@saluzi/saluzi-edu 0.2.12 → 0.2.13

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 (167) hide show
  1. package/dist/cli.js +212 -140
  2. package/dist/rcs-web/assets/Dashboard-YYwDrKTN.js +1 -0
  3. package/dist/rcs-web/assets/Join-DKCP5X6X.js +1 -0
  4. package/dist/rcs-web/assets/Login-0VGZs85I.js +1 -0
  5. package/{packages/remote-control-server/web/dist/assets/SessionDetail-DSoMXZJb.js → dist/rcs-web/assets/SessionDetail-DmK-DfBQ.js} +11 -11
  6. package/dist/rcs-web/assets/Setup-C0cjxXMt.js +1 -0
  7. package/dist/rcs-web/assets/{ShareLanding-C06U9Nrr.js → ShareLanding-DUZrreJ7.js} +1 -1
  8. package/dist/rcs-web/assets/TeamCreate-B8ZV6EdY.js +1 -0
  9. package/dist/rcs-web/assets/{TeamDetail-d_GwIRHd.js → TeamDetail-DBAsJ__i.js} +2 -2
  10. package/dist/rcs-web/assets/{TeamList-BlNGdKci.js → TeamList-C-Hte4nV.js} +1 -1
  11. package/dist/rcs-web/assets/{TeamSettings-CPraC9uS.js → TeamSettings-CNVwYwcp.js} +1 -1
  12. package/dist/rcs-web/assets/UserSettings-DRdz9kYE.js +1 -0
  13. package/dist/rcs-web/assets/{arc-BmYza-0n.js → arc-CJxirXEQ.js} +1 -1
  14. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-CYBtlgdO.js → architectureDiagram-3BPJPVTR-BZvIHrLA.js} +1 -1
  15. package/dist/rcs-web/assets/{blockDiagram-GPEHLZMM-RJAfHk_a.js → blockDiagram-GPEHLZMM-3p0y3Ija.js} +1 -1
  16. package/{packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-CJ-qJA6w.js → dist/rcs-web/assets/c4Diagram-AAUBKEIU-Bmz9A1wn.js} +1 -1
  17. package/dist/rcs-web/assets/channel-DaI_n8dp.js +1 -0
  18. package/dist/rcs-web/assets/{chunk-2J33WTMH-n5I6Q1zJ.js → chunk-2J33WTMH-B8gQz22j.js} +1 -1
  19. package/dist/rcs-web/assets/{chunk-4BX2VUAB-CSOBh7qY.js → chunk-4BX2VUAB-CgLEZsTU.js} +1 -1
  20. package/dist/rcs-web/assets/{chunk-55IACEB6-C0euQVm_.js → chunk-55IACEB6-0mdE_-IS.js} +1 -1
  21. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-Ch7yD8cR.js → dist/rcs-web/assets/chunk-727SXJPM-DdtjnIHR.js} +1 -1
  22. package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-Ms2Q7r6u.js → dist/rcs-web/assets/chunk-AQP2D5EJ-BtwFPk50.js} +1 -1
  23. package/dist/rcs-web/assets/{chunk-FMBD7UC4-bszHUkpx.js → chunk-FMBD7UC4-BcO9mQ0P.js} +1 -1
  24. package/dist/rcs-web/assets/{chunk-ND2GUHAM-BVQIhq6J.js → chunk-ND2GUHAM-BvRq13S_.js} +1 -1
  25. package/dist/rcs-web/assets/{chunk-QZHKN3VN-BVEDe5qc.js → chunk-QZHKN3VN-D7GHkPpq.js} +1 -1
  26. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-pYllpkOq.js +1 -0
  27. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-pYllpkOq.js +1 -0
  28. package/dist/rcs-web/assets/{code-block-IT6T5CEO-B26n-rFC.js → code-block-IT6T5CEO-B1p-vO-3.js} +1 -1
  29. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-DXc7GE8W.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-L0rUZuH5.js} +1 -1
  30. package/dist/rcs-web/assets/{dagre-BM42HDAG-DAXofHt_.js → dagre-BM42HDAG-CHGuio22.js} +1 -1
  31. package/dist/rcs-web/assets/{diagram-2AECGRRQ-DK0TBUQA.js → diagram-2AECGRRQ-DIDRyQk8.js} +1 -1
  32. package/dist/rcs-web/assets/{diagram-5GNKFQAL-DMsq-Grp.js → diagram-5GNKFQAL-CNubKb6P.js} +1 -1
  33. package/dist/rcs-web/assets/{diagram-KO2AKTUF-B3FMhmUc.js → diagram-KO2AKTUF-CzQh664-.js} +1 -1
  34. package/dist/rcs-web/assets/{diagram-LMA3HP47-BjO3BHFl.js → diagram-LMA3HP47-CWBR7-VG.js} +1 -1
  35. package/dist/rcs-web/assets/{diagram-OG6HWLK6-CNg4B2L3.js → diagram-OG6HWLK6-BMHdlbcZ.js} +1 -1
  36. package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-BDxz8NRK.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-OgT8dC-K.js} +1 -1
  37. package/{packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-VIgM13sK.js → dist/rcs-web/assets/flowDiagram-I6XJVG4X-DRrCY2oB.js} +1 -1
  38. package/dist/rcs-web/assets/{ganttDiagram-6RSMTGT7-Ba2QuJU0.js → ganttDiagram-6RSMTGT7-DctpzEKN.js} +1 -1
  39. package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-B-gV-lAg.js → gitGraphDiagram-PVQCEYII-5KpLszm9.js} +1 -1
  40. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-DothwgD4.js → infoDiagram-5YYISTIA-BAKD_Tt7.js} +1 -1
  41. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-DhpjM1Vc.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-VHOPG4Nc.js} +1 -1
  42. package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-PbQTouMJ.js → journeyDiagram-JHISSGLW-BtGih-ik.js} +1 -1
  43. package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-63WdwG-X.js → kanban-definition-UN3LZRKU-BsEGZsD1.js} +1 -1
  44. package/dist/rcs-web/assets/{linear-CeRljV9s.js → linear-Dj636PNG.js} +1 -1
  45. package/dist/rcs-web/assets/main-CkqtCllF.js +238 -0
  46. package/dist/rcs-web/assets/{mermaid-VLURNSYL-CG6yNR7g.js → mermaid-VLURNSYL-DutpHHm9.js} +4 -4
  47. package/dist/rcs-web/assets/{mermaid.core-CAuNNATY.js → mermaid.core-XHHf0pen.js} +5 -5
  48. package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-9hDL1CUV.js → mindmap-definition-RKZ34NQL-BBa8V_3g.js} +1 -1
  49. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-BS_P2t04.js → pieDiagram-4H26LBE5-BuNEdo9H.js} +1 -1
  50. package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-Cp9QQkHV.js → quadrantDiagram-W4KKPZXB-CsJgyQIN.js} +1 -1
  51. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-C_XSzOKE.js → requirementDiagram-4Y6WPE33-DqMJZ914.js} +1 -1
  52. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-BhuVqzZd.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CVsz09q2.js} +1 -1
  53. package/{packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-C3IPZrcW.js → dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-BRp4Wddn.js} +1 -1
  54. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-CN4iNPRl.js → stateDiagram-AJRCARHV-S-QqQr-D.js} +1 -1
  55. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CICBlDSJ.js → stateDiagram-v2-BHNVJYJU-D77KfDr-.js} +1 -1
  56. package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-Be7t_3rC.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-De8bFWnE.js} +1 -1
  57. package/dist/rcs-web/assets/{useTeams-DPHGnBHL.js → useTeams-CqJOqEy1.js} +1 -1
  58. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-CSaUc2Xv.js → vennDiagram-CIIHVFJN-Dikwrn1L.js} +1 -1
  59. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-DTuJrl9P.js → wardleyDiagram-YWT4CUSO-DUzpiV6H.js} +1 -1
  60. package/dist/rcs-web/assets/{workerType-CSqeySYe.js → workerType-DOQ0AHrq.js} +1 -1
  61. package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-BQ0oU3Qi.js → xychartDiagram-2RQKCTM6-OZNbB32D.js} +1 -1
  62. package/dist/rcs-web/index.html +1 -1
  63. package/package.json +2 -2
  64. package/packages/remote-control-server/src/__tests__/cookie.test.ts +0 -71
  65. package/packages/remote-control-server/src/__tests__/data-layer-round2.test.ts +556 -0
  66. package/packages/remote-control-server/src/__tests__/route-mounting.test.ts +212 -0
  67. package/packages/remote-control-server/src/__tests__/routes.test.ts +5 -44
  68. package/packages/remote-control-server/src/__tests__/security-fixes.test.ts +526 -0
  69. package/packages/remote-control-server/src/__tests__/security-round3.test.ts +780 -0
  70. package/packages/remote-control-server/src/__tests__/shares.test.ts +5 -2
  71. package/packages/remote-control-server/src/auth/constants.ts +0 -6
  72. package/packages/remote-control-server/src/auth/cookie.ts +0 -43
  73. package/packages/remote-control-server/src/auth/csrf.ts +58 -0
  74. package/packages/remote-control-server/src/auth/middleware.ts +7 -4
  75. package/packages/remote-control-server/src/index.ts +26 -0
  76. package/packages/remote-control-server/src/registerRoutes.ts +17 -1
  77. package/packages/remote-control-server/src/routes/web/auth-routes.ts +93 -54
  78. package/packages/remote-control-server/src/routes/web/auth.ts +16 -23
  79. package/packages/remote-control-server/src/routes/web/sessions.ts +30 -5
  80. package/packages/remote-control-server/src/routes/web/shares.ts +38 -1
  81. package/packages/remote-control-server/src/routes/web/teams.ts +22 -4
  82. package/packages/remote-control-server/src/services/session.ts +143 -9
  83. package/packages/remote-control-server/src/store.ts +34 -1
  84. package/packages/remote-control-server/src/types/api.ts +0 -1
  85. package/packages/remote-control-server/web/dist/assets/Dashboard-YYwDrKTN.js +1 -0
  86. package/packages/remote-control-server/web/dist/assets/Join-DKCP5X6X.js +1 -0
  87. package/packages/remote-control-server/web/dist/assets/Login-0VGZs85I.js +1 -0
  88. package/{dist/rcs-web/assets/SessionDetail-DSoMXZJb.js → packages/remote-control-server/web/dist/assets/SessionDetail-DmK-DfBQ.js} +11 -11
  89. package/packages/remote-control-server/web/dist/assets/Setup-C0cjxXMt.js +1 -0
  90. package/packages/remote-control-server/web/dist/assets/{ShareLanding-C06U9Nrr.js → ShareLanding-DUZrreJ7.js} +1 -1
  91. package/packages/remote-control-server/web/dist/assets/TeamCreate-B8ZV6EdY.js +1 -0
  92. package/packages/remote-control-server/web/dist/assets/{TeamDetail-d_GwIRHd.js → TeamDetail-DBAsJ__i.js} +2 -2
  93. package/packages/remote-control-server/web/dist/assets/{TeamList-BlNGdKci.js → TeamList-C-Hte4nV.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/{TeamSettings-CPraC9uS.js → TeamSettings-CNVwYwcp.js} +1 -1
  95. package/packages/remote-control-server/web/dist/assets/UserSettings-DRdz9kYE.js +1 -0
  96. package/packages/remote-control-server/web/dist/assets/{arc-BmYza-0n.js → arc-CJxirXEQ.js} +1 -1
  97. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-CYBtlgdO.js → architectureDiagram-3BPJPVTR-BZvIHrLA.js} +1 -1
  98. package/packages/remote-control-server/web/dist/assets/{blockDiagram-GPEHLZMM-RJAfHk_a.js → blockDiagram-GPEHLZMM-3p0y3Ija.js} +1 -1
  99. package/{dist/rcs-web/assets/c4Diagram-AAUBKEIU-CJ-qJA6w.js → packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-Bmz9A1wn.js} +1 -1
  100. package/packages/remote-control-server/web/dist/assets/channel-DaI_n8dp.js +1 -0
  101. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-n5I6Q1zJ.js → chunk-2J33WTMH-B8gQz22j.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-CSOBh7qY.js → chunk-4BX2VUAB-CgLEZsTU.js} +1 -1
  103. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-C0euQVm_.js → chunk-55IACEB6-0mdE_-IS.js} +1 -1
  104. package/{dist/rcs-web/assets/chunk-727SXJPM-Ch7yD8cR.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-DdtjnIHR.js} +1 -1
  105. package/{dist/rcs-web/assets/chunk-AQP2D5EJ-Ms2Q7r6u.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-BtwFPk50.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-bszHUkpx.js → chunk-FMBD7UC4-BcO9mQ0P.js} +1 -1
  107. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-BVQIhq6J.js → chunk-ND2GUHAM-BvRq13S_.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-BVEDe5qc.js → chunk-QZHKN3VN-D7GHkPpq.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-pYllpkOq.js +1 -0
  110. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-pYllpkOq.js +1 -0
  111. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-B26n-rFC.js → code-block-IT6T5CEO-B1p-vO-3.js} +1 -1
  112. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-DXc7GE8W.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-L0rUZuH5.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-DAXofHt_.js → dagre-BM42HDAG-CHGuio22.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-DK0TBUQA.js → diagram-2AECGRRQ-DIDRyQk8.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-DMsq-Grp.js → diagram-5GNKFQAL-CNubKb6P.js} +1 -1
  116. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-B3FMhmUc.js → diagram-KO2AKTUF-CzQh664-.js} +1 -1
  117. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-BjO3BHFl.js → diagram-LMA3HP47-CWBR7-VG.js} +1 -1
  118. package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-CNg4B2L3.js → diagram-OG6HWLK6-BMHdlbcZ.js} +1 -1
  119. package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-BDxz8NRK.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-OgT8dC-K.js} +1 -1
  120. package/{dist/rcs-web/assets/flowDiagram-I6XJVG4X-VIgM13sK.js → packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-DRrCY2oB.js} +1 -1
  121. package/packages/remote-control-server/web/dist/assets/{ganttDiagram-6RSMTGT7-Ba2QuJU0.js → ganttDiagram-6RSMTGT7-DctpzEKN.js} +1 -1
  122. package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-B-gV-lAg.js → gitGraphDiagram-PVQCEYII-5KpLszm9.js} +1 -1
  123. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-DothwgD4.js → infoDiagram-5YYISTIA-BAKD_Tt7.js} +1 -1
  124. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-DhpjM1Vc.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-VHOPG4Nc.js} +1 -1
  125. package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-PbQTouMJ.js → journeyDiagram-JHISSGLW-BtGih-ik.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-63WdwG-X.js → kanban-definition-UN3LZRKU-BsEGZsD1.js} +1 -1
  127. package/packages/remote-control-server/web/dist/assets/{linear-CeRljV9s.js → linear-Dj636PNG.js} +1 -1
  128. package/packages/remote-control-server/web/dist/assets/main-CkqtCllF.js +238 -0
  129. package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-CG6yNR7g.js → mermaid-VLURNSYL-DutpHHm9.js} +4 -4
  130. package/packages/remote-control-server/web/dist/assets/{mermaid.core-CAuNNATY.js → mermaid.core-XHHf0pen.js} +5 -5
  131. package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-9hDL1CUV.js → mindmap-definition-RKZ34NQL-BBa8V_3g.js} +1 -1
  132. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-BS_P2t04.js → pieDiagram-4H26LBE5-BuNEdo9H.js} +1 -1
  133. package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-Cp9QQkHV.js → quadrantDiagram-W4KKPZXB-CsJgyQIN.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-C_XSzOKE.js → requirementDiagram-4Y6WPE33-DqMJZ914.js} +1 -1
  135. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-BhuVqzZd.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CVsz09q2.js} +1 -1
  136. package/{dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-C3IPZrcW.js → packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-BRp4Wddn.js} +1 -1
  137. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-CN4iNPRl.js → stateDiagram-AJRCARHV-S-QqQr-D.js} +1 -1
  138. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CICBlDSJ.js → stateDiagram-v2-BHNVJYJU-D77KfDr-.js} +1 -1
  139. package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-Be7t_3rC.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-De8bFWnE.js} +1 -1
  140. package/packages/remote-control-server/web/dist/assets/{useTeams-DPHGnBHL.js → useTeams-CqJOqEy1.js} +1 -1
  141. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-CSaUc2Xv.js → vennDiagram-CIIHVFJN-Dikwrn1L.js} +1 -1
  142. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-DTuJrl9P.js → wardleyDiagram-YWT4CUSO-DUzpiV6H.js} +1 -1
  143. package/packages/remote-control-server/web/dist/assets/{workerType-CSqeySYe.js → workerType-DOQ0AHrq.js} +1 -1
  144. package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-BQ0oU3Qi.js → xychartDiagram-2RQKCTM6-OZNbB32D.js} +1 -1
  145. package/packages/remote-control-server/web/dist/index.html +1 -1
  146. package/dist/rcs-web/assets/Dashboard-D_Im4UId.js +0 -1
  147. package/dist/rcs-web/assets/Join-BTnvMsB9.js +0 -1
  148. package/dist/rcs-web/assets/Login-ClT7RckC.js +0 -1
  149. package/dist/rcs-web/assets/Setup-PaDA6Et-.js +0 -1
  150. package/dist/rcs-web/assets/TeamCreate-249rK3U3.js +0 -1
  151. package/dist/rcs-web/assets/UserSettings-X627Fdni.js +0 -1
  152. package/dist/rcs-web/assets/channel-BUwWbT6U.js +0 -1
  153. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DYtx22zv.js +0 -1
  154. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DYtx22zv.js +0 -1
  155. package/dist/rcs-web/assets/i18n-Dbt-vEQ3.js +0 -1
  156. package/dist/rcs-web/assets/main-DvfxciBy.js +0 -238
  157. package/packages/remote-control-server/web/dist/assets/Dashboard-D_Im4UId.js +0 -1
  158. package/packages/remote-control-server/web/dist/assets/Join-BTnvMsB9.js +0 -1
  159. package/packages/remote-control-server/web/dist/assets/Login-ClT7RckC.js +0 -1
  160. package/packages/remote-control-server/web/dist/assets/Setup-PaDA6Et-.js +0 -1
  161. package/packages/remote-control-server/web/dist/assets/TeamCreate-249rK3U3.js +0 -1
  162. package/packages/remote-control-server/web/dist/assets/UserSettings-X627Fdni.js +0 -1
  163. package/packages/remote-control-server/web/dist/assets/channel-BUwWbT6U.js +0 -1
  164. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DYtx22zv.js +0 -1
  165. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DYtx22zv.js +0 -1
  166. package/packages/remote-control-server/web/dist/assets/i18n-Dbt-vEQ3.js +0 -1
  167. package/packages/remote-control-server/web/dist/assets/main-DvfxciBy.js +0 -238
@@ -0,0 +1,238 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-DutpHHm9.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-YYwDrKTN.js","assets/workerType-DOQ0AHrq.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-DmK-DfBQ.js","assets/ShareLanding-DUZrreJ7.js","assets/Login-0VGZs85I.js","assets/Setup-C0cjxXMt.js","assets/Join-DKCP5X6X.js","assets/UserSettings-DRdz9kYE.js","assets/TeamList-C-Hte4nV.js","assets/useTeams-CqJOqEy1.js","assets/TeamCreate-B8ZV6EdY.js","assets/TeamDetail-DBAsJ__i.js","assets/TeamSettings-CNVwYwcp.js"])))=>i.map(i=>d[i]);
2
+ var Il=Object.defineProperty;var Pl=(e,t,n)=>t in e?Il(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=(e,t,n)=>Pl(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as rt,j as d,R as Br,r as As,b as Ml,c as Hr,d as Ol}from"./vendor-DE_-CLIE.js";import{_ as Re}from"./shiki-mEP5vQQu.js";import{m as Dl}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 _s(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=_s(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Rs(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=_s(e))&&(o&&(o+=" "),o+=t);return o}const Ll=(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},Fl=(e,t)=>({classGroupId:e,validator:t}),js=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),En="-",Io=[],$l="arbitrary..",zl=e=>{const t=Bl(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Ul(a);const i=a.split(En),m=i[0]===""&&i.length>1?1:0;return Ts(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=o[a],f=n[a];return m?f?Ll(f,m):m:f||Io}return n[a]||Io}}},Ts=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],s=n.nextPart.get(r);if(s){const f=Ts(e,t+1,s);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(En):e.slice(t).join(En),m=a.length;for(let f=0;f<m;f++){const c=a[f];if(c.validator(i))return c.classGroupId}},Ul=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?$l+o:void 0})(),Bl=e=>{const{theme:t,classGroups:n}=e;return Hl(n,t)},Hl=(e,t)=>{const n=js();for(const o in e){const r=e[o];Wr(r,n,o,t)}return n},Wr=(e,t,n,o)=>{const r=e.length;for(let s=0;s<r;s++){const a=e[s];Wl(a,t,n,o)}},Wl=(e,t,n,o)=>{if(typeof e=="string"){Gl(e,t,n);return}if(typeof e=="function"){Vl(e,t,n,o);return}Kl(e,t,n,o)},Gl=(e,t,n)=>{const o=e===""?t:Ns(t,e);o.classGroupId=n},Vl=(e,t,n,o)=>{if(ql(e)){Wr(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(Fl(n,e))},Kl=(e,t,n,o)=>{const r=Object.entries(e),s=r.length;for(let a=0;a<s;a++){const[i,m]=r[a];Wr(m,Ns(t,i),n,o)}},Ns=(e,t)=>{let n=e;const o=t.split(En),r=o.length;for(let s=0;s<r;s++){const a=o[s];let i=n.nextPart.get(a);i||(i=js(),n.nextPart.set(a,i)),n=i}return n},ql=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Xl=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)}}},Ar="!",Po=":",Yl=[],Mo=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),Ql=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const s=[];let a=0,i=0,m=0,f;const c=r.length;for(let v=0;v<c;v++){const y=r[v];if(a===0&&i===0){if(y===Po){s.push(r.slice(m,v)),m=v+1;continue}if(y==="/"){f=v;continue}}y==="["?a++:y==="]"?a--:y==="("?i++:y===")"&&i--}const l=s.length===0?r:r.slice(m);let u=l,h=!1;l.endsWith(Ar)?(u=l.slice(0,-1),h=!0):l.startsWith(Ar)&&(u=l.slice(1),h=!0);const g=f&&f>m?f-m:void 0;return Mo(s,h,u,g)};if(t){const r=t+Po,s=o;o=a=>a.startsWith(r)?s(a.slice(r.length)):Mo(Yl,!1,a,void 0,!0)}if(n){const r=o;o=s=>n({className:s,parseClassName:r})}return o},Zl=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}},Jl=e=>({cache:Xl(e.cacheSize),parseClassName:Ql(e),sortModifiers:Zl(e),postfixLookupClassGroupIds:ec(e),...zl(e)}),ec=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},tc=/\s+/,nc=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(tc);let f="";for(let c=m.length-1;c>=0;c-=1){const l=m[c],{isExternal:u,modifiers:h,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:y}=n(l);if(u){f=l+(f.length>0?" "+f:f);continue}let w=!!y,_;if(w){const j=v.substring(0,y);_=o(j);const x=_&&a[_]?o(v):void 0;x&&x!==_&&(_=x,w=!1)}else _=o(v);if(!_){if(!w){f=l+(f.length>0?" "+f:f);continue}if(_=o(v),!_){f=l+(f.length>0?" "+f:f);continue}w=!1}const R=h.length===0?"":h.length===1?h[0]:s(h).join(":"),A=g?R+Ar:R,F=A+_;if(i.indexOf(F)>-1)continue;i.push(F);const S=r(_,w);for(let j=0;j<S.length;++j){const x=S[j];i.push(A+x)}f=l+(f.length>0?" "+f:f)}return f},rc=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=Is(n))&&(r&&(r+=" "),r+=o);return r},Is=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Is(e[o]))&&(n&&(n+=" "),n+=t);return n},oc=(e,...t)=>{let n,o,r,s;const a=m=>{const f=t.reduce((c,l)=>l(c),e());return n=Jl(f),o=n.cache.get,r=n.cache.set,s=i,i(m)},i=m=>{const f=o(m);if(f)return f;const c=nc(m,n);return r(m,c),c};return s=a,(...m)=>s(rc(...m))},sc=[],xe=e=>{const t=n=>n[e]||sc;return t.isThemeGetter=!0,t},Ps=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ms=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ac=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ic=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lc=/\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$/,cc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nt=e=>ac.test(e),oe=e=>!!e&&!Number.isNaN(Number(e)),$e=e=>!!e&&Number.isInteger(Number(e)),sr=e=>e.endsWith("%")&&oe(e.slice(0,-1)),Ve=e=>ic.test(e),Os=()=>!0,fc=e=>lc.test(e)&&!cc.test(e),Gr=()=>!1,mc=e=>uc.test(e),pc=e=>dc.test(e),hc=e=>!X(e)&&!Q(e),gc=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)),xc=e=>ut(e,Fs,Gr),X=e=>Ps.test(e),xt=e=>ut(e,$s,fc),Oo=e=>ut(e,kc,oe),vc=e=>ut(e,Us,Os),bc=e=>ut(e,zs,Gr),Do=e=>ut(e,Ds,Gr),wc=e=>ut(e,Ls,pc),hn=e=>ut(e,Bs,mc),Q=e=>Ms.test(e),Gt=e=>Et(e,$s),yc=e=>Et(e,zs),Lo=e=>Et(e,Ds),Cc=e=>Et(e,Fs),Sc=e=>Et(e,Ls),gn=e=>Et(e,Bs,!0),Ec=e=>Et(e,Us,!0),ut=(e,t,n)=>{const o=Ps.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Et=(e,t,n=!1)=>{const o=Ms.exec(e);return o?o[1]?t(o[1]):n:!1},Ds=e=>e==="position"||e==="percentage",Ls=e=>e==="image"||e==="url",Fs=e=>e==="length"||e==="size"||e==="bg-size",$s=e=>e==="length",kc=e=>e==="number",zs=e=>e==="family-name",Us=e=>e==="number"||e==="weight",Bs=e=>e==="shadow",Ac=()=>{const e=xe("color"),t=xe("font"),n=xe("text"),o=xe("font-weight"),r=xe("tracking"),s=xe("leading"),a=xe("breakpoint"),i=xe("container"),m=xe("spacing"),f=xe("radius"),c=xe("shadow"),l=xe("inset-shadow"),u=xe("text-shadow"),h=xe("drop-shadow"),g=xe("blur"),v=xe("perspective"),y=xe("aspect"),w=xe("ease"),_=xe("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...A(),Q,X],S=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],x=()=>[Q,X,m],b=()=>[nt,"full","auto",...x()],I=()=>[$e,"none","subgrid",Q,X],O=()=>["auto",{span:["full",$e,Q,X]},$e,Q,X],M=()=>[$e,"auto",Q,X],$=()=>["auto","min","max","fr",Q,X],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...x()],C=()=>[nt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],D=()=>[nt,"screen","full","dvw","lvw","svw","min","max","fit",...x()],k=()=>[nt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],N=()=>[e,Q,X],H=()=>[...A(),Lo,Do,{position:[Q,X]}],T=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",Cc,xc,{size:[Q,X]}],U=()=>[sr,Gt,xt],L=()=>["","none","full",f,Q,X],G=()=>["",oe,Gt,xt],V=()=>["solid","dashed","dotted","double"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[oe,sr,Lo,Do],ne=()=>["","none",g,Q,X],ae=()=>["none",oe,Q,X],le=()=>["none",oe,Q,X],me=()=>[oe,Q,X],W=()=>[nt,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ve],breakpoint:[Ve],color:[Os],container:[Ve],"drop-shadow":[Ve],ease:["in","out","in-out"],font:[hc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ve],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ve],shadow:[Ve],spacing:["px",oe],text:[Ve],"text-shadow":[Ve],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nt,X,Q,y]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[gc],columns:[{columns:[oe,X,Q,i]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:F()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:b()}],"inset-x":[{"inset-x":b()}],"inset-y":[{"inset-y":b()}],start:[{"inset-s":b(),start:b()}],end:[{"inset-e":b(),end:b()}],"inset-bs":[{"inset-bs":b()}],"inset-be":[{"inset-be":b()}],top:[{top:b()}],right:[{right:b()}],bottom:[{bottom:b()}],left:[{left:b()}],visibility:["visible","invisible","collapse"],z:[{z:[$e,"auto",Q,X]}],basis:[{basis:[nt,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[oe,nt,"auto","initial","none",X]}],grow:[{grow:["",oe,Q,X]}],shrink:[{shrink:["",oe,Q,X]}],order:[{order:[$e,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"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:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],"inline-size":[{inline:["auto",...D()]}],"min-inline-size":[{"min-inline":["auto",...D()]}],"max-inline-size":[{"max-inline":["none",...D()]}],"block-size":[{block:["auto",...k()]}],"min-block-size":[{"min-block":["auto",...k()]}],"max-block-size":[{"max-block":["none",...k()]}],w:[{w:[i,"screen",...C()]}],"min-w":[{"min-w":[i,"screen","none",...C()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",n,Gt,xt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Ec,vc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sr,X]}],"font-family":[{font:[yc,bc,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":[oe,"none",Q,Oo]}],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:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[oe,"from-font","auto",Q,xt]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[oe,"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:[$e,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:H()}],"bg-repeat":[{bg:T()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$e,Q,X],radial:["",Q,X],conic:[$e,Q,X]},Sc,wc]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-bs":[{"border-bs":G()}],"border-w-be":[{"border-be":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[oe,Q,X]}],"outline-w":[{outline:["",oe,Gt,xt]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",c,gn,hn]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",l,gn,hn]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[oe,xt]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",u,gn,hn]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[oe,Q,X]}],"mix-blend":[{"mix-blend":[...Y(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Y()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[oe]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[Q,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[oe]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:T()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:ne()}],brightness:[{brightness:[oe,Q,X]}],contrast:[{contrast:[oe,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",h,gn,hn]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",oe,Q,X]}],"hue-rotate":[{"hue-rotate":[oe,Q,X]}],invert:[{invert:["",oe,Q,X]}],saturate:[{saturate:[oe,Q,X]}],sepia:[{sepia:["",oe,Q,X]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,X]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[oe,Q,X]}],"backdrop-contrast":[{"backdrop-contrast":[oe,Q,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",oe,Q,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[oe,Q,X]}],"backdrop-invert":[{"backdrop-invert":["",oe,Q,X]}],"backdrop-opacity":[{"backdrop-opacity":[oe,Q,X]}],"backdrop-saturate":[{"backdrop-saturate":[oe,Q,X]}],"backdrop-sepia":[{"backdrop-sepia":["",oe,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:[oe,"initial",Q,X]}],ease:[{ease:["linear","initial",w,Q,X]}],delay:[{delay:[oe,Q,X]}],animate:[{animate:["none",_,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,X]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[Q,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:W()}],"translate-x":[{"translate-x":W()}],"translate-y":[{"translate-y":W()}],"translate-z":[{"translate-z":W()}],"translate-none":["translate-none"],zoom:[{zoom:[$e,Q,X]}],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,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":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,X]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[oe,Gt,xt,Oo]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},_c=oc(Ac);function J(...e){return _c(Rs(e))}function Rc(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function pv(e){return e?new Date(e*1e3).toLocaleString():""}function hv(e){return e==="archived"||e==="inactive"}function gv(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function jc(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 xv(){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),jc(t)}/**
3
+ * @license lucide-react v0.555.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const Tc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Nc=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),Fo=e=>{const t=Nc(e);return t.charAt(0).toUpperCase()+t.slice(1)},Hs=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),Ic=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 Pc={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 Mc=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,...Pc,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Hs("lucide",r),...!s&&!Ic(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,c])=>p.createElement(f,c)),...Array.isArray(s)?s:[s]]));/**
18
+ * @license lucide-react v0.555.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const ce=(e,t)=>{const n=p.forwardRef(({className:o,...r},s)=>p.createElement(Mc,{ref:s,iconNode:t,className:Hs(`lucide-${Tc(Fo(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Fo(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 Oc=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Dc=ce("arrow-down",Oc);/**
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 Lc=[["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"}]],Fc=ce("brain",Lc);/**
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 $c=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],nn=ce("check",$c);/**
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 zc=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rn=ce("chevron-down",zc);/**
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 Uc=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bc=ce("chevron-left",Uc);/**
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 Hc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ws=ce("chevron-up",Hc);/**
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 Wc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Gc=ce("circle-check",Wc);/**
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 Vc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Kc=ce("circle",Vc);/**
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 qc=[["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"}]],Yt=ce("file-text",qc);/**
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 Xc=[["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"}]],Vr=ce("folder-open",Xc);/**
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 Yc=[["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"}]],Qc=ce("image",Yc);/**
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 Zc=[["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"}]],Jc=ce("layout-grid",Zc);/**
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 eu=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Gs=ce("loader-circle",eu);/**
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 tu=[["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"}]],nu=ce("message-square",tu);/**
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 ru=[["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"}]],ou=ce("monitor",ru);/**
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 su=[["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"}]],Vs=ce("moon",su);/**
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 au=[["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"}]],iu=ce("panel-left-close",au);/**
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 lu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],cu=ce("panel-left",lu);/**
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 uu=[["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"}]],du=ce("paperclip",uu);/**
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 fu=[["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"}]],mu=ce("pencil",fu);/**
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 pu=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ks=ce("plus",pu);/**
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 hu=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],gu=ce("search",hu);/**
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:"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"}]],vu=ce("send",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 bu=[["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"}]],qs=ce("shield-alert",bu);/**
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 wu=[["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"}]],yu=ce("shield",wu);/**
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 Cu=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],Su=ce("slash",Cu);/**
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 Eu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ku=ce("square",Eu);/**
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 Au=[["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"}]],Xs=ce("sun",Au);/**
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 _u=[["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"}]],Kr=ce("table",_u);/**
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 Ru=[["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"}]],ju=ce("trash-2",Ru);/**
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 Tu=[["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"}]],Nu=ce("user",Tu);/**
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 Iu=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],$n=ce("x",Iu),Ys=p.createContext(void 0),Qs="theme";function $o(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function zo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(Qs);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Uo(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function Pu(){const e=p.useContext(Ys);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Mu({children:e,defaultTheme:t="system"}){const[n,o]=p.useState(()=>zo()||t),[r,s]=p.useState(()=>{const m=zo()||t;return m==="system"?$o():m}),a=p.useCallback(m=>{o(m);try{localStorage.setItem(Qs,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?$o():n;s(m),Uo(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=c=>{const l=c.matches?"dark":"light";s(l),Uo(l)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:r,setTheme:a};return rt.createElement(Ys.Provider,{value:i},e)}function Bo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function He(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Bo(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():Bo(e[r],null)}}}}function pe(...e){return p.useCallback(He(...e),e)}var Ou=Symbol.for("react.lazy"),kn=Br[" use ".trim().toString()];function Du(e){return typeof e=="object"&&e!==null&&"then"in e}function Zs(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ou&&"_payload"in e&&Du(e._payload)}function Js(e){const t=Fu(e),n=p.forwardRef((o,r)=>{let{children:s,...a}=o;Zs(s)&&typeof kn=="function"&&(s=kn(s._payload));const i=p.Children.toArray(s),m=i.find(zu);if(m){const f=m.props.children,c=i.map(l=>l===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:l);return d.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,c):null})}return d.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Lu=Js("Slot");function Fu(e){const t=p.forwardRef((n,o)=>{let{children:r,...s}=n;if(Zs(r)&&typeof kn=="function"&&(r=kn(r._payload)),p.isValidElement(r)){const a=Bu(r),i=Uu(s,r.props);return r.type!==p.Fragment&&(i.ref=o?He(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $u=Symbol("radix.slottable");function zu(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$u}function Uu(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 Bu(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 Ho=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Wo=Rs,Hu=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return Wo(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=t,a=Object.keys(r).map(f=>{const c=n==null?void 0:n[f],l=s==null?void 0:s[f];if(c===null)return null;const u=Ho(c)||Ho(l);return r[f][u]}),i=n&&Object.entries(n).reduce((f,c)=>{let[l,u]=c;return u===void 0||(f[l]=u),f},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,c)=>{let{class:l,className:u,...h}=c;return Object.entries(h).every(g=>{let[v,y]=g;return Array.isArray(y)?y.includes({...s,...i}[v]):{...s,...i}[v]===y})?[...f,l,u]:f},[]);return Wo(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},Wu=Hu("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 kt({className:e,variant:t,size:n,asChild:o=!1,...r}){const s=o?Lu:"button";return d.jsx(s,{"data-slot":"button",className:J(Wu({variant:t,size:n,className:e})),...r})}function ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Gu(e,t){const n=p.createContext(t),o=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return d.jsx(n.Provider,{value:m,children:a})};o.displayName=e+"Provider";function r(s){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Qe(e,t=[]){let n=[];function o(s,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=l=>{var w;const{scope:u,children:h,...g}=l,v=((w=u==null?void 0:u[e])==null?void 0:w[m])||i,y=p.useMemo(()=>g,Object.values(g));return d.jsx(v.Provider,{value:y,children:h})};f.displayName=s+"Provider";function c(l,u){var v;const h=((v=u==null?void 0:u[e])==null?void 0:v[m])||i,g=p.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${l}\` must be used within \`${s}\``)}return[f,c]}const r=()=>{const s=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return r.scopeName=e,[o,Vu(r,...t)]}function Vu(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((i,{useScope:m,scopeName:f})=>{const l=m(s)[`__scope${f}`];return{...i,...l}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ke=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Ku=Br[" useInsertionEffect ".trim().toString()]||Ke;function at({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=qu({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:r;{const c=p.useRef(e!==void 0);p.useEffect(()=>{const l=c.current;l!==i&&console.warn(`${o} is changing from ${l?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=i},[i,o])}const f=p.useCallback(c=>{var l;if(i){const u=Xu(c)?c(e):c;u!==e&&((l=a.current)==null||l.call(a,u))}else s(c)},[i,e,s,a]);return[m,f]}function qu({defaultProp:e,onChange:t}){const[n,o]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return Ku(()=>{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 Xu(e){return typeof e=="function"}function Ot(e){const t=Yu(e),n=p.forwardRef((o,r)=>{const{children:s,...a}=o,i=p.Children.toArray(s),m=i.find(Zu);if(m){const f=m.props.children,c=i.map(l=>l===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:l);return d.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,c):null})}return d.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Yu(e){const t=p.forwardRef((n,o)=>{const{children:r,...s}=n;if(p.isValidElement(r)){const a=ed(r),i=Ju(s,r.props);return r.type!==p.Fragment&&(i.ref=o?He(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ea=Symbol("radix.slottable");function Qu(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ea,t}function Zu(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ea}function Ju(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 ed(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 td=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ue=td.reduce((e,t)=>{const n=Ot(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function ta(e,t){e&&As.flushSync(()=>e.dispatchEvent(t))}function na(e){const t=e+"CollectionProvider",[n,o]=Qe(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:y,children:w}=v,_=rt.useRef(null),R=rt.useRef(new Map).current;return d.jsx(r,{scope:y,itemMap:R,collectionRef:_,children:w})};a.displayName=t;const i=e+"CollectionSlot",m=Ot(i),f=rt.forwardRef((v,y)=>{const{scope:w,children:_}=v,R=s(i,w),A=pe(y,R.collectionRef);return d.jsx(m,{ref:A,children:_})});f.displayName=i;const c=e+"CollectionItemSlot",l="data-radix-collection-item",u=Ot(c),h=rt.forwardRef((v,y)=>{const{scope:w,children:_,...R}=v,A=rt.useRef(null),F=pe(y,A),S=s(c,w);return rt.useEffect(()=>(S.itemMap.set(A,{ref:A,...R}),()=>void S.itemMap.delete(A))),d.jsx(u,{[l]:"",ref:F,children:_})});h.displayName=c;function g(v){const y=s(e+"CollectionConsumer",v);return rt.useCallback(()=>{const _=y.collectionRef.current;if(!_)return[];const R=Array.from(_.querySelectorAll(`[${l}]`));return Array.from(y.itemMap.values()).sort((S,j)=>R.indexOf(S.ref.current)-R.indexOf(j.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,o]}var nd=p.createContext(void 0);function ra(e){const t=p.useContext(nd);return e||t||"ltr"}function qe(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 rd(e,t=globalThis==null?void 0:globalThis.document){const n=qe(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 od="DismissableLayer",_r="dismissableLayer.update",sd="dismissableLayer.pointerDownOutside",ad="dismissableLayer.focusOutside",Go,oa=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),on=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(oa),[c,l]=p.useState(null),u=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=pe(t,j=>l(j)),v=Array.from(f.layers),[y]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),w=v.indexOf(y),_=c?v.indexOf(c):-1,R=f.layersWithOutsidePointerEventsDisabled.size>0,A=_>=w,F=cd(j=>{const x=j.target,b=[...f.branches].some(I=>I.contains(x));!A||b||(r==null||r(j),a==null||a(j),j.defaultPrevented||i==null||i())},u),S=ud(j=>{const x=j.target;[...f.branches].some(I=>I.contains(x))||(s==null||s(j),a==null||a(j),j.defaultPrevented||i==null||i())},u);return rd(j=>{_===f.layers.size-1&&(o==null||o(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},u),p.useEffect(()=>{if(c)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Go=u.body.style.pointerEvents,u.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(c)),f.layers.add(c),Vo(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(u.body.style.pointerEvents=Go)}},[c,u,n,f]),p.useEffect(()=>()=>{c&&(f.layers.delete(c),f.layersWithOutsidePointerEventsDisabled.delete(c),Vo())},[c,f]),p.useEffect(()=>{const j=()=>h({});return document.addEventListener(_r,j),()=>document.removeEventListener(_r,j)},[]),d.jsx(ue.div,{...m,ref:g,style:{pointerEvents:R?A?"auto":"none":void 0,...e.style},onFocusCapture:ee(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ee(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ee(e.onPointerDownCapture,F.onPointerDownCapture)})});on.displayName=od;var id="DismissableLayerBranch",ld=p.forwardRef((e,t)=>{const n=p.useContext(oa),o=p.useRef(null),r=pe(t,o);return p.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),d.jsx(ue.div,{...e,ref:r})});ld.displayName=id;function cd(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),o=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let m=function(){sa(sd,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 ud(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),o=p.useRef(!1);return p.useEffect(()=>{const r=s=>{s.target&&!o.current&&sa(ad,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 Vo(){const e=new CustomEvent(_r);document.dispatchEvent(e)}function sa(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?ta(r,s):r.dispatchEvent(s)}var ar=0;function qr(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ko()),document.body.insertAdjacentElement("beforeend",e[1]??Ko()),ar++,()=>{ar===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ar--}},[])}function Ko(){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 ir="focusScope.autoFocusOnMount",lr="focusScope.autoFocusOnUnmount",qo={bubbles:!1,cancelable:!0},dd="FocusScope",zn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=qe(r),c=qe(s),l=p.useRef(null),u=pe(t,v=>m(v)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(o){let v=function(R){if(h.paused||!i)return;const A=R.target;i.contains(A)?l.current=A:ot(l.current,{select:!0})},y=function(R){if(h.paused||!i)return;const A=R.relatedTarget;A!==null&&(i.contains(A)||ot(l.current,{select:!0}))},w=function(R){if(document.activeElement===document.body)for(const F of R)F.removedNodes.length>0&&ot(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",y);const _=new MutationObserver(w);return i&&_.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),_.disconnect()}}},[o,i,h.paused]),p.useEffect(()=>{if(i){Yo.add(h);const v=document.activeElement;if(!i.contains(v)){const w=new CustomEvent(ir,qo);i.addEventListener(ir,f),i.dispatchEvent(w),w.defaultPrevented||(fd(xd(aa(i)),{select:!0}),document.activeElement===v&&ot(i))}return()=>{i.removeEventListener(ir,f),setTimeout(()=>{const w=new CustomEvent(lr,qo);i.addEventListener(lr,c),i.dispatchEvent(w),w.defaultPrevented||ot(v??document.body,{select:!0}),i.removeEventListener(lr,c),Yo.remove(h)},0)}}},[i,f,c,h]);const g=p.useCallback(v=>{if(!n&&!o||h.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,w=document.activeElement;if(y&&w){const _=v.currentTarget,[R,A]=md(_);R&&A?!v.shiftKey&&w===A?(v.preventDefault(),n&&ot(R,{select:!0})):v.shiftKey&&w===R&&(v.preventDefault(),n&&ot(A,{select:!0})):w===_&&v.preventDefault()}},[n,o,h.paused]);return d.jsx(ue.div,{tabIndex:-1,...a,ref:u,onKeyDown:g})});zn.displayName=dd;function fd(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(ot(o,{select:t}),document.activeElement!==n)return}function md(e){const t=aa(e),n=Xo(t,e),o=Xo(t.reverse(),e);return[n,o]}function aa(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 Xo(e,t){for(const n of e)if(!pd(n,{upTo:t}))return n}function pd(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 hd(e){return e instanceof HTMLInputElement&&"select"in e}function ot(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hd(e)&&t&&e.select()}}var Yo=gd();function gd(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Qo(e,t),e.unshift(t)},remove(t){var n;e=Qo(e,t),(n=e[0])==null||n.resume()}}}function Qo(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function xd(e){return e.filter(t=>t.tagName!=="A")}var vd=Br[" useId ".trim().toString()]||(()=>{}),bd=0;function ye(e){const[t,n]=p.useState(vd());return Ke(()=>{n(o=>o??String(bd++))},[e]),e||(t?`radix-${t}`:"")}const wd=["top","right","bottom","left"],it=Math.min,Ae=Math.max,An=Math.round,xn=Math.floor,Be=e=>({x:e,y:e}),yd={left:"right",right:"left",bottom:"top",top:"bottom"};function Rr(e,t,n){return Ae(e,it(t,n))}function Xe(e,t){return typeof e=="function"?e(t):e}function Ye(e){return e.split("-")[0]}function $t(e){return e.split("-")[1]}function Xr(e){return e==="x"?"y":"x"}function Yr(e){return e==="y"?"height":"width"}function Ue(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Qr(e){return Xr(Ue(e))}function Cd(e,t,n){n===void 0&&(n=!1);const o=$t(e),r=Qr(e),s=Yr(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=_n(a)),[a,_n(a)]}function Sd(e){const t=_n(e);return[jr(e),t,jr(t)]}function jr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Zo=["left","right"],Jo=["right","left"],Ed=["top","bottom"],kd=["bottom","top"];function Ad(e,t,n){switch(e){case"top":case"bottom":return n?t?Jo:Zo:t?Zo:Jo;case"left":case"right":return t?Ed:kd;default:return[]}}function _d(e,t,n,o){const r=$t(e);let s=Ad(Ye(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(jr)))),s}function _n(e){const t=Ye(e);return yd[t]+e.slice(t.length)}function Rd(e){return{top:0,right:0,bottom:0,left:0,...e}}function ia(e){return typeof e!="number"?Rd(e):{top:e,right:e,bottom:e,left:e}}function Rn(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function es(e,t,n){let{reference:o,floating:r}=e;const s=Ue(t),a=Qr(t),i=Yr(a),m=Ye(t),f=s==="y",c=o.x+o.width/2-r.width/2,l=o.y+o.height/2-r.height/2,u=o[i]/2-r[i]/2;let h;switch(m){case"top":h={x:c,y:o.y-r.height};break;case"bottom":h={x:c,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:l};break;case"left":h={x:o.x-r.width,y:l};break;default:h={x:o.x,y:o.y}}switch($t(t)){case"start":h[a]-=u*(n&&f?-1:1);break;case"end":h[a]+=u*(n&&f?-1:1);break}return h}async function jd(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:c="viewport",elementContext:l="floating",altBoundary:u=!1,padding:h=0}=Xe(t,e),g=ia(h),y=i[u?l==="floating"?"reference":"floating":l],w=Rn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:c,strategy:m})),_=l==="floating"?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),A=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},F=Rn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:_,offsetParent:R,strategy:m}):_);return{top:(w.top-F.top+g.top)/A.y,bottom:(F.bottom-w.bottom+g.bottom)/A.y,left:(w.left-F.left+g.left)/A.x,right:(F.right-w.right+g.right)/A.x}}const Td=50,Nd=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:jd},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:l}=es(f,o,m),u=o,h=0;const g={};for(let v=0;v<s.length;v++){const y=s[v];if(!y)continue;const{name:w,fn:_}=y,{x:R,y:A,data:F,reset:S}=await _({x:c,y:l,initialPlacement:o,placement:u,strategy:r,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});c=R??c,l=A??l,g[w]={...g[w],...F},S&&h<Td&&(h++,typeof S=="object"&&(S.placement&&(u=S.placement),S.rects&&(f=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):S.rects),{x:c,y:l}=es(f,u,m)),v=-1)}return{x:c,y:l,placement:u,strategy:r,middlewareData:g}},Id=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:c=0}=Xe(e,t)||{};if(f==null)return{};const l=ia(c),u={x:n,y:o},h=Qr(r),g=Yr(h),v=await a.getDimensions(f),y=h==="y",w=y?"top":"left",_=y?"bottom":"right",R=y?"clientHeight":"clientWidth",A=s.reference[g]+s.reference[h]-u[h]-s.floating[g],F=u[h]-s.reference[h],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let j=S?S[R]:0;(!j||!await(a.isElement==null?void 0:a.isElement(S)))&&(j=i.floating[R]||s.floating[g]);const x=A/2-F/2,b=j/2-v[g]/2-1,I=it(l[w],b),O=it(l[_],b),M=I,$=j-v[g]-O,P=j/2-v[g]/2+x,z=Rr(M,P,$),E=!m.arrow&&$t(r)!=null&&P!==z&&s.reference[g]/2-(P<M?I:O)-v[g]/2<0,C=E?P<M?P-M:P-$:0;return{[h]:u[h]+C,data:{[h]:z,centerOffset:P-z-C,...E&&{alignmentOffset:C}},reset:E}}}),Pd=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:c=!0,crossAxis:l=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...y}=Xe(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=Ye(r),_=Ue(i),R=Ye(i)===i,A=await(m.isRTL==null?void 0:m.isRTL(f.floating)),F=u||(R||!v?[_n(i)]:Sd(i)),S=g!=="none";!u&&S&&F.push(..._d(i,v,g,A));const j=[i,...F],x=await m.detectOverflow(t,y),b=[];let I=((o=s.flip)==null?void 0:o.overflows)||[];if(c&&b.push(x[w]),l){const P=Cd(r,a,A);b.push(x[P[0]],x[P[1]])}if(I=[...I,{placement:r,overflows:b}],!b.every(P=>P<=0)){var O,M;const P=(((O=s.flip)==null?void 0:O.index)||0)+1,z=j[P];if(z&&(!(l==="alignment"?_!==Ue(z):!1)||I.every(D=>Ue(D.placement)===_?D.overflows[0]>0:!0)))return{data:{index:P,overflows:I},reset:{placement:z}};let E=(M=I.filter(C=>C.overflows[0]<=0).sort((C,D)=>C.overflows[1]-D.overflows[1])[0])==null?void 0:M.placement;if(!E)switch(h){case"bestFit":{var $;const C=($=I.filter(D=>{if(S){const k=Ue(D.placement);return k===_||k==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(k=>k>0).reduce((k,N)=>k+N,0)]).sort((D,k)=>D[1]-k[1])[0])==null?void 0:$[0];C&&(E=C);break}case"initialPlacement":E=i;break}if(r!==E)return{reset:{placement:E}}}return{}}}};function ts(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ns(e){return wd.some(t=>e[t]>=0)}const Md=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=Xe(e,t);switch(r){case"referenceHidden":{const a=await o.detectOverflow(t,{...s,elementContext:"reference"}),i=ts(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ns(i)}}}case"escaped":{const a=await o.detectOverflow(t,{...s,altBoundary:!0}),i=ts(a,n.floating);return{data:{escapedOffsets:i,escaped:ns(i)}}}default:return{}}}}},la=new Set(["left","top"]);async function Od(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=Ye(n),i=$t(n),m=Ue(n)==="y",f=la.has(a)?-1:1,c=s&&m?-1:1,l=Xe(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:g}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return i&&typeof g=="number"&&(h=i==="end"?g*-1:g),m?{x:h*c,y:u*f}:{x:u*f,y:h*c}}const Dd=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 Od(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}}}}},Ld=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:w=>{let{x:_,y:R}=w;return{x:_,y:R}}},...f}=Xe(e,t),c={x:n,y:o},l=await s.detectOverflow(t,f),u=Ue(Ye(r)),h=Xr(u);let g=c[h],v=c[u];if(a){const w=h==="y"?"top":"left",_=h==="y"?"bottom":"right",R=g+l[w],A=g-l[_];g=Rr(R,g,A)}if(i){const w=u==="y"?"top":"left",_=u==="y"?"bottom":"right",R=v+l[w],A=v-l[_];v=Rr(R,v,A)}const y=m.fn({...t,[h]:g,[u]:v});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[h]:a,[u]:i}}}}}},Fd=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=Xe(e,t),c={x:n,y:o},l=Ue(r),u=Xr(l);let h=c[u],g=c[l];const v=Xe(i,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const R=u==="y"?"height":"width",A=s.reference[u]-s.floating[R]+y.mainAxis,F=s.reference[u]+s.reference[R]-y.mainAxis;h<A?h=A:h>F&&(h=F)}if(f){var w,_;const R=u==="y"?"width":"height",A=la.has(Ye(r)),F=s.reference[l]-s.floating[R]+(A&&((w=a.offset)==null?void 0:w[l])||0)+(A?0:y.crossAxis),S=s.reference[l]+s.reference[R]+(A?0:((_=a.offset)==null?void 0:_[l])||0)-(A?y.crossAxis:0);g<F?g=F:g>S&&(g=S)}return{[u]:h,[l]:g}}}},$d=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=Xe(e,t),c=await a.detectOverflow(t,f),l=Ye(r),u=$t(r),h=Ue(r)==="y",{width:g,height:v}=s.floating;let y,w;l==="top"||l==="bottom"?(y=l,w=u===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(w=l,y=u==="end"?"top":"bottom");const _=v-c.top-c.bottom,R=g-c.left-c.right,A=it(v-c[y],_),F=it(g-c[w],R),S=!t.middlewareData.shift;let j=A,x=F;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=R),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(j=_),S&&!u){const I=Ae(c.left,0),O=Ae(c.right,0),M=Ae(c.top,0),$=Ae(c.bottom,0);h?x=g-2*(I!==0||O!==0?I+O:Ae(c.left,c.right)):j=v-2*(M!==0||$!==0?M+$:Ae(c.top,c.bottom))}await m({...t,availableWidth:x,availableHeight:j});const b=await a.getDimensions(i.floating);return g!==b.width||v!==b.height?{reset:{rects:!0}}:{}}}};function Un(){return typeof window<"u"}function zt(e){return ca(e)?(e.nodeName||"").toLowerCase():"#document"}function _e(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function We(e){var t;return(t=(ca(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ca(e){return Un()?e instanceof Node||e instanceof _e(e).Node:!1}function Me(e){return Un()?e instanceof Element||e instanceof _e(e).Element:!1}function Ze(e){return Un()?e instanceof HTMLElement||e instanceof _e(e).HTMLElement:!1}function rs(e){return!Un()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _e(e).ShadowRoot}function sn(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Oe(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function zd(e){return/^(table|td|th)$/.test(zt(e))}function Bn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Ud=/transform|translate|scale|rotate|perspective|filter/,Bd=/paint|layout|strict|content/,vt=e=>!!e&&e!=="none";let cr;function Zr(e){const t=Me(e)?Oe(e):e;return vt(t.transform)||vt(t.translate)||vt(t.scale)||vt(t.rotate)||vt(t.perspective)||!Jr()&&(vt(t.backdropFilter)||vt(t.filter))||Ud.test(t.willChange||"")||Bd.test(t.contain||"")}function Hd(e){let t=lt(e);for(;Ze(t)&&!Dt(t);){if(Zr(t))return t;if(Bn(t))return null;t=lt(t)}return null}function Jr(){return cr==null&&(cr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),cr}function Dt(e){return/^(html|body|#document)$/.test(zt(e))}function Oe(e){return _e(e).getComputedStyle(e)}function Hn(e){return Me(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lt(e){if(zt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||rs(e)&&e.host||We(e);return rs(t)?t.host:t}function ua(e){const t=lt(e);return Dt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ze(t)&&sn(t)?t:ua(t)}function Qt(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=ua(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=_e(r);if(s){const i=Tr(a);return t.concat(a,a.visualViewport||[],sn(r)?r:[],i&&n?Qt(i):[])}else return t.concat(r,Qt(r,[],n))}function Tr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function da(e){const t=Oe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Ze(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,i=An(n)!==s||An(o)!==a;return i&&(n=s,o=a),{width:n,height:o,$:i}}function eo(e){return Me(e)?e:e.contextElement}function Pt(e){const t=eo(e);if(!Ze(t))return Be(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=da(t);let a=(s?An(n.width):n.width)/o,i=(s?An(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Wd=Be(0);function fa(e){const t=_e(e);return!Jr()||!t.visualViewport?Wd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Gd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_e(e)?!1:t}function yt(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=eo(e);let a=Be(1);t&&(o?Me(o)&&(a=Pt(o)):a=Pt(e));const i=Gd(s,n,o)?fa(s):Be(0);let m=(r.left+i.x)/a.x,f=(r.top+i.y)/a.y,c=r.width/a.x,l=r.height/a.y;if(s){const u=_e(s),h=o&&Me(o)?_e(o):o;let g=u,v=Tr(g);for(;v&&o&&h!==g;){const y=Pt(v),w=v.getBoundingClientRect(),_=Oe(v),R=w.left+(v.clientLeft+parseFloat(_.paddingLeft))*y.x,A=w.top+(v.clientTop+parseFloat(_.paddingTop))*y.y;m*=y.x,f*=y.y,c*=y.x,l*=y.y,m+=R,f+=A,g=_e(v),v=Tr(g)}}return Rn({width:c,height:l,x:m,y:f})}function Wn(e,t){const n=Hn(e).scrollLeft;return t?t.left+n:yt(We(e)).left+n}function ma(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Wn(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Vd(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=We(o),i=t?Bn(t.floating):!1;if(o===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Be(1);const c=Be(0),l=Ze(o);if((l||!l&&!s)&&((zt(o)!=="body"||sn(a))&&(m=Hn(o)),l)){const h=yt(o);f=Pt(o),c.x=h.x+o.clientLeft,c.y=h.y+o.clientTop}const u=a&&!l&&!s?ma(a,m):Be(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+c.x+u.x,y:n.y*f.y-m.scrollTop*f.y+c.y+u.y}}function Kd(e){return Array.from(e.getClientRects())}function qd(e){const t=We(e),n=Hn(e),o=e.ownerDocument.body,r=Ae(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=Ae(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+Wn(e);const i=-n.scrollTop;return Oe(o).direction==="rtl"&&(a+=Ae(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:i}}const os=25;function Xd(e,t){const n=_e(e),o=We(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,i=0,m=0;if(r){s=r.width,a=r.height;const c=Jr();(!c||c&&t==="fixed")&&(i=r.offsetLeft,m=r.offsetTop)}const f=Wn(o);if(f<=0){const c=o.ownerDocument,l=c.body,u=getComputedStyle(l),h=c.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,g=Math.abs(o.clientWidth-l.clientWidth-h);g<=os&&(s-=g)}else f<=os&&(s+=f);return{width:s,height:a,x:i,y:m}}function Yd(e,t){const n=yt(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=Ze(e)?Pt(e):Be(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=r*s.x,f=o*s.y;return{width:a,height:i,x:m,y:f}}function ss(e,t,n){let o;if(t==="viewport")o=Xd(e,n);else if(t==="document")o=qd(We(e));else if(Me(t))o=Yd(t,n);else{const r=fa(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Rn(o)}function pa(e,t){const n=lt(e);return n===t||!Me(n)||Dt(n)?!1:Oe(n).position==="fixed"||pa(n,t)}function Qd(e,t){const n=t.get(e);if(n)return n;let o=Qt(e,[],!1).filter(i=>Me(i)&&zt(i)!=="body"),r=null;const s=Oe(e).position==="fixed";let a=s?lt(e):e;for(;Me(a)&&!Dt(a);){const i=Oe(a),m=Zr(a);!m&&i.position==="fixed"&&(r=null),(s?!m&&!r:!m&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||sn(a)&&!m&&pa(e,a))?o=o.filter(c=>c!==a):r=i,a=lt(a)}return t.set(e,o),o}function Zd(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?Bn(t)?[]:Qd(t,this._c):[].concat(n),o],i=ss(t,a[0],r);let m=i.top,f=i.right,c=i.bottom,l=i.left;for(let u=1;u<a.length;u++){const h=ss(t,a[u],r);m=Ae(h.top,m),f=it(h.right,f),c=it(h.bottom,c),l=Ae(h.left,l)}return{width:f-l,height:c-m,x:l,y:m}}function Jd(e){const{width:t,height:n}=da(e);return{width:t,height:n}}function ef(e,t,n){const o=Ze(t),r=We(t),s=n==="fixed",a=yt(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Be(0);function f(){m.x=Wn(r)}if(o||!o&&!s)if((zt(t)!=="body"||sn(r))&&(i=Hn(t)),o){const h=yt(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else r&&f();s&&!o&&r&&f();const c=r&&!o&&!s?ma(r,i):Be(0),l=a.left+i.scrollLeft-m.x-c.x,u=a.top+i.scrollTop-m.y-c.y;return{x:l,y:u,width:a.width,height:a.height}}function ur(e){return Oe(e).position==="static"}function as(e,t){if(!Ze(e)||Oe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return We(e)===n&&(n=n.ownerDocument.body),n}function ha(e,t){const n=_e(e);if(Bn(e))return n;if(!Ze(e)){let r=lt(e);for(;r&&!Dt(r);){if(Me(r)&&!ur(r))return r;r=lt(r)}return n}let o=as(e,t);for(;o&&zd(o)&&ur(o);)o=as(o,t);return o&&Dt(o)&&ur(o)&&!Zr(o)?n:o||Hd(e)||n}const tf=async function(e){const t=this.getOffsetParent||ha,n=this.getDimensions,o=await n(e.floating);return{reference:ef(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function nf(e){return Oe(e).direction==="rtl"}const rf={convertOffsetParentRelativeRectToViewportRelativeRect:Vd,getDocumentElement:We,getClippingRect:Zd,getOffsetParent:ha,getElementRects:tf,getClientRects:Kd,getDimensions:Jd,getScale:Pt,isElement:Me,isRTL:nf};function ga(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function of(e,t){let n=null,o;const r=We(e);function s(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),s();const f=e.getBoundingClientRect(),{left:c,top:l,width:u,height:h}=f;if(i||t(),!u||!h)return;const g=xn(l),v=xn(r.clientWidth-(c+u)),y=xn(r.clientHeight-(l+h)),w=xn(c),R={rootMargin:-g+"px "+-v+"px "+-y+"px "+-w+"px",threshold:Ae(0,it(1,m))||1};let A=!0;function F(S){const j=S[0].intersectionRatio;if(j!==m){if(!A)return a();j?a(!1,j):o=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!ga(f,e.getBoundingClientRect())&&a(),A=!1}try{n=new IntersectionObserver(F,{...R,root:r.ownerDocument})}catch{n=new IntersectionObserver(F,R)}n.observe(e)}return a(!0),s}function sf(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=eo(e),c=r||s?[...f?Qt(f):[],...t?Qt(t):[]]:[];c.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const l=f&&i?of(f,n):null;let u=-1,h=null;a&&(h=new ResizeObserver(w=>{let[_]=w;_&&_.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var R;(R=h)==null||R.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?yt(e):null;m&&y();function y(){const w=yt(e);v&&!ga(v,w)&&n(),v=w,g=requestAnimationFrame(y)}return n(),()=>{var w;c.forEach(_=>{r&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),l==null||l(),(w=h)==null||w.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const af=Dd,lf=Ld,cf=Pd,uf=$d,df=Md,is=Id,ff=Fd,mf=(e,t,n)=>{const o=new Map,r={platform:rf,...n},s={...r.platform,_c:o};return Nd(e,t,{...r,platform:s})};var pf=typeof document<"u",hf=function(){},Cn=pf?p.useLayoutEffect:hf;function jn(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(!jn(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)&&!jn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function xa(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ls(e,t){const n=xa(e);return Math.round(t*n)/n}function dr(e){const t=p.useRef(e);return Cn(()=>{t.current=e}),t}function gf(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[c,l]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,h]=p.useState(o);jn(u,o)||h(o);const[g,v]=p.useState(null),[y,w]=p.useState(null),_=p.useCallback(D=>{D!==S.current&&(S.current=D,v(D))},[]),R=p.useCallback(D=>{D!==j.current&&(j.current=D,w(D))},[]),A=s||g,F=a||y,S=p.useRef(null),j=p.useRef(null),x=p.useRef(c),b=m!=null,I=dr(m),O=dr(r),M=dr(f),$=p.useCallback(()=>{if(!S.current||!j.current)return;const D={placement:t,strategy:n,middleware:u};O.current&&(D.platform=O.current),mf(S.current,j.current,D).then(k=>{const N={...k,isPositioned:M.current!==!1};P.current&&!jn(x.current,N)&&(x.current=N,As.flushSync(()=>{l(N)}))})},[u,t,n,O,M]);Cn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,l(D=>({...D,isPositioned:!1})))},[f]);const P=p.useRef(!1);Cn(()=>(P.current=!0,()=>{P.current=!1}),[]),Cn(()=>{if(A&&(S.current=A),F&&(j.current=F),A&&F){if(I.current)return I.current(A,F,$);$()}},[A,F,$,I,b]);const z=p.useMemo(()=>({reference:S,floating:j,setReference:_,setFloating:R}),[_,R]),E=p.useMemo(()=>({reference:A,floating:F}),[A,F]),C=p.useMemo(()=>{const D={position:n,left:0,top:0};if(!E.floating)return D;const k=ls(E.floating,c.x),N=ls(E.floating,c.y);return i?{...D,transform:"translate("+k+"px, "+N+"px)",...xa(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:N}},[n,i,E.floating,c.x,c.y]);return p.useMemo(()=>({...c,update:$,refs:z,elements:E,floatingStyles:C}),[c,$,z,E,C])}const xf=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?is({element:o.current,padding:r}).fn(n):{}:o?is({element:o,padding:r}).fn(n):{}}}},vf=(e,t)=>{const n=af(e);return{name:n.name,fn:n.fn,options:[e,t]}},bf=(e,t)=>{const n=lf(e);return{name:n.name,fn:n.fn,options:[e,t]}},wf=(e,t)=>({fn:ff(e).fn,options:[e,t]}),yf=(e,t)=>{const n=cf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cf=(e,t)=>{const n=uf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sf=(e,t)=>{const n=df(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ef=(e,t)=>{const n=xf(e);return{name:n.name,fn:n.fn,options:[e,t]}};var kf="Arrow",va=p.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return d.jsx(ue.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});va.displayName=kf;var Af=va;function _f(e){const[t,n]=p.useState(void 0);return Ke(()=>{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 to="Popper",[ba,Ut]=Qe(to),[Rf,wa]=ba(to),ya=e=>{const{__scopePopper:t,children:n}=e,[o,r]=p.useState(null);return d.jsx(Rf,{scope:t,anchor:o,onAnchorChange:r,children:n})};ya.displayName=to;var Ca="PopperAnchor",Sa=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=wa(Ca,n),a=p.useRef(null),i=pe(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(o==null?void 0:o.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),o?null:d.jsx(ue.div,{...r,ref:i})});Sa.displayName=Ca;var no="PopperContent",[jf,Tf]=ba(no),Ea=p.forwardRef((e,t)=>{var V,Y,K,ne,ae,le;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:c=0,sticky:l="partial",hideWhenDetached:u=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,y=wa(no,n),[w,_]=p.useState(null),R=pe(t,me=>_(me)),[A,F]=p.useState(null),S=_f(A),j=(S==null?void 0:S.width)??0,x=(S==null?void 0:S.height)??0,b=o+(s!=="center"?"-"+s:""),I=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},O=Array.isArray(f)?f:[f],M=O.length>0,$={padding:I,boundary:O.filter(If),altBoundary:M},{refs:P,floatingStyles:z,placement:E,isPositioned:C,middlewareData:D}=gf({strategy:"fixed",placement:b,whileElementsMounted:(...me)=>sf(...me,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[vf({mainAxis:r+x,alignmentAxis:a}),m&&bf({mainAxis:!0,crossAxis:!1,limiter:l==="partial"?wf():void 0,...$}),m&&yf({...$}),Cf({...$,apply:({elements:me,rects:W,availableWidth:q,availableHeight:Z})=>{const{width:te,height:ie}=W.reference,re=me.floating.style;re.setProperty("--radix-popper-available-width",`${q}px`),re.setProperty("--radix-popper-available-height",`${Z}px`),re.setProperty("--radix-popper-anchor-width",`${te}px`),re.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),A&&Ef({element:A,padding:i}),Pf({arrowWidth:j,arrowHeight:x}),u&&Sf({strategy:"referenceHidden",...$})]}),[k,N]=_a(E),H=qe(g);Ke(()=>{C&&(H==null||H())},[C,H]);const T=(V=D.arrow)==null?void 0:V.x,B=(Y=D.arrow)==null?void 0:Y.y,U=((K=D.arrow)==null?void 0:K.centerOffset)!==0,[L,G]=p.useState();return Ke(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),d.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:C?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:L,"--radix-popper-transform-origin":[(ne=D.transformOrigin)==null?void 0:ne.x,(ae=D.transformOrigin)==null?void 0:ae.y].join(" "),...((le=D.hide)==null?void 0:le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(jf,{scope:n,placedSide:k,onArrowChange:F,arrowX:T,arrowY:B,shouldHideArrow:U,children:d.jsx(ue.div,{"data-side":k,"data-align":N,...v,ref:R,style:{...v.style,animation:C?void 0:"none"}})})})});Ea.displayName=no;var ka="PopperArrow",Nf={top:"bottom",right:"left",bottom:"top",left:"right"},Aa=p.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=Tf(ka,o),a=Nf[s.placedSide];return d.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:d.jsx(Af,{...r,ref:n,style:{...r.style,display:"block"}})})});Aa.displayName=ka;function If(e){return e!==null}var Pf=e=>({name:"transformOrigin",options:e,fn(t){var y,w,_;const{placement:n,rects:o,middlewareData:r}=t,a=((y=r.arrow)==null?void 0:y.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,c]=_a(n),l={start:"0%",center:"50%",end:"100%"}[c],u=(((w=r.arrow)==null?void 0:w.x)??0)+i/2,h=(((_=r.arrow)==null?void 0:_.y)??0)+m/2;let g="",v="";return f==="bottom"?(g=a?l:`${u}px`,v=`${-m}px`):f==="top"?(g=a?l:`${u}px`,v=`${o.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?l:`${h}px`):f==="left"&&(g=`${o.floating.width+m}px`,v=a?l:`${h}px`),{data:{x:g,y:v}}}});function _a(e){const[t,n="center"]=e.split("-");return[t,n]}var ro=ya,Gn=Sa,oo=Ea,so=Aa,Mf="Portal",an=p.forwardRef((e,t)=>{var i;const{container:n,...o}=e,[r,s]=p.useState(!1);Ke(()=>s(!0),[]);const a=n||r&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?Ml.createPortal(d.jsx(ue.div,{...o,ref:t}),a):null});an.displayName=Mf;function Of(e,t){return p.useReducer((n,o)=>t[n][o]??n,e)}var je=e=>{const{present:t,children:n}=e,o=Df(t),r=typeof n=="function"?n({present:o.isPresent}):p.Children.only(n),s=pe(o.ref,Lf(r));return typeof n=="function"||o.isPresent?p.cloneElement(r,{ref:s}):null};je.displayName="Presence";function Df(e){const[t,n]=p.useState(),o=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Of(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=vn(o.current);s.current=i==="mounted"?f:"none"},[i]),Ke(()=>{const f=o.current,c=r.current;if(c!==e){const u=s.current,h=vn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(c&&u!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,m]),Ke(()=>{if(t){let f;const c=t.ownerDocument.defaultView??window,l=h=>{const v=vn(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!r.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",f=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},u=h=>{h.target===t&&(s.current=vn(o.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{c.clearTimeout(f),t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function vn(e){return(e==null?void 0:e.animationName)||"none"}function Lf(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 fr="rovingFocusGroup.onEntryFocus",Ff={bubbles:!1,cancelable:!0},ln="RovingFocusGroup",[Nr,Ra,$f]=na(ln),[zf,ja]=Qe(ln,[$f]),[Uf,Bf]=zf(ln),Ta=p.forwardRef((e,t)=>d.jsx(Nr.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Nr.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Hf,{...e,ref:t})})}));Ta.displayName=ln;var Hf=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:c=!1,...l}=e,u=p.useRef(null),h=pe(t,u),g=ra(s),[v,y]=at({prop:a,defaultProp:i??null,onChange:m,caller:ln}),[w,_]=p.useState(!1),R=qe(f),A=Ra(n),F=p.useRef(!1),[S,j]=p.useState(0);return p.useEffect(()=>{const x=u.current;if(x)return x.addEventListener(fr,R),()=>x.removeEventListener(fr,R)},[R]),d.jsx(Uf,{scope:n,orientation:o,dir:g,loop:r,currentTabStopId:v,onItemFocus:p.useCallback(x=>y(x),[y]),onItemShiftTab:p.useCallback(()=>_(!0),[]),onFocusableItemAdd:p.useCallback(()=>j(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>j(x=>x-1),[]),children:d.jsx(ue.div,{tabIndex:w||S===0?-1:0,"data-orientation":o,...l,ref:h,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,()=>{F.current=!0}),onFocus:ee(e.onFocus,x=>{const b=!F.current;if(x.target===x.currentTarget&&b&&!w){const I=new CustomEvent(fr,Ff);if(x.currentTarget.dispatchEvent(I),!I.defaultPrevented){const O=A().filter(E=>E.focusable),M=O.find(E=>E.active),$=O.find(E=>E.id===v),z=[M,$,...O].filter(Boolean).map(E=>E.ref.current);Pa(z,c)}}F.current=!1}),onBlur:ee(e.onBlur,()=>_(!1))})})}),Na="RovingFocusGroupItem",Ia=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...i}=e,m=ye(),f=s||m,c=Bf(Na,n),l=c.currentTabStopId===f,u=Ra(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=c;return p.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),d.jsx(Nr.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:d.jsx(ue.span,{tabIndex:l?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:ee(e.onMouseDown,y=>{o?c.onItemFocus(f):y.preventDefault()}),onFocus:ee(e.onFocus,()=>c.onItemFocus(f)),onKeyDown:ee(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){c.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const w=Vf(y,c.orientation,c.dir);if(w!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let R=u().filter(A=>A.focusable).map(A=>A.ref.current);if(w==="last")R.reverse();else if(w==="prev"||w==="next"){w==="prev"&&R.reverse();const A=R.indexOf(y.currentTarget);R=c.loop?Kf(R,A+1):R.slice(A+1)}setTimeout(()=>Pa(R))}}),children:typeof a=="function"?a({isCurrentTabStop:l,hasTabStop:v!=null}):a})})});Ia.displayName=Na;var Wf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Gf(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Vf(e,t,n){const o=Gf(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Wf[o]}function Pa(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Kf(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var qf=Ta,Xf=Ia,Yf=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},jt=new WeakMap,bn=new WeakMap,wn={},mr=0,Ma=function(e){return e&&(e.host||Ma(e.parentNode))},Qf=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=Ma(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})},Zf=function(e,t,n,o){var r=Qf(t,Array.isArray(e)?e:[e]);wn[n]||(wn[n]=new WeakMap);var s=wn[n],a=[],i=new Set,m=new Set(r),f=function(l){!l||i.has(l)||(i.add(l),f(l.parentNode))};r.forEach(f);var c=function(l){!l||m.has(l)||Array.prototype.forEach.call(l.children,function(u){if(i.has(u))c(u);else try{var h=u.getAttribute(o),g=h!==null&&h!=="false",v=(jt.get(u)||0)+1,y=(s.get(u)||0)+1;jt.set(u,v),s.set(u,y),a.push(u),v===1&&g&&bn.set(u,!0),y===1&&u.setAttribute(n,"true"),g||u.setAttribute(o,"true")}catch(w){console.error("aria-hidden: cannot operate on ",u,w)}})};return c(t),i.clear(),mr++,function(){a.forEach(function(l){var u=jt.get(l)-1,h=s.get(l)-1;jt.set(l,u),s.set(l,h),u||(bn.has(l)||l.removeAttribute(o),bn.delete(l)),h||l.removeAttribute(n)}),mr--,mr||(jt=new WeakMap,jt=new WeakMap,bn=new WeakMap,wn={})}},ao=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Yf(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Zf(o,r,n,"aria-hidden")):function(){return null}},Ir=["Enter"," "],Jf=["ArrowDown","PageUp","Home"],Oa=["ArrowUp","PageDown","End"],em=[...Jf,...Oa],tm={ltr:[...Ir,"ArrowRight"],rtl:[...Ir,"ArrowLeft"]},nm={ltr:["ArrowLeft"],rtl:["ArrowRight"]},cn="Menu",[Zt,rm,om]=na(cn),[At,Da]=Qe(cn,[om,Ut,ja]),Vn=Ut(),La=ja(),[sm,_t]=At(cn),[am,un]=At(cn),Fa=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,i=Vn(t),[m,f]=p.useState(null),c=p.useRef(!1),l=qe(s),u=ra(r);return p.useEffect(()=>{const h=()=>{c.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>c.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),d.jsx(ro,{...i,children:d.jsx(sm,{scope:t,open:n,onOpenChange:l,content:m,onContentChange:f,children:d.jsx(am,{scope:t,onClose:p.useCallback(()=>l(!1),[l]),isUsingKeyboardRef:c,dir:u,modal:a,children:o})})})};Fa.displayName=cn;var im="MenuAnchor",io=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Vn(n);return d.jsx(Gn,{...r,...o,ref:t})});io.displayName=im;var lo="MenuPortal",[lm,$a]=At(lo,{forceMount:void 0}),za=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=_t(lo,t);return d.jsx(lm,{scope:t,forceMount:n,children:d.jsx(je,{present:n||s.open,children:d.jsx(an,{asChild:!0,container:r,children:o})})})};za.displayName=lo;var Ne="MenuContent",[cm,co]=At(Ne),Ua=p.forwardRef((e,t)=>{const n=$a(Ne,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=_t(Ne,e.__scopeMenu),a=un(Ne,e.__scopeMenu);return d.jsx(Zt.Provider,{scope:e.__scopeMenu,children:d.jsx(je,{present:o||s.open,children:d.jsx(Zt.Slot,{scope:e.__scopeMenu,children:a.modal?d.jsx(um,{...r,ref:t}):d.jsx(dm,{...r,ref:t})})})})}),um=p.forwardRef((e,t)=>{const n=_t(Ne,e.__scopeMenu),o=p.useRef(null),r=pe(t,o);return p.useEffect(()=>{const s=o.current;if(s)return ao(s)},[]),d.jsx(uo,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),dm=p.forwardRef((e,t)=>{const n=_t(Ne,e.__scopeMenu);return d.jsx(uo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),fm=Ot("MenuContent.ScrollLock"),uo=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,onDismiss:h,disableOutsideScroll:g,...v}=e,y=_t(Ne,n),w=un(Ne,n),_=Vn(n),R=La(n),A=rm(n),[F,S]=p.useState(null),j=p.useRef(null),x=pe(t,j,y.onContentChange),b=p.useRef(0),I=p.useRef(""),O=p.useRef(0),M=p.useRef(null),$=p.useRef("right"),P=p.useRef(0),z=g?Hr:p.Fragment,E=g?{as:fm,allowPinchZoom:!0}:void 0,C=k=>{var V,Y;const N=I.current+k,H=A().filter(K=>!K.disabled),T=document.activeElement,B=(V=H.find(K=>K.ref.current===T))==null?void 0:V.textValue,U=H.map(K=>K.textValue),L=Em(U,N,B),G=(Y=H.find(K=>K.textValue===L))==null?void 0:Y.ref.current;(function K(ne){I.current=ne,window.clearTimeout(b.current),ne!==""&&(b.current=window.setTimeout(()=>K(""),1e3))})(N),G&&setTimeout(()=>G.focus())};p.useEffect(()=>()=>window.clearTimeout(b.current),[]),qr();const D=p.useCallback(k=>{var H,T;return $.current===((H=M.current)==null?void 0:H.side)&&Am(k,(T=M.current)==null?void 0:T.area)},[]);return d.jsx(cm,{scope:n,searchRef:I,onItemEnter:p.useCallback(k=>{D(k)&&k.preventDefault()},[D]),onItemLeave:p.useCallback(k=>{var N;D(k)||((N=j.current)==null||N.focus(),S(null))},[D]),onTriggerLeave:p.useCallback(k=>{D(k)&&k.preventDefault()},[D]),pointerGraceTimerRef:O,onPointerGraceIntentChange:p.useCallback(k=>{M.current=k},[]),children:d.jsx(z,{...E,children:d.jsx(zn,{asChild:!0,trapped:r,onMountAutoFocus:ee(s,k=>{var N;k.preventDefault(),(N=j.current)==null||N.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:d.jsx(on,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,onDismiss:h,children:d.jsx(qf,{asChild:!0,...R,dir:w.dir,orientation:"vertical",loop:o,currentTabStopId:F,onCurrentTabStopIdChange:S,onEntryFocus:ee(m,k=>{w.isUsingKeyboardRef.current||k.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(oo,{role:"menu","aria-orientation":"vertical","data-state":ri(y.open),"data-radix-menu-content":"",dir:w.dir,..._,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:ee(v.onKeyDown,k=>{const H=k.target.closest("[data-radix-menu-content]")===k.currentTarget,T=k.ctrlKey||k.altKey||k.metaKey,B=k.key.length===1;H&&(k.key==="Tab"&&k.preventDefault(),!T&&B&&C(k.key));const U=j.current;if(k.target!==U||!em.includes(k.key))return;k.preventDefault();const G=A().filter(V=>!V.disabled).map(V=>V.ref.current);Oa.includes(k.key)&&G.reverse(),Cm(G)}),onBlur:ee(e.onBlur,k=>{k.currentTarget.contains(k.target)||(window.clearTimeout(b.current),I.current="")}),onPointerMove:ee(e.onPointerMove,Jt(k=>{const N=k.target,H=P.current!==k.clientX;if(k.currentTarget.contains(N)&&H){const T=k.clientX>P.current?"right":"left";$.current=T,P.current=k.clientX}}))})})})})})})});Ua.displayName=Ne;var mm="MenuGroup",fo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return d.jsx(ue.div,{role:"group",...o,ref:t})});fo.displayName=mm;var pm="MenuLabel",Ba=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return d.jsx(ue.div,{...o,ref:t})});Ba.displayName=pm;var Tn="MenuItem",cs="menu.itemSelect",Kn=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=p.useRef(null),a=un(Tn,e.__scopeMenu),i=co(Tn,e.__scopeMenu),m=pe(t,s),f=p.useRef(!1),c=()=>{const l=s.current;if(!n&&l){const u=new CustomEvent(cs,{bubbles:!0,cancelable:!0});l.addEventListener(cs,h=>o==null?void 0:o(h),{once:!0}),ta(l,u),u.defaultPrevented?f.current=!1:a.onClose()}};return d.jsx(Ha,{...r,ref:m,disabled:n,onClick:ee(e.onClick,c),onPointerDown:l=>{var u;(u=e.onPointerDown)==null||u.call(e,l),f.current=!0},onPointerUp:ee(e.onPointerUp,l=>{var u;f.current||(u=l.currentTarget)==null||u.click()}),onKeyDown:ee(e.onKeyDown,l=>{const u=i.searchRef.current!=="";n||u&&l.key===" "||Ir.includes(l.key)&&(l.currentTarget.click(),l.preventDefault())})})});Kn.displayName=Tn;var Ha=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=co(Tn,n),i=La(n),m=p.useRef(null),f=pe(t,m),[c,l]=p.useState(!1),[u,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[s.children]),d.jsx(Zt.ItemSlot,{scope:n,disabled:o,textValue:r??u,children:d.jsx(Xf,{asChild:!0,...i,focusable:!o,children:d.jsx(ue.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:ee(e.onPointerMove,Jt(g=>{o?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ee(e.onPointerLeave,Jt(g=>a.onItemLeave(g))),onFocus:ee(e.onFocus,()=>l(!0)),onBlur:ee(e.onBlur,()=>l(!1))})})})}),hm="MenuCheckboxItem",Wa=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return d.jsx(Xa,{scope:e.__scopeMenu,checked:n,children:d.jsx(Kn,{role:"menuitemcheckbox","aria-checked":Nn(n)?"mixed":n,...r,ref:t,"data-state":po(n),onSelect:ee(r.onSelect,()=>o==null?void 0:o(Nn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wa.displayName=hm;var Ga="MenuRadioGroup",[gm,xm]=At(Ga,{value:void 0,onValueChange:()=>{}}),Va=p.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=qe(o);return d.jsx(gm,{scope:e.__scopeMenu,value:n,onValueChange:s,children:d.jsx(fo,{...r,ref:t})})});Va.displayName=Ga;var Ka="MenuRadioItem",qa=p.forwardRef((e,t)=>{const{value:n,...o}=e,r=xm(Ka,e.__scopeMenu),s=n===r.value;return d.jsx(Xa,{scope:e.__scopeMenu,checked:s,children:d.jsx(Kn,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":po(s),onSelect:ee(o.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,n)},{checkForDefaultPrevented:!1})})})});qa.displayName=Ka;var mo="MenuItemIndicator",[Xa,vm]=At(mo,{checked:!1}),Ya=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=vm(mo,n);return d.jsx(je,{present:o||Nn(s.checked)||s.checked===!0,children:d.jsx(ue.span,{...r,ref:t,"data-state":po(s.checked)})})});Ya.displayName=mo;var bm="MenuSeparator",Qa=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return d.jsx(ue.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});Qa.displayName=bm;var wm="MenuArrow",Za=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Vn(n);return d.jsx(so,{...r,...o,ref:t})});Za.displayName=wm;var ym="MenuSub",[vv,Ja]=At(ym),Xt="MenuSubTrigger",ei=p.forwardRef((e,t)=>{const n=_t(Xt,e.__scopeMenu),o=un(Xt,e.__scopeMenu),r=Ja(Xt,e.__scopeMenu),s=co(Xt,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=s,f={__scopeMenu:e.__scopeMenu},c=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>c,[c]),p.useEffect(()=>{const l=i.current;return()=>{window.clearTimeout(l),m(null)}},[i,m]),d.jsx(io,{asChild:!0,...f,children:d.jsx(Ha,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":ri(n.open),...e,ref:He(t,r.onTriggerChange),onClick:l=>{var u;(u=e.onClick)==null||u.call(e,l),!(e.disabled||l.defaultPrevented)&&(l.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ee(e.onPointerMove,Jt(l=>{s.onItemEnter(l),!l.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100))})),onPointerLeave:ee(e.onPointerLeave,Jt(l=>{var h,g;c();const u=(h=n.content)==null?void 0:h.getBoundingClientRect();if(u){const v=(g=n.content)==null?void 0:g.dataset.side,y=v==="right",w=y?-5:5,_=u[y?"left":"right"],R=u[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:l.clientX+w,y:l.clientY},{x:_,y:u.top},{x:R,y:u.top},{x:R,y:u.bottom},{x:_,y:u.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(l),l.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ee(e.onKeyDown,l=>{var h;const u=s.searchRef.current!=="";e.disabled||u&&l.key===" "||tm[o.dir].includes(l.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),l.preventDefault())})})})});ei.displayName=Xt;var ti="MenuSubContent",ni=p.forwardRef((e,t)=>{const n=$a(Ne,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=_t(Ne,e.__scopeMenu),a=un(Ne,e.__scopeMenu),i=Ja(ti,e.__scopeMenu),m=p.useRef(null),f=pe(t,m);return d.jsx(Zt.Provider,{scope:e.__scopeMenu,children:d.jsx(je,{present:o||s.open,children:d.jsx(Zt.Slot,{scope:e.__scopeMenu,children:d.jsx(uo,{id:i.contentId,"aria-labelledby":i.triggerId,...r,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var l;a.isUsingKeyboardRef.current&&((l=m.current)==null||l.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:ee(e.onFocusOutside,c=>{c.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ee(e.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:ee(e.onKeyDown,c=>{var h;const l=c.currentTarget.contains(c.target),u=nm[a.dir].includes(c.key);l&&u&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),c.preventDefault())})})})})})});ni.displayName=ti;function ri(e){return e?"open":"closed"}function Nn(e){return e==="indeterminate"}function po(e){return Nn(e)?"indeterminate":e?"checked":"unchecked"}function Cm(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Sm(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function Em(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=Sm(e,Math.max(s,0));r.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(r.toLowerCase()));return m!==n?m:void 0}function km(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,c=i.y,l=m.x,u=m.y;c>o!=u>o&&n<(l-f)*(o-c)/(u-c)+f&&(r=!r)}return r}function Am(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return km(n,t)}function Jt(e){return t=>t.pointerType==="mouse"?e(t):void 0}var _m=Fa,Rm=io,jm=za,Tm=Ua,Nm=fo,Im=Ba,Pm=Kn,Mm=Wa,Om=Va,Dm=qa,Lm=Ya,Fm=Qa,$m=Za,zm=ei,Um=ni,qn="DropdownMenu",[Bm]=Qe(qn,[Da]),Ce=Da(),[Hm,oi]=Bm(qn),si=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Ce(t),f=p.useRef(null),[c,l]=at({prop:r,defaultProp:s??!1,onChange:a,caller:qn});return d.jsx(Hm,{scope:t,triggerId:ye(),triggerRef:f,contentId:ye(),open:c,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(u=>!u),[l]),modal:i,children:d.jsx(_m,{...m,open:c,onOpenChange:l,dir:o,modal:i,children:n})})};si.displayName=qn;var ai="DropdownMenuTrigger",ii=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=oi(ai,n),a=Ce(n);return d.jsx(Rm,{asChild:!0,...a,children:d.jsx(ue.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:He(t,s.triggerRef),onPointerDown:ee(e.onPointerDown,i=>{!o&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:ee(e.onKeyDown,i=>{o||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});ii.displayName=ai;var Wm="DropdownMenuPortal",li=e=>{const{__scopeDropdownMenu:t,...n}=e,o=Ce(t);return d.jsx(jm,{...o,...n})};li.displayName=Wm;var ci="DropdownMenuContent",ui=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=oi(ci,n),s=Ce(n),a=p.useRef(!1);return d.jsx(Tm,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:ee(e.onCloseAutoFocus,i=>{var m;a.current||(m=r.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:ee(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,c=m.button===2||f;(!r.modal||c)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ui.displayName=ci;var Gm="DropdownMenuGroup",Vm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(Nm,{...r,...o,ref:t})});Vm.displayName=Gm;var Km="DropdownMenuLabel",qm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(Im,{...r,...o,ref:t})});qm.displayName=Km;var Xm="DropdownMenuItem",di=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(Pm,{...r,...o,ref:t})});di.displayName=Xm;var Ym="DropdownMenuCheckboxItem",Qm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(Mm,{...r,...o,ref:t})});Qm.displayName=Ym;var Zm="DropdownMenuRadioGroup",Jm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(Om,{...r,...o,ref:t})});Jm.displayName=Zm;var ep="DropdownMenuRadioItem",tp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(Dm,{...r,...o,ref:t})});tp.displayName=ep;var np="DropdownMenuItemIndicator",rp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(Lm,{...r,...o,ref:t})});rp.displayName=np;var op="DropdownMenuSeparator",sp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(Fm,{...r,...o,ref:t})});sp.displayName=op;var ap="DropdownMenuArrow",ip=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx($m,{...r,...o,ref:t})});ip.displayName=ap;var lp="DropdownMenuSubTrigger",cp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(zm,{...r,...o,ref:t})});cp.displayName=lp;var up="DropdownMenuSubContent",dp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return d.jsx(Um,{...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)"}})});dp.displayName=up;var fp=si,mp=ii,pp=li,hp=ui,gp=di;function xp({...e}){return d.jsx(fp,{"data-slot":"dropdown-menu",...e})}function vp({...e}){return d.jsx(mp,{"data-slot":"dropdown-menu-trigger",...e})}function bp({className:e,sideOffset:t=4,...n}){return d.jsx(pp,{children:d.jsx(hp,{"data-slot":"dropdown-menu-content",sideOffset:t,className:J("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 wp({className:e,inset:t,variant:n="default",...o}){return d.jsx(gp,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:J("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})}const yp=[{value:"light",label:"Light",icon:d.jsx(Xs,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:d.jsx(Vs,{className:"h-4 w-4"})},{value:"system",label:"System",icon:d.jsx(ou,{className:"h-4 w-4"})}];function Cp(){const{theme:e,setTheme:t,resolvedTheme:n}=Pu();return d.jsxs(xp,{children:[d.jsx(vp,{asChild:!0,children:d.jsxs(kt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?d.jsx(Vs,{className:"h-4 w-4"}):d.jsx(Xs,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),d.jsx(bp,{align:"end",children:yp.map(o=>d.jsxs(wp,{onClick:()=>t(o.value),className:e===o.value?"bg-accent":"",children:[o.icon,d.jsx("span",{className:"ml-2",children:o.label})]},o.value))})]})}const us={"auth.setup.title":"首次部署","auth.setup.apiKey":"API Key","auth.setup.username":"管理员用户名","auth.setup.password":"密码","auth.setup.confirmPassword":"确认密码","auth.setup.submit":"初始化","auth.setup.passwordMismatch":"两次密码不一致","auth.setup.passwordTooShort":"密码至少 8 个字符","auth.setup.alreadyDone":"初始化已完成,请登录","auth.setup.invalidKey":"API Key 无效","auth.setup.description":"输入 RCS_API_KEYS 之一,并设置管理员账号密码。","auth.login.title":"登录","auth.login.username":"用户名","auth.login.password":"密码","auth.login.submit":"登录","auth.login.failed":"用户名或密码错误","auth.login.description":"输入你的用户名和密码以继续。","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.create.title":"创建团队","team.create.name":"团队名称","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.metaSession":"会话","session.metaEnvironment":"环境","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","user.settings.language":"语言","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘"},Sp={"auth.setup.title":"First-time setup","auth.setup.apiKey":"API Key","auth.setup.username":"Admin username","auth.setup.password":"Password","auth.setup.confirmPassword":"Confirm password","auth.setup.submit":"Initialize","auth.setup.passwordMismatch":"Passwords do not match","auth.setup.passwordTooShort":"Password must be at least 8 characters","auth.setup.alreadyDone":"Setup already completed. Please log in.","auth.setup.invalidKey":"Invalid API key","auth.setup.description":"Enter one of RCS_API_KEYS and set your admin credentials.","auth.login.title":"Login","auth.login.username":"Username","auth.login.password":"Password","auth.login.submit":"Log in","auth.login.failed":"Invalid username or password","auth.login.description":"Enter your username and password to continue.","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.create.title":"Create team","team.create.name":"Team Name","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.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","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.metaSession":"Session","session.metaEnvironment":"Environment","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.inputPlaceholder":"Type a message...","session.connectingAgent":"Connecting to agent...","session.connectionFailed":"Connection Failed","user.settings.language":"Language","user.settings.role":"Role","user.settings.backDashboard":"← Dashboard"};function Ep(){return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let ho=Ep();const Pr=new Set;function bv(e){ho=e,Pr.forEach(t=>t())}function kp(e){return Pr.add(e),()=>{Pr.delete(e)}}function Ap(){return p.useSyncExternalStore(kp,()=>ho)}function yn(e){return ho==="en"?Sp[e]??us[e]??e:us[e]??e}function _p({sessionTitle:e,sessionSource:t,onBack:n}){return Ap(),d.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:d.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[e?d.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[d.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[d.jsx(Bc,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:yn("nav.dashboard")})]}),d.jsx("span",{className:"text-text-muted/40",children:"/"}),d.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&d.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):d.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[d.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:d.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"var(--color-brand)"})}),d.jsx("span",{className:"hidden sm:inline",children:yn("nav.remoteControl")})]}),d.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!e&&d.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:yn("nav.dashboard"),children:[d.jsx(Jc,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:yn("nav.dashboard")})]}),d.jsx(Cp,{})]})]})})}function wv({status:e}){const t={active:"bg-status-active/20 text-status-active",running:"bg-status-running/20 text-status-running",idle:"bg-status-idle/20 text-status-idle",inactive:"bg-text-muted/20 text-text-muted",requires_action:"bg-status-warning/20 text-status-warning",archived:"bg-text-muted/20 text-text-muted",error:"bg-status-error/20 text-status-error"};return d.jsx("span",{className:J("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})}const Rp="";let In=null;function jp(e){In=e}function yv(){return In}let Vt=null;async function Tp(){return Vt||(Vt=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{Vt=null}})(),Vt)}class pr extends Error{constructor(n,o,r){super(n);se(this,"type");se(this,"status");this.name="ApiError",this.type=o,this.status=r}}async function De(e,t,n,o){const r={"Content-Type":"application/json"};In&&(r.Authorization=`Bearer ${In}`);const s=`${Rp}${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/")&&!o&&await Tp())return De(e,t,n,!0);let m;try{m=await i.json()}catch{throw i.ok?new pr("Invalid JSON response","parse_error",i.status):new pr(i.statusText,"http_error",i.status)}if(!i.ok){const c=m.error||{type:"unknown",message:i.statusText};throw new pr(c.message||c.type||"unknown",c.type||"unknown",i.status)}return m}function Cv(){return De("GET","/web/sessions/all")}function Sv(e){return De("GET",`/web/sessions/${e}`)}function Ev(e){return De("GET",`/web/sessions/${e}/history`)}function kv(){return De("GET","/web/environments")}function Av(e,t){return De("POST",`/web/sessions/${e}/events`,t)}function _v(e,t){return De("POST",`/web/sessions/${e}/control`,t)}function Rv(e){return De("POST",`/web/sessions/${e}/interrupt`)}function jv(e){return De("DELETE",`/web/sessions/${e}`)}function Tv(e){return De("POST","/web/sessions",e)}function Nv(e){return De("GET",`/web/sessions/s/${e}`)}function Np(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 fi extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const st=class st{constructor(t){se(this,"ws",null);se(this,"settings");se(this,"connectionState","disconnected");se(this,"sessionId",null);se(this,"_agentCapabilities",null);se(this,"_promptCapabilities",null);se(this,"_modelState",null);se(this,"_availableCommands",[]);se(this,"onModelChanged",new Set);se(this,"onModelStateChanged",new Set);se(this,"onAvailableCommandsChanged",null);se(this,"onSessionLoaded",null);se(this,"onSessionSwitching",null);se(this,"onConnectionStateChange",new Set);se(this,"onSessionUpdate",null);se(this,"onSessionCreated",null);se(this,"onPromptComplete",null);se(this,"onPermissionRequest",null);se(this,"onBrowserToolCall",null);se(this,"onErrorMessage",null);se(this,"onSessionDeleted",null);se(this,"onSessionRenamed",null);se(this,"pendingSessionList",null);se(this,"pendingSessionLoad",null);se(this,"pendingSessionResume",null);se(this,"pendingSessionTarget",null);se(this,"connectResolve",null);se(this,"connectReject",null);se(this,"heartbeatInterval",null);se(this,"heartbeatTimeout",null);se(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const o of this.onConnectionStateChange)o(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.resume)!==null}get supportsSessionList(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const o=new WebSocket(this.settings.proxyUrl,this.settings.token?[Np(this.settings.token)]:void 0);this.ws=o,o.onopen=()=>{if(this.ws!==o){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),o.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},o.onmessage=r=>{if(this.ws===o)try{const s=JSON.parse(r.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},o.onerror=()=>{var r;this.ws===o&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(r=this.connectReject)==null||r.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},o.onclose=r=>{if(this.ws===o){if(console.log("[ACPClient] WebSocket closed",r.code,r.reason),this.connectReject){const s=r.reason||`Connection closed (code: ${r.code})`;this.setState("error",s),this.connectReject(new Error(s)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(o){this.setState("error",o.message),n(o)}})}handleResponse(t){var n,o,r,s,a,i,m,f,c,l,u,h,g;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const v=((o=t.payload)==null?void 0:o.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(r=this.onErrorMessage)==null||r.call(this,v));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(s=this.onSessionCreated)==null||s.call(this,t.payload.sessionId);for(const w of this.onModelStateChanged)w(this._modelState);break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const w of this.onModelStateChanged)w(this._modelState);break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const w of this.onModelStateChanged)w(this._modelState);break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const y=(c=t.payload.update)==null?void 0:c.sessionUpdate;console.log("[ACPClient] session_update type:",y,"payload:",t.payload),y==="available_commands_update"&&(this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(l=this.onAvailableCommandsChanged)==null||l.call(this,this._availableCommands)),(u=this.onSessionUpdate)==null||u.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(g=this.onPermissionRequest)==null||g.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const w of this.onModelChanged)w(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const o=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:o})}catch(o){console.error("[ACPClient] Browser tool error:",o),this.send({type:"browser_tool_result",callId:t,result:{error:o.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=st.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"))},st.PONG_TIMEOUT_MS)},st.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 fi),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const o of this.onModelStateChanged)o(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]);const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};se(st,"HEARTBEAT_INTERVAL_MS",3e4),se(st,"PONG_TIMEOUT_MS",1e4),se(st,"MAX_MISSED_PONGS",2);let Mr=st;function Ip(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 mi(e,t){return new Promise((function(n,o){let r;return Pp(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 Pp=e=>new Promise(((t,n)=>{const o=new FileReader;o.addEventListener("load",(({target:{result:r}})=>{const s=new DataView(r);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const m=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const f=a+10;let c;switch(s.getUint16(f)){case 18761:c=!0;break;case 19789:c=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,c)!==42)return n("TIFF header contains invalid version");const l=s.getUint32(f+4,c),u=f+l+2+12*s.getUint16(f+l,c);for(let h=f+l+2;h<u;h+=12)if(s.getUint16(h,c)==274){if(s.getUint16(h+2,c)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,c)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,c);break}return t(r.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),o.readAsArrayBuffer(e)}));var Pn={},Mp={get exports(){return Pn},set exports(e){Pn=e}};(function(e){var t,n,o={};Mp.exports=o,o.parse=function(r,s){for(var a=o.bin.readUshort,i=o.bin.readUint,m=0,f={},c=new Uint8Array(r),l=c.length-4;i(c,l)!=101010256;)l--;m=l,m+=4;var u=a(c,m+=4);a(c,m+=2);var h=i(c,m+=2),g=i(c,m+=4);m+=4,m=g;for(var v=0;v<u;v++){i(c,m),m+=4,m+=4,m+=4,i(c,m+=4),h=i(c,m+=4);var y=i(c,m+=4),w=a(c,m+=4),_=a(c,m+2),R=a(c,m+4);m+=6;var A=i(c,m+=8);m+=4,m+=w+_+R,o._readLocal(c,A,f,h,y,s)}return f},o._readLocal=function(r,s,a,i,m,f){var c=o.bin.readUshort,l=o.bin.readUint;l(r,s),c(r,s+=4),c(r,s+=2);var u=c(r,s+=2);l(r,s+=2),l(r,s+=4),s+=4;var h=c(r,s+=8),g=c(r,s+=2);s+=2;var v=o.bin.readUTF8(r,s,h);if(s+=h,s+=g,f)a[v]={size:m,csize:i};else{var y=new Uint8Array(r.buffer,s);if(u==0)a[v]=new Uint8Array(y.buffer.slice(s,s+i));else{if(u!=8)throw"unknown compression method: "+u;var w=new Uint8Array(m);o.inflateRaw(y,w),a[v]=w}}},o.inflateRaw=function(r,s){return o.F.inflate(r,s)},o.inflate=function(r,s){return r[0],r[1],o.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),s)},o.deflate=function(r,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*r.length));i[a]=120,i[a+1]=156,a+=2,a=o.F.deflateRaw(r,i,a,s.level);var m=o.adler(r,0,r.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},o.deflateRaw=function(r,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*r.length)),i=o.F.deflateRaw(r,a,i,s.level);return new Uint8Array(a.buffer,0,i)},o.encode=function(r,s){s==null&&(s=!1);var a=0,i=o.bin.writeUint,m=o.bin.writeUshort,f={};for(var c in r){var l=!o._noNeed(c)&&!s,u=r[c],h=o.crc.crc(u,0,u.length);f[c]={cpr:l,usize:u.length,crc:h,file:l?o.deflateRaw(u):u}}for(var c in f)a+=f[c].file.length+30+46+2*o.bin.sizeUTF8(c);a+=22;var g=new Uint8Array(a),v=0,y=[];for(var c in f){var w=f[c];y.push(v),v=o._writeHeader(g,v,c,w,0)}var _=0,R=v;for(var c in f)w=f[c],y.push(v),v=o._writeHeader(g,v,c,w,1,y[_++]);var A=v-R;return i(g,v,101010256),v+=4,m(g,v+=4,_),m(g,v+=2,_),i(g,v+=2,A),i(g,v+=4,R),v+=4,v+=2,g.buffer},o._noNeed=function(r){var s=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},o._writeHeader=function(r,s,a,i,m,f){var c=o.bin.writeUint,l=o.bin.writeUshort,u=i.file;return c(r,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),l(r,s,20),l(r,s+=2,0),l(r,s+=2,i.cpr?8:0),c(r,s+=2,0),c(r,s+=4,i.crc),c(r,s+=4,u.length),c(r,s+=4,i.usize),l(r,s+=4,o.bin.sizeUTF8(a)),l(r,s+=2,0),s+=2,m==1&&(s+=2,s+=2,c(r,s+=6,f),s+=4),s+=o.bin.writeUTF8(r,s,a),m==0&&(r.set(u,s),s+=u.length),s},o.crc={table:(function(){for(var r=new Uint32Array(256),s=0;s<256;s++){for(var a=s,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;r[s]=a}return r})(),update:function(r,s,a,i){for(var m=0;m<i;m++)r=o.crc.table[255&(r^s[a+m])]^r>>>8;return r},crc:function(r,s,a){return 4294967295^o.crc.update(4294967295,r,s,a)}},o.adler=function(r,s,a){for(var i=1,m=0,f=s,c=s+a;f<c;){for(var l=Math.min(f+5552,c);f<l;)m+=i+=r[f++];i%=65521,m%=65521}return m<<16|i},o.bin={readUshort:function(r,s){return r[s]|r[s+1]<<8},writeUshort:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255},readUint:function(r,s){return 16777216*r[s+3]+(r[s+2]<<16|r[s+1]<<8|r[s])},writeUint:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255,r[s+2]=a>>16&255,r[s+3]=a>>24&255},readASCII:function(r,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(r[s+m]);return i},writeASCII:function(r,s,a){for(var i=0;i<a.length;i++)r[s+i]=a.charCodeAt(i)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+o.bin.pad(r[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return o.bin.readASCII(r,s,a)}return i},writeUTF8:function(r,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var c=a.charCodeAt(f);if((4294967168&c)==0)r[s+m]=c,m++;else if((4294965248&c)==0)r[s+m]=192|c>>6,r[s+m+1]=128|c>>0&63,m+=2;else if((4294901760&c)==0)r[s+m]=224|c>>12,r[s+m+1]=128|c>>6&63,r[s+m+2]=128|c>>0&63,m+=3;else{if((4292870144&c)!=0)throw"e";r[s+m]=240|c>>18,r[s+m+1]=128|c>>12&63,r[s+m+2]=128|c>>6&63,r[s+m+3]=128|c>>0&63,m+=4}}return m},sizeUTF8:function(r){for(var s=r.length,a=0,i=0;i<s;i++){var m=r.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},o.F={},o.F.deflateRaw=function(r,s,a,i){var m=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=o.F.U,c=o.F._goodIndex;o.F._hash;var l=o.F._putsE,u=0,h=a<<3,g=0,v=r.length;if(i==0){for(;u<v;)l(s,h,u+(O=Math.min(65535,v-u))==v?1:0),h=o.F._copyExact(r,u,O,s,h+8),u+=O;return h>>>3}var y=f.lits,w=f.strt,_=f.prev,R=0,A=0,F=0,S=0,j=0,x=0;for(v>2&&(w[x=o.F._hash(r,0)]=0),u=0;u<v;u++){if(j=x,u+1<v-2){x=o.F._hash(r,u+1);var b=u+1&32767;_[b]=w[x],w[x]=b}if(g<=u){(R>14e3||A>26697)&&v-u>100&&(g<u&&(y[R]=u-g,R+=2,g=u),h=o.F._writeBlock(u==v-1||g==v?1:0,y,R,S,r,F,u-F,s,h),R=A=S=0,F=u);var I=0;u<v-2&&(I=o.F._bestMatch(r,u,_,j,Math.min(m[2],v-u),m[3]));var O=I>>>16,M=65535&I;if(I!=0){M=65535&I;var $=c(O=I>>>16,f.of0);f.lhst[257+$]++;var P=c(M,f.df0);f.dhst[P]++,S+=f.exb[$]+f.dxb[P],y[R]=O<<23|u-g,y[R+1]=M<<16|$<<8|P,R+=2,g=u+O}else f.lhst[r[u]]++;A++}}for(F==u&&r.length!=0||(g<u&&(y[R]=u-g,R+=2,g=u),h=o.F._writeBlock(1,y,R,S,r,F,u-F,s,h),R=0,A=0,R=A=S=0,F=u);(7&h)!=0;)h++;return h>>>3},o.F._bestMatch=function(r,s,a,i,m,f){var c=32767&s,l=a[c],u=c-l+32768&32767;if(l==c||i!=o.F._hash(r,s-u))return 0;for(var h=0,g=0,v=Math.min(32767,s);u<=v&&--f!=0&&l!=c;){if(h==0||r[s+h]==r[s+h-u]){var y=o.F._howLong(r,s,u);if(y>h){if(g=u,(h=y)>=m)break;u+2<y&&(y=u+2);for(var w=0,_=0;_<y-2;_++){var R=s-u+_+32768&32767,A=R-a[R]+32768&32767;A>w&&(w=A,l=R)}}}u+=(c=l)-(l=a[c])+32768&32767}return h<<16|g},o.F._howLong=function(r,s,a){if(r[s]!=r[s-a]||r[s+1]!=r[s+1-a]||r[s+2]!=r[s+2-a])return 0;var i=s,m=Math.min(r.length,s+258);for(s+=3;s<m&&r[s]==r[s-a];)s++;return s-i},o.F._hash=function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<4)&65535},o.saved=0,o.F._writeBlock=function(r,s,a,i,m,f,c,l,u){var h,g,v,y,w,_,R,A,F,S=o.F.U,j=o.F._putsF,x=o.F._putsE;S.lhst[256]++,g=(h=o.F.getTrees())[0],v=h[1],y=h[2],w=h[3],_=h[4],R=h[5],A=h[6],F=h[7];var b=32+((u+3&7)==0?0:8-(u+3&7))+(c<<3),I=i+o.F.contSize(S.fltree,S.lhst)+o.F.contSize(S.fdtree,S.dhst),O=i+o.F.contSize(S.ltree,S.lhst)+o.F.contSize(S.dtree,S.dhst);O+=14+3*R+o.F.contSize(S.itree,S.ihst)+(2*S.ihst[16]+3*S.ihst[17]+7*S.ihst[18]);for(var M=0;M<286;M++)S.lhst[M]=0;for(M=0;M<30;M++)S.dhst[M]=0;for(M=0;M<19;M++)S.ihst[M]=0;var $=b<I&&b<O?0:I<O?1:2;if(j(l,u,r),j(l,u+1,$),u+=3,$==0){for(;(7&u)!=0;)u++;u=o.F._copyExact(m,f,c,l,u)}else{var P,z;if($==1&&(P=S.fltree,z=S.fdtree),$==2){o.F.makeCodes(S.ltree,g),o.F.revCodes(S.ltree,g),o.F.makeCodes(S.dtree,v),o.F.revCodes(S.dtree,v),o.F.makeCodes(S.itree,y),o.F.revCodes(S.itree,y),P=S.ltree,z=S.dtree,x(l,u,w-257),x(l,u+=5,_-1),x(l,u+=5,R-4),u+=4;for(var E=0;E<R;E++)x(l,u+3*E,S.itree[1+(S.ordr[E]<<1)]);u+=3*R,u=o.F._codeTiny(A,S.itree,l,u),u=o.F._codeTiny(F,S.itree,l,u)}for(var C=f,D=0;D<a;D+=2){for(var k=s[D],N=k>>>23,H=C+(8388607&k);C<H;)u=o.F._writeLit(m[C++],P,l,u);if(N!=0){var T=s[D+1],B=T>>16,U=T>>8&255,L=255&T;x(l,u=o.F._writeLit(257+U,P,l,u),N-S.of0[U]),u+=S.exb[U],j(l,u=o.F._writeLit(L,z,l,u),B-S.df0[L]),u+=S.dxb[L],C+=N}}u=o.F._writeLit(256,P,l,u)}return u},o.F._copyExact=function(r,s,a,i,m){var f=m>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(r.buffer,s,a),f),m+(a+4<<3)},o.F.getTrees=function(){for(var r=o.F.U,s=o.F._hufTree(r.lhst,r.ltree,15),a=o.F._hufTree(r.dhst,r.dtree,15),i=[],m=o.F._lenCodes(r.ltree,i),f=[],c=o.F._lenCodes(r.dtree,f),l=0;l<i.length;l+=2)r.ihst[i[l]]++;for(l=0;l<f.length;l+=2)r.ihst[f[l]]++;for(var u=o.F._hufTree(r.ihst,r.itree,7),h=19;h>4&&r.itree[1+(r.ordr[h-1]<<1)]==0;)h--;return[s,a,u,m,c,h,i,f]},o.F.getSecond=function(r){for(var s=[],a=0;a<r.length;a+=2)s.push(r[a+1]);return s},o.F.nonZero=function(r){for(var s="",a=0;a<r.length;a+=2)r[a+1]!=0&&(s+=(a>>1)+",");return s},o.F.contSize=function(r,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*r[1+(i<<1)];return a},o.F._codeTiny=function(r,s,a,i){for(var m=0;m<r.length;m+=2){var f=r[m],c=r[m+1];i=o.F._writeLit(f,s,a,i);var l=f==16?2:f==17?3:7;f>15&&(o.F._putsE(a,i,c,l),i+=l)}return i},o.F._lenCodes=function(r,s){for(var a=r.length;a!=2&&r[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=r[i+1],f=i+3<a?r[i+3]:-1,c=i+5<a?r[i+5]:-1,l=i==0?-1:r[i-1];if(m==0&&f==m&&c==m){for(var u=i+5;u+2<a&&r[u+2]==m;)u+=2;(h=Math.min(u+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(m==l&&f==m&&c==m){for(u=i+5;u+2<a&&r[u+2]==m;)u+=2;var h=Math.min(u+1-i>>>1,6);s.push(16,h-3),i+=2*h-2}else s.push(m,0)}return a>>>1},o.F._hufTree=function(r,s,a){var i=[],m=r.length,f=s.length,c=0;for(c=0;c<f;c+=2)s[c]=0,s[c+1]=0;for(c=0;c<m;c++)r[c]!=0&&i.push({lit:c,f:r[c]});var l=i.length,u=i.slice(0);if(l==0)return 0;if(l==1){var h=i[0].lit;return u=h==0?1:0,s[1+(h<<1)]=1,s[1+(u<<1)]=1,1}i.sort((function(A,F){return A.f-F.f}));var g=i[0],v=i[1],y=0,w=1,_=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};w!=l-1;)g=y!=w&&(_==l||i[y].f<i[_].f)?i[y++]:i[_++],v=y!=w&&(_==l||i[y].f<i[_].f)?i[y++]:i[_++],i[w++]={lit:-1,f:g.f+v.f,l:g,r:v};var R=o.F.setDepth(i[w-1],0);for(R>a&&(o.F.restrictDepth(u,a,R),R=a),c=0;c<l;c++)s[1+(u[c].lit<<1)]=u[c].d;return R},o.F.setDepth=function(r,s){return r.lit!=-1?(r.d=s,s):Math.max(o.F.setDepth(r.l,s+1),o.F.setDepth(r.r,s+1))},o.F.restrictDepth=function(r,s,a){var i=0,m=1<<a-s,f=0;for(r.sort((function(l,u){return u.d==l.d?l.f-u.f:u.d-l.d})),i=0;i<r.length&&r[i].d>s;i++){var c=r[i].d;r[i].d=s,f+=m-(1<<a-c)}for(f>>>=a-s;f>0;)(c=r[i].d)<s?(r[i].d++,f-=1<<s-c-1):i++;for(;i>=0;i--)r[i].d==s&&f<0&&(r[i].d--,f++);f!=0&&console.log("debt left")},o.F._goodIndex=function(r,s){var a=0;return s[16|a]<=r&&(a|=16),s[8|a]<=r&&(a|=8),s[4|a]<=r&&(a|=4),s[2|a]<=r&&(a|=2),s[1|a]<=r&&(a|=1),a},o.F._writeLit=function(r,s,a,i){return o.F._putsF(a,i,s[r<<1]),i+s[1+(r<<1)]},o.F.inflate=function(r,s){var a=Uint8Array;if(r[0]==3&&r[1]==0)return s||new a(0);var i=o.F,m=i._bitsF,f=i._bitsE,c=i._decodeTiny,l=i.makeCodes,u=i.codes2map,h=i._get17,g=i.U,v=s==null;v&&(s=new a(r.length>>>2<<3));for(var y,w,_=0,R=0,A=0,F=0,S=0,j=0,x=0,b=0,I=0;_==0;)if(_=m(r,I,1),R=m(r,I+1,2),I+=3,R!=0){if(v&&(s=o.F._check(s,b+(1<<17))),R==1&&(y=g.flmap,w=g.fdmap,j=511,x=31),R==2){A=f(r,I,5)+257,F=f(r,I+5,5)+1,S=f(r,I+10,4)+4,I+=14;for(var O=0;O<38;O+=2)g.itree[O]=0,g.itree[O+1]=0;var M=1;for(O=0;O<S;O++){var $=f(r,I+3*O,3);g.itree[1+(g.ordr[O]<<1)]=$,$>M&&(M=$)}I+=3*S,l(g.itree,M),u(g.itree,M,g.imap),y=g.lmap,w=g.dmap,I=c(g.imap,(1<<M)-1,A+F,r,I,g.ttree);var P=i._copyOut(g.ttree,0,A,g.ltree);j=(1<<P)-1;var z=i._copyOut(g.ttree,A,F,g.dtree);x=(1<<z)-1,l(g.ltree,P),u(g.ltree,P,y),l(g.dtree,z),u(g.dtree,z,w)}for(;;){var E=y[h(r,I)&j];I+=15&E;var C=E>>>4;if(!(C>>>8))s[b++]=C;else{if(C==256)break;var D=b+C-254;if(C>264){var k=g.ldef[C-257];D=b+(k>>>3)+f(r,I,7&k),I+=7&k}var N=w[h(r,I)&x];I+=15&N;var H=N>>>4,T=g.ddef[H],B=(T>>>4)+m(r,I,15&T);for(I+=15&T,v&&(s=o.F._check(s,b+(1<<17)));b<D;)s[b]=s[b++-B],s[b]=s[b++-B],s[b]=s[b++-B],s[b]=s[b++-B];b=D}}}else{(7&I)!=0&&(I+=8-(7&I));var U=4+(I>>>3),L=r[U-4]|r[U-3]<<8;v&&(s=o.F._check(s,b+L)),s.set(new a(r.buffer,r.byteOffset+U,L),b),I=U+L<<3,b+=L}return s.length==b?s:s.slice(0,b)},o.F._check=function(r,s){var a=r.length;if(s<=a)return r;var i=new Uint8Array(Math.max(a<<1,s));return i.set(r,0),i},o.F._decodeTiny=function(r,s,a,i,m,f){for(var c=o.F._bitsE,l=o.F._get17,u=0;u<a;){var h=r[l(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[u]=g,u++;else{var v=0,y=0;g==16?(y=3+c(i,m,2),m+=2,v=f[u-1]):g==17?(y=3+c(i,m,3),m+=3):g==18&&(y=11+c(i,m,7),m+=7);for(var w=u+y;u<w;)f[u]=v,u++}}return m},o.F._copyOut=function(r,s,a,i){for(var m=0,f=0,c=i.length>>>1;f<a;){var l=r[f+s];i[f<<1]=0,i[1+(f<<1)]=l,l>m&&(m=l),f++}for(;f<c;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},o.F.makeCodes=function(r,s){for(var a,i,m,f,c=o.F.U,l=r.length,u=c.bl_count,h=0;h<=s;h++)u[h]=0;for(h=1;h<l;h+=2)u[r[h]]++;var g=c.next_code;for(a=0,u[0]=0,i=1;i<=s;i++)a=a+u[i-1]<<1,g[i]=a;for(m=0;m<l;m+=2)(f=r[m+1])!=0&&(r[m]=g[f],g[f]++)},o.F.codes2map=function(r,s,a){for(var i=r.length,m=o.F.U.rev15,f=0;f<i;f+=2)if(r[f+1]!=0)for(var c=f>>1,l=r[f+1],u=c<<4|l,h=s-l,g=r[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=u,g++},o.F.revCodes=function(r,s){for(var a=o.F.U.rev15,i=15-s,m=0;m<r.length;m+=2){var f=r[m]<<s-r[m+1];r[m]=a[f]>>>i}},o.F._putsE=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8},o.F._putsF=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8,r[i+2]|=a>>>16},o.F._bitsE=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},o.F._bitsF=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},o.F._get17=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)},o.F._get25=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16|r[3+(s>>>3)]<<24)>>>(7&s)},o.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var r=o.F.U,s=0;s<32768;s++){var a=s;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,r.rev15[s]=(a>>>16|a<<16)>>>17}function i(m,f,c){for(;f--!=0;)m.push(0,c)}for(s=0;s<32;s++)r.ldef[s]=r.of0[s]<<3|r.exb[s],r.ddef[s]=r.df0[s]<<4|r.dxb[s];i(r.fltree,144,8),i(r.fltree,112,9),i(r.fltree,24,7),i(r.fltree,8,8),o.F.makeCodes(r.fltree,9),o.F.codes2map(r.fltree,9,r.flmap),o.F.revCodes(r.fltree,9),i(r.fdtree,32,5),o.F.makeCodes(r.fdtree,5),o.F.codes2map(r.fdtree,5,r.fdmap),o.F.revCodes(r.fdtree,5),i(r.itree,19,0),i(r.ltree,286,0),i(r.dtree,30,0),i(r.ttree,320,0)})()})();var Op=Ip({__proto__:null,default:Pn},[Pn]);const Pe=(function(){var e={nextZero(c,l){for(;c[l]!=0;)l++;return l},readUshort:(c,l)=>c[l]<<8|c[l+1],writeUshort(c,l,u){c[l]=u>>8&255,c[l+1]=255&u},readUint:(c,l)=>16777216*c[l]+(c[l+1]<<16|c[l+2]<<8|c[l+3]),writeUint(c,l,u){c[l]=u>>24&255,c[l+1]=u>>16&255,c[l+2]=u>>8&255,c[l+3]=255&u},readASCII(c,l,u){let h="";for(let g=0;g<u;g++)h+=String.fromCharCode(c[l+g]);return h},writeASCII(c,l,u){for(let h=0;h<u.length;h++)c[l+h]=u.charCodeAt(h)},readBytes(c,l,u){const h=[];for(let g=0;g<u;g++)h.push(c[l+g]);return h},pad:c=>c.length<2?`0${c}`:c,readUTF8(c,l,u){let h,g="";for(let v=0;v<u;v++)g+=`%${e.pad(c[l+v].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(c,l,u)}return h}};function t(c,l,u,h){const g=l*u,v=s(h),y=Math.ceil(l*v/8),w=new Uint8Array(4*g),_=new Uint32Array(w.buffer),{ctype:R}=h,{depth:A}=h,F=e.readUshort;if(R==6){const k=g<<2;if(A==8)for(var S=0;S<k;S+=4)w[S]=c[S],w[S+1]=c[S+1],w[S+2]=c[S+2],w[S+3]=c[S+3];if(A==16)for(S=0;S<k;S++)w[S]=c[S<<1]}else if(R==2){const k=h.tabs.tRNS;if(k==null){if(A==8)for(S=0;S<g;S++){var j=3*S;_[S]=255<<24|c[j+2]<<16|c[j+1]<<8|c[j]}if(A==16)for(S=0;S<g;S++)j=6*S,_[S]=255<<24|c[j+4]<<16|c[j+2]<<8|c[j]}else{var x=k[0];const N=k[1],H=k[2];if(A==8)for(S=0;S<g;S++){var b=S<<2;j=3*S,_[S]=255<<24|c[j+2]<<16|c[j+1]<<8|c[j],c[j]==x&&c[j+1]==N&&c[j+2]==H&&(w[b+3]=0)}if(A==16)for(S=0;S<g;S++)b=S<<2,j=6*S,_[S]=255<<24|c[j+4]<<16|c[j+2]<<8|c[j],F(c,j)==x&&F(c,j+2)==N&&F(c,j+4)==H&&(w[b+3]=0)}}else if(R==3){const k=h.tabs.PLTE,N=h.tabs.tRNS,H=N?N.length:0;if(A==1)for(var I=0;I<u;I++){var O=I*y,M=I*l;for(S=0;S<l;S++){b=M+S<<2;var $=3*(P=c[O+(S>>3)]>>7-((7&S)<<0)&1);w[b]=k[$],w[b+1]=k[$+1],w[b+2]=k[$+2],w[b+3]=P<H?N[P]:255}}if(A==2)for(I=0;I<u;I++)for(O=I*y,M=I*l,S=0;S<l;S++)b=M+S<<2,$=3*(P=c[O+(S>>2)]>>6-((3&S)<<1)&3),w[b]=k[$],w[b+1]=k[$+1],w[b+2]=k[$+2],w[b+3]=P<H?N[P]:255;if(A==4)for(I=0;I<u;I++)for(O=I*y,M=I*l,S=0;S<l;S++)b=M+S<<2,$=3*(P=c[O+(S>>1)]>>4-((1&S)<<2)&15),w[b]=k[$],w[b+1]=k[$+1],w[b+2]=k[$+2],w[b+3]=P<H?N[P]:255;if(A==8)for(S=0;S<g;S++){var P;b=S<<2,$=3*(P=c[S]),w[b]=k[$],w[b+1]=k[$+1],w[b+2]=k[$+2],w[b+3]=P<H?N[P]:255}}else if(R==4){if(A==8)for(S=0;S<g;S++){b=S<<2;var z=c[E=S<<1];w[b]=z,w[b+1]=z,w[b+2]=z,w[b+3]=c[E+1]}if(A==16)for(S=0;S<g;S++){var E;b=S<<2,z=c[E=S<<2],w[b]=z,w[b+1]=z,w[b+2]=z,w[b+3]=c[E+2]}}else if(R==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,I=0;I<u;I++){const k=I*y,N=I*l;if(A==1)for(var C=0;C<l;C++){var D=(z=255*(c[k+(C>>>3)]>>>7-(7&C)&1))==255*x?0:255;_[N+C]=D<<24|z<<16|z<<8|z}else if(A==2)for(C=0;C<l;C++)D=(z=85*(c[k+(C>>>2)]>>>6-((3&C)<<1)&3))==85*x?0:255,_[N+C]=D<<24|z<<16|z<<8|z;else if(A==4)for(C=0;C<l;C++)D=(z=17*(c[k+(C>>>1)]>>>4-((1&C)<<2)&15))==17*x?0:255,_[N+C]=D<<24|z<<16|z<<8|z;else if(A==8)for(C=0;C<l;C++)D=(z=c[k+C])==x?0:255,_[N+C]=D<<24|z<<16|z<<8|z;else if(A==16)for(C=0;C<l;C++)z=c[k+(C<<1)],D=F(c,k+(C<<1))==x?0:255,_[N+C]=D<<24|z<<16|z<<8|z}return w}function n(c,l,u,h){const g=s(c),v=Math.ceil(u*g/8),y=new Uint8Array((v+1+c.interlace)*h);return l=c.tabs.CgBI?r(l,y):o(l,y),c.interlace==0?l=a(l,c,0,u,h):c.interlace==1&&(l=(function(_,R){const A=R.width,F=R.height,S=s(R),j=S>>3,x=Math.ceil(A*S/8),b=new Uint8Array(F*x);let I=0;const O=[0,0,4,0,2,0,1],M=[0,4,0,2,0,1,0],$=[8,8,8,4,4,2,2],P=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const C=$[z],D=P[z];let k=0,N=0,H=O[z];for(;H<F;)H+=C,N++;let T=M[z];for(;T<A;)T+=D,k++;const B=Math.ceil(k*S/8);a(_,R,I,k,N);let U=0,L=O[z];for(;L<F;){let G=M[z],V=I+U*B<<3;for(;G<A;){var E;if(S==1&&(E=(E=_[V>>3])>>7-(7&V)&1,b[L*x+(G>>3)]|=E<<7-((7&G)<<0)),S==2&&(E=(E=_[V>>3])>>6-(7&V)&3,b[L*x+(G>>2)]|=E<<6-((3&G)<<1)),S==4&&(E=(E=_[V>>3])>>4-(7&V)&15,b[L*x+(G>>1)]|=E<<4-((1&G)<<2)),S>=8){const Y=L*x+G*j;for(let K=0;K<j;K++)b[Y+K]=_[(V>>3)+K]}V+=S,G+=D}U++,L+=C}k*N!=0&&(I+=N*(1+B)),z+=1}return b})(l,c)),l}function o(c,l){return r(new Uint8Array(c.buffer,2,c.length-6),l)}var r=(function(){const c={H:{}};return c.H.N=function(l,u){const h=Uint8Array;let g,v,y=0,w=0,_=0,R=0,A=0,F=0,S=0,j=0,x=0;if(l[0]==3&&l[1]==0)return u||new h(0);const b=c.H,I=b.b,O=b.e,M=b.R,$=b.n,P=b.A,z=b.Z,E=b.m,C=u==null;for(C&&(u=new h(l.length>>>2<<5));y==0;)if(y=I(l,x,1),w=I(l,x+1,2),x+=3,w!=0){if(C&&(u=c.H.W(u,j+(1<<17))),w==1&&(g=E.J,v=E.h,F=511,S=31),w==2){_=O(l,x,5)+257,R=O(l,x+5,5)+1,A=O(l,x+10,4)+4,x+=14;let k=1;for(var D=0;D<38;D+=2)E.Q[D]=0,E.Q[D+1]=0;for(D=0;D<A;D++){const T=O(l,x+3*D,3);E.Q[1+(E.X[D]<<1)]=T,T>k&&(k=T)}x+=3*A,$(E.Q,k),P(E.Q,k,E.u),g=E.w,v=E.d,x=M(E.u,(1<<k)-1,_+R,l,x,E.v);const N=b.V(E.v,0,_,E.C);F=(1<<N)-1;const H=b.V(E.v,_,R,E.D);S=(1<<H)-1,$(E.C,N),P(E.C,N,g),$(E.D,H),P(E.D,H,v)}for(;;){const k=g[z(l,x)&F];x+=15&k;const N=k>>>4;if(!(N>>>8))u[j++]=N;else{if(N==256)break;{let H=j+N-254;if(N>264){const G=E.q[N-257];H=j+(G>>>3)+O(l,x,7&G),x+=7&G}const T=v[z(l,x)&S];x+=15&T;const B=T>>>4,U=E.c[B],L=(U>>>4)+I(l,x,15&U);for(x+=15&U;j<H;)u[j]=u[j++-L],u[j]=u[j++-L],u[j]=u[j++-L],u[j]=u[j++-L];j=H}}}}else{(7&x)!=0&&(x+=8-(7&x));const k=4+(x>>>3),N=l[k-4]|l[k-3]<<8;C&&(u=c.H.W(u,j+N)),u.set(new h(l.buffer,l.byteOffset+k,N),j),x=k+N<<3,j+=N}return u.length==j?u:u.slice(0,j)},c.H.W=function(l,u){const h=l.length;if(u<=h)return l;const g=new Uint8Array(h<<1);return g.set(l,0),g},c.H.R=function(l,u,h,g,v,y){const w=c.H.e,_=c.H.Z;let R=0;for(;R<h;){const A=l[_(g,v)&u];v+=15&A;const F=A>>>4;if(F<=15)y[R]=F,R++;else{let S=0,j=0;F==16?(j=3+w(g,v,2),v+=2,S=y[R-1]):F==17?(j=3+w(g,v,3),v+=3):F==18&&(j=11+w(g,v,7),v+=7);const x=R+j;for(;R<x;)y[R]=S,R++}}return v},c.H.V=function(l,u,h,g){let v=0,y=0;const w=g.length>>>1;for(;y<h;){const _=l[y+u];g[y<<1]=0,g[1+(y<<1)]=_,_>v&&(v=_),y++}for(;y<w;)g[y<<1]=0,g[1+(y<<1)]=0,y++;return v},c.H.n=function(l,u){const h=c.H.m,g=l.length;let v,y,w,_;const R=h.j;for(var A=0;A<=u;A++)R[A]=0;for(A=1;A<g;A+=2)R[l[A]]++;const F=h.K;for(v=0,R[0]=0,y=1;y<=u;y++)v=v+R[y-1]<<1,F[y]=v;for(w=0;w<g;w+=2)_=l[w+1],_!=0&&(l[w]=F[_],F[_]++)},c.H.A=function(l,u,h){const g=l.length,v=c.H.m.r;for(let y=0;y<g;y+=2)if(l[y+1]!=0){const w=y>>1,_=l[y+1],R=w<<4|_,A=u-_;let F=l[y]<<A;const S=F+(1<<A);for(;F!=S;)h[v[F]>>>15-u]=R,F++}},c.H.l=function(l,u){const h=c.H.m.r,g=15-u;for(let v=0;v<l.length;v+=2){const y=l[v]<<u-l[v+1];l[v]=h[y]>>>g}},c.H.M=function(l,u,h){h<<=7&u;const g=u>>>3;l[g]|=h,l[g+1]|=h>>>8},c.H.I=function(l,u,h){h<<=7&u;const g=u>>>3;l[g]|=h,l[g+1]|=h>>>8,l[g+2]|=h>>>16},c.H.e=function(l,u,h){return(l[u>>>3]|l[1+(u>>>3)]<<8)>>>(7&u)&(1<<h)-1},c.H.b=function(l,u,h){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16)>>>(7&u)&(1<<h)-1},c.H.Z=function(l,u){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16)>>>(7&u)},c.H.i=function(l,u){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16|l[3+(u>>>3)]<<24)>>>(7&u)},c.H.m=(function(){const l=Uint16Array,u=Uint32Array;return{K:new l(16),j:new l(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new l(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new u(32),J:new l(512),_:[],h:new l(32),$:[],w:new l(32768),C:[],v:[],d:new l(32768),D:[],u:new l(512),Q:[],r:new l(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new l(65536),g:new l(32768)}})(),(function(){const l=c.H.m;for(var u=0;u<32768;u++){let g=u;g=(2863311530&g)>>>1|(1431655765&g)<<1,g=(3435973836&g)>>>2|(858993459&g)<<2,g=(4042322160&g)>>>4|(252645135&g)<<4,g=(4278255360&g)>>>8|(16711935&g)<<8,l.r[u]=(g>>>16|g<<16)>>>17}function h(g,v,y){for(;v--!=0;)g.push(0,y)}for(u=0;u<32;u++)l.q[u]=l.S[u]<<3|l.T[u],l.c[u]=l.p[u]<<4|l.z[u];h(l._,144,8),h(l._,112,9),h(l._,24,7),h(l._,8,8),c.H.n(l._,9),c.H.A(l._,9,l.J),c.H.l(l._,9),h(l.$,32,5),c.H.n(l.$,5),c.H.A(l.$,5,l.h),c.H.l(l.$,5),h(l.Q,19,0),h(l.C,286,0),h(l.D,30,0),h(l.v,320,0)})(),c.H.N})();function s(c){return[1,null,3,1,2,null,4][c.ctype]*c.depth}function a(c,l,u,h,g){let v=s(l);const y=Math.ceil(h*v/8);let w,_;v=Math.ceil(v/8);let R=c[u],A=0;if(R>1&&(c[u]=[0,0,1][R-2]),R==3)for(A=v;A<y;A++)c[A+1]=c[A+1]+(c[A+1-v]>>>1)&255;for(let F=0;F<g;F++)if(w=u+F*y,_=w+F+1,R=c[_-1],A=0,R==0)for(;A<y;A++)c[w+A]=c[_+A];else if(R==1){for(;A<v;A++)c[w+A]=c[_+A];for(;A<y;A++)c[w+A]=c[_+A]+c[w+A-v]}else if(R==2)for(;A<y;A++)c[w+A]=c[_+A]+c[w+A-y];else if(R==3){for(;A<v;A++)c[w+A]=c[_+A]+(c[w+A-y]>>>1);for(;A<y;A++)c[w+A]=c[_+A]+(c[w+A-y]+c[w+A-v]>>>1)}else{for(;A<v;A++)c[w+A]=c[_+A]+i(0,c[w+A-y],0);for(;A<y;A++)c[w+A]=c[_+A]+i(c[w+A-v],c[w+A-y],c[w+A-v-y])}return c}function i(c,l,u){const h=c+l-u,g=h-c,v=h-l,y=h-u;return g*g<=v*v&&g*g<=y*y?c:v*v<=y*y?l:u}function m(c,l,u){u.width=e.readUint(c,l),l+=4,u.height=e.readUint(c,l),l+=4,u.depth=c[l],l++,u.ctype=c[l],l++,u.compress=c[l],l++,u.filter=c[l],l++,u.interlace=c[l],l++}function f(c,l,u,h,g,v,y,w,_){const R=Math.min(l,g),A=Math.min(u,v);let F=0,S=0;for(let z=0;z<A;z++)for(let E=0;E<R;E++)if(y>=0&&w>=0?(F=z*l+E<<2,S=(w+z)*g+y+E<<2):(F=(-w+z)*l-y+E<<2,S=z*g+E<<2),_==0)h[S]=c[F],h[S+1]=c[F+1],h[S+2]=c[F+2],h[S+3]=c[F+3];else if(_==1){var j=c[F+3]*.00392156862745098,x=c[F]*j,b=c[F+1]*j,I=c[F+2]*j,O=h[S+3]*(1/255),M=h[S]*O,$=h[S+1]*O,P=h[S+2]*O;const C=1-j,D=j+O*C,k=D==0?0:1/D;h[S+3]=255*D,h[S+0]=(x+M*C)*k,h[S+1]=(b+$*C)*k,h[S+2]=(I+P*C)*k}else if(_==2)j=c[F+3],x=c[F],b=c[F+1],I=c[F+2],O=h[S+3],M=h[S],$=h[S+1],P=h[S+2],j==O&&x==M&&b==$&&I==P?(h[S]=0,h[S+1]=0,h[S+2]=0,h[S+3]=0):(h[S]=x,h[S+1]=b,h[S+2]=I,h[S+3]=j);else if(_==3){if(j=c[F+3],x=c[F],b=c[F+1],I=c[F+2],O=h[S+3],M=h[S],$=h[S+1],P=h[S+2],j==O&&x==M&&b==$&&I==P)continue;if(j<220&&O>20)return!1}return!0}return{decode:function(l){const u=new Uint8Array(l);let h=8;const g=e,v=g.readUshort,y=g.readUint,w={tabs:{},frames:[]},_=new Uint8Array(u.length);let R,A=0,F=0;const S=[137,80,78,71,13,10,26,10];for(var j=0;j<8;j++)if(u[j]!=S[j])throw"The input is not a PNG file!";for(;h<u.length;){const z=g.readUint(u,h);h+=4;const E=g.readASCII(u,h,4);if(h+=4,E=="IHDR")m(u,h,w);else if(E=="iCCP"){for(var x=h;u[x]!=0;)x++;g.readASCII(u,h,x-h),u[x+1];const C=u.slice(x+2,h+z);let D=null;try{D=o(C)}catch{D=r(C)}w.tabs[E]=D}else if(E=="CgBI")w.tabs[E]=u.slice(h,h+4);else if(E=="IDAT"){for(j=0;j<z;j++)_[A+j]=u[h+j];A+=z}else if(E=="acTL")w.tabs[E]={num_frames:y(u,h),num_plays:y(u,h+4)},R=new Uint8Array(u.length);else if(E=="fcTL"){F!=0&&((P=w.frames[w.frames.length-1]).data=n(w,R.slice(0,F),P.rect.width,P.rect.height),F=0);const C={x:y(u,h+12),y:y(u,h+16),width:y(u,h+4),height:y(u,h+8)};let D=v(u,h+22);D=v(u,h+20)/(D==0?100:D);const k={rect:C,delay:Math.round(1e3*D),dispose:u[h+24],blend:u[h+25]};w.frames.push(k)}else if(E=="fdAT"){for(j=0;j<z-4;j++)R[F+j]=u[h+j+4];F+=z-4}else if(E=="pHYs")w.tabs[E]=[g.readUint(u,h),g.readUint(u,h+4),u[h+8]];else if(E=="cHRM")for(w.tabs[E]=[],j=0;j<8;j++)w.tabs[E].push(g.readUint(u,h+4*j));else if(E=="tEXt"||E=="zTXt"){w.tabs[E]==null&&(w.tabs[E]={});var b=g.nextZero(u,h),I=g.readASCII(u,h,b-h),O=h+z-b-1;if(E=="tEXt")$=g.readASCII(u,b+1,O);else{var M=o(u.slice(b+2,b+2+O));$=g.readUTF8(M,0,M.length)}w.tabs[E][I]=$}else if(E=="iTXt"){w.tabs[E]==null&&(w.tabs[E]={}),b=0,x=h,b=g.nextZero(u,x),I=g.readASCII(u,x,b-x);const C=u[x=b+1];var $;u[x+1],x+=2,b=g.nextZero(u,x),g.readASCII(u,x,b-x),x=b+1,b=g.nextZero(u,x),g.readUTF8(u,x,b-x),O=z-((x=b+1)-h),C==0?$=g.readUTF8(u,x,O):(M=o(u.slice(x,x+O)),$=g.readUTF8(M,0,M.length)),w.tabs[E][I]=$}else if(E=="PLTE")w.tabs[E]=g.readBytes(u,h,z);else if(E=="hIST"){const C=w.tabs.PLTE.length/3;for(w.tabs[E]=[],j=0;j<C;j++)w.tabs[E].push(v(u,h+2*j))}else if(E=="tRNS")w.ctype==3?w.tabs[E]=g.readBytes(u,h,z):w.ctype==0?w.tabs[E]=v(u,h):w.ctype==2&&(w.tabs[E]=[v(u,h),v(u,h+2),v(u,h+4)]);else if(E=="gAMA")w.tabs[E]=g.readUint(u,h)/1e5;else if(E=="sRGB")w.tabs[E]=u[h];else if(E=="bKGD")w.ctype==0||w.ctype==4?w.tabs[E]=[v(u,h)]:w.ctype==2||w.ctype==6?w.tabs[E]=[v(u,h),v(u,h+2),v(u,h+4)]:w.ctype==3&&(w.tabs[E]=u[h]);else if(E=="IEND")break;h+=z,g.readUint(u,h),h+=4}var P;return F!=0&&((P=w.frames[w.frames.length-1]).data=n(w,R.slice(0,F),P.rect.width,P.rect.height)),w.data=n(w,_,w.width,w.height),delete w.compress,delete w.interlace,delete w.filter,w},toRGBA8:function(l){const u=l.width,h=l.height;if(l.tabs.acTL==null)return[t(l.data,u,h,l).buffer];const g=[];l.frames[0].data==null&&(l.frames[0].data=l.data);const v=u*h*4,y=new Uint8Array(v),w=new Uint8Array(v),_=new Uint8Array(v);for(let A=0;A<l.frames.length;A++){const F=l.frames[A],S=F.rect.x,j=F.rect.y,x=F.rect.width,b=F.rect.height,I=t(F.data,x,b,l);if(A!=0)for(var R=0;R<v;R++)_[R]=y[R];if(F.blend==0?f(I,x,b,y,u,h,S,j,0):F.blend==1&&f(I,x,b,y,u,h,S,j,1),g.push(y.buffer.slice(0)),F.dispose!=0){if(F.dispose==1)f(w,x,b,y,u,h,S,j,0);else if(F.dispose==2)for(R=0;R<v;R++)y[R]=_[R]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Pe,{_bin:t}=Pe,n=Pe._paeth;var o={table:(function(){const x=new Uint32Array(256);for(let b=0;b<256;b++){let I=b;for(let O=0;O<8;O++)1&I?I=3988292384^I>>>1:I>>>=1;x[b]=I}return x})(),update(x,b,I,O){for(let M=0;M<O;M++)x=o.table[255&(x^b[I+M])]^x>>>8;return x},crc:(x,b,I)=>4294967295^o.update(4294967295,x,b,I)};function r(x,b,I,O){b[I]+=x[0]*O>>4,b[I+1]+=x[1]*O>>4,b[I+2]+=x[2]*O>>4,b[I+3]+=x[3]*O>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,b){const I=x[0]-b[0],O=x[1]-b[1],M=x[2]-b[2],$=x[3]-b[3];return I*I+O*O+M*M+$*$}function i(x,b,I,O,M,$,P){P==null&&(P=1);const z=O.length,E=[];for(var C=0;C<z;C++){const L=O[C];E.push([L>>>0&255,L>>>8&255,L>>>16&255,L>>>24&255])}for(C=0;C<z;C++){let L=4294967295;for(var D=0,k=0;k<z;k++){var N=a(E[C],E[k]);k!=C&&N<L&&(L=N,D=k)}}const H=new Uint32Array(M.buffer),T=new Int16Array(b*I*4),B=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(C=0;C<B.length;C++)B[C]=255*((B[C]+.5)/16-.5);for(let L=0;L<I;L++)for(let G=0;G<b;G++){var U;C=4*(L*b+G),P!=2?U=[s(x[C]+T[C]),s(x[C+1]+T[C+1]),s(x[C+2]+T[C+2]),s(x[C+3]+T[C+3])]:(N=B[4*(3&L)+(3&G)],U=[s(x[C]+N),s(x[C+1]+N),s(x[C+2]+N),s(x[C+3]+N)]),D=0;let V=16777215;for(k=0;k<z;k++){const ne=a(U,E[k]);ne<V&&(V=ne,D=k)}const Y=E[D],K=[U[0]-Y[0],U[1]-Y[1],U[2]-Y[2],U[3]-Y[3]];P==1&&(G!=b-1&&r(K,T,C+4,7),L!=I-1&&(G!=0&&r(K,T,C+4*b-4,3),r(K,T,C+4*b,5),G!=b-1&&r(K,T,C+4*b+4,1))),$[C>>2]=D,H[C>>2]=O[D]}}function m(x,b,I,O,M){M==null&&(M={});const{crc:$}=o,P=t.writeUint,z=t.writeUshort,E=t.writeASCII;let C=8;const D=x.frames.length>1;let k,N=!1,H=33+(D?20:0);if(M.sRGB!=null&&(H+=13),M.pHYs!=null&&(H+=21),M.iCCP!=null&&(k=pako.deflate(M.iCCP),H+=21+k.length+4),x.ctype==3){for(var T=x.plte.length,B=0;B<T;B++)x.plte[B]>>>24!=255&&(N=!0);H+=8+3*T+4+(N?8+1*T+4:0)}for(var U=0;U<x.frames.length;U++)D&&(H+=38),H+=(Y=x.frames[U]).cimg.length+12,U!=0&&(H+=4);H+=12;const L=new Uint8Array(H),G=[137,80,78,71,13,10,26,10];for(B=0;B<8;B++)L[B]=G[B];if(P(L,C,13),C+=4,E(L,C,"IHDR"),C+=4,P(L,C,b),C+=4,P(L,C,I),C+=4,L[C]=x.depth,C++,L[C]=x.ctype,C++,L[C]=0,C++,L[C]=0,C++,L[C]=0,C++,P(L,C,$(L,C-17,17)),C+=4,M.sRGB!=null&&(P(L,C,1),C+=4,E(L,C,"sRGB"),C+=4,L[C]=M.sRGB,C++,P(L,C,$(L,C-5,5)),C+=4),M.iCCP!=null){const K=13+k.length;P(L,C,K),C+=4,E(L,C,"iCCP"),C+=4,E(L,C,"ICC profile"),C+=11,C+=2,L.set(k,C),C+=k.length,P(L,C,$(L,C-(K+4),K+4)),C+=4}if(M.pHYs!=null&&(P(L,C,9),C+=4,E(L,C,"pHYs"),C+=4,P(L,C,M.pHYs[0]),C+=4,P(L,C,M.pHYs[1]),C+=4,L[C]=M.pHYs[2],C++,P(L,C,$(L,C-13,13)),C+=4),D&&(P(L,C,8),C+=4,E(L,C,"acTL"),C+=4,P(L,C,x.frames.length),C+=4,P(L,C,M.loop!=null?M.loop:0),C+=4,P(L,C,$(L,C-12,12)),C+=4),x.ctype==3){for(P(L,C,3*(T=x.plte.length)),C+=4,E(L,C,"PLTE"),C+=4,B=0;B<T;B++){const K=3*B,ne=x.plte[B],ae=255&ne,le=ne>>>8&255,me=ne>>>16&255;L[C+K+0]=ae,L[C+K+1]=le,L[C+K+2]=me}if(C+=3*T,P(L,C,$(L,C-3*T-4,3*T+4)),C+=4,N){for(P(L,C,T),C+=4,E(L,C,"tRNS"),C+=4,B=0;B<T;B++)L[C+B]=x.plte[B]>>>24&255;C+=T,P(L,C,$(L,C-T-4,T+4)),C+=4}}let V=0;for(U=0;U<x.frames.length;U++){var Y=x.frames[U];D&&(P(L,C,26),C+=4,E(L,C,"fcTL"),C+=4,P(L,C,V++),C+=4,P(L,C,Y.rect.width),C+=4,P(L,C,Y.rect.height),C+=4,P(L,C,Y.rect.x),C+=4,P(L,C,Y.rect.y),C+=4,z(L,C,O[U]),C+=2,z(L,C,1e3),C+=2,L[C]=Y.dispose,C++,L[C]=Y.blend,C++,P(L,C,$(L,C-30,30)),C+=4);const K=Y.cimg;P(L,C,(T=K.length)+(U==0?0:4)),C+=4;const ne=C;E(L,C,U==0?"IDAT":"fdAT"),C+=4,U!=0&&(P(L,C,V++),C+=4),L.set(K,C),C+=T,P(L,C,$(L,ne,C-ne)),C+=4}return P(L,C,0),C+=4,E(L,C,"IEND"),C+=4,P(L,C,$(L,C-4,4)),C+=4,L.buffer}function f(x,b,I){for(let O=0;O<x.frames.length;O++){const M=x.frames[O];M.rect.width;const $=M.rect.height,P=new Uint8Array($*M.bpl+$);M.cimg=h(M.img,$,M.bpp,M.bpl,P,b,I)}}function c(x,b,I,O,M){const $=M[0],P=M[1],z=M[2],E=M[3],C=M[4],D=M[5];let k=6,N=8,H=255;for(var T=0;T<x.length;T++){const Z=new Uint8Array(x[T]);for(var B=Z.length,U=0;U<B;U+=4)H&=Z[U+3]}const L=H!=255,G=(function(te,ie,re,fe,he,Ee){const ge=[];for(var de=0;de<te.length;de++){const we=new Uint8Array(te[de]),Ie=new Uint32Array(we.buffer);var ke;let Te=0,Ge=0,Fe=ie,pt=re,rr=fe?1:0;if(de!=0){const Tl=Ee||fe||de==1||ge[de-2].dispose!=0?1:2;let or=0,To=1e9;for(let Ht=0;Ht<Tl;Ht++){var Je=new Uint8Array(te[de-1-Ht]);const Nl=new Uint32Array(te[de-1-Ht]);let et=ie,tt=re,Rt=-1,Wt=-1;for(let ht=0;ht<re;ht++)for(let gt=0;gt<ie;gt++)Ie[be=ht*ie+gt]!=Nl[be]&&(gt<et&&(et=gt),gt>Rt&&(Rt=gt),ht<tt&&(tt=ht),ht>Wt&&(Wt=ht));Rt==-1&&(et=tt=Rt=Wt=0),he&&((1&et)==1&&et--,(1&tt)==1&&tt--);const No=(Rt-et+1)*(Wt-tt+1);No<To&&(To=No,or=Ht,Te=et,Ge=tt,Fe=Rt-et+1,pt=Wt-tt+1)}Je=new Uint8Array(te[de-1-or]),or==1&&(ge[de-1].dispose=2),ke=new Uint8Array(Fe*pt*4),e(Je,ie,re,ke,Fe,pt,-Te,-Ge,0),rr=e(we,ie,re,ke,Fe,pt,-Te,-Ge,3)?1:0,rr==1?u(we,ie,re,ke,{x:Te,y:Ge,width:Fe,height:pt}):e(we,ie,re,ke,Fe,pt,-Te,-Ge,0)}else ke=we.slice(0);ge.push({rect:{x:Te,y:Ge,width:Fe,height:pt},img:ke,blend:rr,dispose:0})}if(fe)for(de=0;de<ge.length;de++){if((mt=ge[de]).blend==1)continue;const we=mt.rect,Ie=ge[de-1].rect,Te=Math.min(we.x,Ie.x),Ge=Math.min(we.y,Ie.y),Fe={x:Te,y:Ge,width:Math.max(we.x+we.width,Ie.x+Ie.width)-Te,height:Math.max(we.y+we.height,Ie.y+Ie.height)-Ge};ge[de-1].dispose=1,de-1!=0&&l(te,ie,re,ge,de-1,Fe,he),l(te,ie,re,ge,de,Fe,he)}let pn=0;if(te.length!=1)for(var be=0;be<ge.length;be++){var mt;pn+=(mt=ge[be]).rect.width*mt.rect.height}return ge})(x,b,I,$,P,z),V={},Y=[],K=[];if(O!=0){const Z=[];for(U=0;U<G.length;U++)Z.push(G[U].img.buffer);const te=(function(he){let Ee=0;for(var ge=0;ge<he.length;ge++)Ee+=he[ge].byteLength;const de=new Uint8Array(Ee);let ke=0;for(ge=0;ge<he.length;ge++){const Je=new Uint8Array(he[ge]),pn=Je.length;for(let be=0;be<pn;be+=4){let mt=Je[be],we=Je[be+1],Ie=Je[be+2];const Te=Je[be+3];Te==0&&(mt=we=Ie=0),de[ke+be]=mt,de[ke+be+1]=we,de[ke+be+2]=Ie,de[ke+be+3]=Te}ke+=pn}return de.buffer})(Z),ie=v(te,O);for(U=0;U<ie.plte.length;U++)Y.push(ie.plte[U].est.rgba);let re=0;for(U=0;U<G.length;U++){const fe=(ae=G[U]).img.length;var ne=new Uint8Array(ie.inds.buffer,re>>2,fe>>2);K.push(ne);const he=new Uint8Array(ie.abuf,re,fe);D&&i(ae.img,ae.rect.width,ae.rect.height,Y,he,ne),ae.img.set(he),re+=fe}}else for(T=0;T<G.length;T++){var ae=G[T];const Z=new Uint32Array(ae.img.buffer);var le=ae.rect.width;for(B=Z.length,ne=new Uint8Array(B),K.push(ne),U=0;U<B;U++){const te=Z[U];if(U!=0&&te==Z[U-1])ne[U]=ne[U-1];else if(U>le&&te==Z[U-le])ne[U]=ne[U-le];else{let ie=V[te];if(ie==null&&(V[te]=ie=Y.length,Y.push(te),Y.length>=300))break;ne[U]=ie}}}const me=Y.length;for(me<=256&&C==0&&(N=me<=2?1:me<=4?2:me<=16?4:8,N=Math.max(N,E)),T=0;T<G.length;T++){(ae=G[T]).rect.x,ae.rect.y,le=ae.rect.width;const Z=ae.rect.height;let te=ae.img;new Uint32Array(te.buffer);let ie=4*le,re=4;if(me<=256&&C==0){ie=Math.ceil(N*le/8);var W=new Uint8Array(ie*Z);const fe=K[T];for(let he=0;he<Z;he++){U=he*ie;const Ee=he*le;if(N==8)for(var q=0;q<le;q++)W[U+q]=fe[Ee+q];else if(N==4)for(q=0;q<le;q++)W[U+(q>>1)]|=fe[Ee+q]<<4-4*(1&q);else if(N==2)for(q=0;q<le;q++)W[U+(q>>2)]|=fe[Ee+q]<<6-2*(3&q);else if(N==1)for(q=0;q<le;q++)W[U+(q>>3)]|=fe[Ee+q]<<7-1*(7&q)}te=W,k=3,re=1}else if(L==0&&G.length==1){W=new Uint8Array(le*Z*3);const fe=le*Z;for(U=0;U<fe;U++){const he=3*U,Ee=4*U;W[he]=te[Ee],W[he+1]=te[Ee+1],W[he+2]=te[Ee+2]}te=W,k=2,re=3,ie=3*le}ae.img=te,ae.bpl=ie,ae.bpp=re}return{ctype:k,depth:N,plte:Y,frames:G}}function l(x,b,I,O,M,$,P){const z=Uint8Array,E=Uint32Array,C=new z(x[M-1]),D=new E(x[M-1]),k=M+1<x.length?new z(x[M+1]):null,N=new z(x[M]),H=new E(N.buffer);let T=b,B=I,U=-1,L=-1;for(let V=0;V<$.height;V++)for(let Y=0;Y<$.width;Y++){const K=$.x+Y,ne=$.y+V,ae=ne*b+K,le=H[ae];le==0||O[M-1].dispose==0&&D[ae]==le&&(k==null||k[4*ae+3]!=0)||(K<T&&(T=K),K>U&&(U=K),ne<B&&(B=ne),ne>L&&(L=ne))}U==-1&&(T=B=U=L=0),P&&((1&T)==1&&T--,(1&B)==1&&B--),$={x:T,y:B,width:U-T+1,height:L-B+1};const G=O[M];G.rect=$,G.blend=1,G.img=new Uint8Array($.width*$.height*4),O[M-1].dispose==0?(e(C,b,I,G.img,$.width,$.height,-$.x,-$.y,0),u(N,b,I,G.img,$)):e(N,b,I,G.img,$.width,$.height,-$.x,-$.y,0)}function u(x,b,I,O,M){e(x,b,I,O,M.width,M.height,-M.x,-M.y,2)}function h(x,b,I,O,M,$,P){const z=[];let E,C=[0,1,2,3,4];$!=-1?C=[$]:(b*O>5e5||I==1)&&(C=[0]),P&&(E={level:0});const D=Op;for(var k=0;k<C.length;k++){for(let T=0;T<b;T++)g(M,x,T,O,I,C[k]);z.push(D.deflate(M,E))}let N,H=1e9;for(k=0;k<z.length;k++)z[k].length<H&&(N=k,H=z[k].length);return z[N]}function g(x,b,I,O,M,$){const P=I*O;let z=P+I;if(x[z]=$,z++,$==0)if(O<500)for(var E=0;E<O;E++)x[z+E]=b[P+E];else x.set(new Uint8Array(b.buffer,P,O),z);else if($==1){for(E=0;E<M;E++)x[z+E]=b[P+E];for(E=M;E<O;E++)x[z+E]=b[P+E]-b[P+E-M]+256&255}else if(I==0){for(E=0;E<M;E++)x[z+E]=b[P+E];if($==2)for(E=M;E<O;E++)x[z+E]=b[P+E];if($==3)for(E=M;E<O;E++)x[z+E]=b[P+E]-(b[P+E-M]>>1)+256&255;if($==4)for(E=M;E<O;E++)x[z+E]=b[P+E]-n(b[P+E-M],0,0)+256&255}else{if($==2)for(E=0;E<O;E++)x[z+E]=b[P+E]+256-b[P+E-O]&255;if($==3){for(E=0;E<M;E++)x[z+E]=b[P+E]+256-(b[P+E-O]>>1)&255;for(E=M;E<O;E++)x[z+E]=b[P+E]+256-(b[P+E-O]+b[P+E-M]>>1)&255}if($==4){for(E=0;E<M;E++)x[z+E]=b[P+E]+256-n(0,b[P+E-O],0)&255;for(E=M;E<O;E++)x[z+E]=b[P+E]+256-n(b[P+E-M],b[P+E-O],b[P+E-M-O])&255}}}function v(x,b){const I=new Uint8Array(x),O=I.slice(0),M=new Uint32Array(O.buffer),$=y(O,b),P=$[0],z=$[1],E=I.length,C=new Uint8Array(E>>2);let D;if(I.length<2e7)for(var k=0;k<E;k+=4)D=w(P,N=I[k]*(1/255),H=I[k+1]*(1/255),T=I[k+2]*(1/255),B=I[k+3]*(1/255)),C[k>>2]=D.ind,M[k>>2]=D.est.rgba;else for(k=0;k<E;k+=4){var N=I[k]*.00392156862745098,H=I[k+1]*(1/255),T=I[k+2]*(1/255),B=I[k+3]*(1/255);for(D=P;D.left;)D=_(D.est,N,H,T,B)<=0?D.left:D.right;C[k>>2]=D.ind,M[k>>2]=D.est.rgba}return{abuf:O.buffer,inds:C,plte:z}}function y(x,b,I){I==null&&(I=1e-4);const O=new Uint32Array(x.buffer),M={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};M.bst=F(x,M.i0,M.i1),M.est=S(M.bst);const $=[M];for(;$.length<b;){let z=0,E=0;for(var P=0;P<$.length;P++)$[P].est.L>z&&(z=$[P].est.L,E=P);if(z<I)break;const C=$[E],D=R(x,O,C.i0,C.i1,C.est.e,C.est.eMq255);if(C.i0>=D||C.i1<=D){C.est.L=0;continue}const k={i0:C.i0,i1:D,bst:null,est:null,tdst:0,left:null,right:null};k.bst=F(x,k.i0,k.i1),k.est=S(k.bst);const N={i0:D,i1:C.i1,bst:null,est:null,tdst:0,left:null,right:null};for(N.bst={R:[],m:[],N:C.bst.N-k.bst.N},P=0;P<16;P++)N.bst.R[P]=C.bst.R[P]-k.bst.R[P];for(P=0;P<4;P++)N.bst.m[P]=C.bst.m[P]-k.bst.m[P];N.est=S(N.bst),C.left=k,C.right=N,$[E]=k,$.push(N)}for($.sort(((z,E)=>E.bst.N-z.bst.N)),P=0;P<$.length;P++)$[P].ind=P;return[M,$]}function w(x,b,I,O,M){if(x.left==null)return x.tdst=(function(k,N,H,T,B){const U=N-k[0],L=H-k[1],G=T-k[2],V=B-k[3];return U*U+L*L+G*G+V*V})(x.est.q,b,I,O,M),x;const $=_(x.est,b,I,O,M);let P=x.left,z=x.right;$>0&&(P=x.right,z=x.left);const E=w(P,b,I,O,M);if(E.tdst<=$*$)return E;const C=w(z,b,I,O,M);return C.tdst<E.tdst?C:E}function _(x,b,I,O,M){const{e:$}=x;return $[0]*b+$[1]*I+$[2]*O+$[3]*M-x.eMq}function R(x,b,I,O,M,$){for(O-=4;I<O;){for(;A(x,I,M)<=$;)I+=4;for(;A(x,O,M)>$;)O-=4;if(I>=O)break;const P=b[I>>2];b[I>>2]=b[O>>2],b[O>>2]=P,I+=4,O-=4}for(;A(x,I,M)>$;)I-=4;return I+4}function A(x,b,I){return x[b]*I[0]+x[b+1]*I[1]+x[b+2]*I[2]+x[b+3]*I[3]}function F(x,b,I){const O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=[0,0,0,0],$=I-b>>2;for(let P=b;P<I;P+=4){const z=x[P]*.00392156862745098,E=x[P+1]*(1/255),C=x[P+2]*(1/255),D=x[P+3]*(1/255);M[0]+=z,M[1]+=E,M[2]+=C,M[3]+=D,O[0]+=z*z,O[1]+=z*E,O[2]+=z*C,O[3]+=z*D,O[5]+=E*E,O[6]+=E*C,O[7]+=E*D,O[10]+=C*C,O[11]+=C*D,O[15]+=D*D}return O[4]=O[1],O[8]=O[2],O[9]=O[6],O[12]=O[3],O[13]=O[7],O[14]=O[11],{R:O,m:M,N:$}}function S(x){const{R:b}=x,{m:I}=x,{N:O}=x,M=I[0],$=I[1],P=I[2],z=I[3],E=O==0?0:1/O,C=[b[0]-M*M*E,b[1]-M*$*E,b[2]-M*P*E,b[3]-M*z*E,b[4]-$*M*E,b[5]-$*$*E,b[6]-$*P*E,b[7]-$*z*E,b[8]-P*M*E,b[9]-P*$*E,b[10]-P*P*E,b[11]-P*z*E,b[12]-z*M*E,b[13]-z*$*E,b[14]-z*P*E,b[15]-z*z*E],D=C,k=j;let N=[Math.random(),Math.random(),Math.random(),Math.random()],H=0,T=0;if(O!=0)for(let U=0;U<16&&(N=k.multVec(D,N),T=Math.sqrt(k.dot(N,N)),N=k.sml(1/T,N),!(U!=0&&Math.abs(T-H)<1e-9));U++)H=T;const B=[M*E,$*E,P*E,z*E];return{Cov:C,q:B,e:N,L:H,eMq255:k.dot(k.sml(255,B),N),eMq:k.dot(N,B),rgba:(Math.round(255*B[3])<<24|Math.round(255*B[2])<<16|Math.round(255*B[1])<<8|Math.round(255*B[0])<<0)>>>0}}var j={multVec:(x,b)=>[x[0]*b[0]+x[1]*b[1]+x[2]*b[2]+x[3]*b[3],x[4]*b[0]+x[5]*b[1]+x[6]*b[2]+x[7]*b[3],x[8]*b[0]+x[9]*b[1]+x[10]*b[2]+x[11]*b[3],x[12]*b[0]+x[13]*b[1]+x[14]*b[2]+x[15]*b[3]],dot:(x,b)=>x[0]*b[0]+x[1]*b[1]+x[2]*b[2]+x[3]*b[3],sml:(x,b)=>[x*b[0],x*b[1],x*b[2],x*b[3]]};Pe.encode=function(b,I,O,M,$,P,z){M==null&&(M=0),z==null&&(z=!1);const E=c(b,I,O,M,[!1,!1,!1,0,z,!1]);return f(E,-1),m(E,I,O,$,P)},Pe.encodeLL=function(b,I,O,M,$,P,z,E){const C={ctype:0+(M==1?0:2)+($==0?0:4),depth:P,frames:[]},D=(M+$)*P,k=D*I;for(let N=0;N<b.length;N++)C.frames.push({rect:{x:0,y:0,width:I,height:O},img:new Uint8Array(b[N]),blend:0,dispose:1,bpp:Math.ceil(D/8),bpl:Math.ceil(k/8)});return f(C,0,!0),m(C,I,O,z,E)},Pe.encode.compress=c,Pe.encode.dither=i,Pe.quantize=v,Pe.quantize.getKDtree=y,Pe.quantize.getNearest=w})();const pi={toArrayBuffer(e,t){const n=e.width,o=e.height,r=n<<2,s=e.getContext("2d").getImageData(0,0,n,o),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*o,f=122+m,c=new ArrayBuffer(f),l=new DataView(c),u=1<<20;let h,g,v,y,w=u,_=0,R=0,A=0;function F(x){l.setUint16(R,x,!0),R+=2}function S(x){l.setUint32(R,x,!0),R+=4}function j(x){R+=x}F(19778),S(f),j(4),S(122),S(108),S(n),S(-o>>>0),F(1),F(32),S(3),S(m),S(2835),S(2835),j(8),S(16711680),S(65280),S(255),S(4278190080),S(1466527264),(function x(){for(;_<o&&w>0;){for(y=122+_*i,h=0;h<r;)w--,g=a[A++],v=g>>>24,l.setUint32(y+h,g<<8|v),h+=4;_++}A<a.length?(w=u,setTimeout(x,pi._dly)):t(c)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Se={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Dp={[Se.CHROME]:16384,[Se.FIREFOX]:11180,[Se.DESKTOP_SAFARI]:16384,[Se.IE]:8192,[Se.IOS]:4096,[Se.ETC]:8192};const go=typeof window<"u",hi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Mn=go&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Lp=(go||hi)&&(Mn&&Mn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),gi=(go||hi)&&(Mn&&Mn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function xo(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 xi(e){return new Promise(((t,n)=>{const o=new gi;o.onload=()=>t(o.result),o.onerror=r=>n(r),o.readAsDataURL(e)}))}function vi(e){return new Promise(((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=r=>n(r),o.src=e}))}function bt(){if(bt.cachedResult!==void 0)return bt.cachedResult;let e=Se.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Se.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Se.IOS:/Safari/i.test(t)?e=Se.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Se.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Se.IE),bt.cachedResult=e,bt.cachedResult}function bi(e,t){const n=bt(),o=Dp[n];let r=e,s=t,a=r*s;const i=r>s?s/r:r/s;for(;a>o*o;){const m=(o+r)/2,f=(o+s)/2;m<f?(s=f,r=f*i):(s=m*i,r=m),a=r*s}return{width:r,height:s}}function Xn(e,t){let n,o;try{if(n=new OffscreenCanvas(e,t),o=n.getContext("2d"),o===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),o=n.getContext("2d")}return n.width=e,n.height=t,[n,o]}function wi(e,t){const{width:n,height:o}=bi(e.width,e.height),[r,s]=Xn(n,o);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,r.width,r.height)),s.drawImage(e,0,0,r.width,r.height),r}function Sn(){return Sn.cachedResult!==void 0||(Sn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Sn.cachedResult}function On(e,t={}){return new Promise((function(n,o){let r,s;var a=function(){try{return s=wi(r,t.fileType||e.type),n([r,s])}catch(m){return o(m)}},i=function(m){try{var f=function(c){try{throw c}catch(l){return o(l)}};try{let c;return xi(e).then((function(l){try{return c=l,vi(c).then((function(u){try{return r=u,(function(){try{return a()}catch(h){return o(h)}})()}catch(h){return f(h)}}),f)}catch(u){return f(u)}}),f)}catch(c){f(c)}}catch(c){return o(c)}};try{if(Sn()||[Se.DESKTOP_SAFARI,Se.MOBILE_SAFARI].includes(bt()))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 Dn(e,t,n,o,r=1){return new Promise((function(s,a){let i;if(t==="image/png"){let f,c,l;return f=e.getContext("2d"),{data:c}=f.getImageData(0,0,e.width,e.height),l=Pe.encode([c.buffer],e.width,e.height,4096*r),i=new Blob([l],{type:t}),i.name=n,i.lastModified=o,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((c=>pi.toBlob(e,c))).then((function(c){try{return i=c,i.name=n,i.lastModified=o,f.call(this)}catch(l){return a(l)}}).bind(this),a);{let c=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:r}).then((function(l){try{return i=l,i.name=n,i.lastModified=o,c.call(this)}catch(u){return a(u)}}).bind(this),a);{let l;return l=e.toDataURL(t,r),xo(l,n,o).then((function(u){try{return i=u,c.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return s(i)}}))}function ze(e){e.width=0,e.height=0}function It(){return new Promise((function(e,t){let n,o,r,s;return It.cachedResult!==void 0?e(It.cachedResult):xo("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,On(n).then((function(i){try{return o=i[1],Dn(o,n.type,n.name,n.lastModified).then((function(m){try{return r=m,ze(o),On(r).then((function(f){try{return s=f[0],It.cachedResult=s.width===1&&s.height===2,e(It.cachedResult)}catch(c){return t(c)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function yi(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 c=s.getUint16(i,f);i+=2;for(let l=0;l<c;l++)if(s.getUint16(i+12*l,f)==274)return t(s.getUint16(i+12*l+8,f))}else{if((65280&m)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},o.onerror=r=>n(r),o.readAsArrayBuffer(e)}))}function Ci(e,t){const{width:n}=e,{height:o}=e,{maxWidthOrHeight:r}=t;let s,a=e;return isFinite(r)&&(n>r||o>r)&&([a,s]=Xn(n,o),n>o?(a.width=r,a.height=o/n*r):(a.width=n/o*r,a.height=r),s.drawImage(e,0,0,a.width,a.height),ze(e)),a}function Si(e,t){const{width:n}=e,{height:o}=e,[r,s]=Xn(n,o);switch(t>4&&t<9?(r.width=o,r.height=n):(r.width=n,r.height=o),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,o);break;case 4:s.transform(1,0,0,-1,0,o);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,o,0);break;case 7:s.transform(0,-1,-1,0,o,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,o),ze(e),r}function ds(e,t,n=0){return new Promise((function(o,r){let s,a,i,m,f,c,l,u,h,g,v,y,w,_,R,A,F,S,j,x;function b(O=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=O,t.onProgress(Math.min(s,100))}function I(O){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(O,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,b(),On(e,t).then((function(O){try{return[,m]=O,b(),f=Ci(m,t),b(),new Promise((function(M,$){var P;if(!(P=t.exifOrientation))return yi(e).then((function(E){try{return P=E,z.call(this)}catch(C){return $(C)}}).bind(this),$);function z(){return M(P)}return z.call(this)})).then((function(M){try{return c=M,b(),It().then((function($){try{return l=$?f:Si(f,c),b(),u=t.initialQuality||1,h=t.fileType||e.type,Dn(l,h,e.name,e.lastModified,u).then((function(P){try{{let E=function(){if(a--&&(R>i||R>w)){let D,k;return D=x?.95*j.width:j.width,k=x?.95*j.height:j.height,[F,S]=Xn(D,k),S.drawImage(j,0,0,D,k),u*=h==="image/png"?.85:.95,Dn(F,h,e.name,e.lastModified,u).then((function(N){try{return A=N,ze(j),j=F,R=A.size,I(Math.min(99,Math.floor((_-R)/(_-i)*100))),E}catch(H){return r(H)}}),r)}return[1]},C=function(){return ze(j),ze(F),ze(f),ze(l),ze(m),I(100),o(A)};if(g=P,b(),v=g.size>i,y=g.size>e.size,!v&&!y)return I(100),o(g);var z;return w=e.size,_=g.size,R=_,j=l,x=!t.alwaysKeepResolution&&v,(z=(function(D){for(;D;){if(D.then)return void D.then(z,r);try{if(D.pop){if(D.length)return D.pop()?C.call(this):D;D=E}else D=D.call(this)}catch(k){return r(k)}}}).bind(this))(E)}}catch(E){return r(E)}}).bind(this),r)}catch(P){return r(P)}}).bind(this),r)}catch($){return r($)}}).bind(this),r)}catch(M){return r(M)}}).bind(this),r)}))}const Fp=`
183
+ let scriptImported = false
184
+ self.addEventListener('message', async (e) => {
185
+ const { file, id, imageCompressionLibUrl, options } = e.data
186
+ options.onProgress = (progress) => self.postMessage({ progress, id })
187
+ try {
188
+ if (!scriptImported) {
189
+ // console.log('[worker] importScripts', imageCompressionLibUrl)
190
+ self.importScripts(imageCompressionLibUrl)
191
+ scriptImported = true
192
+ }
193
+ // console.log('[worker] self', self)
194
+ const compressedFile = await imageCompression(file, options)
195
+ self.postMessage({ file: compressedFile, id })
196
+ } catch (e) {
197
+ // console.error('[worker] error', e)
198
+ self.postMessage({ error: e.message + '\\n' + e.stack, id })
199
+ }
200
+ })
201
+ `;let hr;function $p(e,t){return new Promise(((n,o)=>{hr||(hr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Fp));const r=new Worker(hr);r.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)r.terminate();else if(a.data.progress===void 0){if(a.data.error)return o(new Error(a.data.error)),void r.terminate();n(a.data.file),r.terminate()}else t.onProgress(a.data.progress)})),r.addEventListener("error",o),t.signal&&t.signal.addEventListener("abort",(()=>{o(t.signal.reason),r.terminate()})),r.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function ve(e,t){return new Promise((function(n,o){let r,s,a,i,m,f;if(r={...t},a=0,{onProgress:i}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Lp))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 ds(e,r).then((function(h){try{return s=h,u.call(this)}catch(g){return o(g)}}).bind(this),o);var c=(function(){try{return u.call(this)}catch(h){return o(h)}}).bind(this),l=function(h){try{return ds(e,r).then((function(g){try{return s=g,c()}catch(v){return o(v)}}),o)}catch(g){return o(g)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",$p(e,r).then((function(h){try{return s=h,c()}catch{return l()}}),l)}catch{l()}function u(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{r.preserveExif&&e.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===e.type)&&(s=mi(e,s))}catch{}return n(s)}}))}ve.getDataUrlFromFile=xi,ve.getFilefromDataUrl=xo,ve.loadImage=vi,ve.drawImageInCanvas=wi,ve.drawFileInCanvas=On,ve.canvasToFile=Dn,ve.getExifOrientation=yi,ve.handleMaxWidthOrHeight=Ci,ve.followExifOrientation=Si,ve.cleanupCanvasMemory=ze,ve.isAutoOrientationInBrowser=It,ve.approximateBelowMaximumCanvasSizeOfBrowser=bi,ve.copyExifWithoutOrientation=mi,ve.getBrowserName=bt,ve.version="2.0.2";var zp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dt=zp.reduce((e,t)=>{const n=Js(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Up=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"}),Bp="VisuallyHidden",Ei=p.forwardRef((e,t)=>d.jsx(ue.span,{...e,ref:t,style:{...Up,...e.style}}));Ei.displayName=Bp;var Hp=Ei,[Yn]=Qe("Tooltip",[Ut]),Qn=Ut(),ki="TooltipProvider",Wp=700,Or="tooltip.open",[Gp,vo]=Yn(ki),Ai=e=>{const{__scopeTooltip:t,delayDuration:n=Wp,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),d.jsx(Gp,{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})};Ai.displayName=ki;var en="Tooltip",[Vp,dn]=Yn(en),_i=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=vo(en,e.__scopeTooltip),f=Qn(t),[c,l]=p.useState(null),u=ye(),h=p.useRef(0),g=a??m.disableHoverableContent,v=i??m.delayDuration,y=p.useRef(!1),[w,_]=at({prop:o,defaultProp:r??!1,onChange:j=>{j?(m.onOpen(),document.dispatchEvent(new CustomEvent(Or))):m.onClose(),s==null||s(j)},caller:en}),R=p.useMemo(()=>w?y.current?"delayed-open":"instant-open":"closed",[w]),A=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,_(!0)},[_]),F=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),S=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,_(!0),h.current=0},v)},[v,_]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),d.jsx(ro,{...f,children:d.jsx(Vp,{scope:t,contentId:u,open:w,stateAttribute:R,trigger:c,onTriggerChange:l,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?S():A()},[m.isOpenDelayedRef,S,A]),onTriggerLeave:p.useCallback(()=>{g?F():(window.clearTimeout(h.current),h.current=0)},[F,g]),onOpen:A,onClose:F,disableHoverableContent:g,children:n})})};_i.displayName=en;var Dr="TooltipTrigger",Ri=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=dn(Dr,n),s=vo(Dr,n),a=Qn(n),i=p.useRef(null),m=pe(t,i,r.onTriggerChange),f=p.useRef(!1),c=p.useRef(!1),l=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",l),[l]),d.jsx(Gn,{asChild:!0,...a,children:d.jsx(ue.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:m,onPointerMove:ee(e.onPointerMove,u=>{u.pointerType!=="touch"&&!c.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),c.current=!0)}),onPointerLeave:ee(e.onPointerLeave,()=>{r.onTriggerLeave(),c.current=!1}),onPointerDown:ee(e.onPointerDown,()=>{r.open&&r.onClose(),f.current=!0,document.addEventListener("pointerup",l,{once:!0})}),onFocus:ee(e.onFocus,()=>{f.current||r.onOpen()}),onBlur:ee(e.onBlur,r.onClose),onClick:ee(e.onClick,r.onClose)})})});Ri.displayName=Dr;var bo="TooltipPortal",[Kp,qp]=Yn(bo,{forceMount:void 0}),ji=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=dn(bo,t);return d.jsx(Kp,{scope:t,forceMount:n,children:d.jsx(je,{present:n||s.open,children:d.jsx(an,{asChild:!0,container:r,children:o})})})};ji.displayName=bo;var Lt="TooltipContent",Ti=p.forwardRef((e,t)=>{const n=qp(Lt,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=dn(Lt,e.__scopeTooltip);return d.jsx(je,{present:o||a.open,children:a.disableHoverableContent?d.jsx(Ni,{side:r,...s,ref:t}):d.jsx(Xp,{side:r,...s,ref:t})})}),Xp=p.forwardRef((e,t)=>{const n=dn(Lt,e.__scopeTooltip),o=vo(Lt,e.__scopeTooltip),r=p.useRef(null),s=pe(t,r),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,c=r.current,{onPointerInTransitChange:l}=o,u=p.useCallback(()=>{i(null),l(!1)},[l]),h=p.useCallback((g,v)=>{const y=g.currentTarget,w={x:g.clientX,y:g.clientY},_=Jp(w,y.getBoundingClientRect()),R=eh(w,_),A=th(v.getBoundingClientRect()),F=rh([...R,...A]);i(F),l(!0)},[l]);return p.useEffect(()=>()=>u(),[u]),p.useEffect(()=>{if(m&&c){const g=y=>h(y,c),v=y=>h(y,m);return m.addEventListener("pointerleave",g),c.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",g),c.removeEventListener("pointerleave",v)}}},[m,c,h,u]),p.useEffect(()=>{if(a){const g=v=>{const y=v.target,w={x:v.clientX,y:v.clientY},_=(m==null?void 0:m.contains(y))||(c==null?void 0:c.contains(y)),R=!nh(w,a);_?u():R&&(u(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,c,a,f,u]),d.jsx(Ni,{...e,ref:s})}),[Yp,Qp]=Yn(en,{isInside:!1}),Zp=Qu("TooltipContent"),Ni=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,m=dn(Lt,n),f=Qn(n),{onClose:c}=m;return p.useEffect(()=>(document.addEventListener(Or,c),()=>document.removeEventListener(Or,c)),[c]),p.useEffect(()=>{if(m.trigger){const l=u=>{const h=u.target;h!=null&&h.contains(m.trigger)&&c()};return window.addEventListener("scroll",l,{capture:!0}),()=>window.removeEventListener("scroll",l,{capture:!0})}},[m.trigger,c]),d.jsx(on,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l=>l.preventDefault(),onDismiss:c,children:d.jsxs(oo,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(Zp,{children:o}),d.jsx(Yp,{scope:n,isInside:!0,children:d.jsx(Hp,{id:m.contentId,role:"tooltip",children:r||o})})]})})});Ti.displayName=Lt;var Ii="TooltipArrow",Pi=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=Qn(n);return Qp(Ii,n).isInside?null:d.jsx(so,{...r,...o,ref:t})});Pi.displayName=Ii;function Jp(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 eh(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 th(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 nh(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,c=i.y,l=m.x,u=m.y;c>o!=u>o&&n<(l-f)*(o-c)/(u-c)+f&&(r=!r)}return r}function rh(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),oh(t)}function oh(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 sh=Ai,ah=_i,ih=Ri,lh=ji,ch=Ti,uh=Pi;function dh({delayDuration:e=0,...t}){return d.jsx(sh,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function fh({...e}){return d.jsx(dh,{children:d.jsx(ah,{"data-slot":"tooltip",...e})})}function mh({...e}){return d.jsx(ih,{"data-slot":"tooltip-trigger",...e})}function ph({className:e,sideOffset:t=0,children:n,...o}){return d.jsx(lh,{children:d.jsxs(ch,{"data-slot":"tooltip-content",sideOffset:t,className:J("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...o,children:[n,d.jsx(uh,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const hh=p.lazy(()=>Re(()=>import("./mermaid-VLURNSYL-DutpHHm9.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));p.createContext(null);const wo=p.memo(({className:e,children:t,...n})=>d.jsx(p.Suspense,{fallback:d.jsx("div",{className:J("whitespace-pre-wrap break-words",e),children:t}),children:d.jsx(hh,{className:J("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);wo.displayName="MessageResponse";var Zn="Collapsible",[gh]=Qe(Zn),[xh,yo]=gh(Zn),Mi=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:a,...i}=e,[m,f]=at({prop:o,defaultProp:r??!1,onChange:a,caller:Zn});return d.jsx(xh,{scope:n,disabled:s,contentId:ye(),open:m,onOpenToggle:p.useCallback(()=>f(c=>!c),[f]),children:d.jsx(ue.div,{"data-state":So(m),"data-disabled":s?"":void 0,...i,ref:t})})});Mi.displayName=Zn;var Oi="CollapsibleTrigger",Di=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,r=yo(Oi,n);return d.jsx(ue.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":So(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:t,onClick:ee(e.onClick,r.onOpenToggle)})});Di.displayName=Oi;var Co="CollapsibleContent",Li=p.forwardRef((e,t)=>{const{forceMount:n,...o}=e,r=yo(Co,e.__scopeCollapsible);return d.jsx(je,{present:n||r.open,children:({present:s})=>d.jsx(vh,{...o,ref:t,present:s})})});Li.displayName=Co;var vh=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:r,...s}=e,a=yo(Co,n),[i,m]=p.useState(o),f=p.useRef(null),c=pe(t,f),l=p.useRef(0),u=l.current,h=p.useRef(0),g=h.current,v=a.open||i,y=p.useRef(v),w=p.useRef(void 0);return p.useEffect(()=>{const _=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(_)},[]),Ke(()=>{const _=f.current;if(_){w.current=w.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const R=_.getBoundingClientRect();l.current=R.height,h.current=R.width,y.current||(_.style.transitionDuration=w.current.transitionDuration,_.style.animationName=w.current.animationName),m(o)}},[a.open,o]),d.jsx(ue.div,{"data-state":So(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:c,style:{"--radix-collapsible-content-height":u?`${u}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&r})});function So(e){return e?"open":"closed"}var bh=Mi;function wh({...e}){return d.jsx(bh,{"data-slot":"collapsible",...e})}function yh({...e}){return d.jsx(Di,{"data-slot":"collapsible-trigger",...e})}function Ch({...e}){return d.jsx(Li,{"data-slot":"collapsible-content",...e})}const Sh=({children:e,as:t="p",className:n,duration:o=2})=>{const r=Dl.create(t);return d.jsx(r,{animate:{opacity:[.5,1,.5]},className:J("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:o,ease:"easeInOut"},children:e})},Eh=p.memo(Sh),Fi=p.createContext(null),kh=()=>{const e=p.useContext(Fi);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Ah=1e3,_h=1e3,$i=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:o=!0,onOpenChange:r,duration:s,children:a,...i})=>{const[m,f]=at({prop:n,defaultProp:o,onChange:r}),[c,l]=at({prop:s,defaultProp:void 0}),[u,h]=p.useState(!1),[g,v]=p.useState(null);p.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(l(Math.ceil((Date.now()-g)/_h)),v(null))},[t,g,l]);const y=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!y&&o&&!t&&m&&!u){const _=setTimeout(()=>{f(!1),h(!0)},Ah);return()=>clearTimeout(_)}},[t,m,o,f,u,y]);const w=_=>{f(_)};return d.jsx(Fi.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:c},children:d.jsx(wh,{className:J("not-prose mb-4",e),onOpenChange:w,open:m,...i,children:a})})}),Rh=(e,t)=>e||t===0?d.jsx(Eh,{duration:1,children:"Thinking..."}):t===void 0?d.jsx("p",{children:"Thought for a few seconds"}):d.jsxs("p",{children:["Thought for ",t," seconds"]}),zi=p.memo(({className:e,children:t,getThinkingMessage:n=Rh,...o})=>{const{isStreaming:r,isOpen:s,duration:a}=kh();return d.jsx(yh,{className:J("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??d.jsxs(d.Fragment,{children:[d.jsx(Fc,{className:"size-4"}),n(r,a),d.jsx(rn,{className:J("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),Ui=p.memo(({className:e,children:t,...n})=>d.jsx(Ch,{className:J("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}));$i.displayName="Reasoning";zi.displayName="ReasoningTrigger";Ui.displayName="ReasoningContent";const gr=200;function jh({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>gr+4)},[]);return p.useEffect(()=>{a()},[a,e.content]),d.jsx("div",{className:"flex justify-end",children:d.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,m)=>d.jsx(Nh,{image:i},m))}),e.attachments&&e.attachments.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((i,m)=>d.jsx(Ih,{attachment:i},m))}),e.content&&d.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[d.jsx("div",{ref:s,className:J("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&o&&`max-h-[${gr}px]`),style:!t&&o?{maxHeight:`${gr}px`}:void 0,children:Rc(e.content)}),!t&&o&&d.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:d.jsxs("button",{type:"button",onClick:()=>n(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[d.jsx("span",{children:"展开"}),d.jsx(rn,{className:"h-3 w-3"})]})})]})]})})}function Th({entry:e,isStreaming:t}){return d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[d.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,o)=>{if(n.type==="thought"){const r=o===e.chunks.length-1,s=t&&r;return d.jsxs($i,{isStreaming:s,children:[d.jsx(zi,{}),d.jsx(Ui,{children:d.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},o)}return d.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:d.jsx(wo,{children:n.text})},o)})]})]})}function Nh({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return d.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:d.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function Ih({attachment:e}){const[t,n]=p.useState(!1),o=(()=>{switch(e.kind){case"text":return d.jsx(Yt,{className:"h-4 w-4"});case"table":return d.jsx(Kr,{className:"h-4 w-4"});case"directory":return d.jsx(Vr,{className:"h-4 w-4"});default:return d.jsx(Yt,{className:"h-4 w-4"})}})(),r=e.size!=null?Ph(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return d.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[d.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:J("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[o,d.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[d.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),d.jsxs("div",{className:"text-[10px] text-text-muted",children:[r&&d.jsx("span",{children:r}),r&&s!=null&&d.jsx("span",{children:" · "}),s!=null&&d.jsxs("span",{children:[s," 个文件"]})]})]}),a&&d.jsx(rn,{className:J("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&d.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:d.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function Ph(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Mh(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function Oh(e){switch(e){case"allow_once":case"allow_always":return d.jsx(nn,{className:"size-4"});case"reject_once":case"reject_always":return d.jsx($n,{className:"size-4"});default:return null}}function Dh({requestId:e,options:t,onRespond:n,className:o}){const r=s=>{n(e,s.optionId,s.kind)};return d.jsxs("div",{className:J("p-3 border-t border-warning-border/30 bg-warning-bg/50",o),children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(qs,{className:"size-4 text-warning-text"}),d.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>d.jsxs(kt,{variant:Mh(s.kind),size:"sm",onClick:()=>r(s),className:"gap-1.5",children:[Oh(s.kind),s.name]},s.optionId))})]})}function Bi({entries:e,onPermissionRespond:t}){const[n,o]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return d.jsx("div",{className:"pl-10",children:d.jsx(fs,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const r=Lh(e);return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand font-bold hover:bg-brand/10 transition-colors",onClick:()=>o(!n),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:J("transition-transform text-text-muted",n&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs text-brand font-bold font-display",children:r})]}),n&&d.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>d.jsx(fs,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function fs({tool:e,compact:t,onPermissionRespond:n}){const[o,r]=p.useState(!t),s=(()=>{switch(e.status){case"running":return d.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return d.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return d.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return d.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=e.status!=="running"&&e.status!=="waiting_for_confirmation"&&(e.rawOutput||e.content);return d.jsxs("div",{className:J("px-3 py-2",t&&"py-1.5"),children:[d.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>r(!o),children:[s,d.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&d.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&d.jsx("div",{className:"mt-1.5 ml-4",children:d.jsx(Dh,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),o&&d.jsxs("div",{className:"mt-1.5 ml-4 space-y-1.5",children:[e.rawInput&&Object.keys(e.rawInput).length>0&&d.jsx("div",{children:d.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Lr(JSON.stringify(e.rawInput,null,2),2e3)})}),a&&d.jsx("div",{children:d.jsx("pre",{className:J("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:$h(e)})})]})]})}function Lh(e){const t=new Map;for(const o of e){const r=Fh(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 Fh(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function $h(e){if(e.content&&e.content.length>0){const t=e.content.filter(n=>n.type==="content").filter(n=>n.content.type==="text"&&"text"in n.content).map(n=>n.content.text);if(t.length>0)return Lr(t.join(`
202
+ `),2e3)}return e.rawOutput&&Object.keys(e.rawOutput).length>0?Lr(JSON.stringify(e.rawOutput,null,2),2e3):""}function Lr(e,t){return e.length>t?e.slice(0,t)+"...":e}function zh({entry:e}){const[t,n]=p.useState(!1),{entries:o}=e;if(o.length===0)return null;const r=o.filter(i=>i.status==="completed").length,s=o.length,a=s>0?Math.round(r/s*100):0;return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:J("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[r,"/",s]}),d.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:d.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&d.jsx("div",{className:J("border-t border-border px-3 py-1.5 space-y-0.5",s>5&&"max-h-64 overflow-y-auto"),children:o.map((i,m)=>d.jsx(Uh,{entry:i},m))})]})})}function Uh({entry:e}){return d.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[d.jsx("span",{className:"flex-shrink-0 mt-0.5",children:d.jsx(Bh,{status:e.status})}),d.jsx("span",{className:J("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),d.jsx(Hh,{priority:e.priority})]})}function Bh({status:e}){switch(e){case"completed":return d.jsx(Gc,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return d.jsx(Gs,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return d.jsx(Kc,{className:"h-3.5 w-3.5 text-text-muted"})}}function Hh({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:"高",medium:"中",low:"低"};return d.jsx("span",{className:J("text-[9px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function Wh({entry:e}){const t=e.variant==="error";return d.jsxs("div",{className:"w-full",children:[d.jsx("div",{className:J("border-t-2",t?"border-status-error":"border-border")}),d.jsxs("div",{className:"pt-3",children:[d.jsx("h3",{className:J("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&d.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),d.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:d.jsx(wo,{children:e.outputText})}),d.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
203
+ * Copyright (c) StackBlitz. All rights reserved.
204
+ * Licensed under the MIT License. See License.txt in the project root for license information.
205
+ *--------------------------------------------------------------------------------------------*/const Gh={damping:.7,stiffness:.05,mass:1.25},Vh=70,Kh=1e3/60,qh=350;let Jn=!1;var Ss;(Ss=globalThis.document)==null||Ss.addEventListener("mousedown",()=>{Jn=!0});var Es;(Es=globalThis.document)==null||Es.addEventListener("mouseup",()=>{Jn=!1});var ks;(ks=globalThis.document)==null||ks.addEventListener("click",()=>{Jn=!1});const Xh=(e={})=>{const[t,n]=p.useState(!1),[o,r]=p.useState(e.initial!==!1),[s,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var A;if(!Jn)return!1;const _=window.getSelection();if(!_||!_.rangeCount)return!1;const R=_.getRangeAt(0);return R.commonAncestorContainer.contains(y.current)||((A=y.current)==null?void 0:A.contains(R.commonAncestorContainer))},[]),f=p.useCallback(_=>{l.isAtBottom=_,r(_)},[]),c=p.useCallback(_=>{l.escapedFromLock=_,n(_)},[]),l=p.useMemo(()=>{let _;return{escapedFromLock:t,isAtBottom:o,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var R;return((R=y.current)==null?void 0:R.scrollTop)??0},set scrollTop(R){if(y.current){const{scrollBehavior:A}=getComputedStyle(y.current);A!=="auto"&&(y.current.style.scrollBehavior="auto"),y.current.scrollTop=R,l.ignoreScrollToTop=y.current.scrollTop,A!=="auto"&&(y.current.style.scrollBehavior=A)}},get targetScrollTop(){return!y.current||!w.current?0:y.current.scrollHeight-1-y.current.clientHeight},get calculatedTargetScrollTop(){if(!y.current||!w.current)return 0;const{targetScrollTop:R}=this;if(!e.targetScrollTop)return R;if((_==null?void 0:_.targetScrollTop)===R)return _.calculatedScrollTop;const A=Math.max(Math.min(e.targetScrollTop(R,{scrollElement:y.current,contentElement:w.current}),R),0);return _={targetScrollTop:R,calculatedScrollTop:A},requestAnimationFrame(()=>{_=void 0}),A},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Vh}}},[]),u=p.useCallback((_={})=>{var b;typeof _=="string"&&(_={animation:_}),_.preserveScrollPosition||f(!0);const R=Date.now()+(Number(_.wait)||0),A=vr(i.current,_.animation),{ignoreEscapes:F=!1}=_;let S,j=l.calculatedTargetScrollTop;_.duration instanceof Promise?_.duration.finally(()=>{S=Date.now()}):S=R+(_.duration??0);const x=async()=>{const I=new Promise(requestAnimationFrame).then(()=>{var P;if(!l.isAtBottom)return l.animation=void 0,!1;const{scrollTop:O}=l,M=performance.now(),$=(M-(l.lastTick??M))/Kh;if(l.animation||(l.animation={behavior:A,promise:I,ignoreEscapes:F}),l.animation.behavior===A&&(l.lastTick=M),m()||R>Date.now())return x();if(O<Math.min(j,l.calculatedTargetScrollTop)){if(((P=l.animation)==null?void 0:P.behavior)===A){if(A==="instant")return l.scrollTop=l.calculatedTargetScrollTop,x();l.velocity=(A.damping*l.velocity+A.stiffness*l.scrollDifference)/A.mass,l.accumulated+=l.velocity*$,l.scrollTop+=l.accumulated,l.scrollTop!==O&&(l.accumulated=0)}return x()}return S>Date.now()?(j=l.calculatedTargetScrollTop,x()):(l.animation=void 0,l.scrollTop<l.calculatedTargetScrollTop?u({animation:vr(i.current,i.current.resize),ignoreEscapes:F,duration:Math.max(0,S-Date.now())||void 0}):l.isAtBottom)});return I.then(O=>(requestAnimationFrame(()=>{l.animation||(l.lastTick=void 0,l.velocity=0)}),O))};return _.wait!==!0&&(l.animation=void 0),((b=l.animation)==null?void 0:b.behavior)===A?l.animation.promise:x()},[f,m,l]),h=p.useCallback(()=>{c(!0),f(!1)},[c,f]),g=p.useCallback(({target:_})=>{if(_!==y.current)return;const{scrollTop:R,ignoreScrollToTop:A}=l;let{lastScrollTop:F=R}=l;l.lastScrollTop=R,l.ignoreScrollToTop=void 0,A&&A>R&&(F=A),a(l.isNearBottom),setTimeout(()=>{var x;if(l.resizeDifference||R===A)return;if(m()){c(!0),f(!1);return}const S=R>F,j=R<F;if((x=l.animation)!=null&&x.ignoreEscapes){l.scrollTop=F;return}j&&(c(!0),f(!1)),S&&c(!1),!l.escapedFromLock&&l.isNearBottom&&f(!0)},1)},[c,f,m,l]),v=p.useCallback(({target:_,deltaY:R})=>{var F;let A=_;for(;!["scroll","auto"].includes(getComputedStyle(A).overflow);){if(!A.parentElement)return;A=A.parentElement}A===y.current&&R<0&&y.current.scrollHeight>y.current.clientHeight&&!((F=l.animation)!=null&&F.ignoreEscapes)&&(c(!0),f(!1))},[c,f,l]),y=ms(_=>{var R,A;(R=y.current)==null||R.removeEventListener("scroll",g),(A=y.current)==null||A.removeEventListener("wheel",v),_==null||_.addEventListener("scroll",g,{passive:!0}),_==null||_.addEventListener("wheel",v,{passive:!0})},[]),w=ms(_=>{var A,F;if((A=l.resizeObserver)==null||A.disconnect(),!_)return;let R;l.resizeObserver=new ResizeObserver(([S])=>{const{height:j}=S.contentRect,x=j-(R??j);if(l.resizeDifference=x,l.scrollTop>l.targetScrollTop&&(l.scrollTop=l.targetScrollTop),a(l.isNearBottom),x>=0){const b=vr(i.current,R?i.current.resize:i.current.initial);u({animation:b,wait:!0,preserveScrollPosition:!0,duration:b==="instant"?void 0:qh})}else l.isNearBottom&&(c(!1),f(!0));R=j,requestAnimationFrame(()=>{setTimeout(()=>{l.resizeDifference===x&&(l.resizeDifference=0)},1)})}),(F=l.resizeObserver)==null||F.observe(_)},[]);return{contentRef:w,scrollRef:y,scrollToBottom:u,stopScroll:h,isAtBottom:o||s,isNearBottom:s,escapedFromLock:t,state:l}};function ms(e,t){const n=p.useCallback(o=>(n.current=o,e(o)),t);return n}const xr=new Map;function vr(...e){const t={...Gh};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 xr.has(o)||xr.set(o,Object.freeze(t)),n?"instant":xr.get(o)}/*!---------------------------------------------------------------------------------------------
206
+ * Copyright (c) StackBlitz. All rights reserved.
207
+ * Licensed under the MIT License. See License.txt in the project root for license information.
208
+ *--------------------------------------------------------------------------------------------*/const Hi=p.createContext(null),Yh=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Ln({instance:e,children:t,resize:n,initial:o,mass:r,damping:s,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const c=p.useRef(null),l=p.useCallback((F,S)=>{const j=(A==null?void 0:A.targetScrollTop)??i;return(j==null?void 0:j(F,S))??F},[i]),u=Xh({mass:r,damping:s,stiffness:a,resize:n,initial:o,targetScrollTop:l}),{scrollRef:h,contentRef:g,scrollToBottom:v,stopScroll:y,isAtBottom:w,escapedFromLock:_,state:R}=e??u,A=p.useMemo(()=>({scrollToBottom:v,stopScroll:y,scrollRef:h,isAtBottom:w,escapedFromLock:_,contentRef:g,state:R,get targetScrollTop(){return c.current},set targetScrollTop(F){c.current=F}}),[v,w,g,h,y,_,R]);return p.useImperativeHandle(m,()=>A,[A]),Yh(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(Hi.Provider,{value:A},p.createElement("div",{...f},typeof t=="function"?t(A):t))}(function(e){function t({children:n,scrollClassName:o,...r}){const s=Eo();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})(Ln||(Ln={}));function Eo(){const e=p.useContext(Hi);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const Qh=({className:e,...t})=>d.jsx(Ln,{className:J("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Zh=({className:e,...t})=>d.jsx(Ln.Content,{className:J("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}),Jh=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:o,children:r,...s})=>d.jsx("div",{className:J("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:r??d.jsxs(d.Fragment,{children:[o&&d.jsx("div",{className:"text-text-muted",children:o}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&d.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),eg=({className:e,...t})=>{const{scrollToBottom:n}=Eo(),o=p.useCallback(()=>{n()},[n]);return d.jsx(kt,{className:J("rounded-full",e),onClick:o,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:d.jsx(Dc,{className:"size-4"})})},tg="data-last-user-message",ng=({className:e,...t})=>{const n=p.useCallback(()=>{const o=document.querySelector(`[${tg}="true"]`);o&&o.scrollIntoView({behavior:"smooth",block:"start"})},[]);return d.jsx(kt,{className:J("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:d.jsx(Nu,{className:"size-4"})})},rg=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:o}=Eo();return o?null:d.jsxs("div",{className:J("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&d.jsx(ng,{}),d.jsx(eg,{})]})};function og({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:o="开始对话",emptyDescription:r="输入消息开始聊天"}){var m;const s=ig(e),a=e.length>0,i=t&&e.length>0&&((m=e[e.length-1])==null?void 0:m.type)==="user_message";return d.jsx(Qh,{className:"flex-1",children:d.jsxs(Zh,{children:[a?d.jsxs(d.Fragment,{children:[s.map((f,c)=>f.type==="single"?d.jsx("div",{className:J(sg(e,c)),children:d.jsx(ag,{entry:f.entry,isLoading:t,onPermissionRespond:n})},`entry-${c}`):d.jsx("div",{className:"-mt-2",children:d.jsx(Bi,{entries:f.entries,onPermissionRespond:n})},`group-${c}`)),i&&d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsx("div",{className:"flex items-center gap-1 pt-2",children:d.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[d.jsx("span",{}),d.jsx("span",{}),d.jsx("span",{})]})})]})]}):d.jsx(Jh,{title:o,description:r}),d.jsx(rg,{hasUserMessages:e.some(f=>f.type==="user_message")})]})})}function sg(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 ag({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return d.jsx(jh,{entry:e});case"assistant_message":return d.jsx(Th,{entry:e,isStreaming:t});case"tool_call":return d.jsx(Bi,{entries:[e],onPermissionRespond:n});case"plan":return d.jsx(zh,{entry:e});case"command_output":return d.jsx(Wh,{entry:e});default:return null}}function ig(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 lg(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function cg({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=>lg(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=c=>{s.current&&!s.current.contains(c.target)&&o()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),p.useEffect(()=>{const f=c=>{if(m.length!==0){if(c.key==="ArrowDown")c.preventDefault(),i(l=>(l+1)%m.length);else if(c.key==="ArrowUp")c.preventDefault(),i(l=>(l-1+m.length)%m.length);else if(c.key==="Enter"&&!c.shiftKey){c.preventDefault();const l=m[a];l&&n(l)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=s.current;if(!f)return;const c=f.querySelector("[data-active='true']");c==null||c.scrollIntoView({block:"nearest"})},[a]),d.jsx("div",{ref:s,className:J("rounded-xl border border-border bg-surface-2 shadow-lg",r),children:d.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?d.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:"没有匹配的命令"}):m.map((f,c)=>{var l;return d.jsxs("button",{type:"button","data-active":c===a,onClick:()=>n(f),onMouseEnter:()=>i(c),className:J("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",c===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[d.jsxs("span",{className:"text-sm font-display font-medium text-brand",children:["/",f.name]}),d.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((l=f.input)==null?void 0:l.hint)&&d.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function wt(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 ug={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},dg=500*1024,Wi=2*1024*1024,br=200,ps=5*1024*1024,fg=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"]),mg=new Set([".csv",".tsv",".xlsx",".xls"]);function tn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Gi(e){if(e.type.startsWith("text/"))return!0;const t=tn(e.name);return fg.has(t)}function Fr(e){const t=tn(e.name);return mg.has(t)}function pg({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:o=!1,placeholder:r="给 Saluzi 发送消息…",supportsAttachments:s,supportsImages:a,commands:i,className:m}){const f=s??a??!1,[c,l]=p.useState(""),[u,h]=p.useState([]),[g,v]=p.useState([]),[y,w]=p.useState(!1),[_,R]=p.useState(""),[A,F]=p.useState(!1),[S,j]=p.useState(!1),[x,b]=p.useState(!1),I=p.useRef(null),O=p.useRef(null),M=p.useRef(null),$=p.useRef(null),P=p.useRef(null),z=p.useRef(null),E=p.useRef(null);p.useEffect(()=>{wt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:f,commandsCount:(i==null?void 0:i.length)??0})},[f,i]),p.useEffect(()=>{if(!S)return;const W=q=>{var re,fe;const Z=q.target,te=(re=z.current)==null?void 0:re.contains(Z),ie=(fe=E.current)==null?void 0:fe.contains(Z);!te&&!ie&&j(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[S]);const C=p.useCallback(W=>{const q=(W??c).trim(),Z=u.length>0||g.length>0;!q&&!Z||o||x||(e({text:q,images:u.length>0?u:void 0,attachments:g.length>0?g:void 0}),l(""),h([]),v([]),w(!1),R(""),I.current&&(I.current.style.height="auto"))},[c,u,g,o,x,e]),D=p.useCallback(W=>{if(y){if(W.key==="Escape"){W.preventDefault(),w(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),w(!1);return}}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t?n==null||n():C())},[C,t,n,y]),k=p.useCallback(W=>{const q=W.target.value;l(q),q.startsWith("/")&&i&&i.length>0?(w(!0),R(q.slice(1).split(/\s/)[0]||"")):y&&(w(!1),R(""));const Z=W.target;Z.style.height="auto",Z.style.height=Math.min(Z.scrollHeight,200)+"px"},[i,y]),N=p.useCallback(async W=>{if(wt("[ChatInput] paste event",{canAttach:f,files:W.clipboardData.files.length,types:W.clipboardData.types}),!f)return;const q=Array.from(W.clipboardData.files).filter(Z=>Z.type.startsWith("image/"));if(wt("[ChatInput] paste image files",{count:q.length,types:q.map(Z=>Z.type)}),q.length!==0){W.preventDefault(),b(!0);try{const Z=await wr(q);h(te=>[...te,...Z])}finally{b(!1)}}},[f]),H=p.useCallback(async()=>{if(!O.current)return;const W=O.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await wr(Array.from(W));h(Z=>[...Z,...q])}finally{O.current.value="",b(!1)}}},[]),T=p.useCallback(async()=>{if(!M.current)return;const W=M.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await hs(Array.from(W));v(Z=>[...Z,...q])}finally{M.current.value="",b(!1)}}},[]),B=p.useCallback(async()=>{if(!$.current)return;const W=$.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await gs(Array.from(W));v(Z=>[...Z,...q])}finally{$.current.value="",b(!1)}}},[]),U=p.useCallback(async()=>{if(!P.current)return;const W=P.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await gg(Array.from(W));q&&v(Z=>[...Z,q])}finally{P.current.value="",b(!1)}}},[]),L=p.useCallback(W=>{h(q=>q.filter((Z,te)=>te!==W))},[]),G=p.useCallback(W=>{v(q=>q.filter((Z,te)=>te!==W))},[]),V=p.useCallback(W=>{var Z,te;w(!1),R("");const q=`/${W.name}`;(Z=W.input)!=null&&Z.hint?(l(`${q} `),(te=I.current)==null||te.focus()):C(q)},[C]),Y=p.useCallback(W=>{f&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",A||F(!0))},[f,A]),K=p.useCallback(W=>{const q=W.relatedTarget;(!q||!W.currentTarget.contains(q))&&F(!1)},[]),ne=p.useCallback(async W=>{if(!f)return;const q=Array.from(W.dataTransfer.files);if(q.length!==0){W.preventDefault(),F(!1),b(!0);try{const Z=q.filter(re=>re.type.startsWith("image/")),te=q.filter(re=>!re.type.startsWith("image/")&&Fr(re)),ie=q.filter(re=>!re.type.startsWith("image/")&&!Fr(re)&&Gi(re));if(Z.length>0){const re=await wr(Z);h(fe=>[...fe,...re])}if(te.length>0){const re=await gs(te);v(fe=>[...fe,...re])}if(ie.length>0){const re=await hs(ie);v(fe=>[...fe,...re])}}finally{b(!1)}}},[f]),ae=p.useCallback(()=>{var W;y?(w(!1),R("")):(c.startsWith("/")||l("/"+c),w(!0),R(c.startsWith("/")&&c.slice(1).split(/\s/)[0]||""),(W=I.current)==null||W.focus())},[y,c]),le=u.length+g.length,me=(c.trim()||le>0)&&!o&&!x;return d.jsxs("div",{className:J("w-full max-w-3xl mx-auto px-4 sm:px-8 pb-4 pt-2",m),children:[d.jsxs("div",{className:"relative",children:[y&&i&&i.length>0&&d.jsx(cg,{commands:i,filter:_,onSelect:V,onClose:()=>{w(!1),R("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),S&&f&&d.jsxs("div",{ref:z,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=O.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Qc,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"图片"})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=M.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Yt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"文本文件"})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=$.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Kr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"表格文件"})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=P.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Vr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:"目录"})]})]}),d.jsxs("div",{onDragOver:Y,onDragLeave:K,onDrop:ne,className:J("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",A&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[u.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:u.map((W,q)=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${q+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),d.jsx("button",{type:"button",onClick:()=>L(q),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${q+1}`,children:"×"})]},q))}),g.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:g.map((W,q)=>d.jsx(hg,{attachment:W,onRemove:()=>G(q)},q))}),d.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[f&&d.jsxs("div",{className:"relative flex-shrink-0",children:[d.jsxs("button",{ref:E,type:"button",onClick:()=>j(W=>!W),disabled:o||x,className:J("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",S?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[d.jsx(du,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Attach"})]}),d.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:H}),d.jsx("input",{ref:M,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:T}),d.jsx("input",{ref:$,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:B}),d.jsx("input",{ref:P,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:U})]}),i&&i.length>0&&d.jsx("button",{type:"button",onClick:ae,className:J("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-colors",y?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),disabled:o,title:"命令列表",children:d.jsx(Su,{className:"h-4 w-4"})}),d.jsx("textarea",{ref:I,value:c,onChange:k,onKeyDown:D,onPaste:N,placeholder:x?"处理文件中…":r,disabled:o,rows:1,className:J("flex-1 resize-none border-none bg-transparent outline-none","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),d.jsx("button",{type:"button",onClick:t?n:()=>C(),disabled:!t&&!me,className:J("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":me?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?d.jsx(ku,{className:"h-3.5 w-3.5",fill:"currentColor"}):x?d.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):d.jsx(vu,{className:"h-4 w-4"})})]})]})]}),d.jsx("div",{className:"text-center mt-1.5",children:d.jsx("span",{className:"text-[11px] text-text-muted font-display",children:"Enter 发送,Shift+Enter 换行"})})]})}function hg({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return d.jsx(Yt,{className:"h-3.5 w-3.5"});case"table":return d.jsx(Kr,{className:"h-3.5 w-3.5"});case"directory":return d.jsx(Vr,{className:"h-3.5 w-3.5"});default:return d.jsx(Yt,{className:"h-3.5 w-3.5"})}})(),o=e.size!=null?Mt(e.size):null,r=e.kind==="directory"&&e.files?e.files.length:null;return d.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,d.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),o&&d.jsx("span",{className:"text-text-muted text-[10px]",children:o}),r!=null&&d.jsxs("span",{className:"text-text-muted text-[10px]",children:[r," 文件"]}),d.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:d.jsx($n,{className:"h-3 w-3"})})]})}function Mt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function wr(e){const t=[];for(const n of e)try{let o=n,r=n.type;n.size>2*1024*1024&&(o=await ve(n,ug),r="image/jpeg");const s=await xg(o);t.push({mimeType:r,data:s})}catch(o){console.error("Failed to process image:",o)}return t}async function hs(e){const t=[];for(const n of e)try{if(n.size>Wi){console.warn(`Skipping ${n.name}: too large (${Mt(n.size)})`);continue}n.size>dg&&console.warn(`File ${n.name} is large (${Mt(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 gs(e){const t=[];for(const n of e)try{const o=tn(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 Vi(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 Vi(e){const t=await Re(()=>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}
209
+
210
+ ${a}`):o.push(a)}return o.join(`
211
+
212
+ `)}async function gg(e){if(e.length===0)return null;const t=e.filter(u=>!(u.name.startsWith(".")||u.size>Wi));t.length>br&&console.warn(`Directory has ${t.length} files, truncating to ${br}`);const n=t.slice(0,br);let o=0;for(const u of n)o+=u.size;o>ps&&console.warn(`Directory total size ${Mt(o)} exceeds limit, some files may be truncated`);const r=n[0].webkitRelativePath,s=r&&r.split("/")[0]||"目录",a=[],i=[];let m=0;const f=[...n].sort((u,h)=>{const g=u.webkitRelativePath||u.name,v=h.webkitRelativePath||h.name;return g.localeCompare(v)});for(const u of f){const h=u.webkitRelativePath||u.name;if(a.push(h),Gi(u)||Fr(u))if(m+u.size<=ps)try{let g;if(tn(u.name)===".xlsx"||tn(u.name)===".xls"){const v=await u.arrayBuffer();g=await Vi(v)}else g=await u.text();i.push(`
213
+ ### ${h}
214
+ \`\`\`
215
+ ${g}
216
+ \`\`\``),m+=u.size}catch{i.push(`
217
+ ### ${h}
218
+ (读取失败)`)}else i.push(`
219
+ ### ${h}
220
+ (文件过大,已跳过)`);else u.type.startsWith("image/")?i.push(`
221
+ ### ${h}
222
+ (图片文件,${Mt(u.size)})`):i.push(`
223
+ ### ${h}
224
+ (二进制文件,${Mt(u.size)})`)}const c=a.join(`
225
+ `),l=[`# 目录: ${s}`,`共 ${a.length} 个文件`,"","## 文件结构","```",c,"```","","## 文件内容",...i].join(`
226
+ `);return{kind:"directory",name:s,size:o,textContent:l,files:a}}async function xg(e){return new Promise((t,n)=>{const o=new FileReader;o.onloadend=()=>{const r=o.result,s=r.indexOf(",");t(s>=0?r.slice(s+1):r)},o.onerror=()=>n(new Error("FileReader error")),o.readAsDataURL(e)})}function vg({requests:e,onRespond:t,className:n}){return e.length===0?null:d.jsx("div",{className:J("w-full max-w-3xl mx-auto px-4",n),children:d.jsx("div",{className:"space-y-2",children:e.map(o=>d.jsx(bg,{request:o,onRespond:t},o.requestId))})})}function bg({request:e,onRespond:t}){return d.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[d.jsx(qs,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&d.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-brand text-white text-xs font-medium hover:bg-brand-light transition-colors flex items-center gap-1.5",children:[d.jsx(nn,{className:"h-3.5 w-3.5"}),"允许"]}),d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-warning-border/30 text-warning-text text-xs font-medium hover:bg-warning-bg transition-colors flex items-center gap-1.5",children:[d.jsx($n,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}var er="Popover",[Ki]=Qe(er,[Ut]),fn=Ut(),[wg,ft]=Ki(er),qi=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!1}=e,i=fn(t),m=p.useRef(null),[f,c]=p.useState(!1),[l,u]=at({prop:o,defaultProp:r??!1,onChange:s,caller:er});return d.jsx(ro,{...i,children:d.jsx(wg,{scope:t,contentId:ye(),triggerRef:m,open:l,onOpenChange:u,onOpenToggle:p.useCallback(()=>u(h=>!h),[u]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>c(!0),[]),onCustomAnchorRemove:p.useCallback(()=>c(!1),[]),modal:a,children:n})})};qi.displayName=er;var Xi="PopoverAnchor",yg=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=ft(Xi,n),s=fn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=r;return p.useEffect(()=>(a(),()=>i()),[a,i]),d.jsx(Gn,{...s,...o,ref:t})});yg.displayName=Xi;var Yi="PopoverTrigger",Qi=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=ft(Yi,n),s=fn(n),a=pe(t,r.triggerRef),i=d.jsx(ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":nl(r.open),...o,ref:a,onClick:ee(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?i:d.jsx(Gn,{asChild:!0,...s,children:i})});Qi.displayName=Yi;var ko="PopoverPortal",[Cg,Sg]=Ki(ko,{forceMount:void 0}),Zi=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,s=ft(ko,t);return d.jsx(Cg,{scope:t,forceMount:n,children:d.jsx(je,{present:n||s.open,children:d.jsx(an,{asChild:!0,container:r,children:o})})})};Zi.displayName=ko;var Ft="PopoverContent",Ji=p.forwardRef((e,t)=>{const n=Sg(Ft,e.__scopePopover),{forceMount:o=n.forceMount,...r}=e,s=ft(Ft,e.__scopePopover);return d.jsx(je,{present:o||s.open,children:s.modal?d.jsx(kg,{...r,ref:t}):d.jsx(Ag,{...r,ref:t})})});Ji.displayName=Ft;var Eg=Ot("PopoverContent.RemoveScroll"),kg=p.forwardRef((e,t)=>{const n=ft(Ft,e.__scopePopover),o=p.useRef(null),r=pe(t,o),s=p.useRef(!1);return p.useEffect(()=>{const a=o.current;if(a)return ao(a)},[]),d.jsx(Hr,{as:Eg,allowPinchZoom:!0,children:d.jsx(el,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;s.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:ee(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ag=p.forwardRef((e,t)=>{const n=ft(Ft,e.__scopePopover),o=p.useRef(!1),r=p.useRef(!1);return d.jsx(el,{...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()}})}),el=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:c,...l}=e,u=ft(Ft,n),h=fn(n);return qr(),d.jsx(zn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:d.jsx(on,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>u.onOpenChange(!1),children:d.jsx(oo,{"data-state":nl(u.open),role:"dialog",id:u.contentId,...h,...l,ref:t,style:{...l.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),tl="PopoverClose",_g=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=ft(tl,n);return d.jsx(ue.button,{type:"button",...o,ref:t,onClick:ee(e.onClick,()=>r.onOpenChange(!1))})});_g.displayName=tl;var Rg="PopoverArrow",jg=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=fn(n);return d.jsx(so,{...r,...o,ref:t})});jg.displayName=Rg;function nl(e){return e?"open":"closed"}var Tg=qi,Ng=Qi,Ig=Zi,Pg=Ji;function rl({...e}){return d.jsx(Tg,{"data-slot":"popover",...e})}function ol({...e}){return d.jsx(Ng,{"data-slot":"popover-trigger",...e})}function sl({className:e,align:t="center",sideOffset:n=4,...o}){return d.jsx(Ig,{children:d.jsx(Pg,{"data-slot":"popover-content",align:t,sideOffset:n,className:J("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 xs=1,Mg=.9,Og=.8,Dg=.17,yr=.1,Cr=.999,Lg=.9999,Fg=.99,$g=/[\\\/_+.#"@\[\(\{&]/,zg=/[\\\/_+.#"@\[\(\{&]/g,Ug=/[\s-]/,al=/[\s-]/g;function $r(e,t,n,o,r,s,a){if(s===t.length)return r===e.length?xs:Fg;var i=`${r},${s}`;if(a[i]!==void 0)return a[i];for(var m=o.charAt(s),f=n.indexOf(m,r),c=0,l,u,h,g;f>=0;)l=$r(e,t,n,o,f+1,s+1,a),l>c&&(f===r?l*=xs:$g.test(e.charAt(f-1))?(l*=Og,h=e.slice(r,f-1).match(zg),h&&r>0&&(l*=Math.pow(Cr,h.length))):Ug.test(e.charAt(f-1))?(l*=Mg,g=e.slice(r,f-1).match(al),g&&r>0&&(l*=Math.pow(Cr,g.length))):(l*=Dg,r>0&&(l*=Math.pow(Cr,f-r))),e.charAt(f)!==t.charAt(s)&&(l*=Lg)),(l<yr&&n.charAt(f-1)===o.charAt(s+1)||o.charAt(s+1)===o.charAt(s)&&n.charAt(f-1)!==o.charAt(s))&&(u=$r(e,t,n,o,f+1,s+2,a),u*yr>l&&(l=u*yr)),l>c&&(c=l),f=n.indexOf(m,f+1);return a[i]=c,c}function vs(e){return e.toLowerCase().replace(al," ")}function Bg(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,$r(e,t,vs(e),vs(t),0,0,{})}var tr="Dialog",[il]=Qe(tr),[Hg,Le]=il(tr),ll=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,c]=at({prop:o,defaultProp:r??!1,onChange:s,caller:tr});return d.jsx(Hg,{scope:t,triggerRef:i,contentRef:m,contentId:ye(),titleId:ye(),descriptionId:ye(),open:f,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(l=>!l),[c]),modal:a,children:n})};ll.displayName=tr;var cl="DialogTrigger",Wg=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(cl,n),s=pe(t,r.triggerRef);return d.jsx(ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Ro(r.open),...o,ref:s,onClick:ee(e.onClick,r.onOpenToggle)})});Wg.displayName=cl;var Ao="DialogPortal",[Gg,ul]=il(Ao,{forceMount:void 0}),dl=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,s=Le(Ao,t);return d.jsx(Gg,{scope:t,forceMount:n,children:p.Children.map(o,a=>d.jsx(je,{present:n||s.open,children:d.jsx(an,{asChild:!0,container:r,children:a})}))})};dl.displayName=Ao;var Fn="DialogOverlay",fl=p.forwardRef((e,t)=>{const n=ul(Fn,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=Le(Fn,e.__scopeDialog);return s.modal?d.jsx(je,{present:o||s.open,children:d.jsx(Kg,{...r,ref:t})}):null});fl.displayName=Fn;var Vg=Ot("DialogOverlay.RemoveScroll"),Kg=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(Fn,n);return d.jsx(Hr,{as:Vg,allowPinchZoom:!0,shards:[r.contentRef],children:d.jsx(ue.div,{"data-state":Ro(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),Ct="DialogContent",ml=p.forwardRef((e,t)=>{const n=ul(Ct,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=Le(Ct,e.__scopeDialog);return d.jsx(je,{present:o||s.open,children:s.modal?d.jsx(qg,{...r,ref:t}):d.jsx(Xg,{...r,ref:t})})});ml.displayName=Ct;var qg=p.forwardRef((e,t)=>{const n=Le(Ct,e.__scopeDialog),o=p.useRef(null),r=pe(t,n.contentRef,o);return p.useEffect(()=>{const s=o.current;if(s)return ao(s)},[]),d.jsx(pl,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault())})}),Xg=p.forwardRef((e,t)=>{const n=Le(Ct,e.__scopeDialog),o=p.useRef(!1),r=p.useRef(!1);return d.jsx(pl,{...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()}})}),pl=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,i=Le(Ct,n),m=p.useRef(null),f=pe(t,m);return qr(),d.jsxs(d.Fragment,{children:[d.jsx(zn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:d.jsx(on,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Ro(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(Qg,{titleId:i.titleId}),d.jsx(Jg,{contentRef:m,descriptionId:i.descriptionId})]})]})}),_o="DialogTitle",hl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(_o,n);return d.jsx(ue.h2,{id:r.titleId,...o,ref:t})});hl.displayName=_o;var gl="DialogDescription",Yg=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(gl,n);return d.jsx(ue.p,{id:r.descriptionId,...o,ref:t})});Yg.displayName=gl;var xl="DialogClose",vl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(xl,n);return d.jsx(ue.button,{type:"button",...o,ref:t,onClick:ee(e.onClick,()=>r.onOpenChange(!1))})});vl.displayName=xl;function Ro(e){return e?"open":"closed"}var bl="DialogTitleWarning",[Iv,wl]=Gu(bl,{contentName:Ct,titleName:_o,docsSlug:"dialog"}),Qg=({titleId:e})=>{const t=wl(bl),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
227
+
228
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
229
+
230
+ 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},Zg="DialogDescriptionWarning",Jg=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wl(Zg).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},ex=ll,tx=dl,nx=fl,rx=ml,Pv=hl,Mv=vl,Kt='[cmdk-group=""]',Sr='[cmdk-group-items=""]',ox='[cmdk-group-heading=""]',yl='[cmdk-item=""]',bs=`${yl}:not([aria-disabled="true"])`,zr="cmdk-item-select",Tt="data-value",sx=(e,t,n)=>Bg(e,t,n),Cl=p.createContext(void 0),mn=()=>p.useContext(Cl),Sl=p.createContext(void 0),jo=()=>p.useContext(Sl),El=p.createContext(void 0),kl=p.forwardRef((e,t)=>{let n=Nt(()=>{var T,B;return{search:"",value:(B=(T=e.value)!=null?T:e.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=Nt(()=>new Set),r=Nt(()=>new Map),s=Nt(()=>new Map),a=Nt(()=>new Set),i=Al(e),{label:m,children:f,value:c,onValueChange:l,filter:u,shouldFilter:h,loop:g,disablePointerSelection:v=!1,vimBindings:y=!0,...w}=e,_=ye(),R=ye(),A=ye(),F=p.useRef(null),S=gx();St(()=>{if(c!==void 0){let T=c.trim();n.current.value=T,j.emit()}},[c]),St(()=>{S(6,$)},[]);let j=p.useMemo(()=>({subscribe:T=>(a.current.add(T),()=>a.current.delete(T)),snapshot:()=>n.current,setState:(T,B,U)=>{var L,G,V,Y;if(!Object.is(n.current[T],B)){if(n.current[T]=B,T==="search")M(),I(),S(1,O);else if(T==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(A);K?K.focus():(L=document.getElementById(_))==null||L.focus()}if(S(7,()=>{var K;n.current.selectedItemId=(K=P())==null?void 0:K.id,j.emit()}),U||S(5,$),((G=i.current)==null?void 0:G.value)!==void 0){let K=B??"";(Y=(V=i.current).onValueChange)==null||Y.call(V,K);return}}j.emit()}},emit:()=>{a.current.forEach(T=>T())}}),[]),x=p.useMemo(()=>({value:(T,B,U)=>{var L;B!==((L=s.current.get(T))==null?void 0:L.value)&&(s.current.set(T,{value:B,keywords:U}),n.current.filtered.items.set(T,b(B,U)),S(2,()=>{I(),j.emit()}))},item:(T,B)=>(o.current.add(T),B&&(r.current.has(B)?r.current.get(B).add(T):r.current.set(B,new Set([T]))),S(3,()=>{M(),I(),n.current.value||O(),j.emit()}),()=>{s.current.delete(T),o.current.delete(T),n.current.filtered.items.delete(T);let U=P();S(4,()=>{M(),(U==null?void 0:U.getAttribute("id"))===T&&O(),j.emit()})}),group:T=>(r.current.has(T)||r.current.set(T,new Set),()=>{s.current.delete(T),r.current.delete(T)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:_,inputId:A,labelId:R,listInnerRef:F}),[]);function b(T,B){var U,L;let G=(L=(U=i.current)==null?void 0:U.filter)!=null?L:sx;return T?G(T,n.current.search,B):0}function I(){if(!n.current.search||i.current.shouldFilter===!1)return;let T=n.current.filtered.items,B=[];n.current.filtered.groups.forEach(L=>{let G=r.current.get(L),V=0;G.forEach(Y=>{let K=T.get(Y);V=Math.max(K,V)}),B.push([L,V])});let U=F.current;z().sort((L,G)=>{var V,Y;let K=L.getAttribute("id"),ne=G.getAttribute("id");return((V=T.get(ne))!=null?V:0)-((Y=T.get(K))!=null?Y:0)}).forEach(L=>{let G=L.closest(Sr);G?G.appendChild(L.parentElement===G?L:L.closest(`${Sr} > *`)):U.appendChild(L.parentElement===U?L:L.closest(`${Sr} > *`))}),B.sort((L,G)=>G[1]-L[1]).forEach(L=>{var G;let V=(G=F.current)==null?void 0:G.querySelector(`${Kt}[${Tt}="${encodeURIComponent(L[0])}"]`);V==null||V.parentElement.appendChild(V)})}function O(){let T=z().find(U=>U.getAttribute("aria-disabled")!=="true"),B=T==null?void 0:T.getAttribute(Tt);j.setState("value",B||void 0)}function M(){var T,B,U,L;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let G=0;for(let V of o.current){let Y=(B=(T=s.current.get(V))==null?void 0:T.value)!=null?B:"",K=(L=(U=s.current.get(V))==null?void 0:U.keywords)!=null?L:[],ne=b(Y,K);n.current.filtered.items.set(V,ne),ne>0&&G++}for(let[V,Y]of r.current)for(let K of Y)if(n.current.filtered.items.get(K)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=G}function $(){var T,B,U;let L=P();L&&(((T=L.parentElement)==null?void 0:T.firstChild)===L&&((U=(B=L.closest(Kt))==null?void 0:B.querySelector(ox))==null||U.scrollIntoView({block:"nearest"})),L.scrollIntoView({block:"nearest"}))}function P(){var T;return(T=F.current)==null?void 0:T.querySelector(`${yl}[aria-selected="true"]`)}function z(){var T;return Array.from(((T=F.current)==null?void 0:T.querySelectorAll(bs))||[])}function E(T){let B=z()[T];B&&j.setState("value",B.getAttribute(Tt))}function C(T){var B;let U=P(),L=z(),G=L.findIndex(Y=>Y===U),V=L[G+T];(B=i.current)!=null&&B.loop&&(V=G+T<0?L[L.length-1]:G+T===L.length?L[0]:L[G+T]),V&&j.setState("value",V.getAttribute(Tt))}function D(T){let B=P(),U=B==null?void 0:B.closest(Kt),L;for(;U&&!L;)U=T>0?px(U,Kt):hx(U,Kt),L=U==null?void 0:U.querySelector(bs);L?j.setState("value",L.getAttribute(Tt)):C(T)}let k=()=>E(z().length-1),N=T=>{T.preventDefault(),T.metaKey?k():T.altKey?D(1):C(1)},H=T=>{T.preventDefault(),T.metaKey?E(0):T.altKey?D(-1):C(-1)};return p.createElement(dt.div,{ref:t,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:T=>{var B;(B=w.onKeyDown)==null||B.call(w,T);let U=T.nativeEvent.isComposing||T.keyCode===229;if(!(T.defaultPrevented||U))switch(T.key){case"n":case"j":{y&&T.ctrlKey&&N(T);break}case"ArrowDown":{N(T);break}case"p":case"k":{y&&T.ctrlKey&&H(T);break}case"ArrowUp":{H(T);break}case"Home":{T.preventDefault(),E(0);break}case"End":{T.preventDefault(),k();break}case"Enter":{T.preventDefault();let L=P();if(L){let G=new Event(zr);L.dispatchEvent(G)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:vx},m),nr(e,T=>p.createElement(Sl.Provider,{value:j},p.createElement(Cl.Provider,{value:x},T))))}),ax=p.forwardRef((e,t)=>{var n,o;let r=ye(),s=p.useRef(null),a=p.useContext(El),i=mn(),m=Al(e),f=(o=(n=m.current)==null?void 0:n.forceMount)!=null?o:a==null?void 0:a.forceMount;St(()=>{if(!f)return i.item(r,a==null?void 0:a.id)},[f]);let c=_l(r,s,[e.value,e.children,s],e.keywords),l=jo(),u=ct(S=>S.value&&S.value===c.current),h=ct(S=>f||i.filter()===!1?!0:S.search?S.filtered.items.get(r)>0:!0);p.useEffect(()=>{let S=s.current;if(!(!S||e.disabled))return S.addEventListener(zr,g),()=>S.removeEventListener(zr,g)},[h,e.onSelect,e.disabled]);function g(){var S,j;v(),(j=(S=m.current).onSelect)==null||j.call(S,c.current)}function v(){l.setState("value",c.current,!0)}if(!h)return null;let{disabled:y,value:w,onSelect:_,forceMount:R,keywords:A,...F}=e;return p.createElement(dt.div,{ref:He(s,t),...F,id:r,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!u,"data-disabled":!!y,"data-selected":!!u,onPointerMove:y||i.getDisablePointerSelection()?void 0:v,onClick:y?void 0:g},e.children)}),ix=p.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:r,...s}=e,a=ye(),i=p.useRef(null),m=p.useRef(null),f=ye(),c=mn(),l=ct(h=>r||c.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);St(()=>c.group(a),[]),_l(a,i,[e.value,e.heading,m]);let u=p.useMemo(()=>({id:a,forceMount:r}),[r]);return p.createElement(dt.div,{ref:He(i,t),...s,"cmdk-group":"",role:"presentation",hidden:l?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),nr(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(El.Provider,{value:u},h))))}),lx=p.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,r=p.useRef(null),s=ct(a=>!a.search);return!n&&!s?null:p.createElement(dt.div,{ref:He(r,t),...o,"cmdk-separator":"",role:"separator"})}),cx=p.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,r=e.value!=null,s=jo(),a=ct(f=>f.search),i=ct(f=>f.selectedItemId),m=mn();return p.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),p.createElement(dt.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)}})}),ux=p.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...r}=e,s=p.useRef(null),a=p.useRef(null),i=ct(f=>f.selectedItemId),m=mn();return p.useEffect(()=>{if(a.current&&s.current){let f=a.current,c=s.current,l,u=new ResizeObserver(()=>{l=requestAnimationFrame(()=>{let h=f.offsetHeight;c.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return u.observe(f),()=>{cancelAnimationFrame(l),u.unobserve(f)}}},[]),p.createElement(dt.div,{ref:He(s,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":o,id:m.listId},nr(e,f=>p.createElement("div",{ref:He(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),dx=p.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:r,contentClassName:s,container:a,...i}=e;return p.createElement(ex,{open:n,onOpenChange:o},p.createElement(tx,{container:a},p.createElement(nx,{"cmdk-overlay":"",className:r}),p.createElement(rx,{"aria-label":e.label,"cmdk-dialog":"",className:s},p.createElement(kl,{ref:t,...i}))))}),fx=p.forwardRef((e,t)=>ct(n=>n.filtered.count===0)?p.createElement(dt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),mx=p.forwardRef((e,t)=>{let{progress:n,children:o,label:r="Loading...",...s}=e;return p.createElement(dt.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},nr(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),Bt=Object.assign(kl,{List:ux,Item:ax,Input:cx,Group:ix,Separator:lx,Dialog:dx,Empty:fx,Loading:mx});function px(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function hx(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Al(e){let t=p.useRef(e);return St(()=>{t.current=e}),t}var St=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Nt(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function ct(e){let t=jo(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function _l(e,t,n,o=[]){let r=p.useRef(),s=mn();return St(()=>{var a;let i=(()=>{var f;for(let c of n){if(typeof c=="string")return c.trim();if(typeof c=="object"&&"current"in c)return c.current?(f=c.current.textContent)==null?void 0:f.trim():r.current}})(),m=o.map(f=>f.trim());s.value(e,i,m),(a=t.current)==null||a.setAttribute(Tt,i),r.current=i}),r}var gx=()=>{let[e,t]=p.useState(),n=Nt(()=>new Map);return St(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,r)=>{n.current.set(o,r),t({})}};function xx(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function nr({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(xx(t),{ref:t.ref},n(t.props.children)):n(t)}var vx={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function bx({className:e,...t}){return d.jsx(Bt,{"data-slot":"command",className:J("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function wx({className:e,...t}){return d.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[d.jsx(gu,{className:"size-4 shrink-0 opacity-50"}),d.jsx(Bt.Input,{"data-slot":"command-input",className:J("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function yx({className:e,...t}){return d.jsx(Bt.List,{"data-slot":"command-list",className:J("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Cx({...e}){return d.jsx(Bt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Sx({className:e,...t}){return d.jsx(Bt.Group,{"data-slot":"command-group",className:J("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 Ex({className:e,...t}){return d.jsx(Bt.Item,{"data-slot":"command-item",className:J("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 ws(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 kx({models:e,currentModelId:t,onSelect:n,showSearch:o=!0,isMobile:r=!1}){const[s,a]=p.useState(""),[i,m]=p.useState(r?"__none__":void 0),f=p.useMemo(()=>s?e.filter(c=>ws(s,c.name)||ws(s,c.modelId)):e,[e,s]);return d.jsxs(bx,{shouldFilter:!1,value:i,onValueChange:m,children:[o&&d.jsx(wx,{placeholder:"Select a model…",value:s,onValueChange:a}),d.jsxs(yx,{children:[d.jsx(Cx,{children:"No models found."}),d.jsx(Sx,{children:f.map(c=>d.jsxs(Ex,{value:c.modelId,onSelect:()=>n(c),className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[d.jsx("span",{className:"truncate font-medium",children:c.name}),c.description&&d.jsx("span",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),d.jsx(nn,{className:J("h-4 w-4 shrink-0",t===c.modelId?"opacity-100":"opacity-0")})]},c.modelId))})]})]})}function Rl(e){const[t,n]=p.useState(e.modelState),[o,r]=p.useState(!1);p.useEffect(()=>{const f=l=>{if(n(l),l&&l.availableModels.length>0){const u=localStorage.getItem("acp_model_id");u&&u!==l.currentModelId&&l.availableModels.some(h=>h.modelId===u)&&e.setSessionModel(u).catch(()=>{})}},c=l=>{n(u=>u?{...u,currentModelId:l}:null),r(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(c),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(c)}},[e]);const s=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>s.find(f=>f.modelId===a)??null,[s,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");r(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(c){throw r(!1),c}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:m,isLoading:o}}function Ax({client:e,onModelSelect:t}){const[n,o]=p.useState(!1),{supportsModelSelection:r,availableModels:s,currentModel:a,setModel:i,isLoading:m}=Rl(e),f=r&&s.length>0,c=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,l=async u=>{try{await i(u.modelId),t==null||t(u.modelId),o(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return d.jsxs(rl,{open:n,onOpenChange:f?o:void 0,children:[d.jsx(ol,{asChild:!0,children:d.jsxs(kt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?d.jsx(Gs,{className:"h-3 w-3 animate-spin"}):null,d.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?d.jsx(Ws,{className:"h-3 w-3"}):d.jsx(rn,{className:"h-3 w-3"})]})}),d.jsx(sl,{className:"w-72 p-0",align:"end",children:d.jsx(kx,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:l,showSearch:!c,isMobile:c})})]})}function _x(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const r=s=>{n(s)};return e.setAvailableCommandsChangedHandler(r),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const o=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:o}}const Rx=new Set(["clear","new","help","status","model","copy"]),jx=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"},{name:"files",desc:"列出上下文中的文件"}];function Tx(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 Nx(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function Ix(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 jx)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(`
231
+ `)}function Px(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(`
232
+ `)}function Mx(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(`
233
+ `)}async function Ox(e,t){var l;if(!e.startsWith("/"))return{handled:!1};const[n,...o]=e.slice(1).split(/\s+/),r=o.join(" ").trim(),s=n==null?void 0:n.toLowerCase();if(!s||!Rx.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=Ix(t.availableCommands);else if(s==="status")a=Px({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(s==="model")if(r)try{await t.setModel(r),a=`已请求切换到模型: \`${r}\``}catch(u){a=`切换模型失败: ${u instanceof Error?u.message:String(u)}`,i=!0}else a=Mx(t.availableModels,t.currentModel);else if(s==="copy"){const u=[...t.entries].reverse().find(g=>g.type==="assistant_message"),h=((l=u==null?void 0:u.chunks)==null?void 0:l.map(g=>g.text).join(`
234
+ `))??"";try{await navigator.clipboard.writeText(h),a=h?`已复制 ${h.length} 字符到剪贴板`:"没有可复制的助手消息"}catch{a="复制失败:剪贴板不可用",i=!0}}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},c={type:"command_output",id:`cmd-${m}`,commandName:s,inputText:e,title:Tx(s),subtitle:Nx(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:c}}const Dx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function Lx(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 Er=[{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 Fx({mode:e,onModeChange:t}){const[n,o]=p.useState(!1),r=Er.find(s=>s.value===e)??Er[0];return d.jsxs(rl,{open:n,onOpenChange:o,children:[d.jsx(ol,{asChild:!0,children:d.jsxs(kt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[d.jsx(yu,{className:"h-3 w-3"}),d.jsx("span",{className:"max-w-24 truncate",children:r.label}),n?d.jsx(Ws,{className:"h-3 w-3"}):d.jsx(rn,{className:"h-3 w-3"})]})}),d.jsx(sl,{className:"w-64 p-1",align:"start",children:Er.map(s=>d.jsxs("button",{type:"button",onClick:()=>{t(s.value),o(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[d.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===s.value&&d.jsx(nn,{className:"h-3.5 w-3.5 text-brand"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.label}),d.jsx("div",{className:"text-xs text-text-muted",children:s.description})]})]},s.value))})]})}function ys(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function kr(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 $x({client:e,agentId:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),c=p.useRef(null),l=p.useRef(n);l.current=n;const[u,h]=p.useState(null),g=p.useRef(null),[v,y]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[w,_]=p.useState(!1),{commands:R}=_x(e),{availableModels:A,currentModel:F,setModel:S}=Rl(e);p.useEffect(()=>{c.current=m},[m]);const j=p.useCallback(()=>{o([]),s(!1),i(!1)},[]),x=t?`acp_last_session_${t}`:null,b=p.useCallback((D,k)=>{if(((k==null?void 0:k.resetEntries)??!0)&&(o([]),s(!1)),f(D),i(!0),_(e.supportsImages),x)try{localStorage.setItem(x,D)}catch{}console.log("[ChatInterface] Active session:",D,"supportsImages:",e.supportsImages)},[e,x]),I=p.useCallback(D=>{c.current&&D.sessionId!==c.current||(console.log("[ChatInterface] Permission request:",D),o(k=>{const N=kr(k,D.toolCall.toolCallId);if(N>=0)return k.map((H,T)=>T!==N||H.type!=="tool_call"||H.toolCall.status!=="running"?H:{type:"tool_call",toolCall:{...H.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:D.requestId,options:D.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const H={type:"tool_call",toolCall:{id:D.toolCall.toolCallId,title:D.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:D.requestId,options:D.options},isStandalonePermission:!0}};return[...k,H]}}))},[]),O=p.useCallback((D,k)=>{if(!(c.current&&D!==c.current))if(k.sessionUpdate==="agent_message_chunk"){const N=k.content.type==="text"&&k.content.text?k.content.text:"";if(!N)return;o(H=>{const T=H[H.length-1];if((T==null?void 0:T.type)==="assistant_message"){const U=T.chunks[T.chunks.length-1];return(U==null?void 0:U.type)==="message"?[...H.slice(0,-1),{...T,chunks:[...T.chunks.slice(0,-1),{type:"message",text:U.text+N}]}]:[...H.slice(0,-1),{...T,chunks:[...T.chunks,{type:"message",text:N}]}]}const B={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:N}]};return[...H,B]})}else if(k.sessionUpdate==="agent_thought_chunk"){const N=k.content.type==="text"&&k.content.text?k.content.text:"";if(!N)return;o(H=>{const T=H[H.length-1];if((T==null?void 0:T.type)==="assistant_message"){const U=T.chunks[T.chunks.length-1];return(U==null?void 0:U.type)==="thought"?[...H.slice(0,-1),{...T,chunks:[...T.chunks.slice(0,-1),{type:"thought",text:U.text+N}]}]:[...H.slice(0,-1),{...T,chunks:[...T.chunks,{type:"thought",text:N}]}]}const B={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:N}]};return[...H,B]})}else if(k.sessionUpdate==="user_message_chunk"){const N=k.content.type==="text"&&k.content.text?k.content.text:"";if(!N)return;o(H=>{const T=H[H.length-1];if((T==null?void 0:T.type)==="user_message")return[...H.slice(0,-1),{...T,content:T.content+N}];const B={type:"user_message",id:`user-${Date.now()}`,content:N};return[...H,B]})}else if(k.sessionUpdate==="tool_call"){const N={id:k.toolCallId,title:k.title,status:ys(k.status),content:k.content,rawInput:k.rawInput,rawOutput:k.rawOutput};o(H=>{const T=kr(H,k.toolCallId);if(T>=0)return H.map((U,L)=>L!==T||U.type!=="tool_call"?U:{type:"tool_call",toolCall:{...U.toolCall,...N}});const B={type:"tool_call",toolCall:N};return[...H,B]})}else k.sessionUpdate==="tool_call_update"?o(N=>{const H=kr(N,k.toolCallId);if(H<0){console.warn(`[ChatInterface] Tool call not found for update: ${k.toolCallId}`);const T={type:"tool_call",toolCall:{id:k.toolCallId,title:k.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...N,T]}return N.map((T,B)=>{if(B!==H||T.type!=="tool_call")return T;const U=k.status?ys(k.status):T.toolCall.status,L=k.content?[...T.toolCall.content||[],...k.content]:T.toolCall.content;return{type:"tool_call",toolCall:{...T.toolCall,status:U,...k.title&&{title:k.title},content:L,...k.rawInput&&{rawInput:k.rawInput},...k.rawOutput&&{rawOutput:k.rawOutput}}}})}):k.sessionUpdate==="plan"&&o(N=>{if(k.entries.length===0)return N.filter(B=>B.type!=="plan");const H=N.reduce((B,U,L)=>U.type==="plan"?L:B,-1);if(H>=0)return N.map((B,U)=>U===H?{...B,entries:k.entries}:B);const T={type:"plan",id:`plan-${Date.now()}`,entries:k.entries};return[...N,T]})},[]);p.useEffect(()=>{e.setSessionCreatedHandler(k=>{console.log("[ChatInterface] Session created:",k),b(k)}),e.setSessionLoadedHandler(k=>{console.log("[ChatInterface] Session loaded/resumed:",k),b(k,{resetEntries:!1})}),e.setSessionSwitchingHandler(k=>{console.log("[ChatInterface] Switching to session:",k),f(k),j()}),e.setSessionUpdateHandler((k,N)=>{O(k,N)}),e.setPromptCompleteHandler(k=>{console.log("[ChatInterface] Prompt complete:",k),s(!1)}),e.setPermissionRequestHandler(I),e.setErrorMessageHandler(k=>{console.error("[ChatInterface] Agent error:",k),h(k),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const D=x?localStorage.getItem(x):null;return D&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",D),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:D}):await e.resumeSession({sessionId:D})}catch(N){console.warn("[ChatInterface] Failed to restore session, creating new one:",N),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[b,e,I,O,j]);const M=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),r&&e.cancel(),j(),f(null),e.createSession(void 0,v)},[e,r,j,v]),$=()=>{console.log("[ChatInterface] Cancel requested"),o(D=>D.map(k=>k.type!=="tool_call"||!(k.toolCall.status==="running"||k.toolCall.status==="waiting_for_confirmation")?k:(console.log("[ChatInterface] Marking tool call as canceled:",k.toolCall.id),{type:"tool_call",toolCall:{...k.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},P=p.useCallback((D,k,N)=>{console.log("[ChatInterface] Permission response:",{requestId:D,optionId:k,optionKind:N}),e.respondToPermission(D,k);const H=N==="reject_once"||N==="reject_always"||k===null;o(T=>T.map(B=>{var L;if(B.type!=="tool_call"||((L=B.toolCall.permissionRequest)==null?void 0:L.requestId)!==D)return B;let U;return H?U="rejected":B.toolCall.isStandalonePermission?U="complete":U="running",{type:"tool_call",toolCall:{...B.toolCall,status:U,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),z=n.filter(D=>D.type==="tool_call"&&D.toolCall.status==="waiting_for_confirmation"&&!!D.toolCall.permissionRequest).map(D=>({requestId:D.toolCall.permissionRequest.requestId,toolName:D.toolCall.title,toolInput:D.toolCall.rawInput||{},description:D.toolCall.title,options:D.toolCall.permissionRequest.options})),E=p.useCallback((D,k)=>{const N=z.find(B=>B.requestId===D);let H=null,T=null;if(N!=null&&N.options&&N.options.length>0)if(k){const B=N.options.find(U=>U.kind==="allow_once")??N.options.find(U=>U.kind==="allow_always");B&&(H=B.optionId,T=B.kind)}else{const B=N.options.find(U=>U.kind==="reject_once")??N.options.find(U=>U.kind==="reject_always");B&&(H=B.optionId,T=B.kind)}H||(T=k?"allow_once":"reject_once"),P(D,H,T)},[P,z]),C=p.useCallback(async D=>{var G;const k=D.text.trim(),N=D.images||[],H=D.attachments||[];if(!k&&N.length===0&&H.length===0||r||!a)return;if(k.startsWith("/")&&N.length===0){wt("[ChatInterface] slash command input",{text:k});const V=await Ox(k,{sessionId:m,availableCommands:R,availableModels:A,currentModel:F,supportsImages:w,entries:l.current,setModel:S,onNewSession:M}).catch(()=>null);if(V){if(wt("[ChatInterface] local command handled",V),"clearEntries"in V&&V.clearEntries){o([]);return}if("newSession"in V&&V.newSession){M();return}if("userEntry"in V){o(Y=>[...Y,V.userEntry,V.cmdEntry]);return}}wt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:k})}wt("[ChatInterface] forwarding to agent",{text:k,hasImages:N.length>0,sessionReady:a,isLoading:r});const T=[];k&&T.push({type:"text",text:k});const B=[];for(const V of N)try{const Y=`data:${V.mimeType};base64,${V.data}`;let K;Y.startsWith("data:")?K=Lx(Y):K=await(await fetch(Y)).blob();let ne=K,ae=V.mimeType;if(K.size>2*1024*1024){const W=new File([K],"image.jpg",{type:K.type});ne=await ve(W,Dx),ae="image/jpeg"}const le=await new Promise((W,q)=>{const Z=new FileReader;Z.onloadend=()=>{const te=Z.result,ie=te.indexOf(",");W(ie>=0?te.slice(ie+1):te)},Z.onerror=()=>{var te;return q(new Error("FileReader error: "+((te=Z.error)==null?void 0:te.message)))},Z.readAsDataURL(ne)}),me={type:"image",mimeType:ae,data:le};T.push(me),B.push({mimeType:ae,data:le})}catch(Y){console.error("[ChatInterface] Failed to process image:",Y)}const U=[];for(const V of H)try{if(V.textContent){let Y;if(V.kind==="directory"){const K=((G=V.files)==null?void 0:G.length)??0;Y=`📁 目录: ${V.name} (${K} 个文件)
235
+ ${V.textContent}`}else{const K=V.size!=null?` (${zx(V.size)})`:"";Y=`📎 ${V.name}${K}
236
+ \`\`\`
237
+ ${V.textContent}
238
+ \`\`\``}T.push({type:"text",text:Y}),U.push(V)}}catch(Y){console.error("[ChatInterface] Failed to process attachment:",Y)}if(T.length===0)return;const L={type:"user_message",id:`user-${Date.now()}`,content:k,images:B.length>0?B:void 0,attachments:U.length>0?U:void 0};o(V=>[...V,L]),s(!0);try{await e.sendPrompt(T)}catch(V){console.error("[ChatInterface] Failed to send prompt:",V),s(!1)}},[r,a,e,R,A,F,w,m,S,M]);return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx(og,{entries:n,isLoading:r&&!a?!1:r,onPermissionRespond:(D,k,N)=>{P(D,k,N)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),d.jsx(vg,{requests:z,onRespond:E}),u&&d.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:d.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[d.jsx("span",{children:u}),d.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),d.jsxs("div",{className:"flex-shrink-0",children:[d.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(Fx,{mode:v,onModeChange:D=>{y(D),localStorage.setItem("acp_permission_mode",D)}}),d.jsx(Ax,{client:e})]}),n.length>0&&d.jsxs(fh,{children:[d.jsx(mh,{asChild:!0,children:d.jsxs(kt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:M,children:[d.jsx(Ks,{className:"h-3 w-3"}),"新会话"]})}),d.jsx(ph,{children:"New Thread"})]})]}),d.jsx(pg,{onSubmit:C,isLoading:r,onInterrupt:$,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:w,commands:R.length>0?R:void 0})]})]})}function zx(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ux({client:e,agentId:t}){const[n,o]=p.useState(!1),r=p.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return d.jsxs("div",{className:"flex h-full w-full",children:[d.jsxs("div",{className:J("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&d.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),d.jsxs("div",{className:J("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&d.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:d.jsx(Ks,{className:"h-4 w-4"})}),d.jsx("button",{type:"button",onClick:()=>o(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?d.jsx(cu,{className:"h-4 w-4"}):d.jsx(iu,{className:"h-4 w-4"})})]})]}),!n&&d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Bx,{client:e,onSelectSession:r})})]}),d.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:d.jsx($x,{client:e,agentId:t})})]})}function Bx({client:e,onSelectSession:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[c,l]=p.useState(""),[u,h]=p.useState(!0),g=p.useRef(null),v=p.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const j=await e.listSessions();o(j.sessions)}catch(j){console.warn("[SidebarSessionList] Failed to load:",j)}finally{s(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const j=x=>{x==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(j),()=>e.removeConnectionStateHandler(j)},[e,v]),p.useEffect(()=>{const j=setInterval(v,1e4);return()=>clearInterval(j)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(j=>{v()}),e.setSessionRenamedHandler((j,x)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(j=>{/Method not found/i.test(j)&&/session\/(rename|delete)/i.test(j)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const y=p.useCallback(j=>{const x=j.title&&j.title.trim()?j.title:j.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(j.sessionId),o(b=>b.filter(I=>I.sessionId!==j.sessionId)),a===j.sessionId&&i(null)}catch(b){console.error("[SidebarSessionList] delete failed:",b)}},[e,a]),w=p.useCallback(j=>{f(j.sessionId),l(j.title&&j.title.trim()?j.title:"")},[]),_=p.useCallback(()=>{if(!m)return;const j=c.trim();if(!j){f(null);return}try{e.renameSession(m,j),o(x=>x.map(b=>b.sessionId===m?{...b,title:j}:b))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,c]),R=p.useCallback(()=>{f(null)},[]),A=p.useCallback(j=>{j.key==="Enter"?(j.preventDefault(),_()):j.key==="Escape"&&(j.preventDefault(),R())},[_,R]),F=p.useMemo(()=>[...n].sort((j,x)=>{const b=j.updatedAt?new Date(j.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-b}),[n]);if(r&&n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const S=Hx(F);return d.jsx("nav",{className:"py-1","aria-label":"历史会话",children:S.map((j,x)=>d.jsxs("div",{children:[x>0&&d.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),d.jsx("div",{className:"px-4 py-2",children:d.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:j.label})}),j.sessions.map(b=>{const I=m===b.sessionId;return d.jsxs("div",{className:J("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",b.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[d.jsx(nu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),I?d.jsx("input",{ref:g,type:"text",value:c,onChange:O=>l(O.target.value),onKeyDown:A,onBlur:_,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick:O=>O.stopPropagation()}):d.jsx("button",{type:"button",onClick:()=>{i(b.sessionId),t(b)},className:"flex-1 min-w-0 text-left",title:b.title||b.sessionId,children:d.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:b.title&&b.title.trim()?b.title:"新会话"})}),I?d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[d.jsx("button",{type:"button",onClick:_,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"确认",children:d.jsx(nn,{className:"h-3.5 w-3.5"})}),d.jsx("button",{type:"button",onClick:R,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:"取消",children:d.jsx($n,{className:"h-3.5 w-3.5"})})]}):d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:u?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[d.jsx("button",{type:"button",disabled:!u,onClick:O=>{O.stopPropagation(),u&&w(b)},className:J("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-brand hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:u?"重命名":"该 agent 不支持会话重命名",children:d.jsx(mu,{className:"h-3 w-3"})}),d.jsx("button",{type:"button",disabled:!u,onClick:O=>{O.stopPropagation(),u&&y(b)},className:J("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:u?"删除":"该 agent 不支持会话删除",children:d.jsx(ju,{className:"h-3 w-3"})})]})]},b.sessionId)})]},j.label))})}function Hx(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 Wx({url:e,token:t,onBack:n}){const[o,r]=p.useState(null),[s,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const c=new Mr({proxyUrl:e,token:t});return c.setConnectionStateHandler((l,u)=>{a(l),m(u||null)}),f.current=c,r(c),c.connect().catch(l=>{l instanceof fi||(m(l.message),a("error"))}),()=>{c.disconnect(),f.current=null,r(null),a("disconnected")}},[e,t]),d.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&d.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,d.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),d.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!o&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),d.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),d.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),o&&s==="connected"&&d.jsx(Ux,{client:o})]})}const Ur="rcs_admin_key";function Gx(){try{return localStorage.getItem(Ur)}catch{return null}}function Vx(){const[e,t]=p.useState(Gx),n=p.useCallback(o=>{const r=o.trim();t(r||null);try{r?localStorage.setItem(Ur,r):localStorage.removeItem(Ur)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const jl=p.createContext(null);function Kx(){const e=p.useContext(jl);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function qt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function qx(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}function Xx({children:e}){const[t,n]=p.useState(null),[o,r]=p.useState(!0);p.useEffect(()=>{let l=!1;return qt().then(u=>{l||(n(u),r(!1))}),()=>{l=!0}},[]);const s=p.useCallback(async(l,u)=>{const h=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:l,password:u})});if(!h.ok){const v=await h.json();throw new Error(v.error||"Login failed")}const g=await qt();n(g)},[]),a=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null)},[]),i=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const u=await qt();return n(u),!0}catch{return!1}},[]),m=p.useCallback(async(l,u,h)=>{const g=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,username:u,password:h})});if(!g.ok){const y=await g.json();throw new Error(y.error||"Setup failed")}const v=await qt();n(v)},[]),f=p.useCallback(async(l,u,h)=>{const g=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:l,username:u,password:h})});if(!g.ok){const y=await g.json();throw new Error(y.error||"Join failed")}const v=await qt();n(v)},[]),c=p.useCallback(async()=>qx(),[]);return d.jsx(jl.Provider,{value:{user:t,isLoading:o,login:s,logout:a,refresh:i,setup:m,join:f,checkSetupStatus:c},children:e})}const Cs=p.lazy(()=>Re(()=>import("./Dashboard-YYwDrKTN.js"),__vite__mapDeps([3,2,4,1,5])).then(e=>({default:e.Dashboard}))),Yx=p.lazy(()=>Re(()=>import("./SessionDetail-DmK-DfBQ.js"),__vite__mapDeps([6,2,4,1,5])).then(e=>({default:e.SessionDetail}))),Qx=p.lazy(()=>Re(()=>import("./ShareLanding-DUZrreJ7.js"),__vite__mapDeps([7,2,1,5])).then(e=>({default:e.ShareLanding}))),Zx=p.lazy(()=>Re(()=>import("./Login-0VGZs85I.js"),__vite__mapDeps([8,2,1,5])).then(e=>({default:e.Login}))),Jx=p.lazy(()=>Re(()=>import("./Setup-C0cjxXMt.js"),__vite__mapDeps([9,2,1,5])).then(e=>({default:e.Setup}))),ev=p.lazy(()=>Re(()=>import("./Join-DKCP5X6X.js"),__vite__mapDeps([10,2,1,5])).then(e=>({default:e.Join}))),tv=p.lazy(()=>Re(()=>import("./UserSettings-DRdz9kYE.js"),__vite__mapDeps([11,2,1,5])).then(e=>({default:e.UserSettings}))),nv=p.lazy(()=>Re(()=>import("./TeamList-C-Hte4nV.js"),__vite__mapDeps([12,2,13,1,5])).then(e=>({default:e.TeamList}))),rv=p.lazy(()=>Re(()=>import("./TeamCreate-B8ZV6EdY.js"),__vite__mapDeps([14,2,13,1,5])).then(e=>({default:e.TeamCreate}))),ov=p.lazy(()=>Re(()=>import("./TeamDetail-DBAsJ__i.js"),__vite__mapDeps([15,2,1,5])).then(e=>({default:e.TeamDetail}))),sv=p.lazy(()=>Re(()=>import("./TeamSettings-CNVwYwcp.js"),__vite__mapDeps([16,2,1,5])).then(e=>({default:e.TeamSettings}))),av=new Set(["login","setup","join","share"]),iv=new Set(["login","setup","join"]);function lv(){return d.jsx(Mu,{defaultTheme:"system",children:d.jsx(Xx,{children:d.jsx(cv,{})})})}function cv(){const[e,t]=p.useState("dashboard"),[n,o]=p.useState(null),[r,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),{adminKey:c}=Vx(),{user:l,isLoading:u,checkSetupStatus:h}=Kx();p.useEffect(()=>{jp(c)},[c]);const[g,v]=p.useState(!1);p.useEffect(()=>{!u&&!l&&h().then(v)},[u,l,h]);const y=p.useCallback(()=>{const S=window.location.pathname,j=new URLSearchParams(window.location.search);if(j.get("acp")==="1"){const P=sessionStorage.getItem("acp_connection");if(P)try{const z=JSON.parse(P);if(z.url&&z.token){f({url:z.url,token:z.token}),sessionStorage.removeItem("acp_connection");const E=new URL(window.location.href);E.searchParams.delete("acp"),window.history.replaceState(null,"",E),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const b=j.get("sid");if(b){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${b}`),o(b),i(null),t("session");return}if(S==="/login"){t("login");return}if(S==="/setup"){t("setup");return}if(S==="/join"){t("join");return}if(S==="/settings"){t("settings");return}if(S==="/teams/new"){t("team-create");return}if(S.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(S.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(S==="/teams"){t("teams");return}const M=S.match(/^\/code\/s\/([^/]+)/);if(M&&M[1]){i(M[1]),o(null),s(void 0),t("share");return}const $=S.match(/^\/code\/([^/]+)/);$&&$[1]?(o($[1]),s(void 0),i(null),t("session")):(o(null),s(void 0),i(null),t("dashboard"))},[]);p.useEffect(()=>(y(),window.addEventListener("popstate",y),()=>window.removeEventListener("popstate",y)),[y]);const w=p.useCallback(S=>{window.history.pushState(null,"",`/code/${S}`),o(S),s(void 0),i(null),t("session")},[]),_=p.useCallback(()=>{window.history.pushState(null,"","/code/"),o(null),s(void 0),i(null),f(null),t("dashboard")},[]);if(u)return d.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});let R=e;g&&R!=="setup"&&(R="setup",window.location.pathname!=="/setup"&&window.history.replaceState(null,"","/setup")),!l&&!av.has(R)&&(R="login",window.location.pathname!=="/login"&&window.history.replaceState(null,"","/login")),l&&(R==="login"||R==="setup")&&(R="dashboard",window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"));const A=()=>{if(m&&R==="acp")return d.jsx(Wx,{url:m.url,token:m.token,onBack:_});switch(R){case"login":return d.jsx(Zx,{onSuccess:_});case"setup":return d.jsx(Jx,{onSuccess:_,onAlreadyDone:_});case"join":return d.jsx(ev,{onSuccess:_,onInvalidInvite:_});case"settings":return d.jsx(tv,{onBack:_});case"teams":return d.jsx(nv,{});case"team-create":return d.jsx(rv,{});case"team-detail":return d.jsx(ov,{});case"team-settings":return d.jsx(sv,{});case"share":return d.jsx(Qx,{});case"session":return n?d.jsx(Yx,{sessionId:n,onSessionLoaded:S=>s(S.source)},n):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Cs,{onNavigateSession:w})});default:return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Cs,{onNavigateSession:w})})}},F=!iv.has(R);return d.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[F&&d.jsx(_p,{sessionTitle:n||(m?"ACP":void 0),sessionSource:m?"acp":r,onBack:n||m||a?_:void 0}),d.jsx(p.Suspense,{fallback:d.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:A()})]})}Ol.createRoot(document.getElementById("root")).render(d.jsx(p.StrictMode,{children:d.jsx(lv,{})}));export{Mr as A,pv as B,pg as C,fi as D,xv as E,yv as F,hv as G,bv as H,yn as I,gv as J,Ox as K,Gs as L,_c as M,Kx as N,nx as O,Ks as P,Ap as Q,ex as R,ku as S,Pv as T,$n as X,Ux as a,pr as b,og as c,nn as d,Mv as e,rx as f,tx as g,wv as h,dh as i,ju as j,De as k,Tv as l,jv as m,Cv as n,kv as o,Sv as p,Ev as q,Rv as r,Nv as s,_v as t,Av as u,Rs as v,J as w,ce as x,wt as y,Rc as z};