@saluzi/saluzi-edu 0.2.65 → 0.2.67

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 (178) hide show
  1. package/dist/cli.js +534 -349
  2. package/dist/guide/guide-data.json +8 -0
  3. package/dist/rcs-schema.sql +23 -0
  4. package/dist/rcs-web/assets/{AdminPanel-CqP_94xa.js → AdminPanel-94uchXH7.js} +1 -1
  5. package/dist/rcs-web/assets/ArtifactView-CT0Fu4U5.js +6 -0
  6. package/dist/rcs-web/assets/ArtifactsGallery-DgK1CSno.js +339 -0
  7. package/{packages/remote-control-server/web/dist/assets/Claim-BvfARQ6Q.js → dist/rcs-web/assets/Claim-C7V1Q01Y.js} +1 -1
  8. package/dist/rcs-web/assets/{Dashboard-BDGi4XpN.js → Dashboard-NLM7Kgm8.js} +2 -2
  9. package/{packages/remote-control-server/web/dist/assets/Join-PPDYBhsJ.js → dist/rcs-web/assets/Join-BhjsvbAP.js} +1 -1
  10. package/dist/rcs-web/assets/{Login-JprQIEpr.js → Login-DRFE4F-F.js} +1 -1
  11. package/dist/rcs-web/assets/{Register-cuGuAE83.js → Register-FgLOFB4h.js} +1 -1
  12. package/dist/rcs-web/assets/SessionDetail-3P77L-sJ.js +60 -0
  13. package/dist/rcs-web/assets/SessionVisibilityBadge-raEV1sW8.js +11 -0
  14. package/dist/rcs-web/assets/{Setup-Buwa9Y3M.js → Setup-DDJHMu0z.js} +1 -1
  15. package/dist/rcs-web/assets/ShareLanding-DG5JbaWg.js +1 -0
  16. package/dist/rcs-web/assets/{TeamCreate-CaoinTSG.js → TeamCreate-D_AnatYF.js} +1 -1
  17. package/dist/rcs-web/assets/{TeamDetail-D5ahen24.js → TeamDetail-C1FFiAj2.js} +2 -2
  18. package/dist/rcs-web/assets/{TeamList-qCuKKSH3.js → TeamList-tfsnwvZG.js} +1 -1
  19. package/dist/rcs-web/assets/{TeamSettings-BaIwImrp.js → TeamSettings-FeTuY9_I.js} +1 -1
  20. package/dist/rcs-web/assets/{UserSearchInput-BxcYR_HU.js → UserSearchInput-Bu3RXDYh.js} +1 -1
  21. package/dist/rcs-web/assets/{UserSettings-zfGfcuWs.js → UserSettings-BrjmELAZ.js} +1 -1
  22. package/dist/rcs-web/assets/{arc-DwAbF6eM.js → arc-Di9w8tGK.js} +1 -1
  23. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-uMOwOwiN.js → architectureDiagram-3BPJPVTR-FT-IsfVA.js} +1 -1
  24. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-B5BqFTkP.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-DryBvbP3.js} +1 -1
  25. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-D6eienz2.js → c4Diagram-AAUBKEIU-HWAmxH56.js} +1 -1
  26. package/dist/rcs-web/assets/channel-N4W03sy5.js +1 -0
  27. package/dist/rcs-web/assets/{chunk-2J33WTMH-DqVxv8yW.js → chunk-2J33WTMH-AdjHpC7B.js} +1 -1
  28. package/dist/rcs-web/assets/{chunk-4BX2VUAB-X5o4x8om.js → chunk-4BX2VUAB-CpZ-59LR.js} +1 -1
  29. package/dist/rcs-web/assets/{chunk-55IACEB6-D7G25_Y5.js → chunk-55IACEB6-BBSmURaz.js} +1 -1
  30. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CoXI1FIy.js → dist/rcs-web/assets/chunk-727SXJPM-1k6tgn8s.js} +1 -1
  31. package/dist/rcs-web/assets/{chunk-AQP2D5EJ-C73Crhqe.js → chunk-AQP2D5EJ-im0ij4Kj.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-FMBD7UC4-DVzxIsSE.js → chunk-FMBD7UC4-Cs3z8_hw.js} +1 -1
  33. package/dist/rcs-web/assets/{chunk-ND2GUHAM-C6_oEhLf.js → chunk-ND2GUHAM-BA9iE2wc.js} +1 -1
  34. package/dist/rcs-web/assets/{chunk-QZHKN3VN-COvH7k5r.js → chunk-QZHKN3VN-DbvzoKsw.js} +1 -1
  35. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-CcBgewcu.js +1 -0
  36. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-CcBgewcu.js +1 -0
  37. package/dist/rcs-web/assets/{code-block-IT6T5CEO-CE-2f_-K.js → code-block-IT6T5CEO-wgmiR0vF.js} +1 -1
  38. package/dist/rcs-web/assets/{copy-9pzb1Po6.js → copy-BD6qrRfd.js} +1 -1
  39. package/dist/rcs-web/assets/{cose-bilkent-S5V4N54A-B9sMDFRe.js → cose-bilkent-S5V4N54A-DT4C5Yz2.js} +1 -1
  40. package/dist/rcs-web/assets/{dagre-BM42HDAG-DB1jXylM.js → dagre-BM42HDAG-CRf1H6Hv.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-2AECGRRQ-MNuqSRmg.js → diagram-2AECGRRQ-BChRpS-u.js} +1 -1
  42. package/dist/rcs-web/assets/{diagram-5GNKFQAL-BZwhvaEY.js → diagram-5GNKFQAL-BicbIYus.js} +1 -1
  43. package/dist/rcs-web/assets/{diagram-KO2AKTUF-3Wp2PnI2.js → diagram-KO2AKTUF-DCfQNjGq.js} +1 -1
  44. package/dist/rcs-web/assets/{diagram-LMA3HP47-CTcV1SBj.js → diagram-LMA3HP47-mMyd4aUd.js} +1 -1
  45. package/dist/rcs-web/assets/{diagram-OG6HWLK6-DzXhSQDC.js → diagram-OG6HWLK6-DUWhyWTm.js} +1 -1
  46. package/dist/rcs-web/assets/dialog-DympH6_o.js +1 -0
  47. package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-CwSihkB8.js → erDiagram-TEJ5UH35-DnBH3GMK.js} +1 -1
  48. package/dist/rcs-web/assets/external-link-J-x6ty1h.js +6 -0
  49. package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-BSuXctT4.js → flowDiagram-I6XJVG4X-Ba7lo6ds.js} +1 -1
  50. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-B87oxjmY.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CKkj67eu.js} +1 -1
  51. package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-BRrwOi3C.js → gitGraphDiagram-PVQCEYII-205YdSRe.js} +1 -1
  52. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-B-8QXS0n.js → infoDiagram-5YYISTIA-CpPvGigJ.js} +1 -1
  53. package/dist/rcs-web/assets/{ishikawaDiagram-YF4QCWOH-Bau9MU6C.js → ishikawaDiagram-YF4QCWOH-D0ZEWQy7.js} +1 -1
  54. package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-D_tAp--R.js → journeyDiagram-JHISSGLW-DVl0M9a7.js} +1 -1
  55. package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU---UIvjMZ.js → kanban-definition-UN3LZRKU-Dkr8uJC-.js} +1 -1
  56. package/dist/rcs-web/assets/{linear-CIDLjd5h.js → linear-CIdvseqY.js} +1 -1
  57. package/dist/rcs-web/assets/main-B8hkVvfg.js +265 -0
  58. package/dist/rcs-web/assets/main-C2O-g177.css +1 -0
  59. package/dist/rcs-web/assets/{mermaid-VLURNSYL-Cu5A5sMk.js → mermaid-VLURNSYL-DdTSeoZS.js} +4 -4
  60. package/dist/rcs-web/assets/{mermaid.core-CEJOtCGw.js → mermaid.core-CtvzCSq2.js} +5 -5
  61. package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-ldyccyCP.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-CMlDCaV_.js} +1 -1
  62. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-CmghofeF.js → pieDiagram-4H26LBE5-C6xMizTL.js} +1 -1
  63. package/{packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-B-2N2UHr.js → dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-D6epraE1.js} +1 -1
  64. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-39jlO9Y8.js → requirementDiagram-4Y6WPE33-BHmML6bk.js} +1 -1
  65. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-DdY7KNFB.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CIKij54Y.js} +1 -1
  66. package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-D2k5rX6x.js → sequenceDiagram-3UESZ5HK-CY0y5zdR.js} +1 -1
  67. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-CP9N457o.js → stateDiagram-AJRCARHV-FBhNz1Lc.js} +1 -1
  68. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CPhZYlL0.js → stateDiagram-v2-BHNVJYJU-m7ruBTu5.js} +1 -1
  69. package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-DSEPBO8O.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-CJopHs1x.js} +1 -1
  70. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-CkNMwCJ3.js → vennDiagram-CIIHVFJN-DF_uHOP7.js} +1 -1
  71. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-Cxd-F60s.js → wardleyDiagram-YWT4CUSO-DQmjIZJA.js} +1 -1
  72. package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-BLL105NN.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-v8zL-j4G.js} +1 -1
  73. package/dist/rcs-web/index.html +2 -2
  74. package/package.json +1 -1
  75. package/packages/remote-control-server/src/__tests__/artifacts.test.ts +370 -0
  76. package/packages/remote-control-server/src/__tests__/attach-wait.test.ts +54 -0
  77. package/packages/remote-control-server/src/__tests__/attach.test.ts +37 -0
  78. package/packages/remote-control-server/src/__tests__/helpers/mock-config.ts +1 -0
  79. package/packages/remote-control-server/src/__tests__/low-priority-fixes.test.ts +95 -0
  80. package/packages/remote-control-server/src/__tests__/routes.test.ts +69 -0
  81. package/packages/remote-control-server/src/config.ts +6 -0
  82. package/packages/remote-control-server/src/db/rcs-schema.sql +23 -0
  83. package/packages/remote-control-server/src/index.ts +9 -0
  84. package/packages/remote-control-server/src/registerRoutes.ts +8 -0
  85. package/packages/remote-control-server/src/routes/v1/artifacts.ts +179 -0
  86. package/packages/remote-control-server/src/routes/v1/environments.ts +17 -9
  87. package/packages/remote-control-server/src/routes/v1/environments.work.ts +2 -2
  88. package/packages/remote-control-server/src/routes/v1/sessions.ts +39 -9
  89. package/packages/remote-control-server/src/routes/web/artifacts.ts +249 -0
  90. package/packages/remote-control-server/src/routes/web/sessions.ts +25 -22
  91. package/packages/remote-control-server/src/services/artifacts.ts +378 -0
  92. package/packages/remote-control-server/src/services/environment.ts +25 -0
  93. package/packages/remote-control-server/web/dist/assets/{AdminPanel-CqP_94xa.js → AdminPanel-94uchXH7.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/ArtifactView-CT0Fu4U5.js +6 -0
  95. package/packages/remote-control-server/web/dist/assets/ArtifactsGallery-DgK1CSno.js +339 -0
  96. package/{dist/rcs-web/assets/Claim-BvfARQ6Q.js → packages/remote-control-server/web/dist/assets/Claim-C7V1Q01Y.js} +1 -1
  97. package/packages/remote-control-server/web/dist/assets/{Dashboard-BDGi4XpN.js → Dashboard-NLM7Kgm8.js} +2 -2
  98. package/{dist/rcs-web/assets/Join-PPDYBhsJ.js → packages/remote-control-server/web/dist/assets/Join-BhjsvbAP.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{Login-JprQIEpr.js → Login-DRFE4F-F.js} +1 -1
  100. package/packages/remote-control-server/web/dist/assets/{Register-cuGuAE83.js → Register-FgLOFB4h.js} +1 -1
  101. package/packages/remote-control-server/web/dist/assets/SessionDetail-3P77L-sJ.js +60 -0
  102. package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-raEV1sW8.js +11 -0
  103. package/packages/remote-control-server/web/dist/assets/{Setup-Buwa9Y3M.js → Setup-DDJHMu0z.js} +1 -1
  104. package/packages/remote-control-server/web/dist/assets/ShareLanding-DG5JbaWg.js +1 -0
  105. package/packages/remote-control-server/web/dist/assets/{TeamCreate-CaoinTSG.js → TeamCreate-D_AnatYF.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/{TeamDetail-D5ahen24.js → TeamDetail-C1FFiAj2.js} +2 -2
  107. package/packages/remote-control-server/web/dist/assets/{TeamList-qCuKKSH3.js → TeamList-tfsnwvZG.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/{TeamSettings-BaIwImrp.js → TeamSettings-FeTuY9_I.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-BxcYR_HU.js → UserSearchInput-Bu3RXDYh.js} +1 -1
  110. package/packages/remote-control-server/web/dist/assets/{UserSettings-zfGfcuWs.js → UserSettings-BrjmELAZ.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{arc-DwAbF6eM.js → arc-Di9w8tGK.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-uMOwOwiN.js → architectureDiagram-3BPJPVTR-FT-IsfVA.js} +1 -1
  113. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-B5BqFTkP.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DryBvbP3.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-D6eienz2.js → c4Diagram-AAUBKEIU-HWAmxH56.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/channel-N4W03sy5.js +1 -0
  116. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-DqVxv8yW.js → chunk-2J33WTMH-AdjHpC7B.js} +1 -1
  117. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-X5o4x8om.js → chunk-4BX2VUAB-CpZ-59LR.js} +1 -1
  118. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-D7G25_Y5.js → chunk-55IACEB6-BBSmURaz.js} +1 -1
  119. package/{dist/rcs-web/assets/chunk-727SXJPM-CoXI1FIy.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-1k6tgn8s.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-C73Crhqe.js → chunk-AQP2D5EJ-im0ij4Kj.js} +1 -1
  121. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-DVzxIsSE.js → chunk-FMBD7UC4-Cs3z8_hw.js} +1 -1
  122. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-C6_oEhLf.js → chunk-ND2GUHAM-BA9iE2wc.js} +1 -1
  123. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-COvH7k5r.js → chunk-QZHKN3VN-DbvzoKsw.js} +1 -1
  124. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-CcBgewcu.js +1 -0
  125. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-CcBgewcu.js +1 -0
  126. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-CE-2f_-K.js → code-block-IT6T5CEO-wgmiR0vF.js} +1 -1
  127. package/packages/remote-control-server/web/dist/assets/{copy-9pzb1Po6.js → copy-BD6qrRfd.js} +1 -1
  128. package/packages/remote-control-server/web/dist/assets/{cose-bilkent-S5V4N54A-B9sMDFRe.js → cose-bilkent-S5V4N54A-DT4C5Yz2.js} +1 -1
  129. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-DB1jXylM.js → dagre-BM42HDAG-CRf1H6Hv.js} +1 -1
  130. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-MNuqSRmg.js → diagram-2AECGRRQ-BChRpS-u.js} +1 -1
  131. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-BZwhvaEY.js → diagram-5GNKFQAL-BicbIYus.js} +1 -1
  132. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-3Wp2PnI2.js → diagram-KO2AKTUF-DCfQNjGq.js} +1 -1
  133. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-CTcV1SBj.js → diagram-LMA3HP47-mMyd4aUd.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-DzXhSQDC.js → diagram-OG6HWLK6-DUWhyWTm.js} +1 -1
  135. package/packages/remote-control-server/web/dist/assets/dialog-DympH6_o.js +1 -0
  136. package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-CwSihkB8.js → erDiagram-TEJ5UH35-DnBH3GMK.js} +1 -1
  137. package/packages/remote-control-server/web/dist/assets/external-link-J-x6ty1h.js +6 -0
  138. package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-BSuXctT4.js → flowDiagram-I6XJVG4X-Ba7lo6ds.js} +1 -1
  139. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-B87oxjmY.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CKkj67eu.js} +1 -1
  140. package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-BRrwOi3C.js → gitGraphDiagram-PVQCEYII-205YdSRe.js} +1 -1
  141. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-B-8QXS0n.js → infoDiagram-5YYISTIA-CpPvGigJ.js} +1 -1
  142. package/packages/remote-control-server/web/dist/assets/{ishikawaDiagram-YF4QCWOH-Bau9MU6C.js → ishikawaDiagram-YF4QCWOH-D0ZEWQy7.js} +1 -1
  143. package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-D_tAp--R.js → journeyDiagram-JHISSGLW-DVl0M9a7.js} +1 -1
  144. package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU---UIvjMZ.js → kanban-definition-UN3LZRKU-Dkr8uJC-.js} +1 -1
  145. package/packages/remote-control-server/web/dist/assets/{linear-CIDLjd5h.js → linear-CIdvseqY.js} +1 -1
  146. package/packages/remote-control-server/web/dist/assets/main-B8hkVvfg.js +265 -0
  147. package/packages/remote-control-server/web/dist/assets/main-C2O-g177.css +1 -0
  148. package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-Cu5A5sMk.js → mermaid-VLURNSYL-DdTSeoZS.js} +4 -4
  149. package/packages/remote-control-server/web/dist/assets/{mermaid.core-CEJOtCGw.js → mermaid.core-CtvzCSq2.js} +5 -5
  150. package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-ldyccyCP.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-CMlDCaV_.js} +1 -1
  151. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-CmghofeF.js → pieDiagram-4H26LBE5-C6xMizTL.js} +1 -1
  152. package/{dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-B-2N2UHr.js → packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-D6epraE1.js} +1 -1
  153. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-39jlO9Y8.js → requirementDiagram-4Y6WPE33-BHmML6bk.js} +1 -1
  154. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-DdY7KNFB.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CIKij54Y.js} +1 -1
  155. package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-D2k5rX6x.js → sequenceDiagram-3UESZ5HK-CY0y5zdR.js} +1 -1
  156. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-CP9N457o.js → stateDiagram-AJRCARHV-FBhNz1Lc.js} +1 -1
  157. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CPhZYlL0.js → stateDiagram-v2-BHNVJYJU-m7ruBTu5.js} +1 -1
  158. package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-DSEPBO8O.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-CJopHs1x.js} +1 -1
  159. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-CkNMwCJ3.js → vennDiagram-CIIHVFJN-DF_uHOP7.js} +1 -1
  160. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-Cxd-F60s.js → wardleyDiagram-YWT4CUSO-DQmjIZJA.js} +1 -1
  161. package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-BLL105NN.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-v8zL-j4G.js} +1 -1
  162. package/packages/remote-control-server/web/dist/index.html +2 -2
  163. package/dist/rcs-web/assets/SessionDetail-D-xhkyLo.js +0 -65
  164. package/dist/rcs-web/assets/SessionVisibilityBadge-91WyR9K6.js +0 -11
  165. package/dist/rcs-web/assets/ShareLanding-DhwgJb6V.js +0 -1
  166. package/dist/rcs-web/assets/channel-CCfqpGSl.js +0 -1
  167. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DzNdVs3v.js +0 -1
  168. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DzNdVs3v.js +0 -1
  169. package/dist/rcs-web/assets/main-DhbquBXW.css +0 -1
  170. package/dist/rcs-web/assets/main-N3GYCdLF.js +0 -260
  171. package/packages/remote-control-server/web/dist/assets/SessionDetail-D-xhkyLo.js +0 -65
  172. package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-91WyR9K6.js +0 -11
  173. package/packages/remote-control-server/web/dist/assets/ShareLanding-DhwgJb6V.js +0 -1
  174. package/packages/remote-control-server/web/dist/assets/channel-CCfqpGSl.js +0 -1
  175. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DzNdVs3v.js +0 -1
  176. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DzNdVs3v.js +0 -1
  177. package/packages/remote-control-server/web/dist/assets/main-DhbquBXW.css +0 -1
  178. package/packages/remote-control-server/web/dist/assets/main-N3GYCdLF.js +0 -260
@@ -0,0 +1,60 @@
1
+ var lt=Object.defineProperty;var ct=(s,t,r)=>t in s?lt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var T=(s,t,r)=>ct(s,typeof t!="symbol"?t+"":t,r);import{e as u,j as e}from"./vendor-DE_-CLIE.js";import{ab as P,_ as dt,aj as ut,a5 as mt,af as pe,a4 as F,$ as xt,x as Pe,g as ve,ae as qe,L as De,z as pt,w as ht,ad as $,a9 as J,d as Ue,am as _e,a0 as ft,J as yt,a3 as gt,aq as Fe,al as k,A as bt,ag as jt,G as wt,an as kt,ac as Nt,N as vt,a1 as _t,y as Oe,P as St,F as Ct,c as Mt,C as Et,R as Se,Z as Tt,ai as At,D as Rt,a as $t,q as Le,s as He,v as It,f as ze,e as Be,r as Ve,M as Pt}from"./main-B8hkVvfg.js";import{g as qt}from"./workerType-Bd-zteMi.js";import{D as We,a as Qe,c as Ge,d as Ke,b as Dt}from"./dialog-DympH6_o.js";import{E as Ut}from"./external-link-J-x6ty1h.js";import{S as Ft}from"./SessionVisibilityBadge-raEV1sW8.js";import{U as Ot}from"./UserSearchInput-Bu3RXDYh.js";import{ArtifactsGallery as Lt}from"./ArtifactsGallery-DgK1CSno.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";import"./copy-BD6qrRfd.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 Ht=[["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"}]],zt=P("activity",Ht);/**
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 Bt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vt=P("chevron-right",Bt);/**
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 Wt=[["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=P("cpu",Wt);/**
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 Qt=[["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"}]],Gt=P("hash",Qt);/**
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 Kt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Yt=P("info",Kt);/**
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 Jt=[["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"}]],Xt=P("message-square-text",Jt);/**
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 Zt=[["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"}]],es=P("play",Zt);/**
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 ts=[["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"}]],ss=P("server-cog",ts);/**
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 ns=[["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"}]],rs=P("share-2",ns);/**
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 as=[["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"}]],os=P("shield-check",as);/**
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 is=[["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"}]],ls=P("triangle-alert",is);function Je(){return{tasks:{}}}const Ce=3e4;function re(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 cs(s,t){var d,x,p,m,g,j,w,_,a,o,f,y;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:re(t.description??c.description),taskType:t.task_type??c.taskType,workflowName:t.workflow_name??c.workflowName,prompt:t.prompt??c.prompt,toolUseId:t.tool_use_id??c.toolUseId,status:"running",startTime:l,evictAfter:void 0}}};const b=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:re(b),description:b,taskType:t.task_type,workflowName:t.workflow_name,prompt:t.prompt,toolUseId:t.tool_use_id,status:"running",startTime:l}}}}if(r==="task_progress"){if(!c){const b=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:re(b),description:b,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:(p=t.usage)==null?void 0:p.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:((g=t.usage)==null?void 0:g.tool_uses)??c.toolUseCount,durationMs:((j=t.usage)==null?void 0:j.duration_ms)??c.durationMs,lastToolName:t.last_tool_name??c.lastToolName,summary:t.summary??c.summary}}}}return c?{tasks:{...s.tasks,[n]:{...c,status:t.status??"completed",endTime:l,finalSummary:t.summary??c.finalSummary,outputFile:t.output_file??c.outputFile,tokenCount:((o=t.usage)==null?void 0:o.total_tokens)??c.tokenCount,toolUseCount:((f=t.usage)==null?void 0:f.tool_uses)??c.toolUseCount,durationMs:((y=t.usage)==null?void 0:y.duration_ms)??c.durationMs,evictAfter:l+Ce}}}:{tasks:{...s.tasks,[n]:{taskId:n,name:re(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:l,endTime:l,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(w=t.usage)==null?void 0:w.total_tokens,toolUseCount:(_=t.usage)==null?void 0:_.tool_uses,durationMs:(a=t.usage)==null?void 0:a.duration_ms,evictAfter:l+Ce}}}}function ds(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 us{constructor(){T(this,"listeners",new Set);T(this,"eventSource",null);T(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 he=new us;function Me(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 Ee(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 fe="streaming-";function ms(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 Te(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 xs{constructor(t,r,n){T(this,"sessionId");T(this,"setEntries");T(this,"unsub",null);T(this,"onStatusChange");T(this,"onError");T(this,"onPermissionRequest");T(this,"onModelsStateChange");T(this,"onSubagentUpdate");T(this,"onControlResponse");T(this,"onPermissionModeChange");T(this,"onUsageChange");T(this,"onElicitationRequest");T(this,"subagentState",Je());T(this,"seenUuids",new Set);T(this,"seenToolCallIds",new Set);T(this,"pendingControlRequests",new Map);T(this,"turnEnded",!1);T(this,"userSinceTurnEnd",!1);this.sessionId=t,this.setEntries=r,this.onStatusChange=n==null?void 0:n.onStatusChange,this.onError=n==null?void 0:n.onError,this.onPermissionRequest=n==null?void 0:n.onPermissionRequest,this.onModelsStateChange=n==null?void 0:n.onModelsStateChange,this.onSubagentUpdate=n==null?void 0:n.onSubagentUpdate,this.onControlResponse=n==null?void 0:n.onControlResponse,this.onPermissionModeChange=n==null?void 0:n.onPermissionModeChange,this.onUsageChange=n==null?void 0:n.onUsageChange,this.onElicitationRequest=n==null?void 0:n.onElicitationRequest}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var m,g,j;const{events:t}=await dt(this.sessionId);if(!t||t.length===0)return;const r=[];let n=null;const l=()=>{n&&(r.push(n),n=null)};for(const w of t){const _=w.payload||{},a=_.uuid;if(typeof a=="string"&&a&&this.seenUuids.add(a),w.type==="tool_use"){const o=_.tool_call_id;typeof o=="string"&&o&&this.seenToolCallIds.add(o)}if(w.type==="user"){if(w.direction==="inbound")continue;l();const o=Me(_);o&&r.push({type:"user_message",id:w.id||`hist-user-${r.length}`,content:o})}else if(w.type==="assistant"){l();const o=Me(_),f=[],y=_.message;if(y&&typeof y=="object"&&Array.isArray(y.content)){for(const b of y.content)if(b.type==="tool_use"){const N=b.id;N&&this.seenToolCallIds.add(N),f.push({type:"tool_call",toolCall:{id:N||`hist-tool-${r.length}`,title:b.name||"tool",status:"complete",rawInput:b.input||{}}})}}if(o||f.length>0){n={type:"assistant_message",id:w.id||`hist-asst-${r.length}`,chunks:o?[{type:"message",text:o}]:[]},r.push(n);for(const b of f)r.push(b);n=null}}else if(w.type==="tool_use"){const o=_,f={type:"tool_call",toolCall:{id:o.tool_call_id||`hist-tool-${r.length}`,title:o.tool_name||"tool",status:"complete",rawInput:o.tool_input||{}}};r.push(f)}else if(w.type==="tool_result"){const o=_,f=Ee(r,o.tool_call_id||"");if(f>=0){const y=r[f];r[f]={type:"tool_call",toolCall:{...y.toolCall,rawOutput:{output:o.content||o.output||""}}}}}}l();let c=null;for(const w of t){if(w.type!=="task_state")continue;const _=w.payload||{};Array.isArray(_.tasks)&&(c=_.tasks)}if(c&&c.length>0){const w=Te(c);w.length>0&&r.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:w})}this.setEntries(r);let d=null,x=null,p=null;for(const w of t){const _=w.payload||{};if(w.type==="user"?p="user":(w.type==="result"||w.type==="result_success"||w.type==="interrupt")&&(p="turn_end"),w.type==="models_state"){const a=_.raw,o=a&&typeof a=="object"?a.models_state:_.models_state;o&&Array.isArray(o.availableModels)&&typeof o.currentModelId=="string"&&(d=o)}else if(w.type==="result"||w.type==="result_success"){const a=_.usage,o=typeof _.total_cost_usd=="number"?_.total_cost_usd:null;(a||o!==null)&&(x={inputTokens:((a==null?void 0:a.input_tokens)??0)+((a==null?void 0:a.cache_read_input_tokens)??0)+((a==null?void 0:a.cache_creation_input_tokens)??0),outputTokens:(a==null?void 0:a.output_tokens)??0,totalCostUsd:o})}}d&&((m=this.onModelsStateChange)==null||m.call(this,d)),x&&((g=this.onUsageChange)==null||g.call(this,x)),this.turnEnded=p==="turn_end",this.userSinceTurnEnd=p==="user",this.turnEnded&&((j=this.onStatusChange)==null||j.call(this,"idle"))}connectSSE(){he.connect(this.sessionId),this.unsub=he.onEvent(t=>this.handleEvent(t))}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),he.disconnect()}handleEvent(t){var c,d,x,p,m,g,j,w,_;const r=t.type,n=t.payload||{},l=JSON.stringify(t);if(!/Remote Control connecting/i.test(l))switch(r){case"user":{this.userSinceTurnEnd=!0;break}case"assistant":{const a=n.uuid;if(typeof a=="string"&&a){if(this.seenUuids.has(a))break;this.seenUuids.add(a)}const o=typeof n.content=="string"?n.content:"",f=ms(n);this.setEntries(b=>{const N=b[b.length-1];if((N==null?void 0:N.type)==="assistant_message"&&N.id.startsWith(fe))return[...b.slice(0,-1),{...N,id:`assistant-${Date.now()}`,chunks:[...f?[{type:"thought",text:f}]:[],{type:"message",text:o}]}];if((N==null?void 0:N.type)==="assistant_message"){const M=N.chunks[N.chunks.length-1];return(M==null?void 0:M.type)==="message"?[...b.slice(0,-1),{...N,chunks:[...N.chunks.slice(0,-1),{type:"message",text:M.text+o}]}]:[...b.slice(0,-1),{...N,chunks:[...N.chunks,{type:"message",text:o}]}]}if(o&&o.trim()||f){const M={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...f?[{type:"thought",text:f}]:[],...o?[{type:"message",text:o}]:[]]};return[...b,M]}return b});const y=n.message;if(y&&typeof y=="object"&&Array.isArray(y.content)){const b=y.content.filter(N=>N.type==="tool_use");for(const N of b){const M=N.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(M))continue;this.seenToolCallIds.add(M);const A={id:M,title:N.name||"tool",status:"running",rawInput:N.input||{}};this.setEntries(E=>[...E,{type:"tool_call",toolCall:A}])}}break}case"tool_use":{const a=n,o=a.tool_call_id||`call-${Date.now()}`;if(this.seenToolCallIds.has(o))break;this.seenToolCallIds.add(o);const f={id:o,title:a.tool_name||"tool",status:"running",rawInput:a.tool_input||{}};this.setEntries(y=>[...y,{type:"tool_call",toolCall:f}]);break}case"tool_result":{const a=n,o=a.tool_call_id||"";this.setEntries(f=>{const y=Ee(f,o);if(y<0)return f;const b=f[y];return f.map((N,M)=>M===y?{type:"tool_call",toolCall:{...b.toolCall,status:"complete",rawOutput:{output:a.content||a.output||""}}}:N)});break}case"control_request":case"permission_request":{const a=n.request;if(a&&a.subtype==="can_use_tool"){const o=n.request_id||"",f=a.tool_name||"unknown",y=a.input||a.tool_input||{},b=a.description||"",N=Array.isArray(a.permission_suggestions)?a.permission_suggestions:[];this.setEntries(M=>{const A=[...M].reverse().findIndex(E=>E.type==="tool_call");if(A>=0){const E=M.length-1-A,D=M[E];if(D.toolCall.status==="running")return M.map((H,W)=>W===E?{type:"tool_call",toolCall:{...D.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:o,options:[]}}}:H)}return M}),(c=this.onPermissionRequest)==null||c.call(this,{requestId:o,toolName:f,toolInput:y,description:b,suggestions:N})}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(ut(n)){this.setEntries([]);break}if(typeof n.status=="string"){if(n.status==="running"&&this.turnEnded&&!this.userSinceTurnEnd)break;(x=this.onStatusChange)==null||x.call(this,n.status)}break}case"error":{const a=String(n.message||n.content||"Unknown error");(p=this.onError)==null||p.call(this,a);break}case"models_state":{const a=n.raw,o=typeof a=="object"&&a!==null?a.models_state:n.models_state;o&&Array.isArray(o.availableModels)&&typeof o.currentModelId=="string"&&((m=this.onModelsStateChange)==null||m.call(this,o));break}case"system":{const a=n.raw,o=a&&typeof a=="object"?a:n,f=typeof o.subtype=="string"?o.subtype:void 0;if(f==="task_started"||f==="task_progress"||f==="task_notification"){const b={subtype:f,task_id:typeof o.task_id=="string"?o.task_id:void 0,tool_use_id:typeof o.tool_use_id=="string"?o.tool_use_id:void 0,description:typeof o.description=="string"?o.description:void 0,task_type:typeof o.task_type=="string"?o.task_type:void 0,workflow_name:typeof o.workflow_name=="string"?o.workflow_name:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,usage:o.usage&&typeof o.usage=="object"?o.usage:void 0,last_tool_name:typeof o.last_tool_name=="string"?o.last_tool_name:void 0,summary:typeof o.summary=="string"?o.summary:void 0,status:o.status==="completed"||o.status==="failed"||o.status==="stopped"?o.status:void 0,output_file:typeof o.output_file=="string"?o.output_file:void 0};this.subagentState=cs(this.subagentState,b)}const y=typeof o.permissionMode=="string"?o.permissionMode:typeof n.permissionMode=="string"?n.permissionMode:null;y&&((g=this.onPermissionModeChange)==null||g.call(this,y));break}case"control_response":{const a=n.response;if(a&&typeof a=="object"){const o=typeof a.request_id=="string"?a.request_id:"",f=typeof a.subtype=="string"?a.subtype:"";if(o){(j=this.onControlResponse)==null||j.call(this,{subtype:f,requestId:o,error:typeof a.error=="string"?a.error:void 0});const y=this.pendingControlRequests.get(o);y&&(this.pendingControlRequests.delete(o),y(f==="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 o=a.delta;if(!o||typeof o.type!="string")break;const f=o.type==="text_delta"?"message":o.type==="thinking_delta"?"thought":null;if(!f)break;const y=o.text??o.thinking;if(typeof y!="string"||!y)break;this.appendStreamingDelta(f,y)}break}case"partial_assistant":{const a=typeof n.content=="string"?n.content:"";a&&this.appendStreamingDelta("message",a);break}case"result":case"result_success":{this.turnEnded=!0,this.userSinceTurnEnd=!1,(w=this.onStatusChange)==null||w.call(this,"idle");const a=n.usage,o=typeof n.total_cost_usd=="number"?n.total_cost_usd:null;if(a||o!==null){const f=((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);(_=this.onUsageChange)==null||_.call(this,{inputTokens:f,outputTokens:(a==null?void 0:a.output_tokens)??0,totalCostUsd:o})}break}case"task_state":{const a=Array.isArray(n.tasks)?n.tasks:[];if(a.length===0)break;const o=Te(a);if(o.length===0)break;this.setEntries(f=>[...f.filter(b=>b.type!=="plan"),{type:"plan",id:`plan-${n.task_list_id||Date.now()}`,entries:o}]);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(fe)){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:`${fe}${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 g=`📎 ${m.name}${m.size!=null?` (${ps(m.size)})`:""}`,j=m.textContent||"(空文件)";x.push({type:"text",text:`${g}
57
+ \`\`\`
58
+ ${j}
59
+ \`\`\``})}else if(m.kind==="directory"){const g=`📁 目录: ${m.name}${m.files!=null?` (${m.files.length} 个文件)`:""}`,j=m.textContent||"(空目录)";x.push({type:"text",text:`${g}
60
+ ${j}`})}}const p=x.length===1&&x[0].type==="text"?x[0].text||t:x.length>0?x:t;await mt(this.sessionId,{type:"user",uuid:pe(),content:t,message:{content:p}})}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 xt(this.sessionId)}async setPermissionMode(t){const r=pe();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=pe(),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 p of d.suggestions)p&&typeof p=="object"&&typeof p.path=="string"&&x.push(p.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 ps(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function hs(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 fs(s){return s?Date.now()-s<6e4:!1}function ys({onClose:s,session:t,liveStatus:r,pendingPermissions:n,onInterrupt:l,onDelete:c}){const[d,x]=u.useState(!1),p=async()=>{await navigator.clipboard.writeText(t.id),x(!0),setTimeout(()=>x(!1),1500)},m=n.length,g=t.worker,j=t.work_item,w=t.environment;return e.jsx(We,{open:!0,onOpenChange:_=>{_||s()},children:e.jsxs(Qe,{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(Ge,{children:e.jsx(Ke,{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(zt,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{status:r||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:g&&(fs(g.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[g&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(ve,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:hs(g.last_heartbeat_at)})]}),w&&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:w.machine_name||w.id})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(ve,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:qe(t.created_at)})]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(De,{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(ss,{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(pt,{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(Gt,{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:p,className:"text-text-muted hover:text-text-primary transition-colors flex-shrink-0",title:"Copy session id",children:d?"✓":"⧉"})]})]}),j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Spawn mode"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:j.spawn_mode??"default"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Work state"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:j.state})]})]}),t.source&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Source"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:t.source})]}),w&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker type"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:w.worker_type})]})]})]})]})]})})}const Ae="rcs:subagent-panel:collapsed";function gs(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 bs(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 js({status:s}){return s==="running"?e.jsx(De,{className:"h-3 w-3 animate-spin text-brand"}):s==="completed"?e.jsx(es,{className:"h-3 w-3 text-status-success"}):s==="failed"||s==="stopped"?e.jsx(ht,{className:"h-3 w-3 text-status-error"}):null}function ws({task:s}){const t=s.status==="running",r=t?s.durationMs??Date.now()-s.startTime:(s.endTime??Date.now())-s.startTime,n=bs(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(js,{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:gs(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 ks({state:s}){const[t,r]=u.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ae)==="1"}catch{return!1}}),n=()=>{r(p=>{const m=!p;try{window.localStorage.setItem(Ae,m?"1":"0")}catch{}return m})},[,l]=u.useState(0);u.useEffect(()=>{const p=Object.values(s.tasks).some(j=>j.status==="running"),m=Object.values(s.tasks).some(j=>j.status!=="running"&&j.evictAfter!==void 0);if(!p&&!m)return;const g=setInterval(()=>{l(j=>j+1)},1e3);return()=>clearInterval(g)},[s]);const c=ds(s);if(c.length===0)return null;const d=c.filter(p=>p.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(Vt,{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(p=>e.jsx(ws,{task:p},p.taskId))})]})})}function Re(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 Ns({requestId:s,toolName:t,toolInput:r,description:n,suggestions:l,onApprove:c,onApproveAlways:d,onReject:x}){const p=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(ls,{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:$(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:$(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:_e(p,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:`允许并记住规则:${Re(t,l)}`,children:[e.jsx(os,{className:"h-3.5 w-3.5"}),"Always allow ",_e(Re(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 vs({questions:s,description:t,onSubmit:r,onSkip:n}){const[l,c]=u.useState({}),[d,x]=u.useState({}),[p,m]=u.useState(0),g=(a,o,f)=>{if(f){const y=l[a]||[],b=y.includes(o)?y.filter(N=>N!==o):[...y,o];c({...l,[a]:b})}else c({...l,[a]:o})},j=a=>{var f;const o=(f=d[a])==null?void 0:f.trim();o&&(c({...l,[a]:o}),x({...d,[a]:""}))},w=()=>{var o,f;const a={};for(const[y,b]of Object.entries(l)){const N=s[parseInt(y,10)];N&&(typeof b=="number"?a[y]=((f=(o=N.options)==null?void 0:o[b])==null?void 0:f.label)||String(b):Array.isArray(b)?a[y]=b.map(M=>{var A,E;return((E=(A=N.options)==null?void 0:A[M])==null?void 0:E.label)||String(M)}):a[y]=b)}r(a)};if(s.length<=1){const a=s[0]||{question:t,options:[],multiSelect:!1},o=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:$(t||a.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(a.options||[]).map((f,y)=>{const b=o?(l[0]||[]).includes(y):l[0]===y;return e.jsxs("button",{onClick:()=>g(0,y,o),className:J("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",b?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:$(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:$(f.description)})]},y)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:d[0]||"",onChange:f=>x({...d,0: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"&&j(0)}),e.jsx("button",{onClick:()=>j(0),className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("button",{onClick:w,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 _=s[p];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:$(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:s.map((a,o)=>e.jsx("button",{onClick:()=>m(o),className:J("rounded-md px-3 py-1.5 text-xs whitespace-nowrap transition-colors",p===o?"bg-brand/20 text-brand":"text-text-muted hover:bg-surface-2"),children:a.header||`Q${o+1}`},o))}),_&&e.jsx(_s,{question:_,qIdx:p,answers:l,otherTexts:d,onSelect:g,onOtherTextChange:(a,o)=>x({...d,[a]:o}),onOtherSubmit:j}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[p+1," / ",s.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:w,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 _s({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:$(s.question)}),e.jsxs("div",{className:"space-y-2",children:[(s.options||[]).map((p,m)=>{const g=x?(r[t]||[]).includes(m):r[t]===m;return e.jsxs("button",{onClick:()=>l(t,m,x),className:J("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",g?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:$(p.label)}),p.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:$(p.description)})]},m)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:n[t]||"",onChange:p=>c(t,p.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:p=>p.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 Ss({planContent:s,description:t,onSubmit:r}){const[n,l]=u.useState(null),[c,d]=u.useState(""),x=!s||!s.trim(),p=()=>{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(Ue,{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:Cs(s)}}),e.jsx("div",{className:"space-y-2",children:x?e.jsxs(e.Fragment,{children:[e.jsx(Y,{selected:n==="yes-default",onClick:()=>l("yes-default"),label:"Yes"}),e.jsx(Y,{selected:n==="no",onClick:()=>l("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{selected:n==="yes-accept-edits",onClick:()=>l("yes-accept-edits"),label:"Yes, auto-accept edits",desc:"Approve plan and auto-accept file edits"}),e.jsx(Y,{selected:n==="yes-default",onClick:()=>l("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(Y,{selected:n==="no",onClick:()=>l("no"),label:"No, keep planning",desc:"Provide feedback to refine the plan"})]})}),n==="no"&&e.jsx("textarea",{value:c,onChange: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:p,disabled:!n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"Submit"})})]})}function Y({selected:s,onClick:t,label:r,desc:n}){return e.jsxs("button",{onClick:t,className:J("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",s?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:J("flex h-4 w-4 items-center justify-center rounded-full border text-[10px] transition-colors",s?"border-brand bg-brand text-white":"border-border"),children:s&&"✓"}),e.jsx("span",{className:"font-medium",children:r})]}),n&&e.jsx("div",{className:"mt-0.5 pl-6 text-xs text-text-muted",children:n})]})}function Cs(s){let t=$(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 Ms({request:s,onSubmit:t}){const r=Es(s.requestedSchema),n=Ts(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($e,{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(Ut,{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($e,{serverName:s.serverName,message:s.message}),r.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:r.map(({name:x,prop:p})=>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:"必填"})]}),p.description&&e.jsx("div",{className:"mb-1 text-xs text-text-muted",children:$(p.description)}),e.jsx("input",{type:p.type==="number"?"number":"text",value:l[x]??"",onChange:m=>c(g=>({...g,[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:p,prop:m}of r){const g=(l[p]??"").trim();g&&(x[p]=m.type==="number"?Number(g):g)}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 $e({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(Xt,{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:$(s)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:$(t)})]})}function Es(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 Ts(s){const t=s==null?void 0:s.required;return Array.isArray(t)?t.filter(r=>typeof r=="string"):[]}function As(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 g=await ft(s);r(g)}catch(g){d(g instanceof Error?g.message:"Failed to load shares")}finally{l(!1)}},[s]);u.useEffect(()=>{x()},[x]);const p=u.useCallback(async g=>{d(null);try{const j=await yt(s,g);return await x(),j}catch(j){throw d(j instanceof Error?j.message:"Failed to create share"),j}},[s,x]),m=u.useCallback(async g=>{d(null);try{await gt(s,g),await x()}catch(j){throw d(j instanceof Error?j.message:"Failed to revoke share"),j}},[s,x]);return{shares:t,isLoading:n,error:c,createShare:p,revokeShare:m,refresh:x}}function Rs({open:s,onClose:t,sessionId:r,sessionTitle:n}){Fe();const{shares:l,isLoading:c,error:d,createShare:x,revokeShare:p}=As(r),[m,g]=u.useState("user"),[j,w]=u.useState(""),[_,a]=u.useState(""),[o,f]=u.useState("read"),[y,b]=u.useState(""),[N,M]=u.useState(!1),[A,E]=u.useState(null),[D,H]=u.useState(""),[W,I]=u.useState(!1),[oe,O]=u.useState(!1);u.useEffect(()=>{s&&(g("user"),w(""),a(""),f("read"),b(""),M(!1),E(null),H(""),I(!1),O(!1))},[s]);const X=async()=>{M(!0),H(""),E(null);try{const S={grantedTo:m==="user"?{userId:j.trim()}:{teamId:_.trim()},permission:o};y.trim()&&(S.expiresAt=y.trim());const G=await x(S);E(`${window.location.origin}/code/s/${G.shareToken}`)}catch(S){H(S instanceof Error?S.message:"Failed to create share")}finally{M(!1)}},B=async S=>{try{await p(S)}catch{}},Q=async()=>{if(!A)return;O(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(A),I(!0),setTimeout(()=>I(!1),2e3);return}}catch{}const S=document.createElement("textarea");S.value=A,S.style.position="fixed",S.style.opacity="0",document.body.appendChild(S),S.select();try{document.execCommand("copy"),I(!0),setTimeout(()=>I(!1),2e3)}catch{O(!0)}document.body.removeChild(S)};return e.jsx(We,{open:s,onOpenChange:S=>{S||t()},children:e.jsxs(Qe,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Ge,{children:e.jsxs(Ke,{className:"font-display text-lg font-semibold text-text-primary",children:[k("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:k("share.grantTo")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>g("user"),className:`rounded-md px-3 py-1 text-sm transition-colors ${m==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:k("share.user")}),e.jsx("button",{onClick:()=>g("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:k("share.team")})]}),m==="user"?e.jsx(Ot,{onSelect:w,placeholder:k("share.userIdPlaceholder"),actionLabel:k("share.selectUser")}):e.jsx("input",{type:"text",value:_,onChange:S=>a(S.target.value),placeholder:k("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"&&j&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[k("share.selectedUser"),": ",e.jsx("span",{className:"font-mono",children:j})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:k("share.permission")}),e.jsxs("select",{value:o,onChange:S=>f(S.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"read",children:k("share.permissionRead")}),e.jsx("option",{value:"write",children:k("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:k("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:y,onChange:S=>b(S.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none"})]}),(D||d)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:D||d}),A&&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:k("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:A}),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:W?k("share.copied"):k("share.copy")})]}),oe&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:k("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:k("share.existingShares")}),c?e.jsx("p",{className:"text-sm text-text-muted",children:k("share.loading")}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:k("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:l.map(S=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md bg-surface-2 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm text-text-primary",children:S.granted_to_user||S.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[S.permission==="write"?k("share.permissionWrite"):k("share.permissionRead"),S.expires_at?` · expires ${S.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>B(S.id),className:"shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:k("share.revoke")})]},S.id))})]})]}),e.jsxs(Dt,{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:k("common.close")}),e.jsx("button",{onClick:X,disabled:N||(m==="user"?!j.trim():!_.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?k("common.creating"):k("share.createShare")})]})]})})}function $s(s){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${s}`}function Is(s){const t=$s(s),r=jt(),n=r?{proxyUrl:t,token:r}:{proxyUrl:t};return new bt(n)}const V=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"}],ae="rcs_permission_mode";function Ie(s){return s<1e3?String(s):s<1e6?`${(s/1e3).toFixed(1)}k`:`${(s/1e6).toFixed(1)}M`}function Ps(s){const t=V.findIndex(r=>r.value===s);return V[(t+1+V.length)%V.length].value}function qs({models:s,currentModelId:t,onSelect:r,disabled:n}){const[l,c]=u.useState(!1),d=s.find(m=>m.modelId===t)??null,x=s.length>0,p=async m=>{r(m.modelId),c(!1)};return e.jsxs(Le,{open:l,onOpenChange:x?c:void 0,children:[e.jsx(He,{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(ze,{className:"h-3 w-3"}):e.jsx(Be,{className:"h-3 w-3"})]})}),e.jsx(Ve,{className:"w-72 p-0",align:"start",children:e.jsx(Pt,{models:s,currentModelId:t,onSelect:p,showSearch:s.length>5})})]})}function Ds({mode:s,onModeChange:t,disabled:r}){const[n,l]=u.useState(!1),c=V.find(d=>d.value===s);return e.jsxs(Le,{open:n,onOpenChange:l,children:[e.jsx(He,{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(It,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:(c==null?void 0:c.label)??s}),n?e.jsx(ze,{className:"h-3 w-3"}):e.jsx(Be,{className:"h-3 w-3"})]})}),e.jsx(Ve,{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(Ue,{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 Xs({sessionId:s,onSessionLoaded:t}){Fe();const[r,n]=u.useState(null),[l,c]=u.useState(null),[d,x]=u.useState(""),[p,m]=u.useState(!1),[g,j]=u.useState(!1),[w,_]=u.useState(!1),[a,o]=u.useState(!1),[f,y]=u.useState([]),[b,N]=u.useState(!1),[M,A]=u.useState([]),[E,D]=u.useState(null),[H,W]=u.useState(()=>Je()),[I,oe]=u.useState(null),[O,X]=u.useState(null),[B,Q]=u.useState([]),[S,G]=u.useState(!1),[ie,ye]=u.useState(""),le=u.useRef(null),[ce,Z]=u.useState(()=>localStorage.getItem(ae)||"default"),[ge,be]=u.useState(null),K=u.useRef(null),U=u.useRef(ce);U.current=ce;const ee=u.useRef(null),je=u.useRef(null),we=u.useRef(f);we.current=f;const te=u.useRef(t);te.current=t;const se=u.useCallback(i=>{be(i),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>be(null),5e3)},[]),de=u.useCallback(i=>{var C;if(i===U.current)return;const h=U.current;U.current=i,Z(i);try{localStorage.setItem(ae,i)}catch{}(C=je.current)==null||C.setPermissionMode(i).then(v=>{ee.current={requestId:v,previous:h}}).catch(v=>{console.error("[SessionDetail] set permission mode failed:",v),se(`模式切换请求发送失败: ${v instanceof Error?v.message:String(v)}`),U.current=h,Z(h)})},[se]),R=u.useMemo(()=>new xs(s,y,{onStatusChange:i=>{c(i),N(i==="running"||i==="requires_action")},onError:i=>{console.error("[RCSChatAdapter] error:",i)},onPermissionRequest:i=>{A(h=>h.some(C=>C.requestId===i.requestId)?h:[...h,i])},onModelsStateChange:i=>{D(i)},onSubagentUpdate:i=>{W(i)},onControlResponse:i=>{const h=ee.current;if(!(!h||h.requestId!==i.requestId)&&(ee.current=null,i.subtype==="error")){U.current=h.previous,Z(h.previous);try{localStorage.setItem(ae,h.previous)}catch{}se(i.error||"模式切换失败")}},onPermissionModeChange:i=>{if(i!==U.current){U.current=i,Z(i);try{localStorage.setItem(ae,i)}catch{}ee.current=null}},onUsageChange:i=>{oe(h=>({inputTokens:Math.max((h==null?void 0:h.inputTokens)??0,i.inputTokens),outputTokens:Math.max((h==null?void 0:h.outputTokens)??0,i.outputTokens),totalCostUsd:i.totalCostUsd??(h==null?void 0:h.totalCostUsd)??null}))},onElicitationRequest:i=>{X(i)}}),[s,se]);u.useEffect(()=>(je.current=R,()=>{R.disconnect()}),[R]),u.useEffect(()=>{let i=!1;async function h(){var C;x("");try{const v=await Tt(s);if(i)return;n(v),c(v.status),N(v.status==="running"||v.status==="requires_action"),(C=te.current)==null||C.call(te,v)}catch(v){if(i)return;x(v instanceof Error?v.message:k("session.loadFailed"));return}try{await R.init()}catch(v){console.warn("Failed to init adapter:",v)}}return h(),()=>{i=!0}},[s,R]);const z=At(l),L=(r==null?void 0:r.access_level)==="read",ue=u.useCallback(()=>{y([]),wt(s).catch(i=>{console.warn("[SessionDetail] Failed to clear session history:",i)})},[s]),ne=u.useCallback(async i=>{const h=i.text.trim(),C=i.images&&i.images.length>0||i.attachments&&i.attachments.length>0;if(!h&&!C||z)return;const v=await kt(h,{sessionId:s,availableCommands:Se,availableModels:(E==null?void 0:E.availableModels)??[],currentModel:E?{modelId:E.currentModelId,name:E.currentModelId}:null,supportsImages:!0,entries:we.current,setModel:async q=>{await F(s,{type:"control_request",request:{subtype:"set_model",model:q}}),D(xe=>xe&&{...xe,currentModelId:q})},onNewSession:()=>{y([])}}).catch(()=>null);if(v){if(Nt("[SessionDetail] local command result",v),"clearEntries"in v&&v.clearEntries){ue();return}if("newSession"in v&&v.newSession){ue();return}if("userEntry"in v){y(q=>[...q,v.userEntry,v.cmdEntry]);return}}N(!0);try{await R.sendMessage(h,i.images,i.attachments)}catch(q){console.error("Send failed:",q)}},[R,z,s,E,ue]),Xe=u.useCallback(i=>{if(b){Q(h=>[...h,i]);return}ne(i)},[b,ne]),me=u.useRef(!1);u.useEffect(()=>{if(b||B.length===0||me.current)return;const i=B[0];i&&(me.current=!0,Q(h=>h.slice(1)),ne(i).finally(()=>{me.current=!1}))},[b,B,ne]);const ke=u.useCallback(async()=>{try{await R.interrupt()}catch(i){console.error("Interrupt failed:",i)}finally{N(!1)}},[R]),Ze=u.useCallback(()=>{de(Ps(U.current))},[de]);u.useEffect(()=>()=>{K.current&&clearTimeout(K.current)},[]);const et=u.useCallback(async()=>{if(r&&window.confirm(k("dashboard.confirmDelete").replace("{id}",r.title||r.id)))try{await vt(r.id),window.location.href="/code/"}catch(i){alert(i instanceof Error?i.message:k("dashboard.deleteFailed"))}},[r]),tt=u.useCallback(async i=>{try{await R.respondPermission(i,!0)}catch(h){console.error("Failed to approve:",h)}A(h=>h.filter(C=>C.requestId!==i))},[R]),st=u.useCallback(async(i,h)=>{try{await R.respondPermission(i,!0,{updated_permissions:h})}catch(C){console.error("Failed to approve with rules:",C)}A(C=>C.filter(v=>v.requestId!==i))},[R]),nt=u.useCallback(async(i,h)=>{const C=O;if(X(null),!!C)try{await R.respondElicitation(C.requestId,i,h)}catch(v){console.error("Failed to submit elicitation:",v)}},[O,R]),rt=u.useCallback(()=>{!r||L||(ye(r.title||""),G(!0),setTimeout(()=>{var i,h;(i=le.current)==null||i.focus(),(h=le.current)==null||h.select()},0))},[r,L]),Ne=u.useCallback(async()=>{const i=ie.trim();if(G(!1),!(!r||!i||i===r.title))try{const h=await _t(r.id,i);n(C=>C&&{...C,title:h.title??i})}catch(h){console.error("Rename failed:",h),alert(h instanceof Error?h.message:"重命名失败")}},[r,ie]),at=u.useCallback(async i=>{try{await R.respondPermission(i,!1)}catch(h){console.error("Failed to reject:",h)}A(h=>h.filter(C=>C.requestId!==i))},[R]),ot=u.useCallback(async(i,h,C)=>{try{await F(s,{type:"permission_response",approved:!0,request_id:i,updated_input:{questions:C,answers:h}})}catch(v){console.error("Failed to submit answers:",v)}A(v=>v.filter(q=>q.requestId!==i))},[s]),it=u.useCallback(async(i,h,C)=>{try{h==="no"?await F(s,{type:"permission_response",approved:!1,request_id:i,...C?{message:C}:{}}):await F(s,{type:"permission_response",approved:!0,request_id:i,updated_permissions:[{type:"setMode",mode:{"yes-accept-edits":"acceptEdits","yes-default":"default"}[h]||"default",destination:"session"}]})}catch(v){console.error("Failed to submit plan response:",v)}A(v=>v.filter(q=>q.requestId!==i))},[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:k("session.backToDashboard")})]})}):r?r.source==="acp"&&r.environment_id?e.jsx(Fs,{sessionId:s,agentId:r.environment_id}):e.jsx(Oe,{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:[S?e.jsx("input",{ref:le,value:ie,onChange:i=>ye(i.target.value),onKeyDown:i=>{i.key==="Enter"&&!i.nativeEvent.isComposing?(i.preventDefault(),Ne()):i.key==="Escape"&&(i.preventDefault(),G(!1))},onBlur:()=>void Ne(),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:rt,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(St,{className:"h-3.5 w-3.5"})})]}),r.visibility&&!S&&e.jsx(Ft,{visibility:r.visibility||"private"})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(()=>{var C;const i=r.source==="acp"?"acp":(C=r.environment)==null?void 0:C.worker_type,h=qt(i);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${h.colorClass}`,children:h.fullLabel})})(),l&&e.jsx(Pe,{status:l}),e.jsx("span",{className:"text-xs text-text-muted",children:qe(r.created_at)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>o(!a),className:`flex items-center gap-1 rounded-md px-2 py-1 text-xs transition-colors ${a?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:k("artifacts.title"),children:e.jsx(Ct,{className:"h-3.5 w-3.5"})}),!L&&(r==null?void 0:r.access_level)!=="write"&&e.jsx("button",{onClick:()=>_(!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:k("session.share"),children:e.jsx(rs,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>j(!g),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:k("session.info"),children:e.jsx(Yt,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>m(!p),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:[k("session.tasks"),M.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:M.length})]})]})]}),g&&e.jsxs("div",{className:"mt-2 rounded-md bg-surface-2 px-3 py-2 text-xs text-text-muted space-y-1 font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:k("session.metaSession")})," ",r.id]}),r.environment_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:k("session.metaEnvironment")})," ",r.environment_id]})]})]})}),a&&e.jsx("div",{className:"border-b bg-surface-1 px-4 py-4",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(Lt,{sessionId:s,embedded:!0})})}),e.jsx(Mt,{entries:f,isLoading:b,emptyTitle:k("session.emptyTitle"),emptyDescription:k("session.emptyDescription")}),e.jsx(ks,{state:H}),M.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:M.map(i=>e.jsx(Us,{request:i,onApprove:()=>tt(i.requestId),onApproveAlways:i.suggestions&&i.suggestions.length>0?()=>st(i.requestId,i.suggestions??[]):void 0,onReject:()=>at(i.requestId),onSubmitAnswers:ot,onSubmitPlan:it},i.requestId))})}),O&&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(Ms,{request:O,onSubmit:nt})})}),ge&&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:ge})}),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(Ds,{mode:ce,onModeChange:de,disabled:z||L}),e.jsx(qs,{models:(E==null?void 0:E.availableModels)??[],currentModelId:(E==null?void 0:E.currentModelId)??null,onSelect:i=>{F(s,{type:"control_request",request:{subtype:"set_model",model:i}}),D(h=>h&&{...h,currentModelId:i})},disabled:z||L})]}),I&&e.jsxs("span",{className:"text-[11px] text-text-muted font-mono",title:"会话累计用量(input 含缓存读写)",children:[Ie(I.inputTokens)," in / ",Ie(I.outputTokens)," out",I.totalCostUsd!=null&&` · $${I.totalCostUsd.toFixed(2)}`]})]}),e.jsx(Et,{onSubmit:Xe,isLoading:b,onInterrupt:ke,onCycleMode:Ze,disabled:z||L,placeholder:z?k("session.closed"):L?k("session.readOnly"):k("session.inputPlaceholder"),supportsAttachments:!0,commands:Se,queueWhileLoading:!0,queuedCount:B.length,onDequeue:i=>Q(h=>h.filter((C,v)=>v!==i)),onSearchFiles:i=>R.searchFiles(i)}),p&&r&&e.jsx(ys,{onClose:()=>m(!1),session:r,liveStatus:l,pendingPermissions:M,onInterrupt:ke,onDelete:et}),e.jsx(Rs,{open:w,onClose:()=>_(!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:k("session.loading")})})}function Us({request:s,onApprove:t,onApproveAlways:r,onReject:n,onSubmitAnswers:l,onSubmitPlan:c}){const d=s.toolName,x=s.toolInput,p=s.description||"";if(d==="AskUserQuestion"){const m=x.questions||[];return e.jsx(vs,{requestId:s.requestId,questions:m,description:p,onSubmit:g=>l(s.requestId,g,m),onSkip:n})}if(d==="ExitPlanMode"){const m=x.plan||"";return e.jsx(Ss,{requestId:s.requestId,planContent:m,description:p,onSubmit:(g,j)=>c(s.requestId,g,j)})}return e.jsx(Ns,{requestId:s.requestId,toolName:d,toolInput:x,description:p,suggestions:s.suggestions,onApprove:t,onApproveAlways:r,onReject:n})}function Fs({sessionId:s,agentId:t}){const[r,n]=u.useState(null),[l,c]=u.useState("disconnected"),[d,x]=u.useState(null),p=u.useRef(null);return u.useEffect(()=>{const m=Is(t);return m.setConnectionStateHandler((g,j)=>{c(g),x(j||null)}),p.current=m,n(m),m.connect().catch(g=>{g instanceof Rt||(x(g.message),c("error"))}),()=>{m.disconnect(),p.current=null,n(null),c("disconnected")}},[t]),e.jsx(Oe,{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:k("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:k("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($t,{client:r,agentId:t})})]})})}export{Xs as SessionDetail};
@@ -0,0 +1,11 @@
1
+ import{j as e}from"./vendor-DE_-CLIE.js";import{ab as c,U as n,a9 as i}from"./main-B8hkVvfg.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 d=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],x=c("globe",d);/**
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 b=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],m=c("lock",b);function u({visibility:o,className:t}){const a={private:{label:"Private",Icon:m,colorClass:"text-text-muted border-border/60"},team:{label:"Team",Icon:n,colorClass:"text-accent border-accent/40"},public:{label:"Public",Icon:x,colorClass:"text-accent border-accent/40"}},{label:s,Icon:r,colorClass:l}=a[o];return e.jsxs("span",{className:i("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs",l,t),children:[e.jsx(r,{className:"h-3 w-3"}),s]})}export{u as S};
@@ -1 +1 @@
1
- import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aj as v,af as t}from"./main-N3GYCdLF.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function q({onSuccess:p,onAlreadyDone:b}){const{setup:f}=v(),[n,h]=r.useState(""),[l,y]=r.useState(""),[a,g]=r.useState(""),[d,w]=r.useState(""),[i,o]=r.useState(""),[c,m]=r.useState(!1),j=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==d){o(t("auth.setup.passwordMismatch"));return}m(!0);try{await f(n,l,a),p()}catch(x){const u=x instanceof Error?x.message:"Setup failed";if(u.includes("already")||u.includes("409")){b();return}o(u)}finally{m(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.setup.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.setup.description")})]}),e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.apiKey")}),e.jsx("input",{type:"password",value:n,onChange:s=>h(s.target.value),required:!0,autoComplete:"off",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.username")}),e.jsx("input",{type:"text",value:l,onChange:s=>y(s.target.value),required:!0,autoComplete:"username",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.confirmPassword")}),e.jsx("input",{type:"password",value:d,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:c,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:c?t("common.loading"):t("auth.setup.submit")})]})]})})}export{q as Setup};
1
+ import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{ap as v,al as t}from"./main-B8hkVvfg.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function q({onSuccess:p,onAlreadyDone:b}){const{setup:f}=v(),[n,h]=r.useState(""),[l,y]=r.useState(""),[a,g]=r.useState(""),[d,w]=r.useState(""),[i,o]=r.useState(""),[c,m]=r.useState(!1),j=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==d){o(t("auth.setup.passwordMismatch"));return}m(!0);try{await f(n,l,a),p()}catch(x){const u=x instanceof Error?x.message:"Setup failed";if(u.includes("already")||u.includes("409")){b();return}o(u)}finally{m(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.setup.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.setup.description")})]}),e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.apiKey")}),e.jsx("input",{type:"password",value:n,onChange:s=>h(s.target.value),required:!0,autoComplete:"off",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.username")}),e.jsx("input",{type:"text",value:l,onChange:s=>y(s.target.value),required:!0,autoComplete:"username",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.confirmPassword")}),e.jsx("input",{type:"password",value:d,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:c,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:c?t("common.loading"):t("auth.setup.submit")})]})]})})}export{q as Setup};
@@ -0,0 +1 @@
1
+ import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{a2 as m,b as h}from"./main-B8hkVvfg.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function j(){const[t,r]=d.useState("loading"),[i,a]=d.useState(""),l=(typeof window<"u"?window.location.pathname:"").match(/\/code\/s\/([^/?]+)/),o=l?l[1]:null;return d.useEffect(()=>{if(!o){r("invalid"),a("Share link is invalid — no token found.");return}if(!o.startsWith("shr_")){r("invalid"),a("Invalid share token format.");return}let n=!1;async function c(){try{const s=await m(o);if(n)return;window.location.href=`/code/${s.id}`}catch(s){if(n)return;s instanceof h?s.status===401&&s.message.toLowerCase().includes("expired")?(r("expired"),a("This share has expired.")):s.status===404?s.message.toLowerCase().includes("session")?(r("not_found"),a("Session not found.")):(r("invalid"),a("Share not found or has been revoked.")):s.status===403?(r("invalid"),a("You do not have permission to access this share.")):(r("error"),a(s.message||"Failed to resolve share.")):(r("error"),a(s instanceof Error?s.message:"Failed to resolve share."))}}return c(),()=>{n=!0}},[o]),d.useEffect(()=>{if(t!=="loading"&&t!=="error"){const n=setTimeout(()=>{window.location.href="/code"},3e3);return()=>clearTimeout(n)}},[t]),t==="loading"?e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),e.jsx("p",{children:"Resolving share link..."})]})}):e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-primary",children:e.jsxs("div",{className:"text-center max-w-md px-4",children:[t==="expired"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Share Expired"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share has expired."})]}),t==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Invalid Share"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share link is invalid or has been revoked."})]}),t==="not_found"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Not Found"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"The session could not be found."})]}),t==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Error"}),e.jsx("p",{className:"text-status-error mb-4",children:i})]}),e.jsx("a",{href:"/code",className:"text-brand hover:underline",children:"← Back to Dashboard"})]})})}export{j as ShareLanding};
@@ -1 +1 @@
1
- import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{ak as f,al as y,af as r}from"./main-N3GYCdLF.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function S(){f();const{createTeam:u}=y(),[o,p]=a.useState(""),[s,c]=a.useState(""),[i,b]=a.useState(""),[m,l]=a.useState(null),[d,x]=a.useState(!1),h=t=>{p(t),s||c(t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-"))},g=async t=>{t.preventDefault(),l(null),x(!0);try{const n=await u({name:o,slug:s,description:i||void 0});window.location.href=`/teams/${n.slug}`}catch(n){l(n instanceof Error?n.message:"Failed to create team")}finally{x(!1)}};return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"mb-10 font-display text-2xl font-semibold tracking-tight text-text-primary",children:r("team.create.title")}),e.jsxs("form",{onSubmit:g,className:"max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.name")}),e.jsx("input",{id:"name",type:"text",required:!0,value:o,onChange:t=>h(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"Engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.nameHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"slug",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.slug")}),e.jsx("input",{id:"slug",type:"text",required:!0,value:s,onChange:t=>c(t.target.value),pattern:"^[a-z0-9-]{3,32}$",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.slugHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.description")}),e.jsx("textarea",{id:"description",value:i,onChange:t=>b(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:d||!o||!s,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:d?r("common.creating"):r("team.create.submit")})]})]})]})})}export{S as TeamCreate};
1
+ import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{aq as f,ar as y,al as r}from"./main-B8hkVvfg.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function S(){f();const{createTeam:u}=y(),[o,p]=a.useState(""),[s,c]=a.useState(""),[i,b]=a.useState(""),[m,l]=a.useState(null),[d,x]=a.useState(!1),h=t=>{p(t),s||c(t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-"))},g=async t=>{t.preventDefault(),l(null),x(!0);try{const n=await u({name:o,slug:s,description:i||void 0});window.location.href=`/teams/${n.slug}`}catch(n){l(n instanceof Error?n.message:"Failed to create team")}finally{x(!1)}};return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"mb-10 font-display text-2xl font-semibold tracking-tight text-text-primary",children:r("team.create.title")}),e.jsxs("form",{onSubmit:g,className:"max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.name")}),e.jsx("input",{id:"name",type:"text",required:!0,value:o,onChange:t=>h(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"Engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.nameHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"slug",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.slug")}),e.jsx("input",{id:"slug",type:"text",required:!0,value:s,onChange:t=>c(t.target.value),pattern:"^[a-z0-9-]{3,32}$",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.slugHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.description")}),e.jsx("textarea",{id:"description",value:i,onChange:t=>b(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:d||!o||!s,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:d?r("common.creating"):r("team.create.submit")})]})]})]})})}export{S as TeamCreate};
@@ -1,6 +1,6 @@
1
- import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{a5 as H,B as T,ak as P,af as i,d as B,X as z,x as G,K as I,a2 as W,a1 as q,aj as K,S as X,a4 as Y,j as J,o as Q,P as V,k as Z,m as ee,l as M,n as te,z as se}from"./main-N3GYCdLF.js";import{U as ae}from"./UserSearchInput-BxcYR_HU.js";import{C as D}from"./copy-9pzb1Po6.js";import{g as ne}from"./workerType-Bd-zteMi.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
1
+ import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{ab as H,B as T,aq as P,al as i,d as B,X as z,x as G,Y as I,a7 as q,a6 as W,ap as Y,S as X,a9 as J,j as K,o as Q,P as V,k as Z,m as ee,l as M,n as te,z as se}from"./main-B8hkVvfg.js";import{U as ae}from"./UserSearchInput-Bu3RXDYh.js";import{C as D}from"./copy-BD6qrRfd.js";import{g as ne}from"./workerType-Bd-zteMi.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const re=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ie=H("user-plus",re);function O(a){const[m,r]=n.useState([]),[N,v]=n.useState(!1),c=n.useCallback(async()=>{if(a){v(!0);try{const u=await T("GET",`/web/teams/${a}/members`);r(u)}catch{r([])}finally{v(!1)}}},[a]);n.useEffect(()=>{c()},[c]);const h=n.useCallback(async(u,f)=>{await T("POST",`/web/teams/${a}/members`,{userId:u,role:f}),await c()},[a,c]),x=n.useCallback(async u=>{await T("DELETE",`/web/teams/${a}/members/${u}`),await c()},[a,c]),l=n.useCallback(async(u,f)=>{await T("PATCH",`/web/teams/${a}/members/${u}`,{role:f}),await c()},[a,c]);return{members:m,isLoading:N,addMember:h,removeMember:x,updateRole:l,refetch:c}}function oe(a){const[m,r]=n.useState([]),N=n.useCallback(async c=>{if(!a)return null;const h=await T("POST",`/web/teams/${a}/invitations`,c);return r(x=>[...x,h]),h},[a]),v=n.useCallback(async c=>{a&&(await T("DELETE",`/web/teams/${a}/invitations/${c}`),r(h=>h.filter(x=>x.token!==c)))},[a]);return{invitations:m,createInvitation:N,revokeInvitation:v}}function ce({teamId:a,canManage:m}){P();const{invitations:r,createInvitation:N,revokeInvitation:v}=oe(a),{addMember:c}=O(a),[h,x]=n.useState(!1),[l,u]=n.useState(null),[f,E]=n.useState("member"),[d,g]=n.useState(!1),[y,b]=n.useState("member"),[j,L]=n.useState(null),[$,_]=n.useState(!1),[s,t]=n.useState(!1),[p,w]=n.useState(!1),S=async()=>{x(!0);try{const o=await N({role:f,expiresIn:86400,maxUses:5});o&&u(o.token||o.inviteToken||null)}catch{}finally{x(!1)}},R=async()=>{if(!l)return;const o=`${window.location.origin}/join?invite=${l}`;let k=!1;try{navigator.clipboard&&window.isSecureContext&&(await navigator.clipboard.writeText(o),k=!0)}catch{}if(!k){const C=document.createElement("textarea");C.value=o,C.style.position="fixed",C.style.top="0",C.style.opacity="0",document.body.appendChild(C),C.focus(),C.select(),C.setSelectionRange(0,o.length);try{k=document.execCommand("copy")}catch{k=!1}document.body.removeChild(C)}k?(w(!1),t(!0),setTimeout(()=>t(!1),2e3)):(t(!1),w(!0),setTimeout(()=>w(!1),4e3))},A=async o=>{_(!0),L(null);try{await c(o,y),g(!1)}catch(k){L(k instanceof Error?k.message:"Failed to add user")}finally{_(!1)}};return e.jsxs("div",{className:"space-y-5",children:[m&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("select",{className:"rounded-md border border-border bg-surface-2 px-2.5 py-1.5 text-xs text-text-primary focus:border-accent focus:outline-none",value:f,onChange:o=>E(o.target.value),children:[e.jsx("option",{value:"member",children:i("invitation.member")}),e.jsx("option",{value:"admin",children:i("invitation.admin")})]}),e.jsx("button",{type:"button",onClick:S,disabled:h,className:"rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:opacity-50",children:h?i("invitation.creating"):i("invitation.create")}),e.jsxs("button",{type:"button",onClick:()=>g(!d),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-surface-2",title:i("invitation.addExistingHint"),children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),i("invitation.addExisting")]})]}),d&&m&&e.jsxs("div",{className:"space-y-3 rounded border border-border bg-surface-2 p-3",children:[e.jsx("p",{className:"text-xs text-text-muted",children:i("invitation.addExistingHint")}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("select",{className:"rounded border border-border bg-surface-1 px-2 py-1.5 text-sm",value:y,onChange:o=>b(o.target.value),children:[e.jsx("option",{value:"member",children:i("invitation.member")}),e.jsx("option",{value:"admin",children:i("invitation.admin")})]})}),j&&e.jsx("p",{className:"text-xs text-destructive",children:j}),e.jsx(ae,{onSelect:A,actionDisabled:$,placeholder:i("invitation.searchUser")})]}),l&&e.jsxs("div",{className:"space-y-1.5 rounded border border-accent/40 bg-accent/5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-xs text-text-primary break-all",children:`${window.location.origin}/join?invite=${l}`}),e.jsx("button",{type:"button",onClick:R,className:s?"text-status-active":"text-text-muted hover:text-text-primary",title:s?i("share.copied"):i("share.copy"),children:s?e.jsx(B,{className:"h-4 w-4"}):e.jsx(D,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:()=>u(null),className:"text-text-muted hover:text-text-primary",children:e.jsx(z,{className:"h-4 w-4"})})]}),s&&e.jsx("p",{className:"text-xs text-status-active",children:i("share.copied")}),p&&e.jsx("p",{className:"text-xs text-status-error",children:i("share.copyFailed")})]}),r.length>0&&e.jsx("ul",{className:"space-y-2",children:r.map(o=>e.jsxs("li",{className:"flex items-center justify-between rounded border border-border/60 bg-surface-2 p-2 text-sm",children:[e.jsxs("span",{className:"text-text-muted",children:[o.role," — expires ",new Date(o.expiresAt).toLocaleDateString()]}),m&&e.jsx("button",{type:"button",onClick:()=>v(o.token),className:"text-sm text-destructive hover:underline",children:i("invitation.revoke")})]},o.token))})]})}function le({teamId:a,canManage:m}){const[r,N]=n.useState([]),[v,c]=n.useState(!0),[h,x]=n.useState(null),[l,u]=n.useState(""),[f,E]=n.useState(null),[d,g]=n.useState(!1),y=async()=>{try{const s=await I();N(s||[])}catch(s){x(s instanceof Error?s.message:"Failed to load environments")}finally{c(!1)}};n.useEffect(()=>{y()},[]);const b=n.useMemo(()=>r.filter(s=>s.team_id===a),[r,a]),j=n.useMemo(()=>r.filter(s=>!s.team_id),[r]),L=async()=>{if(l){E(null);try{await q(l,a),u(""),await y()}catch(s){E(s instanceof Error?s.message:"Failed to link environment")}}},$=async s=>{if(window.confirm("Unlink this environment from the team? It will revert to personal scope.")){E(null);try{await W(a,s),await y()}catch(t){E(t instanceof Error?t.message:"Failed to unlink environment")}}},_=async()=>{const s=`slz rc --team-id ${a}`;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(s),g(!0),setTimeout(()=>g(!1),2e3);return}}catch{}const t=document.createElement("textarea");t.value=s,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),g(!0),setTimeout(()=>g(!1),2e3)}catch{}document.body.removeChild(t)};return v?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading environments..."}):h?e.jsx("p",{className:"text-sm text-destructive",children:h}):e.jsxs("div",{className:"space-y-8",children:[e.jsx("ul",{className:"space-y-3",children:b.length===0?e.jsx("li",{className:"text-sm text-text-muted",children:"No environments linked to this team yet."}):b.map(s=>{const t=ne(s.worker_type);return e.jsxs("li",{className:"text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:s.machine_name||s.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${t.colorClass}`,children:t.shortLabel}),e.jsx(G,{status:s.status}),m&&e.jsx("button",{type:"button",onClick:()=>$(s.id),className:"ml-2 text-xs text-text-muted underline-offset-2 transition-colors hover:text-destructive hover:underline",children:"Unlink"})]}),e.jsxs("div",{className:"mt-1 font-mono text-xs text-text-muted",children:[s.directory||""," ",s.branch?`· ${s.branch}`:""]})]},s.id)})}),m&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Register a new worker to this team:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"rounded-md border border-border bg-surface-2 px-3 py-1.5 font-mono text-xs text-text-primary",children:["slz rc --team-id ",a]}),e.jsx("button",{type:"button",onClick:_,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy command",children:e.jsx(D,{className:"h-3.5 w-3.5"})}),d&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"})]})]}),j.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Link an existing personal environment:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:l,onChange:s=>u(s.target.value),className:"max-w-md rounded-md border border-border bg-surface-2 px-3 py-1.5 text-sm text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"",children:"Select environment..."}),j.map(s=>e.jsxs("option",{value:s.id,children:[s.machine_name||s.id," ",s.branch?`· ${s.branch}`:""]},s.id))]}),e.jsx("button",{type:"button",onClick:L,disabled:!l,className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:"Link"})]})]}),f&&e.jsx("p",{className:"text-sm text-destructive",children:f})]})]})}async function de(a){try{const m=a.startsWith("team_")?`/web/teams/${a}`:`/web/teams/by-slug/${a}`;return await T("GET",m)}catch{return null}}const me={owner:"team.member.roleOwner",admin:"team.member.roleAdmin",member:"team.member.roleMember"},U={owner:"border-brand/30 bg-brand/10 text-brand",admin:"border-accent/30 bg-accent/10 text-accent",member:"border-border/60 bg-surface-2 text-text-muted"};function F(a){return i(me[a]||"team.member.roleMember")}function je(){P();const a=window.location.pathname.split("/"),m=a[a.length-1]||"",[r,N]=n.useState(null),[v,c]=n.useState(!0),[h,x]=n.useState(!1),{members:l,isLoading:u,updateRole:f,removeMember:E}=O((r==null?void 0:r.id)||null),{user:d}=K(),[g,y]=n.useState("");if(n.useEffect(()=>{m&&(c(!0),de(m).then(t=>{N(t),c(!1)}))},[m]),v)return e.jsx("div",{className:"px-6 py-16 text-sm text-text-muted",children:"Loading..."});if(!r)return e.jsx("div",{className:"px-6 py-16 sm:px-10",children:e.jsxs("div",{className:"max-w-3xl",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})});const b=l.find(t=>t.user_id===(d==null?void 0:d.userId)),j=(d==null?void 0:d.role)==="admin"||(b==null?void 0:b.role)==="owner"||(b==null?void 0:b.role)==="admin",L=(d==null?void 0:d.role)==="admin"||(b==null?void 0:b.role)==="owner",$=async()=>{const t=r.id;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(t),x(!0),setTimeout(()=>x(!1),2e3);return}}catch{}const p=document.createElement("textarea");p.value=t,p.style.position="fixed",p.style.opacity="0",document.body.appendChild(p),p.select();try{document.execCommand("copy"),x(!0),setTimeout(()=>x(!1),2e3)}catch{}document.body.removeChild(p)},_=async(t,p)=>{if(t.role!==p){y("");try{await f(t.user_id,p)}catch(w){y(w instanceof Error?w.message:i("team.member.updateFailed"))}}},s=async t=>{const p=t.username||t.user_id;if(window.confirm(i("team.member.removeConfirm").replace("{name}",p))){y("");try{await E(t.user_id)}catch(S){y(S instanceof Error?S.message:i("team.member.updateFailed"))}}};return e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:r.name}),e.jsxs("p",{className:"mt-2 font-mono text-xs text-text-muted",children:["/",r.slug]}),r.description&&e.jsx("p",{className:"mt-5 max-w-2xl text-sm leading-relaxed text-text-muted",children:r.description}),e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:r.id}),e.jsx("button",{type:"button",onClick:$,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy team ID",children:e.jsx(D,{className:"h-3.5 w-3.5"})}),h&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"}),j&&e.jsx("a",{href:`/teams/${r.slug}/settings`,className:"ml-1 text-text-muted transition-colors hover:text-text-primary","aria-label":"Team settings",title:"Team settings",children:e.jsx(X,{className:"h-4 w-4"})})]})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("div",{className:"mb-6 flex items-baseline justify-between",children:e.jsxs("h2",{className:"text-sm font-medium text-text-primary",children:[i("team.detail.members")," (",l.length,")"]})}),g&&e.jsx("div",{className:"mb-4 rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:g}),u?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading members..."}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:"No members."}):e.jsx("ul",{className:"space-y-2",children:l.map(t=>{const p=t.user_id===(d==null?void 0:d.userId),w=t.role==="owner"||t.role==="admin",S=j&&(!w||L),R=S&&!(t.role==="owner"&&l.filter(o=>o.role==="owner").length<=1),A=["owner","admin","member"];return e.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-xl border border-border bg-surface-1 px-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.username||t.user_id}),p&&e.jsx("span",{className:"text-xs text-text-muted",children:i("team.member.you")}),e.jsx("span",{className:Y("shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-medium",U[t.role]||U.member),children:F(t.role)})]}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-text-muted",children:t.user_id})]}),j&&e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",disabled:!S,className:"shrink-0 rounded-md p-1.5 text-text-muted transition-colors hover:bg-surface-2 hover:text-text-primary disabled:opacity-40 disabled:hover:bg-transparent","aria-label":i("team.member.changeRole"),title:i("team.member.changeRole"),children:e.jsx(V,{className:"h-4 w-4"})})}),e.jsxs(Z,{align:"end",className:"w-48",children:[e.jsx(ee,{className:"text-xs text-text-muted",children:i("team.member.changeRole")}),A.map(o=>e.jsxs(M,{onSelect:()=>_(t,o),className:"flex items-center justify-between",children:[e.jsx("span",{children:F(o)}),t.role===o&&e.jsx(B,{className:"h-3.5 w-3.5 text-brand"})]},o)),e.jsx(te,{}),e.jsxs(M,{variant:"destructive",disabled:!R,onSelect:()=>s(t),className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:i("team.member.remove")})]})]})]})]},t.user_id)})})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:i("team.detail.environments")}),e.jsx(le,{teamId:r.id,canManage:j})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:i("team.detail.invitations")}),e.jsx(ce,{teamId:r.id,canManage:j})]})]})}export{je as TeamDetail};
6
+ */const re=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ie=H("user-plus",re);function O(a){const[m,r]=n.useState([]),[N,j]=n.useState(!1),c=n.useCallback(async()=>{if(a){j(!0);try{const u=await T("GET",`/web/teams/${a}/members`);r(u)}catch{r([])}finally{j(!1)}}},[a]);n.useEffect(()=>{c()},[c]);const h=n.useCallback(async(u,f)=>{await T("POST",`/web/teams/${a}/members`,{userId:u,role:f}),await c()},[a,c]),x=n.useCallback(async u=>{await T("DELETE",`/web/teams/${a}/members/${u}`),await c()},[a,c]),l=n.useCallback(async(u,f)=>{await T("PATCH",`/web/teams/${a}/members/${u}`,{role:f}),await c()},[a,c]);return{members:m,isLoading:N,addMember:h,removeMember:x,updateRole:l,refetch:c}}function oe(a){const[m,r]=n.useState([]),N=n.useCallback(async c=>{if(!a)return null;const h=await T("POST",`/web/teams/${a}/invitations`,c);return r(x=>[...x,h]),h},[a]),j=n.useCallback(async c=>{a&&(await T("DELETE",`/web/teams/${a}/invitations/${c}`),r(h=>h.filter(x=>x.token!==c)))},[a]);return{invitations:m,createInvitation:N,revokeInvitation:j}}function ce({teamId:a,canManage:m}){P();const{invitations:r,createInvitation:N,revokeInvitation:j}=oe(a),{addMember:c}=O(a),[h,x]=n.useState(!1),[l,u]=n.useState(null),[f,E]=n.useState("member"),[d,g]=n.useState(!1),[y,b]=n.useState("member"),[v,L]=n.useState(null),[$,_]=n.useState(!1),[s,t]=n.useState(!1),[p,w]=n.useState(!1),S=async()=>{x(!0);try{const o=await N({role:f,expiresIn:86400,maxUses:5});o&&u(o.token||o.inviteToken||null)}catch{}finally{x(!1)}},R=async()=>{if(!l)return;const o=`${window.location.origin}/join?invite=${l}`;let k=!1;try{navigator.clipboard&&window.isSecureContext&&(await navigator.clipboard.writeText(o),k=!0)}catch{}if(!k){const C=document.createElement("textarea");C.value=o,C.style.position="fixed",C.style.top="0",C.style.opacity="0",document.body.appendChild(C),C.focus(),C.select(),C.setSelectionRange(0,o.length);try{k=document.execCommand("copy")}catch{k=!1}document.body.removeChild(C)}k?(w(!1),t(!0),setTimeout(()=>t(!1),2e3)):(t(!1),w(!0),setTimeout(()=>w(!1),4e3))},A=async o=>{_(!0),L(null);try{await c(o,y),g(!1)}catch(k){L(k instanceof Error?k.message:"Failed to add user")}finally{_(!1)}};return e.jsxs("div",{className:"space-y-5",children:[m&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("select",{className:"rounded-md border border-border bg-surface-2 px-2.5 py-1.5 text-xs text-text-primary focus:border-accent focus:outline-none",value:f,onChange:o=>E(o.target.value),children:[e.jsx("option",{value:"member",children:i("invitation.member")}),e.jsx("option",{value:"admin",children:i("invitation.admin")})]}),e.jsx("button",{type:"button",onClick:S,disabled:h,className:"rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:opacity-50",children:h?i("invitation.creating"):i("invitation.create")}),e.jsxs("button",{type:"button",onClick:()=>g(!d),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-surface-2",title:i("invitation.addExistingHint"),children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),i("invitation.addExisting")]})]}),d&&m&&e.jsxs("div",{className:"space-y-3 rounded border border-border bg-surface-2 p-3",children:[e.jsx("p",{className:"text-xs text-text-muted",children:i("invitation.addExistingHint")}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("select",{className:"rounded border border-border bg-surface-1 px-2 py-1.5 text-sm",value:y,onChange:o=>b(o.target.value),children:[e.jsx("option",{value:"member",children:i("invitation.member")}),e.jsx("option",{value:"admin",children:i("invitation.admin")})]})}),v&&e.jsx("p",{className:"text-xs text-destructive",children:v}),e.jsx(ae,{onSelect:A,actionDisabled:$,placeholder:i("invitation.searchUser")})]}),l&&e.jsxs("div",{className:"space-y-1.5 rounded border border-accent/40 bg-accent/5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-xs text-text-primary break-all",children:`${window.location.origin}/join?invite=${l}`}),e.jsx("button",{type:"button",onClick:R,className:s?"text-status-active":"text-text-muted hover:text-text-primary",title:s?i("share.copied"):i("share.copy"),children:s?e.jsx(B,{className:"h-4 w-4"}):e.jsx(D,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:()=>u(null),className:"text-text-muted hover:text-text-primary",children:e.jsx(z,{className:"h-4 w-4"})})]}),s&&e.jsx("p",{className:"text-xs text-status-active",children:i("share.copied")}),p&&e.jsx("p",{className:"text-xs text-status-error",children:i("share.copyFailed")})]}),r.length>0&&e.jsx("ul",{className:"space-y-2",children:r.map(o=>e.jsxs("li",{className:"flex items-center justify-between rounded border border-border/60 bg-surface-2 p-2 text-sm",children:[e.jsxs("span",{className:"text-text-muted",children:[o.role," — expires ",new Date(o.expiresAt).toLocaleDateString()]}),m&&e.jsx("button",{type:"button",onClick:()=>j(o.token),className:"text-sm text-destructive hover:underline",children:i("invitation.revoke")})]},o.token))})]})}function le({teamId:a,canManage:m}){const[r,N]=n.useState([]),[j,c]=n.useState(!0),[h,x]=n.useState(null),[l,u]=n.useState(""),[f,E]=n.useState(null),[d,g]=n.useState(!1),y=async()=>{try{const s=await I();N(s||[])}catch(s){x(s instanceof Error?s.message:"Failed to load environments")}finally{c(!1)}};n.useEffect(()=>{y()},[]);const b=n.useMemo(()=>r.filter(s=>s.team_id===a),[r,a]),v=n.useMemo(()=>r.filter(s=>!s.team_id),[r]),L=async()=>{if(l){E(null);try{await W(l,a),u(""),await y()}catch(s){E(s instanceof Error?s.message:"Failed to link environment")}}},$=async s=>{if(window.confirm("Unlink this environment from the team? It will revert to personal scope.")){E(null);try{await q(a,s),await y()}catch(t){E(t instanceof Error?t.message:"Failed to unlink environment")}}},_=async()=>{const s=`slz rc --team-id ${a}`;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(s),g(!0),setTimeout(()=>g(!1),2e3);return}}catch{}const t=document.createElement("textarea");t.value=s,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),g(!0),setTimeout(()=>g(!1),2e3)}catch{}document.body.removeChild(t)};return j?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading environments..."}):h?e.jsx("p",{className:"text-sm text-destructive",children:h}):e.jsxs("div",{className:"space-y-8",children:[e.jsx("ul",{className:"space-y-3",children:b.length===0?e.jsx("li",{className:"text-sm text-text-muted",children:"No environments linked to this team yet."}):b.map(s=>{const t=ne(s.worker_type);return e.jsxs("li",{className:"text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:s.machine_name||s.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${t.colorClass}`,children:t.shortLabel}),e.jsx(G,{status:s.status}),m&&e.jsx("button",{type:"button",onClick:()=>$(s.id),className:"ml-2 text-xs text-text-muted underline-offset-2 transition-colors hover:text-destructive hover:underline",children:"Unlink"})]}),e.jsxs("div",{className:"mt-1 font-mono text-xs text-text-muted",children:[s.directory||""," ",s.branch?`· ${s.branch}`:""]})]},s.id)})}),m&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Register a new worker to this team:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"rounded-md border border-border bg-surface-2 px-3 py-1.5 font-mono text-xs text-text-primary",children:["slz rc --team-id ",a]}),e.jsx("button",{type:"button",onClick:_,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy command",children:e.jsx(D,{className:"h-3.5 w-3.5"})}),d&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"})]})]}),v.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-text-muted",children:"Link an existing personal environment:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:l,onChange:s=>u(s.target.value),className:"max-w-md rounded-md border border-border bg-surface-2 px-3 py-1.5 text-sm text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"",children:"Select environment..."}),v.map(s=>e.jsxs("option",{value:s.id,children:[s.machine_name||s.id," ",s.branch?`· ${s.branch}`:""]},s.id))]}),e.jsx("button",{type:"button",onClick:L,disabled:!l,className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:"Link"})]})]}),f&&e.jsx("p",{className:"text-sm text-destructive",children:f})]})]})}async function de(a){try{const m=a.startsWith("team_")?`/web/teams/${a}`:`/web/teams/by-slug/${a}`;return await T("GET",m)}catch{return null}}const me={owner:"team.member.roleOwner",admin:"team.member.roleAdmin",member:"team.member.roleMember"},U={owner:"border-brand/30 bg-brand/10 text-brand",admin:"border-accent/30 bg-accent/10 text-accent",member:"border-border/60 bg-surface-2 text-text-muted"};function F(a){return i(me[a]||"team.member.roleMember")}function ve(){P();const a=window.location.pathname.split("/"),m=a[a.length-1]||"",[r,N]=n.useState(null),[j,c]=n.useState(!0),[h,x]=n.useState(!1),{members:l,isLoading:u,updateRole:f,removeMember:E}=O((r==null?void 0:r.id)||null),{user:d}=Y(),[g,y]=n.useState("");if(n.useEffect(()=>{m&&(c(!0),de(m).then(t=>{N(t),c(!1)}))},[m]),j)return e.jsx("div",{className:"px-6 py-16 text-sm text-text-muted",children:"Loading..."});if(!r)return e.jsx("div",{className:"px-6 py-16 sm:px-10",children:e.jsxs("div",{className:"max-w-3xl",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})});const b=l.find(t=>t.user_id===(d==null?void 0:d.userId)),v=(d==null?void 0:d.role)==="admin"||(b==null?void 0:b.role)==="owner"||(b==null?void 0:b.role)==="admin",L=(d==null?void 0:d.role)==="admin"||(b==null?void 0:b.role)==="owner",$=async()=>{const t=r.id;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(t),x(!0),setTimeout(()=>x(!1),2e3);return}}catch{}const p=document.createElement("textarea");p.value=t,p.style.position="fixed",p.style.opacity="0",document.body.appendChild(p),p.select();try{document.execCommand("copy"),x(!0),setTimeout(()=>x(!1),2e3)}catch{}document.body.removeChild(p)},_=async(t,p)=>{if(t.role!==p){y("");try{await f(t.user_id,p)}catch(w){y(w instanceof Error?w.message:i("team.member.updateFailed"))}}},s=async t=>{const p=t.username||t.user_id;if(window.confirm(i("team.member.removeConfirm").replace("{name}",p))){y("");try{await E(t.user_id)}catch(S){y(S instanceof Error?S.message:i("team.member.updateFailed"))}}};return e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:r.name}),e.jsxs("p",{className:"mt-2 font-mono text-xs text-text-muted",children:["/",r.slug]}),r.description&&e.jsx("p",{className:"mt-5 max-w-2xl text-sm leading-relaxed text-text-muted",children:r.description}),e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:r.id}),e.jsx("button",{type:"button",onClick:$,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy team ID",children:e.jsx(D,{className:"h-3.5 w-3.5"})}),h&&e.jsx("span",{className:"text-xs text-status-active",children:"Copied"}),v&&e.jsx("a",{href:`/teams/${r.slug}/settings`,className:"ml-1 text-text-muted transition-colors hover:text-text-primary","aria-label":"Team settings",title:"Team settings",children:e.jsx(X,{className:"h-4 w-4"})})]})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("div",{className:"mb-6 flex items-baseline justify-between",children:e.jsxs("h2",{className:"text-sm font-medium text-text-primary",children:[i("team.detail.members")," (",l.length,")"]})}),g&&e.jsx("div",{className:"mb-4 rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:g}),u?e.jsx("p",{className:"text-sm text-text-muted",children:"Loading members..."}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:"No members."}):e.jsx("ul",{className:"space-y-2",children:l.map(t=>{const p=t.user_id===(d==null?void 0:d.userId),w=t.role==="owner"||t.role==="admin",S=v&&(!w||L),R=S&&!(t.role==="owner"&&l.filter(o=>o.role==="owner").length<=1),A=["owner","admin","member"];return e.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-xl border border-border bg-surface-1 px-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.username||t.user_id}),p&&e.jsx("span",{className:"text-xs text-text-muted",children:i("team.member.you")}),e.jsx("span",{className:J("shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-medium",U[t.role]||U.member),children:F(t.role)})]}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-text-muted",children:t.user_id})]}),v&&e.jsxs(K,{children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",disabled:!S,className:"shrink-0 rounded-md p-1.5 text-text-muted transition-colors hover:bg-surface-2 hover:text-text-primary disabled:opacity-40 disabled:hover:bg-transparent","aria-label":i("team.member.changeRole"),title:i("team.member.changeRole"),children:e.jsx(V,{className:"h-4 w-4"})})}),e.jsxs(Z,{align:"end",className:"w-48",children:[e.jsx(ee,{className:"text-xs text-text-muted",children:i("team.member.changeRole")}),A.map(o=>e.jsxs(M,{onSelect:()=>_(t,o),className:"flex items-center justify-between",children:[e.jsx("span",{children:F(o)}),t.role===o&&e.jsx(B,{className:"h-3.5 w-3.5 text-brand"})]},o)),e.jsx(te,{}),e.jsxs(M,{variant:"destructive",disabled:!R,onSelect:()=>s(t),className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:i("team.member.remove")})]})]})]})]},t.user_id)})})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:i("team.detail.environments")}),e.jsx(le,{teamId:r.id,canManage:v})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:i("team.detail.invitations")}),e.jsx(ce,{teamId:r.id,canManage:v})]})]})}export{ve as TeamDetail};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-DE_-CLIE.js";import{al as l,p as a}from"./main-N3GYCdLF.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function c(){const{myTeams:t,isLoading:i}=l();return i?e.jsx("div",{className:"px-6 py-20 sm:px-10",children:e.jsxs("div",{className:"max-w-4xl",children:[e.jsx("div",{className:"h-8 w-32 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"mt-12 space-y-10",children:[0,1,2].map(s=>e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-surface-2"})]},s))})]})}):e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary sm:text-4xl",children:"Teams"}),e.jsx("p",{className:"mt-3 text-sm text-text-muted",children:t.length===0?"Create your first team to start collaborating.":`${t.length} ${t.length===1?"team":"teams"}`})]}),t.length===0?e.jsx("div",{className:"py-8",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md bg-accent px-5 py-2.5 text-sm font-medium text-white transition-all hover:bg-accent/90 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"Create team"]})}):e.jsx("ul",{className:"space-y-10",children:t.map(s=>e.jsx("li",{children:e.jsxs("a",{href:`/teams/${s.slug}`,className:"group block",children:[e.jsxs("div",{className:"flex items-baseline gap-4",children:[e.jsx("h2",{className:"font-display text-xl font-medium tracking-tight text-text-primary transition-colors group-hover:text-accent",children:s.name}),e.jsxs("span",{className:"font-mono text-xs text-text-muted",children:["/",s.slug]})]}),s.description?e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-text-muted",children:s.description}):e.jsx("p",{className:"mt-2 text-sm italic text-text-muted/60",children:"No description"})]})},s.id))}),t.length>0&&e.jsx("div",{className:"mt-16",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md border border-border px-4 py-2 text-sm font-medium text-text-primary transition-all hover:bg-surface-2 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"New team"]})})]})}export{c as TeamList};
1
+ import{j as e}from"./vendor-DE_-CLIE.js";import{ar as l,p as a}from"./main-B8hkVvfg.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function c(){const{myTeams:t,isLoading:i}=l();return i?e.jsx("div",{className:"px-6 py-20 sm:px-10",children:e.jsxs("div",{className:"max-w-4xl",children:[e.jsx("div",{className:"h-8 w-32 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"mt-12 space-y-10",children:[0,1,2].map(s=>e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-surface-2"})]},s))})]})}):e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary sm:text-4xl",children:"Teams"}),e.jsx("p",{className:"mt-3 text-sm text-text-muted",children:t.length===0?"Create your first team to start collaborating.":`${t.length} ${t.length===1?"team":"teams"}`})]}),t.length===0?e.jsx("div",{className:"py-8",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md bg-accent px-5 py-2.5 text-sm font-medium text-white transition-all hover:bg-accent/90 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"Create team"]})}):e.jsx("ul",{className:"space-y-10",children:t.map(s=>e.jsx("li",{children:e.jsxs("a",{href:`/teams/${s.slug}`,className:"group block",children:[e.jsxs("div",{className:"flex items-baseline gap-4",children:[e.jsx("h2",{className:"font-display text-xl font-medium tracking-tight text-text-primary transition-colors group-hover:text-accent",children:s.name}),e.jsxs("span",{className:"font-mono text-xs text-text-muted",children:["/",s.slug]})]}),s.description?e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-text-muted",children:s.description}):e.jsx("p",{className:"mt-2 text-sm italic text-text-muted/60",children:"No description"})]})},s.id))}),t.length>0&&e.jsx("div",{className:"mt-16",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md border border-border px-4 py-2 text-sm font-medium text-text-primary transition-all hover:bg-surface-2 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"New team"]})})]})}export{c as TeamList};
@@ -1 +1 @@
1
- import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{B as c}from"./main-N3GYCdLF.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";async function j(s){try{const r=s.startsWith("team_")?`/web/teams/${s}`:`/web/teams/by-slug/${s}`;return await c("GET",r)}catch{return null}}async function w(s,r){await c("PATCH",`/web/teams/${s}`,r)}async function N(s){await c("DELETE",`/web/teams/${s}`)}function k(){const s=window.location.pathname.split("/"),r=s[s.length-2]||"",[a,h]=n.useState(null),[b,y]=n.useState(!0),[i,m]=n.useState(""),[l,d]=n.useState(""),[u,o]=n.useState(null),[x,p]=n.useState(!1);n.useEffect(()=>{r&&j(r).then(t=>{t&&(h(t),m(t.name),d(t.description||"")),y(!1)})},[r]);const g=async t=>{if(t.preventDefault(),!!a){o(null),p(!0);try{await w(a.id,{name:i,description:l}),window.location.href=`/teams/${a.slug}`}catch(f){o(f instanceof Error?f.message:"Failed to update")}finally{p(!1)}}},v=async()=>{if(a&&window.confirm("Delete this team? Environments must be transferred first."))try{await N(a.id),window.location.href="/teams"}catch(t){o(t instanceof Error?t.message:"Failed to delete")}};return b?e.jsx("div",{className:"flex items-center justify-center py-12 text-text-muted",children:"Loading..."}):a?e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsxs("header",{className:"mb-12",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:a.name}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:["/",a.slug]})]}),e.jsxs("form",{onSubmit:g,className:"mb-16 max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:"Team Name"}),e.jsx("input",{id:"name",type:"text",required:!0,value:i,onChange:t=>m(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:"Description"}),e.jsx("textarea",{id:"description",value:l,onChange:t=>d(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),u&&e.jsx("p",{className:"text-sm text-destructive",children:u}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:x||!i,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:x?"Saving...":"Save Changes"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-sm font-medium text-destructive",children:"Delete team"}),e.jsx("p",{className:"mb-4 text-sm text-text-muted",children:"Deleting a team requires all environments to be transferred first."}),e.jsx("button",{type:"button",onClick:v,className:"rounded-md border border-destructive/60 px-4 py-2 text-sm font-medium text-destructive hover:bg-destructive/10 transition-colors",children:"Delete Team"})]})]})}):e.jsxs("div",{className:"mx-auto max-w-lg px-4 py-8",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})}export{k as TeamSettings};
1
+ import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{B as c}from"./main-B8hkVvfg.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";async function j(s){try{const r=s.startsWith("team_")?`/web/teams/${s}`:`/web/teams/by-slug/${s}`;return await c("GET",r)}catch{return null}}async function w(s,r){await c("PATCH",`/web/teams/${s}`,r)}async function N(s){await c("DELETE",`/web/teams/${s}`)}function k(){const s=window.location.pathname.split("/"),r=s[s.length-2]||"",[a,h]=n.useState(null),[b,y]=n.useState(!0),[i,m]=n.useState(""),[l,d]=n.useState(""),[u,o]=n.useState(null),[x,p]=n.useState(!1);n.useEffect(()=>{r&&j(r).then(t=>{t&&(h(t),m(t.name),d(t.description||"")),y(!1)})},[r]);const g=async t=>{if(t.preventDefault(),!!a){o(null),p(!0);try{await w(a.id,{name:i,description:l}),window.location.href=`/teams/${a.slug}`}catch(f){o(f instanceof Error?f.message:"Failed to update")}finally{p(!1)}}},v=async()=>{if(a&&window.confirm("Delete this team? Environments must be transferred first."))try{await N(a.id),window.location.href="/teams"}catch(t){o(t instanceof Error?t.message:"Failed to delete")}};return b?e.jsx("div",{className:"flex items-center justify-center py-12 text-text-muted",children:"Loading..."}):a?e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsxs("header",{className:"mb-12",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:a.name}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:["/",a.slug]})]}),e.jsxs("form",{onSubmit:g,className:"mb-16 max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:"Team Name"}),e.jsx("input",{id:"name",type:"text",required:!0,value:i,onChange:t=>m(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:"Description"}),e.jsx("textarea",{id:"description",value:l,onChange:t=>d(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),u&&e.jsx("p",{className:"text-sm text-destructive",children:u}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:x||!i,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:x?"Saving...":"Save Changes"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-sm font-medium text-destructive",children:"Delete team"}),e.jsx("p",{className:"mb-4 text-sm text-text-muted",children:"Deleting a team requires all environments to be transferred first."}),e.jsx("button",{type:"button",onClick:v,className:"rounded-md border border-destructive/60 px-4 py-2 text-sm font-medium text-destructive hover:bg-destructive/10 transition-colors",children:"Delete Team"})]})]})}):e.jsxs("div",{className:"mx-auto max-w-lg px-4 py-8",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})}export{k as TeamSettings};
@@ -1 +1 @@
1
- import{e as a,j as t}from"./vendor-DE_-CLIE.js";import{ak as v,af as l,B as S}from"./main-N3GYCdLF.js";function C({onSelect:o,excludeUserIds:x=[],placeholder:u,actionLabel:m,actionDisabled:h=!1,className:p}){v();const[n,c]=a.useState(""),[f,s]=a.useState([]),[i,d]=a.useState(!1),b=async e=>{if(c(e),e.trim().length<2){s([]);return}d(!0);try{const N=await S("GET",`/web/users/search?q=${encodeURIComponent(e.trim())}`);s(N)}catch{s([])}finally{d(!1)}},y=e=>{o(e),c(""),s([])},r=f.filter(e=>!x.includes(e.id)),g=m??l("invitation.add"),j=u??l("invitation.searchUser");return t.jsxs("div",{className:p,children:[t.jsx("input",{type:"text",value:n,onChange:e=>b(e.target.value),placeholder:j,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&&t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:"Searching..."}),r.length>0&&t.jsx("ul",{className:"mt-2 divide-y divide-border rounded border border-border bg-surface-1",children:r.map(e=>t.jsxs("li",{className:"flex items-center justify-between px-3 py-2 text-sm",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-text-primary",children:e.username}),t.jsx("div",{className:"truncate font-mono text-xs text-text-muted",children:e.id})]}),t.jsx("button",{type:"button",onClick:()=>y(e.id),disabled:h,className:"rounded bg-accent px-2 py-1 text-xs text-white hover:bg-accent/90 disabled:opacity-50",children:g})]},e.id))}),n.trim().length>=2&&r.length===0&&!i&&t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:"No users found."})]})}export{C as U};
1
+ import{e as a,j as t}from"./vendor-DE_-CLIE.js";import{aq as v,al as l,B as S}from"./main-B8hkVvfg.js";function q({onSelect:o,excludeUserIds:x=[],placeholder:u,actionLabel:m,actionDisabled:h=!1,className:p}){v();const[n,c]=a.useState(""),[b,s]=a.useState([]),[i,d]=a.useState(!1),f=async e=>{if(c(e),e.trim().length<2){s([]);return}d(!0);try{const N=await S("GET",`/web/users/search?q=${encodeURIComponent(e.trim())}`);s(N)}catch{s([])}finally{d(!1)}},y=e=>{o(e),c(""),s([])},r=b.filter(e=>!x.includes(e.id)),g=m??l("invitation.add"),j=u??l("invitation.searchUser");return t.jsxs("div",{className:p,children:[t.jsx("input",{type:"text",value:n,onChange:e=>f(e.target.value),placeholder:j,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&&t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:"Searching..."}),r.length>0&&t.jsx("ul",{className:"mt-2 divide-y divide-border rounded border border-border bg-surface-1",children:r.map(e=>t.jsxs("li",{className:"flex items-center justify-between px-3 py-2 text-sm",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-text-primary",children:e.username}),t.jsx("div",{className:"truncate font-mono text-xs text-text-muted",children:e.id})]}),t.jsx("button",{type:"button",onClick:()=>y(e.id),disabled:h,className:"rounded bg-accent px-2 py-1 text-xs text-white hover:bg-accent/90 disabled:opacity-50",children:g})]},e.id))}),n.trim().length>=2&&r.length===0&&!i&&t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:"No users found."})]})}export{q as U};
@@ -1 +1 @@
1
- import{e as o,j as e}from"./vendor-DE_-CLIE.js";import{aj as C,ak as P,af as t,ae as S}from"./main-N3GYCdLF.js";import{C as k}from"./copy-9pzb1Po6.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function L(){const{user:n,logout:f}=C(),w=P(),[l,u]=o.useState(""),[c,m]=o.useState(""),[x,p]=o.useState(""),[h,b]=o.useState(""),[g,a]=o.useState(""),[y,d]=o.useState(!1);if(!n)return null;const j=async()=>{const s=n.userId;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3);return}}catch{}const r=document.createElement("textarea");r.value=s,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();try{document.execCommand("copy"),d(!0),setTimeout(()=>d(!1),2e3)}catch{}document.body.removeChild(r)},N=async s=>{if(s.preventDefault(),a(""),b(""),c.length<8){a(t("auth.setup.passwordTooShort"));return}if(c!==x){a(t("auth.setup.passwordMismatch"));return}try{const r=await fetch("/web/auth/change-password",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({currentPassword:l,newPassword:c})});if(!r.ok){const i=await r.json();throw new Error(i.error||t("user.settings.changeFailed"))}b(t("user.settings.passwordChanged")),u(""),m(""),p("")}catch(r){const i=r instanceof Error?r.message:t("user.settings.changeFailed");a(i)}},v=async()=>{try{if(!(await fetch("/web/auth/logout-all",{method:"POST",credentials:"include",headers:{"X-Requested-With":"XMLHttpRequest"}})).ok){a(t("common.error"));return}await f()}catch{a(t("common.error"))}};return e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsxs("div",{children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:n.username}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:n.userId}),e.jsx("button",{type:"button",onClick:j,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy user ID",children:e.jsx(k,{className:"h-3.5 w-3.5"})}),y&&e.jsx("span",{className:"text-xs text-status-active",children:t("share.copied")}),e.jsx("span",{className:"text-text-muted/40",children:"·"}),e.jsx("span",{className:"text-xs text-text-muted",children:n.role})]})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-5 text-sm font-medium text-text-primary",children:t("user.settings.language")}),e.jsxs("select",{value:w,onChange:s=>S(s.target.value),className:"rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"zh",children:"中文"}),e.jsx("option",{value:"en",children:"English"})]})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-5 text-sm font-medium text-text-primary",children:t("user.settings.changePassword")}),e.jsxs("form",{onSubmit:N,className:"max-w-md space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:t("user.settings.currentPassword")}),e.jsx("input",{type:"password",value:l,onChange:s=>u(s.target.value),required:!0,autoComplete:"current-password",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:t("user.settings.newPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>m(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:t("user.settings.confirmNewPassword")}),e.jsx("input",{type:"password",value:x,onChange:s=>p(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"})]}),g&&e.jsx("p",{className:"text-sm text-status-error",children:g}),h&&e.jsx("p",{className:"text-sm text-status-active",children:h}),e.jsx("div",{className:"pt-2",children:e.jsx("button",{type:"submit",className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-accent/90",children:t("user.settings.submit")})})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-5 text-sm font-medium text-destructive",children:t("user.settings.logoutAll")}),e.jsx("p",{className:"mb-4 text-sm text-text-muted",children:"Revoke sessions on all devices."}),e.jsx("button",{onClick:v,className:"rounded-md border border-status-error/30 px-4 py-2 text-sm font-medium text-status-error transition-colors hover:bg-status-error/10",children:t("user.settings.logoutAll")})]})]})})}export{L as UserSettings};
1
+ import{e as o,j as e}from"./vendor-DE_-CLIE.js";import{ap as C,aq as P,al as t,ak as S}from"./main-B8hkVvfg.js";import{C as k}from"./copy-BD6qrRfd.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function L(){const{user:n,logout:f}=C(),w=P(),[l,u]=o.useState(""),[c,m]=o.useState(""),[x,p]=o.useState(""),[h,b]=o.useState(""),[g,a]=o.useState(""),[y,d]=o.useState(!1);if(!n)return null;const j=async()=>{const s=n.userId;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3);return}}catch{}const r=document.createElement("textarea");r.value=s,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();try{document.execCommand("copy"),d(!0),setTimeout(()=>d(!1),2e3)}catch{}document.body.removeChild(r)},N=async s=>{if(s.preventDefault(),a(""),b(""),c.length<8){a(t("auth.setup.passwordTooShort"));return}if(c!==x){a(t("auth.setup.passwordMismatch"));return}try{const r=await fetch("/web/auth/change-password",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({currentPassword:l,newPassword:c})});if(!r.ok){const i=await r.json();throw new Error(i.error||t("user.settings.changeFailed"))}b(t("user.settings.passwordChanged")),u(""),m(""),p("")}catch(r){const i=r instanceof Error?r.message:t("user.settings.changeFailed");a(i)}},v=async()=>{try{if(!(await fetch("/web/auth/logout-all",{method:"POST",credentials:"include",headers:{"X-Requested-With":"XMLHttpRequest"}})).ok){a(t("common.error"));return}await f()}catch{a(t("common.error"))}};return e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsxs("div",{children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:n.username}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:n.userId}),e.jsx("button",{type:"button",onClick:j,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":"Copy user ID",children:e.jsx(k,{className:"h-3.5 w-3.5"})}),y&&e.jsx("span",{className:"text-xs text-status-active",children:t("share.copied")}),e.jsx("span",{className:"text-text-muted/40",children:"·"}),e.jsx("span",{className:"text-xs text-text-muted",children:n.role})]})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-5 text-sm font-medium text-text-primary",children:t("user.settings.language")}),e.jsxs("select",{value:w,onChange:s=>S(s.target.value),className:"rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"zh",children:"中文"}),e.jsx("option",{value:"en",children:"English"})]})]}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-5 text-sm font-medium text-text-primary",children:t("user.settings.changePassword")}),e.jsxs("form",{onSubmit:N,className:"max-w-md space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:t("user.settings.currentPassword")}),e.jsx("input",{type:"password",value:l,onChange:s=>u(s.target.value),required:!0,autoComplete:"current-password",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:t("user.settings.newPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>m(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:t("user.settings.confirmNewPassword")}),e.jsx("input",{type:"password",value:x,onChange:s=>p(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none"})]}),g&&e.jsx("p",{className:"text-sm text-status-error",children:g}),h&&e.jsx("p",{className:"text-sm text-status-active",children:h}),e.jsx("div",{className:"pt-2",children:e.jsx("button",{type:"submit",className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-accent/90",children:t("user.settings.submit")})})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-5 text-sm font-medium text-destructive",children:t("user.settings.logoutAll")}),e.jsx("p",{className:"mb-4 text-sm text-text-muted",children:"Revoke sessions on all devices."}),e.jsx("button",{onClick:v,className:"rounded-md border border-status-error/30 px-4 py-2 text-sm font-medium text-status-error transition-colors hover:bg-status-error/10",children:t("user.settings.logoutAll")})]})]})})}export{L as UserSettings};
@@ -1 +1 @@
1
- import{bl as ln,aO as an,H as z,b8 as w,F as G,ah as un,W as y,bd as tn,b9 as J,aI as _,c as rn,m as o,aG as on,j as sn,d as fn}from"./mermaid.core-CEJOtCGw.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,j,I,v,A,H,a){var q=j-l,i=I-h,n=H-v,d=a-A,u=d*q-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*q,h+u*i]}function U(l,h,j,I,v,A,H){var a=l-j,q=h-I,i=(H?A:-A)/J(a*a+q*q),n=i*q,d=-i*a,u=l+n,s=h+d,f=j+n,c=I+d,S=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,D=(g<0?-1:1)*J(on(0,T*T*R-P*P)),E=(P*g-m*D)/R,F=(-P*m-g*D)/R,b=(P*g+m*D)/R,p=(-P*m+g*D)/R,x=E-S,e=F-t,r=b-S,W=p-t;return x*x+e*e>r*r+W*W&&(E=b,F=p),{cx:E,cy:F,x01:-n,y01:-d,x11:E*(v/T-1),y11:F*(v/T-1)}}function hn(){var l=cn,h=yn,j=G(0),I=null,v=gn,A=dn,H=mn,a=null,q=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,S=rn(c-f),t=c>f;if(a||(a=n=q()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(S>tn-y)a.moveTo(s*z(f),s*w(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*z(c),u*w(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=S,D=S,E=H.apply(this,arguments)/2,F=E>y&&(I?+I.apply(this,arguments):J(u*u+s*s)),b=_(rn(s-u)/2,+j.apply(this,arguments)),p=b,x=b,e,r;if(F>y){var W=sn(F/u*w(E)),K=sn(F/s*w(E));(P-=W*2)>y?(W*=t?1:-1,R+=W,T-=W):(P=0,R=T=(f+c)/2),(D-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(D=0,m=g=(f+c)/2)}var B=s*z(m),C=s*w(m),L=u*z(T),M=u*w(T);if(b>y){var N=s*z(g),Q=s*w(g),V=u*z(R),X=u*w(R),O;if(S<an)if(O=pn(B,C,V,X,N,Q,L,M)){var Y=B-O[0],Z=C-O[1],$=N-O[0],k=Q-O[1],nn=1/w(fn((Y*$+Z*k)/(J(Y*Y+Z*Z)*J($*$+k*k)))/2),en=J(O[0]*O[0]+O[1]*O[1]);p=_(b,(u-en)/(nn-1)),x=_(b,(s-en)/(nn+1))}else p=x=0}D>y?x>y?(e=U(V,X,B,C,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<b?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(B,C),a.arc(0,0,s,m,g,!t)):a.moveTo(B,C),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(B,C,V,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<b?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[z(d)*n,w(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:G(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:G(+n),i):h},i.cornerRadius=function(n){return arguments.length?(j=typeof n=="function"?n:G(+n),i):j},i.padRadius=function(n){return arguments.length?(I=n==null?null:typeof n=="function"?n:G(+n),i):I},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:G(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:G(+n),i):A},i.padAngle=function(n){return arguments.length?(H=typeof n=="function"?n:G(+n),i):H},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{bl as ln,aO as an,H as z,b8 as w,F as G,ah as un,W as y,bd as tn,b9 as J,aI as _,c as rn,m as o,aG as on,j as sn,d as fn}from"./mermaid.core-CtvzCSq2.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,j,I,v,A,H,a){var q=j-l,i=I-h,n=H-v,d=a-A,u=d*q-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*q,h+u*i]}function U(l,h,j,I,v,A,H){var a=l-j,q=h-I,i=(H?A:-A)/J(a*a+q*q),n=i*q,d=-i*a,u=l+n,s=h+d,f=j+n,c=I+d,S=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,D=(g<0?-1:1)*J(on(0,T*T*R-P*P)),E=(P*g-m*D)/R,F=(-P*m-g*D)/R,b=(P*g+m*D)/R,p=(-P*m+g*D)/R,x=E-S,e=F-t,r=b-S,W=p-t;return x*x+e*e>r*r+W*W&&(E=b,F=p),{cx:E,cy:F,x01:-n,y01:-d,x11:E*(v/T-1),y11:F*(v/T-1)}}function hn(){var l=cn,h=yn,j=G(0),I=null,v=gn,A=dn,H=mn,a=null,q=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,S=rn(c-f),t=c>f;if(a||(a=n=q()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(S>tn-y)a.moveTo(s*z(f),s*w(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*z(c),u*w(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=S,D=S,E=H.apply(this,arguments)/2,F=E>y&&(I?+I.apply(this,arguments):J(u*u+s*s)),b=_(rn(s-u)/2,+j.apply(this,arguments)),p=b,x=b,e,r;if(F>y){var W=sn(F/u*w(E)),K=sn(F/s*w(E));(P-=W*2)>y?(W*=t?1:-1,R+=W,T-=W):(P=0,R=T=(f+c)/2),(D-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(D=0,m=g=(f+c)/2)}var B=s*z(m),C=s*w(m),L=u*z(T),M=u*w(T);if(b>y){var N=s*z(g),Q=s*w(g),V=u*z(R),X=u*w(R),O;if(S<an)if(O=pn(B,C,V,X,N,Q,L,M)){var Y=B-O[0],Z=C-O[1],$=N-O[0],k=Q-O[1],nn=1/w(fn((Y*$+Z*k)/(J(Y*Y+Z*Z)*J($*$+k*k)))/2),en=J(O[0]*O[0]+O[1]*O[1]);p=_(b,(u-en)/(nn-1)),x=_(b,(s-en)/(nn+1))}else p=x=0}D>y?x>y?(e=U(V,X,B,C,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<b?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(B,C),a.arc(0,0,s,m,g,!t)):a.moveTo(B,C),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(B,C,V,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<b?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[z(d)*n,w(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:G(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:G(+n),i):h},i.cornerRadius=function(n){return arguments.length?(j=typeof n=="function"?n:G(+n),i):j},i.padRadius=function(n){return arguments.length?(I=n==null?null:typeof n=="function"?n:G(+n),i):I},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:G(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:G(+n),i):A},i.padAngle=function(n){return arguments.length?(H=typeof n=="function"?n:G(+n),i):H},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};