@saluzi/saluzi-edu 0.2.20 → 0.2.21

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 (185) hide show
  1. package/dist/cli.js +106 -83
  2. package/dist/rcs-web/assets/AdminPanel-B0hhIa7W.js +1 -0
  3. package/dist/rcs-web/assets/Claim-BTx12YJw.js +1 -0
  4. package/dist/rcs-web/assets/Dashboard-C_qeuXGp.js +1 -0
  5. package/dist/rcs-web/assets/Join-DDMaEXX-.js +1 -0
  6. package/dist/rcs-web/assets/Login-eCEGVdjw.js +1 -0
  7. package/dist/rcs-web/assets/Register-gqlt4O0J.js +1 -0
  8. package/dist/rcs-web/assets/{SessionDetail-B5C0o1YT.js → SessionDetail-BfrG6lOA.js} +10 -10
  9. package/dist/rcs-web/assets/SessionVisibilityBadge-CN3bz2gb.js +11 -0
  10. package/dist/rcs-web/assets/Setup-yO-c5mfy.js +1 -0
  11. package/dist/rcs-web/assets/{ShareLanding-DBC9gbJo.js → ShareLanding-S3XUdrDL.js} +1 -1
  12. package/dist/rcs-web/assets/TeamCreate-DGUK4ghi.js +1 -0
  13. package/dist/rcs-web/assets/TeamDetail-Ct07DirR.js +6 -0
  14. package/dist/rcs-web/assets/TeamList-CJTYa2Ah.js +1 -0
  15. package/dist/rcs-web/assets/TeamSettings-DXb0w8GG.js +1 -0
  16. package/dist/rcs-web/assets/UserSettings-DzreS8Mi.js +1 -0
  17. package/dist/rcs-web/assets/{arc-DBPKxYzS.js → arc-wiB_u0W8.js} +1 -1
  18. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-D88rj_js.js → architectureDiagram-3BPJPVTR-70tgIgZq.js} +1 -1
  19. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-xzgUpRMn.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-Drz4LSdp.js} +1 -1
  20. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-vpg_EoPb.js → c4Diagram-AAUBKEIU-BM7C7SEx.js} +1 -1
  21. package/dist/rcs-web/assets/channel-D-a_TNjA.js +1 -0
  22. package/dist/rcs-web/assets/{chunk-2J33WTMH-DXWsXvhS.js → chunk-2J33WTMH-BSqxyVTy.js} +1 -1
  23. package/dist/rcs-web/assets/{chunk-4BX2VUAB-BtTxwj9K.js → chunk-4BX2VUAB-HFKHN20V.js} +1 -1
  24. package/dist/rcs-web/assets/{chunk-55IACEB6-D2-Q95qg.js → chunk-55IACEB6-DOBdvIv4.js} +1 -1
  25. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-Ce3e5x8u.js → dist/rcs-web/assets/chunk-727SXJPM-B2qn-WmZ.js} +1 -1
  26. package/dist/rcs-web/assets/{chunk-AQP2D5EJ-C0UbKVtd.js → chunk-AQP2D5EJ-DFC3ivzL.js} +1 -1
  27. package/dist/rcs-web/assets/{chunk-FMBD7UC4-BCwppVqh.js → chunk-FMBD7UC4-CkVr3MVW.js} +1 -1
  28. package/dist/rcs-web/assets/{chunk-ND2GUHAM-CnOBwWrm.js → chunk-ND2GUHAM-B2WO2xxD.js} +1 -1
  29. package/dist/rcs-web/assets/{chunk-QZHKN3VN-CDdzB71P.js → chunk-QZHKN3VN-YpZyVA2c.js} +1 -1
  30. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-Dl3V5TVw.js +1 -0
  31. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-Dl3V5TVw.js +1 -0
  32. package/dist/rcs-web/assets/{code-block-IT6T5CEO-C1_H_ztH.js → code-block-IT6T5CEO-Bmds1dKk.js} +1 -1
  33. package/dist/rcs-web/assets/{copy-DXU1lQqc.js → copy-DdSkINCW.js} +1 -1
  34. package/dist/rcs-web/assets/{cose-bilkent-S5V4N54A-BC6nfjTF.js → cose-bilkent-S5V4N54A-CTtGg7Fx.js} +1 -1
  35. package/dist/rcs-web/assets/{dagre-BM42HDAG-CEPR_pRx.js → dagre-BM42HDAG-CFX48pZZ.js} +1 -1
  36. package/dist/rcs-web/assets/{diagram-2AECGRRQ-fVMGnSYa.js → diagram-2AECGRRQ-BwZE2jAF.js} +1 -1
  37. package/dist/rcs-web/assets/{diagram-5GNKFQAL-BPzN2rbK.js → diagram-5GNKFQAL-BuHnggju.js} +1 -1
  38. package/dist/rcs-web/assets/{diagram-KO2AKTUF-Boneg9n-.js → diagram-KO2AKTUF-Dmd3MO7f.js} +1 -1
  39. package/{packages/remote-control-server/web/dist/assets/diagram-LMA3HP47-B8AtvjO9.js → dist/rcs-web/assets/diagram-LMA3HP47-34ZNfvQd.js} +1 -1
  40. package/dist/rcs-web/assets/{diagram-OG6HWLK6-DjY7A8jK.js → diagram-OG6HWLK6-CjZvlFxO.js} +1 -1
  41. package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-C1BEfKxk.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-BWR0WD_N.js} +1 -1
  42. package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-7TbI9MLV.js → flowDiagram-I6XJVG4X-DjZ7uFyw.js} +1 -1
  43. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CMAV0A01.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-BuAM7awZ.js} +1 -1
  44. package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-DAlR8G81.js → gitGraphDiagram-PVQCEYII-B_6bqpod.js} +1 -1
  45. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-0T0DAV4W.js → infoDiagram-5YYISTIA-BbhCTAn2.js} +1 -1
  46. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-BAw8txlx.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-1VPCYnPS.js} +1 -1
  47. package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-DWvYKwz-.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-Dzl0f8Im.js} +1 -1
  48. package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-Qzqw1H5B.js → kanban-definition-UN3LZRKU-BGoVgBze.js} +1 -1
  49. package/{packages/remote-control-server/web/dist/assets/linear-D2KIJoCI.js → dist/rcs-web/assets/linear-DF7ChHtW.js} +1 -1
  50. package/dist/rcs-web/assets/main-B_OE0doJ.css +1 -0
  51. package/dist/rcs-web/assets/main-CEsvX5rj.js +253 -0
  52. package/dist/rcs-web/assets/{mermaid-VLURNSYL-CxWk1wHz.js → mermaid-VLURNSYL-3EqupjjN.js} +4 -4
  53. package/dist/rcs-web/assets/{mermaid.core-C48YvKu4.js → mermaid.core-BnVRH5R_.js} +5 -5
  54. package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-BfmcTuCA.js → mindmap-definition-RKZ34NQL-R3usKqMg.js} +1 -1
  55. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-DVNZpnfb.js → pieDiagram-4H26LBE5-U1XXn3t9.js} +1 -1
  56. package/{packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-COL55Z3i.js → dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-CocIpolQ.js} +1 -1
  57. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-CFczYQ0a.js → requirementDiagram-4Y6WPE33-DX7pHOr5.js} +1 -1
  58. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-BrQEv3WQ.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-TD6XCrii.js} +1 -1
  59. package/{packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-CMxtYmQu.js → dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-EyZvfcbT.js} +1 -1
  60. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-Dw9xJZ-A.js → stateDiagram-AJRCARHV-B_SU6QSv.js} +1 -1
  61. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-Br0D-weX.js → stateDiagram-v2-BHNVJYJU-C8vEqOLP.js} +1 -1
  62. package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-DuWDwYBt.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-C2XHcj96.js} +1 -1
  63. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN--7IV65HQ.js → vennDiagram-CIIHVFJN-aAmhPOm3.js} +1 -1
  64. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-CVTgWbvT.js → wardleyDiagram-YWT4CUSO-Db_mMfd6.js} +1 -1
  65. package/dist/rcs-web/assets/workerType-Bd-zteMi.js +1 -0
  66. package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-B9om4xAF.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-DPjdOqDe.js} +1 -1
  67. package/dist/rcs-web/index.html +2 -2
  68. package/package.json +1 -1
  69. package/packages/remote-control-server/src/__tests__/bind-replacement.test.ts +5 -5
  70. package/packages/remote-control-server/src/__tests__/phase4-integration.test.ts +2 -2
  71. package/packages/remote-control-server/src/__tests__/route-mounting.test.ts +2 -2
  72. package/packages/remote-control-server/src/__tests__/routes.test.ts +21 -5
  73. package/packages/remote-control-server/src/__tests__/shares.test.ts +21 -20
  74. package/packages/remote-control-server/src/__tests__/teams.test.ts +119 -0
  75. package/packages/remote-control-server/src/config.ts +3 -0
  76. package/packages/remote-control-server/src/db/schema.sql +6 -1
  77. package/packages/remote-control-server/src/db/sqlite.ts +46 -1
  78. package/packages/remote-control-server/src/registerRoutes.ts +17 -1
  79. package/packages/remote-control-server/src/routes/v1/environments.ts +35 -1
  80. package/packages/remote-control-server/src/routes/v1/sessions.ts +48 -2
  81. package/packages/remote-control-server/src/routes/web/auth-routes.ts +64 -0
  82. package/packages/remote-control-server/src/routes/web/environments.ts +7 -3
  83. package/packages/remote-control-server/src/routes/web/shares.ts +17 -26
  84. package/packages/remote-control-server/src/routes/web/teams.ts +241 -4
  85. package/packages/remote-control-server/src/services/environment.ts +12 -1
  86. package/packages/remote-control-server/src/store.ts +87 -4
  87. package/packages/remote-control-server/src/types/api.ts +1 -0
  88. package/packages/remote-control-server/web/dist/assets/AdminPanel-B0hhIa7W.js +1 -0
  89. package/packages/remote-control-server/web/dist/assets/Claim-BTx12YJw.js +1 -0
  90. package/packages/remote-control-server/web/dist/assets/Dashboard-C_qeuXGp.js +1 -0
  91. package/packages/remote-control-server/web/dist/assets/Join-DDMaEXX-.js +1 -0
  92. package/packages/remote-control-server/web/dist/assets/Login-eCEGVdjw.js +1 -0
  93. package/packages/remote-control-server/web/dist/assets/Register-gqlt4O0J.js +1 -0
  94. package/packages/remote-control-server/web/dist/assets/{SessionDetail-B5C0o1YT.js → SessionDetail-BfrG6lOA.js} +10 -10
  95. package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-CN3bz2gb.js +11 -0
  96. package/packages/remote-control-server/web/dist/assets/Setup-yO-c5mfy.js +1 -0
  97. package/packages/remote-control-server/web/dist/assets/{ShareLanding-DBC9gbJo.js → ShareLanding-S3XUdrDL.js} +1 -1
  98. package/packages/remote-control-server/web/dist/assets/TeamCreate-DGUK4ghi.js +1 -0
  99. package/packages/remote-control-server/web/dist/assets/TeamDetail-Ct07DirR.js +6 -0
  100. package/packages/remote-control-server/web/dist/assets/TeamList-CJTYa2Ah.js +1 -0
  101. package/packages/remote-control-server/web/dist/assets/TeamSettings-DXb0w8GG.js +1 -0
  102. package/packages/remote-control-server/web/dist/assets/UserSettings-DzreS8Mi.js +1 -0
  103. package/packages/remote-control-server/web/dist/assets/{arc-DBPKxYzS.js → arc-wiB_u0W8.js} +1 -1
  104. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-D88rj_js.js → architectureDiagram-3BPJPVTR-70tgIgZq.js} +1 -1
  105. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-xzgUpRMn.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-Drz4LSdp.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-vpg_EoPb.js → c4Diagram-AAUBKEIU-BM7C7SEx.js} +1 -1
  107. package/packages/remote-control-server/web/dist/assets/channel-D-a_TNjA.js +1 -0
  108. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-DXWsXvhS.js → chunk-2J33WTMH-BSqxyVTy.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-BtTxwj9K.js → chunk-4BX2VUAB-HFKHN20V.js} +1 -1
  110. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-D2-Q95qg.js → chunk-55IACEB6-DOBdvIv4.js} +1 -1
  111. package/{dist/rcs-web/assets/chunk-727SXJPM-Ce3e5x8u.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-B2qn-WmZ.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-C0UbKVtd.js → chunk-AQP2D5EJ-DFC3ivzL.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-BCwppVqh.js → chunk-FMBD7UC4-CkVr3MVW.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-CnOBwWrm.js → chunk-ND2GUHAM-B2WO2xxD.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-CDdzB71P.js → chunk-QZHKN3VN-YpZyVA2c.js} +1 -1
  116. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-Dl3V5TVw.js +1 -0
  117. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-Dl3V5TVw.js +1 -0
  118. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-C1_H_ztH.js → code-block-IT6T5CEO-Bmds1dKk.js} +1 -1
  119. package/packages/remote-control-server/web/dist/assets/{copy-DXU1lQqc.js → copy-DdSkINCW.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{cose-bilkent-S5V4N54A-BC6nfjTF.js → cose-bilkent-S5V4N54A-CTtGg7Fx.js} +1 -1
  121. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-CEPR_pRx.js → dagre-BM42HDAG-CFX48pZZ.js} +1 -1
  122. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-fVMGnSYa.js → diagram-2AECGRRQ-BwZE2jAF.js} +1 -1
  123. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-BPzN2rbK.js → diagram-5GNKFQAL-BuHnggju.js} +1 -1
  124. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-Boneg9n-.js → diagram-KO2AKTUF-Dmd3MO7f.js} +1 -1
  125. package/{dist/rcs-web/assets/diagram-LMA3HP47-B8AtvjO9.js → packages/remote-control-server/web/dist/assets/diagram-LMA3HP47-34ZNfvQd.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-DjY7A8jK.js → diagram-OG6HWLK6-CjZvlFxO.js} +1 -1
  127. package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-C1BEfKxk.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-BWR0WD_N.js} +1 -1
  128. package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-7TbI9MLV.js → flowDiagram-I6XJVG4X-DjZ7uFyw.js} +1 -1
  129. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CMAV0A01.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-BuAM7awZ.js} +1 -1
  130. package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-DAlR8G81.js → gitGraphDiagram-PVQCEYII-B_6bqpod.js} +1 -1
  131. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-0T0DAV4W.js → infoDiagram-5YYISTIA-BbhCTAn2.js} +1 -1
  132. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-BAw8txlx.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-1VPCYnPS.js} +1 -1
  133. package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-DWvYKwz-.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-Dzl0f8Im.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-Qzqw1H5B.js → kanban-definition-UN3LZRKU-BGoVgBze.js} +1 -1
  135. package/{dist/rcs-web/assets/linear-D2KIJoCI.js → packages/remote-control-server/web/dist/assets/linear-DF7ChHtW.js} +1 -1
  136. package/packages/remote-control-server/web/dist/assets/main-B_OE0doJ.css +1 -0
  137. package/packages/remote-control-server/web/dist/assets/main-CEsvX5rj.js +253 -0
  138. package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-CxWk1wHz.js → mermaid-VLURNSYL-3EqupjjN.js} +4 -4
  139. package/packages/remote-control-server/web/dist/assets/{mermaid.core-C48YvKu4.js → mermaid.core-BnVRH5R_.js} +5 -5
  140. package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-BfmcTuCA.js → mindmap-definition-RKZ34NQL-R3usKqMg.js} +1 -1
  141. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-DVNZpnfb.js → pieDiagram-4H26LBE5-U1XXn3t9.js} +1 -1
  142. package/{dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-COL55Z3i.js → packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-CocIpolQ.js} +1 -1
  143. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-CFczYQ0a.js → requirementDiagram-4Y6WPE33-DX7pHOr5.js} +1 -1
  144. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-BrQEv3WQ.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-TD6XCrii.js} +1 -1
  145. package/{dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-CMxtYmQu.js → packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-EyZvfcbT.js} +1 -1
  146. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-Dw9xJZ-A.js → stateDiagram-AJRCARHV-B_SU6QSv.js} +1 -1
  147. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-Br0D-weX.js → stateDiagram-v2-BHNVJYJU-C8vEqOLP.js} +1 -1
  148. package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-DuWDwYBt.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-C2XHcj96.js} +1 -1
  149. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN--7IV65HQ.js → vennDiagram-CIIHVFJN-aAmhPOm3.js} +1 -1
  150. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-CVTgWbvT.js → wardleyDiagram-YWT4CUSO-Db_mMfd6.js} +1 -1
  151. package/packages/remote-control-server/web/dist/assets/workerType-Bd-zteMi.js +1 -0
  152. package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-B9om4xAF.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-DPjdOqDe.js} +1 -1
  153. package/packages/remote-control-server/web/dist/index.html +2 -2
  154. package/dist/rcs-web/assets/AdminPanel-CQU763nr.js +0 -1
  155. package/dist/rcs-web/assets/Dashboard-B1hQfqI9.js +0 -1
  156. package/dist/rcs-web/assets/Join-7hMl360t.js +0 -1
  157. package/dist/rcs-web/assets/Login-BE8mNc0U.js +0 -1
  158. package/dist/rcs-web/assets/SessionVisibilityBadge-CQN3bJW4.js +0 -11
  159. package/dist/rcs-web/assets/Setup-CqZ5gEBQ.js +0 -1
  160. package/dist/rcs-web/assets/TeamCreate-DSYdTaPe.js +0 -1
  161. package/dist/rcs-web/assets/TeamDetail-CmJGsgOP.js +0 -1
  162. package/dist/rcs-web/assets/TeamList-BMS_Qq8U.js +0 -1
  163. package/dist/rcs-web/assets/TeamSettings-C0sYgCFT.js +0 -1
  164. package/dist/rcs-web/assets/UserSettings-CqzeJ5cc.js +0 -1
  165. package/dist/rcs-web/assets/channel-Daz3yMSu.js +0 -1
  166. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DufdcV1P.js +0 -1
  167. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DufdcV1P.js +0 -1
  168. package/dist/rcs-web/assets/main-EP6Lac2m.css +0 -1
  169. package/dist/rcs-web/assets/main-J6cPs2y8.js +0 -253
  170. package/packages/remote-control-server/web/dist/assets/AdminPanel-CQU763nr.js +0 -1
  171. package/packages/remote-control-server/web/dist/assets/Dashboard-B1hQfqI9.js +0 -1
  172. package/packages/remote-control-server/web/dist/assets/Join-7hMl360t.js +0 -1
  173. package/packages/remote-control-server/web/dist/assets/Login-BE8mNc0U.js +0 -1
  174. package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-CQN3bJW4.js +0 -11
  175. package/packages/remote-control-server/web/dist/assets/Setup-CqZ5gEBQ.js +0 -1
  176. package/packages/remote-control-server/web/dist/assets/TeamCreate-DSYdTaPe.js +0 -1
  177. package/packages/remote-control-server/web/dist/assets/TeamDetail-CmJGsgOP.js +0 -1
  178. package/packages/remote-control-server/web/dist/assets/TeamList-BMS_Qq8U.js +0 -1
  179. package/packages/remote-control-server/web/dist/assets/TeamSettings-C0sYgCFT.js +0 -1
  180. package/packages/remote-control-server/web/dist/assets/UserSettings-CqzeJ5cc.js +0 -1
  181. package/packages/remote-control-server/web/dist/assets/channel-Daz3yMSu.js +0 -1
  182. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DufdcV1P.js +0 -1
  183. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DufdcV1P.js +0 -1
  184. package/packages/remote-control-server/web/dist/assets/main-EP6Lac2m.css +0 -1
  185. package/packages/remote-control-server/web/dist/assets/main-J6cPs2y8.js +0 -253
@@ -1,253 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-CxWk1wHz.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-B1hQfqI9.js","assets/SessionVisibilityBadge-CQN3bJW4.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-B5C0o1YT.js","assets/ShareLanding-DBC9gbJo.js","assets/Login-BE8mNc0U.js","assets/Setup-CqZ5gEBQ.js","assets/Join-7hMl360t.js","assets/UserSettings-CqzeJ5cc.js","assets/copy-DXU1lQqc.js","assets/TeamList-BMS_Qq8U.js","assets/TeamCreate-DSYdTaPe.js","assets/TeamDetail-CmJGsgOP.js","assets/TeamSettings-C0sYgCFT.js","assets/AdminPanel-CQU763nr.js"])))=>i.map(i=>d[i]);
2
- var Yl=Object.defineProperty;var Xl=(e,t,n)=>t in e?Yl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=(e,t,n)=>Xl(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as ot,j as d,R as Kr,r as Ps,b as Ql,c as qr,d as Zl}from"./vendor-DE_-CLIE.js";import{_ as ke}from"./shiki-mEP5vQQu.js";import{m as Jl}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function Ms(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Ms(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Os(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Ms(e))&&(o&&(o+=" "),o+=t);return o}const ec=(e,t)=>{const n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},tc=(e,t)=>({classGroupId:e,validator:t}),Ds=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),kn="-",Lo=[],nc="arbitrary..",rc=e=>{const t=sc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return oc(a);const i=a.split(kn),m=i[0]===""&&i.length>1?1:0;return Ls(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=o[a],f=n[a];return m?f?ec(f,m):m:f||Lo}return n[a]||Lo}}},Ls=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],s=n.nextPart.get(r);if(s){const f=Ls(e,t+1,s);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(kn):e.slice(t).join(kn),m=a.length;for(let f=0;f<m;f++){const c=a[f];if(c.validator(i))return c.classGroupId}},oc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?nc+o:void 0})(),sc=e=>{const{theme:t,classGroups:n}=e;return ac(n,t)},ac=(e,t)=>{const n=Ds();for(const o in e){const r=e[o];Yr(r,n,o,t)}return n},Yr=(e,t,n,o)=>{const r=e.length;for(let s=0;s<r;s++){const a=e[s];ic(a,t,n,o)}},ic=(e,t,n,o)=>{if(typeof e=="string"){lc(e,t,n);return}if(typeof e=="function"){cc(e,t,n,o);return}uc(e,t,n,o)},lc=(e,t,n)=>{const o=e===""?t:Fs(t,e);o.classGroupId=n},cc=(e,t,n,o)=>{if(dc(e)){Yr(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(tc(n,e))},uc=(e,t,n,o)=>{const r=Object.entries(e),s=r.length;for(let a=0;a<s;a++){const[i,m]=r[a];Yr(m,Fs(t,i),n,o)}},Fs=(e,t)=>{let n=e;const o=t.split(kn),r=o.length;for(let s=0;s<r;s++){const a=o[s];let i=n.nextPart.get(a);i||(i=Ds(),n.nextPart.set(a,i)),n=i}return n},dc=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,fc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null);const r=(s,a)=>{n[s]=a,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=o[s])!==void 0)return r(s,a),a},set(s,a){s in n?n[s]=a:r(s,a)}}},jr="!",Fo=":",mc=[],$o=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),pc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const s=[];let a=0,i=0,m=0,f;const c=r.length;for(let v=0;v<c;v++){const C=r[v];if(a===0&&i===0){if(C===Fo){s.push(r.slice(m,v)),m=v+1;continue}if(C==="/"){f=v;continue}}C==="["?a++:C==="]"?a--:C==="("?i++:C===")"&&i--}const l=s.length===0?r:r.slice(m);let u=l,h=!1;l.endsWith(jr)?(u=l.slice(0,-1),h=!0):l.startsWith(jr)&&(u=l.slice(1),h=!0);const g=f&&f>m?f-m:void 0;return $o(s,h,u,g)};if(t){const r=t+Fo,s=o;o=a=>a.startsWith(r)?s(a.slice(r.length)):$o(mc,!1,a,void 0,!0)}if(n){const r=o;o=s=>n({className:s,parseClassName:r})}return o},hc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{const o=[];let r=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",m=t.has(a);i||m?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(a)):r.push(a)}return r.length>0&&(r.sort(),o.push(...r)),o}},gc=e=>({cache:fc(e.cacheSize),parseClassName:pc(e),sortModifiers:hc(e),postfixLookupClassGroupIds:xc(e),...rc(e)}),xc=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},vc=/\s+/,bc=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(vc);let f="";for(let c=m.length-1;c>=0;c-=1){const l=m[c],{isExternal:u,modifiers:h,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:C}=n(l);if(u){f=l+(f.length>0?" "+f:f);continue}let w=!!C,_;if(w){const j=v.substring(0,C);_=o(j);const x=_&&a[_]?o(v):void 0;x&&x!==_&&(_=x,w=!1)}else _=o(v);if(!_){if(!w){f=l+(f.length>0?" "+f:f);continue}if(_=o(v),!_){f=l+(f.length>0?" "+f:f);continue}w=!1}const R=h.length===0?"":h.length===1?h[0]:s(h).join(":"),A=g?R+jr:R,F=A+_;if(i.indexOf(F)>-1)continue;i.push(F);const y=r(_,w);for(let j=0;j<y.length;++j){const x=y[j];i.push(A+x)}f=l+(f.length>0?" "+f:f)}return f},wc=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=$s(n))&&(r&&(r+=" "),r+=o);return r},$s=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=$s(e[o]))&&(n&&(n+=" "),n+=t);return n},yc=(e,...t)=>{let n,o,r,s;const a=m=>{const f=t.reduce((c,l)=>l(c),e());return n=gc(f),o=n.cache.get,r=n.cache.set,s=i,i(m)},i=m=>{const f=o(m);if(f)return f;const c=bc(m,n);return r(m,c),c};return s=a,(...m)=>s(wc(...m))},Cc=[],xe=e=>{const t=n=>n[e]||Cc;return t.isThemeGetter=!0,t},Us=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,zs=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Sc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ec=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ac=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,_c=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rt=e=>Sc.test(e),oe=e=>!!e&&!Number.isNaN(Number(e)),$e=e=>!!e&&Number.isInteger(Number(e)),ar=e=>e.endsWith("%")&&oe(e.slice(0,-1)),Ve=e=>Ec.test(e),Bs=()=>!0,Rc=e=>kc.test(e)&&!Ac.test(e),Xr=()=>!1,Tc=e=>_c.test(e),Nc=e=>jc.test(e),Ic=e=>!Y(e)&&!Q(e),Pc=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Mc=e=>dt(e,Gs,Xr),Y=e=>Us.test(e),vt=e=>dt(e,Vs,Rc),Uo=e=>dt(e,Bc,oe),Oc=e=>dt(e,qs,Bs),Dc=e=>dt(e,Ks,Xr),zo=e=>dt(e,Hs,Xr),Lc=e=>dt(e,Ws,Nc),gn=e=>dt(e,Ys,Tc),Q=e=>zs.test(e),Kt=e=>kt(e,Vs),Fc=e=>kt(e,Ks),Bo=e=>kt(e,Hs),$c=e=>kt(e,Gs),Uc=e=>kt(e,Ws),xn=e=>kt(e,Ys,!0),zc=e=>kt(e,qs,!0),dt=(e,t,n)=>{const o=Us.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},kt=(e,t,n=!1)=>{const o=zs.exec(e);return o?o[1]?t(o[1]):n:!1},Hs=e=>e==="position"||e==="percentage",Ws=e=>e==="image"||e==="url",Gs=e=>e==="length"||e==="size"||e==="bg-size",Vs=e=>e==="length",Bc=e=>e==="number",Ks=e=>e==="family-name",qs=e=>e==="number"||e==="weight",Ys=e=>e==="shadow",Hc=()=>{const e=xe("color"),t=xe("font"),n=xe("text"),o=xe("font-weight"),r=xe("tracking"),s=xe("leading"),a=xe("breakpoint"),i=xe("container"),m=xe("spacing"),f=xe("radius"),c=xe("shadow"),l=xe("inset-shadow"),u=xe("text-shadow"),h=xe("drop-shadow"),g=xe("blur"),v=xe("perspective"),C=xe("aspect"),w=xe("ease"),_=xe("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...A(),Q,Y],y=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],x=()=>[Q,Y,m],b=()=>[rt,"full","auto",...x()],I=()=>[$e,"none","subgrid",Q,Y],O=()=>["auto",{span:["full",$e,Q,Y]},$e,Q,Y],M=()=>[$e,"auto",Q,Y],$=()=>["auto","min","max","fr",Q,Y],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...x()],S=()=>[rt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],D=()=>[rt,"screen","full","dvw","lvw","svw","min","max","fit",...x()],k=()=>[rt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],N=()=>[e,Q,Y],H=()=>[...A(),Bo,zo,{position:[Q,Y]}],T=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",$c,Mc,{size:[Q,Y]}],z=()=>[ar,Kt,vt],L=()=>["","none","full",f,Q,Y],G=()=>["",oe,Kt,vt],V=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[oe,ar,Bo,zo],ne=()=>["","none",g,Q,Y],ae=()=>["none",oe,Q,Y],ce=()=>["none",oe,Q,Y],me=()=>[oe,Q,Y],W=()=>[rt,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ve],breakpoint:[Ve],color:[Bs],container:[Ve],"drop-shadow":[Ve],ease:["in","out","in-out"],font:[Ic],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ve],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ve],shadow:[Ve],spacing:["px",oe],text:[Ve],"text-shadow":[Ve],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",rt,Y,Q,C]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,Y]}],"container-named":[Pc],columns:[{columns:[oe,Y,Q,i]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:F()}],overflow:[{overflow:y()}],"overflow-x":[{"overflow-x":y()}],"overflow-y":[{"overflow-y":y()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:b()}],"inset-x":[{"inset-x":b()}],"inset-y":[{"inset-y":b()}],start:[{"inset-s":b(),start:b()}],end:[{"inset-e":b(),end:b()}],"inset-bs":[{"inset-bs":b()}],"inset-be":[{"inset-be":b()}],top:[{top:b()}],right:[{right:b()}],bottom:[{bottom:b()}],left:[{left:b()}],visibility:["visible","invisible","collapse"],z:[{z:[$e,"auto",Q,Y]}],basis:[{basis:[rt,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[oe,rt,"auto","initial","none",Y]}],grow:[{grow:["",oe,Q,Y]}],shrink:[{shrink:["",oe,Q,Y]}],order:[{order:[$e,"first","last","none",Q,Y]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:S()}],"inline-size":[{inline:["auto",...D()]}],"min-inline-size":[{"min-inline":["auto",...D()]}],"max-inline-size":[{"max-inline":["none",...D()]}],"block-size":[{block:["auto",...k()]}],"min-block-size":[{"min-block":["auto",...k()]}],"max-block-size":[{"max-block":["none",...k()]}],w:[{w:[i,"screen",...S()]}],"min-w":[{"min-w":[i,"screen","none",...S()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...S()]}],h:[{h:["screen","lh",...S()]}],"min-h":[{"min-h":["screen","lh","none",...S()]}],"max-h":[{"max-h":["screen","lh",...S()]}],"font-size":[{text:["base",n,Kt,vt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,zc,Oc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ar,Y]}],"font-family":[{font:[Fc,Dc,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Q,Y]}],"line-clamp":[{"line-clamp":[oe,"none",Q,Uo]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",Q,Y]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,Y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[oe,"from-font","auto",Q,vt]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[oe,"auto",Q,Y]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[$e,Q,Y]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,Y]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q,Y]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:T()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$e,Q,Y],radial:["",Q,Y],conic:[$e,Q,Y]},Uc,Lc]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-bs":[{"border-bs":G()}],"border-w-be":[{"border-be":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[oe,Q,Y]}],"outline-w":[{outline:["",oe,Kt,vt]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",c,xn,gn]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",l,xn,gn]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[oe,vt]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",u,xn,gn]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[oe,Q,Y]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[oe]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[Q,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[oe]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:T()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,Y]}],filter:[{filter:["","none",Q,Y]}],blur:[{blur:ne()}],brightness:[{brightness:[oe,Q,Y]}],contrast:[{contrast:[oe,Q,Y]}],"drop-shadow":[{"drop-shadow":["","none",h,xn,gn]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",oe,Q,Y]}],"hue-rotate":[{"hue-rotate":[oe,Q,Y]}],invert:[{invert:["",oe,Q,Y]}],saturate:[{saturate:[oe,Q,Y]}],sepia:[{sepia:["",oe,Q,Y]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,Y]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[oe,Q,Y]}],"backdrop-contrast":[{"backdrop-contrast":[oe,Q,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":["",oe,Q,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[oe,Q,Y]}],"backdrop-invert":[{"backdrop-invert":["",oe,Q,Y]}],"backdrop-opacity":[{"backdrop-opacity":[oe,Q,Y]}],"backdrop-saturate":[{"backdrop-saturate":[oe,Q,Y]}],"backdrop-sepia":[{"backdrop-sepia":["",oe,Q,Y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,Y]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[oe,"initial",Q,Y]}],ease:[{ease:["linear","initial",w,Q,Y]}],delay:[{delay:[oe,Q,Y]}],animate:[{animate:["none",_,Q,Y]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,Y]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[Q,Y,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:W()}],"translate-x":[{"translate-x":W()}],"translate-y":[{"translate-y":W()}],"translate-z":[{"translate-z":W()}],"translate-none":["translate-none"],zoom:[{zoom:[$e,Q,Y]}],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,Y]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,Y]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[oe,Kt,vt,Uo]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Wc=yc(Hc);function Z(...e){return Wc(Os(e))}function Gc(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function Uv(e){return e?new Date(e*1e3).toLocaleString():""}function zv(e){return e==="archived"||e==="inactive"}function Bv(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function Vc(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function Hv(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate message UUIDs");const t=new Uint8Array(16);return e.getRandomValues(t),Vc(t)}/**
3
- * @license lucide-react v0.555.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const Kc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qc=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),Ho=e=>{const t=qc(e);return t.charAt(0).toUpperCase()+t.slice(1)},Xs=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),Yc=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
8
- * @license lucide-react v0.555.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */var Xc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
13
- * @license lucide-react v0.555.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const Qc=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:s,iconNode:a,...i},m)=>p.createElement("svg",{ref:m,...Xc,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Xs("lucide",r),...!s&&!Yc(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,c])=>p.createElement(f,c)),...Array.isArray(s)?s:[s]]));/**
18
- * @license lucide-react v0.555.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const le=(e,t)=>{const n=p.forwardRef(({className:o,...r},s)=>p.createElement(Qc,{ref:s,iconNode:t,className:Xs(`lucide-${Kc(Ho(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Ho(e),n};/**
23
- * @license lucide-react v0.555.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */const Zc=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Jc=le("arrow-down",Zc);/**
28
- * @license lucide-react v0.555.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const eu=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],tu=le("brain",eu);/**
33
- * @license lucide-react v0.555.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */const nu=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],on=le("check",nu);/**
38
- * @license lucide-react v0.555.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */const ru=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ut=le("chevron-down",ru);/**
43
- * @license lucide-react v0.555.0 - ISC
44
- *
45
- * This source code is licensed under the ISC license.
46
- * See the LICENSE file in the root directory of this source tree.
47
- */const ou=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],su=le("chevron-left",ou);/**
48
- * @license lucide-react v0.555.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */const au=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Qs=le("chevron-up",au);/**
53
- * @license lucide-react v0.555.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */const iu=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],lu=le("circle-check",iu);/**
58
- * @license lucide-react v0.555.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */const cu=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],uu=le("circle",cu);/**
63
- * @license lucide-react v0.555.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */const du=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Zt=le("file-text",du);/**
68
- * @license lucide-react v0.555.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const fu=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Qr=le("folder-open",fu);/**
73
- * @license lucide-react v0.555.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const mu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],pu=le("image",mu);/**
78
- * @license lucide-react v0.555.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const hu=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],gu=le("layout-grid",hu);/**
83
- * @license lucide-react v0.555.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const xu=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Zs=le("loader-circle",xu);/**
88
- * @license lucide-react v0.555.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const vu=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],bu=le("log-out",vu);/**
93
- * @license lucide-react v0.555.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const wu=[["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"}]],yu=le("message-square",wu);/**
98
- * @license lucide-react v0.555.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const Cu=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Su=le("monitor",Cu);/**
103
- * @license lucide-react v0.555.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const Eu=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Js=le("moon",Eu);/**
108
- * @license lucide-react v0.555.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const ku=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Au=le("panel-left-close",ku);/**
113
- * @license lucide-react v0.555.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const _u=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],ju=le("panel-left",_u);/**
118
- * @license lucide-react v0.555.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const Ru=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Tu=le("paperclip",Ru);/**
123
- * @license lucide-react v0.555.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const Nu=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Iu=le("pencil",Nu);/**
128
- * @license lucide-react v0.555.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const Pu=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ea=le("plus",Pu);/**
133
- * @license lucide-react v0.555.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const Mu=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ou=le("search",Mu);/**
138
- * @license lucide-react v0.555.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const Du=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Lu=le("send",Du);/**
143
- * @license lucide-react v0.555.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const Fu=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$u=le("settings",Fu);/**
148
- * @license lucide-react v0.555.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const Uu=[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ta=le("shield-alert",Uu);/**
153
- * @license lucide-react v0.555.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const zu=[["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"}]],Bu=le("shield",zu);/**
158
- * @license lucide-react v0.555.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const Hu=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],Wu=le("slash",Hu);/**
163
- * @license lucide-react v0.555.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const Gu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Vu=le("square",Gu);/**
168
- * @license lucide-react v0.555.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const Ku=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],na=le("sun",Ku);/**
173
- * @license lucide-react v0.555.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const qu=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],Zr=le("table",qu);/**
178
- * @license lucide-react v0.555.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const Yu=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Xu=le("trash-2",Yu);/**
183
- * @license lucide-react v0.555.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const Qu=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ra=le("user",Qu);/**
188
- * @license lucide-react v0.555.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const Zu=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Ju=le("users",Zu);/**
193
- * @license lucide-react v0.555.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const ed=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Un=le("x",ed),oa=p.createContext(void 0),sa="theme";function Wo(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Go(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(sa);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Vo(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function td(){const e=p.useContext(oa);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function nd({children:e,defaultTheme:t="system"}){const[n,o]=p.useState(()=>Go()||t),[r,s]=p.useState(()=>{const m=Go()||t;return m==="system"?Wo():m}),a=p.useCallback(m=>{o(m);try{localStorage.setItem(sa,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Wo():n;s(m),Vo(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=c=>{const l=c.matches?"dark":"light";s(l),Vo(l)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:r,setTheme:a};return ot.createElement(oa.Provider,{value:i},e)}function Ko(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function He(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Ko(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<o.length;r++){const s=o[r];typeof s=="function"?s():Ko(e[r],null)}}}}function pe(...e){return p.useCallback(He(...e),e)}var rd=Symbol.for("react.lazy"),An=Kr[" use ".trim().toString()];function od(e){return typeof e=="object"&&e!==null&&"then"in e}function aa(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===rd&&"_payload"in e&&od(e._payload)}function ia(e){const t=ad(e),n=p.forwardRef((o,r)=>{let{children:s,...a}=o;aa(s)&&typeof An=="function"&&(s=An(s._payload));const i=p.Children.toArray(s),m=i.find(ld);if(m){const f=m.props.children,c=i.map(l=>l===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:l);return d.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,c):null})}return d.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var sd=ia("Slot");function ad(e){const t=p.forwardRef((n,o)=>{let{children:r,...s}=n;if(aa(r)&&typeof An=="function"&&(r=An(r._payload)),p.isValidElement(r)){const a=ud(r),i=cd(s,r.props);return r.type!==p.Fragment&&(i.ref=o?He(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var id=Symbol("radix.slottable");function ld(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===id}function cd(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function ud(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const qo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Yo=Os,dd=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return Yo(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=t,a=Object.keys(r).map(f=>{const c=n==null?void 0:n[f],l=s==null?void 0:s[f];if(c===null)return null;const u=qo(c)||qo(l);return r[f][u]}),i=n&&Object.entries(n).reduce((f,c)=>{let[l,u]=c;return u===void 0||(f[l]=u),f},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,c)=>{let{class:l,className:u,...h}=c;return Object.entries(h).every(g=>{let[v,C]=g;return Array.isArray(C)?C.includes({...s,...i}[v]):{...s,...i}[v]===C})?[...f,l,u]:f},[]);return Yo(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},fd=dd("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function At({className:e,variant:t,size:n,asChild:o=!1,...r}){const s=o?sd:"button";return d.jsx(s,{"data-slot":"button",className:Z(fd({variant:t,size:n,className:e})),...r})}function ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function md(e,t){const n=p.createContext(t),o=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return d.jsx(n.Provider,{value:m,children:a})};o.displayName=e+"Provider";function r(s){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Ze(e,t=[]){let n=[];function o(s,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=l=>{var w;const{scope:u,children:h,...g}=l,v=((w=u==null?void 0:u[e])==null?void 0:w[m])||i,C=p.useMemo(()=>g,Object.values(g));return d.jsx(v.Provider,{value:C,children:h})};f.displayName=s+"Provider";function c(l,u){var v;const h=((v=u==null?void 0:u[e])==null?void 0:v[m])||i,g=p.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${l}\` must be used within \`${s}\``)}return[f,c]}const r=()=>{const s=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return r.scopeName=e,[o,pd(r,...t)]}function pd(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((i,{useScope:m,scopeName:f})=>{const l=m(s)[`__scope${f}`];return{...i,...l}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var qe=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},hd=Kr[" useInsertionEffect ".trim().toString()]||qe;function it({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=gd({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:r;{const c=p.useRef(e!==void 0);p.useEffect(()=>{const l=c.current;l!==i&&console.warn(`${o} is changing from ${l?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=i},[i,o])}const f=p.useCallback(c=>{var l;if(i){const u=xd(c)?c(e):c;u!==e&&((l=a.current)==null||l.call(a,u))}else s(c)},[i,e,s,a]);return[m,f]}function gd({defaultProp:e,onChange:t}){const[n,o]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return hd(()=>{s.current=t},[t]),p.useEffect(()=>{var a;r.current!==n&&((a=s.current)==null||a.call(s,n),r.current=n)},[n,r]),[n,o,s]}function xd(e){return typeof e=="function"}function Dt(e){const t=vd(e),n=p.forwardRef((o,r)=>{const{children:s,...a}=o,i=p.Children.toArray(s),m=i.find(wd);if(m){const f=m.props.children,c=i.map(l=>l===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:l);return d.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,c):null})}return d.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function vd(e){const t=p.forwardRef((n,o)=>{const{children:r,...s}=n;if(p.isValidElement(r)){const a=Cd(r),i=yd(s,r.props);return r.type!==p.Fragment&&(i.ref=o?He(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var la=Symbol("radix.slottable");function bd(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=la,t}function wd(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===la}function yd(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Cd(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Sd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ue=Sd.reduce((e,t)=>{const n=Dt(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function ca(e,t){e&&Ps.flushSync(()=>e.dispatchEvent(t))}function ua(e){const t=e+"CollectionProvider",[n,o]=Ze(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:C,children:w}=v,_=ot.useRef(null),R=ot.useRef(new Map).current;return d.jsx(r,{scope:C,itemMap:R,collectionRef:_,children:w})};a.displayName=t;const i=e+"CollectionSlot",m=Dt(i),f=ot.forwardRef((v,C)=>{const{scope:w,children:_}=v,R=s(i,w),A=pe(C,R.collectionRef);return d.jsx(m,{ref:A,children:_})});f.displayName=i;const c=e+"CollectionItemSlot",l="data-radix-collection-item",u=Dt(c),h=ot.forwardRef((v,C)=>{const{scope:w,children:_,...R}=v,A=ot.useRef(null),F=pe(C,A),y=s(c,w);return ot.useEffect(()=>(y.itemMap.set(A,{ref:A,...R}),()=>void y.itemMap.delete(A))),d.jsx(u,{[l]:"",ref:F,children:_})});h.displayName=c;function g(v){const C=s(e+"CollectionConsumer",v);return ot.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const R=Array.from(_.querySelectorAll(`[${l}]`));return Array.from(C.itemMap.values()).sort((y,j)=>R.indexOf(y.ref.current)-R.indexOf(j.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,o]}var Ed=p.createContext(void 0);function da(e){const t=p.useContext(Ed);return e||t||"ltr"}function Ye(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function kd(e,t=globalThis==null?void 0:globalThis.document){const n=Ye(e);p.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Ad="DismissableLayer",Rr="dismissableLayer.update",_d="dismissableLayer.pointerDownOutside",jd="dismissableLayer.focusOutside",Xo,fa=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),sn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(fa),[c,l]=p.useState(null),u=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=pe(t,j=>l(j)),v=Array.from(f.layers),[C]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),w=v.indexOf(C),_=c?v.indexOf(c):-1,R=f.layersWithOutsidePointerEventsDisabled.size>0,A=_>=w,F=Nd(j=>{const x=j.target,b=[...f.branches].some(I=>I.contains(x));!A||b||(r==null||r(j),a==null||a(j),j.defaultPrevented||i==null||i())},u),y=Id(j=>{const x=j.target;[...f.branches].some(I=>I.contains(x))||(s==null||s(j),a==null||a(j),j.defaultPrevented||i==null||i())},u);return kd(j=>{_===f.layers.size-1&&(o==null||o(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},u),p.useEffect(()=>{if(c)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Xo=u.body.style.pointerEvents,u.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(c)),f.layers.add(c),Qo(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(u.body.style.pointerEvents=Xo)}},[c,u,n,f]),p.useEffect(()=>()=>{c&&(f.layers.delete(c),f.layersWithOutsidePointerEventsDisabled.delete(c),Qo())},[c,f]),p.useEffect(()=>{const j=()=>h({});return document.addEventListener(Rr,j),()=>document.removeEventListener(Rr,j)},[]),d.jsx(ue.div,{...m,ref:g,style:{pointerEvents:R?A?"auto":"none":void 0,...e.style},onFocusCapture:ee(e.onFocusCapture,y.onFocusCapture),onBlurCapture:ee(e.onBlurCapture,y.onBlurCapture),onPointerDownCapture:ee(e.onPointerDownCapture,F.onPointerDownCapture)})});sn.displayName=Ad;var Rd="DismissableLayerBranch",Td=p.forwardRef((e,t)=>{const n=p.useContext(fa),o=p.useRef(null),r=pe(t,o);return p.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),d.jsx(ue.div,{...e,ref:r})});Td.displayName=Rd;function Nd(e,t=globalThis==null?void 0:globalThis.document){const n=Ye(e),o=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let m=function(){ma(_d,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=m,t.addEventListener("click",r.current,{once:!0})):m()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Id(e,t=globalThis==null?void 0:globalThis.document){const n=Ye(e),o=p.useRef(!1);return p.useEffect(()=>{const r=s=>{s.target&&!o.current&&ma(jd,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Qo(){const e=new CustomEvent(Rr);document.dispatchEvent(e)}function ma(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?ca(r,s):r.dispatchEvent(s)}var ir=0;function Jr(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Zo()),document.body.insertAdjacentElement("beforeend",e[1]??Zo()),ir++,()=>{ir===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ir--}},[])}function Zo(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var lr="focusScope.autoFocusOnMount",cr="focusScope.autoFocusOnUnmount",Jo={bubbles:!1,cancelable:!0},Pd="FocusScope",zn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=Ye(r),c=Ye(s),l=p.useRef(null),u=pe(t,v=>m(v)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(o){let v=function(R){if(h.paused||!i)return;const A=R.target;i.contains(A)?l.current=A:st(l.current,{select:!0})},C=function(R){if(h.paused||!i)return;const A=R.relatedTarget;A!==null&&(i.contains(A)||st(l.current,{select:!0}))},w=function(R){if(document.activeElement===document.body)for(const F of R)F.removedNodes.length>0&&st(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const _=new MutationObserver(w);return i&&_.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",C),_.disconnect()}}},[o,i,h.paused]),p.useEffect(()=>{if(i){ts.add(h);const v=document.activeElement;if(!i.contains(v)){const w=new CustomEvent(lr,Jo);i.addEventListener(lr,f),i.dispatchEvent(w),w.defaultPrevented||(Md($d(pa(i)),{select:!0}),document.activeElement===v&&st(i))}return()=>{i.removeEventListener(lr,f),setTimeout(()=>{const w=new CustomEvent(cr,Jo);i.addEventListener(cr,c),i.dispatchEvent(w),w.defaultPrevented||st(v??document.body,{select:!0}),i.removeEventListener(cr,c),ts.remove(h)},0)}}},[i,f,c,h]);const g=p.useCallback(v=>{if(!n&&!o||h.paused)return;const C=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,w=document.activeElement;if(C&&w){const _=v.currentTarget,[R,A]=Od(_);R&&A?!v.shiftKey&&w===A?(v.preventDefault(),n&&st(R,{select:!0})):v.shiftKey&&w===R&&(v.preventDefault(),n&&st(A,{select:!0})):w===_&&v.preventDefault()}},[n,o,h.paused]);return d.jsx(ue.div,{tabIndex:-1,...a,ref:u,onKeyDown:g})});zn.displayName=Pd;function Md(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(st(o,{select:t}),document.activeElement!==n)return}function Od(e){const t=pa(e),n=es(t,e),o=es(t.reverse(),e);return[n,o]}function pa(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function es(e,t){for(const n of e)if(!Dd(n,{upTo:t}))return n}function Dd(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Ld(e){return e instanceof HTMLInputElement&&"select"in e}function st(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ld(e)&&t&&e.select()}}var ts=Fd();function Fd(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ns(e,t),e.unshift(t)},remove(t){var n;e=ns(e,t),(n=e[0])==null||n.resume()}}}function ns(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function $d(e){return e.filter(t=>t.tagName!=="A")}var Ud=Kr[" useId ".trim().toString()]||(()=>{}),zd=0;function Ce(e){const[t,n]=p.useState(Ud());return qe(()=>{n(o=>o??String(zd++))},[e]),e||(t?`radix-${t}`:"")}const Bd=["top","right","bottom","left"],lt=Math.min,je=Math.max,_n=Math.round,vn=Math.floor,Be=e=>({x:e,y:e}),Hd={left:"right",right:"left",bottom:"top",top:"bottom"};function Tr(e,t,n){return je(e,lt(t,n))}function Xe(e,t){return typeof e=="function"?e(t):e}function Qe(e){return e.split("-")[0]}function zt(e){return e.split("-")[1]}function eo(e){return e==="x"?"y":"x"}function to(e){return e==="y"?"height":"width"}function ze(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function no(e){return eo(ze(e))}function Wd(e,t,n){n===void 0&&(n=!1);const o=zt(e),r=no(e),s=to(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=jn(a)),[a,jn(a)]}function Gd(e){const t=jn(e);return[Nr(e),t,Nr(t)]}function Nr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const rs=["left","right"],os=["right","left"],Vd=["top","bottom"],Kd=["bottom","top"];function qd(e,t,n){switch(e){case"top":case"bottom":return n?t?os:rs:t?rs:os;case"left":case"right":return t?Vd:Kd;default:return[]}}function Yd(e,t,n,o){const r=zt(e);let s=qd(Qe(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Nr)))),s}function jn(e){const t=Qe(e);return Hd[t]+e.slice(t.length)}function Xd(e){return{top:0,right:0,bottom:0,left:0,...e}}function ha(e){return typeof e!="number"?Xd(e):{top:e,right:e,bottom:e,left:e}}function Rn(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function ss(e,t,n){let{reference:o,floating:r}=e;const s=ze(t),a=no(t),i=to(a),m=Qe(t),f=s==="y",c=o.x+o.width/2-r.width/2,l=o.y+o.height/2-r.height/2,u=o[i]/2-r[i]/2;let h;switch(m){case"top":h={x:c,y:o.y-r.height};break;case"bottom":h={x:c,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:l};break;case"left":h={x:o.x-r.width,y:l};break;default:h={x:o.x,y:o.y}}switch(zt(t)){case"start":h[a]-=u*(n&&f?-1:1);break;case"end":h[a]+=u*(n&&f?-1:1);break}return h}async function Qd(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:c="viewport",elementContext:l="floating",altBoundary:u=!1,padding:h=0}=Xe(t,e),g=ha(h),C=i[u?l==="floating"?"reference":"floating":l],w=Rn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:c,strategy:m})),_=l==="floating"?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),A=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},F=Rn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:_,offsetParent:R,strategy:m}):_);return{top:(w.top-F.top+g.top)/A.y,bottom:(F.bottom-w.bottom+g.bottom)/A.y,left:(w.left-F.left+g.left)/A.x,right:(F.right-w.right+g.right)/A.x}}const Zd=50,Jd=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:Qd},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:l}=ss(f,o,m),u=o,h=0;const g={};for(let v=0;v<s.length;v++){const C=s[v];if(!C)continue;const{name:w,fn:_}=C,{x:R,y:A,data:F,reset:y}=await _({x:c,y:l,initialPlacement:o,placement:u,strategy:r,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});c=R??c,l=A??l,g[w]={...g[w],...F},y&&h<Zd&&(h++,typeof y=="object"&&(y.placement&&(u=y.placement),y.rects&&(f=y.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):y.rects),{x:c,y:l}=ss(f,u,m)),v=-1)}return{x:c,y:l,placement:u,strategy:r,middlewareData:g}},ef=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:c=0}=Xe(e,t)||{};if(f==null)return{};const l=ha(c),u={x:n,y:o},h=no(r),g=to(h),v=await a.getDimensions(f),C=h==="y",w=C?"top":"left",_=C?"bottom":"right",R=C?"clientHeight":"clientWidth",A=s.reference[g]+s.reference[h]-u[h]-s.floating[g],F=u[h]-s.reference[h],y=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let j=y?y[R]:0;(!j||!await(a.isElement==null?void 0:a.isElement(y)))&&(j=i.floating[R]||s.floating[g]);const x=A/2-F/2,b=j/2-v[g]/2-1,I=lt(l[w],b),O=lt(l[_],b),M=I,$=j-v[g]-O,P=j/2-v[g]/2+x,U=Tr(M,P,$),E=!m.arrow&&zt(r)!=null&&P!==U&&s.reference[g]/2-(P<M?I:O)-v[g]/2<0,S=E?P<M?P-M:P-$:0;return{[h]:u[h]+S,data:{[h]:U,centerOffset:P-U-S,...E&&{alignmentOffset:S}},reset:E}}}),tf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:c=!0,crossAxis:l=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...C}=Xe(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=Qe(r),_=ze(i),R=Qe(i)===i,A=await(m.isRTL==null?void 0:m.isRTL(f.floating)),F=u||(R||!v?[jn(i)]:Gd(i)),y=g!=="none";!u&&y&&F.push(...Yd(i,v,g,A));const j=[i,...F],x=await m.detectOverflow(t,C),b=[];let I=((o=s.flip)==null?void 0:o.overflows)||[];if(c&&b.push(x[w]),l){const P=Wd(r,a,A);b.push(x[P[0]],x[P[1]])}if(I=[...I,{placement:r,overflows:b}],!b.every(P=>P<=0)){var O,M;const P=(((O=s.flip)==null?void 0:O.index)||0)+1,U=j[P];if(U&&(!(l==="alignment"?_!==ze(U):!1)||I.every(D=>ze(D.placement)===_?D.overflows[0]>0:!0)))return{data:{index:P,overflows:I},reset:{placement:U}};let E=(M=I.filter(S=>S.overflows[0]<=0).sort((S,D)=>S.overflows[1]-D.overflows[1])[0])==null?void 0:M.placement;if(!E)switch(h){case"bestFit":{var $;const S=($=I.filter(D=>{if(y){const k=ze(D.placement);return k===_||k==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(k=>k>0).reduce((k,N)=>k+N,0)]).sort((D,k)=>D[1]-k[1])[0])==null?void 0:$[0];S&&(E=S);break}case"initialPlacement":E=i;break}if(r!==E)return{reset:{placement:E}}}return{}}}};function as(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function is(e){return Bd.some(t=>e[t]>=0)}const nf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=Xe(e,t);switch(r){case"referenceHidden":{const a=await o.detectOverflow(t,{...s,elementContext:"reference"}),i=as(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:is(i)}}}case"escaped":{const a=await o.detectOverflow(t,{...s,altBoundary:!0}),i=as(a,n.floating);return{data:{escapedOffsets:i,escaped:is(i)}}}default:return{}}}}},ga=new Set(["left","top"]);async function rf(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=Qe(n),i=zt(n),m=ze(n)==="y",f=ga.has(a)?-1:1,c=s&&m?-1:1,l=Xe(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:g}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return i&&typeof g=="number"&&(h=i==="end"?g*-1:g),m?{x:h*c,y:u*f}:{x:u*f,y:h*c}}const of=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:a,middlewareData:i}=t,m=await rf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:r+m.x,y:s+m.y,data:{...m,placement:a}}}}},sf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:w=>{let{x:_,y:R}=w;return{x:_,y:R}}},...f}=Xe(e,t),c={x:n,y:o},l=await s.detectOverflow(t,f),u=ze(Qe(r)),h=eo(u);let g=c[h],v=c[u];if(a){const w=h==="y"?"top":"left",_=h==="y"?"bottom":"right",R=g+l[w],A=g-l[_];g=Tr(R,g,A)}if(i){const w=u==="y"?"top":"left",_=u==="y"?"bottom":"right",R=v+l[w],A=v-l[_];v=Tr(R,v,A)}const C=m.fn({...t,[h]:g,[u]:v});return{...C,data:{x:C.x-n,y:C.y-o,enabled:{[h]:a,[u]:i}}}}}},af=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=Xe(e,t),c={x:n,y:o},l=ze(r),u=eo(l);let h=c[u],g=c[l];const v=Xe(i,t),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const R=u==="y"?"height":"width",A=s.reference[u]-s.floating[R]+C.mainAxis,F=s.reference[u]+s.reference[R]-C.mainAxis;h<A?h=A:h>F&&(h=F)}if(f){var w,_;const R=u==="y"?"width":"height",A=ga.has(Qe(r)),F=s.reference[l]-s.floating[R]+(A&&((w=a.offset)==null?void 0:w[l])||0)+(A?0:C.crossAxis),y=s.reference[l]+s.reference[R]+(A?0:((_=a.offset)==null?void 0:_[l])||0)-(A?C.crossAxis:0);g<F?g=F:g>y&&(g=y)}return{[u]:h,[l]:g}}}},lf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=Xe(e,t),c=await a.detectOverflow(t,f),l=Qe(r),u=zt(r),h=ze(r)==="y",{width:g,height:v}=s.floating;let C,w;l==="top"||l==="bottom"?(C=l,w=u===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(w=l,C=u==="end"?"top":"bottom");const _=v-c.top-c.bottom,R=g-c.left-c.right,A=lt(v-c[C],_),F=lt(g-c[w],R),y=!t.middlewareData.shift;let j=A,x=F;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=R),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(j=_),y&&!u){const I=je(c.left,0),O=je(c.right,0),M=je(c.top,0),$=je(c.bottom,0);h?x=g-2*(I!==0||O!==0?I+O:je(c.left,c.right)):j=v-2*(M!==0||$!==0?M+$:je(c.top,c.bottom))}await m({...t,availableWidth:x,availableHeight:j});const b=await a.getDimensions(i.floating);return g!==b.width||v!==b.height?{reset:{rects:!0}}:{}}}};function Bn(){return typeof window<"u"}function Bt(e){return xa(e)?(e.nodeName||"").toLowerCase():"#document"}function Re(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function We(e){var t;return(t=(xa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xa(e){return Bn()?e instanceof Node||e instanceof Re(e).Node:!1}function Oe(e){return Bn()?e instanceof Element||e instanceof Re(e).Element:!1}function Je(e){return Bn()?e instanceof HTMLElement||e instanceof Re(e).HTMLElement:!1}function ls(e){return!Bn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Re(e).ShadowRoot}function an(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=De(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function cf(e){return/^(table|td|th)$/.test(Bt(e))}function Hn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const uf=/transform|translate|scale|rotate|perspective|filter/,df=/paint|layout|strict|content/,bt=e=>!!e&&e!=="none";let ur;function ro(e){const t=Oe(e)?De(e):e;return bt(t.transform)||bt(t.translate)||bt(t.scale)||bt(t.rotate)||bt(t.perspective)||!oo()&&(bt(t.backdropFilter)||bt(t.filter))||uf.test(t.willChange||"")||df.test(t.contain||"")}function ff(e){let t=ct(e);for(;Je(t)&&!Lt(t);){if(ro(t))return t;if(Hn(t))return null;t=ct(t)}return null}function oo(){return ur==null&&(ur=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ur}function Lt(e){return/^(html|body|#document)$/.test(Bt(e))}function De(e){return Re(e).getComputedStyle(e)}function Wn(e){return Oe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ct(e){if(Bt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ls(e)&&e.host||We(e);return ls(t)?t.host:t}function va(e){const t=ct(e);return Lt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Je(t)&&an(t)?t:va(t)}function Jt(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=va(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=Re(r);if(s){const i=Ir(a);return t.concat(a,a.visualViewport||[],an(r)?r:[],i&&n?Jt(i):[])}else return t.concat(r,Jt(r,[],n))}function Ir(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ba(e){const t=De(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Je(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,i=_n(n)!==s||_n(o)!==a;return i&&(n=s,o=a),{width:n,height:o,$:i}}function so(e){return Oe(e)?e:e.contextElement}function Mt(e){const t=so(e);if(!Je(t))return Be(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=ba(t);let a=(s?_n(n.width):n.width)/o,i=(s?_n(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const mf=Be(0);function wa(e){const t=Re(e);return!oo()||!t.visualViewport?mf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Re(e)?!1:t}function Ct(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=so(e);let a=Be(1);t&&(o?Oe(o)&&(a=Mt(o)):a=Mt(e));const i=pf(s,n,o)?wa(s):Be(0);let m=(r.left+i.x)/a.x,f=(r.top+i.y)/a.y,c=r.width/a.x,l=r.height/a.y;if(s){const u=Re(s),h=o&&Oe(o)?Re(o):o;let g=u,v=Ir(g);for(;v&&o&&h!==g;){const C=Mt(v),w=v.getBoundingClientRect(),_=De(v),R=w.left+(v.clientLeft+parseFloat(_.paddingLeft))*C.x,A=w.top+(v.clientTop+parseFloat(_.paddingTop))*C.y;m*=C.x,f*=C.y,c*=C.x,l*=C.y,m+=R,f+=A,g=Re(v),v=Ir(g)}}return Rn({width:c,height:l,x:m,y:f})}function Gn(e,t){const n=Wn(e).scrollLeft;return t?t.left+n:Ct(We(e)).left+n}function ya(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Gn(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function hf(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=We(o),i=t?Hn(t.floating):!1;if(o===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Be(1);const c=Be(0),l=Je(o);if((l||!l&&!s)&&((Bt(o)!=="body"||an(a))&&(m=Wn(o)),l)){const h=Ct(o);f=Mt(o),c.x=h.x+o.clientLeft,c.y=h.y+o.clientTop}const u=a&&!l&&!s?ya(a,m):Be(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+c.x+u.x,y:n.y*f.y-m.scrollTop*f.y+c.y+u.y}}function gf(e){return Array.from(e.getClientRects())}function xf(e){const t=We(e),n=Wn(e),o=e.ownerDocument.body,r=je(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=je(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+Gn(e);const i=-n.scrollTop;return De(o).direction==="rtl"&&(a+=je(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:i}}const cs=25;function vf(e,t){const n=Re(e),o=We(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,i=0,m=0;if(r){s=r.width,a=r.height;const c=oo();(!c||c&&t==="fixed")&&(i=r.offsetLeft,m=r.offsetTop)}const f=Gn(o);if(f<=0){const c=o.ownerDocument,l=c.body,u=getComputedStyle(l),h=c.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,g=Math.abs(o.clientWidth-l.clientWidth-h);g<=cs&&(s-=g)}else f<=cs&&(s+=f);return{width:s,height:a,x:i,y:m}}function bf(e,t){const n=Ct(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=Je(e)?Mt(e):Be(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=r*s.x,f=o*s.y;return{width:a,height:i,x:m,y:f}}function us(e,t,n){let o;if(t==="viewport")o=vf(e,n);else if(t==="document")o=xf(We(e));else if(Oe(t))o=bf(t,n);else{const r=wa(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Rn(o)}function Ca(e,t){const n=ct(e);return n===t||!Oe(n)||Lt(n)?!1:De(n).position==="fixed"||Ca(n,t)}function wf(e,t){const n=t.get(e);if(n)return n;let o=Jt(e,[],!1).filter(i=>Oe(i)&&Bt(i)!=="body"),r=null;const s=De(e).position==="fixed";let a=s?ct(e):e;for(;Oe(a)&&!Lt(a);){const i=De(a),m=ro(a);!m&&i.position==="fixed"&&(r=null),(s?!m&&!r:!m&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||an(a)&&!m&&Ca(e,a))?o=o.filter(c=>c!==a):r=i,a=ct(a)}return t.set(e,o),o}function yf(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?Hn(t)?[]:wf(t,this._c):[].concat(n),o],i=us(t,a[0],r);let m=i.top,f=i.right,c=i.bottom,l=i.left;for(let u=1;u<a.length;u++){const h=us(t,a[u],r);m=je(h.top,m),f=lt(h.right,f),c=lt(h.bottom,c),l=je(h.left,l)}return{width:f-l,height:c-m,x:l,y:m}}function Cf(e){const{width:t,height:n}=ba(e);return{width:t,height:n}}function Sf(e,t,n){const o=Je(t),r=We(t),s=n==="fixed",a=Ct(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Be(0);function f(){m.x=Gn(r)}if(o||!o&&!s)if((Bt(t)!=="body"||an(r))&&(i=Wn(t)),o){const h=Ct(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else r&&f();s&&!o&&r&&f();const c=r&&!o&&!s?ya(r,i):Be(0),l=a.left+i.scrollLeft-m.x-c.x,u=a.top+i.scrollTop-m.y-c.y;return{x:l,y:u,width:a.width,height:a.height}}function dr(e){return De(e).position==="static"}function ds(e,t){if(!Je(e)||De(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return We(e)===n&&(n=n.ownerDocument.body),n}function Sa(e,t){const n=Re(e);if(Hn(e))return n;if(!Je(e)){let r=ct(e);for(;r&&!Lt(r);){if(Oe(r)&&!dr(r))return r;r=ct(r)}return n}let o=ds(e,t);for(;o&&cf(o)&&dr(o);)o=ds(o,t);return o&&Lt(o)&&dr(o)&&!ro(o)?n:o||ff(e)||n}const Ef=async function(e){const t=this.getOffsetParent||Sa,n=this.getDimensions,o=await n(e.floating);return{reference:Sf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function kf(e){return De(e).direction==="rtl"}const Af={convertOffsetParentRelativeRectToViewportRelativeRect:hf,getDocumentElement:We,getClippingRect:yf,getOffsetParent:Sa,getElementRects:Ef,getClientRects:gf,getDimensions:Cf,getScale:Mt,isElement:Oe,isRTL:kf};function Ea(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _f(e,t){let n=null,o;const r=We(e);function s(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),s();const f=e.getBoundingClientRect(),{left:c,top:l,width:u,height:h}=f;if(i||t(),!u||!h)return;const g=vn(l),v=vn(r.clientWidth-(c+u)),C=vn(r.clientHeight-(l+h)),w=vn(c),R={rootMargin:-g+"px "+-v+"px "+-C+"px "+-w+"px",threshold:je(0,lt(1,m))||1};let A=!0;function F(y){const j=y[0].intersectionRatio;if(j!==m){if(!A)return a();j?a(!1,j):o=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!Ea(f,e.getBoundingClientRect())&&a(),A=!1}try{n=new IntersectionObserver(F,{...R,root:r.ownerDocument})}catch{n=new IntersectionObserver(F,R)}n.observe(e)}return a(!0),s}function jf(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,f=so(e),c=r||s?[...f?Jt(f):[],...t?Jt(t):[]]:[];c.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const l=f&&i?_f(f,n):null;let u=-1,h=null;a&&(h=new ResizeObserver(w=>{let[_]=w;_&&_.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var R;(R=h)==null||R.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?Ct(e):null;m&&C();function C(){const w=Ct(e);v&&!Ea(v,w)&&n(),v=w,g=requestAnimationFrame(C)}return n(),()=>{var w;c.forEach(_=>{r&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),l==null||l(),(w=h)==null||w.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const Rf=of,Tf=sf,Nf=tf,If=lf,Pf=nf,fs=ef,Mf=af,Of=(e,t,n)=>{const o=new Map,r={platform:Af,...n},s={...r.platform,_c:o};return Jd(e,t,{...r,platform:s})};var Df=typeof document<"u",Lf=function(){},Cn=Df?p.useLayoutEffect:Lf;function Tn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Tn(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Tn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function ka(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ms(e,t){const n=ka(e);return Math.round(t*n)/n}function fr(e){const t=p.useRef(e);return Cn(()=>{t.current=e}),t}function Ff(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[c,l]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,h]=p.useState(o);Tn(u,o)||h(o);const[g,v]=p.useState(null),[C,w]=p.useState(null),_=p.useCallback(D=>{D!==y.current&&(y.current=D,v(D))},[]),R=p.useCallback(D=>{D!==j.current&&(j.current=D,w(D))},[]),A=s||g,F=a||C,y=p.useRef(null),j=p.useRef(null),x=p.useRef(c),b=m!=null,I=fr(m),O=fr(r),M=fr(f),$=p.useCallback(()=>{if(!y.current||!j.current)return;const D={placement:t,strategy:n,middleware:u};O.current&&(D.platform=O.current),Of(y.current,j.current,D).then(k=>{const N={...k,isPositioned:M.current!==!1};P.current&&!Tn(x.current,N)&&(x.current=N,Ps.flushSync(()=>{l(N)}))})},[u,t,n,O,M]);Cn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,l(D=>({...D,isPositioned:!1})))},[f]);const P=p.useRef(!1);Cn(()=>(P.current=!0,()=>{P.current=!1}),[]),Cn(()=>{if(A&&(y.current=A),F&&(j.current=F),A&&F){if(I.current)return I.current(A,F,$);$()}},[A,F,$,I,b]);const U=p.useMemo(()=>({reference:y,floating:j,setReference:_,setFloating:R}),[_,R]),E=p.useMemo(()=>({reference:A,floating:F}),[A,F]),S=p.useMemo(()=>{const D={position:n,left:0,top:0};if(!E.floating)return D;const k=ms(E.floating,c.x),N=ms(E.floating,c.y);return i?{...D,transform:"translate("+k+"px, "+N+"px)",...ka(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:N}},[n,i,E.floating,c.x,c.y]);return p.useMemo(()=>({...c,update:$,refs:U,elements:E,floatingStyles:S}),[c,$,U,E,S])}const $f=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?fs({element:o.current,padding:r}).fn(n):{}:o?fs({element:o,padding:r}).fn(n):{}}}},Uf=(e,t)=>{const n=Rf(e);return{name:n.name,fn:n.fn,options:[e,t]}},zf=(e,t)=>{const n=Tf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bf=(e,t)=>({fn:Mf(e).fn,options:[e,t]}),Hf=(e,t)=>{const n=Nf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wf=(e,t)=>{const n=If(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gf=(e,t)=>{const n=Pf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vf=(e,t)=>{const n=$f(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Kf="Arrow",Aa=p.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return d.jsx(ue.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});Aa.displayName=Kf;var qf=Aa;function Yf(e){const[t,n]=p.useState(void 0);return qe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,i;if("borderBoxSize"in s){const m=s.borderBoxSize,f=Array.isArray(m)?m[0]:m;a=f.inlineSize,i=f.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var ao="Popper",[_a,Ht]=Ze(ao),[Xf,ja]=_a(ao),Ra=e=>{const{__scopePopper:t,children:n}=e,[o,r]=p.useState(null);return d.jsx(Xf,{scope:t,anchor:o,onAnchorChange:r,children:n})};Ra.displayName=ao;var Ta="PopperAnchor",Na=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=ja(Ta,n),a=p.useRef(null),i=pe(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(o==null?void 0:o.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),o?null:d.jsx(ue.div,{...r,ref:i})});Na.displayName=Ta;var io="PopperContent",[Qf,Zf]=_a(io),Ia=p.forwardRef((e,t)=>{var V,X,K,ne,ae,ce;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:c=0,sticky:l="partial",hideWhenDetached:u=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,C=ja(io,n),[w,_]=p.useState(null),R=pe(t,me=>_(me)),[A,F]=p.useState(null),y=Yf(A),j=(y==null?void 0:y.width)??0,x=(y==null?void 0:y.height)??0,b=o+(s!=="center"?"-"+s:""),I=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},O=Array.isArray(f)?f:[f],M=O.length>0,$={padding:I,boundary:O.filter(em),altBoundary:M},{refs:P,floatingStyles:U,placement:E,isPositioned:S,middlewareData:D}=Ff({strategy:"fixed",placement:b,whileElementsMounted:(...me)=>jf(...me,{animationFrame:h==="always"}),elements:{reference:C.anchor},middleware:[Uf({mainAxis:r+x,alignmentAxis:a}),m&&zf({mainAxis:!0,crossAxis:!1,limiter:l==="partial"?Bf():void 0,...$}),m&&Hf({...$}),Wf({...$,apply:({elements:me,rects:W,availableWidth:q,availableHeight:J})=>{const{width:te,height:ie}=W.reference,re=me.floating.style;re.setProperty("--radix-popper-available-width",`${q}px`),re.setProperty("--radix-popper-available-height",`${J}px`),re.setProperty("--radix-popper-anchor-width",`${te}px`),re.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),A&&Vf({element:A,padding:i}),tm({arrowWidth:j,arrowHeight:x}),u&&Gf({strategy:"referenceHidden",...$})]}),[k,N]=Oa(E),H=Ye(g);qe(()=>{S&&(H==null||H())},[S,H]);const T=(V=D.arrow)==null?void 0:V.x,B=(X=D.arrow)==null?void 0:X.y,z=((K=D.arrow)==null?void 0:K.centerOffset)!==0,[L,G]=p.useState();return qe(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),d.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:S?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:L,"--radix-popper-transform-origin":[(ne=D.transformOrigin)==null?void 0:ne.x,(ae=D.transformOrigin)==null?void 0:ae.y].join(" "),...((ce=D.hide)==null?void 0:ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(Qf,{scope:n,placedSide:k,onArrowChange:F,arrowX:T,arrowY:B,shouldHideArrow:z,children:d.jsx(ue.div,{"data-side":k,"data-align":N,...v,ref:R,style:{...v.style,animation:S?void 0:"none"}})})})});Ia.displayName=io;var Pa="PopperArrow",Jf={top:"bottom",right:"left",bottom:"top",left:"right"},Ma=p.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=Zf(Pa,o),a=Jf[s.placedSide];return d.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:d.jsx(qf,{...r,ref:n,style:{...r.style,display:"block"}})})});Ma.displayName=Pa;function em(e){return e!==null}var tm=e=>({name:"transformOrigin",options:e,fn(t){var C,w,_;const{placement:n,rects:o,middlewareData:r}=t,a=((C=r.arrow)==null?void 0:C.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,c]=Oa(n),l={start:"0%",center:"50%",end:"100%"}[c],u=(((w=r.arrow)==null?void 0:w.x)??0)+i/2,h=(((_=r.arrow)==null?void 0:_.y)??0)+m/2;let g="",v="";return f==="bottom"?(g=a?l:`${u}px`,v=`${-m}px`):f==="top"?(g=a?l:`${u}px`,v=`${o.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?l:`${h}px`):f==="left"&&(g=`${o.floating.width+m}px`,v=a?l:`${h}px`),{data:{x:g,y:v}}}});function Oa(e){const[t,n="center"]=e.split("-");return[t,n]}var lo=Ra,Vn=Na,co=Ia,uo=Ma,nm="Portal",ln=p.forwardRef((e,t)=>{var i;const{container:n,...o}=e,[r,s]=p.useState(!1);qe(()=>s(!0),[]);const a=n||r&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?Ql.createPortal(d.jsx(ue.div,{...o,ref:t}),a):null});ln.displayName=nm;function rm(e,t){return p.useReducer((n,o)=>t[n][o]??n,e)}var Te=e=>{const{present:t,children:n}=e,o=om(t),r=typeof n=="function"?n({present:o.isPresent}):p.Children.only(n),s=pe(o.ref,sm(r));return typeof n=="function"||o.isPresent?p.cloneElement(r,{ref:s}):null};Te.displayName="Presence";function om(e){const[t,n]=p.useState(),o=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=rm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=bn(o.current);s.current=i==="mounted"?f:"none"},[i]),qe(()=>{const f=o.current,c=r.current;if(c!==e){const u=s.current,h=bn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(c&&u!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,m]),qe(()=>{if(t){let f;const c=t.ownerDocument.defaultView??window,l=h=>{const v=bn(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!r.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",f=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},u=h=>{h.target===t&&(s.current=bn(o.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{c.clearTimeout(f),t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function bn(e){return(e==null?void 0:e.animationName)||"none"}function sm(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mr="rovingFocusGroup.onEntryFocus",am={bubbles:!1,cancelable:!0},cn="RovingFocusGroup",[Pr,Da,im]=ua(cn),[lm,La]=Ze(cn,[im]),[cm,um]=lm(cn),Fa=p.forwardRef((e,t)=>d.jsx(Pr.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Pr.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(dm,{...e,ref:t})})}));Fa.displayName=cn;var dm=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:c=!1,...l}=e,u=p.useRef(null),h=pe(t,u),g=da(s),[v,C]=it({prop:a,defaultProp:i??null,onChange:m,caller:cn}),[w,_]=p.useState(!1),R=Ye(f),A=Da(n),F=p.useRef(!1),[y,j]=p.useState(0);return p.useEffect(()=>{const x=u.current;if(x)return x.addEventListener(mr,R),()=>x.removeEventListener(mr,R)},[R]),d.jsx(cm,{scope:n,orientation:o,dir:g,loop:r,currentTabStopId:v,onItemFocus:p.useCallback(x=>C(x),[C]),onItemShiftTab:p.useCallback(()=>_(!0),[]),onFocusableItemAdd:p.useCallback(()=>j(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>j(x=>x-1),[]),children:d.jsx(ue.div,{tabIndex:w||y===0?-1:0,"data-orientation":o,...l,ref:h,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,()=>{F.current=!0}),onFocus:ee(e.onFocus,x=>{const b=!F.current;if(x.target===x.currentTarget&&b&&!w){const I=new CustomEvent(mr,am);if(x.currentTarget.dispatchEvent(I),!I.defaultPrevented){const O=A().filter(E=>E.focusable),M=O.find(E=>E.active),$=O.find(E=>E.id===v),U=[M,$,...O].filter(Boolean).map(E=>E.ref.current);za(U,c)}}F.current=!1}),onBlur:ee(e.onBlur,()=>_(!1))})})}),$a="RovingFocusGroupItem",Ua=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...i}=e,m=Ce(),f=s||m,c=um($a,n),l=c.currentTabStopId===f,u=Da(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=c;return p.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),d.jsx(Pr.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:d.jsx(ue.span,{tabIndex:l?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:ee(e.onMouseDown,C=>{o?c.onItemFocus(f):C.preventDefault()}),onFocus:ee(e.onFocus,()=>c.onItemFocus(f)),onKeyDown:ee(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){c.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const w=pm(C,c.orientation,c.dir);if(w!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let R=u().filter(A=>A.focusable).map(A=>A.ref.current);if(w==="last")R.reverse();else if(w==="prev"||w==="next"){w==="prev"&&R.reverse();const A=R.indexOf(C.currentTarget);R=c.loop?hm(R,A+1):R.slice(A+1)}setTimeout(()=>za(R))}}),children:typeof a=="function"?a({isCurrentTabStop:l,hasTabStop:v!=null}):a})})});Ua.displayName=$a;var fm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function pm(e,t,n){const o=mm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return fm[o]}function za(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function hm(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var gm=Fa,xm=Ua,vm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Tt=new WeakMap,wn=new WeakMap,yn={},pr=0,Ba=function(e){return e&&(e.host||Ba(e.parentNode))},bm=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=Ba(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},wm=function(e,t,n,o){var r=bm(t,Array.isArray(e)?e:[e]);yn[n]||(yn[n]=new WeakMap);var s=yn[n],a=[],i=new Set,m=new Set(r),f=function(l){!l||i.has(l)||(i.add(l),f(l.parentNode))};r.forEach(f);var c=function(l){!l||m.has(l)||Array.prototype.forEach.call(l.children,function(u){if(i.has(u))c(u);else try{var h=u.getAttribute(o),g=h!==null&&h!=="false",v=(Tt.get(u)||0)+1,C=(s.get(u)||0)+1;Tt.set(u,v),s.set(u,C),a.push(u),v===1&&g&&wn.set(u,!0),C===1&&u.setAttribute(n,"true"),g||u.setAttribute(o,"true")}catch(w){console.error("aria-hidden: cannot operate on ",u,w)}})};return c(t),i.clear(),pr++,function(){a.forEach(function(l){var u=Tt.get(l)-1,h=s.get(l)-1;Tt.set(l,u),s.set(l,h),u||(wn.has(l)||l.removeAttribute(o),wn.delete(l)),h||l.removeAttribute(n)}),pr--,pr||(Tt=new WeakMap,Tt=new WeakMap,wn=new WeakMap,yn={})}},fo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=vm(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),wm(o,r,n,"aria-hidden")):function(){return null}},Mr=["Enter"," "],ym=["ArrowDown","PageUp","Home"],Ha=["ArrowUp","PageDown","End"],Cm=[...ym,...Ha],Sm={ltr:[...Mr,"ArrowRight"],rtl:[...Mr,"ArrowLeft"]},Em={ltr:["ArrowLeft"],rtl:["ArrowRight"]},un="Menu",[en,km,Am]=ua(un),[_t,Wa]=Ze(un,[Am,Ht,La]),Kn=Ht(),Ga=La(),[_m,jt]=_t(un),[jm,dn]=_t(un),Va=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,i=Kn(t),[m,f]=p.useState(null),c=p.useRef(!1),l=Ye(s),u=da(r);return p.useEffect(()=>{const h=()=>{c.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>c.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),d.jsx(lo,{...i,children:d.jsx(_m,{scope:t,open:n,onOpenChange:l,content:m,onContentChange:f,children:d.jsx(jm,{scope:t,onClose:p.useCallback(()=>l(!1),[l]),isUsingKeyboardRef:c,dir:u,modal:a,children:o})})})};Va.displayName=un;var Rm="MenuAnchor",mo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Kn(n);return d.jsx(Vn,{...r,...o,ref:t})});mo.displayName=Rm;var po="MenuPortal",[Tm,Ka]=_t(po,{forceMount:void 0}),qa=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=jt(po,t);return d.jsx(Tm,{scope:t,forceMount:n,children:d.jsx(Te,{present:n||s.open,children:d.jsx(ln,{asChild:!0,container:r,children:o})})})};qa.displayName=po;var Ie="MenuContent",[Nm,ho]=_t(Ie),Ya=p.forwardRef((e,t)=>{const n=Ka(Ie,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=jt(Ie,e.__scopeMenu),a=dn(Ie,e.__scopeMenu);return d.jsx(en.Provider,{scope:e.__scopeMenu,children:d.jsx(Te,{present:o||s.open,children:d.jsx(en.Slot,{scope:e.__scopeMenu,children:a.modal?d.jsx(Im,{...r,ref:t}):d.jsx(Pm,{...r,ref:t})})})})}),Im=p.forwardRef((e,t)=>{const n=jt(Ie,e.__scopeMenu),o=p.useRef(null),r=pe(t,o);return p.useEffect(()=>{const s=o.current;if(s)return fo(s)},[]),d.jsx(go,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Pm=p.forwardRef((e,t)=>{const n=jt(Ie,e.__scopeMenu);return d.jsx(go,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Mm=Dt("MenuContent.ScrollLock"),go=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,onDismiss:h,disableOutsideScroll:g,...v}=e,C=jt(Ie,n),w=dn(Ie,n),_=Kn(n),R=Ga(n),A=km(n),[F,y]=p.useState(null),j=p.useRef(null),x=pe(t,j,C.onContentChange),b=p.useRef(0),I=p.useRef(""),O=p.useRef(0),M=p.useRef(null),$=p.useRef("right"),P=p.useRef(0),U=g?qr:p.Fragment,E=g?{as:Mm,allowPinchZoom:!0}:void 0,S=k=>{var V,X;const N=I.current+k,H=A().filter(K=>!K.disabled),T=document.activeElement,B=(V=H.find(K=>K.ref.current===T))==null?void 0:V.textValue,z=H.map(K=>K.textValue),L=Vm(z,N,B),G=(X=H.find(K=>K.textValue===L))==null?void 0:X.ref.current;(function K(ne){I.current=ne,window.clearTimeout(b.current),ne!==""&&(b.current=window.setTimeout(()=>K(""),1e3))})(N),G&&setTimeout(()=>G.focus())};p.useEffect(()=>()=>window.clearTimeout(b.current),[]),Jr();const D=p.useCallback(k=>{var H,T;return $.current===((H=M.current)==null?void 0:H.side)&&qm(k,(T=M.current)==null?void 0:T.area)},[]);return d.jsx(Nm,{scope:n,searchRef:I,onItemEnter:p.useCallback(k=>{D(k)&&k.preventDefault()},[D]),onItemLeave:p.useCallback(k=>{var N;D(k)||((N=j.current)==null||N.focus(),y(null))},[D]),onTriggerLeave:p.useCallback(k=>{D(k)&&k.preventDefault()},[D]),pointerGraceTimerRef:O,onPointerGraceIntentChange:p.useCallback(k=>{M.current=k},[]),children:d.jsx(U,{...E,children:d.jsx(zn,{asChild:!0,trapped:r,onMountAutoFocus:ee(s,k=>{var N;k.preventDefault(),(N=j.current)==null||N.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:d.jsx(sn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,onDismiss:h,children:d.jsx(gm,{asChild:!0,...R,dir:w.dir,orientation:"vertical",loop:o,currentTabStopId:F,onCurrentTabStopIdChange:y,onEntryFocus:ee(m,k=>{w.isUsingKeyboardRef.current||k.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(co,{role:"menu","aria-orientation":"vertical","data-state":di(C.open),"data-radix-menu-content":"",dir:w.dir,..._,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:ee(v.onKeyDown,k=>{const H=k.target.closest("[data-radix-menu-content]")===k.currentTarget,T=k.ctrlKey||k.altKey||k.metaKey,B=k.key.length===1;H&&(k.key==="Tab"&&k.preventDefault(),!T&&B&&S(k.key));const z=j.current;if(k.target!==z||!Cm.includes(k.key))return;k.preventDefault();const G=A().filter(V=>!V.disabled).map(V=>V.ref.current);Ha.includes(k.key)&&G.reverse(),Wm(G)}),onBlur:ee(e.onBlur,k=>{k.currentTarget.contains(k.target)||(window.clearTimeout(b.current),I.current="")}),onPointerMove:ee(e.onPointerMove,tn(k=>{const N=k.target,H=P.current!==k.clientX;if(k.currentTarget.contains(N)&&H){const T=k.clientX>P.current?"right":"left";$.current=T,P.current=k.clientX}}))})})})})})})});Ya.displayName=Ie;var Om="MenuGroup",xo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return d.jsx(ue.div,{role:"group",...o,ref:t})});xo.displayName=Om;var Dm="MenuLabel",Xa=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return d.jsx(ue.div,{...o,ref:t})});Xa.displayName=Dm;var Nn="MenuItem",ps="menu.itemSelect",qn=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=p.useRef(null),a=dn(Nn,e.__scopeMenu),i=ho(Nn,e.__scopeMenu),m=pe(t,s),f=p.useRef(!1),c=()=>{const l=s.current;if(!n&&l){const u=new CustomEvent(ps,{bubbles:!0,cancelable:!0});l.addEventListener(ps,h=>o==null?void 0:o(h),{once:!0}),ca(l,u),u.defaultPrevented?f.current=!1:a.onClose()}};return d.jsx(Qa,{...r,ref:m,disabled:n,onClick:ee(e.onClick,c),onPointerDown:l=>{var u;(u=e.onPointerDown)==null||u.call(e,l),f.current=!0},onPointerUp:ee(e.onPointerUp,l=>{var u;f.current||(u=l.currentTarget)==null||u.click()}),onKeyDown:ee(e.onKeyDown,l=>{const u=i.searchRef.current!=="";n||u&&l.key===" "||Mr.includes(l.key)&&(l.currentTarget.click(),l.preventDefault())})})});qn.displayName=Nn;var Qa=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=ho(Nn,n),i=Ga(n),m=p.useRef(null),f=pe(t,m),[c,l]=p.useState(!1),[u,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[s.children]),d.jsx(en.ItemSlot,{scope:n,disabled:o,textValue:r??u,children:d.jsx(xm,{asChild:!0,...i,focusable:!o,children:d.jsx(ue.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:ee(e.onPointerMove,tn(g=>{o?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ee(e.onPointerLeave,tn(g=>a.onItemLeave(g))),onFocus:ee(e.onFocus,()=>l(!0)),onBlur:ee(e.onBlur,()=>l(!1))})})})}),Lm="MenuCheckboxItem",Za=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return d.jsx(ri,{scope:e.__scopeMenu,checked:n,children:d.jsx(qn,{role:"menuitemcheckbox","aria-checked":In(n)?"mixed":n,...r,ref:t,"data-state":bo(n),onSelect:ee(r.onSelect,()=>o==null?void 0:o(In(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Za.displayName=Lm;var Ja="MenuRadioGroup",[Fm,$m]=_t(Ja,{value:void 0,onValueChange:()=>{}}),ei=p.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=Ye(o);return d.jsx(Fm,{scope:e.__scopeMenu,value:n,onValueChange:s,children:d.jsx(xo,{...r,ref:t})})});ei.displayName=Ja;var ti="MenuRadioItem",ni=p.forwardRef((e,t)=>{const{value:n,...o}=e,r=$m(ti,e.__scopeMenu),s=n===r.value;return d.jsx(ri,{scope:e.__scopeMenu,checked:s,children:d.jsx(qn,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":bo(s),onSelect:ee(o.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,n)},{checkForDefaultPrevented:!1})})})});ni.displayName=ti;var vo="MenuItemIndicator",[ri,Um]=_t(vo,{checked:!1}),oi=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=Um(vo,n);return d.jsx(Te,{present:o||In(s.checked)||s.checked===!0,children:d.jsx(ue.span,{...r,ref:t,"data-state":bo(s.checked)})})});oi.displayName=vo;var zm="MenuSeparator",si=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return d.jsx(ue.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});si.displayName=zm;var Bm="MenuArrow",ai=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Kn(n);return d.jsx(uo,{...r,...o,ref:t})});ai.displayName=Bm;var Hm="MenuSub",[Wv,ii]=_t(Hm),Qt="MenuSubTrigger",li=p.forwardRef((e,t)=>{const n=jt(Qt,e.__scopeMenu),o=dn(Qt,e.__scopeMenu),r=ii(Qt,e.__scopeMenu),s=ho(Qt,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=s,f={__scopeMenu:e.__scopeMenu},c=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>c,[c]),p.useEffect(()=>{const l=i.current;return()=>{window.clearTimeout(l),m(null)}},[i,m]),d.jsx(mo,{asChild:!0,...f,children:d.jsx(Qa,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":di(n.open),...e,ref:He(t,r.onTriggerChange),onClick:l=>{var u;(u=e.onClick)==null||u.call(e,l),!(e.disabled||l.defaultPrevented)&&(l.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ee(e.onPointerMove,tn(l=>{s.onItemEnter(l),!l.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100))})),onPointerLeave:ee(e.onPointerLeave,tn(l=>{var h,g;c();const u=(h=n.content)==null?void 0:h.getBoundingClientRect();if(u){const v=(g=n.content)==null?void 0:g.dataset.side,C=v==="right",w=C?-5:5,_=u[C?"left":"right"],R=u[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:l.clientX+w,y:l.clientY},{x:_,y:u.top},{x:R,y:u.top},{x:R,y:u.bottom},{x:_,y:u.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(l),l.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ee(e.onKeyDown,l=>{var h;const u=s.searchRef.current!=="";e.disabled||u&&l.key===" "||Sm[o.dir].includes(l.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),l.preventDefault())})})})});li.displayName=Qt;var ci="MenuSubContent",ui=p.forwardRef((e,t)=>{const n=Ka(Ie,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=jt(Ie,e.__scopeMenu),a=dn(Ie,e.__scopeMenu),i=ii(ci,e.__scopeMenu),m=p.useRef(null),f=pe(t,m);return d.jsx(en.Provider,{scope:e.__scopeMenu,children:d.jsx(Te,{present:o||s.open,children:d.jsx(en.Slot,{scope:e.__scopeMenu,children:d.jsx(go,{id:i.contentId,"aria-labelledby":i.triggerId,...r,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var l;a.isUsingKeyboardRef.current&&((l=m.current)==null||l.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:ee(e.onFocusOutside,c=>{c.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ee(e.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:ee(e.onKeyDown,c=>{var h;const l=c.currentTarget.contains(c.target),u=Em[a.dir].includes(c.key);l&&u&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),c.preventDefault())})})})})})});ui.displayName=ci;function di(e){return e?"open":"closed"}function In(e){return e==="indeterminate"}function bo(e){return In(e)?"indeterminate":e?"checked":"unchecked"}function Wm(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Gm(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function Vm(e,t,n){const r=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=Gm(e,Math.max(s,0));r.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(r.toLowerCase()));return m!==n?m:void 0}function Km(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,c=i.y,l=m.x,u=m.y;c>o!=u>o&&n<(l-f)*(o-c)/(u-c)+f&&(r=!r)}return r}function qm(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Km(n,t)}function tn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Ym=Va,Xm=mo,Qm=qa,Zm=Ya,Jm=xo,ep=Xa,tp=qn,np=Za,rp=ei,op=ni,sp=oi,ap=si,ip=ai,lp=li,cp=ui,Yn="DropdownMenu",[up]=Ze(Yn,[Wa]),Se=Wa(),[dp,fi]=up(Yn),mi=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Se(t),f=p.useRef(null),[c,l]=it({prop:r,defaultProp:s??!1,onChange:a,caller:Yn});return d.jsx(dp,{scope:t,triggerId:Ce(),triggerRef:f,contentId:Ce(),open:c,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(u=>!u),[l]),modal:i,children:d.jsx(Ym,{...m,open:c,onOpenChange:l,dir:o,modal:i,children:n})})};mi.displayName=Yn;var pi="DropdownMenuTrigger",hi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=fi(pi,n),a=Se(n);return d.jsx(Xm,{asChild:!0,...a,children:d.jsx(ue.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:He(t,s.triggerRef),onPointerDown:ee(e.onPointerDown,i=>{!o&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:ee(e.onKeyDown,i=>{o||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});hi.displayName=pi;var fp="DropdownMenuPortal",gi=e=>{const{__scopeDropdownMenu:t,...n}=e,o=Se(t);return d.jsx(Qm,{...o,...n})};gi.displayName=fp;var xi="DropdownMenuContent",vi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=fi(xi,n),s=Se(n),a=p.useRef(!1);return d.jsx(Zm,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:ee(e.onCloseAutoFocus,i=>{var m;a.current||(m=r.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:ee(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,c=m.button===2||f;(!r.modal||c)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});vi.displayName=xi;var mp="DropdownMenuGroup",pp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(Jm,{...r,...o,ref:t})});pp.displayName=mp;var hp="DropdownMenuLabel",bi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(ep,{...r,...o,ref:t})});bi.displayName=hp;var gp="DropdownMenuItem",wi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(tp,{...r,...o,ref:t})});wi.displayName=gp;var xp="DropdownMenuCheckboxItem",vp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(np,{...r,...o,ref:t})});vp.displayName=xp;var bp="DropdownMenuRadioGroup",wp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(rp,{...r,...o,ref:t})});wp.displayName=bp;var yp="DropdownMenuRadioItem",Cp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(op,{...r,...o,ref:t})});Cp.displayName=yp;var Sp="DropdownMenuItemIndicator",Ep=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(sp,{...r,...o,ref:t})});Ep.displayName=Sp;var kp="DropdownMenuSeparator",yi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(ap,{...r,...o,ref:t})});yi.displayName=kp;var Ap="DropdownMenuArrow",_p=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(ip,{...r,...o,ref:t})});_p.displayName=Ap;var jp="DropdownMenuSubTrigger",Rp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(lp,{...r,...o,ref:t})});Rp.displayName=jp;var Tp="DropdownMenuSubContent",Np=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Se(n);return d.jsx(cp,{...r,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Np.displayName=Tp;var Ip=mi,Pp=hi,Mp=gi,Op=vi,Dp=bi,Lp=wi,Fp=yi;function Ci({...e}){return d.jsx(Ip,{"data-slot":"dropdown-menu",...e})}function Si({...e}){return d.jsx(Pp,{"data-slot":"dropdown-menu-trigger",...e})}function Ei({className:e,sideOffset:t=4,...n}){return d.jsx(Mp,{children:d.jsx(Op,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Z("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Sn({className:e,inset:t,variant:n="default",...o}){return d.jsx(Lp,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Z("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o})}function $p({className:e,inset:t,...n}){return d.jsx(Dp,{"data-slot":"dropdown-menu-label","data-inset":t,className:Z("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function hs({className:e,...t}){return d.jsx(Fp,{"data-slot":"dropdown-menu-separator",className:Z("bg-border -mx-1 my-1 h-px",e),...t})}const Up=[{value:"light",label:"Light",icon:d.jsx(na,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:d.jsx(Js,{className:"h-4 w-4"})},{value:"system",label:"System",icon:d.jsx(Su,{className:"h-4 w-4"})}];function zp(){const{theme:e,setTheme:t,resolvedTheme:n}=td();return d.jsxs(Ci,{children:[d.jsx(Si,{asChild:!0,children:d.jsxs(At,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?d.jsx(Js,{className:"h-4 w-4"}):d.jsx(na,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),d.jsx(Ei,{align:"end",children:Up.map(o=>d.jsxs(Sn,{onClick:()=>t(o.value),className:e===o.value?"bg-accent":"",children:[o.icon,d.jsx("span",{className:"ml-2",children:o.label})]},o.value))})]})}const gs={"auth.setup.title":"首次部署","auth.setup.apiKey":"API Key","auth.setup.username":"管理员用户名","auth.setup.password":"密码","auth.setup.confirmPassword":"确认密码","auth.setup.submit":"初始化","auth.setup.passwordMismatch":"两次密码不一致","auth.setup.passwordTooShort":"密码至少 8 个字符","auth.setup.alreadyDone":"初始化已完成,请登录","auth.setup.invalidKey":"API Key 无效","auth.setup.description":"输入 RCS_API_KEYS 之一,并设置管理员账号密码。","auth.login.title":"登录","auth.login.username":"用户名","auth.login.password":"密码","auth.login.submit":"登录","auth.login.failed":"用户名或密码错误","auth.login.description":"输入你的用户名和密码以继续。","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.create.title":"创建团队","team.create.name":"团队名称","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"用户 ID(在「个人设置」可查看)","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.share":"分享会话","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.metaSession":"会话","session.metaEnvironment":"环境","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","user.settings.language":"语言","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},Bp={"auth.setup.title":"First-time setup","auth.setup.apiKey":"API Key","auth.setup.username":"Admin username","auth.setup.password":"Password","auth.setup.confirmPassword":"Confirm password","auth.setup.submit":"Initialize","auth.setup.passwordMismatch":"Passwords do not match","auth.setup.passwordTooShort":"Password must be at least 8 characters","auth.setup.alreadyDone":"Setup already completed. Please log in.","auth.setup.invalidKey":"Invalid API key","auth.setup.description":"Enter one of RCS_API_KEYS and set your admin credentials.","auth.login.title":"Login","auth.login.username":"Username","auth.login.password":"Password","auth.login.submit":"Log in","auth.login.failed":"Invalid username or password","auth.login.description":"Enter your username and password to continue.","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.create.title":"Create team","team.create.name":"Team Name","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"User ID (visible in Settings)","share.teamIdPlaceholder":"Team ID (visible in Team Details)","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.share":"Share Session","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.metaSession":"Session","session.metaEnvironment":"Environment","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.inputPlaceholder":"Type a message...","session.connectingAgent":"Connecting to agent...","session.connectionFailed":"Connection Failed","user.settings.language":"Language","user.settings.role":"Role","user.settings.backDashboard":"← Dashboard","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},ki="rcs_locale";function Hp(){try{const t=localStorage.getItem(ki);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let wo=Hp();const Or=new Set;function Gv(e){wo=e;try{localStorage.setItem(ki,e)}catch{}Or.forEach(t=>t())}function Wp(e){return Or.add(e),()=>{Or.delete(e)}}function Ai(){return p.useSyncExternalStore(Wp,()=>wo)}function Ke(e){return wo==="en"?Bp[e]??gs[e]??e:gs[e]??e}const Gp="";let Pn=null;function Vp(e){Pn=e}function Vv(){return Pn}let Dr=null;function xs(e){Dr=e}let qt=null;async function Kp(){return qt||(qt=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{qt=null}})(),qt)}class hr extends Error{constructor(n,o,r){super(n);se(this,"type");se(this,"status");this.name="ApiError",this.type=o,this.status=r}}async function we(e,t,n,o){const r={"Content-Type":"application/json"};Pn&&(r.Authorization=`Bearer ${Pn}`);const s=`${Gp}${t}`,a={method:e,headers:r,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(s,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!o&&await Kp())return we(e,t,n,!0);Dr&&Dr()}let m;try{m=await i.json()}catch{throw i.ok?new hr("Invalid JSON response","parse_error",i.status):new hr(i.statusText,"http_error",i.status)}if(!i.ok){const c=m.error||{type:"unknown",message:i.statusText};throw new hr(c.message||c.type||"unknown",c.type||"unknown",i.status)}return m}function Kv(){return we("GET","/web/sessions/all")}function qv(e){return we("GET",`/web/sessions/${e}`)}function Yv(e){return we("GET",`/web/sessions/${e}/history`)}function Xv(){return we("GET","/web/environments")}function Qv(e,t){return we("POST",`/web/sessions/${e}/events`,t)}function Zv(e,t){return we("POST",`/web/sessions/${e}/control`,t)}function Jv(e){return we("POST",`/web/sessions/${e}/interrupt`)}function eb(e){return we("DELETE",`/web/sessions/${e}`)}function tb(e){return we("POST","/web/sessions",e)}function nb(e){return we("GET",`/web/sessions/s/${e}`)}function rb(e){return we("GET",`/web/sessions/${e}/shares`)}function ob(e,t){return we("POST",`/web/sessions/${e}/shares`,t)}function sb(e,t){return we("DELETE",`/web/sessions/${e}/shares/${t}`)}const Lr="rcs_active_team";function qp(){try{return localStorage.getItem(Lr)}catch{return null}}let _i=qp();const Fr=new Set;function Yp(){for(const e of Fr)e()}function Xp(e){return Fr.add(e),()=>Fr.delete(e)}function Qp(){return _i}function Zp(e){try{e?localStorage.setItem(Lr,e):localStorage.removeItem(Lr)}catch{}_i=e,Yp()}function Jp(){const[e,t]=p.useState([]),[n,o]=p.useState(!0),r=p.useSyncExternalStore(Xp,Qp,()=>null),s=p.useCallback(async()=>{o(!0);try{const f=await we("GET","/web/teams");t(f)}catch{t([])}finally{o(!1)}},[]);p.useEffect(()=>{s()},[s]);const a=e.find(f=>f.id===r)||null,i=p.useCallback(f=>{Zp(f)},[]),m=p.useCallback(async f=>{const c=await we("POST","/web/teams",f);return await s(),c},[s]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:s}}function eh({className:e}){Ai();const{myTeams:t,activeTeam:n,switchTeam:o,isLoading:r}=Jp();return r||t.length===0?null:d.jsxs("div",{className:Z("relative",e),children:[d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-2 px-3 py-1.5 pr-7 text-sm text-text-primary hover:bg-surface-3 transition-colors cursor-pointer",value:(n==null?void 0:n.id)||"",onChange:s=>{const a=s.target.value;o(a||null)},children:[d.jsx("option",{value:"",children:Ke("team.switcher.personal")}),t.map(s=>d.jsx("option",{value:s.id,children:s.name},s.id))]}),d.jsx(Ut,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted pointer-events-none"})]})}const ji=p.createContext(null);function Ri(){const e=p.useContext(ji);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Yt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function th(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function gr(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function nh({children:e}){const[t,n]=p.useState(null),[o,r]=p.useState(!0);p.useEffect(()=>{let l=!1;return Yt().then(u=>{l||(n(u),r(!1))}),xs(()=>{n(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{l=!0,xs(null)}},[]);const s=p.useCallback(async(l,u)=>{const h=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:l,password:u})});if(!h.ok){const v=await gr(h);throw new Error(v.error||"Login failed")}const g=await Yt();n(g)},[]),a=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null)},[]),i=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const u=await Yt();return n(u),!0}catch{return!1}},[]),m=p.useCallback(async(l,u,h)=>{const g=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,username:u,password:h})});if(!g.ok){const C=await gr(g);throw new Error(C.error||"Setup failed")}const v=await Yt();n(v)},[]),f=p.useCallback(async(l,u,h)=>{const g=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:l,username:u,password:h})});if(!g.ok){const C=await gr(g);throw new Error(C.error||"Join failed")}const v=await Yt();n(v)},[]),c=p.useCallback(async()=>th(),[]);return d.jsx(ji.Provider,{value:{user:t,isLoading:o,login:s,logout:a,refresh:i,setup:m,join:f,checkSetupStatus:c},children:e})}function rh({onSettingsClick:e}){const{user:t,logout:n}=Ri();if(!t)return null;const o=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return d.jsxs(Ci,{children:[d.jsx(Si,{asChild:!0,children:d.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-primary hover:bg-surface-2 transition-colors",title:t.username,children:[d.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand",children:d.jsx(ra,{className:"h-3.5 w-3.5"})}),d.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),d.jsxs(Ei,{align:"end",className:"w-48",children:[d.jsx($p,{children:d.jsxs("div",{className:"flex flex-col space-y-0.5",children:[d.jsx("span",{className:"text-sm font-medium",children:t.username}),d.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),d.jsx(hs,{}),d.jsxs(Sn,{onClick:e,children:[d.jsx($u,{className:"mr-2 h-4 w-4"}),Ke("user.menu.settings")]}),d.jsxs(Sn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[d.jsx(Ju,{className:"mr-2 h-4 w-4"}),Ke("team.menu.myTeams")]}),d.jsx(hs,{}),d.jsxs(Sn,{onClick:o,children:[d.jsx(bu,{className:"mr-2 h-4 w-4"}),Ke("user.menu.logout")]})]})]})}function oh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:o}){return Ai(),d.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:d.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[d.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[!e&&d.jsx(eh,{}),e?d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[d.jsx(su,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:Ke("nav.dashboard")})]}),d.jsx("span",{className:"text-text-muted/40",children:"/"}),d.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&d.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):d.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[d.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:d.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"var(--color-brand)"})}),d.jsx("span",{className:"hidden sm:inline",children:Ke("nav.remoteControl")})]})]}),d.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!e&&d.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:Ke("nav.dashboard"),children:[d.jsx(gu,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:Ke("nav.dashboard")})]}),d.jsx(zp,{}),d.jsx(rh,{onSettingsClick:o??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function ab({status:e}){const t={active:"bg-status-active/20 text-status-active",running:"bg-status-running/20 text-status-running",idle:"bg-status-idle/20 text-status-idle",inactive:"bg-text-muted/20 text-text-muted",requires_action:"bg-status-warning/20 text-status-warning",archived:"bg-text-muted/20 text-text-muted",error:"bg-status-error/20 text-status-error"};return d.jsx("span",{className:Z("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t[e]||"bg-surface-3 text-text-secondary"),children:e})}function sh(e){const t=new TextEncoder().encode(e);let n="";for(const r of t)n+=String.fromCharCode(r);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Ti extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const at=class at{constructor(t){se(this,"ws",null);se(this,"settings");se(this,"connectionState","disconnected");se(this,"sessionId",null);se(this,"_agentCapabilities",null);se(this,"_promptCapabilities",null);se(this,"_modelState",null);se(this,"_availableCommands",[]);se(this,"onModelChanged",new Set);se(this,"onModelStateChanged",new Set);se(this,"onAvailableCommandsChanged",null);se(this,"onSessionLoaded",null);se(this,"onSessionSwitching",null);se(this,"onConnectionStateChange",new Set);se(this,"onSessionUpdate",null);se(this,"onSessionCreated",null);se(this,"onPromptComplete",null);se(this,"onPermissionRequest",null);se(this,"onBrowserToolCall",null);se(this,"onErrorMessage",null);se(this,"onSessionDeleted",null);se(this,"onSessionRenamed",null);se(this,"pendingSessionList",null);se(this,"pendingSessionLoad",null);se(this,"pendingSessionResume",null);se(this,"pendingSessionTarget",null);se(this,"connectResolve",null);se(this,"connectReject",null);se(this,"heartbeatInterval",null);se(this,"heartbeatTimeout",null);se(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const o of this.onConnectionStateChange)o(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.resume)!==null}get supportsSessionList(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const o=new WebSocket(this.settings.proxyUrl,this.settings.token?[sh(this.settings.token)]:void 0);this.ws=o,o.onopen=()=>{if(this.ws!==o){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),o.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},o.onmessage=r=>{if(this.ws===o)try{const s=JSON.parse(r.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},o.onerror=()=>{var r;this.ws===o&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(r=this.connectReject)==null||r.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},o.onclose=r=>{if(this.ws===o){if(console.log("[ACPClient] WebSocket closed",r.code,r.reason),this.connectReject){const s=r.reason||`Connection closed (code: ${r.code})`;this.setState("error",s),this.connectReject(new Error(s)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(o){this.setState("error",o.message),n(o)}})}handleResponse(t){var n,o,r,s,a,i,m,f,c,l,u,h,g;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const v=((o=t.payload)==null?void 0:o.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(r=this.onErrorMessage)==null||r.call(this,v));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(s=this.onSessionCreated)==null||s.call(this,t.payload.sessionId);for(const w of this.onModelStateChanged)w(this._modelState);break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const w of this.onModelStateChanged)w(this._modelState);break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const w of this.onModelStateChanged)w(this._modelState);break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const C=(c=t.payload.update)==null?void 0:c.sessionUpdate;console.log("[ACPClient] session_update type:",C,"payload:",t.payload),C==="available_commands_update"&&(this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(l=this.onAvailableCommandsChanged)==null||l.call(this,this._availableCommands)),(u=this.onSessionUpdate)==null||u.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(g=this.onPermissionRequest)==null||g.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const w of this.onModelChanged)w(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const o=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:o})}catch(o){console.error("[ACPClient] Browser tool error:",o),this.send({type:"browser_tool_result",callId:t,result:{error:o.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=at.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},at.PONG_TIMEOUT_MS)},at.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const o=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:o,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const o=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:o}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,o)=>{const r=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,o(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:o,timer:r};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(r),this.pendingSessionList=null,o(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:o,timer:r};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,o(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:o,timer:r};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionResume=null,o(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Ti),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const o of this.onModelStateChanged)o(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]);const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};se(at,"HEARTBEAT_INTERVAL_MS",3e4),se(at,"PONG_TIMEOUT_MS",1e4),se(at,"MAX_MISSED_PONGS",2);let $r=at;function ah(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(o){if(o!=="default"&&!(o in e)){var r=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:function(){return n[o]}})}}))})),Object.freeze(e)}function Ni(e,t){return new Promise((function(n,o){let r;return ih(e).then((function(s){try{return r=s,n(new Blob([t.slice(0,2),r,t.slice(2)],{type:"image/jpeg"}))}catch(a){return o(a)}}),o)}))}const ih=e=>new Promise(((t,n)=>{const o=new FileReader;o.addEventListener("load",(({target:{result:r}})=>{const s=new DataView(r);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const m=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const f=a+10;let c;switch(s.getUint16(f)){case 18761:c=!0;break;case 19789:c=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,c)!==42)return n("TIFF header contains invalid version");const l=s.getUint32(f+4,c),u=f+l+2+12*s.getUint16(f+l,c);for(let h=f+l+2;h<u;h+=12)if(s.getUint16(h,c)==274){if(s.getUint16(h+2,c)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,c)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,c);break}return t(r.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),o.readAsArrayBuffer(e)}));var Mn={},lh={get exports(){return Mn},set exports(e){Mn=e}};(function(e){var t,n,o={};lh.exports=o,o.parse=function(r,s){for(var a=o.bin.readUshort,i=o.bin.readUint,m=0,f={},c=new Uint8Array(r),l=c.length-4;i(c,l)!=101010256;)l--;m=l,m+=4;var u=a(c,m+=4);a(c,m+=2);var h=i(c,m+=2),g=i(c,m+=4);m+=4,m=g;for(var v=0;v<u;v++){i(c,m),m+=4,m+=4,m+=4,i(c,m+=4),h=i(c,m+=4);var C=i(c,m+=4),w=a(c,m+=4),_=a(c,m+2),R=a(c,m+4);m+=6;var A=i(c,m+=8);m+=4,m+=w+_+R,o._readLocal(c,A,f,h,C,s)}return f},o._readLocal=function(r,s,a,i,m,f){var c=o.bin.readUshort,l=o.bin.readUint;l(r,s),c(r,s+=4),c(r,s+=2);var u=c(r,s+=2);l(r,s+=2),l(r,s+=4),s+=4;var h=c(r,s+=8),g=c(r,s+=2);s+=2;var v=o.bin.readUTF8(r,s,h);if(s+=h,s+=g,f)a[v]={size:m,csize:i};else{var C=new Uint8Array(r.buffer,s);if(u==0)a[v]=new Uint8Array(C.buffer.slice(s,s+i));else{if(u!=8)throw"unknown compression method: "+u;var w=new Uint8Array(m);o.inflateRaw(C,w),a[v]=w}}},o.inflateRaw=function(r,s){return o.F.inflate(r,s)},o.inflate=function(r,s){return r[0],r[1],o.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),s)},o.deflate=function(r,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*r.length));i[a]=120,i[a+1]=156,a+=2,a=o.F.deflateRaw(r,i,a,s.level);var m=o.adler(r,0,r.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},o.deflateRaw=function(r,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*r.length)),i=o.F.deflateRaw(r,a,i,s.level);return new Uint8Array(a.buffer,0,i)},o.encode=function(r,s){s==null&&(s=!1);var a=0,i=o.bin.writeUint,m=o.bin.writeUshort,f={};for(var c in r){var l=!o._noNeed(c)&&!s,u=r[c],h=o.crc.crc(u,0,u.length);f[c]={cpr:l,usize:u.length,crc:h,file:l?o.deflateRaw(u):u}}for(var c in f)a+=f[c].file.length+30+46+2*o.bin.sizeUTF8(c);a+=22;var g=new Uint8Array(a),v=0,C=[];for(var c in f){var w=f[c];C.push(v),v=o._writeHeader(g,v,c,w,0)}var _=0,R=v;for(var c in f)w=f[c],C.push(v),v=o._writeHeader(g,v,c,w,1,C[_++]);var A=v-R;return i(g,v,101010256),v+=4,m(g,v+=4,_),m(g,v+=2,_),i(g,v+=2,A),i(g,v+=4,R),v+=4,v+=2,g.buffer},o._noNeed=function(r){var s=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},o._writeHeader=function(r,s,a,i,m,f){var c=o.bin.writeUint,l=o.bin.writeUshort,u=i.file;return c(r,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),l(r,s,20),l(r,s+=2,0),l(r,s+=2,i.cpr?8:0),c(r,s+=2,0),c(r,s+=4,i.crc),c(r,s+=4,u.length),c(r,s+=4,i.usize),l(r,s+=4,o.bin.sizeUTF8(a)),l(r,s+=2,0),s+=2,m==1&&(s+=2,s+=2,c(r,s+=6,f),s+=4),s+=o.bin.writeUTF8(r,s,a),m==0&&(r.set(u,s),s+=u.length),s},o.crc={table:(function(){for(var r=new Uint32Array(256),s=0;s<256;s++){for(var a=s,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;r[s]=a}return r})(),update:function(r,s,a,i){for(var m=0;m<i;m++)r=o.crc.table[255&(r^s[a+m])]^r>>>8;return r},crc:function(r,s,a){return 4294967295^o.crc.update(4294967295,r,s,a)}},o.adler=function(r,s,a){for(var i=1,m=0,f=s,c=s+a;f<c;){for(var l=Math.min(f+5552,c);f<l;)m+=i+=r[f++];i%=65521,m%=65521}return m<<16|i},o.bin={readUshort:function(r,s){return r[s]|r[s+1]<<8},writeUshort:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255},readUint:function(r,s){return 16777216*r[s+3]+(r[s+2]<<16|r[s+1]<<8|r[s])},writeUint:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255,r[s+2]=a>>16&255,r[s+3]=a>>24&255},readASCII:function(r,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(r[s+m]);return i},writeASCII:function(r,s,a){for(var i=0;i<a.length;i++)r[s+i]=a.charCodeAt(i)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+o.bin.pad(r[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return o.bin.readASCII(r,s,a)}return i},writeUTF8:function(r,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var c=a.charCodeAt(f);if((4294967168&c)==0)r[s+m]=c,m++;else if((4294965248&c)==0)r[s+m]=192|c>>6,r[s+m+1]=128|c>>0&63,m+=2;else if((4294901760&c)==0)r[s+m]=224|c>>12,r[s+m+1]=128|c>>6&63,r[s+m+2]=128|c>>0&63,m+=3;else{if((4292870144&c)!=0)throw"e";r[s+m]=240|c>>18,r[s+m+1]=128|c>>12&63,r[s+m+2]=128|c>>6&63,r[s+m+3]=128|c>>0&63,m+=4}}return m},sizeUTF8:function(r){for(var s=r.length,a=0,i=0;i<s;i++){var m=r.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},o.F={},o.F.deflateRaw=function(r,s,a,i){var m=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=o.F.U,c=o.F._goodIndex;o.F._hash;var l=o.F._putsE,u=0,h=a<<3,g=0,v=r.length;if(i==0){for(;u<v;)l(s,h,u+(O=Math.min(65535,v-u))==v?1:0),h=o.F._copyExact(r,u,O,s,h+8),u+=O;return h>>>3}var C=f.lits,w=f.strt,_=f.prev,R=0,A=0,F=0,y=0,j=0,x=0;for(v>2&&(w[x=o.F._hash(r,0)]=0),u=0;u<v;u++){if(j=x,u+1<v-2){x=o.F._hash(r,u+1);var b=u+1&32767;_[b]=w[x],w[x]=b}if(g<=u){(R>14e3||A>26697)&&v-u>100&&(g<u&&(C[R]=u-g,R+=2,g=u),h=o.F._writeBlock(u==v-1||g==v?1:0,C,R,y,r,F,u-F,s,h),R=A=y=0,F=u);var I=0;u<v-2&&(I=o.F._bestMatch(r,u,_,j,Math.min(m[2],v-u),m[3]));var O=I>>>16,M=65535&I;if(I!=0){M=65535&I;var $=c(O=I>>>16,f.of0);f.lhst[257+$]++;var P=c(M,f.df0);f.dhst[P]++,y+=f.exb[$]+f.dxb[P],C[R]=O<<23|u-g,C[R+1]=M<<16|$<<8|P,R+=2,g=u+O}else f.lhst[r[u]]++;A++}}for(F==u&&r.length!=0||(g<u&&(C[R]=u-g,R+=2,g=u),h=o.F._writeBlock(1,C,R,y,r,F,u-F,s,h),R=0,A=0,R=A=y=0,F=u);(7&h)!=0;)h++;return h>>>3},o.F._bestMatch=function(r,s,a,i,m,f){var c=32767&s,l=a[c],u=c-l+32768&32767;if(l==c||i!=o.F._hash(r,s-u))return 0;for(var h=0,g=0,v=Math.min(32767,s);u<=v&&--f!=0&&l!=c;){if(h==0||r[s+h]==r[s+h-u]){var C=o.F._howLong(r,s,u);if(C>h){if(g=u,(h=C)>=m)break;u+2<C&&(C=u+2);for(var w=0,_=0;_<C-2;_++){var R=s-u+_+32768&32767,A=R-a[R]+32768&32767;A>w&&(w=A,l=R)}}}u+=(c=l)-(l=a[c])+32768&32767}return h<<16|g},o.F._howLong=function(r,s,a){if(r[s]!=r[s-a]||r[s+1]!=r[s+1-a]||r[s+2]!=r[s+2-a])return 0;var i=s,m=Math.min(r.length,s+258);for(s+=3;s<m&&r[s]==r[s-a];)s++;return s-i},o.F._hash=function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<4)&65535},o.saved=0,o.F._writeBlock=function(r,s,a,i,m,f,c,l,u){var h,g,v,C,w,_,R,A,F,y=o.F.U,j=o.F._putsF,x=o.F._putsE;y.lhst[256]++,g=(h=o.F.getTrees())[0],v=h[1],C=h[2],w=h[3],_=h[4],R=h[5],A=h[6],F=h[7];var b=32+((u+3&7)==0?0:8-(u+3&7))+(c<<3),I=i+o.F.contSize(y.fltree,y.lhst)+o.F.contSize(y.fdtree,y.dhst),O=i+o.F.contSize(y.ltree,y.lhst)+o.F.contSize(y.dtree,y.dhst);O+=14+3*R+o.F.contSize(y.itree,y.ihst)+(2*y.ihst[16]+3*y.ihst[17]+7*y.ihst[18]);for(var M=0;M<286;M++)y.lhst[M]=0;for(M=0;M<30;M++)y.dhst[M]=0;for(M=0;M<19;M++)y.ihst[M]=0;var $=b<I&&b<O?0:I<O?1:2;if(j(l,u,r),j(l,u+1,$),u+=3,$==0){for(;(7&u)!=0;)u++;u=o.F._copyExact(m,f,c,l,u)}else{var P,U;if($==1&&(P=y.fltree,U=y.fdtree),$==2){o.F.makeCodes(y.ltree,g),o.F.revCodes(y.ltree,g),o.F.makeCodes(y.dtree,v),o.F.revCodes(y.dtree,v),o.F.makeCodes(y.itree,C),o.F.revCodes(y.itree,C),P=y.ltree,U=y.dtree,x(l,u,w-257),x(l,u+=5,_-1),x(l,u+=5,R-4),u+=4;for(var E=0;E<R;E++)x(l,u+3*E,y.itree[1+(y.ordr[E]<<1)]);u+=3*R,u=o.F._codeTiny(A,y.itree,l,u),u=o.F._codeTiny(F,y.itree,l,u)}for(var S=f,D=0;D<a;D+=2){for(var k=s[D],N=k>>>23,H=S+(8388607&k);S<H;)u=o.F._writeLit(m[S++],P,l,u);if(N!=0){var T=s[D+1],B=T>>16,z=T>>8&255,L=255&T;x(l,u=o.F._writeLit(257+z,P,l,u),N-y.of0[z]),u+=y.exb[z],j(l,u=o.F._writeLit(L,U,l,u),B-y.df0[L]),u+=y.dxb[L],S+=N}}u=o.F._writeLit(256,P,l,u)}return u},o.F._copyExact=function(r,s,a,i,m){var f=m>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(r.buffer,s,a),f),m+(a+4<<3)},o.F.getTrees=function(){for(var r=o.F.U,s=o.F._hufTree(r.lhst,r.ltree,15),a=o.F._hufTree(r.dhst,r.dtree,15),i=[],m=o.F._lenCodes(r.ltree,i),f=[],c=o.F._lenCodes(r.dtree,f),l=0;l<i.length;l+=2)r.ihst[i[l]]++;for(l=0;l<f.length;l+=2)r.ihst[f[l]]++;for(var u=o.F._hufTree(r.ihst,r.itree,7),h=19;h>4&&r.itree[1+(r.ordr[h-1]<<1)]==0;)h--;return[s,a,u,m,c,h,i,f]},o.F.getSecond=function(r){for(var s=[],a=0;a<r.length;a+=2)s.push(r[a+1]);return s},o.F.nonZero=function(r){for(var s="",a=0;a<r.length;a+=2)r[a+1]!=0&&(s+=(a>>1)+",");return s},o.F.contSize=function(r,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*r[1+(i<<1)];return a},o.F._codeTiny=function(r,s,a,i){for(var m=0;m<r.length;m+=2){var f=r[m],c=r[m+1];i=o.F._writeLit(f,s,a,i);var l=f==16?2:f==17?3:7;f>15&&(o.F._putsE(a,i,c,l),i+=l)}return i},o.F._lenCodes=function(r,s){for(var a=r.length;a!=2&&r[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=r[i+1],f=i+3<a?r[i+3]:-1,c=i+5<a?r[i+5]:-1,l=i==0?-1:r[i-1];if(m==0&&f==m&&c==m){for(var u=i+5;u+2<a&&r[u+2]==m;)u+=2;(h=Math.min(u+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(m==l&&f==m&&c==m){for(u=i+5;u+2<a&&r[u+2]==m;)u+=2;var h=Math.min(u+1-i>>>1,6);s.push(16,h-3),i+=2*h-2}else s.push(m,0)}return a>>>1},o.F._hufTree=function(r,s,a){var i=[],m=r.length,f=s.length,c=0;for(c=0;c<f;c+=2)s[c]=0,s[c+1]=0;for(c=0;c<m;c++)r[c]!=0&&i.push({lit:c,f:r[c]});var l=i.length,u=i.slice(0);if(l==0)return 0;if(l==1){var h=i[0].lit;return u=h==0?1:0,s[1+(h<<1)]=1,s[1+(u<<1)]=1,1}i.sort((function(A,F){return A.f-F.f}));var g=i[0],v=i[1],C=0,w=1,_=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};w!=l-1;)g=C!=w&&(_==l||i[C].f<i[_].f)?i[C++]:i[_++],v=C!=w&&(_==l||i[C].f<i[_].f)?i[C++]:i[_++],i[w++]={lit:-1,f:g.f+v.f,l:g,r:v};var R=o.F.setDepth(i[w-1],0);for(R>a&&(o.F.restrictDepth(u,a,R),R=a),c=0;c<l;c++)s[1+(u[c].lit<<1)]=u[c].d;return R},o.F.setDepth=function(r,s){return r.lit!=-1?(r.d=s,s):Math.max(o.F.setDepth(r.l,s+1),o.F.setDepth(r.r,s+1))},o.F.restrictDepth=function(r,s,a){var i=0,m=1<<a-s,f=0;for(r.sort((function(l,u){return u.d==l.d?l.f-u.f:u.d-l.d})),i=0;i<r.length&&r[i].d>s;i++){var c=r[i].d;r[i].d=s,f+=m-(1<<a-c)}for(f>>>=a-s;f>0;)(c=r[i].d)<s?(r[i].d++,f-=1<<s-c-1):i++;for(;i>=0;i--)r[i].d==s&&f<0&&(r[i].d--,f++);f!=0&&console.log("debt left")},o.F._goodIndex=function(r,s){var a=0;return s[16|a]<=r&&(a|=16),s[8|a]<=r&&(a|=8),s[4|a]<=r&&(a|=4),s[2|a]<=r&&(a|=2),s[1|a]<=r&&(a|=1),a},o.F._writeLit=function(r,s,a,i){return o.F._putsF(a,i,s[r<<1]),i+s[1+(r<<1)]},o.F.inflate=function(r,s){var a=Uint8Array;if(r[0]==3&&r[1]==0)return s||new a(0);var i=o.F,m=i._bitsF,f=i._bitsE,c=i._decodeTiny,l=i.makeCodes,u=i.codes2map,h=i._get17,g=i.U,v=s==null;v&&(s=new a(r.length>>>2<<3));for(var C,w,_=0,R=0,A=0,F=0,y=0,j=0,x=0,b=0,I=0;_==0;)if(_=m(r,I,1),R=m(r,I+1,2),I+=3,R!=0){if(v&&(s=o.F._check(s,b+(1<<17))),R==1&&(C=g.flmap,w=g.fdmap,j=511,x=31),R==2){A=f(r,I,5)+257,F=f(r,I+5,5)+1,y=f(r,I+10,4)+4,I+=14;for(var O=0;O<38;O+=2)g.itree[O]=0,g.itree[O+1]=0;var M=1;for(O=0;O<y;O++){var $=f(r,I+3*O,3);g.itree[1+(g.ordr[O]<<1)]=$,$>M&&(M=$)}I+=3*y,l(g.itree,M),u(g.itree,M,g.imap),C=g.lmap,w=g.dmap,I=c(g.imap,(1<<M)-1,A+F,r,I,g.ttree);var P=i._copyOut(g.ttree,0,A,g.ltree);j=(1<<P)-1;var U=i._copyOut(g.ttree,A,F,g.dtree);x=(1<<U)-1,l(g.ltree,P),u(g.ltree,P,C),l(g.dtree,U),u(g.dtree,U,w)}for(;;){var E=C[h(r,I)&j];I+=15&E;var S=E>>>4;if(!(S>>>8))s[b++]=S;else{if(S==256)break;var D=b+S-254;if(S>264){var k=g.ldef[S-257];D=b+(k>>>3)+f(r,I,7&k),I+=7&k}var N=w[h(r,I)&x];I+=15&N;var H=N>>>4,T=g.ddef[H],B=(T>>>4)+m(r,I,15&T);for(I+=15&T,v&&(s=o.F._check(s,b+(1<<17)));b<D;)s[b]=s[b++-B],s[b]=s[b++-B],s[b]=s[b++-B],s[b]=s[b++-B];b=D}}}else{(7&I)!=0&&(I+=8-(7&I));var z=4+(I>>>3),L=r[z-4]|r[z-3]<<8;v&&(s=o.F._check(s,b+L)),s.set(new a(r.buffer,r.byteOffset+z,L),b),I=z+L<<3,b+=L}return s.length==b?s:s.slice(0,b)},o.F._check=function(r,s){var a=r.length;if(s<=a)return r;var i=new Uint8Array(Math.max(a<<1,s));return i.set(r,0),i},o.F._decodeTiny=function(r,s,a,i,m,f){for(var c=o.F._bitsE,l=o.F._get17,u=0;u<a;){var h=r[l(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[u]=g,u++;else{var v=0,C=0;g==16?(C=3+c(i,m,2),m+=2,v=f[u-1]):g==17?(C=3+c(i,m,3),m+=3):g==18&&(C=11+c(i,m,7),m+=7);for(var w=u+C;u<w;)f[u]=v,u++}}return m},o.F._copyOut=function(r,s,a,i){for(var m=0,f=0,c=i.length>>>1;f<a;){var l=r[f+s];i[f<<1]=0,i[1+(f<<1)]=l,l>m&&(m=l),f++}for(;f<c;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},o.F.makeCodes=function(r,s){for(var a,i,m,f,c=o.F.U,l=r.length,u=c.bl_count,h=0;h<=s;h++)u[h]=0;for(h=1;h<l;h+=2)u[r[h]]++;var g=c.next_code;for(a=0,u[0]=0,i=1;i<=s;i++)a=a+u[i-1]<<1,g[i]=a;for(m=0;m<l;m+=2)(f=r[m+1])!=0&&(r[m]=g[f],g[f]++)},o.F.codes2map=function(r,s,a){for(var i=r.length,m=o.F.U.rev15,f=0;f<i;f+=2)if(r[f+1]!=0)for(var c=f>>1,l=r[f+1],u=c<<4|l,h=s-l,g=r[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=u,g++},o.F.revCodes=function(r,s){for(var a=o.F.U.rev15,i=15-s,m=0;m<r.length;m+=2){var f=r[m]<<s-r[m+1];r[m]=a[f]>>>i}},o.F._putsE=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8},o.F._putsF=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8,r[i+2]|=a>>>16},o.F._bitsE=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},o.F._bitsF=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},o.F._get17=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)},o.F._get25=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16|r[3+(s>>>3)]<<24)>>>(7&s)},o.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var r=o.F.U,s=0;s<32768;s++){var a=s;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,r.rev15[s]=(a>>>16|a<<16)>>>17}function i(m,f,c){for(;f--!=0;)m.push(0,c)}for(s=0;s<32;s++)r.ldef[s]=r.of0[s]<<3|r.exb[s],r.ddef[s]=r.df0[s]<<4|r.dxb[s];i(r.fltree,144,8),i(r.fltree,112,9),i(r.fltree,24,7),i(r.fltree,8,8),o.F.makeCodes(r.fltree,9),o.F.codes2map(r.fltree,9,r.flmap),o.F.revCodes(r.fltree,9),i(r.fdtree,32,5),o.F.makeCodes(r.fdtree,5),o.F.codes2map(r.fdtree,5,r.fdmap),o.F.revCodes(r.fdtree,5),i(r.itree,19,0),i(r.ltree,286,0),i(r.dtree,30,0),i(r.ttree,320,0)})()})();var ch=ah({__proto__:null,default:Mn},[Mn]);const Me=(function(){var e={nextZero(c,l){for(;c[l]!=0;)l++;return l},readUshort:(c,l)=>c[l]<<8|c[l+1],writeUshort(c,l,u){c[l]=u>>8&255,c[l+1]=255&u},readUint:(c,l)=>16777216*c[l]+(c[l+1]<<16|c[l+2]<<8|c[l+3]),writeUint(c,l,u){c[l]=u>>24&255,c[l+1]=u>>16&255,c[l+2]=u>>8&255,c[l+3]=255&u},readASCII(c,l,u){let h="";for(let g=0;g<u;g++)h+=String.fromCharCode(c[l+g]);return h},writeASCII(c,l,u){for(let h=0;h<u.length;h++)c[l+h]=u.charCodeAt(h)},readBytes(c,l,u){const h=[];for(let g=0;g<u;g++)h.push(c[l+g]);return h},pad:c=>c.length<2?`0${c}`:c,readUTF8(c,l,u){let h,g="";for(let v=0;v<u;v++)g+=`%${e.pad(c[l+v].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(c,l,u)}return h}};function t(c,l,u,h){const g=l*u,v=s(h),C=Math.ceil(l*v/8),w=new Uint8Array(4*g),_=new Uint32Array(w.buffer),{ctype:R}=h,{depth:A}=h,F=e.readUshort;if(R==6){const k=g<<2;if(A==8)for(var y=0;y<k;y+=4)w[y]=c[y],w[y+1]=c[y+1],w[y+2]=c[y+2],w[y+3]=c[y+3];if(A==16)for(y=0;y<k;y++)w[y]=c[y<<1]}else if(R==2){const k=h.tabs.tRNS;if(k==null){if(A==8)for(y=0;y<g;y++){var j=3*y;_[y]=255<<24|c[j+2]<<16|c[j+1]<<8|c[j]}if(A==16)for(y=0;y<g;y++)j=6*y,_[y]=255<<24|c[j+4]<<16|c[j+2]<<8|c[j]}else{var x=k[0];const N=k[1],H=k[2];if(A==8)for(y=0;y<g;y++){var b=y<<2;j=3*y,_[y]=255<<24|c[j+2]<<16|c[j+1]<<8|c[j],c[j]==x&&c[j+1]==N&&c[j+2]==H&&(w[b+3]=0)}if(A==16)for(y=0;y<g;y++)b=y<<2,j=6*y,_[y]=255<<24|c[j+4]<<16|c[j+2]<<8|c[j],F(c,j)==x&&F(c,j+2)==N&&F(c,j+4)==H&&(w[b+3]=0)}}else if(R==3){const k=h.tabs.PLTE,N=h.tabs.tRNS,H=N?N.length:0;if(A==1)for(var I=0;I<u;I++){var O=I*C,M=I*l;for(y=0;y<l;y++){b=M+y<<2;var $=3*(P=c[O+(y>>3)]>>7-((7&y)<<0)&1);w[b]=k[$],w[b+1]=k[$+1],w[b+2]=k[$+2],w[b+3]=P<H?N[P]:255}}if(A==2)for(I=0;I<u;I++)for(O=I*C,M=I*l,y=0;y<l;y++)b=M+y<<2,$=3*(P=c[O+(y>>2)]>>6-((3&y)<<1)&3),w[b]=k[$],w[b+1]=k[$+1],w[b+2]=k[$+2],w[b+3]=P<H?N[P]:255;if(A==4)for(I=0;I<u;I++)for(O=I*C,M=I*l,y=0;y<l;y++)b=M+y<<2,$=3*(P=c[O+(y>>1)]>>4-((1&y)<<2)&15),w[b]=k[$],w[b+1]=k[$+1],w[b+2]=k[$+2],w[b+3]=P<H?N[P]:255;if(A==8)for(y=0;y<g;y++){var P;b=y<<2,$=3*(P=c[y]),w[b]=k[$],w[b+1]=k[$+1],w[b+2]=k[$+2],w[b+3]=P<H?N[P]:255}}else if(R==4){if(A==8)for(y=0;y<g;y++){b=y<<2;var U=c[E=y<<1];w[b]=U,w[b+1]=U,w[b+2]=U,w[b+3]=c[E+1]}if(A==16)for(y=0;y<g;y++){var E;b=y<<2,U=c[E=y<<2],w[b]=U,w[b+1]=U,w[b+2]=U,w[b+3]=c[E+2]}}else if(R==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,I=0;I<u;I++){const k=I*C,N=I*l;if(A==1)for(var S=0;S<l;S++){var D=(U=255*(c[k+(S>>>3)]>>>7-(7&S)&1))==255*x?0:255;_[N+S]=D<<24|U<<16|U<<8|U}else if(A==2)for(S=0;S<l;S++)D=(U=85*(c[k+(S>>>2)]>>>6-((3&S)<<1)&3))==85*x?0:255,_[N+S]=D<<24|U<<16|U<<8|U;else if(A==4)for(S=0;S<l;S++)D=(U=17*(c[k+(S>>>1)]>>>4-((1&S)<<2)&15))==17*x?0:255,_[N+S]=D<<24|U<<16|U<<8|U;else if(A==8)for(S=0;S<l;S++)D=(U=c[k+S])==x?0:255,_[N+S]=D<<24|U<<16|U<<8|U;else if(A==16)for(S=0;S<l;S++)U=c[k+(S<<1)],D=F(c,k+(S<<1))==x?0:255,_[N+S]=D<<24|U<<16|U<<8|U}return w}function n(c,l,u,h){const g=s(c),v=Math.ceil(u*g/8),C=new Uint8Array((v+1+c.interlace)*h);return l=c.tabs.CgBI?r(l,C):o(l,C),c.interlace==0?l=a(l,c,0,u,h):c.interlace==1&&(l=(function(_,R){const A=R.width,F=R.height,y=s(R),j=y>>3,x=Math.ceil(A*y/8),b=new Uint8Array(F*x);let I=0;const O=[0,0,4,0,2,0,1],M=[0,4,0,2,0,1,0],$=[8,8,8,4,4,2,2],P=[8,8,4,4,2,2,1];let U=0;for(;U<7;){const S=$[U],D=P[U];let k=0,N=0,H=O[U];for(;H<F;)H+=S,N++;let T=M[U];for(;T<A;)T+=D,k++;const B=Math.ceil(k*y/8);a(_,R,I,k,N);let z=0,L=O[U];for(;L<F;){let G=M[U],V=I+z*B<<3;for(;G<A;){var E;if(y==1&&(E=(E=_[V>>3])>>7-(7&V)&1,b[L*x+(G>>3)]|=E<<7-((7&G)<<0)),y==2&&(E=(E=_[V>>3])>>6-(7&V)&3,b[L*x+(G>>2)]|=E<<6-((3&G)<<1)),y==4&&(E=(E=_[V>>3])>>4-(7&V)&15,b[L*x+(G>>1)]|=E<<4-((1&G)<<2)),y>=8){const X=L*x+G*j;for(let K=0;K<j;K++)b[X+K]=_[(V>>3)+K]}V+=y,G+=D}z++,L+=S}k*N!=0&&(I+=N*(1+B)),U+=1}return b})(l,c)),l}function o(c,l){return r(new Uint8Array(c.buffer,2,c.length-6),l)}var r=(function(){const c={H:{}};return c.H.N=function(l,u){const h=Uint8Array;let g,v,C=0,w=0,_=0,R=0,A=0,F=0,y=0,j=0,x=0;if(l[0]==3&&l[1]==0)return u||new h(0);const b=c.H,I=b.b,O=b.e,M=b.R,$=b.n,P=b.A,U=b.Z,E=b.m,S=u==null;for(S&&(u=new h(l.length>>>2<<5));C==0;)if(C=I(l,x,1),w=I(l,x+1,2),x+=3,w!=0){if(S&&(u=c.H.W(u,j+(1<<17))),w==1&&(g=E.J,v=E.h,F=511,y=31),w==2){_=O(l,x,5)+257,R=O(l,x+5,5)+1,A=O(l,x+10,4)+4,x+=14;let k=1;for(var D=0;D<38;D+=2)E.Q[D]=0,E.Q[D+1]=0;for(D=0;D<A;D++){const T=O(l,x+3*D,3);E.Q[1+(E.X[D]<<1)]=T,T>k&&(k=T)}x+=3*A,$(E.Q,k),P(E.Q,k,E.u),g=E.w,v=E.d,x=M(E.u,(1<<k)-1,_+R,l,x,E.v);const N=b.V(E.v,0,_,E.C);F=(1<<N)-1;const H=b.V(E.v,_,R,E.D);y=(1<<H)-1,$(E.C,N),P(E.C,N,g),$(E.D,H),P(E.D,H,v)}for(;;){const k=g[U(l,x)&F];x+=15&k;const N=k>>>4;if(!(N>>>8))u[j++]=N;else{if(N==256)break;{let H=j+N-254;if(N>264){const G=E.q[N-257];H=j+(G>>>3)+O(l,x,7&G),x+=7&G}const T=v[U(l,x)&y];x+=15&T;const B=T>>>4,z=E.c[B],L=(z>>>4)+I(l,x,15&z);for(x+=15&z;j<H;)u[j]=u[j++-L],u[j]=u[j++-L],u[j]=u[j++-L],u[j]=u[j++-L];j=H}}}}else{(7&x)!=0&&(x+=8-(7&x));const k=4+(x>>>3),N=l[k-4]|l[k-3]<<8;S&&(u=c.H.W(u,j+N)),u.set(new h(l.buffer,l.byteOffset+k,N),j),x=k+N<<3,j+=N}return u.length==j?u:u.slice(0,j)},c.H.W=function(l,u){const h=l.length;if(u<=h)return l;const g=new Uint8Array(h<<1);return g.set(l,0),g},c.H.R=function(l,u,h,g,v,C){const w=c.H.e,_=c.H.Z;let R=0;for(;R<h;){const A=l[_(g,v)&u];v+=15&A;const F=A>>>4;if(F<=15)C[R]=F,R++;else{let y=0,j=0;F==16?(j=3+w(g,v,2),v+=2,y=C[R-1]):F==17?(j=3+w(g,v,3),v+=3):F==18&&(j=11+w(g,v,7),v+=7);const x=R+j;for(;R<x;)C[R]=y,R++}}return v},c.H.V=function(l,u,h,g){let v=0,C=0;const w=g.length>>>1;for(;C<h;){const _=l[C+u];g[C<<1]=0,g[1+(C<<1)]=_,_>v&&(v=_),C++}for(;C<w;)g[C<<1]=0,g[1+(C<<1)]=0,C++;return v},c.H.n=function(l,u){const h=c.H.m,g=l.length;let v,C,w,_;const R=h.j;for(var A=0;A<=u;A++)R[A]=0;for(A=1;A<g;A+=2)R[l[A]]++;const F=h.K;for(v=0,R[0]=0,C=1;C<=u;C++)v=v+R[C-1]<<1,F[C]=v;for(w=0;w<g;w+=2)_=l[w+1],_!=0&&(l[w]=F[_],F[_]++)},c.H.A=function(l,u,h){const g=l.length,v=c.H.m.r;for(let C=0;C<g;C+=2)if(l[C+1]!=0){const w=C>>1,_=l[C+1],R=w<<4|_,A=u-_;let F=l[C]<<A;const y=F+(1<<A);for(;F!=y;)h[v[F]>>>15-u]=R,F++}},c.H.l=function(l,u){const h=c.H.m.r,g=15-u;for(let v=0;v<l.length;v+=2){const C=l[v]<<u-l[v+1];l[v]=h[C]>>>g}},c.H.M=function(l,u,h){h<<=7&u;const g=u>>>3;l[g]|=h,l[g+1]|=h>>>8},c.H.I=function(l,u,h){h<<=7&u;const g=u>>>3;l[g]|=h,l[g+1]|=h>>>8,l[g+2]|=h>>>16},c.H.e=function(l,u,h){return(l[u>>>3]|l[1+(u>>>3)]<<8)>>>(7&u)&(1<<h)-1},c.H.b=function(l,u,h){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16)>>>(7&u)&(1<<h)-1},c.H.Z=function(l,u){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16)>>>(7&u)},c.H.i=function(l,u){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16|l[3+(u>>>3)]<<24)>>>(7&u)},c.H.m=(function(){const l=Uint16Array,u=Uint32Array;return{K:new l(16),j:new l(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new l(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new u(32),J:new l(512),_:[],h:new l(32),$:[],w:new l(32768),C:[],v:[],d:new l(32768),D:[],u:new l(512),Q:[],r:new l(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new l(65536),g:new l(32768)}})(),(function(){const l=c.H.m;for(var u=0;u<32768;u++){let g=u;g=(2863311530&g)>>>1|(1431655765&g)<<1,g=(3435973836&g)>>>2|(858993459&g)<<2,g=(4042322160&g)>>>4|(252645135&g)<<4,g=(4278255360&g)>>>8|(16711935&g)<<8,l.r[u]=(g>>>16|g<<16)>>>17}function h(g,v,C){for(;v--!=0;)g.push(0,C)}for(u=0;u<32;u++)l.q[u]=l.S[u]<<3|l.T[u],l.c[u]=l.p[u]<<4|l.z[u];h(l._,144,8),h(l._,112,9),h(l._,24,7),h(l._,8,8),c.H.n(l._,9),c.H.A(l._,9,l.J),c.H.l(l._,9),h(l.$,32,5),c.H.n(l.$,5),c.H.A(l.$,5,l.h),c.H.l(l.$,5),h(l.Q,19,0),h(l.C,286,0),h(l.D,30,0),h(l.v,320,0)})(),c.H.N})();function s(c){return[1,null,3,1,2,null,4][c.ctype]*c.depth}function a(c,l,u,h,g){let v=s(l);const C=Math.ceil(h*v/8);let w,_;v=Math.ceil(v/8);let R=c[u],A=0;if(R>1&&(c[u]=[0,0,1][R-2]),R==3)for(A=v;A<C;A++)c[A+1]=c[A+1]+(c[A+1-v]>>>1)&255;for(let F=0;F<g;F++)if(w=u+F*C,_=w+F+1,R=c[_-1],A=0,R==0)for(;A<C;A++)c[w+A]=c[_+A];else if(R==1){for(;A<v;A++)c[w+A]=c[_+A];for(;A<C;A++)c[w+A]=c[_+A]+c[w+A-v]}else if(R==2)for(;A<C;A++)c[w+A]=c[_+A]+c[w+A-C];else if(R==3){for(;A<v;A++)c[w+A]=c[_+A]+(c[w+A-C]>>>1);for(;A<C;A++)c[w+A]=c[_+A]+(c[w+A-C]+c[w+A-v]>>>1)}else{for(;A<v;A++)c[w+A]=c[_+A]+i(0,c[w+A-C],0);for(;A<C;A++)c[w+A]=c[_+A]+i(c[w+A-v],c[w+A-C],c[w+A-v-C])}return c}function i(c,l,u){const h=c+l-u,g=h-c,v=h-l,C=h-u;return g*g<=v*v&&g*g<=C*C?c:v*v<=C*C?l:u}function m(c,l,u){u.width=e.readUint(c,l),l+=4,u.height=e.readUint(c,l),l+=4,u.depth=c[l],l++,u.ctype=c[l],l++,u.compress=c[l],l++,u.filter=c[l],l++,u.interlace=c[l],l++}function f(c,l,u,h,g,v,C,w,_){const R=Math.min(l,g),A=Math.min(u,v);let F=0,y=0;for(let U=0;U<A;U++)for(let E=0;E<R;E++)if(C>=0&&w>=0?(F=U*l+E<<2,y=(w+U)*g+C+E<<2):(F=(-w+U)*l-C+E<<2,y=U*g+E<<2),_==0)h[y]=c[F],h[y+1]=c[F+1],h[y+2]=c[F+2],h[y+3]=c[F+3];else if(_==1){var j=c[F+3]*.00392156862745098,x=c[F]*j,b=c[F+1]*j,I=c[F+2]*j,O=h[y+3]*(1/255),M=h[y]*O,$=h[y+1]*O,P=h[y+2]*O;const S=1-j,D=j+O*S,k=D==0?0:1/D;h[y+3]=255*D,h[y+0]=(x+M*S)*k,h[y+1]=(b+$*S)*k,h[y+2]=(I+P*S)*k}else if(_==2)j=c[F+3],x=c[F],b=c[F+1],I=c[F+2],O=h[y+3],M=h[y],$=h[y+1],P=h[y+2],j==O&&x==M&&b==$&&I==P?(h[y]=0,h[y+1]=0,h[y+2]=0,h[y+3]=0):(h[y]=x,h[y+1]=b,h[y+2]=I,h[y+3]=j);else if(_==3){if(j=c[F+3],x=c[F],b=c[F+1],I=c[F+2],O=h[y+3],M=h[y],$=h[y+1],P=h[y+2],j==O&&x==M&&b==$&&I==P)continue;if(j<220&&O>20)return!1}return!0}return{decode:function(l){const u=new Uint8Array(l);let h=8;const g=e,v=g.readUshort,C=g.readUint,w={tabs:{},frames:[]},_=new Uint8Array(u.length);let R,A=0,F=0;const y=[137,80,78,71,13,10,26,10];for(var j=0;j<8;j++)if(u[j]!=y[j])throw"The input is not a PNG file!";for(;h<u.length;){const U=g.readUint(u,h);h+=4;const E=g.readASCII(u,h,4);if(h+=4,E=="IHDR")m(u,h,w);else if(E=="iCCP"){for(var x=h;u[x]!=0;)x++;g.readASCII(u,h,x-h),u[x+1];const S=u.slice(x+2,h+U);let D=null;try{D=o(S)}catch{D=r(S)}w.tabs[E]=D}else if(E=="CgBI")w.tabs[E]=u.slice(h,h+4);else if(E=="IDAT"){for(j=0;j<U;j++)_[A+j]=u[h+j];A+=U}else if(E=="acTL")w.tabs[E]={num_frames:C(u,h),num_plays:C(u,h+4)},R=new Uint8Array(u.length);else if(E=="fcTL"){F!=0&&((P=w.frames[w.frames.length-1]).data=n(w,R.slice(0,F),P.rect.width,P.rect.height),F=0);const S={x:C(u,h+12),y:C(u,h+16),width:C(u,h+4),height:C(u,h+8)};let D=v(u,h+22);D=v(u,h+20)/(D==0?100:D);const k={rect:S,delay:Math.round(1e3*D),dispose:u[h+24],blend:u[h+25]};w.frames.push(k)}else if(E=="fdAT"){for(j=0;j<U-4;j++)R[F+j]=u[h+j+4];F+=U-4}else if(E=="pHYs")w.tabs[E]=[g.readUint(u,h),g.readUint(u,h+4),u[h+8]];else if(E=="cHRM")for(w.tabs[E]=[],j=0;j<8;j++)w.tabs[E].push(g.readUint(u,h+4*j));else if(E=="tEXt"||E=="zTXt"){w.tabs[E]==null&&(w.tabs[E]={});var b=g.nextZero(u,h),I=g.readASCII(u,h,b-h),O=h+U-b-1;if(E=="tEXt")$=g.readASCII(u,b+1,O);else{var M=o(u.slice(b+2,b+2+O));$=g.readUTF8(M,0,M.length)}w.tabs[E][I]=$}else if(E=="iTXt"){w.tabs[E]==null&&(w.tabs[E]={}),b=0,x=h,b=g.nextZero(u,x),I=g.readASCII(u,x,b-x);const S=u[x=b+1];var $;u[x+1],x+=2,b=g.nextZero(u,x),g.readASCII(u,x,b-x),x=b+1,b=g.nextZero(u,x),g.readUTF8(u,x,b-x),O=U-((x=b+1)-h),S==0?$=g.readUTF8(u,x,O):(M=o(u.slice(x,x+O)),$=g.readUTF8(M,0,M.length)),w.tabs[E][I]=$}else if(E=="PLTE")w.tabs[E]=g.readBytes(u,h,U);else if(E=="hIST"){const S=w.tabs.PLTE.length/3;for(w.tabs[E]=[],j=0;j<S;j++)w.tabs[E].push(v(u,h+2*j))}else if(E=="tRNS")w.ctype==3?w.tabs[E]=g.readBytes(u,h,U):w.ctype==0?w.tabs[E]=v(u,h):w.ctype==2&&(w.tabs[E]=[v(u,h),v(u,h+2),v(u,h+4)]);else if(E=="gAMA")w.tabs[E]=g.readUint(u,h)/1e5;else if(E=="sRGB")w.tabs[E]=u[h];else if(E=="bKGD")w.ctype==0||w.ctype==4?w.tabs[E]=[v(u,h)]:w.ctype==2||w.ctype==6?w.tabs[E]=[v(u,h),v(u,h+2),v(u,h+4)]:w.ctype==3&&(w.tabs[E]=u[h]);else if(E=="IEND")break;h+=U,g.readUint(u,h),h+=4}var P;return F!=0&&((P=w.frames[w.frames.length-1]).data=n(w,R.slice(0,F),P.rect.width,P.rect.height)),w.data=n(w,_,w.width,w.height),delete w.compress,delete w.interlace,delete w.filter,w},toRGBA8:function(l){const u=l.width,h=l.height;if(l.tabs.acTL==null)return[t(l.data,u,h,l).buffer];const g=[];l.frames[0].data==null&&(l.frames[0].data=l.data);const v=u*h*4,C=new Uint8Array(v),w=new Uint8Array(v),_=new Uint8Array(v);for(let A=0;A<l.frames.length;A++){const F=l.frames[A],y=F.rect.x,j=F.rect.y,x=F.rect.width,b=F.rect.height,I=t(F.data,x,b,l);if(A!=0)for(var R=0;R<v;R++)_[R]=C[R];if(F.blend==0?f(I,x,b,C,u,h,y,j,0):F.blend==1&&f(I,x,b,C,u,h,y,j,1),g.push(C.buffer.slice(0)),F.dispose!=0){if(F.dispose==1)f(w,x,b,C,u,h,y,j,0);else if(F.dispose==2)for(R=0;R<v;R++)C[R]=_[R]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Me,{_bin:t}=Me,n=Me._paeth;var o={table:(function(){const x=new Uint32Array(256);for(let b=0;b<256;b++){let I=b;for(let O=0;O<8;O++)1&I?I=3988292384^I>>>1:I>>>=1;x[b]=I}return x})(),update(x,b,I,O){for(let M=0;M<O;M++)x=o.table[255&(x^b[I+M])]^x>>>8;return x},crc:(x,b,I)=>4294967295^o.update(4294967295,x,b,I)};function r(x,b,I,O){b[I]+=x[0]*O>>4,b[I+1]+=x[1]*O>>4,b[I+2]+=x[2]*O>>4,b[I+3]+=x[3]*O>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,b){const I=x[0]-b[0],O=x[1]-b[1],M=x[2]-b[2],$=x[3]-b[3];return I*I+O*O+M*M+$*$}function i(x,b,I,O,M,$,P){P==null&&(P=1);const U=O.length,E=[];for(var S=0;S<U;S++){const L=O[S];E.push([L>>>0&255,L>>>8&255,L>>>16&255,L>>>24&255])}for(S=0;S<U;S++){let L=4294967295;for(var D=0,k=0;k<U;k++){var N=a(E[S],E[k]);k!=S&&N<L&&(L=N,D=k)}}const H=new Uint32Array(M.buffer),T=new Int16Array(b*I*4),B=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(S=0;S<B.length;S++)B[S]=255*((B[S]+.5)/16-.5);for(let L=0;L<I;L++)for(let G=0;G<b;G++){var z;S=4*(L*b+G),P!=2?z=[s(x[S]+T[S]),s(x[S+1]+T[S+1]),s(x[S+2]+T[S+2]),s(x[S+3]+T[S+3])]:(N=B[4*(3&L)+(3&G)],z=[s(x[S]+N),s(x[S+1]+N),s(x[S+2]+N),s(x[S+3]+N)]),D=0;let V=16777215;for(k=0;k<U;k++){const ne=a(z,E[k]);ne<V&&(V=ne,D=k)}const X=E[D],K=[z[0]-X[0],z[1]-X[1],z[2]-X[2],z[3]-X[3]];P==1&&(G!=b-1&&r(K,T,S+4,7),L!=I-1&&(G!=0&&r(K,T,S+4*b-4,3),r(K,T,S+4*b,5),G!=b-1&&r(K,T,S+4*b+4,1))),$[S>>2]=D,H[S>>2]=O[D]}}function m(x,b,I,O,M){M==null&&(M={});const{crc:$}=o,P=t.writeUint,U=t.writeUshort,E=t.writeASCII;let S=8;const D=x.frames.length>1;let k,N=!1,H=33+(D?20:0);if(M.sRGB!=null&&(H+=13),M.pHYs!=null&&(H+=21),M.iCCP!=null&&(k=pako.deflate(M.iCCP),H+=21+k.length+4),x.ctype==3){for(var T=x.plte.length,B=0;B<T;B++)x.plte[B]>>>24!=255&&(N=!0);H+=8+3*T+4+(N?8+1*T+4:0)}for(var z=0;z<x.frames.length;z++)D&&(H+=38),H+=(X=x.frames[z]).cimg.length+12,z!=0&&(H+=4);H+=12;const L=new Uint8Array(H),G=[137,80,78,71,13,10,26,10];for(B=0;B<8;B++)L[B]=G[B];if(P(L,S,13),S+=4,E(L,S,"IHDR"),S+=4,P(L,S,b),S+=4,P(L,S,I),S+=4,L[S]=x.depth,S++,L[S]=x.ctype,S++,L[S]=0,S++,L[S]=0,S++,L[S]=0,S++,P(L,S,$(L,S-17,17)),S+=4,M.sRGB!=null&&(P(L,S,1),S+=4,E(L,S,"sRGB"),S+=4,L[S]=M.sRGB,S++,P(L,S,$(L,S-5,5)),S+=4),M.iCCP!=null){const K=13+k.length;P(L,S,K),S+=4,E(L,S,"iCCP"),S+=4,E(L,S,"ICC profile"),S+=11,S+=2,L.set(k,S),S+=k.length,P(L,S,$(L,S-(K+4),K+4)),S+=4}if(M.pHYs!=null&&(P(L,S,9),S+=4,E(L,S,"pHYs"),S+=4,P(L,S,M.pHYs[0]),S+=4,P(L,S,M.pHYs[1]),S+=4,L[S]=M.pHYs[2],S++,P(L,S,$(L,S-13,13)),S+=4),D&&(P(L,S,8),S+=4,E(L,S,"acTL"),S+=4,P(L,S,x.frames.length),S+=4,P(L,S,M.loop!=null?M.loop:0),S+=4,P(L,S,$(L,S-12,12)),S+=4),x.ctype==3){for(P(L,S,3*(T=x.plte.length)),S+=4,E(L,S,"PLTE"),S+=4,B=0;B<T;B++){const K=3*B,ne=x.plte[B],ae=255&ne,ce=ne>>>8&255,me=ne>>>16&255;L[S+K+0]=ae,L[S+K+1]=ce,L[S+K+2]=me}if(S+=3*T,P(L,S,$(L,S-3*T-4,3*T+4)),S+=4,N){for(P(L,S,T),S+=4,E(L,S,"tRNS"),S+=4,B=0;B<T;B++)L[S+B]=x.plte[B]>>>24&255;S+=T,P(L,S,$(L,S-T-4,T+4)),S+=4}}let V=0;for(z=0;z<x.frames.length;z++){var X=x.frames[z];D&&(P(L,S,26),S+=4,E(L,S,"fcTL"),S+=4,P(L,S,V++),S+=4,P(L,S,X.rect.width),S+=4,P(L,S,X.rect.height),S+=4,P(L,S,X.rect.x),S+=4,P(L,S,X.rect.y),S+=4,U(L,S,O[z]),S+=2,U(L,S,1e3),S+=2,L[S]=X.dispose,S++,L[S]=X.blend,S++,P(L,S,$(L,S-30,30)),S+=4);const K=X.cimg;P(L,S,(T=K.length)+(z==0?0:4)),S+=4;const ne=S;E(L,S,z==0?"IDAT":"fdAT"),S+=4,z!=0&&(P(L,S,V++),S+=4),L.set(K,S),S+=T,P(L,S,$(L,ne,S-ne)),S+=4}return P(L,S,0),S+=4,E(L,S,"IEND"),S+=4,P(L,S,$(L,S-4,4)),S+=4,L.buffer}function f(x,b,I){for(let O=0;O<x.frames.length;O++){const M=x.frames[O];M.rect.width;const $=M.rect.height,P=new Uint8Array($*M.bpl+$);M.cimg=h(M.img,$,M.bpp,M.bpl,P,b,I)}}function c(x,b,I,O,M){const $=M[0],P=M[1],U=M[2],E=M[3],S=M[4],D=M[5];let k=6,N=8,H=255;for(var T=0;T<x.length;T++){const J=new Uint8Array(x[T]);for(var B=J.length,z=0;z<B;z+=4)H&=J[z+3]}const L=H!=255,G=(function(te,ie,re,fe,he,Ae){const ge=[];for(var de=0;de<te.length;de++){const ye=new Uint8Array(te[de]),Pe=new Uint32Array(ye.buffer);var _e;let Ne=0,Ge=0,Fe=ie,ht=re,or=fe?1:0;if(de!=0){const Kl=Ae||fe||de==1||ge[de-2].dispose!=0?1:2;let sr=0,Oo=1e9;for(let Gt=0;Gt<Kl;Gt++){var et=new Uint8Array(te[de-1-Gt]);const ql=new Uint32Array(te[de-1-Gt]);let tt=ie,nt=re,Rt=-1,Vt=-1;for(let gt=0;gt<re;gt++)for(let xt=0;xt<ie;xt++)Pe[be=gt*ie+xt]!=ql[be]&&(xt<tt&&(tt=xt),xt>Rt&&(Rt=xt),gt<nt&&(nt=gt),gt>Vt&&(Vt=gt));Rt==-1&&(tt=nt=Rt=Vt=0),he&&((1&tt)==1&&tt--,(1&nt)==1&&nt--);const Do=(Rt-tt+1)*(Vt-nt+1);Do<Oo&&(Oo=Do,sr=Gt,Ne=tt,Ge=nt,Fe=Rt-tt+1,ht=Vt-nt+1)}et=new Uint8Array(te[de-1-sr]),sr==1&&(ge[de-1].dispose=2),_e=new Uint8Array(Fe*ht*4),e(et,ie,re,_e,Fe,ht,-Ne,-Ge,0),or=e(ye,ie,re,_e,Fe,ht,-Ne,-Ge,3)?1:0,or==1?u(ye,ie,re,_e,{x:Ne,y:Ge,width:Fe,height:ht}):e(ye,ie,re,_e,Fe,ht,-Ne,-Ge,0)}else _e=ye.slice(0);ge.push({rect:{x:Ne,y:Ge,width:Fe,height:ht},img:_e,blend:or,dispose:0})}if(fe)for(de=0;de<ge.length;de++){if((pt=ge[de]).blend==1)continue;const ye=pt.rect,Pe=ge[de-1].rect,Ne=Math.min(ye.x,Pe.x),Ge=Math.min(ye.y,Pe.y),Fe={x:Ne,y:Ge,width:Math.max(ye.x+ye.width,Pe.x+Pe.width)-Ne,height:Math.max(ye.y+ye.height,Pe.y+Pe.height)-Ge};ge[de-1].dispose=1,de-1!=0&&l(te,ie,re,ge,de-1,Fe,he),l(te,ie,re,ge,de,Fe,he)}let hn=0;if(te.length!=1)for(var be=0;be<ge.length;be++){var pt;hn+=(pt=ge[be]).rect.width*pt.rect.height}return ge})(x,b,I,$,P,U),V={},X=[],K=[];if(O!=0){const J=[];for(z=0;z<G.length;z++)J.push(G[z].img.buffer);const te=(function(he){let Ae=0;for(var ge=0;ge<he.length;ge++)Ae+=he[ge].byteLength;const de=new Uint8Array(Ae);let _e=0;for(ge=0;ge<he.length;ge++){const et=new Uint8Array(he[ge]),hn=et.length;for(let be=0;be<hn;be+=4){let pt=et[be],ye=et[be+1],Pe=et[be+2];const Ne=et[be+3];Ne==0&&(pt=ye=Pe=0),de[_e+be]=pt,de[_e+be+1]=ye,de[_e+be+2]=Pe,de[_e+be+3]=Ne}_e+=hn}return de.buffer})(J),ie=v(te,O);for(z=0;z<ie.plte.length;z++)X.push(ie.plte[z].est.rgba);let re=0;for(z=0;z<G.length;z++){const fe=(ae=G[z]).img.length;var ne=new Uint8Array(ie.inds.buffer,re>>2,fe>>2);K.push(ne);const he=new Uint8Array(ie.abuf,re,fe);D&&i(ae.img,ae.rect.width,ae.rect.height,X,he,ne),ae.img.set(he),re+=fe}}else for(T=0;T<G.length;T++){var ae=G[T];const J=new Uint32Array(ae.img.buffer);var ce=ae.rect.width;for(B=J.length,ne=new Uint8Array(B),K.push(ne),z=0;z<B;z++){const te=J[z];if(z!=0&&te==J[z-1])ne[z]=ne[z-1];else if(z>ce&&te==J[z-ce])ne[z]=ne[z-ce];else{let ie=V[te];if(ie==null&&(V[te]=ie=X.length,X.push(te),X.length>=300))break;ne[z]=ie}}}const me=X.length;for(me<=256&&S==0&&(N=me<=2?1:me<=4?2:me<=16?4:8,N=Math.max(N,E)),T=0;T<G.length;T++){(ae=G[T]).rect.x,ae.rect.y,ce=ae.rect.width;const J=ae.rect.height;let te=ae.img;new Uint32Array(te.buffer);let ie=4*ce,re=4;if(me<=256&&S==0){ie=Math.ceil(N*ce/8);var W=new Uint8Array(ie*J);const fe=K[T];for(let he=0;he<J;he++){z=he*ie;const Ae=he*ce;if(N==8)for(var q=0;q<ce;q++)W[z+q]=fe[Ae+q];else if(N==4)for(q=0;q<ce;q++)W[z+(q>>1)]|=fe[Ae+q]<<4-4*(1&q);else if(N==2)for(q=0;q<ce;q++)W[z+(q>>2)]|=fe[Ae+q]<<6-2*(3&q);else if(N==1)for(q=0;q<ce;q++)W[z+(q>>3)]|=fe[Ae+q]<<7-1*(7&q)}te=W,k=3,re=1}else if(L==0&&G.length==1){W=new Uint8Array(ce*J*3);const fe=ce*J;for(z=0;z<fe;z++){const he=3*z,Ae=4*z;W[he]=te[Ae],W[he+1]=te[Ae+1],W[he+2]=te[Ae+2]}te=W,k=2,re=3,ie=3*ce}ae.img=te,ae.bpl=ie,ae.bpp=re}return{ctype:k,depth:N,plte:X,frames:G}}function l(x,b,I,O,M,$,P){const U=Uint8Array,E=Uint32Array,S=new U(x[M-1]),D=new E(x[M-1]),k=M+1<x.length?new U(x[M+1]):null,N=new U(x[M]),H=new E(N.buffer);let T=b,B=I,z=-1,L=-1;for(let V=0;V<$.height;V++)for(let X=0;X<$.width;X++){const K=$.x+X,ne=$.y+V,ae=ne*b+K,ce=H[ae];ce==0||O[M-1].dispose==0&&D[ae]==ce&&(k==null||k[4*ae+3]!=0)||(K<T&&(T=K),K>z&&(z=K),ne<B&&(B=ne),ne>L&&(L=ne))}z==-1&&(T=B=z=L=0),P&&((1&T)==1&&T--,(1&B)==1&&B--),$={x:T,y:B,width:z-T+1,height:L-B+1};const G=O[M];G.rect=$,G.blend=1,G.img=new Uint8Array($.width*$.height*4),O[M-1].dispose==0?(e(S,b,I,G.img,$.width,$.height,-$.x,-$.y,0),u(N,b,I,G.img,$)):e(N,b,I,G.img,$.width,$.height,-$.x,-$.y,0)}function u(x,b,I,O,M){e(x,b,I,O,M.width,M.height,-M.x,-M.y,2)}function h(x,b,I,O,M,$,P){const U=[];let E,S=[0,1,2,3,4];$!=-1?S=[$]:(b*O>5e5||I==1)&&(S=[0]),P&&(E={level:0});const D=ch;for(var k=0;k<S.length;k++){for(let T=0;T<b;T++)g(M,x,T,O,I,S[k]);U.push(D.deflate(M,E))}let N,H=1e9;for(k=0;k<U.length;k++)U[k].length<H&&(N=k,H=U[k].length);return U[N]}function g(x,b,I,O,M,$){const P=I*O;let U=P+I;if(x[U]=$,U++,$==0)if(O<500)for(var E=0;E<O;E++)x[U+E]=b[P+E];else x.set(new Uint8Array(b.buffer,P,O),U);else if($==1){for(E=0;E<M;E++)x[U+E]=b[P+E];for(E=M;E<O;E++)x[U+E]=b[P+E]-b[P+E-M]+256&255}else if(I==0){for(E=0;E<M;E++)x[U+E]=b[P+E];if($==2)for(E=M;E<O;E++)x[U+E]=b[P+E];if($==3)for(E=M;E<O;E++)x[U+E]=b[P+E]-(b[P+E-M]>>1)+256&255;if($==4)for(E=M;E<O;E++)x[U+E]=b[P+E]-n(b[P+E-M],0,0)+256&255}else{if($==2)for(E=0;E<O;E++)x[U+E]=b[P+E]+256-b[P+E-O]&255;if($==3){for(E=0;E<M;E++)x[U+E]=b[P+E]+256-(b[P+E-O]>>1)&255;for(E=M;E<O;E++)x[U+E]=b[P+E]+256-(b[P+E-O]+b[P+E-M]>>1)&255}if($==4){for(E=0;E<M;E++)x[U+E]=b[P+E]+256-n(0,b[P+E-O],0)&255;for(E=M;E<O;E++)x[U+E]=b[P+E]+256-n(b[P+E-M],b[P+E-O],b[P+E-M-O])&255}}}function v(x,b){const I=new Uint8Array(x),O=I.slice(0),M=new Uint32Array(O.buffer),$=C(O,b),P=$[0],U=$[1],E=I.length,S=new Uint8Array(E>>2);let D;if(I.length<2e7)for(var k=0;k<E;k+=4)D=w(P,N=I[k]*(1/255),H=I[k+1]*(1/255),T=I[k+2]*(1/255),B=I[k+3]*(1/255)),S[k>>2]=D.ind,M[k>>2]=D.est.rgba;else for(k=0;k<E;k+=4){var N=I[k]*.00392156862745098,H=I[k+1]*(1/255),T=I[k+2]*(1/255),B=I[k+3]*(1/255);for(D=P;D.left;)D=_(D.est,N,H,T,B)<=0?D.left:D.right;S[k>>2]=D.ind,M[k>>2]=D.est.rgba}return{abuf:O.buffer,inds:S,plte:U}}function C(x,b,I){I==null&&(I=1e-4);const O=new Uint32Array(x.buffer),M={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};M.bst=F(x,M.i0,M.i1),M.est=y(M.bst);const $=[M];for(;$.length<b;){let U=0,E=0;for(var P=0;P<$.length;P++)$[P].est.L>U&&(U=$[P].est.L,E=P);if(U<I)break;const S=$[E],D=R(x,O,S.i0,S.i1,S.est.e,S.est.eMq255);if(S.i0>=D||S.i1<=D){S.est.L=0;continue}const k={i0:S.i0,i1:D,bst:null,est:null,tdst:0,left:null,right:null};k.bst=F(x,k.i0,k.i1),k.est=y(k.bst);const N={i0:D,i1:S.i1,bst:null,est:null,tdst:0,left:null,right:null};for(N.bst={R:[],m:[],N:S.bst.N-k.bst.N},P=0;P<16;P++)N.bst.R[P]=S.bst.R[P]-k.bst.R[P];for(P=0;P<4;P++)N.bst.m[P]=S.bst.m[P]-k.bst.m[P];N.est=y(N.bst),S.left=k,S.right=N,$[E]=k,$.push(N)}for($.sort(((U,E)=>E.bst.N-U.bst.N)),P=0;P<$.length;P++)$[P].ind=P;return[M,$]}function w(x,b,I,O,M){if(x.left==null)return x.tdst=(function(k,N,H,T,B){const z=N-k[0],L=H-k[1],G=T-k[2],V=B-k[3];return z*z+L*L+G*G+V*V})(x.est.q,b,I,O,M),x;const $=_(x.est,b,I,O,M);let P=x.left,U=x.right;$>0&&(P=x.right,U=x.left);const E=w(P,b,I,O,M);if(E.tdst<=$*$)return E;const S=w(U,b,I,O,M);return S.tdst<E.tdst?S:E}function _(x,b,I,O,M){const{e:$}=x;return $[0]*b+$[1]*I+$[2]*O+$[3]*M-x.eMq}function R(x,b,I,O,M,$){for(O-=4;I<O;){for(;A(x,I,M)<=$;)I+=4;for(;A(x,O,M)>$;)O-=4;if(I>=O)break;const P=b[I>>2];b[I>>2]=b[O>>2],b[O>>2]=P,I+=4,O-=4}for(;A(x,I,M)>$;)I-=4;return I+4}function A(x,b,I){return x[b]*I[0]+x[b+1]*I[1]+x[b+2]*I[2]+x[b+3]*I[3]}function F(x,b,I){const O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=[0,0,0,0],$=I-b>>2;for(let P=b;P<I;P+=4){const U=x[P]*.00392156862745098,E=x[P+1]*(1/255),S=x[P+2]*(1/255),D=x[P+3]*(1/255);M[0]+=U,M[1]+=E,M[2]+=S,M[3]+=D,O[0]+=U*U,O[1]+=U*E,O[2]+=U*S,O[3]+=U*D,O[5]+=E*E,O[6]+=E*S,O[7]+=E*D,O[10]+=S*S,O[11]+=S*D,O[15]+=D*D}return O[4]=O[1],O[8]=O[2],O[9]=O[6],O[12]=O[3],O[13]=O[7],O[14]=O[11],{R:O,m:M,N:$}}function y(x){const{R:b}=x,{m:I}=x,{N:O}=x,M=I[0],$=I[1],P=I[2],U=I[3],E=O==0?0:1/O,S=[b[0]-M*M*E,b[1]-M*$*E,b[2]-M*P*E,b[3]-M*U*E,b[4]-$*M*E,b[5]-$*$*E,b[6]-$*P*E,b[7]-$*U*E,b[8]-P*M*E,b[9]-P*$*E,b[10]-P*P*E,b[11]-P*U*E,b[12]-U*M*E,b[13]-U*$*E,b[14]-U*P*E,b[15]-U*U*E],D=S,k=j;let N=[Math.random(),Math.random(),Math.random(),Math.random()],H=0,T=0;if(O!=0)for(let z=0;z<16&&(N=k.multVec(D,N),T=Math.sqrt(k.dot(N,N)),N=k.sml(1/T,N),!(z!=0&&Math.abs(T-H)<1e-9));z++)H=T;const B=[M*E,$*E,P*E,U*E];return{Cov:S,q:B,e:N,L:H,eMq255:k.dot(k.sml(255,B),N),eMq:k.dot(N,B),rgba:(Math.round(255*B[3])<<24|Math.round(255*B[2])<<16|Math.round(255*B[1])<<8|Math.round(255*B[0])<<0)>>>0}}var j={multVec:(x,b)=>[x[0]*b[0]+x[1]*b[1]+x[2]*b[2]+x[3]*b[3],x[4]*b[0]+x[5]*b[1]+x[6]*b[2]+x[7]*b[3],x[8]*b[0]+x[9]*b[1]+x[10]*b[2]+x[11]*b[3],x[12]*b[0]+x[13]*b[1]+x[14]*b[2]+x[15]*b[3]],dot:(x,b)=>x[0]*b[0]+x[1]*b[1]+x[2]*b[2]+x[3]*b[3],sml:(x,b)=>[x*b[0],x*b[1],x*b[2],x*b[3]]};Me.encode=function(b,I,O,M,$,P,U){M==null&&(M=0),U==null&&(U=!1);const E=c(b,I,O,M,[!1,!1,!1,0,U,!1]);return f(E,-1),m(E,I,O,$,P)},Me.encodeLL=function(b,I,O,M,$,P,U,E){const S={ctype:0+(M==1?0:2)+($==0?0:4),depth:P,frames:[]},D=(M+$)*P,k=D*I;for(let N=0;N<b.length;N++)S.frames.push({rect:{x:0,y:0,width:I,height:O},img:new Uint8Array(b[N]),blend:0,dispose:1,bpp:Math.ceil(D/8),bpl:Math.ceil(k/8)});return f(S,0,!0),m(S,I,O,U,E)},Me.encode.compress=c,Me.encode.dither=i,Me.quantize=v,Me.quantize.getKDtree=C,Me.quantize.getNearest=w})();const Ii={toArrayBuffer(e,t){const n=e.width,o=e.height,r=n<<2,s=e.getContext("2d").getImageData(0,0,n,o),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*o,f=122+m,c=new ArrayBuffer(f),l=new DataView(c),u=1<<20;let h,g,v,C,w=u,_=0,R=0,A=0;function F(x){l.setUint16(R,x,!0),R+=2}function y(x){l.setUint32(R,x,!0),R+=4}function j(x){R+=x}F(19778),y(f),j(4),y(122),y(108),y(n),y(-o>>>0),F(1),F(32),y(3),y(m),y(2835),y(2835),j(8),y(16711680),y(65280),y(255),y(4278190080),y(1466527264),(function x(){for(;_<o&&w>0;){for(C=122+_*i,h=0;h<r;)w--,g=a[A++],v=g>>>24,l.setUint32(C+h,g<<8|v),h+=4;_++}A<a.length?(w=u,setTimeout(x,Ii._dly)):t(c)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Ee={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},uh={[Ee.CHROME]:16384,[Ee.FIREFOX]:11180,[Ee.DESKTOP_SAFARI]:16384,[Ee.IE]:8192,[Ee.IOS]:4096,[Ee.ETC]:8192};const yo=typeof window<"u",Pi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,On=yo&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),dh=(yo||Pi)&&(On&&On.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Mi=(yo||Pi)&&(On&&On.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Co(e,t,n=Date.now()){return new Promise((o=>{const r=e.split(","),s=r[0].match(/:(.*?);/)[1],a=globalThis.atob(r[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:s});f.name=t,f.lastModified=n,o(f)}))}function Oi(e){return new Promise(((t,n)=>{const o=new Mi;o.onload=()=>t(o.result),o.onerror=r=>n(r),o.readAsDataURL(e)}))}function Di(e){return new Promise(((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=r=>n(r),o.src=e}))}function wt(){if(wt.cachedResult!==void 0)return wt.cachedResult;let e=Ee.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Ee.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Ee.IOS:/Safari/i.test(t)?e=Ee.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Ee.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Ee.IE),wt.cachedResult=e,wt.cachedResult}function Li(e,t){const n=wt(),o=uh[n];let r=e,s=t,a=r*s;const i=r>s?s/r:r/s;for(;a>o*o;){const m=(o+r)/2,f=(o+s)/2;m<f?(s=f,r=f*i):(s=m*i,r=m),a=r*s}return{width:r,height:s}}function Xn(e,t){let n,o;try{if(n=new OffscreenCanvas(e,t),o=n.getContext("2d"),o===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),o=n.getContext("2d")}return n.width=e,n.height=t,[n,o]}function Fi(e,t){const{width:n,height:o}=Li(e.width,e.height),[r,s]=Xn(n,o);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,r.width,r.height)),s.drawImage(e,0,0,r.width,r.height),r}function En(){return En.cachedResult!==void 0||(En.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),En.cachedResult}function Dn(e,t={}){return new Promise((function(n,o){let r,s;var a=function(){try{return s=Fi(r,t.fileType||e.type),n([r,s])}catch(m){return o(m)}},i=function(m){try{var f=function(c){try{throw c}catch(l){return o(l)}};try{let c;return Oi(e).then((function(l){try{return c=l,Di(c).then((function(u){try{return r=u,(function(){try{return a()}catch(h){return o(h)}})()}catch(h){return f(h)}}),f)}catch(u){return f(u)}}),f)}catch(c){f(c)}}catch(c){return o(c)}};try{if(En()||[Ee.DESKTOP_SAFARI,Ee.MOBILE_SAFARI].includes(wt()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return r=m,a()}catch{return i()}}),i)}catch{i()}}))}function Ln(e,t,n,o,r=1){return new Promise((function(s,a){let i;if(t==="image/png"){let f,c,l;return f=e.getContext("2d"),{data:c}=f.getImageData(0,0,e.width,e.height),l=Me.encode([c.buffer],e.width,e.height,4096*r),i=new Blob([l],{type:t}),i.name=n,i.lastModified=o,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((c=>Ii.toBlob(e,c))).then((function(c){try{return i=c,i.name=n,i.lastModified=o,f.call(this)}catch(l){return a(l)}}).bind(this),a);{let c=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:r}).then((function(l){try{return i=l,i.name=n,i.lastModified=o,c.call(this)}catch(u){return a(u)}}).bind(this),a);{let l;return l=e.toDataURL(t,r),Co(l,n,o).then((function(u){try{return i=u,c.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return s(i)}}))}function Ue(e){e.width=0,e.height=0}function Pt(){return new Promise((function(e,t){let n,o,r,s;return Pt.cachedResult!==void 0?e(Pt.cachedResult):Co("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Dn(n).then((function(i){try{return o=i[1],Ln(o,n.type,n.name,n.lastModified).then((function(m){try{return r=m,Ue(o),Dn(r).then((function(f){try{return s=f[0],Pt.cachedResult=s.width===1&&s.height===2,e(Pt.cachedResult)}catch(c){return t(c)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function $i(e){return new Promise(((t,n)=>{const o=new Mi;o.onload=r=>{const s=new DataView(r.target.result);if(s.getUint16(0,!1)!=65496)return t(-2);const a=s.byteLength;let i=2;for(;i<a;){if(s.getUint16(i+2,!1)<=8)return t(-1);const m=s.getUint16(i,!1);if(i+=2,m==65505){if(s.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=s.getUint16(i+=6,!1)==18761;i+=s.getUint32(i+4,f);const c=s.getUint16(i,f);i+=2;for(let l=0;l<c;l++)if(s.getUint16(i+12*l,f)==274)return t(s.getUint16(i+12*l+8,f))}else{if((65280&m)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},o.onerror=r=>n(r),o.readAsArrayBuffer(e)}))}function Ui(e,t){const{width:n}=e,{height:o}=e,{maxWidthOrHeight:r}=t;let s,a=e;return isFinite(r)&&(n>r||o>r)&&([a,s]=Xn(n,o),n>o?(a.width=r,a.height=o/n*r):(a.width=n/o*r,a.height=r),s.drawImage(e,0,0,a.width,a.height),Ue(e)),a}function zi(e,t){const{width:n}=e,{height:o}=e,[r,s]=Xn(n,o);switch(t>4&&t<9?(r.width=o,r.height=n):(r.width=n,r.height=o),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,o);break;case 4:s.transform(1,0,0,-1,0,o);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,o,0);break;case 7:s.transform(0,-1,-1,0,o,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,o),Ue(e),r}function vs(e,t,n=0){return new Promise((function(o,r){let s,a,i,m,f,c,l,u,h,g,v,C,w,_,R,A,F,y,j,x;function b(O=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=O,t.onProgress(Math.min(s,100))}function I(O){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(O,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,b(),Dn(e,t).then((function(O){try{return[,m]=O,b(),f=Ui(m,t),b(),new Promise((function(M,$){var P;if(!(P=t.exifOrientation))return $i(e).then((function(E){try{return P=E,U.call(this)}catch(S){return $(S)}}).bind(this),$);function U(){return M(P)}return U.call(this)})).then((function(M){try{return c=M,b(),Pt().then((function($){try{return l=$?f:zi(f,c),b(),u=t.initialQuality||1,h=t.fileType||e.type,Ln(l,h,e.name,e.lastModified,u).then((function(P){try{{let E=function(){if(a--&&(R>i||R>w)){let D,k;return D=x?.95*j.width:j.width,k=x?.95*j.height:j.height,[F,y]=Xn(D,k),y.drawImage(j,0,0,D,k),u*=h==="image/png"?.85:.95,Ln(F,h,e.name,e.lastModified,u).then((function(N){try{return A=N,Ue(j),j=F,R=A.size,I(Math.min(99,Math.floor((_-R)/(_-i)*100))),E}catch(H){return r(H)}}),r)}return[1]},S=function(){return Ue(j),Ue(F),Ue(f),Ue(l),Ue(m),I(100),o(A)};if(g=P,b(),v=g.size>i,C=g.size>e.size,!v&&!C)return I(100),o(g);var U;return w=e.size,_=g.size,R=_,j=l,x=!t.alwaysKeepResolution&&v,(U=(function(D){for(;D;){if(D.then)return void D.then(U,r);try{if(D.pop){if(D.length)return D.pop()?S.call(this):D;D=E}else D=D.call(this)}catch(k){return r(k)}}}).bind(this))(E)}}catch(E){return r(E)}}).bind(this),r)}catch(P){return r(P)}}).bind(this),r)}catch($){return r($)}}).bind(this),r)}catch(M){return r(M)}}).bind(this),r)}))}const fh=`
198
- let scriptImported = false
199
- self.addEventListener('message', async (e) => {
200
- const { file, id, imageCompressionLibUrl, options } = e.data
201
- options.onProgress = (progress) => self.postMessage({ progress, id })
202
- try {
203
- if (!scriptImported) {
204
- // console.log('[worker] importScripts', imageCompressionLibUrl)
205
- self.importScripts(imageCompressionLibUrl)
206
- scriptImported = true
207
- }
208
- // console.log('[worker] self', self)
209
- const compressedFile = await imageCompression(file, options)
210
- self.postMessage({ file: compressedFile, id })
211
- } catch (e) {
212
- // console.error('[worker] error', e)
213
- self.postMessage({ error: e.message + '\\n' + e.stack, id })
214
- }
215
- })
216
- `;let xr;function mh(e,t){return new Promise(((n,o)=>{xr||(xr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(fh));const r=new Worker(xr);r.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)r.terminate();else if(a.data.progress===void 0){if(a.data.error)return o(new Error(a.data.error)),void r.terminate();n(a.data.file),r.terminate()}else t.onProgress(a.data.progress)})),r.addEventListener("error",o),t.signal&&t.signal.addEventListener("abort",(()=>{o(t.signal.reason),r.terminate()})),r.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function ve(e,t){return new Promise((function(n,o){let r,s,a,i,m,f;if(r={...t},a=0,{onProgress:i}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof dh))return o(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return o(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return vs(e,r).then((function(h){try{return s=h,u.call(this)}catch(g){return o(g)}}).bind(this),o);var c=(function(){try{return u.call(this)}catch(h){return o(h)}}).bind(this),l=function(h){try{return vs(e,r).then((function(g){try{return s=g,c()}catch(v){return o(v)}}),o)}catch(g){return o(g)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",mh(e,r).then((function(h){try{return s=h,c()}catch{return l()}}),l)}catch{l()}function u(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{r.preserveExif&&e.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===e.type)&&(s=Ni(e,s))}catch{}return n(s)}}))}ve.getDataUrlFromFile=Oi,ve.getFilefromDataUrl=Co,ve.loadImage=Di,ve.drawImageInCanvas=Fi,ve.drawFileInCanvas=Dn,ve.canvasToFile=Ln,ve.getExifOrientation=$i,ve.handleMaxWidthOrHeight=Ui,ve.followExifOrientation=zi,ve.cleanupCanvasMemory=Ue,ve.isAutoOrientationInBrowser=Pt,ve.approximateBelowMaximumCanvasSizeOfBrowser=Li,ve.copyExifWithoutOrientation=Ni,ve.getBrowserName=wt,ve.version="2.0.2";var ph=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ft=ph.reduce((e,t)=>{const n=ia(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),hh=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),gh="VisuallyHidden",Bi=p.forwardRef((e,t)=>d.jsx(ue.span,{...e,ref:t,style:{...hh,...e.style}}));Bi.displayName=gh;var xh=Bi,[Qn]=Ze("Tooltip",[Ht]),Zn=Ht(),Hi="TooltipProvider",vh=700,Ur="tooltip.open",[bh,So]=Qn(Hi),Wi=e=>{const{__scopeTooltip:t,delayDuration:n=vh,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),d.jsx(bh,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,o)},[o]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:r,children:s})};Wi.displayName=Hi;var nn="Tooltip",[wh,fn]=Qn(nn),Gi=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=So(nn,e.__scopeTooltip),f=Zn(t),[c,l]=p.useState(null),u=Ce(),h=p.useRef(0),g=a??m.disableHoverableContent,v=i??m.delayDuration,C=p.useRef(!1),[w,_]=it({prop:o,defaultProp:r??!1,onChange:j=>{j?(m.onOpen(),document.dispatchEvent(new CustomEvent(Ur))):m.onClose(),s==null||s(j)},caller:nn}),R=p.useMemo(()=>w?C.current?"delayed-open":"instant-open":"closed",[w]),A=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C.current=!1,_(!0)},[_]),F=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),y=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{C.current=!0,_(!0),h.current=0},v)},[v,_]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),d.jsx(lo,{...f,children:d.jsx(wh,{scope:t,contentId:u,open:w,stateAttribute:R,trigger:c,onTriggerChange:l,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?y():A()},[m.isOpenDelayedRef,y,A]),onTriggerLeave:p.useCallback(()=>{g?F():(window.clearTimeout(h.current),h.current=0)},[F,g]),onOpen:A,onClose:F,disableHoverableContent:g,children:n})})};Gi.displayName=nn;var zr="TooltipTrigger",Vi=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=fn(zr,n),s=So(zr,n),a=Zn(n),i=p.useRef(null),m=pe(t,i,r.onTriggerChange),f=p.useRef(!1),c=p.useRef(!1),l=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",l),[l]),d.jsx(Vn,{asChild:!0,...a,children:d.jsx(ue.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:m,onPointerMove:ee(e.onPointerMove,u=>{u.pointerType!=="touch"&&!c.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),c.current=!0)}),onPointerLeave:ee(e.onPointerLeave,()=>{r.onTriggerLeave(),c.current=!1}),onPointerDown:ee(e.onPointerDown,()=>{r.open&&r.onClose(),f.current=!0,document.addEventListener("pointerup",l,{once:!0})}),onFocus:ee(e.onFocus,()=>{f.current||r.onOpen()}),onBlur:ee(e.onBlur,r.onClose),onClick:ee(e.onClick,r.onClose)})})});Vi.displayName=zr;var Eo="TooltipPortal",[yh,Ch]=Qn(Eo,{forceMount:void 0}),Ki=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=fn(Eo,t);return d.jsx(yh,{scope:t,forceMount:n,children:d.jsx(Te,{present:n||s.open,children:d.jsx(ln,{asChild:!0,container:r,children:o})})})};Ki.displayName=Eo;var Ft="TooltipContent",qi=p.forwardRef((e,t)=>{const n=Ch(Ft,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=fn(Ft,e.__scopeTooltip);return d.jsx(Te,{present:o||a.open,children:a.disableHoverableContent?d.jsx(Yi,{side:r,...s,ref:t}):d.jsx(Sh,{side:r,...s,ref:t})})}),Sh=p.forwardRef((e,t)=>{const n=fn(Ft,e.__scopeTooltip),o=So(Ft,e.__scopeTooltip),r=p.useRef(null),s=pe(t,r),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,c=r.current,{onPointerInTransitChange:l}=o,u=p.useCallback(()=>{i(null),l(!1)},[l]),h=p.useCallback((g,v)=>{const C=g.currentTarget,w={x:g.clientX,y:g.clientY},_=_h(w,C.getBoundingClientRect()),R=jh(w,_),A=Rh(v.getBoundingClientRect()),F=Nh([...R,...A]);i(F),l(!0)},[l]);return p.useEffect(()=>()=>u(),[u]),p.useEffect(()=>{if(m&&c){const g=C=>h(C,c),v=C=>h(C,m);return m.addEventListener("pointerleave",g),c.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",g),c.removeEventListener("pointerleave",v)}}},[m,c,h,u]),p.useEffect(()=>{if(a){const g=v=>{const C=v.target,w={x:v.clientX,y:v.clientY},_=(m==null?void 0:m.contains(C))||(c==null?void 0:c.contains(C)),R=!Th(w,a);_?u():R&&(u(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,c,a,f,u]),d.jsx(Yi,{...e,ref:s})}),[Eh,kh]=Qn(nn,{isInside:!1}),Ah=bd("TooltipContent"),Yi=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,m=fn(Ft,n),f=Zn(n),{onClose:c}=m;return p.useEffect(()=>(document.addEventListener(Ur,c),()=>document.removeEventListener(Ur,c)),[c]),p.useEffect(()=>{if(m.trigger){const l=u=>{const h=u.target;h!=null&&h.contains(m.trigger)&&c()};return window.addEventListener("scroll",l,{capture:!0}),()=>window.removeEventListener("scroll",l,{capture:!0})}},[m.trigger,c]),d.jsx(sn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l=>l.preventDefault(),onDismiss:c,children:d.jsxs(co,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(Ah,{children:o}),d.jsx(Eh,{scope:n,isInside:!0,children:d.jsx(xh,{id:m.contentId,role:"tooltip",children:r||o})})]})})});qi.displayName=Ft;var Xi="TooltipArrow",Qi=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=Zn(n);return kh(Xi,n).isInside?null:d.jsx(uo,{...r,...o,ref:t})});Qi.displayName=Xi;function _h(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,o,r,s)){case s:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function jh(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function Rh(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}function Th(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,c=i.y,l=m.x,u=m.y;c>o!=u>o&&n<(l-f)*(o-c)/(u-c)+f&&(r=!r)}return r}function Nh(e){const t=e.slice();return t.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),Ih(t)}function Ih(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const r=e[o];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const r=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Ph=Wi,Mh=Gi,Oh=Vi,Dh=Ki,Lh=qi,Fh=Qi;function $h({delayDuration:e=0,...t}){return d.jsx(Ph,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Uh({...e}){return d.jsx($h,{children:d.jsx(Mh,{"data-slot":"tooltip",...e})})}function zh({...e}){return d.jsx(Oh,{"data-slot":"tooltip-trigger",...e})}function Bh({className:e,sideOffset:t=0,children:n,...o}){return d.jsx(Dh,{children:d.jsxs(Lh,{"data-slot":"tooltip-content",sideOffset:t,className:Z("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...o,children:[n,d.jsx(Fh,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Hh=p.lazy(()=>ke(()=>import("./mermaid-VLURNSYL-CxWk1wHz.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));p.createContext(null);const ko=p.memo(({className:e,children:t,...n})=>d.jsx(p.Suspense,{fallback:d.jsx("div",{className:Z("whitespace-pre-wrap break-words",e),children:t}),children:d.jsx(Hh,{className:Z("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);ko.displayName="MessageResponse";var Jn="Collapsible",[Wh]=Ze(Jn),[Gh,Ao]=Wh(Jn),Zi=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:a,...i}=e,[m,f]=it({prop:o,defaultProp:r??!1,onChange:a,caller:Jn});return d.jsx(Gh,{scope:n,disabled:s,contentId:Ce(),open:m,onOpenToggle:p.useCallback(()=>f(c=>!c),[f]),children:d.jsx(ue.div,{"data-state":jo(m),"data-disabled":s?"":void 0,...i,ref:t})})});Zi.displayName=Jn;var Ji="CollapsibleTrigger",el=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,r=Ao(Ji,n);return d.jsx(ue.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":jo(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:t,onClick:ee(e.onClick,r.onOpenToggle)})});el.displayName=Ji;var _o="CollapsibleContent",tl=p.forwardRef((e,t)=>{const{forceMount:n,...o}=e,r=Ao(_o,e.__scopeCollapsible);return d.jsx(Te,{present:n||r.open,children:({present:s})=>d.jsx(Vh,{...o,ref:t,present:s})})});tl.displayName=_o;var Vh=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:r,...s}=e,a=Ao(_o,n),[i,m]=p.useState(o),f=p.useRef(null),c=pe(t,f),l=p.useRef(0),u=l.current,h=p.useRef(0),g=h.current,v=a.open||i,C=p.useRef(v),w=p.useRef(void 0);return p.useEffect(()=>{const _=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(_)},[]),qe(()=>{const _=f.current;if(_){w.current=w.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const R=_.getBoundingClientRect();l.current=R.height,h.current=R.width,C.current||(_.style.transitionDuration=w.current.transitionDuration,_.style.animationName=w.current.animationName),m(o)}},[a.open,o]),d.jsx(ue.div,{"data-state":jo(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:c,style:{"--radix-collapsible-content-height":u?`${u}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&r})});function jo(e){return e?"open":"closed"}var Kh=Zi;function qh({...e}){return d.jsx(Kh,{"data-slot":"collapsible",...e})}function Yh({...e}){return d.jsx(el,{"data-slot":"collapsible-trigger",...e})}function Xh({...e}){return d.jsx(tl,{"data-slot":"collapsible-content",...e})}const Qh=({children:e,as:t="p",className:n,duration:o=2})=>{const r=Jl.create(t);return d.jsx(r,{animate:{opacity:[.5,1,.5]},className:Z("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:o,ease:"easeInOut"},children:e})},Zh=p.memo(Qh),nl=p.createContext(null),Jh=()=>{const e=p.useContext(nl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},eg=1e3,tg=1e3,rl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:o=!0,onOpenChange:r,duration:s,children:a,...i})=>{const[m,f]=it({prop:n,defaultProp:o,onChange:r}),[c,l]=it({prop:s,defaultProp:void 0}),[u,h]=p.useState(!1),[g,v]=p.useState(null);p.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(l(Math.ceil((Date.now()-g)/tg)),v(null))},[t,g,l]);const C=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!C&&o&&!t&&m&&!u){const _=setTimeout(()=>{f(!1),h(!0)},eg);return()=>clearTimeout(_)}},[t,m,o,f,u,C]);const w=_=>{f(_)};return d.jsx(nl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:c},children:d.jsx(qh,{className:Z("not-prose mb-4",e),onOpenChange:w,open:m,...i,children:a})})}),ng=(e,t)=>e||t===0?d.jsx(Zh,{duration:1,children:"Thinking..."}):t===void 0?d.jsx("p",{children:"Thought for a few seconds"}):d.jsxs("p",{children:["Thought for ",t," seconds"]}),ol=p.memo(({className:e,children:t,getThinkingMessage:n=ng,...o})=>{const{isStreaming:r,isOpen:s,duration:a}=Jh();return d.jsx(Yh,{className:Z("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??d.jsxs(d.Fragment,{children:[d.jsx(tu,{className:"size-4"}),n(r,a),d.jsx(Ut,{className:Z("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),sl=p.memo(({className:e,children:t,...n})=>d.jsx(Xh,{className:Z("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));rl.displayName="Reasoning";ol.displayName="ReasoningTrigger";sl.displayName="ReasoningContent";const vr=200;function rg({entry:e}){const[t,n]=p.useState(!1),[o,r]=p.useState(!1),s=p.useRef(null),a=p.useCallback(()=>{const i=s.current;i&&r(i.scrollHeight>vr+4)},[]);return p.useEffect(()=>{a()},[a,e.content]),d.jsx("div",{className:"flex justify-end",children:d.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,m)=>d.jsx(sg,{image:i},m))}),e.attachments&&e.attachments.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((i,m)=>d.jsx(ag,{attachment:i},m))}),e.content&&d.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[d.jsx("div",{ref:s,className:Z("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&o&&`max-h-[${vr}px]`),style:!t&&o?{maxHeight:`${vr}px`}:void 0,children:Gc(e.content)}),!t&&o&&d.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:d.jsxs("button",{type:"button",onClick:()=>n(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[d.jsx("span",{children:"展开"}),d.jsx(Ut,{className:"h-3 w-3"})]})})]})]})})}function og({entry:e,isStreaming:t}){return d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[d.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,o)=>{if(n.type==="thought"){const r=o===e.chunks.length-1,s=t&&r;return d.jsxs(rl,{isStreaming:s,children:[d.jsx(ol,{}),d.jsx(sl,{children:d.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},o)}return d.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:d.jsx(ko,{children:n.text})},o)})]})]})}function sg({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return d.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:d.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function ag({attachment:e}){const[t,n]=p.useState(!1),o=(()=>{switch(e.kind){case"text":return d.jsx(Zt,{className:"h-4 w-4"});case"table":return d.jsx(Zr,{className:"h-4 w-4"});case"directory":return d.jsx(Qr,{className:"h-4 w-4"});default:return d.jsx(Zt,{className:"h-4 w-4"})}})(),r=e.size!=null?ig(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return d.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[d.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:Z("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[o,d.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[d.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),d.jsxs("div",{className:"text-[10px] text-text-muted",children:[r&&d.jsx("span",{children:r}),r&&s!=null&&d.jsx("span",{children:" · "}),s!=null&&d.jsxs("span",{children:[s," 个文件"]})]})]}),a&&d.jsx(Ut,{className:Z("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&d.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:d.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function ig(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function lg(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function cg(e){switch(e){case"allow_once":case"allow_always":return d.jsx(on,{className:"size-4"});case"reject_once":case"reject_always":return d.jsx(Un,{className:"size-4"});default:return null}}function ug({requestId:e,options:t,onRespond:n,className:o}){const r=s=>{n(e,s.optionId,s.kind)};return d.jsxs("div",{className:Z("p-3 border-t border-warning-border/30 bg-warning-bg/50",o),children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(ta,{className:"size-4 text-warning-text"}),d.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>d.jsxs(At,{variant:lg(s.kind),size:"sm",onClick:()=>r(s),className:"gap-1.5",children:[cg(s.kind),s.name]},s.optionId))})]})}function al({entries:e,onPermissionRespond:t}){const[n,o]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return d.jsx("div",{className:"pl-10",children:d.jsx(bs,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const r=dg(e);return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand font-bold hover:bg-brand/10 transition-colors",onClick:()=>o(!n),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Z("transition-transform text-text-muted",n&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs text-brand font-bold font-display",children:r})]}),n&&d.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>d.jsx(bs,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function bs({tool:e,compact:t,onPermissionRespond:n}){const[o,r]=p.useState(!t),s=(()=>{switch(e.status){case"running":return d.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return d.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return d.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return d.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=e.status!=="running"&&e.status!=="waiting_for_confirmation"&&(e.rawOutput||e.content);return d.jsxs("div",{className:Z("px-3 py-2",t&&"py-1.5"),children:[d.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>r(!o),children:[s,d.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&d.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&d.jsx("div",{className:"mt-1.5 ml-4",children:d.jsx(ug,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),o&&d.jsxs("div",{className:"mt-1.5 ml-4 space-y-1.5",children:[e.rawInput&&Object.keys(e.rawInput).length>0&&d.jsx("div",{children:d.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Br(JSON.stringify(e.rawInput,null,2),2e3)})}),a&&d.jsx("div",{children:d.jsx("pre",{className:Z("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:mg(e)})})]})]})}function dg(e){const t=new Map;for(const o of e){const r=fg(o.toolCall.title);t.set(r,(t.get(r)||0)+1)}const n=[];for(const[o,r]of t)n.push(r===1?o:`${r} 次${o}`);return n.length===0?`${e.length} 个工具调用`:n.length===1?n[0]:`${e.length} 个工具: ${n.join("、")}`}function fg(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function mg(e){if(e.content&&e.content.length>0){const t=e.content.filter(n=>n.type==="content").filter(n=>n.content.type==="text"&&"text"in n.content).map(n=>n.content.text);if(t.length>0)return Br(t.join(`
217
- `),2e3)}return e.rawOutput&&Object.keys(e.rawOutput).length>0?Br(JSON.stringify(e.rawOutput,null,2),2e3):""}function Br(e,t){return e.length>t?e.slice(0,t)+"...":e}function pg({entry:e}){const[t,n]=p.useState(!1),{entries:o}=e;if(o.length===0)return null;const r=o.filter(i=>i.status==="completed").length,s=o.length,a=s>0?Math.round(r/s*100):0;return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Z("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[r,"/",s]}),d.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:d.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&d.jsx("div",{className:Z("border-t border-border px-3 py-1.5 space-y-0.5",s>5&&"max-h-64 overflow-y-auto"),children:o.map((i,m)=>d.jsx(hg,{entry:i},m))})]})})}function hg({entry:e}){return d.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[d.jsx("span",{className:"flex-shrink-0 mt-0.5",children:d.jsx(gg,{status:e.status})}),d.jsx("span",{className:Z("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),d.jsx(xg,{priority:e.priority})]})}function gg({status:e}){switch(e){case"completed":return d.jsx(lu,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return d.jsx(Zs,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return d.jsx(uu,{className:"h-3.5 w-3.5 text-text-muted"})}}function xg({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:"高",medium:"中",low:"低"};return d.jsx("span",{className:Z("text-[9px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function vg({entry:e}){const t=e.variant==="error";return d.jsxs("div",{className:"w-full",children:[d.jsx("div",{className:Z("border-t-2",t?"border-status-error":"border-border")}),d.jsxs("div",{className:"pt-3",children:[d.jsx("h3",{className:Z("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&d.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),d.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:d.jsx(ko,{children:e.outputText})}),d.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
218
- * Copyright (c) StackBlitz. All rights reserved.
219
- * Licensed under the MIT License. See License.txt in the project root for license information.
220
- *--------------------------------------------------------------------------------------------*/const bg={damping:.7,stiffness:.05,mass:1.25},wg=70,yg=1e3/60,Cg=350;let er=!1;var Ts;(Ts=globalThis.document)==null||Ts.addEventListener("mousedown",()=>{er=!0});var Ns;(Ns=globalThis.document)==null||Ns.addEventListener("mouseup",()=>{er=!1});var Is;(Is=globalThis.document)==null||Is.addEventListener("click",()=>{er=!1});const Sg=(e={})=>{const[t,n]=p.useState(!1),[o,r]=p.useState(e.initial!==!1),[s,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var A;if(!er)return!1;const _=window.getSelection();if(!_||!_.rangeCount)return!1;const R=_.getRangeAt(0);return R.commonAncestorContainer.contains(C.current)||((A=C.current)==null?void 0:A.contains(R.commonAncestorContainer))},[]),f=p.useCallback(_=>{l.isAtBottom=_,r(_)},[]),c=p.useCallback(_=>{l.escapedFromLock=_,n(_)},[]),l=p.useMemo(()=>{let _;return{escapedFromLock:t,isAtBottom:o,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var R;return((R=C.current)==null?void 0:R.scrollTop)??0},set scrollTop(R){if(C.current){const{scrollBehavior:A}=getComputedStyle(C.current);A!=="auto"&&(C.current.style.scrollBehavior="auto"),C.current.scrollTop=R,l.ignoreScrollToTop=C.current.scrollTop,A!=="auto"&&(C.current.style.scrollBehavior=A)}},get targetScrollTop(){return!C.current||!w.current?0:C.current.scrollHeight-1-C.current.clientHeight},get calculatedTargetScrollTop(){if(!C.current||!w.current)return 0;const{targetScrollTop:R}=this;if(!e.targetScrollTop)return R;if((_==null?void 0:_.targetScrollTop)===R)return _.calculatedScrollTop;const A=Math.max(Math.min(e.targetScrollTop(R,{scrollElement:C.current,contentElement:w.current}),R),0);return _={targetScrollTop:R,calculatedScrollTop:A},requestAnimationFrame(()=>{_=void 0}),A},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=wg}}},[]),u=p.useCallback((_={})=>{var b;typeof _=="string"&&(_={animation:_}),_.preserveScrollPosition||f(!0);const R=Date.now()+(Number(_.wait)||0),A=wr(i.current,_.animation),{ignoreEscapes:F=!1}=_;let y,j=l.calculatedTargetScrollTop;_.duration instanceof Promise?_.duration.finally(()=>{y=Date.now()}):y=R+(_.duration??0);const x=async()=>{const I=new Promise(requestAnimationFrame).then(()=>{var P;if(!l.isAtBottom)return l.animation=void 0,!1;const{scrollTop:O}=l,M=performance.now(),$=(M-(l.lastTick??M))/yg;if(l.animation||(l.animation={behavior:A,promise:I,ignoreEscapes:F}),l.animation.behavior===A&&(l.lastTick=M),m()||R>Date.now())return x();if(O<Math.min(j,l.calculatedTargetScrollTop)){if(((P=l.animation)==null?void 0:P.behavior)===A){if(A==="instant")return l.scrollTop=l.calculatedTargetScrollTop,x();l.velocity=(A.damping*l.velocity+A.stiffness*l.scrollDifference)/A.mass,l.accumulated+=l.velocity*$,l.scrollTop+=l.accumulated,l.scrollTop!==O&&(l.accumulated=0)}return x()}return y>Date.now()?(j=l.calculatedTargetScrollTop,x()):(l.animation=void 0,l.scrollTop<l.calculatedTargetScrollTop?u({animation:wr(i.current,i.current.resize),ignoreEscapes:F,duration:Math.max(0,y-Date.now())||void 0}):l.isAtBottom)});return I.then(O=>(requestAnimationFrame(()=>{l.animation||(l.lastTick=void 0,l.velocity=0)}),O))};return _.wait!==!0&&(l.animation=void 0),((b=l.animation)==null?void 0:b.behavior)===A?l.animation.promise:x()},[f,m,l]),h=p.useCallback(()=>{c(!0),f(!1)},[c,f]),g=p.useCallback(({target:_})=>{if(_!==C.current)return;const{scrollTop:R,ignoreScrollToTop:A}=l;let{lastScrollTop:F=R}=l;l.lastScrollTop=R,l.ignoreScrollToTop=void 0,A&&A>R&&(F=A),a(l.isNearBottom),setTimeout(()=>{var x;if(l.resizeDifference||R===A)return;if(m()){c(!0),f(!1);return}const y=R>F,j=R<F;if((x=l.animation)!=null&&x.ignoreEscapes){l.scrollTop=F;return}j&&(c(!0),f(!1)),y&&c(!1),!l.escapedFromLock&&l.isNearBottom&&f(!0)},1)},[c,f,m,l]),v=p.useCallback(({target:_,deltaY:R})=>{var F;let A=_;for(;!["scroll","auto"].includes(getComputedStyle(A).overflow);){if(!A.parentElement)return;A=A.parentElement}A===C.current&&R<0&&C.current.scrollHeight>C.current.clientHeight&&!((F=l.animation)!=null&&F.ignoreEscapes)&&(c(!0),f(!1))},[c,f,l]),C=ws(_=>{var R,A;(R=C.current)==null||R.removeEventListener("scroll",g),(A=C.current)==null||A.removeEventListener("wheel",v),_==null||_.addEventListener("scroll",g,{passive:!0}),_==null||_.addEventListener("wheel",v,{passive:!0})},[]),w=ws(_=>{var A,F;if((A=l.resizeObserver)==null||A.disconnect(),!_)return;let R;l.resizeObserver=new ResizeObserver(([y])=>{const{height:j}=y.contentRect,x=j-(R??j);if(l.resizeDifference=x,l.scrollTop>l.targetScrollTop&&(l.scrollTop=l.targetScrollTop),a(l.isNearBottom),x>=0){const b=wr(i.current,R?i.current.resize:i.current.initial);u({animation:b,wait:!0,preserveScrollPosition:!0,duration:b==="instant"?void 0:Cg})}else l.isNearBottom&&(c(!1),f(!0));R=j,requestAnimationFrame(()=>{setTimeout(()=>{l.resizeDifference===x&&(l.resizeDifference=0)},1)})}),(F=l.resizeObserver)==null||F.observe(_)},[]);return{contentRef:w,scrollRef:C,scrollToBottom:u,stopScroll:h,isAtBottom:o||s,isNearBottom:s,escapedFromLock:t,state:l}};function ws(e,t){const n=p.useCallback(o=>(n.current=o,e(o)),t);return n}const br=new Map;function wr(...e){const t={...bg};let n=!1;for(const r of e){if(r==="instant"){n=!0;continue}typeof r=="object"&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}const o=JSON.stringify(t);return br.has(o)||br.set(o,Object.freeze(t)),n?"instant":br.get(o)}/*!---------------------------------------------------------------------------------------------
221
- * Copyright (c) StackBlitz. All rights reserved.
222
- * Licensed under the MIT License. See License.txt in the project root for license information.
223
- *--------------------------------------------------------------------------------------------*/const il=p.createContext(null),Eg=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Fn({instance:e,children:t,resize:n,initial:o,mass:r,damping:s,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const c=p.useRef(null),l=p.useCallback((F,y)=>{const j=(A==null?void 0:A.targetScrollTop)??i;return(j==null?void 0:j(F,y))??F},[i]),u=Sg({mass:r,damping:s,stiffness:a,resize:n,initial:o,targetScrollTop:l}),{scrollRef:h,contentRef:g,scrollToBottom:v,stopScroll:C,isAtBottom:w,escapedFromLock:_,state:R}=e??u,A=p.useMemo(()=>({scrollToBottom:v,stopScroll:C,scrollRef:h,isAtBottom:w,escapedFromLock:_,contentRef:g,state:R,get targetScrollTop(){return c.current},set targetScrollTop(F){c.current=F}}),[v,w,g,h,C,_,R]);return p.useImperativeHandle(m,()=>A,[A]),Eg(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(il.Provider,{value:A},p.createElement("div",{...f},typeof t=="function"?t(A):t))}(function(e){function t({children:n,scrollClassName:o,...r}){const s=Ro();return p.createElement("div",{ref:s.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:o},p.createElement("div",{...r,ref:s.contentRef},typeof n=="function"?n(s):n))}e.Content=t})(Fn||(Fn={}));function Ro(){const e=p.useContext(il);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const kg=({className:e,...t})=>d.jsx(Fn,{className:Z("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Ag=({className:e,...t})=>d.jsx(Fn.Content,{className:Z("mx-auto flex max-w-3xl flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),_g=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:o,children:r,...s})=>d.jsx("div",{className:Z("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:r??d.jsxs(d.Fragment,{children:[o&&d.jsx("div",{className:"text-text-muted",children:o}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&d.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),jg=({className:e,...t})=>{const{scrollToBottom:n}=Ro(),o=p.useCallback(()=>{n()},[n]);return d.jsx(At,{className:Z("rounded-full",e),onClick:o,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:d.jsx(Jc,{className:"size-4"})})},Rg="data-last-user-message",Tg=({className:e,...t})=>{const n=p.useCallback(()=>{const o=document.querySelector(`[${Rg}="true"]`);o&&o.scrollIntoView({behavior:"smooth",block:"start"})},[]);return d.jsx(At,{className:Z("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:d.jsx(ra,{className:"size-4"})})},Ng=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:o}=Ro();return o?null:d.jsxs("div",{className:Z("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&d.jsx(Tg,{}),d.jsx(jg,{})]})};function Ig({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:o="开始对话",emptyDescription:r="输入消息开始聊天"}){var m;const s=Og(e),a=e.length>0,i=t&&e.length>0&&((m=e[e.length-1])==null?void 0:m.type)==="user_message";return d.jsx(kg,{className:"flex-1",children:d.jsxs(Ag,{children:[a?d.jsxs(d.Fragment,{children:[s.map((f,c)=>f.type==="single"?d.jsx("div",{className:Z(Pg(e,c)),children:d.jsx(Mg,{entry:f.entry,isLoading:t,onPermissionRespond:n})},`entry-${c}`):d.jsx("div",{className:"-mt-2",children:d.jsx(al,{entries:f.entries,onPermissionRespond:n})},`group-${c}`)),i&&d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsx("div",{className:"flex items-center gap-1 pt-2",children:d.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[d.jsx("span",{}),d.jsx("span",{}),d.jsx("span",{})]})})]})]}):d.jsx(_g,{title:o,description:r}),d.jsx(Ng,{hasUserMessages:e.some(f=>f.type==="user_message")})]})})}function Pg(e,t){const n=e[t];if((n==null?void 0:n.type)==="user_message")return"pt-10 pb-3";if((n==null?void 0:n.type)==="assistant_message"){const o=e[t+1];return(o==null?void 0:o.type)==="tool_call"?"pt-3 pb-1":"pt-3 pb-8"}return(n==null?void 0:n.type)==="plan"?"pt-3 pb-3":(n==null?void 0:n.type)==="command_output"?"pt-6 pb-3":"py-2"}function Mg({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return d.jsx(rg,{entry:e});case"assistant_message":return d.jsx(og,{entry:e,isStreaming:t});case"tool_call":return d.jsx(al,{entries:[e],onPermissionRespond:n});case"plan":return d.jsx(pg,{entry:e});case"command_output":return d.jsx(vg,{entry:e});default:return null}}function Og(e){const t=[];let n=[];const o=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const r of e)r.type==="tool_call"?n.push(r):(o(),t.push({type:"single",entry:r}));return o(),t}function Dg(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function Lg({commands:e,filter:t,onSelect:n,onClose:o,className:r}){const s=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>Dg(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=c=>{s.current&&!s.current.contains(c.target)&&o()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),p.useEffect(()=>{const f=c=>{if(m.length!==0){if(c.key==="ArrowDown")c.preventDefault(),i(l=>(l+1)%m.length);else if(c.key==="ArrowUp")c.preventDefault(),i(l=>(l-1+m.length)%m.length);else if(c.key==="Enter"&&!c.shiftKey){c.preventDefault();const l=m[a];l&&n(l)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=s.current;if(!f)return;const c=f.querySelector("[data-active='true']");c==null||c.scrollIntoView({block:"nearest"})},[a]),d.jsx("div",{ref:s,className:Z("rounded-xl border border-border bg-surface-2 shadow-lg",r),children:d.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?d.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:"没有匹配的命令"}):m.map((f,c)=>{var l;return d.jsxs("button",{type:"button","data-active":c===a,onClick:()=>n(f),onMouseEnter:()=>i(c),className:Z("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",c===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[d.jsxs("span",{className:"text-sm font-display font-medium text-brand",children:["/",f.name]}),d.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((l=f.input)==null?void 0:l.hint)&&d.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function yt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const Fg={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},$g=500*1024,ll=2*1024*1024,yr=200,ys=5*1024*1024,Ug=new Set([".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".csv",".tsv",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".rb",".go",".rs",".java",".kt",".kts",".c",".h",".cc",".cpp",".hpp",".cxx",".cs",".swift",".m",".mm",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".css",".scss",".sass",".less",".styl",".vue",".svelte",".astro",".lua",".r",".R",".jl",".ex",".exs",".erl",".hs",".ml",".php",".pl",".pm",".dockerfile",".makefile",".cmake",".gitignore",".env",".editorconfig",".prettierrc",".eslintrc",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".thrift",".tf",".hcl",".sol"]),zg=new Set([".csv",".tsv",".xlsx",".xls"]);function rn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function cl(e){if(e.type.startsWith("text/"))return!0;const t=rn(e.name);return Ug.has(t)}function Hr(e){const t=rn(e.name);return zg.has(t)}function Bg({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:o=!1,placeholder:r="给 Saluzi 发送消息…",supportsAttachments:s,supportsImages:a,commands:i,className:m}){const f=s??a??!1,[c,l]=p.useState(""),[u,h]=p.useState([]),[g,v]=p.useState([]),[C,w]=p.useState(!1),[_,R]=p.useState(""),[A,F]=p.useState(!1),[y,j]=p.useState(!1),[x,b]=p.useState(!1),I=p.useRef(null),O=p.useRef(null),M=p.useRef(null),$=p.useRef(null),P=p.useRef(null),U=p.useRef(null),E=p.useRef(null);p.useEffect(()=>{yt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:f,commandsCount:(i==null?void 0:i.length)??0})},[f,i]),p.useEffect(()=>{if(!y)return;const W=q=>{var re,fe;const J=q.target,te=(re=U.current)==null?void 0:re.contains(J),ie=(fe=E.current)==null?void 0:fe.contains(J);!te&&!ie&&j(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[y]);const S=p.useCallback(W=>{const q=(W??c).trim(),J=u.length>0||g.length>0;!q&&!J||o||x||(e({text:q,images:u.length>0?u:void 0,attachments:g.length>0?g:void 0}),l(""),h([]),v([]),w(!1),R(""),I.current&&(I.current.style.height="auto"))},[c,u,g,o,x,e]),D=p.useCallback(W=>{if(C){if(W.key==="Escape"){W.preventDefault(),w(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),w(!1);return}}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t?n==null||n():S())},[S,t,n,C]),k=p.useCallback(W=>{const q=W.target.value;l(q),q.startsWith("/")&&i&&i.length>0?(w(!0),R(q.slice(1).split(/\s/)[0]||"")):C&&(w(!1),R(""));const J=W.target;J.style.height="auto",J.style.height=Math.min(J.scrollHeight,200)+"px"},[i,C]),N=p.useCallback(async W=>{if(yt("[ChatInput] paste event",{canAttach:f,files:W.clipboardData.files.length,types:W.clipboardData.types}),!f)return;const q=Array.from(W.clipboardData.files).filter(J=>J.type.startsWith("image/"));if(yt("[ChatInput] paste image files",{count:q.length,types:q.map(J=>J.type)}),q.length!==0){W.preventDefault(),b(!0);try{const J=await Cr(q);h(te=>[...te,...J])}finally{b(!1)}}},[f]),H=p.useCallback(async()=>{if(!O.current)return;const W=O.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await Cr(Array.from(W));h(J=>[...J,...q])}finally{O.current.value="",b(!1)}}},[]),T=p.useCallback(async()=>{if(!M.current)return;const W=M.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await Cs(Array.from(W));v(J=>[...J,...q])}finally{M.current.value="",b(!1)}}},[]),B=p.useCallback(async()=>{if(!$.current)return;const W=$.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await Ss(Array.from(W));v(J=>[...J,...q])}finally{$.current.value="",b(!1)}}},[]),z=p.useCallback(async()=>{if(!P.current)return;const W=P.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await Wg(Array.from(W));q&&v(J=>[...J,q])}finally{P.current.value="",b(!1)}}},[]),L=p.useCallback(W=>{h(q=>q.filter((J,te)=>te!==W))},[]),G=p.useCallback(W=>{v(q=>q.filter((J,te)=>te!==W))},[]),V=p.useCallback(W=>{var J,te;w(!1),R("");const q=`/${W.name}`;(J=W.input)!=null&&J.hint?(l(`${q} `),(te=I.current)==null||te.focus()):S(q)},[S]),X=p.useCallback(W=>{f&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",A||F(!0))},[f,A]),K=p.useCallback(W=>{const q=W.relatedTarget;(!q||!W.currentTarget.contains(q))&&F(!1)},[]),ne=p.useCallback(async W=>{if(!f)return;const q=Array.from(W.dataTransfer.files);if(q.length!==0){W.preventDefault(),F(!1),b(!0);try{const J=q.filter(re=>re.type.startsWith("image/")),te=q.filter(re=>!re.type.startsWith("image/")&&Hr(re)),ie=q.filter(re=>!re.type.startsWith("image/")&&!Hr(re)&&cl(re));if(J.length>0){const re=await Cr(J);h(fe=>[...fe,...re])}if(te.length>0){const re=await Ss(te);v(fe=>[...fe,...re])}if(ie.length>0){const re=await Cs(ie);v(fe=>[...fe,...re])}}finally{b(!1)}}},[f]),ae=p.useCallback(()=>{var W;C?(w(!1),R("")):(c.startsWith("/")||l("/"+c),w(!0),R(c.startsWith("/")&&c.slice(1).split(/\s/)[0]||""),(W=I.current)==null||W.focus())},[C,c]),ce=u.length+g.length,me=(c.trim()||ce>0)&&!o&&!x;return d.jsxs("div",{className:Z("w-full max-w-3xl mx-auto px-4 sm:px-8 pb-4 pt-2",m),children:[d.jsxs("div",{className:"relative",children:[C&&i&&i.length>0&&d.jsx(Lg,{commands:i,filter:_,onSelect:V,onClose:()=>{w(!1),R("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),y&&f&&d.jsxs("div",{ref:U,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=O.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(pu,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"图片"})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=M.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Zt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"文本文件"})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=$.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Zr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"表格文件"})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=P.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Qr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"目录"})]})]}),d.jsxs("div",{onDragOver:X,onDragLeave:K,onDrop:ne,className:Z("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",A&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[u.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:u.map((W,q)=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${q+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),d.jsx("button",{type:"button",onClick:()=>L(q),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${q+1}`,children:"×"})]},q))}),g.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:g.map((W,q)=>d.jsx(Hg,{attachment:W,onRemove:()=>G(q)},q))}),d.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[f&&d.jsxs("div",{className:"relative flex-shrink-0",children:[d.jsxs("button",{ref:E,type:"button",onClick:()=>j(W=>!W),disabled:o||x,className:Z("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",y?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[d.jsx(Tu,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Attach"})]}),d.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:H}),d.jsx("input",{ref:M,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:T}),d.jsx("input",{ref:$,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:B}),d.jsx("input",{ref:P,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:z})]}),i&&i.length>0&&d.jsx("button",{type:"button",onClick:ae,className:Z("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-colors",C?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),disabled:o,title:"命令列表",children:d.jsx(Wu,{className:"h-4 w-4"})}),d.jsx("textarea",{ref:I,value:c,onChange:k,onKeyDown:D,onPaste:N,placeholder:x?"处理文件中…":r,disabled:o,rows:1,className:Z("flex-1 resize-none border-none bg-transparent outline-none","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),d.jsx("button",{type:"button",onClick:t?n:()=>S(),disabled:!t&&!me,className:Z("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":me?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?d.jsx(Vu,{className:"h-3.5 w-3.5",fill:"currentColor"}):x?d.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):d.jsx(Lu,{className:"h-4 w-4"})})]})]})]}),d.jsx("div",{className:"text-center mt-1.5",children:d.jsx("span",{className:"text-[11px] text-text-muted font-display",children:"Enter 发送,Shift+Enter 换行"})})]})}function Hg({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return d.jsx(Zt,{className:"h-3.5 w-3.5"});case"table":return d.jsx(Zr,{className:"h-3.5 w-3.5"});case"directory":return d.jsx(Qr,{className:"h-3.5 w-3.5"});default:return d.jsx(Zt,{className:"h-3.5 w-3.5"})}})(),o=e.size!=null?Ot(e.size):null,r=e.kind==="directory"&&e.files?e.files.length:null;return d.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,d.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),o&&d.jsx("span",{className:"text-text-muted text-[10px]",children:o}),r!=null&&d.jsxs("span",{className:"text-text-muted text-[10px]",children:[r," 文件"]}),d.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:d.jsx(Un,{className:"h-3 w-3"})})]})}function Ot(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Cr(e){const t=[];for(const n of e)try{let o=n,r=n.type;n.size>2*1024*1024&&(o=await ve(n,Fg),r="image/jpeg");const s=await Gg(o);t.push({mimeType:r,data:s})}catch(o){console.error("Failed to process image:",o)}return t}async function Cs(e){const t=[];for(const n of e)try{if(n.size>ll){console.warn(`Skipping ${n.name}: too large (${Ot(n.size)})`);continue}n.size>$g&&console.warn(`File ${n.name} is large (${Ot(n.size)}), may slow down`);const o=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:o,mimeType:n.type||"text/plain"})}catch(o){console.error(`Failed to read text file ${n.name}:`,o)}return t}async function Ss(e){const t=[];for(const n of e)try{const o=rn(n.name);if(o===".csv"||o===".tsv"){const r=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/csv"})}else if(o===".xlsx"||o===".xls"){const r=await n.arrayBuffer(),s=await ul(r);t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(o){console.error(`Failed to process table file ${n.name}:`,o)}return t}async function ul(e){const t=await ke(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),o=[];for(const r of n.SheetNames){const s=n.Sheets[r];if(!s)continue;const a=t.utils.sheet_to_csv(s);n.SheetNames.length>1?o.push(`## Sheet: ${r}
224
-
225
- ${a}`):o.push(a)}return o.join(`
226
-
227
- `)}async function Wg(e){if(e.length===0)return null;const t=e.filter(u=>!(u.name.startsWith(".")||u.size>ll));t.length>yr&&console.warn(`Directory has ${t.length} files, truncating to ${yr}`);const n=t.slice(0,yr);let o=0;for(const u of n)o+=u.size;o>ys&&console.warn(`Directory total size ${Ot(o)} exceeds limit, some files may be truncated`);const r=n[0].webkitRelativePath,s=r&&r.split("/")[0]||"目录",a=[],i=[];let m=0;const f=[...n].sort((u,h)=>{const g=u.webkitRelativePath||u.name,v=h.webkitRelativePath||h.name;return g.localeCompare(v)});for(const u of f){const h=u.webkitRelativePath||u.name;if(a.push(h),cl(u)||Hr(u))if(m+u.size<=ys)try{let g;if(rn(u.name)===".xlsx"||rn(u.name)===".xls"){const v=await u.arrayBuffer();g=await ul(v)}else g=await u.text();i.push(`
228
- ### ${h}
229
- \`\`\`
230
- ${g}
231
- \`\`\``),m+=u.size}catch{i.push(`
232
- ### ${h}
233
- (读取失败)`)}else i.push(`
234
- ### ${h}
235
- (文件过大,已跳过)`);else u.type.startsWith("image/")?i.push(`
236
- ### ${h}
237
- (图片文件,${Ot(u.size)})`):i.push(`
238
- ### ${h}
239
- (二进制文件,${Ot(u.size)})`)}const c=a.join(`
240
- `),l=[`# 目录: ${s}`,`共 ${a.length} 个文件`,"","## 文件结构","```",c,"```","","## 文件内容",...i].join(`
241
- `);return{kind:"directory",name:s,size:o,textContent:l,files:a}}async function Gg(e){return new Promise((t,n)=>{const o=new FileReader;o.onloadend=()=>{const r=o.result,s=r.indexOf(",");t(s>=0?r.slice(s+1):r)},o.onerror=()=>n(new Error("FileReader error")),o.readAsDataURL(e)})}function Vg({requests:e,onRespond:t,className:n}){return e.length===0?null:d.jsx("div",{className:Z("w-full max-w-3xl mx-auto px-4",n),children:d.jsx("div",{className:"space-y-2",children:e.map(o=>d.jsx(Kg,{request:o,onRespond:t},o.requestId))})})}function Kg({request:e,onRespond:t}){return d.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[d.jsx(ta,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&d.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-brand text-white text-xs font-medium hover:bg-brand-light transition-colors flex items-center gap-1.5",children:[d.jsx(on,{className:"h-3.5 w-3.5"}),"允许"]}),d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-warning-border/30 text-warning-text text-xs font-medium hover:bg-warning-bg transition-colors flex items-center gap-1.5",children:[d.jsx(Un,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}var tr="Popover",[dl]=Ze(tr,[Ht]),mn=Ht(),[qg,mt]=dl(tr),fl=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!1}=e,i=mn(t),m=p.useRef(null),[f,c]=p.useState(!1),[l,u]=it({prop:o,defaultProp:r??!1,onChange:s,caller:tr});return d.jsx(lo,{...i,children:d.jsx(qg,{scope:t,contentId:Ce(),triggerRef:m,open:l,onOpenChange:u,onOpenToggle:p.useCallback(()=>u(h=>!h),[u]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>c(!0),[]),onCustomAnchorRemove:p.useCallback(()=>c(!1),[]),modal:a,children:n})})};fl.displayName=tr;var ml="PopoverAnchor",Yg=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=mt(ml,n),s=mn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=r;return p.useEffect(()=>(a(),()=>i()),[a,i]),d.jsx(Vn,{...s,...o,ref:t})});Yg.displayName=ml;var pl="PopoverTrigger",hl=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=mt(pl,n),s=mn(n),a=pe(t,r.triggerRef),i=d.jsx(ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":wl(r.open),...o,ref:a,onClick:ee(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?i:d.jsx(Vn,{asChild:!0,...s,children:i})});hl.displayName=pl;var To="PopoverPortal",[Xg,Qg]=dl(To,{forceMount:void 0}),gl=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,s=mt(To,t);return d.jsx(Xg,{scope:t,forceMount:n,children:d.jsx(Te,{present:n||s.open,children:d.jsx(ln,{asChild:!0,container:r,children:o})})})};gl.displayName=To;var $t="PopoverContent",xl=p.forwardRef((e,t)=>{const n=Qg($t,e.__scopePopover),{forceMount:o=n.forceMount,...r}=e,s=mt($t,e.__scopePopover);return d.jsx(Te,{present:o||s.open,children:s.modal?d.jsx(Jg,{...r,ref:t}):d.jsx(ex,{...r,ref:t})})});xl.displayName=$t;var Zg=Dt("PopoverContent.RemoveScroll"),Jg=p.forwardRef((e,t)=>{const n=mt($t,e.__scopePopover),o=p.useRef(null),r=pe(t,o),s=p.useRef(!1);return p.useEffect(()=>{const a=o.current;if(a)return fo(a)},[]),d.jsx(qr,{as:Zg,allowPinchZoom:!0,children:d.jsx(vl,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;s.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:ee(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),ex=p.forwardRef((e,t)=>{const n=mt($t,e.__scopePopover),o=p.useRef(!1),r=p.useRef(!1);return d.jsx(vl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(o.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),vl=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:c,...l}=e,u=mt($t,n),h=mn(n);return Jr(),d.jsx(zn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:d.jsx(sn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>u.onOpenChange(!1),children:d.jsx(co,{"data-state":wl(u.open),role:"dialog",id:u.contentId,...h,...l,ref:t,style:{...l.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),bl="PopoverClose",tx=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=mt(bl,n);return d.jsx(ue.button,{type:"button",...o,ref:t,onClick:ee(e.onClick,()=>r.onOpenChange(!1))})});tx.displayName=bl;var nx="PopoverArrow",rx=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=mn(n);return d.jsx(uo,{...r,...o,ref:t})});rx.displayName=nx;function wl(e){return e?"open":"closed"}var ox=fl,sx=hl,ax=gl,ix=xl;function yl({...e}){return d.jsx(ox,{"data-slot":"popover",...e})}function Cl({...e}){return d.jsx(sx,{"data-slot":"popover-trigger",...e})}function Sl({className:e,align:t="center",sideOffset:n=4,...o}){return d.jsx(ax,{children:d.jsx(ix,{"data-slot":"popover-content",align:t,sideOffset:n,className:Z("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...o})})}var Es=1,lx=.9,cx=.8,ux=.17,Sr=.1,Er=.999,dx=.9999,fx=.99,mx=/[\\\/_+.#"@\[\(\{&]/,px=/[\\\/_+.#"@\[\(\{&]/g,hx=/[\s-]/,El=/[\s-]/g;function Wr(e,t,n,o,r,s,a){if(s===t.length)return r===e.length?Es:fx;var i=`${r},${s}`;if(a[i]!==void 0)return a[i];for(var m=o.charAt(s),f=n.indexOf(m,r),c=0,l,u,h,g;f>=0;)l=Wr(e,t,n,o,f+1,s+1,a),l>c&&(f===r?l*=Es:mx.test(e.charAt(f-1))?(l*=cx,h=e.slice(r,f-1).match(px),h&&r>0&&(l*=Math.pow(Er,h.length))):hx.test(e.charAt(f-1))?(l*=lx,g=e.slice(r,f-1).match(El),g&&r>0&&(l*=Math.pow(Er,g.length))):(l*=ux,r>0&&(l*=Math.pow(Er,f-r))),e.charAt(f)!==t.charAt(s)&&(l*=dx)),(l<Sr&&n.charAt(f-1)===o.charAt(s+1)||o.charAt(s+1)===o.charAt(s)&&n.charAt(f-1)!==o.charAt(s))&&(u=Wr(e,t,n,o,f+1,s+2,a),u*Sr>l&&(l=u*Sr)),l>c&&(c=l),f=n.indexOf(m,f+1);return a[i]=c,c}function ks(e){return e.toLowerCase().replace(El," ")}function gx(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Wr(e,t,ks(e),ks(t),0,0,{})}var nr="Dialog",[kl]=Ze(nr),[xx,Le]=kl(nr),Al=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,c]=it({prop:o,defaultProp:r??!1,onChange:s,caller:nr});return d.jsx(xx,{scope:t,triggerRef:i,contentRef:m,contentId:Ce(),titleId:Ce(),descriptionId:Ce(),open:f,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(l=>!l),[c]),modal:a,children:n})};Al.displayName=nr;var _l="DialogTrigger",vx=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(_l,n),s=pe(t,r.triggerRef);return d.jsx(ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Po(r.open),...o,ref:s,onClick:ee(e.onClick,r.onOpenToggle)})});vx.displayName=_l;var No="DialogPortal",[bx,jl]=kl(No,{forceMount:void 0}),Rl=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,s=Le(No,t);return d.jsx(bx,{scope:t,forceMount:n,children:p.Children.map(o,a=>d.jsx(Te,{present:n||s.open,children:d.jsx(ln,{asChild:!0,container:r,children:a})}))})};Rl.displayName=No;var $n="DialogOverlay",Tl=p.forwardRef((e,t)=>{const n=jl($n,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=Le($n,e.__scopeDialog);return s.modal?d.jsx(Te,{present:o||s.open,children:d.jsx(yx,{...r,ref:t})}):null});Tl.displayName=$n;var wx=Dt("DialogOverlay.RemoveScroll"),yx=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le($n,n);return d.jsx(qr,{as:wx,allowPinchZoom:!0,shards:[r.contentRef],children:d.jsx(ue.div,{"data-state":Po(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),St="DialogContent",Nl=p.forwardRef((e,t)=>{const n=jl(St,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=Le(St,e.__scopeDialog);return d.jsx(Te,{present:o||s.open,children:s.modal?d.jsx(Cx,{...r,ref:t}):d.jsx(Sx,{...r,ref:t})})});Nl.displayName=St;var Cx=p.forwardRef((e,t)=>{const n=Le(St,e.__scopeDialog),o=p.useRef(null),r=pe(t,n.contentRef,o);return p.useEffect(()=>{const s=o.current;if(s)return fo(s)},[]),d.jsx(Il,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault())})}),Sx=p.forwardRef((e,t)=>{const n=Le(St,e.__scopeDialog),o=p.useRef(!1),r=p.useRef(!1);return d.jsx(Il,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(o.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),Il=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,i=Le(St,n),m=p.useRef(null),f=pe(t,m);return Jr(),d.jsxs(d.Fragment,{children:[d.jsx(zn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:d.jsx(sn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Po(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(kx,{titleId:i.titleId}),d.jsx(_x,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Io="DialogTitle",Pl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(Io,n);return d.jsx(ue.h2,{id:r.titleId,...o,ref:t})});Pl.displayName=Io;var Ml="DialogDescription",Ex=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(Ml,n);return d.jsx(ue.p,{id:r.descriptionId,...o,ref:t})});Ex.displayName=Ml;var Ol="DialogClose",Dl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(Ol,n);return d.jsx(ue.button,{type:"button",...o,ref:t,onClick:ee(e.onClick,()=>r.onOpenChange(!1))})});Dl.displayName=Ol;function Po(e){return e?"open":"closed"}var Ll="DialogTitleWarning",[ib,Fl]=md(Ll,{contentName:St,titleName:Io,docsSlug:"dialog"}),kx=({titleId:e})=>{const t=Fl(Ll),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
242
-
243
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
244
-
245
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ax="DialogDescriptionWarning",_x=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Fl(Ax).contentName}}.`;return p.useEffect(()=>{var s;const r=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},jx=Al,Rx=Rl,Tx=Tl,Nx=Nl,lb=Pl,cb=Dl,Xt='[cmdk-group=""]',kr='[cmdk-group-items=""]',Ix='[cmdk-group-heading=""]',$l='[cmdk-item=""]',As=`${$l}:not([aria-disabled="true"])`,Gr="cmdk-item-select",Nt="data-value",Px=(e,t,n)=>gx(e,t,n),Ul=p.createContext(void 0),pn=()=>p.useContext(Ul),zl=p.createContext(void 0),Mo=()=>p.useContext(zl),Bl=p.createContext(void 0),Hl=p.forwardRef((e,t)=>{let n=It(()=>{var T,B;return{search:"",value:(B=(T=e.value)!=null?T:e.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=It(()=>new Set),r=It(()=>new Map),s=It(()=>new Map),a=It(()=>new Set),i=Wl(e),{label:m,children:f,value:c,onValueChange:l,filter:u,shouldFilter:h,loop:g,disablePointerSelection:v=!1,vimBindings:C=!0,...w}=e,_=Ce(),R=Ce(),A=Ce(),F=p.useRef(null),y=Wx();Et(()=>{if(c!==void 0){let T=c.trim();n.current.value=T,j.emit()}},[c]),Et(()=>{y(6,$)},[]);let j=p.useMemo(()=>({subscribe:T=>(a.current.add(T),()=>a.current.delete(T)),snapshot:()=>n.current,setState:(T,B,z)=>{var L,G,V,X;if(!Object.is(n.current[T],B)){if(n.current[T]=B,T==="search")M(),I(),y(1,O);else if(T==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(A);K?K.focus():(L=document.getElementById(_))==null||L.focus()}if(y(7,()=>{var K;n.current.selectedItemId=(K=P())==null?void 0:K.id,j.emit()}),z||y(5,$),((G=i.current)==null?void 0:G.value)!==void 0){let K=B??"";(X=(V=i.current).onValueChange)==null||X.call(V,K);return}}j.emit()}},emit:()=>{a.current.forEach(T=>T())}}),[]),x=p.useMemo(()=>({value:(T,B,z)=>{var L;B!==((L=s.current.get(T))==null?void 0:L.value)&&(s.current.set(T,{value:B,keywords:z}),n.current.filtered.items.set(T,b(B,z)),y(2,()=>{I(),j.emit()}))},item:(T,B)=>(o.current.add(T),B&&(r.current.has(B)?r.current.get(B).add(T):r.current.set(B,new Set([T]))),y(3,()=>{M(),I(),n.current.value||O(),j.emit()}),()=>{s.current.delete(T),o.current.delete(T),n.current.filtered.items.delete(T);let z=P();y(4,()=>{M(),(z==null?void 0:z.getAttribute("id"))===T&&O(),j.emit()})}),group:T=>(r.current.has(T)||r.current.set(T,new Set),()=>{s.current.delete(T),r.current.delete(T)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:_,inputId:A,labelId:R,listInnerRef:F}),[]);function b(T,B){var z,L;let G=(L=(z=i.current)==null?void 0:z.filter)!=null?L:Px;return T?G(T,n.current.search,B):0}function I(){if(!n.current.search||i.current.shouldFilter===!1)return;let T=n.current.filtered.items,B=[];n.current.filtered.groups.forEach(L=>{let G=r.current.get(L),V=0;G.forEach(X=>{let K=T.get(X);V=Math.max(K,V)}),B.push([L,V])});let z=F.current;U().sort((L,G)=>{var V,X;let K=L.getAttribute("id"),ne=G.getAttribute("id");return((V=T.get(ne))!=null?V:0)-((X=T.get(K))!=null?X:0)}).forEach(L=>{let G=L.closest(kr);G?G.appendChild(L.parentElement===G?L:L.closest(`${kr} > *`)):z.appendChild(L.parentElement===z?L:L.closest(`${kr} > *`))}),B.sort((L,G)=>G[1]-L[1]).forEach(L=>{var G;let V=(G=F.current)==null?void 0:G.querySelector(`${Xt}[${Nt}="${encodeURIComponent(L[0])}"]`);V==null||V.parentElement.appendChild(V)})}function O(){let T=U().find(z=>z.getAttribute("aria-disabled")!=="true"),B=T==null?void 0:T.getAttribute(Nt);j.setState("value",B||void 0)}function M(){var T,B,z,L;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let G=0;for(let V of o.current){let X=(B=(T=s.current.get(V))==null?void 0:T.value)!=null?B:"",K=(L=(z=s.current.get(V))==null?void 0:z.keywords)!=null?L:[],ne=b(X,K);n.current.filtered.items.set(V,ne),ne>0&&G++}for(let[V,X]of r.current)for(let K of X)if(n.current.filtered.items.get(K)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=G}function $(){var T,B,z;let L=P();L&&(((T=L.parentElement)==null?void 0:T.firstChild)===L&&((z=(B=L.closest(Xt))==null?void 0:B.querySelector(Ix))==null||z.scrollIntoView({block:"nearest"})),L.scrollIntoView({block:"nearest"}))}function P(){var T;return(T=F.current)==null?void 0:T.querySelector(`${$l}[aria-selected="true"]`)}function U(){var T;return Array.from(((T=F.current)==null?void 0:T.querySelectorAll(As))||[])}function E(T){let B=U()[T];B&&j.setState("value",B.getAttribute(Nt))}function S(T){var B;let z=P(),L=U(),G=L.findIndex(X=>X===z),V=L[G+T];(B=i.current)!=null&&B.loop&&(V=G+T<0?L[L.length-1]:G+T===L.length?L[0]:L[G+T]),V&&j.setState("value",V.getAttribute(Nt))}function D(T){let B=P(),z=B==null?void 0:B.closest(Xt),L;for(;z&&!L;)z=T>0?Bx(z,Xt):Hx(z,Xt),L=z==null?void 0:z.querySelector(As);L?j.setState("value",L.getAttribute(Nt)):S(T)}let k=()=>E(U().length-1),N=T=>{T.preventDefault(),T.metaKey?k():T.altKey?D(1):S(1)},H=T=>{T.preventDefault(),T.metaKey?E(0):T.altKey?D(-1):S(-1)};return p.createElement(ft.div,{ref:t,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:T=>{var B;(B=w.onKeyDown)==null||B.call(w,T);let z=T.nativeEvent.isComposing||T.keyCode===229;if(!(T.defaultPrevented||z))switch(T.key){case"n":case"j":{C&&T.ctrlKey&&N(T);break}case"ArrowDown":{N(T);break}case"p":case"k":{C&&T.ctrlKey&&H(T);break}case"ArrowUp":{H(T);break}case"Home":{T.preventDefault(),E(0);break}case"End":{T.preventDefault(),k();break}case"Enter":{T.preventDefault();let L=P();if(L){let G=new Event(Gr);L.dispatchEvent(G)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:Vx},m),rr(e,T=>p.createElement(zl.Provider,{value:j},p.createElement(Ul.Provider,{value:x},T))))}),Mx=p.forwardRef((e,t)=>{var n,o;let r=Ce(),s=p.useRef(null),a=p.useContext(Bl),i=pn(),m=Wl(e),f=(o=(n=m.current)==null?void 0:n.forceMount)!=null?o:a==null?void 0:a.forceMount;Et(()=>{if(!f)return i.item(r,a==null?void 0:a.id)},[f]);let c=Gl(r,s,[e.value,e.children,s],e.keywords),l=Mo(),u=ut(y=>y.value&&y.value===c.current),h=ut(y=>f||i.filter()===!1?!0:y.search?y.filtered.items.get(r)>0:!0);p.useEffect(()=>{let y=s.current;if(!(!y||e.disabled))return y.addEventListener(Gr,g),()=>y.removeEventListener(Gr,g)},[h,e.onSelect,e.disabled]);function g(){var y,j;v(),(j=(y=m.current).onSelect)==null||j.call(y,c.current)}function v(){l.setState("value",c.current,!0)}if(!h)return null;let{disabled:C,value:w,onSelect:_,forceMount:R,keywords:A,...F}=e;return p.createElement(ft.div,{ref:He(s,t),...F,id:r,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!u,"data-disabled":!!C,"data-selected":!!u,onPointerMove:C||i.getDisablePointerSelection()?void 0:v,onClick:C?void 0:g},e.children)}),Ox=p.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:r,...s}=e,a=Ce(),i=p.useRef(null),m=p.useRef(null),f=Ce(),c=pn(),l=ut(h=>r||c.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);Et(()=>c.group(a),[]),Gl(a,i,[e.value,e.heading,m]);let u=p.useMemo(()=>({id:a,forceMount:r}),[r]);return p.createElement(ft.div,{ref:He(i,t),...s,"cmdk-group":"",role:"presentation",hidden:l?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),rr(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(Bl.Provider,{value:u},h))))}),Dx=p.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,r=p.useRef(null),s=ut(a=>!a.search);return!n&&!s?null:p.createElement(ft.div,{ref:He(r,t),...o,"cmdk-separator":"",role:"separator"})}),Lx=p.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,r=e.value!=null,s=Mo(),a=ut(f=>f.search),i=ut(f=>f.selectedItemId),m=pn();return p.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),p.createElement(ft.input,{ref:t,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":i,id:m.inputId,type:"text",value:r?e.value:a,onChange:f=>{r||s.setState("search",f.target.value),n==null||n(f.target.value)}})}),Fx=p.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...r}=e,s=p.useRef(null),a=p.useRef(null),i=ut(f=>f.selectedItemId),m=pn();return p.useEffect(()=>{if(a.current&&s.current){let f=a.current,c=s.current,l,u=new ResizeObserver(()=>{l=requestAnimationFrame(()=>{let h=f.offsetHeight;c.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return u.observe(f),()=>{cancelAnimationFrame(l),u.unobserve(f)}}},[]),p.createElement(ft.div,{ref:He(s,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":o,id:m.listId},rr(e,f=>p.createElement("div",{ref:He(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),$x=p.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:r,contentClassName:s,container:a,...i}=e;return p.createElement(jx,{open:n,onOpenChange:o},p.createElement(Rx,{container:a},p.createElement(Tx,{"cmdk-overlay":"",className:r}),p.createElement(Nx,{"aria-label":e.label,"cmdk-dialog":"",className:s},p.createElement(Hl,{ref:t,...i}))))}),Ux=p.forwardRef((e,t)=>ut(n=>n.filtered.count===0)?p.createElement(ft.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),zx=p.forwardRef((e,t)=>{let{progress:n,children:o,label:r="Loading...",...s}=e;return p.createElement(ft.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},rr(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),Wt=Object.assign(Hl,{List:Fx,Item:Mx,Input:Lx,Group:Ox,Separator:Dx,Dialog:$x,Empty:Ux,Loading:zx});function Bx(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Hx(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Wl(e){let t=p.useRef(e);return Et(()=>{t.current=e}),t}var Et=typeof window>"u"?p.useEffect:p.useLayoutEffect;function It(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function ut(e){let t=Mo(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function Gl(e,t,n,o=[]){let r=p.useRef(),s=pn();return Et(()=>{var a;let i=(()=>{var f;for(let c of n){if(typeof c=="string")return c.trim();if(typeof c=="object"&&"current"in c)return c.current?(f=c.current.textContent)==null?void 0:f.trim():r.current}})(),m=o.map(f=>f.trim());s.value(e,i,m),(a=t.current)==null||a.setAttribute(Nt,i),r.current=i}),r}var Wx=()=>{let[e,t]=p.useState(),n=It(()=>new Map);return Et(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,r)=>{n.current.set(o,r),t({})}};function Gx(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function rr({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Gx(t),{ref:t.ref},n(t.props.children)):n(t)}var Vx={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Kx({className:e,...t}){return d.jsx(Wt,{"data-slot":"command",className:Z("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function qx({className:e,...t}){return d.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[d.jsx(Ou,{className:"size-4 shrink-0 opacity-50"}),d.jsx(Wt.Input,{"data-slot":"command-input",className:Z("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Yx({className:e,...t}){return d.jsx(Wt.List,{"data-slot":"command-list",className:Z("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Xx({...e}){return d.jsx(Wt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Qx({className:e,...t}){return d.jsx(Wt.Group,{"data-slot":"command-group",className:Z("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function Zx({className:e,...t}){return d.jsx(Wt.Item,{"data-slot":"command-item",className:Z("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function _s(e,t){if(!e)return!0;const n=e.toLowerCase(),o=t.toLowerCase();let r=0;for(let s=0;s<o.length&&r<n.length;s++)o[s]===n[r]&&r++;return r===n.length}function Jx({models:e,currentModelId:t,onSelect:n,showSearch:o=!0,isMobile:r=!1}){const[s,a]=p.useState(""),[i,m]=p.useState(r?"__none__":void 0),f=p.useMemo(()=>s?e.filter(c=>_s(s,c.name)||_s(s,c.modelId)):e,[e,s]);return d.jsxs(Kx,{shouldFilter:!1,value:i,onValueChange:m,children:[o&&d.jsx(qx,{placeholder:"Select a model…",value:s,onValueChange:a}),d.jsxs(Yx,{children:[d.jsx(Xx,{children:"No models found."}),d.jsx(Qx,{children:f.map(c=>d.jsxs(Zx,{value:c.modelId,onSelect:()=>n(c),className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[d.jsx("span",{className:"truncate font-medium",children:c.name}),c.description&&d.jsx("span",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),d.jsx(on,{className:Z("h-4 w-4 shrink-0",t===c.modelId?"opacity-100":"opacity-0")})]},c.modelId))})]})]})}function Vl(e){const[t,n]=p.useState(e.modelState),[o,r]=p.useState(!1);p.useEffect(()=>{const f=l=>{if(n(l),l&&l.availableModels.length>0){const u=localStorage.getItem("acp_model_id");u&&u!==l.currentModelId&&l.availableModels.some(h=>h.modelId===u)&&e.setSessionModel(u).catch(()=>{})}},c=l=>{n(u=>u?{...u,currentModelId:l}:null),r(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(c),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(c)}},[e]);const s=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>s.find(f=>f.modelId===a)??null,[s,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");r(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(c){throw r(!1),c}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:m,isLoading:o}}function ev({client:e,onModelSelect:t}){const[n,o]=p.useState(!1),{supportsModelSelection:r,availableModels:s,currentModel:a,setModel:i,isLoading:m}=Vl(e),f=r&&s.length>0,c=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,l=async u=>{try{await i(u.modelId),t==null||t(u.modelId),o(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return d.jsxs(yl,{open:n,onOpenChange:f?o:void 0,children:[d.jsx(Cl,{asChild:!0,children:d.jsxs(At,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?d.jsx(Zs,{className:"h-3 w-3 animate-spin"}):null,d.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?d.jsx(Qs,{className:"h-3 w-3"}):d.jsx(Ut,{className:"h-3 w-3"})]})}),d.jsx(Sl,{className:"w-72 p-0",align:"end",children:d.jsx(Jx,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:l,showSearch:!c,isMobile:c})})]})}function tv(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const r=s=>{n(s)};return e.setAvailableCommandsChangedHandler(r),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const o=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:o}}const nv=new Set(["clear","new","help","status","model","copy"]),rv=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"},{name:"files",desc:"列出上下文中的文件"}];function ov(e){switch(e){case"help":return"Help";case"status":return"Status";case"model":return"Model";case"copy":return"Copy";default:return e.charAt(0).toUpperCase()+e.slice(1)}}function sv(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function av(e){var o;const t=[];t.push("**本地命令**(Web UI 直接执行)"),t.push("");const n=[{name:"clear",desc:"清空当前对话"},{name:"new",desc:"新建会话"},{name:"help",desc:"显示此帮助信息"},{name:"status",desc:"显示会话状态"},{name:"model [id]",desc:"查看或切换模型"},{name:"copy",desc:"复制最后一条助手消息"}];for(const r of n)t.push(`- \`/${r.name}\` — ${r.desc}`);t.push(""),t.push("**Agent 命令**(发给 Saluzi agent 执行)"),t.push("");for(const r of rv)t.push(`- \`/${r.name}\` — ${r.desc}`);if(e.length>0)for(const r of e){const s=(o=r.input)!=null&&o.hint?` ${r.input.hint}`:"";t.push(`- \`/${r.name}${s}\` — ${r.description}`)}return t.join(`
246
- `)}function iv(e){var n,o,r;const t=["**会话状态**",""];return t.push(`- 会话 ID: \`${e.sessionId??"无"}\``),t.push(`- 当前模型: ${((n=e.currentModel)==null?void 0:n.name)??((o=e.currentModel)==null?void 0:o.modelId)??"未设置"}`),(r=e.currentModel)!=null&&r.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- 可用模型数: ${e.modelCount}`),t.push(`- 图片支持: ${e.supportsImages?"是":"否"}`),t.push(`- 消息条数: ${e.entryCount}`),t.join(`
247
- `)}function lv(e,t){if(e.length===0)return"当前 agent 未提供模型选择能力。";const n=["**可用模型**",""];for(const o of e){const r=o.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${o.modelId}\` — ${o.name}${r}`)}return n.push(""),n.push("使用 `/model <id>` 切换模型。"),n.join(`
248
- `)}async function cv(e,t){var l;if(!e.startsWith("/"))return{handled:!1};const[n,...o]=e.slice(1).split(/\s+/),r=o.join(" ").trim(),s=n==null?void 0:n.toLowerCase();if(!s||!nv.has(s))return{handled:!1};if(s==="clear")return{handled:!0,clearEntries:!0};if(s==="new")return{handled:!0,newSession:!0};let a="",i=!1;if(s==="help")a=av(t.availableCommands);else if(s==="status")a=iv({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(s==="model")if(r)try{await t.setModel(r),a=`已请求切换到模型: \`${r}\``}catch(u){a=`切换模型失败: ${u instanceof Error?u.message:String(u)}`,i=!0}else a=lv(t.availableModels,t.currentModel);else if(s==="copy"){const u=[...t.entries].reverse().find(g=>g.type==="assistant_message"),h=((l=u==null?void 0:u.chunks)==null?void 0:l.map(g=>g.text).join(`
249
- `))??"";try{await navigator.clipboard.writeText(h),a=h?`已复制 ${h.length} 字符到剪贴板`:"没有可复制的助手消息"}catch{a="复制失败:剪贴板不可用",i=!0}}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},c={type:"command_output",id:`cmd-${m}`,commandName:s,inputText:e,title:ov(s),subtitle:sv(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:c}}const uv={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function dv(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),o=e.slice(t+1),r=n.match(/^data:([^;,]+)/),s=r?r[1]:"application/octet-stream",a=atob(o),i=new Uint8Array(a.length);for(let m=0;m<a.length;m++)i[m]=a.charCodeAt(m);return new Blob([i],{type:s})}const Ar=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"dontAsk",label:"不询问",description:"不弹出询问,自动拒绝"},{value:"auto",label:"自动判断",description:"AI 自动判断是否批准"}];function fv({mode:e,onModeChange:t}){const[n,o]=p.useState(!1),r=Ar.find(s=>s.value===e)??Ar[0];return d.jsxs(yl,{open:n,onOpenChange:o,children:[d.jsx(Cl,{asChild:!0,children:d.jsxs(At,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[d.jsx(Bu,{className:"h-3 w-3"}),d.jsx("span",{className:"max-w-24 truncate",children:r.label}),n?d.jsx(Qs,{className:"h-3 w-3"}):d.jsx(Ut,{className:"h-3 w-3"})]})}),d.jsx(Sl,{className:"w-64 p-1",align:"start",children:Ar.map(s=>d.jsxs("button",{type:"button",onClick:()=>{t(s.value),o(!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:[d.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===s.value&&d.jsx(on,{className:"h-3.5 w-3.5 text-brand"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.label}),d.jsx("div",{className:"text-xs text-text-muted",children:s.description})]})]},s.value))})]})}function js(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function _r(e,t){for(let n=e.length-1;n>=0;n--){const o=e[n];if(o&&o.type==="tool_call"&&o.toolCall.id===t)return n}return-1}function mv({client:e,agentId:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),c=p.useRef(null),l=p.useRef(n);l.current=n;const[u,h]=p.useState(null),g=p.useRef(null),[v,C]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[w,_]=p.useState(!1),{commands:R}=tv(e),{availableModels:A,currentModel:F,setModel:y}=Vl(e);p.useEffect(()=>{c.current=m},[m]);const j=p.useCallback(()=>{o([]),s(!1),i(!1)},[]),x=t?`acp_last_session_${t}`:null,b=p.useCallback((D,k)=>{if(((k==null?void 0:k.resetEntries)??!0)&&(o([]),s(!1)),f(D),i(!0),_(e.supportsImages),x)try{localStorage.setItem(x,D)}catch{}console.log("[ChatInterface] Active session:",D,"supportsImages:",e.supportsImages)},[e,x]),I=p.useCallback(D=>{c.current&&D.sessionId!==c.current||(console.log("[ChatInterface] Permission request:",D),o(k=>{const N=_r(k,D.toolCall.toolCallId);if(N>=0)return k.map((H,T)=>T!==N||H.type!=="tool_call"||H.toolCall.status!=="running"?H:{type:"tool_call",toolCall:{...H.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:D.requestId,options:D.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const H={type:"tool_call",toolCall:{id:D.toolCall.toolCallId,title:D.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:D.requestId,options:D.options},isStandalonePermission:!0}};return[...k,H]}}))},[]),O=p.useCallback((D,k)=>{if(!(c.current&&D!==c.current))if(k.sessionUpdate==="agent_message_chunk"){const N=k.content.type==="text"&&k.content.text?k.content.text:"";if(!N)return;o(H=>{const T=H[H.length-1];if((T==null?void 0:T.type)==="assistant_message"){const z=T.chunks[T.chunks.length-1];return(z==null?void 0:z.type)==="message"?[...H.slice(0,-1),{...T,chunks:[...T.chunks.slice(0,-1),{type:"message",text:z.text+N}]}]:[...H.slice(0,-1),{...T,chunks:[...T.chunks,{type:"message",text:N}]}]}const B={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:N}]};return[...H,B]})}else if(k.sessionUpdate==="agent_thought_chunk"){const N=k.content.type==="text"&&k.content.text?k.content.text:"";if(!N)return;o(H=>{const T=H[H.length-1];if((T==null?void 0:T.type)==="assistant_message"){const z=T.chunks[T.chunks.length-1];return(z==null?void 0:z.type)==="thought"?[...H.slice(0,-1),{...T,chunks:[...T.chunks.slice(0,-1),{type:"thought",text:z.text+N}]}]:[...H.slice(0,-1),{...T,chunks:[...T.chunks,{type:"thought",text:N}]}]}const B={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:N}]};return[...H,B]})}else if(k.sessionUpdate==="user_message_chunk"){const N=k.content.type==="text"&&k.content.text?k.content.text:"";if(!N)return;o(H=>{const T=H[H.length-1];if((T==null?void 0:T.type)==="user_message")return[...H.slice(0,-1),{...T,content:T.content+N}];const B={type:"user_message",id:`user-${Date.now()}`,content:N};return[...H,B]})}else if(k.sessionUpdate==="tool_call"){const N={id:k.toolCallId,title:k.title,status:js(k.status),content:k.content,rawInput:k.rawInput,rawOutput:k.rawOutput};o(H=>{const T=_r(H,k.toolCallId);if(T>=0)return H.map((z,L)=>L!==T||z.type!=="tool_call"?z:{type:"tool_call",toolCall:{...z.toolCall,...N}});const B={type:"tool_call",toolCall:N};return[...H,B]})}else k.sessionUpdate==="tool_call_update"?o(N=>{const H=_r(N,k.toolCallId);if(H<0){console.warn(`[ChatInterface] Tool call not found for update: ${k.toolCallId}`);const T={type:"tool_call",toolCall:{id:k.toolCallId,title:k.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...N,T]}return N.map((T,B)=>{if(B!==H||T.type!=="tool_call")return T;const z=k.status?js(k.status):T.toolCall.status,L=k.content?[...T.toolCall.content||[],...k.content]:T.toolCall.content;return{type:"tool_call",toolCall:{...T.toolCall,status:z,...k.title&&{title:k.title},content:L,...k.rawInput&&{rawInput:k.rawInput},...k.rawOutput&&{rawOutput:k.rawOutput}}}})}):k.sessionUpdate==="plan"&&o(N=>{if(k.entries.length===0)return N.filter(B=>B.type!=="plan");const H=N.reduce((B,z,L)=>z.type==="plan"?L:B,-1);if(H>=0)return N.map((B,z)=>z===H?{...B,entries:k.entries}:B);const T={type:"plan",id:`plan-${Date.now()}`,entries:k.entries};return[...N,T]})},[]);p.useEffect(()=>{e.setSessionCreatedHandler(k=>{console.log("[ChatInterface] Session created:",k),b(k)}),e.setSessionLoadedHandler(k=>{console.log("[ChatInterface] Session loaded/resumed:",k),b(k,{resetEntries:!1})}),e.setSessionSwitchingHandler(k=>{console.log("[ChatInterface] Switching to session:",k),f(k),j()}),e.setSessionUpdateHandler((k,N)=>{O(k,N)}),e.setPromptCompleteHandler(k=>{console.log("[ChatInterface] Prompt complete:",k),s(!1)}),e.setPermissionRequestHandler(I),e.setErrorMessageHandler(k=>{console.error("[ChatInterface] Agent error:",k),h(k),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const D=x?localStorage.getItem(x):null;return D&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",D),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:D}):await e.resumeSession({sessionId:D})}catch(N){console.warn("[ChatInterface] Failed to restore session, creating new one:",N),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[b,e,I,O,j]);const M=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),r&&e.cancel(),j(),f(null),e.createSession(void 0,v)},[e,r,j,v]),$=()=>{console.log("[ChatInterface] Cancel requested"),o(D=>D.map(k=>k.type!=="tool_call"||!(k.toolCall.status==="running"||k.toolCall.status==="waiting_for_confirmation")?k:(console.log("[ChatInterface] Marking tool call as canceled:",k.toolCall.id),{type:"tool_call",toolCall:{...k.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},P=p.useCallback((D,k,N)=>{console.log("[ChatInterface] Permission response:",{requestId:D,optionId:k,optionKind:N}),e.respondToPermission(D,k);const H=N==="reject_once"||N==="reject_always"||k===null;o(T=>T.map(B=>{var L;if(B.type!=="tool_call"||((L=B.toolCall.permissionRequest)==null?void 0:L.requestId)!==D)return B;let z;return H?z="rejected":B.toolCall.isStandalonePermission?z="complete":z="running",{type:"tool_call",toolCall:{...B.toolCall,status:z,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),U=n.filter(D=>D.type==="tool_call"&&D.toolCall.status==="waiting_for_confirmation"&&!!D.toolCall.permissionRequest).map(D=>({requestId:D.toolCall.permissionRequest.requestId,toolName:D.toolCall.title,toolInput:D.toolCall.rawInput||{},description:D.toolCall.title,options:D.toolCall.permissionRequest.options})),E=p.useCallback((D,k)=>{const N=U.find(B=>B.requestId===D);let H=null,T=null;if(N!=null&&N.options&&N.options.length>0)if(k){const B=N.options.find(z=>z.kind==="allow_once")??N.options.find(z=>z.kind==="allow_always");B&&(H=B.optionId,T=B.kind)}else{const B=N.options.find(z=>z.kind==="reject_once")??N.options.find(z=>z.kind==="reject_always");B&&(H=B.optionId,T=B.kind)}H||(T=k?"allow_once":"reject_once"),P(D,H,T)},[P,U]),S=p.useCallback(async D=>{var G;const k=D.text.trim(),N=D.images||[],H=D.attachments||[];if(!k&&N.length===0&&H.length===0||r||!a)return;if(k.startsWith("/")&&N.length===0){yt("[ChatInterface] slash command input",{text:k});const V=await cv(k,{sessionId:m,availableCommands:R,availableModels:A,currentModel:F,supportsImages:w,entries:l.current,setModel:y,onNewSession:M}).catch(()=>null);if(V){if(yt("[ChatInterface] local command handled",V),"clearEntries"in V&&V.clearEntries){o([]);return}if("newSession"in V&&V.newSession){M();return}if("userEntry"in V){o(X=>[...X,V.userEntry,V.cmdEntry]);return}}yt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:k})}yt("[ChatInterface] forwarding to agent",{text:k,hasImages:N.length>0,sessionReady:a,isLoading:r});const T=[];k&&T.push({type:"text",text:k});const B=[];for(const V of N)try{const X=`data:${V.mimeType};base64,${V.data}`;let K;X.startsWith("data:")?K=dv(X):K=await(await fetch(X)).blob();let ne=K,ae=V.mimeType;if(K.size>2*1024*1024){const W=new File([K],"image.jpg",{type:K.type});ne=await ve(W,uv),ae="image/jpeg"}const ce=await new Promise((W,q)=>{const J=new FileReader;J.onloadend=()=>{const te=J.result,ie=te.indexOf(",");W(ie>=0?te.slice(ie+1):te)},J.onerror=()=>{var te;return q(new Error("FileReader error: "+((te=J.error)==null?void 0:te.message)))},J.readAsDataURL(ne)}),me={type:"image",mimeType:ae,data:ce};T.push(me),B.push({mimeType:ae,data:ce})}catch(X){console.error("[ChatInterface] Failed to process image:",X)}const z=[];for(const V of H)try{if(V.textContent){let X;if(V.kind==="directory"){const K=((G=V.files)==null?void 0:G.length)??0;X=`📁 目录: ${V.name} (${K} 个文件)
250
- ${V.textContent}`}else{const K=V.size!=null?` (${pv(V.size)})`:"";X=`📎 ${V.name}${K}
251
- \`\`\`
252
- ${V.textContent}
253
- \`\`\``}T.push({type:"text",text:X}),z.push(V)}}catch(X){console.error("[ChatInterface] Failed to process attachment:",X)}if(T.length===0)return;const L={type:"user_message",id:`user-${Date.now()}`,content:k,images:B.length>0?B:void 0,attachments:z.length>0?z:void 0};o(V=>[...V,L]),s(!0);try{await e.sendPrompt(T)}catch(V){console.error("[ChatInterface] Failed to send prompt:",V),s(!1)}},[r,a,e,R,A,F,w,m,y,M]);return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx(Ig,{entries:n,isLoading:r&&!a?!1:r,onPermissionRespond:(D,k,N)=>{P(D,k,N)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),d.jsx(Vg,{requests:U,onRespond:E}),u&&d.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:d.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[d.jsx("span",{children:u}),d.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),d.jsxs("div",{className:"flex-shrink-0",children:[d.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(fv,{mode:v,onModeChange:D=>{C(D),localStorage.setItem("acp_permission_mode",D)}}),d.jsx(ev,{client:e})]}),n.length>0&&d.jsxs(Uh,{children:[d.jsx(zh,{asChild:!0,children:d.jsxs(At,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:M,children:[d.jsx(ea,{className:"h-3 w-3"}),"新会话"]})}),d.jsx(Bh,{children:"New Thread"})]})]}),d.jsx(Bg,{onSubmit:S,isLoading:r,onInterrupt:$,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:w,commands:R.length>0?R:void 0})]})]})}function pv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function hv({client:e,agentId:t}){const[n,o]=p.useState(!1),r=p.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return d.jsxs("div",{className:"flex h-full w-full",children:[d.jsxs("div",{className:Z("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&d.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),d.jsxs("div",{className:Z("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&d.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:d.jsx(ea,{className:"h-4 w-4"})}),d.jsx("button",{type:"button",onClick:()=>o(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?d.jsx(ju,{className:"h-4 w-4"}):d.jsx(Au,{className:"h-4 w-4"})})]})]}),!n&&d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(gv,{client:e,onSelectSession:r})})]}),d.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:d.jsx(mv,{client:e,agentId:t})})]})}function gv({client:e,onSelectSession:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[c,l]=p.useState(""),[u,h]=p.useState(!0),g=p.useRef(null),v=p.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const j=await e.listSessions();o(j.sessions)}catch(j){console.warn("[SidebarSessionList] Failed to load:",j)}finally{s(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const j=x=>{x==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(j),()=>e.removeConnectionStateHandler(j)},[e,v]),p.useEffect(()=>{const j=setInterval(v,1e4);return()=>clearInterval(j)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(j=>{v()}),e.setSessionRenamedHandler((j,x)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(j=>{/Method not found/i.test(j)&&/session\/(rename|delete)/i.test(j)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const C=p.useCallback(j=>{const x=j.title&&j.title.trim()?j.title:j.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(j.sessionId),o(b=>b.filter(I=>I.sessionId!==j.sessionId)),a===j.sessionId&&i(null)}catch(b){console.error("[SidebarSessionList] delete failed:",b)}},[e,a]),w=p.useCallback(j=>{f(j.sessionId),l(j.title&&j.title.trim()?j.title:"")},[]),_=p.useCallback(()=>{if(!m)return;const j=c.trim();if(!j){f(null);return}try{e.renameSession(m,j),o(x=>x.map(b=>b.sessionId===m?{...b,title:j}:b))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,c]),R=p.useCallback(()=>{f(null)},[]),A=p.useCallback(j=>{j.key==="Enter"?(j.preventDefault(),_()):j.key==="Escape"&&(j.preventDefault(),R())},[_,R]),F=p.useMemo(()=>[...n].sort((j,x)=>{const b=j.updatedAt?new Date(j.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-b}),[n]);if(r&&n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const y=xv(F);return d.jsx("nav",{className:"py-1","aria-label":"历史会话",children:y.map((j,x)=>d.jsxs("div",{children:[x>0&&d.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),d.jsx("div",{className:"px-4 py-2",children:d.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:j.label})}),j.sessions.map(b=>{const I=m===b.sessionId;return d.jsxs("div",{className:Z("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",b.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[d.jsx(yu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),I?d.jsx("input",{ref:g,type:"text",value:c,onChange:O=>l(O.target.value),onKeyDown:A,onBlur:_,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick:O=>O.stopPropagation()}):d.jsx("button",{type:"button",onClick:()=>{i(b.sessionId),t(b)},className:"flex-1 min-w-0 text-left",title:b.title||b.sessionId,children:d.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:b.title&&b.title.trim()?b.title:"新会话"})}),I?d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[d.jsx("button",{type:"button",onClick:_,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"确认",children:d.jsx(on,{className:"h-3.5 w-3.5"})}),d.jsx("button",{type:"button",onClick:R,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:"取消",children:d.jsx(Un,{className:"h-3.5 w-3.5"})})]}):d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:u?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[d.jsx("button",{type:"button",disabled:!u,onClick:O=>{O.stopPropagation(),u&&w(b)},className:Z("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-brand hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:u?"重命名":"该 agent 不支持会话重命名",children:d.jsx(Iu,{className:"h-3 w-3"})}),d.jsx("button",{type:"button",disabled:!u,onClick:O=>{O.stopPropagation(),u&&C(b)},className:Z("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:u?"删除":"该 agent 不支持会话删除",children:d.jsx(Xu,{className:"h-3 w-3"})})]})]},b.sessionId)})]},j.label))})}function xv(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(n.getTime()-864e5),r=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?r[0].sessions.push(s):a>=o?r[1].sessions.push(s):r[2].sessions.push(s)}return r.filter(s=>s.sessions.length>0)}function vv({url:e,token:t,onBack:n}){const[o,r]=p.useState(null),[s,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const c=new $r({proxyUrl:e,token:t});return c.setConnectionStateHandler((l,u)=>{a(l),m(u||null)}),f.current=c,r(c),c.connect().catch(l=>{l instanceof Ti||(m(l.message),a("error"))}),()=>{c.disconnect(),f.current=null,r(null),a("disconnected")}},[e,t]),d.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&d.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,d.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),d.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!o&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),d.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),d.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),o&&s==="connected"&&d.jsx(hv,{client:o})]})}const Vr="rcs_admin_key";function bv(){try{return localStorage.getItem(Vr)}catch{return null}}function wv(){const[e,t]=p.useState(bv),n=p.useCallback(o=>{const r=o.trim();t(r||null);try{r?localStorage.setItem(Vr,r):localStorage.removeItem(Vr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Rs=p.lazy(()=>ke(()=>import("./Dashboard-B1hQfqI9.js"),__vite__mapDeps([3,2,4,1,5])).then(e=>({default:e.Dashboard}))),yv=p.lazy(()=>ke(()=>import("./SessionDetail-B5C0o1YT.js"),__vite__mapDeps([6,2,4,1,5])).then(e=>({default:e.SessionDetail}))),Cv=p.lazy(()=>ke(()=>import("./ShareLanding-DBC9gbJo.js"),__vite__mapDeps([7,2,1,5])).then(e=>({default:e.ShareLanding}))),Sv=p.lazy(()=>ke(()=>import("./Login-BE8mNc0U.js"),__vite__mapDeps([8,2,1,5])).then(e=>({default:e.Login}))),Ev=p.lazy(()=>ke(()=>import("./Setup-CqZ5gEBQ.js"),__vite__mapDeps([9,2,1,5])).then(e=>({default:e.Setup}))),kv=p.lazy(()=>ke(()=>import("./Join-7hMl360t.js"),__vite__mapDeps([10,2,1,5])).then(e=>({default:e.Join}))),Av=p.lazy(()=>ke(()=>import("./UserSettings-CqzeJ5cc.js"),__vite__mapDeps([11,2,12,1,5])).then(e=>({default:e.UserSettings}))),_v=p.lazy(()=>ke(()=>import("./TeamList-BMS_Qq8U.js"),__vite__mapDeps([13,2,1,5])).then(e=>({default:e.TeamList}))),jv=p.lazy(()=>ke(()=>import("./TeamCreate-DSYdTaPe.js"),__vite__mapDeps([14,2,1,5])).then(e=>({default:e.TeamCreate}))),Rv=p.lazy(()=>ke(()=>import("./TeamDetail-CmJGsgOP.js"),__vite__mapDeps([15,2,12,1,5])).then(e=>({default:e.TeamDetail}))),Tv=p.lazy(()=>ke(()=>import("./TeamSettings-C0sYgCFT.js"),__vite__mapDeps([16,2,1,5])).then(e=>({default:e.TeamSettings}))),Nv=p.lazy(()=>ke(()=>import("./AdminPanel-CQU763nr.js"),__vite__mapDeps([17,2,1,5])).then(e=>({default:e.AdminPanel}))),Iv=new Set(["login","setup","join","share"]),Pv=new Set(["login","setup","join"]);function Mv(){return d.jsx(nd,{defaultTheme:"system",children:d.jsx(nh,{children:d.jsx(Ov,{})})})}function Ov(){const[e,t]=p.useState("dashboard"),[n,o]=p.useState(null),[r,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),{adminKey:c}=wv(),{user:l,isLoading:u,checkSetupStatus:h}=Ri();p.useEffect(()=>{Vp(c)},[c]);const[g,v]=p.useState(!1);p.useEffect(()=>{!u&&!l?h().then(v):l&&v(!1)},[u,l,h]);const C=p.useCallback(()=>{const y=window.location.pathname,j=new URLSearchParams(window.location.search);if(j.get("acp")==="1"){const P=sessionStorage.getItem("acp_connection");if(P)try{const U=JSON.parse(P);if(U.url&&U.token){f({url:U.url,token:U.token}),sessionStorage.removeItem("acp_connection");const E=new URL(window.location.href);E.searchParams.delete("acp"),window.history.replaceState(null,"",E),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const b=j.get("sid");if(b){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${b}`),o(b),i(null),t("session");return}if(y==="/login"){t("login");return}if(y==="/setup"){t("setup");return}if(y==="/join"){t("join");return}if(y==="/settings"){t("settings");return}if(y==="/admin"){t("admin");return}if(y==="/teams/new"){t("team-create");return}if(y.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(y.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(y==="/teams"){t("teams");return}const M=y.match(/^\/code\/s\/([^/]+)/);if(M&&M[1]){i(M[1]),o(null),s(void 0),t("share");return}const $=y.match(/^\/code\/([^/]+)/);$&&$[1]?(o($[1]),s(void 0),i(null),t("session")):(o(null),s(void 0),i(null),t("dashboard"))},[]);p.useEffect(()=>(C(),window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)),[C]);const w=p.useCallback(y=>{window.history.pushState(null,"",`/code/${y}`),o(y),s(void 0),i(null),t("session")},[]),_=p.useCallback(()=>{window.history.pushState(null,"","/code/"),o(null),s(void 0),i(null),f(null),t("dashboard")},[]),R=(()=>{let y=e;return u||(g&&y!=="setup"&&y!=="join"&&(y="setup"),!l&&!Iv.has(y)&&(y="login"),l&&(y==="login"||y==="setup")&&(y="dashboard")),y})();if(p.useEffect(()=>{u||(R==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):R==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):R==="dashboard"&&l&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[R,l,u]),u)return d.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const A=()=>{if(m&&R==="acp")return d.jsx(vv,{url:m.url,token:m.token,onBack:_});switch(R){case"login":return d.jsx(Sv,{onSuccess:_});case"setup":return d.jsx(Ev,{onSuccess:_,onAlreadyDone:_});case"join":return d.jsx(kv,{onSuccess:_,onInvalidInvite:_});case"settings":return d.jsx(Av,{onBack:_});case"teams":return d.jsx(_v,{});case"team-create":return d.jsx(jv,{});case"team-detail":return d.jsx(Rv,{});case"team-settings":return d.jsx(Tv,{});case"admin":return(l==null?void 0:l.role)!=="admin"?d.jsx("div",{className:"flex flex-1 items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),d.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:Ke("nav.dashboard")})]})}):d.jsx(Nv,{});case"share":return d.jsx(Cv,{});case"session":return n?d.jsx(yv,{sessionId:n,onSessionLoaded:y=>s(y.source)},n):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Rs,{onNavigateSession:w})});default:return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Rs,{onNavigateSession:w})})}},F=!Pv.has(R);return d.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[F&&d.jsx(oh,{sessionTitle:n||(m?"ACP":void 0),sessionSource:m?"acp":r,onBack:n||m||a?_:void 0}),d.jsx(p.Suspense,{fallback:d.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:A()})]})}Zl.createRoot(document.getElementById("root")).render(d.jsx(p.StrictMode,{children:d.jsx(Mv,{})}));export{Jp as $,$r as A,Z as B,Bg as C,Ti as D,le as E,yt as F,Gc as G,Uv as H,Hv as I,Vv as J,qp as K,Zs as L,zv as M,Gv as N,Tx as O,ea as P,Ke as Q,jx as R,$u as S,lb as T,Ju as U,Bv as V,cv as W,Un as X,Wc as Y,Ri as Z,Ai as _,hv as a,hr as b,Ig as c,on as d,cb as e,Nx as f,Rx as g,Vu as h,ab as i,$h as j,Xu as k,we as l,tb as m,ob as n,eb as o,Kv as p,Xv as q,qv as r,Yv as s,Jv as t,rb as u,nb as v,sb as w,Zv as x,Qv as y,Os as z};