@saluzi/saluzi-edu 0.3.6 → 0.4.0

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 (174) hide show
  1. package/dist/cli.js +78 -58
  2. package/dist/rcs-schema.sql +11 -0
  3. package/dist/rcs-web/assets/{AdminPanel-B9K3CYqS.js → AdminPanel-BpjNyO3W.js} +1 -1
  4. package/dist/rcs-web/assets/ArtifactView-DMsduT0e.js +1 -0
  5. package/dist/rcs-web/assets/{ArtifactsGallery-CjliWleX.js → ArtifactsGallery--KEN5Q2C.js} +1 -1
  6. package/{packages/remote-control-server/web/dist/assets/Claim-CXcdrgMT.js → dist/rcs-web/assets/Claim-ClHGhexz.js} +1 -1
  7. package/dist/rcs-web/assets/Dashboard-C5LV1cdW.js +6 -0
  8. package/dist/rcs-web/assets/{Join-BIPrGzjB.js → Join-DssmEuDo.js} +1 -1
  9. package/dist/rcs-web/assets/{Login-B3F-J_O_.js → Login-D5-UV7og.js} +1 -1
  10. package/dist/rcs-web/assets/{Register-BOMRs2-X.js → Register-Cgsq_Ibv.js} +1 -1
  11. package/dist/rcs-web/assets/SessionDetail-PIKhgeSE.js +83 -0
  12. package/dist/rcs-web/assets/{SessionVisibilityBadge-CpdH64Ki.js → SessionVisibilityBadge-I2lLxC5g.js} +1 -1
  13. package/dist/rcs-web/assets/{Setup-04VLlDdo.js → Setup-C0Ea6PHX.js} +1 -1
  14. package/dist/rcs-web/assets/{ShareLanding-WwHP77MK.js → ShareLanding-CmSEJlVm.js} +1 -1
  15. package/dist/rcs-web/assets/{TeamCreate-Cgn8TbAD.js → TeamCreate-1i5YF-vx.js} +1 -1
  16. package/dist/rcs-web/assets/{TeamDetail-DjCmVq2J.js → TeamDetail-CT0OPoLU.js} +2 -2
  17. package/dist/rcs-web/assets/{TeamList-DkEsaCsT.js → TeamList-Hhn6XHlf.js} +1 -1
  18. package/dist/rcs-web/assets/{TeamSettings-B37TYBAO.js → TeamSettings-DeSvmHy4.js} +1 -1
  19. package/dist/rcs-web/assets/{UserSearchInput-CnZL2wJc.js → UserSearchInput-DOlIGv2X.js} +1 -1
  20. package/dist/rcs-web/assets/UserSettings-DQZVQw18.js +1 -0
  21. package/dist/rcs-web/assets/{arc-CC5N7Gnz.js → arc-DWZUXcLy.js} +1 -1
  22. package/{packages/remote-control-server/web/dist/assets/architectureDiagram-3BPJPVTR-CYnwtsAv.js → dist/rcs-web/assets/architectureDiagram-3BPJPVTR-A-l-nUmv.js} +1 -1
  23. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DQz4PRpo.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-CeAhGtgG.js} +1 -1
  24. package/{packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-CZD52_Kn.js → dist/rcs-web/assets/c4Diagram-AAUBKEIU-AVRUF_j5.js} +1 -1
  25. package/dist/rcs-web/assets/channel-arpszf6z.js +1 -0
  26. package/dist/rcs-web/assets/{chunk-2J33WTMH-Gj2ixi6u.js → chunk-2J33WTMH-C0xZCh74.js} +1 -1
  27. package/dist/rcs-web/assets/{chunk-4BX2VUAB-CXN22Y7-.js → chunk-4BX2VUAB-PPBm6YOm.js} +1 -1
  28. package/dist/rcs-web/assets/{chunk-55IACEB6-xQfT-CuW.js → chunk-55IACEB6-DItii7PK.js} +1 -1
  29. package/dist/rcs-web/assets/{chunk-727SXJPM-BbG-ntwa.js → chunk-727SXJPM-BxvtEOH5.js} +1 -1
  30. package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-D4F7B6E5.js → dist/rcs-web/assets/chunk-AQP2D5EJ-C2Q0SXf5.js} +1 -1
  31. package/dist/rcs-web/assets/{chunk-FMBD7UC4-C05UOexr.js → chunk-FMBD7UC4-CRIq1t7y.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-ND2GUHAM-CgP_C3YR.js → chunk-ND2GUHAM-DWltgrrr.js} +1 -1
  33. package/dist/rcs-web/assets/{chunk-QZHKN3VN-CEG9thbk.js → chunk-QZHKN3VN-DA7d8KIx.js} +1 -1
  34. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-B3HHWAZN.js +1 -0
  35. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-B3HHWAZN.js +1 -0
  36. package/{packages/remote-control-server/web/dist/assets/code-block-IT6T5CEO-LwZNRjDA.js → dist/rcs-web/assets/code-block-IT6T5CEO-BXA78g4Z.js} +1 -1
  37. package/dist/rcs-web/assets/{copy-VKG2qIBt.js → copy-DIHZ4Rnp.js} +1 -1
  38. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-BDYGEjjT.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-DfAvPuoD.js} +1 -1
  39. package/dist/rcs-web/assets/{dagre-BM42HDAG-4fAyUQHo.js → dagre-BM42HDAG-Qq1-K6d7.js} +1 -1
  40. package/dist/rcs-web/assets/{diagram-2AECGRRQ-D3NtHIEV.js → diagram-2AECGRRQ-BdCpCixY.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-5GNKFQAL-BKL4sgRR.js → diagram-5GNKFQAL-Bx3h0pH5.js} +1 -1
  42. package/dist/rcs-web/assets/{diagram-KO2AKTUF-B67rX-ug.js → diagram-KO2AKTUF-D87FL1JG.js} +1 -1
  43. package/dist/rcs-web/assets/{diagram-LMA3HP47-BOKNQw_d.js → diagram-LMA3HP47-CgoY1c_8.js} +1 -1
  44. package/dist/rcs-web/assets/{diagram-OG6HWLK6-C7IEoW-1.js → diagram-OG6HWLK6-BtkoOZUL.js} +1 -1
  45. package/{packages/remote-control-server/web/dist/assets/dialog-BkaYnxd7.js → dist/rcs-web/assets/dialog-Ci9ytkis.js} +1 -1
  46. package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-Dk3unY1I.js → erDiagram-TEJ5UH35-B54UzzpA.js} +1 -1
  47. package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-DZJ3rxoR.js → flowDiagram-I6XJVG4X-B2MA7cSv.js} +1 -1
  48. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-Db4jo72X.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-sCnFGbUE.js} +1 -1
  49. package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BX3YMZO1.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-D1hIYZw2.js} +1 -1
  50. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-B3YkgTqr.js → infoDiagram-5YYISTIA-BIJ_iPnH.js} +1 -1
  51. package/dist/rcs-web/assets/{ishikawaDiagram-YF4QCWOH-C72E1awT.js → ishikawaDiagram-YF4QCWOH-VZSMyDVi.js} +1 -1
  52. package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-BQtBob5h.js → journeyDiagram-JHISSGLW-BtQFP7hW.js} +1 -1
  53. package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-u4jbqr1b.js → kanban-definition-UN3LZRKU-4VzgDGK0.js} +1 -1
  54. package/dist/rcs-web/assets/{linear-BgmGl4it.js → linear-BUc89IRk.js} +1 -1
  55. package/dist/rcs-web/assets/main-B67FXcTf.js +274 -0
  56. package/dist/rcs-web/assets/main-CDFTdB3m.css +1 -0
  57. package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-CbW524nw.js → dist/rcs-web/assets/mermaid-VLURNSYL-B9hHZxgz.js} +4 -4
  58. package/dist/rcs-web/assets/{mermaid.core-CHLPnWoP.js → mermaid.core-BJkztS6P.js} +5 -5
  59. package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-BJmEA5fB.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-D0P4gWNR.js} +1 -1
  60. package/dist/rcs-web/assets/notifications-D9_SRqI0.js +1 -0
  61. package/{packages/remote-control-server/web/dist/assets/pieDiagram-4H26LBE5-D2yhA9tV.js → dist/rcs-web/assets/pieDiagram-4H26LBE5-DpQuSH_r.js} +1 -1
  62. package/{packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-OsyuYmxV.js → dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-CtFhvAZp.js} +1 -1
  63. package/dist/rcs-web/assets/refresh-cw-CgJEBffB.js +6 -0
  64. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-DlBCGFrE.js → requirementDiagram-4Y6WPE33-Dvo0fzAz.js} +1 -1
  65. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CRf3tVJL.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-gbV73Jae.js} +1 -1
  66. package/{packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-CPMzSwEL.js → dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-CGIUy6J3.js} +1 -1
  67. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-C8aXVxPs.js → stateDiagram-AJRCARHV-D7pzulbB.js} +1 -1
  68. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-BtaA-6HM.js → stateDiagram-v2-BHNVJYJU-Ct3ciKMZ.js} +1 -1
  69. package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-D4bpIX_3.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-DTR6Rmtz.js} +1 -1
  70. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-BOvGxUBy.js → vennDiagram-CIIHVFJN-WBicpAVq.js} +1 -1
  71. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-DOap87Nn.js → wardleyDiagram-YWT4CUSO-1HjVSjok.js} +1 -1
  72. package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-BiKOkL9_.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-b5vzo0Pc.js} +1 -1
  73. package/dist/rcs-web/index.html +2 -2
  74. package/package.json +1 -1
  75. package/packages/remote-control-server/src/__tests__/search.test.ts +157 -0
  76. package/packages/remote-control-server/src/__tests__/session-rewind.test.ts +186 -0
  77. package/packages/remote-control-server/src/__tests__/session-titles.test.ts +220 -0
  78. package/packages/remote-control-server/src/db/rcs-schema.sql +11 -0
  79. package/packages/remote-control-server/src/routes/v2/worker-events.ts +13 -0
  80. package/packages/remote-control-server/src/routes/web/sessions.ts +127 -1
  81. package/packages/remote-control-server/src/services/event-persistence.ts +3 -0
  82. package/packages/remote-control-server/src/services/search.ts +195 -0
  83. package/packages/remote-control-server/src/services/session-titles.ts +162 -0
  84. package/packages/remote-control-server/src/services/transport.ts +11 -0
  85. package/packages/remote-control-server/src/transport/ws-handler.ts +13 -0
  86. package/packages/remote-control-server/web/dist/assets/{AdminPanel-B9K3CYqS.js → AdminPanel-BpjNyO3W.js} +1 -1
  87. package/packages/remote-control-server/web/dist/assets/ArtifactView-DMsduT0e.js +1 -0
  88. package/packages/remote-control-server/web/dist/assets/{ArtifactsGallery-CjliWleX.js → ArtifactsGallery--KEN5Q2C.js} +1 -1
  89. package/{dist/rcs-web/assets/Claim-CXcdrgMT.js → packages/remote-control-server/web/dist/assets/Claim-ClHGhexz.js} +1 -1
  90. package/packages/remote-control-server/web/dist/assets/Dashboard-C5LV1cdW.js +6 -0
  91. package/packages/remote-control-server/web/dist/assets/{Join-BIPrGzjB.js → Join-DssmEuDo.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/{Login-B3F-J_O_.js → Login-D5-UV7og.js} +1 -1
  93. package/packages/remote-control-server/web/dist/assets/{Register-BOMRs2-X.js → Register-Cgsq_Ibv.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/SessionDetail-PIKhgeSE.js +83 -0
  95. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-CpdH64Ki.js → SessionVisibilityBadge-I2lLxC5g.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/{Setup-04VLlDdo.js → Setup-C0Ea6PHX.js} +1 -1
  97. package/packages/remote-control-server/web/dist/assets/{ShareLanding-WwHP77MK.js → ShareLanding-CmSEJlVm.js} +1 -1
  98. package/packages/remote-control-server/web/dist/assets/{TeamCreate-Cgn8TbAD.js → TeamCreate-1i5YF-vx.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{TeamDetail-DjCmVq2J.js → TeamDetail-CT0OPoLU.js} +2 -2
  100. package/packages/remote-control-server/web/dist/assets/{TeamList-DkEsaCsT.js → TeamList-Hhn6XHlf.js} +1 -1
  101. package/packages/remote-control-server/web/dist/assets/{TeamSettings-B37TYBAO.js → TeamSettings-DeSvmHy4.js} +1 -1
  102. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-CnZL2wJc.js → UserSearchInput-DOlIGv2X.js} +1 -1
  103. package/packages/remote-control-server/web/dist/assets/UserSettings-DQZVQw18.js +1 -0
  104. package/packages/remote-control-server/web/dist/assets/{arc-CC5N7Gnz.js → arc-DWZUXcLy.js} +1 -1
  105. package/{dist/rcs-web/assets/architectureDiagram-3BPJPVTR-CYnwtsAv.js → packages/remote-control-server/web/dist/assets/architectureDiagram-3BPJPVTR-A-l-nUmv.js} +1 -1
  106. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-DQz4PRpo.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CeAhGtgG.js} +1 -1
  107. package/{dist/rcs-web/assets/c4Diagram-AAUBKEIU-CZD52_Kn.js → packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-AVRUF_j5.js} +1 -1
  108. package/packages/remote-control-server/web/dist/assets/channel-arpszf6z.js +1 -0
  109. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-Gj2ixi6u.js → chunk-2J33WTMH-C0xZCh74.js} +1 -1
  110. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-CXN22Y7-.js → chunk-4BX2VUAB-PPBm6YOm.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-xQfT-CuW.js → chunk-55IACEB6-DItii7PK.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{chunk-727SXJPM-BbG-ntwa.js → chunk-727SXJPM-BxvtEOH5.js} +1 -1
  113. package/{dist/rcs-web/assets/chunk-AQP2D5EJ-D4F7B6E5.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-C2Q0SXf5.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-C05UOexr.js → chunk-FMBD7UC4-CRIq1t7y.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-CgP_C3YR.js → chunk-ND2GUHAM-DWltgrrr.js} +1 -1
  116. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-CEG9thbk.js → chunk-QZHKN3VN-DA7d8KIx.js} +1 -1
  117. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-B3HHWAZN.js +1 -0
  118. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-B3HHWAZN.js +1 -0
  119. package/{dist/rcs-web/assets/code-block-IT6T5CEO-LwZNRjDA.js → packages/remote-control-server/web/dist/assets/code-block-IT6T5CEO-BXA78g4Z.js} +1 -1
  120. package/packages/remote-control-server/web/dist/assets/{copy-VKG2qIBt.js → copy-DIHZ4Rnp.js} +1 -1
  121. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-BDYGEjjT.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-DfAvPuoD.js} +1 -1
  122. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-4fAyUQHo.js → dagre-BM42HDAG-Qq1-K6d7.js} +1 -1
  123. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-D3NtHIEV.js → diagram-2AECGRRQ-BdCpCixY.js} +1 -1
  124. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-BKL4sgRR.js → diagram-5GNKFQAL-Bx3h0pH5.js} +1 -1
  125. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-B67rX-ug.js → diagram-KO2AKTUF-D87FL1JG.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-BOKNQw_d.js → diagram-LMA3HP47-CgoY1c_8.js} +1 -1
  127. package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-C7IEoW-1.js → diagram-OG6HWLK6-BtkoOZUL.js} +1 -1
  128. package/{dist/rcs-web/assets/dialog-BkaYnxd7.js → packages/remote-control-server/web/dist/assets/dialog-Ci9ytkis.js} +1 -1
  129. package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-Dk3unY1I.js → erDiagram-TEJ5UH35-B54UzzpA.js} +1 -1
  130. package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-DZJ3rxoR.js → flowDiagram-I6XJVG4X-B2MA7cSv.js} +1 -1
  131. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-Db4jo72X.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-sCnFGbUE.js} +1 -1
  132. package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BX3YMZO1.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-D1hIYZw2.js} +1 -1
  133. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-B3YkgTqr.js → infoDiagram-5YYISTIA-BIJ_iPnH.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{ishikawaDiagram-YF4QCWOH-C72E1awT.js → ishikawaDiagram-YF4QCWOH-VZSMyDVi.js} +1 -1
  135. package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-BQtBob5h.js → journeyDiagram-JHISSGLW-BtQFP7hW.js} +1 -1
  136. package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-u4jbqr1b.js → kanban-definition-UN3LZRKU-4VzgDGK0.js} +1 -1
  137. package/packages/remote-control-server/web/dist/assets/{linear-BgmGl4it.js → linear-BUc89IRk.js} +1 -1
  138. package/packages/remote-control-server/web/dist/assets/main-B67FXcTf.js +274 -0
  139. package/packages/remote-control-server/web/dist/assets/main-CDFTdB3m.css +1 -0
  140. package/{dist/rcs-web/assets/mermaid-VLURNSYL-CbW524nw.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-B9hHZxgz.js} +4 -4
  141. package/packages/remote-control-server/web/dist/assets/{mermaid.core-CHLPnWoP.js → mermaid.core-BJkztS6P.js} +5 -5
  142. package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-BJmEA5fB.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-D0P4gWNR.js} +1 -1
  143. package/packages/remote-control-server/web/dist/assets/notifications-D9_SRqI0.js +1 -0
  144. package/{dist/rcs-web/assets/pieDiagram-4H26LBE5-D2yhA9tV.js → packages/remote-control-server/web/dist/assets/pieDiagram-4H26LBE5-DpQuSH_r.js} +1 -1
  145. package/{dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-OsyuYmxV.js → packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-CtFhvAZp.js} +1 -1
  146. package/packages/remote-control-server/web/dist/assets/refresh-cw-CgJEBffB.js +6 -0
  147. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-DlBCGFrE.js → requirementDiagram-4Y6WPE33-Dvo0fzAz.js} +1 -1
  148. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CRf3tVJL.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-gbV73Jae.js} +1 -1
  149. package/{dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-CPMzSwEL.js → packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-CGIUy6J3.js} +1 -1
  150. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-C8aXVxPs.js → stateDiagram-AJRCARHV-D7pzulbB.js} +1 -1
  151. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-BtaA-6HM.js → stateDiagram-v2-BHNVJYJU-Ct3ciKMZ.js} +1 -1
  152. package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-D4bpIX_3.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-DTR6Rmtz.js} +1 -1
  153. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-BOvGxUBy.js → vennDiagram-CIIHVFJN-WBicpAVq.js} +1 -1
  154. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-DOap87Nn.js → wardleyDiagram-YWT4CUSO-1HjVSjok.js} +1 -1
  155. package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-BiKOkL9_.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-b5vzo0Pc.js} +1 -1
  156. package/packages/remote-control-server/web/dist/index.html +2 -2
  157. package/dist/rcs-web/assets/ArtifactView-xC7kgK6r.js +0 -6
  158. package/dist/rcs-web/assets/Dashboard-GTUc9fNN.js +0 -6
  159. package/dist/rcs-web/assets/SessionDetail-D13hMSu2.js +0 -60
  160. package/dist/rcs-web/assets/UserSettings-IVT2kcbO.js +0 -1
  161. package/dist/rcs-web/assets/channel-Ca4tVWtj.js +0 -1
  162. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BZnm3s8l.js +0 -1
  163. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BZnm3s8l.js +0 -1
  164. package/dist/rcs-web/assets/main-DT3Fa5LX.css +0 -1
  165. package/dist/rcs-web/assets/main-uW6v3W3M.js +0 -265
  166. package/packages/remote-control-server/web/dist/assets/ArtifactView-xC7kgK6r.js +0 -6
  167. package/packages/remote-control-server/web/dist/assets/Dashboard-GTUc9fNN.js +0 -6
  168. package/packages/remote-control-server/web/dist/assets/SessionDetail-D13hMSu2.js +0 -60
  169. package/packages/remote-control-server/web/dist/assets/UserSettings-IVT2kcbO.js +0 -1
  170. package/packages/remote-control-server/web/dist/assets/channel-Ca4tVWtj.js +0 -1
  171. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BZnm3s8l.js +0 -1
  172. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BZnm3s8l.js +0 -1
  173. package/packages/remote-control-server/web/dist/assets/main-DT3Fa5LX.css +0 -1
  174. package/packages/remote-control-server/web/dist/assets/main-uW6v3W3M.js +0 -265
@@ -0,0 +1,274 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-B9hHZxgz.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-C5LV1cdW.js","assets/workerType-Bd-zteMi.js","assets/SessionVisibilityBadge-I2lLxC5g.js","assets/dialog-Ci9ytkis.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-PIKhgeSE.js","assets/refresh-cw-CgJEBffB.js","assets/ArtifactsGallery--KEN5Q2C.js","assets/copy-DIHZ4Rnp.js","assets/UserSearchInput-DOlIGv2X.js","assets/notifications-D9_SRqI0.js","assets/ShareLanding-CmSEJlVm.js","assets/ArtifactView-DMsduT0e.js","assets/Claim-ClHGhexz.js","assets/Login-D5-UV7og.js","assets/Register-Cgsq_Ibv.js","assets/Setup-C0Ea6PHX.js","assets/Join-DssmEuDo.js","assets/UserSettings-DQZVQw18.js","assets/TeamList-Hhn6XHlf.js","assets/TeamCreate-1i5YF-vx.js","assets/TeamDetail-CT0OPoLU.js","assets/TeamSettings-DeSvmHy4.js","assets/AdminPanel-BpjNyO3W.js"])))=>i.map(i=>d[i]);
2
+ var vc=Object.defineProperty;var bc=(e,t,n)=>t in e?vc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var re=(e,t,n)=>bc(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as dt,j as u,R as oo,r as Js,b as yc,c as so,d as wc}from"./vendor-DE_-CLIE.js";import{_ as Ee}from"./shiki-mEP5vQQu.js";import{m as Cc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function Zs(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Zs(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ea(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Zs(e))&&(r&&(r+=" "),r+=t);return r}const Sc=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},kc=(e,t)=>({classGroupId:e,validator:t}),ta=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Fn="-",qo=[],_c="arbitrary..",Ac=e=>{const t=Tc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Ec(a);const i=a.split(Fn),m=i[0]===""&&i.length>1?1:0;return na(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=r[a],f=n[a];return m?f?Sc(f,m):m:f||qo}return n[a]||qo}}},na=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const f=na(e,t+1,s);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(Fn):e.slice(t).join(Fn),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},Ec=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?_c+r:void 0})(),Tc=e=>{const{theme:t,classGroups:n}=e;return jc(n,t)},jc=(e,t)=>{const n=ta();for(const r in e){const o=e[r];ao(o,n,r,t)}return n},ao=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const a=e[s];Nc(a,t,n,r)}},Nc=(e,t,n,r)=>{if(typeof e=="string"){Rc(e,t,n);return}if(typeof e=="function"){Ic(e,t,n,r);return}Mc(e,t,n,r)},Rc=(e,t,n)=>{const r=e===""?t:ra(t,e);r.classGroupId=n},Ic=(e,t,n,r)=>{if(Pc(e)){ao(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(kc(n,e))},Mc=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let a=0;a<s;a++){const[i,m]=o[a];ao(m,ra(t,i),n,r)}},ra=(e,t)=>{let n=e;const r=t.split(Fn),o=r.length;for(let s=0;s<o;s++){const a=r[s];let i=n.nextPart.get(a);i||(i=ta(),n.nextPart.set(a,i)),n=i}return n},Pc=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Oc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,a)=>{n[s]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=r[s])!==void 0)return o(s,a),a},set(s,a){s in n?n[s]=a:o(s,a)}}},Fr="!",Yo=":",Dc=[],Xo=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),Lc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let a=0,i=0,m=0,f;const l=o.length;for(let b=0;b<l;b++){const y=o[b];if(a===0&&i===0){if(y===Yo){s.push(o.slice(m,b)),m=b+1;continue}if(y==="/"){f=b;continue}}y==="["?a++:y==="]"?a--:y==="("?i++:y===")"&&i--}const c=s.length===0?o:o.slice(m);let d=c,h=!1;c.endsWith(Fr)?(d=c.slice(0,-1),h=!0):c.startsWith(Fr)&&(d=c.slice(1),h=!0);const g=f&&f>m?f-m:void 0;return Xo(s,h,d,g)};if(t){const o=t+Yo,s=r;r=a=>a.startsWith(o)?s(a.slice(o.length)):Xo(Dc,!1,a,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},Fc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",m=t.has(a);i||m?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(a)):o.push(a)}return o.length>0&&(o.sort(),r.push(...o)),r}},$c=e=>({cache:Oc(e.cacheSize),parseClassName:Lc(e),sortModifiers:Fc(e),postfixLookupClassGroupIds:Uc(e),...Ac(e)}),Uc=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},zc=/\s+/,Hc=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(zc);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:d,modifiers:h,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:y}=n(c);if(d){f=c+(f.length>0?" "+f:f);continue}let v=!!y,A;if(v){const E=b.substring(0,y);A=r(E);const x=A&&a[A]?r(b):void 0;x&&x!==A&&(A=x,v=!1)}else A=r(b);if(!A){if(!v){f=c+(f.length>0?" "+f:f);continue}if(A=r(b),!A){f=c+(f.length>0?" "+f:f);continue}v=!1}const T=h.length===0?"":h.length===1?h[0]:s(h).join(":"),_=g?T+Fr:T,D=_+A;if(i.indexOf(D)>-1)continue;i.push(D);const k=o(A,v);for(let E=0;E<k.length;++E){const x=k[E];i.push(_+x)}f=c+(f.length>0?" "+f:f)}return f},Bc=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=oa(n))&&(o&&(o+=" "),o+=r);return o},oa=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=oa(e[r]))&&(n&&(n+=" "),n+=t);return n},Wc=(e,...t)=>{let n,r,o,s;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=$c(f),r=n.cache.get,o=n.cache.set,s=i,i(m)},i=m=>{const f=r(m);if(f)return f;const l=Hc(m,n);return o(m,l),l};return s=a,(...m)=>s(Bc(...m))},Gc=[],ke=e=>{const t=n=>n[e]||Gc;return t.isThemeGetter=!0,t},sa=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,aa=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Vc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Kc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qc=/\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$/,Yc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Xc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ut=e=>Vc.test(e),se=e=>!!e&&!Number.isNaN(Number(e)),Ke=e=>!!e&&Number.isInteger(Number(e)),gr=e=>e.endsWith("%")&&se(e.slice(0,-1)),tt=e=>Kc.test(e),ia=()=>!0,Jc=e=>qc.test(e)&&!Yc.test(e),io=()=>!1,Zc=e=>Xc.test(e),eu=e=>Qc.test(e),tu=e=>!X(e)&&!Q(e),nu=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)),ru=e=>vt(e,ua,io),X=e=>sa.test(e),kt=e=>vt(e,da,Jc),Qo=e=>vt(e,du,se),ou=e=>vt(e,ma,ia),su=e=>vt(e,fa,io),Jo=e=>vt(e,la,io),au=e=>vt(e,ca,eu),_n=e=>vt(e,pa,Zc),Q=e=>aa.test(e),rn=e=>Mt(e,da),iu=e=>Mt(e,fa),Zo=e=>Mt(e,la),lu=e=>Mt(e,ua),cu=e=>Mt(e,ca),An=e=>Mt(e,pa,!0),uu=e=>Mt(e,ma,!0),vt=(e,t,n)=>{const r=sa.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Mt=(e,t,n=!1)=>{const r=aa.exec(e);return r?r[1]?t(r[1]):n:!1},la=e=>e==="position"||e==="percentage",ca=e=>e==="image"||e==="url",ua=e=>e==="length"||e==="size"||e==="bg-size",da=e=>e==="length",du=e=>e==="number",fa=e=>e==="family-name",ma=e=>e==="number"||e==="weight",pa=e=>e==="shadow",fu=()=>{const e=ke("color"),t=ke("font"),n=ke("text"),r=ke("font-weight"),o=ke("tracking"),s=ke("leading"),a=ke("breakpoint"),i=ke("container"),m=ke("spacing"),f=ke("radius"),l=ke("shadow"),c=ke("inset-shadow"),d=ke("text-shadow"),h=ke("drop-shadow"),g=ke("blur"),b=ke("perspective"),y=ke("aspect"),v=ke("ease"),A=ke("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[..._(),Q,X],k=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],x=()=>[Q,X,m],w=()=>[ut,"full","auto",...x()],j=()=>[Ke,"none","subgrid",Q,X],P=()=>["auto",{span:["full",Ke,Q,X]},Ke,Q,X],O=()=>[Ke,"auto",Q,X],F=()=>["auto","min","max","fr",Q,X],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],S=()=>["auto",...x()],C=()=>[ut,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],H=()=>[ut,"screen","full","dvw","lvw","svw","min","max","fit",...x()],M=()=>[ut,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],U=()=>[e,Q,X],q=()=>[..._(),Zo,Jo,{position:[Q,X]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",lu,ru,{size:[Q,X]}],$=()=>[gr,rn,kt],N=()=>["","none","full",f,Q,X],B=()=>["",se,rn,kt],G=()=>["solid","dashed","dotted","double"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[se,gr,Zo,Jo],oe=()=>["","none",g,Q,X],J=()=>["none",se,Q,X],ne=()=>["none",se,Q,X],ie=()=>[se,Q,X],ve=()=>[ut,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tt],breakpoint:[tt],color:[ia],container:[tt],"drop-shadow":[tt],ease:["in","out","in-out"],font:[tu],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tt],shadow:[tt],spacing:["px",se],text:[tt],"text-shadow":[tt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ut,X,Q,y]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[nu],columns:[{columns:[se,X,Q,i]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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:D()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[Ke,"auto",Q,X]}],basis:[{basis:[ut,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[se,ut,"auto","initial","none",X]}],grow:[{grow:["",se,Q,X]}],shrink:[{shrink:["",se,Q,X]}],order:[{order:[Ke,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:S()}],mx:[{mx:S()}],my:[{my:S()}],ms:[{ms:S()}],me:[{me:S()}],mbs:[{mbs:S()}],mbe:[{mbe:S()}],mt:[{mt:S()}],mr:[{mr:S()}],mb:[{mb:S()}],ml:[{ml:S()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],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,rn,kt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,uu,ou]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gr,X]}],"font-family":[{font:[iu,su,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:[o,Q,X]}],"line-clamp":[{"line-clamp":[se,"none",Q,Qo]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",Q,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[se,"from-font","auto",Q,kt]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[se,"auto",Q,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[Ke,Q,X]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ke,Q,X],radial:["",Q,X],conic:[Ke,Q,X]},cu,au]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:N()}],"rounded-s":[{"rounded-s":N()}],"rounded-e":[{"rounded-e":N()}],"rounded-t":[{"rounded-t":N()}],"rounded-r":[{"rounded-r":N()}],"rounded-b":[{"rounded-b":N()}],"rounded-l":[{"rounded-l":N()}],"rounded-ss":[{"rounded-ss":N()}],"rounded-se":[{"rounded-se":N()}],"rounded-ee":[{"rounded-ee":N()}],"rounded-es":[{"rounded-es":N()}],"rounded-tl":[{"rounded-tl":N()}],"rounded-tr":[{"rounded-tr":N()}],"rounded-br":[{"rounded-br":N()}],"rounded-bl":[{"rounded-bl":N()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[se,Q,X]}],"outline-w":[{outline:["",se,rn,kt]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",l,An,_n]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",c,An,_n]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[se,kt]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",d,An,_n]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[se,Q,X]}],"mix-blend":[{"mix-blend":[...V(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":V()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[se]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Q,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[se]}],"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":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:oe()}],brightness:[{brightness:[se,Q,X]}],contrast:[{contrast:[se,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",h,An,_n]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",se,Q,X]}],"hue-rotate":[{"hue-rotate":[se,Q,X]}],invert:[{invert:["",se,Q,X]}],saturate:[{saturate:[se,Q,X]}],sepia:[{sepia:["",se,Q,X]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,X]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[se,Q,X]}],"backdrop-contrast":[{"backdrop-contrast":[se,Q,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",se,Q,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[se,Q,X]}],"backdrop-invert":[{"backdrop-invert":["",se,Q,X]}],"backdrop-opacity":[{"backdrop-opacity":[se,Q,X]}],"backdrop-saturate":[{"backdrop-saturate":[se,Q,X]}],"backdrop-sepia":[{"backdrop-sepia":["",se,Q,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[se,"initial",Q,X]}],ease:[{ease:["linear","initial",v,Q,X]}],delay:[{delay:[se,Q,X]}],animate:[{animate:["none",A,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Q,X]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:J()}],"rotate-x":[{"rotate-x":J()}],"rotate-y":[{"rotate-y":J()}],"rotate-z":[{"rotate-z":J()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":["scale-3d"],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[Q,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],zoom:[{zoom:[Ke,Q,X]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,X]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[se,rn,kt,Qo]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},mu=Wc(fu);function Z(...e){return mu(ea(e))}function pu(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function Lb(e){return e?new Date(e*1e3).toLocaleString():""}function Fb(e){return e==="archived"||e==="inactive"}function $b(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function hu(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 Ub(){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),hu(t)}function zb(e){if(!e||typeof e!="object")return!1;if(e.status==="conversation_cleared")return!0;const t=e.raw;return!!t&&typeof t=="object"&&t.status==="conversation_cleared"}const gu=/^Remote Control connecting(?:…|\.\.\.)$/;function Hb(e){return typeof e=="string"&&gu.test(e.trim())}/**
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 xu=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vu=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),es=e=>{const t=vu(e);return t.charAt(0).toUpperCase()+t.slice(1)},ha=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),bu=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 yu={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 wu=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...i},m)=>p.createElement("svg",{ref:m,...yu,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ha("lucide",o),...!s&&!bu(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,l])=>p.createElement(f,l)),...Array.isArray(s)?s:[s]]));/**
18
+ * @license lucide-react v0.555.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const ae=(e,t)=>{const n=p.forwardRef(({className:r,...o},s)=>p.createElement(wu,{ref:s,iconNode:t,className:ha(`lucide-${xu(es(e))}`,`lucide-${e}`,r),...o}));return n.displayName=es(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 Cu=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Su=ae("arrow-down",Cu);/**
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 ku=[["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"}]],_u=ae("brain",ku);/**
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 Au=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],mn=ae("check",Au);/**
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 Eu=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Qt=ae("chevron-down",Eu);/**
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 Tu=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ju=ae("chevron-left",Tu);/**
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 Nu=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ga=ae("chevron-up",Nu);/**
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 Ru=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Iu=ae("circle-check",Ru);/**
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 Mu=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Pu=ae("circle",Mu);/**
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 Ou=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Du=ae("clock",Ou);/**
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 Lu=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Fu=ae("file-code-corner",Lu);/**
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 $u=[["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"}]],Vt=ae("file-text",$u);/**
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 Uu=[["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"}]],lo=ae("folder-open",Uu);/**
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 zu=[["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"}]],Hu=ae("image",zu);/**
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 Bu=[["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"}]],Wu=ae("layout-grid",Bu);/**
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 Gu=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],xa=ae("loader-circle",Gu);/**
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 Vu=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Ku=ae("log-out",Vu);/**
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 qu=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Yu=ae("message-square",qu);/**
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 Xu=[["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"}]],Qu=ae("monitor",Xu);/**
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 Ju=[["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"}]],va=ae("moon",Ju);/**
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 Zu=[["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"}]],ed=ae("panel-left-close",Zu);/**
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 td=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],nd=ae("panel-left",td);/**
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 rd=[["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"}]],od=ae("paperclip",rd);/**
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 sd=[["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"}]],ba=ae("pencil",sd);/**
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 ad=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ya=ae("plus",ad);/**
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 id=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ld=ae("search",id);/**
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 cd=[["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"}]],ud=ae("send",cd);/**
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 dd=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],fd=ae("settings",dd);/**
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 md=[["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"}]],wa=ae("shield-alert",md);/**
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 pd=[["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"}]],hd=ae("shield",pd);/**
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 gd=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],xd=ae("slash",gd);/**
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 vd=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],bd=ae("square",vd);/**
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 yd=[["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"}]],Ca=ae("sun",yd);/**
183
+ * @license lucide-react v0.555.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */const wd=[["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"}]],co=ae("table",wd);/**
188
+ * @license lucide-react v0.555.0 - ISC
189
+ *
190
+ * This source code is licensed under the ISC license.
191
+ * See the LICENSE file in the root directory of this source tree.
192
+ */const Cd=[["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"}]],Sd=ae("trash-2",Cd);/**
193
+ * @license lucide-react v0.555.0 - ISC
194
+ *
195
+ * This source code is licensed under the ISC license.
196
+ * See the LICENSE file in the root directory of this source tree.
197
+ */const kd=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],_d=ae("undo-2",kd);/**
198
+ * @license lucide-react v0.555.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */const Ad=[["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"}]],Sa=ae("user",Ad);/**
203
+ * @license lucide-react v0.555.0 - ISC
204
+ *
205
+ * This source code is licensed under the ISC license.
206
+ * See the LICENSE file in the root directory of this source tree.
207
+ */const Ed=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Td=ae("users",Ed);/**
208
+ * @license lucide-react v0.555.0 - ISC
209
+ *
210
+ * This source code is licensed under the ISC license.
211
+ * See the LICENSE file in the root directory of this source tree.
212
+ */const jd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],pn=ae("x",jd),ka=p.createContext(void 0),_a="theme";function ts(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ns(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(_a);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function rs(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function Nd(){const e=p.useContext(ka);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Rd({children:e,defaultTheme:t="system"}){const[n,r]=p.useState(()=>ns()||t),[o,s]=p.useState(()=>{const m=ns()||t;return m==="system"?ts():m}),a=p.useCallback(m=>{r(m);try{localStorage.setItem(_a,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?ts():n;s(m),rs(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";s(c),rs(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:o,setTheme:a};return dt.createElement(ka.Provider,{value:i},e)}function os(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Je(...e){return t=>{let n=!1;const r=e.map(o=>{const s=os(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():os(e[o],null)}}}}function Ce(...e){return p.useCallback(Je(...e),e)}var Id=Symbol.for("react.lazy"),$n=oo[" use ".trim().toString()];function Md(e){return typeof e=="object"&&e!==null&&"then"in e}function Aa(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Id&&"_payload"in e&&Md(e._payload)}function Ea(e){const t=Od(e),n=p.forwardRef((r,o)=>{let{children:s,...a}=r;Aa(s)&&typeof $n=="function"&&(s=$n(s._payload));const i=p.Children.toArray(s),m=i.find(Ld);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:o,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Pd=Ea("Slot");function Od(e){const t=p.forwardRef((n,r)=>{let{children:o,...s}=n;if(Aa(o)&&typeof $n=="function"&&(o=$n(o._payload)),p.isValidElement(o)){const a=$d(o),i=Fd(s,o.props);return o.type!==p.Fragment&&(i.ref=r?Je(r,a):a),p.cloneElement(o,i)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Dd=Symbol("radix.slottable");function Ld(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Dd}function Fd(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const m=s(...i);return o(...i),m}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function $d(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const ss=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,as=ea,Ud=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return as(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(f=>{const l=n==null?void 0:n[f],c=s==null?void 0:s[f];if(l===null)return null;const d=ss(l)||ss(c);return o[f][d]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,d]=l;return d===void 0||(f[c]=d),f},{}),m=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,l)=>{let{class:c,className:d,...h}=l;return Object.entries(h).every(g=>{let[b,y]=g;return Array.isArray(y)?y.includes({...s,...i}[b]):{...s,...i}[b]===y})?[...f,c,d]:f},[]);return as(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},zd=Ud("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 Pt({className:e,variant:t,size:n,asChild:r=!1,...o}){const s=r?Pd:"button";return u.jsx(s,{"data-slot":"button",className:Z(zd({variant:t,size:n,className:e})),...o})}function te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Hd(e,t){const n=p.createContext(t),r=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return u.jsx(n.Provider,{value:m,children:a})};r.displayName=e+"Provider";function o(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[r,o]}function at(e,t=[]){let n=[];function r(s,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var v;const{scope:d,children:h,...g}=c,b=((v=d==null?void 0:d[e])==null?void 0:v[m])||i,y=p.useMemo(()=>g,Object.values(g));return u.jsx(b.Provider,{value:y,children:h})};f.displayName=s+"Provider";function l(c,d){var b;const h=((b=d==null?void 0:d[e])==null?void 0:b[m])||i,g=p.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${s}\``)}return[f,l]}const o=()=>{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 o.scopeName=e,[r,Bd(o,...t)]}function Bd(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((i,{useScope:m,scopeName:f})=>{const c=m(s)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var nt=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Wd=oo[" useInsertionEffect ".trim().toString()]||nt;function pt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,a]=Gd({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:o;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${r} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,r])}const f=p.useCallback(l=>{var c;if(i){const d=Vd(l)?l(e):l;d!==e&&((c=a.current)==null||c.call(a,d))}else s(l)},[i,e,s,a]);return[m,f]}function Gd({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),o=p.useRef(n),s=p.useRef(t);return Wd(()=>{s.current=t},[t]),p.useEffect(()=>{var a;o.current!==n&&((a=s.current)==null||a.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Vd(e){return typeof e=="function"}function Kt(e){const t=Kd(e),n=p.forwardRef((r,o)=>{const{children:s,...a}=r,i=p.Children.toArray(s),m=i.find(Yd);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:o,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function Kd(e){const t=p.forwardRef((n,r)=>{const{children:o,...s}=n;if(p.isValidElement(o)){const a=Qd(o),i=Xd(s,o.props);return o.type!==p.Fragment&&(i.ref=r?Je(r,a):a),p.cloneElement(o,i)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ta=Symbol("radix.slottable");function qd(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Ta,t}function Yd(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ta}function Xd(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const m=s(...i);return o(...i),m}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Qd(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Jd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=Jd.reduce((e,t)=>{const n=Kt(`Primitive.${t}`),r=p.forwardRef((o,s)=>{const{asChild:a,...i}=o,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ja(e,t){e&&Js.flushSync(()=>e.dispatchEvent(t))}function Na(e){const t=e+"CollectionProvider",[n,r]=at(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=b=>{const{scope:y,children:v}=b,A=dt.useRef(null),T=dt.useRef(new Map).current;return u.jsx(o,{scope:y,itemMap:T,collectionRef:A,children:v})};a.displayName=t;const i=e+"CollectionSlot",m=Kt(i),f=dt.forwardRef((b,y)=>{const{scope:v,children:A}=b,T=s(i,v),_=Ce(y,T.collectionRef);return u.jsx(m,{ref:_,children:A})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",d=Kt(l),h=dt.forwardRef((b,y)=>{const{scope:v,children:A,...T}=b,_=dt.useRef(null),D=Ce(y,_),k=s(l,v);return dt.useEffect(()=>(k.itemMap.set(_,{ref:_,...T}),()=>void k.itemMap.delete(_))),u.jsx(d,{[c]:"",ref:D,children:A})});h.displayName=l;function g(b){const y=s(e+"CollectionConsumer",b);return dt.useCallback(()=>{const A=y.collectionRef.current;if(!A)return[];const T=Array.from(A.querySelectorAll(`[${c}]`));return Array.from(y.itemMap.values()).sort((k,E)=>T.indexOf(k.ref.current)-T.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,r]}var Zd=p.createContext(void 0);function Ra(e){const t=p.useContext(Zd);return e||t||"ltr"}function rt(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ef(e,t=globalThis==null?void 0:globalThis.document){const n=rt(e);p.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var tf="DismissableLayer",$r="dismissableLayer.update",nf="dismissableLayer.pointerDownOutside",rf="dismissableLayer.focusOutside",is,Ia=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(Ia),[l,c]=p.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=Ce(t,E=>c(E)),b=Array.from(f.layers),[y]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),A=l?b.indexOf(l):-1,T=f.layersWithOutsidePointerEventsDisabled.size>0,_=A>=v,D=af(E=>{const x=E.target,w=[...f.branches].some(j=>j.contains(x));!_||w||(o==null||o(E),a==null||a(E),E.defaultPrevented||i==null||i())},d),k=lf(E=>{const x=E.target;[...f.branches].some(j=>j.contains(x))||(s==null||s(E),a==null||a(E),E.defaultPrevented||i==null||i())},d);return ef(E=>{A===f.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&i&&(E.preventDefault(),i()))},d),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(is=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ls(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=is)}},[l,d,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ls())},[l,f]),p.useEffect(()=>{const E=()=>h({});return document.addEventListener($r,E),()=>document.removeEventListener($r,E)},[]),u.jsx(ge.div,{...m,ref:g,style:{pointerEvents:T?_?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,k.onFocusCapture),onBlurCapture:te(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,D.onPointerDownCapture)})});hn.displayName=tf;var of="DismissableLayerBranch",sf=p.forwardRef((e,t)=>{const n=p.useContext(Ia),r=p.useRef(null),o=Ce(t,r);return p.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(ge.div,{...e,ref:o})});sf.displayName=of;function af(e,t=globalThis==null?void 0:globalThis.document){const n=rt(e),r=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!r.current){let m=function(){Ma(nf,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=m,t.addEventListener("click",o.current,{once:!0})):m()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function lf(e,t=globalThis==null?void 0:globalThis.document){const n=rt(e),r=p.useRef(!1);return p.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ma(rf,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ls(){const e=new CustomEvent($r);document.dispatchEvent(e)}function Ma(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ja(o,s):o.dispatchEvent(s)}var xr=0;function uo(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??cs()),document.body.insertAdjacentElement("beforeend",e[1]??cs()),xr++,()=>{xr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xr--}},[])}function cs(){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 vr="focusScope.autoFocusOnMount",br="focusScope.autoFocusOnUnmount",us={bubbles:!1,cancelable:!0},cf="FocusScope",Zn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=rt(o),l=rt(s),c=p.useRef(null),d=Ce(t,b=>m(b)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let b=function(T){if(h.paused||!i)return;const _=T.target;i.contains(_)?c.current=_:ft(c.current,{select:!0})},y=function(T){if(h.paused||!i)return;const _=T.relatedTarget;_!==null&&(i.contains(_)||ft(c.current,{select:!0}))},v=function(T){if(document.activeElement===document.body)for(const D of T)D.removedNodes.length>0&&ft(i)};document.addEventListener("focusin",b),document.addEventListener("focusout",y);const A=new MutationObserver(v);return i&&A.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",y),A.disconnect()}}},[r,i,h.paused]),p.useEffect(()=>{if(i){fs.add(h);const b=document.activeElement;if(!i.contains(b)){const v=new CustomEvent(vr,us);i.addEventListener(vr,f),i.dispatchEvent(v),v.defaultPrevented||(uf(hf(Pa(i)),{select:!0}),document.activeElement===b&&ft(i))}return()=>{i.removeEventListener(vr,f),setTimeout(()=>{const v=new CustomEvent(br,us);i.addEventListener(br,l),i.dispatchEvent(v),v.defaultPrevented||ft(b??document.body,{select:!0}),i.removeEventListener(br,l),fs.remove(h)},0)}}},[i,f,l,h]);const g=p.useCallback(b=>{if(!n&&!r||h.paused)return;const y=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,v=document.activeElement;if(y&&v){const A=b.currentTarget,[T,_]=df(A);T&&_?!b.shiftKey&&v===_?(b.preventDefault(),n&&ft(T,{select:!0})):b.shiftKey&&v===T&&(b.preventDefault(),n&&ft(_,{select:!0})):v===A&&b.preventDefault()}},[n,r,h.paused]);return u.jsx(ge.div,{tabIndex:-1,...a,ref:d,onKeyDown:g})});Zn.displayName=cf;function uf(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ft(r,{select:t}),document.activeElement!==n)return}function df(e){const t=Pa(e),n=ds(t,e),r=ds(t.reverse(),e);return[n,r]}function Pa(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ds(e,t){for(const n of e)if(!ff(n,{upTo:t}))return n}function ff(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 mf(e){return e instanceof HTMLInputElement&&"select"in e}function ft(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mf(e)&&t&&e.select()}}var fs=pf();function pf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ms(e,t),e.unshift(t)},remove(t){var n;e=ms(e,t),(n=e[0])==null||n.resume()}}}function ms(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function hf(e){return e.filter(t=>t.tagName!=="A")}var gf=oo[" useId ".trim().toString()]||(()=>{}),xf=0;function Me(e){const[t,n]=p.useState(gf());return nt(()=>{n(r=>r??String(xf++))},[e]),e||(t?`radix-${t}`:"")}const vf=["top","right","bottom","left"],ht=Math.min,Le=Math.max,Un=Math.round,En=Math.floor,Qe=e=>({x:e,y:e}),bf={left:"right",right:"left",bottom:"top",top:"bottom"};function Ur(e,t,n){return Le(e,ht(t,n))}function ot(e,t){return typeof e=="function"?e(t):e}function st(e){return e.split("-")[0]}function Jt(e){return e.split("-")[1]}function fo(e){return e==="x"?"y":"x"}function mo(e){return e==="y"?"height":"width"}function Xe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function po(e){return fo(Xe(e))}function yf(e,t,n){n===void 0&&(n=!1);const r=Jt(e),o=po(e),s=mo(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=zn(a)),[a,zn(a)]}function wf(e){const t=zn(e);return[zr(e),t,zr(t)]}function zr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ps=["left","right"],hs=["right","left"],Cf=["top","bottom"],Sf=["bottom","top"];function kf(e,t,n){switch(e){case"top":case"bottom":return n?t?hs:ps:t?ps:hs;case"left":case"right":return t?Cf:Sf;default:return[]}}function _f(e,t,n,r){const o=Jt(e);let s=kf(st(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(zr)))),s}function zn(e){const t=st(e);return bf[t]+e.slice(t.length)}function Af(e){return{top:0,right:0,bottom:0,left:0,...e}}function Oa(e){return typeof e!="number"?Af(e):{top:e,right:e,bottom:e,left:e}}function Hn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function gs(e,t,n){let{reference:r,floating:o}=e;const s=Xe(t),a=po(t),i=mo(a),m=st(t),f=s==="y",l=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,d=r[i]/2-o[i]/2;let h;switch(m){case"top":h={x:l,y:r.y-o.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-o.width,y:c};break;default:h={x:r.x,y:r.y}}switch(Jt(t)){case"start":h[a]-=d*(n&&f?-1:1);break;case"end":h[a]+=d*(n&&f?-1:1);break}return h}async function Ef(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:d=!1,padding:h=0}=ot(t,e),g=Oa(h),y=i[d?c==="floating"?"reference":"floating":c],v=Hn(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:l,strategy:m})),A=c==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),_=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},D=Hn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:A,offsetParent:T,strategy:m}):A);return{top:(v.top-D.top+g.top)/_.y,bottom:(D.bottom-v.bottom+g.bottom)/_.y,left:(v.left-D.left+g.left)/_.x,right:(D.right-v.right+g.right)/_.x}}const Tf=50,jf=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:Ef},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:c}=gs(f,r,m),d=r,h=0;const g={};for(let b=0;b<s.length;b++){const y=s[b];if(!y)continue;const{name:v,fn:A}=y,{x:T,y:_,data:D,reset:k}=await A({x:l,y:c,initialPlacement:r,placement:d,strategy:o,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=T??l,c=_??c,g[v]={...g[v],...D},k&&h<Tf&&(h++,typeof k=="object"&&(k.placement&&(d=k.placement),k.rects&&(f=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:l,y:c}=gs(f,d,m)),b=-1)}return{x:l,y:c,placement:d,strategy:o,middlewareData:g}},Nf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=ot(e,t)||{};if(f==null)return{};const c=Oa(l),d={x:n,y:r},h=po(o),g=mo(h),b=await a.getDimensions(f),y=h==="y",v=y?"top":"left",A=y?"bottom":"right",T=y?"clientHeight":"clientWidth",_=s.reference[g]+s.reference[h]-d[h]-s.floating[g],D=d[h]-s.reference[h],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let E=k?k[T]:0;(!E||!await(a.isElement==null?void 0:a.isElement(k)))&&(E=i.floating[T]||s.floating[g]);const x=_/2-D/2,w=E/2-b[g]/2-1,j=ht(c[v],w),P=ht(c[A],w),O=j,F=E-b[g]-P,I=E/2-b[g]/2+x,z=Ur(O,I,F),S=!m.arrow&&Jt(o)!=null&&I!==z&&s.reference[g]/2-(I<O?j:P)-b[g]/2<0,C=S?I<O?I-O:I-F:0;return{[h]:d[h]+C,data:{[h]:z,centerOffset:I-z-C,...S&&{alignmentOffset:C}},reset:S}}}),Rf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...y}=ot(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=st(o),A=Xe(i),T=st(i)===i,_=await(m.isRTL==null?void 0:m.isRTL(f.floating)),D=d||(T||!b?[zn(i)]:wf(i)),k=g!=="none";!d&&k&&D.push(..._f(i,b,g,_));const E=[i,...D],x=await m.detectOverflow(t,y),w=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&w.push(x[v]),c){const I=yf(o,a,_);w.push(x[I[0]],x[I[1]])}if(j=[...j,{placement:o,overflows:w}],!w.every(I=>I<=0)){var P,O;const I=(((P=s.flip)==null?void 0:P.index)||0)+1,z=E[I];if(z&&(!(c==="alignment"?A!==Xe(z):!1)||j.every(H=>Xe(H.placement)===A?H.overflows[0]>0:!0)))return{data:{index:I,overflows:j},reset:{placement:z}};let S=(O=j.filter(C=>C.overflows[0]<=0).sort((C,H)=>C.overflows[1]-H.overflows[1])[0])==null?void 0:O.placement;if(!S)switch(h){case"bestFit":{var F;const C=(F=j.filter(H=>{if(k){const M=Xe(H.placement);return M===A||M==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(M=>M>0).reduce((M,U)=>M+U,0)]).sort((H,M)=>H[1]-M[1])[0])==null?void 0:F[0];C&&(S=C);break}case"initialPlacement":S=i;break}if(o!==S)return{reset:{placement:S}}}return{}}}};function xs(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vs(e){return vf.some(t=>e[t]>=0)}const If=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=ot(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),i=xs(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:vs(i)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),i=xs(a,n.floating);return{data:{escapedOffsets:i,escaped:vs(i)}}}default:return{}}}}},Da=new Set(["left","top"]);async function Mf(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=st(n),i=Jt(n),m=Xe(n)==="y",f=Da.has(a)?-1:1,l=s&&m?-1:1,c=ot(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:g}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return i&&typeof g=="number"&&(h=i==="end"?g*-1:g),m?{x:h*l,y:d*f}:{x:d*f,y:h*l}}const Pf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:i}=t,m=await Mf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:o+m.x,y:s+m.y,data:{...m,placement:a}}}}},Of=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:v=>{let{x:A,y:T}=v;return{x:A,y:T}}},...f}=ot(e,t),l={x:n,y:r},c=await s.detectOverflow(t,f),d=Xe(st(o)),h=fo(d);let g=l[h],b=l[d];if(a){const v=h==="y"?"top":"left",A=h==="y"?"bottom":"right",T=g+c[v],_=g-c[A];g=Ur(T,g,_)}if(i){const v=d==="y"?"top":"left",A=d==="y"?"bottom":"right",T=b+c[v],_=b-c[A];b=Ur(T,b,_)}const y=m.fn({...t,[h]:g,[d]:b});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:a,[d]:i}}}}}},Df=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=ot(e,t),l={x:n,y:r},c=Xe(o),d=fo(c);let h=l[d],g=l[c];const b=ot(i,t),y=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(m){const T=d==="y"?"height":"width",_=s.reference[d]-s.floating[T]+y.mainAxis,D=s.reference[d]+s.reference[T]-y.mainAxis;h<_?h=_:h>D&&(h=D)}if(f){var v,A;const T=d==="y"?"width":"height",_=Da.has(st(o)),D=s.reference[c]-s.floating[T]+(_&&((v=a.offset)==null?void 0:v[c])||0)+(_?0:y.crossAxis),k=s.reference[c]+s.reference[T]+(_?0:((A=a.offset)==null?void 0:A[c])||0)-(_?y.crossAxis:0);g<D?g=D:g>k&&(g=k)}return{[d]:h,[c]:g}}}},Lf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=ot(e,t),l=await a.detectOverflow(t,f),c=st(o),d=Jt(o),h=Xe(o)==="y",{width:g,height:b}=s.floating;let y,v;c==="top"||c==="bottom"?(y=c,v=d===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(v=c,y=d==="end"?"top":"bottom");const A=b-l.top-l.bottom,T=g-l.left-l.right,_=ht(b-l[y],A),D=ht(g-l[v],T),k=!t.middlewareData.shift;let E=_,x=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=A),k&&!d){const j=Le(l.left,0),P=Le(l.right,0),O=Le(l.top,0),F=Le(l.bottom,0);h?x=g-2*(j!==0||P!==0?j+P:Le(l.left,l.right)):E=b-2*(O!==0||F!==0?O+F:Le(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:E});const w=await a.getDimensions(i.floating);return g!==w.width||b!==w.height?{reset:{rects:!0}}:{}}}};function er(){return typeof window<"u"}function Zt(e){return La(e)?(e.nodeName||"").toLowerCase():"#document"}function Fe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ze(e){var t;return(t=(La(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function La(e){return er()?e instanceof Node||e instanceof Fe(e).Node:!1}function Be(e){return er()?e instanceof Element||e instanceof Fe(e).Element:!1}function it(e){return er()?e instanceof HTMLElement||e instanceof Fe(e).HTMLElement:!1}function bs(e){return!er()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Fe(e).ShadowRoot}function gn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=We(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Ff(e){return/^(table|td|th)$/.test(Zt(e))}function tr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $f=/transform|translate|scale|rotate|perspective|filter/,Uf=/paint|layout|strict|content/,_t=e=>!!e&&e!=="none";let yr;function ho(e){const t=Be(e)?We(e):e;return _t(t.transform)||_t(t.translate)||_t(t.scale)||_t(t.rotate)||_t(t.perspective)||!go()&&(_t(t.backdropFilter)||_t(t.filter))||$f.test(t.willChange||"")||Uf.test(t.contain||"")}function zf(e){let t=gt(e);for(;it(t)&&!qt(t);){if(ho(t))return t;if(tr(t))return null;t=gt(t)}return null}function go(){return yr==null&&(yr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),yr}function qt(e){return/^(html|body|#document)$/.test(Zt(e))}function We(e){return Fe(e).getComputedStyle(e)}function nr(e){return Be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gt(e){if(Zt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||bs(e)&&e.host||Ze(e);return bs(t)?t.host:t}function Fa(e){const t=gt(e);return qt(t)?e.ownerDocument?e.ownerDocument.body:e.body:it(t)&&gn(t)?t:Fa(t)}function ln(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Fa(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=Fe(o);if(s){const i=Hr(a);return t.concat(a,a.visualViewport||[],gn(o)?o:[],i&&n?ln(i):[])}else return t.concat(o,ln(o,[],n))}function Hr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $a(e){const t=We(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=it(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,i=Un(n)!==s||Un(r)!==a;return i&&(n=s,r=a),{width:n,height:r,$:i}}function xo(e){return Be(e)?e:e.contextElement}function Wt(e){const t=xo(e);if(!it(t))return Qe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=$a(t);let a=(s?Un(n.width):n.width)/r,i=(s?Un(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Hf=Qe(0);function Ua(e){const t=Fe(e);return!go()||!t.visualViewport?Hf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Fe(e)?!1:t}function Nt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=xo(e);let a=Qe(1);t&&(r?Be(r)&&(a=Wt(r)):a=Wt(e));const i=Bf(s,n,r)?Ua(s):Qe(0);let m=(o.left+i.x)/a.x,f=(o.top+i.y)/a.y,l=o.width/a.x,c=o.height/a.y;if(s){const d=Fe(s),h=r&&Be(r)?Fe(r):r;let g=d,b=Hr(g);for(;b&&r&&h!==g;){const y=Wt(b),v=b.getBoundingClientRect(),A=We(b),T=v.left+(b.clientLeft+parseFloat(A.paddingLeft))*y.x,_=v.top+(b.clientTop+parseFloat(A.paddingTop))*y.y;m*=y.x,f*=y.y,l*=y.x,c*=y.y,m+=T,f+=_,g=Fe(b),b=Hr(g)}}return Hn({width:l,height:c,x:m,y:f})}function rr(e,t){const n=nr(e).scrollLeft;return t?t.left+n:Nt(Ze(e)).left+n}function za(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-rr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Wf(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=Ze(r),i=t?tr(t.floating):!1;if(r===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Qe(1);const l=Qe(0),c=it(r);if((c||!c&&!s)&&((Zt(r)!=="body"||gn(a))&&(m=nr(r)),c)){const h=Nt(r);f=Wt(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}const d=a&&!c&&!s?za(a,m):Qe(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+d.x,y:n.y*f.y-m.scrollTop*f.y+l.y+d.y}}function Gf(e){return Array.from(e.getClientRects())}function Vf(e){const t=Ze(e),n=nr(e),r=e.ownerDocument.body,o=Le(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Le(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+rr(e);const i=-n.scrollTop;return We(r).direction==="rtl"&&(a+=Le(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:i}}const ys=25;function Kf(e,t){const n=Fe(e),r=Ze(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,i=0,m=0;if(o){s=o.width,a=o.height;const l=go();(!l||l&&t==="fixed")&&(i=o.offsetLeft,m=o.offsetTop)}const f=rr(r);if(f<=0){const l=r.ownerDocument,c=l.body,d=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(r.clientWidth-c.clientWidth-h);g<=ys&&(s-=g)}else f<=ys&&(s+=f);return{width:s,height:a,x:i,y:m}}function qf(e,t){const n=Nt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=it(e)?Wt(e):Qe(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=o*s.x,f=r*s.y;return{width:a,height:i,x:m,y:f}}function ws(e,t,n){let r;if(t==="viewport")r=Kf(e,n);else if(t==="document")r=Vf(Ze(e));else if(Be(t))r=qf(t,n);else{const o=Ua(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Hn(r)}function Ha(e,t){const n=gt(e);return n===t||!Be(n)||qt(n)?!1:We(n).position==="fixed"||Ha(n,t)}function Yf(e,t){const n=t.get(e);if(n)return n;let r=ln(e,[],!1).filter(i=>Be(i)&&Zt(i)!=="body"),o=null;const s=We(e).position==="fixed";let a=s?gt(e):e;for(;Be(a)&&!qt(a);){const i=We(a),m=ho(a);!m&&i.position==="fixed"&&(o=null),(s?!m&&!o:!m&&i.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||gn(a)&&!m&&Ha(e,a))?r=r.filter(l=>l!==a):o=i,a=gt(a)}return t.set(e,r),r}function Xf(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?tr(t)?[]:Yf(t,this._c):[].concat(n),r],i=ws(t,a[0],o);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let d=1;d<a.length;d++){const h=ws(t,a[d],o);m=Le(h.top,m),f=ht(h.right,f),l=ht(h.bottom,l),c=Le(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function Qf(e){const{width:t,height:n}=$a(e);return{width:t,height:n}}function Jf(e,t,n){const r=it(t),o=Ze(t),s=n==="fixed",a=Nt(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Qe(0);function f(){m.x=rr(o)}if(r||!r&&!s)if((Zt(t)!=="body"||gn(o))&&(i=nr(t)),r){const h=Nt(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else o&&f();s&&!r&&o&&f();const l=o&&!r&&!s?za(o,i):Qe(0),c=a.left+i.scrollLeft-m.x-l.x,d=a.top+i.scrollTop-m.y-l.y;return{x:c,y:d,width:a.width,height:a.height}}function wr(e){return We(e).position==="static"}function Cs(e,t){if(!it(e)||We(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ze(e)===n&&(n=n.ownerDocument.body),n}function Ba(e,t){const n=Fe(e);if(tr(e))return n;if(!it(e)){let o=gt(e);for(;o&&!qt(o);){if(Be(o)&&!wr(o))return o;o=gt(o)}return n}let r=Cs(e,t);for(;r&&Ff(r)&&wr(r);)r=Cs(r,t);return r&&qt(r)&&wr(r)&&!ho(r)?n:r||zf(e)||n}const Zf=async function(e){const t=this.getOffsetParent||Ba,n=this.getDimensions,r=await n(e.floating);return{reference:Jf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function em(e){return We(e).direction==="rtl"}const tm={convertOffsetParentRelativeRectToViewportRelativeRect:Wf,getDocumentElement:Ze,getClippingRect:Xf,getOffsetParent:Ba,getElementRects:Zf,getClientRects:Gf,getDimensions:Qf,getScale:Wt,isElement:Be,isRTL:em};function Wa(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nm(e,t){let n=null,r;const o=Ze(e);function s(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),s();const f=e.getBoundingClientRect(),{left:l,top:c,width:d,height:h}=f;if(i||t(),!d||!h)return;const g=En(c),b=En(o.clientWidth-(l+d)),y=En(o.clientHeight-(c+h)),v=En(l),T={rootMargin:-g+"px "+-b+"px "+-y+"px "+-v+"px",threshold:Le(0,ht(1,m))||1};let _=!0;function D(k){const E=k[0].intersectionRatio;if(E!==m){if(!_)return a();E?a(!1,E):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!Wa(f,e.getBoundingClientRect())&&a(),_=!1}try{n=new IntersectionObserver(D,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,T)}n.observe(e)}return a(!0),s}function rm(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,f=xo(e),l=o||s?[...f?ln(f):[],...t?ln(t):[]]:[];l.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const c=f&&i?nm(f,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(v=>{let[A]=v;A&&A.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var T;(T=h)==null||T.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,b=m?Nt(e):null;m&&y();function y(){const v=Nt(e);b&&!Wa(b,v)&&n(),b=v,g=requestAnimationFrame(y)}return n(),()=>{var v;l.forEach(A=>{o&&A.removeEventListener("scroll",n),s&&A.removeEventListener("resize",n)}),c==null||c(),(v=h)==null||v.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const om=Pf,sm=Of,am=Rf,im=Lf,lm=If,Ss=Nf,cm=Df,um=(e,t,n)=>{const r=new Map,o={platform:tm,...n},s={...o.platform,_c:r};return jf(e,t,{...o,platform:s})};var dm=typeof document<"u",fm=function(){},In=dm?p.useLayoutEffect:fm;function Bn(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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Bn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Bn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ga(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ks(e,t){const n=Ga(e);return Math.round(t*n)/n}function Cr(e){const t=p.useRef(e);return In(()=>{t.current=e}),t}function mm(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[l,c]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=p.useState(r);Bn(d,r)||h(r);const[g,b]=p.useState(null),[y,v]=p.useState(null),A=p.useCallback(H=>{H!==k.current&&(k.current=H,b(H))},[]),T=p.useCallback(H=>{H!==E.current&&(E.current=H,v(H))},[]),_=s||g,D=a||y,k=p.useRef(null),E=p.useRef(null),x=p.useRef(l),w=m!=null,j=Cr(m),P=Cr(o),O=Cr(f),F=p.useCallback(()=>{if(!k.current||!E.current)return;const H={placement:t,strategy:n,middleware:d};P.current&&(H.platform=P.current),um(k.current,E.current,H).then(M=>{const U={...M,isPositioned:O.current!==!1};I.current&&!Bn(x.current,U)&&(x.current=U,Js.flushSync(()=>{c(U)}))})},[d,t,n,P,O]);In(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(H=>({...H,isPositioned:!1})))},[f]);const I=p.useRef(!1);In(()=>(I.current=!0,()=>{I.current=!1}),[]),In(()=>{if(_&&(k.current=_),D&&(E.current=D),_&&D){if(j.current)return j.current(_,D,F);F()}},[_,D,F,j,w]);const z=p.useMemo(()=>({reference:k,floating:E,setReference:A,setFloating:T}),[A,T]),S=p.useMemo(()=>({reference:_,floating:D}),[_,D]),C=p.useMemo(()=>{const H={position:n,left:0,top:0};if(!S.floating)return H;const M=ks(S.floating,l.x),U=ks(S.floating,l.y);return i?{...H,transform:"translate("+M+"px, "+U+"px)",...Ga(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:U}},[n,i,S.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:S,floatingStyles:C}),[l,F,z,S,C])}const pm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ss({element:r.current,padding:o}).fn(n):{}:r?Ss({element:r,padding:o}).fn(n):{}}}},hm=(e,t)=>{const n=om(e);return{name:n.name,fn:n.fn,options:[e,t]}},gm=(e,t)=>{const n=sm(e);return{name:n.name,fn:n.fn,options:[e,t]}},xm=(e,t)=>({fn:cm(e).fn,options:[e,t]}),vm=(e,t)=>{const n=am(e);return{name:n.name,fn:n.fn,options:[e,t]}},bm=(e,t)=>{const n=im(e);return{name:n.name,fn:n.fn,options:[e,t]}},ym=(e,t)=>{const n=lm(e);return{name:n.name,fn:n.fn,options:[e,t]}},wm=(e,t)=>{const n=pm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Cm="Arrow",Va=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return u.jsx(ge.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Va.displayName=Cm;var Sm=Va;function km(e){const[t,n]=p.useState(void 0);return nt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[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 r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var vo="Popper",[Ka,en]=at(vo),[_m,qa]=Ka(vo),Ya=e=>{const{__scopePopper:t,children:n}=e,[r,o]=p.useState(null);return u.jsx(_m,{scope:t,anchor:r,onAnchorChange:o,children:n})};Ya.displayName=vo;var Xa="PopperAnchor",Qa=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=qa(Xa,n),a=p.useRef(null),i=Ce(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(r==null?void 0:r.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),r?null:u.jsx(ge.div,{...o,ref:i})});Qa.displayName=Xa;var bo="PopperContent",[Am,Em]=Ka(bo),Ja=p.forwardRef((e,t)=>{var G,V,K,oe,J,ne;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:g,...b}=e,y=qa(bo,n),[v,A]=p.useState(null),T=Ce(t,ie=>A(ie)),[_,D]=p.useState(null),k=km(_),E=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,w=r+(s!=="center"?"-"+s:""),j=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},P=Array.isArray(f)?f:[f],O=P.length>0,F={padding:j,boundary:P.filter(jm),altBoundary:O},{refs:I,floatingStyles:z,placement:S,isPositioned:C,middlewareData:H}=mm({strategy:"fixed",placement:w,whileElementsMounted:(...ie)=>rm(...ie,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[hm({mainAxis:o+x,alignmentAxis:a}),m&&gm({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?xm():void 0,...F}),m&&vm({...F}),bm({...F,apply:({elements:ie,rects:ve,availableWidth:ce,availableHeight:be})=>{const{width:de,height:le}=ve.reference,xe=ie.floating.style;xe.setProperty("--radix-popper-available-width",`${ce}px`),xe.setProperty("--radix-popper-available-height",`${be}px`),xe.setProperty("--radix-popper-anchor-width",`${de}px`),xe.setProperty("--radix-popper-anchor-height",`${le}px`)}}),_&&wm({element:_,padding:i}),Nm({arrowWidth:E,arrowHeight:x}),d&&ym({strategy:"referenceHidden",...F})]}),[M,U]=ti(S),q=rt(g);nt(()=>{C&&(q==null||q())},[C,q]);const R=(G=H.arrow)==null?void 0:G.x,L=(V=H.arrow)==null?void 0:V.y,$=((K=H.arrow)==null?void 0:K.centerOffset)!==0,[N,B]=p.useState();return nt(()=>{v&&B(window.getComputedStyle(v).zIndex)},[v]),u.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:C?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:N,"--radix-popper-transform-origin":[(oe=H.transformOrigin)==null?void 0:oe.x,(J=H.transformOrigin)==null?void 0:J.y].join(" "),...((ne=H.hide)==null?void 0:ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(Am,{scope:n,placedSide:M,onArrowChange:D,arrowX:R,arrowY:L,shouldHideArrow:$,children:u.jsx(ge.div,{"data-side":M,"data-align":U,...b,ref:T,style:{...b.style,animation:C?void 0:"none"}})})})});Ja.displayName=bo;var Za="PopperArrow",Tm={top:"bottom",right:"left",bottom:"top",left:"right"},ei=p.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Em(Za,r),a=Tm[s.placedSide];return u.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:u.jsx(Sm,{...o,ref:n,style:{...o.style,display:"block"}})})});ei.displayName=Za;function jm(e){return e!==null}var Nm=e=>({name:"transformOrigin",options:e,fn(t){var y,v,A;const{placement:n,rects:r,middlewareData:o}=t,a=((y=o.arrow)==null?void 0:y.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=ti(n),c={start:"0%",center:"50%",end:"100%"}[l],d=(((v=o.arrow)==null?void 0:v.x)??0)+i/2,h=(((A=o.arrow)==null?void 0:A.y)??0)+m/2;let g="",b="";return f==="bottom"?(g=a?c:`${d}px`,b=`${-m}px`):f==="top"?(g=a?c:`${d}px`,b=`${r.floating.height+m}px`):f==="right"?(g=`${-m}px`,b=a?c:`${h}px`):f==="left"&&(g=`${r.floating.width+m}px`,b=a?c:`${h}px`),{data:{x:g,y:b}}}});function ti(e){const[t,n="center"]=e.split("-");return[t,n]}var yo=Ya,or=Qa,wo=Ja,Co=ei,Rm="Portal",xn=p.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[o,s]=p.useState(!1);nt(()=>s(!0),[]);const a=n||o&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?yc.createPortal(u.jsx(ge.div,{...r,ref:t}),a):null});xn.displayName=Rm;function Im(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var $e=e=>{const{present:t,children:n}=e,r=Mm(t),o=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),s=Ce(r.ref,Pm(o));return typeof n=="function"||r.isPresent?p.cloneElement(o,{ref:s}):null};$e.displayName="Presence";function Mm(e){const[t,n]=p.useState(),r=p.useRef(null),o=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Im(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=Tn(r.current);s.current=i==="mounted"?f:"none"},[i]),nt(()=>{const f=r.current,l=o.current;if(l!==e){const d=s.current,h=Tn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&d!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,m]),nt(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const b=Tn(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&b&&(m("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},d=h=>{h.target===t&&(s.current=Tn(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Tn(e){return(e==null?void 0:e.animationName)||"none"}function Pm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Sr="rovingFocusGroup.onEntryFocus",Om={bubbles:!1,cancelable:!0},vn="RovingFocusGroup",[Br,ni,Dm]=Na(vn),[Lm,ri]=at(vn,[Dm]),[Fm,$m]=Lm(vn),oi=p.forwardRef((e,t)=>u.jsx(Br.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Br.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Um,{...e,ref:t})})}));oi.displayName=vn;var Um=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,d=p.useRef(null),h=Ce(t,d),g=Ra(s),[b,y]=pt({prop:a,defaultProp:i??null,onChange:m,caller:vn}),[v,A]=p.useState(!1),T=rt(f),_=ni(n),D=p.useRef(!1),[k,E]=p.useState(0);return p.useEffect(()=>{const x=d.current;if(x)return x.addEventListener(Sr,T),()=>x.removeEventListener(Sr,T)},[T]),u.jsx(Fm,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:b,onItemFocus:p.useCallback(x=>y(x),[y]),onItemShiftTab:p.useCallback(()=>A(!0),[]),onFocusableItemAdd:p.useCallback(()=>E(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>E(x=>x-1),[]),children:u.jsx(ge.div,{tabIndex:v||k===0?-1:0,"data-orientation":r,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{D.current=!0}),onFocus:te(e.onFocus,x=>{const w=!D.current;if(x.target===x.currentTarget&&w&&!v){const j=new CustomEvent(Sr,Om);if(x.currentTarget.dispatchEvent(j),!j.defaultPrevented){const P=_().filter(S=>S.focusable),O=P.find(S=>S.active),F=P.find(S=>S.id===b),z=[O,F,...P].filter(Boolean).map(S=>S.ref.current);ii(z,l)}}D.current=!1}),onBlur:te(e.onBlur,()=>A(!1))})})}),si="RovingFocusGroupItem",ai=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:a,...i}=e,m=Me(),f=s||m,l=$m(si,n),c=l.currentTabStopId===f,d=ni(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=l;return p.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),u.jsx(Br.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:u.jsx(ge.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,y=>{r?l.onItemFocus(f):y.preventDefault()}),onFocus:te(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:te(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){l.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=Bm(y,l.orientation,l.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let T=d().filter(_=>_.focusable).map(_=>_.ref.current);if(v==="last")T.reverse();else if(v==="prev"||v==="next"){v==="prev"&&T.reverse();const _=T.indexOf(y.currentTarget);T=l.loop?Wm(T,_+1):T.slice(_+1)}setTimeout(()=>ii(T))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:b!=null}):a})})});ai.displayName=si;var zm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Hm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Bm(e,t,n){const r=Hm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return zm[r]}function ii(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Wm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Gm=oi,Vm=ai,Km=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$t=new WeakMap,jn=new WeakMap,Nn={},kr=0,li=function(e){return e&&(e.host||li(e.parentNode))},qm=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=li(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Ym=function(e,t,n,r){var o=qm(t,Array.isArray(e)?e:[e]);Nn[n]||(Nn[n]=new WeakMap);var s=Nn[n],a=[],i=new Set,m=new Set(o),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};o.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(d){if(i.has(d))l(d);else try{var h=d.getAttribute(r),g=h!==null&&h!=="false",b=($t.get(d)||0)+1,y=(s.get(d)||0)+1;$t.set(d,b),s.set(d,y),a.push(d),b===1&&g&&jn.set(d,!0),y===1&&d.setAttribute(n,"true"),g||d.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",d,v)}})};return l(t),i.clear(),kr++,function(){a.forEach(function(c){var d=$t.get(c)-1,h=s.get(c)-1;$t.set(c,d),s.set(c,h),d||(jn.has(c)||c.removeAttribute(r),jn.delete(c)),h||c.removeAttribute(n)}),kr--,kr||($t=new WeakMap,$t=new WeakMap,jn=new WeakMap,Nn={})}},So=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Km(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Ym(r,o,n,"aria-hidden")):function(){return null}},Wr=["Enter"," "],Xm=["ArrowDown","PageUp","Home"],ci=["ArrowUp","PageDown","End"],Qm=[...Xm,...ci],Jm={ltr:[...Wr,"ArrowRight"],rtl:[...Wr,"ArrowLeft"]},Zm={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bn="Menu",[cn,ep,tp]=Na(bn),[Ot,ui]=at(bn,[tp,en,ri]),sr=en(),di=ri(),[np,Dt]=Ot(bn),[rp,yn]=Ot(bn),fi=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:a=!0}=e,i=sr(t),[m,f]=p.useState(null),l=p.useRef(!1),c=rt(s),d=Ra(o);return p.useEffect(()=>{const h=()=>{l.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>l.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),u.jsx(yo,{...i,children:u.jsx(np,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:u.jsx(rp,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:d,modal:a,children:r})})})};fi.displayName=bn;var op="MenuAnchor",ko=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=sr(n);return u.jsx(or,{...o,...r,ref:t})});ko.displayName=op;var _o="MenuPortal",[sp,mi]=Ot(_o,{forceMount:void 0}),pi=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Dt(_o,t);return u.jsx(sp,{scope:t,forceMount:n,children:u.jsx($e,{present:n||s.open,children:u.jsx(xn,{asChild:!0,container:o,children:r})})})};pi.displayName=_o;var Ue="MenuContent",[ap,Ao]=Ot(Ue),hi=p.forwardRef((e,t)=>{const n=mi(Ue,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Dt(Ue,e.__scopeMenu),a=yn(Ue,e.__scopeMenu);return u.jsx(cn.Provider,{scope:e.__scopeMenu,children:u.jsx($e,{present:r||s.open,children:u.jsx(cn.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(ip,{...o,ref:t}):u.jsx(lp,{...o,ref:t})})})})}),ip=p.forwardRef((e,t)=>{const n=Dt(Ue,e.__scopeMenu),r=p.useRef(null),o=Ce(t,r);return p.useEffect(()=>{const s=r.current;if(s)return So(s)},[]),u.jsx(Eo,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lp=p.forwardRef((e,t)=>{const n=Dt(Ue,e.__scopeMenu);return u.jsx(Eo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),cp=Kt("MenuContent.ScrollLock"),Eo=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,disableOutsideScroll:g,...b}=e,y=Dt(Ue,n),v=yn(Ue,n),A=sr(n),T=di(n),_=ep(n),[D,k]=p.useState(null),E=p.useRef(null),x=Ce(t,E,y.onContentChange),w=p.useRef(0),j=p.useRef(""),P=p.useRef(0),O=p.useRef(null),F=p.useRef("right"),I=p.useRef(0),z=g?so:p.Fragment,S=g?{as:cp,allowPinchZoom:!0}:void 0,C=M=>{var G,V;const U=j.current+M,q=_().filter(K=>!K.disabled),R=document.activeElement,L=(G=q.find(K=>K.ref.current===R))==null?void 0:G.textValue,$=q.map(K=>K.textValue),N=wp($,U,L),B=(V=q.find(K=>K.textValue===N))==null?void 0:V.ref.current;(function K(oe){j.current=oe,window.clearTimeout(w.current),oe!==""&&(w.current=window.setTimeout(()=>K(""),1e3))})(U),B&&setTimeout(()=>B.focus())};p.useEffect(()=>()=>window.clearTimeout(w.current),[]),uo();const H=p.useCallback(M=>{var q,R;return F.current===((q=O.current)==null?void 0:q.side)&&Sp(M,(R=O.current)==null?void 0:R.area)},[]);return u.jsx(ap,{scope:n,searchRef:j,onItemEnter:p.useCallback(M=>{H(M)&&M.preventDefault()},[H]),onItemLeave:p.useCallback(M=>{var U;H(M)||((U=E.current)==null||U.focus(),k(null))},[H]),onTriggerLeave:p.useCallback(M=>{H(M)&&M.preventDefault()},[H]),pointerGraceTimerRef:P,onPointerGraceIntentChange:p.useCallback(M=>{O.current=M},[]),children:u.jsx(z,{...S,children:u.jsx(Zn,{asChild:!0,trapped:o,onMountAutoFocus:te(s,M=>{var U;M.preventDefault(),(U=E.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:u.jsx(hn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,children:u.jsx(Gm,{asChild:!0,...T,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:k,onEntryFocus:te(m,M=>{v.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(wo,{role:"menu","aria-orientation":"vertical","data-state":Ri(y.open),"data-radix-menu-content":"",dir:v.dir,...A,...b,ref:x,style:{outline:"none",...b.style},onKeyDown:te(b.onKeyDown,M=>{const q=M.target.closest("[data-radix-menu-content]")===M.currentTarget,R=M.ctrlKey||M.altKey||M.metaKey,L=M.key.length===1;q&&(M.key==="Tab"&&M.preventDefault(),!R&&L&&C(M.key));const $=E.current;if(M.target!==$||!Qm.includes(M.key))return;M.preventDefault();const B=_().filter(G=>!G.disabled).map(G=>G.ref.current);ci.includes(M.key)&&B.reverse(),bp(B)}),onBlur:te(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(w.current),j.current="")}),onPointerMove:te(e.onPointerMove,un(M=>{const U=M.target,q=I.current!==M.clientX;if(M.currentTarget.contains(U)&&q){const R=M.clientX>I.current?"right":"left";F.current=R,I.current=M.clientX}}))})})})})})})});hi.displayName=Ue;var up="MenuGroup",To=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(ge.div,{role:"group",...r,ref:t})});To.displayName=up;var dp="MenuLabel",gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(ge.div,{...r,ref:t})});gi.displayName=dp;var Wn="MenuItem",_s="menu.itemSelect",ar=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=p.useRef(null),a=yn(Wn,e.__scopeMenu),i=Ao(Wn,e.__scopeMenu),m=Ce(t,s),f=p.useRef(!1),l=()=>{const c=s.current;if(!n&&c){const d=new CustomEvent(_s,{bubbles:!0,cancelable:!0});c.addEventListener(_s,h=>r==null?void 0:r(h),{once:!0}),ja(c,d),d.defaultPrevented?f.current=!1:a.onClose()}};return u.jsx(xi,{...o,ref:m,disabled:n,onClick:te(e.onClick,l),onPointerDown:c=>{var d;(d=e.onPointerDown)==null||d.call(e,c),f.current=!0},onPointerUp:te(e.onPointerUp,c=>{var d;f.current||(d=c.currentTarget)==null||d.click()}),onKeyDown:te(e.onKeyDown,c=>{const d=i.searchRef.current!=="";n||d&&c.key===" "||Wr.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});ar.displayName=Wn;var xi=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,a=Ao(Wn,n),i=di(n),m=p.useRef(null),f=Ce(t,m),[l,c]=p.useState(!1),[d,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[s.children]),u.jsx(cn.ItemSlot,{scope:n,disabled:r,textValue:o??d,children:u.jsx(Vm,{asChild:!0,...i,focusable:!r,children:u.jsx(ge.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:f,onPointerMove:te(e.onPointerMove,un(g=>{r?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(e.onPointerLeave,un(g=>a.onItemLeave(g))),onFocus:te(e.onFocus,()=>c(!0)),onBlur:te(e.onBlur,()=>c(!1))})})})}),fp="MenuCheckboxItem",vi=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return u.jsx(Si,{scope:e.__scopeMenu,checked:n,children:u.jsx(ar,{role:"menuitemcheckbox","aria-checked":Gn(n)?"mixed":n,...o,ref:t,"data-state":No(n),onSelect:te(o.onSelect,()=>r==null?void 0:r(Gn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});vi.displayName=fp;var bi="MenuRadioGroup",[mp,pp]=Ot(bi,{value:void 0,onValueChange:()=>{}}),yi=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=rt(r);return u.jsx(mp,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(To,{...o,ref:t})})});yi.displayName=bi;var wi="MenuRadioItem",Ci=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=pp(wi,e.__scopeMenu),s=n===o.value;return u.jsx(Si,{scope:e.__scopeMenu,checked:s,children:u.jsx(ar,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":No(s),onSelect:te(r.onSelect,()=>{var a;return(a=o.onValueChange)==null?void 0:a.call(o,n)},{checkForDefaultPrevented:!1})})})});Ci.displayName=wi;var jo="MenuItemIndicator",[Si,hp]=Ot(jo,{checked:!1}),ki=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=hp(jo,n);return u.jsx($e,{present:r||Gn(s.checked)||s.checked===!0,children:u.jsx(ge.span,{...o,ref:t,"data-state":No(s.checked)})})});ki.displayName=jo;var gp="MenuSeparator",_i=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(ge.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});_i.displayName=gp;var xp="MenuArrow",Ai=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=sr(n);return u.jsx(Co,{...o,...r,ref:t})});Ai.displayName=xp;var vp="MenuSub",[Bb,Ei]=Ot(vp),an="MenuSubTrigger",Ti=p.forwardRef((e,t)=>{const n=Dt(an,e.__scopeMenu),r=yn(an,e.__scopeMenu),o=Ei(an,e.__scopeMenu),s=Ao(an,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=s,f={__scopeMenu:e.__scopeMenu},l=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>l,[l]),p.useEffect(()=>{const c=i.current;return()=>{window.clearTimeout(c),m(null)}},[i,m]),u.jsx(ko,{asChild:!0,...f,children:u.jsx(xi,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Ri(n.open),...e,ref:Je(t,o.onTriggerChange),onClick:c=>{var d;(d=e.onClick)==null||d.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:te(e.onPointerMove,un(c=>{s.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:te(e.onPointerLeave,un(c=>{var h,g;l();const d=(h=n.content)==null?void 0:h.getBoundingClientRect();if(d){const b=(g=n.content)==null?void 0:g.dataset.side,y=b==="right",v=y?-5:5,A=d[y?"left":"right"],T=d[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:c.clientX+v,y:c.clientY},{x:A,y:d.top},{x:T,y:d.top},{x:T,y:d.bottom},{x:A,y:d.bottom}],side:b}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(c),c.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:te(e.onKeyDown,c=>{var h;const d=s.searchRef.current!=="";e.disabled||d&&c.key===" "||Jm[r.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});Ti.displayName=an;var ji="MenuSubContent",Ni=p.forwardRef((e,t)=>{const n=mi(Ue,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Dt(Ue,e.__scopeMenu),a=yn(Ue,e.__scopeMenu),i=Ei(ji,e.__scopeMenu),m=p.useRef(null),f=Ce(t,m);return u.jsx(cn.Provider,{scope:e.__scopeMenu,children:u.jsx($e,{present:r||s.open,children:u.jsx(cn.Slot,{scope:e.__scopeMenu,children:u.jsx(Eo,{id:i.contentId,"aria-labelledby":i.triggerId,...o,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var c;a.isUsingKeyboardRef.current&&((c=m.current)==null||c.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:te(e.onFocusOutside,l=>{l.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:te(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:te(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),d=Zm[a.dir].includes(l.key);c&&d&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Ni.displayName=ji;function Ri(e){return e?"open":"closed"}function Gn(e){return e==="indeterminate"}function No(e){return Gn(e)?"indeterminate":e?"checked":"unchecked"}function bp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function yp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function wp(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=yp(e,Math.max(s,0));o.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(o.toLowerCase()));return m!==n?m:void 0}function Cp(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>r!=d>r&&n<(c-f)*(r-l)/(d-l)+f&&(o=!o)}return o}function Sp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Cp(n,t)}function un(e){return t=>t.pointerType==="mouse"?e(t):void 0}var kp=fi,_p=ko,Ap=pi,Ep=hi,Tp=To,jp=gi,Np=ar,Rp=vi,Ip=yi,Mp=Ci,Pp=ki,Op=_i,Dp=Ai,Lp=Ti,Fp=Ni,ir="DropdownMenu",[$p]=at(ir,[ui]),Pe=ui(),[Up,Ii]=$p(ir),Mi=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Pe(t),f=p.useRef(null),[l,c]=pt({prop:o,defaultProp:s??!1,onChange:a,caller:ir});return u.jsx(Up,{scope:t,triggerId:Me(),triggerRef:f,contentId:Me(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(d=>!d),[c]),modal:i,children:u.jsx(kp,{...m,open:l,onOpenChange:c,dir:r,modal:i,children:n})})};Mi.displayName=ir;var Pi="DropdownMenuTrigger",Oi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=Ii(Pi,n),a=Pe(n);return u.jsx(_p,{asChild:!0,...a,children:u.jsx(ge.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":r?"":void 0,disabled:r,...o,ref:Je(t,s.triggerRef),onPointerDown:te(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:te(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Oi.displayName=Pi;var zp="DropdownMenuPortal",Di=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Pe(t);return u.jsx(Ap,{...r,...n})};Di.displayName=zp;var Li="DropdownMenuContent",Fi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ii(Li,n),s=Pe(n),a=p.useRef(!1);return u.jsx(Ep,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var m;a.current||(m=o.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:te(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!o.modal||l)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Fi.displayName=Li;var Hp="DropdownMenuGroup",Bp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Tp,{...o,...r,ref:t})});Bp.displayName=Hp;var Wp="DropdownMenuLabel",$i=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(jp,{...o,...r,ref:t})});$i.displayName=Wp;var Gp="DropdownMenuItem",Ui=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Np,{...o,...r,ref:t})});Ui.displayName=Gp;var Vp="DropdownMenuCheckboxItem",Kp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Rp,{...o,...r,ref:t})});Kp.displayName=Vp;var qp="DropdownMenuRadioGroup",Yp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Ip,{...o,...r,ref:t})});Yp.displayName=qp;var Xp="DropdownMenuRadioItem",Qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Mp,{...o,...r,ref:t})});Qp.displayName=Xp;var Jp="DropdownMenuItemIndicator",Zp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Pp,{...o,...r,ref:t})});Zp.displayName=Jp;var eh="DropdownMenuSeparator",zi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Op,{...o,...r,ref:t})});zi.displayName=eh;var th="DropdownMenuArrow",nh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Dp,{...o,...r,ref:t})});nh.displayName=th;var rh="DropdownMenuSubTrigger",oh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Lp,{...o,...r,ref:t})});oh.displayName=rh;var sh="DropdownMenuSubContent",ah=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Pe(n);return u.jsx(Fp,{...o,...r,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)"}})});ah.displayName=sh;var ih=Mi,lh=Oi,ch=Di,uh=Fi,dh=$i,fh=Ui,mh=zi;function Hi({...e}){return u.jsx(ih,{"data-slot":"dropdown-menu",...e})}function Bi({...e}){return u.jsx(lh,{"data-slot":"dropdown-menu-trigger",...e})}function Wi({className:e,sideOffset:t=4,...n}){return u.jsx(ch,{children:u.jsx(uh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Z("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Mn({className:e,inset:t,variant:n="default",...r}){return u.jsx(fh,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Z("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function ph({className:e,inset:t,...n}){return u.jsx(dh,{"data-slot":"dropdown-menu-label","data-inset":t,className:Z("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function As({className:e,...t}){return u.jsx(mh,{"data-slot":"dropdown-menu-separator",className:Z("bg-border -mx-1 my-1 h-px",e),...t})}const hh=[{value:"light",label:"Light",icon:u.jsx(Ca,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:u.jsx(va,{className:"h-4 w-4"})},{value:"system",label:"System",icon:u.jsx(Qu,{className:"h-4 w-4"})}];function gh(){const{theme:e,setTheme:t,resolvedTheme:n}=Nd();return u.jsxs(Hi,{children:[u.jsx(Bi,{asChild:!0,children:u.jsxs(Pt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?u.jsx(va,{className:"h-4 w-4"}):u.jsx(Ca,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),u.jsx(Wi,{align:"end",children:hh.map(r=>u.jsxs(Mn,{onClick:()=>t(r.value),className:e===r.value?"bg-accent":"",children:[r.icon,u.jsx("span",{className:"ml-2",children:r.label})]},r.value))})]})}const Es={"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.login.singleUserHint":"单用户模式:首次部署已自动创建管理员账号","auth.login.singleUserHintFooter":"本地便捷默认密码,登录后建议尽快修改","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","dialog.envEmpty":"暂无可用环境","dialog.envPersonal":"个人","dialog.envTeam":"团队","dialog.envDirectory":"目录","dialog.envSelectEnv":"选择环境","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.share":"分享会话","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.metaSession":"会话","session.metaEnvironment":"环境","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.closedSendBlocked":"会话已归档,消息未发送","session.sendFailed":"消息发送失败","session.readOnly":"只读会话,无法发送消息","session.mySessions":"我的会话","session.sharedWithMe":"共享给我的会话","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","user.settings.language":"语言","dashboard.searchPlaceholder":"搜索所有会话内容…","dashboard.searchNoResults":"没有匹配的会话","user.settings.notifications":"浏览器通知","user.settings.notificationsDesc":"会话需要审批或回合完成时通知(仅页面处于后台时)","user.settings.notificationsDenied":"通知权限已被拒绝 — 请在浏览器设置中允许","user.settings.notificationsUnsupported":"当前环境不支持通知(需要 HTTPS 或 localhost)","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","artifacts.title":"Artifacts","artifacts.subtitle":"团队共享的交互界面与报告","artifacts.new":"新建 Artifact","artifacts.empty":'还没有 Artifact。让 agent 用 artifact 工具上传,或点击"新建"从模板创建。',"artifacts.loadFailed":"加载 Artifacts 失败","artifacts.delete":"删除","artifacts.deleteFailed":"删除失败","artifacts.openInNewTab":"新窗口打开","artifacts.copyLink":"复制链接","artifacts.copied":"已复制","artifacts.expires":"过期时间","artifacts.version":"版本","artifacts.session":"会话","artifacts.updatedAt":"更新于","artifacts.viewNotFound":"Artifact 不存在或已过期","artifacts.backToGallery":"← 返回 Artifacts","artifacts.create.title":"新建 Artifact","artifacts.editArtifact":"编辑 Artifact","artifacts.edit":"编辑","artifacts.update":"保存更新","artifacts.updateFailed":"更新失败","artifacts.linkNotice":"任何持有链接的人均可访问","artifacts.create.contentRequired":"内容不能为空","artifacts.create.ttl":"有效期","artifacts.create.ttlResetNote":"保存后过期时间将按所选有效期重置","artifacts.create.preview":"实时预览","artifacts.create.template":"模板","artifacts.create.templateBlank":"空白 HTML","artifacts.create.templatePrReview":"PR 审查","artifacts.create.templateIncident":"故障排查时间线","artifacts.create.templateDashboard":"数据看板","artifacts.create.templateChecklist":"发布检查清单","artifacts.create.title.label":"标题","artifacts.create.content":"内容 (HTML 或 Markdown)","artifacts.create.submit":"创建","artifacts.create.failed":"创建失败","artifacts.templateDesc.prReview":"逐文件审查结论、评论与整体状态","artifacts.templateDesc.incident":"按时间线排查故障,标记状态与严重级别","artifacts.templateDesc.dashboard":"KPI 卡片、SVG 图表与数据表","artifacts.templateDesc.checklist":"分阶段发布检查项与进度条","artifacts.create.mode.template":"模板","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI 生成","artifacts.aiUpdate":"AI 更新","artifacts.edit.mode.html":"编辑 HTML","artifacts.edit.mode.ai":"AI 更新","artifacts.create.markdownHint":"用 Markdown 撰写,提交时自动转为带样式的 HTML 页面","artifacts.create.bindSession":"关联会话(可选)","artifacts.create.noSession":"不关联(仅自己可见)","artifacts.create.sessionHint":"关联后团队成员可通过该会话看到此 artifact","artifacts.create.ai.targetSession":"目标会话","artifacts.create.ai.brief":"需求描述","artifacts.create.ai.briefPlaceholder":"例如:一个展示本周构建成功率的看板,含趋势图与异常列表…","artifacts.create.ai.send":"发送给会话","artifacts.create.ai.sending":"发送中…","artifacts.create.ai.sessionRequired":"请选择目标会话","artifacts.create.ai.briefRequired":"请描述你需要的页面","artifacts.create.ai.sent":"需求已发送。页面生成完成后,该会话的 artifacts 提示会亮起。","artifacts.create.ai.openSession":"前往会话","artifacts.create.ai.noSessions":"没有可用会话。请先在 Code 页开启一个会话,再回来使用 AI 生成。","artifacts.create.ai.model":"模型槽位","artifacts.create.ai.modelCurrent":"当前","artifacts.create.ai.modelHint":"选择非当前模型时,会先切换目标会话的模型再发送需求","artifacts.update.ai.briefPlaceholder":"例如:把本周的数据加进去,趋势图延长到最新一周…","artifacts.update.ai.briefRequired":"请描述需要的更新","artifacts.update.ai.sent":"更新需求已发送。新版本上传后会原位替换此 Artifact,链接保持不变。","artifacts.update.ai.inPlace":"原位更新:链接不变,版本自增","artifacts.update.ai.sessionHint":"默认发送到该 Artifact 关联的会话,也可以选择其它会话","artifacts.ai.archify":"Archify 图表模板","artifacts.ai.archifyDesc":"架构 / 流程 / 时序 / 数据流 / 状态图 — 由 archify 技能生成并校验,再上传为 Artifact","artifacts.ai.archifyHint":"开启后,目标会话的 agent 将运行 archify 技能:编写 JSON 规格并校验(showcase 质量零告警),渲染为自包含交互页面后上传。若会话缺少 archify 运行时,agent 会明确说明并退回手写页面。","artifacts.ai.archifyBriefPlaceholder":"例如:一张架构图 — 请求经网关 → 认证服务 → 业务服务 → 缓存 / 数据库 的调用链…","artifacts.view.liveUpdated":"已自动更新","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},xh={"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.login.singleUserHint":"Single-user mode: an admin account was auto-created on first deployment","auth.login.singleUserHintFooter":"Local convenience default — change the password after first login","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","dialog.envEmpty":"No environments available","dialog.envPersonal":"Personal","dialog.envTeam":"Team","dialog.envDirectory":"Directory","dialog.envSelectEnv":"Select environment","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.share":"Share Session","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.metaSession":"Session","session.metaEnvironment":"Environment","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.closedSendBlocked":"Session is archived — message was not sent","session.sendFailed":"Failed to send message","session.readOnly":"Read-only session — cannot send messages","session.mySessions":"My sessions","session.sharedWithMe":"Shared with me","session.inputPlaceholder":"Type a message...","session.connectingAgent":"Connecting to agent...","session.connectionFailed":"Connection Failed","user.settings.language":"Language","dashboard.searchPlaceholder":"Search across all sessions…","dashboard.searchNoResults":"No matching sessions","user.settings.notifications":"Browser notifications","user.settings.notificationsDesc":"Notify when a session needs approval or completes a turn (only while the page is in the background)","user.settings.notificationsDenied":"Notification permission denied — allow it in your browser settings","user.settings.notificationsUnsupported":"Notifications unavailable in this context (HTTPS or localhost required)","user.settings.role":"Role","user.settings.backDashboard":"← Dashboard","artifacts.title":"Artifacts","artifacts.subtitle":"Interactive interfaces & reports shared with your team","artifacts.new":"New Artifact","artifacts.empty":"No artifacts yet. Have the agent upload one with the artifact tool, or start from a template.","artifacts.loadFailed":"Failed to load artifacts","artifacts.delete":"Delete","artifacts.deleteFailed":"Delete failed","artifacts.openInNewTab":"Open in new tab","artifacts.copyLink":"Copy link","artifacts.copied":"Copied","artifacts.expires":"Expires","artifacts.version":"Version","artifacts.session":"Session","artifacts.updatedAt":"Updated","artifacts.viewNotFound":"Artifact not found or expired","artifacts.backToGallery":"← Back to Artifacts","artifacts.create.title":"New Artifact","artifacts.editArtifact":"Edit Artifact","artifacts.edit":"Edit","artifacts.update":"Save update","artifacts.updateFailed":"Update failed","artifacts.linkNotice":"Anyone with the link can view","artifacts.create.contentRequired":"Content is required","artifacts.create.ttl":"Lifetime","artifacts.create.ttlResetNote":"Saving resets the expiry from the chosen lifetime","artifacts.create.preview":"Live preview","artifacts.create.template":"Template","artifacts.create.templateBlank":"Blank HTML","artifacts.create.templatePrReview":"PR Review","artifacts.create.templateIncident":"Incident Timeline","artifacts.create.templateDashboard":"Data Dashboard","artifacts.create.templateChecklist":"Release Checklist","artifacts.create.title.label":"Title","artifacts.create.content":"Content (HTML or Markdown)","artifacts.create.submit":"Create","artifacts.create.failed":"Create failed","artifacts.templateDesc.prReview":"Per-file review verdicts, comments & overall status","artifacts.templateDesc.incident":"Chronological investigation with severity & status markers","artifacts.templateDesc.dashboard":"KPI cards, SVG charts & data tables","artifacts.templateDesc.checklist":"Staged release checks with progress bar","artifacts.create.mode.template":"Template","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI generate","artifacts.aiUpdate":"AI update","artifacts.edit.mode.html":"Edit HTML","artifacts.edit.mode.ai":"AI update","artifacts.create.markdownHint":"Write Markdown; it is converted to a styled HTML page on submit","artifacts.create.bindSession":"Link to session (optional)","artifacts.create.noSession":"None (visible to you only)","artifacts.create.sessionHint":"Linked artifacts become visible to your team via the session","artifacts.create.ai.targetSession":"Target session","artifacts.create.ai.brief":"Describe what you need","artifacts.create.ai.briefPlaceholder":"e.g. a dashboard of this week’s build success rate, with a trend chart and failure list…","artifacts.create.ai.send":"Send to session","artifacts.create.ai.sending":"Sending…","artifacts.create.ai.sessionRequired":"Select a target session","artifacts.create.ai.briefRequired":"Describe the page you need","artifacts.create.ai.sent":"Request sent. The session’s artifacts badge will light up when the page is ready.","artifacts.create.ai.openSession":"Open session","artifacts.create.ai.noSessions":"No sessions available. Start one on the Code page first, then come back.","artifacts.create.ai.model":"Model slot","artifacts.create.ai.modelCurrent":"current","artifacts.create.ai.modelHint":"Picking a non-current model switches the target session before dispatching the brief","artifacts.update.ai.briefPlaceholder":"e.g. append this week’s data and extend the trend chart to the latest week…","artifacts.update.ai.briefRequired":"Describe the update you need","artifacts.update.ai.sent":"Update request sent. The new version will replace this artifact in place — the link stays the same.","artifacts.update.ai.inPlace":"In-place update: link stays stable, version bumps","artifacts.update.ai.sessionHint":"Defaults to the session this artifact belongs to; you can pick another one","artifacts.ai.archify":"Archify diagram template","artifacts.ai.archifyDesc":"Architecture / workflow / sequence / dataflow / lifecycle — authored and validated by the archify skill, then uploaded as an artifact","artifacts.ai.archifyHint":"When on, the agent in the target session runs the archify skill: it authors a JSON spec, validates it (showcase quality, zero warnings), renders a self-contained interactive page, and uploads it. If the archify runtime is missing, the agent reports that and falls back to a hand-authored page.","artifacts.ai.archifyBriefPlaceholder":"e.g. an architecture diagram — the request path through gateway → auth → service → cache / database…","artifacts.view.liveUpdated":"Auto-updated","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},Gi="rcs_locale";function vh(){try{const t=localStorage.getItem(Gi);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Ro=vh();const Gr=new Set;function Wb(e){Ro=e;try{localStorage.setItem(Gi,e)}catch{}Gr.forEach(t=>t())}function bh(e){return Gr.add(e),()=>{Gr.delete(e)}}function Vi(){return p.useSyncExternalStore(bh,()=>Ro)}function He(e){return Ro==="en"?xh[e]??Es[e]??e:Es[e]??e}const yh="";let Vn=null;function wh(e){Vn=e}function Gb(){return Vn}let Vr=null;function Ts(e){Vr=e}let on=null;async function Ch(){return on||(on=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{on=null}})(),on)}class _r extends Error{constructor(n,r,o){super(n);re(this,"type");re(this,"status");this.name="ApiError",this.type=r,this.status=o}}async function me(e,t,n,r){const o={"Content-Type":"application/json"};Vn&&(o.Authorization=`Bearer ${Vn}`);const s=`${yh}${t}`,a={method:e,headers:o,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(s,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!r&&await Ch())return me(e,t,n,!0);Vr&&Vr()}let m;try{m=await i.json()}catch{throw i.ok?new _r("Invalid JSON response","parse_error",i.status):new _r(i.statusText,"http_error",i.status)}if(!i.ok){const f=m;let l="unknown",c=i.statusText;throw typeof f.error=="string"?(c=f.error,l="http_error"):f.error&&typeof f.error=="object"&&(l=f.error.type||"unknown",c=f.error.message||f.error.type||i.statusText),new _r(c,l,i.status)}return m}function Vb(){return me("GET","/web/sessions")}function Kb(){return me("GET","/web/sessions/all")}function qb(e){return me("GET",`/web/sessions/${e}`)}function Yb(e){return me("GET",`/web/sessions/${e}/history`)}function Xb(e){return me("GET",`/web/sessions/${e}/models`)}function Qb(){return me("GET","/web/environments")}function Jb(e,t=20){const n=encodeURIComponent(e);return me("GET",`/web/search?q=${n}&limit=${t}`)}function Zb(e,t){return me("POST",`/web/sessions/${e}/events`,t)}function ey(e,t){return me("POST",`/web/sessions/${e}/rewind`,{target_event_id:t})}function ty(e,t){return me("POST",`/web/sessions/${e}/control`,t)}function ny(e){return me("POST",`/web/sessions/${e}/interrupt`)}function ry(e){return me("DELETE",`/web/sessions/${e}`)}function oy(e){return me("POST",`/web/sessions/${e}/clear`)}function sy(e,t){return me("PATCH",`/web/sessions/${e}`,{title:t})}function ay(e){return me("POST","/web/sessions",e)}function iy(e){return me("GET",`/web/sessions/s/${e}`)}function ly(e){return me("GET",`/web/sessions/${e}/shares`)}function cy(e,t){return me("POST",`/web/sessions/${e}/shares`,t)}function uy(e,t){return me("DELETE",`/web/sessions/${e}/shares/${t}`)}function dy(e,t){return me("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function fy(e,t){return me("DELETE",`/web/teams/${e}/environments/${t}`)}function my(e){return me("POST","/web/environments/claim",{claim_token:e})}function py(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),r=n?`?${n}`:"";return me("GET",`/web/artifacts${r}`)}function hy(e){return me("GET",`/web/artifacts/${e}`)}function gy(e){return me("POST","/web/artifacts",e)}function xy(e){return me("DELETE",`/web/artifacts/${e}`)}const Kr="rcs_active_team";function Sh(){try{return localStorage.getItem(Kr)}catch{return null}}let Ki=Sh();const qr=new Set;function kh(){for(const e of qr)e()}function _h(e){return qr.add(e),()=>qr.delete(e)}function Ah(){return Ki}function At(e){try{e?localStorage.setItem(Kr,e):localStorage.removeItem(Kr)}catch{}Ki=e,kh()}function Eh(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),o=p.useSyncExternalStore(_h,Ah,()=>null),s=p.useCallback(async()=>{r(!0);try{const f=await me("GET","/web/teams");t(f)}catch{t([])}finally{r(!1)}},[]);p.useEffect(()=>{s()},[s]);const a=e.find(f=>f.id===o)||null,i=p.useCallback(f=>{At(f)},[]),m=p.useCallback(async f=>{const l=await me("POST","/web/teams",f);return await s(),l},[s]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:s}}function Th({className:e}){Vi();const{myTeams:t,activeTeam:n,switchTeam:r,isLoading:o}=Eh();return o||t.length===0?null:u.jsxs("div",{className:Z("relative",e),children:[u.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-2 px-3 py-1.5 pr-7 text-sm text-text-primary hover:bg-surface-3 transition-colors cursor-pointer",value:(n==null?void 0:n.id)||"",onChange:s=>{const a=s.target.value;r(a||null)},children:[u.jsx("option",{value:"",children:He("team.switcher.personal")}),t.map(s=>u.jsx("option",{value:s.id,children:s.name},s.id))]}),u.jsx(Qt,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted pointer-events-none"})]})}const qi=p.createContext(null);function Yi(){const e=p.useContext(qi);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Ut(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function jh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function Nh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).singleUser===!0:!1}catch{return!1}}async function Rn(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function Rh({children:e}){const[t,n]=p.useState(null),[r,o]=p.useState(!0),[s,a]=p.useState(!0),[i,m]=p.useState(!1);p.useEffect(()=>{let y=!1;return Ut().then(v=>{y||(n(v),o(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(v=>v.json()).then(v=>{y||a(v.allowed===!0)}).catch(()=>{}),Nh().then(v=>{y||m(v)}),Ts(()=>{n(null),At(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{y=!0,Ts(null)}},[]);const f=p.useCallback(async(y,v)=>{const A=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y,password:v})});if(!A.ok){const _=await Rn(A);throw new Error(_.error||"Login failed")}const T=await Ut();n(T),At(null)},[]),l=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),At(null)},[]),c=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const v=await Ut();return n(v),!0}catch{return!1}},[]),d=p.useCallback(async(y,v,A)=>{const T=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:y,username:v,password:A})});if(!T.ok){const D=await Rn(T);throw new Error(D.error||"Setup failed")}const _=await Ut();n(_),At(null)},[]),h=p.useCallback(async(y,v,A)=>{const T=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:y,username:v,password:A})});if(!T.ok){const D=await Rn(T);throw new Error(D.error||"Join failed")}const _=await Ut();n(_),At(null)},[]),g=p.useCallback(async(y,v)=>{const A=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y,password:v})});if(!A.ok){const _=await Rn(A);throw new Error(_.error||"Registration failed")}const T=await Ut();n(T),At(null)},[]),b=p.useCallback(async()=>jh(),[]);return u.jsx(qi.Provider,{value:{user:t,isLoading:r,login:f,logout:l,refresh:c,setup:d,join:h,register:g,checkSetupStatus:b,registrationAllowed:s,singleUserMode:i},children:e})}function Ih({onSettingsClick:e}){const{user:t,logout:n}=Yi();if(!t)return null;const r=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return u.jsxs(Hi,{children:[u.jsx(Bi,{asChild:!0,children:u.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-primary hover:bg-surface-2 transition-colors",title:t.username,children:[u.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand",children:u.jsx(Sa,{className:"h-3.5 w-3.5"})}),u.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),u.jsxs(Wi,{align:"end",className:"w-48",children:[u.jsx(ph,{children:u.jsxs("div",{className:"flex flex-col space-y-0.5",children:[u.jsx("span",{className:"text-sm font-medium",children:t.username}),u.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),u.jsx(As,{}),u.jsxs(Mn,{onClick:e,children:[u.jsx(fd,{className:"mr-2 h-4 w-4"}),He("user.menu.settings")]}),u.jsxs(Mn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[u.jsx(Td,{className:"mr-2 h-4 w-4"}),He("team.menu.myTeams")]}),u.jsx(As,{}),u.jsxs(Mn,{onClick:r,children:[u.jsx(Ku,{className:"mr-2 h-4 w-4"}),He("user.menu.logout")]})]})]})}function Mh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:r,onNavigateArtifacts:o}){return Vi(),u.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:u.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[!e&&u.jsx(Th,{}),e?u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[u.jsx(ju,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:He("nav.dashboard")})]}),u.jsx("span",{className:"text-text-muted/40",children:"/"}),u.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&u.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):u.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:u.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"var(--color-brand)"})}),u.jsx("span",{className:"hidden sm:inline",children:He("nav.remoteControl")})]})]}),u.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!e&&u.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:He("nav.dashboard"),children:[u.jsx(Wu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:He("nav.dashboard")})]}),o&&u.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary transition-colors",title:He("artifacts.title"),children:[u.jsx(Fu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:He("artifacts.title")})]}),u.jsx(gh,{}),u.jsx(Ih,{onSettingsClick:r??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function vy({status:e}){const t={active:"bg-status-active/20 text-status-active",running:"bg-status-running/20 text-status-running",idle:"bg-status-idle/20 text-status-idle",inactive:"bg-text-muted/20 text-text-muted",requires_action:"bg-status-warning/20 text-status-warning",archived:"bg-text-muted/20 text-text-muted",error:"bg-status-error/20 text-status-error"};return u.jsx("span",{className:Z("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t[e]||"bg-surface-3 text-text-secondary"),children:e})}function Ph(e){const t=new TextEncoder().encode(e);let n="";for(const o of t)n+=String.fromCharCode(o);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Xi extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const mt=class mt{constructor(t){re(this,"ws",null);re(this,"settings");re(this,"connectionState","disconnected");re(this,"sessionId",null);re(this,"_agentCapabilities",null);re(this,"_promptCapabilities",null);re(this,"_modelState",null);re(this,"_availableCommands",[]);re(this,"_usage",null);re(this,"_currentModeId",null);re(this,"_configOptions",[]);re(this,"onModelChanged",new Set);re(this,"onModelStateChanged",new Set);re(this,"onUsageChanged",new Set);re(this,"onCurrentModeChanged",new Set);re(this,"onConfigOptionsChanged",new Set);re(this,"onAvailableCommandsChanged",null);re(this,"onSessionLoaded",null);re(this,"onSessionSwitching",null);re(this,"onConnectionStateChange",new Set);re(this,"onSessionUpdate",null);re(this,"onSessionCreated",null);re(this,"onPromptComplete",null);re(this,"onPermissionRequest",null);re(this,"onBrowserToolCall",null);re(this,"onErrorMessage",null);re(this,"onSessionDeleted",null);re(this,"onSessionRenamed",null);re(this,"pendingSessionList",null);re(this,"pendingSessionLoad",null);re(this,"pendingSessionResume",null);re(this,"pendingSessionTarget",null);re(this,"connectResolve",null);re(this,"connectReject",null);re(this,"heartbeatInterval",null);re(this,"heartbeatTimeout",null);re(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setUsageChangedHandler(t){this.onUsageChanged.add(t),t(this._usage)}removeUsageChangedHandler(t){this.onUsageChanged.delete(t)}setCurrentModeChangedHandler(t){this.onCurrentModeChanged.add(t),t(this._currentModeId)}removeCurrentModeChangedHandler(t){this.onCurrentModeChanged.delete(t)}setConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.add(t),t(this._configOptions)}removeConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const r of this.onConnectionStateChange)r(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.resume)!==null}get supportsSessionList(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.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 r=new WebSocket(this.settings.proxyUrl,this.settings.token?[Ph(this.settings.token)]:void 0);this.ws=r,r.onopen=()=>{if(this.ws!==r){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),r.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},r.onmessage=o=>{if(this.ws===r)try{const s=JSON.parse(o.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},r.onerror=()=>{var o;this.ws===r&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(o=this.connectReject)==null||o.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},r.onclose=o=>{if(this.ws===r){if(console.log("[ACPClient] WebSocket closed",o.code,o.reason),this.connectReject){const s=o.reason||`Connection closed (code: ${o.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(r){this.setState("error",r.message),n(r)}})}handleResponse(t){var n,r,o,s,a,i,m,f,l,c,d,h,g;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const b=((r=t.payload)==null?void 0:r.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(b)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(b)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(b)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(b)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",b),(o=this.onErrorMessage)==null||o.call(this,b));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 v of this.onModelStateChanged)v(this._modelState);this.resetSessionUsageState();break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);this.resetSessionUsageState();break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);this.resetSessionUsageState();break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const y=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(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"),(c=this.onAvailableCommandsChanged)==null||c.call(this,this._availableCommands);else if(y==="usage_update"){this._usage=t.payload.update;for(const v of this.onUsageChanged)v(this._usage)}else if(y==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const v of this.onCurrentModeChanged)v(this._currentModeId)}else if(y==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const v of this.onConfigOptionsChanged)v(this._configOptions)}(d=this.onSessionUpdate)==null||d.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(g=this.onPermissionRequest)==null||g.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const v of this.onModelChanged)v(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}resetSessionUsageState(){this._usage=null,this._currentModeId=null,this._configOptions=[];for(const t of this.onUsageChanged)t(null);for(const t of this.onCurrentModeChanged)t(null);for(const t of this.onConfigOptionsChanged)t([])}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const r=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:r})}catch(r){console.error("[ACPClient] Browser tool error:",r),this.send({type:"browser_tool_result",callId:t,result:{error:r.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>=mt.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"))},mt.PONG_TIMEOUT_MS)},mt.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 r=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:r,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 r=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:r}})}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,r)=>{const o=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,r(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:r,timer:o};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(o),this.pendingSessionList=null,r(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:r,timer:o};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,r(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:r,timer:o};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionResume=null,r(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Xi),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 r of this.onModelStateChanged)r(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};re(mt,"HEARTBEAT_INTERVAL_MS",3e4),re(mt,"PONG_TIMEOUT_MS",1e4),re(mt,"MAX_MISSED_PONGS",2);let Yr=mt;function Oh(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function Qi(e,t){return new Promise((function(n,r){let o;return Dh(e).then((function(s){try{return o=s,n(new Blob([t.slice(0,2),o,t.slice(2)],{type:"image/jpeg"}))}catch(a){return r(a)}}),r)}))}const Dh=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:o}})=>{const s=new DataView(o);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const m=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const f=a+10;let l;switch(s.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=s.getUint32(f+4,l),d=f+c+2+12*s.getUint16(f+c,l);for(let h=f+c+2;h<d;h+=12)if(s.getUint16(h,l)==274){if(s.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,l);break}return t(o.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),r.readAsArrayBuffer(e)}));var Kn={},Lh={get exports(){return Kn},set exports(e){Kn=e}};(function(e){var t,n,r={};Lh.exports=r,r.parse=function(o,s){for(var a=r.bin.readUshort,i=r.bin.readUint,m=0,f={},l=new Uint8Array(o),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var d=a(l,m+=4);a(l,m+=2);var h=i(l,m+=2),g=i(l,m+=4);m+=4,m=g;for(var b=0;b<d;b++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var y=i(l,m+=4),v=a(l,m+=4),A=a(l,m+2),T=a(l,m+4);m+=6;var _=i(l,m+=8);m+=4,m+=v+A+T,r._readLocal(l,_,f,h,y,s)}return f},r._readLocal=function(o,s,a,i,m,f){var l=r.bin.readUshort,c=r.bin.readUint;c(o,s),l(o,s+=4),l(o,s+=2);var d=l(o,s+=2);c(o,s+=2),c(o,s+=4),s+=4;var h=l(o,s+=8),g=l(o,s+=2);s+=2;var b=r.bin.readUTF8(o,s,h);if(s+=h,s+=g,f)a[b]={size:m,csize:i};else{var y=new Uint8Array(o.buffer,s);if(d==0)a[b]=new Uint8Array(y.buffer.slice(s,s+i));else{if(d!=8)throw"unknown compression method: "+d;var v=new Uint8Array(m);r.inflateRaw(y,v),a[b]=v}}},r.inflateRaw=function(o,s){return r.F.inflate(o,s)},r.inflate=function(o,s){return o[0],o[1],r.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),s)},r.deflate=function(o,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*o.length));i[a]=120,i[a+1]=156,a+=2,a=r.F.deflateRaw(o,i,a,s.level);var m=r.adler(o,0,o.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)},r.deflateRaw=function(o,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*o.length)),i=r.F.deflateRaw(o,a,i,s.level);return new Uint8Array(a.buffer,0,i)},r.encode=function(o,s){s==null&&(s=!1);var a=0,i=r.bin.writeUint,m=r.bin.writeUshort,f={};for(var l in o){var c=!r._noNeed(l)&&!s,d=o[l],h=r.crc.crc(d,0,d.length);f[l]={cpr:c,usize:d.length,crc:h,file:c?r.deflateRaw(d):d}}for(var l in f)a+=f[l].file.length+30+46+2*r.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),b=0,y=[];for(var l in f){var v=f[l];y.push(b),b=r._writeHeader(g,b,l,v,0)}var A=0,T=b;for(var l in f)v=f[l],y.push(b),b=r._writeHeader(g,b,l,v,1,y[A++]);var _=b-T;return i(g,b,101010256),b+=4,m(g,b+=4,A),m(g,b+=2,A),i(g,b+=2,_),i(g,b+=4,T),b+=4,b+=2,g.buffer},r._noNeed=function(o){var s=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},r._writeHeader=function(o,s,a,i,m,f){var l=r.bin.writeUint,c=r.bin.writeUshort,d=i.file;return l(o,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),c(o,s,20),c(o,s+=2,0),c(o,s+=2,i.cpr?8:0),l(o,s+=2,0),l(o,s+=4,i.crc),l(o,s+=4,d.length),l(o,s+=4,i.usize),c(o,s+=4,r.bin.sizeUTF8(a)),c(o,s+=2,0),s+=2,m==1&&(s+=2,s+=2,l(o,s+=6,f),s+=4),s+=r.bin.writeUTF8(o,s,a),m==0&&(o.set(d,s),s+=d.length),s},r.crc={table:(function(){for(var o=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;o[s]=a}return o})(),update:function(o,s,a,i){for(var m=0;m<i;m++)o=r.crc.table[255&(o^s[a+m])]^o>>>8;return o},crc:function(o,s,a){return 4294967295^r.crc.update(4294967295,o,s,a)}},r.adler=function(o,s,a){for(var i=1,m=0,f=s,l=s+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=o[f++];i%=65521,m%=65521}return m<<16|i},r.bin={readUshort:function(o,s){return o[s]|o[s+1]<<8},writeUshort:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255},readUint:function(o,s){return 16777216*o[s+3]+(o[s+2]<<16|o[s+1]<<8|o[s])},writeUint:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255,o[s+2]=a>>16&255,o[s+3]=a>>24&255},readASCII:function(o,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(o[s+m]);return i},writeASCII:function(o,s,a){for(var i=0;i<a.length;i++)o[s+i]=a.charCodeAt(i)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+r.bin.pad(o[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return r.bin.readASCII(o,s,a)}return i},writeUTF8:function(o,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)o[s+m]=l,m++;else if((4294965248&l)==0)o[s+m]=192|l>>6,o[s+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)o[s+m]=224|l>>12,o[s+m+1]=128|l>>6&63,o[s+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";o[s+m]=240|l>>18,o[s+m+1]=128|l>>12&63,o[s+m+2]=128|l>>6&63,o[s+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(o){for(var s=o.length,a=0,i=0;i<s;i++){var m=o.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}},r.F={},r.F.deflateRaw=function(o,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=r.F.U,l=r.F._goodIndex;r.F._hash;var c=r.F._putsE,d=0,h=a<<3,g=0,b=o.length;if(i==0){for(;d<b;)c(s,h,d+(P=Math.min(65535,b-d))==b?1:0),h=r.F._copyExact(o,d,P,s,h+8),d+=P;return h>>>3}var y=f.lits,v=f.strt,A=f.prev,T=0,_=0,D=0,k=0,E=0,x=0;for(b>2&&(v[x=r.F._hash(o,0)]=0),d=0;d<b;d++){if(E=x,d+1<b-2){x=r.F._hash(o,d+1);var w=d+1&32767;A[w]=v[x],v[x]=w}if(g<=d){(T>14e3||_>26697)&&b-d>100&&(g<d&&(y[T]=d-g,T+=2,g=d),h=r.F._writeBlock(d==b-1||g==b?1:0,y,T,k,o,D,d-D,s,h),T=_=k=0,D=d);var j=0;d<b-2&&(j=r.F._bestMatch(o,d,A,E,Math.min(m[2],b-d),m[3]));var P=j>>>16,O=65535&j;if(j!=0){O=65535&j;var F=l(P=j>>>16,f.of0);f.lhst[257+F]++;var I=l(O,f.df0);f.dhst[I]++,k+=f.exb[F]+f.dxb[I],y[T]=P<<23|d-g,y[T+1]=O<<16|F<<8|I,T+=2,g=d+P}else f.lhst[o[d]]++;_++}}for(D==d&&o.length!=0||(g<d&&(y[T]=d-g,T+=2,g=d),h=r.F._writeBlock(1,y,T,k,o,D,d-D,s,h),T=0,_=0,T=_=k=0,D=d);(7&h)!=0;)h++;return h>>>3},r.F._bestMatch=function(o,s,a,i,m,f){var l=32767&s,c=a[l],d=l-c+32768&32767;if(c==l||i!=r.F._hash(o,s-d))return 0;for(var h=0,g=0,b=Math.min(32767,s);d<=b&&--f!=0&&c!=l;){if(h==0||o[s+h]==o[s+h-d]){var y=r.F._howLong(o,s,d);if(y>h){if(g=d,(h=y)>=m)break;d+2<y&&(y=d+2);for(var v=0,A=0;A<y-2;A++){var T=s-d+A+32768&32767,_=T-a[T]+32768&32767;_>v&&(v=_,c=T)}}}d+=(l=c)-(c=a[l])+32768&32767}return h<<16|g},r.F._howLong=function(o,s,a){if(o[s]!=o[s-a]||o[s+1]!=o[s+1-a]||o[s+2]!=o[s+2-a])return 0;var i=s,m=Math.min(o.length,s+258);for(s+=3;s<m&&o[s]==o[s-a];)s++;return s-i},r.F._hash=function(o,s){return(o[s]<<8|o[s+1])+(o[s+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(o,s,a,i,m,f,l,c,d){var h,g,b,y,v,A,T,_,D,k=r.F.U,E=r.F._putsF,x=r.F._putsE;k.lhst[256]++,g=(h=r.F.getTrees())[0],b=h[1],y=h[2],v=h[3],A=h[4],T=h[5],_=h[6],D=h[7];var w=32+((d+3&7)==0?0:8-(d+3&7))+(l<<3),j=i+r.F.contSize(k.fltree,k.lhst)+r.F.contSize(k.fdtree,k.dhst),P=i+r.F.contSize(k.ltree,k.lhst)+r.F.contSize(k.dtree,k.dhst);P+=14+3*T+r.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var O=0;O<286;O++)k.lhst[O]=0;for(O=0;O<30;O++)k.dhst[O]=0;for(O=0;O<19;O++)k.ihst[O]=0;var F=w<j&&w<P?0:j<P?1:2;if(E(c,d,o),E(c,d+1,F),d+=3,F==0){for(;(7&d)!=0;)d++;d=r.F._copyExact(m,f,l,c,d)}else{var I,z;if(F==1&&(I=k.fltree,z=k.fdtree),F==2){r.F.makeCodes(k.ltree,g),r.F.revCodes(k.ltree,g),r.F.makeCodes(k.dtree,b),r.F.revCodes(k.dtree,b),r.F.makeCodes(k.itree,y),r.F.revCodes(k.itree,y),I=k.ltree,z=k.dtree,x(c,d,v-257),x(c,d+=5,A-1),x(c,d+=5,T-4),d+=4;for(var S=0;S<T;S++)x(c,d+3*S,k.itree[1+(k.ordr[S]<<1)]);d+=3*T,d=r.F._codeTiny(_,k.itree,c,d),d=r.F._codeTiny(D,k.itree,c,d)}for(var C=f,H=0;H<a;H+=2){for(var M=s[H],U=M>>>23,q=C+(8388607&M);C<q;)d=r.F._writeLit(m[C++],I,c,d);if(U!=0){var R=s[H+1],L=R>>16,$=R>>8&255,N=255&R;x(c,d=r.F._writeLit(257+$,I,c,d),U-k.of0[$]),d+=k.exb[$],E(c,d=r.F._writeLit(N,z,c,d),L-k.df0[N]),d+=k.dxb[N],C+=U}}d=r.F._writeLit(256,I,c,d)}return d},r.F._copyExact=function(o,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(o.buffer,s,a),f),m+(a+4<<3)},r.F.getTrees=function(){for(var o=r.F.U,s=r.F._hufTree(o.lhst,o.ltree,15),a=r.F._hufTree(o.dhst,o.dtree,15),i=[],m=r.F._lenCodes(o.ltree,i),f=[],l=r.F._lenCodes(o.dtree,f),c=0;c<i.length;c+=2)o.ihst[i[c]]++;for(c=0;c<f.length;c+=2)o.ihst[f[c]]++;for(var d=r.F._hufTree(o.ihst,o.itree,7),h=19;h>4&&o.itree[1+(o.ordr[h-1]<<1)]==0;)h--;return[s,a,d,m,l,h,i,f]},r.F.getSecond=function(o){for(var s=[],a=0;a<o.length;a+=2)s.push(o[a+1]);return s},r.F.nonZero=function(o){for(var s="",a=0;a<o.length;a+=2)o[a+1]!=0&&(s+=(a>>1)+",");return s},r.F.contSize=function(o,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*o[1+(i<<1)];return a},r.F._codeTiny=function(o,s,a,i){for(var m=0;m<o.length;m+=2){var f=o[m],l=o[m+1];i=r.F._writeLit(f,s,a,i);var c=f==16?2:f==17?3:7;f>15&&(r.F._putsE(a,i,l,c),i+=c)}return i},r.F._lenCodes=function(o,s){for(var a=o.length;a!=2&&o[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=o[i+1],f=i+3<a?o[i+3]:-1,l=i+5<a?o[i+5]:-1,c=i==0?-1:o[i-1];if(m==0&&f==m&&l==m){for(var d=i+5;d+2<a&&o[d+2]==m;)d+=2;(h=Math.min(d+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(d=i+5;d+2<a&&o[d+2]==m;)d+=2;var h=Math.min(d+1-i>>>1,6);s.push(16,h-3),i+=2*h-2}else s.push(m,0)}return a>>>1},r.F._hufTree=function(o,s,a){var i=[],m=o.length,f=s.length,l=0;for(l=0;l<f;l+=2)s[l]=0,s[l+1]=0;for(l=0;l<m;l++)o[l]!=0&&i.push({lit:l,f:o[l]});var c=i.length,d=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return d=h==0?1:0,s[1+(h<<1)]=1,s[1+(d<<1)]=1,1}i.sort((function(_,D){return _.f-D.f}));var g=i[0],b=i[1],y=0,v=1,A=2;for(i[0]={lit:-1,f:g.f+b.f,l:g,r:b,d:0};v!=c-1;)g=y!=v&&(A==c||i[y].f<i[A].f)?i[y++]:i[A++],b=y!=v&&(A==c||i[y].f<i[A].f)?i[y++]:i[A++],i[v++]={lit:-1,f:g.f+b.f,l:g,r:b};var T=r.F.setDepth(i[v-1],0);for(T>a&&(r.F.restrictDepth(d,a,T),T=a),l=0;l<c;l++)s[1+(d[l].lit<<1)]=d[l].d;return T},r.F.setDepth=function(o,s){return o.lit!=-1?(o.d=s,s):Math.max(r.F.setDepth(o.l,s+1),r.F.setDepth(o.r,s+1))},r.F.restrictDepth=function(o,s,a){var i=0,m=1<<a-s,f=0;for(o.sort((function(c,d){return d.d==c.d?c.f-d.f:d.d-c.d})),i=0;i<o.length&&o[i].d>s;i++){var l=o[i].d;o[i].d=s,f+=m-(1<<a-l)}for(f>>>=a-s;f>0;)(l=o[i].d)<s?(o[i].d++,f-=1<<s-l-1):i++;for(;i>=0;i--)o[i].d==s&&f<0&&(o[i].d--,f++);f!=0&&console.log("debt left")},r.F._goodIndex=function(o,s){var a=0;return s[16|a]<=o&&(a|=16),s[8|a]<=o&&(a|=8),s[4|a]<=o&&(a|=4),s[2|a]<=o&&(a|=2),s[1|a]<=o&&(a|=1),a},r.F._writeLit=function(o,s,a,i){return r.F._putsF(a,i,s[o<<1]),i+s[1+(o<<1)]},r.F.inflate=function(o,s){var a=Uint8Array;if(o[0]==3&&o[1]==0)return s||new a(0);var i=r.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,d=i.codes2map,h=i._get17,g=i.U,b=s==null;b&&(s=new a(o.length>>>2<<3));for(var y,v,A=0,T=0,_=0,D=0,k=0,E=0,x=0,w=0,j=0;A==0;)if(A=m(o,j,1),T=m(o,j+1,2),j+=3,T!=0){if(b&&(s=r.F._check(s,w+(1<<17))),T==1&&(y=g.flmap,v=g.fdmap,E=511,x=31),T==2){_=f(o,j,5)+257,D=f(o,j+5,5)+1,k=f(o,j+10,4)+4,j+=14;for(var P=0;P<38;P+=2)g.itree[P]=0,g.itree[P+1]=0;var O=1;for(P=0;P<k;P++){var F=f(o,j+3*P,3);g.itree[1+(g.ordr[P]<<1)]=F,F>O&&(O=F)}j+=3*k,c(g.itree,O),d(g.itree,O,g.imap),y=g.lmap,v=g.dmap,j=l(g.imap,(1<<O)-1,_+D,o,j,g.ttree);var I=i._copyOut(g.ttree,0,_,g.ltree);E=(1<<I)-1;var z=i._copyOut(g.ttree,_,D,g.dtree);x=(1<<z)-1,c(g.ltree,I),d(g.ltree,I,y),c(g.dtree,z),d(g.dtree,z,v)}for(;;){var S=y[h(o,j)&E];j+=15&S;var C=S>>>4;if(!(C>>>8))s[w++]=C;else{if(C==256)break;var H=w+C-254;if(C>264){var M=g.ldef[C-257];H=w+(M>>>3)+f(o,j,7&M),j+=7&M}var U=v[h(o,j)&x];j+=15&U;var q=U>>>4,R=g.ddef[q],L=(R>>>4)+m(o,j,15&R);for(j+=15&R,b&&(s=r.F._check(s,w+(1<<17)));w<H;)s[w]=s[w++-L],s[w]=s[w++-L],s[w]=s[w++-L],s[w]=s[w++-L];w=H}}}else{(7&j)!=0&&(j+=8-(7&j));var $=4+(j>>>3),N=o[$-4]|o[$-3]<<8;b&&(s=r.F._check(s,w+N)),s.set(new a(o.buffer,o.byteOffset+$,N),w),j=$+N<<3,w+=N}return s.length==w?s:s.slice(0,w)},r.F._check=function(o,s){var a=o.length;if(s<=a)return o;var i=new Uint8Array(Math.max(a<<1,s));return i.set(o,0),i},r.F._decodeTiny=function(o,s,a,i,m,f){for(var l=r.F._bitsE,c=r.F._get17,d=0;d<a;){var h=o[c(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[d]=g,d++;else{var b=0,y=0;g==16?(y=3+l(i,m,2),m+=2,b=f[d-1]):g==17?(y=3+l(i,m,3),m+=3):g==18&&(y=11+l(i,m,7),m+=7);for(var v=d+y;d<v;)f[d]=b,d++}}return m},r.F._copyOut=function(o,s,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=o[f+s];i[f<<1]=0,i[1+(f<<1)]=c,c>m&&(m=c),f++}for(;f<l;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},r.F.makeCodes=function(o,s){for(var a,i,m,f,l=r.F.U,c=o.length,d=l.bl_count,h=0;h<=s;h++)d[h]=0;for(h=1;h<c;h+=2)d[o[h]]++;var g=l.next_code;for(a=0,d[0]=0,i=1;i<=s;i++)a=a+d[i-1]<<1,g[i]=a;for(m=0;m<c;m+=2)(f=o[m+1])!=0&&(o[m]=g[f],g[f]++)},r.F.codes2map=function(o,s,a){for(var i=o.length,m=r.F.U.rev15,f=0;f<i;f+=2)if(o[f+1]!=0)for(var l=f>>1,c=o[f+1],d=l<<4|c,h=s-c,g=o[f]<<h,b=g+(1<<h);g!=b;)a[m[g]>>>15-s]=d,g++},r.F.revCodes=function(o,s){for(var a=r.F.U.rev15,i=15-s,m=0;m<o.length;m+=2){var f=o[m]<<s-o[m+1];o[m]=a[f]>>>i}},r.F._putsE=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8},r.F._putsF=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8,o[i+2]|=a>>>16},r.F._bitsE=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},r.F._bitsF=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},r.F._get17=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)},r.F._get25=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16|o[3+(s>>>3)]<<24)>>>(7&s)},r.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 o=r.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,o.rev15[s]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(s=0;s<32;s++)o.ldef[s]=o.of0[s]<<3|o.exb[s],o.ddef[s]=o.df0[s]<<4|o.dxb[s];i(o.fltree,144,8),i(o.fltree,112,9),i(o.fltree,24,7),i(o.fltree,8,8),r.F.makeCodes(o.fltree,9),r.F.codes2map(o.fltree,9,o.flmap),r.F.revCodes(o.fltree,9),i(o.fdtree,32,5),r.F.makeCodes(o.fdtree,5),r.F.codes2map(o.fdtree,5,o.fdmap),r.F.revCodes(o.fdtree,5),i(o.itree,19,0),i(o.ltree,286,0),i(o.dtree,30,0),i(o.ttree,320,0)})()})();var Fh=Oh({__proto__:null,default:Kn},[Kn]);const ze=(function(){var e={nextZero(l,c){for(;l[c]!=0;)c++;return c},readUshort:(l,c)=>l[c]<<8|l[c+1],writeUshort(l,c,d){l[c]=d>>8&255,l[c+1]=255&d},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,d){l[c]=d>>24&255,l[c+1]=d>>16&255,l[c+2]=d>>8&255,l[c+3]=255&d},readASCII(l,c,d){let h="";for(let g=0;g<d;g++)h+=String.fromCharCode(l[c+g]);return h},writeASCII(l,c,d){for(let h=0;h<d.length;h++)l[c+h]=d.charCodeAt(h)},readBytes(l,c,d){const h=[];for(let g=0;g<d;g++)h.push(l[c+g]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,d){let h,g="";for(let b=0;b<d;b++)g+=`%${e.pad(l[c+b].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(l,c,d)}return h}};function t(l,c,d,h){const g=c*d,b=s(h),y=Math.ceil(c*b/8),v=new Uint8Array(4*g),A=new Uint32Array(v.buffer),{ctype:T}=h,{depth:_}=h,D=e.readUshort;if(T==6){const M=g<<2;if(_==8)for(var k=0;k<M;k+=4)v[k]=l[k],v[k+1]=l[k+1],v[k+2]=l[k+2],v[k+3]=l[k+3];if(_==16)for(k=0;k<M;k++)v[k]=l[k<<1]}else if(T==2){const M=h.tabs.tRNS;if(M==null){if(_==8)for(k=0;k<g;k++){var E=3*k;A[k]=255<<24|l[E+2]<<16|l[E+1]<<8|l[E]}if(_==16)for(k=0;k<g;k++)E=6*k,A[k]=255<<24|l[E+4]<<16|l[E+2]<<8|l[E]}else{var x=M[0];const U=M[1],q=M[2];if(_==8)for(k=0;k<g;k++){var w=k<<2;E=3*k,A[k]=255<<24|l[E+2]<<16|l[E+1]<<8|l[E],l[E]==x&&l[E+1]==U&&l[E+2]==q&&(v[w+3]=0)}if(_==16)for(k=0;k<g;k++)w=k<<2,E=6*k,A[k]=255<<24|l[E+4]<<16|l[E+2]<<8|l[E],D(l,E)==x&&D(l,E+2)==U&&D(l,E+4)==q&&(v[w+3]=0)}}else if(T==3){const M=h.tabs.PLTE,U=h.tabs.tRNS,q=U?U.length:0;if(_==1)for(var j=0;j<d;j++){var P=j*y,O=j*c;for(k=0;k<c;k++){w=O+k<<2;var F=3*(I=l[P+(k>>3)]>>7-((7&k)<<0)&1);v[w]=M[F],v[w+1]=M[F+1],v[w+2]=M[F+2],v[w+3]=I<q?U[I]:255}}if(_==2)for(j=0;j<d;j++)for(P=j*y,O=j*c,k=0;k<c;k++)w=O+k<<2,F=3*(I=l[P+(k>>2)]>>6-((3&k)<<1)&3),v[w]=M[F],v[w+1]=M[F+1],v[w+2]=M[F+2],v[w+3]=I<q?U[I]:255;if(_==4)for(j=0;j<d;j++)for(P=j*y,O=j*c,k=0;k<c;k++)w=O+k<<2,F=3*(I=l[P+(k>>1)]>>4-((1&k)<<2)&15),v[w]=M[F],v[w+1]=M[F+1],v[w+2]=M[F+2],v[w+3]=I<q?U[I]:255;if(_==8)for(k=0;k<g;k++){var I;w=k<<2,F=3*(I=l[k]),v[w]=M[F],v[w+1]=M[F+1],v[w+2]=M[F+2],v[w+3]=I<q?U[I]:255}}else if(T==4){if(_==8)for(k=0;k<g;k++){w=k<<2;var z=l[S=k<<1];v[w]=z,v[w+1]=z,v[w+2]=z,v[w+3]=l[S+1]}if(_==16)for(k=0;k<g;k++){var S;w=k<<2,z=l[S=k<<2],v[w]=z,v[w+1]=z,v[w+2]=z,v[w+3]=l[S+2]}}else if(T==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,j=0;j<d;j++){const M=j*y,U=j*c;if(_==1)for(var C=0;C<c;C++){var H=(z=255*(l[M+(C>>>3)]>>>7-(7&C)&1))==255*x?0:255;A[U+C]=H<<24|z<<16|z<<8|z}else if(_==2)for(C=0;C<c;C++)H=(z=85*(l[M+(C>>>2)]>>>6-((3&C)<<1)&3))==85*x?0:255,A[U+C]=H<<24|z<<16|z<<8|z;else if(_==4)for(C=0;C<c;C++)H=(z=17*(l[M+(C>>>1)]>>>4-((1&C)<<2)&15))==17*x?0:255,A[U+C]=H<<24|z<<16|z<<8|z;else if(_==8)for(C=0;C<c;C++)H=(z=l[M+C])==x?0:255,A[U+C]=H<<24|z<<16|z<<8|z;else if(_==16)for(C=0;C<c;C++)z=l[M+(C<<1)],H=D(l,M+(C<<1))==x?0:255,A[U+C]=H<<24|z<<16|z<<8|z}return v}function n(l,c,d,h){const g=s(l),b=Math.ceil(d*g/8),y=new Uint8Array((b+1+l.interlace)*h);return c=l.tabs.CgBI?o(c,y):r(c,y),l.interlace==0?c=a(c,l,0,d,h):l.interlace==1&&(c=(function(A,T){const _=T.width,D=T.height,k=s(T),E=k>>3,x=Math.ceil(_*k/8),w=new Uint8Array(D*x);let j=0;const P=[0,0,4,0,2,0,1],O=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],I=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const C=F[z],H=I[z];let M=0,U=0,q=P[z];for(;q<D;)q+=C,U++;let R=O[z];for(;R<_;)R+=H,M++;const L=Math.ceil(M*k/8);a(A,T,j,M,U);let $=0,N=P[z];for(;N<D;){let B=O[z],G=j+$*L<<3;for(;B<_;){var S;if(k==1&&(S=(S=A[G>>3])>>7-(7&G)&1,w[N*x+(B>>3)]|=S<<7-((7&B)<<0)),k==2&&(S=(S=A[G>>3])>>6-(7&G)&3,w[N*x+(B>>2)]|=S<<6-((3&B)<<1)),k==4&&(S=(S=A[G>>3])>>4-(7&G)&15,w[N*x+(B>>1)]|=S<<4-((1&B)<<2)),k>=8){const V=N*x+B*E;for(let K=0;K<E;K++)w[V+K]=A[(G>>3)+K]}G+=k,B+=H}$++,N+=C}M*U!=0&&(j+=U*(1+L)),z+=1}return w})(c,l)),c}function r(l,c){return o(new Uint8Array(l.buffer,2,l.length-6),c)}var o=(function(){const l={H:{}};return l.H.N=function(c,d){const h=Uint8Array;let g,b,y=0,v=0,A=0,T=0,_=0,D=0,k=0,E=0,x=0;if(c[0]==3&&c[1]==0)return d||new h(0);const w=l.H,j=w.b,P=w.e,O=w.R,F=w.n,I=w.A,z=w.Z,S=w.m,C=d==null;for(C&&(d=new h(c.length>>>2<<5));y==0;)if(y=j(c,x,1),v=j(c,x+1,2),x+=3,v!=0){if(C&&(d=l.H.W(d,E+(1<<17))),v==1&&(g=S.J,b=S.h,D=511,k=31),v==2){A=P(c,x,5)+257,T=P(c,x+5,5)+1,_=P(c,x+10,4)+4,x+=14;let M=1;for(var H=0;H<38;H+=2)S.Q[H]=0,S.Q[H+1]=0;for(H=0;H<_;H++){const R=P(c,x+3*H,3);S.Q[1+(S.X[H]<<1)]=R,R>M&&(M=R)}x+=3*_,F(S.Q,M),I(S.Q,M,S.u),g=S.w,b=S.d,x=O(S.u,(1<<M)-1,A+T,c,x,S.v);const U=w.V(S.v,0,A,S.C);D=(1<<U)-1;const q=w.V(S.v,A,T,S.D);k=(1<<q)-1,F(S.C,U),I(S.C,U,g),F(S.D,q),I(S.D,q,b)}for(;;){const M=g[z(c,x)&D];x+=15&M;const U=M>>>4;if(!(U>>>8))d[E++]=U;else{if(U==256)break;{let q=E+U-254;if(U>264){const B=S.q[U-257];q=E+(B>>>3)+P(c,x,7&B),x+=7&B}const R=b[z(c,x)&k];x+=15&R;const L=R>>>4,$=S.c[L],N=($>>>4)+j(c,x,15&$);for(x+=15&$;E<q;)d[E]=d[E++-N],d[E]=d[E++-N],d[E]=d[E++-N],d[E]=d[E++-N];E=q}}}}else{(7&x)!=0&&(x+=8-(7&x));const M=4+(x>>>3),U=c[M-4]|c[M-3]<<8;C&&(d=l.H.W(d,E+U)),d.set(new h(c.buffer,c.byteOffset+M,U),E),x=M+U<<3,E+=U}return d.length==E?d:d.slice(0,E)},l.H.W=function(c,d){const h=c.length;if(d<=h)return c;const g=new Uint8Array(h<<1);return g.set(c,0),g},l.H.R=function(c,d,h,g,b,y){const v=l.H.e,A=l.H.Z;let T=0;for(;T<h;){const _=c[A(g,b)&d];b+=15&_;const D=_>>>4;if(D<=15)y[T]=D,T++;else{let k=0,E=0;D==16?(E=3+v(g,b,2),b+=2,k=y[T-1]):D==17?(E=3+v(g,b,3),b+=3):D==18&&(E=11+v(g,b,7),b+=7);const x=T+E;for(;T<x;)y[T]=k,T++}}return b},l.H.V=function(c,d,h,g){let b=0,y=0;const v=g.length>>>1;for(;y<h;){const A=c[y+d];g[y<<1]=0,g[1+(y<<1)]=A,A>b&&(b=A),y++}for(;y<v;)g[y<<1]=0,g[1+(y<<1)]=0,y++;return b},l.H.n=function(c,d){const h=l.H.m,g=c.length;let b,y,v,A;const T=h.j;for(var _=0;_<=d;_++)T[_]=0;for(_=1;_<g;_+=2)T[c[_]]++;const D=h.K;for(b=0,T[0]=0,y=1;y<=d;y++)b=b+T[y-1]<<1,D[y]=b;for(v=0;v<g;v+=2)A=c[v+1],A!=0&&(c[v]=D[A],D[A]++)},l.H.A=function(c,d,h){const g=c.length,b=l.H.m.r;for(let y=0;y<g;y+=2)if(c[y+1]!=0){const v=y>>1,A=c[y+1],T=v<<4|A,_=d-A;let D=c[y]<<_;const k=D+(1<<_);for(;D!=k;)h[b[D]>>>15-d]=T,D++}},l.H.l=function(c,d){const h=l.H.m.r,g=15-d;for(let b=0;b<c.length;b+=2){const y=c[b]<<d-c[b+1];c[b]=h[y]>>>g}},l.H.M=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8},l.H.I=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8,c[g+2]|=h>>>16},l.H.e=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8)>>>(7&d)&(1<<h)-1},l.H.b=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)&(1<<h)-1},l.H.Z=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16|c[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=(function(){const c=Uint16Array,d=Uint32Array;return{K:new c(16),j:new c(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new c(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new d(32),J:new c(512),_:[],h:new c(32),$:[],w:new c(32768),C:[],v:[],d:new c(32768),D:[],u:new c(512),Q:[],r:new c(32768),s:new d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var d=0;d<32768;d++){let g=d;g=(2863311530&g)>>>1|(1431655765&g)<<1,g=(3435973836&g)>>>2|(858993459&g)<<2,g=(4042322160&g)>>>4|(252645135&g)<<4,g=(4278255360&g)>>>8|(16711935&g)<<8,c.r[d]=(g>>>16|g<<16)>>>17}function h(g,b,y){for(;b--!=0;)g.push(0,y)}for(d=0;d<32;d++)c.q[d]=c.S[d]<<3|c.T[d],c.c[d]=c.p[d]<<4|c.z[d];h(c._,144,8),h(c._,112,9),h(c._,24,7),h(c._,8,8),l.H.n(c._,9),l.H.A(c._,9,c.J),l.H.l(c._,9),h(c.$,32,5),l.H.n(c.$,5),l.H.A(c.$,5,c.h),l.H.l(c.$,5),h(c.Q,19,0),h(c.C,286,0),h(c.D,30,0),h(c.v,320,0)})(),l.H.N})();function s(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,d,h,g){let b=s(c);const y=Math.ceil(h*b/8);let v,A;b=Math.ceil(b/8);let T=l[d],_=0;if(T>1&&(l[d]=[0,0,1][T-2]),T==3)for(_=b;_<y;_++)l[_+1]=l[_+1]+(l[_+1-b]>>>1)&255;for(let D=0;D<g;D++)if(v=d+D*y,A=v+D+1,T=l[A-1],_=0,T==0)for(;_<y;_++)l[v+_]=l[A+_];else if(T==1){for(;_<b;_++)l[v+_]=l[A+_];for(;_<y;_++)l[v+_]=l[A+_]+l[v+_-b]}else if(T==2)for(;_<y;_++)l[v+_]=l[A+_]+l[v+_-y];else if(T==3){for(;_<b;_++)l[v+_]=l[A+_]+(l[v+_-y]>>>1);for(;_<y;_++)l[v+_]=l[A+_]+(l[v+_-y]+l[v+_-b]>>>1)}else{for(;_<b;_++)l[v+_]=l[A+_]+i(0,l[v+_-y],0);for(;_<y;_++)l[v+_]=l[A+_]+i(l[v+_-b],l[v+_-y],l[v+_-b-y])}return l}function i(l,c,d){const h=l+c-d,g=h-l,b=h-c,y=h-d;return g*g<=b*b&&g*g<=y*y?l:b*b<=y*y?c:d}function m(l,c,d){d.width=e.readUint(l,c),c+=4,d.height=e.readUint(l,c),c+=4,d.depth=l[c],c++,d.ctype=l[c],c++,d.compress=l[c],c++,d.filter=l[c],c++,d.interlace=l[c],c++}function f(l,c,d,h,g,b,y,v,A){const T=Math.min(c,g),_=Math.min(d,b);let D=0,k=0;for(let z=0;z<_;z++)for(let S=0;S<T;S++)if(y>=0&&v>=0?(D=z*c+S<<2,k=(v+z)*g+y+S<<2):(D=(-v+z)*c-y+S<<2,k=z*g+S<<2),A==0)h[k]=l[D],h[k+1]=l[D+1],h[k+2]=l[D+2],h[k+3]=l[D+3];else if(A==1){var E=l[D+3]*.00392156862745098,x=l[D]*E,w=l[D+1]*E,j=l[D+2]*E,P=h[k+3]*(1/255),O=h[k]*P,F=h[k+1]*P,I=h[k+2]*P;const C=1-E,H=E+P*C,M=H==0?0:1/H;h[k+3]=255*H,h[k+0]=(x+O*C)*M,h[k+1]=(w+F*C)*M,h[k+2]=(j+I*C)*M}else if(A==2)E=l[D+3],x=l[D],w=l[D+1],j=l[D+2],P=h[k+3],O=h[k],F=h[k+1],I=h[k+2],E==P&&x==O&&w==F&&j==I?(h[k]=0,h[k+1]=0,h[k+2]=0,h[k+3]=0):(h[k]=x,h[k+1]=w,h[k+2]=j,h[k+3]=E);else if(A==3){if(E=l[D+3],x=l[D],w=l[D+1],j=l[D+2],P=h[k+3],O=h[k],F=h[k+1],I=h[k+2],E==P&&x==O&&w==F&&j==I)continue;if(E<220&&P>20)return!1}return!0}return{decode:function(c){const d=new Uint8Array(c);let h=8;const g=e,b=g.readUshort,y=g.readUint,v={tabs:{},frames:[]},A=new Uint8Array(d.length);let T,_=0,D=0;const k=[137,80,78,71,13,10,26,10];for(var E=0;E<8;E++)if(d[E]!=k[E])throw"The input is not a PNG file!";for(;h<d.length;){const z=g.readUint(d,h);h+=4;const S=g.readASCII(d,h,4);if(h+=4,S=="IHDR")m(d,h,v);else if(S=="iCCP"){for(var x=h;d[x]!=0;)x++;g.readASCII(d,h,x-h),d[x+1];const C=d.slice(x+2,h+z);let H=null;try{H=r(C)}catch{H=o(C)}v.tabs[S]=H}else if(S=="CgBI")v.tabs[S]=d.slice(h,h+4);else if(S=="IDAT"){for(E=0;E<z;E++)A[_+E]=d[h+E];_+=z}else if(S=="acTL")v.tabs[S]={num_frames:y(d,h),num_plays:y(d,h+4)},T=new Uint8Array(d.length);else if(S=="fcTL"){D!=0&&((I=v.frames[v.frames.length-1]).data=n(v,T.slice(0,D),I.rect.width,I.rect.height),D=0);const C={x:y(d,h+12),y:y(d,h+16),width:y(d,h+4),height:y(d,h+8)};let H=b(d,h+22);H=b(d,h+20)/(H==0?100:H);const M={rect:C,delay:Math.round(1e3*H),dispose:d[h+24],blend:d[h+25]};v.frames.push(M)}else if(S=="fdAT"){for(E=0;E<z-4;E++)T[D+E]=d[h+E+4];D+=z-4}else if(S=="pHYs")v.tabs[S]=[g.readUint(d,h),g.readUint(d,h+4),d[h+8]];else if(S=="cHRM")for(v.tabs[S]=[],E=0;E<8;E++)v.tabs[S].push(g.readUint(d,h+4*E));else if(S=="tEXt"||S=="zTXt"){v.tabs[S]==null&&(v.tabs[S]={});var w=g.nextZero(d,h),j=g.readASCII(d,h,w-h),P=h+z-w-1;if(S=="tEXt")F=g.readASCII(d,w+1,P);else{var O=r(d.slice(w+2,w+2+P));F=g.readUTF8(O,0,O.length)}v.tabs[S][j]=F}else if(S=="iTXt"){v.tabs[S]==null&&(v.tabs[S]={}),w=0,x=h,w=g.nextZero(d,x),j=g.readASCII(d,x,w-x);const C=d[x=w+1];var F;d[x+1],x+=2,w=g.nextZero(d,x),g.readASCII(d,x,w-x),x=w+1,w=g.nextZero(d,x),g.readUTF8(d,x,w-x),P=z-((x=w+1)-h),C==0?F=g.readUTF8(d,x,P):(O=r(d.slice(x,x+P)),F=g.readUTF8(O,0,O.length)),v.tabs[S][j]=F}else if(S=="PLTE")v.tabs[S]=g.readBytes(d,h,z);else if(S=="hIST"){const C=v.tabs.PLTE.length/3;for(v.tabs[S]=[],E=0;E<C;E++)v.tabs[S].push(b(d,h+2*E))}else if(S=="tRNS")v.ctype==3?v.tabs[S]=g.readBytes(d,h,z):v.ctype==0?v.tabs[S]=b(d,h):v.ctype==2&&(v.tabs[S]=[b(d,h),b(d,h+2),b(d,h+4)]);else if(S=="gAMA")v.tabs[S]=g.readUint(d,h)/1e5;else if(S=="sRGB")v.tabs[S]=d[h];else if(S=="bKGD")v.ctype==0||v.ctype==4?v.tabs[S]=[b(d,h)]:v.ctype==2||v.ctype==6?v.tabs[S]=[b(d,h),b(d,h+2),b(d,h+4)]:v.ctype==3&&(v.tabs[S]=d[h]);else if(S=="IEND")break;h+=z,g.readUint(d,h),h+=4}var I;return D!=0&&((I=v.frames[v.frames.length-1]).data=n(v,T.slice(0,D),I.rect.width,I.rect.height)),v.data=n(v,A,v.width,v.height),delete v.compress,delete v.interlace,delete v.filter,v},toRGBA8:function(c){const d=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,d,h,c).buffer];const g=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const b=d*h*4,y=new Uint8Array(b),v=new Uint8Array(b),A=new Uint8Array(b);for(let _=0;_<c.frames.length;_++){const D=c.frames[_],k=D.rect.x,E=D.rect.y,x=D.rect.width,w=D.rect.height,j=t(D.data,x,w,c);if(_!=0)for(var T=0;T<b;T++)A[T]=y[T];if(D.blend==0?f(j,x,w,y,d,h,k,E,0):D.blend==1&&f(j,x,w,y,d,h,k,E,1),g.push(y.buffer.slice(0)),D.dispose!=0){if(D.dispose==1)f(v,x,w,y,d,h,k,E,0);else if(D.dispose==2)for(T=0;T<b;T++)y[T]=A[T]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=ze,{_bin:t}=ze,n=ze._paeth;var r={table:(function(){const x=new Uint32Array(256);for(let w=0;w<256;w++){let j=w;for(let P=0;P<8;P++)1&j?j=3988292384^j>>>1:j>>>=1;x[w]=j}return x})(),update(x,w,j,P){for(let O=0;O<P;O++)x=r.table[255&(x^w[j+O])]^x>>>8;return x},crc:(x,w,j)=>4294967295^r.update(4294967295,x,w,j)};function o(x,w,j,P){w[j]+=x[0]*P>>4,w[j+1]+=x[1]*P>>4,w[j+2]+=x[2]*P>>4,w[j+3]+=x[3]*P>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,w){const j=x[0]-w[0],P=x[1]-w[1],O=x[2]-w[2],F=x[3]-w[3];return j*j+P*P+O*O+F*F}function i(x,w,j,P,O,F,I){I==null&&(I=1);const z=P.length,S=[];for(var C=0;C<z;C++){const N=P[C];S.push([N>>>0&255,N>>>8&255,N>>>16&255,N>>>24&255])}for(C=0;C<z;C++){let N=4294967295;for(var H=0,M=0;M<z;M++){var U=a(S[C],S[M]);M!=C&&U<N&&(N=U,H=M)}}const q=new Uint32Array(O.buffer),R=new Int16Array(w*j*4),L=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(C=0;C<L.length;C++)L[C]=255*((L[C]+.5)/16-.5);for(let N=0;N<j;N++)for(let B=0;B<w;B++){var $;C=4*(N*w+B),I!=2?$=[s(x[C]+R[C]),s(x[C+1]+R[C+1]),s(x[C+2]+R[C+2]),s(x[C+3]+R[C+3])]:(U=L[4*(3&N)+(3&B)],$=[s(x[C]+U),s(x[C+1]+U),s(x[C+2]+U),s(x[C+3]+U)]),H=0;let G=16777215;for(M=0;M<z;M++){const oe=a($,S[M]);oe<G&&(G=oe,H=M)}const V=S[H],K=[$[0]-V[0],$[1]-V[1],$[2]-V[2],$[3]-V[3]];I==1&&(B!=w-1&&o(K,R,C+4,7),N!=j-1&&(B!=0&&o(K,R,C+4*w-4,3),o(K,R,C+4*w,5),B!=w-1&&o(K,R,C+4*w+4,1))),F[C>>2]=H,q[C>>2]=P[H]}}function m(x,w,j,P,O){O==null&&(O={});const{crc:F}=r,I=t.writeUint,z=t.writeUshort,S=t.writeASCII;let C=8;const H=x.frames.length>1;let M,U=!1,q=33+(H?20:0);if(O.sRGB!=null&&(q+=13),O.pHYs!=null&&(q+=21),O.iCCP!=null&&(M=pako.deflate(O.iCCP),q+=21+M.length+4),x.ctype==3){for(var R=x.plte.length,L=0;L<R;L++)x.plte[L]>>>24!=255&&(U=!0);q+=8+3*R+4+(U?8+1*R+4:0)}for(var $=0;$<x.frames.length;$++)H&&(q+=38),q+=(V=x.frames[$]).cimg.length+12,$!=0&&(q+=4);q+=12;const N=new Uint8Array(q),B=[137,80,78,71,13,10,26,10];for(L=0;L<8;L++)N[L]=B[L];if(I(N,C,13),C+=4,S(N,C,"IHDR"),C+=4,I(N,C,w),C+=4,I(N,C,j),C+=4,N[C]=x.depth,C++,N[C]=x.ctype,C++,N[C]=0,C++,N[C]=0,C++,N[C]=0,C++,I(N,C,F(N,C-17,17)),C+=4,O.sRGB!=null&&(I(N,C,1),C+=4,S(N,C,"sRGB"),C+=4,N[C]=O.sRGB,C++,I(N,C,F(N,C-5,5)),C+=4),O.iCCP!=null){const K=13+M.length;I(N,C,K),C+=4,S(N,C,"iCCP"),C+=4,S(N,C,"ICC profile"),C+=11,C+=2,N.set(M,C),C+=M.length,I(N,C,F(N,C-(K+4),K+4)),C+=4}if(O.pHYs!=null&&(I(N,C,9),C+=4,S(N,C,"pHYs"),C+=4,I(N,C,O.pHYs[0]),C+=4,I(N,C,O.pHYs[1]),C+=4,N[C]=O.pHYs[2],C++,I(N,C,F(N,C-13,13)),C+=4),H&&(I(N,C,8),C+=4,S(N,C,"acTL"),C+=4,I(N,C,x.frames.length),C+=4,I(N,C,O.loop!=null?O.loop:0),C+=4,I(N,C,F(N,C-12,12)),C+=4),x.ctype==3){for(I(N,C,3*(R=x.plte.length)),C+=4,S(N,C,"PLTE"),C+=4,L=0;L<R;L++){const K=3*L,oe=x.plte[L],J=255&oe,ne=oe>>>8&255,ie=oe>>>16&255;N[C+K+0]=J,N[C+K+1]=ne,N[C+K+2]=ie}if(C+=3*R,I(N,C,F(N,C-3*R-4,3*R+4)),C+=4,U){for(I(N,C,R),C+=4,S(N,C,"tRNS"),C+=4,L=0;L<R;L++)N[C+L]=x.plte[L]>>>24&255;C+=R,I(N,C,F(N,C-R-4,R+4)),C+=4}}let G=0;for($=0;$<x.frames.length;$++){var V=x.frames[$];H&&(I(N,C,26),C+=4,S(N,C,"fcTL"),C+=4,I(N,C,G++),C+=4,I(N,C,V.rect.width),C+=4,I(N,C,V.rect.height),C+=4,I(N,C,V.rect.x),C+=4,I(N,C,V.rect.y),C+=4,z(N,C,P[$]),C+=2,z(N,C,1e3),C+=2,N[C]=V.dispose,C++,N[C]=V.blend,C++,I(N,C,F(N,C-30,30)),C+=4);const K=V.cimg;I(N,C,(R=K.length)+($==0?0:4)),C+=4;const oe=C;S(N,C,$==0?"IDAT":"fdAT"),C+=4,$!=0&&(I(N,C,G++),C+=4),N.set(K,C),C+=R,I(N,C,F(N,oe,C-oe)),C+=4}return I(N,C,0),C+=4,S(N,C,"IEND"),C+=4,I(N,C,F(N,C-4,4)),C+=4,N.buffer}function f(x,w,j){for(let P=0;P<x.frames.length;P++){const O=x.frames[P];O.rect.width;const F=O.rect.height,I=new Uint8Array(F*O.bpl+F);O.cimg=h(O.img,F,O.bpp,O.bpl,I,w,j)}}function l(x,w,j,P,O){const F=O[0],I=O[1],z=O[2],S=O[3],C=O[4],H=O[5];let M=6,U=8,q=255;for(var R=0;R<x.length;R++){const be=new Uint8Array(x[R]);for(var L=be.length,$=0;$<L;$+=4)q&=be[$+3]}const N=q!=255,B=(function(de,le,xe,ye,fe,_e){const we=[];for(var he=0;he<de.length;he++){const Te=new Uint8Array(de[he]),De=new Uint32Array(Te.buffer);var Re;let Ie=0,W=0,Y=le,ee=xe,pe=ye?1:0;if(he!=0){const Se=_e||ye||he==1||we[he-2].dispose!=0?1:2;let ue=0,je=1e9;for(let wt=0;wt<Se;wt++){var Ve=new Uint8Array(de[he-1-wt]);const kn=new Uint32Array(de[he-1-wt]);let lt=le,ct=xe,Ft=-1,nn=-1;for(let Ct=0;Ct<xe;Ct++)for(let St=0;St<le;St++)De[Ae=Ct*le+St]!=kn[Ae]&&(St<lt&&(lt=St),St>Ft&&(Ft=St),Ct<ct&&(ct=Ct),Ct>nn&&(nn=Ct));Ft==-1&&(lt=ct=Ft=nn=0),fe&&((1&lt)==1&&lt--,(1&ct)==1&&ct--);const Ko=(Ft-lt+1)*(nn-ct+1);Ko<je&&(je=Ko,ue=wt,Ie=lt,W=ct,Y=Ft-lt+1,ee=nn-ct+1)}Ve=new Uint8Array(de[he-1-ue]),ue==1&&(we[he-1].dispose=2),Re=new Uint8Array(Y*ee*4),e(Ve,le,xe,Re,Y,ee,-Ie,-W,0),pe=e(Te,le,xe,Re,Y,ee,-Ie,-W,3)?1:0,pe==1?d(Te,le,xe,Re,{x:Ie,y:W,width:Y,height:ee}):e(Te,le,xe,Re,Y,ee,-Ie,-W,0)}else Re=Te.slice(0);we.push({rect:{x:Ie,y:W,width:Y,height:ee},img:Re,blend:pe,dispose:0})}if(ye)for(he=0;he<we.length;he++){if((et=we[he]).blend==1)continue;const Te=et.rect,De=we[he-1].rect,Ie=Math.min(Te.x,De.x),W=Math.min(Te.y,De.y),Y={x:Ie,y:W,width:Math.max(Te.x+Te.width,De.x+De.width)-Ie,height:Math.max(Te.y+Te.height,De.y+De.height)-W};we[he-1].dispose=1,he-1!=0&&c(de,le,xe,we,he-1,Y,fe),c(de,le,xe,we,he,Y,fe)}let Lt=0;if(de.length!=1)for(var Ae=0;Ae<we.length;Ae++){var et;Lt+=(et=we[Ae]).rect.width*et.rect.height}return we})(x,w,j,F,I,z),G={},V=[],K=[];if(P!=0){const be=[];for($=0;$<B.length;$++)be.push(B[$].img.buffer);const de=(function(fe){let _e=0;for(var we=0;we<fe.length;we++)_e+=fe[we].byteLength;const he=new Uint8Array(_e);let Re=0;for(we=0;we<fe.length;we++){const Ve=new Uint8Array(fe[we]),Lt=Ve.length;for(let Ae=0;Ae<Lt;Ae+=4){let et=Ve[Ae],Te=Ve[Ae+1],De=Ve[Ae+2];const Ie=Ve[Ae+3];Ie==0&&(et=Te=De=0),he[Re+Ae]=et,he[Re+Ae+1]=Te,he[Re+Ae+2]=De,he[Re+Ae+3]=Ie}Re+=Lt}return he.buffer})(be),le=b(de,P);for($=0;$<le.plte.length;$++)V.push(le.plte[$].est.rgba);let xe=0;for($=0;$<B.length;$++){const ye=(J=B[$]).img.length;var oe=new Uint8Array(le.inds.buffer,xe>>2,ye>>2);K.push(oe);const fe=new Uint8Array(le.abuf,xe,ye);H&&i(J.img,J.rect.width,J.rect.height,V,fe,oe),J.img.set(fe),xe+=ye}}else for(R=0;R<B.length;R++){var J=B[R];const be=new Uint32Array(J.img.buffer);var ne=J.rect.width;for(L=be.length,oe=new Uint8Array(L),K.push(oe),$=0;$<L;$++){const de=be[$];if($!=0&&de==be[$-1])oe[$]=oe[$-1];else if($>ne&&de==be[$-ne])oe[$]=oe[$-ne];else{let le=G[de];if(le==null&&(G[de]=le=V.length,V.push(de),V.length>=300))break;oe[$]=le}}}const ie=V.length;for(ie<=256&&C==0&&(U=ie<=2?1:ie<=4?2:ie<=16?4:8,U=Math.max(U,S)),R=0;R<B.length;R++){(J=B[R]).rect.x,J.rect.y,ne=J.rect.width;const be=J.rect.height;let de=J.img;new Uint32Array(de.buffer);let le=4*ne,xe=4;if(ie<=256&&C==0){le=Math.ceil(U*ne/8);var ve=new Uint8Array(le*be);const ye=K[R];for(let fe=0;fe<be;fe++){$=fe*le;const _e=fe*ne;if(U==8)for(var ce=0;ce<ne;ce++)ve[$+ce]=ye[_e+ce];else if(U==4)for(ce=0;ce<ne;ce++)ve[$+(ce>>1)]|=ye[_e+ce]<<4-4*(1&ce);else if(U==2)for(ce=0;ce<ne;ce++)ve[$+(ce>>2)]|=ye[_e+ce]<<6-2*(3&ce);else if(U==1)for(ce=0;ce<ne;ce++)ve[$+(ce>>3)]|=ye[_e+ce]<<7-1*(7&ce)}de=ve,M=3,xe=1}else if(N==0&&B.length==1){ve=new Uint8Array(ne*be*3);const ye=ne*be;for($=0;$<ye;$++){const fe=3*$,_e=4*$;ve[fe]=de[_e],ve[fe+1]=de[_e+1],ve[fe+2]=de[_e+2]}de=ve,M=2,xe=3,le=3*ne}J.img=de,J.bpl=le,J.bpp=xe}return{ctype:M,depth:U,plte:V,frames:B}}function c(x,w,j,P,O,F,I){const z=Uint8Array,S=Uint32Array,C=new z(x[O-1]),H=new S(x[O-1]),M=O+1<x.length?new z(x[O+1]):null,U=new z(x[O]),q=new S(U.buffer);let R=w,L=j,$=-1,N=-1;for(let G=0;G<F.height;G++)for(let V=0;V<F.width;V++){const K=F.x+V,oe=F.y+G,J=oe*w+K,ne=q[J];ne==0||P[O-1].dispose==0&&H[J]==ne&&(M==null||M[4*J+3]!=0)||(K<R&&(R=K),K>$&&($=K),oe<L&&(L=oe),oe>N&&(N=oe))}$==-1&&(R=L=$=N=0),I&&((1&R)==1&&R--,(1&L)==1&&L--),F={x:R,y:L,width:$-R+1,height:N-L+1};const B=P[O];B.rect=F,B.blend=1,B.img=new Uint8Array(F.width*F.height*4),P[O-1].dispose==0?(e(C,w,j,B.img,F.width,F.height,-F.x,-F.y,0),d(U,w,j,B.img,F)):e(U,w,j,B.img,F.width,F.height,-F.x,-F.y,0)}function d(x,w,j,P,O){e(x,w,j,P,O.width,O.height,-O.x,-O.y,2)}function h(x,w,j,P,O,F,I){const z=[];let S,C=[0,1,2,3,4];F!=-1?C=[F]:(w*P>5e5||j==1)&&(C=[0]),I&&(S={level:0});const H=Fh;for(var M=0;M<C.length;M++){for(let R=0;R<w;R++)g(O,x,R,P,j,C[M]);z.push(H.deflate(O,S))}let U,q=1e9;for(M=0;M<z.length;M++)z[M].length<q&&(U=M,q=z[M].length);return z[U]}function g(x,w,j,P,O,F){const I=j*P;let z=I+j;if(x[z]=F,z++,F==0)if(P<500)for(var S=0;S<P;S++)x[z+S]=w[I+S];else x.set(new Uint8Array(w.buffer,I,P),z);else if(F==1){for(S=0;S<O;S++)x[z+S]=w[I+S];for(S=O;S<P;S++)x[z+S]=w[I+S]-w[I+S-O]+256&255}else if(j==0){for(S=0;S<O;S++)x[z+S]=w[I+S];if(F==2)for(S=O;S<P;S++)x[z+S]=w[I+S];if(F==3)for(S=O;S<P;S++)x[z+S]=w[I+S]-(w[I+S-O]>>1)+256&255;if(F==4)for(S=O;S<P;S++)x[z+S]=w[I+S]-n(w[I+S-O],0,0)+256&255}else{if(F==2)for(S=0;S<P;S++)x[z+S]=w[I+S]+256-w[I+S-P]&255;if(F==3){for(S=0;S<O;S++)x[z+S]=w[I+S]+256-(w[I+S-P]>>1)&255;for(S=O;S<P;S++)x[z+S]=w[I+S]+256-(w[I+S-P]+w[I+S-O]>>1)&255}if(F==4){for(S=0;S<O;S++)x[z+S]=w[I+S]+256-n(0,w[I+S-P],0)&255;for(S=O;S<P;S++)x[z+S]=w[I+S]+256-n(w[I+S-O],w[I+S-P],w[I+S-O-P])&255}}}function b(x,w){const j=new Uint8Array(x),P=j.slice(0),O=new Uint32Array(P.buffer),F=y(P,w),I=F[0],z=F[1],S=j.length,C=new Uint8Array(S>>2);let H;if(j.length<2e7)for(var M=0;M<S;M+=4)H=v(I,U=j[M]*(1/255),q=j[M+1]*(1/255),R=j[M+2]*(1/255),L=j[M+3]*(1/255)),C[M>>2]=H.ind,O[M>>2]=H.est.rgba;else for(M=0;M<S;M+=4){var U=j[M]*.00392156862745098,q=j[M+1]*(1/255),R=j[M+2]*(1/255),L=j[M+3]*(1/255);for(H=I;H.left;)H=A(H.est,U,q,R,L)<=0?H.left:H.right;C[M>>2]=H.ind,O[M>>2]=H.est.rgba}return{abuf:P.buffer,inds:C,plte:z}}function y(x,w,j){j==null&&(j=1e-4);const P=new Uint32Array(x.buffer),O={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};O.bst=D(x,O.i0,O.i1),O.est=k(O.bst);const F=[O];for(;F.length<w;){let z=0,S=0;for(var I=0;I<F.length;I++)F[I].est.L>z&&(z=F[I].est.L,S=I);if(z<j)break;const C=F[S],H=T(x,P,C.i0,C.i1,C.est.e,C.est.eMq255);if(C.i0>=H||C.i1<=H){C.est.L=0;continue}const M={i0:C.i0,i1:H,bst:null,est:null,tdst:0,left:null,right:null};M.bst=D(x,M.i0,M.i1),M.est=k(M.bst);const U={i0:H,i1:C.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:C.bst.N-M.bst.N},I=0;I<16;I++)U.bst.R[I]=C.bst.R[I]-M.bst.R[I];for(I=0;I<4;I++)U.bst.m[I]=C.bst.m[I]-M.bst.m[I];U.est=k(U.bst),C.left=M,C.right=U,F[S]=M,F.push(U)}for(F.sort(((z,S)=>S.bst.N-z.bst.N)),I=0;I<F.length;I++)F[I].ind=I;return[O,F]}function v(x,w,j,P,O){if(x.left==null)return x.tdst=(function(M,U,q,R,L){const $=U-M[0],N=q-M[1],B=R-M[2],G=L-M[3];return $*$+N*N+B*B+G*G})(x.est.q,w,j,P,O),x;const F=A(x.est,w,j,P,O);let I=x.left,z=x.right;F>0&&(I=x.right,z=x.left);const S=v(I,w,j,P,O);if(S.tdst<=F*F)return S;const C=v(z,w,j,P,O);return C.tdst<S.tdst?C:S}function A(x,w,j,P,O){const{e:F}=x;return F[0]*w+F[1]*j+F[2]*P+F[3]*O-x.eMq}function T(x,w,j,P,O,F){for(P-=4;j<P;){for(;_(x,j,O)<=F;)j+=4;for(;_(x,P,O)>F;)P-=4;if(j>=P)break;const I=w[j>>2];w[j>>2]=w[P>>2],w[P>>2]=I,j+=4,P-=4}for(;_(x,j,O)>F;)j-=4;return j+4}function _(x,w,j){return x[w]*j[0]+x[w+1]*j[1]+x[w+2]*j[2]+x[w+3]*j[3]}function D(x,w,j){const P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=[0,0,0,0],F=j-w>>2;for(let I=w;I<j;I+=4){const z=x[I]*.00392156862745098,S=x[I+1]*(1/255),C=x[I+2]*(1/255),H=x[I+3]*(1/255);O[0]+=z,O[1]+=S,O[2]+=C,O[3]+=H,P[0]+=z*z,P[1]+=z*S,P[2]+=z*C,P[3]+=z*H,P[5]+=S*S,P[6]+=S*C,P[7]+=S*H,P[10]+=C*C,P[11]+=C*H,P[15]+=H*H}return P[4]=P[1],P[8]=P[2],P[9]=P[6],P[12]=P[3],P[13]=P[7],P[14]=P[11],{R:P,m:O,N:F}}function k(x){const{R:w}=x,{m:j}=x,{N:P}=x,O=j[0],F=j[1],I=j[2],z=j[3],S=P==0?0:1/P,C=[w[0]-O*O*S,w[1]-O*F*S,w[2]-O*I*S,w[3]-O*z*S,w[4]-F*O*S,w[5]-F*F*S,w[6]-F*I*S,w[7]-F*z*S,w[8]-I*O*S,w[9]-I*F*S,w[10]-I*I*S,w[11]-I*z*S,w[12]-z*O*S,w[13]-z*F*S,w[14]-z*I*S,w[15]-z*z*S],H=C,M=E;let U=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,R=0;if(P!=0)for(let $=0;$<16&&(U=M.multVec(H,U),R=Math.sqrt(M.dot(U,U)),U=M.sml(1/R,U),!($!=0&&Math.abs(R-q)<1e-9));$++)q=R;const L=[O*S,F*S,I*S,z*S];return{Cov:C,q:L,e:U,L:q,eMq255:M.dot(M.sml(255,L),U),eMq:M.dot(U,L),rgba:(Math.round(255*L[3])<<24|Math.round(255*L[2])<<16|Math.round(255*L[1])<<8|Math.round(255*L[0])<<0)>>>0}}var E={multVec:(x,w)=>[x[0]*w[0]+x[1]*w[1]+x[2]*w[2]+x[3]*w[3],x[4]*w[0]+x[5]*w[1]+x[6]*w[2]+x[7]*w[3],x[8]*w[0]+x[9]*w[1]+x[10]*w[2]+x[11]*w[3],x[12]*w[0]+x[13]*w[1]+x[14]*w[2]+x[15]*w[3]],dot:(x,w)=>x[0]*w[0]+x[1]*w[1]+x[2]*w[2]+x[3]*w[3],sml:(x,w)=>[x*w[0],x*w[1],x*w[2],x*w[3]]};ze.encode=function(w,j,P,O,F,I,z){O==null&&(O=0),z==null&&(z=!1);const S=l(w,j,P,O,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,j,P,F,I)},ze.encodeLL=function(w,j,P,O,F,I,z,S){const C={ctype:0+(O==1?0:2)+(F==0?0:4),depth:I,frames:[]},H=(O+F)*I,M=H*j;for(let U=0;U<w.length;U++)C.frames.push({rect:{x:0,y:0,width:j,height:P},img:new Uint8Array(w[U]),blend:0,dispose:1,bpp:Math.ceil(H/8),bpl:Math.ceil(M/8)});return f(C,0,!0),m(C,j,P,z,S)},ze.encode.compress=l,ze.encode.dither=i,ze.quantize=b,ze.quantize.getKDtree=y,ze.quantize.getNearest=v})();const Ji={toArrayBuffer(e,t){const n=e.width,r=e.height,o=n<<2,s=e.getContext("2d").getImageData(0,0,n,r),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*r,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),d=1<<20;let h,g,b,y,v=d,A=0,T=0,_=0;function D(x){c.setUint16(T,x,!0),T+=2}function k(x){c.setUint32(T,x,!0),T+=4}function E(x){T+=x}D(19778),k(f),E(4),k(122),k(108),k(n),k(-r>>>0),D(1),D(32),k(3),k(m),k(2835),k(2835),E(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;A<r&&v>0;){for(y=122+A*i,h=0;h<o;)v--,g=a[_++],b=g>>>24,c.setUint32(y+h,g<<8|b),h+=4;A++}_<a.length?(v=d,setTimeout(x,Ji._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Oe={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},$h={[Oe.CHROME]:16384,[Oe.FIREFOX]:11180,[Oe.DESKTOP_SAFARI]:16384,[Oe.IE]:8192,[Oe.IOS]:4096,[Oe.ETC]:8192};const Io=typeof window<"u",Zi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,qn=Io&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Uh=(Io||Zi)&&(qn&&qn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),el=(Io||Zi)&&(qn&&qn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Mo(e,t,n=Date.now()){return new Promise((r=>{const o=e.split(","),s=o[0].match(/:(.*?);/)[1],a=globalThis.atob(o[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,r(f)}))}function tl(e){return new Promise(((t,n)=>{const r=new el;r.onload=()=>t(r.result),r.onerror=o=>n(o),r.readAsDataURL(e)}))}function nl(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=o=>n(o),r.src=e}))}function Et(){if(Et.cachedResult!==void 0)return Et.cachedResult;let e=Oe.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Oe.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Oe.IOS:/Safari/i.test(t)?e=Oe.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Oe.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Oe.IE),Et.cachedResult=e,Et.cachedResult}function rl(e,t){const n=Et(),r=$h[n];let o=e,s=t,a=o*s;const i=o>s?s/o:o/s;for(;a>r*r;){const m=(r+o)/2,f=(r+s)/2;m<f?(s=f,o=f*i):(s=m*i,o=m),a=o*s}return{width:o,height:s}}function lr(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function ol(e,t){const{width:n,height:r}=rl(e.width,e.height),[o,s]=lr(n,r);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,o.width,o.height)),s.drawImage(e,0,0,o.width,o.height),o}function Pn(){return Pn.cachedResult!==void 0||(Pn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Pn.cachedResult}function Yn(e,t={}){return new Promise((function(n,r){let o,s;var a=function(){try{return s=ol(o,t.fileType||e.type),n([o,s])}catch(m){return r(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return r(c)}};try{let l;return tl(e).then((function(c){try{return l=c,nl(l).then((function(d){try{return o=d,(function(){try{return a()}catch(h){return r(h)}})()}catch(h){return f(h)}}),f)}catch(d){return f(d)}}),f)}catch(l){f(l)}}catch(l){return r(l)}};try{if(Pn()||[Oe.DESKTOP_SAFARI,Oe.MOBILE_SAFARI].includes(Et()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return o=m,a()}catch{return i()}}),i)}catch{i()}}))}function Xn(e,t,n,r,o=1){return new Promise((function(s,a){let i;if(t==="image/png"){let f,l,c;return f=e.getContext("2d"),{data:l}=f.getImageData(0,0,e.width,e.height),c=ze.encode([l.buffer],e.width,e.height,4096*o),i=new Blob([c],{type:t}),i.name=n,i.lastModified=r,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Ji.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=r,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:o}).then((function(c){try{return i=c,i.name=n,i.lastModified=r,l.call(this)}catch(d){return a(d)}}).bind(this),a);{let c;return c=e.toDataURL(t,o),Mo(c,n,r).then((function(d){try{return i=d,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return s(i)}}))}function Ye(e){e.width=0,e.height=0}function Bt(){return new Promise((function(e,t){let n,r,o,s;return Bt.cachedResult!==void 0?e(Bt.cachedResult):Mo("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Yn(n).then((function(i){try{return r=i[1],Xn(r,n.type,n.name,n.lastModified).then((function(m){try{return o=m,Ye(r),Yn(o).then((function(f){try{return s=f[0],Bt.cachedResult=s.width===1&&s.height===2,e(Bt.cachedResult)}catch(l){return t(l)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function sl(e){return new Promise(((t,n)=>{const r=new el;r.onload=o=>{const s=new DataView(o.target.result);if(s.getUint16(0,!1)!=65496)return t(-2);const a=s.byteLength;let i=2;for(;i<a;){if(s.getUint16(i+2,!1)<=8)return t(-1);const m=s.getUint16(i,!1);if(i+=2,m==65505){if(s.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=s.getUint16(i+=6,!1)==18761;i+=s.getUint32(i+4,f);const l=s.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(s.getUint16(i+12*c,f)==274)return t(s.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},r.onerror=o=>n(o),r.readAsArrayBuffer(e)}))}function al(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:o}=t;let s,a=e;return isFinite(o)&&(n>o||r>o)&&([a,s]=lr(n,r),n>r?(a.width=o,a.height=r/n*o):(a.width=n/r*o,a.height=o),s.drawImage(e,0,0,a.width,a.height),Ye(e)),a}function il(e,t){const{width:n}=e,{height:r}=e,[o,s]=lr(n,r);switch(t>4&&t<9?(o.width=r,o.height=n):(o.width=n,o.height=r),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,r);break;case 4:s.transform(1,0,0,-1,0,r);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,r,0);break;case 7:s.transform(0,-1,-1,0,r,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,r),Ye(e),o}function js(e,t,n=0){return new Promise((function(r,o){let s,a,i,m,f,l,c,d,h,g,b,y,v,A,T,_,D,k,E,x;function w(P=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=P,t.onProgress(Math.min(s,100))}function j(P){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(P,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,w(),Yn(e,t).then((function(P){try{return[,m]=P,w(),f=al(m,t),w(),new Promise((function(O,F){var I;if(!(I=t.exifOrientation))return sl(e).then((function(S){try{return I=S,z.call(this)}catch(C){return F(C)}}).bind(this),F);function z(){return O(I)}return z.call(this)})).then((function(O){try{return l=O,w(),Bt().then((function(F){try{return c=F?f:il(f,l),w(),d=t.initialQuality||1,h=t.fileType||e.type,Xn(c,h,e.name,e.lastModified,d).then((function(I){try{{let S=function(){if(a--&&(T>i||T>v)){let H,M;return H=x?.95*E.width:E.width,M=x?.95*E.height:E.height,[D,k]=lr(H,M),k.drawImage(E,0,0,H,M),d*=h==="image/png"?.85:.95,Xn(D,h,e.name,e.lastModified,d).then((function(U){try{return _=U,Ye(E),E=D,T=_.size,j(Math.min(99,Math.floor((A-T)/(A-i)*100))),S}catch(q){return o(q)}}),o)}return[1]},C=function(){return Ye(E),Ye(D),Ye(f),Ye(c),Ye(m),j(100),r(_)};if(g=I,w(),b=g.size>i,y=g.size>e.size,!b&&!y)return j(100),r(g);var z;return v=e.size,A=g.size,T=A,E=c,x=!t.alwaysKeepResolution&&b,(z=(function(H){for(;H;){if(H.then)return void H.then(z,o);try{if(H.pop){if(H.length)return H.pop()?C.call(this):H;H=S}else H=H.call(this)}catch(M){return o(M)}}}).bind(this))(S)}}catch(S){return o(S)}}).bind(this),o)}catch(I){return o(I)}}).bind(this),o)}catch(F){return o(F)}}).bind(this),o)}catch(O){return o(O)}}).bind(this),o)}))}const zh=`
213
+ let scriptImported = false
214
+ self.addEventListener('message', async (e) => {
215
+ const { file, id, imageCompressionLibUrl, options } = e.data
216
+ options.onProgress = (progress) => self.postMessage({ progress, id })
217
+ try {
218
+ if (!scriptImported) {
219
+ // console.log('[worker] importScripts', imageCompressionLibUrl)
220
+ self.importScripts(imageCompressionLibUrl)
221
+ scriptImported = true
222
+ }
223
+ // console.log('[worker] self', self)
224
+ const compressedFile = await imageCompression(file, options)
225
+ self.postMessage({ file: compressedFile, id })
226
+ } catch (e) {
227
+ // console.error('[worker] error', e)
228
+ self.postMessage({ error: e.message + '\\n' + e.stack, id })
229
+ }
230
+ })
231
+ `;let Ar;function Hh(e,t){return new Promise(((n,r)=>{Ar||(Ar=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(zh));const o=new Worker(Ar);o.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)o.terminate();else if(a.data.progress===void 0){if(a.data.error)return r(new Error(a.data.error)),void o.terminate();n(a.data.file),o.terminate()}else t.onProgress(a.data.progress)})),o.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function Ne(e,t){return new Promise((function(n,r){let o,s,a,i,m,f;if(o={...t},a=0,{onProgress:i}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Uh))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return js(e,o).then((function(h){try{return s=h,d.call(this)}catch(g){return r(g)}}).bind(this),r);var l=(function(){try{return d.call(this)}catch(h){return r(h)}}).bind(this),c=function(h){try{return js(e,o).then((function(g){try{return s=g,l()}catch(b){return r(b)}}),r)}catch(g){return r(g)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Hh(e,o).then((function(h){try{return s=h,l()}catch{return c()}}),c)}catch{c()}function d(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(s=Qi(e,s))}catch{}return n(s)}}))}Ne.getDataUrlFromFile=tl,Ne.getFilefromDataUrl=Mo,Ne.loadImage=nl,Ne.drawImageInCanvas=ol,Ne.drawFileInCanvas=Yn,Ne.canvasToFile=Xn,Ne.getExifOrientation=sl,Ne.handleMaxWidthOrHeight=al,Ne.followExifOrientation=il,Ne.cleanupCanvasMemory=Ye,Ne.isAutoOrientationInBrowser=Bt,Ne.approximateBelowMaximumCanvasSizeOfBrowser=rl,Ne.copyExifWithoutOrientation=Qi,Ne.getBrowserName=Et,Ne.version="2.0.2";function On(e){return e.type==="tool_call"?e.toolCall.id:e.id}function Bh(e){switch(e.type){case"user_message":return e.content;case"assistant_message":return e.chunks.map(t=>"text"in t?t.text:"").join(`
232
+ `);case"tool_call":{const t=[e.toolCall.title];try{e.toolCall.rawInput&&t.push(JSON.stringify(e.toolCall.rawInput)),e.toolCall.rawOutput&&t.push(JSON.stringify(e.toolCall.rawOutput))}catch{}return t.join(`
233
+ `)}case"plan":return e.entries.map(t=>t.content).join(`
234
+ `);case"command_output":return`${e.inputText}
235
+ ${e.outputText}`;default:return""}}function by(e,t){const n=t.trim();if(!n)return{matchIds:new Set,orderedMatchIds:[]};const r=n.toLowerCase(),o=[];for(const s of e)Bh(s).toLowerCase().includes(r)&&o.push(On(s));return{matchIds:new Set(o),orderedMatchIds:o}}var Wh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bt=Wh.reduce((e,t)=>{const n=Ea(`Primitive.${t}`),r=p.forwardRef((o,s)=>{const{asChild:a,...i}=o,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Gh=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"}),Vh="VisuallyHidden",ll=p.forwardRef((e,t)=>u.jsx(ge.span,{...e,ref:t,style:{...Gh,...e.style}}));ll.displayName=Vh;var Kh=ll,[cr]=at("Tooltip",[en]),ur=en(),cl="TooltipProvider",qh=700,Xr="tooltip.open",[Yh,Po]=cr(cl),ul=e=>{const{__scopeTooltip:t,delayDuration:n=qh,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),u.jsx(Yh,{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,r)},[r]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:o,children:s})};ul.displayName=cl;var dn="Tooltip",[Xh,wn]=cr(dn),dl=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=Po(dn,e.__scopeTooltip),f=ur(t),[l,c]=p.useState(null),d=Me(),h=p.useRef(0),g=a??m.disableHoverableContent,b=i??m.delayDuration,y=p.useRef(!1),[v,A]=pt({prop:r,defaultProp:o??!1,onChange:E=>{E?(m.onOpen(),document.dispatchEvent(new CustomEvent(Xr))):m.onClose(),s==null||s(E)},caller:dn}),T=p.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),_=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,A(!0)},[A]),D=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,A(!1)},[A]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,A(!0),h.current=0},b)},[b,A]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),u.jsx(yo,{...f,children:u.jsx(Xh,{scope:t,contentId:d,open:v,stateAttribute:T,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?k():_()},[m.isOpenDelayedRef,k,_]),onTriggerLeave:p.useCallback(()=>{g?D():(window.clearTimeout(h.current),h.current=0)},[D,g]),onOpen:_,onClose:D,disableHoverableContent:g,children:n})})};dl.displayName=dn;var Qr="TooltipTrigger",fl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=wn(Qr,n),s=Po(Qr,n),a=ur(n),i=p.useRef(null),m=Ce(t,i,o.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),u.jsx(or,{asChild:!0,...a,children:u.jsx(ge.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:m,onPointerMove:te(e.onPointerMove,d=>{d.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),l.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{o.onTriggerLeave(),l.current=!1}),onPointerDown:te(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:te(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:te(e.onBlur,o.onClose),onClick:te(e.onClick,o.onClose)})})});fl.displayName=Qr;var Oo="TooltipPortal",[Qh,Jh]=cr(Oo,{forceMount:void 0}),ml=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=wn(Oo,t);return u.jsx(Qh,{scope:t,forceMount:n,children:u.jsx($e,{present:n||s.open,children:u.jsx(xn,{asChild:!0,container:o,children:r})})})};ml.displayName=Oo;var Yt="TooltipContent",pl=p.forwardRef((e,t)=>{const n=Jh(Yt,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,a=wn(Yt,e.__scopeTooltip);return u.jsx($e,{present:r||a.open,children:a.disableHoverableContent?u.jsx(hl,{side:o,...s,ref:t}):u.jsx(Zh,{side:o,...s,ref:t})})}),Zh=p.forwardRef((e,t)=>{const n=wn(Yt,e.__scopeTooltip),r=Po(Yt,e.__scopeTooltip),o=p.useRef(null),s=Ce(t,o),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=o.current,{onPointerInTransitChange:c}=r,d=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,b)=>{const y=g.currentTarget,v={x:g.clientX,y:g.clientY},A=rg(v,y.getBoundingClientRect()),T=og(v,A),_=sg(b.getBoundingClientRect()),D=ig([...T,..._]);i(D),c(!0)},[c]);return p.useEffect(()=>()=>d(),[d]),p.useEffect(()=>{if(m&&l){const g=y=>h(y,l),b=y=>h(y,m);return m.addEventListener("pointerleave",g),l.addEventListener("pointerleave",b),()=>{m.removeEventListener("pointerleave",g),l.removeEventListener("pointerleave",b)}}},[m,l,h,d]),p.useEffect(()=>{if(a){const g=b=>{const y=b.target,v={x:b.clientX,y:b.clientY},A=(m==null?void 0:m.contains(y))||(l==null?void 0:l.contains(y)),T=!ag(v,a);A?d():T&&(d(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,d]),u.jsx(hl,{...e,ref:s})}),[eg,tg]=cr(dn,{isInside:!1}),ng=qd("TooltipContent"),hl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,m=wn(Yt,n),f=ur(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(Xr,l),()=>document.removeEventListener(Xr,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=d=>{const h=d.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),u.jsx(hn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:u.jsxs(wo,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[u.jsx(ng,{children:r}),u.jsx(eg,{scope:n,isInside:!0,children:u.jsx(Kh,{id:m.contentId,role:"tooltip",children:o||r})})]})})});pl.displayName=Yt;var gl="TooltipArrow",xl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=ur(n);return tg(gl,n).isInside?null:u.jsx(Co,{...o,...r,ref:t})});xl.displayName=gl;function rg(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function og(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function sg(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function ag(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>r!=d>r&&n<(c-f)*(r-l)/(d-l)+f&&(o=!o)}return o}function ig(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),lg(t)}function lg(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}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 cg=ul,ug=dl,dg=fl,fg=ml,mg=pl,pg=xl;function hg({delayDuration:e=0,...t}){return u.jsx(cg,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function gg({...e}){return u.jsx(hg,{children:u.jsx(ug,{"data-slot":"tooltip",...e})})}function xg({...e}){return u.jsx(dg,{"data-slot":"tooltip-trigger",...e})}function vg({className:e,sideOffset:t=0,children:n,...r}){return u.jsx(fg,{children:u.jsxs(mg,{"data-slot":"tooltip-content",sideOffset:t,className:Z("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,u.jsx(pg,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const bg=p.lazy(()=>Ee(()=>import("./mermaid-VLURNSYL-B9hHZxgz.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));p.createContext(null);const Do=p.memo(({className:e,children:t,...n})=>u.jsx(p.Suspense,{fallback:u.jsx("div",{className:Z("whitespace-pre-wrap break-words",e),children:t}),children:u.jsx(bg,{className:Z("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);Do.displayName="MessageResponse";var dr="Collapsible",[yg]=at(dr),[wg,Lo]=yg(dr),vl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...i}=e,[m,f]=pt({prop:r,defaultProp:o??!1,onChange:a,caller:dr});return u.jsx(wg,{scope:n,disabled:s,contentId:Me(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:u.jsx(ge.div,{"data-state":$o(m),"data-disabled":s?"":void 0,...i,ref:t})})});vl.displayName=dr;var bl="CollapsibleTrigger",yl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Lo(bl,n);return u.jsx(ge.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":$o(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:te(e.onClick,o.onOpenToggle)})});yl.displayName=bl;var Fo="CollapsibleContent",wl=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Lo(Fo,e.__scopeCollapsible);return u.jsx($e,{present:n||o.open,children:({present:s})=>u.jsx(Cg,{...r,ref:t,present:s})})});wl.displayName=Fo;var Cg=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=Lo(Fo,n),[i,m]=p.useState(r),f=p.useRef(null),l=Ce(t,f),c=p.useRef(0),d=c.current,h=p.useRef(0),g=h.current,b=a.open||i,y=p.useRef(b),v=p.useRef(void 0);return p.useEffect(()=>{const A=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(A)},[]),nt(()=>{const A=f.current;if(A){v.current=v.current||{transitionDuration:A.style.transitionDuration,animationName:A.style.animationName},A.style.transitionDuration="0s",A.style.animationName="none";const T=A.getBoundingClientRect();c.current=T.height,h.current=T.width,y.current||(A.style.transitionDuration=v.current.transitionDuration,A.style.animationName=v.current.animationName),m(r)}},[a.open,r]),u.jsx(ge.div,{"data-state":$o(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!b,...s,ref:l,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:b&&o})});function $o(e){return e?"open":"closed"}var Sg=vl;function kg({...e}){return u.jsx(Sg,{"data-slot":"collapsible",...e})}function _g({...e}){return u.jsx(yl,{"data-slot":"collapsible-trigger",...e})}function Ag({...e}){return u.jsx(wl,{"data-slot":"collapsible-content",...e})}const Eg=({children:e,as:t="p",className:n,duration:r=2})=>{const o=Cc.create(t);return u.jsx(o,{animate:{opacity:[.5,1,.5]},className:Z("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:r,ease:"easeInOut"},children:e})},Tg=p.memo(Eg),Cl=p.createContext(null),jg=()=>{const e=p.useContext(Cl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Ng=1e3,Rg=1e3,Sl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:o,duration:s,children:a,...i})=>{const[m,f]=pt({prop:n,defaultProp:r,onChange:o}),[l,c]=pt({prop:s,defaultProp:void 0}),[d,h]=p.useState(!1),[g,b]=p.useState(null);p.useEffect(()=>{t?g===null&&b(Date.now()):g!==null&&(c(Math.ceil((Date.now()-g)/Rg)),b(null))},[t,g,c]);const y=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!y&&r&&!t&&m&&!d){const A=setTimeout(()=>{f(!1),h(!0)},Ng);return()=>clearTimeout(A)}},[t,m,r,f,d,y]);const v=A=>{f(A)};return u.jsx(Cl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:u.jsx(kg,{className:Z("not-prose mb-4",e),onOpenChange:v,open:m,...i,children:a})})}),Ig=(e,t)=>e||t===0?u.jsx(Tg,{duration:1,children:"Thinking..."}):t===void 0?u.jsx("p",{children:"Thought for a few seconds"}):u.jsxs("p",{children:["Thought for ",t," seconds"]}),kl=p.memo(({className:e,children:t,getThinkingMessage:n=Ig,...r})=>{const{isStreaming:o,isOpen:s,duration:a}=jg();return u.jsx(_g,{className:Z("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??u.jsxs(u.Fragment,{children:[u.jsx(_u,{className:"size-4"}),n(o,a),u.jsx(Qt,{className:Z("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),_l=p.memo(({className:e,children:t,...n})=>u.jsx(Ag,{className:Z("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));Sl.displayName="Reasoning";kl.displayName="ReasoningTrigger";_l.displayName="ReasoningContent";const Er=200;function Mg({entry:e,onRewind:t,onRewindAndEdit:n}){const[r,o]=p.useState(!1),[s,a]=p.useState(!1),i=p.useRef(null),m=p.useCallback(()=>{const f=i.current;f&&a(f.scrollHeight>Er+4)},[]);return p.useEffect(()=>{m()},[m,e.content]),u.jsxs("div",{className:"group/user flex justify-end items-start gap-2",children:[(t||n)&&u.jsxs("div",{className:"mt-1 flex items-center gap-0.5 opacity-0 transition-opacity group-hover/user:opacity-100",children:[t&&u.jsx("button",{type:"button",onClick:t,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:"回退到这里(对话与文件)",children:u.jsx(_d,{className:"h-3.5 w-3.5"})}),n&&u.jsx("button",{type:"button",onClick:n,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:"回退并编辑这条消息",children:u.jsx(ba,{className:"h-3.5 w-3.5"})})]}),u.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((f,l)=>u.jsx(Og,{image:f},l))}),e.attachments&&e.attachments.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((f,l)=>u.jsx(Dg,{attachment:f},l))}),e.content&&u.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[u.jsx("div",{ref:i,className:Z("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!r&&s&&`max-h-[${Er}px]`),style:!r&&s?{maxHeight:`${Er}px`}:void 0,children:pu(e.content)}),!r&&s&&u.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:u.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[u.jsx("span",{children:"展开"}),u.jsx(Qt,{className:"h-3 w-3"})]})})]})]})]})}function Pg({entry:e,isStreaming:t}){return u.jsxs("div",{className:"flex gap-4 items-start",children:[u.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[u.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,r)=>{if(n.type==="thought"){const o=r===e.chunks.length-1,s=t&&o;return u.jsxs(Sl,{isStreaming:s,children:[u.jsx(kl,{}),u.jsx(_l,{children:u.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},r)}return u.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:u.jsx(Do,{children:n.text})},r)})]})]})}function Og({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return u.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:u.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function Dg({attachment:e}){const[t,n]=p.useState(!1),r=(()=>{switch(e.kind){case"text":return u.jsx(Vt,{className:"h-4 w-4"});case"table":return u.jsx(co,{className:"h-4 w-4"});case"directory":return u.jsx(lo,{className:"h-4 w-4"});default:return u.jsx(Vt,{className:"h-4 w-4"})}})(),o=e.size!=null?Lg(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return u.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[u.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:Z("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[r,u.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[u.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),u.jsxs("div",{className:"text-[10px] text-text-muted",children:[o&&u.jsx("span",{children:o}),o&&s!=null&&u.jsx("span",{children:" · "}),s!=null&&u.jsxs("span",{children:[s," 个文件"]})]})]}),a&&u.jsx(Qt,{className:Z("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&u.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:u.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function Lg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Fg(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function $g(e){switch(e){case"allow_once":case"allow_always":return u.jsx(mn,{className:"size-4"});case"reject_once":case"reject_always":return u.jsx(pn,{className:"size-4"});default:return null}}function Ug({requestId:e,options:t,onRespond:n,className:r}){const o=s=>{n(e,s.optionId,s.kind)};return u.jsxs("div",{className:Z("p-3 border-t border-warning-border/30 bg-warning-bg/50",r),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(wa,{className:"size-4 text-warning-text"}),u.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),u.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>u.jsxs(Pt,{variant:Fg(s.kind),size:"sm",onClick:()=>o(s),className:"gap-1.5",children:[$g(s.kind),s.name]},s.optionId))})]})}const Ns=1e3,zg=1e6;function Tr({filePath:e,oldString:t,newString:n,label:r}){const o=Bg(t,n),s=Is(o,"add"),a=Is(o,"remove"),i=o.length>Ns?o.slice(0,Ns):o,m=o.length-i.length;return u.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[u.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[11px] text-text-primary",title:e,children:e}),s>0&&u.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",s]}),a>0&&u.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),r&&u.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:r})]}),u.jsxs("div",{role:"list","aria-label":`${e} 的改动预览,${s} 行新增,${a} 行删除`,className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>u.jsx(Hg,{line:f},l)),m>0&&u.jsxs("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:["… 还有 ",m," 行未显示"]})]})]})}function Hg({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return u.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?`新增行: ${e.text}`:e.type==="remove"?`删除行: ${e.text}`:void 0,className:Z("flex px-1 leading-relaxed",e.type==="add"&&"bg-green-500/10 text-green-700 dark:text-green-300",e.type==="remove"&&"bg-red-500/10 text-red-700 dark:text-red-300",e.type==="context"&&"text-text-secondary"),children:[u.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),u.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function Rs(e){return e.length===0?[]:e.split(`
236
+ `)}function Is(e,t){let n=0;for(const r of e)r.type===t&&n++;return n}function Bg(e,t){const n=Rs(e),r=Rs(t);let o=0;for(;o<n.length&&o<r.length&&n[o]===r[o];)o++;let s=n.length,a=r.length;for(;s>o&&a>o&&n[s-1]===r[a-1];)s--,a--;const i=[];for(let m=0;m<o;m++)i.push({type:"context",text:n[m]});Wg(n.slice(o,s),r.slice(o,a),i);for(let m=s;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function Wg(e,t,n){const r=e.length,o=t.length;if(r===0&&o===0)return;if(r*o>zg){for(const f of e)n.push({type:"remove",text:f});for(const f of t)n.push({type:"add",text:f});return}const s=o+1,a=new Uint32Array((r+1)*s);for(let f=r-1;f>=0;f--)for(let l=o-1;l>=0;l--)a[f*s+l]=e[f]===t[l]?a[(f+1)*s+l+1]+1:Math.max(a[(f+1)*s+l],a[f*s+l+1]);let i=0,m=0;for(;i<r&&m<o;)e[i]===t[m]?(n.push({type:"context",text:e[i]}),i++,m++):a[(i+1)*s+m]>=a[i*s+m+1]?(n.push({type:"remove",text:e[i]}),i++):(n.push({type:"add",text:t[m]}),m++);for(;i<r;)n.push({type:"remove",text:e[i]}),i++;for(;m<o;)n.push({type:"add",text:t[m]}),m++}function Al({entries:e,onPermissionRespond:t}){const[n,r]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return u.jsx("div",{className:"pl-10",children:u.jsx(Ms,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const o=Zg(e);return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[u.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand font-bold hover:bg-brand/10 transition-colors",onClick:()=>r(!n),children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Z("transition-transform text-text-muted",n&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs text-brand font-bold font-display",children:o})]}),n&&u.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>u.jsx(Ms,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function Ms({tool:e,compact:t,onPermissionRespond:n}){const[r,o]=p.useState(!t),s=(()=>{switch(e.status){case"running":return u.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return u.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return u.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return u.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=Dn(e);return u.jsxs("div",{className:Z("px-3 py-2",t&&"py-1.5"),children:[u.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>o(!r),children:[s,u.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&u.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&u.jsx("div",{className:"mt-1.5 ml-4",children:u.jsx(Ug,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),r&&u.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:Qg(e)??u.jsxs(u.Fragment,{children:[e.rawInput&&Object.keys(e.rawInput).length>0&&u.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:jt(JSON.stringify(e.rawInput,null,2),2e3)}),a&&u.jsx(Ln,{tool:e})]})})]})}const Gg=new Set(["FileEditTool","Edit","SedEdit"]),Vg=new Set(["FileWriteTool","Write"]),Kg=new Set(["MultiEdit"]),qg=new Set(["BashTool","Bash","PowerShellTool"]),Yg=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],Xg=["output","stdout","stderr","result"];function Qg(e){const t=tx(e.title),n=e.rawInput??{};if(Gg.has(t)){const r=qe(n,["old_string","oldString"]),o=qe(n,["new_string","newString"]);return r===void 0||o===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx(Tr,{filePath:qe(n,["file_path","filePath"])??t,oldString:r,newString:o}),Dn(e)&&u.jsx(Ln,{tool:e})]})}if(Vg.has(t)){const r=qe(n,["file_path","filePath"]),o=qe(n,["content"]);if(r===void 0||o===void 0)return null;const s=qe(e.rawOutput??{},Yg);return u.jsxs(u.Fragment,{children:[u.jsx(Tr,{filePath:r,oldString:s??"",newString:o,label:s===void 0?"新文件":void 0}),Dn(e)&&u.jsx(Ln,{tool:e})]})}if(Kg.has(t)){const r=n.edits;if(Array.isArray(r)&&r.length>0){const o=qe(n,["file_path","filePath"])??t,s=[];for(let a=0;a<r.length;a++){const i=r[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=qe(m,["old_string","oldString"]),l=qe(m,["new_string","newString"]);f===void 0||l===void 0||s.push(u.jsx(Tr,{filePath:o,oldString:f,newString:l,label:`#${a+1}`},a))}if(s.length>0)return u.jsxs(u.Fragment,{children:[s,Dn(e)&&u.jsx(Ln,{tool:e})]})}return null}if(qg.has(t)){const r=qe(n,["command","cmd","script"]),o=nx(e);return r===void 0&&o.length===0?null:u.jsx(Jg,{command:r!==void 0?jt(r,500):void 0,output:o,isError:e.status==="error"})}return null}function Jg({command:e,output:t,isError:n}){return u.jsx("div",{className:Z("rounded-md border overflow-hidden",n?"border-status-error/50":"border-border"),children:u.jsxs("div",{className:"max-h-36 overflow-auto bg-zinc-900 px-2 py-1.5 font-mono text-xs text-zinc-300",children:[e&&u.jsxs("div",{className:"whitespace-pre-wrap break-words text-zinc-500",children:["$ ",e]}),t.length>0&&u.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})]})})}function Zg(e){const t=new Map;for(const r of e){const o=ex(r.toolCall.title);t.set(o,(t.get(o)||0)+1)}const n=[];for(const[r,o]of t)n.push(o===1?r:`${o} 次${r}`);return n.length===0?`${e.length} 个工具调用`:n.length===1?n[0]:`${e.length} 个工具: ${n.join("、")}`}function ex(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function tx(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function qe(e,t){for(const n of t){const r=e[n];if(typeof r=="string")return r}}function Dn(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function El(e){return!e.content||e.content.length===0?[]:e.content.filter(t=>t.type==="content").filter(t=>t.content.type==="text"&&"text"in t.content).map(t=>t.content.text)}function nx(e){const t=El(e);if(t.length>0)return jt(t.join(`
237
+ `),2e3);const n=e.rawOutput;if(n){for(const r of Xg){const o=n[r];if(typeof o=="string"&&o.length>0)return jt(o,2e3)}if(Object.keys(n).length>0)return jt(JSON.stringify(n,null,2),2e3)}return""}function Ln({tool:e}){return u.jsx("pre",{className:Z("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:rx(e)})}function rx(e){const t=El(e);return t.length>0?jt(t.join(`
238
+ `),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?jt(JSON.stringify(e.rawOutput,null,2),2e3):""}function jt(e,t){return e.length>t?e.slice(0,t)+"...":e}function ox({entry:e}){const[t,n]=p.useState(!1),{entries:r}=e;if(r.length===0)return null;const o=r.filter(i=>i.status==="completed").length,s=r.length,a=s>0?Math.round(o/s*100):0;return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[u.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:Z("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[o,"/",s]}),u.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:u.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&u.jsx("div",{className:Z("border-t border-border px-3 py-1.5 space-y-0.5",s>5&&"max-h-64 overflow-y-auto"),children:r.map((i,m)=>u.jsx(sx,{entry:i},m))})]})})}function sx({entry:e}){return u.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[u.jsx("span",{className:"flex-shrink-0 mt-0.5",children:u.jsx(ax,{status:e.status})}),u.jsx("span",{className:Z("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),u.jsx(ix,{priority:e.priority})]})}function ax({status:e}){switch(e){case"completed":return u.jsx(Iu,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return u.jsx(xa,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return u.jsx(Pu,{className:"h-3.5 w-3.5 text-text-muted"})}}function ix({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:"高",medium:"中",low:"低"};return u.jsx("span",{className:Z("text-[9px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function lx({entry:e}){const t=e.variant==="error";return u.jsxs("div",{className:"w-full",children:[u.jsx("div",{className:Z("border-t-2",t?"border-status-error":"border-border")}),u.jsxs("div",{className:"pt-3",children:[u.jsx("h3",{className:Z("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&u.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),u.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:u.jsx(Do,{children:e.outputText})}),u.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
239
+ * Copyright (c) StackBlitz. All rights reserved.
240
+ * Licensed under the MIT License. See License.txt in the project root for license information.
241
+ *--------------------------------------------------------------------------------------------*/const cx={damping:.7,stiffness:.05,mass:1.25},ux=70,dx=1e3/60,fx=350;let fr=!1;var Ys;(Ys=globalThis.document)==null||Ys.addEventListener("mousedown",()=>{fr=!0});var Xs;(Xs=globalThis.document)==null||Xs.addEventListener("mouseup",()=>{fr=!1});var Qs;(Qs=globalThis.document)==null||Qs.addEventListener("click",()=>{fr=!1});const mx=(e={})=>{const[t,n]=p.useState(!1),[r,o]=p.useState(e.initial!==!1),[s,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var _;if(!fr)return!1;const A=window.getSelection();if(!A||!A.rangeCount)return!1;const T=A.getRangeAt(0);return T.commonAncestorContainer.contains(y.current)||((_=y.current)==null?void 0:_.contains(T.commonAncestorContainer))},[]),f=p.useCallback(A=>{c.isAtBottom=A,o(A)},[]),l=p.useCallback(A=>{c.escapedFromLock=A,n(A)},[]),c=p.useMemo(()=>{let A;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var T;return((T=y.current)==null?void 0:T.scrollTop)??0},set scrollTop(T){if(y.current){const{scrollBehavior:_}=getComputedStyle(y.current);_!=="auto"&&(y.current.style.scrollBehavior="auto"),y.current.scrollTop=T,c.ignoreScrollToTop=y.current.scrollTop,_!=="auto"&&(y.current.style.scrollBehavior=_)}},get targetScrollTop(){return!y.current||!v.current?0:y.current.scrollHeight-1-y.current.clientHeight},get calculatedTargetScrollTop(){if(!y.current||!v.current)return 0;const{targetScrollTop:T}=this;if(!e.targetScrollTop)return T;if((A==null?void 0:A.targetScrollTop)===T)return A.calculatedScrollTop;const _=Math.max(Math.min(e.targetScrollTop(T,{scrollElement:y.current,contentElement:v.current}),T),0);return A={targetScrollTop:T,calculatedScrollTop:_},requestAnimationFrame(()=>{A=void 0}),_},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=ux}}},[]),d=p.useCallback((A={})=>{var w;typeof A=="string"&&(A={animation:A}),A.preserveScrollPosition||f(!0);const T=Date.now()+(Number(A.wait)||0),_=Nr(i.current,A.animation),{ignoreEscapes:D=!1}=A;let k,E=c.calculatedTargetScrollTop;A.duration instanceof Promise?A.duration.finally(()=>{k=Date.now()}):k=T+(A.duration??0);const x=async()=>{const j=new Promise(requestAnimationFrame).then(()=>{var I;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:P}=c,O=performance.now(),F=(O-(c.lastTick??O))/dx;if(c.animation||(c.animation={behavior:_,promise:j,ignoreEscapes:D}),c.animation.behavior===_&&(c.lastTick=O),m()||T>Date.now())return x();if(P<Math.min(E,c.calculatedTargetScrollTop)){if(((I=c.animation)==null?void 0:I.behavior)===_){if(_==="instant")return c.scrollTop=c.calculatedTargetScrollTop,x();c.velocity=(_.damping*c.velocity+_.stiffness*c.scrollDifference)/_.mass,c.accumulated+=c.velocity*F,c.scrollTop+=c.accumulated,c.scrollTop!==P&&(c.accumulated=0)}return x()}return k>Date.now()?(E=c.calculatedTargetScrollTop,x()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?d({animation:Nr(i.current,i.current.resize),ignoreEscapes:D,duration:Math.max(0,k-Date.now())||void 0}):c.isAtBottom)});return j.then(P=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),P))};return A.wait!==!0&&(c.animation=void 0),((w=c.animation)==null?void 0:w.behavior)===_?c.animation.promise:x()},[f,m,c]),h=p.useCallback(()=>{l(!0),f(!1)},[l,f]),g=p.useCallback(({target:A})=>{if(A!==y.current)return;const{scrollTop:T,ignoreScrollToTop:_}=c;let{lastScrollTop:D=T}=c;c.lastScrollTop=T,c.ignoreScrollToTop=void 0,_&&_>T&&(D=_),a(c.isNearBottom),setTimeout(()=>{var x;if(c.resizeDifference||T===_)return;if(m()){l(!0),f(!1);return}const k=T>D,E=T<D;if((x=c.animation)!=null&&x.ignoreEscapes){c.scrollTop=D;return}E&&(l(!0),f(!1)),k&&l(!1),!c.escapedFromLock&&c.isNearBottom&&f(!0)},1)},[l,f,m,c]),b=p.useCallback(({target:A,deltaY:T})=>{var D;let _=A;for(;!["scroll","auto"].includes(getComputedStyle(_).overflow);){if(!_.parentElement)return;_=_.parentElement}_===y.current&&T<0&&y.current.scrollHeight>y.current.clientHeight&&!((D=c.animation)!=null&&D.ignoreEscapes)&&(l(!0),f(!1))},[l,f,c]),y=Ps(A=>{var T,_;(T=y.current)==null||T.removeEventListener("scroll",g),(_=y.current)==null||_.removeEventListener("wheel",b),A==null||A.addEventListener("scroll",g,{passive:!0}),A==null||A.addEventListener("wheel",b,{passive:!0})},[]),v=Ps(A=>{var _,D;if((_=c.resizeObserver)==null||_.disconnect(),!A)return;let T;c.resizeObserver=new ResizeObserver(([k])=>{const{height:E}=k.contentRect,x=E-(T??E);if(c.resizeDifference=x,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),a(c.isNearBottom),x>=0){const w=Nr(i.current,T?i.current.resize:i.current.initial);d({animation:w,wait:!0,preserveScrollPosition:!0,duration:w==="instant"?void 0:fx})}else c.isNearBottom&&(l(!1),f(!0));T=E,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===x&&(c.resizeDifference=0)},1)})}),(D=c.resizeObserver)==null||D.observe(A)},[]);return{contentRef:v,scrollRef:y,scrollToBottom:d,stopScroll:h,isAtBottom:r||s,isNearBottom:s,escapedFromLock:t,state:c}};function Ps(e,t){const n=p.useCallback(r=>(n.current=r,e(r)),t);return n}const jr=new Map;function Nr(...e){const t={...cx};let n=!1;for(const o of e){if(o==="instant"){n=!0;continue}typeof o=="object"&&(n=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}const r=JSON.stringify(t);return jr.has(r)||jr.set(r,Object.freeze(t)),n?"instant":jr.get(r)}/*!---------------------------------------------------------------------------------------------
242
+ * Copyright (c) StackBlitz. All rights reserved.
243
+ * Licensed under the MIT License. See License.txt in the project root for license information.
244
+ *--------------------------------------------------------------------------------------------*/const Tl=p.createContext(null),px=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Qn({instance:e,children:t,resize:n,initial:r,mass:o,damping:s,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((D,k)=>{const E=(_==null?void 0:_.targetScrollTop)??i;return(E==null?void 0:E(D,k))??D},[i]),d=mx({mass:o,damping:s,stiffness:a,resize:n,initial:r,targetScrollTop:c}),{scrollRef:h,contentRef:g,scrollToBottom:b,stopScroll:y,isAtBottom:v,escapedFromLock:A,state:T}=e??d,_=p.useMemo(()=>({scrollToBottom:b,stopScroll:y,scrollRef:h,isAtBottom:v,escapedFromLock:A,contentRef:g,state:T,get targetScrollTop(){return l.current},set targetScrollTop(D){l.current=D}}),[b,v,g,h,y,A,T]);return p.useImperativeHandle(m,()=>_,[_]),px(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(Tl.Provider,{value:_},p.createElement("div",{...f},typeof t=="function"?t(_):t))}(function(e){function t({children:n,scrollClassName:r,...o}){const s=Uo();return p.createElement("div",{ref:s.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},p.createElement("div",{...o,ref:s.contentRef},typeof n=="function"?n(s):n))}e.Content=t})(Qn||(Qn={}));function Uo(){const e=p.useContext(Tl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const hx=({className:e,...t})=>u.jsx(Qn,{className:Z("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),gx=({className:e,...t})=>u.jsx(Qn.Content,{className:Z("mx-auto flex max-w-3xl flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),xx=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:r,children:o,...s})=>u.jsx("div",{className:Z("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:o??u.jsxs(u.Fragment,{children:[r&&u.jsx("div",{className:"text-text-muted",children:r}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&u.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),vx=({className:e,...t})=>{const{scrollToBottom:n}=Uo(),r=p.useCallback(()=>{n()},[n]);return u.jsx(Pt,{className:Z("rounded-full",e),onClick:r,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:u.jsx(Su,{className:"size-4"})})},bx="data-last-user-message",yx=({className:e,...t})=>{const n=p.useCallback(()=>{const r=document.querySelector(`[${bx}="true"]`);r&&r.scrollIntoView({behavior:"smooth",block:"start"})},[]);return u.jsx(Pt,{className:Z("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:u.jsx(Sa,{className:"size-4"})})},wx=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:r}=Uo();return r?null:u.jsxs("div",{className:Z("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&u.jsx(yx,{}),u.jsx(vx,{})]})};function Cx({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:r="开始对话",emptyDescription:o="输入消息开始聊天",searchMatchIds:s,onRewindEntry:a}){var h;const i=_x(e),m=e.length>0;let f=-1;for(let g=i.length-1;g>=0;g--){const b=i[g];if(b.type==="single"&&b.entry.type==="user_message"){f=g;break}}const l=t&&e.length>0&&((h=e[e.length-1])==null?void 0:h.type)==="user_message",c=!!s&&s.size>0,d=g=>c&&!s.has(On(g));return u.jsx(hx,{className:"flex-1",children:u.jsxs(gx,{children:[m?u.jsxs(u.Fragment,{children:[i.map((g,b)=>{if(g.type==="single"){const v=g.entry.type==="user_message"&&b===f;return u.jsx("div",{"data-last-user-message":v?"true":void 0,"data-entry-id":On(g.entry),className:Z(Sx(e,b),d(g.entry)&&"opacity-40"),children:u.jsx(kx,{entry:g.entry,isLoading:t,onPermissionRespond:n,onRewindEntry:a})},`entry-${b}`)}const y=g.entries.every(d);return u.jsx("div",{"data-entry-id":On(g.entries[0]),className:Z("-mt-2",y&&"opacity-40"),children:u.jsx(Al,{entries:g.entries,onPermissionRespond:n})},`group-${b}`)}),l&&u.jsxs("div",{className:"flex gap-4 items-start",children:[u.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsx("div",{className:"flex items-center gap-1 pt-2",children:u.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[u.jsx("span",{}),u.jsx("span",{}),u.jsx("span",{})]})})]})]}):u.jsx(xx,{title:r,description:o}),u.jsx(wx,{hasUserMessages:e.some(g=>g.type==="user_message")})]})})}function Sx(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 r=e[t+1];return(r==null?void 0:r.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 kx({entry:e,isLoading:t,onPermissionRespond:n,onRewindEntry:r}){switch(e.type){case"user_message":return u.jsx(Mg,{entry:e,onRewind:r?()=>r(e,"rewind"):void 0,onRewindAndEdit:r?()=>r(e,"edit"):void 0});case"assistant_message":return u.jsx(Pg,{entry:e,isStreaming:t});case"tool_call":return u.jsx(Al,{entries:[e],onPermissionRespond:n});case"plan":return u.jsx(ox,{entry:e});case"command_output":return u.jsx(lx,{entry:e});default:return null}}function _x(e){const t=[];let n=[];const r=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const o of e)o.type==="tool_call"?n.push(o):(r(),t.push({type:"single",entry:o}));return r(),t}function Ax(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function Ex({commands:e,filter:t,onSelect:n,onClose:r,className:o}){const s=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>Ax(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{s.current&&!s.current.contains(l.target)&&r()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),p.useEffect(()=>{const f=l=>{if(m.length!==0){if(l.key==="ArrowDown")l.preventDefault(),i(c=>(c+1)%m.length);else if(l.key==="ArrowUp")l.preventDefault(),i(c=>(c-1+m.length)%m.length);else if(l.key==="Enter"&&!l.shiftKey){l.preventDefault();const c=m[a];c&&n(c)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=s.current;if(!f)return;const l=f.querySelector("[data-active='true']");l==null||l.scrollIntoView({block:"nearest"})},[a]),u.jsx("div",{ref:s,className:Z("rounded-xl border border-border bg-surface-2 shadow-lg",o),children:u.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?u.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:"没有匹配的命令"}):m.map((f,l)=>{var c;return u.jsxs("button",{type:"button","data-active":l===a,onClick:()=>n(f),onMouseEnter:()=>i(l),className:Z("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",l===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[u.jsxs("span",{className:"text-sm font-display font-medium text-brand",children:["/",f.name]}),u.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((c=f.input)==null?void 0:c.hint)&&u.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function Tt(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 jl="rcs_input_history_";function Nl(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function Jr(e,t=Nl()){if(!t||!e)return[];try{const n=t.getItem(jl+e);if(!n)return[];const r=JSON.parse(n);return Array.isArray(r)?r.filter(o=>typeof o=="string"):[]}catch{return[]}}function Tx(e,t,n=Nl()){const r=t.trim();if(!n||!e||!r)return Jr(e,n);const o=Jr(e,n);if(o[o.length-1]===r)return o;o.push(r);const s=o.slice(-100);try{n.setItem(jl+e,JSON.stringify(s))}catch{}return s}class jx{constructor(){re(this,"entries",[]);re(this,"draft","");re(this,"cursor",-1)}get active(){return this.cursor>=0}begin(t,n){this.entries=t,this.draft=n,this.cursor=-1}up(){return this.entries.length===0?null:(this.cursor===-1?this.cursor=this.entries.length-1:this.cursor>0&&(this.cursor-=1),this.entries[this.cursor]??null)}down(){return this.cursor===-1?null:this.cursor>=this.entries.length-1?(this.cursor=-1,this.draft):(this.cursor+=1,this.entries[this.cursor]??null)}reset(){this.cursor=-1,this.entries=[],this.draft=""}}const Nx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},Rx=500*1024,Rl=2*1024*1024,Rr=200,Os=5*1024*1024,Ix=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"]),Mx=new Set([".csv",".tsv",".xlsx",".xls"]);function fn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Il(e){if(e.type.startsWith("text/"))return!0;const t=fn(e.name);return Ix.has(t)}function Zr(e){const t=fn(e.name);return Mx.has(t)}function Px({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:r=!1,placeholder:o="给 Saluzi 发送消息…",supportsAttachments:s,supportsImages:a,commands:i,onCycleMode:m,queueWhileLoading:f,queuedCount:l,onDequeue:c,onSearchFiles:d,historyKey:h,draftOverride:g,className:b}){const y=s??a??!1,[v,A]=p.useState(""),[T,_]=p.useState([]),[D,k]=p.useState([]),[E,x]=p.useState(!1),[w,j]=p.useState(""),[P,O]=p.useState(!1),[F,I]=p.useState(!1),[z,S]=p.useState(!1),[C,H]=p.useState(null),[M,U]=p.useState([]),[q,R]=p.useState(0),L=p.useRef(0),$=p.useRef(null),N=p.useRef(null),B=p.useRef(null),G=p.useRef(null),V=p.useRef(null),K=p.useRef(null),oe=p.useRef(null),J=p.useRef(new jx),ne=p.useRef(h);ne.current=h,p.useEffect(()=>{Tt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:y,commandsCount:(i==null?void 0:i.length)??0})},[y,i]),p.useEffect(()=>{!g||g.nonce===0||(A(g.text),J.current.reset(),requestAnimationFrame(()=>{var W;return(W=$.current)==null?void 0:W.focus()}))},[g]),p.useEffect(()=>{if(!F)return;const W=Y=>{var ue,je;const ee=Y.target,pe=(ue=K.current)==null?void 0:ue.contains(ee),Se=(je=oe.current)==null?void 0:je.contains(ee);!pe&&!Se&&I(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[F]);const ie=p.useCallback(W=>{const Y=(W??v).trim(),ee=T.length>0||D.length>0;!Y&&!ee||r||z||(e({text:Y,images:T.length>0?T:void 0,attachments:D.length>0?D:void 0}),ne.current&&Y&&Tx(ne.current,Y),J.current.reset(),A(""),_([]),k([]),x(!1),j(""),$.current&&($.current.style.height="auto"))},[v,T,D,r,z,e]),ve=p.useCallback(W=>{const Y=ne.current;if(!Y)return!1;const ee=J.current;if(W==="up"){if(v!=="")return!1;ee.active||ee.begin(Jr(Y),v);const Se=ee.up();return Se===null?!1:(A(Se),requestAnimationFrame(()=>{const ue=$.current;ue&&(ue.focus(),ue.setSelectionRange(Se.length,Se.length))}),!0)}if(!ee.active)return!1;const pe=ee.down();return pe===null?!1:(A(pe),requestAnimationFrame(()=>{const Se=$.current;Se&&(Se.focus(),Se.setSelectionRange(pe.length,pe.length))}),!0)},[v]),ce=p.useCallback(async W=>{if(!d)return;const Y=++L.current;try{const ee=await d(W);L.current===Y&&U(ee.slice(0,8))}catch{L.current===Y&&U([])}},[d]),be=p.useCallback(W=>{const Y=$.current;if(!Y||C===null)return;const ee=Y.selectionStart??v.length,pe=v.slice(0,ee),Se=/(?:^|\s)@([^\s@]*)$/.exec(pe);if(!Se)return;const ue=ee-Se[1].length-1,je=`@${W} `,wt=v.slice(0,ue)+je+v.slice(ee);A(wt),H(null),U([]),requestAnimationFrame(()=>{const kn=ue+je.length;Y.focus(),Y.setSelectionRange(kn,kn)})},[v,C]),de=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(C!==null&&M.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),R(ee=>{const pe=W.key==="ArrowDown"?1:-1;return(ee+pe+M.length)%M.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const ee=M[q];ee&&be(ee);return}if(W.key==="Escape"){W.preventDefault(),H(null),U([]);return}}if(E){if(W.key==="Escape"){W.preventDefault(),x(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),x(!1);return}}if(W.key==="ArrowUp"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&ve("up")){W.preventDefault();return}if(W.key==="ArrowDown"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&ve("down")){W.preventDefault();return}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():ie())},[ie,t,f,m,n,E,C,M,q,be,ve]),le=p.useCallback(W=>{const Y=W.target.value;if(A(Y),J.current.reset(),Y.startsWith("/")&&i&&i.length>0&&!/\s/.test(Y.slice(1))?(x(!0),j(Y.slice(1))):E&&(x(!1),j("")),d){const pe=W.target.selectionStart??Y.length,Se=Y.slice(0,pe),ue=/(?:^|\s)@([^\s@]*)$/.exec(Se);if(ue){const je=ue[1]||"";H(je),R(0),ce(je)}else H(null),U([])}const ee=W.target;ee.style.height="auto",ee.style.height=Math.min(ee.scrollHeight,200)+"px"},[i,E,d,ce]),xe=p.useCallback(async W=>{if(Tt("[ChatInput] paste event",{canAttach:y,files:W.clipboardData.files.length,types:W.clipboardData.types}),!y)return;const Y=Array.from(W.clipboardData.files).filter(ee=>ee.type.startsWith("image/"));if(Tt("[ChatInput] paste image files",{count:Y.length,types:Y.map(ee=>ee.type)}),Y.length!==0){W.preventDefault(),S(!0);try{const ee=await Ir(Y);_(pe=>[...pe,...ee])}finally{S(!1)}}},[y]),ye=p.useCallback(async()=>{if(!N.current)return;const W=N.current.files;if(!(!W||W.length===0)){S(!0);try{const Y=await Ir(Array.from(W));_(ee=>[...ee,...Y])}finally{N.current.value="",S(!1)}}},[]),fe=p.useCallback(async()=>{if(!B.current)return;const W=B.current.files;if(!(!W||W.length===0)){S(!0);try{const Y=await Ds(Array.from(W));k(ee=>[...ee,...Y])}finally{B.current.value="",S(!1)}}},[]),_e=p.useCallback(async()=>{if(!G.current)return;const W=G.current.files;if(!(!W||W.length===0)){S(!0);try{const Y=await Ls(Array.from(W));k(ee=>[...ee,...Y])}finally{G.current.value="",S(!1)}}},[]),we=p.useCallback(async()=>{if(!V.current)return;const W=V.current.files;if(!(!W||W.length===0)){S(!0);try{const Y=await Dx(Array.from(W));Y&&k(ee=>[...ee,Y])}finally{V.current.value="",S(!1)}}},[]),he=p.useCallback(W=>{_(Y=>Y.filter((ee,pe)=>pe!==W))},[]),Re=p.useCallback(W=>{k(Y=>Y.filter((ee,pe)=>pe!==W))},[]),Ve=p.useCallback(W=>{var ee,pe;x(!1),j("");const Y=`/${W.name}`;(ee=W.input)!=null&&ee.hint?(A(`${Y} `),(pe=$.current)==null||pe.focus()):ie(Y)},[ie]),Lt=p.useCallback(W=>{y&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",P||O(!0))},[y,P]),Ae=p.useCallback(W=>{const Y=W.relatedTarget;(!Y||!W.currentTarget.contains(Y))&&O(!1)},[]),et=p.useCallback(async W=>{if(!y)return;const Y=Array.from(W.dataTransfer.files);if(Y.length!==0){W.preventDefault(),O(!1),S(!0);try{const ee=Y.filter(ue=>ue.type.startsWith("image/")),pe=Y.filter(ue=>!ue.type.startsWith("image/")&&Zr(ue)),Se=Y.filter(ue=>!ue.type.startsWith("image/")&&!Zr(ue)&&Il(ue));if(ee.length>0){const ue=await Ir(ee);_(je=>[...je,...ue])}if(pe.length>0){const ue=await Ls(pe);k(je=>[...je,...ue])}if(Se.length>0){const ue=await Ds(Se);k(je=>[...je,...ue])}}finally{S(!1)}}},[y]),Te=p.useCallback(()=>{var W;E?(x(!1),j("")):(v.startsWith("/")||A("/"+v),x(!0),j(v.startsWith("/")&&v.slice(1).split(/\s/)[0]||""),(W=$.current)==null||W.focus())},[E,v]),De=T.length+D.length,Ie=(v.trim()||De>0)&&!r&&!z;return u.jsxs("div",{className:Z("w-full max-w-3xl mx-auto px-4 sm:px-8 pb-4 pt-2",b),children:[u.jsxs("div",{className:"relative",children:[E&&i&&i.length>0&&u.jsx(Ex,{commands:i,filter:w,onSelect:Ve,onClose:()=>{x(!1),j("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),C!==null&&M.length>0&&u.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[u.jsxs("div",{className:"border-b border-border px-3 py-1.5 text-[11px] text-text-muted",children:["文件匹配 ",C?`“@${C}”`:""," — ↑↓ 选择,Enter 插入"]}),M.map((W,Y)=>u.jsxs("button",{type:"button",onMouseDown:ee=>{ee.preventDefault(),be(W)},onMouseEnter:()=>R(Y),className:Z("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",Y===q?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[u.jsx(Vt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),u.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),F&&y&&u.jsxs("div",{ref:K,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[u.jsxs("button",{type:"button",onClick:()=>{var W;I(!1),(W=N.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(Hu,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"图片"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;I(!1),(W=B.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(Vt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"文本文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;I(!1),(W=G.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(co,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"表格文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;I(!1),(W=V.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(lo,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"目录"})]})]}),u.jsxs("div",{onDragOver:Lt,onDragLeave:Ae,onDrop:et,className:Z("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",P&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[T.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:T.map((W,Y)=>u.jsxs("div",{className:"relative group",children:[u.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${Y+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),u.jsx("button",{type:"button",onClick:()=>he(Y),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${Y+1}`,children:"×"})]},Y))}),D.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:D.map((W,Y)=>u.jsx(Ox,{attachment:W,onRemove:()=>Re(Y)},Y))}),u.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[y&&u.jsxs("div",{className:"relative flex-shrink-0",children:[u.jsxs("button",{ref:oe,type:"button",onClick:()=>I(W=>!W),disabled:r||z,className:Z("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",F?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[u.jsx(od,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Attach"})]}),u.jsx("input",{ref:N,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ye}),u.jsx("input",{ref:B,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:fe}),u.jsx("input",{ref:G,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:_e}),u.jsx("input",{ref:V,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:we})]}),i&&i.length>0&&u.jsx("button",{type:"button",onClick:Te,className:Z("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-colors",E?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),disabled:r,title:"命令列表",children:u.jsx(xd,{className:"h-4 w-4"})}),u.jsx("textarea",{ref:$,value:v,onChange:le,onKeyDown:de,onPaste:xe,placeholder:z?"处理文件中…":o,disabled:r,rows:1,className:Z("flex-1 resize-none border-none bg-transparent outline-none","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),u.jsx("button",{type:"button",onClick:t?n:()=>ie(),disabled:!t&&!Ie,className:Z("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":Ie?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?u.jsx(bd,{className:"h-3.5 w-3.5",fill:"currentColor"}):z?u.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):u.jsx(ud,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&u.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[11px] text-text-muted font-display",children:[u.jsx(Du,{className:"h-3 w-3"}),u.jsxs("span",{children:[l," 条消息排队中,完成后自动发送",c?"(点击取消全部)":""]}),c&&u.jsxs("button",{type:"button",onClick:()=>{for(let W=l-1;W>=0;W--)c(W)},className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:[u.jsx(pn,{className:"h-3 w-3"}),"取消"]})]}),u.jsx("div",{className:"text-center mt-1.5",children:u.jsxs("span",{className:"text-[11px] text-text-muted font-display",children:["Enter 发送,Shift+Enter 换行",d?",@ 补全文件":""]})})]})}function Ox({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return u.jsx(Vt,{className:"h-3.5 w-3.5"});case"table":return u.jsx(co,{className:"h-3.5 w-3.5"});case"directory":return u.jsx(lo,{className:"h-3.5 w-3.5"});default:return u.jsx(Vt,{className:"h-3.5 w-3.5"})}})(),r=e.size!=null?Gt(e.size):null,o=e.kind==="directory"&&e.files?e.files.length:null;return u.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,u.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),r&&u.jsx("span",{className:"text-text-muted text-[10px]",children:r}),o!=null&&u.jsxs("span",{className:"text-text-muted text-[10px]",children:[o," 文件"]}),u.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:u.jsx(pn,{className:"h-3 w-3"})})]})}function Gt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Ir(e){const t=[];for(const n of e)try{let r=n,o=n.type;n.size>2*1024*1024&&(r=await Ne(n,Nx),o="image/jpeg");const s=await Lx(r);t.push({mimeType:o,data:s})}catch(r){console.error("Failed to process image:",r)}return t}async function Ds(e){const t=[];for(const n of e)try{if(n.size>Rl){console.warn(`Skipping ${n.name}: too large (${Gt(n.size)})`);continue}n.size>Rx&&console.warn(`File ${n.name} is large (${Gt(n.size)}), may slow down`);const r=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/plain"})}catch(r){console.error(`Failed to read text file ${n.name}:`,r)}return t}async function Ls(e){const t=[];for(const n of e)try{const r=fn(n.name);if(r===".csv"||r===".tsv"){const o=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:o,mimeType:n.type||"text/csv"})}else if(r===".xlsx"||r===".xls"){const o=await n.arrayBuffer(),s=await Ml(o);t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(r){console.error(`Failed to process table file ${n.name}:`,r)}return t}async function Ml(e){const t=await Ee(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),r=[];for(const o of n.SheetNames){const s=n.Sheets[o];if(!s)continue;const a=t.utils.sheet_to_csv(s);n.SheetNames.length>1?r.push(`## Sheet: ${o}
245
+
246
+ ${a}`):r.push(a)}return r.join(`
247
+
248
+ `)}async function Dx(e){if(e.length===0)return null;const t=e.filter(d=>!(d.name.startsWith(".")||d.size>Rl));t.length>Rr&&console.warn(`Directory has ${t.length} files, truncating to ${Rr}`);const n=t.slice(0,Rr);let r=0;for(const d of n)r+=d.size;r>Os&&console.warn(`Directory total size ${Gt(r)} exceeds limit, some files may be truncated`);const o=n[0].webkitRelativePath,s=o&&o.split("/")[0]||"目录",a=[],i=[];let m=0;const f=[...n].sort((d,h)=>{const g=d.webkitRelativePath||d.name,b=h.webkitRelativePath||h.name;return g.localeCompare(b)});for(const d of f){const h=d.webkitRelativePath||d.name;if(a.push(h),Il(d)||Zr(d))if(m+d.size<=Os)try{let g;if(fn(d.name)===".xlsx"||fn(d.name)===".xls"){const b=await d.arrayBuffer();g=await Ml(b)}else g=await d.text();i.push(`
249
+ ### ${h}
250
+ \`\`\`
251
+ ${g}
252
+ \`\`\``),m+=d.size}catch{i.push(`
253
+ ### ${h}
254
+ (读取失败)`)}else i.push(`
255
+ ### ${h}
256
+ (文件过大,已跳过)`);else d.type.startsWith("image/")?i.push(`
257
+ ### ${h}
258
+ (图片文件,${Gt(d.size)})`):i.push(`
259
+ ### ${h}
260
+ (二进制文件,${Gt(d.size)})`)}const l=a.join(`
261
+ `),c=[`# 目录: ${s}`,`共 ${a.length} 个文件`,"","## 文件结构","```",l,"```","","## 文件内容",...i].join(`
262
+ `);return{kind:"directory",name:s,size:r,textContent:c,files:a}}async function Lx(e){return new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>{const o=r.result,s=o.indexOf(",");t(s>=0?o.slice(s+1):o)},r.onerror=()=>n(new Error("FileReader error")),r.readAsDataURL(e)})}function Fx({requests:e,onRespond:t,className:n}){return e.length===0?null:u.jsx("div",{className:Z("w-full max-w-3xl mx-auto px-4",n),children:u.jsx("div",{className:"space-y-2",children:e.map(r=>u.jsx($x,{request:r,onRespond:t},r.requestId))})})}function $x({request:e,onRespond:t}){return u.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[u.jsx(wa,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&u.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-brand text-white text-xs font-medium hover:bg-brand-light transition-colors flex items-center gap-1.5",children:[u.jsx(mn,{className:"h-3.5 w-3.5"}),"允许"]}),u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-warning-border/30 text-warning-text text-xs font-medium hover:bg-warning-bg transition-colors flex items-center gap-1.5",children:[u.jsx(pn,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}function Fs(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function $s(e){return e<1e3?String(e):e<1e6?`${Fs((e/1e3).toFixed(1))}k`:`${Fs((e/1e6).toFixed(2))}M`}function Us(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function Ux({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push(Us(e.cost)),t.push(`${$s(e.used)} / ${$s(e.size)} tokens`);const n=[`上下文: ${e.used.toLocaleString()} / ${e.size.toLocaleString()} tokens`];return e.cost!=null&&e.cost.amount>0&&n.push(`累计成本: ${Us(e.cost)}`),u.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var mr="Popover",[Pl]=at(mr,[en]),Cn=en(),[zx,yt]=Pl(mr),Ol=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!1}=e,i=Cn(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,d]=pt({prop:r,defaultProp:o??!1,onChange:s,caller:mr});return u.jsx(yo,{...i,children:u.jsx(zx,{scope:t,contentId:Me(),triggerRef:m,open:c,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};Ol.displayName=mr;var Dl="PopoverAnchor",Hx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=yt(Dl,n),s=Cn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=o;return p.useEffect(()=>(a(),()=>i()),[a,i]),u.jsx(or,{...s,...r,ref:t})});Hx.displayName=Dl;var Ll="PopoverTrigger",Fl=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=yt(Ll,n),s=Cn(n),a=Ce(t,o.triggerRef),i=u.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Bl(o.open),...r,ref:a,onClick:te(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:u.jsx(or,{asChild:!0,...s,children:i})});Fl.displayName=Ll;var zo="PopoverPortal",[Bx,Wx]=Pl(zo,{forceMount:void 0}),$l=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=yt(zo,t);return u.jsx(Bx,{scope:t,forceMount:n,children:u.jsx($e,{present:n||s.open,children:u.jsx(xn,{asChild:!0,container:o,children:r})})})};$l.displayName=zo;var Xt="PopoverContent",Ul=p.forwardRef((e,t)=>{const n=Wx(Xt,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=yt(Xt,e.__scopePopover);return u.jsx($e,{present:r||s.open,children:s.modal?u.jsx(Vx,{...o,ref:t}):u.jsx(Kx,{...o,ref:t})})});Ul.displayName=Xt;var Gx=Kt("PopoverContent.RemoveScroll"),Vx=p.forwardRef((e,t)=>{const n=yt(Xt,e.__scopePopover),r=p.useRef(null),o=Ce(t,r),s=p.useRef(!1);return p.useEffect(()=>{const a=r.current;if(a)return So(a)},[]),u.jsx(so,{as:Gx,allowPinchZoom:!0,children:u.jsx(zl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;s.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:te(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Kx=p.forwardRef((e,t)=>{const n=yt(Xt,e.__scopePopover),r=p.useRef(!1),o=p.useRef(!1);return u.jsx(zl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),zl=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:l,...c}=e,d=yt(Xt,n),h=Cn(n);return uo(),u.jsx(Zn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u.jsx(hn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:l,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>d.onOpenChange(!1),children:u.jsx(wo,{"data-state":Bl(d.open),role:"dialog",id:d.contentId,...h,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Hl="PopoverClose",qx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=yt(Hl,n);return u.jsx(ge.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});qx.displayName=Hl;var Yx="PopoverArrow",Xx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Cn(n);return u.jsx(Co,{...o,...r,ref:t})});Xx.displayName=Yx;function Bl(e){return e?"open":"closed"}var Qx=Ol,Jx=Fl,Zx=$l,ev=Ul;function Wl({...e}){return u.jsx(Qx,{"data-slot":"popover",...e})}function Gl({...e}){return u.jsx(Jx,{"data-slot":"popover-trigger",...e})}function Vl({className:e,align:t="center",sideOffset:n=4,...r}){return u.jsx(Zx,{children:u.jsx(ev,{"data-slot":"popover-content",align:t,sideOffset:n,className:Z("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...r})})}var zs=1,tv=.9,nv=.8,rv=.17,Mr=.1,Pr=.999,ov=.9999,sv=.99,av=/[\\\/_+.#"@\[\(\{&]/,iv=/[\\\/_+.#"@\[\(\{&]/g,lv=/[\s-]/,Kl=/[\s-]/g;function eo(e,t,n,r,o,s,a){if(s===t.length)return o===e.length?zs:sv;var i=`${o},${s}`;if(a[i]!==void 0)return a[i];for(var m=r.charAt(s),f=n.indexOf(m,o),l=0,c,d,h,g;f>=0;)c=eo(e,t,n,r,f+1,s+1,a),c>l&&(f===o?c*=zs:av.test(e.charAt(f-1))?(c*=nv,h=e.slice(o,f-1).match(iv),h&&o>0&&(c*=Math.pow(Pr,h.length))):lv.test(e.charAt(f-1))?(c*=tv,g=e.slice(o,f-1).match(Kl),g&&o>0&&(c*=Math.pow(Pr,g.length))):(c*=rv,o>0&&(c*=Math.pow(Pr,f-o))),e.charAt(f)!==t.charAt(s)&&(c*=ov)),(c<Mr&&n.charAt(f-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(f-1)!==r.charAt(s))&&(d=eo(e,t,n,r,f+1,s+2,a),d*Mr>c&&(c=d*Mr)),c>l&&(l=c),f=n.indexOf(m,f+1);return a[i]=l,l}function Hs(e){return e.toLowerCase().replace(Kl," ")}function cv(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,eo(e,t,Hs(e),Hs(t),0,0,{})}var pr="Dialog",[ql]=at(pr),[uv,Ge]=ql(pr),Yl=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,l]=pt({prop:r,defaultProp:o??!1,onChange:s,caller:pr});return u.jsx(uv,{scope:t,triggerRef:i,contentRef:m,contentId:Me(),titleId:Me(),descriptionId:Me(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};Yl.displayName=pr;var Xl="DialogTrigger",dv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ge(Xl,n),s=Ce(t,o.triggerRef);return u.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Wo(o.open),...r,ref:s,onClick:te(e.onClick,o.onOpenToggle)})});dv.displayName=Xl;var Ho="DialogPortal",[fv,Ql]=ql(Ho,{forceMount:void 0}),Jl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Ge(Ho,t);return u.jsx(fv,{scope:t,forceMount:n,children:p.Children.map(r,a=>u.jsx($e,{present:n||s.open,children:u.jsx(xn,{asChild:!0,container:o,children:a})}))})};Jl.displayName=Ho;var Jn="DialogOverlay",Zl=p.forwardRef((e,t)=>{const n=Ql(Jn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Ge(Jn,e.__scopeDialog);return s.modal?u.jsx($e,{present:r||s.open,children:u.jsx(pv,{...o,ref:t})}):null});Zl.displayName=Jn;var mv=Kt("DialogOverlay.RemoveScroll"),pv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ge(Jn,n);return u.jsx(so,{as:mv,allowPinchZoom:!0,shards:[o.contentRef],children:u.jsx(ge.div,{"data-state":Wo(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Rt="DialogContent",ec=p.forwardRef((e,t)=>{const n=Ql(Rt,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Ge(Rt,e.__scopeDialog);return u.jsx($e,{present:r||s.open,children:s.modal?u.jsx(hv,{...o,ref:t}):u.jsx(gv,{...o,ref:t})})});ec.displayName=Rt;var hv=p.forwardRef((e,t)=>{const n=Ge(Rt,e.__scopeDialog),r=p.useRef(null),o=Ce(t,n.contentRef,r);return p.useEffect(()=>{const s=r.current;if(s)return So(s)},[]),u.jsx(tc,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault())})}),gv=p.forwardRef((e,t)=>{const n=Ge(Rt,e.__scopeDialog),r=p.useRef(!1),o=p.useRef(!1);return u.jsx(tc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),tc=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...a}=e,i=Ge(Rt,n),m=p.useRef(null),f=Ce(t,m);return uo(),u.jsxs(u.Fragment,{children:[u.jsx(Zn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u.jsx(hn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Wo(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),u.jsxs(u.Fragment,{children:[u.jsx(vv,{titleId:i.titleId}),u.jsx(yv,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Bo="DialogTitle",nc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ge(Bo,n);return u.jsx(ge.h2,{id:o.titleId,...r,ref:t})});nc.displayName=Bo;var rc="DialogDescription",xv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ge(rc,n);return u.jsx(ge.p,{id:o.descriptionId,...r,ref:t})});xv.displayName=rc;var oc="DialogClose",sc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ge(oc,n);return u.jsx(ge.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});sc.displayName=oc;function Wo(e){return e?"open":"closed"}var ac="DialogTitleWarning",[yy,ic]=Hd(ac,{contentName:Rt,titleName:Bo,docsSlug:"dialog"}),vv=({titleId:e})=>{const t=ic(ac),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
263
+
264
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
265
+
266
+ 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},bv="DialogDescriptionWarning",yv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ic(bv).contentName}}.`;return p.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},wv=Yl,Cv=Jl,Sv=Zl,kv=ec,wy=nc,Cy=sc,sn='[cmdk-group=""]',Or='[cmdk-group-items=""]',_v='[cmdk-group-heading=""]',lc='[cmdk-item=""]',Bs=`${lc}:not([aria-disabled="true"])`,to="cmdk-item-select",zt="data-value",Av=(e,t,n)=>cv(e,t,n),cc=p.createContext(void 0),Sn=()=>p.useContext(cc),uc=p.createContext(void 0),Go=()=>p.useContext(uc),dc=p.createContext(void 0),fc=p.forwardRef((e,t)=>{let n=Ht(()=>{var R,L;return{search:"",value:(L=(R=e.value)!=null?R:e.defaultValue)!=null?L:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ht(()=>new Set),o=Ht(()=>new Map),s=Ht(()=>new Map),a=Ht(()=>new Set),i=mc(e),{label:m,children:f,value:l,onValueChange:c,filter:d,shouldFilter:h,loop:g,disablePointerSelection:b=!1,vimBindings:y=!0,...v}=e,A=Me(),T=Me(),_=Me(),D=p.useRef(null),k=Lv();It(()=>{if(l!==void 0){let R=l.trim();n.current.value=R,E.emit()}},[l]),It(()=>{k(6,F)},[]);let E=p.useMemo(()=>({subscribe:R=>(a.current.add(R),()=>a.current.delete(R)),snapshot:()=>n.current,setState:(R,L,$)=>{var N,B,G,V;if(!Object.is(n.current[R],L)){if(n.current[R]=L,R==="search")O(),j(),k(1,P);else if(R==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(_);K?K.focus():(N=document.getElementById(A))==null||N.focus()}if(k(7,()=>{var K;n.current.selectedItemId=(K=I())==null?void 0:K.id,E.emit()}),$||k(5,F),((B=i.current)==null?void 0:B.value)!==void 0){let K=L??"";(V=(G=i.current).onValueChange)==null||V.call(G,K);return}}E.emit()}},emit:()=>{a.current.forEach(R=>R())}}),[]),x=p.useMemo(()=>({value:(R,L,$)=>{var N;L!==((N=s.current.get(R))==null?void 0:N.value)&&(s.current.set(R,{value:L,keywords:$}),n.current.filtered.items.set(R,w(L,$)),k(2,()=>{j(),E.emit()}))},item:(R,L)=>(r.current.add(R),L&&(o.current.has(L)?o.current.get(L).add(R):o.current.set(L,new Set([R]))),k(3,()=>{O(),j(),n.current.value||P(),E.emit()}),()=>{s.current.delete(R),r.current.delete(R),n.current.filtered.items.delete(R);let $=I();k(4,()=>{O(),($==null?void 0:$.getAttribute("id"))===R&&P(),E.emit()})}),group:R=>(o.current.has(R)||o.current.set(R,new Set),()=>{s.current.delete(R),o.current.delete(R)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:A,inputId:_,labelId:T,listInnerRef:D}),[]);function w(R,L){var $,N;let B=(N=($=i.current)==null?void 0:$.filter)!=null?N:Av;return R?B(R,n.current.search,L):0}function j(){if(!n.current.search||i.current.shouldFilter===!1)return;let R=n.current.filtered.items,L=[];n.current.filtered.groups.forEach(N=>{let B=o.current.get(N),G=0;B.forEach(V=>{let K=R.get(V);G=Math.max(K,G)}),L.push([N,G])});let $=D.current;z().sort((N,B)=>{var G,V;let K=N.getAttribute("id"),oe=B.getAttribute("id");return((G=R.get(oe))!=null?G:0)-((V=R.get(K))!=null?V:0)}).forEach(N=>{let B=N.closest(Or);B?B.appendChild(N.parentElement===B?N:N.closest(`${Or} > *`)):$.appendChild(N.parentElement===$?N:N.closest(`${Or} > *`))}),L.sort((N,B)=>B[1]-N[1]).forEach(N=>{var B;let G=(B=D.current)==null?void 0:B.querySelector(`${sn}[${zt}="${encodeURIComponent(N[0])}"]`);G==null||G.parentElement.appendChild(G)})}function P(){let R=z().find($=>$.getAttribute("aria-disabled")!=="true"),L=R==null?void 0:R.getAttribute(zt);E.setState("value",L||void 0)}function O(){var R,L,$,N;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let B=0;for(let G of r.current){let V=(L=(R=s.current.get(G))==null?void 0:R.value)!=null?L:"",K=(N=($=s.current.get(G))==null?void 0:$.keywords)!=null?N:[],oe=w(V,K);n.current.filtered.items.set(G,oe),oe>0&&B++}for(let[G,V]of o.current)for(let K of V)if(n.current.filtered.items.get(K)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=B}function F(){var R,L,$;let N=I();N&&(((R=N.parentElement)==null?void 0:R.firstChild)===N&&(($=(L=N.closest(sn))==null?void 0:L.querySelector(_v))==null||$.scrollIntoView({block:"nearest"})),N.scrollIntoView({block:"nearest"}))}function I(){var R;return(R=D.current)==null?void 0:R.querySelector(`${lc}[aria-selected="true"]`)}function z(){var R;return Array.from(((R=D.current)==null?void 0:R.querySelectorAll(Bs))||[])}function S(R){let L=z()[R];L&&E.setState("value",L.getAttribute(zt))}function C(R){var L;let $=I(),N=z(),B=N.findIndex(V=>V===$),G=N[B+R];(L=i.current)!=null&&L.loop&&(G=B+R<0?N[N.length-1]:B+R===N.length?N[0]:N[B+R]),G&&E.setState("value",G.getAttribute(zt))}function H(R){let L=I(),$=L==null?void 0:L.closest(sn),N;for(;$&&!N;)$=R>0?Ov($,sn):Dv($,sn),N=$==null?void 0:$.querySelector(Bs);N?E.setState("value",N.getAttribute(zt)):C(R)}let M=()=>S(z().length-1),U=R=>{R.preventDefault(),R.metaKey?M():R.altKey?H(1):C(1)},q=R=>{R.preventDefault(),R.metaKey?S(0):R.altKey?H(-1):C(-1)};return p.createElement(bt.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:R=>{var L;(L=v.onKeyDown)==null||L.call(v,R);let $=R.nativeEvent.isComposing||R.keyCode===229;if(!(R.defaultPrevented||$))switch(R.key){case"n":case"j":{y&&R.ctrlKey&&U(R);break}case"ArrowDown":{U(R);break}case"p":case"k":{y&&R.ctrlKey&&q(R);break}case"ArrowUp":{q(R);break}case"Home":{R.preventDefault(),S(0);break}case"End":{R.preventDefault(),M();break}case"Enter":{R.preventDefault();let N=I();if(N){let B=new Event(to);N.dispatchEvent(B)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:$v},m),hr(e,R=>p.createElement(uc.Provider,{value:E},p.createElement(cc.Provider,{value:x},R))))}),Ev=p.forwardRef((e,t)=>{var n,r;let o=Me(),s=p.useRef(null),a=p.useContext(dc),i=Sn(),m=mc(e),f=(r=(n=m.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;It(()=>{if(!f)return i.item(o,a==null?void 0:a.id)},[f]);let l=pc(o,s,[e.value,e.children,s],e.keywords),c=Go(),d=xt(k=>k.value&&k.value===l.current),h=xt(k=>f||i.filter()===!1?!0:k.search?k.filtered.items.get(o)>0:!0);p.useEffect(()=>{let k=s.current;if(!(!k||e.disabled))return k.addEventListener(to,g),()=>k.removeEventListener(to,g)},[h,e.onSelect,e.disabled]);function g(){var k,E;b(),(E=(k=m.current).onSelect)==null||E.call(k,l.current)}function b(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:y,value:v,onSelect:A,forceMount:T,keywords:_,...D}=e;return p.createElement(bt.div,{ref:Je(s,t),...D,id:o,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!d,"data-disabled":!!y,"data-selected":!!d,onPointerMove:y||i.getDisablePointerSelection()?void 0:b,onClick:y?void 0:g},e.children)}),Tv=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...s}=e,a=Me(),i=p.useRef(null),m=p.useRef(null),f=Me(),l=Sn(),c=xt(h=>o||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);It(()=>l.group(a),[]),pc(a,i,[e.value,e.heading,m]);let d=p.useMemo(()=>({id:a,forceMount:o}),[o]);return p.createElement(bt.div,{ref:Je(i,t),...s,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),hr(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(dc.Provider,{value:d},h))))}),jv=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=p.useRef(null),s=xt(a=>!a.search);return!n&&!s?null:p.createElement(bt.div,{ref:Je(o,t),...r,"cmdk-separator":"",role:"separator"})}),Nv=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,s=Go(),a=xt(f=>f.search),i=xt(f=>f.selectedItemId),m=Sn();return p.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),p.createElement(bt.input,{ref:t,...r,"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:o?e.value:a,onChange:f=>{o||s.setState("search",f.target.value),n==null||n(f.target.value)}})}),Rv=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,s=p.useRef(null),a=p.useRef(null),i=xt(f=>f.selectedItemId),m=Sn();return p.useEffect(()=>{if(a.current&&s.current){let f=a.current,l=s.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=f.offsetHeight;l.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return d.observe(f),()=>{cancelAnimationFrame(c),d.unobserve(f)}}},[]),p.createElement(bt.div,{ref:Je(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:m.listId},hr(e,f=>p.createElement("div",{ref:Je(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),Iv=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:s,container:a,...i}=e;return p.createElement(wv,{open:n,onOpenChange:r},p.createElement(Cv,{container:a},p.createElement(Sv,{"cmdk-overlay":"",className:o}),p.createElement(kv,{"aria-label":e.label,"cmdk-dialog":"",className:s},p.createElement(fc,{ref:t,...i}))))}),Mv=p.forwardRef((e,t)=>xt(n=>n.filtered.count===0)?p.createElement(bt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Pv=p.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...s}=e;return p.createElement(bt.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},hr(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),tn=Object.assign(fc,{List:Rv,Item:Ev,Input:Nv,Group:Tv,Separator:jv,Dialog:Iv,Empty:Mv,Loading:Pv});function Ov(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Dv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function mc(e){let t=p.useRef(e);return It(()=>{t.current=e}),t}var It=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Ht(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function xt(e){let t=Go(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function pc(e,t,n,r=[]){let o=p.useRef(),s=Sn();return It(()=>{var a;let i=(()=>{var f;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(f=l.current.textContent)==null?void 0:f.trim():o.current}})(),m=r.map(f=>f.trim());s.value(e,i,m),(a=t.current)==null||a.setAttribute(zt,i),o.current=i}),o}var Lv=()=>{let[e,t]=p.useState(),n=Ht(()=>new Map);return It(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function Fv(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function hr({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Fv(t),{ref:t.ref},n(t.props.children)):n(t)}var $v={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Uv({className:e,...t}){return u.jsx(tn,{"data-slot":"command",className:Z("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function zv({className:e,...t}){return u.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[u.jsx(ld,{className:"size-4 shrink-0 opacity-50"}),u.jsx(tn.Input,{"data-slot":"command-input",className:Z("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Hv({className:e,...t}){return u.jsx(tn.List,{"data-slot":"command-list",className:Z("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Bv({...e}){return u.jsx(tn.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Wv({className:e,...t}){return u.jsx(tn.Group,{"data-slot":"command-group",className:Z("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function Gv({className:e,...t}){return u.jsx(tn.Item,{"data-slot":"command-item",className:Z("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Ws(e,t){if(!e)return!0;const n=e.toLowerCase(),r=t.toLowerCase();let o=0;for(let s=0;s<r.length&&o<n.length;s++)r[s]===n[o]&&o++;return o===n.length}function Vv({models:e,currentModelId:t,onSelect:n,showSearch:r=!0,isMobile:o=!1}){const[s,a]=p.useState(""),[i,m]=p.useState(o?"__none__":void 0),f=p.useMemo(()=>s?e.filter(l=>Ws(s,l.name)||Ws(s,l.modelId)):e,[e,s]);return u.jsxs(Uv,{shouldFilter:!1,value:i,onValueChange:m,children:[r&&u.jsx(zv,{placeholder:"Select a model…",value:s,onValueChange:a}),u.jsxs(Hv,{children:[u.jsx(Bv,{children:"No models found."}),u.jsx(Wv,{children:f.map(l=>u.jsxs(Gv,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[u.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&u.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),u.jsx(mn,{className:Z("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function hc(e){const[t,n]=p.useState(e.modelState),[r,o]=p.useState(!1);p.useEffect(()=>{const f=c=>{if(n(c),c&&c.availableModels.length>0){const d=localStorage.getItem("acp_model_id");d&&d!==c.currentModelId&&c.availableModels.some(h=>h.modelId===d)&&e.setSessionModel(d).catch(()=>{})}},l=c=>{n(d=>d?{...d,currentModelId:c}:null),o(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(l),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(l)}},[e]);const s=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>s.find(f=>f.modelId===a)??null,[s,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");o(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(l){throw o(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:m,isLoading:r}}function Kv({client:e,onModelSelect:t}){const[n,r]=p.useState(!1),{supportsModelSelection:o,availableModels:s,currentModel:a,setModel:i,isLoading:m}=hc(e),f=o&&s.length>0,l=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,c=async d=>{try{await i(d.modelId),t==null||t(d.modelId),r(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return u.jsxs(Wl,{open:n,onOpenChange:f?r:void 0,children:[u.jsx(Gl,{asChild:!0,children:u.jsxs(Pt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?u.jsx(xa,{className:"h-3 w-3 animate-spin"}):null,u.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?u.jsx(ga,{className:"h-3 w-3"}):u.jsx(Qt,{className:"h-3 w-3"})]})}),u.jsx(Vl,{className:"w-72 p-0",align:"end",children:u.jsx(Vv,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function qv(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const o=s=>{n(s)};return e.setAvailableCommandsChangedHandler(o),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const r=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:r}}function gc(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function Yv(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return gc(e)}function Xv(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!gc(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const r of n)try{const o=await r.getType("text/plain");await t.writeText(await o.text());return}catch{}throw new Error("No text/plain clipboard item available")}};try{Object.defineProperty(navigator,"clipboard",{value:t,configurable:!0,writable:!0})}catch{}}const Vo=new Set(["clear","new","help","status","model","copy"]),no=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"},{name:"files",desc:"列出会话追踪的文件"}],xc=no.map(e=>({name:e.name,description:e.desc})),Qv=[{name:"clear",description:"清空当前对话"},{name:"new",description:"新建会话"},{name:"help",description:"显示此帮助信息"},{name:"status",description:"显示会话状态"},{name:"model",description:"查看或切换模型",input:{hint:"[id]"}},{name:"copy",description:"复制最后一条助手消息"},...xc],Gs=new Set(["compact","cost","summary","files"]);function Sy(e,t=[]){if(e.length===0&&t.length===0)return Qv;const n=Vo,r=new Set,o=[],s=a=>{n.has(a.name)||r.has(a.name)||a.type!=="local-jsx"&&(a.type==="local"&&!Gs.has(a.name)||a.type===void 0&&!Gs.has(a.name)||(r.add(a.name),o.push({name:a.name,description:a.description||"agent 命令",...a.argumentHint?{input:{hint:a.argumentHint}}:{}})))};for(const a of e)s(a);for(const a of t)s(a);for(const a of xc)r.has(a.name)||(r.add(a.name),o.push(a));return[{name:"clear",description:"清空当前对话"},{name:"new",description:"新建会话"},{name:"help",description:"显示此帮助信息"},{name:"status",description:"显示会话状态"},{name:"model",description:"查看或切换模型",input:{hint:"[id]"}},{name:"copy",description:"复制最后一条助手消息"},...o]}function Jv(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 Zv(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function eb(e){var r;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 o of n)t.push(`- \`/${o.name}\` — ${o.desc}`);t.push(""),t.push("**Agent 命令**(发给 Saluzi agent 执行)"),t.push("");for(const o of no)t.push(`- \`/${o.name}\` — ${o.desc}`);if(e.length>0){const o=new Set([...Vo,...no.map(s=>s.name)]);for(const s of e){if(o.has(s.name))continue;const a=(r=s.input)!=null&&r.hint?` ${s.input.hint}`:"";t.push(`- \`/${s.name}${a}\` — ${s.description}`)}}return t.join(`
267
+ `)}function tb(e){var n,r,o;const t=["**会话状态**",""];return t.push(`- 会话 ID: \`${e.sessionId??"无"}\``),t.push(`- 当前模型: ${((n=e.currentModel)==null?void 0:n.name)??((r=e.currentModel)==null?void 0:r.modelId)??"未设置"}`),(o=e.currentModel)!=null&&o.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- 可用模型数: ${e.modelCount}`),t.push(`- 图片支持: ${e.supportsImages?"是":"否"}`),t.push(`- 消息条数: ${e.entryCount}`),t.join(`
268
+ `)}function nb(e,t){if(e.length===0)return"当前 agent 未提供模型选择能力。";const n=["**可用模型**",""];for(const r of e){const o=r.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${r.modelId}\` — ${r.name}${o}`)}return n.push(""),n.push("使用 `/model <id>` 切换模型。"),n.join(`
269
+ `)}async function rb(e,t){var c;if(!e.startsWith("/"))return{handled:!1};const[n,...r]=e.slice(1).split(/\s+/),o=r.join(" ").trim(),s=n==null?void 0:n.toLowerCase();if(!s||!Vo.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=eb(t.availableCommands);else if(s==="status")a=tb({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(s==="model")if(o)try{await t.setModel(o),a=`已请求切换到模型: \`${o}\``}catch(d){a=`切换模型失败: ${d instanceof Error?d.message:String(d)}`,i=!0}else a=nb(t.availableModels,t.currentModel);else if(s==="copy"){const d=[...t.entries].reverse().find(b=>b.type==="assistant_message"),h=((c=d==null?void 0:d.chunks)==null?void 0:c.map(b=>b.text).join(`
270
+ `))??"";(h?await Yv(h):!0)?a=h?`已复制 ${h.length} 字符到剪贴板`:"没有可复制的助手消息":(a="复制失败:剪贴板不可用",i=!0)}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},l={type:"command_output",id:`cmd-${m}`,commandName:s,inputText:e,title:Jv(s),subtitle:Zv(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const ob={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function sb(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),r=e.slice(t+1),o=n.match(/^data:([^;,]+)/),s=o?o[1]:"application/octet-stream",a=atob(r),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 Dr=[{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 ab({mode:e,onModeChange:t}){const[n,r]=p.useState(!1),o=Dr.find(s=>s.value===e)??Dr[0];return u.jsxs(Wl,{open:n,onOpenChange:r,children:[u.jsx(Gl,{asChild:!0,children:u.jsxs(Pt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[u.jsx(hd,{className:"h-3 w-3"}),u.jsx("span",{className:"max-w-24 truncate",children:o.label}),n?u.jsx(ga,{className:"h-3 w-3"}):u.jsx(Qt,{className:"h-3 w-3"})]})}),u.jsx(Vl,{className:"w-64 p-1",align:"start",children:Dr.map(s=>u.jsxs("button",{type:"button",onClick:()=>{t(s.value),r(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[u.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===s.value&&u.jsx(mn,{className:"h-3.5 w-3.5 text-brand"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.label}),u.jsx("div",{className:"text-xs text-text-muted",children:s.description})]})]},s.value))})]})}function Vs(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function Lr(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}function ib({client:e,agentId:t}){const[n,r]=p.useState([]),[o,s]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),l=p.useRef(null),c=p.useRef(n);c.current=n;const[d,h]=p.useState(null),g=p.useRef(null),[b,y]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[v,A]=p.useState(e.usage),[T,_]=p.useState(e.currentModeId),[D,k]=p.useState(!1),{commands:E}=qv(e),{availableModels:x,currentModel:w,setModel:j}=hc(e);p.useEffect(()=>{l.current=m},[m]);const P=p.useCallback(()=>{r([]),s(!1),i(!1),A(null),_(null)},[]),O=t?`acp_last_session_${t}`:null,F=p.useCallback((R,L)=>{if(((L==null?void 0:L.resetEntries)??!0)&&(r([]),s(!1)),f(R),i(!0),k(e.supportsImages),O)try{localStorage.setItem(O,R)}catch{}console.log("[ChatInterface] Active session:",R,"supportsImages:",e.supportsImages)},[e,O]),I=p.useCallback(R=>{l.current&&R.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",R),r(L=>{const $=Lr(L,R.toolCall.toolCallId);if($>=0)return L.map((N,B)=>B!==$||N.type!=="tool_call"||N.toolCall.status!=="running"?N:{type:"tool_call",toolCall:{...N.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:R.requestId,options:R.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const N={type:"tool_call",toolCall:{id:R.toolCall.toolCallId,title:R.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:R.requestId,options:R.options},isStandalonePermission:!0}};return[...L,N]}}))},[]),z=p.useCallback((R,L)=>{if(!(l.current&&R!==l.current))if(L.sessionUpdate==="agent_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(N=>{const B=N[N.length-1];if((B==null?void 0:B.type)==="assistant_message"){const V=B.chunks[B.chunks.length-1];return(V==null?void 0:V.type)==="message"?[...N.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"message",text:V.text+$}]}]:[...N.slice(0,-1),{...B,chunks:[...B.chunks,{type:"message",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...N,G]})}else if(L.sessionUpdate==="agent_thought_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(N=>{const B=N[N.length-1];if((B==null?void 0:B.type)==="assistant_message"){const V=B.chunks[B.chunks.length-1];return(V==null?void 0:V.type)==="thought"?[...N.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"thought",text:V.text+$}]}]:[...N.slice(0,-1),{...B,chunks:[...B.chunks,{type:"thought",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...N,G]})}else if(L.sessionUpdate==="user_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(N=>{const B=N[N.length-1];if((B==null?void 0:B.type)==="user_message")return[...N.slice(0,-1),{...B,content:B.content+$}];const G={type:"user_message",id:`user-${Date.now()}`,content:$};return[...N,G]})}else if(L.sessionUpdate==="tool_call"){const $={id:L.toolCallId,title:L.title,status:Vs(L.status),content:L.content,rawInput:L.rawInput,rawOutput:L.rawOutput};r(N=>{const B=Lr(N,L.toolCallId);if(B>=0)return N.map((V,K)=>K!==B||V.type!=="tool_call"?V:{type:"tool_call",toolCall:{...V.toolCall,...$}});const G={type:"tool_call",toolCall:$};return[...N,G]})}else L.sessionUpdate==="tool_call_update"?r($=>{const N=Lr($,L.toolCallId);if(N<0){console.warn(`[ChatInterface] Tool call not found for update: ${L.toolCallId}`);const B={type:"tool_call",toolCall:{id:L.toolCallId,title:L.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...$,B]}return $.map((B,G)=>{if(G!==N||B.type!=="tool_call")return B;const V=L.status?Vs(L.status):B.toolCall.status,K=L.content?[...B.toolCall.content||[],...L.content]:B.toolCall.content;return{type:"tool_call",toolCall:{...B.toolCall,status:V,...L.title&&{title:L.title},content:K,...L.rawInput&&{rawInput:L.rawInput},...L.rawOutput&&{rawOutput:L.rawOutput}}}})}):L.sessionUpdate==="plan"?r($=>{if(L.entries.length===0)return $.filter(G=>G.type!=="plan");const N=$.reduce((G,V,K)=>V.type==="plan"?K:G,-1);if(N>=0)return $.map((G,V)=>V===N?{...G,entries:L.entries}:G);const B={type:"plan",id:`plan-${Date.now()}`,entries:L.entries};return[...$,B]}):L.sessionUpdate==="usage_update"?A(L):L.sessionUpdate==="current_mode_update"&&_(L.currentModeId)},[]);p.useEffect(()=>{e.setSessionCreatedHandler(L=>{console.log("[ChatInterface] Session created:",L),F(L)}),e.setSessionLoadedHandler(L=>{console.log("[ChatInterface] Session loaded/resumed:",L),F(L,{resetEntries:!1})}),e.setSessionSwitchingHandler(L=>{console.log("[ChatInterface] Switching to session:",L),f(L),P()}),e.setSessionUpdateHandler((L,$)=>{z(L,$)}),e.setPromptCompleteHandler(L=>{console.log("[ChatInterface] Prompt complete:",L),s(!1)}),e.setPermissionRequestHandler(I),e.setErrorMessageHandler(L=>{console.error("[ChatInterface] Agent error:",L),h(L),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const R=O?localStorage.getItem(O):null;return R&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",R),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:R}):await e.resumeSession({sessionId:R})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),e.createSession(void 0,b)}})()):e.createSession(void 0,b),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[F,e,I,z,P]);const S=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),o&&e.cancel(),P(),f(null),e.createSession(void 0,b)},[e,o,P,b]),C=()=>{console.log("[ChatInterface] Cancel requested"),r(R=>R.map(L=>L.type!=="tool_call"||!(L.toolCall.status==="running"||L.toolCall.status==="waiting_for_confirmation")?L:(console.log("[ChatInterface] Marking tool call as canceled:",L.toolCall.id),{type:"tool_call",toolCall:{...L.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},H=p.useCallback((R,L,$)=>{console.log("[ChatInterface] Permission response:",{requestId:R,optionId:L,optionKind:$}),e.respondToPermission(R,L);const N=$==="reject_once"||$==="reject_always"||L===null;r(B=>B.map(G=>{var K;if(G.type!=="tool_call"||((K=G.toolCall.permissionRequest)==null?void 0:K.requestId)!==R)return G;let V;return N?V="rejected":G.toolCall.isStandalonePermission?V="complete":V="running",{type:"tool_call",toolCall:{...G.toolCall,status:V,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),M=n.filter(R=>R.type==="tool_call"&&R.toolCall.status==="waiting_for_confirmation"&&!!R.toolCall.permissionRequest).map(R=>({requestId:R.toolCall.permissionRequest.requestId,toolName:R.toolCall.title,toolInput:R.toolCall.rawInput||{},description:R.toolCall.title,options:R.toolCall.permissionRequest.options})),U=p.useCallback((R,L)=>{const $=M.find(G=>G.requestId===R);let N=null,B=null;if($!=null&&$.options&&$.options.length>0)if(L){const G=$.options.find(V=>V.kind==="allow_once")??$.options.find(V=>V.kind==="allow_always");G&&(N=G.optionId,B=G.kind)}else{const G=$.options.find(V=>V.kind==="reject_once")??$.options.find(V=>V.kind==="reject_always");G&&(N=G.optionId,B=G.kind)}N||(B=L?"allow_once":"reject_once"),H(R,N,B)},[H,M]),q=p.useCallback(async R=>{var oe;const L=R.text.trim(),$=R.images||[],N=R.attachments||[];if(!L&&$.length===0&&N.length===0||!a)return;if(L.startsWith("/")&&$.length===0){Tt("[ChatInterface] slash command input",{text:L});const J=await rb(L,{sessionId:m,availableCommands:E,availableModels:x,currentModel:w,supportsImages:D,entries:c.current,setModel:j,onNewSession:S}).catch(()=>null);if(J){if(Tt("[ChatInterface] local command handled",J),"clearEntries"in J&&J.clearEntries){r([]);return}if("newSession"in J&&J.newSession){S();return}if("userEntry"in J){r(ne=>[...ne,J.userEntry,J.cmdEntry]);return}}Tt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:L})}Tt("[ChatInterface] forwarding to agent",{text:L,hasImages:$.length>0,sessionReady:a,isLoading:o});const B=[];L&&B.push({type:"text",text:L});const G=[];for(const J of $)try{const ne=`data:${J.mimeType};base64,${J.data}`;let ie;ne.startsWith("data:")?ie=sb(ne):ie=await(await fetch(ne)).blob();let ve=ie,ce=J.mimeType;if(ie.size>2*1024*1024){const le=new File([ie],"image.jpg",{type:ie.type});ve=await Ne(le,ob),ce="image/jpeg"}const be=await new Promise((le,xe)=>{const ye=new FileReader;ye.onloadend=()=>{const fe=ye.result,_e=fe.indexOf(",");le(_e>=0?fe.slice(_e+1):fe)},ye.onerror=()=>{var fe;return xe(new Error("FileReader error: "+((fe=ye.error)==null?void 0:fe.message)))},ye.readAsDataURL(ve)}),de={type:"image",mimeType:ce,data:be};B.push(de),G.push({mimeType:ce,data:be})}catch(ne){console.error("[ChatInterface] Failed to process image:",ne)}const V=[];for(const J of N)try{if(J.textContent){let ne;if(J.kind==="directory"){const ie=((oe=J.files)==null?void 0:oe.length)??0;ne=`📁 目录: ${J.name} (${ie} 个文件)
271
+ ${J.textContent}`}else{const ie=J.size!=null?` (${lb(J.size)})`:"";ne=`📎 ${J.name}${ie}
272
+ \`\`\`
273
+ ${J.textContent}
274
+ \`\`\``}B.push({type:"text",text:ne}),V.push(J)}}catch(ne){console.error("[ChatInterface] Failed to process attachment:",ne)}if(B.length===0)return;const K={type:"user_message",id:`user-${Date.now()}`,content:L,images:G.length>0?G:void 0,attachments:V.length>0?V:void 0};r(J=>[...J,K]),s(!0);try{await e.sendPrompt(B)}catch(J){console.error("[ChatInterface] Failed to send prompt:",J),s(!1)}},[o,a,e,E,x,w,D,m,j,S]);return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(Cx,{entries:n,isLoading:o&&!a?!1:o,onPermissionRespond:(R,L,$)=>{H(R,L,$)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),u.jsx(Fx,{requests:M,onRespond:U}),d&&u.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:u.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[u.jsx("span",{children:d}),u.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),u.jsxs("div",{className:"flex-shrink-0",children:[u.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(ab,{mode:T??b,onModeChange:R=>{_(null),y(R),localStorage.setItem("acp_permission_mode",R)}}),u.jsx(Kv,{client:e}),u.jsx(Ux,{usage:v})]}),n.length>0&&u.jsxs(gg,{children:[u.jsx(xg,{asChild:!0,children:u.jsxs(Pt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:S,children:[u.jsx(ya,{className:"h-3 w-3"}),"新会话"]})}),u.jsx(vg,{children:"New Thread"})]})]}),u.jsx(Px,{onSubmit:q,isLoading:o,onInterrupt:C,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:D,commands:E.length>0?E:void 0,queueWhileLoading:!0})]})]})}function lb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function cb({client:e,agentId:t}){const[n,r]=p.useState(!1),o=p.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return u.jsxs("div",{className:"flex h-full w-full",children:[u.jsxs("div",{className:Z("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&u.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),u.jsxs("div",{className:Z("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&u.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:u.jsx(ya,{className:"h-4 w-4"})}),u.jsx("button",{type:"button",onClick:()=>r(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?u.jsx(nd,{className:"h-4 w-4"}):u.jsx(ed,{className:"h-4 w-4"})})]})]}),!n&&u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(ub,{client:e,onSelectSession:o})})]}),u.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:u.jsx(ib,{client:e,agentId:t})})]})}function ub({client:e,onSelectSession:t}){const[n,r]=p.useState([]),[o,s]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[d,h]=p.useState(!0),g=p.useRef(null),b=p.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const E=await e.listSessions();r(E.sessions)}catch(E){console.warn("[SidebarSessionList] Failed to load:",E)}finally{s(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&b()},[e,b]),p.useEffect(()=>{const E=x=>{x==="connected"&&setTimeout(b,200)};return e.setConnectionStateHandler(E),()=>e.removeConnectionStateHandler(E)},[e,b]),p.useEffect(()=>{const E=setInterval(b,1e4);return()=>clearInterval(E)},[b]),p.useEffect(()=>{e.setSessionDeletedHandler(E=>{b()}),e.setSessionRenamedHandler((E,x)=>{b()})},[e,b]),p.useEffect(()=>{e.setErrorMessageHandler(E=>{/Method not found/i.test(E)&&/session\/(rename|delete)/i.test(E)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const y=p.useCallback(E=>{const x=E.title&&E.title.trim()?E.title:E.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(E.sessionId),r(w=>w.filter(j=>j.sessionId!==E.sessionId)),a===E.sessionId&&i(null)}catch(w){console.error("[SidebarSessionList] delete failed:",w)}},[e,a]),v=p.useCallback(E=>{f(E.sessionId),c(E.title&&E.title.trim()?E.title:"")},[]),A=p.useCallback(()=>{if(!m)return;const E=l.trim();if(!E){f(null);return}try{e.renameSession(m,E),r(x=>x.map(w=>w.sessionId===m?{...w,title:E}:w))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),T=p.useCallback(()=>{f(null)},[]),_=p.useCallback(E=>{E.key==="Enter"?(E.preventDefault(),A()):E.key==="Escape"&&(E.preventDefault(),T())},[A,T]),D=p.useMemo(()=>[...n].sort((E,x)=>{const w=E.updatedAt?new Date(E.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-w}),[n]);if(o&&n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const k=db(D);return u.jsx("nav",{className:"py-1","aria-label":"历史会话",children:k.map((E,x)=>u.jsxs("div",{children:[x>0&&u.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),u.jsx("div",{className:"px-4 py-2",children:u.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:E.label})}),E.sessions.map(w=>{const j=m===w.sessionId;return u.jsxs("div",{className:Z("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",w.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[u.jsx(Yu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),j?u.jsx("input",{ref:g,type:"text",value:l,onChange:P=>c(P.target.value),onKeyDown:_,onBlur:A,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:P=>P.stopPropagation()}):u.jsx("button",{type:"button",onClick:()=>{i(w.sessionId),t(w)},className:"flex-1 min-w-0 text-left",title:w.title||w.sessionId,children:u.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:w.title&&w.title.trim()?w.title:"新会话"})}),j?u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u.jsx("button",{type:"button",onClick:A,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"确认",children:u.jsx(mn,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:T,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:"取消",children:u.jsx(pn,{className:"h-3.5 w-3.5"})})]}):u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:d?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[u.jsx("button",{type:"button",disabled:!d,onClick:P=>{P.stopPropagation(),d&&v(w)},className:Z("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-brand hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:d?"重命名":"该 agent 不支持会话重命名",children:u.jsx(ba,{className:"h-3 w-3"})}),u.jsx("button",{type:"button",disabled:!d,onClick:P=>{P.stopPropagation(),d&&y(w)},className:Z("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:d?"删除":"该 agent 不支持会话删除",children:u.jsx(Sd,{className:"h-3 w-3"})})]})]},w.sessionId)})]},E.label))})}function db(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),o=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?o[0].sessions.push(s):a>=r?o[1].sessions.push(s):o[2].sessions.push(s)}return o.filter(s=>s.sessions.length>0)}function fb({url:e,token:t,onBack:n}){const[r,o]=p.useState(null),[s,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new Yr({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,d)=>{a(c),m(d||null)}),f.current=l,o(l),l.connect().catch(c=>{c instanceof Xi||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,o(null),a("disconnected")}},[e,t]),u.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&u.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,u.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),u.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!r&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),u.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),u.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),r&&s==="connected"&&u.jsx(cb,{client:r})]})}const ro="rcs_admin_key";function mb(){try{return localStorage.getItem(ro)}catch{return null}}function pb(){const[e,t]=p.useState(mb),n=p.useCallback(r=>{const o=r.trim();t(o||null);try{o?localStorage.setItem(ro,o):localStorage.removeItem(ro)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Ks=p.lazy(()=>Ee(()=>import("./Dashboard-C5LV1cdW.js"),__vite__mapDeps([3,2,4,5,6,1,7])).then(e=>({default:e.Dashboard}))),hb=p.lazy(()=>Ee(()=>import("./SessionDetail-PIKhgeSE.js"),__vite__mapDeps([8,2,4,6,9,10,11,5,12,13,1,7])).then(e=>({default:e.SessionDetail}))),gb=p.lazy(()=>Ee(()=>import("./ShareLanding-CmSEJlVm.js"),__vite__mapDeps([14,2,1,7])).then(e=>({default:e.ShareLanding}))),qs=p.lazy(()=>Ee(()=>import("./ArtifactsGallery--KEN5Q2C.js").then(e=>e.a),__vite__mapDeps([10,2,6,11])).then(e=>({default:e.ArtifactsGallery}))),xb=p.lazy(()=>Ee(()=>import("./ArtifactView-DMsduT0e.js"),__vite__mapDeps([15,2,10,6,11,9,1,7])).then(e=>({default:e.ArtifactView}))),vb=p.lazy(()=>Ee(()=>import("./Claim-ClHGhexz.js"),__vite__mapDeps([16,2,1,7])).then(e=>({default:e.Claim}))),bb=p.lazy(()=>Ee(()=>import("./Login-D5-UV7og.js"),__vite__mapDeps([17,2,1,7])).then(e=>({default:e.Login}))),yb=p.lazy(()=>Ee(()=>import("./Register-Cgsq_Ibv.js"),__vite__mapDeps([18,2,1,7])).then(e=>({default:e.Register}))),wb=p.lazy(()=>Ee(()=>import("./Setup-C0Ea6PHX.js"),__vite__mapDeps([19,2,1,7])).then(e=>({default:e.Setup}))),Cb=p.lazy(()=>Ee(()=>import("./Join-DssmEuDo.js"),__vite__mapDeps([20,2,1,7])).then(e=>({default:e.Join}))),Sb=p.lazy(()=>Ee(()=>import("./UserSettings-DQZVQw18.js"),__vite__mapDeps([21,2,13,11,1,7])).then(e=>({default:e.UserSettings}))),kb=p.lazy(()=>Ee(()=>import("./TeamList-Hhn6XHlf.js"),__vite__mapDeps([22,2,1,7])).then(e=>({default:e.TeamList}))),_b=p.lazy(()=>Ee(()=>import("./TeamCreate-1i5YF-vx.js"),__vite__mapDeps([23,2,1,7])).then(e=>({default:e.TeamCreate}))),Ab=p.lazy(()=>Ee(()=>import("./TeamDetail-CT0OPoLU.js"),__vite__mapDeps([24,2,12,11,4,1,7])).then(e=>({default:e.TeamDetail}))),Eb=p.lazy(()=>Ee(()=>import("./TeamSettings-DeSvmHy4.js"),__vite__mapDeps([25,2,1,7])).then(e=>({default:e.TeamSettings}))),Tb=p.lazy(()=>Ee(()=>import("./AdminPanel-BpjNyO3W.js"),__vite__mapDeps([26,2,1,7])).then(e=>({default:e.AdminPanel}))),jb=new Set(["login","register","setup","join","share"]),Nb=new Set(["login","register","setup","join"]);function Rb(){return u.jsx(Rd,{defaultTheme:"system",children:u.jsx(Rh,{children:u.jsx(Ib,{})})})}function Ib(){const[e,t]=p.useState("dashboard"),[n,r]=p.useState(null),[o,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(null),{adminKey:d}=pb(),{user:h,isLoading:g,checkSetupStatus:b}=Yi();p.useEffect(()=>{wh(d)},[d]);const[y,v]=p.useState(!1);p.useEffect(()=>{!g&&!h?b().then(v):h&&v(!1)},[g,h,b]);const A=p.useCallback(()=>{const j=window.location.pathname,P=new URLSearchParams(window.location.search);if(P.get("acp")==="1"){const U=sessionStorage.getItem("acp_connection");if(U)try{const q=JSON.parse(U);if(q.url&&q.token){c({url:q.url,token:q.token}),sessionStorage.removeItem("acp_connection");const R=new URL(window.location.href);R.searchParams.delete("acp"),window.history.replaceState(null,"",R),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const F=P.get("sid");if(F){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${F}`),r(F),f(null),t("session");return}if(j==="/login"){t("login");return}if(j==="/register"){t("register");return}if(j==="/setup"){t("setup");return}if(j==="/join"){t("join");return}if(j==="/settings"){t("settings");return}if(j==="/admin"){t("admin");return}if(j==="/teams/new"){t("team-create");return}if(j.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(j.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(j==="/teams"){t("teams");return}const S=j.match(/^\/code\/s\/([^/]+)/);if(S&&S[1]){f(S[1]),r(null),s(void 0),t("share");return}const C=j.match(/^\/code\/a\/([^/]+)/);if(C&&C[1]){i(C[1]),r(null),s(void 0),f(null),t("artifact-view");return}if(j==="/code/artifacts"||j==="/code/artifacts/"){i(null),r(null),s(void 0),f(null),t("artifacts");return}const H=j.match(/^\/code\/claim\/([^/]+)/);if(H&&H[1]){t("claim");return}const M=j.match(/^\/code\/([^/]+)/);M&&M[1]?(r(M[1]),s(void 0),f(null),t("session")):(r(null),s(void 0),f(null),t("dashboard"))},[]);p.useEffect(()=>(A(),window.addEventListener("popstate",A),()=>window.removeEventListener("popstate",A)),[A]);const T=p.useCallback(j=>{window.history.pushState(null,"",`/code/${j}`),r(j),s(void 0),f(null),i(null),t("session")},[]),_=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),i(null),r(null),s(void 0),f(null),t("artifacts")},[]),D=p.useCallback(()=>{window.history.pushState(null,"","/code/"),r(null),s(void 0),f(null),i(null),c(null),t("dashboard")},[]),k=(()=>{let j=e;return g||(y&&j!=="setup"&&j!=="join"&&(j="setup"),!h&&!jb.has(j)&&(j="login"),h&&(j==="login"||j==="setup")&&(j="dashboard")),j})();if(p.useEffect(()=>{g||(k==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):k==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):k==="dashboard"&&h&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[k,h,g]),g)return u.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const E=()=>{if(l&&k==="acp")return u.jsx(fb,{url:l.url,token:l.token,onBack:D});switch(k){case"login":return u.jsx(bb,{onSuccess:D,onNavigateRegister:()=>t("register")});case"register":return u.jsx(yb,{onSuccess:D,onBack:()=>t("login")});case"setup":return u.jsx(wb,{onSuccess:D,onAlreadyDone:D});case"join":return u.jsx(Cb,{onSuccess:D,onInvalidInvite:D});case"settings":return u.jsx(Sb,{});case"teams":return u.jsx(kb,{});case"team-create":return u.jsx(_b,{});case"team-detail":return u.jsx(Ab,{});case"team-settings":return u.jsx(Eb,{});case"admin":return(h==null?void 0:h.role)!=="admin"?u.jsx("div",{className:"flex flex-1 items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),u.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:He("nav.dashboard")})]})}):u.jsx(Tb,{});case"share":return u.jsx(gb,{});case"claim":return u.jsx(vb,{});case"artifacts":return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(qs,{})});case"artifact-view":return a?u.jsx(xb,{artifactId:a,onBack:_}):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(qs,{})});case"session":return n?u.jsx(hb,{sessionId:n,onSessionLoaded:j=>s(j.source)},n):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Ks,{onNavigateSession:T})});default:return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Ks,{onNavigateSession:T})})}},x=!Nb.has(k),w=k==="artifact-view";return u.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[x&&u.jsx(Mh,{sessionTitle:n||(l?"ACP":void 0),sessionSource:l?"acp":o,onBack:n||l||m?D:void 0,onNavigateArtifacts:w?void 0:_}),u.jsx(p.Suspense,{fallback:u.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:E()})]})}Xv();wc.createRoot(document.getElementById("root")).render(u.jsx(p.StrictMode,{children:u.jsx(Rb,{})}));export{Qb as $,Yr as A,_u as B,Px as C,Xi as D,hg as E,Fu as F,Sd as G,me as H,my as I,oy as J,gy as K,xa as L,Do as M,ay as N,Sv as O,ba as P,cy as Q,wv as R,ld as S,wy as T,Td as U,xy as V,ry as W,pn as X,Kb as Y,hy as Z,py as _,cb as a,qb as a0,Yb as a1,Xb as a2,Vb as a3,ny as a4,ly as a5,sy as a6,iy as a7,uy as a8,ey as a9,Yi as aA,Vi as aB,Eh as aC,Jb as aa,ty as ab,Zb as ac,dy as ad,fy as ae,ea as af,Z as ag,Yv as ah,ae as ai,Tt as aj,pu as ak,Lb as al,Ub as am,Gb as an,Sh as ao,On as ap,Hb as aq,Fb as ar,zb as as,Sy as at,by as au,Wb as av,He as aw,$b as ax,rb as ay,mu as az,_r as b,Cx as c,mn as d,Qt as e,ga as f,Du as g,Cy as h,kv as i,Hi as j,Wi as k,Mn as l,ph as m,As as n,Bi as o,Vv as p,ya as q,Wl as r,Vl as s,Gl as t,Cv as u,ud as v,fd as w,hd as x,bd as y,vy as z};