@saluzi/saluzi-edu 0.2.66 → 0.2.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/cli.js +533 -348
  2. package/dist/guide/guide-data.json +8 -0
  3. package/dist/rcs-schema.sql +23 -0
  4. package/dist/rcs-web/assets/{AdminPanel-CqP_94xa.js → AdminPanel-94uchXH7.js} +1 -1
  5. package/dist/rcs-web/assets/ArtifactView-CT0Fu4U5.js +6 -0
  6. package/dist/rcs-web/assets/ArtifactsGallery-DgK1CSno.js +339 -0
  7. package/{packages/remote-control-server/web/dist/assets/Claim-BvfARQ6Q.js → dist/rcs-web/assets/Claim-C7V1Q01Y.js} +1 -1
  8. package/dist/rcs-web/assets/{Dashboard-BDGi4XpN.js → Dashboard-NLM7Kgm8.js} +2 -2
  9. package/{packages/remote-control-server/web/dist/assets/Join-PPDYBhsJ.js → dist/rcs-web/assets/Join-BhjsvbAP.js} +1 -1
  10. package/dist/rcs-web/assets/{Login-JprQIEpr.js → Login-DRFE4F-F.js} +1 -1
  11. package/dist/rcs-web/assets/{Register-cuGuAE83.js → Register-FgLOFB4h.js} +1 -1
  12. package/dist/rcs-web/assets/SessionDetail-3P77L-sJ.js +60 -0
  13. package/dist/rcs-web/assets/SessionVisibilityBadge-raEV1sW8.js +11 -0
  14. package/dist/rcs-web/assets/{Setup-Buwa9Y3M.js → Setup-DDJHMu0z.js} +1 -1
  15. package/dist/rcs-web/assets/ShareLanding-DG5JbaWg.js +1 -0
  16. package/dist/rcs-web/assets/{TeamCreate-CaoinTSG.js → TeamCreate-D_AnatYF.js} +1 -1
  17. package/dist/rcs-web/assets/{TeamDetail-D5ahen24.js → TeamDetail-C1FFiAj2.js} +2 -2
  18. package/dist/rcs-web/assets/{TeamList-qCuKKSH3.js → TeamList-tfsnwvZG.js} +1 -1
  19. package/dist/rcs-web/assets/{TeamSettings-BaIwImrp.js → TeamSettings-FeTuY9_I.js} +1 -1
  20. package/dist/rcs-web/assets/{UserSearchInput-BxcYR_HU.js → UserSearchInput-Bu3RXDYh.js} +1 -1
  21. package/dist/rcs-web/assets/{UserSettings-zfGfcuWs.js → UserSettings-BrjmELAZ.js} +1 -1
  22. package/dist/rcs-web/assets/{arc-DwAbF6eM.js → arc-Di9w8tGK.js} +1 -1
  23. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-uMOwOwiN.js → architectureDiagram-3BPJPVTR-FT-IsfVA.js} +1 -1
  24. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-B5BqFTkP.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-DryBvbP3.js} +1 -1
  25. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-D6eienz2.js → c4Diagram-AAUBKEIU-HWAmxH56.js} +1 -1
  26. package/dist/rcs-web/assets/channel-N4W03sy5.js +1 -0
  27. package/dist/rcs-web/assets/{chunk-2J33WTMH-DqVxv8yW.js → chunk-2J33WTMH-AdjHpC7B.js} +1 -1
  28. package/dist/rcs-web/assets/{chunk-4BX2VUAB-X5o4x8om.js → chunk-4BX2VUAB-CpZ-59LR.js} +1 -1
  29. package/dist/rcs-web/assets/{chunk-55IACEB6-D7G25_Y5.js → chunk-55IACEB6-BBSmURaz.js} +1 -1
  30. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CoXI1FIy.js → dist/rcs-web/assets/chunk-727SXJPM-1k6tgn8s.js} +1 -1
  31. package/dist/rcs-web/assets/{chunk-AQP2D5EJ-C73Crhqe.js → chunk-AQP2D5EJ-im0ij4Kj.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-FMBD7UC4-DVzxIsSE.js → chunk-FMBD7UC4-Cs3z8_hw.js} +1 -1
  33. package/dist/rcs-web/assets/{chunk-ND2GUHAM-C6_oEhLf.js → chunk-ND2GUHAM-BA9iE2wc.js} +1 -1
  34. package/dist/rcs-web/assets/{chunk-QZHKN3VN-COvH7k5r.js → chunk-QZHKN3VN-DbvzoKsw.js} +1 -1
  35. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-CcBgewcu.js +1 -0
  36. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-CcBgewcu.js +1 -0
  37. package/dist/rcs-web/assets/{code-block-IT6T5CEO-CE-2f_-K.js → code-block-IT6T5CEO-wgmiR0vF.js} +1 -1
  38. package/dist/rcs-web/assets/{copy-9pzb1Po6.js → copy-BD6qrRfd.js} +1 -1
  39. package/dist/rcs-web/assets/{cose-bilkent-S5V4N54A-B9sMDFRe.js → cose-bilkent-S5V4N54A-DT4C5Yz2.js} +1 -1
  40. package/dist/rcs-web/assets/{dagre-BM42HDAG-DB1jXylM.js → dagre-BM42HDAG-CRf1H6Hv.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-2AECGRRQ-MNuqSRmg.js → diagram-2AECGRRQ-BChRpS-u.js} +1 -1
  42. package/dist/rcs-web/assets/{diagram-5GNKFQAL-BZwhvaEY.js → diagram-5GNKFQAL-BicbIYus.js} +1 -1
  43. package/dist/rcs-web/assets/{diagram-KO2AKTUF-3Wp2PnI2.js → diagram-KO2AKTUF-DCfQNjGq.js} +1 -1
  44. package/dist/rcs-web/assets/{diagram-LMA3HP47-CTcV1SBj.js → diagram-LMA3HP47-mMyd4aUd.js} +1 -1
  45. package/dist/rcs-web/assets/{diagram-OG6HWLK6-DzXhSQDC.js → diagram-OG6HWLK6-DUWhyWTm.js} +1 -1
  46. package/dist/rcs-web/assets/dialog-DympH6_o.js +1 -0
  47. package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-CwSihkB8.js → erDiagram-TEJ5UH35-DnBH3GMK.js} +1 -1
  48. package/dist/rcs-web/assets/external-link-J-x6ty1h.js +6 -0
  49. package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-BSuXctT4.js → flowDiagram-I6XJVG4X-Ba7lo6ds.js} +1 -1
  50. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-B87oxjmY.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CKkj67eu.js} +1 -1
  51. package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-BRrwOi3C.js → gitGraphDiagram-PVQCEYII-205YdSRe.js} +1 -1
  52. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-B-8QXS0n.js → infoDiagram-5YYISTIA-CpPvGigJ.js} +1 -1
  53. package/dist/rcs-web/assets/{ishikawaDiagram-YF4QCWOH-Bau9MU6C.js → ishikawaDiagram-YF4QCWOH-D0ZEWQy7.js} +1 -1
  54. package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-D_tAp--R.js → journeyDiagram-JHISSGLW-DVl0M9a7.js} +1 -1
  55. package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU---UIvjMZ.js → kanban-definition-UN3LZRKU-Dkr8uJC-.js} +1 -1
  56. package/dist/rcs-web/assets/{linear-CIDLjd5h.js → linear-CIdvseqY.js} +1 -1
  57. package/dist/rcs-web/assets/main-B8hkVvfg.js +265 -0
  58. package/dist/rcs-web/assets/main-C2O-g177.css +1 -0
  59. package/dist/rcs-web/assets/{mermaid-VLURNSYL-Cu5A5sMk.js → mermaid-VLURNSYL-DdTSeoZS.js} +4 -4
  60. package/dist/rcs-web/assets/{mermaid.core-CEJOtCGw.js → mermaid.core-CtvzCSq2.js} +5 -5
  61. package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-ldyccyCP.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-CMlDCaV_.js} +1 -1
  62. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-CmghofeF.js → pieDiagram-4H26LBE5-C6xMizTL.js} +1 -1
  63. package/{packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-B-2N2UHr.js → dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-D6epraE1.js} +1 -1
  64. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-39jlO9Y8.js → requirementDiagram-4Y6WPE33-BHmML6bk.js} +1 -1
  65. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-DdY7KNFB.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CIKij54Y.js} +1 -1
  66. package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-D2k5rX6x.js → sequenceDiagram-3UESZ5HK-CY0y5zdR.js} +1 -1
  67. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-CP9N457o.js → stateDiagram-AJRCARHV-FBhNz1Lc.js} +1 -1
  68. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CPhZYlL0.js → stateDiagram-v2-BHNVJYJU-m7ruBTu5.js} +1 -1
  69. package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-DSEPBO8O.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-CJopHs1x.js} +1 -1
  70. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-CkNMwCJ3.js → vennDiagram-CIIHVFJN-DF_uHOP7.js} +1 -1
  71. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-Cxd-F60s.js → wardleyDiagram-YWT4CUSO-DQmjIZJA.js} +1 -1
  72. package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-BLL105NN.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-v8zL-j4G.js} +1 -1
  73. package/dist/rcs-web/index.html +2 -2
  74. package/package.json +1 -1
  75. package/packages/remote-control-server/src/__tests__/artifacts.test.ts +370 -0
  76. package/packages/remote-control-server/src/__tests__/helpers/mock-config.ts +1 -0
  77. package/packages/remote-control-server/src/config.ts +6 -0
  78. package/packages/remote-control-server/src/db/rcs-schema.sql +23 -0
  79. package/packages/remote-control-server/src/index.ts +9 -0
  80. package/packages/remote-control-server/src/registerRoutes.ts +8 -0
  81. package/packages/remote-control-server/src/routes/v1/artifacts.ts +179 -0
  82. package/packages/remote-control-server/src/routes/web/artifacts.ts +249 -0
  83. package/packages/remote-control-server/src/services/artifacts.ts +378 -0
  84. package/packages/remote-control-server/web/dist/assets/{AdminPanel-CqP_94xa.js → AdminPanel-94uchXH7.js} +1 -1
  85. package/packages/remote-control-server/web/dist/assets/ArtifactView-CT0Fu4U5.js +6 -0
  86. package/packages/remote-control-server/web/dist/assets/ArtifactsGallery-DgK1CSno.js +339 -0
  87. package/{dist/rcs-web/assets/Claim-BvfARQ6Q.js → packages/remote-control-server/web/dist/assets/Claim-C7V1Q01Y.js} +1 -1
  88. package/packages/remote-control-server/web/dist/assets/{Dashboard-BDGi4XpN.js → Dashboard-NLM7Kgm8.js} +2 -2
  89. package/{dist/rcs-web/assets/Join-PPDYBhsJ.js → packages/remote-control-server/web/dist/assets/Join-BhjsvbAP.js} +1 -1
  90. package/packages/remote-control-server/web/dist/assets/{Login-JprQIEpr.js → Login-DRFE4F-F.js} +1 -1
  91. package/packages/remote-control-server/web/dist/assets/{Register-cuGuAE83.js → Register-FgLOFB4h.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/SessionDetail-3P77L-sJ.js +60 -0
  93. package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-raEV1sW8.js +11 -0
  94. package/packages/remote-control-server/web/dist/assets/{Setup-Buwa9Y3M.js → Setup-DDJHMu0z.js} +1 -1
  95. package/packages/remote-control-server/web/dist/assets/ShareLanding-DG5JbaWg.js +1 -0
  96. package/packages/remote-control-server/web/dist/assets/{TeamCreate-CaoinTSG.js → TeamCreate-D_AnatYF.js} +1 -1
  97. package/packages/remote-control-server/web/dist/assets/{TeamDetail-D5ahen24.js → TeamDetail-C1FFiAj2.js} +2 -2
  98. package/packages/remote-control-server/web/dist/assets/{TeamList-qCuKKSH3.js → TeamList-tfsnwvZG.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{TeamSettings-BaIwImrp.js → TeamSettings-FeTuY9_I.js} +1 -1
  100. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-BxcYR_HU.js → UserSearchInput-Bu3RXDYh.js} +1 -1
  101. package/packages/remote-control-server/web/dist/assets/{UserSettings-zfGfcuWs.js → UserSettings-BrjmELAZ.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/{arc-DwAbF6eM.js → arc-Di9w8tGK.js} +1 -1
  103. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-uMOwOwiN.js → architectureDiagram-3BPJPVTR-FT-IsfVA.js} +1 -1
  104. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-B5BqFTkP.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DryBvbP3.js} +1 -1
  105. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-D6eienz2.js → c4Diagram-AAUBKEIU-HWAmxH56.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/channel-N4W03sy5.js +1 -0
  107. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-DqVxv8yW.js → chunk-2J33WTMH-AdjHpC7B.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-X5o4x8om.js → chunk-4BX2VUAB-CpZ-59LR.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-D7G25_Y5.js → chunk-55IACEB6-BBSmURaz.js} +1 -1
  110. package/{dist/rcs-web/assets/chunk-727SXJPM-CoXI1FIy.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-1k6tgn8s.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-C73Crhqe.js → chunk-AQP2D5EJ-im0ij4Kj.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-DVzxIsSE.js → chunk-FMBD7UC4-Cs3z8_hw.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-C6_oEhLf.js → chunk-ND2GUHAM-BA9iE2wc.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-COvH7k5r.js → chunk-QZHKN3VN-DbvzoKsw.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-CcBgewcu.js +1 -0
  116. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-CcBgewcu.js +1 -0
  117. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-CE-2f_-K.js → code-block-IT6T5CEO-wgmiR0vF.js} +1 -1
  118. package/packages/remote-control-server/web/dist/assets/{copy-9pzb1Po6.js → copy-BD6qrRfd.js} +1 -1
  119. package/packages/remote-control-server/web/dist/assets/{cose-bilkent-S5V4N54A-B9sMDFRe.js → cose-bilkent-S5V4N54A-DT4C5Yz2.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-DB1jXylM.js → dagre-BM42HDAG-CRf1H6Hv.js} +1 -1
  121. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-MNuqSRmg.js → diagram-2AECGRRQ-BChRpS-u.js} +1 -1
  122. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-BZwhvaEY.js → diagram-5GNKFQAL-BicbIYus.js} +1 -1
  123. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-3Wp2PnI2.js → diagram-KO2AKTUF-DCfQNjGq.js} +1 -1
  124. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-CTcV1SBj.js → diagram-LMA3HP47-mMyd4aUd.js} +1 -1
  125. package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-DzXhSQDC.js → diagram-OG6HWLK6-DUWhyWTm.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/dialog-DympH6_o.js +1 -0
  127. package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-CwSihkB8.js → erDiagram-TEJ5UH35-DnBH3GMK.js} +1 -1
  128. package/packages/remote-control-server/web/dist/assets/external-link-J-x6ty1h.js +6 -0
  129. package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-BSuXctT4.js → flowDiagram-I6XJVG4X-Ba7lo6ds.js} +1 -1
  130. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-B87oxjmY.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CKkj67eu.js} +1 -1
  131. package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-BRrwOi3C.js → gitGraphDiagram-PVQCEYII-205YdSRe.js} +1 -1
  132. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-B-8QXS0n.js → infoDiagram-5YYISTIA-CpPvGigJ.js} +1 -1
  133. package/packages/remote-control-server/web/dist/assets/{ishikawaDiagram-YF4QCWOH-Bau9MU6C.js → ishikawaDiagram-YF4QCWOH-D0ZEWQy7.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-D_tAp--R.js → journeyDiagram-JHISSGLW-DVl0M9a7.js} +1 -1
  135. package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU---UIvjMZ.js → kanban-definition-UN3LZRKU-Dkr8uJC-.js} +1 -1
  136. package/packages/remote-control-server/web/dist/assets/{linear-CIDLjd5h.js → linear-CIdvseqY.js} +1 -1
  137. package/packages/remote-control-server/web/dist/assets/main-B8hkVvfg.js +265 -0
  138. package/packages/remote-control-server/web/dist/assets/main-C2O-g177.css +1 -0
  139. package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-Cu5A5sMk.js → mermaid-VLURNSYL-DdTSeoZS.js} +4 -4
  140. package/packages/remote-control-server/web/dist/assets/{mermaid.core-CEJOtCGw.js → mermaid.core-CtvzCSq2.js} +5 -5
  141. package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-ldyccyCP.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-CMlDCaV_.js} +1 -1
  142. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-CmghofeF.js → pieDiagram-4H26LBE5-C6xMizTL.js} +1 -1
  143. package/{dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-B-2N2UHr.js → packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-D6epraE1.js} +1 -1
  144. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-39jlO9Y8.js → requirementDiagram-4Y6WPE33-BHmML6bk.js} +1 -1
  145. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-DdY7KNFB.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CIKij54Y.js} +1 -1
  146. package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-D2k5rX6x.js → sequenceDiagram-3UESZ5HK-CY0y5zdR.js} +1 -1
  147. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-CP9N457o.js → stateDiagram-AJRCARHV-FBhNz1Lc.js} +1 -1
  148. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CPhZYlL0.js → stateDiagram-v2-BHNVJYJU-m7ruBTu5.js} +1 -1
  149. package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-DSEPBO8O.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-CJopHs1x.js} +1 -1
  150. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-CkNMwCJ3.js → vennDiagram-CIIHVFJN-DF_uHOP7.js} +1 -1
  151. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-Cxd-F60s.js → wardleyDiagram-YWT4CUSO-DQmjIZJA.js} +1 -1
  152. package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-BLL105NN.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-v8zL-j4G.js} +1 -1
  153. package/packages/remote-control-server/web/dist/index.html +2 -2
  154. package/dist/rcs-web/assets/SessionDetail-D-xhkyLo.js +0 -65
  155. package/dist/rcs-web/assets/SessionVisibilityBadge-91WyR9K6.js +0 -11
  156. package/dist/rcs-web/assets/ShareLanding-DhwgJb6V.js +0 -1
  157. package/dist/rcs-web/assets/channel-CCfqpGSl.js +0 -1
  158. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DzNdVs3v.js +0 -1
  159. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DzNdVs3v.js +0 -1
  160. package/dist/rcs-web/assets/main-DhbquBXW.css +0 -1
  161. package/dist/rcs-web/assets/main-N3GYCdLF.js +0 -260
  162. package/packages/remote-control-server/web/dist/assets/SessionDetail-D-xhkyLo.js +0 -65
  163. package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-91WyR9K6.js +0 -11
  164. package/packages/remote-control-server/web/dist/assets/ShareLanding-DhwgJb6V.js +0 -1
  165. package/packages/remote-control-server/web/dist/assets/channel-CCfqpGSl.js +0 -1
  166. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DzNdVs3v.js +0 -1
  167. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DzNdVs3v.js +0 -1
  168. package/packages/remote-control-server/web/dist/assets/main-DhbquBXW.css +0 -1
  169. package/packages/remote-control-server/web/dist/assets/main-N3GYCdLF.js +0 -260
@@ -0,0 +1,265 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-DdTSeoZS.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-NLM7Kgm8.js","assets/workerType-Bd-zteMi.js","assets/SessionVisibilityBadge-raEV1sW8.js","assets/dialog-DympH6_o.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-3P77L-sJ.js","assets/external-link-J-x6ty1h.js","assets/UserSearchInput-Bu3RXDYh.js","assets/ArtifactsGallery-DgK1CSno.js","assets/copy-BD6qrRfd.js","assets/ShareLanding-DG5JbaWg.js","assets/ArtifactView-CT0Fu4U5.js","assets/Claim-C7V1Q01Y.js","assets/Login-DRFE4F-F.js","assets/Register-FgLOFB4h.js","assets/Setup-DDJHMu0z.js","assets/Join-BhjsvbAP.js","assets/UserSettings-BrjmELAZ.js","assets/TeamList-tfsnwvZG.js","assets/TeamCreate-D_AnatYF.js","assets/TeamDetail-C1FFiAj2.js","assets/TeamSettings-FeTuY9_I.js","assets/AdminPanel-94uchXH7.js"])))=>i.map(i=>d[i]);
2
+ var uc=Object.defineProperty;var dc=(e,t,n)=>t in e?uc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>dc(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as it,j as u,R as Zr,r as Vs,b as fc,c as Jr,d as mc}from"./vendor-DE_-CLIE.js";import{_ as Ae}from"./shiki-mEP5vQQu.js";import{m as pc}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 Gs(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=Gs(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Ks(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Gs(e))&&(o&&(o+=" "),o+=t);return o}const hc=(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},gc=(e,t)=>({classGroupId:e,validator:t}),qs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Mn="-",Bo=[],xc="arbitrary..",vc=e=>{const t=yc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return bc(a);const i=a.split(Mn),m=i[0]===""&&i.length>1?1:0;return Ys(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=o[a],f=n[a];return m?f?hc(f,m):m:f||Bo}return n[a]||Bo}}},Ys=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],s=n.nextPart.get(r);if(s){const f=Ys(e,t+1,s);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(Mn):e.slice(t).join(Mn),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},bc=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?xc+o:void 0})(),yc=e=>{const{theme:t,classGroups:n}=e;return wc(n,t)},wc=(e,t)=>{const n=qs();for(const o in e){const r=e[o];eo(r,n,o,t)}return n},eo=(e,t,n,o)=>{const r=e.length;for(let s=0;s<r;s++){const a=e[s];Cc(a,t,n,o)}},Cc=(e,t,n,o)=>{if(typeof e=="string"){Sc(e,t,n);return}if(typeof e=="function"){kc(e,t,n,o);return}Ec(e,t,n,o)},Sc=(e,t,n)=>{const o=e===""?t:Xs(t,e);o.classGroupId=n},kc=(e,t,n,o)=>{if(_c(e)){eo(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(gc(n,e))},Ec=(e,t,n,o)=>{const r=Object.entries(e),s=r.length;for(let a=0;a<s;a++){const[i,m]=r[a];eo(m,Xs(t,i),n,o)}},Xs=(e,t)=>{let n=e;const o=t.split(Mn),r=o.length;for(let s=0;s<r;s++){const a=o[s];let i=n.nextPart.get(a);i||(i=qs(),n.nextPart.set(a,i)),n=i}return n},_c=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Ac=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)}}},Pr="!",Ho=":",jc=[],Wo=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),Tc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const s=[];let a=0,i=0,m=0,f;const l=r.length;for(let v=0;v<l;v++){const C=r[v];if(a===0&&i===0){if(C===Ho){s.push(r.slice(m,v)),m=v+1;continue}if(C==="/"){f=v;continue}}C==="["?a++:C==="]"?a--:C==="("?i++:C===")"&&i--}const c=s.length===0?r:r.slice(m);let d=c,h=!1;c.endsWith(Pr)?(d=c.slice(0,-1),h=!0):c.startsWith(Pr)&&(d=c.slice(1),h=!0);const g=f&&f>m?f-m:void 0;return Wo(s,h,d,g)};if(t){const r=t+Ho,s=o;o=a=>a.startsWith(r)?s(a.slice(r.length)):Wo(jc,!1,a,void 0,!0)}if(n){const r=o;o=s=>n({className:s,parseClassName:r})}return o},Rc=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}},Nc=e=>({cache:Ac(e.cacheSize),parseClassName:Tc(e),sortModifiers:Rc(e),postfixLookupClassGroupIds:Ic(e),...vc(e)}),Ic=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},Mc=/\s+/,Pc=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(Mc);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:d,modifiers:h,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:C}=n(c);if(d){f=c+(f.length>0?" "+f:f);continue}let b=!!C,_;if(b){const j=v.substring(0,C);_=o(j);const x=_&&a[_]?o(v):void 0;x&&x!==_&&(_=x,b=!1)}else _=o(v);if(!_){if(!b){f=c+(f.length>0?" "+f:f);continue}if(_=o(v),!_){f=c+(f.length>0?" "+f:f);continue}b=!1}const A=h.length===0?"":h.length===1?h[0]:s(h).join(":"),E=g?A+Pr:A,L=E+_;if(i.indexOf(L)>-1)continue;i.push(L);const k=r(_,b);for(let j=0;j<k.length;++j){const x=k[j];i.push(E+x)}f=c+(f.length>0?" "+f:f)}return f},Oc=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=Qs(n))&&(r&&(r+=" "),r+=o);return r},Qs=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Qs(e[o]))&&(n&&(n+=" "),n+=t);return n},Dc=(e,...t)=>{let n,o,r,s;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=Nc(f),o=n.cache.get,r=n.cache.set,s=i,i(m)},i=m=>{const f=o(m);if(f)return f;const l=Pc(m,n);return r(m,l),l};return s=a,(...m)=>s(Oc(...m))},Lc=[],Ee=e=>{const t=n=>n[e]||Lc;return t.isThemeGetter=!0,t},Zs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Js=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$c=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uc=/\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$/,zc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Bc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Hc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,at=e=>Fc.test(e),se=e=>!!e&&!Number.isNaN(Number(e)),He=e=>!!e&&Number.isInteger(Number(e)),fr=e=>e.endsWith("%")&&se(e.slice(0,-1)),Qe=e=>$c.test(e),ea=()=>!0,Wc=e=>Uc.test(e)&&!zc.test(e),to=()=>!1,Vc=e=>Bc.test(e),Gc=e=>Hc.test(e),Kc=e=>!X(e)&&!Q(e),qc=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)),Yc=e=>pt(e,ra,to),X=e=>Zs.test(e),yt=e=>pt(e,oa,Wc),Vo=e=>pt(e,ru,se),Xc=e=>pt(e,aa,ea),Qc=e=>pt(e,sa,to),Go=e=>pt(e,ta,to),Zc=e=>pt(e,na,Gc),wn=e=>pt(e,ia,Vc),Q=e=>Js.test(e),en=e=>Tt(e,oa),Jc=e=>Tt(e,sa),Ko=e=>Tt(e,ta),eu=e=>Tt(e,ra),tu=e=>Tt(e,na),Cn=e=>Tt(e,ia,!0),nu=e=>Tt(e,aa,!0),pt=(e,t,n)=>{const o=Zs.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Tt=(e,t,n=!1)=>{const o=Js.exec(e);return o?o[1]?t(o[1]):n:!1},ta=e=>e==="position"||e==="percentage",na=e=>e==="image"||e==="url",ra=e=>e==="length"||e==="size"||e==="bg-size",oa=e=>e==="length",ru=e=>e==="number",sa=e=>e==="family-name",aa=e=>e==="number"||e==="weight",ia=e=>e==="shadow",ou=()=>{const e=Ee("color"),t=Ee("font"),n=Ee("text"),o=Ee("font-weight"),r=Ee("tracking"),s=Ee("leading"),a=Ee("breakpoint"),i=Ee("container"),m=Ee("spacing"),f=Ee("radius"),l=Ee("shadow"),c=Ee("inset-shadow"),d=Ee("text-shadow"),h=Ee("drop-shadow"),g=Ee("blur"),v=Ee("perspective"),C=Ee("aspect"),b=Ee("ease"),_=Ee("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...E(),Q,X],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],x=()=>[Q,X,m],y=()=>[at,"full","auto",...x()],T=()=>[He,"none","subgrid",Q,X],M=()=>["auto",{span:["full",He,Q,X]},He,Q,X],O=()=>[He,"auto",Q,X],F=()=>["auto","min","max","fr",Q,X],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],S=()=>["auto",...x()],w=()=>[at,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],B=()=>[at,"screen","full","dvw","lvw","svw","min","max","fit",...x()],P=()=>[at,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],U=()=>[e,Q,X],q=()=>[...E(),Ko,Go,{position:[Q,X]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",eu,Yc,{size:[Q,X]}],$=()=>[fr,en,yt],R=()=>["","none","full",f,Q,X],H=()=>["",se,en,yt],V=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[se,fr,Ko,Go],ne=()=>["","none",g,Q,X],Z=()=>["none",se,Q,X],re=()=>["none",se,Q,X],ue=()=>[se,Q,X],be=()=>[at,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qe],breakpoint:[Qe],color:[ea],container:[Qe],"drop-shadow":[Qe],ease:["in","out","in-out"],font:[Kc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qe],shadow:[Qe],spacing:["px",se],text:[Qe],"text-shadow":[Qe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",at,X,Q,C]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[qc],columns:[{columns:[se,X,Q,i]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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:L()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:y()}],"inset-x":[{"inset-x":y()}],"inset-y":[{"inset-y":y()}],start:[{"inset-s":y(),start:y()}],end:[{"inset-e":y(),end:y()}],"inset-bs":[{"inset-bs":y()}],"inset-be":[{"inset-be":y()}],top:[{top:y()}],right:[{right:y()}],bottom:[{bottom:y()}],left:[{left:y()}],visibility:["visible","invisible","collapse"],z:[{z:[He,"auto",Q,X]}],basis:[{basis:[at,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[se,at,"auto","initial","none",X]}],grow:[{grow:["",se,Q,X]}],shrink:[{shrink:["",se,Q,X]}],order:[{order:[He,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],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:S()}],mx:[{mx:S()}],my:[{my:S()}],ms:[{ms:S()}],me:[{me:S()}],mbs:[{mbs:S()}],mbe:[{mbe:S()}],mt:[{mt:S()}],mr:[{mr:S()}],mb:[{mb:S()}],ml:[{ml:S()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:w()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...P()]}],"min-block-size":[{"min-block":["auto",...P()]}],"max-block-size":[{"max-block":["none",...P()]}],w:[{w:[i,"screen",...w()]}],"min-w":[{"min-w":[i,"screen","none",...w()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...w()]}],h:[{h:["screen","lh",...w()]}],"min-h":[{"min-h":["screen","lh","none",...w()]}],"max-h":[{"max-h":["screen","lh",...w()]}],"font-size":[{text:["base",n,en,yt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,nu,Xc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fr,X]}],"font-family":[{font:[Jc,Qc,t]}],"font-features":[{"font-features":[X]}],"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,X]}],"line-clamp":[{"line-clamp":[se,"none",Q,Vo]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",Q,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[se,"from-font","auto",Q,yt]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[se,"auto",Q,X]}],"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:[He,Q,X]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,X]}],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,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:N()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},He,Q,X],radial:["",Q,X],conic:[He,Q,X]},tu,Zc]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[se,Q,X]}],"outline-w":[{outline:["",se,en,yt]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",l,Cn,wn]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",c,Cn,wn]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[se,yt]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",d,Cn,wn]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[se,Q,X]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"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":[se]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Q,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":E()}],"mask-image-conic-pos":[{"mask-conic":[se]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:ne()}],brightness:[{brightness:[se,Q,X]}],contrast:[{contrast:[se,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",h,Cn,wn]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",se,Q,X]}],"hue-rotate":[{"hue-rotate":[se,Q,X]}],invert:[{invert:["",se,Q,X]}],saturate:[{saturate:[se,Q,X]}],sepia:[{sepia:["",se,Q,X]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,X]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[se,Q,X]}],"backdrop-contrast":[{"backdrop-contrast":[se,Q,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",se,Q,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[se,Q,X]}],"backdrop-invert":[{"backdrop-invert":["",se,Q,X]}],"backdrop-opacity":[{"backdrop-opacity":[se,Q,X]}],"backdrop-saturate":[{"backdrop-saturate":[se,Q,X]}],"backdrop-sepia":[{"backdrop-sepia":["",se,Q,X]}],"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,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[se,"initial",Q,X]}],ease:[{ease:["linear","initial",b,Q,X]}],delay:[{delay:[se,Q,X]}],animate:[{animate:["none",_,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,X]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[Q,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],zoom:[{zoom:[He,Q,X]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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,X]}],"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":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"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,X]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[se,en,yt,Vo]}],stroke:[{stroke:["none",...U()]}],"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"]}},su=Dc(ou);function ee(...e){return su(Ks(e))}function au(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function kb(e){return e?new Date(e*1e3).toLocaleString():""}function Eb(e){return e==="archived"||e==="inactive"}function _b(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function iu(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 Ab(){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),iu(t)}function jb(e){if(!e||typeof e!="object")return!1;if(e.status==="conversation_cleared")return!0;const t=e.raw;return!!t&&typeof t=="object"&&t.status==="conversation_cleared"}/**
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 lu=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cu=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),qo=e=>{const t=cu(e);return t.charAt(0).toUpperCase()+t.slice(1)},la=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),uu=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 du={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 fu=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,...du,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:la("lucide",r),...!s&&!uu(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,l])=>p.createElement(f,l)),...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 ae=(e,t)=>{const n=p.forwardRef(({className:o,...r},s)=>p.createElement(fu,{ref:s,iconNode:t,className:la(`lucide-${lu(qo(e))}`,`lucide-${e}`,o),...r}));return n.displayName=qo(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 mu=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],pu=ae("arrow-down",mu);/**
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 hu=[["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"}]],gu=ae("brain",hu);/**
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 xu=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],un=ae("check",xu);/**
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 vu=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Kt=ae("chevron-down",vu);/**
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 bu=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],yu=ae("chevron-left",bu);/**
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 wu=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ca=ae("chevron-up",wu);/**
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 Cu=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Su=ae("circle-check",Cu);/**
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 ku=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Eu=ae("circle",ku);/**
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 _u=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Au=ae("clock",_u);/**
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 ju=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Tu=ae("file-code-corner",ju);/**
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 Ru=[["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"}]],Bt=ae("file-text",Ru);/**
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 Nu=[["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"}]],no=ae("folder-open",Nu);/**
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 Iu=[["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"}]],Mu=ae("image",Iu);/**
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 Pu=[["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"}]],Ou=ae("layout-grid",Pu);/**
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 Du=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ua=ae("loader-circle",Du);/**
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 Lu=[["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"}]],Fu=ae("log-out",Lu);/**
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 $u=[["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"}]],Uu=ae("message-square",$u);/**
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 zu=[["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"}]],Bu=ae("monitor",zu);/**
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 Hu=[["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"}]],da=ae("moon",Hu);/**
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 Wu=[["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"}]],Vu=ae("panel-left-close",Wu);/**
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 Gu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Ku=ae("panel-left",Gu);/**
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 qu=[["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"}]],Yu=ae("paperclip",qu);/**
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 Xu=[["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"}]],Qu=ae("pencil",Xu);/**
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 Zu=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],fa=ae("plus",Zu);/**
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 Ju=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ed=ae("search",Ju);/**
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 td=[["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"}]],nd=ae("send",td);/**
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 rd=[["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"}]],od=ae("settings",rd);/**
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 sd=[["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"}]],ma=ae("shield-alert",sd);/**
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 ad=[["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"}]],id=ae("shield",ad);/**
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 ld=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],cd=ae("slash",ld);/**
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 ud=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],dd=ae("square",ud);/**
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 fd=[["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"}]],pa=ae("sun",fd);/**
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 md=[["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"}]],ro=ae("table",md);/**
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 pd=[["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"}]],hd=ae("trash-2",pd);/**
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 gd=[["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"}]],ha=ae("user",gd);/**
198
+ * @license lucide-react v0.555.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */const xd=[["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"}]],vd=ae("users",xd);/**
203
+ * @license lucide-react v0.555.0 - ISC
204
+ *
205
+ * This source code is licensed under the ISC license.
206
+ * See the LICENSE file in the root directory of this source tree.
207
+ */const bd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dn=ae("x",bd),ga=p.createContext(void 0),xa="theme";function Yo(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Xo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(xa);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Qo(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function yd(){const e=p.useContext(ga);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function wd({children:e,defaultTheme:t="system"}){const[n,o]=p.useState(()=>Xo()||t),[r,s]=p.useState(()=>{const m=Xo()||t;return m==="system"?Yo():m}),a=p.useCallback(m=>{o(m);try{localStorage.setItem(xa,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Yo():n;s(m),Qo(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";s(c),Qo(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:r,setTheme:a};return it.createElement(ga.Provider,{value:i},e)}function Zo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qe(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Zo(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():Zo(e[r],null)}}}}function ke(...e){return p.useCallback(qe(...e),e)}var Cd=Symbol.for("react.lazy"),Pn=Zr[" use ".trim().toString()];function Sd(e){return typeof e=="object"&&e!==null&&"then"in e}function va(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Cd&&"_payload"in e&&Sd(e._payload)}function ba(e){const t=Ed(e),n=p.forwardRef((o,r)=>{let{children:s,...a}=o;va(s)&&typeof Pn=="function"&&(s=Pn(s._payload));const i=p.Children.toArray(s),m=i.find(Ad);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var kd=ba("Slot");function Ed(e){const t=p.forwardRef((n,o)=>{let{children:r,...s}=n;if(va(r)&&typeof Pn=="function"&&(r=Pn(r._payload)),p.isValidElement(r)){const a=Td(r),i=jd(s,r.props);return r.type!==p.Fragment&&(i.ref=o?qe(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 _d=Symbol("radix.slottable");function Ad(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_d}function jd(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 Td(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 Jo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,es=Ks,Rd=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return es(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 l=n==null?void 0:n[f],c=s==null?void 0:s[f];if(l===null)return null;const d=Jo(l)||Jo(c);return r[f][d]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,d]=l;return d===void 0||(f[c]=d),f},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,l)=>{let{class:c,className:d,...h}=l;return Object.entries(h).every(g=>{let[v,C]=g;return Array.isArray(C)?C.includes({...s,...i}[v]):{...s,...i}[v]===C})?[...f,c,d]:f},[]);return es(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},Nd=Rd("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 Rt({className:e,variant:t,size:n,asChild:o=!1,...r}){const s=o?kd:"button";return u.jsx(s,{"data-slot":"button",className:ee(Nd({variant:t,size:n,className:e})),...r})}function te(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 Id(e,t){const n=p.createContext(t),o=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return u.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 nt(e,t=[]){let n=[];function o(s,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var b;const{scope:d,children:h,...g}=c,v=((b=d==null?void 0:d[e])==null?void 0:b[m])||i,C=p.useMemo(()=>g,Object.values(g));return u.jsx(v.Provider,{value:C,children:h})};f.displayName=s+"Provider";function l(c,d){var v;const h=((v=d==null?void 0:d[e])==null?void 0:v[m])||i,g=p.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${s}\``)}return[f,l]}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,Md(r,...t)]}function Md(...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 c=m(s)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ze=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Pd=Zr[" useInsertionEffect ".trim().toString()]||Ze;function ut({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Od({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:r;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${o} is changing from ${c?"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.`),l.current=i},[i,o])}const f=p.useCallback(l=>{var c;if(i){const d=Dd(l)?l(e):l;d!==e&&((c=a.current)==null||c.call(a,d))}else s(l)},[i,e,s,a]);return[m,f]}function Od({defaultProp:e,onChange:t}){const[n,o]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return Pd(()=>{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 Dd(e){return typeof e=="function"}function Ht(e){const t=Ld(e),n=p.forwardRef((o,r)=>{const{children:s,...a}=o,i=p.Children.toArray(s),m=i.find($d);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Ld(e){const t=p.forwardRef((n,o)=>{const{children:r,...s}=n;if(p.isValidElement(r)){const a=zd(r),i=Ud(s,r.props);return r.type!==p.Fragment&&(i.ref=o?qe(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 ya=Symbol("radix.slottable");function Fd(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ya,t}function $d(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ya}function Ud(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 zd(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 Bd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],he=Bd.reduce((e,t)=>{const n=Ht(`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),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function wa(e,t){e&&Vs.flushSync(()=>e.dispatchEvent(t))}function Ca(e){const t=e+"CollectionProvider",[n,o]=nt(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:C,children:b}=v,_=it.useRef(null),A=it.useRef(new Map).current;return u.jsx(r,{scope:C,itemMap:A,collectionRef:_,children:b})};a.displayName=t;const i=e+"CollectionSlot",m=Ht(i),f=it.forwardRef((v,C)=>{const{scope:b,children:_}=v,A=s(i,b),E=ke(C,A.collectionRef);return u.jsx(m,{ref:E,children:_})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",d=Ht(l),h=it.forwardRef((v,C)=>{const{scope:b,children:_,...A}=v,E=it.useRef(null),L=ke(C,E),k=s(l,b);return it.useEffect(()=>(k.itemMap.set(E,{ref:E,...A}),()=>void k.itemMap.delete(E))),u.jsx(d,{[c]:"",ref:L,children:_})});h.displayName=l;function g(v){const C=s(e+"CollectionConsumer",v);return it.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const A=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(C.itemMap.values()).sort((k,j)=>A.indexOf(k.ref.current)-A.indexOf(j.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,o]}var Hd=p.createContext(void 0);function Sa(e){const t=p.useContext(Hd);return e||t||"ltr"}function Je(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 Wd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(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 Vd="DismissableLayer",Or="dismissableLayer.update",Gd="dismissableLayer.pointerDownOutside",Kd="dismissableLayer.focusOutside",ts,ka=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(ka),[l,c]=p.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=ke(t,j=>c(j)),v=Array.from(f.layers),[C]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(C),_=l?v.indexOf(l):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,E=_>=b,L=Xd(j=>{const x=j.target,y=[...f.branches].some(T=>T.contains(x));!E||y||(r==null||r(j),a==null||a(j),j.defaultPrevented||i==null||i())},d),k=Qd(j=>{const x=j.target;[...f.branches].some(T=>T.contains(x))||(s==null||s(j),a==null||a(j),j.defaultPrevented||i==null||i())},d);return Wd(j=>{_===f.layers.size-1&&(o==null||o(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},d),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(ts=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ns(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=ts)}},[l,d,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ns())},[l,f]),p.useEffect(()=>{const j=()=>h({});return document.addEventListener(Or,j),()=>document.removeEventListener(Or,j)},[]),u.jsx(he.div,{...m,ref:g,style:{pointerEvents:A?E?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,k.onFocusCapture),onBlurCapture:te(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,L.onPointerDownCapture)})});fn.displayName=Vd;var qd="DismissableLayerBranch",Yd=p.forwardRef((e,t)=>{const n=p.useContext(ka),o=p.useRef(null),r=ke(t,o);return p.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(he.div,{...e,ref:r})});Yd.displayName=qd;function Xd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let m=function(){Ea(Gd,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 Qd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1);return p.useEffect(()=>{const r=s=>{s.target&&!o.current&&Ea(Kd,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 ns(){const e=new CustomEvent(Or);document.dispatchEvent(e)}function Ea(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?wa(r,s):r.dispatchEvent(s)}var mr=0;function oo(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rs()),document.body.insertAdjacentElement("beforeend",e[1]??rs()),mr++,()=>{mr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),mr--}},[])}function rs(){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 pr="focusScope.autoFocusOnMount",hr="focusScope.autoFocusOnUnmount",os={bubbles:!1,cancelable:!0},Zd="FocusScope",qn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=Je(r),l=Je(s),c=p.useRef(null),d=ke(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(A){if(h.paused||!i)return;const E=A.target;i.contains(E)?c.current=E:lt(c.current,{select:!0})},C=function(A){if(h.paused||!i)return;const E=A.relatedTarget;E!==null&&(i.contains(E)||lt(c.current,{select:!0}))},b=function(A){if(document.activeElement===document.body)for(const L of A)L.removedNodes.length>0&&lt(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const _=new MutationObserver(b);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){as.add(h);const v=document.activeElement;if(!i.contains(v)){const b=new CustomEvent(pr,os);i.addEventListener(pr,f),i.dispatchEvent(b),b.defaultPrevented||(Jd(of(_a(i)),{select:!0}),document.activeElement===v&&lt(i))}return()=>{i.removeEventListener(pr,f),setTimeout(()=>{const b=new CustomEvent(hr,os);i.addEventListener(hr,l),i.dispatchEvent(b),b.defaultPrevented||lt(v??document.body,{select:!0}),i.removeEventListener(hr,l),as.remove(h)},0)}}},[i,f,l,h]);const g=p.useCallback(v=>{if(!n&&!o||h.paused)return;const C=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(C&&b){const _=v.currentTarget,[A,E]=ef(_);A&&E?!v.shiftKey&&b===E?(v.preventDefault(),n&&lt(A,{select:!0})):v.shiftKey&&b===A&&(v.preventDefault(),n&&lt(E,{select:!0})):b===_&&v.preventDefault()}},[n,o,h.paused]);return u.jsx(he.div,{tabIndex:-1,...a,ref:d,onKeyDown:g})});qn.displayName=Zd;function Jd(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(lt(o,{select:t}),document.activeElement!==n)return}function ef(e){const t=_a(e),n=ss(t,e),o=ss(t.reverse(),e);return[n,o]}function _a(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 ss(e,t){for(const n of e)if(!tf(n,{upTo:t}))return n}function tf(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 nf(e){return e instanceof HTMLInputElement&&"select"in e}function lt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&nf(e)&&t&&e.select()}}var as=rf();function rf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=is(e,t),e.unshift(t)},remove(t){var n;e=is(e,t),(n=e[0])==null||n.resume()}}}function is(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function of(e){return e.filter(t=>t.tagName!=="A")}var sf=Zr[" useId ".trim().toString()]||(()=>{}),af=0;function Re(e){const[t,n]=p.useState(sf());return Ze(()=>{n(o=>o??String(af++))},[e]),e||(t?`radix-${t}`:"")}const lf=["top","right","bottom","left"],dt=Math.min,Me=Math.max,On=Math.round,Sn=Math.floor,Ke=e=>({x:e,y:e}),cf={left:"right",right:"left",bottom:"top",top:"bottom"};function Dr(e,t,n){return Me(e,dt(t,n))}function et(e,t){return typeof e=="function"?e(t):e}function tt(e){return e.split("-")[0]}function qt(e){return e.split("-")[1]}function so(e){return e==="x"?"y":"x"}function ao(e){return e==="y"?"height":"width"}function Ge(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function io(e){return so(Ge(e))}function uf(e,t,n){n===void 0&&(n=!1);const o=qt(e),r=io(e),s=ao(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Dn(a)),[a,Dn(a)]}function df(e){const t=Dn(e);return[Lr(e),t,Lr(t)]}function Lr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ls=["left","right"],cs=["right","left"],ff=["top","bottom"],mf=["bottom","top"];function pf(e,t,n){switch(e){case"top":case"bottom":return n?t?cs:ls:t?ls:cs;case"left":case"right":return t?ff:mf;default:return[]}}function hf(e,t,n,o){const r=qt(e);let s=pf(tt(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Lr)))),s}function Dn(e){const t=tt(e);return cf[t]+e.slice(t.length)}function gf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Aa(e){return typeof e!="number"?gf(e):{top:e,right:e,bottom:e,left:e}}function Ln(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 us(e,t,n){let{reference:o,floating:r}=e;const s=Ge(t),a=io(t),i=ao(a),m=tt(t),f=s==="y",l=o.x+o.width/2-r.width/2,c=o.y+o.height/2-r.height/2,d=o[i]/2-r[i]/2;let h;switch(m){case"top":h={x:l,y:o.y-r.height};break;case"bottom":h={x:l,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:c};break;case"left":h={x:o.x-r.width,y:c};break;default:h={x:o.x,y:o.y}}switch(qt(t)){case"start":h[a]-=d*(n&&f?-1:1);break;case"end":h[a]+=d*(n&&f?-1:1);break}return h}async function xf(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:l="viewport",elementContext:c="floating",altBoundary:d=!1,padding:h=0}=et(t,e),g=Aa(h),C=i[d?c==="floating"?"reference":"floating":c],b=Ln(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:l,strategy:m})),_=c==="floating"?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),E=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},L=Ln(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:_,offsetParent:A,strategy:m}):_);return{top:(b.top-L.top+g.top)/E.y,bottom:(L.bottom-b.bottom+g.bottom)/E.y,left:(b.left-L.left+g.left)/E.x,right:(L.right-b.right+g.right)/E.x}}const vf=50,bf=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:xf},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:l,y:c}=us(f,o,m),d=o,h=0;const g={};for(let v=0;v<s.length;v++){const C=s[v];if(!C)continue;const{name:b,fn:_}=C,{x:A,y:E,data:L,reset:k}=await _({x:l,y:c,initialPlacement:o,placement:d,strategy:r,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=A??l,c=E??c,g[b]={...g[b],...L},k&&h<vf&&(h++,typeof k=="object"&&(k.placement&&(d=k.placement),k.rects&&(f=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:l,y:c}=us(f,d,m)),v=-1)}return{x:l,y:c,placement:d,strategy:r,middlewareData:g}},yf=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:l=0}=et(e,t)||{};if(f==null)return{};const c=Aa(l),d={x:n,y:o},h=io(r),g=ao(h),v=await a.getDimensions(f),C=h==="y",b=C?"top":"left",_=C?"bottom":"right",A=C?"clientHeight":"clientWidth",E=s.reference[g]+s.reference[h]-d[h]-s.floating[g],L=d[h]-s.reference[h],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let j=k?k[A]:0;(!j||!await(a.isElement==null?void 0:a.isElement(k)))&&(j=i.floating[A]||s.floating[g]);const x=E/2-L/2,y=j/2-v[g]/2-1,T=dt(c[b],y),M=dt(c[_],y),O=T,F=j-v[g]-M,I=j/2-v[g]/2+x,z=Dr(O,I,F),S=!m.arrow&&qt(r)!=null&&I!==z&&s.reference[g]/2-(I<O?T:M)-v[g]/2<0,w=S?I<O?I-O:I-F:0;return{[h]:d[h]+w,data:{[h]:z,centerOffset:I-z-w,...S&&{alignmentOffset:w}},reset:S}}}),wf=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:l=!0,crossAxis:c=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...C}=et(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tt(r),_=Ge(i),A=tt(i)===i,E=await(m.isRTL==null?void 0:m.isRTL(f.floating)),L=d||(A||!v?[Dn(i)]:df(i)),k=g!=="none";!d&&k&&L.push(...hf(i,v,g,E));const j=[i,...L],x=await m.detectOverflow(t,C),y=[];let T=((o=s.flip)==null?void 0:o.overflows)||[];if(l&&y.push(x[b]),c){const I=uf(r,a,E);y.push(x[I[0]],x[I[1]])}if(T=[...T,{placement:r,overflows:y}],!y.every(I=>I<=0)){var M,O;const I=(((M=s.flip)==null?void 0:M.index)||0)+1,z=j[I];if(z&&(!(c==="alignment"?_!==Ge(z):!1)||T.every(B=>Ge(B.placement)===_?B.overflows[0]>0:!0)))return{data:{index:I,overflows:T},reset:{placement:z}};let S=(O=T.filter(w=>w.overflows[0]<=0).sort((w,B)=>w.overflows[1]-B.overflows[1])[0])==null?void 0:O.placement;if(!S)switch(h){case"bestFit":{var F;const w=(F=T.filter(B=>{if(k){const P=Ge(B.placement);return P===_||P==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(P=>P>0).reduce((P,U)=>P+U,0)]).sort((B,P)=>B[1]-P[1])[0])==null?void 0:F[0];w&&(S=w);break}case"initialPlacement":S=i;break}if(r!==S)return{reset:{placement:S}}}return{}}}};function ds(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fs(e){return lf.some(t=>e[t]>=0)}const Cf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=et(e,t);switch(r){case"referenceHidden":{const a=await o.detectOverflow(t,{...s,elementContext:"reference"}),i=ds(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:fs(i)}}}case"escaped":{const a=await o.detectOverflow(t,{...s,altBoundary:!0}),i=ds(a,n.floating);return{data:{escapedOffsets:i,escaped:fs(i)}}}default:return{}}}}},ja=new Set(["left","top"]);async function Sf(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=tt(n),i=qt(n),m=Ge(n)==="y",f=ja.has(a)?-1:1,l=s&&m?-1:1,c=et(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:g}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return i&&typeof g=="number"&&(h=i==="end"?g*-1:g),m?{x:h*l,y:d*f}:{x:d*f,y:h*l}}const kf=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 Sf(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}}}}},Ef=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:b=>{let{x:_,y:A}=b;return{x:_,y:A}}},...f}=et(e,t),l={x:n,y:o},c=await s.detectOverflow(t,f),d=Ge(tt(r)),h=so(d);let g=l[h],v=l[d];if(a){const b=h==="y"?"top":"left",_=h==="y"?"bottom":"right",A=g+c[b],E=g-c[_];g=Dr(A,g,E)}if(i){const b=d==="y"?"top":"left",_=d==="y"?"bottom":"right",A=v+c[b],E=v-c[_];v=Dr(A,v,E)}const C=m.fn({...t,[h]:g,[d]:v});return{...C,data:{x:C.x-n,y:C.y-o,enabled:{[h]:a,[d]:i}}}}}},_f=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}=et(e,t),l={x:n,y:o},c=Ge(r),d=so(c);let h=l[d],g=l[c];const v=et(i,t),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const A=d==="y"?"height":"width",E=s.reference[d]-s.floating[A]+C.mainAxis,L=s.reference[d]+s.reference[A]-C.mainAxis;h<E?h=E:h>L&&(h=L)}if(f){var b,_;const A=d==="y"?"width":"height",E=ja.has(tt(r)),L=s.reference[c]-s.floating[A]+(E&&((b=a.offset)==null?void 0:b[c])||0)+(E?0:C.crossAxis),k=s.reference[c]+s.reference[A]+(E?0:((_=a.offset)==null?void 0:_[c])||0)-(E?C.crossAxis:0);g<L?g=L:g>k&&(g=k)}return{[d]:h,[c]:g}}}},Af=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}=et(e,t),l=await a.detectOverflow(t,f),c=tt(r),d=qt(r),h=Ge(r)==="y",{width:g,height:v}=s.floating;let C,b;c==="top"||c==="bottom"?(C=c,b=d===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,C=d==="end"?"top":"bottom");const _=v-l.top-l.bottom,A=g-l.left-l.right,E=dt(v-l[C],_),L=dt(g-l[b],A),k=!t.middlewareData.shift;let j=E,x=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=A),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(j=_),k&&!d){const T=Me(l.left,0),M=Me(l.right,0),O=Me(l.top,0),F=Me(l.bottom,0);h?x=g-2*(T!==0||M!==0?T+M:Me(l.left,l.right)):j=v-2*(O!==0||F!==0?O+F:Me(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:j});const y=await a.getDimensions(i.floating);return g!==y.width||v!==y.height?{reset:{rects:!0}}:{}}}};function Yn(){return typeof window<"u"}function Yt(e){return Ta(e)?(e.nodeName||"").toLowerCase():"#document"}function Pe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ye(e){var t;return(t=(Ta(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ta(e){return Yn()?e instanceof Node||e instanceof Pe(e).Node:!1}function $e(e){return Yn()?e instanceof Element||e instanceof Pe(e).Element:!1}function rt(e){return Yn()?e instanceof HTMLElement||e instanceof Pe(e).HTMLElement:!1}function ms(e){return!Yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pe(e).ShadowRoot}function mn(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Ue(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function jf(e){return/^(table|td|th)$/.test(Yt(e))}function Xn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Tf=/transform|translate|scale|rotate|perspective|filter/,Rf=/paint|layout|strict|content/,wt=e=>!!e&&e!=="none";let gr;function lo(e){const t=$e(e)?Ue(e):e;return wt(t.transform)||wt(t.translate)||wt(t.scale)||wt(t.rotate)||wt(t.perspective)||!co()&&(wt(t.backdropFilter)||wt(t.filter))||Tf.test(t.willChange||"")||Rf.test(t.contain||"")}function Nf(e){let t=ft(e);for(;rt(t)&&!Wt(t);){if(lo(t))return t;if(Xn(t))return null;t=ft(t)}return null}function co(){return gr==null&&(gr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gr}function Wt(e){return/^(html|body|#document)$/.test(Yt(e))}function Ue(e){return Pe(e).getComputedStyle(e)}function Qn(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(Yt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ms(e)&&e.host||Ye(e);return ms(t)?t.host:t}function Ra(e){const t=ft(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:rt(t)&&mn(t)?t:Ra(t)}function on(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Ra(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=Pe(r);if(s){const i=Fr(a);return t.concat(a,a.visualViewport||[],mn(r)?r:[],i&&n?on(i):[])}else return t.concat(r,on(r,[],n))}function Fr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Na(e){const t=Ue(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=rt(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,i=On(n)!==s||On(o)!==a;return i&&(n=s,o=a),{width:n,height:o,$:i}}function uo(e){return $e(e)?e:e.contextElement}function Ut(e){const t=uo(e);if(!rt(t))return Ke(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Na(t);let a=(s?On(n.width):n.width)/o,i=(s?On(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const If=Ke(0);function Ia(e){const t=Pe(e);return!co()||!t.visualViewport?If:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pe(e)?!1:t}function _t(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=uo(e);let a=Ke(1);t&&(o?$e(o)&&(a=Ut(o)):a=Ut(e));const i=Mf(s,n,o)?Ia(s):Ke(0);let m=(r.left+i.x)/a.x,f=(r.top+i.y)/a.y,l=r.width/a.x,c=r.height/a.y;if(s){const d=Pe(s),h=o&&$e(o)?Pe(o):o;let g=d,v=Fr(g);for(;v&&o&&h!==g;){const C=Ut(v),b=v.getBoundingClientRect(),_=Ue(v),A=b.left+(v.clientLeft+parseFloat(_.paddingLeft))*C.x,E=b.top+(v.clientTop+parseFloat(_.paddingTop))*C.y;m*=C.x,f*=C.y,l*=C.x,c*=C.y,m+=A,f+=E,g=Pe(v),v=Fr(g)}}return Ln({width:l,height:c,x:m,y:f})}function Zn(e,t){const n=Qn(e).scrollLeft;return t?t.left+n:_t(Ye(e)).left+n}function Ma(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Zn(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Pf(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=Ye(o),i=t?Xn(t.floating):!1;if(o===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Ke(1);const l=Ke(0),c=rt(o);if((c||!c&&!s)&&((Yt(o)!=="body"||mn(a))&&(m=Qn(o)),c)){const h=_t(o);f=Ut(o),l.x=h.x+o.clientLeft,l.y=h.y+o.clientTop}const d=a&&!c&&!s?Ma(a,m):Ke(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+d.x,y:n.y*f.y-m.scrollTop*f.y+l.y+d.y}}function Of(e){return Array.from(e.getClientRects())}function Df(e){const t=Ye(e),n=Qn(e),o=e.ownerDocument.body,r=Me(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=Me(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+Zn(e);const i=-n.scrollTop;return Ue(o).direction==="rtl"&&(a+=Me(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:i}}const ps=25;function Lf(e,t){const n=Pe(e),o=Ye(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,i=0,m=0;if(r){s=r.width,a=r.height;const l=co();(!l||l&&t==="fixed")&&(i=r.offsetLeft,m=r.offsetTop)}const f=Zn(o);if(f<=0){const l=o.ownerDocument,c=l.body,d=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(o.clientWidth-c.clientWidth-h);g<=ps&&(s-=g)}else f<=ps&&(s+=f);return{width:s,height:a,x:i,y:m}}function Ff(e,t){const n=_t(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=rt(e)?Ut(e):Ke(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 hs(e,t,n){let o;if(t==="viewport")o=Lf(e,n);else if(t==="document")o=Df(Ye(e));else if($e(t))o=Ff(t,n);else{const r=Ia(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ln(o)}function Pa(e,t){const n=ft(e);return n===t||!$e(n)||Wt(n)?!1:Ue(n).position==="fixed"||Pa(n,t)}function $f(e,t){const n=t.get(e);if(n)return n;let o=on(e,[],!1).filter(i=>$e(i)&&Yt(i)!=="body"),r=null;const s=Ue(e).position==="fixed";let a=s?ft(e):e;for(;$e(a)&&!Wt(a);){const i=Ue(a),m=lo(a);!m&&i.position==="fixed"&&(r=null),(s?!m&&!r:!m&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||mn(a)&&!m&&Pa(e,a))?o=o.filter(l=>l!==a):r=i,a=ft(a)}return t.set(e,o),o}function Uf(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?Xn(t)?[]:$f(t,this._c):[].concat(n),o],i=hs(t,a[0],r);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let d=1;d<a.length;d++){const h=hs(t,a[d],r);m=Me(h.top,m),f=dt(h.right,f),l=dt(h.bottom,l),c=Me(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function zf(e){const{width:t,height:n}=Na(e);return{width:t,height:n}}function Bf(e,t,n){const o=rt(t),r=Ye(t),s=n==="fixed",a=_t(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Ke(0);function f(){m.x=Zn(r)}if(o||!o&&!s)if((Yt(t)!=="body"||mn(r))&&(i=Qn(t)),o){const h=_t(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else r&&f();s&&!o&&r&&f();const l=r&&!o&&!s?Ma(r,i):Ke(0),c=a.left+i.scrollLeft-m.x-l.x,d=a.top+i.scrollTop-m.y-l.y;return{x:c,y:d,width:a.width,height:a.height}}function xr(e){return Ue(e).position==="static"}function gs(e,t){if(!rt(e)||Ue(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ye(e)===n&&(n=n.ownerDocument.body),n}function Oa(e,t){const n=Pe(e);if(Xn(e))return n;if(!rt(e)){let r=ft(e);for(;r&&!Wt(r);){if($e(r)&&!xr(r))return r;r=ft(r)}return n}let o=gs(e,t);for(;o&&jf(o)&&xr(o);)o=gs(o,t);return o&&Wt(o)&&xr(o)&&!lo(o)?n:o||Nf(e)||n}const Hf=async function(e){const t=this.getOffsetParent||Oa,n=this.getDimensions,o=await n(e.floating);return{reference:Bf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Wf(e){return Ue(e).direction==="rtl"}const Vf={convertOffsetParentRelativeRectToViewportRelativeRect:Pf,getDocumentElement:Ye,getClippingRect:Uf,getOffsetParent:Oa,getElementRects:Hf,getClientRects:Of,getDimensions:zf,getScale:Ut,isElement:$e,isRTL:Wf};function Da(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Gf(e,t){let n=null,o;const r=Ye(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:l,top:c,width:d,height:h}=f;if(i||t(),!d||!h)return;const g=Sn(c),v=Sn(r.clientWidth-(l+d)),C=Sn(r.clientHeight-(c+h)),b=Sn(l),A={rootMargin:-g+"px "+-v+"px "+-C+"px "+-b+"px",threshold:Me(0,dt(1,m))||1};let E=!0;function L(k){const j=k[0].intersectionRatio;if(j!==m){if(!E)return a();j?a(!1,j):o=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!Da(f,e.getBoundingClientRect())&&a(),E=!1}try{n=new IntersectionObserver(L,{...A,root:r.ownerDocument})}catch{n=new IntersectionObserver(L,A)}n.observe(e)}return a(!0),s}function Kf(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=uo(e),l=r||s?[...f?on(f):[],...t?on(t):[]]:[];l.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const c=f&&i?Gf(f,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(b=>{let[_]=b;_&&_.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?_t(e):null;m&&C();function C(){const b=_t(e);v&&!Da(v,b)&&n(),v=b,g=requestAnimationFrame(C)}return n(),()=>{var b;l.forEach(_=>{r&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),c==null||c(),(b=h)==null||b.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const qf=kf,Yf=Ef,Xf=wf,Qf=Af,Zf=Cf,xs=yf,Jf=_f,em=(e,t,n)=>{const o=new Map,r={platform:Vf,...n},s={...r.platform,_c:o};return bf(e,t,{...r,platform:s})};var tm=typeof document<"u",nm=function(){},jn=tm?p.useLayoutEffect:nm;function Fn(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(!Fn(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)&&!Fn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function La(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vs(e,t){const n=La(e);return Math.round(t*n)/n}function vr(e){const t=p.useRef(e);return jn(()=>{t.current=e}),t}function rm(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,[l,c]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=p.useState(o);Fn(d,o)||h(o);const[g,v]=p.useState(null),[C,b]=p.useState(null),_=p.useCallback(B=>{B!==k.current&&(k.current=B,v(B))},[]),A=p.useCallback(B=>{B!==j.current&&(j.current=B,b(B))},[]),E=s||g,L=a||C,k=p.useRef(null),j=p.useRef(null),x=p.useRef(l),y=m!=null,T=vr(m),M=vr(r),O=vr(f),F=p.useCallback(()=>{if(!k.current||!j.current)return;const B={placement:t,strategy:n,middleware:d};M.current&&(B.platform=M.current),em(k.current,j.current,B).then(P=>{const U={...P,isPositioned:O.current!==!1};I.current&&!Fn(x.current,U)&&(x.current=U,Vs.flushSync(()=>{c(U)}))})},[d,t,n,M,O]);jn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(B=>({...B,isPositioned:!1})))},[f]);const I=p.useRef(!1);jn(()=>(I.current=!0,()=>{I.current=!1}),[]),jn(()=>{if(E&&(k.current=E),L&&(j.current=L),E&&L){if(T.current)return T.current(E,L,F);F()}},[E,L,F,T,y]);const z=p.useMemo(()=>({reference:k,floating:j,setReference:_,setFloating:A}),[_,A]),S=p.useMemo(()=>({reference:E,floating:L}),[E,L]),w=p.useMemo(()=>{const B={position:n,left:0,top:0};if(!S.floating)return B;const P=vs(S.floating,l.x),U=vs(S.floating,l.y);return i?{...B,transform:"translate("+P+"px, "+U+"px)",...La(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:U}},[n,i,S.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:S,floatingStyles:w}),[l,F,z,S,w])}const om=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?xs({element:o.current,padding:r}).fn(n):{}:o?xs({element:o,padding:r}).fn(n):{}}}},sm=(e,t)=>{const n=qf(e);return{name:n.name,fn:n.fn,options:[e,t]}},am=(e,t)=>{const n=Yf(e);return{name:n.name,fn:n.fn,options:[e,t]}},im=(e,t)=>({fn:Jf(e).fn,options:[e,t]}),lm=(e,t)=>{const n=Xf(e);return{name:n.name,fn:n.fn,options:[e,t]}},cm=(e,t)=>{const n=Qf(e);return{name:n.name,fn:n.fn,options:[e,t]}},um=(e,t)=>{const n=Zf(e);return{name:n.name,fn:n.fn,options:[e,t]}},dm=(e,t)=>{const n=om(e);return{name:n.name,fn:n.fn,options:[e,t]}};var fm="Arrow",Fa=p.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return u.jsx(he.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Fa.displayName=fm;var mm=Fa;function pm(e){const[t,n]=p.useState(void 0);return Ze(()=>{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 fo="Popper",[$a,Xt]=nt(fo),[hm,Ua]=$a(fo),za=e=>{const{__scopePopper:t,children:n}=e,[o,r]=p.useState(null);return u.jsx(hm,{scope:t,anchor:o,onAnchorChange:r,children:n})};za.displayName=fo;var Ba="PopperAnchor",Ha=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=Ua(Ba,n),a=p.useRef(null),i=ke(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:u.jsx(he.div,{...r,ref:i})});Ha.displayName=Ba;var mo="PopperContent",[gm,xm]=$a(mo),Wa=p.forwardRef((e,t)=>{var V,K,G,ne,Z,re;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,C=Ua(mo,n),[b,_]=p.useState(null),A=ke(t,ue=>_(ue)),[E,L]=p.useState(null),k=pm(E),j=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,y=o+(s!=="center"?"-"+s:""),T=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},M=Array.isArray(f)?f:[f],O=M.length>0,F={padding:T,boundary:M.filter(bm),altBoundary:O},{refs:I,floatingStyles:z,placement:S,isPositioned:w,middlewareData:B}=rm({strategy:"fixed",placement:y,whileElementsMounted:(...ue)=>Kf(...ue,{animationFrame:h==="always"}),elements:{reference:C.anchor},middleware:[sm({mainAxis:r+x,alignmentAxis:a}),m&&am({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?im():void 0,...F}),m&&lm({...F}),cm({...F,apply:({elements:ue,rects:be,availableWidth:de,availableHeight:ye})=>{const{width:fe,height:ie}=be.reference,ge=ue.floating.style;ge.setProperty("--radix-popper-available-width",`${de}px`),ge.setProperty("--radix-popper-available-height",`${ye}px`),ge.setProperty("--radix-popper-anchor-width",`${fe}px`),ge.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),E&&dm({element:E,padding:i}),ym({arrowWidth:j,arrowHeight:x}),d&&um({strategy:"referenceHidden",...F})]}),[P,U]=Ka(S),q=Je(g);Ze(()=>{w&&(q==null||q())},[w,q]);const N=(V=B.arrow)==null?void 0:V.x,D=(K=B.arrow)==null?void 0:K.y,$=((G=B.arrow)==null?void 0:G.centerOffset)!==0,[R,H]=p.useState();return Ze(()=>{b&&H(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:w?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(ne=B.transformOrigin)==null?void 0:ne.x,(Z=B.transformOrigin)==null?void 0:Z.y].join(" "),...((re=B.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(gm,{scope:n,placedSide:P,onArrowChange:L,arrowX:N,arrowY:D,shouldHideArrow:$,children:u.jsx(he.div,{"data-side":P,"data-align":U,...v,ref:A,style:{...v.style,animation:w?void 0:"none"}})})})});Wa.displayName=mo;var Va="PopperArrow",vm={top:"bottom",right:"left",bottom:"top",left:"right"},Ga=p.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=xm(Va,o),a=vm[s.placedSide];return u.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:u.jsx(mm,{...r,ref:n,style:{...r.style,display:"block"}})})});Ga.displayName=Va;function bm(e){return e!==null}var ym=e=>({name:"transformOrigin",options:e,fn(t){var C,b,_;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,l]=Ka(n),c={start:"0%",center:"50%",end:"100%"}[l],d=(((b=r.arrow)==null?void 0:b.x)??0)+i/2,h=(((_=r.arrow)==null?void 0:_.y)??0)+m/2;let g="",v="";return f==="bottom"?(g=a?c:`${d}px`,v=`${-m}px`):f==="top"?(g=a?c:`${d}px`,v=`${o.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(g=`${o.floating.width+m}px`,v=a?c:`${h}px`),{data:{x:g,y:v}}}});function Ka(e){const[t,n="center"]=e.split("-");return[t,n]}var po=za,Jn=Ha,ho=Wa,go=Ga,wm="Portal",pn=p.forwardRef((e,t)=>{var i;const{container:n,...o}=e,[r,s]=p.useState(!1);Ze(()=>s(!0),[]);const a=n||r&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?fc.createPortal(u.jsx(he.div,{...o,ref:t}),a):null});pn.displayName=wm;function Cm(e,t){return p.useReducer((n,o)=>t[n][o]??n,e)}var Oe=e=>{const{present:t,children:n}=e,o=Sm(t),r=typeof n=="function"?n({present:o.isPresent}):p.Children.only(n),s=ke(o.ref,km(r));return typeof n=="function"||o.isPresent?p.cloneElement(r,{ref:s}):null};Oe.displayName="Presence";function Sm(e){const[t,n]=p.useState(),o=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Cm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=kn(o.current);s.current=i==="mounted"?f:"none"},[i]),Ze(()=>{const f=o.current,l=r.current;if(l!==e){const d=s.current,h=kn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&d!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,m]),Ze(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=kn(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=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},d=h=>{h.target===t&&(s.current=kn(o.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function kn(e){return(e==null?void 0:e.animationName)||"none"}function km(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 br="rovingFocusGroup.onEntryFocus",Em={bubbles:!1,cancelable:!0},hn="RovingFocusGroup",[$r,qa,_m]=Ca(hn),[Am,Ya]=nt(hn,[_m]),[jm,Tm]=Am(hn),Xa=p.forwardRef((e,t)=>u.jsx($r.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx($r.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Rm,{...e,ref:t})})}));Xa.displayName=hn;var Rm=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,d=p.useRef(null),h=ke(t,d),g=Sa(s),[v,C]=ut({prop:a,defaultProp:i??null,onChange:m,caller:hn}),[b,_]=p.useState(!1),A=Je(f),E=qa(n),L=p.useRef(!1),[k,j]=p.useState(0);return p.useEffect(()=>{const x=d.current;if(x)return x.addEventListener(br,A),()=>x.removeEventListener(br,A)},[A]),u.jsx(jm,{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:u.jsx(he.div,{tabIndex:b||k===0?-1:0,"data-orientation":o,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{L.current=!0}),onFocus:te(e.onFocus,x=>{const y=!L.current;if(x.target===x.currentTarget&&y&&!b){const T=new CustomEvent(br,Em);if(x.currentTarget.dispatchEvent(T),!T.defaultPrevented){const M=E().filter(S=>S.focusable),O=M.find(S=>S.active),F=M.find(S=>S.id===v),z=[O,F,...M].filter(Boolean).map(S=>S.ref.current);Ja(z,l)}}L.current=!1}),onBlur:te(e.onBlur,()=>_(!1))})})}),Qa="RovingFocusGroupItem",Za=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...i}=e,m=Re(),f=s||m,l=Tm(Qa,n),c=l.currentTabStopId===f,d=qa(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=l;return p.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),u.jsx($r.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:u.jsx(he.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,C=>{o?l.onItemFocus(f):C.preventDefault()}),onFocus:te(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:te(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){l.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const b=Mm(C,l.orientation,l.dir);if(b!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let A=d().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")A.reverse();else if(b==="prev"||b==="next"){b==="prev"&&A.reverse();const E=A.indexOf(C.currentTarget);A=l.loop?Pm(A,E+1):A.slice(E+1)}setTimeout(()=>Ja(A))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});Za.displayName=Qa;var Nm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Im(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Mm(e,t,n){const o=Im(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Nm[o]}function Ja(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Pm(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Om=Xa,Dm=Za,Lm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ot=new WeakMap,En=new WeakMap,_n={},yr=0,ei=function(e){return e&&(e.host||ei(e.parentNode))},Fm=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=ei(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})},$m=function(e,t,n,o){var r=Fm(t,Array.isArray(e)?e:[e]);_n[n]||(_n[n]=new WeakMap);var s=_n[n],a=[],i=new Set,m=new Set(r),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};r.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(d){if(i.has(d))l(d);else try{var h=d.getAttribute(o),g=h!==null&&h!=="false",v=(Ot.get(d)||0)+1,C=(s.get(d)||0)+1;Ot.set(d,v),s.set(d,C),a.push(d),v===1&&g&&En.set(d,!0),C===1&&d.setAttribute(n,"true"),g||d.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",d,b)}})};return l(t),i.clear(),yr++,function(){a.forEach(function(c){var d=Ot.get(c)-1,h=s.get(c)-1;Ot.set(c,d),s.set(c,h),d||(En.has(c)||c.removeAttribute(o),En.delete(c)),h||c.removeAttribute(n)}),yr--,yr||(Ot=new WeakMap,Ot=new WeakMap,En=new WeakMap,_n={})}},xo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Lm(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),$m(o,r,n,"aria-hidden")):function(){return null}},Ur=["Enter"," "],Um=["ArrowDown","PageUp","Home"],ti=["ArrowUp","PageDown","End"],zm=[...Um,...ti],Bm={ltr:[...Ur,"ArrowRight"],rtl:[...Ur,"ArrowLeft"]},Hm={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gn="Menu",[sn,Wm,Vm]=Ca(gn),[Nt,ni]=nt(gn,[Vm,Xt,Ya]),er=Xt(),ri=Ya(),[Gm,It]=Nt(gn),[Km,xn]=Nt(gn),oi=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,i=er(t),[m,f]=p.useState(null),l=p.useRef(!1),c=Je(s),d=Sa(r);return p.useEffect(()=>{const h=()=>{l.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>l.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})}},[]),u.jsx(po,{...i,children:u.jsx(Gm,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:u.jsx(Km,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:d,modal:a,children:o})})})};oi.displayName=gn;var qm="MenuAnchor",vo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(Jn,{...r,...o,ref:t})});vo.displayName=qm;var bo="MenuPortal",[Ym,si]=Nt(bo,{forceMount:void 0}),ai=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=It(bo,t);return u.jsx(Ym,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};ai.displayName=bo;var De="MenuContent",[Xm,yo]=Nt(De),ii=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(Qm,{...r,ref:t}):u.jsx(Zm,{...r,ref:t})})})})}),Qm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu),o=p.useRef(null),r=ke(t,o);return p.useEffect(()=>{const s=o.current;if(s)return xo(s)},[]),u.jsx(wo,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Zm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu);return u.jsx(wo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Jm=Ht("MenuContent.ScrollLock"),wo=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,disableOutsideScroll:g,...v}=e,C=It(De,n),b=xn(De,n),_=er(n),A=ri(n),E=Wm(n),[L,k]=p.useState(null),j=p.useRef(null),x=ke(t,j,C.onContentChange),y=p.useRef(0),T=p.useRef(""),M=p.useRef(0),O=p.useRef(null),F=p.useRef("right"),I=p.useRef(0),z=g?Jr:p.Fragment,S=g?{as:Jm,allowPinchZoom:!0}:void 0,w=P=>{var V,K;const U=T.current+P,q=E().filter(G=>!G.disabled),N=document.activeElement,D=(V=q.find(G=>G.ref.current===N))==null?void 0:V.textValue,$=q.map(G=>G.textValue),R=dp($,U,D),H=(K=q.find(G=>G.textValue===R))==null?void 0:K.ref.current;(function G(ne){T.current=ne,window.clearTimeout(y.current),ne!==""&&(y.current=window.setTimeout(()=>G(""),1e3))})(U),H&&setTimeout(()=>H.focus())};p.useEffect(()=>()=>window.clearTimeout(y.current),[]),oo();const B=p.useCallback(P=>{var q,N;return F.current===((q=O.current)==null?void 0:q.side)&&mp(P,(N=O.current)==null?void 0:N.area)},[]);return u.jsx(Xm,{scope:n,searchRef:T,onItemEnter:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),onItemLeave:p.useCallback(P=>{var U;B(P)||((U=j.current)==null||U.focus(),k(null))},[B]),onTriggerLeave:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),pointerGraceTimerRef:M,onPointerGraceIntentChange:p.useCallback(P=>{O.current=P},[]),children:u.jsx(z,{...S,children:u.jsx(qn,{asChild:!0,trapped:r,onMountAutoFocus:te(s,P=>{var U;P.preventDefault(),(U=j.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,children:u.jsx(Om,{asChild:!0,...A,dir:b.dir,orientation:"vertical",loop:o,currentTabStopId:L,onCurrentTabStopIdChange:k,onEntryFocus:te(m,P=>{b.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(ho,{role:"menu","aria-orientation":"vertical","data-state":Si(C.open),"data-radix-menu-content":"",dir:b.dir,..._,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:te(v.onKeyDown,P=>{const q=P.target.closest("[data-radix-menu-content]")===P.currentTarget,N=P.ctrlKey||P.altKey||P.metaKey,D=P.key.length===1;q&&(P.key==="Tab"&&P.preventDefault(),!N&&D&&w(P.key));const $=j.current;if(P.target!==$||!zm.includes(P.key))return;P.preventDefault();const H=E().filter(V=>!V.disabled).map(V=>V.ref.current);ti.includes(P.key)&&H.reverse(),cp(H)}),onBlur:te(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(y.current),T.current="")}),onPointerMove:te(e.onPointerMove,an(P=>{const U=P.target,q=I.current!==P.clientX;if(P.currentTarget.contains(U)&&q){const N=P.clientX>I.current?"right":"left";F.current=N,I.current=P.clientX}}))})})})})})})});ii.displayName=De;var ep="MenuGroup",Co=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"group",...o,ref:t})});Co.displayName=ep;var tp="MenuLabel",li=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{...o,ref:t})});li.displayName=tp;var $n="MenuItem",bs="menu.itemSelect",tr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=p.useRef(null),a=xn($n,e.__scopeMenu),i=yo($n,e.__scopeMenu),m=ke(t,s),f=p.useRef(!1),l=()=>{const c=s.current;if(!n&&c){const d=new CustomEvent(bs,{bubbles:!0,cancelable:!0});c.addEventListener(bs,h=>o==null?void 0:o(h),{once:!0}),wa(c,d),d.defaultPrevented?f.current=!1:a.onClose()}};return u.jsx(ci,{...r,ref:m,disabled:n,onClick:te(e.onClick,l),onPointerDown:c=>{var d;(d=e.onPointerDown)==null||d.call(e,c),f.current=!0},onPointerUp:te(e.onPointerUp,c=>{var d;f.current||(d=c.currentTarget)==null||d.click()}),onKeyDown:te(e.onKeyDown,c=>{const d=i.searchRef.current!=="";n||d&&c.key===" "||Ur.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});tr.displayName=$n;var ci=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=yo($n,n),i=ri(n),m=p.useRef(null),f=ke(t,m),[l,c]=p.useState(!1),[d,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[s.children]),u.jsx(sn.ItemSlot,{scope:n,disabled:o,textValue:r??d,children:u.jsx(Dm,{asChild:!0,...i,focusable:!o,children:u.jsx(he.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:te(e.onPointerMove,an(g=>{o?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(e.onPointerLeave,an(g=>a.onItemLeave(g))),onFocus:te(e.onFocus,()=>c(!0)),onBlur:te(e.onBlur,()=>c(!1))})})})}),np="MenuCheckboxItem",ui=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return u.jsx(hi,{scope:e.__scopeMenu,checked:n,children:u.jsx(tr,{role:"menuitemcheckbox","aria-checked":Un(n)?"mixed":n,...r,ref:t,"data-state":ko(n),onSelect:te(r.onSelect,()=>o==null?void 0:o(Un(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ui.displayName=np;var di="MenuRadioGroup",[rp,op]=Nt(di,{value:void 0,onValueChange:()=>{}}),fi=p.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=Je(o);return u.jsx(rp,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(Co,{...r,ref:t})})});fi.displayName=di;var mi="MenuRadioItem",pi=p.forwardRef((e,t)=>{const{value:n,...o}=e,r=op(mi,e.__scopeMenu),s=n===r.value;return u.jsx(hi,{scope:e.__scopeMenu,checked:s,children:u.jsx(tr,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":ko(s),onSelect:te(o.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,n)},{checkForDefaultPrevented:!1})})})});pi.displayName=mi;var So="MenuItemIndicator",[hi,sp]=Nt(So,{checked:!1}),gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=sp(So,n);return u.jsx(Oe,{present:o||Un(s.checked)||s.checked===!0,children:u.jsx(he.span,{...r,ref:t,"data-state":ko(s.checked)})})});gi.displayName=So;var ap="MenuSeparator",xi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});xi.displayName=ap;var ip="MenuArrow",vi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(go,{...r,...o,ref:t})});vi.displayName=ip;var lp="MenuSub",[Tb,bi]=Nt(lp),rn="MenuSubTrigger",yi=p.forwardRef((e,t)=>{const n=It(rn,e.__scopeMenu),o=xn(rn,e.__scopeMenu),r=bi(rn,e.__scopeMenu),s=yo(rn,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=s,f={__scopeMenu:e.__scopeMenu},l=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>l,[l]),p.useEffect(()=>{const c=i.current;return()=>{window.clearTimeout(c),m(null)}},[i,m]),u.jsx(vo,{asChild:!0,...f,children:u.jsx(ci,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Si(n.open),...e,ref:qe(t,r.onTriggerChange),onClick:c=>{var d;(d=e.onClick)==null||d.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:te(e.onPointerMove,an(c=>{s.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:te(e.onPointerLeave,an(c=>{var h,g;l();const d=(h=n.content)==null?void 0:h.getBoundingClientRect();if(d){const v=(g=n.content)==null?void 0:g.dataset.side,C=v==="right",b=C?-5:5,_=d[C?"left":"right"],A=d[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:c.clientX+b,y:c.clientY},{x:_,y:d.top},{x:A,y:d.top},{x:A,y:d.bottom},{x:_,y:d.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(c),c.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:te(e.onKeyDown,c=>{var h;const d=s.searchRef.current!=="";e.disabled||d&&c.key===" "||Bm[o.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});yi.displayName=rn;var wi="MenuSubContent",Ci=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu),i=bi(wi,e.__scopeMenu),m=p.useRef(null),f=ke(t,m);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:u.jsx(wo,{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:l=>{var c;a.isUsingKeyboardRef.current&&((c=m.current)==null||c.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:te(e.onFocusOutside,l=>{l.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:te(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:te(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),d=Hm[a.dir].includes(l.key);c&&d&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Ci.displayName=wi;function Si(e){return e?"open":"closed"}function Un(e){return e==="indeterminate"}function ko(e){return Un(e)?"indeterminate":e?"checked":"unchecked"}function cp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function up(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function dp(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=up(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 fp(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,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function mp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return fp(n,t)}function an(e){return t=>t.pointerType==="mouse"?e(t):void 0}var pp=oi,hp=vo,gp=ai,xp=ii,vp=Co,bp=li,yp=tr,wp=ui,Cp=fi,Sp=pi,kp=gi,Ep=xi,_p=vi,Ap=yi,jp=Ci,nr="DropdownMenu",[Tp]=nt(nr,[ni]),Ne=ni(),[Rp,ki]=Tp(nr),Ei=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Ne(t),f=p.useRef(null),[l,c]=ut({prop:r,defaultProp:s??!1,onChange:a,caller:nr});return u.jsx(Rp,{scope:t,triggerId:Re(),triggerRef:f,contentId:Re(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(d=>!d),[c]),modal:i,children:u.jsx(pp,{...m,open:l,onOpenChange:c,dir:o,modal:i,children:n})})};Ei.displayName=nr;var _i="DropdownMenuTrigger",Ai=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=ki(_i,n),a=Ne(n);return u.jsx(hp,{asChild:!0,...a,children:u.jsx(he.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:qe(t,s.triggerRef),onPointerDown:te(e.onPointerDown,i=>{!o&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:te(e.onKeyDown,i=>{o||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Ai.displayName=_i;var Np="DropdownMenuPortal",ji=e=>{const{__scopeDropdownMenu:t,...n}=e,o=Ne(t);return u.jsx(gp,{...o,...n})};ji.displayName=Np;var Ti="DropdownMenuContent",Ri=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=ki(Ti,n),s=Ne(n),a=p.useRef(!1);return u.jsx(xp,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var m;a.current||(m=r.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:te(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!r.modal||l)&&(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)"}})});Ri.displayName=Ti;var Ip="DropdownMenuGroup",Mp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(vp,{...r,...o,ref:t})});Mp.displayName=Ip;var Pp="DropdownMenuLabel",Ni=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(bp,{...r,...o,ref:t})});Ni.displayName=Pp;var Op="DropdownMenuItem",Ii=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(yp,{...r,...o,ref:t})});Ii.displayName=Op;var Dp="DropdownMenuCheckboxItem",Lp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(wp,{...r,...o,ref:t})});Lp.displayName=Dp;var Fp="DropdownMenuRadioGroup",$p=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Cp,{...r,...o,ref:t})});$p.displayName=Fp;var Up="DropdownMenuRadioItem",zp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Sp,{...r,...o,ref:t})});zp.displayName=Up;var Bp="DropdownMenuItemIndicator",Hp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(kp,{...r,...o,ref:t})});Hp.displayName=Bp;var Wp="DropdownMenuSeparator",Mi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Ep,{...r,...o,ref:t})});Mi.displayName=Wp;var Vp="DropdownMenuArrow",Gp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(_p,{...r,...o,ref:t})});Gp.displayName=Vp;var Kp="DropdownMenuSubTrigger",qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Ap,{...r,...o,ref:t})});qp.displayName=Kp;var Yp="DropdownMenuSubContent",Xp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(jp,{...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)"}})});Xp.displayName=Yp;var Qp=Ei,Zp=Ai,Jp=ji,eh=Ri,th=Ni,nh=Ii,rh=Mi;function Pi({...e}){return u.jsx(Qp,{"data-slot":"dropdown-menu",...e})}function Oi({...e}){return u.jsx(Zp,{"data-slot":"dropdown-menu-trigger",...e})}function Di({className:e,sideOffset:t=4,...n}){return u.jsx(Jp,{children:u.jsx(eh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ee("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 Tn({className:e,inset:t,variant:n="default",...o}){return u.jsx(nh,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ee("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 oh({className:e,inset:t,...n}){return u.jsx(th,{"data-slot":"dropdown-menu-label","data-inset":t,className:ee("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function ys({className:e,...t}){return u.jsx(rh,{"data-slot":"dropdown-menu-separator",className:ee("bg-border -mx-1 my-1 h-px",e),...t})}const sh=[{value:"light",label:"Light",icon:u.jsx(pa,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:u.jsx(da,{className:"h-4 w-4"})},{value:"system",label:"System",icon:u.jsx(Bu,{className:"h-4 w-4"})}];function ah(){const{theme:e,setTheme:t,resolvedTheme:n}=yd();return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?u.jsx(da,{className:"h-4 w-4"}):u.jsx(pa,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),u.jsx(Di,{align:"end",children:sh.map(o=>u.jsxs(Tn,{onClick:()=>t(o.value),className:e===o.value?"bg-accent":"",children:[o.icon,u.jsx("span",{className:"ml-2",children:o.label})]},o.value))})]})}const ws={"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":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","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.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","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(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","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":"创建会话失败","dialog.envEmpty":"暂无可用环境","dialog.envPersonal":"个人","dialog.envTeam":"团队","dialog.envDirectory":"目录","dialog.envSelectEnv":"选择环境","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.readOnly":"只读会话,无法发送消息","session.mySessions":"我的会话","session.sharedWithMe":"共享给我的会话","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","user.settings.language":"语言","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","artifacts.title":"Artifacts","artifacts.subtitle":"团队共享的交互界面与报告","artifacts.new":"新建 Artifact","artifacts.empty":'还没有 Artifact。让 agent 用 artifact 工具上传,或点击"新建"从模板创建。',"artifacts.loadFailed":"加载 Artifacts 失败","artifacts.delete":"删除","artifacts.deleteFailed":"删除失败","artifacts.openInNewTab":"新窗口打开","artifacts.copyLink":"复制链接","artifacts.copied":"已复制","artifacts.expires":"过期时间","artifacts.version":"版本","artifacts.session":"会话","artifacts.updatedAt":"更新于","artifacts.viewNotFound":"Artifact 不存在或已过期","artifacts.backToGallery":"← 返回 Artifacts","artifacts.create.title":"新建 Artifact","artifacts.create.template":"模板","artifacts.create.templateBlank":"空白 HTML","artifacts.create.templatePrReview":"PR 审查","artifacts.create.templateIncident":"故障排查时间线","artifacts.create.templateDashboard":"数据看板","artifacts.create.templateChecklist":"发布检查清单","artifacts.create.title.label":"标题","artifacts.create.content":"内容 (HTML 或 Markdown)","artifacts.create.submit":"创建","artifacts.create.failed":"创建失败","artifacts.templateDesc.prReview":"逐文件审查结论、评论与整体状态","artifacts.templateDesc.incident":"按时间线排查故障,标记状态与严重级别","artifacts.templateDesc.dashboard":"KPI 卡片、SVG 图表与数据表","artifacts.templateDesc.checklist":"分阶段发布检查项与进度条","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},ih={"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.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","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.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","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","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","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":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","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","dialog.envEmpty":"No environments available","dialog.envPersonal":"Personal","dialog.envTeam":"Team","dialog.envDirectory":"Directory","dialog.envSelectEnv":"Select environment","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.readOnly":"Read-only session — cannot send messages","session.mySessions":"My sessions","session.sharedWithMe":"Shared with me","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","artifacts.title":"Artifacts","artifacts.subtitle":"Interactive interfaces & reports shared with your team","artifacts.new":"New Artifact","artifacts.empty":"No artifacts yet. Have the agent upload one with the artifact tool, or start from a template.","artifacts.loadFailed":"Failed to load artifacts","artifacts.delete":"Delete","artifacts.deleteFailed":"Delete failed","artifacts.openInNewTab":"Open in new tab","artifacts.copyLink":"Copy link","artifacts.copied":"Copied","artifacts.expires":"Expires","artifacts.version":"Version","artifacts.session":"Session","artifacts.updatedAt":"Updated","artifacts.viewNotFound":"Artifact not found or expired","artifacts.backToGallery":"← Back to Artifacts","artifacts.create.title":"New Artifact","artifacts.create.template":"Template","artifacts.create.templateBlank":"Blank HTML","artifacts.create.templatePrReview":"PR Review","artifacts.create.templateIncident":"Incident Timeline","artifacts.create.templateDashboard":"Data Dashboard","artifacts.create.templateChecklist":"Release Checklist","artifacts.create.title.label":"Title","artifacts.create.content":"Content (HTML or Markdown)","artifacts.create.submit":"Create","artifacts.create.failed":"Create failed","artifacts.templateDesc.prReview":"Per-file review verdicts, comments & overall status","artifacts.templateDesc.incident":"Chronological investigation with severity & status markers","artifacts.templateDesc.dashboard":"KPI cards, SVG charts & data tables","artifacts.templateDesc.checklist":"Staged release checks with progress bar","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},Li="rcs_locale";function lh(){try{const t=localStorage.getItem(Li);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Eo=lh();const zr=new Set;function Rb(e){Eo=e;try{localStorage.setItem(Li,e)}catch{}zr.forEach(t=>t())}function ch(e){return zr.add(e),()=>{zr.delete(e)}}function Fi(){return p.useSyncExternalStore(ch,()=>Eo)}function Fe(e){return Eo==="en"?ih[e]??ws[e]??e:ws[e]??e}const uh="";let zn=null;function dh(e){zn=e}function Nb(){return zn}let Br=null;function Cs(e){Br=e}let tn=null;async function fh(){return tn||(tn=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{tn=null}})(),tn)}class wr extends Error{constructor(n,o,r){super(n);oe(this,"type");oe(this,"status");this.name="ApiError",this.type=o,this.status=r}}async function ve(e,t,n,o){const r={"Content-Type":"application/json"};zn&&(r.Authorization=`Bearer ${zn}`);const s=`${uh}${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 fh())return ve(e,t,n,!0);Br&&Br()}let m;try{m=await i.json()}catch{throw i.ok?new wr("Invalid JSON response","parse_error",i.status):new wr(i.statusText,"http_error",i.status)}if(!i.ok){const f=m;let l="unknown",c=i.statusText;throw typeof f.error=="string"?(c=f.error,l="http_error"):f.error&&typeof f.error=="object"&&(l=f.error.type||"unknown",c=f.error.message||f.error.type||i.statusText),new wr(c,l,i.status)}return m}function Ib(){return ve("GET","/web/sessions/all")}function Mb(e){return ve("GET",`/web/sessions/${e}`)}function Pb(e){return ve("GET",`/web/sessions/${e}/history`)}function Ob(){return ve("GET","/web/environments")}function Db(e,t){return ve("POST",`/web/sessions/${e}/events`,t)}function Lb(e,t){return ve("POST",`/web/sessions/${e}/control`,t)}function Fb(e){return ve("POST",`/web/sessions/${e}/interrupt`)}function $b(e){return ve("DELETE",`/web/sessions/${e}`)}function Ub(e){return ve("POST",`/web/sessions/${e}/clear`)}function zb(e,t){return ve("PATCH",`/web/sessions/${e}`,{title:t})}function Bb(e){return ve("POST","/web/sessions",e)}function Hb(e){return ve("GET",`/web/sessions/s/${e}`)}function Wb(e){return ve("GET",`/web/sessions/${e}/shares`)}function Vb(e,t){return ve("POST",`/web/sessions/${e}/shares`,t)}function Gb(e,t){return ve("DELETE",`/web/sessions/${e}/shares/${t}`)}function Kb(e,t){return ve("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function qb(e,t){return ve("DELETE",`/web/teams/${e}/environments/${t}`)}function Yb(e){return ve("POST","/web/environments/claim",{claim_token:e})}function Xb(e){const t=e!=null&&e.session_id?`?session_id=${encodeURIComponent(e.session_id)}`:"";return ve("GET",`/web/artifacts${t}`)}function Qb(e){return ve("GET",`/web/artifacts/${e}`)}function Zb(e){return ve("POST","/web/artifacts",e)}function Jb(e){return ve("DELETE",`/web/artifacts/${e}`)}const Hr="rcs_active_team";function mh(){try{return localStorage.getItem(Hr)}catch{return null}}let $i=mh();const Wr=new Set;function ph(){for(const e of Wr)e()}function hh(e){return Wr.add(e),()=>Wr.delete(e)}function gh(){return $i}function Ct(e){try{e?localStorage.setItem(Hr,e):localStorage.removeItem(Hr)}catch{}$i=e,ph()}function xh(){const[e,t]=p.useState([]),[n,o]=p.useState(!0),r=p.useSyncExternalStore(hh,gh,()=>null),s=p.useCallback(async()=>{o(!0);try{const f=await ve("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=>{Ct(f)},[]),m=p.useCallback(async f=>{const l=await ve("POST","/web/teams",f);return await s(),l},[s]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:s}}function vh({className:e}){Fi();const{myTeams:t,activeTeam:n,switchTeam:o,isLoading:r}=xh();return r||t.length===0?null:u.jsxs("div",{className:ee("relative",e),children:[u.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:[u.jsx("option",{value:"",children:Fe("team.switcher.personal")}),t.map(s=>u.jsx("option",{value:s.id,children:s.name},s.id))]}),u.jsx(Kt,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted pointer-events-none"})]})}const Ui=p.createContext(null);function zi(){const e=p.useContext(Ui);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Dt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function bh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function An(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function yh({children:e}){const[t,n]=p.useState(null),[o,r]=p.useState(!0),[s,a]=p.useState(!0);p.useEffect(()=>{let g=!1;return Dt().then(v=>{g||(n(v),r(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(v=>v.json()).then(v=>{g||a(v.allowed===!0)}).catch(()=>{}),Cs(()=>{n(null),Ct(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{g=!0,Cs(null)}},[]);const i=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Login failed")}const b=await Dt();n(b),Ct(null)},[]),m=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Ct(null)},[]),f=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const v=await Dt();return n(v),!0}catch{return!1}},[]),l=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Setup failed")}const _=await Dt();n(_),Ct(null)},[]),c=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Join failed")}const _=await Dt();n(_),Ct(null)},[]),d=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Registration failed")}const b=await Dt();n(b),Ct(null)},[]),h=p.useCallback(async()=>bh(),[]);return u.jsx(Ui.Provider,{value:{user:t,isLoading:o,login:i,logout:m,refresh:f,setup:l,join:c,register:d,checkSetupStatus:h,registrationAllowed:s},children:e})}function wh({onSettingsClick:e}){const{user:t,logout:n}=zi();if(!t)return null;const o=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.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:[u.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand",children:u.jsx(ha,{className:"h-3.5 w-3.5"})}),u.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),u.jsxs(Di,{align:"end",className:"w-48",children:[u.jsx(oh,{children:u.jsxs("div",{className:"flex flex-col space-y-0.5",children:[u.jsx("span",{className:"text-sm font-medium",children:t.username}),u.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:e,children:[u.jsx(od,{className:"mr-2 h-4 w-4"}),Fe("user.menu.settings")]}),u.jsxs(Tn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[u.jsx(vd,{className:"mr-2 h-4 w-4"}),Fe("team.menu.myTeams")]}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:o,children:[u.jsx(Fu,{className:"mr-2 h-4 w-4"}),Fe("user.menu.logout")]})]})]})}function Ch({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:o,onNavigateArtifacts:r}){return Fi(),u.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:u.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[!e&&u.jsx(vh,{}),e?u.jsxs(u.Fragment,{children:[u.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:[u.jsx(yu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),u.jsx("span",{className:"text-text-muted/40",children:"/"}),u.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&u.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"})]}):u.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:u.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)"})}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.remoteControl")})]})]}),u.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!e&&u.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:Fe("nav.dashboard"),children:[u.jsx(Ou,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),r&&u.jsxs("button",{type:"button",onClick:r,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 transition-colors",title:Fe("artifacts.title"),children:[u.jsx(Tu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("artifacts.title")})]}),u.jsx(ah,{}),u.jsx(wh,{onSettingsClick:o??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function ey({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 u.jsx("span",{className:ee("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 Bi extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const ct=class ct{constructor(t){oe(this,"ws",null);oe(this,"settings");oe(this,"connectionState","disconnected");oe(this,"sessionId",null);oe(this,"_agentCapabilities",null);oe(this,"_promptCapabilities",null);oe(this,"_modelState",null);oe(this,"_availableCommands",[]);oe(this,"_usage",null);oe(this,"_currentModeId",null);oe(this,"_configOptions",[]);oe(this,"onModelChanged",new Set);oe(this,"onModelStateChanged",new Set);oe(this,"onUsageChanged",new Set);oe(this,"onCurrentModeChanged",new Set);oe(this,"onConfigOptionsChanged",new Set);oe(this,"onAvailableCommandsChanged",null);oe(this,"onSessionLoaded",null);oe(this,"onSessionSwitching",null);oe(this,"onConnectionStateChange",new Set);oe(this,"onSessionUpdate",null);oe(this,"onSessionCreated",null);oe(this,"onPromptComplete",null);oe(this,"onPermissionRequest",null);oe(this,"onBrowserToolCall",null);oe(this,"onErrorMessage",null);oe(this,"onSessionDeleted",null);oe(this,"onSessionRenamed",null);oe(this,"pendingSessionList",null);oe(this,"pendingSessionLoad",null);oe(this,"pendingSessionResume",null);oe(this,"pendingSessionTarget",null);oe(this,"connectResolve",null);oe(this,"connectReject",null);oe(this,"heartbeatInterval",null);oe(this,"heartbeatTimeout",null);oe(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)}setUsageChangedHandler(t){this.onUsageChanged.add(t),t(this._usage)}removeUsageChangedHandler(t){this.onUsageChanged.delete(t)}setCurrentModeChangedHandler(t){this.onCurrentModeChanged.add(t),t(this._currentModeId)}removeCurrentModeChangedHandler(t){this.onCurrentModeChanged.delete(t)}setConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.add(t),t(this._configOptions)}removeConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.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 usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}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,l,c,d,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 b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();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 b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();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 b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();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=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(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"),(c=this.onAvailableCommandsChanged)==null||c.call(this,this._availableCommands);else if(C==="usage_update"){this._usage=t.payload.update;for(const b of this.onUsageChanged)b(this._usage)}else if(C==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const b of this.onCurrentModeChanged)b(this._currentModeId)}else if(C==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const b of this.onConfigOptionsChanged)b(this._configOptions)}(d=this.onSessionUpdate)==null||d.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 b of this.onModelChanged)b(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}}resetSessionUsageState(){this._usage=null,this._currentModeId=null,this._configOptions=[];for(const t of this.onUsageChanged)t(null);for(const t of this.onCurrentModeChanged)t(null);for(const t of this.onConfigOptionsChanged)t([])}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>=ct.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"))},ct.PONG_TIMEOUT_MS)},ct.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 Bi),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,[]),this.resetSessionUsageState();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)}};oe(ct,"HEARTBEAT_INTERVAL_MS",3e4),oe(ct,"PONG_TIMEOUT_MS",1e4),oe(ct,"MAX_MISSED_PONGS",2);let Vr=ct;function kh(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 Hi(e,t){return new Promise((function(n,o){let r;return Eh(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 Eh=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 l;switch(s.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=s.getUint32(f+4,l),d=f+c+2+12*s.getUint16(f+c,l);for(let h=f+c+2;h<d;h+=12)if(s.getUint16(h,l)==274){if(s.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,l);break}return t(r.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),o.readAsArrayBuffer(e)}));var Bn={},_h={get exports(){return Bn},set exports(e){Bn=e}};(function(e){var t,n,o={};_h.exports=o,o.parse=function(r,s){for(var a=o.bin.readUshort,i=o.bin.readUint,m=0,f={},l=new Uint8Array(r),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var d=a(l,m+=4);a(l,m+=2);var h=i(l,m+=2),g=i(l,m+=4);m+=4,m=g;for(var v=0;v<d;v++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var C=i(l,m+=4),b=a(l,m+=4),_=a(l,m+2),A=a(l,m+4);m+=6;var E=i(l,m+=8);m+=4,m+=b+_+A,o._readLocal(l,E,f,h,C,s)}return f},o._readLocal=function(r,s,a,i,m,f){var l=o.bin.readUshort,c=o.bin.readUint;c(r,s),l(r,s+=4),l(r,s+=2);var d=l(r,s+=2);c(r,s+=2),c(r,s+=4),s+=4;var h=l(r,s+=8),g=l(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(d==0)a[v]=new Uint8Array(C.buffer.slice(s,s+i));else{if(d!=8)throw"unknown compression method: "+d;var b=new Uint8Array(m);o.inflateRaw(C,b),a[v]=b}}},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 l in r){var c=!o._noNeed(l)&&!s,d=r[l],h=o.crc.crc(d,0,d.length);f[l]={cpr:c,usize:d.length,crc:h,file:c?o.deflateRaw(d):d}}for(var l in f)a+=f[l].file.length+30+46+2*o.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),v=0,C=[];for(var l in f){var b=f[l];C.push(v),v=o._writeHeader(g,v,l,b,0)}var _=0,A=v;for(var l in f)b=f[l],C.push(v),v=o._writeHeader(g,v,l,b,1,C[_++]);var E=v-A;return i(g,v,101010256),v+=4,m(g,v+=4,_),m(g,v+=2,_),i(g,v+=2,E),i(g,v+=4,A),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 l=o.bin.writeUint,c=o.bin.writeUshort,d=i.file;return l(r,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),c(r,s,20),c(r,s+=2,0),c(r,s+=2,i.cpr?8:0),l(r,s+=2,0),l(r,s+=4,i.crc),l(r,s+=4,d.length),l(r,s+=4,i.usize),c(r,s+=4,o.bin.sizeUTF8(a)),c(r,s+=2,0),s+=2,m==1&&(s+=2,s+=2,l(r,s+=6,f),s+=4),s+=o.bin.writeUTF8(r,s,a),m==0&&(r.set(d,s),s+=d.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,l=s+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)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 l=a.charCodeAt(f);if((4294967168&l)==0)r[s+m]=l,m++;else if((4294965248&l)==0)r[s+m]=192|l>>6,r[s+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)r[s+m]=224|l>>12,r[s+m+1]=128|l>>6&63,r[s+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";r[s+m]=240|l>>18,r[s+m+1]=128|l>>12&63,r[s+m+2]=128|l>>6&63,r[s+m+3]=128|l>>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,l=o.F._goodIndex;o.F._hash;var c=o.F._putsE,d=0,h=a<<3,g=0,v=r.length;if(i==0){for(;d<v;)c(s,h,d+(M=Math.min(65535,v-d))==v?1:0),h=o.F._copyExact(r,d,M,s,h+8),d+=M;return h>>>3}var C=f.lits,b=f.strt,_=f.prev,A=0,E=0,L=0,k=0,j=0,x=0;for(v>2&&(b[x=o.F._hash(r,0)]=0),d=0;d<v;d++){if(j=x,d+1<v-2){x=o.F._hash(r,d+1);var y=d+1&32767;_[y]=b[x],b[x]=y}if(g<=d){(A>14e3||E>26697)&&v-d>100&&(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(d==v-1||g==v?1:0,C,A,k,r,L,d-L,s,h),A=E=k=0,L=d);var T=0;d<v-2&&(T=o.F._bestMatch(r,d,_,j,Math.min(m[2],v-d),m[3]));var M=T>>>16,O=65535&T;if(T!=0){O=65535&T;var F=l(M=T>>>16,f.of0);f.lhst[257+F]++;var I=l(O,f.df0);f.dhst[I]++,k+=f.exb[F]+f.dxb[I],C[A]=M<<23|d-g,C[A+1]=O<<16|F<<8|I,A+=2,g=d+M}else f.lhst[r[d]]++;E++}}for(L==d&&r.length!=0||(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(1,C,A,k,r,L,d-L,s,h),A=0,E=0,A=E=k=0,L=d);(7&h)!=0;)h++;return h>>>3},o.F._bestMatch=function(r,s,a,i,m,f){var l=32767&s,c=a[l],d=l-c+32768&32767;if(c==l||i!=o.F._hash(r,s-d))return 0;for(var h=0,g=0,v=Math.min(32767,s);d<=v&&--f!=0&&c!=l;){if(h==0||r[s+h]==r[s+h-d]){var C=o.F._howLong(r,s,d);if(C>h){if(g=d,(h=C)>=m)break;d+2<C&&(C=d+2);for(var b=0,_=0;_<C-2;_++){var A=s-d+_+32768&32767,E=A-a[A]+32768&32767;E>b&&(b=E,c=A)}}}d+=(l=c)-(c=a[l])+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,l,c,d){var h,g,v,C,b,_,A,E,L,k=o.F.U,j=o.F._putsF,x=o.F._putsE;k.lhst[256]++,g=(h=o.F.getTrees())[0],v=h[1],C=h[2],b=h[3],_=h[4],A=h[5],E=h[6],L=h[7];var y=32+((d+3&7)==0?0:8-(d+3&7))+(l<<3),T=i+o.F.contSize(k.fltree,k.lhst)+o.F.contSize(k.fdtree,k.dhst),M=i+o.F.contSize(k.ltree,k.lhst)+o.F.contSize(k.dtree,k.dhst);M+=14+3*A+o.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var O=0;O<286;O++)k.lhst[O]=0;for(O=0;O<30;O++)k.dhst[O]=0;for(O=0;O<19;O++)k.ihst[O]=0;var F=y<T&&y<M?0:T<M?1:2;if(j(c,d,r),j(c,d+1,F),d+=3,F==0){for(;(7&d)!=0;)d++;d=o.F._copyExact(m,f,l,c,d)}else{var I,z;if(F==1&&(I=k.fltree,z=k.fdtree),F==2){o.F.makeCodes(k.ltree,g),o.F.revCodes(k.ltree,g),o.F.makeCodes(k.dtree,v),o.F.revCodes(k.dtree,v),o.F.makeCodes(k.itree,C),o.F.revCodes(k.itree,C),I=k.ltree,z=k.dtree,x(c,d,b-257),x(c,d+=5,_-1),x(c,d+=5,A-4),d+=4;for(var S=0;S<A;S++)x(c,d+3*S,k.itree[1+(k.ordr[S]<<1)]);d+=3*A,d=o.F._codeTiny(E,k.itree,c,d),d=o.F._codeTiny(L,k.itree,c,d)}for(var w=f,B=0;B<a;B+=2){for(var P=s[B],U=P>>>23,q=w+(8388607&P);w<q;)d=o.F._writeLit(m[w++],I,c,d);if(U!=0){var N=s[B+1],D=N>>16,$=N>>8&255,R=255&N;x(c,d=o.F._writeLit(257+$,I,c,d),U-k.of0[$]),d+=k.exb[$],j(c,d=o.F._writeLit(R,z,c,d),D-k.df0[R]),d+=k.dxb[R],w+=U}}d=o.F._writeLit(256,I,c,d)}return d},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=[],l=o.F._lenCodes(r.dtree,f),c=0;c<i.length;c+=2)r.ihst[i[c]]++;for(c=0;c<f.length;c+=2)r.ihst[f[c]]++;for(var d=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,d,m,l,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],l=r[m+1];i=o.F._writeLit(f,s,a,i);var c=f==16?2:f==17?3:7;f>15&&(o.F._putsE(a,i,l,c),i+=c)}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,l=i+5<a?r[i+5]:-1,c=i==0?-1:r[i-1];if(m==0&&f==m&&l==m){for(var d=i+5;d+2<a&&r[d+2]==m;)d+=2;(h=Math.min(d+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(d=i+5;d+2<a&&r[d+2]==m;)d+=2;var h=Math.min(d+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,l=0;for(l=0;l<f;l+=2)s[l]=0,s[l+1]=0;for(l=0;l<m;l++)r[l]!=0&&i.push({lit:l,f:r[l]});var c=i.length,d=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return d=h==0?1:0,s[1+(h<<1)]=1,s[1+(d<<1)]=1,1}i.sort((function(E,L){return E.f-L.f}));var g=i[0],v=i[1],C=0,b=1,_=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};b!=c-1;)g=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],v=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],i[b++]={lit:-1,f:g.f+v.f,l:g,r:v};var A=o.F.setDepth(i[b-1],0);for(A>a&&(o.F.restrictDepth(d,a,A),A=a),l=0;l<c;l++)s[1+(d[l].lit<<1)]=d[l].d;return A},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(c,d){return d.d==c.d?c.f-d.f:d.d-c.d})),i=0;i<r.length&&r[i].d>s;i++){var l=r[i].d;r[i].d=s,f+=m-(1<<a-l)}for(f>>>=a-s;f>0;)(l=r[i].d)<s?(r[i].d++,f-=1<<s-l-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,l=i._decodeTiny,c=i.makeCodes,d=i.codes2map,h=i._get17,g=i.U,v=s==null;v&&(s=new a(r.length>>>2<<3));for(var C,b,_=0,A=0,E=0,L=0,k=0,j=0,x=0,y=0,T=0;_==0;)if(_=m(r,T,1),A=m(r,T+1,2),T+=3,A!=0){if(v&&(s=o.F._check(s,y+(1<<17))),A==1&&(C=g.flmap,b=g.fdmap,j=511,x=31),A==2){E=f(r,T,5)+257,L=f(r,T+5,5)+1,k=f(r,T+10,4)+4,T+=14;for(var M=0;M<38;M+=2)g.itree[M]=0,g.itree[M+1]=0;var O=1;for(M=0;M<k;M++){var F=f(r,T+3*M,3);g.itree[1+(g.ordr[M]<<1)]=F,F>O&&(O=F)}T+=3*k,c(g.itree,O),d(g.itree,O,g.imap),C=g.lmap,b=g.dmap,T=l(g.imap,(1<<O)-1,E+L,r,T,g.ttree);var I=i._copyOut(g.ttree,0,E,g.ltree);j=(1<<I)-1;var z=i._copyOut(g.ttree,E,L,g.dtree);x=(1<<z)-1,c(g.ltree,I),d(g.ltree,I,C),c(g.dtree,z),d(g.dtree,z,b)}for(;;){var S=C[h(r,T)&j];T+=15&S;var w=S>>>4;if(!(w>>>8))s[y++]=w;else{if(w==256)break;var B=y+w-254;if(w>264){var P=g.ldef[w-257];B=y+(P>>>3)+f(r,T,7&P),T+=7&P}var U=b[h(r,T)&x];T+=15&U;var q=U>>>4,N=g.ddef[q],D=(N>>>4)+m(r,T,15&N);for(T+=15&N,v&&(s=o.F._check(s,y+(1<<17)));y<B;)s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D];y=B}}}else{(7&T)!=0&&(T+=8-(7&T));var $=4+(T>>>3),R=r[$-4]|r[$-3]<<8;v&&(s=o.F._check(s,y+R)),s.set(new a(r.buffer,r.byteOffset+$,R),y),T=$+R<<3,y+=R}return s.length==y?s:s.slice(0,y)},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 l=o.F._bitsE,c=o.F._get17,d=0;d<a;){var h=r[c(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[d]=g,d++;else{var v=0,C=0;g==16?(C=3+l(i,m,2),m+=2,v=f[d-1]):g==17?(C=3+l(i,m,3),m+=3):g==18&&(C=11+l(i,m,7),m+=7);for(var b=d+C;d<b;)f[d]=v,d++}}return m},o.F._copyOut=function(r,s,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=r[f+s];i[f<<1]=0,i[1+(f<<1)]=c,c>m&&(m=c),f++}for(;f<l;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},o.F.makeCodes=function(r,s){for(var a,i,m,f,l=o.F.U,c=r.length,d=l.bl_count,h=0;h<=s;h++)d[h]=0;for(h=1;h<c;h+=2)d[r[h]]++;var g=l.next_code;for(a=0,d[0]=0,i=1;i<=s;i++)a=a+d[i-1]<<1,g[i]=a;for(m=0;m<c;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 l=f>>1,c=r[f+1],d=l<<4|c,h=s-c,g=r[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=d,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,l){for(;f--!=0;)m.push(0,l)}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 Ah=kh({__proto__:null,default:Bn},[Bn]);const Le=(function(){var e={nextZero(l,c){for(;l[c]!=0;)c++;return c},readUshort:(l,c)=>l[c]<<8|l[c+1],writeUshort(l,c,d){l[c]=d>>8&255,l[c+1]=255&d},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,d){l[c]=d>>24&255,l[c+1]=d>>16&255,l[c+2]=d>>8&255,l[c+3]=255&d},readASCII(l,c,d){let h="";for(let g=0;g<d;g++)h+=String.fromCharCode(l[c+g]);return h},writeASCII(l,c,d){for(let h=0;h<d.length;h++)l[c+h]=d.charCodeAt(h)},readBytes(l,c,d){const h=[];for(let g=0;g<d;g++)h.push(l[c+g]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,d){let h,g="";for(let v=0;v<d;v++)g+=`%${e.pad(l[c+v].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(l,c,d)}return h}};function t(l,c,d,h){const g=c*d,v=s(h),C=Math.ceil(c*v/8),b=new Uint8Array(4*g),_=new Uint32Array(b.buffer),{ctype:A}=h,{depth:E}=h,L=e.readUshort;if(A==6){const P=g<<2;if(E==8)for(var k=0;k<P;k+=4)b[k]=l[k],b[k+1]=l[k+1],b[k+2]=l[k+2],b[k+3]=l[k+3];if(E==16)for(k=0;k<P;k++)b[k]=l[k<<1]}else if(A==2){const P=h.tabs.tRNS;if(P==null){if(E==8)for(k=0;k<g;k++){var j=3*k;_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j]}if(E==16)for(k=0;k<g;k++)j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j]}else{var x=P[0];const U=P[1],q=P[2];if(E==8)for(k=0;k<g;k++){var y=k<<2;j=3*k,_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j],l[j]==x&&l[j+1]==U&&l[j+2]==q&&(b[y+3]=0)}if(E==16)for(k=0;k<g;k++)y=k<<2,j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j],L(l,j)==x&&L(l,j+2)==U&&L(l,j+4)==q&&(b[y+3]=0)}}else if(A==3){const P=h.tabs.PLTE,U=h.tabs.tRNS,q=U?U.length:0;if(E==1)for(var T=0;T<d;T++){var M=T*C,O=T*c;for(k=0;k<c;k++){y=O+k<<2;var F=3*(I=l[M+(k>>3)]>>7-((7&k)<<0)&1);b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}if(E==2)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>2)]>>6-((3&k)<<1)&3),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==4)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>1)]>>4-((1&k)<<2)&15),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==8)for(k=0;k<g;k++){var I;y=k<<2,F=3*(I=l[k]),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}else if(A==4){if(E==8)for(k=0;k<g;k++){y=k<<2;var z=l[S=k<<1];b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+1]}if(E==16)for(k=0;k<g;k++){var S;y=k<<2,z=l[S=k<<2],b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+2]}}else if(A==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,T=0;T<d;T++){const P=T*C,U=T*c;if(E==1)for(var w=0;w<c;w++){var B=(z=255*(l[P+(w>>>3)]>>>7-(7&w)&1))==255*x?0:255;_[U+w]=B<<24|z<<16|z<<8|z}else if(E==2)for(w=0;w<c;w++)B=(z=85*(l[P+(w>>>2)]>>>6-((3&w)<<1)&3))==85*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==4)for(w=0;w<c;w++)B=(z=17*(l[P+(w>>>1)]>>>4-((1&w)<<2)&15))==17*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==8)for(w=0;w<c;w++)B=(z=l[P+w])==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==16)for(w=0;w<c;w++)z=l[P+(w<<1)],B=L(l,P+(w<<1))==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z}return b}function n(l,c,d,h){const g=s(l),v=Math.ceil(d*g/8),C=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?r(c,C):o(c,C),l.interlace==0?c=a(c,l,0,d,h):l.interlace==1&&(c=(function(_,A){const E=A.width,L=A.height,k=s(A),j=k>>3,x=Math.ceil(E*k/8),y=new Uint8Array(L*x);let T=0;const M=[0,0,4,0,2,0,1],O=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],I=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const w=F[z],B=I[z];let P=0,U=0,q=M[z];for(;q<L;)q+=w,U++;let N=O[z];for(;N<E;)N+=B,P++;const D=Math.ceil(P*k/8);a(_,A,T,P,U);let $=0,R=M[z];for(;R<L;){let H=O[z],V=T+$*D<<3;for(;H<E;){var S;if(k==1&&(S=(S=_[V>>3])>>7-(7&V)&1,y[R*x+(H>>3)]|=S<<7-((7&H)<<0)),k==2&&(S=(S=_[V>>3])>>6-(7&V)&3,y[R*x+(H>>2)]|=S<<6-((3&H)<<1)),k==4&&(S=(S=_[V>>3])>>4-(7&V)&15,y[R*x+(H>>1)]|=S<<4-((1&H)<<2)),k>=8){const K=R*x+H*j;for(let G=0;G<j;G++)y[K+G]=_[(V>>3)+G]}V+=k,H+=B}$++,R+=w}P*U!=0&&(T+=U*(1+D)),z+=1}return y})(c,l)),c}function o(l,c){return r(new Uint8Array(l.buffer,2,l.length-6),c)}var r=(function(){const l={H:{}};return l.H.N=function(c,d){const h=Uint8Array;let g,v,C=0,b=0,_=0,A=0,E=0,L=0,k=0,j=0,x=0;if(c[0]==3&&c[1]==0)return d||new h(0);const y=l.H,T=y.b,M=y.e,O=y.R,F=y.n,I=y.A,z=y.Z,S=y.m,w=d==null;for(w&&(d=new h(c.length>>>2<<5));C==0;)if(C=T(c,x,1),b=T(c,x+1,2),x+=3,b!=0){if(w&&(d=l.H.W(d,j+(1<<17))),b==1&&(g=S.J,v=S.h,L=511,k=31),b==2){_=M(c,x,5)+257,A=M(c,x+5,5)+1,E=M(c,x+10,4)+4,x+=14;let P=1;for(var B=0;B<38;B+=2)S.Q[B]=0,S.Q[B+1]=0;for(B=0;B<E;B++){const N=M(c,x+3*B,3);S.Q[1+(S.X[B]<<1)]=N,N>P&&(P=N)}x+=3*E,F(S.Q,P),I(S.Q,P,S.u),g=S.w,v=S.d,x=O(S.u,(1<<P)-1,_+A,c,x,S.v);const U=y.V(S.v,0,_,S.C);L=(1<<U)-1;const q=y.V(S.v,_,A,S.D);k=(1<<q)-1,F(S.C,U),I(S.C,U,g),F(S.D,q),I(S.D,q,v)}for(;;){const P=g[z(c,x)&L];x+=15&P;const U=P>>>4;if(!(U>>>8))d[j++]=U;else{if(U==256)break;{let q=j+U-254;if(U>264){const H=S.q[U-257];q=j+(H>>>3)+M(c,x,7&H),x+=7&H}const N=v[z(c,x)&k];x+=15&N;const D=N>>>4,$=S.c[D],R=($>>>4)+T(c,x,15&$);for(x+=15&$;j<q;)d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R];j=q}}}}else{(7&x)!=0&&(x+=8-(7&x));const P=4+(x>>>3),U=c[P-4]|c[P-3]<<8;w&&(d=l.H.W(d,j+U)),d.set(new h(c.buffer,c.byteOffset+P,U),j),x=P+U<<3,j+=U}return d.length==j?d:d.slice(0,j)},l.H.W=function(c,d){const h=c.length;if(d<=h)return c;const g=new Uint8Array(h<<1);return g.set(c,0),g},l.H.R=function(c,d,h,g,v,C){const b=l.H.e,_=l.H.Z;let A=0;for(;A<h;){const E=c[_(g,v)&d];v+=15&E;const L=E>>>4;if(L<=15)C[A]=L,A++;else{let k=0,j=0;L==16?(j=3+b(g,v,2),v+=2,k=C[A-1]):L==17?(j=3+b(g,v,3),v+=3):L==18&&(j=11+b(g,v,7),v+=7);const x=A+j;for(;A<x;)C[A]=k,A++}}return v},l.H.V=function(c,d,h,g){let v=0,C=0;const b=g.length>>>1;for(;C<h;){const _=c[C+d];g[C<<1]=0,g[1+(C<<1)]=_,_>v&&(v=_),C++}for(;C<b;)g[C<<1]=0,g[1+(C<<1)]=0,C++;return v},l.H.n=function(c,d){const h=l.H.m,g=c.length;let v,C,b,_;const A=h.j;for(var E=0;E<=d;E++)A[E]=0;for(E=1;E<g;E+=2)A[c[E]]++;const L=h.K;for(v=0,A[0]=0,C=1;C<=d;C++)v=v+A[C-1]<<1,L[C]=v;for(b=0;b<g;b+=2)_=c[b+1],_!=0&&(c[b]=L[_],L[_]++)},l.H.A=function(c,d,h){const g=c.length,v=l.H.m.r;for(let C=0;C<g;C+=2)if(c[C+1]!=0){const b=C>>1,_=c[C+1],A=b<<4|_,E=d-_;let L=c[C]<<E;const k=L+(1<<E);for(;L!=k;)h[v[L]>>>15-d]=A,L++}},l.H.l=function(c,d){const h=l.H.m.r,g=15-d;for(let v=0;v<c.length;v+=2){const C=c[v]<<d-c[v+1];c[v]=h[C]>>>g}},l.H.M=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8},l.H.I=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8,c[g+2]|=h>>>16},l.H.e=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8)>>>(7&d)&(1<<h)-1},l.H.b=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)&(1<<h)-1},l.H.Z=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16|c[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=(function(){const c=Uint16Array,d=Uint32Array;return{K:new c(16),j:new c(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 c(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 d(32),J:new c(512),_:[],h:new c(32),$:[],w:new c(32768),C:[],v:[],d:new c(32768),D:[],u:new c(512),Q:[],r:new c(32768),s:new d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var d=0;d<32768;d++){let g=d;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,c.r[d]=(g>>>16|g<<16)>>>17}function h(g,v,C){for(;v--!=0;)g.push(0,C)}for(d=0;d<32;d++)c.q[d]=c.S[d]<<3|c.T[d],c.c[d]=c.p[d]<<4|c.z[d];h(c._,144,8),h(c._,112,9),h(c._,24,7),h(c._,8,8),l.H.n(c._,9),l.H.A(c._,9,c.J),l.H.l(c._,9),h(c.$,32,5),l.H.n(c.$,5),l.H.A(c.$,5,c.h),l.H.l(c.$,5),h(c.Q,19,0),h(c.C,286,0),h(c.D,30,0),h(c.v,320,0)})(),l.H.N})();function s(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,d,h,g){let v=s(c);const C=Math.ceil(h*v/8);let b,_;v=Math.ceil(v/8);let A=l[d],E=0;if(A>1&&(l[d]=[0,0,1][A-2]),A==3)for(E=v;E<C;E++)l[E+1]=l[E+1]+(l[E+1-v]>>>1)&255;for(let L=0;L<g;L++)if(b=d+L*C,_=b+L+1,A=l[_-1],E=0,A==0)for(;E<C;E++)l[b+E]=l[_+E];else if(A==1){for(;E<v;E++)l[b+E]=l[_+E];for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-v]}else if(A==2)for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-C];else if(A==3){for(;E<v;E++)l[b+E]=l[_+E]+(l[b+E-C]>>>1);for(;E<C;E++)l[b+E]=l[_+E]+(l[b+E-C]+l[b+E-v]>>>1)}else{for(;E<v;E++)l[b+E]=l[_+E]+i(0,l[b+E-C],0);for(;E<C;E++)l[b+E]=l[_+E]+i(l[b+E-v],l[b+E-C],l[b+E-v-C])}return l}function i(l,c,d){const h=l+c-d,g=h-l,v=h-c,C=h-d;return g*g<=v*v&&g*g<=C*C?l:v*v<=C*C?c:d}function m(l,c,d){d.width=e.readUint(l,c),c+=4,d.height=e.readUint(l,c),c+=4,d.depth=l[c],c++,d.ctype=l[c],c++,d.compress=l[c],c++,d.filter=l[c],c++,d.interlace=l[c],c++}function f(l,c,d,h,g,v,C,b,_){const A=Math.min(c,g),E=Math.min(d,v);let L=0,k=0;for(let z=0;z<E;z++)for(let S=0;S<A;S++)if(C>=0&&b>=0?(L=z*c+S<<2,k=(b+z)*g+C+S<<2):(L=(-b+z)*c-C+S<<2,k=z*g+S<<2),_==0)h[k]=l[L],h[k+1]=l[L+1],h[k+2]=l[L+2],h[k+3]=l[L+3];else if(_==1){var j=l[L+3]*.00392156862745098,x=l[L]*j,y=l[L+1]*j,T=l[L+2]*j,M=h[k+3]*(1/255),O=h[k]*M,F=h[k+1]*M,I=h[k+2]*M;const w=1-j,B=j+M*w,P=B==0?0:1/B;h[k+3]=255*B,h[k+0]=(x+O*w)*P,h[k+1]=(y+F*w)*P,h[k+2]=(T+I*w)*P}else if(_==2)j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I?(h[k]=0,h[k+1]=0,h[k+2]=0,h[k+3]=0):(h[k]=x,h[k+1]=y,h[k+2]=T,h[k+3]=j);else if(_==3){if(j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I)continue;if(j<220&&M>20)return!1}return!0}return{decode:function(c){const d=new Uint8Array(c);let h=8;const g=e,v=g.readUshort,C=g.readUint,b={tabs:{},frames:[]},_=new Uint8Array(d.length);let A,E=0,L=0;const k=[137,80,78,71,13,10,26,10];for(var j=0;j<8;j++)if(d[j]!=k[j])throw"The input is not a PNG file!";for(;h<d.length;){const z=g.readUint(d,h);h+=4;const S=g.readASCII(d,h,4);if(h+=4,S=="IHDR")m(d,h,b);else if(S=="iCCP"){for(var x=h;d[x]!=0;)x++;g.readASCII(d,h,x-h),d[x+1];const w=d.slice(x+2,h+z);let B=null;try{B=o(w)}catch{B=r(w)}b.tabs[S]=B}else if(S=="CgBI")b.tabs[S]=d.slice(h,h+4);else if(S=="IDAT"){for(j=0;j<z;j++)_[E+j]=d[h+j];E+=z}else if(S=="acTL")b.tabs[S]={num_frames:C(d,h),num_plays:C(d,h+4)},A=new Uint8Array(d.length);else if(S=="fcTL"){L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height),L=0);const w={x:C(d,h+12),y:C(d,h+16),width:C(d,h+4),height:C(d,h+8)};let B=v(d,h+22);B=v(d,h+20)/(B==0?100:B);const P={rect:w,delay:Math.round(1e3*B),dispose:d[h+24],blend:d[h+25]};b.frames.push(P)}else if(S=="fdAT"){for(j=0;j<z-4;j++)A[L+j]=d[h+j+4];L+=z-4}else if(S=="pHYs")b.tabs[S]=[g.readUint(d,h),g.readUint(d,h+4),d[h+8]];else if(S=="cHRM")for(b.tabs[S]=[],j=0;j<8;j++)b.tabs[S].push(g.readUint(d,h+4*j));else if(S=="tEXt"||S=="zTXt"){b.tabs[S]==null&&(b.tabs[S]={});var y=g.nextZero(d,h),T=g.readASCII(d,h,y-h),M=h+z-y-1;if(S=="tEXt")F=g.readASCII(d,y+1,M);else{var O=o(d.slice(y+2,y+2+M));F=g.readUTF8(O,0,O.length)}b.tabs[S][T]=F}else if(S=="iTXt"){b.tabs[S]==null&&(b.tabs[S]={}),y=0,x=h,y=g.nextZero(d,x),T=g.readASCII(d,x,y-x);const w=d[x=y+1];var F;d[x+1],x+=2,y=g.nextZero(d,x),g.readASCII(d,x,y-x),x=y+1,y=g.nextZero(d,x),g.readUTF8(d,x,y-x),M=z-((x=y+1)-h),w==0?F=g.readUTF8(d,x,M):(O=o(d.slice(x,x+M)),F=g.readUTF8(O,0,O.length)),b.tabs[S][T]=F}else if(S=="PLTE")b.tabs[S]=g.readBytes(d,h,z);else if(S=="hIST"){const w=b.tabs.PLTE.length/3;for(b.tabs[S]=[],j=0;j<w;j++)b.tabs[S].push(v(d,h+2*j))}else if(S=="tRNS")b.ctype==3?b.tabs[S]=g.readBytes(d,h,z):b.ctype==0?b.tabs[S]=v(d,h):b.ctype==2&&(b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]);else if(S=="gAMA")b.tabs[S]=g.readUint(d,h)/1e5;else if(S=="sRGB")b.tabs[S]=d[h];else if(S=="bKGD")b.ctype==0||b.ctype==4?b.tabs[S]=[v(d,h)]:b.ctype==2||b.ctype==6?b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]:b.ctype==3&&(b.tabs[S]=d[h]);else if(S=="IEND")break;h+=z,g.readUint(d,h),h+=4}var I;return L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height)),b.data=n(b,_,b.width,b.height),delete b.compress,delete b.interlace,delete b.filter,b},toRGBA8:function(c){const d=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,d,h,c).buffer];const g=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const v=d*h*4,C=new Uint8Array(v),b=new Uint8Array(v),_=new Uint8Array(v);for(let E=0;E<c.frames.length;E++){const L=c.frames[E],k=L.rect.x,j=L.rect.y,x=L.rect.width,y=L.rect.height,T=t(L.data,x,y,c);if(E!=0)for(var A=0;A<v;A++)_[A]=C[A];if(L.blend==0?f(T,x,y,C,d,h,k,j,0):L.blend==1&&f(T,x,y,C,d,h,k,j,1),g.push(C.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)f(b,x,y,C,d,h,k,j,0);else if(L.dispose==2)for(A=0;A<v;A++)C[A]=_[A]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Le,{_bin:t}=Le,n=Le._paeth;var o={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let T=y;for(let M=0;M<8;M++)1&T?T=3988292384^T>>>1:T>>>=1;x[y]=T}return x})(),update(x,y,T,M){for(let O=0;O<M;O++)x=o.table[255&(x^y[T+O])]^x>>>8;return x},crc:(x,y,T)=>4294967295^o.update(4294967295,x,y,T)};function r(x,y,T,M){y[T]+=x[0]*M>>4,y[T+1]+=x[1]*M>>4,y[T+2]+=x[2]*M>>4,y[T+3]+=x[3]*M>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,y){const T=x[0]-y[0],M=x[1]-y[1],O=x[2]-y[2],F=x[3]-y[3];return T*T+M*M+O*O+F*F}function i(x,y,T,M,O,F,I){I==null&&(I=1);const z=M.length,S=[];for(var w=0;w<z;w++){const R=M[w];S.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(w=0;w<z;w++){let R=4294967295;for(var B=0,P=0;P<z;P++){var U=a(S[w],S[P]);P!=w&&U<R&&(R=U,B=P)}}const q=new Uint32Array(O.buffer),N=new Int16Array(y*T*4),D=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(w=0;w<D.length;w++)D[w]=255*((D[w]+.5)/16-.5);for(let R=0;R<T;R++)for(let H=0;H<y;H++){var $;w=4*(R*y+H),I!=2?$=[s(x[w]+N[w]),s(x[w+1]+N[w+1]),s(x[w+2]+N[w+2]),s(x[w+3]+N[w+3])]:(U=D[4*(3&R)+(3&H)],$=[s(x[w]+U),s(x[w+1]+U),s(x[w+2]+U),s(x[w+3]+U)]),B=0;let V=16777215;for(P=0;P<z;P++){const ne=a($,S[P]);ne<V&&(V=ne,B=P)}const K=S[B],G=[$[0]-K[0],$[1]-K[1],$[2]-K[2],$[3]-K[3]];I==1&&(H!=y-1&&r(G,N,w+4,7),R!=T-1&&(H!=0&&r(G,N,w+4*y-4,3),r(G,N,w+4*y,5),H!=y-1&&r(G,N,w+4*y+4,1))),F[w>>2]=B,q[w>>2]=M[B]}}function m(x,y,T,M,O){O==null&&(O={});const{crc:F}=o,I=t.writeUint,z=t.writeUshort,S=t.writeASCII;let w=8;const B=x.frames.length>1;let P,U=!1,q=33+(B?20:0);if(O.sRGB!=null&&(q+=13),O.pHYs!=null&&(q+=21),O.iCCP!=null&&(P=pako.deflate(O.iCCP),q+=21+P.length+4),x.ctype==3){for(var N=x.plte.length,D=0;D<N;D++)x.plte[D]>>>24!=255&&(U=!0);q+=8+3*N+4+(U?8+1*N+4:0)}for(var $=0;$<x.frames.length;$++)B&&(q+=38),q+=(K=x.frames[$]).cimg.length+12,$!=0&&(q+=4);q+=12;const R=new Uint8Array(q),H=[137,80,78,71,13,10,26,10];for(D=0;D<8;D++)R[D]=H[D];if(I(R,w,13),w+=4,S(R,w,"IHDR"),w+=4,I(R,w,y),w+=4,I(R,w,T),w+=4,R[w]=x.depth,w++,R[w]=x.ctype,w++,R[w]=0,w++,R[w]=0,w++,R[w]=0,w++,I(R,w,F(R,w-17,17)),w+=4,O.sRGB!=null&&(I(R,w,1),w+=4,S(R,w,"sRGB"),w+=4,R[w]=O.sRGB,w++,I(R,w,F(R,w-5,5)),w+=4),O.iCCP!=null){const G=13+P.length;I(R,w,G),w+=4,S(R,w,"iCCP"),w+=4,S(R,w,"ICC profile"),w+=11,w+=2,R.set(P,w),w+=P.length,I(R,w,F(R,w-(G+4),G+4)),w+=4}if(O.pHYs!=null&&(I(R,w,9),w+=4,S(R,w,"pHYs"),w+=4,I(R,w,O.pHYs[0]),w+=4,I(R,w,O.pHYs[1]),w+=4,R[w]=O.pHYs[2],w++,I(R,w,F(R,w-13,13)),w+=4),B&&(I(R,w,8),w+=4,S(R,w,"acTL"),w+=4,I(R,w,x.frames.length),w+=4,I(R,w,O.loop!=null?O.loop:0),w+=4,I(R,w,F(R,w-12,12)),w+=4),x.ctype==3){for(I(R,w,3*(N=x.plte.length)),w+=4,S(R,w,"PLTE"),w+=4,D=0;D<N;D++){const G=3*D,ne=x.plte[D],Z=255&ne,re=ne>>>8&255,ue=ne>>>16&255;R[w+G+0]=Z,R[w+G+1]=re,R[w+G+2]=ue}if(w+=3*N,I(R,w,F(R,w-3*N-4,3*N+4)),w+=4,U){for(I(R,w,N),w+=4,S(R,w,"tRNS"),w+=4,D=0;D<N;D++)R[w+D]=x.plte[D]>>>24&255;w+=N,I(R,w,F(R,w-N-4,N+4)),w+=4}}let V=0;for($=0;$<x.frames.length;$++){var K=x.frames[$];B&&(I(R,w,26),w+=4,S(R,w,"fcTL"),w+=4,I(R,w,V++),w+=4,I(R,w,K.rect.width),w+=4,I(R,w,K.rect.height),w+=4,I(R,w,K.rect.x),w+=4,I(R,w,K.rect.y),w+=4,z(R,w,M[$]),w+=2,z(R,w,1e3),w+=2,R[w]=K.dispose,w++,R[w]=K.blend,w++,I(R,w,F(R,w-30,30)),w+=4);const G=K.cimg;I(R,w,(N=G.length)+($==0?0:4)),w+=4;const ne=w;S(R,w,$==0?"IDAT":"fdAT"),w+=4,$!=0&&(I(R,w,V++),w+=4),R.set(G,w),w+=N,I(R,w,F(R,ne,w-ne)),w+=4}return I(R,w,0),w+=4,S(R,w,"IEND"),w+=4,I(R,w,F(R,w-4,4)),w+=4,R.buffer}function f(x,y,T){for(let M=0;M<x.frames.length;M++){const O=x.frames[M];O.rect.width;const F=O.rect.height,I=new Uint8Array(F*O.bpl+F);O.cimg=h(O.img,F,O.bpp,O.bpl,I,y,T)}}function l(x,y,T,M,O){const F=O[0],I=O[1],z=O[2],S=O[3],w=O[4],B=O[5];let P=6,U=8,q=255;for(var N=0;N<x.length;N++){const ye=new Uint8Array(x[N]);for(var D=ye.length,$=0;$<D;$+=4)q&=ye[$+3]}const R=q!=255,H=(function(fe,ie,ge,we,me,_e){const Ce=[];for(var pe=0;pe<fe.length;pe++){const J=new Uint8Array(fe[pe]),ce=new Uint32Array(J.buffer);var Te;let Se=0,le=0,xe=ie,Xe=ge,Mt=we?1:0;if(pe!=0){const lc=_e||we||pe==1||Ce[pe-2].dispose!=0?1:2;let dr=0,Uo=1e9;for(let Zt=0;Zt<lc;Zt++){var Be=new Uint8Array(fe[pe-1-Zt]);const cc=new Uint32Array(fe[pe-1-Zt]);let ot=ie,st=ge,Pt=-1,Jt=-1;for(let vt=0;vt<ge;vt++)for(let bt=0;bt<ie;bt++)ce[W=vt*ie+bt]!=cc[W]&&(bt<ot&&(ot=bt),bt>Pt&&(Pt=bt),vt<st&&(st=vt),vt>Jt&&(Jt=vt));Pt==-1&&(ot=st=Pt=Jt=0),me&&((1&ot)==1&&ot--,(1&st)==1&&st--);const zo=(Pt-ot+1)*(Jt-st+1);zo<Uo&&(Uo=zo,dr=Zt,Se=ot,le=st,xe=Pt-ot+1,Xe=Jt-st+1)}Be=new Uint8Array(fe[pe-1-dr]),dr==1&&(Ce[pe-1].dispose=2),Te=new Uint8Array(xe*Xe*4),e(Be,ie,ge,Te,xe,Xe,-Se,-le,0),Mt=e(J,ie,ge,Te,xe,Xe,-Se,-le,3)?1:0,Mt==1?d(J,ie,ge,Te,{x:Se,y:le,width:xe,height:Xe}):e(J,ie,ge,Te,xe,Xe,-Se,-le,0)}else Te=J.slice(0);Ce.push({rect:{x:Se,y:le,width:xe,height:Xe},img:Te,blend:Mt,dispose:0})}if(we)for(pe=0;pe<Ce.length;pe++){if((Y=Ce[pe]).blend==1)continue;const J=Y.rect,ce=Ce[pe-1].rect,Se=Math.min(J.x,ce.x),le=Math.min(J.y,ce.y),xe={x:Se,y:le,width:Math.max(J.x+J.width,ce.x+ce.width)-Se,height:Math.max(J.y+J.height,ce.y+ce.height)-le};Ce[pe-1].dispose=1,pe-1!=0&&c(fe,ie,ge,Ce,pe-1,xe,me),c(fe,ie,ge,Ce,pe,xe,me)}let xt=0;if(fe.length!=1)for(var W=0;W<Ce.length;W++){var Y;xt+=(Y=Ce[W]).rect.width*Y.rect.height}return Ce})(x,y,T,F,I,z),V={},K=[],G=[];if(M!=0){const ye=[];for($=0;$<H.length;$++)ye.push(H[$].img.buffer);const fe=(function(me){let _e=0;for(var Ce=0;Ce<me.length;Ce++)_e+=me[Ce].byteLength;const pe=new Uint8Array(_e);let Te=0;for(Ce=0;Ce<me.length;Ce++){const Be=new Uint8Array(me[Ce]),xt=Be.length;for(let W=0;W<xt;W+=4){let Y=Be[W],J=Be[W+1],ce=Be[W+2];const Se=Be[W+3];Se==0&&(Y=J=ce=0),pe[Te+W]=Y,pe[Te+W+1]=J,pe[Te+W+2]=ce,pe[Te+W+3]=Se}Te+=xt}return pe.buffer})(ye),ie=v(fe,M);for($=0;$<ie.plte.length;$++)K.push(ie.plte[$].est.rgba);let ge=0;for($=0;$<H.length;$++){const we=(Z=H[$]).img.length;var ne=new Uint8Array(ie.inds.buffer,ge>>2,we>>2);G.push(ne);const me=new Uint8Array(ie.abuf,ge,we);B&&i(Z.img,Z.rect.width,Z.rect.height,K,me,ne),Z.img.set(me),ge+=we}}else for(N=0;N<H.length;N++){var Z=H[N];const ye=new Uint32Array(Z.img.buffer);var re=Z.rect.width;for(D=ye.length,ne=new Uint8Array(D),G.push(ne),$=0;$<D;$++){const fe=ye[$];if($!=0&&fe==ye[$-1])ne[$]=ne[$-1];else if($>re&&fe==ye[$-re])ne[$]=ne[$-re];else{let ie=V[fe];if(ie==null&&(V[fe]=ie=K.length,K.push(fe),K.length>=300))break;ne[$]=ie}}}const ue=K.length;for(ue<=256&&w==0&&(U=ue<=2?1:ue<=4?2:ue<=16?4:8,U=Math.max(U,S)),N=0;N<H.length;N++){(Z=H[N]).rect.x,Z.rect.y,re=Z.rect.width;const ye=Z.rect.height;let fe=Z.img;new Uint32Array(fe.buffer);let ie=4*re,ge=4;if(ue<=256&&w==0){ie=Math.ceil(U*re/8);var be=new Uint8Array(ie*ye);const we=G[N];for(let me=0;me<ye;me++){$=me*ie;const _e=me*re;if(U==8)for(var de=0;de<re;de++)be[$+de]=we[_e+de];else if(U==4)for(de=0;de<re;de++)be[$+(de>>1)]|=we[_e+de]<<4-4*(1&de);else if(U==2)for(de=0;de<re;de++)be[$+(de>>2)]|=we[_e+de]<<6-2*(3&de);else if(U==1)for(de=0;de<re;de++)be[$+(de>>3)]|=we[_e+de]<<7-1*(7&de)}fe=be,P=3,ge=1}else if(R==0&&H.length==1){be=new Uint8Array(re*ye*3);const we=re*ye;for($=0;$<we;$++){const me=3*$,_e=4*$;be[me]=fe[_e],be[me+1]=fe[_e+1],be[me+2]=fe[_e+2]}fe=be,P=2,ge=3,ie=3*re}Z.img=fe,Z.bpl=ie,Z.bpp=ge}return{ctype:P,depth:U,plte:K,frames:H}}function c(x,y,T,M,O,F,I){const z=Uint8Array,S=Uint32Array,w=new z(x[O-1]),B=new S(x[O-1]),P=O+1<x.length?new z(x[O+1]):null,U=new z(x[O]),q=new S(U.buffer);let N=y,D=T,$=-1,R=-1;for(let V=0;V<F.height;V++)for(let K=0;K<F.width;K++){const G=F.x+K,ne=F.y+V,Z=ne*y+G,re=q[Z];re==0||M[O-1].dispose==0&&B[Z]==re&&(P==null||P[4*Z+3]!=0)||(G<N&&(N=G),G>$&&($=G),ne<D&&(D=ne),ne>R&&(R=ne))}$==-1&&(N=D=$=R=0),I&&((1&N)==1&&N--,(1&D)==1&&D--),F={x:N,y:D,width:$-N+1,height:R-D+1};const H=M[O];H.rect=F,H.blend=1,H.img=new Uint8Array(F.width*F.height*4),M[O-1].dispose==0?(e(w,y,T,H.img,F.width,F.height,-F.x,-F.y,0),d(U,y,T,H.img,F)):e(U,y,T,H.img,F.width,F.height,-F.x,-F.y,0)}function d(x,y,T,M,O){e(x,y,T,M,O.width,O.height,-O.x,-O.y,2)}function h(x,y,T,M,O,F,I){const z=[];let S,w=[0,1,2,3,4];F!=-1?w=[F]:(y*M>5e5||T==1)&&(w=[0]),I&&(S={level:0});const B=Ah;for(var P=0;P<w.length;P++){for(let N=0;N<y;N++)g(O,x,N,M,T,w[P]);z.push(B.deflate(O,S))}let U,q=1e9;for(P=0;P<z.length;P++)z[P].length<q&&(U=P,q=z[P].length);return z[U]}function g(x,y,T,M,O,F){const I=T*M;let z=I+T;if(x[z]=F,z++,F==0)if(M<500)for(var S=0;S<M;S++)x[z+S]=y[I+S];else x.set(new Uint8Array(y.buffer,I,M),z);else if(F==1){for(S=0;S<O;S++)x[z+S]=y[I+S];for(S=O;S<M;S++)x[z+S]=y[I+S]-y[I+S-O]+256&255}else if(T==0){for(S=0;S<O;S++)x[z+S]=y[I+S];if(F==2)for(S=O;S<M;S++)x[z+S]=y[I+S];if(F==3)for(S=O;S<M;S++)x[z+S]=y[I+S]-(y[I+S-O]>>1)+256&255;if(F==4)for(S=O;S<M;S++)x[z+S]=y[I+S]-n(y[I+S-O],0,0)+256&255}else{if(F==2)for(S=0;S<M;S++)x[z+S]=y[I+S]+256-y[I+S-M]&255;if(F==3){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-(y[I+S-M]>>1)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-(y[I+S-M]+y[I+S-O]>>1)&255}if(F==4){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-n(0,y[I+S-M],0)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-n(y[I+S-O],y[I+S-M],y[I+S-O-M])&255}}}function v(x,y){const T=new Uint8Array(x),M=T.slice(0),O=new Uint32Array(M.buffer),F=C(M,y),I=F[0],z=F[1],S=T.length,w=new Uint8Array(S>>2);let B;if(T.length<2e7)for(var P=0;P<S;P+=4)B=b(I,U=T[P]*(1/255),q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255)),w[P>>2]=B.ind,O[P>>2]=B.est.rgba;else for(P=0;P<S;P+=4){var U=T[P]*.00392156862745098,q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255);for(B=I;B.left;)B=_(B.est,U,q,N,D)<=0?B.left:B.right;w[P>>2]=B.ind,O[P>>2]=B.est.rgba}return{abuf:M.buffer,inds:w,plte:z}}function C(x,y,T){T==null&&(T=1e-4);const M=new Uint32Array(x.buffer),O={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};O.bst=L(x,O.i0,O.i1),O.est=k(O.bst);const F=[O];for(;F.length<y;){let z=0,S=0;for(var I=0;I<F.length;I++)F[I].est.L>z&&(z=F[I].est.L,S=I);if(z<T)break;const w=F[S],B=A(x,M,w.i0,w.i1,w.est.e,w.est.eMq255);if(w.i0>=B||w.i1<=B){w.est.L=0;continue}const P={i0:w.i0,i1:B,bst:null,est:null,tdst:0,left:null,right:null};P.bst=L(x,P.i0,P.i1),P.est=k(P.bst);const U={i0:B,i1:w.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:w.bst.N-P.bst.N},I=0;I<16;I++)U.bst.R[I]=w.bst.R[I]-P.bst.R[I];for(I=0;I<4;I++)U.bst.m[I]=w.bst.m[I]-P.bst.m[I];U.est=k(U.bst),w.left=P,w.right=U,F[S]=P,F.push(U)}for(F.sort(((z,S)=>S.bst.N-z.bst.N)),I=0;I<F.length;I++)F[I].ind=I;return[O,F]}function b(x,y,T,M,O){if(x.left==null)return x.tdst=(function(P,U,q,N,D){const $=U-P[0],R=q-P[1],H=N-P[2],V=D-P[3];return $*$+R*R+H*H+V*V})(x.est.q,y,T,M,O),x;const F=_(x.est,y,T,M,O);let I=x.left,z=x.right;F>0&&(I=x.right,z=x.left);const S=b(I,y,T,M,O);if(S.tdst<=F*F)return S;const w=b(z,y,T,M,O);return w.tdst<S.tdst?w:S}function _(x,y,T,M,O){const{e:F}=x;return F[0]*y+F[1]*T+F[2]*M+F[3]*O-x.eMq}function A(x,y,T,M,O,F){for(M-=4;T<M;){for(;E(x,T,O)<=F;)T+=4;for(;E(x,M,O)>F;)M-=4;if(T>=M)break;const I=y[T>>2];y[T>>2]=y[M>>2],y[M>>2]=I,T+=4,M-=4}for(;E(x,T,O)>F;)T-=4;return T+4}function E(x,y,T){return x[y]*T[0]+x[y+1]*T[1]+x[y+2]*T[2]+x[y+3]*T[3]}function L(x,y,T){const M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=[0,0,0,0],F=T-y>>2;for(let I=y;I<T;I+=4){const z=x[I]*.00392156862745098,S=x[I+1]*(1/255),w=x[I+2]*(1/255),B=x[I+3]*(1/255);O[0]+=z,O[1]+=S,O[2]+=w,O[3]+=B,M[0]+=z*z,M[1]+=z*S,M[2]+=z*w,M[3]+=z*B,M[5]+=S*S,M[6]+=S*w,M[7]+=S*B,M[10]+=w*w,M[11]+=w*B,M[15]+=B*B}return M[4]=M[1],M[8]=M[2],M[9]=M[6],M[12]=M[3],M[13]=M[7],M[14]=M[11],{R:M,m:O,N:F}}function k(x){const{R:y}=x,{m:T}=x,{N:M}=x,O=T[0],F=T[1],I=T[2],z=T[3],S=M==0?0:1/M,w=[y[0]-O*O*S,y[1]-O*F*S,y[2]-O*I*S,y[3]-O*z*S,y[4]-F*O*S,y[5]-F*F*S,y[6]-F*I*S,y[7]-F*z*S,y[8]-I*O*S,y[9]-I*F*S,y[10]-I*I*S,y[11]-I*z*S,y[12]-z*O*S,y[13]-z*F*S,y[14]-z*I*S,y[15]-z*z*S],B=w,P=j;let U=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,N=0;if(M!=0)for(let $=0;$<16&&(U=P.multVec(B,U),N=Math.sqrt(P.dot(U,U)),U=P.sml(1/N,U),!($!=0&&Math.abs(N-q)<1e-9));$++)q=N;const D=[O*S,F*S,I*S,z*S];return{Cov:w,q:D,e:U,L:q,eMq255:P.dot(P.sml(255,D),U),eMq:P.dot(U,D),rgba:(Math.round(255*D[3])<<24|Math.round(255*D[2])<<16|Math.round(255*D[1])<<8|Math.round(255*D[0])<<0)>>>0}}var j={multVec:(x,y)=>[x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],x[4]*y[0]+x[5]*y[1]+x[6]*y[2]+x[7]*y[3],x[8]*y[0]+x[9]*y[1]+x[10]*y[2]+x[11]*y[3],x[12]*y[0]+x[13]*y[1]+x[14]*y[2]+x[15]*y[3]],dot:(x,y)=>x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],sml:(x,y)=>[x*y[0],x*y[1],x*y[2],x*y[3]]};Le.encode=function(y,T,M,O,F,I,z){O==null&&(O=0),z==null&&(z=!1);const S=l(y,T,M,O,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,T,M,F,I)},Le.encodeLL=function(y,T,M,O,F,I,z,S){const w={ctype:0+(O==1?0:2)+(F==0?0:4),depth:I,frames:[]},B=(O+F)*I,P=B*T;for(let U=0;U<y.length;U++)w.frames.push({rect:{x:0,y:0,width:T,height:M},img:new Uint8Array(y[U]),blend:0,dispose:1,bpp:Math.ceil(B/8),bpl:Math.ceil(P/8)});return f(w,0,!0),m(w,T,M,z,S)},Le.encode.compress=l,Le.encode.dither=i,Le.quantize=v,Le.quantize.getKDtree=C,Le.quantize.getNearest=b})();const Wi={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,l=new ArrayBuffer(f),c=new DataView(l),d=1<<20;let h,g,v,C,b=d,_=0,A=0,E=0;function L(x){c.setUint16(A,x,!0),A+=2}function k(x){c.setUint32(A,x,!0),A+=4}function j(x){A+=x}L(19778),k(f),j(4),k(122),k(108),k(n),k(-o>>>0),L(1),L(32),k(3),k(m),k(2835),k(2835),j(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;_<o&&b>0;){for(C=122+_*i,h=0;h<r;)b--,g=a[E++],v=g>>>24,c.setUint32(C+h,g<<8|v),h+=4;_++}E<a.length?(b=d,setTimeout(x,Wi._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Ie={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},jh={[Ie.CHROME]:16384,[Ie.FIREFOX]:11180,[Ie.DESKTOP_SAFARI]:16384,[Ie.IE]:8192,[Ie.IOS]:4096,[Ie.ETC]:8192};const _o=typeof window<"u",Vi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Hn=_o&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Th=(_o||Vi)&&(Hn&&Hn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Gi=(_o||Vi)&&(Hn&&Hn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Ao(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 Ki(e){return new Promise(((t,n)=>{const o=new Gi;o.onload=()=>t(o.result),o.onerror=r=>n(r),o.readAsDataURL(e)}))}function qi(e){return new Promise(((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=r=>n(r),o.src=e}))}function St(){if(St.cachedResult!==void 0)return St.cachedResult;let e=Ie.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Ie.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Ie.IOS:/Safari/i.test(t)?e=Ie.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Ie.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Ie.IE),St.cachedResult=e,St.cachedResult}function Yi(e,t){const n=St(),o=jh[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 rr(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 Xi(e,t){const{width:n,height:o}=Yi(e.width,e.height),[r,s]=rr(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 Rn(){return Rn.cachedResult!==void 0||(Rn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Rn.cachedResult}function Wn(e,t={}){return new Promise((function(n,o){let r,s;var a=function(){try{return s=Xi(r,t.fileType||e.type),n([r,s])}catch(m){return o(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return o(c)}};try{let l;return Ki(e).then((function(c){try{return l=c,qi(l).then((function(d){try{return r=d,(function(){try{return a()}catch(h){return o(h)}})()}catch(h){return f(h)}}),f)}catch(d){return f(d)}}),f)}catch(l){f(l)}}catch(l){return o(l)}};try{if(Rn()||[Ie.DESKTOP_SAFARI,Ie.MOBILE_SAFARI].includes(St()))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 Vn(e,t,n,o,r=1){return new Promise((function(s,a){let i;if(t==="image/png"){let f,l,c;return f=e.getContext("2d"),{data:l}=f.getImageData(0,0,e.width,e.height),c=Le.encode([l.buffer],e.width,e.height,4096*r),i=new Blob([c],{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((l=>Wi.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=o,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:r}).then((function(c){try{return i=c,i.name=n,i.lastModified=o,l.call(this)}catch(d){return a(d)}}).bind(this),a);{let c;return c=e.toDataURL(t,r),Ao(c,n,o).then((function(d){try{return i=d,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return s(i)}}))}function Ve(e){e.width=0,e.height=0}function $t(){return new Promise((function(e,t){let n,o,r,s;return $t.cachedResult!==void 0?e($t.cachedResult):Ao("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Wn(n).then((function(i){try{return o=i[1],Vn(o,n.type,n.name,n.lastModified).then((function(m){try{return r=m,Ve(o),Wn(r).then((function(f){try{return s=f[0],$t.cachedResult=s.width===1&&s.height===2,e($t.cachedResult)}catch(l){return t(l)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function Qi(e){return new Promise(((t,n)=>{const o=new Gi;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 l=s.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(s.getUint16(i+12*c,f)==274)return t(s.getUint16(i+12*c+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 Zi(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]=rr(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),Ve(e)),a}function Ji(e,t){const{width:n}=e,{height:o}=e,[r,s]=rr(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),Ve(e),r}function Ss(e,t,n=0){return new Promise((function(o,r){let s,a,i,m,f,l,c,d,h,g,v,C,b,_,A,E,L,k,j,x;function y(M=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=M,t.onProgress(Math.min(s,100))}function T(M){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(M,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,y(),Wn(e,t).then((function(M){try{return[,m]=M,y(),f=Zi(m,t),y(),new Promise((function(O,F){var I;if(!(I=t.exifOrientation))return Qi(e).then((function(S){try{return I=S,z.call(this)}catch(w){return F(w)}}).bind(this),F);function z(){return O(I)}return z.call(this)})).then((function(O){try{return l=O,y(),$t().then((function(F){try{return c=F?f:Ji(f,l),y(),d=t.initialQuality||1,h=t.fileType||e.type,Vn(c,h,e.name,e.lastModified,d).then((function(I){try{{let S=function(){if(a--&&(A>i||A>b)){let B,P;return B=x?.95*j.width:j.width,P=x?.95*j.height:j.height,[L,k]=rr(B,P),k.drawImage(j,0,0,B,P),d*=h==="image/png"?.85:.95,Vn(L,h,e.name,e.lastModified,d).then((function(U){try{return E=U,Ve(j),j=L,A=E.size,T(Math.min(99,Math.floor((_-A)/(_-i)*100))),S}catch(q){return r(q)}}),r)}return[1]},w=function(){return Ve(j),Ve(L),Ve(f),Ve(c),Ve(m),T(100),o(E)};if(g=I,y(),v=g.size>i,C=g.size>e.size,!v&&!C)return T(100),o(g);var z;return b=e.size,_=g.size,A=_,j=c,x=!t.alwaysKeepResolution&&v,(z=(function(B){for(;B;){if(B.then)return void B.then(z,r);try{if(B.pop){if(B.length)return B.pop()?w.call(this):B;B=S}else B=B.call(this)}catch(P){return r(P)}}}).bind(this))(S)}}catch(S){return r(S)}}).bind(this),r)}catch(I){return r(I)}}).bind(this),r)}catch(F){return r(F)}}).bind(this),r)}catch(O){return r(O)}}).bind(this),r)}))}const Rh=`
208
+ let scriptImported = false
209
+ self.addEventListener('message', async (e) => {
210
+ const { file, id, imageCompressionLibUrl, options } = e.data
211
+ options.onProgress = (progress) => self.postMessage({ progress, id })
212
+ try {
213
+ if (!scriptImported) {
214
+ // console.log('[worker] importScripts', imageCompressionLibUrl)
215
+ self.importScripts(imageCompressionLibUrl)
216
+ scriptImported = true
217
+ }
218
+ // console.log('[worker] self', self)
219
+ const compressedFile = await imageCompression(file, options)
220
+ self.postMessage({ file: compressedFile, id })
221
+ } catch (e) {
222
+ // console.error('[worker] error', e)
223
+ self.postMessage({ error: e.message + '\\n' + e.stack, id })
224
+ }
225
+ })
226
+ `;let Cr;function Nh(e,t){return new Promise(((n,o)=>{Cr||(Cr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Rh));const r=new Worker(Cr);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 je(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 Th))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 Ss(e,r).then((function(h){try{return s=h,d.call(this)}catch(g){return o(g)}}).bind(this),o);var l=(function(){try{return d.call(this)}catch(h){return o(h)}}).bind(this),c=function(h){try{return Ss(e,r).then((function(g){try{return s=g,l()}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",Nh(e,r).then((function(h){try{return s=h,l()}catch{return c()}}),c)}catch{c()}function d(){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=Hi(e,s))}catch{}return n(s)}}))}je.getDataUrlFromFile=Ki,je.getFilefromDataUrl=Ao,je.loadImage=qi,je.drawImageInCanvas=Xi,je.drawFileInCanvas=Wn,je.canvasToFile=Vn,je.getExifOrientation=Qi,je.handleMaxWidthOrHeight=Zi,je.followExifOrientation=Ji,je.cleanupCanvasMemory=Ve,je.isAutoOrientationInBrowser=$t,je.approximateBelowMaximumCanvasSizeOfBrowser=Yi,je.copyExifWithoutOrientation=Hi,je.getBrowserName=St,je.version="2.0.2";var Ih=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=Ih.reduce((e,t)=>{const n=ba(`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),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Mh=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"}),Ph="VisuallyHidden",el=p.forwardRef((e,t)=>u.jsx(he.span,{...e,ref:t,style:{...Mh,...e.style}}));el.displayName=Ph;var Oh=el,[or]=nt("Tooltip",[Xt]),sr=Xt(),tl="TooltipProvider",Dh=700,Gr="tooltip.open",[Lh,jo]=or(tl),nl=e=>{const{__scopeTooltip:t,delayDuration:n=Dh,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)},[]),u.jsx(Lh,{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})};nl.displayName=tl;var ln="Tooltip",[Fh,vn]=or(ln),rl=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=jo(ln,e.__scopeTooltip),f=sr(t),[l,c]=p.useState(null),d=Re(),h=p.useRef(0),g=a??m.disableHoverableContent,v=i??m.delayDuration,C=p.useRef(!1),[b,_]=ut({prop:o,defaultProp:r??!1,onChange:j=>{j?(m.onOpen(),document.dispatchEvent(new CustomEvent(Gr))):m.onClose(),s==null||s(j)},caller:ln}),A=p.useMemo(()=>b?C.current?"delayed-open":"instant-open":"closed",[b]),E=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C.current=!1,_(!0)},[_]),L=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),k=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)},[]),u.jsx(po,{...f,children:u.jsx(Fh,{scope:t,contentId:d,open:b,stateAttribute:A,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?k():E()},[m.isOpenDelayedRef,k,E]),onTriggerLeave:p.useCallback(()=>{g?L():(window.clearTimeout(h.current),h.current=0)},[L,g]),onOpen:E,onClose:L,disableHoverableContent:g,children:n})})};rl.displayName=ln;var Kr="TooltipTrigger",ol=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=vn(Kr,n),s=jo(Kr,n),a=sr(n),i=p.useRef(null),m=ke(t,i,r.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),u.jsx(Jn,{asChild:!0,...a,children:u.jsx(he.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:m,onPointerMove:te(e.onPointerMove,d=>{d.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),l.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{r.onTriggerLeave(),l.current=!1}),onPointerDown:te(e.onPointerDown,()=>{r.open&&r.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:te(e.onFocus,()=>{f.current||r.onOpen()}),onBlur:te(e.onBlur,r.onClose),onClick:te(e.onClick,r.onClose)})})});ol.displayName=Kr;var To="TooltipPortal",[$h,Uh]=or(To,{forceMount:void 0}),sl=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=vn(To,t);return u.jsx($h,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};sl.displayName=To;var Vt="TooltipContent",al=p.forwardRef((e,t)=>{const n=Uh(Vt,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=vn(Vt,e.__scopeTooltip);return u.jsx(Oe,{present:o||a.open,children:a.disableHoverableContent?u.jsx(il,{side:r,...s,ref:t}):u.jsx(zh,{side:r,...s,ref:t})})}),zh=p.forwardRef((e,t)=>{const n=vn(Vt,e.__scopeTooltip),o=jo(Vt,e.__scopeTooltip),r=p.useRef(null),s=ke(t,r),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=r.current,{onPointerInTransitChange:c}=o,d=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,v)=>{const C=g.currentTarget,b={x:g.clientX,y:g.clientY},_=Vh(b,C.getBoundingClientRect()),A=Gh(b,_),E=Kh(v.getBoundingClientRect()),L=Yh([...A,...E]);i(L),c(!0)},[c]);return p.useEffect(()=>()=>d(),[d]),p.useEffect(()=>{if(m&&l){const g=C=>h(C,l),v=C=>h(C,m);return m.addEventListener("pointerleave",g),l.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",g),l.removeEventListener("pointerleave",v)}}},[m,l,h,d]),p.useEffect(()=>{if(a){const g=v=>{const C=v.target,b={x:v.clientX,y:v.clientY},_=(m==null?void 0:m.contains(C))||(l==null?void 0:l.contains(C)),A=!qh(b,a);_?d():A&&(d(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,d]),u.jsx(il,{...e,ref:s})}),[Bh,Hh]=or(ln,{isInside:!1}),Wh=Fd("TooltipContent"),il=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,m=vn(Vt,n),f=sr(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(Gr,l),()=>document.removeEventListener(Gr,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=d=>{const h=d.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:u.jsxs(ho,{"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:[u.jsx(Wh,{children:o}),u.jsx(Bh,{scope:n,isInside:!0,children:u.jsx(Oh,{id:m.contentId,role:"tooltip",children:r||o})})]})})});al.displayName=Vt;var ll="TooltipArrow",cl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=sr(n);return Hh(ll,n).isInside?null:u.jsx(go,{...r,...o,ref:t})});cl.displayName=ll;function Vh(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 Gh(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 Kh(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 qh(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,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function Yh(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),Xh(t)}function Xh(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 Qh=nl,Zh=rl,Jh=ol,eg=sl,tg=al,ng=cl;function rg({delayDuration:e=0,...t}){return u.jsx(Qh,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function og({...e}){return u.jsx(rg,{children:u.jsx(Zh,{"data-slot":"tooltip",...e})})}function sg({...e}){return u.jsx(Jh,{"data-slot":"tooltip-trigger",...e})}function ag({className:e,sideOffset:t=0,children:n,...o}){return u.jsx(eg,{children:u.jsxs(tg,{"data-slot":"tooltip-content",sideOffset:t,className:ee("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,u.jsx(ng,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const ig=p.lazy(()=>Ae(()=>import("./mermaid-VLURNSYL-DdTSeoZS.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));p.createContext(null);const Ro=p.memo(({className:e,children:t,...n})=>u.jsx(p.Suspense,{fallback:u.jsx("div",{className:ee("whitespace-pre-wrap break-words",e),children:t}),children:u.jsx(ig,{className:ee("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);Ro.displayName="MessageResponse";var ar="Collapsible",[lg]=nt(ar),[cg,No]=lg(ar),ul=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:a,...i}=e,[m,f]=ut({prop:o,defaultProp:r??!1,onChange:a,caller:ar});return u.jsx(cg,{scope:n,disabled:s,contentId:Re(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:u.jsx(he.div,{"data-state":Mo(m),"data-disabled":s?"":void 0,...i,ref:t})})});ul.displayName=ar;var dl="CollapsibleTrigger",fl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,r=No(dl,n);return u.jsx(he.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Mo(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:t,onClick:te(e.onClick,r.onOpenToggle)})});fl.displayName=dl;var Io="CollapsibleContent",ml=p.forwardRef((e,t)=>{const{forceMount:n,...o}=e,r=No(Io,e.__scopeCollapsible);return u.jsx(Oe,{present:n||r.open,children:({present:s})=>u.jsx(ug,{...o,ref:t,present:s})})});ml.displayName=Io;var ug=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:r,...s}=e,a=No(Io,n),[i,m]=p.useState(o),f=p.useRef(null),l=ke(t,f),c=p.useRef(0),d=c.current,h=p.useRef(0),g=h.current,v=a.open||i,C=p.useRef(v),b=p.useRef(void 0);return p.useEffect(()=>{const _=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(_)},[]),Ze(()=>{const _=f.current;if(_){b.current=b.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const A=_.getBoundingClientRect();c.current=A.height,h.current=A.width,C.current||(_.style.transitionDuration=b.current.transitionDuration,_.style.animationName=b.current.animationName),m(o)}},[a.open,o]),u.jsx(he.div,{"data-state":Mo(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:l,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&r})});function Mo(e){return e?"open":"closed"}var dg=ul;function fg({...e}){return u.jsx(dg,{"data-slot":"collapsible",...e})}function mg({...e}){return u.jsx(fl,{"data-slot":"collapsible-trigger",...e})}function pg({...e}){return u.jsx(ml,{"data-slot":"collapsible-content",...e})}const hg=({children:e,as:t="p",className:n,duration:o=2})=>{const r=pc.create(t);return u.jsx(r,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:o,ease:"easeInOut"},children:e})},gg=p.memo(hg),pl=p.createContext(null),xg=()=>{const e=p.useContext(pl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},vg=1e3,bg=1e3,hl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:o=!0,onOpenChange:r,duration:s,children:a,...i})=>{const[m,f]=ut({prop:n,defaultProp:o,onChange:r}),[l,c]=ut({prop:s,defaultProp:void 0}),[d,h]=p.useState(!1),[g,v]=p.useState(null);p.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(c(Math.ceil((Date.now()-g)/bg)),v(null))},[t,g,c]);const C=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!C&&o&&!t&&m&&!d){const _=setTimeout(()=>{f(!1),h(!0)},vg);return()=>clearTimeout(_)}},[t,m,o,f,d,C]);const b=_=>{f(_)};return u.jsx(pl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:u.jsx(fg,{className:ee("not-prose mb-4",e),onOpenChange:b,open:m,...i,children:a})})}),yg=(e,t)=>e||t===0?u.jsx(gg,{duration:1,children:"Thinking..."}):t===void 0?u.jsx("p",{children:"Thought for a few seconds"}):u.jsxs("p",{children:["Thought for ",t," seconds"]}),gl=p.memo(({className:e,children:t,getThinkingMessage:n=yg,...o})=>{const{isStreaming:r,isOpen:s,duration:a}=xg();return u.jsx(mg,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??u.jsxs(u.Fragment,{children:[u.jsx(gu,{className:"size-4"}),n(r,a),u.jsx(Kt,{className:ee("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),xl=p.memo(({className:e,children:t,...n})=>u.jsx(pg,{className:ee("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}));hl.displayName="Reasoning";gl.displayName="ReasoningTrigger";xl.displayName="ReasoningContent";const Sr=200;function wg({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>Sr+4)},[]);return p.useEffect(()=>{a()},[a,e.content]),u.jsx("div",{className:"flex justify-end",children:u.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,m)=>u.jsx(Sg,{image:i},m))}),e.attachments&&e.attachments.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((i,m)=>u.jsx(kg,{attachment:i},m))}),e.content&&u.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[u.jsx("div",{ref:s,className:ee("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&o&&`max-h-[${Sr}px]`),style:!t&&o?{maxHeight:`${Sr}px`}:void 0,children:au(e.content)}),!t&&o&&u.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:u.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:[u.jsx("span",{children:"展开"}),u.jsx(Kt,{className:"h-3 w-3"})]})})]})]})})}function Cg({entry:e,isStreaming:t}){return u.jsxs("div",{className:"flex gap-4 items-start",children:[u.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:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[u.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 u.jsxs(hl,{isStreaming:s,children:[u.jsx(gl,{}),u.jsx(xl,{children:u.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},o)}return u.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:n.text})},o)})]})]})}function Sg({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return u.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:u.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function kg({attachment:e}){const[t,n]=p.useState(!1),o=(()=>{switch(e.kind){case"text":return u.jsx(Bt,{className:"h-4 w-4"});case"table":return u.jsx(ro,{className:"h-4 w-4"});case"directory":return u.jsx(no,{className:"h-4 w-4"});default:return u.jsx(Bt,{className:"h-4 w-4"})}})(),r=e.size!=null?Eg(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return u.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[u.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:ee("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,u.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[u.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),u.jsxs("div",{className:"text-[10px] text-text-muted",children:[r&&u.jsx("span",{children:r}),r&&s!=null&&u.jsx("span",{children:" · "}),s!=null&&u.jsxs("span",{children:[s," 个文件"]})]})]}),a&&u.jsx(Kt,{className:ee("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&u.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:u.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function Eg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function _g(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function Ag(e){switch(e){case"allow_once":case"allow_always":return u.jsx(un,{className:"size-4"});case"reject_once":case"reject_always":return u.jsx(dn,{className:"size-4"});default:return null}}function jg({requestId:e,options:t,onRespond:n,className:o}){const r=s=>{n(e,s.optionId,s.kind)};return u.jsxs("div",{className:ee("p-3 border-t border-warning-border/30 bg-warning-bg/50",o),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(ma,{className:"size-4 text-warning-text"}),u.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),u.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>u.jsxs(Rt,{variant:_g(s.kind),size:"sm",onClick:()=>r(s),className:"gap-1.5",children:[Ag(s.kind),s.name]},s.optionId))})]})}const ks=1e3,Tg=1e6;function kr({filePath:e,oldString:t,newString:n,label:o}){const r=Ng(t,n),s=_s(r,"add"),a=_s(r,"remove"),i=r.length>ks?r.slice(0,ks):r,m=r.length-i.length;return u.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[u.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[11px] text-text-primary",title:e,children:e}),s>0&&u.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",s]}),a>0&&u.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),o&&u.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:o})]}),u.jsxs("div",{role:"list","aria-label":`${e} 的改动预览,${s} 行新增,${a} 行删除`,className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>u.jsx(Rg,{line:f},l)),m>0&&u.jsxs("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:["… 还有 ",m," 行未显示"]})]})]})}function Rg({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return u.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?`新增行: ${e.text}`:e.type==="remove"?`删除行: ${e.text}`:void 0,className:ee("flex px-1 leading-relaxed",e.type==="add"&&"bg-green-500/10 text-green-700 dark:text-green-300",e.type==="remove"&&"bg-red-500/10 text-red-700 dark:text-red-300",e.type==="context"&&"text-text-secondary"),children:[u.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),u.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function Es(e){return e.length===0?[]:e.split(`
227
+ `)}function _s(e,t){let n=0;for(const o of e)o.type===t&&n++;return n}function Ng(e,t){const n=Es(e),o=Es(t);let r=0;for(;r<n.length&&r<o.length&&n[r]===o[r];)r++;let s=n.length,a=o.length;for(;s>r&&a>r&&n[s-1]===o[a-1];)s--,a--;const i=[];for(let m=0;m<r;m++)i.push({type:"context",text:n[m]});Ig(n.slice(r,s),o.slice(r,a),i);for(let m=s;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function Ig(e,t,n){const o=e.length,r=t.length;if(o===0&&r===0)return;if(o*r>Tg){for(const f of e)n.push({type:"remove",text:f});for(const f of t)n.push({type:"add",text:f});return}const s=r+1,a=new Uint32Array((o+1)*s);for(let f=o-1;f>=0;f--)for(let l=r-1;l>=0;l--)a[f*s+l]=e[f]===t[l]?a[(f+1)*s+l+1]+1:Math.max(a[(f+1)*s+l],a[f*s+l+1]);let i=0,m=0;for(;i<o&&m<r;)e[i]===t[m]?(n.push({type:"context",text:e[i]}),i++,m++):a[(i+1)*s+m]>=a[i*s+m+1]?(n.push({type:"remove",text:e[i]}),i++):(n.push({type:"add",text:t[m]}),m++);for(;i<o;)n.push({type:"remove",text:e[i]}),i++;for(;m<r;)n.push({type:"add",text:t[m]}),m++}function vl({entries:e,onPermissionRespond:t}){const[n,o]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return u.jsx("div",{className:"pl-10",children:u.jsx(As,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const r=zg(e);return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[u.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:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted",n&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs text-brand font-bold font-display",children:r})]}),n&&u.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>u.jsx(As,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function As({tool:e,compact:t,onPermissionRespond:n}){const[o,r]=p.useState(!t),s=(()=>{switch(e.status){case"running":return u.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return u.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return u.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return u.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=Nn(e);return u.jsxs("div",{className:ee("px-3 py-2",t&&"py-1.5"),children:[u.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>r(!o),children:[s,u.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&u.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&u.jsx("div",{className:"mt-1.5 ml-4",children:u.jsx(jg,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),o&&u.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:$g(e)??u.jsxs(u.Fragment,{children:[e.rawInput&&Object.keys(e.rawInput).length>0&&u.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Et(JSON.stringify(e.rawInput,null,2),2e3)}),a&&u.jsx(In,{tool:e})]})})]})}const Mg=new Set(["FileEditTool","Edit","SedEdit"]),Pg=new Set(["FileWriteTool","Write"]),Og=new Set(["MultiEdit"]),Dg=new Set(["BashTool","Bash","PowerShellTool"]),Lg=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],Fg=["output","stdout","stderr","result"];function $g(e){const t=Hg(e.title),n=e.rawInput??{};if(Mg.has(t)){const o=We(n,["old_string","oldString"]),r=We(n,["new_string","newString"]);return o===void 0||r===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:We(n,["file_path","filePath"])??t,oldString:o,newString:r}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Pg.has(t)){const o=We(n,["file_path","filePath"]),r=We(n,["content"]);if(o===void 0||r===void 0)return null;const s=We(e.rawOutput??{},Lg);return u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:o,oldString:s??"",newString:r,label:s===void 0?"新文件":void 0}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Og.has(t)){const o=n.edits;if(Array.isArray(o)&&o.length>0){const r=We(n,["file_path","filePath"])??t,s=[];for(let a=0;a<o.length;a++){const i=o[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=We(m,["old_string","oldString"]),l=We(m,["new_string","newString"]);f===void 0||l===void 0||s.push(u.jsx(kr,{filePath:r,oldString:f,newString:l,label:`#${a+1}`},a))}if(s.length>0)return u.jsxs(u.Fragment,{children:[s,Nn(e)&&u.jsx(In,{tool:e})]})}return null}if(Dg.has(t)){const o=We(n,["command","cmd","script"]),r=Wg(e);return o===void 0&&r.length===0?null:u.jsx(Ug,{command:o!==void 0?Et(o,500):void 0,output:r,isError:e.status==="error"})}return null}function Ug({command:e,output:t,isError:n}){return u.jsx("div",{className:ee("rounded-md border overflow-hidden",n?"border-status-error/50":"border-border"),children:u.jsxs("div",{className:"max-h-36 overflow-auto bg-zinc-900 px-2 py-1.5 font-mono text-xs text-zinc-300",children:[e&&u.jsxs("div",{className:"whitespace-pre-wrap break-words text-zinc-500",children:["$ ",e]}),t.length>0&&u.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})]})})}function zg(e){const t=new Map;for(const o of e){const r=Bg(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 Bg(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function Hg(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function We(e,t){for(const n of t){const o=e[n];if(typeof o=="string")return o}}function Nn(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function bl(e){return!e.content||e.content.length===0?[]:e.content.filter(t=>t.type==="content").filter(t=>t.content.type==="text"&&"text"in t.content).map(t=>t.content.text)}function Wg(e){const t=bl(e);if(t.length>0)return Et(t.join(`
228
+ `),2e3);const n=e.rawOutput;if(n){for(const o of Fg){const r=n[o];if(typeof r=="string"&&r.length>0)return Et(r,2e3)}if(Object.keys(n).length>0)return Et(JSON.stringify(n,null,2),2e3)}return""}function In({tool:e}){return u.jsx("pre",{className:ee("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:Vg(e)})}function Vg(e){const t=bl(e);return t.length>0?Et(t.join(`
229
+ `),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?Et(JSON.stringify(e.rawOutput,null,2),2e3):""}function Et(e,t){return e.length>t?e.slice(0,t)+"...":e}function Gg({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 u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[u.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:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[r,"/",s]}),u.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:u.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&u.jsx("div",{className:ee("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)=>u.jsx(Kg,{entry:i},m))})]})})}function Kg({entry:e}){return u.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[u.jsx("span",{className:"flex-shrink-0 mt-0.5",children:u.jsx(qg,{status:e.status})}),u.jsx("span",{className:ee("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}),u.jsx(Yg,{priority:e.priority})]})}function qg({status:e}){switch(e){case"completed":return u.jsx(Su,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return u.jsx(ua,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return u.jsx(Eu,{className:"h-3.5 w-3.5 text-text-muted"})}}function Yg({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 u.jsx("span",{className:ee("text-[9px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function Xg({entry:e}){const t=e.variant==="error";return u.jsxs("div",{className:"w-full",children:[u.jsx("div",{className:ee("border-t-2",t?"border-status-error":"border-border")}),u.jsxs("div",{className:"pt-3",children:[u.jsx("h3",{className:ee("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&u.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),u.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:e.outputText})}),u.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
230
+ * Copyright (c) StackBlitz. All rights reserved.
231
+ * Licensed under the MIT License. See License.txt in the project root for license information.
232
+ *--------------------------------------------------------------------------------------------*/const Qg={damping:.7,stiffness:.05,mass:1.25},Zg=70,Jg=1e3/60,ex=350;let ir=!1;var Bs;(Bs=globalThis.document)==null||Bs.addEventListener("mousedown",()=>{ir=!0});var Hs;(Hs=globalThis.document)==null||Hs.addEventListener("mouseup",()=>{ir=!1});var Ws;(Ws=globalThis.document)==null||Ws.addEventListener("click",()=>{ir=!1});const tx=(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 E;if(!ir)return!1;const _=window.getSelection();if(!_||!_.rangeCount)return!1;const A=_.getRangeAt(0);return A.commonAncestorContainer.contains(C.current)||((E=C.current)==null?void 0:E.contains(A.commonAncestorContainer))},[]),f=p.useCallback(_=>{c.isAtBottom=_,r(_)},[]),l=p.useCallback(_=>{c.escapedFromLock=_,n(_)},[]),c=p.useMemo(()=>{let _;return{escapedFromLock:t,isAtBottom:o,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var A;return((A=C.current)==null?void 0:A.scrollTop)??0},set scrollTop(A){if(C.current){const{scrollBehavior:E}=getComputedStyle(C.current);E!=="auto"&&(C.current.style.scrollBehavior="auto"),C.current.scrollTop=A,c.ignoreScrollToTop=C.current.scrollTop,E!=="auto"&&(C.current.style.scrollBehavior=E)}},get targetScrollTop(){return!C.current||!b.current?0:C.current.scrollHeight-1-C.current.clientHeight},get calculatedTargetScrollTop(){if(!C.current||!b.current)return 0;const{targetScrollTop:A}=this;if(!e.targetScrollTop)return A;if((_==null?void 0:_.targetScrollTop)===A)return _.calculatedScrollTop;const E=Math.max(Math.min(e.targetScrollTop(A,{scrollElement:C.current,contentElement:b.current}),A),0);return _={targetScrollTop:A,calculatedScrollTop:E},requestAnimationFrame(()=>{_=void 0}),E},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Zg}}},[]),d=p.useCallback((_={})=>{var y;typeof _=="string"&&(_={animation:_}),_.preserveScrollPosition||f(!0);const A=Date.now()+(Number(_.wait)||0),E=_r(i.current,_.animation),{ignoreEscapes:L=!1}=_;let k,j=c.calculatedTargetScrollTop;_.duration instanceof Promise?_.duration.finally(()=>{k=Date.now()}):k=A+(_.duration??0);const x=async()=>{const T=new Promise(requestAnimationFrame).then(()=>{var I;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:M}=c,O=performance.now(),F=(O-(c.lastTick??O))/Jg;if(c.animation||(c.animation={behavior:E,promise:T,ignoreEscapes:L}),c.animation.behavior===E&&(c.lastTick=O),m()||A>Date.now())return x();if(M<Math.min(j,c.calculatedTargetScrollTop)){if(((I=c.animation)==null?void 0:I.behavior)===E){if(E==="instant")return c.scrollTop=c.calculatedTargetScrollTop,x();c.velocity=(E.damping*c.velocity+E.stiffness*c.scrollDifference)/E.mass,c.accumulated+=c.velocity*F,c.scrollTop+=c.accumulated,c.scrollTop!==M&&(c.accumulated=0)}return x()}return k>Date.now()?(j=c.calculatedTargetScrollTop,x()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?d({animation:_r(i.current,i.current.resize),ignoreEscapes:L,duration:Math.max(0,k-Date.now())||void 0}):c.isAtBottom)});return T.then(M=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),M))};return _.wait!==!0&&(c.animation=void 0),((y=c.animation)==null?void 0:y.behavior)===E?c.animation.promise:x()},[f,m,c]),h=p.useCallback(()=>{l(!0),f(!1)},[l,f]),g=p.useCallback(({target:_})=>{if(_!==C.current)return;const{scrollTop:A,ignoreScrollToTop:E}=c;let{lastScrollTop:L=A}=c;c.lastScrollTop=A,c.ignoreScrollToTop=void 0,E&&E>A&&(L=E),a(c.isNearBottom),setTimeout(()=>{var x;if(c.resizeDifference||A===E)return;if(m()){l(!0),f(!1);return}const k=A>L,j=A<L;if((x=c.animation)!=null&&x.ignoreEscapes){c.scrollTop=L;return}j&&(l(!0),f(!1)),k&&l(!1),!c.escapedFromLock&&c.isNearBottom&&f(!0)},1)},[l,f,m,c]),v=p.useCallback(({target:_,deltaY:A})=>{var L;let E=_;for(;!["scroll","auto"].includes(getComputedStyle(E).overflow);){if(!E.parentElement)return;E=E.parentElement}E===C.current&&A<0&&C.current.scrollHeight>C.current.clientHeight&&!((L=c.animation)!=null&&L.ignoreEscapes)&&(l(!0),f(!1))},[l,f,c]),C=js(_=>{var A,E;(A=C.current)==null||A.removeEventListener("scroll",g),(E=C.current)==null||E.removeEventListener("wheel",v),_==null||_.addEventListener("scroll",g,{passive:!0}),_==null||_.addEventListener("wheel",v,{passive:!0})},[]),b=js(_=>{var E,L;if((E=c.resizeObserver)==null||E.disconnect(),!_)return;let A;c.resizeObserver=new ResizeObserver(([k])=>{const{height:j}=k.contentRect,x=j-(A??j);if(c.resizeDifference=x,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),a(c.isNearBottom),x>=0){const y=_r(i.current,A?i.current.resize:i.current.initial);d({animation:y,wait:!0,preserveScrollPosition:!0,duration:y==="instant"?void 0:ex})}else c.isNearBottom&&(l(!1),f(!0));A=j,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===x&&(c.resizeDifference=0)},1)})}),(L=c.resizeObserver)==null||L.observe(_)},[]);return{contentRef:b,scrollRef:C,scrollToBottom:d,stopScroll:h,isAtBottom:o||s,isNearBottom:s,escapedFromLock:t,state:c}};function js(e,t){const n=p.useCallback(o=>(n.current=o,e(o)),t);return n}const Er=new Map;function _r(...e){const t={...Qg};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 Er.has(o)||Er.set(o,Object.freeze(t)),n?"instant":Er.get(o)}/*!---------------------------------------------------------------------------------------------
233
+ * Copyright (c) StackBlitz. All rights reserved.
234
+ * Licensed under the MIT License. See License.txt in the project root for license information.
235
+ *--------------------------------------------------------------------------------------------*/const yl=p.createContext(null),nx=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Gn({instance:e,children:t,resize:n,initial:o,mass:r,damping:s,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((L,k)=>{const j=(E==null?void 0:E.targetScrollTop)??i;return(j==null?void 0:j(L,k))??L},[i]),d=tx({mass:r,damping:s,stiffness:a,resize:n,initial:o,targetScrollTop:c}),{scrollRef:h,contentRef:g,scrollToBottom:v,stopScroll:C,isAtBottom:b,escapedFromLock:_,state:A}=e??d,E=p.useMemo(()=>({scrollToBottom:v,stopScroll:C,scrollRef:h,isAtBottom:b,escapedFromLock:_,contentRef:g,state:A,get targetScrollTop(){return l.current},set targetScrollTop(L){l.current=L}}),[v,b,g,h,C,_,A]);return p.useImperativeHandle(m,()=>E,[E]),nx(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(yl.Provider,{value:E},p.createElement("div",{...f},typeof t=="function"?t(E):t))}(function(e){function t({children:n,scrollClassName:o,...r}){const s=Po();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})(Gn||(Gn={}));function Po(){const e=p.useContext(yl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const rx=({className:e,...t})=>u.jsx(Gn,{className:ee("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),ox=({className:e,...t})=>u.jsx(Gn.Content,{className:ee("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}),sx=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:o,children:r,...s})=>u.jsx("div",{className:ee("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:r??u.jsxs(u.Fragment,{children:[o&&u.jsx("div",{className:"text-text-muted",children:o}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&u.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),ax=({className:e,...t})=>{const{scrollToBottom:n}=Po(),o=p.useCallback(()=>{n()},[n]);return u.jsx(Rt,{className:ee("rounded-full",e),onClick:o,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:u.jsx(pu,{className:"size-4"})})},ix="data-last-user-message",lx=({className:e,...t})=>{const n=p.useCallback(()=>{const o=document.querySelector(`[${ix}="true"]`);o&&o.scrollIntoView({behavior:"smooth",block:"start"})},[]);return u.jsx(Rt,{className:ee("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:u.jsx(ha,{className:"size-4"})})},cx=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:o}=Po();return o?null:u.jsxs("div",{className:ee("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&u.jsx(lx,{}),u.jsx(ax,{})]})};function ux({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:o="开始对话",emptyDescription:r="输入消息开始聊天"}){var m;const s=mx(e),a=e.length>0,i=t&&e.length>0&&((m=e[e.length-1])==null?void 0:m.type)==="user_message";return u.jsx(rx,{className:"flex-1",children:u.jsxs(ox,{children:[a?u.jsxs(u.Fragment,{children:[s.map((f,l)=>f.type==="single"?u.jsx("div",{className:ee(dx(e,l)),children:u.jsx(fx,{entry:f.entry,isLoading:t,onPermissionRespond:n})},`entry-${l}`):u.jsx("div",{className:"-mt-2",children:u.jsx(vl,{entries:f.entries,onPermissionRespond:n})},`group-${l}`)),i&&u.jsxs("div",{className:"flex gap-4 items-start",children:[u.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsx("div",{className:"flex items-center gap-1 pt-2",children:u.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[u.jsx("span",{}),u.jsx("span",{}),u.jsx("span",{})]})})]})]}):u.jsx(sx,{title:o,description:r}),u.jsx(cx,{hasUserMessages:e.some(f=>f.type==="user_message")})]})})}function dx(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 fx({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return u.jsx(wg,{entry:e});case"assistant_message":return u.jsx(Cg,{entry:e,isStreaming:t});case"tool_call":return u.jsx(vl,{entries:[e],onPermissionRespond:n});case"plan":return u.jsx(Gg,{entry:e});case"command_output":return u.jsx(Xg,{entry:e});default:return null}}function mx(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 px(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function hx({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=>px(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{s.current&&!s.current.contains(l.target)&&o()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),p.useEffect(()=>{const f=l=>{if(m.length!==0){if(l.key==="ArrowDown")l.preventDefault(),i(c=>(c+1)%m.length);else if(l.key==="ArrowUp")l.preventDefault(),i(c=>(c-1+m.length)%m.length);else if(l.key==="Enter"&&!l.shiftKey){l.preventDefault();const c=m[a];c&&n(c)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=s.current;if(!f)return;const l=f.querySelector("[data-active='true']");l==null||l.scrollIntoView({block:"nearest"})},[a]),u.jsx("div",{ref:s,className:ee("rounded-xl border border-border bg-surface-2 shadow-lg",r),children:u.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?u.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:"没有匹配的命令"}):m.map((f,l)=>{var c;return u.jsxs("button",{type:"button","data-active":l===a,onClick:()=>n(f),onMouseEnter:()=>i(l),className:ee("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",l===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[u.jsxs("span",{className:"text-sm font-display font-medium text-brand",children:["/",f.name]}),u.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((c=f.input)==null?void 0:c.hint)&&u.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function kt(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 gx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},xx=500*1024,wl=2*1024*1024,Ar=200,Ts=5*1024*1024,vx=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"]),bx=new Set([".csv",".tsv",".xlsx",".xls"]);function cn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Cl(e){if(e.type.startsWith("text/"))return!0;const t=cn(e.name);return vx.has(t)}function qr(e){const t=cn(e.name);return bx.has(t)}function yx({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:o=!1,placeholder:r="给 Saluzi 发送消息…",supportsAttachments:s,supportsImages:a,commands:i,onCycleMode:m,queueWhileLoading:f,queuedCount:l,onDequeue:c,onSearchFiles:d,className:h}){const g=s??a??!1,[v,C]=p.useState(""),[b,_]=p.useState([]),[A,E]=p.useState([]),[L,k]=p.useState(!1),[j,x]=p.useState(""),[y,T]=p.useState(!1),[M,O]=p.useState(!1),[F,I]=p.useState(!1),[z,S]=p.useState(null),[w,B]=p.useState([]),[P,U]=p.useState(0),q=p.useRef(0),N=p.useRef(null),D=p.useRef(null),$=p.useRef(null),R=p.useRef(null),H=p.useRef(null),V=p.useRef(null),K=p.useRef(null);p.useEffect(()=>{kt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:g,commandsCount:(i==null?void 0:i.length)??0})},[g,i]),p.useEffect(()=>{if(!M)return;const W=Y=>{var le,xe;const J=Y.target,ce=(le=V.current)==null?void 0:le.contains(J),Se=(xe=K.current)==null?void 0:xe.contains(J);!ce&&!Se&&O(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[M]);const G=p.useCallback(W=>{const Y=(W??v).trim(),J=b.length>0||A.length>0;!Y&&!J||o||F||(e({text:Y,images:b.length>0?b:void 0,attachments:A.length>0?A:void 0}),C(""),_([]),E([]),k(!1),x(""),N.current&&(N.current.style.height="auto"))},[v,b,A,o,F,e]),ne=p.useCallback(async W=>{if(!d)return;const Y=++q.current;try{const J=await d(W);q.current===Y&&B(J.slice(0,8))}catch{q.current===Y&&B([])}},[d]),Z=p.useCallback(W=>{const Y=N.current;if(!Y||z===null)return;const J=Y.selectionStart??v.length,ce=v.slice(0,J),Se=/(?:^|\s)@([^\s@]*)$/.exec(ce);if(!Se)return;const le=J-Se[1].length-1,xe=`@${W} `,Xe=v.slice(0,le)+xe+v.slice(J);C(Xe),S(null),B([]),requestAnimationFrame(()=>{const Mt=le+xe.length;Y.focus(),Y.setSelectionRange(Mt,Mt)})},[v,z]),re=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(z!==null&&w.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),U(J=>{const ce=W.key==="ArrowDown"?1:-1;return(J+ce+w.length)%w.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const J=w[P];J&&Z(J);return}if(W.key==="Escape"){W.preventDefault(),S(null),B([]);return}}if(L){if(W.key==="Escape"){W.preventDefault(),k(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),k(!1);return}}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():G())},[G,t,f,m,n,L,z,w,P,Z]),ue=p.useCallback(W=>{const Y=W.target.value;if(C(Y),Y.startsWith("/")&&i&&i.length>0?(k(!0),x(Y.slice(1).split(/\s/)[0]||"")):L&&(k(!1),x("")),d){const ce=W.target.selectionStart??Y.length,Se=Y.slice(0,ce),le=/(?:^|\s)@([^\s@]*)$/.exec(Se);if(le){const xe=le[1]||"";S(xe),U(0),ne(xe)}else S(null),B([])}const J=W.target;J.style.height="auto",J.style.height=Math.min(J.scrollHeight,200)+"px"},[i,L,d,ne]),be=p.useCallback(async W=>{if(kt("[ChatInput] paste event",{canAttach:g,files:W.clipboardData.files.length,types:W.clipboardData.types}),!g)return;const Y=Array.from(W.clipboardData.files).filter(J=>J.type.startsWith("image/"));if(kt("[ChatInput] paste image files",{count:Y.length,types:Y.map(J=>J.type)}),Y.length!==0){W.preventDefault(),I(!0);try{const J=await jr(Y);_(ce=>[...ce,...J])}finally{I(!1)}}},[g]),de=p.useCallback(async()=>{if(!D.current)return;const W=D.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await jr(Array.from(W));_(J=>[...J,...Y])}finally{D.current.value="",I(!1)}}},[]),ye=p.useCallback(async()=>{if(!$.current)return;const W=$.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Rs(Array.from(W));E(J=>[...J,...Y])}finally{$.current.value="",I(!1)}}},[]),fe=p.useCallback(async()=>{if(!R.current)return;const W=R.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Ns(Array.from(W));E(J=>[...J,...Y])}finally{R.current.value="",I(!1)}}},[]),ie=p.useCallback(async()=>{if(!H.current)return;const W=H.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Cx(Array.from(W));Y&&E(J=>[...J,Y])}finally{H.current.value="",I(!1)}}},[]),ge=p.useCallback(W=>{_(Y=>Y.filter((J,ce)=>ce!==W))},[]),we=p.useCallback(W=>{E(Y=>Y.filter((J,ce)=>ce!==W))},[]),me=p.useCallback(W=>{var J,ce;k(!1),x("");const Y=`/${W.name}`;(J=W.input)!=null&&J.hint?(C(`${Y} `),(ce=N.current)==null||ce.focus()):G(Y)},[G]),_e=p.useCallback(W=>{g&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",y||T(!0))},[g,y]),Ce=p.useCallback(W=>{const Y=W.relatedTarget;(!Y||!W.currentTarget.contains(Y))&&T(!1)},[]),pe=p.useCallback(async W=>{if(!g)return;const Y=Array.from(W.dataTransfer.files);if(Y.length!==0){W.preventDefault(),T(!1),I(!0);try{const J=Y.filter(le=>le.type.startsWith("image/")),ce=Y.filter(le=>!le.type.startsWith("image/")&&qr(le)),Se=Y.filter(le=>!le.type.startsWith("image/")&&!qr(le)&&Cl(le));if(J.length>0){const le=await jr(J);_(xe=>[...xe,...le])}if(ce.length>0){const le=await Ns(ce);E(xe=>[...xe,...le])}if(Se.length>0){const le=await Rs(Se);E(xe=>[...xe,...le])}}finally{I(!1)}}},[g]),Te=p.useCallback(()=>{var W;L?(k(!1),x("")):(v.startsWith("/")||C("/"+v),k(!0),x(v.startsWith("/")&&v.slice(1).split(/\s/)[0]||""),(W=N.current)==null||W.focus())},[L,v]),Be=b.length+A.length,xt=(v.trim()||Be>0)&&!o&&!F;return u.jsxs("div",{className:ee("w-full max-w-3xl mx-auto px-4 sm:px-8 pb-4 pt-2",h),children:[u.jsxs("div",{className:"relative",children:[L&&i&&i.length>0&&u.jsx(hx,{commands:i,filter:j,onSelect:me,onClose:()=>{k(!1),x("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),z!==null&&w.length>0&&u.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[u.jsxs("div",{className:"border-b border-border px-3 py-1.5 text-[11px] text-text-muted",children:["文件匹配 ",z?`“@${z}”`:""," — ↑↓ 选择,Enter 插入"]}),w.map((W,Y)=>u.jsxs("button",{type:"button",onMouseDown:J=>{J.preventDefault(),Z(W)},onMouseEnter:()=>U(Y),className:ee("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",Y===P?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[u.jsx(Bt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),u.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),M&&g&&u.jsxs("div",{ref:V,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:[u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=D.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:[u.jsx(Mu,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"图片"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!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:[u.jsx(Bt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"文本文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=R.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:[u.jsx(ro,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"表格文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=H.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:[u.jsx(no,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"目录"})]})]}),u.jsxs("div",{onDragOver:_e,onDragLeave:Ce,onDrop:pe,className:ee("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",y&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[b.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:b.map((W,Y)=>u.jsxs("div",{className:"relative group",children:[u.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${Y+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),u.jsx("button",{type:"button",onClick:()=>ge(Y),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 ${Y+1}`,children:"×"})]},Y))}),A.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:A.map((W,Y)=>u.jsx(wx,{attachment:W,onRemove:()=>we(Y)},Y))}),u.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[g&&u.jsxs("div",{className:"relative flex-shrink-0",children:[u.jsxs("button",{ref:K,type:"button",onClick:()=>O(W=>!W),disabled:o||F,className:ee("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",M?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[u.jsx(Yu,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Attach"})]}),u.jsx("input",{ref:D,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:de}),u.jsx("input",{ref:$,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:ye}),u.jsx("input",{ref:R,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:fe}),u.jsx("input",{ref:H,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:ie})]}),i&&i.length>0&&u.jsx("button",{type:"button",onClick:Te,className:ee("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-colors",L?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),disabled:o,title:"命令列表",children:u.jsx(cd,{className:"h-4 w-4"})}),u.jsx("textarea",{ref:N,value:v,onChange:ue,onKeyDown:re,onPaste:be,placeholder:F?"处理文件中…":r,disabled:o,rows:1,className:ee("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")}),u.jsx("button",{type:"button",onClick:t?n:()=>G(),disabled:!t&&!xt,className:ee("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":xt?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?u.jsx(dd,{className:"h-3.5 w-3.5",fill:"currentColor"}):F?u.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):u.jsx(nd,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&u.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[11px] text-text-muted font-display",children:[u.jsx(Au,{className:"h-3 w-3"}),u.jsxs("span",{children:[l," 条消息排队中,完成后自动发送",c?"(点击取消全部)":""]}),c&&u.jsxs("button",{type:"button",onClick:()=>{for(let W=l-1;W>=0;W--)c(W)},className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:[u.jsx(dn,{className:"h-3 w-3"}),"取消"]})]}),u.jsx("div",{className:"text-center mt-1.5",children:u.jsxs("span",{className:"text-[11px] text-text-muted font-display",children:["Enter 发送,Shift+Enter 换行",d?",@ 补全文件":""]})})]})}function wx({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return u.jsx(Bt,{className:"h-3.5 w-3.5"});case"table":return u.jsx(ro,{className:"h-3.5 w-3.5"});case"directory":return u.jsx(no,{className:"h-3.5 w-3.5"});default:return u.jsx(Bt,{className:"h-3.5 w-3.5"})}})(),o=e.size!=null?zt(e.size):null,r=e.kind==="directory"&&e.files?e.files.length:null;return u.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,u.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),o&&u.jsx("span",{className:"text-text-muted text-[10px]",children:o}),r!=null&&u.jsxs("span",{className:"text-text-muted text-[10px]",children:[r," 文件"]}),u.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:u.jsx(dn,{className:"h-3 w-3"})})]})}function zt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function jr(e){const t=[];for(const n of e)try{let o=n,r=n.type;n.size>2*1024*1024&&(o=await je(n,gx),r="image/jpeg");const s=await Sx(o);t.push({mimeType:r,data:s})}catch(o){console.error("Failed to process image:",o)}return t}async function Rs(e){const t=[];for(const n of e)try{if(n.size>wl){console.warn(`Skipping ${n.name}: too large (${zt(n.size)})`);continue}n.size>xx&&console.warn(`File ${n.name} is large (${zt(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 Ns(e){const t=[];for(const n of e)try{const o=cn(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 Sl(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 Sl(e){const t=await Ae(()=>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}
236
+
237
+ ${a}`):o.push(a)}return o.join(`
238
+
239
+ `)}async function Cx(e){if(e.length===0)return null;const t=e.filter(d=>!(d.name.startsWith(".")||d.size>wl));t.length>Ar&&console.warn(`Directory has ${t.length} files, truncating to ${Ar}`);const n=t.slice(0,Ar);let o=0;for(const d of n)o+=d.size;o>Ts&&console.warn(`Directory total size ${zt(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((d,h)=>{const g=d.webkitRelativePath||d.name,v=h.webkitRelativePath||h.name;return g.localeCompare(v)});for(const d of f){const h=d.webkitRelativePath||d.name;if(a.push(h),Cl(d)||qr(d))if(m+d.size<=Ts)try{let g;if(cn(d.name)===".xlsx"||cn(d.name)===".xls"){const v=await d.arrayBuffer();g=await Sl(v)}else g=await d.text();i.push(`
240
+ ### ${h}
241
+ \`\`\`
242
+ ${g}
243
+ \`\`\``),m+=d.size}catch{i.push(`
244
+ ### ${h}
245
+ (读取失败)`)}else i.push(`
246
+ ### ${h}
247
+ (文件过大,已跳过)`);else d.type.startsWith("image/")?i.push(`
248
+ ### ${h}
249
+ (图片文件,${zt(d.size)})`):i.push(`
250
+ ### ${h}
251
+ (二进制文件,${zt(d.size)})`)}const l=a.join(`
252
+ `),c=[`# 目录: ${s}`,`共 ${a.length} 个文件`,"","## 文件结构","```",l,"```","","## 文件内容",...i].join(`
253
+ `);return{kind:"directory",name:s,size:o,textContent:c,files:a}}async function Sx(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 kx({requests:e,onRespond:t,className:n}){return e.length===0?null:u.jsx("div",{className:ee("w-full max-w-3xl mx-auto px-4",n),children:u.jsx("div",{className:"space-y-2",children:e.map(o=>u.jsx(Ex,{request:o,onRespond:t},o.requestId))})})}function Ex({request:e,onRespond:t}){return u.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[u.jsx(ma,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&u.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.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:[u.jsx(un,{className:"h-3.5 w-3.5"}),"允许"]}),u.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:[u.jsx(dn,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}function Is(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function Ms(e){return e<1e3?String(e):e<1e6?`${Is((e/1e3).toFixed(1))}k`:`${Is((e/1e6).toFixed(2))}M`}function Ps(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function _x({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push(Ps(e.cost)),t.push(`${Ms(e.used)} / ${Ms(e.size)} tokens`);const n=[`上下文: ${e.used.toLocaleString()} / ${e.size.toLocaleString()} tokens`];return e.cost!=null&&e.cost.amount>0&&n.push(`累计成本: ${Ps(e.cost)}`),u.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var lr="Popover",[kl]=nt(lr,[Xt]),bn=Xt(),[Ax,gt]=kl(lr),El=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!1}=e,i=bn(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,d]=ut({prop:o,defaultProp:r??!1,onChange:s,caller:lr});return u.jsx(po,{...i,children:u.jsx(Ax,{scope:t,contentId:Re(),triggerRef:m,open:c,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};El.displayName=lr;var _l="PopoverAnchor",jx=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=gt(_l,n),s=bn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=r;return p.useEffect(()=>(a(),()=>i()),[a,i]),u.jsx(Jn,{...s,...o,ref:t})});jx.displayName=_l;var Al="PopoverTrigger",jl=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=gt(Al,n),s=bn(n),a=ke(t,r.triggerRef),i=u.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Ml(r.open),...o,ref:a,onClick:te(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?i:u.jsx(Jn,{asChild:!0,...s,children:i})});jl.displayName=Al;var Oo="PopoverPortal",[Tx,Rx]=kl(Oo,{forceMount:void 0}),Tl=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,s=gt(Oo,t);return u.jsx(Tx,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};Tl.displayName=Oo;var Gt="PopoverContent",Rl=p.forwardRef((e,t)=>{const n=Rx(Gt,e.__scopePopover),{forceMount:o=n.forceMount,...r}=e,s=gt(Gt,e.__scopePopover);return u.jsx(Oe,{present:o||s.open,children:s.modal?u.jsx(Ix,{...r,ref:t}):u.jsx(Mx,{...r,ref:t})})});Rl.displayName=Gt;var Nx=Ht("PopoverContent.RemoveScroll"),Ix=p.forwardRef((e,t)=>{const n=gt(Gt,e.__scopePopover),o=p.useRef(null),r=ke(t,o),s=p.useRef(!1);return p.useEffect(()=>{const a=o.current;if(a)return xo(a)},[]),u.jsx(Jr,{as:Nx,allowPinchZoom:!0,children:u.jsx(Nl,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:te(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:te(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Mx=p.forwardRef((e,t)=>{const n=gt(Gt,e.__scopePopover),o=p.useRef(!1),r=p.useRef(!1);return u.jsx(Nl,{...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()}})}),Nl=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:l,...c}=e,d=gt(Gt,n),h=bn(n);return oo(),u.jsx(qn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:l,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>d.onOpenChange(!1),children:u.jsx(ho,{"data-state":Ml(d.open),role:"dialog",id:d.contentId,...h,...c,ref:t,style:{...c.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)"}})})})}),Il="PopoverClose",Px=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=gt(Il,n);return u.jsx(he.button,{type:"button",...o,ref:t,onClick:te(e.onClick,()=>r.onOpenChange(!1))})});Px.displayName=Il;var Ox="PopoverArrow",Dx=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=bn(n);return u.jsx(go,{...r,...o,ref:t})});Dx.displayName=Ox;function Ml(e){return e?"open":"closed"}var Lx=El,Fx=jl,$x=Tl,Ux=Rl;function Pl({...e}){return u.jsx(Lx,{"data-slot":"popover",...e})}function Ol({...e}){return u.jsx(Fx,{"data-slot":"popover-trigger",...e})}function Dl({className:e,align:t="center",sideOffset:n=4,...o}){return u.jsx($x,{children:u.jsx(Ux,{"data-slot":"popover-content",align:t,sideOffset:n,className:ee("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 Os=1,zx=.9,Bx=.8,Hx=.17,Tr=.1,Rr=.999,Wx=.9999,Vx=.99,Gx=/[\\\/_+.#"@\[\(\{&]/,Kx=/[\\\/_+.#"@\[\(\{&]/g,qx=/[\s-]/,Ll=/[\s-]/g;function Yr(e,t,n,o,r,s,a){if(s===t.length)return r===e.length?Os:Vx;var i=`${r},${s}`;if(a[i]!==void 0)return a[i];for(var m=o.charAt(s),f=n.indexOf(m,r),l=0,c,d,h,g;f>=0;)c=Yr(e,t,n,o,f+1,s+1,a),c>l&&(f===r?c*=Os:Gx.test(e.charAt(f-1))?(c*=Bx,h=e.slice(r,f-1).match(Kx),h&&r>0&&(c*=Math.pow(Rr,h.length))):qx.test(e.charAt(f-1))?(c*=zx,g=e.slice(r,f-1).match(Ll),g&&r>0&&(c*=Math.pow(Rr,g.length))):(c*=Hx,r>0&&(c*=Math.pow(Rr,f-r))),e.charAt(f)!==t.charAt(s)&&(c*=Wx)),(c<Tr&&n.charAt(f-1)===o.charAt(s+1)||o.charAt(s+1)===o.charAt(s)&&n.charAt(f-1)!==o.charAt(s))&&(d=Yr(e,t,n,o,f+1,s+2,a),d*Tr>c&&(c=d*Tr)),c>l&&(l=c),f=n.indexOf(m,f+1);return a[i]=l,l}function Ds(e){return e.toLowerCase().replace(Ll," ")}function Yx(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Yr(e,t,Ds(e),Ds(t),0,0,{})}var cr="Dialog",[Fl]=nt(cr),[Xx,ze]=Fl(cr),$l=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,l]=ut({prop:o,defaultProp:r??!1,onChange:s,caller:cr});return u.jsx(Xx,{scope:t,triggerRef:i,contentRef:m,contentId:Re(),titleId:Re(),descriptionId:Re(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};$l.displayName=cr;var Ul="DialogTrigger",Qx=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(Ul,n),s=ke(t,r.triggerRef);return u.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Fo(r.open),...o,ref:s,onClick:te(e.onClick,r.onOpenToggle)})});Qx.displayName=Ul;var Do="DialogPortal",[Zx,zl]=Fl(Do,{forceMount:void 0}),Bl=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,s=ze(Do,t);return u.jsx(Zx,{scope:t,forceMount:n,children:p.Children.map(o,a=>u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:a})}))})};Bl.displayName=Do;var Kn="DialogOverlay",Hl=p.forwardRef((e,t)=>{const n=zl(Kn,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=ze(Kn,e.__scopeDialog);return s.modal?u.jsx(Oe,{present:o||s.open,children:u.jsx(ev,{...r,ref:t})}):null});Hl.displayName=Kn;var Jx=Ht("DialogOverlay.RemoveScroll"),ev=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(Kn,n);return u.jsx(Jr,{as:Jx,allowPinchZoom:!0,shards:[r.contentRef],children:u.jsx(he.div,{"data-state":Fo(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),At="DialogContent",Wl=p.forwardRef((e,t)=>{const n=zl(At,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=ze(At,e.__scopeDialog);return u.jsx(Oe,{present:o||s.open,children:s.modal?u.jsx(tv,{...r,ref:t}):u.jsx(nv,{...r,ref:t})})});Wl.displayName=At;var tv=p.forwardRef((e,t)=>{const n=ze(At,e.__scopeDialog),o=p.useRef(null),r=ke(t,n.contentRef,o);return p.useEffect(()=>{const s=o.current;if(s)return xo(s)},[]),u.jsx(Vl,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault())})}),nv=p.forwardRef((e,t)=>{const n=ze(At,e.__scopeDialog),o=p.useRef(!1),r=p.useRef(!1);return u.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{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,i=ze(At,n),m=p.useRef(null),f=ke(t,m);return oo(),u.jsxs(u.Fragment,{children:[u.jsx(qn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:u.jsx(fn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Fo(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),u.jsxs(u.Fragment,{children:[u.jsx(ov,{titleId:i.titleId}),u.jsx(av,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Lo="DialogTitle",Gl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(Lo,n);return u.jsx(he.h2,{id:r.titleId,...o,ref:t})});Gl.displayName=Lo;var Kl="DialogDescription",rv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(Kl,n);return u.jsx(he.p,{id:r.descriptionId,...o,ref:t})});rv.displayName=Kl;var ql="DialogClose",Yl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(ql,n);return u.jsx(he.button,{type:"button",...o,ref:t,onClick:te(e.onClick,()=>r.onOpenChange(!1))})});Yl.displayName=ql;function Fo(e){return e?"open":"closed"}var Xl="DialogTitleWarning",[ty,Ql]=Id(Xl,{contentName:At,titleName:Lo,docsSlug:"dialog"}),ov=({titleId:e})=>{const t=Ql(Xl),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
254
+
255
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
256
+
257
+ 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},sv="DialogDescriptionWarning",av=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ql(sv).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},iv=$l,lv=Bl,cv=Hl,uv=Wl,ny=Gl,ry=Yl,nn='[cmdk-group=""]',Nr='[cmdk-group-items=""]',dv='[cmdk-group-heading=""]',Zl='[cmdk-item=""]',Ls=`${Zl}:not([aria-disabled="true"])`,Xr="cmdk-item-select",Lt="data-value",fv=(e,t,n)=>Yx(e,t,n),Jl=p.createContext(void 0),yn=()=>p.useContext(Jl),ec=p.createContext(void 0),$o=()=>p.useContext(ec),tc=p.createContext(void 0),nc=p.forwardRef((e,t)=>{let n=Ft(()=>{var N,D;return{search:"",value:(D=(N=e.value)!=null?N:e.defaultValue)!=null?D:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=Ft(()=>new Set),r=Ft(()=>new Map),s=Ft(()=>new Map),a=Ft(()=>new Set),i=rc(e),{label:m,children:f,value:l,onValueChange:c,filter:d,shouldFilter:h,loop:g,disablePointerSelection:v=!1,vimBindings:C=!0,...b}=e,_=Re(),A=Re(),E=Re(),L=p.useRef(null),k=Sv();jt(()=>{if(l!==void 0){let N=l.trim();n.current.value=N,j.emit()}},[l]),jt(()=>{k(6,F)},[]);let j=p.useMemo(()=>({subscribe:N=>(a.current.add(N),()=>a.current.delete(N)),snapshot:()=>n.current,setState:(N,D,$)=>{var R,H,V,K;if(!Object.is(n.current[N],D)){if(n.current[N]=D,N==="search")O(),T(),k(1,M);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let G=document.getElementById(E);G?G.focus():(R=document.getElementById(_))==null||R.focus()}if(k(7,()=>{var G;n.current.selectedItemId=(G=I())==null?void 0:G.id,j.emit()}),$||k(5,F),((H=i.current)==null?void 0:H.value)!==void 0){let G=D??"";(K=(V=i.current).onValueChange)==null||K.call(V,G);return}}j.emit()}},emit:()=>{a.current.forEach(N=>N())}}),[]),x=p.useMemo(()=>({value:(N,D,$)=>{var R;D!==((R=s.current.get(N))==null?void 0:R.value)&&(s.current.set(N,{value:D,keywords:$}),n.current.filtered.items.set(N,y(D,$)),k(2,()=>{T(),j.emit()}))},item:(N,D)=>(o.current.add(N),D&&(r.current.has(D)?r.current.get(D).add(N):r.current.set(D,new Set([N]))),k(3,()=>{O(),T(),n.current.value||M(),j.emit()}),()=>{s.current.delete(N),o.current.delete(N),n.current.filtered.items.delete(N);let $=I();k(4,()=>{O(),($==null?void 0:$.getAttribute("id"))===N&&M(),j.emit()})}),group:N=>(r.current.has(N)||r.current.set(N,new Set),()=>{s.current.delete(N),r.current.delete(N)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:_,inputId:E,labelId:A,listInnerRef:L}),[]);function y(N,D){var $,R;let H=(R=($=i.current)==null?void 0:$.filter)!=null?R:fv;return N?H(N,n.current.search,D):0}function T(){if(!n.current.search||i.current.shouldFilter===!1)return;let N=n.current.filtered.items,D=[];n.current.filtered.groups.forEach(R=>{let H=r.current.get(R),V=0;H.forEach(K=>{let G=N.get(K);V=Math.max(G,V)}),D.push([R,V])});let $=L.current;z().sort((R,H)=>{var V,K;let G=R.getAttribute("id"),ne=H.getAttribute("id");return((V=N.get(ne))!=null?V:0)-((K=N.get(G))!=null?K:0)}).forEach(R=>{let H=R.closest(Nr);H?H.appendChild(R.parentElement===H?R:R.closest(`${Nr} > *`)):$.appendChild(R.parentElement===$?R:R.closest(`${Nr} > *`))}),D.sort((R,H)=>H[1]-R[1]).forEach(R=>{var H;let V=(H=L.current)==null?void 0:H.querySelector(`${nn}[${Lt}="${encodeURIComponent(R[0])}"]`);V==null||V.parentElement.appendChild(V)})}function M(){let N=z().find($=>$.getAttribute("aria-disabled")!=="true"),D=N==null?void 0:N.getAttribute(Lt);j.setState("value",D||void 0)}function O(){var N,D,$,R;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let H=0;for(let V of o.current){let K=(D=(N=s.current.get(V))==null?void 0:N.value)!=null?D:"",G=(R=($=s.current.get(V))==null?void 0:$.keywords)!=null?R:[],ne=y(K,G);n.current.filtered.items.set(V,ne),ne>0&&H++}for(let[V,K]of r.current)for(let G of K)if(n.current.filtered.items.get(G)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=H}function F(){var N,D,$;let R=I();R&&(((N=R.parentElement)==null?void 0:N.firstChild)===R&&(($=(D=R.closest(nn))==null?void 0:D.querySelector(dv))==null||$.scrollIntoView({block:"nearest"})),R.scrollIntoView({block:"nearest"}))}function I(){var N;return(N=L.current)==null?void 0:N.querySelector(`${Zl}[aria-selected="true"]`)}function z(){var N;return Array.from(((N=L.current)==null?void 0:N.querySelectorAll(Ls))||[])}function S(N){let D=z()[N];D&&j.setState("value",D.getAttribute(Lt))}function w(N){var D;let $=I(),R=z(),H=R.findIndex(K=>K===$),V=R[H+N];(D=i.current)!=null&&D.loop&&(V=H+N<0?R[R.length-1]:H+N===R.length?R[0]:R[H+N]),V&&j.setState("value",V.getAttribute(Lt))}function B(N){let D=I(),$=D==null?void 0:D.closest(nn),R;for(;$&&!R;)$=N>0?wv($,nn):Cv($,nn),R=$==null?void 0:$.querySelector(Ls);R?j.setState("value",R.getAttribute(Lt)):w(N)}let P=()=>S(z().length-1),U=N=>{N.preventDefault(),N.metaKey?P():N.altKey?B(1):w(1)},q=N=>{N.preventDefault(),N.metaKey?S(0):N.altKey?B(-1):w(-1)};return p.createElement(ht.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:N=>{var D;(D=b.onKeyDown)==null||D.call(b,N);let $=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||$))switch(N.key){case"n":case"j":{C&&N.ctrlKey&&U(N);break}case"ArrowDown":{U(N);break}case"p":case"k":{C&&N.ctrlKey&&q(N);break}case"ArrowUp":{q(N);break}case"Home":{N.preventDefault(),S(0);break}case"End":{N.preventDefault(),P();break}case"Enter":{N.preventDefault();let R=I();if(R){let H=new Event(Xr);R.dispatchEvent(H)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:Ev},m),ur(e,N=>p.createElement(ec.Provider,{value:j},p.createElement(Jl.Provider,{value:x},N))))}),mv=p.forwardRef((e,t)=>{var n,o;let r=Re(),s=p.useRef(null),a=p.useContext(tc),i=yn(),m=rc(e),f=(o=(n=m.current)==null?void 0:n.forceMount)!=null?o:a==null?void 0:a.forceMount;jt(()=>{if(!f)return i.item(r,a==null?void 0:a.id)},[f]);let l=oc(r,s,[e.value,e.children,s],e.keywords),c=$o(),d=mt(k=>k.value&&k.value===l.current),h=mt(k=>f||i.filter()===!1?!0:k.search?k.filtered.items.get(r)>0:!0);p.useEffect(()=>{let k=s.current;if(!(!k||e.disabled))return k.addEventListener(Xr,g),()=>k.removeEventListener(Xr,g)},[h,e.onSelect,e.disabled]);function g(){var k,j;v(),(j=(k=m.current).onSelect)==null||j.call(k,l.current)}function v(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:C,value:b,onSelect:_,forceMount:A,keywords:E,...L}=e;return p.createElement(ht.div,{ref:qe(s,t),...L,id:r,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!d,"data-disabled":!!C,"data-selected":!!d,onPointerMove:C||i.getDisablePointerSelection()?void 0:v,onClick:C?void 0:g},e.children)}),pv=p.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:r,...s}=e,a=Re(),i=p.useRef(null),m=p.useRef(null),f=Re(),l=yn(),c=mt(h=>r||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);jt(()=>l.group(a),[]),oc(a,i,[e.value,e.heading,m]);let d=p.useMemo(()=>({id:a,forceMount:r}),[r]);return p.createElement(ht.div,{ref:qe(i,t),...s,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),ur(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(tc.Provider,{value:d},h))))}),hv=p.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,r=p.useRef(null),s=mt(a=>!a.search);return!n&&!s?null:p.createElement(ht.div,{ref:qe(r,t),...o,"cmdk-separator":"",role:"separator"})}),gv=p.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,r=e.value!=null,s=$o(),a=mt(f=>f.search),i=mt(f=>f.selectedItemId),m=yn();return p.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),p.createElement(ht.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)}})}),xv=p.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...r}=e,s=p.useRef(null),a=p.useRef(null),i=mt(f=>f.selectedItemId),m=yn();return p.useEffect(()=>{if(a.current&&s.current){let f=a.current,l=s.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=f.offsetHeight;l.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return d.observe(f),()=>{cancelAnimationFrame(c),d.unobserve(f)}}},[]),p.createElement(ht.div,{ref:qe(s,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":o,id:m.listId},ur(e,f=>p.createElement("div",{ref:qe(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),vv=p.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:r,contentClassName:s,container:a,...i}=e;return p.createElement(iv,{open:n,onOpenChange:o},p.createElement(lv,{container:a},p.createElement(cv,{"cmdk-overlay":"",className:r}),p.createElement(uv,{"aria-label":e.label,"cmdk-dialog":"",className:s},p.createElement(nc,{ref:t,...i}))))}),bv=p.forwardRef((e,t)=>mt(n=>n.filtered.count===0)?p.createElement(ht.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),yv=p.forwardRef((e,t)=>{let{progress:n,children:o,label:r="Loading...",...s}=e;return p.createElement(ht.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},ur(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),Qt=Object.assign(nc,{List:xv,Item:mv,Input:gv,Group:pv,Separator:hv,Dialog:vv,Empty:bv,Loading:yv});function wv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Cv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function rc(e){let t=p.useRef(e);return jt(()=>{t.current=e}),t}var jt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Ft(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function mt(e){let t=$o(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function oc(e,t,n,o=[]){let r=p.useRef(),s=yn();return jt(()=>{var a;let i=(()=>{var f;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(f=l.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(Lt,i),r.current=i}),r}var Sv=()=>{let[e,t]=p.useState(),n=Ft(()=>new Map);return jt(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,r)=>{n.current.set(o,r),t({})}};function kv(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ur({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(kv(t),{ref:t.ref},n(t.props.children)):n(t)}var Ev={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function _v({className:e,...t}){return u.jsx(Qt,{"data-slot":"command",className:ee("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function Av({className:e,...t}){return u.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[u.jsx(ed,{className:"size-4 shrink-0 opacity-50"}),u.jsx(Qt.Input,{"data-slot":"command-input",className:ee("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 jv({className:e,...t}){return u.jsx(Qt.List,{"data-slot":"command-list",className:ee("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Tv({...e}){return u.jsx(Qt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Rv({className:e,...t}){return u.jsx(Qt.Group,{"data-slot":"command-group",className:ee("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 Nv({className:e,...t}){return u.jsx(Qt.Item,{"data-slot":"command-item",className:ee("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 Fs(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 Iv({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(l=>Fs(s,l.name)||Fs(s,l.modelId)):e,[e,s]);return u.jsxs(_v,{shouldFilter:!1,value:i,onValueChange:m,children:[o&&u.jsx(Av,{placeholder:"Select a model…",value:s,onValueChange:a}),u.jsxs(jv,{children:[u.jsx(Tv,{children:"No models found."}),u.jsx(Rv,{children:f.map(l=>u.jsxs(Nv,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[u.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&u.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),u.jsx(un,{className:ee("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function sc(e){const[t,n]=p.useState(e.modelState),[o,r]=p.useState(!1);p.useEffect(()=>{const f=c=>{if(n(c),c&&c.availableModels.length>0){const d=localStorage.getItem("acp_model_id");d&&d!==c.currentModelId&&c.availableModels.some(h=>h.modelId===d)&&e.setSessionModel(d).catch(()=>{})}},l=c=>{n(d=>d?{...d,currentModelId:c}:null),r(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(l),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(l)}},[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(l){throw r(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:m,isLoading:o}}function Mv({client:e,onModelSelect:t}){const[n,o]=p.useState(!1),{supportsModelSelection:r,availableModels:s,currentModel:a,setModel:i,isLoading:m}=sc(e),f=r&&s.length>0,l=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,c=async d=>{try{await i(d.modelId),t==null||t(d.modelId),o(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return u.jsxs(Pl,{open:n,onOpenChange:f?o:void 0,children:[u.jsx(Ol,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?u.jsx(ua,{className:"h-3 w-3 animate-spin"}):null,u.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?u.jsx(ca,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Dl,{className:"w-72 p-0",align:"end",children:u.jsx(Iv,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function Pv(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}}function ac(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function Ov(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return ac(e)}function Dv(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!ac(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const o of n)try{const r=await o.getType("text/plain");await t.writeText(await r.text());return}catch{}throw new Error("No text/plain clipboard item available")}};try{Object.defineProperty(navigator,"clipboard",{value:t,configurable:!0,writable:!0})}catch{}}const Lv=new Set(["clear","new","help","status","model","copy"]),ic=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"}],Fv=ic.map(e=>({name:e.name,description:e.desc})),oy=[{name:"clear",description:"清空当前对话"},{name:"new",description:"新建会话"},{name:"help",description:"显示此帮助信息"},{name:"status",description:"显示会话状态"},{name:"model",description:"查看或切换模型",input:{hint:"[id]"}},{name:"copy",description:"复制最后一条助手消息"},...Fv];function $v(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 Uv(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function zv(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 ic)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(`
258
+ `)}function Bv(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(`
259
+ `)}function Hv(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(`
260
+ `)}async function Wv(e,t){var c;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||!Lv.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=zv(t.availableCommands);else if(s==="status")a=Bv({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(d){a=`切换模型失败: ${d instanceof Error?d.message:String(d)}`,i=!0}else a=Hv(t.availableModels,t.currentModel);else if(s==="copy"){const d=[...t.entries].reverse().find(v=>v.type==="assistant_message"),h=((c=d==null?void 0:d.chunks)==null?void 0:c.map(v=>v.text).join(`
261
+ `))??"";(h?await Ov(h):!0)?a=h?`已复制 ${h.length} 字符到剪贴板`:"没有可复制的助手消息":(a="复制失败:剪贴板不可用",i=!0)}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},l={type:"command_output",id:`cmd-${m}`,commandName:s,inputText:e,title:$v(s),subtitle:Uv(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const Vv={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function Gv(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 Ir=[{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 Kv({mode:e,onModeChange:t}){const[n,o]=p.useState(!1),r=Ir.find(s=>s.value===e)??Ir[0];return u.jsxs(Pl,{open:n,onOpenChange:o,children:[u.jsx(Ol,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[u.jsx(id,{className:"h-3 w-3"}),u.jsx("span",{className:"max-w-24 truncate",children:r.label}),n?u.jsx(ca,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Dl,{className:"w-64 p-1",align:"start",children:Ir.map(s=>u.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:[u.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===s.value&&u.jsx(un,{className:"h-3.5 w-3.5 text-brand"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.label}),u.jsx("div",{className:"text-xs text-text-muted",children:s.description})]})]},s.value))})]})}function $s(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function Mr(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 qv({client:e,agentId:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),l=p.useRef(null),c=p.useRef(n);c.current=n;const[d,h]=p.useState(null),g=p.useRef(null),[v,C]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[b,_]=p.useState(e.usage),[A,E]=p.useState(e.currentModeId),[L,k]=p.useState(!1),{commands:j}=Pv(e),{availableModels:x,currentModel:y,setModel:T}=sc(e);p.useEffect(()=>{l.current=m},[m]);const M=p.useCallback(()=>{o([]),s(!1),i(!1),_(null),E(null)},[]),O=t?`acp_last_session_${t}`:null,F=p.useCallback((N,D)=>{if(((D==null?void 0:D.resetEntries)??!0)&&(o([]),s(!1)),f(N),i(!0),k(e.supportsImages),O)try{localStorage.setItem(O,N)}catch{}console.log("[ChatInterface] Active session:",N,"supportsImages:",e.supportsImages)},[e,O]),I=p.useCallback(N=>{l.current&&N.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",N),o(D=>{const $=Mr(D,N.toolCall.toolCallId);if($>=0)return D.map((R,H)=>H!==$||R.type!=="tool_call"||R.toolCall.status!=="running"?R:{type:"tool_call",toolCall:{...R.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const R={type:"tool_call",toolCall:{id:N.toolCall.toolCallId,title:N.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options},isStandalonePermission:!0}};return[...D,R]}}))},[]),z=p.useCallback((N,D)=>{if(!(l.current&&N!==l.current))if(D.sessionUpdate==="agent_message_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;o(R=>{const H=R[R.length-1];if((H==null?void 0:H.type)==="assistant_message"){const K=H.chunks[H.chunks.length-1];return(K==null?void 0:K.type)==="message"?[...R.slice(0,-1),{...H,chunks:[...H.chunks.slice(0,-1),{type:"message",text:K.text+$}]}]:[...R.slice(0,-1),{...H,chunks:[...H.chunks,{type:"message",text:$}]}]}const V={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...R,V]})}else if(D.sessionUpdate==="agent_thought_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;o(R=>{const H=R[R.length-1];if((H==null?void 0:H.type)==="assistant_message"){const K=H.chunks[H.chunks.length-1];return(K==null?void 0:K.type)==="thought"?[...R.slice(0,-1),{...H,chunks:[...H.chunks.slice(0,-1),{type:"thought",text:K.text+$}]}]:[...R.slice(0,-1),{...H,chunks:[...H.chunks,{type:"thought",text:$}]}]}const V={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...R,V]})}else if(D.sessionUpdate==="user_message_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;o(R=>{const H=R[R.length-1];if((H==null?void 0:H.type)==="user_message")return[...R.slice(0,-1),{...H,content:H.content+$}];const V={type:"user_message",id:`user-${Date.now()}`,content:$};return[...R,V]})}else if(D.sessionUpdate==="tool_call"){const $={id:D.toolCallId,title:D.title,status:$s(D.status),content:D.content,rawInput:D.rawInput,rawOutput:D.rawOutput};o(R=>{const H=Mr(R,D.toolCallId);if(H>=0)return R.map((K,G)=>G!==H||K.type!=="tool_call"?K:{type:"tool_call",toolCall:{...K.toolCall,...$}});const V={type:"tool_call",toolCall:$};return[...R,V]})}else D.sessionUpdate==="tool_call_update"?o($=>{const R=Mr($,D.toolCallId);if(R<0){console.warn(`[ChatInterface] Tool call not found for update: ${D.toolCallId}`);const H={type:"tool_call",toolCall:{id:D.toolCallId,title:D.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...$,H]}return $.map((H,V)=>{if(V!==R||H.type!=="tool_call")return H;const K=D.status?$s(D.status):H.toolCall.status,G=D.content?[...H.toolCall.content||[],...D.content]:H.toolCall.content;return{type:"tool_call",toolCall:{...H.toolCall,status:K,...D.title&&{title:D.title},content:G,...D.rawInput&&{rawInput:D.rawInput},...D.rawOutput&&{rawOutput:D.rawOutput}}}})}):D.sessionUpdate==="plan"?o($=>{if(D.entries.length===0)return $.filter(V=>V.type!=="plan");const R=$.reduce((V,K,G)=>K.type==="plan"?G:V,-1);if(R>=0)return $.map((V,K)=>K===R?{...V,entries:D.entries}:V);const H={type:"plan",id:`plan-${Date.now()}`,entries:D.entries};return[...$,H]}):D.sessionUpdate==="usage_update"?_(D):D.sessionUpdate==="current_mode_update"&&E(D.currentModeId)},[]);p.useEffect(()=>{e.setSessionCreatedHandler(D=>{console.log("[ChatInterface] Session created:",D),F(D)}),e.setSessionLoadedHandler(D=>{console.log("[ChatInterface] Session loaded/resumed:",D),F(D,{resetEntries:!1})}),e.setSessionSwitchingHandler(D=>{console.log("[ChatInterface] Switching to session:",D),f(D),M()}),e.setSessionUpdateHandler((D,$)=>{z(D,$)}),e.setPromptCompleteHandler(D=>{console.log("[ChatInterface] Prompt complete:",D),s(!1)}),e.setPermissionRequestHandler(I),e.setErrorMessageHandler(D=>{console.error("[ChatInterface] Agent error:",D),h(D),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const N=O?localStorage.getItem(O):null;return N&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",N),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:N}):await e.resumeSession({sessionId:N})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),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(()=>{})}},[F,e,I,z,M]);const S=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),r&&e.cancel(),M(),f(null),e.createSession(void 0,v)},[e,r,M,v]),w=()=>{console.log("[ChatInterface] Cancel requested"),o(N=>N.map(D=>D.type!=="tool_call"||!(D.toolCall.status==="running"||D.toolCall.status==="waiting_for_confirmation")?D:(console.log("[ChatInterface] Marking tool call as canceled:",D.toolCall.id),{type:"tool_call",toolCall:{...D.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},B=p.useCallback((N,D,$)=>{console.log("[ChatInterface] Permission response:",{requestId:N,optionId:D,optionKind:$}),e.respondToPermission(N,D);const R=$==="reject_once"||$==="reject_always"||D===null;o(H=>H.map(V=>{var G;if(V.type!=="tool_call"||((G=V.toolCall.permissionRequest)==null?void 0:G.requestId)!==N)return V;let K;return R?K="rejected":V.toolCall.isStandalonePermission?K="complete":K="running",{type:"tool_call",toolCall:{...V.toolCall,status:K,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),P=n.filter(N=>N.type==="tool_call"&&N.toolCall.status==="waiting_for_confirmation"&&!!N.toolCall.permissionRequest).map(N=>({requestId:N.toolCall.permissionRequest.requestId,toolName:N.toolCall.title,toolInput:N.toolCall.rawInput||{},description:N.toolCall.title,options:N.toolCall.permissionRequest.options})),U=p.useCallback((N,D)=>{const $=P.find(V=>V.requestId===N);let R=null,H=null;if($!=null&&$.options&&$.options.length>0)if(D){const V=$.options.find(K=>K.kind==="allow_once")??$.options.find(K=>K.kind==="allow_always");V&&(R=V.optionId,H=V.kind)}else{const V=$.options.find(K=>K.kind==="reject_once")??$.options.find(K=>K.kind==="reject_always");V&&(R=V.optionId,H=V.kind)}R||(H=D?"allow_once":"reject_once"),B(N,R,H)},[B,P]),q=p.useCallback(async N=>{var ne;const D=N.text.trim(),$=N.images||[],R=N.attachments||[];if(!D&&$.length===0&&R.length===0||!a)return;if(D.startsWith("/")&&$.length===0){kt("[ChatInterface] slash command input",{text:D});const Z=await Wv(D,{sessionId:m,availableCommands:j,availableModels:x,currentModel:y,supportsImages:L,entries:c.current,setModel:T,onNewSession:S}).catch(()=>null);if(Z){if(kt("[ChatInterface] local command handled",Z),"clearEntries"in Z&&Z.clearEntries){o([]);return}if("newSession"in Z&&Z.newSession){S();return}if("userEntry"in Z){o(re=>[...re,Z.userEntry,Z.cmdEntry]);return}}kt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:D})}kt("[ChatInterface] forwarding to agent",{text:D,hasImages:$.length>0,sessionReady:a,isLoading:r});const H=[];D&&H.push({type:"text",text:D});const V=[];for(const Z of $)try{const re=`data:${Z.mimeType};base64,${Z.data}`;let ue;re.startsWith("data:")?ue=Gv(re):ue=await(await fetch(re)).blob();let be=ue,de=Z.mimeType;if(ue.size>2*1024*1024){const ie=new File([ue],"image.jpg",{type:ue.type});be=await je(ie,Vv),de="image/jpeg"}const ye=await new Promise((ie,ge)=>{const we=new FileReader;we.onloadend=()=>{const me=we.result,_e=me.indexOf(",");ie(_e>=0?me.slice(_e+1):me)},we.onerror=()=>{var me;return ge(new Error("FileReader error: "+((me=we.error)==null?void 0:me.message)))},we.readAsDataURL(be)}),fe={type:"image",mimeType:de,data:ye};H.push(fe),V.push({mimeType:de,data:ye})}catch(re){console.error("[ChatInterface] Failed to process image:",re)}const K=[];for(const Z of R)try{if(Z.textContent){let re;if(Z.kind==="directory"){const ue=((ne=Z.files)==null?void 0:ne.length)??0;re=`📁 目录: ${Z.name} (${ue} 个文件)
262
+ ${Z.textContent}`}else{const ue=Z.size!=null?` (${Yv(Z.size)})`:"";re=`📎 ${Z.name}${ue}
263
+ \`\`\`
264
+ ${Z.textContent}
265
+ \`\`\``}H.push({type:"text",text:re}),K.push(Z)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(H.length===0)return;const G={type:"user_message",id:`user-${Date.now()}`,content:D,images:V.length>0?V:void 0,attachments:K.length>0?K:void 0};o(Z=>[...Z,G]),s(!0);try{await e.sendPrompt(H)}catch(Z){console.error("[ChatInterface] Failed to send prompt:",Z),s(!1)}},[r,a,e,j,x,y,L,m,T,S]);return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(ux,{entries:n,isLoading:r&&!a?!1:r,onPermissionRespond:(N,D,$)=>{B(N,D,$)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),u.jsx(kx,{requests:P,onRespond:U}),d&&u.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:u.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:[u.jsx("span",{children:d}),u.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:"×"})]})}),u.jsxs("div",{className:"flex-shrink-0",children:[u.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(Kv,{mode:A??v,onModeChange:N=>{E(null),C(N),localStorage.setItem("acp_permission_mode",N)}}),u.jsx(Mv,{client:e}),u.jsx(_x,{usage:b})]}),n.length>0&&u.jsxs(og,{children:[u.jsx(sg,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:S,children:[u.jsx(fa,{className:"h-3 w-3"}),"新会话"]})}),u.jsx(ag,{children:"New Thread"})]})]}),u.jsx(yx,{onSubmit:q,isLoading:r,onInterrupt:w,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:L,commands:j.length>0?j:void 0,queueWhileLoading:!0})]})]})}function Yv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Xv({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 u.jsxs("div",{className:"flex h-full w-full",children:[u.jsxs("div",{className:ee("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:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&u.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),u.jsxs("div",{className:ee("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&u.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:u.jsx(fa,{className:"h-4 w-4"})}),u.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?u.jsx(Ku,{className:"h-4 w-4"}):u.jsx(Vu,{className:"h-4 w-4"})})]})]}),!n&&u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Qv,{client:e,onSelectSession:r})})]}),u.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:u.jsx(qv,{client:e,agentId:t})})]})}function Qv({client:e,onSelectSession:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[d,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(y=>y.filter(T=>T.sessionId!==j.sessionId)),a===j.sessionId&&i(null)}catch(y){console.error("[SidebarSessionList] delete failed:",y)}},[e,a]),b=p.useCallback(j=>{f(j.sessionId),c(j.title&&j.title.trim()?j.title:"")},[]),_=p.useCallback(()=>{if(!m)return;const j=l.trim();if(!j){f(null);return}try{e.renameSession(m,j),o(x=>x.map(y=>y.sessionId===m?{...y,title:j}:y))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),A=p.useCallback(()=>{f(null)},[]),E=p.useCallback(j=>{j.key==="Enter"?(j.preventDefault(),_()):j.key==="Escape"&&(j.preventDefault(),A())},[_,A]),L=p.useMemo(()=>[...n].sort((j,x)=>{const y=j.updatedAt?new Date(j.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-y}),[n]);if(r&&n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const k=Zv(L);return u.jsx("nav",{className:"py-1","aria-label":"历史会话",children:k.map((j,x)=>u.jsxs("div",{children:[x>0&&u.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),u.jsx("div",{className:"px-4 py-2",children:u.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:j.label})}),j.sessions.map(y=>{const T=m===y.sessionId;return u.jsxs("div",{className:ee("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",y.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[u.jsx(Uu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),T?u.jsx("input",{ref:g,type:"text",value:l,onChange:M=>c(M.target.value),onKeyDown:E,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:M=>M.stopPropagation()}):u.jsx("button",{type:"button",onClick:()=>{i(y.sessionId),t(y)},className:"flex-1 min-w-0 text-left",title:y.title||y.sessionId,children:u.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:y.title&&y.title.trim()?y.title:"新会话"})}),T?u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u.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:u.jsx(un,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:A,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:u.jsx(dn,{className:"h-3.5 w-3.5"})})]}):u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:d?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&b(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-brand hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:d?"重命名":"该 agent 不支持会话重命名",children:u.jsx(Qu,{className:"h-3 w-3"})}),u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&C(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:d?"删除":"该 agent 不支持会话删除",children:u.jsx(hd,{className:"h-3 w-3"})})]})]},y.sessionId)})]},j.label))})}function Zv(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 Jv({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 l=new Vr({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,d)=>{a(c),m(d||null)}),f.current=l,r(l),l.connect().catch(c=>{c instanceof Bi||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,r(null),a("disconnected")}},[e,t]),u.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&u.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,u.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),u.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!o&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),u.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),u.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"&&u.jsx(Xv,{client:o})]})}const Qr="rcs_admin_key";function eb(){try{return localStorage.getItem(Qr)}catch{return null}}function tb(){const[e,t]=p.useState(eb),n=p.useCallback(o=>{const r=o.trim();t(r||null);try{r?localStorage.setItem(Qr,r):localStorage.removeItem(Qr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Us=p.lazy(()=>Ae(()=>import("./Dashboard-NLM7Kgm8.js"),__vite__mapDeps([3,2,4,5,6,1,7])).then(e=>({default:e.Dashboard}))),nb=p.lazy(()=>Ae(()=>import("./SessionDetail-3P77L-sJ.js"),__vite__mapDeps([8,2,4,6,9,5,10,11,12,1,7])).then(e=>({default:e.SessionDetail}))),rb=p.lazy(()=>Ae(()=>import("./ShareLanding-DG5JbaWg.js"),__vite__mapDeps([13,2,1,7])).then(e=>({default:e.ShareLanding}))),zs=p.lazy(()=>Ae(()=>import("./ArtifactsGallery-DgK1CSno.js"),__vite__mapDeps([11,2,6,9,12,1,7])).then(e=>({default:e.ArtifactsGallery}))),ob=p.lazy(()=>Ae(()=>import("./ArtifactView-CT0Fu4U5.js"),__vite__mapDeps([14,2,12,9,1,7])).then(e=>({default:e.ArtifactView}))),sb=p.lazy(()=>Ae(()=>import("./Claim-C7V1Q01Y.js"),__vite__mapDeps([15,2,1,7])).then(e=>({default:e.Claim}))),ab=p.lazy(()=>Ae(()=>import("./Login-DRFE4F-F.js"),__vite__mapDeps([16,2,1,7])).then(e=>({default:e.Login}))),ib=p.lazy(()=>Ae(()=>import("./Register-FgLOFB4h.js"),__vite__mapDeps([17,2,1,7])).then(e=>({default:e.Register}))),lb=p.lazy(()=>Ae(()=>import("./Setup-DDJHMu0z.js"),__vite__mapDeps([18,2,1,7])).then(e=>({default:e.Setup}))),cb=p.lazy(()=>Ae(()=>import("./Join-BhjsvbAP.js"),__vite__mapDeps([19,2,1,7])).then(e=>({default:e.Join}))),ub=p.lazy(()=>Ae(()=>import("./UserSettings-BrjmELAZ.js"),__vite__mapDeps([20,2,12,1,7])).then(e=>({default:e.UserSettings}))),db=p.lazy(()=>Ae(()=>import("./TeamList-tfsnwvZG.js"),__vite__mapDeps([21,2,1,7])).then(e=>({default:e.TeamList}))),fb=p.lazy(()=>Ae(()=>import("./TeamCreate-D_AnatYF.js"),__vite__mapDeps([22,2,1,7])).then(e=>({default:e.TeamCreate}))),mb=p.lazy(()=>Ae(()=>import("./TeamDetail-C1FFiAj2.js"),__vite__mapDeps([23,2,10,12,4,1,7])).then(e=>({default:e.TeamDetail}))),pb=p.lazy(()=>Ae(()=>import("./TeamSettings-FeTuY9_I.js"),__vite__mapDeps([24,2,1,7])).then(e=>({default:e.TeamSettings}))),hb=p.lazy(()=>Ae(()=>import("./AdminPanel-94uchXH7.js"),__vite__mapDeps([25,2,1,7])).then(e=>({default:e.AdminPanel}))),gb=new Set(["login","register","setup","join","share"]),xb=new Set(["login","register","setup","join"]);function vb(){return u.jsx(wd,{defaultTheme:"system",children:u.jsx(yh,{children:u.jsx(bb,{})})})}function bb(){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),[l,c]=p.useState(null),{adminKey:d}=tb(),{user:h,isLoading:g,checkSetupStatus:v}=zi();p.useEffect(()=>{dh(d)},[d]);const[C,b]=p.useState(!1);p.useEffect(()=>{!g&&!h?v().then(b):h&&b(!1)},[g,h,v]);const _=p.useCallback(()=>{const T=window.location.pathname,M=new URLSearchParams(window.location.search);if(M.get("acp")==="1"){const U=sessionStorage.getItem("acp_connection");if(U)try{const q=JSON.parse(U);if(q.url&&q.token){c({url:q.url,token:q.token}),sessionStorage.removeItem("acp_connection");const N=new URL(window.location.href);N.searchParams.delete("acp"),window.history.replaceState(null,"",N),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const F=M.get("sid");if(F){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${F}`),o(F),f(null),t("session");return}if(T==="/login"){t("login");return}if(T==="/register"){t("register");return}if(T==="/setup"){t("setup");return}if(T==="/join"){t("join");return}if(T==="/settings"){t("settings");return}if(T==="/admin"){t("admin");return}if(T==="/teams/new"){t("team-create");return}if(T.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(T.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(T==="/teams"){t("teams");return}const S=T.match(/^\/code\/s\/([^/]+)/);if(S&&S[1]){f(S[1]),o(null),s(void 0),t("share");return}const w=T.match(/^\/code\/a\/([^/]+)/);if(w&&w[1]){i(w[1]),o(null),s(void 0),f(null),t("artifact-view");return}if(T==="/code/artifacts"||T==="/code/artifacts/"){i(null),o(null),s(void 0),f(null),t("artifacts");return}const B=T.match(/^\/code\/claim\/([^/]+)/);if(B&&B[1]){t("claim");return}const P=T.match(/^\/code\/([^/]+)/);P&&P[1]?(o(P[1]),s(void 0),f(null),t("session")):(o(null),s(void 0),f(null),t("dashboard"))},[]);p.useEffect(()=>(_(),window.addEventListener("popstate",_),()=>window.removeEventListener("popstate",_)),[_]);const A=p.useCallback(T=>{window.history.pushState(null,"",`/code/${T}`),o(T),s(void 0),f(null),i(null),t("session")},[]),E=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),i(null),o(null),s(void 0),f(null),t("artifacts")},[]),L=p.useCallback(()=>{window.history.pushState(null,"","/code/"),o(null),s(void 0),f(null),i(null),c(null),t("dashboard")},[]),k=(()=>{let T=e;return g||(C&&T!=="setup"&&T!=="join"&&(T="setup"),!h&&!gb.has(T)&&(T="login"),h&&(T==="login"||T==="setup")&&(T="dashboard")),T})();if(p.useEffect(()=>{g||(k==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):k==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):k==="dashboard"&&h&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[k,h,g]),g)return u.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const j=()=>{if(l&&k==="acp")return u.jsx(Jv,{url:l.url,token:l.token,onBack:L});switch(k){case"login":return u.jsx(ab,{onSuccess:L,onNavigateRegister:()=>t("register")});case"register":return u.jsx(ib,{onSuccess:L,onBack:()=>t("login")});case"setup":return u.jsx(lb,{onSuccess:L,onAlreadyDone:L});case"join":return u.jsx(cb,{onSuccess:L,onInvalidInvite:L});case"settings":return u.jsx(ub,{});case"teams":return u.jsx(db,{});case"team-create":return u.jsx(fb,{});case"team-detail":return u.jsx(mb,{});case"team-settings":return u.jsx(pb,{});case"admin":return(h==null?void 0:h.role)!=="admin"?u.jsx("div",{className:"flex flex-1 items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),u.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:Fe("nav.dashboard")})]})}):u.jsx(hb,{});case"share":return u.jsx(rb,{});case"claim":return u.jsx(sb,{});case"artifacts":return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"artifact-view":return a?u.jsx(ob,{artifactId:a,onBack:E}):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"session":return n?u.jsx(nb,{sessionId:n,onSessionLoaded:T=>s(T.source)},n):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})});default:return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})})}},x=!xb.has(k),y=k==="artifact-view";return u.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[x&&u.jsx(Ch,{sessionTitle:n||(l?"ACP":void 0),sessionSource:l?"acp":r,onBack:n||l||m?L:void 0,onNavigateArtifacts:y?void 0:E}),u.jsx(p.Suspense,{fallback:u.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:j()})]})}Dv();mc.createRoot(document.getElementById("root")).render(u.jsx(p.StrictMode,{children:u.jsx(vb,{})}));export{Fb as $,Vr as A,ve as B,yx as C,Bi as D,Yb as E,Tu as F,Ub as G,Zb as H,Bb as I,Vb as J,Jb as K,ua as L,Iv as M,$b as N,cv as O,Qu as P,Ib as Q,oy as R,od as S,ny as T,vd as U,Qb as V,Xb as W,dn as X,Ob as Y,Mb as Z,Pb as _,Xv as a,Wb as a0,zb as a1,Hb as a2,Gb as a3,Lb as a4,Db as a5,Kb as a6,qb as a7,Ks as a8,ee as a9,Ov as aa,ae as ab,kt as ac,au as ad,kb as ae,Ab as af,Nb as ag,mh as ah,Eb as ai,jb as aj,Rb as ak,Fe as al,_b as am,Wv as an,su as ao,zi as ap,Fi as aq,xh as ar,wr as b,ux as c,un as d,Kt as e,ca as f,Au as g,ry as h,uv as i,Pi as j,Di as k,Tn as l,oh as m,ys as n,Oi as o,fa as p,Pl as q,Dl as r,Ol as s,lv as t,iv as u,id as v,dd as w,ey as x,rg as y,hd as z};