@saluzi/saluzi-edu 0.2.72 → 0.2.75

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 (161) hide show
  1. package/dist/cli.js +51 -51
  2. package/dist/rcs-web/assets/{AdminPanel-8HNxSZw0.js → AdminPanel-DGyc0uGQ.js} +1 -1
  3. package/dist/rcs-web/assets/ArtifactView-DDhb3d8t.js +6 -0
  4. package/dist/rcs-web/assets/ArtifactsGallery-MEE_QDjK.js +431 -0
  5. package/{packages/remote-control-server/web/dist/assets/Claim-Dfdhnggp.js → dist/rcs-web/assets/Claim-ChakqMPm.js} +1 -1
  6. package/dist/rcs-web/assets/{Dashboard-DnLE2gtW.js → Dashboard-CjO5dxyO.js} +2 -2
  7. package/dist/rcs-web/assets/{Join-Cgq7v-Sb.js → Join-DpcwWZDc.js} +1 -1
  8. package/dist/rcs-web/assets/{Login-CpRVSamw.js → Login-CPvnrMgA.js} +1 -1
  9. package/dist/rcs-web/assets/{Register-CvCuP-ww.js → Register-COSDEhaV.js} +1 -1
  10. package/dist/rcs-web/assets/SessionDetail-Be3UG4sF.js +60 -0
  11. package/dist/rcs-web/assets/{SessionVisibilityBadge-7ElYQ4hP.js → SessionVisibilityBadge-Dy3ZGawS.js} +1 -1
  12. package/dist/rcs-web/assets/{Setup-DH5NCalW.js → Setup-BBB5PmwE.js} +1 -1
  13. package/dist/rcs-web/assets/{ShareLanding-B48Z1tak.js → ShareLanding-DU4f7Pz3.js} +1 -1
  14. package/dist/rcs-web/assets/{TeamCreate-tXM5yKmq.js → TeamCreate-ovX7IiX2.js} +1 -1
  15. package/dist/rcs-web/assets/{TeamDetail-3jPhrX5z.js → TeamDetail-DG-YTHaa.js} +2 -2
  16. package/dist/rcs-web/assets/{TeamList-DylGNt59.js → TeamList-CHOWUmik.js} +1 -1
  17. package/dist/rcs-web/assets/{TeamSettings-CoBx_q55.js → TeamSettings-BLpkrRcY.js} +1 -1
  18. package/dist/rcs-web/assets/{UserSearchInput-DM6V0r1B.js → UserSearchInput-74J0KF8K.js} +1 -1
  19. package/dist/rcs-web/assets/{UserSettings-CxuLje2z.js → UserSettings-IyrqBc1i.js} +1 -1
  20. package/dist/rcs-web/assets/{arc-BrQup1CU.js → arc-CeNXRXGX.js} +1 -1
  21. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-l1NuwJAC.js → architectureDiagram-3BPJPVTR-CW4HgXmr.js} +1 -1
  22. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CVNyoBQm.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-cpLXlmVg.js} +1 -1
  23. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-C8IgW5pQ.js → c4Diagram-AAUBKEIU-CXMkSvWS.js} +1 -1
  24. package/dist/rcs-web/assets/channel-B6COvzyD.js +1 -0
  25. package/dist/rcs-web/assets/{chunk-2J33WTMH-Cz-fnX8Q.js → chunk-2J33WTMH-DEyGFBzH.js} +1 -1
  26. package/dist/rcs-web/assets/{chunk-4BX2VUAB-s0k1FsPS.js → chunk-4BX2VUAB-DxXT6eP4.js} +1 -1
  27. package/dist/rcs-web/assets/{chunk-55IACEB6-k7MztSxj.js → chunk-55IACEB6-HmgmzBnH.js} +1 -1
  28. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-DCD6b_gA.js → dist/rcs-web/assets/chunk-727SXJPM-CuZJw90P.js} +1 -1
  29. package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-ByLnKNaa.js → dist/rcs-web/assets/chunk-AQP2D5EJ-CDt2hrLS.js} +1 -1
  30. package/dist/rcs-web/assets/{chunk-FMBD7UC4-DnoA9fQr.js → chunk-FMBD7UC4-CvdHuOMd.js} +1 -1
  31. package/dist/rcs-web/assets/{chunk-ND2GUHAM-BsbvPHC6.js → chunk-ND2GUHAM-XAkimgx-.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-QZHKN3VN-DnHGOmkn.js → chunk-QZHKN3VN-yoNUbMoQ.js} +1 -1
  33. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-ChndRvEB.js +1 -0
  34. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-ChndRvEB.js +1 -0
  35. package/dist/rcs-web/assets/{code-block-IT6T5CEO-Br6udBTB.js → code-block-IT6T5CEO-DpuW5otn.js} +1 -1
  36. package/dist/rcs-web/assets/{copy-BFkM6GS4.js → copy-Ds1kEyW_.js} +1 -1
  37. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-ChN-rm-T.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-hxTzBVb7.js} +1 -1
  38. package/dist/rcs-web/assets/{dagre-BM42HDAG-Dy0qgRIV.js → dagre-BM42HDAG-BuaRh5_V.js} +1 -1
  39. package/dist/rcs-web/assets/{diagram-2AECGRRQ-ByiBm-x4.js → diagram-2AECGRRQ-CV1BNYv6.js} +1 -1
  40. package/dist/rcs-web/assets/{diagram-5GNKFQAL-rGbxhf-H.js → diagram-5GNKFQAL-BnD_0e2X.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-KO2AKTUF-COdwodvi.js → diagram-KO2AKTUF-d0FkGsys.js} +1 -1
  42. package/dist/rcs-web/assets/{diagram-LMA3HP47-EjqjzeZY.js → diagram-LMA3HP47-DJDP8Wb4.js} +1 -1
  43. package/dist/rcs-web/assets/{diagram-OG6HWLK6-DSPVSdmJ.js → diagram-OG6HWLK6-Cv9tZ0_x.js} +1 -1
  44. package/{packages/remote-control-server/web/dist/assets/dialog-aHICCHyK.js → dist/rcs-web/assets/dialog-ybaqiKM_.js} +1 -1
  45. package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-DZBAaLMb.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-C1CfRkws.js} +1 -1
  46. package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-DJHAIGo5.js → flowDiagram-I6XJVG4X-DF7zb7Jc.js} +1 -1
  47. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DEXe0aC6.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CVSVHZ1u.js} +1 -1
  48. package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-D35WJeQv.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BBUoSgjZ.js} +1 -1
  49. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-n-NVaNrp.js → infoDiagram-5YYISTIA-BUweKrDn.js} +1 -1
  50. package/dist/rcs-web/assets/{ishikawaDiagram-YF4QCWOH-D7nU29iu.js → ishikawaDiagram-YF4QCWOH-Cxoo0QxE.js} +1 -1
  51. package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-De0htrHG.js → journeyDiagram-JHISSGLW-Cnk8yKCW.js} +1 -1
  52. package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-C5rnfLlw.js → kanban-definition-UN3LZRKU-CzydxMee.js} +1 -1
  53. package/dist/rcs-web/assets/{linear-BkfmaOFV.js → linear-s8rprJB3.js} +1 -1
  54. package/dist/rcs-web/assets/main-C1pGF5LM.css +1 -0
  55. package/dist/rcs-web/assets/{main-2FF76CHO.js → main-Ckj6POvG.js} +21 -21
  56. package/dist/rcs-web/assets/{mermaid-VLURNSYL-CAb8MsJr.js → mermaid-VLURNSYL-SYCFRjUp.js} +4 -4
  57. package/dist/rcs-web/assets/{mermaid.core-dT6jK4cB.js → mermaid.core-D2rxkNqs.js} +5 -5
  58. package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-KBR776rc.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-Chulk5pQ.js} +1 -1
  59. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-aGUqFGVT.js → pieDiagram-4H26LBE5-vbW5CLRY.js} +1 -1
  60. package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-DbWbBGjW.js → quadrantDiagram-W4KKPZXB-QiwEvUD3.js} +1 -1
  61. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-CRIIsSnh.js → requirementDiagram-4Y6WPE33-3zyJ_Stn.js} +1 -1
  62. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-C1fZEOgo.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-C26JYqVD.js} +1 -1
  63. package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-DpwCRJwm.js → sequenceDiagram-3UESZ5HK-Cvt2g3dR.js} +1 -1
  64. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-Dx-tpSSo.js → stateDiagram-AJRCARHV-BAhPFgJ1.js} +1 -1
  65. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-DTEk3-eZ.js → stateDiagram-v2-BHNVJYJU-BBoo93U1.js} +1 -1
  66. package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-CUVrbUF6.js → timeline-definition-PNZ67QCA-BEsxhuSm.js} +1 -1
  67. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-Bjoy1hva.js → vennDiagram-CIIHVFJN-BOKf8gTG.js} +1 -1
  68. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-Xv7_ml_a.js → wardleyDiagram-YWT4CUSO-pt93Tqjm.js} +1 -1
  69. package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-CMv6nVsy.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-BVNPIQIv.js} +1 -1
  70. package/dist/rcs-web/index.html +2 -2
  71. package/package.json +3 -2
  72. package/packages/remote-control-server/src/__tests__/artifacts.test.ts +302 -0
  73. package/packages/remote-control-server/src/routes/web/artifacts.ts +78 -6
  74. package/packages/remote-control-server/src/services/artifacts.ts +57 -4
  75. package/packages/remote-control-server/src/services/event-persistence.ts +13 -4
  76. package/packages/remote-control-server/src/services/transport.ts +10 -0
  77. package/packages/remote-control-server/web/dist/assets/{AdminPanel-8HNxSZw0.js → AdminPanel-DGyc0uGQ.js} +1 -1
  78. package/packages/remote-control-server/web/dist/assets/ArtifactView-DDhb3d8t.js +6 -0
  79. package/packages/remote-control-server/web/dist/assets/ArtifactsGallery-MEE_QDjK.js +431 -0
  80. package/{dist/rcs-web/assets/Claim-Dfdhnggp.js → packages/remote-control-server/web/dist/assets/Claim-ChakqMPm.js} +1 -1
  81. package/packages/remote-control-server/web/dist/assets/{Dashboard-DnLE2gtW.js → Dashboard-CjO5dxyO.js} +2 -2
  82. package/packages/remote-control-server/web/dist/assets/{Join-Cgq7v-Sb.js → Join-DpcwWZDc.js} +1 -1
  83. package/packages/remote-control-server/web/dist/assets/{Login-CpRVSamw.js → Login-CPvnrMgA.js} +1 -1
  84. package/packages/remote-control-server/web/dist/assets/{Register-CvCuP-ww.js → Register-COSDEhaV.js} +1 -1
  85. package/packages/remote-control-server/web/dist/assets/SessionDetail-Be3UG4sF.js +60 -0
  86. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-7ElYQ4hP.js → SessionVisibilityBadge-Dy3ZGawS.js} +1 -1
  87. package/packages/remote-control-server/web/dist/assets/{Setup-DH5NCalW.js → Setup-BBB5PmwE.js} +1 -1
  88. package/packages/remote-control-server/web/dist/assets/{ShareLanding-B48Z1tak.js → ShareLanding-DU4f7Pz3.js} +1 -1
  89. package/packages/remote-control-server/web/dist/assets/{TeamCreate-tXM5yKmq.js → TeamCreate-ovX7IiX2.js} +1 -1
  90. package/packages/remote-control-server/web/dist/assets/{TeamDetail-3jPhrX5z.js → TeamDetail-DG-YTHaa.js} +2 -2
  91. package/packages/remote-control-server/web/dist/assets/{TeamList-DylGNt59.js → TeamList-CHOWUmik.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/{TeamSettings-CoBx_q55.js → TeamSettings-BLpkrRcY.js} +1 -1
  93. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-DM6V0r1B.js → UserSearchInput-74J0KF8K.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/{UserSettings-CxuLje2z.js → UserSettings-IyrqBc1i.js} +1 -1
  95. package/packages/remote-control-server/web/dist/assets/{arc-BrQup1CU.js → arc-CeNXRXGX.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-l1NuwJAC.js → architectureDiagram-3BPJPVTR-CW4HgXmr.js} +1 -1
  97. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-CVNyoBQm.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-cpLXlmVg.js} +1 -1
  98. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-C8IgW5pQ.js → c4Diagram-AAUBKEIU-CXMkSvWS.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/channel-B6COvzyD.js +1 -0
  100. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-Cz-fnX8Q.js → chunk-2J33WTMH-DEyGFBzH.js} +1 -1
  101. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-s0k1FsPS.js → chunk-4BX2VUAB-DxXT6eP4.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-k7MztSxj.js → chunk-55IACEB6-HmgmzBnH.js} +1 -1
  103. package/{dist/rcs-web/assets/chunk-727SXJPM-DCD6b_gA.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CuZJw90P.js} +1 -1
  104. package/{dist/rcs-web/assets/chunk-AQP2D5EJ-ByLnKNaa.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-CDt2hrLS.js} +1 -1
  105. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-DnoA9fQr.js → chunk-FMBD7UC4-CvdHuOMd.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-BsbvPHC6.js → chunk-ND2GUHAM-XAkimgx-.js} +1 -1
  107. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-DnHGOmkn.js → chunk-QZHKN3VN-yoNUbMoQ.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-ChndRvEB.js +1 -0
  109. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-ChndRvEB.js +1 -0
  110. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-Br6udBTB.js → code-block-IT6T5CEO-DpuW5otn.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{copy-BFkM6GS4.js → copy-Ds1kEyW_.js} +1 -1
  112. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-ChN-rm-T.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-hxTzBVb7.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-Dy0qgRIV.js → dagre-BM42HDAG-BuaRh5_V.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-ByiBm-x4.js → diagram-2AECGRRQ-CV1BNYv6.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-rGbxhf-H.js → diagram-5GNKFQAL-BnD_0e2X.js} +1 -1
  116. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-COdwodvi.js → diagram-KO2AKTUF-d0FkGsys.js} +1 -1
  117. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-EjqjzeZY.js → diagram-LMA3HP47-DJDP8Wb4.js} +1 -1
  118. package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-DSPVSdmJ.js → diagram-OG6HWLK6-Cv9tZ0_x.js} +1 -1
  119. package/{dist/rcs-web/assets/dialog-aHICCHyK.js → packages/remote-control-server/web/dist/assets/dialog-ybaqiKM_.js} +1 -1
  120. package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-DZBAaLMb.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-C1CfRkws.js} +1 -1
  121. package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-DJHAIGo5.js → flowDiagram-I6XJVG4X-DF7zb7Jc.js} +1 -1
  122. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DEXe0aC6.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CVSVHZ1u.js} +1 -1
  123. package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-D35WJeQv.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BBUoSgjZ.js} +1 -1
  124. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-n-NVaNrp.js → infoDiagram-5YYISTIA-BUweKrDn.js} +1 -1
  125. package/packages/remote-control-server/web/dist/assets/{ishikawaDiagram-YF4QCWOH-D7nU29iu.js → ishikawaDiagram-YF4QCWOH-Cxoo0QxE.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-De0htrHG.js → journeyDiagram-JHISSGLW-Cnk8yKCW.js} +1 -1
  127. package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-C5rnfLlw.js → kanban-definition-UN3LZRKU-CzydxMee.js} +1 -1
  128. package/packages/remote-control-server/web/dist/assets/{linear-BkfmaOFV.js → linear-s8rprJB3.js} +1 -1
  129. package/packages/remote-control-server/web/dist/assets/main-C1pGF5LM.css +1 -0
  130. package/packages/remote-control-server/web/dist/assets/{main-2FF76CHO.js → main-Ckj6POvG.js} +21 -21
  131. package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-CAb8MsJr.js → mermaid-VLURNSYL-SYCFRjUp.js} +4 -4
  132. package/packages/remote-control-server/web/dist/assets/{mermaid.core-dT6jK4cB.js → mermaid.core-D2rxkNqs.js} +5 -5
  133. package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-KBR776rc.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-Chulk5pQ.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-aGUqFGVT.js → pieDiagram-4H26LBE5-vbW5CLRY.js} +1 -1
  135. package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-DbWbBGjW.js → quadrantDiagram-W4KKPZXB-QiwEvUD3.js} +1 -1
  136. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-CRIIsSnh.js → requirementDiagram-4Y6WPE33-3zyJ_Stn.js} +1 -1
  137. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-C1fZEOgo.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-C26JYqVD.js} +1 -1
  138. package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-DpwCRJwm.js → sequenceDiagram-3UESZ5HK-Cvt2g3dR.js} +1 -1
  139. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-Dx-tpSSo.js → stateDiagram-AJRCARHV-BAhPFgJ1.js} +1 -1
  140. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-DTEk3-eZ.js → stateDiagram-v2-BHNVJYJU-BBoo93U1.js} +1 -1
  141. package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-CUVrbUF6.js → timeline-definition-PNZ67QCA-BEsxhuSm.js} +1 -1
  142. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-Bjoy1hva.js → vennDiagram-CIIHVFJN-BOKf8gTG.js} +1 -1
  143. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-Xv7_ml_a.js → wardleyDiagram-YWT4CUSO-pt93Tqjm.js} +1 -1
  144. package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-CMv6nVsy.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-BVNPIQIv.js} +1 -1
  145. package/packages/remote-control-server/web/dist/index.html +2 -2
  146. package/dist/rcs-web/assets/ArtifactView-2di4r0Cr.js +0 -6
  147. package/dist/rcs-web/assets/ArtifactsGallery-DQj98ptl.js +0 -339
  148. package/dist/rcs-web/assets/SessionDetail-CTa4JN6V.js +0 -60
  149. package/dist/rcs-web/assets/channel-DqfyWDcz.js +0 -1
  150. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BC1-yHO5.js +0 -1
  151. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BC1-yHO5.js +0 -1
  152. package/dist/rcs-web/assets/external-link-Cb0Qh2uy.js +0 -6
  153. package/dist/rcs-web/assets/main-C2O-g177.css +0 -1
  154. package/packages/remote-control-server/web/dist/assets/ArtifactView-2di4r0Cr.js +0 -6
  155. package/packages/remote-control-server/web/dist/assets/ArtifactsGallery-DQj98ptl.js +0 -339
  156. package/packages/remote-control-server/web/dist/assets/SessionDetail-CTa4JN6V.js +0 -60
  157. package/packages/remote-control-server/web/dist/assets/channel-DqfyWDcz.js +0 -1
  158. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BC1-yHO5.js +0 -1
  159. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BC1-yHO5.js +0 -1
  160. package/packages/remote-control-server/web/dist/assets/external-link-Cb0Qh2uy.js +0 -6
  161. package/packages/remote-control-server/web/dist/assets/main-C2O-g177.css +0 -1
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{E as u,Q as f}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";const v=2e3,N=3e4;function E(){const c=window.location.pathname.split("/"),i=c[c.length-1]||"",[s,n]=r.useState("idle"),[m,l]=r.useState(null),[a,d]=r.useState(null);return r.useEffect(()=>{if(!i||!i.startsWith("clm_")){l("Invalid claim token"),n("error");return}n("claiming"),u(i).then(t=>{d(t.environment_id),n("waiting")}).catch(t=>{l(t instanceof Error?t.message:"Claim failed"),n("error")})},[i]),r.useEffect(()=>{if(s!=="waiting"||!a)return;let t=!1;const x=Date.now(),o=setInterval(()=>{if(Date.now()-x>N){clearInterval(o),t||n("timeout");return}f().then(h=>{t||(h||[]).some(p=>p.environment_id===a)&&(clearInterval(o),window.location.href="/code/")}).catch(()=>{})},v);return()=>{t=!0,clearInterval(o)}},[s,a]),s==="claiming"?e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})}):s==="error"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsx("a",{href:"/code",className:"mt-4 inline-block text-accent hover:underline",children:"Back to dashboard"})]}):s==="waiting"||s==="timeout"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:"Environment claimed"}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:"You are now the owner of this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[a&&e.jsx("p",{className:"font-mono text-xs text-text-muted",children:a}),s==="waiting"?e.jsxs("p",{className:"text-sm text-text-muted",children:["Waiting for the worker to create a session",e.jsx("span",{className:"animate-pulse",children:"…"})]}):e.jsx("p",{className:"text-sm text-text-muted",children:"The worker has not created a session yet — it may be offline or stopped. The session will appear on the dashboard once the worker connects."}),e.jsx("a",{href:"/code",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:"Go to dashboard"})]})]}):e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})})}export{E as Claim};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{E as u,Q as f}from"./main-Ckj6POvG.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";const v=2e3,N=3e4;function E(){const c=window.location.pathname.split("/"),i=c[c.length-1]||"",[s,n]=r.useState("idle"),[m,l]=r.useState(null),[a,d]=r.useState(null);return r.useEffect(()=>{if(!i||!i.startsWith("clm_")){l("Invalid claim token"),n("error");return}n("claiming"),u(i).then(t=>{d(t.environment_id),n("waiting")}).catch(t=>{l(t instanceof Error?t.message:"Claim failed"),n("error")})},[i]),r.useEffect(()=>{if(s!=="waiting"||!a)return;let t=!1;const x=Date.now(),o=setInterval(()=>{if(Date.now()-x>N){clearInterval(o),t||n("timeout");return}f().then(h=>{t||(h||[]).some(p=>p.environment_id===a)&&(clearInterval(o),window.location.href="/code/")}).catch(()=>{})},v);return()=>{t=!0,clearInterval(o)}},[s,a]),s==="claiming"?e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})}):s==="error"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsx("a",{href:"/code",className:"mt-4 inline-block text-accent hover:underline",children:"Back to dashboard"})]}):s==="waiting"||s==="timeout"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:"Environment claimed"}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:"You are now the owner of this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[a&&e.jsx("p",{className:"font-mono text-xs text-text-muted",children:a}),s==="waiting"?e.jsxs("p",{className:"text-sm text-text-muted",children:["Waiting for the worker to create a session",e.jsx("span",{className:"animate-pulse",children:"…"})]}):e.jsx("p",{className:"text-sm text-text-muted",children:"The worker has not created a session yet — it may be offline or stopped. The session will appear on the dashboard once the worker connects."}),e.jsx("a",{href:"/code",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:"Go to dashboard"})]})]}):e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})})}export{E as Claim};
@@ -1,6 +1,6 @@
1
- import{j as e,e as l}from"./vendor-DE_-CLIE.js";import{ab as O,a9 as _,as as E,aq as T,x as F,ar as L,am as a,ae as A,q as $,s as W,e as q,r as H,d as P,ah as V,I as Q,Q as R,Y as U,N as Y}from"./main-2FF76CHO.js";import{g as D}from"./workerType-Bd-zteMi.js";import{S as Z}from"./SessionVisibilityBadge-7ElYQ4hP.js";import{D as z,a as G,c as J,d as K,b as X}from"./dialog-aHICCHyK.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
1
+ import{j as e,e as l}from"./vendor-DE_-CLIE.js";import{ac as O,aa as _,at as E,ar as T,x as F,as as L,an as a,af as A,q as $,s as W,e as H,r as V,d as P,ai as q,I as Q,Q as R,Y as U,N as Y}from"./main-Ckj6POvG.js";import{g as D}from"./workerType-Bd-zteMi.js";import{S as Z}from"./SessionVisibilityBadge-Dy3ZGawS.js";import{D as z,a as G,c as J,d as K,b as X}from"./dialog-ybaqiKM_.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
2
2
  * @license lucide-react v0.555.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 ee=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],te=O("folder",ee);function se({teamName:n,className:x}){return n?e.jsx("span",{className:_("inline-flex items-center rounded-full border border-border/60 bg-surface-2 px-2 py-0.5 text-xs text-text-muted",x),children:n}):null}function re({environments:n,onSelectEnvironment:x}){const{activeTeam:b}=E(),{user:u}=T(),i=l.useMemo(()=>(u==null?void 0:u.role)==="admin"?n:b?n.filter(r=>r.team_id===b.id):n.filter(r=>!r.team_id),[n,b,u]);return!i||i.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No active environments"}):e.jsx("div",{className:"space-y-2",children:i.map(r=>{const c=r.worker_type==="acp",p=D(r.worker_type),h=p.fullLabel,g=p.colorClass;return e.jsxs("button",{type:"button",onClick:()=>x==null?void 0:x(r),disabled:c,className:`flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors ${c?"cursor-default opacity-80":"hover:border-border-light cursor-pointer"}`,children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:r.machine_name||r.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${g}`,children:h}),e.jsx(se,{teamName:r.team_name??null})]}),e.jsx("div",{className:"text-sm text-text-muted",children:r.directory||""})]})}),e.jsxs("div",{className:"text-right",children:[e.jsx(F,{status:r.status}),e.jsx("div",{className:"mt-1 text-xs text-text-muted",children:r.branch||""})]})]},r.id)})})}function ae({sessions:n,environments:x,onSelect:b,onDelete:u}){L();const{activeTeam:i,myTeams:r}=E(),{user:c}=T(),p=l.useMemo(()=>{const t=new Map;for(const m of r)t.set(m.id,m.name);return t},[r]),h=l.useMemo(()=>(c==null?void 0:c.role)==="admin"?n:i?n.filter(t=>t.owner_type==="team"&&t.owner_id===i.id):n.filter(t=>t.owner_type==="user"||t.access_level==="write"||t.access_level==="read"),[n,i,c]),{mySessions:g,sharedSessions:w}=l.useMemo(()=>{const t=[],m=[];for(const d of h)i?t.push(d):d.access_level==="write"||d.access_level==="read"?m.push(d):t.push(d);return{mySessions:t,sharedSessions:m}},[h,i]),y=new Map;for(const t of x??[])t!=null&&t.id&&t.worker_type&&y.set(t.id,t.worker_type);const o=(t,m)=>(m.updated_at||0)-(t.updated_at||0);function f(t){const m=!!u&&t.access_level!=="write"&&t.access_level!=="read";return e.jsxs("div",{className:"group flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("button",{type:"button",onClick:()=>b(t.id),className:"min-w-0 flex-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id}),t.visibility&&e.jsx(Z,{visibility:t.visibility||"private"}),(()=>{var k;let d=t.source==="acp"?"acp":(k=t.environment)==null?void 0:k.worker_type;!d&&t.environment_id&&(d=y.get(t.environment_id));const j=D(d);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${j.colorClass}`,children:j.fullLabel})})()]}),e.jsxs("div",{className:"flex items-center gap-2 truncate text-xs text-text-muted",children:[e.jsx("span",{className:"truncate font-mono",children:t.id}),t.owner_type==="team"&&t.owner_id&&e.jsxs("span",{className:"inline-flex items-center gap-2 truncate",children:[e.jsx("span",{className:"text-text-muted/40",children:"|"}),e.jsx("span",{className:"truncate",children:p.get(t.owner_id)||t.owner_id})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:A(t.created_at||t.updated_at)}),m&&e.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),u(t.id)},className:"rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100",title:"Delete session",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id)}if(h.length===0)return e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No sessions"});const N=[...g].sort(o),v=[...w].sort(o);return e.jsxs("div",{className:"space-y-4",children:[N.length>0&&e.jsxs("section",{className:"space-y-2",children:[!i&&v.length>0&&e.jsx("h3",{className:"px-1 text-xs font-medium uppercase tracking-wide text-text-muted",children:a("session.mySessions")}),N.map(f)]}),v.length>0&&e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"px-1 text-xs font-medium uppercase tracking-wide text-text-muted",children:a("session.sharedWithMe")}),v.map(f)]})]})}function ne({open:n,environments:x,onClose:b,onCreated:u}){L();const{activeTeam:i}=E(),{user:r}=T(),[c,p]=l.useState(""),[h,g]=l.useState(""),[w,y]=l.useState("same-dir"),[o,f]=l.useState(""),[N,v]=l.useState(!1),[t,m]=l.useState(!1),d=l.useMemo(()=>(r==null?void 0:r.role)==="admin"?x:i?x.filter(s=>s.team_id===i.id):x.filter(s=>!s.team_id),[x,i,r]);l.useEffect(()=>{n&&(p(""),g(""),y("same-dir"),f(""),m(!1))},[n]);const j=d.find(s=>s.id===h)||null,k=j?d.findIndex(s=>s.id===j.id)+1:null,B=async()=>{v(!0),f("");try{const s={};c.trim()&&(s.title=c.trim()),h&&(s.environment_id=h),s.spawn_mode=w;const S=V();S&&(s.team_id=S);const C=await Q(s);u(C)}catch(s){f(s instanceof Error?s.message:a("dialog.createFailed"))}finally{v(!1)}};return e.jsx(z,{open:n,onOpenChange:s=>{s||b()},children:e.jsxs(G,{className:"max-w-md rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(J,{children:e.jsx(K,{className:"font-display text-lg font-semibold text-text-primary",children:a("dialog.newSession")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:a("dialog.titleOptional")}),e.jsx("input",{type:"text",value:c,onChange:s=>p(s.target.value),placeholder:a("dialog.titlePlaceholder"),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:a("dialog.environment")}),e.jsxs($,{open:t,onOpenChange:m,children:[e.jsx(W,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary hover:border-border-light focus:border-brand focus:outline-none transition-colors",children:[e.jsx("span",{className:_("flex items-center gap-2 truncate",!j&&"text-text-muted"),children:j?e.jsxs(e.Fragment,{children:[k!==null&&e.jsxs("span",{className:"shrink-0 rounded bg-surface-3 px-1.5 py-0.5 text-[10px] font-mono text-text-muted",children:["#",k]}),e.jsx("span",{className:"truncate",children:j.machine_name||j.id}),e.jsx("span",{className:"shrink-0 text-text-muted",children:"·"}),e.jsx("span",{className:"shrink-0 text-text-muted",children:D(j.worker_type).shortLabel})]}):e.jsx("span",{children:a("dialog.none")})}),e.jsx(q,{className:"h-4 w-4 shrink-0 text-text-muted"})]})}),e.jsxs(H,{align:"start",className:"max-h-80 w-80 overflow-y-auto rounded-lg border-border bg-surface-1 p-1 shadow-xl",children:[e.jsxs("button",{type:"button",onClick:()=>{g(""),m(!1)},className:"flex w-full items-center justify-between rounded-md px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:[e.jsx("span",{children:a("dialog.none")}),!h&&e.jsx(P,{className:"h-3.5 w-3.5 text-brand"})]}),d.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-muted",children:a("dialog.envEmpty")}):e.jsx("div",{className:"space-y-1 pt-1",children:d.map((s,S)=>{const C=D(s.worker_type),M=!!s.team_id,I=s.id===h;return e.jsxs("button",{type:"button",onClick:()=>{g(s.id),m(!1)},className:_("flex w-full flex-col gap-1.5 rounded-md px-3 py-2 text-left transition-colors",I?"bg-brand/10":"hover:bg-surface-2"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"shrink-0 rounded bg-surface-3 px-1.5 py-0.5 text-[10px] font-mono text-text-muted",children:["#",S+1]}),e.jsx("span",{className:"truncate font-medium text-text-primary",children:s.machine_name||s.id}),e.jsx("span",{className:_("shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium",C.colorClass),children:C.shortLabel}),e.jsx("span",{className:_("shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-medium",M?"border-border/60 bg-surface-2 text-text-muted":"border-brand/30 bg-brand/10 text-brand"),children:M?`${a("dialog.envTeam")}: ${s.team_name||s.team_id}`:a("dialog.envPersonal")}),I&&e.jsx(P,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-brand"})]}),s.directory&&e.jsxs("div",{className:"flex items-center gap-1.5 truncate text-xs text-text-muted",children:[e.jsx(te,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate font-mono",children:s.directory}),s.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-muted/40",children:"·"}),e.jsx("span",{className:"truncate",children:s.branch})]})]})]},s.id)})})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:a("dialog.workspaceMode")}),e.jsxs("select",{value:w,onChange:s=>y(s.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"same-dir",children:a("dialog.sameDir")}),e.jsx("option",{value:"worktree",children:a("dialog.worktree")})]})]}),o&&e.jsx("div",{className:"text-sm text-status-error",children:o})]}),e.jsxs(X,{children:[e.jsx("button",{onClick:b,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:a("common.cancel")}),e.jsx("button",{onClick:B,disabled:N,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:N?a("common.creating"):a("common.create")})]})]})})}function ue({onNavigateSession:n}){L();const[x,b]=l.useState([]),[u,i]=l.useState([]),[r,c]=l.useState(!1),p=l.useCallback(async()=>{try{const[o,f]=await Promise.all([R(),U()]);b(o||[]),i(f||[])}catch(o){console.error("Dashboard render error:",o)}},[]);l.useEffect(()=>{p();const o=setInterval(p,5e3);return window.addEventListener("focus",p),()=>{clearInterval(o),window.removeEventListener("focus",p)}},[p]);const h=o=>{c(!1),n(o.id)},g=l.useCallback(o=>{},[]),w=l.useCallback(o=>{n(o)},[n]),y=l.useCallback(async o=>{if(window.confirm(a("dashboard.confirmDelete").replace("{id}",o)))try{await Y(o),b(f=>f.filter(N=>N.id!==o))}catch(f){alert(f instanceof Error?f.message:a("dashboard.deleteFailed"))}},[]);return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:a("dashboard.title")}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:a("dashboard.environments")}),e.jsx(re,{environments:u,onSelectEnvironment:g})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:a("dashboard.sessions")}),e.jsx("button",{onClick:()=>c(!0),className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:a("dashboard.newSession")})]}),e.jsx(ae,{sessions:x,environments:u,onSelect:w,onDelete:y})]}),e.jsx(ne,{open:r,environments:u,onClose:()=>c(!1),onCreated:h})]})})}export{ue as Dashboard};
6
+ */const ee=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],te=O("folder",ee);function se({teamName:n,className:x}){return n?e.jsx("span",{className:_("inline-flex items-center rounded-full border border-border/60 bg-surface-2 px-2 py-0.5 text-xs text-text-muted",x),children:n}):null}function re({environments:n,onSelectEnvironment:x}){const{activeTeam:b}=E(),{user:u}=T(),i=l.useMemo(()=>(u==null?void 0:u.role)==="admin"?n:b?n.filter(r=>r.team_id===b.id):n.filter(r=>!r.team_id),[n,b,u]);return!i||i.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No active environments"}):e.jsx("div",{className:"space-y-2",children:i.map(r=>{const c=r.worker_type==="acp",p=D(r.worker_type),h=p.fullLabel,g=p.colorClass;return e.jsxs("button",{type:"button",onClick:()=>x==null?void 0:x(r),disabled:c,className:`flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors ${c?"cursor-default opacity-80":"hover:border-border-light cursor-pointer"}`,children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:r.machine_name||r.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${g}`,children:h}),e.jsx(se,{teamName:r.team_name??null})]}),e.jsx("div",{className:"text-sm text-text-muted",children:r.directory||""})]})}),e.jsxs("div",{className:"text-right",children:[e.jsx(F,{status:r.status}),e.jsx("div",{className:"mt-1 text-xs text-text-muted",children:r.branch||""})]})]},r.id)})})}function ae({sessions:n,environments:x,onSelect:b,onDelete:u}){L();const{activeTeam:i,myTeams:r}=E(),{user:c}=T(),p=l.useMemo(()=>{const t=new Map;for(const m of r)t.set(m.id,m.name);return t},[r]),h=l.useMemo(()=>(c==null?void 0:c.role)==="admin"?n:i?n.filter(t=>t.owner_type==="team"&&t.owner_id===i.id):n.filter(t=>t.owner_type==="user"||t.access_level==="write"||t.access_level==="read"),[n,i,c]),{mySessions:g,sharedSessions:w}=l.useMemo(()=>{const t=[],m=[];for(const d of h)i?t.push(d):d.access_level==="write"||d.access_level==="read"?m.push(d):t.push(d);return{mySessions:t,sharedSessions:m}},[h,i]),y=new Map;for(const t of x??[])t!=null&&t.id&&t.worker_type&&y.set(t.id,t.worker_type);const o=(t,m)=>(m.updated_at||0)-(t.updated_at||0);function f(t){const m=!!u&&t.access_level!=="write"&&t.access_level!=="read";return e.jsxs("div",{className:"group flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("button",{type:"button",onClick:()=>b(t.id),className:"min-w-0 flex-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id}),t.visibility&&e.jsx(Z,{visibility:t.visibility||"private"}),(()=>{var k;let d=t.source==="acp"?"acp":(k=t.environment)==null?void 0:k.worker_type;!d&&t.environment_id&&(d=y.get(t.environment_id));const j=D(d);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${j.colorClass}`,children:j.fullLabel})})()]}),e.jsxs("div",{className:"flex items-center gap-2 truncate text-xs text-text-muted",children:[e.jsx("span",{className:"truncate font-mono",children:t.id}),t.owner_type==="team"&&t.owner_id&&e.jsxs("span",{className:"inline-flex items-center gap-2 truncate",children:[e.jsx("span",{className:"text-text-muted/40",children:"|"}),e.jsx("span",{className:"truncate",children:p.get(t.owner_id)||t.owner_id})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:A(t.created_at||t.updated_at)}),m&&e.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),u(t.id)},className:"rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100",title:"Delete session",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id)}if(h.length===0)return e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No sessions"});const N=[...g].sort(o),v=[...w].sort(o);return e.jsxs("div",{className:"space-y-4",children:[N.length>0&&e.jsxs("section",{className:"space-y-2",children:[!i&&v.length>0&&e.jsx("h3",{className:"px-1 text-xs font-medium uppercase tracking-wide text-text-muted",children:a("session.mySessions")}),N.map(f)]}),v.length>0&&e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"px-1 text-xs font-medium uppercase tracking-wide text-text-muted",children:a("session.sharedWithMe")}),v.map(f)]})]})}function ne({open:n,environments:x,onClose:b,onCreated:u}){L();const{activeTeam:i}=E(),{user:r}=T(),[c,p]=l.useState(""),[h,g]=l.useState(""),[w,y]=l.useState("same-dir"),[o,f]=l.useState(""),[N,v]=l.useState(!1),[t,m]=l.useState(!1),d=l.useMemo(()=>(r==null?void 0:r.role)==="admin"?x:i?x.filter(s=>s.team_id===i.id):x.filter(s=>!s.team_id),[x,i,r]);l.useEffect(()=>{n&&(p(""),g(""),y("same-dir"),f(""),m(!1))},[n]);const j=d.find(s=>s.id===h)||null,k=j?d.findIndex(s=>s.id===j.id)+1:null,B=async()=>{v(!0),f("");try{const s={};c.trim()&&(s.title=c.trim()),h&&(s.environment_id=h),s.spawn_mode=w;const S=q();S&&(s.team_id=S);const C=await Q(s);u(C)}catch(s){f(s instanceof Error?s.message:a("dialog.createFailed"))}finally{v(!1)}};return e.jsx(z,{open:n,onOpenChange:s=>{s||b()},children:e.jsxs(G,{className:"max-w-md rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(J,{children:e.jsx(K,{className:"font-display text-lg font-semibold text-text-primary",children:a("dialog.newSession")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:a("dialog.titleOptional")}),e.jsx("input",{type:"text",value:c,onChange:s=>p(s.target.value),placeholder:a("dialog.titlePlaceholder"),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:a("dialog.environment")}),e.jsxs($,{open:t,onOpenChange:m,children:[e.jsx(W,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary hover:border-border-light focus:border-brand focus:outline-none transition-colors",children:[e.jsx("span",{className:_("flex items-center gap-2 truncate",!j&&"text-text-muted"),children:j?e.jsxs(e.Fragment,{children:[k!==null&&e.jsxs("span",{className:"shrink-0 rounded bg-surface-3 px-1.5 py-0.5 text-[10px] font-mono text-text-muted",children:["#",k]}),e.jsx("span",{className:"truncate",children:j.machine_name||j.id}),e.jsx("span",{className:"shrink-0 text-text-muted",children:"·"}),e.jsx("span",{className:"shrink-0 text-text-muted",children:D(j.worker_type).shortLabel})]}):e.jsx("span",{children:a("dialog.none")})}),e.jsx(H,{className:"h-4 w-4 shrink-0 text-text-muted"})]})}),e.jsxs(V,{align:"start",className:"max-h-80 w-80 overflow-y-auto rounded-lg border-border bg-surface-1 p-1 shadow-xl",children:[e.jsxs("button",{type:"button",onClick:()=>{g(""),m(!1)},className:"flex w-full items-center justify-between rounded-md px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:[e.jsx("span",{children:a("dialog.none")}),!h&&e.jsx(P,{className:"h-3.5 w-3.5 text-brand"})]}),d.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-muted",children:a("dialog.envEmpty")}):e.jsx("div",{className:"space-y-1 pt-1",children:d.map((s,S)=>{const C=D(s.worker_type),M=!!s.team_id,I=s.id===h;return e.jsxs("button",{type:"button",onClick:()=>{g(s.id),m(!1)},className:_("flex w-full flex-col gap-1.5 rounded-md px-3 py-2 text-left transition-colors",I?"bg-brand/10":"hover:bg-surface-2"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"shrink-0 rounded bg-surface-3 px-1.5 py-0.5 text-[10px] font-mono text-text-muted",children:["#",S+1]}),e.jsx("span",{className:"truncate font-medium text-text-primary",children:s.machine_name||s.id}),e.jsx("span",{className:_("shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium",C.colorClass),children:C.shortLabel}),e.jsx("span",{className:_("shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-medium",M?"border-border/60 bg-surface-2 text-text-muted":"border-brand/30 bg-brand/10 text-brand"),children:M?`${a("dialog.envTeam")}: ${s.team_name||s.team_id}`:a("dialog.envPersonal")}),I&&e.jsx(P,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-brand"})]}),s.directory&&e.jsxs("div",{className:"flex items-center gap-1.5 truncate text-xs text-text-muted",children:[e.jsx(te,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate font-mono",children:s.directory}),s.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-muted/40",children:"·"}),e.jsx("span",{className:"truncate",children:s.branch})]})]})]},s.id)})})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:a("dialog.workspaceMode")}),e.jsxs("select",{value:w,onChange:s=>y(s.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"same-dir",children:a("dialog.sameDir")}),e.jsx("option",{value:"worktree",children:a("dialog.worktree")})]})]}),o&&e.jsx("div",{className:"text-sm text-status-error",children:o})]}),e.jsxs(X,{children:[e.jsx("button",{onClick:b,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:a("common.cancel")}),e.jsx("button",{onClick:B,disabled:N,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:N?a("common.creating"):a("common.create")})]})]})})}function ue({onNavigateSession:n}){L();const[x,b]=l.useState([]),[u,i]=l.useState([]),[r,c]=l.useState(!1),p=l.useCallback(async()=>{try{const[o,f]=await Promise.all([R(),U()]);b(o||[]),i(f||[])}catch(o){console.error("Dashboard render error:",o)}},[]);l.useEffect(()=>{p();const o=setInterval(p,5e3);return window.addEventListener("focus",p),()=>{clearInterval(o),window.removeEventListener("focus",p)}},[p]);const h=o=>{c(!1),n(o.id)},g=l.useCallback(o=>{},[]),w=l.useCallback(o=>{n(o)},[n]),y=l.useCallback(async o=>{if(window.confirm(a("dashboard.confirmDelete").replace("{id}",o)))try{await Y(o),b(f=>f.filter(N=>N.id!==o))}catch(f){alert(f instanceof Error?f.message:a("dashboard.deleteFailed"))}},[]);return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:a("dashboard.title")}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:a("dashboard.environments")}),e.jsx(re,{environments:u,onSelectEnvironment:g})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:a("dashboard.sessions")}),e.jsx("button",{onClick:()=>c(!0),className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:a("dashboard.newSession")})]}),e.jsx(ae,{sessions:x,environments:u,onSelect:w,onDelete:y})]}),e.jsx(ne,{open:r,environments:u,onClose:()=>c(!1),onCreated:h})]})})}export{ue as Dashboard};
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as v,am as t}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function E({onSuccess:b,onInvalidInvite:l}){const{join:h}=v(),[u,f]=r.useState(""),[d,j]=r.useState(""),[o,w]=r.useState(""),[c,g]=r.useState(""),[m,n]=r.useState(""),[x,p]=r.useState(!1);r.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("invite");a?f(a):l()},[l]);const y=async s=>{if(s.preventDefault(),n(""),o.length<8){n(t("auth.setup.passwordTooShort"));return}if(o!==c){n(t("auth.setup.passwordMismatch"));return}p(!0);try{await h(u,d,o),b()}catch(a){const i=a instanceof Error?a.message:"Join failed";if(i.includes("Invalid invitation")||i.includes("expired")||i.includes("already used")){l();return}n(i)}finally{p(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.join.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.join.welcome")}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:t("auth.join.description")})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.username")}),e.jsx("input",{type:"text",value:d,onChange:s=>j(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),m&&e.jsx("p",{className:"text-sm text-status-error",children:m}),e.jsx("button",{type:"submit",disabled:x||!u,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:x?t("common.loading"):t("auth.join.submit")})]})]})})}export{E as Join};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{ar as v,an as t}from"./main-Ckj6POvG.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function E({onSuccess:b,onInvalidInvite:l}){const{join:h}=v(),[u,f]=r.useState(""),[d,j]=r.useState(""),[o,w]=r.useState(""),[c,g]=r.useState(""),[m,n]=r.useState(""),[x,p]=r.useState(!1);r.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("invite");a?f(a):l()},[l]);const y=async s=>{if(s.preventDefault(),n(""),o.length<8){n(t("auth.setup.passwordTooShort"));return}if(o!==c){n(t("auth.setup.passwordMismatch"));return}p(!0);try{await h(u,d,o),b()}catch(a){const i=a instanceof Error?a.message:"Join failed";if(i.includes("Invalid invitation")||i.includes("expired")||i.includes("already used")){l();return}n(i)}finally{p(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.join.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.join.welcome")}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:t("auth.join.description")})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.username")}),e.jsx("input",{type:"text",value:d,onChange:s=>j(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),m&&e.jsx("p",{className:"text-sm text-status-error",children:m}),e.jsx("button",{type:"submit",disabled:x||!u,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:x?t("common.loading"):t("auth.join.submit")})]})]})})}export{E as Join};
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as f,am as t}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function N({onSuccess:d,onNavigateRegister:c}){const{login:m,registrationAllowed:x}=f(),[a,p]=r.useState(""),[o,b]=r.useState(""),[l,n]=r.useState(""),[i,u]=r.useState(!1),h=async s=>{s.preventDefault(),n(""),u(!0);try{await m(a,o),d()}catch{n(t("auth.login.failed"))}finally{u(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.login.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.login.description")})]}),e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:a,onChange:s=>p(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>b(s.target.value),required:!0,autoComplete:"current-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),l&&e.jsx("p",{className:"text-sm text-status-error",children:l}),e.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:i?t("common.loading"):t("auth.login.submit")})]}),x&&e.jsx("button",{type:"button",onClick:c,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.login.register")})]})})}export{N as Login};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{ar as f,an as t}from"./main-Ckj6POvG.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function N({onSuccess:d,onNavigateRegister:c}){const{login:m,registrationAllowed:x}=f(),[a,p]=r.useState(""),[o,b]=r.useState(""),[n,l]=r.useState(""),[i,u]=r.useState(!1),h=async s=>{s.preventDefault(),l(""),u(!0);try{await m(a,o),d()}catch{l(t("auth.login.failed"))}finally{u(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.login.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.login.description")})]}),e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:a,onChange:s=>p(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>b(s.target.value),required:!0,autoComplete:"current-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),n&&e.jsx("p",{className:"text-sm text-status-error",children:n}),e.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:i?t("common.loading"):t("auth.login.submit")})]}),x&&e.jsx("button",{type:"button",onClick:c,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.login.register")})]})})}export{N as Login};
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as y,am as t}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function S({onSuccess:m,onBack:x}){const{register:p}=y(),[n,b]=r.useState(""),[a,h]=r.useState(""),[l,f]=r.useState(""),[i,o]=r.useState(""),[u,d]=r.useState(!1),g=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==l){o(t("auth.setup.passwordMismatch"));return}d(!0);try{await p(n,a),m()}catch(c){o(c instanceof Error?c.message:t("auth.register.failed"))}finally{d(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.register.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.register.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:n,onChange:s=>b(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>h(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:l,onChange:s=>f(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:u,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:u?t("common.loading"):t("auth.register.submit")})]}),e.jsx("button",{type:"button",onClick:x,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.register.backToLogin")})]})})}export{S as Register};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{ar as y,an as t}from"./main-Ckj6POvG.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function S({onSuccess:m,onBack:x}){const{register:p}=y(),[n,b]=r.useState(""),[a,h]=r.useState(""),[l,f]=r.useState(""),[i,o]=r.useState(""),[u,d]=r.useState(!1),g=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==l){o(t("auth.setup.passwordMismatch"));return}d(!0);try{await p(n,a),m()}catch(c){o(c instanceof Error?c.message:t("auth.register.failed"))}finally{d(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.register.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.register.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:n,onChange:s=>b(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>h(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:l,onChange:s=>f(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:u,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:u?t("common.loading"):t("auth.register.submit")})]}),e.jsx("button",{type:"button",onClick:x,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.register.backToLogin")})]})})}export{S as Register};
@@ -0,0 +1,60 @@
1
+ var bt=Object.defineProperty;var jt=(s,t,r)=>t in s?bt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var E=(s,t,r)=>jt(s,typeof t!="symbol"?t+"":t,r);import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{ac as D,_ as kt,aj as Ie,al as wt,ak as we,a6 as Nt,ag as je,a5 as L,a0 as vt,x as We,g as Pe,af as Qe,L as Ge,z as _t,w as St,ae as P,aa as J,d as Ke,ao as qe,a1 as Ct,J as Et,a4 as Mt,as as Ye,an as w,A as Tt,ah as Rt,G as At,ap as $t,ad as It,b as Pt,N as qt,a2 as Dt,y as Je,P as Ut,F as Ft,c as Ot,C as Lt,R as De,Z as Bt,D as Ht,a as zt,q as Xe,s as Ze,v as Vt,f as et,e as tt,r as st,M as Wt}from"./main-Ckj6POvG.js";import{g as Qt}from"./workerType-Bd-zteMi.js";import{D as nt,a as rt,c as at,d as ot,b as Gt}from"./dialog-ybaqiKM_.js";import{E as Kt,A as Yt}from"./ArtifactsGallery-MEE_QDjK.js";import{S as Jt}from"./SessionVisibilityBadge-Dy3ZGawS.js";import{U as Xt}from"./UserSearchInput-74J0KF8K.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";import"./copy-Ds1kEyW_.js";/**
2
+ * @license lucide-react v0.555.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Zt=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],es=D("activity",Zt);/**
7
+ * @license lucide-react v0.555.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ts=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ss=D("chevron-right",ts);/**
12
+ * @license lucide-react v0.555.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const ns=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],it=D("cpu",ns);/**
17
+ * @license lucide-react v0.555.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const rs=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],as=D("hash",rs);/**
22
+ * @license lucide-react v0.555.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const os=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],is=D("info",os);/**
27
+ * @license lucide-react v0.555.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const ls=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],cs=D("message-square-text",ls);/**
32
+ * @license lucide-react v0.555.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const ds=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],us=D("play",ds);/**
37
+ * @license lucide-react v0.555.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const ms=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],xs=D("server-cog",ms);/**
42
+ * @license lucide-react v0.555.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const ps=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],hs=D("share-2",ps);/**
47
+ * @license lucide-react v0.555.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const fs=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ys=D("shield-check",fs);/**
52
+ * @license lucide-react v0.555.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const gs=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],bs=D("triangle-alert",gs);function lt(){return{tasks:{}}}const Ue=3e4;function oe(s){const t=s.trim();if(!t)return"agent";const r=t.split(/\s+/).slice(0,2).join(" ");return r.length>40?r.slice(0,40)+"…":r}function js(s,t){var u,p,f,x,g,j,N,i,a,m,y,k;const r=t.subtype;if(r!=="task_started"&&r!=="task_progress"&&r!=="task_notification")return s;const n=t.task_id;if(!n)return s;const l=Date.now(),c=s.tasks[n];if(r==="task_started"){if(c)return{tasks:{...s.tasks,[n]:{...c,description:t.description??c.description,name:oe(t.description??c.description),taskType:t.task_type??c.taskType,workflowName:t.workflow_name??c.workflowName,prompt:t.prompt??c.prompt,toolUseId:t.tool_use_id??c.toolUseId,status:"running",startTime:l,evictAfter:void 0}}};const b=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:oe(b),description:b,taskType:t.task_type,workflowName:t.workflow_name,prompt:t.prompt,toolUseId:t.tool_use_id,status:"running",startTime:l}}}}if(r==="task_progress"){if(!c){const b=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:oe(b),description:b,toolUseId:t.tool_use_id,status:"running",startTime:l,tokenCount:(u=t.usage)==null?void 0:u.total_tokens,toolUseCount:(p=t.usage)==null?void 0:p.tool_uses,durationMs:(f=t.usage)==null?void 0:f.duration_ms,lastToolName:t.last_tool_name,summary:t.summary}}}}return{tasks:{...s.tasks,[n]:{...c,description:t.description??c.description,tokenCount:((x=t.usage)==null?void 0:x.total_tokens)??c.tokenCount,toolUseCount:((g=t.usage)==null?void 0:g.tool_uses)??c.toolUseCount,durationMs:((j=t.usage)==null?void 0:j.duration_ms)??c.durationMs,lastToolName:t.last_tool_name??c.lastToolName,summary:t.summary??c.summary}}}}return c?{tasks:{...s.tasks,[n]:{...c,status:t.status??"completed",endTime:l,finalSummary:t.summary??c.finalSummary,outputFile:t.output_file??c.outputFile,tokenCount:((m=t.usage)==null?void 0:m.total_tokens)??c.tokenCount,toolUseCount:((y=t.usage)==null?void 0:y.tool_uses)??c.toolUseCount,durationMs:((k=t.usage)==null?void 0:k.duration_ms)??c.durationMs,evictAfter:l+Ue}}}:{tasks:{...s.tasks,[n]:{taskId:n,name:oe(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:l,endTime:l,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(N=t.usage)==null?void 0:N.total_tokens,toolUseCount:(i=t.usage)==null?void 0:i.tool_uses,durationMs:(a=t.usage)==null?void 0:a.duration_ms,evictAfter:l+Ue}}}}function ks(s,t=Date.now()){return Object.values(s.tasks).filter(r=>r.evictAfter===void 0||r.evictAfter>t).sort((r,n)=>r.startTime-n.startTime)}class ws{constructor(){E(this,"listeners",new Set);E(this,"eventSource",null);E(this,"_lastSeqNum",0)}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}connect(t){this.disconnect();const r=`/web/sessions/${t}/events`,n=new EventSource(r,{withCredentials:!0});this.eventSource=n,n.addEventListener("message",l=>{try{const c=JSON.parse(l.data);if(c.seqNum!==void 0&&c.seqNum<=this._lastSeqNum)return;c.seqNum!==void 0&&(this._lastSeqNum=c.seqNum);for(const u of this.listeners)u(c)}catch{}})}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._lastSeqNum=0}}const le=new ws;function Fe(s){if(typeof s.content=="string")return s.content;if(s.message&&typeof s.message=="object"){const t=s.message;if(typeof t.content=="string")return t.content;if(Array.isArray(t.content))return t.content.filter(r=>r.type==="text"&&typeof r.text=="string").map(r=>r.text).join("")}return""}function Oe(s,t){for(let r=s.length-1;r>=0;r--){const n=s[r];if(n&&n.type==="tool_call"&&n.toolCall.id===t)return r}return-1}const ke="streaming-";function Ns(s){const t=s.message;if(!t||typeof t!="object"||!Array.isArray(t.content))return"";const r=[];for(const n of t.content)if((n==null?void 0:n.type)==="thinking"){const l=typeof n.thinking=="string"&&n.thinking||typeof n.text=="string"&&n.text||"";l&&r.push(l)}return r.join("")}function Le(s){return s.filter(t=>typeof t.subject=="string"&&t.subject).map(t=>({content:t.subject,priority:"medium",status:t.status==="completed"?"completed":t.status==="in_progress"?"in_progress":"pending"}))}class vs{constructor(t,r,n){E(this,"sessionId");E(this,"setEntries");E(this,"unsub",null);E(this,"onStatusChange");E(this,"onError");E(this,"onPermissionRequest");E(this,"onModelsStateChange");E(this,"onSubagentUpdate");E(this,"onControlResponse");E(this,"onPermissionModeChange");E(this,"onUsageChange");E(this,"onElicitationRequest");E(this,"subagentState",lt());E(this,"seenUuids",new Set);E(this,"seenToolCallIds",new Set);E(this,"pendingControlRequests",new Map);E(this,"turnEnded",!1);E(this,"userSinceTurnEnd",!1);E(this,"closed",!1);this.sessionId=t,this.setEntries=r,this.onStatusChange=n==null?void 0:n.onStatusChange,this.onError=n==null?void 0:n.onError,this.onPermissionRequest=n==null?void 0:n.onPermissionRequest,this.onModelsStateChange=n==null?void 0:n.onModelsStateChange,this.onSubagentUpdate=n==null?void 0:n.onSubagentUpdate,this.onControlResponse=n==null?void 0:n.onControlResponse,this.onPermissionModeChange=n==null?void 0:n.onPermissionModeChange,this.onUsageChange=n==null?void 0:n.onUsageChange,this.onElicitationRequest=n==null?void 0:n.onElicitationRequest}markClosed(){this.closed=!0}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var x,g,j;const{events:t}=await kt(this.sessionId);if(!t||t.length===0)return;const r=[];let n=null;const l=()=>{n&&(r.push(n),n=null)};for(const N of t){const i=N.payload||{},a=i.uuid;if(typeof a=="string"&&a&&this.seenUuids.add(a),N.type==="tool_use"){const m=i.tool_call_id;typeof m=="string"&&m&&this.seenToolCallIds.add(m)}if(N.type==="user"){if(N.direction==="inbound")continue;l();const m=Fe(i);m&&r.push({type:"user_message",id:N.id||`hist-user-${r.length}`,content:m})}else if(N.type==="assistant"){l();const m=Fe(i);if(Ie(m))continue;const y=[],k=i.message;if(k&&typeof k=="object"&&Array.isArray(k.content)){for(const b of k.content)if(b.type==="tool_use"){const C=b.id;C&&this.seenToolCallIds.add(C),y.push({type:"tool_call",toolCall:{id:C||`hist-tool-${r.length}`,title:b.name||"tool",status:"complete",rawInput:b.input||{}}})}}if(m||y.length>0){n={type:"assistant_message",id:N.id||`hist-asst-${r.length}`,chunks:m?[{type:"message",text:m}]:[]},r.push(n);for(const b of y)r.push(b);n=null}}else if(N.type==="tool_use"){const m=i,y={type:"tool_call",toolCall:{id:m.tool_call_id||`hist-tool-${r.length}`,title:m.tool_name||"tool",status:"complete",rawInput:m.tool_input||{}}};r.push(y)}else if(N.type==="tool_result"){const m=i,y=Oe(r,m.tool_call_id||"");if(y>=0){const k=r[y];r[y]={type:"tool_call",toolCall:{...k.toolCall,rawOutput:{output:m.content||m.output||""}}}}}}l();let c=null;for(const N of t){if(N.type!=="task_state")continue;const i=N.payload||{};Array.isArray(i.tasks)&&(c=i.tasks)}if(c&&c.length>0){const N=Le(c);N.length>0&&r.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:N})}this.setEntries(r);let u=null,p=null,f=null;for(const N of t){const i=N.payload||{};if(N.type==="user"?f="user":(N.type==="result"||N.type==="result_success"||N.type==="interrupt")&&(f="turn_end"),N.type==="models_state"){const a=i.raw,m=a&&typeof a=="object"?a.models_state:i.models_state;m&&Array.isArray(m.availableModels)&&typeof m.currentModelId=="string"&&(u=m)}else if(N.type==="result"||N.type==="result_success"){const a=i.usage,m=typeof i.total_cost_usd=="number"?i.total_cost_usd:null;(a||m!==null)&&(p={inputTokens:((a==null?void 0:a.input_tokens)??0)+((a==null?void 0:a.cache_read_input_tokens)??0)+((a==null?void 0:a.cache_creation_input_tokens)??0),outputTokens:(a==null?void 0:a.output_tokens)??0,totalCostUsd:m})}}u&&((x=this.onModelsStateChange)==null||x.call(this,u)),p&&((g=this.onUsageChange)==null||g.call(this,p)),this.turnEnded=f==="turn_end",this.userSinceTurnEnd=f==="user",this.turnEnded&&!this.closed&&((j=this.onStatusChange)==null||j.call(this,"idle"))}connectSSE(){le.connect(this.sessionId),this.unsub=le.onEvent(t=>this.handleEvent(t))}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),le.disconnect()}handleEvent(t){var l,c,u,p,f,x,g,j,N;const r=t.type,n=t.payload||{};switch(r){case"user":{this.userSinceTurnEnd=!0;break}case"assistant":{const i=n.uuid;if(typeof i=="string"&&i){if(this.seenUuids.has(i))break;this.seenUuids.add(i)}const a=typeof n.content=="string"?n.content:"";if(Ie(a))break;const m=Ns(n);this.setEntries(k=>{const b=k[k.length-1];if((b==null?void 0:b.type)==="assistant_message"&&b.id.startsWith(ke))return[...k.slice(0,-1),{...b,id:`assistant-${Date.now()}`,chunks:[...m?[{type:"thought",text:m}]:[],{type:"message",text:a}]}];if((b==null?void 0:b.type)==="assistant_message"){const C=b.chunks[b.chunks.length-1];return(C==null?void 0:C.type)==="message"?[...k.slice(0,-1),{...b,chunks:[...b.chunks.slice(0,-1),{type:"message",text:C.text+a}]}]:[...k.slice(0,-1),{...b,chunks:[...b.chunks,{type:"message",text:a}]}]}if(a&&a.trim()||m){const C={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...m?[{type:"thought",text:m}]:[],...a?[{type:"message",text:a}]:[]]};return[...k,C]}return k});const y=n.message;if(y&&typeof y=="object"&&Array.isArray(y.content)){const k=y.content.filter(b=>b.type==="tool_use");for(const b of k){const C=b.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(C))continue;this.seenToolCallIds.add(C);const $={id:C,title:b.name||"tool",status:"running",rawInput:b.input||{}};this.setEntries(M=>[...M,{type:"tool_call",toolCall:$}])}}break}case"tool_use":{const i=n,a=i.tool_call_id||`call-${Date.now()}`;if(this.seenToolCallIds.has(a))break;this.seenToolCallIds.add(a);const m={id:a,title:i.tool_name||"tool",status:"running",rawInput:i.tool_input||{}};this.setEntries(y=>[...y,{type:"tool_call",toolCall:m}]);break}case"tool_result":{const i=n,a=i.tool_call_id||"";this.setEntries(m=>{const y=Oe(m,a);if(y<0)return m;const k=m[y];return m.map((b,C)=>C===y?{type:"tool_call",toolCall:{...k.toolCall,status:"complete",rawOutput:{output:i.content||i.output||""}}}:b)});break}case"control_request":case"permission_request":{const i=n.request;if(i&&i.subtype==="can_use_tool"){const a=n.request_id||"",m=i.tool_name||"unknown",y=i.input||i.tool_input||{},k=i.description||"",b=Array.isArray(i.permission_suggestions)?i.permission_suggestions:[];this.setEntries(C=>{const $=[...C].reverse().findIndex(M=>M.type==="tool_call");if($>=0){const M=C.length-1-$,A=C[M];if(A.toolCall.status==="running")return C.map((U,q)=>q===M?{type:"tool_call",toolCall:{...A.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:a,options:[]}}}:U)}return C}),(l=this.onPermissionRequest)==null||l.call(this,{requestId:a,toolName:m,toolInput:y,description:k,suggestions:b})}else i&&i.subtype==="elicitation"&&((c=this.onElicitationRequest)==null||c.call(this,{requestId:n.request_id||"",serverName:i.mcp_server_name||"",message:i.message||"",mode:i.mode==="url"?"url":"form",url:typeof i.url=="string"?i.url:void 0,requestedSchema:i.requested_schema||void 0}));break}case"session_status":{if(wt(n)){this.setEntries([]);break}if(typeof n.status=="string"){if(we(n.status))this.closed=!0;else if(this.closed)break;if(n.status==="running"&&this.turnEnded&&!this.userSinceTurnEnd)break;(u=this.onStatusChange)==null||u.call(this,n.status)}break}case"error":{const i=String(n.message||n.content||"Unknown error");(p=this.onError)==null||p.call(this,i);break}case"models_state":{const i=n.raw,a=typeof i=="object"&&i!==null?i.models_state:n.models_state;a&&Array.isArray(a.availableModels)&&typeof a.currentModelId=="string"&&((f=this.onModelsStateChange)==null||f.call(this,a));break}case"system":{const i=n.raw,a=i&&typeof i=="object"?i:n,m=typeof a.subtype=="string"?a.subtype:void 0;if(m==="task_started"||m==="task_progress"||m==="task_notification"){const k={subtype:m,task_id:typeof a.task_id=="string"?a.task_id:void 0,tool_use_id:typeof a.tool_use_id=="string"?a.tool_use_id:void 0,description:typeof a.description=="string"?a.description:void 0,task_type:typeof a.task_type=="string"?a.task_type:void 0,workflow_name:typeof a.workflow_name=="string"?a.workflow_name:void 0,prompt:typeof a.prompt=="string"?a.prompt:void 0,usage:a.usage&&typeof a.usage=="object"?a.usage:void 0,last_tool_name:typeof a.last_tool_name=="string"?a.last_tool_name:void 0,summary:typeof a.summary=="string"?a.summary:void 0,status:a.status==="completed"||a.status==="failed"||a.status==="stopped"?a.status:void 0,output_file:typeof a.output_file=="string"?a.output_file:void 0};this.subagentState=js(this.subagentState,k)}const y=typeof a.permissionMode=="string"?a.permissionMode:typeof n.permissionMode=="string"?n.permissionMode:null;y&&((x=this.onPermissionModeChange)==null||x.call(this,y));break}case"control_response":{const i=n.response;if(i&&typeof i=="object"){const a=typeof i.request_id=="string"?i.request_id:"",m=typeof i.subtype=="string"?i.subtype:"";if(a){(g=this.onControlResponse)==null||g.call(this,{subtype:m,requestId:a,error:typeof i.error=="string"?i.error:void 0});const y=this.pendingControlRequests.get(a);y&&(this.pendingControlRequests.delete(a),y(m==="success"&&i.response&&typeof i.response=="object"?i.response:null))}}break}case"stream_event":{const i=n.event;if(!i||typeof i.type!="string")break;if(i.type==="content_block_delta"){const a=i.delta;if(!a||typeof a.type!="string")break;const m=a.type==="text_delta"?"message":a.type==="thinking_delta"?"thought":null;if(!m)break;const y=a.text??a.thinking;if(typeof y!="string"||!y)break;this.appendStreamingDelta(m,y)}break}case"partial_assistant":{const i=typeof n.content=="string"?n.content:"";i&&this.appendStreamingDelta("message",i);break}case"result":case"result_success":{this.turnEnded=!0,this.userSinceTurnEnd=!1,this.closed||(j=this.onStatusChange)==null||j.call(this,"idle");const i=n.usage,a=typeof n.total_cost_usd=="number"?n.total_cost_usd:null;if(i||a!==null){const m=((i==null?void 0:i.input_tokens)??0)+((i==null?void 0:i.cache_read_input_tokens)??0)+((i==null?void 0:i.cache_creation_input_tokens)??0);(N=this.onUsageChange)==null||N.call(this,{inputTokens:m,outputTokens:(i==null?void 0:i.output_tokens)??0,totalCostUsd:a})}break}case"task_state":{const i=Array.isArray(n.tasks)?n.tasks:[];if(i.length===0)break;const a=Le(i);if(a.length===0)break;this.setEntries(m=>[...m.filter(k=>k.type!=="plan"),{type:"plan",id:`plan-${n.task_list_id||Date.now()}`,entries:a}]);break}}}appendStreamingDelta(t,r){this.setEntries(n=>{const l=n[n.length-1];if((l==null?void 0:l.type)==="assistant_message"&&l.id.startsWith(ke)){const u=l.chunks[l.chunks.length-1];return(u==null?void 0:u.type)===t?[...n.slice(0,-1),{...l,chunks:[...l.chunks.slice(0,-1),{type:t,text:u.text+r}]}]:[...n.slice(0,-1),{...l,chunks:[...l.chunks,{type:t,text:r}]}]}const c={type:"assistant_message",id:`${ke}${Date.now()}`,chunks:[{type:t,text:r}]};return[...n,c]})}async sendMessage(t,r,n){const l=r&&r.length>0,c=n&&n.length>0;if(!t.trim()&&!l&&!c)return;const u={type:"user_message",id:`user-${Date.now()}`,content:t,images:l?r:void 0,attachments:c?n:void 0};this.setEntries(x=>[...x,u]);const p=[];if(t&&p.push({type:"text",text:t}),l)for(const x of r)p.push({type:"image",source:{type:"base64",media_type:x.mimeType,data:x.data}});if(c){for(const x of n)if(x.kind==="text"||x.kind==="table"){const g=`📎 ${x.name}${x.size!=null?` (${_s(x.size)})`:""}`,j=x.textContent||"(空文件)";p.push({type:"text",text:`${g}
57
+ \`\`\`
58
+ ${j}
59
+ \`\`\``})}else if(x.kind==="directory"){const g=`📁 目录: ${x.name}${x.files!=null?` (${x.files.length} 个文件)`:""}`,j=x.textContent||"(空目录)";p.push({type:"text",text:`${g}
60
+ ${j}`})}}const f=p.length===1&&p[0].type==="text"?p[0].text||t:p.length>0?p:t;try{await Nt(this.sessionId,{type:"user",uuid:je(),content:t,message:{content:f}})}catch(x){throw this.setEntries(g=>g.filter(j=>!(j.type==="user_message"&&j.id===u.id))),x}}async respondPermission(t,r,n){await L(this.sessionId,{type:"permission_response",approved:r,request_id:t,...n}),this.setEntries(l=>l.map(c=>{var u;return c.type!=="tool_call"||((u=c.toolCall.permissionRequest)==null?void 0:u.requestId)!==t?c:{type:"tool_call",toolCall:{...c.toolCall,status:r?"running":"rejected",permissionRequest:void 0}}}))}async interrupt(){this.setEntries(t=>t.map(r=>r.type!=="tool_call"||r.toolCall.status!=="running"&&r.toolCall.status!=="waiting_for_confirmation"?r:{type:"tool_call",toolCall:{...r.toolCall,status:"canceled",permissionRequest:void 0}})),await vt(this.sessionId)}async setPermissionMode(t){const r=je();return await L(this.sessionId,{type:"control_request",request_id:r,request:{subtype:"set_permission_mode",mode:t}}),r}async searchFiles(t,r=20){const n=je(),l=new Promise(u=>{this.pendingControlRequests.set(n,u)});await L(this.sessionId,{type:"control_request",request_id:n,request:{subtype:"file_search",query:t,limit:r}});const c=setTimeout(()=>{const u=this.pendingControlRequests.get(n);u&&(this.pendingControlRequests.delete(n),u(null))},8e3);try{const u=await l;if(!u||!Array.isArray(u.suggestions))return[];const p=[];for(const f of u.suggestions)f&&typeof f=="object"&&typeof f.path=="string"&&p.push(f.path);return p}finally{clearTimeout(c)}}async respondElicitation(t,r,n){await L(this.sessionId,{type:"permission_response",approved:r==="accept",request_id:t,response:{subtype:"success",request_id:t,response:{action:r,...n?{content:n}:{}}}})}}function _s(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Ss(s){if(!s)return"never";const t=Math.max(0,Date.now()-s);return t<5e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function Cs(s){return s?Date.now()-s<6e4:!1}function Es({onClose:s,session:t,liveStatus:r,pendingPermissions:n,onInterrupt:l,onDelete:c}){const[u,p]=d.useState(!1),f=async()=>{await navigator.clipboard.writeText(t.id),p(!0),setTimeout(()=>p(!1),1500)},x=n.length,g=t.worker,j=t.work_item,N=t.environment;return e.jsx(nt,{open:!0,onOpenChange:i=>{i||s()},children:e.jsxs(rt,{showCloseButton:!1,className:"fixed inset-y-0 right-0 top-auto left-auto translate-x-0 translate-y-0 w-full sm:w-96 h-full max-w-none max-h-none rounded-none border-l border-border bg-surface-1 p-4 sm:max-w-md overflow-y-auto",children:[e.jsx(at,{children:e.jsx(ot,{className:"font-display font-semibold text-text-primary",children:"Session Ops"})}),e.jsxs("div",{className:"mt-3 space-y-5 text-sm",children:[e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(es,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(We,{status:r||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:g&&(Cs(g.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[g&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Pe,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:Ss(g.last_heartbeat_at)})]}),N&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(it,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:N.machine_name||N.id})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Pe,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:Qe(t.created_at)})]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(Ge,{className:"h-3.5 w-3.5"}),"Pending Actions"]}),x>0?e.jsxs("div",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning",children:[x," permission request",x>1?"s":""," awaiting your approval"]}):e.jsx("p",{className:"text-xs text-text-muted",children:"No pending actions"})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(xs,{className:"h-3.5 w-3.5"}),"Quick Actions"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:l,className:"flex-1 rounded-md border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-2 transition-colors",children:"Interrupt"}),e.jsxs("button",{onClick:c,className:"flex-1 rounded-md border border-status-error/30 px-3 py-1.5 text-xs text-status-error hover:bg-status-error/10 transition-colors",children:[e.jsx(_t,{className:"mr-1 inline h-3 w-3"}),"Delete"]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(as,{className:"h-3.5 w-3.5"}),"Session Info"]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("dt",{children:"Session ID"}),e.jsxs("dd",{className:"flex items-center gap-1 min-w-0",children:[e.jsx("code",{className:"break-all font-mono text-text-secondary text-right",children:t.id}),e.jsx("button",{onClick:f,className:"text-text-muted hover:text-text-primary transition-colors flex-shrink-0",title:"Copy session id",children:u?"✓":"⧉"})]})]}),j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Spawn mode"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:j.spawn_mode??"default"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Work state"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:j.state})]})]}),t.source&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Source"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:t.source})]}),N&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker type"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:N.worker_type})]})]})]})]})]})})}const Be="rcs:subagent-panel:collapsed";function Ms(s){if(s<1e3)return"0s";const t=Math.floor(s/1e3);if(t<60)return`${t}s`;const r=Math.floor(t/60),n=t%60;if(r<60)return n?`${r}m${n}s`:`${r}m`;const l=Math.floor(r/60),c=r%60;return c?`${l}h${c}m`:`${l}h`}function Ts(s){return s===void 0||s<=0?"":s<1e3?`${s}`:s<1e6?`${(s/1e3).toFixed(s<1e4?1:0)}k`:`${(s/1e6).toFixed(1)}M`}function Rs({status:s}){return s==="running"?e.jsx(Ge,{className:"h-3 w-3 animate-spin text-brand"}):s==="completed"?e.jsx(us,{className:"h-3 w-3 text-status-success"}):s==="failed"||s==="stopped"?e.jsx(St,{className:"h-3 w-3 text-status-error"}):null}function As({task:s}){const t=s.status==="running",r=t?s.durationMs??Date.now()-s.startTime:(s.endTime??Date.now())-s.startTime,n=Ts(s.tokenCount),l=s.toolUseCount!==void 0&&s.toolUseCount>0?`${s.toolUseCount} tool${s.toolUseCount>1?"s":""}`:"",c=s.summary||s.description||"(no description)";return e.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-xs",children:[e.jsx("div",{className:"mt-0.5 flex-shrink-0",children:e.jsx(Rs,{status:s.status})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:s.name}),e.jsx("span",{className:"flex-shrink-0 font-mono text-text-muted",children:Ms(r)})]}),e.jsx("div",{className:"mt-0.5 truncate text-text-secondary",children:c}),(n||l||s.lastToolName)&&e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-[10px] text-text-muted",children:[n&&e.jsxs("span",{children:["↕ ",n," tok"]}),l&&e.jsxs("span",{children:["· ",l]}),s.lastToolName&&e.jsxs("span",{className:"truncate",children:["· last: ",s.lastToolName]})]}),!t&&s.finalSummary&&e.jsx("div",{className:"mt-1 rounded bg-status-success/10 px-1.5 py-0.5 text-[10px] text-status-success",children:s.finalSummary})]})]})}function $s({state:s}){const[t,r]=d.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Be)==="1"}catch{return!1}}),n=()=>{r(f=>{const x=!f;try{window.localStorage.setItem(Be,x?"1":"0")}catch{}return x})},[,l]=d.useState(0);d.useEffect(()=>{const f=Object.values(s.tasks).some(j=>j.status==="running"),x=Object.values(s.tasks).some(j=>j.status!=="running"&&j.evictAfter!==void 0);if(!f&&!x)return;const g=setInterval(()=>{l(j=>j+1)},1e3);return()=>clearInterval(g)},[s]);const c=ks(s);if(c.length===0)return null;const u=c.filter(f=>f.status==="running").length,p=u>0?`${u} running`:`${c.length} recent`;return e.jsx("section",{"aria-label":"Subagents",className:"border-t border-border bg-surface-1 px-4 py-2",children:e.jsxs("div",{className:"mx-auto max-w-3xl space-y-1.5",children:[e.jsxs("button",{type:"button",onClick:n,"aria-expanded":!t,"aria-controls":"subagent-list",className:"flex w-full items-center justify-between text-[10px] font-medium uppercase tracking-wide text-text-muted hover:text-text-secondary transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ss,{className:`h-3 w-3 transition-transform ${t?"":"rotate-90"}`}),e.jsx("span",{children:"Subagents"})]}),e.jsx("span",{children:p})]}),!t&&e.jsx("div",{id:"subagent-list",className:"space-y-1.5",children:c.map(f=>e.jsx(As,{task:f},f.taskId))})]})})}function He(s,t){var l;const r=(l=t==null?void 0:t.find(c=>c.type==="addRules"||c.type==="replaceRules"))==null?void 0:l.rules,n=r==null?void 0:r[0];return n!=null&&n.ruleContent?`${n.toolName}(${n.ruleContent})`:n!=null&&n.toolName?n.toolName:s}function Is({requestId:s,toolName:t,toolInput:r,description:n,suggestions:l,onApprove:c,onApproveAlways:u,onReject:p}){const f=typeof r=="string"?r:JSON.stringify(r,null,2),x=Array.isArray(l)&&l.length>0;return e.jsxs("div",{className:"rounded-xl border border-warning-border/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-warning-border/15 text-warning-text",children:e.jsx(bs,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-semibold text-warning-text",children:"Permission Request"})]}),n&&e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:P(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:P(t)}),t!=="AskUserQuestion"&&e.jsx("pre",{className:"mb-3 max-h-40 overflow-auto rounded-lg bg-surface-1 p-2 text-xs text-text-secondary font-mono",children:qe(f,500)}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:c,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Approve"}),x&&u&&e.jsxs("button",{onClick:u,className:"flex items-center gap-1.5 rounded-lg border border-brand/40 bg-brand/10 px-4 py-2 text-sm font-medium text-brand hover:bg-brand/20 transition-colors",title:`允许并记住规则:${He(t,l)}`,children:[e.jsx(ys,{className:"h-3.5 w-3.5"}),"Always allow ",qe(He(t,l),40)]}),e.jsx("button",{onClick:p,className:"rounded-lg bg-status-error/20 px-4 py-2 text-sm font-medium text-status-error hover:bg-status-error/30 transition-colors",children:"Reject"})]})]})}function Ps({questions:s,description:t,onSubmit:r,onSkip:n}){const[l,c]=d.useState({}),[u,p]=d.useState({}),[f,x]=d.useState(0),g=(a,m,y)=>{if(y){const k=l[a]||[],b=k.includes(m)?k.filter(C=>C!==m):[...k,m];c({...l,[a]:b})}else c({...l,[a]:m})},j=a=>{var y;const m=(y=u[a])==null?void 0:y.trim();m&&(c({...l,[a]:m}),p({...u,[a]:""}))},N=()=>{var m,y;const a={};for(const[k,b]of Object.entries(l)){const C=s[parseInt(k,10)];C&&(typeof b=="number"?a[k]=((y=(m=C.options)==null?void 0:m[b])==null?void 0:y.label)||String(b):Array.isArray(b)?a[k]=b.map($=>{var M,A;return((A=(M=C.options)==null?void 0:M[$])==null?void 0:A.label)||String($)}):a[k]=b)}r(a)};if(s.length<=1){const a=s[0]||{question:t,options:[],multiSelect:!1},m=a.multiSelect||!1;return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold text-text-primary",children:P(t||a.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(a.options||[]).map((y,k)=>{const b=m?(l[0]||[]).includes(k):l[0]===k;return e.jsxs("button",{onClick:()=>g(0,k,m),className:J("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",b?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:P(y.label)}),y.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:P(y.description)})]},k)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:u[0]||"",onChange:y=>p({...u,0:y.target.value}),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:y=>y.key==="Enter"&&j(0)}),e.jsx("button",{onClick:()=>j(0),className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("button",{onClick:N,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Submit"}),e.jsx("button",{onClick:n,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})}const i=s[f];return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold text-text-primary",children:P(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:s.map((a,m)=>e.jsx("button",{onClick:()=>x(m),className:J("rounded-md px-3 py-1.5 text-xs whitespace-nowrap transition-colors",f===m?"bg-brand/20 text-brand":"text-text-muted hover:bg-surface-2"),children:a.header||`Q${m+1}`},m))}),i&&e.jsx(qs,{question:i,qIdx:f,answers:l,otherTexts:u,onSelect:g,onOtherTextChange:(a,m)=>p({...u,[a]:m}),onOtherSubmit:j}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[f+1," / ",s.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:N,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Submit All"}),e.jsx("button",{onClick:n,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})]})}function qs({question:s,qIdx:t,answers:r,otherTexts:n,onSelect:l,onOtherTextChange:c,onOtherSubmit:u}){const p=s.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:P(s.question)}),e.jsxs("div",{className:"space-y-2",children:[(s.options||[]).map((f,x)=>{const g=p?(r[t]||[]).includes(x):r[t]===x;return e.jsxs("button",{onClick:()=>l(t,x,p),className:J("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",g?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:P(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:P(f.description)})]},x)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:n[t]||"",onChange:f=>c(t,f.target.value),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:f=>f.key==="Enter"&&u(t)}),e.jsx("button",{onClick:()=>u(t),className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]})]})}function Ds({planContent:s,description:t,onSubmit:r}){const[n,l]=d.useState(null),[c,u]=d.useState(""),p=!s||!s.trim(),f=()=>{n&&r(n,n==="no"?c:void 0)};return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-brand/15 text-brand",children:e.jsx(Ke,{className:"h-3 w-3",strokeWidth:2.5})}),e.jsx("span",{className:"text-sm font-semibold text-text-primary",children:p?"Exit plan mode?":"Ready to code?"})]}),!p&&e.jsx("div",{className:"mb-4 max-h-64 overflow-auto rounded-lg bg-tool-card p-4 text-sm text-text-secondary",dangerouslySetInnerHTML:{__html:Us(s)}}),e.jsx("div",{className:"space-y-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(Y,{selected:n==="yes-default",onClick:()=>l("yes-default"),label:"Yes"}),e.jsx(Y,{selected:n==="no",onClick:()=>l("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{selected:n==="yes-accept-edits",onClick:()=>l("yes-accept-edits"),label:"Yes, auto-accept edits",desc:"Approve plan and auto-accept file edits"}),e.jsx(Y,{selected:n==="yes-default",onClick:()=>l("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(Y,{selected:n==="no",onClick:()=>l("no"),label:"No, keep planning",desc:"Provide feedback to refine the plan"})]})}),n==="no"&&e.jsx("textarea",{value:c,onChange:x=>u(x.target.value),placeholder:"Tell Saluzi what to change...",className:"mt-3 w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",rows:3}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:f,disabled:!n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"Submit"})})]})}function Y({selected:s,onClick:t,label:r,desc:n}){return e.jsxs("button",{onClick:t,className:J("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",s?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:J("flex h-4 w-4 items-center justify-center rounded-full border text-[10px] transition-colors",s?"border-brand bg-brand text-white":"border-border"),children:s&&"✓"}),e.jsx("span",{className:"font-medium",children:r})]}),n&&e.jsx("div",{className:"mt-0.5 pl-6 text-xs text-text-muted",children:n})]})}function Us(s){let t=P(s);return t=t.replace(/```(\w*)\n?([\s\S]*?)```/g,(r,n,l)=>`<pre class="my-2 overflow-x-auto rounded-lg bg-tool-card p-3 font-mono text-xs">${l.trim()}</pre>`),t=t.replace(/`([^`]+)`/g,'<code class="rounded bg-tool-card px-1.5 py-0.5 font-mono text-xs">$1</code>'),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t}function Fs({request:s,onSubmit:t}){const r=Os(s.requestedSchema),n=Ls(s.requestedSchema),[l,c]=d.useState({}),u=r.length===0||n.every(p=>(l[p]??"").trim()!=="");return s.mode==="url"&&s.url?e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx(ze,{serverName:s.serverName,message:s.message}),e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex w-full items-center justify-between rounded-lg border border-border bg-surface-2 px-4 py-2.5 text-sm text-brand hover:bg-brand/10 transition-colors",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:s.url}),e.jsx(Kt,{className:"ml-2 h-4 w-4 flex-shrink-0"})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("button",{onClick:()=>t("accept"),className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"完成"}),e.jsx("button",{onClick:()=>t("cancel"),className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"取消"})]})]}):e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx(ze,{serverName:s.serverName,message:s.message}),r.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:r.map(({name:p,prop:f})=>e.jsxs("label",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs font-medium text-text-primary",children:p}),n.includes(p)&&e.jsx("span",{className:"text-[10px] font-medium text-warning-text",children:"必填"})]}),f.description&&e.jsx("div",{className:"mb-1 text-xs text-text-muted",children:P(f.description)}),e.jsx("input",{type:f.type==="number"?"number":"text",value:l[p]??"",onChange:x=>c(g=>({...g,[p]:x.target.value})),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]},p))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{const p={};for(const{name:f,prop:x}of r){const g=(l[f]??"").trim();g&&(p[f]=x.type==="number"?Number(g):g)}t("accept",p)},disabled:!u,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"提交"}),e.jsx("button",{onClick:()=>t("decline"),className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"拒绝"})]})]})}function ze({serverName:s,message:t}){return e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-brand/15 text-brand",children:e.jsx(cs,{className:"h-3 w-3"})}),e.jsxs("span",{className:"text-sm font-semibold text-text-primary",children:["MCP 请求输入 ",e.jsx("span",{className:"font-mono text-xs text-text-muted",children:P(s)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:P(t)})]})}function Os(s){const t=s==null?void 0:s.properties;return!t||typeof t!="object"?[]:Object.entries(t).filter(([,r])=>r&&typeof r=="object").map(([r,n])=>({name:r,prop:n}))}function Ls(s){const t=s==null?void 0:s.required;return Array.isArray(t)?t.filter(r=>typeof r=="string"):[]}function Bs(s){const[t,r]=d.useState([]),[n,l]=d.useState(!0),[c,u]=d.useState(null),p=d.useCallback(async()=>{l(!0),u(null);try{const g=await Ct(s);r(g)}catch(g){u(g instanceof Error?g.message:"Failed to load shares")}finally{l(!1)}},[s]);d.useEffect(()=>{p()},[p]);const f=d.useCallback(async g=>{u(null);try{const j=await Et(s,g);return await p(),j}catch(j){throw u(j instanceof Error?j.message:"Failed to create share"),j}},[s,p]),x=d.useCallback(async g=>{u(null);try{await Mt(s,g),await p()}catch(j){throw u(j instanceof Error?j.message:"Failed to revoke share"),j}},[s,p]);return{shares:t,isLoading:n,error:c,createShare:f,revokeShare:x,refresh:p}}function Hs({open:s,onClose:t,sessionId:r,sessionTitle:n}){Ye();const{shares:l,isLoading:c,error:u,createShare:p,revokeShare:f}=Bs(r),[x,g]=d.useState("user"),[j,N]=d.useState(""),[i,a]=d.useState(""),[m,y]=d.useState("read"),[k,b]=d.useState(""),[C,$]=d.useState(!1),[M,A]=d.useState(null),[U,q]=d.useState(""),[B,R]=d.useState(!1),[W,Q]=d.useState(!1);d.useEffect(()=>{s&&(g("user"),N(""),a(""),y("read"),b(""),$(!1),A(null),q(""),R(!1),Q(!1))},[s]);const ce=async()=>{$(!0),q(""),A(null);try{const S={grantedTo:x==="user"?{userId:j.trim()}:{teamId:i.trim()},permission:m};k.trim()&&(S.expiresAt=k.trim());const X=await p(S);A(`${window.location.origin}/code/s/${X.shareToken}`)}catch(S){q(S instanceof Error?S.message:"Failed to create share")}finally{$(!1)}},z=async S=>{try{await f(S)}catch{}},de=async()=>{if(!M)return;Q(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(M),R(!0),setTimeout(()=>R(!1),2e3);return}}catch{}const S=document.createElement("textarea");S.value=M,S.style.position="fixed",S.style.opacity="0",document.body.appendChild(S),S.select();try{document.execCommand("copy"),R(!0),setTimeout(()=>R(!1),2e3)}catch{Q(!0)}document.body.removeChild(S)};return e.jsx(nt,{open:s,onOpenChange:S=>{S||t()},children:e.jsxs(rt,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(at,{children:e.jsxs(ot,{className:"font-display text-lg font-semibold text-text-primary",children:[w("share.title"),n?`: ${n}`:""]})}),e.jsxs("div",{className:"space-y-4 min-w-0",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:w("share.grantTo")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>g("user"),className:`rounded-md px-3 py-1 text-sm transition-colors ${x==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:w("share.user")}),e.jsx("button",{onClick:()=>g("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${x==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:w("share.team")})]}),x==="user"?e.jsx(Xt,{onSelect:N,placeholder:w("share.userIdPlaceholder"),actionLabel:w("share.selectUser")}):e.jsx("input",{type:"text",value:i,onChange:S=>a(S.target.value),placeholder:w("share.teamIdPlaceholder"),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"}),x==="user"&&j&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[w("share.selectedUser"),": ",e.jsx("span",{className:"font-mono",children:j})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:w("share.permission")}),e.jsxs("select",{value:m,onChange:S=>y(S.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"read",children:w("share.permissionRead")}),e.jsx("option",{value:"write",children:w("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:w("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:k,onChange:S=>b(S.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none"})]}),(U||u)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:U||u}),M&&e.jsxs("div",{className:"rounded-md bg-surface-2 px-3 py-2",children:[e.jsx("p",{className:"text-sm text-text-secondary mb-1",children:w("share.linkCreated")}),e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs text-text-primary",children:M}),e.jsx("button",{onClick:de,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:B?w("share.copied"):w("share.copy")})]}),W&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:w("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:w("share.existingShares")}),c?e.jsx("p",{className:"text-sm text-text-muted",children:w("share.loading")}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:w("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:l.map(S=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md bg-surface-2 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm text-text-primary",children:S.granted_to_user||S.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[S.permission==="write"?w("share.permissionWrite"):w("share.permissionRead"),S.expires_at?` · expires ${S.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>z(S.id),className:"shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:w("share.revoke")})]},S.id))})]})]}),e.jsxs(Gt,{children:[e.jsx("button",{onClick:t,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:w("common.close")}),e.jsx("button",{onClick:ce,disabled:C||(x==="user"?!j.trim():!i.trim()),className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:C?w("common.creating"):w("share.createShare")})]})]})})}function zs(s){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${s}`}function Vs(s){const t=zs(s),r=Rt(),n=r?{proxyUrl:t,token:r}:{proxyUrl:t};return new Tt(n)}const V=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"}],ie="rcs_permission_mode";function Ve(s){return s<1e3?String(s):s<1e6?`${(s/1e3).toFixed(1)}k`:`${(s/1e6).toFixed(1)}M`}function Ws(s){const t=V.findIndex(r=>r.value===s);return V[(t+1+V.length)%V.length].value}function Qs({models:s,currentModelId:t,onSelect:r,disabled:n}){const[l,c]=d.useState(!1),u=s.find(x=>x.modelId===t)??null,p=s.length>0,f=async x=>{r(x.modelId),c(!1)};return e.jsxs(Xe,{open:l,onOpenChange:p?c:void 0,children:[e.jsx(Ze,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:n||!p,className:"flex items-center gap-1.5 rounded-lg px-2 h-7 text-xs text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-display",title:"选择模型",children:[e.jsx(it,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-32 truncate",children:(u==null?void 0:u.name)??t??"选择模型"}),l?e.jsx(et,{className:"h-3 w-3"}):e.jsx(tt,{className:"h-3 w-3"})]})}),e.jsx(st,{className:"w-72 p-0",align:"start",children:e.jsx(Wt,{models:s,currentModelId:t,onSelect:f,showSearch:s.length>5})})]})}function Gs({mode:s,onModeChange:t,disabled:r}){const[n,l]=d.useState(!1),c=V.find(u=>u.value===s);return e.jsxs(Xe,{open:n,onOpenChange:l,children:[e.jsx(Ze,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:r,className:"flex items-center gap-1.5 rounded-lg px-2 h-7 text-xs text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-display",title:"权限模式(Shift+Tab 循环)",children:[e.jsx(Vt,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:(c==null?void 0:c.label)??s}),n?e.jsx(et,{className:"h-3 w-3"}):e.jsx(tt,{className:"h-3 w-3"})]})}),e.jsx(st,{className:"w-64 p-1",align:"start",children:V.map(u=>e.jsxs("button",{type:"button",onClick:()=>{t(u.value),l(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[e.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:s===u.value&&e.jsx(Ke,{className:"h-3.5 w-3.5 text-brand"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:u.label}),e.jsx("div",{className:"text-xs text-text-muted",children:u.description})]})]},u.value))})]})}function cn({sessionId:s,onSessionLoaded:t}){Ye();const[r,n]=d.useState(null),[l,c]=d.useState(null),[u,p]=d.useState(""),[f,x]=d.useState(!1),[g,j]=d.useState(!1),[N,i]=d.useState(!1),[a,m]=d.useState(!1),[y,k]=d.useState(0),[b,C]=d.useState(0),[$,M]=d.useState([]),[A,U]=d.useState(!1),[q,B]=d.useState([]),[R,W]=d.useState(null),[Q,ce]=d.useState(()=>lt()),[z,de]=d.useState(null),[S,X]=d.useState(null),[Z,ee]=d.useState([]),[Ne,ue]=d.useState(!1),[me,ve]=d.useState(""),xe=d.useRef(null),[pe,te]=d.useState(()=>localStorage.getItem(ie)||"default"),[_e,Se]=d.useState(null),G=d.useRef(null),[Ce,Ee]=d.useState(null),K=d.useRef(null),F=d.useRef(pe);F.current=pe;const se=d.useRef(null),Me=d.useRef(null),Te=d.useRef($);Te.current=$;const ne=d.useRef(t);ne.current=t;const re=d.useCallback(o=>{Se(o),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>Se(null),5e3)},[]),he=d.useCallback(o=>{Ee(o),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>Ee(null),5e3)},[]),fe=d.useCallback(o=>{var _;if(o===F.current)return;const h=F.current;F.current=o,te(o);try{localStorage.setItem(ie,o)}catch{}(_=Me.current)==null||_.setPermissionMode(o).then(v=>{se.current={requestId:v,previous:h}}).catch(v=>{console.error("[SessionDetail] set permission mode failed:",v),re(`模式切换请求发送失败: ${v instanceof Error?v.message:String(v)}`),F.current=h,te(h)})},[re]),T=d.useMemo(()=>new vs(s,M,{onStatusChange:o=>{c(o),U(o==="running"||o==="requires_action")},onError:o=>{console.error("[RCSChatAdapter] error:",o)},onPermissionRequest:o=>{B(h=>h.some(_=>_.requestId===o.requestId)?h:[...h,o])},onModelsStateChange:o=>{W(o)},onSubagentUpdate:o=>{ce(o)},onControlResponse:o=>{const h=se.current;if(!(!h||h.requestId!==o.requestId)&&(se.current=null,o.subtype==="error")){F.current=h.previous,te(h.previous);try{localStorage.setItem(ie,h.previous)}catch{}re(o.error||"模式切换失败")}},onPermissionModeChange:o=>{if(o!==F.current){F.current=o,te(o);try{localStorage.setItem(ie,o)}catch{}se.current=null}},onUsageChange:o=>{de(h=>({inputTokens:Math.max((h==null?void 0:h.inputTokens)??0,o.inputTokens),outputTokens:Math.max((h==null?void 0:h.outputTokens)??0,o.outputTokens),totalCostUsd:o.totalCostUsd??(h==null?void 0:h.totalCostUsd)??null}))},onElicitationRequest:o=>{X(o)}}),[s,re]);d.useEffect(()=>(Me.current=T,()=>{T.disconnect()}),[T]);const Re=d.useRef(a);Re.current=a,d.useEffect(()=>le.onEvent(h=>{h.type!=="artifact_created"&&h.type!=="artifact_updated"||(Re.current&&C(_=>_+1),k(_=>_+1))}),[]),d.useEffect(()=>{a&&k(0)},[a]),d.useEffect(()=>{let o=!1;async function h(){var _;p("");try{const v=await Bt(s);if(o)return;n(v),c(v.status),we(v.status)&&T.markClosed(),U(v.status==="running"||v.status==="requires_action"),(_=ne.current)==null||_.call(ne,v)}catch(v){if(o)return;p(v instanceof Error?v.message:w("session.loadFailed"));return}try{await T.init()}catch(v){console.warn("Failed to init adapter:",v)}}return h(),()=>{o=!0}},[s,T]);const O=we(l),H=(r==null?void 0:r.access_level)==="read",ye=d.useCallback(()=>{M([]),At(s).catch(o=>{console.warn("[SessionDetail] Failed to clear session history:",o)})},[s]),ae=d.useCallback(async o=>{const h=o.text.trim(),_=o.images&&o.images.length>0||o.attachments&&o.attachments.length>0;if(!h&&!_||O)return;const v=await $t(h,{sessionId:s,availableCommands:De,availableModels:(R==null?void 0:R.availableModels)??[],currentModel:R?{modelId:R.currentModelId,name:R.currentModelId}:null,supportsImages:!0,entries:Te.current,setModel:async I=>{await L(s,{type:"control_request",request:{subtype:"set_model",model:I}}),W(be=>be&&{...be,currentModelId:I})},onNewSession:()=>{M([])}}).catch(()=>null);if(v){if(It("[SessionDetail] local command result",v),"clearEntries"in v&&v.clearEntries){ye();return}if("newSession"in v&&v.newSession){ye();return}if("userEntry"in v){M(I=>[...I,v.userEntry,v.cmdEntry]);return}}U(!0);try{await T.sendMessage(h,o.images,o.attachments)}catch(I){if(console.error("Send failed:",I),I instanceof Pt&&I.type==="session_closed"){c("archived"),T.markClosed(),he(w("session.closedSendBlocked"));return}he(`${w("session.sendFailed")}${I instanceof Error?`: ${I.message}`:""}`)}},[T,O,s,R,ye,he]),ct=d.useCallback(o=>{if(A){ee(h=>[...h,o]);return}ae(o)},[A,ae]),ge=d.useRef(!1);d.useEffect(()=>{if(O){ee(h=>h.length>0?[]:h);return}if(A||Z.length===0||ge.current)return;const o=Z[0];o&&(ge.current=!0,ee(h=>h.slice(1)),ae(o).finally(()=>{ge.current=!1}))},[A,Z,ae,O]);const Ae=d.useCallback(async()=>{try{await T.interrupt()}catch(o){console.error("Interrupt failed:",o)}finally{U(!1)}},[T]),dt=d.useCallback(()=>{fe(Ws(F.current))},[fe]);d.useEffect(()=>()=>{G.current&&clearTimeout(G.current),K.current&&clearTimeout(K.current)},[]);const ut=d.useCallback(async()=>{if(r&&window.confirm(w("dashboard.confirmDelete").replace("{id}",r.title||r.id)))try{await qt(r.id),window.location.href="/code/"}catch(o){alert(o instanceof Error?o.message:w("dashboard.deleteFailed"))}},[r]),mt=d.useCallback(async o=>{try{await T.respondPermission(o,!0)}catch(h){console.error("Failed to approve:",h)}B(h=>h.filter(_=>_.requestId!==o))},[T]),xt=d.useCallback(async(o,h)=>{try{await T.respondPermission(o,!0,{updated_permissions:h})}catch(_){console.error("Failed to approve with rules:",_)}B(_=>_.filter(v=>v.requestId!==o))},[T]),pt=d.useCallback(async(o,h)=>{const _=S;if(X(null),!!_)try{await T.respondElicitation(_.requestId,o,h)}catch(v){console.error("Failed to submit elicitation:",v)}},[S,T]),ht=d.useCallback(()=>{!r||H||(ve(r.title||""),ue(!0),setTimeout(()=>{var o,h;(o=xe.current)==null||o.focus(),(h=xe.current)==null||h.select()},0))},[r,H]),$e=d.useCallback(async()=>{const o=me.trim();if(ue(!1),!(!r||!o||o===r.title))try{const h=await Dt(r.id,o);n(_=>_&&{..._,title:h.title??o})}catch(h){console.error("Rename failed:",h),alert(h instanceof Error?h.message:"重命名失败")}},[r,me]),ft=d.useCallback(async o=>{try{await T.respondPermission(o,!1)}catch(h){console.error("Failed to reject:",h)}B(h=>h.filter(_=>_.requestId!==o))},[T]),yt=d.useCallback(async(o,h,_)=>{try{await L(s,{type:"permission_response",approved:!0,request_id:o,updated_input:{questions:_,answers:h}})}catch(v){console.error("Failed to submit answers:",v)}B(v=>v.filter(I=>I.requestId!==o))},[s]),gt=d.useCallback(async(o,h,_)=>{try{h==="no"?await L(s,{type:"permission_response",approved:!1,request_id:o,..._?{message:_}:{}}):await L(s,{type:"permission_response",approved:!0,request_id:o,updated_permissions:[{type:"setMode",mode:{"yes-accept-edits":"acceptEdits","yes-default":"default"}[h]||"default",destination:"session"}]})}catch(v){console.error("Failed to submit plan response:",v)}B(v=>v.filter(I=>I.requestId!==o))},[s]);return u?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-status-error",children:u}),e.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:w("session.backToDashboard")})]})}):r?r.source==="acp"&&r.environment_id?e.jsx(Ys,{sessionId:s,agentId:r.environment_id}):e.jsx(Je,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("h1",{className:"sr-only",children:r.title||r.id}),e.jsx("div",{className:"border-b bg-surface-1 px-4 py-3",children:e.jsxs("div",{className:"mx-auto max-w-5xl",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Ne?e.jsx("input",{ref:xe,value:me,onChange:o=>ve(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),$e()):o.key==="Escape"&&(o.preventDefault(),ue(!1))},onBlur:()=>void $e(),maxLength:200,className:"w-full max-w-md rounded-lg border border-brand/50 bg-surface-2 px-2.5 py-1 font-display text-lg font-semibold text-text-primary focus:outline-none focus:ring-2 focus:ring-brand/30"}):e.jsxs("h2",{className:"group/title flex min-w-0 items-center gap-1.5 font-display text-lg font-semibold text-text-primary",children:[e.jsx("span",{className:"truncate",children:r.title||r.id}),!H&&!O&&e.jsx("button",{type:"button",onClick:ht,className:"flex-shrink-0 rounded p-0.5 text-text-muted opacity-0 transition-opacity hover:text-text-primary group-hover/title:opacity-100",title:"重命名会话",children:e.jsx(Ut,{className:"h-3.5 w-3.5"})})]}),r.visibility&&!Ne&&e.jsx(Jt,{visibility:r.visibility||"private"})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(()=>{var _;const o=r.source==="acp"?"acp":(_=r.environment)==null?void 0:_.worker_type,h=Qt(o);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${h.colorClass}`,children:h.fullLabel})})(),l&&e.jsx(We,{status:l}),e.jsx("span",{className:"text-xs text-text-muted",children:Qe(r.created_at)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>m(!a),className:`relative flex items-center gap-1 rounded-md px-2 py-1 text-xs transition-colors ${a?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:w("artifacts.title"),children:[e.jsx(Ft,{className:"h-3.5 w-3.5"}),y>0&&!a&&e.jsx("span",{className:"absolute -right-1.5 -top-1.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-status-active px-1 text-[10px] font-bold text-white",children:y>9?"9+":y})]}),!H&&(r==null?void 0:r.access_level)!=="write"&&e.jsx("button",{onClick:()=>i(!0),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:w("session.share"),children:e.jsx(hs,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>j(!g),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:w("session.info"),children:e.jsx(is,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>x(!f),className:"flex items-center gap-1 rounded-md px-3 py-1.5 text-sm text-text-primary font-bold hover:bg-brand-light hover:text-white transition-colors",children:[w("session.tasks"),q.length>0&&e.jsx("span",{className:"ml-1 rounded-full bg-status-warning px-1.5 py-0.5 text-[10px] font-medium text-white",children:q.length})]})]})]}),g&&e.jsxs("div",{className:"mt-2 rounded-md bg-surface-2 px-3 py-2 text-xs text-text-muted space-y-1 font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:w("session.metaSession")})," ",r.id]}),r.environment_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:w("session.metaEnvironment")})," ",r.environment_id]})]})]})}),a&&e.jsx("div",{className:"border-b bg-surface-1 px-4 py-4",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(Yt,{sessionId:s,embedded:!0,refreshTick:b})})}),e.jsx(Ot,{entries:$,isLoading:A,emptyTitle:w("session.emptyTitle"),emptyDescription:w("session.emptyDescription")}),e.jsx($s,{state:Q}),q.length>0&&e.jsx("div",{className:"border-t bg-surface-1 px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl space-y-3",children:q.map(o=>e.jsx(Ks,{request:o,onApprove:()=>mt(o.requestId),onApproveAlways:o.suggestions&&o.suggestions.length>0?()=>xt(o.requestId,o.suggestions??[]):void 0,onReject:()=>ft(o.requestId),onSubmitAnswers:yt,onSubmitPlan:gt},o.requestId))})}),S&&e.jsx("div",{className:"border-t bg-surface-1 px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(Fs,{request:S,onSubmit:pt})})}),Ce&&e.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:e.jsx("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-1.5 text-xs text-red-700 dark:text-red-300",children:Ce})}),_e&&e.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:e.jsx("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-1.5 text-xs text-red-700 dark:text-red-300",children:_e})}),e.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Gs,{mode:pe,onModeChange:fe,disabled:O||H}),e.jsx(Qs,{models:(R==null?void 0:R.availableModels)??[],currentModelId:(R==null?void 0:R.currentModelId)??null,onSelect:o=>{L(s,{type:"control_request",request:{subtype:"set_model",model:o}}),W(h=>h&&{...h,currentModelId:o})},disabled:O||H})]}),z&&e.jsxs("span",{className:"text-[11px] text-text-muted font-mono",title:"会话累计用量(input 含缓存读写)",children:[Ve(z.inputTokens)," in / ",Ve(z.outputTokens)," out",z.totalCostUsd!=null&&` · $${z.totalCostUsd.toFixed(2)}`]})]}),e.jsx(Lt,{onSubmit:ct,isLoading:A,onInterrupt:Ae,onCycleMode:dt,disabled:O||H,placeholder:O?w("session.closed"):H?w("session.readOnly"):w("session.inputPlaceholder"),supportsAttachments:!0,commands:De,queueWhileLoading:!0,queuedCount:Z.length,onDequeue:o=>ee(h=>h.filter((_,v)=>v!==o)),onSearchFiles:o=>T.searchFiles(o)}),f&&r&&e.jsx(Es,{onClose:()=>x(!1),session:r,liveStatus:l,pendingPermissions:q,onInterrupt:Ae,onDelete:ut}),e.jsx(Hs,{open:N,onClose:()=>i(!1),sessionId:r.id,sessionTitle:r.title||void 0})]})}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("div",{className:"text-text-muted",children:w("session.loading")})})}function Ks({request:s,onApprove:t,onApproveAlways:r,onReject:n,onSubmitAnswers:l,onSubmitPlan:c}){const u=s.toolName,p=s.toolInput,f=s.description||"";if(u==="AskUserQuestion"){const x=p.questions||[];return e.jsx(Ps,{requestId:s.requestId,questions:x,description:f,onSubmit:g=>l(s.requestId,g,x),onSkip:n})}if(u==="ExitPlanMode"){const x=p.plan||"";return e.jsx(Ds,{requestId:s.requestId,planContent:x,description:f,onSubmit:(g,j)=>c(s.requestId,g,j)})}return e.jsx(Is,{requestId:s.requestId,toolName:u,toolInput:p,description:f,suggestions:s.suggestions,onApprove:t,onApproveAlways:r,onReject:n})}function Ys({sessionId:s,agentId:t}){const[r,n]=d.useState(null),[l,c]=d.useState("disconnected"),[u,p]=d.useState(null),f=d.useRef(null);return d.useEffect(()=>{const x=Vs(t);return x.setConnectionStateHandler((g,j)=>{c(g),p(j||null)}),f.current=x,n(x),x.connect().catch(g=>{g instanceof Ht||(p(g.message),c("error"))}),()=>{x.disconnect(),f.current=null,n(null),c("disconnected")}},[t]),e.jsx(Je,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[u&&l==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:u}),l==="connecting"&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),e.jsx("p",{className:"text-text-muted text-sm",children:w("session.connectingAgent")})]})}),l==="error"&&!r&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium mb-1",children:w("session.connectionFailed")}),e.jsx("p",{className:"text-text-muted text-sm",children:u})]})}),r&&l==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(zt,{client:r,agentId:t})})]})})}export{cn as SessionDetail};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./vendor-DE_-CLIE.js";import{ab as c,U as n,a9 as i}from"./main-2FF76CHO.js";/**
1
+ import{j as e}from"./vendor-DE_-CLIE.js";import{ac as c,U as n,aa as i}from"./main-Ckj6POvG.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as v,am as t}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function k({onSuccess:p,onAlreadyDone:b}){const{setup:f}=v(),[n,h]=r.useState(""),[l,y]=r.useState(""),[a,g]=r.useState(""),[d,w]=r.useState(""),[i,o]=r.useState(""),[c,m]=r.useState(!1),j=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==d){o(t("auth.setup.passwordMismatch"));return}m(!0);try{await f(n,l,a),p()}catch(x){const u=x instanceof Error?x.message:"Setup failed";if(u.includes("already")||u.includes("409")){b();return}o(u)}finally{m(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.setup.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.setup.description")})]}),e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.apiKey")}),e.jsx("input",{type:"password",value:n,onChange:s=>h(s.target.value),required:!0,autoComplete:"off",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.username")}),e.jsx("input",{type:"text",value:l,onChange:s=>y(s.target.value),required:!0,autoComplete:"username",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.confirmPassword")}),e.jsx("input",{type:"password",value:d,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:c,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:c?t("common.loading"):t("auth.setup.submit")})]})]})})}export{k as Setup};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{ar as v,an as t}from"./main-Ckj6POvG.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function q({onSuccess:p,onAlreadyDone:b}){const{setup:f}=v(),[n,h]=r.useState(""),[l,y]=r.useState(""),[a,g]=r.useState(""),[d,w]=r.useState(""),[i,o]=r.useState(""),[c,m]=r.useState(!1),j=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==d){o(t("auth.setup.passwordMismatch"));return}m(!0);try{await f(n,l,a),p()}catch(x){const u=x instanceof Error?x.message:"Setup failed";if(u.includes("already")||u.includes("409")){b();return}o(u)}finally{m(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.setup.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.setup.description")})]}),e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.apiKey")}),e.jsx("input",{type:"password",value:n,onChange:s=>h(s.target.value),required:!0,autoComplete:"off",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.username")}),e.jsx("input",{type:"text",value:l,onChange:s=>y(s.target.value),required:!0,autoComplete:"username",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.confirmPassword")}),e.jsx("input",{type:"password",value:d,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:c,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:c?t("common.loading"):t("auth.setup.submit")})]})]})})}export{q as Setup};
@@ -1 +1 @@
1
- import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{a2 as m,b as h}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function j(){const[t,r]=d.useState("loading"),[i,a]=d.useState(""),l=(typeof window<"u"?window.location.pathname:"").match(/\/code\/s\/([^/?]+)/),o=l?l[1]:null;return d.useEffect(()=>{if(!o){r("invalid"),a("Share link is invalid — no token found.");return}if(!o.startsWith("shr_")){r("invalid"),a("Invalid share token format.");return}let n=!1;async function c(){try{const s=await m(o);if(n)return;window.location.href=`/code/${s.id}`}catch(s){if(n)return;s instanceof h?s.status===401&&s.message.toLowerCase().includes("expired")?(r("expired"),a("This share has expired.")):s.status===404?s.message.toLowerCase().includes("session")?(r("not_found"),a("Session not found.")):(r("invalid"),a("Share not found or has been revoked.")):s.status===403?(r("invalid"),a("You do not have permission to access this share.")):(r("error"),a(s.message||"Failed to resolve share.")):(r("error"),a(s instanceof Error?s.message:"Failed to resolve share."))}}return c(),()=>{n=!0}},[o]),d.useEffect(()=>{if(t!=="loading"&&t!=="error"){const n=setTimeout(()=>{window.location.href="/code"},3e3);return()=>clearTimeout(n)}},[t]),t==="loading"?e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),e.jsx("p",{children:"Resolving share link..."})]})}):e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-primary",children:e.jsxs("div",{className:"text-center max-w-md px-4",children:[t==="expired"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Share Expired"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share has expired."})]}),t==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Invalid Share"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share link is invalid or has been revoked."})]}),t==="not_found"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Not Found"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"The session could not be found."})]}),t==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Error"}),e.jsx("p",{className:"text-status-error mb-4",children:i})]}),e.jsx("a",{href:"/code",className:"text-brand hover:underline",children:"← Back to Dashboard"})]})})}export{j as ShareLanding};
1
+ import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{a3 as m,b as h}from"./main-Ckj6POvG.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function j(){const[t,r]=d.useState("loading"),[i,a]=d.useState(""),l=(typeof window<"u"?window.location.pathname:"").match(/\/code\/s\/([^/?]+)/),o=l?l[1]:null;return d.useEffect(()=>{if(!o){r("invalid"),a("Share link is invalid — no token found.");return}if(!o.startsWith("shr_")){r("invalid"),a("Invalid share token format.");return}let n=!1;async function c(){try{const s=await m(o);if(n)return;window.location.href=`/code/${s.id}`}catch(s){if(n)return;s instanceof h?s.status===401&&s.message.toLowerCase().includes("expired")?(r("expired"),a("This share has expired.")):s.status===404?s.message.toLowerCase().includes("session")?(r("not_found"),a("Session not found.")):(r("invalid"),a("Share not found or has been revoked.")):s.status===403?(r("invalid"),a("You do not have permission to access this share.")):(r("error"),a(s.message||"Failed to resolve share.")):(r("error"),a(s instanceof Error?s.message:"Failed to resolve share."))}}return c(),()=>{n=!0}},[o]),d.useEffect(()=>{if(t!=="loading"&&t!=="error"){const n=setTimeout(()=>{window.location.href="/code"},3e3);return()=>clearTimeout(n)}},[t]),t==="loading"?e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),e.jsx("p",{children:"Resolving share link..."})]})}):e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-primary",children:e.jsxs("div",{className:"text-center max-w-md px-4",children:[t==="expired"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Share Expired"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share has expired."})]}),t==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Invalid Share"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share link is invalid or has been revoked."})]}),t==="not_found"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Not Found"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"The session could not be found."})]}),t==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Error"}),e.jsx("p",{className:"text-status-error mb-4",children:i})]}),e.jsx("a",{href:"/code",className:"text-brand hover:underline",children:"← Back to Dashboard"})]})})}export{j as ShareLanding};
@@ -1 +1 @@
1
- import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{ar as f,as as y,am as r}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function S(){f();const{createTeam:u}=y(),[o,p]=a.useState(""),[s,c]=a.useState(""),[i,b]=a.useState(""),[m,l]=a.useState(null),[d,x]=a.useState(!1),h=t=>{p(t),s||c(t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-"))},g=async t=>{t.preventDefault(),l(null),x(!0);try{const n=await u({name:o,slug:s,description:i||void 0});window.location.href=`/teams/${n.slug}`}catch(n){l(n instanceof Error?n.message:"Failed to create team")}finally{x(!1)}};return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"mb-10 font-display text-2xl font-semibold tracking-tight text-text-primary",children:r("team.create.title")}),e.jsxs("form",{onSubmit:g,className:"max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.name")}),e.jsx("input",{id:"name",type:"text",required:!0,value:o,onChange:t=>h(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"Engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.nameHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"slug",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.slug")}),e.jsx("input",{id:"slug",type:"text",required:!0,value:s,onChange:t=>c(t.target.value),pattern:"^[a-z0-9-]{3,32}$",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.slugHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.description")}),e.jsx("textarea",{id:"description",value:i,onChange:t=>b(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:d||!o||!s,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:d?r("common.creating"):r("team.create.submit")})]})]})]})})}export{S as TeamCreate};
1
+ import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{as as f,at as y,an as r}from"./main-Ckj6POvG.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function S(){f();const{createTeam:u}=y(),[o,p]=a.useState(""),[s,c]=a.useState(""),[i,b]=a.useState(""),[m,l]=a.useState(null),[d,x]=a.useState(!1),h=t=>{p(t),s||c(t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-"))},g=async t=>{t.preventDefault(),l(null),x(!0);try{const n=await u({name:o,slug:s,description:i||void 0});window.location.href=`/teams/${n.slug}`}catch(n){l(n instanceof Error?n.message:"Failed to create team")}finally{x(!1)}};return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"mb-10 font-display text-2xl font-semibold tracking-tight text-text-primary",children:r("team.create.title")}),e.jsxs("form",{onSubmit:g,className:"max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.name")}),e.jsx("input",{id:"name",type:"text",required:!0,value:o,onChange:t=>h(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"Engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.nameHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"slug",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.slug")}),e.jsx("input",{id:"slug",type:"text",required:!0,value:s,onChange:t=>c(t.target.value),pattern:"^[a-z0-9-]{3,32}$",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.slugHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.description")}),e.jsx("textarea",{id:"description",value:i,onChange:t=>b(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:d||!o||!s,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:d?r("common.creating"):r("team.create.submit")})]})]})]})})}export{S as TeamCreate};
@@ -1,6 +1,6 @@
1
- import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{ab as H,B as T,ar as P,am as i,d as B,X as z,x as G,Y as I,a7 as q,a6 as W,aq as Y,S as X,a9 as J,j as K,o as Q,P as V,k as Z,m as ee,l as M,n as te,z as se}from"./main-2FF76CHO.js";import{U as ae}from"./UserSearchInput-DM6V0r1B.js";import{C as D}from"./copy-BFkM6GS4.js";import{g as ne}from"./workerType-Bd-zteMi.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
1
+ import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{ac as H,B as T,as as P,an as i,d as B,X as z,x as G,Y as I,a8 as W,a7 as Y,ar as q,S as X,aa as J,j as K,o as Q,P as V,k as Z,m as ee,l as M,n as te,z as se}from"./main-Ckj6POvG.js";import{U as ae}from"./UserSearchInput-74J0KF8K.js";import{C as D}from"./copy-Ds1kEyW_.js";import{g as ne}from"./workerType-Bd-zteMi.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
2
2
  * @license lucide-react v0.555.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 re=[["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:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ie=H("user-plus",re);function O(a){const[m,r]=n.useState([]),[N,j]=n.useState(!1),c=n.useCallback(async()=>{if(a){j(!0);try{const u=await T("GET",`/web/teams/${a}/members`);r(u)}catch{r([])}finally{j(!1)}}},[a]);n.useEffect(()=>{c()},[c]);const h=n.useCallback(async(u,f)=>{await T("POST",`/web/teams/${a}/members`,{userId:u,role:f}),await c()},[a,c]),x=n.useCallback(async u=>{await T("DELETE",`/web/teams/${a}/members/${u}`),await c()},[a,c]),l=n.useCallback(async(u,f)=>{await T("PATCH",`/web/teams/${a}/members/${u}`,{role:f}),await c()},[a,c]);return{members:m,isLoading:N,addMember:h,removeMember:x,updateRole:l,refetch:c}}function oe(a){const[m,r]=n.useState([]),N=n.useCallback(async c=>{if(!a)return null;const h=await T("POST",`/web/teams/${a}/invitations`,c);return r(x=>[...x,h]),h},[a]),j=n.useCallback(async c=>{a&&(await T("DELETE",`/web/teams/${a}/invitations/${c}`),r(h=>h.filter(x=>x.token!==c)))},[a]);return{invitations:m,createInvitation:N,revokeInvitation:j}}function ce({teamId:a,canManage:m}){P();const{invitations:r,createInvitation:N,revokeInvitation:j}=oe(a),{addMember:c}=O(a),[h,x]=n.useState(!1),[l,u]=n.useState(null),[f,E]=n.useState("member"),[d,g]=n.useState(!1),[y,b]=n.useState("member"),[v,L]=n.useState(null),[$,_]=n.useState(!1),[s,t]=n.useState(!1),[p,w]=n.useState(!1),S=async()=>{x(!0);try{const o=await N({role:f,expiresIn:86400,maxUses:5});o&&u(o.token||o.inviteToken||null)}catch{}finally{x(!1)}},R=async()=>{if(!l)return;const o=`${window.location.origin}/join?invite=${l}`;let k=!1;try{navigator.clipboard&&window.isSecureContext&&(await navigator.clipboard.writeText(o),k=!0)}catch{}if(!k){const C=document.createElement("textarea");C.value=o,C.style.position="fixed",C.style.top="0",C.style.opacity="0",document.body.appendChild(C),C.focus(),C.select(),C.setSelectionRange(0,o.length);try{k=document.execCommand("copy")}catch{k=!1}document.body.removeChild(C)}k?(w(!1),t(!0),setTimeout(()=>t(!1),2e3)):(t(!1),w(!0),setTimeout(()=>w(!1),4e3))},A=async o=>{_(!0),L(null);try{await c(o,y),g(!1)}catch(k){L(k instanceof Error?k.message:"Failed to add user")}finally{_(!1)}};return e.jsxs("div",{className:"space-y-5",children:[m&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("select",{className:"rounded-md border border-border bg-surface-2 px-2.5 py-1.5 text-xs text-text-primary focus:border-accent focus:outline-none",value:f,onChange:o=>E(o.target.value),children:[e.jsx("option",{value:"member",children:i("invitation.member")}),e.jsx("option",{value:"admin",children:i("invitation.admin")})]}),e.jsx("button",{type:"button",onClick:S,disabled:h,className:"rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:opacity-50",children:h?i("invitation.creating"):i("invitation.create")}),e.jsxs("button",{type:"button",onClick:()=>g(!d),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-surface-2",title:i("invitation.addExistingHint"),children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),i("invitation.addExisting")]})]}),d&&m&&e.jsxs("div",{className:"space-y-3 rounded border border-border bg-surface-2 p-3",children:[e.jsx("p",{className:"text-xs text-text-muted",children:i("invitation.addExistingHint")}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("select",{className:"rounded border border-border bg-surface-1 px-2 py-1.5 text-sm",value:y,onChange:o=>b(o.target.value),children:[e.jsx("option",{value:"member",children:i("invitation.member")}),e.jsx("option",{value:"admin",children:i("invitation.admin")})]})}),v&&e.jsx("p",{className:"text-xs text-destructive",children:v}),e.jsx(ae,{onSelect:A,actionDisabled:$,placeholder:i("invitation.searchUser")})]}),l&&e.jsxs("div",{className:"space-y-1.5 rounded border border-accent/40 bg-accent/5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-xs text-text-primary break-all",children:`${window.location.origin}/join?invite=${l}`}),e.jsx("button",{type:"button",onClick:R,className:s?"text-status-active":"text-text-muted hover:text-text-primary",title:s?i("share.copied"):i("share.copy"),children:s?e.jsx(B,{className:"h-4 w-4"}):e.jsx(D,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:()=>u(null),className:"text-text-muted hover:text-text-primary",children:e.jsx(z,{className:"h-4 w-4"})})]}),s&&e.jsx("p",{className:"text-xs text-status-active",children:i("share.copied")}),p&&e.jsx("p",{className:"text-xs text-status-error",children:i("share.copyFailed")})]}),r.length>0&&e.jsx("ul",{className:"space-y-2",children:r.map(o=>e.jsxs("li",{className:"flex items-center justify-between rounded border border-border/60 bg-surface-2 p-2 text-sm",children:[e.jsxs("span",{className:"text-text-muted",children:[o.role," — expires ",new Date(o.expiresAt).toLocaleDateString()]}),m&&e.jsx("button",{type:"button",onClick:()=>j(o.token),className:"text-sm text-destructive hover:underline",children:i("invitation.revoke")})]},o.token))})]})}function le({teamId:a,canManage:m}){const[r,N]=n.useState([]),[j,c]=n.useState(!0),[h,x]=n.useState(null),[l,u]=n.useState(""),[f,E]=n.useState(null),[d,g]=n.useState(!1),y=async()=>{try{const s=await I();N(s||[])}catch(s){x(s instanceof Error?s.message:"Failed to load environments")}finally{c(!1)}};n.useEffect(()=>{y()},[]);const b=n.useMemo(()=>r.filter(s=>s.team_id===a),[r,a]),v=n.useMemo(()=>r.filter(s=>!s.team_id),[r]),L=async()=>{if(l){E(null);try{await W(l,a),u(""),await y()}catch(s){E(s instanceof Error?s.message:"Failed to link environment")}}},$=async s=>{if(window.confirm("Unlink this environment from the team? It will revert to personal scope.")){E(null);try{await q(a,s),await y()}catch(t){E(t instanceof Error?t.message:"Failed to unlink environment")}}},_=async()=>{const s=`slz rc --team-id ${a}`;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(s),g(!0),setTimeout(()=>g(!1),2e3);return}}catch{}const t=document.createElement("textarea");t.value=s,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),g(!0),setTimeout(()=>g(!1),2e3)}catch{}document.body.removeChild(t)};return j?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading environments..."}):h?e.jsx("p",{className:"text-sm text-destructive",children:h}):e.jsxs("div",{className:"space-y-8",children:[e.jsx("ul",{className:"space-y-3",children:b.length===0?e.jsx("li",{className:"text-sm text-text-muted",children:"No environments linked to this team yet."}):b.map(s=>{const t=ne(s.worker_type);return e.jsxs("li",{className:"text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:s.machine_name||s.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${t.colorClass}`,children:t.shortLabel}),e.jsx(G,{status:s.status}),m&&e.jsx("button",{type:"button",onClick:()=>$(s.id),className:"ml-2 text-xs text-text-muted underline-offset-2 transition-colors hover:text-destructive hover:underline",children:"Unlink"})]}),e.jsxs("div",{className:"mt-1 font-mono text-xs text-text-muted",children:[s.directory||""," ",s.branch?`· ${s.branch}`:""]})]},s.id)})}),m&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Register a new worker to this team:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"rounded-md border border-border bg-surface-2 px-3 py-1.5 font-mono text-xs text-text-primary",children:["slz rc --team-id ",a]}),e.jsx("button",{type:"button",onClick:_,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy command",children:e.jsx(D,{className:"h-3.5 w-3.5"})}),d&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"})]})]}),v.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Link an existing personal environment:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:l,onChange:s=>u(s.target.value),className:"max-w-md rounded-md border border-border bg-surface-2 px-3 py-1.5 text-sm text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"",children:"Select environment..."}),v.map(s=>e.jsxs("option",{value:s.id,children:[s.machine_name||s.id," ",s.branch?`· ${s.branch}`:""]},s.id))]}),e.jsx("button",{type:"button",onClick:L,disabled:!l,className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:"Link"})]})]}),f&&e.jsx("p",{className:"text-sm text-destructive",children:f})]})]})}async function de(a){try{const m=a.startsWith("team_")?`/web/teams/${a}`:`/web/teams/by-slug/${a}`;return await T("GET",m)}catch{return null}}const me={owner:"team.member.roleOwner",admin:"team.member.roleAdmin",member:"team.member.roleMember"},U={owner:"border-brand/30 bg-brand/10 text-brand",admin:"border-accent/30 bg-accent/10 text-accent",member:"border-border/60 bg-surface-2 text-text-muted"};function F(a){return i(me[a]||"team.member.roleMember")}function ve(){P();const a=window.location.pathname.split("/"),m=a[a.length-1]||"",[r,N]=n.useState(null),[j,c]=n.useState(!0),[h,x]=n.useState(!1),{members:l,isLoading:u,updateRole:f,removeMember:E}=O((r==null?void 0:r.id)||null),{user:d}=Y(),[g,y]=n.useState("");if(n.useEffect(()=>{m&&(c(!0),de(m).then(t=>{N(t),c(!1)}))},[m]),j)return e.jsx("div",{className:"px-6 py-16 text-sm text-text-muted",children:"Loading..."});if(!r)return e.jsx("div",{className:"px-6 py-16 sm:px-10",children:e.jsxs("div",{className:"max-w-3xl",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})});const b=l.find(t=>t.user_id===(d==null?void 0:d.userId)),v=(d==null?void 0:d.role)==="admin"||(b==null?void 0:b.role)==="owner"||(b==null?void 0:b.role)==="admin",L=(d==null?void 0:d.role)==="admin"||(b==null?void 0:b.role)==="owner",$=async()=>{const t=r.id;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(t),x(!0),setTimeout(()=>x(!1),2e3);return}}catch{}const p=document.createElement("textarea");p.value=t,p.style.position="fixed",p.style.opacity="0",document.body.appendChild(p),p.select();try{document.execCommand("copy"),x(!0),setTimeout(()=>x(!1),2e3)}catch{}document.body.removeChild(p)},_=async(t,p)=>{if(t.role!==p){y("");try{await f(t.user_id,p)}catch(w){y(w instanceof Error?w.message:i("team.member.updateFailed"))}}},s=async t=>{const p=t.username||t.user_id;if(window.confirm(i("team.member.removeConfirm").replace("{name}",p))){y("");try{await E(t.user_id)}catch(S){y(S instanceof Error?S.message:i("team.member.updateFailed"))}}};return e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:r.name}),e.jsxs("p",{className:"mt-2 font-mono text-xs text-text-muted",children:["/",r.slug]}),r.description&&e.jsx("p",{className:"mt-5 max-w-2xl text-sm leading-relaxed text-text-muted",children:r.description}),e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:r.id}),e.jsx("button",{type:"button",onClick:$,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy team ID",children:e.jsx(D,{className:"h-3.5 w-3.5"})}),h&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"}),v&&e.jsx("a",{href:`/teams/${r.slug}/settings`,className:"ml-1 text-text-muted transition-colors hover:text-text-primary","aria-label":"Team settings",title:"Team settings",children:e.jsx(X,{className:"h-4 w-4"})})]})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("div",{className:"mb-6 flex items-baseline justify-between",children:e.jsxs("h2",{className:"text-sm font-medium text-text-primary",children:[i("team.detail.members")," (",l.length,")"]})}),g&&e.jsx("div",{className:"mb-4 rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:g}),u?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading members..."}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:"No members."}):e.jsx("ul",{className:"space-y-2",children:l.map(t=>{const p=t.user_id===(d==null?void 0:d.userId),w=t.role==="owner"||t.role==="admin",S=v&&(!w||L),R=S&&!(t.role==="owner"&&l.filter(o=>o.role==="owner").length<=1),A=["owner","admin","member"];return e.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-xl border border-border bg-surface-1 px-4 py-3",children:[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 font-medium text-text-primary",children:t.username||t.user_id}),p&&e.jsx("span",{className:"text-xs text-text-muted",children:i("team.member.you")}),e.jsx("span",{className:J("shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-medium",U[t.role]||U.member),children:F(t.role)})]}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-text-muted",children:t.user_id})]}),v&&e.jsxs(K,{children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",disabled:!S,className:"shrink-0 rounded-md p-1.5 text-text-muted transition-colors hover:bg-surface-2 hover:text-text-primary disabled:opacity-40 disabled:hover:bg-transparent","aria-label":i("team.member.changeRole"),title:i("team.member.changeRole"),children:e.jsx(V,{className:"h-4 w-4"})})}),e.jsxs(Z,{align:"end",className:"w-48",children:[e.jsx(ee,{className:"text-xs text-text-muted",children:i("team.member.changeRole")}),A.map(o=>e.jsxs(M,{onSelect:()=>_(t,o),className:"flex items-center justify-between",children:[e.jsx("span",{children:F(o)}),t.role===o&&e.jsx(B,{className:"h-3.5 w-3.5 text-brand"})]},o)),e.jsx(te,{}),e.jsxs(M,{variant:"destructive",disabled:!R,onSelect:()=>s(t),className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:i("team.member.remove")})]})]})]})]},t.user_id)})})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:i("team.detail.environments")}),e.jsx(le,{teamId:r.id,canManage:v})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:i("team.detail.invitations")}),e.jsx(ce,{teamId:r.id,canManage:v})]})]})}export{ve as TeamDetail};
6
+ */const re=[["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:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ie=H("user-plus",re);function O(a){const[m,r]=n.useState([]),[N,j]=n.useState(!1),c=n.useCallback(async()=>{if(a){j(!0);try{const u=await T("GET",`/web/teams/${a}/members`);r(u)}catch{r([])}finally{j(!1)}}},[a]);n.useEffect(()=>{c()},[c]);const h=n.useCallback(async(u,f)=>{await T("POST",`/web/teams/${a}/members`,{userId:u,role:f}),await c()},[a,c]),x=n.useCallback(async u=>{await T("DELETE",`/web/teams/${a}/members/${u}`),await c()},[a,c]),l=n.useCallback(async(u,f)=>{await T("PATCH",`/web/teams/${a}/members/${u}`,{role:f}),await c()},[a,c]);return{members:m,isLoading:N,addMember:h,removeMember:x,updateRole:l,refetch:c}}function oe(a){const[m,r]=n.useState([]),N=n.useCallback(async c=>{if(!a)return null;const h=await T("POST",`/web/teams/${a}/invitations`,c);return r(x=>[...x,h]),h},[a]),j=n.useCallback(async c=>{a&&(await T("DELETE",`/web/teams/${a}/invitations/${c}`),r(h=>h.filter(x=>x.token!==c)))},[a]);return{invitations:m,createInvitation:N,revokeInvitation:j}}function ce({teamId:a,canManage:m}){P();const{invitations:r,createInvitation:N,revokeInvitation:j}=oe(a),{addMember:c}=O(a),[h,x]=n.useState(!1),[l,u]=n.useState(null),[f,E]=n.useState("member"),[d,g]=n.useState(!1),[y,b]=n.useState("member"),[v,L]=n.useState(null),[$,_]=n.useState(!1),[s,t]=n.useState(!1),[p,w]=n.useState(!1),S=async()=>{x(!0);try{const o=await N({role:f,expiresIn:86400,maxUses:5});o&&u(o.token||o.inviteToken||null)}catch{}finally{x(!1)}},R=async()=>{if(!l)return;const o=`${window.location.origin}/join?invite=${l}`;let k=!1;try{navigator.clipboard&&window.isSecureContext&&(await navigator.clipboard.writeText(o),k=!0)}catch{}if(!k){const C=document.createElement("textarea");C.value=o,C.style.position="fixed",C.style.top="0",C.style.opacity="0",document.body.appendChild(C),C.focus(),C.select(),C.setSelectionRange(0,o.length);try{k=document.execCommand("copy")}catch{k=!1}document.body.removeChild(C)}k?(w(!1),t(!0),setTimeout(()=>t(!1),2e3)):(t(!1),w(!0),setTimeout(()=>w(!1),4e3))},A=async o=>{_(!0),L(null);try{await c(o,y),g(!1)}catch(k){L(k instanceof Error?k.message:"Failed to add user")}finally{_(!1)}};return e.jsxs("div",{className:"space-y-5",children:[m&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("select",{className:"rounded-md border border-border bg-surface-2 px-2.5 py-1.5 text-xs text-text-primary focus:border-accent focus:outline-none",value:f,onChange:o=>E(o.target.value),children:[e.jsx("option",{value:"member",children:i("invitation.member")}),e.jsx("option",{value:"admin",children:i("invitation.admin")})]}),e.jsx("button",{type:"button",onClick:S,disabled:h,className:"rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:opacity-50",children:h?i("invitation.creating"):i("invitation.create")}),e.jsxs("button",{type:"button",onClick:()=>g(!d),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-surface-2",title:i("invitation.addExistingHint"),children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),i("invitation.addExisting")]})]}),d&&m&&e.jsxs("div",{className:"space-y-3 rounded border border-border bg-surface-2 p-3",children:[e.jsx("p",{className:"text-xs text-text-muted",children:i("invitation.addExistingHint")}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("select",{className:"rounded border border-border bg-surface-1 px-2 py-1.5 text-sm",value:y,onChange:o=>b(o.target.value),children:[e.jsx("option",{value:"member",children:i("invitation.member")}),e.jsx("option",{value:"admin",children:i("invitation.admin")})]})}),v&&e.jsx("p",{className:"text-xs text-destructive",children:v}),e.jsx(ae,{onSelect:A,actionDisabled:$,placeholder:i("invitation.searchUser")})]}),l&&e.jsxs("div",{className:"space-y-1.5 rounded border border-accent/40 bg-accent/5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-xs text-text-primary break-all",children:`${window.location.origin}/join?invite=${l}`}),e.jsx("button",{type:"button",onClick:R,className:s?"text-status-active":"text-text-muted hover:text-text-primary",title:s?i("share.copied"):i("share.copy"),children:s?e.jsx(B,{className:"h-4 w-4"}):e.jsx(D,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:()=>u(null),className:"text-text-muted hover:text-text-primary",children:e.jsx(z,{className:"h-4 w-4"})})]}),s&&e.jsx("p",{className:"text-xs text-status-active",children:i("share.copied")}),p&&e.jsx("p",{className:"text-xs text-status-error",children:i("share.copyFailed")})]}),r.length>0&&e.jsx("ul",{className:"space-y-2",children:r.map(o=>e.jsxs("li",{className:"flex items-center justify-between rounded border border-border/60 bg-surface-2 p-2 text-sm",children:[e.jsxs("span",{className:"text-text-muted",children:[o.role," — expires ",new Date(o.expiresAt).toLocaleDateString()]}),m&&e.jsx("button",{type:"button",onClick:()=>j(o.token),className:"text-sm text-destructive hover:underline",children:i("invitation.revoke")})]},o.token))})]})}function le({teamId:a,canManage:m}){const[r,N]=n.useState([]),[j,c]=n.useState(!0),[h,x]=n.useState(null),[l,u]=n.useState(""),[f,E]=n.useState(null),[d,g]=n.useState(!1),y=async()=>{try{const s=await I();N(s||[])}catch(s){x(s instanceof Error?s.message:"Failed to load environments")}finally{c(!1)}};n.useEffect(()=>{y()},[]);const b=n.useMemo(()=>r.filter(s=>s.team_id===a),[r,a]),v=n.useMemo(()=>r.filter(s=>!s.team_id),[r]),L=async()=>{if(l){E(null);try{await Y(l,a),u(""),await y()}catch(s){E(s instanceof Error?s.message:"Failed to link environment")}}},$=async s=>{if(window.confirm("Unlink this environment from the team? It will revert to personal scope.")){E(null);try{await W(a,s),await y()}catch(t){E(t instanceof Error?t.message:"Failed to unlink environment")}}},_=async()=>{const s=`slz rc --team-id ${a}`;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(s),g(!0),setTimeout(()=>g(!1),2e3);return}}catch{}const t=document.createElement("textarea");t.value=s,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),g(!0),setTimeout(()=>g(!1),2e3)}catch{}document.body.removeChild(t)};return j?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading environments..."}):h?e.jsx("p",{className:"text-sm text-destructive",children:h}):e.jsxs("div",{className:"space-y-8",children:[e.jsx("ul",{className:"space-y-3",children:b.length===0?e.jsx("li",{className:"text-sm text-text-muted",children:"No environments linked to this team yet."}):b.map(s=>{const t=ne(s.worker_type);return e.jsxs("li",{className:"text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:s.machine_name||s.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${t.colorClass}`,children:t.shortLabel}),e.jsx(G,{status:s.status}),m&&e.jsx("button",{type:"button",onClick:()=>$(s.id),className:"ml-2 text-xs text-text-muted underline-offset-2 transition-colors hover:text-destructive hover:underline",children:"Unlink"})]}),e.jsxs("div",{className:"mt-1 font-mono text-xs text-text-muted",children:[s.directory||""," ",s.branch?`· ${s.branch}`:""]})]},s.id)})}),m&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Register a new worker to this team:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"rounded-md border border-border bg-surface-2 px-3 py-1.5 font-mono text-xs text-text-primary",children:["slz rc --team-id ",a]}),e.jsx("button",{type:"button",onClick:_,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy command",children:e.jsx(D,{className:"h-3.5 w-3.5"})}),d&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"})]})]}),v.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Link an existing personal environment:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:l,onChange:s=>u(s.target.value),className:"max-w-md rounded-md border border-border bg-surface-2 px-3 py-1.5 text-sm text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"",children:"Select environment..."}),v.map(s=>e.jsxs("option",{value:s.id,children:[s.machine_name||s.id," ",s.branch?`· ${s.branch}`:""]},s.id))]}),e.jsx("button",{type:"button",onClick:L,disabled:!l,className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:"Link"})]})]}),f&&e.jsx("p",{className:"text-sm text-destructive",children:f})]})]})}async function de(a){try{const m=a.startsWith("team_")?`/web/teams/${a}`:`/web/teams/by-slug/${a}`;return await T("GET",m)}catch{return null}}const me={owner:"team.member.roleOwner",admin:"team.member.roleAdmin",member:"team.member.roleMember"},U={owner:"border-brand/30 bg-brand/10 text-brand",admin:"border-accent/30 bg-accent/10 text-accent",member:"border-border/60 bg-surface-2 text-text-muted"};function F(a){return i(me[a]||"team.member.roleMember")}function ve(){P();const a=window.location.pathname.split("/"),m=a[a.length-1]||"",[r,N]=n.useState(null),[j,c]=n.useState(!0),[h,x]=n.useState(!1),{members:l,isLoading:u,updateRole:f,removeMember:E}=O((r==null?void 0:r.id)||null),{user:d}=q(),[g,y]=n.useState("");if(n.useEffect(()=>{m&&(c(!0),de(m).then(t=>{N(t),c(!1)}))},[m]),j)return e.jsx("div",{className:"px-6 py-16 text-sm text-text-muted",children:"Loading..."});if(!r)return e.jsx("div",{className:"px-6 py-16 sm:px-10",children:e.jsxs("div",{className:"max-w-3xl",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})});const b=l.find(t=>t.user_id===(d==null?void 0:d.userId)),v=(d==null?void 0:d.role)==="admin"||(b==null?void 0:b.role)==="owner"||(b==null?void 0:b.role)==="admin",L=(d==null?void 0:d.role)==="admin"||(b==null?void 0:b.role)==="owner",$=async()=>{const t=r.id;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(t),x(!0),setTimeout(()=>x(!1),2e3);return}}catch{}const p=document.createElement("textarea");p.value=t,p.style.position="fixed",p.style.opacity="0",document.body.appendChild(p),p.select();try{document.execCommand("copy"),x(!0),setTimeout(()=>x(!1),2e3)}catch{}document.body.removeChild(p)},_=async(t,p)=>{if(t.role!==p){y("");try{await f(t.user_id,p)}catch(w){y(w instanceof Error?w.message:i("team.member.updateFailed"))}}},s=async t=>{const p=t.username||t.user_id;if(window.confirm(i("team.member.removeConfirm").replace("{name}",p))){y("");try{await E(t.user_id)}catch(S){y(S instanceof Error?S.message:i("team.member.updateFailed"))}}};return e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:r.name}),e.jsxs("p",{className:"mt-2 font-mono text-xs text-text-muted",children:["/",r.slug]}),r.description&&e.jsx("p",{className:"mt-5 max-w-2xl text-sm leading-relaxed text-text-muted",children:r.description}),e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:r.id}),e.jsx("button",{type:"button",onClick:$,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy team ID",children:e.jsx(D,{className:"h-3.5 w-3.5"})}),h&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"}),v&&e.jsx("a",{href:`/teams/${r.slug}/settings`,className:"ml-1 text-text-muted transition-colors hover:text-text-primary","aria-label":"Team settings",title:"Team settings",children:e.jsx(X,{className:"h-4 w-4"})})]})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("div",{className:"mb-6 flex items-baseline justify-between",children:e.jsxs("h2",{className:"text-sm font-medium text-text-primary",children:[i("team.detail.members")," (",l.length,")"]})}),g&&e.jsx("div",{className:"mb-4 rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:g}),u?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading members..."}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:"No members."}):e.jsx("ul",{className:"space-y-2",children:l.map(t=>{const p=t.user_id===(d==null?void 0:d.userId),w=t.role==="owner"||t.role==="admin",S=v&&(!w||L),R=S&&!(t.role==="owner"&&l.filter(o=>o.role==="owner").length<=1),A=["owner","admin","member"];return e.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-xl border border-border bg-surface-1 px-4 py-3",children:[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 font-medium text-text-primary",children:t.username||t.user_id}),p&&e.jsx("span",{className:"text-xs text-text-muted",children:i("team.member.you")}),e.jsx("span",{className:J("shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-medium",U[t.role]||U.member),children:F(t.role)})]}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-text-muted",children:t.user_id})]}),v&&e.jsxs(K,{children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",disabled:!S,className:"shrink-0 rounded-md p-1.5 text-text-muted transition-colors hover:bg-surface-2 hover:text-text-primary disabled:opacity-40 disabled:hover:bg-transparent","aria-label":i("team.member.changeRole"),title:i("team.member.changeRole"),children:e.jsx(V,{className:"h-4 w-4"})})}),e.jsxs(Z,{align:"end",className:"w-48",children:[e.jsx(ee,{className:"text-xs text-text-muted",children:i("team.member.changeRole")}),A.map(o=>e.jsxs(M,{onSelect:()=>_(t,o),className:"flex items-center justify-between",children:[e.jsx("span",{children:F(o)}),t.role===o&&e.jsx(B,{className:"h-3.5 w-3.5 text-brand"})]},o)),e.jsx(te,{}),e.jsxs(M,{variant:"destructive",disabled:!R,onSelect:()=>s(t),className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:i("team.member.remove")})]})]})]})]},t.user_id)})})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:i("team.detail.environments")}),e.jsx(le,{teamId:r.id,canManage:v})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:i("team.detail.invitations")}),e.jsx(ce,{teamId:r.id,canManage:v})]})]})}export{ve as TeamDetail};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-DE_-CLIE.js";import{as as l,p as a}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function c(){const{myTeams:t,isLoading:i}=l();return i?e.jsx("div",{className:"px-6 py-20 sm:px-10",children:e.jsxs("div",{className:"max-w-4xl",children:[e.jsx("div",{className:"h-8 w-32 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"mt-12 space-y-10",children:[0,1,2].map(s=>e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-surface-2"})]},s))})]})}):e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary sm:text-4xl",children:"Teams"}),e.jsx("p",{className:"mt-3 text-sm text-text-muted",children:t.length===0?"Create your first team to start collaborating.":`${t.length} ${t.length===1?"team":"teams"}`})]}),t.length===0?e.jsx("div",{className:"py-8",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md bg-accent px-5 py-2.5 text-sm font-medium text-white transition-all hover:bg-accent/90 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"Create team"]})}):e.jsx("ul",{className:"space-y-10",children:t.map(s=>e.jsx("li",{children:e.jsxs("a",{href:`/teams/${s.slug}`,className:"group block",children:[e.jsxs("div",{className:"flex items-baseline gap-4",children:[e.jsx("h2",{className:"font-display text-xl font-medium tracking-tight text-text-primary transition-colors group-hover:text-accent",children:s.name}),e.jsxs("span",{className:"font-mono text-xs text-text-muted",children:["/",s.slug]})]}),s.description?e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-text-muted",children:s.description}):e.jsx("p",{className:"mt-2 text-sm italic text-text-muted/60",children:"No description"})]})},s.id))}),t.length>0&&e.jsx("div",{className:"mt-16",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md border border-border px-4 py-2 text-sm font-medium text-text-primary transition-all hover:bg-surface-2 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"New team"]})})]})}export{c as TeamList};
1
+ import{j as e}from"./vendor-DE_-CLIE.js";import{at as l,p as a}from"./main-Ckj6POvG.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function c(){const{myTeams:t,isLoading:i}=l();return i?e.jsx("div",{className:"px-6 py-20 sm:px-10",children:e.jsxs("div",{className:"max-w-4xl",children:[e.jsx("div",{className:"h-8 w-32 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"mt-12 space-y-10",children:[0,1,2].map(s=>e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-surface-2"})]},s))})]})}):e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary sm:text-4xl",children:"Teams"}),e.jsx("p",{className:"mt-3 text-sm text-text-muted",children:t.length===0?"Create your first team to start collaborating.":`${t.length} ${t.length===1?"team":"teams"}`})]}),t.length===0?e.jsx("div",{className:"py-8",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md bg-accent px-5 py-2.5 text-sm font-medium text-white transition-all hover:bg-accent/90 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"Create team"]})}):e.jsx("ul",{className:"space-y-10",children:t.map(s=>e.jsx("li",{children:e.jsxs("a",{href:`/teams/${s.slug}`,className:"group block",children:[e.jsxs("div",{className:"flex items-baseline gap-4",children:[e.jsx("h2",{className:"font-display text-xl font-medium tracking-tight text-text-primary transition-colors group-hover:text-accent",children:s.name}),e.jsxs("span",{className:"font-mono text-xs text-text-muted",children:["/",s.slug]})]}),s.description?e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-text-muted",children:s.description}):e.jsx("p",{className:"mt-2 text-sm italic text-text-muted/60",children:"No description"})]})},s.id))}),t.length>0&&e.jsx("div",{className:"mt-16",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md border border-border px-4 py-2 text-sm font-medium text-text-primary transition-all hover:bg-surface-2 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"New team"]})})]})}export{c as TeamList};