dorkos 0.128.0 → 0.129.0

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 (359) hide show
  1. package/dist/bin/cli.js +84 -16
  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-CmQERFxo.js → AboutPage-CML_SdU1.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-Dw231W2w.js → ActivityErrorState-TuQRJopr.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-DVfeyA9u.js → ActivityPage-CmSxeVSK.js} +1 -1
  7. package/dist/client/assets/ActivityRow-DJhDehIR.js +1 -0
  8. package/dist/client/assets/{AdapterIcon-NqCDzgCI.js → AdapterIcon-CeRDpZGz.js} +1 -1
  9. package/dist/client/assets/AdapterSetupWizard-B6KkTuJo.js +2 -0
  10. package/dist/client/assets/{AgentOptionRow-BRJfZo2y.js → AgentOptionRow-388OJkPc.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-B7upjYRk.js → AgentPicker-C51wqToQ.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-DXJnLk6q.js → AgentRequestCard-Bz31ewIs.js} +4 -4
  13. package/dist/client/assets/AppearancePage-DSVeowGb.js +1 -0
  14. package/dist/client/assets/{ApplyToOverridesDialog-C_QQhNIf.js → ApplyToOverridesDialog-DRtcLrVY.js} +1 -1
  15. package/dist/client/assets/AttentionSignalRow-CqKZyoxB.js +1 -0
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-G7vrCqeA.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-DA1jhqFy.js} +3 -3
  17. package/dist/client/assets/BindingDialog-D25PAed0.js +1 -0
  18. package/dist/client/assets/{BlintzCanvas-DruVZcDU.js → BlintzCanvas-BgIQdpTx.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-CtLpZnTs.js → CanvasCsvContent-ZWHWmb88.js} +4 -4
  20. package/dist/client/assets/CanvasFileContent-DR5pUgca.js +2 -0
  21. package/dist/client/assets/CanvasModel3dContent-OP1ZOMui.js +2 -0
  22. package/dist/client/assets/ChannelComposer-BJ0nNzQb.js +45 -0
  23. package/dist/client/assets/{ChatAppsOff-CCZUzDIH.js → ChatAppsOff-ByitL4Xt.js} +2 -2
  24. package/dist/client/assets/{CodeMirrorDiff-BCpYdhgZ.js → CodeMirrorDiff-JsV_vWBa.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-BeCubxHV.js → CodeMirrorEditor-BfCJG9hQ.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-BZtfTnwg.js → CommitmentList-yFV3_m00.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-DmurDgxV.js → CommitmentsPage-DeERVg-2.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-Bik6GLKp.js → ComputerResourceView-CYMMSE8Y.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-CksBDqdu.js → ComputerViewer-H7kJSIj7.js} +1 -1
  30. package/dist/client/assets/ConnectionAccessLists-SRkf7-Y6.js +1 -0
  31. package/dist/client/assets/{ConnectionsPage-Cgg36gDY.js → ConnectionsPage-D6e3hd4L.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-CNhpF6Z1.js → ConventionPage-CpvRMcSG.js} +2 -2
  33. package/dist/client/assets/{ExtensionPageRoute-C2zue_Pw.js → ExtensionPageRoute-CiFv6we8.js} +2 -2
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-3v1TfY1P.js → FloatingTanStackRouterDevtools-CqogiFob-D-8CeYC7.js} +1 -1
  35. package/dist/client/assets/{ForwardConsentHost-Mbo0D-zk.js → ForwardConsentHost-ml3b_fsX.js} +1 -1
  36. package/dist/client/assets/HandlePage-Bq5qdCfY.js +1 -0
  37. package/dist/client/assets/HeartbeatPage-C0zSvWH4.js +1 -0
  38. package/dist/client/assets/{KeyEntry-C43vkwpA.js → KeyEntry-Dq6eKAbX.js} +1 -1
  39. package/dist/client/assets/{LexicalField-iAHcvRmI.js → LexicalField-CYOqOLpV.js} +1 -1
  40. package/dist/client/assets/{ManagesPage-BUIJvLmv.js → ManagesPage-DZTMD3Al.js} +1 -1
  41. package/dist/client/assets/Marketplace-buSfuVrY.js +36 -0
  42. package/dist/client/assets/{MarketplaceSourcesView-BZODwhxu.js → MarketplaceSourcesView-BxwvBWgh.js} +1 -1
  43. package/dist/client/assets/{McpAppFrame-D15nxVaI.js → McpAppFrame-CWiRFp8o.js} +2 -2
  44. package/dist/client/assets/{McpSigninBody-DmBxqgxN.js → McpSigninBody-BpYSAV1h.js} +1 -1
  45. package/dist/client/assets/{Model3dViewer-RGXeJd6a.js → Model3dViewer-B2KTvx6d.js} +1 -1
  46. package/dist/client/assets/NamePage-_yT2RQvT.js +1 -0
  47. package/dist/client/assets/{NewDirectMessageMenu-DBAdvv5p.js → NewDirectMessageMenu-CMp4ppiH.js} +1 -1
  48. package/dist/client/assets/{NotificationsPage-NRfyiinS.js → NotificationsPage-CWXIghVM.js} +1 -1
  49. package/dist/client/assets/{OpenMeshSwitch-CgQ6uefo.js → OpenMeshSwitch-C9hiAEHP.js} +2 -2
  50. package/dist/client/assets/OperatorIdentityForm-CjmMoP6n.js +1 -0
  51. package/dist/client/assets/{PermissionHistory-DPEPq8D9.js → PermissionHistory-D_Imuq02.js} +1 -1
  52. package/dist/client/assets/{PermissionsPage--k-xutbJ.js → PermissionsPage-QMLV8PfB.js} +1 -1
  53. package/dist/client/assets/{PersonalityPopover-DMMptmPS.js → PersonalityPopover-BL9DLK0Q.js} +1 -1
  54. package/dist/client/assets/PhotoPage-Djh4IZBF.js +1 -0
  55. package/dist/client/assets/PreviewRefusedNotice-Dt2hV0aJ.js +1 -0
  56. package/dist/client/assets/{ProfileFields-DbPJ7fvN.js → ProfileFields-DD6X85w2.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-CzwhrIlw.js → ProfilePanelContainer-DuFEpNJ3.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-CZEXvlJm.js → ProfileRolePicker-CT9eJ1J0.js} +1 -1
  59. package/dist/client/assets/PromptSuggestionChips-C8V611-5.js +1 -0
  60. package/dist/client/assets/{ReportsToPopover-YOwGLJy5.js → ReportsToPopover-Bs55bP7b.js} +1 -1
  61. package/dist/client/assets/RoomSurface-DXZ36tmU.js +1 -0
  62. package/dist/client/assets/{RoomsPage-CoXjZMWL.js → RoomsPage-CDiSwt-I.js} +1 -1
  63. package/dist/client/assets/RunsOnPopover-CFBDa9DO.js +1 -0
  64. package/dist/client/assets/RuntimeConnectFlow-DsawxJN7.js +1 -0
  65. package/dist/client/assets/RuntimeSetupDialog-bdf844gx.js +1 -0
  66. package/dist/client/assets/{SeenDevices-Bh2yh-PW.js → SeenDevices-Cix5nnGQ.js} +2 -2
  67. package/dist/client/assets/{SessionsPage-CFvkbT9X.js → SessionsPage-CCu8rM-J.js} +1 -1
  68. package/dist/client/assets/SettingsDialog-D7sVluoe.js +12 -0
  69. package/dist/client/assets/SkillsPage-SSq7ofgp.js +1 -0
  70. package/dist/client/assets/TaskDialogWrapper-CBIuIbmj.js +1 -0
  71. package/dist/client/assets/TasksEmptyState-C0K_NOA3.js +3 -0
  72. package/dist/client/assets/{TasksPage-D0Zi6Mve.js → TasksPage-BpSn7GmR.js} +1 -1
  73. package/dist/client/assets/{TeamComputerEntry-CY9eLVad.js → TeamComputerEntry-BAi9omUC.js} +1 -1
  74. package/dist/client/assets/{ToolsPage-0_vx5P-F.js → ToolsPage-nkGWy6MR.js} +2 -2
  75. package/dist/client/assets/{TopologyGraph-DUZLZZrB.js → TopologyGraph-D6SSv0kC.js} +14 -14
  76. package/dist/client/assets/TourHost-CrZciWIf.js +1 -0
  77. package/dist/client/assets/{UnlinkDialog-ptZy3IN4.js → UnlinkDialog-B9zw8r6F.js} +1 -1
  78. package/dist/client/assets/{UnreadDivider-Ckey1IWn.js → UnreadDivider-BnJ06LmP.js} +1 -1
  79. package/dist/client/assets/WidgetErrorCard-CQKYI7oK.js +108 -0
  80. package/dist/client/assets/{WithheldExtensionsNotice-7Vu1Jctn.js → WithheldExtensionsNotice-VMM5NjL5.js} +1 -1
  81. package/dist/client/assets/WorkView-D5d8DDxS.js +51 -0
  82. package/dist/client/assets/_shell-CTKp94uQ.js +80 -0
  83. package/dist/client/assets/{_shell._home-BRIXhYLg.js → _shell._home-CcfELPIk.js} +1 -1
  84. package/dist/client/assets/_shell._home.activity-CGKsuLq8.js +1 -0
  85. package/dist/client/assets/_shell._home.index-DrJRgJCb.js +3 -0
  86. package/dist/client/assets/_shell._home.tasks-B_lv_-fX.js +1 -0
  87. package/dist/client/assets/_shell._home.workspaces-CjBJymCW.js +1 -0
  88. package/dist/client/assets/{_shell.channels-Bx6q9xVH.js → _shell.channels-CzQFR6pU.js} +4 -4
  89. package/dist/client/assets/_shell.connections-B5hafeep.js +1 -0
  90. package/dist/client/assets/{_shell.feedback-requests-DFznTGbN.js → _shell.feedback-requests-DtD2bH-4.js} +2 -2
  91. package/dist/client/assets/_shell.marketplace-DUpaCb0r.js +1 -0
  92. package/dist/client/assets/_shell.marketplace_.sources-C3pA7zZW.js +1 -0
  93. package/dist/client/assets/_shell.session-DH_9f3AK.js +1 -0
  94. package/dist/client/assets/{_shell.team-DmA09abY.js → _shell.team-BrGo-IxK.js} +6 -6
  95. package/dist/client/assets/_shell.threads-Ceq_tmNk.js +1 -0
  96. package/dist/client/assets/_shell.x._extensionId-DaXLhYNr.js +1 -0
  97. package/dist/client/assets/_shell.x._extensionId_._-DaXLhYNr.js +1 -0
  98. package/dist/client/assets/{abnfDiagram-WEYOIA3C-DxgtVd9I.js → abnfDiagram-WEYOIA3C-BN5bqwbu.js} +1 -1
  99. package/dist/client/assets/{access-copy-Dqct36mi.js → access-copy-BAhTOOsG.js} +1 -1
  100. package/dist/client/assets/{arc-C-67Ef0p.js → arc-BfTE_VoF.js} +1 -1
  101. package/dist/client/assets/{architectureDiagram-ZHVYKT53-B7TjdT-_.js → architectureDiagram-ZHVYKT53-Dc6keeDz.js} +1 -1
  102. package/dist/client/assets/{banner-C9qTs6-C.js → banner-DOgGDCJ5.js} +2 -2
  103. package/dist/client/assets/{blockDiagram-RJAE7QA3-DNqxJ3Ww.js → blockDiagram-RJAE7QA3-B4c6U-ob.js} +1 -1
  104. package/dist/client/assets/{c4Diagram-XDPPPE54-D3jNLV0j.js → c4Diagram-XDPPPE54-CCtD8QC8.js} +1 -1
  105. package/dist/client/assets/channel-CF9_Q7CV.js +1 -0
  106. package/dist/client/assets/{chunk-2E7WHVMD-C6OKx0ty.js → chunk-2E7WHVMD-DcDNqIJG.js} +1 -1
  107. package/dist/client/assets/{chunk-2Q5K7J3B-Dr_6hHrZ.js → chunk-2Q5K7J3B-DOVVK0B8.js} +1 -1
  108. package/dist/client/assets/{chunk-4EMNKR2T-CSrZVDEt.js → chunk-4EMNKR2T-Cg-Do982.js} +1 -1
  109. package/dist/client/assets/{chunk-55XCU76K-CIazeRXO.js → chunk-55XCU76K-CDmULSeY.js} +1 -1
  110. package/dist/client/assets/{chunk-5VM5RSS4-C8IJ3zTR.js → chunk-5VM5RSS4-Bi0yIWW1.js} +1 -1
  111. package/dist/client/assets/{chunk-JWPE2WC7-D9DGXb79.js → chunk-JWPE2WC7-ZHaJh6CV.js} +1 -1
  112. package/dist/client/assets/{chunk-VQ5W62QI-B0LNYdif.js → chunk-VQ5W62QI-DZi6GyW_.js} +1 -1
  113. package/dist/client/assets/{chunk-XXDRQBXY-C7IAIbvZ.js → chunk-XXDRQBXY-D18oZOrd.js} +1 -1
  114. package/dist/client/assets/{chunk-ZCHMQSOR-C79hvjlu.js → chunk-ZCHMQSOR-BkZ0l0fE.js} +2 -2
  115. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-0Di1C2ZB.js → classDiagram-v2-4MYWR3UA-BfmK1buF.js} +1 -1
  116. package/dist/client/assets/{command-BVQb6I3_.js → command-CZqA020F.js} +1 -1
  117. package/dist/client/assets/copy-button-ByA00JGh.js +1 -0
  118. package/dist/client/assets/{cose-bilkent-JH36ORCC-rZumaV4b.js → cose-bilkent-JH36ORCC-B1NTVSbk.js} +1 -1
  119. package/dist/client/assets/{cpu-DeRuDMl4.js → cpu-DNvpMmNN.js} +1 -1
  120. package/dist/client/assets/{cynefin-EF2NZ3EQ-CI9l9xhM.js → cynefin-EF2NZ3EQ-CB_HMIZ8.js} +1 -1
  121. package/dist/client/assets/{cynefinDiagram-WF24UDRP-C8CdorJJ.js → cynefinDiagram-WF24UDRP-MmIWYdc2.js} +1 -1
  122. package/dist/client/assets/{dagre-NK4GIZVX-AHpsTq1O.js → dagre-NK4GIZVX-BQay0k4e.js} +1 -1
  123. package/dist/client/assets/detail-row-290qyusq.js +1 -0
  124. package/dist/client/assets/{diagram-CBK3MWTC-BpPLL30n.js → diagram-CBK3MWTC-C1lRH4cb.js} +1 -1
  125. package/dist/client/assets/{diagram-I5XIIV2D-D6loMn3G.js → diagram-I5XIIV2D-CnANa27A.js} +1 -1
  126. package/dist/client/assets/{diagram-ODIL2UCW-BaGNd5eN.js → diagram-ODIL2UCW-Cwt7hxes.js} +1 -1
  127. package/dist/client/assets/{diagram-PFBEJUXE-BnDdKu_g.js → diagram-PFBEJUXE-DZtAER77.js} +1 -1
  128. package/dist/client/assets/{diagram-RJA3I4VV-UXagB0_c.js → diagram-RJA3I4VV-CbVXbiGs.js} +1 -1
  129. package/dist/client/assets/{diagram-TYUNFSNR-C-whBP-S.js → diagram-TYUNFSNR-D-AcGdsL.js} +1 -1
  130. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-BbG481iS.js → ebnfDiagram-V4P3TTPT-DLkrFSAy.js} +1 -1
  131. package/dist/client/assets/{elk-QONTBCTQ-FtssIxOc.js → elk-QONTBCTQ-DQM6Glxa.js} +1 -1
  132. package/dist/client/assets/{empty-state-CACt-76q.js → empty-state-BnuM8oop.js} +1 -1
  133. package/dist/client/assets/{erDiagram-KYQIGQAA-PpFgUf4C.js → erDiagram-KYQIGQAA-C1qgB1Mn.js} +1 -1
  134. package/dist/client/assets/{execution-config-CGL73sRn.js → execution-config-BjLHHc9x.js} +1 -1
  135. package/dist/client/assets/{file-D80JE_L0.js → file-D7_QdH_S.js} +1 -1
  136. package/dist/client/assets/{file-exclamation-point-CcJ_e4_m.js → file-exclamation-point-Cdt8YqyQ.js} +1 -1
  137. package/dist/client/assets/{file-text-Ds9edaTZ.js → file-text-CB9l6Ur-.js} +1 -1
  138. package/dist/client/assets/{find-latest-widget-fence-BtqFMP_f.js → find-latest-widget-fence-SQB9WgjN.js} +5 -5
  139. package/dist/client/assets/{flowDiagram-IUGLLWBU-BIva66g9.js → flowDiagram-IUGLLWBU-DH-ePeFu.js} +1 -1
  140. package/dist/client/assets/form--HjBAzX8.js +1 -0
  141. package/dist/client/assets/{format-cron-BpGrgPLu.js → format-cron-svkfKW5b.js} +1 -1
  142. package/dist/client/assets/format-tokens-DymkROvy.js +1 -0
  143. package/dist/client/assets/{ganttDiagram-R7GPNTJY-CZqips_4.js → ganttDiagram-R7GPNTJY-fjb_iAW1.js} +1 -1
  144. package/dist/client/assets/{git-branch-B8JNwQ6q.js → git-branch-CPOwiT8a.js} +1 -1
  145. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DoIc3lda.js → gitGraphDiagram-PDYL7XHY-CcCqH5T3.js} +1 -1
  146. package/dist/client/assets/{graph-yizM0vwL.js → graph-DS3J2jnN.js} +1 -1
  147. package/dist/client/assets/{heart-BavUIV45.js → heart-C6uRnXx3.js} +1 -1
  148. package/dist/client/assets/{highlighted-body-KPVGNVTW-CGr3AgaU.js → highlighted-body-KPVGNVTW-CNygKq0i.js} +1 -1
  149. package/dist/client/assets/image-lightbox-BQV3i0WJ.js +1 -0
  150. package/dist/client/assets/{image-off-C1uTDs9-.js → image-off-B88WBkcV.js} +1 -1
  151. package/dist/client/assets/{index-SOKlO1zZ.js → index-3CJSEcZE.js} +1 -1
  152. package/dist/client/assets/index-3JL8A9YZ.css +1 -0
  153. package/dist/client/assets/{index-BJEt9R_G.js → index-57qzL_5b.js} +1 -1
  154. package/dist/client/assets/index-5RD9flqf.js +1 -0
  155. package/dist/client/assets/{index-FhWMRBQP.js → index-B6pmysqs.js} +1 -1
  156. package/dist/client/assets/{index-DEiSJbvu.js → index-BIZNH5u1.js} +1 -1
  157. package/dist/client/assets/{index-BOhSPP-6.js → index-BKdXHSbr.js} +1 -1
  158. package/dist/client/assets/{index-B36osK_S.js → index-BN3zOTbR.js} +3 -3
  159. package/dist/client/assets/{index-DYEmUa5t.js → index-BNq_mnok.js} +1 -1
  160. package/dist/client/assets/index-BPp-rj-W.js +1 -0
  161. package/dist/client/assets/{index-DW4KUPHp.js → index-BTqJGL1_.js} +1 -1
  162. package/dist/client/assets/{index-CJXMgnYp.js → index-B_YZ5cyn.js} +1 -1
  163. package/dist/client/assets/{index-Dcd4NqFB.js → index-B_rc9Pb1.js} +1 -1
  164. package/dist/client/assets/{index-56EOd-zy.js → index-B_v2l2ND.js} +1 -1
  165. package/dist/client/assets/{index-QSXJR98z.js → index-Bktc0aFV.js} +1 -1
  166. package/dist/client/assets/index-BtTqA4_d.js +1 -0
  167. package/dist/client/assets/{index-CiGYtR9O.js → index-BxsALYNM.js} +1 -1
  168. package/dist/client/assets/index-C4Uak2ha.js +1 -0
  169. package/dist/client/assets/{index-FI_y_dND.js → index-C7I0BjyX.js} +1 -1
  170. package/dist/client/assets/{index-CoNMlH37.js → index-CEicS7Zi.js} +1 -1
  171. package/dist/client/assets/{index-1QfQImuJ.js → index-CLTrC-a-.js} +3 -3
  172. package/dist/client/assets/{index-CXBYgGja.js → index-CLVvKY2v.js} +1 -1
  173. package/dist/client/assets/{index-BKWJiERs.js → index-COXdXByr.js} +1 -1
  174. package/dist/client/assets/{index-CoKNU2F9.js → index-CTJA-mZu.js} +1 -1
  175. package/dist/client/assets/{index-BOEPL6hN.js → index-CZmU-67J.js} +1 -1
  176. package/dist/client/assets/{index-LwL5BpE4.js → index-Cbbw2ByB.js} +1 -1
  177. package/dist/client/assets/{index-C4t0UTU-.js → index-Cbk19RQp.js} +1 -1
  178. package/dist/client/assets/{index-DqkFtcGQ.js → index-D0QV18E0.js} +1 -1
  179. package/dist/client/assets/{index-7XeZCCDI.js → index-D5fV4hrl.js} +1 -1
  180. package/dist/client/assets/{index-CeDn1Ak1.js → index-DBAPfYwE.js} +1 -1
  181. package/dist/client/assets/{index-Cdod8zEY.js → index-DK8zHloW.js} +1 -1
  182. package/dist/client/assets/index-DO8NbOqk.js +1 -0
  183. package/dist/client/assets/{index-C8ZpJXTQ.js → index-DXZ-w0Z9.js} +1 -1
  184. package/dist/client/assets/{index-n_pnc-CO.js → index-DYQjub9g.js} +1 -1
  185. package/dist/client/assets/index-Daoy3TZ8.js +1 -0
  186. package/dist/client/assets/{index-tgbcsB6H.js → index-DdBvjuc4.js} +1 -1
  187. package/dist/client/assets/{index-X282DRZf.js → index-DhqeMM58.js} +2 -2
  188. package/dist/client/assets/{index-YSHcMqHa.js → index-Ds9wPt9M.js} +1 -1
  189. package/dist/client/assets/{index-Br6xDNvu.js → index-RQhQx8gq.js} +1 -1
  190. package/dist/client/assets/{index-CrTmY12y.js → index-UJpgX--l.js} +2 -2
  191. package/dist/client/assets/index-YUtEyz7O.js +1053 -0
  192. package/dist/client/assets/{index-BkJlIXqM.js → index-oc-yQ5Q4.js} +1 -1
  193. package/dist/client/assets/index-tRdq7FGO.js +1 -0
  194. package/dist/client/assets/{index-ZR5f82z2.js → index-um-0KSur.js} +1 -1
  195. package/dist/client/assets/{index.esm-CAeUe7uQ.js → index.esm-B10OaB6F.js} +1 -1
  196. package/dist/client/assets/{infoDiagram-MVDRKAX5-DweUdYSy.js → infoDiagram-MVDRKAX5-CGtvYWtj.js} +1 -1
  197. package/dist/client/assets/{inline-code-SYHTKcle.js → inline-code-BL-6EKVP.js} +1 -1
  198. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DKNQIv7P.js → ishikawaDiagram-HPEHV2GE-ICsVVT2t.js} +1 -1
  199. package/dist/client/assets/{journeyDiagram-BOSHW7O7-DPD7F4VO.js → journeyDiagram-BOSHW7O7-DEmSX2Hn.js} +1 -1
  200. package/dist/client/assets/{kanban-definition-FNSA4HC5-B_uPSwxC.js → kanban-definition-FNSA4HC5-SAV5PQOr.js} +1 -1
  201. package/dist/client/assets/{layers-F4mvrI2l.js → layers-Bfdpn7ZM.js} +1 -1
  202. package/dist/client/assets/{lightbulb-a6nNsrzy.js → lightbulb-CSPTiZoi.js} +1 -1
  203. package/dist/client/assets/{link-2-yI2Tlm7Q.js → link-2-ZzmN9B9k.js} +1 -1
  204. package/dist/client/assets/{list-runtime-types-CsGil5te.js → list-runtime-types-7qV7HQ7K.js} +1 -1
  205. package/dist/client/assets/{markdown-content-Cjhsscbn.js → markdown-content-CiDXslQf.js} +1 -1
  206. package/dist/client/assets/mention-pill-CuSUdpn7.js +1 -0
  207. package/dist/client/assets/{mermaid.core-9PwG-9fN.js → mermaid.core-C-qvGQ5g.js} +4 -4
  208. package/dist/client/assets/{message-square-off-aV4NMCjd.js → message-square-off-BehEHG9c.js} +1 -1
  209. package/dist/client/assets/{mindmap-definition-6OY57UG3-BRbWmQkj.js → mindmap-definition-6OY57UG3-DzU2APoo.js} +1 -1
  210. package/dist/client/assets/{more-details-CRLU2HN4.js → more-details-DF2dJXMV.js} +1 -1
  211. package/dist/client/assets/{owner-notice-CTJbhUak.js → owner-notice-DoH-_Veh.js} +1 -1
  212. package/dist/client/assets/{package-sPggO7Dr.js → package-Fm_v1gMn.js} +1 -1
  213. package/dist/client/assets/{page-container-CnfDuiDC.js → page-container-Bcz5wJVR.js} +1 -1
  214. package/dist/client/assets/{pane-resize-handle-63OC5vfI.js → pane-resize-handle-_EuIpxzc.js} +1 -1
  215. package/dist/client/assets/{paperclip-WhPo3_WD.js → paperclip-AGN67YEM.js} +1 -1
  216. package/dist/client/assets/path-input-jrT0Ap4j.js +1 -0
  217. package/dist/client/assets/{pegDiagram-ECIUJNBX-Ct9Li_PA.js → pegDiagram-ECIUJNBX-CAyGJ7fm.js} +1 -1
  218. package/dist/client/assets/{pieDiagram-GNMPY74T-BAB5RA5v.js → pieDiagram-GNMPY74T-tmLJe1p-.js} +1 -1
  219. package/dist/client/assets/{plug-_q5iqunq.js → plug-C-4o4Kb8.js} +1 -1
  220. package/dist/client/assets/primer-trigger-CmE4Ib-X.js +3 -0
  221. package/dist/client/assets/{profile-errors-COcBx7w5.js → profile-errors-vJU1kT3U.js} +1 -1
  222. package/dist/client/assets/{progress-77FCPL2y.js → progress-BTu_QWg8.js} +1 -1
  223. package/dist/client/assets/{quadrantDiagram-D57K4MC3-BqPJVmMS.js → quadrantDiagram-D57K4MC3-CUr2zJoz.js} +1 -1
  224. package/dist/client/assets/{query-error-state-5236P3z0.js → query-error-state-BCX32dab.js} +1 -1
  225. package/dist/client/assets/{radio-C8xmfoqO.js → radio-DBitPjM1.js} +1 -1
  226. package/dist/client/assets/{railroadDiagram-Y72NRBL7-B8U11nT6.js → railroadDiagram-Y72NRBL7-Bk9OMEWz.js} +1 -1
  227. package/dist/client/assets/registry-DVPRVi8T.js +34 -0
  228. package/dist/client/assets/registry-DiFfRDdW.js +1 -0
  229. package/dist/client/assets/{relay-trace-schemas-B80E4EUn.js → relay-trace-schemas-C-1Js81V.js} +2 -2
  230. package/dist/client/assets/{repeat-CHmB_vD7.js → repeat-B1wCYWXI.js} +1 -1
  231. package/dist/client/assets/{requirementDiagram-EQYSW5RA-CzJ1gzTh.js → requirementDiagram-EQYSW5RA-B2pkljrw.js} +1 -1
  232. package/dist/client/assets/{room-files-source-B0gc97Ri.js → room-files-source-BDkq0-fd.js} +2 -2
  233. package/dist/client/assets/{rotate-ccw-clock-CCU6SVnv.js → rotate-ccw-clock-Ds8cHkxD.js} +1 -1
  234. package/dist/client/assets/{rotate-cw-B8WQa8O-.js → rotate-cw-hUzouNTK.js} +1 -1
  235. package/dist/client/assets/{sankeyDiagram-SY24JHO5-D4vQwyve.js → sankeyDiagram-SY24JHO5-DEW9eIPS.js} +1 -1
  236. package/dist/client/assets/scroll-area-RSd8NjrE.js +1 -0
  237. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BVnIsPQe.js → sequenceDiagram-BLEHNHQU-CoiCdD1D.js} +1 -1
  238. package/dist/client/assets/{shield-x-ijIbRppV.js → shield-x-KL4ZbHfz.js} +1 -1
  239. package/dist/client/assets/signed-in-Dzxe2378.js +1 -0
  240. package/dist/client/assets/{sizeCapture-INFHLROL-DGb1rAJL.js → sizeCapture-INFHLROL-BWGf0Ghs.js} +1 -1
  241. package/dist/client/assets/{soul-file-CXgYs25S.js → soul-file-BQXbWArv.js} +1 -1
  242. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DeX3IKTm.js → stateDiagram-v2-A6IESKWZ-aeqwGZMB.js} +1 -1
  243. package/dist/client/assets/{swimlanes-B3ENRKFQ-DN5ljYhG.js → swimlanes-B3ENRKFQ-BkWhAAlV.js} +1 -1
  244. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CS2DMvLi.js +8 -0
  245. package/dist/client/assets/{table-D9ww_3Ij.js → table-CfLst6CF.js} +1 -1
  246. package/dist/client/assets/{timeline-definition-JXYKGLGB-DpRthC3r.js → timeline-definition-JXYKGLGB-C1BUxIfq.js} +1 -1
  247. package/dist/client/assets/{trust-posture-Dn2ciEE0.js → trust-posture-CfEIPM4Z.js} +1 -1
  248. package/dist/client/assets/{unplug-BZ8zSvfB.js → unplug-B3eDst8L.js} +1 -1
  249. package/dist/client/assets/{unverified-catalog-notice-CGy05tAO.js → unverified-catalog-notice-BqIWxQuN.js} +1 -1
  250. package/dist/client/assets/{use-bindings-BLAWQRpe.js → use-bindings-DhOKnybh.js} +1 -1
  251. package/dist/client/assets/{use-composer-prefs-ICOpilWK.js → use-composer-prefs-_rlNL0D8.js} +1 -1
  252. package/dist/client/assets/{use-connector-management-DEMGZy9N.js → use-connector-management-CHLdhBhC.js} +1 -1
  253. package/dist/client/assets/{use-deep-link-scroll-DxGYrks3.js → use-deep-link-scroll-BVkszEn2.js} +1 -1
  254. package/dist/client/assets/{use-delete-binding-Bnv3J5Fu.js → use-delete-binding-BET7vH2R.js} +1 -1
  255. package/dist/client/assets/{use-dev-links-BOcktLiE.js → use-dev-links-BjLPuSUC.js} +1 -1
  256. package/dist/client/assets/{use-direct-message-panel-D38tSozW.js → use-direct-message-panel-ClXVf94w.js} +1 -1
  257. package/dist/client/assets/{use-external-adapter-catalog-9qiNBqpc.js → use-external-adapter-catalog-D1INoacX.js} +1 -1
  258. package/dist/client/assets/use-filter-state-BRlb3qG3.js +6 -0
  259. package/dist/client/assets/use-full-activity-feed-GWBg-_1B.js +1 -0
  260. package/dist/client/assets/use-is-below-desktop-BjWA-tqP.js +1 -0
  261. package/dist/client/assets/{use-local-browser-B1huJhdg.js → use-local-browser-C-V2n_wd.js} +1 -1
  262. package/dist/client/assets/{use-mesh-topology-BTYAy6zc.js → use-mesh-topology-BzSFyR_s.js} +1 -1
  263. package/dist/client/assets/{use-mounted-ref-CaPc6Prv.js → use-mounted-ref-1T3JbkY1.js} +1 -1
  264. package/dist/client/assets/{use-notification-prefs-u76DPoP0.js → use-notification-prefs-qcYeVmLQ.js} +1 -1
  265. package/dist/client/assets/use-pending-read-C1oA2H00.js +1 -0
  266. package/dist/client/assets/use-personality-commit-CJb-rqmM.js +1 -0
  267. package/dist/client/assets/{use-promo-activation-5HG08FlB.js → use-promo-activation-CAJItujg.js} +3 -3
  268. package/dist/client/assets/{use-promo-dismissals-CO7-qhEl.js → use-promo-dismissals-C6bPU5Rm.js} +1 -1
  269. package/dist/client/assets/{use-pulse-freshness-D07Mv-Sa.js → use-pulse-freshness-Y11Ibit1.js} +1 -1
  270. package/dist/client/assets/{use-room-follow-claim-DRQBuAIe.js → use-room-follow-claim-Di-yvoJD.js} +1 -1
  271. package/dist/client/assets/{use-room-sessions-Bzk7rM40.js → use-room-sessions-CPDRbQAW.js} +1 -1
  272. package/dist/client/assets/{use-roving-tab-list-CcznVldj.js → use-roving-tab-list-DK0OzOUz.js} +1 -1
  273. package/dist/client/assets/{use-session-canvas-CpgE7tFb.js → use-session-canvas-DA2i9Mdm.js} +6 -6
  274. package/dist/client/assets/use-status-budget-jMg_w0rF.js +21 -0
  275. package/dist/client/assets/{use-transform-ByJGn3hq.js → use-transform-BX3r518L.js} +1 -1
  276. package/dist/client/assets/{use-unclaimed-chats-C-z5fstJ.js → use-unclaimed-chats-B0nk8b84.js} +1 -1
  277. package/dist/client/assets/use-update-config-Ce7sHmp2.js +1 -0
  278. package/dist/client/assets/{useMutationState-BF1EFtIZ.js → useMutationState-Rlga1GBT.js} +1 -1
  279. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-efVKbRIX.js → usecaseDiagram-WPOLBNNX-mjIwRNL1.js} +1 -1
  280. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Bravmwce.js → vennDiagram-Q3Y3IDCW-BcDIpVa6.js} +1 -1
  281. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-fR77zByv.js → wardleyDiagram-IVAIDKWA-NFX31kox.js} +1 -1
  282. package/dist/client/assets/{xychartDiagram-4URNHDU4-BphORSLh.js → xychartDiagram-4URNHDU4-DZZY7dL1.js} +1 -1
  283. package/dist/client/index.html +2 -2
  284. package/dist/drizzle/20261031012841_dor3309_file_turn_on_offer.sql +2 -0
  285. package/dist/drizzle/20261101122330_schedule_declined_content_key.sql +1 -0
  286. package/dist/drizzle/meta/20261031012841_snapshot.json +14116 -0
  287. package/dist/drizzle/meta/20261101122330_snapshot.json +14123 -0
  288. package/dist/drizzle/meta/_journal.json +14 -0
  289. package/dist/server/index.js +6424 -4548
  290. package/dist/server/index.js.map +2 -2
  291. package/package.json +5 -5
  292. package/dist/client/assets/ActivityRow-DIBH4v9c.js +0 -1
  293. package/dist/client/assets/AdapterSetupWizard-Dle_b9qc.js +0 -2
  294. package/dist/client/assets/AppearancePage-DXbhUt2e.js +0 -1
  295. package/dist/client/assets/AttentionSignalRow-5E7TkG98.js +0 -1
  296. package/dist/client/assets/BindingDialog-q--8SDJF.js +0 -1
  297. package/dist/client/assets/CanvasFileContent-BThy5fjD.js +0 -2
  298. package/dist/client/assets/CanvasModel3dContent-BbgR73jh.js +0 -2
  299. package/dist/client/assets/ChannelComposer-qhk0KtW7.js +0 -44
  300. package/dist/client/assets/ConnectionAccessLists-DRwO1v0V.js +0 -1
  301. package/dist/client/assets/HandlePage-B4qbFi40.js +0 -1
  302. package/dist/client/assets/HeartbeatPage-BnNbQLCW.js +0 -1
  303. package/dist/client/assets/Marketplace-DbdLWz0-.js +0 -36
  304. package/dist/client/assets/NamePage-fhxyWDDY.js +0 -1
  305. package/dist/client/assets/OperatorIdentityForm-Bls5Vo_u.js +0 -1
  306. package/dist/client/assets/PhotoPage-CNHcXbz4.js +0 -1
  307. package/dist/client/assets/PreviewRefusedNotice-Ds4IO32o.js +0 -1
  308. package/dist/client/assets/PromptSuggestionChips-BXxC799Q.js +0 -1
  309. package/dist/client/assets/RoomSurface-DgH3a_Fv.js +0 -1
  310. package/dist/client/assets/RunsOnPopover-CEkkjrGg.js +0 -1
  311. package/dist/client/assets/RuntimeConnectFlow-DXWGgvCW.js +0 -1
  312. package/dist/client/assets/RuntimeSetupDialog-D6L1QhMF.js +0 -1
  313. package/dist/client/assets/SettingsDialog-BOOqWKcj.js +0 -12
  314. package/dist/client/assets/SkillsPage-ntCEhUIM.js +0 -1
  315. package/dist/client/assets/TaskDialogWrapper-vBWAWwTY.js +0 -1
  316. package/dist/client/assets/TasksEmptyState-C_3UkAbA.js +0 -3
  317. package/dist/client/assets/TourHost-B69XAKpE.js +0 -1
  318. package/dist/client/assets/WidgetErrorCard-BlqaIsPK.js +0 -108
  319. package/dist/client/assets/WorkView-BekLkR4O.js +0 -51
  320. package/dist/client/assets/_shell-Du0F-5fK.js +0 -80
  321. package/dist/client/assets/_shell._home.activity-5rihXoYF.js +0 -1
  322. package/dist/client/assets/_shell._home.index-BsLNqt4f.js +0 -3
  323. package/dist/client/assets/_shell._home.tasks-Cxs5tLWA.js +0 -1
  324. package/dist/client/assets/_shell._home.workspaces-CEHDdfbP.js +0 -1
  325. package/dist/client/assets/_shell.connections-Bm0WmgXH.js +0 -1
  326. package/dist/client/assets/_shell.marketplace-CsQ60Mlc.js +0 -1
  327. package/dist/client/assets/_shell.marketplace_.sources-DNyShS1x.js +0 -1
  328. package/dist/client/assets/_shell.session-BN42bV3w.js +0 -1
  329. package/dist/client/assets/_shell.threads-HH4EvufJ.js +0 -1
  330. package/dist/client/assets/_shell.x._extensionId-3ZlJV1iu.js +0 -1
  331. package/dist/client/assets/_shell.x._extensionId_._-3ZlJV1iu.js +0 -1
  332. package/dist/client/assets/card-DUmTNXJJ.js +0 -1
  333. package/dist/client/assets/channel-B7zgJbnU.js +0 -1
  334. package/dist/client/assets/form-D93N5lrK.js +0 -1
  335. package/dist/client/assets/image-lightbox-vgPEvSCc.js +0 -1
  336. package/dist/client/assets/index-B446r3dL.js +0 -1
  337. package/dist/client/assets/index-BGo1YiUE.js +0 -1
  338. package/dist/client/assets/index-BO3yPJt-.js +0 -1
  339. package/dist/client/assets/index-DE6uOpn4.js +0 -1
  340. package/dist/client/assets/index-Dag1qeZI.js +0 -1
  341. package/dist/client/assets/index-Dm0Tav7v.js +0 -1
  342. package/dist/client/assets/index-Dry_agqN.css +0 -1
  343. package/dist/client/assets/index-OQuvRZTD.js +0 -1058
  344. package/dist/client/assets/index-eVrGefuq.js +0 -1
  345. package/dist/client/assets/mention-pill-BsOeTJ2f.js +0 -1
  346. package/dist/client/assets/path-input-C2KIXdON.js +0 -1
  347. package/dist/client/assets/primer-trigger-B2tjuHBx.js +0 -3
  348. package/dist/client/assets/registry-BzXBOE9h.js +0 -34
  349. package/dist/client/assets/registry-sfhDu9q2.js +0 -1
  350. package/dist/client/assets/scroll-area-FwZwM74Q.js +0 -1
  351. package/dist/client/assets/search-x-Q18Wm-C5.js +0 -6
  352. package/dist/client/assets/signed-in-DEOMBWVX.js +0 -1
  353. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-D8kHFWtL.js +0 -8
  354. package/dist/client/assets/use-full-activity-feed-CtQquOBW.js +0 -1
  355. package/dist/client/assets/use-is-below-desktop-CAGEAsCC.js +0 -1
  356. package/dist/client/assets/use-pending-read-D0y6i7G9.js +0 -1
  357. package/dist/client/assets/use-personality-commit-C3h8upDo.js +0 -1
  358. package/dist/client/assets/use-status-budget-Xn2sIeM1.js +0 -16
  359. package/dist/client/assets/use-update-config-L5NCTj3t.js +0 -1
@@ -0,0 +1,45 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BN3zOTbR.js","assets/index-YUtEyz7O.js","assets/index-3JL8A9YZ.css","assets/room-files-source-BDkq0-fd.js","assets/markdown-content-CiDXslQf.js","assets/file-exclamation-point-Cdt8YqyQ.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-DYQjub9g.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-hUzouNTK.js","assets/link-2-ZzmN9B9k.js","assets/file-D7_QdH_S.js","assets/git-branch-CPOwiT8a.js","assets/more-details-DF2dJXMV.js"])))=>i.map(i=>d[i]);
2
+ import{O as P,r as c,j as l,B as ue,h4 as Nn,n1 as Cn,g as Rn,k2 as An,G as te,a5 as fe,a7 as Fe,a8 as Be,aQ as U,ci as Ue,cj as Sn,cT as Mn,n2 as jn,lx as _n,n3 as On,h as En,ay as Tn,cp as He,gv as se,q as Z,dB as We,s as pe,lX as $n,n4 as Dn,my as Pn,n5 as Ln,eP as Fn,g7 as Bn,a0 as Un,e0 as Hn,m$ as Wn,n6 as Kn,n7 as zn,a4 as qn,bx as Vn,n8 as Gn,n9 as Jn,Y as Yn,$ as Qn,gA as Xn,kT as Ce,na as Ke,bV as Zn,kS as Q,kW as ze,nb as et,ch as ge,ak as nt,bZ as he,im as qe,c5 as tt,_ as Ve,nc as st,ct as Ge,nd as ot,fc as at,kj as Je,ne as Ye,a_ as rt,gx as Qe,kV as it,nf as Xe,ng as ct,nh as lt,ni as dt,nj as Re,eR as ut,nk as mt,nl as ft,nm as pt,nn as gt,no as ht,np as xt,l as yt,hh as bt,kK as vt,al as kt,nq as wt,nr as It,ns as Nt,b9 as Ct,nt as Rt,nu as At,nv as St,nw as Mt,Z as Ae,f0 as jt}from"./index-YUtEyz7O.js";import{g as Se,m as Me,h as xe,f as Ze,M as _t,a as Ot,E as Et,i as Tt,j as $t,c as D,k as Dt,b as Pt,l as Lt,r as Ft,u as Bt,C as Ut}from"./registry-DVPRVi8T.js";import"./WidgetErrorCard-CQKYI7oK.js";import{R as Ht,A as en}from"./repeat-B1wCYWXI.js";import{u as Wt}from"./use-room-sessions-CPDRbQAW.js";import{M as Kt}from"./markdown-content-CiDXslQf.js";import{W as zt,a as qt}from"./find-latest-widget-fence-SQB9WgjN.js";import{f as Vt}from"./format-duration-BCr6uzby.js";import{H as Gt,a as Jt,b as Yt}from"./RuntimeSetupDialog-bdf844gx.js";import{M as je}from"./mention-pill-CuSUdpn7.js";import{R as Qt}from"./rotate-ccw-clock-Ds8cHkxD.js";import{U as Xt}from"./unplug-B3eDst8L.js";import{M as _e}from"./message-square-off-BehEHG9c.js";import{i as Zt}from"./registry-DiFfRDdW.js";/**
3
+ * @license lucide-react v1.48.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const nn={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"}]]};nn.node;const es=P(nn);/**
8
+ * @license lucide-react v1.48.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const tn={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"}]]};tn.node;const ns=P(tn);/**
13
+ * @license lucide-react v1.48.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const sn={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"}]]};sn.node;const ts=P(sn);/**
18
+ * @license lucide-react v1.48.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const on={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"}]]};on.node;const ss=P(on);/**
23
+ * @license lucide-react v1.48.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const an={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"}]]};an.node;const os=P(an);/**
28
+ * @license lucide-react v1.48.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const rn={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};rn.node;const as=P(rn);/**
33
+ * @license lucide-react v1.48.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const cn={name:"user-minus",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:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};cn.node;const Oe=P(cn);/**
38
+ * @license lucide-react v1.48.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const ln={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"}]]};ln.node;const rs=P(ln),is='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function cs(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=c.useRef(null),r=c.useRef(!1);c.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let m=0,x=0;const v=()=>{var u;const f=(u=a.current)==null?void 0:u.querySelector(is);if(f)return f.focus();++m<10&&(x=requestAnimationFrame(v))};return v(),()=>cancelAnimationFrame(x)},[t]);const i=c.useCallback(m=>{var x;!m&&((x=a.current)!=null&&x.contains(document.activeElement))||s(m)},[s]),d=c.useCallback(m=>{!o||m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),r.current=!0,s(!0))},[o,s]),p=c.useMemo(()=>({onEscapeKeyDown:()=>{var m;return(m=n.current)==null?void 0:m.focus()},onBlur:m=>{var v,f,u;const x=m.relatedTarget;x&&((v=a.current)!=null&&v.contains(x)||(f=n.current)!=null&&f.contains(x))||(u=a.current)!=null&&u.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:i,onTriggerKeyDown:d,contentHandlers:p}}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 i=s||n&&e.shiftKey?-1:1;a[(r+i+a.length)%a.length].focus()}function ls({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 ds({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(Nn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const us=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:i}){const{kind:d,displayName:p,handle:m,color:x,emoji:v,imageUrl:f,origin:u,agent:g}=e,I=x??"hsl(var(--muted-foreground))",h=typeof u=="object"&&u!==null,y=d==="agent"&&(g==null?void 0:g.working)!=null?g.working:null,[N,M]=c.useState(!1),S=c.useCallback(k=>{M(k),a==null||a(k)},[a]),R=c.useRef(!1),C=c.useRef(null),A=Cn({onLongPress:()=>{R.current&&S(!0)}}),{contentRef:_,handleOpenChange:O,onTriggerKeyDown:b,contentHandlers:j}=cs({open:N,setOpen:S,triggerRef:C,enabled:r&&o!==void 0});return l.jsxs(Gt,{open:N,onOpenChange:O,openDelay:us,children:[l.jsx(Jt,{asChild:!0,ref:C,"data-gesture-priority":"",...A,onPointerDown:k=>{R.current=k.pointerType==="touch"||k.pointerType==="pen",A.onPointerDown(k)},...r?{onClick:()=>S(!0),onKeyDown:b}:{},children:t}),l.jsxs(Yt,{ref:_,...j,...o?{role:"dialog","aria-label":p}:{},"data-slot":"identity-hover-card",align:"start",className:te("flex w-64 flex-col gap-0 overflow-hidden p-0",i),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(Rn,{"aria-hidden":!0,color:I,emoji:v,imageUrl:f,fallback:An(p),kind:d,origin:u,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:p}),m&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",m]})]})]}),n&&l.jsx(ls,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((g==null?void 0:g.runtime)||(g==null?void 0:g.model))&&l.jsx(G,{children:[g.runtime,g.model].filter(Boolean).join(" · ")}),y&&l.jsxs(G,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Vt(y.forMs)]}),d==="human"&&l.jsx(G,{children:h?u.platform:"On this machine"}),d==="agent"&&(g==null?void 0:g.managedBy)&&l.jsxs(G,{children:["Managed by"," ",g.managedBy.handle?`@${g.managedBy.handle}`:g.managedBy.displayName]})]}),o?l.jsx(ds,{actions:o,onAct:()=>{var k;(k=C.current)==null||k.focus(),S(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var k;(k=C.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 ms(){const e=fe(),t=Fe();return Be({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var m;const r=t.getQueryData(U.entries(s)),i=(m=r==null?void 0:r.find(x=>x.id===n))==null?void 0:m.reactions,{reactions:d,on:p}=Se(i,o,a);return t.setQueryData(U.entries(s),x=>Me(x,n,d)),{on:p}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,p;const r=t.getQueryData(U.entries(s)),i=((p=(d=r==null?void 0:r.find(m=>m.id===n))==null?void 0:d.reactions)==null?void 0:p.some(m=>m.emoji===o&&m.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:i})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},i)=>{i!==void 0&&t.setQueryData(U.entries(n),d=>{var x;const p=(x=d==null?void 0:d.find(v=>v.id===o))==null?void 0:x.reactions,{reactions:m}=Se(p,a,r,!i.on);return Me(d,o,m)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(U.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 fs(e){return W(e)??e.id}function ps(e,t){return Math.max(t??0,e)}function la(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:ps(e.length,s),lastAt:n.createdAt,unread:o}}function gs(e){var S,R;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=Ue(),r=Sn(),i=a&&o&&t!==void 0,d=Mn(i?t:null),p=jn(d.member),m=_n(),x=On(),v=En(),f=Tn(),{data:u}=He({enabled:i&&r}),g=f.status==="ready"?f.roomId:null,I=u==null?void 0:u.find(C=>C.id===g),h=I?se(I):null,y=(R=(S=d.member)==null?void 0:S.agent)==null?void 0:R.effectiveRuntimeId,N=c.useCallback(()=>{t!==void 0&&(Z.getState().recordOpened("agent",t),m({agentPath:t},y?{runtime:y}:{}))},[t,m,y]),M=c.useCallback(async()=>{if(t===void 0||!v)return;const C=await x(t);if(C===null){We(`${s} has no session in ${h??"this room"} yet`);return}v(pe({session:C}))},[t,v,x,s,h]);return c.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:p},actions:{onMessage:N,...n?{onViewProfile:n}:{},...r&&h?{session:{label:`Session in ${h}`,onOpen:()=>void M()}}:{}}},[a,t,d.role,p,N,n,r,h,M])}function hs({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=c.useState(!1),i=gs({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=c.useCallback(p=>{p&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&i!==null,...i?{about:i.about,actions:i.actions}:{},children:o})}function xs(e){return l.jsx(qt,{code:e.code,isIncomplete:e.isIncomplete})}const ys=[{language:zt,component:xs}],bs={turn_failed:{Icon:qn,tone:"text-status-warning"},agent_busy:{Icon:zn},agent_gone:{Icon:rs,tone:"text-status-warning"},agent_left:{Icon:Oe,tone:"text-status-warning"},room_archived:{Icon:Kn},agent_reseated:{Icon:Wn},handle_changed:{Icon:en},files_set_up:{Icon:Hn},handoff_shared:{Icon:Un},handoff_declined:{Icon:_e},runtime_gone:{Icon:ss,tone:"text-status-warning"},agent_paused:{Icon:Bn},agent_declined:{Icon:_e},agent_unavailable:{Icon:Fn},awaiting_approval:{Icon:es,tone:"text-status-warning"},halted:{Icon:Ln},budget_reached:{Icon:Pn},cascade_stopped:{Icon:Dn},addressing_changed:{Icon:ts},bridge_blocked:{Icon:Xt,tone:"text-status-warning"},bridge_undelivered:{Icon:$n,tone:"text-status-warning"},bridge_rate_limited:{Icon:as},bridge_second_agent_refused:{Icon:Oe},bridge_disconnected:{Icon:ns},bridge_agent_swapped:{Icon:Ht},bridge_history_note:{Icon:Qt}},vs={Icon:Vn},le=80;function ks(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 ws(e,t,s){const n=Is(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 Is(e,t){if(t!==void 0){const n=Gn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=Jn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function Ns({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,tone:r}=(e.body.notice&&bs[e.body.notice])??vs;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":ks(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?ws(e.body.text,n,o):e.body.text})]})}const Cs=Zt.moment;function Rs({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=Ze(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(_t,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(Cs,{"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:Ot(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function As(e,t){const s=Q.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
43
+ `)?"":" ";s.set(e,`${n}${o}@${t} `)}function Ss({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const a=fs(t),r=t.body.text,i=(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:p}=Yn({toastOnSettle:!0});return c.useMemo(()=>{const m={reply:{id:"reply",label:"Reply in thread",icon:os,run:()=>{Xn.getState().openThread(e,a,!0),Ce.getState().requestFocus(Ke(e,a))}},copy:{id:"copy",label:"Copy text",icon:Qn,run:()=>void p(r)}};return o!==void 0&&(m.profile={id:"profile",label:"View profile",icon:Zn,run:o}),i!==void 0&&(m.mention={id:"mention",label:d===void 0?"Mention author":`Mention ${d}`,icon:en,run:()=>{As(e,i),Ce.getState().requestFocus(e)}}),Et.map(x=>m[x]).filter(x=>x!==void 0)},[e,a,r,i,d,o,p])}function Ms(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function da(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 ua(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function js(e,t,s){const n=t.get(e),o=ze({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 ma(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 i=n.get(r);i?i.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function _s(e){return`thread-${e}`}function Os(e){return`thread-row-${e}`}function fa(e){return`thread-panel-entry-${e}`}function Es(e){return`room-entry-${e}`}function Ts(e,t){const s=e.find(i=>i.id===t);if(s===void 0)return null;const n=W(s)??null,o={rowId:t,domId:Es(t)};if(n===null)return o;const a=e.find(i=>i.id===n);return a!==void 0&&(W(a)??null)===null?{rowId:_s(n),domId:Os(n)}:o}function pa(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Ts(e,s.id)}const Ee=48;function ga(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>Ee?`${a.slice(0,Ee).trimEnd()}…`:a}}function $s(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=et({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:nt(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Ds(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Ps={info:new Map,faces:new Map},be=c.createContext(Ps);function ha({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function xa(){const e=he(),t=c.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=c.useMemo(()=>t.map(r=>r.projectPath),[t]),n=qe(s),o=c.useMemo(()=>$s(t,n.data??{}),[t,n.data]),a=c.useMemo(()=>Ds(o),[o]);return c.useMemo(()=>({info:o,faces:a}),[o,a])}function ee(e){const t=c.useContext(be);return e===void 0?void 0:t.info.get(e)}function Ls(){return c.useContext(be).faces}const Te={people:"People",agents:"Agents"},Fs=["people","agents"];function Bs(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 Us(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Hs(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 Hs(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 Ws(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,i=a.startsWith(" ")?"":" ";return{value:o+r+i+a,cursorPos:o.length+r.length+1}}const Ks=/(^|\s)@([A-Za-z0-9_.-]*)$/,dn="mention-palette-listbox";function me(e){return`mention-item-${e}`}function zs({members:e,viewerAuthorId:t,text:s,sectionOrder:n=Fs}){var j;const[o,a]=c.useState(!1),[r,i]=c.useState(""),[d,p]=c.useState(-1),m=tt(s),x=c.useRef(!1),v=c.useMemo(()=>Bs(e,t),[e,t]),f=c.useMemo(()=>o?Us(v,r,n):[],[v,r,o,n]),[u,g]=c.useState(null),I=u!==null&&u.query===r&&u.open===o?u.index:J(f,0,1),h=f[I],y=f.length===0||h!==void 0&&!h.disabled?I:J(f,0,1),N=c.useCallback((k,T)=>{const $=k.slice(0,T).match(Ks);if(!$){a(!1);return}a(!0),i($[2]),p(($.index??0)+$[1].length)},[]),M=c.useCallback(k=>{m.write(k),x.current=!1},[m]),S=c.useCallback(k=>{x.current||N(m.read(),k)},[N,m]),R=c.useCallback(()=>{g({query:r,open:o,index:J(f,y+1,1)})},[f,y,r,o]),C=c.useCallback(()=>{g({query:r,open:o,index:J(f,y-1,-1)})},[f,y,r,o]),A=c.useCallback(k=>k.disabled||k.handle===void 0?null:(x.current=!0,a(!1),Ws(m.read(),d,r,k.handle)),[d,r,m]),_=c.useCallback(()=>{const k=f[y];return k?A(k):(a(!1),null)},[f,y,A]),O=c.useCallback(()=>{x.current=!0,a(!1)},[]),b=f.some(k=>!k.disabled);return{isOpen:o,hasSelectableRows:b,rows:f,selectedIndex:y,activeDescendantId:o&&((j=f[y])==null?void 0:j.disabled)===!1?me(y):void 0,listboxId:o?dn:void 0,noteTextChange:M,handleCursorChange:S,moveDown:R,moveUp:C,selectHighlighted:_,selectRow:A,dismiss:O}}function qs({rows:e,selectedIndex:t,onSelect:s}){const n=c.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const i=o[o.length-1];i&&i.section===a.section?i.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return c.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Ve.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:dn,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":Te[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:Te[o]}),a.map(({row:i,index:d})=>{const p=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":p,"aria-disabled":i.disabled,"data-selected":p,"data-disabled":i.disabled,onClick:()=>{i.disabled||s(i)},className:i.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:i.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:i.label}),i.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",i.handle]}),i.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:i.disabledReason})]},i.authorId)})]},o))})})}const Vs=/(?:^|[^A-Za-z0-9_.@-])cc(?![A-Za-z0-9_])/i;function Gs(e,t){const s=e.lastIndexOf(`
44
+ `,t-1)+1;return Vs.test(e.slice(s,t))}function Js(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=s.map(a=>Gs(e,a.offset)),o=new Set(s.filter((a,r)=>!n[r]).map(a=>a.authorId));return s.map((a,r)=>n[r]&&!o.has(a.authorId)?{...a,cc:!0}:a)}function Ys(e,t){const s=e.length>0?`Woke ${e.join(", ")}.`:"Woke nobody.";return t.length>0?`${s} Cc: ${t.join(", ")}.`:s}function un(e){const t=new Set(e.filter(n=>!n.cc).map(n=>n.authorId)),s=[];for(const n of e)n.cc&&!t.has(n.authorId)&&!s.includes(n.authorId)&&s.push(n.authorId);return s}const Qs=/@([A-Za-z0-9][A-Za-z0-9_.-]*)/g,Xs=/[.\-_]+$/;function Zs(e,t){const s=new Map;for(const{author:o}of t)o.handle&&s.set(o.handle.toLowerCase(),o.handle);const n=[];for(const o of e.matchAll(Qs)){if(o.index===void 0)continue;const a=o[1].toLowerCase(),r=a.replace(Xs,""),i=s.get(a)??s.get(r);if(!i)continue;const d=(s.has(a)?a.length:r.length)+1;n.push({offset:o.index,length:d,authorId:i,handle:i})}return n}function eo(e,t){const s=Js(e,Zs(e,t)),n=[],o=[];for(const r of s){const i=r.cc?o:n;i.includes(r.handle)||i.push(r.handle)}if(o.length===0)return null;const a=r=>r.map(i=>`@${i}`).join(", ");return`${n.length>0?`Wakes ${a(n)}`:"Wakes nobody"} · cc ${a(o)}`}function no(e,t){const s=e.mentions.filter(r=>r!==e.authorId);if(s.length===0)return null;const n=new Set(un(e.mentionSpans??[])),o=r=>{var i,d;return`@${((i=t.get(r))==null?void 0:i.handle)??((d=t.get(r))==null?void 0:d.displayName)??r}`},a=s.filter(r=>{var i;return!n.has(r)&&((i=t.get(r))==null?void 0:i.kind)==="agent"});return Ys(a.map(o),s.filter(r=>n.has(r)).map(o))}function to({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:i}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(i)}}const X=120,so="code block";function oo(e){if(e.length<=X&&!e.includes("```"))return null;const t=ao(e);return t.length===0?null:t}function ao(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${so} `).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=ro(t,X),n=s.lastIndexOf(" ");return`${(n>X/2?s.slice(0,n):s).trimEnd()}…`}function ro(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 io({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=ms(),i=o===!0||!a,d=c.useMemo(()=>t.reactions??[],[t.reactions]),p=c.useMemo(()=>d.filter(v=>Tt(v,s)).map(v=>v.emoji),[d,s]),m=c.useCallback(v=>r.mutate({roomId:e,entryId:t.id,emoji:v,viewerAuthorId:s}),[r,e,t.id,s]),x=c.useMemo(()=>({quick:n,mine:p,onToggle:m,disabled:i}),[n,p,m,i]);return{reactions:d,toggle:m,quickRow:x}}function co({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 lo(e,t){var x,v;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&st.includes(n),a=Wt(e,{enabled:o}),r=Ge(),i=Fe(),d=fe(),p=o?((v=(x=a.data)==null?void 0:x.bindings.find(f=>f.authorId===s))==null?void 0:v.sessionId)??null:null,m=c.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(p===null||s===void 0)&&ot({queryClient:i,transport:d},e,s).then(u=>{u.kind!=="none"&&r(pe({session:u.kind==="bound"?u.sessionId:p}))}))},[s,r,i,e,p,d]);return c.useMemo(()=>p===null?null:{href:at({session:p}),onOpen:m},[m,p])}const ne="mention",ve="author_id",uo={[ne]:[ve]},mo=[ne];function fo(e,t){if(!t||t.length===0)return e;const s=po(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:i}=s[o],d=n.slice(0,a),p=n.slice(a,a+r),m=n.slice(a+r);n=`${d}<${ne} ${ve}="${i}">${p}</${ne}>${m}`}return n}function po(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 go=/(?:^|[^\p{L}\p{N}_])cc$/iu;function ho(e,t){const s=new Set;for(const n of t)n.cc&&go.test(e.slice(0,n.offset).trimEnd())&&s.add(n.authorId);return s}const xo=new Map,mn=c.createContext(xo);function yo({authors:e,children:t}){return l.jsx(mn.Provider,{value:e,children:t})}function bo(e){const t=c.useContext(mn);return e===void 0?void 0:t.get(e)}const $e=new WeakMap;function vo(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 ko(e){var n;const s=(n=he().data)==null?void 0:n.agents;return c.useMemo(()=>e===void 0||!s?void 0:vo(s).get(e),[s,e])}function fn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=Ue(),a=ko(o?t:void 0),r=ee(t);return c.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const i={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(p,m={})=>l.jsx(hs,{identity:i,agentPath:a,onViewProfile:n,openOnClick:m.openOnClick??!1,children:p});return{wrap:d,wrapAvatar:p=>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:p}),{openOnClick:!0}),wrapName:p=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:te(p.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 wo={kind:"human",displayName:""};function Io(e){return typeof e=="string"?e.replace(/^@/,""):""}function No({authorId:e,children:t,cc:s,ccWord:n}){const o=bo(e),a=ee(o==null?void 0:o.agentRef),{open:r}=Je(),i=o?ze({record:o,override:a==null?void 0:a.visual}):null,d=o?Ye(o,a==null?void 0:a.memberId):void 0,p=c.useMemo(()=>d===void 0?void 0:()=>r(d),[d,r]),m=i==null?void 0:i.color,x=i==null?void 0:i.emoji,v=i==null?void 0:i.imageUrl,f=c.useMemo(()=>o?{kind:o.kind,displayName:o.displayName,handle:o.handle??void 0,color:m,emoji:x,imageUrl:v,origin:o.origin,agent:a&&{runtime:a.runtime,...a.model&&{model:a.model}}}:null,[o,m,x,v,a]),u=fn({agentRef:o==null?void 0:o.agentRef,identity:f??wo,onViewProfile:p});if(!o||!f)return l.jsx(je,{kind:"human",label:Io(t),resolved:!1});const I=u?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:p?{role:"button",tabIndex:0,"aria-label":`View ${o.displayName}’s profile`,onClick:p,onKeyDown:y=>{y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),p())}}:{},h=l.jsx(je,{kind:o.kind,label:o.displayName,handle:o.handle??void 0,color:o.color,origin:o.origin,resolved:!0,interactive:p!==void 0,...I,cc:s,ccWord:n});return u?u.wrap(h,{openOnClick:!0}):l.jsx(ye,{onViewProfile:p,identity:f,children:h})}function Co(e,t=new Set,s=new Set){return{mention:n=>{const o=n[ve],a=typeof o=="string"?o:void 0;return!a||!e.has(a)?l.jsx(l.Fragment,{children:n.children}):l.jsx(No,{authorId:a,cc:t.has(a),ccWord:!s.has(a),children:n.children})}}}function Ro({entry:e,authors:t}){const s=c.useMemo(()=>fo(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=c.useMemo(()=>{var i;return new Set(((i=e.mentionSpans)==null?void 0:i.map(d=>d.authorId))??[])},[e.mentionSpans]),o=c.useMemo(()=>new Set(un(e.mentionSpans??[])),[e.mentionSpans]),a=c.useMemo(()=>ho(e.body.text,e.mentionSpans??[]),[e.body.text,e.mentionSpans]),r=c.useMemo(()=>Co(n,o,a),[n,o,a]);return l.jsx(yo,{authors:t,children:l.jsx(Kt,{content:s,className:"msg-prose",allowedTags:uo,literalTagContent:mo,components:r,renderers:ys})})}function Ao(e){return function(s){return l.jsx(Ro,{entry:s,authors:e})}}const pn="the top folder";function De(e){return e.slice(e.lastIndexOf("/")+1)}function So(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function Mo(e){return e===""?pn:`${e}/`}function de(e){return e.target!==void 0?e.target===""?pn:e.target:Mo(So(e.paths[0]??""))}function jo(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 ${De(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 ${De(s)} from the chat to ${de(e)}`}}const _o=c.lazy(()=>rt(()=>import("./index-BN3zOTbR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function ya({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:i,streamStalled:d,isMember:p=!0,grouping:m,orphanedReply:x,answers:v,feedPosition:f,rowId:u,roomKind:g}){const I=Ze(t.createdAt),h=c.useMemo(()=>{const L=oo(t.body.text),ie=$t(t.attachments??[]);if(ie===null)return L;const Ne=L??t.body.text.trim();return Ne.length>0?`${Ne} ${ie}`:ie},[t.body.text,t.attachments]),y=c.useId(),N=`${y}-author`,M=`${y}-content`,S=`${y}-summary`,R=c.useRef(null),C=c.useRef(null),A=c.useRef(null),{reactions:_,toggle:O,quickRow:b}=io({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:i,streamStalled:d,isMember:p}),j=ee(n==null?void 0:n.agentRef),{open:k}=Je(),T=n===void 0?void 0:Ye(n,j==null?void 0:j.memberId),$=c.useCallback(()=>{T!==void 0&&k(T)},[k,T]),B=T===void 0?void 0:$,K=Ss({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:B}),F=(n==null?void 0:n.handle)??void 0,oe=c.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:F,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,F,s.color,s.emoji,s.imageUrl]),w=fn({agentRef:n==null?void 0:n.agentRef,identity:oe,onViewProfile:B}),z=co({barRef:C,pillsRef:A,hasReactions:_.length>0}),q=c.useCallback(()=>{var L;return(L=R.current)==null?void 0:L.focus()},[]),bn=c.useMemo(()=>Ao(o),[o]),we=c.useMemo(()=>g==="channel"&&t.authorId===a?no(t,o):null,[g,t,a,o]),vn=c.useCallback(L=>l.jsx(c.Suspense,{fallback:null,children:l.jsx(_o,{roomId:e,attachment:L})}),[e]),kn=Ls(),ae=t.body.subjectAuthorId??t.authorId,E=o.get(ae),V=ee(E==null?void 0:E.agentRef),wn=lo(e,t),re=Ms(t);if(re.kind==="notice")return l.jsx(Ns,{entry:t,feedPosition:f,rowId:u,sessionLink:wn,subjectName:E==null?void 0:E.displayName});if(re.kind==="moment")return l.jsx(Rs,{entry:t,moment:re.moment,subject:ae===t.authorId?s:js(ae,o,kn),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:u});const In=m.position==="first"||m.position==="only",Ie=t.authorId===a;return l.jsxs(D.Root,{ref:R,id:u,position:m.position,actions:K,reactions:b,"data-testid":"room-entry",tabIndex:0,...to({showAuthorHeader:In,headerId:N,displayName:s.displayName,time:I,summary:h,contentId:M,summaryId:S,feedPosition:f}),onKeyDown:z,children:[l.jsx(D.Gutter,{author:s,at:t.createdAt,onViewProfile:w?void 0:B,isSelf:Ie,renderAvatar:w==null?void 0:w.wrapAvatar}),l.jsxs(D.Body,{children:[l.jsx(D.Author,{id:N,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,isSelf:Ie,renderName:w==null?void 0:w.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(Dt,{via:t.body.via}),l.jsx(D.Content,{id:M,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:jo(t.body.fileChange,(E==null?void 0:E.displayName)??"Somebody")}):bn(t,{rowId:t.id,isStreaming:!1})}),we!==null&&l.jsx("p",{"data-testid":"room-entry-reach",className:"text-muted-foreground text-xs",children:we}),h!==null&&l.jsx("span",{id:S,className:"hidden",children:h}),l.jsx(D.Attachments,{items:t.attachments??[],renderAction:p?vn:void 0}),l.jsx(D.Reactions,{ref:A,reactions:_,viewerAuthorId:a,names:r,frequents:i,onToggle:O,disabled:d===!0||!p,onExit:q}),l.jsx(D.Actions,{actions:K,reactions:b,barRef:C,onExit:q})]})]})}const ba={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function Oo(e){const t=fe(),[s,n]=c.useState([]),o=c.useRef(new Map),a=c.useCallback(f=>{const u=f.map(g=>({id:crypto.randomUUID(),file:g,status:"pending",progress:0}));n(g=>[...g,...u])},[]),r=c.useCallback(f=>{o.current.delete(f),n(u=>u.filter(g=>g.id!==f))},[]),i=c.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const u=new Set(f);for(const g of u)o.current.delete(g);n(g=>g.filter(I=>!u.has(I.id)))},[]),d=c.useCallback(f=>{o.current.delete(f),n(u=>u.map(g=>g.id===f&&g.status==="error"?{...g,status:"pending",progress:0,error:void 0}:g))},[]),p=c.useRef(null),m=Be({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(h=>h.map(y=>f.some(N=>N.id===y.id)?{...y,status:"uploading"}:y));const u=h=>{n(y=>y.map(N=>N.status==="uploading"?{...N,progress:h.percentage}:N))},g=new AbortController;p.current=g;const I=f.map(h=>h.file);return t.uploadRoomAttachments(e,I,u,g.signal)},onSettled:()=>{p.current=null},onSuccess:(f,u)=>{u.forEach((g,I)=>{const h=f[I];h&&o.current.set(g.id,h.id)}),n(g=>g.map(I=>u.findIndex(y=>y.id===I.id)===-1?I:{...I,status:"uploaded",progress:100}))},onError:f=>{n(u=>u.map(g=>g.status==="uploading"?{...g,status:"error",error:f.message}:g))}}),x=c.useCallback(()=>{var f;(f=p.current)==null||f.abort()},[]),v=c.useCallback(async()=>{const f=s.filter(g=>g.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 u=s.filter(g=>g.status==="pending");return u.length>0&&await m.mutateAsync(u),s.map(g=>o.current.get(g.id)).filter(g=>g!==void 0)},[s,m]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:i,cancelUpload:x,uploadAndGetIds:v,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:m.isPending}}function va(e){const{room:t,threadRootId:s}=e,n=Pt(),o=Lt(),a=Oo((t==null?void 0:t.id)??""),r=t!==void 0&&Qe(t.members,t.viewerAuthorId),i=c.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});c.useEffect(()=>{i.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=c.useCallback(y=>i.current.attachments.addFiles(y),[]),p=c.useCallback(y=>i.current.attachments.removeFile(y),[]),m=c.useCallback(y=>i.current.attachments.retryFile(y),[]),x=c.useCallback(()=>i.current.attachments.cancelUpload(),[]),{pendingFiles:v,hasFailedUpload:f,isUploading:u}=a,g=c.useMemo(()=>({staged:v,add:d,remove:p,retry:m,cancel:x,hasFailed:f,isUploading:u,holdsSendWhileUploading:!1}),[v,f,u,d,p,m,x]),I=c.useCallback(async y=>{const{attachments:N,post:M,reply:S,room:R,threadRootId:C}=i.current;if(R===void 0)throw new Error("That room isn’t loaded yet.");if(R.archived)throw new Error("This room is archived.");Z.getState().recordOpened("room",R.id);const A=it(),_=N.pendingFiles.map(k=>k.file.name),O=N.pendingFiles.map(k=>k.id),b=await N.uploadAndGetIds();N.clearFiles(O);const j=y.parentEntryId??C;if(Ft({roomId:R.id,threadRootId:j??null},y.text),j!==void 0){S.mutate({roomId:R.id,rootEntryId:j,text:y.text,clientId:A,attachmentIds:b,attachmentNames:_});return}M.mutate({roomId:R.id,text:y.text,clientId:A,attachmentIds:b,attachmentNames:_})},[]);return{target:c.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:Xe},send:I,attachments:g}),[t,s,r,g,I]),attachments:a}}const gn=8;function hn(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function Eo(e){if(dt(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`:hn(e.topic)}function Pe(e){return{kind:"session",id:e.id,name:lt(e.title),summary:hn(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function To(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:Eo(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 $o(e){return e.kind==="session"?Re("session",e.id):Re("room",e.id)}function Le(e,t){const s=[Y(t[$o(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 Do(e){return(t,s)=>Le(s,e)-Le(t,e)||s.id.localeCompare(t.id)}function Po(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 Lo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function Fo({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=gn}){const{yours:a,spinOffs:r,automated:i}=ct(e),d=Do(n),p=[...a.map(Pe),...t.filter(m=>Lo(m,s)).map(To)].sort(d);return{items:Po(p).slice(0,o),automated:[...r,...i].map(Pe).sort(d).slice(0,o)}}const Bo=3,Uo=ft;function Ho({limit:e=gn,mutedRoomIds:t,enabled:s=!0}={}){var p,m;const n=ut(Math.max(e*Bo,Uo),{enabled:s}),o=He({enabled:s}),a=mt(),r=(p=n.data)==null?void 0:p.sessions,i=o.data;return{...c.useMemo(()=>Fo({sessions:r??[],rooms:i??[],mutedRoomIds:t,interactions:a,limit:e}),[r,i,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((m=n.data)==null?void 0:m.warnings)??[]}}const Wo=6,xn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const Ko='[role="combobox"]';function H(e){return e instanceof Element&&e.matches(Ko)}function zo({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=Ge(),o=pt(),[a,r]=c.useState(!1),[i,d]=c.useState({stamp:"",index:0}),[p,m]=c.useState(!1),[x,v]=c.useState(!1);e.length>0&&!x&&v(!0);const f=c.useRef(!1);c.useEffect(()=>{f.current=!0},[]);const{data:u}=he({enabled:s}),g=c.useMemo(()=>((u==null?void 0:u.agents)??[]).map(w=>w.projectPath),[u]),{data:I}=qe(g,{enabled:s}),h=c.useMemo(()=>I??{},[I]),y=c.useMemo(()=>gt(g,h),[g,h]),N=c.useMemo(()=>new Map(g.map(w=>[ge(w),w])),[g]),M=c.useCallback(w=>ht({room:w,agentsByPath:h,pathByAgentRef:N}),[h,N]),S=c.useMemo(()=>xt(o.muted),[o.muted]),{items:R}=Ho({mutedRoomIds:S,enabled:s}),C=c.useMemo(()=>R.slice(0,Wo),[R]),A=s&&a&&!p&&!x&&!t&&e.length===0&&C.length>0,_=`${A}:${C.length}`,O=i.stamp===_?i.index:0,b=c.useCallback(w=>{f.current&&H(w.target)&&(m(!1),v(!1),r(!0))},[]),j=c.useCallback(w=>{H(w.target)&&r(!0)},[]),k=c.useCallback(w=>{H(w.target)&&r(!1)},[]),T=c.useCallback(w=>{C.length!==0&&d(z=>{const q=z.stamp===_?z.index:0;return{stamp:_,index:(q+w+C.length)%C.length}})},[C.length,_]),$=c.useCallback(()=>T(1),[T]),B=c.useCallback(()=>T(-1),[T]),K=c.useCallback(()=>{m(!0)},[]),F=c.useCallback(w=>{if(m(!0),w.kind==="session"){w.session.cwd&&Z.getState().recordOpened("agent",w.session.cwd),n(pe({dir:w.session.cwd??void 0,session:w.session.id}));return}Z.getState().recordOpened("room",w.room.id),n({...yt.channels(),search:{id:w.room.id}})},[n]),oe=c.useCallback(()=>{const w=C[O];!A||!w||F(w)},[A,C,O,F]);return{isOpen:A,hasRows:C.length>0,rows:C,agents:h,displayNames:y,visualOf:M,selectedIndex:O,activeDescendantId:A&&C[O]!==void 0?ke(O):void 0,listboxId:A?xn:void 0,handleFocus:b,handleBlur:k,handlePointerDown:j,moveDown:$,moveUp:B,selectHighlighted:oe,selectRow:F,dismiss:K}}function yn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:i,onSelect:d}){const p=c.useMemo(()=>Number.isNaN(Date.parse(o))?null:Ct(o),[o,i]);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}),p!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:p})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function qo({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const i=vt(t,e.session.cwd??s);return l.jsx(yn,{mark:l.jsx(kt,{color:i.color,emoji:i.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 Vo({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(yn,{mark:l.jsx(It,{room:e.room,participants:e.room.participants,visuals:Nt(t)}),label:l.jsx(wt,{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 Go({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=bt(6e4);return c.useEffect(()=>{var i,d;(d=(i=document.getElementById(ke(t)))==null?void 0:i.scrollIntoView)==null||d.call(i,{block:"nearest"})},[t]),l.jsx(Ve.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:i=>i.preventDefault(),children:l.jsx("div",{id:xn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((i,d)=>{var p;return i.kind==="session"?l.jsx(qo,{item:i,agent:i.session.cwd&&s[i.session.cwd]||null,displayName:i.session.cwd&&n[i.session.cwd]||((p=i.session.cwd)==null?void 0:p.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(i)},`session-${i.id}`):l.jsx(Vo,{item:i,visual:o(i.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(i)},`room-${i.id}`)})})})}function ka({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:Ke(e.id,t),i=Rt(r),{target:d}=Bt(),p=At(),m=St(r),x=c.useRef(null),v=Qe(e.members,e.viewerAuthorId),f=c.useRef(!1),u=zs({members:e.members,viewerAuthorId:e.viewerAuthorId,text:i}),g=c.useMemo(()=>e.kind==="channel"?eo(i,e.members):null,[e.kind,e.members,i]),I=n===!0,h=zo({value:i,yieldToPalette:u.isOpen,enabled:I}),y=c.useRef(m);c.useEffect(()=>{var b;m!==y.current&&(y.current=m,(b=x.current)==null||b.focus())},[m]),c.useEffect(()=>{var b;s===!0&&((b=x.current)==null||b.focusUnlessTouch())},[]);const N=c.useCallback(b=>Q.getState().set(r,b),[r]),[M,S]=c.useState(null);c.useLayoutEffect(()=>{var b;M!==null&&((b=x.current)==null||b.focusAt(M.pos))},[M]);const R=c.useCallback(b=>{b&&(N(b.value),S({pos:b.cursorPos}))},[N]),C=c.useCallback(b=>R(u.selectRow(b)),[u,R]),A=c.useCallback(()=>R(u.selectHighlighted()),[u,R]),_=()=>{if(d===null||!d.canSend||f.current)return;u.dismiss();const b=Q.getState().take(r).trim();if(b==="")return;const j=a.pendingFiles.length>0;j&&(f.current=!0),d.send({text:b}).catch(()=>{const k=Q.getState(),T=k.drafts[r]??"";k.set(r,T===""?b:`${b}
45
+ ${T}`)}).finally(()=>{j&&(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:Xe}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:p.isPending,onClick:()=>p.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>We.success(`You joined ${se(e)}`)}),children:Mt})]});const O=l.jsx(Ut.Composer,{inputRef:x,value:i,onChange:b=>{N(b),u.noteTextChange(b)},onSubmit:_,footer:g?l.jsx("p",{"data-slot":"cc-line",className:"text-muted-foreground px-3 pb-2 text-xs",children:g}):void 0,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:u.isOpen&&u.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Ae,{children:u.isOpen&&l.jsx(qs,{rows:u.rows,selectedIndex:u.selectedIndex,onSelect:C})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Ae,{children:h.isOpen&&l.jsx(Go,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:u.handleCursorChange,isStreaming:!1,isPaletteOpen:u.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:u.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:u.moveUp,onArrowDown:h.isOpen?h.moveDown:u.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:A,onEscape:h.isOpen?h.dismiss:u.dismiss,tabPicks:!h.isOpen,onClear:()=>{N(""),u.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:u.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:u.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!I&&o===void 0?O:l.jsx("section",{className:"flex flex-col","data-testid":jt.homeComposer,onFocus:b=>{h.handleFocus(b),H(b.target)&&(o==null||o(!0))},onBlur:b=>{h.handleBlur(b),H(b.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:O})}export{ha as A,ka as C,ye as I,ba as R,da as a,ya as b,js as c,ua as d,xa as e,ga as f,ma as g,_s as h,ps as i,la as j,Os as k,Es as l,Ts as m,fa as n,pa as o,H as p,fs as r,W as t,va as u};
@@ -1,6 +1,6 @@
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-OQuvRZTD.js";import{u as D}from"./use-update-config-L5NCTj3t.js";import{I as O}from"./inline-code-SYHTKcle.js";/**
1
+ import{O as m,a5 as x,aZ as k,r as v,j as t,B as d,G as p,dB as y}from"./index-YUtEyz7O.js";import{u as O}from"./use-update-config-Ce7sHmp2.js";import{I as R}from"./inline-code-BL-6EKVP.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 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};
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};
@@ -1,3 +1,3 @@
1
- import{j as J,r as T}from"./index-OQuvRZTD.js";import{R as lt}from"./index-BkJlIXqM.js";import{o as Q,E as B,q as ne,C as Ge,S as G,r as Ne,u as Fe,v as st,w as H,x as M,F as Ve,R as N,W as Y,G as oe,y as ot,z as at,A as je,B as Ie,H as ft,V as dt,m as ht,n as ct}from"./index-1QfQImuJ.js";class v{constructor(e,n,l,i){this.fromA=e,this.toA=n,this.fromB=l,this.toB=i}offset(e,n=e){return new v(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function y(t,e,n,l,i,r){if(t==l)return[];let s=fe(t,e,n,l,i,r),o=de(t,e+s,n,l,i+s,r);e+=s,n-=o,i+=s,r-=o;let f=n-e,h=r-i;if(!f||!h)return[new v(e,n,i,r)];if(f>h){let d=t.slice(e,n).indexOf(l.slice(i,r));if(d>-1)return[new v(e,e+d,i,i),new v(e+d+h,n,r,r)]}else if(h>f){let d=l.slice(i,r).indexOf(t.slice(e,n));if(d>-1)return[new v(e,e,i,i+d),new v(n,n,i+d+f,r)]}if(f==1||h==1)return[new v(e,n,i,r)];let a=He(t,e,n,l,i,r);if(a){let[d,c,u]=a;return y(t,e,d,l,i,c).concat(y(t,d+u,n,l,c+u,r))}return ut(t,e,n,l,i,r)}let I=1e9,U=0,ae=!1;function ut(t,e,n,l,i,r){let s=n-e,o=r-i;if(I<1e9&&Math.min(s,o)>I*16||U>0&&Date.now()>U)return Math.min(s,o)>I*64?[new v(e,n,i,r)]:ge(t,e,n,l,i,r);let f=Math.ceil((s+o)/2);ee.reset(f),te.reset(f);let h=(u,m)=>t.charCodeAt(e+u)==l.charCodeAt(i+m),a=(u,m)=>t.charCodeAt(n-u-1)==l.charCodeAt(r-m-1),d=(s-o)%2!=0?te:null,c=d?null:ee;for(let u=0;u<f;u++){if(u>I||U>0&&!(u&63)&&Date.now()>U)return ge(t,e,n,l,i,r);let m=ee.advance(u,s,o,f,d,!1,h)||te.advance(u,s,o,f,c,!0,a);if(m)return mt(t,e,n,e+m[0],l,i,r,i+m[1])}return[new v(e,n,i,r)]}class Ue{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,l,i,r,s,o){for(let f=-e+this.start;f<=e-this.end;f+=2){let h=i+f,a=f==-e||f!=e&&this.vec[h-1]<this.vec[h+1]?this.vec[h+1]:this.vec[h-1]+1,d=a-f;for(;a<n&&d<l&&o(a,d);)a++,d++;if(this.vec[h]=a,a>n)this.end+=2;else if(d>l)this.start+=2;else if(r){let c=i+(n-l)-f;if(c>=0&&c<this.len&&r.vec[c]!=-1)if(s){let u=r.vec[c];if(u>=n-a)return[u,i+u-c]}else{let u=n-r.vec[c];if(a>=u)return[a,d]}}}return null}}const ee=new Ue,te=new Ue;function mt(t,e,n,l,i,r,s,o){let f=!1;return!F(t,l)&&++l==n&&(f=!0),!F(i,o)&&++o==s&&(f=!0),f?[new v(e,n,r,s)]:y(t,e,l,i,r,o).concat(y(t,l,n,i,o,s))}function We(t,e){let n=1,l=Math.min(t,e);for(;n<l;)n=n<<1;return n}function fe(t,e,n,l,i,r){if(e==n||e==r||t.charCodeAt(e)!=l.charCodeAt(i))return 0;let s=We(n-e,r-i);for(let o=e,f=i;;){let h=o+s,a=f+s;if(h>n||a>r||t.slice(o,h)!=l.slice(f,a)){if(s==1)return o-e-(F(t,o)?0:1);s=s>>1}else{if(h==n||a==r)return h-e;o=h,f=a}}}function de(t,e,n,l,i,r){if(e==n||i==r||t.charCodeAt(n-1)!=l.charCodeAt(r-1))return 0;let s=We(n-e,r-i);for(let o=n,f=r;;){let h=o-s,a=f-s;if(h<e||a<i||t.slice(h,o)!=l.slice(a,f)){if(s==1)return n-o-(F(t,o)?0:1);s=s>>1}else{if(h==e||a==i)return n-h;o=h,f=a}}}function re(t,e,n,l,i,r,s,o){let f=l.slice(i,r),h=null;for(;;){if(h||s<o)return h;for(let a=e+s;;){F(t,a)||a++;let d=a+s;if(F(t,d)||(d+=d==a+1?1:-1),d>=n)break;let c=t.slice(a,d),u=-1;for(;(u=f.indexOf(c,u+1))!=-1;){let m=fe(t,d,n,l,i+u+c.length,r),p=de(t,e,a,l,i,i+u),g=c.length+m+p;(!h||h[2]<g)&&(h=[a-p,i+u-p,g])}a=d}if(o<0)return h;s=s>>1}}function He(t,e,n,l,i,r){let s=n-e,o=r-i;if(s<o){let f=He(l,i,r,t,e,n);return f&&[f[1],f[0],f[2]]}return s<4||o*2<s?null:re(t,e,n,l,i,r,Math.floor(s/4),-1)}function ge(t,e,n,l,i,r){ae=!0;let s=n-e,o=r-i,f;if(s<o){let c=re(l,i,r,t,e,n,Math.floor(s/6),50);f=c&&[c[1],c[0],c[2]]}else f=re(t,e,n,l,i,r,Math.floor(o/6),50);if(!f)return[new v(e,n,i,r)];let[h,a,d]=f;return y(t,e,h,l,i,a).concat(y(t,h+d,n,l,a+d,r))}function ze(t,e){for(let n=1;n<t.length;n++){let l=t[n-1],i=t[n];l.toA>i.fromA-e&&l.toB>i.fromB-e&&(t[n-1]=new v(l.fromA,i.toA,l.fromB,i.toB),t.splice(n--,1))}}function gt(t,e,n){for(;;){ze(n,1);let l=!1;for(let i=0;i<n.length;i++){let r=n[i],s,o;(s=fe(t,r.fromA,r.toA,e,r.fromB,r.toB))&&(r=n[i]=new v(r.fromA+s,r.toA,r.fromB+s,r.toB)),(o=de(t,r.fromA,r.toA,e,r.fromB,r.toB))&&(r=n[i]=new v(r.fromA,r.toA-o,r.fromB,r.toB-o));let f=r.toA-r.fromA,h=r.toB-r.fromB;if(f&&h)continue;let a=r.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:t.length)-r.toA;if(!a||!d)continue;let c=f?t.slice(r.fromA,r.toA):e.slice(r.fromB,r.toB);a<=c.length&&t.slice(r.fromA-a,r.fromA)==c.slice(c.length-a)?(n[i]=new v(r.fromA-a,r.toA-a,r.fromB-a,r.toB-a),l=!0):d<=c.length&&t.slice(r.toA,r.toA+d)==c.slice(0,d)&&(n[i]=new v(r.fromA+d,r.toA+d,r.fromB+d,r.toB+d),l=!0)}if(!l)break}return n}function pt(t,e,n){for(let l=0,i=0;i<t.length;i++){let r=t[i],s=r.toA-r.fromA,o=r.toB-r.fromB;if(s&&o||s>3||o>3){let f=i==t.length-1?e.length:t[i+1].fromA,h=r.fromA-l,a=f-r.toA,d=Ce(e,r.fromA,h),c=pe(e,r.toA,a),u=r.fromA-d,m=c-r.toA;if((!s||!o)&&u&&m){let p=Math.max(s,o),[g,C,S]=s?[e,r.fromA,r.toA]:[n,r.fromB,r.toB];p>u&&e.slice(d,r.fromA)==g.slice(S-u,S)?(r=t[i]=new v(d,d+s,r.fromB-u,r.toB-u),d=r.fromA,c=pe(e,r.toA,f-r.toA)):p>m&&e.slice(r.toA,c)==g.slice(C,C+m)&&(r=t[i]=new v(c-s,c,r.fromB+m,r.toB+m),c=r.toA,d=Ce(e,r.fromA,r.fromA-l)),u=r.fromA-d,m=c-r.toA}if(u||m)r=t[i]=new v(r.fromA-u,r.toA+m,r.fromB-u,r.toB+m);else if(s){if(!o){let p=Ae(e,r.fromA,r.toA),g,C=p<0?-1:ve(e,r.toA,r.fromA);p>-1&&(g=p-r.fromA)<=a&&e.slice(r.fromA,p)==e.slice(r.toA,r.toA+g)?r=t[i]=r.offset(g):C>-1&&(g=r.toA-C)<=h&&e.slice(r.fromA-g,r.fromA)==e.slice(C,r.toA)&&(r=t[i]=r.offset(-g))}}else{let p=Ae(n,r.fromB,r.toB),g,C=p<0?-1:ve(n,r.toB,r.fromB);p>-1&&(g=p-r.fromB)<=a&&n.slice(r.fromB,p)==n.slice(r.toB,r.toB+g)?r=t[i]=r.offset(g):C>-1&&(g=r.toB-C)<=h&&n.slice(r.fromB-g,r.fromB)==n.slice(C,r.toB)&&(r=t[i]=r.offset(-g))}}l=r.toA}return ze(t,3),t}let E;try{E=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Pe(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function qe(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?Pe(n)?1:0:E?!Je(n)||e==t.length-1?E.test(String.fromCharCode(n))?1:0:E.test(t.slice(e,e+2))?2:0:0}function _e(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?Pe(n)?1:0:E?!Ke(n)||e==1?E.test(String.fromCharCode(n))?1:0:E.test(t.slice(e-2,e))?2:0:0}const $e=8;function pe(t,e,n){if(e==t.length||!_e(t,e))return e;for(let l=e,i=e+n,r=0;r<$e;r++){let s=qe(t,l);if(!s||l+s>i)return l;l+=s}return e}function Ce(t,e,n){if(!e||!qe(t,e))return e;for(let l=e,i=e-n,r=0;r<$e;r++){let s=_e(t,l);if(!s||l-s<i)return l;l-=s}return e}function ve(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function Ae(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const Je=t=>t>=55296&&t<=56319,Ke=t=>t>=56320&&t<=57343;function F(t,e){return!e||e==t.length||!Je(t.charCodeAt(e-1))||!Ke(t.charCodeAt(e))}function Ct(t,e,n){var l;let i=n==null?void 0:n.override;return i?i(t,e):(I=((l=n==null?void 0:n.scanLimit)!==null&&l!==void 0?l:1e9)>>1,U=n!=null&&n.timeout?Date.now()+n.timeout:0,ae=!1,gt(t,e,y(t,0,t.length,e,0,e.length)))}function Qe(){return!ae}function Ye(t,e,n){return pt(Ct(t,e,n),t,e)}const b=Ve.define({combine:t=>t[0]}),ie=G.define(),Ze=Ve.define(),k=H.define({create(t){return null},update(t,e){for(let n of e.effects)n.is(ie)&&(t=n.value);for(let n of e.state.facet(Ze))t=n(t,e);return t}});function vt(t){let e=t.field(k,!1);if(!e)return null;let n=t.facet(b);return{chunks:e,side:n?n.side:null}}class O{constructor(e,n,l,i,r,s=!0){this.changes=e,this.fromA=n,this.toA=l,this.fromB=i,this.toB=r,this.precise=s}offset(e,n){return e||n?new O(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,l){let i=Ye(e.toString(),n.toString(),l);return Xe(i,e,n,0,0,Qe())}static updateA(e,n,l,i,r){return be(Be(e,i,!0,l.length),e,n,l,r)}static updateB(e,n,l,i,r){return be(Be(e,i,!1,n.length),e,n,l,r)}}function xe(t,e,n,l){let i=n.lineAt(t),r=l.lineAt(e);return i.to==t&&r.to==e&&t<n.length&&e<l.length?[t+1,e+1]:[i.from,r.from]}function we(t,e,n,l){let i=n.lineAt(t),r=l.lineAt(e);return i.from==t&&r.from==e?[t,e]:[i.to+1,r.to+1]}function Xe(t,e,n,l,i,r){let s=[];for(let o=0;o<t.length;o++){let f=t[o],[h,a]=xe(f.fromA+l,f.fromB+i,e,n),[d,c]=we(f.toA+l,f.toB+i,e,n),u=[f.offset(-h+l,-a+i)];for(;o<t.length-1;){let m=t[o+1],[p,g]=xe(m.fromA+l,m.fromB+i,e,n);if(p>d+1&&g>c+1)break;u.push(m.offset(-h+l,-a+i)),[d,c]=we(m.toA+l,m.toB+i,e,n),o++}s.push(new O(u,h,Math.max(h,d),a,Math.max(a,c),r))}return s}const z=1e3;function ke(t,e,n,l){let i=0,r=t.length;for(;;){if(i==r){let a=0,d=0;i&&({toA:a,toB:d}=t[i-1]);let c=e-(n?a:d);return[a+c,d+c]}let s=i+r>>1,o=t[s],[f,h]=n?[o.fromA,o.toA]:[o.fromB,o.toB];if(f>e)r=s;else if(h<=e)i=s+1;else return l?[o.fromA,o.fromB]:[o.toA,o.toB]}}function Be(t,e,n,l){let i=[];return e.iterChangedRanges((r,s,o,f)=>{let h=0,a=n?e.length:l,d=0,c=n?l:e.length;r>z&&([h,d]=ke(t,r-z,n,!0)),s<e.length-z&&([a,c]=ke(t,s+z,n,!1));let u=f-o-(s-r),m,[p,g]=n?[u,0]:[0,u];i.length&&(m=i[i.length-1]).toA>=h?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:a,toB:c,diffA:m.diffA+p,diffB:m.diffB+g}:i.push({fromA:h,toA:a,fromB:d,toB:c,diffA:p,diffB:g})}),i}function be(t,e,n,l,i){if(!t.length)return e;let r=[];for(let s=0,o=0,f=0,h=0;;s++){let a=s==t.length?null:t[s],d=a?a.fromA+o:n.length,c=a?a.fromB+f:l.length;for(;h<e.length;){let g=e[h];if(a&&(g.toA+o>d||g.toB+f>c))break;r.push(g.offset(o,f)),h++}if(!a)break;let u=a.toA+o+a.diffA,m=a.toB+f+a.diffB,p=Ye(n.sliceString(d,u),l.sliceString(c,m),i);for(let g of Xe(p,n,l,d,c,Qe()))r.push(g);for(o+=a.diffA,f+=a.diffB;h<e.length;){let g=e[h];if(g.fromA+o>u&&g.fromB+f>m)break;h++}}return r}const et={scanLimit:500},Z=dt.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=Le(t))}update(t){(t.docChanged||t.viewportChanged||At(t.startState,t.state)||xt(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=Le(t.view))}},{decorations:t=>t.deco}),P=Q.low(je({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Z))===null||e===void 0?void 0:e.gutter)||Ie.empty}}));function At(t,e){return t.field(k,!1)!=e.field(k,!1)}function xt(t,e){return t.facet(b)!=e.facet(b)}const Me=M.line({class:"cm-changedLine"}),tt=M.mark({class:"cm-changedText"}),wt=M.mark({tagName:"ins",class:"cm-insertedLine"}),kt=M.mark({tagName:"del",class:"cm-deletedLine"}),De=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Bt(t,e,n,l,i,r){let s=n?t.fromA:t.fromB,o=n?t.toA:t.toB,f=0;if(s!=o){i.add(s,s,Me),i.add(s,o,n?kt:wt),r&&r.add(s,s,De);for(let h=e.iterRange(s,o-1),a=s;!h.next().done;){if(h.lineBreak){a++,i.add(a,a,Me),r&&r.add(a,a,De);continue}let d=a+h.value.length;if(l)for(;f<t.changes.length;){let c=t.changes[f],u=s+(n?c.fromA:c.fromB),m=s+(n?c.toA:c.toB),p=Math.max(a,u),g=Math.min(d,m);if(p<g&&i.add(p,g,tt),m<d)f++;else break}a=d}}}function Le(t){let e=t.state.field(k),{side:n,highlightChanges:l,markGutter:i,overrideChunk:r}=t.state.facet(b),s=n=="a",o=new N,f=i?new N:null,{from:h,to:a}=t.viewport;for(let d of e){if((s?d.fromA:d.fromB)>=a)break;(s?d.toA:d.toB)>h&&(!r||!r(t.state,d,o,f))&&Bt(d,t.state.doc,s,l,o,f)}return{deco:o.finish(),gutter:f&&f.finish()}}class q extends Y{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const K=G.define({map:(t,e)=>t.map(e)}),W=H.define({create:()=>M.none,update:(t,e)=>{for(let n of e.effects)if(n.is(K))return n.value;return t.map(e.changes)},provide:t=>B.decorations.from(t)}),_=.01;function Se(t,e){if(t.size!=e.size)return!1;let n=t.iter(),l=e.iter();for(;n.value;){if(n.from!=l.from||Math.abs(n.value.spec.widget.height-l.value.spec.widget.height)>1)return!1;n.next(),l.next()}return!0}function bt(t,e,n){let l=new N,i=new N,r=t.state.field(W).iter(),s=e.state.field(W).iter(),o=0,f=0,h=0,a=0,d=t.viewport,c=e.viewport;for(let g=0;;g++){let C=g<n.length?n[g]:null,S=C?C.fromA:t.state.doc.length,R=C?C.fromB:e.state.doc.length;if(o<S){let x=t.lineBlockAt(o).top+h,D=e.lineBlockAt(f).top+a,w=x-D;w<-_?(h-=w,l.add(o,o,M.widget({widget:new q(-w),block:!0,side:-1}))):w>_&&(a+=w,i.add(f,f,M.widget({widget:new q(w),block:!0,side:-1})))}if(S>o+1e3&&o<d.from&&S>d.from&&f<c.from&&R>c.from){let x=Math.min(d.from-o,c.from-f);o+=x,f+=x,g--}else if(C)o=C.toA,f=C.toB;else break;for(;r.value&&r.from<o;)h-=r.value.spec.widget.height,r.next();for(;s.value&&s.from<f;)a-=s.value.spec.widget.height,s.next()}for(;r.value;)h-=r.value.spec.widget.height,r.next();for(;s.value;)a-=s.value.spec.widget.height,s.next();let u=t.contentHeight+h-(e.contentHeight+a);u<_?l.add(t.state.doc.length,t.state.doc.length,M.widget({widget:new q(-u),block:!0,side:1})):u>_&&i.add(e.state.doc.length,e.state.doc.length,M.widget({widget:new q(u),block:!0,side:1}));let m=l.finish(),p=i.finish();Se(m,t.state.field(W))||t.dispatch({effects:K.of(m)}),Se(p,e.state.field(W))||e.dispatch({effects:K.of(p)})}const le=G.define({map:(t,e)=>e.mapPos(t)});class Mt extends Y{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",l=>{let i=e.posAtDOM(l.target);e.dispatch({effects:le.of(i)});let{side:r,sibling:s}=e.state.facet(b);s&&s().dispatch({effects:le.of(Dt(i,e.state.field(k),r=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Dt(t,e,n){let l=0,i=0;for(let r=0;;r++){let s=r<e.length?e[r]:null;if(!s||(n?s.fromA:s.fromB)>=t)return i+(t-l);[l,i]=n?[s.toA,s.toB]:[s.toB,s.toA]}}const Lt=H.define({create(t){return M.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(le)&&(t=t.update({filter:l=>l!=n.value}));if(t.size&&e.state.field(k)!=e.startState.field(k,!1)){let n=e.state.facet(b).side=="a",l=[];for(let i of e.state.field(k))t.between(n?i.fromA:i.fromB,n?i.toA:i.toB,r=>{l.push(r)});l.length&&(t=t.update({filter:i=>l.indexOf(i)<0}))}return t},provide:t=>B.decorations.from(t)});function se({margin:t=3,minSize:e=4}){return Lt.init(n=>St(n,t,e))}function St(t,e,n){let l=new N,i=t.facet(b).side=="a",r=t.field(k),s=1;for(let o=0;;o++){let f=o<r.length?r[o]:null,h=o?s+e:1,a=f?t.doc.lineAt(i?f.fromA:f.fromB).number-1-e:t.doc.lines,d=a-h+1;if(d>=n&&l.add(t.doc.line(h).from,t.doc.line(a).to,M.replace({widget:new Mt(d),block:!0})),!f)break;s=t.doc.lineAt(Math.min(t.doc.length,i?f.toA:f.toB)).number}return l.finish()}const Ot=B.styleModule.of(new st({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),nt=B.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Oe=new Ge,$=new Ge;class Et{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||et;let n=[Q.low(Z),nt,Ot,W,B.updateListener.of(d=>{this.measuring<0&&(d.heightChanged||d.viewportChanged)&&!d.transactions.some(c=>c.effects.some(u=>u.is(K)))&&this.measure()})],l=[b.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&l.push(P);let i=ne.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],B.editorAttributes.of({class:"cm-merge-a"}),$.of(l),n]}),r=[b.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&r.push(P);let s=ne.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],B.editorAttributes.of({class:"cm-merge-b"}),$.of(r),n]});this.chunks=O.build(i.doc,s.doc,this.diffConf);let o=[k.init(()=>this.chunks),Oe.of(e.collapseUnchanged?se(e.collapseUnchanged):[])];i=i.update({effects:G.appendConfig.of(o)}).state,s=s.update({effects:G.appendConfig.of(o)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let f=e.orientation||"a-b",h=document.createElement("div");h.className="cm-mergeViewEditor";let a=document.createElement("div");a.className="cm-mergeViewEditor",this.editorDOM.appendChild(f=="a-b"?h:a),this.editorDOM.appendChild(f=="a-b"?a:h),this.a=new B({state:i,parent:h,root:e.root,dispatchTransactions:d=>this.dispatch(d,this.a)}),this.b=new B({state:s,parent:a,root:e.root,dispatchTransactions:d=>this.dispatch(d,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(l=>l.docChanged)){let l=e[e.length-1],i=e.reduce((s,o)=>s.compose(o.changes),Ne.empty(e[0].startState.doc.length));this.chunks=n==this.a?O.updateA(this.chunks,l.newDoc,this.b.state.doc,i,this.diffConf):O.updateB(this.chunks,this.a.state.doc,l.newDoc,i,this.diffConf),n.update([...e,l.state.update({effects:ie.of(this.chunks)})]);let r=n==this.a?this.b:this.a;r.update([r.state.update({effects:ie.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let r=e.orientation!="b-a";if(r!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let s=this.a.dom.parentNode,o=this.b.dom.parentNode;s.remove(),o.remove(),this.editorDOM.insertBefore(r?s:o,this.editorDOM.firstChild),this.editorDOM.appendChild(r?o:s),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let r=!!this.revertDOM,s=this.revertToA,o=this.renderRevert;"revertControls"in e&&(r=!!e.revertControls,s=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(r,s,o)}let n="highlightChanges"in e,l="gutter"in e,i="collapseUnchanged"in e;if(n||l||i){let r=[],s=[];if(n||l){let o=this.a.state.facet(b),f=l?e.gutter!==!1:o.markGutter,h=n?e.highlightChanges!==!1:o.highlightChanges;r.push($.reconfigure([b.of({side:"a",sibling:()=>this.b,highlightChanges:h,markGutter:f}),f?P:[]])),s.push($.reconfigure([b.of({side:"b",sibling:()=>this.a,highlightChanges:h,markGutter:f}),f?P:[]]))}if(i){let o=Oe.reconfigure(e.collapseUnchanged?se(e.collapseUnchanged):[]);r.push(o),s.push(o)}this.a.dispatch({effects:r}),this.b.dispatch({effects:s})}this.scheduleMeasure()}setupRevertControls(e,n,l){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=l,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",i=>this.revertClicked(i)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){bt(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,l=this.a.viewport,i=this.b.viewport;for(let r=0;r<this.chunks.length;r++){let s=this.chunks[r];if(s.fromA>l.to||s.fromB>i.to)break;if(s.fromA<l.from||s.fromB<i.from)continue;let o=this.a.lineBlockAt(s.fromA).top+"px";for(;n&&+n.dataset.chunk<r;)n=Ee(n);n&&n.dataset.chunk==String(r)?(n.style.top!=o&&(n.style.top=o),n=n.nextSibling):e.insertBefore(this.renderRevertButton(o,r),n)}for(;n;)n=Ee(n)}renderRevertButton(e,n){let l;if(this.renderRevert)l=this.renderRevert();else{l=document.createElement("button");let i=this.a.state.phrase("Revert this chunk");l.setAttribute("aria-label",i),l.setAttribute("title",i),l.textContent=this.revertToLeft?"⇜":"⇝"}return l.style.top=e,l.setAttribute("data-chunk",String(n)),l}revertClicked(e){let n=e.target,l;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(l=this.chunks[n.dataset.chunk])){let[i,r,s,o,f,h]=this.revertToA?[this.b,this.a,l.fromB,l.toB,l.fromA,l.toA]:[this.a,this.b,l.fromA,l.toA,l.fromB,l.toB],a=i.state.sliceDoc(s,Math.max(s,o-1));s!=o&&h<=r.state.doc.length&&(a+=i.state.lineBreak),r.dispatch({changes:{from:f,to:Math.min(r.state.doc.length,h),insert:a},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function Ee(t){let e=t.nextSibling;return t.remove(),e}const yt=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},Rt=Q.low(je({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Z))===null||e===void 0?void 0:e.gutter)||Ie.empty},widgetMarker:(t,e)=>e instanceof rt?yt:null}));function Tt(t){var e;let n=typeof t.original=="string"?Fe.of(t.original.split(/\r?\n/)):t.original,l=t.diffConfig||et;return[Q.low(Z),Vt,nt,B.editorAttributes.of({class:"cm-merge-b"}),Ze.of((i,r)=>{let s=r.effects.find(o=>o.is(he));return s&&(i=O.updateA(i,s.value.doc,r.startState.doc,s.value.changes,l)),r.docChanged&&(i=O.updateB(i,r.state.field(V),r.newDoc,r.changes,l)),i}),b.of({highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1,syntaxHighlightDeletions:t.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(e=t.mergeControls)!==null&&e!==void 0?e:!0,overrideChunk:t.allowInlineDiffs?Wt:void 0,side:"b"}),V.init(()=>n),t.gutter!==!1?Rt:[],t.collapseUnchanged?se(t.collapseUnchanged):[],k.init(i=>O.build(n,i.doc,l))]}const he=G.define(),V=H.define({create:()=>Fe.empty,update(t,e){for(let n of e.effects)n.is(he)&&(t=n.value.doc);return t}}),ye=new WeakMap;class rt extends Y{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||(this.dom=this.buildDOM(e))}}function Gt(t,e,n){let l=ye.get(e.changes);if(l)return l;let i=s=>{let{highlightChanges:o,syntaxHighlightDeletions:f,syntaxHighlightDeletionsMaxLength:h,mergeControls:a}=t.facet(b),d=document.createElement("div");if(d.className="cm-deletedChunk",a){let x=d.appendChild(document.createElement("div"));x.className="cm-chunkButtons";let D=A=>{A.preventDefault(),Nt(s,s.posAtDOM(d))},w=A=>{A.preventDefault(),Ft(s,s.posAtDOM(d))};if(typeof a=="function")x.appendChild(a("accept",D)),x.appendChild(a("reject",w));else{let A=x.appendChild(document.createElement("button"));A.name="accept",A.textContent=t.phrase("Accept"),A.onmousedown=D;let L=x.appendChild(document.createElement("button"));L.name="reject",L.textContent=t.phrase("Reject"),L.onmousedown=w}}if(n||e.fromA>=e.toA)return d;let c=s.state.field(V).sliceString(e.fromA,e.endA),u=f&&t.facet(ot),m=S(),p=e.changes,g=0,C=!1;function S(){let x=d.appendChild(document.createElement("div"));return x.className="cm-deletedLine",x.appendChild(document.createElement("del"))}function R(x,D,w){for(let A=x;A<D;){if(c.charAt(A)==`
1
+ import{j as J,r as T}from"./index-YUtEyz7O.js";import{R as lt}from"./index-oc-yQ5Q4.js";import{o as Q,E as B,q as ne,C as Ge,S as G,r as Ne,u as Fe,v as st,w as H,x as M,F as Ve,R as N,W as Y,G as oe,y as ot,z as at,A as je,B as Ie,H as ft,V as dt,m as ht,n as ct}from"./index-CLTrC-a-.js";class v{constructor(e,n,l,i){this.fromA=e,this.toA=n,this.fromB=l,this.toB=i}offset(e,n=e){return new v(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function y(t,e,n,l,i,r){if(t==l)return[];let s=fe(t,e,n,l,i,r),o=de(t,e+s,n,l,i+s,r);e+=s,n-=o,i+=s,r-=o;let f=n-e,h=r-i;if(!f||!h)return[new v(e,n,i,r)];if(f>h){let d=t.slice(e,n).indexOf(l.slice(i,r));if(d>-1)return[new v(e,e+d,i,i),new v(e+d+h,n,r,r)]}else if(h>f){let d=l.slice(i,r).indexOf(t.slice(e,n));if(d>-1)return[new v(e,e,i,i+d),new v(n,n,i+d+f,r)]}if(f==1||h==1)return[new v(e,n,i,r)];let a=He(t,e,n,l,i,r);if(a){let[d,c,u]=a;return y(t,e,d,l,i,c).concat(y(t,d+u,n,l,c+u,r))}return ut(t,e,n,l,i,r)}let I=1e9,U=0,ae=!1;function ut(t,e,n,l,i,r){let s=n-e,o=r-i;if(I<1e9&&Math.min(s,o)>I*16||U>0&&Date.now()>U)return Math.min(s,o)>I*64?[new v(e,n,i,r)]:ge(t,e,n,l,i,r);let f=Math.ceil((s+o)/2);ee.reset(f),te.reset(f);let h=(u,m)=>t.charCodeAt(e+u)==l.charCodeAt(i+m),a=(u,m)=>t.charCodeAt(n-u-1)==l.charCodeAt(r-m-1),d=(s-o)%2!=0?te:null,c=d?null:ee;for(let u=0;u<f;u++){if(u>I||U>0&&!(u&63)&&Date.now()>U)return ge(t,e,n,l,i,r);let m=ee.advance(u,s,o,f,d,!1,h)||te.advance(u,s,o,f,c,!0,a);if(m)return mt(t,e,n,e+m[0],l,i,r,i+m[1])}return[new v(e,n,i,r)]}class Ue{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,l,i,r,s,o){for(let f=-e+this.start;f<=e-this.end;f+=2){let h=i+f,a=f==-e||f!=e&&this.vec[h-1]<this.vec[h+1]?this.vec[h+1]:this.vec[h-1]+1,d=a-f;for(;a<n&&d<l&&o(a,d);)a++,d++;if(this.vec[h]=a,a>n)this.end+=2;else if(d>l)this.start+=2;else if(r){let c=i+(n-l)-f;if(c>=0&&c<this.len&&r.vec[c]!=-1)if(s){let u=r.vec[c];if(u>=n-a)return[u,i+u-c]}else{let u=n-r.vec[c];if(a>=u)return[a,d]}}}return null}}const ee=new Ue,te=new Ue;function mt(t,e,n,l,i,r,s,o){let f=!1;return!F(t,l)&&++l==n&&(f=!0),!F(i,o)&&++o==s&&(f=!0),f?[new v(e,n,r,s)]:y(t,e,l,i,r,o).concat(y(t,l,n,i,o,s))}function We(t,e){let n=1,l=Math.min(t,e);for(;n<l;)n=n<<1;return n}function fe(t,e,n,l,i,r){if(e==n||e==r||t.charCodeAt(e)!=l.charCodeAt(i))return 0;let s=We(n-e,r-i);for(let o=e,f=i;;){let h=o+s,a=f+s;if(h>n||a>r||t.slice(o,h)!=l.slice(f,a)){if(s==1)return o-e-(F(t,o)?0:1);s=s>>1}else{if(h==n||a==r)return h-e;o=h,f=a}}}function de(t,e,n,l,i,r){if(e==n||i==r||t.charCodeAt(n-1)!=l.charCodeAt(r-1))return 0;let s=We(n-e,r-i);for(let o=n,f=r;;){let h=o-s,a=f-s;if(h<e||a<i||t.slice(h,o)!=l.slice(a,f)){if(s==1)return n-o-(F(t,o)?0:1);s=s>>1}else{if(h==e||a==i)return n-h;o=h,f=a}}}function re(t,e,n,l,i,r,s,o){let f=l.slice(i,r),h=null;for(;;){if(h||s<o)return h;for(let a=e+s;;){F(t,a)||a++;let d=a+s;if(F(t,d)||(d+=d==a+1?1:-1),d>=n)break;let c=t.slice(a,d),u=-1;for(;(u=f.indexOf(c,u+1))!=-1;){let m=fe(t,d,n,l,i+u+c.length,r),p=de(t,e,a,l,i,i+u),g=c.length+m+p;(!h||h[2]<g)&&(h=[a-p,i+u-p,g])}a=d}if(o<0)return h;s=s>>1}}function He(t,e,n,l,i,r){let s=n-e,o=r-i;if(s<o){let f=He(l,i,r,t,e,n);return f&&[f[1],f[0],f[2]]}return s<4||o*2<s?null:re(t,e,n,l,i,r,Math.floor(s/4),-1)}function ge(t,e,n,l,i,r){ae=!0;let s=n-e,o=r-i,f;if(s<o){let c=re(l,i,r,t,e,n,Math.floor(s/6),50);f=c&&[c[1],c[0],c[2]]}else f=re(t,e,n,l,i,r,Math.floor(o/6),50);if(!f)return[new v(e,n,i,r)];let[h,a,d]=f;return y(t,e,h,l,i,a).concat(y(t,h+d,n,l,a+d,r))}function ze(t,e){for(let n=1;n<t.length;n++){let l=t[n-1],i=t[n];l.toA>i.fromA-e&&l.toB>i.fromB-e&&(t[n-1]=new v(l.fromA,i.toA,l.fromB,i.toB),t.splice(n--,1))}}function gt(t,e,n){for(;;){ze(n,1);let l=!1;for(let i=0;i<n.length;i++){let r=n[i],s,o;(s=fe(t,r.fromA,r.toA,e,r.fromB,r.toB))&&(r=n[i]=new v(r.fromA+s,r.toA,r.fromB+s,r.toB)),(o=de(t,r.fromA,r.toA,e,r.fromB,r.toB))&&(r=n[i]=new v(r.fromA,r.toA-o,r.fromB,r.toB-o));let f=r.toA-r.fromA,h=r.toB-r.fromB;if(f&&h)continue;let a=r.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:t.length)-r.toA;if(!a||!d)continue;let c=f?t.slice(r.fromA,r.toA):e.slice(r.fromB,r.toB);a<=c.length&&t.slice(r.fromA-a,r.fromA)==c.slice(c.length-a)?(n[i]=new v(r.fromA-a,r.toA-a,r.fromB-a,r.toB-a),l=!0):d<=c.length&&t.slice(r.toA,r.toA+d)==c.slice(0,d)&&(n[i]=new v(r.fromA+d,r.toA+d,r.fromB+d,r.toB+d),l=!0)}if(!l)break}return n}function pt(t,e,n){for(let l=0,i=0;i<t.length;i++){let r=t[i],s=r.toA-r.fromA,o=r.toB-r.fromB;if(s&&o||s>3||o>3){let f=i==t.length-1?e.length:t[i+1].fromA,h=r.fromA-l,a=f-r.toA,d=Ce(e,r.fromA,h),c=pe(e,r.toA,a),u=r.fromA-d,m=c-r.toA;if((!s||!o)&&u&&m){let p=Math.max(s,o),[g,C,S]=s?[e,r.fromA,r.toA]:[n,r.fromB,r.toB];p>u&&e.slice(d,r.fromA)==g.slice(S-u,S)?(r=t[i]=new v(d,d+s,r.fromB-u,r.toB-u),d=r.fromA,c=pe(e,r.toA,f-r.toA)):p>m&&e.slice(r.toA,c)==g.slice(C,C+m)&&(r=t[i]=new v(c-s,c,r.fromB+m,r.toB+m),c=r.toA,d=Ce(e,r.fromA,r.fromA-l)),u=r.fromA-d,m=c-r.toA}if(u||m)r=t[i]=new v(r.fromA-u,r.toA+m,r.fromB-u,r.toB+m);else if(s){if(!o){let p=Ae(e,r.fromA,r.toA),g,C=p<0?-1:ve(e,r.toA,r.fromA);p>-1&&(g=p-r.fromA)<=a&&e.slice(r.fromA,p)==e.slice(r.toA,r.toA+g)?r=t[i]=r.offset(g):C>-1&&(g=r.toA-C)<=h&&e.slice(r.fromA-g,r.fromA)==e.slice(C,r.toA)&&(r=t[i]=r.offset(-g))}}else{let p=Ae(n,r.fromB,r.toB),g,C=p<0?-1:ve(n,r.toB,r.fromB);p>-1&&(g=p-r.fromB)<=a&&n.slice(r.fromB,p)==n.slice(r.toB,r.toB+g)?r=t[i]=r.offset(g):C>-1&&(g=r.toB-C)<=h&&n.slice(r.fromB-g,r.fromB)==n.slice(C,r.toB)&&(r=t[i]=r.offset(-g))}}l=r.toA}return ze(t,3),t}let E;try{E=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Pe(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function qe(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?Pe(n)?1:0:E?!Je(n)||e==t.length-1?E.test(String.fromCharCode(n))?1:0:E.test(t.slice(e,e+2))?2:0:0}function _e(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?Pe(n)?1:0:E?!Ke(n)||e==1?E.test(String.fromCharCode(n))?1:0:E.test(t.slice(e-2,e))?2:0:0}const $e=8;function pe(t,e,n){if(e==t.length||!_e(t,e))return e;for(let l=e,i=e+n,r=0;r<$e;r++){let s=qe(t,l);if(!s||l+s>i)return l;l+=s}return e}function Ce(t,e,n){if(!e||!qe(t,e))return e;for(let l=e,i=e-n,r=0;r<$e;r++){let s=_e(t,l);if(!s||l-s<i)return l;l-=s}return e}function ve(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function Ae(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const Je=t=>t>=55296&&t<=56319,Ke=t=>t>=56320&&t<=57343;function F(t,e){return!e||e==t.length||!Je(t.charCodeAt(e-1))||!Ke(t.charCodeAt(e))}function Ct(t,e,n){var l;let i=n==null?void 0:n.override;return i?i(t,e):(I=((l=n==null?void 0:n.scanLimit)!==null&&l!==void 0?l:1e9)>>1,U=n!=null&&n.timeout?Date.now()+n.timeout:0,ae=!1,gt(t,e,y(t,0,t.length,e,0,e.length)))}function Qe(){return!ae}function Ye(t,e,n){return pt(Ct(t,e,n),t,e)}const b=Ve.define({combine:t=>t[0]}),ie=G.define(),Ze=Ve.define(),k=H.define({create(t){return null},update(t,e){for(let n of e.effects)n.is(ie)&&(t=n.value);for(let n of e.state.facet(Ze))t=n(t,e);return t}});function vt(t){let e=t.field(k,!1);if(!e)return null;let n=t.facet(b);return{chunks:e,side:n?n.side:null}}class O{constructor(e,n,l,i,r,s=!0){this.changes=e,this.fromA=n,this.toA=l,this.fromB=i,this.toB=r,this.precise=s}offset(e,n){return e||n?new O(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,l){let i=Ye(e.toString(),n.toString(),l);return Xe(i,e,n,0,0,Qe())}static updateA(e,n,l,i,r){return be(Be(e,i,!0,l.length),e,n,l,r)}static updateB(e,n,l,i,r){return be(Be(e,i,!1,n.length),e,n,l,r)}}function xe(t,e,n,l){let i=n.lineAt(t),r=l.lineAt(e);return i.to==t&&r.to==e&&t<n.length&&e<l.length?[t+1,e+1]:[i.from,r.from]}function we(t,e,n,l){let i=n.lineAt(t),r=l.lineAt(e);return i.from==t&&r.from==e?[t,e]:[i.to+1,r.to+1]}function Xe(t,e,n,l,i,r){let s=[];for(let o=0;o<t.length;o++){let f=t[o],[h,a]=xe(f.fromA+l,f.fromB+i,e,n),[d,c]=we(f.toA+l,f.toB+i,e,n),u=[f.offset(-h+l,-a+i)];for(;o<t.length-1;){let m=t[o+1],[p,g]=xe(m.fromA+l,m.fromB+i,e,n);if(p>d+1&&g>c+1)break;u.push(m.offset(-h+l,-a+i)),[d,c]=we(m.toA+l,m.toB+i,e,n),o++}s.push(new O(u,h,Math.max(h,d),a,Math.max(a,c),r))}return s}const z=1e3;function ke(t,e,n,l){let i=0,r=t.length;for(;;){if(i==r){let a=0,d=0;i&&({toA:a,toB:d}=t[i-1]);let c=e-(n?a:d);return[a+c,d+c]}let s=i+r>>1,o=t[s],[f,h]=n?[o.fromA,o.toA]:[o.fromB,o.toB];if(f>e)r=s;else if(h<=e)i=s+1;else return l?[o.fromA,o.fromB]:[o.toA,o.toB]}}function Be(t,e,n,l){let i=[];return e.iterChangedRanges((r,s,o,f)=>{let h=0,a=n?e.length:l,d=0,c=n?l:e.length;r>z&&([h,d]=ke(t,r-z,n,!0)),s<e.length-z&&([a,c]=ke(t,s+z,n,!1));let u=f-o-(s-r),m,[p,g]=n?[u,0]:[0,u];i.length&&(m=i[i.length-1]).toA>=h?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:a,toB:c,diffA:m.diffA+p,diffB:m.diffB+g}:i.push({fromA:h,toA:a,fromB:d,toB:c,diffA:p,diffB:g})}),i}function be(t,e,n,l,i){if(!t.length)return e;let r=[];for(let s=0,o=0,f=0,h=0;;s++){let a=s==t.length?null:t[s],d=a?a.fromA+o:n.length,c=a?a.fromB+f:l.length;for(;h<e.length;){let g=e[h];if(a&&(g.toA+o>d||g.toB+f>c))break;r.push(g.offset(o,f)),h++}if(!a)break;let u=a.toA+o+a.diffA,m=a.toB+f+a.diffB,p=Ye(n.sliceString(d,u),l.sliceString(c,m),i);for(let g of Xe(p,n,l,d,c,Qe()))r.push(g);for(o+=a.diffA,f+=a.diffB;h<e.length;){let g=e[h];if(g.fromA+o>u&&g.fromB+f>m)break;h++}}return r}const et={scanLimit:500},Z=dt.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=Le(t))}update(t){(t.docChanged||t.viewportChanged||At(t.startState,t.state)||xt(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=Le(t.view))}},{decorations:t=>t.deco}),P=Q.low(je({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Z))===null||e===void 0?void 0:e.gutter)||Ie.empty}}));function At(t,e){return t.field(k,!1)!=e.field(k,!1)}function xt(t,e){return t.facet(b)!=e.facet(b)}const Me=M.line({class:"cm-changedLine"}),tt=M.mark({class:"cm-changedText"}),wt=M.mark({tagName:"ins",class:"cm-insertedLine"}),kt=M.mark({tagName:"del",class:"cm-deletedLine"}),De=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Bt(t,e,n,l,i,r){let s=n?t.fromA:t.fromB,o=n?t.toA:t.toB,f=0;if(s!=o){i.add(s,s,Me),i.add(s,o,n?kt:wt),r&&r.add(s,s,De);for(let h=e.iterRange(s,o-1),a=s;!h.next().done;){if(h.lineBreak){a++,i.add(a,a,Me),r&&r.add(a,a,De);continue}let d=a+h.value.length;if(l)for(;f<t.changes.length;){let c=t.changes[f],u=s+(n?c.fromA:c.fromB),m=s+(n?c.toA:c.toB),p=Math.max(a,u),g=Math.min(d,m);if(p<g&&i.add(p,g,tt),m<d)f++;else break}a=d}}}function Le(t){let e=t.state.field(k),{side:n,highlightChanges:l,markGutter:i,overrideChunk:r}=t.state.facet(b),s=n=="a",o=new N,f=i?new N:null,{from:h,to:a}=t.viewport;for(let d of e){if((s?d.fromA:d.fromB)>=a)break;(s?d.toA:d.toB)>h&&(!r||!r(t.state,d,o,f))&&Bt(d,t.state.doc,s,l,o,f)}return{deco:o.finish(),gutter:f&&f.finish()}}class q extends Y{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const K=G.define({map:(t,e)=>t.map(e)}),W=H.define({create:()=>M.none,update:(t,e)=>{for(let n of e.effects)if(n.is(K))return n.value;return t.map(e.changes)},provide:t=>B.decorations.from(t)}),_=.01;function Se(t,e){if(t.size!=e.size)return!1;let n=t.iter(),l=e.iter();for(;n.value;){if(n.from!=l.from||Math.abs(n.value.spec.widget.height-l.value.spec.widget.height)>1)return!1;n.next(),l.next()}return!0}function bt(t,e,n){let l=new N,i=new N,r=t.state.field(W).iter(),s=e.state.field(W).iter(),o=0,f=0,h=0,a=0,d=t.viewport,c=e.viewport;for(let g=0;;g++){let C=g<n.length?n[g]:null,S=C?C.fromA:t.state.doc.length,R=C?C.fromB:e.state.doc.length;if(o<S){let x=t.lineBlockAt(o).top+h,D=e.lineBlockAt(f).top+a,w=x-D;w<-_?(h-=w,l.add(o,o,M.widget({widget:new q(-w),block:!0,side:-1}))):w>_&&(a+=w,i.add(f,f,M.widget({widget:new q(w),block:!0,side:-1})))}if(S>o+1e3&&o<d.from&&S>d.from&&f<c.from&&R>c.from){let x=Math.min(d.from-o,c.from-f);o+=x,f+=x,g--}else if(C)o=C.toA,f=C.toB;else break;for(;r.value&&r.from<o;)h-=r.value.spec.widget.height,r.next();for(;s.value&&s.from<f;)a-=s.value.spec.widget.height,s.next()}for(;r.value;)h-=r.value.spec.widget.height,r.next();for(;s.value;)a-=s.value.spec.widget.height,s.next();let u=t.contentHeight+h-(e.contentHeight+a);u<_?l.add(t.state.doc.length,t.state.doc.length,M.widget({widget:new q(-u),block:!0,side:1})):u>_&&i.add(e.state.doc.length,e.state.doc.length,M.widget({widget:new q(u),block:!0,side:1}));let m=l.finish(),p=i.finish();Se(m,t.state.field(W))||t.dispatch({effects:K.of(m)}),Se(p,e.state.field(W))||e.dispatch({effects:K.of(p)})}const le=G.define({map:(t,e)=>e.mapPos(t)});class Mt extends Y{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",l=>{let i=e.posAtDOM(l.target);e.dispatch({effects:le.of(i)});let{side:r,sibling:s}=e.state.facet(b);s&&s().dispatch({effects:le.of(Dt(i,e.state.field(k),r=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Dt(t,e,n){let l=0,i=0;for(let r=0;;r++){let s=r<e.length?e[r]:null;if(!s||(n?s.fromA:s.fromB)>=t)return i+(t-l);[l,i]=n?[s.toA,s.toB]:[s.toB,s.toA]}}const Lt=H.define({create(t){return M.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(le)&&(t=t.update({filter:l=>l!=n.value}));if(t.size&&e.state.field(k)!=e.startState.field(k,!1)){let n=e.state.facet(b).side=="a",l=[];for(let i of e.state.field(k))t.between(n?i.fromA:i.fromB,n?i.toA:i.toB,r=>{l.push(r)});l.length&&(t=t.update({filter:i=>l.indexOf(i)<0}))}return t},provide:t=>B.decorations.from(t)});function se({margin:t=3,minSize:e=4}){return Lt.init(n=>St(n,t,e))}function St(t,e,n){let l=new N,i=t.facet(b).side=="a",r=t.field(k),s=1;for(let o=0;;o++){let f=o<r.length?r[o]:null,h=o?s+e:1,a=f?t.doc.lineAt(i?f.fromA:f.fromB).number-1-e:t.doc.lines,d=a-h+1;if(d>=n&&l.add(t.doc.line(h).from,t.doc.line(a).to,M.replace({widget:new Mt(d),block:!0})),!f)break;s=t.doc.lineAt(Math.min(t.doc.length,i?f.toA:f.toB)).number}return l.finish()}const Ot=B.styleModule.of(new st({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),nt=B.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Oe=new Ge,$=new Ge;class Et{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||et;let n=[Q.low(Z),nt,Ot,W,B.updateListener.of(d=>{this.measuring<0&&(d.heightChanged||d.viewportChanged)&&!d.transactions.some(c=>c.effects.some(u=>u.is(K)))&&this.measure()})],l=[b.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&l.push(P);let i=ne.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],B.editorAttributes.of({class:"cm-merge-a"}),$.of(l),n]}),r=[b.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&r.push(P);let s=ne.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],B.editorAttributes.of({class:"cm-merge-b"}),$.of(r),n]});this.chunks=O.build(i.doc,s.doc,this.diffConf);let o=[k.init(()=>this.chunks),Oe.of(e.collapseUnchanged?se(e.collapseUnchanged):[])];i=i.update({effects:G.appendConfig.of(o)}).state,s=s.update({effects:G.appendConfig.of(o)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let f=e.orientation||"a-b",h=document.createElement("div");h.className="cm-mergeViewEditor";let a=document.createElement("div");a.className="cm-mergeViewEditor",this.editorDOM.appendChild(f=="a-b"?h:a),this.editorDOM.appendChild(f=="a-b"?a:h),this.a=new B({state:i,parent:h,root:e.root,dispatchTransactions:d=>this.dispatch(d,this.a)}),this.b=new B({state:s,parent:a,root:e.root,dispatchTransactions:d=>this.dispatch(d,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(l=>l.docChanged)){let l=e[e.length-1],i=e.reduce((s,o)=>s.compose(o.changes),Ne.empty(e[0].startState.doc.length));this.chunks=n==this.a?O.updateA(this.chunks,l.newDoc,this.b.state.doc,i,this.diffConf):O.updateB(this.chunks,this.a.state.doc,l.newDoc,i,this.diffConf),n.update([...e,l.state.update({effects:ie.of(this.chunks)})]);let r=n==this.a?this.b:this.a;r.update([r.state.update({effects:ie.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let r=e.orientation!="b-a";if(r!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let s=this.a.dom.parentNode,o=this.b.dom.parentNode;s.remove(),o.remove(),this.editorDOM.insertBefore(r?s:o,this.editorDOM.firstChild),this.editorDOM.appendChild(r?o:s),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let r=!!this.revertDOM,s=this.revertToA,o=this.renderRevert;"revertControls"in e&&(r=!!e.revertControls,s=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(r,s,o)}let n="highlightChanges"in e,l="gutter"in e,i="collapseUnchanged"in e;if(n||l||i){let r=[],s=[];if(n||l){let o=this.a.state.facet(b),f=l?e.gutter!==!1:o.markGutter,h=n?e.highlightChanges!==!1:o.highlightChanges;r.push($.reconfigure([b.of({side:"a",sibling:()=>this.b,highlightChanges:h,markGutter:f}),f?P:[]])),s.push($.reconfigure([b.of({side:"b",sibling:()=>this.a,highlightChanges:h,markGutter:f}),f?P:[]]))}if(i){let o=Oe.reconfigure(e.collapseUnchanged?se(e.collapseUnchanged):[]);r.push(o),s.push(o)}this.a.dispatch({effects:r}),this.b.dispatch({effects:s})}this.scheduleMeasure()}setupRevertControls(e,n,l){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=l,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",i=>this.revertClicked(i)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){bt(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,l=this.a.viewport,i=this.b.viewport;for(let r=0;r<this.chunks.length;r++){let s=this.chunks[r];if(s.fromA>l.to||s.fromB>i.to)break;if(s.fromA<l.from||s.fromB<i.from)continue;let o=this.a.lineBlockAt(s.fromA).top+"px";for(;n&&+n.dataset.chunk<r;)n=Ee(n);n&&n.dataset.chunk==String(r)?(n.style.top!=o&&(n.style.top=o),n=n.nextSibling):e.insertBefore(this.renderRevertButton(o,r),n)}for(;n;)n=Ee(n)}renderRevertButton(e,n){let l;if(this.renderRevert)l=this.renderRevert();else{l=document.createElement("button");let i=this.a.state.phrase("Revert this chunk");l.setAttribute("aria-label",i),l.setAttribute("title",i),l.textContent=this.revertToLeft?"⇜":"⇝"}return l.style.top=e,l.setAttribute("data-chunk",String(n)),l}revertClicked(e){let n=e.target,l;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(l=this.chunks[n.dataset.chunk])){let[i,r,s,o,f,h]=this.revertToA?[this.b,this.a,l.fromB,l.toB,l.fromA,l.toA]:[this.a,this.b,l.fromA,l.toA,l.fromB,l.toB],a=i.state.sliceDoc(s,Math.max(s,o-1));s!=o&&h<=r.state.doc.length&&(a+=i.state.lineBreak),r.dispatch({changes:{from:f,to:Math.min(r.state.doc.length,h),insert:a},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function Ee(t){let e=t.nextSibling;return t.remove(),e}const yt=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},Rt=Q.low(je({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Z))===null||e===void 0?void 0:e.gutter)||Ie.empty},widgetMarker:(t,e)=>e instanceof rt?yt:null}));function Tt(t){var e;let n=typeof t.original=="string"?Fe.of(t.original.split(/\r?\n/)):t.original,l=t.diffConfig||et;return[Q.low(Z),Vt,nt,B.editorAttributes.of({class:"cm-merge-b"}),Ze.of((i,r)=>{let s=r.effects.find(o=>o.is(he));return s&&(i=O.updateA(i,s.value.doc,r.startState.doc,s.value.changes,l)),r.docChanged&&(i=O.updateB(i,r.state.field(V),r.newDoc,r.changes,l)),i}),b.of({highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1,syntaxHighlightDeletions:t.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(e=t.mergeControls)!==null&&e!==void 0?e:!0,overrideChunk:t.allowInlineDiffs?Wt:void 0,side:"b"}),V.init(()=>n),t.gutter!==!1?Rt:[],t.collapseUnchanged?se(t.collapseUnchanged):[],k.init(i=>O.build(n,i.doc,l))]}const he=G.define(),V=H.define({create:()=>Fe.empty,update(t,e){for(let n of e.effects)n.is(he)&&(t=n.value.doc);return t}}),ye=new WeakMap;class rt extends Y{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||(this.dom=this.buildDOM(e))}}function Gt(t,e,n){let l=ye.get(e.changes);if(l)return l;let i=s=>{let{highlightChanges:o,syntaxHighlightDeletions:f,syntaxHighlightDeletionsMaxLength:h,mergeControls:a}=t.facet(b),d=document.createElement("div");if(d.className="cm-deletedChunk",a){let x=d.appendChild(document.createElement("div"));x.className="cm-chunkButtons";let D=A=>{A.preventDefault(),Nt(s,s.posAtDOM(d))},w=A=>{A.preventDefault(),Ft(s,s.posAtDOM(d))};if(typeof a=="function")x.appendChild(a("accept",D)),x.appendChild(a("reject",w));else{let A=x.appendChild(document.createElement("button"));A.name="accept",A.textContent=t.phrase("Accept"),A.onmousedown=D;let L=x.appendChild(document.createElement("button"));L.name="reject",L.textContent=t.phrase("Reject"),L.onmousedown=w}}if(n||e.fromA>=e.toA)return d;let c=s.state.field(V).sliceString(e.fromA,e.endA),u=f&&t.facet(ot),m=S(),p=e.changes,g=0,C=!1;function S(){let x=d.appendChild(document.createElement("div"));return x.className="cm-deletedLine",x.appendChild(document.createElement("del"))}function R(x,D,w){for(let A=x;A<D;){if(c.charAt(A)==`
2
2
  `){m.firstChild||m.appendChild(document.createElement("br")),m=S(),A++;continue}let L=D,ce=w+(C?" cm-deletedText":""),ue=!1,X=c.indexOf(`
3
3
  `,A);if(X>-1&&X<D&&(L=X),o&&g<p.length){let j=Math.max(0,C?p[g].toA:p[g].fromA);j<=L&&(L=j,C&&g++,ue=!0)}if(L>A){let j=document.createTextNode(c.slice(A,L));if(ce){let me=m.appendChild(document.createElement("span"));me.className=ce,me.appendChild(j)}else m.appendChild(j);A=L}ue&&(C=!C)}}if(u&&e.toA-e.fromA<=h){let x=u.parser.parse(c),D=0;at(x,{style:w=>ft(t,w)},(w,A,L)=>{w>D&&R(D,w,""),R(w,A,L),D=A}),R(D,c.length,"")}else R(0,c.length,"");return m.firstChild||m.appendChild(document.createElement("br")),d},r=M.widget({block:!0,side:-1,widget:new rt(i)});return ye.set(e.changes,r),r}function Nt(t,e){let{state:n}=t,l=e??n.selection.main.head,i=t.state.field(k).find(f=>f.fromB<=l&&f.endB>=l);if(!i)return!1;let r=t.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),s=t.state.field(V);i.fromB!=i.toB&&i.toA<=s.length&&(r+=t.state.lineBreak);let o=Ne.of({from:i.fromA,to:Math.min(s.length,i.toA),insert:r},s.length);return t.dispatch({effects:he.of({doc:o.apply(s),changes:o}),userEvent:"accept"}),!0}function Ft(t,e){let{state:n}=t,l=e??n.selection.main.head,i=n.field(k).find(o=>o.fromB<=l&&o.endB>=l);if(!i)return!1;let s=n.field(V).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(s+=n.lineBreak),t.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:s},userEvent:"revert"}),!0}function Re(t){let e=new N;for(let n of t.field(k)){let l=t.facet(b).overrideChunk&&it(t,n);e.add(n.fromB,n.fromB,Gt(t,n,!!l))}return e.finish()}const Vt=H.define({create:t=>Re(t),update(t,e){return e.state.field(k,!1)!=e.startState.field(k,!1)?Re(e.state):t},provide:t=>B.decorations.from(t)}),Te=new WeakMap;function it(t,e){let n=Te.get(e);if(n!==void 0)return n;n=null;let l=t.field(V),i=t.doc,r=l.lineAt(e.endA).number-l.lineAt(e.fromA).number+1,s=i.lineAt(e.endB).number-i.lineAt(e.fromB).number+1;e:if(r==s&&r<10){let o=[],f=0,h=e.fromA,a=e.fromB;for(let d of e.changes){if(d.fromA<d.toA){f+=d.toA-d.fromA;let c=l.sliceString(h+d.fromA,h+d.toA);if(/\n/.test(c))break e;o.push(M.widget({widget:new jt(c),side:-1}).range(a+d.fromB))}d.fromB<d.toB&&o.push(tt.range(a+d.fromB,a+d.toB))}f<e.endA-e.fromA-r*2&&(n=o)}return Te.set(e,n),n}class jt extends Y{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let n=document.createElement("del");return n.className="cm-deletedText",n.textContent=this.text,n}}const It=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},Ut=M.line({class:"cm-inlineChangedLine"});function Wt(t,e,n,l){let i=it(t,e),r=0;if(!i)return!1;for(let s=t.doc.lineAt(e.fromB);;){for(l&&l.add(s.from,s.from,It),n.add(s.from,s.from,Ut);r<i.length&&i[r].to<=s.to;){let o=i[r++];n.add(o.from,o.to,o.value)}if(s.to>=e.endB)break;s=t.doc.lineAt(s.to+1)}return!0}function Ht(t){const[e,n]=T.useState([]);return T.useEffect(()=>{let l=!1;const i=ht.matchFilename(ct,t);if(!i){n([]);return}return i.load().then(r=>{l||n([r])}).catch(()=>{l||n([])}),()=>{l=!0}},[t]),e}function Kt({baseline:t,current:e,theme:n,filename:l,sideBySide:i,onRejectHunk:r,onHunkCountChange:s}){const o=Ht(l);return i?J.jsx(Pt,{baseline:t,current:e,theme:n,languageExtension:o}):J.jsx(zt,{baseline:t,current:e,theme:n,languageExtension:o,onRejectHunk:r,onHunkCountChange:s})}function zt({baseline:t,current:e,theme:n,languageExtension:l,onRejectHunk:i,onHunkCountChange:r}){const s=T.useRef(-1),o=T.useMemo(()=>[B.lineWrapping,Tt({original:t,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),...l],[t,l]);return J.jsx(lt,{value:e,editable:!1,readOnly:!0,theme:n,height:"100%",className:"desktop:select-text h-full text-sm",extensions:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},onChange:f=>i(f),onUpdate:f=>{var a;const h=((a=vt(f.state))==null?void 0:a.chunks.length)??null;h!==null&&h!==s.current&&(s.current=h,r(h))}})}function Pt({baseline:t,current:e,theme:n,languageExtension:l}){const i=T.useRef(null);return T.useEffect(()=>{const r=i.current;if(!r)return;const s=[B.editable.of(!1),ne.readOnly.of(!0),B.lineWrapping,...n==="dark"?[qt()]:[],...l],o=new Et({a:{doc:t,extensions:s},b:{doc:e,extensions:s},parent:r,collapseUnchanged:{margin:3,minSize:4},highlightChanges:!0,gutter:!0});return()=>o.destroy()},[t,e,n,l]),J.jsx("div",{ref:i,className:"cm-diff-split h-full overflow-auto text-sm"})}function qt(){return B.theme({"&":{backgroundColor:"transparent",color:"inherit"}},{dark:!0})}export{Kt as CodeMirrorDiff};
@@ -1 +1 @@
1
- import{r as n,j as f}from"./index-OQuvRZTD.js";import{R as l}from"./index-BkJlIXqM.js";import{m as a,n as c,E as x}from"./index-1QfQImuJ.js";function j({value:u,editable:t,filename:i,languageHint:e,theme:h,onChange:m}){const[g,r]=n.useState([]);return n.useEffect(()=>{let s=!1;const o=e?a.matchLanguageName(c,e,!0):a.matchFilename(c,i);if(!o){r([]);return}return o.load().then(p=>{s||r([p])}).catch(()=>{s||r([])}),()=>{s=!0}},[i,e]),f.jsx(l,{value:u,editable:t,readOnly:!t,onChange:m,theme:h,height:"100%",className:"desktop:select-text h-full text-sm",extensions:[x.lineWrapping,...g],basicSetup:{highlightActiveLine:t,highlightActiveLineGutter:t}})}export{j as CodeMirrorEditor};
1
+ import{r as n,j as f}from"./index-YUtEyz7O.js";import{R as l}from"./index-oc-yQ5Q4.js";import{m as a,n as c,E as x}from"./index-CLTrC-a-.js";function j({value:u,editable:t,filename:i,languageHint:e,theme:h,onChange:m}){const[g,r]=n.useState([]);return n.useEffect(()=>{let s=!1;const o=e?a.matchLanguageName(c,e,!0):a.matchFilename(c,i);if(!o){r([]);return}return o.load().then(p=>{s||r([p])}).catch(()=>{s||r([])}),()=>{s=!0}},[i,e]),f.jsx(l,{value:u,editable:t,readOnly:!t,onChange:m,theme:h,height:"100%",className:"desktop:select-text h-full text-sm",extensions:[x.lineWrapping,...g],basicSetup:{highlightActiveLine:t,highlightActiveLineGutter:t}})}export{j as CodeMirrorEditor};
@@ -1 +1 @@
1
- import{a1 as A,a3 as E,a4 as k,fE as I,fF as $,fG as P,fH as j,fI as o,fJ as R,fK as q,fL as z,r as p,j as t,I as y,B as v,G as w,fM as F,e as W,Q as K,T as U,C as X,V as Q,f as B,dD as H}from"./index-OQuvRZTD.js";function G(){const e=A(),s=E();return k({mutationFn:({agentId:n,body:a})=>e.createCommitment(n,a),onSettled:()=>s.invalidateQueries({queryKey:I.all})})}function J(){const e=A(),s=E();return k({mutationFn:({id:n,body:a})=>e.updateCommitment(n,a),onSettled:()=>s.invalidateQueries({queryKey:I.all})})}$();const L=300,V=500,Z=200,M="external:",T=P(["open","kept","missed","dropped"]).openapi("CommitmentState"),O=j({id:o(),agentId:o(),to:o().nullable(),what:o(),dueAt:o().nullable(),state:T,overdue:q(),sourceSessionId:o().nullable(),sourceRoomEntryId:o().nullable(),createdAt:o(),closedAt:o().nullable(),note:o().nullable()}).openapi("Commitment"),_=o().datetime({offset:!0});j({what:o().trim().min(1).max(L),to:o().trim().min(1).max(Z).optional(),dueAt:_.optional()}).openapi("CreateCommitmentRequest");j({state:T,dueAt:_.nullable().optional(),note:o().trim().max(V).optional(),from:T.optional()}).openapi("UpdateCommitmentRequest");const Y=500;j({agentId:o().min(1).optional(),state:T.optional(),to:o().min(1).optional(),limit:R().int().min(1).max(Y).optional()}).openapi("ListCommitmentsQuery");j({commitments:z(O)}).openapi("ListCommitmentsResponse");function ee(e,s=new Date){if(!e)return null;const n=new Date(e);if(Number.isNaN(n.getTime()))return null;const a=n.getTime()<s.getTime()?"Overdue ·":"Due",d=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===s.toDateString()?`${a} ${d}`:Math.abs(n.getTime()-s.getTime())/864e5<6?`${a} ${n.toLocaleDateString(void 0,{weekday:"short"})} ${d}`:`${a} ${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})}`}function te(e,s){return e?e.startsWith(M)?`To ${e.slice(M.length)}`:`To ${(s==null?void 0:s(e))??e}`:null}function se(e){return{open:e.filter(s=>s.state==="open"),closed:e.filter(s=>s.state!=="open")}}const ae={kept:"Kept",missed:"Missed",dropped:"Dropped"};function de(e){var n;const s=new Map;for(const a of e)s.set(a.id,a.displayName),(n=a.agent)!=null&&n.manifestId&&s.set(a.agent.manifestId,a.displayName);return a=>s.get(a)}const ne=6e4;function oe(){const e=new Date;return new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function ie({agentId:e,onDone:s}){var m;const n=G(),[a,d]=p.useState(""),[r,l]=p.useState(""),u=p.useId(),g=p.useId(),x=a.trim(),N=n.isError&&((m=n.error)==null?void 0:m.code)==="PAST_DUE",h=r?new Date(r).getTime():null,[c,S]=p.useState(!1),[b]=p.useState(oe);function i(C){if(C.preventDefault(),!x||c)return;const f=h!==null?new Date(h).toISOString():void 0;n.mutate({agentId:e,body:{what:x,...f?{dueAt:f}:{}}},{onSuccess:s})}return t.jsxs("form",{onSubmit:i,"data-slot":"add-commitment-form",className:"flex flex-col gap-2 rounded-md border p-3",children:[t.jsx("label",{htmlFor:u,className:"text-xs font-medium",children:"What was promised"}),t.jsx(y,{id:u,value:a,maxLength:L,onChange:C=>d(C.target.value),placeholder:"Send Acme the revised quote"}),t.jsx("label",{htmlFor:g,className:"text-xs font-medium",children:"Due (optional)"}),t.jsx(y,{id:g,type:"datetime-local",value:r,min:b,"aria-invalid":c||void 0,onChange:C=>{const f=C.target.value;l(f),S(f!==""&&new Date(f).getTime()<Date.now()-ne)}}),(c||N)&&t.jsx("p",{className:"text-destructive text-xs",children:"That time has passed."}),n.isError&&!N&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t save the commitment. Try again."}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(v,{type:"button",size:"sm",variant:"ghost",onClick:s,children:"Cancel"}),t.jsx(v,{type:"submit",size:"sm",disabled:!x||c||n.isPending,children:"Add commitment"})]})]})}function D({commitment:e,agentName:s,nameOf:n,onClose:a,busy:d}){const r=e.state==="open",l=[s,te(e.to,n)].filter(Boolean).join(" · "),u=r?ee(e.dueAt):null;return t.jsxs("li",{"data-slot":"commitment-row","data-state":e.state,"data-overdue":e.overdue||void 0,className:"flex flex-col gap-2 rounded-md px-2 py-2 sm:flex-row sm:items-center sm:gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:w("text-sm break-words",!r&&"text-muted-foreground",e.state==="dropped"&&"line-through"),children:e.what}),(l||u||!r)&&t.jsxs("div",{className:"text-muted-foreground mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs",children:[e.state!=="open"&&t.jsx("span",{children:ae[e.state]}),l&&t.jsx("span",{className:"min-w-0 truncate",children:l}),u&&t.jsx("span",{className:w(e.overdue&&"text-destructive font-medium"),children:u})]})]}),r&&a&&t.jsxs("div",{className:"flex shrink-0 gap-1",children:[t.jsx(v,{size:"xs",variant:"outline",disabled:d,onClick:()=>a("kept"),"aria-label":`Mark kept: ${e.what}`,children:"Mark kept"}),t.jsx(v,{size:"xs",variant:"ghost",disabled:d,onClick:()=>a("dropped"),"aria-label":`Drop: ${e.what}`,children:"Drop"})]})]})}const re={kept:"Marked kept",dropped:"Commitment dropped"};function ue({agentId:e,nameOf:s,canAdd:n=!1,readOnly:a=!1,canChange:d}){var b;const r=F(e?{agentId:e}:{}),l=J(),[u,g]=p.useState(!1),x=e===void 0;function N(i,m){l.mutate({id:i.id,body:{state:m}},{onSuccess:()=>H.success(re[m],{action:{label:"Undo",onClick:()=>l.mutate({id:i.id,body:{state:"open",from:m}})}})})}if(r.isPending)return t.jsx(W,{className:"h-16 w-full"});if(r.isError)return t.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read commitments."});const{open:h,closed:c}=se(r.data),S=l.isPending?(b=l.variables)==null?void 0:b.id:void 0;return t.jsxs("div",{"data-slot":"commitment-list",className:"flex flex-col gap-2",children:[h.length===0&&c.length===0&&!u&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"No commitments yet."}),h.length>0&&t.jsx("ul",{className:"flex flex-col","aria-label":"Open commitments",children:h.map(i=>t.jsx(D,{commitment:i,agentName:x?s==null?void 0:s(i.agentId):void 0,nameOf:s,busy:S===i.id,...a||d&&!d(i)?{}:{onClose:m=>N(i,m)}},i.id))}),l.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t change that commitment. Try again."}),c.length>0&&t.jsxs(K,{children:[t.jsxs(U,{className:"focus-ring text-muted-foreground hover:text-foreground group flex items-center gap-1 rounded-md px-2 py-1 text-xs",children:[t.jsx(X,{"aria-hidden":!0,className:"size-3.5 transition-transform group-data-[state=open]:rotate-90"}),"Closed (",c.length,")"]}),t.jsx(Q,{children:t.jsx("ul",{className:"flex flex-col","aria-label":"Closed commitments",children:c.map(i=>t.jsx(D,{commitment:i,agentName:x?s==null?void 0:s(i.agentId):void 0,nameOf:s},i.id))})})]}),n&&!a&&e&&u&&t.jsx(ie,{agentId:e,onDone:()=>g(!1)}),n&&!a&&e&&!u&&t.jsxs(v,{size:"sm",variant:"ghost",className:"self-start",onClick:()=>g(!0),children:[t.jsx(B,{"aria-hidden":!0}),"Add commitment"]})]})}export{ue as C,de as r};
1
+ import{a5 as A,a7 as E,a8 as k,fD as I,fE as $,fF as P,fG as j,fH as o,fI as R,fJ as q,fK as z,r as p,j as t,I as y,B as v,G as w,fL as F,e as W,Q as K,T as U,C as X,V as B,f as Q,dB as H}from"./index-YUtEyz7O.js";function G(){const e=A(),s=E();return k({mutationFn:({agentId:n,body:a})=>e.createCommitment(n,a),onSettled:()=>s.invalidateQueries({queryKey:I.all})})}function J(){const e=A(),s=E();return k({mutationFn:({id:n,body:a})=>e.updateCommitment(n,a),onSettled:()=>s.invalidateQueries({queryKey:I.all})})}$();const L=300,V=500,Z=200,D="external:",T=P(["open","kept","missed","dropped"]).openapi("CommitmentState"),O=j({id:o(),agentId:o(),to:o().nullable(),what:o(),dueAt:o().nullable(),state:T,overdue:q(),sourceSessionId:o().nullable(),sourceRoomEntryId:o().nullable(),createdAt:o(),closedAt:o().nullable(),note:o().nullable()}).openapi("Commitment"),_=o().datetime({offset:!0});j({what:o().trim().min(1).max(L),to:o().trim().min(1).max(Z).optional(),dueAt:_.optional()}).openapi("CreateCommitmentRequest");j({state:T,dueAt:_.nullable().optional(),note:o().trim().max(V).optional(),from:T.optional()}).openapi("UpdateCommitmentRequest");const Y=500;j({agentId:o().min(1).optional(),state:T.optional(),to:o().min(1).optional(),limit:R().int().min(1).max(Y).optional()}).openapi("ListCommitmentsQuery");j({commitments:z(O)}).openapi("ListCommitmentsResponse");function ee(e,s=new Date){if(!e)return null;const n=new Date(e);if(Number.isNaN(n.getTime()))return null;const a=n.getTime()<s.getTime()?"Overdue ·":"Due",d=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===s.toDateString()?`${a} ${d}`:Math.abs(n.getTime()-s.getTime())/864e5<6?`${a} ${n.toLocaleDateString(void 0,{weekday:"short"})} ${d}`:`${a} ${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})}`}function te(e,s){return e?e.startsWith(D)?`To ${e.slice(D.length)}`:`To ${(s==null?void 0:s(e))??e}`:null}function se(e){return{open:e.filter(s=>s.state==="open"),closed:e.filter(s=>s.state!=="open")}}const ae={kept:"Kept",missed:"Missed",dropped:"Dropped"};function de(e){var n;const s=new Map;for(const a of e)s.set(a.id,a.displayName),(n=a.agent)!=null&&n.manifestId&&s.set(a.agent.manifestId,a.displayName);return a=>s.get(a)}const ne=6e4;function oe(){const e=new Date;return new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function ie({agentId:e,onDone:s}){var m;const n=G(),[a,d]=p.useState(""),[r,l]=p.useState(""),u=p.useId(),g=p.useId(),x=a.trim(),N=n.isError&&((m=n.error)==null?void 0:m.code)==="PAST_DUE",h=r?new Date(r).getTime():null,[c,S]=p.useState(!1),[b]=p.useState(oe);function i(C){if(C.preventDefault(),!x||c)return;const f=h!==null?new Date(h).toISOString():void 0;n.mutate({agentId:e,body:{what:x,...f?{dueAt:f}:{}}},{onSuccess:s})}return t.jsxs("form",{onSubmit:i,"data-slot":"add-commitment-form",className:"flex flex-col gap-2 rounded-md border p-3",children:[t.jsx("label",{htmlFor:u,className:"text-xs font-medium",children:"What was promised"}),t.jsx(y,{id:u,value:a,maxLength:L,onChange:C=>d(C.target.value),placeholder:"Send Acme the revised quote"}),t.jsx("label",{htmlFor:g,className:"text-xs font-medium",children:"Due (optional)"}),t.jsx(y,{id:g,type:"datetime-local",value:r,min:b,"aria-invalid":c||void 0,onChange:C=>{const f=C.target.value;l(f),S(f!==""&&new Date(f).getTime()<Date.now()-ne)}}),(c||N)&&t.jsx("p",{className:"text-destructive text-xs",children:"That time has passed."}),n.isError&&!N&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t save the commitment. Try again."}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(v,{type:"button",size:"sm",variant:"ghost",onClick:s,children:"Cancel"}),t.jsx(v,{type:"submit",size:"sm",disabled:!x||c||n.isPending,children:"Add commitment"})]})]})}function M({commitment:e,agentName:s,nameOf:n,onClose:a,busy:d}){const r=e.state==="open",l=[s,te(e.to,n)].filter(Boolean).join(" · "),u=r?ee(e.dueAt):null;return t.jsxs("li",{"data-slot":"commitment-row","data-state":e.state,"data-overdue":e.overdue||void 0,className:"flex flex-col gap-2 rounded-md px-2 py-2 sm:flex-row sm:items-center sm:gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:w("text-sm break-words",!r&&"text-muted-foreground",e.state==="dropped"&&"line-through"),children:e.what}),(l||u||!r)&&t.jsxs("div",{className:"text-muted-foreground mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs",children:[e.state!=="open"&&t.jsx("span",{children:ae[e.state]}),l&&t.jsx("span",{className:"min-w-0 truncate",children:l}),u&&t.jsx("span",{className:w(e.overdue&&"text-destructive font-medium"),children:u})]})]}),r&&a&&t.jsxs("div",{className:"flex shrink-0 gap-1",children:[t.jsx(v,{size:"xs",variant:"outline",disabled:d,onClick:()=>a("kept"),"aria-label":`Mark kept: ${e.what}`,children:"Mark kept"}),t.jsx(v,{size:"xs",variant:"ghost",disabled:d,onClick:()=>a("dropped"),"aria-label":`Drop: ${e.what}`,children:"Drop"})]})]})}const re={kept:"Marked kept",dropped:"Commitment dropped"};function ue({agentId:e,nameOf:s,canAdd:n=!1,readOnly:a=!1,canChange:d}){var b;const r=F(e?{agentId:e}:{}),l=J(),[u,g]=p.useState(!1),x=e===void 0;function N(i,m){l.mutate({id:i.id,body:{state:m}},{onSuccess:()=>H.success(re[m],{action:{label:"Undo",onClick:()=>l.mutate({id:i.id,body:{state:"open",from:m}})}})})}if(r.isPending)return t.jsx(W,{className:"h-16 w-full"});if(r.isError)return t.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read commitments."});const{open:h,closed:c}=se(r.data),S=l.isPending?(b=l.variables)==null?void 0:b.id:void 0;return t.jsxs("div",{"data-slot":"commitment-list",className:"flex flex-col gap-2",children:[h.length===0&&c.length===0&&!u&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"No commitments yet."}),h.length>0&&t.jsx("ul",{className:"flex flex-col","aria-label":"Open commitments",children:h.map(i=>t.jsx(M,{commitment:i,agentName:x?s==null?void 0:s(i.agentId):void 0,nameOf:s,busy:S===i.id,...a||d&&!d(i)?{}:{onClose:m=>N(i,m)}},i.id))}),l.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t change that commitment. Try again."}),c.length>0&&t.jsxs(K,{children:[t.jsxs(U,{className:"focus-ring text-muted-foreground hover:text-foreground group flex items-center gap-1 rounded-md px-2 py-1 text-xs",children:[t.jsx(X,{"aria-hidden":!0,className:"size-3.5 transition-transform group-data-[state=open]:rotate-90"}),"Closed (",c.length,")"]}),t.jsx(B,{children:t.jsx("ul",{className:"flex flex-col","aria-label":"Closed commitments",children:c.map(i=>t.jsx(M,{commitment:i,agentName:x?s==null?void 0:s(i.agentId):void 0,nameOf:s},i.id))})})]}),n&&!a&&e&&u&&t.jsx(ie,{agentId:e,onDone:()=>g(!1)}),n&&!a&&e&&!u&&t.jsxs(v,{size:"sm",variant:"ghost",className:"self-start",onClick:()=>g(!0),children:[t.jsx(Q,{"aria-hidden":!0}),"Add commitment"]})]})}export{ue as C,de as r};
@@ -1 +1 @@
1
- import{r,d,j as m}from"./index-OQuvRZTD.js";import{r as c,C as l}from"./CommitmentList-BZtfTnwg.js";function u({member:s,roster:t}){var o;const e=(o=s.agent)==null?void 0:o.manifestId,i=r.useMemo(()=>c(t),[t]),n=d(s,t),a=n==="managed"||n==="system";return e?m.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-commitments",children:m.jsx(l,{agentId:e,nameOf:i,canAdd:a,readOnly:!a})}):null}export{u as CommitmentsPage};
1
+ import{r,d,j as m}from"./index-YUtEyz7O.js";import{r as c,C as l}from"./CommitmentList-yFV3_m00.js";function u({member:s,roster:t}){var o;const e=(o=s.agent)==null?void 0:o.manifestId,i=r.useMemo(()=>c(t),[t]),n=d(s,t),a=n==="managed"||n==="system";return e?m.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-commitments",children:m.jsx(l,{agentId:e,nameOf:i,canAdd:a,readOnly:!a})}):null}export{u as CommitmentsPage};
@@ -1,4 +1,4 @@
1
- import{O as g,a1 as x,aW as o,r as C,j as e,B as d,Y as P}from"./index-OQuvRZTD.js";import{r as m,u as f,C as w}from"./ComputerViewer-CksBDqdu.js";import{u as v}from"./use-is-below-desktop-CAGEAsCC.js";/**
1
+ import{O as g,a5 as x,aZ as o,r as C,j as e,B as d,a0 as P}from"./index-YUtEyz7O.js";import{r as m,u as f,C as w}from"./ComputerViewer-H7kJSIj7.js";import{u as v}from"./use-is-below-desktop-BjWA-tqP.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- var R=Object.defineProperty;var S=(i,t,e)=>t in i?R(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var o=(i,t,e)=>S(i,typeof t!="symbol"?t+"":t,e);import{a1 as D,a2 as F,r as h,j as a,I as O,B as y,G as I}from"./index-OQuvRZTD.js";const Y=["computer","local"];function z(){const i=D();return F({queryKey:Y,queryFn:()=>i.getComputer(),networkMode:"always",refetchInterval:2e3,retry:!1})}class B{constructor(t,e,r){o(this,"snapshot",{frame:null,lease:null,owner:null,busy:!1,error:!1,controlError:!1});o(this,"listeners",new Map);o(this,"timer");o(this,"epoch",0);o(this,"acquisition",0);o(this,"queue",Promise.resolve());o(this,"movePending",!1);o(this,"polling",!1);o(this,"retired",!1);o(this,"pendingOwner",null);o(this,"frameRequest",null);o(this,"getSnapshot",()=>this.snapshot);o(this,"subscribe",(t,e)=>(this.listeners.set(t,e),!this.polling&&!this.retired&&this.start(),()=>{this.listeners.delete(t),this.releaseFor(t),this.listeners.size===0&&(this.epoch+=1,this.polling=!1,clearTimeout(this.timer),this.update({frame:null}))}));o(this,"release",async()=>{const t=this.snapshot.lease;this.drop();const e=this.acquisition;if(t)try{await this.transport.releaseComputerControl(t.leaseId)}catch{e===this.acquisition&&this.update({error:!0,frame:null})}});o(this,"releaseFor",t=>this.snapshot.owner===t||this.pendingOwner===t?this.release():Promise.resolve());o(this,"acquire",async t=>{if(this.retired||!this.listeners.has(t)||this.snapshot.busy||!this.snapshot.frame||this.snapshot.lease)return;const e=++this.acquisition;this.pendingOwner=t,this.update({busy:!0,controlError:!1});try{const r=await this.transport.acquireComputerControl();if(!this.listeners.has(t)||e!==this.acquisition||r.generation!==this.generation){await this.transport.releaseComputerControl(r.leaseId);return}this.update({lease:r,owner:t,controlError:!1})}catch{e===this.acquisition&&this.update({controlError:!0})}finally{e===this.acquisition&&(this.pendingOwner=null,this.update({busy:!1}))}});o(this,"send",(t,e)=>{const r=this.snapshot.lease;if(!r||this.snapshot.owner!==t||!this.listeners.has(t))return Promise.resolve(!1);const l=e.kind==="pointer"&&e.action==="move";if(l&&this.movePending)return Promise.resolve(!1);l&&(this.movePending=!0);const n=this.queue.then(async()=>{if(this.snapshot.lease!==r||this.snapshot.owner!==t||!this.listeners.has(t))return l&&(this.movePending=!1),!1;try{return await this.transport.sendComputerInput({...e,...r}),!0}catch{return this.snapshot.lease===r&&this.snapshot.owner===t&&(this.update({error:!0,frame:null}),await this.release()),!1}finally{l&&(this.movePending=!1)}});return this.queue=n.then(()=>{}),n});this.transport=t,this.generation=e,this.previous=r}update(t){this.snapshot={...this.snapshot,...t};for(const e of this.listeners.values())e()}retire(){this.retired=!0,this.epoch+=1,this.polling=!1,clearTimeout(this.timer),this.release(),this.update({frame:null,error:!0})}start(){var r;(r=this.previous)==null||r.retire(),this.previous=void 0,this.polling=!0;const t=++this.epoch,e=async()=>{const l=this.snapshot.lease;try{const n=this.frameRequest??this.transport.getComputerFrame();this.frameRequest=n;const u=await n.finally(()=>{this.frameRequest===n&&(this.frameRequest=null)});if(t!==this.epoch)return;u.generation!==this.generation?(this.update({frame:null,error:!0}),this.release()):(u.controlledByYou===!1&&l&&this.snapshot.lease===l&&this.drop(),this.update({frame:u,error:!1}))}catch{if(t!==this.epoch)return;this.update({frame:null,error:!0}),this.release()}t===this.epoch&&(this.timer=setTimeout(()=>void e(),500))};e()}drop(){this.acquisition+=1,this.movePending=!1,this.pendingOwner=null,this.update({lease:null,owner:null,busy:!1,controlError:!1})}}const k=new WeakMap;function Q(i){var t;return((t=k.get(i))==null?void 0:t.release())??Promise.resolve()}function K(i,t){let e=k.get(i);return(!e||e.generation!==t)&&(e=new B(i,t,e),k.set(i,e)),e}function L(i){const t=D(),e=h.useId(),r=h.useMemo(()=>K(t,i),[t,i]),l=h.useCallback(u=>r.subscribe(e,u),[r,e]),n=h.useSyncExternalStore(l,r.getSnapshot);return{...n,lease:n.owner===e?n.lease:null,controlledElsewhere:!!(n.lease&&n.owner!==e),session:r,owner:e}}function U({send:i}){const[t,e]=h.useState(""),[r,l]=h.useState(!1),n=h.useRef(!0);return h.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),a.jsxs("form",{className:"flex flex-wrap gap-2",onSubmit:u=>{if(u.preventDefault(),!t||r)return;const m=t;l(!0),i({kind:"text",text:m}).then(c=>{n.current&&c&&e(d=>d===m?"":d)}).finally(()=>{n.current&&l(!1)})},children:[a.jsx(O,{"aria-label":"Type on computer",placeholder:"Type on computer",value:t,maxLength:4096,autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1,className:"min-w-0 flex-1",onChange:u=>e(u.target.value)}),a.jsx(y,{type:"submit","aria-disabled":r||!t,"aria-busy":r,children:"Type"}),a.jsx(y,{type:"button",variant:"outline",onClick:()=>{i({kind:"key",key:"Enter",action:"down"}),i({kind:"key",key:"Enter",action:"up"})},children:"Enter"})]})}function _({generation:i,onClose:t}){const{frame:e,lease:r,busy:l,error:n,controlError:u,controlledElsewhere:m,session:c,owner:d}=L(i),E=h.useRef(null),q=h.useId(),v=c.release,x=s=>c.send(d,s),N=async()=>{var s;await c.acquire(d),(s=E.current)==null||s.focus()};h.useEffect(()=>{const s=()=>{c.releaseFor(d)},g=()=>{document.hidden&&s()};return window.addEventListener("blur",s),document.addEventListener("visibilitychange",g),()=>{window.removeEventListener("blur",s),document.removeEventListener("visibilitychange",g)}},[c,d,v]);const w=(s,g)=>{var j,P,T,M;if(!r||!e)return;const p=s.currentTarget.getBoundingClientRect();if(!p.width||!p.height)return;const f=Math.min(p.width/e.width,p.height/e.height),b=p.left+(p.width-e.width*f)/2,C=p.top+(p.height-e.height*f)/2;(s.clientX<b||s.clientX>b+e.width*f||s.clientY<C||s.clientY>C+e.height*f)&&!((P=(j=s.currentTarget).hasPointerCapture)!=null&&P.call(j,s.pointerId))||(s.preventDefault(),g==="down"&&(s.currentTarget.focus(),(M=(T=s.currentTarget).setPointerCapture)==null||M.call(T,s.pointerId)),x({kind:"pointer",action:g,button:Math.max(0,Math.min(2,s.button)),x:Math.max(0,Math.min(e.width-1,Math.floor((s.clientX-b)/f))),y:Math.max(0,Math.min(e.height-1,Math.floor((s.clientY-C)/f)))}))};return a.jsxs("section",{"data-slot":"computer-viewer","aria-label":"Computer desktop",className:"flex h-full min-h-0 flex-col gap-2 overflow-auto p-3",onBlur:s=>{s.currentTarget.contains(s.relatedTarget)||c.releaseFor(d)},children:[a.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[a.jsx("p",{className:"text-muted-foreground mr-auto text-sm",role:"status",children:n?"Disconnected":r?"You have control":e?"Watching":"Connecting…"}),r?a.jsx(y,{variant:"outline",onClick:()=>void v(),children:"Return control"}):a.jsx(y,{variant:"outline",disabled:!e||m,"aria-disabled":l||!e||m,"aria-busy":l,onClick:()=>void N(),children:"Take over"}),t&&a.jsx(y,{variant:"ghost",onClick:t,children:"Close view"})]}),n&&a.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Disconnected. Trying to reconnect…"}),u&&!n&&a.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t take control. Try again."}),e?a.jsx("div",{ref:E,role:"application","aria-label":"Computer desktop control","aria-describedby":q,tabIndex:r?0:-1,className:I("focus-visible:ring-ring block min-h-20 w-full flex-1 rounded-md outline-none select-none focus-visible:ring-2",r?"touch-none":"touch-pan-y"),onDragStart:s=>s.preventDefault(),onContextMenu:s=>s.preventDefault(),onPointerDown:s=>w(s,"down"),onPointerMove:s=>w(s,"move"),onPointerUp:s=>w(s,"up"),onPointerCancel:()=>void c.releaseFor(d),onKeyDown:s=>{if(r){if(s.preventDefault(),s.key==="Escape"&&s.ctrlKey&&s.shiftKey){v();return}s.repeat||x({kind:"key",key:s.key,action:"down"})}},onKeyUp:s=>{r&&(s.preventDefault(),x({kind:"key",key:s.key,action:"up"}))},children:a.jsx("img",{src:e.dataUrl,width:e.width,height:e.height,alt:"Live computer desktop",draggable:!1,className:"block h-full w-full rounded-md object-contain"})}):a.jsx("p",{role:"status",className:"text-muted-foreground py-10 text-center text-sm",children:"Waiting for the desktop…"}),r&&a.jsx(U,{send:x},r.leaseId),a.jsx("p",{id:q,className:I("text-muted-foreground shrink-0 text-xs",!r&&"sr-only"),children:"Press Control + Shift + Escape to return control."}),t&&a.jsx("p",{className:"text-muted-foreground shrink-0 text-xs",children:"Closing this view keeps the computer running."})]})}export{_ as C,Y as a,Q as r,z as u};
1
+ var R=Object.defineProperty;var S=(i,t,e)=>t in i?R(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var o=(i,t,e)=>S(i,typeof t!="symbol"?t+"":t,e);import{a5 as D,a6 as F,r as h,j as a,I as O,B as y,G as I}from"./index-YUtEyz7O.js";const Y=["computer","local"];function z(){const i=D();return F({queryKey:Y,queryFn:()=>i.getComputer(),networkMode:"always",refetchInterval:2e3,retry:!1})}class B{constructor(t,e,r){o(this,"snapshot",{frame:null,lease:null,owner:null,busy:!1,error:!1,controlError:!1});o(this,"listeners",new Map);o(this,"timer");o(this,"epoch",0);o(this,"acquisition",0);o(this,"queue",Promise.resolve());o(this,"movePending",!1);o(this,"polling",!1);o(this,"retired",!1);o(this,"pendingOwner",null);o(this,"frameRequest",null);o(this,"getSnapshot",()=>this.snapshot);o(this,"subscribe",(t,e)=>(this.listeners.set(t,e),!this.polling&&!this.retired&&this.start(),()=>{this.listeners.delete(t),this.releaseFor(t),this.listeners.size===0&&(this.epoch+=1,this.polling=!1,clearTimeout(this.timer),this.update({frame:null}))}));o(this,"release",async()=>{const t=this.snapshot.lease;this.drop();const e=this.acquisition;if(t)try{await this.transport.releaseComputerControl(t.leaseId)}catch{e===this.acquisition&&this.update({error:!0,frame:null})}});o(this,"releaseFor",t=>this.snapshot.owner===t||this.pendingOwner===t?this.release():Promise.resolve());o(this,"acquire",async t=>{if(this.retired||!this.listeners.has(t)||this.snapshot.busy||!this.snapshot.frame||this.snapshot.lease)return;const e=++this.acquisition;this.pendingOwner=t,this.update({busy:!0,controlError:!1});try{const r=await this.transport.acquireComputerControl();if(!this.listeners.has(t)||e!==this.acquisition||r.generation!==this.generation){await this.transport.releaseComputerControl(r.leaseId);return}this.update({lease:r,owner:t,controlError:!1})}catch{e===this.acquisition&&this.update({controlError:!0})}finally{e===this.acquisition&&(this.pendingOwner=null,this.update({busy:!1}))}});o(this,"send",(t,e)=>{const r=this.snapshot.lease;if(!r||this.snapshot.owner!==t||!this.listeners.has(t))return Promise.resolve(!1);const l=e.kind==="pointer"&&e.action==="move";if(l&&this.movePending)return Promise.resolve(!1);l&&(this.movePending=!0);const n=this.queue.then(async()=>{if(this.snapshot.lease!==r||this.snapshot.owner!==t||!this.listeners.has(t))return l&&(this.movePending=!1),!1;try{return await this.transport.sendComputerInput({...e,...r}),!0}catch{return this.snapshot.lease===r&&this.snapshot.owner===t&&(this.update({error:!0,frame:null}),await this.release()),!1}finally{l&&(this.movePending=!1)}});return this.queue=n.then(()=>{}),n});this.transport=t,this.generation=e,this.previous=r}update(t){this.snapshot={...this.snapshot,...t};for(const e of this.listeners.values())e()}retire(){this.retired=!0,this.epoch+=1,this.polling=!1,clearTimeout(this.timer),this.release(),this.update({frame:null,error:!0})}start(){var r;(r=this.previous)==null||r.retire(),this.previous=void 0,this.polling=!0;const t=++this.epoch,e=async()=>{const l=this.snapshot.lease;try{const n=this.frameRequest??this.transport.getComputerFrame();this.frameRequest=n;const u=await n.finally(()=>{this.frameRequest===n&&(this.frameRequest=null)});if(t!==this.epoch)return;u.generation!==this.generation?(this.update({frame:null,error:!0}),this.release()):(u.controlledByYou===!1&&l&&this.snapshot.lease===l&&this.drop(),this.update({frame:u,error:!1}))}catch{if(t!==this.epoch)return;this.update({frame:null,error:!0}),this.release()}t===this.epoch&&(this.timer=setTimeout(()=>void e(),500))};e()}drop(){this.acquisition+=1,this.movePending=!1,this.pendingOwner=null,this.update({lease:null,owner:null,busy:!1,controlError:!1})}}const k=new WeakMap;function Q(i){var t;return((t=k.get(i))==null?void 0:t.release())??Promise.resolve()}function K(i,t){let e=k.get(i);return(!e||e.generation!==t)&&(e=new B(i,t,e),k.set(i,e)),e}function L(i){const t=D(),e=h.useId(),r=h.useMemo(()=>K(t,i),[t,i]),l=h.useCallback(u=>r.subscribe(e,u),[r,e]),n=h.useSyncExternalStore(l,r.getSnapshot);return{...n,lease:n.owner===e?n.lease:null,controlledElsewhere:!!(n.lease&&n.owner!==e),session:r,owner:e}}function U({send:i}){const[t,e]=h.useState(""),[r,l]=h.useState(!1),n=h.useRef(!0);return h.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),a.jsxs("form",{className:"flex flex-wrap gap-2",onSubmit:u=>{if(u.preventDefault(),!t||r)return;const m=t;l(!0),i({kind:"text",text:m}).then(c=>{n.current&&c&&e(d=>d===m?"":d)}).finally(()=>{n.current&&l(!1)})},children:[a.jsx(O,{"aria-label":"Type on computer",placeholder:"Type on computer",value:t,maxLength:4096,autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1,className:"min-w-0 flex-1",onChange:u=>e(u.target.value)}),a.jsx(y,{type:"submit","aria-disabled":r||!t,"aria-busy":r,children:"Type"}),a.jsx(y,{type:"button",variant:"outline",onClick:()=>{i({kind:"key",key:"Enter",action:"down"}),i({kind:"key",key:"Enter",action:"up"})},children:"Enter"})]})}function _({generation:i,onClose:t}){const{frame:e,lease:r,busy:l,error:n,controlError:u,controlledElsewhere:m,session:c,owner:d}=L(i),E=h.useRef(null),q=h.useId(),v=c.release,x=s=>c.send(d,s),N=async()=>{var s;await c.acquire(d),(s=E.current)==null||s.focus()};h.useEffect(()=>{const s=()=>{c.releaseFor(d)},g=()=>{document.hidden&&s()};return window.addEventListener("blur",s),document.addEventListener("visibilitychange",g),()=>{window.removeEventListener("blur",s),document.removeEventListener("visibilitychange",g)}},[c,d,v]);const w=(s,g)=>{var j,P,T,M;if(!r||!e)return;const p=s.currentTarget.getBoundingClientRect();if(!p.width||!p.height)return;const f=Math.min(p.width/e.width,p.height/e.height),b=p.left+(p.width-e.width*f)/2,C=p.top+(p.height-e.height*f)/2;(s.clientX<b||s.clientX>b+e.width*f||s.clientY<C||s.clientY>C+e.height*f)&&!((P=(j=s.currentTarget).hasPointerCapture)!=null&&P.call(j,s.pointerId))||(s.preventDefault(),g==="down"&&(s.currentTarget.focus(),(M=(T=s.currentTarget).setPointerCapture)==null||M.call(T,s.pointerId)),x({kind:"pointer",action:g,button:Math.max(0,Math.min(2,s.button)),x:Math.max(0,Math.min(e.width-1,Math.floor((s.clientX-b)/f))),y:Math.max(0,Math.min(e.height-1,Math.floor((s.clientY-C)/f)))}))};return a.jsxs("section",{"data-slot":"computer-viewer","aria-label":"Computer desktop",className:"flex h-full min-h-0 flex-col gap-2 overflow-auto p-3",onBlur:s=>{s.currentTarget.contains(s.relatedTarget)||c.releaseFor(d)},children:[a.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[a.jsx("p",{className:"text-muted-foreground mr-auto text-sm",role:"status",children:n?"Disconnected":r?"You have control":e?"Watching":"Connecting…"}),r?a.jsx(y,{variant:"outline",onClick:()=>void v(),children:"Return control"}):a.jsx(y,{variant:"outline",disabled:!e||m,"aria-disabled":l||!e||m,"aria-busy":l,onClick:()=>void N(),children:"Take over"}),t&&a.jsx(y,{variant:"ghost",onClick:t,children:"Close view"})]}),n&&a.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Disconnected. Trying to reconnect…"}),u&&!n&&a.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t take control. Try again."}),e?a.jsx("div",{ref:E,role:"application","aria-label":"Computer desktop control","aria-describedby":q,tabIndex:r?0:-1,className:I("focus-visible:ring-ring block min-h-20 w-full flex-1 rounded-md outline-none select-none focus-visible:ring-2",r?"touch-none":"touch-pan-y"),onDragStart:s=>s.preventDefault(),onContextMenu:s=>s.preventDefault(),onPointerDown:s=>w(s,"down"),onPointerMove:s=>w(s,"move"),onPointerUp:s=>w(s,"up"),onPointerCancel:()=>void c.releaseFor(d),onKeyDown:s=>{if(r){if(s.preventDefault(),s.key==="Escape"&&s.ctrlKey&&s.shiftKey){v();return}s.repeat||x({kind:"key",key:s.key,action:"down"})}},onKeyUp:s=>{r&&(s.preventDefault(),x({kind:"key",key:s.key,action:"up"}))},children:a.jsx("img",{src:e.dataUrl,width:e.width,height:e.height,alt:"Live computer desktop",draggable:!1,className:"block h-full w-full rounded-md object-contain"})}):a.jsx("p",{role:"status",className:"text-muted-foreground py-10 text-center text-sm",children:"Waiting for the desktop…"}),r&&a.jsx(U,{send:x},r.leaseId),a.jsx("p",{id:q,className:I("text-muted-foreground shrink-0 text-xs",!r&&"sr-only"),children:"Press Control + Shift + Escape to return control."}),t&&a.jsx("p",{className:"text-muted-foreground shrink-0 text-xs",children:"Closing this view keeps the computer running."})]})}export{_ as C,Y as a,Q as r,z as u};
@@ -0,0 +1 @@
1
+ import{j as s,e as x,B as o,a0 as m,a1 as u,a2 as h,a3 as g}from"./index-YUtEyz7O.js";import{u as p,s as l,a as j,b as f}from"./access-copy-BAhTOOsG.js";import{Q as N}from"./query-error-state-BCX32dab.js";const v={agent:"From the agent",this_chat:"Only in this chat"};function k({agentId:n,onManage:e}){var i;const a=p(n);if(a.isPending)return s.jsx(x,{className:"h-24 w-full rounded-lg"});if(a.isError)return s.jsx(N,{title:"Couldn’t load account access",description:"Nothing changed. Try again.",onRetry:()=>void a.refetch(),isRetrying:a.isFetching});const c=((i=a.data)==null?void 0:i.connections)??[];return s.jsxs("section",{"aria-labelledby":"agent-account-access",className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h3",{id:"agent-account-access",className:"text-sm font-semibold",children:"Account access"}),s.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Accounts this agent can use."})]}),e&&s.jsxs(o,{variant:"ghost",size:"sm",onClick:e,children:["Manage",s.jsx(m,{className:"size-3.5","aria-hidden":!0})]})]}),c.length===0?s.jsxs("div",{className:"bg-muted/40 rounded-lg p-4 text-sm",children:[s.jsx("p",{className:"font-medium",children:"No account access"}),s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Give access from the Connections page."})]}):s.jsx("ul",{className:"space-y-1.5",children:c.map(t=>{const r=t.readiness.state==="ready";return s.jsxs("li",{"data-testid":`agent-connection-${t.connectionId}`,className:"bg-muted/40 flex min-h-11 items-center gap-3 rounded-lg px-3 py-2",children:[s.jsx(u,{iconKey:t.toolkit,displayName:l(t.toolkit),className:"size-7"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"truncate text-sm font-medium",children:[l(t.toolkit)," (",t.label,")"]}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.operationRevisionIds.length," approved"," ",t.operationRevisionIds.length===1?"action":"actions",t.everyAgent&&" · given to every agent"]})]}),s.jsx(h,{size:"xs",variant:r?"secondary":"outline",title:r?void 0:t.readiness.copy.owner,children:r?"Available":"Unavailable"})]},t.connectionId)})})]})}const y="This only affects this chat. Turning an app back on never adds access.",C="Couldn’t change access for this chat. Try again.";function b(n){return(n==null?void 0:n.code)==="session_access_other_agent"?n.message:C}function T({sessionId:n,onManage:e,emptyAction:a,footer:c}){var r;const i=j(n);if(i.isPending)return s.jsx(x,{className:"h-16 w-full rounded-lg"});if(i.isError)return s.jsxs("section",{"data-testid":"session-connectors",className:"space-y-2",children:[s.jsx("p",{role:"alert",className:"text-destructive px-1 text-xs",children:"Couldn’t load account access."}),s.jsx(o,{variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Try again"})]});const t=((r=i.data)==null?void 0:r.connections)??[];return s.jsxs("section",{"data-testid":"session-connectors","aria-labelledby":"session-account-access",className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 pb-1",children:[s.jsx("h3",{id:"session-account-access",className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Connections"}),e&&s.jsxs(o,{variant:"ghost",size:"xs",onClick:e,children:["Manage agent access",s.jsx(m,{className:"size-3","aria-hidden":!0})]})]}),t.length===0?s.jsxs("div",{className:"bg-muted/40 space-y-2 rounded-md px-2.5 py-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"No account access"}),s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Ask this agent to request the access it needs."})]}),a]}):s.jsxs(s.Fragment,{children:[t.some(d=>d.thisChat)&&s.jsx("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:y}),t.map(d=>s.jsx(S,{sessionId:n,connection:d},d.connectionId))]}),t.length>0&&c]})}function S({sessionId:n,connection:e}){const a=f(n),c=e.readiness.state==="ready",i=`${l(e.toolkit)} (${e.label})`;return s.jsxs("div",{"data-testid":`session-connection-${e.connectionId}`,"data-reason":e.readiness.reason,className:"bg-muted/40 rounded-md px-2.5 py-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-sm font-medium",children:i}),s.jsx(h,{size:"xs",variant:c?"secondary":"outline",children:c?v[e.source]:"Not available"})]}),s.jsx("p",{className:c?"text-muted-foreground mt-1 text-xs":"text-status-warning-fg mt-1 text-xs",children:c?`${e.operationRevisionIds.length} ${e.operationRevisionIds.length===1?"action":"actions"} available in this chat.`:e.readiness.copy.owner})]}),e.thisChat&&s.jsx(g,{"aria-label":`${i} in this chat`,"data-testid":`session-connection-switch-${e.connectionId}`,checked:e.thisChat==="on",disabled:a.isPending,onCheckedChange:t=>a.mutate({connectionId:e.connectionId,on:t}),className:"mt-0.5 shrink-0"})]}),a.isError&&e.thisChat&&s.jsx("p",{role:"alert",className:"text-destructive mt-1 text-xs",children:b(a.error)})]})}export{k as A,T as S};
@@ -1,6 +1,6 @@
1
- import{O as V,a1 as Z,a4 as J,r,b6 as K,j as e,G as I,bC as Q,_ as L,dj as X,dk as Y,dl as ee,g0 as se,g1 as te,B,g2 as ae,g3 as ne,g4 as R,x as ie,g5 as re,g6 as F,g7 as ce,g8 as oe,bH as de,bI as le,bJ as me,bK as ue,bL as pe,bM as xe,bN as ge,bP as he,g9 as fe,ga as je,f as ye,gb as ve,gc as Ne,gd as W,dD as N,ai as be,b as Ce,e as Te}from"./index-OQuvRZTD.js";import{A as Ie}from"./ConnectionAccessLists-DRwO1v0V.js";import{u as Ae}from"./use-bindings-BLAWQRpe.js";import{b as we,u as Se,a as ke,t as De,B as Re}from"./BindingDialog-q--8SDJF.js";import{u as Me}from"./use-delete-binding-Bnv3J5Fu.js";import{u as Pe,A as Be}from"./AdapterSetupWizard-Dle_b9qc.js";import{u as Ee}from"./use-external-adapter-catalog-9qiNBqpc.js";import"./relay-trace-schemas-B80E4EUn.js";import{A as _,a as P,b as ze}from"./AdapterIcon-NqCDzgCI.js";import{R as $}from"./radio-C8xmfoqO.js";import"./access-copy-Dqct36mi.js";import"./query-error-state-5236P3z0.js";import"./empty-state-CACt-76q.js";import"./form-D93N5lrK.js";import"./trust-posture-Dn2ciEE0.js";import"./markdown-content-Cjhsscbn.js";/**
1
+ import{O as Z,a5 as H,a8 as J,r,b9 as K,j as e,G as I,bD as Q,a2 as L,dh as X,di as Y,dj as ee,f$ as se,g0 as te,B,g1 as ae,g2 as ne,g3 as R,x as ie,g4 as re,g5 as F,g6 as ce,g7 as oe,bI as de,bJ as le,bK as me,bL as ue,bM as pe,bN as xe,bO as ge,bQ as he,g8 as fe,g9 as je,f as ye,ga as ve,gb as Ne,gc as W,dB as N,am as be,b as Ce,e as Te}from"./index-YUtEyz7O.js";import{A as Ie}from"./ConnectionAccessLists-SRkf7-Y6.js";import{u as Ae}from"./use-bindings-DhOKnybh.js";import{b as we,u as Se,a as ke,t as De,B as Re}from"./BindingDialog-D25PAed0.js";import{u as Me}from"./use-delete-binding-BET7vH2R.js";import{u as Pe,A as Be}from"./AdapterSetupWizard-B6KkTuJo.js";import{u as Ee}from"./use-external-adapter-catalog-D1INoacX.js";import"./relay-trace-schemas-C-1Js81V.js";import{A as _,a as P,b as ze}from"./AdapterIcon-CeRDpZGz.js";import{R as $}from"./radio-DBitPjM1.js";import"./access-copy-BAhTOOsG.js";import"./query-error-state-BCX32dab.js";import"./empty-state-BnuM8oop.js";import"./form--HjBAzX8.js";import"./trust-posture-CfEIPM4Z.js";import"./markdown-content-CiDXslQf.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:"plug-2",size:24,node:[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0Z",key:"wtfw2c"}]]};G.node;const Oe=V(G);function _e(){const a=Z();return J({mutationFn:i=>a.testBinding(i),meta:{errorLabel:"Couldn’t test the connection"}})}const Le={connected:P.connected,disconnected:Q.warning,error:P.error,connecting:P.starting};function Fe(a){const i=[];return a.canInitiate&&i.push("Can message first"),a.canReply||i.push("Can’t reply"),a.canReceive||i.push("Can’t receive"),i.join(" · ")}function $e({binding:a,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:x,errorMessage:g,chatDisplayName:h,lastMessageAt:d,onTogglePause:f,onTest:n,onEdit:m,onRemove:u}){const[t,o]=r.useState(!1),[j,v]=r.useState(!1),p=a.enabled===!1,[A,w]=r.useState(0);r.useEffect(()=>{if(!d||p)return;const b=setInterval(()=>w(s=>s+1),6e4);return()=>clearInterval(b)},[d,p]);const E=h?`${i} · ${h}`:i,S=we({sessionStrategy:a.sessionStrategy,chatDisplayName:h,channelType:a.channelType}),k=a.canInitiate||!a.canReply||!a.canReceive,z=k?Fe(a):"",D=r.useMemo(()=>p?"Paused: no messages delivered":d?`Last received ${K(d).toLowerCase()}`:"No recent activity",[p,d,A]),O=async()=>{v(!0);try{await n()}finally{v(!1)}};return e.jsxs("div",{className:I("relative rounded-xl border px-4 py-3 transition-colors",x==="error"&&!p&&"border-red-500/50 bg-red-500/[0.02]",p&&"opacity-60"),children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(_,{iconId:y,adapterType:l,size:32}),e.jsx("span",{className:I("ring-background absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full ring-2",p?"bg-muted-foreground/40":Le[x])})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:E}),p&&e.jsx(L,{variant:"secondary",children:"Paused"})]}),p?e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:D}):x==="error"&&g?e.jsx("p",{className:"text-destructive text-xs",children:g}):e.jsxs(e.Fragment,{children:[S&&e.jsx("p",{className:"text-muted-foreground truncate text-xs italic",children:S}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:D})]})]}),k&&e.jsxs(X,{children:[e.jsx(Y,{asChild:!0,children:e.jsx(L,{variant:"outline",children:"Restricted"})}),e.jsx(ee,{children:z})]}),e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"icon-md",responsive:!1,className:"h-8 w-8 shrink-0",children:[e.jsx(ae,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ne,{align:"end",children:[e.jsxs(R,{onClick:O,disabled:j||p,children:[j?e.jsx(ie,{className:"mr-2"}):e.jsx(re,{className:"mr-2 size-(--size-icon-sm)"}),"Send test"]}),e.jsx(F,{}),e.jsx(R,{onClick:()=>f(!a.enabled),children:p?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"mr-2 size-4"}),"Resume"]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"mr-2 size-4"}),"Pause"]})}),e.jsx(F,{}),e.jsx(R,{onClick:m,children:"Edit"}),e.jsx(R,{onClick:()=>o(!0),className:"text-destructive focus:text-destructive",children:"Remove"})]})]})]}),e.jsx(de,{open:t,onOpenChange:o,children:e.jsxs(le,{children:[e.jsxs(me,{children:[e.jsxs(ue,{children:["Remove the ",i," connection?"]}),e.jsx(pe,{children:"This agent stops getting messages from it."})]}),e.jsxs(xe,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(he,{onClick:()=>{u(),o(!1)},className:"bg-red-600 hover:bg-red-700",children:"Remove connection"})]})]})})]})}function qe({binding:a,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:x,errorMessage:g,onTogglePause:h,onTest:d,onEdit:f,onRemove:n}){const{data:m=[]}=Se(a.adapterId),u=a.chatId?m.find(j=>j.chatId===a.chatId):void 0,t=(u==null?void 0:u.displayName)??(a.chatId?`#${a.chatId.slice(-4)}`:void 0),o=r.useMemo(()=>{if(u)return u.lastMessageAt;if(m.length!==0)return m.reduce((j,v)=>v.lastMessageAt>j?v.lastMessageAt:j,m[0].lastMessageAt)},[u,m]);return e.jsx($e,{binding:a,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:x,errorMessage:g,chatDisplayName:t,lastMessageAt:o,onTogglePause:h,onTest:d,onEdit:f,onRemove:n})}function q({catalog:a,boundAdapterIds:i,onSelectIntegration:y,onRequestSetup:l,disabled:x}){const[g,h]=r.useState(!1),d=r.useMemo(()=>a.flatMap(t=>t.instances.map(o=>({id:o.id,displayName:o.status.displayName??t.manifest.displayName,label:o.label,state:o.status.state,isDisabled:o.status.state==="error"||!o.enabled,alreadyBound:i.has(o.id),iconId:t.manifest.iconId,adapterType:t.manifest.type}))),[a,i]),f=r.useMemo(()=>a.filter(t=>!t.manifest.deprecated&&(t.instances.length===0||t.manifest.multiInstance)),[a]);function n(t){y(t),h(!1)}function m(t){h(!1),l(t)}const u=d.length===0&&f.length===0;return e.jsxs(fe,{open:g,onOpenChange:h,children:[e.jsx(je,{asChild:!0,children:e.jsxs(B,{variant:"outline",size:"sm",disabled:x,children:[e.jsx(ye,{className:"mr-1.5 size-3.5"}),"Add connection"]})}),e.jsx(ve,{className:"w-72 p-0",align:"start",children:e.jsx("div",{className:"max-h-64 overflow-y-auto",children:u?e.jsx("div",{className:"px-3 py-4 text-center",children:e.jsx("p",{className:"text-muted-foreground text-sm",children:"No connections available"})}):e.jsxs(e.Fragment,{children:[d.length>0&&e.jsx("div",{className:"py-1",children:d.map(t=>e.jsxs("button",{disabled:t.isDisabled||t.alreadyBound,onClick:()=>n(t.id),className:I("flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors","hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50"),children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(_,{iconId:t.iconId,adapterType:t.adapterType,size:20,className:"text-muted-foreground"}),e.jsx("span",{className:I("ring-background absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-[1.5px]",P[t.state])})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate font-medium",children:t.displayName}),t.label&&e.jsx("p",{className:"text-muted-foreground truncate text-xs",children:t.label})]}),e.jsx("span",{className:"text-muted-foreground/60 text-xs",children:t.alreadyBound?"Connected":ze[t.state]})]},t.id))}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t"}),e.jsxs("div",{className:"py-1",children:[e.jsx("p",{className:"text-muted-foreground px-3 py-1 text-xs font-medium",children:"Available to set up"}),f.map(t=>e.jsxs("button",{onClick:()=>m(t.manifest),className:I("flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors","hover:bg-accent"),children:[e.jsx(_,{iconId:t.manifest.iconId,adapterType:t.manifest.type,size:14,className:"text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate font-medium",children:t.manifest.displayName})]},t.manifest.type))]})]})]})})})]})}const M={open:!1,binding:null,adapterName:""},U={open:!1};function Ue({agent:a}){const i=Ne(),{data:y=[]}=Ae(),{data:l=[]}=Ee(i),x=ke(),g=Me(),h=_e(),d=Pe(),f=W(),[n,m]=r.useState(M),[u,t]=r.useState(U),o=y.filter(s=>s.agentId===a.id),j=r.useMemo(()=>{const s=new Map;for(const c of l)for(const C of c.instances){const T=C.status.state,H=T==="connected"||T==="error"?T:T==="starting"||T==="stopping"||T==="reconnecting"?"connecting":"disconnected";s.set(C.id,{state:H,name:C.status.displayName??c.manifest.displayName,iconId:c.manifest.iconId,adapterType:c.manifest.type,errorMessage:C.status.lastError??void 0})}return s},[l]),v=r.useCallback(s=>j.get(s)??{state:"disconnected",name:s,adapterType:s},[j]),p=r.useMemo(()=>new Set(o.map(s=>s.adapterId)),[o]),A=r.useCallback(async s=>{try{await x.mutateAsync({adapterId:s,agentId:a.id,sessionStrategy:"per-chat",label:"",canInitiate:!1,canReply:!0,canReceive:!0}),N.success("Connection added")}catch{}},[a.id,x]),w=r.useCallback(s=>{t({open:!0,manifest:s})},[]),E=r.useCallback(s=>{m({open:!0,binding:s,adapterName:v(s.adapterId).name})},[v]),S=r.useCallback(async s=>{try{await g.mutateAsync(s),N.success("Connection removed")}catch{}},[g]),k=r.useCallback(async(s,c)=>{try{await d.mutateAsync({id:s,updates:{enabled:c}}),N.success(c?"Connection resumed":"Connection paused")}catch{}},[d]),z=r.useCallback(async s=>{const c=await h.mutateAsync(s);return c.ok?N.success(`Test message delivered in ${c.latencyMs}ms`):N.error(c.reason?`Test message didn’t arrive: ${c.reason}`:"Test message didn’t arrive. Try again."),c},[h]),D=r.useCallback(async s=>{if(n.binding)try{await d.mutateAsync({id:n.binding.id,updates:De(s)}),N.success("Connection updated"),m(M)}catch{}},[n.binding,d]),O=r.useCallback(async s=>{try{await g.mutateAsync(s),N.success("Connection removed"),m(M)}catch{}},[g]),b=e.jsxs(e.Fragment,{children:[n.binding&&e.jsx(Re,{open:n.open,onOpenChange:s=>{s||m(M)},mode:"edit",initialValues:{adapterId:n.binding.adapterId,agentId:n.binding.agentId,sessionStrategy:n.binding.sessionStrategy,label:n.binding.label,permissionMode:n.binding.permissionMode,chatId:n.binding.chatId,channelType:n.binding.channelType,canInitiate:n.binding.canInitiate,canReply:n.binding.canReply,canReceive:n.binding.canReceive,notifyOnTaskComplete:n.binding.notifyOnTaskComplete},adapterName:n.adapterName,agentName:be(a),bindingId:n.binding.id,onConfirm:D,onDelete:O,isPending:d.isPending||g.isPending}),u.manifest&&e.jsx(Be,{open:u.open,onOpenChange:s=>{s||t(U)},manifest:u.manifest,existingAdapterIds:l.flatMap(s=>s.instances.map(c=>c.id))})]});return i?l.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx($,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"No connections available"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Add Telegram, Slack or a webhook, then connect it here."})]}),e.jsx(B,{variant:"outline",size:"sm",onClick:()=>f(),children:"Add a connection"})]}),b]}):o.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx($,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"Message this agent from anywhere"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Connect a chat app to message it while you’re away."})]}),e.jsx(q,{catalog:l,boundAdapterIds:p,onSelectIntegration:A,onRequestSetup:w,disabled:x.isPending})]}),b]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"space-y-2",children:o.map(s=>{const c=v(s.adapterId);return e.jsx(qe,{binding:s,integrationName:c.name,integrationIconId:c.iconId,integrationAdapterType:c.adapterType,adapterState:c.state,errorMessage:c.errorMessage,onTogglePause:C=>k(s.id,C),onTest:()=>z(s.id),onEdit:()=>E(s),onRemove:()=>S(s.id)},s.id)})}),e.jsx(q,{catalog:l,boundAdapterIds:p,onSelectIntegration:A,onRequestSetup:w,disabled:x.isPending}),b]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx(Oe,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"Chat apps are off"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Turn them on in Connections to reach this agent from chat."})]}),e.jsx(B,{variant:"outline",size:"sm",onClick:()=>f(),children:"Open Connections"})]}),b]})}function rs({member:a}){const{agent:i,isPending:y}=Ce(a),l=W();return y?e.jsx(Te,{className:"h-32 w-full"}):i?e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ie,{agentId:i.id,onManage:()=>l()}),e.jsxs("section",{"aria-labelledby":"agent-messaging-access",className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"agent-messaging-access",className:"text-sm font-semibold",children:"Messaging"}),e.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Places where people can reach this agent."})]}),e.jsx(Ue,{agent:i})]})]}):e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s connections."})}export{rs as ConnectionsPage};
6
+ */const G={name:"plug-2",size:24,node:[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0Z",key:"wtfw2c"}]]};G.node;const Oe=Z(G);function _e(){const a=H();return J({mutationFn:i=>a.testBinding(i),meta:{errorLabel:"Couldn’t test the connection"}})}const Le={connected:P.connected,disconnected:Q.warning,error:P.error,connecting:P.starting};function Fe(a){const i=[];return a.canInitiate&&i.push("Can message first"),a.canReply||i.push("Can’t reply"),a.canReceive||i.push("Can’t receive"),i.join(" · ")}function $e({binding:a,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:x,errorMessage:g,chatDisplayName:h,lastMessageAt:d,onTogglePause:f,onTest:n,onEdit:m,onRemove:u}){const[t,o]=r.useState(!1),[j,v]=r.useState(!1),p=a.enabled===!1,[A,w]=r.useState(0);r.useEffect(()=>{if(!d||p)return;const b=setInterval(()=>w(s=>s+1),6e4);return()=>clearInterval(b)},[d,p]);const E=h?`${i} · ${h}`:i,S=we({sessionStrategy:a.sessionStrategy,chatDisplayName:h,channelType:a.channelType}),k=a.canInitiate||!a.canReply||!a.canReceive,z=k?Fe(a):"",D=r.useMemo(()=>p?"Paused: no messages delivered":d?`Last received ${K(d).toLowerCase()}`:"No recent activity",[p,d,A]),O=async()=>{v(!0);try{await n()}finally{v(!1)}};return e.jsxs("div",{className:I("relative rounded-xl border px-4 py-3 transition-colors",x==="error"&&!p&&"border-red-500/50 bg-red-500/[0.02]",p&&"opacity-60"),children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(_,{iconId:y,adapterType:l,size:32}),e.jsx("span",{className:I("ring-background absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full ring-2",p?"bg-muted-foreground/40":Le[x])})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:E}),p&&e.jsx(L,{variant:"secondary",children:"Paused"})]}),p?e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:D}):x==="error"&&g?e.jsx("p",{className:"text-destructive text-xs",children:g}):e.jsxs(e.Fragment,{children:[S&&e.jsx("p",{className:"text-muted-foreground truncate text-xs italic",children:S}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:D})]})]}),k&&e.jsxs(X,{children:[e.jsx(Y,{asChild:!0,children:e.jsx(L,{variant:"outline",children:"Restricted"})}),e.jsx(ee,{children:z})]}),e.jsxs(se,{children:[e.jsx(te,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"icon-md",responsive:!1,className:"h-8 w-8 shrink-0",children:[e.jsx(ae,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Actions"})]})}),e.jsxs(ne,{align:"end",children:[e.jsxs(R,{onClick:O,disabled:j||p,children:[j?e.jsx(ie,{className:"mr-2"}):e.jsx(re,{className:"mr-2 size-(--size-icon-sm)"}),"Send test"]}),e.jsx(F,{}),e.jsx(R,{onClick:()=>f(!a.enabled),children:p?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"mr-2 size-4"}),"Resume"]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"mr-2 size-4"}),"Pause"]})}),e.jsx(F,{}),e.jsx(R,{onClick:m,children:"Edit"}),e.jsx(R,{onClick:()=>o(!0),className:"text-destructive focus:text-destructive",children:"Remove"})]})]})]}),e.jsx(de,{open:t,onOpenChange:o,children:e.jsxs(le,{children:[e.jsxs(me,{children:[e.jsxs(ue,{children:["Remove the ",i," connection?"]}),e.jsx(pe,{children:"This agent stops getting messages from it."})]}),e.jsxs(xe,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(he,{onClick:()=>{u(),o(!1)},className:"bg-red-600 hover:bg-red-700",children:"Remove connection"})]})]})})]})}function qe({binding:a,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:x,errorMessage:g,onTogglePause:h,onTest:d,onEdit:f,onRemove:n}){const{data:m=[]}=Se(a.adapterId),u=a.chatId?m.find(j=>j.chatId===a.chatId):void 0,t=(u==null?void 0:u.displayName)??(a.chatId?`#${a.chatId.slice(-4)}`:void 0),o=r.useMemo(()=>{if(u)return u.lastMessageAt;if(m.length!==0)return m.reduce((j,v)=>v.lastMessageAt>j?v.lastMessageAt:j,m[0].lastMessageAt)},[u,m]);return e.jsx($e,{binding:a,integrationName:i,integrationIconId:y,integrationAdapterType:l,adapterState:x,errorMessage:g,chatDisplayName:t,lastMessageAt:o,onTogglePause:h,onTest:d,onEdit:f,onRemove:n})}function q({catalog:a,boundAdapterIds:i,onSelectIntegration:y,onRequestSetup:l,disabled:x}){const[g,h]=r.useState(!1),d=r.useMemo(()=>a.flatMap(t=>t.instances.map(o=>({id:o.id,displayName:o.status.displayName??t.manifest.displayName,label:o.label,state:o.status.state,isDisabled:o.status.state==="error"||!o.enabled,alreadyBound:i.has(o.id),iconId:t.manifest.iconId,adapterType:t.manifest.type}))),[a,i]),f=r.useMemo(()=>a.filter(t=>!t.manifest.deprecated&&(t.instances.length===0||t.manifest.multiInstance)),[a]);function n(t){y(t),h(!1)}function m(t){h(!1),l(t)}const u=d.length===0&&f.length===0;return e.jsxs(fe,{open:g,onOpenChange:h,children:[e.jsx(je,{asChild:!0,children:e.jsxs(B,{variant:"outline",size:"sm",disabled:x,children:[e.jsx(ye,{className:"mr-1.5 size-3.5"}),"Add connection"]})}),e.jsx(ve,{className:"w-72 p-0",align:"start",children:e.jsx("div",{className:"max-h-64 overflow-y-auto",children:u?e.jsx("div",{className:"px-3 py-4 text-center",children:e.jsx("p",{className:"text-muted-foreground text-sm",children:"No connections available"})}):e.jsxs(e.Fragment,{children:[d.length>0&&e.jsx("div",{className:"py-1",children:d.map(t=>e.jsxs("button",{disabled:t.isDisabled||t.alreadyBound,onClick:()=>n(t.id),className:I("flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors","hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50"),children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(_,{iconId:t.iconId,adapterType:t.adapterType,size:20,className:"text-muted-foreground"}),e.jsx("span",{className:I("ring-background absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-[1.5px]",P[t.state])})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate font-medium",children:t.displayName}),t.label&&e.jsx("p",{className:"text-muted-foreground truncate text-xs",children:t.label})]}),e.jsx("span",{className:"text-muted-foreground/60 text-xs",children:t.alreadyBound?"Connected":ze[t.state]})]},t.id))}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t"}),e.jsxs("div",{className:"py-1",children:[e.jsx("p",{className:"text-muted-foreground px-3 py-1 text-xs font-medium",children:"Available to set up"}),f.map(t=>e.jsxs("button",{onClick:()=>m(t.manifest),className:I("flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors","hover:bg-accent"),children:[e.jsx(_,{iconId:t.manifest.iconId,adapterType:t.manifest.type,size:14,className:"text-muted-foreground shrink-0"}),e.jsx("span",{className:"truncate font-medium",children:t.manifest.displayName})]},t.manifest.type))]})]})]})})})]})}const M={open:!1,binding:null,adapterName:""},U={open:!1};function Ue({agent:a}){const i=Ne(),{data:y=[]}=Ae(),{data:l=[]}=Ee(i),x=ke(),g=Me(),h=_e(),d=Pe(),f=W(),[n,m]=r.useState(M),[u,t]=r.useState(U),o=y.filter(s=>s.agentId===a.id),j=r.useMemo(()=>{const s=new Map;for(const c of l)for(const C of c.instances){const T=C.status.state,V=T==="connected"||T==="error"?T:T==="starting"||T==="stopping"||T==="reconnecting"?"connecting":"disconnected";s.set(C.id,{state:V,name:C.status.displayName??c.manifest.displayName,iconId:c.manifest.iconId,adapterType:c.manifest.type,errorMessage:C.status.lastError??void 0})}return s},[l]),v=r.useCallback(s=>j.get(s)??{state:"disconnected",name:s,adapterType:s},[j]),p=r.useMemo(()=>new Set(o.map(s=>s.adapterId)),[o]),A=r.useCallback(async s=>{try{await x.mutateAsync({adapterId:s,agentId:a.id,sessionStrategy:"per-chat",label:"",canInitiate:!1,canReply:!0,canReceive:!0}),N.success("Connection added")}catch{}},[a.id,x]),w=r.useCallback(s=>{t({open:!0,manifest:s})},[]),E=r.useCallback(s=>{m({open:!0,binding:s,adapterName:v(s.adapterId).name})},[v]),S=r.useCallback(async s=>{try{await g.mutateAsync(s),N.success("Connection removed")}catch{}},[g]),k=r.useCallback(async(s,c)=>{try{await d.mutateAsync({id:s,updates:{enabled:c}}),N.success(c?"Connection resumed":"Connection paused")}catch{}},[d]),z=r.useCallback(async s=>{const c=await h.mutateAsync(s);return c.ok?N.success(`Test message delivered in ${c.latencyMs}ms`):N.error(c.reason?`Test message didn’t arrive: ${c.reason}`:"Test message didn’t arrive. Try again."),c},[h]),D=r.useCallback(async s=>{if(n.binding)try{await d.mutateAsync({id:n.binding.id,updates:De(s)}),N.success("Connection updated"),m(M)}catch{}},[n.binding,d]),O=r.useCallback(async s=>{try{await g.mutateAsync(s),N.success("Connection removed"),m(M)}catch{}},[g]),b=e.jsxs(e.Fragment,{children:[n.binding&&e.jsx(Re,{open:n.open,onOpenChange:s=>{s||m(M)},mode:"edit",initialValues:{adapterId:n.binding.adapterId,agentId:n.binding.agentId,sessionStrategy:n.binding.sessionStrategy,label:n.binding.label,permissionMode:n.binding.permissionMode,chatId:n.binding.chatId,channelType:n.binding.channelType,canInitiate:n.binding.canInitiate,canReply:n.binding.canReply,canReceive:n.binding.canReceive,notifyOnTaskComplete:n.binding.notifyOnTaskComplete},adapterName:n.adapterName,agentName:be(a),bindingId:n.binding.id,onConfirm:D,onDelete:O,isPending:d.isPending||g.isPending}),u.manifest&&e.jsx(Be,{open:u.open,onOpenChange:s=>{s||t(U)},manifest:u.manifest,existingAdapterIds:l.flatMap(s=>s.instances.map(c=>c.id))})]});return i?l.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx($,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"No connections available"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Add Telegram, Slack or a webhook, then connect it here."})]}),e.jsx(B,{variant:"outline",size:"sm",onClick:()=>f(),children:"Add a connection"})]}),b]}):o.length===0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx($,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"Message this agent from anywhere"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Connect a chat app to message it while you’re away."})]}),e.jsx(q,{catalog:l,boundAdapterIds:p,onSelectIntegration:A,onRequestSetup:w,disabled:x.isPending})]}),b]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"space-y-2",children:o.map(s=>{const c=v(s.adapterId);return e.jsx(qe,{binding:s,integrationName:c.name,integrationIconId:c.iconId,integrationAdapterType:c.adapterType,adapterState:c.state,errorMessage:c.errorMessage,onTogglePause:C=>k(s.id,C),onTest:()=>z(s.id),onEdit:()=>E(s),onRemove:()=>S(s.id)},s.id)})}),e.jsx(q,{catalog:l,boundAdapterIds:p,onSelectIntegration:A,onRequestSetup:w,disabled:x.isPending}),b]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed px-6 py-10",children:[e.jsx(Oe,{className:"text-muted-foreground/40 size-8"}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"Chat apps are off"}),e.jsx("p",{className:"text-muted-foreground max-w-xs text-xs leading-relaxed",children:"Turn them on in Connections to reach this agent from chat."})]}),e.jsx(B,{variant:"outline",size:"sm",onClick:()=>f(),children:"Open Connections"})]}),b]})}function rs({member:a}){const{agent:i,isPending:y}=Ce(a),l=W();return y?e.jsx(Te,{className:"h-32 w-full"}):i?e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ie,{agentId:i.id,onManage:()=>l()}),e.jsxs("section",{"aria-labelledby":"agent-messaging-access",className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"agent-messaging-access",className:"text-sm font-semibold",children:"Messaging"}),e.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Places where people can reach this agent."})]}),e.jsx(Ue,{agent:i})]})]}):e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s connections."})}export{rs as ConnectionsPage};