dorkos 0.126.2 → 0.126.4

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 (317) hide show
  1. package/dist/bin/cli.js +254 -114
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-BQ66xWcJ.js → AboutPage-CAt15a-r.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-CPbfgXjw.js → ActivityErrorState-s4xAcJQR.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-CesljfZn.js → ActivityPage-BpSggjZV.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-DzhwE0ht.js → ActivityRow-5PJBHIt2.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-BXJkyF5g.js → AdapterIcon-d8mZODCX.js} +1 -1
  9. package/dist/client/assets/AdapterSetupWizard-R-KxNMiM.js +2 -0
  10. package/dist/client/assets/{AgentOptionRow-0VdNzXCF.js → AgentOptionRow-hemBruhh.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-Ldh64iOA.js → AgentPicker-DOba9a77.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-CmAlDGTr.js → AgentRequestCard-RFQOrk-W.js} +1 -1
  13. package/dist/client/assets/{AppearancePage-DmsZPHst.js → AppearancePage-1m4bJ-Rg.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-Ct1W283T.js → ApplyToOverridesDialog-BxeMLhGv.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-B7gezgzA.js → AttentionSignalRow-BoTonsR5.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-Nqvr65_g.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-Bz6XyZ6v.js} +3 -3
  17. package/dist/client/assets/BindingDialog-CILm91iU.js +1 -0
  18. package/dist/client/assets/{BlintzCanvas-BCtfZPrs.js → BlintzCanvas-BFJXKo1L.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-DYksqzaf.js → CanvasCsvContent-DzkaHpEo.js} +3 -3
  20. package/dist/client/assets/{CanvasFileContent-CqEqSxuJ.js → CanvasFileContent-DZf9SjJn.js} +2 -2
  21. package/dist/client/assets/{CanvasModel3dContent-vR6ze4IR.js → CanvasModel3dContent-Cd8hf6Ba.js} +2 -2
  22. package/dist/client/assets/{ChannelComposer-BVACOdph.js → ChannelComposer-YXkkFcyY.js} +10 -10
  23. package/dist/client/assets/{ChatAppsOff-VsPP2Hye.js → ChatAppsOff-X5Y8OHAz.js} +2 -2
  24. package/dist/client/assets/{CodeMirrorDiff-CmKjH03N.js → CodeMirrorDiff-BsQKbrls.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-BtNgazuc.js → CodeMirrorEditor-DnkumDd3.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-D9I-CmNy.js → CommitmentList-BjI2jvMX.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-BORMYDZb.js → CommitmentsPage-7g68FcGR.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-BZ9BxgOi.js → ComputerResourceView-Dcd0e_Oj.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-CbuU9tXK.js → ComputerViewer-Dq3aQyZD.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-uE-Fzp6Y.js → ConnectionAccessLists-CXPn8ICQ.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-D7QTHeQQ.js → ConnectionsPage-DEc4JsR5.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-PS2WWCyB.js → ConventionPage-B7cm4O1D.js} +1 -1
  33. package/dist/client/assets/{ExtensionPageRoute-Cn7bYxGB.js → ExtensionPageRoute-ba2uGsYs.js} +2 -2
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DKGNSXVz.js → FloatingTanStackRouterDevtools-CqogiFob-Dxk_rLHR.js} +1 -1
  35. package/dist/client/assets/{ForwardConsentHost-CLIHtWwq.js → ForwardConsentHost-CNuTTR3q.js} +1 -1
  36. package/dist/client/assets/HandlePage-WIwOCyJg.js +1 -0
  37. package/dist/client/assets/{HeartbeatPage-7MTowke-.js → HeartbeatPage-CEb8SaAx.js} +1 -1
  38. package/dist/client/assets/{KeyEntry-Cf7D0Oo6.js → KeyEntry-CHJpgP6H.js} +1 -1
  39. package/dist/client/assets/{LexicalField-DqvzeMr3.js → LexicalField-B0tWaDy5.js} +1 -1
  40. package/dist/client/assets/{ManagesPage-DxR4zWMf.js → ManagesPage-rcz--gCT.js} +1 -1
  41. package/dist/client/assets/{Marketplace-V_92jKOn.js → Marketplace-wjAUiULQ.js} +4 -4
  42. package/dist/client/assets/{MarketplaceSourcesView-CjCVMP_d.js → MarketplaceSourcesView-BMGnEy8T.js} +1 -1
  43. package/dist/client/assets/{McpAppFrame-4JDJsrmg.js → McpAppFrame-CmwiQHxf.js} +2 -2
  44. package/dist/client/assets/{McpSigninBody-DG1XX7XT.js → McpSigninBody-D99PCc0n.js} +1 -1
  45. package/dist/client/assets/{Model3dViewer-DedBFHsl.js → Model3dViewer-qUwwZnb2.js} +1 -1
  46. package/dist/client/assets/NamePage-B7VSrPmK.js +1 -0
  47. package/dist/client/assets/{NewDirectMessageMenu-C8t7x-sB.js → NewDirectMessageMenu-DyMfEU7i.js} +1 -1
  48. package/dist/client/assets/{NotificationsPage-DwGFE3F6.js → NotificationsPage-BsOaV6Ei.js} +1 -1
  49. package/dist/client/assets/{OpenMeshSwitch-DPmTA9eg.js → OpenMeshSwitch-CjCPWZn0.js} +2 -2
  50. package/dist/client/assets/{OperatorIdentityForm-Cu0h8Xqy.js → OperatorIdentityForm-Cd6B2hxb.js} +1 -1
  51. package/dist/client/assets/{PermissionHistory-zD6ksrl2.js → PermissionHistory-xp6vPQ20.js} +1 -1
  52. package/dist/client/assets/{PermissionsPage-Durcnmie.js → PermissionsPage-DaAJew99.js} +1 -1
  53. package/dist/client/assets/{PersonalityPopover-DuRjJuLj.js → PersonalityPopover-BZaif5Fn.js} +1 -1
  54. package/dist/client/assets/PhotoPage-43WNaavk.js +1 -0
  55. package/dist/client/assets/{PreviewRefusedNotice-hlYrFDQM.js → PreviewRefusedNotice-CCpHgrea.js} +1 -1
  56. package/dist/client/assets/{ProfileFields-x-x8vgNo.js → ProfileFields-DyVqmcPr.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-8WxopRj2.js → ProfilePanelContainer-CMRG6AmB.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-BfciiNpr.js → ProfileRolePicker-Q_hY6ybO.js} +1 -1
  59. package/dist/client/assets/{PromptSuggestionChips-D34Zeaq_.js → PromptSuggestionChips-B5afjbD0.js} +1 -1
  60. package/dist/client/assets/{ReportsToPopover-BhqA5qXi.js → ReportsToPopover-CVF7Rtzh.js} +1 -1
  61. package/dist/client/assets/{RoomSurface-BlMNuQsT.js → RoomSurface-Bz1DfoQD.js} +1 -1
  62. package/dist/client/assets/{RoomsPage-C52AOHIE.js → RoomsPage-4u74yonc.js} +1 -1
  63. package/dist/client/assets/{RunsOnPopover-DLhEKwXF.js → RunsOnPopover-CnUm4LP2.js} +1 -1
  64. package/dist/client/assets/{RuntimeConnectFlow-D3H5Fpkc.js → RuntimeConnectFlow-B0TIITVq.js} +1 -1
  65. package/dist/client/assets/{RuntimeSetupDialog-DPU4QIY9.js → RuntimeSetupDialog-CEUC7GrY.js} +1 -1
  66. package/dist/client/assets/{SeenDevices-CDSHTsL7.js → SeenDevices-CxhuIRp3.js} +2 -2
  67. package/dist/client/assets/{SessionsPage-Crh3D3Jj.js → SessionsPage-l6_Qc7hz.js} +1 -1
  68. package/dist/client/assets/{SettingsDialog-D0Oh-ku1.js → SettingsDialog-GEK8nhI8.js} +4 -4
  69. package/dist/client/assets/{SkillsPage-BPexZwnJ.js → SkillsPage-PlVj6VdA.js} +1 -1
  70. package/dist/client/assets/{TaskDialogWrapper-D6RB8E59.js → TaskDialogWrapper-TspfYk9J.js} +1 -1
  71. package/dist/client/assets/{TasksEmptyState-Di3SbhJM.js → TasksEmptyState-DsHh0blU.js} +2 -2
  72. package/dist/client/assets/{TasksPage-CDLsY1Ww.js → TasksPage-Va0dvkif.js} +1 -1
  73. package/dist/client/assets/{TeamComputerEntry-B_q-oVSs.js → TeamComputerEntry-C6juiObF.js} +1 -1
  74. package/dist/client/assets/{ToolsPage-gvIVTnwf.js → ToolsPage-C0ESG42C.js} +2 -2
  75. package/dist/client/assets/{TopologyGraph-Bp8aL_qw.js → TopologyGraph-M24Edx-I.js} +3 -3
  76. package/dist/client/assets/TourHost-CcN4uCDR.js +1 -0
  77. package/dist/client/assets/{UnlinkDialog-Ddd1Yxfk.js → UnlinkDialog-DlD1cmRZ.js} +1 -1
  78. package/dist/client/assets/{UnreadDivider-LL4_YtF0.js → UnreadDivider-DPD9MQ8-.js} +1 -1
  79. package/dist/client/assets/{WidgetErrorCard-BA3P7hNv.js → WidgetErrorCard-Bte2obmw.js} +3 -3
  80. package/dist/client/assets/{WithheldExtensionsNotice-quqWNbus.js → WithheldExtensionsNotice-CZibLuKA.js} +1 -1
  81. package/dist/client/assets/{WorkView-C_h8sclU.js → WorkView-PsLjURld.js} +15 -15
  82. package/dist/client/assets/{_shell-D9q8zLfr.js → _shell-Ce_cSF7V.js} +2 -2
  83. package/dist/client/assets/{_shell._home-CrTxBB3h.js → _shell._home-DcZcTXu8.js} +1 -1
  84. package/dist/client/assets/{_shell._home.activity-2M0BJkbQ.js → _shell._home.activity-BXw8iSC4.js} +1 -1
  85. package/dist/client/assets/_shell._home.index-BleaCq_y.js +3 -0
  86. package/dist/client/assets/{_shell._home.tasks-Dfrqv2nl.js → _shell._home.tasks-gdbnkq3-.js} +1 -1
  87. package/dist/client/assets/{_shell._home.workspaces-DPLQXDdH.js → _shell._home.workspaces-BCwJX783.js} +1 -1
  88. package/dist/client/assets/{_shell.channels-CJqfUTZ1.js → _shell.channels-D-lMqbSA.js} +1 -1
  89. package/dist/client/assets/_shell.connections-BFmTpceq.js +1 -0
  90. package/dist/client/assets/{_shell.feedback-requests-BeWCqScf.js → _shell.feedback-requests-NKpm6Uhu.js} +1 -1
  91. package/dist/client/assets/_shell.marketplace-DB7NSxDU.js +1 -0
  92. package/dist/client/assets/_shell.marketplace_.sources-WU9ILkRM.js +1 -0
  93. package/dist/client/assets/_shell.session-CchZWYRA.js +1 -0
  94. package/dist/client/assets/{_shell.team-EPvcS7RS.js → _shell.team-DcCRbdAb.js} +4 -4
  95. package/dist/client/assets/{_shell.threads-NJDzq9dv.js → _shell.threads-BLy6Cgqk.js} +1 -1
  96. package/dist/client/assets/_shell.x._extensionId-CVW0g7Rb.js +1 -0
  97. package/dist/client/assets/_shell.x._extensionId_._-CVW0g7Rb.js +1 -0
  98. package/dist/client/assets/{abnfDiagram-WEYOIA3C-DUHshdrR.js → abnfDiagram-WEYOIA3C-DpkXbw1_.js} +1 -1
  99. package/dist/client/assets/{access-copy-DHfPjN3G.js → access-copy-Y2_F9uAx.js} +1 -1
  100. package/dist/client/assets/{arc-sP6zNsGB.js → arc-B3bZAGvi.js} +1 -1
  101. package/dist/client/assets/{architectureDiagram-ZHVYKT53-C8PTjsPx.js → architectureDiagram-ZHVYKT53-BKR1sFvp.js} +1 -1
  102. package/dist/client/assets/{banner-CVrzHqOT.js → banner-CqhUGJmy.js} +2 -2
  103. package/dist/client/assets/{blockDiagram-RJAE7QA3-Cydde2fz.js → blockDiagram-RJAE7QA3-C2I50BMQ.js} +1 -1
  104. package/dist/client/assets/{c4Diagram-XDPPPE54-DbM6KAK7.js → c4Diagram-XDPPPE54-dhHi_wUH.js} +1 -1
  105. package/dist/client/assets/{card-DA_Z-FYX.js → card-CM7-_8nD.js} +1 -1
  106. package/dist/client/assets/channel-NlrM9BR7.js +1 -0
  107. package/dist/client/assets/{chunk-2E7WHVMD-CEbspaNh.js → chunk-2E7WHVMD-B0B27SHJ.js} +1 -1
  108. package/dist/client/assets/{chunk-2Q5K7J3B-DDP1SiE0.js → chunk-2Q5K7J3B-dsUDjsr2.js} +1 -1
  109. package/dist/client/assets/{chunk-4EMNKR2T-BFjozJqd.js → chunk-4EMNKR2T-C3IdUlS9.js} +1 -1
  110. package/dist/client/assets/{chunk-55XCU76K-0JSp6acZ.js → chunk-55XCU76K-D6qgX8rY.js} +1 -1
  111. package/dist/client/assets/{chunk-5VM5RSS4-DswTXnmp.js → chunk-5VM5RSS4-CWhRZZS1.js} +1 -1
  112. package/dist/client/assets/{chunk-JWPE2WC7-D0PYncYV.js → chunk-JWPE2WC7-Bd3RyNB2.js} +1 -1
  113. package/dist/client/assets/{chunk-VQ5W62QI-r5T-ZVBs.js → chunk-VQ5W62QI-HqUjzAO7.js} +1 -1
  114. package/dist/client/assets/{chunk-XXDRQBXY-D8kkjktE.js → chunk-XXDRQBXY-CfeGRauy.js} +1 -1
  115. package/dist/client/assets/{chunk-ZCHMQSOR-D6XtRzln.js → chunk-ZCHMQSOR-D30UE34C.js} +2 -2
  116. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-DUPDMGfm.js → classDiagram-v2-4MYWR3UA-ClIZEeNx.js} +1 -1
  117. package/dist/client/assets/{command-BvXBgZfv.js → command-DuhX52Bi.js} +1 -1
  118. package/dist/client/assets/{cose-bilkent-JH36ORCC-tiQpE-Q8.js → cose-bilkent-JH36ORCC-C_MZbmxw.js} +1 -1
  119. package/dist/client/assets/{cpu-mx7zDf7k.js → cpu-BMUMZCWW.js} +1 -1
  120. package/dist/client/assets/{cynefin-EF2NZ3EQ-BjAUxFfb.js → cynefin-EF2NZ3EQ-DjzC1gsw.js} +1 -1
  121. package/dist/client/assets/{cynefinDiagram-WF24UDRP-PmlyltXR.js → cynefinDiagram-WF24UDRP-Dnu1pf_9.js} +1 -1
  122. package/dist/client/assets/{dagre-NK4GIZVX-DDePjPkn.js → dagre-NK4GIZVX-Bruwoqfg.js} +1 -1
  123. package/dist/client/assets/{diagram-CBK3MWTC-D7N3T4Fx.js → diagram-CBK3MWTC-Co7nk3xQ.js} +1 -1
  124. package/dist/client/assets/{diagram-I5XIIV2D-BfZHSbR2.js → diagram-I5XIIV2D-CDJY0Snc.js} +1 -1
  125. package/dist/client/assets/{diagram-ODIL2UCW-sXAa9bzN.js → diagram-ODIL2UCW-CF0utpvI.js} +1 -1
  126. package/dist/client/assets/{diagram-PFBEJUXE-Dfd_61WO.js → diagram-PFBEJUXE-BrLRX5Ip.js} +1 -1
  127. package/dist/client/assets/{diagram-RJA3I4VV-BCzdEfnM.js → diagram-RJA3I4VV-BOo6-thr.js} +1 -1
  128. package/dist/client/assets/{diagram-TYUNFSNR-BMqtz6sZ.js → diagram-TYUNFSNR-B-206XZy.js} +1 -1
  129. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-CyWj1615.js → ebnfDiagram-V4P3TTPT-C6SZjvSQ.js} +1 -1
  130. package/dist/client/assets/{elk-QONTBCTQ-BkQMBXse.js → elk-QONTBCTQ-B_QHOQ8G.js} +1 -1
  131. package/dist/client/assets/{empty-state-Dv5iV4jb.js → empty-state-BzWMBBQZ.js} +1 -1
  132. package/dist/client/assets/{erDiagram-KYQIGQAA-DiPsX7uU.js → erDiagram-KYQIGQAA-BTKJgVOK.js} +1 -1
  133. package/dist/client/assets/{execution-config-Bej0Ot8e.js → execution-config-D_PgYyCI.js} +1 -1
  134. package/dist/client/assets/{file-DXbyb23e.js → file-DiYwTQdD.js} +1 -1
  135. package/dist/client/assets/{file-exclamation-point-C8XqHyzY.js → file-exclamation-point-CnQYdJiV.js} +1 -1
  136. package/dist/client/assets/{file-text-CRTgqqkn.js → file-text-DLPhIP0f.js} +1 -1
  137. package/dist/client/assets/{find-latest-widget-fence-D1i7qNny.js → find-latest-widget-fence-BYtG5PzD.js} +3 -3
  138. package/dist/client/assets/{flowDiagram-IUGLLWBU-BSM44aJP.js → flowDiagram-IUGLLWBU-o2In4cGl.js} +1 -1
  139. package/dist/client/assets/{form-DYSiVEri.js → form-DUFlQ-yL.js} +1 -1
  140. package/dist/client/assets/{format-cron-DYYwmo-o.js → format-cron-D5dtMPdH.js} +1 -1
  141. package/dist/client/assets/{ganttDiagram-R7GPNTJY-BWCjYexX.js → ganttDiagram-R7GPNTJY-WwrWLB2J.js} +1 -1
  142. package/dist/client/assets/{git-branch-1zYKSuur.js → git-branch-uZFa3Tmr.js} +1 -1
  143. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-ULC7Zunc.js → gitGraphDiagram-PDYL7XHY-C1yG6xrf.js} +1 -1
  144. package/dist/client/assets/{graph-BsZzo5TN.js → graph-C10tj8MW.js} +1 -1
  145. package/dist/client/assets/{heart-C4CSHUW7.js → heart--8btr31M.js} +1 -1
  146. package/dist/client/assets/{highlighted-body-KPVGNVTW-CFECg7iB.js → highlighted-body-KPVGNVTW-DGp-Vg6c.js} +1 -1
  147. package/dist/client/assets/{image-lightbox-M9t3Wulc.js → image-lightbox-BfwZy_vF.js} +1 -1
  148. package/dist/client/assets/{image-off-c01kxBAm.js → image-off-Bmtj2Xtq.js} +1 -1
  149. package/dist/client/assets/{index-BScgHCO_.js → index-8hXtJ0Xw.js} +1 -1
  150. package/dist/client/assets/{index-DG13Cp5o.js → index-B5i5B8F0.js} +1 -1
  151. package/dist/client/assets/{index-DzHj8lCz.js → index-BBaFVr5z.js} +9 -9
  152. package/dist/client/assets/{index-DIDUjTkq.js → index-BCZa5De0.js} +1 -1
  153. package/dist/client/assets/{index-BTGRc0hC.js → index-BE8yM241.js} +1 -1
  154. package/dist/client/assets/{index-XEE1k4cl.js → index-BHXG7bNX.js} +1 -1
  155. package/dist/client/assets/{index-BqwCOIbF.js → index-BJ_fl1Gy.js} +1 -1
  156. package/dist/client/assets/{index-DhoaVQXu.js → index-BbIFaQ9_.js} +1 -1
  157. package/dist/client/assets/{index-Dt7RONID.js → index-BlHuuCes.js} +1 -1
  158. package/dist/client/assets/{index-C3swXqWW.js → index-BtrV6g02.js} +1 -1
  159. package/dist/client/assets/{index-C1XazYWZ.js → index-C-tNYOVV.js} +1 -1
  160. package/dist/client/assets/{index-BYY8HEOz.js → index-C3LZBxuM.js} +1 -1
  161. package/dist/client/assets/{index-B-7P1Q9s.js → index-CO9QUYdl.js} +1 -1
  162. package/dist/client/assets/{index-BIVIHPoe.js → index-CP47qL8N.js} +1 -1
  163. package/dist/client/assets/{index-BRH6C3LJ.js → index-CYM65t4i.js} +1 -1
  164. package/dist/client/assets/{index-DhkfALZp.js → index-CaZ9yNIm.js} +1 -1
  165. package/dist/client/assets/index-CaxFHvSK.js +1 -0
  166. package/dist/client/assets/index-CdHuEKYh.js +1 -0
  167. package/dist/client/assets/{index-YXyEu3Ia.js → index-CoL3MmPh.js} +1 -1
  168. package/dist/client/assets/{index-Du4HX97h.js → index-CtN6_QCQ.js} +2 -2
  169. package/dist/client/assets/{index-JG_0k1NX.js → index-CvIKejlx.js} +1 -1
  170. package/dist/client/assets/{index-FwAvbbet.js → index-CypEgDik.js} +1 -1
  171. package/dist/client/assets/index-Cz9N1NHd.js +1 -0
  172. package/dist/client/assets/{index-CnltS8ym.js → index-D-ZRSiaH.js} +1 -1
  173. package/dist/client/assets/{index-DQTTC52E.js → index-D8ZcqMea.js} +1 -1
  174. package/dist/client/assets/{index-CAjKQnAd.js → index-D97clHqL.js} +1 -1
  175. package/dist/client/assets/index-DAaYbj1s.js +1 -0
  176. package/dist/client/assets/{index-B3xeyV6n.js → index-DI9IsN-O.js} +1 -1
  177. package/dist/client/assets/{index-DhYnXLRT.js → index-DLPkp7I9.js} +1 -1
  178. package/dist/client/assets/{index-CAAsqmfP.js → index-DMTfnznD.js} +1 -1
  179. package/dist/client/assets/{index-BSxkprTm.js → index-DZQUx5pX.js} +3 -3
  180. package/dist/client/assets/{index-B_he44rF.js → index-DamNtsio.js} +1 -1
  181. package/dist/client/assets/{index-Ce3HZQem.js → index-DenTxAiI.js} +1 -1
  182. package/dist/client/assets/{index-jLIoULQt.js → index-DmG7yphM.js} +1 -1
  183. package/dist/client/assets/{index-BnXWm8Db.js → index-Dqouol3i.js} +1 -1
  184. package/dist/client/assets/{index-DsasLE1l.js → index-Dsj1fDYU.js} +1 -1
  185. package/dist/client/assets/{index-Br35Gqfz.js → index-E5KPj_ZX.js} +1 -1
  186. package/dist/client/assets/{index-DrENuQdJ.js → index-LGTvsZzp.js} +1 -1
  187. package/dist/client/assets/{index-uLbyd6YP.js → index-Nr39AP-T.js} +1 -1
  188. package/dist/client/assets/{index-DrQqkQq_.js → index-YrSNUw95.js} +1 -1
  189. package/dist/client/assets/index-fge85Gub.js +1053 -0
  190. package/dist/client/assets/{index-D847rJXW.js → index-mweR5xOP.js} +1 -1
  191. package/dist/client/assets/{index-LpaxG4VS.js → index-ocZzSFoR.js} +1 -1
  192. package/dist/client/assets/{index.esm-CZ68Qd2t.js → index.esm-BEGwgVfU.js} +1 -1
  193. package/dist/client/assets/{infoDiagram-MVDRKAX5-BCjhXqIT.js → infoDiagram-MVDRKAX5-oeBcoEBA.js} +1 -1
  194. package/dist/client/assets/{inline-code-BKPMIXZR.js → inline-code-7dwi7wWG.js} +1 -1
  195. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-C9rsv2nh.js → ishikawaDiagram-HPEHV2GE-CLIGz304.js} +1 -1
  196. package/dist/client/assets/{journeyDiagram-BOSHW7O7-BRYr1XL1.js → journeyDiagram-BOSHW7O7-Cg0HlPT5.js} +1 -1
  197. package/dist/client/assets/{kanban-definition-FNSA4HC5-2ey8FXEn.js → kanban-definition-FNSA4HC5-DXaqYXhm.js} +1 -1
  198. package/dist/client/assets/{layers-DE3wjQuk.js → layers-BhECZJWp.js} +1 -1
  199. package/dist/client/assets/{lightbulb-BXJIRUdm.js → lightbulb-DjMxuZnu.js} +1 -1
  200. package/dist/client/assets/{link-2-DzWm9OxA.js → link-2-BY2WyWzK.js} +1 -1
  201. package/dist/client/assets/{list-runtime-types-BhkZkTrB.js → list-runtime-types-hMouIGtG.js} +1 -1
  202. package/dist/client/assets/{markdown-content-Bk9lCksw.js → markdown-content-DV3AiG76.js} +1 -1
  203. package/dist/client/assets/{mention-pill-os_7QQu2.js → mention-pill-Db0XBC6Z.js} +1 -1
  204. package/dist/client/assets/{mermaid.core-BcRUBvZd.js → mermaid.core-_ZqWvaFB.js} +4 -4
  205. package/dist/client/assets/{message-square-off-DuOiETNI.js → message-square-off-w0__0O5g.js} +1 -1
  206. package/dist/client/assets/{mindmap-definition-6OY57UG3-DBhXkS2i.js → mindmap-definition-6OY57UG3-BRVkHL68.js} +1 -1
  207. package/dist/client/assets/{more-details-Bt9nlPmS.js → more-details-BUolHzrY.js} +1 -1
  208. package/dist/client/assets/{owner-notice-4ZSBxa2K.js → owner-notice-Cn5EUxgh.js} +1 -1
  209. package/dist/client/assets/{package-BmOMrNwc.js → package-BafFSryH.js} +1 -1
  210. package/dist/client/assets/{page-container-LomhzyuS.js → page-container-BCdJ_DsH.js} +1 -1
  211. package/dist/client/assets/{pane-resize-handle-BOtzx5Q4.js → pane-resize-handle-Bar-FdkY.js} +1 -1
  212. package/dist/client/assets/{paperclip-C1tkiT74.js → paperclip-DY4e-IlK.js} +1 -1
  213. package/dist/client/assets/{path-input-JHTlL97W.js → path-input-SZl4NGTs.js} +1 -1
  214. package/dist/client/assets/{pegDiagram-ECIUJNBX-B01fb3t0.js → pegDiagram-ECIUJNBX-D9J7XmXK.js} +1 -1
  215. package/dist/client/assets/{pieDiagram-GNMPY74T-BJ7JYrTk.js → pieDiagram-GNMPY74T-myMGqtsR.js} +1 -1
  216. package/dist/client/assets/{plug-CsqfQsYq.js → plug-BdWCGVJg.js} +1 -1
  217. package/dist/client/assets/primer-trigger-r8N0YY5e.js +3 -0
  218. package/dist/client/assets/{profile-errors-CpvSy5wY.js → profile-errors-DymWFWiP.js} +1 -1
  219. package/dist/client/assets/{progress-qB87L0zJ.js → progress-es667_cM.js} +1 -1
  220. package/dist/client/assets/{quadrantDiagram-D57K4MC3-mJYGGmOV.js → quadrantDiagram-D57K4MC3-D5_2lcqK.js} +1 -1
  221. package/dist/client/assets/{query-error-state-MyJ1ivia.js → query-error-state-BNPduDBN.js} +1 -1
  222. package/dist/client/assets/{radio-DJV7l0fv.js → radio-DpWUX1KL.js} +1 -1
  223. package/dist/client/assets/{railroadDiagram-Y72NRBL7-BlXWwQe2.js → railroadDiagram-Y72NRBL7-D15ELhSC.js} +1 -1
  224. package/dist/client/assets/{registry-tJrGs7kB.js → registry-5Qudcjd5.js} +4 -4
  225. package/dist/client/assets/registry-DvKu39S1.js +1 -0
  226. package/dist/client/assets/relay-trace-schemas-DURazPP9.js +6 -0
  227. package/dist/client/assets/{repeat-CBnopqBr.js → repeat-HOHWZc6L.js} +1 -1
  228. package/dist/client/assets/{requirementDiagram-EQYSW5RA-Dqr1Y74x.js → requirementDiagram-EQYSW5RA-CHcEVlsR.js} +1 -1
  229. package/dist/client/assets/{room-files-source-BFo0FEUP.js → room-files-source-BO3E2ed0.js} +1 -1
  230. package/dist/client/assets/{rotate-ccw-clock-D9XRHj5E.js → rotate-ccw-clock-Dniulnw5.js} +1 -1
  231. package/dist/client/assets/{rotate-cw-DNa7ENG3.js → rotate-cw-um9OzAM7.js} +1 -1
  232. package/dist/client/assets/{sankeyDiagram-SY24JHO5-DGYZs_kW.js → sankeyDiagram-SY24JHO5-_R5087R3.js} +1 -1
  233. package/dist/client/assets/{scroll-area-Bf6IGziJ.js → scroll-area-MdXbnM77.js} +1 -1
  234. package/dist/client/assets/search-x-CHNgYj0F.js +6 -0
  235. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BW3u4L9y.js → sequenceDiagram-BLEHNHQU-BzHmSHMF.js} +1 -1
  236. package/dist/client/assets/{shield-x-WGxwrtNV.js → shield-x-CDXAW9YF.js} +1 -1
  237. package/dist/client/assets/{signed-in-eV4_EXuv.js → signed-in-JAMHtSjx.js} +1 -1
  238. package/dist/client/assets/{sizeCapture-INFHLROL-C1TpueOu.js → sizeCapture-INFHLROL-CqA3cZcy.js} +1 -1
  239. package/dist/client/assets/{soul-file-e1iYX9IV.js → soul-file-BcaDvIdL.js} +1 -1
  240. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DvrHUauN.js → stateDiagram-v2-A6IESKWZ-RAA8YyBW.js} +1 -1
  241. package/dist/client/assets/{swimlanes-B3ENRKFQ-BUbTcoId.js → swimlanes-B3ENRKFQ-BQvgJIcj.js} +1 -1
  242. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-iDgTYazX.js +8 -0
  243. package/dist/client/assets/{table-DsxLk3Gx.js → table-BcJvj9rx.js} +1 -1
  244. package/dist/client/assets/{timeline-definition-JXYKGLGB-CzbVpGxn.js → timeline-definition-JXYKGLGB-DXi0saeN.js} +1 -1
  245. package/dist/client/assets/{trust-posture-Blofy7eE.js → trust-posture-vH4plBRD.js} +1 -1
  246. package/dist/client/assets/{unplug-B6dUhqA7.js → unplug-CK2bPGpg.js} +1 -1
  247. package/dist/client/assets/untrusted-text-BDygHCRk.js +1 -0
  248. package/dist/client/assets/{unverified-catalog-notice-6pwZtIjx.js → unverified-catalog-notice-WMkPDdUp.js} +1 -1
  249. package/dist/client/assets/{use-bindings-BgXZ0D7k.js → use-bindings-h_mG9d64.js} +1 -1
  250. package/dist/client/assets/{use-composer-prefs--zO2mm_M.js → use-composer-prefs-DhCnTsrF.js} +1 -1
  251. package/dist/client/assets/{use-connector-management-9Q7wHb06.js → use-connector-management-CXVz2xe3.js} +1 -1
  252. package/dist/client/assets/{use-deep-link-scroll-CXqwdwGr.js → use-deep-link-scroll-DYOZ5k0G.js} +1 -1
  253. package/dist/client/assets/{use-delete-binding-BBQNMtUY.js → use-delete-binding-CHAeTC_Q.js} +1 -1
  254. package/dist/client/assets/{use-dev-links-C643CCcq.js → use-dev-links-CM2NIeqy.js} +1 -1
  255. package/dist/client/assets/{use-direct-message-panel-BD_daG2E.js → use-direct-message-panel-DXTH05Ym.js} +1 -1
  256. package/dist/client/assets/use-external-adapter-catalog-DKlBkkvF.js +1 -0
  257. package/dist/client/assets/use-full-activity-feed-QZAZ5vBJ.js +1 -0
  258. package/dist/client/assets/use-is-below-desktop-DS51QTwj.js +1 -0
  259. package/dist/client/assets/{use-local-browser-P93oA-F5.js → use-local-browser-43FpcgCM.js} +1 -1
  260. package/dist/client/assets/{use-mesh-topology-B0k0gLoW.js → use-mesh-topology-Bw7MmKA9.js} +1 -1
  261. package/dist/client/assets/{use-mounted-ref-DE7EQsBF.js → use-mounted-ref-Cuui7-gf.js} +1 -1
  262. package/dist/client/assets/{use-notification-prefs-B8JtshQ0.js → use-notification-prefs-CJnF55Rv.js} +1 -1
  263. package/dist/client/assets/use-pending-read-DB25CO5E.js +1 -0
  264. package/dist/client/assets/{use-personality-commit-Dh5Sejj_.js → use-personality-commit-p6Of1UxX.js} +1 -1
  265. package/dist/client/assets/{use-promo-activation-C9FWA7ru.js → use-promo-activation-CxG-kZJQ.js} +3 -3
  266. package/dist/client/assets/{use-promo-dismissals-BIfafj9f.js → use-promo-dismissals-DeNbRWOh.js} +1 -1
  267. package/dist/client/assets/{use-pulse-freshness-CxzVMmVK.js → use-pulse-freshness-CdRkKThf.js} +1 -1
  268. package/dist/client/assets/{use-room-follow-claim-B1QPFaUb.js → use-room-follow-claim-_B7HonZx.js} +1 -1
  269. package/dist/client/assets/{use-room-sessions-CdjzO67_.js → use-room-sessions-CrFskgCJ.js} +1 -1
  270. package/dist/client/assets/{use-roving-tab-list-Nu-MIapD.js → use-roving-tab-list-DSjW4_wm.js} +1 -1
  271. package/dist/client/assets/use-session-canvas-KguPfnsc.js +27 -0
  272. package/dist/client/assets/{use-status-budget-DgeTxC3h.js → use-status-budget-CTereFSr.js} +3 -3
  273. package/dist/client/assets/{use-transform-CiJqtMBf.js → use-transform-YUDqOhoc.js} +1 -1
  274. package/dist/client/assets/{use-unclaimed-chats-Blkq6U4D.js → use-unclaimed-chats-B9ChucvA.js} +1 -1
  275. package/dist/client/assets/use-update-config-BH0agtZh.js +1 -0
  276. package/dist/client/assets/{useMutationState-lbcdmnfE.js → useMutationState-TJGtJT5R.js} +1 -1
  277. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-BM36oESm.js → usecaseDiagram-WPOLBNNX-Cjs1EpVL.js} +1 -1
  278. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Zrybcs91.js → vennDiagram-Q3Y3IDCW-BtgH-ZyN.js} +1 -1
  279. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-CO4pzGG0.js → wardleyDiagram-IVAIDKWA-BCWHQ18G.js} +1 -1
  280. package/dist/client/assets/{xychartDiagram-4URNHDU4-pi_wF1CM.js → xychartDiagram-4URNHDU4-CUBPWq_V.js} +1 -1
  281. package/dist/client/index.html +1 -1
  282. package/dist/server/index.js +7695 -5486
  283. package/dist/server/index.js.map +2 -2
  284. package/package.json +5 -5
  285. package/dist/client/assets/AdapterSetupWizard-CwKYl1vG.js +0 -2
  286. package/dist/client/assets/BindingDialog-CpBZoSZU.js +0 -1
  287. package/dist/client/assets/HandlePage-BjlcYr_l.js +0 -1
  288. package/dist/client/assets/NamePage-A8X09lY7.js +0 -1
  289. package/dist/client/assets/PhotoPage-DP5WoeFd.js +0 -1
  290. package/dist/client/assets/TourHost-Cg8EHvod.js +0 -1
  291. package/dist/client/assets/_shell._home.index-BTJhhEWN.js +0 -3
  292. package/dist/client/assets/_shell.connections-Cpe1hru3.js +0 -1
  293. package/dist/client/assets/_shell.marketplace-CzLqm8iR.js +0 -1
  294. package/dist/client/assets/_shell.marketplace_.sources-DtraxnMx.js +0 -1
  295. package/dist/client/assets/_shell.session-72JEfodU.js +0 -1
  296. package/dist/client/assets/_shell.x._extensionId-CcJi8pKR.js +0 -1
  297. package/dist/client/assets/_shell.x._extensionId_._-CcJi8pKR.js +0 -1
  298. package/dist/client/assets/channel-DMgpNBDz.js +0 -1
  299. package/dist/client/assets/index-B6Scr7KJ.js +0 -1053
  300. package/dist/client/assets/index-DyN65ufd.js +0 -1
  301. package/dist/client/assets/index-UJq1qaku.js +0 -1
  302. package/dist/client/assets/index-e6oawwKv.js +0 -1
  303. package/dist/client/assets/index-j30EyYIU.js +0 -1
  304. package/dist/client/assets/primer-trigger-DLdK7lVr.js +0 -3
  305. package/dist/client/assets/registry-BrjQCdmG.js +0 -1
  306. package/dist/client/assets/relay-trace-schemas-TH0-GYCB.js +0 -6
  307. package/dist/client/assets/search-x-DFBBEouE.js +0 -6
  308. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-wkooBe_N.js +0 -8
  309. package/dist/client/assets/untrusted-text-pHjcUwfI.js +0 -1
  310. package/dist/client/assets/use-adapter-catalog-J43bUHJu.js +0 -1
  311. package/dist/client/assets/use-external-adapter-catalog-BjbC1V6t.js +0 -1
  312. package/dist/client/assets/use-full-activity-feed-DUH8r8jx.js +0 -1
  313. package/dist/client/assets/use-is-below-desktop-DAZnwJGB.js +0 -1
  314. package/dist/client/assets/use-pending-read-DeGO1wGC.js +0 -1
  315. package/dist/client/assets/use-relay-config-DQE3dmJ2.js +0 -1
  316. package/dist/client/assets/use-session-canvas-BfKGOpNy.js +0 -27
  317. package/dist/client/assets/use-update-config-BFFW_6Mc.js +0 -1
@@ -1,15 +1,15 @@
1
- import{f4 as Ee,a1 as xe,aY as Re,r as ve,a2 as Se,j,G as Ce}from"./index-B6Scr7KJ.js";import{u as Oe}from"./index-JG_0k1NX.js";import{r as Te}from"./use-session-canvas-BfKGOpNy.js";import"./rotate-cw-DNa7ENG3.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CZ68Qd2t.js";import"./WidgetErrorCard-BA3P7hNv.js";import"./index-B3xeyV6n.js";import"./card-DA_Z-FYX.js";import"./progress-qB87L0zJ.js";import"./markdown-content-Bk9lCksw.js";import"./table-DsxLk3Gx.js";import"./package-BmOMrNwc.js";import"./heart-C4CSHUW7.js";import"./git-branch-1zYKSuur.js";import"./file-text-CRTgqqkn.js";import"./file-DXbyb23e.js";import"./McpAppFrame-4JDJsrmg.js";import"./more-details-Bt9nlPmS.js";var he={exports:{}};/* @license
1
+ import{f3 as Ee,a1 as xe,aW as Re,r as ve,a2 as Se,j,G as Ce}from"./index-fge85Gub.js";import{u as Oe}from"./index-CvIKejlx.js";import{r as Te}from"./use-session-canvas-KguPfnsc.js";import"./rotate-cw-um9OzAM7.js";import"./query-keys-DeYqUDia.js";import"./index.esm-BEGwgVfU.js";import"./WidgetErrorCard-Bte2obmw.js";import"./index-DI9IsN-O.js";import"./card-CM7-_8nD.js";import"./progress-es667_cM.js";import"./markdown-content-DV3AiG76.js";import"./table-BcJvj9rx.js";import"./package-BafFSryH.js";import"./heart--8btr31M.js";import"./git-branch-uZFa3Tmr.js";import"./file-text-DLPhIP0f.js";import"./file-DiYwTQdD.js";import"./McpAppFrame-CmwiQHxf.js";import"./more-details-BUolHzrY.js";var he={exports:{}};/* @license
2
2
  Papa Parse
3
3
  v5.7.0
4
4
  https://github.com/mholt/PapaParse
5
5
  License: MIT
6
- */var Ie=he.exports,ke;function Ae(){return ke||(ke=1,(function(H,X){((G,m)=>{H.exports=m()})(Ie,function G(){var m=typeof self<"u"?self:typeof window<"u"?window:m!==void 0?m:{},C=!m.document&&!!m.postMessage,N=m.IS_PAPA_WORKER||!1,J={},Y=0,o={};function P(t){return t.charCodeAt(0)===65279?t.slice(1):t}function z(t){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var r=de(e);r.chunkSize=parseInt(r.chunkSize),e.step||e.chunk||(r.chunkSize=null),this._handle=new pe(r),(this._handle.streamer=this)._config=r}).call(this,t),this.parseChunk=function(e,r){var s=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<s){let g=this._config.newline;g||(i=this._config.quoteChar||'"',g=this._handle.guessLineEndings(e,i)),e=[...e.split(g).slice(s)].join(g)}this.isFirstChunk&&E(this._config.beforeFirstChunk)&&(i=this._config.beforeFirstChunk(e))!==void 0&&(e=i),this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e,i=(this._partialLine="",this._handle.parse(s,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=i.meta.cursor,s=(this._finished||(this._partialLine=s.substring(e-this._baseIndex),this._baseIndex=e),i&&i.data&&(this._rowCount+=i.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),N)m.postMessage({results:i,workerId:o.WORKER_ID,finished:s});else if(E(this._config.chunk)&&!r){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=i=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),this._completed||!s||!E(this._config.complete)||i&&i.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),s||i&&i.meta.paused||this._nextChunk(),i}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):N&&this._config.error&&m.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function re(t){var e;(t=t||{}).chunkSize||(t.chunkSize=o.RemoteChunkSize),z.call(this,t),this._nextChunk=C?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(r){this._input=r,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),C||(e.onload=$(this._chunkLoaded,this),e.onerror=$(this._chunkError,this)),e.ontimeout=$(this._chunkTimeout,this),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!C),this._config.downloadTimeout&&!C&&(e.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var r,s=this._config.downloadRequestHeaders;for(r in s)e.setRequestHeader(r,s[r])}var i;this._config.chunkSize&&(i=this._start+this._config.chunkSize-1,e.setRequestHeader("Range","bytes="+this._start+"-"+i));try{e.send(this._config.downloadRequestBody)}catch(g){this._chunkError(g.message)}C&&e.status===0&&this._chunkError()}},this._chunkLoaded=function(){e.readyState===4&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize||e.responseText.length,this._finished=!this._config.chunkSize||this._start>=(r=>(r=r.getResponseHeader("Content-Range"))!==null?parseInt(r.substring(r.lastIndexOf("/")+1)):-1)(e),this.parseChunk(e.responseText)))},this._chunkError=function(r){r=e.statusText||r,this._sendError(new Error(r))},this._chunkTimeout=function(){this._chunkError("Request timed out after "+this._config.downloadTimeout+"ms")}}function oe(t){(t=t||{}).chunkSize||(t.chunkSize=o.LocalChunkSize),z.call(this,t);var e,r,s=typeof FileReader<"u";this.stream=function(i){this._input=i,r=i.slice||i.webkitSlice||i.mozSlice,s?((e=new FileReader).onload=$(this._chunkLoaded,this),e.onerror=$(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var i=this._input,g=(this._config.chunkSize&&(g=Math.min(this._start+this._config.chunkSize,this._input.size),i=r.call(i,this._start,g)),e.readAsText(i,this._config.encoding));s||this._chunkLoaded({target:{result:g}})},this._chunkLoaded=function(i){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(i.target.result)},this._chunkError=function(){this._sendError(e.error)}}function ie(t){var e;z.call(this,t=t||{}),this.stream=function(r){return e=r,this._nextChunk()},this._nextChunk=function(){var r,s;if(!this._finished)return r=this._config.chunkSize,e=r?(s=e.substring(0,r),e.substring(r)):(s=e,""),this._finished=!e,this.parseChunk(s)}}function ue(t){z.call(this,t=t||{});var e=[],r=!0,s=!1;this.pause=function(){z.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){z.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(i){this._input=i,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&e.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):r=!0},this._streamData=$(function(i){try{e.push(typeof i=="string"?i:i.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(g){this._streamError(g)}},this),this._streamError=$(function(i){this._streamCleanUp(),this._sendError(i)},this),this._streamEnd=$(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=$(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function pe(t){var e,r,s,i,g=Math.pow(2,53),I=-g,U=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Q=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,w=this,A=0,u=0,D=!1,l=!1,d=[],n={data:[],errors:[],meta:{}};function F(p){return t.skipEmptyLines==="greedy"?p.join("").trim()==="":p.length===1&&p[0].length===0}function k(){if(n&&s&&(M("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(n.data=n.data.filter(function(a){return!F(a)})),x()){let a=function(R){d.push(R)};if(n)if(Array.isArray(n.data[0])){for(var p=0;x()&&p<n.data.length;p++)n.data[p].forEach(a);n.data.splice(0,1)}else n.data.forEach(a)}function f(a,R){for(var O=t.header?{}:[],_=0;_<a.length;_++){var y=_,c=a[_],c=((q,h)=>(v=>(t.dynamicTypingFunction&&t.dynamicTyping[v]===void 0&&(t.dynamicTyping[v]=t.dynamicTypingFunction(v)),(t.dynamicTyping[v]||t.dynamicTyping)===!0))(q)?h==="true"||h==="TRUE"||h!=="false"&&h!=="FALSE"&&((v=>{if(U.test(v)&&(v=parseFloat(v),I<v&&v<g))return 1})(h)?parseFloat(h):Q.test(h)?new Date(h):h===""?null:h):h)(y=t.header?_>=d.length?"__parsed_extra":d[_]:y,c=t.transform?t.transform(c,y):c);y==="__parsed_extra"?(O[y]=O[y]||[],O[y].push(c)):O[y]=c}return t.header&&(_>d.length?M("FieldMismatch","TooManyFields","Too many fields: expected "+d.length+" fields but parsed "+_,u+R):_<d.length&&M("FieldMismatch","TooFewFields","Too few fields: expected "+d.length+" fields but parsed "+_,u+R)),O}var b;n&&(t.header||t.dynamicTyping||t.transform)&&(b=1,!n.data.length||Array.isArray(n.data[0])?(n.data=n.data.map(f),b=n.data.length):n.data=f(n.data,0),t.header&&n.meta&&(n.meta.fields=d),u+=b)}function x(){return t.header&&d.length===0}function M(p,f,b,a){p={type:p,code:f,message:b},a!==void 0&&(p.row=a),n.errors.push(p)}E(t.step)&&(i=t.step,t.step=function(p){n=p,x()?k():(k(),n.data.length!==0&&(A+=p.data.length,t.preview&&A>t.preview?r.abort():(n.data=n.data[0],i(n,w))))}),this.parse=function(p,f,b){var a=t.quoteChar||'"',a=(t.newline||(t.newline=this.guessLineEndings(p,a)),s=!1,t.delimiter?E(t.delimiter)&&(t.delimiter=t.delimiter(p),n.meta.delimiter=t.delimiter):((a=((R,O,_,y,c)=>{var q,h,v,Z;c=c||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var ee=0;ee<c.length;ee++){for(var B,se=c[ee],T=0,K=0,S=0,L=(v=void 0,new le({comments:y,delimiter:se,newline:O,preview:10}).parse(R)),V=0;V<L.data.length;V++)_&&F(L.data[V])?S++:(B=L.data[V].length,K+=B,v===void 0?v=B:0<B&&(T+=Math.abs(B-v),v=B));0<L.data.length&&(K/=L.data.length-S),1.99<K&&(h===void 0||T<h||T===h&&Z<K)&&(h=T,q=se,Z=K)}return{successful:!!(t.delimiter=q),bestDelimiter:q}})(p,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess)).successful?t.delimiter=a.bestDelimiter:(s=!0,t.delimiter=o.DefaultDelimiter),n.meta.delimiter=t.delimiter),de(t));return a.header=x(),t.preview&&t.header&&a.preview++,e=p,r=new le(a),n=r.parse(e,f,b),k(),D?{meta:{paused:!0}}:n||{meta:{paused:!1}}},this.paused=function(){return D},this.pause=function(){D=!0,r.abort(),e=E(t.chunk)?"":e.substring(r.getCharIndex())},this.resume=function(){w.streamer._halted?(D=!1,w.streamer.parseChunk(e,!0)):setTimeout(w.resume,3)},this.aborted=function(){return l},this.abort=function(){l=!0,r.abort(),n.meta.aborted=!0,E(t.complete)&&t.complete(n),e=""},this.guessLineEndings=function(R,a){R=R.substring(0,1048576);var a=new RegExp(ne(a)+"([^]*?)"+ne(a),"gm"),b=(R=R.replace(a,"")).split("\r"),a=R.split(`
6
+ */var Ie=he.exports,ke;function Ae(){return ke||(ke=1,(function(H,X){((G,m)=>{H.exports=m()})(Ie,function G(){var m=typeof self<"u"?self:typeof window<"u"?window:m!==void 0?m:{},C=!m.document&&!!m.postMessage,N=m.IS_PAPA_WORKER||!1,J={},Y=0,o={};function P(t){return t.charCodeAt(0)===65279?t.slice(1):t}function z(t){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var r=de(e);r.chunkSize=parseInt(r.chunkSize),e.step||e.chunk||(r.chunkSize=null),this._handle=new pe(r),(this._handle.streamer=this)._config=r}).call(this,t),this.parseChunk=function(e,r){var s=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<s){let g=this._config.newline;g||(i=this._config.quoteChar||'"',g=this._handle.guessLineEndings(e,i)),e=[...e.split(g).slice(s)].join(g)}this.isFirstChunk&&E(this._config.beforeFirstChunk)&&(i=this._config.beforeFirstChunk(e))!==void 0&&(e=i),this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e,i=(this._partialLine="",this._handle.parse(s,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=i.meta.cursor,s=(this._finished||(this._partialLine=s.substring(e-this._baseIndex),this._baseIndex=e),i&&i.data&&(this._rowCount+=i.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),N)m.postMessage({results:i,workerId:o.WORKER_ID,finished:s});else if(E(this._config.chunk)&&!r){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=i=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),this._completed||!s||!E(this._config.complete)||i&&i.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),s||i&&i.meta.paused||this._nextChunk(),i}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):N&&this._config.error&&m.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function re(t){var e;(t=t||{}).chunkSize||(t.chunkSize=o.RemoteChunkSize),z.call(this,t),this._nextChunk=C?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(r){this._input=r,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),C||(e.onload=$(this._chunkLoaded,this),e.onerror=$(this._chunkError,this)),e.ontimeout=$(this._chunkTimeout,this),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!C),this._config.downloadTimeout&&!C&&(e.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var r,s=this._config.downloadRequestHeaders;for(r in s)e.setRequestHeader(r,s[r])}var i;this._config.chunkSize&&(i=this._start+this._config.chunkSize-1,e.setRequestHeader("Range","bytes="+this._start+"-"+i));try{e.send(this._config.downloadRequestBody)}catch(g){this._chunkError(g.message)}C&&e.status===0&&this._chunkError()}},this._chunkLoaded=function(){e.readyState===4&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize||e.responseText.length,this._finished=!this._config.chunkSize||this._start>=(r=>(r=r.getResponseHeader("Content-Range"))!==null?parseInt(r.substring(r.lastIndexOf("/")+1)):-1)(e),this.parseChunk(e.responseText)))},this._chunkError=function(r){r=e.statusText||r,this._sendError(new Error(r))},this._chunkTimeout=function(){this._chunkError("Request timed out after "+this._config.downloadTimeout+"ms")}}function oe(t){(t=t||{}).chunkSize||(t.chunkSize=o.LocalChunkSize),z.call(this,t);var e,r,s=typeof FileReader<"u";this.stream=function(i){this._input=i,r=i.slice||i.webkitSlice||i.mozSlice,s?((e=new FileReader).onload=$(this._chunkLoaded,this),e.onerror=$(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var i=this._input,g=(this._config.chunkSize&&(g=Math.min(this._start+this._config.chunkSize,this._input.size),i=r.call(i,this._start,g)),e.readAsText(i,this._config.encoding));s||this._chunkLoaded({target:{result:g}})},this._chunkLoaded=function(i){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(i.target.result)},this._chunkError=function(){this._sendError(e.error)}}function ie(t){var e;z.call(this,t=t||{}),this.stream=function(r){return e=r,this._nextChunk()},this._nextChunk=function(){var r,s;if(!this._finished)return r=this._config.chunkSize,e=r?(s=e.substring(0,r),e.substring(r)):(s=e,""),this._finished=!e,this.parseChunk(s)}}function ue(t){z.call(this,t=t||{});var e=[],r=!0,s=!1;this.pause=function(){z.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){z.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(i){this._input=i,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&e.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):r=!0},this._streamData=$(function(i){try{e.push(typeof i=="string"?i:i.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(g){this._streamError(g)}},this),this._streamError=$(function(i){this._streamCleanUp(),this._sendError(i)},this),this._streamEnd=$(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=$(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function pe(t){var e,r,s,i,g=Math.pow(2,53),I=-g,U=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Q=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,w=this,A=0,u=0,D=!1,l=!1,d=[],n={data:[],errors:[],meta:{}};function F(p){return t.skipEmptyLines==="greedy"?p.join("").trim()==="":p.length===1&&p[0].length===0}function k(){if(n&&s&&(M("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(n.data=n.data.filter(function(a){return!F(a)})),x()){let a=function(R){d.push(R)};if(n)if(Array.isArray(n.data[0])){for(var p=0;x()&&p<n.data.length;p++)n.data[p].forEach(a);n.data.splice(0,1)}else n.data.forEach(a)}function f(a,R){for(var O=t.header?{}:[],_=0;_<a.length;_++){var y=_,c=a[_],c=((q,h)=>(v=>(t.dynamicTypingFunction&&t.dynamicTyping[v]===void 0&&(t.dynamicTyping[v]=t.dynamicTypingFunction(v)),(t.dynamicTyping[v]||t.dynamicTyping)===!0))(q)?h==="true"||h==="TRUE"||h!=="false"&&h!=="FALSE"&&((v=>{if(U.test(v)&&(v=parseFloat(v),I<v&&v<g))return 1})(h)?parseFloat(h):Q.test(h)?new Date(h):h===""?null:h):h)(y=t.header?_>=d.length?"__parsed_extra":d[_]:y,c=t.transform?t.transform(c,y):c);y==="__parsed_extra"?(O[y]=O[y]||[],O[y].push(c)):O[y]=c}return t.header&&(_>d.length?M("FieldMismatch","TooManyFields","Too many fields: expected "+d.length+" fields but parsed "+_,u+R):_<d.length&&M("FieldMismatch","TooFewFields","Too few fields: expected "+d.length+" fields but parsed "+_,u+R)),O}var b;n&&(t.header||t.dynamicTyping||t.transform)&&(b=1,!n.data.length||Array.isArray(n.data[0])?(n.data=n.data.map(f),b=n.data.length):n.data=f(n.data,0),t.header&&n.meta&&(n.meta.fields=d),u+=b)}function x(){return t.header&&d.length===0}function M(p,f,b,a){p={type:p,code:f,message:b},a!==void 0&&(p.row=a),n.errors.push(p)}E(t.step)&&(i=t.step,t.step=function(p){n=p,x()?k():(k(),n.data.length!==0&&(A+=p.data.length,t.preview&&A>t.preview?r.abort():(n.data=n.data[0],i(n,w))))}),this.parse=function(p,f,b){var a=t.quoteChar||'"',a=(t.newline||(t.newline=this.guessLineEndings(p,a)),s=!1,t.delimiter?E(t.delimiter)&&(t.delimiter=t.delimiter(p),n.meta.delimiter=t.delimiter):((a=((R,O,_,y,c)=>{var q,h,v,Z;c=c||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var ee=0;ee<c.length;ee++){for(var W,se=c[ee],T=0,B=0,S=0,L=(v=void 0,new le({comments:y,delimiter:se,newline:O,preview:10}).parse(R)),V=0;V<L.data.length;V++)_&&F(L.data[V])?S++:(W=L.data[V].length,B+=W,v===void 0?v=W:0<W&&(T+=Math.abs(W-v),v=W));0<L.data.length&&(B/=L.data.length-S),1.99<B&&(h===void 0||T<h||T===h&&Z<B)&&(h=T,q=se,Z=B)}return{successful:!!(t.delimiter=q),bestDelimiter:q}})(p,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess)).successful?t.delimiter=a.bestDelimiter:(s=!0,t.delimiter=o.DefaultDelimiter),n.meta.delimiter=t.delimiter),de(t));return a.header=x(),t.preview&&t.header&&a.preview++,e=p,r=new le(a),n=r.parse(e,f,b),k(),D?{meta:{paused:!0}}:n||{meta:{paused:!1}}},this.paused=function(){return D},this.pause=function(){D=!0,r.abort(),e=E(t.chunk)?"":e.substring(r.getCharIndex())},this.resume=function(){w.streamer._halted?(D=!1,w.streamer.parseChunk(e,!0)):setTimeout(w.resume,3)},this.aborted=function(){return l},this.abort=function(){l=!0,r.abort(),n.meta.aborted=!0,E(t.complete)&&t.complete(n),e=""},this.guessLineEndings=function(R,a){R=R.substring(0,1048576);var a=new RegExp(ne(a)+"([^]*?)"+ne(a),"gm"),b=(R=R.replace(a,"")).split("\r"),a=R.split(`
7
7
  `),R=1<a.length&&a[0].length<b[0].length;if(b.length===1||R)return`
8
8
  `;for(var O=0,_=0;_<b.length;_++)b[_][0]===`
9
9
  `&&O++;return O>=b.length/2?`\r
10
10
  `:"\r"}}function ne(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function le(t){var e=(t=t||{}).delimiter,r=t.newline,s=t.comments,i=t.step,g=t.preview,I=t.fastMode,U=null,Q=!1,w=t.quoteChar==null?'"':t.quoteChar,A=w;if(t.escapeChar!==void 0&&(A=t.escapeChar),(typeof e!="string"||-1<o.BAD_DELIMITERS.indexOf(e))&&(e=","),s===e)throw new Error("Comment character same as delimiter");s===!0?s="#":(typeof s!="string"||-1<o.BAD_DELIMITERS.indexOf(s))&&(s=!1),r!==`
11
11
  `&&r!=="\r"&&r!==`\r
12
12
  `&&(r=`
13
- `);var u=0,D=!1;this.parse=function(l,d,n){if(typeof l!="string")throw new Error("Input must be a string");var F=l.length,k=e.length,x=r.length,M=s.length,p=E(i),f=[],b=[],a=[],R=u=0;if(!l)return T();if(I||I!==!1&&l.indexOf(w)===-1){for(var O=l.split(r),_=0;_<O.length;_++){if(a=O[_],u+=a.length,_!==O.length-1)u+=r.length;else if(n)return T();if(!s||a.substring(0,M)!==s){if(p){if(f=[],Z(a.split(e)),K(),D)return T()}else Z(a.split(e));if(g&&g<=_)return f=f.slice(0,g),T(!0)}}return T()}for(var y=l.indexOf(e,u),c=l.indexOf(r,u),q=new RegExp(ne(A)+ne(w),"g"),h=l.indexOf(w,u);;)if(l[u]===w)for(h=u,u++;;){if((h=l.indexOf(w,h+1))===-1)return n||b.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:f.length,index:u}),B();if(h===F-1)return B(l.substring(u,h).replace(q,w));if(w===A&&l[h+1]===A)h++;else if(w===A||h===0||l[h-1]!==A){y!==-1&&y<h+1&&(y=l.indexOf(e,h+1));var v=ee((c=c!==-1&&c<h+1?l.indexOf(r,h+1):c)===-1?y:Math.min(y,c));if(l.substr(h+1+v,k)===e){a.push(l.substring(u,h).replace(q,w)),l[u=h+1+v+k]!==w&&(h=l.indexOf(w,u)),y=l.indexOf(e,u),c=l.indexOf(r,u);break}if(v=ee(c),l.substring(h+1+v,h+1+v+x)===r){if(a.push(l.substring(u,h).replace(q,w)),se(h+1+v+x),y=l.indexOf(e,u),h=l.indexOf(w,u),p&&(K(),D))return T();if(g&&f.length>=g)return T(!0);break}b.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:f.length,index:u}),h++}}else if(s&&a.length===0&&l.substring(u,u+M)===s){if(c===-1)return T();u=c+x,c=l.indexOf(r,u),y=l.indexOf(e,u)}else if(y!==-1&&(y<c||c===-1))a.push(l.substring(u,y)),u=y+k,y=l.indexOf(e,u);else{if(c===-1)break;if(a.push(l.substring(u,c)),se(c+x),p&&(K(),D))return T();if(g&&f.length>=g)return T(!0)}return B();function Z(S){f.push(S),R=u}function ee(S){var L=0;return L=S!==-1&&(S=l.substring(h+1,S))&&S.trim()===""?S.length:L}function B(S){return n||(S===void 0&&(S=l.substring(u)),a.push(S),u=F,Z(a),p&&K()),T()}function se(S){u=S,Z(a),a=[],c=l.indexOf(r,u)}function T(S){if(t.header&&!d&&f.length&&!Q){var L=f[0],V=Object.create(null),fe=new Set(L);let me=!1;for(let te=0;te<L.length;te++){let W=P(L[te]);if(V[W=E(t.transformHeader)?t.transformHeader(W,te):W]){let ae,ye=V[W];for(;ae=W+"_"+ye,ye++,fe.has(ae););fe.add(ae),L[te]=ae,V[W]++,me=!0,(U=U===null?{}:U)[ae]=W}else V[W]=1,L[te]=W;fe.add(W)}me&&console.warn("Duplicate headers found and renamed."),Q=!0}return{data:f,errors:b,meta:{delimiter:e,linebreak:r,aborted:D,truncated:!!S,cursor:R+(d||0),renamedHeaders:U}}}function K(){i(T()),f=[],b=[]}},this.abort=function(){D=!0},this.getCharIndex=function(){return u}}function be(t){var e=t.data,r=J[e.workerId],s=!1;if(e.error)r.userError(e.error,e.file);else if(e.results&&e.results.data){var i={abort:function(){s=!0,ge(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_e,resume:_e};if(E(r.userStep)){for(var g=0;g<e.results.data.length&&(r.userStep({data:e.results.data[g],errors:e.results.errors,meta:e.results.meta},i),!s);g++);delete e.results}else E(r.userChunk)&&(r.userChunk(e.results,i,e.file),delete e.results)}e.finished&&!s&&ge(e.workerId,e.results)}function ge(t,e){var r=J[t];E(r.userComplete)&&r.userComplete(e),r.terminate(),delete J[t]}function _e(){throw new Error("Not implemented.")}function de(t){if(typeof t!="object"||t===null)return t;var e,r=Array.isArray(t)?[]:{};for(e in t)r[e]=de(t[e]);return r}function $(t,e){return function(){t.apply(e,arguments)}}function E(t){return typeof t=="function"}return o.parse=function(t,e){var r=(e=e||{}).dynamicTyping||!1;if(E(r)&&(e.dynamicTypingFunction=r,r={}),e.dynamicTyping=r,e.transform=!!E(e.transform)&&e.transform,e.downloadTimeout!==void 0){var r=parseInt(e.downloadTimeout);if(isNaN(r))throw new Error("Config downloadTimeout value ("+e.downloadTimeout+") not parsable by parseInt(val).");e.downloadTimeout=r}if(!e.worker||!o.WORKERS_SUPPORTED)return r=null,o.NODE_STREAM_INPUT,typeof t=="string"?(t=P(t),r=new(e.download?re:ie)(e)):t.readable===!0&&E(t.read)&&E(t.on)?r=new ue(e):(m.File&&t instanceof File||t instanceof Object)&&(r=new oe(e)),r.stream(t);(r=(()=>{var s;return!!o.WORKERS_SUPPORTED&&(s=(()=>{var i=m.URL||m.webkitURL||null,g=G.toString();return o.BLOB_URL||(o.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",g,")();"],{type:"text/javascript"})))})(),(s=new m.Worker(s)).onmessage=be,s.id=Y++,J[s.id]=s)})()).userStep=e.step,r.userChunk=e.chunk,r.userComplete=e.complete,r.userError=e.error,e.step=E(e.step),e.chunk=E(e.chunk),e.complete=E(e.complete),e.error=E(e.error),delete e.worker,r.postMessage({input:t,config:e,workerId:r.id})},o.unparse=function(t,e){var r=!1,s=!0,i=",",g=`\r
13
+ `);var u=0,D=!1;this.parse=function(l,d,n){if(typeof l!="string")throw new Error("Input must be a string");var F=l.length,k=e.length,x=r.length,M=s.length,p=E(i),f=[],b=[],a=[],R=u=0;if(!l)return T();if(I||I!==!1&&l.indexOf(w)===-1){for(var O=l.split(r),_=0;_<O.length;_++){if(a=O[_],u+=a.length,_!==O.length-1)u+=r.length;else if(n)return T();if(!s||a.substring(0,M)!==s){if(p){if(f=[],Z(a.split(e)),B(),D)return T()}else Z(a.split(e));if(g&&g<=_)return f=f.slice(0,g),T(!0)}}return T()}for(var y=l.indexOf(e,u),c=l.indexOf(r,u),q=new RegExp(ne(A)+ne(w),"g"),h=l.indexOf(w,u);;)if(l[u]===w)for(h=u,u++;;){if((h=l.indexOf(w,h+1))===-1)return n||b.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:f.length,index:u}),W();if(h===F-1)return W(l.substring(u,h).replace(q,w));if(w===A&&l[h+1]===A)h++;else if(w===A||h===0||l[h-1]!==A){y!==-1&&y<h+1&&(y=l.indexOf(e,h+1));var v=ee((c=c!==-1&&c<h+1?l.indexOf(r,h+1):c)===-1?y:Math.min(y,c));if(l.substr(h+1+v,k)===e){a.push(l.substring(u,h).replace(q,w)),l[u=h+1+v+k]!==w&&(h=l.indexOf(w,u)),y=l.indexOf(e,u),c=l.indexOf(r,u);break}if(v=ee(c),l.substring(h+1+v,h+1+v+x)===r){if(a.push(l.substring(u,h).replace(q,w)),se(h+1+v+x),y=l.indexOf(e,u),h=l.indexOf(w,u),p&&(B(),D))return T();if(g&&f.length>=g)return T(!0);break}b.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:f.length,index:u}),h++}}else if(s&&a.length===0&&l.substring(u,u+M)===s){if(c===-1)return T();u=c+x,c=l.indexOf(r,u),y=l.indexOf(e,u)}else if(y!==-1&&(y<c||c===-1))a.push(l.substring(u,y)),u=y+k,y=l.indexOf(e,u);else{if(c===-1)break;if(a.push(l.substring(u,c)),se(c+x),p&&(B(),D))return T();if(g&&f.length>=g)return T(!0)}return W();function Z(S){f.push(S),R=u}function ee(S){var L=0;return L=S!==-1&&(S=l.substring(h+1,S))&&S.trim()===""?S.length:L}function W(S){return n||(S===void 0&&(S=l.substring(u)),a.push(S),u=F,Z(a),p&&B()),T()}function se(S){u=S,Z(a),a=[],c=l.indexOf(r,u)}function T(S){if(t.header&&!d&&f.length&&!Q){var L=f[0],V=Object.create(null),fe=new Set(L);let me=!1;for(let te=0;te<L.length;te++){let K=P(L[te]);if(V[K=E(t.transformHeader)?t.transformHeader(K,te):K]){let ae,ye=V[K];for(;ae=K+"_"+ye,ye++,fe.has(ae););fe.add(ae),L[te]=ae,V[K]++,me=!0,(U=U===null?{}:U)[ae]=K}else V[K]=1,L[te]=K;fe.add(K)}me&&console.warn("Duplicate headers found and renamed."),Q=!0}return{data:f,errors:b,meta:{delimiter:e,linebreak:r,aborted:D,truncated:!!S,cursor:R+(d||0),renamedHeaders:U}}}function B(){i(T()),f=[],b=[]}},this.abort=function(){D=!0},this.getCharIndex=function(){return u}}function be(t){var e=t.data,r=J[e.workerId],s=!1;if(e.error)r.userError(e.error,e.file);else if(e.results&&e.results.data){var i={abort:function(){s=!0,ge(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_e,resume:_e};if(E(r.userStep)){for(var g=0;g<e.results.data.length&&(r.userStep({data:e.results.data[g],errors:e.results.errors,meta:e.results.meta},i),!s);g++);delete e.results}else E(r.userChunk)&&(r.userChunk(e.results,i,e.file),delete e.results)}e.finished&&!s&&ge(e.workerId,e.results)}function ge(t,e){var r=J[t];E(r.userComplete)&&r.userComplete(e),r.terminate(),delete J[t]}function _e(){throw new Error("Not implemented.")}function de(t){if(typeof t!="object"||t===null)return t;var e,r=Array.isArray(t)?[]:{};for(e in t)r[e]=de(t[e]);return r}function $(t,e){return function(){t.apply(e,arguments)}}function E(t){return typeof t=="function"}return o.parse=function(t,e){var r=(e=e||{}).dynamicTyping||!1;if(E(r)&&(e.dynamicTypingFunction=r,r={}),e.dynamicTyping=r,e.transform=!!E(e.transform)&&e.transform,e.downloadTimeout!==void 0){var r=parseInt(e.downloadTimeout);if(isNaN(r))throw new Error("Config downloadTimeout value ("+e.downloadTimeout+") not parsable by parseInt(val).");e.downloadTimeout=r}if(!e.worker||!o.WORKERS_SUPPORTED)return r=null,o.NODE_STREAM_INPUT,typeof t=="string"?(t=P(t),r=new(e.download?re:ie)(e)):t.readable===!0&&E(t.read)&&E(t.on)?r=new ue(e):(m.File&&t instanceof File||t instanceof Object)&&(r=new oe(e)),r.stream(t);(r=(()=>{var s;return!!o.WORKERS_SUPPORTED&&(s=(()=>{var i=m.URL||m.webkitURL||null,g=G.toString();return o.BLOB_URL||(o.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",g,")();"],{type:"text/javascript"})))})(),(s=new m.Worker(s)).onmessage=be,s.id=Y++,J[s.id]=s)})()).userStep=e.step,r.userChunk=e.chunk,r.userComplete=e.complete,r.userError=e.error,e.step=E(e.step),e.chunk=E(e.chunk),e.complete=E(e.complete),e.error=E(e.error),delete e.worker,r.postMessage({input:t,config:e,workerId:r.id})},o.unparse=function(t,e){var r=!1,s=!0,i=",",g=`\r
14
14
  `,I='"',U=I+I,Q=!1,w=null,A=!1,u=((()=>{if(typeof e=="object"){if(typeof e.delimiter!="string"||o.BAD_DELIMITERS.filter(function(d){return e.delimiter.indexOf(d)!==-1}).length||(i=e.delimiter),typeof e.quotes!="boolean"&&typeof e.quotes!="function"&&!Array.isArray(e.quotes)||(r=e.quotes),typeof e.skipEmptyLines!="boolean"&&typeof e.skipEmptyLines!="string"||(Q=e.skipEmptyLines),typeof e.newline=="string"&&(g=e.newline),typeof e.quoteChar=="string"&&(I=e.quoteChar,U=I+I),typeof e.header=="boolean"&&(s=e.header),Array.isArray(e.columns)){if(e.columns.length===0)throw new Error("Option columns is empty");w=e.columns}e.escapeChar!==void 0&&(U=e.escapeChar+I),e.escapeFormulae instanceof RegExp?A=e.escapeFormulae:typeof e.escapeFormulae=="boolean"&&e.escapeFormulae&&(A=/^[=+\-@\t\r].*$/)}})(),new RegExp(ne(I),"g"));if(typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return D(null,t,Q);if(typeof t[0]=="object")return D(w||Object.keys(t[0]),t,Q)}else if(typeof t=="object")return typeof t.data=="string"&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||w),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:typeof t.data[0]=="object"?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||typeof t.data[0]=="object"||(t.data=[t.data])),D(t.fields||[],t.data||[],Q);throw new Error("Unable to serialize unrecognized input");function D(d,n,F){var k="",x=(typeof d=="string"&&(d=JSON.parse(d)),typeof n=="string"&&(n=JSON.parse(n)),Array.isArray(d)&&0<d.length),M=!Array.isArray(n[0]);if(x&&s){for(var p=0;p<d.length;p++)0<p&&(k+=i),k+=l(d[p],p);0<n.length&&(k+=g)}for(var f=0;f<n.length;f++){var b=(x?d:n[f]).length,a=!1,R=x?Object.keys(n[f]).length===0:n[f].length===0;if(F&&!x&&(a=F==="greedy"?n[f].join("").trim()==="":n[f].length===1&&n[f][0].length===0),F==="greedy"&&x){for(var O=[],_=0;_<b;_++){var y=M?d[_]:_;O.push(n[f][y])}a=O.join("").trim()===""}if(!a){for(var c=0;c<b;c++){0<c&&!R&&(k+=i);var q=x&&M?d[c]:c;k+=l(n[f][q],c)}f<n.length-1&&(!F||0<b&&!R)&&(k+=g)}}return k}function l(d,n){var F,k,x;return d==null?"":d.constructor===Date?isNaN(d.getTime())?"":d.toISOString():(x=!1,A&&typeof d=="string"&&A.test(d)&&(d="'"+d,x=!0),k=(F=d.toString()).replace(u,U),(x=x||r===!0||typeof r=="function"&&r(d,n)||Array.isArray(r)&&r[n]||((M,p)=>{for(var f=0;f<p.length;f++)if(-1<M.indexOf(p[f]))return!0;return!1})(k,o.BAD_DELIMITERS)||-1<k.indexOf(i)||-1<F.indexOf(I)||k.charAt(0)===" "||k.charAt(k.length-1)===" ")?I+k+I:k)}},o.RECORD_SEP="",o.UNIT_SEP="",o.BYTE_ORDER_MARK="\uFEFF",o.BAD_DELIMITERS=["\r",`
15
15
  `,'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!C&&!!m.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=le,o.ParserHandle=pe,o.NetworkStreamer=re,o.FileStreamer=oe,o.StringStreamer=ie,o.ReadableStreamStreamer=ue,N&&(m.onmessage=function(t){t=t.data,o.WORKER_ID===void 0&&t&&(o.WORKER_ID=t.workerId),typeof t.input=="string"?m.postMessage({workerId:o.WORKER_ID,results:o.parse(t.input,t.config),finished:!0}):(m.File&&t.input instanceof File||t.input instanceof Object)&&(t=o.parse(t.input,t.config))&&m.postMessage({workerId:o.WORKER_ID,results:t,finished:!0})}),(re.prototype=Object.create(z.prototype)).constructor=re,(oe.prototype=Object.create(z.prototype)).constructor=oe,(ie.prototype=Object.create(ie.prototype)).constructor=ie,(ue.prototype=Object.create(z.prototype)).constructor=ue,o})})(he)),he.exports}var De=Ae();const Le=Ee(De),we=32;function et({content:H}){const X=xe(),G=Re(P=>P.selectedCwd),m=ve.useMemo(()=>Te(H.src,P=>X.mediaUrl(G??"",P)),[H.src,X,G]),{data:C,error:N,isLoading:J}=Se({queryKey:["canvas-csv",m.url],enabled:m.url!==null,queryFn:async()=>{const P=await fetch(m.url);if(!P.ok)throw new Error(`Failed to load CSV (${P.status})`);const z=await P.text();return Le.parse(z.trim(),{skipEmptyLines:!0}).data},staleTime:6e4,retry:!1});if(m.url===null)return j.jsx(ce,{children:"This CSV source can’t be displayed here."});if(J)return j.jsx(ce,{children:"Loading CSV…"});if(N||!C||C.length===0)return j.jsx(ce,{children:"This CSV couldn’t be loaded."});const[Y,...o]=C;return j.jsx(je,{header:Y,rows:o})}function je({header:H,rows:X}){const G=ve.useRef(null),m=Oe({count:X.length,getScrollElement:()=>G.current,estimateSize:()=>we,overscan:12});return j.jsx("div",{ref:G,className:"h-full overflow-auto",children:j.jsxs("table",{className:"w-full border-collapse text-sm",children:[j.jsx("thead",{className:"bg-muted sticky top-0 z-10",children:j.jsx("tr",{children:H.map((C,N)=>j.jsx("th",{className:"text-muted-foreground border-b px-3 py-1.5 text-left font-medium whitespace-nowrap",children:C},N))})}),j.jsx("tbody",{style:{height:m.getTotalSize(),position:"relative"},children:m.getVirtualItems().map(C=>{const N=X[C.index];return j.jsx("tr",{className:Ce("absolute flex w-full",C.index%2===1&&"bg-muted/30"),style:{transform:`translateY(${C.start}px)`,height:we},children:H.map((J,Y)=>j.jsx("td",{className:"flex-1 truncate border-b px-3 py-1.5 whitespace-nowrap",title:N[Y]??"",children:N[Y]??""},Y))},C.key)})})]})})}function ce({children:H}){return j.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:j.jsx("p",{children:H})})}export{et as CanvasCsvContent};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-BtNgazuc.js","assets/index-B6Scr7KJ.js","assets/index-CujX3mpY.css","assets/index-BIVIHPoe.js","assets/index-BSxkprTm.js","assets/BlintzCanvas-BCtfZPrs.js","assets/index-DsasLE1l.js","assets/BlintzCanvas-DCXOV_yN.css"])))=>i.map(i=>d[i]);
2
- import{r as a,aY as z,h7 as ce,j as t,G as O,g1 as oe,g2 as le,B as D,g3 as ue,g4 as de,g5 as Z,h8 as fe,dl as he,dm as pe,J as me,gh as ve,dn as xe,a3 as ge,h9 as be,aZ as ee,a1 as ye,ha as je,a2 as Ce}from"./index-B6Scr7KJ.js";import{u as ke,a as we,b as Re}from"./use-session-canvas-BfKGOpNy.js";import{R as Te}from"./rotate-cw-DNa7ENG3.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CZ68Qd2t.js";import"./WidgetErrorCard-BA3P7hNv.js";import"./index-B3xeyV6n.js";import"./card-DA_Z-FYX.js";import"./progress-qB87L0zJ.js";import"./markdown-content-Bk9lCksw.js";import"./table-DsxLk3Gx.js";import"./package-BmOMrNwc.js";import"./heart-C4CSHUW7.js";import"./git-branch-1zYKSuur.js";import"./file-text-CRTgqqkn.js";import"./file-DXbyb23e.js";import"./McpAppFrame-4JDJsrmg.js";import"./more-details-Bt9nlPmS.js";function B(e,r){return["canvas-file",e,r]}function Ne({documentId:e,sourcePath:r,binding:d,save:n,draftRef:o,revisionRef:s,finishAttemptRef:C,timerRef:y,finalSaveRef:b,invalidateConfirmedFile:p}){const x=a.useRef({binding:d,save:n,invalidateConfirmedFile:p}),_=a.useRef(null),f=a.useRef(null);return a.useLayoutEffect(()=>{x.current={binding:d,save:n,invalidateConfirmedFile:p}}),a.useLayoutEffect(()=>{const w=z.getState().openDocuments.find(m=>m.id===e);if(!w||typeof w.openedAt!="number")return;const R=ce(e,w.openedAt,r,{required:()=>!!x.current.binding,current:()=>{const m=f.current;return!!m&&m.revision===s.current&&m.attempt===C.current&&m.binding===x.current.binding&&m.save===x.current.save&&m.binding.current()},invalidateConfirmedFile:()=>x.current.invalidateConfirmedFile(),prepare:async()=>{var c;f.current=null;const{binding:m,save:T}=x.current;if(!(m!=null&&m.current()))return!1;y.current&&(clearTimeout(y.current),y.current=null);const F=o.current,g=s.current,l=++C.current,i=await T(F);return i.status!=="changed"&&i.status!=="no_op"||i.confirmed.content!==F||s.current!==g||C.current!==l||x.current.binding!==m||x.current.save!==T||!m.current()?!1:((c=b.current)==null||c.cancel(),b.current=null,f.current={revision:g,attempt:l,binding:m,save:T},!0)}});return _.current=R,()=>R.retire()},[e,r,o,s,C,y,b]),_}function M(e){return e.status==="refused"||e.status==="local_uncertain"?e.status:"unavailable"}function _e(e,r,d){var l;const n=a.useRef(e),o=a.useRef(null),s=a.useRef(null),[C,y]=a.useState({identity:e.identity,phase:"pending",busy:!1});a.useLayoutEffect(()=>{n.current=e},[e]);const b=a.useCallback((i,c)=>{o.current===i&&n.current.identity===i&&n.current.current()&&y(u=>({identity:i,...c,historical:c.historical??(u.identity===i?u.historical:void 0)}))},[]),p=a.useCallback(i=>{o.current!==i||n.current.identity!==i||y(c=>c.identity===i?{...c,phase:"unavailable",busy:!1}:{identity:i,phase:"unavailable",busy:!1})},[]),x=e.identity,_=e.supported;a.useLayoutEffect(()=>{const i=n.current;s.current=null,o.current=x;let c=!1;return _&&r==="ready"&&i.discover().then(u=>{c||(u.status==="observed"?b(x,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(x,{phase:M(u),busy:!1}):p(x))}),()=>{c=!0,s.current=null,o.current===x&&(o.current=null)}},[x,_,r,d,b,p]);const f=C.identity===e.identity?C:void 0,w=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return;s.current=null,y(j=>({identity:c,phase:"pending",busy:!0,historical:j.identity===c?j.historical:void 0}));const u=await i.discover(!0);u.status==="observed"?b(c,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(c,{phase:M(u),busy:!1}):p(c)},[b,p]),R=a.useCallback(async i=>{const c=n.current,u=c.identity;if(o.current!==u||!c.current())return;s.current=null,y(h=>({identity:u,phase:"pending",busy:!0,discovery:h.identity===u?h.discovery:void 0,historical:h.identity===u?h.historical:void 0}));const j=await c.recover(i);j.status==="observed"?b(u,{phase:"ready",discovery:j.value.discovery,historical:j.value.result.entry,busy:!1}):j.status!=="idle"?b(u,{phase:M(j),busy:!1}):p(u)},[b,p]),m=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return{status:"idle"};const u={};s.current=u,y(h=>h.identity===c?{...h,phase:"pending",busy:!0}:h);const j=await i.inspectCurrent();return s.current!==u?{status:"idle"}:(s.current=null,j.status==="idle"&&p(c),o.current===c&&n.current.identity===c&&i.current()&&j.status!=="idle"&&y(h=>h.identity===c?{...h,phase:j.status==="observed"?"ready":M(j),busy:!1}:h),j)},[p]),T=e.supported&&r==="ready",F=r==="pending"?"pending":(f==null?void 0:f.phase)??"pending",g=T&&(F!=="ready"||((l=f==null?void 0:f.discovery)==null?void 0:l.admission)==="blocked");return{supported:T,phase:F,editBlocked:g,busy:(f==null?void 0:f.busy)??F==="pending",discovery:f==null?void 0:f.discovery,historical:f==null?void 0:f.historical,refresh:w,recover:R,inspectCurrent:m}}const Fe={unavailable:"Couldn’t check previous saves, so editing is off.",refused:"This file can’t be edited from this canvas."};function Pe(e){var r,d,n;return e.supported?e.phase==="unavailable"||e.phase==="refused"||e.phase==="local_uncertain"?!0:((r=e.discovery)==null?void 0:r.admission)==="blocked"||((d=e.discovery)==null?void 0:d.entries.some(o=>o.state==="review"))===!0||((n=e.historical)==null?void 0:n.state)==="receipt":!1}function X({recovery:e,editing:r,loadCurrent:d}){var o;if(e.phase==="unavailable"||e.phase==="refused")return t.jsxs(t.Fragment,{children:[t.jsx("p",{role:"alert",className:"col-start-1 row-start-1 py-1.5",children:Fe[e.phase]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",className:"col-span-2 col-start-1 row-start-2 mb-1.5 justify-self-start @md:col-span-1 @md:col-start-2 @md:row-start-1 @md:mb-0",disabled:e.busy||r,onClick:()=>void e.refresh(),children:"Check again"})]});if(e.phase==="local_uncertain")return t.jsx("p",{role:"alert",children:"Use Retry original save. Checking previous saves won’t confirm this save."});const n=e.discovery;return t.jsxs("div",{className:"space-y-1",children:[(n==null?void 0:n.admission)==="blocked"&&t.jsx("p",{role:"alert",children:"An unresolved original save blocks this file. This list may not include the blocking operation."}),(n==null?void 0:n.hasMore)&&t.jsx("p",{children:"Only the latest 25 matching saves are shown. Older evidence is omitted."}),n&&n.entries.length>0&&t.jsx(t.Fragment,{children:t.jsx("ul",{children:n.entries.map(s=>t.jsxs("li",{children:[t.jsxs("span",{children:[s.eventId,":"," ",s.state==="receipt"?"Historical save recorded":s.state==="review"?"Original save needs review":s.state==="no_op"?"Original save made no change":"Original save failed before replacement"]}),s.state==="review"&&(s.reason==="prepared_without_replacement"?t.jsx("p",{children:"This save needs manual review. These controls won’t write the file."}):t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx("p",{children:"The original saved replacement must be proven before its receipt can be settled."}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:e.busy||r,onClick:()=>void e.recover(s.eventId),children:"Recover original receipt"})]}))]},s.eventId))})}),(n==null?void 0:n.admission)==="blocked"&&n.entries.length===0&&t.jsx("p",{children:"No matching recent saves."}),((o=e.historical)==null?void 0:o.state)==="receipt"&&t.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsxs("div",{children:[t.jsx("p",{children:"Previous save confirmed. Your current draft may differ."}),t.jsx("p",{children:e.historical.currentFileMatch==="different"?"The current file differs from that historical save.":e.historical.currentFileMatch==="same_saved_replacement"?"The saved replacement matched when checked; current bytes still require a fresh load.":"The current file was not checked."})]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:r||e.editBlocked||e.busy,onClick:d,children:"Load current file"})]})]})}function Se({recovery:e,editing:r,loadCurrent:d}){return!e.supported||r?null:t.jsxs(oe,{children:[t.jsx(le,{asChild:!0,children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground","aria-label":"More file actions",children:t.jsx(ue,{className:"size-4"})})}),t.jsxs(de,{align:"end",children:[t.jsx(Z,{disabled:e.busy,onSelect:()=>void e.refresh(),children:"Check previous saves"}),t.jsx(Z,{disabled:e.editBlocked||e.busy,onSelect:()=>d(),children:"Load current file"})]})]})}function De({recovery:e,editing:r,loadCurrent:d,toolbar:n}){const o=Pe(e),s=e.phase==="unavailable"||e.phase==="refused";return t.jsxs(t.Fragment,{children:[e.supported&&e.phase==="pending"&&t.jsx("p",{role:"status",className:"sr-only",children:"Checking previous saves…"}),t.jsx("div",{...o?{role:"region","aria-label":"Previous file saves"}:{},className:O("shrink-0",o?"bg-muted text-foreground mx-2 mt-2 rounded-md py-1 pr-1 pl-3 text-sm":"flex justify-end px-2 pt-1",o&&(s?"@container":"flow-root")),children:t.jsxs("div",{className:O(o&&s&&"grid grid-cols-[1fr_auto] items-center gap-x-2 @md:grid-cols-[1fr_auto_auto]"),children:[t.jsx("div",{className:O("flex items-center gap-1",o&&!s&&"float-right ml-2",o&&s&&"col-start-2 row-start-1 @md:col-start-3"),children:n}),o&&(s?t.jsx(X,{recovery:e,editing:r,loadCurrent:d}):t.jsx("div",{className:"py-1.5",children:t.jsx(X,{recovery:e,editing:r,loadCurrent:d})}))]})})]})}function Le({editing:e,off:r,observation:d,onClick:n}){return t.jsx(fe,{children:t.jsxs(he,{...r?{}:{open:!1},children:[t.jsx(pe,{asChild:!0,children:t.jsx("span",{className:"inline-flex",children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:n,"aria-label":e?"Finish editing":"Edit file",disabled:r,"data-document-save-observation":d,children:e?t.jsx(me,{className:"size-4"}):t.jsx(ve,{className:"size-4"})})})}),t.jsx(xe,{children:"Editing is off"})]})})}const Ee=a.lazy(()=>ee(()=>import("./CodeMirrorEditor-BtNgazuc.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),ze=a.lazy(()=>ee(()=>import("./BlintzCanvas-BCtfZPrs.js").then(e=>e.B),__vite__mapDeps([5,1,2,6,4,7])).then(e=>({default:e.BlintzCanvas}))),Be=500;function Me(e,r){return r==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function Oe(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";case"uncertain":return"Save not confirmed";default:return null}}function te({content:e,documentId:r,cwd:d,loaded:n,theme:o,isEditing:s,onEditingChange:C,setDocumentEditing:y,observedBinding:b,fileSaveObservation:p="unavailable",recoveryBinding:x}){const _=e.readOnly!==!0,f=Me(e.sourcePath,e.language),w=ge(),[R,m]=a.useState(n),[T,F]=a.useState(),g=a.useRef(b);a.useLayoutEffect(()=>{g.current=b},[b]);const l=ke({documentId:r,sourcePath:e.sourcePath,cwd:d,loadedContent:n,documentSaveBinding:T,documentRecoveryBinding:x}),i=_e(l.recovery,p,x),c=we({cwd:d,sourcePath:f?e.sourcePath:null,content:R,saved:l.status==="saved"}),u=a.useRef(!1),j=a.useRef(s);a.useLayoutEffect(()=>(u.current=!0,j.current=s,()=>{u.current=!1}),[s]);const h=a.useRef(null),S=a.useRef(R),L=a.useRef(0),A=a.useRef(0),I=a.useRef(l.save),K=a.useRef(l.prepareFinalSave),U=a.useRef(l.waitForCloseDrain),E=a.useRef(null),Y=a.useRef(C),V=Ne({documentId:r,sourcePath:e.sourcePath,binding:T,save:l.save,draftRef:S,revisionRef:L,finishAttemptRef:A,timerRef:h,finalSaveRef:E,invalidateConfirmedFile:()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)}).catch(()=>{})}});a.useEffect(()=>{S.current=R,I.current=l.save,K.current=l.prepareFinalSave,U.current=l.waitForCloseDrain,Y.current=C});const $=a.useCallback(v=>{var k;L.current+=1,S.current=v,m(v),(k=E.current)==null||k.cancel(),E.current=K.current(v),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,I.current(S.current)},Be)},[]),se=()=>{var P;if(i.editBlocked||p==="pending"||p==="ready"&&!((P=g.current)!=null&&P.current()))return;const v=g.current,k=v&&Object.freeze({...v.incarnation});F(v!=null&&v.current()&&k?{incarnation:k,current:()=>{const N=g.current;return!!N&&be(k,N.incarnation)&&N.current()}}:void 0),L.current+=1,S.current=n,m(n),C(!0),y(r,!0)},ne=async()=>{h.current&&(clearTimeout(h.current),h.current=null);const v=S.current,k=L.current,P=++A.current,N=await I.current(v);if(N.status!=="changed"&&N.status!=="no_op"||L.current!==k||A.current!==P||N.confirmed.content!==v)return;const q=N.confirmed;q.content===S.current&&w.setQueryData(B(d,e.sourcePath),Q=>Q&&{...Q,content:q.content,hash:q.hash}),C(!1),y(r,!1)},re=()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)})};a.useEffect(()=>{var v;s||(h.current&&clearTimeout(h.current),h.current=null,(v=E.current)==null||v.cancel(),E.current=null)},[s]),a.useEffect(()=>{const v=V.current;return()=>{var N;h.current&&(clearTimeout(h.current),h.current=null);const k=(N=E.current)==null?void 0:N.flush(),P=S.current;v==null||v.settleRetirement(Promise.resolve(k).then(()=>U.current(P))),E.current=null,y(r,!1),Y.current(!1)}},[r,y,V]);const G=async()=>{if(s||!u.current||i.editBlocked)return;const v=L.current,k=await i.inspectCurrent();k.status!=="observed"||!u.current||j.current||L.current!==v||!l.recovery.current()||w.setQueryData(B(d,e.sourcePath),P=>P&&{...P,...k.value})},ae=()=>{const v=l.adoptDisk();v!=null&&m(v)},ie=()=>{l.overwrite(S.current)},J=l.status==="saved"?l.confirmedContent!==R?"Unsaved changes":l.documentReceipt?"Save recorded":"Saved to file":Oe(l.status),W=s?R:n;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsx(De,{recovery:i,editing:s,loadCurrent:()=>void G(),toolbar:t.jsxs(t.Fragment,{children:[_&&J&&t.jsx("span",{className:O("mr-1 text-xs",l.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:J}),!s&&p==="pending"&&t.jsx("span",{role:"status",children:"Checking document…"}),!s&&t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:re,"aria-label":"Refresh from disk",children:t.jsx(Te,{className:"size-4"})}),_&&t.jsx(Le,{editing:s,off:!s&&(p==="pending"||i.editBlocked),observation:p,onClick:s?()=>void ne():se}),t.jsx(Se,{recovery:i,editing:s,loadCurrent:()=>void G()})]})}),l.status==="uncertain"&&t.jsxs("div",{role:"status",className:"mx-2 mt-2 flex items-center gap-2 text-sm",children:[t.jsx("span",{children:"Save not confirmed. Retry the original save before saving another draft."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",onClick:()=>void l.retryUnconfirmed(),children:"Retry original save"})]}),l.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:ae,children:"Reload"}),t.jsx(D,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:ie,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(a.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:f?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(ze,{value:W,editable:s,onChange:s?$:void 0,wikiLinks:c})}):t.jsx(Ee,{value:W,editable:s,filename:e.sourcePath,languageHint:e.language,theme:o,onChange:s?$:void 0})})})]})}function Ae(e){const{fileSaveBinding:r,fileSaveObservation:d}=Re(e.documentId);return t.jsx(te,{...e,observedBinding:r,recoveryBinding:r,fileSaveObservation:d})}function Ie(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function at({content:e,documentId:r}){const d=ye(),n=z(g=>g.selectedCwd),o=z(g=>g.setDocumentEditing),s=z(g=>{var l;return((l=g.openDocuments.find(i=>i.id===r))==null?void 0:l.editing)??!1}),C=je(),y=z(g=>g.canvasSessionId),b=z(g=>g.roomCanvasLiveRoomId),{data:p,error:x,isLoading:_}=Ce({queryKey:B(n,e.sourcePath),enabled:n!==null,queryFn:()=>d.readFileContent(n,e.sourcePath),staleTime:3e4,retry:!1}),[f,w]=a.useState(null),R=g=>{w(g&&p?{pinnedHash:p.hash}:null)};if(n===null)return t.jsx(H,{children:"Open a chat to view files."});if(_)return t.jsx(H,{children:"Loading file…"});if(x||!p)return t.jsx(H,{children:Ie(x)});const m=f!==null&&s,T=(m?f==null?void 0:f.pinnedHash:null)??p.hash,F=y&&!b?Ae:te;return t.jsx(F,{content:e,documentId:r,cwd:n,loaded:p.content,theme:C,isEditing:m,onEditingChange:R,setDocumentEditing:o},`${e.sourcePath}:${T}`)}function H({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{at as CanvasFileContent};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-DnkumDd3.js","assets/index-fge85Gub.js","assets/index-CujX3mpY.css","assets/index-CP47qL8N.js","assets/index-DZQUx5pX.js","assets/BlintzCanvas-BFJXKo1L.js","assets/index-Dsj1fDYU.js","assets/BlintzCanvas-DCXOV_yN.css"])))=>i.map(i=>d[i]);
2
+ import{r as a,aW as z,h7 as ce,j as t,G as O,g0 as oe,g1 as le,B as D,g2 as ue,g3 as de,g4 as X,h8 as fe,dj as he,dk as pe,J as me,gh as ve,dl as xe,a3 as ge,h9 as be,aX as ee,a1 as ye,ha as je,a2 as Ce}from"./index-fge85Gub.js";import{u as ke,a as we,b as Re}from"./use-session-canvas-KguPfnsc.js";import{R as Te}from"./rotate-cw-um9OzAM7.js";import"./query-keys-DeYqUDia.js";import"./index.esm-BEGwgVfU.js";import"./WidgetErrorCard-Bte2obmw.js";import"./index-DI9IsN-O.js";import"./card-CM7-_8nD.js";import"./progress-es667_cM.js";import"./markdown-content-DV3AiG76.js";import"./table-BcJvj9rx.js";import"./package-BafFSryH.js";import"./heart--8btr31M.js";import"./git-branch-uZFa3Tmr.js";import"./file-text-DLPhIP0f.js";import"./file-DiYwTQdD.js";import"./McpAppFrame-CmwiQHxf.js";import"./more-details-BUolHzrY.js";function B(e,r){return["canvas-file",e,r]}function Ne({documentId:e,sourcePath:r,binding:d,save:n,draftRef:o,revisionRef:s,finishAttemptRef:C,timerRef:y,finalSaveRef:b,invalidateConfirmedFile:p}){const x=a.useRef({binding:d,save:n,invalidateConfirmedFile:p}),_=a.useRef(null),f=a.useRef(null);return a.useLayoutEffect(()=>{x.current={binding:d,save:n,invalidateConfirmedFile:p}}),a.useLayoutEffect(()=>{const w=z.getState().openDocuments.find(m=>m.id===e);if(!w||typeof w.openedAt!="number")return;const R=ce(e,w.openedAt,r,{required:()=>!!x.current.binding,current:()=>{const m=f.current;return!!m&&m.revision===s.current&&m.attempt===C.current&&m.binding===x.current.binding&&m.save===x.current.save&&m.binding.current()},invalidateConfirmedFile:()=>x.current.invalidateConfirmedFile(),prepare:async()=>{var c;f.current=null;const{binding:m,save:T}=x.current;if(!(m!=null&&m.current()))return!1;y.current&&(clearTimeout(y.current),y.current=null);const F=o.current,g=s.current,l=++C.current,i=await T(F);return i.status!=="changed"&&i.status!=="no_op"||i.confirmed.content!==F||s.current!==g||C.current!==l||x.current.binding!==m||x.current.save!==T||!m.current()?!1:((c=b.current)==null||c.cancel(),b.current=null,f.current={revision:g,attempt:l,binding:m,save:T},!0)}});return _.current=R,()=>R.retire()},[e,r,o,s,C,y,b]),_}function M(e){return e.status==="refused"||e.status==="local_uncertain"?e.status:"unavailable"}function _e(e,r,d){var l;const n=a.useRef(e),o=a.useRef(null),s=a.useRef(null),[C,y]=a.useState({identity:e.identity,phase:"pending",busy:!1});a.useLayoutEffect(()=>{n.current=e},[e]);const b=a.useCallback((i,c)=>{o.current===i&&n.current.identity===i&&n.current.current()&&y(u=>({identity:i,...c,historical:c.historical??(u.identity===i?u.historical:void 0)}))},[]),p=a.useCallback(i=>{o.current!==i||n.current.identity!==i||y(c=>c.identity===i?{...c,phase:"unavailable",busy:!1}:{identity:i,phase:"unavailable",busy:!1})},[]),x=e.identity,_=e.supported;a.useLayoutEffect(()=>{const i=n.current;s.current=null,o.current=x;let c=!1;return _&&r==="ready"&&i.discover().then(u=>{c||(u.status==="observed"?b(x,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(x,{phase:M(u),busy:!1}):p(x))}),()=>{c=!0,s.current=null,o.current===x&&(o.current=null)}},[x,_,r,d,b,p]);const f=C.identity===e.identity?C:void 0,w=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return;s.current=null,y(j=>({identity:c,phase:"pending",busy:!0,historical:j.identity===c?j.historical:void 0}));const u=await i.discover(!0);u.status==="observed"?b(c,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(c,{phase:M(u),busy:!1}):p(c)},[b,p]),R=a.useCallback(async i=>{const c=n.current,u=c.identity;if(o.current!==u||!c.current())return;s.current=null,y(h=>({identity:u,phase:"pending",busy:!0,discovery:h.identity===u?h.discovery:void 0,historical:h.identity===u?h.historical:void 0}));const j=await c.recover(i);j.status==="observed"?b(u,{phase:"ready",discovery:j.value.discovery,historical:j.value.result.entry,busy:!1}):j.status!=="idle"?b(u,{phase:M(j),busy:!1}):p(u)},[b,p]),m=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return{status:"idle"};const u={};s.current=u,y(h=>h.identity===c?{...h,phase:"pending",busy:!0}:h);const j=await i.inspectCurrent();return s.current!==u?{status:"idle"}:(s.current=null,j.status==="idle"&&p(c),o.current===c&&n.current.identity===c&&i.current()&&j.status!=="idle"&&y(h=>h.identity===c?{...h,phase:j.status==="observed"?"ready":M(j),busy:!1}:h),j)},[p]),T=e.supported&&r==="ready",F=r==="pending"?"pending":(f==null?void 0:f.phase)??"pending",g=T&&(F!=="ready"||((l=f==null?void 0:f.discovery)==null?void 0:l.admission)==="blocked");return{supported:T,phase:F,editBlocked:g,busy:(f==null?void 0:f.busy)??F==="pending",discovery:f==null?void 0:f.discovery,historical:f==null?void 0:f.historical,refresh:w,recover:R,inspectCurrent:m}}const Fe={unavailable:"Couldn’t check previous saves, so editing is off.",refused:"This file can’t be edited from this canvas."};function Pe(e){var r,d,n;return e.supported?e.phase==="unavailable"||e.phase==="refused"||e.phase==="local_uncertain"?!0:((r=e.discovery)==null?void 0:r.admission)==="blocked"||((d=e.discovery)==null?void 0:d.entries.some(o=>o.state==="review"))===!0||((n=e.historical)==null?void 0:n.state)==="receipt":!1}function Z({recovery:e,editing:r,loadCurrent:d}){var o;if(e.phase==="unavailable"||e.phase==="refused")return t.jsxs(t.Fragment,{children:[t.jsx("p",{role:"alert",className:"col-start-1 row-start-1 py-1.5",children:Fe[e.phase]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",className:"col-span-2 col-start-1 row-start-2 mb-1.5 justify-self-start @md:col-span-1 @md:col-start-2 @md:row-start-1 @md:mb-0",disabled:e.busy||r,onClick:()=>void e.refresh(),children:"Check again"})]});if(e.phase==="local_uncertain")return t.jsx("p",{role:"alert",children:"Use Retry original save. Checking previous saves won’t confirm this save."});const n=e.discovery;return t.jsxs("div",{className:"space-y-1",children:[(n==null?void 0:n.admission)==="blocked"&&t.jsx("p",{role:"alert",children:"An unresolved original save blocks this file. This list may not include the blocking operation."}),(n==null?void 0:n.hasMore)&&t.jsx("p",{children:"Only the latest 25 matching saves are shown. Older evidence is omitted."}),n&&n.entries.length>0&&t.jsx(t.Fragment,{children:t.jsx("ul",{children:n.entries.map(s=>t.jsxs("li",{children:[t.jsxs("span",{children:[s.eventId,":"," ",s.state==="receipt"?"Historical save recorded":s.state==="review"?"Original save needs review":s.state==="no_op"?"Original save made no change":"Original save failed before replacement"]}),s.state==="review"&&(s.reason==="prepared_without_replacement"?t.jsx("p",{children:"This save needs manual review. These controls won’t write the file."}):t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx("p",{children:"The original saved replacement must be proven before its receipt can be settled."}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:e.busy||r,onClick:()=>void e.recover(s.eventId),children:"Recover original receipt"})]}))]},s.eventId))})}),(n==null?void 0:n.admission)==="blocked"&&n.entries.length===0&&t.jsx("p",{children:"No matching recent saves."}),((o=e.historical)==null?void 0:o.state)==="receipt"&&t.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsxs("div",{children:[t.jsx("p",{children:"Previous save confirmed. Your current draft may differ."}),t.jsx("p",{children:e.historical.currentFileMatch==="different"?"The current file differs from that historical save.":e.historical.currentFileMatch==="same_saved_replacement"?"The saved replacement matched when checked; current bytes still require a fresh load.":"The current file was not checked."})]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:r||e.editBlocked||e.busy,onClick:d,children:"Load current file"})]})]})}function Se({recovery:e,editing:r,loadCurrent:d}){return!e.supported||r?null:t.jsxs(oe,{children:[t.jsx(le,{asChild:!0,children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground","aria-label":"More file actions",children:t.jsx(ue,{className:"size-4"})})}),t.jsxs(de,{align:"end",children:[t.jsx(X,{disabled:e.busy,onSelect:()=>void e.refresh(),children:"Check previous saves"}),t.jsx(X,{disabled:e.editBlocked||e.busy,onSelect:()=>d(),children:"Load current file"})]})]})}function De({recovery:e,editing:r,loadCurrent:d,toolbar:n}){const o=Pe(e),s=e.phase==="unavailable"||e.phase==="refused";return t.jsxs(t.Fragment,{children:[e.supported&&e.phase==="pending"&&t.jsx("p",{role:"status",className:"sr-only",children:"Checking previous saves…"}),t.jsx("div",{...o?{role:"region","aria-label":"Previous file saves"}:{},className:O("shrink-0",o?"bg-muted text-foreground mx-2 mt-2 rounded-md py-1 pr-1 pl-3 text-sm":"flex justify-end px-2 pt-1",o&&(s?"@container":"flow-root")),children:t.jsxs("div",{className:O(o&&s&&"grid grid-cols-[1fr_auto] items-center gap-x-2 @md:grid-cols-[1fr_auto_auto]"),children:[t.jsx("div",{className:O("flex items-center gap-1",o&&!s&&"float-right ml-2",o&&s&&"col-start-2 row-start-1 @md:col-start-3"),children:n}),o&&(s?t.jsx(Z,{recovery:e,editing:r,loadCurrent:d}):t.jsx("div",{className:"py-1.5",children:t.jsx(Z,{recovery:e,editing:r,loadCurrent:d})}))]})})]})}function Le({editing:e,off:r,observation:d,onClick:n}){return t.jsx(fe,{children:t.jsxs(he,{...r?{}:{open:!1},children:[t.jsx(pe,{asChild:!0,children:t.jsx("span",{className:"inline-flex",children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:n,"aria-label":e?"Finish editing":"Edit file",disabled:r,"data-document-save-observation":d,children:e?t.jsx(me,{className:"size-4"}):t.jsx(ve,{className:"size-4"})})})}),t.jsx(xe,{children:"Editing is off"})]})})}const Ee=a.lazy(()=>ee(()=>import("./CodeMirrorEditor-DnkumDd3.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),ze=a.lazy(()=>ee(()=>import("./BlintzCanvas-BFJXKo1L.js").then(e=>e.B),__vite__mapDeps([5,1,2,6,4,7])).then(e=>({default:e.BlintzCanvas}))),Be=500;function Me(e,r){return r==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function Oe(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";case"uncertain":return"Save not confirmed";default:return null}}function te({content:e,documentId:r,cwd:d,loaded:n,theme:o,isEditing:s,onEditingChange:C,setDocumentEditing:y,observedBinding:b,fileSaveObservation:p="unavailable",recoveryBinding:x}){const _=e.readOnly!==!0,f=Me(e.sourcePath,e.language),w=ge(),[R,m]=a.useState(n),[T,F]=a.useState(),g=a.useRef(b);a.useLayoutEffect(()=>{g.current=b},[b]);const l=ke({documentId:r,sourcePath:e.sourcePath,cwd:d,loadedContent:n,documentSaveBinding:T,documentRecoveryBinding:x}),i=_e(l.recovery,p,x),c=we({cwd:d,sourcePath:f?e.sourcePath:null,content:R,saved:l.status==="saved"}),u=a.useRef(!1),j=a.useRef(s);a.useLayoutEffect(()=>(u.current=!0,j.current=s,()=>{u.current=!1}),[s]);const h=a.useRef(null),S=a.useRef(R),L=a.useRef(0),A=a.useRef(0),I=a.useRef(l.save),K=a.useRef(l.prepareFinalSave),U=a.useRef(l.waitForCloseDrain),E=a.useRef(null),V=a.useRef(C),Y=Ne({documentId:r,sourcePath:e.sourcePath,binding:T,save:l.save,draftRef:S,revisionRef:L,finishAttemptRef:A,timerRef:h,finalSaveRef:E,invalidateConfirmedFile:()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)}).catch(()=>{})}});a.useEffect(()=>{S.current=R,I.current=l.save,K.current=l.prepareFinalSave,U.current=l.waitForCloseDrain,V.current=C});const $=a.useCallback(v=>{var k;L.current+=1,S.current=v,m(v),(k=E.current)==null||k.cancel(),E.current=K.current(v),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,I.current(S.current)},Be)},[]),se=()=>{var P;if(i.editBlocked||p==="pending"||p==="ready"&&!((P=g.current)!=null&&P.current()))return;const v=g.current,k=v&&Object.freeze({...v.incarnation});F(v!=null&&v.current()&&k?{incarnation:k,current:()=>{const N=g.current;return!!N&&be(k,N.incarnation)&&N.current()}}:void 0),L.current+=1,S.current=n,m(n),C(!0),y(r,!0)},ne=async()=>{h.current&&(clearTimeout(h.current),h.current=null);const v=S.current,k=L.current,P=++A.current,N=await I.current(v);if(N.status!=="changed"&&N.status!=="no_op"||L.current!==k||A.current!==P||N.confirmed.content!==v)return;const q=N.confirmed;q.content===S.current&&w.setQueryData(B(d,e.sourcePath),Q=>Q&&{...Q,content:q.content,hash:q.hash}),C(!1),y(r,!1)},re=()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)})};a.useEffect(()=>{var v;s||(h.current&&clearTimeout(h.current),h.current=null,(v=E.current)==null||v.cancel(),E.current=null)},[s]),a.useEffect(()=>{const v=Y.current;return()=>{var N;h.current&&(clearTimeout(h.current),h.current=null);const k=(N=E.current)==null?void 0:N.flush(),P=S.current;v==null||v.settleRetirement(Promise.resolve(k).then(()=>U.current(P))),E.current=null,y(r,!1),V.current(!1)}},[r,y,Y]);const G=async()=>{if(s||!u.current||i.editBlocked)return;const v=L.current,k=await i.inspectCurrent();k.status!=="observed"||!u.current||j.current||L.current!==v||!l.recovery.current()||w.setQueryData(B(d,e.sourcePath),P=>P&&{...P,...k.value})},ae=()=>{const v=l.adoptDisk();v!=null&&m(v)},ie=()=>{l.overwrite(S.current)},W=l.status==="saved"?l.confirmedContent!==R?"Unsaved changes":l.documentReceipt?"Save recorded":"Saved to file":Oe(l.status),J=s?R:n;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsx(De,{recovery:i,editing:s,loadCurrent:()=>void G(),toolbar:t.jsxs(t.Fragment,{children:[_&&W&&t.jsx("span",{className:O("mr-1 text-xs",l.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:W}),!s&&p==="pending"&&t.jsx("span",{role:"status",children:"Checking document…"}),!s&&t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:re,"aria-label":"Refresh from disk",children:t.jsx(Te,{className:"size-4"})}),_&&t.jsx(Le,{editing:s,off:!s&&(p==="pending"||i.editBlocked),observation:p,onClick:s?()=>void ne():se}),t.jsx(Se,{recovery:i,editing:s,loadCurrent:()=>void G()})]})}),l.status==="uncertain"&&t.jsxs("div",{role:"status",className:"mx-2 mt-2 flex items-center gap-2 text-sm",children:[t.jsx("span",{children:"Save not confirmed. Retry the original save before saving another draft."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",onClick:()=>void l.retryUnconfirmed(),children:"Retry original save"})]}),l.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:ae,children:"Reload"}),t.jsx(D,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:ie,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(a.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:f?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(ze,{value:J,editable:s,onChange:s?$:void 0,wikiLinks:c})}):t.jsx(Ee,{value:J,editable:s,filename:e.sourcePath,languageHint:e.language,theme:o,onChange:s?$:void 0})})})]})}function Ae(e){const{fileSaveBinding:r,fileSaveObservation:d}=Re(e.documentId);return t.jsx(te,{...e,observedBinding:r,recoveryBinding:r,fileSaveObservation:d})}function Ie(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function at({content:e,documentId:r}){const d=ye(),n=z(g=>g.selectedCwd),o=z(g=>g.setDocumentEditing),s=z(g=>{var l;return((l=g.openDocuments.find(i=>i.id===r))==null?void 0:l.editing)??!1}),C=je(),y=z(g=>g.canvasSessionId),b=z(g=>g.roomCanvasLiveRoomId),{data:p,error:x,isLoading:_}=Ce({queryKey:B(n,e.sourcePath),enabled:n!==null,queryFn:()=>d.readFileContent(n,e.sourcePath),staleTime:3e4,retry:!1}),[f,w]=a.useState(null),R=g=>{w(g&&p?{pinnedHash:p.hash}:null)};if(n===null)return t.jsx(H,{children:"Open a chat to view files."});if(_)return t.jsx(H,{children:"Loading file…"});if(x||!p)return t.jsx(H,{children:Ie(x)});const m=f!==null&&s,T=(m?f==null?void 0:f.pinnedHash:null)??p.hash,F=y&&!b?Ae:te;return t.jsx(F,{content:e,documentId:r,cwd:n,loaded:p.content,theme:C,isEditing:m,onEditingChange:R,setDocumentEditing:o},`${e.sourcePath}:${T}`)}function H({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{at as CanvasFileContent};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-DedBFHsl.js","assets/index-B6Scr7KJ.js","assets/index-CujX3mpY.css"])))=>i.map(i=>d[i]);
2
- import{a1 as m,aY as n,r as s,j as t,aZ as p}from"./index-B6Scr7KJ.js";import{r as u}from"./use-session-canvas-BfKGOpNy.js";import"./rotate-cw-DNa7ENG3.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CZ68Qd2t.js";import"./WidgetErrorCard-BA3P7hNv.js";import"./index-B3xeyV6n.js";import"./card-DA_Z-FYX.js";import"./progress-qB87L0zJ.js";import"./markdown-content-Bk9lCksw.js";import"./table-DsxLk3Gx.js";import"./package-BmOMrNwc.js";import"./heart-C4CSHUW7.js";import"./git-branch-1zYKSuur.js";import"./file-text-CRTgqqkn.js";import"./file-DXbyb23e.js";import"./McpAppFrame-4JDJsrmg.js";import"./more-details-Bt9nlPmS.js";const d=s.lazy(()=>p(()=>import("./Model3dViewer-DedBFHsl.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.Model3dViewer})));function f(e){var o;const r=(o=e.split(".").pop())==null?void 0:o.toLowerCase();return r==="glb"||r==="gltf"?"gltf":r==="stl"?"stl":r==="obj"?"obj":r==="3mf"?"3mf":r==="ply"?"ply":r==="fbx"?"fbx":r==="dae"?"dae":null}function A({content:e}){const r=m(),o=n(i=>i.selectedCwd),l=s.useMemo(()=>u(e.src,i=>r.mediaUrl(o??"",i)),[e.src,r,o]),a=s.useMemo(()=>f(e.src),[e.src]);return l.url===null||a===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(s.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(d,{url:l.url,format:a,label:e.title??"Canvas 3D model"})})})}export{A as CanvasModel3dContent,f as formatOf};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-qUwwZnb2.js","assets/index-fge85Gub.js","assets/index-CujX3mpY.css"])))=>i.map(i=>d[i]);
2
+ import{a1 as m,aW as n,r as s,j as t,aX as p}from"./index-fge85Gub.js";import{r as u}from"./use-session-canvas-KguPfnsc.js";import"./rotate-cw-um9OzAM7.js";import"./query-keys-DeYqUDia.js";import"./index.esm-BEGwgVfU.js";import"./WidgetErrorCard-Bte2obmw.js";import"./index-DI9IsN-O.js";import"./card-CM7-_8nD.js";import"./progress-es667_cM.js";import"./markdown-content-DV3AiG76.js";import"./table-BcJvj9rx.js";import"./package-BafFSryH.js";import"./heart--8btr31M.js";import"./git-branch-uZFa3Tmr.js";import"./file-text-DLPhIP0f.js";import"./file-DiYwTQdD.js";import"./McpAppFrame-CmwiQHxf.js";import"./more-details-BUolHzrY.js";const d=s.lazy(()=>p(()=>import("./Model3dViewer-qUwwZnb2.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.Model3dViewer})));function f(e){var o;const r=(o=e.split(".").pop())==null?void 0:o.toLowerCase();return r==="glb"||r==="gltf"?"gltf":r==="stl"?"stl":r==="obj"?"obj":r==="3mf"?"3mf":r==="ply"?"ply":r==="fbx"?"fbx":r==="dae"?"dae":null}function A({content:e}){const r=m(),o=n(i=>i.selectedCwd),l=s.useMemo(()=>u(e.src,i=>r.mediaUrl(o??"",i)),[e.src,r,o]),a=s.useMemo(()=>f(e.src),[e.src]);return l.url===null||a===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(s.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(d,{url:l.url,format:a,label:e.title??"Canvas 3D model"})})})}export{A as CanvasModel3dContent,f as formatOf};
@@ -1,30 +1,30 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-XEE1k4cl.js","assets/index-B6Scr7KJ.js","assets/index-CujX3mpY.css","assets/room-files-source-BFo0FEUP.js","assets/markdown-content-Bk9lCksw.js","assets/file-exclamation-point-C8XqHyzY.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-JG_0k1NX.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-DNa7ENG3.js","assets/link-2-DzWm9OxA.js","assets/file-DXbyb23e.js","assets/git-branch-1zYKSuur.js","assets/more-details-Bt9nlPmS.js"])))=>i.map(i=>d[i]);
2
- import{O as F,r as i,j as l,B as ue,h4 as bn,mS as vn,g as kn,k1 as wn,G as te,a1 as fe,a3 as De,a4 as Pe,aP as H,cj as Fe,ck as Nn,cZ as In,mT as Rn,ly as Cn,mU as An,h as Mn,ax as jn,cq as Le,gw as se,q as Z,a7 as Be,s as pe,lY as Sn,mV as _n,mC as On,mW as En,eS as Tn,g9 as $n,e3 as Dn,mQ as Pn,mX as Fn,mY as Ln,a0 as Bn,bx as Un,mZ as Hn,m_ as Kn,jr as Wn,iq as qn,gB as Vn,kS as Ne,m$ as Ue,bW as zn,kR as Q,kV as He,n0 as Gn,ci as ge,ai as Jn,b_ as he,ij as Ke,n1 as Yn,cu as We,n2 as Qn,ff as Xn,ki as qe,n3 as Ve,aZ as Zn,gy as ze,kU as et,n4 as Ge,n5 as nt,n6 as tt,n7 as st,n8 as Ie,eU as ot,n9 as at,na as rt,nb as it,nc as ct,nd as lt,ne as dt,l as ut,hh as mt,ar as Je,kJ as ft,aj as pt,nf as gt,ng as ht,nh as xt,b8 as yt,c6 as bt,ni as vt,nj as kt,nk as wt,nl as Nt,by as Re,f3 as It}from"./index-B6Scr7KJ.js";import{g as Ce,m as Ae,h as xe,f as Ye,M as Rt,a as Ct,E as At,i as Mt,j as jt,c as P,k as St,b as _t,l as Ot,u as Et,C as Tt}from"./registry-tJrGs7kB.js";import"./WidgetErrorCard-BA3P7hNv.js";import{R as $t,A as Qe}from"./repeat-CBnopqBr.js";import{u as Dt}from"./use-room-sessions-CdjzO67_.js";import{M as Pt}from"./markdown-content-Bk9lCksw.js";import{W as Ft,a as Lt}from"./find-latest-widget-fence-D1i7qNny.js";import{f as Bt}from"./format-duration-BCr6uzby.js";import{H as Ut,a as Ht,b as Kt}from"./RuntimeSetupDialog-DPU4QIY9.js";import{M as Me}from"./mention-pill-os_7QQu2.js";import{R as Wt}from"./rotate-ccw-clock-D9XRHj5E.js";import{U as qt}from"./unplug-B6dUhqA7.js";import{M as Vt}from"./message-square-off-DuOiETNI.js";import{i as zt}from"./registry-BrjQCdmG.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BHXG7bNX.js","assets/index-fge85Gub.js","assets/index-CujX3mpY.css","assets/room-files-source-BO3E2ed0.js","assets/markdown-content-DV3AiG76.js","assets/file-exclamation-point-CnQYdJiV.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-CvIKejlx.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-um9OzAM7.js","assets/link-2-BY2WyWzK.js","assets/file-DiYwTQdD.js","assets/git-branch-uZFa3Tmr.js","assets/more-details-BUolHzrY.js"])))=>i.map(i=>d[i]);
2
+ import{O as F,r as i,j as l,B as ue,h4 as bn,n2 as vn,g as kn,k4 as wn,G as te,a1 as fe,a3 as De,a4 as Pe,aN as H,ch as Fe,ci as Nn,cX as In,n3 as Rn,lB as Cn,n4 as An,h as Mn,av as jn,co as Le,gw as se,q as Z,dD as Be,s as pe,l$ as Sn,n5 as On,mF as _n,n6 as En,eR as Tn,g8 as $n,e2 as Dn,n0 as Pn,n7 as Fn,n8 as Ln,a0 as Bn,bv as Un,n9 as Hn,na as Kn,ju as qn,it as Wn,gB as zn,kV as Ne,nb as Ue,bU as Vn,kU as X,kY as He,nc as Gn,cg as ge,ag as Yn,bY as he,im as Ke,nd as Jn,cs as qe,ne as Xn,fe as Qn,kl as We,nf as ze,aX as Zn,gy as Ve,kX as et,ng as Ge,nh as nt,ni as tt,nj as st,nk as Ie,eT as ot,nl as at,nm as rt,nn as it,no as ct,np as lt,nq as dt,l as ut,hh as mt,ap as Ye,kM as ft,ah as pt,nr as gt,ns as ht,nt as xt,b6 as yt,c4 as bt,nu as vt,nv as kt,nw as wt,nx as Nt,bw as Re,f2 as It}from"./index-fge85Gub.js";import{g as Ce,m as Ae,h as xe,f as Je,M as Rt,a as Ct,E as At,i as Mt,j as jt,c as P,k as St,b as Ot,l as _t,u as Et,C as Tt}from"./registry-5Qudcjd5.js";import"./WidgetErrorCard-Bte2obmw.js";import{R as $t,A as Xe}from"./repeat-HOHWZc6L.js";import{u as Dt}from"./use-room-sessions-CrFskgCJ.js";import{M as Pt}from"./markdown-content-DV3AiG76.js";import{W as Ft,a as Lt}from"./find-latest-widget-fence-BYtG5PzD.js";import{f as Bt}from"./format-duration-BCr6uzby.js";import{H as Ut,a as Ht,b as Kt}from"./RuntimeSetupDialog-CEUC7GrY.js";import{M as Me}from"./mention-pill-Db0XBC6Z.js";import{R as qt}from"./rotate-ccw-clock-Dniulnw5.js";import{U as Wt}from"./unplug-CK2bPGpg.js";import{M as zt}from"./message-square-off-w0__0O5g.js";import{i as Vt}from"./registry-DvKu39S1.js";/**
3
3
  * @license lucide-react v1.48.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const Xe={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};Xe.node;const Gt=F(Xe);/**
7
+ */const Qe={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};Qe.node;const Gt=F(Qe);/**
8
8
  * @license lucide-react v1.48.0 - ISC
9
9
  *
10
10
  * This source code is licensed under the ISC license.
11
11
  * See the LICENSE file in the root directory of this source tree.
12
- */const Ze={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};Ze.node;const Jt=F(Ze);/**
12
+ */const Ze={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};Ze.node;const Yt=F(Ze);/**
13
13
  * @license lucide-react v1.48.0 - ISC
14
14
  *
15
15
  * This source code is licensed under the ISC license.
16
16
  * See the LICENSE file in the root directory of this source tree.
17
- */const en={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};en.node;const Yt=F(en);/**
17
+ */const en={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};en.node;const Jt=F(en);/**
18
18
  * @license lucide-react v1.48.0 - ISC
19
19
  *
20
20
  * This source code is licensed under the ISC license.
21
21
  * See the LICENSE file in the root directory of this source tree.
22
- */const nn={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};nn.node;const Qt=F(nn);/**
22
+ */const nn={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};nn.node;const Xt=F(nn);/**
23
23
  * @license lucide-react v1.48.0 - ISC
24
24
  *
25
25
  * This source code is licensed under the ISC license.
26
26
  * See the LICENSE file in the root directory of this source tree.
27
- */const tn={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};tn.node;const Xt=F(tn);/**
27
+ */const tn={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};tn.node;const Qt=F(tn);/**
28
28
  * @license lucide-react v1.48.0 - ISC
29
29
  *
30
30
  * This source code is licensed under the ISC license.
@@ -39,6 +39,6 @@ import{O as F,r as i,j as l,B as ue,h4 as bn,mS as vn,g as kn,k1 as wn,G as te,a
39
39
  *
40
40
  * This source code is licensed under the ISC license.
41
41
  * See the LICENSE file in the root directory of this source tree.
42
- */const an={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};an.node;const es=F(an),ns='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function ts(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=i.useRef(null),r=i.useRef(!1);i.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let u=0,x=0;const v=()=>{var m;const f=(m=a.current)==null?void 0:m.querySelector(ns);if(f)return f.focus();++u<10&&(x=requestAnimationFrame(v))};return v(),()=>cancelAnimationFrame(x)},[t]);const c=i.useCallback(u=>{var x;!u&&((x=a.current)!=null&&x.contains(document.activeElement))||s(u)},[s]),d=i.useCallback(u=>{!o||u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),r.current=!0,s(!0))},[o,s]),g=i.useMemo(()=>({onEscapeKeyDown:()=>{var u;return(u=n.current)==null?void 0:u.focus()},onBlur:u=>{var v,f,m;const x=u.relatedTarget;x&&((v=a.current)!=null&&v.contains(x)||(f=n.current)!=null&&f.contains(x))||(m=a.current)!=null&&m.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:c,onTriggerKeyDown:d,contentHandlers:g}}function ce(e){const t=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",n=e.key==="Tab";if(!t&&!s&&!n)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const c=s||n&&e.shiftKey?-1:1;a[(r+c+a.length)%a.length].focus()}function ss({kind:e,about:t}){const n=[e==="agent"?"Agent":e==="human"?"Person":null,t.role].filter(Boolean).join(" · ");return!n&&!t.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[n&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n,children:n}),t.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:t.status})]})}function os({actions:e,onAct:t}){const s=n=>()=>{t(),n()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(bn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const as=300;function G({className:e,children:t}){return l.jsx("span",{className:te("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function ye({identity:e,children:t,onViewProfile:s,about:n,actions:o,onOpenChange:a,openOnClick:r=!1,className:c}){const{kind:d,displayName:g,handle:u,color:x,emoji:v,imageUrl:f,origin:m,agent:p}=e,h=x??"hsl(var(--muted-foreground))",w=typeof m=="object"&&m!==null,y=d==="agent"&&(p==null?void 0:p.working)!=null?p.working:null,[I,S]=i.useState(!1),C=i.useCallback(k=>{S(k),a==null||a(k)},[a]),A=i.useRef(!1),N=i.useRef(null),M=vn({onLongPress:()=>{A.current&&C(!0)}}),{contentRef:j,handleOpenChange:b,onTriggerKeyDown:_,contentHandlers:O}=ts({open:I,setOpen:C,triggerRef:N,enabled:r&&o!==void 0});return l.jsxs(Ut,{open:I,onOpenChange:b,openDelay:as,children:[l.jsx(Ht,{asChild:!0,ref:N,"data-gesture-priority":"",...M,onPointerDown:k=>{A.current=k.pointerType==="touch"||k.pointerType==="pen",M.onPointerDown(k)},...r?{onClick:()=>C(!0),onKeyDown:_}:{},children:t}),l.jsxs(Kt,{ref:j,...O,...o?{role:"dialog","aria-label":g}:{},"data-slot":"identity-hover-card",align:"start",className:te("flex w-64 flex-col gap-0 overflow-hidden p-0",c),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(kn,{"aria-hidden":!0,color:h,emoji:v,imageUrl:f,fallback:wn(g),kind:d,origin:m,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:g}),u&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",u]})]})]}),n&&l.jsx(ss,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((p==null?void 0:p.runtime)||(p==null?void 0:p.model))&&l.jsx(G,{children:[p.runtime,p.model].filter(Boolean).join(" · ")}),y&&l.jsxs(G,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Bt(y.forMs)]}),d==="human"&&l.jsx(G,{children:w?m.platform:"On this machine"}),d==="agent"&&(p==null?void 0:p.managedBy)&&l.jsxs(G,{children:["Managed by"," ",p.managedBy.handle?`@${p.managedBy.handle}`:p.managedBy.displayName]})]}),o?l.jsx(os,{actions:o,onAct:()=>{var k;(k=N.current)==null||k.focus(),C(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var k;(k=N.current)==null||k.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function rs(){const e=fe(),t=De();return Pe({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var u;const r=t.getQueryData(H.entries(s)),c=(u=r==null?void 0:r.find(x=>x.id===n))==null?void 0:u.reactions,{reactions:d,on:g}=Ce(c,o,a);return t.setQueryData(H.entries(s),x=>Ae(x,n,d)),{on:g}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,g;const r=t.getQueryData(H.entries(s)),c=((g=(d=r==null?void 0:r.find(u=>u.id===n))==null?void 0:d.reactions)==null?void 0:g.some(u=>u.emoji===o&&u.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},c)=>{c!==void 0&&t.setQueryData(H.entries(n),d=>{var x;const g=(x=d==null?void 0:d.find(v=>v.id===o))==null?void 0:x.reactions,{reactions:u}=Ce(g,a,r,!c.on);return Ae(d,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(H.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function W(e){return e.threadRootEntryId??e.parentEntryId}function is(e){return W(e)??e.id}function cs(e,t){return Math.max(t??0,e)}function Vo(e,t,s){let n=e[0],o=0;for(const a of e)a.seq>n.seq&&(n=a),t!==null&&a.seq>t&&(o+=1);return{count:cs(e.length,s),lastAt:n.createdAt,unread:o}}function ls(e){var C,A;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=Fe(),r=Nn(),c=a&&o&&t!==void 0,d=In(c?t:null),g=Rn(d.member),u=Cn(),x=An(),v=Mn(),f=jn(),{data:m}=Le({enabled:c&&r}),p=f.status==="ready"?f.roomId:null,h=m==null?void 0:m.find(N=>N.id===p),w=h?se(h):null,y=(A=(C=d.member)==null?void 0:C.agent)==null?void 0:A.effectiveRuntimeId,I=i.useCallback(()=>{t!==void 0&&(Z.getState().recordOpened("agent",t),u({agentPath:t},y?{runtime:y}:{}))},[t,u,y]),S=i.useCallback(async()=>{if(t===void 0||!v)return;const N=await x(t);if(N===null){Be(`${s} has no session in ${w??"this room"} yet`);return}v(pe({session:N}))},[t,v,x,s,w]);return i.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:g},actions:{onMessage:I,...n?{onViewProfile:n}:{},...r&&w?{session:{label:`Session in ${w}`,onOpen:()=>void S()}}:{}}},[a,t,d.role,g,I,n,r,w,S])}function ds({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=i.useState(!1),c=ls({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=i.useCallback(g=>{g&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&c!==null,...c?{about:c.about,actions:c.actions}:{},children:o})}function us(e){return l.jsx(Lt,{code:e.code,isIncomplete:e.isIncomplete})}const ms=[{language:Ft,component:us}],fs={turn_failed:{Icon:Bn,tone:"text-status-warning"},agent_busy:{Icon:Ln},agent_gone:{Icon:es,tone:"text-status-warning"},agent_left:{Icon:je,tone:"text-status-warning"},room_archived:{Icon:Fn},agent_reseated:{Icon:Pn},handle_changed:{Icon:Qe},files_set_up:{Icon:Dn},runtime_gone:{Icon:Qt,tone:"text-status-warning"},agent_paused:{Icon:$n},agent_declined:{Icon:Vt},agent_unavailable:{Icon:Tn},awaiting_approval:{Icon:Gt,tone:"text-status-warning"},halted:{Icon:En},budget_reached:{Icon:On},cascade_stopped:{Icon:_n},addressing_changed:{Icon:Yt},bridge_blocked:{Icon:qt,tone:"text-status-warning"},bridge_undelivered:{Icon:Sn,tone:"text-status-warning"},bridge_rate_limited:{Icon:Zt},bridge_second_agent_refused:{Icon:je},bridge_disconnected:{Icon:Jt},bridge_agent_swapped:{Icon:$t},bridge_history_note:{Icon:Wt}},ps={Icon:Un},le=80;function gs(e){const t=e.trim();if(t.length<=le)return t;const s=t.slice(0,le),n=s.lastIndexOf(" ");return`${(n>le/2?s.slice(0,n):s).trimEnd()}…`}function hs(e,t,s){const n=xs(e,s),o=a=>l.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:a});return n===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function xs(e,t){if(t!==void 0){const n=Hn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=Kn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function ys({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,tone:r}=(e.body.notice&&fs[e.body.notice])??ps;return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":gs(e.body.text)},...xe(t),className:te("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",r??"text-muted-foreground"),children:[l.jsx(a,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),l.jsx("span",{children:n?hs(e.body.text,n,o):e.body.text})]})}const bs=zt.moment;function vs({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=Ye(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:l.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(Rt,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(bs,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:Ct(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function ks(e,t){const s=Q.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
43
- `)?"":" ";s.set(e,`${n}${o}@${t} `)}function ws({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const a=is(t),r=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,d=s==null?void 0:s.displayName,{copy:g}=Wn({toastOnSettle:!0});return i.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Xt,run:()=>{Vn.getState().openThread(e,a,!0),Ne.getState().requestFocus(Ue(e,a))}},copy:{id:"copy",label:"Copy text",icon:qn,run:()=>void g(r)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:zn,run:o}),c!==void 0&&(u.mention={id:"mention",label:d===void 0?"Mention author":`Mention ${d}`,icon:Qe,run:()=>{ks(e,c),Ne.getState().requestFocus(e)}}),At.map(x=>u[x]).filter(x=>x!==void 0)},[e,a,r,c,d,o,g])}function Ns(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function zo(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function Go(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function Is(e,t,s){const n=t.get(e),o=He({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Jo(e){const t=new Set;for(const a of e)W(a)===null&&t.add(a.id);const s=[],n=new Map,o=new Set;for(const a of e){const r=W(a);if(r===null){s.push(a);continue}if(!t.has(r)){s.push(a),o.add(a.id);continue}const c=n.get(r);c?c.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Rs(e){return`thread-${e}`}function Cs(e){return`thread-row-${e}`}function Yo(e){return`thread-panel-entry-${e}`}function As(e){return`room-entry-${e}`}function Ms(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=W(s)??null,o={rowId:t,domId:As(t)};if(n===null)return o;const a=e.find(c=>c.id===n);return a!==void 0&&(W(a)??null)===null?{rowId:Rs(n),domId:Cs(n)}:o}function Qo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Ms(e,s.id)}const Se=48;function Xo(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:n,excerpt:a.length>Se?`${a.slice(0,Se).trimEnd()}…`:a}}function js(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=Gn({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:Jn(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Ss(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const _s={info:new Map,faces:new Map},be=i.createContext(_s);function Zo({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function ea(){const e=he(),t=i.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=i.useMemo(()=>t.map(r=>r.projectPath),[t]),n=Ke(s),o=i.useMemo(()=>js(t,n.data??{}),[t,n.data]),a=i.useMemo(()=>Ss(o),[o]);return i.useMemo(()=>({info:o,faces:a}),[o,a])}function ee(e){const t=i.useContext(be);return e===void 0?void 0:t.info.get(e)}function Os(){return i.useContext(be).faces}function Es({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(c)}}const X=120,Ts="code block";function $s(e){if(e.length<=X&&!e.includes("```"))return null;const t=Ds(e);return t.length===0?null:t}function Ds(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Ts} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=X)return t;const s=Ps(t,X),n=s.lastIndexOf(" ");return`${(n>X/2?s.slice(0,n):s).trimEnd()}…`}function Ps(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of n.segment(e)){if(o.length+a.length>t)break;o+=a}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Fs({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=rs(),c=o===!0||!a,d=i.useMemo(()=>t.reactions??[],[t.reactions]),g=i.useMemo(()=>d.filter(v=>Mt(v,s)).map(v=>v.emoji),[d,s]),u=i.useCallback(v=>r.mutate({roomId:e,entryId:t.id,emoji:v,viewerAuthorId:s}),[r,e,t.id,s]),x=i.useMemo(()=>({quick:n,mine:g,onToggle:u,disabled:c}),[n,g,u,c]);return{reactions:d,toggle:u,quickRow:x}}function Ls({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var a,r;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(a=t.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(r=e.current)==null||r.focusFirst())}}function Bs(e,t){var x,v;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Yn.includes(n),a=Dt(e,{enabled:o}),r=We(),c=De(),d=fe(),g=o?((v=(x=a.data)==null?void 0:x.bindings.find(f=>f.authorId===s))==null?void 0:v.sessionId)??null:null,u=i.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(g===null||s===void 0)&&Qn({queryClient:c,transport:d},e,s).then(m=>{m.kind!=="none"&&r(pe({session:m.kind==="bound"?m.sessionId:g}))}))},[s,r,c,e,g,d]);return i.useMemo(()=>g===null?null:{href:Xn({session:g}),onOpen:u},[u,g])}const ne="mention",ve="author_id",Us={[ne]:[ve]},Hs=[ne];function Ks(e,t){if(!t||t.length===0)return e;const s=Ws(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:c}=s[o],d=n.slice(0,a),g=n.slice(a,a+r),u=n.slice(a+r);n=`${d}<${ne} ${ve}="${c}">${g}</${ne}>${u}`}return n}function Ws(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(n.push(a),o=a.offset+a.length);return n}const qs=new Map,rn=i.createContext(qs);function Vs({authors:e,children:t}){return l.jsx(rn.Provider,{value:e,children:t})}function zs(e){const t=i.useContext(rn);return e===void 0?void 0:t.get(e)}const _e=new WeakMap;function Gs(e){const t=_e.get(e);if(t)return t;const s=new Map(e.map(n=>[ge(n.projectPath),n.projectPath]));return _e.set(e,s),s}function Js(e){var n;const s=(n=he().data)==null?void 0:n.agents;return i.useMemo(()=>e===void 0||!s?void 0:Gs(s).get(e),[s,e])}function cn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=Fe(),a=Js(o?t:void 0),r=ee(t);return i.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const c={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(g,u={})=>l.jsx(ds,{identity:c,agentPath:a,onViewProfile:n,openOnClick:u.openOnClick??!1,children:g});return{wrap:d,wrapAvatar:g=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:g}),{openOnClick:!0}),wrapName:g=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:te(g.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,n])}const Ys={kind:"human",displayName:""};function Qs(e){return typeof e=="string"?e.replace(/^@/,""):""}function Xs({authorId:e,children:t}){const s=zs(e),n=ee(s==null?void 0:s.agentRef),{open:o}=qe(),a=s?He({record:s,override:n==null?void 0:n.visual}):null,r=s?Ve(s,n==null?void 0:n.memberId):void 0,c=i.useMemo(()=>r===void 0?void 0:()=>o(r),[r,o]),d=a==null?void 0:a.color,g=a==null?void 0:a.emoji,u=a==null?void 0:a.imageUrl,x=i.useMemo(()=>s?{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:d,emoji:g,imageUrl:u,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}}:null,[s,d,g,u,n]),v=cn({agentRef:s==null?void 0:s.agentRef,identity:x??Ys,onViewProfile:c});if(!s||!x)return l.jsx(Me,{kind:"human",label:Qs(t),resolved:!1});const m=v?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),c())}}:{},p=l.jsx(Me,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...m});return v?v.wrap(p,{openOnClick:!0}):l.jsx(ye,{onViewProfile:c,identity:x,children:p})}function Zs(e){return{mention:t=>{const s=t[ve],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?l.jsx(l.Fragment,{children:t.children}):l.jsx(Xs,{authorId:n,children:t.children})}}}function eo({entry:e,authors:t}){const s=i.useMemo(()=>Ks(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=i.useMemo(()=>{var a;return new Set(((a=e.mentionSpans)==null?void 0:a.map(r=>r.authorId))??[])},[e.mentionSpans]),o=i.useMemo(()=>Zs(n),[n]);return l.jsx(Vs,{authors:t,children:l.jsx(Pt,{content:s,className:"msg-prose",allowedTags:Us,literalTagContent:Hs,components:o,renderers:ms})})}function no(e){return function(s){return l.jsx(eo,{entry:s,authors:e})}}const ln="the top folder";function Oe(e){return e.slice(e.lastIndexOf("/")+1)}function to(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function so(e){return e===""?ln:`${e}/`}function de(e){return e.target!==void 0?e.target===""?ln:e.target:so(to(e.paths[0]??""))}function oo(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${Oe(s)} to ${de(e)}`:`${t} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${Oe(s)} from the chat to ${de(e)}`}}const ao=i.lazy(()=>Zn(()=>import("./index-XEE1k4cl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function na({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:c,streamStalled:d,isMember:g=!0,grouping:u,orphanedReply:x,answers:v,feedPosition:f,rowId:m}){const p=Ye(t.createdAt),h=i.useMemo(()=>{const L=$s(t.body.text),ie=jt(t.attachments??[]);if(ie===null)return L;const we=L??t.body.text.trim();return we.length>0?`${we} ${ie}`:ie},[t.body.text,t.attachments]),w=i.useId(),y=`${w}-author`,I=`${w}-content`,S=`${w}-summary`,C=i.useRef(null),A=i.useRef(null),N=i.useRef(null),{reactions:M,toggle:j,quickRow:b}=Fs({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:c,streamStalled:d,isMember:g}),_=ee(n==null?void 0:n.agentRef),{open:O}=qe(),k=n===void 0?void 0:Ve(n,_==null?void 0:_.memberId),D=i.useCallback(()=>{k!==void 0&&O(k)},[O,k]),T=k===void 0?void 0:D,q=ws({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:T}),V=(n==null?void 0:n.handle)??void 0,B=i.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:V,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,V,s.color,s.emoji,s.imageUrl]),$=cn({agentRef:n==null?void 0:n.agentRef,identity:B,onViewProfile:T}),R=Ls({barRef:A,pillsRef:N,hasReactions:M.length>0}),U=i.useCallback(()=>{var L;return(L=C.current)==null?void 0:L.focus()},[]),oe=i.useMemo(()=>no(o),[o]),gn=i.useCallback(L=>l.jsx(i.Suspense,{fallback:null,children:l.jsx(ao,{roomId:e,attachment:L})}),[e]),hn=Os(),ae=t.body.subjectAuthorId??t.authorId,E=o.get(ae),z=ee(E==null?void 0:E.agentRef),xn=Bs(e,t),re=Ns(t);if(re.kind==="notice")return l.jsx(ys,{entry:t,feedPosition:f,rowId:m,sessionLink:xn,subjectName:E==null?void 0:E.displayName});if(re.kind==="moment")return l.jsx(vs,{entry:t,moment:re.moment,subject:ae===t.authorId?s:Is(ae,o,hn),subjectIdentity:{handle:(E==null?void 0:E.handle)??void 0,origin:E==null?void 0:E.origin,agent:z&&{runtime:z.runtime,...z.model&&{model:z.model}}},feedPosition:f,rowId:m});const yn=u.position==="first"||u.position==="only";return l.jsxs(P.Root,{ref:C,id:m,position:u.position,actions:q,reactions:b,"data-testid":"room-entry",tabIndex:0,...Es({showAuthorHeader:yn,headerId:y,displayName:s.displayName,time:p,summary:h,contentId:I,summaryId:S,feedPosition:f}),onKeyDown:R,children:[l.jsx(P.Gutter,{author:s,at:t.createdAt,onViewProfile:$?void 0:T,isSelf:t.authorId===a,renderAvatar:$==null?void 0:$.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:y,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,renderName:$==null?void 0:$.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),v!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${v.excerpt}”`}),t.body.via&&l.jsx(St,{via:t.body.via}),l.jsx(P.Content,{id:I,className:"wrap-anywhere [&_pre]:overflow-x-auto [&_pre]:wrap-normal",children:t.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:oo(t.body.fileChange,(E==null?void 0:E.displayName)??"Somebody")}):oe(t,{rowId:t.id,isStreaming:!1})}),h!==null&&l.jsx("span",{id:S,className:"hidden",children:h}),l.jsx(P.Attachments,{items:t.attachments??[],renderAction:g?gn:void 0}),l.jsx(P.Reactions,{ref:N,reactions:M,viewerAuthorId:a,names:r,frequents:c,onToggle:j,disabled:d===!0||!g,onExit:U}),l.jsx(P.Actions,{actions:q,reactions:b,barRef:A,onExit:U})]})]})}const ta={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function ro(e){const t=fe(),[s,n]=i.useState([]),o=i.useRef(new Map),a=i.useCallback(f=>{const m=f.map(p=>({id:crypto.randomUUID(),file:p,status:"pending",progress:0}));n(p=>[...p,...m])},[]),r=i.useCallback(f=>{o.current.delete(f),n(m=>m.filter(p=>p.id!==f))},[]),c=i.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const m=new Set(f);for(const p of m)o.current.delete(p);n(p=>p.filter(h=>!m.has(h.id)))},[]),d=i.useCallback(f=>{o.current.delete(f),n(m=>m.map(p=>p.id===f&&p.status==="error"?{...p,status:"pending",progress:0,error:void 0}:p))},[]),g=i.useRef(null),u=Pe({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(w=>w.map(y=>f.some(I=>I.id===y.id)?{...y,status:"uploading"}:y));const m=w=>{n(y=>y.map(I=>I.status==="uploading"?{...I,progress:w.percentage}:I))},p=new AbortController;g.current=p;const h=f.map(w=>w.file);return t.uploadRoomAttachments(e,h,m,p.signal)},onSettled:()=>{g.current=null},onSuccess:(f,m)=>{m.forEach((p,h)=>{const w=f[h];w&&o.current.set(p.id,w.id)}),n(p=>p.map(h=>m.findIndex(y=>y.id===h.id)===-1?h:{...h,status:"uploaded",progress:100}))},onError:f=>{n(m=>m.map(p=>p.status==="uploading"?{...p,status:"error",error:f.message}:p))}}),x=i.useCallback(()=>{var f;(f=g.current)==null||f.abort()},[]),v=i.useCallback(async()=>{const f=s.filter(p=>p.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const m=s.filter(p=>p.status==="pending");return m.length>0&&await u.mutateAsync(m),s.map(p=>o.current.get(p.id)).filter(p=>p!==void 0)},[s,u]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:c,cancelUpload:x,uploadAndGetIds:v,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function sa(e){const{room:t,threadRootId:s}=e,n=_t(),o=Ot(),a=ro((t==null?void 0:t.id)??""),r=t!==void 0&&ze(t.members,t.viewerAuthorId),c=i.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});i.useEffect(()=>{c.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=i.useCallback(y=>c.current.attachments.addFiles(y),[]),g=i.useCallback(y=>c.current.attachments.removeFile(y),[]),u=i.useCallback(y=>c.current.attachments.retryFile(y),[]),x=i.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:v,hasFailedUpload:f,isUploading:m}=a,p=i.useMemo(()=>({staged:v,add:d,remove:g,retry:u,cancel:x,hasFailed:f,isUploading:m,holdsSendWhileUploading:!1}),[v,f,m,d,g,u,x]),h=i.useCallback(async y=>{const{attachments:I,post:S,reply:C,room:A,threadRootId:N}=c.current;if(A===void 0)throw new Error("That room isn’t loaded yet.");if(A.archived)throw new Error("This room is archived.");Z.getState().recordOpened("room",A.id);const M=et(),j=I.pendingFiles.map(k=>k.file.name),b=I.pendingFiles.map(k=>k.id),_=await I.uploadAndGetIds();I.clearFiles(b);const O=y.parentEntryId??N;if(O!==void 0){C.mutate({roomId:A.id,rootEntryId:O,text:y.text,clientId:M,attachmentIds:_,attachmentNames:j});return}S.mutate({roomId:A.id,text:y.text,clientId:M,attachmentIds:_,attachmentNames:j})},[]);return{target:i.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&r,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Ge},send:h,attachments:p}),[t,s,r,p,h]),attachments:a}}const dn=8;function un(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function io(e){if(st(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:un(e.topic)}function Ee(e){return{kind:"session",id:e.id,name:tt(e.title),summary:un(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function co(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:io(e),lastActivityAt:e.lastActivityAt,room:e}}function J(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function lo(e){return e.kind==="session"?Ie("session",e.id):Ie("room",e.id)}function Te(e,t){const s=[J(t[lo(e)]),...e.kind==="session"?[J(e.session.lastTouchedByYouAt),J(e.session.userLastMessageAt)]:[]].filter(n=>n!==null);return s.length>0?Math.max(...s):J(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function uo(e){return(t,s)=>Te(s,e)-Te(t,e)||s.id.localeCompare(t.id)}function mo(e){const t=new Set;return e.filter(s=>{const n=`${s.kind}:${s.id}`;return t.has(n)?!1:(t.add(n),!0)})}function fo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function po({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=dn}){const{yours:a,spinOffs:r,automated:c}=nt(e),d=uo(n),g=[...a.map(Ee),...t.filter(u=>fo(u,s)).map(co)].sort(d);return{items:mo(g).slice(0,o),automated:[...r,...c].map(Ee).sort(d).slice(0,o)}}const go=3,ho=rt;function xo({limit:e=dn,mutedRoomIds:t,enabled:s=!0}={}){var g,u;const n=ot(Math.max(e*go,ho),{enabled:s}),o=Le({enabled:s}),a=at(),r=(g=n.data)==null?void 0:g.sessions,c=o.data;return{...i.useMemo(()=>po({sessions:r??[],rooms:c??[],mutedRoomIds:t,interactions:a,limit:e}),[r,c,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((u=n.data)==null?void 0:u.warnings)??[]}}const yo=6,mn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const bo='[role="combobox"]';function K(e){return e instanceof Element&&e.matches(bo)}function vo({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=We(),o=it(),[a,r]=i.useState(!1),[c,d]=i.useState({stamp:"",index:0}),[g,u]=i.useState(!1),[x,v]=i.useState(!1);e.length>0&&!x&&v(!0);const f=i.useRef(!1);i.useEffect(()=>{f.current=!0},[]);const{data:m}=he({enabled:s}),p=i.useMemo(()=>((m==null?void 0:m.agents)??[]).map(R=>R.projectPath),[m]),{data:h}=Ke(p,{enabled:s}),w=i.useMemo(()=>h??{},[h]),y=i.useMemo(()=>ct(p,w),[p,w]),I=i.useMemo(()=>new Map(p.map(R=>[ge(R),R])),[p]),S=i.useCallback(R=>lt({room:R,agentsByPath:w,pathByAgentRef:I}),[w,I]),C=i.useMemo(()=>dt(o.muted),[o.muted]),{items:A}=xo({mutedRoomIds:C,enabled:s}),N=i.useMemo(()=>A.slice(0,yo),[A]),M=s&&a&&!g&&!x&&!t&&e.length===0&&N.length>0,j=`${M}:${N.length}`,b=c.stamp===j?c.index:0,_=i.useCallback(R=>{f.current&&K(R.target)&&(u(!1),v(!1),r(!0))},[]),O=i.useCallback(R=>{K(R.target)&&r(!0)},[]),k=i.useCallback(R=>{K(R.target)&&r(!1)},[]),D=i.useCallback(R=>{N.length!==0&&d(U=>{const oe=U.stamp===j?U.index:0;return{stamp:j,index:(oe+R+N.length)%N.length}})},[N.length,j]),T=i.useCallback(()=>D(1),[D]),q=i.useCallback(()=>D(-1),[D]),V=i.useCallback(()=>{u(!0)},[]),B=i.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Z.getState().recordOpened("agent",R.session.cwd),n(pe({dir:R.session.cwd??void 0,session:R.session.id}));return}Z.getState().recordOpened("room",R.room.id),n({...ut.channels(),search:{id:R.room.id}})},[n]),$=i.useCallback(()=>{const R=N[b];!M||!R||B(R)},[M,N,b,B]);return{isOpen:M,hasRows:N.length>0,rows:N,agents:w,displayNames:y,visualOf:S,selectedIndex:b,activeDescendantId:M&&N[b]!==void 0?ke(b):void 0,listboxId:M?mn:void 0,handleFocus:_,handleBlur:k,handlePointerDown:O,moveDown:T,moveUp:q,selectHighlighted:$,selectRow:B,dismiss:V}}function fn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:c,onSelect:d}){const g=i.useMemo(()=>Number.isNaN(Date.parse(o))?null:yt(o),[o,c]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),g!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:g})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function ko({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const c=ft(t,e.session.cwd??s);return l.jsx(fn,{mark:l.jsx(pt,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:a,onSelect:r})}function wo({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(fn,{mark:l.jsx(ht,{room:e.room,participants:e.room.participants,visuals:xt(t)}),label:l.jsx(gt,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:a})}function No({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=mt(6e4);return i.useEffect(()=>{var c,d;(d=(c=document.getElementById(ke(t)))==null?void 0:c.scrollIntoView)==null||d.call(c,{block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:l.jsx("div",{id:mn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,d)=>{var g;return c.kind==="session"?l.jsx(ko,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((g=c.session.cwd)==null?void 0:g.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`session-${c.id}`):l.jsx(wo,{item:c,visual:o(c.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`room-${c.id}`)})})})}const $e={people:"People",agents:"Agents"},Io=["people","agents"];function Ro(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Co(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Ao(a,n)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Ao(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let n=null;for(const a of s){const r=a===t?0:a.startsWith(t)?1:a.includes(t)?2:null;r!==null&&(n===null||r<n)&&(n=r)}return n}function Y(e,t,s){var a;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let r=0;r<n;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+n)%n}return 0}function Mo(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,c=a.startsWith(" ")?"":" ";return{value:o+r+c+a,cursorPos:o.length+r.length+1}}const jo=/(^|\s)@([A-Za-z0-9_.-]*)$/,pn="mention-palette-listbox";function me(e){return`mention-item-${e}`}function So({members:e,viewerAuthorId:t,text:s,sectionOrder:n=Io}){var O;const[o,a]=i.useState(!1),[r,c]=i.useState(""),[d,g]=i.useState(-1),u=bt(s),x=i.useRef(!1),v=i.useMemo(()=>Ro(e,t),[e,t]),f=i.useMemo(()=>o?Co(v,r,n):[],[v,r,o,n]),[m,p]=i.useState(null),h=m!==null&&m.query===r&&m.open===o?m.index:Y(f,0,1),w=f[h],y=f.length===0||w!==void 0&&!w.disabled?h:Y(f,0,1),I=i.useCallback((k,D)=>{const T=k.slice(0,D).match(jo);if(!T){a(!1);return}a(!0),c(T[2]),g((T.index??0)+T[1].length)},[]),S=i.useCallback(k=>{u.write(k),x.current=!1},[u]),C=i.useCallback(k=>{x.current||I(u.read(),k)},[I,u]),A=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y+1,1)})},[f,y,r,o]),N=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y-1,-1)})},[f,y,r,o]),M=i.useCallback(k=>k.disabled||k.handle===void 0?null:(x.current=!0,a(!1),Mo(u.read(),d,r,k.handle)),[d,r,u]),j=i.useCallback(()=>{const k=f[y];return k?M(k):(a(!1),null)},[f,y,M]),b=i.useCallback(()=>{x.current=!0,a(!1)},[]),_=f.some(k=>!k.disabled);return{isOpen:o,hasSelectableRows:_,rows:f,selectedIndex:y,activeDescendantId:o&&((O=f[y])==null?void 0:O.disabled)===!1?me(y):void 0,listboxId:o?pn:void 0,noteTextChange:S,handleCursorChange:C,moveDown:A,moveUp:N,selectHighlighted:j,selectRow:M,dismiss:b}}function _o({rows:e,selectedIndex:t,onSelect:s}){const n=i.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const c=o[o.length-1];c&&c.section===a.section?c.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return i.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:pn,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":$e[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:$e[o]}),a.map(({row:c,index:d})=>{const g=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":g,"aria-disabled":c.disabled,"data-selected":g,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function oa({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:Ue(e.id,t),c=vt(r),{target:d}=Et(),g=kt(),u=wt(r),x=i.useRef(null),v=ze(e.members,e.viewerAuthorId),f=i.useRef(!1),m=So({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),p=n===!0,h=vo({value:c,yieldToPalette:m.isOpen,enabled:p}),w=i.useRef(u);i.useEffect(()=>{var b;u!==w.current&&(w.current=u,(b=x.current)==null||b.focus())},[u]),i.useEffect(()=>{var b;s===!0&&((b=x.current)==null||b.focusUnlessTouch())},[]);const y=i.useCallback(b=>Q.getState().set(r,b),[r]),[I,S]=i.useState(null);i.useLayoutEffect(()=>{var b;I!==null&&((b=x.current)==null||b.focusAt(I.pos))},[I]);const C=i.useCallback(b=>{b&&(y(b.value),S({pos:b.cursorPos}))},[y]),A=i.useCallback(b=>C(m.selectRow(b)),[m,C]),N=i.useCallback(()=>C(m.selectHighlighted()),[m,C]),M=()=>{if(d===null||!d.canSend||f.current)return;m.dismiss();const b=Q.getState().take(r).trim();if(b==="")return;const _=a.pendingFiles.length>0;_&&(f.current=!0),d.send({text:b}).catch(()=>{const O=Q.getState(),k=O.drafts[r]??"";O.set(r,k===""?b:`${b}
44
- ${k}`)}).finally(()=>{_&&(f.current=!1)})};if(!v)return l.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[l.jsx("p",{className:"text-muted-foreground text-sm",children:Ge}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:g.isPending,onClick:()=>g.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>Be.success(`You joined ${se(e)}`)}),children:Nt})]});const j=l.jsx(Tt.Composer,{inputRef:x,value:c,onChange:b=>{y(b),m.noteTextChange(b)},onSubmit:M,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:m.isOpen&&m.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Re,{children:m.isOpen&&l.jsx(_o,{rows:m.rows,selectedIndex:m.selectedIndex,onSelect:A})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Re,{children:h.isOpen&&l.jsx(No,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:m.handleCursorChange,isStreaming:!1,isPaletteOpen:m.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:m.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:m.moveUp,onArrowDown:h.isOpen?h.moveDown:m.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:N,onEscape:h.isOpen?h.dismiss:m.dismiss,tabPicks:!h.isOpen,onClear:()=>{y(""),m.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:m.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:m.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!p&&o===void 0?j:l.jsx("section",{className:"flex flex-col","data-testid":It.homeComposer,onFocus:b=>{h.handleFocus(b),K(b.target)&&(o==null||o(!0))},onBlur:b=>{h.handleBlur(b),K(b.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:j})}export{Zo as A,oa as C,ye as I,ta as R,zo as a,na as b,Is as c,Go as d,ea as e,Xo as f,Jo as g,Rs as h,cs as i,Vo as j,Cs as k,As as l,Ms as m,Yo as n,Qo as o,K as p,is as r,W as t,sa as u};
42
+ */const an={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};an.node;const es=F(an),ns='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function ts(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=i.useRef(null),r=i.useRef(!1);i.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let u=0,x=0;const v=()=>{var m;const f=(m=a.current)==null?void 0:m.querySelector(ns);if(f)return f.focus();++u<10&&(x=requestAnimationFrame(v))};return v(),()=>cancelAnimationFrame(x)},[t]);const c=i.useCallback(u=>{var x;!u&&((x=a.current)!=null&&x.contains(document.activeElement))||s(u)},[s]),d=i.useCallback(u=>{!o||u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),r.current=!0,s(!0))},[o,s]),g=i.useMemo(()=>({onEscapeKeyDown:()=>{var u;return(u=n.current)==null?void 0:u.focus()},onBlur:u=>{var v,f,m;const x=u.relatedTarget;x&&((v=a.current)!=null&&v.contains(x)||(f=n.current)!=null&&f.contains(x))||(m=a.current)!=null&&m.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:c,onTriggerKeyDown:d,contentHandlers:g}}function ce(e){const t=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",n=e.key==="Tab";if(!t&&!s&&!n)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const c=s||n&&e.shiftKey?-1:1;a[(r+c+a.length)%a.length].focus()}function ss({kind:e,about:t}){const n=[e==="agent"?"Agent":e==="human"?"Person":null,t.role].filter(Boolean).join(" · ");return!n&&!t.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[n&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n,children:n}),t.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:t.status})]})}function os({actions:e,onAct:t}){const s=n=>()=>{t(),n()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(bn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const as=300;function G({className:e,children:t}){return l.jsx("span",{className:te("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function ye({identity:e,children:t,onViewProfile:s,about:n,actions:o,onOpenChange:a,openOnClick:r=!1,className:c}){const{kind:d,displayName:g,handle:u,color:x,emoji:v,imageUrl:f,origin:m,agent:p}=e,h=x??"hsl(var(--muted-foreground))",w=typeof m=="object"&&m!==null,y=d==="agent"&&(p==null?void 0:p.working)!=null?p.working:null,[I,S]=i.useState(!1),C=i.useCallback(k=>{S(k),a==null||a(k)},[a]),A=i.useRef(!1),N=i.useRef(null),M=vn({onLongPress:()=>{A.current&&C(!0)}}),{contentRef:j,handleOpenChange:b,onTriggerKeyDown:O,contentHandlers:_}=ts({open:I,setOpen:C,triggerRef:N,enabled:r&&o!==void 0});return l.jsxs(Ut,{open:I,onOpenChange:b,openDelay:as,children:[l.jsx(Ht,{asChild:!0,ref:N,"data-gesture-priority":"",...M,onPointerDown:k=>{A.current=k.pointerType==="touch"||k.pointerType==="pen",M.onPointerDown(k)},...r?{onClick:()=>C(!0),onKeyDown:O}:{},children:t}),l.jsxs(Kt,{ref:j,..._,...o?{role:"dialog","aria-label":g}:{},"data-slot":"identity-hover-card",align:"start",className:te("flex w-64 flex-col gap-0 overflow-hidden p-0",c),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(kn,{"aria-hidden":!0,color:h,emoji:v,imageUrl:f,fallback:wn(g),kind:d,origin:m,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:g}),u&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",u]})]})]}),n&&l.jsx(ss,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((p==null?void 0:p.runtime)||(p==null?void 0:p.model))&&l.jsx(G,{children:[p.runtime,p.model].filter(Boolean).join(" · ")}),y&&l.jsxs(G,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Bt(y.forMs)]}),d==="human"&&l.jsx(G,{children:w?m.platform:"On this machine"}),d==="agent"&&(p==null?void 0:p.managedBy)&&l.jsxs(G,{children:["Managed by"," ",p.managedBy.handle?`@${p.managedBy.handle}`:p.managedBy.displayName]})]}),o?l.jsx(os,{actions:o,onAct:()=>{var k;(k=N.current)==null||k.focus(),C(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var k;(k=N.current)==null||k.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function rs(){const e=fe(),t=De();return Pe({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var u;const r=t.getQueryData(H.entries(s)),c=(u=r==null?void 0:r.find(x=>x.id===n))==null?void 0:u.reactions,{reactions:d,on:g}=Ce(c,o,a);return t.setQueryData(H.entries(s),x=>Ae(x,n,d)),{on:g}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,g;const r=t.getQueryData(H.entries(s)),c=((g=(d=r==null?void 0:r.find(u=>u.id===n))==null?void 0:d.reactions)==null?void 0:g.some(u=>u.emoji===o&&u.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},c)=>{c!==void 0&&t.setQueryData(H.entries(n),d=>{var x;const g=(x=d==null?void 0:d.find(v=>v.id===o))==null?void 0:x.reactions,{reactions:u}=Ce(g,a,r,!c.on);return Ae(d,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(H.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function q(e){return e.threadRootEntryId??e.parentEntryId}function is(e){return q(e)??e.id}function cs(e,t){return Math.max(t??0,e)}function zo(e,t,s){let n=e[0],o=0;for(const a of e)a.seq>n.seq&&(n=a),t!==null&&a.seq>t&&(o+=1);return{count:cs(e.length,s),lastAt:n.createdAt,unread:o}}function ls(e){var C,A;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=Fe(),r=Nn(),c=a&&o&&t!==void 0,d=In(c?t:null),g=Rn(d.member),u=Cn(),x=An(),v=Mn(),f=jn(),{data:m}=Le({enabled:c&&r}),p=f.status==="ready"?f.roomId:null,h=m==null?void 0:m.find(N=>N.id===p),w=h?se(h):null,y=(A=(C=d.member)==null?void 0:C.agent)==null?void 0:A.effectiveRuntimeId,I=i.useCallback(()=>{t!==void 0&&(Z.getState().recordOpened("agent",t),u({agentPath:t},y?{runtime:y}:{}))},[t,u,y]),S=i.useCallback(async()=>{if(t===void 0||!v)return;const N=await x(t);if(N===null){Be(`${s} has no session in ${w??"this room"} yet`);return}v(pe({session:N}))},[t,v,x,s,w]);return i.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:g},actions:{onMessage:I,...n?{onViewProfile:n}:{},...r&&w?{session:{label:`Session in ${w}`,onOpen:()=>void S()}}:{}}},[a,t,d.role,g,I,n,r,w,S])}function ds({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=i.useState(!1),c=ls({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=i.useCallback(g=>{g&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&c!==null,...c?{about:c.about,actions:c.actions}:{},children:o})}function us(e){return l.jsx(Lt,{code:e.code,isIncomplete:e.isIncomplete})}const ms=[{language:Ft,component:us}],fs={turn_failed:{Icon:Bn,tone:"text-status-warning"},agent_busy:{Icon:Ln},agent_gone:{Icon:es,tone:"text-status-warning"},agent_left:{Icon:je,tone:"text-status-warning"},room_archived:{Icon:Fn},agent_reseated:{Icon:Pn},handle_changed:{Icon:Xe},files_set_up:{Icon:Dn},runtime_gone:{Icon:Xt,tone:"text-status-warning"},agent_paused:{Icon:$n},agent_declined:{Icon:zt},agent_unavailable:{Icon:Tn},awaiting_approval:{Icon:Gt,tone:"text-status-warning"},halted:{Icon:En},budget_reached:{Icon:_n},cascade_stopped:{Icon:On},addressing_changed:{Icon:Jt},bridge_blocked:{Icon:Wt,tone:"text-status-warning"},bridge_undelivered:{Icon:Sn,tone:"text-status-warning"},bridge_rate_limited:{Icon:Zt},bridge_second_agent_refused:{Icon:je},bridge_disconnected:{Icon:Yt},bridge_agent_swapped:{Icon:$t},bridge_history_note:{Icon:qt}},ps={Icon:Un},le=80;function gs(e){const t=e.trim();if(t.length<=le)return t;const s=t.slice(0,le),n=s.lastIndexOf(" ");return`${(n>le/2?s.slice(0,n):s).trimEnd()}…`}function hs(e,t,s){const n=xs(e,s),o=a=>l.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:a});return n===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function xs(e,t){if(t!==void 0){const n=Hn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=Kn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function ys({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,tone:r}=(e.body.notice&&fs[e.body.notice])??ps;return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":gs(e.body.text)},...xe(t),className:te("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",r??"text-muted-foreground"),children:[l.jsx(a,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),l.jsx("span",{children:n?hs(e.body.text,n,o):e.body.text})]})}const bs=Vt.moment;function vs({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=Je(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:l.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(Rt,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(bs,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:Ct(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function ks(e,t){const s=X.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
43
+ `)?"":" ";s.set(e,`${n}${o}@${t} `)}function ws({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const a=is(t),r=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,d=s==null?void 0:s.displayName,{copy:g}=qn({toastOnSettle:!0});return i.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Qt,run:()=>{zn.getState().openThread(e,a,!0),Ne.getState().requestFocus(Ue(e,a))}},copy:{id:"copy",label:"Copy text",icon:Wn,run:()=>void g(r)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:Vn,run:o}),c!==void 0&&(u.mention={id:"mention",label:d===void 0?"Mention author":`Mention ${d}`,icon:Xe,run:()=>{ks(e,c),Ne.getState().requestFocus(e)}}),At.map(x=>u[x]).filter(x=>x!==void 0)},[e,a,r,c,d,o,g])}function Ns(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function Vo(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function Go(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function Is(e,t,s){const n=t.get(e),o=He({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Yo(e){const t=new Set;for(const a of e)q(a)===null&&t.add(a.id);const s=[],n=new Map,o=new Set;for(const a of e){const r=q(a);if(r===null){s.push(a);continue}if(!t.has(r)){s.push(a),o.add(a.id);continue}const c=n.get(r);c?c.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Rs(e){return`thread-${e}`}function Cs(e){return`thread-row-${e}`}function Jo(e){return`thread-panel-entry-${e}`}function As(e){return`room-entry-${e}`}function Ms(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=q(s)??null,o={rowId:t,domId:As(t)};if(n===null)return o;const a=e.find(c=>c.id===n);return a!==void 0&&(q(a)??null)===null?{rowId:Rs(n),domId:Cs(n)}:o}function Xo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Ms(e,s.id)}const Se=48;function Qo(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:n,excerpt:a.length>Se?`${a.slice(0,Se).trimEnd()}…`:a}}function js(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=Gn({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:Yn(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Ss(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Os={info:new Map,faces:new Map},be=i.createContext(Os);function Zo({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function ea(){const e=he(),t=i.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=i.useMemo(()=>t.map(r=>r.projectPath),[t]),n=Ke(s),o=i.useMemo(()=>js(t,n.data??{}),[t,n.data]),a=i.useMemo(()=>Ss(o),[o]);return i.useMemo(()=>({info:o,faces:a}),[o,a])}function ee(e){const t=i.useContext(be);return e===void 0?void 0:t.info.get(e)}function _s(){return i.useContext(be).faces}function Es({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(c)}}const Q=120,Ts="code block";function $s(e){if(e.length<=Q&&!e.includes("```"))return null;const t=Ds(e);return t.length===0?null:t}function Ds(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Ts} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=Q)return t;const s=Ps(t,Q),n=s.lastIndexOf(" ");return`${(n>Q/2?s.slice(0,n):s).trimEnd()}…`}function Ps(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of n.segment(e)){if(o.length+a.length>t)break;o+=a}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Fs({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=rs(),c=o===!0||!a,d=i.useMemo(()=>t.reactions??[],[t.reactions]),g=i.useMemo(()=>d.filter(v=>Mt(v,s)).map(v=>v.emoji),[d,s]),u=i.useCallback(v=>r.mutate({roomId:e,entryId:t.id,emoji:v,viewerAuthorId:s}),[r,e,t.id,s]),x=i.useMemo(()=>({quick:n,mine:g,onToggle:u,disabled:c}),[n,g,u,c]);return{reactions:d,toggle:u,quickRow:x}}function Ls({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var a,r;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(a=t.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(r=e.current)==null||r.focusFirst())}}function Bs(e,t){var x,v;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Jn.includes(n),a=Dt(e,{enabled:o}),r=qe(),c=De(),d=fe(),g=o?((v=(x=a.data)==null?void 0:x.bindings.find(f=>f.authorId===s))==null?void 0:v.sessionId)??null:null,u=i.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(g===null||s===void 0)&&Xn({queryClient:c,transport:d},e,s).then(m=>{m.kind!=="none"&&r(pe({session:m.kind==="bound"?m.sessionId:g}))}))},[s,r,c,e,g,d]);return i.useMemo(()=>g===null?null:{href:Qn({session:g}),onOpen:u},[u,g])}const ne="mention",ve="author_id",Us={[ne]:[ve]},Hs=[ne];function Ks(e,t){if(!t||t.length===0)return e;const s=qs(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:c}=s[o],d=n.slice(0,a),g=n.slice(a,a+r),u=n.slice(a+r);n=`${d}<${ne} ${ve}="${c}">${g}</${ne}>${u}`}return n}function qs(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(n.push(a),o=a.offset+a.length);return n}const Ws=new Map,rn=i.createContext(Ws);function zs({authors:e,children:t}){return l.jsx(rn.Provider,{value:e,children:t})}function Vs(e){const t=i.useContext(rn);return e===void 0?void 0:t.get(e)}const Oe=new WeakMap;function Gs(e){const t=Oe.get(e);if(t)return t;const s=new Map(e.map(n=>[ge(n.projectPath),n.projectPath]));return Oe.set(e,s),s}function Ys(e){var n;const s=(n=he().data)==null?void 0:n.agents;return i.useMemo(()=>e===void 0||!s?void 0:Gs(s).get(e),[s,e])}function cn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=Fe(),a=Ys(o?t:void 0),r=ee(t);return i.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const c={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(g,u={})=>l.jsx(ds,{identity:c,agentPath:a,onViewProfile:n,openOnClick:u.openOnClick??!1,children:g});return{wrap:d,wrapAvatar:g=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:g}),{openOnClick:!0}),wrapName:g=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:te(g.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,n])}const Js={kind:"human",displayName:""};function Xs(e){return typeof e=="string"?e.replace(/^@/,""):""}function Qs({authorId:e,children:t}){const s=Vs(e),n=ee(s==null?void 0:s.agentRef),{open:o}=We(),a=s?He({record:s,override:n==null?void 0:n.visual}):null,r=s?ze(s,n==null?void 0:n.memberId):void 0,c=i.useMemo(()=>r===void 0?void 0:()=>o(r),[r,o]),d=a==null?void 0:a.color,g=a==null?void 0:a.emoji,u=a==null?void 0:a.imageUrl,x=i.useMemo(()=>s?{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:d,emoji:g,imageUrl:u,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}}:null,[s,d,g,u,n]),v=cn({agentRef:s==null?void 0:s.agentRef,identity:x??Js,onViewProfile:c});if(!s||!x)return l.jsx(Me,{kind:"human",label:Xs(t),resolved:!1});const m=v?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),c())}}:{},p=l.jsx(Me,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...m});return v?v.wrap(p,{openOnClick:!0}):l.jsx(ye,{onViewProfile:c,identity:x,children:p})}function Zs(e){return{mention:t=>{const s=t[ve],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?l.jsx(l.Fragment,{children:t.children}):l.jsx(Qs,{authorId:n,children:t.children})}}}function eo({entry:e,authors:t}){const s=i.useMemo(()=>Ks(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=i.useMemo(()=>{var a;return new Set(((a=e.mentionSpans)==null?void 0:a.map(r=>r.authorId))??[])},[e.mentionSpans]),o=i.useMemo(()=>Zs(n),[n]);return l.jsx(zs,{authors:t,children:l.jsx(Pt,{content:s,className:"msg-prose",allowedTags:Us,literalTagContent:Hs,components:o,renderers:ms})})}function no(e){return function(s){return l.jsx(eo,{entry:s,authors:e})}}const ln="the top folder";function _e(e){return e.slice(e.lastIndexOf("/")+1)}function to(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function so(e){return e===""?ln:`${e}/`}function de(e){return e.target!==void 0?e.target===""?ln:e.target:so(to(e.paths[0]??""))}function oo(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${_e(s)} to ${de(e)}`:`${t} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${_e(s)} from the chat to ${de(e)}`}}const ao=i.lazy(()=>Zn(()=>import("./index-BHXG7bNX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function na({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:c,streamStalled:d,isMember:g=!0,grouping:u,orphanedReply:x,answers:v,feedPosition:f,rowId:m}){const p=Je(t.createdAt),h=i.useMemo(()=>{const L=$s(t.body.text),ie=jt(t.attachments??[]);if(ie===null)return L;const we=L??t.body.text.trim();return we.length>0?`${we} ${ie}`:ie},[t.body.text,t.attachments]),w=i.useId(),y=`${w}-author`,I=`${w}-content`,S=`${w}-summary`,C=i.useRef(null),A=i.useRef(null),N=i.useRef(null),{reactions:M,toggle:j,quickRow:b}=Fs({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:c,streamStalled:d,isMember:g}),O=ee(n==null?void 0:n.agentRef),{open:_}=We(),k=n===void 0?void 0:ze(n,O==null?void 0:O.memberId),D=i.useCallback(()=>{k!==void 0&&_(k)},[_,k]),T=k===void 0?void 0:D,W=ws({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:T}),z=(n==null?void 0:n.handle)??void 0,B=i.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:z,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,z,s.color,s.emoji,s.imageUrl]),$=cn({agentRef:n==null?void 0:n.agentRef,identity:B,onViewProfile:T}),R=Ls({barRef:A,pillsRef:N,hasReactions:M.length>0}),U=i.useCallback(()=>{var L;return(L=C.current)==null?void 0:L.focus()},[]),oe=i.useMemo(()=>no(o),[o]),gn=i.useCallback(L=>l.jsx(i.Suspense,{fallback:null,children:l.jsx(ao,{roomId:e,attachment:L})}),[e]),hn=_s(),ae=t.body.subjectAuthorId??t.authorId,E=o.get(ae),V=ee(E==null?void 0:E.agentRef),xn=Bs(e,t),re=Ns(t);if(re.kind==="notice")return l.jsx(ys,{entry:t,feedPosition:f,rowId:m,sessionLink:xn,subjectName:E==null?void 0:E.displayName});if(re.kind==="moment")return l.jsx(vs,{entry:t,moment:re.moment,subject:ae===t.authorId?s:Is(ae,o,hn),subjectIdentity:{handle:(E==null?void 0:E.handle)??void 0,origin:E==null?void 0:E.origin,agent:V&&{runtime:V.runtime,...V.model&&{model:V.model}}},feedPosition:f,rowId:m});const yn=u.position==="first"||u.position==="only";return l.jsxs(P.Root,{ref:C,id:m,position:u.position,actions:W,reactions:b,"data-testid":"room-entry",tabIndex:0,...Es({showAuthorHeader:yn,headerId:y,displayName:s.displayName,time:p,summary:h,contentId:I,summaryId:S,feedPosition:f}),onKeyDown:R,children:[l.jsx(P.Gutter,{author:s,at:t.createdAt,onViewProfile:$?void 0:T,isSelf:t.authorId===a,renderAvatar:$==null?void 0:$.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:y,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,renderName:$==null?void 0:$.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),v!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${v.excerpt}”`}),t.body.via&&l.jsx(St,{via:t.body.via}),l.jsx(P.Content,{id:I,className:"wrap-anywhere [&_pre]:overflow-x-auto [&_pre]:wrap-normal",children:t.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:oo(t.body.fileChange,(E==null?void 0:E.displayName)??"Somebody")}):oe(t,{rowId:t.id,isStreaming:!1})}),h!==null&&l.jsx("span",{id:S,className:"hidden",children:h}),l.jsx(P.Attachments,{items:t.attachments??[],renderAction:g?gn:void 0}),l.jsx(P.Reactions,{ref:N,reactions:M,viewerAuthorId:a,names:r,frequents:c,onToggle:j,disabled:d===!0||!g,onExit:U}),l.jsx(P.Actions,{actions:W,reactions:b,barRef:A,onExit:U})]})]})}const ta={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function ro(e){const t=fe(),[s,n]=i.useState([]),o=i.useRef(new Map),a=i.useCallback(f=>{const m=f.map(p=>({id:crypto.randomUUID(),file:p,status:"pending",progress:0}));n(p=>[...p,...m])},[]),r=i.useCallback(f=>{o.current.delete(f),n(m=>m.filter(p=>p.id!==f))},[]),c=i.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const m=new Set(f);for(const p of m)o.current.delete(p);n(p=>p.filter(h=>!m.has(h.id)))},[]),d=i.useCallback(f=>{o.current.delete(f),n(m=>m.map(p=>p.id===f&&p.status==="error"?{...p,status:"pending",progress:0,error:void 0}:p))},[]),g=i.useRef(null),u=Pe({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(w=>w.map(y=>f.some(I=>I.id===y.id)?{...y,status:"uploading"}:y));const m=w=>{n(y=>y.map(I=>I.status==="uploading"?{...I,progress:w.percentage}:I))},p=new AbortController;g.current=p;const h=f.map(w=>w.file);return t.uploadRoomAttachments(e,h,m,p.signal)},onSettled:()=>{g.current=null},onSuccess:(f,m)=>{m.forEach((p,h)=>{const w=f[h];w&&o.current.set(p.id,w.id)}),n(p=>p.map(h=>m.findIndex(y=>y.id===h.id)===-1?h:{...h,status:"uploaded",progress:100}))},onError:f=>{n(m=>m.map(p=>p.status==="uploading"?{...p,status:"error",error:f.message}:p))}}),x=i.useCallback(()=>{var f;(f=g.current)==null||f.abort()},[]),v=i.useCallback(async()=>{const f=s.filter(p=>p.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const m=s.filter(p=>p.status==="pending");return m.length>0&&await u.mutateAsync(m),s.map(p=>o.current.get(p.id)).filter(p=>p!==void 0)},[s,u]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:c,cancelUpload:x,uploadAndGetIds:v,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function sa(e){const{room:t,threadRootId:s}=e,n=Ot(),o=_t(),a=ro((t==null?void 0:t.id)??""),r=t!==void 0&&Ve(t.members,t.viewerAuthorId),c=i.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});i.useEffect(()=>{c.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=i.useCallback(y=>c.current.attachments.addFiles(y),[]),g=i.useCallback(y=>c.current.attachments.removeFile(y),[]),u=i.useCallback(y=>c.current.attachments.retryFile(y),[]),x=i.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:v,hasFailedUpload:f,isUploading:m}=a,p=i.useMemo(()=>({staged:v,add:d,remove:g,retry:u,cancel:x,hasFailed:f,isUploading:m,holdsSendWhileUploading:!1}),[v,f,m,d,g,u,x]),h=i.useCallback(async y=>{const{attachments:I,post:S,reply:C,room:A,threadRootId:N}=c.current;if(A===void 0)throw new Error("That room isn’t loaded yet.");if(A.archived)throw new Error("This room is archived.");Z.getState().recordOpened("room",A.id);const M=et(),j=I.pendingFiles.map(k=>k.file.name),b=I.pendingFiles.map(k=>k.id),O=await I.uploadAndGetIds();I.clearFiles(b);const _=y.parentEntryId??N;if(_!==void 0){C.mutate({roomId:A.id,rootEntryId:_,text:y.text,clientId:M,attachmentIds:O,attachmentNames:j});return}S.mutate({roomId:A.id,text:y.text,clientId:M,attachmentIds:O,attachmentNames:j})},[]);return{target:i.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&r,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Ge},send:h,attachments:p}),[t,s,r,p,h]),attachments:a}}const dn=8;function un(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function io(e){if(st(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:un(e.topic)}function Ee(e){return{kind:"session",id:e.id,name:tt(e.title),summary:un(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function co(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:io(e),lastActivityAt:e.lastActivityAt,room:e}}function Y(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function lo(e){return e.kind==="session"?Ie("session",e.id):Ie("room",e.id)}function Te(e,t){const s=[Y(t[lo(e)]),...e.kind==="session"?[Y(e.session.lastTouchedByYouAt),Y(e.session.userLastMessageAt)]:[]].filter(n=>n!==null);return s.length>0?Math.max(...s):Y(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function uo(e){return(t,s)=>Te(s,e)-Te(t,e)||s.id.localeCompare(t.id)}function mo(e){const t=new Set;return e.filter(s=>{const n=`${s.kind}:${s.id}`;return t.has(n)?!1:(t.add(n),!0)})}function fo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function po({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=dn}){const{yours:a,spinOffs:r,automated:c}=nt(e),d=uo(n),g=[...a.map(Ee),...t.filter(u=>fo(u,s)).map(co)].sort(d);return{items:mo(g).slice(0,o),automated:[...r,...c].map(Ee).sort(d).slice(0,o)}}const go=3,ho=rt;function xo({limit:e=dn,mutedRoomIds:t,enabled:s=!0}={}){var g,u;const n=ot(Math.max(e*go,ho),{enabled:s}),o=Le({enabled:s}),a=at(),r=(g=n.data)==null?void 0:g.sessions,c=o.data;return{...i.useMemo(()=>po({sessions:r??[],rooms:c??[],mutedRoomIds:t,interactions:a,limit:e}),[r,c,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((u=n.data)==null?void 0:u.warnings)??[]}}const yo=6,mn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const bo='[role="combobox"]';function K(e){return e instanceof Element&&e.matches(bo)}function vo({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=qe(),o=it(),[a,r]=i.useState(!1),[c,d]=i.useState({stamp:"",index:0}),[g,u]=i.useState(!1),[x,v]=i.useState(!1);e.length>0&&!x&&v(!0);const f=i.useRef(!1);i.useEffect(()=>{f.current=!0},[]);const{data:m}=he({enabled:s}),p=i.useMemo(()=>((m==null?void 0:m.agents)??[]).map(R=>R.projectPath),[m]),{data:h}=Ke(p,{enabled:s}),w=i.useMemo(()=>h??{},[h]),y=i.useMemo(()=>ct(p,w),[p,w]),I=i.useMemo(()=>new Map(p.map(R=>[ge(R),R])),[p]),S=i.useCallback(R=>lt({room:R,agentsByPath:w,pathByAgentRef:I}),[w,I]),C=i.useMemo(()=>dt(o.muted),[o.muted]),{items:A}=xo({mutedRoomIds:C,enabled:s}),N=i.useMemo(()=>A.slice(0,yo),[A]),M=s&&a&&!g&&!x&&!t&&e.length===0&&N.length>0,j=`${M}:${N.length}`,b=c.stamp===j?c.index:0,O=i.useCallback(R=>{f.current&&K(R.target)&&(u(!1),v(!1),r(!0))},[]),_=i.useCallback(R=>{K(R.target)&&r(!0)},[]),k=i.useCallback(R=>{K(R.target)&&r(!1)},[]),D=i.useCallback(R=>{N.length!==0&&d(U=>{const oe=U.stamp===j?U.index:0;return{stamp:j,index:(oe+R+N.length)%N.length}})},[N.length,j]),T=i.useCallback(()=>D(1),[D]),W=i.useCallback(()=>D(-1),[D]),z=i.useCallback(()=>{u(!0)},[]),B=i.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Z.getState().recordOpened("agent",R.session.cwd),n(pe({dir:R.session.cwd??void 0,session:R.session.id}));return}Z.getState().recordOpened("room",R.room.id),n({...ut.channels(),search:{id:R.room.id}})},[n]),$=i.useCallback(()=>{const R=N[b];!M||!R||B(R)},[M,N,b,B]);return{isOpen:M,hasRows:N.length>0,rows:N,agents:w,displayNames:y,visualOf:S,selectedIndex:b,activeDescendantId:M&&N[b]!==void 0?ke(b):void 0,listboxId:M?mn:void 0,handleFocus:O,handleBlur:k,handlePointerDown:_,moveDown:T,moveUp:W,selectHighlighted:$,selectRow:B,dismiss:z}}function fn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:c,onSelect:d}){const g=i.useMemo(()=>Number.isNaN(Date.parse(o))?null:yt(o),[o,c]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),g!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:g})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function ko({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const c=ft(t,e.session.cwd??s);return l.jsx(fn,{mark:l.jsx(pt,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:a,onSelect:r})}function wo({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(fn,{mark:l.jsx(ht,{room:e.room,participants:e.room.participants,visuals:xt(t)}),label:l.jsx(gt,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:a})}function No({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=mt(6e4);return i.useEffect(()=>{var c,d;(d=(c=document.getElementById(ke(t)))==null?void 0:c.scrollIntoView)==null||d.call(c,{block:"nearest"})},[t]),l.jsx(Ye.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:l.jsx("div",{id:mn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,d)=>{var g;return c.kind==="session"?l.jsx(ko,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((g=c.session.cwd)==null?void 0:g.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`session-${c.id}`):l.jsx(wo,{item:c,visual:o(c.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`room-${c.id}`)})})})}const $e={people:"People",agents:"Agents"},Io=["people","agents"];function Ro(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Co(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Ao(a,n)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Ao(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let n=null;for(const a of s){const r=a===t?0:a.startsWith(t)?1:a.includes(t)?2:null;r!==null&&(n===null||r<n)&&(n=r)}return n}function J(e,t,s){var a;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let r=0;r<n;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+n)%n}return 0}function Mo(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,c=a.startsWith(" ")?"":" ";return{value:o+r+c+a,cursorPos:o.length+r.length+1}}const jo=/(^|\s)@([A-Za-z0-9_.-]*)$/,pn="mention-palette-listbox";function me(e){return`mention-item-${e}`}function So({members:e,viewerAuthorId:t,text:s,sectionOrder:n=Io}){var _;const[o,a]=i.useState(!1),[r,c]=i.useState(""),[d,g]=i.useState(-1),u=bt(s),x=i.useRef(!1),v=i.useMemo(()=>Ro(e,t),[e,t]),f=i.useMemo(()=>o?Co(v,r,n):[],[v,r,o,n]),[m,p]=i.useState(null),h=m!==null&&m.query===r&&m.open===o?m.index:J(f,0,1),w=f[h],y=f.length===0||w!==void 0&&!w.disabled?h:J(f,0,1),I=i.useCallback((k,D)=>{const T=k.slice(0,D).match(jo);if(!T){a(!1);return}a(!0),c(T[2]),g((T.index??0)+T[1].length)},[]),S=i.useCallback(k=>{u.write(k),x.current=!1},[u]),C=i.useCallback(k=>{x.current||I(u.read(),k)},[I,u]),A=i.useCallback(()=>{p({query:r,open:o,index:J(f,y+1,1)})},[f,y,r,o]),N=i.useCallback(()=>{p({query:r,open:o,index:J(f,y-1,-1)})},[f,y,r,o]),M=i.useCallback(k=>k.disabled||k.handle===void 0?null:(x.current=!0,a(!1),Mo(u.read(),d,r,k.handle)),[d,r,u]),j=i.useCallback(()=>{const k=f[y];return k?M(k):(a(!1),null)},[f,y,M]),b=i.useCallback(()=>{x.current=!0,a(!1)},[]),O=f.some(k=>!k.disabled);return{isOpen:o,hasSelectableRows:O,rows:f,selectedIndex:y,activeDescendantId:o&&((_=f[y])==null?void 0:_.disabled)===!1?me(y):void 0,listboxId:o?pn:void 0,noteTextChange:S,handleCursorChange:C,moveDown:A,moveUp:N,selectHighlighted:j,selectRow:M,dismiss:b}}function Oo({rows:e,selectedIndex:t,onSelect:s}){const n=i.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const c=o[o.length-1];c&&c.section===a.section?c.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return i.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Ye.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:pn,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":$e[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:$e[o]}),a.map(({row:c,index:d})=>{const g=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":g,"aria-disabled":c.disabled,"data-selected":g,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function oa({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:Ue(e.id,t),c=vt(r),{target:d}=Et(),g=kt(),u=wt(r),x=i.useRef(null),v=Ve(e.members,e.viewerAuthorId),f=i.useRef(!1),m=So({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),p=n===!0,h=vo({value:c,yieldToPalette:m.isOpen,enabled:p}),w=i.useRef(u);i.useEffect(()=>{var b;u!==w.current&&(w.current=u,(b=x.current)==null||b.focus())},[u]),i.useEffect(()=>{var b;s===!0&&((b=x.current)==null||b.focusUnlessTouch())},[]);const y=i.useCallback(b=>X.getState().set(r,b),[r]),[I,S]=i.useState(null);i.useLayoutEffect(()=>{var b;I!==null&&((b=x.current)==null||b.focusAt(I.pos))},[I]);const C=i.useCallback(b=>{b&&(y(b.value),S({pos:b.cursorPos}))},[y]),A=i.useCallback(b=>C(m.selectRow(b)),[m,C]),N=i.useCallback(()=>C(m.selectHighlighted()),[m,C]),M=()=>{if(d===null||!d.canSend||f.current)return;m.dismiss();const b=X.getState().take(r).trim();if(b==="")return;const O=a.pendingFiles.length>0;O&&(f.current=!0),d.send({text:b}).catch(()=>{const _=X.getState(),k=_.drafts[r]??"";_.set(r,k===""?b:`${b}
44
+ ${k}`)}).finally(()=>{O&&(f.current=!1)})};if(!v)return l.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[l.jsx("p",{className:"text-muted-foreground text-sm",children:Ge}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:g.isPending,onClick:()=>g.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>Be.success(`You joined ${se(e)}`)}),children:Nt})]});const j=l.jsx(Tt.Composer,{inputRef:x,value:c,onChange:b=>{y(b),m.noteTextChange(b)},onSubmit:M,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:m.isOpen&&m.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Re,{children:m.isOpen&&l.jsx(Oo,{rows:m.rows,selectedIndex:m.selectedIndex,onSelect:A})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Re,{children:h.isOpen&&l.jsx(No,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:m.handleCursorChange,isStreaming:!1,isPaletteOpen:m.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:m.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:m.moveUp,onArrowDown:h.isOpen?h.moveDown:m.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:N,onEscape:h.isOpen?h.dismiss:m.dismiss,tabPicks:!h.isOpen,onClear:()=>{y(""),m.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:m.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:m.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!p&&o===void 0?j:l.jsx("section",{className:"flex flex-col","data-testid":It.homeComposer,onFocus:b=>{h.handleFocus(b),K(b.target)&&(o==null||o(!0))},onBlur:b=>{h.handleBlur(b),K(b.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:j})}export{Zo as A,oa as C,ye as I,ta as R,Vo as a,na as b,Is as c,Go as d,ea as e,Qo as f,Yo as g,Rs as h,cs as i,zo as j,Cs as k,As as l,Ms as m,Jo as n,Xo as o,K as p,is as r,q as t,sa as u};
@@ -1,6 +1,6 @@
1
- import{O as m,a1 as x,aY as k,r as v,j as t,B as d,G as p,a7 as y}from"./index-B6Scr7KJ.js";import{u as O}from"./use-update-config-BFFW_6Mc.js";import{I as R}from"./inline-code-BKPMIXZR.js";/**
1
+ import{O as m,a1 as x,aW as k,r as v,j as t,B as d,G as p,dD as y}from"./index-fge85Gub.js";import{u as D}from"./use-update-config-BH0agtZh.js";import{I as O}from"./inline-code-7dwi7wWG.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const g={name:"route",size:24,node:[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]};g.node;const S=m(g);function C(){const e=typeof window<"u"?window.electronAPI:void 0;if(typeof(e==null?void 0:e.restartServer)!="function"||typeof e.resetAllData!="function")return null;const{restartServer:r,resetAllData:c}=e;return{restartServer:()=>r(),resetAllData:()=>c()}}function D(e){if(!e.ok)throw new Error(e.message)}async function w(e){const r=C();r?D(await r.restartServer()):await e.restartServer()}function b(e){return e.isLoading||e.isError||e.enabled?null:e.initError?"failed":e.lockedByEnv?"env":e.enabledInConfig===!0?"restart":"off"}function I({relay:e,variant:r}){const c=x(),a=O(),h=k(i=>i.setRestartOverlayOpen),[n,u]=v.useState(!1),l=b(e);if(!l)return null;const f=async()=>{u(!0);try{await w(c),h(!0)}catch(i){y.error("Couldn’t restart DorkOS.",{description:i instanceof Error?i.message:"It may not have restarted. Try again."})}finally{u(!1)}};let s,o=null;switch(l){case"env":s=t.jsxs(t.Fragment,{children:["Chat apps are off: ",t.jsx(R,{children:"DORKOS_RELAY_ENABLED"})," overrides the setting. Remove it, then restart DorkOS."]});break;case"failed":s="Chat apps didn’t start. Restarting DorkOS tries again.",o=t.jsx(d,{size:"sm",variant:"secondary",disabled:n,onClick:()=>void f(),children:n?"Restarting…":"Restart DorkOS"});break;case"restart":s="Chat apps turn on when DorkOS restarts. Restarting stops anything running right now.",o=t.jsx(d,{size:"sm",disabled:n,onClick:()=>void f(),children:n?"Restarting…":"Restart DorkOS"});break;case"off":s="Chat apps are off. Turn them on to reach agents from Telegram, Slack or webhooks.",o=t.jsx(d,{size:"sm",disabled:a.isPending,onClick:()=>a.mutate({relay:{enabled:!0}}),children:a.isPending?"Turning on…":"Turn on chat apps"});break}return t.jsxs("div",{"data-testid":"chat-apps-off","data-reason":l,className:p(r==="line"?"flex flex-wrap items-center gap-x-3 gap-y-2":"flex flex-col items-center gap-3 p-8 text-center"),children:[r==="block"&&t.jsx(S,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),t.jsx("p",{className:p("text-muted-foreground",r==="line"?"text-xs":"text-sm"),role:"status",children:s}),o,a.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t save. Check that DorkOS is running, then try again."})]})}export{I as C,S as R,C as g,w as r,D as u};
6
+ */const g={name:"route",size:24,node:[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]};g.node;const R=m(g);function S(){const e=typeof window<"u"?window.electronAPI:void 0;if(typeof(e==null?void 0:e.restartServer)!="function"||typeof e.resetAllData!="function")return null;const{restartServer:r,resetAllData:c}=e;return{restartServer:()=>r(),resetAllData:()=>c()}}function C(e){if(!e.ok)throw new Error(e.message)}async function w(e){const r=S();r?C(await r.restartServer()):await e.restartServer()}function b(e){return e.isLoading||e.isError||e.enabled?null:e.initError?"failed":e.lockedByEnv?"env":e.enabledInConfig===!0?"restart":"off"}function I({relay:e,variant:r}){const c=x(),a=D(),h=k(i=>i.setRestartOverlayOpen),[n,u]=v.useState(!1),l=b(e);if(!l)return null;const f=async()=>{u(!0);try{await w(c),h(!0)}catch(i){y.error("Couldn’t restart DorkOS.",{description:i instanceof Error?i.message:"It may not have restarted. Try again."})}finally{u(!1)}};let s,o=null;switch(l){case"env":s=t.jsxs(t.Fragment,{children:["Chat apps are off: ",t.jsx(O,{children:"DORKOS_RELAY_ENABLED"})," overrides the setting. Remove it, then restart DorkOS."]});break;case"failed":s="Chat apps didn’t start. Restarting DorkOS tries again.",o=t.jsx(d,{size:"sm",variant:"secondary",disabled:n,onClick:()=>void f(),children:n?"Restarting…":"Restart DorkOS"});break;case"restart":s="Chat apps turn on when DorkOS restarts. Restarting stops anything running right now.",o=t.jsx(d,{size:"sm",disabled:n,onClick:()=>void f(),children:n?"Restarting…":"Restart DorkOS"});break;case"off":s="Chat apps are off. Turn them on to reach agents from Telegram, Slack or webhooks.",o=t.jsx(d,{size:"sm",disabled:a.isPending,onClick:()=>a.mutate({relay:{enabled:!0}}),children:a.isPending?"Turning on…":"Turn on chat apps"});break}return t.jsxs("div",{"data-testid":"chat-apps-off","data-reason":l,className:p(r==="line"?"flex flex-wrap items-center gap-x-3 gap-y-2":"flex flex-col items-center gap-3 p-8 text-center"),children:[r==="block"&&t.jsx(R,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),t.jsx("p",{className:p("text-muted-foreground",r==="line"?"text-xs":"text-sm"),role:"status",children:s}),o,a.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t save. Check that DorkOS is running, then try again."})]})}export{I as C,R,S as g,w as r,C as u};