@saluzi/saluzi-edu 0.2.60 → 0.2.61

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 (145) hide show
  1. package/dist/cli.js +177 -41
  2. package/dist/parade/web/cube.js +33 -2
  3. package/dist/parade/web/menu.html +195 -0
  4. package/dist/rcs-web/assets/{AdminPanel-BMgxq2d0.js → AdminPanel-Xlza8Stt.js} +1 -1
  5. package/{packages/remote-control-server/web/dist/assets/Claim-DRJ_CmK0.js → dist/rcs-web/assets/Claim-BMWwu213.js} +1 -1
  6. package/{packages/remote-control-server/web/dist/assets/Dashboard-CablTsf3.js → dist/rcs-web/assets/Dashboard-D5awDzM3.js} +1 -1
  7. package/{packages/remote-control-server/web/dist/assets/Join-a80j0Uiw.js → dist/rcs-web/assets/Join-ok37ggfZ.js} +1 -1
  8. package/dist/rcs-web/assets/{Login-DclVxA4Q.js → Login-5qo97rq-.js} +1 -1
  9. package/dist/rcs-web/assets/{Register-DizfWHKb.js → Register-D_UOG8ar.js} +1 -1
  10. package/dist/rcs-web/assets/SessionDetail-BbHrR4Qu.js +65 -0
  11. package/dist/rcs-web/assets/{SessionVisibilityBadge-Bp4kZdZ4.js → SessionVisibilityBadge-Dy4FwTzo.js} +1 -1
  12. package/dist/rcs-web/assets/{Setup-DIw3Qc5x.js → Setup-GnPeNyH9.js} +1 -1
  13. package/dist/rcs-web/assets/{ShareLanding-CmyujISc.js → ShareLanding-CUjQydLL.js} +1 -1
  14. package/dist/rcs-web/assets/{TeamCreate-fq5PdqO_.js → TeamCreate-Ck2fEoUW.js} +1 -1
  15. package/dist/rcs-web/assets/{TeamDetail-haFVDL0P.js → TeamDetail-De6EPND0.js} +1 -1
  16. package/dist/rcs-web/assets/{TeamList-CR63fSv_.js → TeamList-C-0LJRxd.js} +1 -1
  17. package/dist/rcs-web/assets/{TeamSettings-BlXY05zK.js → TeamSettings-BszOrXVW.js} +1 -1
  18. package/dist/rcs-web/assets/{UserSearchInput-Cpg_A_Py.js → UserSearchInput-CyQWtLL-.js} +1 -1
  19. package/dist/rcs-web/assets/{UserSettings-BzHH2wQ6.js → UserSettings-DgyYp-1y.js} +1 -1
  20. package/dist/rcs-web/assets/{arc-cULKnhNn.js → arc-BaOPt7k-.js} +1 -1
  21. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-CXLnNGBR.js → architectureDiagram-3BPJPVTR-SvIakXbT.js} +1 -1
  22. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-BPQU9CvK.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-CiDp9J7i.js} +1 -1
  23. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-x76XWolr.js → c4Diagram-AAUBKEIU-D9wzA9ur.js} +1 -1
  24. package/dist/rcs-web/assets/channel-CirgRB_G.js +1 -0
  25. package/dist/rcs-web/assets/{chunk-2J33WTMH-C2xuSz2p.js → chunk-2J33WTMH-qfYueRAP.js} +1 -1
  26. package/dist/rcs-web/assets/{chunk-4BX2VUAB-BPsGJ9Ky.js → chunk-4BX2VUAB-D1V_UCiK.js} +1 -1
  27. package/dist/rcs-web/assets/{chunk-55IACEB6-DV5Xxy86.js → chunk-55IACEB6-C67QiGmo.js} +1 -1
  28. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-dwWMJ2pm.js → dist/rcs-web/assets/chunk-727SXJPM-D2Wln4TT.js} +1 -1
  29. package/dist/rcs-web/assets/{chunk-AQP2D5EJ-CkxHIiMh.js → chunk-AQP2D5EJ-03h8hZhw.js} +1 -1
  30. package/dist/rcs-web/assets/{chunk-FMBD7UC4-CyuNPJ-2.js → chunk-FMBD7UC4-7zas8pDp.js} +1 -1
  31. package/dist/rcs-web/assets/{chunk-ND2GUHAM-L7in2-8e.js → chunk-ND2GUHAM-PUXucyY6.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-QZHKN3VN-xFEPbqY9.js → chunk-QZHKN3VN-M3U5l4yW.js} +1 -1
  33. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-Cq12UEz9.js +1 -0
  34. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-Cq12UEz9.js +1 -0
  35. package/dist/rcs-web/assets/{code-block-IT6T5CEO-hkRn_BN_.js → code-block-IT6T5CEO-BgUazuuS.js} +1 -1
  36. package/dist/rcs-web/assets/{copy-B8rXAtFb.js → copy-DjaSB1Rw.js} +1 -1
  37. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-DSZFWhhn.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-zPupX74N.js} +1 -1
  38. package/dist/rcs-web/assets/{dagre-BM42HDAG-B5wjmFJL.js → dagre-BM42HDAG-B_EJ050J.js} +1 -1
  39. package/dist/rcs-web/assets/{diagram-2AECGRRQ-CGeTqGVq.js → diagram-2AECGRRQ-dnnxPH7w.js} +1 -1
  40. package/dist/rcs-web/assets/{diagram-5GNKFQAL-B9-2D-Y8.js → diagram-5GNKFQAL-CLEOqCLZ.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-KO2AKTUF-BVCQ5UyX.js → diagram-KO2AKTUF-DKBGpiRW.js} +1 -1
  42. package/dist/rcs-web/assets/{diagram-LMA3HP47-Cj4gFMtD.js → diagram-LMA3HP47-BAilhXiA.js} +1 -1
  43. package/dist/rcs-web/assets/{diagram-OG6HWLK6-BBpaH0il.js → diagram-OG6HWLK6-C3CdmOxC.js} +1 -1
  44. package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-DS19qy_q.js → erDiagram-TEJ5UH35-D1yv-3Jv.js} +1 -1
  45. package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-D9WY3n6O.js → flowDiagram-I6XJVG4X-DpW11XWj.js} +1 -1
  46. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-BNOSopT7.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CWr8suZm.js} +1 -1
  47. package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-WBmYjFoA.js → gitGraphDiagram-PVQCEYII-BspxLSNV.js} +1 -1
  48. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-D3l4nC2Y.js → infoDiagram-5YYISTIA-Bow20s-Q.js} +1 -1
  49. package/dist/rcs-web/assets/{ishikawaDiagram-YF4QCWOH-BYDxMH9Q.js → ishikawaDiagram-YF4QCWOH-BESvGYGI.js} +1 -1
  50. package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-BSD6AEvb.js → journeyDiagram-JHISSGLW-DZ6gzC7H.js} +1 -1
  51. package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-DtqGr_PI.js → kanban-definition-UN3LZRKU-DIQo2GiM.js} +1 -1
  52. package/dist/rcs-web/assets/{linear-CaKAAJC6.js → linear-CdXALiZ8.js} +1 -1
  53. package/dist/rcs-web/assets/{main-Dk8hyS_b.js → main-CwLwGVDc.js} +3 -3
  54. package/dist/rcs-web/assets/{mermaid-VLURNSYL-f6St46tQ.js → mermaid-VLURNSYL-C0ZKM74W.js} +4 -4
  55. package/dist/rcs-web/assets/{mermaid.core-DWc0M-5V.js → mermaid.core-eEtoQhrQ.js} +5 -5
  56. package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-D0RkeEqx.js → mindmap-definition-RKZ34NQL-CcW3H_cH.js} +1 -1
  57. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-YlDnS5wa.js → pieDiagram-4H26LBE5-DpXUpJMl.js} +1 -1
  58. package/{packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-CZcVTIBE.js → dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-DOwMRzzP.js} +1 -1
  59. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-BUn0r08O.js → requirementDiagram-4Y6WPE33-CBi_6NcW.js} +1 -1
  60. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-Dr_ywHhs.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CKbAoTHm.js} +1 -1
  61. package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-Bts1oven.js → sequenceDiagram-3UESZ5HK-a3rYCe-w.js} +1 -1
  62. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-DFbylE7U.js → stateDiagram-AJRCARHV-B6R_Dt84.js} +1 -1
  63. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-Bzl4YDMv.js → stateDiagram-v2-BHNVJYJU-Cq935fvz.js} +1 -1
  64. package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-BtqngM31.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-8DXPKq1k.js} +1 -1
  65. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-D1hGAcgx.js → vennDiagram-CIIHVFJN-BfDEkku5.js} +1 -1
  66. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-Cf3_zw3F.js → wardleyDiagram-YWT4CUSO-Dvp2XZVf.js} +1 -1
  67. package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-BuQiwlY7.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-DiPjQLUx.js} +1 -1
  68. package/dist/rcs-web/index.html +1 -1
  69. package/package.json +1 -1
  70. package/packages/remote-control-server/src/__tests__/routes.test.ts +15 -5
  71. package/packages/remote-control-server/src/__tests__/turn-end-status.test.ts +205 -0
  72. package/packages/remote-control-server/src/routes/v2/worker-events.ts +22 -0
  73. package/packages/remote-control-server/web/dist/assets/{AdminPanel-BMgxq2d0.js → AdminPanel-Xlza8Stt.js} +1 -1
  74. package/{dist/rcs-web/assets/Claim-DRJ_CmK0.js → packages/remote-control-server/web/dist/assets/Claim-BMWwu213.js} +1 -1
  75. package/{dist/rcs-web/assets/Dashboard-CablTsf3.js → packages/remote-control-server/web/dist/assets/Dashboard-D5awDzM3.js} +1 -1
  76. package/{dist/rcs-web/assets/Join-a80j0Uiw.js → packages/remote-control-server/web/dist/assets/Join-ok37ggfZ.js} +1 -1
  77. package/packages/remote-control-server/web/dist/assets/{Login-DclVxA4Q.js → Login-5qo97rq-.js} +1 -1
  78. package/packages/remote-control-server/web/dist/assets/{Register-DizfWHKb.js → Register-D_UOG8ar.js} +1 -1
  79. package/packages/remote-control-server/web/dist/assets/SessionDetail-BbHrR4Qu.js +65 -0
  80. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-Bp4kZdZ4.js → SessionVisibilityBadge-Dy4FwTzo.js} +1 -1
  81. package/packages/remote-control-server/web/dist/assets/{Setup-DIw3Qc5x.js → Setup-GnPeNyH9.js} +1 -1
  82. package/packages/remote-control-server/web/dist/assets/{ShareLanding-CmyujISc.js → ShareLanding-CUjQydLL.js} +1 -1
  83. package/packages/remote-control-server/web/dist/assets/{TeamCreate-fq5PdqO_.js → TeamCreate-Ck2fEoUW.js} +1 -1
  84. package/packages/remote-control-server/web/dist/assets/{TeamDetail-haFVDL0P.js → TeamDetail-De6EPND0.js} +1 -1
  85. package/packages/remote-control-server/web/dist/assets/{TeamList-CR63fSv_.js → TeamList-C-0LJRxd.js} +1 -1
  86. package/packages/remote-control-server/web/dist/assets/{TeamSettings-BlXY05zK.js → TeamSettings-BszOrXVW.js} +1 -1
  87. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-Cpg_A_Py.js → UserSearchInput-CyQWtLL-.js} +1 -1
  88. package/packages/remote-control-server/web/dist/assets/{UserSettings-BzHH2wQ6.js → UserSettings-DgyYp-1y.js} +1 -1
  89. package/packages/remote-control-server/web/dist/assets/{arc-cULKnhNn.js → arc-BaOPt7k-.js} +1 -1
  90. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-CXLnNGBR.js → architectureDiagram-3BPJPVTR-SvIakXbT.js} +1 -1
  91. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-BPQU9CvK.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CiDp9J7i.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-x76XWolr.js → c4Diagram-AAUBKEIU-D9wzA9ur.js} +1 -1
  93. package/packages/remote-control-server/web/dist/assets/channel-CirgRB_G.js +1 -0
  94. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-C2xuSz2p.js → chunk-2J33WTMH-qfYueRAP.js} +1 -1
  95. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-BPsGJ9Ky.js → chunk-4BX2VUAB-D1V_UCiK.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-DV5Xxy86.js → chunk-55IACEB6-C67QiGmo.js} +1 -1
  97. package/{dist/rcs-web/assets/chunk-727SXJPM-dwWMJ2pm.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-D2Wln4TT.js} +1 -1
  98. package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-CkxHIiMh.js → chunk-AQP2D5EJ-03h8hZhw.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-CyuNPJ-2.js → chunk-FMBD7UC4-7zas8pDp.js} +1 -1
  100. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-L7in2-8e.js → chunk-ND2GUHAM-PUXucyY6.js} +1 -1
  101. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-xFEPbqY9.js → chunk-QZHKN3VN-M3U5l4yW.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-Cq12UEz9.js +1 -0
  103. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-Cq12UEz9.js +1 -0
  104. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-hkRn_BN_.js → code-block-IT6T5CEO-BgUazuuS.js} +1 -1
  105. package/packages/remote-control-server/web/dist/assets/{copy-B8rXAtFb.js → copy-DjaSB1Rw.js} +1 -1
  106. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-DSZFWhhn.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-zPupX74N.js} +1 -1
  107. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-B5wjmFJL.js → dagre-BM42HDAG-B_EJ050J.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-CGeTqGVq.js → diagram-2AECGRRQ-dnnxPH7w.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-B9-2D-Y8.js → diagram-5GNKFQAL-CLEOqCLZ.js} +1 -1
  110. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-BVCQ5UyX.js → diagram-KO2AKTUF-DKBGpiRW.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-Cj4gFMtD.js → diagram-LMA3HP47-BAilhXiA.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-BBpaH0il.js → diagram-OG6HWLK6-C3CdmOxC.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-DS19qy_q.js → erDiagram-TEJ5UH35-D1yv-3Jv.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-D9WY3n6O.js → flowDiagram-I6XJVG4X-DpW11XWj.js} +1 -1
  115. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-BNOSopT7.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CWr8suZm.js} +1 -1
  116. package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-WBmYjFoA.js → gitGraphDiagram-PVQCEYII-BspxLSNV.js} +1 -1
  117. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-D3l4nC2Y.js → infoDiagram-5YYISTIA-Bow20s-Q.js} +1 -1
  118. package/packages/remote-control-server/web/dist/assets/{ishikawaDiagram-YF4QCWOH-BYDxMH9Q.js → ishikawaDiagram-YF4QCWOH-BESvGYGI.js} +1 -1
  119. package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-BSD6AEvb.js → journeyDiagram-JHISSGLW-DZ6gzC7H.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-DtqGr_PI.js → kanban-definition-UN3LZRKU-DIQo2GiM.js} +1 -1
  121. package/packages/remote-control-server/web/dist/assets/{linear-CaKAAJC6.js → linear-CdXALiZ8.js} +1 -1
  122. package/packages/remote-control-server/web/dist/assets/{main-Dk8hyS_b.js → main-CwLwGVDc.js} +3 -3
  123. package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-f6St46tQ.js → mermaid-VLURNSYL-C0ZKM74W.js} +4 -4
  124. package/packages/remote-control-server/web/dist/assets/{mermaid.core-DWc0M-5V.js → mermaid.core-eEtoQhrQ.js} +5 -5
  125. package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-D0RkeEqx.js → mindmap-definition-RKZ34NQL-CcW3H_cH.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-YlDnS5wa.js → pieDiagram-4H26LBE5-DpXUpJMl.js} +1 -1
  127. package/{dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-CZcVTIBE.js → packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-DOwMRzzP.js} +1 -1
  128. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-BUn0r08O.js → requirementDiagram-4Y6WPE33-CBi_6NcW.js} +1 -1
  129. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-Dr_ywHhs.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CKbAoTHm.js} +1 -1
  130. package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-Bts1oven.js → sequenceDiagram-3UESZ5HK-a3rYCe-w.js} +1 -1
  131. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-DFbylE7U.js → stateDiagram-AJRCARHV-B6R_Dt84.js} +1 -1
  132. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-Bzl4YDMv.js → stateDiagram-v2-BHNVJYJU-Cq935fvz.js} +1 -1
  133. package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-BtqngM31.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-8DXPKq1k.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-D1hGAcgx.js → vennDiagram-CIIHVFJN-BfDEkku5.js} +1 -1
  135. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-Cf3_zw3F.js → wardleyDiagram-YWT4CUSO-Dvp2XZVf.js} +1 -1
  136. package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-BuQiwlY7.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-DiPjQLUx.js} +1 -1
  137. package/packages/remote-control-server/web/dist/index.html +1 -1
  138. package/dist/rcs-web/assets/SessionDetail-CJoBz0DU.js +0 -65
  139. package/dist/rcs-web/assets/channel-DVf9sV9K.js +0 -1
  140. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DfHzlu2X.js +0 -1
  141. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DfHzlu2X.js +0 -1
  142. package/packages/remote-control-server/web/dist/assets/SessionDetail-CJoBz0DU.js +0 -65
  143. package/packages/remote-control-server/web/dist/assets/channel-DVf9sV9K.js +0 -1
  144. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DfHzlu2X.js +0 -1
  145. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DfHzlu2X.js +0 -1
@@ -610,6 +610,17 @@ function sendFocus(pid, row) {
610
610
 
611
611
  document.addEventListener('contextmenu', function (e) {
612
612
  e.preventDefault()
613
+ // Electron bridge: the menu opens as its own cursor-anchored popup window
614
+ // (see paradeWindow.ts 'parade-open-menu'), so it can extend beyond this
615
+ // window's bounds — the in-page fallback below is clipped by them, which
616
+ // truncated the menu on the small logo/mini modes.
617
+ if (window.parade && typeof window.parade.openMenu === 'function') {
618
+ window.parade.openMenu({ mode: displayMode, rot: cubeMode })
619
+ return
620
+ }
621
+ // Fallback (bridge missing — e.g. debugging the UI in a regular browser
622
+ // tab): show the in-page menu with flip/clamp positioning, accepting that
623
+ // it cannot leave the window.
613
624
  updateModeLabel()
614
625
  updateViewMenu()
615
626
  ctxMenu.style.display = 'block'
@@ -625,6 +636,20 @@ document.addEventListener('contextmenu', function (e) {
625
636
  ctxMenu.style.top = y + 'px'
626
637
  })
627
638
 
639
+ // Actions arriving from the popup menu window (relayed via the main process).
640
+ // The parade window stays the source of truth — the popup only reports what
641
+ // was clicked, this side applies and persists it.
642
+ if (window.parade && typeof window.parade.onMenuAction === 'function') {
643
+ window.parade.onMenuAction(function (action) {
644
+ if (!action || typeof action !== 'object') return
645
+ if (action.type === 'view' && MODES[action.value]) {
646
+ setMode(action.value)
647
+ } else if (action.type === 'rotation') {
648
+ toggleRotationMode()
649
+ }
650
+ })
651
+ }
652
+
628
653
  // Frameless window drag + corner resize via IPC (Electron). Left-click on
629
654
  // the body starts a move-drag; left-click on a .corner-handle starts a
630
655
  // proportional resize. The main process polls the cursor and moves/resizes
@@ -722,8 +747,8 @@ function updateModeLabel() {
722
747
  'Rotation: ' + (cubeMode === 'dynamic' ? 'Dynamic' : 'Static')
723
748
  }
724
749
 
725
- ctxMode.addEventListener('click', function () {
726
- ctxMenu.style.display = 'none'
750
+ // Shared by the in-page menu (fallback) and the popup menu action relay.
751
+ function toggleRotationMode() {
727
752
  cubeMode = cubeMode === 'dynamic' ? 'static' : 'dynamic'
728
753
  try {
729
754
  localStorage.setItem('parade-cube-mode', cubeMode)
@@ -732,6 +757,12 @@ ctxMode.addEventListener('click', function () {
732
757
  }
733
758
  updateModeLabel()
734
759
  updateCubeRotation()
760
+ }
761
+
762
+ ctxMode.addEventListener('click', function (e) {
763
+ e.stopPropagation()
764
+ ctxMenu.style.display = 'none'
765
+ toggleRotationMode()
735
766
  })
736
767
 
737
768
  updateModeLabel()
@@ -0,0 +1,195 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Parade Menu</title>
6
+ <!--
7
+ Standalone host for the parade right-click context menu.
8
+
9
+ Why a separate page: the menu used to be a DOM element inside index.html,
10
+ but a page can never paint outside its own window — and the parade window
11
+ can be as small as 100x80 (logo mode), so the menu was truncated. The
12
+ electron main script (paradeWindow.ts) opens this page in a second
13
+ frameless, transparent, always-on-top popup window anchored at the OS
14
+ cursor, so the menu can extend beyond the parade window.
15
+
16
+ Contract with the electron main script:
17
+ - Window size: MENU_W x MENU_H design px (158x147) — the constants in
18
+ paradeWindow.ts MUST match the locked layout below.
19
+ - Query params: ?mode=<displayMode>&rot=<dynamic|static>&zoom=<dpiScale>
20
+ zoom is applied identically to index.html (physical px compensation on
21
+ --force-device-scale-factor=1 Win11; multiply window size by unitScale).
22
+ - Selections: window.paradeMenu.action({type:'view', value}) or
23
+ ({type:'rotation'}) → IPC parade-menu-action → relayed to the parade
24
+ window renderer, which stays the single source of truth for mode state.
25
+ -->
26
+ <style>
27
+ :root {
28
+ /* Same design tokens as index.html — keep in sync. */
29
+ --bg-elev: #1d1830;
30
+ --border: rgba(139, 92, 246, 0.18);
31
+ --purple: #8B5CF6;
32
+ --purple-soft: #a78bfa;
33
+ --text: #e7e3f4;
34
+ --text-faint: #5c5575;
35
+ }
36
+ * { margin: 0; padding: 0; box-sizing: border-box; }
37
+ html, body {
38
+ width: 100%; height: 100%; overflow: hidden;
39
+ /* Transparent so the popup window shows only the menu card. */
40
+ background: transparent;
41
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
42
+ color: var(--text);
43
+ user-select: none;
44
+ -webkit-font-smoothing: antialiased;
45
+ }
46
+ /* Same card as index.html's #ctx-menu — keep in sync. Line-heights and
47
+ paddings are locked so the total height is exactly 147px regardless of
48
+ system font metrics:
49
+ border 2 + padding 6 + label 17 + 4 items x 23 + sep 7 + item 23 */
50
+ #menu {
51
+ display: block;
52
+ position: fixed;
53
+ top: 0;
54
+ left: 0;
55
+ width: 158px;
56
+ background: var(--bg-elev);
57
+ border: 1px solid var(--border);
58
+ border-radius: 6px;
59
+ padding: 3px;
60
+ box-shadow: 0 4px 16px rgba(0,0,0,0.5);
61
+ transform-origin: top left;
62
+ animation: menu-in 0.12s ease;
63
+ }
64
+ @keyframes menu-in {
65
+ from { opacity: 0; transform: scale(0.96); }
66
+ }
67
+ #menu .ctx-label {
68
+ padding: 4px 12px 2px;
69
+ font-size: 9px;
70
+ line-height: 11px;
71
+ letter-spacing: 1px;
72
+ text-transform: uppercase;
73
+ color: var(--text-faint);
74
+ cursor: default;
75
+ }
76
+ #menu .ctx-item {
77
+ padding: 5px 12px;
78
+ font-size: 11px;
79
+ line-height: 13px;
80
+ color: var(--text);
81
+ cursor: pointer;
82
+ border-radius: 4px;
83
+ transition: background 0.1s;
84
+ }
85
+ #menu .ctx-item:hover {
86
+ background: var(--purple);
87
+ color: #fff;
88
+ }
89
+ #menu .ctx-sep {
90
+ height: 1px;
91
+ background: var(--border);
92
+ margin: 3px 6px;
93
+ }
94
+ /* View-mode radio bullets — same as index.html */
95
+ #menu .ctx-view::before {
96
+ content: '';
97
+ display: inline-block;
98
+ width: 9px; height: 9px;
99
+ border-radius: 50%;
100
+ border: 1px solid var(--text-faint);
101
+ margin-right: 7px;
102
+ vertical-align: -1px;
103
+ box-sizing: border-box;
104
+ }
105
+ #menu .ctx-view.active::before {
106
+ border-color: var(--purple);
107
+ background: var(--purple);
108
+ box-shadow: inset 0 0 0 2px var(--bg-elev);
109
+ }
110
+ #menu .ctx-view.active {
111
+ color: var(--purple-soft);
112
+ }
113
+ #menu .ctx-view.active:hover { color: #fff; }
114
+ </style>
115
+ </head>
116
+ <body>
117
+ <div id="menu">
118
+ <div class="ctx-label">View</div>
119
+ <div class="ctx-item ctx-view" data-view="logo">Cube only</div>
120
+ <div class="ctx-item ctx-view" data-view="mini">Cube + counts</div>
121
+ <div class="ctx-item ctx-view" data-view="standard">Standard</div>
122
+ <div class="ctx-item ctx-view" data-view="detail">Detail</div>
123
+ <div class="ctx-sep"></div>
124
+ <div class="ctx-item" id="ctx-mode">Rotation: Dynamic</div>
125
+ </div>
126
+ <script>
127
+ // Reflect the parade window's current state passed via query string.
128
+ ;(function () {
129
+ var q = new URLSearchParams(window.location.search)
130
+
131
+ // DPI compensation — identical mechanism to index.html/cube.js: the main
132
+ // process forces 1 CSS px = 1 physical px on Win11, then we CSS-zoom the
133
+ // content by the OS DPI factor so physical size matches intent. Applied at
134
+ // parse time; the window was sized as design px x unitScale by main.
135
+ var zoom = parseFloat(q.get('zoom')) || 0
136
+ if (zoom > 1) document.documentElement.style.zoom = String(zoom)
137
+
138
+ // Mark the active display mode radio item.
139
+ var mode = q.get('mode') || ''
140
+ var views = document.querySelectorAll('.ctx-view')
141
+ for (let i = 0; i < views.length; i++) {
142
+ if (views[i].getAttribute('data-view') === mode) {
143
+ views[i].classList.add('active')
144
+ }
145
+ }
146
+
147
+ // Rotation label.
148
+ var rot = q.get('rot') === 'static' ? 'static' : 'dynamic'
149
+ var modeEl = document.getElementById('ctx-mode')
150
+ if (modeEl) {
151
+ modeEl.textContent = 'Rotation: ' + (rot === 'dynamic' ? 'Dynamic' : 'Static')
152
+ }
153
+ })()
154
+
155
+ // Report a selection to the electron main process, which closes the popup and
156
+ // relays the action to the parade window renderer.
157
+ function reportAction(action) {
158
+ if (window.paradeMenu && typeof window.paradeMenu.action === 'function') {
159
+ window.paradeMenu.action(action)
160
+ }
161
+ }
162
+
163
+ // View-mode radio items.
164
+ var viewItems = document.querySelectorAll('.ctx-view')
165
+ for (let i = 0; i < viewItems.length; i++) {
166
+ ;(function (el) {
167
+ el.addEventListener('click', function () {
168
+ reportAction({ type: 'view', value: el.getAttribute('data-view') })
169
+ })
170
+ })(viewItems[i])
171
+ }
172
+
173
+ // Rotation toggle — the parade window applies and persists the new mode.
174
+ var modeEl = document.getElementById('ctx-mode')
175
+ if (modeEl) {
176
+ modeEl.addEventListener('click', function () {
177
+ reportAction({ type: 'rotation' })
178
+ })
179
+ }
180
+
181
+ // Escape dismisses (native-menu parity).
182
+ document.addEventListener('keydown', function (e) {
183
+ if (e.key === 'Escape') {
184
+ try { window.close() } catch (_) { /* ignore */ }
185
+ }
186
+ })
187
+
188
+ // Right-click inside the menu: swallow it (prevents Electron/browser default
189
+ // menus); the parade window's own right-click re-anchors a fresh menu.
190
+ document.addEventListener('contextmenu', function (e) {
191
+ e.preventDefault()
192
+ })
193
+ </script>
194
+ </body>
195
+ </html>
@@ -1 +1 @@
1
- import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{ak as c,al as o,J as m,af as s,a8 as l,x as u}from"./main-Dk8hyS_b.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function j(){c();const[a,i]=d.useState([]),{myTeams:r,isLoading:x}=o(),n=d.useCallback(async()=>{try{const t=await m();i(t||[])}catch(t){console.error("Admin: failed to load sessions",t)}},[]);return d.useEffect(()=>{n()},[n]),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-8",children:[e.jsx("h1",{className:"mb-6 font-display text-2xl font-semibold text-text-primary",children:s("admin.title")}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.teams")," (",r.length,")"]}),x?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("common.loading")}):r.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noTeams")}):e.jsx("div",{className:"space-y-2",children:r.map(t=>e.jsxs("a",{href:`/teams/${t.slug}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium text-text-primary",children:t.name}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:t.slug})]}),e.jsx("span",{className:"text-xs text-text-muted",children:l(new Date(t.created_at).getTime()/1e3)})]},t.id))})]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.sessions")," (",a.length,")"]}),a.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noSessions")}):e.jsx("div",{className:"space-y-2",children:a.map(t=>e.jsxs("a",{href:`/code/${t.id}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",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.title||t.id}),e.jsx("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-xs text-text-muted",children:t.source||"unknown"})]}),e.jsx("div",{className:"truncate text-xs text-text-muted",children:t.id})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-3",children:[e.jsx(u,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:l(t.updated_at||t.created_at)})]})]},t.id))})]})]})})}export{j as AdminPanel};
1
+ import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{ak as c,al as o,J as m,af as s,a8 as l,x as u}from"./main-CwLwGVDc.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function j(){c();const[a,i]=d.useState([]),{myTeams:r,isLoading:x}=o(),n=d.useCallback(async()=>{try{const t=await m();i(t||[])}catch(t){console.error("Admin: failed to load sessions",t)}},[]);return d.useEffect(()=>{n()},[n]),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-8",children:[e.jsx("h1",{className:"mb-6 font-display text-2xl font-semibold text-text-primary",children:s("admin.title")}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.teams")," (",r.length,")"]}),x?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("common.loading")}):r.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noTeams")}):e.jsx("div",{className:"space-y-2",children:r.map(t=>e.jsxs("a",{href:`/teams/${t.slug}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium text-text-primary",children:t.name}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:t.slug})]}),e.jsx("span",{className:"text-xs text-text-muted",children:l(new Date(t.created_at).getTime()/1e3)})]},t.id))})]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.sessions")," (",a.length,")"]}),a.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noSessions")}):e.jsx("div",{className:"space-y-2",children:a.map(t=>e.jsxs("a",{href:`/code/${t.id}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",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.title||t.id}),e.jsx("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-xs text-text-muted",children:t.source||"unknown"})]}),e.jsx("div",{className:"truncate text-xs text-text-muted",children:t.id})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-3",children:[e.jsx(u,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:l(t.updated_at||t.created_at)})]})]},t.id))})]})]})})}export{j as AdminPanel};
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{E as u,J as f}from"./main-Dk8hyS_b.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,J as f}from"./main-CwLwGVDc.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,4 +1,4 @@
1
- import{j as e,e as o}from"./vendor-DE_-CLIE.js";import{a5 as O,a4 as _,al as E,aj as T,x as F,ak as L,af as a,a8 as A,q as $,s as W,e as H,r as V,d as P,ab as q,G,J,K,I as R}from"./main-Dk8hyS_b.js";import{g as D}from"./workerType-Bd-zteMi.js";import{S as U,D as Z,a as z,c as Q,d as X,b as Y}from"./SessionVisibilityBadge-Bp4kZdZ4.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
1
+ import{j as e,e as o}from"./vendor-DE_-CLIE.js";import{a5 as O,a4 as _,al as E,aj as T,x as F,ak as L,af as a,a8 as A,q as $,s as W,e as H,r as V,d as P,ab as q,G,J,K,I as R}from"./main-CwLwGVDc.js";import{g as D}from"./workerType-Bd-zteMi.js";import{S as U,D as Z,a as z,c as Q,d as X,b as Y}from"./SessionVisibilityBadge-Dy4FwTzo.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.
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aj as v,af as t}from"./main-Dk8hyS_b.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function E({onSuccess:b,onInvalidInvite:l}){const{join:f}=v(),[u,h]=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?h(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 f(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{aj as v,af as t}from"./main-CwLwGVDc.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function E({onSuccess:b,onInvalidInvite:l}){const{join:f}=v(),[u,h]=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?h(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 f(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{aj as f,af as t}from"./main-Dk8hyS_b.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{aj as f,af as t}from"./main-CwLwGVDc.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 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aj as y,af as t}from"./main-Dk8hyS_b.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{aj as y,af as t}from"./main-CwLwGVDc.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,65 @@
1
+ var ot=Object.defineProperty;var it=(s,t,r)=>t in s?ot(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var E=(s,t,r)=>it(s,typeof t!="symbol"?t+"":t,r);import{e as u,j as e}from"./vendor-DE_-CLIE.js";import{a5 as $,Q as lt,ad as ct,a0 as dt,a9 as xe,$ as F,V as ut,x as Ie,g as we,a8 as $e,L as qe,z as mt,w as xt,a7 as I,a4 as G,d as Pe,ag as Ne,W as pt,H as ht,_ as ft,ak as De,af as N,A as yt,aa as gt,F as bt,ah as jt,a6 as kt,I as wt,Y as Nt,y as Ue,P as vt,c as _t,C as St,R as ve,N as Ct,ac as Mt,D as Et,a as Tt,q as Fe,s as Oe,v as Rt,f as Le,e as He,r as ze,M as At}from"./main-CwLwGVDc.js";import{g as It}from"./workerType-Bd-zteMi.js";import{D as Ve,a as Be,c as We,d as Qe,b as $t,S as qt}from"./SessionVisibilityBadge-Dy4FwTzo.js";import{U as Pt}from"./UserSearchInput-CyQWtLL-.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.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 Dt=[["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"}]],Ut=$("activity",Dt);/**
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 Ft=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ot=$("chevron-right",Ft);/**
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 Lt=[["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"}]],Ye=$("cpu",Lt);/**
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 Ht=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],zt=$("external-link",Ht);/**
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 Vt=[["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"}]],Bt=$("hash",Vt);/**
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 Wt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Qt=$("info",Wt);/**
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 Yt=[["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"}]],Kt=$("message-square-text",Yt);/**
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 Gt=[["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"}]],Jt=$("play",Gt);/**
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 Xt=[["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"}]],Zt=$("server-cog",Xt);/**
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 es=[["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"}]],ts=$("share-2",es);/**
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 ss=[["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"}]],ns=$("shield-check",ss);/**
57
+ * @license lucide-react v0.555.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const rs=[["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"}]],as=$("triangle-alert",rs);function Ke(){return{tasks:{}}}const _e=3e4;function ae(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 os(s,t){var d,x,f,m,p,g,v,j,a,i,y,b;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:ae(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 k=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:ae(k),description:k,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 k=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:ae(k),description:k,toolUseId:t.tool_use_id,status:"running",startTime:l,tokenCount:(d=t.usage)==null?void 0:d.total_tokens,toolUseCount:(x=t.usage)==null?void 0:x.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:((m=t.usage)==null?void 0:m.total_tokens)??c.tokenCount,toolUseCount:((p=t.usage)==null?void 0:p.tool_uses)??c.toolUseCount,durationMs:((g=t.usage)==null?void 0:g.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:((i=t.usage)==null?void 0:i.total_tokens)??c.tokenCount,toolUseCount:((y=t.usage)==null?void 0:y.tool_uses)??c.toolUseCount,durationMs:((b=t.usage)==null?void 0:b.duration_ms)??c.durationMs,evictAfter:l+_e}}}:{tasks:{...s.tasks,[n]:{taskId:n,name:ae(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:l,endTime:l,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(v=t.usage)==null?void 0:v.total_tokens,toolUseCount:(j=t.usage)==null?void 0:j.tool_uses,durationMs:(a=t.usage)==null?void 0:a.duration_ms,evictAfter:l+_e}}}}function is(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 ls{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 d of this.listeners)d(c)}catch{}})}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._lastSeqNum=0}}const pe=new ls;function Se(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 Ce(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 he="streaming-";function cs(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 Me(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 ds{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",Ke());E(this,"seenUuids",new Set);E(this,"seenToolCallIds",new Set);E(this,"pendingControlRequests",new Map);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}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var f,m;const{events:t}=await lt(this.sessionId);if(!t||t.length===0)return;const r=[];let n=null;const l=()=>{n&&(r.push(n),n=null)};for(const p of t){const g=p.payload||{},v=g.uuid;if(typeof v=="string"&&v&&this.seenUuids.add(v),p.type==="tool_use"){const j=g.tool_call_id;typeof j=="string"&&j&&this.seenToolCallIds.add(j)}if(p.type==="user"){if(p.direction==="inbound")continue;l();const j=Se(g);j&&r.push({type:"user_message",id:p.id||`hist-user-${r.length}`,content:j})}else if(p.type==="assistant"){l();const j=Se(g),a=[],i=g.message;if(i&&typeof i=="object"&&Array.isArray(i.content)){for(const y of i.content)if(y.type==="tool_use"){const b=y.id;b&&this.seenToolCallIds.add(b),a.push({type:"tool_call",toolCall:{id:b||`hist-tool-${r.length}`,title:y.name||"tool",status:"complete",rawInput:y.input||{}}})}}if(j||a.length>0){n={type:"assistant_message",id:p.id||`hist-asst-${r.length}`,chunks:j?[{type:"message",text:j}]:[]},r.push(n);for(const y of a)r.push(y);n=null}}else if(p.type==="tool_use"){const j=g,a={type:"tool_call",toolCall:{id:j.tool_call_id||`hist-tool-${r.length}`,title:j.tool_name||"tool",status:"complete",rawInput:j.tool_input||{}}};r.push(a)}else if(p.type==="tool_result"){const j=g,a=Ce(r,j.tool_call_id||"");if(a>=0){const i=r[a];r[a]={type:"tool_call",toolCall:{...i.toolCall,rawOutput:{output:j.content||j.output||""}}}}}}l();let c=null;for(const p of t){if(p.type!=="task_state")continue;const g=p.payload||{};Array.isArray(g.tasks)&&(c=g.tasks)}if(c&&c.length>0){const p=Me(c);p.length>0&&r.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:p})}this.setEntries(r);let d=null,x=null;for(const p of t){const g=p.payload||{};if(p.type==="models_state"){const v=g.raw,j=v&&typeof v=="object"?v.models_state:g.models_state;j&&Array.isArray(j.availableModels)&&typeof j.currentModelId=="string"&&(d=j)}else if(p.type==="result"||p.type==="result_success"){const v=g.usage,j=typeof g.total_cost_usd=="number"?g.total_cost_usd:null;(v||j!==null)&&(x={inputTokens:((v==null?void 0:v.input_tokens)??0)+((v==null?void 0:v.cache_read_input_tokens)??0)+((v==null?void 0:v.cache_creation_input_tokens)??0),outputTokens:(v==null?void 0:v.output_tokens)??0,totalCostUsd:j})}}d&&((f=this.onModelsStateChange)==null||f.call(this,d)),x&&((m=this.onUsageChange)==null||m.call(this,x))}connectSSE(){pe.connect(this.sessionId),this.unsub=pe.onEvent(t=>this.handleEvent(t))}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),pe.disconnect()}handleEvent(t){var c,d,x,f,m,p,g,v,j;const r=t.type,n=t.payload||{},l=JSON.stringify(t);if(!/Remote Control connecting/i.test(l))switch(r){case"assistant":{const a=n.uuid;if(typeof a=="string"&&a){if(this.seenUuids.has(a))break;this.seenUuids.add(a)}const i=typeof n.content=="string"?n.content:"",y=cs(n);this.setEntries(k=>{const _=k[k.length-1];if((_==null?void 0:_.type)==="assistant_message"&&_.id.startsWith(he))return[...k.slice(0,-1),{..._,id:`assistant-${Date.now()}`,chunks:[...y?[{type:"thought",text:y}]:[],{type:"message",text:i}]}];if((_==null?void 0:_.type)==="assistant_message"){const S=_.chunks[_.chunks.length-1];return(S==null?void 0:S.type)==="message"?[...k.slice(0,-1),{..._,chunks:[..._.chunks.slice(0,-1),{type:"message",text:S.text+i}]}]:[...k.slice(0,-1),{..._,chunks:[..._.chunks,{type:"message",text:i}]}]}if(i&&i.trim()||y){const S={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...y?[{type:"thought",text:y}]:[],...i?[{type:"message",text:i}]:[]]};return[...k,S]}return k});const b=n.message;if(b&&typeof b=="object"&&Array.isArray(b.content)){const k=b.content.filter(_=>_.type==="tool_use");for(const _ of k){const S=_.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(S))continue;this.seenToolCallIds.add(S);const R={id:S,title:_.name||"tool",status:"running",rawInput:_.input||{}};this.setEntries(A=>[...A,{type:"tool_call",toolCall:R}])}}break}case"tool_use":{const a=n,i=a.tool_call_id||`call-${Date.now()}`;if(this.seenToolCallIds.has(i))break;this.seenToolCallIds.add(i);const y={id:i,title:a.tool_name||"tool",status:"running",rawInput:a.tool_input||{}};this.setEntries(b=>[...b,{type:"tool_call",toolCall:y}]);break}case"tool_result":{const a=n,i=a.tool_call_id||"";this.setEntries(y=>{const b=Ce(y,i);if(b<0)return y;const k=y[b];return y.map((_,S)=>S===b?{type:"tool_call",toolCall:{...k.toolCall,status:"complete",rawOutput:{output:a.content||a.output||""}}}:_)});break}case"control_request":case"permission_request":{const a=n.request;if(a&&a.subtype==="can_use_tool"){const i=n.request_id||"",y=a.tool_name||"unknown",b=a.input||a.tool_input||{},k=a.description||"",_=Array.isArray(a.permission_suggestions)?a.permission_suggestions:[];this.setEntries(S=>{const R=[...S].reverse().findIndex(A=>A.type==="tool_call");if(R>=0){const A=S.length-1-R,H=S[A];if(H.toolCall.status==="running")return S.map((q,B)=>B===A?{type:"tool_call",toolCall:{...H.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:i,options:[]}}}:q)}return S}),(c=this.onPermissionRequest)==null||c.call(this,{requestId:i,toolName:y,toolInput:b,description:k,suggestions:_})}else a&&a.subtype==="elicitation"&&((d=this.onElicitationRequest)==null||d.call(this,{requestId:n.request_id||"",serverName:a.mcp_server_name||"",message:a.message||"",mode:a.mode==="url"?"url":"form",url:typeof a.url=="string"?a.url:void 0,requestedSchema:a.requested_schema||void 0}));break}case"session_status":{if(ct(n)){this.setEntries([]);break}typeof n.status=="string"&&((x=this.onStatusChange)==null||x.call(this,n.status));break}case"error":{const a=String(n.message||n.content||"Unknown error");(f=this.onError)==null||f.call(this,a);break}case"models_state":{const a=n.raw,i=typeof a=="object"&&a!==null?a.models_state:n.models_state;i&&Array.isArray(i.availableModels)&&typeof i.currentModelId=="string"&&((m=this.onModelsStateChange)==null||m.call(this,i));break}case"system":{const a=n.raw,i=a&&typeof a=="object"?a:n,y=typeof i.subtype=="string"?i.subtype:void 0;if(y==="task_started"||y==="task_progress"||y==="task_notification"){const k={subtype:y,task_id:typeof i.task_id=="string"?i.task_id:void 0,tool_use_id:typeof i.tool_use_id=="string"?i.tool_use_id:void 0,description:typeof i.description=="string"?i.description:void 0,task_type:typeof i.task_type=="string"?i.task_type:void 0,workflow_name:typeof i.workflow_name=="string"?i.workflow_name:void 0,prompt:typeof i.prompt=="string"?i.prompt:void 0,usage:i.usage&&typeof i.usage=="object"?i.usage:void 0,last_tool_name:typeof i.last_tool_name=="string"?i.last_tool_name:void 0,summary:typeof i.summary=="string"?i.summary:void 0,status:i.status==="completed"||i.status==="failed"||i.status==="stopped"?i.status:void 0,output_file:typeof i.output_file=="string"?i.output_file:void 0};this.subagentState=os(this.subagentState,k)}const b=typeof i.permissionMode=="string"?i.permissionMode:typeof n.permissionMode=="string"?n.permissionMode:null;b&&((p=this.onPermissionModeChange)==null||p.call(this,b));break}case"control_response":{const a=n.response;if(a&&typeof a=="object"){const i=typeof a.request_id=="string"?a.request_id:"",y=typeof a.subtype=="string"?a.subtype:"";if(i){(g=this.onControlResponse)==null||g.call(this,{subtype:y,requestId:i,error:typeof a.error=="string"?a.error:void 0});const b=this.pendingControlRequests.get(i);b&&(this.pendingControlRequests.delete(i),b(y==="success"&&a.response&&typeof a.response=="object"?a.response:null))}}break}case"stream_event":{const a=n.event;if(!a||typeof a.type!="string")break;if(a.type==="content_block_delta"){const i=a.delta;if(!i||typeof i.type!="string")break;const y=i.type==="text_delta"?"message":i.type==="thinking_delta"?"thought":null;if(!y)break;const b=i.text??i.thinking;if(typeof b!="string"||!b)break;this.appendStreamingDelta(y,b)}break}case"partial_assistant":{const a=typeof n.content=="string"?n.content:"";a&&this.appendStreamingDelta("message",a);break}case"result":case"result_success":{(v=this.onStatusChange)==null||v.call(this,"idle");const a=n.usage,i=typeof n.total_cost_usd=="number"?n.total_cost_usd:null;if(a||i!==null){const y=((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);(j=this.onUsageChange)==null||j.call(this,{inputTokens:y,outputTokens:(a==null?void 0:a.output_tokens)??0,totalCostUsd:i})}break}case"task_state":{const a=Array.isArray(n.tasks)?n.tasks:[];if(a.length===0)break;const i=Me(a);if(i.length===0)break;this.setEntries(y=>[...y.filter(k=>k.type!=="plan"),{type:"plan",id:`plan-${n.task_list_id||Date.now()}`,entries:i}]);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(he)){const d=l.chunks[l.chunks.length-1];return(d==null?void 0:d.type)===t?[...n.slice(0,-1),{...l,chunks:[...l.chunks.slice(0,-1),{type:t,text:d.text+r}]}]:[...n.slice(0,-1),{...l,chunks:[...l.chunks,{type:t,text:r}]}]}const c={type:"assistant_message",id:`${he}${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 d={type:"user_message",id:`user-${Date.now()}`,content:t,images:l?r:void 0,attachments:c?n:void 0};this.setEntries(m=>[...m,d]);const x=[];if(t&&x.push({type:"text",text:t}),l)for(const m of r)x.push({type:"image",source:{type:"base64",media_type:m.mimeType,data:m.data}});if(c){for(const m of n)if(m.kind==="text"||m.kind==="table"){const p=`📎 ${m.name}${m.size!=null?` (${us(m.size)})`:""}`,g=m.textContent||"(空文件)";x.push({type:"text",text:`${p}
62
+ \`\`\`
63
+ ${g}
64
+ \`\`\``})}else if(m.kind==="directory"){const p=`📁 目录: ${m.name}${m.files!=null?` (${m.files.length} 个文件)`:""}`,g=m.textContent||"(空目录)";x.push({type:"text",text:`${p}
65
+ ${g}`})}}const f=x.length===1&&x[0].type==="text"?x[0].text||t:x.length>0?x:t;await dt(this.sessionId,{type:"user",uuid:xe(),content:t,message:{content:f}})}async respondPermission(t,r,n){await F(this.sessionId,{type:"permission_response",approved:r,request_id:t,...n}),this.setEntries(l=>l.map(c=>{var d;return c.type!=="tool_call"||((d=c.toolCall.permissionRequest)==null?void 0:d.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 ut(this.sessionId)}async setPermissionMode(t){const r=xe();return await F(this.sessionId,{type:"control_request",request_id:r,request:{subtype:"set_permission_mode",mode:t}}),r}async searchFiles(t,r=20){const n=xe(),l=new Promise(d=>{this.pendingControlRequests.set(n,d)});await F(this.sessionId,{type:"control_request",request_id:n,request:{subtype:"file_search",query:t,limit:r}});const c=setTimeout(()=>{const d=this.pendingControlRequests.get(n);d&&(this.pendingControlRequests.delete(n),d(null))},8e3);try{const d=await l;if(!d||!Array.isArray(d.suggestions))return[];const x=[];for(const f of d.suggestions)f&&typeof f=="object"&&typeof f.path=="string"&&x.push(f.path);return x}finally{clearTimeout(c)}}async respondElicitation(t,r,n){await F(this.sessionId,{type:"permission_response",approved:r==="accept",request_id:t,response:{subtype:"success",request_id:t,response:{action:r,...n?{content:n}:{}}}})}}function us(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function ms(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 xs(s){return s?Date.now()-s<6e4:!1}function ps({onClose:s,session:t,liveStatus:r,pendingPermissions:n,onInterrupt:l,onDelete:c}){const[d,x]=u.useState(!1),f=async()=>{await navigator.clipboard.writeText(t.id),x(!0),setTimeout(()=>x(!1),1500)},m=n.length,p=t.worker,g=t.work_item,v=t.environment;return e.jsx(Ve,{open:!0,onOpenChange:j=>{j||s()},children:e.jsxs(Be,{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(We,{children:e.jsx(Qe,{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(Ut,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{status:r||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:p&&(xs(p.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[p&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(we,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:ms(p.last_heartbeat_at)})]}),v&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Ye,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:v.machine_name||v.id})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(we,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:$e(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(qe,{className:"h-3.5 w-3.5"}),"Pending Actions"]}),m>0?e.jsxs("div",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning",children:[m," permission request",m>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(Zt,{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(mt,{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(Bt,{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:d?"✓":"⧉"})]})]}),g&&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:g.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:g.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})]}),v&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker type"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:v.worker_type})]})]})]})]})]})})}const Ee="rcs:subagent-panel:collapsed";function hs(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 fs(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 ys({status:s}){return s==="running"?e.jsx(qe,{className:"h-3 w-3 animate-spin text-brand"}):s==="completed"?e.jsx(Jt,{className:"h-3 w-3 text-status-success"}):s==="failed"||s==="stopped"?e.jsx(xt,{className:"h-3 w-3 text-status-error"}):null}function gs({task:s}){const t=s.status==="running",r=t?s.durationMs??Date.now()-s.startTime:(s.endTime??Date.now())-s.startTime,n=fs(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(ys,{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:hs(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 bs({state:s}){const[t,r]=u.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ee)==="1"}catch{return!1}}),n=()=>{r(f=>{const m=!f;try{window.localStorage.setItem(Ee,m?"1":"0")}catch{}return m})},[,l]=u.useState(0);u.useEffect(()=>{const f=Object.values(s.tasks).some(g=>g.status==="running"),m=Object.values(s.tasks).some(g=>g.status!=="running"&&g.evictAfter!==void 0);if(!f&&!m)return;const p=setInterval(()=>{l(g=>g+1)},1e3);return()=>clearInterval(p)},[s]);const c=is(s);if(c.length===0)return null;const d=c.filter(f=>f.status==="running").length,x=d>0?`${d} 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(Ot,{className:`h-3 w-3 transition-transform ${t?"":"rotate-90"}`}),e.jsx("span",{children:"Subagents"})]}),e.jsx("span",{children:x})]}),!t&&e.jsx("div",{id:"subagent-list",className:"space-y-1.5",children:c.map(f=>e.jsx(gs,{task:f},f.taskId))})]})})}function Te(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 js({requestId:s,toolName:t,toolInput:r,description:n,suggestions:l,onApprove:c,onApproveAlways:d,onReject:x}){const f=typeof r=="string"?r:JSON.stringify(r,null,2),m=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(as,{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:I(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:I(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:Ne(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"}),m&&d&&e.jsxs("button",{onClick:d,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:`允许并记住规则:${Te(t,l)}`,children:[e.jsx(ns,{className:"h-3.5 w-3.5"}),"Always allow ",Ne(Te(t,l),40)]}),e.jsx("button",{onClick:x,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 ks({questions:s,description:t,onSubmit:r,onSkip:n}){const[l,c]=u.useState({}),[d,x]=u.useState({}),[f,m]=u.useState(0),p=(a,i,y)=>{if(y){const b=l[a]||[],k=b.includes(i)?b.filter(_=>_!==i):[...b,i];c({...l,[a]:k})}else c({...l,[a]:i})},g=a=>{var y;const i=(y=d[a])==null?void 0:y.trim();i&&(c({...l,[a]:i}),x({...d,[a]:""}))},v=()=>{var i,y;const a={};for(const[b,k]of Object.entries(l)){const _=s[parseInt(b,10)];_&&(typeof k=="number"?a[b]=((y=(i=_.options)==null?void 0:i[k])==null?void 0:y.label)||String(k):Array.isArray(k)?a[b]=k.map(S=>{var R,A;return((A=(R=_.options)==null?void 0:R[S])==null?void 0:A.label)||String(S)}):a[b]=k)}r(a)};if(s.length<=1){const a=s[0]||{question:t,options:[],multiSelect:!1},i=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:I(t||a.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(a.options||[]).map((y,b)=>{const k=i?(l[0]||[]).includes(b):l[0]===b;return e.jsxs("button",{onClick:()=>p(0,b,i),className:G("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",k?"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:I(y.label)}),y.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:I(y.description)})]},b)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:d[0]||"",onChange:y=>x({...d,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"&&g(0)}),e.jsx("button",{onClick:()=>g(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:v,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 j=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:I(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:s.map((a,i)=>e.jsx("button",{onClick:()=>m(i),className:G("rounded-md px-3 py-1.5 text-xs whitespace-nowrap transition-colors",f===i?"bg-brand/20 text-brand":"text-text-muted hover:bg-surface-2"),children:a.header||`Q${i+1}`},i))}),j&&e.jsx(ws,{question:j,qIdx:f,answers:l,otherTexts:d,onSelect:p,onOtherTextChange:(a,i)=>x({...d,[a]:i}),onOtherSubmit:g}),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:v,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 ws({question:s,qIdx:t,answers:r,otherTexts:n,onSelect:l,onOtherTextChange:c,onOtherSubmit:d}){const x=s.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:I(s.question)}),e.jsxs("div",{className:"space-y-2",children:[(s.options||[]).map((f,m)=>{const p=x?(r[t]||[]).includes(m):r[t]===m;return e.jsxs("button",{onClick:()=>l(t,m,x),className:G("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",p?"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:I(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:I(f.description)})]},m)}),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"&&d(t)}),e.jsx("button",{onClick:()=>d(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 Ns({planContent:s,description:t,onSubmit:r}){const[n,l]=u.useState(null),[c,d]=u.useState(""),x=!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(Pe,{className:"h-3 w-3",strokeWidth:2.5})}),e.jsx("span",{className:"text-sm font-semibold text-text-primary",children:x?"Exit plan mode?":"Ready to code?"})]}),!x&&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:vs(s)}}),e.jsx("div",{className:"space-y-2",children:x?e.jsxs(e.Fragment,{children:[e.jsx(K,{selected:n==="yes-default",onClick:()=>l("yes-default"),label:"Yes"}),e.jsx(K,{selected:n==="no",onClick:()=>l("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(K,{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(K,{selected:n==="yes-default",onClick:()=>l("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(K,{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:m=>d(m.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 K({selected:s,onClick:t,label:r,desc:n}){return e.jsxs("button",{onClick:t,className:G("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:G("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 vs(s){let t=I(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 _s({request:s,onSubmit:t}){const r=Ss(s.requestedSchema),n=Cs(s.requestedSchema),[l,c]=u.useState({}),d=r.length===0||n.every(x=>(l[x]??"").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(Re,{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(zt,{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(Re,{serverName:s.serverName,message:s.message}),r.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:r.map(({name:x,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:x}),n.includes(x)&&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:I(f.description)}),e.jsx("input",{type:f.type==="number"?"number":"text",value:l[x]??"",onChange:m=>c(p=>({...p,[x]:m.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"})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{const x={};for(const{name:f,prop:m}of r){const p=(l[f]??"").trim();p&&(x[f]=m.type==="number"?Number(p):p)}t("accept",x)},disabled:!d,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 Re({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(Kt,{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:I(s)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:I(t)})]})}function Ss(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 Cs(s){const t=s==null?void 0:s.required;return Array.isArray(t)?t.filter(r=>typeof r=="string"):[]}function Ms(s){const[t,r]=u.useState([]),[n,l]=u.useState(!0),[c,d]=u.useState(null),x=u.useCallback(async()=>{l(!0),d(null);try{const p=await pt(s);r(p)}catch(p){d(p instanceof Error?p.message:"Failed to load shares")}finally{l(!1)}},[s]);u.useEffect(()=>{x()},[x]);const f=u.useCallback(async p=>{d(null);try{const g=await ht(s,p);return await x(),g}catch(g){throw d(g instanceof Error?g.message:"Failed to create share"),g}},[s,x]),m=u.useCallback(async p=>{d(null);try{await ft(s,p),await x()}catch(g){throw d(g instanceof Error?g.message:"Failed to revoke share"),g}},[s,x]);return{shares:t,isLoading:n,error:c,createShare:f,revokeShare:m,refresh:x}}function Es({open:s,onClose:t,sessionId:r,sessionTitle:n}){De();const{shares:l,isLoading:c,error:d,createShare:x,revokeShare:f}=Ms(r),[m,p]=u.useState("user"),[g,v]=u.useState(""),[j,a]=u.useState(""),[i,y]=u.useState("read"),[b,k]=u.useState(""),[_,S]=u.useState(!1),[R,A]=u.useState(null),[H,q]=u.useState(""),[B,P]=u.useState(!1),[J,O]=u.useState(!1);u.useEffect(()=>{s&&(p("user"),v(""),a(""),y("read"),k(""),S(!1),A(null),q(""),P(!1),O(!1))},[s]);const W=async()=>{S(!0),q(""),A(null);try{const C={grantedTo:m==="user"?{userId:g.trim()}:{teamId:j.trim()},permission:i};b.trim()&&(C.expiresAt=b.trim());const Z=await x(C);A(`${window.location.origin}/code/s/${Z.shareToken}`)}catch(C){q(C instanceof Error?C.message:"Failed to create share")}finally{S(!1)}},X=async C=>{try{await f(C)}catch{}},Q=async()=>{if(!R)return;O(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(R),P(!0),setTimeout(()=>P(!1),2e3);return}}catch{}const C=document.createElement("textarea");C.value=R,C.style.position="fixed",C.style.opacity="0",document.body.appendChild(C),C.select();try{document.execCommand("copy"),P(!0),setTimeout(()=>P(!1),2e3)}catch{O(!0)}document.body.removeChild(C)};return e.jsx(Ve,{open:s,onOpenChange:C=>{C||t()},children:e.jsxs(Be,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(We,{children:e.jsxs(Qe,{className:"font-display text-lg font-semibold text-text-primary",children:[N("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:N("share.grantTo")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>p("user"),className:`rounded-md px-3 py-1 text-sm transition-colors ${m==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:N("share.user")}),e.jsx("button",{onClick:()=>p("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${m==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:N("share.team")})]}),m==="user"?e.jsx(Pt,{onSelect:v,placeholder:N("share.userIdPlaceholder"),actionLabel:N("share.selectUser")}):e.jsx("input",{type:"text",value:j,onChange:C=>a(C.target.value),placeholder:N("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"}),m==="user"&&g&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[N("share.selectedUser"),": ",e.jsx("span",{className:"font-mono",children:g})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:N("share.permission")}),e.jsxs("select",{value:i,onChange:C=>y(C.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:N("share.permissionRead")}),e.jsx("option",{value:"write",children:N("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:N("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:b,onChange:C=>k(C.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"})]}),(H||d)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:H||d}),R&&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:N("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:R}),e.jsx("button",{onClick:Q,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:B?N("share.copied"):N("share.copy")})]}),J&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:N("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:N("share.existingShares")}),c?e.jsx("p",{className:"text-sm text-text-muted",children:N("share.loading")}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:N("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:l.map(C=>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:C.granted_to_user||C.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[C.permission==="write"?N("share.permissionWrite"):N("share.permissionRead"),C.expires_at?` · expires ${C.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>X(C.id),className:"shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:N("share.revoke")})]},C.id))})]})]}),e.jsxs($t,{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:N("common.close")}),e.jsx("button",{onClick:W,disabled:_||(m==="user"?!g.trim():!j.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:_?N("common.creating"):N("share.createShare")})]})]})})}function Ts(s){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${s}`}function Rs(s){const t=Ts(s),r=gt(),n=r?{proxyUrl:t,token:r}:{proxyUrl:t};return new yt(n)}const V=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"}],oe="rcs_permission_mode";function Ae(s){return s<1e3?String(s):s<1e6?`${(s/1e3).toFixed(1)}k`:`${(s/1e6).toFixed(1)}M`}function As(s){const t=V.findIndex(r=>r.value===s);return V[(t+1+V.length)%V.length].value}function Is({models:s,currentModelId:t,onSelect:r,disabled:n}){const[l,c]=u.useState(!1),d=s.find(m=>m.modelId===t)??null,x=s.length>0,f=async m=>{r(m.modelId),c(!1)};return e.jsxs(Fe,{open:l,onOpenChange:x?c:void 0,children:[e.jsx(Oe,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:n||!x,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(Ye,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-32 truncate",children:(d==null?void 0:d.name)??t??"选择模型"}),l?e.jsx(Le,{className:"h-3 w-3"}):e.jsx(He,{className:"h-3 w-3"})]})}),e.jsx(ze,{className:"w-72 p-0",align:"start",children:e.jsx(At,{models:s,currentModelId:t,onSelect:f,showSearch:s.length>5})})]})}function $s({mode:s,onModeChange:t,disabled:r}){const[n,l]=u.useState(!1),c=V.find(d=>d.value===s);return e.jsxs(Fe,{open:n,onOpenChange:l,children:[e.jsx(Oe,{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(Rt,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:(c==null?void 0:c.label)??s}),n?e.jsx(Le,{className:"h-3 w-3"}):e.jsx(He,{className:"h-3 w-3"})]})}),e.jsx(ze,{className:"w-64 p-1",align:"start",children:V.map(d=>e.jsxs("button",{type:"button",onClick:()=>{t(d.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===d.value&&e.jsx(Pe,{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:d.label}),e.jsx("div",{className:"text-xs text-text-muted",children:d.description})]})]},d.value))})]})}function Bs({sessionId:s,onSessionLoaded:t}){De();const[r,n]=u.useState(null),[l,c]=u.useState(null),[d,x]=u.useState(""),[f,m]=u.useState(!1),[p,g]=u.useState(!1),[v,j]=u.useState(!1),[a,i]=u.useState([]),[y,b]=u.useState(!1),[k,_]=u.useState([]),[S,R]=u.useState(null),[A,H]=u.useState(()=>Ke()),[q,B]=u.useState(null),[P,J]=u.useState(null),[O,W]=u.useState([]),[X,Q]=u.useState(!1),[C,Z]=u.useState(""),ie=u.useRef(null),[le,ee]=u.useState(()=>localStorage.getItem(oe)||"default"),[fe,ye]=u.useState(null),Y=u.useRef(null),U=u.useRef(le);U.current=le;const te=u.useRef(null),ge=u.useRef(null),be=u.useRef(a);be.current=a;const se=u.useRef(t);se.current=t;const ne=u.useCallback(o=>{ye(o),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>ye(null),5e3)},[]),ce=u.useCallback(o=>{var M;if(o===U.current)return;const h=U.current;U.current=o,ee(o);try{localStorage.setItem(oe,o)}catch{}(M=ge.current)==null||M.setPermissionMode(o).then(w=>{te.current={requestId:w,previous:h}}).catch(w=>{console.error("[SessionDetail] set permission mode failed:",w),ne(`模式切换请求发送失败: ${w instanceof Error?w.message:String(w)}`),U.current=h,ee(h)})},[ne]),T=u.useMemo(()=>new ds(s,i,{onStatusChange:o=>{c(o),b(o==="running"||o==="requires_action")},onError:o=>{console.error("[RCSChatAdapter] error:",o)},onPermissionRequest:o=>{_(h=>h.some(M=>M.requestId===o.requestId)?h:[...h,o])},onModelsStateChange:o=>{R(o)},onSubagentUpdate:o=>{H(o)},onControlResponse:o=>{const h=te.current;if(!(!h||h.requestId!==o.requestId)&&(te.current=null,o.subtype==="error")){U.current=h.previous,ee(h.previous);try{localStorage.setItem(oe,h.previous)}catch{}ne(o.error||"模式切换失败")}},onPermissionModeChange:o=>{if(o!==U.current){U.current=o,ee(o);try{localStorage.setItem(oe,o)}catch{}te.current=null}},onUsageChange:o=>{B(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=>{J(o)}}),[s,ne]);u.useEffect(()=>(ge.current=T,()=>{T.disconnect()}),[T]),u.useEffect(()=>{let o=!1;async function h(){var M;x("");try{const w=await Ct(s);if(o)return;n(w),c(w.status),b(w.status==="running"||w.status==="requires_action"),(M=se.current)==null||M.call(se,w)}catch(w){if(o)return;x(w instanceof Error?w.message:N("session.loadFailed"));return}try{await T.init()}catch(w){console.warn("Failed to init adapter:",w)}}return h(),()=>{o=!0}},[s,T]);const z=Mt(l),L=(r==null?void 0:r.access_level)==="read",de=u.useCallback(()=>{i([]),bt(s).catch(o=>{console.warn("[SessionDetail] Failed to clear session history:",o)})},[s]),re=u.useCallback(async o=>{const h=o.text.trim(),M=o.images&&o.images.length>0||o.attachments&&o.attachments.length>0;if(!h&&!M||z)return;const w=await jt(h,{sessionId:s,availableCommands:ve,availableModels:(S==null?void 0:S.availableModels)??[],currentModel:S?{modelId:S.currentModelId,name:S.currentModelId}:null,supportsImages:!0,entries:be.current,setModel:async D=>{await F(s,{type:"control_request",request:{subtype:"set_model",model:D}}),R(me=>me&&{...me,currentModelId:D})},onNewSession:()=>{i([])}}).catch(()=>null);if(w){if(kt("[SessionDetail] local command result",w),"clearEntries"in w&&w.clearEntries){de();return}if("newSession"in w&&w.newSession){de();return}if("userEntry"in w){i(D=>[...D,w.userEntry,w.cmdEntry]);return}}b(!0);try{await T.sendMessage(h,o.images,o.attachments)}catch(D){console.error("Send failed:",D)}},[T,z,s,S,de]),Ge=u.useCallback(o=>{if(y){W(h=>[...h,o]);return}re(o)},[y,re]),ue=u.useRef(!1);u.useEffect(()=>{if(y||O.length===0||ue.current)return;const o=O[0];o&&(ue.current=!0,W(h=>h.slice(1)),re(o).finally(()=>{ue.current=!1}))},[y,O,re]);const je=u.useCallback(async()=>{try{await T.interrupt()}catch(o){console.error("Interrupt failed:",o)}finally{b(!1)}},[T]),Je=u.useCallback(()=>{ce(As(U.current))},[ce]);u.useEffect(()=>()=>{Y.current&&clearTimeout(Y.current)},[]);const Xe=u.useCallback(async()=>{if(r&&window.confirm(N("dashboard.confirmDelete").replace("{id}",r.title||r.id)))try{await wt(r.id),window.location.href="/code/"}catch(o){alert(o instanceof Error?o.message:N("dashboard.deleteFailed"))}},[r]),Ze=u.useCallback(async o=>{try{await T.respondPermission(o,!0)}catch(h){console.error("Failed to approve:",h)}_(h=>h.filter(M=>M.requestId!==o))},[T]),et=u.useCallback(async(o,h)=>{try{await T.respondPermission(o,!0,{updated_permissions:h})}catch(M){console.error("Failed to approve with rules:",M)}_(M=>M.filter(w=>w.requestId!==o))},[T]),tt=u.useCallback(async(o,h)=>{const M=P;if(J(null),!!M)try{await T.respondElicitation(M.requestId,o,h)}catch(w){console.error("Failed to submit elicitation:",w)}},[P,T]),st=u.useCallback(()=>{!r||L||(Z(r.title||""),Q(!0),setTimeout(()=>{var o,h;(o=ie.current)==null||o.focus(),(h=ie.current)==null||h.select()},0))},[r,L]),ke=u.useCallback(async()=>{const o=C.trim();if(Q(!1),!(!r||!o||o===r.title))try{const h=await Nt(r.id,o);n(M=>M&&{...M,title:h.title??o})}catch(h){console.error("Rename failed:",h),alert(h instanceof Error?h.message:"重命名失败")}},[r,C]),nt=u.useCallback(async o=>{try{await T.respondPermission(o,!1)}catch(h){console.error("Failed to reject:",h)}_(h=>h.filter(M=>M.requestId!==o))},[T]),rt=u.useCallback(async(o,h,M)=>{try{await F(s,{type:"permission_response",approved:!0,request_id:o,updated_input:{questions:M,answers:h}})}catch(w){console.error("Failed to submit answers:",w)}_(w=>w.filter(D=>D.requestId!==o))},[s]),at=u.useCallback(async(o,h,M)=>{try{h==="no"?await F(s,{type:"permission_response",approved:!1,request_id:o,...M?{message:M}:{}}):await F(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(w){console.error("Failed to submit plan response:",w)}_(w=>w.filter(D=>D.requestId!==o))},[s]);return d?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:d}),e.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:N("session.backToDashboard")})]})}):r?r.source==="acp"&&r.environment_id?e.jsx(Ps,{sessionId:s,agentId:r.environment_id}):e.jsx(Ue,{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:[X?e.jsx("input",{ref:ie,value:C,onChange:o=>Z(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),ke()):o.key==="Escape"&&(o.preventDefault(),Q(!1))},onBlur:()=>void ke(),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}),!L&&!z&&e.jsx("button",{type:"button",onClick:st,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(vt,{className:"h-3.5 w-3.5"})})]}),r.visibility&&!X&&e.jsx(qt,{visibility:r.visibility||"private"})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(()=>{var M;const o=r.source==="acp"?"acp":(M=r.environment)==null?void 0:M.worker_type,h=It(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(Ie,{status:l}),e.jsx("span",{className:"text-xs text-text-muted",children:$e(r.created_at)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!L&&(r==null?void 0:r.access_level)!=="write"&&e.jsx("button",{onClick:()=>j(!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:N("session.share"),children:e.jsx(ts,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>g(!p),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:N("session.info"),children:e.jsx(Qt,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>m(!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:[N("session.tasks"),k.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:k.length})]})]})]}),p&&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:N("session.metaSession")})," ",r.id]}),r.environment_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:N("session.metaEnvironment")})," ",r.environment_id]})]})]})}),e.jsx(_t,{entries:a,isLoading:y,emptyTitle:N("session.emptyTitle"),emptyDescription:N("session.emptyDescription")}),e.jsx(bs,{state:A}),k.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:k.map(o=>e.jsx(qs,{request:o,onApprove:()=>Ze(o.requestId),onApproveAlways:o.suggestions&&o.suggestions.length>0?()=>et(o.requestId,o.suggestions??[]):void 0,onReject:()=>nt(o.requestId),onSubmitAnswers:rt,onSubmitPlan:at},o.requestId))})}),P&&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(_s,{request:P,onSubmit:tt})})}),fe&&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:fe})}),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($s,{mode:le,onModeChange:ce,disabled:z||L}),e.jsx(Is,{models:(S==null?void 0:S.availableModels)??[],currentModelId:(S==null?void 0:S.currentModelId)??null,onSelect:o=>{F(s,{type:"control_request",request:{subtype:"set_model",model:o}}),R(h=>h&&{...h,currentModelId:o})},disabled:z||L})]}),q&&e.jsxs("span",{className:"text-[11px] text-text-muted font-mono",title:"会话累计用量(input 含缓存读写)",children:[Ae(q.inputTokens)," in / ",Ae(q.outputTokens)," out",q.totalCostUsd!=null&&` · $${q.totalCostUsd.toFixed(2)}`]})]}),e.jsx(St,{onSubmit:Ge,isLoading:y,onInterrupt:je,onCycleMode:Je,disabled:z||L,placeholder:z?N("session.closed"):L?N("session.readOnly"):N("session.inputPlaceholder"),supportsAttachments:!0,commands:ve,queueWhileLoading:!0,queuedCount:O.length,onDequeue:o=>W(h=>h.filter((M,w)=>w!==o)),onSearchFiles:o=>T.searchFiles(o)}),f&&r&&e.jsx(ps,{onClose:()=>m(!1),session:r,liveStatus:l,pendingPermissions:k,onInterrupt:je,onDelete:Xe}),e.jsx(Es,{open:v,onClose:()=>j(!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:N("session.loading")})})}function qs({request:s,onApprove:t,onApproveAlways:r,onReject:n,onSubmitAnswers:l,onSubmitPlan:c}){const d=s.toolName,x=s.toolInput,f=s.description||"";if(d==="AskUserQuestion"){const m=x.questions||[];return e.jsx(ks,{requestId:s.requestId,questions:m,description:f,onSubmit:p=>l(s.requestId,p,m),onSkip:n})}if(d==="ExitPlanMode"){const m=x.plan||"";return e.jsx(Ns,{requestId:s.requestId,planContent:m,description:f,onSubmit:(p,g)=>c(s.requestId,p,g)})}return e.jsx(js,{requestId:s.requestId,toolName:d,toolInput:x,description:f,suggestions:s.suggestions,onApprove:t,onApproveAlways:r,onReject:n})}function Ps({sessionId:s,agentId:t}){const[r,n]=u.useState(null),[l,c]=u.useState("disconnected"),[d,x]=u.useState(null),f=u.useRef(null);return u.useEffect(()=>{const m=Rs(t);return m.setConnectionStateHandler((p,g)=>{c(p),x(g||null)}),f.current=m,n(m),m.connect().catch(p=>{p instanceof Et||(x(p.message),c("error"))}),()=>{m.disconnect(),f.current=null,n(null),c("disconnected")}},[t]),e.jsx(Ue,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[d&&l==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:d}),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:N("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:N("session.connectionFailed")}),e.jsx("p",{className:"text-text-muted text-sm",children:d})]})}),r&&l==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Tt,{client:r,agentId:t})})]})})}export{Bs as SessionDetail};
@@ -1,4 +1,4 @@
1
- import{j as t}from"./vendor-DE_-CLIE.js";import{a5 as l,u as c,i as d,h as g,X as u,a4 as o,T as x,t as f,O as m,U as p}from"./main-Dk8hyS_b.js";/**
1
+ import{j as t}from"./vendor-DE_-CLIE.js";import{a5 as l,u as c,i as d,h as g,X as u,a4 as o,T as x,t as f,O as m,U as p}from"./main-CwLwGVDc.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.