@ensocode/server 0.3.15-beta.236 → 0.3.15-beta.238

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/out/phone/assets/{EditDiff-DPrGvGAU.js → EditDiff-d_soeIoH.js} +1 -1
  2. package/out/phone/assets/{ReadFileView-s4kjqMan.js → ReadFileView-npigX-Gg.js} +1 -1
  3. package/out/phone/assets/{abnfDiagram-VCTEODGH-BbG8PpJN.js → abnfDiagram-VCTEODGH-BFJoo386.js} +1 -1
  4. package/out/phone/assets/architecture-7GRP2DOG-shN3C0HU.js +1 -0
  5. package/out/phone/assets/{architectureDiagram-5GKGNRK7-DnxOyC6a.js → architectureDiagram-5GKGNRK7-CQ5CAwHD.js} +1 -1
  6. package/out/phone/assets/{blockDiagram-I7D4REHJ-B5s7XAHT.js → blockDiagram-I7D4REHJ-Dx9ch0E-.js} +1 -1
  7. package/out/phone/assets/{c4Diagram-7LVT6UL2-DixPhQ_p.js → c4Diagram-7LVT6UL2-BCBCnQbb.js} +1 -1
  8. package/out/phone/assets/channel-Ik-TlKzp.js +1 -0
  9. package/out/phone/assets/{chunk-4HAMMTFA-ClCSp7Xk.js → chunk-4HAMMTFA-CSiosLN7.js} +1 -1
  10. package/out/phone/assets/{chunk-75Z2AOVW-QvFknKGi.js → chunk-75Z2AOVW-BY6tm6Nw.js} +1 -1
  11. package/out/phone/assets/{chunk-DU6HZSFF-CeYtDBPs.js → chunk-DU6HZSFF-DapVrsFt.js} +1 -1
  12. package/out/phone/assets/{chunk-F27PBJKO-BnR5_CAQ.js → chunk-F27PBJKO-CQJqljdE.js} +1 -1
  13. package/out/phone/assets/{chunk-GMAD6QVW-SLRPQ8AI.js → chunk-GMAD6QVW-CT-aDPym.js} +1 -1
  14. package/out/phone/assets/{chunk-GVQU2GXP-BiPH1vVN.js → chunk-GVQU2GXP-6AzEbnnF.js} +1 -1
  15. package/out/phone/assets/{chunk-IMKFNOWR-DHtYLC41.js → chunk-IMKFNOWR-R_-0W8oi.js} +1 -1
  16. package/out/phone/assets/{chunk-L3NEJ4N5-2hf9zWlv.js → chunk-L3NEJ4N5-CRcor8NA.js} +1 -1
  17. package/out/phone/assets/{chunk-OSK3NFVY-BDSQEHdr.js → chunk-OSK3NFVY-B5dl1aYu.js} +1 -1
  18. package/out/phone/assets/{chunk-P2QGCYS3-KWTrRS1P.js → chunk-P2QGCYS3-CRepj7HD.js} +1 -1
  19. package/out/phone/assets/{chunk-POPQ4Y6H-DjbY6mYy.js → chunk-POPQ4Y6H-DYmnYTxL.js} +1 -1
  20. package/out/phone/assets/{chunk-PWAF6VOD-CV-3dG-I.js → chunk-PWAF6VOD-DeQ6uhCi.js} +1 -1
  21. package/out/phone/assets/{chunk-SHT3W25Y-CAuUqICh.js → chunk-SHT3W25Y-C4p1ZEtc.js} +1 -1
  22. package/out/phone/assets/{chunk-SVP7TREG-CLX8NrQn.js → chunk-SVP7TREG-CsWqQJ30.js} +1 -1
  23. package/out/phone/assets/{chunk-TICWLB2K-CxmZOcaM.js → chunk-TICWLB2K-BbgD4MWV.js} +1 -1
  24. package/out/phone/assets/classDiagram-ZZMXUADV-CsXincSc.js +1 -0
  25. package/out/phone/assets/classDiagram-v2-VYDZK3BY-CsXincSc.js +1 -0
  26. package/out/phone/assets/{codeHighlighter-Dd1boUw8.js → codeHighlighter-DpeH5sWX.js} +1 -1
  27. package/out/phone/assets/{cynefin-OW5HDTMX-D7J6hO8o.js → cynefin-OW5HDTMX-ojsAR-tX.js} +1 -1
  28. package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-54NONNDT.js → cynefinDiagram-5FMLGOSQ-DFPwl-AZ.js} +1 -1
  29. package/out/phone/assets/{dagre-GXQ25YYZ-z_jqgr0R.js → dagre-GXQ25YYZ-CO5umVb0.js} +1 -1
  30. package/out/phone/assets/{desk-DnE_YcZf.js → desk-DpajOY8n.js} +1 -1
  31. package/out/phone/assets/{diagram-S7CK7UJ4-BGOTpV8e.js → diagram-S7CK7UJ4-DCMB9jPi.js} +1 -1
  32. package/out/phone/assets/{diagram-UQ7AKVKN-BDuxJ6Pi.js → diagram-UQ7AKVKN-CTtq95DY.js} +1 -1
  33. package/out/phone/assets/{diagram-VSXAHHWV-BZfIBI0n.js → diagram-VSXAHHWV-kcCB8u0R.js} +1 -1
  34. package/out/phone/assets/{diagram-VX7I27RA-D7XcWAj9.js → diagram-VX7I27RA-Dt2aZJ0d.js} +1 -1
  35. package/out/phone/assets/{diagram-Z3DM3KII-BnKcajkr.js → diagram-Z3DM3KII-Cdou1VG5.js} +1 -1
  36. package/out/phone/assets/{ebnfDiagram-PWID7BFC-BycKMCHF.js → ebnfDiagram-PWID7BFC-CLKxG6r6.js} +1 -1
  37. package/out/phone/assets/{erDiagram-RLTQ6QDP-Cz0JIM68.js → erDiagram-RLTQ6QDP-ByDI4y4D.js} +1 -1
  38. package/out/phone/assets/eventmodeling-NTZA5JFV-B1Z5I-DC.js +1 -0
  39. package/out/phone/assets/flowDiagram-HODETNUW-D9ZCCf6F.js +1 -0
  40. package/out/phone/assets/{ganttDiagram-EL5Y4UJY-BQMB-70Y.js → ganttDiagram-EL5Y4UJY-B0V86D_b.js} +1 -1
  41. package/out/phone/assets/{gitGraph-4MIJSDKK-ChNDb-oT.js → gitGraph-4MIJSDKK-BT67bqYU.js} +1 -1
  42. package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-1jVNY0Pd.js → gitGraphDiagram-WWUBYQGX-CX3aPrbp.js} +1 -1
  43. package/out/phone/assets/{info-A6RAGUB7-BFyIuYXR.js → info-A6RAGUB7-Be_ldIwK.js} +1 -1
  44. package/out/phone/assets/{infoDiagram-27XIBGKW-Bkixk8KZ.js → infoDiagram-27XIBGKW-Biw7-MJ_.js} +1 -1
  45. package/out/phone/assets/{ishikawaDiagram-5VMMS53U-DDo4d686.js → ishikawaDiagram-5VMMS53U-CAPJNJu3.js} +1 -1
  46. package/out/phone/assets/{journeyDiagram-3NMN7TZE-CMIpH7AF.js → journeyDiagram-3NMN7TZE-CWmXAbaI.js} +1 -1
  47. package/out/phone/assets/{kanban-definition-UXKFOSKX-DCrzCNHL.js → kanban-definition-UXKFOSKX-DoNGCtmq.js} +1 -1
  48. package/out/phone/assets/{line-Owcld2hO.js → line-By9pyrOb.js} +1 -1
  49. package/out/phone/assets/main-B1NbKxtS.js +277 -0
  50. package/out/phone/assets/{mermaid-parser.core-DCnmw5kY.js → mermaid-parser.core-ByaXgLiC.js} +3 -3
  51. package/out/phone/assets/{mermaid.core-CL48hMfG.js → mermaid.core-2chwDkZy.js} +4 -4
  52. package/out/phone/assets/{mindmap-definition-YA3MSWOX-D9Vm9oAs.js → mindmap-definition-YA3MSWOX-D2F0z6lX.js} +1 -1
  53. package/out/phone/assets/{packet-AYTQ26CC-0_3hoxAg.js → packet-AYTQ26CC-Dr2rxRxl.js} +1 -1
  54. package/out/phone/assets/{pegDiagram-XKGWAZYB-CaTsidSZ.js → pegDiagram-XKGWAZYB-GgFjYAEY.js} +1 -1
  55. package/out/phone/assets/{pie-WAS4IAKB-CZGajbj1.js → pie-WAS4IAKB-BXHbpBOS.js} +1 -1
  56. package/out/phone/assets/{pieDiagram-E7YTZNPT-CSaGEUBU.js → pieDiagram-E7YTZNPT-DLqTCKrJ.js} +1 -1
  57. package/out/phone/assets/{quadrantDiagram-AXDQQJYC-ZrxLtEGP.js → quadrantDiagram-AXDQQJYC-CY6NPkpK.js} +1 -1
  58. package/out/phone/assets/{radar-RG4KPBEZ-DJS9j7IU.js → radar-RG4KPBEZ-sI2543j_.js} +1 -1
  59. package/out/phone/assets/{railroad-74A4TZTK-BhE1CVxj.js → railroad-74A4TZTK-B35U-dmj.js} +1 -1
  60. package/out/phone/assets/railroad-abnf-HS5TGJTU-DCaFiyy6.js +1 -0
  61. package/out/phone/assets/railroad-ebnf-LZEXJU2U-BLUU6ww7.js +1 -0
  62. package/out/phone/assets/railroad-peg-WCYAUIDC-DrillhOI.js +1 -0
  63. package/out/phone/assets/{railroadDiagram-O6MQD6OU-jZFf0rRp.js → railroadDiagram-O6MQD6OU-BKRqgnce.js} +1 -1
  64. package/out/phone/assets/{requirementDiagram-BXWQKSXE-BesfzmXy.js → requirementDiagram-BXWQKSXE-UT9vo-ig.js} +1 -1
  65. package/out/phone/assets/{sankeyDiagram-P5KCCOFB-Cv065AkB.js → sankeyDiagram-P5KCCOFB-C2LI_WkY.js} +1 -1
  66. package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-USwT-H0A.js → sequenceDiagram-WJ2MYXX4-CteTK9Zv.js} +1 -1
  67. package/out/phone/assets/{shellUpdate-Bz93QVRZ.js → shellUpdate-Dc6v5Qoq.js} +1 -1
  68. package/out/phone/assets/{stateDiagram-D77RDMKH-DHejOw4C.js → stateDiagram-D77RDMKH-CujL7d5P.js} +1 -1
  69. package/out/phone/assets/stateDiagram-v2-MP3YSRHH-lU-IeF4i.js +1 -0
  70. package/out/phone/assets/{swimlanes-42K2YHIH-CQPL8t9s.js → swimlanes-42K2YHIH-_Ltc1_aZ.js} +1 -1
  71. package/out/phone/assets/swimlanesDiagram-VR7AAH4N-O6sDqg0C.js +8 -0
  72. package/out/phone/assets/{timeline-definition-24CTP7MA-Bz-Yw2Ha.js → timeline-definition-24CTP7MA-DZV0Go8L.js} +1 -1
  73. package/out/phone/assets/{treeView-Q6P3EWNA-FT_AXPvw.js → treeView-Q6P3EWNA-DQHfwhZZ.js} +1 -1
  74. package/out/phone/assets/{treemap-WGGIJYW6-GvrJTu-Y.js → treemap-WGGIJYW6-DwwxJbXT.js} +1 -1
  75. package/out/phone/assets/{vennDiagram-4TSXK5OY-bTmZFq-k.js → vennDiagram-4TSXK5OY-Bt70Vh54.js} +1 -1
  76. package/out/phone/assets/{wardley-WFR3VGLG-DxZxBwnT.js → wardley-WFR3VGLG-BW51hFk8.js} +1 -1
  77. package/out/phone/assets/{wardleyDiagram-VM6X3IG4-t5MwTl6Q.js → wardleyDiagram-VM6X3IG4-CaARH4Sq.js} +1 -1
  78. package/out/phone/assets/{xychartDiagram-S5SC5T6Z-o-QLA07Y.js → xychartDiagram-S5SC5T6Z-qRYqM6fa.js} +1 -1
  79. package/out/phone/desk.html +3 -3
  80. package/out/phone/index.html +3 -3
  81. package/out/phone/sw.js +2 -2
  82. package/out/renderer/assets/{EditDiff-C4s3bU-R.js → EditDiff-CsZiYr45.js} +1 -1
  83. package/out/renderer/assets/{ReadFileView-cJEX2HPH.js → ReadFileView-DKGllK-F.js} +1 -1
  84. package/out/renderer/assets/{SidePanel-DimtLT8Q.js → SidePanel-DmR537Xd.js} +2 -2
  85. package/out/renderer/assets/{abnfDiagram-VCTEODGH-DKvQLNxl.js → abnfDiagram-VCTEODGH-CZcmcPKz.js} +1 -1
  86. package/out/renderer/assets/{arc-COwxE35C.js → arc-DaQpSl1q.js} +1 -1
  87. package/out/renderer/assets/{architectureDiagram-5GKGNRK7-CXxYVQ-x.js → architectureDiagram-5GKGNRK7-D8cSPLUW.js} +1 -1
  88. package/out/renderer/assets/{blockDiagram-I7D4REHJ-CMvFU-xh.js → blockDiagram-I7D4REHJ-kGSqNWv5.js} +1 -1
  89. package/out/renderer/assets/{c4Diagram-7LVT6UL2-DqkIurG4.js → c4Diagram-7LVT6UL2-mqY_hkiw.js} +1 -1
  90. package/out/renderer/assets/channel-zRjmXjDD.js +1 -0
  91. package/out/renderer/assets/{chunk-2Q5K7J3B-BvJ68CJ9.js → chunk-2Q5K7J3B-BtFVpFTn.js} +1 -1
  92. package/out/renderer/assets/{chunk-5VM5RSS4-pQq3Ri2E.js → chunk-5VM5RSS4-DzwIyZKl.js} +1 -1
  93. package/out/renderer/assets/{chunk-F27PBJKO-4eAk8-1c.js → chunk-F27PBJKO-8687_OuS.js} +1 -1
  94. package/out/renderer/assets/{chunk-IMKFNOWR-CORuLEem.js → chunk-IMKFNOWR-De9Tp0Fi.js} +1 -1
  95. package/out/renderer/assets/{chunk-JWPE2WC7-Co1JP8hE.js → chunk-JWPE2WC7-DWlQ0XON.js} +1 -1
  96. package/out/renderer/assets/{chunk-POPQ4Y6H-BG_gUWlb.js → chunk-POPQ4Y6H-Cr1pBwkF.js} +1 -1
  97. package/out/renderer/assets/{chunk-SVP7TREG-D_azldtp.js → chunk-SVP7TREG-4sCKltf5.js} +1 -1
  98. package/out/renderer/assets/{chunk-TICWLB2K-DBNgcUM3.js → chunk-TICWLB2K-DYy7Ae10.js} +1 -1
  99. package/out/renderer/assets/{chunk-XXDRQBXY-BpFx2_oS.js → chunk-XXDRQBXY-DkxZimQC.js} +1 -1
  100. package/out/renderer/assets/classDiagram-ZZMXUADV-DVcTuvxn.js +1 -0
  101. package/out/renderer/assets/classDiagram-v2-VYDZK3BY-DVcTuvxn.js +1 -0
  102. package/out/renderer/assets/{cose-bilkent-JH36ORCC-cbzVUH5i.js → cose-bilkent-JH36ORCC-JEf9wo2b.js} +1 -1
  103. package/out/renderer/assets/{cynefin-OW5HDTMX-DdGVKXpD.js → cynefin-OW5HDTMX-D_ngNdoA.js} +1 -1
  104. package/out/renderer/assets/{cynefinDiagram-5FMLGOSQ-CoXvoyv7.js → cynefinDiagram-5FMLGOSQ-qcLl6vDH.js} +1 -1
  105. package/out/renderer/assets/{dagre-GXQ25YYZ-DPj7Fszf.js → dagre-GXQ25YYZ-BK8Dgf-u.js} +1 -1
  106. package/out/renderer/assets/{diagram-S7CK7UJ4-CEBiLgR8.js → diagram-S7CK7UJ4-CR0M0L7e.js} +1 -1
  107. package/out/renderer/assets/{diagram-UQ7AKVKN-CO-GLoBI.js → diagram-UQ7AKVKN-DXHBmmFy.js} +1 -1
  108. package/out/renderer/assets/{diagram-VSXAHHWV-MII5LBuz.js → diagram-VSXAHHWV-BhNUuLum.js} +1 -1
  109. package/out/renderer/assets/{diagram-VX7I27RA-C6vVEfMX.js → diagram-VX7I27RA-zMCQ-ugG.js} +1 -1
  110. package/out/renderer/assets/{diagram-Z3DM3KII-BYQcJvzV.js → diagram-Z3DM3KII-G4uHzmuz.js} +1 -1
  111. package/out/renderer/assets/{ebnfDiagram-PWID7BFC-DqjynLKg.js → ebnfDiagram-PWID7BFC-ClotS3eg.js} +1 -1
  112. package/out/renderer/assets/{erDiagram-RLTQ6QDP-C3EnWx_s.js → erDiagram-RLTQ6QDP-D7PS8s3p.js} +1 -1
  113. package/out/renderer/assets/{flowDiagram-HODETNUW-CaR5_paJ.js → flowDiagram-HODETNUW-B4n-NcfI.js} +1 -1
  114. package/out/renderer/assets/{ganttDiagram-EL5Y4UJY-DOrZ_6co.js → ganttDiagram-EL5Y4UJY-uCKTQI5T.js} +1 -1
  115. package/out/renderer/assets/{gitGraphDiagram-WWUBYQGX-BnQuPD29.js → gitGraphDiagram-WWUBYQGX-D8V4RVbP.js} +1 -1
  116. package/out/renderer/assets/{index-BCmk6x7B.js → index-DUyNTJmE.js} +272 -272
  117. package/out/renderer/assets/{infoDiagram-27XIBGKW-MZQIidAo.js → infoDiagram-27XIBGKW-CFsFpCO0.js} +1 -1
  118. package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-8Ns166qG.js → ishikawaDiagram-5VMMS53U-CPhKje45.js} +1 -1
  119. package/out/renderer/assets/{journeyDiagram-3NMN7TZE-BZRcR7NU.js → journeyDiagram-3NMN7TZE-BmeYLeFj.js} +1 -1
  120. package/out/renderer/assets/{kanban-definition-UXKFOSKX-BL8MeZ8V.js → kanban-definition-UXKFOSKX-DFWY2-B7.js} +1 -1
  121. package/out/renderer/assets/{layout-Bd0RsD3t.js → layout-CyXjLVVF.js} +1 -1
  122. package/out/renderer/assets/{linear-CLNSvs6X.js → linear-C7cMP9ty.js} +1 -1
  123. package/out/renderer/assets/{mermaid.core-C7_3uxUU.js → mermaid.core-CXUd-Wvc.js} +5 -5
  124. package/out/renderer/assets/{mindmap-definition-YA3MSWOX-D5EZxj9K.js → mindmap-definition-YA3MSWOX-D2pxnRRB.js} +1 -1
  125. package/out/renderer/assets/{pegDiagram-XKGWAZYB-Dnhwt7dm.js → pegDiagram-XKGWAZYB-DbkClgur.js} +1 -1
  126. package/out/renderer/assets/{pieDiagram-E7YTZNPT-CBDZCyRu.js → pieDiagram-E7YTZNPT-UVTDwaij.js} +1 -1
  127. package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-DEQXP9Eo.js → quadrantDiagram-AXDQQJYC-uP6VB0R3.js} +1 -1
  128. package/out/renderer/assets/{railroadDiagram-O6MQD6OU-wppyfObu.js → railroadDiagram-O6MQD6OU-C5TiLueC.js} +1 -1
  129. package/out/renderer/assets/{requirementDiagram-BXWQKSXE-My1GIaoL.js → requirementDiagram-BXWQKSXE-D-5jrTq7.js} +1 -1
  130. package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-CODqfCoJ.js → sankeyDiagram-P5KCCOFB-Dy9wZRpZ.js} +1 -1
  131. package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-DWTI2GPN.js → sequenceDiagram-WJ2MYXX4-UsVN9eJW.js} +1 -1
  132. package/out/renderer/assets/{sessionChanges-55Ce2W6e.js → sessionChanges-CB72fgAn.js} +1 -1
  133. package/out/renderer/assets/{sizeCapture-INFHLROL-BtNh4g-W.js → sizeCapture-INFHLROL-BzBIyBEe.js} +1 -1
  134. package/out/renderer/assets/{stateDiagram-D77RDMKH-BpLm_QD-.js → stateDiagram-D77RDMKH-B0O1IWp8.js} +1 -1
  135. package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-D0dsqv3E.js +1 -0
  136. package/out/renderer/assets/{swimlanes-42K2YHIH-Dj27vx03.js → swimlanes-42K2YHIH-BVvUpkQp.js} +1 -1
  137. package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-Dtk8AO8A.js +8 -0
  138. package/out/renderer/assets/{timeline-definition-24CTP7MA-BXaGk6Mr.js → timeline-definition-24CTP7MA-DAF6oQ4P.js} +1 -1
  139. package/out/renderer/assets/{vennDiagram-4TSXK5OY-B8VVfucW.js → vennDiagram-4TSXK5OY-BQ4iCU32.js} +1 -1
  140. package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-TCPh_Xam.js → wardleyDiagram-VM6X3IG4-tr_QJe4L.js} +1 -1
  141. package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-ChKUHFHq.js → xychartDiagram-S5SC5T6Z-B58FjPZx.js} +1 -1
  142. package/out/renderer/index.html +1 -1
  143. package/out/server/agent.js +4 -4
  144. package/out/server/chunks/{builtinOccupancy-D8_T5SBm.js → builtinOccupancy-CcKXijUB.js} +3 -3
  145. package/out/server/chunks/{dispatchModel-COFs7Mxc.js → dispatchModel-Dh9V2tcb.js} +2 -2
  146. package/out/server/chunks/{loadProvider-DMF_f1uH.js → loadProvider-B1Pypdk9.js} +2 -2
  147. package/out/server/chunks/{menuSkills-D-SjYY21.js → menuSkills-DhkgK3Qg.js} +3 -3
  148. package/out/server/chunks/{projectCode-UvWkPILc.js → projectCode-DiqxQAvp.js} +2 -2
  149. package/out/server/chunks/{web-DlqMGm8c.js → web-G9sA9fk5.js} +2 -2
  150. package/out/server/chunks/{workflowPresets-COjG82iz.js → workflowPresets-BqTgQbcu.js} +2 -2
  151. package/out/server/index.js +198 -14
  152. package/package.json +1 -1
  153. package/out/phone/assets/architecture-7GRP2DOG-DroUMTKc.js +0 -1
  154. package/out/phone/assets/channel-BF88Uwu2.js +0 -1
  155. package/out/phone/assets/classDiagram-ZZMXUADV-VmTmyVMD.js +0 -1
  156. package/out/phone/assets/classDiagram-v2-VYDZK3BY-VmTmyVMD.js +0 -1
  157. package/out/phone/assets/eventmodeling-NTZA5JFV-D5llMeQ5.js +0 -1
  158. package/out/phone/assets/flowDiagram-HODETNUW-CkQ2of0C.js +0 -1
  159. package/out/phone/assets/main-DtnpLJjx.js +0 -277
  160. package/out/phone/assets/railroad-abnf-HS5TGJTU-Dtu3vS3c.js +0 -1
  161. package/out/phone/assets/railroad-ebnf-LZEXJU2U-DruUmiMw.js +0 -1
  162. package/out/phone/assets/railroad-peg-WCYAUIDC-DmK0BjdF.js +0 -1
  163. package/out/phone/assets/stateDiagram-v2-MP3YSRHH-CSeiPhWU.js +0 -1
  164. package/out/phone/assets/swimlanesDiagram-VR7AAH4N-BZvdvCoE.js +0 -8
  165. package/out/renderer/assets/channel-CFaWfxDZ.js +0 -1
  166. package/out/renderer/assets/classDiagram-ZZMXUADV-BIvTaGhI.js +0 -1
  167. package/out/renderer/assets/classDiagram-v2-VYDZK3BY-BIvTaGhI.js +0 -1
  168. package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-uLtDbyZ2.js +0 -1
  169. package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-Cz-6UA9B.js +0 -8
@@ -1,277 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-aPuBvESs.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/html-BsvMqTlf.js","assets/javascript-DcMHgNcu.js","assets/css-DlBQoFxe.js","assets/angular-ts-ocjSXnvf.js","assets/scss-BaZL6t2Y.js","assets/apl-D8Zaj6f9.js","assets/xml-C01ajBW7.js","assets/java-D7h0NA_A.js","assets/json-DePJdKYk.js","assets/astro-CbVusc_k.js","assets/typescript-BTGs5etX.js","assets/postcss-BXeXVLqQ.js","assets/tsx-DvWhG4dC.js","assets/blade-BuKMbjJR.js","assets/html-derivative-D9FvRNj4.js","assets/sql-DvarVTMJ.js","assets/bsl-_VjlB9mv.js","assets/sdbl-bTVj8UrX.js","assets/c-BNQJhXlP.js","assets/cairo-DLTphjLi.js","assets/python-gzcpVVnB.js","assets/chapel-CFMD-Djs.js","assets/cobol-qSrRm_BU.js","assets/coffee-BP03ytLP.js","assets/cpp-CUBNVKxn.js","assets/regexp-I2jnduhj.js","assets/glsl-CyFpZtQv.js","assets/crystal-CCpd0BXH.js","assets/shellscript-B51zB43X.js","assets/edge-k_uo0VIr.js","assets/elixir-CJS91GrO.js","assets/elm-Bmx6Fs0i.js","assets/erb-yi0ZozmI.js","assets/ruby-D1ky9XZ0.js","assets/haml-Dds4VdNJ.js","assets/graphql-BIyAKkG2.js","assets/jsx-BUUYi3qs.js","assets/lua-Z49wBRLR.js","assets/yaml-BWCS3NLV.js","assets/erlang-Cphh6RMH.js","assets/markdown-BYOwaDjH.js","assets/fortran-fixed-form-DEKoE2YW.js","assets/fortran-free-form-CYNrtFtB.js","assets/fsharp-D13ZGOAj.js","assets/gdresource-xMC7jr7x.js","assets/gdshader-CBce3t8t.js","assets/gdscript-DYvRD3hg.js","assets/git-commit-BSykSTBG.js","assets/diff-woXpYk--.js","assets/git-rebase-C-RR1FSc.js","assets/glimmer-js-Di6EiJvU.js","assets/glimmer-ts-C2P-EwIP.js","assets/hack-DDi4pUY-.js","assets/handlebars-C81KA5yo.js","assets/http-c4_vT9ST.js","assets/hurl-BqZA9I9Q.js","assets/csv-Dx-8-gkx.js","assets/hxml-Dcm88srW.js","assets/haxe-C8oCnwJJ.js","assets/jinja-CixBDh_U.js","assets/jison-Ru_S5AEn.js","assets/julia-CaY0JZD0.js","assets/r-CvCSiWB_.js","assets/just-Q4EdCjF5.js","assets/perl-BtArmf81.js","assets/latex-t1iljvl0.js","assets/tex-JPaUWOrn.js","assets/liquid-DEL4RHa9.js","assets/marko-DYWPPmCl.js","assets/less-DVTAwKKz.js","assets/mdc-CsAWFGA9.js","assets/nextflow-BJtWHP5T.js","assets/nextflow-groovy-DJMQeKeT.js","assets/nginx-BrbrEdla.js","assets/nim-BjwzhXka.js","assets/org-TFl3N09_.js","assets/clojure-DqKBuwfJ.js","assets/csharp-oqKa8noW.js","assets/dart-CnvKMtbv.js","assets/docker-IyjqRm3v.js","assets/go-rLFTqkRN.js","assets/groovy-CacY0gHj.js","assets/ini-B5eOa1yu.js","assets/make-Dixweg8N.js","assets/objective-c-D1A_Heim.js","assets/ocaml-O90oeIOV.js","assets/php-Cx25uSIP.js","assets/vb-DOwzaHZ0.js","assets/raku-B3gFvitq.js","assets/rust-Cfkwpbl8.js","assets/scala-BiFt_7mu.js","assets/zig-CMLA9XwU.js","assets/xsl-CCLNyvR3.js","assets/pug-B4bk2kWf.js","assets/qml-g4UDed-8.js","assets/razor-BSt2ayLr.js","assets/rst-BucurtmO.js","assets/cmake-Bj61d0ZC.js","assets/sas-CUQt684o.js","assets/shaderlab-TOUzSsQk.js","assets/hlsl-Cvrh5tZx.js","assets/shellsession-B-KBpmJs.js","assets/soy-D5xCHD_M.js","assets/sparql-D_iOobhT.js","assets/turtle-ByJddavk.js","assets/stata-8TbiBYrm.js","assets/surrealql-DalIYx4r.js","assets/svelte-D4FIy7cP.js","assets/templ-DP4lTcEq.js","assets/ts-tags-CNUq3so9.js","assets/twig-Chu5fnNS.js","assets/typst--WwEKe8X.js","assets/bat-qdxAdBWQ.js","assets/bibtex-Ci_nEsc7.js","assets/jsonc-CYpm1nAK.js","assets/log-BNLmms1o.js","assets/powershell-CCSX75yM.js","assets/swift-CyEgAFGc.js","assets/system-verilog-Dh5ihWbf.js","assets/verilog-B2gwz-sJ.js","assets/vue-DjCn01CB.js","assets/vue-html-BXjKVtKk.js","assets/vue-vine-By_xyXdL.js","assets/stylus-B6D30XZt.js","assets/mermaid.core-CL48hMfG.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-oBChb5qS.js","assets/chunk-DU6HZSFF-CeYtDBPs.js","assets/chunk-75Z2AOVW-QvFknKGi.js","assets/dist-B_J_HbC0.js","assets/chunk-PWAF6VOD-CV-3dG-I.js","assets/chunk-GMAD6QVW-SLRPQ8AI.js","assets/chunk-P2QGCYS3-KWTrRS1P.js","assets/chunk-4HAMMTFA-ClCSp7Xk.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-GVQU2GXP-BiPH1vVN.js","assets/chunk-OSK3NFVY-BDSQEHdr.js","assets/line-Owcld2hO.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/graphlib-DS17s2tU.js","assets/chunk-L3NEJ4N5-2hf9zWlv.js","assets/EditDiff-DPrGvGAU.js","assets/shellUpdate-Bz93QVRZ.js","assets/codeHighlighter-Dd1boUw8.js","assets/ReadFileView-s4kjqMan.js","assets/jsQR-B1eQcpQl.js"])))=>i.map(i=>d[i]);
2
- import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{A as r,At as i,B as a,Bt as o,C as s,Ct as c,D as l,Dt as u,E as d,Et as f,F as p,Ft as m,G as h,Gt as g,H as _,Ht as v,I as y,It as b,L as x,Lt as S,M as C,Mt as w,N as T,Nt as E,O as D,Ot as O,P as k,Pt as A,R as j,Rt as M,S as N,St as P,T as F,Tt as I,U as ee,Ut as L,V as te,Vt as R,W as z,Wt as B,_ as ne,a as V,at as re,b as ie,c as ae,ct as oe,d as se,dt as ce,f as le,ft as ue,g as de,h as fe,ht as pe,it as me,j as he,jt as ge,k as _e,kt as ve,l as ye,lt as be,m as xe,mt as Se,n as Ce,o as we,ot as Te,p as Ee,rt as De,s as Oe,t as ke,tt as Ae,ut as je,vt as Me,w as Ne,wt as Pe,y as Fe,z as Ie,zt as Le}from"./shellUpdate-Bz93QVRZ.js";function Re(){window.electronAPI||Object.defineProperty(window,"electronAPI",{value:{git:{diffHead:async()=>({ok:!1,error:`unavailable`})},changes:{readSnapshots:async()=>({}),writeSnapshots:async()=>!1},workspaceFiles:{listDir:async()=>({ok:!1,error:`unavailable`}),read:async()=>({ok:!1,error:`unavailable`}),write:async()=>({ok:!1,error:`unavailable`}),watchStart:async()=>({ok:!1,error:`unavailable`}),watchStop:async()=>({ok:!1,error:`unavailable`}),onChange:()=>()=>void 0,search:async()=>({ok:!1,error:`unavailable`})},files:{read:async()=>null,search:async()=>[],pathForFile:()=>null},agentRegistry:{list:async()=>null},agent:{stopTask:async()=>({ok:!1,error:`not supported on phone`}),stopSubagent:async()=>({ok:!1,error:`not supported on phone`})},providers:{listOauth:async()=>[],getOauthUsage:async()=>null}},writable:!1})}function ze(e){let t=window.electronAPI?.agent;t&&(t.stopTask=async(t,n)=>(e.stopTask(t,n),{ok:!0}),t.stopSubagent=async(t,n)=>(e.stopSubagent(t,n),{ok:!0}))}Re();var Be=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Ve=n(((e,t)=>{t.exports=Be()})),He=n((e=>{var t=g();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),Ue=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=He()})),We=n((e=>{var t=Ve(),n=g(),r=Ue();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},ee=[],L=-1;function te(e){return{current:e}}function R(e){0>L||(e.current=ee[L],ee[L]=null,L--)}function z(e,t){L++,ee[L]=e.current,e.current=t}var B=te(null),ne=te(null),V=te(null),re=te(null);function ie(e,t){switch(z(V,t),z(ne,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Kd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Kd(t),e=qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function ae(){R(B),R(ne),R(V)}function oe(e){e.memoizedState!==null&&z(re,e);var t=B.current,n=qd(t,e.type);t!==n&&(z(ne,e),z(B,n))}function se(e){ne.current===e&&(R(B),R(ne)),re.current===e&&(R(re),rp._currentValue=I)}var ce,le;function ue(e){if(ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ce=t&&t[1]||``,le=-1<e.stack.indexOf(`
3
- at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
- `+ce+e+le}var de=!1;function fe(e,t){if(!e||de)return``;de=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
- `),l=s.split(`
6
- `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
7
- `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{de=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ue(n):``}function pe(e,t){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue(`Lazy`);case 13:return e.child!==t&&t!==null?ue(`Suspense Fallback`):ue(`Suspense`);case 19:return ue(`SuspenseList`);case 0:case 15:return fe(e.type,!1);case 11:return fe(e.type.render,!1);case 1:return fe(e.type,!0);case 31:return ue(`Activity`);default:return``}}function me(e){try{var t=``,n=null;do t+=pe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
- Error generating stack: `+e.message+`
9
- `+e.stack}}var he=Object.prototype.hasOwnProperty,ge=t.unstable_scheduleCallback,_e=t.unstable_cancelCallback,ve=t.unstable_shouldYield,ye=t.unstable_requestPaint,be=t.unstable_now,xe=t.unstable_getCurrentPriorityLevel,Se=t.unstable_ImmediatePriority,Ce=t.unstable_UserBlockingPriority,we=t.unstable_NormalPriority,Te=t.unstable_LowPriority,Ee=t.unstable_IdlePriority,De=t.log,Oe=t.unstable_setDisableYieldValue,ke=null,Ae=null;function je(e){if(typeof De==`function`&&Oe(e),Ae&&typeof Ae.setStrictMode==`function`)try{Ae.setStrictMode(ke,e)}catch{}}var Me=Math.clz32?Math.clz32:Fe,Ne=Math.log,Pe=Math.LN2;function Fe(e){return e>>>=0,e===0?32:31-(Ne(e)/Pe|0)|0}var Ie=256,Le=262144,Re=4194304;function ze(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Be(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=ze(n))):i=ze(o):i=ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ze(n))):i=ze(o)):i=ze(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function He(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ge(){var e=Re;return Re<<=1,!(Re&62914560)&&(Re=4194304),e}function H(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ke(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function qe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Me(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Je(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Je(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Me(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ye(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Me(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Xe(e,t){var n=t&-t;return n=n&42?1:Ze(n),(n&(e.suspendedLanes|t))===0?n:0}function Ze(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Qe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function $e(){var e=F.p;return e===0?(e=window.event,e===void 0?32:yp(e.type)):e}function et(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var tt=Math.random().toString(36).slice(2),nt=`__reactFiber$`+tt,rt=`__reactProps$`+tt,U=`__reactContainer$`+tt,it=`__reactEvents$`+tt,at=`__reactListeners$`+tt,ot=`__reactHandles$`+tt,st=`__reactResources$`+tt,ct=`__reactMarker$`+tt;function lt(e){delete e[nt],delete e[rt],delete e[it],delete e[at],delete e[ot]}function ut(e){var t=e[nt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[U]||n[nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=gf(e);e!==null;){if(n=e[nt])return n;e=gf(e)}return t}e=n,n=e.parentNode}return null}function dt(e){if(e=e[nt]||e[U]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ft(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function pt(e){var t=e[st];return t||=e[st]={hoistableStyles:new Map,hoistableScripts:new Map},t}function mt(e){e[ct]=!0}var ht=new Set,gt={};function _t(e,t){vt(e,t),vt(e+`Capture`,t)}function vt(e,t){for(gt[e]=t,e=0;e<t.length;e++)ht.add(t[e])}var yt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),bt={},xt={};function St(e){return he.call(xt,e)?!0:he.call(bt,e)?!1:yt.test(e)?xt[e]=!0:(bt[e]=!0,!1)}function Ct(e,t,n){if(St(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function wt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Tt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Et(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Dt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ot(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function kt(e){if(!e._valueTracker){var t=Dt(e)?`checked`:`value`;e._valueTracker=Ot(e,t,``+e[t])}}function At(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Dt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function jt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Mt=/[\n"\\]/g;function Nt(e){return e.replace(Mt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Pt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Et(t)):e.value!==``+Et(t)&&(e.value=``+Et(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):It(e,o,Et(n)):It(e,o,Et(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Et(s):e.removeAttribute(`name`)}function Ft(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){kt(e);return}n=n==null?``:``+Et(n),t=t==null?n:``+Et(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),kt(e)}function It(e,t,n){t===`number`&&jt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Lt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Et(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Rt(e,t,n){if(t!=null&&(t=``+Et(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Et(n)}function zt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(N(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Et(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),kt(e)}function Bt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Vt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Ht(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Vt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ut(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Ht(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Ht(e,o,t[o])}function Wt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Gt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Kt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function qt(e){return Kt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Jt(){}var Yt=null;function Xt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zt=null,Qt=null;function $t(e){var t=dt(e);if(t&&(e=t.stateNode)){var n=e[rt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Pt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Nt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[rt]||null;if(!a)throw Error(i(90));Pt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&At(r)}break a;case`textarea`:Rt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Lt(e,!!n.multiple,t,!1)}}}var en=!1;function tn(e,t,n){if(en)return e(t,n);en=!0;try{return e(t)}finally{if(en=!1,(Zt!==null||Qt!==null)&&(Cu(),Zt&&(t=Zt,e=Qt,Qt=Zt=null,$t(t),e)))for(t=0;t<e.length;t++)$t(e[t])}}function nn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[rt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var rn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),an=!1;if(rn)try{var on={};Object.defineProperty(on,"passive",{get:function(){an=!0}}),window.addEventListener(`test`,on,on),window.removeEventListener(`test`,on,on)}catch{an=!1}var sn=null,cn=null,ln=null;function un(){if(ln)return ln;var e,t=cn,n=t.length,r,i=`value`in sn?sn.value:sn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return ln=i.slice(e,1<r?1-r:void 0)}function dn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function fn(){return!0}function pn(){return!1}function mn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?fn:pn,this.isPropagationStopped=pn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=fn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=fn)},persist:function(){},isPersistent:fn}),t}var hn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gn=mn(hn),_n=f({},hn,{view:0,detail:0}),vn=mn(_n),yn,bn,xn,Sn=f({},_n,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==xn&&(xn&&e.type===`mousemove`?(yn=e.screenX-xn.screenX,bn=e.screenY-xn.screenY):bn=yn=0,xn=e),yn)},movementY:function(e){return`movementY`in e?e.movementY:bn}}),Cn=mn(Sn),wn=mn(f({},Sn,{dataTransfer:0})),Tn=mn(f({},_n,{relatedTarget:0})),En=mn(f({},hn,{animationName:0,elapsedTime:0,pseudoElement:0})),Dn=mn(f({},hn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),On=mn(f({},hn,{data:0})),kn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},An={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},jn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Mn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=jn[e])?!!t[e]:!1}function Nn(){return Mn}var Pn=mn(f({},_n,{key:function(e){if(e.key){var t=kn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=dn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?An[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nn,charCode:function(e){return e.type===`keypress`?dn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?dn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Fn=mn(f({},Sn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),In=mn(f({},_n,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nn})),Ln=mn(f({},hn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=mn(f({},Sn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),zn=mn(f({},hn,{newState:0,oldState:0})),Bn=[9,13,27,32],Vn=rn&&`CompositionEvent`in window,Hn=null;rn&&`documentMode`in document&&(Hn=document.documentMode);var Un=rn&&`TextEvent`in window&&!Hn,Wn=rn&&(!Vn||Hn&&8<Hn&&11>=Hn),Gn=` `,Kn=!1;function qn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Jn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Yn=!1;function Xn(e,t){switch(e){case`compositionend`:return Jn(t);case`keypress`:return t.which===32?(Kn=!0,Gn):null;case`textInput`:return e=t.data,e===Gn&&Kn?null:e;default:return null}}function Zn(e,t){if(Yn)return e===`compositionend`||!Vn&&qn(e,t)?(e=un(),ln=cn=sn=null,Yn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Wn&&t.locale!==`ko`?null:t.data;default:return null}}var Qn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function $n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Qn[e.type]:t===`textarea`}function er(e,t,n,r){Zt?Qt?Qt.push(r):Qt=[r]:Zt=r,t=Ad(t,`onChange`),0<t.length&&(n=new gn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var tr=null,nr=null;function rr(e){Sd(e,0)}function ir(e){if(At(ft(e)))return e}function ar(e,t){if(e===`change`)return t}var or=!1;if(rn){var sr;if(rn){var cr=`oninput`in document;if(!cr){var lr=document.createElement(`div`);lr.setAttribute(`oninput`,`return;`),cr=typeof lr.oninput==`function`}sr=cr}else sr=!1;or=sr&&(!document.documentMode||9<document.documentMode)}function ur(){tr&&(tr.detachEvent(`onpropertychange`,dr),nr=tr=null)}function dr(e){if(e.propertyName===`value`&&ir(nr)){var t=[];er(t,nr,e,Xt(e)),tn(rr,t)}}function fr(e,t,n){e===`focusin`?(ur(),tr=t,nr=n,tr.attachEvent(`onpropertychange`,dr)):e===`focusout`&&ur()}function pr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ir(nr)}function mr(e,t){if(e===`click`)return ir(t)}function hr(e,t){if(e===`input`||e===`change`)return ir(t)}function gr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var _r=typeof Object.is==`function`?Object.is:gr;function vr(e,t){if(_r(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!he.call(t,i)||!_r(e[i],t[i]))return!1}return!0}function yr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function br(e,t){var n=yr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=yr(n)}}function xr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=jt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=jt(e.document)}return t}function Cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var wr=rn&&`documentMode`in document&&11>=document.documentMode,Tr=null,Er=null,Dr=null,Or=!1;function kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Or||Tr==null||Tr!==jt(r)||(r=Tr,`selectionStart`in r&&Cr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dr&&vr(Dr,r)||(Dr=r,r=Ad(Er,`onSelect`),0<r.length&&(t=new gn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Tr)))}function Ar(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var jr={animationend:Ar(`Animation`,`AnimationEnd`),animationiteration:Ar(`Animation`,`AnimationIteration`),animationstart:Ar(`Animation`,`AnimationStart`),transitionrun:Ar(`Transition`,`TransitionRun`),transitionstart:Ar(`Transition`,`TransitionStart`),transitioncancel:Ar(`Transition`,`TransitionCancel`),transitionend:Ar(`Transition`,`TransitionEnd`)},Mr={},Nr={};rn&&(Nr=document.createElement(`div`).style,`AnimationEvent`in window||(delete jr.animationend.animation,delete jr.animationiteration.animation,delete jr.animationstart.animation),`TransitionEvent`in window||delete jr.transitionend.transition);function Pr(e){if(Mr[e])return Mr[e];if(!jr[e])return e;var t=jr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Nr)return Mr[e]=t[n];return e}var Fr=Pr(`animationend`),Ir=Pr(`animationiteration`),Lr=Pr(`animationstart`),Rr=Pr(`transitionrun`),zr=Pr(`transitionstart`),Br=Pr(`transitioncancel`),Vr=Pr(`transitionend`),Hr=new Map,Ur=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Ur.push(`scrollEnd`);function Wr(e,t){Hr.set(e,t),_t(t,[e])}var Gr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Kr=[],qr=0,Jr=0;function Yr(){for(var e=qr,t=Jr=qr=0;t<e;){var n=Kr[t];Kr[t++]=null;var r=Kr[t];Kr[t++]=null;var i=Kr[t];Kr[t++]=null;var a=Kr[t];if(Kr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&$r(n,i,a)}}function Xr(e,t,n,r){Kr[qr++]=e,Kr[qr++]=t,Kr[qr++]=n,Kr[qr++]=r,Jr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Zr(e,t,n,r){return Xr(e,t,n,r),ei(e)}function Qr(e,t){return Xr(e,null,null,t),ei(e)}function $r(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Me(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ei(e){if(50<mu)throw mu=0,hu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ti={};function ni(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ri(e,t,n,r){return new ni(e,t,n,r)}function ii(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ai(e,t){var n=e.alternate;return n===null?(n=ri(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function oi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function si(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ii(e)&&(s=1);else if(typeof e==`string`)s=Jf(e,n,B.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case D:return e=ri(31,n,t,a),e.elementType=D,e.lanes=o,e;case _:return ci(n.children,a,o,t);case v:s=8,a|=24;break;case y:return e=ri(12,n,t,a|2),e.elementType=y,e.lanes=o,e;case C:return e=ri(13,n,t,a),e.elementType=C,e.lanes=o,e;case w:return e=ri(19,n,t,a),e.elementType=w,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case x:s=10;break a;case b:s=9;break a;case S:s=11;break a;case T:s=14;break a;case E:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ri(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ci(e,t,n,r){return e=ri(7,e,r,t),e.lanes=n,e}function li(e,t,n){return e=ri(6,e,null,t),e.lanes=n,e}function ui(e){var t=ri(18,null,null,0);return t.stateNode=e,t}function di(e,t,n){return t=ri(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var fi=new WeakMap;function pi(e,t){if(typeof e==`object`&&e){var n=fi.get(e);return n===void 0?(t={value:e,source:t,stack:me(t)},fi.set(e,t),t):n}return{value:e,source:t,stack:me(t)}}var mi=[],hi=0,gi=null,_i=0,vi=[],yi=0,bi=null,xi=1,Si=``;function Ci(e,t){mi[hi++]=_i,mi[hi++]=gi,gi=e,_i=t}function wi(e,t,n){vi[yi++]=xi,vi[yi++]=Si,vi[yi++]=bi,bi=e;var r=xi;e=Si;var i=32-Me(r)-1;r&=~(1<<i),n+=1;var a=32-Me(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,xi=1<<32-Me(t)+i|n<<i|r,Si=a+e}else xi=1<<a|n<<i|r,Si=e}function Ti(e){e.return!==null&&(Ci(e,1),wi(e,1,0))}function Ei(e){for(;e===gi;)gi=mi[--hi],mi[hi]=null,_i=mi[--hi],mi[hi]=null;for(;e===bi;)bi=vi[--yi],vi[yi]=null,Si=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null}function Di(e,t){vi[yi++]=xi,vi[yi++]=Si,vi[yi++]=bi,xi=t.id,Si=t.overflow,bi=e}var Oi=null,ki=null,Ai=!1,ji=null,Mi=!1,Ni=Error(i(519));function Pi(e){throw Bi(pi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ni}function Fi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[nt]=e,t[rt]=r,n){case`dialog`:Cd(`cancel`,t),Cd(`close`,t);break;case`iframe`:case`object`:case`embed`:Cd(`load`,t);break;case`video`:case`audio`:for(n=0;n<bd.length;n++)Cd(bd[n],t);break;case`source`:Cd(`error`,t);break;case`img`:case`image`:case`link`:Cd(`error`,t),Cd(`load`,t);break;case`details`:Cd(`toggle`,t);break;case`input`:Cd(`invalid`,t),Ft(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Cd(`invalid`,t);break;case`textarea`:Cd(`invalid`,t),zt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Id(t.textContent,n)?(r.popover!=null&&(Cd(`beforetoggle`,t),Cd(`toggle`,t)),r.onScroll!=null&&Cd(`scroll`,t),r.onScrollEnd!=null&&Cd(`scrollend`,t),r.onClick!=null&&(t.onclick=Jt),t=!0):t=!1,t||Pi(e,!0)}function Ii(e){for(Oi=e.return;Oi;)switch(Oi.tag){case 5:case 31:case 13:Mi=!1;return;case 27:case 3:Mi=!0;return;default:Oi=Oi.return}}function Li(e){if(e!==Oi)return!1;if(!Ai)return Ii(e),Ai=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Jd(e.type,e.memoizedProps)),n=!n),n&&ki&&Pi(e),Ii(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ki=hf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ki=hf(e)}else t===27?(t=ki,nf(e.type)?(e=mf,mf=null,ki=e):ki=t):ki=Oi?pf(e.stateNode.nextSibling):null;return!0}function Ri(){ki=Oi=null,Ai=!1}function zi(){var e=ji;return e!==null&&(eu===null?eu=e:eu.push.apply(eu,e),ji=null),e}function Bi(e){ji===null?ji=[e]:ji.push(e)}var Vi=te(null),Hi=null,Ui=null;function Wi(e,t,n){z(Vi,t._currentValue),t._currentValue=n}function Gi(e){e._currentValue=Vi.current,R(Vi)}function Ki(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function qi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ki(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ki(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Ji(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;_r(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===re.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[rp]:e.push(rp))}a=a.return}e!==null&&qi(t,e,n,r),t.flags|=262144}function Yi(e){for(e=e.firstContext;e!==null;){if(!_r(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Xi(e){Hi=e,Ui=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Zi(e){return $i(Hi,e)}function Qi(e,t){return Hi===null&&Xi(e),$i(e,t)}function $i(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ui===null){if(e===null)throw Error(i(308));Ui=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ui=Ui.next=t;return n}var ea=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ta=t.unstable_scheduleCallback,na=t.unstable_NormalPriority,ra={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ia(){return{controller:new ea,data:new Map,refCount:0}}function aa(e){e.refCount--,e.refCount===0&&ta(na,function(){e.controller.abort()})}var oa=null,sa=0,ca=0,la=null;function ua(e,t){if(oa===null){var n=oa=[];sa=0,ca=md(),la={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return sa++,t.then(da,da),t}function da(){if(--sa===0&&oa!==null){la!==null&&(la.status=`fulfilled`);var e=oa;oa=null,ca=0,la=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function fa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var pa=P.S;P.S=function(e,t){ru=be(),typeof t==`object`&&t&&typeof t.then==`function`&&ua(e,t),pa!==null&&pa(e,t)};var ma=te(null);function ha(){var e=ma.current;return e===null?Rl.pooledCache:e}function ga(e,t){t===null?z(ma,ma.current):z(ma,t.pool)}function _a(){var e=ha();return e===null?null:{parent:ra._currentValue,pool:e}}var va=Error(i(460)),ya=Error(i(474)),ba=Error(i(542)),xa={then:function(){}};function Sa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ca(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Jt,Jt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,W(e),e;default:if(typeof t.status==`string`)t.then(Jt,Jt);else{if(e=Rl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,W(e),e}throw Ta=t,va}}function wa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ta=e,va):e}}var Ta=null;function Ea(){if(Ta===null)throw Error(i(459));var e=Ta;return Ta=null,e}function W(e){if(e===va||e===ba)throw Error(i(483))}var Da=null,Oa=0;function ka(e){var t=Oa;return Oa+=1,Da===null&&(Da=[]),Ca(Da,e,t)}function Aa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ja(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ai(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=li(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===_?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===E&&wa(i)===t.type)?(t=a(t,n.props),Aa(t,n),t.return=e,t):(t=si(n.type,n.key,n.props,null,e.mode,r),Aa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=di(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ci(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=li(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=si(t.type,t.key,t.props,null,e.mode,n),Aa(n,t),n.return=e,n;case h:return t=di(t,e.mode,n),t.return=e,t;case E:return t=wa(t),f(e,t,n)}if(N(t)||A(t))return t=ci(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ka(t),n);if(t.$$typeof===x)return f(e,Qi(e,t),n);ja(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case E:return n=wa(n),p(e,t,n,r)}if(N(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ka(n),r);if(n.$$typeof===x)return p(e,t,Qi(e,n),r);ja(e,n)}return null}function g(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case E:return r=wa(r),g(e,t,n,r,i)}if(N(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return g(e,t,n,ka(r),i);if(r.$$typeof===x)return g(e,t,n,Qi(t,r),i);ja(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var _=p(i,d,s[m],c);if(_===null){d===null&&(d=h);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,m),u===null?l=_:u.sibling=_,u=_,d=h}if(m===s.length)return n(i,d),Ai&&Ci(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return Ai&&Ci(i,m),l}for(d=r(d);m<s.length;m++)h=g(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),Ai&&Ci(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,_=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(_=m,m=null):_=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=_);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=_}if(v.done)return n(a,m),Ai&&Ci(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return Ai&&Ci(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=g(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),Ai&&Ci(a,h),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===E&&wa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Aa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===_?(c=ci(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=si(o.type,o.key,o.props,null,e.mode,c),Aa(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=di(o,e.mode,c),c.return=e,e=c}return s(e);case E:return o=wa(o),b(e,r,o,c)}if(N(o))return v(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,ka(o),c);if(o.$$typeof===x)return b(e,r,Qi(e,o),c);ja(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=li(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===va||t===ba)throw t;var a=ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ll&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ei(e),$r(e,null,n),t}return Xr(e,r,t,n),ei(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=la;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Bl&p)===p:(r&p)===p){p!==0&&p===ca&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Fa=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Jl|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ga(n[e],t)}var G=te(null),qa=te(0);function Ja(e,t){e=Kl,z(qa,e),z(G,t),Kl=e|t.baseLanes}function Ya(){z(qa,Kl),z(G,G.current)}function Xa(){Kl=qa.current,R(G),R(qa)}var Za=te(null),Qa=null;function $a(e){var t=e.alternate;z(io,io.current&1),z(Za,e),Qa===null&&(t===null||G.current!==null||t.memoizedState!==null)&&(Qa=e)}function eo(e){z(io,io.current),z(Za,e),Qa===null&&(Qa=e)}function to(e){e.tag===22?(z(io,io.current),z(Za,e),Qa===null&&(Qa=e)):no(e)}function no(){z(io,io.current),z(Za,Za.current)}function ro(e){R(Za),Qa===e&&(Qa=null),R(io)}var io=te(0);function ao(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||uf(n)||df(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var oo=0,so=null,co=null,lo=null,uo=!1,fo=!1,po=!1,mo=0,ho=0,go=null,_o=0;function vo(){throw Error(i(321))}function yo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!_r(e[n],t[n]))return!1;return!0}function bo(e,t,n,r,i,a){return oo=a,so=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?Is:Ls,po=!1,a=n(r,i),po=!1,fo&&(a=So(t,n,r,i)),xo(e),a}function xo(e){P.H=Fs;var t=co!==null&&co.next!==null;if(oo=0,lo=co=so=null,uo=!1,ho=0,go=null,t)throw Error(i(300));e===null||$s||(e=e.dependencies,e!==null&&Yi(e)&&($s=!0))}function So(e,t,n,r){so=e;var a=0;do{if(fo&&(go=null),ho=0,fo=!1,25<=a)throw Error(i(301));if(a+=1,lo=co=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}P.H=Rs,o=t(n,r)}while(fo);return o}function Co(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?Ao(t):t,e=e.useState()[0],(co===null?null:co.memoizedState)!==e&&(so.flags|=1024),t}function wo(){var e=mo!==0;return mo=0,e}function To(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Eo(e){if(uo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}uo=!1}oo=0,lo=co=so=null,fo=!1,ho=mo=0,go=null}function Do(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lo===null?so.memoizedState=lo=e:lo=lo.next=e,lo}function Oo(){if(co===null){var e=so.alternate;e=e===null?null:e.memoizedState}else e=co.next;var t=lo===null?so.memoizedState:lo.next;if(t!==null)lo=t,co=e;else{if(e===null)throw so.alternate===null?Error(i(467)):Error(i(310));co=e,e={memoizedState:co.memoizedState,baseState:co.baseState,baseQueue:co.baseQueue,queue:co.queue,next:null},lo===null?so.memoizedState=lo=e:lo=lo.next=e}return lo}function ko(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ao(e){var t=ho;return ho+=1,go===null&&(go=[]),e=Ca(go,e,t),t=so,(lo===null?t.memoizedState:lo.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?Is:Ls),e}function jo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Ao(e);if(e.$$typeof===x)return Zi(e)}throw Error(i(438,String(e)))}function Mo(e){var t=null,n=so.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=so.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ko(),so.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=O;return t.index++,n}function No(e,t){return typeof t==`function`?t(e):t}function Po(e){return Fo(Oo(),co,e)}function Fo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(oo&f)===f:(Bl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ca&&(d=!0);else if((oo&p)===p){u=u.next,p===ca&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,so.lanes|=p,Jl|=p;f=u.action,po&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,so.lanes|=f,Jl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!_r(o,e.memoizedState)&&($s=!0,d&&(n=la,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Io(e){var t=Oo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);_r(o,t.memoizedState)||($s=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Lo(e,t,n){var r=so,a=Oo(),o=Ai;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!_r((co||a).memoizedState,n);if(s&&(a.memoizedState=n,$s=!0),a=a.queue,cs(Bo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||lo!==null&&lo.memoizedState.tag&1){if(r.flags|=2048,rs(9,{destroy:void 0},zo.bind(null,r,a,n,t),null),Rl===null)throw Error(i(349));o||oo&127||Ro(r,t,n)}return n}function Ro(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=so.updateQueue,t===null?(t=ko(),so.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zo(e,t,n,r){t.value=n,t.getSnapshot=r,Vo(t)&&Ho(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Ho(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!_r(e,n)}catch{return!0}}function Ho(e){var t=Qr(e,2);t!==null&&vu(t,e,2)}function Uo(e){var t=Do();if(typeof e==`function`){var n=e;if(e=n(),po){je(!0);try{n()}finally{je(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:e},t}function Wo(e,t,n,r){return e.baseState=n,Fo(e,co,typeof r==`function`?r:No)}function Go(e,t,n,r,a){if(Ms(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};P.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ko(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ko(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),qo(e,t,s)}catch(n){Yo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),qo(e,t,a)}catch(n){Yo(e,t,n)}}function qo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Jo(e,t,n)},function(n){return Yo(e,t,n)}):Jo(e,t,n)}function Jo(e,t,n){t.status=`fulfilled`,t.value=n,Xo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ko(e,n)))}function Yo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Xo(t),t=t.next;while(t!==r)}e.action=null}function Xo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Zo(e,t){return t}function Qo(e,t){if(Ai){var n=Rl.formState;if(n!==null){a:{var r=so;if(Ai){if(ki){b:{for(var i=ki,a=Mi;i.nodeType!==8;){if(!a){i=null;break b}if(i=pf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ki=pf(i.nextSibling),r=i.data===`F!`;break a}}Pi(r)}r=!1}r&&(t=n[0])}}return n=Do(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zo,lastRenderedState:t},n.queue=r,n=K.bind(null,so,r),r.dispatch=n,r=Uo(!1),a=js.bind(null,so,!1,r.queue),r=Do(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Go.bind(null,so,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function $o(e){return es(Oo(),co,e)}function es(e,t,n){if(t=Fo(e,t,Zo)[0],e=Po(No)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Ao(t)}catch(e){throw e===va?ba:e}else r=t;t=Oo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(so.flags|=2048,rs(9,{destroy:void 0},ts.bind(null,i,n),null)),[r,a,e]}function ts(e,t){e.action=t}function ns(e){var t=Oo(),n=co;if(n!==null)return es(t,n,e);Oo(),t=t.memoizedState,n=Oo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function rs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=so.updateQueue,t===null&&(t=ko(),so.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function is(){return Oo().memoizedState}function as(e,t,n,r){var i=Do();so.flags|=e,i.memoizedState=rs(1|t,{destroy:void 0},n,r===void 0?null:r)}function os(e,t,n,r){var i=Oo();r=r===void 0?null:r;var a=i.memoizedState.inst;co!==null&&r!==null&&yo(r,co.memoizedState.deps)?i.memoizedState=rs(t,a,n,r):(so.flags|=e,i.memoizedState=rs(1|t,a,n,r))}function ss(e,t){as(8390656,8,e,t)}function cs(e,t){os(2048,8,e,t)}function ls(e){so.flags|=4;var t=so.updateQueue;if(t===null)t=ko(),so.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function us(e){var t=Oo().memoizedState;return ls({ref:t,nextImpl:e}),function(){if(Ll&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ds(e,t){return os(4,2,e,t)}function fs(e,t){return os(4,4,e,t)}function ps(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ms(e,t,n){n=n==null?null:n.concat([e]),os(4,4,ps.bind(null,t,e),n)}function hs(){}function gs(e,t){var n=Oo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&yo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function _s(e,t){var n=Oo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&yo(t,r[1]))return r[0];if(r=e(),po){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r}function vs(e,t,n){return n===void 0||oo&1073741824&&!(Bl&261930)?e.memoizedState=t:(e.memoizedState=n,e=_u(),so.lanes|=e,Jl|=e,n)}function ys(e,t,n,r){return _r(n,t)?n:G.current===null?!(oo&42)||oo&1073741824&&!(Bl&261930)?($s=!0,e.memoizedState=n):(e=_u(),so.lanes|=e,Jl|=e,t):(e=vs(e,n,r),_r(e,t)||($s=!0),e)}function bs(e,t,n,r,i){var a=F.p;F.p=a!==0&&8>a?a:8;var o=P.T,s={};P.T=s,js(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,fa(c,r),gu(e)):As(e,t,r,gu(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},gu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function xs(){}function Ss(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Cs(e).queue;bs(e,a,t,I,n===null?xs:function(){return ws(e),n(r)})}function Cs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:I},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ws(e){var t=Cs(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},gu())}function Ts(){return Zi(rp)}function Es(){return Oo().memoizedState}function Ds(){return Oo().memoizedState}function Os(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=gu();e=Ra(n);var r=za(t,e,n);r!==null&&(vu(r,t,n),Ba(r,t,n)),t={cache:ia()},e.payload=t;return}t=t.return}}function ks(e,t,n){var r=gu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=Zr(e,t,n,r),n!==null&&(vu(n,e,r),Ps(n,t,r)))}function K(e,t,n){As(e,t,n,gu())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,_r(s,o))return Xr(e,t,i,0),Rl===null&&Yr(),!1}catch{}if(n=Zr(e,t,i,r),n!==null)return vu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:md(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(i(479))}else t=Zr(e,n,r,2),t!==null&&vu(t,e,2)}function Ms(e){var t=e.alternate;return e===so||t!==null&&t===so}function Ns(e,t){fo=uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ye(e,n)}}var Fs={readContext:Zi,use:jo,useCallback:vo,useContext:vo,useEffect:vo,useImperativeHandle:vo,useLayoutEffect:vo,useInsertionEffect:vo,useMemo:vo,useReducer:vo,useRef:vo,useState:vo,useDebugValue:vo,useDeferredValue:vo,useTransition:vo,useSyncExternalStore:vo,useId:vo,useHostTransitionStatus:vo,useFormState:vo,useActionState:vo,useOptimistic:vo,useMemoCache:vo,useCacheRefresh:vo};Fs.useEffectEvent=vo;var Is={readContext:Zi,use:jo,useCallback:function(e,t){return Do().memoizedState=[e,t===void 0?null:t],e},useContext:Zi,useEffect:ss,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),as(4194308,4,ps.bind(null,t,e),n)},useLayoutEffect:function(e,t){return as(4194308,4,e,t)},useInsertionEffect:function(e,t){as(4,2,e,t)},useMemo:function(e,t){var n=Do();t=t===void 0?null:t;var r=e();if(po){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Do();if(n!==void 0){var i=n(t);if(po){je(!0);try{n(t)}finally{je(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ks.bind(null,so,e),[r.memoizedState,e]},useRef:function(e){var t=Do();return e={current:e},t.memoizedState=e},useState:function(e){e=Uo(e);var t=e.queue,n=K.bind(null,so,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:hs,useDeferredValue:function(e,t){return vs(Do(),e,t)},useTransition:function(){var e=Uo(!1);return e=bs.bind(null,so,e.queue,!0,!1),Do().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=so,a=Do();if(Ai){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Rl===null)throw Error(i(349));Bl&127||Ro(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ss(Bo.bind(null,r,o,e),[e]),r.flags|=2048,rs(9,{destroy:void 0},zo.bind(null,r,o,n,t),null),n},useId:function(){var e=Do(),t=Rl.identifierPrefix;if(Ai){var n=Si,r=xi;n=(r&~(1<<32-Me(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=mo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=_o++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ts,useFormState:Qo,useActionState:Qo,useOptimistic:function(e){var t=Do();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=js.bind(null,so,!0,n),n.dispatch=t,[e,t]},useMemoCache:Mo,useCacheRefresh:function(){return Do().memoizedState=Os.bind(null,so)},useEffectEvent:function(e){var t=Do(),n={impl:e};return t.memoizedState=n,function(){if(Ll&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ls={readContext:Zi,use:jo,useCallback:gs,useContext:Zi,useEffect:cs,useImperativeHandle:ms,useInsertionEffect:ds,useLayoutEffect:fs,useMemo:_s,useReducer:Po,useRef:is,useState:function(){return Po(No)},useDebugValue:hs,useDeferredValue:function(e,t){return ys(Oo(),co.memoizedState,e,t)},useTransition:function(){var e=Po(No)[0],t=Oo().memoizedState;return[typeof e==`boolean`?e:Ao(e),t]},useSyncExternalStore:Lo,useId:Es,useHostTransitionStatus:Ts,useFormState:$o,useActionState:$o,useOptimistic:function(e,t){return Wo(Oo(),co,e,t)},useMemoCache:Mo,useCacheRefresh:Ds};Ls.useEffectEvent=us;var Rs={readContext:Zi,use:jo,useCallback:gs,useContext:Zi,useEffect:cs,useImperativeHandle:ms,useInsertionEffect:ds,useLayoutEffect:fs,useMemo:_s,useReducer:Io,useRef:is,useState:function(){return Io(No)},useDebugValue:hs,useDeferredValue:function(e,t){var n=Oo();return co===null?vs(n,e,t):ys(n,co.memoizedState,e,t)},useTransition:function(){var e=Io(No)[0],t=Oo().memoizedState;return[typeof e==`boolean`?e:Ao(e),t]},useSyncExternalStore:Lo,useId:Es,useHostTransitionStatus:Ts,useFormState:ns,useActionState:ns,useOptimistic:function(e,t){var n=Oo();return co===null?(n.baseState=e,[e,n.queue.dispatch]):Wo(n,co,e,t)},useMemoCache:Mo,useCacheRefresh:Ds};Rs.useEffectEvent=us;function zs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=gu(),i=Ra(r);i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(vu(t,e,r),Ba(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=gu(),i=Ra(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(vu(t,e,r),Ba(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gu(),r=Ra(n);r.tag=2,t!=null&&(r.callback=t),t=za(e,r,n),t!==null&&(vu(t,e,n),Ba(t,e,n))}};function Vs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!vr(n,r)||!vr(i,a):!0}function Hs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Bs.enqueueReplaceState(t,t.state,null)}function Us(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ws(e){Gr(e)}function Gs(e){console.error(e)}function Ks(e){Gr(e)}function qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function q(e,t,n){return n=Ra(n),n.tag=3,n.payload={element:null},n.callback=function(){qs(e,t)},n}function Ys(e){return e=Ra(e),e.tag=3,e}function Xs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Js(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Js(t,n,r),typeof i!=`function`&&(ou===null?ou=new Set([this]):ou.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Zs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ji(t,n,a,!0),n=Za.current,n!==null){switch(n.tag){case 31:case 13:return Qa===null?Au():n.alternate===null&&ql===0&&(ql=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Yu(e,r,a)),!1;case 22:return n.flags|=65536,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Yu(e,r,a)),!1}throw Error(i(435,n.tag))}return Yu(e,r,a),Au(),!1}if(Ai)return t=Za.current,t===null?(r!==Ni&&(t=Error(i(423),{cause:r}),Bi(pi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=pi(r,n),a=q(e.stateNode,r,a),Va(e,a),ql!==4&&(ql=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ni&&(e=Error(i(422),{cause:r}),Bi(pi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=pi(o,n),$l===null?$l=[o]:$l.push(o),ql!==4&&(ql=2),t===null)return!0;r=pi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=q(n.stateNode,r,e),Va(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(ou===null||!ou.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ys(a),Xs(a,e,n,r),Va(n,a),!1}n=n.return}while(n!==null);return!1}var Qs=Error(i(461)),$s=!1;function ec(e,t,n,r){t.child=e===null?Pa(t,null,n,r):Na(t,e.child,n,r)}function tc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Xi(t),r=bo(e,t,n,o,a,i),s=wo(),e!==null&&!$s?(To(e,t,i),Tc(e,t,i)):(Ai&&s&&Ti(t),t.flags|=1,ec(e,t,r,i),t.child)}function nc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ii(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,rc(e,t,a,r,i)):(e=si(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ec(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?vr:n,n(o,r)&&e.ref===t.ref)return Tc(e,t,i)}return t.flags|=1,e=ai(a,r),e.ref=t.ref,e.return=t,t.child=e}function rc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(vr(a,r)&&e.ref===t.ref){if($s=!1,t.pendingProps=r=a,Ec(e,i))e.flags&131072&&($s=!0);else return t.lanes=e.lanes,Tc(e,t,i)}}return dc(e,t,n,r,i)}function ic(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return oc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ga(t,a===null?null:a.cachePool),a===null?Ya():Ja(t,a),to(t);else return r=t.lanes=536870912,oc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ga(t,null),Ya(),no(t)):(ga(t,a.cachePool),Ja(t,a),no(t),t.memoizedState=null);return ec(e,t,i,n),t.child}function ac(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function oc(e,t,n,r,i){var a=ha();return a=a===null?null:{parent:ra._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ga(t,null),Ya(),to(t),e!==null&&Ji(e,t,r,!0),t.childLanes=i,null}function sc(e,t){return t=bc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function cc(e,t,n){return Na(t,e.child,null,n),e=sc(t,t.pendingProps),e.flags|=2,ro(t),t.memoizedState=null,e}function lc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ai){if(r.mode===`hidden`)return e=sc(t,r),t.lanes=536870912,ac(null,e);if(eo(t),(e=ki)?(e=lf(e,Mi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bi===null?null:{id:xi,overflow:Si},retryLane:536870912,hydrationErrors:null},n=ui(e),n.return=t,t.child=n,Oi=t,ki=null)):e=null,e===null)throw Pi(t);return t.lanes=536870912,null}return sc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(eo(t),a){if(t.flags&256)t.flags&=-257,t=cc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if($s||Ji(e,t,n,!1),a=(n&e.childLanes)!==0,$s||a){if(r=Rl,r!==null&&(s=Xe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Qr(e,s),vu(r,e,s),Qs;Au(),t=cc(e,t,n)}else e=o.treeContext,ki=pf(s.nextSibling),Oi=t,Ai=!0,ji=null,Mi=!1,e!==null&&Di(t,e),t=sc(t,r),t.flags|=4096;return t}return e=ai(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function uc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function dc(e,t,n,r,i){return Xi(t),n=bo(e,t,n,r,void 0,i),r=wo(),e!==null&&!$s?(To(e,t,i),Tc(e,t,i)):(Ai&&r&&Ti(t),t.flags|=1,ec(e,t,n,i),t.child)}function fc(e,t,n,r,i,a){return Xi(t),t.updateQueue=null,n=So(t,r,n,i),xo(e),r=wo(),e!==null&&!$s?(To(e,t,a),Tc(e,t,a)):(Ai&&r&&Ti(t),t.flags|=1,ec(e,t,n,a),t.child)}function pc(e,t,n,r,i){if(Xi(t),t.stateNode===null){var a=ti,o=n.contextType;typeof o==`object`&&o&&(a=Zi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Bs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ia(t),o=n.contextType,a.context=typeof o==`object`&&o?Zi(o):ti,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(zs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Bs.enqueueReplaceState(a,a.state,null),Wa(t,r,a,i),Ua(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Us(n,s);a.props=c;var l=a.context,u=n.contextType;o=ti,typeof u==`object`&&u&&(o=Zi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Hs(t,a,r,o),Fa=!1;var f=t.memoizedState;a.state=f,Wa(t,r,a,i),Ua(),l=t.memoizedState,s||f!==l||Fa?(typeof d==`function`&&(zs(t,n,d,r),l=t.memoizedState),(c=Fa||Vs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,La(e,t),o=t.memoizedProps,u=Us(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ti,typeof l==`object`&&l&&(c=Zi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Hs(t,a,r,c),Fa=!1,f=t.memoizedState,a.state=f,Wa(t,r,a,i),Ua();var p=t.memoizedState;o!==d||f!==p||Fa||e!==null&&e.dependencies!==null&&Yi(e.dependencies)?(typeof s==`function`&&(zs(t,n,s,r),p=t.memoizedState),(u=Fa||Vs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Yi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,uc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Na(t,e.child,null,i),t.child=Na(t,null,n,i)):ec(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Tc(e,t,i),e}function mc(e,t,n,r){return Ri(),t.flags|=256,ec(e,t,n,r),t.child}var hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:_a()}}function _c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Zl),e}function vc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(io.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Ai){if(a?$a(t):no(t),(e=ki)?(e=lf(e,Mi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bi===null?null:{id:xi,overflow:Si},retryLane:536870912,hydrationErrors:null},n=ui(e),n.return=t,t.child=n,Oi=t,ki=null)):e=null,e===null)throw Pi(t);return df(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(no(t),a=t.mode,c=bc({mode:`hidden`,children:c},a),r=ci(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(null,r)):($a(t),yc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?($a(t),t.flags&=-257,t=xc(e,t,n)):t.memoizedState===null?(no(t),c=r.fallback,a=t.mode,r=bc({mode:`visible`,children:r.children},a),c=ci(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Na(t,e.child,null,n),r=t.child,r.memoizedState=gc(n),r.childLanes=_c(e,s,n),t.memoizedState=hc,t=ac(null,r)):(no(t),t.child=e.child,t.flags|=128,t=null);else if($a(t),df(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Bi({value:r,source:null,stack:null}),t=xc(e,t,n)}else if($s||Ji(e,t,n,!1),s=(n&e.childLanes)!==0,$s||s){if(s=Rl,s!==null&&(r=Xe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Qr(e,r),vu(s,e,r),Qs;uf(c)||Au(),t=xc(e,t,n)}else uf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,ki=pf(c.nextSibling),Oi=t,Ai=!0,ji=null,Mi=!1,e!==null&&Di(t,e),t=yc(t,r.children),t.flags|=4096);return t}return a?(no(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ai(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ci(c,a,n,null),c.flags|=2):c=ai(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ac(null,r),r=t.child,c=e.child.memoizedState,c===null?c=gc(n):(a=c.cachePool,a===null?a=_a():(l=ra._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=_c(e,s,n),t.memoizedState=hc,ac(e.child,r)):($a(t),n=e.child,e=n.sibling,n=ai(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function yc(e,t){return t=bc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function bc(e,t){return e=ri(22,e,null,t),e.lanes=0,e}function xc(e,t,n){return Na(t,e.child,null,n),e=yc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Sc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ki(e.return,t,n)}function Cc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function wc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=io.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,z(io,o),ec(e,t,r,n),r=Ai?_i:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sc(e,n,t);else if(e.tag===19)Sc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ao(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Cc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ao(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Cc(t,!0,n,null,a,r);break;case`together`:Cc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Tc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ji(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ai(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ai(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ec(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Yi(e)))}function Dc(e,t,n){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),Wi(t,ra,e.memoizedState.cache),Ri();break;case 27:case 5:oe(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:Wi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,eo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?($a(t),e=Tc(e,t,n),e===null?null:e.sibling):vc(e,t,n):($a(t),t.flags|=128,null);$a(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Ji(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return wc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),z(io,io.current),r)break;return null;case 22:return t.lanes=0,ic(e,t,n,t.pendingProps);case 24:Wi(t,ra,e.memoizedState.cache)}return Tc(e,t,n)}function Oc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)$s=!0;else{if(!Ec(e,n)&&!(t.flags&128))return $s=!1,Dc(e,t,n);$s=!!(e.flags&131072)}}else $s=!1,Ai&&t.flags&1048576&&wi(t,_i,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=wa(t.elementType),t.type=e,typeof e==`function`)ii(e)?(r=Us(e,r),t.tag=1,t=pc(null,t,e,r,n)):(t.tag=0,t=dc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===S){t.tag=11,t=tc(null,t,e,r,n);break a}if(a===T){t.tag=14,t=nc(null,t,e,r,n);break a}}throw t=M(e)||e,Error(i(306,t,``))}}return t;case 0:return dc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Us(r,t.pendingProps),pc(e,t,r,a,n);case 3:a:{if(ie(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,La(e,t),Wa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Wi(t,ra,r),r!==o.cache&&qi(t,[ra],n,!0),Ua(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=mc(e,t,r,n);break a}if(r!==a){a=pi(Error(i(424)),t),Bi(a),t=mc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ki=pf(e.firstChild),Oi=t,Ai=!0,ji=null,Mi=!0,n=Pa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ri(),r===a){t=Tc(e,t,n);break a}ec(e,t,r,n)}t=t.child}return t;case 26:return uc(e,t),e===null?(n=Pf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ai||(n=t.type,e=t.pendingProps,r=Gd(V.current).createElement(n),r[nt]=t,r[rt]=e,zd(r,n,e),mt(r),t.stateNode=r):t.memoizedState=Pf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return oe(t),e===null&&Ai&&(r=t.stateNode=_f(t.type,t.pendingProps,V.current),Oi=t,Mi=!0,a=ki,nf(t.type)?(mf=a,ki=pf(r.firstChild)):ki=a),ec(e,t,t.pendingProps.children,n),uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ai&&((a=r=ki)&&(r=sf(r,t.type,t.pendingProps,Mi),r===null?a=!1:(t.stateNode=r,Oi=t,ki=pf(r.firstChild),Mi=!1,a=!0)),a||Pi(t)),oe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Jd(a,o)?r=null:s!==null&&Jd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=bo(e,t,Co,null,null,n),rp._currentValue=a),uc(e,t),ec(e,t,r,n),t.child;case 6:return e===null&&Ai&&((e=n=ki)&&(n=cf(n,t.pendingProps,Mi),n===null?e=!1:(t.stateNode=n,Oi=t,ki=null,e=!0)),e||Pi(t)),null;case 13:return vc(e,t,n);case 4:return ie(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Na(t,null,r,n):ec(e,t,r,n),t.child;case 11:return tc(e,t,t.type,t.pendingProps,n);case 7:return ec(e,t,t.pendingProps,n),t.child;case 8:return ec(e,t,t.pendingProps.children,n),t.child;case 12:return ec(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Wi(t,t.type,r.value),ec(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Xi(t),a=Zi(a),r=r(a),t.flags|=1,ec(e,t,r,n),t.child;case 14:return nc(e,t,t.type,t.pendingProps,n);case 15:return rc(e,t,t.type,t.pendingProps,n);case 19:return wc(e,t,n);case 31:return lc(e,t,n);case 22:return ic(e,t,n,t.pendingProps);case 24:return Xi(t),r=Zi(ra),e===null?(a=ha(),a===null&&(a=Rl,o=ia(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ia(t),Wi(t,ra,a)):((e.lanes&n)!==0&&(La(e,t),Wa(t,null,null,n),Ua()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Wi(t,ra,r),r!==a.cache&&qi(t,[ra],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Wi(t,ra,r))),ec(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function kc(e){e.flags|=4}function Ac(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Du())e.flags|=8192;else throw Ta=xa,ya}}else e.flags&=-16777217}function jc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Yf(t)){if(Du())e.flags|=8192;else throw Ta=xa,ya}}function Mc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ge(),e.lanes|=t,Ql|=t)}function Nc(e,t){if(!Ai)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Pc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fc(e,t,n){var r=t.pendingProps;switch(Ei(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pc(t),null;case 1:return Pc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Gi(ra),ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Li(t)?kc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,zi())),Pc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(kc(t),o===null?(Pc(t),Ac(t,a,null,r,n)):(Pc(t),jc(t,o))):o?o===e.memoizedState?(Pc(t),t.flags&=-16777217):(kc(t),Pc(t),jc(t,o)):(e=e.memoizedProps,e!==r&&kc(t),Pc(t),Ac(t,a,e,r,n)),null;case 27:if(se(t),n=V.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}e=B.current,Li(t)?Fi(t,e):(e=_f(a,r,n),t.stateNode=e,kc(t))}return Pc(t),null;case 5:if(se(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Pc(t),null}if(o=B.current,Li(t))Fi(t,o);else{var s=Gd(V.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[nt]=t,o[rt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(zd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=V.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Oi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[nt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Id(e.nodeValue,n)),e||Pi(t,!0)}else e=Gd(e).createTextNode(r),e[nt]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Li(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[nt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ro(t),t):(ro(t),null);if(t.flags&128)throw Error(i(558))}return Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Li(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[nt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),a=!1}else a=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ro(t),t):(ro(t),null)}return ro(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Mc(t,t.updateQueue),Pc(t),null);case 4:return ae(),e===null&&Ed(t.stateNode.containerInfo),Pc(t),null;case 10:return Gi(t.type),Pc(t),null;case 19:if(R(io),r=t.memoizedState,r===null)return Pc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Nc(r,!1);else{if(ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ao(e),o!==null){for(t.flags|=128,Nc(r,!1),e=o.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oi(n,e),n=n.sibling;return z(io,io.current&1|2),Ai&&Ci(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&be()>iu&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=ao(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ai)return Pc(t),null}else 2*be()-r.renderingStartTime>iu&&n!==536870912&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=be(),e.sibling=null,n=io.current,z(io,a?n&1|2:n&1),Ai&&Ci(t,r.treeForkCount),e);case 22:case 23:return ro(t),Xa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&R(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gi(ra),Pc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Ic(e,t){switch(Ei(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gi(ra),ae(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return se(t),null;case 31:if(t.memoizedState!==null){if(ro(t),t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ro(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(io),null;case 4:return ae(),null;case 10:return Gi(t.type),null;case 22:case 23:return ro(t),Xa(),e!==null&&R(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gi(ra),null;case 25:return null;default:return null}}function Lc(e,t){switch(Ei(t),t.tag){case 3:Gi(ra),ae();break;case 26:case 27:case 5:se(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&ro(t);break;case 13:ro(t);break;case 19:R(io);break;case 10:Gi(t.type);break;case 22:case 23:ro(t),Xa(),e!==null&&R(ma);break;case 24:Gi(ra)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ju(t,t.return,e)}}function zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ju(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ju(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Ju(e,e.return,t)}}}function Vc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ju(e,t,n)}}function Hc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ju(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Ju(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ju(e,t,n)}else n.current=null}}function Wc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ju(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;Bd(r,e.type,n,t),r[rt]=t}catch(t){Ju(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&nf(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&nf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Jt));else if(r!==4&&(r===27&&nf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&nf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);zd(t,r,n),t[nt]=e,t[rt]=n}catch(t){Ju(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Ud=fp,e=Sr(e),Cr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Wd={focusedElem:e,selectionRange:n},fp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Us(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ju(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)of(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:of(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,tl=e;break}tl=t.return}}function rl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&Rc(5,n);break;case 1:if(vl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ju(n,n.return,e)}else{var i=Us(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ju(n,n.return,e)}}}r&64&&Bc(n),r&512&&Hc(n,n.return);break;case 3:if(vl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ka(e,t)}catch(e){Ju(n,n.return,e)}}break;case 27:t===null&&r&4&&Xc(n);case 26:case 5:vl(e,n),t===null&&r&4&&Wc(n),r&512&&Hc(n,n.return);break;case 12:vl(e,n);break;case 31:vl(e,n),r&4&&ll(e,n);break;case 13:vl(e,n),r&4&&ul(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Qu.bind(null,n),ff(e,n))));break;case 22:if(r=n.memoizedState!==null||Zc,!r){t=t!==null&&t.memoizedState!==null||Qc,i=Zc;var a=Qc;Zc=r,(Qc=t)&&!a?bl(e,n,!!(n.subtreeFlags&8772)):vl(e,n),Zc=i,Qc=a}break;case 30:break;default:vl(e,n)}}function il(e){var t=e.alternate;t!==null&&(e.alternate=null,il(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&lt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var al=null,ol=!1;function sl(e,t,n){for(n=n.child;n!==null;)cl(e,t,n),n=n.sibling}function cl(e,t,n){if(Ae&&typeof Ae.onCommitFiberUnmount==`function`)try{Ae.onCommitFiberUnmount(ke,n)}catch{}switch(n.tag){case 26:Qc||Uc(n,t),sl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Qc||Uc(n,t);var r=al,i=ol;nf(n.type)&&(al=n.stateNode,ol=!1),sl(e,t,n),vf(n.stateNode),al=r,ol=i;break;case 5:Qc||Uc(n,t);case 6:if(r=al,i=ol,al=null,sl(e,t,n),al=r,ol=i,al!==null){if(ol)try{(al.nodeType===9?al.body:al.nodeName===`HTML`?al.ownerDocument.body:al).removeChild(n.stateNode)}catch(e){Ju(n,t,e)}else try{al.removeChild(n.stateNode)}catch(e){Ju(n,t,e)}}break;case 18:al!==null&&(ol?(e=al,rf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Rp(e)):rf(al,n.stateNode));break;case 4:r=al,i=ol,al=n.stateNode.containerInfo,ol=!0,sl(e,t,n),al=r,ol=i;break;case 0:case 11:case 14:case 15:zc(2,n,t),Qc||zc(4,n,t),sl(e,t,n);break;case 1:Qc||(Uc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Vc(n,t,r)),sl(e,t,n);break;case 21:sl(e,t,n);break;case 22:Qc=(r=Qc)||n.memoizedState!==null,sl(e,t,n),Qc=r;break;default:sl(e,t,n)}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Rp(e)}catch(e){Ju(t,t.return,e)}}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Rp(e)}catch(e){Ju(t,t.return,e)}}function dl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new el),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new el),t;default:throw Error(i(435,e.tag))}}function fl(e,t){var n=dl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=$u.bind(null,e,t);t.then(r,r)}})}function pl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(nf(c.type)){al=c.stateNode,ol=!1;break a}break;case 5:al=c.stateNode,ol=!1;break a;case 3:case 4:al=c.stateNode.containerInfo,ol=!0;break a}c=c.return}if(al===null)throw Error(i(160));cl(o,s,a),al=null,ol=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hl(t,e),t=t.sibling}var ml=null;function hl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pl(t,e),gl(e),r&4&&(zc(3,e,e.return),Rc(3,e),zc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&64&&Zc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=ml;if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ct]||o[nt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),zd(o,r,n),o[nt]=e,mt(o),r=o;break a;case`link`:var s=Kf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),zd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Kf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),zd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[nt]=e,mt(o),r=o}e.stateNode=r}else qf(a,e.type,e.stateNode)}else e.stateNode=Vf(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Gc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?qf(a,e.type,e.stateNode):Vf(a,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),n!==null&&r&4&&Gc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&(Qc||n===null||Uc(n,n.return)),e.flags&32){a=e.stateNode;try{Bt(a,``)}catch(t){Ju(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Gc(e,a,n===null?a:n.memoizedProps)),r&1024&&($c=!0);break;case 6:if(pl(t,e),gl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ju(e,e.return,t)}}break;case 3:if(Gf=null,a=ml,ml=xf(t.containerInfo),pl(t,e),ml=a,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Rp(t.containerInfo)}catch(t){Ju(e,e.return,t)}$c&&($c=!1,_l(e));break;case 4:r=ml,ml=xf(e.stateNode.containerInfo),pl(t,e),gl(e),ml=r;break;case 12:pl(t,e),gl(e);break;case 31:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 13:pl(t,e),gl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(nu=be()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Zc,d=Qc;if(Zc=u||a,Qc=d||l,pl(t,e),Qc=d,Zc=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Zc||Qc||yl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ju(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ju(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?af(m,!0):af(l.stateNode,!1)}catch(e){Ju(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,fl(e,n))));break;case 19:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 30:break;case 21:break;default:pl(t,e),gl(e)}}function gl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Kc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Yc(e,qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Bt(o,``),n.flags&=-33),Yc(e,qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Jc(e,qc(e),s);break;default:throw Error(i(161))}}catch(t){Ju(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _l(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_l(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rl(e,t.alternate,t),t=t.sibling}function yl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:zc(4,t,t.return),yl(t);break;case 1:Uc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Vc(t,t.return,n),yl(t);break;case 27:vf(t.stateNode);case 26:case 5:Uc(t,t.return),yl(t);break;case 22:t.memoizedState===null&&yl(t);break;case 30:yl(t);break;default:yl(t)}e=e.sibling}}function bl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:bl(i,a,n),Rc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ju(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ga(c[i],s)}catch(e){Ju(r,r.return,e)}}n&&o&64&&Bc(a),Hc(a,a.return);break;case 27:Xc(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&Wc(a),Hc(a,a.return);break;case 12:bl(i,a,n);break;case 31:bl(i,a,n),n&&o&4&&ll(i,a);break;case 13:bl(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&bl(i,a,n),Hc(a,a.return);break;case 30:break;default:bl(i,a,n)}t=t.sibling}}function xl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&aa(n))}function Sl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e))}function Cl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wl(e,t,n,r),t=t.sibling}function wl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Cl(e,t,n,r),i&2048&&Rc(9,t);break;case 1:Cl(e,t,n,r);break;case 3:Cl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e)));break;case 12:if(i&2048){Cl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ju(t,t.return,e)}}else Cl(e,t,n,r);break;case 31:Cl(e,t,n,r);break;case 13:Cl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Cl(e,t,n,r):(a._visibility|=2,Tl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Cl(e,t,n,r):El(e,t),i&2048&&xl(o,t);break;case 24:Cl(e,t,n,r),i&2048&&Sl(t.alternate,t);break;default:Cl(e,t,n,r)}}function Tl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Tl(a,o,s,c,i),Rc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Tl(a,o,s,c,i)):u._visibility&2?Tl(a,o,s,c,i):El(a,o),i&&l&2048&&xl(o.alternate,o);break;case 24:Tl(a,o,s,c,i),i&&l&2048&&Sl(o.alternate,o);break;default:Tl(a,o,s,c,i)}t=t.sibling}}function El(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:El(n,r),i&2048&&xl(r.alternate,r);break;case 24:El(n,r),i&2048&&Sl(r.alternate,r);break;default:El(n,r)}t=t.sibling}}var Dl=8192;function Ol(e,t,n){if(e.subtreeFlags&Dl)for(e=e.child;e!==null;)kl(e,t,n),e=e.sibling}function kl(e,t,n){switch(e.tag){case 26:Ol(e,t,n),e.flags&Dl&&e.memoizedState!==null&&Xf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:Ol(e,t,n);break;case 3:case 4:var r=ml;ml=xf(e.stateNode.containerInfo),Ol(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Dl,Dl=16777216,Ol(e,t,n),Dl=r):Ol(e,t,n));break;default:Ol(e,t,n)}}function Al(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ml(e),e=e.sibling}function Ml(e){switch(e.tag){case 0:case 11:case 15:jl(e),e.flags&2048&&zc(9,e,e.return);break;case 3:jl(e);break;case 12:jl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Nl(e)):jl(e);break;default:jl(e)}}function Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tl=r,Pl(r,e)}Al(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:zc(8,t,t.return),Nl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Nl(t));break;default:Nl(t)}e=e.sibling}}function Pl(e,t){for(;tl!==null;){var n=tl;switch(n.tag){case 0:case 11:case 15:zc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:aa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tl=r;else a:for(n=e;tl!==null;){r=tl;var i=r.sibling,a=r.return;if(il(r),r===n){tl=null;break a}if(i!==null){i.return=a,tl=i;break a}tl=a}}}var Fl={getCacheForType:function(e){var t=Zi(ra),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Zi(ra).controller.signal}},Il=typeof WeakMap==`function`?WeakMap:Map,Ll=0,Rl=null,zl=null,Bl=0,Vl=0,Hl=null,Ul=!1,Wl=!1,Gl=!1,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=0,$l=null,eu=null,tu=!1,nu=0,ru=0,iu=1/0,au=null,ou=null,su=0,cu=null,lu=null,uu=0,du=0,fu=null,pu=null,mu=0,hu=null;function gu(){return Ll&2&&Bl!==0?Bl&-Bl:P.T===null?$e():md()}function _u(){if(Zl===0){if(!(Bl&536870912)||Ai){var e=Le;Le<<=1,!(Le&3932160)&&(Le=262144),Zl=e}else Zl=536870912}return e=Za.current,e!==null&&(e.flags|=32),Zl}function vu(e,t,n){(e===Rl&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)&&(Tu(e,0),Su(e,Bl,Zl,!1)),Ke(e,n),(!(Ll&2)||e!==Rl)&&(e===Rl&&(!(Ll&2)&&(Yl|=n),ql===4&&Su(e,Bl,Zl,!1)),sd(e))}function yu(e,t,n){if(Ll&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||He(e,t),a=r?Nu(e,t):ju(e,t,!0),o=r;do{if(a===0){Wl&&!r&&Su(e,t,0,!1);break}if(n=e.current.alternate,o&&!xu(n)){a=ju(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=$l;var l=c.current.memoizedState.isDehydrated;if(l&&(Tu(c,s).flags|=256),s=ju(c,s,!1),s!==2){if(Gl&&!l){c.errorRecoveryDisabledLanes|=o,Yl|=o,a=4;break a}o=eu,eu=a,o!==null&&(eu===null?eu=o:eu.push.apply(eu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Tu(e,0),Su(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Su(r,t,Zl,!Ul);break a;case 2:eu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=nu+300-be(),10<a)){if(Su(r,t,Zl,!Ul),Be(r,0,!0)!==0)break a;uu=t,r.timeoutHandle=Zd(bu.bind(null,r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,o,`Throttled`,-0,0),a);break a}bu(r,n,eu,au,tu,t,Zl,Yl,Ql,Ul,o,null,-0,0)}break}while(1);sd(e)}function bu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jt},kl(t,a,d);var m=(a&62914560)===a?nu-be():(a&4194048)===a?ru-be():0;if(m=Qf(d,m),m!==null){uu=a,e.cancelPendingCommit=m(Bu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Su(e,a,o,!l);return}}Bu(e,t,a,n,r,i,o,s,c)}function xu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!_r(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Su(e,t,n,r){t&=~Xl,t&=~Yl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Me(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Je(e,n,t)}function Cu(){return Ll&6?!0:(cd(0,!1),!1)}function wu(){if(zl!==null){if(Vl===0)var e=zl.return;else e=zl,Ui=Hi=null,Eo(e),Da=null,Oa=0,e=zl;for(;e!==null;)Lc(e.alternate,e),e=e.return;zl=null}}function Tu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),uu=0,wu(),Rl=e,zl=n=ai(e.current,null),Bl=t,Vl=0,Hl=null,Ul=!1,Wl=He(e,t),Gl=!1,Ql=Zl=Xl=Yl=Jl=ql=0,eu=$l=null,tu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Me(r),a=1<<i;t|=e[i],r&=~a}return Kl=t,Yr(),n}function Eu(e,t){so=null,P.H=Fs,t===va||t===ba?(t=Ea(),Vl=3):t===ya?(t=Ea(),Vl=4):Vl=t===Qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Hl=t,zl===null&&(ql=1,qs(e,pi(t,e.current)))}function Du(){var e=Za.current;return e===null?!0:(Bl&4194048)===Bl?Qa===null:(Bl&62914560)===Bl||Bl&536870912?e===Qa:!1}function Ou(){var e=P.H;return P.H=Fs,e===null?Fs:e}function ku(){var e=P.A;return P.A=Fl,e}function Au(){ql=4,Ul||(Bl&4194048)!==Bl&&Za.current!==null||(Wl=!0),!(Jl&134217727)&&!(Yl&134217727)||Rl===null||Su(Rl,Bl,Zl,!1)}function ju(e,t,n){var r=Ll;Ll|=2;var i=Ou(),a=ku();(Rl!==e||Bl!==t)&&(au=null,Tu(e,t)),t=!1;var o=ql;a:do try{if(Vl!==0&&zl!==null){var s=zl,c=Hl;switch(Vl){case 8:wu(),o=6;break a;case 3:case 2:case 9:case 6:Za.current===null&&(t=!0);var l=Vl;if(Vl=0,Hl=null,Lu(e,s,c,l),n&&Wl){o=0;break a}break;default:l=Vl,Vl=0,Hl=null,Lu(e,s,c,l)}}Mu(),o=ql;break}catch(t){Eu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ui=Hi=null,Ll=r,P.H=i,P.A=a,zl===null&&(Rl=null,Bl=0,Yr()),o}function Mu(){for(;zl!==null;)Fu(zl)}function Nu(e,t){var n=Ll;Ll|=2;var r=Ou(),a=ku();Rl!==e||Bl!==t?(au=null,iu=be()+500,Tu(e,t)):Wl=He(e,t);a:do try{if(Vl!==0&&zl!==null){t=zl;var o=Hl;b:switch(Vl){case 1:Vl=0,Hl=null,Lu(e,t,o,1);break;case 2:case 9:if(Sa(o)){Vl=0,Hl=null,Iu(t);break}t=function(){Vl!==2&&Vl!==9||Rl!==e||(Vl=7),sd(e)},o.then(t,t);break a;case 3:Vl=7;break a;case 4:Vl=5;break a;case 7:Sa(o)?(Vl=0,Hl=null,Iu(t)):(Vl=0,Hl=null,Lu(e,t,o,7));break;case 5:var s=null;switch(zl.tag){case 26:s=zl.memoizedState;case 5:case 27:var c=zl;if(s?Yf(s):c.stateNode.complete){Vl=0,Hl=null;var l=c.sibling;if(l!==null)zl=l;else{var u=c.return;u===null?zl=null:(zl=u,Ru(u))}break b}}Vl=0,Hl=null,Lu(e,t,o,5);break;case 6:Vl=0,Hl=null,Lu(e,t,o,6);break;case 8:wu(),ql=6;break a;default:throw Error(i(462))}}Pu();break}catch(t){Eu(e,t)}while(1);return Ui=Hi=null,P.H=r,P.A=a,Ll=n,zl===null?(Rl=null,Bl=0,Yr(),ql):0}function Pu(){for(;zl!==null&&!ve();)Fu(zl)}function Fu(e){var t=Oc(e.alternate,e,Kl);e.memoizedProps=e.pendingProps,t===null?Ru(e):zl=t}function Iu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=fc(n,t,t.pendingProps,t.type,void 0,Bl);break;case 11:t=fc(n,t,t.pendingProps,t.type.render,t.ref,Bl);break;case 5:Eo(t);default:Lc(n,t),t=zl=oi(t,Kl),t=Oc(n,t,Kl)}e.memoizedProps=e.pendingProps,t===null?Ru(e):zl=t}function Lu(e,t,n,r){Ui=Hi=null,Eo(t),Da=null,Oa=0;var i=t.return;try{if(Zs(e,i,t,n,Bl)){ql=1,qs(e,pi(n,e.current)),zl=null;return}}catch(t){if(i!==null)throw zl=i,t;ql=1,qs(e,pi(n,e.current)),zl=null;return}t.flags&32768?(Ai||r===1?e=!0:Wl||Bl&536870912?e=!1:(Ul=e=!0,(r===2||r===9||r===3||r===6)&&(r=Za.current,r!==null&&r.tag===13&&(r.flags|=16384))),zu(t,e)):Ru(t)}function Ru(e){var t=e;do{if(t.flags&32768){zu(t,Ul);return}e=t.return;var n=Fc(t.alternate,t,Kl);if(n!==null){zl=n;return}if(t=t.sibling,t!==null){zl=t;return}zl=t=e}while(t!==null);ql===0&&(ql=5)}function zu(e,t){do{var n=Ic(e.alternate,e);if(n!==null){n.flags&=32767,zl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){zl=e;return}zl=e=n}while(e!==null);ql=6,zl=null}function Bu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Gu();while(su!==0);if(Ll&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Jr,qe(e,n,o,s,c,l),e===Rl&&(zl=Rl=null,Bl=0),lu=t,cu=e,uu=n,du=o,fu=a,pu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ed(we,function(){return Ku(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=P.T,P.T=null,a=F.p,F.p=2,s=Ll,Ll|=4;try{nl(e,t,n)}finally{Ll=s,F.p=a,P.T=r}}su=1,Vu(),Hu(),Uu()}}function Vu(){if(su===1){su=0;var e=cu,t=lu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Ll;Ll|=4;try{hl(t,e);var a=Wd,o=Sr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&xr(s.ownerDocument.documentElement,s)){if(c!==null&&Cr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=br(s,h),v=br(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}fp=!!Ud,Wd=Ud=null}finally{Ll=i,F.p=r,P.T=n}}e.current=t,su=2}}function Hu(){if(su===2){su=0;var e=cu,t=lu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Ll;Ll|=4;try{rl(e,t.alternate,t)}finally{Ll=i,F.p=r,P.T=n}}su=3}}function Uu(){if(su===4||su===3){su=0,ye();var e=cu,t=lu,n=uu,r=pu;t.subtreeFlags&10256||t.flags&10256?su=5:(su=0,lu=cu=null,Wu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ou=null),Qe(n),t=t.stateNode,Ae&&typeof Ae.onCommitFiberRoot==`function`)try{Ae.onCommitFiberRoot(ke,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=P.T,i=F.p,F.p=2,P.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{P.T=t,F.p=i}}uu&3&&Gu(),sd(e),i=e.pendingLanes,n&261930&&i&42?e===hu?mu++:(mu=0,hu=e):mu=0,cd(0,!1)}}function Wu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,aa(t)))}function Gu(){return Vu(),Hu(),Uu(),Ku()}function Ku(){if(su!==5)return!1;var e=cu,t=du;du=0;var n=Qe(uu),r=P.T,a=F.p;try{F.p=32>n?32:n,P.T=null,n=fu,fu=null;var o=cu,s=uu;if(su=0,lu=cu=null,uu=0,Ll&6)throw Error(i(331));var c=Ll;if(Ll|=4,Ml(o.current),wl(o,o.current,s,n),Ll=c,cd(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot==`function`)try{Ae.onPostCommitFiberRoot(ke,o)}catch{}return!0}finally{F.p=a,P.T=r,Wu(e,t)}}function qu(e,t,n){t=pi(n,t),t=q(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Ke(e,2),sd(e))}function Ju(e,t,n){if(e.tag===3)qu(e,e,n);else for(;t!==null;){if(t.tag===3){qu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ou===null||!ou.has(r))){e=pi(n,e),n=Ys(2),r=za(t,n,2),r!==null&&(Xs(n,r,t,e),Ke(r,2),sd(r));break}}t=t.return}}function Yu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Gl=!0,i.add(n),e=Xu.bind(null,e,t,n),t.then(e,e))}function Xu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Rl===e&&(Bl&n)===n&&(ql===4||ql===3&&(Bl&62914560)===Bl&&300>be()-nu?!(Ll&2)&&Tu(e,0):Xl|=n,Ql===Bl&&(Ql=0)),sd(e)}function Zu(e,t){t===0&&(t=Ge()),e=Qr(e,t),e!==null&&(Ke(e,t),sd(e))}function Qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zu(e,n)}function $u(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Zu(e,n)}function ed(e,t){return ge(e,t)}var td=null,nd=null,rd=!1,id=!1,ad=!1,od=0;function sd(e){e!==nd&&e.next===null&&(nd===null?td=nd=e:nd=nd.next=e),id=!0,rd||(rd=!0,pd())}function cd(e,t){if(!ad&&id){ad=!0;do for(var n=!1,r=td;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Me(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,fd(r,a))}else a=Bl,a=Be(r,r===Rl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||He(r,a)||(n=!0,fd(r,a))}r=r.next}while(n);ad=!1}}function J(){ld()}function ld(){id=rd=!1;var e=0;od!==0&&Xd()&&(e=od);for(var t=be(),n=null,r=td;r!==null;){var i=r.next,a=ud(r,t);a===0?(r.next=null,n===null?td=i:n.next=i,i===null&&(nd=n)):(n=r,(e!==0||a&3)&&(id=!0)),r=i}su!==0&&su!==5||cd(e,!1),od!==0&&(od=0)}function ud(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Me(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=We(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Rl,n=Bl,n=Be(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Vl===2||Vl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&_e(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||He(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&_e(r),Qe(n)){case 2:case 8:n=Ce;break;case 32:n=we;break;case 268435456:n=Ee;break;default:n=we}return r=dd.bind(null,e),n=ge(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&_e(r),e.callbackPriority=2,e.callbackNode=null,2}function dd(e,t){if(su!==0&&su!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Gu()&&e.callbackNode!==n)return null;var r=Bl;return r=Be(e,e===Rl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(yu(e,r,t),ud(e,be()),e.callbackNode!=null&&e.callbackNode===n?dd.bind(null,e):null)}function fd(e,t){if(Gu())return null;yu(e,t,!0)}function pd(){ef(function(){Ll&6?ge(Se,J):ld()})}function md(){if(od===0){var e=ca;e===0&&(e=Ie,Ie<<=1,!(Ie&261888)&&(Ie=256)),od=e}return od}function hd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:qt(``+e)}function gd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function _d(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=hd((i[rt]||null).action),o=r.submitter;o&&(t=(t=o[rt]||null)?hd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new gn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(od!==0){var e=o?gd(i,o):new FormData(i);Ss(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?gd(i,o):new FormData(i),Ss(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var vd=0;vd<Ur.length;vd++){var yd=Ur[vd];Wr(yd.toLowerCase(),`on`+(yd[0].toUpperCase()+yd.slice(1)))}Wr(Fr,`onAnimationEnd`),Wr(Ir,`onAnimationIteration`),Wr(Lr,`onAnimationStart`),Wr(`dblclick`,`onDoubleClick`),Wr(`focusin`,`onFocus`),Wr(`focusout`,`onBlur`),Wr(Rr,`onTransitionRun`),Wr(zr,`onTransitionStart`),Wr(Br,`onTransitionCancel`),Wr(Vr,`onTransitionEnd`),vt(`onMouseEnter`,[`mouseout`,`mouseover`]),vt(`onMouseLeave`,[`mouseout`,`mouseover`]),vt(`onPointerEnter`,[`pointerout`,`pointerover`]),vt(`onPointerLeave`,[`pointerout`,`pointerover`]),_t(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),_t(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),_t(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),_t(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),_t(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),_t(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var bd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),xd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(bd));function Sd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Gr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Gr(e)}i.currentTarget=null,a=c}}}}function Cd(e,t){var n=t[it];n===void 0&&(n=t[it]=new Set);var r=e+`__bubble`;n.has(r)||(Dd(t,e,2,!1),n.add(r))}function wd(e,t,n){var r=0;t&&(r|=4),Dd(n,e,r,t)}var Td=`_reactListening`+Math.random().toString(36).slice(2);function Ed(e){if(!e[Td]){e[Td]=!0,ht.forEach(function(t){t!==`selectionchange`&&(xd.has(t)||wd(t,!1,e),wd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Td]||(t[Td]=!0,wd(`selectionchange`,!1,t))}}function Dd(e,t,n,r){switch(yp(t)){case 2:var i=pp;break;case 8:i=mp;break;default:i=hp}n=i.bind(null,t,n,e),i=void 0,!an||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Od(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ut(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}tn(function(){var r=a,i=Xt(n),s=[];a:{var c=Hr.get(e);if(c!==void 0){var l=gn,u=e;switch(e){case`keypress`:if(dn(n)===0)break a;case`keydown`:case`keyup`:l=Pn;break;case`focusin`:u=`focus`,l=Tn;break;case`focusout`:u=`blur`,l=Tn;break;case`beforeblur`:case`afterblur`:l=Tn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Cn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=wn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=In;break;case Fr:case Ir:case Lr:l=En;break;case Vr:l=Ln;break;case`scroll`:case`scrollend`:l=vn;break;case`wheel`:l=Rn;break;case`copy`:case`cut`:case`paste`:l=Dn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Fn;break;case`toggle`:case`beforetoggle`:l=zn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=nn(m,p),g!=null&&d.push(kd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Yt&&(u=n.relatedTarget||n.fromElement)&&(ut(u)||u[U]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ut(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Cn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Fn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ft(l),h=u==null?c:ft(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ut(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=jd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Md(s,c,l,d,!1),u!==null&&f!==null&&Md(s,f,u,d,!0)}}a:{if(c=r?ft(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ar;else if($n(c)){if(or)v=hr;else{v=pr;var y=fr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Wt(r.elementType)&&(v=ar):v=mr;if(v&&=v(e,r)){er(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&It(c,`number`,c.value)}switch(y=r?ft(r):window,e){case`focusin`:($n(y)||y.contentEditable===`true`)&&(Tr=y,Er=r,Dr=null);break;case`focusout`:Dr=Er=Tr=null;break;case`mousedown`:Or=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Or=!1,kr(s,n,i);break;case`selectionchange`:if(wr)break;case`keydown`:case`keyup`:kr(s,n,i)}var b;if(Vn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Yn?qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Wn&&n.locale!==`ko`&&(Yn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Yn&&(b=un()):(sn=i,cn=`value`in sn?sn.value:sn.textContent,Yn=!0)),y=Ad(r,x),0<y.length&&(x=new On(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Jn(n),b!==null&&(x.data=b)))),(b=Un?Xn(e,n):Zn(e,n))&&(x=Ad(r,`onBeforeInput`),0<x.length&&(y=new On(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),_d(s,e,r,n,i)}Sd(s,t)})}function kd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ad(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=nn(e,n),i!=null&&r.unshift(kd(e,i,a)),i=nn(e,t),i!=null&&r.push(kd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function jd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Md(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=nn(n,a),l!=null&&o.unshift(kd(n,l,c))):i||(l=nn(n,a),l!=null&&o.push(kd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Nd=/\r\n?/g,Pd=/\u0000|\uFFFD/g;function Fd(e){return(typeof e==`string`?e:``+e).replace(Nd,`
10
- `).replace(Pd,``)}function Id(e,t){return t=Fd(t),Fd(e)===t}function Ld(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Bt(e,``+r);break;case`className`:wt(e,`class`,r);break;case`tabIndex`:wt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:wt(e,n,r);break;case`style`:Ut(e,r,o);break;case`data`:if(t!==`object`){wt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Ld(e,t,`name`,a.name,a,null),Ld(e,t,`formEncType`,a.formEncType,a,null),Ld(e,t,`formMethod`,a.formMethod,a,null),Ld(e,t,`formTarget`,a.formTarget,a,null)):(Ld(e,t,`encType`,a.encType,a,null),Ld(e,t,`method`,a.method,a,null),Ld(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Jt);break;case`onScroll`:r!=null&&Cd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Cd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Cd(`beforetoggle`,e),Cd(`toggle`,e),Ct(e,`popover`,r);break;case`xlinkActuate`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Tt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Tt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Tt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ct(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Gt.get(n)||n,Ct(e,n,r))}}function Rd(e,t,n,r,a,o){switch(n){case`style`:Ut(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Bt(e,``+r);break;case`onScroll`:r!=null&&Cd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Cd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Jt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!gt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[rt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ct(e,n,r)}}}function zd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Cd(`error`,e),Cd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Ld(e,t,o,s,n,null)}}a&&Ld(e,t,`srcSet`,n.srcSet,n,null),r&&Ld(e,t,`src`,n.src,n,null);return;case`input`:Cd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Ld(e,t,r,d,n,null)}}Ft(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Cd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Ld(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Lt(e,!!r,n,!0):Lt(e,!!r,t,!1);return;case`textarea`:for(s in Cd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Ld(e,t,s,c,n,null)}zt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Ld(e,t,l,r,n,null)}return;case`dialog`:Cd(`beforetoggle`,e),Cd(`toggle`,e),Cd(`cancel`,e),Cd(`close`,e);break;case`iframe`:case`object`:Cd(`load`,e);break;case`video`:case`audio`:for(r=0;r<bd.length;r++)Cd(bd[r],e);break;case`image`:Cd(`error`,e),Cd(`load`,e);break;case`details`:Cd(`toggle`,e);break;case`embed`:case`source`:case`link`:Cd(`error`,e),Cd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Ld(e,t,u,r,n,null)}return;default:if(Wt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Rd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Ld(e,t,c,r,n,null))}function Bd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Ld(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Ld(e,t,p,m,r,f)}}Pt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Ld(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Ld(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Lt(e,!!n,n?[]:``,!1):Lt(e,!!n,t,!0)):Lt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Ld(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Ld(e,t,s,a,r,o)}Rt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Ld(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Ld(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Ld(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Ld(e,t,u,p,r,m)}return;default:if(Wt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Rd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Rd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Ld(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Ld(e,t,f,p,r,m)}function Vd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Hd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Vd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Vd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Ud=null,Wd=null;function Gd(e){return e.nodeType===9?e:e.ownerDocument}function Kd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function qd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Jd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Yd=null;function Xd(){var e=window.event;return e&&e.type===`popstate`?e!==Yd&&(Yd=e,!0):(Yd=null,!1)}var Zd=typeof setTimeout==`function`?setTimeout:void 0,Qd=typeof clearTimeout==`function`?clearTimeout:void 0,$d=typeof Promise==`function`?Promise:void 0,ef=typeof queueMicrotask==`function`?queueMicrotask:$d===void 0?Zd:function(e){return $d.resolve(null).then(e).catch(tf)};function tf(e){setTimeout(function(){throw e})}function nf(e){return e===`head`}function rf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Rp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)vf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,vf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ct]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&vf(e.ownerDocument.body)}n=i}while(n);Rp(t)}function af(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function of(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:of(n),lt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function sf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[ct])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=pf(e.nextSibling),e===null)break}return null}function cf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=pf(e.nextSibling),e===null))return null;return e}function lf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=pf(e.nextSibling),e===null))return null;return e}function uf(e){return e.data===`$?`||e.data===`$~`}function df(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function ff(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function pf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var mf=null;function hf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return pf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function gf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function _f(e,t,n){switch(t=Gd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function vf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);lt(e)}var yf=new Map,bf=new Set;function xf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Sf=F.d;F.d={f:Cf,r:wf,D:Df,C:Of,L:kf,m:Af,X:Mf,S:jf,M:Nf};function Cf(){var e=Sf.f(),t=Cu();return e||t}function wf(e){var t=dt(e);t!==null&&t.tag===5&&t.type===`form`?ws(t):Sf.r(e)}var Tf=typeof document>`u`?null:document;function Ef(e,t,n){var r=Tf;if(r&&typeof t==`string`&&t){var i=Nt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),bf.has(i)||(bf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),zd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Df(e){Sf.D(e),Ef(`dns-prefetch`,e,null)}function Of(e,t){Sf.C(e,t),Ef(`preconnect`,e,t)}function kf(e,t,n){Sf.L(e,t,n);var r=Tf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Nt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Nt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Nt(n.imageSizes)+`"]`)):i+=`[href="`+Nt(e)+`"]`;var a=i;switch(t){case`style`:a=Ff(e);break;case`script`:a=zf(e)}yf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),yf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(If(a))||t===`script`&&r.querySelector(Bf(a))||(t=r.createElement(`link`),zd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Af(e,t){Sf.m(e,t);var n=Tf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Nt(r)+`"][href="`+Nt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=zf(e)}if(!yf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),yf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Bf(a)))return}r=n.createElement(`link`),zd(r,`link`,e),mt(r),n.head.appendChild(r)}}}function jf(e,t,n){Sf.S(e,t,n);var r=Tf;if(r&&e){var i=pt(r).hoistableStyles,a=Ff(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(If(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=yf.get(a))&&Uf(e,n);var c=o=r.createElement(`link`);mt(c),zd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Hf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Mf(e,t){Sf.X(e,t);var n=Tf;if(n&&e){var r=pt(n).hoistableScripts,i=zf(e),a=r.get(i);a||(a=n.querySelector(Bf(i)),a||(e=f({src:e,async:!0},t),(t=yf.get(i))&&Wf(e,t),a=n.createElement(`script`),mt(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t){Sf.M(e,t);var n=Tf;if(n&&e){var r=pt(n).hoistableScripts,i=zf(e),a=r.get(i);a||(a=n.querySelector(Bf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=yf.get(i))&&Wf(e,t),a=n.createElement(`script`),mt(a),zd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t,n,r){var a=(a=V.current)?xf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Ff(n.href),n=pt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Ff(n.href);var o=pt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(If(e)))&&!o._p&&(s.instance=o,s.state.loading=5),yf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},yf.set(e,n),o||Rf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=zf(n),n=pt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Ff(e){return`href="`+Nt(e)+`"`}function If(e){return`link[rel="stylesheet"][`+e+`]`}function Lf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Rf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),zd(t,`link`,n),mt(t),e.head.appendChild(t))}function zf(e){return`[src="`+Nt(e)+`"]`}function Bf(e){return`script[async]`+e}function Vf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Nt(n.href)+`"]`);if(r)return t.instance=r,mt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),mt(r),zd(r,`style`,a),Hf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Ff(n.href);var o=e.querySelector(If(a));if(o)return t.state.loading|=4,t.instance=o,mt(o),o;r=Lf(n),(a=yf.get(a))&&Uf(r,a),o=(e.ownerDocument||e).createElement(`link`),mt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),zd(o,`link`,r),t.state.loading|=4,Hf(o,n.precedence,e),t.instance=o;case`script`:return o=zf(n.src),(a=e.querySelector(Bf(o)))?(t.instance=a,mt(a),a):(r=n,(a=yf.get(o))&&(r=f({},n),Wf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),mt(a),zd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Hf(r,n.precedence,e));return t.instance}function Hf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Wf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Gf=null;function Kf(e,t,n){if(Gf===null){var r=new Map,i=Gf=new Map;i.set(n,r)}else i=Gf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ct]||a[nt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function qf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Jf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Yf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Ff(r.href),a=t.querySelector(If(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=$f.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,mt(a);return}a=t.ownerDocument||t,r=Lf(r),(i=yf.get(i))&&Uf(r,i),a=a.createElement(`link`),mt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),zd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=$f.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Zf=0;function Qf(e,t){return e.stylesheets&&e.count===0&&tp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&tp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Zf===0&&(Zf=62500*Hd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&tp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Zf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function $f(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ep=null;function tp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ep=new Map,t.forEach(np,e),ep=null,$f.call(e))}function np(e,t){if(!(t.state.loading&4)){var n=ep.get(e);if(n)var r=n.get(null);else{n=new Map,ep.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=$f.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var rp={$$typeof:x,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function ip(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=H(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=H(0),this.hiddenUpdates=H(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ap(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ip(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ri(3,null,null,t),e.current=a,a.stateNode=e,t=ia(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ia(a),e}function op(e){return e?(e=ti,e):ti}function sp(e,t,n,r,i,a){i=op(i),r.context===null?r.context=i:r.pendingContext=i,r=Ra(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=za(e,r,t),n!==null&&(vu(n,e,t),Ba(n,e,t))}function cp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lp(e,t){cp(e,t),(e=e.alternate)&&cp(e,t)}function up(e){if(e.tag===13||e.tag===31){var t=Qr(e,67108864);t!==null&&vu(t,e,67108864),lp(e,67108864)}}function dp(e){if(e.tag===13||e.tag===31){var t=gu();t=Ze(t);var n=Qr(e,t);n!==null&&vu(n,e,t),lp(e,t)}}var fp=!0;function pp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,hp(e,t,n,r)}finally{F.p=a,P.T=i}}function mp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,hp(e,t,n,r)}finally{F.p=a,P.T=i}}function hp(e,t,n,r){if(fp){var i=gp(r);if(i===null)Od(e,t,r,_p,n),Op(e,r);else if(Ap(i,e,t,n,r))r.stopPropagation();else if(Op(e,r),t&4&&-1<Dp.indexOf(e)){for(;i!==null;){var a=dt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ze(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Me(o);s.entanglements[1]|=c,o&=~c}sd(a),!(Ll&6)&&(iu=be()+500,cd(0,!1))}}break;case 31:case 13:s=Qr(a,2),s!==null&&vu(s,a,2),Cu(),lp(a,2)}if(a=gp(r),a===null&&Od(e,t,r,_p,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Od(e,t,r,null,n)}}function gp(e){return e=Xt(e),vp(e)}var _p=null;function vp(e){if(_p=null,e=ut(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return _p=e,null}function yp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(xe()){case Se:return 2;case Ce:return 8;case we:case Te:return 32;case Ee:return 268435456;default:return 32}default:return 32}}var bp=!1,xp=null,Sp=null,Cp=null,wp=new Map,Tp=new Map,Ep=[],Dp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Op(e,t){switch(e){case`focusin`:case`focusout`:xp=null;break;case`dragenter`:case`dragleave`:Sp=null;break;case`mouseover`:case`mouseout`:Cp=null;break;case`pointerover`:case`pointerout`:wp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Tp.delete(t.pointerId)}}function kp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=dt(t),t!==null&&up(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ap(e,t,n,r,i){switch(t){case`focusin`:return xp=kp(xp,e,t,n,r,i),!0;case`dragenter`:return Sp=kp(Sp,e,t,n,r,i),!0;case`mouseover`:return Cp=kp(Cp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return wp.set(a,kp(wp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Tp.set(a,kp(Tp.get(a)||null,e,t,n,r,i)),!0}return!1}function jp(e){var t=ut(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,et(e.priority,function(){dp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,et(e.priority,function(){dp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Mp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Yt=r,n.target.dispatchEvent(r),Yt=null}else return t=dt(n),t!==null&&up(t),e.blockedOn=n,!1;t.shift()}return!0}function Np(e,t,n){Mp(e)&&n.delete(t)}function Pp(){bp=!1,xp!==null&&Mp(xp)&&(xp=null),Sp!==null&&Mp(Sp)&&(Sp=null),Cp!==null&&Mp(Cp)&&(Cp=null),wp.forEach(Np),Tp.forEach(Np)}function Fp(e,n){e.blockedOn===n&&(e.blockedOn=null,bp||(bp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Pp)))}var Ip=null;function Lp(e){Ip!==e&&(Ip=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ip===e&&(Ip=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(vp(r||n)===null)continue;break}var a=dt(n);a!==null&&(e.splice(t,3),t-=3,Ss(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Rp(e){function t(t){return Fp(t,e)}xp!==null&&Fp(xp,e),Sp!==null&&Fp(Sp,e),Cp!==null&&Fp(Cp,e),wp.forEach(t),Tp.forEach(t);for(var n=0;n<Ep.length;n++){var r=Ep[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ep.length&&(n=Ep[0],n.blockedOn===null);)jp(n),n.blockedOn===null&&Ep.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[rt]||null;if(typeof a==`function`)o||Lp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[rt]||null)s=o.formAction;else if(vp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Lp(n)}}}function zp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Bp(e){this._internalRoot=e}Vp.prototype.render=Bp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;sp(n,gu(),e,t,null,null)},Vp.prototype.unmount=Bp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;sp(e.current,2,null,e,null,null),Cu(),t[U]=null}};function Vp(e){this._internalRoot=e}Vp.prototype.unstable_scheduleHydration=function(e){if(e){var t=$e();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ep.length&&t!==0&&t<Ep[n].priority;n++);Ep.splice(n,0,e),n===0&&jp(e)}};var Hp=n.version;if(Hp!==`19.2.8`)throw Error(i(527,Hp,`19.2.8`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Up={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Wp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wp.isDisabled&&Wp.supportsFiber)try{ke=Wp.inject(Up),Ae=Wp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ws,s=Gs,c=Ks;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ap(e,1,!1,null,null,n,r,null,o,s,c,zp),e[U]=t.current,Ed(e),new Bp(t)}})),Ge=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=We()})),H=e(g(),1),Ke=Ge(),qe=/^\/compact(?:\s+([\s\S]+))?$/i;function Je(e){let t=qe.exec(e.trim());if(!t)return null;let n=t[1]?.trim();return n?{instructions:n}:{}}var Ye=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Xe=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Ze=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Qe=e=>{let t=Ze(e);return t.charAt(0).toUpperCase()+t.slice(1)},$e={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`},et=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},tt=(0,H.createContext)({}),nt=()=>(0,H.useContext)(tt),rt=(0,H.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=nt()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,H.createElement)(`svg`,{ref:c,...$e,width:t??l??$e.width,height:t??l??$e.height,stroke:e??f,strokeWidth:m,className:Ye(`lucide`,p,i),...!a&&!et(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,H.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),U=(e,t)=>{let n=(0,H.forwardRef)(({className:n,...r},i)=>(0,H.createElement)(rt,{ref:i,iconNode:t,className:Ye(`lucide-${Xe(Qe(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Qe(e),n},it=U(`alarm-clock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),at=U(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ot=U(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),st=U(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),ct=U(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),lt=U(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),ut=U(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),dt=U(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),ft=U(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),pt=U(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),mt=U(`brain`,[[`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`}]]),ht=U(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),gt=U(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),_t=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),vt=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),yt=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),bt=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),xt=U(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),St=U(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Ct=U(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),wt=U(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Tt=U(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Et=U(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Dt=U(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),Ot=U(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),kt=U(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),At=U(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),jt=U(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Mt=U(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Nt=U(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),Pt=U(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Ft=U(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),It=U(`corner-down-right`,[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),Lt=U(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Rt=U(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),zt=U(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Bt=U(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Vt=U(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),Ht=U(`file-plus`,[[`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:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Ut=U(`file-text`,[[`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`}]]),Wt=U(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Gt=U(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 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.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),Kt=U(`folder-open`,[[`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`}]]),qt=U(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Jt=U(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Yt=U(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Xt=U(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),Zt=U(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Qt=U(`image-down`,[[`path`,{d:`M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21`,key:`9csbqa`}],[`path`,{d:`m14 19 3 3v-5.5`,key:`9ldu5r`}],[`path`,{d:`m17 22 3-3`,key:`1nkfve`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),$t=U(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),en=U(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),tn=U(`image`,[[`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`}]]),nn=U(`images`,[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]),rn=U(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),an=U(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),on=U(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),sn=U(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),cn=U(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ln=U(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),un=U(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),dn=U(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),fn=U(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),pn=U(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),mn=U(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),hn=U(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),gn=U(`monitor`,[[`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`}]]),_n=U(`moon`,[[`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`}]]),vn=U(`package-minus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M21 13V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`zu9avd`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),yn=U(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),bn=U(`panel-left-close`,[[`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`}]]),xn=U(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Sn=U(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Cn=U(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),wn=U(`pencil`,[[`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`}]]),Tn=U(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),En=U(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Dn=U(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),On=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),kn=U(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),An=U(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),jn=U(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Mn=U(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Nn=U(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Pn=U(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Fn=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),In=U(`send`,[[`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`}]]),Ln=U(`shield-alert`,[[`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`}]]),Rn=U(`shield-x`,[[`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:`m14.5 9.5-5 5`,key:`17q4r4`}],[`path`,{d:`m9.5 9.5 5 5`,key:`18nt4w`}]]),zn=U(`shield`,[[`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`}]]),Bn=U(`skip-forward`,[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]),Vn=U(`slash`,[[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}]]),Hn=U(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Un=U(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Wn=U(`square-dashed`,[[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M21 14v1`,key:`169vum`}]]),Gn=U(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Kn=U(`square-slash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),qn=U(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Jn=U(`square-x`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Yn=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Xn=U(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Zn=U(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Qn=U(`undo-2`,[[`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`}]]),$n=U(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),er=U(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),tr=U(`users`,[[`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`}]]),nr=U(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),rr=U(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),ir=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ar=U(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]);function or(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var sr={};function cr(e,t,n,r,i){if(!n&&!r&&!i&&!e)return ur(t);let a=ur(e);return t&&(a=dr(a,t)),n&&(a=dr(a,n)),r&&(a=dr(a,r)),i&&(a=dr(a,i)),a}function lr(e){if(e.length===0)return sr;if(e.length===1)return ur(e[0]);let t=ur(e[0]);for(let n=1;n<e.length;n+=1)t=dr(t,e[n]);return t}function ur(e){return hr(e)?{...gr(e,sr)}:fr(e)}function dr(e,t){return hr(t)?gr(t,e):pr(e,t)}function fr(e){let t={...e};for(let e in t){let n=t[e];mr(e,n)&&(t[e]=vr(n))}return t}function pr(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=or(e.style,r);break;case`className`:e[n]=br(e.className,r);break;default:e[n]=mr(n,r)?_r(e[n],r):r}}return e}function mr(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function hr(e){return typeof e==`function`}function gr(e,t){return hr(e)?e(t):e??sr}function _r(e,t){return t?e?(...n)=>{let r=n[0];if(xr(r)){let i=r;yr(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:vr(t):e}function vr(e){return e&&((...t)=>{let n=t[0];return xr(n)&&yr(n),e(...t)})}function yr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function br(e,t){return t?e?t+` `+e:t:e}function xr(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function Sr(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var Cr=Sr(`https://base-ui.com/production-error`,`Base UI`),wr={};function Tr(e,t){let n=H.useRef(wr);return n.current===wr&&(n.current=e(t)),n}function Er(e,t,n,r){let i=Tr(Or).current;return kr(i,e,t,n,r)&&jr(i,[e,t,n,r]),i.callback}function Dr(e){let t=Tr(Or).current;return Ar(t,e)&&jr(t,e),t.callback}function Or(){return{callback:null,cleanup:null,refs:[]}}function kr(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Ar(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function jr(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}var Mr=19;function Nr(e){return Mr>=e}function Pr(e){if(!H.isValidElement(e))return null;let t=e,n=t.props;return(Nr(19)?n?.ref:t.ref)??null}function Fr(){}var Ir=Object.freeze([]),Lr=Object.freeze({});function Rr(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function zr(e,t){return typeof e==`function`?e(t):e}function Br(e,t){return typeof e==`function`?e(t):e}function Vr(e,t,n={}){let r=t.render,i=Hr(t,n);return n.enabled===!1?null:Gr(e,r,i,n.state??Lr)}function Hr(e,t={}){let{className:n,style:r,render:i}=e,{state:a=Lr,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?zr(n,a):void 0,d=l?Br(r,a):void 0,f=l?Rr(a,c):Lr,p=l&&s?Ur(s):void 0,m=l?or(f,p)??{}:Lr;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?Dr([m.ref,Pr(i),...o]):Er(m.ref,Pr(i),o):Er(null,null)),l?(u!==void 0&&(m.className=br(m.className,u)),d!==void 0&&(m.style=or(m.style,d)),m):Lr}function Ur(e){return Array.isArray(e)?lr(e):cr(void 0,e)}var Wr=Symbol.for(`react.lazy`);function Gr(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=cr(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===Wr&&(i=H.Children.toArray(t)[0]),H.cloneElement(i,e)}if(e&&typeof e==`string`)return Kr(e,n);throw Error(Cr(8))}function Kr(e,t){return e===`button`?(0,H.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,H.createElement)(`img`,{alt:``,...t,key:t.key}):H.createElement(e,t)}function qr(e){return Vr(e.defaultTagName??`div`,e,e)}function Jr(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Jr(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Yr(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Jr(e))&&(r&&(r+=` `),r+=t);return r}var Xr=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Zr=Yr,Qr=(e,t)=>n=>{if(t?.variants==null)return Zr(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Xr(t)||Xr(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Zr(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},$r=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ei=(e,t)=>({classGroupId:e,validator:t}),ti=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ni=`-`,ri=[],ii=`arbitrary..`,ai=e=>{let t=ci(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return si(e);let n=e.split(ni);return oi(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?$r(i,t):t:i||ri}return n[e]||ri}}},oi=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=oi(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ni):e.slice(t).join(ni),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},si=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ii+r:void 0})(),ci=e=>{let{theme:t,classGroups:n}=e;return li(n,t)},li=(e,t)=>{let n=ti();for(let r in e){let i=e[r];ui(i,n,r,t)}return n},ui=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];di(i,t,n,r)}},di=(e,t,n,r)=>{if(typeof e==`string`){fi(e,t,n);return}if(typeof e==`function`){pi(e,t,n,r);return}mi(e,t,n,r)},fi=(e,t,n)=>{let r=e===``?t:hi(t,e);r.classGroupId=n},pi=(e,t,n,r)=>{if(gi(e)){ui(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ei(n,e))},mi=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];ui(o,hi(t,a),n,r)}},hi=(e,t)=>{let n=e,r=t.split(ni),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=ti(),n.nextPart.set(t,i)),n=i}return n},gi=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,_i=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},vi=`!`,yi=`:`,bi=[],xi=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Si=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===yi){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(vi)?(c=s.slice(0,-1),l=!0):s.startsWith(vi)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return xi(t,l,c,u)};if(t){let e=t+yi,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):xi(bi,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Ci=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},wi=e=>({cache:_i(e.cacheSize),parseClassName:Si(e),sortModifiers:Ci(e),postfixLookupClassGroupIds:Ti(e),...ai(e)}),Ti=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Ei=/\s+/,Di=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Ei),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+vi:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Oi=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=ki(n))&&(i&&(i+=` `),i+=r);return i},ki=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=ki(e[r]))&&(n&&(n+=` `),n+=t);return n},Ai=(e,...t)=>{let n,r,i,a,o=o=>(n=wi(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Di(e,n);return i(e,a),a};return a=o,(...e)=>a(Oi(...e))},ji=[],Mi=e=>{let t=t=>t[e]||ji;return t.isThemeGetter=!0,t},Ni=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pi=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fi=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ii=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Li=/\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$/,Ri=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vi=e=>Fi.test(e),Hi=e=>!!e&&!Number.isNaN(Number(e)),Ui=e=>!!e&&Number.isInteger(Number(e)),Wi=e=>e.endsWith(`%`)&&Hi(e.slice(0,-1)),Gi=e=>Ii.test(e),Ki=()=>!0,qi=e=>Li.test(e)&&!Ri.test(e),Ji=()=>!1,Yi=e=>zi.test(e),Xi=e=>Bi.test(e),Zi=e=>!ea(e)&&!ca(e),Qi=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)),$i=e=>ga(e,ba,Ji),ea=e=>Ni.test(e),ta=e=>ga(e,xa,qi),na=e=>ga(e,Sa,Hi),ra=e=>ga(e,wa,Ki),ia=e=>ga(e,Ca,Ji),aa=e=>ga(e,va,Ji),oa=e=>ga(e,ya,Xi),sa=e=>ga(e,Ta,Yi),ca=e=>Pi.test(e),la=e=>_a(e,xa),ua=e=>_a(e,Ca),da=e=>_a(e,va),fa=e=>_a(e,ba),pa=e=>_a(e,ya),ma=e=>_a(e,Ta,!0),ha=e=>_a(e,wa,!0),ga=(e,t,n)=>{let r=Ni.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},_a=(e,t,n=!1)=>{let r=Pi.exec(e);return r?r[1]?t(r[1]):n:!1},va=e=>e===`position`||e===`percentage`,ya=e=>e===`image`||e===`url`,ba=e=>e===`length`||e===`size`||e===`bg-size`,xa=e=>e===`length`,Sa=e=>e===`number`,Ca=e=>e===`family-name`,wa=e=>e===`number`||e===`weight`,Ta=e=>e===`shadow`,Ea=Ai(()=>{let e=Mi(`color`),t=Mi(`font`),n=Mi(`text`),r=Mi(`font-weight`),i=Mi(`tracking`),a=Mi(`leading`),o=Mi(`breakpoint`),s=Mi(`container`),c=Mi(`spacing`),l=Mi(`radius`),u=Mi(`shadow`),d=Mi(`inset-shadow`),f=Mi(`text-shadow`),p=Mi(`drop-shadow`),m=Mi(`blur`),h=Mi(`perspective`),g=Mi(`aspect`),_=Mi(`ease`),v=Mi(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),ca,ea],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[ca,ea,c],T=()=>[Vi,`full`,`auto`,...w()],E=()=>[Ui,`none`,`subgrid`,ca,ea],D=()=>[`auto`,{span:[`full`,Ui,ca,ea]},Ui,ca,ea],O=()=>[Ui,`auto`,ca,ea],k=()=>[`auto`,`min`,`max`,`fr`,ca,ea],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Vi,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Vi,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Vi,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,ca,ea],ee=()=>[...b(),da,aa,{position:[ca,ea]}],L=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],te=()=>[`auto`,`cover`,`contain`,fa,$i,{size:[ca,ea]}],R=()=>[Wi,la,ta],z=()=>[``,`none`,`full`,l,ca,ea],B=()=>[``,Hi,la,ta],ne=()=>[`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`],re=()=>[Hi,Wi,da,aa],ie=()=>[``,`none`,m,ca,ea],ae=()=>[`none`,Hi,ca,ea],oe=()=>[`none`,Hi,ca,ea],se=()=>[Hi,ca,ea],ce=()=>[Vi,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Gi],breakpoint:[Gi],color:[Ki],container:[Gi],"drop-shadow":[Gi],ease:[`in`,`out`,`in-out`],font:[Zi],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Gi],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Gi],shadow:[Gi],spacing:[`px`,Hi],text:[Gi],"text-shadow":[Gi],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Vi,ea,ca,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,ca,ea]}],"container-named":[Qi],columns:[{columns:[Hi,ea,ca,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Ui,`auto`,ca,ea]}],basis:[{basis:[Vi,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Hi,Vi,`auto`,`initial`,`none`,ea]}],grow:[{grow:[``,Hi,ca,ea]}],shrink:[{shrink:[``,Hi,ca,ea]}],order:[{order:[Ui,`first`,`last`,`none`,ca,ea]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"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":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,la,ta]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,ha,ra]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Wi,ea]}],"font-family":[{font:[ua,ia,t]}],"font-features":[{"font-features":[ea]}],"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:[i,ca,ea]}],"line-clamp":[{"line-clamp":[Hi,`none`,ca,na]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,ca,ea]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,ca,ea]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ne(),`wavy`]}],"text-decoration-thickness":[{decoration:[Hi,`from-font`,`auto`,ca,ta]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Hi,`auto`,ca,ea]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Ui,ca,ea]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,ca,ea]}],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`,ca,ea]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:te()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Ui,ca,ea],radial:[``,ca,ea],conic:[Ui,ca,ea]},pa,oa]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"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:[...ne(),`hidden`,`none`]}],"divide-style":[{divide:[...ne(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...ne(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Hi,ca,ea]}],"outline-w":[{outline:[``,Hi,la,ta]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,ma,sa]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,ma,sa]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Hi,ta]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,ma,sa]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Hi,ca,ea]}],"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":[Hi]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[ca,ea]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[Hi]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,ca,ea]}],filter:[{filter:[``,`none`,ca,ea]}],blur:[{blur:ie()}],brightness:[{brightness:[Hi,ca,ea]}],contrast:[{contrast:[Hi,ca,ea]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,ma,sa]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Hi,ca,ea]}],"hue-rotate":[{"hue-rotate":[Hi,ca,ea]}],invert:[{invert:[``,Hi,ca,ea]}],saturate:[{saturate:[Hi,ca,ea]}],sepia:[{sepia:[``,Hi,ca,ea]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,ca,ea]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[Hi,ca,ea]}],"backdrop-contrast":[{"backdrop-contrast":[Hi,ca,ea]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Hi,ca,ea]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Hi,ca,ea]}],"backdrop-invert":[{"backdrop-invert":[``,Hi,ca,ea]}],"backdrop-opacity":[{"backdrop-opacity":[Hi,ca,ea]}],"backdrop-saturate":[{"backdrop-saturate":[Hi,ca,ea]}],"backdrop-sepia":[{"backdrop-sepia":[``,Hi,ca,ea]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,ca,ea]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Hi,`initial`,ca,ea]}],ease:[{ease:[`linear`,`initial`,_,ca,ea]}],delay:[{delay:[Hi,ca,ea]}],animate:[{animate:[`none`,v,ca,ea]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,ca,ea]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":[`scale-3d`],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[ca,ea,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":[`translate-none`],zoom:[{zoom:[Ui,ca,ea]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"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`,ca,ea]}],"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":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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`,ca,ea]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Hi,la,ta,na]}],stroke:[{stroke:[`none`,...I()]}],"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`]}});function W(...e){return Ea(Yr(e))}var Da=Qr(`[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-[box-shadow,transform] duration-150 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 active:scale-[0.97] sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-9 px-[calc(--spacing(3)-1px)] sm:h-8`,icon:`size-9 sm:size-8`,"icon-lg":`size-10 sm:size-9`,"icon-sm":`size-8 sm:size-7`,"icon-xl":`size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,"icon-xs":`size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5`,lg:`h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9`,sm:`h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7`,xl:`h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,xs:`h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5`},variant:{default:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none`,destructive:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none`,"destructive-outline":`border-border bg-transparent bg-clip-padding text-destructive shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/32 [:hover,[data-pressed]]:bg-destructive/4`,ghost:`border-transparent hover:bg-accent data-pressed:bg-accent`,link:`border-transparent underline-offset-4 hover:underline`,outline:`border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80`}}});function Oa({className:e,variant:t,size:n,render:r,...i}){let a=r?void 0:`button`;return qr({defaultTagName:`button`,props:cr({className:W(Da({className:e,size:n,variant:t})),"data-slot":`button`,type:a},i),render:r})}function ka(e){let t=0;for(let n of e)n.muted!==!0&&(t+=Aa(n.pendingAskCount),t+=Aa(n.pendingApprovalCount));return t}function Aa(e){return typeof e!=`number`||!Number.isFinite(e)||e<=0?0:Math.floor(e)}function ja(e,t=typeof navigator>`u`?{}:navigator){let n=Aa(e);try{n>0?t.setAppBadge?.(n):t.clearAppBadge?.()}catch{}}function Ma(e){switch(e){case`image-quota`:return`Chat image storage is full (200MiB). Message not sent.`;case`image-too-large`:return`An image is still over 10MiB after compression. Message not sent.`;case`image-not-image`:return`An attachment is not a supported image. Message not sent.`;case`image-storage`:return`Could not save the images. Message not sent. Please try again.`;default:return}}var Na=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,Pa=e=>typeof e==`string`&&Na.test(e),Fa=new Set([`image`,`markdown`,`html`,`pdf`,`text`,`other`]),Ia=new Set([`file`,`web`,`desktop`,`upload`]),La=3e4,Ra=e=>`entryId`in e?`${e.chatId}|e|${e.entryId}`:`${e.chatId}|c|${e.conversationId}|${e.messageIndex}`,za=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ba=e=>typeof e==`string`&&e?e:void 0,Va=e=>typeof e==`string`&&/^data:image\/(?:png|jpeg|gif|webp|svg\+xml|bmp|avif|x-icon);base64,/.test(e);function Ha(e){if(!za(e))return null;let{rel:t,name:n,size:r,kind:i}=e;return typeof t==`string`&&typeof n==`string`&&typeof r==`number`&&typeof i==`string`&&Fa.has(i)?{rel:t,name:n,size:r,kind:i}:null}function Ua(e){if(!za(e)||typeof e.source!=`string`||!Ia.has(e.source))return null;let t=e.source,n=Ba(e.name),r=Ba(e.caption),i={source:t,...n?{name:n}:{},...r?{caption:r}:{}};return e.ok===!0&&Pa(e.mediaId)?{ok:!0,mediaId:e.mediaId,...Va(e.thumb)?{thumb:e.thumb}:{},...i}:e.ok===!1&&(e.error===`too-large`||e.error===`quota`)?{ok:!1,error:e.error,...i}:null}var Wa=class{send;cache=new Map;inflight=new Set;listeners=new Set;images=new Map;seq=0;constructor(e){this.send=e}get(e){return this.cache.get(Ra(e))}request(e){let t=Ra(e),n=this.cache.get(t);this.inflight.has(t)||n&&(n.artifacts.length>0||n.media.length>0)||(this.inflight.add(t),this.send({type:`bot-artifacts`,target:e}))}receive(e){if(!za(e.target))return;let t=Ra(e.target);this.inflight.delete(t);let n=(Array.isArray(e.artifacts)?e.artifacts:[]).map(Ha).filter(e=>e!==null),r=new Set,i=(Array.isArray(e.media)?e.media:[]).map(Ua).filter(e=>e?.ok?!r.has(e.mediaId)&&(r.add(e.mediaId),!0):e!==null).slice(0,4);this.cache.set(t,{artifacts:n,media:i});for(let e of this.listeners)e()}image(e,t){let n=`img-${Date.now().toString(36)}-${++this.seq}`;return new Promise(r=>{let i=setTimeout(()=>this.settle(n,{error:`timeout`}),La);this.images.set(n,e=>{clearTimeout(i),r(e)}),this.send({type:`bot-artifact-image`,requestId:n,target:e,...t})})}receiveImage(e){this.settle(e.requestId,Va(e.dataUrl)?{dataUrl:e.dataUrl}:{error:e.error??`invalid`})}reset(){this.inflight.clear();for(let e of[...this.images.keys()])this.settle(e,{error:`offline`})}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}settle(e,t){let n=this.images.get(e);n&&(this.images.delete(e),n(t))}},Ga=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ka=n(((e,t)=>{t.exports=Ga()})),G=Ka(),qa=(0,H.createContext)(null),Ja={web:`网页截图`,desktop:`桌面截图`,file:`工作区`,upload:``},Ya=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function Xa({target:e}){let t=(0,H.useContext)(qa),n=Ra(e),r=t?.port,i=(0,H.useSyncExternalStore)(e=>r?.subscribe(e)??(()=>{}),()=>r?.get(e)),a=t?.online??!1;(0,H.useEffect)(()=>{a&&r?.request(e)},[r,n,a]);let[o,s]=(0,H.useState)(null);if(!r||!i||i.media.length===0&&i.artifacts.length===0)return null;let c=i.media.some(e=>e.ok&&e.source===`desktop`);return(0,G.jsxs)(`div`,{className:`mt-1.5`,children:[i.media.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.media.map((e,t)=>e.ok?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>s({ref:{mediaId:e.mediaId},title:e.caption??e.name??Ja[e.source],source:e.source,thumb:e.thumb}),className:`relative h-20 w-28 overflow-hidden rounded-lg border bg-muted`,children:[e.thumb?(0,G.jsx)(`img`,{src:e.thumb,alt:``,className:`h-full w-full object-cover`}):(0,G.jsx)($t,{className:`m-auto h-4 w-4 text-muted-foreground`}),Ja[e.source]&&(0,G.jsx)(`span`,{className:W(`absolute top-1 left-1 rounded px-1 text-[10px] leading-4`,e.source===`desktop`?`bg-warning text-warning-foreground`:`bg-black/60 text-white`),children:Ja[e.source]}),(e.caption||e.name)&&(0,G.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/70 to-transparent px-1.5 pt-3 pb-0.5 text-left text-[10px] text-white`,children:e.caption??e.name})]},e.mediaId):(0,G.jsxs)(`div`,{className:`flex w-32 flex-col gap-0.5 rounded-lg border border-destructive/60 border-dashed p-2 text-destructive text-xs`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium`,children:e.name??Ja[e.source]}),(0,G.jsx)(`span`,{children:e.error===`quota`?`群图片空间已满,没收下`:`压缩后仍超过 10MiB,没发出去`})]},`failed-${t}`))}),c&&(0,G.jsx)(`p`,{className:`mt-1 text-warning text-xs`,children:`桌面截图可能拍到别的窗口里的敏感内容。`}),i.artifacts.length>0&&(0,G.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:i.artifacts.map(e=>(0,G.jsx)(Za,{artifact:e,onOpen:()=>s({ref:{rel:e.rel},title:e.name})},e.rel))}),o&&(0,G.jsx)(Qa,{preview:o,load:()=>r.image(e,o.ref),onClose:()=>s(null)})]})}function Za({artifact:e,onOpen:t}){let n=e.kind===`image`;return(0,G.jsxs)(`button`,{type:`button`,disabled:!n,onClick:t,title:e.rel,className:`flex max-w-60 items-center gap-1.5 rounded-lg border bg-card px-2 py-1 text-left text-xs disabled:cursor-default`,children:[(0,G.jsx)(Ut,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name}),(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:Ya(e.size)})]})}function Qa({preview:e,load:t,onClose:n}){let[r,i]=(0,H.useState)(null);(0,H.useEffect)(()=>{let e=!0;return t().then(t=>e&&i(t)),()=>{e=!1}},[]);let a=r&&`dataUrl`in r?r.dataUrl:e.thumb;return(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col bg-black/90 text-white`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pt-[max(env(safe-area-inset-top),0.75rem)] pb-2 text-sm`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.source&&(0,G.jsx)(`span`,{className:`shrink-0 text-white/70 text-xs`,children:Ja[e.source]}),(0,G.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`关闭`,className:`rounded p-1.5`,children:(0,G.jsx)(ir,{className:`h-5 w-5`})})]}),e.source===`desktop`&&(0,G.jsx)(`p`,{className:`px-3 text-warning text-xs`,children:`这是整桌面截图,可能拍到其他窗口里的敏感内容。`}),(0,G.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 items-center justify-center p-3`,children:[a&&(0,G.jsx)(`img`,{src:a,alt:e.title,className:`max-h-full max-w-full object-contain`}),!r&&(0,G.jsx)(cn,{className:`absolute h-5 w-5 animate-spin`}),r&&`error`in r&&(0,G.jsx)(`p`,{className:`absolute bottom-4 rounded bg-black/70 px-2 py-1 text-xs`,children:r.error===`too-large`?`图片太大,手机上看不了`:`大图没拉下来`})]})]})}var $a=`#64748b`,eo=/^#[0-9a-f]{6}$/i;function to(e){let[t,n,r]=[1,3,5].map(t=>Number.parseInt(e.slice(t,t+2),16)/255),i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s=i-a;if(s===0)return[0,0,o];let c=s/(1-Math.abs(2*o-1));return[((i===t?(n-r)/s%6:i===n?(r-t)/s+2:(t-n)/s+4)*60+360)%360,c,o]}function no(e,t,n){let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,[o,s,c]=e<60?[r,i,0]:e<120?[i,r,0]:e<180?[0,r,i]:e<240?[0,i,r]:e<300?[i,0,r]:[r,0,i];return`#${[o,s,c].map(e=>Math.round((e+a)*255).toString(16).padStart(2,`0`)).join(``)}`}function ro(e){let t=typeof e==`string`&&eo.test(e)?e.toLowerCase():$a,[n,r]=to(t),i=Math.max(r,.35),a=(e,t)=>no((n+e+360)%360,i,t);return[t,a(35,.78),a(-35,.32),a(180,.62),a(90,.9)]}var io=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t)},ao=(e,t)=>Math.floor(e/10**t%10),oo=(e,t)=>!(ao(e,t)%2),so=(e,t,n)=>{let r=e%t;return n&&ao(e,n)%2==0?-r:r},co=(e,t,n)=>t[e%n],lo=e=>{e.slice(0,1)===`#`&&(e=e.slice(1));let t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2,2),16),r=parseInt(e.substr(4,2),16);return(t*299+n*587+r*114)/1e3>=128?`#000000`:`#FFFFFF`},uo=4,fo=80;function po(e,t){let n=io(e),r=t&&t.length;return Array.from({length:uo},(e,i)=>({color:co(n+i,t,r),translateX:so(n*(i+1),fo/2-(i+17),1),translateY:so(n*(i+1),fo/2-(i+17),2),rotate:so(n*(i+1),360),isSquare:oo(n,2)}))}var mo=({name:e,colors:t,title:n,square:r,size:i,...a})=>{let o=po(e,t),s=H.useId();return(0,G.jsxs)(`svg`,{viewBox:`0 0 80 80`,fill:`none`,role:`img`,xmlns:`http://www.w3.org/2000/svg`,width:i,height:i,...a,children:[n&&(0,G.jsx)(`title`,{children:e}),(0,G.jsx)(`mask`,{id:s,maskUnits:`userSpaceOnUse`,x:0,y:0,width:fo,height:fo,children:(0,G.jsx)(`rect`,{width:fo,height:fo,rx:r?void 0:160,fill:`#FFFFFF`})}),(0,G.jsxs)(`g`,{mask:`url(#${s})`,children:[(0,G.jsx)(`rect`,{width:fo,height:fo,fill:o[0].color}),(0,G.jsx)(`rect`,{x:10,y:30,width:fo,height:o[1].isSquare?fo:fo/8,fill:o[1].color,transform:`translate(`+o[1].translateX+` `+o[1].translateY+`) rotate(`+o[1].rotate+` 40 40)`}),(0,G.jsx)(`circle`,{cx:fo/2,cy:fo/2,fill:o[2].color,r:fo/5,transform:`translate(`+o[2].translateX+` `+o[2].translateY+`)`}),(0,G.jsx)(`line`,{x1:0,y1:fo/2,x2:fo,y2:fo/2,strokeWidth:2,stroke:o[3].color,transform:`translate(`+o[3].translateX+` `+o[3].translateY+`) rotate(`+o[3].rotate+` 40 40)`})]})]})},ho=90,go=5;function _o(e,t){let n=io(e),r=t&&t.length,i=Array.from({length:go},(e,i)=>co(n+i,t,r)),a=[];return a[0]=i[0],a[1]=i[1],a[2]=i[1],a[3]=i[2],a[4]=i[2],a[5]=i[3],a[6]=i[3],a[7]=i[0],a[8]=i[4],a}var vo=({name:e,colors:t,title:n,square:r,size:i,...a})=>{let o=_o(e,t),s=H.useId();return(0,G.jsxs)(`svg`,{viewBox:`0 0 90 90`,fill:`none`,role:`img`,xmlns:`http://www.w3.org/2000/svg`,width:i,height:i,...a,children:[n&&(0,G.jsx)(`title`,{children:e}),(0,G.jsx)(`mask`,{id:s,maskUnits:`userSpaceOnUse`,x:0,y:0,width:ho,height:ho,children:(0,G.jsx)(`rect`,{width:ho,height:ho,rx:r?void 0:180,fill:`#FFFFFF`})}),(0,G.jsxs)(`g`,{mask:`url(#${s})`,children:[(0,G.jsx)(`path`,{d:`M0 0h90v45H0z`,fill:o[0]}),(0,G.jsx)(`path`,{d:`M0 45h90v45H0z`,fill:o[1]}),(0,G.jsx)(`path`,{d:`M83 45a38 38 0 00-76 0h76z`,fill:o[2]}),(0,G.jsx)(`path`,{d:`M83 45a38 38 0 01-76 0h76z`,fill:o[3]}),(0,G.jsx)(`path`,{d:`M77 45a32 32 0 10-64 0h64z`,fill:o[4]}),(0,G.jsx)(`path`,{d:`M77 45a32 32 0 11-64 0h64z`,fill:o[5]}),(0,G.jsx)(`path`,{d:`M71 45a26 26 0 00-52 0h52z`,fill:o[6]}),(0,G.jsx)(`path`,{d:`M71 45a26 26 0 01-52 0h52z`,fill:o[7]}),(0,G.jsx)(`circle`,{cx:45,cy:45,r:23,fill:o[8]})]})]})},yo=64,bo=80;function xo(e,t){let n=io(e),r=t&&t.length;return Array.from({length:yo},(e,i)=>co(n%(i+1),t,r))}var So=({name:e,colors:t,title:n,square:r,size:i,...a})=>{let o=xo(e,t),s=H.useId();return(0,G.jsxs)(`svg`,{viewBox:`0 0 80 80`,fill:`none`,role:`img`,xmlns:`http://www.w3.org/2000/svg`,width:i,height:i,...a,children:[n&&(0,G.jsx)(`title`,{children:e}),(0,G.jsx)(`mask`,{id:s,"mask-type":`alpha`,maskUnits:`userSpaceOnUse`,x:0,y:0,width:bo,height:bo,children:(0,G.jsx)(`rect`,{width:bo,height:bo,rx:r?void 0:160,fill:`#FFFFFF`})}),(0,G.jsxs)(`g`,{mask:`url(#${s})`,children:[(0,G.jsx)(`rect`,{width:10,height:10,fill:o[0]}),(0,G.jsx)(`rect`,{x:20,width:10,height:10,fill:o[1]}),(0,G.jsx)(`rect`,{x:40,width:10,height:10,fill:o[2]}),(0,G.jsx)(`rect`,{x:60,width:10,height:10,fill:o[3]}),(0,G.jsx)(`rect`,{x:10,width:10,height:10,fill:o[4]}),(0,G.jsx)(`rect`,{x:30,width:10,height:10,fill:o[5]}),(0,G.jsx)(`rect`,{x:50,width:10,height:10,fill:o[6]}),(0,G.jsx)(`rect`,{x:70,width:10,height:10,fill:o[7]}),(0,G.jsx)(`rect`,{y:10,width:10,height:10,fill:o[8]}),(0,G.jsx)(`rect`,{y:20,width:10,height:10,fill:o[9]}),(0,G.jsx)(`rect`,{y:30,width:10,height:10,fill:o[10]}),(0,G.jsx)(`rect`,{y:40,width:10,height:10,fill:o[11]}),(0,G.jsx)(`rect`,{y:50,width:10,height:10,fill:o[12]}),(0,G.jsx)(`rect`,{y:60,width:10,height:10,fill:o[13]}),(0,G.jsx)(`rect`,{y:70,width:10,height:10,fill:o[14]}),(0,G.jsx)(`rect`,{x:20,y:10,width:10,height:10,fill:o[15]}),(0,G.jsx)(`rect`,{x:20,y:20,width:10,height:10,fill:o[16]}),(0,G.jsx)(`rect`,{x:20,y:30,width:10,height:10,fill:o[17]}),(0,G.jsx)(`rect`,{x:20,y:40,width:10,height:10,fill:o[18]}),(0,G.jsx)(`rect`,{x:20,y:50,width:10,height:10,fill:o[19]}),(0,G.jsx)(`rect`,{x:20,y:60,width:10,height:10,fill:o[20]}),(0,G.jsx)(`rect`,{x:20,y:70,width:10,height:10,fill:o[21]}),(0,G.jsx)(`rect`,{x:40,y:10,width:10,height:10,fill:o[22]}),(0,G.jsx)(`rect`,{x:40,y:20,width:10,height:10,fill:o[23]}),(0,G.jsx)(`rect`,{x:40,y:30,width:10,height:10,fill:o[24]}),(0,G.jsx)(`rect`,{x:40,y:40,width:10,height:10,fill:o[25]}),(0,G.jsx)(`rect`,{x:40,y:50,width:10,height:10,fill:o[26]}),(0,G.jsx)(`rect`,{x:40,y:60,width:10,height:10,fill:o[27]}),(0,G.jsx)(`rect`,{x:40,y:70,width:10,height:10,fill:o[28]}),(0,G.jsx)(`rect`,{x:60,y:10,width:10,height:10,fill:o[29]}),(0,G.jsx)(`rect`,{x:60,y:20,width:10,height:10,fill:o[30]}),(0,G.jsx)(`rect`,{x:60,y:30,width:10,height:10,fill:o[31]}),(0,G.jsx)(`rect`,{x:60,y:40,width:10,height:10,fill:o[32]}),(0,G.jsx)(`rect`,{x:60,y:50,width:10,height:10,fill:o[33]}),(0,G.jsx)(`rect`,{x:60,y:60,width:10,height:10,fill:o[34]}),(0,G.jsx)(`rect`,{x:60,y:70,width:10,height:10,fill:o[35]}),(0,G.jsx)(`rect`,{x:10,y:10,width:10,height:10,fill:o[36]}),(0,G.jsx)(`rect`,{x:10,y:20,width:10,height:10,fill:o[37]}),(0,G.jsx)(`rect`,{x:10,y:30,width:10,height:10,fill:o[38]}),(0,G.jsx)(`rect`,{x:10,y:40,width:10,height:10,fill:o[39]}),(0,G.jsx)(`rect`,{x:10,y:50,width:10,height:10,fill:o[40]}),(0,G.jsx)(`rect`,{x:10,y:60,width:10,height:10,fill:o[41]}),(0,G.jsx)(`rect`,{x:10,y:70,width:10,height:10,fill:o[42]}),(0,G.jsx)(`rect`,{x:30,y:10,width:10,height:10,fill:o[43]}),(0,G.jsx)(`rect`,{x:30,y:20,width:10,height:10,fill:o[44]}),(0,G.jsx)(`rect`,{x:30,y:30,width:10,height:10,fill:o[45]}),(0,G.jsx)(`rect`,{x:30,y:40,width:10,height:10,fill:o[46]}),(0,G.jsx)(`rect`,{x:30,y:50,width:10,height:10,fill:o[47]}),(0,G.jsx)(`rect`,{x:30,y:60,width:10,height:10,fill:o[48]}),(0,G.jsx)(`rect`,{x:30,y:70,width:10,height:10,fill:o[49]}),(0,G.jsx)(`rect`,{x:50,y:10,width:10,height:10,fill:o[50]}),(0,G.jsx)(`rect`,{x:50,y:20,width:10,height:10,fill:o[51]}),(0,G.jsx)(`rect`,{x:50,y:30,width:10,height:10,fill:o[52]}),(0,G.jsx)(`rect`,{x:50,y:40,width:10,height:10,fill:o[53]}),(0,G.jsx)(`rect`,{x:50,y:50,width:10,height:10,fill:o[54]}),(0,G.jsx)(`rect`,{x:50,y:60,width:10,height:10,fill:o[55]}),(0,G.jsx)(`rect`,{x:50,y:70,width:10,height:10,fill:o[56]}),(0,G.jsx)(`rect`,{x:70,y:10,width:10,height:10,fill:o[57]}),(0,G.jsx)(`rect`,{x:70,y:20,width:10,height:10,fill:o[58]}),(0,G.jsx)(`rect`,{x:70,y:30,width:10,height:10,fill:o[59]}),(0,G.jsx)(`rect`,{x:70,y:40,width:10,height:10,fill:o[60]}),(0,G.jsx)(`rect`,{x:70,y:50,width:10,height:10,fill:o[61]}),(0,G.jsx)(`rect`,{x:70,y:60,width:10,height:10,fill:o[62]}),(0,G.jsx)(`rect`,{x:70,y:70,width:10,height:10,fill:o[63]})]})]})},Co=36;function wo(e,t){let n=io(e),r=t&&t.length,i=co(n,t,r),a=so(n,10,1),o=a<5?a+Co/9:a,s=so(n,10,2),c=s<5?s+Co/9:s;return{wrapperColor:i,faceColor:lo(i),backgroundColor:co(n+13,t,r),wrapperTranslateX:o,wrapperTranslateY:c,wrapperRotate:so(n,360),wrapperScale:1+so(n,Co/12)/10,isMouthOpen:oo(n,2),isCircle:oo(n,1),eyeSpread:so(n,5),mouthSpread:so(n,3),faceRotate:so(n,10,3),faceTranslateX:o>Co/6?o/2:so(n,8,1),faceTranslateY:c>Co/6?c/2:so(n,7,2)}}var To=({name:e,colors:t,title:n,square:r,size:i,...a})=>{let o=wo(e,t),s=H.useId();return(0,G.jsxs)(`svg`,{viewBox:`0 0 36 36`,fill:`none`,role:`img`,xmlns:`http://www.w3.org/2000/svg`,width:i,height:i,...a,children:[n&&(0,G.jsx)(`title`,{children:e}),(0,G.jsx)(`mask`,{id:s,maskUnits:`userSpaceOnUse`,x:0,y:0,width:Co,height:Co,children:(0,G.jsx)(`rect`,{width:Co,height:Co,rx:r?void 0:72,fill:`#FFFFFF`})}),(0,G.jsxs)(`g`,{mask:`url(#${s})`,children:[(0,G.jsx)(`rect`,{width:Co,height:Co,fill:o.backgroundColor}),(0,G.jsx)(`rect`,{x:`0`,y:`0`,width:Co,height:Co,transform:`translate(`+o.wrapperTranslateX+` `+o.wrapperTranslateY+`) rotate(`+o.wrapperRotate+` 18 18) scale(`+o.wrapperScale+`)`,fill:o.wrapperColor,rx:o.isCircle?Co:Co/6}),(0,G.jsxs)(`g`,{transform:`translate(`+o.faceTranslateX+` `+o.faceTranslateY+`) rotate(`+o.faceRotate+` 18 18)`,children:[o.isMouthOpen?(0,G.jsx)(`path`,{d:`M15 `+(19+o.mouthSpread)+`c2 1 4 1 6 0`,stroke:o.faceColor,fill:`none`,strokeLinecap:`round`}):(0,G.jsx)(`path`,{d:`M13,`+(19+o.mouthSpread)+` a1,0.75 0 0,0 10,0`,fill:o.faceColor}),(0,G.jsx)(`rect`,{x:14-o.eyeSpread,y:14,width:1.5,height:2,rx:1,stroke:`none`,fill:o.faceColor}),(0,G.jsx)(`rect`,{x:20+o.eyeSpread,y:14,width:1.5,height:2,rx:1,stroke:`none`,fill:o.faceColor})]})]})]})},Eo=4,Do=80;function Oo(e,t){let n=io(e),r=t&&t.length;return Array.from({length:Eo},(e,i)=>co(n+i,t,r))}var ko=({name:e,colors:t,title:n,square:r,size:i,...a})=>{let o=Oo(e,t),s=e.replace(/\s/g,``),c=H.useId();return(0,G.jsxs)(`svg`,{viewBox:`0 0 80 80`,fill:`none`,role:`img`,xmlns:`http://www.w3.org/2000/svg`,width:i,height:i,...a,children:[n&&(0,G.jsx)(`title`,{children:e}),(0,G.jsx)(`mask`,{id:c,maskUnits:`userSpaceOnUse`,x:0,y:0,width:Do,height:Do,children:(0,G.jsx)(`rect`,{width:Do,height:Do,rx:r?void 0:160,fill:`#FFFFFF`})}),(0,G.jsxs)(`g`,{mask:`url(#${c})`,children:[(0,G.jsx)(`path`,{fill:`url(#gradient_paint0_linear_`+s+`)`,d:`M0 0h80v40H0z`}),(0,G.jsx)(`path`,{fill:`url(#gradient_paint1_linear_`+s+`)`,d:`M0 40h80v40H0z`})]}),(0,G.jsxs)(`defs`,{children:[(0,G.jsxs)(`linearGradient`,{id:`gradient_paint0_linear_`+s,x1:Do/2,y1:0,x2:Do/2,y2:Do/2,gradientUnits:`userSpaceOnUse`,children:[(0,G.jsx)(`stop`,{stopColor:o[0]}),(0,G.jsx)(`stop`,{offset:1,stopColor:o[1]})]}),(0,G.jsxs)(`linearGradient`,{id:`gradient_paint1_linear_`+s,x1:Do/2,y1:Do/2,x2:Do/2,y2:Do,gradientUnits:`userSpaceOnUse`,children:[(0,G.jsx)(`stop`,{stopColor:o[2]}),(0,G.jsx)(`stop`,{offset:1,stopColor:o[3]})]})]})]})},Ao=3,jo=80;function Mo(e,t){let n=io(e),r=t&&t.length;return Array.from({length:Ao},(e,i)=>({color:co(n+i,t,r),translateX:so(n*(i+1),jo/10,1),translateY:so(n*(i+1),jo/10,2),scale:1.2+so(n*(i+1),jo/20)/10,rotate:so(n*(i+1),360,1)}))}var No=({name:e,colors:t,title:n,square:r,size:i,...a})=>{let o=Mo(e,t),s=H.useId();return(0,G.jsxs)(`svg`,{viewBox:`0 0 80 80`,fill:`none`,role:`img`,xmlns:`http://www.w3.org/2000/svg`,width:i,height:i,...a,children:[n&&(0,G.jsx)(`title`,{children:e}),(0,G.jsx)(`mask`,{id:s,maskUnits:`userSpaceOnUse`,x:0,y:0,width:jo,height:jo,children:(0,G.jsx)(`rect`,{width:jo,height:jo,rx:r?void 0:160,fill:`#FFFFFF`})}),(0,G.jsxs)(`g`,{mask:`url(#${s})`,children:[(0,G.jsx)(`rect`,{width:jo,height:jo,fill:o[0].color}),(0,G.jsx)(`path`,{filter:`url(#filter_${s})`,d:`M32.414 59.35L50.376 70.5H72.5v-71H33.728L26.5 13.381l19.057 27.08L32.414 59.35z`,fill:o[1].color,transform:`translate(`+o[1].translateX+` `+o[1].translateY+`) rotate(`+o[1].rotate+` 40 40) scale(`+o[2].scale+`)`}),(0,G.jsx)(`path`,{filter:`url(#filter_${s})`,style:{mixBlendMode:`overlay`},d:`M22.216 24L0 46.75l14.108 38.129L78 86l-3.081-59.276-22.378 4.005 12.972 20.186-23.35 27.395L22.215 24z`,fill:o[2].color,transform:`translate(`+o[2].translateX+` `+o[2].translateY+`) rotate(`+o[2].rotate+` 40 40) scale(`+o[2].scale+`)`})]}),(0,G.jsx)(`defs`,{children:(0,G.jsxs)(`filter`,{id:`filter_${s}`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,G.jsx)(`feFlood`,{floodOpacity:0,result:`BackgroundImageFix`}),(0,G.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`BackgroundImageFix`,result:`shape`}),(0,G.jsx)(`feGaussianBlur`,{stdDeviation:7,result:`effect1_foregroundBlur`})]})})]})},Po={pixel:So,bauhaus:mo,ring:vo,beam:To,sunset:ko,marble:No,geometric:To,abstract:mo},Fo=({variant:e=`marble`,colors:t=[`#92A1C6`,`#146A7C`,`#F0AB3D`,`#C271B4`,`#C20D90`],name:n=`Clara Barton`,title:r=!1,size:i=`40px`,square:a=!1,...o})=>{let s=Po[e]||No;return(0,G.jsx)(s,{colors:t,name:n,title:r,size:i,square:a,...o})};function Io({bot:e,size:t=`md`,busy:n}){return(0,G.jsx)(`span`,{"aria-hidden":!0,className:W(`flex shrink-0 overflow-hidden rounded-full bg-muted`,t===`sm`?`h-7 w-7`:`h-9 w-9`,n&&`ring-2 ring-brand/60 ring-offset-1 ring-offset-background animate-pulse`),children:e&&(0,G.jsx)(Fo,{name:e.name,variant:`beam`,colors:ro(e.avatarColor),size:`100%`})})}var Lo=[[0,59],[0,23],[1,31],[1,12],[0,7]];function Ro(e,t,n){if(!/^\d+$/u.test(e))return;let r=Number(e);return r>=t&&r<=n?r:void 0}function zo(e,t,n){let r=new Set;for(let i of e.split(`,`)){let[e,a,o]=i.split(`/`);if(o!==void 0)return;let s=a===void 0?1:Ro(a,1,n);if(s===void 0)return;let c,l;if(e===`*`)c=t,l=n;else{let[r,i,o]=e.split(`-`);if(o!==void 0)return;c=Ro(r,t,n),l=i===void 0?a===void 0?c:n:Ro(i,t,n)}if(c===void 0||l===void 0||c>l)return;for(let e=c;e<=l;e+=s)r.add(e)}return[...r].sort((e,t)=>e-t)}function Bo(e){let t=e.trim().split(/\s+/u);if(t.length!==5)return;let n=t.map((e,t)=>zo(e,...Lo[t]));if(n.some(e=>e===void 0))return;let[r,i,a,o,s]=n;return{source:t.join(` `),minute:r,hour:i,dayOfMonth:a,month:o,dayOfWeek:[...new Set(s.map(e=>e%7))].sort((e,t)=>e-t),domStar:t[2].startsWith(`*`),dowStar:t[4].startsWith(`*`)}}var Vo=[`所有人`,`everyone`,`all`],Ho=e=>e.normalize(`NFC`).toLowerCase();function Uo(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`&&typeof e.name==`string`&&e.name.length>0):[]}function Wo(e,t){let n=Ho(typeof e==`string`?e.replace(/^@/,``):``);return Uo(t).filter(e=>Ho(e.name).startsWith(n))}var Go=(e,t)=>Number(!!t.pinned)-Number(!!e.pinned)||t.updatedAt-e.updatedAt;function Ko(e,t){let n=new Set(t.filter(e=>!e.archived).map(e=>e.id));return{groups:e.filter(e=>e.kind===`group`).sort(Go),directs:e.filter(e=>e.kind===`direct`&&n.has(e.members[0])).sort(Go)}}function qo(e,t){let n=[e,...t.filter(t=>t.parentId===e.id)];return{current:n.find(t=>t.id===e.activeThreadId)??e,entries:n.map(e=>({id:e.id,title:e.threadTitle??(e.parentId?`新话题`:`主话题`),...e.last?.text?{preview:e.last.text}:{},activityAt:e.last?.at??e.updatedAt,unread:!1,running:e.status!==`idle`}))}}var Jo=400;function Yo(e,t=!1){return e.entries.length<=Jo?e:{...e,entries:t?e.entries.slice(0,Jo):e.entries.slice(-400),hasOlder:!t||e.hasOlder,...t?{history:!0}:{}}}function Xo(e,t,n){return n||t===0?e:e.filter(e=>e.seq>=t)}function Zo(e,t){let n={entries:[...t.entries].sort((e,t)=>e.seq-t.seq),lastSeq:t.lastSeq,hasOlder:t.hasOlder,...t.epochSeq===void 0?{}:{epochSeq:t.epochSeq}};if(e&&t.epochSeq!==void 0){if(t.epochSeq<(e.epochSeq??0))return e;if(t.epochSeq>(e.epochSeq??0)&&t.beforeSeq===void 0)return Yo(n)}if(!e||e.entries.length===0)return Yo(n,t.beforeSeq!==void 0);if(t.beforeSeq===void 0&&e.history)return{...e,lastSeq:Math.max(e.lastSeq,t.lastSeq)};if(t.beforeSeq===void 0&&t.lastSeq<e.lastSeq)return e;let r=e.entries[0].seq;if(t.beforeSeq!==void 0){if(t.beforeSeq!==r)return e}else{let t=e.entries.at(-1)?.seq??0;if((n.entries[0]?.seq??t+1)>t+1)return Yo(n)}let i=new Map(e.entries.map(e=>[e.seq,e]));for(let e of n.entries){let t=i.get(e.seq);e.truncated&&t&&!t.truncated||i.set(e.seq,e)}let a=[...i.values()].sort((e,t)=>e.seq-t.seq),o=(n.entries[0]?.seq??1/0)<r;return Yo({entries:a,lastSeq:Math.max(e.lastSeq,n.lastSeq),hasOlder:t.beforeSeq!==void 0||o?n.hasOlder:e.hasOlder,...e.history?{history:!0}:{},...n.epochSeq===void 0?e.epochSeq===void 0?{}:{epochSeq:e.epochSeq}:{epochSeq:n.epochSeq}},t.beforeSeq!==void 0)}var Qo=/[A-Za-z0-9._%+-]/;function $o(e,t){let n=e.slice(0,t),r=n.lastIndexOf(`@`);if(r<0||r>0&&Qo.test(n[r-1]))return null;let i=n.slice(r+1);return/\s/.test(i)?null:{start:r,query:i}}var es=`__all__`;function ts(e,t){let n=Vo[0],r=Ho(e.replace(/^@/,``));return[...Ho(n).startsWith(r)?[{id:es,name:n}]:[],...Wo(e,t).map(({id:e,name:t})=>({id:e,name:t}))]}function ns(e,t,n,r){let i=`@${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}var rs={approval:`需要审批`,ask:`等你回答`,"delegation-interrupted":`委派中断`,budget:`今日预算已用完`,"routine-draft":`例行任务待批准`,"routine-blocked":`例行任务被阻塞`,"task-blocked":`任务卡住`};function is(e,t){return e.kind===`silence`?`已安静 ${Math.max(0,Math.floor((t-(e.since??t))/1e3))} 秒`:rs[e.kind]}var as={thinking:`思考中`,typing:`输出中`,tool:`调用工具`,retrying:`重试中`},os={turn:`排队 · 等上一轮结束`,capacity:`排队 · 并发已满`,"member-check":`排队 · 正在判断是否可并行`,"member-serial":`排队 · 等待成员当前任务完成`,"member-fifo":`排队 · 等待成员前序任务`,"member-stopping":`排队 · 等待成员停止完成`};function ss(e){return e.state===`queued`?e.reason&&Object.hasOwn(os,e.reason)?os[e.reason]:`排队中`:as[e.state]}function cs(e){let t=e.steps.findLast(e=>e.status===`running`);return t?`${t.name} ${t.detail}`.trim():ss(e)}function ls(e,t){return e.filter(e=>e.chatId===t).sort((e,t)=>Number(e.state===`queued`)-Number(t.state===`queued`))}function us(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}var ds={running:`工作中`,queued:`排队中`};function fs(e,t,n){if(n){let r=cs(n),i=t.get(n.botId)?.name;return e.kind===`group`&&i?`${i}:${r}`:r}if(e.status!==`idle`)return ds[e.status];let r=e.last;if(!r)return e.kind===`group`?`${e.members.length} 位成员`:``;let i=r.kind===`human`?`我`:r.botId?t.get(r.botId)?.name:void 0;return i&&e.kind===`group`?`${i}:${r.text}`:r.text}function ps({bots:e,chats:t,activeChatId:n,onSelect:r,inbox:i=[],onDismiss:a,activities:o=[]}){let s=new Map(e.map(e=>[e.id,e])),{groups:c,directs:l}=Ko(t,e),u=e=>{let t=e.kind===`direct`?s.get(e.members[0]):void 0,i=ls(o,e.id)[0],a=i?i.state!==`queued`:e.status===`running`,c=!i&&e.status===`idle`;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:W(`flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60`,e.id===n&&`bg-muted`),children:[t?(0,G.jsx)(Io,{bot:t,busy:a}):(0,G.jsx)(`span`,{className:`flex shrink-0 -space-x-2`,children:e.members.slice(0,3).map(e=>(0,G.jsx)(Io,{bot:s.get(e),size:`sm`},e))}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate font-medium text-sm`,children:t?.name??(e.title||`群聊`)}),(0,G.jsx)(`span`,{className:W(`block truncate text-xs`,c?`text-muted-foreground`:`text-brand`),children:fs(e,s,i)||t?.title||`\xA0`})]})]},e.id)};return(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2`,children:[c.length===0&&l.length===0&&(0,G.jsx)(`p`,{className:`rounded-lg border border-dashed px-3 py-6 text-center text-muted-foreground text-sm`,children:`桌面端还没有 Bot 聊天`}),i.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`px-2 py-1.5 font-medium text-muted-foreground text-xs`,children:[`收件箱 · `,i.length]}),i.map(e=>{let t=e.botId?s.get(e.botId):void 0,n=e.ownerBotId?s.get(e.ownerBotId):void 0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg px-2 py-2`,children:[(0,G.jsxs)(`button`,{type:`button`,disabled:!e.chatId,onClick:()=>e.chatId&&r(e.chatId),className:`flex min-w-0 flex-1 items-center gap-2.5 text-left`,children:[(0,G.jsx)(Io,{bot:t}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`span`,{className:`block truncate font-medium text-sm`,children:[t?.name??`成员`,n?` 替 ${n.name}`:``,(0,G.jsx)(`span`,{className:`ml-1.5 font-normal text-brand text-xs`,children:is(e,Date.now())})]}),(0,G.jsx)(`span`,{className:`block truncate text-muted-foreground text-xs`,children:e.text||`\xA0`})]})]}),e.dismissible&&a&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e.key),className:`shrink-0 rounded px-2 py-1 text-muted-foreground text-xs hover:bg-muted`,children:`忽略`})]},e.key)})]}),c.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`px-2 py-1.5 font-medium text-muted-foreground text-xs`,children:`群聊`}),c.map(u)]}),l.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`px-2 py-1.5 font-medium text-muted-foreground text-xs`,children:`成员`}),l.map(u)]})]}),(0,G.jsx)(`p`,{className:`shrink-0 px-3 py-2 text-center text-[11px] text-muted-foreground`,children:`新建成员 / 群聊、例行任务请在桌面端管理`})]})}var ms=class{send;generation=0;active=null;pending=null;constructor(e){this.send=e}start(e,t){if(this.active)return this.active;let n=this.generation,r=(async()=>{let r=await this.request(e);return n===this.generation?r.needsConfirmation===!0?t()?this.request(e,!0):null:r:{...r,ok:!1,error:`offline`}})().finally(()=>{this.active===r&&(this.active=null)});return this.active=r,r}receive(e){e.requestId===this.pending?.requestId&&e.chatId===this.pending.chatId&&this.pending.settle(e)}reset(){this.generation++;let e=this.pending;e&&e.settle({type:`bot-new-session-result`,chatId:e.chatId,requestId:e.requestId,ok:!1,error:`offline`}),this.active=null}request(e,t=!1){let n=crypto.randomUUID();return new Promise(r=>{let i=setTimeout(()=>this.receive({type:`bot-new-session-result`,chatId:e,requestId:n,ok:!1,error:`timeout`}),6e4);this.pending={chatId:e,requestId:n,settle:e=>{clearTimeout(i),this.pending=null,r(e)}};try{this.send({type:`bot-new-session`,chatId:e,requestId:n,...t?{confirmed:!0}:{}})}catch{this.receive({type:`bot-new-session-result`,chatId:e,requestId:n,ok:!1,error:`offline`})}})}},hs=15e3,gs=class{send;pending=null;constructor(e){this.send=e}request(e){let t=crypto.randomUUID(),n=n=>({type:`bot-thread-result`,chatId:e.chatId,requestId:t,ok:!1,error:n});return this.pending?Promise.resolve(n(`busy`)):new Promise(r=>{let i=setTimeout(()=>this.receive(n(`timeout`)),hs);this.pending={chatId:e.chatId,requestId:t,settle:e=>{clearTimeout(i),this.pending=null,r(e)}};try{this.send({...e,requestId:t})}catch{this.receive(n(`offline`))}})}receive(e){e.requestId===this.pending?.requestId&&e.chatId===this.pending.chatId&&this.pending.settle(e)}reset(){let e=this.pending;e&&e.settle({type:`bot-thread-result`,chatId:e.chatId,requestId:e.requestId,ok:!1,error:`offline`})}},_s=`git stash`,vs=`git push --force-with-lease`,ys={"core.filesystem:rm-rf-root-home":{zh:`递归强制删除根目录或用户主目录`,why:`会删掉系统文件或全部个人数据,不进废纸篓,无法恢复。`},"core.filesystem:rm-r-f-separate-root-home":{zh:`用分开的 -r -f 参数递归强制删除根目录或用户主目录`,why:`与 rm -rf / 等价,会删掉系统文件或全部个人数据,无法恢复。`},"core.filesystem:rm-recursive-force-root-home":{zh:`用 --recursive --force 递归强制删除根目录或用户主目录`,why:`与 rm -rf / 等价,会删掉系统文件或全部个人数据,无法恢复。`},"core.filesystem:rm-rf-general":{zh:`递归强制删除目录(rm -rf)`,why:`不经确认直接删除,不进废纸篓;路径写错或通配符展开过宽会误删。`},"core.filesystem:rm-r-f-separate":{zh:`用分开的 -r -f 参数递归强制删除`,why:`与 rm -rf 等价,不经确认直接删除,无法恢复。`},"core.filesystem:rm-recursive-force-long":{zh:`用 --recursive --force 递归强制删除`,why:`与 rm -rf 等价,不经确认直接删除,无法恢复。`},"core.filesystem:rm-recursive-general":{zh:`递归删除目录(rm -r)`,why:`会删掉整棵目录树,可写文件不会逐个确认,删除后无法恢复。`},"core.filesystem:rm-glob-home":{zh:`在用户主目录下用通配符删除文件`,why:`通配符由 shell 展开,实际删除范围事先看不到,可能远超预期。`},"core.filesystem:find-delete-general":{zh:`用 find … -delete 批量删除匹配文件`,why:`效果等同递归删除匹配到的整棵树,条件写宽就会误删。`},"core.filesystem:find-delete-root-home":{zh:`对根目录、主目录或系统目录执行 find … -delete`,why:`可能批量删掉系统文件或个人数据,无法恢复。`},"core.filesystem:unlink-general":{zh:`用 unlink 删除文件`,why:`等同 rm 删除单个文件,不进废纸篓。`},"core.filesystem:truncate-zero-general":{zh:`用 truncate 截断或清空文件`,why:`文件内容会被直接截掉,无法恢复。`},"core.filesystem:shred-general":{zh:`用 shred 粉碎文件内容`,why:`多次覆写文件,连取证工具都无法恢复。`},"core.filesystem:dd-overwrite-general":{zh:`用 dd of=<文件> 覆写文件内容`,why:`目标文件原内容会被就地覆盖,无法恢复。`},"core.filesystem:mv-dynamic-path":{zh:`对含变量展开或转义路径的文件执行 mv`,why:`实际路径要到运行时才确定,可能把重要文件移走或覆盖同名文件。`},"core.filesystem:credential-file-write":{zh:`写入凭据、私钥或登录 shell 启动文件(如 ~/.ssh、~/.aws/credentials、~/.zshrc)`,why:`可能覆盖密钥、泄露凭据或植入每次登录都会执行的代码。`},"core.filesystem:git-internals-write":{zh:`直接改写 .git 目录内部文件`,why:`可能损坏仓库,或写入 git 会自动执行的 hook / 配置。`},"core.filesystem:redirect-truncate-dynamic-path":{zh:`用 > 重定向写入一个含变量展开的路径`,why:`实际目标要到运行时才确定,可能清空某个重要文件。`},"core.filesystem:fork-bomb":{zh:`fork 炸弹:无限递归创建进程`,why:`会耗尽系统资源导致机器卡死,只能强制重启。`},"core.filesystem:powershell-remove-item-recursive":{zh:`用 PowerShell Remove-Item -Recurse 递归删除`,why:`与 rm -rf 等价,不进回收站,无法恢复。`},"core.git:reset-hard":{zh:`丢弃工作区和暂存区的全部未提交改动(git reset --hard)`,why:`从未提交过的改动会彻底丢失,git 也找不回来。`,alt:_s},"core.git:reset-merge":{zh:`用 git reset --merge 回退`,why:`可能丢失未提交的改动。`,alt:_s},"core.git:clean-force":{zh:`强制删除所有未跟踪文件(git clean -f)`,why:`未跟踪文件从未进过 git,删掉就无法恢复。`,alt:`git clean -n`},"core.git:push-force-long":{zh:`强制推送(git push --force)覆盖远端分支`,why:`会覆盖远端历史,别人已推送的提交可能被抹掉。`,alt:vs},"core.git:push-force-short":{zh:`强制推送(git push -f)覆盖远端分支`,why:`会覆盖远端历史,别人已推送的提交可能被抹掉。`,alt:vs},"core.git:push-force-refspec":{zh:`用 + 前缀 refspec 强制推送`,why:`等同对该分支强制推送,会覆盖远端历史。`},"core.git:checkout-discard":{zh:`用 git checkout -- 丢弃文件的未提交改动`,why:`被丢弃的改动从未提交过,无法恢复。`,alt:_s},"core.git:checkout-discard-cwd":{zh:`用 git checkout . 丢弃当前路径下全部未提交改动`,why:`被丢弃的改动从未提交过,无法恢复。`,alt:_s},"core.git:checkout-ref-discard":{zh:`用 git checkout <ref> -- <路径> 覆盖工作区文件`,why:`工作区里这些文件的未提交改动会被覆盖,无法恢复。`,alt:_s},"core.git:checkout-force":{zh:`强制切换分支(git checkout -f)`,why:`会丢弃已跟踪文件的全部未提交改动。`,alt:_s},"core.git:switch-discard":{zh:`丢弃改动并切换分支(git switch --discard-changes / -f)`,why:`会丢弃已跟踪文件的全部未提交改动。`,alt:_s},"core.git:restore-worktree":{zh:`用 git restore 还原工作区文件`,why:`会丢弃这些文件的未提交改动,无法恢复。`,alt:_s},"core.git:restore-worktree-explicit":{zh:`用 git restore --worktree 还原工作区文件`,why:`会丢弃这些文件的未提交改动,无法恢复。`,alt:_s},"core.git:branch-delete":{zh:`删除本地分支`,why:`分支上未合并、未推送的提交会失去引用,之后难以找回。`},"core.git:branch-force-delete":{zh:`强制删除分支或强制改写分支指向(git branch -D / -f)`,why:`即使有未合并的提交也会删掉,提交失去引用后难以找回。`},"core.git:stash-clear":{zh:`清空全部 stash(git stash clear)`,why:`所有暂存的改动会一次性删除。`,alt:`git stash list`},"core.git:filter-branch":{zh:`用 git filter-branch 改写仓库历史`,why:`会改写大量提交,操作不当会永久丢失提交。`},"core.git:reflog-expire-now":{zh:`立即清空 reflog`,why:`reflog 是找回误删提交的最后手段,清空后就找不回了。`},"core.git:rm-force":{zh:`强制删除文件(git rm -f)`,why:`即使文件有未提交改动也会删掉,改动无法恢复。`},"heredoc.posix:pipeline-consumer":{zh:`把下载或其它程序的输出直接管道给 shell 执行(如 curl … | sh)`,why:`执行的内容事先看不到,可能运行任意代码。`},"system.disk:dd-device":{zh:`用 dd 写入块设备`,why:`会覆盖整个磁盘或分区上的全部数据。`},"system.disk:mkfs":{zh:`格式化分区(mkfs)`,why:`会清除该分区上的全部数据。`},"system.disk:diskutil-erase":{zh:`用 diskutil 抹掉磁盘或宗卷`,why:`会清除目标磁盘或宗卷上的全部数据。`}};function bs(e){let t=Object.hasOwn(ys,e.ruleId)?ys[e.ruleId]:null;return t?{what:t.zh,why:t.why,...t.alt?{alt:t.alt}:{}}:{what:e.reason}}var xs=new Set([`core.filesystem:rm-rf-root-home`,`core.filesystem:rm-r-f-separate-root-home`,`core.filesystem:rm-recursive-force-root-home`,`core.filesystem:find-delete-root-home`,`core.filesystem:credential-file-write`,`core.filesystem:fork-bomb`,`heredoc.posix:pipeline-consumer`,`system.disk:dd-device`,`system.disk:mkfs`,`system.disk:diskutil-erase`]),Ss=/^[A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+$/,Cs=e=>typeof e==`string`&&e.length<=128&&Ss.test(e),ws=e=>Cs(e)&&!e.startsWith(`enso.`)&&!xs.has(e);function Ts(e){return/^(.+)\/\d+$/.exec(e)?.[1]}var Es=e=>Ts(e)!==void 0,Ds=typeof navigator<`u`&&navigator.language.startsWith(`zh`)?`zh`:`en`;function Os(e,t){return Le(Ds,e,t)}function ks(e,t){let n=Le(Ds,e);return t?n.split(/(\{\{\w+\}\})/g).map(e=>{let n=/^\{\{(\w+)\}\}$/.exec(e);if(!n)return e;let r=t[n[1]];return r===void 0?e:(0,G.jsx)(`span`,{children:r},n[1])}):n}function K(){return{locale:Ds,t:Os,tNode:ks}}var As={"external-send":`Protected: external send`,delete:`Protected: delete`,payment:`Protected: payment`,deploy:`Protected: deploy / production`,secret:`Protected: secrets`,destructive:`Protected: destructive command`};function js(e,t){return t(As[e])}var Ms={exec:`Isolated sandbox`,codemode:`Isolated sandbox`,tool_search:`Tool search`,apply_patch:`Apply patch`,explore_mark:`Explore mark`,explore_fold:`Explore fold`,turn_discard:`Turn discard`,turn_recall:`Turn recall`,subagent:`Subagent`,workflow:`Workflow`,ask_user:`Ask user`,task_output:`Task output`,task_stop:`Task stop`,task_settle:`Background task wrap-up`,remind_me:`Remind me`,reminder_list:`Reminder list`,reminder_cancel:`Cancel reminder`,message_coworker:`Message coworker`,message_main_agent:`Message main agent`,recall:`Recall memory`,memory_search:`Memory search`,memory_capture:`Memory capture`,memory_crystallize:`Memory crystallize`,memory_delete:`Memory delete`,browser_navigate:`Browser navigate`,browser_snapshot:`Browser snapshot`,browser_click:`Browser click`,browser_type:`Browser type`,browser_tabs:`Browser tabs`,browser_lock:`Browser lock`,browser_fill:`Browser fill`,browser_press_key:`Browser press key`,browser_scroll:`Browser scroll`,browser_select_option:`Browser select option`,browser_mouse_click_xy:`Browser click xy`,browser_drag:`Browser drag`,browser_highlight:`Browser highlight`,browser_get_bounding_box:`Browser bounding box`,browser_screenshot:`Browser screenshot`,browser_cdp:`Browser CDP`,web_search:`Web search`,web_fetch:`Web fetch`,todo:`Todos`};function Ns(e,t){let n=Ms[e];return n?t(n):e}var Ps={report:`Read report`,wait:`Wait`,stop:`Stop`,dismiss:`Dismiss agent`,list:`List agents`,resume:`Resume agent`};function Fs({text:e,className:t,label:n}){let{t:r}=K(),[i,a]=(0,H.useState)(!1);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{let t=typeof e==`function`?e():e;navigator.clipboard.writeText(t).then(()=>{a(!0),setTimeout(()=>a(!1),1e3)})},className:W(`flex items-center gap-1 transition-colors hover:text-foreground`,t),title:r(`Copy`),children:[(0,G.jsxs)(`span`,{className:`t-icon-swap`,"data-state":i?`b`:`a`,children:[(0,G.jsx)(`span`,{className:`t-icon inline-flex`,"data-icon":`a`,children:(0,G.jsx)(Ft,{className:`h-3 w-3`})}),(0,G.jsx)(`span`,{className:`t-icon inline-flex`,"data-icon":`b`,children:(0,G.jsx)(_t,{className:`h-3 w-3`})})]}),n]})}function Is(e,t=0){let[n,r]=(0,H.useState)(()=>Date.now());return(0,H.useEffect)(()=>{if(e===void 0)return;r(Date.now());let t=window.setInterval(()=>r(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),e===void 0?void 0:e+t-n}function Ls({remainingMs:e,expiredLabel:t}){let{t:n}=K();if(e===void 0)return null;if(e<=0)return(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] text-warning`,children:n(t)});let r=Math.ceil(e/1e3),i=`${Math.floor(r/60)}:${String(r%60).padStart(2,`0`)}`;return(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground tabular-nums`,children:n(`{{time}} left`,{time:i})})}var Rs=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Bs=Object.getOwnPropertyNames,Vs=Object.prototype.hasOwnProperty,Hs=(e,t)=>{let n={};for(var r in e)Rs(n,r,{get:e[r],enumerable:!0});return t||Rs(n,Symbol.toStringTag,{value:`Module`}),n},Us=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Bs(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Vs.call(e,s)&&s!==n&&Rs(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=zs(t,s))||r.enumerable});return e},Ws=(e,t,n)=>(Us(e,t,`default`),n&&Us(n,t,`default`)),Gs=e(Ue()),Ks=`modulepreload`,qs=function(e){return`/`+e},Js={},q=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=qs(t,n),t=s(t),t in Js)return;Js[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Ks,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ys=[{id:`abap`,name:`ABAP`,import:(()=>q(()=>import(`./abap-CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>q(()=>import(`./actionscript-3-Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>q(()=>import(`./ada-C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>q(()=>import(`./ahk-CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>q(()=>import(`./ahk2-_6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>q(()=>import(`./angular-html-aPuBvESs.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>q(()=>import(`./angular-ts-ocjSXnvf.js`),__vite__mapDeps([5,0,1,2,3,4,6])))},{id:`apache`,name:`Apache Conf`,import:(()=>q(()=>import(`./apache-U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>q(()=>import(`./apex-KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>q(()=>import(`./apl-D8Zaj6f9.js`),__vite__mapDeps([7,3,1,4,2,8,9,10])))},{id:`applescript`,name:`AppleScript`,import:(()=>q(()=>import(`./applescript-CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>q(()=>import(`./ara-4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>q(()=>import(`./asciidoc-SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>q(()=>import(`./asm-Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>q(()=>import(`./astro-CbVusc_k.js`),__vite__mapDeps([11,3,1,4,10,12,13,14])))},{id:`awk`,name:`AWK`,import:(()=>q(()=>import(`./awk-BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>q(()=>import(`./ballerina-B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>q(()=>import(`./bat-qdxAdBWQ.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>q(()=>import(`./beancount-D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>q(()=>import(`./berry-DKpUyyne.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>q(()=>import(`./bibtex-Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>q(()=>import(`./bicep-CUHmPFLl.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>q(()=>import(`./bird2-CYIUgYqB.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>q(()=>import(`./blade-BuKMbjJR.js`),__vite__mapDeps([15,3,1,4,2,8,9,10,16,17])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>q(()=>import(`./bsl-_VjlB9mv.js`),__vite__mapDeps([18,19])))},{id:`c`,name:`C`,import:(()=>q(()=>import(`./c-BNQJhXlP.js`).then(e=>e.n),__vite__mapDeps([20,1])))},{id:`c3`,name:`C3`,import:(()=>q(()=>import(`./c3-D0apG41V.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>q(()=>import(`./cadence-CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>q(()=>import(`./cairo-DLTphjLi.js`),__vite__mapDeps([21,22])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>q(()=>import(`./chapel-CFMD-Djs.js`),__vite__mapDeps([23,20,1])))},{id:`clarity`,name:`Clarity`,import:(()=>q(()=>import(`./clarity-CtfBBspg.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>q(()=>import(`./clojure-DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>q(()=>import(`./cmake-Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>q(()=>import(`./cobol-qSrRm_BU.js`),__vite__mapDeps([24,2,1,3,4,9])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>q(()=>import(`./codeowners-C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>q(()=>import(`./codeql-oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>q(()=>import(`./coffee-BP03ytLP.js`),__vite__mapDeps([25,3,1])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>q(()=>import(`./common-lisp-Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>q(()=>import(`./coq-DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>q(()=>import(`./cpp-CUBNVKxn.js`).then(e=>e.n),__vite__mapDeps([26,1,27,28,20])))},{id:`crystal`,name:`Crystal`,import:(()=>q(()=>import(`./crystal-CCpd0BXH.js`),__vite__mapDeps([29,3,1,4,2,17,20,30])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>q(()=>import(`./csharp-oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>q(()=>import(`./css-DlBQoFxe.js`).then(e=>e.n),__vite__mapDeps([4,1])))},{id:`csv`,name:`CSV`,import:(()=>q(()=>import(`./csv-Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>q(()=>import(`./cue-CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>q(()=>import(`./cypher-ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>q(()=>import(`./d-qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>q(()=>import(`./dart-CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>q(()=>import(`./dax-BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>q(()=>import(`./desktop-Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>q(()=>import(`./diff-woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>q(()=>import(`./docker-IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>q(()=>import(`./dotenv-_5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>q(()=>import(`./dream-maker-DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>q(()=>import(`./edge-k_uo0VIr.js`),__vite__mapDeps([31,2,1,3,4,12,16])))},{id:`elixir`,name:`Elixir`,import:(()=>q(()=>import(`./elixir-CJS91GrO.js`),__vite__mapDeps([32,2,1,3,4])))},{id:`elm`,name:`Elm`,import:(()=>q(()=>import(`./elm-Bmx6Fs0i.js`),__vite__mapDeps([33,28,1,20])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>q(()=>import(`./emacs-lisp-c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>q(()=>import(`./erb-yi0ZozmI.js`),__vite__mapDeps([34,2,1,3,4,35,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>q(()=>import(`./erlang-Cphh6RMH.js`),__vite__mapDeps([41,42])))},{id:`fennel`,name:`Fennel`,import:(()=>q(()=>import(`./fennel-DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>q(()=>import(`./fish-BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>q(()=>import(`./fluent-C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>q(()=>import(`./fortran-fixed-form-DEKoE2YW.js`),__vite__mapDeps([43,44])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>q(()=>import(`./fortran-free-form-CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>q(()=>import(`./fsharp-D13ZGOAj.js`),__vite__mapDeps([45,42])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>q(()=>import(`./gdresource-xMC7jr7x.js`),__vite__mapDeps([46,47,48])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>q(()=>import(`./gdscript-DYvRD3hg.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>q(()=>import(`./gdshader-CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>q(()=>import(`./genie-CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>q(()=>import(`./gherkin-DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>q(()=>import(`./git-commit-BSykSTBG.js`),__vite__mapDeps([49,50])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>q(()=>import(`./git-rebase-C-RR1FSc.js`),__vite__mapDeps([51,30,1])))},{id:`gleam`,name:`Gleam`,import:(()=>q(()=>import(`./gleam-CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>q(()=>import(`./glimmer-js-Di6EiJvU.js`),__vite__mapDeps([52,3,1,4,2,12])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>q(()=>import(`./glimmer-ts-C2P-EwIP.js`),__vite__mapDeps([53,3,1,4,2,12])))},{id:`glsl`,name:`GLSL`,import:(()=>q(()=>import(`./glsl-CyFpZtQv.js`).then(e=>e.n),__vite__mapDeps([28,1,20])))},{id:`gn`,name:`GN`,import:(()=>q(()=>import(`./gn-ilITqXS6.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>q(()=>import(`./gnuplot-7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>q(()=>import(`./go-rLFTqkRN.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>q(()=>import(`./graphql-BIyAKkG2.js`).then(e=>e.n),__vite__mapDeps([37,1,3,12,14,38])))},{id:`groovy`,name:`Groovy`,import:(()=>q(()=>import(`./groovy-CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>q(()=>import(`./hack-DDi4pUY-.js`),__vite__mapDeps([54,2,1,3,4,17])))},{id:`haml`,name:`Ruby Haml`,import:(()=>q(()=>import(`./haml-Dds4VdNJ.js`).then(e=>e.n),__vite__mapDeps([36,1,3,4])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>q(()=>import(`./handlebars-C81KA5yo.js`),__vite__mapDeps([55,3,1,4,2,40])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>q(()=>import(`./haskell-D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>q(()=>import(`./haxe-C8oCnwJJ.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>q(()=>import(`./hcl-Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>q(()=>import(`./hjson-CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>q(()=>import(`./hlsl-Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>q(()=>import(`./html-BsvMqTlf.js`).then(e=>e.n),__vite__mapDeps([2,1,3,4])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>q(()=>import(`./html-derivative-D9FvRNj4.js`),__vite__mapDeps([16,2,1,3,4])))},{id:`http`,name:`HTTP`,import:(()=>q(()=>import(`./http-c4_vT9ST.js`),__vite__mapDeps([56,8,1,9,10,30,37,3,12,14,38])))},{id:`hurl`,name:`Hurl`,import:(()=>q(()=>import(`./hurl-BqZA9I9Q.js`),__vite__mapDeps([57,8,1,9,58,37,3,12,14,38])))},{id:`hxml`,name:`HXML`,import:(()=>q(()=>import(`./hxml-Dcm88srW.js`),__vite__mapDeps([59,60])))},{id:`hy`,name:`Hy`,import:(()=>q(()=>import(`./hy-CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>q(()=>import(`./imba-DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>q(()=>import(`./ini-B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>q(()=>import(`./java-D7h0NA_A.js`).then(e=>e.n),__vite__mapDeps([9,1])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>q(()=>import(`./javascript-DcMHgNcu.js`).then(e=>e.n),__vite__mapDeps([3,1])))},{id:`jinja`,name:`Jinja`,import:(()=>q(()=>import(`./jinja-CixBDh_U.js`),__vite__mapDeps([61,2,1,3,4])))},{id:`jison`,name:`Jison`,import:(()=>q(()=>import(`./jison-Ru_S5AEn.js`),__vite__mapDeps([62,3,1])))},{id:`json`,name:`JSON`,import:(()=>q(()=>import(`./json-DePJdKYk.js`).then(e=>e.n),__vite__mapDeps([10,1])))},{id:`json5`,name:`JSON5`,import:(()=>q(()=>import(`./json5-BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>q(()=>import(`./jsonc-CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>q(()=>import(`./jsonl-CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>q(()=>import(`./jsonnet-CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>q(()=>import(`./jssm-DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>q(()=>import(`./jsx-BUUYi3qs.js`).then(e=>e.n),__vite__mapDeps([38,1])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>q(()=>import(`./julia-CaY0JZD0.js`),__vite__mapDeps([63,3,1,17,22,26,27,28,20,64])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>q(()=>import(`./just-Q4EdCjF5.js`),__vite__mapDeps([65,3,1,12,22,30,35,4,2,8,9,17,20,26,27,28,36,37,14,38,39,40,66])))},{id:`kdl`,name:`KDL`,import:(()=>q(()=>import(`./kdl-CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>q(()=>import(`./kotlin-DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>q(()=>import(`./kusto-C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>q(()=>import(`./latex-t1iljvl0.js`),__vite__mapDeps([67,68,1,64])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>q(()=>import(`./lean-CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>q(()=>import(`./less-DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>q(()=>import(`./liquid-DEL4RHa9.js`),__vite__mapDeps([69,3,1,4,2,10])))},{id:`llvm`,name:`LLVM IR`,import:(()=>q(()=>import(`./llvm-DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>q(()=>import(`./log-BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>q(()=>import(`./logo-Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>q(()=>import(`./lua-Z49wBRLR.js`).then(e=>e.n),__vite__mapDeps([39,1,20])))},{id:`luau`,name:`Luau`,import:(()=>q(()=>import(`./luau-C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>q(()=>import(`./make-Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>q(()=>import(`./markdown-BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>q(()=>import(`./marko-DYWPPmCl.js`),__vite__mapDeps([70,4,1,6,12,71])))},{id:`matlab`,name:`MATLAB`,import:(()=>q(()=>import(`./matlab-D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>q(()=>import(`./mdc-CsAWFGA9.js`),__vite__mapDeps([72,16,2,1,3,4,40,42])))},{id:`mdx`,name:`MDX`,import:(()=>q(()=>import(`./mdx-DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>q(()=>import(`./mermaid-BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>q(()=>import(`./mipsasm-BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>q(()=>import(`./mojo-fg40_ntQ.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>q(()=>import(`./moonbit-DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>q(()=>import(`./move-BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>q(()=>import(`./narrat-_X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>q(()=>import(`./nextflow-BJtWHP5T.js`),__vite__mapDeps([73,74])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>q(()=>import(`./nextflow-groovy-DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>q(()=>import(`./nginx-BrbrEdla.js`),__vite__mapDeps([75,39,1,20])))},{id:`nim`,name:`Nim`,import:(()=>q(()=>import(`./nim-BjwzhXka.js`),__vite__mapDeps([76,3,1,4,2,8,9,20,28,42])))},{id:`nix`,name:`Nix`,import:(()=>q(()=>import(`./nix-IvuFDN5E.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>q(()=>import(`./nsis-CjNLYCLg.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>q(()=>import(`./nushell-DHYfO66s.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>q(()=>import(`./objective-c-D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>q(()=>import(`./objective-cpp-BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>q(()=>import(`./ocaml-O90oeIOV.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>q(()=>import(`./odin-B1RWQWA5.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>q(()=>import(`./openscad-BUDT5pXO.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>q(()=>import(`./org-TFl3N09_.js`),__vite__mapDeps([77,3,1,4,2,6,9,8,10,12,14,17,20,22,78,25,27,26,28,30,79,80,50,81,32,39,40,35,36,37,38,42,41,49,51,82,83,84,64,66,67,68,71,85,76,86,87,88,89,90,91,92,93,94])))},{id:`pascal`,name:`Pascal`,import:(()=>q(()=>import(`./pascal-4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>q(()=>import(`./perl-BtArmf81.js`),__vite__mapDeps([66,3,1,4,2,8,9,17])))},{id:`php`,name:`PHP`,import:(()=>q(()=>import(`./php-Cx25uSIP.js`),__vite__mapDeps([88,3,1,4,2,8,9,10,17])))},{id:`pkl`,name:`Pkl`,import:(()=>q(()=>import(`./pkl-ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>q(()=>import(`./plsql-DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>q(()=>import(`./po-BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>q(()=>import(`./polar-C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>q(()=>import(`./postcss-BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>q(()=>import(`./powerquery-DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>q(()=>import(`./powershell-CCSX75yM.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>q(()=>import(`./prisma-DMgNhnYS.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>q(()=>import(`./prolog-iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>q(()=>import(`./proto-DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>q(()=>import(`./pug-B4bk2kWf.js`),__vite__mapDeps([95,3,1,4,2])))},{id:`puppet`,name:`Puppet`,import:(()=>q(()=>import(`./puppet-CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>q(()=>import(`./purescript-9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>q(()=>import(`./python-gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>q(()=>import(`./qml-g4UDed-8.js`),__vite__mapDeps([96,3,1])))},{id:`qmldir`,name:`QML Directory`,import:(()=>q(()=>import(`./qmldir-DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>q(()=>import(`./qss-Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>q(()=>import(`./r-CvCSiWB_.js`).then(e=>e.n),__vite__mapDeps([64,1])))},{id:`racket`,name:`Racket`,import:(()=>q(()=>import(`./racket-DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>q(()=>import(`./raku-B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>q(()=>import(`./razor-BSt2ayLr.js`),__vite__mapDeps([97,2,1,3,4,79])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>q(()=>import(`./rbs-C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>q(()=>import(`./reg-CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>q(()=>import(`./regexp-I2jnduhj.js`).then(e=>e.n),__vite__mapDeps([27,1])))},{id:`rel`,name:`Rel`,import:(()=>q(()=>import(`./rel-BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>q(()=>import(`./riscv-Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>q(()=>import(`./ron-VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>q(()=>import(`./rosmsg-CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>q(()=>import(`./rst-BucurtmO.js`),__vite__mapDeps([98,3,1,16,2,4,22,99,26,27,28,20,30,40,35,8,9,17,36,37,12,14,38,39])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>q(()=>import(`./ruby-D1ky9XZ0.js`),__vite__mapDeps([35,3,1,4,2,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>q(()=>import(`./rust-Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>q(()=>import(`./sas-CUQt684o.js`),__vite__mapDeps([100,17,1])))},{id:`sass`,name:`Sass`,import:(()=>q(()=>import(`./sass-DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>q(()=>import(`./scala-BiFt_7mu.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>q(()=>import(`./scheme-DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>q(()=>import(`./scss-BaZL6t2Y.js`).then(e=>e.n),__vite__mapDeps([6,1,4])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>q(()=>import(`./sdbl-bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>q(()=>import(`./shaderlab-TOUzSsQk.js`),__vite__mapDeps([101,102])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>q(()=>import(`./shellscript-B51zB43X.js`).then(e=>e.n),__vite__mapDeps([30,1])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>q(()=>import(`./shellsession-B-KBpmJs.js`),__vite__mapDeps([103,30,1])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>q(()=>import(`./smalltalk-BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>q(()=>import(`./smithy-Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>q(()=>import(`./solidity-Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>q(()=>import(`./soy-D5xCHD_M.js`),__vite__mapDeps([104,2,1,3,4])))},{id:`sparql`,name:`SPARQL`,import:(()=>q(()=>import(`./sparql-D_iOobhT.js`),__vite__mapDeps([105,106])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>q(()=>import(`./splunk-BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>q(()=>import(`./sql-DvarVTMJ.js`).then(e=>e.n),__vite__mapDeps([17,1])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>q(()=>import(`./ssh-config-BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>q(()=>import(`./stata-8TbiBYrm.js`),__vite__mapDeps([107,17,1])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>q(()=>import(`./stylus-B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>q(()=>import(`./surrealql-DalIYx4r.js`),__vite__mapDeps([108,3,1])))},{id:`svelte`,name:`Svelte`,import:(()=>q(()=>import(`./svelte-D4FIy7cP.js`),__vite__mapDeps([109,3,1,4,12,13])))},{id:`swift`,name:`Swift`,import:(()=>q(()=>import(`./swift-CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>q(()=>import(`./system-verilog-Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>q(()=>import(`./systemd-BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>q(()=>import(`./talonscript-CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>q(()=>import(`./tasl-DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>q(()=>import(`./tcl-CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>q(()=>import(`./templ-DP4lTcEq.js`),__vite__mapDeps([110,3,1,4,82])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>q(()=>import(`./terraform-DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>q(()=>import(`./tex-JPaUWOrn.js`).then(e=>e.n),__vite__mapDeps([68,1,64])))},{id:`toml`,name:`TOML`,import:(()=>q(()=>import(`./toml-CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>q(()=>import(`./ts-tags-CNUq3so9.js`),__vite__mapDeps([111,3,1,4,2,8,9,12,17,28,20])))},{id:`tsv`,name:`TSV`,import:(()=>q(()=>import(`./tsv-sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>q(()=>import(`./tsx-DvWhG4dC.js`).then(e=>e.n),__vite__mapDeps([14,1])))},{id:`turtle`,name:`Turtle`,import:(()=>q(()=>import(`./turtle-ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>q(()=>import(`./twig-Chu5fnNS.js`),__vite__mapDeps([112,3,1,4,6,22,35,2,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40,88,10])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>q(()=>import(`./typescript-BTGs5etX.js`).then(e=>e.n),__vite__mapDeps([12,1])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>q(()=>import(`./typespec-BRdr0IET.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>q(()=>import(`./typst--WwEKe8X.js`),__vite__mapDeps([113,3,1,4,2,6,9,8,10,12,14,114,115,17,20,22,78,25,27,26,28,30,79,80,50,81,32,39,40,35,36,37,38,42,41,45,49,51,82,83,55,84,116,64,63,66,67,68,71,117,85,86,88,89,90,91,92,94,118,95,119,120,112,121])))},{id:`v`,name:`V`,import:(()=>q(()=>import(`./v-DBj4K9d_.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>q(()=>import(`./vala-zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>q(()=>import(`./vb-DOwzaHZ0.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>q(()=>import(`./verilog-B2gwz-sJ.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>q(()=>import(`./vhdl-BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>q(()=>import(`./viml-DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>q(()=>import(`./vue-DjCn01CB.js`),__vite__mapDeps([122,3,1,4,2,10,12,16])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>q(()=>import(`./vue-html-BXjKVtKk.js`),__vite__mapDeps([123,3,1])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>q(()=>import(`./vue-vine-By_xyXdL.js`),__vite__mapDeps([124,3,1,4,6,13,71,125])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>q(()=>import(`./vyper-CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>q(()=>import(`./wasm-ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>q(()=>import(`./wenyan-C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>q(()=>import(`./wgsl-BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>q(()=>import(`./wikitext-ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>q(()=>import(`./wit-DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>q(()=>import(`./wolfram-DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>q(()=>import(`./xml-C01ajBW7.js`).then(e=>e.n),__vite__mapDeps([8,1,9])))},{id:`xsl`,name:`XSL`,import:(()=>q(()=>import(`./xsl-CCLNyvR3.js`),__vite__mapDeps([94,8,1,9])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>q(()=>import(`./yaml-BWCS3NLV.js`).then(e=>e.n),__vite__mapDeps([40,1])))},{id:`zenscript`,name:`ZenScript`,import:(()=>q(()=>import(`./zenscript-BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>q(()=>import(`./zig-CMLA9XwU.js`),[]))}],Xs=Object.fromEntries(Ys.map(e=>[e.id,e.import])),Zs=Object.fromEntries(Ys.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Qs={...Xs,...Zs},$s=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>q(()=>import(`./andromeeda-vGVdxbeo.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>q(()=>import(`./aurora-x-CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>q(()=>import(`./ayu-dark-DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>q(()=>import(`./ayu-light-C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>q(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>q(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>q(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>q(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>q(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>q(()=>import(`./dark-plus-Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>q(()=>import(`./dracula-BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>q(()=>import(`./dracula-soft-5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>q(()=>import(`./everforest-dark-sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>q(()=>import(`./everforest-light-Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>q(()=>import(`./github-dark-C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>q(()=>import(`./github-dark-default-DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>q(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>q(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>q(()=>import(`./github-light-EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>q(()=>import(`./github-light-default-BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>q(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>q(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>q(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>q(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>q(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>q(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>q(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>q(()=>import(`./horizon-CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>q(()=>import(`./horizon-bright-DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>q(()=>import(`./houston-CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>q(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>q(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>q(()=>import(`./kanagawa-wave-BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>q(()=>import(`./laserwave-C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>q(()=>import(`./light-plus-DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>q(()=>import(`./material-theme-Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>q(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>q(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>q(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>q(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>q(()=>import(`./min-dark-BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>q(()=>import(`./min-light-DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>q(()=>import(`./monokai-B_bV9PQ9.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>q(()=>import(`./night-owl-DhmEMT88.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>q(()=>import(`./night-owl-light-eJ-hLW7d.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>q(()=>import(`./nord-Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>q(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>q(()=>import(`./one-light-D7Lr4KcI.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>q(()=>import(`./plastic-DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>q(()=>import(`./poimandres-DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>q(()=>import(`./red-DX1BQOs8.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>q(()=>import(`./rose-pine-aMsaMD1D.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>q(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>q(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>q(()=>import(`./slack-dark-DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>q(()=>import(`./slack-ochin-B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>q(()=>import(`./snazzy-light-4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>q(()=>import(`./solarized-dark-UdsmMDCL.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>q(()=>import(`./solarized-light-C1IUL_tW.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>q(()=>import(`./synthwave-84-nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>q(()=>import(`./tokyo-night-oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>q(()=>import(`./vesper-DdrHHSXu.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>q(()=>import(`./vitesse-black-fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>q(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>q(()=>import(`./vitesse-light-VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),ec=t({createOnigurumaEngine:()=>Oc,getDefaultWasmLoader:()=>Dc,loadWasm:()=>xc,setDefaultWasmLoader:()=>Ec}),tc=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function nc(){return 2147483648}function rc(){return typeof performance<`u`?performance.now():Date.now()}var ic=(e,t)=>e+(t-e%t)%t;async function ac(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=nc();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,ic(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:rc,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var oc=Object.defineProperty,sc=(e,t,n)=>t in e?oc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cc=(e,t,n)=>sc(e,typeof t==`symbol`?t:t+``,n),lc=null;function uc(e){throw new tc(e.UTF8ToString(e.getLastOnigError()))}var dc=class e{constructor(t){cc(this,`utf16Length`),cc(this,`utf8Length`),cc(this,`utf16Value`),cc(this,`utf8Value`),cc(this,`utf16OffsetToUtf8`),cc(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},fc=class e{constructor(t){if(cc(this,`id`,++e.LAST_ID),cc(this,`_onigBinding`),cc(this,`content`),cc(this,`utf16Length`),cc(this,`utf8Length`),cc(this,`utf16OffsetToUtf8`),cc(this,`utf8OffsetToUtf16`),cc(this,`ptr`),!lc)throw new tc(`Must invoke loadWasm first.`);this._onigBinding=lc,this.content=t;let n=new dc(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=lc.omalloc(1e4),e._sharedPtrInUse=!0,lc.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(lc)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};cc(fc,`LAST_ID`,0),cc(fc,`_sharedPtr`,0),cc(fc,`_sharedPtrInUse`,!1);var pc=fc,mc=class{constructor(e){if(cc(this,`_onigBinding`),cc(this,`_ptr`),!lc)throw new tc(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new dc(e[r]);t[r]=i.createString(lc),n[r]=i.utf8Length}let r=lc.omalloc(4*e.length);lc.HEAPU32.set(t,r/4);let i=lc.omalloc(4*e.length);lc.HEAPU32.set(n,i/4);let a=lc.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)lc.ofree(t[n]);lc.ofree(i),lc.ofree(r),a===0&&uc(lc),this._onigBinding=lc,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new pc(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function hc(e){return typeof e.instantiator==`function`}function gc(e){return typeof e.default==`function`}function _c(e){return e.data!==void 0}function vc(e){return typeof Response<`u`&&e instanceof Response}function yc(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var bc;function xc(e){if(bc)return bc;async function t(){lc=await ac(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),hc(n)?n=await n.instantiator(t):gc(n)?n=await n.default(t):(_c(n)&&(n=n.data),vc(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Cc(n)(t):await wc(n)(t):yc(n)||n instanceof WebAssembly.Module?n=await Sc(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Sc(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return bc=t(),bc}function Sc(e){return t=>WebAssembly.instantiate(e,t)}function Cc(e){return t=>WebAssembly.instantiateStreaming(e,t)}function wc(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Tc;function Ec(e){Tc=e}function Dc(){return Tc}async function Oc(e){return e&&await xc(e),{createScanner(e){return new mc(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new pc(e)}}}var kc=Hs({});Ws(kc,ec);var Ac=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function jc(e){return Mc(e)}function Mc(e){return Array.isArray(e)?Nc(e):e instanceof RegExp?e:typeof e==`object`?Pc(e):e}function Nc(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Mc(e[n]);return t}function Pc(e){let t={};for(let n in e)t[n]=Mc(e[n]);return t}function Fc(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Ic(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Ic(e.substring(0,e.length-1)):e.substr(~t+1)}var Lc=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Rc=class{static hasCaptures(e){return e!==null&&(Lc.lastIndex=0,Lc.test(e))}static replaceCaptures(e,t,n){return e.replace(Lc,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function zc(e,t){return e<t?-1:+(e>t)}function Bc(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=zc(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Vc(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Hc(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Uc=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Wc=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Yc(e),t)}static createFromParsedTheme(e,t){return Qc(e,t)}_cachedMatchRoot=new Uc(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Kc(e.parent,t.parentScopes));return n?new Jc(n.fontStyle,n.foreground,n.background):null}},Gc=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Kc(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!qc(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function qc(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Jc=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Yc(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&Vc(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Vc(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Xc(l,u,e,o,s,c)}}return n}var Xc=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},Zc=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(Zc||{});function Qc(e,t){e.sort((e,t)=>{let n=zc(e.scope,t.scope);return n!==0||(n=Bc(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new $c(t),o=new Jc(n,a.getId(r),a.getId(i)),s=new nl(new tl(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Wc(a,o,s)}var $c=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},el=Object.freeze([]),tl=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||el,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},nl=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),tl.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Bc(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new tl(e,t,n,r,i))}},rl=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=al(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function il(e){return e}function al(e){return e}function ol(e,t){let n=[],r=cl(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(sl(i)){let e=[];do e.push(i),i=r.next();while(sl(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function sl(e){return!!e&&!!e.match(/[\w\.:]+/)}function cl(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function ll(e){typeof e.dispose==`function`&&e.dispose()}var ul=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},dl=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},fl=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},pl=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new ul(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new fl;for(let n of e)ml(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof ul){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function ml(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof ul?gl({baseGrammar:a,selfGrammar:i},r):hl(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new ul(e))}function hl(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];_l([r],t,n)}}function gl(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&_l(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&_l(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function _l(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Fc({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&_l(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=Cl(i);switch(a.kind){case 0:gl({...t,selfGrammar:t.baseGrammar},n);break;case 1:gl(t,n);break;case 2:hl(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?hl(a.ruleName,i,n):gl(i,n)}else a.kind===4?n.add(new dl(a.scopeName,a.ruleName)):n.add(new ul(a.scopeName))}}}var vl=class{kind=0},yl=class{kind=1},bl=class{constructor(e){this.ruleName=e}kind=2},xl=class{constructor(e){this.scopeName=e}kind=3},Sl=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Cl(e){if(e===`$base`)return new vl;if(e===`$self`)return new yl;let t=e.indexOf(`#`);return t===-1?new xl(e):t===0?new bl(e.substring(1)):new Sl(e.substring(0,t),e.substring(t+1))}var wl=/\\(\d+)/,Tl=/\\(\d+)/g,El=-1,Dl=-2;function Ol(e){return e}function kl(e){return e}var Al=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Rc.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Rc.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Ic(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Rc.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Rc.replaceCaptures(this._contentName,e,t)}},jl=class extends Al{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},Ml=class extends Al{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Ll(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Rl,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Nl=class extends Al{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Rl,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Pl=class extends Al{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new Ll(i,this.id),this.beginCaptures=a,this._end=new Ll(o||`￿`,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Rl;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Fl=class extends Al{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new Ll(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new Ll(o,Dl),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Rl;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Rl,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},Il=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new jl(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new Ml(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Fc({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Nl(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Fl(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Pl(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=Cl(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Nl||e instanceof Pl||e instanceof Fl)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Ll=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&wl.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return Tl.lastIndex=0,this.source.replace(Tl,(e,t)=>Hc(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=`￿`,t[i+1]=`￿`,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=`￿`,t[i+1]=`G`,n[i+1]=`￿`,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Rl=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new zl(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new zl(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},zl=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
11
- `)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Bl=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Vl=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Bl(e,8),this._embeddedLanguagesMatcher=new Hl(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Bl(0,0);_getBasicScopeAttributes=new Uc(e=>new Bl(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Hl=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Hc(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Ul=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Wl(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Gl(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Ul(i,!0);f()}return new Ul(i,!1);function f(){let o=Kl(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===El){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Zl(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Pl){let r=o;Zl(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof Fl){let r=o;Zl(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Zl(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Gl(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof Fl&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Xl(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Dl){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Zl(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Kl(e,t,n,r,i,a){let o=ql(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Jl(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function ql(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Yl(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Jl(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Yl(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Yl(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Xl(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Zl(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Wl(e,p,n&&d.start===0,d.start,f,i,!1,0),ll(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Ql(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Ql=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function $l(e,t,n,r,i,a,o,s){return new ru(e,t,n,r,i,a,o,s)}function eu(e,t,n,r,i){let a=ol(t,tu),o=Il.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function tu(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(nu(t[r],e))return n=r+1,!0;return!1})}function nu(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var ru=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Vl(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=iu(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=ol(e,tu);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)eu(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&eu(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(Ol(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[kl(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=iu(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Il.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===ou.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=rl.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?au.createRootAndLookUpScopeName(a,r,this):au.createRoot(`unknown`,r),t=new ou(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
12
- `;let a=this.createOnigString(e),o=a.content.length,s=new cu(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Wl(this,a,i,0,t,s,!0,r);return ll(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function iu(e,t){return e=jc(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var au=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Gc.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Gc(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Gc(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),rl.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},ou=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?au.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:kl(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=au.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Ol(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,au.fromExtension(r,n.contentNameScopesList))}},su=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):ol(e,tu).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>ol(e,tu).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},cu=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=rl.set(n,0,il(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=rl.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},lu=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,$l(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},uu=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new lu(Wc.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Wc.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new su(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new pl(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},du=ou.NULL;function fu(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function pu(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function mu(e){return Array.isArray(e)?e:[e]}async function hu(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function gu(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function _u(e){return e===`ansi`||gu(e)}function vu(e){return e===`none`}function yu(e){return vu(e)}var bu=/(\r?\n)/g;function xu(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(bu),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var Su={light:`#333333`,dark:`#bbbbbb`},Cu={light:`#fffffe`,dark:`#1e1e1e`},wu=`__shiki_resolved`;function Tu(e){if(e?.[wu])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?Su.light:Su.dark,n||=t.type===`light`?Cu.light:Cu.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,wu,{enumerable:!1,writable:!1,value:!0}),t}async function Eu(e){return[...new Set((await Promise.all(e.filter(e=>!_u(e)).map(async e=>await hu(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function Du(e){return(await Promise.all(e.map(async e=>yu(e)?null:Tu(await hu(e))))).filter(e=>!!e)}function Ou(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Ac(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var ku=class extends uu{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=Tu(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Wc.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Ou(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new Ac(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},Au=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},ju=0;function Mu(e){ju+=1,e.warnings!==!1&&ju>=10&&ju%10==0&&console.warn(`[Shiki] ${ju} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Ac("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Tu),i=new ku(new Au(e.engine,n),r,n,e.langAlias),a;function o(t){return Ou(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Ac(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new Ac(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await Eu(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await Du(e))}function g(){if(t)throw new Ac(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--ju)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function Nu(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([Du(e.themes||[]),Eu(e.langs||[]),e.engine]);return Mu({...e,themes:t,langs:n,engine:r})}var Pu=new WeakMap;function Fu(e,t){Pu.set(e,t)}function Iu(e){return Pu.get(e)}var Lu=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(mu(n).map(e=>[e,du])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Ru(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Ru(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function zu(e,t){if(!(e instanceof Lu))throw new Ac(`Invalid grammar state`);return e.getInternalStack(t)}var Bu=/,/,Vu=/ /;function Hu(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(gu(e.resolveLangAlias(n.lang||`text`))||vu(r))return xu(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new Ac(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Ac(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Wu(t,o,i,a,n)}function Uu(...e){if(e.length===2)return Iu(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(gu(i)||vu(a))throw new Ac(`Plain language does not have grammar state`);if(i===`ansi`)throw new Ac(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new Lu(Gu(n,c,o,s,r).stateStack,c.name,o.name)}function Wu(e,t,n,r,i){let a=Gu(e,t,n,r,i),o=new Lu(a.stateStack,t.name,n.name);return Fu(a.tokens,o),a.tokens}function Gu(e,t,n,r,i){let a=fu(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=xu(e),u=i.grammarState?zu(i.grammarState,n.name)??du:i.grammarContextCode==null?du:Gu(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=pu(r[rl.getForeground(s)],a),u=rl.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=rl.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(Bu).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Vu))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?Ku(t.scopes):qu(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function Ku(e){return e.map(e=>({scopeName:e}))}function qu(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Xu(e,i,t.slice(0,r))}}return n}function Ju(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function Yu(e,t,n){if(!Ju(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Ju(e[r],n[i])&&--r,--i;return r===-1}function Xu(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Yu(e,t,n)){r.push(a);break}return r}function Zu(e,t,n,r=Hu){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:Iu(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Qu(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new Lu(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&Fu(s,c),s}function Qu(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var $u=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],ed=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ed.prototype.normal={},ed.prototype.property={},ed.prototype.space=void 0;function td(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new ed(n,r,t)}function nd(e){return e.toLowerCase()}var rd=class{constructor(e,t){this.attribute=t,this.property=e}};rd.prototype.attribute=``,rd.prototype.booleanish=!1,rd.prototype.boolean=!1,rd.prototype.commaOrSpaceSeparated=!1,rd.prototype.commaSeparated=!1,rd.prototype.defined=!1,rd.prototype.mustUseProperty=!1,rd.prototype.number=!1,rd.prototype.overloadedBoolean=!1,rd.prototype.property=``,rd.prototype.spaceSeparated=!1,rd.prototype.space=void 0;var id=t({boolean:()=>od,booleanish:()=>sd,commaOrSpaceSeparated:()=>dd,commaSeparated:()=>ud,number:()=>J,overloadedBoolean:()=>cd,spaceSeparated:()=>ld}),ad=0,od=fd(),sd=fd(),cd=fd(),J=fd(),ld=fd(),ud=fd(),dd=fd();function fd(){return 2**++ad}var pd=Object.keys(id),md=class extends rd{constructor(e,t,n,r){let i=-1;if(super(e,t),hd(this,`space`,r),typeof n==`number`)for(;++i<pd.length;){let e=pd[i];hd(this,pd[i],(n&id[e])===id[e])}}};md.prototype.defined=!0;function hd(e,t,n){n&&(e[t]=n)}function gd(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new md(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[nd(r)]=r,n[nd(a.attribute)]=r}return new ed(t,n,e.space)}var _d=gd({properties:{ariaActiveDescendant:null,ariaAtomic:sd,ariaAutoComplete:null,ariaBusy:sd,ariaChecked:sd,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:ld,ariaCurrent:null,ariaDescribedBy:ld,ariaDetails:null,ariaDisabled:sd,ariaDropEffect:ld,ariaErrorMessage:null,ariaExpanded:sd,ariaFlowTo:ld,ariaGrabbed:sd,ariaHasPopup:null,ariaHidden:sd,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ld,ariaLevel:J,ariaLive:null,ariaModal:sd,ariaMultiLine:sd,ariaMultiSelectable:sd,ariaOrientation:null,ariaOwns:ld,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:sd,ariaReadOnly:sd,ariaRelevant:null,ariaRequired:sd,ariaRoleDescription:ld,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:sd,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function vd(e,t){return t in e?e[t]:t}function yd(e,t){return vd(e,t.toLowerCase())}var bd=gd({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:ud,acceptCharset:ld,accessKey:ld,action:null,allow:null,allowFullScreen:od,allowPaymentRequest:od,allowUserMedia:od,alpha:od,alt:null,as:null,async:od,autoCapitalize:null,autoComplete:ld,autoFocus:od,autoPlay:od,blocking:ld,capture:null,charSet:null,checked:od,cite:null,className:ld,closedBy:null,colorSpace:null,cols:J,colSpan:J,command:null,commandFor:null,content:null,contentEditable:sd,controls:od,controlsList:ld,coords:J|ud,crossOrigin:null,data:null,dateTime:null,decoding:null,default:od,defer:od,dir:null,dirName:null,disabled:od,download:cd,draggable:sd,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:od,formTarget:null,headers:ld,height:J,hidden:cd,high:J,href:null,hrefLang:null,htmlFor:ld,httpEquiv:ld,id:null,imageSizes:null,imageSrcSet:null,inert:od,inputMode:null,integrity:null,is:null,isMap:od,itemId:null,itemProp:ld,itemRef:ld,itemScope:od,itemType:ld,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:od,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:od,muted:od,name:null,nonce:null,noModule:od,noValidate:od,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:od,optimum:J,pattern:null,ping:ld,placeholder:null,playsInline:od,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:od,referrerPolicy:null,rel:ld,required:od,reversed:od,rows:J,rowSpan:J,sandbox:ld,scope:null,scoped:od,seamless:od,selected:od,shadowRootClonable:od,shadowRootCustomElementRegistry:od,shadowRootDelegatesFocus:od,shadowRootMode:null,shadowRootSerializable:od,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:sd,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:od,useMap:null,value:sd,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ld,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:od,declare:od,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:od,noHref:od,noShade:od,noWrap:od,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:sd,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:od,disablePictureInPicture:od,disableRemotePlayback:od,exportParts:ud,part:ld,prefix:null,property:null,results:J,security:null,unselectable:null},space:`html`,transform:yd}),xd=gd({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:dd,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:ld,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:od,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ud,g2:ud,glyphName:ud,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:dd,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ld,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:dd,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:dd,rev:dd,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:dd,requiredFeatures:dd,requiredFonts:dd,requiredFormats:dd,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:dd,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:dd,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:dd,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:vd}),Sd=gd({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Cd=gd({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:yd}),wd=gd({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Td={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Ed=/[A-Z]/g,Dd=/-[a-z]/g,Od=/^data[-\w.:]+$/i;function kd(e,t){let n=nd(t),r=t,i=rd;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Od.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Dd,jd);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Dd.test(e)){let n=e.replace(Ed,Ad);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=md}return new i(r,t)}function Ad(e){return`-`+e.toLowerCase()}function jd(e){return e.charAt(1).toUpperCase()}var Md=td([_d,bd,Sd,Cd,wd],`html`),Nd=td([_d,xd,Sd,Cd,wd],`svg`),Pd={}.hasOwnProperty;function Fd(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Pd.call(t,e)){let n=String(t[e]);i=Pd.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var Id=/["&'<>`]/g,Ld=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Rd=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,zd=/[|\\{}()[\]^$+*?.]/g,Bd=new WeakMap;function Vd(e,t){if(e=e.replace(t.subset?Hd(t.subset):Id,r),t.subset||t.escapeOnly)return e;return e.replace(Ld,n).replace(Rd,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function Hd(e){let t=Bd.get(e);return t||(t=Ud(e),Bd.set(e,t)),t}function Ud(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(zd,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Wd=/[\dA-Fa-f]/;function Gd(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Wd.test(String.fromCharCode(t))?r:r+`;`}var Kd=/\d/;function qd(e,t,n){let r=`&#`+String(e);return n&&t&&!Kd.test(String.fromCharCode(t))?r:r+`;`}var Jd=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),Yd={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},Xd=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Zd={}.hasOwnProperty,Qd={},$d;for($d in Yd)Zd.call(Yd,$d)&&(Qd[Yd[$d]]=$d);var ef=/[^\dA-Za-z]/;function tf(e,t,n,r){let i=String.fromCharCode(e);if(Zd.call(Qd,i)){let e=Qd[i],a=`&`+e;return n&&Jd.includes(e)&&!Xd.includes(e)&&(!r||t&&t!==61&&ef.test(String.fromCharCode(t)))?a:a+`;`}return``}function nf(e,t,n){let r=Gd(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=tf(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=qd(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function rf(e,t){return Vd(e,Object.assign({format:nf},t))}var af=/^>|^->|<!--|-->|--!>|<!-$/g,of=[`>`],sf=[`<`,`>`];function cf(e,t,n,r){return r.settings.bogusComments?`<?`+rf(e.value,Object.assign({},r.settings.characterReferences,{subset:of}))+`>`:`<!--`+e.value.replace(af,i)+`-->`;function i(e){return rf(e,Object.assign({},r.settings.characterReferences,{subset:sf}))}}function lf(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function uf(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function df(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function ff(e){return e.join(` `).trim()}var pf=/[ \t\n\f\r]/g;function mf(e){return typeof e==`object`?e.type===`text`&&hf(e.value):hf(e)}function hf(e){return e.replace(pf,``)===``}var gf=yf(1),_f=yf(-1),vf=[];function yf(e){return t;function t(t,n,r){let i=t?t.children:vf,a=(n||0)+e,o=i[a];if(!r)for(;o&&mf(o);)a+=e,o=i[a];return o}}var bf={}.hasOwnProperty;function xf(e){return t;function t(t,n,r){return bf.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Sf=xf({body:Tf,caption:Cf,colgroup:Cf,dd:kf,dt:Of,head:Cf,html:wf,li:Df,optgroup:jf,option:Mf,p:Ef,rp:Af,rt:Af,tbody:Pf,td:Lf,tfoot:Ff,th:Lf,thead:Nf,tr:If});function Cf(e,t,n){let r=gf(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&mf(r.value.charAt(0)))}function wf(e,t,n){let r=gf(n,t);return!r||r.type!==`comment`}function Tf(e,t,n){let r=gf(n,t);return!r||r.type!==`comment`}function Ef(e,t,n){let r=gf(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function Df(e,t,n){let r=gf(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Of(e,t,n){let r=gf(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function kf(e,t,n){let r=gf(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function Af(e,t,n){let r=gf(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function jf(e,t,n){let r=gf(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Mf(e,t,n){let r=gf(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Nf(e,t,n){let r=gf(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Pf(e,t,n){let r=gf(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Ff(e,t,n){return!gf(n,t)}function If(e,t,n){let r=gf(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function Lf(e,t,n){let r=gf(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var Rf=xf({body:Vf,colgroup:Hf,head:Bf,html:zf,tbody:Uf});function zf(e){let t=gf(e,-1);return!t||t.type!==`comment`}function Bf(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function Vf(e){let t=gf(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&mf(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function Hf(e,t,n){let r=_f(n,t),i=gf(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Sf(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Uf(e,t,n){let r=_f(n,t),i=gf(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Sf(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Wf={name:[[`
13
- \f\r &/=>`.split(``),`
14
- \f\r "&'/=>\``.split(``)],[`\0
15
- \f\r "&'/<=>`.split(``),`\0
16
- \f\r "&'/<=>\``.split(``)]],unquoted:[[`
17
- \f\r &>`.split(``),`\0
18
- \f\r "&'<=>\``.split(``)],[`\0
19
- \f\r "&'<=>\``.split(``),`\0
20
- \f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Gf(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Nd);let l=Kf(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!Rf(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!Sf(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function Kf(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=qf(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function qf(e,t,n){let r=kd(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=rf(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Wf.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?df:ff)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=rf(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Wf.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&uf(n,o)>uf(n,e.alternative)&&(o=e.alternative),s=o+rf(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Wf.single:Wf.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Jf=[`<`,`&`];function Yf(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:rf(e.value,Object.assign({},r.settings.characterReferences,{subset:Jf}))}function Xf(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Yf(e,t,n,r)}function Zf(e,t,n,r){return r.all(e)}var Qf=Fd(`type`,{invalid:$f,unknown:ep,handlers:{comment:cf,doctype:lf,element:Gf,raw:Xf,root:Zf,text:Yf}});function $f(e){throw Error("Expected node, not `"+e+"`")}function ep(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var tp={},np={},rp=[];function ip(e,t){let n=t||tp,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:ap,all:op,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||$u,characterReferences:n.characterReferences||np,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Nd:Md,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function ap(e,t,n){return Qf(e,t,n,this)}function op(e){let t=[],n=e&&e.children||rp,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var sp=/\s+/g;function cp(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(sp)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(sp);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var lp=/:?lang=["']([^"']+)["']/g,up=/(?:```|~~~)([\w-]+)/g,dp=/\\begin\{([\w-]+)\}/g,fp=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,pp=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function mp(e){let t=xu(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function hp(e,t,n){let r=new Set;for(let t of e.matchAll(lp)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(up)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(dp)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(fp)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(pp.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var gp=[`color`,`background-color`];function _p(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function vp(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function yp(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=vp(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return _p(e,a)})):e}function bp(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>xp(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&gp.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new Ac('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function xp(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&Zc.Italic&&(t[`font-style`]=`italic`),e.fontStyle&Zc.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&Zc.Underline&&n.push(`underline`),e.fontStyle&Zc.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function Sp(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function Cp(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=mp(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new Ac(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new Ac(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new Ac(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));wp(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return yp(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new Ac(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=Tp(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new Ac(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new Ac(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&cp(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function wp(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new Ac(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new Ac(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function Tp(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(Tp).join(``):``}var Ep=[Cp()];function Dp(e){let t=Op(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Ep]}function Op(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var kp=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],Ap={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function jp(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function Mp(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function Np(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)Ap[r]&&t.push({type:`setDecoration`,value:Ap[r]});else if(r<=29){let e=Ap[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:kp[r-30]}});else if(r===38){let n=Mp(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:kp[r-40]}});else if(r===48){let n=Mp(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:kp[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:kp[r-100+8]}})}}return t}function Pp(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=jp(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=Np(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var Fp={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function Ip(e=Fp){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<kp.length;e++)r.push(t(kp[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var Lp=/#([0-9a-f]{3,8})/i,Rp=/var\((--[\w-]+-ansi-[\w-]+)\)/,zp={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function Bp(e,t,n){let r=fu(e,n),i=xu(t),a=Ip(Object.fromEntries(kp.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||zp[t]]}))),o=Pp();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=pu(i,r),o=pu(o,r),n.decorations.has(`dim`)&&(i=Vp(i));let s=Zc.None;return n.decorations.has(`bold`)&&(s|=Zc.Bold),n.decorations.has(`italic`)&&(s|=Zc.Italic),n.decorations.has(`underline`)&&(s|=Zc.Underline),n.decorations.has(`strikethrough`)&&(s|=Zc.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function Vp(e){let t=e.match(Lp);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(Rp);return n?`var(${n[1]}-dim)`:e}function Hp(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!gu(r)&&!vu(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return Bp(r,t,n)}return Hu(e,t,n)}function Up(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new Ac("`themes` option must not be empty");let p=Zu(e,t,n,Hp);if(c=Iu(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new Ac(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>bp(e,h,u,l,d))),c&&Fu(a,c);let g=f.map(e=>fu(e.theme,n));i=Wp(f,m,g,u,l,`fg`,d),r=Wp(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=fu(n.theme,n);a=Hp(e,t,n);let l=e.getTheme(n.theme);r=pu(l.bg,s),i=pu(l.fg,s),o=l.name,c=Iu(a)}else throw new Ac("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function Wp(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=pu(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new Ac('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${pu(t[r][a],n[r])||`inherit`}, ${pu(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var Gp=/^\s+$/,eee=/^(\s*)(.*?)(\s*)$/;function Kp(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Kp(e,t,n),codeToTokens:(t,n)=>Up(e,t,n)}){let i=t;for(let e of Dp(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=Up(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Jp(a):d===`never`&&(a=Yp(a)),f&&(a=Xp(a));let p={...r,get source(){return i}};for(let e of Dp(n))a=e.tokens?.call(p,a)||a;return qp(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function qp(e,t,n,r=Iu(e)){let i=Dp(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:cp,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
21
- `}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=Sp(a.htmlStyle||xp(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&Fu(m,r),m}function Jp(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&Zc.Underline||i.fontStyle&Zc.Strikethrough));o&&Gp.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Yp(e){return e.map(e=>e.flatMap(e=>{if(Gp.test(e.content))return e;let t=e.content.match(eee);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function Xp(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=Sp(e.htmlStyle||xp(e)),i=Sp(n.htmlStyle||xp(n)),a=e.fontStyle&&(e.fontStyle&Zc.Underline||e.fontStyle&Zc.Strikethrough),o=n.fontStyle&&(n.fontStyle&Zc.Underline||n.fontStyle&Zc.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Zp=ip;function tee(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Kp(e,t,n),codeToTokens:(t,n)=>Up(e,t,n)},i=Zp(Kp(e,t,n,r));for(let e of Dp(n))i=e.postprocess?.call(r,i,n)||i;return i}async function nee(e){let t=await Nu(e);return{getLastGrammarState:(...e)=>Uu(t,...e),codeToTokensBase:(e,n)=>Hp(t,e,n),codeToTokensWithThemes:(e,n)=>Zu(t,e,n),codeToTokens:(e,n)=>Up(t,e,n),codeToHast:(e,n)=>Kp(t,e,n),codeToHtml:(e,n)=>tee(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function ree(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,_u(n))return[];let r=t[n];if(!r)throw new Ac(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(yu(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new Ac(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await nee({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function iee(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function aee(e,t){let n=iee(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var Qp=ree({langs:Qs,themes:$s,engine:()=>(0,kc.createOnigurumaEngine)(q(()=>import(`./wasm-BnjxR4X6.js`),[]))}),{codeToHtml:oee,codeToHast:see,codeToTokens:cee,codeToTokensBase:lee,codeToTokensWithThemes:uee,getSingletonHighlighter:dee,getLastGrammarState:fee}=aee(Qp,{guessEmbeddedLanguages:hp}),$p=4294967295,em=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:$p,end:$p,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function tm(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function nm(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var rm=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),im=String.raw;function am(e,t){if(e==null)throw Error(t??`Value expected`);return e}var om=im`\[\^?`,sm=`c.? | C(?:-.?)?|${im`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${im`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${im`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${im`o\{[^\}]*\}?`}|${im`\d{1,3}`}`,cm=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,lm=new RegExp(im`
22
- \\ (?:
23
- ${sm}
24
- | [gk]<[^>]*>?
25
- | [gk]'[^']*'?
26
- | .
27
- )
28
- | \( (?:
29
- \? (?:
30
- [:=!>({]
31
- | <[=!]
32
- | <[^>]*>
33
- | '[^']*'
34
- | ~\|?
35
- | #(?:[^)\\]|\\.?)*
36
- | [^:)]*[:)]
37
- )?
38
- | \*[^\)]*\)?
39
- )?
40
- | (?:${cm.source})+
41
- | ${om}
42
- | .
43
- `.replace(/\s+/g,``),`gsu`),um=new RegExp(im`
44
- \\ (?:
45
- ${sm}
46
- | .
47
- )
48
- | \[:(?:\^?\p{Alpha}+|\^):\]
49
- | ${om}
50
- | &&
51
- | .
52
- `.replace(/\s+/g,``),`gsu`);function pee(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=Im(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(lm.lastIndex=0;s=lm.exec(e);){let t=mee(a,e,s[0],lm.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(lm.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?Rm(e,u):e).flat(),flags:r}}function mee(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=hee(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:fm(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Em(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:pm(n)}}if(a===`K`)return{token:bm(`keep`,n)};if(a===`N`||a===`R`)return{token:ym(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:ym(`any`,n)};if(a===`X`)return{token:ym(`text_segment`,n)};let e=dm(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:jm(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Am(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:Cm(`group`,n)};if(n===`(?>`)return{token:Cm(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:Cm(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:Cm(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:Cm(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:Sm(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
53
- `,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:ym(`dot`,n)}:n===`^`||n===`$`?{token:fm(e.singleline?{"^":im`\A`,$:im`\Z`}[n]:n,n)}:n===`|`?{token:_ee(n)}:cm.test(n)?{tokens:zm(n)}:{token:mm(tm(n),n)}}function hee(e,t,n){let r=[vm(t[1]===`^`,t)],i=1,a;for(um.lastIndex=n;a=um.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(vm(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(mm(93,e));else if(i--,r.push(hm(e)),!i)break}else{let t=gee(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:um.lastIndex||e.length}}function gee(e){if(e[0]===`\\`)return dm(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!rm.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return ym(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?gm(e):e===`&&`?_m(e):mm(tm(e),e)}function dm(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return km(e);if(`dDhHsSwW`.includes(n))return Nm(e);if(e.startsWith(im`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return Pm(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return mm(tm(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return mm(Lm(e),e);if(Om.has(n))return mm(Om.get(n),e);if(/\d/.test(n))return xm(t,e);if(e===`\\`)throw Error(im`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return mm(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function _ee(e){return{type:`Alternator`,raw:e}}function fm(e,t){return{type:`Assertion`,kind:e,raw:t}}function pm(e){return{type:`Backreference`,raw:e}}function mm(e,t){return{type:`Character`,value:e,raw:t}}function hm(e){return{type:`CharacterClassClose`,raw:e}}function gm(e){return{type:`CharacterClassHyphen`,raw:e}}function _m(e){return{type:`CharacterClassIntersector`,raw:e}}function vm(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function ym(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function bm(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:am(n.flags),raw:t}}function xm(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function Sm(e){return{type:`GroupClose`,raw:e}}function Cm(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function wm(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function Tm(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function Em(e){return{type:`Subroutine`,raw:e}}var Dm=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),Om=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function km(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return mm(tm(t.toUpperCase())-64,e)}function Am(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=Fm(n),o=Fm(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),bm(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,Cm(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function jm(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=Dm.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return wm(l,r??null,i?.split(`,`)??null,e)}function Mm(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return Tm(t,n,r,e)}function Nm(e){let t=e[1].toLowerCase();return ym({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function Pm(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return ym(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function Fm(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function Im(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function Lm(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function Rm(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[pm(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(im`Octal encoded byte above 177 unsupported "${n}"`)}else r=tm(t);a.push(mm(r,(e===0?`\\`:``)+t))}return a}function zm(e){let t=[],n=new RegExp(cm,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(Mm(e.slice(0,-1)));continue}}}t.push(Mm(e))}return t}function Bm(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function Vm(e){return Hm.has(e.type)}var Hm=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function Um(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=pee(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return $m();case`Assertion`:return Wm(n);case`Backreference`:return Gm(n,a);case`Character`:return rh(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Km(n,a,t);case`CharacterClassOpen`:return qm(n,a,t);case`CharacterSet`:return Jm(n,a);case`Directive`:return yee(n.kind,{flags:n.flags});case`GroupOpen`:return Ym(n,a,t);case`NamedCallout`:return xee(n.kind,n.tag,n.arguments);case`Quantifier`:return Xm(n,a);case`Subroutine`:return Zm(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=Cee(bee(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(im`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(im`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function Wm({kind:e}){return eh(am({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===im`\B`||e===im`\Y`})}function Gm({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,th(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return th(r)}return i(+r)}function Km(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),vee(o,e);throw Error(`Invalid character class range`)}return rh(tm(`-`))}function qm({negate:e},t,n){let{tokens:r,walk:i}=t,a=[ih()],o=r[t.nextIndex],s=vh(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(ih()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=vh(r[t.nextIndex],o)}let c=ih({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function Jm({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=_h(n);if(rm.has(r)&&!o?.has(r))e=`posix`,n=r;else return uh(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?See(n,{negate:t}):ah(e,{negate:t})}function Ym(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=wee(e),l=c.type===`AbsenceFunction`,u=mh(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&nm(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=yh(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push($m()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(ph(t)||t.type===`CapturingGroup`)throw Error(e)}else if(ph(t)||mh(t)&&t.negate)throw Error(e)}}f=yh(r[t.nextIndex])}return t.nextIndex++,c}function Xm({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!Vm(a))throw Error(`Quantifier requires a repeatable token`);let o=ch(e,t,n,a);return i.body.pop(),o}function Zm({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=lh(i);return r.push(o),o}function Qm(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:dh(t?.body)}}function $m(e){return{type:`Alternative`,body:fh(e?.body)}}function eh(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function th(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function nh(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!hh(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:dh(t?.body)}}function rh(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function ih(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:fh(e?.body)}}function vee(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function ah(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function yee(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:am(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function bee(e){return{type:`Flags`,...e}}function oh(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:dh(e?.body)}}function sh(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:dh(e?.body)}}function xee(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function See(e,t){let n=!!t?.negate;if(!rm.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function ch(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function Cee(e,t){return{type:`Regex`,body:dh(t?.body),flags:e}}function lh(e){return{type:`Subroutine`,ref:e}}function uh(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(_h(e));if(!r){if(n.normalizeUnknownPropertyNames)r=gh(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(im`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function wee({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return Qm(`repeater`);case`atomic`:return oh({atomic:!0});case`capturing`:return nh(i,{name:n});case`group`:return oh({flags:e});case`lookahead`:case`lookbehind`:return sh({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function dh(e){if(e===void 0)e=[$m()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function fh(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function ph(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function mh(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function hh(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function gh(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function _h(e){return e.replace(/[- _]+/g,``).toLowerCase()}function vh(e,t){let n=t;return am(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function yh(e){return am(e,`Unclosed group`)}function bh(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){xh(c).splice(Math.max(0,Sh(s)+l),1),l--,u=!0},removeAllNextSiblings(){return xh(c).splice(Sh(s)+1)},removeAllPrevSiblings(){let e=Sh(s)+l;return l-=e,xh(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,Sh(s)+l)]=e:am(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(xh(c).splice(Math.max(0,Sh(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,Sh(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function xh(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function Sh(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var Ch=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function wh(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Th(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Eh=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function Dh(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===Eh.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?Eh.CHAR_CLASS:Eh.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function Oh(e,t,n,r){Dh(e,t,n,r)}function kh(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===Eh.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function Ah(e,t,n){return!!kh(e,t,0,n)}function jh(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var Mh=new RegExp(String.raw`(?<noncapturingStart>${Ch})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function Nh(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(Mh.lastIndex=Number.isNaN(c)?0:c+7;f=Mh.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),wh(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=Dh(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},Eh.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var Ph=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Fh=new RegExp(String.raw`
54
- \\(?: \d+
55
- | c[A-Za-z]
56
- | [gk]<[^>]+>
57
- | [pPu]\{[^\}]+\}
58
- | u[A-Fa-f\d]{4}
59
- | x[A-Fa-f\d]{2}
60
- )
61
- | \((?: \? (?: [:=!>]
62
- | <(?:[=!]|[^>]+>)
63
- | [A-Za-z\-]+:
64
- | \(DEFINE\)
65
- ))?
66
- | (?<qBase>${Ph})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
67
- | \\?.
68
- `.replace(/\s+/g,``),`gsu`);function Ih(e){if(!RegExp(`${Ph}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Fh.lastIndex=0;o=Fh.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Th(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}Fh.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var Lh=String.raw,Rh=Lh`\(\?R=(?<rDepth>[^\)]+)\)|${Lh`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,zh=Lh`\(\?<(?![=!])(?<captureName>[^>]+)>`,Bh=Lh`${zh}|(?<unnamed>\()(?!\?)`,Vh=new RegExp(Lh`${zh}|${Rh}|\(\?|\\?.`,`gsu`),Hh=`Cannot use multiple overlapping recursions`;function Uh(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Rh,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Ah(e,Lh`\(\?\(DEFINE\)`,Eh.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Ah(e,Lh`\\[1-9]`,Eh.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(Vh.lastIndex=0;f=Vh.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(Wh(m),l)throw Error(Hh);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(Vh.lastIndex);if(Ah(s,Rh,Eh.DEFAULT))throw Error(Hh);let c=m-1;e=Gh(t,s,c,!1,n,a,d),i=Jh(i,t,c,a.length,0,d);break}if(h){Wh(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Hh);break}if(!u)throw Error(Lh`Recursive \g cannot be used outside the referenced group "${r===`external`?h:Lh`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=jh(e,p);if(o&&Ah(m,Lh`${zh}|\((?!\?)`,Eh.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=Gh(_,v,b,!0,n,a,d);i=Jh(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,Vh.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),Vh.lastIndex),s.set(p,Vh.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),Vh.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function Wh(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function Gh(e,t,n,r,i,a,o){let s=new Set;r&&Oh(e+t,zh,({groups:{captureName:e}})=>{s.add(e)},Eh.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${Kh(`(?:${e}`,`forward`,...c)}(?:)${Kh(`${t})`,`backward`,...c)}${t}`}function Kh(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Dh(e,Lh`${Bh}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),qh(i,n),s?e:`(?<${t}${l}>`}return Lh`\k<${c}${l}>`},Eh.DEFAULT)}return c}function qh(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Jh(e,t,n,r,i,a){if(e.size&&r){let o=0;Oh(t,Bh,()=>o++,Eh.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var Yh=String.fromCodePoint,Xh=String.raw,Zh={},Qh=globalThis.RegExp;Zh.flagGroups=(()=>{try{new Qh(`(?i:)`)}catch{return!1}return!0})(),Zh.unicodeSets=(()=>{try{new Qh(`[[]]`,`v`)}catch{return!1}return!0})(),Zh.bugFlagVLiteralHyphenIsRange=Zh.unicodeSets?(()=>{try{new Qh(Xh`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,Zh.bugNestedClassIgnoresNegation=Zh.unicodeSets&&new Qh(`[[^a]]`,`v`).test(`a`);function $h(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function eg(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function tg(e,t){return rg[e]>=rg[t]}function ng(e,t){if(e==null)throw Error(t??`Value expected`);return e}var rg={ES2025:2025,ES2024:2024,ES2018:2018},ig={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function ag(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!ig[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=Zh.flagGroups?`ES2025`:Zh.unicodeSets?`ES2024`:`ES2018`),t}var og=`[ -\r ]`,sg=new Set([Yh(304),Yh(305)]),cg=Xh`[\p{L}\p{M}\p{N}\p{Pc}]`;function lg(e){if(sg.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=pg.get(n),a=dg.get(n),o=fg.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var ug=new Map(`C Other
69
- Cc Control cntrl
70
- Cf Format
71
- Cn Unassigned
72
- Co Private_Use
73
- Cs Surrogate
74
- L Letter
75
- LC Cased_Letter
76
- Ll Lowercase_Letter
77
- Lm Modifier_Letter
78
- Lo Other_Letter
79
- Lt Titlecase_Letter
80
- Lu Uppercase_Letter
81
- M Mark Combining_Mark
82
- Mc Spacing_Mark
83
- Me Enclosing_Mark
84
- Mn Nonspacing_Mark
85
- N Number
86
- Nd Decimal_Number digit
87
- Nl Letter_Number
88
- No Other_Number
89
- P Punctuation punct
90
- Pc Connector_Punctuation
91
- Pd Dash_Punctuation
92
- Pe Close_Punctuation
93
- Pf Final_Punctuation
94
- Pi Initial_Punctuation
95
- Po Other_Punctuation
96
- Ps Open_Punctuation
97
- S Symbol
98
- Sc Currency_Symbol
99
- Sk Modifier_Symbol
100
- Sm Math_Symbol
101
- So Other_Symbol
102
- Z Separator
103
- Zl Line_Separator
104
- Zp Paragraph_Separator
105
- Zs Space_Separator
106
- ASCII
107
- ASCII_Hex_Digit AHex
108
- Alphabetic Alpha
109
- Any
110
- Assigned
111
- Bidi_Control Bidi_C
112
- Bidi_Mirrored Bidi_M
113
- Case_Ignorable CI
114
- Cased
115
- Changes_When_Casefolded CWCF
116
- Changes_When_Casemapped CWCM
117
- Changes_When_Lowercased CWL
118
- Changes_When_NFKC_Casefolded CWKCF
119
- Changes_When_Titlecased CWT
120
- Changes_When_Uppercased CWU
121
- Dash
122
- Default_Ignorable_Code_Point DI
123
- Deprecated Dep
124
- Diacritic Dia
125
- Emoji
126
- Emoji_Component EComp
127
- Emoji_Modifier EMod
128
- Emoji_Modifier_Base EBase
129
- Emoji_Presentation EPres
130
- Extended_Pictographic ExtPict
131
- Extender Ext
132
- Grapheme_Base Gr_Base
133
- Grapheme_Extend Gr_Ext
134
- Hex_Digit Hex
135
- IDS_Binary_Operator IDSB
136
- IDS_Trinary_Operator IDST
137
- ID_Continue IDC
138
- ID_Start IDS
139
- Ideographic Ideo
140
- Join_Control Join_C
141
- Logical_Order_Exception LOE
142
- Lowercase Lower
143
- Math
144
- Noncharacter_Code_Point NChar
145
- Pattern_Syntax Pat_Syn
146
- Pattern_White_Space Pat_WS
147
- Quotation_Mark QMark
148
- Radical
149
- Regional_Indicator RI
150
- Sentence_Terminal STerm
151
- Soft_Dotted SD
152
- Terminal_Punctuation Term
153
- Unified_Ideograph UIdeo
154
- Uppercase Upper
155
- Variation_Selector VS
156
- White_Space space
157
- XID_Continue XIDC
158
- XID_Start XIDS`.split(/\s/).map(e=>[_h(e),e])),dg=new Map([[`s`,Yh(383)],[Yh(383),`s`]]),fg=new Map([[Yh(223),Yh(7838)],[Yh(107),Yh(8490)],[Yh(229),Yh(8491)],[Yh(969),Yh(8486)]]),pg=new Map([gg(453),gg(456),gg(459),gg(498),..._g(8072,8079),..._g(8088,8095),..._g(8104,8111),gg(8124),gg(8140),gg(8188)]),mg=new Map([[`alnum`,Xh`[\p{Alpha}\p{Nd}]`],[`alpha`,Xh`\p{Alpha}`],[`ascii`,Xh`\p{ASCII}`],[`blank`,Xh`[\p{Zs}\t]`],[`cntrl`,Xh`\p{Cc}`],[`digit`,Xh`\p{Nd}`],[`graph`,Xh`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,Xh`\p{Lower}`],[`print`,Xh`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,Xh`[\p{P}\p{S}]`],[`space`,Xh`\p{space}`],[`upper`,Xh`\p{Upper}`],[`word`,Xh`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,Xh`\p{AHex}`]]);function hg(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function gg(e){let t=Yh(e);return[t.toLowerCase(),t]}function _g(e,t){return hg(e,t).map(e=>gg(e))}var vg=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function yg(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Cg(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:tg(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};bh(e,bg,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return bh(e,xg,a),bh(e,Sg,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var bg={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=oh();e.body[0].body.push(sh({negate:!0,body:r}),uh(`Any`));let i=oh();i.body[0].body.push(ch(`greedy`,0,1/0,e)),n(Lg(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];eg(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=kg(t.get(e));if(n){let t=oh({flags:n});t.body[0].body=e.body,e.body=[Lg(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(Lg(sh({body:[$m({body:[eh(`string_end`)]}),$m({body:[rh(10)]})]}),t));else if(c===`line_start`)o(Lg(Pg(Xh`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&Oee(e))o(Lg(sh({negate:!0}),t));else if(d)throw Error(Xh`Uses "\G" in a way that requires a subclass`);else o(Ig(eh(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(Lg(Pg(Xh`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${cg})(?!${cg})|(?<!${cg})(?=${cg}))`,n=`(?:(?<=${cg})(?=${cg})|(?<!${cg})(?!${cg}))`;o(Lg(Pg(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Ng(n)&&(n=Og(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Ng(r)&&(r=Og(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(Lg(ih({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(Ig(ah(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(Lg(Fg(Pg(og),l),t));return}if(s&&(c===`word`||u===`word`)){n(Ig(ah(`word`,{negate:l}),t));return}if(c===`any`)n(Ig(uh(`Any`),t));else if(c===`digit`)n(Ig(uh(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(Xh`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=Xh`\p{RI}{2}|${e}(?:\u200D${e})*`;n(Lg(Pg(Xh`(?>\r\n|${i?Xh`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Ig(uh(`AHex`,{negate:l}),t));else if(c===`newline`)n(Lg(Pg(l?`[^
159
- ]`:`(?>\r
160
- ?|[
161
- \v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${Yh(e.codePointAt(0)-1)}${Yh(e.codePointAt(2)+1)}-\u{10FFFF}`),n(Lg(Pg(`[${e}]`),t))}else n(Lg(Fg(Pg(mg.get(u)),l),t))}else if(c===`property`)ug.has(_h(u))||(e.key=`sc`);else if(c===`space`)n(Ig(uh(`space`,{negate:l}),t));else if(c===`word`)n(Lg(Fg(Pg(cg),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=oh({flags:c});e.body[0].body=o(),i(Lg(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Bm(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(Xh`Uses "\K" in a way that's unsupported`);let o=sh({behind:!0});o.body[0].body=a(),i(Lg(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(Lg(sh({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=oh();t.body[0].body.push(e.body),e.body=Lg(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=jg(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(Xh`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Ng(n)&&(n=Og(n,t),e.ref=n)}},xg={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=Ig(Dg(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&eg(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=eg(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=$h(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?Dg(0):Eg(o,r.groupOriginByCopy,null),l=c;if(!s){let e=kg(Tee(o,e=>e.type===`Group`&&!!e.flags)),t=e?$h(r.globalFlags,e):r.globalFlags;wg(t,r.currentFlags)||(l=oh({flags:Eee(t)}),l.body[0].body.push(c))}n(Lg(l,t),{traverse:!s})}},Sg={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Tg(t,e));i.length?i.length>1?n(Lg(oh({atomic:!0,body:i.reverse().map(e=>$m({body:[th(e.number)]}))}),t)):e.ref=i[0].number:n(Lg(sh({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=nh();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Cg(e){bh(e,{"*"({node:e,parent:t}){e.parent=t}})}function wg(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Tg(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=Ag(n.parent);for(let r of t){if(r===n)break;if(r===e||Mg(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function Eg(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=Eg(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function Dg(e){let t=lh(e);return t.isRecursive=!0,t}function Tee(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Og(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function kg(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Eee({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Ag(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function jg(e){let t=e.find(e=>e.kind===`search_start`||kee(e,{negate:!1})||!Dee(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=jg(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Mg(e,t){let n=Ag(e)??[];for(let e of n)if(e===t||Mg(e,t))return!0;return!1}function Dee({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function Oee(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function kee(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Bm(e.body[0],{type:`Assertion`,kind:`search_start`})}function Ng(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Pg(e,t){let n=Um(e,{...t,unicodePropertyMap:ug}).body;return n.length>1||n[0].body.length>1?oh({body:n}):n[0].body[0]}function Fg(e,t){return e.negate=t,e}function Ig(e,t){return e.parent=t,e}function Lg(e,t){return Cg(e),e.parent=t,e}function Aee(e,t){let n=ag(t),r=tg(n.target,`ES2024`),i=tg(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];bh(e,jee,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,ng(Mee[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&eg(f._captureTransfers,e.transferTo,[]).push(t)}),f}var jee={"*":{enter({node:e},t){if(Hg(e)){let n=t.getCurrentModI();t.pushModI(e.flags?$h({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){Hg(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){zg(Yh(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Bg(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&vg.has(e.value)&&t.setHasCasedChar()}},Mee={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?Xh`\B`:Xh`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=Yh(e),r=Vg(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&zg(n)){let e=lg(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);Zh.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(Ug)&&(o=[rh(45),...o.filter(e=>!Ug(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||Zh.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=oh(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=$m({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(Zh.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=Vg(n,i),o=Vg(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Lee(Bg(e)).forEach(e=>{s.add(Array.isArray(e)?`${Vg(e[0],i)}-${Vg(e[1],i)}`:Vg(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:Xh`[^\n]`;if(e===`digit`)return t?Xh`\D`:Xh`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&vg.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?Xh`\P`:Xh`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?Xh`\W`:Xh`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=$h(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${Ree(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+zee(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:Xh`\g<${t}&R=${r}>`}},Nee=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),Pee=new Set([`-`,`\\`,`]`,`^`,`[`]),Fee=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),Rg=new Map([[9,Xh`\t`],[10,Xh`\n`],[11,Xh`\v`],[12,Xh`\f`],[13,Xh`\r`],[8232,Xh`\u2028`],[8233,Xh`\u2029`],[65279,Xh`\uFEFF`]]),Iee=/^\p{Cased}$/u;function zg(e){return Iee.test(e)}function Bg(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=Yh(e);if(!zg(t))continue;let o=lg(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function Vg(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Rg.has(e))return Rg.get(e);if(e<32||e>126&&e<160||e>262143||t&&Bee(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?Fee:Pee:Nee,a=Yh(e);return(i.has(a)?`\\`:``)+a}function Lee(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function Ree(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function zee({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function Hg({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function Bee(e){return e>47&&e<58}function Ug({type:e,value:t}){return e===`Character`&&t===45}var Vee=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=Uee(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Hee(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=Wee(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function Hee(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function Uee(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)eg(n,t,{}).transferTo=e;return n}function Wee(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function Gee(e,t){let n=Kee(e,t);return n.options?new Vee(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Kee(e,t){let n=ag(t),r=yg(Um(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:ug}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Aee(r,n),a=Uh(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Nh(Ih(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function qee(e,t){return Gee(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function Wg(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>qee(e,{target:t.target}),{createScanner(e){return new em(e,t)},createString(e){return{content:e}}}}var Jee=[`markdown`,`typescript`,`tsx`,`javascript`,`jsx`,`json`,`css`,`html`,`html-derivative`,`python`,`rust`,`go`,`shellscript`,`yaml`],Gg=null;function Yee(){return Gg??=Qp({themes:[`github-dark`,`github-light`],langs:[...Jee],engine:Wg()}),Gg}var Xee=200,Zee=20971520,Kg=new Map,qg=0;function Jg(e){let t=Kg.get(e);return t!==void 0&&(Kg.delete(e),Kg.set(e,t)),t}function Yg(e,t){if(!Kg.has(e))for(Kg.set(e,t),qg+=t.length*2;(Kg.size>Xee||qg>Zee)&&Kg.size>0;){let e=Kg.keys().next().value;qg-=(Kg.get(e)?.length??0)*2,Kg.delete(e)}}async function Xg(e,t,n=!0){let r=`${t}${e}`;if(n){let e=Jg(r);if(e!==void 0)return e}try{let i=await Yee(),a=i.getLoadedLanguages().includes(t)?t:`text`,o=i.codeToHtml(e,{lang:a,themes:{light:`github-light`,dark:`github-dark`},defaultColor:`light`});return n&&Yg(r,o),o}catch(e){return console.error(`snippet highlight failed:`,e),null}}var Zg={command:qn,"file-edit":Vt,"file-write":Ht,mcp:Dn};function Qg({kind:e,summary:t}){let[n,r]=(0,H.useState)(null);(0,H.useEffect)(()=>{if(e!==`command`)return;let n=!0;return Xg(t,`shellscript`).then(e=>{n&&r({summary:t,html:e})}),()=>{n=!1}},[e,t]);let i=n?.summary===t?n.html:null,a=(0,G.jsx)(Fs,{text:t,className:`absolute top-1 right-1 z-10 rounded-md bg-background/80 p-1 text-muted-foreground backdrop-blur`});return e===`command`&&i!=null?(0,G.jsxs)(`div`,{className:`relative mt-1.5`,children:[(0,G.jsx)(`div`,{className:`max-h-24 overflow-auto rounded-md text-xs leading-relaxed [&_pre]:m-0 [&_pre]:py-1.5 [&_pre]:pr-7 [&_pre]:pl-2 [&_pre]:font-mono [&_pre]:whitespace-pre-wrap`,dangerouslySetInnerHTML:{__html:i}}),a]}):(0,G.jsxs)(`div`,{className:`relative mt-1.5`,children:[(0,G.jsx)(`pre`,{className:`max-h-24 overflow-auto rounded-md bg-muted/50 py-1.5 pr-7 pl-2 font-mono text-xs whitespace-pre-wrap`,children:t}),a]})}var $g={timeout:`Auto-managed review timed out. Please decide.`,error:`Auto-managed review failed. Please decide.`,invalid:`Auto-managed review returned no valid decision. Please decide.`},e_=()=>typeof window>`u`||window.electronAPI?.remote?void 0:window.electronAPI?.dcg,t_={critical:`Critical`,high:`High`,medium:`Medium`,low:`Low`};function n_({guard:e}){let{t}=K(),n=e.ruleId===o;return(0,G.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-[11px]`,children:[(0,G.jsxs)(`p`,{className:`text-destructive`,children:[t(e.reason),` `,(0,G.jsx)(`code`,{className:`rounded bg-muted/60 px-1 font-mono text-[10px] text-muted-foreground`,children:e.ruleId})]}),(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:t(n?`Safety floor rule — still requires confirmation in full-access mode. Click Adjust to target a specific subdirectory or session temp folder, or Allow once.`:`Blocked by built-in guard — still requires confirmation in full-access mode. Review the command, click Adjust, or Allow once.`)})]})}function r_({guard:e}){let{t,locale:n}=K(),[r,i]=(0,H.useState)(null),a=e.decision===`warn`,o=e.decision===void 0||e.decision===`deny`,s=ws(e.ruleId),[c,l]=(0,H.useState)(!1);(0,H.useEffect)(()=>{if(!o)return;let t=!0;return l(!1),e_()?.ruleState(e.ruleId).then(n=>{t&&n&&i({ruleId:e.ruleId,state:n})}).catch(()=>{}),()=>{t=!1}},[e.ruleId,o]);let u=r?.ruleId===e.ruleId?r.state:null,d=n===`zh`?bs(e):{what:e.reason};return(0,G.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-[11px]`,children:[(0,G.jsxs)(`p`,{className:a?`text-muted-foreground`:`text-destructive`,title:e.ruleId,children:[e.severity&&(0,G.jsx)(`span`,{className:`mr-1 rounded bg-muted px-1 text-[10px]`,children:t(t_[e.severity])}),t(a?`dcg notice: {{reason}}`:`dcg: {{reason}}`,{reason:d.what}),(0,G.jsx)(`code`,{className:`ml-1 rounded bg-muted/60 px-1 font-mono text-[10px] text-muted-foreground`,children:e.ruleId})]}),!a&&(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:s?e.decision===`ask`?t(`Guard rule requires confirmation each time — still prompts in full-access mode. Click Adjust for a safer command, or Allow once.`):t(`Triggered by command guard — still prompts in full-access mode. Click Adjust to change the command or path, or manage exemptions in Settings (auto-suggested after 5 allows).`):t(`High-risk safety floor (cannot be exempted) — still requires confirmation in full-access mode. Click Adjust for a safer command or path, or Allow once.`)}),e.matched&&(0,G.jsxs)(`p`,{className:`text-muted-foreground`,children:[t(`Matched`),`:`,` `,(0,G.jsx)(`code`,{className:`rounded bg-muted/60 px-1 font-mono`,children:e.matched})]}),d.why&&(0,G.jsxs)(`p`,{className:`text-muted-foreground`,children:[t(`Why it is dangerous`),`: `,d.why]}),d.alt&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[t(`Safer alternative`),`:`]}),(0,G.jsx)(`code`,{className:`rounded bg-muted/60 px-1 font-mono`,children:d.alt}),(0,G.jsx)(Fs,{text:d.alt,className:`p-0.5`})]}),e.explanation&&(0,G.jsxs)(`details`,{className:`text-muted-foreground`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer`,children:t(`dcg explanation`)}),(0,G.jsx)(`p`,{className:`whitespace-pre-wrap`,children:e.explanation})]}),u?.suggestExempt&&(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 text-amber-600 dark:text-amber-400`,children:c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:t(`Allow "{{rule}}" automatically in new conversations? You can revoke this anytime in Settings.`,{rule:e.ruleId})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{l(!1),e_()?.ruleExempt(e.ruleId).then(t=>{t&&i({ruleId:e.ruleId,state:t})}).catch(()=>{})},className:`font-medium underline underline-offset-2`,children:t(`Confirm exemption`)}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>l(!1),className:`text-muted-foreground underline underline-offset-2`,children:t(`Cancel`)})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:t(`You have allowed this rule {{count}} times. Allow it automatically from now on?`,{count:u.allowCount})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>l(!0),className:`underline underline-offset-2`,children:t(`Always allow this rule`)})]})}),u?.exempt&&(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:t(`This rule is allowed automatically in new conversations until dcg is updated.`)})]})}var i_=400;function a_({approvals:e,onRespond:t,allowSession:n=!0,handoff:r=!0,clockOffset:i}){let{t:a}=K(),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(null),u=e[0],d=u?.requestId,f=Is(u?.phase===`reviewing`?void 0:u?.expiresAt,i);if((0,H.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>l(d),i_);return()=>clearTimeout(e)},[d]),!u)return null;let p=Zg[u.kind]??Ln,m=u.phase===`reviewing`,h=c!==u.requestId||o===u.requestId||f!==void 0&&f<=0,g=e=>{e!==`review`&&s(u.requestId),e===`allow`&&u.guard&&(u.guard.decision===void 0||u.guard.decision===`deny`)&&!u.guard.ruleId.startsWith(`enso.`)&&e_()?.ruleAllowed(u.guard.ruleId).catch(()=>{}),t(u.requestId,e)};return(0,G.jsxs)(`div`,{"data-enso":`approval`,className:`mb-1 rounded-lg border border-border/60 bg-muted/20 px-2.5 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(Ln,{className:`h-3.5 w-3.5 shrink-0 text-amber-500`}),(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:a(m?`Assistant reviewing…`:`Approval required`)}),(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-muted-foreground`,children:[(0,G.jsx)(p,{className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate font-mono`,children:u.toolCallId&&Es(u.toolCallId)?`${a(`Isolated sandbox`)} › ${Ns(u.tool,a)}`:Ns(u.tool,a)})]}),u.protected&&(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-destructive/15 px-1.5 text-[10px] text-destructive`,children:js(u.protected,a)}),(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,G.jsx)(Ls,{remainingMs:f,expiredLabel:`Timed out · denied`}),e.length>1&&(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[`1/`,e.length]})]})]}),u.reviewFallback&&(0,G.jsx)(`p`,{className:`mt-1 text-[11px] text-amber-600 dark:text-amber-400`,children:a($g[u.reviewFallback])}),u.guard&&(u.guard.ruleId.startsWith(`enso.`)?(0,G.jsx)(n_,{guard:u.guard}):(0,G.jsx)(r_,{guard:u.guard})),u.summary&&(0,G.jsx)(Qg,{kind:u.kind,summary:u.summary}),!m&&(0,G.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-1.5`,children:[r&&u.kind===`command`&&(0,G.jsx)(`button`,{type:`button`,disabled:h,title:a(`Send back for a safer command`),onClick:()=>g(`revise`),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:a(`Adjust`)}),r&&(0,G.jsx)(`button`,{type:`button`,disabled:h,title:a(`Let the assistant decide`),onClick:()=>g(`review`),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:a(`Assistant review`)}),(0,G.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>g(`deny`),className:`rounded-md px-2.5 py-1 text-xs text-destructive transition-colors hover:bg-destructive/10 disabled:opacity-50`,children:a(`Deny`)}),n&&!u.protected&&!u.mandatory&&(0,G.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>g(`allowSession`),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:a(`Always allow this session`)}),(0,G.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>g(`allow`),className:`rounded-md bg-primary px-2.5 py-1 text-xs text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50`,children:a(`Allow`)})]})]})}function o_(e){return e>=0&&e<9?String(e+1):null}function s_(e,t){let n=t===void 0?-1:e?.indexOf(t)??-1;return n>=0?n:0}function c_(e,t,n){return n===`ArrowDown`?Math.min(e+1,t-1):n===`ArrowUp`?Math.max(e-1,0):null}function l_({asks:e,onAnswer:t,clockOffset:n,autoFocus:r=!0}){let{t:i}=K(),a=(0,H.useRef)(null),o=(0,H.useRef)(null),s=(0,H.useRef)([]),[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(!1),[f,p]=(0,H.useState)(null),[m,h]=(0,H.useState)(()=>new Set),g=e.filter(e=>e.answered),_=e.find(e=>!e.answered),v=_?.requestId,y=Is(_?.expiresAt,n),b=v!==void 0&&m.has(v),x=_?.options,S=_?.recommended,C=e=>{let t=s.current[e];x&&e<x.length&&t?t.focus():a.current?.focus()};if((0,H.useEffect)(()=>{if(!r||!v||b)return;let e=s_(x,S),t=s.current[e];x&&e<x.length&&t?t.focus():a.current?.focus()},[r,v,b]),(0,H.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=()=>d(e.scrollHeight-e.scrollTop-e.clientHeight>1);t();let n=new ResizeObserver(t);return n.observe(e),e.addEventListener(`scroll`,t,{passive:!0}),()=>{n.disconnect(),e.removeEventListener(`scroll`,t)}},[v,b]),!_)return g.length>0?(0,G.jsx)(u_,{asks:g}):null;let w=f===_.requestId||y!==void 0&&y<=0,T=e=>{e.trim()&&(p(_.requestId),l(``),t(_.requestId,e.trim()))},E=()=>h(e=>e.has(_.requestId)?e:new Set(e).add(_.requestId));return b?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u_,{asks:g}),(0,G.jsxs)(`button`,{type:`button`,"data-enso":`ask-later`,onClick:()=>h(e=>{let t=new Set(e);return t.delete(_.requestId),t}),className:`mb-1 flex w-full items-center gap-2 rounded-lg border border-dashed border-border/60 px-2.5 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground`,children:[(0,G.jsx)(un,{className:`h-3.5 w-3.5 shrink-0 text-blue-500`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_.question}),e.length>1&&(0,G.jsxs)(`span`,{className:`shrink-0 text-[10px] tabular-nums`,children:[`1/`,e.length]}),(0,G.jsx)(yt,{className:`h-3 w-3 shrink-0`})]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u_,{asks:g}),(0,G.jsxs)(`div`,{"data-enso":`ask`,className:`mb-1 flex max-h-[60dvh] min-h-0 flex-col rounded-lg border border-border/60 bg-muted/20 px-2.5 py-2`,onKeyDown:e=>{if(e.nativeEvent.isComposing||w)return;if(e.key===`Escape`){e.preventDefault(),E();return}let t=e.target,n=(x?.length??0)+1,r=t===a.current?n-1:s.current.indexOf(t),i=r>=0?c_(r,n,e.key):null;if(i!==null){e.preventDefault(),C(i);return}if(t instanceof HTMLInputElement&&(t.value.length>0||e.key===`Enter`))return;let o=Number(e.key)-1,c=x?.[o];if(o_(o)&&c){e.preventDefault(),T(c);return}t instanceof HTMLButtonElement&&r>=0&&(e.key===`Process`?a.current?.focus():e.key.length===1&&e.key!==` `&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),l(t=>t+e.key),a.current?.focus()))},children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,G.jsx)(un,{className:`h-3.5 w-3.5 shrink-0 text-blue-500`}),_.relay&&(0,G.jsx)(`span`,{"data-enso":`ask-relay`,className:`min-w-0 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground [overflow-wrap:anywhere]`,children:i(`Handed to {{name}}`,{name:_.relay.name})}),(0,G.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:E,className:`rounded-md px-1.5 py-0.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:i(`Later`)}),(0,G.jsx)(Ls,{remainingMs:y,expiredLabel:`Timed out · no answer`}),e.length>1&&(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[`1/`,e.length]})]})]}),(0,G.jsx)(`div`,{ref:o,"data-enso":`ask-question`,className:W(`mt-1.5 min-h-5 min-w-0 overflow-y-auto overscroll-contain text-xs leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,u&&`[mask-image:linear-gradient(to_bottom,#000_calc(100%_-_1.5rem),transparent)]`),children:_.question}),x&&x.length>0&&(0,G.jsx)(`div`,{"data-enso":`ask-options`,className:`mt-2 flex max-h-[30dvh] shrink-0 flex-col gap-1.5 overflow-y-auto overscroll-contain`,children:x.map((e,t)=>{let n=o_(t);return(0,G.jsxs)(`button`,{ref:e=>{s.current[t]=e},type:`button`,disabled:w,onClick:()=>T(e),className:`flex items-center gap-2 rounded-md border border-border/60 px-2 py-1 text-left text-xs text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus:border-ring focus:bg-muted focus:text-foreground disabled:opacity-50`,children:[n&&(0,G.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center rounded bg-muted font-mono text-[10px] text-muted-foreground`,children:n}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:e}),e===S&&(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-success/15 px-1.5 text-[10px] text-success`,children:i(`Recommended`)})]},e)})}),(0,G.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(`input`,{ref:a,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||e.key===`Enter`&&T(c)},disabled:w,placeholder:i(`Type an answer…`),className:`h-7 min-w-0 flex-1 rounded-md border bg-transparent px-2 text-xs outline-none focus:ring-1 focus:ring-ring disabled:opacity-50`}),(0,G.jsx)(`button`,{type:`button`,disabled:w||!c.trim(),onClick:()=>T(c),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40`,children:(0,G.jsx)(In,{className:`h-3.5 w-3.5`})})]})]})]})}function u_({asks:e}){let{t}=K();return e.length===0?null:(0,G.jsx)(`div`,{"data-enso":`ask-settled`,className:`mb-1 space-y-1`,children:e.map(e=>{let n=e.answered;if(!n)return null;let r=n.by===`timeout`?t(`No answer in time`):n.by===`relay`?t(`{{name}} answered: {{answer}}`,{name:n.name??t(`Secretary`),answer:n.answer??``}):t(`Answered: {{answer}}`,{answer:n.answer??``});return(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-dashed border-border/60 px-2.5 py-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(un,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.question}),(0,G.jsx)(`span`,{className:`shrink-0`,children:r})]},e.requestId)})})}var d_=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function f_(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function p_(e){return`nodeType`in e}function m_(e){return e?f_(e)?e:p_(e)?e.ownerDocument?.defaultView??window:window:window}function h_(e){let{Document:t}=m_(e);return e instanceof t}function g_(e){return!f_(e)&&e instanceof m_(e).HTMLElement}function __(e){return e instanceof m_(e).SVGElement}function v_(e){return e?f_(e)?e.document:p_(e)?h_(e)?e:g_(e)||__(e)?e.ownerDocument:document:document:document}var y_=d_?H.useLayoutEffect:H.useEffect;function b_(e){let t=(0,H.useRef)(e);return y_(()=>{t.current=e}),(0,H.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function x_(e,t){t===void 0&&(t=[e]);let n=(0,H.useRef)(e);return y_(()=>{n.current!==e&&(n.current=e)},t),n}function S_(e){let t=b_(e),n=(0,H.useRef)(null);return[n,(0,H.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}var C_={};function w_(e,t){return(0,H.useMemo)(()=>{if(t)return t;let n=C_[e]==null?0:C_[e]+1;return C_[e]=n,e+`-`+n},[e,t])}function T_(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var E_=T_(-1);function D_(e){return`clientX`in e&&`clientY`in e}function O_(e){if(!e)return!1;let{TouchEvent:t}=m_(e.target);return t&&e instanceof t}function k_(e){if(O_(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return D_(e)?{x:e.clientX,y:e.clientY}:null}var A_;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(A_||={});function j_(){}var M_=Object.freeze({x:0,y:0}),N_;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(N_||={});var P_=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function F_(e){let{EventTarget:t}=m_(e);return e instanceof t?e:v_(e)}function I_(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var L_;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(L_||={});function R_(e){e.preventDefault()}function z_(e){e.stopPropagation()}var B_;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(B_||={}),B_.Space,B_.Enter,B_.Esc,B_.Space,B_.Enter,B_.Tab;function V_(e){return!!(e&&`distance`in e)}function H_(e){return!!(e&&`delay`in e)}var U_=class{constructor(e,t,n){n===void 0&&(n=F_(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=v_(i),this.documentListeners=new P_(this.document),this.listeners=new P_(n),this.windowListeners=new P_(m_(i)),this.initialCoordinates=k_(r)??M_,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(L_.Resize,this.handleCancel),this.windowListeners.add(L_.DragStart,R_),this.windowListeners.add(L_.VisibilityChange,this.handleCancel),this.windowListeners.add(L_.ContextMenu,R_),this.documentListeners.add(L_.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(H_(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(V_(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(L_.Click,z_,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(L_.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=k_(e)??M_,s=E_(n,o);if(!t&&a){if(V_(a)){if(a.tolerance!=null&&I_(s,a.tolerance))return this.handleCancel();if(I_(s,a.distance))return this.handleStart()}if(H_(a)&&I_(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===B_.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},W_={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},G_=class extends U_{constructor(e){let{event:t}=e,n=v_(t.target);super(e,W_,n)}};G_.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var K_={move:{name:`mousemove`},end:{name:`mouseup`}},q_;(function(e){e[e.RightClick=2]=`RightClick`})(q_||={});var J_=class extends U_{constructor(e){super(e,K_,v_(e.event.target))}};J_.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==q_.RightClick&&(r?.({event:n}),!0)}}];var Y_={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},X_=class extends U_{constructor(e){super(e,Y_)}static setup(){return window.addEventListener(Y_.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Y_.move.name,e)};function e(){}}};X_.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Z_;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Z_||={});var Q_;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Q_||={}),N_.Backward,N_.Forward,N_.Backward,N_.Forward;var $_;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})($_||={});var ev;(function(e){e.Optimized=`optimized`})(ev||={});function tv(e){let{callback:t,disabled:n}=e,r=b_(t),i=(0,H.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,H.useEffect)(()=>()=>i?.disconnect(),[i]),i}$_.WhileDragging,ev.Optimized;var nv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:j_,draggableNodes:new Map,over:null,measureDroppableContainers:j_},rv=(0,H.createContext)(nv);({...M_});var iv;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(iv||={});var av=`Droppable`,ov={timeout:25};function sv(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=w_(av),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,H.useContext)(rv),u=(0,H.useRef)({disabled:n}),d=(0,H.useRef)(!1),f=(0,H.useRef)(null),p=(0,H.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...ov,...i},_=x_(h??r),v=tv({callback:(0,H.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=S_((0,H.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=x_(t);return(0,H.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,H.useEffect)(()=>(s({type:A_.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:A_.UnregisterDroppable,key:a,id:r})),[r]),(0,H.useEffect)(()=>{n!==u.current.disabled&&(s({type:A_.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}var cv=/["[\]\n]/g;function lv(e,t){return typeof e==`string`?e.replace(cv,` `).replace(/\s+/g,` `).trim().slice(0,t):``}function uv(e){return`[Selected UI element "${lv(e.label,80)}" — path: ${lv(e.path,300)}; text: ${lv(e.text,200)}]`}var dv=/^\[Selected UI element "([^"]*)" — path: (.*); text: (.*)\]$/;function fv(e){let t=dv.exec(e);return t?{label:t[1],path:t[2],text:t[3]}:null}function pv(e,t){if(t.length===0)return[...e];let n=new Set(t);return e.filter(e=>!e.id||!n.has(e.id))}var mv=`pasted-text.txt`;function hv(e){let t=e.replace(/\r\n?/g,`
162
- `).trim();return t.length>=5e4&&t.length<=2e7?t:null}var gv=/@((?:\/|[A-Za-z]:\\)[^\n@]*?[\\/]pasted-text[\\/](?:bot-)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}[\\/][0-9a-f]{8}[\\/]pasted-text\.txt)/g;function _v(e){let t=[],n=0;for(let r of e.matchAll(gv))r.index>n&&t.push({type:`text`,text:e.slice(n,r.index)}),t.push({type:`file`,path:r[1]}),n=r.index+r[0].length;return(n<e.length||t.length===0)&&t.push({type:`text`,text:e.slice(n)}),t}var vv=`(?<![A-Za-z0-9_])`,yv=`(?![A-Za-z0-9_])`,bv=(e,t,n)=>({kind:`API_KEY`,rule:e,re:RegExp(`${vv}${t}${yv}`,`g`),keep:n}),xv=/^\{\{[A-Z][A-Z_]*_[a-z2-7]{8}\}\}$/,Sv=/^(?:\$\{.*\}|\$[A-Za-z_]\w*|<[^>]*>|%[\w]+%|process\.env\..*|null|nil|none|true|false|undefined|x{3,}|\*{3,}|changeme|password|secret|your[_-].*)$/i,Cv=e=>e.length>=6&&!Sv.test(e)&&!xv.test(e),wv=([e=``])=>/pass|pwd|密码|口令/i.test(e)?`PASSWORD`:/token|令牌/i.test(e)?`TOKEN`:`SECRET`,Tv=[{kind:`PRIVATE_KEY`,rule:`pem`,re:/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,keep:0},bv(`openai`,`sk-[A-Za-z0-9_-]{16,}`,/^sk-(?:ant-(?:api\d+-)?|proj-)?/),bv(`stripe`,`[sr]k_(?:live|test)_[A-Za-z0-9]{10,}`,/^[sr]k_(?:live|test)_/),bv(`github`,`gh[opusr]_[A-Za-z0-9]{20,}`,/^gh[opusr]_/),bv(`github`,`github_pat_[A-Za-z0-9_]{20,}`,/^github_pat_/),bv(`gitlab`,`glpat-[A-Za-z0-9_-]{20,}`,/^glpat-/),bv(`google`,`AIza[0-9A-Za-z_-]{35}`,/^AIza/),bv(`slack`,`xox[abprs]-[A-Za-z0-9-]{10,}`,/^xox[abprs]-/),bv(`aws`,`(?:AKIA|ASIA)[0-9A-Z]{16}`,/^(?:AKIA|ASIA)/),bv(`huggingface`,`hf_[A-Za-z0-9]{20,}`,/^hf_/),bv(`groq`,`gsk_[A-Za-z0-9]{20,}`,/^gsk_/),bv(`xai`,`xai-[A-Za-z0-9]{20,}`,/^xai-/),bv(`npm`,`npm_[A-Za-z0-9]{36}`,/^npm_/),bv(`pypi`,`pypi-[A-Za-z0-9_-]{50,}`,/^pypi-/),bv(`digitalocean`,`do[opr]_v1_[a-f0-9]{64}`,/^do[opr]_v1_/),bv(`sendgrid`,`SG\\.[A-Za-z0-9_-]{22}\\.[A-Za-z0-9_-]{43}`,/^SG\./),{kind:`TOKEN`,rule:`jwt`,re:/(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,keep:3},{kind:`TOKEN`,rule:`bearer`,re:/\bBearer\s+([A-Za-z0-9._~+/=-]{16,})/dg,group:1,keep:0},{kind:`PASSWORD`,rule:`url`,re:/:(?<=\b[a-z][a-z0-9+.-]*:)\/\/[^\s/:@]+:([^\s/@]+)@/dgi,group:1,keep:0,validate:e=>!Sv.test(e)&&!xv.test(e)},{kind:wv,rule:`kv`,re:/\b(?<!(?:^|[^A-Za-z0-9_])(?:[A-Za-z0-9]+[_-])+?)(?:[A-Za-z0-9]+[_-])*(api[_-]?key|secret(?:[_-]?key)?|access[_-]?token|refresh[_-]?token|auth[_-]?token|token|passwd|password|pwd|client[_-]?secret|private[_-]?key)["']?\s*[:=]\s*(?:"((?:\\.|[^"\\\n])*)"|'((?:\\.|[^'\\\n])*)'|([^\s"',;{}[\]]+))/dgi,group:-1,keep:0,validate:Cv},{kind:wv,rule:`cjk`,re:/(密码|口令|密钥|秘钥|令牌)\s*(?:[::=]|为|是)\s*([^\s,。、,;;"'“”‘’]{6,})/dg,group:2,keep:0,validate:Cv}],Ev=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];function Dv(e){let t=Number(e.slice(10,12)),n=Number(e.slice(12,14));return t<1||t>12||n<1||n>31?!1:`10X98765432`[Ev.reduce((t,n,r)=>t+n*Number(e[r]),0)%11]===e[17].toUpperCase()}function Ov(e){let t=0;for(let n=0;n<e.length;n++){let r=Number(e[e.length-1-n]);n%2==1&&(r*=2,r>9&&(r-=9)),t+=r}return t%10==0}var kv=/(?:^|\.)(?:example\.(?:com|org|net)|example|test|invalid|local|localhost)$/i,Av={email:{kind:`EMAIL`,rule:`email`,re:/(?<![\w.%+-])[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}(?![\w-])/g,keep:0,validate:e=>!/no-?reply/i.test(e)&&!kv.test(e.slice(e.indexOf(`@`)+1))},phone:{kind:`PHONE`,rule:`cn-mobile`,re:/(?<![\d+])(?:\+?86[- ]?)?1[3-9]\d{9}(?!\d)/g,keep:0},idCard:{kind:`ID_CARD`,rule:`cn-id`,re:/(?<![\dA-Za-z])\d{17}[\dXx](?![\dA-Za-z])/g,keep:0,validate:Dv},bankCard:{kind:`BANK_CARD`,rule:`luhn`,re:/(?<![\d-])\d(?:[ -]?\d){14,18}(?!\d)/g,keep:0,validate:e=>{let t=e.replace(/[ -]/g,``);return!/^(\d)\1+$/.test(t)&&Ov(t)}},ip:{kind:`IP`,rule:`ipv4`,re:/(?<![\d.])(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)(?![\d.])/g,keep:0,validate:e=>!/^(?:127\.|0\.0\.0\.0$|255\.255\.255\.255$)/.test(e)}},jv=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Mv=e=>`${/^\w/.test(e)?vv:``}${jv(e)}${/\w$/.test(e)?yv:``}`;function Nv(e,t){let n=e.map(e=>({kind:`CUSTOM`,rule:`word`,re:new RegExp(Mv(e),`gi`),keep:0}));for(let e of t){let t=/^\/(.+)\/([a-z]*)$/s.exec(e);try{n.push(t?{kind:`CUSTOM`,rule:`regex`,re:new RegExp(t[1],`${t[2].replace(/[gyd]/g,``)}g`),keep:0}:{kind:`CUSTOM`,rule:`prefix`,re:RegExp(`${/^\w/.test(e)?vv:``}${jv(e)}[A-Za-z0-9._-]+`,`g`),keep:e.length})}catch{}}return n}function Pv(e){let t=[];if(e.enabled){if(e.secrets.enabled)for(let n of Tv)t.push({...n,action:e.secrets.action,category:`secret`});if(e.personal.enabled)for(let n of e.personal.kinds)t.push({...Av[n],action:e.personal.action,category:`personal`});for(let n of Nv(e.custom.words,e.custom.rules))t.push({...n,action:e.custom.action,category:`custom`})}return{active:t.length>0,rules:t,allow:new Set(e.allow.map(e=>e.toLowerCase()))}}var Fv=/\{\{[A-Z][A-Z_]*_[a-z2-7]{8}\}\}/g;function Iv(e,t){let n=t.indices;if(!e.group)return[t.index,t.index+t[0].length];if(n){if(e.group>0)return n[e.group];for(let e=2;e<n.length;e++)if(n[e])return n[e]}}function Lv(e,t){if(!t.active||!e)return[];let n=[];for(let t of e.matchAll(Fv))n.push([t.index,t.index+t[0].length]);let r=[];for(let i of t.rules){i.re.lastIndex=0;for(let a=i.re.exec(e);a;a=i.re.exec(e)){if(a[0].length===0){i.re.lastIndex++;continue}let o=Iv(i,a);if(!o||o[1]<=o[0])continue;let[s,c]=o,l=e.slice(s,c);if(i.validate&&!i.validate(l)||t.allow.has(l.toLowerCase())||n.some(([e,t])=>s<t&&c>e))continue;let u=typeof i.keep==`number`?i.keep:i.keep?.exec(l)?.[0].length??0;r.push({start:s,end:c,kind:typeof i.kind==`string`?i.kind:i.kind([a[1]??``]),rule:i.rule,action:i.action,category:i.category,keep:Math.min(u,l.length)})}}r.sort((e,t)=>e.start-t.start||t.end-e.end);let i=[];for(let e of r)(!i.length||e.start>=i[i.length-1].end)&&i.push(e);return i}function Rv(e,t){let n=Lv(e,Pv(t));return{masked:n.filter(e=>e.action===`mask`).length,blocked:[...new Set(n.filter(e=>e.action===`block`).map(e=>e.kind))]}}var zv={"/goal":[{name:`pause`,aliases:[],description:`Pause the current session goal`},{name:`resume`,aliases:[],description:`Resume a paused session goal`},{name:`clear`,aliases:[],description:`Clear the session goal`}]};function Bv(e,t){if(!e)return null;let n=t.trimStart();return n?n.search(/\s/)>=0?null:n:``}function Vv(e,t){if(!e)return[];let n=zv[e]??[],r=t.trim().toLowerCase();return r?n.filter(e=>e.name.toLowerCase().startsWith(r)||e.aliases.some(e=>e.toLowerCase().startsWith(r))):n}var Hv=H.createContext(void 0);function Uv(e){let t=H.useContext(Hv);if(!e&&t===void 0)throw Error(Cr(27));return t}var Wv=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Gv={"data-starting-style":``},Kv={"data-ending-style":``},qv={transitionStatus(e){return e===`starting`?Gv:e===`ending`?Kv:null}};(function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Wv.startingStyle]=`startingStyle`,e[e.endingStyle=Wv.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e})({});var Jv={"data-popup-open":``},Yv={"data-popup-open":``,"data-pressed":``},Xv={"data-open":``},Zv={"data-closed":``},Qv={"data-anchor-hidden":``},$v={open(e){return e?Jv:null}},ey={open(e){return e?Yv:null}},ty={open(e){return e?Xv:Zv},anchorHidden(e){return e?Qv:null}},ny={...ty,...qv},ry=H.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Uv(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Vr(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:ny,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})});function iy(){return typeof window<`u`}function ay(e){return cy(e)?(e.nodeName||``).toLowerCase():`#document`}function oy(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sy(e){return((cy(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function cy(e){return iy()?e instanceof Node||e instanceof oy(e).Node:!1}function ly(e){return iy()?e instanceof Element||e instanceof oy(e).Element:!1}function uy(e){return iy()?e instanceof HTMLElement||e instanceof oy(e).HTMLElement:!1}function dy(e){return!iy()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof oy(e).ShadowRoot}function fy(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Cy(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function py(e){return/^(table|td|th)$/.test(ay(e))}function my(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var hy=/transform|translate|scale|rotate|perspective|filter/,gy=/paint|layout|strict|content/,_y=e=>!!e&&e!==`none`,vy;function yy(e){let t=ly(e)?Cy(e):e;return _y(t.transform)||_y(t.translate)||_y(t.scale)||_y(t.rotate)||_y(t.perspective)||!xy()&&(_y(t.backdropFilter)||_y(t.filter))||hy.test(t.willChange||``)||gy.test(t.contain||``)}function by(e){let t=Ty(e);for(;uy(t)&&!Sy(t);){if(yy(t))return t;if(my(t))return null;t=Ty(t)}return null}function xy(){return vy??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),vy}function Sy(e){return/^(html|body|#document)$/.test(ay(e))}function Cy(e){return oy(e).getComputedStyle(e)}function wy(e){return ly(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ty(e){if(ay(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||dy(e)&&e.host||sy(e);return dy(t)?t.host:t}function Ey(e){let t=Ty(e);return Sy(t)?(e.ownerDocument||e).body:uy(t)&&fy(t)?t:Ey(t)}function Dy(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ey(e),i=r===e.ownerDocument?.body,a=oy(r);if(i){let e=Oy(a);return t.concat(a,a.visualViewport||[],fy(r)?r:[],e&&n?Dy(e):[])}return t.concat(r,Dy(r,[],n))}function Oy(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var ky={...H},Ay=ky.useInsertionEffect,Qee=Ay&&Ay!==ky.useLayoutEffect?Ay:e=>e();function jy(e){let t=Tr($ee).current;return t.next=e,Qee(t.effect),t.trampoline}function $ee(){let e={next:void 0,callback:ete,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function ete(){}var Y=typeof document<`u`?H.useLayoutEffect:()=>{},tte=H.createContext(void 0);function My(e=!1){let t=H.useContext(tte);if(t===void 0&&!e)throw Error(Cr(16));return t}function nte(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:H.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function Ny(e){return e?.ownerDocument||document}function Py(e,t,{detail:n=0}={}){e.dispatchEvent(new(oy(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Fy(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=H.useRef(null),s=My(!0),c=a??s!==void 0,{props:l}=nte({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=H.useCallback(()=>{let e=o.current;Iy(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Y(u,[u]),{getButtonProps:H.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return cr({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(yr(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Iy(r),s=!i&&rte(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),Py(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Py(r,e)))},onKeyUp(e){if(!t){if(yr(e),a?.(e),e.target===e.currentTarget&&i&&c&&Iy(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Py(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:jy(e=>{o.current=e,u()})}}function Iy(e){return uy(e)&&e.tagName===`BUTTON`}function rte(e){return uy(e)&&e.tagName===`A`&&!!e.href}var Ly=`none`,Ry=`trigger-press`,zy=`trigger-hover`,By=`trigger-focus`,ite=`outside-press`,Vy=`item-press`,ate=`close-press`,Hy=`focus-out`,ote=`escape-key`,Uy=`list-navigation`,Wy=`cancel-open`,Gy=`sibling-open`,Ky=`imperative-action`,ste=`window-resize`;function qy(e,t,n,r){let i=!1,a=!1,o=r??Lr;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var Jy=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=Uv(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Fy({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,qy(ate,e.nativeEvent))}return Vr(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),Yy=0;function cte(e,t=`mui`){let[n,r]=H.useState(e),i=e||n;return H.useEffect(()=>{n??(Yy+=1,r(`${t}-${Yy}`))},[n,t]),i}var Xy=ky.useId;function Zy(e,t){if(Xy!==void 0){let n=Xy();return e??(t?`${t}-${n}`:n)}return cte(e,t)}function Qy(e){return Zy(e,`base-ui`)}var $y=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Uv(),c=Qy(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Vr(`p`,e,{ref:t,props:[{id:c},o]})});function eb(e){H.useEffect(e,Ir)}var tb=0,nb=class e{static create(){return new e}currentId=tb;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=tb,t()},e)}isStarted(){return this.currentId!==tb}clear=()=>{this.currentId!==tb&&(clearTimeout(this.currentId),this.currentId=tb)};disposeEffect=()=>this.clear};function rb(){let e=Tr(nb.create).current;return eb(e.disposeEffect),e}function lte(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:ute,platform:dte,maxTouchPoints:fte}=lte(),ib=ute.toLowerCase(),ab=dte.toLowerCase(),ob=/^i(os$|p)/.test(ab)||ab===`macintel`&&fte>1,sb=`android`,cb=ab===sb||ib.includes(sb),lb=!ob&&ab.startsWith(`mac`);ab.startsWith(`win`),!cb&&/^(linux|chrome os)/.test(ab);var pte=lb||ob,ub=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!ub&&ib.includes(`firefox`),!ub&&ib.includes(`chrom`);var mte=pte,db=/jsdom|happydom/.test(ib);function fb(e){e.preventDefault(),e.stopPropagation()}function hte(e){return`nativeEvent`in e}function pb(e){return e.pointerType===``&&e.isTrusted?!0:cb&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function mb(e){return db?!1:!cb&&e.width===0&&e.height===0||cb&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function hb(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function gte(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var _te=`data-base-ui-focusable`,vte=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,gb=`ArrowLeft`,_b=`ArrowRight`,vb=`ArrowUp`,yb=`ArrowDown`;function bb(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function xb(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&dy(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Sb(e){return`composedPath`in e?e.composedPath()[0]:e.target}function Cb(e,t){if(!ly(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(xb(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function wb(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Tb(e){return e.matches(`html,body`)}function Eb(e){return uy(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Db(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${vte}`)!=null}function Ob(e){return e?e.getAttribute(`role`)===`combobox`&&Eb(e):!1}function kb(e){if(!e||db)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Ab(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function jb(e,t){return t!=null&&!hb(t)?0:typeof e==`function`?e():e}function Mb(e,t,n){let r=jb(e,n);return typeof r==`number`?r:r?.[t]}function Nb(e){return typeof e==`function`?e():e}function Pb(e,t){return t||e===`click`||e===`mousedown`}function Fb(e){return e?.includes(`mouse`)&&e!==`mousedown`}function Ib(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Lb(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Rb(e){let t=Tr(zb,e).current;return t.next=e,Y(t.effect),t}function zb(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Bb=null;globalThis.requestAnimationFrame;var Vb=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},Hb=class e{static create(){return new e}static request(e){return Vb.request(e)}static cancel(e){return Vb.cancel(e)}currentId=Bb;request(e){this.cancel(),this.currentId=Vb.request(()=>{this.currentId=Bb,e()})}cancel=()=>{this.currentId!==Bb&&(Vb.cancel(this.currentId),this.currentId=Bb)};disposeEffect=()=>this.cancel};function Ub(){let e=Tr(Hb.create).current;return eb(e.disposeEffect),e}var Wb={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Gb={...Wb,position:`fixed`,top:0,left:0},Kb={...Wb,position:`absolute`},qb=H.forwardRef(function(e,t){let[n,r]=H.useState();Y(()=>{mte&&ub&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,G.jsx)(`span`,{...e,ref:t,style:Gb,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),Jb=Math.min,Yb=Math.max,Xb=Math.round,Zb=Math.floor,Qb=e=>({x:e,y:e}),$b={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ex(e,t,n){return Yb(e,Jb(t,n))}function tx(e,t){return typeof e==`function`?e(t):e}function nx(e){return e.split(`-`)[0]}function rx(e){return e.split(`-`)[1]}function ix(e){return e===`x`?`y`:`x`}function ax(e){return e===`y`?`height`:`width`}function ox(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function sx(e){return ix(ox(e))}function cx(e,t,n){n===void 0&&(n=!1);let r=rx(e),i=sx(e),a=ax(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=_x(o)),[o,_x(o)]}function lx(e){let t=_x(e);return[ux(e),t,ux(t)]}function ux(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var dx=[`left`,`right`],fx=[`right`,`left`],px=[`top`,`bottom`],mx=[`bottom`,`top`];function hx(e,t,n){switch(e){case`top`:case`bottom`:return n?t?fx:dx:t?dx:fx;case`left`:case`right`:return t?px:mx;default:return[]}}function gx(e,t,n,r){let i=rx(e),a=hx(nx(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ux)))),a}function _x(e){let t=nx(e);return $b[t]+e.slice(t.length)}function vx(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function yx(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:vx(e)}function bx(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function xx(e,t){return t<0||t>=e.length}function Sx(e,t){return wx(e.current,{disabledIndices:t})}function Cx(e,t){return wx(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function wx(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Tx(e,a,r));return a}function Tx(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!Dx(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Ex(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Dx(e,t=e?Cy(e):null){return!e||!e.isConnected||!t||Ex(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Ox=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function kx(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return dy(n)?n.host:null}function Ax(e){for(let t of Array.from(e.children))if(ay(t)===`summary`)return t;return null}function jx(e,t){let n=Ax(t);return!!n&&(e===n||xb(n,e))}function Mx(e){let t=e?ay(e):``;return e!=null&&e.matches(Ox)&&(t!==`summary`||e.parentElement!=null&&ay(e.parentElement)===`details`&&Ax(e.parentElement)===e)&&(t!==`details`||Ax(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Nx(e){if(!Mx(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=kx(t)){let n=t!==e,r=ay(t)===`slot`;if(t.hasAttribute(`inert`)||n&&ay(t)===`details`&&!t.open&&!jx(e,t)||t.hasAttribute(`hidden`)||!r&&!Px(t,n))return!1}return!0}function Px(e,t){let n=Cy(e);return t?n.display!==`none`:Dx(e,n)}function Fx(e){let t=e.tabIndex;if(t<0){let t=ay(e);if(t===`details`||t===`audio`||t===`video`||uy(e)&&e.isContentEditable)return 0}return t}function Ix(e){if(ay(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Lx(e,t){let n=Ix(e);if(!n)return!0;let r=t.find(e=>{let t=Ix(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Ix(e);return t?.name===n.name&&t.form===n.form})===n}function Rx(e){if(uy(e)&&ay(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return uy(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function zx(e,t){Rx(e).forEach(e=>{Mx(e)&&t.push(e),zx(e,t)})}function Bx(e,t,n){Rx(e).forEach(e=>{uy(e)&&e.matches(t)&&n.push(e),Bx(e,t,n)})}function Vx(e){return Nx(e)&&Fx(e)>=0}function Hx(e){let t=[];return zx(e,t),t.filter(Nx)}function Ux(e){let t=Hx(e);return t.filter(e=>Fx(e)>=0&&Lx(e,t))}function Wx(e,t){let n=Ux(e),r=n.length;if(r===0)return;let i=bb(Ny(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Gx(e){return Wx(Ny(e).body,1)||e}function Kx(e){return Wx(Ny(e).body,-1)||e}function qx(e,t){if(!e)return null;let n=Ux(Ny(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Jx(e){return qx(e,1)}function Yx(e){return qx(e,-1)}function Xx(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!xb(n,r)}function Zx(e){Ux(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Qx(e){let t=[];Bx(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function $x(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...$x(e,t.id,n)])}function eS(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function tS(e){return`data-base-ui-${e}`}var nS=0;function rS(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(nS);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),Fr;let o=requestAnimationFrame(a);return nS=o,()=>{nS===o&&(cancelAnimationFrame(o),nS=0)}}var iS={inert:new WeakMap,"aria-hidden":new WeakMap},aS=`data-base-ui-inert`,oS={inert:new WeakSet,"aria-hidden":new WeakSet},sS=new WeakMap,cS=0;function lS(e){return oS[e]}function uS(e){return e?dy(e)?e.host:uS(e.parentNode):null}var dS=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=uS(t);return e.contains(n)?n:null}).filter(e=>e!=null),fS=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},pS=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{ay(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function mS(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=dS(t,e),l=i?pS(t,fS(c),new Set(c)):[],u=[],d=[];if(a){let e=iS[a],n=lS(a);s=n,o=e;let r=dS(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);pS(t,fS(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(sS.get(e)||0)+1;sS.set(e,t),d.push(e),t===1&&e.setAttribute(aS,``)}),cS+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(sS.get(e)||0)-1;sS.set(e,t),t||e.removeAttribute(aS)}),--cS,cS||(iS.inert=new WeakMap,iS[`aria-hidden`]=new WeakMap,oS.inert=new WeakSet,oS[`aria-hidden`]=new WeakSet,sS=new WeakMap)}}function hS(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=Ny(e[0]).body;return mS(e,a,n,r,{mark:i})}var gS={style:{transition:`none`}},_S=`data-base-ui-click-trigger`,vS={fallbackAxisSide:`none`},yS={fallbackAxisSide:`end`},bS={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},xS=H.createContext(null),SS=()=>H.useContext(xS),CS=tS(`portal`);function wS(e={}){let{ref:t,container:n,componentProps:r=Lr,elementProps:i}=e,a=Zy(),o=SS()?.portalNode,[s,c]=H.useState(null),[l,u]=H.useState(null),d=jy(e=>{e!==null&&u(e)}),f=H.useRef(null);Y(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(cy(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=Vr(`div`,r,{ref:[t,d],props:[{id:a,[CS]:``},i]}),m=s&&p?Gs.createPortal(p,s):null;return{node:l,nodeId:H.isValidElement(p)?p.props.id:void 0,subtree:m}}var TS=H.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,...s}=e,{node:c,nodeId:l,subtree:u}=wS({container:o,ref:t,componentProps:e,elementProps:s}),d=H.useRef(null),f=H.useRef(null),p=H.useRef(null),m=H.useRef(null),[h,g]=H.useState(null),_=H.useRef(!1),v=h?.modal,y=h?.open,b=!!h&&!h.modal&&h.open&&!!c;H.useEffect(()=>{if(!c||v)return;function e(e){c&&e.relatedTarget&&Xx(e)&&(e.type===`focusin`?_.current&&=(Qx(c),!1):(Zx(c),_.current=!0))}return Lb(Ib(c,`focusin`,e,!0),Ib(c,`focusout`,e,!0))},[c,v]),Y(()=>{!c||y!==!0||!_.current||(Qx(c),_.current=!1)},[y,c]);let x=H.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:g}),[c]);return(0,G.jsxs)(H.Fragment,{children:[u,(0,G.jsxs)(xS.Provider,{value:x,children:[b&&c&&(0,G.jsx)(qb,{"data-type":`outside`,ref:d,onFocus:e=>{Xx(e,c)?p.current?.focus():Kx(h?h.domReference:null)?.focus()}}),b&&c&&(0,G.jsx)(`span`,{"aria-owns":l,style:bS}),c&&Gs.createPortal(a,c),b&&c&&(0,G.jsx)(qb,{"data-type":`outside`,ref:f,onFocus:e=>{Xx(e,c)?m.current?.focus():(Gx(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,qy(`focus-out`,e.nativeEvent)))}})]})]})});function ES(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var DS=class{nodesRef={current:[]};events=ES();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},OS=H.createContext(null),kS=H.createContext(null),AS=()=>H.useContext(OS)?.id||null,jS=e=>{let t=H.useContext(kS);return e??t};function MS(e){let t=Zy(),n=jS(e),r=AS();return Y(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function NS(e){let{children:t,id:n}=e,r=AS();return(0,G.jsx)(OS.Provider,{value:H.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function PS(e){let{children:t,externalTree:n}=e,r=Tr(()=>n??new DS).current;return(0,G.jsx)(kS.Provider,{value:r,children:t})}function FS(e){return e==null?e:`current`in e?e.current:e}function IS(e,t){let n=oy(Sb(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var LS=20,RS=[];function zS(){RS=RS.filter(e=>e.deref()?.isConnected)}function BS(e){zS(),e&&ay(e)!==`body`&&(RS.push(new WeakRef(e)),RS.length>LS&&(RS=RS.slice(-20)))}function VS(){return zS(),RS[RS.length-1]?.deref()}function HS(e){return e?Vx(e)?e:Ux(e)[0]||e:null}function US(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Hx(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Vx(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function WS(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=jy(()=>b.current.floatingContext?.nodeId),S=i===!1,C=Ob(_)&&S,w=Rb(i),T=Rb(a),E=Rb(l),D=Rb(g),O=jS(p),k=SS(),A=H.useRef(!1),j=H.useRef(!1),M=H.useRef(!1),N=H.useRef(null),P=H.useRef(``),F=H.useRef(``),I=H.useRef(null),ee=H.useRef(null),L=Er(I,f,k?.beforeInsideRef),te=Er(ee,k?.afterInsideRef),R=rb(),z=rb(),B=Ub(),ne=k!=null,V=Ab(v),re=jy((e=V)=>e?Ux(e):[]),ie=jy(()=>m?.().filter(e=>e!=null)??[]);H.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&xb(V,bb(Ny(V)))&&re().length===0&&!C&&fb(e)}return Ib(Ny(V),`keydown`,e)},[r,V,s,C,re]),H.useEffect(()=>{if(r||!g)return;let e=Ny(V);function t(){M.current=!1}function n(e){let t=Sb(e),n=ie(),r=xb(v,t)||xb(_,t)||xb(k?.portalNode,t)||n.some(e=>e===t||xb(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,z.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return Lb(Ib(e,`pointerdown`,n,!0),Ib(e,`pointerup`,t,!0),Ib(e,`pointercancel`,t,!0),Ib(e,`keydown`,i,!0),t)},[r,v,_,V,g,k,z,ie]),H.useEffect(()=>{if(r||!c)return;let e=Ny(V);function t(){j.current=!0,z.start(0,()=>{j.current=!1})}function n(e){let t=Sb(e);Vx(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=Sb(t);s&&n==null&&i!=null&&xb(v,i)&&BS(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=ie(),f=n?.hasAttribute(tS(`focus-guard`))&&[I.current,ee.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,FS(d),FS(u)].includes(n),p=!(xb(_,n)||xb(v,n)||xb(n,v)||xb(k?.portalNode,n)||l.some(e=>e===n||xb(e,n))||c.hasMatchingElement(e=>xb(e,n))||f||O&&($x(O.nodesRef.current,a).find(e=>xb(e.context?.elements.floating,n)||xb(e.context?.elements.domReference,n))||eS(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,Ab(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&V&&US(V),o&&r!==_&&!Dx(i)&&bb(e)===e.body){if(uy(V)&&(V.focus(),o===`popup`)){B.request(()=>{V.focus()});return}let e=re(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||V;uy(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!j.current&&(C||n!==VS())&&(A.current=!0,h.setOpen(!1,qy(Hy,t)))})}function a(){M.current||(b.current.insideReactTree=!0,R.start(0,()=>{b.current.insideReactTree=!1}))}let l=uy(_)?_:null;if(!(!v&&!l))return Lb(l&&Ib(l,`focusout`,i),l&&Ib(l,`pointerdown`,t),v&&Ib(v,`focusin`,n),v&&Ib(v,`focusout`,i),v&&k&&Ib(v,`focusout`,a,!0))},[r,_,v,V,s,O,k,h,c,o,re,C,x,b,R,z,B,u,d,ie]),H.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${tS(`portal`)}]`)||[]),t=(O?eS(O.nodesRef.current,x()):[]).find(e=>Ob(e.context?.elements.domReference||null))?.context?.elements.domReference,n=hS([v,...e,I.current,ee.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...ie(),t,FS(d),FS(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=hS([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,ie]),Y(()=>{if(!g||r||!uy(V))return;P.current=``,F.current=``;let e=Ny(V),t=bb(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||xb(V,t))return;let i=null,a=()=>(i??=re(V),i[0]||V),o;o=r===!0||r===null?a():FS(r),o||=a();let s=xb(V,bb(e));rS(o,{preventScroll:o===V,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=bb(e);return!(t!==o&&xb(V,t))}})})},[r,g,V,re,w,E,D]),Y(()=>{if(r||!V)return;let e=Ny(V),t=bb(e),n=E.current==null;BS(t);function i(e){if(e.open||(P.current=IS(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`){if(e.nested)A.current=!1;else if(pb(e.nativeEvent)||mb(e.nativeEvent))A.current=!1;else{let e=!1;Ny(V).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&ay(t)!==`body`?t:null,s=n?o||a:a||o;return s||=VS()||null,typeof i==`boolean`?s:FS(i)||s||null}return()=>{y.off(`openchange`,i);let t=bb(e),n=ie(),r=xb(v,t)||n.some(e=>e===t||xb(e,t))||O&&$x(O.nodesRef.current,x(),!1).some(e=>xb(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=HS(c),i=typeof o!=`boolean`;if(o&&!A.current&&uy(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}A.current=!1})}},[r,v,V,T,E,y,O,_,x,ie]),Y(()=>{if(!ub||g||!v)return;let e=bb(Ny(v));!uy(e)||!Eb(e)||xb(v,e)&&e.blur()},[g,v]),Y(()=>{if(!(r||!k))return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),Y(()=>{if(!(r||!V))return US(V),()=>{queueMicrotask(zS)}},[r,V]);let ae=!r&&(!s||!C)&&(ne||s);return(0,G.jsxs)(H.Fragment,{children:[ae&&(0,G.jsx)(qb,{"data-type":`inside`,ref:L,onFocus:e=>{if(s){let e=re();rS(e[e.length-1])}else k?.portalNode&&(A.current=!1,Xx(e,k.portalNode)?Gx(_)?.focus():FS(d??k.beforeOutsideRef)?.focus())}}),n,ae&&(0,G.jsx)(qb,{"data-type":`inside`,ref:te,onFocus:e=>{s?rS(re()[0]):k?.portalNode&&(c&&(A.current=!0),Xx(e,k.portalNode)?Kx(_)?.focus():FS(u??k.afterOutsideRef)?.focus())}})]})}function GS(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Ry}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=H.useRef(void 0),f=Ub(),p=rb(),m=H.useMemo(()=>{function e(e,t,n,r){let i=qy(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=hb(e.pointerType,!0)&&mb(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||hb(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=Sb(o);if(Eb(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}hb(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return H.useMemo(()=>n?{reference:m}:Lr,[n,m])}function KS(){return!1}function qS(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function JS(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=KS,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f}=l.context,p=jS(c),m=jy(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=jy(()=>a),{escapeKey:v,outsidePress:y}=qS(s),b=H.useRef(!1),x=H.useRef(!1),S=H.useRef(!1),C=H.useRef(!1),w=H.useRef(``),T=H.useRef(null),E=rb(),D=rb(),O=jy(()=>{D.clear(),f.current.insideReactTree=!1}),k=jy(e=>{let t=f.current.floatingContext?.nodeId;return(p?$x(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),A=jy(e=>wb(e,l.select(`floatingElement`))||wb(e,l.select(`domReferenceElement`))),j=jy(e=>{o()&&l.setOpen(!1,qy(Ry,e.nativeEvent))}),M=jy(e=>{if(!u||!n||!r||e.key!==`Escape`||C.current||!v&&k(`__escapeKeyBubbles`))return;let t=qy(ote,hte(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!v&&!t.isPropagationAllowed&&e.stopPropagation()}),N=jy(()=>{f.current.insideReactTree=!0,D.start(0,O)}),P=jy(e=>{if(!u||!n||e.button!==0)return;let t=Sb(e.nativeEvent);xb(l.select(`floatingElement`),t)&&(b.current||(b.current=!0,x.current=!1))}),F=jy(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});H.useEffect(()=>{if(!u||!n)return O;f.current.__escapeKeyBubbles=v,f.current.__outsidePressBubbles=y;let e=new nb,t=new nb;function i(){e.clear(),C.current=!0}function a(){e.start(ub?5:0,()=>{C.current=!1})}function o(){S.current=!0,t.start(0,()=>{S.current=!1})}function s(){b.current=!1,x.current=!1}function c(){let e=w.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function D(e){let t=f.current.floatingContext?.nodeId,n=p&&$x(p.nodesRef.current,t).some(t=>wb(e,t.context?.elements.floating));return A(e)||n}function j(e){if(m(e)){e.type!==`click`&&!A(e)&&(t.clear(),S.current=!1),O();return}if(f.current.insideReactTree){O();return}let n=Sb(e),r=`[${tS(`inert`)}]`,i=ly(n)?n.getRootNode():null,a=Array.from((dy(i)?i:Ny(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>xb(e,n))))return;let s=ly(n)?n:null;for(;s&&!Sy(s);){let e=Ty(s);if(Sy(e)||!ly(e))break;s=e}if(!(a.length&&ly(n)&&!Tb(n)&&!xb(n,l.select(`floatingElement`))&&a.every(e=>!xb(s,e)))){if(uy(n)&&!(`touches`in e)){let t=Sy(n),r=Cy(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!D(e)){if(c()===`intentional`&&S.current){t.clear(),S.current=!1;return}typeof h==`function`&&!h(e)||k(`__outsidePressBubbles`)||(l.setOpen(!1,qy(ite,e)),O())}}}function N(e){c()!==`sloppy`||e.pointerType===`touch`||!l.select(`open`)||!n||A(e)||j(e)}function P(e){if(c()!==`sloppy`||!l.select(`open`)||!n||A(e))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=Sb(e);if(!n)return;let r=Ib(n,e.type,()=>{t(e),r()})}function I(e){w.current=`touch`,F(e,P)}function ee(e){E.clear(),e.type===`pointerdown`&&(w.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?N(e):j(e)})}function L(e){if(!b.current)return;let n=x.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!D(e)){if(n){o();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,O())}}}function te(e){if(c()!==`sloppy`||!T.current||A(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-T.current.startX),r=Math.abs(t.clientY-T.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(T.current.dismissOnTouchEnd=!0),i>10&&(j(e),E.clear(),T.current=null)}function R(e){F(e,te)}function z(e){c()!==`sloppy`||!T.current||A(e)||(T.current.dismissOnTouchEnd&&j(e),E.clear(),T.current=null)}function B(e){F(e,z)}let ne=Ny(d),V=Lb(r&&Lb(Ib(ne,`keydown`,M),Ib(ne,`compositionstart`,i),Ib(ne,`compositionend`,a)),g&&Lb(Ib(ne,`click`,ee,!0),Ib(ne,`pointerdown`,ee,!0),Ib(ne,`pointerup`,L,!0),Ib(ne,`pointercancel`,L,!0),Ib(ne,`mousedown`,ee,!0),Ib(ne,`mouseup`,L,!0),Ib(ne,`touchstart`,I,!0),Ib(ne,`touchmove`,R,!0),Ib(ne,`touchend`,B,!0)));return()=>{V(),e.clear(),t.clear(),s(),S.current=!1,O()}},[f,d,r,g,h,u,n,v,y,M,O,_,k,A,p,l,E]);let I=H.useMemo(()=>({onKeyDown:M,onPointerDown:j,onClick:j}),[M,j]),ee=H.useMemo(()=>({onKeyDown:M,onPointerDown:F,onMouseDown:F,onClickCapture:N,onMouseDownCapture(e){N(),P(e)},onPointerDownCapture(e){N(),P(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,P,F]);return H.useMemo(()=>n?{reference:I,floating:ee,trigger:I}:{},[n,I,ee])}function YS(e,t,n){let{reference:r,floating:i}=e,a=ox(t),o=sx(t),s=ax(o),c=nx(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=rx(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function XS(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=tx(t,e),p=yx(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=bx(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=bx(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ZS=50,QS=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:XS},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=YS(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ZS&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=YS(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},$S=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=tx(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=nx(r),_=ox(o),v=nx(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[_x(o)]:lx(o)),x=p!==`none`;!d&&x&&b.push(...gx(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=cx(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===ox(t)||T.every(e=>ox(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=ox(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},eC=new Set([`left`,`top`]);async function tC(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=nx(n),s=rx(n),c=ox(n)===`y`,l=eC.has(o)?-1:1,u=a&&c?-1:1,d=tx(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var nC=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await tC(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},rC=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=tx(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=ox(i),p=ix(f),m=u[p],h=u[f],g=(e,t)=>ex(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},iC=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=tx(e,t),u={x:n,y:r},d=ox(i),f=ix(d),p=u[f],m=u[d],h=tx(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=eC.has(nx(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},aC=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=tx(e,t),c=await i.detectOverflow(t,s),l=nx(n),u=rx(n),d=ox(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Jb(p-c[m],g),y=Jb(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Yb(c.left,c.right):S=p-2*Yb(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function oC(e){let t=Cy(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=uy(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Xb(n)!==a||Xb(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function sC(e){return ly(e)?e:e.contextElement}function cC(e){let t=sC(e);if(!uy(t))return Qb(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=oC(t),o=(a?Xb(n.width):n.width)/r,s=(a?Xb(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var lC=Qb(0);function uC(e){let t=oy(e);return!xy()||!t.visualViewport?lC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dC(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===oy(e)}function fC(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=sC(e),o=Qb(1);t&&(r?ly(r)&&(o=cC(r)):o=cC(e));let s=dC(a,n,r)?uC(a):Qb(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=oy(a),t=ly(r)?oy(r):r,n=e,i=Oy(n);for(;i&&t!==n;){let e=cC(i),t=i.getBoundingClientRect(),r=Cy(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=oy(i),i=Oy(n)}}return bx({width:u,height:d,x:c,y:l})}function pC(e,t){let n=wy(e).scrollLeft;return t?t.left+n:fC(sy(e)).left+n}function mC(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-pC(e,n),y:n.top+t.scrollTop}}function hC(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=sy(r),s=t?my(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Qb(1),u=Qb(0),d=uy(r);if((d||!a)&&((ay(r)!==`body`||fy(o))&&(c=wy(r)),d)){let e=fC(r);l=cC(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?mC(o,c):Qb(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function gC(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function _C(e){let t=wy(e),n=e.ownerDocument.body,r=Yb(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Yb(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+pC(e),o=-t.scrollTop;return Cy(n).direction===`rtl`&&(a+=Yb(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var vC=25;function yC(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=oy(e),a=sy(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!xy()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(pC(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=vC&&(s-=o)}return{width:s,height:c,x:l,y:u}}function bC(e,t){let n=fC(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=cC(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function xC(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=yC(e,n,t);else if(t===`document`)r=_C(sy(e));else if(ly(t))r=bC(t,n);else{let n=uC(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return bx(r)}function SC(e,t){let n=t.get(e);if(n)return n;let r=Dy(e,[],!1).filter(e=>ly(e)&&ay(e)!==`body`),i=null,a=Cy(e).position===`fixed`,o=a?Ty(e):e;for(;ly(o)&&!Sy(o);){let e=Cy(o),t=yy(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Ty(o)}return t.set(e,r),r}function CC(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?my(t)?[]:SC(t,this._c):[].concat(n),r],o=xC(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=xC(t,a[e],i);s=Yb(n.top,s),c=Jb(n.right,c),l=Jb(n.bottom,l),u=Yb(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function wC(e){let{width:t,height:n}=oC(e);return{width:t,height:n}}function TC(e,t,n){let r=uy(t),i=sy(t),a=n===`fixed`,o=fC(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Qb(0);if((r||!a)&&((ay(t)!==`body`||fy(i))&&(s=wy(t)),r)){let e=fC(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=pC(i));let l=i&&!r&&!a?mC(i,s):Qb(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function EC(e){return Cy(e).position===`static`}function DC(e,t){if(!uy(e)||Cy(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return sy(e)===n&&(n=n.ownerDocument.body),n}function OC(e,t){let n=oy(e);if(my(e))return n;if(!uy(e)){let t=Ty(e);for(;t&&!Sy(t);){if(ly(t)&&!EC(t))return t;t=Ty(t)}return n}let r=DC(e,t);for(;r&&py(r)&&EC(r);)r=DC(r,t);return r&&Sy(r)&&EC(r)&&!yy(r)?n:r||by(e)||n}var kC=async function(e){let t=this.getOffsetParent||OC,n=this.getDimensions,r=await n(e.floating);return{reference:TC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function AC(e){return Cy(e).direction===`rtl`}var jC={convertOffsetParentRelativeRectToViewportRelativeRect:hC,getDocumentElement:sy,getClippingRect:CC,getOffsetParent:OC,getElementRects:kC,getClientRects:gC,getDimensions:wC,getScale:cC,isElement:ly,isRTL:AC};function MC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function NC(e,t,n){let r=null,i,a=sy(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Zb(d),h=Zb(a.clientWidth-(u+f)),g=Zb(a.clientHeight-(d+p)),_=Zb(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Yb(0,Jb(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!MC(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=oy(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function PC(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=sC(e),u=i||a?[...l?Dy(l):[],...t?Dy(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?NC(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?fC(e):null;c&&g();function g(){let t=fC(e);h&&!MC(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var FC=nC,IC=rC,LC=$S,RC=aC,zC=iC,BC=(e,t,n)=>{let r=new Map,i=n??{},a={...jC,...i.platform,_c:r};return QS(e,t,{...i,platform:a})},VC=typeof document<`u`?H.useLayoutEffect:function(){};function HC(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,i;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(!HC(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!HC(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function UC(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function WC(e,t){let n=UC(e);return Math.round(t*n)/n}function GC(e){let t=H.useRef(e);return VC(()=>{t.current=e}),t}function KC(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=H.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=H.useState(r);HC(f,r)||p(r);let[m,h]=H.useState(null),[g,_]=H.useState(null),v=H.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=H.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=H.useRef(null),C=H.useRef(null),w=H.useRef(u),T=c!=null,E=GC(c),D=GC(i),O=GC(l),k=H.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),BC(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!HC(w.current,t)&&(w.current=t,Gs.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);VC(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=H.useRef(!1);VC(()=>(A.current=!0,()=>{A.current=!1}),[]),VC(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=H.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=H.useMemo(()=>({reference:b,floating:x}),[b,x]),N=H.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=WC(M.floating,u.x),r=WC(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...UC(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return H.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var qC=(e,t)=>{let n=FC(e);return{name:n.name,fn:n.fn,options:[e,t]}},JC=(e,t)=>{let n=IC(e);return{name:n.name,fn:n.fn,options:[e,t]}},YC=(e,t)=>({fn:zC(e).fn,options:[e,t]}),XC=(e,t)=>{let n=LC(e);return{name:n.name,fn:n.fn,options:[e,t]}},ZC=(e,t)=>{let n=RC(e);return{name:n.name,fn:n.fn,options:[e,t]}};function QC(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function $C(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function ew(e){let t=[],n,r=1/0,i=1/0,a=-1/0,o=-1/0;for(let s of Array.from(e).sort((e,t)=>e.top-t.top)){if(r=Math.min(r,s.left),i=Math.min(i,s.top),a=Math.max(a,s.right),o=Math.max(o,s.bottom),!n||s.top-n.top>n.height/2)t.push($C(s));else{let e=t[t.length-1];e.left=Math.min(e.left,s.left),e.right=Math.max(e.right,s.right),e.bottom=Math.max(e.bottom,s.bottom),e.width=e.right-e.left,e.height=e.bottom-e.top}n=s}return{lines:t,fallback:QC(r,i,a,o)}}function tw(e,t,n){return e.findIndex(e=>t>e.left-2&&t<e.right+2&&n>e.top-2&&n<e.bottom+2)}function nw(e){return QC(e.left,e.top,e.right,e.bottom)}function rw(e,t,n){let{lines:r}=ew(e.getClientRects());if(r.length<2)return;let i=tw(r,t,n);return{x:t,y:n,lineIndex:i===-1?void 0:i,element:e}}function iw(e,t,n){let{lines:r,fallback:i}=ew(e.getClientRects());if(r.length<2)return null;let a=n?.x,o=n?.y,s=t[0];if(n?.lineIndex!=null&&r[n.lineIndex])return nw(r[n.lineIndex]);if(a!=null&&o!=null){let e=tw(r,a,o);if(e!==-1)return nw(r[e])}if(r.length===2&&r[0].left>r[1].right&&a!=null&&o!=null)return i;if(s===`t`||s===`b`){let e=r[0],t=r[r.length-1],n=s===`t`?e:t;return QC(n.left,e.top,n.right,t.bottom)}let c=s===`l`,l=r[0].left,u=r[0].right,d=c?1/0:-1/0,f=r[0],p=r[0];for(let e of r){l=Math.min(l,e.left),u=Math.max(u,e.right);let t=c?e.left:e.right;c&&t<d||!c&&t>d?(d=t,f=e,p=e):t===d&&(p=e)}return QC(l,f.top,u,p.bottom)}function aw(e){return`contextElement`in e&&e.contextElement?e.contextElement:ly(e)?e:void 0}function ow(e,t){function n(t){sw(e,t.currentTarget,t.clientX,t.clientY)}function r(e){t||n(e)}return{onFocus(){e.current=void 0},onMouseEnter:r,onMouseMove:r}}function sw(e,t,n,r){let i=rw(t,n,r);return e.current=i,i}function cw(e){return{name:`inline`,async fn(t){let n=t.elements.reference;if(typeof n?.getClientRects!=`function`)return{};let r=aw(n),i=e.current,a=i?.element===n||i?.element===r?i:void 0,o=iw(n,t.placement,a);if(!o||typeof t.platform.getElementRects!=`function`)return{};let s=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return o}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===s.reference.x&&t.rects.reference.y===s.reference.y&&t.rects.reference.width===s.reference.width&&t.rects.reference.height===s.reference.height?{}:{reset:{rects:s}}}}}var lw=n((e=>{var t=g();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),uw=n(((e,t)=>{t.exports=lw()})),dw=n((e=>{var t=g(),n=uw();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),fw=n(((e,t)=>{t.exports=dw()})),pw=[],mw=void 0;function hw(){return mw}function gw(e){pw.push(e)}function _w(e){let t=(t,n)=>{let r=Tr(yw).current,i;try{mw=r;for(let e of pw)e.before(r);i=e(t,n);for(let e of pw)e.after(r);r.didInitialize=!0}finally{mw=void 0}return i};return t.displayName=e.displayName||e.name,t}function vw(e){return H.forwardRef(_w(e))}function yw(){return{didInitialize:!1}}var bw=uw(),xw=fw(),Sw=Nr(19)?Tw:Ew;function Cw(e,t,n,r,i){return Sw(e,t,n,r,i)}function ww(e,t,n,r,i){let a=H.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,bw.useSyncExternalStore)(e.subscribe,a,a)}gw({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,bw.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Tw(e,t,n,r,i){let a=hw();if(!a)return ww(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Ew(e,t,n,r,i){return(0,xw.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var yte=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Cw(this,e,t,n,r)}},Dw=class extends yte{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){H.useDebugValue(e);let n=this;Y(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Y(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Y(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){H.useDebugValue(e);let n=this,r=t!==void 0;Y(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return H.useDebugValue(e),Cw(this,this.selectors[e],t,n,r)}useContextCallback(e,t){H.useDebugValue(e);let n=jy(t??Fr);this.context[e]=n}useStateSetter(e){let t=H.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},bte={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},Ow=class extends Dw{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:ES(),nested:n,triggerElements:i},bte),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&gte(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function kw(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=H.useRef(null);r===void 0&&f.current===null&&(f.current=new Ow({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),Y(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};ly(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function Aw(e,t=!1,n=!1){let[r,i]=H.useState(e&&t?`idle`:void 0),[a,o]=H.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Y(()=>{if(!e&&a&&r!==`ending`&&n){let e=Hb.request(()=>{i(`ending`)});return()=>{Hb.cancel(e)}}},[e,a,r,n]),Y(()=>{if(!e||t)return;let n=Hb.request(()=>{i(void 0)});return()=>{Hb.cancel(n)}},[t,e]),Y(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=Hb.request(()=>{i(`idle`)});return()=>{Hb.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function jw(e,t=!1){let n=Ub();return jy((r,i=null)=>{n.cancel();let a=FS(e);if(a==null)return;let o=a,s=()=>{Gs.flushSync(r)};if(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{i?.aborted||s()},()=>{if(!i?.aborted){if(o.getAnimations().some(e=>e.pending||e.playState!==`finished`)){c();return}s()}})}if(t){let e=`data-starting-style`;if(!o.hasAttribute(e)){n.request(c);return}let t=new MutationObserver(()=>{o.hasAttribute(e)||(t.disconnect(),c())});t.observe(o,{attributes:!0,attributeFilter:[e]}),i?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}n.request(c)})}function Mw(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=jy(i),o=jw(r,n);H.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var Nw={tabIndex:-1,[_te]:``};function Pw(e){return t=>t!==`touch`||e.current}function Fw(e,t=!1){let n=Zy(),r=AS()!=null,i=Tr(()=>e(n,r)).current;return kw({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function Iw({handle:e,store:t}){return Y(()=>e.attachStore(t),[e,t]),null}function xte(e,t){let n=H.useRef(null),r=H.useRef(null);return H.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function Lw(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function Rw(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Ste(e,t,n,r={}){let i=n.reason,a=i===zy,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Rw(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i={...r.extraState,open:t};o?i.instantType=`focus`:s?i.instantType=`dismiss`:a&&(i.instantType=void 0),Lw(i,t,n.trigger,c()),e.update(i)};a?Gs.flushSync(l):l()}function zw(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=xte(e,n),o=jy(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){n.update({activeTriggerElement:t,...i?r:null});return}a==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})}),s=H.useCallback(e=>{a(e),e&&o(e)},[a,o]);return Y(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Bw(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=H.useRef(null),i=e.useState(`open`);Y(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=qy(Ly);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function Vw(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=Aw(e),o=t.useState(`preventUnmountingOnClose`),s=!e&&o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=jy(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Mw({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function Hw(e,t){e.useSyncedValues(t),Y(()=>()=>{e.update({activeTriggerProps:Lr,inactiveTriggerProps:Lr,popupProps:Lr})},[e])}function Uw(e,t){Y(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Y(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var Ww=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function Cte(){return new Ow({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ww,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Gw(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Cte(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Lr,inactiveTriggerProps:Lr,popupProps:Lr}}function Kw(e,t,n=!1){return new Ow({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var qw=e=>e.triggerIdProp??e.activeTriggerId,Jw=e=>e.openProp??e.open,Yw=e=>(e.popupElement?.id??e.floatingId)||void 0;function Xw(e,t){return t!==void 0&&Jw(e)&&qw(e)===t}function wte(e,t){return Xw(e,t)?!0:t!==void 0&&Jw(e)&&qw(e)==null&&e.triggerCount===1}var Zw={open:Jw,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:qw,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Yw,isTriggerActive:(e,t)=>t!==void 0&&qw(e)===t,isOpenedByTrigger:(e,t)=>Xw(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&qw(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>wte(e,t)?Yw(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Qw(e){let t=H.useCallback(t=>e===void 0?Fr:e.subscribeStore(t),[e]),n=H.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,bw.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Tte(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Zy(),a=AS()!=null,o=Tr(()=>new Ow({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ww,floatingId:i,syncOnly:!1,nested:a})).current;return Y(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=ly(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Ete(e){return Dte(e,e.rootContext)}function Dte(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=H.useState(null),[d,f]=H.useState(void 0),[p,m]=H.useState(void 0),h=H.useRef(null),g=jS(r),_=H.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=KC({...e,elements:{..._,...l&&{reference:l}}}),y=ly(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=H.useCallback(e=>{let t=ly(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=H.useCallback(e=>{(ly(e)||e===null)&&(h.current=e,f(e)),(ly(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!ly(e))&&v.refs.setReference(e)},[v.refs,f]),C=H.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=H.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=H.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=H.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return Y(()=>{o&&(h.current=o)},[o]),Y(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),H.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var $w=lb&&ub;function eT(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=H.useRef(!1),c=H.useRef(null),l=H.useRef(!0),u=rb();H.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=oy(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&uy(e)&&e===bb(Ny(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return Lb(Ib(t,`blur`,r),$w&&Ib(t,`keydown`,a,!0),$w&&Ib(t,`pointerdown`,o,!0))},[i,n]),H.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);ly(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=H.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=Sb(t.nativeEvent);if(ly(a)){if($w&&!t.relatedTarget){if(!l.current&&!Eb(a))return}else if(!kb(a))return}let o=Cb(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,qy(By,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,qy(By,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=ly(n)&&n.hasAttribute(tS(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=bb(Ny(e));!n&&t===e||xb(o.current.floatingContext?.refs.floating.current,t)||xb(e,t)||a||Cb(n??t,i.context.triggerElements)||i.setOpen(!1,qy(By,r))})}}},[o,r,i,u]);return H.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Ote=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new nb,this.restTimeout=new nb,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},tT=new WeakMap;function nT(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&tT.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),tT.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function rT(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=tT.get(n);a&&a!==e&&nT(a),nT(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,tT.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function iT(e){let t=e.context.dataRef.current,n=Tr(()=>t.hoverInteractionState??Ote.create()).current;return t.hoverInteractionState||=n,eb(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function aT(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=jS(),d=AS(),f=iT(a),p=rb(),m=jy(()=>Pb(l.current.openEvent?.type,f.interactedInside)),h=jy(()=>Fb(l.current.openEvent?.type)),g=jy(()=>{nT(f)});Y(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),H.useEffect(()=>g,[g]),Y(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&ly(c)&&s){let e=c,t=s,n=Ny(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return rT(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),H.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&$x(u.nodesRef.current,d).length>0)}function t(e){let t=Mb(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,qy(zy,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=Sb(e);if(!Db(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(Cb(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&ly(o)&&$x(u.nodesRef.current,r,!1).some(e=>xb(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,qy(zy,t)),u.events.emit(`floating.closed`,t)})}let y=s;return Lb(y&&Ib(y,`mouseenter`,c),y&&Ib(y,`mouseleave`,_),y&&Ib(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var kte={current:null};function oT(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=kte,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=jS(l),y=iT(h),b=H.useRef(!1),x=Rb(i),S=Rb(r),C=Rb(o),w=Rb(n),T=Rb(p),E=Rb(f),D=jy(()=>Pb(g.current.openEvent?.type,y.interactedInside)),O=jy(()=>T.current?.()!==!1),k=jy((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!xb(e,t);if(!ly(n))return!1;let i=n;return r.hasMatchingElement(e=>xb(e,i))&&(!e||!xb(e,i))}),A=jy(()=>{y.handler&&=(Ny(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=jy(()=>{nT(y)});return u&&(y.handleCloseOptions=x.current?.__options),H.useEffect(()=>A,[A]),H.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===zy,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),H.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Mb(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,qy(zy,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,qy(zy,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!ly(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!hb(y.pointerType))return;let t=Nb(C.current),n=Mb(S.current,`open`,y.pointerType),r=Sb(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(ly(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(xb(e,r)){s=e;break}}ly(i)&&ly(o)&&!h.context.triggerElements.hasElement(i)&&xb(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&ly(s)&&ly(o)&&xb(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){O()&&h.setOpen(!0,qy(zy,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,qy(zy,e,s))}):g&&O()&&h.setOpen(!0,qy(zy,e,s)))}function i(t){if(D()){j();return}A();let n=Ny(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!Cb(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!xb(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){xb(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?Ib(t,`mouseout`,o):void 0;return s?Lb(Ib(t,`mousemove`,r,{once:!0}),Ib(t,`mouseenter`,r),Ib(t,`mouseleave`,i),l):Lb(Ib(t,`mouseenter`,r),Ib(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),H.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!hb(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;rT(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Nb(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,qy(zy,t,n))}y.pointerType===`touch`?Gs.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var Ate=`Escape`;function sT(e){return ub&&e.movementX===0&&e.movementY===0}function cT(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function lT(e,t){return cT(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function uT(e,t,n){return cT(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function jte(e,t,n){return cT(t,n?e===gb:e===_b,e===yb)}function Mte(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Ate:cT(t,n?e===_b:e===gb,e===vb)}function dT(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=Ab(T),k=Ob(E),A=Rb(O),j=AS(),M=jS(b),N=H.useRef(f),P=H.useRef(o??-1),F=H.useRef(null),I=H.useRef(!0),ee=jy(e=>{i(P.current===-1?null:P.current,e)}),L=H.useRef(!!T),te=H.useRef(w),R=H.useRef(!1),z=H.useRef(!1),B=H.useRef(null),ne=Rb(h),V=Rb(w),re=Rb(o),ie=Rb(y),ae=Ub(),oe=Ub(),se=jy(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):B.current=rS(e,{sync:R.current,preventScroll:!0})}let t=n.current[P.current],r=z.current;t&&e(t),(R.current?e=>e():e=>ae.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),pe&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Y(()=>{D.current.orientation=g},[D,g]),Y(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(z.current=!0,ee())):L.current&&(P.current=-1,ee()))},[a,w,T,o,ee]),Y(()=>{if(a){if(!w){R.current=!1;return}if(T){if(r==null){if(R.current=!1,re.current!=null)return;if(L.current&&(P.current=-1,se()),(!te.current||!L.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>oe.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||uT(F.current,g,u)||l?Sx(n):Cx(n),F.current=null,ee())};t()}}else xx(n.current,r)||(P.current=r,se(),z.current=!1)}}},[a,w,T,r,re,l,n,g,u,ee,se,oe]),Y(()=>{if(!a||T||!M||d||!L.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=bb(Ny(E??t??null)),r=e.some(e=>e.context&&xb(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),Y(()=>{te.current=w,L.current=!!T}),Y(()=>{w||(F.current=null,N.current=f)},[w,f]);let ce=r!=null,le=jy(e=>{if(!V.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,ee(e))}),ue=jy(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),de=jy(()=>Sx(n,ne.current)),fe=jy(e=>{if(I.current=!1,R.current=!0,e.which===229||!V.current&&e.currentTarget===A.current)return;if(l&&Mte(e.key,g,u,S)){lT(e.key,ue())||fb(e),C.setOpen(!1,qy(Uy,e.nativeEvent)),uy(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=Sx(n,h),i=Cx(n,h);if(k||(e.key===`Home`&&(fb(e),P.current=r,ee(e)),e.key===`End`&&(fb(e),P.current=i,ee(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,ee(e)),g===`both`)return}if(lT(e.key,g)){if(fb(e),w&&!d&&bb(e.currentTarget.ownerDocument)===e.currentTarget){P.current=uT(e.key,g,u)?r:i,ee(e);return}uT(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(R.current=!1,P.current=r):P.current=wx(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,wx(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(R.current=!1,P.current=i):P.current=wx(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,wx(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),xx(n.current,P.current)&&(P.current=-1),ee(e)}}),pe=H.useMemo(()=>({onFocus(e){R.current=!0,le(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){sT(e)||(R.current=!0,z.current=!1,p&&le(e))},onPointerLeave(e){if(!V.current||!I.current||e.pointerType===`touch`)return;R.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&ie.current&&(B.current?.(),B.current=null,P.current=-1,ee(e),!d)){let e=A.current,t=bb(Ny(e));e&&xb(e,t)&&e.focus({preventScroll:!0})}}}),[le,V,A,p,n,ee,ie,d]),me=H.useMemo(()=>d&&w&&ce&&{"aria-activedescendant":`${v}-${r}`},[d,w,ce,v,r]),he=H.useMemo(()=>({"aria-orientation":g===`both`?void 0:g,...k?{}:me,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=Sb(e.nativeEvent);if(t&&!xb(A.current,t))return;fb(e),C.setOpen(!1,qy(Hy,e.nativeEvent)),uy(E)&&E.focus();return}fe(e)},onPointerMove(e){sT(e)||(I.current=!0)}}),[me,fe,A,g,k,C,w,d,E]),ge=H.useMemo(()=>{function e(e){C.setOpen(!0,qy(Uy,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&pb(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&mb(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=jte(t.key,ue(),u),a=lT(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return fe(t);if(!(!n&&!m&&r)){if(o){let e=lT(t.key,ue());F.current=l&&e?null:t.key}if(l){i&&(fb(t),n?(P.current=de(),ee(t)):e(t));return}a&&(re.current!=null&&(P.current=re.current),fb(t),!n&&m?e(t):fe(t),n&&ee(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,ee(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[fe,f,de,l,ee,C,m,g,ue,u,re,d]),_e=H.useMemo(()=>({...me,...ge}),[me,ge]);return H.useMemo(()=>a?{reference:_e,floating:he,item:pe,trigger:ge}:{},[a,_e,he,ge,pe])}function fT(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=rb(),m=H.useRef(``),h=H.useRef(u??i??-1),g=H.useRef(null),_=jy(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!Dx(n)||n?.matches(`:disabled`)?!1:o==null||!Tx(Ir,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!c(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(fb(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(fb(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=jy(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);xb(n,t)||xb(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});Y(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=H.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return H.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var pT=.1,Nte=pT*pT,mT=.5;function hT(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function gT(e,t,n,r,i,a,o,s,c,l){let u=!1;return hT(e,t,n,r,i,a)&&(u=!u),hT(e,t,i,a,o,s)&&(u=!u),hT(e,t,o,s,c,l)&&(u=!u),hT(e,t,c,l,n,r)&&(u=!u),u}function Pte(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function _T(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function vT(e={}){let{blockPointerEvents:t=!1}=e,n=new nb,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*Nte;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Sb(r),g=r.type===`mouseleave`,_=xb(u,h),v=xb(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&ly(r.relatedTarget)&&xb(u,r.relatedTarget))return;function y(){return!!(s&&$x(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=_T(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=_T(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=_T(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=_T(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!Pte(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?mT/2:mT*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+mT+1,o=C||T?S.bottom-mT:S.top,s=C?T?S.bottom-mT:S.top:S.bottom-mT;M=gT(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?mT/2:mT*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-mT,o=C||T?S.top+mT:S.bottom,s=C?T?S.top+mT:S.bottom:S.top+mT;M=gT(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?mT/2:mT*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+mT+1,o=w||E?S.right-mT:S.left,s=w?E?S.right-mT:S.left:S.right-mT;M=gT(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?mT/2:mT*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-mT,o=w||E?S.left+mT:S.right,s=w?E?S.left+mT:S.right:S.left+mT;M=gT(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var yT=H.createContext(void 0);function bT(){let e=H.useContext(yT);if(e===void 0)throw Error(Cr(26));return e}var xT=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),ST={...ty,...qv,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},CT=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Uv(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);bT(),Mw({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?Pw(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=Vr(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...Nw,hidden:!m,onKeyDown(e){xT.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:ST});return(0,G.jsx)(WS,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function wT(e){return Nr(19)?e:e?`true`:void 0}var TT=H.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,G.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),ET=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Uv(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,G.jsx)(yT.Provider,{value:n,children:(0,G.jsxs)(TS,{ref:t,...r,children:[a&&o===!0&&(0,G.jsx)(TT,{ref:i.context.internalBackdropRef,inert:wT(!s)}),e.children]})}):null}),DT={},OT={},kT=``;function AT(e,t){return fy(e)?e:t}function jT(e,t,n){return/hidden|clip/.test(e.getComputedStyle(AT(t,n)).overflowY)}function Fte(e){if(typeof document>`u`)return!1;let t=Ny(e);return oy(t).innerWidth-t.documentElement.clientWidth>0}function Ite(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Ny(e),n=t.documentElement,r=t.body,i=AT(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Lte(e){let t=Ny(e),n=t.documentElement,r=t.body,i=AT(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Rte(e){let t=Ny(e),n=t.documentElement,r=t.body,i=oy(n),a=0,o=0,s=!1,c=Hb.create();if(ub&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,DT={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},kT=n.style.scrollBehavior,OT={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=AT(n,r);if(s=Ite(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,DT),Object.assign(r.style,OT),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=kT)}function d(){u(),c.request(l)}l();let f=Ib(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var zte=new class{lockCount=0;restore=null;timeoutLock=nb.create();timeoutUnlock=nb.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Ny(e),n=t.documentElement,r=t.body,i=oy(n);if(jT(i,n,r)){let t=new i.MutationObserver(()=>{jT(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=ob||!Fte(e);this.restore=a?Lte(e):Rte(e)}};function MT(e=!0,t=null){Y(()=>{if(e)return zte.acquire(t)},[e,t])}function Bte({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=H.useState(0),[u,d]=H.useState(0),f=c===0,p=JS(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Sb(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||xb(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return MT(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),Y(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),Hw(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var Vte={...Zw,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Hte=class extends Dw{constructor(e,t,n){let r=new Ww,i=Ute(e,r,t,n);super(i,Wte(r),Vte)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};Lw(n,e,t.trigger),this.update(n)}};function Ute(e,t,n,r=!1){let i={...Gw(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=Kw(t,n,r),i}function Wte(e){return{popupRef:H.createRef(),backdropRef:H.createRef(),internalBackdropRef:H.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function NT(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=Uv(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=Fw((e,t)=>new Hte({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);Uw(b,x),Bw(b);let{forceUnmount:w}=Vw(x,b);H.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,qy(Ky))}),[w,b]);let T=x||S;return(0,G.jsxs)(Hv.Provider,{value:b,children:[u&&(0,G.jsx)(Iw,{handle:u,store:b}),T&&(0,G.jsx)(Bte,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}function PT(e){return NT(`dialog`,e)}var FT=H.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=bT(),c=Uv(),l=c.useState(`open`),u=c.useState(`nested`),d=c.useState(`transitionStatus`),f=c.useState(`nestedOpenDialogCount`),p=c.useState(`mounted`),m=c.useStateSetter(`viewportElement`);return Vr(`div`,e,{enabled:s||p,state:{open:l,nested:u,transitionStatus:d,nestedDialogOpen:f>0},ref:[t,m],stateAttributesMapping:ST,props:[{role:`presentation`,hidden:!p,style:{pointerEvents:l?void 0:`none`},children:a},o]})}),IT=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Uv(),c=Qy(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Vr(`h2`,e,{ref:t,props:[{id:c},o]})});function Gte(e){let t=H.useRef(``),n=H.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:H.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function LT(e,t){let n=H.useRef(e),r=jy(t);Y(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function RT(e,t){let{onClick:n,onPointerDown:r}=Gte(jy((n,r)=>{(typeof e==`function`?e():e)||t(r||(ob?`touch`:``))}));return H.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function zT(e){let[t,n]=H.useState(null),r=RT(e,n);return LT(e,t=>{t&&!e&&n(null)}),H.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Kte=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Uv(!0),f=Qw(l)??d;if(!f)throw Error(Cr(79));let p=Qy(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=H.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=zw(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=Fy({disabled:a,native:o}),S=GS(m),C=RT(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return Vr(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[_S]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:$v})}),BT=H.createContext(void 0);function VT(){let e=H.useContext(BT);if(e===void 0)throw Error(Cr(53));return e}function HT(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var UT=`base-ui-disable-scrollbar`,WT={className:UT,getElement(e){return(0,G.jsx)(`style`,{nonce:e,href:UT,precedence:`base-ui:low`,children:`.${UT}{scrollbar-width:none}.${UT}::-webkit-scrollbar{display:none}`})}},GT=e=>t=>t?{[e]:``}:null,KT={hasOverflowX:GT(`data-has-overflow-x`),hasOverflowY:GT(`data-has-overflow-y`),overflowXStart:GT(`data-overflow-x-start`),overflowXEnd:GT(`data-overflow-x-end`),overflowYStart:GT(`data-overflow-y-start`),overflowYEnd:GT(`data-overflow-y-end`),cornerHidden:()=>null},qT=H.createContext(void 0),JT={disableStyleElements:!1};function YT(){return H.useContext(qT)??JT}var XT={x:0,y:0},ZT={width:0,height:0},QT={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},$T={x:!0,y:!0,corner:!0},eE=H.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=tE(i),d=Qy(),f=rb(),p=rb(),{nonce:m,disableStyleElements:h}=YT(),[g,_]=H.useState(!1),[v,y]=H.useState(!1),[b,x]=H.useState(!1),[S,C]=H.useState(!1),[w,T]=H.useState(!1),[E,D]=H.useState(ZT),[O,k]=H.useState(ZT),[A,j]=H.useState(QT),[M,N]=H.useState($T),P=H.useRef(null),F=H.useRef(null),I=H.useRef(null),ee=H.useRef(null),L=H.useRef(null),te=H.useRef(null),R=H.useRef(null),z=H.useRef(null),B=H.useRef(0),ne=H.useRef(0),V=H.useRef(0),re=H.useRef(0),ie=H.useRef(`vertical`),ae=H.useRef(XT),oe=H.useRef(null);function se(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let ce=jy(e=>{let t=e.x-ae.current.x,n=e.y-ae.current.y;ae.current=e,n!==0&&se(!0),t!==0&&se(!1)}),le=jy(()=>{let e=F.current;e&&oe.current===null&&(oe.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),ue=jy(e=>{if(e.button!==0||z.current!==null&&(ie.current===`vertical`?L.current:te.current)?.hasPointerCapture(z.current))return;z.current=e.pointerId,B.current=e.clientY,ne.current=e.clientX,ie.current=e.currentTarget.getAttribute(`data-orientation`);let t=F.current;t&&(V.current=t.scrollTop,re.current=t.scrollLeft,le()),(ie.current===`vertical`?L.current:te.current)?.setPointerCapture(e.pointerId)}),de=jy(e=>{if(e.pointerId!==z.current)return;z.current=null,(ie.current===`vertical`?x:y)(!1),oe.current!==null&&(F.current&&(F.current.style.scrollSnapType=oe.current),oe.current=null);let t=ie.current===`vertical`?L.current:te.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),fe=jy(e=>{if(e.pointerId!==z.current)return;if(e.buttons%2==0){de(e);return}let t=F.current;if(!t)return;let n=ie.current===`vertical`,r=n?L.current:te.current,i=n?I.current:ee.current;if(!r||!i)return;let a=n?`y`:`x`,o=HT(i,`padding`,a),s=HT(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-B.current:e.clientX-ne.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?V.current:re.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),se(n)});function pe(e){C(e.pointerType===`touch`)}function me(e){if(pe(e),e.pointerType!==`touch`){let t=xb(P.current,e.target);_(t)}}let he=H.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),ge={role:`presentation`,onPointerEnter:me,onPointerMove:me,onPointerDown:pe,onPointerLeave(){_(!1)},style:{position:`relative`,"--scroll-area-corner-height":`${E.height}px`,"--scroll-area-corner-width":`${E.width}px`}},_e=Vr(`div`,e,{state:he,ref:[t,P],props:[ge,o],stateAttributesMapping:KT}),ve=H.useMemo(()=>({handlePointerDown:ue,handlePointerMove:fe,handlePointerUp:de,handleScroll:ce,disableViewportSnap:le,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:R,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:I,scrollbarXRef:ee,thumbYRef:L,thumbXRef:te,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:he,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[ue,fe,de,ce,le,E,O,w,S,v,b,g,d,M,A,he,s,c,l,u]);return(0,G.jsxs)(BT.Provider,{value:ve,children:[!h&&WT.getElement(m),_e]})});function tE(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var nE=H.createContext(void 0),rE=H.createContext(void 0);function iE(){return H.useContext(rE)?.direction??`ltr`}function aE(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function oE(e,t){return Math.max(0,e-t)}function sE(e,t){if(t<=0)return 0;let n=aE(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var cE=[`--scroll-area-overflow-x-start`,`--scroll-area-overflow-x-end`,`--scroll-area-overflow-y-start`,`--scroll-area-overflow-y-end`],lE=!1;function uE(){lE||ub||(typeof CSS<`u`&&`registerProperty`in CSS&&cE.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),lE=!0)}var dE=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=VT(),T=iE(),E=H.useRef(!0),D=H.useRef([NaN,NaN,NaN,NaN]),O=rb(),k=rb(),A=jy(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=fE(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),F=Math.max(0,h-y),I=0,ee=0;j||(I=sE(T===`rtl`?-w:w,P),ee=P-I);let L=A?0:sE(x,F),te=A?0:F-L,R=j?0:b,z=A?0:y,B=0,ne=0;!j&&!A&&(B=t?.offsetWidth||0,ne=n?.offsetHeight||0);let V=f.width===0&&f.height===0,re=V?B:0,ie=V?ne:0,ae=HT(n,`padding`,`x`),oe=HT(t,`padding`,`y`),se=HT(i,`margin`,`x`),ce=HT(r,`margin`,`y`),le=R-ae-se,ue=z-oe-ce,de=n?Math.min(n.offsetWidth-re,le):le,fe=t?Math.min(t.offsetHeight-ie,ue):ue,pe=Math.max(16,de*M),me=Math.max(16,fe*N);if(m(e=>pE(e,{width:pe,height:me})),t&&r){let e=mE(r,`--scroll-area-thumb-height`,x,F,h,me,t.offsetHeight-me-oe-ce);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-pe-ae-se,t=mE(i,`--scroll-area-thumb-width`,T===`rtl`?-w:w,P,_,pe,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let he=[I,ee,L,te];cE.forEach((t,n)=>{e.style.setProperty(t,`${he[n]}px`)}),a&&p(e=>pE(e,{width:B,height:ne})),g(e=>pE(e,k));let ge={xStart:!j&&I>C.xStart,xEnd:!j&&ee>C.xEnd,yStart:!A&&L>C.yStart,yEnd:!A&&te>C.yEnd};S(e=>pE(e,ge))});Y(()=>{uE()},[]),Y(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),Y(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),Y(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=e.getAnimations({subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished)).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={role:`presentation`,...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:WT.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=Vr(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:KT}),P=H.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,G.jsx)(nE.Provider,{value:P,children:N})});function fE(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function pE(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function mE(e,t,n,r,i,a,o){let s=aE(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var hE=H.createContext(void 0);function gE(){let e=H.useContext(hE);if(e===void 0)throw Error(Cr(54));return e}var _E=H.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=VT(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=iE(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;H.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return Ib(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},onPointerDown(e){if(e.button!==0)return;let t=Sb(e.nativeEvent),n=T?h.current:g.current;if(n&&xb(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=HT(n,`margin`,a),s=HT(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(--scroll-area-corner-height)`,insetInlineEnd:0,"--scroll-area-thumb-height":`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(--scroll-area-corner-width)`,bottom:0,"--scroll-area-thumb-width":`${S.width}px`}}},M=Vr(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:KT});return A?(0,G.jsx)(hE.Provider,{value:i,children:M}):null}),vE=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=VT(),m=gE(),h=m===`vertical`;return Vr(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})}),yE=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{cornerRef:o,cornerSize:s,hiddenState:c}=VT(),l=Vr(`div`,e,{ref:[t,o],props:[{style:{position:`absolute`,bottom:0,insetInlineEnd:0,width:s.width,height:s.height}},a]});return c.corner?null:l});function bE({className:e,children:t,scrollFade:n=!1,scrollbarGutter:r=!1,...i}){return(0,G.jsxs)(eE,{className:W(`size-full min-h-0`,e),...i,children:[(0,G.jsx)(dE,{className:W(`h-full !overflow-y-auto overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,n&&`mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]`,r&&`data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5`),"data-slot":`scroll-area-viewport`,children:t}),(0,G.jsx)(xE,{orientation:`vertical`}),(0,G.jsx)(xE,{orientation:`horizontal`}),(0,G.jsx)(yE,{"data-slot":`scroll-area-corner`})]})}function xE({className:e,orientation:t=`vertical`,...n}){return(0,G.jsx)(_E,{className:W(`m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100`,e),"data-slot":`scroll-area-scrollbar`,orientation:t,...n,children:(0,G.jsx)(vE,{className:`relative flex-1 rounded-full bg-foreground/20`,"data-slot":`scroll-area-thumb`})})}var SE=e=>{typeof window>`u`||window.electronAPI?.browser?.setOverlayActive(e)},CE=0,wE=!1;function TE(){let e=CE>0;e!==wE&&(wE=e,SE(wE))}function EE(){CE+=1,TE()}function DE(){CE=Math.max(0,CE-1),TE()}function OE(){return CE>0}function kE(e=!0){(0,H.useLayoutEffect)(()=>{if(e)return EE(),()=>DE()},[e])}function AE(){return kE(),null}var jE=0,ME=!1,NE=!1,PE=!1;function FE(){let e=jE>0&&!NE;e!==ME&&(ME=e,window.electronAPI?.window?.setTrafficLightsVisible(!e))}function IE(){PE||(PE=!0,window.electronAPI?.window?.isFullScreen().then(e=>{NE=e,FE()}).catch(()=>{}),window.electronAPI?.window?.onFullScreenChange(e=>{NE=e,FE()}))}function LE(){window.electronAPI?.env?.platform===`darwin`&&(IE(),jE++,FE())}function RE(){window.electronAPI?.env?.platform===`darwin`&&(jE=Math.max(0,jE-1),FE())}function zE(e){(0,H.useEffect)(()=>{if(e)return LE(),()=>RE()},[e])}var BE={BASE:0,SETTINGS_WINDOW:10,MOBILE_DRAWER:30,DROPDOWN:40,MODAL_BACKDROP:50,MODAL_CONTENT:51,DROPDOWN_IN_MODAL:60,NESTED_MODAL_BACKDROP:70,NESTED_MODAL_CONTENT:71,DROPDOWN_IN_NESTED_MODAL:80,TOOLTIP:100,TOAST:110,DEVTOOLS_OVERLAY:120},VE=(0,H.createContext)(BE.DROPDOWN);function HE(e){return zE(e.open??!1),(0,G.jsx)(PT,{...e})}var UE=ET;function WE(e){return(0,G.jsx)(Kte,{"data-slot":`dialog-trigger`,...e})}function GE({className:e,...t}){return(0,G.jsx)(ry,{className:W(`fixed inset-0 no-drag bg-black/32 backdrop-blur-sm transition-opacity duration-150 ease-out data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`dialog-backdrop`,"data-enso-float":``,...t})}function KE({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`fixed inset-0 grid grid-rows-[1fr_auto_3fr] justify-items-center p-4 pointer-events-none`,e),"data-slot":`dialog-viewport`,...t})}function qE({className:e,children:t,showCloseButton:n=!0,bottomStickOnMobile:r=!0,disableNestedTransform:i=!1,showBackdrop:a=!0,zIndexLevel:o=`base`,style:s,...c}){let l=i?{...s??{},"--nested-dialogs":0}:s,u=o===`base`?BE.MODAL_CONTENT:BE.NESTED_MODAL_CONTENT,d=o===`base`?BE.MODAL_BACKDROP:BE.NESTED_MODAL_BACKDROP,f=o===`base`?BE.DROPDOWN_IN_MODAL:BE.DROPDOWN_IN_NESTED_MODAL;return(0,G.jsxs)(UE,{children:[(0,G.jsx)(AE,{}),a&&(0,G.jsx)(GE,{style:{zIndex:d}}),(0,G.jsx)(KE,{className:W(r&&`max-sm:grid-rows-[1fr_auto] max-sm:pt-12`),style:{zIndex:u},children:(0,G.jsxs)(CT,{className:W(`-translate-y-[calc(1.25rem*var(--nested-dialogs))] no-drag pointer-events-auto relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg transition-[scale,opacity,translate] duration-150 [transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-95 data-starting-style:scale-95 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]`,r&&`max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none`,e),style:l,"data-slot":`dialog-popup`,...c,children:[(0,G.jsx)(VE.Provider,{value:f,children:t}),n&&(0,G.jsx)(Jy,{"aria-label":`Close`,className:`absolute end-3 top-2.5 z-50 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors`,children:(0,G.jsx)(ir,{className:`h-4 w-4`})})]})})]})}function JE({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`flex flex-col gap-2 p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pb-3 max-sm:pb-4`,e),"data-slot":`dialog-header`,...t})}function YE({className:e,variant:t=`default`,...n}){return(0,G.jsx)(`div`,{className:W(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/50 py-4`,t===`bare`&&`in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pt-3 pt-4 pb-6`,e),"data-slot":`dialog-footer`,...n})}function XE({className:e,...t}){return(0,G.jsx)(IT,{className:W(`font-heading text-xl leading-none`,e),"data-slot":`dialog-title`,...t})}function ZE({className:e,...t}){return(0,G.jsx)($y,{className:W(`text-muted-foreground text-sm`,e),"data-slot":`dialog-description`,...t})}var QE=`px-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-header])]:pt-1 in-[[data-slot=dialog-popup]:not(:has([data-slot=dialog-header]))]:pt-6 in-[[data-slot=dialog-popup]:not(:has([data-slot=dialog-footer]))]:pb-6! in-[[data-slot=dialog-popup]:not(:has([data-slot=dialog-footer].border-t))]:pb-1 pb-6`;function $E({className:e,bare:t=!1,...n}){let r=(0,G.jsx)(`div`,{className:W(QE,e),"data-slot":`dialog-panel`,...n});return t?r:(0,G.jsx)(bE,{className:`!h-auto min-h-0 flex-1`,children:r})}var eD=0;function tD(e){return eD+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${eD}`}var nD=H.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=wS({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,G.jsxs)(H.Fragment,{children:[l,c&&Gs.createPortal(n,c)]})}),rD=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=tx(e,t)||{};if(l==null)return{};let f=yx(u),p={x:n,y:r},m=sx(i),h=ax(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=ex(k,j,A),N=!c.arrow&&rx(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),iD=(e,t)=>({...rD(e),options:[e,t]}),aD={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},oD={sideX:`left`,sideY:`top`},sD=`--available-width`,cD=`--available-height`;function lD(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function uD(e,t,n){let{rects:r,placement:i}=e;return{side:lD(t,nx(i),n),align:rx(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function dD(e){return fD(e,Ete)}function fD(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=H.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=jy(A),M=A?j:n,N=Rb(n),P=Rb(g),F=iE()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],ee=o===`center`?I:`${I}-${o}`,L=l;typeof L==`number`?L={top:L,right:L,bottom:L,left:L}:L&&={top:L.top||0,right:L.right||0,bottom:L.bottom||0,left:L.left||0};let te=+(i===`bottom`),R=+(i===`top`),z=+(i===`right`),B=+(i===`left`),ne={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:L},V=H.useRef(null),re=Rb(a),ie=Rb(s),ae=typeof a==`function`?0:a,oe=typeof s==`function`?0:s,se=[];p&&se.push(p),se.push(qC(e=>{let t=uD(e,i,F),n=typeof re.current==`function`?re.current(t):re.current,r=typeof ie.current==`function`?ie.current(t):ie.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[ae,oe,F,i]));let ce=E===`none`&&T!==`shift`,le=!ce&&(u||O||T===`shift`),ue=T===`none`?null:XC({...ne,padding:{top:L.top+1+te,right:L.right+1+B,bottom:L.bottom+1+R,left:L.left+1+z},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),de=ce?null:JC({...ne,rootBoundary:k,mainAxis:E!==`none`,crossAxis:le,limiter:u||O?void 0:YC(e=>{if(!V.current)return{};let{width:t,height:n}=V.current.getBoundingClientRect(),r=ox(nx(e.placement)),i=r===`y`?t:n,a=r===`y`?L.left+L.right:L.top+L.bottom;return{offset:i/2+a/2}})},[ne,u,O,k,L,E]);T===`shift`||E===`shift`||o===`center`?se.push(de,ue):se.push(ue,de),se.push(ZC({...ne,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(sD,`${t}px`),i.setProperty(cD,`${n}px`);let a=oy(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),iD(e=>({element:V.current||Ny(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=nx(r),l=ox(c),u=V.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(uD(e,i,F)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,le&&l===`y`&&b?S:x),{}}},aD,b),Y(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let fe=H.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:he,y:ge,middlewareData:_e,update:ve,placement:ye,context:be,isPositioned:xe,floatingStyles:Se}=t({rootContext:h,open:m?g:void 0,placement:ee,middleware:se,strategy:r,whileElementsMounted:m?void 0:(...e)=>PC(...e,fe),nodeId:y,externalTree:S}),{sideX:Ce,sideY:we}=_e.adaptiveOrigin||oD,Te=xe?r:`fixed`,Ee=H.useMemo(()=>{let e;return e=xe?b?{position:Te,[Ce]:he,[we]:ge}:{...Se,position:Te}:{position:Te,top:0,left:0},e[sD]=`100vw`,e[cD]=`100vh`,xe||(e.opacity=0),e},[b,Te,Ce,he,we,ge,Se,xe]),De=H.useRef(null);Y(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(pD(t)?t.current:t)||null;n!==De.current&&(pe.setPositionReference(n),De.current=n)},[g,pe,M,N]),H.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&pD(e)&&e.current!==De.current&&(pe.setPositionReference(e.current),De.current=e.current)},[g,pe,M,N]),H.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return PC(me.reference,me.floating,ve,fe)},[m,g,me,ve,fe]);let Oe=nx(ye),ke=lD(i,Oe,F),Ae=rx(ye)||`center`,je=!!_e.hide?.referenceHidden;Y(()=>{x&&g&&xe&&Oe!==I&&w(Oe)},[x,g,xe,Oe,I]);let Me=H.useMemo(()=>({position:`absolute`,top:_e.arrow?.y,left:_e.arrow?.x}),[_e.arrow]),Ne=_e.arrow?.centerOffset!==0;return H.useMemo(()=>({positionerStyles:Ee,arrowStyles:Me,arrowRef:V,arrowUncentered:Ne,side:ke,align:Ae,physicalSide:Oe,anchorHidden:je,refs:pe,context:be,isPositioned:xe,update:ve}),[Ee,Me,V,Ne,ke,Ae,Oe,je,pe,be,xe,ve])}function pD(e){return e!=null&&`current`in e}function mD(e){return e===`starting`?gS:Lr}function hD(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Vr(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},mD(r),i],stateAttributesMapping:ty})}function gD(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||tD(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var _D=gD();function vD(e){let t={error:1e4,warning:1e4,loading:0,success:5e3,info:5e3},n=e.type,r=e.timeout??(n?t[n]:5e3),{actions:i,data:a,...o}=e,s=i?{...a,actions:i}:a;return _D.add({...o,data:s,timeout:r})}var yD=[`agents`,`members`,`chats`];function bD(e){return[...yD.flatMap(t=>e[t].map(e=>({candidate:e,group:t}))),...e.files.map(e=>({candidate:e,group:`files`}))]}function xD(e,t){let n=yD.filter(t=>e[t].length>0);return!t.trim()&&n.length>0?[...n.map(e=>({type:`folder`,id:e})),...e.files.map(e=>({type:`item`,candidate:e,group:`files`}))]:bD(e).map(e=>({type:`item`,candidate:e.candidate,group:e.group}))}function SD(e){return e.map(e=>({...e,kind:`agent-type`,id:e.typeKey,label:e.displayName}))}function CD(e){let t=new Set,n=[];for(let r of e)!r.relativePath||t.has(r.relativePath)||(t.add(r.relativePath),n.push({kind:`file`,id:r.relativePath,label:r.name||r.relativePath.split(`/`).at(-1)||r.relativePath,relativePath:r.relativePath}));return n}function wD(e,t,n,r=[]){let i=e.trim().toLocaleLowerCase(),a=i?t.filter(e=>`${e.label}\n${e.description}\n${e.source}\n${e.typeKey}`.toLocaleLowerCase().includes(i)):[...t],o=i?n.filter(e=>`${e.label}\n${e.relativePath}`.toLocaleLowerCase().includes(i)):[...n],s=i?r.filter(e=>e.label.toLocaleLowerCase().includes(i)):[...r];return{agents:a.filter(e=>e.source!==`bot`),members:a.filter(e=>e.source===`bot`),files:o,chats:s}}function TD(e,t,n=[],r={}){let[i,a]=(0,H.useState)([]),[o,s]=(0,H.useState)([]),c=t!==null,{searchFiles:l,agents:u=!0}=r;return(0,H.useEffect)(()=>{if(!c||!u)return;a([]);let e=!1;return window.electronAPI.agentRegistry.list().then(t=>{let n=A(t);e||a(n?SD(n.candidates):[])}).catch(()=>{e||a([])}),()=>{e=!0}},[c,u]),(0,H.useEffect)(()=>{if(t===null||!e&&!l){s([]);return}let n=!1,r=window.setTimeout(()=>{(l?l(t):window.electronAPI.files.search({conversationId:e,query:t})).then(e=>{n||s(CD(e))}).catch(()=>{n||s([])})},150);return()=>{n=!0,window.clearTimeout(r)}},[e,t,l]),(0,H.useMemo)(()=>t===null?{agents:[],members:[],files:[],chats:[]}:wD(t,i,o,n),[i,o,n,t])}var ED=1024,DD=(e,t)=>e<=(t?ED:767),OD=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,kD=()=>typeof window<`u`&&typeof window.innerWidth==`number`&&DD(window.innerWidth,OD()),AD=e=>(window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e));function jD(){return(0,H.useSyncExternalStore)(AD,()=>DD(window.innerWidth,OD()),()=>!1)}var MD=`mod+shift+m`,ND=typeof navigator<`u`&&typeof navigator.platform==`string`?navigator.platform.startsWith(`Mac`):process.platform===`darwin`,PD={"toggle-sidebar":`mod+b`,"toggle-app-mode":`mod+e`,"toggle-side-panel":`mod+j`,"toggle-side-panel-fullscreen":`mod+shift+j`,"open-settings":`mod+,`,"open-secretary":`mod+shift+s`,"switch-model":`mod+.`,"focus-composer":`mod+l`,"send-message":`enter`,"find-in-chat":`mod+f`,"search-workspace":`mod+k`,"new-conversation":`mod+n`,"next-tab":ND?`ctrl+tab`:`mod+tab`,"prev-tab":ND?`ctrl+shift+tab`:`mod+shift+tab`,"new-side-tab":`mod+t`,"new-btw-tab":`mod+shift+b`,"close-side-tab":`mod+w`,"toggle-minimize-to-tray":MD};function FD(e){return{...PD,...e}}function ID(e,t){let n=LD(e);if([`meta`,`control`,`alt`,`shift`].includes(n))return null;let r=ND?e.metaKey:e.ctrlKey,i=ND&&e.ctrlKey;if(!(r||i||e.altKey)&&!(t?.allowBare&&n===`enter`))return null;let a=[];return r&&a.push(`mod`),i&&a.push(`ctrl`),e.altKey&&a.push(`alt`),e.shiftKey&&a.push(`shift`),a.push(n),a.join(`+`)}function LD(e){if(e.key===` `||e.key===`\xA0`)return`space`;if(e.altKey){let t=/^(?:Key([A-Z])|Digit([0-9]))$/.exec(e.code??``);if(t)return(t[1]??t[2]??``).toLowerCase()}return e.key.toLowerCase()}function RD(e){let t=e.split(`+`),n=t.at(-1)??``,r=n.length===1?n.toUpperCase():n.charAt(0).toUpperCase()+n.slice(1);return ND?[t.includes(`ctrl`)?`⌃`:``,t.includes(`alt`)?`⌥`:``,t.includes(`shift`)?`⇧`:``,t.includes(`mod`)?`⌘`:``,r].join(``):[t.includes(`mod`)?`Ctrl`:``,t.includes(`alt`)?`Alt`:``,t.includes(`shift`)?`Shift`:``,r].filter(Boolean).join(`+`)}var zD=new Set,BD=!1;function VD(e,t){t?zD.add(e):zD.delete(e);let n=zD.size>0;n!==BD&&(BD=n,window.electronAPI?.updater?.reportUnsentDraft?.(n))}var HD=[],UD=e=>`/${e.pluginId}:${e.id}`;function WD(e){return HD.find(t=>UD(t)===e)??null}function GD(){return HD}async function KD(e,t){let n=await window.electronAPI.extensionPlugins.call({pluginId:e.pluginId,method:`command.run`,payload:{id:e.id},sessionId:t});return n.ok?null:n.error}var qD=null,JD=new Map;function YD(e){return qD=e,()=>{qD===e&&(qD=null)}}function XD(e){let t=JD.get(e);return JD.delete(e),t}var ZD=[],QD=0,$D=new Set;function eO(){return QD}function tO(e){return $D.add(e),()=>$D.delete(e)}function nO(e){return ZD.filter(t=>t.slot===`message.action`&&t.position===e)}function rO(e){let t=e===`left`?`composer.left`:`composer.right`;return ZD.filter(e=>e.slot===t)}function iO(e,t){return ZD.find(n=>n.slot===`tool.card`&&n.pluginId===e&&n.toolName===t)}function aO(){return ZD.find(e=>e.slot===`thinking.body`)}function oO(){return ZD.find(e=>e.slot===`message.leaf`)}function sO(e,t){let n=t.toLowerCase();return ZD.find(t=>t.slot===`block`&&t.pluginId===e&&t.language===n)}var cO=/^[a-z][a-z0-9]*(\.[a-z0-9]+)+$/;function lO(e){if(!e)return null;let t=e.indexOf(`:`);if(t<=0)return null;let n=e.slice(0,t),r=e.slice(t+1);return!cO.test(n)||r.length===0?null:{pluginId:n,lang:r}}function uO({entry:e,props:t}){return(0,H.createElement)(e.component,t)}function dO(){return(0,H.useSyncExternalStore)(tO,eO,eO)}var fO=class extends H.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`[plugin] ${this.props.pluginId} 挂点 ${this.props.slot} 渲染失败`,e)}render(){return this.state.failed?this.props.fallback??null:this.props.children}};function pO({entry:e,props:t,fallback:n}){return(0,G.jsx)(fO,{pluginId:e.pluginId,slot:e.slot,fallback:n,children:(0,G.jsx)(uO,{entry:e,props:t})})}function mO({position:e,text:t,messageIndex:n,sessionId:r}){dO();let i=nO(e);return i.length===0?null:(0,G.jsx)(G.Fragment,{children:i.map(i=>(0,G.jsx)(pO,{entry:i,props:{position:e,text:t,messageIndex:n,sessionId:r}},`${i.pluginId}:${i.uid}`))})}function hO({name:e,output:t,state:n}){dO();let r=w(e);if(!r)return null;let i=iO(r.pluginId,r.toolName);return i?(0,G.jsx)(pO,{entry:i,props:{toolName:r.toolName,output:t,state:n}}):null}var gO=[`t-acc-reveal mt-1 ml-[10px] border-l-2 border-border py-0.5 pl-[19px]`,`text-[13px] leading-relaxed text-muted-foreground whitespace-pre-wrap`].join(` `);function _O({text:e,streaming:t,itemKey:n}){dO();let r=aO();return r?(0,G.jsx)(`div`,{className:gO,children:(0,G.jsx)(pO,{entry:r,props:{text:e,streaming:t,itemKey:n},fallback:e},r.uid)}):(0,G.jsx)(`p`,{className:gO,children:e})}function vO({entry:e,source:t,final:n,messageIndex:r,sessionId:i,Markdown:a}){return(0,G.jsx)(pO,{entry:e,props:{source:t,final:n,messageIndex:r,sessionId:i,Markdown:a}})}function yO({pluginId:e,lang:t,source:n}){dO();let r=sO(e,t);return r?(0,G.jsx)(pO,{entry:r,props:{language:t,source:n}}):null}function bO({side:e,sessionId:t,draft:n,busy:r,pluginPresetId:i}){dO();let a=rO(e);return a.length===0?null:(0,G.jsx)(G.Fragment,{children:a.map(a=>(0,G.jsx)(pO,{entry:a,props:{position:e,sessionId:t,draft:n,busy:r,pluginPresetId:i}},`${a.pluginId}:${a.uid}`))})}var xO=[],SO=new Set;function CO(e){return SO.add(e),()=>SO.delete(e)}var wO=()=>xO,TO={neutral:`text-muted-foreground`,accent:`text-primary`,success:`text-emerald-600 dark:text-emerald-400`,warning:`text-amber-600 dark:text-amber-400`,danger:`text-red-600 dark:text-red-400`};function EO({sessionId:e}){let t=(0,H.useSyncExternalStore)(CO,wO,wO);return t.length===0?null:(0,G.jsx)(G.Fragment,{children:t.map(t=>{let n=t.command?GD().find(e=>e.pluginId===t.pluginId&&e.id===t.command):void 0,r=W(`shrink-0 truncate px-1 text-[11px]`,TO[t.tone]),i=t.tooltip?`${t.tooltip} · ${t.pluginName}`:t.pluginName;return n?(0,G.jsx)(`button`,{type:`button`,title:i,className:W(r,`rounded hover:bg-accent`),onClick:()=>void KD(n,e).then(e=>{e&&vD({title:e})}),children:t.text},`${t.pluginId}:${t.id}`):(0,G.jsx)(`span`,{title:i,className:r,children:t.text},`${t.pluginId}:${t.id}`)})})}var DO=50,OO=64,kO=120,AO=32768,jO=120,MO=[];function NO(e){return/(?:^|\s)#([^\s#]*)$/.exec(e)?.[1]??null}function PO(e,t,n){if(!Array.isArray(n))return[];let r=[];for(let i of n){if(r.length>=DO)break;if(typeof i!=`object`||!i)continue;let{id:n,label:a,detail:o}=i;typeof n!=`string`||!n||typeof a!=`string`||!a||r.push({key:`${e}:${t}:${n}`,pluginId:e,name:t,item:{id:n.slice(0,200),label:a.slice(0,OO),...typeof o==`string`&&o?{detail:o.slice(0,kO)}:{}}})}return r}function FO(e){let t=typeof e==`string`?e:typeof e==`object`&&e?e.text:null;return typeof t==`string`&&t.length<=AO?t:null}var IO=[],LO=new Set;function RO(e){return LO.add(e),()=>LO.delete(e)}var zO=()=>IO;function BO(e,t){let n=(0,H.useSyncExternalStore)(RO,zO,zO),[r,i]=(0,H.useState)(MO);return(0,H.useEffect)(()=>{if(e===null||n.length===0){i(MO);return}let r=!1,a=setTimeout(()=>{Promise.all(n.map(async({pluginId:n,name:r})=>{let i=await window.electronAPI.extensionPlugins.call({pluginId:n,method:`trigger.candidates`,payload:{name:r,query:e},sessionId:t});return i.ok?PO(n,r,i.value):MO})).then(e=>{r||i(e.flat().slice(0,DO))})},jO);return()=>{r=!0,clearTimeout(a)}},[e,n,t]),e===null?MO:r}async function VO(e,t){let n=await window.electronAPI.extensionPlugins.call({pluginId:e.pluginId,method:`trigger.pick`,payload:{name:e.name,item:e.item},sessionId:t});return n.ok?FO(n.value):null}var HO=null,UO=null,WO=null,GO=null,KO=null,qO=null,JO=null,YO=null,XO=null;function ZO(e){return HO=e,()=>{HO===e&&(HO=null)}}function QO(e){return GO=e,()=>{GO===e&&(GO=null)}}function $O(e){return UO=e,()=>{UO===e&&(UO=null)}}function ek(){return GO?(GO(),!0):!1}function tk(e){return WO=e,()=>{WO===e&&(WO=null)}}function nk(e){return WO?(WO(e),!0):!1}function rk(e){return XO=e,()=>{XO===e&&(XO=null)}}function ik(e){return UO?(UO(e),!0):!1}function ak(e){return KO=e,()=>{KO===e&&(KO=null)}}function ok(e){return qO=e,()=>{qO===e&&(qO=null)}}function sk(e){return JO=e,()=>{JO===e&&(JO=null)}}function ck(e){return YO=e,()=>{YO===e&&(YO=null)}}var lk=`composer-drop`,uk=/<quote(?: truncated="true" original-lines="(\d+)")?>\n([\s\S]*?)\n<\/quote>/g;function dk(e){return`<quote${e.originalLines?` truncated="true" original-lines="${e.originalLines}"`:``}>\n${e.text.replace(/<\/quote>/g,`<\\/quote>`)}\n</quote>`}function fk(e){let t=e[2].replace(/<\\\/quote>/g,`</quote>`);return e[1]?{text:t,originalLines:Number(e[1])}:{text:t}}function pk(e){return e.search(uk)>=0}function mk(e){return e.replace(uk,(...e)=>{let t=fk(e),n=t.text.replace(/^/gm,`> `);return t.originalLines?`${n}\n> …`:n})}function hk(e){return e.replace(uk,``).trim()||[...e.matchAll(uk)].map(e=>fk(e).text).join(`
163
- `)}var gk=[{name:`blue`,rgb:[58,150,221],cssVar:`--cursor-blue`},{name:`purple`,rgb:[155,89,182],cssVar:`--cursor-purple`},{name:`green`,rgb:[39,174,96],cssVar:`--cursor-green`},{name:`orange`,rgb:[242,153,74],cssVar:`--cursor-orange`},{name:`cyan`,rgb:[0,184,169],cssVar:`--cursor-cyan`},{name:`magenta`,rgb:[219,68,134],cssVar:`--cursor-magenta`},{name:`red`,rgb:[235,87,87],cssVar:`--cursor-red`},{name:`yellow`,rgb:[170,175,18],cssVar:`--cursor-yellow`}];gk.map(e=>e.name);function _k(e,t){return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t})`}gk.map(({rgb:e})=>({fill:_k(e,.04),stroke:_k(e,.5),scribbleStroke:_k(e,.92)})),gk.map(({rgb:e})=>({border:_k(e,1),bg:_k(e,.1),hoverBorder:_k(e,.3),hoverBg:_k(e,.02)}));var{PI:vk}=Math;vk+1e-4;var yk=`CSS edits — `;RegExp(`^${yk}.*$`,`m`),RegExp(`^${yk}`,`gm`);var bk=/\n*```browser_element\n[\s\S]*?```(?=\n|$)/g;function xk(e){return e.replace(bk,``).trimEnd()}var Sk=/^<unattended>\n([\s\S]*?)\n<\/unattended>(?:\n\n|$)/;function Ck(e){let t=Sk.exec(e);return t?{note:/unattended mode is off/i.test(t[1])?`off`:`on`,rest:e.slice(t[0].length)}:{rest:e}}var wk=`background-tasks-wrap-up`,Tk=RegExp(`^<${wk}>\\n[\\s\\S]*?\\n</${wk}>(?:\\n\\n|$)`),Ek=/^- (\S+?): (.*?)(?: \(running ([^()]+)\))?$/;function Dk(e){let t=[];for(let n of e.split(`
164
- `)){let e=Ek.exec(n);e?.[1]&&t.push({taskId:e[1],command:e[2]??``,...e[3]?{ran:e[3]}:{}})}return t}function Ok(e){let t=Tk.exec(e);return t?{items:Dk(t[0]),rest:e.slice(t[0].length)}:null}function kk(e){let t=e,n,r,i;for(;;){let a=n?{rest:t}:ge(t);if(a.note){n=a.note,t=a.rest;continue}let o=i?null:Ok(t);if(o){let n=e.length-t.length;i={items:o.items,start:n,end:n+t.length-o.rest.length},t=o.rest;continue}let s=r?{rest:t}:Ck(t);if(!s.note)break;r=s.note,t=s.rest}return{...n?{plan:n}:{},...r?{unattended:r}:{},wrapUp:i,rest:t}}function Ak(e){let{plan:t,unattended:n,rest:r}=kk(e);return{...t?{plan:t}:{},...n?{unattended:n}:{},rest:r}}function jk(e){let t=kk(e).wrapUp;return t?{items:t.items}:void 0}function Mk(e){let t=kk(e).wrapUp;return t?e.slice(0,t.start)+e.slice(t.end):e}var Nk=/^\/skill:(\S+)(?:\s+|$)/,Pk=/^<skill name="([^"]+)" location="([^"]*)">\n([\s\S]*?)\n<\/skill>(?:\n\n|$)/;function Fk(e){let t=[],n=e;for(let e=Nk.exec(n);e;e=Nk.exec(n))t.push(e[1]),n=n.slice(e[0].length);return{names:t,rest:t.length>0?n.trim():e}}function Ik(e){let t=[],n=e;for(let e=Pk.exec(n);e;e=Pk.exec(n))t.push({name:e[1],location:e[2],body:e[3]}),n=n.slice(e[0].length);return t.length>0?{skills:t,rest:n.trim()}:null}var Lk=/^<workflow-preset name="([^"]*)">\n(\{.*\})\n<\/workflow-preset>(?:\n\n[\s\S]*)?$/,Rk=e=>e.replace(/&(amp|quot|lt|gt);/g,e=>e===`&amp;`?`&`:e===`&quot;`?`"`:e===`&lt;`?`<`:`>`);function zk(e){let t=Lk.exec(e);if(!t)return null;let n;try{n=JSON.parse(t[2]??``)}catch{return null}if(!n||typeof n!=`object`||Array.isArray(n))return null;let{preset:r,args:i={}}=n;if(typeof r!=`string`||!r||!i||typeof i!=`object`||Array.isArray(i))return null;let a=Object.entries(i);return a.some(([,e])=>typeof e!=`string`)?null:{id:r,name:Rk(t[1]??``),args:a}}var Bk=/\[Referenced past chat "(.+?)" — transcript file: (.+?) \(pi session jsonl; read it if relevant\)\]/g,Vk=/\[Selected UI element "([^"]*)" — path: (.*?); text: (.*?)\]/g;function Hk(e,t){for(let n=t-1;n>=0;n--){let r=e[n];if(r===`@`){let r=n>0?e[n-1]:` `;return r===` `||r===`
165
- `?e.slice(n+1,t):null}if(r===` `||r===`
166
- `)return null}return null}function Uk(e){let t=Math.max(0,e.containerWidth-e.popupWidth),n=Math.min(Math.max(0,e.anchorLeft),t);return{left:n,flyoutSide:e.containerWidth-n-e.popupWidth-e.flyoutGap>=e.flyoutWidth?`right`:`left`}}function Wk(e){if(e.isComposing||e.itemCount===0)return{type:`none`};let t=e.key===`Enter`&&!e.shiftKey||e.key===`Tab`;if(e.folderOpen){if(e.key===`Escape`||e.key===`ArrowLeft`)return{type:`close-folder`};let n=e.folderItemCount??0;if(n===0)return{type:`none`};let r=e.folderIndex??0;return e.key===`ArrowDown`?{type:`move-folder`,index:(r+1)%n}:e.key===`ArrowUp`?{type:`move-folder`,index:(r-1+n)%n}:t?{type:`pick`}:{type:`none`}}return e.activeIsFolder&&(e.key===`ArrowRight`||t)?{type:`open-folder`}:e.key===`ArrowDown`?{type:`move`,index:(e.activeIndex+1)%e.itemCount}:e.key===`ArrowUp`?{type:`move`,index:(e.activeIndex-1+e.itemCount)%e.itemCount}:t?{type:`pick`}:e.key===`Escape`?{type:`close`}:{type:`none`}}function Gk(e,t){return`[Referenced past chat "${e.replace(/["[\]\n]/g,` `).replace(/\s+/g,` `).trim()||`untitled`}" — transcript file: ${t} (pi session jsonl; read it if relevant)]`}var Kk=/^\[Referenced past chat "(.+)" — transcript file: (.+) \(pi session jsonl; read it if relevant\)\]$/,qk=/^@(\S.*)$/;function Jk(e){let t=``;return e.forEach((n,r)=>{let i=e[r-1];t+=n.type===`text`?i?.type===`quote`?n.text.replace(/^[\u00a0 ]/,``):n.text:n.type===`quote`?`${t&&!t.endsWith(`
167
- `)?`
168
- `:``}${dk(n)}\n`:n.type===`file`?/\s/.test(n.path)&&!n.path.includes(`"`)?`@"${n.path}"`:`@${n.path}`:n.type===`chat`?Gk(n.label,n.sessionFile):uv(n)}),t}function Yk(e,t){Bk.lastIndex=t,Vk.lastIndex=t,uk.lastIndex=t;let n=Bk.exec(e),r=Vk.exec(e),i=uk.exec(e),a=n?{index:n.index,length:n[0].length,segment:{type:`chat`,label:n[1],sessionFile:n[2]}}:null,o=r?fv(r[0]):null,s=r&&o?{index:r.index,length:r[0].length,segment:{type:`ui-element`,id:``,...o,imageId:``}}:null,c=null;if(i){let n=+(i.index>t&&e[i.index-1]===`
169
- `),r=+(e[i.index+i[0].length]===`
170
- `);c={index:i.index-n,length:i[0].length+n+r,segment:{type:`quote`,...fk(i)}}}return[c,a,s].filter(e=>e!==null).sort((e,t)=>e.index-t.index)[0]??null}function Xk(e){let t=[],n=0;for(let r of e.matchAll(uk)){let i=r.index??0,a=+(i>n&&e[i-1]===`
171
- `);i-a>n&&t.push({type:`text`,text:e.slice(n,i-a)}),t.push({type:`quote`,...fk(r)}),n=i+r[0].length,e[n]===`
172
- `&&(n+=1)}return n<e.length?t.push({type:`text`,text:e.slice(n)}):t.at(-1)?.type===`quote`&&t.push({type:`text`,text:`\xA0`}),t}function Zk(e){let t=[],n=0,r=Yk(e,0);for(;r;){let i=e.slice(n,r.index);for(let e of rA(i))(e.type!==`text`||e.text!==``)&&t.push(e);t.push(r.segment),n=r.index+r.length,r=Yk(e,n)}let i=e.slice(n);if(i||t.length===0)for(let e of rA(i))e.type===`text`&&e.text===``&&t.length>0||t.push(e);return t}var Qk=/^(?:[A-Za-z]:[\\/])?(?:[\p{L}\p{N}_./\\-]*\.[\w-]{1,16}(?:#L\d+(?:-L\d+)?)?|[\p{L}\p{N}_./\\-]+[\\/])$/u,$k=/^"([^"\n]*(?:\.[\w-]{1,16}(?:#L\d+(?:-L\d+)?)?|[\\/]))"/,eA=/#L\d+(?:-L\d+)?$/;function tA(e){return e.replace(eA,``)}function nA(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).at(-1)||e}function rA(e){return _v(e).flatMap(e=>e.type===`file`?[e]:iA(e.text))}function iA(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e.indexOf(`@`,r);if(i===-1){n+=e.slice(r);break}let a=i>0?e[i-1]:` `,o=a===` `||a===`
173
- `?$k.exec(e.slice(i+1)):null;if(o){n+=e.slice(r,i),n&&=(t.push({type:`text`,text:n}),``),t.push({type:`file`,path:o[1]}),r=i+1+o[0].length;continue}let s=(/^\S*/.exec(e.slice(i+1))?.[0]??``).replace(/[),.;!?]+$/,``);(a===` `||a===`
174
- `)&&s&&Qk.test(s)?(n+=e.slice(r,i),n&&=(t.push({type:`text`,text:n}),``),t.push({type:`file`,path:s}),r=i+1+s.length):(n+=e.slice(r,i+1),r=i+1)}return n&&t.push({type:`text`,text:n}),t.length>0?t:[{type:`text`,text:e}]}function aA(e){let t={body:e,files:[],chats:[]},n=e.split(`
175
- `),r=[],i=[],a=n.length-1;for(;a>=0;a--){let e=n[a],t=Kk.exec(e);if(t){i.unshift({label:t[1],sessionFile:t[2]});continue}if(qk.test(e)){r.unshift(e.slice(1));continue}break}return r.length+i.length===0||a<0||n[a].trim()!==``?t:{body:n.slice(0,a).join(`
176
- `).trimEnd(),files:r,chats:i}}function oA(e){let t=Jk(e.segments).trim(),n=e.segments.filter(e=>e.type!==`text`&&e.type!==`quote`).map(e=>e.type===`file`?{kind:`file`,id:e.path,label:nA(e.path),relativePath:tA(e.path)}:e.type===`chat`?{kind:`chat`,id:e.conversationId??e.sessionFile,label:e.label,sessionFile:e.sessionFile}:{kind:`ui-element`,id:e.id,label:e.label,path:e.path,text:e.text,imageId:e.imageId});e.recipient&&n.push(e.recipient);let r=e.slashes.join(` `);return{text:r?t?`${r} ${t}`:r:t,images:e.images.map(({data:e,mimeType:t})=>({data:e,mimeType:t})),mentions:n,...e.recipient?{recipient:e.recipient}:{}}}function sA(e){return e.startsWith(`/skill:`)?`skill`:e===`/goal`?`goal`:`command`}function cA(e){return e.startsWith(`/skill:`)?e.slice(7):e.replace(/^\//,``)}function lA(e){let t=/^\/skill:(\S+)(?:\s+([\s\S]*))?$/.exec(e);if(t)return{slash:`/skill:${t[1]}`,rest:t[2]??``};let n=/^\/([A-Za-z][\w:-]*)(?:\s+([\s\S]*))?$/.exec(e);return n?{slash:`/${n[1]}`,rest:n[2]??``}:{slash:null,rest:e}}var uA={skill:Un,goal:Xn,command:Kn},dA={skill:`bg-info/15 text-info`,goal:`bg-warning/25 text-warning-foreground dark:bg-warning/15 dark:text-warning`,command:`bg-foreground/10 text-foreground`};function fA(e,t=!1){return W(`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 align-middle text-xs font-medium`,dA[e],t&&e===`skill`&&`hover:bg-info/25`,t&&e===`goal`&&`hover:bg-warning/35 dark:hover:bg-warning/25`,t&&e===`command`&&`hover:bg-foreground/15`)}function pA({name:e,className:t,interactive:n=!1,trailing:r}){let i=sA(e),a=uA[i];return(0,G.jsxs)(`span`,{className:W(fA(i,n),t),children:[(0,G.jsx)(a,{className:`h-3 w-3`}),cA(e),r]})}var mA=e=>e.startsWith(`/skill:`);function hA(e,t){return!mA(t)||!e.every(mA)?[t]:e.includes(t)?[...e]:[...e,t]}function gA(e){let t=Fk(e);if(t.names.length>0)return{slashes:t.names.map(e=>`/skill:${e}`),rest:t.rest};let n=lA(e);return{slashes:n.slash?[n.slash]:[],rest:n.rest}}function _A(e,t,n=!1){let r=e.segments.some(e=>e.type!==`text`||e.text.length>0);if(n&&(r||e.slashes.length>0))return{slashes:e.slashes,segments:[...e.segments,...t.text?Xk(`${r?`
177
-
178
- `:``}${t.text}`):[]],images:[...e.images,...t.images??[]]};let i=gA(t.text??``);return{slashes:i.slashes,segments:i.rest?Xk(i.rest):[],images:[...n?e.images:[],...t.images??[]]}}var vA={"agent-type":`bg-purple-500/15 text-purple-600 dark:text-purple-400`,file:`bg-success/15 text-success`,chat:`bg-warning/25 text-warning-foreground dark:bg-warning/15 dark:text-warning`,"ui-element":`bg-purple-500/15 text-purple-600 dark:text-purple-400`};function yA(e){return W(`inline-flex max-w-52 items-center gap-1 rounded-md px-1.5 py-0.5 align-middle text-xs font-medium`,vA[e])}function bA({label:e,onRemove:t}){return(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-sm opacity-70 transition-opacity hover:opacity-100`,"aria-label":e,children:(0,G.jsx)(ir,{className:`h-3 w-3`})})}function xA({recipient:e,onRemove:t}){let{t:n}=K();return(0,G.jsxs)(`span`,{className:W(yA(`agent-type`),`mt-0.5 shrink-0`),children:[(0,G.jsx)(pt,{className:`h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.label}),(0,G.jsx)(bA,{label:n(`Remove Agent recipient`),onRemove:t}),(0,G.jsx)(`span`,{className:`sr-only`,children:e.typeKey})]})}var SA=2e4,CA=3,wA=/^```/gm,TA=/^```/;function EA(e){return e.split(`
179
- `).filter(e=>!TA.test(e)).length}function DA(e){let t=e.replace(/\r\n?/g,`
180
- `).replace(/^\n+|\s+$/g,``);if(!t.trim())return null;let n=t.split(`
181
- `),r=EA(t);if(r<=200&&t.length<=2e4)return{type:`quote`,text:t};let i=0;for(let e=0;i<n.length&&!(!TA.test(n[i])&&++e>200);i++);let a=n.slice(0,i).join(`
182
- `).slice(0,SA);return(a.match(wA)?.length??0)%2==1&&(a+="\n```"),{type:`quote`,text:a,originalLines:r}}function OA(e){let t=e.split(`
183
- `);return t.length<=CA?{preview:e,clipped:!1}:{preview:t.slice(0,CA).join(`
184
- `),clipped:!0}}function kA(e){let t=[],n=0;for(let r of e.matchAll(/^```[^\n]*\n([\s\S]*?)\n?^```[ \t]*$/gm)){let i=e.slice(n,r.index).replace(/^\n|\n$/g,``);i&&t.push({type:`text`,text:i}),t.push({type:`code`,code:r[1]}),n=r.index+r[0].length}let r=e.slice(n).replace(/^\n/,``);return(r||t.length===0)&&t.push({type:`text`,text:r}),t}var AA=`[data-enso="code-block"]`,jA=`[data-quote-skip]`,MA=new Set([`P`,`DIV`,`LI`,`UL`,`OL`,`TR`,`TABLE`,`BLOCKQUOTE`,`H1`,`H2`,`H3`,`H4`,`H5`,`H6`,`PRE`]);function NA(e){return e?e.nodeType===1?e:e.parentElement:null}function PA(e,t){return`\`\`\`${t??``}\n${e.replace(/\n+$/,``)}\n\`\`\``}function FA(e){if(e.nodeType===3)return e.textContent??``;if(e.nodeType!==1&&e.nodeType!==11)return``;let t=e.nodeType===1?e:null;if(t?.tagName===`BUTTON`||t?.matches(jA))return``;if(t?.tagName===`BR`)return`
185
- `;if(t?.matches(AA))return`\n${PA(t.querySelector(`pre`)?.textContent??t.textContent??``,t.getAttribute(`data-language`)??void 0)}\n`;let n=[...e.childNodes].map(FA).join(``);return t&&MA.has(t.tagName)?`${n}\n`:n}function IA(e,t){if(!e||e.rangeCount===0||e.isCollapsed)return null;let n=NA(e.anchorNode),r=NA(e.focusNode);if(!n||!r||!t.contains(n)||!t.contains(r))return null;let i=n.closest(`[data-nav-key]`);if(!i||i!==r.closest(`[data-nav-key]`))return null;let a=e.toString();if(!a.trim())return null;let o=e.getRangeAt(0),s=NA(o.commonAncestorContainer)?.closest(AA);if(s)return PA(a,s.getAttribute(`data-language`)??void 0);let c=o.cloneContents();return c.querySelector(`${AA}, ${jA}`)?FA(c).replace(/\n{3,}/g,`
186
-
187
- `).trim():a}var LA=8,RA=6;function zA(e,t,n,r,i=[]){let a=(e,t)=>Math.min(Math.max(LA,e),t),o=t.height-n.height-LA,s=t.width-n.width-LA,c=e.top-n.height-RA,l=e.bottom+RA,u=a((e.left+e.right)/2-n.width/2,s),d=(r?[l,c]:[c,l]).filter(e=>e>=LA&&e<=o),f=(e,t)=>i.find(r=>t<r.right&&t+n.width>r.left&&e<r.bottom&&e+n.height>r.top),p=d.map(e=>({top:e,left:u}));for(let e of d){let t=f(e,u);t&&p.push({top:e,left:t.right+RA},{top:e,left:t.left-n.width-RA})}let m=a((e.top+e.bottom)/2-n.height/2,o);return p.push({top:m,left:e.right+RA},{top:m,left:e.left-n.width-RA}),p.find(({top:e,left:t})=>e>=LA&&e<=o&&t>=LA&&t<=s&&!f(e,t))||{top:a(r||c<LA?l:c,o),left:u}}function BA(e,t){return/(?:^|\s)\$([^\s$]*)$/.exec(e.slice(0,t))?.[1]??null}function VA(e){let t=new Set,n=[];for(let r of e){let e=r.name.trim().toLowerCase();!e||t.has(e)||(t.add(e),n.push(r))}return n}function HA(e,t,n){let r=n??t;if(r===null)return[];let i=r.toLowerCase();return VA(e.filter(e=>n===null?e.name.toLowerCase().includes(i):e.name.startsWith(`/skill:`)&&e.name.slice(7).toLowerCase().includes(i))).slice(0,10)}var UA={file:`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>`,chat:`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/></svg>`,"ui-element":`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 3a2 2 0 0 0-2 2"/><path d="M19 3a2 2 0 0 1 2 2"/><path d="M21 19a2 2 0 0 1-2 2"/><path d="M5 21a2 2 0 0 1-2-2"/><path d="M9 3h1"/><path d="M9 21h1"/><path d="M14 3h1"/><path d="M14 21h1"/><path d="M3 9v1"/><path d="M21 9v1"/><path d="M3 14v1"/><path d="M21 14v1"/></svg>`},WA=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`,GA={file:`bg-success/15 text-success`,chat:`bg-warning/25 text-warning-foreground dark:bg-warning/15 dark:text-warning`,"ui-element":`bg-purple-500/15 text-purple-600 dark:text-purple-400`},KA=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/><path d="M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/></svg>`;function qA(e,t){let n=e.dataset.text??``,r=e.dataset.expanded===`true`,{preview:i,clipped:a}=OA(n),o=e.querySelector(`[data-quote-body]`);if(o&&(o.textContent=r?n:a?`${i}\n…`:i,o.className=W(`mt-0.5 block whitespace-pre-wrap break-words text-foreground/80`,r?`max-h-32 overflow-y-auto overscroll-contain`:`max-h-16 overflow-hidden`)),e.querySelector(`[data-quote-toggle]`)?.remove(),!r&&a){let n=document.createElement(`span`);n.dataset.quoteToggle=``,n.className=`shrink-0 text-muted-foreground/80`,n.textContent=t.expand,e.querySelector(`[data-quote-remove]`)?.before(n)}}function JA(e,t){let n=document.createElement(`span`);n.contentEditable=`false`,n.dataset.mentionKind=`quote`,n.dataset.text=e.text,e.originalLines&&(n.dataset.originalLines=String(e.originalLines)),n.className=`my-1 block cursor-pointer rounded-md border-l-2 border-brand/50 bg-muted/60 px-2 py-1 text-xs select-none`;let r=document.createElement(`span`);r.className=`flex items-center gap-1.5 text-muted-foreground`;let i=document.createElement(`span`);i.className=`shrink-0 inline-flex`,i.innerHTML=KA;let a=document.createElement(`span`);if(a.className=`min-w-0 flex-1 truncate`,a.textContent=t.title(EA(e.text)),r.append(i,a),e.originalLines){let n=document.createElement(`span`);n.dataset.quoteTruncated=``,n.className=`shrink-0 rounded bg-warning/20 px-1 text-warning-foreground dark:text-warning`,n.textContent=t.truncated(e.originalLines),r.appendChild(n)}let o=document.createElement(`button`);o.type=`button`,o.dataset.quoteRemove=``,o.setAttribute(`aria-label`,t.remove),o.className=`shrink-0 rounded-sm px-1 opacity-70 hover:opacity-100`,o.textContent=`×`,r.appendChild(o);let s=document.createElement(`span`);return s.dataset.quoteBody=``,n.append(r,s),qA(n,t),n}function YA(e,t){if(e.type===`quote`)return JA(e,t);let n=document.createElement(`span`);n.contentEditable=`false`,n.dataset.mentionKind=e.type,e.type===`file`?(n.dataset.path=e.path,e.label&&(n.dataset.label=e.label),n.title=e.path):e.type===`chat`?(n.dataset.label=e.label,n.dataset.sessionFile=e.sessionFile,e.conversationId&&(n.dataset.conversationId=e.conversationId)):(n.dataset.id=e.id,n.dataset.label=e.label,n.dataset.path=e.path,n.dataset.text=e.text,n.dataset.imageId=e.imageId,n.title=`${e.path}${e.text?` · ${e.text}`:``}`),n.className=W(`mx-0.5 inline-flex max-w-52 items-center gap-1 rounded-md px-1.5 py-0.5 align-middle text-xs font-medium leading-4 select-none`,GA[e.type]);let r=document.createElement(`span`);r.className=`shrink-0 inline-flex`,r.innerHTML=e.type===`file`&&/[\\/]$/.test(e.path)?WA:UA[e.type],n.appendChild(r);let i=document.createElement(`span`);return i.className=`truncate`,i.textContent=e.type===`file`?e.label??nA(e.path):e.label,n.appendChild(i),n}function XA(e){if(e.dataset.mentionKind===`quote`&&e.dataset.text){let t=Number(e.dataset.originalLines);return{type:`quote`,text:e.dataset.text,...t>0?{originalLines:t}:{}}}return e.dataset.mentionKind===`file`&&e.dataset.path?{type:`file`,path:e.dataset.path,...e.dataset.label?{label:e.dataset.label}:{}}:e.dataset.mentionKind===`chat`&&e.dataset.label&&e.dataset.sessionFile?{type:`chat`,label:e.dataset.label,sessionFile:e.dataset.sessionFile,...e.dataset.conversationId?{conversationId:e.dataset.conversationId}:{}}:e.dataset.mentionKind===`ui-element`&&e.dataset.label&&e.dataset.path&&e.dataset.text?{type:`ui-element`,id:e.dataset.id??``,label:e.dataset.label,path:e.dataset.path,text:e.dataset.text,imageId:e.dataset.imageId??``}:null}function ZA(e){let t=[],n=e=>{if(!e)return;let n=t.at(-1);n?.type===`text`?n.text+=e:t.push({type:`text`,text:e})},r=e=>{if(e.nodeType===Node.TEXT_NODE){n(e.textContent??``);return}if(e instanceof HTMLElement){if(e.dataset.mentionKind){let n=XA(e);n&&t.push(n);return}if(e.tagName===`BR`){n(`
188
- `);return}(e.tagName===`DIV`||e.tagName===`P`)&&t.length>0&&n(`
189
- `);for(let t of e.childNodes)r(t)}};for(let t of e.childNodes)r(t);return t}function QA(e){let t=window.getSelection();if(!t||t.rangeCount===0||!t.isCollapsed)return null;let{anchorNode:n,anchorOffset:r}=t;return!n||!e.contains(n)||n.nodeType!==Node.TEXT_NODE?null:{node:n,offset:r}}function $A(e,t){if(t.rangeCount===0||!t.isCollapsed)return null;let{anchorNode:n,anchorOffset:r}=t;if(!n||n.nodeType===Node.TEXT_NODE||n!==e&&!e.contains(n))return null;let i=n.childNodes,a=i[r],o=r>0?i[r-1]:void 0,s=a?.nodeType===Node.TEXT_NODE?{node:a,offset:0}:o?.nodeType===Node.TEXT_NODE?{node:o,offset:o.length}:null;if(!s)return null;let c=document.createRange();return c.setStart(s.node,s.offset),c.collapse(!0),c}function ej(e){return e instanceof HTMLElement&&!!e.dataset.mentionKind}function tj(e){return e instanceof Text&&!/[^\s\u00a0]/.test(e.textContent??``)}function nj(e,t){let n=window.getSelection();if(!n||n.rangeCount===0||!n.isCollapsed)return null;let{anchorNode:r,anchorOffset:i}=n;if(!r||!e.contains(r))return null;if(r.nodeType===Node.TEXT_NODE){let e=r.textContent??``;if(t===`before`){if(/[^\s\u00a0]/.test(e.slice(0,i)))return null;let t=r.previousSibling;for(;tj(t);)t=t.previousSibling;return ej(t)?t:null}if(/[^\s\u00a0]/.test(e.slice(i)))return null;let n=r.nextSibling;for(;tj(n);)n=n.nextSibling;return ej(n)?n:null}let a=r.childNodes;if(t===`before`){let e=i-1;for(;e>=0&&tj(a[e]);)--e;let t=e>=0?a[e]:null;return ej(t)?t:null}let o=i;for(;o<a.length&&tj(a[o]);)o+=1;let s=a[o];return ej(s)?s:null}function rj(e,t){let n=e.nextSibling;tj(n)&&n.remove();let r=e.previousSibling;if(e.remove(),r){ij(r);return}let i=window.getSelection();if(!i)return;let a=document.createRange();a.setStart(t,0),a.collapse(!0),i.removeAllRanges(),i.addRange(a)}function ij(e){let t=window.getSelection();if(!t)return;let n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.removeAllRanges(),t.addRange(n)}var aj=(0,H.forwardRef)(function({placeholder:e,disabled:t,className:n,onStateChange:r,onKeyDown:i,onPaste:a,onPasteText:o,onCompositionStart:s,onCompositionEnd:c,onChipActivate:l,ariaProps:u},d){let{t:f}=K(),p=(0,H.useRef)(null),m={title:e=>f(`Quote · {{count}} lines`,{count:e}),truncated:e=>f(`Truncated · original {{count}} lines`,{count:e}),expand:f(`Click to expand`),remove:f(`Remove quote`)},h=(0,H.useRef)(m);h.current=m;let g=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=e=>{let t=e.target;for(let e of p.current?.querySelectorAll(`[data-mention-kind="quote"][data-expanded]`)??[])t&&e.contains(t)||(delete e.dataset.expanded,qA(e,h.current))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[]),(0,H.useEffect)(()=>{let e=()=>{let e=p.current;if(!e||document.activeElement!==e)return;let t=window.getSelection();if(!t||t.rangeCount===0||!t.isCollapsed)return;let n=t.anchorNode;if(n&&(n===e||e.contains(n))){let r=$A(e,t);r?(t.removeAllRanges(),t.addRange(r)):n.nodeType===Node.TEXT_NODE&&(g.current={node:n,offset:t.anchorOffset});return}let r=g.current,i=document.createRange();r?.node.isConnected&&e.contains(r.node)?(i.setStart(r.node,Math.min(r.offset,r.node.length)),i.collapse(!0)):(i.selectNodeContents(e),i.collapse(!0)),t.removeAllRanges(),t.addRange(i)};return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[]);let _=(0,H.useCallback)(()=>{let e=p.current;if(!e)return;let t=ZA(e),n=t.map(e=>e.type===`text`?e.text:``).join(``),i=t.some(e=>e.type!==`text`),a=null,o=null,s=null,c=null,l=QA(e);if(l){let t=l.node.textContent?.slice(0,l.offset)??``;a=Hk(t,t.length),a===null&&(s=BA(t,t.length)),a===null&&s===null&&(c=NO(t)),a===null&&l.node===e.firstChild&&/^\/[^\s]*$/.test(t)&&(o=t.slice(1))}r({plainText:n,hasMentions:i,segments:t,mentionQuery:a,slashQuery:o,skillQuery:s,pluginQuery:c})},[r]),v=(0,H.useCallback)(e=>{let t=p.current;if(!t)return null;let n=QA(t);if(!n)return null;let r=n.node.textContent?.slice(0,n.offset)??``;if(e===`#`){let e=NO(r);return e===null?null:{node:n.node,start:r.length-e.length-1,end:n.offset}}if(e===`@`||e===`$`){let t=e===`@`?Hk(r,r.length):BA(r,r.length);return t===null?null:{node:n.node,start:r.length-t.length-1,end:n.offset}}return n.node!==t.firstChild||!/^\/[^\s]*$/.test(r)?null:{node:n.node,start:0,end:n.offset}},[]),y=(0,H.useCallback)((e,t)=>{let n=p.current;if(!n)return;n.focus();let r=document.createRange(),i=t?v(`@`):null;if(i)r.setStart(i.node,i.start),r.setEnd(i.node,i.end),r.deleteContents();else{let e=QA(n);e?(r.setStart(e.node,e.offset),r.collapse(!0)):(r.selectNodeContents(n),r.collapse(!1))}let a=e();r.insertNode(a);let o=document.createTextNode(`\xA0`);a.parentNode?.insertBefore(o,a.nextSibling),ij(o),_()},[v,_]);return(0,H.useImperativeHandle)(d,()=>({focus:()=>p.current?.focus(),isEmpty:()=>{let e=p.current;return!e||!ZA(e).some(e=>e.type!==`text`||e.text.trim().length>0)},getSegments:()=>p.current?ZA(p.current):[],setSegments:e=>{let t=p.current;if(t){t.textContent=``;for(let n of e)n.type===`text`?t.appendChild(document.createTextNode(n.text)):t.appendChild(YA(n,h.current));_()}},clear:()=>{let e=p.current;e&&(e.textContent=``,_())},insertMention:e=>{let t=e.kind===`file`?{type:`file`,path:e.relativePath}:e.kind===`chat`?{type:`chat`,label:e.label,sessionFile:e.sessionFile,conversationId:e.id}:{type:`ui-element`,id:e.id,label:e.label,path:e.path,text:e.text,imageId:e.imageId};y(()=>YA(t,h.current),e.kind!==`ui-element`)},consumeToken:e=>{let t=v(e);if(!t)return;let n=document.createRange();n.setStart(t.node,t.start),n.setEnd(t.node,t.end),n.deleteContents(),_()},insertFileChip:(e,t)=>{y(()=>YA({type:`file`,path:e,...t?{label:t}:{}},h.current),!1)},insertText:e=>{y(()=>document.createTextNode(e),!1)},insertQuote:e=>{let t=p.current;if(!t)return;let n=document.createTextNode(`\xA0`);t.append(YA(e,h.current),n),t.focus(),window.getSelection()?.collapse(n,n.length),t.scrollTop=t.scrollHeight,_()},getMentionAnchorRect:()=>{let e=v(`@`);if(!e)return null;let t=document.createRange();return t.setStart(e.node,e.start),t.setEnd(e.node,Math.min(e.start+1,e.node.length)),t.getBoundingClientRect()}}),[v,_,y]),(0,G.jsx)(`div`,{ref:p,contentEditable:!t,role:u?.role??`textbox`,"aria-placeholder":e,"data-placeholder":e,...u,onInput:_,onKeyDown:e=>{if(!e.nativeEvent.isComposing&&(e.key===`Backspace`||e.key===`Delete`)){let t=p.current,n=t&&nj(t,e.key===`Backspace`?`before`:`after`);if(n&&t){e.preventDefault(),rj(n,t),_();return}}i(e)},onClick:e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[data-mention-kind]`);if(!(n instanceof HTMLElement)||!p.current?.contains(n))return;if(n.dataset.mentionKind===`quote`){t.closest(`[data-quote-remove]`)?(rj(n,p.current),_()):n.dataset.expanded!==`true`&&(n.dataset.expanded=`true`,qA(n,h.current));return}if(!l)return;let r=XA(n);r&&l(r)},onKeyUp:e=>{e.key!==`Escape`&&_()},onMouseUp:_,onPaste:e=>{if(e.clipboardData.files.length>0){a(e);return}e.preventDefault();let t=e.clipboardData.getData(`text/plain`);t&&(o?.(t)||document.execCommand(`insertText`,!1,t))},onCompositionStart:s,onCompositionEnd:()=>{c(),_()},className:W(`max-h-40 min-h-10 min-w-0 flex-1 overflow-y-auto pt-0.5 text-sm break-words whitespace-pre-wrap outline-none`,`empty:before:pointer-events-none empty:before:text-muted-foreground empty:before:content-[attr(data-placeholder)]`,t&&`opacity-60`,n)})}),oj=Qr(`relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button,a&]:cursor-pointer [button,a&]:pointer-coarse:after:absolute [button,a&]:pointer-coarse:after:size-full [button,a&]:pointer-coarse:after:min-h-11 [button,a&]:pointer-coarse:after:min-w-11`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-5.5 min-w-5.5 px-[calc(--spacing(1)-1px)] text-sm sm:h-4.5 sm:min-w-4.5 sm:text-xs`,lg:`h-6.5 min-w-6.5 px-[calc(--spacing(1.5)-1px)] text-base sm:h-5.5 sm:min-w-5.5 sm:text-sm`,sm:`h-5 min-w-5 rounded-[calc(var(--radius-sm)-2px)] px-[calc(--spacing(1)-1px)] text-xs sm:h-4 sm:min-w-4 sm:text-[.625rem]`},variant:{default:`bg-primary text-primary-foreground [button,a&]:hover:bg-primary/90`,destructive:`bg-destructive text-white [button,a&]:hover:bg-destructive/90`,error:`bg-destructive/12 text-destructive dark:bg-destructive/16`,info:`bg-info/12 text-info dark:bg-info/16`,outline:`border-border bg-transparent dark:bg-input/32 [button,a&]:hover:bg-accent/50 dark:[button,a&]:hover:bg-input/48`,secondary:`bg-secondary text-secondary-foreground [button,a&]:hover:bg-secondary/90`,success:`bg-success/12 text-success dark:bg-success/16`,warning:`bg-warning/12 text-warning-foreground dark:bg-warning/16`}}});function sj({className:e,variant:t,size:n,render:r,...i}){return qr({defaultTagName:`span`,props:cr({className:W(oj({className:e,size:n,variant:t})),"data-slot":`badge`},i),render:r})}var cj=/[\\/]/;function lj(e){return e.split(cj).filter(e=>e.length>0)}function uj(e){let t=new Map,n=e.map(lj),r=n.map(e=>e.join(`/`));for(let i=0;i<e.length;i++){let a=e[i],o=n[i]??[],s=Math.max(0,o.length-3);for(;s>0;){let e=o.slice(s).join(`/`);if(!r.some(t=>t!==r[i]&&(t===e||t.endsWith(`/${e}`))))break;s--}let c=o.slice(s).join(`/`);t.set(a,s>0?`…/${c}`:c)}return t}function dj({groups:e,query:t,activeIndex:n,onActiveIndexChange:r,openFolderId:i,folderIndex:a,onOpenFolderIdChange:o,onFolderIndexChange:s,onSelect:c,id:l=`composer-mention-picker`,left:u=0,flyoutSide:d=`right`}){let{t:f}=K(),p=jD(),m=(0,H.useMemo)(()=>xD(e,t),[e,t]),h=(0,H.useMemo)(()=>uj(e.files.map(e=>e.relativePath)),[e.files]),g=(0,H.useRef)(new Map),_=(0,H.useRef)(new Map),v=m[0]?.type===`folder`;if((0,H.useEffect)(()=>{g.current.get(n)?.scrollIntoView({block:`nearest`})},[n]),(0,H.useEffect)(()=>{i&&_.current.get(a)?.scrollIntoView({block:`nearest`})},[i,a]),m.length===0)return null;let y={agents:f(`Agents`),members:f(`Members`),chats:f(`Chats`)},b={agents:pt,members:tr,chats:Mn},x=i?e[i]:[],S=0,C=()=>x.map((e,t)=>(0,G.jsx)(fj,{ref:e=>{e?_.current.set(t,e):_.current.delete(t)},id:`${l}-sub-${t}`,candidate:e,active:t===a,onHover:()=>s(t),onSelect:()=>c(e)},`sub:${e.id}`)),w=!!(p&&i&&x.length>0),T=e=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,"data-slot":`mention-sheet-back`,onClick:()=>o(null),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs`,children:[(0,G.jsx)(bt,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 font-medium`,children:y[e]})]}),C()]}),E=(t,i)=>{let a=e[t];if(a.length===0)return null;let s=t===`files`?f(`Files`):y[t];return(0,G.jsxs)(`div`,{role:`group`,"aria-label":s,children:[(0,G.jsx)(`p`,{className:W(`px-2 pb-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,i?`pt-2`:`pt-1.5`),children:s}),a.map(e=>{let i=S++;return(0,G.jsx)(fj,{ref:e=>{e?g.current.set(i,e):g.current.delete(i)},id:`${l}-option-${i}`,candidate:e,active:i===n,pathLabel:e.kind===`file`?h.get(e.relativePath):void 0,onHover:()=>{r(i),v&&o(null)},onSelect:()=>c(e)},`${t}:${e.id}`)})]})};return(0,G.jsxs)(`div`,{"data-slot":`mention-picker`,className:p?`absolute inset-x-0 bottom-full z-10 mb-1.5 w-full`:`absolute bottom-full z-10 mb-1.5 max-w-full`,style:p?void 0:{left:u},children:[(0,G.jsx)(`div`,{id:l,role:`listbox`,"aria-label":f(`Mention suggestions`),className:p?`max-h-[50dvh] w-full overflow-y-auto rounded-lg border bg-popover p-1 shadow-md`:`max-h-72 w-80 max-w-full overflow-y-auto rounded-lg border bg-popover p-1 shadow-md`,children:w&&i?T(i):v?(0,G.jsxs)(G.Fragment,{children:[m.filter(e=>e.type===`folder`).map(e=>{let t=S++,a=b[e.id];return(0,G.jsxs)(`button`,{ref:e=>{e?g.current.set(t,e):g.current.delete(t)},id:`${l}-option-${t}`,type:`button`,role:`option`,"aria-selected":n===t,onClick:()=>{r(t),o(e.id),s(0)},onMouseMove:()=>{r(t),!p&&i!==e.id&&(o(e.id),s(0))},className:W(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs`,n===t&&`bg-foreground/10`),children:[(0,G.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border bg-background`,children:(0,G.jsx)(a,{className:`h-3.5 w-3.5 text-muted-foreground`})}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 font-medium`,children:y[e.id]}),(0,G.jsx)(yt,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]},`folder:${e.id}`)}),E(`files`,!0)]}):(0,G.jsxs)(G.Fragment,{children:[E(`agents`,!1),E(`members`,e.agents.length>0),E(`chats`,e.agents.length+e.members.length>0),E(`files`,e.agents.length+e.members.length+e.chats.length>0)]})}),!p&&i&&x.length>0&&(0,G.jsx)(`div`,{role:`listbox`,"aria-label":y[i],"data-slot":`mention-flyout`,className:W(`absolute top-0 z-20 max-h-72 w-72 overflow-y-auto rounded-lg border bg-popover p-1 shadow-md`,d===`right`?`left-full ml-1`:`right-full mr-1`),children:C()})]})}function fj({ref:e,id:t,candidate:n,active:r,pathLabel:i,onHover:a,onSelect:o}){let{t:s}=K(),c=pj(n),l=n.kind===`agent-type`?n.source===`bot`?tr:pt:n.kind===`chat`?Mn:c?qt:Ut;return(0,G.jsxs)(`button`,{ref:e,id:t,type:`button`,role:`option`,"aria-selected":r,onClick:o,onMouseMove:a,className:W(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs`,r&&`bg-foreground/10`),children:[(0,G.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border bg-background`,children:(0,G.jsx)(l,{className:`h-3.5 w-3.5 text-muted-foreground`})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0 font-medium`,children:n.label}),(0,G.jsx)(sj,{variant:`outline`,className:`px-1 py-0 text-[9px]`,children:n.kind===`agent-type`?s(n.source===`system`?`System`:n.source===`builtin`?`Built-in`:n.source===`bot`?`Member`:`Custom`):n.kind===`chat`?s(`Chat`):s(c?`Folder`:`File`)}),n.kind===`agent-type`&&n.locked&&(0,G.jsx)(sj,{variant:`secondary`,className:`px-1 py-0 text-[9px]`,children:s(`Locked`)})]}),(0,G.jsx)(`span`,{className:W(`block text-muted-foreground`,n.kind===`file`?`whitespace-normal break-all`:`truncate`),title:n.kind===`file`?n.relativePath:void 0,children:n.kind===`agent-type`?n.source===`bot`?n.description:s(n.description):n.kind===`chat`?n.sessionFile.split(`/`).at(-1):n.kind===`file`?i??n.relativePath:n.path})]})]})}function pj(e){return e.kind===`file`&&/[\\/]$/.test(e.relativePath)}var mj=[`on`,`off`],hj=[`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function gj(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function _j(e){return typeof e==`string`&&mj.includes(e)}function vj(e){return typeof e==`string`&&hj.includes(e)}function yj(e){if(!e)return{};let t={};_j(e.reasoning)&&(t.reasoning=e.reasoning),vj(e.thinkingLevel)&&(t.thinkingLevel=e.thinkingLevel);let n=gj(e.contextWindow);n!==void 0&&(t.contextWindow=n);let r=gj(e.maxTokens);return r!==void 0&&(t.maxTokens=r),t}var bj=e=>{let t=e.indexOf(`#`);return t===-1?e:e.slice(0,t)},xj=`enso-virtual`;function Sj(e){return e?.providerId===xj}function Cj(e,t){if(!(!t||!Sj(t)))return e?.find(e=>e.id===t.modelId)}function wj(e,t){return e?.find(e=>e.id===t)?.name??t}new Set(Object.values({"openrouter.ai":`openrouter`,"opencode.ai":`opencode`,"ai-gateway.vercel.sh":`vercel-ai-gateway`,"api.typesafe.ai":`typesafe`}));function Tj(e,t){if(e===void 0)return t.map(e=>({...e}));let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e){let e=n.get(t.id);n.delete(t.id);let i={id:t.id};t.label!==void 0&&(i.label=t.label),e&&(e.label!==void 0&&(i.label=e.label),e.enabled!==void 0&&(i.enabled=e.enabled),e.imageGeneration!==void 0&&(i.imageGeneration=e.imageGeneration),Object.assign(i,yj(e))),r.push(i)}for(let e of n.values())r.push({...e});return r}function Ej(e,t){if(!t)return[...e];let n=new Map(t.providers.map(e=>[e.key,e]));return e.map(e=>{if(!e.oauthAccountKey)return e;let t=n.get(bj(e.oauthAccountKey));return t?{...e,models:Tj(t.models,e.models)}:e})}var Dj=H.createContext(void 0);function Oj(e){let t=H.useContext(Dj);if(t===void 0&&!e)throw Error(Cr(33));return t}var kj=H.createContext(void 0);function Aj(e){let t=H.useContext(kj);if(t===void 0&&!e)throw Error(Cr(36));return t}var jj=H.createContext(void 0);function Mj(e=!0){let t=H.useContext(jj);if(t===void 0&&!e)throw Error(Cr(25));return t}var Nj=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Aj(),s=o.useState(`open`),c=o.useState(`mounted`),l=o.useState(`transitionStatus`),u=o.useState(`lastOpenChangeReason`),d=Mj(),f={open:s,transitionStatus:l};return Vr(`div`,e,{ref:d?.backdropRef?[t,d.backdropRef]:t,state:f,stateAttributesMapping:ny,props:[{role:`presentation`,hidden:!c,style:{pointerEvents:u===`trigger-hover`?`none`:void 0,userSelect:`none`,WebkitUserSelect:`none`}},a]})});function Pj({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=H.useRef(e!==void 0),[a,o]=H.useState(t);return[i?e:a,H.useCallback(e=>{i||o(e)},[])]}function Fj(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=Mj(!0),f=d!==void 0;return H.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:Vy})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!lb&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&Py(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var Ij={type:`regular-item`};function Lj(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=H.useRef(null),{getButtonProps:d,buttonRef:f}=Fy({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Fj({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=H.useCallback(e=>cr(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=Er(u,f);return H.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Rj=H.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function zj(){return H.useContext(Rj)}function Bj(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=zj(),u=H.useRef(-1),[d,f]=H.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=H.useRef(null),h=H.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Y(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Vj=H.createContext(void 0);function Hj(){let e=H.useContext(Vj);if(e===void 0)throw Error(Cr(31));return e}var Uj=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=H.useState(void 0),c=Vr(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,G.jsx)(Vj.Provider,{value:s,children:c})}),Wj=H.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Qy(a),c=Hj();return Y(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),Vr(`div`,e,{ref:t,props:{id:s,role:`presentation`,...o}})}),Gj=H.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Bj({guess:!0,label:a}),f=Oj(!0),p=Qy(i),{store:m}=Aj(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Lj({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Ij});return Vr(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),Kj=H.createContext(void 0);function qj(e){let t=H.useContext(Kj);if(t===void 0&&!e)throw Error(Cr(69));return t}var Jj=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Aj(),{side:c,align:l}=Oj(),u=qj(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;Mw({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),H.useEffect(()=>{function e(e){s.setOpen(!1,qy(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),aT(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=Vr(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:ny,props:[p,{onKeyDown(e){u&&xT.has(e.key)&&e.stopPropagation()}},mD(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,G.jsx)(WS,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),Yj=H.createContext(void 0);function Xj(){let e=H.useContext(Yj);if(e===void 0)throw Error(Cr(32));return e}var Zj=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Aj();return i.useState(`mounted`)||n?(0,G.jsx)(Yj.Provider,{value:n,children:(0,G.jsx)(TS,{ref:t,...r})}):null});function Qj(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=jy(i),[,o]=H.useState(!1),s=Tr(eM).current,c=Tr($j).current,l=H.useRef(0),u=H.useRef(!0),d=H.useRef([]),f=H.useRef(null),p=jy(()=>{u.current||(u.current=!0,o(e=>!e))}),m=jy((e,t)=>{c.set(e,t),p()}),h=jy(e=>{c.delete(e),p()}),g=jy(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!rM(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&iM(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=nM(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=jy(()=>{let[e,t]=tM(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});Y(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Y(()=>{u.current&&v()}),Y(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=jy(e=>(s.add(e),()=>{s.delete(e)})),b=H.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,G.jsx)(Rj.Provider,{value:b,children:t})}function $j(){return new Map}function eM(){return new Set}function tM(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>iM(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function nM(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function rM(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function iM(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var aM=20;function oM(e,t,n,r){let[i,a]=H.useState(!1);Y(()=>{if(!e||!t||n==null){a(!1);return}let r=Ny(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-aM)},[e,t,n]),MT(e&&(!t||i),r)}var sM=H.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=vS,style:g,..._}=e,{store:v}=Aj(),y=Xj(),b=Mj(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),ee=H.useRef(null),L=jw(A),te=n,R=c,z=l,B=s,ne=h;x.type===`context-menu`&&(te=n??x.context?.anchor,B??=`start`,!o&&B!==`center`&&(z=e.alignOffset??2,R=e.sideOffset??-5));let V=o,re=B;x.type===`menu`?(V??=`inline-end`,re??=`start`,ne=e.collisionAvoidance??yS):x.type===`menubar`&&(V??=x.context.orientation===`vertical`?`inline-end`:`bottom`,re??=`start`);let ie=x.type===`context-menu`,ae=dD({anchor:te,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:V,sideOffset:R,align:re,alignOffset:z,arrowPadding:ie?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:ne,shift:ie?{crossAxis:!(`side`in ne&&ne.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});H.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,qy(Gy)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),H.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,qy(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let oe=rb();H.useEffect(()=>{T||oe.clear()},[T,oe]),H.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`))){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?oe.isStarted()||oe.start(e,()=>{v.setOpen(!1,qy(Gy))}):v.setOpen(!1,qy(Gy))}else oe.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,oe]),H.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),Y(()=>{let e=I,t=ee.current;if(e&&(ee.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return L(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,L,v]);let se={open:T,side:ae.side,align:ae.align,anchorHidden:ae.anchorHidden,nested:x.type===`menu`,instant:j},ce=x.type===`menubar`&&x.context.modal;oM(T&&(ce||E&&N!==`trigger-hover`),D===`touch`,A,O);let le=hD(e,se,{styles:ae.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),ue=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),de=null;return x.type===`menubar`?de=x.context.contentElement:x.type===void 0&&(de=O),(0,G.jsxs)(Dj.Provider,{value:ae,children:[ue&&(0,G.jsx)(TT,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:wT(!T),cutout:de}),(0,G.jsx)(NS,{id:P,children:(0,G.jsx)(Qj,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:le})})]})}),cM=H.createContext(null);function lM(e){let t=H.useContext(cM);if(t===null&&!e)throw Error(Cr(5));return t}var uM={...Zw,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},dM=class extends Dw{constructor(e){super({...pM(),...e},fM(),uM),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function fM(){return{positionerRef:H.createRef(),popupRef:H.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:H.createRef(),beforeContentFocusGuardRef:H.createRef(),onOpenChangeComplete:void 0,triggerElements:new Ww}}function pM(){return{...Gw(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new DS,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Lr,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var mM=H.createContext(void 0);function hM(){return H.useContext(mM)}var gM=_w(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=Mj(!0),_=Aj(!0),v=lM(!0),y=hM(),b=H.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=_M({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b});x.useControlledProp(`openProp`,n),x.useControlledProp(`triggerIdProp`,p),x.useContextCallback(`onOpenChangeComplete`,i);let S=Zy(),C=Zy(),w=x.useState(`floatingTreeRoot`),T=MS(w),E=AS(),D=x.useState(`open`),O=x.useState(`activeTriggerElement`),k=x.useState(`positionerElement`),A=x.useState(`hoverEnabled`),j=x.useState(`disabled`),M=x.useState(`lastOpenChangeReason`),N=x.useState(`parent`),P=x.useState(`activeIndex`),F=x.useState(`payload`),I=x.useState(`floatingParentNodeId`),ee=H.useRef(null),L=H.useRef(N.type!==`context-menu`),te=rb(),R=H.useRef(!0),z=rb(),B=I!=null,{openMethod:ne,triggerProps:V}=zT(D);x.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:N.type===void 0?s:void 0,openMethod:ne,rootId:S}),Bw(x);let{forceUnmount:re}=Vw(D,x,()=>{x.set(`allowMouseEnter`,!1)});Y(()=>{g&&!_?x.update({parent:{type:`context-menu`,context:g},floatingNodeId:T,floatingParentNodeId:E}):_&&x.update({floatingNodeId:T,floatingParentNodeId:E})},[g,_,T,E,x]),H.useEffect(()=>{if(D||(ee.current=null),N.type===`context-menu`){if(!D){te.clear(),L.current=!1;return}te.start(500,()=>{L.current=!0})}},[te,D,N.type]),Y(()=>{!D&&!A&&x.set(`hoverEnabled`,!0)},[D,A,x]);let ie=jy((e,t)=>{let n=t.reason;if(!e&&!x.select(`open`)||D===e&&t.trigger===O&&M===n)return;let i=Rw(t);if(!e&&t.trigger==null&&(t.trigger=O??void 0),r?.(e,t),t.isCanceled)return;x.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!R.current)return;e&&n===`trigger-focus`?(R.current=!1,z.start(300,()=>{R.current=!0})):(R.current=!0,z.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};ee.current=t.event,Lw(c,e,t.trigger,i()),x.update(c),N.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?x.set(`instantType`,`group`):o||s?x.set(`instantType`,o?`click`:`dismiss`):x.set(`instantType`,void 0)}),ae=kw({popupStore:x,floatingId:C,nested:E!=null,onOpenChange:ie}),oe=ae.context.events;Y(()=>{let e=({open:e,eventDetails:t})=>ie(e,t);return oe.on(`setOpen`,e),()=>{oe?.off(`setOpen`,e)}},[oe,ie]);let se=H.useCallback(()=>{x.setOpen(!1,qy(Ky))},[x]);H.useImperativeHandle(u,()=>({unmount:re,close:se}),[re,se]);let ce;N.type===`context-menu`&&(ce=N.context),H.useImperativeHandle(ce?.positionerRef,()=>k,[k]),H.useImperativeHandle(ce?.actionsRef,()=>({setOpen:ie}),[ie]);let le=JS(ae,{enabled:!j,bubbles:{escapeKey:d&&N.type===`menu`},outsidePress(){return N.type!==`context-menu`||ee.current?.type===`contextmenu`||L.current},externalTree:B?w:void 0}),ue=iE(),de=H.useCallback(e=>{x.select(`activeIndex`)!==e&&x.set(`activeIndex`,e)},[x]),fe=dT(ae,{enabled:!j,listRef:x.context.itemDomElements,activeIndex:P,nested:N.type!==void 0,loopFocus:c,orientation:l,parentOrientation:N.type===`menubar`?N.context.orientation:void 0,rtl:ue===`rtl`,disabledIndices:Ir,onNavigate:de,openOnArrowKeyDown:N.type!==`context-menu`,externalTree:B?w:void 0,focusItemOnHover:h}),pe=H.useCallback(e=>{x.context.typingRef.current=e},[x]),me=fT(ae,{enabled:!j,listRef:x.context.itemLabels,elementsRef:x.context.itemDomElements,activeIndex:P,resetMs:500,onMatch:e=>{D&&e!==P&&x.set(`activeIndex`,e)},onTyping:pe});Hw(x,{floatingRootContext:ae,activeTriggerProps:H.useMemo(()=>{let e=cr(me.reference,fe.reference,le.reference,{onMouseMove(){x.set(`allowMouseEnter`,!0)}},V);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=D,e},[x,me.reference,fe.reference,le.reference,V,D]),inactiveTriggerProps:H.useMemo(()=>{let e=cr(fe.trigger,le.trigger,V);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[fe.trigger,le.trigger,V]),popupProps:H.useMemo(()=>cr(Nw,{id:C,role:`menu`,"aria-labelledby":O?.id,onMouseMove(){x.set(`allowMouseEnter`,!0),N.type===`menu`&&x.set(`hoverEnabled`,!1)},onClick(){x.select(`hoverEnabled`)&&x.set(`hoverEnabled`,!1)},onKeyDown(e){let t=x.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},me.floating,fe.floating,le.floating),[O,C,N.type,x,me.floating,fe.floating,le.floating]),itemProps:fe.item??Lr});let he=H.useMemo(()=>({store:x,parent:b}),[x,b]),ge=(0,G.jsxs)(kj.Provider,{value:he,children:[f&&(0,G.jsx)(Iw,{handle:f,store:x}),typeof t==`function`?t({payload:F}):t]});return N.type===void 0||N.type===`context-menu`?(0,G.jsx)(PS,{externalTree:w,children:ge}):ge});function _M(e){return Tr(()=>new dM(e)).current}var vM=5;function yM(e,t){let n=bM(t);return e.clientX>=n.left-vM&&e.clientX<=n.right+vM&&e.clientY>=n.top-vM&&e.clientY<=n.bottom+vM}function bM(e){let t=e.getBoundingClientRect(),n=oy(e);if(db)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function xM(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=My(),{ref:i,index:a}=Bj(e),o=n===a,s=H.useRef(null),c=Er(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function SM(e){let{render:t,className:n,style:r,state:i=Lr,props:a=Ir,refs:o=Ir,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=xM({metadata:s});return Vr(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function CM(e){if(uy(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!Sy(e))return CM(Ty(e))}function wM(e,t){let n=H.useRef(null);function r(t){Gs.flushSync(()=>{e.setOpen(!1,qy(Hy,t.nativeEvent,t.currentTarget))}),Yx(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&Xx(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{Gs.flushSync(()=>{e.setOpen(!1,qy(Hy,n.nativeEvent,n.currentTarget))});let i=Jx(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&xb(r,i);){let e=i;if(i=Gx(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function TM(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=H.useRef(!1);return H.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Ny(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Lr,[t,n,r])}var EM=vw(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=Aj(!0),h=Qw(d)??m?.store;if(!h)throw Error(Cr(85));let g=Qy(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=H.useRef(null),S=OM(),C=My(!0),w=jS(),T=H.useMemo(()=>w??new DS,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=zw(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:MS(T),floatingParentNodeId:AS(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=Fy({disabled:A,native:o});H.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=H.useRef(null),P=rb(),F=jy(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;xb(N.current,t)||xb(h.select(`positionerElement`),t)||t===N.current||(t==null||CM(t)!==h.select(`rootId`))&&(yM(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:Wy}))});H.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&Ny(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,ee=oT(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:vT({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),L=DM(y,h.select(`lastOpenChangeReason`)),te=GS(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&L}),R=eT(v,{enabled:!A&&I}),z=TM({open:y,enabled:O,mouseDownAction:`open`}),B=H.useMemo(()=>cr(R.reference,te.reference),[R.reference,te.reference]),ne=h.useState(`triggerProps`,D),{preFocusGuardRef:V,handlePreFocusGuardFocus:re,handleFocusTargetFocus:ie}=wM(h,x),ae={disabled:A,open:y},oe=[N,t,M,E,x],se=[B,ee??Lr,ne,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Ny(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},z,p,j],ce=Vr(`button`,e,{enabled:!O,stateAttributesMapping:ey,state:ae,ref:oe,props:se});return O?(0,G.jsx)(SM,{tag:`button`,render:n,className:r,style:i,state:ae,refs:oe,props:se,stateAttributesMapping:ey}):y?(0,G.jsxs)(H.Fragment,{children:[(0,G.jsx)(qb,{ref:V,onFocus:re},`${g}-pre-focus-guard`),(0,G.jsx)(H.Fragment,{children:ce},g),(0,G.jsx)(qb,{ref:h.context.triggerFocusTargetRef,onFocus:ie},`${g}-post-focus-guard`)]}):(0,G.jsx)(H.Fragment,{children:ce},g)});function DM(e,t){let n=rb(),[r,i]=H.useState(!1);return Y(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function OM(){let e=lM(!0);return H.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}function kM(e){let[t,n]=H.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function AM(e){let t=Cy(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=uy(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(Xb(n)!==a||Xb(r)!==o)&&(n=a,r=o),{width:n,height:r}}function jM(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,onMeasureLayout:a,onMeasureLayoutComplete:o,side:s,direction:c}=e,l=jw(t,!0),u=Ub(),d=H.useRef(null),f=H.useRef(!0),p=H.useRef(Fr),m=jy(a),h=jy(o),g=H.useMemo(()=>MM(s,c),[s,c]);Y(()=>{if(!i){p.current=Fr,f.current=!0,d.current=null;return}if(!t||!n)return;p.current=PM(t,g),FM(t,`auto`);let e=NM(t,`position`,`static`),r=NM(t,`transform`,`none`),a=NM(t,`scale`,`1`),o=PM(n,{"--available-width":`max-content`,"--available-height":`max-content`});function s(){e(),r(),o()}function c(){s(),a()}if(m?.(),f.current||d.current===null){IM(n,`max-content`);let e=AM(t);return d.current=e,IM(n,e),c(),h?.(null,e),f.current=!1,()=>{p.current(),p.current=Fr}}IM(n,`max-content`);let _=d.current,v=AM(t);d.current=v,FM(t,_),c(),h?.(_,v),IM(n,v);let y=new AbortController;return u.request(()=>{FM(t,v),l(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},y.signal)}),()=>{y.abort(),u.cancel(),p.current(),p.current=Fr}},[r,t,n,l,u,i,m,h,g])}function MM(e,t){let n=e===`top`,r=e===`left`||e===(t===`rtl`?`inline-end`:`inline-start`);return!n&&!r?Lr:{position:`absolute`,[n?`bottom`:`top`]:`0`,[r?`right`:`left`]:`0`}}function NM(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function PM(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(NM(e,r,i));return n.length?()=>{n.forEach(e=>e())}:Fr}function FM(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function IM(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}var LM={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=oy(i),l=c.getComputedStyle(i);if(l.transitionDuration===`0s`||l.transitionDuration===``)return{x:t,y:n,data:oD};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Ny(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=nx(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:oD.sideX,g=f===`top`?`bottom`:oD.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}},RM={activationDirection:e=>e?{"data-activation-direction":e}:null};function zM(e){let{store:t,side:n,children:r}=e,i=iE(),a=t.useState(`activeTriggerElement`),o=t.useState(`activeTriggerId`),s=t.useState(`open`),c=t.useState(`payload`),l=t.useState(`mounted`),u=t.useState(`popupElement`),d=t.useState(`positionerElement`),f=kM(s?a:null),p=UM(o,c),m=H.useRef(null),[h,g]=H.useState(null),[_,v]=H.useState(null),y=H.useRef(null),b=H.useRef(null),x=jw(y,!0),S=Ub(),C=H.useRef(null),[w,T]=H.useState(null),[E,D]=H.useState(!1);Y(()=>(t.set(`adaptiveOrigin`,LM),()=>{t.set(`adaptiveOrigin`,void 0)}),[t]);let O=jy(()=>{y.current?.style.setProperty(`animation`,`none`),y.current?.style.setProperty(`transition`,`none`),b.current?.style.setProperty(`display`,`none`)}),k=jy(e=>{y.current?.style.removeProperty(`animation`),y.current?.style.removeProperty(`transition`),b.current?.style.removeProperty(`display`),e&&T(e)}),A=jy(()=>{C.current?.abort();let e=new AbortController;C.current=e,x(()=>{g(null),T(null),m.current=null},e.signal)}),j=H.useRef(null);Y(()=>{(!s||!l)&&(j.current=null)},[s,l]),Y(()=>{if(a&&f&&a!==f&&j.current!==a&&m.current){g(m.current),D(!0);let e=HM(f,a);v(e),j.current=a}},[a,f]),Y(()=>{h!=null&&(C.current?.abort(),D(!0),S.request(()=>{Gs.flushSync(()=>{D(!1)}),A()}))},[p,h,A,S]),Y(()=>{let e=y.current;if(!e)return;let t=Ny(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));m.current=t});let M=h!=null,N;N=M?(0,G.jsxs)(H.Fragment,{children:[(0,G.jsx)(`div`,{"data-previous":!0,inert:wT(!0),ref:b,style:{...w?{"--popup-width":`${w.width}px`,"--popup-height":`${w.height}px`}:null,position:`absolute`},"data-ending-style":E?void 0:``},`previous`),(0,G.jsx)(`div`,{"data-current":!0,ref:y,"data-starting-style":E?``:void 0,children:r},p)]}):(0,G.jsx)(`div`,{"data-current":!0,ref:y,children:r},p),Y(()=>{let e=b.current;!e||!h||e.replaceChildren(...Array.from(h.childNodes))},[h]),jM({popupElement:u,positionerElement:d,mounted:l,content:c,onMeasureLayout:O,onMeasureLayoutComplete:k,side:n,direction:i});let P={activationDirection:BM(_),transitioning:M};return{children:N,state:P}}function BM(e){if(e)return`${VM(e.horizontal,5,`right`,`left`)} ${VM(e.vertical,5,`down`,`up`)}`}function VM(e,t,n,r){return e>t?n:e<-t?r:``}function HM(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function UM(e,t){let[n,r]=H.useState(0),i=H.useRef(e),a=H.useRef(t),o=H.useRef(!1);return Y(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var WM=H.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Vr(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function GM(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var KM=gM,qM=`relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-xl border bg-popover bg-clip-padding shadow-xl outline-none transition-[scale,opacity] duration-150 [transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none has-data-starting-style:scale-95 has-data-starting-style:opacity-0 has-data-ending-style:scale-95 has-data-ending-style:opacity-0 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]`;function JM(e){return(0,G.jsx)(EM,{"data-slot":`menu-trigger`,...e})}function YM({children:e,className:t,sideOffset:n=4,align:r=`center`,alignOffset:i,side:a=`bottom`,zIndex:o,...s}){let c=o??BE.MODAL_BACKDROP;return(0,G.jsxs)(Zj,{children:[(0,G.jsx)(Nj,{className:`fixed inset-0`,"data-enso-float":``,style:{zIndex:c-1}}),(0,G.jsx)(sM,{align:r,alignOffset:i,"data-slot":`menu-positioner`,side:a,sideOffset:n,style:{zIndex:c},children:(0,G.jsx)(Jj,{className:W(qM,t),"data-slot":`menu-popup`,...s,children:(0,G.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1.5`,children:e})})})]})}var XM=`[&_svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2.5 whitespace-nowrap rounded-md px-2 py-1.5 text-base outline-none data-disabled:cursor-not-allowed data-disabled:bg-transparent! data-disabled:text-muted-foreground! data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive data-highlighted:text-accent-foreground data-highlighted:data-[variant=destructive]:bg-destructive/10 data-highlighted:data-[variant=destructive]:text-destructive data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`;function ZM(e){return(0,G.jsx)(Uj,{"data-slot":`menu-group`,...e})}function QM({className:e,inset:t,variant:n=`default`,style:r,...i}){return(0,G.jsx)(Gj,{className:W(XM,e),"data-inset":t,"data-slot":`menu-item`,"data-variant":n,style:{WebkitAppRegion:`no-drag`,...r},...i})}function $M({className:e,inset:t,...n}){return(0,G.jsx)(Wj,{className:W(`px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8`,e),"data-inset":t,"data-slot":`menu-label`,...n})}function eN({className:e,...t}){return(0,G.jsx)(WM,{className:W(`mx-2 my-1 h-px bg-border`,e),"data-slot":`menu-separator`,...t})}function tN(e=`default`){return W(`relative inline-flex min-h-9 w-full min-w-36 select-none items-center justify-between gap-2 rounded-lg border border-input bg-background bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base shadow-xs outline-none ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 focus-visible:border-ring focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none`,e===`sm`&&`min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7`,e===`lg`&&`min-h-10 sm:min-h-9`)}function nN(){return(0,G.jsx)(St,{className:`-me-1 size-4.5 opacity-80 sm:size-4`})}var rN=H.createContext(void 0);function iN(){let e=H.useContext(rN);if(e===void 0)throw Error(Cr(63));return e}var aN={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},oN={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},sN={valid(e){return e===null?null:e?{"data-valid":``}:{"data-invalid":``}}},cN={...sN,checked(e){return e?{"data-checked":``}:{"data-unchecked":``}}},lN={invalid:void 0,name:void 0,validityData:{state:aN,errors:[],error:``,value:``,initialValue:null},setValidityData:Fr,disabled:void 0,setTouched:Fr,setDirty:Fr,setFilled:Fr,setFocused:Fr,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:oN,registerFieldControl:Fr,validation:{getValidationProps:(e,t=Lr)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Fr,getInputControl:()=>null,commit:async()=>{},change:Fr}},uN=H.createContext(lN);function dN(e=!0){let t=H.useContext(uN);if(t.setValidityData===Fr&&!e)throw Error(Cr(28));return t}function fN(e,t,n,r,i=!0,a){let{registerFieldControl:o}=dN(),s=Tr(()=>Symbol());Y(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),Y(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var pN=H.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Fr,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function mN(){return H.useContext(pN)}var hN=H.createContext({controlId:void 0,registerControlId:Fr,labelId:void 0,setLabelId:Fr,messageIds:[],setMessageIds:Fr,getDescriptionProps:e=>e});function gN(){return H.useContext(hN)}function _N(e,t,n,r=!0,i){let[a,o]=H.useState(),s=Qy(i?`${i}-label`:void 0),c=e??t??a;return Y(()=>{let i=e||t||!r?void 0:vN(n.current,s);a!==i&&o(i)}),c}function vN(e,t){let n=yN(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function yN(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function bN(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=gN(),o=Qy(t),s=n?i:void 0,c=Tr(()=>Symbol()),l=H.useRef(!1),u=H.useRef(t!=null),d=jy(()=>{!l.current||a===Fr||(l.current=!1,a(c.current,void 0))});return Y(()=>{if(a===Fr)return;let e;if(n){let n=r?.current;e=ly(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),H.useEffect(()=>d,[d]),i??o}var xN=H.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=mN(),{state:x,setTouched:S,setDirty:C,validityData:w,setFilled:T,setFocused:E,validationMode:D,disabled:O,name:k,validation:A}=dN(),{labelId:j}=gN(),M=O||m,N=k??l,P=H.useRef(null),F=Er(P,c,A.inputRef),I=H.useRef(null),ee=Qy(),L=bN({id:s,implicit:!1,controlRef:I}),te=u?void 0:L,[R,z]=Pj({controlled:n,default:!!i,name:`Switch`,state:`checked`});fN(I,ee,R,void 0,!M,l),Y(()=>{P.current&&T(P.current.checked)},[T]),LT(R,()=>{b(N),C(R!==w.initialValue),T(R),A.change(R)});let{getButtonProps:B,buttonRef:ne}=Fy({disabled:M,native:u}),V=_N(a,j,P,!u,te),re={id:u?L:ee,role:`switch`,"aria-checked":R,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":V,onFocus(){M||E(!0)},onBlur(){let e=P.current;!e||M||(S(!0),E(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){if(f||M)return;e.preventDefault();let t=P.current;t&&Py(t,e)}},ie={...A.getValidationProps(M),checked:R,disabled:M,form:o,id:te,name:N,required:p,style:N?Kb:Gb,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=qy(Ly,e.nativeEvent);d?.(t,n),!n.isCanceled&&z(t)},onClick(e){e.stopPropagation()},onFocus(){I.current?.focus()},..._===void 0?Lr:{value:_}},ae=H.useMemo(()=>({...x,checked:R,disabled:M,readOnly:f,required:p}),[x,R,M,f,p]),oe=Vr(`span`,e,{state:ae,ref:[t,I,ne],props:[re,y,B,e=>A.getValidationProps(M,e)],stateAttributesMapping:cN});return(0,G.jsxs)(rN.Provider,{value:ae,children:[oe,!R&&N&&g!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,form:o,name:N,value:g,disabled:M}),(0,G.jsx)(`input`,{...ie,suppressHydrationWarning:!0})]})}),SN=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return Vr(`span`,e,{state:iN(),ref:t,stateAttributesMapping:cN,props:a})});function CN({className:e,...t}){return(0,G.jsx)(xN,{className:W(`group/switch inset-shadow-[0_1px_--theme(--color-black/4%)] inline-flex h-5.5 w-9.5 shrink-0 items-center rounded-full p-px outline-none transition-all focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:opacity-64 sm:h-4.5 sm:w-7.5`,e),"data-slot":`switch`,...t,children:(0,G.jsx)(SN,{className:W(`pointer-events-none block size-5 rounded-full bg-background shadow-sm transition-[translate,width] group-active/switch:not-data-disabled:w-5.5 data-checked:translate-x-4 data-unchecked:translate-x-0 data-checked:group-active/switch:translate-x-3.5 sm:size-4 sm:data-checked:translate-x-3 sm:group-active/switch:not-data-disabled:w-4.5 sm:data-checked:group-active/switch:translate-x-2.5`),"data-slot":`switch-thumb`})})}var wN=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},TN=(e=>e?wN(e):wN),EN=e=>e;function DN(e,t=EN){let n=H.useSyncExternalStore(e.subscribe,H.useCallback(()=>t(e.getState()),[e,t]),H.useCallback(()=>t(e.getInitialState()),[e,t]));return H.useDebugValue(n),n}var ON=e=>{let t=TN(e),n=e=>DN(t,e);return Object.assign(n,t),n},kN=(e=>e?ON(e):ON);kN(()=>({byScope:{},generation:0}));function AN(e){let t=e=>String(e>=100?Math.round(e):Math.round(e*10)/10);return e<1e3?String(e):e<1e6?`${t(e/1e3)}K`:`${t(e/1e6)}M`}function jN(e){let t=e/1e3;if(t<60)return`${Math.round(t*10)/10}s`;let n=Math.round(t);return`${Math.floor(n/60)}m${n%60}s`}var MN=`enso:open-chat-model-picker`;tN(`sm`),tN();function NN(){window.dispatchEvent(new Event(MN))}function PN(e,t){return e.filter(e=>e!==t)}var FN=new Map,IN=e=>e.images.length>0||e.segments.some(e=>e.type!==`text`||e.text.trim()!==``),LN=()=>!!window.electronAPI?.remote&&window.matchMedia?.(`(pointer: coarse)`).matches===!0;function RN({mentionConversationId:e,commands:t,running:n,busy:r,focusKey:i,pluginPresetId:a=null,autoFocus:o=!window.electronAPI?.remote,enterToSend:s=!LN(),toolbar:c,locked:l=!1,injectedDraft:u,injectedImages:d,injectedDraftAppend:f,onDraftConsumed:p,chatCandidates:m,onActivate:h,onSend:g,onAbort:_,queuedCount:v=0,onSteerQueued:y,isolated:b=!1,placeholder:x,planMode:S=!1,savePastedText:C}){let{t:w}=K(),T=jD(),D=E(e=>e.keybindings),O=E(e=>e.privacyMasking),k=FD(D)[`send-message`],A=(0,H.useId)(),[j,M]=(0,H.useState)([]),[N,P]=(0,H.useState)([]),[F,I]=(0,H.useState)(),ee=(0,H.useRef)(i),[L,te]=(0,H.useState)(!1),{setNodeRef:R,isOver:z}=sv({id:b?`isolated-composer:${i??`side`}`:lk,disabled:b}),[B,ne]=(0,H.useState)(null),[V,re]=(0,H.useState)(null),ie=(0,H.useRef)(new Set),ae=(0,H.useRef)(g);ae.current=g;let oe=(0,H.useRef)(O);oe.current=O,(0,H.useEffect)(()=>{if(b)return;let e=ZO(e=>se.current?.insertMention(e)),t=$O(e=>se.current?.insertText(e)),n=tk(e=>se.current?.insertQuote(e)),r=QO(()=>se.current?.focus()),i=ak((e,t)=>{t&&M(n=>[...n,{...t,id:e.imageId}]),se.current?.insertMention(e),se.current?.focus()}),a=ok(e=>{M(t=>[...t,{data:e.data,mimeType:e.mimeType}]),se.current?.focus()}),o=rk(e=>{if(de.current)return!1;let t=oe.current,n=t.enabled?Rv(e.text,t).blocked:[];return n.length>0?(vD({type:`error`,title:w(`Message not sent`),description:w(`Privacy masking blocks {{kinds}}. Remove it, or change the action or allow list in Settings → Privacy.`,{kinds:n.join(`, `)})}),!1):ae.current(e)!==!1});return()=>{e(),t(),n(),r(),i(),a(),o()}},[b,w]);let se=(0,H.useRef)(null),ce=(0,H.useRef)(null),le=(0,H.useRef)(null),ue=(0,H.useRef)(!1),de=(0,H.useRef)(l);de.current=l,(0,H.useEffect)(()=>{if(!(b||!i))return YD({key:i,segments:()=>se.current?.getSegments()??[],insertText:e=>se.current?.insertText(e),setText:e=>se.current?.setSegments(e?[{type:`text`,text:e}]:[]),busy:()=>ue.current||de.current||!se.current})},[b,i]);let[fe,pe]=(0,H.useState)({left:0,flyoutSide:`right`}),[me,he]=(0,H.useState)(``),[ge,_e]=(0,H.useState)(!1),ve=(0,H.useRef)(Symbol(`composer`)),ye=me.trim()!==``||ge||j.length>0;(0,H.useEffect)(()=>VD(ve.current,ye),[ye]),(0,H.useEffect)(()=>()=>VD(ve.current,!1),[]);let[be,xe]=(0,H.useState)(null),Se=TD(e,be,m),Ce=(0,H.useMemo)(()=>xD(Se,be??``),[Se,be]),[we,Te]=(0,H.useState)(null),[Ee,De]=(0,H.useState)(null),[Oe,ke]=(0,H.useState)(null),Ae=BO(Oe,i??null),[je,Me]=(0,H.useState)(0),[Ne,Pe]=(0,H.useState)(null),[Fe,Ie]=(0,H.useState)(0),Le=(0,H.useRef)(null),Re=(0,H.useCallback)(e=>{(e.plainText.trim()||e.hasMentions)&&h?.(),he(e.plainText),_e(e.hasMentions);let t=new Set(e.segments.filter(e=>e.type===`ui-element`&&e.imageId).map(e=>e.type===`ui-element`?e.imageId:``)),n=[...ie.current].filter(e=>!t.has(e));ie.current=t,n.length>0&&(M(e=>pv(e,n)),ne(e=>e&&n.includes(e.imageId)?null:e)),xe(t=>(t!==e.mentionQuery&&(Me(0),Pe(null),Ie(0)),e.mentionQuery)),Te(e.slashQuery),De(e.skillQuery),ke(e.pluginQuery)},[h]);(0,H.useEffect)(()=>{let e=ee.current;if(e!==i){if(e){let t={segments:se.current?.getSegments()??[],images:j,slashes:N,recipient:F};FN.set(e,t),VD(`draft:${e}`,IN(t))}let t=i?FN.get(i):void 0;i&&VD(`draft:${i}`,!1);let n=i?XD(i):void 0;se.current?.setSegments(n?[{type:`text`,text:n}]:t?.segments??[]),ie.current=new Set((t?.segments??[]).filter(e=>e.type===`ui-element`&&e.imageId).map(e=>e.type===`ui-element`?e.imageId:``)),M(t?.images??[]),P(t?.slashes??[]),I(t?.recipient),ee.current=i,xe(null),Te(null),De(null),Me(0),Pe(null),Ie(0)}o&&se.current?.focus()},[i]),(0,H.useEffect)(()=>{if(!u&&!d?.length)return;let e=_A({segments:se.current?.getSegments()??[],images:j,slashes:N},{text:u,images:d},f);P(e.slashes),M(e.images),se.current?.setSegments(e.segments),p?.(),window.setTimeout(()=>se.current?.focus(),0)},[u,d,f]);let ze=N.length===1?N[0]:null,Be=Bv(ze,me.replaceAll(``,``)),Ve=HA(t,we,Ee),He=we===null&&Ee===null&&Be!==null?Vv(ze,Be):[];(0,H.useEffect)(()=>{Me(0)},[we,Ee,Be,Oe]),(0,H.useEffect)(()=>{(Le.current?.children[je])?.scrollIntoView({block:`nearest`})},[je]);let Ue=(0,H.useCallback)(e=>{if(e.kind===`agent-type`){se.current?.consumeToken(`@`),I(e),xe(null);return}se.current?.insertMention(e),xe(null)},[]),We=(0,H.useCallback)(e=>{ke(null),VO(e,i??null).then(e=>{let t=se.current;t&&(t.consumeToken(`#`),e&&t.insertText(e))})},[i]),Ge=be!==null&&Ce.length>0?`mention`:Oe!==null&&Ae.length>0?`plugin`:Ve.length>0?`slash`:He.length>0?`slash-sub`:null;(0,H.useLayoutEffect)(()=>{if(Ge!==`mention`)return;let e=ce.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=e.querySelector(`[data-slot="mention-picker"]`),r=n?.querySelector(`[role="listbox"]`),i=n?.querySelector(`[data-slot="mention-flyout"]`),a=se.current?.getMentionAnchorRect(),o=Uk({anchorLeft:a?a.left-t.left:0,containerWidth:t.width,popupWidth:r instanceof HTMLElement?r.offsetWidth:280,flyoutWidth:i instanceof HTMLElement?i.offsetWidth:252,flyoutGap:4});pe(e=>e.left===o.left&&e.flyoutSide===o.flyoutSide?e:o)};return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[be,me,Ne,Ge]);let Ke=Ge===`mention`?Ce.length:Ge===`plugin`?Ae.length:Ge===`slash-sub`?He.length:Ve.length,qe=(0,H.useCallback)((e,t)=>{let n=[{type:`text`,text:e}];se.current?.setSegments(n),t&&g(oA({segments:n,slashes:N,images:j,recipient:F}))!==!1&&(se.current?.clear(),M([]),P([]),I(void 0),xe(null),Te(null),De(null))},[j,g,F,N]),Je=(0,H.useCallback)(e=>{se.current?.consumeToken(Ee===null?`/`:`$`),Te(null),De(null);let t=WD(e);if(!t){P(t=>hA(t,e));return}KD(t,b?null:i??null).then(e=>{e&&vD({type:`error`,title:w(`Plugin command failed`),description:e})})},[Ee,b,i,w]),Ye=(0,H.useCallback)((e=!1)=>{if(Ge===`mention`){if(Ne){let e=Se[Ne][Fe];e&&Ue(e);return}let e=Ce[je];e?.type===`item`&&Ue(e.candidate)}else if(Ge===`plugin`){let e=Ae[je];e&&We(e)}else if(Ge===`slash`){let e=Ve[je];e&&Je(e.name)}else if(Ge===`slash-sub`){let t=He[je];if(!t)return;qe(t.name,e)}},[je,Fe,Ne,Se,Ce,Ue,We,Ae,Ge,Ve,Je,He,qe]),Xe=me.replaceAll(``,``).trim(),Ze=!!(Xe||N.length>0||j.length>0||ge),Qe=F!==void 0,$e=r&&!Qe,et={sessionId:b?null:i??null,draft:me.replaceAll(``,``),busy:l,pluginPresetId:a},tt=n&&v>0&&y!==void 0&&s&&!!k,nt=tt&&!Ze&&!Qe&&!l,rt=(0,H.useMemo)(()=>O.enabled&&Xe?Rv(Xe,O):null,[Xe,O]),U=()=>{if(!Ze)return;let e=oA({segments:se.current?.getSegments()??[],slashes:N,images:j,recipient:F}),t=O.enabled?Rv(e.text,O).blocked:[];if(t.length>0){vD({type:`error`,title:w(`Message not sent`),description:w(`Privacy masking blocks {{kinds}}. Remove it, or change the action or allow list in Settings → Privacy.`,{kinds:t.join(`, `)})});return}g(e)!==!1&&(se.current?.clear(),M([]),P([]),I(void 0),xe(null),Te(null),De(null))},it=(0,H.useCallback)(e=>{for(let t of e){if(t.type.startsWith(`image/`)){let e=new FileReader;e.onload=()=>{let n=e.result,r=n.slice(n.indexOf(`,`)+1);M(e=>[...e,{data:r,mimeType:t.type}])},e.readAsDataURL(t);continue}let e=window.electronAPI.files.pathForFile(t),n=window.electronAPI.remote;if(!e&&n){n.upload(t).then(e=>{e&&se.current?.insertFileChip(e)}).catch(()=>{});continue}e&&se.current?.insertFileChip(e)}},[]);return(0,H.useEffect)(()=>{if(b)return;let e=sk(e=>{it(e),se.current?.focus()}),t=ck(e=>{for(let t of e)se.current?.insertFileChip(t);se.current?.focus()});return()=>{e(),t()}},[b,it]),(0,G.jsxs)(`div`,{ref:ce,className:`relative`,children:[Ge===`mention`&&(0,G.jsx)(dj,{id:A,groups:Se,query:be??``,activeIndex:je,onActiveIndexChange:Me,openFolderId:Ne,folderIndex:Fe,onOpenFolderIdChange:Pe,onFolderIndexChange:Ie,onSelect:Ue,left:fe.left,flyoutSide:fe.flyoutSide}),Ge===`plugin`&&(0,G.jsx)(`div`,{ref:Le,role:`listbox`,"aria-label":w(`Plugin suggestions`),className:`absolute bottom-full left-0 z-10 mb-1.5 max-h-64 w-full overflow-y-auto rounded-lg border bg-popover p-1 shadow-md`,children:Ae.map((e,t)=>(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===je,onMouseDown:e=>e.preventDefault(),onClick:()=>We(e),onMouseMove:()=>Me(t),className:W(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs`,t===je&&`bg-foreground/10`),children:[(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:`#`}),(0,G.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.item.label}),e.item.detail&&(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:e.item.detail})]},e.key))}),(Ge===`slash`||Ge===`slash-sub`)&&(0,G.jsx)(`div`,{ref:Le,role:`listbox`,"aria-label":w(`Command suggestions`),className:`absolute bottom-full left-0 z-10 mb-1.5 max-h-64 w-full overflow-y-auto rounded-lg border bg-popover p-1 shadow-md`,children:(Ge===`slash`?Ve:He).map((e,t)=>(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===je,onClick:()=>{Me(t),Ge===`slash`?Je(e.name):qe(e.name,!1)},onMouseMove:()=>Me(t),className:W(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs`,t===je&&`bg-foreground/10`),children:[(0,G.jsx)(Kn,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono font-medium`,children:Ee===null?e.name:`$${e.name.slice(7)}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:w(e.description)})]},e.name))}),(0,G.jsxs)(`div`,{ref:R,"data-slot":`composer`,"data-enso":`composer`,className:W(`rounded-[24px] border bg-card shadow-[0_2px_6px_rgb(0_0_0/0.03),0_12px_32px_rgb(0_0_0/0.07)] transition-[border-color,box-shadow] duration-200 focus-within:border-foreground/20 [.dark_&]:shadow-[0_2px_6px_rgb(0_0_0/0.2),0_12px_32px_rgb(0_0_0/0.3)]`,(L||z)&&`border-brand/50 bg-brand/5`,(Qe||S)&&`border-primary/35 shadow-primary/5`),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),te(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||te(!1)},onDrop:e=>{let t=Array.from(e.dataTransfer.files);t.length!==0&&(e.preventDefault(),te(!1),it(t))},children:[j.filter(e=>!e.id).length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,children:j.filter(e=>!e.id).map((e,t)=>(0,G.jsxs)(`div`,{className:`group relative`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>re(e),className:`block rounded-md focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,"aria-label":w(`Preview`),children:(0,G.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:``,className:`h-16 w-16 rounded-md border object-cover`})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>M(t=>PN(t,e)),className:`absolute -top-1.5 -right-1.5 rounded-full border bg-background p-0.5 text-muted-foreground shadow-sm transition-opacity hover:text-destructive`,children:(0,G.jsx)(ir,{className:`h-3 w-3`})})]},t))}),(0,G.jsxs)(`div`,{className:W(`flex items-start gap-1.5 px-4`,j.length>0?`pt-1.5`:`pt-3.5`),children:[F&&(0,G.jsx)(xA,{recipient:F,onRemove:()=>I(void 0)}),N.map(e=>(0,G.jsx)(pA,{name:e,className:`mt-0.5 shrink-0`,trailing:(0,G.jsx)(`button`,{type:`button`,onClick:()=>P(t=>t.filter(t=>t!==e)),className:`rounded-sm opacity-70 hover:opacity-100`,"aria-label":w(`Remove`),children:(0,G.jsx)(ir,{className:`h-3 w-3`})})},e)),(0,G.jsx)(aj,{ref:se,placeholder:N.length>0?``:l?w(`Resolve the pending approval to continue`):Qe?w(`Message the selected Agent…`):tt?w(`Press {{key}} to steer the next queued message into this round…`,{key:RD(k)}):x||w(n?`Message will queue until this round finishes…`:`Type @ to choose a file or Agent`),disabled:l,onStateChange:Re,onChipActivate:e=>{e.type===`ui-element`&&ne({kind:`ui-element`,id:e.id,label:e.label,path:e.path,text:e.text,imageId:e.imageId})},onKeyDown:e=>{let t=e.nativeEvent.isComposing||ue.current;if(Ge){let n=Ge===`mention`?Ce[je]:void 0,r=Wk({key:e.key,shiftKey:e.shiftKey,isComposing:t,activeIndex:je,itemCount:Ke,folderOpen:Ge===`mention`&&Ne!==null,activeIsFolder:Ge===`mention`&&n?.type===`folder`,folderIndex:Fe,folderItemCount:Ne?Se[Ne].length:0});if(r.type===`move`){e.preventDefault(),Me(r.index),Pe(null);return}if(r.type===`move-folder`){e.preventDefault(),Ie(r.index);return}if(r.type===`open-folder`){e.preventDefault(),n?.type===`folder`&&Pe(n.id),Ie(0);return}if(r.type===`close-folder`){e.preventDefault(),Pe(null);return}if(r.type===`pick`){e.preventDefault(),Ye(Ge===`slash-sub`&&e.key===`Enter`);return}if(r.type===`close`){e.preventDefault(),xe(null),Te(null),De(null),ke(null),Pe(null);return}}if(t)return;let n=ID(e);if(!b&&n&&n===FD(E.getState().keybindings)[`switch-model`]){e.preventDefault(),NN();return}if(e.key===`Backspace`&&N.length>0&&Xe.length===0&&!ge){e.preventDefault(),P(e=>e.slice(0,-1));return}if(e.key===`Backspace`&&F&&se.current?.isEmpty()&&N.length===0){e.preventDefault(),I(void 0);return}s&&!Ge&&ID(e,{allowBare:!0})===k&&(e.preventDefault(),nt?y?.():U())},onPasteText:e=>!C||!hv(e)?!1:(C(e).catch(()=>({ok:!1,error:`unavailable`})).then(t=>{let n=se.current;t.ok?n?.insertFileChip(t.path,`${mv} · ${w(`{{count}} chars`,{count:t.chars.toLocaleString()})}`):n?.insertText(e)}),!0),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),it(t))},onCompositionStart:()=>{ue.current=!0},onCompositionEnd:()=>{ue.current=!1},ariaProps:{role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":Ge!==null,"aria-controls":Ge===`mention`?A:void 0,"aria-activedescendant":Ge===`mention`?Ne?`${A}-sub-${Fe}`:`${A}-option-${je}`:void 0}})]}),Qe&&(0,G.jsx)(`p`,{className:`sr-only`,children:w(`Send only to the selected Agent`)}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-1.5 px-3 pt-0.5 pb-2.5`,children:[(0,G.jsxs)(`div`,{className:W(`flex min-w-0 flex-1 items-center`,T?`gap-0.5 overflow-x-auto [scrollbar-width:none]`:`gap-1 overflow-hidden`),children:[(0,G.jsx)(`input`,{ref:le,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:e=>{it(Array.from(e.target.files??[])),e.target.value=``}}),(0,G.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>le.current?.click(),"aria-label":w(`Attach image`),title:w(`Attach image`),className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-40 max-md:size-[32px]`,children:(0,G.jsx)(en,{className:`h-3.5 w-3.5`})}),(0,G.jsx)(bO,{side:`left`,...et}),c,!b&&(0,G.jsx)(EO,{sessionId:et.sessionId}),(0,G.jsx)(bO,{side:`right`,...et}),rt&&(rt.blocked.length>0||rt.masked>0)&&(0,G.jsxs)(`span`,{className:W(`flex shrink-0 items-center gap-1 text-[11px]`,rt.blocked.length>0?`text-red-600 dark:text-red-400`:`text-sky-600 dark:text-sky-400`),"data-privacy-precheck":!0,children:[rt.blocked.length>0?(0,G.jsx)(Rn,{className:`size-3.5`}):(0,G.jsx)(zn,{className:`size-3.5`}),rt.blocked.length>0?w(`Will be blocked: {{kinds}}`,{kinds:rt.blocked.join(`, `)}):w(`{{count}} will be masked`,{count:rt.masked})]})]}),$e&&!Ze?(0,G.jsx)(Oa,{variant:`outline`,size:`icon`,className:`size-8 shrink-0 rounded-full`,onClick:_,"aria-label":w(`Stop`),children:(0,G.jsx)(Dt,{className:`h-4 w-4`})}):(0,G.jsx)(Oa,{size:`icon`,className:`size-8 shrink-0 rounded-full bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-35`,onClick:U,disabled:!Ze||l,"aria-label":w(Qe?`Send only to the selected Agent`:`Send`),title:Qe?w(`Send only to the selected Agent`):s&&k?`${w(`Send`)} ${RD(k)}`:w(`Send`),children:(0,G.jsx)(lt,{className:`h-4 w-4`})})]})]}),(0,G.jsx)(HE,{open:B!==null,onOpenChange:e=>!e&&ne(null),children:(0,G.jsxs)(qE,{className:`max-w-md`,children:[(0,G.jsx)(JE,{children:(0,G.jsx)(XE,{children:B?.label??w(`Selected UI element`)})}),(0,G.jsx)($E,{className:`space-y-2 text-xs`,children:B&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-muted-foreground break-all`,children:B.path}),B.text&&(0,G.jsx)(`p`,{children:B.text}),(()=>{let e=j.find(e=>e.id===B.imageId);return e?(0,G.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:``,className:`max-h-72 w-full rounded-md border object-contain`}):null})()]})})]})}),(0,G.jsx)(HE,{open:V!==null,onOpenChange:e=>!e&&re(null),children:(0,G.jsxs)(qE,{className:`max-w-3xl`,children:[(0,G.jsx)(JE,{children:(0,G.jsx)(XE,{children:w(`Preview`)})}),(0,G.jsx)($E,{children:V&&(0,G.jsx)(`img`,{src:`data:${V.mimeType};base64,${V.data}`,alt:``,className:`max-h-[80vh] w-full rounded-md object-contain`})})]})})]})}var zN=(0,H.createContext)(null);function BN(){return(0,H.useContext)(zN)}function VN({className:e}){return(0,G.jsx)(`svg`,{viewBox:`0 0 64 64`,fill:`none`,"aria-hidden":`true`,className:W(`size-4`,e),children:(0,G.jsx)(`path`,{d:`M 38.96 48.86 A 18.24 18.24 0 1 1 48.19 40.4`,stroke:`currentColor`,strokeWidth:`8.32`,strokeLinecap:`round`})})}var HN=12e4;function UN(e){return{id:e.id,dueAt:e.dueAt,...e.label?{label:e.label}:{}}}function WN(e,t){return e.filter(e=>e.dueAt>t-HN).sort((e,t)=>e.dueAt-t.dueAt)}function GN(e,t){let n=WN(e,t),r=n[0];if(r)return{...UN(r),count:n.length}}function KN(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function qN(e,t,n){let r=e-t;if(r<=0)return n(`due now`);if(r<6e4)return n(`<1m`);let i=Math.ceil(r/6e4);if(i<60)return n(`in {{minutes}}m`,{minutes:i});let a=Math.floor(i/60),o=i%60;return o>0?n(`in {{hours}}h {{minutes}}m`,{hours:a,minutes:o}):n(`in {{hours}}h`,{hours:a})}function JN(e,t,n){let r=[`${n(`Waiting for reminder · {{time}}`,{time:KN(e.dueAt)})} (${qN(e.dueAt,t,n)})`];return e.label&&r.push(e.label),e.count>1&&r.push(n(`{{count}} reminders`,{count:e.count})),r.join(` — `)}var YN=6e4,XN=60*YN;1*YN,2*YN,5*YN,10*YN,15*YN,6*XN,30*YN,24*XN,1*YN,1*YN,2*YN,5*YN,10*YN;function ZN(e){return e?.status===`waiting`&&e.retry?.reason===`upstream`}function QN(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}var $N=3e4,eP=kN(e=>({byConversation:{},replace:(t,n)=>e(e=>{let r={...e.byConversation};if(n.length>0)r[t]=n;else if(r[t])delete r[t];else return e;return{byConversation:r}}),replaceAll:t=>{let n={};for(let[e,r]of Object.entries(t))Array.isArray(r)&&r.length>0&&(n[e]=r);e({byConversation:n})}}));function tP(e,t=!0){let n=eP(n=>t&&e?n.byConversation[e]:void 0),[,r]=(0,H.useState)(0),i=!!(n&&n.length>0);(0,H.useEffect)(()=>{if(!i)return;let e=setInterval(()=>r(e=>e+1),$N);return()=>clearInterval(e)},[i]);let a=Date.now();return!t||!n||n.length===0?{reminder:void 0,now:a}:{reminder:GN(n,a),now:a}}var nP={activeId:null,conversations:{},rewind:()=>{},retry:()=>{},forkFromMessage:async()=>null,selectConversation:()=>{},removeQueuedMessage:()=>{},updateQueuedMessage:()=>{},sendQueuedNow:()=>{},interruptAndSendQueued:async()=>{},pauseGoal:()=>{},resumeGoal:()=>{},clearGoal:()=>{}};function rP(e){Object.assign(nP,e)}function iP(e){if(!e){nP.activeId=null,nP.conversations={};return}nP.activeId=e.id,nP.conversations={[e.id]:e}}function aP(e){return e(nP)}aP.getState=()=>nP,aP.subscribe=e=>()=>{};var oP=`rounded-lg border border-border/60 bg-muted/20 px-2.5 py-1.5 text-xs`;function sP({className:e}){return(0,G.jsx)(Xn,{className:W(`h-3.5 w-3.5 shrink-0 text-muted-foreground`,e)})}var cP=`w-full overflow-hidden rounded-lg border border-dashed border-border/60 text-xs text-muted-foreground`,lP=W(cP,`px-3 py-2`),uP=`mt-0.5 h-3.5 w-3.5 shrink-0`,dP={active:`bg-green-500 animate-pulse`,paused:`bg-amber-500`,waiting:`bg-amber-500`,blocked:`bg-destructive`,completed:`bg-blue-500`};function fP({conversationId:e,goal:t,sessionStatus:n}){let{t:r}=K(),i=ZN(t)?t.retry:void 0,{reminder:a,now:o}=tP(e,!i&&t.status===`active`&&n!==`running`),s={active:r(`working`),paused:r(`paused`),waiting:r(`waiting`),blocked:r(`blocked`),completed:r(`completed`)},c=i?i.kind===`quota`?r(`Quota exhausted · next {{time}}`,{time:QN(i.at)}):r(`Waiting for upstream recovery · next {{time}}`,{time:QN(i.at)}):s[t.status],l=a?JN(a,o,r):void 0;return(0,G.jsxs)(`div`,{className:W(`mb-1 flex items-center gap-2`,oP),children:[(0,G.jsx)(sP,{}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:i?.lastError?`${t.text} — ${i.lastError}`:l?`${t.text} — ${l}`:t.note?`${t.text} — ${t.note}`:t.text,children:[t.text,t.note&&(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[` — `,t.note]})]}),a?(0,G.jsxs)(`span`,{"data-enso":`goal-reminder-waiting`,title:l,className:`inline-flex min-w-0 max-w-[260px] shrink-0 items-center gap-1 rounded bg-sky-500/15 px-1.5 py-0.5 font-mono text-[10px] text-sky-600 tabular-nums dark:text-sky-400`,children:[(0,G.jsx)(Mt,{className:`h-3 w-3 shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:`truncate`,children:[r(`Waiting for reminder · {{time}}`,{time:KN(a.dueAt)}),a.label?` · ${a.label}`:``]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:W(`h-1.5 w-1.5 shrink-0 rounded-full`,dP[t.status])}),(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums`,children:[c,t.status===`active`&&t.autoTurns>0?` · ${t.autoTurns}/25`:``]})]}),i?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,"data-enso":`upstream-retry-now`,title:r(`Retry now`),onClick:()=>void aP.getState().retryUpstreamNow(e),className:`inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-amber-600 transition-colors hover:bg-amber-500/10 dark:text-amber-400`,children:[(0,G.jsx)(Nn,{className:`h-3 w-3`}),r(`Retry now`)]}),(0,G.jsx)(`button`,{type:`button`,"data-enso":`upstream-stop`,title:r(`Stop auto-retry`),onClick:()=>void aP.getState().abort(e),className:`shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-destructive`,children:(0,G.jsx)(Yn,{className:`h-3 w-3`})})]}):t.status===`active`?(0,G.jsx)(`button`,{type:`button`,title:r(`Pause goal`),onClick:()=>aP.getState().pauseGoal(e),className:`shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground`,children:(0,G.jsx)(Cn,{className:`h-3.5 w-3.5`})}):t.status===`completed`?null:(0,G.jsx)(`button`,{type:`button`,title:r(`Resume goal`),onClick:()=>aP.getState().resumeGoal(e),className:`shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground`,children:(0,G.jsx)(En,{className:`h-3.5 w-3.5`})}),(0,G.jsx)(`button`,{type:`button`,title:r(`Clear goal`),onClick:()=>aP.getState().clearGoal(e),className:`shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-destructive`,children:(0,G.jsx)(ir,{className:`h-3.5 w-3.5`})})]})}function pP(e,t){return e.trim().length>0||t>0}function mP(e,t){return e>0?`${e} ${t}`:null}var hP=mk;function gP(e){return!pk(e)}function _P({conversationId:e,queued:t}){let{t:n}=K(),[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(``);if(t.length===0)return null;let s=t=>{pP(a,t.images?.length??0)&&aP.getState().updateQueuedMessage(e,t.id,a.trim()),i(null)};return(0,G.jsx)(`div`,{className:`mb-1 flex flex-col gap-0.5`,children:t.map(t=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 border-dashed bg-muted/20 px-2.5 py-1.5 text-xs`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground uppercase tracking-wide`,children:n(`Queued`)}),r===t.id?(0,G.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Enter`&&s(t),e.key===`Escape`&&i(null))},autoFocus:!0,className:`h-6 min-w-0 flex-1 rounded border bg-transparent px-1.5 outline-none focus:ring-1 focus:ring-ring`}):(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:hP(t.text)||`[image]`}),mP(t.images?.length??0,n(`attachments`))&&(0,G.jsxs)(`span`,{title:mP(t.images?.length??0,n(`attachments`))??void 0,className:`flex shrink-0 items-center gap-0.5 text-muted-foreground`,children:[(0,G.jsx)(nn,{className:`h-3 w-3`}),t.images?.length]}),r===t.id?(0,G.jsx)(`button`,{type:`button`,onClick:()=>s(t),className:`shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(_t,{className:`h-3.5 w-3.5`})}):(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,G.jsx)(`button`,{type:`button`,title:n(`Withdraw message`),"aria-label":n(`Withdraw message`),onClick:()=>aP.getState().withdrawMessage(e,{kind:`queue`,id:t.id}),className:`rounded p-0.5 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(Qn,{className:`h-3 w-3`})}),gP(t.text)&&(0,G.jsx)(`button`,{type:`button`,title:n(`Edit`),onClick:()=>{i(t.id),o(t.text)},className:`rounded p-0.5 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(wn,{className:`h-3 w-3`})}),(0,G.jsx)(`button`,{type:`button`,title:n(`Send now`),onClick:()=>aP.getState().sendQueuedNow(e,t.id),className:`rounded p-0.5 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(In,{className:`h-3 w-3`})}),(0,G.jsx)(`button`,{type:`button`,title:n(`Interrupt and send now`),onClick:()=>void aP.getState().interruptAndSendQueued(e,t.id),className:`rounded p-0.5 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(Jn,{className:`h-3 w-3`})}),(0,G.jsx)(`button`,{type:`button`,title:n(`Remove`),onClick:()=>aP.getState().removeQueuedMessage(e,t.id),className:`rounded p-0.5 text-muted-foreground hover:text-destructive`,children:(0,G.jsx)(ir,{className:`h-3.5 w-3.5`})})]})]},t.id))})}var vP=0,yP=1,bP=2,xP=4;function SP(e){return()=>e}function CP(e){e()}function wP(e,t){return n=>e(t(n))}function TP(e,t){return()=>e(t)}function EP(e,t){return n=>e(t,n)}function DP(e){return e!==void 0}function OP(...e){return()=>{e.map(CP)}}function kP(){}function AP(e,t){return t(e),e}function jP(e,t){return t(e)}function MP(...e){return e}function NP(e,t){return e(yP,t)}function PP(e,t){e(vP,t)}function FP(e){e(bP)}function IP(e){return e(xP)}function LP(e,t){return NP(e,EP(t,vP))}function RP(e,t){let n=e(yP,e=>{n(),t(e)});return n}function zP(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function BP(e,t){return e===t}function VP(e=BP){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function HP(e){return t=>n=>{e(n)&&t(n)}}function UP(e){return t=>wP(t,e)}function WP(e){return t=>()=>{t(e)}}function X(e,...t){let n=qte(...t);return((t,r)=>{switch(t){case bP:FP(e);return;case yP:return NP(e,n(r))}})}function GP(e,t){return n=>r=>{n(t=e(t,r))}}function KP(e){return t=>n=>{e>0?e--:t(n)}}function qP(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function JP(...e){let t=Array.from({length:e.length}),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;NP(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function qte(...e){return t=>e.reduceRight(jP,t)}function Jte(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case yP:return a?n===a?void 0:(r(),n=a,t=NP(e,a),t):(r(),kP);case bP:r(),n=null;return}}}function Z(e){let t=e,n=XP();return((e,r)=>{switch(e){case vP:t=r;break;case yP:r(t);break;case xP:return t}return n(e,r)})}function YP(e,t){return AP(Z(t),t=>LP(e,t))}function XP(){let e=[];return((t,n)=>{switch(t){case vP:e.slice().forEach(e=>{e(n)});return;case bP:e.splice(0);return;case yP:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function ZP(e){return AP(XP(),t=>LP(e,t))}var Yte={singleton:!0};function QP(e,t=[],n=Yte){let{singleton:r}=n;return{constructor:e,dependencies:t,id:Xte(),singleton:r}}var Xte=()=>Symbol(`id`);function Zte(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function $P(...e){let t=XP(),n=Array.from({length:e.length}),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;NP(e,e=>{n[a]=e,r|=o,r===i&&PP(t,n)})}),function(e,a){switch(e){case bP:FP(t);return;case yP:return r===i&&a(n),NP(t,a)}}}function eF(e,t=BP){return X(e,VP(t))}function tF(...e){return function(t,n){switch(t){case bP:return;case yP:return OP(...e.map(e=>NP(e,n)))}}}var nF={DEBUG:0,INFO:1,WARN:2,ERROR:3},Qte={[nF.DEBUG]:`debug`,[nF.ERROR]:`error`,[nF.INFO]:`log`,[nF.WARN]:`warn`},$te=()=>typeof globalThis>`u`?window:globalThis,rF=QP(()=>{let e=Z(nF.ERROR);return{log:Z((t,n,r=nF.INFO)=>{r>=($te().VIRTUOSO_LOG_LEVEL??IP(e))&&console[Qte[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0});function ene(e){return`self`in e?e.document.documentElement:e}function iF(e){let t=ene(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction===`rtl`}function aF(e,t){return iF(e)?-t:t}function oF(e,t){return iF(e)?-t:t}function sF(e,t,n){return cF(e,t,n).callbackRef}function cF(e,t,n){let r=H.useRef(null),i=e=>{},a=H.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function lF(e,t,n,r,i,a,o,s,c){return cF(H.useCallback(n=>{let c=tne(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild?.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,p=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight,m=o?s?aF(o,o.scrollLeft):o.scrollTop:u?s?aF(d,d.scrollX||d.document.documentElement.scrollLeft):d.scrollY||d.document.documentElement.scrollTop:s?aF(l,l.scrollLeft):l.scrollTop;r({scrollHeight:f,scrollTop:Math.max(m,0),viewportHeight:p}),a?.(s?uF(`column-gap`,getComputedStyle(n).columnGap,i):uF(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function tne(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o<i;o++){let i=e.item(o);if(i.dataset.index===void 0)continue;let s=parseInt(i.dataset.index,10),c=parseFloat(i.dataset.knownSize),l=t(i,n);if(l===0&&r(`Zero-sized element, this should not happen`,{child:i},nF.ERROR),l===c)continue;let u=a[a.length-1];a.length===0||u.size!==l||u.endIndex!==s-1?a.push({endIndex:s,size:l,startIndex:s}):a[a.length-1].endIndex++}return a}function uF(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,nF.WARN),t===`normal`?0:parseInt(t??`0`,10)}function dF(e,t,n){let r=H.useRef(null),i=H.useCallback(n=>{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=cF(i,!0,n),s=H.useCallback(()=>{i(o.current)},[i,o]);return H.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var fF=QP(()=>{let e=XP(),t=XP(),n=Z(0),r=XP(),i=Z(0),a=XP(),o=XP(),s=Z(0),c=Z(0),l=Z(0),u=Z(0),d=XP(),f=XP(),p=Z(!1),m=Z(!1),h=Z(!1);return LP(X(e,UP(({scrollTop:e})=>e)),t),LP(X(e,UP(({scrollHeight:e})=>e)),o),LP(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),pF={lvl:0};function mF(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;o<n;o++){let{index:n,value:s}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=s}return a.push({end:1/0,start:r,value:i}),a}function hF(e){return e===pF}function gF(e,t){if(!hF(e))return t===e.k?e.v:t<e.k?gF(e.l,t):gF(e.r,t)}function _F(e,t,n=`k`){if(hF(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=_F(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return _F(e.l,t,n)}function vF(e,t,n){return hF(e)?kF(t,n,1):t===e.k?TF(e,{k:t,v:n}):t<e.k?AF(TF(e,{l:vF(e.l,t,n)})):AF(TF(e,{r:vF(e.r,t,n)}))}function yF(){return pF}function bF(e,t,n){if(hF(e))return[];let r=_F(e,t)[0];return nne(CF(e,r,n))}function xF(e,t){if(hF(e))return pF;let{k:n,l:r,r:i}=e;if(t===n){if(hF(r))return i;if(hF(i))return r;let[t,n]=OF(r);return wF(TF(e,{k:t,l:EF(r),v:n}))}return wF(t<n?TF(e,{l:xF(r,t)}):TF(e,{r:xF(i,t)}))}function SF(e){return hF(e)?[]:[...SF(e.l),{k:e.k,v:e.v},...SF(e.r)]}function CF(e,t,n){if(hF(e))return[];let{k:r,l:i,r:a,v:o}=e,s=[];return r>t&&(s=s.concat(CF(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(CF(a,t,n))),s}function wF(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(DF(t))return jF(TF(e,{lvl:n-1}));if(!hF(t)&&!hF(t.r))return TF(t.r,{l:TF(t,{r:t.r.l}),lvl:n,r:TF(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(DF(e))return MF(TF(e,{lvl:n-1}));if(!hF(r)&&!hF(r.l)){let t=r.l,i=DF(t)?r.lvl-1:r.lvl;return TF(t,{l:TF(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:MF(TF(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function TF(e,t){return kF(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function EF(e){return hF(e.r)?e.l:wF(TF(e,{r:EF(e.r)}))}function DF(e){return hF(e)||e.lvl>e.r.lvl}function OF(e){return hF(e.r)?[e.k,e.v]:OF(e.r)}function kF(e,t,n,r=pF,i=pF){return{k:e,l:r,lvl:n,r:i,v:t}}function AF(e){return MF(jF(e))}function jF(e){let{l:t}=e;return!hF(t)&&t.lvl===e.lvl?TF(t,{r:TF(e,{l:t.r})}):e}function MF(e){let{lvl:t,r:n}=e;return!hF(n)&&!hF(n.r)&&n.lvl===t&&n.r.lvl===t?TF(n,{l:TF(e,{r:n.l}),lvl:t+1}):e}function nne(e){return mF(e,({k:e,v:t})=>({index:e,value:t}))}function NF(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function PF(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var FF=QP(()=>({recalcInProgress:Z(!1)}),[],{singleton:!0});function IF(e,t,n){return e[LF(e,t,n)]}function LF(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function rne(e,t,n,r){let i=LF(e,t,r),a=LF(e,n,r,i);return e.slice(i,a+1)}function RF(e,t){return Math.round(e.getBoundingClientRect()[t])}function zF(e){return!hF(e.groupOffsetTree)}function BF({index:e},t){return t===e?0:t<e?-1:1}function ine(){return{groupIndices:[],groupOffsetTree:yF(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:yF()}}function ane(e,t){let n=hF(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),hF(e)){e=vF(e,0,i);continue}let o=bF(e,a-1,t+1);if(o.some(fne(r)))continue;let s=!1,c=!1;for(let{end:n,start:r,value:a}of o)s?(t>=r||i===a)&&(e=xF(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=vF(e,t+1,a));c&&(e=vF(e,a,i))}return[e,n]}function one(e){return e.groupIndex!==void 0}function sne({offset:e},t){return t===e?0:t<e?-1:1}function VF(e,t,n){if(t.length===0)return 0;let{index:r,offset:i,size:a}=IF(t,e,BF),o=e-r,s=a*o+(o-1)*n+i;return s>0?s+n:s}function HF(e,t){if(!zF(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function UF(e,t,n){if(one(e))return t.groupIndices[e.groupIndex]+1;let r=HF(e.index===`LAST`?n:e.index,t);return r=Math.max(0,Math.min(n,r)),r}function cne(e,t,n,r=0){return r>0&&(t=Math.max(t,IF(e,r,BF).offset)),mF(rne(e,t,n,sne),dne)}function lne(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,nF.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&hF(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>vF(vF(t,n,e),n+1,r),o)}else[o,s]=ane(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=GF(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>vF(e,t,VF(t,d,i)),yF()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function une(e){return SF(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function WF(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function GF(e,t,n,r){let i=e,a=0,o=0,s=0,c=0;if(t===0)i=[];else{c=LF(i,t-1,BF),s=i[c].offset;let e=_F(n,t-1);a=e[0],o=e[1],i.length&&i[c].size===_F(n,t)[1]&&--c,i=i.slice(0,c+1)}for(let{start:e,value:c}of bF(n,t,1/0)){let t=e-a,n=t*o+s+t*r;i.push({index:e,offset:n,size:c}),a=e,s=n,o=c}return{lastIndex:a,lastOffset:s,lastSize:o,offsetTree:i}}function dne(e){return{index:e.index,value:e}}function fne(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var pne={offsetHeight:`height`,offsetWidth:`width`},KF=QP(([{log:e},{recalcInProgress:t}])=>{let n=XP(),r=XP(),i=YP(r,0),a=XP(),o=XP(),s=Z(0),c=Z([]),l=Z(void 0),u=Z(void 0),d=Z(void 0),f=Z(void 0),p=Z((e,t)=>RF(e,pne[t])),m=Z(void 0),h=Z(0),g=ine(),_=YP(X(n,JP(c,e,h),GP(lne,g),VP()),g),v=YP(X(c,VP(),GP((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),UP(({prev:e})=>e)),[]);LP(X(c,HP(e=>e.length>0),JP(_,h),UP(([e,t,n])=>{let r=e.reduce((e,r,i)=>vF(e,r,VF(r,t.offsetTree,n)||i),yF());return{...t,groupIndices:e,groupOffsetTree:r}})),_),LP(X(r,JP(_),HP(([e,{lastIndex:t}])=>e<t),UP(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),LP(l,u);let y=YP(X(l,UP(e=>e===void 0)),!0);LP(X(u,HP(e=>e!==void 0&&hF(IP(_).sizeTree)),UP(e=>{let t=IP(d),n=IP(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),LP(X(f,HP(e=>e!==void 0&&e.length>0&&hF(IP(_).sizeTree)),UP(e=>{let t=[],n=e[0],r=0;for(let i=1;i<e.length;i++){let a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),LP(X(c,JP(d,u),HP(([,e,t])=>e!==void 0&&t!==void 0),UP(([e,t,n])=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),o!==void 0&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);let b=ZP(X(n,JP(_),GP(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),UP(e=>e.changed)));NP(X(s,GP((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),UP(e=>e.diff)),e=>{let{groupIndices:n}=IP(_);if(e>0)PP(t,!0),PP(a,e+WF(e,n));else if(e<0){let t=IP(v);t.length>0&&(e-=WF(-e,t)),PP(o,e)}}),NP(X(s,JP(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},nF.ERROR)});let x=ZP(a);LP(X(a,JP(_),UP(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=gF(t.sizeTree,0),a=0,o=0;for(;a<e;){let e=t.groupIndices[o],s=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+s-1,size:i,startIndex:e+1}),o++,a+=s+1}let s=SF(t.sizeTree);return a!==e&&s.shift(),s.reduce((t,{k:n,v:r})=>{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return SF(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=ZP(X(o,JP(_,h),UP(([e,{offsetTree:t},n])=>VF(-e,t,n))));return LP(X(o,JP(_,h),UP(([e,t,n])=>{if(t.groupIndices.length>0){if(hF(t.sizeTree))return t;let r=yF(),i=IP(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=SF(t.sizeTree).reduce((t,{k:n,v:r})=>vF(t,Math.max(0,n+e),r),r),a!==-e){let n=gF(t.sizeTree,s);r=vF(r,0,n);let i=_F(t.sizeTree,-e+1)[1];r=vF(r,1,i)}return{...t,sizeTree:r,...GF(t.offsetTree,0,r,n)}}let r=SF(t.sizeTree).reduce((t,{k:n,v:r})=>vF(t,Math.max(0,n+e),r),yF());return{...t,sizeTree:r,...GF(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},MP(rF,FF),{singleton:!0});function mne(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var qF=QP(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=XP(),o=XP(),s=ZP(X(a,UP(mne)));return LP(X(s,UP(e=>e.totalCount)),n),LP(X(s,UP(e=>e.groupIndices)),e),LP(X($P(i,t,r),HP(([e,t])=>zF(t)),UP(([e,t,n])=>_F(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),VP(),UP(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},MP(KF,fF)),JF=QP(([{log:e}])=>{let t=Z(!1),n=ZP(X(t,HP(e=>e),VP()));return NP(t,t=>{t&&IP(e)(`props updated`,{},nF.DEBUG)}),{didMount:n,propsReady:t}},MP(rF),{singleton:!0}),hne=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function YF(e){let t=typeof e==`number`?{index:e}:{...e};return t.align||=`start`,(!t.behavior||!hne)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var XF=QP(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=XP(),m=XP(),h=Z(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),PP(c,!1)}return LP(X(p,JP(n,d,r,h,s,o,f),JP(e,a,i),UP(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=YF(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=UF(b,n,w),E=VF(T,n.offsetTree,d)+o;x===`end`?(E+=f+_F(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+_F(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let D=t=>{y(),t?(l(`retrying to scroll to`,{location:e},nF.DEBUG),PP(p,e)):(PP(m,!0),l(`list did not change, scroll successful`,{},nF.DEBUG))};if(y(),S===`smooth`){let e=!1;v=NP(t,t=>{e||=t}),g=RP(u,()=>{D(e)})}else g=RP(X(t,gne(150)),D);return _=setTimeout(()=>{y()},1200),PP(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},nF.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},MP(KF,fF,rF),{singleton:!0});function gne(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function ZF(e,t){e===0?t():requestAnimationFrame(()=>{ZF(e-1,t)})}function QF(e,t){if(e===void 0)return 0;let n=t-1,r=typeof e==`number`?e:e.index===`LAST`?n:e.index;return Math.max(0,Math.min(r,n))}function $F(e){return e===void 0?!0:typeof e==`number`?e===0:e.index===0&&(e.align===void 0||e.align===`start`)&&(e.offset===void 0||e.offset===0)}var eI=QP(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=Z(!0),c=Z(0),l=Z(!0);return LP(X(o,JP(c),HP(([e,t])=>!$F(t)),WP(!1)),s),LP(X(o,JP(c),HP(([e,t])=>!$F(t)),WP(!1)),l),NP(X($P(t,o),JP(s,n,e,l),HP(([[,e],t,{sizeTree:n},r,i])=>e&&(!hF(n)||DP(r))&&!t&&!i),JP(c)),([,e])=>{if(e===void 0){PP(s,!0),PP(l,!0);return}RP(i,()=>{PP(l,!0)}),ZF(4,()=>{RP(r,()=>{PP(s,!0)}),PP(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},MP(KF,fF,XF,JF),{singleton:!0});function tI(e,t){return Math.abs(e-t)<1.01}var nI=`up`,rI=`down`,_ne=`none`,vne={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},yne=0,iI=QP(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=Z(!1),s=Z(!0),c=XP(),l=XP(),u=Z(4),d=Z(yne),f=YP(X(tF(X(eF(i),KP(1),WP(!0)),X(eF(i),KP(1),WP(!1),zP(100))),VP()),!1),p=YP(X(tF(X(n,WP(!0)),X(n,WP(!1),zP(200))),VP()),!1);LP(X($P(eF(i),eF(d)),UP(([e,t])=>e<=t),VP()),s),LP(X(s,qP(50)),l);let m=ZP(X($P(r,eF(a),eF(t),eF(e),eF(u)),GP((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:r<e.state.viewportHeight?`VIEWPORT_HEIGHT_DECREASING`:n<e.state.scrollTop?`SCROLLING_UPWARDS`:`NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM`,{atBottom:!1,notAtBottomBecause:l,state:c}},vne),VP((e,t)=>e!==void 0&&e.atBottom===t.atBottom))),h=YP(X(r,GP((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!tI(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),HP(e=>e.changed),UP(e=>e.jump)),0);LP(X(m,UP(e=>e.atBottom)),o),LP(X(o,qP(50)),c);let g=Z(rI);LP(X(r,UP(({scrollTop:e})=>e),VP(),GP((e,t)=>IP(p)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?nI:rI,prevScrollTop:t},{direction:rI,prevScrollTop:0}),UP(e=>e.direction)),g),LP(X(r,qP(50),WP(_ne)),g);let _=Z(0);return LP(X(f,HP(e=>!e),WP(0)),_),LP(X(i,qP(100),JP(f),HP(([e,t])=>t),GP(([e,t],[n])=>[t,n],[0,0]),UP(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},MP(fF)),aI=`top`,oI=`bottom`,sI=`none`;function cI(e,t,n){return typeof e==`number`?n===nI&&t===aI||n===rI&&t===oI?e:0:n===nI?t===aI?e.main:e.reverse:t===oI?e.main:e.reverse}function lI(e,t){return typeof e==`number`?e:e[t]??0}var uI=QP(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=XP(),o=Z(0),s=Z(0),c=Z(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:YP(X($P(eF(r),eF(i),eF(n),eF(a,PF),eF(c),eF(o),eF(t),eF(e),eF(s)),UP(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=sI,m=lI(l,aI),h=lI(l,oI);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=nI),i<e-f+t+h&&(p=rI),p===sI?null:[Math.max(u-n-cI(a,aI,p)-m,0),u-f-s+t+cI(a,oI,p)+h]}),HP(e=>e!==null),VP(PF)),[0,0])}},MP(fF),{singleton:!0});function bne(e,t,n){if(zF(t)){let r=HF(e,t);return[{index:_F(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var dI={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function fI(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:mI(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:mI(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function pI(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=QF(t,s);return fI(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function mI(e,t,n){if(e.length===0)return[];if(!zF(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=bF(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end<r.index)&&(s=o.shift(),c=t.groupIndices.indexOf(s.start));let e;e=r.index===s.start?{index:c,type:`group`}:{groupIndex:c,index:r.index-(c+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function hI(e,t){return e===void 0?0:typeof e==`number`?e:e[t]??0}var gI=QP(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:s,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:p},{recalcInProgress:m}])=>{let h=Z([]),g=Z(0),_=XP(),v=Z(0);LP(a.topItemsIndexes,h);let y=YP(X($P(p,m,eF(c,PF),eF(i),eF(r),eF(l),u,eF(h),eF(t),eF(n),eF(v),e),HP(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),UP(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=IP(g);if(n===0)return{...dI,totalCount:n};if(e===0&&t===0)return m===0?{...dI,totalCount:n}:pI(m,i,r,s,c,u||[]);if(hF(p))return m>0?null:fI(bne(QF(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of bF(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return fI([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=cne(f,e,t,_);if(v.length===0)return null;let y=n-1,b=AP([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+c)/(s+c));let t=o-r.start;a+=t*s+t*c}o<_&&(a+=(_-o)*s,o=_);let l=Math.min(r.end,y);for(let e=o;e<=l&&!(a>=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=hI(l,aI),S=hI(l,oI);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=bF(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.index<y){let e=Math.min(S,y-t.index),n=t.offset+t.size+c;for(let r=t.index+1;r<=t.index+e;r++){let e=bF(p,r,r)[0]?.value??t.size;b.push({data:u?.[r],index:r,offset:n,size:e}),n+=e+c}}}return fI(b,h,n,c,d,s)}),HP(e=>e!==null),VP()),dI);LP(X(e,HP(DP),UP(e=>e?.length)),i),LP(X(y,UP(e=>e.topListHeight)),d),LP(d,s),LP(X(y,UP(e=>[e.top,e.bottom])),o),LP(X(y,UP(e=>e.items)),_);let b=ZP(X(y,HP(({items:e})=>e.length>0),JP(i,e),HP(([{items:e},t])=>e[e.length-1].originalIndex===t-1),UP(([,e,t])=>[e-1,t]),VP(PF),UP(([e])=>e))),x=ZP(X(y,qP(200),HP(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),UP(({items:e})=>e[0].index),VP()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:ZP(X(y,HP(({items:e})=>e.length>0),UP(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&t<n;)t++;for(;e[n].type===`group`&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),VP(NF))),startReached:x,topItemsIndexes:h,...f}},MP(KF,qF,uI,eI,XF,iI,JF,FF),{singleton:!0}),_I=QP(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=XP(),o=YP(X($P(n,e,r,t,i),UP(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return LP(eF(o),a),{totalListHeight:o,totalListHeightChanged:a}},MP(fF,gI),{singleton:!0}),xne=QP(([{viewportHeight:e},{totalListHeight:t}])=>{let n=Z(!1);return{alignToBottom:n,paddingTopAddition:YP(X($P(n,e,t),HP(([e])=>e),UP(([,e,t])=>Math.max(0,e-t)),qP(0),VP()),0)}},MP(fF,_I),{singleton:!0}),vI=QP(()=>({context:Z(null)})),Sne=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??`start`,...r===void 0?{}:{behavior:r}}:e>a?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,yI=QP(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=XP();return LP(X(u,JP(t,c,n,a,i,r,s),JP(e),UP(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=Sne,done:d,...f}=e,p=UF(e,t,r-1),m=VF(p,t.offsetTree,l)+i+a,h=m+_F(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&RP(X(o,HP(e=>!e),KP(IP(o)?1:2)),d),_}),HP(e=>e!==null)),l),{scrollIntoView:u}},MP(KF,fF,XF,gI,rF),{singleton:!0});function bI(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var Cne=(e,t)=>typeof e==`function`?bI(e(t)):t&&bI(e),wne=QP(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=Z(!1),h=XP(),g=null;function _(e){PP(o,{align:`end`,behavior:e,index:`LAST`})}NP(X($P(X(eF(t),KP(1)),c),JP(eF(m),a,s,d),UP(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=Cne(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),HP(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),IP(n)===void 0?g=RP(e,()=>{IP(u)(`following output to `,{totalCount:r},nF.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{IP(u)(`following output to `,{totalCount:r},nF.DEBUG),_(t)})});function v(e){let t=RP(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(IP(u)(`scrolling to bottom due to increased size`,{},nF.DEBUG),_(`auto`))});setTimeout(t,100)}NP(X($P(eF(m),t,l),HP(([e,,t])=>e!==!1&&t),GP(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),HP(({refreshed:e})=>e),JP(m,t)),([,e])=>{IP(s)&&v(e!==!1)}),NP(h,()=>{v(IP(m)!==!1)}),NP($P(eF(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=Z(null),b=XP();return LP(tF(X(eF(r),UP(e=>e?.length??0)),X(eF(t))),b),NP(X($P(X(b,KP(1)),c),JP(eF(y),s,d,f),UP(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),HP(e=>!!e),qP(0)),t=>{g!==null&&(g(),g=null),IP(n)===void 0?g=RP(e,()=>{IP(u)(`scrolling into view`,{}),PP(p,t),g=null}):requestAnimationFrame(()=>{IP(u)(`scrolling into view`,{}),PP(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},MP(KF,iI,XF,eI,JF,rF,fF,vI,yI)),Tne=QP(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(LP(X(s,JP(a),HP(([,e])=>e!==0),JP(i,r,t,n,e),UP(([[,e],t,n,r,i,a=[]])=>pI(e,t,n,r,i,a))),o),{}),MP(KF,eI,gI,JF),{singleton:!0}),Ene=QP(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=Z(0);return NP(X(e,JP(r),HP(([,e])=>e!==0),UP(([,e])=>({top:e}))),e=>{RP(X(n,KP(1),HP(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{PP(t,e)})})}),{initialScrollTop:r}},MP(JF,fF,gI),{singleton:!0}),xI=QP(([{scrollVelocity:e}])=>{let t=Z(!1),n=XP(),r=Z(!1);return LP(X(e,JP(r,t,n),HP(([e,t])=>t!==!1&&t!==void 0),UP(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),VP()),t),NP(X($P(t,e,n),JP(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},MP(iI),{singleton:!0}),SI=QP(([{scrollContainerState:e,scrollTo:t}])=>{let n=XP(),r=XP(),i=XP(),a=Z(!1),o=Z(void 0);return LP(X($P(n,r),UP(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),LP(X(t,JP(r),UP(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},MP(fF)),Dne=QP(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=XP(),u=Z(void 0),d=Z(null),f=Z(null);return LP(s,d),LP(c,f),NP(X(l,JP(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=une(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),LP(X(u,HP(DP),UP(One)),i),LP(X(a,JP(u),HP(([,e])=>e!==void 0),VP(),UP(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},MP(KF,fF,eI,JF,SI));function One(e){return{align:`start`,index:0,offset:e.scrollTop}}var kne=QP(([{topItemsIndexes:e}])=>{let t=Z(0);return LP(X(t,HP(e=>e>=0),UP(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},MP(gI));function CI(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var Ane=CI(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),wI=QP(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:D,topItemsIndexes:O,rangeChanged:k,...A}=b;return LP(k,T.scrollSeekRangeChanged),LP(X($P(T.windowViewportRect,_.headerHeight,_.fixedHeaderHeight),UP(([e,t,n])=>Math.max(t+n+1,e.visibleHeight))),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:O,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:D,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:k,...A,...T,..._,sizes:u,...v}},MP(KF,eI,fF,Dne,wne,gI,XF,QP(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=ZP(X(c,JP(o),GP(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),HP(([e])=>e!==0),JP(r,s,n,i,p,m),HP(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===nI),UP(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},nF.DEBUG),e))));function g(n){n>0?(PP(t,{behavior:`auto`,top:-n}),PP(e,0)):(PP(e,0),PP(t,{behavior:`auto`,top:-n}))}return NP(X(h,JP(e,a)),([t,n,r])=>{r&&Ane()?PP(e,n-t):g(-t)}),NP(X($P(YP(a,!1),e,m),HP(([e,t,n])=>!e&&!n&&t!==0),UP(([e,t])=>t),qP(1)),g),LP(X(d,UP(e=>({top:-e}))),t),NP(X(l,JP(f,u),UP(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=gF(r,0),c=0,l=0;for(;c<e;){c++,o+=s;let n=t.length===l+1?1/0:t[l+1]-t[l]-1;c+n>e&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{PP(e,n),requestAnimationFrame(()=>{PP(t,{top:n}),requestAnimationFrame(()=>{PP(e,0),PP(m,!1)})})}),{deviation:e}},MP(fF,iI,gI,KF,rF,FF)),kne,qF,QP(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),MP(uI,Tne,JF,xI,_I,Ene,xne,SI,yI,rF,vI))));function jne(e,t){let n={},r={},i=0,a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}var TI=typeof document>`u`?H.useEffect:H.useLayoutEffect;function EI(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=H.createContext({});function c(e,n){e.propsReady!==void 0&&PP(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];PP(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];PP(i,n[r])}e.propsReady!==void 0&&PP(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];PP(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=Jte(e[t.events[r]]),n),{})}return{Component:H.forwardRef(function(t,a){let{children:d,...f}=t,[p]=H.useState(()=>AP(Zte(e),e=>{c(e,f)})),[m]=H.useState(TP(u,p));TI(()=>{for(let e of o)e in f&&NP(m[e],f[e]);return()=>{Object.values(m).map(FP)}},[f,m,p]),TI(()=>{c(p,f)}),H.useImperativeHandle(a,SP(l(p)));let h=n;return(0,G.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,G.jsx)(h,{...jne([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=H.useContext(s)[e];TI(()=>NP(n,t),[t,n])},useEmitterValue:e=>{let t=H.useContext(s)[e],n=H.useCallback(e=>NP(t,e),[t]);return H.useSyncExternalStore(n,()=>IP(t),()=>IP(t))},usePublisher:e=>{let t=H.useContext(s);return H.useCallback(n=>{PP(t[e],n)},[t,e])}}}var DI=H.createContext(void 0),OI=H.createContext(void 0),kI=`-webkit-sticky`,AI=`sticky`,jI=CI(()=>{if(typeof document>`u`)return AI;let e=document.createElement(`div`);return e.style.position=kI,e.style.position===kI?kI:AI}),MI=typeof document>`u`?H.useEffect:H.useLayoutEffect;function NI(e){return`self`in e}function PI(e){return`body`in e}function FI(e,t,n,r=kP,i,a){let o=H.useRef(null),s=H.useRef(null),c=H.useRef(null),l=H.useCallback(n=>{let r,i,o,l=n.target;if(PI(l)||NI(l)){let e=NI(l)?l:l.defaultView;o=a===!0?aF(e,e.scrollX):e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?aF(l,l.scrollLeft):l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():Gs.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);H.useEffect(()=>{let e=i??o.current;return r(i??o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;NI(r)?(u=Math.max(RF(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?aF(r,r.scrollX):r.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=RF(r,a===!0?`width`:`height`),d=a===!0?aF(r,r.scrollLeft):r.scrollTop);let f=u-l;if(n.top===void 0){r.scrollTo(n);return}let p=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=p,tI(l,u)||p===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=p,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:oF(r,p)}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:oF(o.current,e.top)}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function II(e){return e}var LI=QP(([e,t])=>({...e,...t}),MP(wI,QP(()=>{let e=Z(e=>`Item ${e}`),t=Z(e=>`Group ${e}`),n=Z({}),r=Z(II),i=Z(`div`),a=Z(kP),o=(e,t=null)=>YP(X(n,UP(t=>t[e]),VP()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),RI=({height:e})=>(0,G.jsx)(`div`,{style:{height:e}}),zI={overflowAnchor:`none`,position:jI(),zIndex:1},BI={overflowAnchor:`none`},VI={...BI,display:`inline-block`,height:`100%`},HI=H.memo(function({showTopList:e=!1}){let t=aL(`listState`),n=oL(`sizeRanges`),r=aL(`useWindowScroll`),i=aL(`customScrollParent`),a=oL(`windowScrollContainerState`),o=oL(`scrollContainerState`),s=i||r?a:o,c=aL(`itemContent`),l=aL(`context`),u=aL(`groupContent`),d=aL(`trackItemSizes`),f=aL(`itemSize`),p=aL(`log`),m=oL(`gap`),h=aL(`horizontalDirection`),{callbackRef:g}=lF(n,f,d,e?kP:s,p,m,i,h,aL(`skipAnimationFrameInResizeObserver`)),[_,v]=H.useState(0);iL(`deviation`,e=>{_!==e&&v(e)});let y=aL(`EmptyPlaceholder`),b=aL(`ScrollSeekPlaceholder`)??RI,x=aL(`ListComponent`),S=aL(`ItemComponent`),C=aL(`GroupComponent`),w=aL(`computeItemKey`),T=aL(`isSeeking`),E=aL(`groupIndices`).length>0,D=aL(`alignToBottom`),O=aL(`initialItemFinalLocationReached`),k=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginInlineStart:_===0?D?`auto`:0:_,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:`nowrap`}:{marginTop:_===0?D?`auto`:0:_,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...O?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&y!=null?(0,G.jsx)(y,{...JI(y,l)}):(0,G.jsx)(x,{...JI(x,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:k,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=w(n+t.firstItemIndex,e.data,l);return T?(0,H.createElement)(b,{...JI(b,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,H.createElement)(C,{...JI(C,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:zI},u(e.index,l)):(0,H.createElement)(S,{...JI(S,l),...YI(S,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?VI:BI},E?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),UI={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},WI={outline:`none`,overflowX:`auto`,position:`relative`},GI=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),KI=(e,t,n=0)=>({...GI(e),position:t?`relative`:`absolute`,top:t?-n:0}),qI={position:jI(),top:0,width:`100%`,zIndex:1};function JI(e,t){if(typeof e!=`string`)return{context:t}}function YI(e,t){return{item:typeof e==`string`?void 0:t}}var XI=H.memo(function(){let e=aL(`HeaderComponent`),t=oL(`headerHeight`),n=aL(`HeaderFooterTag`),r=sF(H.useMemo(()=>e=>{t(RF(e,`height`))},[t]),!0,aL(`skipAnimationFrameInResizeObserver`)),i=aL(`context`);return e==null?null:(0,G.jsx)(n,{ref:r,children:(0,G.jsx)(e,{...JI(e,i)})})}),ZI=H.memo(function(){let e=aL(`FooterComponent`),t=oL(`footerHeight`),n=aL(`HeaderFooterTag`),r=sF(H.useMemo(()=>e=>{t(RF(e,`height`))},[t]),!0,aL(`skipAnimationFrameInResizeObserver`)),i=aL(`context`);return e==null?null:(0,G.jsx)(n,{ref:r,children:(0,G.jsx)(e,{...JI(e,i)})})});function QI({useEmitter:e,useEmitterValue:t,usePublisher:n}){return H.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=FI(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,G.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?WI:UI,...i},tabIndex:0,...o,...JI(c,a),children:r})})}function $I({useEmitter:e,useEmitterValue:t,usePublisher:n}){return H.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=H.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=FI(s,l,c,t(`scrollerRef`),f);return MI(()=>(h.current=f??p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,G.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...JI(c,a),children:r})})}var eL=({children:e})=>{let t=H.useContext(DI),n=oL(`viewportHeight`),r=oL(`fixedItemHeight`),i=aL(`alignToBottom`),a=aL(`horizontalDirection`),o=sF(H.useMemo(()=>wP(n,e=>RF(e,a?`width`:`height`)),[n,a]),!0,aL(`skipAnimationFrameInResizeObserver`));return H.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,G.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:GI(i),children:e})},tL=({children:e})=>{let t=H.useContext(DI),n=oL(`windowViewportRect`),r=oL(`fixedItemHeight`),i=aL(`customScrollParent`),a=aL(`useWindowScroll`),o=aL(`topListHeight`),s=dF(n,i,aL(`skipAnimationFrameInResizeObserver`)),c=aL(`alignToBottom`);return H.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,G.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:KI(c,a,o),children:e})},nL=({children:e})=>{let t=aL(`TopItemListComponent`)??`div`,n=aL(`headerHeight`),r={...qI,marginTop:`${n}px`},i=aL(`context`);return(0,G.jsx)(t,{style:r,...JI(t,i),children:e})},{Component:rL,useEmitter:iL,useEmitterValue:aL,usePublisher:oL}=EI(LI,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},H.memo(function(e){let t=aL(`useWindowScroll`),n=aL(`topItemsIndexes`).length>0,r=aL(`customScrollParent`),i=aL(`context`);return(0,G.jsxs)(r||t?cL:sL,{...e,context:i,children:[n&&(0,G.jsx)(nL,{children:(0,G.jsx)(HI,{showTopList:!0})}),(0,G.jsxs)(r||t?tL:eL,{children:[(0,G.jsx)(XI,{}),(0,G.jsx)(HI,{}),(0,G.jsx)(ZI,{})]})]})})),sL=QI({useEmitter:iL,useEmitterValue:aL,usePublisher:oL}),cL=$I({useEmitter:iL,useEmitterValue:aL,usePublisher:oL}),lL=rL,uL=QP(([e,t])=>({...e,...t}),MP(wI,QP(()=>{let e=Z(e=>(0,G.jsxs)(`td`,{children:[`Item $`,e]})),t=Z(null),n=Z(e=>(0,G.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=Z(null),i=Z(null),a=Z({}),o=Z(II),s=Z(kP),c=(e,t=null)=>YP(X(a,UP(t=>t[e]),VP()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),dL=({height:e})=>(0,G.jsx)(`tr`,{children:(0,G.jsx)(`td`,{style:{height:e}})}),fL=({height:e})=>(0,G.jsx)(`tr`,{children:(0,G.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),pL={overflowAnchor:`none`},mL={position:jI(),zIndex:2,overflowAnchor:`none`},hL=H.memo(function({showTopList:e=!1}){let t=bL(`listState`),n=bL(`computeItemKey`),r=bL(`firstItemIndex`),i=bL(`context`),a=bL(`isSeeking`),o=bL(`fixedHeaderHeight`),s=bL(`groupIndices`).length>0,c=bL(`itemContent`),l=bL(`groupContent`),u=bL(`ScrollSeekPlaceholder`)??dL,d=bL(`GroupComponent`),f=bL(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,H.createElement)(u,{...JI(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,H.createElement)(d,{...JI(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{...mL,top:o}},l(t.index,i)):(0,H.createElement)(f,{...JI(f,i),...YI(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{...mL,top:o+g}:pL},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),gL=H.memo(function(){let e=bL(`listState`),t=bL(`topItemsIndexes`).length>0,n=xL(`sizeRanges`),r=bL(`useWindowScroll`),i=bL(`customScrollParent`),a=xL(`windowScrollContainerState`),o=xL(`scrollContainerState`),s=i||r?a:o,c=bL(`trackItemSizes`),{callbackRef:l,ref:u}=lF(n,bL(`itemSize`),c,s,bL(`log`),void 0,i,!1,bL(`skipAnimationFrameInResizeObserver`)),[d,f]=H.useState(0);yL(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=bL(`EmptyPlaceholder`),m=bL(`FillerRow`)??fL,h=bL(`TableBodyComponent`),g=bL(`paddingTopAddition`),_=bL(`statefulTotalCount`),v=bL(`context`);if(_===0&&p!=null)return(0,G.jsx)(p,{...JI(p,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+g+d-y,x=e.offsetBottom,S=b>0?(0,G.jsx)(m,{context:v,height:b},`padding-top`):null,C=x>0?(0,G.jsx)(m,{context:v,height:x},`padding-bottom`):null;return(0,G.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...JI(h,v),children:[S,t&&(0,G.jsx)(hL,{showTopList:!0}),(0,G.jsx)(hL,{}),C]})}),_L=({children:e})=>{let t=H.useContext(DI),n=xL(`viewportHeight`),r=xL(`fixedItemHeight`),i=sF(H.useMemo(()=>wP(n,e=>RF(e,`height`)),[n]),!0,bL(`skipAnimationFrameInResizeObserver`));return H.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,G.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:GI(!1),children:e})},vL=({children:e})=>{let t=H.useContext(DI),n=xL(`windowViewportRect`),r=xL(`fixedItemHeight`),i=bL(`customScrollParent`),a=bL(`useWindowScroll`),o=dF(n,i,bL(`skipAnimationFrameInResizeObserver`));return H.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,G.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:KI(!1,a),children:e})},{Component:Mne,useEmitter:yL,useEmitterValue:bL,usePublisher:xL}=EI(uL,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},H.memo(function(e){let t=bL(`useWindowScroll`),n=bL(`customScrollParent`),r=xL(`fixedHeaderHeight`),i=xL(`fixedFooterHeight`),a=bL(`fixedHeaderContent`),o=bL(`fixedFooterContent`),s=bL(`context`),c=sF(H.useMemo(()=>wP(r,e=>RF(e,`height`)),[r]),!0,bL(`skipAnimationFrameInResizeObserver`)),l=sF(H.useMemo(()=>wP(i,e=>RF(e,`height`)),[i]),!0,bL(`skipAnimationFrameInResizeObserver`)),u=n||t?CL:SL,d=n||t?vL:_L,f=bL(`TableComponent`),p=bL(`TableHeadComponent`),m=bL(`TableFooterComponent`),h=a?(0,G.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...JI(p,s),children:a()},`TableHead`):null,g=o?(0,G.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...JI(m,s),children:o()},`TableFoot`):null;return(0,G.jsx)(u,{...e,...JI(u,s),children:(0,G.jsx)(d,{children:(0,G.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...JI(f,s),children:[h,(0,G.jsx)(gL,{},`TableBody`),g]})})})})),SL=QI({useEmitter:yL,useEmitterValue:bL,usePublisher:xL}),CL=$I({useEmitter:yL,useEmitterValue:bL,usePublisher:xL}),wL={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},TL={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:EL,floor:DL,max:OL,min:kL,round:AL}=Math;function jL(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function ML(e){return{...TL,items:e}}function NL(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function PL(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var FL=QP(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=Z(0),C=Z(0),w=Z(wL),T=Z({height:0,width:0}),E=Z({height:0,width:0}),D=XP(),O=XP(),k=Z(0),A=Z(null),j=Z({column:0,row:0}),M=XP(),N=XP(),P=Z(!1),F=Z(0),I=Z(!0),ee=Z(!1),L=Z(!1);NP(X(m,JP(F),HP(([e,t])=>!$F(t))),()=>{PP(I,!1)}),NP(X($P(m,I,E,T,F,ee),HP(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{if(e===void 0){PP(I,!0);return}PP(ee,!0),ZF(1,()=>{PP(D,e)}),RP(X(l),()=>{PP(t,[0,0]),PP(I,!0)})}),LP(X(N,HP(e=>e!=null&&e.scrollTop>0),WP(0)),C),NP(X(m,JP(N),HP(([,e])=>e!=null)),([,e])=>{e&&(PP(T,e.viewport),PP(E,e.item),PP(j,e.gap),e.scrollTop>0&&(PP(P,!0),RP(X(l,KP(1)),e=>{PP(P,!1)}),PP(c,{top:e.scrollTop})))}),LP(X(T,UP(({height:e})=>e)),d),LP(X($P(eF(T,NL),eF(E,NL),eF(j,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),eF(l)),UP(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),M),LP(X($P(eF(S),r,eF(j,PL),eF(E,NL),eF(T,NL),eF(A),eF(C),eF(P),eF(I),eF(F)),HP(([,,,,,,,e])=>!e),UP(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return wL;if(p===0){let t=QF(l,e);return ML(jL(t,t+Math.max(s-1,0),o))}let h=IL(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*DL((t+d)/(f+d)),_=h*EL((n+d)/(f+d))-1,_=kL(e-1,OL(_,h-1)),g=kL(_,OL(0,g))):(g=0,_=-1);let v=jL(g,_,o),{bottom:y,top:b}=LL(a,r,i,v),x=EL(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),LP(X(A,HP(e=>e!==null),UP(e=>e.length)),S),LP(X($P(T,E,w,j),HP(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),UP(([e,t,{items:n},r])=>{let{bottom:i,top:a}=LL(e,r,t,n);return[a,i]}),VP(PF)),t);let te=Z(!1);LP(X(l,JP(te),UP(([e,t])=>t||e!==0)),te);let R=ZP(X($P(w,S),HP(([{items:e}])=>e.length>0),JP(te),HP(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),UP(([[,e]])=>e-1),VP())),z=ZP(X(eF(w),HP(({items:e})=>e.length>0&&e[0].index===0),WP(0),VP())),B=ZP(X(eF(w),JP(P),HP(([{items:e},t])=>e.length>0&&!t),UP(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),VP(NF),qP(0)));LP(B,p.scrollSeekRangeChanged),LP(X(D,JP(T,E,S,j),UP(([e,t,n,r,i])=>{let a=YF(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=OL(0,l,kL(r-1,l));let u=RL(t,i,n,l);return o===`end`?u=AL(u-t.height+n.height):o===`center`&&(u=AL(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let ne=YP(X(w,UP(e=>e.offsetBottom+e.bottom)),0);return LP(X(b,UP(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:A,deviation:k,footerHeight:i,gap:j,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:N,scrollBy:o,scrollContainerState:s,scrollHeight:O,scrollTo:c,scrollToIndex:D,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:L,initialTopMostItemIndex:F,totalListHeight:ne,...f,endReached:R,propsReady:h,rangeChanged:B,startReached:z,stateChanged:M,stateRestoreInProgress:P,...x}},MP(uI,fF,iI,xI,JF,SI,rF));function IL(e,t,n){return OL(1,DL((e+n)/(DL(t)+n)))}function LL(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=RL(e,t,n,r[0].index);return{bottom:RL(e,t,n,r[r.length-1].index)+i,top:a}}function RL(e,t,n,r){let i=DL(r/IL(e.width,n.width,t.column)),a=i*n.height+OL(0,i-1)*t.row;return a>0?a+t.row:a}var zL=QP(([e,t])=>({...e,...t}),MP(FL,QP(()=>{let e=Z(e=>`Item ${e}`),t=Z({}),n=Z(null),r=Z(`virtuoso-grid-item`),i=Z(`virtuoso-grid-list`),a=Z(II),o=Z(`div`),s=Z(kP),c=(e,n=null)=>YP(X(t,UP(t=>t[e]),VP()),n),l=Z(!1),u=Z(!1);return LP(eF(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),BL=H.memo(function(){let e=KL(`gridState`),t=KL(`listClassName`),n=KL(`itemClassName`),r=KL(`itemContent`),i=KL(`computeItemKey`),a=KL(`isSeeking`),o=qL(`scrollHeight`),s=KL(`ItemComponent`),c=KL(`ListComponent`),l=KL(`ScrollSeekPlaceholder`),u=KL(`context`),d=qL(`itemDimensions`),f=qL(`gap`),p=KL(`log`),m=KL(`stateRestoreInProgress`),h=qL(`reportReadyState`),g=sF(H.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:XL(`column-gap`,getComputedStyle(e).columnGap,p),row:XL(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return MI(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,G.jsx)(c,{className:t,ref:g,...JI(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,G.jsx)(l,{...JI(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,H.createElement)(s,{...JI(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),VL=H.memo(function(){let e=KL(`HeaderComponent`),t=qL(`headerHeight`),n=KL(`headerFooterTag`),r=sF(H.useMemo(()=>e=>{t(RF(e,`height`))},[t]),!0,!1),i=KL(`context`);return e==null?null:(0,G.jsx)(n,{ref:r,children:(0,G.jsx)(e,{...JI(e,i)})})}),HL=H.memo(function(){let e=KL(`FooterComponent`),t=qL(`footerHeight`),n=KL(`headerFooterTag`),r=sF(H.useMemo(()=>e=>{t(RF(e,`height`))},[t]),!0,!1),i=KL(`context`);return e==null?null:(0,G.jsx)(n,{ref:r,children:(0,G.jsx)(e,{...JI(e,i)})})}),UL=({children:e})=>{let t=H.useContext(OI),n=qL(`itemDimensions`),r=qL(`viewportDimensions`),i=sF(H.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return H.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,G.jsx)(`div`,{ref:i,style:GI(!1),children:e})},WL=({children:e})=>{let t=H.useContext(OI),n=qL(`windowViewportRect`),r=qL(`itemDimensions`),i=KL(`customScrollParent`),a=KL(`useWindowScroll`),o=dF(n,i,!1);return H.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,G.jsx)(`div`,{ref:o,style:KI(!1,a),children:e})},{Component:Nne,useEmitter:GL,useEmitterValue:KL,usePublisher:qL}=EI(zL,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},H.memo(function({...e}){let t=KL(`useWindowScroll`),n=KL(`customScrollParent`),r=n||t?YL:JL,i=n||t?WL:UL,a=KL(`context`);return(0,G.jsx)(r,{...e,...JI(r,a),children:(0,G.jsxs)(i,{children:[(0,G.jsx)(VL,{}),(0,G.jsx)(BL,{}),(0,G.jsx)(HL,{})]})})})),JL=QI({useEmitter:GL,useEmitterValue:KL,usePublisher:qL}),YL=$I({useEmitter:GL,useEmitterValue:KL,usePublisher:qL});function XL(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,nF.WARN),t===`normal`?0:parseInt(t??`0`,10)}function ZL({name:e,color:t}){return(0,G.jsx)(Fo,{name:e,variant:`beam`,colors:ro(t),size:`100%`,className:`absolute inset-0 h-full w-full`})}var QL=2e3,$L=6e4;function eR(){let e=globalThis[c];return typeof e==`string`?e:null}function tR(e,t,n){let r=QL,i=!1,a,o=()=>{t(e).then(e=>{if(!i){if(e)return n();r=Math.min(r*2,$L),a=setTimeout(o,r)}})};return a=setTimeout(o,r),()=>{i=!0,clearTimeout(a)}}var nR=e=>new Promise(t=>{let n=new Image;n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e});function rR(e){let t=eR();!t||typeof caches>`u`||Me(caches,t,e).catch(()=>{})}var iR=`#7c5cff`;function aR({name:e,color:t,image:n,className:r,enso:i}){let[a,o]=(0,H.useState)(null);return(0,H.useEffect)(()=>{if(!(!n||a!==n||!eR()))return tR(n,nR,()=>o(null))},[a,n]),n&&a!==n?(0,G.jsx)(`img`,{"data-enso":i,"data-image":`true`,src:n,alt:``,draggable:!1,onError:()=>o(n),className:W(`object-cover`,r),style:t?{backgroundColor:t}:void 0}):(0,G.jsx)(`span`,{"data-enso":i,"data-generated":`true`,className:W(`relative block shrink-0 overflow-hidden`,r),children:(0,G.jsx)(ZL,{name:e.trim()||`secretary`,color:t??iR})})}var oR={xs:`size-6 rounded-[8px] text-[11.5px]`,sm:`size-[22px] rounded-[7px] text-[11.5px]`,md:`size-7 rounded-[9px] text-[13px]`,lg:`size-11 rounded-[13px] text-base`};function sR({name:e,color:t,image:n,needsYou:r,running:i,size:a=`md`,enso:o=`secretary-avatar`}){let s=r>0?`warn`:i>0?`run`:null;return(0,G.jsxs)(`span`,{"data-enso":o,"data-image":n?`true`:void 0,className:W(`relative flex shrink-0`,oR[a]),children:[(0,G.jsx)(aR,{name:e,color:t,image:n,enso:`${o}-face`,className:`size-full overflow-hidden rounded-[inherit]`}),s&&(0,G.jsx)(`span`,{"data-enso":`secretary-pip`,"data-tone":s,className:W(`absolute -top-1 -right-1 size-2.5 rounded-full border-2 border-background`,s===`warn`?`bg-warning`:`bg-success`)})]})}var cR=e=>e===`oauth-credentials-unloaded`||e===`oauth-credentials-loading`||e===`oauth-credentials-error`;function lR(e){switch(e.oauthCredentials.status){case`unloaded`:return{reason:`oauth-credentials-unloaded`,suggestedAction:`load-oauth-credentials`};case`loading`:return{reason:`oauth-credentials-loading`,suggestedAction:`wait-for-oauth-credentials`};case`error`:return{reason:`oauth-credentials-error`,suggestedAction:`retry-oauth-credentials`,credentialError:e.oauthCredentials.error};case`ready`:return null}}function uR(e,t,n,r){if(!e)return`missing-selection`;if(Sj(e)){if(!r)return`provider-missing`;let i=Cj(r,e);return i?i.enabled?uR(i.primary,t,n):`model-disabled`:`model-missing`}let i=t.find(t=>t.id===e.providerId);if(!i)return`provider-missing`;if(!i.enabled)return`provider-disabled`;if(ve(i))return`classifier-only`;let a=i.models.find(t=>t.id===e.modelId);return a?a.enabled===!1?`model-disabled`:i.oauthAccountPool!==void 0&&!O(i)?`oauth-account-missing`:i.oauthAccountKey?n.oauthCredentials.status===`ready`?O(i)?u(i,e.modelId,t,n.oauthCredentials.authenticatedAccountKeys).length>0?`usable`:`oauth-account-missing`:n.oauthCredentials.authenticatedAccountKeys.has(i.oauthAccountKey)?`usable`:`oauth-account-missing`:lR(n)?.reason??`oauth-credentials-error`:i.apiKey?`usable`:`api-key-missing`:`model-missing`}function dR(e,t){let n=e?.groupId?t.find(t=>t.id===e.groupId):void 0;return{projectDefaultModel:e?.defaultModel??null,groupDefaultModel:n?.defaultModel??null,projectReasoningEnabled:e?.defaultReasoningEnabled,projectThinkingLevel:e?.defaultThinkingLevel,groupReasoningEnabled:n?.defaultReasoningEnabled,groupThinkingLevel:n?.defaultThinkingLevel}}function fR(e){let t=uR(e.defaultModel,e.providers,e.credentials,e.virtualModels),n=e.defaultModel!==null&&t!==`usable`&&!cR(t),r=[{selection:e.lastProviderId&&e.lastModelId?{providerId:e.lastProviderId,modelId:e.lastModelId}:null,source:`session`},{selection:e.projectDefaultModel??null,source:`project`},{selection:e.groupDefaultModel??null,source:`group`},{selection:e.defaultModel,source:`default`}];for(let t of r){let r=uR(t.selection,e.providers,e.credentials,e.virtualModels);if(r===`usable`&&t.selection)return{...t.selection,source:t.source,invalidDefault:t.source!=="default"&&n};if(cR(r)){let t=lR(e.credentials);if(t)return{providerId:null,modelId:null,source:`none`,invalidDefault:n,...t}}}return{providerId:null,modelId:null,source:`none`,invalidDefault:n,...(cR(t)?lR(e.credentials):null)??{reason:`no-usable-model`}}}var pR={revision:0,availability:{status:`unloaded`}},mR=kN(()=>({snapshot:pR}));function hR(e){return{oauthCredentials:e.availability}}var gR=kN(()=>({snapshot:void 0}));function _R(){return Ej(E.getState().providers,gR.getState().snapshot)}function vR(e){new Set(e)}function yR(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var bR=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return bR(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return bR(t)(e)}}}},xR=(e,t)=>(n,r,i)=>{let a={storage:yR(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>(f(e,t),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return bR(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p},SR=e=>{if(typeof e!=`string`||!e.startsWith(`plugin:`))return!1;let t=e.indexOf(`:`,7);return t>7&&t<e.length-1};function CR(e,t,n){if(!t)return!1;let r=e.uiByConversation[t]?.open;return r===void 0?!n&&e.liveGlobalTabs.length>0:r}function wR(e){let t=Array.isArray(e.globalTabs)?e.globalTabs.filter(SR):[],n=e.globalScopeOverrides,r={};if(n&&typeof n==`object`&&!Array.isArray(n))for(let[e,t]of Object.entries(n))SR(e)&&(t===`global`||t===`session`)&&(r[e]=t);return{globalTabs:[...new Set(t)],globalScopeOverrides:r}}function TR(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ER(e,t){if(TR(e)){if(e.type===`leaf`){let n=TR(e.data)?e.data:void 0,r=Array.isArray(n?.views)?n.views.filter(e=>typeof e==`string`&&t.has(e)):[];if(r.length===0)return;let i=n?.views,a=i.indexOf(n?.activeView),o=typeof n?.activeView==`string`&&t.has(n.activeView)?n.activeView:[...i.slice(0,Math.max(a,0)).reverse(),...i.slice(a+1)].find(e=>typeof e==`string`&&t.has(e))??r[0];return{type:`leaf`,data:{...n,views:r,activeView:o},size:e.size}}if(e.type===`branch`){let n=Array.isArray(e.data)?e.data.flatMap(e=>{let n=ER(e,t);return n?[n]:[]}):[];return n.length===0?void 0:{type:`branch`,data:n,size:e.size}}}}function DR(e,t){return!e||!TR(e.panels)||!(t in e.panels)?e:OR(e,e=>e!==t)}function OR(e,t){if(!TR(e)||!TR(e.panels))return;let n={};for(let[r,i]of Object.entries(e.panels))t(r,i)&&(n[r]=i);let r=new Set(Object.keys(n));if(r.size===0)return;let i=TR(e.grid)?e.grid:void 0,a=i?ER(i.root,r):void 0;if(a)return{...e,panels:n,grid:{...i,root:a}}}var kR=4,AR=e=>{if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null};function jR(e){if(!AR(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!AR(r))continue;let e={};for(let[t,n]of Object.entries(r))typeof n==`string`&&(e[t]=n);Object.keys(e).length>0&&(t[n]=e)}return t}function MR(e,t){let n=AR(e)?e:{};if(t<2)return{state:{uiByConversation:{},layouts:{}},snapshots:{}};if(t<kR)return{state:{uiByConversation:t<3?{}:n.uiByConversation??{},layouts:n.layouts??{},changesModeByConversation:n.changesModeByConversation??{}},snapshots:jR(n.snapshotsByConversation)};let{snapshotsByConversation:r,...i}=n;return{state:i,snapshots:{}}}function NR(e,t){let{state:n,snapshots:r}=MR(e,t);return{state:{...n,...wR(n)},snapshots:r}}function PR(e){return typeof e!=`number`||!Number.isFinite(e)?224:Math.min(480,Math.max(160,e))}function FR(e,t){let n=PR(e);if(t<=0)return n;let r=Math.max(224,t-240-1);return Math.min(n,r)}function IR(e,t,n){let r=FR(e,n),i=FR(r+t,n);return i===r?PR(e):i}function LR(e,t,n=1){let r=Math.max(280,e);if(t<=0)return r;let i=Math.max(0,t-360-n);return Math.min(i,r)}function RR(e,t,n,r=1){let i=LR(e,n,r),a=LR(i+t,n,r);return a===i?e:a}function zR(){return aP.getState().activeId??void 0}function BR(e,t){return e.uiByConversation[t]??{width:e.lastWidth}}function VR(e,t){return CR(e,t,kD())}function HR(e,t,n){return{...e.fullscreenByConversation,[t]:n}}function UR(e,t,n){return{...e.uiByConversation,[t]:{...BR(e,t),...n}}}var WR=kN()(xR((e,t)=>({fullscreen:!1,fullscreenByConversation:{},lastWidth:360,filesTreeWidth:224,uiByConversation:{},browserHoles:{},layouts:{},pinnedTabs:[],globalTabs:[],globalScopeOverrides:{},liveGlobalTabs:[],changesModeByConversation:{},snapshotsByConversation:{},toggleOpen:()=>{let n=zR();if(!n)return;let r=!VR(t(),n);e({uiByConversation:UR(t(),n,{open:r}),fullscreen:r?t().fullscreen:!1,fullscreenByConversation:HR(t(),n,r?t().fullscreen:!1)})},reconcileForActiveConversation:()=>{let n=zR(),r=n?t().fullscreenByConversation[n]??!1:!1;r!==t().fullscreen&&e({fullscreen:r})},ensureOpen:n=>{let r=n??zR();!r||BR(t(),r).open||e({uiByConversation:UR(t(),r,{open:!0})})},nudgeWidth:(n,r,i)=>{let a=zR();if(!a)return;let o=RR(BR(t(),a).width,n,r,i);e({uiByConversation:UR(t(),a,{width:o}),lastWidth:o})},nudgeFilesTreeWidth:(n,r=0)=>{let i=IR(t().filesTreeWidth,n,r);i!==t().filesTreeWidth&&e({filesTreeWidth:i})},resetFilesTreeWidth:()=>e({filesTreeWidth:224}),toggleFullscreen:()=>{let n=zR();if(!n)return;let{fullscreen:r}=t();if(!VR(t(),n)){e({uiByConversation:UR(t(),n,{open:!0}),fullscreen:!0,fullscreenByConversation:HR(t(),n,!0)});return}e({fullscreen:!r,fullscreenByConversation:HR(t(),n,!r)})},setFullscreen:n=>{let r=zR();if(n&&r){e({fullscreen:!0,uiByConversation:UR(t(),r,{open:!0}),fullscreenByConversation:HR(t(),r,!0)});return}e({fullscreen:n,...r?{fullscreenByConversation:HR(t(),r,n)}:{}})},togglePinnedTab:n=>{let r=t().pinnedTabs,i=Array.isArray(r)?r:[];e({pinnedTabs:i.includes(n)?i.filter(e=>e!==n):[...i,n]})},setBrowserHole:(n,r)=>{let{[n]:i,...a}=t().browserHoles;!r&&!i||e({browserHoles:r?{...a,[n]:r}:a})},setGlobalTabs:t=>e({globalTabs:t}),setGlobalScopeOverride:(n,r)=>{let{[n]:i,...a}=t().globalScopeOverrides;e({globalScopeOverrides:r?{...a,[n]:r}:a})},setLiveGlobalTabs:n=>{let r=t().liveGlobalTabs;r.length===n.length&&r.every((e,t)=>e===n[t])||e({liveGlobalTabs:n})},dropPanelFromLayouts:(n,r)=>{let{layouts:i,uiByConversation:a}=t(),o={...i},s={...a},c=!1;for(let[e,t]of Object.entries(i)){if(r.has(e))continue;let i=DR(t,n);if(i===t)continue;c=!0,o[e]=i;let l=a[e];!i&&l?.open===!0&&(s[e]={...l,open:!1})}c&&e({layouts:o,uiByConversation:s})},saveLayout:(n,r)=>{aP.getState().conversations[n]&&e({layouts:{...t().layouts,[n]:r}})},forgetConversation:n=>{let{[n]:r,...i}=t().layouts,{[n]:a,...o}=t().uiByConversation,{[n]:s,...c}=t().fullscreenByConversation,{[n]:l,...u}=t().changesModeByConversation,{[n]:d,...f}=t().snapshotsByConversation;e({layouts:i,uiByConversation:o,fullscreenByConversation:c,changesModeByConversation:u,snapshotsByConversation:f})},setChangesMode:(n,r)=>{e({changesModeByConversation:{...t().changesModeByConversation,[n]:r}})},saveSnapshots:(n,r)=>{e({snapshotsByConversation:{...t().snapshotsByConversation,[n]:r}}),window.electronAPI.changes.writeSnapshots({conversationId:n,snapshots:r})},loadSnapshots:n=>{if(n in t().snapshotsByConversation)return;let r=r=>{n in t().snapshotsByConversation||e({snapshotsByConversation:{...t().snapshotsByConversation,[n]:r}})};window.electronAPI.changes.readSnapshots({conversationId:n}).then(r,()=>r({}))}}),{name:`enso-side-panel`,version:5,storage:yR(()=>localStorage),partialize:e=>({lastWidth:e.lastWidth,filesTreeWidth:e.filesTreeWidth,uiByConversation:e.uiByConversation,fullscreenByConversation:e.fullscreenByConversation,layouts:e.layouts,pinnedTabs:e.pinnedTabs,globalTabs:e.globalTabs,globalScopeOverrides:e.globalScopeOverrides,changesModeByConversation:e.changesModeByConversation}),merge:(e,t)=>{let n=e&&typeof e==`object`?e:{};return{...t,...n,...wR(n)}},migrate:(e,t)=>{let{state:n,snapshots:r}=NR(e,t),i=window.electronAPI?.changes;if(i)for(let[e,t]of Object.entries(r))i.writeSnapshots({conversationId:e,snapshots:t});return n}})),GR=`Let's set you up. Ask me a few questions about what to call me, which model you should use, and how much you may do on your own. Then submit the draft with secretary_profile_propose and wait for my confirmation.`,KR={enabled:!1,projectId:null,profile:null,persona:``,board:{needsYou:[],running:[],done:[],todos:[]},proposals:{},takeovers:[]};function qR(e,t){return t&&e.some(e=>e.id===t)?t:e[0]?.id??null}function JR(e){vR(Object.values(e).flatMap(e=>e.takeovers.map(e=>e.conversationId)))}function YR(e){return e?XR.getState().secretaries.find(t=>t.projectId===e)?.id??null:null}var XR=kN()((e,t)=>({secretary:KR,secretaries:[],states:{},focusedId:null,resolving:{},welcomeOpen:!1,focusProposal:null,focus:n=>{let{states:r,focusedId:i}=t();i===n&&r[n]||(e({focusedId:n,secretary:r[n]??KR,welcomeOpen:!1}),r[n]||t().reload(n))},reload:async n=>{let r=n??t().focusedId;if(!r)return;let i=await window.electronAPI.secretary.getState(r).catch(()=>null);i&&e(e=>({states:{...e.states,[r]:i},...e.focusedId===r?{secretary:i}:{}}))},createSecretary:async()=>{let n=await window.electronAPI.secretary.create();return n.ok?(e({secretaries:await window.electronAPI.secretary.list()}),t().focus(n.secretaryId),e({welcomeOpen:!0}),n.secretaryId):null},openWelcome:()=>e({welcomeOpen:!0}),closeWelcome:()=>e({welcomeOpen:!1}),focusProposalCard:t=>e({focusProposal:{proposalId:t,at:Date.now()}}),clearFocusProposal:()=>e({focusProposal:null}),bind:()=>{let n=new Set,r=!0,i=n=>{let r=n.secretaryId??t().focusedId;r&&e(e=>{let t={...e.states,[r]:n};JR(t);let i=qR(e.secretaries,e.focusedId)??r;if(i!==r)return{states:t,focusedId:i};let a=e.states[r]??e.secretary;return{states:t,focusedId:i,secretary:n,welcomeOpen:n.profile?!1:a.profile!==null&&a.enabled?!0:e.welcomeOpen}})},a=window.electronAPI.secretary.onStateChanged(e=>{e.secretaryId&&n.add(e.secretaryId),i(e)}),o=window.electronAPI.secretary.onListChanged(t=>{rR(t.map(e=>e.id)),e(e=>{let n=new Set(t.map(e=>e.id)),r=Object.fromEntries(Object.entries(e.states).filter(([e])=>n.has(e))),i=qR(t,e.focusedId);return JR(r),{secretaries:t,states:r,focusedId:i,secretary:i&&r[i]||(i===e.focusedId?e.secretary:KR)}})});window.electronAPI.secretary.list().then(async t=>{if(r){rR(t.map(e=>e.id)),e(e=>({secretaries:t,focusedId:qR(t,e.focusedId)}));for(let e of t){let t=await window.electronAPI.secretary.getState(e.id);!r||n.has(e.id)||i({...t,secretaryId:t.secretaryId??e.id})}}}).catch(()=>void 0);let s=window.electronAPI.secretary.onOpenConversation(e=>{aP.getState().selectConversation(e.conversationId),WR.getState().ensureOpen(e.conversationId),e.proposalId&&t().focusProposalCard(e.proposalId)}),c=aP.subscribe((e,n)=>{if(e.activeId===n.activeId)return;let r=YR(e.activeId?e.conversations[e.activeId]?.projectId:void 0);r&&t().focus(r)});return()=>{r=!1,a(),o(),s(),c(),vR([]),e({secretary:KR,secretaries:[],states:{},focusedId:null,welcomeOpen:!1,focusProposal:null})}},newSecretaryConversation:async e=>{let{states:n,secretary:r,secretaries:i}=t(),a=e?.secretaryId?n[e.secretaryId]:r;e?.secretaryId&&t().focus(e.secretaryId);let o=a?.projectId??(e?.secretaryId?i.find(t=>t.id===e.secretaryId)?.projectId:null);if(!o)return null;let s=E.getState().projects.find(e=>e.id===o);if(!s)return null;let c=e?.greeting?ZR(o):null;if(e?.greeting&&!c)return null;let l=aP.getState(),u=await l.newConversation(o);if(!u)return null;if(c){let e=M(E.getState().language);await l.send(Le(e,GR),{...c,cwd:s.path},void 0,u)}return u},resolveProposal:async(n,r,i,a)=>{e({resolving:{...t().resolving,[n]:!0}});try{await window.electronAPI.secretary.resolveProposal(n,r,i,a)}catch{}finally{let r={...t().resolving};delete r[n],e({resolving:r})}}}));function ZR(e){let t=E.getState(),n=t.projects.find(t=>t.id===e);if(!n)return null;let r=fR({defaultModel:t.defaultModel,...dR(n,t.projectGroups),providers:_R(),credentials:hR(mR.getState().snapshot),virtualModels:t.virtualModels});return r.source===`none`?null:{providerId:r.providerId,modelId:r.modelId}}function QR(){let e=XR(e=>e.secretary.enabled?e.secretary.profile:null),t=XR(e=>e.secretary.secretaryId??void 0);if(!e)return null;let n=e.avatar.imageVersion;return{name:e.name.trim()||`·`,color:e.avatar.color,...n?{image:I(n,e.avatar.imageHash,t)}:{}}}var $R=kN(()=>({active:!1})),ez=()=>$R.getState().active;function tz(e){return typeof e!=`number`||!Number.isInteger(e)?5:e<1?1:e>60?60:e}function nz(e){return tz(e)*1e3}var rz=new Set(`ls.tree.pwd.cd.cat.bat.head.tail.wc.nl.tac.less.more.rg.grep.egrep.fgrep.ag.find.fd.fdfind.which.type.file.stat.du.df.sort.uniq.cut.tr.awk.sed.diff.jq.yq.echo.printf.basename.dirname.realpath.readlink.printenv.date.whoami.uname.column.true.test.[.git`.split(`.`)),iz=new Set([`status`,`log`,`diff`,`show`,`blame`,`grep`,`ls-files`,`ls-tree`,`rev-parse`,`describe`,`shortlog`,`reflog`,`cat-file`,`name-rev`,`remote`,`config`,`branch`,`tag`]),az={sed:/^(-[a-zA-Z]*i|--in-place)|\/[a-zA-Z]*e[a-zA-Z]*['"]?$|^['"]?e\b/,awk:/^-[a-zA-Z]*[fiE]|^--(file|include|exec)/,yq:/^-[a-zA-Z]*[is]|^--(inplace|split-exp)/,sort:/^-[a-zA-Z]*o|^--(output|compress-program)/,find:/^-(exec|execdir|ok|okdir|delete|fprint|fprintf|fprint0|fls)$/,git:/^--(output|ext-diff|textconv|filters|exec-path)/,rg:/^--pre($|=)/,fd:/^-[a-zA-Z0-9]*[xX]|^--exec/,fdfind:/^-[a-zA-Z0-9]*[xX]|^--exec/,ag:/^--pager/,bat:/^--pager/,tree:/^-o$|^--output/,file:/^-[a-zA-Z]*C/,date:/^(-s|--set)/},oz={branch:/^-(d|D|m|M|c|C|u|f|-delete|-move|-copy|-set-upstream-to|-unset-upstream|-force)/,tag:/^-(a|s|d|f|m|F|-annotate|-sign|-delete|-force|-message)/,config:/^(-e|--edit|--unset|--unset-all|--add|--replace-all|--rename-section|--remove-section)$/,remote:/^(add|remove|rm|rename|set-url|set-head|set-branches|prune|update)$/,reflog:/^(expire|delete)$/,grep:/^(-O|--open-files-in-pager)/},sz=/^\/(usr\/(local\/)?)?s?bin\/[^/]+$|^\/opt\/homebrew\/bin\/[^/]+$/,cz=new Set([`--no-pager`,`-P`,`--no-optional-locks`]),lz=/^(LC_[A-Z_]+|LANG|LANGUAGE|TZ|NO_COLOR|FORCE_COLOR|CLICOLOR(_FORCE)?|COLUMNS|TERM)=/,uz=new Set([`node`,`npm`,`pnpm`,`yarn`,`bun`,`deno`,`python`,`python3`,`pip`,`pip3`,`ruby`,`go`,`cargo`,`rustc`,`java`,`javac`]),dz=/^['"]?((\d+|\$)(,(\d+|\$))?|\/[^/]*\/)p['"]?$/,fz=new Set([`-n`,`-E`,`-r`,`--quiet`,`--silent`]);function pz(e){let t=e.trim().split(/\s+/),n=0;for(;n<t.length&&/^[A-Za-z_][A-Za-z0-9_]*=/.test(t[n]);)n+=1;return{env:t.slice(0,n),tokens:t.slice(n)}}function mz(e){let t=pz(e).tokens[0]??``;return t.slice(t.lastIndexOf(`/`)+1)}function hz(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31&&n!==10)return!0}return!1}function gz(e){let t=e.find(e=>!fz.has(e));return!t||!dz.test(t)?!1:e.slice(0,e.indexOf(t)).every(e=>fz.has(e))}function _z(e){let t=1;for(;t<e.length&&e[t].startsWith(`-`);)if(e[t]===`-C`){if(t+1>=e.length)return!1;t+=2}else if(cz.has(e[t]))t+=1;else return!1;if(t>=e.length)return!1;let n=e[t];if(!iz.has(n))return!1;let r=e.slice(t+1),i=oz[n];return!(i&&r.some(e=>i.test(e))||n===`config`&&!r.some(e=>/^(--get|--get-all|--list|-l|--get-regexp)$/.test(e))||(n===`branch`||n===`tag`)&&r.some(e=>!e.startsWith(`-`))&&!r.some(e=>e===`-l`||e===`--list`))}function vz(e){let t=e.trim();if(!t||/\$\(|<\(|`/.test(t)||hz(t))return!1;let n=t.replace(/2>&1|[12]?>\s*\/dev\/null/g,``);if(n.includes(`>`))return!1;let r=n.split(/\|\|?|&&?|;|\n/);for(let e of r){let t=e.trim();if(!t)continue;let{env:n,tokens:r}=pz(t);if(n.some(e=>!lz.test(e)))return!1;let i=mz(t),a=r[0]??``;if(a.includes(`/`)&&!sz.test(a))return!1;let o=r.slice(1);if(uz.has(i)){if(o.length!==1||![`--version`,`-v`,`-V`].includes(o[0]))return!1;continue}if(!rz.has(i))return!1;let s=az[i];if(s&&o.some(e=>s.test(e))||i===`awk`&&/system\s*\(/.test(o.join(` `))||i===`sed`&&!gz(o)||i===`git`&&!_z(r)||i===`uniq`&&o.filter(e=>!e.startsWith(`-`)).length>1)return!1}return!0}var yz=`</untrusted-content`,bz=`<untrusted-content`;function xz(e){return e.split(`<\\/untrusted-content`).join(yz).split(`<\\untrusted-content`).join(bz)}var Sz=/^<untrusted-content(?:\s[^<>\n]*)?>([\s\S]*)<\/untrusted-content>$/u,Cz=/<\\?untrusted-content source="plugin:[^"<>\n]*"[^<>\n]*>/u,wz=/<\\?\/untrusted-content>\s*$/u;function Tz(e){let t=Sz.exec(e.trim()),n=!!(t&&!t[1].includes(yz)),r=n&&t?t[1]:e,i=Cz.exec(r),a=wz.exec(r);return i&&a&&a.index>=i.index+i[0].length&&(r=r.slice(0,i.index)+r.slice(i.index+i[0].length,a.index)),n&&(r=xz(r)),r===e?e:r.trim()}function Ez(e){let t=/^mcp__(.+?)__(.+)$/.exec(e);return t?{server:t[1],tool:t[2]}:null}function Dz(e){let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return null}return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function Oz(e){let t=[e.tool,e.name].find(e=>typeof e==`string`&&e);if(typeof t==`string`)return t.startsWith(`mcp__`)||typeof e.server!=`string`||!e.server?t:`mcp__${e.server}__${t}`}function kz(e,t){if(e!==`mcp`)return{name:e,args:t};let n=Dz(t);if(!n)return{name:e,args:t};let r=Oz(n);return n.action===`list`?{name:e,args:t,summary:typeof n.server==`string`&&n.server?n.server:`list`}:n.action===`describe`&&r?{name:e,args:t,summary:r}:n.action===`call`&&r&&Ez(r)?{name:r,args:Dz(n.arguments)??{}}:{name:e,args:t}}function Az(e,t,n){let r=[];for(let i=0;i<e.length;){let a=e[i];if(a.kind!==`tool`||!a.name||!t(a.name)){r.push(a),i+=1;continue}let o=i+1;for(;o<e.length&&e[o].kind===`tool`&&e[o].name===a.name;)o+=1;r.push(o-i>=2?n(a,e.slice(i+1,o)):a),i=o}return r}var jz=[`日`,`一`,`二`,`三`,`四`,`五`,`六`],Mz=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Nz(e){let t=e.trim();return t.length<=8?t:`${t.slice(0,8)}…`}function Pz(e,t){return t?.trim()||(e?Nz(e):``)}function Fz(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Iz(e){return String(e).padStart(2,`0`)}function Lz(e,t){return`${Iz(e)}:${Iz(t)}`}function Rz(e,t,n){return e.length===n-t+1&&e[0]===t&&e[e.length-1]===n}function zz(e,t){if(e.length<2||e[0]!==0)return;let n=e[1]-e[0];if(!(n<1)){for(let t=1;t<e.length;t+=1)if(e[t]-e[t-1]!==n)return;return e[e.length-1]+n>=t?n:void 0}}function Bz(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Vz(e,t){let n=Bo(e);if(!n)return e.trim();let r=Rz(n.dayOfMonth,1,31)&&Rz(n.month,1,12)&&Rz(n.dayOfWeek,0,6);if(r&&Rz(n.hour,0,23)){let e=zz(n.minute,60);if(e===1)return t===`zh`?`每分钟`:`every minute`;if(e)return t===`zh`?`每 ${e} 分钟`:`every ${e} minutes`}if(n.minute.length!==1||n.hour.length!==1||!Rz(n.month,1,12))return n.source;let i=Lz(n.hour[0],n.minute[0]);if(r)return t===`zh`?`每天 ${i}`:`every day at ${i}`;if(Rz(n.dayOfMonth,1,31)&&Bz(n.dayOfWeek,[1,2,3,4,5]))return t===`zh`?`每个工作日 ${i}`:`weekdays at ${i}`;if(Rz(n.dayOfMonth,1,31)&&n.dayOfWeek.length===1){let e=n.dayOfWeek[0];return t===`zh`?`每周${jz[e]} ${i}`:`every ${Mz[e]} at ${i}`}return n.source}var Hz=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Uz(e){if(!e)return null;try{let t=JSON.parse(e);return Hz(t)?t:null}catch{return null}}function Wz(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){if(!Hz(r)||typeof r.id!=`string`||!r.id||typeof r.title!=`string`||typeof r.content!=`string`)return null;let{spaceId:e,[t]:i}=r;n.push({id:r.id,title:r.title,content:r.content,unitType:typeof r.unitType==`string`&&r.unitType?r.unitType:null,space:e===`global`?`global`:typeof e==`string`&&e.startsWith(`proj:`)?`project`:null,relevance:typeof i==`number`&&Number.isFinite(i)?i:null})}return n}function Gz(e){let t=Uz(e);return t?Wz(t.results,`relevance`):null}function Kz(e,t){let n=Uz(e);if(n?.status===`candidates_found`){let e=Wz(n.candidates,`similarity`);return e?{written:!1,candidates:e}:null}if(n?.status!==`inserted`||!Hz(n.memory)||!t)return null;let r=Wz([{...n.memory,content:t}],`relevance`)?.[0];return r?{written:!0,deduplicated:n.deduplicated===!0,memory:r}:null}var qz=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]);function Jz(e){for(let t of e){if(!t||typeof t!=`object`)continue;let e=t;if(!(e.type!==`image`||typeof e.data!=`string`||!e.data)&&typeof e.mimeType==`string`&&qz.has(e.mimeType))return e}}var Yz=e=>typeof e==`number`?e:null;function Xz(e){let t=e?.split(`
190
- `,1)[0]?.trim();if(!t?.startsWith(`{`))return null;let n;try{n=JSON.parse(t)}catch{return null}if(!n||typeof n!=`object`)return null;let r=n;return{path:typeof r.path==`string`&&r.path?r.path:null,size:Yz(r.size),width:Yz(r.width),height:Yz(r.height)}}var Zz=/^(?:\/|[A-Za-z]:[\\/]|\\\\)/u;function Qz(e,t,n){return n?e?`data:${e.mimeType};base64,${e.data}`:t&&Zz.test(t)?f(t):null:null}var $z=new Set([...ce,`memory_search`,`memory_capture`,`memory_delete`,`memory_crystallize`,`web_search`,`web_fetch`]);function eB(e,t=!1){return e===`task_settle`?!0:t?$z.has(e)||e.startsWith(`my_`)||Ez(e)!==null:!1}var tB=new Map;function nB(e,t){tB.set(e,t)}function rB(e,t){return(tB.get(e.name)??UB)(e,t)}var iB={todo_item_update:`Updated {{count}} to-dos`,todo_item_add:`Added {{count}} to-dos`,session_send:`Sent {{count}} messages`,session_stop:`Stopped {{count}} sessions`,session_task_stop:`Stopped {{count}} background tasks`,session_archive:`Archived {{count}} sessions`,session_unarchive:`Unarchived {{count}} sessions`,result_mark_done:`Marked {{count}} sessions done`,result_mark_undo:`Undid {{count}} marks`,needs_user_escalate:`Escalated {{count}} items to you`,session_answer:`Answered {{count}} questions`,session_create:`Created {{count}} sessions`,todo_item_dispatch:`Dispatched {{count}} to-dos`,schedule_add:`Added {{count}} schedules`,schedule_remove:`Removed {{count}} schedules`};function aB(e,t){let n=e.map(e=>rB(e,t));if(n.length<=1)return{grouped:!1,title:n[0]?.title??``,cards:n};let r=e[0]?.name??``,i=iB[r];return{grouped:!0,title:i?t.t(i,{count:n.length}):t.t(`{{count}} × {{tool}}`,{count:n.length,tool:oB(r,t)}),cards:n}}function oB(e,t){if(e.startsWith(`my_`))return t.t(`Custom tool {{name}}`,{name:e.slice(3).replaceAll(`-`,` `)});let n=Ez(e);if(n)return`${n.tool.replaceAll(`_`,` `)} · ${n.server}`;let r=Ms[e];return r?t.t(r):e.replaceAll(`_`,` `)}function sB(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Q(e){return sB(e)?e:null}function cB(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function lB(e){let t=cB(e);return t===null?cB(e?.split(`
191
- `,1)[0]??null):t}function $(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function uB(e){let t=$(e);if(!t)return;let n=t.match(/^<untrusted-content\b[^>]*>([\s\S]*)<\/untrusted-content>$/u);return(n?n[1]:t).trim()||void 0}function dB(e){return e.length>280||e.split(`
192
- `).length>6}function fB(e){let t=``;try{t=typeof e.args==`string`?e.args:JSON.stringify(e.args,null,2)??``}catch{t=String(e.args)}return{rawArgs:t,rawOutput:e.output??``}}function pB(e,t,n,r){return{name:e.name,title:t,state:e.state,blocks:n,...r?{status:r}:{},...fB(e)}}var mB={"dispatch-limit":`Dispatch limit reached`,"project-not-visible":`Project is not visible`,"project-required":`A project is required`,"not-found":`Not found`,"invalid-cron":`Invalid schedule`,"invalid-at":`Invalid schedule`,"at-in-past":`Invalid schedule`,"exactly-one-of-at-or-cron":`Invalid schedule`,"stale-index":`The message changed (the session was rewound or switched branches). List the session again and read it with the new id.`,"not-readable":`Only user and assistant messages can be read; tool calls and tool output are not shown.`};function hB(e,t){if(e.state!==`error`)return null;let n=e.output?.trim()??``;if(!n)return t.t(`Tool failed`);let r=mB[n]??mB[/^([a-z][a-z-]*):\s/u.exec(n)?.[1]??``];return r?t.t(r):n}function gB(e,t){return e?Pz(e,t.lookup?.sessionTitle?.(e)):t.t(`Unknown session`)}function _B(e,t){return e?Pz(e,t.lookup?.projectName?.(e)):t.t(`Not set`)}function vB(e,t){if(e==null||e===``)return t.t(`Not set`);if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function yB(e,t){return Object.entries(e).map(([e,n])=>({label:e,value:vB(n,t)}))}var bB={running:{key:`Session running`,tone:`ok`},idle:{key:`Session idle`,tone:`neutral`},waiting:{key:`Session needs you`,tone:`pending`},error:{key:`Session error`,tone:`error`},"not-started":{key:`Session not started`,tone:`neutral`}};function xB(e,t){let n=typeof e==`string`?bB[e]:void 0;return n?{badge:t.t(n.key),badgeTone:n.tone}:{badge:typeof e==`string`?e:``,badgeTone:`neutral`}}function SB(e){let t=Q(e);return(typeof t?.approvals==`number`?t.approvals:0)+(typeof t?.asks==`number`?t.asks:0)}function CB(e){return e.replace(/<untrusted-content[^>]*>/gu,``).replace(/<\/untrusted-content>/gu,``).trim()}function wB(e){let t=CB(e).split(`
193
- `).map(e=>e.trim()).find(Boolean)??``;return t.length>120?`${t.slice(0,120)}…`:t}var TB={dispatch:`Dispatch card`,profile:`Profile card`,skill:`Skill card`,tool:`Tool card`,takeover:`Takeover card`,cleanup:`Cleanup card`};function EB(e,t){if(e?.status!==`awaiting_confirmation`)return;let n=$(e.proposalId)??``,r=n?t.lookup?.proposal?.(n):void 0,i=r?.status??`pending`,a=t.t(TB[r?.kind??``]??`Confirmation card`);return i===`pending`||i===`executing`?{tone:`pending`,label:t.t(`Waiting on {{card}} {{id}}`,{card:a,id:n?Nz(n):t.t(`Not set`)})}:i===`succeeded`?{tone:`ok`,label:t.t(`Confirmed`)}:i===`rejected`?{tone:`error`,label:t.t(`Rejected`)}:i===`failed`?{tone:`error`,label:t.t(`Confirmation failed`)}:i===`expired`?{tone:`neutral`,label:t.t(`Confirmation expired`)}:{tone:`pending`,label:t.t(`Waiting on {{card}} {{id}}`,{card:a,id:Nz(n)})}}function DB(e,t){let n=$(e?.conversationId);return e?.status!==`created`&&e?.status!==`queued`||!n?null:{kind:`session`,id:n,label:gB(n,t)}}nB(`session_send`,(e,t)=>{let n=Q(e.args),r=Q(cB(e.output)),i=$(n?.conversationId),a=$(n?.mode)===`steer`,o=t.t(`Send message {{title}}`,{title:gB(i,t)}),s=[],c=$(n?.goal);c&&s.push({kind:`kv`,rows:[{label:t.t(`Goal`),value:c,display:`long`}]});let l=$(n?.message);l&&s.push({kind:`prompt`,label:t.t(`Message`),text:l});let u=hB(e,t);u&&s.unshift({kind:`error`,text:u});let d;u?d={tone:`error`,label:t.t(`Refused`)}:r?.status===`steered`?d={tone:`ok`,label:t.t(`Steered into the current turn`)}:r?.status===`queued`?d={tone:`queued`,label:t.t(`Queued until the current turn ends`)}:r?.status===`sent`?d={tone:`ok`,label:a?t.t(`Delivered as a new turn (the session was idle)`):t.t(`Delivered`)}:e.state===`running`&&(d={tone:`neutral`,label:a?t.t(`Steering…`):t.t(`Sending…`)});let f=i?{kind:`session`,id:i,label:gB(i,t)}:null;return f&&s.unshift(f),pB(e,o,s,d)}),nB(`session_answer`,(e,t)=>{let n=Q(e.args),r=Q(cB(e.output)),i=$(n?.conversationId),a=$(n?.answer),o=hB(e,t);return pB(e,t.t(`Answer {{title}}`,{title:gB(i,t)}),[...i?[{kind:`session`,id:i,label:gB(i,t)}]:[],...a?[{kind:`note`,text:a}]:[],...o?[{kind:`error`,text:o}]:[]],o?{tone:`error`,label:t.t(`Refused`)}:r?.status===`answered`?{tone:`ok`,label:t.t(`Answered`)}:e.state===`running`?{tone:`neutral`,label:t.t(`Answering…`)}:void 0)}),nB(`task_settle`,(e,t)=>{let n=Q(cB(e.output)),r=(Array.isArray(n?.settled)?n.settled:Array.isArray(Q(e.args)?.tasks)?Q(e.args)?.tasks:[]).flatMap(e=>{let t=Q(e),r=t?.action;return!t||r!==`stop`&&r!==`keep`?[]:[{item:t,action:r,done:n?t.ok!==!1:void 0}]}),i=r.filter(e=>e.action===`stop`&&e.done).length,a=r.filter(e=>e.action===`keep`&&e.done).length,o=hB(e,t);return pB(e,t.t(`Background task wrap-up`),[...r.length>0?[{kind:`list`,items:r.map(({item:e,action:n,done:r})=>({title:$(e.command)??$(e.taskId)??``,badge:r===!1?t.t(`Not running`):n===`stop`?t.t(`Stopped`):t.t(`Kept`),badgeTone:n===`keep`&&r!==!1?`pending`:`neutral`,...$(e.reason)?{detail:$(e.reason)}:{}}))}]:[],...o?[{kind:`error`,text:o}]:[]],o?{tone:`error`,label:t.t(`Failed`)}:n?{tone:`neutral`,label:t.t(`Stop {{stopped}} · Keep {{kept}}`,{stopped:i,kept:a})}:e.state===`running`?{tone:`neutral`,label:t.t(`Settling…`)}:void 0)}),nB(`session_task_stop`,(e,t)=>{let n=Q(e.args),r=$(n?.conversationId),i=$(n?.taskId),a=Q(cB(e.output)),o=hB(e,t);return pB(e,t.t(`Stop background task {{task}}`,{task:i??``}),[...r?[{kind:`session`,id:r,label:gB(r,t)}]:[],...i?[{kind:`note`,text:i}]:[],...o?[{kind:`error`,text:o}]:[]],o?{tone:`error`,label:t.t(`Refused`)}:a?.status===`stopped`?{tone:`ok`,label:t.t(`Stopped`)}:e.state===`running`?{tone:`neutral`,label:t.t(`Stopping…`)}:void 0)}),nB(`session_stop`,(e,t)=>{let n=$(Q(e.args)?.conversationId),r=Q(cB(e.output)),i=hB(e,t),a=r?.status===`running`,o=r?.status===`cancelled`,s=$(r?.note);return pB(e,o?t.t(`Cancel waiting dispatch`):t.t(`Stop session {{title}}`,{title:gB(n,t)}),[...n?[{kind:`session`,id:n,label:gB(n,t)}]:[],...s?[{kind:`note`,text:s}]:[],...i?[{kind:`error`,text:i}]:[]],i?{tone:`error`,label:t.t(`Refused`)}:a?{tone:`queued`,label:t.t(`Still running`)}:o?{tone:`ok`,label:t.t(`Cancelled`)}:{tone:`ok`,label:t.t(`Stopped`)})});function OB(e,t,n){let r=Q(e.args),i=Q(cB(e.output)),a=$(r?.projectId),o=$(r?.title)??(n===`dispatch`?t.lookup?.todoText?.($(r?.todoId)??``):void 0)??$(i?.conversationId)?Pz($(i?.conversationId),$(r?.title)??(n===`dispatch`?t.lookup?.todoText?.($(r?.todoId)??``):void 0)):t.t(`New session`),s=[...a?[{label:t.t(`Project`),value:_B(a,t)}]:[],{label:t.t(`Worktree`),value:r?.worktree===!0?t.t(`Run in a worktree`):t.t(`Run in the project checkout`)},...$(r?.checkout)?[{label:t.t(`Checkout`),value:$(r?.checkout),display:`path`}]:[],...$(r?.baseRef)?[{label:t.t(`Base`),value:$(r?.baseRef)}]:[],...$(r?.branch)?[{label:t.t(`New branch`),value:$(r?.branch)}]:[],...Array.isArray(r?.after)&&r.after.length>0?[{label:t.t(`After`),value:r.after.map(String).join(`, `)}]:[],...$(r?.model)?[{label:t.t(`Model`),value:$(r?.model)}]:[],...$(r?.goal)?[{label:t.t(`Goal`),value:$(r?.goal),display:`long`}]:[]],c=$(r?.prompt),l=hB(e,t),u=DB(i,t),d=[...l?[{kind:`error`,text:l}]:[],...s.length>0?[{kind:`kv`,rows:s}]:[],...c?[{kind:`prompt`,label:t.t(`Dispatch instructions`),text:c}]:[],...u?[u]:[]],f=n===`dispatch`?`Dispatch session {{title}}`:`Create session {{title}}`;return pB(e,t.t(f,{title:o||t.t(`New session`)}),d,l?{tone:`error`,label:t.t(`Refused`)}:i?.status===`waiting`?{tone:`queued`,label:t.t(`Waiting for dependencies`)}:i?.status===`queued`?{tone:`queued`,label:typeof i.position==`number`?t.t(`Queued at #{{n}}`,{n:i.position}):t.t(`Queued`)}:EB(i,t)??(u?{tone:`ok`,label:t.t(`Created the session`)}:void 0))}nB(`session_create`,(e,t)=>OB(e,t,`create`)),nB(`todo_item_dispatch`,(e,t)=>OB(e,t,`dispatch`)),nB(`todo_item_add`,(e,t)=>{let n=Q(e.args),r=Q(cB(e.output)),i=$(r?.text)??$(n?.text)??t.t(`Not set`),a=[...typeof r?.dueAt==`number`||typeof n?.dueAt==`number`?[{label:t.t(`Due time`),value:Fz(Number(r?.dueAt??n?.dueAt))}]:[],...$(n?.projectId)?[{label:t.t(`Project`),value:_B($(n?.projectId),t)}]:[]];return pB(e,t.t(`Add to-do {{text}}`,{text:i}),a.length?[{kind:`kv`,rows:a}]:[])});function kB(e,t){let n=Q(e.args),r=Q(cB(e.output)),i=Q(r?.after),a=Q(r?.before),o=$(n?.todoId)??$(r?.todoId)??``;return $(i?.text)??$(a?.text)??$(n?.text)??(o?t.lookup?.todoText?.(o):void 0)??(o?Nz(o):t.t(`Not set`))}nB(`todo_item_update`,(e,t)=>{let n=Q(e.args),r=Q(cB(e.output)),i=Q(r?.before),a=Q(r?.after),o=[],s=hB(e,t);if(s&&o.push({kind:`error`,text:s}),i&&a){let e=i.done===!0,n=a.done===!0;e!==n&&o.push({kind:`note`,text:n?t.t(`Marked done`):t.t(`Marked not done`)});let r=[];$(i.text)!==$(a.text)&&(i.text!==void 0||a.text!==void 0)&&String(i.text??``)!==String(a.text??``)&&r.push({label:t.t(`To-do text`),before:String(i.text??``),after:String(a.text??``)}),(i.dueAt??null)!==(a.dueAt??null)&&r.push({label:t.t(`Due time`),before:typeof i.dueAt==`number`?Fz(i.dueAt):t.t(`Not set`),after:typeof a.dueAt==`number`?Fz(a.dueAt):t.t(`Not set`)}),String(i.projectId??``)!==String(a.projectId??``)&&r.push({label:t.t(`Project`),before:_B($(i.projectId),t),after:_B($(a.projectId),t)}),r.length>0&&o.push({kind:`diff`,rows:r})}else n?.done===!0?o.push({kind:`note`,text:t.t(`Marked done`)}):n?.done===!1&&o.push({kind:`note`,text:t.t(`Marked not done`)});return pB(e,t.t(`Update to-do {{text}}`,{text:kB(e,t)}),o,s?{tone:`error`,label:t.t(`Refused`)}:void 0)});var AB={todo:`To do`,active:`In progress`,problem:`Problem`,done:`Done`};nB(`todo_list`,(e,t)=>{let n=Q(cB(e.output)),r=(Array.isArray(n?.todos)?n.todos:[]).flatMap(e=>{let n=Q(e);if(!n)return[];let r=$(n.status),i=r?t.t(AB[r]??r):void 0;return[{title:uB(n.text)??t.t(`Not set`),...i?{badge:i}:{}}]}),i=hB(e,t);return pB(e,t.t(`List to-dos`),[...i?[{kind:`error`,text:i}]:[],...r.length>0?[{kind:`list`,items:r}]:[]],i?{tone:`error`,label:t.t(`Refused`)}:void 0)});function jB(e,t){let n=$(e?.cron);if(n)return Vz(n,t.locale);let r=$(e?.at);if(!r)return t.t(`Not set`);let i=Date.parse(r);return t.t(`Once at {{time}}`,{time:Number.isNaN(i)?r:Fz(i)})}nB(`schedule_add`,(e,t)=>{let n=Q(e.args),r=Q(cB(e.output)),i=$(n?.name)??$(r?.name)??t.t(`Not set`),a=$(n?.prompt),o=hB(e,t),s=[...o?[{kind:`error`,text:o}]:[],{kind:`note`,text:jB(n,t)},...typeof r?.nextRunAt==`number`?[{kind:`note`,text:t.t(`Next run {{time}}`,{time:Fz(r.nextRunAt)})}]:[],...a?[{kind:`markdown`,text:a,collapsed:!0}]:[]];return pB(e,t.t(`Add schedule {{name}}`,{name:i}),s,o?{tone:`error`,label:t.t(`Refused`)}:void 0)}),nB(`schedule_remove`,(e,t)=>{let n=Q(e.args),r=Q(cB(e.output)),i=$(n?.scheduleId)??$(r?.scheduleId)??``,a=$(r?.name)??$(n?.name)??(i?Nz(i):t.t(`Not set`)),o=hB(e,t);return pB(e,t.t(`Remove schedule {{name}}`,{name:a}),o?[{kind:`error`,text:o}]:[],o?{tone:`error`,label:t.t(`Refused`)}:void 0)}),nB(`session_list`,(e,t)=>{let n=Q(e.args),r=Q(cB(e.output)),i=$(n?.projectId),a=i?_B(i,t):``,o=(Array.isArray(r?.sessions)?r.sessions:[]).flatMap(e=>{let n=Q(e);if(!n)return[];let r=SB(n.pending),i=xB(n.state,t);return[{title:$(n.title)??gB($(n.conversationId),t),badge:i.badge,badgeTone:i.badgeTone,...r>0?{detail:t.t(`{{count}} pending`,{count:r})}:{},...$(n.conversationId)?{sessionId:$(n.conversationId)}:{}}]});return pB(e,a?t.t(`List sessions in {{project}}`,{project:a}):t.t(`List sessions`),o.length>0?[{kind:`list`,items:o}]:[])}),nB(`session_read`,(e,t)=>{let n=Q(cB(e.output)),r=$(n?.conversationId)??$(Q(e.args)?.conversationId),i=$(n?.title)??gB(r,t),a=hB(e,t);if(typeof n?.index==`number`){let r=uB(n.text)??``,o=[];a&&o.push({kind:`error`,text:a}),r&&o.push({kind:`markdown`,text:r,collapsed:dB(r)});let s=typeof n.nextOffset==`number`?n.nextOffset:void 0;return s!==void 0&&o.push({kind:`note`,text:t.t(`More text from character {{next}}`,{next:s})}),pB(e,t.t(`Read message {{index}} in {{title}}`,{index:String(n.index),title:i}),o,a?{tone:`error`,label:t.t(`Refused`)}:{tone:`neutral`,label:t.t(`Read`)})}let o=xB(n?.state,t),s={tone:o.badgeTone,label:o.badge},c=Q(n?.pending),l=typeof c?.approvals==`number`?c.approvals:0,u=typeof c?.asks==`number`?c.asks:0,d=Array.isArray(n?.messages)?n.messages:[],f=d.flatMap(e=>{let t=Q(e);return t?.truncated===!0&&typeof t.index==`number`?[t.index]:[]}),p=d.flatMap(e=>{let n=Q(e),r=$(n?.text);return!n||!r?[]:[`${n.role===`assistant`?t.t(`Assistant`):t.t(`User`)}: ${wB(r)}`]}).join(`
194
- `),m=[...a?[{kind:`error`,text:a}]:[],...l>0||u>0?[{kind:`kv`,rows:[{label:t.t(`Pending approvals`),value:String(l)},{label:t.t(`Pending questions`),value:String(u)}]}]:[]];return p&&m.push({kind:`markdown`,text:p,collapsed:!0}),f.length>0&&m.push({kind:`note`,text:t.t(`Truncated messages {{indexes}}: read them by index`,{indexes:f.map(e=>`#${e}`).join(`, `)})}),pB(e,t.t(`Read session {{title}}`,{title:i}),m,a?{tone:`error`,label:t.t(`Refused`)}:s)});function MB(e,t){let n=Q(e.git),r=[];return n?(r.push($(n.branch)??t.t(`No local branch`)),r.push(n.dirty===!0?t.t(`Uncommitted changes`):t.t(`Clean tree`))):r.push(t.t(`No local branch`)),r.join(` · `)}nB(`project_list`,(e,t)=>{let n=Array.isArray(Q(cB(e.output))?.projects)?Q(cB(e.output))?.projects:[];return pB(e,t.t(`List projects`),[{kind:`list`,items:n.flatMap(e=>{let n=Q(e);return n?[{title:$(n.name)??_B($(n.projectId),t),detail:MB(n,t)}]:[]})}])}),nB(`project_info`,(e,t)=>{let n=Q(cB(e.output))??{},r=$(n.name)??_B($(n.projectId)??$(Q(e.args)?.projectId),t);return pB(e,t.t(`Project {{name}}`,{name:r}),[{kind:`note`,text:MB(n,t)}])});function NB(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/60);return n>=60?`${Math.floor(n/60)}h ${n%60}m`:n>0?`${n}m ${t%60}s`:`${t}s`}var PB={running:{key:`Running`,tone:`ok`},exited:{key:`Exited`,tone:`neutral`},killed:{key:`Killed`,tone:`error`}};nB(`repo_status`,(e,t)=>{let n=Q(cB(e.output))??{},r=_B($(n.projectId)??$(Q(e.args)?.projectId),t),i=hB(e,t),a=$(n.branch),o=Q(n.head),s=Q(n.changes),c=Q(n.operation),l=Q(n.base),u=Q(n.contains),d=[];i&&d.push({kind:`error`,text:i});let f=typeof s?.total==`number`?s.total:0,p=[{label:t.t(`Branch`),value:a??t.t(`No local branch`)}];if(o){let e=uB(o.subject)??``;p.push({label:t.t(`HEAD`),value:`${$(o.sha)??``} ${e}`.trim()})}p.push({label:t.t(`Working tree`),value:f===0?t.t(`Clean tree`):t.t(`{{count}} changed files`,{count:f})}),l&&p.push({label:t.t(`Against {{ref}}`,{ref:$(l.ref)??``}),value:t.t(`{{ahead}} ahead, {{behind}} behind`,{ahead:typeof l.ahead==`number`?l.ahead:0,behind:typeof l.behind==`number`?l.behind:0})}),u&&p.push({label:t.t(`Contains {{sha}}`,{sha:$(u.sha)??``}),value:u.inHead===!0?t.t(`Yes`):t.t(`No`)});let m=[...c?.merge===!0?[t.t(`Merge`)]:[],...c?.rebase===!0?[t.t(`Rebase`)]:[]];m.length>0&&p.push({label:t.t(`In progress`),value:m.join(` · `)}),d.push({kind:`kv`,rows:p});let h=Array.isArray(n.commits)?n.commits:[];h.length>0&&d.push({kind:`list`,items:h.flatMap(e=>{let t=Q(e),n=$(t?.sha);if(!t||!n)return[];let r=uB(t.subject)??``,i=[uB(t.author)??``,typeof t.at==`number`?Fz(t.at):``].filter(Boolean).join(` · `);return[{title:`${n} ${r}`.trim(),...i?{detail:i}:{}}]})});let g=Array.isArray(s?.files)?s.files:[];g.length>0&&d.push({kind:`list`,items:g.flatMap(e=>{let t=Q(e),n=$(t?.path);return!t||!n?[]:[{title:n,badge:$(t.status)??``}]})});let _=Array.isArray(n.worktrees)?n.worktrees:[];return _.length>1&&d.push({kind:`list`,items:_.flatMap(e=>{let n=Q(e),r=$(n?.path);return!n||!r?[]:[{title:r,detail:[$(n.branch)??t.t(`No local branch`),$(n.head)??``].filter(Boolean).join(` · `)}]})}),pB(e,t.t(`Repository status {{project}}`,{project:r}),d,i?{tone:`error`,label:t.t(`Refused`)}:{tone:`neutral`,label:a??t.t(`No local branch`)})}),nB(`session_tasks`,(e,t)=>{let n=Q(cB(e.output)),r=gB($(n?.conversationId)??$(Q(e.args)?.conversationId),t),i=hB(e,t),a=Array.isArray(n?.tasks)?n.tasks:[],o=a.filter(e=>Q(e)?.state===`running`).length,s=[];return i&&s.push({kind:`error`,text:i}),a.length>0&&s.push({kind:`list`,items:a.flatMap(e=>{let n=Q(e);if(!n)return[];let r=$(n.state)??``,i=PB[r],a=[typeof n.ranMs==`number`?t.t(`ran {{duration}}`,{duration:NB(n.ranMs)}):``,typeof n.exitCode==`number`?t.t(`exit {{code}}`,{code:n.exitCode}):``,n.alive===!1?t.t(`Process gone`):n.stalled===!0?t.t(`Past its deadline`):``,n.persistent===!0?t.t(`Persistent service`):``,$(n.leftover)?t.t(`Leftover`):``].filter(Boolean).join(` · `);return[{title:wB(uB(n.command)??``)||$(n.taskId)||t.t(`Unknown task`),badge:i?t.t(i.key):r,badgeTone:i?.tone??`neutral`,...a?{detail:a}:{}}]})}),pB(e,t.t(`Background tasks in {{title}}`,{title:r}),s,i?{tone:`error`,label:t.t(`Refused`)}:o>0?{tone:`ok`,label:t.t(`{{count}} running`,{count:o})}:{tone:`neutral`,label:t.t(`{{count}} tasks`,{count:a.length})})}),nB(`session_activity`,(e,t)=>{let n=Q(cB(e.output)),r=gB($(n?.conversationId)??$(Q(e.args)?.conversationId),t),i=hB(e,t),a=Array.isArray(n?.calls)?n.calls:[],o=a.filter(e=>{let t=Q(e);return t?.ok===!1&&t.pending!==!0}).length,s=[];return i&&s.push({kind:`error`,text:i}),a.length>0&&s.push({kind:`list`,items:a.flatMap(e=>{let n=Q(e),r=$(n?.name);if(!n||!r)return[];let i=n.pending===!0,a=n.ok===!0,o=[typeof n.durationMs==`number`?NB(n.durationMs):``,typeof n.at==`number`?Fz(n.at):``,wB(uB(n.command)??``)].filter(Boolean);return[{title:oB(r,t),badge:i?t.t(`Running`):a?t.t(`Succeeded`):t.t(`Failed`),badgeTone:i?`pending`:a?`ok`:`error`,...o.length>0?{detail:o.join(` · `)}:{}}]})}),pB(e,t.t(`Recent tool calls in {{title}}`,{title:r}),s,i?{tone:`error`,label:t.t(`Refused`)}:o>0?{tone:`error`,label:t.t(`{{count}} failed`,{count:o})}:{tone:`ok`,label:t.t(`{{count}} calls`,{count:a.length})})});var FB={name:`Name`,avatarColor:`Avatar color`,model:`Model`,autonomy:`Autonomy`,autoApproveProjectIds:`Auto-approved projects`,visibleProjectIds:`Visible projects`,dispatchModel:`Dispatch model`,dispatchWorktree:`Dispatch worktree`,maxRunningDispatches:`Dispatch limit`,addressAs:`What to call you`,replyLanguage:`Reply language`,style:`Communication style`,notify:`System notifications`,dailyBriefAt:`Daily brief time`,persona:`Persona`};nB(`secretary_profile_propose`,(e,t)=>{let n=Q(cB(e.output)),r=(Array.isArray(n?.changes)?n.changes:[]).flatMap(e=>{let n=Q(e),r=$(n?.field);return!n||!r?[]:[{label:t.t(FB[r]??r),before:vB(n.before,t),after:vB(n.after,t)}]}),i=hB(e,t);return pB(e,t.t(`Propose profile changes`),[...i?[{kind:`error`,text:i}]:[],...r.length>0?[{kind:`diff`,rows:r}]:[]],i?{tone:`error`,label:t.t(`Refused`)}:EB(n,t))});function IB(e,t,n){let r=Q(e.args),i=Q(cB(e.output)),a=$(r?.name)??t.t(`Not set`),o=$(r?.description),s=$(r?.body)??$(r?.code),c=hB(e,t);return pB(e,t.t(n,{name:a}),[...c?[{kind:`error`,text:c}]:[],...o?[{kind:`note`,text:o}]:[],...s?[{kind:`markdown`,text:s,collapsed:!0}]:[]],c?{tone:`error`,label:t.t(`Refused`)}:EB(i,t))}nB(`skill_propose`,(e,t)=>IB(e,t,`Propose skill {{name}}`)),nB(`tool_propose`,(e,t)=>IB(e,t,`Propose tool {{name}}`)),nB(`session_takeover_propose`,(e,t)=>{let n=Q(e.args),r=$(n?.conversationId),i=$(n?.reason),a=Q(cB(e.output)),o=hB(e,t);return pB(e,t.t(`Ask to take over {{title}}`,{title:gB(r,t)}),[...o?[{kind:`error`,text:o}]:[],...i?[{kind:`note`,text:i}]:[]],o?{tone:`error`,label:t.t(`Refused`)}:EB(a,t))});function LB(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}var RB={branch:`Branch`,worktree:`Worktree`,session:`Session`};function zB(e){return e.split(/[\\/]/u).filter(Boolean).at(-1)??e}var BB={"not-merged":`Not merged yet`,"current-branch":`Currently checked out`,"used-by-worktree":`Used by a worktree`,"detached-head":`Detached HEAD`,"uncommitted-changes":`Has uncommitted changes`};function VB(e,t){let n=$(e.kind)??``,r=$(e.blocked),i=Array.isArray(e.mergedInto)?e.mergedInto.filter(e=>typeof e==`string`):[],a=typeof e.sizeBytes==`number`?e.sizeBytes:null,o=[];return i.length>0&&o.push(t.t(`merged into {{refs}}`,{refs:i.join(`, `)})),a!==null&&o.push(LB(a)),r&&o.push(t.t(BB[r]??r)),{title:$(e.name)??t.t(`Not set`),badge:t.t(RB[n]??n),badgeTone:r?`error`:`ok`,...o.length>0?{detail:o.join(` · `)}:{}}}nB(`image_view`,(e,t)=>{let n=Q(e.args),r=hB(e,t),i=r?null:Xz(e.output),a=i?.path??$(n?.path)??``,{width:o,height:s,size:c}=i??{width:null,height:null,size:null},l=a?zB(a):t.t(`Not set`),u=[];r?u.push({kind:`error`,text:r}):(e.image||i?.path)&&u.push({kind:`image`,...e.image?{image:e.image}:{},...i?.path?{path:i.path}:{},alt:l});let d=[];return i?.path&&d.push({label:t.t(`Path`),value:i.path}),o&&s&&d.push({label:t.t(`Dimensions`),value:`${o} × ${s}`}),c!==null&&d.push({label:t.t(`File size`),value:LB(c)}),d.length>0&&u.push({kind:`kv`,rows:d}),pB(e,t.t(`Look at {{name}}`,{name:l}),u,r?{tone:`error`,label:t.t(`Refused`)}:void 0)}),nB(`cleanup_list`,(e,t)=>{let n=Q(lB(e.output)),r=Array.isArray(n?.items)?n.items.map(Q).filter(e=>e!==null):[],i=typeof n?.total==`number`?n.total:r.length,a=hB(e,t);return pB(e,t.t(`Cleanup candidates · {{count}}`,{count:i}),[...a?[{kind:`error`,text:a}]:[],...r.length>0?[{kind:`list`,items:r.map(e=>VB(e,t))}]:[]],a?{tone:`error`,label:t.t(`Refused`)}:void 0)}),nB(`cleanup_apply`,(e,t)=>{let n=Q(e.args),r=Q(lB(e.output)),i=Array.isArray(n?.ids)?n.ids.length:0,a=typeof r?.total==`number`?r.total:i,o=hB(e,t);return pB(e,t.t(`Clean up {{count}} items`,{count:a}),o?[{kind:`error`,text:o}]:[],o?{tone:`error`,label:t.t(`Refused`)}:EB(r,t))}),nB(`memory_search`,(e,t)=>{let n=$(Q(e.args)?.query)??``,r=Gz(e.output)??[];return pB(e,t.t(`Search memory {{query}} · {{count}}`,{query:n,count:r.length}),[{kind:`list`,items:r.map(e=>({title:e.title||Nz(e.id)}))}])}),nB(`memory_capture`,(e,t)=>{let n=Kz(e.output,$(Q(e.args)?.content));return n?n.written?pB(e,t.t(`Save memory {{title}}`,{title:n.memory.title}),[{kind:`note`,text:wB(n.memory.content)}]):pB(e,t.t(`Memory not written`),[{kind:`list`,items:n.candidates.map(e=>({title:e.title,detail:wB(e.content)}))}]):UB(e,t)}),nB(`memory_delete`,(e,t)=>{let n=Q(cB(e.output)),r=$(n?.id)??$(Q(e.args)?.id)??``,i=$(n?.title)??(r?Nz(r):t.t(`Not set`)),a=$(n?.content),o=hB(e,t);return pB(e,t.t(`Delete memory {{title}}`,{title:i}),[...o?[{kind:`error`,text:o}]:[],...a?[{kind:`note`,text:wB(a)}]:[]],o?{tone:`error`,label:t.t(`Refused`)}:void 0)});function HB(e){if(!e)return[];let t=[];for(let n of e.matchAll(/^\d+\.\s+\[([^\]]+)\]\((https?:\/\/[^)]+)\)/gmu))t.push({title:n[1],url:n[2]});return t}nB(`web_search`,(e,t)=>{let n=$(Q(e.args)?.query)??``,r=HB(e.output);return pB(e,t.t(`Web search {{query}}`,{query:n}),[{kind:`list`,items:r.map(e=>({title:e.title,detail:e.url}))}])}),nB(`web_fetch`,(e,t)=>{let n=e.output??``,r=$(Q(e.args)?.url),i=/^Fetched (\S+)/u.exec(n)?.[1],a=r??i??``,o=a;try{o=new URL(a).host}catch{o=a||t.t(`Not set`)}let s=/^Title: (.+)$/mu.exec(n)?.[1]?.trim();return pB(e,t.t(`Fetch {{domain}}`,{domain:o}),s?[{kind:`note`,text:s}]:[])});function UB(e,t){let n=Q(e.args),r=cB(e.output),i=[],a=hB(e,t);return a&&i.push({kind:`error`,text:a}),n&&Object.keys(n).length>0&&i.push({kind:`kv`,rows:yB(n,t)}),sB(r)?i.push({kind:`kv`,rows:yB(r,t)}):typeof e.output==`string`&&e.output.trim()&&!a&&i.push({kind:`note`,text:e.output.trim(),collapsed:dB(e.output)}),pB(e,oB(e.name,t),i,a?{tone:`error`,label:t.t(`Refused`)}:void 0)}function WB(e){return e.some(e=>e===`error`)?`error`:e.some(e=>e===`running`||e===`reviewing`)?`running`:`ok`}function GB(e,t){let n=new Set([t]),r=e[t]?.forkedFromConversationId;for(;r&&!n.has(r);)n.add(r),r=e[r]?.forkedFromConversationId;return n.size}function KB(e){return!e.started&&!e.spawning&&!e.parentId&&!!e.sessionFile&&!e.historyOnly&&!e.worktreeMissing&&!e.workspaceMigrating&&e.status!==`running`}function qB(e,t){return t&&!t.canRewind||!e||e.historyOnly||e.worktreeMissing||e.workspaceMigrating||e.spawning||e.status===`running`||e.rewinding||e.restoringFiles?!1:e.started?!0:KB(e)}function JB(e,t,n=1){return t&&(!t.canRewind||t.canFork===!1)||n>=3||!e||e.parentId||e.historyOnly||e.status!==`idle`?!1:e.started?!e.spawning:KB(e)}function YB(e,t){let n=typeof t==`string`?e.messages.findIndex(e=>e.entryId===t):$B(e.messages,t);if(n===null||n<0)return null;let r=e.messages[n];return r?.role!==`user`||r.optimistic||!r.entryId?.trim()?null:{entryId:r.entryId,userIndexFromEnd:e.messages.slice(n+1).filter(e=>e.role===`user`).length}}function XB(e,t,n,r,i){if(!n||t!==e)return null;let a=i??ZB(n,r);if(a===null)return null;let o=YB(n,a);return o?{conversationId:e,...o}:null}function ZB(e,t){if(!Number.isInteger(t)||t<0)return null;let n=t-(e.historyBaseIndex??0);return n<0||e.messages[n]?.role!==`user`?null:e.messages.slice(n+1).filter(e=>e.role===`user`).length}function QB(e){return e.optimistic?!1:e.role===`user`||e.role===`custom`&&!!e.pluginSource}function $B(e,t){if(!Number.isInteger(t)||t<0)return null;let n=[];for(let t=0;t<e.length;t++)e[t]?.role===`user`&&n.push(t);let r=n[n.length-1-t];return r===void 0?null:r}function eV(e){let t=(e,t)=>`${e}:\n${t.length>0?t.map(e=>`- ${e}`).join(`
195
- `):`(none)`}`;return[`Patch ${e.status}.`,t(`Applied`,e.applied),t(`Failed paths`,e.failed),...e.error?[`Error: ${e.error}`]:[],t(`Unattempted`,e.unattempted),t(`Uncertain`,e.uncertain),...e.status===`success`?[]:[`Re-read failed or uncertain paths before retrying.`],...e.input?[`Input:\n${e.input}`]:[]].join(`
196
- `)}function tV(e,t){return!t&&e.kind===`tool`&&e.name===`apply_patch`&&!!e.fileChanges?.length}function nV(e,t,n){return e===null?n&&t:e}function rV(e){return e.kind===`tool`&&e.name===`apply_patch`&&!!e.fileChanges?.length&&!!e.output}var iV=[`path`,`file_path`,`command`,`pattern`,`query`,`url`,`description`,`summary`,`reason`,`goal`],aV=new Set([`path`,`file_path`]),oV=/^\[(.+)#([0-9A-Fa-f]{4})\]$/,sV=/^\*\*\* (?:(?:Add|Delete|Update) File|Move to): (.+)$/;function cV(e){let t=e.replaceAll(`\\`,`/`),n=/^[A-Za-z]:(\/.*)?$/.exec(t);return n?n[1]&&n[1].length>0?n[1]:`/`:t}function lV(e,t){if(!t)return e;let n=cV(t).replace(/\/+$/,``),r=cV(e);if(!n)return r;if(r===n)return`.`;let i=n.endsWith(`/`)?n:`${n}/`;return r.startsWith(i)?r.slice(i.length):r===e?e:r}var uV=new Set(P);function dV(e){return e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}function fV(e,t){if(!e||typeof e!=`object`)return null;let n=e,r=``;for(let e of[`path`,`file_path`]){let t=n[e];if(typeof t==`string`&&t){r=t;break}}if(!r||!uV.has(Pe(r))||r.startsWith(`\\\\`)||r.startsWith(`//`))return null;if(dV(r))return r;if(!t)return null;let i=t.includes(`\\`)&&!t.includes(`/`)?`\\`:`/`;return`${t.replace(/[\\/]+$/,``)}${i}${r.replace(/^[\\/]+/,``)}`}function pV(e){if(typeof e==`string`)for(let t of e.split(`
197
- `)){let e=t.trim();if(e)return oV.exec(e)?.[1]}}function mV(e){if(!e||typeof e!=`object`)return null;let t=e.input;if(typeof t!=`string`)return null;let n=new Set;for(let e of t.split(`
198
- `)){let t=sV.exec(e.trim())?.[1];t&&n.add(t)}return[...n]}function hV(e,t){if(!e||typeof e!=`object`)return``;let n=e;for(let e of iV){let r=n[e];if(typeof r==`string`&&r)return aV.has(e)?lV(r,t):r}let r=pV(n.input);if(r)return lV(r,t);let i=JSON.stringify(n);return i===`{}`?``:i.slice(0,80)}function gV(e,t,n,r=!1,i=!1){return e?t?`loading`:n&&i?`more`:n===!1&&r?`start`:`none`:`none`}function _V(e,t,n,r,i=80){return e&&!t&&n<=r+i}function vV(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=[t.code,t.command].find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n:null}function yV(e){let t=e.split(`
199
- `).map(e=>e.trim()).find(Boolean)??``;return t.length>72?`${t.slice(0,72)}…`:t}function bV(e){let t=new Map;for(let n of e)t.set(n.name,(t.get(n.name)??0)+1);return[...t].map(([e,t])=>`${e} ×${t}`).join(` `)}var xV=e=>e===`exec`||e===`codemode`,SV=/^Script (?:completed|failed)\nWall time [^\n]*\nOutput:\n/;function CV(e){return e===null?null:e.replace(SV,``)||null}var wV=/(?:^|\n)<console_output>\n([\s\S]*?)\n<\/console_output>(?:\n|$)/;function TV(e){let t=wV.exec(e);return t?{body:[e.slice(0,t.index),e.slice(t.index+t[0].length)].filter(Boolean).join(`
200
- `),console:t[1]}:{body:e}}function EV(e,t,n){let{body:r,console:i}=TV(e??``),a=i===void 0?{}:{console:i};return t?{status:`failed`,error:r,...a,calls:[...n??[]]}:{status:`completed`,value:r,...a,calls:[...n??[]]}}function DV(e){if(!e?.trim())return null;try{let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(n.status!==`completed`&&n.status!==`failed`)return null;let r=Array.isArray(n.calls)?n.calls.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e;return typeof t.name!=`string`||!t.name?[]:[{name:t.name,ok:t.ok===!0,...typeof t.error==`string`?{error:t.error}:{},...typeof t.summary==`string`?{summary:t.summary}:{}}]}):[];return{status:n.status,...n.status===`failed`&&typeof n.error==`string`?{error:n.error}:{},...n.status===`completed`?{value:n.value}:{},calls:r}}catch{return null}}function OV(e,t){if(e!==`submit_plan`||!t||typeof t!=`object`)return null;let{title:n,plan:r}=t;return typeof n==`string`&&typeof r==`string`&&r.trim()?{title:n.trim(),text:r.trim()}:null}function kV(e,t){if(e!==`write`||!t||typeof t!=`object`)return null;let n=t.content;return typeof n==`string`&&n?n:null}var AV=new Map([[`message_main_agent`,e=>[e.message]],[`message_coworker`,e=>[e.text,e.to]],[`subagent`,(e,t)=>e.operation===`send`?[e.message,t.get(String(e.agentId))]:e.operation===`message`?[e.text,t.get(String(e.to))]:[]]]),jV=/(?:^|\n)\((?:delivered to |the main agent is blocked waiting )[^\n]*\)\s*$/,MV=new Set([`agentId`,`runId`,`delivery`,`status`]);function NV(e,t,n){let r=AV.get(e);if(!r||!t||typeof t!=`object`)return null;let[i,a]=r(t,n);if(typeof i!=`string`||!i.trim())return null;let o=i.trim();return{text:o,summary:typeof a==`string`&&a.trim()?`${a.trim()} · ${o}`:o}}function PV(e,t){if(e!==`subagent`||!t||typeof t!=`object`)return null;let{operation:n,prompt:r}=t;return n===`spawn`&&typeof r==`string`&&r.trim()?r.trim():null}function FV(e){if(!e)return null;let t=e.startsWith(`{`)?0:e.lastIndexOf(`
201
- {`)+1;try{let n=JSON.parse(e.slice(t));return n&&typeof n==`object`&&!Array.isArray(n)?{head:e.slice(0,t).trimEnd(),value:n}:null}catch{return null}}function IV(e){let t=FV(e);return(t&&Object.keys(t.value).every(e=>MV.has(e))?t.head:e?.replace(jV,``))?.trimEnd()||null}var LV=new Set([`spawn`,`send`,`message`,`resume`]);function RV(e,t,n,r){if(!n||typeof n!=`object`)return;let{operation:i,name:a,description:o}=n;if(!LV.has(i))return;let{agentId:s,runId:c}=FV(r)?.value??{};if(typeof s!=`string`||(typeof c==`string`&&t.set(c,s),i!==`spawn`))return;let l=[a,o].find(e=>typeof e==`string`&&e.trim());typeof l==`string`&&e.set(s,l.trim())}var zV=new Set([`report`,`wait`,`stop`,`dismiss`,`list`,`resume`]);function BV(e,t){if(!t||typeof t!=`object`)return null;let n=t;return e===`task_output`?typeof n.timeout_ms==`number`&&n.timeout_ms>0?`task`:null:e===`subagent`&&(n.operation===`wait`||(n.operation===`spawn`||n.operation===`send`)&&n.wait===!0)?`subagent`:null}function VV(e,t,n){if(!e||typeof e!=`object`)return null;let{operation:r,name:i,description:a,agentId:o,runId:s,runIds:c}=e;if(r===`spawn`){if(typeof i!=`string`||!i.trim())return null;let e=[i,a].flatMap(e=>typeof e==`string`&&e.trim()?[e.trim()]:[]);return{title:[...new Set(e)].join(` · `)}}if(!zV.has(r))return null;if(r===`list`)return t.size>0?{op:`list`,title:``,titles:Object.fromEntries(t)}:{op:`list`,title:``};let l=r===`dismiss`||r===`resume`?[o]:[s,...Array.isArray(c)?c:[]].map(e=>typeof e==`string`?n.get(e):void 0),u={};for(let e of l){if(typeof e!=`string`)continue;let n=t.get(e);n&&(u[e]=n)}let d=[...new Set(Object.values(u))].join(`, `);return r===`wait`&&d?{op:`wait`,title:d,titles:u}:{op:r,title:d}}function HV(e,t){if(e!==`memory_capture`||!t||typeof t!=`object`)return null;let{title:n,content:r}=t;if(typeof r!=`string`||!r.trim())return null;let i=r.trim();return{title:(typeof n==`string`?n.trim():``)||i.split(`
202
- `,1)[0].trim(),content:i}}var UV=/^\s*<(system-reminder|background-task-update)>[\s\S]*?<\/\1>/,WV=/ \(auto-selected: no response in time\)$/;function GV(e,t,n,r){if(e!==`ask_user`||!t||typeof t!=`object`)return null;let{question:i,options:a}=t;if(typeof i!=`string`||!i.trim())return null;let o=Array.isArray(a)?a.slice(0,4).flatMap(e=>typeof e==`string`&&e.trim()?[e.trim()]:[]):[],s={question:i.trim(),options:o,answer:null,autoSelected:!1};if(!r||!n)return{ask:s,output:n};let c=n,l=[];for(let e=UV.exec(c);e;e=UV.exec(c))l.push(e[0].trim()),c=c.slice(e[0].length);let u=c.trim(),d=u.replace(WV,``);return{ask:{...s,answer:d||null,autoSelected:d!==u},output:l.join(`
203
-
204
- `)||null}}function KV(e,t){if(e!==`edit`||!t||typeof t!=`object`)return null;let n=t;if(!(`edits`in n)&&typeof n.oldText==`string`&&typeof n.newText==`string`)return YV(n,n.oldText,n.newText);let r=n.edits;if(typeof r==`string`)try{r=JSON.parse(r)}catch{return null}return!Array.isArray(r)||r.length===0?null:r.every(e=>e&&typeof e==`object`&&typeof e.oldText==`string`&&typeof e.newText==`string`)?r:null}function qV(e,t){return e!==`edit`||!t||typeof t.oldText!=`string`||typeof t.newText!=`string`?null:YV(t,t.oldText,t.newText)}var JV=new WeakMap;function YV(e,t,n){let r=JV.get(e);return r||(r=[{oldText:t,newText:n}],JV.set(e,r)),r}var XV=e=>e.content.map(e=>e.type===`text`?e.text:``).join(``),ZV=/(?:^|\n)<source_reference type="(?:file|web)" (?:path|url)="[^"\n]*" \/>(?:\n<source_reference type="(?:file|web)" (?:path|url)="[^"\n]*" \/>)*$/,QV=e=>e.content.map(e=>e.type===`text`?e.text.replace(ZV,``):``).join(``);function $V(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`text`&&n.text.trim()||n.type===`thinking`&&n.text||n.type===`toolCall`||n.type===`image`)return t}return-1}function eH(e){let t=e.timing;if(t?.completedMs)return typeof e.duration==`number`&&e.duration>0?e.duration:Math.max(0,t.completedMs-t.stepStartMs)}function tH(e,t){let n=e.timing,r=eH(e);if(!n||r===void 0)return;let{stepStartMs:i,firstTokenMs:a}=n,o=e.usage?.output??0,s=typeof e.ttft==`number`&&e.ttft>0?e.ttft:a===void 0?void 0:Math.max(0,a-i);return{runMs:r,...t===void 0?{}:{turnMs:t},...s===void 0?{}:{ttftMs:s},...o>0&&r>0?{tps:o/(r/1e3)}:{}}}var nH=`<thinking>`,rH=`</thinking>`;function iH(e){let t=[],n=(e,n)=>{let r=n.trim();r&&t.push({kind:e,text:r})},r=0;for(;r<e.length;){let t=e.indexOf(nH,r);if(t===-1){n(`text`,e.slice(r));break}t>r&&n(`text`,e.slice(r,t));let i=t+10,a=e.indexOf(rH,i);if(a===-1){n(`thinking`,e.slice(i));break}n(`thinking`,e.slice(i,a)),r=a+11}return t}function aH(e){let t=new Set;for(let n of e??[])if(n.phase===`reviewing`&&n.toolCallId){t.add(n.toolCallId);let e=Ts(n.toolCallId);e&&t.add(e)}return t}function oH(e,t){return(t??[]).filter(t=>t.toolCallId&&Ts(t.toolCallId)===e).length}function sH(e,t,n,r,i,a,o=0,s,c=!1,l){let u=aH(i),d=new Map;for(let t of e)t.role===`toolResult`&&t.toolCallId&&d.set(t.toolCallId,{output:QV(t),isError:t.isError===!0,todos:t.todos??null,durationMs:t.toolDurationMs??null,agentMeta:t.subagentMeta??null,editDiff:t.editDiff??null,fileChanges:t.fileChanges??null,applyPatchOutcome:t.applyPatchOutcome??null,codemodeCalls:t.codemodeCalls??null,rtk:t.rtk,approvalReview:t.approvalReview,backgroundTaskId:t.backgroundTaskId,shellFailure:t.shellFailure,dcgWarning:t.dcgWarning,pluginArtifacts:t.pluginArtifacts,generatedImages:t.generatedImages,image:Jz(t.content)});let f=-1;for(let t=e.length-1;t>=0;t--)if(!e[t].optimistic&&e[t].role!==`toolResult`){f=t;break}let p=[],m=new Map,h=new Map,g=Array(e.length);for(let t=e.length-1,n;t>=0;t--)g[t]=n,QB(e[t])?n=`user`:e[t].role===`assistant`&&!e[t].optimistic&&(n=`assistant`);let _=e.findLastIndex(e=>e.role===`user`&&!e.optimistic),v=e.findLastIndex(e=>!e.optimistic),y=0,x=0,S=!1,C,w=!1,T;return e.forEach((E,D)=>{let O=D===v,k=o+D;if(E.role===`user`&&E.optimistic){p.push({kind:`user`,key:`${k}`,text:XV(E),images:E.content.filter(e=>e.type===`image`),timestamp:E.timestamp,canCollapse:!1,deliveryState:E.deliveryRejected?E.rejectedReason===`turn-stuck`?`stuck`:`rejected`:`pending`});return}if(E.role===`user`){C=E.timestamp,w=!1,y=0,x=0,S=!1;let n=XV(E),r=E.content.filter(e=>e.type===`image`),i=/^<background-task-update>\n?([\s\S]*?)\n?<\/background-task-update>\s*$/.exec(n.trim());if(i&&r.length===0){let e=i[1].trim();p.push({kind:`task-note`,key:`${k}`,summary:e.split(`
205
- `,1)[0]??e,detail:e}),T=void 0;return}if(n||r.length>0){let i=D+1;for(;e[i]?.role===`system`||e[i]?.optimistic;)i++;let a=i<e.length&&!QB(e[i])&&!(t&&D===_),o={kind:`user`,key:`${k}`,text:n,images:r,timestamp:E.timestamp,canCollapse:a};p.push(o),T=o}return}if(E.role===`custom`){E.pluginSource&&(C=E.timestamp,w=!1,y=0,x=0,S=!1,T=void 0,p.push({kind:`plugin-message`,key:`${k}`,text:Tz(XV(E)),...E.pluginSource}));return}if(E.role===`compactionSummary`){p.push({kind:`compaction`,key:`${k}`,summary:XV(E),tokensBefore:E.tokensBefore??null,...E.verified?{verified:!0}:{},...E.memory?{memory:!0}:{}});return}if(E.role===`toolResult`){E.toolName===`ask_user`&&(w=!0),x>0&&E.toolName!==`ask_user`&&typeof E.toolDurationMs==`number`&&Number.isFinite(E.toolDurationMs)&&E.toolDurationMs>0&&(y+=E.toolDurationMs);return}if(E.role!==`assistant`)return;x+=1,T&&E.model&&(x===1||S)&&(T.replyModel=E.model,S=E.stopReason===`error`),x===1&&T&&E.timestamp!==void 0&&(T.replyAt=E.timestamp),T&&E.privacyMask&&(T.replyPrivacyMask=b(T.replyPrivacyMask,E.privacyMask));let A=eH(E);A!==void 0&&(y+=A);let j=g[D]===void 0||g[D]===`user`,M=j&&x>1?y:void 0,N=!(g[D]===void 0&&(t||E.stopReason===`pending`)),P;if(j&&N){if(y>0)P=y;else if(!w){let e=E.timing?.completedMs??E.timestamp;typeof C==`number`&&typeof e==`number`&&e>C&&(P=e-C)}T&&P!==void 0&&(T.turnDurationMs=P)}if(E.restartResumed){p.push(cH(E,k,n));return}let F=$V(E.content);if(E.content.forEach((e,o)=>{let l=`${k}-${o}`,g=O&&o===F,_=!!E.stopReason&&E.stopReason!==`pending`,v=t&&g&&!_;switch(e.type){case`text`:{if(!e.text.trim())return;let t=iH(e.text);if(t.length===0)return;if(t.length===1&&t[0].kind===`text`){let t=j&&!v;p.push({kind:`text`,key:l,text:e.text,streaming:v,timestamp:E.timestamp,perf:tH(E,M),...t?{turnEnd:!0,...P===void 0?{}:{turnDurationMs:P}}:{}});return}t.forEach((e,n)=>{let r=t.length===1?l:`${l}-${n}`,i=v&&n===t.length-1;if(e.kind===`thinking`){p.push({kind:`thinking`,key:r,text:e.text,streaming:i,durationMs:null});return}let a=j&&!i&&n===t.length-1;p.push({kind:`text`,key:r,text:e.text,streaming:i,timestamp:E.timestamp,perf:tH(E,M),...a?{turnEnd:!0,...P===void 0?{}:{turnDurationMs:P}}:{}})});return}case`thinking`:if(e.text){let t=E.timing,n=t?.thinkingEndMs??t?.completedMs;p.push({kind:`thinking`,key:l,text:e.text,streaming:v,durationMs:t&&n!==void 0?Math.max(0,n-t.stepStartMs):null,...t?{startedAt:t.stepStartMs}:{}})}return;case`toolCall`:{let o=d.get(e.id),g=r?.[e.id],_=xV(e.name),v=_?vV(e.arguments):null,y=o?o.applyPatchOutcome?eV(o.applyPatchOutcome):o.output:(g??null)||null,b=e.name===`codemode`?CV(y):y,x=e.name===`exec`?DV(b):e.name===`codemode`&&o?EV(b,o.isError,o.codemodeCalls):null,S=kz(e.name,e.arguments);e.name===`subagent`&&RV(m,h,e.arguments,o?.output);let C=e.name===`subagent`?VV(e.arguments,m,h):null,w=NV(e.name,e.arguments,m),T=w?.text??PV(e.name,e.arguments),E=HV(e.name,e.arguments),O=GV(e.name,e.arguments,b,!!(o&&!o.isError)),k=e.name===`apply_patch`?o?.fileChanges?.length?o.fileChanges.map(e=>e.path):mV(e.arguments):null,A=!o&&t&&D===f,j=A&&(e.name===`bash`||e.name===`powershell`),M=A?BV(e.name,e.arguments):null,N=e.name===`read`&&!o?.isError?fV(e.arguments,n):null;p.push({kind:`tool`,key:l,name:S.name,...eB(S.name,c)?{args:S.args??null}:{},summary:v?yV(v):k?k.length>1?`${k.length} files`:lV(k[0]??``,n):w?.summary??E?.title??O?.ask.question??C?.title??S.summary??hV(S.args,n),source:v,output:w?IV(b):O?O.output:b,nestedPending:oH(e.id,i)||void 0,...N?{imagePath:N}:{},...e.name===`image_view`&&o?.image&&!o.isError?{image:o.image}:{},...o?.generatedImages?.length?{generatedImages:o.generatedImages}:{},..._?{sandbox:x}:{},state:o?o.isError||x?.status===`failed`?`error`:`ok`:t&&D===f?u.has(e.id)?`reviewing`:`running`:t?`ok`:`error`,edits:o?.isError?null:KV(e.name,e.arguments)??qV(e.name,o?.editDiff),writeContent:kV(e.name,e.arguments),fileChanges:o?.fileChanges??null,todos:o?.todos??null,durationMs:o?.durationMs??null,agentMeta:o?.agentMeta??null,...o?.rtk?{rtk:o.rtk}:{},...o?.approvalReview?{approvalReview:o.approvalReview}:{},...j||M?{callId:e.id}:{},...M?{waiting:M}:{},...o?.backgroundTaskId?{backgroundTaskId:o.backgroundTaskId}:{},...o?.shellFailure?{shellFailure:o.shellFailure}:{},...o?.dcgWarning?{dcgWarning:o.dcgWarning}:{},...e.name===`submit_plan`?{plan:OV(e.name,e.arguments)}:{},...T?{sentMessage:T}:{},...E?{memoryContent:E.content}:{},...O?{ask:O.ask}:{},...C?.op?{subagentOp:C.op}:{},...C?.titles?{subagentTitles:C.titles}:{},...o?.pluginArtifacts?{pluginArtifacts:o.pluginArtifacts}:{},...s?.has(e.id)?{batchLabel:s.get(e.id)}:{},...o||!a?{}:{startedAt:a[e.id]??null}});return}default:return}}),E.errorMessage){let n=D+1;for(;e[n]?.role===`system`;)n++;let r=e[n]?.role===`assistant`,i=t&&D===e.length-1,a=l!==void 0&&E.errorMessage===l;!r&&!i&&!a&&p.push({kind:`error`,key:`${k}-err`,text:E.errorMessage})}}),p}function cH(e,t,n){let r=t=>e.content.flatMap(e=>e.type===t&&e.text.trim()?[e.text.trim()]:[]).join(`
206
-
207
- `);return{kind:`resumed-reply`,key:`${t}-resumed`,thinking:r(`thinking`),text:r(`text`),tools:e.content.flatMap(e=>e.type===`toolCall`?[{name:e.name,summary:hV(e.arguments,n)}]:[]),expanded:!1}}var lH=e=>e.kind===`capability-receipt`?e.receipt.occurredAt:e.at,uH=`<${wk}>`;function dH(e){return e.content.map(e=>e.type===`text`?e.text:``).join(`
208
- `).trim()}function fH(e){if(!e.includes(uH))return!1;if(jk(e))return!0;let t=Ik(e);return!!(t&&jk(t.rest))}function pH(e,t,n){let r=new Set,i=t.filter(e=>e.kind===`task-wrap-up-nudge`).map(e=>e.at).sort((e,t)=>e-t);if(i.length===0)return r;let a=0,o=!1;return e.forEach((e,t)=>{if(e.optimistic)return;let s=e.timestamp??-1/0;for(;a<i.length&&(i[a]??0)<=s;)o=!0,a+=1;if(!o||e.role!==`user`&&e.role!==`toolResult`)return;let c=dH(e);if(e.role===`toolResult`){c.includes(uH)&&(o=!1);return}fH(c)&&(r.add(n+t),o=!1)}),r}var mH=e=>{let t=e.key.indexOf(`-`),n=Number.parseInt(t===-1?e.key:e.key.slice(0,t),10);return Number.isInteger(n)?n:-1},hH=(e,t,n=0)=>{let r=mH(e)-n;return r>=0?t[r]?.timestamp??-1/0:-1/0};function gH(e,t){let n=e.findLast(e=>e.kind===`compaction`);if(!n||t<=mH(n))return e;let r=e.length;for(let n=0;n<e.length;n++)if(mH(e[n])>=t){r=n;break}if(r===e.length&&mH(e.at(-1)??e[0])+1<t||e[r-1]?.kind===`compaction`)return e;let i={kind:`compaction-notice`,key:`compaction-notice:${n.key}`,summary:n.summary,tokensBefore:n.tokensBefore,...n.tokensAfter===void 0?{}:{tokensAfter:n.tokensAfter},...n.verified?{verified:!0}:{},...n.memory?{memory:!0}:{}};return[...e.slice(0,r),i,...e.slice(r)]}function _H(e,t){if(t===void 0)return e;let n=e.findLastIndex(e=>e.kind===`compaction`),r=e[n];if(r?.kind!==`compaction`)return e;let i=[...e];return i[n]={...r,tokensAfter:t},i}function vH(e,t,n,r){let i=_H(e,r),a=n===void 0?i:gH(i,n);return t?[...a,{kind:`compaction-progress`,key:`compaction:${t}`,state:t}]:a}function yH(e,t,n=[],r,i){let a=i?.historyBaseIndex??0,o=new Map,s=[];for(let e of n)e.kind===`tool-batch-label`?o.set(e.callId,e.label):s.push(e);let c=sH(e,t,r,i?.toolOutputs,i?.pendingApprovals,i?.toolStartedAt,a,o,i?.secretarySession===!0,i?.interrupted?.suppressedError),l=pH(e,s,a),u=l.size===0?c:c.map(e=>e.kind===`user`&&!e.deliveryState&&l.has(mH(e))?{...e,hostTaskWrapUp:!0}:e),d=s.length===0?u:[...u.map((t,n)=>({item:t,at:hH(t,e,a),order:n})),...s.map((e,t)=>({item:{kind:`session-custom`,key:e.kind===`capability-receipt`?`custom:receipt:${e.receipt.receiptId}`:e.kind===`oauth-account-selected`?`custom:${e.kind}:${e.accountKey}:${e.at}:${t}`:e.kind===`task-wrap-up-nudge`?`custom:${e.kind}:${e.at}:${t}`:`custom:${e.kind}:${e.child.generation}:${e.at}:${t}`,entry:e},at:lH(e),order:u.length+t}))].sort((e,t)=>e.at-t.at||e.order-t.order).map(({item:e})=>e),f=u.filter(e=>e.kind===`user`&&e.deliveryState),p=f.length?d.filter(e=>!(e.kind===`user`&&e.deliveryState)):d;for(let e of f){let t=e.kind===`user`?e.timestamp:void 0,n=t!==void 0&&Number.isFinite(t)?p.findIndex(e=>e.kind===`user`&&!e.deliveryState&&e.timestamp!==void 0&&Number.isFinite(e.timestamp)&&e.timestamp>t):-1;p.splice(n<0?p.length:n,0,e)}let m=vH(i?.runDividers?.length?xH(p,i.runDividers,t=>t.kind===`session-custom`?lH(t.entry):hH(t,e,a),a===0):p,i?.compaction,i?.compactionNoticeAt,i?.compactionTokensAfter);return i?.interrupted?[...m,{kind:`interrupted`,key:`interrupted`,at:i.interrupted.at,exitKind:i.interrupted.kind,unfinishedTools:i.interrupted.unfinishedTools}]:m}var bH=1e4;function xH(e,t,n,r){let i=[...e],a=-1;for(let e of t){let t=i.findIndex((t,r)=>r>a&&n(t)>=e.at);if(t<0&&(t=i.length),!r&&!i.slice(0,t).some(t=>n(t)<e.at))continue;let o=i[t-1];t-1>a&&o.kind===`user`&&e.at-n(o)<=bH&&--t,i.splice(t,0,{kind:`divider`,key:e.key,text:e.text}),a=t+1}return i}var SH=3;function CH(e){switch(e.kind){case`compaction`:case`compaction-notice`:case`compaction-progress`:case`error`:case`divider`:case`plugin-message`:case`discarded-turn`:case`interrupted`:return!1;default:return!0}}var wH=new Set([`grep`,`find`,`glob`,`ls`]);function TH(e,t,n,r){e===`read`?n.reads+=1:wH.has(e)?n.searches+=1:e===`bash`?!r||!vz(t)?n.commands+=1:OH.has(mz(t))?n.reads+=1:n.searches+=1:n.others+=1}var EH=new Set([`read`,...wH]);function DH(e){let t=[],n=e=>{e.kind===`tool-group`?e.children.forEach(n):e.kind===`tool`&&e.batchLabel&&!t.includes(e.batchLabel)&&t.push(e.batchLabel)};return e.forEach(n),t.length>0?t.join(` · `):void 0}var OH=new Set([`cat`,`bat`,`head`,`tail`,`less`,`more`,`nl`,`tac`]);function kH(e){return EH.has(e.name)||e.name===`bash`&&vz(e.summary)}function AH(e){let t=[];for(let n of e){let e=t.at(-1);n.kind===`thinking`&&e?.kind===`thinking`&&mH(n)>=0&&mH(e)===mH(n)?t[t.length-1]={...e,text:`${e.text}\n\n${n.text}`,streaming:e.streaming||n.streaming,durationMs:e.durationMs??n.durationMs,startedAt:e.startedAt??n.startedAt}:t.push(n)}return t}var jH=new Set([`explore_mark`,`explore_fold`]),MH=/^Explore folded\.[^\n]*\n*/,NH=e=>`${e}:steps`;function PH(e,t,n){let r=[],i=-1;for(let a of e){if(a.kind!==`tool`&&a.kind!==`thinking`&&a.kind!==`text`)i=-1;else if(a.kind===`tool`&&a.state===`ok`){if(a.name===`explore_fold`&&i>=0){let e=[...r.splice(i),a],o=e[0],s={commands:0,reads:0,searches:0,others:0},c=0;for(let t of e)t.kind!==`tool`||jH.has(t.name)||(TH(t.name,t.summary,s,n),c+=1);let l=`explore-${o.key}`,u=t.has(l);r.push({kind:`tool-group`,key:l,expanded:u,count:c,stats:s,exploring:!1,explore:{goal:o.summary,report:(a.output??``).replace(MH,``).trim(),steps:u&&t.has(NH(l))},children:e}),i=-1;continue}a.name===`explore_mark`&&i<0&&(i=r.length)}r.push(a)}return r}var FH=/^Turn discarded[:.]?\s*/;function IH(e,t){let n=[];for(let r of e){if(r.kind===`tool`&&r.name===`turn_discard`&&r.state===`ok`){let e=n.length;for(;e>0&&(n[e-1].kind===`thinking`||n[e-1].kind===`text`||n[e-1].kind===`tool`);)e--;let i=e;for(;e>0&&n[e-1].kind===`plugin-message`;)e--;if(e<i){let i=n.splice(e),a=i.filter(e=>e.kind===`plugin-message`),o=`discard-${a[0].key}`;n.push({kind:`discarded-turn`,key:o,reason:r.output==null?r.summary:r.output.replace(FH,``).trim(),pluginId:a[0].pluginId,pluginName:a[0].pluginName,messages:a.map(e=>e.text),tools:i.flatMap(e=>e.kind===`tool`?[{name:e.name,summary:e.summary}]:[]),expanded:t.has(o)});continue}}n.push(r)}return n}function LH(e){return e.kind===`tool-group`&&e.explore?.steps?[e,...e.children]:[e]}function RH(e,t,n=!1){if(e.length<2)return e.flatMap(LH);let r={commands:0,reads:0,searches:0,others:0},i=0,a=0,o=0;for(let t of e.flatMap(e=>e.kind===`tool-group`?e.children:[e]))t.kind===`thinking`?i+=1:t.kind===`tool`&&(TH(t.name,t.summary,r,!1),o+=1),(t.kind===`thinking`||t.kind===`tool`)&&(a+=t.durationMs??0);let s=`group-${e[0].key}`,c=t.has(s),l=DH(e),u={kind:`tool-group`,key:s,expanded:c,count:o,stats:r,exploring:!1,activity:{thinking:i,workedMs:a},...n?{live:!0}:{},...l?{summary:l}:{},children:e};return c?[u,...e.flatMap(LH)]:[u]}var zH={signature:``,closedAt:null,held:[]};function BH(e){return e.kind===`tool-group`&&e.children[0]?e.children[0].key:e.key}function VH(e,t){return e.kind===`tool`&&e.generatedImages?.length||e.kind===`tool`&&eB(e.name,t)?!1:e.kind===`thinking`||e.kind===`tool-group`||e.kind===`tool`&&e.state===`ok`&&!e.name.startsWith(`goal_`)&&e.name!==`submit_plan`}function HH(e,t,n,r){let i=IH(e,n),a=r.autoCollapseCompletedTurns===!0,o=r.turnOverrides,s=i.findLastIndex(e=>e.kind===`user`&&!e.deliveryState),c=i;if(a||o&&o.size>0){let e=[],n=0;for(;n<i.length;){let r=i[n];if(r.kind===`user`){let c=n===s,l=a&&!c&&r.canCollapse===!0,u=!r.deliveryState&&!(t&&c)&&(o?.get(r.key)??l);if(e.push(u?{...r,collapsed:!0}:r),n+=1,u)for(;n<i.length&&i[n].kind!==`user`;){let t=i[n];CH(t)||e.push(t),n+=1}}else e.push(r),n+=1}c=e}c=PH(c,n,r.compact===!0);let l=c.findLastIndex(e=>e.kind===`user`&&!e.deliveryState),u=Math.max(l,c.findLastIndex(e=>e.kind===`text`));return{sourceItems:c,lastUserIndex:l,liveFrom:u}}function UH(e,t,n){if(n.collapseLiveActivity!==!0||!t)return null;let{sourceItems:r,liveFrom:i}=HH(e,t,new Set,n),a=n.readableToolCards===!0,o=[],s=!1,c=0;for(;c<r.length;){if(!(c>i)||!VH(r[c],a)){c+=1;continue}let e=[],t=c;for(;t<r.length&&VH(r[t],a);){let n=r[t];if(n.kind===`thinking`&&n.streaming){s=!0;break}e.push(BH(n)),t+=1}for(e.length>0&&o.push(e);t<r.length&&VH(r[t],a);)t+=1;c=t}return o.length===0?null:{segments:o,blocked:s}}function WH(e,t,n,r,i){let a=UH(e,t,n);if(!a)return{witness:zH,released:new Set,wakeAt:null};let{segments:o,blocked:s}=a,c=new Set(r.held),l=[],u=[],d=!0;for(let e of o)for(let t of e)d&&c.has(t)?l.push(t):(d=!1,u.push(t));let f=new Set(l);if(s)return{witness:{signature:``,closedAt:null,held:l},released:f,wakeAt:null};let p=o.some(e=>e.filter(e=>!f.has(e)).length>0&&e.length>=2);if(u.length===0||!p)return{witness:{signature:``,closedAt:null,held:l},released:f,wakeAt:null};let m=u.join(`\0`),h=r.signature===m&&r.closedAt!==null?r.closedAt:i,g=h+nz(n.liveActivityFoldDelaySec);if(i<g)return{witness:{signature:m,closedAt:h,held:l},released:f,wakeAt:g};let _=[...l,...u];return{witness:{signature:``,closedAt:null,held:_},released:new Set(_),wakeAt:null}}function GH(e,t,n,r,i,a,o,s,c,l){let u=e=>e.kind===`tool`&&c?.has(e.key)===!0,d=e=>e.kind===`tool`&&eB(e.name,l),f=e=>i&&!(t&&e>s),p=n=>{if(!a||!t||!(n>s)||!VH(e[n],l)||u(e[n])||!a.has(BH(e[n])))return n;let r=n;for(;r<e.length&&VH(e[r],l)&&!u(e[r])&&a.has(BH(e[r]));)r+=1;return r-n>=2?r:n},m=(e,t)=>!d(e)&&!u(e)&&!(e.kind===`tool`&&e.generatedImages?.length)&&(e.kind===`thinking`||e.kind===`tool-group`&&f(t)||e.kind===`tool`&&(f(t)?e.state===`ok`&&!e.name.startsWith(`goal_`)&&e.name!==`submit_plan`:!r||kH(e))),h=[],g=0;for(;g<e.length;){let i=e[g],a=p(g);if(a>g){h.push(...RH(AH(e.slice(g,a)),n,!0)),g=a;continue}if(!m(i,g)){h.push(...LH(i)),g+=1;continue}let s=g;for(;s<e.length&&m(e[s],s)&&p(s)===s;)s+=1;let c=AH(e.slice(g,s));if(f(g)){h.push(...RH(c,n)),g=s;continue}let l=!r&&t&&o>=0&&g>o,u=e=>e.kind===`tool`?e.edits!==null||e.writeContent||e.fileChanges?.length||e.imagePath&&e.state!==`error`||e.name===`todo`||e.name===`submit_plan`?!0:e.state!==`running`&&e.state!==`reviewing`?!1:!(r&&kH(e)):!1,d=c.filter(u),_=c.filter(e=>!u(e)),v=_.filter(e=>e.kind===`tool`).length;if(l||v<SH)h.push(...c);else{let i={commands:0,reads:0,searches:0,others:0};for(let e of _)e.kind===`tool`&&TH(e.name,e.summary,i,r);let a=`group-${c[0].key}`,o=n.has(a),l=DH(_);h.push({kind:`tool-group`,key:a,expanded:o,count:v,stats:i,exploring:r&&(t&&s===e.length||_.some(e=>e.kind===`tool`&&(e.state===`running`||e.state===`reviewing`))),...l?{summary:l}:{},children:_}),o?h.push(...c):h.push(...d)}g=s}return h}function KH(e){return e.kind===`user`&&!e.deliveryState}function qH(e){return e.kind===`text`&&pe(e.text)}function JH(e){return e.kind===`text`&&e.text.trim().length>0&&!pe(e.text)}function YH(e,t){for(let n of e)n.kind===`tool`?t(n):n.kind===`tool-group`&&YH(n.children,t)}function XH(e,t,n){if(e.length===0)return[];let r={commands:0,reads:0,searches:0,others:0},i=0,a=0,o=0;YH(e,e=>{TH(e.name,e.summary,r,!1),i+=1,o+=e.durationMs??0});for(let t of e)t.kind===`thinking`&&(a+=1,o+=t.durationMs??0);let s=`${n?`silent`:`group`}-${e[0].key}`,c=t.has(s),l=DH(e),u={kind:`tool-group`,key:s,expanded:c,count:i,stats:r,exploring:!1,activity:{thinking:a,workedMs:o},...n?{notice:n}:{},...l&&!n?{summary:l}:{},children:e};return c?[u,...e]:[u]}function ZH(e){return/<secretary-schedule>/.test(e)&&!/<session-updates>/.test(e)?`patrol`:`seen`}function QH(e){let t=!1;return YH(e,e=>{e.name===`silence_turn`&&(t=!0)}),t||e.some(qH)}function $H(e,t,n,r){let i=[],a=0;for(;a<e.length;){if(!KH(e[a])){i.push(e[a]),a+=1;continue}let o=a+1;for(;o<e.length&&!KH(e[o]);)o+=1;let s=e.slice(a,o),c=t&&o===e.length;i.push(...eU(s,c,n,r)),a=o}return i}function eU(e,t,n,r){let i=e[0];if(t||i?.kind!==`user`)return e;let a=e.slice(1).filter(e=>!qH(e));if(Se(i.text)&&QH(e.slice(1))){let e=ZH(i.text);return XH([{...i,canCollapse:!1},...a],n,e)}if(!r||a.some(JH))return e;let o=!1,s=0;return YH(a,e=>{s+=1,e.state!==`ok`&&(o=!0)}),o||s<1||a.some(e=>e.kind!==`tool`&&e.kind!==`thinking`&&e.kind!==`tool-group`)?e:[{...i,canCollapse:!1},...XH(a,n)]}function tU(e,t,n,r={}){let{sourceItems:i,lastUserIndex:a,liveFrom:o}=HH($H(e.map(e=>e.kind===`resumed-reply`?{...e,expanded:n.has(e.key)}:e),t,n,r.foldToolOnlyTurns===!0),t,n,r),s=r.readableToolCards===!0,c=Az(i,e=>eB(e,s),(e,t)=>e.kind===`tool`?{...e,cardPeers:t.flatMap(e=>e.kind===`tool`?[{key:e.key,args:e.args??null,output:e.output,state:e.state,...e.image?{image:e.image}:{}}]:[])}:e),l=r.collapseLiveActivity===!0?r.releasedLiveActivity??null:null;return GH(c,t,n,r.compact===!0,r.collapseCompletedActivity===!0,l,a,o,r.heldOpenTools??null,s)}var nU={rows:new Set,expanded:new Set};function rU(e,t,n){let r=[],i=[],a=new Map,o=new Set;for(let s of t){if(s.kind!==`tool-group`||!s.explore)continue;let t=e.rows.has(s.key);if(s.explore.steps){o.add(s.key),t&&!e.expanded.has(s.key)&&i.push(s.key),s.children.forEach((e,t)=>{a.set(e.key,{group:s.key,index:t})});continue}let c=s.children[0]?.key??``,l=s.children.at(-1)?.key??``,u=!t&&e.rows.has(c)&&e.rows.has(l);if(!u&&!e.expanded.has(s.key))continue;let d=n(u?c:s.key,l);d>0&&r.push({key:s.key,height:d,pair:u})}return{collapses:r,expands:i,children:a,next:{rows:new Set(t.map(e=>e.key)),expanded:o}}}function iU({loading:e=!1,runStartedAt:t}){if(!e)return t}var aU=(0,H.createContext)({query:``,activeKey:``,activeNth:-1});function oU(){return(0,H.useContext)(aU)}var sU=`rounded-[2px] px-0.5 py-px`,cU=`${sU} bg-yellow-300 text-foreground dark:bg-yellow-500/80`,lU=`${sU} bg-orange-600 text-white dark:bg-orange-500`;function uU(e,t,n,r){let i=t.trim();if(!i)return e;let a=e.toLowerCase(),o=i.toLowerCase(),s=0,c=a.indexOf(o,s);if(c<0)return e;let l=[];for(;c>=0;){c>s&&l.push(e.slice(s,c));let t=r.n++;l.push((0,G.jsx)(`mark`,{className:t===n?lU:cU,children:e.slice(c,c+i.length)},t)),s=c+i.length,c=a.indexOf(o,s)}return s<e.length&&l.push(e.slice(s)),l}function dU(e,t,n,r){return e==null||typeof e==`boolean`?e:typeof e==`string`||typeof e==`number`?uU(String(e),t,n,r):Array.isArray(e)?e.map((e,i)=>(0,G.jsx)(H.Fragment,{children:dU(e,t,n,r)},i)):e}function fU(e){return e===`right`||e===`off`?e:`left`}function pU(e,t,n){return e!==`off`&&!t&&n>=2}var mU=40;function hU({items:e,activeKey:t,onJump:n}){let r=E(e=>e.chatWide),i=fU(E(e=>e.navRailSide)),[a,o]=(0,H.useState)(null);if(!pU(i,r,e.length))return null;let s=i===`right`,c=Math.max(0,e.findIndex(e=>e.key===t)),l=Math.min(Math.max(0,c-Math.floor(mU/2)),Math.max(0,e.length-mU)),u=e.slice(l,l+mU),d=l>0,f=l+mU<e.length,p=(e,t)=>{let n=t?24:12;if(a===null)return n;let r=Math.abs(e-a);return n+Math.max(0,16-r*6)};return(0,G.jsx)(`div`,{className:W(`group/rail absolute top-0 z-10 hidden h-full w-14 @min-[52rem]:block`,s?`right-0`:`left-0`),children:(0,G.jsx)(`div`,{className:W(`absolute top-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-200 group-hover/rail:opacity-100`,s?`right-2`:`left-2`),onMouseLeave:()=>o(null),children:(0,G.jsxs)(`div`,{className:`relative flex flex-col justify-center gap-[5px]`,style:{maskImage:d||f?`linear-gradient(to bottom, ${d?`transparent, black 24px`:`black`}, ${f?`black calc(100% - 24px), transparent`:`black`})`:void 0},children:[u.map((e,r)=>{let i=e.key===t,c=r===a;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e.key),onMouseEnter:()=>o(r),className:W(`flex h-[7px] w-10 items-center`,s&&`justify-end`),children:(0,G.jsx)(`span`,{className:W(`rounded-full transition-all duration-150`,i||c?`h-[3px] bg-foreground`:`h-[2px] bg-muted-foreground/40`),style:{width:p(r,i)}})},e.key)}),a!==null&&u[a]&&(0,G.jsxs)(`div`,{className:W(`pointer-events-none absolute w-72 -translate-y-1/2 rounded-xl border bg-popover p-3 shadow-lg`,s?`right-10`:`left-10`),style:{top:`${(a+.5)/u.length*100}%`},children:[(0,G.jsx)(`p`,{className:`line-clamp-2 text-xs font-semibold`,children:u[a].question}),u[a].answer&&(0,G.jsx)(`p`,{className:`mt-1 line-clamp-3 text-xs text-muted-foreground`,children:u[a].answer})]})]})})})}var gU={width:72,height:28};function _U(e,t){let n=[];for(let r of e.querySelectorAll(`[data-quote-skip]`)){let e=r.getBoundingClientRect();e.height>0&&e.bottom>0&&e.top<t&&n.push(e)}return n}function vU({containerRef:e}){let{t}=K(),n=E(e=>e.quoteSelectionButton),r=jD(),[i,a]=(0,H.useState)(null);return(0,H.useEffect)(()=>{if(!n){a(null);return}let t=()=>{let t=e.current,n=window.getSelection(),i=t?IA(n,t):null;if(!i||!n||!t){a(null);return}let o=n.getRangeAt(0).getBoundingClientRect(),s={width:window.innerWidth,height:window.innerHeight},c=_U(t,s.height);a({text:i,...zA(o,s,gU,r,c)})};return document.addEventListener(`selectionchange`,t),window.addEventListener(`scroll`,t,!0),window.addEventListener(`resize`,t),()=>{document.removeEventListener(`selectionchange`,t),window.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,t)}},[n,r,e]),!n||!i?null:(0,Gs.createPortal)((0,G.jsxs)(`button`,{type:`button`,"data-enso":`quote-selection`,title:t(`Quote into the input box`),onMouseDown:e=>e.preventDefault(),onClick:()=>{let e=DA(i.text);!e||!nk(e)||(window.getSelection()?.removeAllRanges(),a(null))},style:{top:i.top,left:i.left,minWidth:gU.width},className:`fixed z-50 inline-flex h-7 items-center justify-center gap-1 rounded-full border bg-card px-2.5 text-xs text-foreground shadow-float hover:bg-muted`,children:[(0,G.jsx)(An,{className:`h-3 w-3`}),t(`Quote`)]}),document.body)}var yU=/\n*<chat-reference id="([^"]*)" title="([^"]*)" kind="(?:direct|group)">\n[\s\S]*?\n<\/chat-reference>/g;function bU(e){let t=[],n=e.replace(yU,(e,n,r)=>(t.push({id:n,title:r}),``));return t.length?{body:n.trim(),refs:t}:{body:e,refs:t}}var xU={zh:`这是同一件事的补充,保留原目标,把它并进这一轮的结果;不要单独回一句「收到」。只有明确说换掉或取消才改目标。
209
- 补充内容:
210
- `,en:`This adds to the same request. Keep the original goal and fold it into this turn's result; do not reply with a standalone "got it". Only change the goal if explicitly told to replace or cancel it.
211
- Addition:
212
- `};function SU(e){for(let t of Object.values(xU))if(e.startsWith(t))return e.slice(t.length);return e}var CU=/^\s*<notes-updated>[\s\S]*?<\/notes-updated>\s*/;function wU(e){return SU(e.replace(CU,``))}var TU={"&amp;":`&`,"&lt;":`<`,"&gt;":`>`,"&quot;":`"`,"&apos;":`'`},EU=e=>e.replace(/&(?:amp|lt|gt|quot|apos);/g,e=>TU[e]);function DU(e){let t=Object.create(null);return e.replace(/\s+([\w-]+)="([^"]*)"/g,(e,n,r)=>(t[n]=EU(r),``)).trim()?null:t}function OU(e){let t=wU(e).trim(),n=kU(t);if(n||t.startsWith(`<group`)||t.startsWith(`(`))return n;for(let e of t.matchAll(/\n(?=<group-info>|<group-state>|<group-context>\n|<group-message |(省略了 \d+ 条)/g)){let n=kU(t.slice(0,e.index).trim()),r=kU(t.slice(e.index).trim());if(n&&n.kind!==`group`&&r?.kind===`group`)return{...n,group:r.messages}}return null}function kU(e){let t=/^(省略了 \d+ 条更早的消息)\s*/,n=/^<group-context>\n([\s\S]*)\n<\/group-context>$/.exec(e);if(n){let e=n[1].search(/^(?:<group-message |(省略了 \d+ 条)/m);if(e<0)return null;let r=kU(n[1].slice(e).replace(t,``).trim());return r?.kind===`group`&&!r.instruction&&!r.note&&!r.refs?{kind:`group`,messages:r.messages,instruction:``}:null}if(e.startsWith(`<group-info>`)||e.startsWith(`<group-state>`)||e.startsWith(`<group-message `)||t.test(e)){let n=e.replace(/^<group-info>[\s\S]*?<\/group-info>\s*/,``).replace(/^<group-state>[\s\S]*?<\/group-state>\s*/,``),r=t.exec(n)?.[0].trim();n=n.replace(t,``);let i=[];for(;n.startsWith(`<group-message `);){let e=/^<group-message([^>]*)>([\s\S]*?)<\/group-message>\s*/.exec(n);if(!e)return null;let t=DU(e[1]);if(!t?.from)return null;i.push({from:t.from,text:EU(e[2].trim())}),n=n.slice(e[0].length)}if(!i.length)return null;let a=/\n*<routing-note>([\s\S]*?)<\/routing-note>\s*$/.exec(n);a&&(n=n.slice(0,a.index));let{body:o,refs:s}=bU(n);return{kind:`group`,messages:i,instruction:EU([r,o.trim()].filter(Boolean).join(`
213
- `)),...a?{note:EU(a[1].trim())}:{},...s.length?{refs:s}:{}}}let r=/^<delegation-results(\s[^>]*)?>([\s\S]*)<\/delegation-results>$/.exec(e);if(r){if(!DU(r[1]??``))return null;let e=r[2].trim(),t=[];for(;e;){let n=/^<delegation-result([^>]*)>([\s\S]*?)<\/delegation-result>\s*/.exec(e),r=n&&DU(n[1]);if(!n||!r?.from)return null;t.push({from:r.from,status:r.status??``,text:EU(n[2].trim())}),e=e.slice(n[0].length)}return t.length?{kind:`delegation-results`,results:t}:null}let i=/^<(routine|delegation-task|delegation-result|delegation-retry|delegation-check-failed)(\s[^>]*)?>([\s\S]*)<\/\1>$/.exec(e);if(!i)return null;let a=DU(i[2]??``);if(!a)return null;let o=i[3].trim();if(i[1]===`delegation-retry`||i[1]===`delegation-check-failed`)return!a.id||/[<>]/.test(o)?null:{kind:i[1],text:EU(o)};if(i[1]===`routine`){if(!a.title)return null;if(a[`dry-run`]!==`true`)return{kind:`routine`,title:a.title,prompt:EU(o)};let e=EU(o.replace(/^\[Dry run\][^\n]*\n*/,``));return{kind:`routine`,title:a.title,prompt:e,dryRun:!0}}if(!a.from)return null;if(i[1]===`delegation-result`)return{kind:`delegation-result`,from:a.from,status:a.status??``,text:EU(o)};let s=o.replace(/\s*<previous-runs>[\s\S]*<\/previous-runs>$/,``).replace(/\s*<acceptance-check>[\s\S]*<\/acceptance-check>$/,``),c=/\s*<context>([\s\S]*)<\/context>$/.exec(s);return!c&&/<\/?context>/.test(s)?null:{kind:`delegation-task`,from:a.from,task:EU((c?s.slice(0,c.index):s).trim()),context:EU(c?.[1].trim()??``)}}var AU=`You are a side conversation attached to a coding session. The main agent cannot see this thread. Do not continue the main task unless the user asks you to. Follow the same tool and skill constraints as the main session. Do not spawn subagents, coworkers, or workflows. Answer the user directly.`;function jU(e){return e.startsWith(AU)}function MU(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}var NU={zh:{quit:`被关闭`,update:`被关闭(安装更新)`},en:{quit:`was closed`,update:`was closed (installing an update)`}};function PU(e){let t=MU(e.at),n=[...new Set(e.unfinishedTools)];return e.lang===`en`?`${`The app ${NU.en[e.kind]} at ${t} and this turn was interrupted.`}${n.length>0?` ${n.length} tool call(s) never returned (${n.join(`, `)}) and may have run halfway — check the result before continuing.`:``}`.trim():`${`应用在 ${t} ${NU.zh[e.kind]},这一轮被中断。`}${n.length>0?`中断时有 ${n.length} 个工具调用没有结果(${n.join(`、`)}),可能只执行了一半,继续前请先检查。`:``}`}function FU(e){let t=PU(e);return e.lang===`en`?`${t} You can retry to continue.`:`${t}可以点重试继续。`}var IU={"too-large":`超过 10MB,没有保存`,"not-image":`不是 png / jpeg / webp / gif 图片,没有保存`,unavailable:`没能保存`},LU=String.raw`\[图片 \d+(?: 未收下)?\] [^\n]*`;new RegExp(String.raw`(?:^|\n\n)${LU}(?:\n${LU})*$`,`u`);function RU(e){return[...e.matchAll(/^\[图片 \d+\] (.+)$/gmu)].map(e=>e[1])}var zU=new Map(Object.entries(IU).map(([e,t])=>[t,e]));function BU(e){return/^(?:\/|[A-Za-z]:\/)/u.test(e.replace(/\\/gu,`/`))}function VU(e){return BU(e)&&e.replace(/\\/gu,`/`).includes(`/bot-chats/secretary-images/`)}function HU(e,t=0){let n=[];for(let[r,i]of e.split(`
214
- `).entries()){let e=/^\[图片 (\d+)( 未收下)?\] (.+)$/u.exec(i);if(!e||Number(e[1])!==r+1)return null;let a=e[3];if(e[2]){let e=zU.get(a);if(!e)return null;n.push({index:r+1,rejected:e})}else{if(!(r<t?BU(a):VU(a)))return null;n.push({index:r+1,path:a})}}return n}var UU=new RegExp(String.raw`(?:^|\n\n)(${LU}(?:\n${LU})*)`+String.raw`((?:\n\n\[Image[^\n]*\](?:\n\[Image[^\n]*\])*)?)$`,`u`);function WU(e,t=0){let n=UU.exec(e);if(!n)return null;let r=HU(n[1],t);if(!r)return null;let i=e.slice(0,n.index),a=n[2]??``;return{text:i?`${i}${a}`:a.replace(/^\n\n/u,``),entries:r}}new TextEncoder;function GU(e){if(e)try{return decodeURIComponent(e)}catch{return e}}var KU=`([A-Za-z0-9._@:+/=%-]+)`,qU=RegExp(String.raw`^\[(?:来自|From) ([^\]\n@·「」]{1,40}?)`+String.raw`(?: (私聊|private|群|group)(?:「([^」\]\n]{1,64})」)?)?`+`(?: chatId=${KU})?(?: topicId=${KU})?(?: senderId=${KU}| (发送者未知|sender unknown))?`+String.raw`(?: @([^\]\n@·]{1,32}?))?(?: · (\d{2}):(\d{2}))?\]\n`+String.raw`<untrusted-content source="([a-z0-9._:-]+?)(?::@[^"\n]{1,32})?(?: [^"\n]*)?">`+String.raw`([\s\S]*)<\/untrusted-content>((?:\n${LU})*)$`,`u`);function JU(e){let t=qU.exec(e);if(!t)return null;let[,n=``,r,i,a,o,s,c,l,u,d,f=``,p=``,m=``]=t,h=r===`私聊`||r===`private`?`private`:r?`group`:void 0,g={chat:GU(a),topic:GU(o),sender:GU(s)},_=RU(m),v=m?HU(m.slice(1)):null;return{channel:f,title:n,...g.chat?{chatId:g.chat}:{},...h?{chatType:h}:{},...h===`group`&&i?{chatTitle:i}:{},...g.topic?{topicId:g.topic}:{},...g.sender?{senderId:g.sender}:{},...c?{senderUnknown:!0}:{},...l?{username:l}:{},...u&&d?{time:`${u}:${d}`}:{},body:xz(p),..._.length?{images:_}:{},...v?.length?{imageLines:v}:{}}}var YU=RegExp(`<(agent-notification|goal-continuation|coworker-hired|coworker-dismissed|background-task-update|session-updates|secretary-schedule|secretary-message)>\\n?([\\s\\S]*?)\\n?</\\1>`,`g`),XU=/\n(?=Work toward this goal autonomously\.|Continue working toward it\.)/;function ZU(e){let t=(e.split(`
215
- `).map(e=>e.trim()).find(Boolean)??``).split(/(?<=[。!?.!?])\s*/)[0]?.trim()??``;return t.length<=72?t:`${t.slice(0,72)}…`}function QU(e){let t=e.trim(),n=/^(?:Session goal(?: resumed)?:[ \t]*)([\s\S]*)$/.exec(t),r=(n?n[1]:t).trim(),i=r.search(XU);return i<0?{goal:r,instructions:``}:{goal:r.slice(0,i).trim(),instructions:r.slice(i).trim()}}function $U(e){let t=[],n=new RegExp(YU.source,`g`),r=0,i=!1;for(let a of e.matchAll(n)){i=!0;let n=a.index??0;n>r&&t.push({kind:`text`,text:e.slice(r,n)});let o=a[1]??``,s=a[2]??``;o===`goal-continuation`?t.push({kind:`goal`,...QU(s)}):o===`secretary-schedule`?t.push({kind:`schedule`,raw:a[0]}):o===`session-updates`?t.push({kind:`updates`,raw:a[0]}):t.push({kind:`notice`,tag:o,body:s}),r=n+a[0].length}return i?(r<e.length&&t.push({kind:`text`,text:e.slice(r)}),t):null}var eW=/^<\/?(?:agent-notification|goal-continuation|coworker-hired|coworker-dismissed|background-task-update|session-updates|secretary-schedule|secretary-message)>$/;function tW(e){return e.split(`
216
- `).filter(e=>!eW.test(e.trim())).join(`
217
- `).trim()}function nW(e){return e.length<=72?e:`${e.slice(0,72)}…`}function rW(e){let t=e.trim(),n=t.indexOf(`
218
- `),r=(n<0?t:t.slice(0,n)).trim(),i=r.indexOf(`:`);if(i>0&&i<=8){let e=r.slice(i+1).trim();if(e){let r=n<0?``:t.slice(n+1);return{summary:nW(e),body:r?`${e}\n${r.trim()}`:e}}}return{summary:nW(r),body:t}}function iW(e){let t=tW(e);return t?t.split(/\n(?=- \[schedule\])/).map(e=>rW(e.replace(/^- \[schedule\][ \t]?/,``))).filter(e=>e.body.length>0):[]}function aW(e){let t=tW(e).replace(/^- \[[a-z-]+(?: session:[^\]]+)?\][ \t]?/gm,``).trim();return{summary:nW(t.split(`
219
- `).map(e=>e.trim()).find(Boolean)??``),body:t}}var oW=`#7c5cff`,sW=/^#[0-9a-f]{6}$/iu,cW=/^[0-9a-f]{8}$/u,lW=/^([01]\d|2[0-3]):[0-5]\d$/u,uW=[`ui`,`zh`,`en`],dW=[`concise`,`detailed`],fW=[`needs-user`,`with-done`,`off`],pW=[`goal-complete`,`goal-blocked`,`turn-ended`,`needs-user`,`failed`,`stalled`,`interrupted`];function mW(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function hW(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function gW(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0}function _W(e){let t=gW(e);return t===void 0?void 0:Math.floor(t)}function vW(e,t,n){if(!(typeof e!=`number`||!Number.isFinite(e)))return Math.min(n,Math.max(t,Math.round(e)))}function yW(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=hW(n);e&&!t.includes(e)&&t.push(e)}return t}function bW(e,t,n){return t.includes(e)?e:n}function xW(e,t){return typeof e==`boolean`?e:t}var SW={mode:`projects`,projectIds:[]};function CW(e){return mW(e)?e.mode===`all`?{mode:`all`}:e.mode===`explicit`?{mode:`explicit`}:e.mode===`projects`?{mode:`projects`,projectIds:yW(e.projectIds)}:SW:SW}function wW(e){if(!mW(e))return null;let t=mW(e.avatar)?e.avatar:{},n=_W(t.imageVersion),r=typeof t.imageHash==`string`&&cW.test(t.imageHash)?t.imageHash:void 0,i={version:1,name:hW(e.name)??`秘书`,avatar:{color:typeof t.color==`string`&&sW.test(t.color)?t.color:oW,...n&&n>0?{imageVersion:n,...r?{imageHash:r}:{}}:{}},takeoverScope:CW(e.takeoverScope),pluginIds:yW(e.pluginIds),skillIds:yW(e.skillIds),visibleProjectIds:Array.isArray(e.visibleProjectIds)?yW(e.visibleProjectIds):`all`,maxRunningDispatches:vW(e.maxRunningDispatches,1,10)??3,patrolEnabled:xW(e.patrolEnabled,!0),...e.cleanupSkipConfirm===!0?{cleanupSkipConfirm:!0}:{},replyLanguage:bW(e.replyLanguage,uW,`ui`),style:bW(e.style,dW,`concise`),notify:bW(e.notify,fW,`needs-user`),updatedAt:gW(e.updatedAt)??0},a=vW(e.updateWindowMs,1e3,6e4);a!==void 0&&(i.updateWindowMs=a);let o=yW(e.disabledSkillNames);o.length>0&&(i.disabledSkillNames=o);let s=hW(e.addressAs);return s&&(i.addressAs=s),typeof e.dailyBriefAt==`string`&&lW.test(e.dailyBriefAt)&&(i.dailyBriefAt=e.dailyBriefAt),i}var TW=/^<(session-updates|secretary-schedule)>\n([\s\S]*?)\n<\/\1>(?:\n|$)/,EW=/^- \[([a-z-]+)(?: (?:session|pending):([^\]\s]+))?\] ([^\n]*)(?:\n|$)/,DW=/^<untrusted-content source="[^"]*">/,OW=`</untrusted-content>`;function kW(e){return pW.includes(e)}function AW(e,t,n,r){return e===`secretary-schedule`?t===`schedule`&&!n?{kind:t,text:r}:null:t===`proposal`?n?null:{kind:t,text:r}:t===`pending`?{kind:t,text:r}:t===`ask-relay`||t===`leftover`||t===`queued`?n?{kind:t,text:r,conversationId:n}:null:kW(t)?n?{kind:t,text:r,conversationId:n}:{kind:t,text:r}:null}function jW(e,t){let n=[],r=t;for(;r;){let t=EW.exec(r),i=t&&AW(e,t[1],t[2],t[3]);if(!t||!i)return null;r=r.slice(t[0].length);let a=DW.exec(r);if(a){let e=r.indexOf(OW);if(e<0)return null;if(i.detail=xz(r.slice(a[0].length,e)),r=r.slice(e+20),r.startsWith(`
220
- `))r=r.slice(1);else if(r)return null}n.push(i)}return n.length>0?n:null}function MW(e){let t=[],n=e.trim();for(;n;){let e=TW.exec(n),r=e&&jW(e[1],e[2]);if(!e||!r)return null;t.push(...r),n=n.slice(e[0].length)}return t.length>0?t:null}var NW=new Set([`Shell read-only shortcut: prefer read (offset/limit) for files, grep for content, find for paths — the dedicated tools handle line ranges and stream far less output.`,"Sleep-waiting in a foreground command costs a model round per check. Put the whole wait in one command that exits when the condition holds (e.g. `until <check>; do sleep 10; done; <report>`) and run it with background: true — you are notified when it finishes, then end your turn.",`timeout only kills the process; it does not keep this call in the foreground. If the command may outlast the yield, set background: true and end your turn — completion wakes you. Do not poll with sleep, ps, pgrep, or task_output loops.`]);function PW(e){let t=e.split(`
221
- `),n=0;for(;n<t.length&&NW.has(t[n].replace(/\r$/,``));)n++;if(n===0)return e;for(;n<t.length&&!t[n].trim();)n++;return t.slice(n).join(`
222
- `)||e}var FW=/^Command exited with code \d+$/,IW=/^Command (?:aborted|timed out after \d+ seconds|terminated without an exit code)/,LW=/^\[[^\]]+\]/,RW=/^at\s/,zW=/\b(?:error|fatal|panic|exception|failed|failure|cannot|not found|no such file|denied|refused)\b(?!\.\w|\()/i;function BW(e){let t=PW(e).split(/\r?\n/).map(e=>e.trim()),n=t.findLastIndex(e=>FW.test(e)||IW.test(e));if(n<0)return t.find(Boolean)??``;if(IW.test(t[n]))return t[n];for(let e=n-1;e>=0;e--){let n=t[e];if(n&&!LW.test(n)&&!RW.test(n)&&zW.test(n))return n}return t[n]}function VW({message:e}){let{t}=K(),n={queued:t(`Queued`),running:t(`In progress`),completed:t(`Completed`),failed:t(`Failed`),canceled:t(`Canceled`)},r=e.kind===`routine`?Mt:e.kind===`group`?pn:e.kind===`delegation-task`?jt:e.kind===`delegation-retry`||e.kind===`delegation-check-failed`?Nn:It,i=e.kind===`routine`?`${e.dryRun?t(`Routine dry run`):t(`Routine task`)} · ${e.title}`:e.kind===`group`?t(`Group messages`):e.kind===`delegation-task`?t(`Task from {{name}}`,{name:e.from}):e.kind===`delegation-results`?t(`Delegation results`):e.kind===`delegation-retry`?t(`Continue delegated task`):e.kind===`delegation-check-failed`?t(`Acceptance check not passed`):t(`Result from {{name}}`,{name:e.from});return(0,G.jsxs)(`div`,{"data-bot-injection":e.kind,className:`w-full rounded-lg border border-border/60 bg-muted/20 px-3 py-2 text-sm`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,G.jsx)(r,{className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{children:i}),e.kind===`delegation-result`&&e.status&&(0,G.jsxs)(`span`,{children:[`· `,n[e.status]??e.status]})]}),(0,G.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:e.kind===`routine`?e.prompt:e.kind===`delegation-task`?e.task:e.kind===`delegation-result`||e.kind===`delegation-retry`||e.kind===`delegation-check-failed`?e.text:e.kind===`delegation-results`?e.results.map((e,t)=>(0,G.jsxs)(`p`,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[e.from,e.status&&` · ${n[e.status]??e.status}`,`:`]}),e.text]},`${t}:${e.from}`)):e.messages.map((e,t)=>(0,G.jsxs)(`p`,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[e.from,`:`]}),e.text]},`${t}:${e.from}`))}),e.kind===`delegation-task`&&e.context&&(0,G.jsxs)(`details`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer`,children:t(`Context`)}),(0,G.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:e.context})]}),e.kind===`group`&&e.instruction&&(0,G.jsxs)(`details`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer`,children:t(`Instructions`)}),(0,G.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:e.instruction})]}),e.kind===`group`&&!!e.refs?.length&&(0,G.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:e.refs.map(e=>(0,G.jsxs)(`span`,{title:t(`Referenced chat`),className:`inline-flex h-6 max-w-56 items-center gap-1 rounded-md bg-muted px-1.5 text-xs`,children:[(0,G.jsx)(pn,{className:`h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]},e.id))}),e.kind===`group`&&e.note&&(0,G.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:t(`Dispatch hint: {{note}}`,{note:e.note})}),e.kind!==`group`&&!!e.group?.length&&(0,G.jsxs)(`details`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[(0,G.jsxs)(`summary`,{className:`cursor-pointer`,children:[t(`Group messages`),` · `,e.group.length]}),(0,G.jsx)(`div`,{className:`mt-1 whitespace-pre-wrap break-words`,children:e.group.map((e,t)=>(0,G.jsxs)(`p`,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[e.from,`:`]}),e.text]},`${t}:${e.from}`))})]})]})}async function HW(e,t){let n=await aP.getState().restartConversation(e);n&&vD({type:`error`,title:t(`Failed to restart conversation`),description:n})}function UW(e,t){if(!t)return null;for(let[n,r]of Object.entries(e))if(r?.sessionFile===t)return n;return null}function WW(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function GW(e){return e.alias?.trim()||(e.name===e.path?WW(e.path):e.name)}function KW(e,t,n){if(!t)return``;if(Sj(t))return wj(n,t.modelId);let r=e.find(e=>e.id===t.providerId);return r?`${r.name} / ${t.modelId}`:t.modelId}var qW=wW({});if(!qW)throw Error(`secretary default profile`);var JW=qW;function YW(e,t){let n=e??JW;return{name:e?.name.trim()||t,avatar:{color:n.avatar.color,...n.avatar.imageVersion?{imageVersion:n.avatar.imageVersion}:{}},takeoverScope:n.takeoverScope.mode===`projects`?{mode:`projects`,projectIds:[...n.takeoverScope.projectIds]}:n.takeoverScope,visibleProjectIds:n.visibleProjectIds===`all`?`all`:[...n.visibleProjectIds],maxRunningDispatches:n.maxRunningDispatches,patrolEnabled:n.patrolEnabled,cleanupSkipConfirm:n.cleanupSkipConfirm===!0,replyLanguage:n.replyLanguage,style:n.style,notify:n.notify,addressAs:n.addressAs??null,dailyBriefAt:n.dailyBriefAt??null}}function XW(e){return YW(null,e)}function ZW(e,t){switch(t.type){case`patch`:{let{avatar:n,...r}=t.patch;return{...e,...r,...n?{avatar:{...e.avatar,...n}}:{}}}case`reset`:return t.draft}}var QW=H.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:x,validation:S}=dN(),{clearErrors:C}=mN(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=gN(),O=bN({id:i});Y(()=>{let e=o!=null;S.inputRef.current?.value||e&&o!==``?b(!0):e&&o===``&&b(!1)},[S.inputRef,b,o]);let k=H.useRef(null);Y(()=>{u&&k.current===bb(Ny(k.current))&&y(!0)},[u,y]);let[A]=Pj({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=jy(()=>S.inputRef.current?.value);return fN(S.inputRef,O,M,N,!w,a),Vr(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:S.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,qy(Ly,e.nativeEvent)),_(t!==(v.initialValue??``)),b(t!==``),e.nativeEvent.defaultPrevented||(C(T),S.change(t))},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),x===`onBlur`&&S.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),S.commit(e.currentTarget.value))}},f,e=>S.getValidationProps(w,e)],stateAttributesMapping:sN})}),$W=H.forwardRef(function(e,t){return(0,G.jsx)(QW,{ref:t,...e})});function eG({className:e,size:t=`default`,unstyled:n=!1,...r}){return(0,G.jsx)(`span`,{className:W(!n&&`relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)]`,e)||void 0,"data-size":t,"data-slot":`input-control`,children:(0,G.jsx)($W,{className:W(`h-8.5 w-full min-w-0 rounded-[inherit] px-[calc(--spacing(3)-1px)] leading-8.5 outline-none placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5`,t===`sm`&&`h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5`,t===`lg`&&`h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5`,r.type===`search`&&`[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none`,r.type===`file`&&`text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm`),"data-slot":`input`,size:typeof t==`number`?t:void 0,...r})})}var tG=[`#7c5cff`,`#2f9e75`,`#c2553f`,`#2f7fc2`,`#b07a1e`,`#7a4fb5`],nG=/^#[0-9a-f]{6}$/iu;function rG(e){let t=e.trim();return nG.test(t)?t.toLowerCase():null}function iG(e){let t=e?rG(e):null,n=tG.find(e=>e===t)??null;return{preset:n,customSelected:t!==null&&n===null}}function aG({color:e,onChange:t}){let{t:n}=K(),[r,i]=(0,H.useState)(e);(0,H.useEffect)(()=>i(e),[e]);let a=iG(e),o=e=>{let n=rG(e);n&&t(n)};return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pointer-coarse:gap-[23px]`,"data-enso":`secretary-form-avatar`,children:[tG.map(e=>(0,G.jsx)(`button`,{type:`button`,"aria-pressed":a.preset===e,"aria-label":e,onClick:()=>t(e),style:{backgroundColor:e},className:W(`size-6 rounded-full border-2 transition-transform`,a.preset===e?`border-foreground`:`border-transparent hover:scale-105`)},e)),(0,G.jsxs)(`label`,{"data-enso":`secretary-form-avatar-custom`,"data-selected":a.customSelected?`true`:`false`,title:n(`Custom color`),style:a.customSelected?{backgroundColor:e}:void 0,className:W(`relative grid size-6 cursor-pointer place-items-center overflow-hidden rounded-full border-2 text-[10px] pointer-coarse:overflow-visible`,a.customSelected?`border-foreground text-white`:`border-border text-muted-foreground`),children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:a.customSelected?`sr-only`:void 0,children:`+`}),(0,G.jsx)(`input`,{type:`color`,"aria-label":n(`Custom color`),value:rG(e)??`#7c5cff`,onChange:e=>o(e.target.value),className:`absolute inset-0 cursor-pointer opacity-0 pointer-coarse:-inset-[12px]`})]}),(0,G.jsx)(eG,{"data-enso":`secretary-form-avatar-hex`,value:r,spellCheck:!1,"aria-label":n(`Custom color`),onChange:e=>{let t=e.target.value;i(t),o(t)},className:`h-7 w-24 font-mono text-xs`})]})}var oG=[1,2,3,4,5];function sG({value:e,options:t,onChange:n,enso:r}){let{t:i}=K();return(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,"data-enso":r,children:t.map(t=>(0,G.jsx)(`button`,{type:`button`,"aria-pressed":t.value===e,onClick:()=>n(t.value),className:W(`rounded-md border px-2.5 py-1 text-xs transition-colors`,t.value===e?`border-primary/60 bg-primary/10 text-foreground`:`border-border text-muted-foreground hover:bg-muted`),children:i(t.label)},t.value))})}function cG({label:e,hint:t,children:n}){let{t:r}=K();return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`p`,{className:`text-sm`,children:r(e)}),n,t?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(t)}):null]})}function lG({label:e,hint:t,checked:n,onChange:r,enso:i}){let{t:a}=K();return(0,G.jsxs)(`label`,{className:`flex items-start justify-between gap-3`,"data-enso":i,children:[(0,G.jsxs)(`span`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`block text-sm`,children:a(e)}),(0,G.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:a(t)})]}),(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,onClick:()=>r(!n),className:W(`relative mt-0.5 h-5 w-9 shrink-0 rounded-full border transition-colors`,n?`border-primary bg-primary`:`border-border bg-muted`),children:(0,G.jsx)(`span`,{className:W(`absolute top-0.5 size-3.5 rounded-full bg-background transition-all`,n?`left-[18px]`:`left-0.5`)})})]})}function uG({selected:e,onChange:t,enso:n}){let r=E(e=>e.projects).filter(e=>e.kind!==`scratch`&&e.kind!==`secretary`);return r.length===0?null:(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,"data-enso":n,children:r.map(n=>{let r=e.includes(n.id);return(0,G.jsx)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>t(r?e.filter(e=>e!==n.id):[...e,n.id]),className:W(`rounded-md border px-2.5 py-1 text-xs transition-colors`,r?`border-primary/60 bg-primary/10 text-foreground`:`border-border text-muted-foreground hover:bg-muted`),children:GW(n)},n.id)})})}function dG({initialDraft:e,submitLabel:t,onSubmit:n,busy:r=!1,error:i=null,allowDefaults:a=!1,onCancel:o,hideMaxRunning:s=!1}){let{t:c}=K(),[l,u]=H.useReducer(ZW,e),d=e=>u({type:`patch`,patch:e});return(0,G.jsxs)(`div`,{className:`space-y-4`,"data-enso":`secretary-profile-form`,children:[(0,G.jsx)(cG,{label:`Name`,children:(0,G.jsx)(eG,{"data-enso":`secretary-form-name`,value:l.name??``,onChange:e=>d({name:e.target.value}),className:`max-w-xs`})}),(0,G.jsx)(cG,{label:`Avatar color`,children:(0,G.jsx)(aG,{color:l.avatar?.color??`#7c5cff`,onChange:e=>d({avatar:{color:e}})})}),(0,G.jsxs)(cG,{label:`Visible projects`,children:[(0,G.jsx)(sG,{enso:`secretary-form-visible-mode`,value:l.visibleProjectIds===`all`?`all`:`selected`,options:[{value:`all`,label:`All projects`},{value:`selected`,label:`Selected projects`}],onChange:e=>d({visibleProjectIds:e===`all`?`all`:l.visibleProjectIds===`all`?[]:l.visibleProjectIds})}),l.visibleProjectIds===`all`?null:(0,G.jsx)(uG,{enso:`secretary-form-visible-projects`,selected:l.visibleProjectIds??[],onChange:e=>d({visibleProjectIds:e})})]}),!s&&(0,G.jsx)(cG,{label:`Running dispatches at most`,children:(0,G.jsx)(sG,{enso:`secretary-form-max-running`,value:String(l.maxRunningDispatches??3),options:oG.map(e=>({value:String(e),label:String(e)})),onChange:e=>d({maxRunningDispatches:Number(e)})})}),(0,G.jsx)(lG,{enso:`secretary-form-patrol`,label:`Watch running sessions automatically`,hint:`While anything is running the secretary checks it and only reports an anomaly: a goal session idle for 3 minutes with an unfinished goal and no live background task, idle for 20 minutes with a background task that never woke it, or running for 30 minutes without any event. Every hour it also reports background tasks left running in finished sessions; nothing is killed. Nothing is sent when all is well.`,checked:l.patrolEnabled??!0,onChange:e=>d({patrolEnabled:e})}),(0,G.jsx)(lG,{enso:`secretary-form-cleanup-skip-confirm`,label:`Clean up without asking`,hint:`Off by default. When on, this secretary's cleanup deletes immediately, with no confirmation card: merged local branches and their worktrees. Sessions are only archived, never deleted. Unmerged branches, branches in use, feat/secretary-agent, main, the current branch and worktrees with uncommitted changes are still refused or skipped.`,checked:l.cleanupSkipConfirm??!1,onChange:e=>d({cleanupSkipConfirm:e})}),i?(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:i}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(Oa,{size:`sm`,disabled:r,"data-enso":`secretary-form-submit`,onClick:()=>n(l),children:t}),o&&(0,G.jsx)(Oa,{variant:`ghost`,size:`sm`,disabled:r,onClick:o,children:c(`Cancel`)}),a&&(0,G.jsx)(`button`,{type:`button`,"data-enso":`secretary-form-defaults`,disabled:r,onClick:()=>n(XW(c(`Secretary`))),className:`text-xs text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,children:c(`Use all defaults and start`)})]})]})}var fG=new Set([`session_create`,`todo_item_dispatch`,`secretary_profile_propose`,`skill_propose`,`tool_propose`,`session_takeover_propose`,`cleanup_apply`]);function pG(e){if(!fG.has(e.name)||e.state===`running`||e.state===`error`||!e.output)return null;let t;try{t=JSON.parse(e.output)}catch{return null}if(!t||typeof t!=`object`)return null;let n=t;return n.status===`awaiting_confirmation`&&typeof n.proposalId==`string`?n.proposalId:null}var mG={pending:`Waiting for your confirmation`,executing:`Creating the session…`,succeeded:`Session created`,failed:`Failed`,rejected:`Rejected`,expired:`Expired`},hG={...mG,executing:`Saving the profile…`,succeeded:`Profile saved`};function gG(e){return W(`mb-1 w-full rounded-lg border px-2.5 py-2`,e?`border-warning/40 bg-warning/5`:`border-border/60 bg-muted/20`)}function _G(e){return e.draft.title?.trim()||e.draft.prompt.split(`
223
- `)[0]?.trim()||``}function vG({proposalId:e,prominent:t}){let{t:n}=K(),r=XR(t=>t.secretary.proposals[e]),i=XR(t=>t.resolving[e]===!0),a=XR(e=>e.resolveProposal),o=E(e=>e.projects),s=E(e=>e.providers)??[],c=E(e=>e.virtualModels);if(!r)return(0,G.jsx)(`div`,{"data-enso":`secretary-proposal`,className:W(gG(t),`text-[11px] text-muted-foreground`),children:n(`Waiting for your confirmation`)});if(r.kind===`profile`)return(0,G.jsx)(yG,{proposal:r,prominent:t});if(r.kind===`skill`)return(0,G.jsx)(TG,{proposal:r,prominent:t});if(r.kind===`tool`)return(0,G.jsx)(wG,{proposal:r,prominent:t});if(r.kind===`takeover`)return(0,G.jsx)(CG,{proposal:r,prominent:t});if(r.kind===`cleanup`)return(0,G.jsx)(jG,{proposal:r,prominent:t});let l=o.find(e=>e.id===r.draft.projectId),u=r.status===`failed`,d=KW(s,r.draft.model,c);return(0,G.jsxs)(`div`,{"data-enso":`secretary-proposal`,className:gG(t),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:n(`Dispatch`)}),l&&(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 text-[10px] text-muted-foreground`,children:GW(l)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:_G(r)}),(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 text-[10px] text-muted-foreground`,children:r.draft.worktree?n(`Isolated worktree`):n(`Project checkout`)})]}),(r.draft.branch||r.draft.baseRef||d||(r.draft.after?.length??0)>0)&&(0,G.jsxs)(`div`,{"data-enso":`secretary-proposal-base`,className:`mt-1 flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[r.draft.branch&&(0,G.jsx)(`span`,{children:r.draft.branch}),r.draft.baseRef&&(0,G.jsx)(`span`,{children:n(`from {{ref}}`,{ref:r.draft.baseRef})}),d&&(0,G.jsx)(`span`,{"data-enso":`secretary-proposal-model`,children:n(`Model: {{model}}`,{model:d})}),r.draft.after&&r.draft.after.length>0&&(0,G.jsx)(`span`,{children:n(`After {{ids}}`,{ids:r.draft.after.join(`, `)})})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:W(`text-[11px]`,u?`text-destructive`:`text-muted-foreground`),children:[n(mG[r.status]),u&&r.error?` · ${r.error}`:``]}),r.status===`pending`&&(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>void a(r.id,`confirm`),className:`rounded-md bg-primary px-2.5 py-1 text-xs text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50`,children:n(`Confirm dispatch`)}),(0,G.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>void a(r.id,`reject`),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:n(`Reject`)})]})]})]})}function yG({proposal:e,prominent:t}){let{t:n}=K(),r=XR(t=>t.resolving[e.id]===!0),i=XR(e=>e.resolveProposal),[a,o]=H.useState(!1),s=e.draft,c=e.status===`failed`,l=H.useMemo(()=>({...YW(null,n(`Secretary`)),...s}),[s,n]);return(0,G.jsxs)(`div`,{"data-enso":`secretary-proposal`,"data-kind":`profile`,className:gG(t),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:n(`Profile`)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:s.name??n(`Secretary`)})]}),(0,G.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:n(`Up to {{n}} at a time`,{n:s.maxRunningDispatches??3})}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsx)(`span`,{children:n(s.patrolEnabled===!1?`Patrol off`:`Patrol on`)}),(0,G.jsx)(`span`,{children:n(s.cleanupSkipConfirm?`Cleanup without confirmation`:`Cleanup asks first`)})]}),a?(0,G.jsx)(`div`,{className:`mt-2 border-t border-border/60 pt-2`,children:(0,G.jsx)(dG,{initialDraft:l,submitLabel:n(`Confirm`),busy:r,onSubmit:t=>{o(!1),i(e.id,`confirm`,void 0,t)},onCancel:()=>o(!1)})}):(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:W(`text-[11px]`,c?`text-destructive`:`text-muted-foreground`),children:[n(hG[e.status]),c&&e.error?` · ${e.error}`:``]}),e.status===`pending`&&(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void i(e.id,`confirm`),className:`rounded-md bg-primary px-2.5 py-1 text-xs text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50`,children:n(`Confirm`)}),(0,G.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void i(e.id,`reject`),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:n(`Reject`)}),(0,G.jsx)(`button`,{type:`button`,"data-enso":`secretary-proposal-edit`,disabled:r,onClick:()=>o(!0),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:n(`Edit here`)})]})]})]})}var bG={...mG,executing:`Saving the skill…`,succeeded:`Skill saved`},xG={...mG,executing:`Saving the tool…`,succeeded:`Tool saved`},SG={...mG,executing:`Handing it over…`,succeeded:`Handed over to the secretary`};function CG({proposal:e,prominent:t}){let{t:n}=K(),r=XR(t=>t.resolving[e.id]===!0),i=XR(e=>e.resolveProposal),a=E(e=>e.projects).find(t=>t.id===e.draft.projectId),o=e.status===`failed`;return(0,G.jsxs)(`div`,{"data-enso":`secretary-proposal`,"data-kind":`takeover`,className:gG(t),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:n(`Take over`)}),a&&(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 text-[10px] text-muted-foreground`,children:GW(a)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.draft.title??n(`Unnamed`)})]}),(0,G.jsxs)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:[n(`The secretary asks to manage this session: it may message and stop it like its own.`),e.draft.reason?` ${e.draft.reason}`:``]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:W(`text-[11px]`,o?`text-destructive`:`text-muted-foreground`),children:[n(SG[e.status]),o&&e.error?` · ${e.error}`:``]}),e.status===`pending`&&(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void i(e.id,`confirm`),className:`rounded-md bg-primary px-2.5 py-1 text-xs text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50`,children:n(`Allow takeover`)}),(0,G.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void i(e.id,`reject`),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:n(`Reject`)})]})]})]})}function wG({proposal:e,prominent:t}){let{t:n}=K(),r=XR(t=>t.resolving[e.id]===!0),i=XR(e=>e.resolveProposal),a=e.draft,o=e.status===`failed`;return(0,G.jsxs)(`div`,{"data-enso":`secretary-proposal`,"data-kind":`tool`,className:gG(t),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:n(`Tool`)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:a.name}),(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 text-[10px] text-muted-foreground`,children:a.runtime===`python`?`Python`:`Node`}),(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 text-[10px] text-muted-foreground`,children:a.readOnly?n(`Read-only`):n(`Asks every call`)}),(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 text-[10px] text-muted-foreground`,children:e.previous?n(`Update`):n(`New`)})]}),(0,G.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:a.description}),(0,G.jsxs)(`details`,{className:`mt-1.5 rounded border border-border/60 bg-background/40 px-2 py-1`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-muted-foreground`,children:n(`Show the arguments`)}),(0,G.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre-wrap text-[11px]`,children:JSON.stringify(a.parameters,null,2)})]}),(0,G.jsxs)(`details`,{className:`mt-1 rounded border border-border/60 bg-background/40 px-2 py-1`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-muted-foreground`,children:n(`Show the code`)}),(0,G.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre font-mono text-[11px]`,children:a.code})]}),e.previous?(0,G.jsxs)(`details`,{className:`mt-1 rounded border border-border/60 bg-background/40 px-2 py-1`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-muted-foreground`,children:n(`Show the current version`)}),(0,G.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre font-mono text-[11px]`,children:e.previous.code})]}):null,(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:W(`text-[11px]`,o?`text-destructive`:`text-muted-foreground`),children:[n(xG[e.status]),o&&e.error?` · ${e.error}`:``]}),e.status===`pending`&&(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void i(e.id,`confirm`),className:`rounded-md bg-primary px-2.5 py-1 text-xs text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50`,children:n(`Confirm`)}),(0,G.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void i(e.id,`reject`),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:n(`Reject`)})]})]})]})}function TG({proposal:e,prominent:t}){let{t:n}=K(),r=XR(t=>t.resolving[e.id]===!0),i=XR(e=>e.resolveProposal),a=e.draft,o=e.status===`failed`;return(0,G.jsxs)(`div`,{"data-enso":`secretary-proposal`,"data-kind":`skill`,className:gG(t),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:n(`Skill`)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:a.name}),(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 text-[10px] text-muted-foreground`,children:e.previous?n(`Update`):n(`New`)})]}),(0,G.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:a.description}),(0,G.jsxs)(`details`,{className:`mt-1.5 rounded border border-border/60 bg-background/40 px-2 py-1`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-muted-foreground`,children:n(`Show the content`)}),(0,G.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre-wrap text-[11px]`,children:a.body})]}),e.previous?(0,G.jsxs)(`details`,{className:`mt-1 rounded border border-border/60 bg-background/40 px-2 py-1`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-muted-foreground`,children:n(`Show the current version`)}),(0,G.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre-wrap text-[11px]`,children:e.previous.body})]}):null,(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:W(`text-[11px]`,o?`text-destructive`:`text-muted-foreground`),children:[n(bG[e.status]),o&&e.error?` · ${e.error}`:``]}),e.status===`pending`&&(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void i(e.id,`confirm`),className:`rounded-md bg-primary px-2.5 py-1 text-xs text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50`,children:n(`Confirm`)}),(0,G.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void i(e.id,`reject`),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:n(`Reject`)})]})]})]})}var EG={...mG,executing:`Cleaning up…`,succeeded:`Cleanup done`},DG={branch:`Branch`,worktree:`Worktree`,session:`Session`},OG={"not-merged":`Not merged yet`,"current-branch":`Currently checked out`,"used-by-worktree":`Used by a worktree`,"detached-head":`Detached HEAD`,"uncommitted-changes":`Has uncommitted changes`};function kG(e){return e===void 0?null:e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}var AG=5;function jG({proposal:e,prominent:t}){let{t:n}=K(),r=XR(t=>t.resolving[e.id]===!0),i=XR(e=>e.resolveProposal),a=e.draft.items,o=a.slice(0,AG),s=a.length-o.length,c=e.status===`failed`,l=a.reduce((e,t)=>(e[t.kind]=(e[t.kind]??0)+1,e),{});return(0,G.jsxs)(`div`,{"data-enso":`secretary-proposal`,"data-kind":`cleanup`,className:gG(t),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:n(`Clean up`)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n(`{{count}} items`,{count:a.length})}),[`branch`,`worktree`,`session`].map(e=>l[e]?(0,G.jsxs)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 text-[10px] text-muted-foreground`,children:[l[e],` `,n(DG[e])]},e):null)]}),(0,G.jsxs)(`ul`,{"data-enso":`secretary-cleanup-items`,className:`mt-1.5 space-y-0.5`,children:[o.map(e=>{let t=kG(e.sizeBytes),r=[e.mergedInto?.length?n(`merged into {{refs}}`,{refs:e.mergedInto.join(`, `)}):null,t,e.blocked?n(OG[e.blocked]??e.blocked):null].filter(Boolean);return(0,G.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-1.5 text-[11px]`,children:[(0,G.jsx)(`span`,{"data-enso":`secretary-cleanup-kind`,className:`shrink-0 rounded bg-muted px-1 text-[10px] text-muted-foreground`,children:n(DG[e.kind])}),(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono`,children:e.name}),r.length>0&&(0,G.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:r.join(` · `)})]},e.id)}),s>0&&(0,G.jsx)(`li`,{"data-enso":`secretary-cleanup-rest`,className:`text-[11px] text-muted-foreground`,children:n(`and {{count}} more`,{count:s})})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:W(`text-[11px]`,c?`text-destructive`:`text-muted-foreground`),children:[n(EG[e.status]),c&&e.error?` · ${e.error}`:``,e.report?` · ${e.report}`:``]}),e.status===`pending`&&(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,"data-enso":`secretary-cleanup-confirm`,disabled:r,onClick:()=>void i(e.id,`confirm`),className:`rounded-md bg-primary px-2.5 py-1 text-xs text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50`,children:n(`Confirm cleanup`)}),(0,G.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>void i(e.id,`reject`),className:`rounded-md px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,children:n(`Reject`)})]})]})]})}function MG(e){let[t,n]=H.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=H.useRef(null),i=H.useRef(null),a=H.useRef(null),o=H.useRef(null),s=H.useRef(!0),c=H.useRef(null),l=Zy(),u=H.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:a,backdropRef:r,internalBackdropRef:i,positionerRef:o,allowMouseUpTriggerRef:s,initialCursorPointRef:c,rootId:l}),[t,l]);return(0,G.jsx)(jj.Provider,{value:u,children:(0,G.jsx)(kj.Provider,{value:void 0,children:(0,G.jsx)(gM,{...e})})})}var NG=500,PG=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{setAnchor:o,actionsRef:s,internalBackdropRef:c,backdropRef:l,positionerRef:u,allowMouseUpTriggerRef:d,initialCursorPointRef:f,rootId:p}=Mj(!1),{store:m}=Aj(!1),h=m.useState(`open`),g=m.useState(`disabled`),_=H.useRef(null),v=H.useRef(null),y=rb(),b=rb(),x=H.useRef(!1),S=H.useRef(null);function C(e,t,n){let r=n.type.startsWith(`touch`);f.current={x:e,y:t},o({getBoundingClientRect(){return DOMRect.fromRect({width:r?10:0,height:r?10:0,x:e,y:t})}}),x.current=!1,s.current?.setOpen(!0,qy(Ry,n)),b.start(NG,()=>{x.current=!0})}function w(e){if(g)return;d.current=!0,fb(e),C(e.clientX,e.clientY,e.nativeEvent);let t=Ny(_.current);S.current?.abort();let n=new AbortController;S.current=n,t.addEventListener(`mouseup`,e=>{if(d.current=!1,!x.current)return;b.clear(),x.current=!1;let t=Sb(e);xb(u.current,t)||p&&t&&CM(t)===p||s.current?.setOpen(!1,qy(Wy,e))},{once:!0,signal:n.signal})}function T(){y.clear(),v.current=null}function E(e){if(g){T();return}if(d.current=!1,e.touches.length!==1){T();return}e.stopPropagation();let t=e.touches[0],n={x:t.clientX,y:t.clientY};v.current=n,y.start(NG,()=>{C(n.x,n.y,e.nativeEvent)})}function D(e){if(e.touches.length!==1){T();return}if(y.isStarted()&&v.current){let t=e.touches[0],n=Math.abs(t.clientX-v.current.x),r=Math.abs(t.clientY-v.current.y);(n>10||r>10)&&T()}}return H.useEffect(()=>()=>{S.current?.abort()},[]),H.useEffect(()=>{function e(e){if(g)return;let t=Sb(e);(xb(_.current,t)||xb(c.current,t)||xb(l.current,t))&&e.preventDefault()}return Ib(Ny(_.current),`contextmenu`,e)},[l,g,c]),Vr(`div`,e,{state:{open:h},ref:[_,t],props:[{onContextMenu:w,onTouchStart:E,onTouchMove:D,onTouchEnd:T,onTouchCancel:T,style:{WebkitTouchCallout:`none`}},a],stateAttributesMapping:ey})}),FG=MG;function IG(e){return(0,G.jsx)(PG,{"data-slot":`context-menu-trigger`,...e})}function LG({children:e,className:t,zIndex:n,...r}){return(0,G.jsxs)(Zj,{children:[(0,G.jsx)(Nj,{className:`fixed inset-0 z-40`,"data-enso-float":``,style:n===void 0?void 0:{zIndex:n-1}}),(0,G.jsx)(sM,{className:`z-50`,"data-slot":`context-menu-positioner`,style:n===void 0?void 0:{zIndex:n},children:(0,G.jsx)(Jj,{className:W(qM,t),"data-slot":`context-menu-popup`,...r,children:(0,G.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1.5`,children:e})})})]})}function RG({className:e,variant:t=`default`,...n}){return(0,G.jsx)(Gj,{className:W(XM,e),"data-slot":`context-menu-item`,"data-variant":t,...n})}async function zG(e){let t=/^data:([^;,]+);base64,(.*)$/s.exec(e);if(!t)return(await fetch(e)).blob();let n=atob(t[2]),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return new Blob([r],{type:t[1]})}async function BG(e){let t=await zG(e),n=t;if(t.type!==`image/png`){let e=await createImageBitmap(t),r=new OffscreenCanvas(e.width,e.height);r.getContext(`2d`)?.drawImage(e,0,0),e.close(),n=await r.convertToBlob({type:`image/png`})}await navigator.clipboard.write([new ClipboardItem({"image/png":n})])}function VG({src:e,className:t,frameClassName:n,onError:r,alt:i=``,lazy:a=!1,children:o,title:s}){let{t:c}=K(),[l,u]=(0,H.useState)(!1);kE(l),(0,H.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&u(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]);let d=()=>{BG(e).then(()=>vD({type:`success`,title:c(`Image copied`)}),e=>vD({type:`error`,title:c(`Could not copy image`),description:e instanceof Error?e.message:String(e)}))};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(FG,{children:[(0,G.jsx)(IG,{render:(0,G.jsx)(`button`,{type:`button`,onClick:()=>u(!0),title:s,className:W(`cursor-zoom-in`,n),children:o??(0,G.jsx)(`img`,{src:e,alt:i,className:t,onError:r,...a?{loading:`lazy`,decoding:`async`}:{}})}),onContextMenu:e=>e.stopPropagation()}),(0,G.jsx)(LG,{className:`min-w-36`,children:(0,G.jsx)(RG,{closeOnClick:!0,onClick:d,children:c(`Copy image`)})})]}),l&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>u(!1),className:W(`fixed inset-0 flex cursor-zoom-out items-center justify-center bg-black/75`),style:{zIndex:BE.NESTED_MODAL_BACKDROP},"data-enso-float":``,children:(0,G.jsx)(`img`,{src:e,alt:``,className:`max-h-[92vh] max-w-[92vw] rounded-lg object-contain`})})]})}var HG={"too-large":`over 10 MB, not saved`,"not-image":`not a png / jpeg / webp / gif image, not saved`,unavailable:`could not be saved`};function UG(e){return e.split(/[\\/]/u).pop()??e}function WG({entries:e,thumbnails:t=0,align:n=`end`}){let{t:r}=K(),i=e.filter(e=>`path`in e&&e.index>t),a=e.filter(e=>`rejected`in e);return i.length===0&&a.length===0?null:(0,G.jsxs)(`div`,{"data-enso":`inbound-images`,className:W(`flex flex-col gap-1`,n===`end`?`items-end`:`items-start`),children:[i.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,G.jsxs)(VG,{src:f(e.path),title:UG(e.path),frameClassName:`inline-flex h-6 items-center gap-1 rounded-md bg-muted px-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(tn,{className:`size-3 shrink-0`}),(0,G.jsx)(`span`,{children:r(`Image {{n}}`,{n:e.index})})]},e.index))}),a.map(e=>(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`Image {{n}} not accepted: {{reason}}`,{n:e.index,reason:r(HG[e.rejected])})},e.index))]})}var GG={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,bmp:`image/bmp`,ico:`image/x-icon`,avif:`image/avif`,svg:`image/svg+xml`};function KG(e){let t=e.split(/[?#]/)[0]??``,n=t.lastIndexOf(`.`);return n<0?null:GG[t.slice(n+1).toLowerCase()]??null}var qG=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YG={};function XG(e,t){return((t||YG).jsx?JG:qG).test(e)}var ZG=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
224
- `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),QG=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(ZG());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),$G=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),eK=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(QG()),r=$G();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),tK=rK(`end`),nK=rK(`start`);function rK(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function iK(e){let t=nK(e),n=tK(e);if(t&&n)return{start:t,end:n}}function aK(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?sK(e.position):`start`in e||`end`in e?sK(e):`line`in e||`column`in e?oK(e):``}function oK(e){return cK(e&&e.line)+`:`+cK(e&&e.column)}function sK(e){return oK(e&&e.start)+`-`+oK(e&&e.end)}function cK(e){return e&&typeof e==`number`?e:1}var lK=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=aK(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};lK.prototype.file=``,lK.prototype.name=``,lK.prototype.reason=``,lK.prototype.message=``,lK.prototype.stack=``,lK.prototype.column=void 0,lK.prototype.line=void 0,lK.prototype.ancestors=void 0,lK.prototype.cause=void 0,lK.prototype.fatal=void 0,lK.prototype.place=void 0,lK.prototype.ruleId=void 0,lK.prototype.source=void 0;var uK=e(eK(),1),dK={}.hasOwnProperty,fK=new Map,pK=/[A-Z]/g,mK=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),hK=new Set([`td`,`th`]),gK=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function _K(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=OK(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=DK(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Nd:Md,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=vK(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function vK(e,t,n){if(t.type===`element`)return yK(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return bK(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return SK(e,t,n);if(t.type===`mdxjsEsm`)return xK(e,t);if(t.type===`root`)return CK(e,t,n);if(t.type===`text`)return wK(e,t)}function yK(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Nd,e.schema=i),e.ancestors.push(t);let a=PK(e,t.tagName,!1),o=kK(e,t),s=jK(e,t);return mK.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!mf(e)})),TK(e,o,a,t),EK(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function bK(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}FK(e,t.position)}function xK(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);FK(e,t.position)}function SK(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Nd,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:PK(e,t.name,!0),o=AK(e,t),s=jK(e,t);return TK(e,o,a,t),EK(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function CK(e,t,n){let r={};return EK(r,jK(e,t)),e.create(t,e.Fragment,r,n)}function wK(e,t){return t.value}function TK(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function EK(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function DK(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function OK(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=nK(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function kK(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&dK.call(t.properties,i)){let a=MK(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&hK.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function AK(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else FK(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else FK(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function jK(e,t){let n=[],r=-1,i=e.passKeys?new Map:fK;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=vK(e,a,o);s!==void 0&&n.push(s)}return n}function MK(e,t,n){let r=kd(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?df(n):ff(n)),r.property===`style`){let t=typeof n==`object`?n:NK(e,String(n));return e.stylePropertyNameCase===`css`&&(t=IK(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Td[r.property]||r.property:r.attribute,n]}}function NK(e,t){try{return(0,uK.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new lK("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=gK+`#cannot-parse-style-attribute`,r}}function PK(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=XG(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=XG(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return dK.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);FK(e)}function FK(e,t){let n=new lK("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=gK+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function IK(e){let t={},n;for(n in e)dK.call(e,n)&&(t[LK(n)]=e[n]);return t}function LK(e){let t=e.replace(pK,RK);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function RK(e){return`-`+e.toLowerCase()}var zK={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},BK={};function VK(e,t){let n=t||BK;return HK(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function HK(e,t,n){if(WK(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return UK(e.children,t,n)}return Array.isArray(e)?UK(e,t,n):``}function UK(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=HK(e[i],t,n);return r.join(``)}function WK(e){return!!(e&&typeof e==`object`)}var GK=document.createElement(`i`);function KK(e){let t=`&`+e+`;`;GK.innerHTML=t;let n=GK.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function qK(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function JK(e,t){return e.length>0?(qK(e,e.length,0,t),e):t}var YK={}.hasOwnProperty;function XK(e){let t={},n=-1;for(;++n<e.length;)ZK(t,e[n]);return t}function ZK(e,t){let n;for(n in t){let r=(YK.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){YK.call(r,a)||(r[a]=[]);let e=i[a];QK(r[a],Array.isArray(e)?e:e?[e]:[])}}}function QK(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);qK(e,0,0,r)}function $K(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function eq(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var tq=pq(/[A-Za-z]/),nq=pq(/[\dA-Za-z]/),rq=pq(/[#-'*+\--9=?A-Z^-~]/);function iq(e){return e!==null&&(e<32||e===127)}var aq=pq(/\d/),oq=pq(/[\dA-Fa-f]/),sq=pq(/[!-/:-@[-`{-~]/);function cq(e){return e!==null&&e<-2}function lq(e){return e!==null&&(e<0||e===32)}function uq(e){return e===-2||e===-1||e===32}var dq=pq(/\p{P}|\p{S}/u),fq=pq(/\s/);function pq(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function mq(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&nq(e.charCodeAt(n+1))&&nq(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function hq(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return uq(r)?(e.enter(n),s(r)):t(r)}function s(r){return uq(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var gq={tokenize:_q};function _q(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),hq(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return cq(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var vq={tokenize:bq},yq={tokenize:xq};function bq(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return qK(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(yq,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(yq,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return cq(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;qK(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function xq(e,t,n){return hq(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Sq(e){if(e===null||lq(e)||fq(e))return 1;if(dq(e))return 2}function Cq(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var wq={name:`attention`,resolveAll:Tq,tokenize:Eq};function Tq(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Dq(d,-c),Dq(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=JK(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=JK(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=JK(l,Cq(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=JK(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=JK(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,qK(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Eq(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Sq(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Sq(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Dq(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Oq={name:`autolink`,tokenize:kq};function kq(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return tq(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||nq(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||nq(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||iq(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):rq(t)?(e.consume(t),l):n(t)}function u(e){return nq(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||nq(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Aq={partial:!0,tokenize:jq};function jq(e,t,n){return r;function r(t){return uq(t)?hq(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||cq(e)?t(e):n(e)}}var Mq={continuation:{tokenize:Pq},exit:Fq,name:`blockQuote`,tokenize:Nq};function Nq(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return uq(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Pq(e,t,n){let r=this;return i;function i(t){return uq(t)?hq(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Mq,t,n)(r)}}function Fq(e){e.exit(`blockQuote`)}var Iq={name:`characterEscape`,tokenize:Lq};function Lq(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return sq(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Rq={name:`characterReference`,tokenize:zq};function zq(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=nq,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=oq,u):(e.enter(`characterReferenceValue`),a=7,o=aq,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===nq&&!KK(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Bq={partial:!0,tokenize:Uq},Vq={concrete:!0,name:`codeFenced`,tokenize:Hq};function Hq(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),uq(t)?hq(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||cq(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Bq,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||cq(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):uq(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),hq(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||cq(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||cq(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&uq(t)?hq(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||cq(t)?e.check(Bq,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||cq(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),uq(t)?hq(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),uq(t)?hq(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||cq(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Uq(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Wq={name:`codeIndented`,tokenize:Kq},Gq={partial:!0,tokenize:qq};function Kq(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),hq(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):cq(t)?e.attempt(Gq,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||cq(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function qq(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):cq(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):hq(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):cq(e)?i(e):n(e)}}var Jq={name:`codeText`,previous:Xq,resolve:Yq,tokenize:Zq};function Yq(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Xq(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Zq(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):cq(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||cq(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Qq=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&$q(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),$q(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),$q(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);$q(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);$q(this.left,t.reverse())}}}};function $q(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function eJ(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Qq(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,tJ(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return qK(e,0,1/0,u.slice(0)),!l}function tJ(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var nJ={resolve:iJ,tokenize:aJ},rJ={partial:!0,tokenize:oJ};function iJ(e){return eJ(e),e}function aJ(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):cq(t)?e.check(rJ,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function oJ(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),hq(e,a,`linePrefix`)}function a(i){if(i===null||cq(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function sJ(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||iq(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||cq(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||lq(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||iq(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function cJ(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):cq(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||cq(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!uq(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function lJ(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):cq(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),hq(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||cq(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function uJ(e,t){let n;return r;function r(i){return cq(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):uq(i)?hq(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var dJ={name:`definition`,tokenize:pJ},fJ={partial:!0,tokenize:mJ};function pJ(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return cJ.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=eq(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return lq(t)?uJ(e,l)(t):l(t)}function l(t){return sJ(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(fJ,d,d)(t)}function d(t){return uq(t)?hq(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||cq(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function mJ(e,t,n){return r;function r(t){return lq(t)?uJ(e,i)(t):n(t)}function i(t){return lJ(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return uq(t)?hq(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||cq(e)?t(e):n(e)}}var hJ={name:`hardBreakEscape`,tokenize:gJ};function gJ(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return cq(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var _J={name:`headingAtx`,resolve:vJ,tokenize:yJ};function vJ(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},qK(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function yJ(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||lq(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||cq(n)?(e.exit(`atxHeading`),t(n)):uq(n)?hq(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||lq(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var bJ=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),xJ=[`pre`,`script`,`style`,`textarea`],SJ={concrete:!0,name:`htmlFlow`,resolveTo:TJ,tokenize:EJ},CJ={partial:!0,tokenize:OJ},wJ={partial:!0,tokenize:DJ};function TJ(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function EJ(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):tq(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):tq(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return tq(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||lq(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&xJ.includes(l)?(i=1,r.interrupt?t(s):O(s)):bJ.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||nq(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return uq(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||tq(t)?(e.consume(t),b):uq(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||nq(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):uq(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):uq(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||cq(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||lq(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||uq(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||cq(t)?O(t):uq(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),ee):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):cq(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(CJ,L,k)(t)):t===null||cq(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(wJ,A,L)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||cq(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return xJ.includes(n)?(e.consume(t),ee):O(t)}return tq(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),ee):t===45&&i===2?(e.consume(t),I):O(t)}function ee(t){return t===null||cq(t)?(e.exit(`htmlFlowData`),L(t)):(e.consume(t),ee)}function L(n){return e.exit(`htmlFlow`),t(n)}}function DJ(e,t,n){let r=this;return i;function i(t){return cq(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function OJ(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Aq,t,n)}}var kJ={name:`htmlText`,tokenize:AJ};function AJ(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):tq(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):tq(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):cq(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):cq(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):cq(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):cq(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return tq(t)?(e.consume(t),S):n(t)}function S(t){return t===45||nq(t)?(e.consume(t),S):C(t)}function C(t){return cq(t)?(o=C,N(t)):uq(t)?(e.consume(t),C):M(t)}function w(t){return t===45||nq(t)?(e.consume(t),w):t===47||t===62||lq(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||tq(t)?(e.consume(t),E):cq(t)?(o=T,N(t)):uq(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||nq(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):cq(t)?(o=D,N(t)):uq(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):cq(t)?(o=O,N(t)):uq(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):cq(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||lq(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||lq(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return uq(t)?hq(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var jJ={name:`labelEnd`,resolveAll:FJ,resolveTo:IJ,tokenize:LJ},MJ={tokenize:RJ},NJ={tokenize:zJ},PJ={tokenize:BJ};function FJ(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&qK(e,0,e.length,n),e}function IJ(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=JK(s,e.slice(a+1,a+r+3)),s=JK(s,[[`enter`,u,t]]),s=JK(s,Cq(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=JK(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=JK(s,e.slice(o+1)),s=JK(s,[[`exit`,c,t]]),qK(e,a,e.length,s),e}function LJ(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(eq(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(MJ,u,o?u:d)(t):t===91?e.attempt(NJ,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(PJ,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function RJ(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return lq(t)?uJ(e,a)(t):a(t)}function a(t){return t===41?u(t):sJ(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return lq(t)?uJ(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?lJ(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return lq(t)?uJ(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function zJ(e,t,n){let r=this;return i;function i(t){return cJ.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(eq(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function BJ(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var VJ={name:`labelStartImage`,resolveAll:jJ.resolveAll,tokenize:HJ};function HJ(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var UJ={name:`labelStartLink`,resolveAll:jJ.resolveAll,tokenize:WJ};function WJ(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var GJ={name:`lineEnding`,tokenize:KJ};function KJ(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),hq(e,t,`linePrefix`)}}var qJ={name:`thematicBreak`,tokenize:JJ};function JJ(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||cq(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),uq(t)?hq(e,s,`whitespace`)(t):s(t))}}var YJ={continuation:{tokenize:$J},exit:tY,name:`list`,tokenize:QJ},XJ={partial:!0,tokenize:nY},ZJ={partial:!0,tokenize:eY};function QJ(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:aq(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(qJ,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return aq(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Aq,r.interrupt?n:u,e.attempt(XJ,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return uq(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function $J(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Aq,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,hq(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!uq(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ZJ,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,hq(e,e.attempt(YJ,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function eY(e,t,n){let r=this;return hq(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function tY(e){e.exit(this.containerState.type)}function nY(e,t,n){let r=this;return hq(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!uq(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var rY={name:`setextUnderline`,resolveTo:iY,tokenize:aY};function iY(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function aY(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),uq(t)?hq(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||cq(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var oY={tokenize:sY};function sY(e){let t=this,n=e.attempt(Aq,r,e.attempt(this.parser.constructs.flowInitial,i,hq(e,e.attempt(this.parser.constructs.flow,i,e.attempt(nJ,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var cY={resolveAll:fY()},lY=dY(`string`),uY=dY(`text`);function dY(e){return{resolveAll:fY(e===`text`?pY:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function fY(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function pY(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var mY=t({attentionMarkers:()=>SY,contentInitial:()=>gY,disable:()=>CY,document:()=>hY,flow:()=>vY,flowInitial:()=>_Y,insideSpan:()=>xY,string:()=>yY,text:()=>bY}),hY={42:YJ,43:YJ,45:YJ,48:YJ,49:YJ,50:YJ,51:YJ,52:YJ,53:YJ,54:YJ,55:YJ,56:YJ,57:YJ,62:Mq},gY={91:dJ},_Y={[-2]:Wq,[-1]:Wq,32:Wq},vY={35:_J,42:qJ,45:[rY,qJ],60:SJ,61:rY,95:qJ,96:Vq,126:Vq},yY={38:Rq,92:Iq},bY={[-5]:GJ,[-4]:GJ,[-3]:GJ,33:VJ,38:Rq,42:wq,60:[Oq,kJ],91:UJ,92:[hJ,Iq],93:jJ,95:wq,96:Jq},xY={null:[wq,cY]},SY={null:[42,95]},CY={null:[]};function wY(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=JK(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Cq(a,l.events,l),l.events):[]}function f(e,t){return EY(p(e),t)}function p(e){return TY(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){cq(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&qK(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function TY(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function EY(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
225
- `;break;case-3:o=`\r
226
- `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function DY(e){let t={constructs:XK([mY,...(e||{}).extensions||[]]),content:n(gq),defined:[],document:n(vq),flow:n(oY),lazy:{},string:n(lY),text:n(uY)};return t;function n(e){return n;function n(n){return wY(t,e,n)}}}function OY(e){for(;!eJ(e););return e}var kY=/[\0\t\n\r]/g;function AY(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(kY.lastIndex=u,c=kY.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var jY=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MY(e){return e.replace(jY,NY)}function NY(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return $K(n.slice(t?2:1),t?16:10)}return KK(n)||e}var PY={}.hasOwnProperty;function FY(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),IY(n)(OY(DY(n).document().write(AY()(e,t,!0))))}function IY(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(pe),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(le),blockQuote:a(ie),characterEscape:T,characterReference:T,codeFenced:a(ae),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ae,o),codeText:a(oe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(se),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ce),hardBreakEscape:a(ue),hardBreakTrailing:a(ue),htmlFlow:a(de,o),htmlFlowData:T,htmlText:a(de,o),htmlTextData:T,image:a(fe),label:o,link:a(pe),listItem:a(he),listItemValue:f,listOrdered:a(me,d),listUnordered:a(me),paragraph:a(ge),reference:te,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(le),strong:a(_e),thematicBreak:a(ye)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:re,autolinkProtocol:V,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:B,characterReference:ne,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:R,resourceDestinationString:I,resourceTitleString:ee,resource:L,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};RY(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];PY.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||BY).call(a,void 0,e[0])}for(r.position={start:LY(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:LY(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:LY(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||BY).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+aK({start:e.start,end:e.end})+`): it’s not open`);n.position.end=LY(e.end)}function u(){return VK(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=eq(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=ve(),n.position={start:LY(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=LY(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=LY(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=MY(t),n.identifier=eq(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function L(){this.data.inReference=void 0}function te(){this.data.referenceType=`collapsed`}function R(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=eq(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function z(e){this.data.characterReferenceType=e.type}function B(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=$K(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=KK(t);let i=this.stack[this.stack.length-1];i.value+=r}function ne(e){let t=this.stack.pop();t.position.end=LY(e.end)}function V(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function re(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ie(){return{type:`blockquote`,children:[]}}function ae(){return{type:`code`,lang:null,meta:null,value:``}}function oe(){return{type:`inlineCode`,value:``}}function se(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ce(){return{type:`emphasis`,children:[]}}function le(){return{type:`heading`,depth:0,children:[]}}function ue(){return{type:`break`}}function de(){return{type:`html`,value:``}}function fe(){return{type:`image`,title:null,url:``,alt:null}}function pe(){return{type:`link`,title:null,url:``,children:[]}}function me(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function he(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function ge(){return{type:`paragraph`,children:[]}}function _e(){return{type:`strong`,children:[]}}function ve(){return{type:`text`,value:``}}function ye(){return{type:`thematicBreak`}}}function LY(e){return{line:e.line,column:e.column,offset:e.offset}}function RY(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?RY(e,r):zY(e,r)}}function zY(e,t){let n;for(n in t)if(PY.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function BY(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+aK({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+aK({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+aK({start:t.start,end:t.end})+`) is still open`)}function VY(e){let t=this;t.parser=n;function n(n){return FY(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function HY(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function UY(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
227
- `}]}function WY(e,t){let n=t.value?t.value+`
228
- `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function GY(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KY(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qY(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=mq(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function JY(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YY(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function XY(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function ZY(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return XY(e,t);let i={src:mq(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function QY(e,t){let n={src:mq(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function $Y(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function eX(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return XY(e,t);let i={href:mq(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function tX(e,t){let n={href:mq(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function nX(e,t,n){let r=e.all(t),i=n?rX(n):iX(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
229
- `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
230
- `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function rX(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=iX(n[r])}return t}function iX(e){return e.spread??e.children.length>1}function aX(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function oX(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sX(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function cX(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lX(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=nK(t.children[1]),o=tK(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function uX(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function dX(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var fX=9,pX=32;function mX(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(hX(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(hX(t.slice(i),i>0,!1)),a.join(``)}function hX(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===fX||t===pX;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===fX||t===pX;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function gX(e,t){let n={type:`text`,value:mX(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function _X(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var vX={blockquote:HY,break:UY,code:WY,delete:GY,emphasis:KY,footnoteReference:qY,heading:JY,html:YY,imageReference:ZY,image:QY,inlineCode:$Y,linkReference:eX,link:tX,listItem:nX,list:aX,paragraph:oX,root:sX,strong:cX,table:lX,tableCell:dX,tableRow:uX,text:gX,thematicBreak:_X,toml:yX,yaml:yX,definition:yX,footnoteDefinition:yX};function yX(){}var bX=typeof self==`object`?self:globalThis,xX=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new bX[e](t)},SX=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof bX[e]==`function`?xX(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(xX(a,o),i)};return r},CX=e=>SX(new Map,e)(0),wX=``,{toString:TX}={},{keys:EX}=Object,DX=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=TX.call(e).slice(8,-1);switch(n){case`Array`:return[1,wX];case`Object`:return[2,wX];case`Date`:return[3,wX];case`RegExp`:return[4,wX];case`Map`:return[5,wX];case`Set`:return[6,wX];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},OX=([e,t])=>e===0&&(t===`function`||t===`symbol`),kX=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=DX(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of EX(r))(e||!OX(DX(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?wX:r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(OX(DX(n))||OX(DX(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!OX(DX(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},AX=(e,{json:t,lossy:n}={})=>{let r=[];return kX(!(t||n),!!t,new Map,r)(e),r},jX=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?CX(AX(e,t)):structuredClone(e):(e,t)=>CX(AX(e,t));function MX(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function NX(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function PX(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||MX,r=e.options.footnoteBackLabel||NX,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=mq(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...jX(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
231
- `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
232
- `}]}}var FX=(function(e){if(e==null)return BX;if(typeof e==`function`)return zX(e);if(typeof e==`object`)return Array.isArray(e)?IX(e):LX(e);if(typeof e==`string`)return RX(e);throw Error(`Expected function, string, or object as test`)});function IX(e){let t=[],n=-1;for(;++n<e.length;)t[n]=FX(e[n]);return zX(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function LX(e){let t=e;return zX(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function RX(e){return zX(t);function t(t){return t&&t.type===e}}function zX(e){return t;function t(t,n,r){return!!(VX(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function BX(){return!0}function VX(e){return typeof e==`object`&&!!e&&`type`in e}function HX(e){return e}var UX=[];function WX(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=FX(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+HX(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=UX,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=GX(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function GX(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?UX:[e]}function KX(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),WX(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var qX={}.hasOwnProperty,JX={};function YX(e,t){let n=t||JX,r=new Map,i=new Map,a={all:s,applyData:ZX,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...vX,...n.handlers},one:o,options:n,patch:XX,wrap:$X};return KX(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(qX.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=jX(n);return r.children=a.all(e),r}return jX(e)}return(a.options.unknownHandler||QX)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=eZ(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=eZ(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function XX(e,t){e.position&&(t.position=iK(e))}function ZX(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,jX(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function QX(e,t){let n=t.data||{},r=`value`in t&&!(qX.call(n,`hProperties`)||qX.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function $X(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
233
- `});++r<e.length;)r&&n.push({type:`text`,value:`
234
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
235
- `}),n}function eZ(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function tZ(e,t){let n=YX(e,t),r=n.one(e,void 0),i=PX(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
236
- `},i)),a}function nZ(e,t){return e&&`run`in e?async function(n,r){let i=tZ(n,{file:r,...t});await e.run(i,r)}:function(n,r){return tZ(n,{file:r,...e||t})}}function rZ(e){if(e)throw e}var iZ=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function aZ(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function oZ(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?sZ(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function sZ(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var cZ={basename:lZ,dirname:uZ,extname:dZ,join:fZ,sep:`/`};function lZ(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);hZ(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function uZ(e){if(hZ(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function dZ(e){hZ(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function fZ(...e){let t=-1,n;for(;++t<e.length;)hZ(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:pZ(n)}function pZ(e){hZ(e);let t=e.codePointAt(0)===47,n=mZ(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function mZ(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function hZ(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var gZ={cwd:_Z};function _Z(){return`/`}function vZ(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function yZ(e){if(typeof e==`string`)e=new URL(e);else if(!vZ(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return bZ(e)}function bZ(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var xZ=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],SZ=class{constructor(e){let t;t=e?vZ(e)?{path:e}:typeof e==`string`||EZ(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:gZ.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<xZ.length;){let e=xZ[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)xZ.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?cZ.basename(this.path):void 0}set basename(e){wZ(e,`basename`),CZ(e,`basename`),this.path=cZ.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?cZ.dirname(this.path):void 0}set dirname(e){TZ(this.basename,`dirname`),this.path=cZ.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?cZ.extname(this.path):void 0}set extname(e){if(CZ(e,`extname`),TZ(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=cZ.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){vZ(e)&&(e=yZ(e)),wZ(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?cZ.basename(this.path,this.extname):void 0}set stem(e){wZ(e,`stem`),CZ(e,`stem`),this.path=cZ.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new lK(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function CZ(e,t){if(e&&e.includes(cZ.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+cZ.sep+"`")}function wZ(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function TZ(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function EZ(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var DZ=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),OZ=e(iZ(),1),kZ={}.hasOwnProperty,AZ=new class e extends DZ{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=oZ()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,OZ.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(NZ(`data`,this.frozen),this.namespace[e]=t,this):kZ.call(this.namespace,e)&&this.namespace[e]||void 0:e?(NZ(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=IZ(e),n=this.parser||this.Parser;return jZ(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),jZ(`process`,this.parser||this.Parser),MZ(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=IZ(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);RZ(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),jZ(`processSync`,this.parser||this.Parser),MZ(`processSync`,this.compiler||this.Compiler),this.process(e,r),FZ(`processSync`,`process`,t),n;function r(e,r){t=!0,rZ(e),n=r}}run(e,t,n){PZ(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=IZ(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),FZ(`runSync`,`run`,n),r;function i(e,t){rZ(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=IZ(t),r=this.compiler||this.Compiler;return MZ(`stringify`,r),PZ(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(NZ(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,OZ.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];aZ(o)&&aZ(r)&&(r=(0,OZ.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function jZ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function MZ(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function NZ(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function PZ(e){if(!aZ(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function FZ(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function IZ(e){return LZ(e)?e:new SZ(e)}function LZ(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function RZ(e){return typeof e==`string`||zZ(e)}function zZ(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var BZ=[],VZ={allowDangerousHtml:!0},HZ=/^(https?|ircs?|mailto|xmpp)$/i,UZ=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function WZ(e){let t=GZ(e),n=KZ(e);return qZ(t.runSync(t.parse(n),n),e)}function GZ(e){let t=e.rehypePlugins||BZ,n=e.remarkPlugins||BZ,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...VZ}:VZ;return AZ().use(VY).use(n).use(nZ,r).use(t)}function KZ(e){let t=e.children||``,n=new SZ;return typeof t==`string`?n.value=t:``+t,n}function qZ(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||JZ;for(let e of UZ)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return KX(e,l),_K(e,{Fragment:G.Fragment,components:i,ignoreInvalidStyle:!0,jsx:G.jsx,jsxs:G.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in zK)if(Object.hasOwn(zK,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=zK[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function JZ(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||HZ.test(e.slice(0,t))?e:``}function YZ(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function XZ(e,t,n){let r=FX((n||{}).ignore||[]),i=ZZ(t),a=-1;for(;++a<i.length;)WX(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function ZZ(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([QZ(e[0]),$Z(e[1])])}return t}function QZ(e){return typeof e==`string`?new RegExp(YZ(e),`g`):e}function $Z(e){return typeof e==`function`?e:function(){return e}}var eQ=`phrasing`,tQ=[`autolink`,`link`,`image`,`label`];function nQ(){return{transforms:[uQ],enter:{literalAutolink:iQ,literalAutolinkEmail:aQ,literalAutolinkHttp:aQ,literalAutolinkWww:aQ},exit:{literalAutolink:lQ,literalAutolinkEmail:cQ,literalAutolinkHttp:oQ,literalAutolinkWww:sQ}}}function rQ(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:eQ,notInConstruct:tQ},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:eQ,notInConstruct:tQ},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:eQ,notInConstruct:tQ}]}}function iQ(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function aQ(e){this.config.enter.autolinkProtocol.call(this,e)}function oQ(e){this.config.exit.autolinkProtocol.call(this,e)}function sQ(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function cQ(e){this.config.exit.autolinkEmail.call(this,e)}function lQ(e){this.exit(e)}function uQ(e){XZ(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,dQ],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,fQ]],{ignore:[`link`,`linkReference`]})}function dQ(e,t,n,r,i){let a=``;if(!hQ(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!pQ(n)))return!1;let o=mQ(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function fQ(e,t,n,r){return!hQ(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function pQ(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function mQ(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=uf(e,`(`),a=uf(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function hQ(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||fq(n)||dq(n))&&(!t||n!==47)}TQ.peek=wQ;function gQ(){this.buffer()}function _Q(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function vQ(){this.buffer()}function yQ(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function bQ(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=eq(this.sliceSerialize(e)).toLowerCase(),n.label=t}function xQ(e){this.exit(e)}function SQ(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=eq(this.sliceSerialize(e)).toLowerCase(),n.label=t}function CQ(e){this.exit(e)}function wQ(){return`[`}function TQ(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function EQ(){return{enter:{gfmFootnoteCallString:gQ,gfmFootnoteCall:_Q,gfmFootnoteDefinitionLabelString:vQ,gfmFootnoteDefinition:yQ},exit:{gfmFootnoteCallString:bQ,gfmFootnoteCall:xQ,gfmFootnoteDefinitionLabelString:SQ,gfmFootnoteDefinition:CQ}}}function DQ(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:TQ},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
237
- `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?kQ:OQ))),s(),o}}function OQ(e,t,n){return t===0?e:kQ(e,t,n)}function kQ(e,t,n){return(n?``:` `)+e}var AQ=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];FQ.peek=IQ;function jQ(){return{canContainEols:[`delete`],enter:{strikethrough:NQ},exit:{strikethrough:PQ}}}function MQ(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:AQ}],handlers:{delete:FQ}}}function NQ(e){this.enter({type:`delete`,children:[]},e)}function PQ(e){this.exit(e)}function FQ(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function IQ(){return`~`}function LQ(e){return e.length}function RQ(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||LQ,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=zQ(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=BQ(r[d]);else{let e=BQ(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
238
- `)}function zQ(e){return e==null?``:String(e)}function BQ(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function VQ(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),HQ);return i(),o}function HQ(e,t,n){return`>`+(n?``:` `)+e}function UQ(e,t){return WQ(e,t.inConstruct,!0)&&!WQ(e,t.notInConstruct,!1)}function WQ(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function GQ(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
239
- `&&UQ(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
240
- `}function KQ(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function qQ(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function JQ(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function YQ(e,t,n,r){let i=JQ(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(qQ(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,XQ);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(KQ(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
241
- `,encode:["`"],...s.current()})),t()}return u+=s.move(`
242
- `),a&&(u+=s.move(a+`
243
- `)),u+=s.move(c),l(),u}function XQ(e,t,n){return(n?``:` `)+e}function ZQ(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function QQ(e,t,n,r){let i=ZQ(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
244
- `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function $Q(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function e$(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function t$(e,t,n){let r=Sq(e),i=Sq(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}n$.peek=r$;function n$(e,t,n,r){let i=$Q(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=t$(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=e$(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=t$(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+e$(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function r$(e,t,n){return n.options.emphasis||`*`}function i$(e,t){let n=!1;return KX(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&VK(e)&&(t.options.setext||n))}function a$(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(i$(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
245
- `,after:`
246
- `});return r(),t(),o+`
247
- `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
248
- `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
249
- `,...a.current()});return/^[\t ]/.test(l)&&(l=e$(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}o$.peek=s$;function o$(e){return e.value||``}function s$(){return`<`}c$.peek=l$;function c$(e,t,n,r){let i=ZQ(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function l$(){return`!`}u$.peek=d$;function u$(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function d$(){return`!`}f$.peek=p$;function f$(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function p$(){return"`"}function m$(e,t){let n=VK(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}h$.peek=g$;function h$(e,t,n,r){let i=ZQ(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(m$(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function g$(e,t,n){return m$(e,n)?`<`:`[`}_$.peek=v$;function _$(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function v$(){return`[`}function y$(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function b$(e){let t=y$(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function x$(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function S$(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function C$(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?x$(n):y$(n),s=e.ordered?o===`.`?`)`:`.`:b$(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),S$(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function w$(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function T$(e,t,n,r){let i=w$(n),a=n.bulletCurrent||y$(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function E$(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var D$=FX([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function O$(e,t,n,r){return(e.children.some(function(e){return D$(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function k$(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}A$.peek=j$;function A$(e,t,n,r){let i=k$(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=t$(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=e$(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=t$(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+e$(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function j$(e,t,n){return n.options.strong||`*`}function M$(e,t,n,r){return n.safe(e.value,r)}function N$(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function P$(e,t,n){let r=(S$(n)+(n.options.ruleSpaces?` `:``)).repeat(N$(n));return n.options.ruleSpaces?r.slice(0,-1):r}var F$={blockquote:VQ,break:GQ,code:YQ,definition:QQ,emphasis:n$,hardBreak:GQ,heading:a$,html:o$,image:c$,imageReference:u$,inlineCode:f$,link:h$,linkReference:_$,list:C$,listItem:T$,paragraph:E$,root:O$,strong:A$,text:M$,thematicBreak:P$};function I$(){return{enter:{table:L$,tableData:V$,tableHeader:V$,tableRow:z$},exit:{codeText:H$,table:R$,tableData:B$,tableHeader:B$,tableRow:B$}}}function L$(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function R$(e){this.exit(e),this.data.inTable=void 0}function z$(e){this.enter({type:`tableRow`,children:[]},e)}function B$(e){this.exit(e)}function V$(e){this.enter({type:`tableCell`,children:[]},e)}function H$(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,U$));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function U$(e,t){return t===`|`?t:e}function W$(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
250
- `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
251
- `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return RQ(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=F$.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function G$(){return{exit:{taskListCheckValueChecked:q$,taskListCheckValueUnchecked:q$,paragraph:J$}}}function K$(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Y$}}}function q$(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function J$(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Y$(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=F$.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function X$(){return[nQ(),EQ(),jQ(),I$(),G$()]}function Z$(e){return{extensions:[rQ(),DQ(e),MQ(),W$(e),K$()]}}var Q$={tokenize:f1,partial:!0},$$={tokenize:p1,partial:!0},e1={tokenize:m1,partial:!0},t1={tokenize:h1,partial:!0},n1={tokenize:g1,partial:!0},r1={name:`wwwAutolink`,tokenize:u1,previous:_1},i1={name:`protocolAutolink`,tokenize:d1,previous:v1},a1={name:`emailAutolink`,tokenize:l1,previous:y1},o1={};function s1(){return{text:o1}}for(var c1=48;c1<123;)o1[c1]=a1,c1++,c1===58?c1=65:c1===91&&(c1=97);o1[43]=a1,o1[45]=a1,o1[46]=a1,o1[95]=a1,o1[72]=[a1,i1],o1[104]=[a1,i1],o1[87]=[a1,r1],o1[119]=[a1,r1];function l1(e,t,n){let r=this,i,a;return o;function o(t){return!b1(t)||!y1.call(r,r.previous)||x1(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return b1(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(n1,u,l)(t):t===45||t===95||nq(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&tq(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function u1(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!_1.call(r,r.previous)||x1(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Q$,e.attempt($$,e.attempt(e1,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function d1(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&v1.call(r,r.previous)&&!x1(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(tq(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||iq(t)||lq(t)||fq(t)||dq(t)?n(t):e.attempt($$,e.attempt(e1,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function f1(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function p1(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(t1,c,s)(t):t===null||lq(t)||fq(t)||t!==45&&dq(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function m1(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(t1,t,a)(o):o===null||lq(o)||fq(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function h1(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||lq(o)||fq(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||lq(e)||fq(e)?t(e):r(e)}function a(e){return tq(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):tq(t)?(e.consume(t),o):n(t)}}function g1(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return nq(e)?n(e):t(e)}}function _1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||lq(e)}function v1(e){return!tq(e)}function y1(e){return!(e===47||b1(e))}function b1(e){return e===43||e===45||e===46||e===95||nq(e)}function x1(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var S1={tokenize:k1,partial:!0};function Pne(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:E1,continuation:{tokenize:D1},exit:O1}},text:{91:{name:`gfmFootnoteCall`,tokenize:T1},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:C1,resolveTo:w1}}}}function C1(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=eq(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function w1(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function T1(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||lq(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(eq(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return lq(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function E1(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||lq(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=eq(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return lq(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),hq(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function D1(e,t,n){return e.check(Aq,t,e.attempt(S1,t,n))}function O1(e){e.exit(`gfmFootnoteDefinition`)}function k1(e,t,n){let r=this;return hq(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function A1(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&qK(o,o.length,0,Cq(s,e.slice(r+1,n),t)),qK(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),qK(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Sq(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Sq(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var j1=class{constructor(){this.map=[]}add(e,t,n){M1(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function M1(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function N1(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function P1(){return{flow:{null:{name:`table`,tokenize:F1,resolveAll:I1}}}}function F1(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):cq(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):uq(t)?hq(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||lq(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,uq(t)?hq(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return uq(t)?hq(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||cq(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return uq(t)?hq(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||cq(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||cq(n)?(e.exit(`tableRow`),t(n)):uq(n)?hq(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||lq(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function I1(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new j1;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(R1(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=L1(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=L1(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=L1(f,t,o,i,n,d)):(o[0]=o[1],d=L1(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&R1(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=N1(t.events,n))}return e}function L1(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},z1(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=z1(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=z1(t.events,n[2]),a=z1(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},z1(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function R1(e,t,n,r,i){let a=[],o=z1(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function z1(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var B1={name:`tasklistCheck`,tokenize:H1};function V1(){return{text:{91:B1}}}function H1(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return lq(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return cq(r)?t(r):uq(r)?e.check({tokenize:U1},t,n)(r):n(r)}}function U1(e,t,n){return hq(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function W1(e){return XK([s1(),Pne(),A1(e),P1(),V1()])}var G1={};function K1(e){let t=this,n=e||G1,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(W1(n)),a.push(X$()),o.push(Z$(n))}function q1(){let e=navigator.userAgent;return e.includes(`Mac`)?`Reveal in Finder`:e.includes(`Linux`)?`Open Containing Folder`:`Reveal in File Explorer`}function J1({image:e,onClose:t}){let{t:n}=K();return(0,G.jsx)(HE,{open:e!==null,onOpenChange:e=>{e||t()},children:(0,G.jsxs)(qE,{className:`max-w-4xl`,children:[(0,G.jsxs)(JE,{children:[(0,G.jsx)(XE,{children:n(`Image preview`)}),(0,G.jsx)(ZE,{className:`break-all`,children:e?.rel})]}),(0,G.jsx)($E,{className:`max-h-[70vh]`,children:e&&(0,G.jsx)(`img`,{src:e.dataUrl,alt:e.rel,className:`mx-auto max-h-[65vh] max-w-full object-contain`})}),(0,G.jsx)(YE,{children:(0,G.jsx)(Oa,{variant:`outline`,onClick:t,children:n(`Close`)})})]})})}function Y1(e){try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),t.setSelectionRange(0,e.length);let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function X1(e){let t=typeof navigator>`u`?void 0:navigator.clipboard;if(!t?.writeText||window.isSecureContext===!1)return Promise.resolve(Y1(e));try{return Promise.resolve(t.writeText(e)).then(()=>!0,()=>Y1(e))}catch{return Promise.resolve(Y1(e))}}function Z1(){return!!window.electronAPI?.remote}function Q1(e){return new TextDecoder().decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}function $1(e,t){return e[t]?.btwParentId||t}var e0=new Map,t0=new Map,n0=new Map,r0=new Set,i0=[];function a0(){let e=aP.getState(),t=e.activeId;if(!t)return null;let n=e.conversations[t],r=e0.get(t);return!n||!r?null:{api:r,conversationId:t,projectId:n.projectId}}function o0(e){let t=a0();if(!t||c0(t.projectId))return;WR.getState().ensureOpen();let n=t.api.getPanel(`changes`);if(n){n.focus();return}t.api.addPanel({id:`changes`,component:`changes`,title:e?.title??`Changes`,params:{conversationId:t.conversationId,projectId:t.projectId}})}function s0(e,t){return t?e.some(e=>e.id===t&&e.kind===`secretary`):!1}function c0(e){return s0(E.getState().projects,e)}function l0(e,t,n,r){let i=e.getPanel(`files`);if(i){i.focus();return}e.addPanel({id:`files`,component:`files`,title:r??`Files`,params:{conversationId:t,projectId:n}})}function u0(e,t,n,r){let i=aP.getState(),a=$1(i.conversations,e),o=i.conversations[a]?.projectId;if(!o||c0(o))return;WR.getState().ensureOpen(a);let s=r?[t,n,r]:n?[t,n]:[t],c=t0.get(a);c?c(...s):n0.set(a,s);let l=e0.get(a);l?l0(l,a,o):r0.add(a)}function d0(e){let t=aP.getState(),n=e?.conversationId??t.activeId;if(!n)return;let r=t.conversations[n];if(!r)return;let i=$1(t.conversations,n),a=e0.get(i);WR.getState().ensureOpen(i);let o=e?.tabId??`browser:${crypto.randomUUID()}`;if(!a){i0.push({conversationId:i,tabId:o,ownerId:n});return}let s=a.getPanel(o);if(s){s.focus();return}a.addPanel({id:o,component:`browser`,title:e?.title??`Browser`,params:{conversationId:n,projectId:r.projectId}})}function f0(e,t){if(!aP.getState().conversations[e])return null;let n=`browser:${crypto.randomUUID()}`;return d0({conversationId:e,tabId:n,title:new URL(t).host}),window.electronAPI.browser.navigate(n,e,t)}var p0=`my-2 overflow-x-auto rounded-lg border bg-[var(--sunken,var(--muted))] text-(length:--chat-code-block-size) [font-weight:var(--chat-code-block-weight)] leading-relaxed`;function m0(e){let t=e.trimStart();return/^<[a-zA-Z!/]/.test(t)?`html`:/^[{[]/.test(t)?`json`:/^[$#] /.test(t)?`shellscript`:`text`}function h0({code:e,language:t,streaming:n=!1}){let[r,i]=(0,H.useState)(null);(0,H.useEffect)(()=>{if(n){i(null);return}let r=!0;return Xg(e,t??m0(e),!0).then(e=>{r&&i(e)}),()=>{r=!1}},[e,t,n]);let a=!n&&(0,G.jsx)(Fs,{text:e,className:`absolute top-1.5 right-1.5 rounded-md border bg-background/80 p-1.5 text-muted-foreground opacity-0 backdrop-blur transition-opacity group-hover/code:opacity-100`});return r==null?(0,G.jsxs)(`div`,{"data-enso":`code-block`,"data-language":t,className:`group/code relative`,children:[(0,G.jsx)(`pre`,{className:`${p0} p-3 font-mono`,children:(0,G.jsx)(`code`,{children:e})}),a]}):(0,G.jsxs)(`div`,{"data-enso":`code-block`,"data-language":t,className:`group/code relative`,children:[(0,G.jsx)(`div`,{className:`${p0} [&_pre]:m-0 [&_pre]:overflow-x-auto [&_pre]:bg-transparent! [&_pre]:p-3 [&_pre]:font-mono [&_pre]:[--shiki-dark-bg:transparent]!`,dangerouslySetInnerHTML:{__html:r}}),a]})}var g0=50,_0=3e4,v0={status:`missing`},y0=new Map,b0=new Map,x0=new Set,S0=new Map,C0=null,w0=0,T0={batches:0,paths:0,ms:0},E0=e=>e.cwd??`conversation:${e.conversationId}`,D0=(e,t)=>`${E0(e)}\0${t}`;function O0(e){return e?e.state.status===`ok`?e.epoch===w0:Date.now()-e.at<_0:!1}function k0(e,t){let n=y0.get(e)?.state,r=n?.status===t.status&&(t.status===`missing`||n.status===`ok`&&n.rel===t.rel&&n.kind===t.kind);if(y0.set(e,{state:r&&n?n:t,epoch:w0,at:Date.now()}),!r)for(let t of b0.get(e)??[])t()}function A0(e){return e?{status:`ok`,rel:e.rel,kind:e.kind}:v0}async function j0(e,t){let n=performance.now();try{let n=await window.electronAPI.workspaceFiles.resolveLinks({conversationId:e.conversationId,projectId:e.projectId,rels:t});return t.map((e,t)=>A0(n.ok?n.items[t]:null))}catch{return t.map(()=>v0)}finally{T0.batches+=1,T0.paths+=t.length,T0.ms+=performance.now()-n}}function M0(){C0=null;let e=[...S0.values()];S0.clear();for(let{scope:t,rels:n}of e){let e=[...n];for(let n=0;n<e.length;n+=200){let r=e.slice(n,n+200);j0(t,r).then(e=>{r.forEach((n,r)=>{let i=D0(t,n);x0.delete(i),k0(i,e[r])})})}}}function N0(e,t){let n=D0(e,t);if(x0.has(n)||O0(y0.get(n)))return;x0.add(n);let r=`${e.conversationId}\0${e.projectId}`,i=S0.get(r)??{scope:e,rels:new Set};i.rels.add(t),S0.set(r,i),C0??=setTimeout(M0,g0)}async function P0(e,t){let[n]=await j0(e,[t]);return k0(D0(e,t),n),n}function F0(e,t,n){let r=e&&t?D0(e,t):null,i=(0,H.useCallback)(e=>{if(!r)return()=>{};let t=b0.get(r)??new Set;return b0.set(r,t),t.add(e),()=>{t.delete(e),t.size===0&&b0.delete(r)}},[r]),a=(0,H.useSyncExternalStore)(i,()=>r?y0.get(r)?.state:void 0);return(0,H.useEffect)(()=>{n&&e&&t&&N0(e,t)},[n,r]),a}var I0=2;function L0({value:e}){return typeof e==`string`?(0,G.jsx)(`span`,{className:`text-emerald-700 dark:text-emerald-400`,children:JSON.stringify(e)}):typeof e==`number`?(0,G.jsx)(`span`,{className:`text-sky-700 dark:text-sky-400`,children:String(e)}):(0,G.jsx)(`span`,{className:`text-violet-700 dark:text-violet-400`,children:String(e)})}function R0({name:e,value:t,depth:n}){let[r,i]=(0,H.useState)(n<I0),a=e!==void 0&&(0,G.jsxs)(`span`,{className:`text-foreground/80`,children:[e,(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`: `})]});if(typeof t!=`object`||!t)return(0,G.jsxs)(`div`,{className:`pl-4`,children:[a,(0,G.jsx)(L0,{value:t})]});let o=Array.isArray(t),s=o?t.map((e,t)=>[String(t),e]):Object.entries(t),[c,l]=o?[`[`,`]`]:[`{`,`}`];return(0,G.jsxs)(`div`,{className:n>0?`pl-4`:void 0,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`-ml-4 inline-flex items-center text-left hover:text-foreground`,children:[(0,G.jsx)(yt,{className:W(`h-3 w-3 shrink-0 transition-transform`,r&&`rotate-90`)}),(0,G.jsxs)(`span`,{className:`ml-1`,children:[a,(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[c,!r&&` ${s.length} ${l}`]})]})]}),r&&(0,G.jsxs)(G.Fragment,{children:[s.map(([e,t])=>(0,G.jsx)(R0,{name:o?void 0:e,value:t,depth:n+1},e)),(0,G.jsx)(`div`,{className:`text-muted-foreground`,children:l})]})]})}function z0({source:e,value:t}){let{t:n}=K(),[r,i]=(0,H.useState)(!1),a=e=>W(`rounded px-1.5 py-0.5`,e?`bg-muted text-foreground`:`hover:text-foreground`);return(0,G.jsxs)(`div`,{"data-enso":`json-tree`,className:`group/code relative my-2 rounded-lg border`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 border-b px-2 py-1 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:`mr-auto font-mono`,children:`JSON`}),(0,G.jsx)(`button`,{type:`button`,className:a(!r),onClick:()=>i(!1),children:n(`Tree view`)}),(0,G.jsx)(`button`,{type:`button`,className:a(r),onClick:()=>i(!0),children:n(`Raw text`)}),(0,G.jsx)(Fs,{text:e,className:`rounded p-1`})]}),r?(0,G.jsx)(`div`,{className:`px-2`,children:(0,G.jsx)(h0,{code:e,language:`json`})}):(0,G.jsx)(`div`,{className:`max-h-[480px] overflow-auto py-2 pr-3 pl-6 font-mono text-(length:--chat-code-block-size) leading-relaxed`,children:(0,G.jsx)(R0,{value:t,depth:0})})]})}function B0(e,{prefersDark:t,terminalIsDark:n}){switch(e){case`light`:return`light`;case`dark`:return`dark`;case`system`:return t?`dark`:`light`;case`sync-terminal`:return n?`dark`:`light`}}function V0(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches}function H0(){let e=E(e=>e.theme),t=E(e=>e.terminalTheme),[n,r]=(0,H.useState)(V0);return(0,H.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),B0(e,{prefersDark:n,terminalIsDark:je(t)})}function U0(e){let t=H0();return(0,H.useMemo)(()=>({...e,themeType:t}),[e,t])}var W0=`http://www.w3.org/2000/svg`,G0=`http://www.w3.org/1999/xlink`,K0=/<svg\b(?:[^>"']|"[^"]*"|'[^']*')*>/i,q0=16384,J0=q0*q0,Y0=2;function X0(e){return RegExp(`\\s${e}\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s"'>]+)`,`i`)}function Z0(e,t){let n=e.match(X0(t));return n?n[0].replace(/^[^=]*=\s*/,``).replace(/^["']|["']$/g,``):null}function Q0(e,t,n){let r=` ${t}="${n}"`,i=X0(t);return i.test(e)?e.replace(i,r):e.replace(/\s*\/?>$/,e=>`${r}${e}`)}function $0(e){let t=e.match(K0)?.[0],n=t?Z0(t,`viewBox`):null;if(!n)return null;let r=n.trim().split(/[\s,]+/).map(Number);if(r.length!==4)return null;let[,,i,a]=r;return Number.isFinite(i)&&Number.isFinite(a)&&i>0&&a>0?{width:i,height:a}:null}function e2(e){let t=e.match(K0);if(!t)return e;let n=t[0];Z0(n,`xmlns`)||(n=Q0(n,`xmlns`,W0)),e.includes(`xlink:`)&&!Z0(n,`xmlns:xlink`)&&(n=Q0(n,`xmlns:xlink`,G0));let r=$0(e);if(r){n=Q0(n,`width`,String(r.width)),n=Q0(n,`height`,String(r.height));let e=Z0(n,`style`);if(e!==null){let t=e.split(`;`).filter(e=>e.trim()&&!/^\s*max-width\s*:/i.test(e)).join(`;`).trim();n=t?Q0(n,`style`,t):n.replace(X0(`style`),``)}}return e.replace(t[0],()=>n)}function t2(e,t=new Date){let n=e=>String(e).padStart(2,`0`);return`mermaid-${`${t.getFullYear()}${n(t.getMonth()+1)}${n(t.getDate())}`}-${`${n(t.getHours())}${n(t.getMinutes())}${n(t.getSeconds())}`}.${e}`}function n2(e,t){let n=Math.min(Y0,q0/e,q0/t,Math.sqrt(J0/(e*t)));return n>=1?n:null}function r2(e){return new Blob([e2(e)],{type:`image/svg+xml`})}function i2(e){return e2(new XMLSerializer().serializeToString(e))}function a2(e){let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`svg`);if(!t)throw Error(`No svg in markup`);return i2(t)}function o2(e,t){let n=typeof e==`string`?e:URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),typeof e!=`string`&&setTimeout(()=>URL.revokeObjectURL(n),0)}async function s2(e,t,n,r,i){let a=new Image;a.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,await a.decode();let o=document.createElement(`canvas`);o.width=Math.floor(t*r),o.height=Math.floor(n*r);let s=o.getContext(`2d`);if(!s)throw Error(`Canvas unavailable`);s.fillStyle=i,s.fillRect(0,0,o.width,o.height),s.drawImage(a,0,0,o.width,o.height);let c=o.toDataURL(`image/png`);if(!c.startsWith(`data:image/png`))throw Error(`Canvas export failed`);return c}async function c2(e){let t=t=>{try{let n=e.currentSvg();return n?(e.download(r2(n),t2(`svg`)),{kind:`svg`,reason:t}):{kind:`failed`}}catch{return{kind:`failed`}}},n;try{n=e2(await e.rerender())}catch{return t(`rerender-failed`)}if(/<foreignObject\b/i.test(n))return t(`rerender-failed`);let r=$0(n);if(!r)return t(`draw-failed`);let i=n2(r.width,r.height);if(i===null)return t(`too-large`);try{let t=await e.rasterize(n,r.width,r.height,i);return e.download(t,t2(`png`)),{kind:`png`}}catch{return t(`draw-failed`)}}var l2=`position:fixed;left:0;top:0;width:800px;height:600px;overflow:hidden;opacity:0;pointer-events:none;visibility:hidden;contain:strict;`;function u2(e){return!e.includes(`<svg`)||/\bfocusable=/.test(e)?e:e.replace(`<svg`,`<svg focusable="false" tabindex="-1"`)}function d2(e){return{startOnLoad:!1,theme:e,securityLevel:`strict`,fontFamily:`inherit`,suppressErrorRendering:!0,flowchart:{htmlLabels:!1,useMaxWidth:!0}}}var f2=/<(?:a|area)\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,p2=/\s(?:xlink:)?(?:href|target)\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]+)/gi;function m2(e){return e.replace(f2,e=>e.replace(p2,``))}var h2=null,g2=null,_2=Promise.resolve(),v2=0;async function y2(){return g2||(h2||=q(()=>import(`./mermaid.core-CL48hMfG.js`).then(e=>(g2=e.default,g2)),__vite__mapDeps([126,127,128,1,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143])).catch(e=>{throw h2=null,e}),h2)}function b2(e){let t=_2.then(e,e);return _2=t.then(()=>void 0,()=>void 0),t}async function x2(e,t,n={}){return b2(async()=>{let r=await y2();r.initialize({...d2(t),...n});let i=`ensoMermaid${++v2}`,a=document.createElement(`div`);a.setAttribute(`aria-hidden`,`true`),a.style.cssText=l2,document.body.appendChild(a);try{let{svg:t}=await r.render(i,e,a);return u2(m2(t))}finally{a.remove(),document.getElementById(i)?.remove(),document.getElementById(`d${i}`)?.remove()}})}var S2=.1,C2={dark:`#1f2020`,default:`#ffffff`},w2=.1;function T2({code:e,streaming:t=!1,className:n}){let{t:r}=K(),i=(0,H.useRef)(null),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(1),[d,f]=(0,H.useState)({x:0,y:0}),[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)(!1);kE(h);let _=(0,H.useRef)({x:0,y:0}),v=(0,H.useRef)({x:0,y:0}),y=(0,H.useRef)(null),b=(0,H.useRef)(!1),x=H0()===`dark`?`dark`:`default`;(0,H.useEffect)(()=>{if(t){o(null),c(null);return}let n=!1;return(async()=>{if(!e.trim()){o(null),c(null);return}try{let t=await x2(e,x);n||(o(t),c(null),u(1),f({x:0,y:0}))}catch(e){n||(c(e instanceof Error?e.message:`Mermaid render failed`),o(null))}})(),()=>{n=!0}},[e,x,t]);let S=(0,H.useCallback)(()=>u(e=>e+S2),[]),C=(0,H.useCallback)(()=>u(e=>Math.max(e-S2,w2)),[]),w=(0,H.useCallback)(()=>{u(1),f({x:0,y:0})},[]),T=(0,H.useCallback)(()=>{g(!1),u(1),f({x:0,y:0})},[]),E=(0,H.useCallback)(()=>{g(!0),requestAnimationFrame(()=>{let e=y.current,t=e?.firstElementChild;if(!e||!t?.offsetWidth||!t.offsetHeight)return;let n=Math.min((e.clientWidth-48)/t.offsetWidth,(e.clientHeight-48)/t.offsetHeight);u(Math.round(n*100)/100),f({x:0,y:0})})},[]),D=(0,H.useCallback)(e=>{if(!h)return;e.preventDefault();let t=e.deltaY>0?-.1:S2;u(e=>Math.round(Math.max(e+t,w2)*100)/100)},[h]),O=(0,H.useCallback)(e=>{!h||e.button!==0||(m(!0),b.current=!1,_.current={x:e.clientX,y:e.clientY},v.current={...d})},[h,d]),k=(0,H.useCallback)(e=>{if(!p)return;let t=e.clientX-_.current.x,n=e.clientY-_.current.y;(Math.abs(t)>2||Math.abs(n)>2)&&(b.current=!0),f({x:v.current.x+t,y:v.current.y+n})},[p]),A=(0,H.useCallback)(()=>m(!1),[]),j=(0,H.useCallback)(e=>{e.stopPropagation()},[]),M=(0,H.useCallback)(()=>{b.current||T()},[T]),N=(0,H.useCallback)(()=>{try{let e=i.current?.querySelector(`svg`);if(!e)throw Error(`No svg`);o2(r2(i2(e)),t2(`svg`))}catch{vD({type:`error`,title:r(`Export failed`)})}},[r]),P=(0,H.useCallback)(async()=>{let t=await c2({currentSvg:()=>{let e=i.current?.querySelector(`svg`);return e?i2(e):null},rerender:async()=>a2(await x2(e,x,{htmlLabels:!1})),rasterize:(e,t,n,r)=>s2(e,t,n,r,C2[x]),download:o2});t.kind===`failed`?vD({type:`error`,title:r(`Export failed`)}):t.kind===`svg`&&vD({type:`warning`,title:t.reason===`too-large`?r(`Diagram is too large for PNG, exported SVG instead`):r(`PNG export failed, exported SVG instead`)})},[e,x,r]),F=e=>{let t=e===`sm`?`h-6 w-6`:`h-7 w-7`,n=e===`sm`?`h-3.5 w-3.5`:`h-4 w-4`,i=e===`sm`?`h-6 min-w-[2.5rem]`:`h-7 min-w-[3rem]`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background/95 p-1 shadow-sm`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:S,className:W(`flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground`,t),title:r(`Zoom in`),children:(0,G.jsx)(On,{className:n})}),(0,G.jsxs)(`button`,{type:`button`,onClick:w,className:W(`flex items-center justify-center rounded text-xs transition-colors hover:bg-accent hover:text-accent-foreground`,i),title:r(`Reset zoom`),children:[Math.round(l*100),`%`]}),(0,G.jsx)(`button`,{type:`button`,onClick:C,disabled:l<=w2,className:W(`flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground`,t,l<=w2&&`cursor-not-allowed opacity-50`),title:r(`Zoom out`),children:(0,G.jsx)(hn,{className:n})}),l!==1&&(0,G.jsx)(`button`,{type:`button`,onClick:w,className:W(`flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground`,t),title:r(`Fit to original size`),children:(0,G.jsx)(Nn,{className:n})}),(0,G.jsx)(`div`,{className:`mx-0.5 h-4 w-px bg-border`}),(0,G.jsx)(`button`,{type:`button`,onClick:N,className:W(`flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground`,t),title:r(`Export SVG`),children:(0,G.jsx)(zt,{className:n})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>void P(),className:W(`flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground`,t),title:r(`Export PNG`),children:(0,G.jsx)(Qt,{className:n})}),h?(0,G.jsx)(`button`,{type:`button`,onClick:T,className:W(`flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground`,t),title:r(`Exit fullscreen`),children:(0,G.jsx)(mn,{className:n})}):(0,G.jsx)(`button`,{type:`button`,onClick:E,className:W(`flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground`,t),title:r(`View fullscreen`),children:(0,G.jsx)(ln,{className:n})})]})};return s?(0,G.jsxs)(`div`,{className:W(`overflow-x-auto rounded-lg border border-destructive/50`,n),children:[(0,G.jsx)(`div`,{className:`flex items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:(0,G.jsx)(`span`,{children:r(`Mermaid render error`)})}),(0,G.jsx)(`pre`,{className:`p-4 text-sm`,children:(0,G.jsx)(`code`,{className:`block font-mono leading-relaxed text-muted-foreground`,children:e})}),(0,G.jsx)(`div`,{className:`border-t border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:s})]}):a?(0,G.jsxs)(`div`,{className:W(`relative rounded-lg border border-border bg-muted/30`,n),style:{userSelect:`none`,WebkitUserSelect:`none`},children:[(0,G.jsx)(`div`,{ref:i,className:W(`max-h-[min(50vh,20rem)] overflow-hidden [overflow-anchor:none]`,h&&(p?`cursor-grabbing`:`cursor-grab`)),onWheel:D,onMouseDown:O,onMouseMove:k,onMouseUp:A,onMouseLeave:A,onDoubleClick:h?void 0:E,children:(0,G.jsx)(`div`,{className:`origin-center transition-transform duration-100 ease-out`,style:{transform:`translate(${d.x}px, ${d.y}px) scale(${l})`},children:(0,G.jsx)(`div`,{className:`p-4`,dangerouslySetInnerHTML:{__html:a}})})}),(0,G.jsx)(`div`,{className:`absolute right-2 bottom-2`,children:F(`sm`)}),h&&(0,G.jsxs)(`div`,{className:`fixed inset-0 flex select-none flex-col bg-background`,style:{zIndex:BE.TOAST},"data-enso-float":``,onClick:M,onKeyDown:e=>{e.key===`Escape`&&T()},children:[(0,G.jsxs)(`div`,{className:`relative z-10 flex shrink-0 items-center justify-between border-b border-border bg-muted/30 px-4 py-2`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-muted-foreground`,children:r(`Mermaid preview`)}),(0,G.jsx)(`button`,{type:`button`,onClick:T,className:`flex h-7 w-7 items-center justify-center rounded-md border border-border bg-background/95 text-sm transition-colors hover:bg-accent hover:text-accent-foreground`,title:r(`Exit fullscreen`),children:(0,G.jsx)(ir,{className:`h-4 w-4`})})]}),(0,G.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,G.jsx)(`div`,{ref:y,className:W(`flex min-h-0 flex-1 select-none overflow-hidden`,p?`cursor-grabbing`:`cursor-grab`),onWheel:D,onMouseDown:O,onMouseMove:k,onMouseUp:A,onMouseLeave:A,onClick:j,onKeyDown:j,children:(0,G.jsx)(`div`,{className:`m-auto origin-center transition-transform duration-100 ease-out`,style:{transform:`translate(${d.x}px, ${d.y}px) scale(${l})`},children:(0,G.jsx)(`div`,{className:`p-4`,dangerouslySetInnerHTML:{__html:a}})})}),(0,G.jsx)(`div`,{className:`absolute right-4 bottom-4`,children:F(`md`)})]})]})]}):(0,G.jsx)(`div`,{className:W(`flex items-center justify-center rounded-lg border border-border bg-muted/30 p-8`,n),children:(0,G.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:r(`Loading Mermaid diagram...`)})})}var E2=/^[a-z][a-z\d+.-]*:/i,D2=/^(?:https?|ircs?|mailto|xmpp):/i,O2=/^(?:[a-z]:[\\/]|\\\\)/i;function k2(e){let t=e?.trim();if(!t||!/^https?:\/\//i.test(t))return null;try{return new URL(t)}catch{return null}}function A2(e){let t=/^(.*?):(\d+)(?:-\d+)?$/.exec(e);if(!t)return{path:e};let n=Number(t[2]);return n>0?{path:t[1],line:n}:{path:t[1]}}function j2(e){try{return decodeURIComponent(e)}catch{return null}}function M2(e){let t=e.search(/[?#]/);return t<0?e:e.slice(0,t)}function N2(e){try{let t=new URL(e);if(t.protocol!==`file:`)return null;let n=decodeURIComponent(t.pathname);return n?(t.hostname&&t.hostname.toLowerCase()!==`localhost`?n=`//${t.hostname}${n}`:/^\/[a-z]:[\\/]/i.test(n)&&(n=n.slice(1)),n):null}catch{return null}}function P2(e){let t=e.trim();if(!t||t.startsWith(`#`)||t.startsWith(`?`))return{kind:`external`};if(/^file:/i.test(t)){let e=N2(t);return e?{kind:`local`,path:e}:{kind:`blocked`}}if(D2.test(t)||t.startsWith(`//`))return{kind:`external`};let n=j2(M2(t));return n==null||n.includes(`\0`)||E2.test(n)&&!O2.test(n)?{kind:`blocked`}:{kind:`local`,path:n}}function F2(e){let t=e.replace(/\\/g,`/`),n=/^[a-z]:\//i.test(t)||t.startsWith(`//`);if(!n&&!t.startsWith(`/`))return null;let r=/^[a-z]:\//i.test(t)?t.slice(0,2).toLowerCase():null,i=(r||n?t.slice(2):t.slice(1)).split(`/`),a=[];for(let e of i)if(!(!e||e===`.`)){if(e===`..`){if(a.length===0)return null;a.pop()}else a.push(e)}return r?{value:`${r}/${a.join(`/`)}`.replace(/\/$/,``),windows:!0}:n?{value:`//${a.join(`/`)}`,windows:!0}:{value:`/${a.join(`/`)}`.replace(/\/$/,``)||`/`,windows:!1}}function I2(e){let t=e.replace(/\\/g,`/`),n=[];for(let e of t.split(`/`))if(!(!e||e===`.`)){if(e===`..`){if(n.length===0)return null;n.pop()}else{if(e.includes(`\0`))return null;n.push(e)}}return n.join(`/`)}function L2(e){return F2(e)!==null}function R2(e,t){if(!t)return F2(e)?null:I2(e);let n=F2(t);if(!n)return null;let r=n.windows&&/^\/[a-z]:[\\/]/i.test(e)?e.slice(1):e,i=F2(r);if(!i)return r===e?I2(e):null;if(i.windows!==n.windows)return null;let a=n.value.toLowerCase(),o=i.value.toLowerCase();if(o===a)return``;let s=n.value.endsWith(`/`)?n.value:`${n.value}/`;return o.startsWith(s.toLowerCase())?I2(i.value.slice(s.length)):null}function z2(e,t){let n=t?F2(t):null;if(!n||R2(e,t)!==null)return null;let r=n.windows&&/^\/[a-z]:[\\/]/i.test(e)?e.slice(1):e;return F2(r)?r:null}var B2=/^(?:%|ms|s|sec|min|h|ms\/op|ns|µs|us|b|kb|mb|gb|tb|kib|mib|gib|x|×|k|m|bn)$/i;function V2(e){let t=e.trim().replace(/^[$€£¥₹]\s*/,``),n=!1;/^\(.*\)$/.test(t)&&(n=!0,t=t.slice(1,-1));let r=/^([+-]?(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?)\s*(\S*)$/.exec(t);if(!r||r[2]&&!B2.test(r[2]))return null;let i=Number(r[1].replace(/,/g,``));return n?-i:i}function H2(e){let t=Math.max(0,...e.map(e=>e.length));return Array.from({length:t},(t,n)=>{let r=e.map(e=>e[n]?.trim()??``).filter(Boolean);return r.length>0&&r.every(e=>V2(e)!==null)})}function U2(e,t,n){return n?(V2(e)??0)-(V2(t)??0):e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function W2(e,t,n){let r=e.map((e,t)=>t);if(!t)return r;let i=t.dir===`asc`?1:-1,a=n=>e[n][t.column]?.trim()??``;return r.sort((e,r)=>{let o=a(e),s=a(r);return!o||!s?o?-1:+!!s:i*U2(o,s,n[t.column]??!1)||e-r})}function G2(e,t){return e?.column===t?e.dir===`asc`?{column:t,dir:`desc`}:null:{column:t,dir:`asc`}}var K2=new Set([`json`,`jsonc`,`json5`]),q2=new Set([`console`,`shell-session`,`terminal`,`output`,`ansi`]),J2=new Set([`sh`,`bash`,`shell`,`zsh`,`shellscript`]),Y2=`$ `;function X2(e,t){let n=e?.toLowerCase();if(n&&K2.has(n))return Z2(t)?`json`:null;if(!n&&/^\s*[{[]/.test(t)&&Z2(t))return`json`;if(n&&q2.has(n)||t.includes(`\x1B[`))return`terminal`;if(!n||J2.has(n)){let e=t.split(`
252
- `).filter(e=>e.trim());if(e[0]?.startsWith(Y2)&&e.some(e=>!e.startsWith(Y2)))return`terminal`}return null}function Z2(e){let t=Q2(e);return t.ok&&typeof t.value==`object`&&t.value!==null}function Q2(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===`"`){let r=n+1;for(;r<e.length&&e[r]!==`"`;)r+=e[r]===`\\`?2:1;t+=e.slice(n,r+1),n=r+1}else if(r===`/`&&e[n+1]===`/`)for(;n<e.length&&e[n]!==`
253
- `;)n++;else if(r===`/`&&e[n+1]===`*`){let t=e.indexOf(`*/`,n+2);n=t<0?e.length:t+2}else r===`,`&&/^\s*[}\]]/.test(e.slice(n+1))||(t+=r),n++}try{return{ok:!0,value:JSON.parse(t)}}catch{return{ok:!1}}}var $2=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`],e4=[0,95,135,175,215,255],t4=`\x1B`,n4=`\x07`,r4=RegExp(`${t4}\\[([0-9;?]*)([A-Za-z])|${t4}\\][^${n4}${t4}]*(?:${n4}|${t4}\\\\)?|${t4}[@-Z\\\\-_]`,`g`);function i4(...e){return`#${e.map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function a4(e){if(e<0||e>255)return;if(e<8)return $2[e];if(e<16)return`bright-${$2[e-8]}`;if(e<232){let t=e-16;return i4(e4[Math.floor(t/36)],e4[Math.floor(t/6)%6],e4[t%6])}let t=8+(e-232)*10;return i4(t,t,t)}function o4(e,t){if(e[t+1]===5)return[a4(e[t+2]??-1),3];if(e[t+1]===2){let[n,r,i]=e.slice(t+2,t+5);return[n===void 0||r===void 0||i===void 0?void 0:`rgb(${n},${r},${i})`,5]}return[void 0,1]}function s4(e,t){let n=t?t.split(`;`).map(e=>Number(e||0)):[0],r={...e};for(let e=0;e<n.length;e++){let t=n[e];if(t===0)r={};else if(t===1)r.bold=!0;else if(t===2)r.dim=!0;else if(t===3)r.italic=!0;else if(t===4)r.underline=!0;else if(t===22)delete r.bold,delete r.dim;else if(t===23)delete r.italic;else if(t===24)delete r.underline;else if(t>=30&&t<=37)r.fg=$2[t-30];else if(t>=90&&t<=97)r.fg=`bright-${$2[t-90]}`;else if(t>=40&&t<=47)r.bg=$2[t-40];else if(t>=100&&t<=107)r.bg=`bright-${$2[t-100]}`;else if(t===39)delete r.fg;else if(t===49)delete r.bg;else if(t===38||t===48){let[i,a]=o4(n,e);i&&(r[t===38?`fg`:`bg`]=i),e+=a-1}}return r}var c4=(e,t)=>e.fg===t.fg&&e.bg===t.bg&&e.bold===t.bold&&e.dim===t.dim&&e.italic===t.italic&&e.underline===t.underline;function l4(e){let t=[],n={},r=e=>{if(!e)return;let r=t.at(-1);r&&c4(r,n)?r.text+=e:t.push({text:e,...n})},i=0;for(let t of e.matchAll(r4))r(e.slice(i,t.index)),i=t.index+t[0].length,t[2]===`m`&&!t[1]?.includes(`?`)&&(n=s4(n,t[1]??``));return r(e.slice(i)),t}function u4(e){return e.replace(r4,``)}function d4(e){let t=[];for(let n of e.split(`
254
- `)){if(n.startsWith(Y2)){t.push({kind:`command`,text:n.slice(2)});continue}let e=t.at(-1);e?.kind===`output`?e.text+=`\n${n}`:t.push({kind:`output`,text:n})}return t}var f4=40,p4={black:`#6e7781`,red:`#d1242f`,green:`#1a7f37`,yellow:`#9a6700`,blue:`#0969da`,magenta:`#8250df`,cyan:`#1b7c83`,white:`#8c959f`,"bright-black":`#8c959f`,"bright-red":`#e5534b`,"bright-green":`#3fb950`,"bright-yellow":`#d4a72c`,"bright-blue":`#539bf5`,"bright-magenta":`#b083f0`,"bright-cyan":`#39c5cf`,"bright-white":`#adbac7`};function m4({segment:e}){let{text:t,fg:n,bg:r,bold:i,dim:a,italic:o,underline:s}=e;return!n&&!r&&!i&&!a&&!o&&!s?t:(0,G.jsx)(`span`,{style:{color:n?p4[n]??n:void 0,backgroundColor:r?p4[r]??r:void 0},className:W(i&&`font-semibold`,a&&`opacity-60`,o&&`italic`,s&&`underline`),children:t})}function h4({source:e}){let{t}=K(),[n,r]=(0,H.useState)(!1),i=e.split(`
255
- `),a=!n&&i.length>f4,o=a?i.slice(-20).join(`
256
- `):e,s=(0,H.useMemo)(()=>d4(o),[o]);return(0,G.jsxs)(`div`,{"data-enso":`terminal-block`,className:`group/code relative my-2`,children:[(0,G.jsxs)(`div`,{className:`overflow-x-auto rounded-lg border bg-[var(--sunken,var(--muted))] p-3 font-mono text-(length:--chat-code-block-size) leading-relaxed`,children:[a&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!0),className:`mb-1 text-[11px] text-muted-foreground hover:text-foreground`,children:t(`Show all {{count}} lines`,{count:i.length})}),s.map((e,t)=>e.kind===`command`?(0,G.jsxs)(`div`,{className:`whitespace-pre font-semibold`,children:[(0,G.jsx)(`span`,{className:`select-none text-muted-foreground`,children:`$ `}),u4(e.text)]},t):(0,G.jsx)(`div`,{className:`whitespace-pre`,children:l4(e.text).map((e,t)=>(0,G.jsx)(m4,{segment:e},t))},t))]}),(0,G.jsx)(Fs,{text:()=>u4(e),className:`absolute top-1.5 right-1.5 rounded-md border bg-background/80 p-1.5 text-muted-foreground opacity-0 backdrop-blur transition-opacity group-hover/code:opacity-100`})]})}function g4(e){if(!e)return;let t=e.split(`:`).at(-1)??e;return/\.(\w+)$/.exec(t)?.[1]||(/^[\w-]+$/.test(e)?e:void 0)}var _4={note:{label:`Note`,border:`border-blue-500`,text:`text-blue-600 dark:text-blue-400`},tip:{label:`Tip`,border:`border-green-500`,text:`text-green-600 dark:text-green-400`},important:{label:`Important`,border:`border-purple-500`,text:`text-purple-600 dark:text-purple-400`},warning:{label:`Warning`,border:`border-amber-500`,text:`text-amber-600 dark:text-amber-400`},caution:{label:`Caution`,border:`border-red-500`,text:`text-red-600 dark:text-red-400`}};function v4(){return e=>{KX(e,`blockquote`,e=>{let t=e.children[0];if(t?.type!==`paragraph`)return;let n=t.children[0];if(n?.type!==`text`)return;let r=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*/i.exec(n.value);if(!r)return;n.value=n.value.slice(r[0].length),n.value||t.children.shift();let i=r[1].toLowerCase();e.data={...e.data,hProperties:{...e.data?.hProperties,"data-alert":i,dataAlert:i}}})}}var y4=/^(?:[\w.@-]+\/)+[\w.@-]+\.\w{1,8}(?::\d+(?:-\d+)?)?$|^[\w.-]+\.\w{1,8}:\d+(?:-\d+)?$/,b4=/^(?!(?:\.+\/)+$)(?:[\w.@-]+\/)+$/,x4=`rounded-[5px] border border-border/70 bg-muted/70 px-1 py-px font-mono text-(length:--chat-inline-code-size) [font-weight:var(--chat-inline-code-weight)]`,S4=[K1,v4],C4=(0,H.createContext)({text:``,streaming:!1,searchQuery:``,activeNth:-1}),w4=(0,H.createContext)(null),T4=(0,H.createContext)(!0);function E4({text:e}){let{t}=K(),[n,r]=(0,H.useState)(!1),i=()=>{let n=window.getSelection?.();n&&!n.isCollapsed&&n.toString()||X1(e).then(e=>{e&&(r(!0),setTimeout(()=>r(!1),1200),vD({type:`success`,title:t(`Copied`)}))})};return(0,G.jsxs)(`span`,{role:`button`,tabIndex:0,title:t(`Copy`),"data-copy-code":``,className:`group/copy relative cursor-pointer`,onClick:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())},children:[(0,G.jsx)(`code`,{className:x4,children:e}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:W(`pointer-events-none absolute -top-2.5 -right-2 inline-flex rounded-[4px] border border-border bg-background p-0.5 text-muted-foreground shadow-sm transition-opacity`,n?`opacity-100`:`opacity-0 group-hover/copy:opacity-100`),children:n?(0,G.jsx)(_t,{className:`h-3 w-3`}):(0,G.jsx)(Ft,{className:`h-3 w-3`})})]})}function D4(e){for(let t=e.parentElement;t;t=t.parentElement){let{overflowY:e}=getComputedStyle(t);if(e===`auto`||e===`scroll`)return t}return null}function O4(e){let[t,n]=(0,H.useState)(null),[r,i]=(0,H.useState)(()=>typeof IntersectionObserver!=`function`);return(0,H.useEffect)(()=>{if(!e||!t||r)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&i(!0)},{root:D4(t),rootMargin:`100% 0px`});return n.observe(t),()=>n.disconnect()},[e,t,r]),[n,r]}function k4(e,t){let[n,r]=(0,H.useState)(null);return(0,H.useEffect)(()=>{if(!t)return;let n=setTimeout(()=>r(e),300);return()=>clearTimeout(n)},[e,t]),!t||n===e}function A4(e,t){switch(e){case`invalid-path`:return t(`The link is outside the current workspace.`);case`unsupported`:return t(`This link is not available on the local computer.`);case`unavailable`:return t(`The linked file or folder is unavailable.`);case`unsupported-viewer`:return t(`This file format cannot be previewed inside EnsoCode.`);case`too-large`:return t(`The image is too large to preview.`);case`invalid-application`:return t(`The selected application path is invalid.`);case`application-unavailable`:return t(`VS Code is unavailable. Install it or select another application.`);default:return e}}async function j4(e,t,n,r){try{let r=R2(t,e.cwd);if(r===null)throw Error(`invalid-path`);let i=await window.electronAPI.workspaceFiles.openContext({conversationId:e.conversationId,projectId:e.projectId,rel:r,itemId:n});if(!i.ok)throw Error(i.error)}catch(e){vD({type:`error`,title:r(`Could not open local file link`),description:A4(e instanceof Error?e.message:String(e),r)})}}function M4({context:e,file:t,extra:n,children:r}){let{t:i}=K(),a=E(e=>e.contextMenuOpen),o=e?a.filter(e=>e.enabled):[];return o.length===0&&!n?r:(0,G.jsxs)(FG,{children:[(0,G.jsx)(IG,{render:r,onContextMenu:e=>e.stopPropagation()}),(0,G.jsxs)(LG,{className:`min-w-48`,children:[n,o.map(n=>{let r=n.target===`application`?(n.applicationPath.split(/[/\\]/).at(-1)??n.applicationPath).replace(/\.(?:exe|app)$/i,``):`VS Code`;return(0,G.jsx)(RG,{closeOnClick:!0,onClick:()=>e&&void j4(e,t,n.id,i),children:n.target===`reveal`?i(q1()):i(`Open in {{app}}`,{app:r})},n.id)})]})]})}function N4(e){let t=P2(e);if(t.kind===`external`)return{classification:t,line:void 0};let n=A2(t.kind===`local`?t.path:e);return n.line&&/\.[\w]+$/.test(n.path)?{classification:P2(n.path),line:n.line}:{classification:t,line:void 0}}function P4(e){let t=e?.children;if(t?.length!==1)return null;let n=t[0],r=n.tagName===`code`&&n.children?.length===1?n.children[0]:null;return r?.type===`text`&&typeof r.value==`string`?r.value:null}function F4(e,t){let{t:n}=K(),r=(0,H.useContext)(w4),[i,a]=(0,H.useState)(null),o=e=>{vD({type:`error`,title:n(`Could not open local file link`),description:A4(e,n)})},s=r&&e!==null?z2(e,r.cwd):null,c=async e=>{if(r)try{let t=await window.electronAPI.workspaceFiles.revealExternal({conversationId:r.conversationId,projectId:r.projectId,path:e});!t.ok&&t.error!==`cancelled`&&o(t.error)}catch(e){o(e instanceof Error?e.message:String(e))}};return{linkContext:r,external:s,openLocal:async n=>{if(!r||e===null)return;let i=R2(e,r.cwd);if(i==null){s?await c(s):o(`invalid-path`);return}if(!n&&t){u0(r.conversationId,i,t);return}let l={conversationId:r.conversationId,projectId:r.projectId,rel:i};try{if(n){let e=await window.electronAPI.workspaceFiles.reveal(l);e.ok||o(e.error);return}let e=await window.electronAPI.workspaceFiles.open(l);if(!e.ok){o(e.error);return}if(e.target===`handled`)return;if(e.viewer===`image`){let t=KG(e.rel);if(!t){o(`unsupported-viewer`);return}let n=await window.electronAPI.workspaceFiles.readImage({...l,rel:e.rel});if(!n.ok){o(n.error);return}let r=`data:${t};base64,`;if(!n.dataUrl.startsWith(r)||!/^[A-Za-z0-9+/=]+$/.test(n.dataUrl.slice(r.length))){o(`unsupported-viewer`);return}a({rel:e.rel,dataUrl:n.dataUrl})}else e.viewer===`markdown`?u0(r.conversationId,e.rel,void 0,`markdown`):u0(r.conversationId,e.rel)}catch(e){o(e instanceof Error?e.message:String(e))}},preview:(0,G.jsx)(J1,{image:i,onClose:()=>a(null)})}}function I4({path:e,children:t}){let{t:n}=K(),r=E(e=>e.contextMenuOpen.some(e=>e.enabled&&e.target===`reveal`)),{classification:i}=N4(e),a=i.kind===`local`?i.path:null,{linkContext:o,external:s,openLocal:c,preview:l}=F4(a),u=E(e=>e.projects.some(e=>e.id===o?.projectId&&e.kind===`ssh`)),d=o!==null&&a!==null&&R2(a,o.cwd)!==null,f=(0,G.jsxs)(G.Fragment,{children:[(d&&!r||!d&&s)&&!u&&(0,G.jsx)(RG,{closeOnClick:!0,onClick:()=>void c(!0),children:n(q1())}),(0,G.jsx)(RG,{closeOnClick:!0,onClick:()=>{navigator.clipboard.writeText(a??e).then(()=>vD({type:`success`,title:n(`Copied`)}),e=>vD({type:`error`,title:n(`Copy failed`),description:e instanceof Error?e.message:String(e)}))},children:n(`Copy Path`)})]});return d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(M4,{context:o,file:a??e,extra:f,children:(0,G.jsx)(`span`,{role:`link`,tabIndex:0,className:`cursor-pointer`,onClick:()=>void c(!1),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c(!1))},children:t})}),l]}):(0,G.jsx)(M4,{context:null,file:a??e,extra:f,children:(0,G.jsx)(`span`,{children:t})})}function L4({children:e,href:t,node:n}){let{t:r}=K(),{classification:i,line:a}=N4(t??``),{linkContext:o,external:s,openLocal:c,preview:l}=F4(i.kind===`local`?i.path:null,a),u=i.kind===`local`&&o!==null,d=u?P4(n):null,f=(0,H.useContext)(T4),p=u&&!s&&i.kind===`local`&&R2(i.path,o?.cwd)||null,m=F0(p?o:null,p,f),h=E(e=>e.openLinksInBuiltinBrowser&&ue(e.disabledBuiltinTools,e.projects,o?.projectId,`browser`))&&o&&i.kind===`external`?k2(t):null,g=e=>{if(i.kind===`external`){if(!h||!o||(ND?e.metaKey:e.ctrlKey))return;let t=f0(o.conversationId,h.href);if(!t)return;e.preventDefault(),t.then(e=>{e.ok||vD({type:`error`,title:r(`Navigation failed`),description:e.error})});return}e.preventDefault(),u&&_()},_=async()=>{if(p&&o&&(await P0(o,p)).status!==`ok`){vD({type:`error`,title:r(`Could not open local file link`),description:A4(`unavailable`,r)});return}await c(!1)},v=(0,G.jsx)(`a`,{href:i.kind===`external`&&t||void 0,className:W(`text-brand underline decoration-brand/40 underline-offset-2 transition-colors hover:decoration-brand`,u&&`cursor-pointer break-all`),role:u?`link`:void 0,tabIndex:u?0:void 0,title:h?r(`{{key}}+Click to open in external browser`,{key:ND?`Cmd`:`Ctrl`}):void 0,...i.kind===`external`?{target:`_blank`,rel:`noreferrer`}:{},onClick:g,onKeyDown:e=>{u&&e.key===`Enter`&&(e.preventDefault(),_())},children:d??e});if(!u||i.kind!==`local`||!o)return v;if(!s&&m?.status!==`ok`)return d===null?(0,G.jsx)(`span`,{children:e}):p&&!m?(0,G.jsx)(`code`,{className:x4,children:d}):(0,G.jsx)(E4,{text:d});let y=s?(0,G.jsx)(M4,{context:null,file:i.path,extra:(0,G.jsx)(RG,{closeOnClick:!0,onClick:()=>void c(!0),children:r(q1())}),children:v}):(0,G.jsx)(M4,{context:o,file:i.path,children:v});return d===null?(0,G.jsxs)(`span`,{className:`inline`,children:[y,(0,G.jsx)(`button`,{type:`button`,className:`ml-1 inline-flex rounded p-0.5 align-middle text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":r(q1()),title:r(q1()),onClick:()=>void c(!0),children:(0,G.jsx)(Kt,{className:`h-3.5 w-3.5`})}),l]}):(0,G.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-0.5 rounded-[5px] border border-border/70 bg-muted/70 py-px pr-0.5 pl-1 align-baseline font-mono text-(length:--chat-inline-code-size) [font-weight:var(--chat-inline-code-weight)]`,children:[y,(0,G.jsx)(`button`,{type:`button`,className:`inline-flex shrink-0 rounded-[3px] p-0.5 text-muted-foreground hover:bg-background hover:text-foreground`,"aria-label":r(q1()),title:r(q1()),onClick:()=>void c(!0),children:(0,G.jsx)(Kt,{className:`h-3 w-3`})}),l]})}function R4(e,t,n=!0){let r=JZ(e);return r||t!==`href`?r:n&&N4(e).classification.kind===`local`?e:``}var z4=`my-2 leading-[1.625] first:mt-0 last:mb-0`;function B4({children:e}){let{t}=K(),n=(0,H.useContext)(w4),r=(0,H.useContext)(T4),i=typeof e==`string`?e:``,a=b4.test(i)||y4.test(i),{path:o,line:s}=A2(i),c=a&&n&&!(b4.test(i)&&Z1())&&R2(o,n.cwd)||null,l=F0(c?n:null,c,r);if(!a)return(0,G.jsx)(`code`,{className:x4,children:e});if(!c||!n||l?.status===`missing`)return(0,G.jsx)(E4,{text:i});if(!l)return(0,G.jsx)(`code`,{className:x4,children:e});if(l.kind===`dir`&&Z1())return(0,G.jsx)(E4,{text:i});let u=e=>vD({type:`error`,title:t(`Could not open local file link`),description:A4(e,t)}),d=async()=>{let e=await P0(n,c);if(e.status!==`ok`){u(`unavailable`);return}if(e.kind===`file`){u0(n.conversationId,e.rel,s);return}try{let t=await window.electronAPI.workspaceFiles.reveal({conversationId:n.conversationId,projectId:n.projectId,rel:e.rel});t.ok||u(t.error)}catch(e){u(e instanceof Error?e.message:String(e))}};return(0,G.jsx)(M4,{context:n,file:l.rel,children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>void d(),title:i,className:`inline-flex max-w-full items-center rounded-[5px] border border-border/70 bg-muted/70 px-1 py-px align-baseline font-mono text-(length:--chat-inline-code-size) [font-weight:var(--chat-inline-code-weight)] text-brand transition-colors hover:bg-muted`,children:(0,G.jsx)(`span`,{className:`truncate`,children:i})})})}var V4=`mt-4 mb-2 text-(length:--chat-h1-size) leading-tight [font-weight:var(--chat-h1-weight)]`,H4=`mt-4 mb-2 text-(length:--chat-h2-size) leading-tight [font-weight:var(--chat-h2-weight)]`,U4=`mt-3 mb-1.5 text-(length:--chat-h3-size) leading-tight [font-weight:var(--chat-h3-weight)]`,W4=`mt-3 mb-1 text-(length:--chat-h4-size) [font-weight:var(--chat-h4-weight)]`,G4=`whitespace-nowrap border-b border-border px-2 py-1 text-left font-medium`,K4=`whitespace-nowrap border-b border-border/50 px-2 py-1`;function q4({source:e,language:t,streaming:n}){let r=(0,H.useMemo)(()=>{let r=X2(t,e);if(r===`json`){let t=Q2(e);return!n&&t.ok?{kind:r,value:t.value}:null}return r?{kind:r}:null},[t,e,n]);return r?.kind===`json`?(0,G.jsx)(z0,{source:e,value:r.value}):r?.kind===`terminal`?(0,G.jsx)(h4,{source:e}):(0,G.jsx)(h0,{code:e,language:t,streaming:n})}var J4=6;function Y4(e){return e.type===`text`?e.value:`children`in e?e.children.map(Y4).join(``):``}var X4=(e,t)=>(e?.children??[]).filter(e=>e.type===`element`&&e.tagName===t),Z4=(e,t)=>H.Children.toArray(e).filter(e=>(0,H.isValidElement)(e)&&(t===void 0||e.type===t));function Q4({children:e,sort:t,onSort:n}){return n?(0,G.jsx)(`th`,{className:G4,"aria-sort":t===`asc`?`ascending`:t===`desc`?`descending`:void 0,children:(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:`group/sort inline-flex items-center gap-1 hover:text-foreground`,children:[e,(0,G.jsx)(t===`desc`?st:lt,{className:W(`h-3 w-3 shrink-0`,t===`none`?`opacity-0 group-hover/sort:opacity-40`:`opacity-70`)})]})}):(0,G.jsx)(`th`,{className:G4,children:e})}function $4({children:e,node:t}){let{t:n}=K(),{text:r,streaming:i}=(0,H.useContext)(C4),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(null),l=t?.position?.start?.offset,u=t?.position?.end?.offset,d=l!==void 0&&u!==void 0?r.slice(l,u):null,f=Z4(e),p=f.find(e=>e.type===`thead`),m=Z4(f.find(e=>e.type===`tbody`)?.props.children,`tr`),h=(0,H.useMemo)(()=>X4(t,`tbody`).flatMap(e=>X4(e,`tr`)).map(e=>e.children.filter(e=>e.type===`element`).map(Y4)),[t]),g=(0,H.useMemo)(()=>H2(h),[h]),_=!i&&p!==void 0&&h.length>=2&&m.length===h.length,v=e;if(_){let e=s?.trim().toLowerCase(),t=W2(h,a,g).filter(t=>!e||h[t].join(` `).toLowerCase().includes(e)),n=Z4(p.props.children,`tr`);v=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`thead`,{children:n.map((e,t)=>(0,H.cloneElement)(e,{key:e.key??t},Z4(e.props.children).map((e,t)=>(0,H.cloneElement)(e,{key:e.key??t,sort:a?.column===t?a.dir:`none`,onSort:()=>o(e=>G2(e,t))}))))}),(0,G.jsx)(`tbody`,{children:t.map(e=>m[e])})]})}let y=`rounded-md border bg-background/80 p-1.5 text-muted-foreground opacity-0 backdrop-blur transition-opacity group-hover/table:opacity-100`;return(0,G.jsxs)(`div`,{className:`group/table relative my-2 min-w-0 max-w-full`,children:[_&&s!==null&&(0,G.jsx)(`input`,{autoFocus:!0,type:`text`,onInput:e=>c(e.currentTarget.value),onKeyDown:e=>{e.key===`Escape`&&c(null)},placeholder:n(`Search table`),className:`mb-1 h-7 w-56 rounded-md border bg-background px-2 text-xs outline-none focus:border-ring`}),(0,G.jsx)(`div`,{className:`overflow-x-auto overscroll-x-contain [-webkit-overflow-scrolling:touch]`,children:(0,G.jsx)(`table`,{className:`w-max min-w-full border-collapse text-(length:--chat-table-size) [font-weight:var(--chat-table-weight)] leading-[1.5] [overflow-wrap:normal]`,children:v})}),d&&!i&&(0,G.jsxs)(`div`,{className:`absolute top-0.5 right-0.5 flex gap-1`,children:[_&&h.length>=J4&&(0,G.jsx)(`button`,{type:`button`,title:n(`Search table`),onClick:()=>c(e=>e===null?``:null),className:W(y,`hover:text-foreground`),children:(0,G.jsx)(Fn,{className:`h-3 w-3`})}),(0,G.jsx)(Fs,{text:d,className:y})]})]})}var e3={p:({children:e})=>(0,G.jsx)(u3,{className:z4,children:e}),a:L4,ul:({children:e})=>(0,G.jsx)(`ul`,{className:`my-2 list-disc space-y-1 pl-5 leading-[1.625] marker:text-muted-foreground [&_p]:leading-[1.625]`,children:e}),ol:({children:e})=>(0,G.jsx)(`ol`,{className:`my-2 list-decimal space-y-1 pl-5 leading-[1.625] marker:text-muted-foreground [&_p]:leading-[1.625]`,children:e}),h1:({children:e})=>(0,G.jsx)(`h1`,{className:V4,children:e}),h2:({children:e})=>(0,G.jsx)(`h2`,{className:H4,children:e}),h3:({children:e})=>(0,G.jsx)(`h3`,{className:U4,children:e}),h4:({children:e})=>(0,G.jsx)(`h4`,{className:W4,children:e}),h5:({children:e})=>(0,G.jsx)(`h5`,{className:W4,children:e}),h6:({children:e})=>(0,G.jsx)(`h6`,{className:W4,children:e}),blockquote:({children:e,node:t})=>{let{t:n}=K(),r=t?.properties,i=_4[String(r?.dataAlert??r?.[`data-alert`]??``)];return i?(0,G.jsxs)(`blockquote`,{className:W(`my-1.5 border-l-2 pl-3`,i.border),children:[(0,G.jsx)(`p`,{className:W(`mt-1.5 mb-0.5 text-xs font-semibold`,i.text),children:n(i.label)}),e]}):(0,G.jsx)(`blockquote`,{className:`my-2 border-l-2 border-brand/30 pl-3 text-muted-foreground`,children:e})},code:B4,pre:({node:e})=>{let{streaming:t}=(0,H.useContext)(C4),n=e?.children?.[0],r=n&&`properties`in n?n.properties:void 0,i=/language-(\S+)/.exec(r?.className?.join(` `)??``)?.[1],a=n&&`children`in n?n.children?.[0]:void 0,o=(a&&`value`in a?String(a.value):``).replace(/\n$/,``),s=g4(i),c=lO(s);return c?(0,G.jsx)(yO,{pluginId:c.pluginId,lang:c.lang,source:o}):s?.toLowerCase()===`mermaid`?(0,G.jsx)(T2,{code:o,streaming:t}):(0,G.jsx)(q4,{source:o,language:s,streaming:t})},table:$4,th:Q4,td:({children:e})=>(0,G.jsx)(`td`,{className:K4,children:e}),hr:()=>(0,G.jsx)(`hr`,{className:`my-3 border-border`})},t3=new Set([`blockquote`,`div`,`dl`,`figure`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`hr`,`li`,`ol`,`p`,`pre`,`table`,`ul`]),n3=`mt-2 mb-0 leading-[1.625] first:mt-0`,r3=`empty:hidden whitespace-normal`;function i3(e){return e.type===`element`&&t3.has(e.tagName)}function a3(e,t,n){let r,i;for(let t of e?.children??[]){if(i3(t))break;let e=t.position?.start?.offset,n=t.position?.end?.offset;e!=null&&n!=null&&(r??=e,i=n)}if(r==null||i==null)return null;let a=t.slice(r,i);if(!a.trim())return null;let o=e?.position?.end?.offset??i;return{source:a,final:!n||o<t.trimEnd().length}}function o3(e,t){let n=0;for(let r of e)if(!(t&&r.type===`text`&&!r.value.trim())){if(i3(r))return n;n+=1}return null}function s3(e){let{text:t,streaming:n,leafSlot:r}=(0,H.useContext)(C4);if(!r)return null;let i=a3(e,t,n);return i?{...i,messageIndex:r.messageIndex,sessionId:r.sessionId,entry:r.entry}:null}function c3({text:e}){return(0,G.jsx)(x3,{text:e})}function l3({leaf:e}){return(0,G.jsx)(`div`,{className:r3,children:(0,G.jsx)(vO,{entry:e.entry,source:e.source,final:e.final,messageIndex:e.messageIndex,sessionId:e.sessionId,Markdown:c3})})}function u3({children:e,className:t}){let{searchQuery:n,activeNth:r}=(0,H.useContext)(C4);return(0,G.jsx)(`p`,{className:t,children:n.trim()?dU(e,n,r,{n:0}):e})}function d3({children:e,node:t}){let n=s3(t);return n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u3,{className:n3,children:e}),(0,G.jsx)(l3,{leaf:n})]}):(0,G.jsx)(u3,{className:z4,children:e})}function f3(e,t){return function({children:n,node:r}){let i=s3(r),a=(0,G.jsx)(e,{className:t,children:n});return i?(0,G.jsxs)(G.Fragment,{children:[a,(0,G.jsx)(l3,{leaf:i})]}):a}}function p3({tag:e,className:t,children:n,node:r}){let i=s3(r),a=e;if(!i)return(0,G.jsx)(a,{className:t,children:n});let o=o3(r?.children??[],e!==`li`),s=H.Children.toArray(n);return(0,G.jsxs)(a,{className:t,children:[o==null?s:s.slice(0,o),(0,G.jsx)(l3,{leaf:i}),o==null?null:s.slice(o)]})}var m3=f3(`h1`,V4),h3=f3(`h2`,H4),g3=f3(`h3`,U4),_3=f3(`h4`,W4),v3=f3(`h5`,W4),y3=f3(`h6`,W4),b3={...e3,p:d3,h1:m3,h2:h3,h3:g3,h4:_3,h5:v3,h6:y3,li:({children:e,node:t,className:n})=>(0,G.jsx)(p3,{tag:`li`,className:n,node:t,children:e}),th:({children:e,node:t})=>(0,G.jsx)(p3,{tag:`th`,className:G4,node:t,children:e}),td:({children:e,node:t})=>(0,G.jsx)(p3,{tag:`td`,className:K4,node:t,children:e})};function x3({text:e,streaming:t=!1,searchQuery:n=``,activeNth:r=-1,leafSlot:i=null}){let a=(0,H.useContext)(w4)!==null,[o,s]=O4(a),c=k4(e,t),l=s&&c,u=(0,H.useMemo)(()=>({text:e,streaming:t,searchQuery:n,activeNth:r,...i?{leafSlot:i}:{}}),[e,t,n,r,i]),d=(0,H.useMemo)(()=>(e,t)=>R4(e,t,a),[a]);return(0,G.jsx)(C4.Provider,{value:u,children:(0,G.jsx)(T4.Provider,{value:l,children:(0,G.jsx)(`div`,{ref:o,className:W(`[font-weight:var(--chat-body-weight)]`,t&&`t-stream-live`),children:(0,G.jsx)(WZ,{remarkPlugins:S4,components:i?b3:e3,urlTransform:d,children:e})})})})}function S3({leaf:e,...t}){dO();let n=oO(),r=(0,H.useMemo)(()=>n?{messageIndex:e.messageIndex,sessionId:e.sessionId,entry:n}:null,[n,e.messageIndex,e.sessionId]);return(0,G.jsx)(x3,{...t,leafSlot:r})}function C3({text:e,streaming:t=!1,searchQuery:n=``,activeNth:r=-1,leaf:i}){return i?(0,G.jsx)(S3,{text:e,streaming:t,searchQuery:n,activeNth:r,leaf:i}):(0,G.jsx)(x3,{text:e,streaming:t,searchQuery:n,activeNth:r})}function w3(e){let t=(e.split(`
257
- `).map(e=>e.replace(/^[#>\-*\s]+/u,``).trim()).find(Boolean)??``).replace(/\s+/gu,` `);return t.length>60?`${t.slice(0,60)}…`:t}function T3({message:e}){let{t}=K(),n=e.username?`@${e.username}`:``;return(0,G.jsxs)(`div`,{"data-telegram-inbound":e.channel,className:`w-full rounded-lg border border-border/60 bg-muted/20 px-3 py-2 text-sm`,children:[(0,G.jsxs)(`details`,{className:`group`,children:[(0,G.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,G.jsx)(In,{className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`shrink-0`,children:e.channel===`telegram`?t(`From Telegram`):t(`From {{name}}`,{name:e.title})}),n&&(0,G.jsx)(`span`,{className:`shrink-0 text-foreground`,children:n}),e.time&&(0,G.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.time]}),(0,G.jsx)(`span`,{className:`min-w-0 truncate font-normal group-open:hidden`,children:w3(e.body)})]}),(0,G.jsx)(`div`,{className:`mt-1.5 break-words`,children:(0,G.jsx)(C3,{text:e.body})})]}),e.imageLines&&(0,G.jsx)(`div`,{className:`mt-1.5`,children:(0,G.jsx)(WG,{entries:e.imageLines,align:`start`})})]})}var E3=H.createContext(void 0);function D3(e){let t=H.useContext(E3);if(t===void 0&&!e)throw Error(Cr(47));return t}var O3={...Zw,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},k3=class extends Dw{constructor(e,t,n){let r=new Ww;super(A3(e,r,t,n),j3(r),O3)}setOpen=(e,t)=>{let n=t.reason===zy,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=Rw(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};Lw(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),Gs.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function A3(e,t,n,r=!1){let i={...Gw(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Kw(t,n,r),i}function j3(e){return{popupRef:H.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:H.createRef(),beforeContentFocusGuardRef:H.createRef(),stickIfOpenTimeout:new nb,triggerElements:e}}function M3({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=P3(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),Uw(u,d),Bw(u);let{forceUnmount:m}=Vw(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),H.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),H.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,qy(Ky))}),[m,u]);let h=d||f;return(0,G.jsxs)(E3.Provider,{value:u,children:[s&&(0,G.jsx)(Iw,{handle:s,store:u}),h&&(0,G.jsx)(F3,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function N3(e){return D3(!0)?(0,G.jsx)(M3,{props:e}):(0,G.jsx)(PS,{children:(0,G.jsx)(M3,{props:e})})}function P3(e,t){let n=Fw((e,n)=>new k3(t,e,n));return H.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function F3({store:e,modal:t}){let n=JS(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return Hw(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var I3=H.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=D3(!0),h=Qw(s)??m;if(!h)throw Error(Cr(74));let g=Qy(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=H.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=zw(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=oT(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:vT(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=GS(v,{stickIfOpen:T}),A=RT(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=Fy({disabled:a,native:o}),P={open(e){return e&&w===`trigger-press`?ey.open(e):$v.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:I,handleFocusTargetFocus:ee}=wM(h,x),L=Vr(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,O,j,A,{[_S]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:P}),te=(0,G.jsx)(H.Fragment,{children:L},g);return C&&!D?(0,G.jsxs)(H.Fragment,{children:[(0,G.jsx)(qb,{ref:F,onFocus:I}),te,(0,G.jsx)(qb,{ref:h.context.triggerFocusTargetRef,onFocus:ee})]}):te}),L3=H.createContext(void 0);function R3(){let e=H.useContext(L3);if(e===void 0)throw Error(Cr(45));return e}var z3=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return D3().useState(`mounted`)||n?(0,G.jsx)(L3.Provider,{value:n,children:(0,G.jsx)(TS,{ref:t,...r})}):null}),B3=H.createContext(void 0);function V3(){let e=H.useContext(B3);if(!e)throw Error(Cr(46));return e}var H3=H.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=yS,..._}=e,v=D3(),y=R3(),b=MS(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`adaptiveOrigin`),M=H.useRef(null),N=jw(O),P=dD({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j}),F=x.useState(`domReferenceElement`);Y(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]);let I=E===!0&&w!==`trigger-hover`;oM(C&&I,D===`touch`,O,T);let ee=v.useStateSetter(`positionerElement`),L=hD(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,ee],hidden:!S,inert:!C});return(0,G.jsxs)(B3.Provider,{value:P,children:[S&&I&&(0,G.jsx)(TT,{inert:wT(!C),cutout:T}),(0,G.jsx)(NS,{id:b,children:L})]})}),U3=H.createContext(void 0);function W3(){let[e,t]=H.useState(0),n=jy(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:H.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var G3=H.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=D3(),l=V3(),u=qj(!0)!=null,{context:d,hasClosePart:f}=W3(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);Mw({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),aT(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?Pw(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=Vr(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...Nw,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&xT.has(e.key)&&e.stopPropagation()}},mD(g),s],stateAttributesMapping:ny});return(0,G.jsx)(WS,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:uy(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,G.jsx)(U3.Provider,{value:d,children:M})})}),K3=H.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=D3(),{side:c}=V3(),l=s.useState(`instantType`),{children:u,state:d}=zM({store:s,side:c,children:a});return Vr(`div`,e,{state:{activationDirection:d.activationDirection,transitioning:d.transitioning,instant:l},ref:t,props:[o,{children:u}],stateAttributesMapping:RM})}),q3=N3;function J3(e){return(0,G.jsx)(I3,{"data-slot":`popover-trigger`,...e})}function Y3({children:e,className:t,positionerClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:s=!1,...c}){return(0,G.jsx)(z3,{children:(0,G.jsx)(H3,{align:i,alignOffset:o,className:W(`z-50 h-(--positioner-height) max-h-(--available-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,n),"data-slot":`popover-positioner`,side:r,sideOffset:a,children:(0,G.jsx)(G3,{className:W(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover bg-clip-padding text-popover-foreground shadow-lg transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]`,s&&`w-fit text-balance rounded-md text-xs shadow-black/5 shadow-md before:rounded-[calc(var(--radius-md)-1px)]`,t),"data-slot":`popover-popup`,...c,children:(0,G.jsx)(K3,{className:W(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 outline-none [--viewport-inline-padding:--spacing(4)] data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,s?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`),"data-slot":`popover-viewport`,children:e})})})})}var X3=new Map,Z3;function Q3(e){if(Z3?.revision===e)return Z3.request;let t=window.electronAPI.providers.listOauth().then(t=>{let n=new Map;for(let e of t)for(let t of e.accounts){if(typeof t.email!=`string`)continue;let e=``;for(let n of t.email){let t=n.codePointAt(0)??0;t>=32&&t!==127&&(e+=n)}e=e.trim(),e&&n.set(t.key,e)}return{revision:e,emails:n}}).catch(t=>(console.error(`Failed to load OAuth account metadata`,t),{revision:e,emails:X3})),n={revision:e,request:t,data:void 0};return Z3=n,t.then(e=>{Z3===n&&(n.data=e)}),t}function $3(){let e=mR(e=>e.snapshot.revision),[t,n]=(0,H.useState)(()=>Z3?.revision===e?Z3.data:void 0);return(0,H.useEffect)(()=>{let t=!1;return Q3(e).then(e=>{t||n(e)}),()=>{t=!0}},[e]),t?.revision===e?t.emails:X3}function e6(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677)}return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36)}function t6(e,t,n){return`${e}:${e6(t)}:${e6(n,1)}`}var n6=/(?:\x1b\]|\x9d)[^\x07\x1b\x9c]*(?:\x07|\x1b\\|\x9c|$)/g,r6=/(?:\x1b\[|\x9b)[0-?]*[ -/]*(?:[@-~]|$)/g;function i6(e){return e.replace(n6,``).replace(r6,``)}var a6=kN()(e=>({conversationId:null,result:null,tab:`session`,from:null,open:(t,n,r)=>e({conversationId:t,result:n??null,tab:n?`result`:`session`,from:r??null}),setTab:t=>e({tab:t}),close:()=>e({conversationId:null,result:null,tab:`session`,from:null})})),o6=kN()(()=>({back:null}));function s6(e){return aP.getState().conversations[e]?.parentId??e}function c6(e){let t=aP.getState().conversations[e]?.projectId;return E.getState().projects.some(e=>e.id===t&&e.kind===`secretary`)}var l6=!1;function u6(){l6||(l6=!0,aP.subscribe((e,t)=>{if(e.activeId===t.activeId)return;let{back:n}=o6.getState();n&&(!e.activeId||s6(e.activeId)!==n.to)&&o6.setState({back:null})}))}function d6(e,t){let n=aP.getState();if(!n.conversations[e])return;let r=t??n.activeId,i=r?s6(r):null,a=s6(e);u6(),a6.getState().close(),n.selectConversation(e),o6.setState({back:i&&i!==a&&c6(i)&&!c6(a)?{from:i,to:a}:null})}var f6=`
258
- …`;function p6(e){return e.length>=32768&&e.endsWith(f6)?e.slice(0,-2):null}function m6(e){return!!(e?.role===`user`&&e.optimistic&&e.deliveryRejected&&e.deliveryId&&!e.entryId)}function h6(e){return!!(e?.role===`user`&&e.optimistic&&!e.deliveryRejected&&!e.withdrawRequested&&e.deliveryId&&!e.entryId)}var g6=kN(e=>({byConversation:{},replace:(t,n)=>e(e=>{let r={...e.byConversation};if(n.length>0)r[t]=n;else if(r[t])delete r[t];else return e;return{byConversation:r}})}));function _6(e){let t=e.toLowerCase();return t.startsWith(`image/`)?`image`:t.startsWith(`text/`)||t===`application/json`||t===`application/javascript`||t===`application/xml`||t.endsWith(`+json`)||t.endsWith(`+xml`)?`text`:`file`}function v6(e){return!Number.isFinite(e)||e<1024?`${Math.max(0,Math.round(e))} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}async function y6(e){if(!window.electronAPI.remote){let t=await window.electronAPI.extensionPlugins.artifactSave(e.id);return t.ok?null:t.error}let t=await window.electronAPI.extensionPlugins.artifactRead(e.id);if(!t.ok)return t.error;let n=Uint8Array.from(atob(t.base64),e=>e.charCodeAt(0)),r=URL.createObjectURL(new Blob([n],{type:e.mime||`application/octet-stream`})),i=document.createElement(`a`);return i.href=r,i.download=e.name,i.click(),URL.revokeObjectURL(r),null}function b6({artifact:e,onDelete:t}){let[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(!1),c=_6(e.mime),l=async()=>{s(!0),a(null);let t=await window.electronAPI.extensionPlugins.artifactRead(e.id);if(s(!1),!t.ok){a(t.error),r(null);return}if(c===`image`){r({kind:`image`,body:`data:${t.info.mime};base64,${t.base64}`});return}if(c===`text`){r({kind:`text`,body:Q1(t.base64)});return}r(null),a(`这个文件不能在这里预览`)};return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:[e.name,(0,G.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[e.mime,` · `,v6(e.size)]})]}),c!==`file`&&(0,G.jsx)(Oa,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>void l(),children:`预览`}),(0,G.jsx)(Oa,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>{s(!0),y6(e).then(e=>{s(!1),a(e)})},children:window.electronAPI.remote?`下载`:`另存`}),t&&(0,G.jsx)(Oa,{size:`sm`,variant:`ghost`,onClick:()=>t(e.id),children:`删除`})]}),i&&(0,G.jsx)(`p`,{className:`text-destructive text-xs`,children:i}),n?.kind===`text`&&(0,G.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-all font-mono text-muted-foreground text-xs`,children:n.body}),n?.kind===`image`&&(0,G.jsx)(`img`,{src:n.body,alt:e.name,className:`max-h-48 max-w-full rounded border object-contain`})]})}function x6({artifacts:e,onDelete:t}){return e.length===0?(0,G.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`还没有产出文件`}):(0,G.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,G.jsx)(b6,{artifact:e,onDelete:t},e.id))})}function S6({artifacts:e,align:t=`tool-row`}){return(0,G.jsxs)(`div`,{className:W(`mt-1 mb-1.5 rounded-lg border border-border/70 bg-card px-3 py-2`,t===`card`?`w-full`:`ml-[30px]`),children:[(0,G.jsx)(`p`,{className:`mb-1 text-[11px] text-muted-foreground`,children:`产出文件`}),(0,G.jsx)(x6,{artifacts:e})]})}var C6={},w6=new Set,T6=new Map;function E6(e){return w6.add(e),()=>w6.delete(e)}function D6(e,t){let n=`${e}\0${t}`,r=T6.get(n);return r||(r=window.electronAPI.extensionPlugins.asset(e,t).then(e=>e.ok?`data:${e.mime};base64,${e.base64}`:null).catch(()=>null),r.then(e=>e===null&&T6.delete(n)),T6.set(n,r)),r}function O6({pluginId:e,icon:t,className:n}){let r=(0,H.useSyncExternalStore)(E6,()=>C6[e]),i=t??r,[a,o]=(0,H.useState)(null);return(0,H.useEffect)(()=>{if(o(null),!i)return;let t=!0;return D6(e,i).then(e=>t&&o(e)),()=>{t=!1}},[e,i]),a?(0,G.jsx)(`img`,{src:a,alt:``,className:W(`object-contain`,n)}):(0,G.jsx)(kn,{className:n})}var k6={read_only:`Read-only`,regenerable:`Regenerable output`,reversible_workspace_change:`Reversible workspace change`,data_loss:`Possible data loss`,system_state:`Changes system state`,exfiltration:`Sends data externally`,unclear_target:`Unclear target or intent`};function A6({value:e}){let t=Te(e),{t:n}=K();if(!t)return null;let r=`allow ${t.allow.toFixed(2)} · ask ${t.ask.toFixed(2)} · block ${t.block.toFixed(2)}`;return(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 border-border/60 border-t px-3 py-1 text-[10px] text-muted-foreground`,"data-approval-review":t.verdict,children:[(0,G.jsx)(`span`,{className:`font-semibold tracking-wide text-foreground/75`,children:t.verdict===`allow`?n(`Auto-managed · allowed`):n(`Auto-managed · denied`)}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsx)(`span`,{className:`font-mono`,children:t.model}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsx)(`span`,{className:`font-mono`,children:r}),t.reason&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsxs)(`span`,{children:[n(`Reason`),`: `,n(k6[t.reason])]})]})]})}function j6({ask:e,waiting:t}){let{t:n}=K(),r=e.answer!==null&&!e.options.includes(e.answer)?e.answer:null;return(0,G.jsxs)(`div`,{className:`space-y-1.5 px-3 py-2 text-xs`,children:[(0,G.jsx)(`p`,{className:`whitespace-pre-wrap break-words leading-relaxed text-foreground`,children:e.question}),(e.options.length>0||r!==null)&&(0,G.jsxs)(`ul`,{className:`space-y-0.5`,children:[e.options.map(t=>(0,G.jsx)(M6,{selected:t===e.answer,text:t},t)),r!==null&&(0,G.jsx)(M6,{selected:!0,text:r,label:e.options.length>0&&!e.autoSelected?n(`Custom answer`):void 0})]}),e.autoSelected&&(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:n(`No answer in time; the default was selected`)}),t&&e.answer===null&&(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:n(`Waiting for your answer`)})]})}function M6({selected:e,text:t,label:n}){let{t:r}=K(),i=e?wt:kt;return(0,G.jsxs)(`li`,{"data-selected":e||void 0,className:W(`flex items-start gap-1.5 rounded-md px-2 py-1 leading-relaxed`,e?`bg-primary/10 text-foreground`:`text-muted-foreground`),children:[(0,G.jsx)(i,{className:W(`mt-0.5 h-3.5 w-3.5 shrink-0`,e?`text-primary`:`opacity-40`)}),(0,G.jsxs)(`span`,{className:`min-w-0 whitespace-pre-wrap break-words`,children:[n&&(0,G.jsx)(`span`,{className:`mr-1.5 text-muted-foreground`,children:n}),t]}),e&&(0,G.jsx)(`span`,{className:`sr-only`,children:r(`Selected`)})]})}var N6=/^Subagent ".*" \(agentId [^,\s]+, runId [^)\s]+\) \S+ after .+\.$/gm,P6=/^The following is the subagent's report: .*$\n?/m,F6=/<usage>([\s\S]*?)<\/usage>/,I6=/^Background tasks this subagent started\b.*\n((?:- .*(?:\n|$))+)/m,L6=(e,t)=>{let n=RegExp(`^${t}: (\\d+)$`,`m`).exec(e);return n?Number(n[1]):null};function R6(e){let t=e.indexOf(`
259
- `),n=t<0?e:e.slice(0,t),r=t<0?``:e.slice(t+1),i=null,a=[],o=F6.exec(r);if(o){let e=I6.exec(r.slice(o.index+o[0].length));e&&(a=e[1].split(`
260
- `).filter(e=>e.startsWith(`- `)).map(e=>e.slice(2))),r=r.slice(0,o.index);let t=L6(o[1],`subagent_tokens`),n=L6(o[1],`tool_uses`),s=L6(o[1],`duration_ms`);t!==null&&n!==null&&s!==null&&(i={tokens:t,toolUses:n,durationMs:s})}return{header:n,report:r.replace(P6,``).trim(),usage:i,...a.length>0?{tasks:a}:{}}}function z6(e){let t=e.trim(),n=[...t.matchAll(N6)].map(e=>e.index);return n[0]===0?n.map((e,r)=>R6(t.slice(e,n[r+1]).replace(/\n+---\s*$/,``).trim())):null}function B6(e){return NT(`alert-dialog`,e)}function V6(e){return zE(e.open??!1),(0,G.jsx)(B6,{...e})}var H6=ET;function U6({className:e,style:t,...n}){return(0,G.jsx)(ry,{className:W(`fixed inset-0 bg-black/32 backdrop-blur-sm transition-all duration-200 ease-out data-ending-style:opacity-0 data-starting-style:opacity-0`,e),style:t,"data-slot":`alert-dialog-backdrop`,...n})}function W6({className:e,style:t,...n}){return(0,G.jsx)(FT,{className:W(`fixed inset-0 grid grid-rows-[1fr_auto] justify-items-center pt-6 sm:grid-rows-[1fr_auto_3fr] sm:p-4`,e),style:t,"data-slot":`alert-dialog-viewport`,...n})}function G6({className:e,showBackdrop:t=!0,zIndexLevel:n=`base`,...r}){let i=n===`nested`?BE.NESTED_MODAL_BACKDROP:BE.MODAL_BACKDROP,a=n===`nested`?BE.NESTED_MODAL_CONTENT:BE.MODAL_CONTENT,o=n===`nested`?BE.DROPDOWN_IN_NESTED_MODAL:BE.DROPDOWN_IN_MODAL;return(0,G.jsxs)(H6,{children:[(0,G.jsx)(AE,{}),t&&(0,G.jsx)(U6,{style:{zIndex:i}}),(0,G.jsx)(W6,{style:{zIndex:a},children:(0,G.jsx)(VE.Provider,{value:o,children:(0,G.jsx)(CT,{className:W(`sm:-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 grid max-h-full w-full min-w-0 border-t bg-popover bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-nested-dialog-open:origin-top data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden sm:max-w-lg sm:data-nested:data-ending-style:translate-y-8 sm:data-nested:data-starting-style:translate-y-8 sm:scale-[calc(1-0.1*var(--nested-dialogs))] sm:rounded-2xl sm:border sm:data-ending-style:scale-98 sm:data-starting-style:scale-98 sm:before:rounded-[calc(var(--radius-2xl)-1px)] dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]`,e),"data-slot":`alert-dialog-popup`,...r})})})]})}function K6({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`flex flex-col gap-2 p-6 not-has-[+[data-slot=alert-dialog-footer]]:pb-4 text-center max-sm:pb-4 sm:text-left`,e),"data-slot":`alert-dialog-header`,...t})}function q6({className:e,variant:t=`default`,...n}){return(0,G.jsx)(`div`,{className:W(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/50 py-4`,t===`bare`&&`pt-4 pb-6`,e),"data-slot":`alert-dialog-footer`,...n})}function J6({className:e,...t}){return(0,G.jsx)(IT,{className:W(`font-heading text-xl leading-none`,e),"data-slot":`alert-dialog-title`,...t})}function Y6({className:e,...t}){return(0,G.jsx)($y,{className:W(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function X6(e){return(0,G.jsx)(Jy,{"data-slot":`alert-dialog-close`,...e})}function Z6({open:e,onOpenChange:t,title:n,description:r,confirmLabel:i,cancelLabel:a,onConfirm:o,zIndexLevel:s}){let{t:c}=K();return(0,G.jsx)(V6,{open:e,onOpenChange:t,children:(0,G.jsxs)(G6,{className:`sm:max-w-sm`,zIndexLevel:s,children:[(0,G.jsxs)(K6,{children:[(0,G.jsx)(J6,{className:`text-base`,children:n}),r&&(0,G.jsx)(Y6,{children:r})]}),(0,G.jsxs)(q6,{variant:`bare`,children:[(0,G.jsx)(X6,{render:(0,G.jsx)(Oa,{variant:`outline`,size:`sm`}),children:a??c(`Cancel`)}),(0,G.jsx)(Oa,{variant:`destructive`,size:`sm`,onClick:()=>{o(),t(!1)},children:i})]})]})})}function Q6(e,t){return!e||e<=0||t===void 0||t>=e?null:Math.round((1-t/e)*100)}function $6({hits:e,defaultOpen:t=!1}){let{t:n}=K();return e.length===0?(0,G.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:n(`No results`)}):(0,G.jsx)(`ul`,{className:`divide-y divide-border/60`,children:e.map(e=>(0,G.jsx)(t8,{hit:e,defaultOpen:t},e.id))})}function e8({view:e}){let{t}=K(),n=e.written?e.deduplicated&&t(`Identical memory already exists, nothing new was written`):t(`Similar memories already exist, nothing was written`);return(0,G.jsxs)(G.Fragment,{children:[n&&(0,G.jsx)(`p`,{className:`px-3 pt-2 text-xs text-muted-foreground`,children:n}),e.written?(0,G.jsx)($6,{hits:[e.memory],defaultOpen:!0}):(0,G.jsx)($6,{hits:e.candidates})]})}function t8({hit:e,defaultOpen:t}){let{t:n}=K(),[r,i]=(0,H.useState)(t);return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:e=>{let t=window.getSelection();t?.toString()&&e.currentTarget.contains(t.anchorNode)||i(e=>!e)},className:`block w-full cursor-pointer px-3 py-2 text-left transition-colors hover:bg-muted/40`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:W(`min-w-0 flex-1 font-medium text-foreground text-xs`,r?`break-words`:`truncate`),children:e.title}),e.unitType&&(0,G.jsx)(sj,{variant:`secondary`,size:`sm`,children:e.unitType}),e.space&&(0,G.jsx)(sj,{variant:`outline`,size:`sm`,children:n(e.space===`global`?`Global`:`Project`)}),e.relevance!==null&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums`,title:n(`Semantic similarity`),children:e.relevance.toFixed(2)})]}),(0,G.jsx)(`span`,{className:W(`mt-0.5 whitespace-pre-wrap break-words text-muted-foreground text-xs leading-relaxed`,r?`block`:`line-clamp-2`),children:e.content})]})})}var n8=H.createContext(void 0);function r8(e){let t=H.useContext(n8);if(t===void 0&&!e)throw Error(Cr(50));return t}var i8={...Zw,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay},a8=class extends Dw{constructor(e,t,n){let r=new Ww;super(o8(e,r,t,n),s8(r),i8)}setOpen=(e,t)=>{let{inlineRectCoordsRef:n}=this.context;Ste(this,e,t,{onBeforeDispatch(){let r=t.event;e&&t.reason===`trigger-hover`&&t.trigger&&`clientX`in r&&`clientY`in r&&n.current?.element!==t.trigger&&sw(n,t.trigger,r.clientX,r.clientY)}})}};function o8(e,t,n,r=!1){let i={...Gw(),instantType:void 0,adaptiveOrigin:void 0,closeDelay:300,...e};return i.floatingRootContext=Kw(t,n,r),i}function s8(e){return{popupRef:H.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function c8(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:i,actionsRef:a,handle:o,triggerId:s,defaultTriggerId:c=null,children:l}=e,u=Fw((e,r)=>new a8({open:n,openProp:t,activeTriggerId:c,triggerIdProp:s},e,r));u.useControlledProp(`openProp`,t),u.useControlledProp(`triggerIdProp`,s),u.useContextCallback(`onOpenChange`,r),u.useContextCallback(`onOpenChangeComplete`,i);let d=u.useState(`open`),f=u.useState(`activeTriggerId`),p=u.useState(`mounted`),m=u.useState(`payload`);Bw(u,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:h}=Vw(d,u,()=>{u.context.inlineRectCoordsRef.current=void 0});Y(()=>{d&&(f??u.set(`payload`,void 0))},[u,f,d]),H.useImperativeHandle(a,()=>({unmount:h,close:()=>u.setOpen(!1,qy(Ky))}),[h,u]);let g=d||p;return(0,G.jsxs)(n8.Provider,{value:u,children:[o&&(0,G.jsx)(Iw,{handle:o,store:u}),g&&(0,G.jsx)(l8,{store:u}),typeof l==`function`?l({payload:m}):l]})}function l8({store:e}){let t=JS(e.useState(`floatingRootContext`));return Hw(e,{activeTriggerProps:t.reference,inactiveTriggerProps:t.trigger,popupProps:t.floating}),null}var u8=_w(function(e){return r8(!0)?(0,G.jsx)(c8,{...e}):(0,G.jsx)(PS,{children:(0,G.jsx)(c8,{...e})})}),d8=H.createContext(void 0);function f8(){let e=H.useContext(d8);if(e===void 0)throw Error(Cr(48));return e}var p8=H.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return r8().useState(`mounted`)||n?(0,G.jsx)(d8.Provider,{value:n,children:(0,G.jsx)(nD,{ref:t,...r})}):null}),m8=vw(function(e,t){let{render:n,className:r,delay:i,closeDelay:a,id:o,payload:s,handle:c,style:l,...u}=e,d=r8(!0),f=Qw(c)??d;if(!f)throw Error(Cr(89));let p=Qy(o),m=f.useState(`isTriggerActive`,p),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`floatingRootContext`),_=f.context.inlineRectCoordsRef,v=H.useRef(null),y=i??600,b=a??300,{registerTrigger:x,isMountedByThisTrigger:S}=zw(p,v,f,{payload:s,closeDelay:b}),C=oT(g,{mouseOnly:!0,move:!1,handleClose:vT(),delay:()=>({open:y,close:b}),triggerElementRef:v,isActiveTrigger:m,isClosing:()=>f.select(`transitionStatus`)===`ending`}),w=eT(g,{delay:y}),T={open:h},E=f.useState(`triggerProps`,S),D=ow(_,h);return Vr(`a`,e,{state:T,ref:[t,x,v],props:[C,w.reference,E,D,{id:p},u],stateAttributesMapping:$v})}),h8=H.createContext(void 0);function g8(){let e=H.useContext(h8);if(e===void 0)throw Error(Cr(49));return e}var _8=H.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=yS,style:g,..._}=e,v=r8(),y=f8(),b=MS(),x=v.useState(`open`),S=v.useState(`mounted`),C=v.useState(`floatingRootContext`),w=v.useState(`instantType`),T=v.useState(`transitionStatus`),E=v.useState(`adaptiveOrigin`),D=v.context.inlineRectCoordsRef,O=dD({anchor:i,floatingRootContext:C,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:y,nodeId:b,collisionAvoidance:h,adaptiveOrigin:E,inline:cw(D)}),k=O.update;Y(()=>{x&&S&&k()},[x,S,k]);let A=hD(e,{open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:w},{styles:O.positionerStyles,transitionStatus:T,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!S,inert:!x});return(0,G.jsx)(h8.Provider,{value:O,children:(0,G.jsx)(NS,{id:b,children:A})})}),v8=H.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=r8(),{side:s,align:c}=g8(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`closeDelay`);return Mw({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),aT(p,{closeDelay:m}),Vr(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[Nw,f,mD(d),a],stateAttributesMapping:ny})}),y8=u8;function b8({...e}){return(0,G.jsx)(m8,{"data-slot":`preview-card-trigger`,...e})}function x8({className:e,children:t,align:n=`center`,sideOffset:r=4,...i}){return(0,G.jsx)(p8,{children:(0,G.jsx)(_8,{align:n,className:`z-50`,"data-slot":`preview-card-positioner`,sideOffset:r,children:(0,G.jsx)(v8,{className:W(`relative flex w-64 origin-(--transform-origin) text-balance rounded-lg border bg-popover bg-clip-padding p-4 text-popover-foreground text-sm shadow-lg transition-[scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]`,e),"data-slot":`preview-card-content`,...i,children:t})})})}var S8={mask:`text-sky-600 dark:text-sky-400`,warn:`text-amber-600 dark:text-amber-400`,block:`text-red-600 dark:text-red-400`},C8={mask:zn,warn:Ln,block:Rn},w8={mask:`Mask`,warn:`Warn only`,block:`Block`},T8={system:`System prompt`,user:`Your message`,tool_result:`Tool output`,tool_args:`Tool arguments`,assistant:`Earlier replies`,tools:`Tool descriptions`};function E8({report:e}){let{t}=K(),n=S(e);if(!n)return null;let r=C8[n],i=new Set(e.hits.map(e=>e.token)).size;return(0,G.jsxs)(y8,{children:[(0,G.jsxs)(b8,{render:(0,G.jsx)(`span`,{className:W(`inline-flex shrink-0 items-center gap-0.5 text-[11px]`,S8[n]),"data-privacy-mask":n}),children:[(0,G.jsx)(r,{className:`size-3.5`}),(0,G.jsx)(`span`,{className:`tabular-nums`,children:i})]}),(0,G.jsxs)(x8,{className:`max-h-(--available-height) w-72 flex-col overflow-y-auto overscroll-contain text-xs`,children:[(0,G.jsx)(`p`,{className:`mb-1.5 font-medium`,children:t(`Privacy masking`)}),(0,G.jsx)(`ul`,{className:`space-y-1`,children:m(e.hits).map(e=>(0,G.jsxs)(`li`,{className:`flex flex-wrap gap-x-2`,children:[(0,G.jsx)(`span`,{className:S8[e.action],children:t(w8[e.action])}),(0,G.jsx)(`span`,{children:e.kind}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:t(T8[e.where]??e.where)}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e.values>1?t(`{{count}} values`,{count:e.values}):e.preview}),e.count>1&&(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[`×`,e.count]})]},`${e.action}-${e.kind}-${e.where}`))}),e.restored>0&&(0,G.jsx)(`p`,{className:`mt-1.5 text-muted-foreground`,children:t(`Restored {{count}} in the reply`,{count:e.restored})})]})]})}function D8(e){let{inputTokens:t,outputTokens:n}=e;if(typeof t!=`number`||!Number.isFinite(t)||t<0||typeof n!=`number`||!Number.isFinite(n)||n<0)return null;let r=Math.max(0,t-n);return{tokens:r,percent:t>0?Math.round(r/t*100):null}}var O8={compressed:`Compressed`,unchanged:`Unchanged`,pending:`Background task started`,bypassed:`Bypassed`,unavailable:`Unavailable`};function k8({value:e}){let t=re(e),{t:n}=K();if(!t)return null;let r=D8(t);return(0,G.jsxs)(`div`,{className:`border-border/60 border-t text-[10px] text-muted-foreground`,"data-rtk-status":t.status,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 px-3 py-1`,children:[(0,G.jsx)(`span`,{className:`font-semibold tracking-wide text-foreground/75`,children:`RTK`}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsx)(`span`,{children:n(O8[t.status])}),r&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsx)(`span`,{children:n(`~{{count}} tokens saved`,{count:AN(r.tokens)})}),r.percent!==null&&(0,G.jsxs)(`span`,{children:[`(`,r.percent,`%)`]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2 px-3 pb-2`,children:[t.status===`pending`&&(0,G.jsx)(`p`,{className:`rounded bg-muted/40 px-2 py-1 text-foreground/80`,children:n(`This is the startup receipt; see the task_output result for final statistics.`)}),(t.inputTokens!==void 0||t.reason)&&(0,G.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:[t.inputTokens!==void 0&&t.outputTokens!==void 0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{children:n(`Input estimate`)}),(0,G.jsx)(`dd`,{className:`font-mono text-foreground/80`,children:n(`{{count}} tokens`,{count:AN(t.inputTokens)})}),(0,G.jsx)(`dt`,{children:n(`Output estimate`)}),(0,G.jsx)(`dd`,{className:`font-mono text-foreground/80`,children:n(`{{count}} tokens`,{count:AN(t.outputTokens)})})]}),t.reason&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{children:n(`Reason`)}),(0,G.jsx)(`dd`,{className:`min-w-0 whitespace-pre-wrap text-foreground/80`,children:t.reason})]})]})]})]})}function A8(e,t,n){if(e==null||t===void 0||t<=e)return null;let r=Math.max(0,t-n);return{remainingMs:r,fraction:Math.min(1,r/(t-e))}}function j8(e,t,n=me){let r=t-e;return r>=n?r:null}var M8={exit_nonzero:`Exit {{code}}`,deadline:`Killed at timeout`,stopped_by_user:`Stopped by you`,tty_required:`Needs terminal`,auth_required:`Needs login`,not_found:`Command not found`,not_executable:`Not executable`,binary_output:`Binary output`,output_truncated:`Log truncated`},N8={deadline:`Killed when its timeout was reached. Raise the timeout or run it in the background.`,tty_required:`Needs an interactive terminal. Use a non-interactive flag (such as --yes) or run it in your own terminal.`,auth_required:`Needs credentials. Sign in from your own terminal, then retry.`,not_found:`The program is not installed or not on PATH.`};function P8(e){return e?.kind===`deadline`?[`background`,`timeout`]:[]}function F8(e,t,n){let r=`\`\`\`\n${t}\n\`\`\``;return e===`background`?n(`Rerun this command with background: true:
261
-
262
- {{command}}`,{command:r}):n(`Rerun this command with timeout: {{seconds}}:
263
-
264
- {{command}}`,{seconds:600,command:r})}function I8(e,t,n){return t(e)?(n(),!0):!1}function L8(){let[e,t]=(0,H.useState)(()=>Date.now());return(0,H.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}var R8=5,z8=2*Math.PI*R8;function B8({startedAt:e,deadlineAt:t,output:n}){let{t:r}=K(),i=L8(),a=(0,H.useRef)({output:n,at:e??Date.now()});a.current.output!==n&&(a.current={output:n,at:Date.now()});let o=A8(e,t,i),s=j8(a.current.at,i);return!o&&s===null?null:(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-[10px] text-muted-foreground/70 tabular-nums`,children:[s!==null&&(0,G.jsx)(`span`,{"data-shell-quiet":!0,className:`rounded bg-muted px-1`,children:r(`No output for {{seconds}}s`,{seconds:Math.floor(s/1e3)})}),o&&o.remainingMs>0&&(0,G.jsxs)(`span`,{className:`flex items-center gap-0.5`,title:r(`Moves to background in {{seconds}}s`,{seconds:Math.ceil(o.remainingMs/1e3)}),children:[(0,G.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:[(0,G.jsx)(`circle`,{cx:`6`,cy:`6`,r:R8,fill:`none`,stroke:`currentColor`,opacity:`0.25`}),(0,G.jsx)(`circle`,{cx:`6`,cy:`6`,r:R8,fill:`none`,stroke:`currentColor`,strokeDasharray:z8,strokeDashoffset:z8*(1-o.fraction),transform:`rotate(-90 6 6)`})]}),Math.ceil(o.remainingMs/1e3),`s`]})]})}function V8(e,t){return e.kind===`exit_nonzero`&&e.exitCode===void 0?t(`Failed`):t(M8[e.kind],{code:e.exitCode??``})}function H8({failure:e}){let{t}=K();return(0,G.jsx)(`span`,{"data-shell-failure":e.kind,className:W(`shrink-0 rounded px-1 text-[10px]`,e.retryable?`bg-muted text-muted-foreground`:`bg-destructive/10 text-destructive`),children:V8(e,t)})}function U8({warning:e}){let{t,locale:n}=K(),r=n===`zh`?bs(e):{what:e.reason};return(0,G.jsx)(`span`,{"data-dcg-warning":e.ruleId,title:[r.what,r.why,e.ruleId].filter(Boolean).join(`
265
- `),className:`shrink-0 rounded bg-muted px-1 text-[10px] text-muted-foreground`,children:t(`dcg notice`)})}function W8({failure:e,command:t}){let{t:n}=K(),[r,i]=(0,H.useState)(!1);if(!e)return null;let a=N8[e.kind],o=P8(e);return(0,G.jsxs)(`div`,{"data-shell-status":e.kind,className:`mt-2 flex items-center gap-2 border-t border-current/10 pt-1.5 text-[11px] opacity-80`,children:[(0,G.jsx)(`span`,{className:`shrink-0 font-medium`,children:V8(e,n)}),a&&(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:n(a)}),o.map(e=>(0,G.jsx)(`button`,{type:`button`,"data-shell-rerun":e,onClick:()=>{I8(F8(e,t,n),ik,ek)},className:`flex shrink-0 items-center gap-1 underline-offset-2 hover:underline hover:opacity-100`,children:e===`background`?n(`Rerun in background`):n(`Rerun with {{seconds}}s timeout`,{seconds:600})},e)),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(t).then(()=>{i(!0),setTimeout(()=>i(!1),1e3)})},className:`ml-auto flex shrink-0 items-center gap-1 hover:opacity-100`,title:n(`Copy command`),children:[r?(0,G.jsx)(_t,{className:`h-3 w-3`}):(0,G.jsx)(Ft,{className:`h-3 w-3`}),n(`Copy command`)]})]})}function G8({icon:e,state:t}){let n=t===`running`||t===`reviewing`;return(0,G.jsxs)(`span`,{className:W(`relative flex size-[22px] shrink-0 items-center justify-center rounded-full border text-muted-foreground`,n&&`border-transparent text-brand`,t===`error`&&`border-destructive/40 text-destructive`),children:[(0,G.jsx)(e,{className:`size-3`}),n&&(0,G.jsx)(`span`,{className:`absolute -inset-px animate-spin rounded-full border-[1.5px] border-brand/20 border-t-brand`})]})}function K8({state:e}){return(0,G.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center`,children:e===`running`||e===`reviewing`?(0,G.jsx)(`span`,{className:`size-2.5 animate-spin rounded-full border-[1.5px] border-border border-t-brand`}):e===`error`?(0,G.jsx)(`span`,{className:`size-1.5 rounded-full bg-destructive`}):(0,G.jsx)(`span`,{className:`size-1 rounded-full bg-current opacity-60`})})}var q8={queued:[`Queued`,`bg-muted-foreground`],running:[`running`,`bg-amber-500`],awaiting_input:[`awaiting input`,`bg-amber-500`],validating:[`validating`,`bg-amber-500`],succeeded:[`succeeded`,`bg-emerald-500`],failed:[`failed`,`bg-destructive`],cancelled:[`cancelled`,`bg-muted-foreground`],interrupted:[`interrupted`,`bg-muted-foreground`],creating:[`creating`,`bg-amber-500`],ready:[`idle`,`bg-muted-foreground`],active:[`running`,`bg-amber-500`],parked:[`parked`,`bg-muted-foreground`],closed:[`closed`,`bg-muted-foreground`]};function J8({view:e,titles:t}){let{t:n}=K();return(0,G.jsxs)(`div`,{className:`space-y-2 px-3 py-2 text-sm`,children:[e.kind===`report`&&e.text&&(0,G.jsx)(C3,{text:e.text}),e.kind===`report`&&e.value&&(0,G.jsx)(C3,{text:`\`\`\`json\n${e.value}\n\`\`\``}),e.kind===`report`&&e.error&&(0,G.jsx)(`p`,{className:`whitespace-pre-wrap text-destructive`,children:e.error}),e.runs.length>0&&(0,G.jsx)(`ul`,{className:`space-y-0.5 text-xs text-muted-foreground`,children:e.runs.map(e=>(0,G.jsx)(Y8,{run:e,title:t?.[e.agentId]},e.runId||e.agentId))}),e.kind===`list`&&e.runs.length===0&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`No agents`)}),e.kind===`wait`&&e.timedOut&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Timed out; unfinished agents keep running`)}),e.kind===`wait`&&e.interrupted&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Wait was interrupted`)}),(0,G.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer hover:text-foreground`,children:n(`Run info`)}),(0,G.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap font-mono`,children:e.info})]}),e.head&&(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs text-muted-foreground`,children:e.head})]})}function Y8({run:e,title:t}){let{t:n}=K(),[r,i]=q8[e.status]??[null,`bg-muted-foreground`],a=e.durationMs===null?``:n(`took {{duration}}`,{duration:jN(e.durationMs)});return(0,G.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:W(`h-1.5 w-1.5 shrink-0 rounded-full`,i)}),t&&(0,G.jsx)(`span`,{className:`truncate text-foreground`,children:t}),(0,G.jsx)(`span`,{className:`shrink-0`,children:[r?n(r):e.status,a].filter(Boolean).join(` · `)})]})}var X8=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Z8=e=>typeof e==`string`&&e.trim()?e:null;function Q8(e){if(!X8(e))return null;let{agentId:t,runId:n,status:r,createdAt:i,startedAt:a,finishedAt:o}=e;if(typeof t!=`string`||typeof n!=`string`||typeof r!=`string`)return null;let s=typeof a==`number`?a:i;return{agentId:t,runId:n,status:r,durationMs:typeof o==`number`&&typeof s==`number`?Math.max(0,o-s):null}}var $8=new Set([`closed`,`parked`,`creating`]);function e5(e){if(!X8(e))return null;let{agentId:t,status:n,latestRun:r}=e;return typeof t!=`string`||typeof n!=`string`?null:($8.has(n)?null:Q8(r))??{agentId:t,runId:``,status:n,durationMs:null}}function t5(e,t){let n=FV(t);if(!n)return null;let{head:r,value:i}=n;if(e===`report`){let e=Q8(i.run);if(!e)return null;let{text:t,value:n,error:a,...o}=i;return{kind:`report`,head:r,runs:[e],text:Z8(t),value:n==null?null:JSON.stringify(n,null,2),error:Z8(a),info:JSON.stringify(o,null,2)}}if(e===`list`){if(!Array.isArray(i.agents))return null;let e=i.agents.flatMap(e=>e5(e)??[]);return e.length===i.agents.length?{kind:`list`,head:r,runs:e,info:JSON.stringify(i,null,2)}:null}let a=e===`wait`?i:e===void 0?i.report:null;if(!X8(a)||!Array.isArray(a.runs))return(e===void 0||e===`resume`)&&i.report===void 0&&typeof i.agentId==`string`&&typeof i.runId==`string`?{kind:`receipt`,head:r,runs:[],info:JSON.stringify(i,null,2)}:null;let o=a.runs.flatMap(e=>Q8(e)??[]);return o.length===a.runs.length?{kind:`wait`,head:r,runs:o,timedOut:a.timedOut===!0,interrupted:a.interrupted===!0,info:JSON.stringify(i,null,2)}:null}var n5={"restart-lost":`This subagent was started before EnsoCode restarted, and its record was lost in the restart`,"other-owner":`This subagent belongs to another conversation and cannot be controlled here`,"not-found":`This conversation has no subagent with this id (mistyped, or agentId and runId mixed up)`};function r5(e){let t=/^([a-z][a-z-]*):\s/u.exec(e?.trim()??``)?.[1];return t&&n5[t]||null}function i5({items:e,live:t=[],onOpen:n}){let{t:r}=K(),[i,a]=(0,H.useState)(!1);return(0,G.jsxs)(`div`,{"data-enso":`task-wrap-up`,"data-open":i?`true`:`false`,className:lP,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`flex w-full items-start gap-2 text-left hover:text-foreground`,children:[(0,G.jsx)(Zt,{className:uP}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:r(`{{count}} background tasks to wrap up: stop them or say why they keep running`,{count:e.length})})]}),i&&(0,G.jsx)(`ul`,{className:`mt-1.5 space-y-1.5 border-t border-border/60 pt-1.5`,children:e.map(e=>{let r=t.find(t=>t.taskId===e.taskId);return(0,G.jsx)(a5,{item:e,command:r?.command??e.command,onOpen:r?.status===`running`?n:void 0},e.taskId)})})]})}function a5({item:e,command:t,onOpen:n}){let{t:r}=K(),[i,a]=(0,H.useState)(!1);return(0,G.jsxs)(`li`,{"data-enso":`task-wrap-up-item`,"data-task-id":e.taskId,className:`flex min-w-0 gap-2`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`min-w-0 flex-1 text-left hover:text-foreground`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-foreground`,children:e.taskId}),e.ran&&(0,G.jsx)(`span`,{className:`shrink-0`,children:r(`Running for {{duration}}`,{duration:e.ran})})]}),(0,G.jsx)(`span`,{"data-enso":`task-wrap-up-command`,title:t,className:W(`block font-mono text-[11px]`,i?`whitespace-pre-wrap break-all`:`truncate`),children:t})]}),n&&(0,G.jsx)(`button`,{type:`button`,"data-enso":`task-wrap-up-open`,title:r(`Show in task bar`),"aria-label":r(`Show in task bar`),onClick:()=>n(e.taskId),className:`flex size-5 shrink-0 items-center justify-center rounded-[5px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,G.jsx)(ct,{className:`h-3.5 w-3.5`})})]})}function o5({command:e,output:t,failure:n}){let r=E(e=>e.terminalTheme),i=E(e=>e.terminalFontFamily),a=be(r)??oe;return(0,G.jsxs)(`div`,{"data-slot":`terminal-output`,className:`px-3 py-2 text-xs leading-relaxed`,style:{backgroundColor:a.background,"--terminal-bg":a.background,color:a.foreground,fontFamily:i},children:[(0,G.jsxs)(`div`,{className:`whitespace-pre-wrap [overflow-wrap:anywhere]`,children:[(0,G.jsx)(`span`,{style:{color:a.green},children:`$ `}),e]}),t&&(0,G.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap [overflow-wrap:anywhere]`,style:{fontFamily:`inherit`},children:i6(t)}),(0,G.jsx)(W8,{failure:n,command:e})]})}function s5(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(!(n.role!==`toolResult`||n.toolName!==`todo`||!n.todos))return n.todos.some(e=>e.status!==`completed`)?{id:n.toolCallId??String(t),todos:n.todos}:null}return null}function c5({todos:e}){return(0,G.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:e.map(e=>(0,G.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[e.status===`completed`?(0,G.jsx)(_t,{className:`mt-0.5 h-3 w-3 shrink-0 text-brand`}):e.status===`in_progress`?(0,G.jsx)(Tt,{className:`mt-0.5 h-3 w-3 shrink-0 text-brand`}):(0,G.jsx)(kt,{className:`mt-0.5 h-3 w-3 shrink-0 text-muted-foreground/50`}),(0,G.jsx)(`span`,{className:W(e.status===`completed`?`text-muted-foreground line-through`:e.status===`in_progress`?`font-medium`:`text-muted-foreground`),children:e.content})]},e.content))})}function l5({done:e,total:t,className:n}){return(0,G.jsx)(`div`,{className:W(`h-0.5 overflow-hidden rounded-full bg-border`,n),children:(0,G.jsx)(`div`,{className:`h-full rounded-full bg-brand transition-[width]`,style:{width:`${t?e/t*100:0}%`}})})}var u5=new Set;function d5({conversationId:e}){let{t}=K(),n=E(e=>e.pinUnfinishedTodos),r=aP(t=>t.conversations[e]?.messages),i=(0,H.useMemo)(()=>n&&r?s5(r):null,[n,r]),[a,o]=(0,H.useState)(!1),[,s]=(0,H.useState)(0);if(!i||u5.has(i.id))return null;let c=i.todos.filter(e=>e.status===`completed`).length,l=i.todos.find(e=>e.status===`in_progress`)??i.todos.find(e=>e.status===`pending`);return(0,G.jsxs)(`div`,{"data-enso":`todo`,className:`mb-1.5 rounded-xl border bg-card px-3 py-1.5 text-xs shadow-xs`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,G.jsx)(on,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`shrink-0 font-medium`,children:t(`Todos`)}),(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums`,children:[c,`/`,i.todos.length]}),!a&&l&&(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,title:l.content,children:l.content}),a?(0,G.jsx)(vt,{className:`ml-auto h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,G.jsx)(yt,{className:`ml-auto h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),(0,G.jsx)(`button`,{type:`button`,title:t(`Hide until the todo list updates`),onClick:()=>{u5.add(i.id),s(e=>e+1)},className:`shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground`,children:(0,G.jsx)(ir,{className:`h-3.5 w-3.5`})})]}),a&&(0,G.jsxs)(`div`,{className:`mt-1.5 max-h-48 overflow-y-auto pb-0.5`,children:[(0,G.jsx)(l5,{done:c,total:i.todos.length,className:`mb-2`}),(0,G.jsx)(c5,{todos:i.todos})]})]})}function f5({image:e,path:t,alt:n}){let{t:r}=K(),i=(0,H.useMemo)(()=>Qz(e,t,!0),[e,t]),[a,o]=(0,H.useState)(!1);return!i||a?(0,G.jsx)(`p`,{"data-slot":`tool-image-missing`,className:`text-xs text-muted-foreground`,children:r(`Image unavailable`)}):(0,G.jsx)(VG,{src:i,alt:n,lazy:!0,onError:()=>o(!0),frameClassName:`block max-w-full`,className:`block max-h-64 max-w-full rounded-md border border-border/60 bg-muted/40 object-contain`})}function p5({image:e,output:t}){let{t:n}=K(),r=(0,H.useMemo)(()=>Xz(t),[t]),i=[];return r?.path&&i.push([n(`Path`),r.path]),r?.width&&r.height&&i.push([n(`Dimensions`),`${r.width} × ${r.height}`]),r?.size!==null&&r?.size!==void 0&&i.push([n(`File size`),LB(r.size)]),(0,G.jsxs)(`div`,{"data-slot":`image-view`,className:`space-y-2 px-3 py-2`,children:[(0,G.jsx)(f5,{image:e,path:r?.path,alt:r?.path??``}),i.length>0?(0,G.jsx)(`dl`,{className:`space-y-0.5 text-xs`,children:i.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,G.jsx)(`dt`,{className:`shrink-0 text-muted-foreground`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0 break-all font-mono`,children:t})]},e))}):null]})}function m5(){let e=aP(e=>e.conversations),t=E(e=>e.projects),n=XR(e=>e.secretary.board.todos),r=XR(e=>e.secretary.proposals);return{sessionTitle(t){return e[t]?.title?.trim()||void 0},projectName(e){let n=t.find(t=>t.id===e);return n?.alias?.trim()||n?.name?.trim()||void 0},todoText(e){return n.find(t=>t.id===e)?.text},proposal(e){let t=r[e];return t?{status:t.status,kind:t.kind}:void 0}}}function h5(e){let t=e.cardPeers??[];return[{name:e.name,args:e.args??null,output:e.output,state:e.state,...e.image?{image:e.image}:{}},...t.map(t=>({name:e.name,args:t.args??null,output:t.output,state:t.state,...t.image?{image:t.image}:{}}))]}function g5({item:e,framed:t=!1}){let{t:n,locale:r}=K(),i=m5(),a=aP(e=>e.conversations),o=aB(h5(e),{t:n,locale:r===`zh`?`zh`:`en`,lookup:i}),s=WB(o.cards.map(e=>e.state)),[c,l]=(0,H.useState)(!1),u=o.grouped?null:o.cards[0]??null;return(0,G.jsxs)(`div`,{"data-enso":`tool-card`,"data-tool":e.name,"data-open":c?`true`:`false`,"data-grouped":o.grouped?`true`:`false`,"data-count":o.cards.length,className:`my-0.5 w-full min-w-0 text-[13px]`,children:[(0,G.jsxs)(`button`,{type:`button`,"data-enso":`tool-card-expand`,"aria-expanded":c,onClick:()=>l(e=>!e),className:`group/step flex min-h-6 w-full min-w-0 items-center gap-2 text-left text-[13px] text-muted-foreground`,children:[(0,G.jsx)(K8,{state:s}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o.grouped?o.title:u?.title}),u?.status?(0,G.jsx)(_5,{status:u.status}):null,(0,G.jsx)(yt,{className:W(`h-3 w-3 shrink-0 opacity-0 transition-[opacity,transform] group-hover/step:opacity-100`,c&&`rotate-90 opacity-100`)})]}),c&&o.grouped?o.cards.map((e,n)=>(0,G.jsx)(v5,{card:e,known:a,onOpen:d6,framed:t},`${e.title}-${n}`)):null,c&&u?(0,G.jsx)(y5,{card:u,known:a,onOpen:d6,framed:t}):null]})}function _5({status:e}){return(0,G.jsx)(`span`,{"data-enso":`tool-card-status`,"data-tone":e.tone,className:W(`shrink-0 rounded px-1 py-px text-[10px]`,e.tone===`error`&&`bg-destructive/15 text-destructive`,e.tone===`ok`&&`bg-success/15 text-success`,(e.tone===`queued`||e.tone===`pending`)&&`bg-warning/15 text-warning`,e.tone===`neutral`&&`bg-muted text-muted-foreground`),children:e.label})}function v5({card:e,known:t,onOpen:n,framed:r}){let[i,a]=(0,H.useState)(!1);return(0,G.jsxs)(`div`,{className:`pl-5`,children:[(0,G.jsxs)(`button`,{type:`button`,"data-enso":`tool-card-expand`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`group/step flex min-h-6 w-full min-w-0 items-center gap-2 text-left text-[13px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.status?(0,G.jsx)(_5,{status:e.status}):null,(0,G.jsx)(yt,{className:W(`h-3 w-3 shrink-0 opacity-0 transition-[opacity,transform] group-hover/step:opacity-100`,i&&`rotate-90 opacity-100`)})]}),i?(0,G.jsx)(y5,{card:e,known:t,onOpen:n,framed:r,nested:!0}):null]})}function y5({card:e,known:t,onOpen:n,framed:r,nested:i=!1}){let{t:a}=K(),[o,s]=(0,H.useState)(!1),c=(0,G.jsx)(`button`,{type:`button`,"data-enso":`tool-card-raw`,"aria-expanded":o,onClick:()=>s(e=>!e),className:`text-[11px] text-muted-foreground hover:text-foreground`,children:a(`View raw data`)}),l=o?(0,G.jsxs)(`div`,{className:W(`mt-1 space-y-1`,r&&`max-h-60 overflow-auto`),children:[e.rawArgs&&(0,G.jsx)(`pre`,{className:`overflow-auto font-mono text-[10px] leading-relaxed text-muted-foreground whitespace-pre-wrap`,children:e.rawArgs}),e.rawOutput&&(0,G.jsx)(`pre`,{className:`overflow-auto font-mono text-[10px] leading-relaxed text-muted-foreground whitespace-pre-wrap`,children:e.rawOutput})]}):null,u=(e,r)=>(0,G.jsx)(T5,{block:e,known:t,onOpen:n},`${e.kind}-${r}`);if(r){let t=[];e.blocks.forEach((e,n)=>{let r=e.kind===`prompt`,i=t.at(-1);!r&&i&&!i.prompt?i.blocks.push([e,n]):t.push({prompt:r,blocks:[[e,n]]})});let n=t.at(-1),r=!n||n.prompt,a=(0,G.jsxs)(`div`,{children:[c,l]});return(0,G.jsxs)(`div`,{"data-enso":`tool-card-body`,"data-framed":`true`,className:W(`mt-1 mb-1.5 min-w-0 overflow-hidden rounded-lg border border-border/70 bg-card text-[12px]`,!i&&`ml-5`),children:[t.map((e,t)=>(0,G.jsxs)(`div`,{className:W(`min-w-0`,t>0&&`border-t border-border/60`,!e.prompt&&`space-y-1.5 px-3 py-2`),children:[e.blocks.map(([e,t])=>e.kind===`prompt`?(0,G.jsx)(C5,{label:e.label,text:e.text},t):u(e,t)),!r&&e===n?a:null]},t)),r?(0,G.jsx)(`div`,{className:W(`px-3 py-2`,n&&`border-t border-border/60`),children:a}):null]})}return(0,G.jsxs)(`div`,{"data-enso":`tool-card-body`,className:`space-y-1 py-0.5 pl-5 text-[12px]`,children:[(0,G.jsx)(`div`,{className:`space-y-1`,children:e.blocks.map(u)}),(0,G.jsx)(`button`,{type:`button`,"data-enso":`tool-card-raw`,"aria-expanded":o,onClick:()=>s(e=>!e),className:`mt-1 text-[11px] text-muted-foreground hover:text-foreground`,children:a(`View raw data`)}),l]})}var b5={"--chat-h1-size":`1em`,"--chat-h2-size":`1em`,"--chat-h3-size":`1em`,"--chat-h4-size":`1em`,"--chat-code-block-size":`11px`},x5=4;function S5(e){let t=e.split(`
266
- `).filter(e=>e.trim()&&!/^\s*(```|~~~)/.test(e)).map(e=>e.replace(/^\s*#{1,6}\s+/,``).trimEnd());return{preview:t.slice(0,x5).join(`
267
- `),folded:t.length>x5||e.length>320}}function C5({label:e,text:t}){let{t:n}=K(),{preview:r,folded:i}=S5(t),[a,o]=(0,H.useState)(!1),s=a||!i;return(0,G.jsxs)(`section`,{"data-enso":`tool-card-prompt`,"data-open":s?`true`:`false`,className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-3 pt-1.5 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2.5`,children:[i&&(0,G.jsx)(`button`,{type:`button`,"data-enso":`tool-card-prompt-toggle`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`hover:text-foreground`,children:n(a?`Show less`:`Show full text`)}),(0,G.jsx)(Fs,{text:t,label:n(`Copy`)})]})]}),s?(0,G.jsx)(`div`,{"data-enso":`tool-card-prompt-body`,style:b5,className:`max-h-80 min-w-0 overflow-y-auto overscroll-contain px-3 pt-1 pb-2 text-xs leading-relaxed [&_:is(h1,h2,h3,h4)]:mt-2.5 [&_:is(h1,h2,h3,h4)]:mb-1 [&_[data-enso=code-block]>:first-child]:border-0`,children:(0,G.jsx)(C3,{text:t})}):(0,G.jsx)(`button`,{type:`button`,"data-enso":`tool-card-prompt-preview`,onClick:()=>o(!0),className:`line-clamp-4 block w-full min-w-0 px-3 pt-1 pb-2 text-left text-xs leading-relaxed text-muted-foreground break-words whitespace-pre-wrap`,children:r})]})}function w5({row:e}){let{t}=K(),[n,r]=(0,H.useState)(!1),i=e.display===`long`&&(e.value.length>120||e.value.includes(`
268
- `));return(0,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`whitespace-nowrap text-muted-foreground`,children:e.label}),(0,G.jsxs)(`dd`,{"data-enso":`tool-card-kv-value`,"data-display":e.display,title:e.display===`path`?e.value:void 0,className:W(`min-w-0`,e.display===`path`?`truncate`:`whitespace-pre-wrap break-words`),children:[i&&!n?(0,G.jsx)(`span`,{className:`line-clamp-2`,children:e.value}):e.value,i&&(0,G.jsx)(`button`,{type:`button`,"data-enso":`tool-card-kv-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),className:`block text-[11px] text-muted-foreground hover:text-foreground`,children:t(n?`Show less`:`Show more`)})]})]})}function T5({block:e,known:t,onOpen:n}){let{t:r}=K(),[i,a]=(0,H.useState)(!1);if(e.kind===`error`)return(0,G.jsx)(`p`,{className:`rounded-md bg-destructive/10 px-2 py-1 text-destructive text-xs whitespace-pre-wrap`,children:e.text});if(e.kind===`note`)return(0,G.jsx)(`p`,{className:`whitespace-pre-wrap text-xs`,children:e.text});if(e.kind===`prompt`)return(0,G.jsx)(C5,{label:e.label,text:e.text});if(e.kind===`markdown`){let t=e.collapsed&&!i;return(0,G.jsxs)(`div`,{className:`text-sm`,children:[t?(0,G.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.text.split(`
269
- `).find(e=>e.trim())}):(0,G.jsx)(C3,{text:e.text}),e.collapsed&&(0,G.jsx)(`button`,{type:`button`,"data-enso":`tool-card-fold`,onClick:()=>a(e=>!e),className:`text-[11px] text-muted-foreground hover:text-foreground`,children:r(i?`Show less`:`Show more`)})]})}return e.kind===`image`?(0,G.jsx)(`div`,{"data-enso":`tool-card-image`,children:(0,G.jsx)(f5,{image:e.image,path:e.path,alt:e.alt})}):e.kind===`session`?t[e.id]?(0,G.jsx)(`button`,{type:`button`,"data-enso":`tool-card-session`,"data-conversation-id":e.id,onClick:()=>n(e.id),className:`truncate text-left text-xs text-foreground underline-offset-2 hover:underline`,children:e.label}):(0,G.jsx)(`p`,{className:`text-xs`,children:e.label}):e.kind===`kv`?(0,G.jsx)(`dl`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 text-xs`,children:e.rows.map(e=>(0,G.jsx)(w5,{row:e},e.label))}):e.kind===`diff`?(0,G.jsx)(`div`,{className:`space-y-0.5 text-xs`,children:e.rows.map(e=>(0,G.jsxs)(`p`,{className:`min-w-0 break-words`,children:[(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.label,` `]}),(0,G.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),(0,G.jsxs)(`span`,{children:[` → `,e.after]})]},e.label))}):e.kind===`list`?(0,G.jsx)(`ul`,{className:`space-y-0.5`,children:e.items.map((e,r)=>(0,G.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-1.5 text-xs`,children:[e.sessionId&&t[e.sessionId]?(0,G.jsx)(`button`,{type:`button`,"data-enso":`tool-card-session`,"data-conversation-id":e.sessionId,onClick:()=>n(e.sessionId),className:`min-w-0 truncate text-left hover:underline`,children:e.title}):(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title}),e.badge&&(0,G.jsx)(`span`,{"data-enso":`tool-card-badge`,"data-tone":e.badgeTone,className:W(`shrink-0 rounded px-1 py-px text-[10px]`,e.badgeTone===`error`&&`bg-destructive/15 text-destructive`,e.badgeTone===`ok`&&`bg-success/15 text-success`,e.badgeTone===`pending`&&`bg-warning/15 text-warning`,(!e.badgeTone||e.badgeTone===`neutral`||e.badgeTone===`queued`)&&`bg-muted text-muted-foreground`),children:e.badge}),e.detail&&(0,G.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:e.detail})]},`${e.title}-${r}`))}):null}var E5=(0,H.createContext)({report:()=>{},scroller:{current:null}}),Fne=E5.Provider;function Ine(){return(0,H.useContext)(E5)}var D5=(0,H.lazy)(()=>q(()=>import(`./EditDiff-DPrGvGAU.js`).then(e=>({default:e.EditDiff})),__vite__mapDeps([144,1,145,146]))),O5=(0,H.lazy)(()=>q(()=>import(`./ReadFileView-s4kjqMan.js`).then(e=>({default:e.ReadFileView})),__vite__mapDeps([147,1,145,146]))),Lne=(e,t)=>e===t||!!e&&!!t&&e.runMs===t.runMs&&e.turnMs===t.turnMs&&e.ttftMs===t.ttftMs&&e.tps===t.tps;function Rne(e,t){let n=e??[],r=t??[];return n.length===r.length&&n.every((e,t)=>{let n=r[t];return n!==void 0&&e.key===n.key&&e.state===n.state&&e.output===n.output&&e.image?.data===n.image?.data&&JSON.stringify(e.args??null)===JSON.stringify(n.args??null)})}function zne(e,t){if(e.secretarySession!==t.secretarySession)return!1;let n=e.item,r=t.item;if(n===r)return!0;if(n.kind!==r.kind||n.key!==r.key)return!1;switch(n.kind){case`user`:return r.kind!==`user`||n.text!==r.text||n.images.length!==r.images.length||n.timestamp!==r.timestamp||n.deliveryState!==r.deliveryState||n.turnDurationMs!==r.turnDurationMs||n.collapsed!==r.collapsed||n.canCollapse!==r.canCollapse||n.hostTaskWrapUp!==r.hostTaskWrapUp?!1:n.images.every((e,t)=>e===r.images[t]);case`text`:case`thinking`:return r.kind===n.kind&&n.text===r.text&&n.streaming===r.streaming&&(n.kind!==`text`||r.kind===`text`&&Lne(n.perf,r.perf)&&n.timestamp===r.timestamp&&n.turnDurationMs===r.turnDurationMs)&&(n.kind!==`thinking`||r.kind===`thinking`&&n.durationMs===r.durationMs);case`tool`:return r.kind===`tool`&&n.state===r.state&&n.name===r.name&&n.summary===r.summary&&n.output===r.output&&n.edits===r.edits&&n.writeContent===r.writeContent&&n.fileChanges===r.fileChanges&&n.imagePath===r.imagePath&&n.image?.data===r.image?.data&&n.image?.mimeType===r.image?.mimeType&&n.generatedImages===r.generatedImages&&n.todos===r.todos&&n.durationMs===r.durationMs&&n.startedAt===r.startedAt&&n.agentMeta===r.agentMeta&&n.source===r.source&&n.nestedPending===r.nestedPending&&JSON.stringify(n.sandbox)===JSON.stringify(r.sandbox)&&n.rtk===r.rtk&&n.approvalReview===r.approvalReview&&n.plan?.title===r.plan?.title&&n.plan?.text===r.plan?.text&&n.sentMessage===r.sentMessage&&n.memoryContent===r.memoryContent&&n.ask?.question===r.ask?.question&&n.ask?.options.join(`
270
- `)===r.ask?.options.join(`
271
- `)&&n.ask?.answer===r.ask?.answer&&n.ask?.autoSelected===r.ask?.autoSelected&&n.subagentOp===r.subagentOp&&JSON.stringify(n.subagentTitles)===JSON.stringify(r.subagentTitles)&&n.waiting===r.waiting&&n.pluginArtifacts===r.pluginArtifacts&&n.shellFailure===r.shellFailure&&n.dcgWarning===r.dcgWarning&&JSON.stringify(n.args??null)===JSON.stringify(r.args??null)&&Rne(n.cardPeers,r.cardPeers);case`tool-group`:return r.kind===`tool-group`&&n.expanded===r.expanded&&n.count===r.count&&n.stats.commands===r.stats.commands&&n.stats.reads===r.stats.reads&&n.stats.searches===r.stats.searches&&n.stats.others===r.stats.others&&n.exploring===r.exploring&&n.live===r.live&&n.activity?.thinking===r.activity?.thinking&&n.activity?.workedMs===r.activity?.workedMs&&n.explore?.goal===r.explore?.goal&&n.explore?.report===r.explore?.report&&n.explore?.steps===r.explore?.steps&&n.notice===r.notice;case`error`:return r.kind===`error`&&n.text===r.text;case`interrupted`:return r.kind===`interrupted`&&n.at===r.at&&n.exitKind===r.exitKind&&n.unfinishedTools.length===r.unfinishedTools.length;case`task-note`:return r.kind===`task-note`&&n.detail===r.detail;case`compaction`:case`compaction-notice`:return(r.kind===`compaction`||r.kind===`compaction-notice`)&&n.kind===r.kind&&n.summary===r.summary&&n.tokensBefore===r.tokensBefore&&n.tokensAfter===r.tokensAfter&&n.verified===r.verified;case`compaction-progress`:return r.kind===`compaction-progress`&&n.state===r.state;case`session-custom`:return r.kind===`session-custom`&&n.entry===r.entry;case`divider`:return r.kind===`divider`&&n.text===r.text;case`plugin-message`:return r.kind===`plugin-message`&&n.text===r.text&&n.pluginId===r.pluginId;case`resumed-reply`:return r.kind===`resumed-reply`&&n.expanded===r.expanded&&n.text===r.text&&n.thinking===r.thinking&&n.tools.length===r.tools.length;case`discarded-turn`:return r.kind===`discarded-turn`&&n.expanded===r.expanded&&n.reason===r.reason&&n.messages.length===r.messages.length&&n.messages.every((e,t)=>e===r.messages[t])&&n.tools.length===r.tools.length}}var k5=/^<role>\n?([\s\S]*?)\n?<\/role>\s*/,Bne=/^<workspace-migrated>\n?([\s\S]*?)\n?<\/workspace-migrated>\s*/,Vne=/^<workspace-branch-changed>\n?([\s\S]*?)\n?<\/workspace-branch-changed>\s*/;function Hne({note:e}){let{t}=K(),n=/on Git branch ("(?:[^"\\]|\\.)*")/.exec(e)?.[1],r=``;try{r=n?String(JSON.parse(n)):``}catch{}return(0,G.jsxs)(`aside`,{title:e,className:`flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(Yt,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 break-all`,children:r?t(`Workspace switched to branch {{branch}}`,{branch:r}):t(`Workspace switched branch`)})]})}function A5({items:e}){let t=BN(),n=aP(e=>t?void 0:K5(e)?.id),r=aP(e=>t?void 0:K5(e)?.backgroundTasks);return(0,G.jsx)(i5,{items:e,live:r,onOpen:n?e=>aP.setState({pendingAgentOpen:{sessionId:n,agentId:e}}):void 0})}function Une({note:e}){let{t}=K(),n=/(?:moved to|main working tree): (.+)$/m.exec(e)?.[1]?.trim(),r=e.includes(`main working tree`);return(0,G.jsxs)(`aside`,{title:e,className:`flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(Yt,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[t(r?`Workspace fell back to the main working tree`:`Workspace moved to an isolated worktree`),n&&(0,G.jsx)(`span`,{className:`ml-1.5 break-all font-mono text-[11px] opacity-80`,children:n})]})]})}function j5({note:e}){let{t}=K();return(0,G.jsxs)(`aside`,{className:`flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(jt,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0`,children:t(e===`on`?`Plan mode on: read-only research, then a plan for your approval`:e===`off`?`Plan mode off`:`Context compacted: the approved plan was attached again`)})]})}function M5({note:e}){let{t}=K(),n=e===`on`;return(0,G.jsxs)(`aside`,{className:`flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[n?(0,G.jsx)(Bt,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}):(0,G.jsx)(er,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0`,children:t(n?`Unattended mode on: no one is watching, so it decides and keeps going`:`Unattended mode off: a person is available again`)})]})}function Wne({tag:e,body:t}){let n=e===`agent-notification`?z6(t):null;return n?(0,G.jsx)(qne,{notices:n}):(0,G.jsx)(Jne,{tag:e,body:t})}function Gne({goal:e,instructions:t}){let{t:n}=K(),[r,i]=(0,H.useState)(!1),a=ZU(e);return(0,G.jsxs)(`div`,{"data-enso":`goal-continuation`,"data-open":r?`true`:`false`,className:W(`my-1 w-full min-w-0`,oP),children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex w-full min-w-0 items-center gap-2 text-left text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(sP,{}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n(`Continue goal: {{summary}}`,{summary:a||e})})]}),r&&(0,G.jsxs)(`div`,{className:`mt-1.5 space-y-1.5 border-t border-border/60 pt-1.5`,children:[(0,G.jsx)(`p`,{className:`whitespace-pre-wrap text-foreground`,children:e}),t&&(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[11px] leading-relaxed text-muted-foreground`,children:t})]})]})}function N5({enso:e,icon:t,title:n,body:r}){let[i,a]=(0,H.useState)(!1);return(0,G.jsxs)(`div`,{"data-enso":e,"data-open":i?`true`:`false`,className:lP,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`flex w-full items-start gap-2 text-left enabled:hover:text-foreground`,children:[(0,G.jsx)(t,{className:uP}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n})]}),i&&r&&(0,G.jsx)(`p`,{className:`mt-1.5 whitespace-pre-wrap text-foreground`,children:r})]})}function Kne({segments:e,searchQuery:t,activeNth:n}){let{t:r}=K();return(0,G.jsx)(G.Fragment,{children:e.map((e,i)=>{let a=`${e.kind}-${i}`;if(e.kind===`text`){let r=e.text.trim();return r?(0,G.jsx)(B5,{text:r,searchQuery:t,activeNth:n},a):null}if(e.kind===`goal`)return(0,G.jsx)(Gne,{goal:e.goal,instructions:e.instructions},a);if(e.kind===`schedule`){let t=iW(e.raw),n=t.length>0?t:[{summary:``,body:``}];return(0,G.jsx)(H.Fragment,{children:n.map((e,t)=>(0,G.jsx)(N5,{enso:`secretary-schedule-card`,icon:it,title:e.summary?r(`Scheduled: {{summary}}`,{summary:e.summary}):r(`Scheduled`),body:e.body},t))},a)}if(e.kind===`updates`){let t=MW(e.raw);if(t)return(0,G.jsx)(P5,{lines:t},a);let n=aW(e.raw);return(0,G.jsx)(N5,{enso:`session-updates-card`,icon:pn,title:n.summary?r(`Session updates: {{summary}}`,{summary:n.summary}):r(`Session updates`),body:n.body},a)}return(0,G.jsx)(Wne,{tag:e.tag,body:e.body},a)})})}function qne({notices:e}){let{t}=K(),[n,r]=(0,H.useState)(!1);return(0,G.jsxs)(`div`,{className:cP,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex w-full items-start gap-2 px-3 py-2 text-left hover:text-foreground`,children:[(0,G.jsx)(pt,{className:uP}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.map(e=>e.header).join(` · `)})]}),n&&e.map((n,r)=>(0,G.jsxs)(`div`,{className:`border-border/60 border-t`,children:[e.length>1&&(0,G.jsx)(`p`,{className:`truncate px-3 pt-2`,children:n.header}),n.report&&(0,G.jsx)(`div`,{className:`max-h-80 overflow-auto px-3 py-2 text-sm text-foreground`,children:(0,G.jsx)(C3,{text:n.report})}),n.usage&&(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 border-border/60 border-t px-3 py-1 text-[10px]`,children:[(0,G.jsx)(`span`,{className:`font-semibold tracking-wide text-foreground/75`,children:`Subagent`}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsx)(`span`,{children:t(`{{count}} tokens`,{count:AN(n.usage.tokens)})}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsx)(`span`,{children:t(`{{count}} tool calls`,{count:n.usage.toolUses})}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsx)(`span`,{children:jN(n.usage.durationMs)})]}),n.tasks&&(0,G.jsxs)(`div`,{className:`border-border/60 border-t px-3 py-1 text-[11px]`,children:[(0,G.jsx)(`p`,{className:`text-foreground/75`,children:t(`Background tasks started by this subagent`)}),n.tasks.map(e=>(0,G.jsx)(`p`,{className:`truncate font-mono text-muted-foreground`,children:e},e))]})]},r))]})}function Jne({tag:e,body:t}){let[n,r]=(0,H.useState)(!1),i=tW(t);if(!i)return null;let a=i.indexOf(`
272
- `),o=a>0,s=e.startsWith(`coworker-`)||e===`agent-notification`?pt:qn;return(0,G.jsxs)(`div`,{className:lP,children:[(0,G.jsxs)(`button`,{type:`button`,disabled:!o,onClick:()=>r(e=>!e),className:`flex w-full items-start gap-2 text-left enabled:hover:text-foreground`,children:[(0,G.jsx)(s,{className:uP}),(0,G.jsx)(`span`,{className:W(`min-w-0 flex-1`,o?`truncate`:`whitespace-pre-wrap`),children:o?i.slice(0,a):i})]}),o&&n&&(0,G.jsx)(`pre`,{className:`mt-1.5 max-h-80 overflow-auto font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words`,children:i.slice(a+1)})]})}var Yne={"goal-complete":_t,"goal-blocked":Ct,"needs-user":er,"turn-ended":pn,failed:Ot,stalled:Zt,interrupted:Mn,proposal:At,schedule:it,pending:Zt,"ask-relay":un,leftover:Zt,queued:it};function P5({lines:e}){return(0,G.jsx)(`div`,{"data-enso":`secretary-updates`,className:W(cP,`divide-y divide-border/60`),children:e.map((e,t)=>(0,G.jsx)(Xne,{line:e,onOpen:d6},t))})}function Xne({line:e,onOpen:t}){let{t:n}=K(),[r,i]=(0,H.useState)(!1),a=Yne[e.kind],o=`conversationId`in e?e.conversationId:void 0,s=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(a,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.text})]});return(0,G.jsxs)(`div`,{"data-enso":`secretary-update`,"data-open":r?`true`:`false`,className:`px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[e.detail?(0,G.jsx)(`button`,{type:`button`,"data-enso":`secretary-update-expand`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex min-w-0 flex-1 items-start gap-2 text-left hover:text-foreground`,children:s}):(0,G.jsx)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:s}),o&&t?(0,G.jsx)(`button`,{type:`button`,"data-enso":`secretary-update-open`,title:n(`Open session`),"aria-label":n(`Open session`),onClick:e=>{e.stopPropagation(),t(o)},className:`-mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-[5px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,G.jsx)(ct,{className:`h-3.5 w-3.5`})}):null]}),e.detail&&r&&(0,G.jsx)(`pre`,{className:`mt-1.5 ml-5.5 max-h-60 overflow-auto font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words`,children:e.detail})]})}var F5=/^<message-from-main-agent>\n?([\s\S]*?)\n?<\/message-from-main-agent>\s*$/;function Zne(e){let t=k5.exec(e);return F5.test(t?e.slice(t[0].length):e)}function Qne({name:e,content:t}){let{t:n}=K();return(0,G.jsxs)(HE,{children:[(0,G.jsxs)(WE,{className:fA(`skill`,!0),children:[(0,G.jsx)(Un,{className:`h-3 w-3`}),e]}),(0,G.jsxs)(qE,{className:`max-w-lg`,children:[(0,G.jsx)(JE,{children:(0,G.jsxs)(XE,{className:`text-base`,children:[n(`Skill`),` · `,e]})}),(0,G.jsx)($E,{className:`max-h-[50vh] text-sm`,children:(0,G.jsx)(C3,{text:t})})]})]})}function I5({chip:e,extra:t}){return(0,G.jsxs)(`div`,{className:`max-w-[80%] rounded-2xl rounded-br-md bg-muted px-4 py-2.5 text-sm`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:e}),t?(0,G.jsx)(`div`,{className:`mt-1.5 whitespace-pre-wrap break-words leading-relaxed`,children:(0,G.jsx)(R5,{text:t})}):null]})}function $ne({blocks:e,hostTaskWrapUp:t}){let n=Ak(e.rest),r=t?jk(e.rest):void 0,i=(0,G.jsx)(I5,{chip:(0,G.jsx)(`span`,{className:`inline-flex flex-wrap gap-1 align-middle`,children:e.skills.map(e=>(0,G.jsx)(Qne,{name:e.name,content:e.body},e.location))}),extra:n.rest.trim()});return!n.plan&&!n.unattended&&!r?i:(0,G.jsxs)(G.Fragment,{children:[n.plan&&(0,G.jsx)(j5,{note:n.plan}),n.unattended&&(0,G.jsx)(M5,{note:n.unattended}),r&&(0,G.jsx)(A5,{items:r.items}),i]})}function ere({text:e}){let t=Fk(e);if(t.names.length>1)return(0,G.jsx)(I5,{chip:(0,G.jsx)(`span`,{className:`inline-flex flex-wrap gap-1 align-middle`,children:t.names.map(e=>(0,G.jsx)(pA,{name:`/skill:${e}`},e))}),extra:t.rest});let n=lA(e);return n.slash?(0,G.jsx)(I5,{chip:(0,G.jsx)(pA,{name:n.slash}),extra:n.rest.trim()}):null}function tre({preset:e}){let{t}=K();return(0,G.jsxs)(`div`,{className:`min-w-64 max-w-[80%] overflow-hidden rounded-2xl rounded-br-md bg-muted text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3.5 py-2.5`,children:[(0,G.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-info/15 text-info`,children:(0,G.jsx)(nr,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:t(`Workflow preset`)}),(0,G.jsx)(`p`,{className:`truncate font-medium`,title:e.id,children:e.name||e.id})]})]}),e.args.length>0&&(0,G.jsx)(`dl`,{className:`space-y-1 border-t border-border/60 px-3.5 py-2 text-xs`,children:e.args.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`dt`,{className:`shrink-0 font-mono text-muted-foreground`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0 whitespace-pre-wrap break-words`,children:t})]},e))})]})}function L5({kind:e,label:t,title:n}){let r=e===`file`?Ut:e===`chat`?Mn:Wn;return(0,G.jsxs)(`span`,{className:W(yA(e),`mx-0.5 max-w-52 rounded-md px-1.5 align-middle leading-4`),title:n,children:[(0,G.jsx)(r,{className:`h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:t})]})}function nre({label:e,sessionFile:t}){let n=UW(aP(e=>e.conversations),t);return n?(0,G.jsxs)(`button`,{type:`button`,"data-enso":`chat-ref`,onClick:()=>d6(n),title:t,className:W(yA(`chat`),`mx-0.5 inline-flex max-w-52 items-center gap-1 rounded-md px-1.5 align-middle leading-4 hover:bg-muted`),children:[(0,G.jsx)(Mn,{className:`h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e})]}):(0,G.jsx)(L5,{kind:`chat`,label:e,title:t})}var rre=240;function ire({text:e,originalLines:t}){let{t:n}=K(),r=(0,H.useRef)(null),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(!1);(0,H.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=()=>a(e.scrollHeight>241);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let c=i&&!o;return(0,G.jsxs)(`span`,{"data-enso":`quote-block`,className:`mt-1 mb-2.5 block border-l-2 border-brand/40 pl-2.5 text-muted-foreground`,children:[t?(0,G.jsx)(`span`,{"data-quote-truncated":``,className:`mb-0.5 block text-[11px] text-warning`,children:n(`Truncated · original {{count}} lines`,{count:t})}):null,(0,G.jsx)(`span`,{ref:r,"data-quote-body":``,"data-clipped":c?``:void 0,style:c?{maxHeight:rre}:void 0,className:W(`block`,c&&`overflow-hidden mask-b-from-60%`),children:kA(e).map((e,t)=>e.type===`code`?(0,G.jsx)(`span`,{"data-quote-code":``,className:`my-1 block overflow-x-auto whitespace-pre rounded-md bg-background/60 px-2 py-1 font-mono text-xs`,children:e.code},t):(0,G.jsx)(`span`,{children:e.text},t))}),i?(0,G.jsx)(`button`,{type:`button`,"data-quote-toggle":``,"data-quote-skip":``,onClick:()=>s(e=>!e),className:`mt-0.5 text-[11px] text-muted-foreground/80 select-none hover:text-foreground`,children:n(o?`Show less`:`Show more`)}):null]})}function R5({text:e,searchQuery:t=``,activeNth:n=-1}){let r=Zk(xk(e)),i={n:0};return(0,G.jsx)(`span`,{className:`whitespace-pre-wrap`,children:r.map((e,r)=>e.type===`file`?(0,G.jsx)(I4,{path:e.path,children:(0,G.jsx)(L5,{kind:`file`,label:nA(e.path),title:e.path})},r):e.type===`chat`?(0,G.jsx)(nre,{label:e.label,sessionFile:e.sessionFile},r):e.type===`ui-element`?(0,G.jsx)(L5,{kind:`ui-element`,label:e.label,title:`${e.path}${e.text?` · ${e.text}`:``}`},r):e.type===`quote`?(0,G.jsx)(ire,{text:e.text,originalLines:e.originalLines},r):(0,G.jsx)(`span`,{children:t.trim()?uU(e.text,t,n,i):e.text},r))})}function are({files:e,chats:t}){return(0,G.jsxs)(`span`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:[e.map(e=>(0,G.jsx)(I4,{path:e,children:(0,G.jsx)(L5,{kind:`file`,label:nA(e),title:e})},`f:${e}`)),t.map(e=>(0,G.jsx)(L5,{kind:`chat`,label:e.label,title:e.sessionFile},`c:${e.sessionFile}`))]})}var z5=`max-w-[82%] rounded-[10px] bg-muted px-3.5 py-[9px] text-(length:--chat-body-size) leading-[1.6]`;function B5({text:e,searchQuery:t=``,activeNth:n=-1,thumbnails:r=0,align:a=`end`,hostTaskWrapUp:o=!1}){let{t:s}=K(),c=BN(),l=!!(c?.speaker||c?.botSession),u=WU(e,r);if(u)return(0,G.jsxs)(G.Fragment,{children:[u.text&&(0,G.jsx)(B5,{text:u.text,searchQuery:t,activeNth:n,hostTaskWrapUp:o}),(0,G.jsx)(WG,{entries:u.entries,thumbnails:r,align:a})]});let d=JU(e);if(d)return(0,G.jsx)(T3,{message:d});let f=l?OU(e):null;if(f)return(0,G.jsx)(VW,{message:f});let p=l?wU(e):e;if(p!==e)return(0,G.jsx)(B5,{text:p,searchQuery:t,activeNth:n,hostTaskWrapUp:o});let m=l?bU(e):null;if(m?.refs.length)return(0,G.jsxs)(`div`,{className:`flex w-full flex-col items-end gap-1.5`,children:[m.body&&(0,G.jsx)(B5,{text:m.body,searchQuery:t,activeNth:n}),(0,G.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:m.refs.map(e=>(0,G.jsxs)(`span`,{title:s(`Referenced chat`),className:`inline-flex h-6 max-w-56 items-center gap-1 rounded-md bg-muted px-1.5 text-xs`,children:[(0,G.jsx)(pn,{className:`h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]},e.id))})]});let h=ge(e);if(h.note){let e=h.rest.trim();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(j5,{note:h.note}),e&&(0,G.jsx)(B5,{text:e,searchQuery:t,activeNth:n,hostTaskWrapUp:o})]})}let g=Ck(e);if(g.note){let e=g.rest.trim();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(M5,{note:g.note}),e&&(0,G.jsx)(B5,{text:e,searchQuery:t,activeNth:n,hostTaskWrapUp:o})]})}let _=o?Ok(e):null;if(_){let e=_.rest.trim();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(A5,{items:_.items}),e&&(0,G.jsx)(B5,{text:e,searchQuery:t,activeNth:n})]})}let v=Vne.exec(e);if(v){let r=e.slice(v[0].length).trim();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Hne,{note:v[1]??``}),r&&(0,G.jsx)(B5,{text:r,searchQuery:t,activeNth:n})]})}let y=i(e);if(y?.kind===`approved`)return(0,G.jsxs)(`div`,{className:`flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(At,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[s(`Plan approved, executing`),(0,G.jsx)(`span`,{className:`ml-1.5 text-foreground`,children:y.title})]})]});if(y?.kind===`feedback`)return(0,G.jsxs)(`div`,{className:W(z5,`whitespace-pre-wrap`),children:[(0,G.jsxs)(`p`,{className:`mb-1 flex items-center gap-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:[(0,G.jsx)(jt,{className:`h-3 w-3`}),s(`Plan feedback`)]}),(0,G.jsx)(R5,{text:y.feedback,searchQuery:t,activeNth:n})]});let b=zk(e);if(b)return(0,G.jsx)(tre,{preset:b});let x=aA(e);if(x.files.length>0||x.chats.length>0){let e=lA(x.body);return(0,G.jsxs)(`div`,{className:z5,children:[e.slash?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(pA,{name:e.slash}),e.rest.trim()?(0,G.jsx)(`span`,{className:`ml-1.5 align-middle`,children:(0,G.jsx)(R5,{text:e.rest.trim(),searchQuery:t,activeNth:n})}):null]}):(0,G.jsx)(R5,{text:x.body,searchQuery:t,activeNth:n}),(0,G.jsx)(are,{files:x.files,chats:x.chats})]})}let S=Ik(e);if(S)return(0,G.jsx)($ne,{blocks:S,hostTaskWrapUp:o});if(lA(e).slash)return(0,G.jsx)(ere,{text:e});let C=Bne.exec(e);if(C){let r=e.slice(C[0].length).trim();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Une,{note:C[1]}),r&&(0,G.jsx)(B5,{text:r,searchQuery:t,activeNth:n})]})}let w=$U(e);if(w)return(0,G.jsx)(Kne,{segments:w,searchQuery:t,activeNth:n});let T=MW(e);if(T)return(0,G.jsx)(P5,{lines:T});let E=k5.exec(e),D=E?e.slice(E[0].length):e,O=F5.exec(D),k=O?O[1]:D;return(0,G.jsxs)(`div`,{className:W(O?`max-w-[80%] rounded-2xl rounded-bl-md border border-blue-500/20 bg-blue-500/8 px-4 py-2.5 text-sm`:W(z5,`whitespace-pre-wrap`)),children:[O&&(0,G.jsxs)(`p`,{className:`mb-1 flex items-center gap-1 text-[10px] font-medium tracking-wide text-blue-600 uppercase dark:text-blue-400`,children:[(0,G.jsx)(pt,{className:`h-3 w-3`}),s(`From main agent`)]}),E?.[1]&&!jU(E[1])&&(0,G.jsxs)(`div`,{className:`mb-2 rounded-md bg-background/60 px-2.5 py-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:s(`Role`)}),` · `,E[1]]}),O?(0,G.jsx)(C3,{text:k,searchQuery:t,activeNth:n}):(0,G.jsx)(R5,{text:k,searchQuery:t,activeNth:n})]})}function V5(e){return e.kind===`tool-group`||e.kind===`thinking`||e.kind===`tool`&&kH(e)}var H5=`text-[color:var(--subtle-foreground,var(--muted-foreground))]`,U5=`animate-pulse motion-reduce:animate-none`;function ore({model:e,at:t,privacyMask:n,secretarySession:r=!1,face:i}){let a=BN(),o=QR(),s=r?i??o:null,c=a?.speaker??(a?null:s),l=!a&&s?!0:void 0,u=[e,typeof t==`number`?$5(t):null].filter(Boolean).join(` · `);return!c&&!u&&!n?null:(0,G.jsxs)(`div`,{"data-quote-skip":``,className:`mb-2 flex h-6 min-w-0 items-center gap-2 text-xs select-none`,children:[c&&(c.image?(0,G.jsx)(`img`,{"data-enso":l?`secretary-chat-avatar`:void 0,"data-image":l?`true`:void 0,src:c.image,alt:``,draggable:!1,className:`size-[22px] shrink-0 rounded-full object-cover`,style:{backgroundColor:c.color}}):l?(0,G.jsx)(aR,{name:c.name,color:c.color,enso:`secretary-chat-avatar`,className:`size-[22px] rounded-full`}):(0,G.jsx)(`span`,{className:`flex size-[22px] shrink-0 items-center justify-center rounded-full font-semibold text-[11px] text-white`,style:{backgroundColor:c.color},children:[...c.name.trim()][0]?.toUpperCase()??`?`})),c&&(0,G.jsx)(`span`,{className:`shrink-0 truncate text-[13px] font-semibold text-foreground`,children:c.name}),u&&(0,G.jsx)(`span`,{className:W(`min-w-0 truncate text-[11.5px]`,H5),children:u}),n&&(0,G.jsx)(E8,{report:n})]})}var sre=(0,H.memo)(function({item:e,secretarySession:t=!1,onToggleGroup:n,onToggleTurn:r}){let i=oU(),a=i.query,o=i.activeKey===e.key?i.activeNth:-1,s=t;switch(e.kind){case`user`:{let t=e.text?Zne(e.text):!1,n=e.collapsed===!0,i=e.hostTaskWrapUp?Mk(e.text):e.text;return(0,G.jsxs)(`div`,{"data-enso":`message-user`,className:W(`group/user flex flex-col gap-1.5`,t?`items-start`:`items-end`),children:[e.images.map((e,t)=>(0,G.jsx)(VG,{src:`data:${e.mimeType};base64,${e.data}`,className:`max-h-48 max-w-full rounded-lg border object-contain`},t)),e.text&&(0,G.jsx)(B5,{text:e.text,searchQuery:a,activeNth:o,thumbnails:e.images.length,align:t?`start`:`end`,hostTaskWrapUp:e.hostTaskWrapUp===!0}),n?(0,G.jsx)(xre,{turnKey:e.key,text:i,timestamp:e.timestamp,turnDurationMs:e.turnDurationMs,onToggle:r}):(0,G.jsx)(Sre,{turnKey:e.key,messageIndex:Number(e.key),text:i,timestamp:e.timestamp,deliveryState:e.deliveryState,canCollapse:e.canCollapse,onToggleTurn:r})]})}case`text`:return(0,G.jsx)(wre,{item:e,searchQuery:a,activeNth:o});case`thinking`:return(0,G.jsx)(Ore,{itemKey:e.key,text:e.text,streaming:e.streaming,durationMs:e.durationMs,startedAt:e.startedAt});case`tool`:{let t=pG(e),n=eB(e.name,s),r=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(hO,{name:e.name,output:e.output,state:e.state}),n?(0,G.jsx)(g5,{item:e,framed:s}):(0,G.jsx)(Fre,{item:e}),t?(0,G.jsx)(vG,{proposalId:t}):null,e.pluginArtifacts?(0,G.jsx)(S6,{artifacts:e.pluginArtifacts,align:n?`card`:`tool-row`}):null]});return n?(0,G.jsx)(`div`,{"data-enso":`tool-card-pair`,className:`w-full min-w-0`,children:r}):r}case`tool-group`:return(0,G.jsx)(Mre,{item:e,onToggle:n});case`error`:return(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-destructive`,children:[(0,G.jsx)(Ct,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap`,children:e.text}),(0,G.jsx)(J5,{})]});case`interrupted`:return(0,G.jsx)(pre,{item:e});case`task-note`:return(0,G.jsx)(kre,{item:e});case`compaction`:case`compaction-notice`:return(0,G.jsx)(jre,{item:e});case`compaction-progress`:return(0,G.jsx)(Are,{state:e.state});case`session-custom`:return(0,G.jsx)(fre,{entry:e.entry});case`plugin-message`:return(0,G.jsx)(lre,{item:e});case`discarded-turn`:return(0,G.jsx)(ure,{item:e,onToggle:n});case`resumed-reply`:return(0,G.jsx)(dre,{item:e,onToggle:n});case`divider`:return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:`h-px flex-1 bg-border`}),e.text,(0,G.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})}},zne),W5=e=>{if(typeof e==`string`)return e;if(e===void 0)return`—`;try{return JSON.stringify(e)}catch{return String(e)}};function cre({entry:e}){let{t}=K(),n=$3(),r=n.get(e.accountKey),i=e.previousAccountKey?n.get(e.previousAccountKey):void 0,a=e.previousAccountKey?i&&r?t(`ChatGPT account switched: {{previous}} → {{current}}`,{previous:i,current:r}):t(`ChatGPT account switched`):r?t(`ChatGPT account selected: {{account}}`,{account:r}):t(`ChatGPT account selected`);return(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-2 text-xs`,children:[(0,G.jsx)(jn,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`}),(0,G.jsx)(`p`,{className:`min-w-0 break-words text-muted-foreground`,children:a})]})}function lre({item:e}){let{t}=K();return(0,G.jsxs)(`div`,{"data-plugin-message":e.pluginId,className:`rounded-md border border-dashed border-border bg-muted/20 px-3 py-2 text-xs`,children:[(0,G.jsxs)(`p`,{className:`mb-1 flex items-center gap-1.5 text-muted-foreground`,children:[(0,G.jsx)(O6,{pluginId:e.pluginId,className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{children:t(`From plugin {{name}}`,{name:e.pluginName})}),(0,G.jsx)(`span`,{className:`font-mono opacity-70`,children:e.pluginId})]}),(0,G.jsx)(`div`,{className:G5,children:(0,G.jsx)(C3,{text:e.text})})]})}var G5=`break-words text-foreground [&_p]:whitespace-pre-line`;function ure({item:e,onToggle:t}){let{t:n}=K();return(0,G.jsxs)(`div`,{"data-discarded-turn":e.pluginId,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.key),"data-enso":`tool-row`,className:W(`group/step flex min-h-6 w-full items-center gap-2 text-left text-[13px] transition-colors hover:text-foreground`,H5),children:[(0,G.jsx)(Bn,{className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground group-hover/step:text-foreground`,children:Ns(`turn_discard`,n)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.pluginName,e.reason].filter(Boolean).join(` · `)}),(0,G.jsx)(yt,{className:W(`h-3 w-3 shrink-0 transition-transform`,e.expanded&&`rotate-90`)})]}),e.expanded&&(0,G.jsxs)(`div`,{className:`t-acc-reveal mt-1 mb-1.5 ml-5 space-y-2 rounded-md border border-dashed border-border bg-muted/20 px-3 py-2 text-xs`,children:[(0,G.jsxs)(`p`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,G.jsx)(O6,{pluginId:e.pluginId,className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{children:n(`From plugin {{name}}`,{name:e.pluginName})})]}),e.messages.map((e,t)=>(0,G.jsx)(`div`,{className:G5,children:(0,G.jsx)(C3,{text:e})},t)),e.tools.map((e,t)=>(0,G.jsxs)(`p`,{className:W(`truncate`,H5),children:[Ns(e.name,n),` `,e.summary]},t))]})]})}function dre({item:e,onToggle:t}){let{t:n}=K();return(0,G.jsxs)(`div`,{"data-resumed-reply":``,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.key),"aria-expanded":e.expanded,"data-enso":`tool-row`,className:W(`group/step flex min-h-6 w-full items-center gap-2 text-left text-[13px] transition-colors hover:text-foreground`,H5),children:[(0,G.jsx)(Cn,{className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[n(`Interrupted by a restart, continued below`),(0,G.jsx)(`span`,{className:`ml-1.5 opacity-70`,children:e.expanded?n(`Hide the interrupted part`):n(`Show the interrupted part`)})]}),(0,G.jsx)(yt,{className:W(`h-3 w-3 shrink-0 transition-transform`,e.expanded&&`rotate-90`)})]}),e.expanded&&(0,G.jsxs)(`div`,{className:`t-acc-reveal mt-1 mb-1.5 ml-5 space-y-2 rounded-md border border-dashed border-border bg-muted/20 px-3 py-2 text-xs`,children:[e.thinking&&(0,G.jsx)(`p`,{className:W(`whitespace-pre-wrap break-words`,H5),children:e.thinking}),e.text&&(0,G.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-foreground`,children:e.text}),e.tools.map((e,t)=>(0,G.jsxs)(`p`,{className:W(`truncate`,H5),children:[Ns(e.name,n),` `,e.summary]},t))]})]})}function fre({entry:e}){let{t}=K();if(e.kind===`oauth-account-selected`)return(0,G.jsx)(cre,{entry:e});if(e.kind===`agent-dispatch`)return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-2 text-xs`,children:[(0,G.jsx)(pt,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:t(`Dispatched to`)}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.child.instanceName})]});if(e.kind===`agent-completed`)return(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-emerald-500/20 bg-emerald-500/5 px-2.5 py-2 text-xs`,children:[(0,G.jsx)(_t,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-500`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`p`,{className:`font-medium`,children:[e.child.instanceName,` · `,t(`Completed`)]}),e.receiptSummary&&(0,G.jsx)(`p`,{className:`mt-0.5 whitespace-pre-wrap text-muted-foreground`,children:e.receiptSummary})]})]});if(e.kind===`agent-failed`)return(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/20 bg-destructive/5 px-2.5 py-2 text-xs`,children:[(0,G.jsx)(Ct,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`p`,{className:`font-medium`,children:[e.child.instanceName,` · `,t(`Failed`)]}),(0,G.jsx)(`p`,{className:`mt-0.5 whitespace-pre-wrap text-muted-foreground`,children:e.message})]})]});if(e.kind===`tool-batch-label`)return null;if(e.kind===`task-wrap-up-nudge`)return(0,G.jsxs)(`div`,{"data-enso":`task-wrap-up-nudge`,className:`my-1 flex items-center gap-1.5 text-[12px] text-subtle-foreground`,children:[(0,G.jsx)(rn,{className:`size-3.5 shrink-0`}),t(`{{count}} background tasks are still undeclared; the next message asks the agent to stop each one or state why it keeps running`,{count:e.count})]});let n=e.receipt,r=n.outcome===`succeeded`;return(0,G.jsx)(`div`,{className:W(`rounded-md border px-2.5 py-2 text-xs`,r?`border-emerald-500/20 bg-emerald-500/5`:n.outcome===`failed`?`border-destructive/20 bg-destructive/5`:`border-amber-500/20 bg-amber-500/5`),children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[r?(0,G.jsx)(_t,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-500`}):(0,G.jsx)(Ct,{className:W(`mt-0.5 h-3.5 w-3.5 shrink-0`,n.outcome===`failed`?`text-destructive`:`text-amber-500`)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`font-medium`,children:[n.subject.label,` · `,t(n.outcome)]}),(0,G.jsx)(`p`,{className:`mt-0.5 whitespace-pre-wrap text-muted-foreground`,children:n.summary}),n.changes&&n.changes.length>0&&(0,G.jsx)(`dl`,{className:`mt-2 space-y-1 border-t border-border/50 pt-2`,children:n.changes.map(e=>(0,G.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-2`,children:[(0,G.jsx)(`dt`,{className:`truncate text-muted-foreground`,children:e.field}),(0,G.jsxs)(`dd`,{className:`text-right font-mono`,children:[W5(e.previous),` → `,W5(e.value)]})]},e.field))})]})]})})}function K5(e){let t=e.activeId?e.conversations[e.activeId]:null;return t?t.activeTabId?e.conversations[t.activeTabId]??t:t:null}var q5=()=>()=>{};function pre({item:e}){let{locale:t}=K(),n=FU({at:e.at,kind:e.exitKind,unfinishedTools:e.unfinishedTools,lang:t});return(0,G.jsxs)(`div`,{"data-enso":`timeline-interrupted`,className:`flex items-start gap-2 text-sm text-warning`,children:[(0,G.jsx)(Ct,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap`,children:n}),(0,G.jsx)(mre,{})]})}function mre(){let{t:e}=K();return aP(e=>{let t=K5(e);return!!(t&&!t.spawning&&t.status!==`running`)})?(0,G.jsxs)(`button`,{type:`button`,"data-enso":`timeline-interrupted-retry`,title:e(`Retry`),onClick:()=>{let e=K5(aP.getState());e&&aP.getState().retryInterrupted(e.id)},className:`mt-0.5 inline-flex shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground`,children:[(0,G.jsx)(jn,{className:`h-3 w-3`}),e(`Retry`)]}):null}function J5(){let{t:e}=K(),t=BN(),n=t?.botControls,r=aP(e=>{if(t&&(!t.canRetry||t.botControls))return!1;let n=K5(e);return!!(n?.started&&!n.spawning&&n.status!==`running`)}),i=()=>{if(!n||!t?.canRetry)return!1;let e=n.projection();return!!(e&&e.status!==`running`)},a=(0,H.useSyncExternalStore)(n?.subscribe??q5,i,i);return(n?a:r)?(0,G.jsxs)(`button`,{type:`button`,title:e(`Retry`),onClick:()=>{if(n)return n.retry();let e=K5(aP.getState());e&&aP.getState().retry(e.id)},className:`mt-0.5 inline-flex shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground`,children:[(0,G.jsx)(jn,{className:`h-3 w-3`}),e(`Retry`)]}):null}function hre(e,t){return qB(K5(e),t)}var Y5=`flex items-center gap-1 text-[11px] text-muted-foreground transition-opacity hover:text-foreground`;function gre({messageIndex:e}){let{t}=K(),n=BN();return aP(e=>{let t=K5(e);return JB(t,n,t?GB(e.conversations,t.id):1)})?(0,G.jsxs)(`button`,{type:`button`,className:Y5,title:t(`Keep this session and start a parallel one from here`),onClick:()=>{let t=aP.getState(),n=K5(t);n&&t.forkFromTurn(n.id,e)},children:[(0,G.jsx)(Yt,{className:`h-3 w-3`}),t(`Conversation branch`)]}):null}function _re({messageIndex:e}){let{t}=K(),n=BN(),r=aP(e=>K5(e)?.id),i=aP(t=>{let i=r?t.conversations[r]:void 0;if(n||!i||i.historyOnly||i.rewinding||i.restoringFiles||i.workspaceMigrating)return;let a=i.messages[e-(i.historyBaseIndex??0)];return m6(a)||i.status===`running`&&h6(a)?a?.deliveryId:void 0});return!r||!i?null:(0,G.jsxs)(`button`,{type:`button`,title:t(`Withdraw message`),onClick:()=>aP.getState().withdrawMessage(r,{kind:`delivery`,id:i}),className:`inline-flex items-center gap-1 hover:text-foreground`,children:[(0,G.jsx)(Qn,{className:`h-3 w-3`}),t(`Withdraw message`)]})}function vre(){let{t:e}=K(),t=aP(e=>K5(e)?.id);return t?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>void HW(t,e),className:`inline-flex items-center gap-1 hover:text-foreground`,children:[(0,G.jsx)(Nn,{className:`h-3 w-3`}),e(`Restart conversation`)]}):null}function yre({messageIndex:e}){let{t}=K(),n=BN(),r=aP(e=>K5(e)?.id),i=aP(t=>{let i=r?t.conversations[r]:void 0;if(n||!i||i.historyOnly)return;let a=i.messages[e-(i.historyBaseIndex??0)];return m6(a)?a?.deliveryId:void 0});return!r||!i?null:(0,G.jsxs)(`button`,{type:`button`,title:t(`Resend`),onClick:()=>aP.getState().resendMessage(r,i),className:`inline-flex items-center gap-1 hover:text-foreground`,children:[(0,G.jsx)(jn,{className:`h-3 w-3`}),t(`Resend`)]})}function bre({messageIndex:e}){let{t}=K(),[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(null),o=BN(),s=o?.botControls,c=aP(t=>{if(o?.botControls)return!1;let n=K5(t);return hre(t,o)&&!!(n&&XB(n.id,n.id,n,e))}),l=()=>{if(!s||!o?.canRewind||!o.sessionId)return null;let t=s.projection();return!t||t.status===`running`?null:XB(o.sessionId,o.sessionId,t,e)?.entryId??null},u=(0,H.useSyncExternalStore)(s?.subscribe??q5,l,l);if(!(s?u!==null:c))return null;let d=t=>{if(s&&o?.sessionId&&u){a({restoreFiles:t,conversationId:o.sessionId,entryId:u});return}let n=K5(aP.getState());if(!n)return;let r=XB(n.id,n.id,n,e);r&&a({restoreFiles:t,conversationId:n.id,entryId:r.entryId})},f=(t,n,r)=>{if(s)return s.rewind(r,t);let i=aP.getState(),a=XB(n,K5(i)?.id,i.conversations[n],e,r);a&&i.rewind(a.conversationId,a.entryId,t)},p=[{icon:Qn,label:t(`Conversation only`),desc:t(`Rewind to this message`),restoreFiles:!1,action:()=>d(!1)},{icon:Mn,label:t(`Conversation + files`),desc:t(`Rewind and restore files to before this turn`),restoreFiles:!0,action:()=>d(!0)}];return(0,G.jsxs)(q3,{open:n,onOpenChange:r,children:[(0,G.jsxs)(J3,{className:Y5,title:t(`Rewind to this message`),children:[(0,G.jsx)(Qn,{className:`h-3 w-3`}),t(`Rewind`)]}),(0,G.jsx)(Y3,{side:`bottom`,align:`end`,className:`w-72 [&_[data-slot=popover-viewport]]:p-1`,children:p.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{r(!1),e.action()},className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-muted/60`,children:[(0,G.jsx)(e.icon,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block`,children:e.label}),(0,G.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.desc})]})]},e.label))}),(0,G.jsx)(Z6,{open:i!==null,onOpenChange:e=>{e||a(null)},title:t(`Rewind to this message?`),description:i?.restoreFiles?t(`Later messages leave the current branch and working-tree files are restored to before this turn.`):t(`Later messages leave the current branch; the text returns to the input box.`),confirmLabel:t(`Rewind`),onConfirm:()=>{i&&f(i.restoreFiles,i.conversationId,i.entryId)}})]})}function xre({turnKey:e,text:t,timestamp:n,turnDurationMs:r,onToggle:i}){let{t:a}=K();return(0,G.jsxs)(`div`,{"data-quote-skip":``,className:`flex items-center gap-1.5 text-[11px] text-muted-foreground/80 select-none`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i?.(e,!1),className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground cursor-pointer border border-border/40`,title:a(`Expand`),children:[(0,G.jsx)(yt,{className:`h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:a(`Expand`)})]}),(0,G.jsx)(X5,{text:t}),typeof n==`number`&&(0,G.jsx)(`span`,{children:$5(n)}),r!==void 0&&(0,G.jsxs)(`span`,{children:[`· `,a(`took {{duration}}`,{duration:jN(r)})]})]})}function X5({text:e}){return e.trim()?(0,G.jsx)(`span`,{"data-enso":`copy-user-prompt`,className:`inline-flex`,children:(0,G.jsx)(Z5,{text:mk(e),className:`opacity-0 transition-opacity group-hover/user:opacity-100 focus-visible:opacity-100`})}):null}function Sre({turnKey:e,messageIndex:t,text:n,timestamp:r,canCollapse:i,deliveryState:a,onToggleTurn:o}){let{t:s}=K(),c=E(e=>e.autoCollapseTurns);return(0,G.jsxs)(`div`,{"data-quote-skip":``,className:`flex items-center gap-2 text-[11px] text-muted-foreground/75 select-none`,children:[(0,G.jsx)(bre,{messageIndex:t}),(0,G.jsx)(yre,{messageIndex:t}),(0,G.jsx)(_re,{messageIndex:t}),(0,G.jsx)(X5,{text:n}),a&&(0,G.jsx)(`span`,{children:s(a===`stuck`?`Not sent: the previous turn is stuck and could not be interrupted. Restart the conversation, then resend.`:a===`rejected`?`Not sent`:`Delivery unconfirmed`)}),a===`stuck`&&(0,G.jsx)(vre,{}),c&&i&&o&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>o(e,!0),className:W(Y5,`cursor-pointer opacity-0 group-hover/user:opacity-100`),title:s(`Collapse`),children:[(0,G.jsx)(vt,{className:`h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:s(`Collapse`)})]}),typeof r==`number`&&(0,G.jsx)(`span`,{children:$5(r)})]})}function Cre({turnKey:e,canCollapse:t,collapsed:n,onToggleTurn:r}){let{t:i}=K();return!E(e=>e.autoCollapseTurns)||!t||!r||n?null:(0,G.jsxs)(`button`,{type:`button`,"data-enso":`turn-collapse`,"data-quote-skip":``,onClick:()=>r(e,!0),className:W(`mt-1 flex min-h-6 select-none items-center gap-1 text-[12px] transition-colors hover:text-foreground [@media(hover:none)]:min-h-10 [@media(hover:none)]:pr-3`,H5),children:[(0,G.jsx)(xt,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{children:i(`Collapse`)})]})}function wre({item:e,searchQuery:t=``,activeNth:n=-1}){let{t:r}=K(),i=BN(),a=e.perf?Tre(e.perf,r,e.turnDurationMs!==void 0):``,o=aP(e=>K5(e)?.id??null),s=Number(e.key.split(`-`)[0]),c={text:e.text,messageIndex:s,sessionId:i?i.sessionId:o};return(0,G.jsxs)(`div`,{"data-enso":`message-assistant`,className:`group text-(length:--chat-body-size)`,children:[(0,G.jsx)(C3,{text:e.text,streaming:e.streaming,searchQuery:t,activeNth:n,leaf:{messageIndex:c.messageIndex,sessionId:c.sessionId}}),e.turnEnd&&!e.streaming&&i?.turnFooter?.(Number(e.key.split(`-`)[0])),!e.streaming&&(0,G.jsxs)(`div`,{"data-quote-skip":``,className:`mt-1 flex items-center gap-2 text-[11px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100`,children:[(0,G.jsx)(mO,{position:`left`,...c}),(0,G.jsx)(Z5,{text:e.text}),(0,G.jsx)(mO,{position:`right`,...c}),e.turnEnd&&(0,G.jsx)(gre,{messageIndex:Number(e.key.split(`-`)[0])}),e.timestamp&&!e.turnEnd&&(0,G.jsx)(`span`,{children:$5(e.timestamp)}),e.turnDurationMs!==void 0&&(0,G.jsxs)(`span`,{children:[e.timestamp&&!e.turnEnd&&`· `,r(`took {{duration}}`,{duration:jN(e.turnDurationMs)})]}),a&&(0,G.jsxs)(`span`,{children:[`· `,a]})]})]})}function Z5({text:e,className:t}){let{t:n}=K(),[r,i]=(0,H.useState)(!1);return(0,G.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i(!0),setTimeout(()=>i(!1),1e3)})},className:W(`flex items-center gap-1 transition-colors hover:text-foreground`,t),title:n(`Copy`),children:r?(0,G.jsx)(_t,{className:`h-3 w-3`}):(0,G.jsx)(Ft,{className:`h-3 w-3`})})}var Q5=e=>String(e).padStart(2,`0`),$5=e=>{let t=new Date(e);return`${Q5(t.getHours())}:${Q5(t.getMinutes())}`},e7=e=>{let t=e/1e3;return String(t<10?Math.round(t*10)/10:Math.round(t))};function Tre(e,t,n=!1){let r=[];return(!n||e.turnMs!==void 0)&&r.push(`${e7(e.runMs)}s`),e.ttftMs!==void 0&&r.push(`TTFT ${e7(e.ttftMs)}s`),e.tps!==void 0&&r.push(`${Math.round(e.tps)} tok/s`),!n&&e.turnMs!==void 0&&r.push(t(`total {{duration}}`,{duration:jN(e.turnMs)})),r.join(` · `)}function Ere(e,t,n=16){return e.top<t.top?e.top-t.top-n:e.bottom>t.bottom?e.bottom-t.bottom+n:0}function Dre(e){let t=e.parentElement;for(;t;){if(t.hasAttribute(`data-virtuoso-scroller`))return t;let e=typeof window.getComputedStyle==`function`?window.getComputedStyle(t).overflowY:t.style.overflowY;if(e===`auto`||e===`scroll`||e===`overlay`)return t;t=t.parentElement}return null}function t7(e,t=Dre(e)){if(!t){e.getBoundingClientRect().top<0&&e.scrollIntoView?.({block:`nearest`});return}let n=Ere(e.getBoundingClientRect(),t.getBoundingClientRect());n!==0&&(t.scrollTop=Math.max(0,t.scrollTop+n))}function Ore({itemKey:e,text:t,streaming:n,durationMs:r,startedAt:i}){let{t:a}=K(),o=E(e=>e.expandLiveReasoning),[s,c]=(0,H.useState)(null),l=nV(s,n,o),u=(0,H.useRef)(null),d=(0,H.useRef)(!1);return(0,H.useLayoutEffect)(()=>{l||!d.current||(d.current=!1,u.current&&t7(u.current))},[l]),(0,G.jsxs)(`div`,{ref:u,"data-enso":`thinking`,"data-live":n||void 0,children:[(0,G.jsxs)(`button`,{type:`button`,"data-quote-skip":``,onClick:()=>c(!l),className:W(`flex min-h-6 select-none items-center gap-2 text-[13px] transition-colors hover:text-foreground`,H5),children:[(0,G.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center`,children:(0,G.jsx)(mt,{className:W(`size-3`,n&&`animate-pulse text-brand`)})}),n?(0,G.jsx)(`span`,{className:W(`text-foreground`,U5),children:a(`Thinking…`)}):r===null?(0,G.jsx)(`span`,{children:a(`Thought process`)}):(0,G.jsx)(`span`,{children:a(`Thought for {{duration}}`,{duration:jN(r)})}),n&&(0,G.jsx)(a7,{itemKey:e,since:i}),(0,G.jsx)(yt,{className:W(`h-3 w-3 transition-transform`,l&&`rotate-90`)})]}),l&&(0,G.jsx)(_O,{text:t,streaming:n,itemKey:e}),l&&!n&&(0,G.jsxs)(`button`,{type:`button`,"data-enso":`thinking-collapse`,"data-quote-skip":``,onClick:()=>{d.current=!0,c(!1)},className:W(`mt-1 ml-[31px] flex min-h-6 select-none items-center gap-1 text-[12px] transition-colors hover:text-foreground`,H5),children:[(0,G.jsx)(xt,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{children:a(`Collapse thinking`)})]})]})}function kre({item:e}){let{t}=K(),[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(void 0),o=/^Background task (\S+) finished \((.+?), ran (.+?)\)/.exec(e.summary),s=o?`${o[1]} · ${o[2]} · ${o[3]}`:e.summary,c=/(?:read ((?:\/|[A-Za-z]:[\\/]).+?\.log) for the complete log|Full log: ((?:\/|[A-Za-z]:[\\/])\S+?\.log))/.exec(e.detail)?.slice(1).find(Boolean)??null;return(0,H.useEffect)(()=>{!n||!c||i!==void 0||window.electronAPI.files.read(c).then(e=>{a(typeof e==`string`?e:null)}).catch(()=>a(null))},[n,c,i]),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex w-full items-center gap-3`,title:e.detail,children:[(0,G.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:[(0,G.jsx)(_t,{className:`h-3 w-3 text-green-600 dark:text-green-500`}),s,(0,G.jsx)(yt,{className:W(`h-3 w-3 transition-transform`,n&&`rotate-90`)})]}),(0,G.jsx)(`span`,{className:`h-px flex-1 bg-border`})]}),n&&(0,G.jsxs)(`div`,{className:`mt-1.5 rounded-lg border border-border/60 bg-muted/20`,children:[(0,G.jsx)(`pre`,{className:`border-b border-border/60 px-3 py-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground`,children:e.detail}),(0,G.jsx)(`pre`,{className:`max-h-64 overflow-auto px-3 py-2 font-mono text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground`,children:c?i===void 0?t(`Loading…`):i6(i??t(`(log unavailable)`)):t(`(no log available)`)})]})]})}function Are({state:e}){let{t}=K();return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(cn,{className:`h-3 w-3 animate-spin`}),(0,G.jsx)(`span`,{children:t(e===`queued`?`Compacts after this turn`:`Compacting…`)})]})}function jre({item:e}){let{t}=K(),[n,r]=(0,H.useState)(!1),i=e.kind===`compaction`,a=e.tokensBefore===null?null:AN(e.tokensBefore),o=Q6(e.tokensBefore,e.tokensAfter),s=o!==null&&e.tokensBefore!==null&&e.tokensAfter!==void 0?t(`{{kind}} · {{before}} → {{after}} · freed {{percent}}%`,{kind:t(e.memory?`Memory context compacted`:e.verified?`Verified context compacted`:`Context compacted`),before:AN(e.tokensBefore),after:AN(e.tokensAfter),percent:o}):e.memory?a===null?t(`Memory context compacted`):t(`Memory context compacted ({{tokens}} tokens before)`,{tokens:a}):e.verified?a===null?t(`Verified context compacted`):t(`Verified context compacted ({{tokens}} tokens before)`,{tokens:a}):a===null?t(`Context compacted`):t(`Context compacted ({{tokens}} tokens before)`,{tokens:a});return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:W(`flex items-center gap-3`,i&&`w-full`),title:e.memory?t(`Summary rendered from continuous memory. Messages above are no longer in the model context; use recall for sources.`):e.verified?t(`Verified summary from smart compaction. Messages above are no longer in the model context.`):t(i?`Messages above are no longer in the model context; only this summary is.`:`Latest compaction summary — expand to read what the model kept.`),children:[i&&(0,G.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:[(0,G.jsx)(vn,{className:`h-3 w-3`}),s,(0,G.jsx)(yt,{className:W(`h-3 w-3 transition-transform`,n&&`rotate-90`)})]}),i&&(0,G.jsx)(`span`,{className:`h-px flex-1 bg-border`})]}),n&&(0,G.jsx)(`pre`,{className:`mt-1.5 max-h-80 overflow-auto rounded-lg border border-border/60 bg-muted/20 px-3 py-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground`,children:e.summary||t(`(summary unavailable)`)})]})}function Mre({item:e,onToggle:t}){let{t:n}=K(),r=E(e=>e.compactReadOnlyTools),i=[];e.stats.commands>0&&i.push(n(`ran {{count}} commands`,{count:e.stats.commands})),e.stats.reads>0&&i.push(n(`read {{count}} files`,{count:e.stats.reads})),e.stats.searches>0&&i.push(n(`searched {{count}} times`,{count:e.stats.searches})),e.stats.others>0&&i.push(n(`{{count}} other calls`,{count:e.stats.others}));let a=[];r&&(e.stats.reads>0&&a.push(n(`{{count}} files`,{count:e.stats.reads})),e.stats.searches>0&&a.push(n(`{{count}} searches`,{count:e.stats.searches})));let o=e.activity,s=[];o&&(o.thinking>0&&s.push(n(`{{count}} thinking steps`,{count:o.thinking})),e.count>0&&s.push(n(`{{count}} tool calls`,{count:e.count})));let c=e.explore,l=e.exploring||!!(o&&e.live),u=e.notice===`patrol`?n(`Patrol clear`):e.notice===`seen`?n(`Update seen`):null,d=c?Ns(`explore_fold`,n):u||(o?n(`Worked for {{duration}}`,{duration:jN(o.workedMs)}):r?e.exploring?n(`Exploring`):n(`Explored`):n(`{{count}} tool calls`,{count:e.count})),f=c?[c.goal,n(`{{count}} tool calls`,{count:e.count})].filter(Boolean):u?s:e.summary&&!e.exploring?[e.summary]:o?s:r?a:i,p=(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{c?.steps&&t?.(NH(e.key)),t?.(e.key)},title:c?.goal,"data-explore-head":c?``:void 0,"data-enso":`tool-row`,"data-notice":e.notice,className:W(`group/step flex min-h-6 w-full items-center gap-2 text-left text-[13px] transition-colors hover:text-foreground`,H5),children:[(0,G.jsx)(K8,{state:e.exploring?`running`:`ok`}),(0,G.jsx)(`span`,{className:W(`shrink-0 text-muted-foreground group-hover/step:text-foreground`,l&&W(U5,`text-foreground`),e.exploring&&`font-medium`),children:d}),(0,G.jsx)(`span`,{className:W(`min-w-0 flex-1 truncate`,l&&U5),children:f.join(` · `)}),(0,G.jsx)(yt,{className:W(`h-3 w-3 shrink-0 transition-transform`,e.expanded&&`rotate-90`)})]});return!c||!e.expanded?p:(0,G.jsxs)(G.Fragment,{children:[p,(0,G.jsxs)(`div`,{"data-slot":`tool-details`,className:`t-acc-reveal mt-1 mb-1.5 ml-5 overflow-hidden rounded-lg border border-border/70 bg-card text-sm shadow-xs`,children:[c.goal&&(0,G.jsxs)(`div`,{className:`border-b border-border/60 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`mb-0.5 text-[11px] text-muted-foreground`,children:n(`Goal`)}),(0,G.jsx)(`p`,{className:`whitespace-pre-wrap`,children:c.goal})]}),c.report&&(0,G.jsxs)(`div`,{className:`border-b border-border/60 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`mb-0.5 text-[11px] text-muted-foreground`,children:n(`Result`)}),(0,G.jsx)(C3,{text:c.report})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t?.(NH(e.key)),className:`flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground`,children:[(0,G.jsx)(yt,{className:W(`h-3 w-3 shrink-0 transition-transform`,c.steps&&`rotate-90`)}),(0,G.jsx)(`span`,{children:c.steps?n(`Hide process`):n(`Show process`)}),(0,G.jsxs)(`span`,{children:[`· `,n(`{{count}} tool calls`,{count:e.count})]})]})]})]})}function n7({children:e,className:t,follow:n}){let r=(0,H.useRef)(null),i=(0,H.useRef)(null),a=(0,H.useRef)(n),o=(0,H.useRef)(n),s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=(0,H.useRef)(0);o.current=n;let u=(0,H.useCallback)(()=>{a.current=!1,s.current=null,cancelAnimationFrame(l.current)},[]),d=(0,H.useCallback)(()=>{!o.current||!a.current||(cancelAnimationFrame(l.current),l.current=requestAnimationFrame(()=>{let e=r.current;if(!e||!o.current||!a.current)return;let t=Math.max(0,e.scrollHeight-e.clientHeight);s.current=t,e.scrollTop=t}))},[]);return(0,H.useEffect)(()=>{n?(a.current=!0,d()):(s.current=null,cancelAnimationFrame(l.current))},[n,d]),(0,H.useEffect)(d),(0,H.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(d);return t.observe(e),()=>t.disconnect()},[d]),(0,H.useEffect)(()=>()=>cancelAnimationFrame(l.current),[]),(0,G.jsx)(`div`,{ref:r,onWheel:e=>{e.deltaY<0&&u()},onPointerDown:e=>{e.target===e.currentTarget&&u()},onTouchStart:e=>{c.current=e.touches[0]?.clientY??null},onTouchMove:e=>{let t=e.touches[0]?.clientY;t!==void 0&&c.current!==null&&t>c.current&&u(),c.current=t??null},onTouchEnd:()=>{c.current=null},onScroll:e=>{if(!o.current)return;let t=e.currentTarget;if(t.scrollHeight-t.scrollTop-t.clientHeight<=2){a.current=!0,s.current=null;return}let n=s.current;if(n!==null&&t.scrollTop>=n-2){s.current=null,d();return}u()},className:W(`max-h-96 overflow-auto [overflow-anchor:none]`,t),children:(0,G.jsx)(`div`,{ref:i,children:e})})}function Nre(e){if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function Pre({source:e,output:t,view:n}){let r=n?.status===`completed`?Nre(n.value):n?.error??t;return(0,G.jsxs)(`div`,{className:`space-y-1 px-3 py-1`,children:[e?(0,G.jsx)(h0,{code:e,language:`javascript`}):null,n&&n.calls.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...new Map(n.calls.map(e=>[e.name,e])).keys()].map(e=>{let t=n.calls.filter(t=>t.name===e),r=t.find(e=>!e.ok),i=`${e} ×${t.length}`;return(0,G.jsx)(`span`,{className:W(`rounded-md border px-1.5 py-0.5 font-mono text-[10px]`,r?`border-destructive/40 text-destructive`:`text-muted-foreground`),title:t.map(e=>e.summary).filter(Boolean).join(`
273
- `),children:r?`${i} · ${r.error??`error`}`:i},e)})}):null,r?n?.status===`completed`&&typeof n.value!=`string`?(0,G.jsx)(h0,{code:r,language:`json`}):(0,G.jsx)(`pre`,{className:`font-mono text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap`,children:i6(r)}):null,n?.console?(0,G.jsx)(`pre`,{className:`border-l-2 pl-2 font-mono text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap`,children:i6(n.console)}):null]})}function r7({path:e,fallback:t}){let[n,r]=(0,H.useState)(!1);return n?t:(0,G.jsx)(`div`,{"data-slot":`read-image`,className:`w-full min-w-0 px-3 py-3`,children:(0,G.jsx)(VG,{src:f(e),onError:()=>r(!0),frameClassName:`block w-full`,className:`mx-auto block max-h-80 max-w-full rounded-md bg-muted/40 object-contain`})})}function Fre({item:e}){let{t}=K(),n=BN(),r=E(e=>e.compactReadOnlyTools),i=E(e=>e.expandLiveEdits),a=r&&e.name!==`bash`&&kH(e),o=!!(e.edits&&e.edits.length>0),s=!!e.writeContent,c=!!(e.fileChanges&&e.fileChanges.length>0),l=e.sandbox??null,u=e.state===`error`?null:e.sentMessage,d=!!e.imagePath&&e.state!==`error`,f=Ms[e.name],p=Ez(e.name),m=e.state!==`error`&&e.todos?.length===0,h=m?t(`Todo list cleared`):e.subagentOp?[t(Ps[e.subagentOp]),e.summary].filter(Boolean).join(` · `):e.summary,g=e.nestedPending&&e.state===`running`?`${h} · ${e.nestedPending} pending`:l?.calls.length&&e.state!==`error`?bV(l.calls):h,_=!m&&!!(e.output||e.source||u||e.ask),v=e.state===`running`&&e.waiting===`subagent`&&!n,y=o||s||c||_||v||d,b=i&&(o||s||d)&&e.state===`running`,[x,S]=(0,H.useState)(b),[C,w]=(0,H.useState)(!1),T=(0,H.useRef)(null),D=Ine();(0,H.useEffect)(()=>{if(!C)return;let t=T.current;if(!t)return;let n=e.key,r=D.report,i=new IntersectionObserver(([e])=>r(n,e?.isIntersecting===!0),{root:D.scroller.current});return i.observe(t),()=>{i.disconnect(),r(n,!1)}},[C,e.key,D]);let O=x&&e.name===`memory_search`?Gz(e.output):null,k=x&&e.name===`memory_capture`?Kz(e.output,e.memoryContent):null,A=x&&e.name===`subagent`&&e.state!==`error`?t5(e.subagentOp,e.output):null,j=e.name===`subagent`&&e.state===`error`?r5(e.output):null,M=(0,H.useRef)(c);return(0,H.useEffect)(()=>{let t=tV(e,M.current);M.current=c,(b||i&&t)&&S(!0)},[b,i,c,e]),e.todos&&e.todos.length>0?(0,G.jsx)(Rre,{todos:e.todos}):e.name.startsWith(`goal_`)?(0,G.jsx)(Ire,{item:e}):e.plan&&e.state!==`error`?(0,G.jsx)(Lre,{plan:e.plan}):(0,G.jsxs)(`div`,{ref:T,"data-enso":`tool-row`,"data-tool-style":a?`compact`:`full`,"data-user-open":C?`true`:void 0,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`button`,{type:`button`,disabled:!y,onClick:()=>{let t=!x;S(t),w(t),D.report(e.key,t)},className:W(`group/step flex min-h-6 min-w-0 flex-1 items-center gap-2 text-left text-[13px]`,H5,y&&`cursor-pointer`),children:[(0,G.jsx)(K8,{state:e.state}),(0,G.jsx)(`span`,{className:W(`shrink-0 text-muted-foreground transition-colors group-hover/step:text-foreground`,e.state===`running`&&W(U5,`text-foreground`)),children:f?t(f):p?.tool??e.name}),(0,G.jsx)(`span`,{className:W(`min-w-0 flex-1 truncate font-mono text-[12px]`,e.state===`error`?`text-destructive`:`text-muted-foreground`,e.state===`running`&&U5),children:e.state===`error`&&e.output?h&&e.name===`apply_patch`&&c?`${g} · ${Gre(e.output)}`:j?t(j):BW(i6(e.output)):h?g:null}),e.backgroundTaskId&&(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,title:e.backgroundTaskId,children:t(`Moved to background`)}),e.shellFailure&&e.state!==`running`&&(0,G.jsx)(H8,{failure:e.shellFailure}),e.dcgWarning&&(0,G.jsx)(U8,{warning:e.dcgWarning}),e.state===`reviewing`?(0,G.jsx)(`span`,{className:W(`shrink-0 text-[11px] text-foreground`,U5),children:t(`Assistant reviewing…`)}):e.state===`running`&&e.startedAt!==null?(0,G.jsxs)(G.Fragment,{children:[e.callId&&(e.name===`bash`||e.name===`powershell`)&&(0,G.jsx)(Wre,{callId:e.callId,startedAt:e.startedAt,output:e.output??``}),(0,G.jsx)(a7,{itemKey:e.key,since:e.startedAt??void 0})]}):(e.agentMeta||e.durationMs!==null)&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums`,children:[e.agentMeta?.modelId,e.agentMeta?.outputTokens?`${e.agentMeta.outputTokens} tok`:null,e.durationMs===null?null:jN(e.durationMs)].filter(Boolean).join(` · `)}),y&&(0,G.jsx)(yt,{className:W(`h-3 w-3 shrink-0 text-muted-foreground opacity-0 transition-[opacity,transform] group-hover/step:opacity-100`,x&&`rotate-90 opacity-100`)})]}),e.state===`running`&&e.callId&&!n&&(0,G.jsx)(zre,{callId:e.callId,waiting:!!e.waiting}),(o||s||c)&&(e.state===`ok`||c)&&(0,G.jsx)(`button`,{type:`button`,title:t(`Open in side panel`),className:`flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:()=>o0(),children:(0,G.jsx)(Xt,{className:`h-3 w-3`})})]}),e.generatedImages?.length?(0,G.jsx)(`div`,{"data-slot":`generated-images`,className:`mt-2 mb-3 ml-5 grid gap-3`,children:e.generatedImages.map(e=>(0,G.jsx)(r7,{path:e,fallback:(0,G.jsx)(`p`,{className:`break-all px-3 py-2 text-xs text-muted-foreground`,children:e})},e))}):null,x&&y&&(0,G.jsxs)(`div`,{"data-slot":`tool-details`,className:`t-acc-reveal mt-1 mb-1.5 ml-5 overflow-hidden rounded-lg border border-border/70 bg-card shadow-xs`,children:[p&&(0,G.jsxs)(`div`,{className:`truncate border-b border-border/60 px-3 py-1 font-mono text-[10px] text-muted-foreground`,children:[p.server,`.`,p.tool]}),v&&(0,G.jsx)(Ure,{agentIds:e.subagentTitles?Object.keys(e.subagentTitles):void 0}),o&&e.edits&&(0,G.jsx)(n7,{follow:e.state===`running`,children:(0,G.jsx)(H.Suspense,{fallback:null,children:(0,G.jsx)(D5,{path:e.summary,blocks:e.edits})})}),c&&e.fileChanges&&(0,G.jsx)(n7,{follow:e.state===`running`,children:e.fileChanges.map((e,n)=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:W(`flex items-center gap-2 border-border/60 px-3 py-1 font-mono text-[10px] text-muted-foreground`,(n>0||o)&&`border-t`),children:[(0,G.jsx)(`span`,{className:`uppercase`,children:e.type}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.path,children:e.path}),e.truncated&&(0,G.jsx)(`span`,{children:t(`Truncated preview`)})]}),(0,G.jsx)(H.Suspense,{fallback:null,children:(0,G.jsx)(D5,{path:e.path,blocks:[e],snapshot:e})})]},`${e.type}:${t6(e.path,e.oldText,e.newText)}`))}),rV(e)&&(0,G.jsx)(n7,{follow:!1,className:`border-t border-border/60`,children:(0,G.jsx)(`pre`,{className:`px-3 py-2 font-mono text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap`,children:i6(e.output??``)})}),s&&e.writeContent&&(0,G.jsx)(n7,{follow:e.state===`running`,className:W((o||c)&&`border-t border-border/60`),children:(0,G.jsx)(H.Suspense,{fallback:null,children:(0,G.jsx)(O5,{path:e.summary,contents:e.writeContent})})}),!o&&!s&&!c&&(_||d)&&(0,G.jsxs)(n7,{follow:e.state===`running`,children:[xV(e.name)?(0,G.jsx)(Pre,{source:e.source,output:e.output,view:l}):e.name===`bash`||e.name===`powershell`?(0,G.jsx)(o5,{command:e.summary,output:e.output??``,failure:e.shellFailure}):e.name===`read`&&d&&e.imagePath?(0,G.jsx)(r7,{path:e.imagePath,fallback:(0,G.jsx)(H.Suspense,{fallback:null,children:(0,G.jsx)(O5,{path:e.summary,contents:e.output??``})})},e.imagePath):e.name===`image_view`&&e.state===`ok`?(0,G.jsx)(p5,{image:e.image,output:e.output}):e.name===`read`?(0,G.jsx)(H.Suspense,{fallback:null,children:(0,G.jsx)(O5,{path:e.summary,contents:e.output??``})}):e.name===`subagent`&&e.state!==`error`&&!u&&!A?(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm`,children:(0,G.jsx)(C3,{text:e.output??``})}):O?(0,G.jsx)($6,{hits:O}):k?(0,G.jsx)(e8,{view:k}):(0,G.jsxs)(G.Fragment,{children:[e.ask&&(0,G.jsx)(j6,{ask:e.ask,waiting:e.state===`running`}),u&&(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm`,children:(0,G.jsx)(C3,{text:u})}),A?(0,G.jsx)(J8,{view:A,titles:e.subagentTitles}):e.output&&(0,G.jsx)(`pre`,{className:`px-3 py-2 font-mono text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap`,children:i6(e.output)})]}),(0,G.jsx)(k8,{value:e.rtk}),(0,G.jsx)(A6,{value:e.approvalReview})]})]})]})}function Ire({item:e}){let{t}=K(),n=e.name.replace(`goal_`,``),r=t(n===`complete`?`Goal completed`:n===`blocked`?`Goal blocked`:`Goal waiting`);return(0,G.jsxs)(`div`,{className:W(`flex items-start gap-2 rounded-lg border px-3 py-2 text-sm`,n===`complete`&&`border-green-500/50 bg-green-500/5`,n===`blocked`&&`border-destructive/50 bg-destructive/5`,n===`wait`&&`border-amber-500/50 bg-amber-500/5`),children:[(0,G.jsx)(Xn,{className:W(`mt-0.5 h-4 w-4 shrink-0`,n===`complete`&&`text-green-600 dark:text-green-500`,n===`blocked`&&`text-destructive`,n===`wait`&&`text-amber-500`)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`font-medium`,children:r}),e.summary&&(0,G.jsx)(`p`,{className:`mt-0.5 whitespace-pre-wrap text-muted-foreground text-xs`,children:e.summary})]})]})}function Lre({plan:e}){let{t}=K(),[n,r]=(0,H.useState)(!1);return(0,G.jsxs)(`div`,{className:`rounded-lg border border-border/60 bg-muted/30 px-3 py-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex w-full min-w-0 items-center gap-2 text-left text-xs`,children:[(0,G.jsx)(jt,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`shrink-0 font-medium text-muted-foreground`,children:t(`Plan`)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,G.jsx)(yt,{className:W(`h-3 w-3 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)})]}),n&&(0,G.jsx)(`div`,{className:`mt-2 border-border/60 border-t pt-2 text-sm`,children:(0,G.jsx)(C3,{text:e.text})})]})}function Rre({todos:e}){let{t}=K(),n=e.filter(e=>e.status===`completed`).length;return(0,G.jsxs)(`div`,{"data-enso":`todo`,className:`rounded-lg border bg-card px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(on,{className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:t(`Todos`)}),(0,G.jsxs)(`span`,{className:`ml-auto tabular-nums`,children:[n,`/`,e.length]})]}),(0,G.jsx)(l5,{done:n,total:e.length,className:`mt-1.5 mb-2`}),(0,G.jsx)(c5,{todos:e})]})}var i7=new Map;function zre({callId:e,waiting:t}){let{t:n}=K(),r=aP(e=>K5(e)?.id??``),[i,a]=(0,H.useState)(!1);if((0,H.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>a(!1),5e3);return()=>clearTimeout(e)},[i]),!r)return null;let o=n(t?i?`Stopping wait…`:`Stop waiting`:i?`Moving to background…`:`Move to background`);return(0,G.jsxs)(`button`,{type:`button`,disabled:i,title:o,className:`flex h-6 shrink-0 items-center gap-1 rounded-md px-1.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-60`,onClick:()=>{a(!0),window.electronAPI.agent.backgroundTool(r,e).then(e=>{e.ok||a(!1)},()=>a(!1))},children:[(0,G.jsx)(t?Bn:ot,{className:`h-3 w-3`}),o]})}var Bre=5e3,Vre=[];function Hre(e,t){if(e.status===`queued`)return t(`Queued`);let n=e.activity;return n?.phase===`tool`?[n.tool,n.detail].filter(Boolean).join(` `):n?.phase===`writing`?t(`Writing reply…`):t(`Thinking…`)}function Ure({agentIds:e}){let{t}=K(),n=aP(e=>K5(e)?.id??``),r=g6(e=>e.byConversation[n]??Vre),[i,a]=(0,H.useState)(!1);if((0,H.useEffect)(()=>{if(!n)return;let e=!0,t=t=>{e&&(g6.getState().replace(n,t),a(!0))},r=()=>window.electronAPI.agent.subagentProgress(n).then(t,()=>{}),i=window.electronAPI.agent.onSubagentProgress(e=>{e.sessionId===n&&t(e.runs)});r();let o=setInterval(r,Bre);return()=>{e=!1,clearInterval(o),i()}},[n]),!i)return null;let o=e?.length?r.filter(t=>e.includes(t.agentId)):r;return(0,G.jsxs)(`div`,{className:`border-b border-border/60 px-3 py-2 text-xs`,children:[o.length===0?(0,G.jsx)(`div`,{className:`text-muted-foreground`,children:t(`No running subagents`)}):o.map(e=>(0,G.jsxs)(`div`,{className:`py-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate font-medium`,children:e.title??e.agentId.slice(0,8)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-muted-foreground`,children:Hre(e,t)}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums`,children:jN(e.elapsedMs)})]}),e.text&&(0,G.jsx)(`div`,{className:`line-clamp-2 break-words pl-2 text-[11px] text-muted-foreground/80`,children:e.text.replace(/\s+/g,` `)})]},e.runId)),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/80`,children:t(`Stopping the wait does not stop subagents; the assistant is notified when they finish.`)})]})}function a7({itemKey:e,since:t}){let n=BN(),r=aP(e=>K5(e)?.id??``),i=n?n.sessionId??``:r,a=(0,H.useRef)(null);if(a.current===null){let n=`${i}:${e}`;a.current=t??i7.get(n)??Date.now(),t===void 0&&i7.set(n,a.current)}let o=t??a.current,[,s]=(0,H.useState)(0);return(0,H.useEffect)(()=>{let e=setInterval(()=>s(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums`,children:jN(Date.now()-o)})}function Wre({callId:e,startedAt:t,output:n}){let r=BN(),i=aP(t=>r?void 0:K5(t)?.toolDeadlineAt?.[e]);return(0,G.jsx)(B8,{startedAt:t,deadlineAt:i,output:n})}function o7(e){return e.kind===`tool-group`||e.kind===`tool`&&!e.todos?.length&&!e.name.startsWith(`goal_`)}var Gre=e=>i6(e.split(`
274
- `,1)[0]??``);function Kre(e,t,n,r,i=100){if(r||!n)return{hiddenSince:t,delayMs:null};let a=t??e;return{hiddenSince:a,delayMs:Math.max(0,i-(e-a))}}var qre=1e6;function Jre(e,t,n=qre){if(t.length===0)return{anchor:null,firstItemIndex:n,remount:!1};if(!e)return{anchor:{keys:t,index:n},firstItemIndex:n,remount:!1};let r=new Map(t.map((e,t)=>[e,t]));for(let n=0;n<e.keys.length;n++){let i=r.get(e.keys[n]);if(i===void 0)continue;let a=e.index+n-i;return{anchor:{keys:t,index:a},firstItemIndex:a,remount:!1}}return{anchor:{keys:t,index:n},firstItemIndex:n,remount:!0}}function s7(e,t){return t}var Yre=new Set([`text`,`thinking`,`tool`,`tool-group`]);function Xre(e,t,n,r){let i=(0,H.useRef)(zH),[a,o]=(0,H.useState)(()=>Date.now()),s=r.compact,c=r.autoCollapseCompletedTurns,l=r.collapseCompletedActivity===!0,u=r.collapseLiveActivity===!0,d={compact:s,autoCollapseCompletedTurns:c,turnOverrides:r.turnOverrides},f=u?WH(e,t,r,i.current,a):null;i.current=f?.witness??zH;let p=f?.wakeAt??null,m=tU(e,t,n,{...d,collapseCompletedActivity:l,collapseLiveActivity:u,releasedLiveActivity:f?.released,heldOpenTools:r.heldOpenTools,foldToolOnlyTurns:r.foldToolOnlyTurns===!0,readableToolCards:r.readableToolCards===!0});return(0,H.useEffect)(()=>{if(p===null||p<=a)return;let e=window.setTimeout(()=>o(p),p-a);return()=>window.clearTimeout(e)},[p,a]),m}var Zre=[{icon:Pt,title:`Map the project`,hint:`Entry points, modules and key dependencies`,prompt:`Walk me through this project's structure: entry points, module layout and key dependencies.`},{icon:ht,title:`Find potential issues`,hint:`Suspicious logic and unhandled edge cases`,prompt:`Review this project for potential bugs, suspicious logic and unhandled edge cases, and list them by severity.`},{icon:Wt,title:`Add unit tests`,hint:`Cover the core modules with tests`,prompt:`Find the core modules that lack tests and add unit tests for them.`},{icon:Mn,title:`Summarize recent changes`,hint:`A digest based on git log`,prompt:`Summarize the recent changes in this repository based on git log.`}];function Qre({onPick:e}){let{t}=K();return(0,G.jsx)(`div`,{className:`mx-auto grid w-full max-w-[560px] grid-cols-1 gap-2.5 text-left @min-[36rem]:grid-cols-2`,children:Zre.map(({icon:n,title:r,hint:i,prompt:a})=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>e(t(a)),"data-slot":`welcome-suggestion`,className:`group flex items-start gap-3 rounded-xl border bg-card px-3.5 py-3 text-left shadow-xs transition-[border-color,box-shadow,transform] duration-200 hover:-translate-y-px hover:border-brand/25 hover:shadow-float`,children:[(0,G.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-lg bg-brand/8 text-brand dark:bg-brand/14`,children:(0,G.jsx)(n,{className:`size-3.5`})}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:`block text-[13px] font-medium`,children:t(r)}),(0,G.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t(i)})]})]},r))})}var c7=`enso-chat-col mx-auto w-full max-w-2xl px-4 @min-[56rem]:max-w-3xl @min-[72rem]:max-w-4xl @min-[84rem]:max-w-5xl @min-[96rem]:max-w-6xl @min-[112rem]:max-w-7xl`,l7=1e3;function u7({className:e,children:t}){let[n,r]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{let e=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(e)},[]),(0,G.jsx)(`div`,{className:W(`t-stagger`,n&&`is-shown`,e),children:t})}var d7=40,$re={index:`LAST`,align:`end`},eie={top:600,bottom:600},tie=e=>e&&!ez()?`auto`:!1,nie={owners:new Map,ends:new Map};function rie(e){let t=new Map,n=new Map,r=null,i=null,a=()=>{r&&i&&n.set(i,r)};for(let n of e)n.kind===`user`?(a(),r=!n.collapsed&&n.canCollapse===!0?n.key:null,i=null,r&&t.set(n.key,r)):r&&(t.set(n.key,r),i=n.key);return a(),{owners:t,ends:n}}var iie=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`;function aie({style:e,...t}){let n=e?.visibility===`hidden`,[r,i]=(0,H.useState)(!1),a=(0,H.useRef)(null);return(0,H.useEffect)(()=>{let e=Kre(Date.now(),a.current,n,r);if(a.current=e.hiddenSince,e.delayMs===null)return;let t=window.setTimeout(()=>i(!0),e.delayMs);return()=>window.clearTimeout(t)},[n,r]),(0,G.jsx)(`div`,{...t,style:n&&r?{...e,visibility:`visible`}:e})}function oie({ref:e,items:t,busy:n,loading:r=!1,running:i,runStartedAt:a,lastOutputAt:o,error:s,emptyTitle:c,emptyDescription:l,onSuggestion:u,onRetryResume:d,onRetrySync:f,virtualize:p=!0,onStartReached:m,historyLoading:h=!1,hasOlder:g,olderCursor:_,searchQuery:v=``,activeHit:y=null,secretarySession:b=!1,secretaryFace:x,quotable:S=!1}){let{t:C}=K(),w=BN(),T=QR(),D=b?x??T:null,O=!w&&D?D:null,k=b,A=(0,H.useRef)(null),[j,M]=(0,H.useState)(!0),[N,P]=(0,H.useState)(!1),F=(0,H.useRef)(!0),I=(0,H.useRef)(null),ee=(0,H.useRef)(null),L=(0,H.useRef)(0),te=(0,H.useRef)(0),R=(0,H.useRef)(null),z=(0,H.useRef)(!1),B=(0,H.useRef)(!1),ne=(0,H.useRef)(0),V=(0,H.useRef)(!1),[re,ie]=(0,H.useState)(null),ae=(0,H.useRef)(0),oe=(0,H.useCallback)(e=>{cancelAnimationFrame(ae.current),ae.current=requestAnimationFrame(()=>ie(e()))},[]);(0,H.useEffect)(()=>()=>cancelAnimationFrame(ae.current),[]);let[se,ce]=(0,H.useState)(new Set),le=(0,H.useRef)(new Set),[ue,de]=(0,H.useState)(()=>new Set),fe=(0,H.useCallback)((e,t)=>{let n=le.current;t!==n.has(e)&&(t?n.add(e):n.delete(e),de(new Set(n)))},[]),pe=(0,H.useRef)({report:fe,scroller:I});pe.current.report=fe;let me=(0,H.useCallback)(e=>{ce(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[he,ge]=(0,H.useState)(new Map),_e=E(e=>e.autoCollapseTurns),ve=E(e=>e.collapseCompletedActivity),ye=E(e=>e.collapseLiveActivity),be=E(e=>e.liveActivityFoldDelaySec),xe=E(e=>e.compactReadOnlyTools),Se=Xre(t,i,se,{compact:xe,autoCollapseCompletedTurns:_e,collapseCompletedActivity:ve,collapseLiveActivity:ye,liveActivityFoldDelaySec:be,heldOpenTools:ue,turnOverrides:he,foldToolOnlyTurns:!w&&k,readableToolCards:k}),Ce=(0,H.useRef)({state:nU,collapse:new Map,reveal:new Map}),we=(0,H.useMemo)(()=>{let e=Ce.current,t=e=>I.current?.querySelector(`[data-nav-key="${CSS.escape(e)}"]`),n=rU(e.state,Se,(e,n)=>{let r=t(e)?.getBoundingClientRect().top,i=t(n)?.getBoundingClientRect().bottom;return r===void 0||i===void 0?0:i-r}),r=Date.now();e.state=n.next;for(let{key:t,...i}of n.collapses)e.collapse.set(t,{at:r,...i});for(let t of n.expands)e.reveal.set(t,r);return n.children},[Se]),Te=(0,H.useRef)(null),Ee=(0,H.useRef)(0),De=(0,H.useRef)(null),Oe=Jre(Te.current,Se.map(e=>e.key));Te.current=Oe.anchor,Oe.remount&&(Ee.current+=1,De.current=null);let ke=Oe.firstItemIndex,Ae=(0,H.useCallback)((e,t)=>{ge(n=>n.get(e)===t?n:new Map(n).set(e,t))},[]),je=(0,H.useMemo)(()=>_e?rie(Se):nie,[_e,Se]),Me=(0,H.useRef)(null),Ne=(0,H.useMemo)(()=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(r.kind!==`user`)continue;let i=``;for(let e=n+1;e<t.length;e++){let n=t[e];if(n.kind===`user`)break;if(n.kind===`text`){i=n.text;break}}e.push({key:r.key,question:hk(r.text)||`[image]`,answer:i})}return e},[t]),Pe=(0,H.useCallback)(()=>{let e=I.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight>2&&(z.current=!0,e.scrollTop=e.scrollHeight)},[]),Fe=(0,H.useCallback)(()=>{cancelAnimationFrame(L.current);let e=Date.now()+1200,t=null,n=()=>{cancelAnimationFrame(L.current),z.current=!1,t?.removeEventListener(`touchstart`,n),t?.removeEventListener(`wheel`,n)},r=()=>{if(B.current){n();return}!t&&I.current&&(t=I.current,t.addEventListener(`touchstart`,n,{passive:!0,once:!0}),t.addEventListener(`wheel`,n,{passive:!0,once:!0})),Pe(),F.current=!0,M(!0),Date.now()<e?L.current=requestAnimationFrame(r):n()};r(),M(!0),F.current=!0},[Pe]);(0,H.useEffect)(()=>()=>{cancelAnimationFrame(L.current),cancelAnimationFrame(te.current),window.clearTimeout(ne.current)},[]),(0,H.useEffect)(()=>$R.subscribe(({active:e},t)=>{if(e===t.active)return;if(e){cancelAnimationFrame(L.current),cancelAnimationFrame(te.current),z.current=!1;return}let n=V.current;V.current=!1,n&&F.current&&!B.current&&Pe()}),[Pe]);let Ie=()=>{B.current=!0,window.clearTimeout(ne.current)},Le=()=>{window.clearTimeout(ne.current),ne.current=window.setTimeout(()=>{B.current=!1},400)},Re=()=>{Ie(),Le()},ze=()=>[...I.current?.querySelectorAll(`[data-nav-key]`)??[]],Be=e=>{Re(),Me.current=e,Ae(e,!0)},Ve=e=>{if(e.key!==`Escape`||e.defaultPrevented||je.owners.size===0)return;let t=I.current,n=e.target;if(!t?.contains(n)||n.closest?.(iie)||OE()||document.querySelector(`[role="dialog"], [role="alertdialog"]`))return;let r=t.getBoundingClientRect();for(let t of ze()){let n=je.owners.get(t.getAttribute(`data-nav-key`)??``);if(!n)continue;let i=t.getBoundingClientRect();if(i.bottom<=r.top||i.top>=r.bottom)continue;let a=e.nativeEvent;window.addEventListener(`keydown`,e=>{e!==a||e.defaultPrevented||(e.preventDefault(),Be(n))},{once:!0});return}},He=()=>{cancelAnimationFrame(L.current),cancelAnimationFrame(te.current),z.current=!1,F.current=!1,M(!1)},Ue=(0,H.useCallback)(e=>{if(R.current?.disconnect(),R.current=null,!e)return;let t=new ResizeObserver(()=>{if(!F.current&&!z.current)return;cancelAnimationFrame(te.current);let e=8,t=()=>{Pe();let n=I.current;(n?n.scrollHeight-n.scrollTop-n.clientHeight:0)<=2||(--e>0?te.current=requestAnimationFrame(t):Fe())};t()});t.observe(e),R.current=t,Fe()},[Pe,Fe]);(0,H.useEffect)(()=>()=>R.current?.disconnect(),[]);let We=e=>Se.findIndex(t=>t.key===e||t.kind===`tool-group`&&f7(t,e)),Ge=e=>{if(!p){I.current?.querySelector(`[data-nav-key="${CSS.escape(e)}"]`)?.scrollIntoView({block:`center`});return}let t=We(e);t>=0&&A.current?.scrollToIndex({index:s7(ke,t),align:`center`})},Ke=(0,H.useRef)(null),qe=e=>{if(He(),We(e)>=0){Ke.current=null,Ge(e);return}let n=null,r=!1;for(let i of t)if(i.kind===`user`&&(n=i.key),i.key===e){r=!0;break}!r||!n||(Ke.current=e,Ae(n,!1))};(0,H.useLayoutEffect)(()=>{let e=Ke.current;!e||We(e)<0||(Ke.current=null,Ge(e))},[Se]),(0,H.useLayoutEffect)(()=>{let e=Me.current;if(!e)return;Me.current=null;let t=ze().find(t=>t.getAttribute(`data-nav-key`)===e);if(t){t7(t,I.current);return}let n=Se.findIndex(t=>t.key===e);p&&n>=0&&A.current?.scrollToIndex({index:s7(ke,n),align:`start`})},[Se]),(0,H.useImperativeHandle)(e,()=>({scrollToBottom:Fe,pinToBottom:Pe,isAtBottom:()=>F.current,getScroller:()=>p?null:I.current,scrollToKey:qe}));let Je=(0,H.useRef)(!1),Ye=`${_}:${ke}`,Xe=(0,H.useRef)(Ye);Xe.current!==Ye&&(Xe.current=Ye,Je.current=!1);let Ze=()=>{!m||Je.current||(Je.current=!0,m())};(0,H.useEffect)(()=>{p&&!h&&De.current===ke&&Ze()},[_,h]);let Qe=(0,H.useMemo)(()=>({query:v,activeKey:y?.key??``,activeNth:y?.nth??-1}),[v,y?.key,y?.nth]),$e=(e,t)=>{let n=Se[t+1];if(n!==void 0&&o7(e)&&o7(n))return`pb-0`;if(!xe)return`pb-4`;let r=n!==void 0&&V5(n);return V5(e)?r?`pb-1`:`pb-2`:e.kind===`text`&&r?`pb-1`:`pb-4`},et=(e,t)=>{let n=Se[t-1],r=n?.kind===`user`&&!n.collapsed&&Yre.has(e.kind)?n:void 0,i=Date.now(),a=Ce.current.collapse.get(e.key),o=a&&i-a.at<l7?a:void 0,s=we.get(e.key),c=s&&Ce.current.reveal.get(s.group),l=s&&c!==void 0&&i-c<l7,u=je.ends.get(e.key);return(0,G.jsxs)(`div`,{"data-nav-key":e.key,"data-fold-collapse":o?o.pair?`pair`:`toggle`:void 0,style:o?{"--fold-from":`${o.height}px`}:l?{"--fold-i":s.index}:void 0,className:W(c7,$e(e,t),l&&`t-fold-reveal`,`[overflow-wrap:anywhere]`),children:[r&&(0,G.jsx)(ore,{model:r.replyModel,at:r.replyAt,privacyMask:r.replyPrivacyMask,secretarySession:k,face:D}),(0,G.jsx)(fie,{itemKey:e.key,children:(0,G.jsx)(sre,{item:e,secretarySession:k,onToggleGroup:me,onToggleTurn:Ae})}),u&&(0,G.jsx)(Cre,{turnKey:u,canCollapse:!0,collapsed:!1,onToggleTurn:Be})]},e.key)},tt=(0,H.useRef)(!1);g===!0&&(tt.current=!0);let nt=gV(t.length>0,h,g,tt.current,!p&&N);(0,H.useLayoutEffect)(()=>{if(p){P(!1);return}let e=I.current;P(!!e&&_V(g===!0,h,e.scrollHeight,e.clientHeight))},[p,g,h,ke,Se.length,t.length]);let rt={pageChrome:nt,onLoadMore:nt===`more`?Ze:void 0,busy:n,loading:!!r,since:iU({loading:!!r,runStartedAt:a,lastOutputAt:o}),error:s,onRetryResume:d};return(0,G.jsx)(aU.Provider,{value:Qe,children:(0,G.jsx)(Fne,{value:pe.current,children:(0,G.jsxs)(`div`,{ref:ee,"data-enso":`timeline`,className:`@container relative min-h-24 flex-1`,onWheel:Re,onKeyDown:e=>{Re(),Ve(e)},onTouchStart:e=>{I.current?.contains(e.target)&&Ie()},onTouchEnd:Le,onPointerDown:e=>{e.target===I.current&&(Ie(),window.addEventListener(`pointerup`,Le,{once:!0}))},children:[(0,G.jsx)(hU,{items:Ne,activeKey:re,onJump:qe}),S&&(0,G.jsx)(vU,{containerRef:ee}),t.length===0&&!n?(0,G.jsxs)(u7,{className:`flex h-full flex-col items-center justify-center gap-2 overflow-y-auto px-4 text-center`,children:[(0,G.jsx)(`span`,{className:`t-stagger-line t-stagger-line--1 mb-3`,children:O?(0,G.jsx)(sR,{name:O.name,color:O.color,image:O.image,needsYou:0,running:0,size:`lg`,enso:`secretary-chat-avatar`}):(0,G.jsx)(`span`,{className:`flex size-11 items-center justify-center rounded-[13px] border border-brand/20 bg-brand/8 text-brand dark:bg-brand/14`,children:(0,G.jsx)(VN,{className:`size-6`})})}),(0,G.jsx)(`p`,{className:`t-stagger-line t-stagger-line--1 text-[22px] font-semibold tracking-tight`,children:c}),s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`t-stagger-line t-stagger-line--2 max-w-md text-sm text-destructive whitespace-pre-wrap`,children:C(s)}),d&&(0,G.jsx)(Oa,{size:`sm`,variant:`outline`,onClick:d,children:C(`Retry resume`)})]}):(0,G.jsxs)(G.Fragment,{children:[f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`t-stagger-line t-stagger-line--2 max-w-md text-sm text-muted-foreground`,children:C(`Session is not ready yet — no history to show.`)}),(0,G.jsx)(Oa,{size:`sm`,variant:`outline`,onClick:f,children:C(`Retry sync`)})]}):l===``?null:(0,G.jsx)(`p`,{className:`t-stagger-line t-stagger-line--2 text-sm text-muted-foreground`,children:l??C(`Ask the agent…`)}),u&&(0,G.jsx)(`div`,{className:`t-stagger-line t-stagger-line--3 mt-5 w-full`,children:(0,G.jsx)(Qre,{onPick:u})})]})]}):t.length===0&&s?(0,G.jsxs)(u7,{className:`flex h-full flex-col items-center justify-center gap-2 text-center`,children:[(0,G.jsx)(`p`,{className:`t-stagger-line t-stagger-line--1 max-w-md text-sm text-destructive whitespace-pre-wrap`,children:C(s)}),d&&(0,G.jsx)(Oa,{size:`sm`,variant:`outline`,onClick:d,children:C(`Retry resume`)})]}):t.length===0?(0,G.jsxs)(`div`,{"data-timeline-loading":``,className:`flex h-full flex-col items-center justify-center gap-2.5 text-center`,children:[(0,G.jsx)(cn,{className:`h-5 w-5 animate-spin text-muted-foreground`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:C(`Preparing session…`)})]}):p?(0,G.jsx)(lL,{ref:A,data:Se,defaultItemHeight:80,computeItemKey:(e,t)=>t.key,firstItemIndex:ke,startReached:Ze,followOutput:tie,atBottomThreshold:d7,atBottomStateChange:e=>{if(!e&&F.current&&!B.current){if(ez()){V.current=!0;return}Fe();return}M(e),F.current=e},increaseViewportBy:eie,initialTopMostItemIndex:$re,rangeChanged:({startIndex:e})=>{De.current=e,e>ke+4&&(Je.current=!1),oe(()=>{let t=Math.max(0,e-ke),n=null;for(let e=0;e<=Math.min(t+1,Se.length-1);e++)Se[e]?.kind===`user`&&(n=Se[e].key);return n})},scrollerRef:e=>{I.current=e instanceof HTMLElement?e:null},className:`h-full select-text`,context:rt,components:cie,itemContent:(e,t)=>et(t,e-ke)},Ee.current):(0,G.jsx)(`div`,{ref:e=>{I.current=e},onScroll:e=>{let t=e.currentTarget;if(z.current){z.current=!1,F.current=!0,M(!0);return}if(!B.current){F.current&&Pe();return}let n=t.scrollHeight-t.scrollTop-t.clientHeight<=d7;n!==F.current&&(F.current=n,M(n)),m&&(t.scrollTop<80&&!Je.current?(Je.current=!0,m()):t.scrollTop>240&&(Je.current=!1))},className:`h-full select-text overflow-y-auto [overflow-anchor:none]`,children:(0,G.jsxs)(`div`,{ref:Ue,children:[(0,G.jsx)(p7,{context:rt}),Se.map((e,t)=>et(e,t)),(0,G.jsx)(m7,{context:rt})]})}),!j&&t.length>0&&(0,G.jsxs)(`button`,{type:`button`,onClick:Fe,className:`absolute bottom-4 left-1/2 z-10 inline-flex h-7 -translate-x-1/2 items-center gap-1.5 rounded-full border bg-card px-3 text-xs text-muted-foreground shadow-float transition-colors hover:text-foreground`,children:[(0,G.jsx)(st,{className:`h-3 w-3`}),C(`Scroll to bottom`)]})]})})})}function f7(e,t){return e.children.some(e=>e.key===t||e.kind===`tool-group`&&f7(e,t))}function sie({chrome:e,onLoadMore:t}){let{t:n}=K();return e===`none`?(0,G.jsx)(`div`,{className:`h-6`}):(0,G.jsx)(`div`,{className:W(c7,`flex items-center justify-center gap-2 py-3`),children:e===`loading`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(cn,{className:`h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Loading earlier messages…`)})]}):e===`more`?(0,G.jsx)(`button`,{type:`button`,className:`text-xs text-muted-foreground underline-offset-2 hover:underline`,onClick:t,children:n(`Load earlier messages`)}):(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Beginning of conversation`)})})}function p7({context:e}){return(0,G.jsx)(sie,{chrome:e.pageChrome,onLoadMore:e.onLoadMore})}function m7({context:e}){let{t}=K(),{busy:n,loading:r,since:i,error:a,onRetryResume:o}=e;return(0,G.jsxs)(`div`,{className:W(c7,`pb-6 [overflow-wrap:anywhere]`),children:[n&&(0,G.jsxs)(`div`,{className:`flex min-h-[26px] items-center gap-2 text-[13px]`,children:[(0,G.jsx)(lie,{}),(0,G.jsx)(`span`,{className:`animate-pulse text-foreground motion-reduce:animate-none`,children:t(r?`Loading…`:`Working…`)}),i!==void 0&&(0,G.jsx)(die,{since:i})]}),a&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-sm text-destructive whitespace-pre-wrap`,children:t(a)}),(0,G.jsx)(J5,{}),o&&(0,G.jsx)(Oa,{size:`sm`,variant:`outline`,onClick:o,children:t(`Retry resume`)})]})]})}var cie={List:aie,Header:p7,Footer:m7};function lie(){return(0,G.jsxs)(`span`,{className:`relative flex size-[22px] shrink-0 items-center justify-center`,children:[(0,G.jsx)(`span`,{className:`absolute size-2 animate-ping rounded-full bg-brand/50`}),(0,G.jsx)(`span`,{className:`relative size-2 rounded-full bg-brand`})]})}var uie=e=>{let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60}s`},die=(0,H.memo)(function({since:e}){let[,t]=(0,H.useState)(0);return(0,H.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,G.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground tabular-nums`,children:uie(Date.now()-e)})}),fie=class extends H.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidUpdate(e){e.itemKey!==this.props.itemKey&&this.state.failed&&this.setState({failed:!1})}render(){return this.state.failed?(0,G.jsxs)(`p`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-1.5 text-xs text-destructive`,children:[`message render failed · `,this.props.itemKey]}):this.props.children}};function pie({retry:e,onCancel:t}){let{t:n}=K(),[r,i]=(0,H.useState)(()=>Date.now());(0,H.useEffect)(()=>{let e=setInterval(()=>i(Date.now()),500);return()=>clearInterval(e)},[]);let a=Math.max(0,Math.ceil((e.at+e.delayMs-r)/1e3));return(0,G.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-2.5 py-1.5 text-xs`,children:[(0,G.jsx)(jn,{className:`h-3.5 w-3.5 shrink-0 animate-spin text-amber-500 [animation-duration:2s]`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.error,children:[e.maxAttempts>0?n(`Auto-retrying ({{attempt}}/{{max}})`,{attempt:e.attempt,max:e.maxAttempts}):n(`Auto-retrying ({{attempt}})`,{attempt:e.attempt}),(0,G.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,a>0?n(`retrying in {{seconds}}s`,{seconds:a}):n(`retrying…`),` — `,e.error]})]}),t&&(0,G.jsx)(`button`,{type:`button`,title:n(`Cancel auto-retry`),onClick:t,className:`shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground`,children:(0,G.jsx)(ir,{className:`h-3.5 w-3.5`})})]})}function h7(e){return e.status===`running`?e.idle?`idle`:e.keep?`kept`:`running`:e.status}function g7(e,t){let n=Math.max(0,Math.floor(e/6e4));if(n<60)return t(`{{n}} min`,{n});let r=Math.floor(n/60),i=n%60;return i===0?t(`{{n}} h`,{n:r}):t(`{{h}} h {{m}} min`,{h:r,m:i})}function mie(e){let t=Math.max(0,Math.floor(e/6e4));return t<60?`${t}m`:`${Math.floor(t/60)}h ${String(t%60).padStart(2,`0`)}m`}function _7(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function v7(e=3e4){let[t,n]=(0,H.useState)(()=>Date.now());return(0,H.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var y7={ok:`bg-success/15 text-success`,pending:`bg-warning/15 text-warning`,neutral:`bg-muted text-muted-foreground`};function b7({tone:e,children:t,className:n}){return(0,G.jsx)(`span`,{className:W(`shrink-0 rounded px-1 py-px text-[10px]`,y7[e],n),children:t})}function x7(e,t,n){return n(`Idle {{duration}}`,{duration:g7(t-(e.idle?.since??t),n)})}function hie({task:e,now:t}){let{t:n}=K(),r=h7(e);return r===`idle`?(0,G.jsx)(b7,{tone:`pending`,children:x7(e,t,n)}):r===`kept`?(0,G.jsx)(b7,{tone:`neutral`,children:n(`Kept`)}):r===`running`?(0,G.jsx)(b7,{tone:`ok`,children:n(`Running`)}):e.interrupted===`restart`?(0,G.jsx)(b7,{tone:`pending`,children:n(`Interrupted by restart`)}):null}function gie({task:e}){return h7(e)===`idle`?(0,G.jsx)(`span`,{className:`relative flex size-[22px] shrink-0 items-center justify-center rounded-full border border-dashed border-warning/60 text-warning`,children:(0,G.jsx)(_n,{className:`size-3`})}):(0,G.jsx)(G8,{icon:qn,state:e.status===`running`?`running`:e.status===`failed`?`error`:`ok`})}function _ie(e,t){let n=e.keep;if(!n)return;let r=n.reason??_7(n.at);return n.by===`user`?t(`Kept by you · {{detail}}`,{detail:r}):t(`Kept: {{reason}}`,{reason:r})}function vie({task:e,className:t}){let{t:n}=K(),r=h7(e)===`kept`?_ie(e,n):void 0;return r?(0,G.jsxs)(`div`,{className:W(`flex min-w-0 items-center gap-1 text-[11px] text-muted-foreground/85`,t),children:[(0,G.jsx)(Tn,{className:`size-3 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,title:r,children:r})]}):null}function S7(e,t){window.electronAPI.agent.stopTask(e,t)}function C7(e,t,n){window.electronAPI.agent.keepTask(e,t,n)}function yie({onStop:e,className:t}){let{t:n}=K();return(0,G.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e()},title:n(`Stop task`),className:W(`flex h-6 shrink-0 items-center rounded-md px-1.5 text-xs text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,t),children:n(`Stop`)})}function w7({sessionId:e,taskId:t}){let{t:n}=K();return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Oa,{size:`xs`,variant:`ghost`,className:`text-muted-foreground`,onClick:n=>{n.stopPropagation(),C7(e,t,``)},children:n(`Keep`)}),(0,G.jsx)(Oa,{size:`xs`,variant:`outline`,className:`hover:text-destructive`,onClick:n=>{n.stopPropagation(),S7(e,t)},children:n(`Stop`)})]})}var bie=[`pattern`,`query`,`path`,`file_path`],xie=[`path`,`file_path`,`query`,`pattern`],Sie=[`command`,`cmd`,`script`],Cie=[`path`,`file_path`,`pattern`,`query`,`command`,`url`,`description`,`summary`],wie=120;function T7(e){let t=e.replace(/\s+/g,` `).trim();return t.length>wie?`${t.slice(0,119)}…`:t}function Tie(e){let t=e.toLowerCase();return t.includes(`search`)||t.includes(`grep`)||t===`find`?bie:t===`read`||t.endsWith(`_read`)?xie:t===`bash`||t.includes(`shell`)||t.includes(`terminal`)?Sie:Cie}function Eie(e,t){let n=t.trim();if(!n)return``;let r;try{r=JSON.parse(n)}catch{return T7(n)}if(r===null)return``;if(typeof r!=`object`||Array.isArray(r))return T7(JSON.stringify(r)??String(r));let i=kz(e,r);if(i.summary!==void 0)return T7(i.summary);if(!i.args||typeof i.args!=`object`)return``;let a=i.args;for(let e of Tie(i.name)){let t=a[e];if(typeof t==`string`&&t.trim())return T7(t)}let o=JSON.stringify(a);return o===`{}`?``:T7(o)}function Die(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=24}var E7=new Map,Oie=e=>{let t=E7.get(e);return t?new Set(t):new Set},D7=(e,t)=>(E7.set(e,t),t),O7=new Map,kie=(e,t)=>{let n=O7.get(e)??new Set;O7.set(e,n);for(let e of t)n.add(e);return n},k7=`enso:task-bar-expanded`,A7=new Map,j7=()=>{try{let e=JSON.parse(window.sessionStorage.getItem(k7)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}},Aie=e=>A7.get(e)??j7().includes(e),jie=(e,t)=>{A7.set(e,t);try{let n=j7().filter(t=>t!==e);window.sessionStorage.setItem(k7,JSON.stringify(t?[...n,e]:n))}catch{}return t};function Mie({sessionId:e,tasks:t,subagents:n,readOnly:r}){let i=E(e=>e.virtualModels),{t:a}=K(),[o,s]=(0,H.useState)(()=>Oie(e)),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(()=>Aie(e)),f=aP(e=>e.pendingAgentOpen);(0,H.useEffect)(()=>{!f||f.sessionId!==e||(l(f.agentId),aP.setState({pendingAgentOpen:null}))},[f,e]);let p=kie(e,[...t.filter(e=>e.status===`running`).map(e=>e.taskId),...n.filter(e=>e.status===`running`).map(e=>e.id)]),m=(e,t)=>!o.has(e)&&(t===`running`||p.has(e)),h=t.filter(e=>m(e.taskId,e.status)),g=n.filter(e=>m(e.id,e.status));if((0,H.useEffect)(()=>{let r=O7.get(e),i=[...t.filter(e=>e.status!==`running`).map(e=>e.taskId),...n.filter(e=>e.status!==`running`).map(e=>e.id)].filter(e=>r?.has(e)&&!o.has(e)&&e!==c);if(i.length===0)return;let a=setTimeout(()=>{s(t=>{let n=new Set(t);for(let e of i)n.add(e);return D7(e,n)})},5e3);return()=>clearTimeout(a)},[e,t,n,o,c]),h.length===0&&g.length===0)return null;let _=t=>{s(n=>D7(e,new Set(n).add(t))),c===t&&l(null)},v=h.find(e=>e.taskId===c)??null,y=g.find(e=>e.id===c)??null,b=h.length>=2;return(0,G.jsxs)(`div`,{className:`relative mb-1.5`,children:[(v||y)&&(0,G.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 z-30 mb-1.5 rounded-xl border bg-card shadow-float`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3 py-1.5 text-xs`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-muted-foreground`,children:[v?v.command:y?.description,y?.modelId?` · ${wj(i,y.modelId)}`:``]}),v&&(0,G.jsx)(Iie,{sessionId:e,task:v,readOnly:r}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>l(null),className:`rounded p-0.5 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(ir,{className:`h-3.5 w-3.5`})})]}),v&&(0,G.jsx)(Lie,{sessionId:e,task:v,readOnly:r}),y&&(0,G.jsx)(Rie,{agent:y},y.id)]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-xl border bg-card p-1 shadow-xs`,children:[b&&(0,G.jsx)(Nie,{sessionId:e,tasks:h,expanded:u,readOnly:r,onToggle:()=>d(jie(e,!u))}),(!b||u)&&h.map(t=>(0,G.jsx)(Fie,{sessionId:e,task:t,readOnly:r,open:c===t.taskId,onToggle:()=>l(c===t.taskId?null:t.taskId),onDismiss:()=>_(t.taskId)},t.taskId)),g.map(t=>(0,G.jsxs)(Pie,{icon:pt,status:t.status,meta:(0,G.jsx)(Uie,{agent:t}),open:c===t.id,onToggle:()=>l(c===t.id?null:t.id),stopTitle:a(`Stop subagent`),onStop:r?void 0:()=>void window.electronAPI.agent.stopSubagent(e,t.id),onDismiss:()=>_(t.id),children:[t.agentType&&(0,G.jsx)(`span`,{className:`shrink-0 font-medium`,children:t.agentType}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:[t.description,t.modelId&&(0,G.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[` `,`· `,wj(i,t.modelId)]}),t.status===`running`&&t.currentActivity&&(0,G.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[` · `,t.currentActivity]})]})]},t.id))]})]})}function Nie({sessionId:e,tasks:t,expanded:n,readOnly:r,onToggle:i}){let{t:a}=K(),o=v7(1e3),[s,c]=(0,H.useState)(!1),l=t.filter(e=>e.status===`running`),u=t.filter(e=>h7(e)===`idle`).length,d=l.reduce((e,t)=>Math.min(e,t.startedAt),o),f=!r&&l.length>0;return(0,H.useEffect)(()=>{f||c(!1)},[f]),(0,G.jsxs)(`div`,{"data-enso":`background-task-summary`,className:`flex min-h-[30px] min-w-0 items-center gap-2 rounded-lg px-1 text-[13px]`,children:[(0,G.jsx)(G8,{icon:qn,state:l.length>0?`running`:`ok`}),s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,children:a(`Stop {{count}} background tasks?`,{count:l.length})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(!1),className:`flex h-6 shrink-0 items-center rounded-md px-1.5 text-xs whitespace-nowrap text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:a(`Cancel`)}),(0,G.jsx)(`button`,{type:`button`,"data-enso":`background-task-stop-all-confirm`,onClick:()=>{for(let t of l)S7(e,t.taskId);c(!1)},className:`flex h-6 shrink-0 items-center rounded-md bg-destructive/10 px-1.5 text-xs whitespace-nowrap text-destructive transition-colors hover:bg-destructive/15`,children:a(`Stop {{count}}`,{count:l.length})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,"data-enso":`background-task-summary-toggle`,onClick:i,"aria-expanded":n,className:`flex h-6 min-w-0 flex-1 items-center gap-1.5 rounded-md text-left text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 truncate`,children:[a(`{{count}} background tasks`,{count:t.length}),l.length>0&&` · ${a(`longest running {{duration}}`,{duration:jN(o-d)})}`]}),u>0&&(0,G.jsx)(b7,{tone:`pending`,className:`whitespace-nowrap`,children:a(`{{count}} suspected idle`,{count:u})}),(0,G.jsx)(vt,{className:W(`h-3 w-3 shrink-0 transition-transform`,n&&`rotate-180`)})]}),f&&(0,G.jsx)(`button`,{type:`button`,"data-enso":`background-task-stop-all`,onClick:()=>c(!0),className:`flex h-6 shrink-0 items-center rounded-md px-1.5 text-xs whitespace-nowrap text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,children:a(`Stop all`)})]})]})}function Pie({icon:e,status:t,meta:n,open:r,onToggle:i,stopTitle:a,onStop:o,onDismiss:s,children:c}){let{t:l}=K();return(0,G.jsxs)(`div`,{className:`flex min-h-[30px] min-w-0 items-center gap-2 px-1 text-[13px]`,children:[(0,G.jsx)(G8,{icon:e,state:t===`running`?`running`:t===`failed`?`error`:`ok`}),c,n,(0,G.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":r,className:`flex h-6 shrink-0 items-center gap-0.5 rounded-md px-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[l(`Output`),(0,G.jsx)(vt,{className:W(`h-3 w-3 transition-transform`,r&&`rotate-180`)})]}),t===`running`?o&&(0,G.jsx)(`button`,{type:`button`,onClick:o,title:a,className:`flex h-6 shrink-0 items-center rounded-md px-1.5 text-xs text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,children:l(`Stop`)}):(0,G.jsx)(`button`,{type:`button`,onClick:s,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,G.jsx)(ir,{className:`h-3 w-3`})})]})}function Fie({sessionId:e,task:t,readOnly:n,open:r,onToggle:i,onDismiss:a}){let{t:o}=K(),s=v7(),c=h7(t);return(0,G.jsxs)(`div`,{"data-enso":`background-task-row`,"data-view":c,className:W(`flex min-h-[30px] min-w-0 items-center gap-2 rounded-lg px-1 text-[13px]`,c===`kept`&&`py-1`,c===`idle`&&`bg-warning/[0.06]`,r&&`bg-muted`),children:[(0,G.jsx)(gie,{task:t}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,title:t.command,children:t.command}),c===`idle`&&(0,G.jsx)(b7,{tone:`pending`,children:x7(t,s,o)})]}),(0,G.jsx)(vie,{task:t,className:`mt-0.5`})]}),(0,G.jsx)(Wie,{task:t}),(0,G.jsxs)(`button`,{type:`button`,onClick:i,"aria-expanded":r,className:W(`flex h-6 shrink-0 items-center gap-0.5 rounded-md px-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,r&&`bg-foreground/[0.06] text-foreground`),children:[o(`Output`),(0,G.jsx)(vt,{className:W(`h-3 w-3 transition-transform`,r&&`rotate-180`)})]}),t.status===`running`?n?null:c===`idle`?(0,G.jsx)(w7,{sessionId:e,taskId:t.taskId}):(0,G.jsx)(yie,{onStop:()=>S7(e,t.taskId)}):(0,G.jsx)(`button`,{type:`button`,onClick:a,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,G.jsx)(ir,{className:`h-3 w-3`})})]})}function Iie({sessionId:e,task:t,readOnly:n}){let{t:r}=K(),i=v7(),a=h7(t);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(hie,{task:t,now:i}),!n&&a===`idle`&&(0,G.jsx)(w7,{sessionId:e,taskId:t.taskId}),!n&&a===`kept`&&(0,G.jsx)(Oa,{size:`xs`,variant:`ghost`,className:`text-muted-foreground`,onClick:()=>C7(e,t.taskId,null),children:r(`Unkeep`)})]})}function M7({icon:e,label:t,value:n}){return(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md bg-muted px-2 py-1.5`,children:[(0,G.jsx)(e,{className:`size-3.5 shrink-0 text-warning`}),(0,G.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t}),(0,G.jsx)(`span`,{className:`ml-auto shrink-0 font-medium tabular-nums`,children:n})]})}function N7({children:e}){return(0,G.jsx)(`div`,{className:`text-[11px] text-subtle-foreground tabular-nums`,children:e})}function Lie({sessionId:e,task:t,readOnly:n}){let{t:r}=K(),i=v7(),a=h7(t),o=mie(i-t.startedAt),s=t.idle?.ports??[],c=a===`idle`||a===`kept`;return(0,G.jsxs)(G.Fragment,{children:[a===`idle`&&(0,G.jsxs)(`div`,{className:`space-y-2.5 px-3 py-2.5 text-xs`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-3 gap-1.5`,children:[(0,G.jsx)(M7,{icon:Mt,label:r(`No new output`),value:g7(i-(t.idle?.since??i),r)}),(0,G.jsx)(M7,{icon:$n,label:s.length>0?r(`Port {{ports}}`,{ports:s.join(`, `)}):r(`Ports`),value:s.length>0?r(`No connections`):r(`Not listening`)}),(0,G.jsx)(M7,{icon:Lt,label:`CPU`,value:`0%`})]}),(0,G.jsx)(N7,{children:r(`Running for {{duration}} · Suspected idle tasks are never stopped automatically`,{duration:o})})]}),a===`kept`&&t.keep&&(0,G.jsxs)(`div`,{className:`space-y-2.5 px-3 py-2.5 text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-muted px-2.5 py-2`,children:[(0,G.jsx)(Tn,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[t.keep.by===`user`&&!n?(0,G.jsx)(`input`,{"data-enso":`background-task-keep-reason`,defaultValue:t.keep.reason??``,maxLength:200,placeholder:r(`Add a reason (optional)`),className:`w-full bg-transparent text-[13px] outline-none placeholder:text-subtle-foreground`,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},onBlur:n=>{let r=n.currentTarget.value.trim();r!==(t.keep?.reason??``)&&C7(e,t.taskId,r)}},t.keep.at):(0,G.jsx)(`div`,{className:`text-[13px]`,children:t.keep.reason??`—`}),(0,G.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:t.keep.by===`agent`?r(`Kept by the agent at {{time}} when wrapping up`,{time:_7(t.keep.at)}):r(`Kept by you at {{time}}`,{time:_7(t.keep.at)})})]})]}),(0,G.jsx)(N7,{children:r(`Running for {{duration}}`,{duration:o})})]}),c&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 border-t border-border/60 px-3 pt-2 text-[11px] text-subtle-foreground`,children:(0,G.jsx)(`span`,{children:r(`Recent output`)})}),(0,G.jsx)(Gie,{tail:t.tail,outputBytes:t.outputBytes,running:t.status===`running`,framed:!c})]})}function Rie({agent:e}){let{t}=K(),n=e.activities??[],r=(0,H.useRef)(null),i=(0,H.useRef)(!0);return(0,H.useEffect)(()=>{let e=r.current;e&&i.current&&(e.scrollTop=e.scrollHeight)},[n,e.resultText]),(0,G.jsxs)(`div`,{ref:r,className:`max-h-96 space-y-2 overflow-auto px-3 py-2 text-sm`,onScroll:e=>{i.current=Die(e.currentTarget)},children:[n.map(e=>(0,G.jsx)(zie,{activity:e},e.id)),n.length===0&&!e.resultText&&(0,G.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap text-muted-foreground`,children:(e.activityLog??[]).join(`
275
- `)||t(`(no output yet)`)}),e.detailsPruned&&(0,G.jsx)(`div`,{className:`rounded-md border border-dashed px-2.5 py-2 text-xs text-muted-foreground`,children:t(`Earlier activity details were cleared; the final report is still available.`)}),e.resultText&&e.status!==`running`&&(0,G.jsxs)(`section`,{className:W(`rounded-lg border px-3 py-2`,e.status===`failed`?`border-destructive/30 bg-destructive/5`:`border-blue-500/30 bg-blue-500/5`),children:[(0,G.jsx)(`div`,{className:`mb-1.5 font-medium text-xs text-foreground`,children:t(`Final report`)}),(0,G.jsx)(C3,{text:e.resultText})]})]})}function zie({activity:e}){let{t}=K(),[n,r]=(0,H.useState)(!1);if(e.type===`assistant`)return(0,G.jsxs)(`section`,{className:`rounded-md bg-muted/30 px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`mb-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase`,children:t(`Assistant`)}),(0,G.jsx)(Hie,{text:e.text,markdown:!0})]});let i=Eie(e.toolName,e.argumentsText),a=kz(e.toolName,e.argumentsText).name,o=Ez(a),s=`subagent-tool-${e.id.replace(/[^A-Za-z0-9_-]/g,`-`)}`;return(0,G.jsxs)(`section`,{className:`border-b border-border/40 last:border-b-0`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-controls":s,"aria-expanded":n,onClick:()=>r(e=>!e),className:`flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1 text-left text-xs transition-colors hover:bg-muted/50`,children:[(0,G.jsx)(Bie,{toolName:a}),(0,G.jsx)(`span`,{className:`shrink-0 font-medium text-foreground/80`,children:o?.tool??a}),i&&(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground`,title:i,children:i}),!i&&(0,G.jsx)(`span`,{className:`min-w-0 flex-1`}),(0,G.jsx)(Vie,{status:e.status,label:t(e.status)}),(0,G.jsx)(yt,{"aria-hidden":`true`,className:W(`h-3 w-3 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)})]}),n&&(0,G.jsxs)(`div`,{id:s,className:`ml-5 border-border/50 border-l pb-2 pl-2.5`,children:[o&&(0,G.jsxs)(`div`,{className:`mb-1 truncate font-mono text-[10px] text-muted-foreground/70`,children:[o.server,`.`,o.tool]}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted-foreground/70`,children:t(`Arguments`)}),(0,G.jsx)(`pre`,{className:`max-h-28 overflow-auto font-mono text-[10px] leading-relaxed whitespace-pre-wrap text-muted-foreground/80`,children:i6(e.argumentsText)}),e.outputText&&(0,G.jsxs)(`div`,{className:`mt-1.5 border-border/40 border-t pt-1.5`,children:[(0,G.jsx)(`div`,{className:`mb-0.5 text-[10px] text-muted-foreground`,children:t(`Result`)}),(0,G.jsx)(`pre`,{className:`overflow-auto font-mono text-[11px] leading-relaxed whitespace-pre-wrap text-foreground/80`,children:i6(e.outputText)})]})]})]})}function Bie({toolName:e}){let t=e.toLowerCase(),n=`h-3.5 w-3.5 shrink-0 text-muted-foreground`;return t.includes(`search`)||t.includes(`grep`)||t===`find`?(0,G.jsx)(Fn,{"aria-hidden":`true`,className:n}):t===`read`||t===`write`||t===`edit`||t===`apply_patch`||t.endsWith(`_read`)?(0,G.jsx)(Ut,{"aria-hidden":`true`,className:n}):t===`bash`||t===`exec`||t===`codemode`||t.includes(`shell`)||t.includes(`terminal`)?(0,G.jsx)(Zn,{"aria-hidden":`true`,className:n}):(0,G.jsx)(rr,{"aria-hidden":`true`,className:n})}function Vie({status:e,label:t}){let n=`h-3.5 w-3.5`;return(0,G.jsx)(`span`,{role:`status`,"aria-label":t,title:t,className:W(`shrink-0`,e===`failed`?`text-destructive`:`text-muted-foreground`),children:e===`running`?(0,G.jsx)(cn,{"aria-hidden":`true`,className:W(n,`animate-spin`)}):e===`done`?(0,G.jsx)(_t,{"aria-hidden":`true`,className:n}):e===`failed`?(0,G.jsx)(Ct,{"aria-hidden":`true`,className:n}):(0,G.jsx)(ut,{"aria-hidden":`true`,className:n})})}function Hie({text:e,label:t,markdown:n=!1}){let{t:r}=K(),i=e.length>800||e.split(`
276
- `).length>16,a=n?(0,G.jsx)(C3,{text:e}):(0,G.jsx)(`pre`,{className:`overflow-x-auto font-mono text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground`,children:i6(e)});return i?(0,G.jsxs)(`details`,{className:`group/details`,children:[(0,G.jsxs)(`summary`,{className:`cursor-pointer text-[10px] text-muted-foreground hover:text-foreground`,children:[t?`${t} · `:``,r(`{{count}} chars`,{count:e.length})]}),(0,G.jsx)(`div`,{className:`mt-1.5`,children:a})]}):(0,G.jsxs)(`div`,{children:[t&&(0,G.jsx)(`div`,{className:`mb-0.5 text-[10px] text-muted-foreground`,children:t}),a]})}function Uie({agent:e}){let[,t]=(0,H.useState)(0);return(0,H.useEffect)(()=>{if(e.status!==`running`)return;let n=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(n)},[e.status]),(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums`,children:[e.steps>0?`${e.steps} steps · `:``,e.outputTokens?`${e.outputTokens} tok · `:``,e.status===`running`?jN(Date.now()-e.startedAt):e.status]})}function Wie({task:e}){let[,t]=(0,H.useState)(0);return(0,H.useEffect)(()=>{if(e.status!==`running`)return;let n=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(n)},[e.status]),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums`,children:e.status===`running`?jN(Date.now()-e.startedAt):e.exitCode===void 0?e.status:`exit ${e.exitCode}`})}function Gie({tail:e,outputBytes:t,running:n,framed:r=!0}){let{t:i}=K(),a=(0,H.useRef)(null);return(0,H.useEffect)(()=>{let e=a.current;e&&(e.scrollTop=e.scrollHeight)},[e]),(0,G.jsx)(`pre`,{ref:a,className:W(`max-h-56 overflow-auto font-mono text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground`,r?`border-t border-border/60 px-2.5 py-2`:`px-3 pt-1 pb-2.5`),children:i6(e)||(t===void 0?i(`Loading…`):t>0?i(`Output written ({{size}}), not loaded yet`,{size:LB(t)}):n?`${i(`(no output yet)`)}\n${i(`The process has not written anything. Without a terminal, some programs buffer output and only write it in blocks or on exit.`)}`:i(`(no output yet)`))})}function Kie(e){return{sessionId:e.sessionId,canRewind:!e.bot&&!e.deviceReadOnly,canRetry:!e.bot&&!e.deviceReadOnly,canFork:!1,...e.bot?{botSession:!0}:{}}}var P7=7e5,qie=1600;async function F7(e,t=P7,n=qie){let r=await createImageBitmap(e),i=Math.min(1,n/Math.max(r.width,r.height)),a=document.createElement(`canvas`);a.width=Math.round(r.width*i),a.height=Math.round(r.height*i);let o=a.getContext(`2d`);if(!o)throw Error(`画布不可用`);o.drawImage(r,0,0,a.width,a.height),r.close();for(let e of[.85,.7,.55,.4]){let n=a.toDataURL(`image/jpeg`,e),r=n.slice(n.indexOf(`,`)+1);if(r.length*.75<=t)return{data:r,mimeType:`image/jpeg`}}throw Error(`图片太大,请换一张更小的图`)}var I7=e=>Math.floor(P7/Math.max(1,e));async function L7(e,t){try{return await F7(e,t)}catch{return F7(e,t,1024)}}async function Jie(e){let t=I7(e.length),n=[];for(let r of e)n.push(await L7(r,t));return n}function Yie(e,t,n,r){let i=e?.find(e=>e.id===n);if(!i)return null;let a=i.text;return{sessionId:t,messageId:n,text:a,...i.hasImages?{hasImages:!0}:{},priorMatches:r.filter(e=>R7(a,e)).length,priorUserCount:r.length}}function R7(e,t){if(t===e)return!0;let n=p6(t);return n!==null&&e.trimStart().startsWith(n)}function Xie(e,t,n){let r=new Set(t.filter(e=>e.sessionId===n).map(e=>e.messageId));return(e??[]).filter(e=>!r.has(e.id))}function Zie(e,t,n){let r=t.filter(e=>e.sessionId===n).map(e=>$ie(e));return r.length===0?[...e]:[...e,...r]}function Qie(e,t,n,r){return e.filter(e=>e.sessionId===t?r?.turnSettled&&n.length>e.priorUserCount?!1:e.text?n.filter(t=>R7(e.text,t)).length<=e.priorMatches:n.length<=e.priorUserCount:!0)}function z7(e){return e.filter(e=>e.role===`user`).map(eae)}function $ie(e){let t=e.text||(e.hasImages?`[image]`:``);return{role:`user`,content:t?[{type:`text`,text:t}]:[]}}function eae(e){return e.content.map(e=>e.type===`text`?e.text:``).join(`
277
- `).trim()}var tae=e=>e===`outbox-discarding`?`正在移除…`:e===`outbox-discard`?`移除未保存,请勿关闭页面;请再次移除,重启后可能重新入队`:e===`outbox-storage`?`无法保存离线消息,请勿关闭页面;可重试或复制消息`:e===`delivery-unconfirmed`?`未收到回执,发送结果未确认;可重试确认`:e===`read-only`?`此设备为只读`:e===`session-busy`?`请等当前回复结束`:e&&Le(`zh`,Ma(e)??e),B7=(e=!1)=>e?`此设备为只读,刚才的操作未执行;可在桌面「设置 → 设备」切换为可操作`:`此设备为只读,只能查看;可在桌面「设置 → 设备」切换为可操作`,nae=70;function rae({percent:e,critical:t}){return(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-1 w-7 shrink-0 overflow-hidden rounded-full bg-muted-foreground/20`,children:(0,G.jsx)(`span`,{className:W(`block h-full rounded-full`,t?`bg-destructive`:e>=nae?`bg-warning`:`bg-muted-foreground/70`),style:{width:`${e}%`}})})}function iae(e,t){let n={inputTokens:0,outputTokens:0,...e};return t&&(n.contextUsed=t.used,t.window!==void 0&&(n.contextWindow=t.window)),n.inputTokens===0&&n.outputTokens===0&&n.cacheHitPercent===void 0&&n.ttftAvgMs===void 0&&n.tokensPerSecond===void 0&&n.contextUsed===void 0?void 0:n}function aae(e,t){let n={tokens:void 0,cache:void 0,context:void 0,speed:void 0};if(!t)return n;if(t.contextUsed!==void 0){let e=t.contextUsed,r=t.contextWindow??0;if(r>0){let t=Math.min(100,Math.round(e/r*100));n.context={compact:`${t}%`,full:`${AN(r)} · ${t}%`,percent:t,critical:t>=90}}else n.context={compact:`${AN(e)}·?`,full:`${AN(e)} · ?`}}let r=[],i=[];return t.ttftAvgMs!==void 0&&(r.push(jN(t.ttftAvgMs)),i.push(e(`First token avg {{duration}}`,{duration:jN(t.ttftAvgMs)}))),t.tokensPerSecond!==void 0&&(r.push(`${t.tokensPerSecond} tok/s`),i.push(e(`{{speed}} tok/s`,{speed:t.tokensPerSecond}))),r.length>0&&(n.speed={compact:r.join(` · `),full:i.join(` · `)}),(t.inputTokens>0||t.outputTokens>0)&&(n.tokens={compact:`↑${AN(t.inputTokens)} ↓${AN(t.outputTokens)}`,full:e(`Input {{input}} tok · Output {{output}} tok`,{input:AN(t.inputTokens),output:AN(t.outputTokens)})}),t.cacheHitPercent!==void 0&&(n.cache={compact:`${t.cacheHitPercent}%`,full:e(`Cache hit {{percent}}%`,{percent:t.cacheHitPercent})}),n}var oae=[[`tokens`,Nt],[`cache`,Rt],[`context`,Jt],[`speed`,ar]];function sae({usageTotals:e,context:t}){let{t:n}=K(),r=aae(n,iae(e,t));return(0,G.jsx)(`div`,{"data-slot":`stats-line`,className:`flex min-h-6 flex-wrap items-center justify-center gap-x-3 px-1`,children:oae.map(([e,t])=>{let n=r[e];return n?(0,G.jsxs)(`span`,{className:W(`flex items-center gap-1 text-[11px] tabular-nums`,n.critical?`text-destructive`:`text-muted-foreground/80`),children:[n.percent===void 0?(0,G.jsx)(t,{className:`h-3 w-3 shrink-0 opacity-75`}):(0,G.jsx)(rae,{percent:n.percent,critical:!!n.critical}),n.compact]},e):null})})}function V7(e){let{view:t,sessionId:n}=e,r=(0,H.useRef)(null),[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null),s=(0,H.useRef)(null),c=(0,H.useRef)(!1);(0,H.useLayoutEffect)(()=>{let e=o.current,t=s.current,n=e?.querySelector(`[aria-selected="true"]`);!e||!t||!n||(c.current||(t.style.transition=`none`),t.style.transform=`translate(${n.offsetLeft}px, ${n.offsetTop}px)`,t.style.width=`${n.offsetWidth}px`,t.style.height=`${n.offsetHeight}px`,c.current||=(t.offsetWidth,t.style.transition=``,!0))},[n,e.tabGroup]);let l=t?.status===`running`,u=e.bot,d=!!(u?.readOnly||e.deviceReadOnly),f=e.artifacts?.chatId,p=e.artifacts?.conversationId,m=(0,H.useMemo)(()=>({...Kie({sessionId:n,bot:u,deviceReadOnly:e.deviceReadOnly}),...f&&p?{turnFooter:e=>(0,G.jsx)(Xa,{target:{chatId:f,conversationId:p,messageIndex:e}})}:{}}),[n,u,e.deviceReadOnly,f,p]),h=(0,H.useMemo)(()=>{if(u)return[];let t=[{name:`/goal`,description:`Set a session goal (/goal <objective> · pause · resume · clear)`},{name:`/compact`,description:`Compact the context now (/compact [summary focus])`}],n=(e.slashCommands??[]).filter(e=>e.name!==`/goal`&&e.name!==`/compact`);return[...t,...n]},[e.slashCommands,u]),g=(0,H.useMemo)(()=>t?[...t.messages.entries()].sort((e,t)=>e[0]-t[0]):[],[t]),_=(0,H.useMemo)(()=>Zie(g.map(([,e])=>e),e.echoes??[],n??``),[g,e.echoes,n]),v=_.length>0||t?.status===`running`||t?.status===`failed`;iP(n?{id:n,projectId:``,status:t?.status??`idle`,started:v,spawning:!1,messages:_,queuedMessages:e.queued?.map(e=>({id:e.id,text:e.text}))}:null);let y=(0,H.useMemo)(()=>yH(_,l,[],e.cwd,{pendingApprovals:t?.approvals,compaction:t?.compaction,compactionNoticeAt:B(g.map(([e])=>e),t?.compactionNoticeAt)}),[_,g,l,e.cwd,t?.approvals,t?.compaction,t?.compactionNoticeAt]),b=t?.messages.size?Math.min(...t.messages.keys()):null,x=(0,H.useRef)(null),S=(0,H.useCallback)(()=>{if(!e.hasOlder||!e.onLoadOlder)return;let t=r.current?.getScroller();x.current=t?{height:t.scrollHeight,top:t.scrollTop}:null,e.onLoadOlder()},[e.hasOlder,e.onLoadOlder]);(0,H.useLayoutEffect)(()=>{let e=r.current?.getScroller(),t=x.current;!e||!t||(x.current=null,e.scrollTop=t.top+(e.scrollHeight-t.height))},[b]),(0,H.useEffect)(()=>{r.current?.isAtBottom()&&r.current.pinToBottom()},[y]);let C=async(t,n)=>{a(!0);try{let i=I7(n.length),a=[];for(let e of n)a.push(await cae(e,i));e.onSend(t,a),r.current?.scrollToBottom()}finally{a(!1)}};return(0,G.jsx)(zN.Provider,{value:m,children:(0,G.jsxs)(`div`,{className:`phone-chat-root flex h-full min-h-0 flex-col`,children:[(0,G.jsxs)(`header`,{className:`flex shrink-0 items-center gap-1 border-b bg-background px-2 py-2 pt-safe`,children:[u?.onBack||!e.drawerDocked?(0,G.jsx)(`button`,{type:`button`,onClick:u?.onBack??e.onOpenDrawer,"aria-label":u?.onBack?`返回群聊`:`打开会话列表`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:u?.onBack?(0,G.jsx)(bt,{className:`h-4.5 w-4.5`}):(0,G.jsx)(Sn,{className:`h-4.5 w-4.5`})}):(0,G.jsx)(`span`,{className:`h-9 w-9 shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 text-center`,children:[(0,G.jsxs)(`p`,{className:`flex min-w-0 items-center justify-center gap-1.5`,children:[e.connState!==`host-offline`&&e.connState!==`unauthorized`&&(0,G.jsx)(`span`,{className:W(`h-1.5 w-1.5 shrink-0 rounded-full`,e.connState===`online`&&!e.syncing?`bg-emerald-500`:`animate-pulse bg-amber-500`),title:e.connState===`online`&&e.syncing?`同步中…`:e.stateLabel}),(0,G.jsx)(`span`,{className:`truncate font-medium text-sm`,children:e.title})]}),(0,G.jsx)(`p`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:e.projectName||e.stateLabel})]}),u?.readOnly?(0,G.jsx)(`span`,{className:`h-9 w-9 shrink-0`}):(0,G.jsx)(`button`,{type:`button`,onClick:e.onNewSession,disabled:!e.canCreate||d||!!u&&i||e.connState!==`online`,"aria-label":`新建会话`,title:e.newSessionHint??`新建会话`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-40`,children:(0,G.jsx)(Gn,{className:`h-4.5 w-4.5`})})]}),e.connState===`host-offline`&&(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center gap-1.5 bg-amber-500/10 py-1 text-amber-700 text-xs dark:text-amber-400`,children:[(0,G.jsx)(cn,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:e.stateLabel})]}),e.tabGroup&&e.tabGroup.children.length>0&&(0,G.jsxs)(`div`,{ref:o,role:`tablist`,className:`t-tabs relative flex shrink-0 items-center justify-start gap-1 overflow-x-auto border-b px-2 py-1`,children:[(0,G.jsx)(`span`,{ref:s,"aria-hidden":`true`,className:`t-tabs-pill pointer-events-none absolute top-0 left-0 z-0 rounded-md bg-muted`}),(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n===e.tabGroup.parent.id,className:H7(n===e.tabGroup.parent.id),onClick:()=>e.onSelectTab?.(e.tabGroup?.parent.id??``),children:[(0,G.jsx)(dn,{className:`h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{className:`max-w-40 truncate`,children:e.tabGroup.parent.title||`新对话`})]}),e.tabGroup.children.map(t=>(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n===t.id,className:H7(n===t.id),onClick:()=>e.onSelectTab?.(t.id),children:[(0,G.jsx)(pt,{className:`h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{className:`max-w-28 truncate`,children:t.title||`coworker`}),(0,G.jsx)(`span`,{className:W(`h-1.5 w-1.5 shrink-0 rounded-full`,t.status===`running`?`animate-pulse bg-brand`:t.status===`failed`?`bg-destructive`:`bg-muted-foreground/30`)})]},t.id))]}),n===null?(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,G.jsx)(`span`,{className:`mb-3 flex size-11 items-center justify-center rounded-[13px] border border-brand/20 bg-brand/8 text-brand dark:bg-brand/14`,children:(0,G.jsx)(VN,{className:`size-6`})}),(0,G.jsx)(`p`,{className:`font-semibold text-[22px] tracking-tight`,children:`EnsoCode`}),(0,G.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:e.connState===`online`?`从左上角选择会话,或新建一个`:e.stateLabel})]}):(0,G.jsx)(oie,{ref:r,items:y,busy:t===null?!!e.syncing:l,loading:t===null,running:l,error:void 0,emptyTitle:e.projectName||`EnsoCode`,virtualize:!1,historyLoading:e.historyLoading,hasOlder:e.hasOlder,firstItemIndex:b??0,onStartReached:e.hasOlder?S:void 0},n),n!==null&&(0,G.jsx)(`div`,{className:`phone-dock @container flex min-h-0 flex-col pt-1 pb-safe`,children:(0,G.jsxs)(`div`,{className:W(`enso-chat-col mx-auto w-full max-w-2xl px-4 @min-[56rem]:max-w-3xl @min-[72rem]:max-w-4xl @min-[84rem]:max-w-5xl @min-[96rem]:max-w-6xl @min-[112rem]:max-w-7xl`,`flex min-h-0 flex-col`),children:[t?.retry&&(0,G.jsx)(pie,{retry:t.retry}),!d&&(0,G.jsx)(_P,{conversationId:n,queued:(e.queued??[]).map(e=>({id:e.id,text:e.text}))}),e.goal&&!d&&(0,G.jsx)(fP,{conversationId:n,goal:{...e.goal,noProgressRuns:0}}),(0,G.jsx)(d5,{conversationId:n},n),(0,G.jsx)(Mie,{sessionId:n,tasks:t?.tasks??[],subagents:t?.subagents??[],readOnly:e.deviceReadOnly}),(0,G.jsxs)(`div`,{"data-enso":`composer-stack`,className:`flex min-h-0 flex-col overflow-y-auto overscroll-contain`,children:[u?.outbox,u?.notice&&(0,G.jsx)(`p`,{className:`mb-1 rounded-md bg-destructive/10 px-2 py-1 text-destructive text-xs`,children:u.notice}),e.deviceReadOnly?(0,G.jsx)(`p`,{className:`mb-1 rounded-md bg-muted px-2 py-1 text-center text-muted-foreground text-xs`,children:B7(e.readOnlyRejected)}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(a_,{approvals:t?.approvals??[],onRespond:e.onApproval,clockOffset:e.clockOffset}),(0,G.jsx)(l_,{asks:t?.asks??[],onAnswer:e.onAsk,clockOffset:e.clockOffset,autoFocus:!1})]})]}),!d&&(0,G.jsx)(RN,{commands:h,running:l,busy:l,locked:e.newSessionBusy||!!u&&i||(t?.approvals??[]).length>0,focusKey:u?.chatId?`bot-chat:${u.chatId}`:n,autoFocus:!1,enterToSend:!1,toolbar:e.modelLabel&&e.onOpenConfig?(0,G.jsxs)(`button`,{type:`button`,onClick:e.onOpenConfig,className:`flex min-w-0 items-center gap-0.5 rounded-md px-1.5 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:[(0,G.jsx)(`span`,{className:`truncate`,children:e.modelLabel}),(0,G.jsx)(vt,{className:`h-3 w-3 shrink-0`})]}):void 0,onSend:e=>{C(e.text,e.images)},onAbort:e.onAbort}),!d&&(0,G.jsx)(sae,{usageTotals:e.usageTotals,context:e.context})]})})]})})}function H7(e){return W(`t-tab flex min-w-0 shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-xs transition-colors`,e?`font-medium`:`text-muted-foreground`)}async function cae(e,t){if(e.data.length*.75<=t)return e;let n=await(await fetch(`data:${e.mimeType};base64,${e.data}`)).blob();return L7(new File([n],`image`,{type:e.mimeType}),t)}function U7(e){if(e.kind===`ssh`)return e.sshConnectionName?.trim()||e.sshHost}function W7(e){return e.alias?.trim()||e.name}function G7(e){let t=W7(e),n=U7(e);return n?`${t} (${n})`:t}var K7=`enso-phone-drawer-segment`;function lae(){let e=localStorage.getItem(K7);return e===`bot`||e===`code`?e:null}function uae(e){localStorage.setItem(K7,e)}function q7(e,t){if(!e)return!1;let n=lae();return n?n===`bot`:t!==null}function dae(e,t=0){let n=new Map;for(let r of e)if(!(r.seq<=t)&&((r.kind===`human`||r.newConversation)&&n.clear(),r.kind===`bot`&&r.botId&&n.delete(r.botId),r.failure&&n.set(r.failure.botId,r.id),r.retryOf))for(let[e,t]of n)t===r.retryOf&&n.delete(e);return new Set(n.values())}function fae(e,t){let n=RegExp(`#${t}(?!\\d)`).exec(e);if(!n)return;let r=n.index+n[0].length;return[e.slice(0,n.index),n[0],e.slice(r)]}function pae({status:e}){return e===`running`?(0,G.jsx)(cn,{className:`h-3 w-3 shrink-0 animate-spin text-brand`}):e===`done`?(0,G.jsx)(_t,{className:`h-3 w-3 shrink-0 text-muted-foreground`}):e===`denied`?(0,G.jsx)(Vn,{className:`h-3 w-3 shrink-0 text-muted-foreground`}):e===`timeout`?(0,G.jsx)(Mt,{className:`h-3 w-3 shrink-0 text-warning`}):(0,G.jsx)(ir,{className:`h-3 w-3 shrink-0 text-destructive`})}function mae({item:e,bots:t,clockOffset:n,onOpen:r}){let i=t.get(e.botId),a=e.ownerBotId?t.get(e.ownerBotId):void 0,o=e.state!==`queued`,[s,c]=(0,H.useState)(()=>Date.now());(0,H.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>c(Date.now()),1e3);return()=>window.clearInterval(e)},[o]);let l=s-n,u=o&&r?()=>r(e.conversationId):void 0;return(0,G.jsxs)(`button`,{type:`button`,disabled:!u,onClick:u,className:`flex w-full gap-2 rounded-lg border bg-muted/30 px-2.5 py-2 text-left disabled:cursor-default`,children:[(0,G.jsx)(Io,{bot:i,size:`sm`,busy:o}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,G.jsxs)(`span`,{className:`truncate font-medium`,children:[i?.name??`成员`,a?(0,G.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` 替 `,a.name]}):null]}),(0,G.jsx)(`span`,{className:W(`shrink-0`,o?`text-brand`:`text-muted-foreground`),children:ss(e)}),o&&e.startedAt!==void 0&&(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground tabular-nums`,children:us(l-e.startedAt)}),u&&(0,G.jsx)(yt,{className:`ml-auto h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),e.more>0&&(0,G.jsxs)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:[`+`,e.more,` 个更早的步骤`]}),e.steps.map((e,t)=>(0,G.jsxs)(`span`,{className:`mt-1 flex items-center gap-1.5 text-[11px]`,children:[(0,G.jsx)(pae,{status:e.status}),(0,G.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-muted-foreground`,children:e.detail}),e.status===`timeout`&&(0,G.jsx)(`span`,{className:`shrink-0 text-warning`,children:e.name===`ask_user`?`已超时未回答`:`已超时拒绝`}),(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground tabular-nums`,children:e.durationMs===void 0?e.startedAt===void 0?``:us(l-e.startedAt):us(e.durationMs)})]},t))]})]})}var J7=e=>[...e].sort((e,t)=>t.activityAt-e.activityAt);function hae(e,t,n=10){let r=J7(e),i=e=>e.id===t.currentId||e.id===t.rootId?0:e.unread||e.running?1:2,a=new Set([...r].sort((e,t)=>i(e)-i(t)).slice(0,n).map(e=>e.id));return r.filter(e=>a.has(e.id)).sort((e,n)=>Number(n.id===t.rootId)-Number(e.id===t.rootId))}function gae(e,t,n){let r=t.trim().toLowerCase();return J7(e).filter(e=>(n===`all`||(n===`unread`?e.unread:e.running))&&(!r||`${e.title}\n${e.preview??``}`.toLowerCase().includes(r)))}var Y7=PT,_ae=ET;function vae({className:e,...t}){return(0,G.jsx)(ry,{className:W(`fixed inset-0 z-50 bg-black/32 backdrop-blur-sm transition-opacity duration-150 ease-out data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`sheet-backdrop`,...t})}function yae({className:e,side:t,inset:n=!1,...r}){return(0,G.jsx)(FT,{className:W(`fixed inset-0 z-50 grid`,t===`bottom`&&`grid grid-rows-[1fr_auto] pt-12`,t===`top`&&`grid grid-rows-[auto_1fr] pb-12`,t===`left`&&`flex justify-start`,t===`right`&&`flex justify-end`,n&&`sm:p-4`),"data-slot":`sheet-viewport`,...r})}function X7({className:e,children:t,showCloseButton:n=!0,side:r=`right`,inset:i=!1,...a}){return(0,G.jsxs)(_ae,{children:[(0,G.jsx)(AE,{}),(0,G.jsx)(vae,{}),(0,G.jsx)(yae,{inset:i,side:r,children:(0,G.jsxs)(CT,{className:W(`relative flex max-h-full min-h-0 w-full min-w-0 flex-col bg-popover bg-clip-padding text-popover-foreground shadow-lg transition-[opacity,translate] duration-150 [transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] will-change-transform before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:before:hidden dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]`,r===`bottom`&&`row-start-2 border-t data-ending-style:translate-y-8 data-starting-style:translate-y-8`,r===`top`&&`data-ending-style:-translate-y-8 data-starting-style:-translate-y-8 border-b`,r===`left`&&`data-ending-style:-translate-x-8 data-starting-style:-translate-x-8 w-[calc(100%-(--spacing(12)))] max-w-md border-e`,r===`right`&&`col-start-2 w-[calc(100%-(--spacing(12)))] max-w-md border-s data-ending-style:translate-x-8 data-starting-style:translate-x-8`,i&&`before:hidden sm:rounded-2xl sm:border sm:before:rounded-[calc(var(--radius-2xl)-1px)] sm:**:data-[slot=sheet-footer]:rounded-b-[calc(var(--radius-2xl)-1px)]`,e),"data-slot":`sheet-popup`,...a,children:[t,n&&(0,G.jsx)(Jy,{"aria-label":`Close`,className:`absolute end-2 top-2`,render:(0,G.jsx)(Oa,{size:`icon`,variant:`ghost`}),children:(0,G.jsx)(ir,{})})]})})]})}function Z7({className:e,...t}){return(0,G.jsx)(`div`,{className:W(`flex flex-col gap-2 p-6 in-[[data-slot=sheet-popup]:has([data-slot=sheet-panel])]:pb-3 max-sm:pb-4`,e),"data-slot":`sheet-header`,...t})}function Q7({className:e,...t}){return(0,G.jsx)(IT,{className:W(`font-heading text-xl leading-none`,e),"data-slot":`sheet-title`,...t})}function $7(e,t,n=Date.now()){let r=new Intl.RelativeTimeFormat(t,{numeric:`auto`}),i=e-n,a=Math.abs(i);return a<6e4?r.format(0,`second`):a<36e5?r.format(Math.trunc(i/6e4),`minute`):a<864e5?r.format(Math.trunc(i/36e5),`hour`):a<2592e6?r.format(Math.trunc(i/864e5),`day`):a<31536e6?r.format(Math.trunc(i/2592e6),`month`):r.format(Math.trunc(i/31536e6),`year`)}function e9({entry:e}){return(0,G.jsxs)(G.Fragment,{children:[e.running&&(0,G.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full bg-warning`}),(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:$7(e.activityAt,`zh`)})]})}function bae({threads:e,status:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(``),{entries:o,currentId:s,rootId:c,disabledHint:l}=e,u=o.find(e=>e.id===s),d=hae(o,{currentId:s,rootId:c}),f=o.length-d.length,p=gae(o,i,`all`),m=t=>{!l&&t!==s&&e.onSelect(t)};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(KM,{children:[(0,G.jsxs)(JM,{"aria-label":`切换话题`,className:`mx-auto flex max-w-full items-center justify-center gap-0.5 text-[11px] text-muted-foreground`,children:[(0,G.jsxs)(`span`,{className:`truncate`,children:[u?.title??`主话题`,t&&` · ${t}`]}),(0,G.jsx)(vt,{className:`h-3 w-3 shrink-0`})]}),(0,G.jsxs)(YM,{className:`w-72 max-w-[calc(100vw-1rem)]`,children:[(0,G.jsxs)(ZM,{children:[(0,G.jsx)($M,{children:`话题`}),d.map(e=>(0,G.jsxs)(QM,{disabled:!!l&&e.id!==s,onClick:()=>m(e.id),children:[(0,G.jsx)(_t,{className:W(e.id!==s&&`invisible`)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,G.jsx)(e9,{entry:e})]},e.id))]}),(0,G.jsx)(eN,{}),f>0&&(0,G.jsxs)(QM,{onClick:()=>{a(``),r(!0)},children:[(0,G.jsx)(sn,{}),`全部话题(`,o.length,`)`]}),(0,G.jsxs)(QM,{disabled:!!l,onClick:e.onCreate,children:[(0,G.jsx)(fn,{}),`新话题`]}),l&&(0,G.jsx)(`p`,{className:`px-2 py-1.5 text-muted-foreground text-xs`,children:l})]})]}),(0,G.jsx)(Y7,{open:n,onOpenChange:r,children:(0,G.jsxs)(X7,{side:`bottom`,className:`max-h-[80vh] pb-safe`,children:[(0,G.jsx)(Z7,{children:(0,G.jsxs)(Q7,{children:[`全部话题(`,o.length,`)`]})}),(0,G.jsx)(`div`,{className:`px-4 pb-2`,children:(0,G.jsx)(eG,{value:i,placeholder:`搜索话题…`,onChange:e=>a(e.target.value)})}),l&&(0,G.jsx)(`p`,{className:`px-4 pb-2 text-muted-foreground text-xs`,children:l}),(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-3`,children:[p.map(e=>(0,G.jsxs)(`button`,{type:`button`,disabled:!!l&&e.id!==s,onClick:()=>{m(e.id),r(!1)},className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left hover:bg-accent disabled:opacity-60`,children:[(0,G.jsx)(_t,{className:W(`h-4 w-4 shrink-0`,e.id!==s&&`invisible`)}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-sm`,children:e.title}),e.preview&&(0,G.jsx)(`span`,{className:`block truncate text-muted-foreground text-xs`,children:e.preview})]}),(0,G.jsx)(e9,{entry:e})]},e.id)),p.length===0&&(0,G.jsx)(`p`,{className:`py-8 text-center text-muted-foreground text-sm`,children:`没有匹配的话题`})]})]})})]})}var xae={queued:`排队中`,running:`进行中`,completed:`已完成`,failed:`失败`,canceled:`已取消`,blocked:`卡住了`},t9=4,Sae=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),Cae={started:{icon:Et,className:`border-brand/50 text-brand`},blocked:{icon:Ct,className:`border-warning/60 text-warning`},delivered:{icon:wt,className:`border-success/60 text-success`}};function wae({entry:e,bots:t}){let n=!!e.taskId,[r,i]=(0,H.useState)(!n),a=(0,G.jsxs)(G.Fragment,{children:[n&&(0,G.jsx)(yt,{"aria-hidden":!0,className:W(`h-3 w-3 shrink-0 transition-transform`,r&&`rotate-90`)}),(0,G.jsxs)(`span`,{className:`font-medium`,children:[t.get(e.from)?.name??`成员`,` → `,t.get(e.to)?.name??`成员`]}),(0,G.jsx)(`span`,{className:W(`rounded px-1.5 py-0.5`,e.state===`running`||e.state===`queued`?`bg-brand/10 text-brand`:e.state===`failed`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`),children:xae[e.state]})]});return(0,G.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 px-3 py-2 text-xs`,children:[n?(0,G.jsx)(`button`,{type:`button`,"aria-expanded":r,"aria-label":r?`收起委派结果`:`展开委派结果`,className:`flex w-full items-center gap-1.5 text-left`,onClick:()=>i(e=>!e),children:a}):(0,G.jsx)(`p`,{className:`flex items-center gap-1.5`,children:a}),r&&e.summary&&(0,G.jsx)(`p`,{className:`mt-1 line-clamp-3 text-muted-foreground`,children:e.summary})]})}function n9(e,t){let n=[...t].sort((e,t)=>t.length-e.length),r=[],i=e,a=0;for(;i;){let e=i.indexOf(`@`),t=e<0?void 0:n.find(t=>i.startsWith(t,e+1));if(e<0||!t){r.push(i);break}e>0&&r.push(i.slice(0,e)),r.push((0,G.jsxs)(`span`,{className:`font-medium text-brand`,children:[`@`,t]},a++)),i=i.slice(e+1+t.length)}return r}function Tae(e){let{chat:t,bots:n,timeline:r,state:i}=e,a=(0,H.useRef)(null),o=(0,H.useRef)(null),s=(0,H.useRef)(null),c=(0,H.useRef)(!0),l=(0,H.useRef)(null),[u,d]=(0,H.useState)(``),[f,p]=(0,H.useState)(0),[m,h]=(0,H.useState)([]),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(null),b=r?.entries??[],x=t.epochSeq??b.findLast(e=>e.kind===`system`&&e.newConversation)?.seq??0,[S,C]=(0,H.useState)(!1);(0,H.useEffect)(()=>C(!1),[t.id,x]);let w=x>0&&!S,T=Xo(b,x,S),E=dae(b,x),D=t.members.map(e=>n.get(e)).filter(e=>!!(e&&!e.archived)),O=D.map(e=>e.name),k=!!i?.current||t.status!==`idle`,A=$o(u,f),j=A?ts(A.query,D):[],M=T[0]?.seq,N=T.at(-1)?.seq;(0,H.useLayoutEffect)(()=>{let e=a.current;if(!e)return;let t=s.current;t?(s.current=null,e.scrollTop=t.top+(e.scrollHeight-t.height)):c.current&&(e.scrollTop=e.scrollHeight)},[M,N,i?.current,e.activities.length]);let P=()=>{let t=a.current;!r?.hasOlder||!t||e.historyLoading||e.connState!==`online`||w&&(b[0]?.seq??x)<=x||(s.current={height:t.scrollHeight,top:t.scrollTop},e.onLoadOlder())},F=e=>{if(!A)return;let t=ns(u,A,f,e.name);d(t.text),p(t.caret),requestAnimationFrame(()=>{o.current?.focus(),o.current?.setSelectionRange(t.caret,t.caret)})},I=(0,H.useRef)(m);I.current=m,(0,H.useEffect)(()=>()=>{for(let e of I.current)URL.revokeObjectURL(e.url)},[]);let ee=e=>{let t=[...e??[]].filter(e=>e.type.startsWith(`image/`)).slice(0,t9-m.length).map(e=>({file:e,url:URL.createObjectURL(e)}));h(e=>[...e,...t]),y(null)},L=e=>{URL.revokeObjectURL(e),h(t=>t.filter(t=>t.url!==e))},te=async()=>{if(!u.trim()&&m.length===0||g||e.newSessionBusy)return;let t=[];if(m.length){_(!0);try{t=await Jie(m.map(e=>e.file))}catch(e){y(e instanceof Error?e.message:`图片处理失败`);return}finally{_(!1)}}e.onSend(u,t);for(let e of m)URL.revokeObjectURL(e.url);h([]),y(null),d(``),p(0),c.current=!0},R=t=>{switch(t.kind){case`human`:return(0,G.jsxs)(`div`,{className:`flex flex-col items-end`,children:[t.text&&(0,G.jsxs)(`div`,{className:`max-w-[85%] whitespace-pre-wrap break-words rounded-2xl rounded-br-md bg-brand/10 px-3 py-2 text-sm`,children:[n9(t.text,O),t.truncated&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`消息过长,仅显示部分内容`})]}),t.images?.length?(0,G.jsx)(Xa,{target:{chatId:e.chat.id,entryId:t.id}}):null]},t.seq);case`bot`:{let r=n.get(t.botId);return(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Io,{bot:r,size:`sm`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`flex items-baseline gap-1.5 text-xs`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:r?.name??`成员`}),(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:Sae(t.at)})]}),(0,G.jsxs)(`div`,{className:`mt-0.5 min-w-0 text-sm`,children:[(0,G.jsx)(C3,{text:t.text}),t.truncated&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`消息过长,仅显示部分内容`})]}),(0,G.jsx)(Xa,{target:{chatId:e.chat.id,entryId:t.id}}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>e.onOpenProcess(t.conversationId),className:`mt-0.5 flex items-center gap-0.5 text-muted-foreground text-xs hover:text-foreground`,children:[(0,G.jsx)(yt,{className:`h-3 w-3`}),`查看过程`]})]})]},t.seq)}case`delegation`:return(0,G.jsx)(wae,{entry:t,bots:n},t.seq);case`progress`:{let e=n.get(t.botId),r=Cae[t.phase],i=r.icon,a=fae(t.text,t.taskSeq);return(0,G.jsxs)(`div`,{"data-phase":t.phase,className:`flex gap-2 text-xs`,children:[(0,G.jsx)(Io,{bot:e,size:`sm`}),(0,G.jsxs)(`div`,{className:W(`flex min-w-0 items-start gap-1.5 rounded-md border-l-2 bg-muted/50 px-2 py-1`,r.className),children:[(0,G.jsx)(i,{"aria-hidden":!0,className:`mt-px h-3.5 w-3.5 shrink-0`}),(0,G.jsxs)(`p`,{className:`line-clamp-2 min-w-0 break-words text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.name??`成员`}),` `,a?(0,G.jsxs)(G.Fragment,{children:[n9(a[0],O),(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:a[1]}),n9(a[2],O)]}):n9(t.text,O)]})]})]},t.seq)}case`system`:return(0,G.jsxs)(`p`,{className:`text-center text-muted-foreground text-xs`,children:[t.text,E.has(t.id)&&e.onRetry&&!e.deviceReadOnly&&(0,G.jsx)(`button`,{type:`button`,className:`ml-2 underline disabled:opacity-50`,disabled:k||e.connState!==`online`,onClick:()=>e.onRetry?.(t.id),children:`重试`})]},t.seq)}},z=i?.current?n.get(i.current):void 0;return(0,G.jsxs)(`div`,{className:`phone-chat-root flex h-full min-h-0 flex-col`,children:[(0,G.jsxs)(`header`,{className:`flex shrink-0 items-center gap-1 border-b bg-background px-2 py-2 pt-safe`,children:[e.drawerDocked?(0,G.jsx)(`span`,{className:`h-9 w-9 shrink-0`}):(0,G.jsx)(`button`,{type:`button`,onClick:e.onOpenDrawer,"aria-label":`打开会话列表`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,G.jsx)(Sn,{className:`h-4.5 w-4.5`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 text-center`,children:[(0,G.jsx)(`p`,{className:`truncate font-medium text-sm`,children:t.title||`群聊`}),e.threads?(0,G.jsx)(bae,{threads:e.threads,status:e.connState===`online`?void 0:e.stateLabel}):(0,G.jsx)(`p`,{className:`truncate text-[11px] text-muted-foreground`,children:e.connState===`online`?`${t.members.length} 位成员`:e.stateLabel})]}),e.threads?(0,G.jsx)(`button`,{type:`button`,onClick:e.threads.onCreate,disabled:!!e.threads.disabledHint,"aria-label":`新话题`,title:e.threads.disabledHint??`新话题`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-40`,children:(0,G.jsx)(Gn,{className:`h-4.5 w-4.5`})}):(0,G.jsx)(`button`,{type:`button`,onClick:e.onNewSession,disabled:!e.canCreate||e.deviceReadOnly||g||e.connState!==`online`,"aria-label":`新建会话`,title:e.newSessionHint??`新建会话`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-40`,children:(0,G.jsx)(Gn,{className:`h-4.5 w-4.5`})})]}),(0,G.jsxs)(`div`,{ref:a,onScroll:e=>{let t=e.currentTarget;c.current=t.scrollHeight-t.scrollTop-t.clientHeight<40,t.scrollTop<60&&P()},className:`min-h-24 flex-1 space-y-3 overflow-y-auto px-3 py-3`,children:[r===void 0?(0,G.jsxs)(`p`,{className:`flex items-center justify-center gap-1.5 py-8 text-muted-foreground text-sm`,children:[(0,G.jsx)(cn,{className:`h-4 w-4 animate-spin`}),`读取中…`]}):r.hasOlder&&(!w||(b[0]?.seq??x)>x)?(0,G.jsx)(`button`,{type:`button`,onClick:P,disabled:e.historyLoading||e.connState!==`online`,className:`w-full py-1 text-center text-muted-foreground text-xs`,children:e.historyLoading?`加载中…`:`加载更早的消息`}):T.length===0?(0,G.jsx)(`p`,{className:`py-8 text-center text-muted-foreground text-sm`,children:`@ 成员开始对话,未 @ 时由群主回复`}):null,x>0&&(0,G.jsx)(`button`,{type:`button`,className:`w-full py-1 text-center text-muted-foreground text-xs`,onClick:()=>{C(!S),S&&r?.history?e.onJumpLatest?.():!S&&r?.hasOlder&&!b.some(e=>e.seq<x)&&e.onLoadOlder()},children:w?`更早的对话 · ${x-1} 条`:`收起更早的对话`}),r?.history&&(0,G.jsx)(`button`,{type:`button`,className:`w-full py-1 text-center text-brand text-xs`,onClick:()=>{c.current=!0,e.onJumpLatest?.()},children:`回到最新消息`}),T.map(R),e.activities.map(t=>(0,G.jsx)(mae,{item:t,bots:n,clockOffset:e.clockOffset,onOpen:e.onOpenProcess},t.conversationId)),z&&e.activities.length===0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Io,{bot:z,size:`sm`,busy:!0}),(0,G.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[z.name,` 正在回复…`]})]})]}),(0,G.jsxs)(`div`,{className:`phone-dock flex min-h-0 flex-col gap-2 px-3 pt-1 pb-safe`,children:[(0,G.jsxs)(`div`,{"data-enso":`composer-stack`,className:`flex min-h-0 flex-col gap-2 overflow-y-auto overscroll-contain empty:hidden`,children:[e.outbox,e.notice&&(0,G.jsx)(`p`,{className:`rounded-md bg-destructive/10 px-2 py-1 text-destructive text-xs`,children:e.notice}),e.deviceReadOnly&&(0,G.jsx)(`p`,{className:`rounded-md bg-muted px-2 py-1 text-center text-muted-foreground text-xs`,children:B7(e.readOnlyRejected)}),!e.deviceReadOnly&&e.pending.map(({sessionId:t,botId:r,view:i})=>i.approvals.length>0||i.asks.length>0?(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:n.get(r)?.name??`成员`}),(0,G.jsx)(a_,{approvals:i.approvals,clockOffset:e.clockOffset,onRespond:(n,r)=>e.onApproval(t,n,r)}),(0,G.jsx)(l_,{asks:i.asks,clockOffset:e.clockOffset,onAnswer:(n,r)=>e.onAsk(t,n,r),autoFocus:!1})]},t):null)]}),(0,G.jsxs)(`div`,{className:W(`relative`,e.deviceReadOnly&&`hidden`),children:[j.length>0&&(0,G.jsx)(`div`,{className:`absolute right-0 bottom-full left-0 mb-1 max-h-48 overflow-y-auto rounded-lg border bg-popover p-1 shadow-md`,children:j.map(e=>{let t=n.get(e.id);return(0,G.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>F(e),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent`,children:[t?(0,G.jsx)(Io,{bot:t,size:`sm`}):(0,G.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center rounded-full bg-muted text-xs`,children:`@`}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.name}),t?.title&&(0,G.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:t.title})]},e.id)})}),v&&(0,G.jsx)(`p`,{className:`mb-1 text-destructive text-xs`,children:v}),m.length>0&&(0,G.jsx)(`div`,{className:`mb-1.5 flex gap-1.5`,children:m.map(e=>(0,G.jsxs)(`div`,{className:`relative h-14 w-14 overflow-hidden rounded-lg border`,children:[(0,G.jsx)(`img`,{src:e.url,alt:``,className:`h-full w-full object-cover`}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`移除图片`,onClick:()=>L(e.url),className:`absolute top-0.5 right-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-black/60 text-white`,children:(0,G.jsx)(ir,{className:`h-3 w-3`})})]},e.url))}),(0,G.jsxs)(`div`,{className:`flex items-end gap-2 rounded-2xl border bg-background px-3 py-2`,children:[(0,G.jsx)(`input`,{ref:l,type:`file`,accept:`image/*`,multiple:!0,hidden:!0,onChange:e=>{ee(e.target.files),e.target.value=``}}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`添加图片`,disabled:m.length>=t9,onClick:()=>l.current?.click(),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground disabled:opacity-40`,children:(0,G.jsx)(en,{className:`h-4.5 w-4.5`})}),(0,G.jsx)(`textarea`,{ref:o,rows:1,value:u,placeholder:`@ 成员,或直接说…`,onChange:e=>{d(e.target.value),p(e.target.selectionStart??e.target.value.length)},onSelect:e=>p(e.currentTarget.selectionStart??0),className:`max-h-32 min-h-6 flex-1 resize-none bg-transparent text-sm outline-none field-sizing-content`}),k&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`停止`,onClick:e.onStop,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted text-foreground`,children:(0,G.jsx)(Yn,{className:`h-3.5 w-3.5 fill-current`})}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`发送`,disabled:!u.trim()&&m.length===0||g||e.newSessionBusy||!e.outbox&&e.connState!==`online`,onClick:()=>void te(),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-brand text-brand-foreground disabled:opacity-40`,children:(0,G.jsx)(lt,{className:`h-4 w-4`})})]})]})]})]})}var r9=e=>typeof window.matchMedia==`function`&&window.matchMedia(e).matches;function Eae(e){return(0,H.useSyncExternalStore)(t=>{if(typeof window.matchMedia!=`function`)return()=>{};let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},()=>r9(e),()=>r9(e))}var Dae=`(min-width: 900px)`;function Oae(e){let t=H.useRef(!0);t.current&&(t.current=!1,e())}var i9=H.createContext(null);function a9(){let e=H.useContext(i9);if(e===null)throw Error(Cr(60));return e}var kae=(e,t)=>Object.is(e,t);function o9(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function s9(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&o9(e,t,n))}function Aae(e,t,n){return e.filter(e=>!o9(t,e,n))}function c9(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function l9(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function jae(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(l9(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function u9(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return c9(e)}function d9(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?c9(e.value):c9(e)}function f9(e,t,n){function r(){return u9(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=l9(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Mae(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,G.jsx)(H.Fragment,{children:f9(r,t,n)},i)),e),[])}var p9={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:d9(t,r)!==``},hasNullItemLabel:(e,t)=>t?jae(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>o9(t,e,n)):o9(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function Nae(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Pae(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=kae,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=mN(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=dN(),F=bN({id:t}),I=M||d,ee=j??c,[L,te]=Pj({controlled:n,default:y?r??Ir:r,name:`Select`,state:`value`}),[R,z]=Pj({controlled:a,default:o,name:`Select`,state:`open`}),B=H.useRef([]),ne=H.useRef([]),V=H.useRef(null),re=H.useRef(null),ie=H.useRef(0),ae=H.useRef(null),oe=H.useRef([]),se=H.useRef(!1),ce=H.useRef(null),le=H.useRef(null),ue=H.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=H.useRef(!1),{mounted:fe,setMounted:pe,transitionStatus:me}=Aw(R),{openMethod:he,triggerProps:ge}=zT(R),_e=Tr(()=>new Dw({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:L,open:R,mounted:fe,transitionStatus:me,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ve=Cw(_e,p9.activeIndex),ye=Cw(_e,p9.selectedIndex),be=Cw(_e,p9.triggerElement),xe=Cw(_e,p9.positionerElement),Se=kM(he),Ce=he??Se,we=H.useMemo(()=>y?``:d9(L,x),[y,L,x]),Te=H.useMemo(()=>y&&Array.isArray(L)?L.map(e=>d9(e,x)):d9(L,x),[y,L,x]);fN(Rb(be),F,L,jy(()=>Te),!I,c);let Ee=H.useRef(L),De=y?Array.isArray(L)&&L.length>0:L!=null&&we!==``;Y(()=>{A(De)},[De,A]),Y(function(){let e=L,t=!1;if(y){let n=Array.isArray(L)?L:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:s9(oe.current,e,S),r=n===-1?null:n;r===null&&(le.current=null),!R&&_e.set(`selectedIndex`,r)},[y,R,L,S,_e]);function Oe(e){let t=k.initialValue;return Array.isArray(e)&&Array.isArray(t)?!Nae(e,t,(e,t)=>o9(e,t,S)):e!==t}LT(L,()=>{T(ee),E(Oe(L)),N.change(L)});let ke=jy((e,t)=>{s?.(e,t),!t.isCanceled&&(z(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(L)))}),Ae=jy(()=>{pe(!1),_e.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});Mw({enabled:!h,open:R,ref:V,onComplete(){R||Ae()}}),H.useImperativeHandle(h,()=>({unmount:Ae}),[Ae]);let je=jy((e,t)=>{i?.(e,t),!t.isCanceled&&te(e)}),Me=jy(e=>{let t=oE(e.scrollHeight,e.clientHeight),n=sE(e.scrollTop,t),r=n>0,i=n<t;_e.set(`scrollUpArrowVisible`,r),_e.set(`scrollDownArrowVisible`,i)}),Ne=Tte({open:R,onOpenChange:ke,elements:{reference:be,floating:xe}}),Pe=GS(Ne,{enabled:!f&&!I,event:`mousedown`}),Fe=JS(Ne),Ie=dT(Ne,{enabled:!f&&!I,listRef:B,activeIndex:ve,selectedIndex:ye,disabledIndices:Ir,onNavigate(e){e===null&&!R||_e.set(`activeIndex`,e)},focusItemOnHover:C}),Le=fT(Ne,{enabled:!f&&!I&&(R||!y),listRef:ne,activeIndex:ve,selectedIndex:ye,disabledIndices:e=>GM(B.current[e]),onMatch(e){R?_e.set(`activeIndex`,e):je(oe.current[e],qy(Ly))},onTyping(e){se.current=e}}),Re=H.useMemo(()=>cr(Le.reference,Ie.reference,Fe.reference,Pe.reference,ge),[Pe.reference,Le.reference,Ie.reference,Fe.reference,ge]),ze=H.useMemo(()=>cr(Nw,Le.floating,Ie.floating,Fe.floating),[Le.floating,Ie.floating,Fe.floating]),Be=Ie.item??Lr;Oae(()=>{_e.update({popupProps:ze,triggerProps:Re})}),_e.useSyncedValues({id:F,modal:m,multiple:y,value:L,open:R,mounted:fe,transitionStatus:me,popupProps:ze,triggerProps:Re,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:Ce});let Ve=H.useMemo(()=>({store:_e,floatingContext:Ne,required:p,disabled:I,readOnly:f,multiple:y,highlightItemOnHover:C,setValue:je,setOpen:ke,listRef:B,popupRef:V,scrollHandlerRef:re,handleScrollArrowVisibility:Me,scrollArrowsMountedCountRef:ie,itemProps:Be,valueRef:ae,valuesRef:oe,labelsRef:ne,typingRef:se,selectionRef:ue,firstItemTextRef:ce,selectedItemTextRef:le,validation:N,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:de,initialValueRef:Ee}),[_e,Ne,p,I,f,y,C,je,ke,Be,N,_,Me]),He=Er(g,N.inputRef),Ue=y?void 0:ee,We=H.useMemo(()=>!y||!Array.isArray(L)||!ee?null:L.map(e=>{let t=d9(e,x);return(0,G.jsx)(`input`,{type:`hidden`,form:l,name:ee,value:t,disabled:I},t)}),[y,L,l,ee,x,I]);return(0,G.jsxs)(i9.Provider,{value:Ve,children:[w,(0,G.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){_e.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=qy(Ly,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=oe.current.findIndex(t=>d9(t,x).toLowerCase()===e||u9(t,b).toLowerCase()===e);r===-1&&(r=oe.current.findIndex((t,n)=>{let r=ne.current[n];return r!=null&&r.toLowerCase()===e}));let i=oe.current[r];i!=null&&je(i,n)}_e.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Ue==null?`${F}-hidden-input`:void 0,form:l,name:Ue,autoComplete:u,value:we,disabled:I,required:p&&!(y&&De),readOnly:f,ref:He,style:ee?Kb:Gb,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),We]})}function Fae(e,t){return e??t}var Iae=400,Lae={...ey,...sN,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Rae=H.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=dN(),{labelId:m}=gN(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:b,alignItemWithTriggerActiveRef:x,disabled:S}=a9(),C=p||S||a,w=Cw(h,p9.open),T=Cw(h,p9.mounted),E=Cw(h,p9.value),D=Cw(h,p9.triggerProps),O=Cw(h,p9.positionerElement),k=Cw(h,p9.listElement),A=Cw(h,p9.popupSide),j=Cw(h,p9.id),M=Cw(h,p9.labelId),N=Cw(h,p9.hasSelectedValue),P=T&&O?A:null,F=i??j,I=Fae(m,M);bN({id:F});let ee=Rb(O),L=H.useRef(null),{getButtonProps:te,buttonRef:R}=Fy({disabled:C,native:o}),z=h.useStateSetter(`triggerElement`),B=rb(),ne=rb(),V=rb();H.useEffect(()=>{if(w)return V.start(Iae,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{V.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ne.clear()},[w,_,ne,V]);let re=cr(D,{id:F,role:`combobox`,"aria-expanded":w,"aria-haspopup":`listbox`,"aria-controls":w?k?.id??Ab(O)?.id:void 0,"aria-labelledby":I,"aria-readonly":y||void 0,"aria-required":b||void 0,tabIndex:C?-1:0,onFocus(e){u(!0),w&&x.current&&g(!1,qy(Ly,e.nativeEvent)),B.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){xb(O,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(E))},onMouseDown(e){if(w)return;let t=Ny(e.currentTarget);function n(e){if(!L.current)return;let t=e.target;xb(L.current,t)||xb(ee.current,t)||yM(e,L.current)||g(!1,qy(Wy,e))}ne.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,te),ie=v.getValidationProps(C,re);ie.role=`combobox`;let ae={...f,open:w,disabled:C,value:E,readOnly:y,popupSide:P,placeholder:!N};return Vr(`button`,e,{ref:[t,L,R,z],state:ae,stateAttributesMapping:Lae,props:ie})}),zae={value:()=>null},Bae=H.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=a9(),u=Cw(c,p9.value),d=Cw(c,p9.items),f=Cw(c,p9.itemToStringLabel),p=Cw(c,p9.hasSelectedValue),m=!p&&a!=null&&i==null,h=Cw(c,p9.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?Mae(u,d,f):f9(u,d,f)),Vr(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:zae})}),Vae=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=a9();return Vr(`span`,e,{state:{open:Cw(o,p9.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:$v})}),Hae=H.forwardRef(function(e,t){let{store:n}=a9(),r=Cw(n,p9.mounted),i=Cw(n,p9.forceMount);return r||i?(0,G.jsx)(TS,{ref:t,...e}):null}),m9=H.createContext(void 0);function h9(){let e=H.useContext(m9);if(!e)throw Error(Cr(59));return e}function g9(e,t){e&&Object.assign(e.style,t)}var _9={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},Uae={position:`fixed`},Wae=H.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=vS,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:D,floatingContext:O}=a9(),k=Cw(y,p9.open),A=Cw(y,p9.mounted),j=Cw(y,p9.modal),M=Cw(y,p9.value),N=Cw(y,p9.openMethod),P=Cw(y,p9.positionerElement),F=Cw(y,p9.triggerElement),I=Cw(y,p9.isItemEqualToValue),ee=Cw(y,p9.transitionStatus),L=H.useRef(null),te=H.useRef(null),[R,z]=H.useState(h),B=A&&R&&N!==`touch`;!A&&R!==h&&z(h),H.useImperativeHandle(S,()=>B),oM((B||j)&&k,N===`touch`,P,F);let ne=dD({anchor:n,floatingRootContext:O,positionMethod:a,mounted:A,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??B,collisionAvoidance:g,keepMounted:!0}),V=B?`none`:ne.side,re=B?Uae:ne.positionerStyles,ie={open:k,side:V,align:ne.align,anchorHidden:ne.anchorHidden};Y(()=>{y.set(`popupSide`,ne.side)},[y,ne.side]);let ae=hD(e,ie,{styles:re,transitionStatus:ee,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!A,inert:!k}),oe=H.useRef(0),se=jy(e=>{if(w.current.length===0)return;let t=oe.current;if(oe.current=e.size,e.size===t)return;let n=qy(Ly);if(t!==0&&!y.state.multiple&&M!==null&&s9(w.current,M,I)===-1){let e=T.current,t=e!=null&&s9(w.current,e,I)!==-1?e:null;D(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(M)){let e=M.filter(e=>s9(w.current,e,I)!==-1);e.length!==M.length&&(D(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(k&&B){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};g9(P,e),g9(E.current,e)}}),ce=H.useMemo(()=>({...ne,side:V,alignItemWithTriggerActive:B,setControlledAlignItemWithTrigger:z,scrollUpArrowRef:L,scrollDownArrowRef:te}),[ne,V,B,z]);return(0,G.jsx)(Qj,{elementsRef:b,labelsRef:x,onMapChange:se,children:(0,G.jsxs)(m9.Provider,{value:ce,children:[A&&j&&(0,G.jsx)(TT,{inert:wT(!k),cutout:F}),ae]})})}),Gae={...ty,...qv},Kae=H.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:f,selectedItemTextRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v,floatingContext:y}=a9(),{side:b,align:x,alignItemWithTriggerActive:S,isPositioned:C,setControlledAlignItemWithTrigger:w}=h9(),T=qj(!0)!=null,E=iE(),{nonce:D,disableStyleElements:O}=YT(),k=Cw(s,p9.id),A=Cw(s,p9.open),j=Cw(s,p9.openMethod),M=Cw(s,p9.mounted),N=Cw(s,p9.popupProps),P=Cw(s,p9.transitionStatus),F=Cw(s,p9.triggerElement),I=Cw(s,p9.positionerElement),ee=Cw(s,p9.listElement),L=H.useRef(!1),te=H.useRef(!1),R=H.useRef({}),z=Ub(),B=jy(e=>{if(!I||!c.current||!te.current)return;let t=I.style.top===`0px`,n=I.style.bottom===`0px`;if(L.current||!S||!t&&!n){h(e);return}let r=b9(I),i=x9(I.getBoundingClientRect().height,`y`,r),a=Ny(I),o=oy(I),s=o.getComputedStyle(I),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=v9(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=y9(e),g=null,_=e=>{I.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=aE(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(L.current=!0),h(e);return}f-y>1?g=t?1/0:0:n&&p<m&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=aE(g,0,y9(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(L.current=!0),h(e)});H.useImperativeHandle(g,()=>B,[B]),Mw({open:A,ref:c,onComplete(){A&&l?.(!0)}});let ne={open:A,transitionStatus:P,side:b,align:x};Y(()=>{!I||!c.current||Object.keys(R.current).length||(R.current={top:I.style.top||`0`,left:I.style.left||`0`,right:I.style.right,height:I.style.height,bottom:I.style.bottom,minHeight:I.style.minHeight,maxHeight:I.style.maxHeight,marginTop:I.style.marginTop,marginBottom:I.style.marginBottom})},[c,I]),Y(()=>{A||S||(te.current=!1,L.current=!1,g9(I,R.current))},[A,S,I,c]),Y(()=>{let e=c.current;if(!A||!F||!I||!e||S&&!C||s.state.transitionStatus===`ending`)return;if(te.current=!0,e.style.removeProperty(`--transform-origin`),!S){z.request(()=>h(ee||e));return}let t=qae(e);try{let t=p.current;t?.isConnected||(t=!p9.hasSelectedValue(s.state)&&f.current?.isConnected?f.current:null);let n=d.current,r=oy(I),i=r.getComputedStyle(I),a=r.getComputedStyle(e),o=Ny(F),c=b9(F),l=S9(F.getBoundingClientRect(),c),u=S9(I.getBoundingClientRect(),c),m=l.height,g=ee||e,y=g.scrollHeight,b=parseFloat(a.borderBottomWidth),x=parseFloat(i.marginTop)||10,S=parseFloat(i.marginBottom)||10,C=parseFloat(i.minHeight)||100,T=v9(a),D=o.documentElement.clientHeight-x-S,O=o.documentElement.clientWidth,k=D-l.bottom+m,A,j=E===`rtl`?l.right-u.width:l.left,M=0;if(t&&n){let e=S9(n.getBoundingClientRect(),c);A=S9(t.getBoundingClientRect(),c),j=u.left+(E===`rtl`?e.right-A.right:e.left-A.left);let r=e.top-l.top+e.height/2;M=A.top-u.top+A.height/2-r}let N=k+M+S+b,P=Math.min(D,N),te=D-x-S,z=N-P,B=O-5;I.style.left=`${aE(j,5,B-u.width)}px`,I.style.height=`${P}px`,I.style.maxHeight=`none`,I.style.marginTop=`${x}px`,I.style.marginBottom=`${S}px`,e.style.height=`100%`;let ne=y9(g),V=z>=ne-1;V&&(P=Math.min(D,u.height)-(z-ne));let re=l.top<20||l.bottom>D-20||Math.ceil(P)+1<Math.min(y,C),ie=(r.visualViewport?.scale??1)!==1&&ub;if(re||ie){g9(I,R.current),w(!1);return}let ae=Math.max(C,P);if(V){let e=Math.max(0,D-N);I.style.top=u.height>=te?`0`:`${e}px`,I.style.height=`${P}px`,g.scrollTop=y9(g)}else I.style.bottom=`0`,g.scrollTop=z;if(A){let t=u.top,n=u.height,r=A.top+A.height/2,i=aE(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ae===D||P>=T)&&(L.current=!0),h(g),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,A,I,F,d,f,p,c,h,S,w,z,ee,_,v,E,C]),H.useEffect(()=>{if(!S||!I||!A)return;let e=oy(I);function t(e){u(!1,qy(ste,e))}return Ib(e,`resize`,t)},[u,S,I,A]);let V={...ee?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${k}-list`},onKeyDown(e){T&&xT.has(e.key)&&e.stopPropagation()},onScroll(e){ee||B(e.currentTarget)},...S&&{style:ee?{height:`100%`}:_9},className:!ee&&S?WT.className:void 0},re=Vr(`div`,e,{ref:[t,c],state:ne,stateAttributesMapping:Gae,props:[N,V,mD(P),o]});return(0,G.jsxs)(H.Fragment,{children:[!O&&WT.getElement(D),(0,G.jsx)(WS,{context:y,modal:!1,disabled:!M,openInteractionType:j,returnFocus:a,restoreFocus:!0,children:re})]})});function v9(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function y9(e){return oE(e.scrollHeight,e.clientHeight)}function b9(e){return jC.getScale(e)}function x9(e,t,n){return e/n[t]}function S9(e,t){return bx({x:x9(e.x,`x`,t),y:x9(e.y,`y`,t),width:x9(e.width,`x`,t),height:x9(e.height,`y`,t)})}var C9=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function qae(e){let{style:t}=e,n={};for(let[e,r]of C9)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of C9){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Jae=H.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=a9(),{alignItemWithTriggerActive:l}=h9(),u=Cw(o,p9.hasScrollArrows),d=Cw(o,p9.openMethod),f={id:`${Cw(o,p9.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:_9},className:u&&d!==`touch`?WT.className:void 0};return Vr(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),w9=H.createContext(void 0);function T9(){let e=H.useContext(w9);if(!e)throw Error(Cr(57));return e}var Yae=H.memo(H.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=H.useRef(null),d=Bj({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=a9(),C=x||s,w=Cw(f,p9.isActive,d.index),T=Cw(f,p9.open),E=Cw(f,p9.isSelected,a),D=Cw(f,p9.isSelectedByFocus,d.index),O=Cw(f,p9.isItemEqualToValue),k=d.index,A=H.useRef(null);Y(()=>{let e=v.current;return e[k]=a,()=>{delete e[k]}},[k,a,v]),Y(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&o9(a,t,O)&&(f.set(`selectedIndex`,k),u.current&&(b.current=u.current))},[k,y,O,f,a,b]);let j=H.useRef(`mouse`),M=H.useRef(!1),{getButtonProps:N,buttonRef:P}=Fy({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),F={disabled:C,selected:E,highlighted:w};function I(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?Aae(n,a,O):[...n,a];h(r,qy(Vy,e))}else h(a,qy(Vy,e)),m(!1,qy(Vy,e))}function ee(){g.current.dragY=0}let L={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,k),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=j.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&pb(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!M.current;M.current=!1,!(C||i)&&I(e.nativeEvent)},onPointerEnter(e){j.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){j.current=e.pointerType,M.current=!0,ee()},onMouseUp(){if(ee(),C||j.current===`touch`||M.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(M.current=!0,A.current?.click(),M.current=!1)}},te=Vr(`div`,e,{ref:[P,t,d.ref,A],state:F,props:[p,L,l,N]}),R=H.useMemo(()=>({selected:E,index:k,textRef:u,selectedByFocus:D}),[E,k,u,D]);return(0,G.jsx)(w9.Provider,{value:R,children:te})})),Xae=H.forwardRef(function(e,t){let{selected:n}=T9();return e.keepMounted||n?(0,G.jsx)(Zae,{...e,ref:t}):null}),Zae=H.memo(H.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=T9(),c=H.useRef(null),{transitionStatus:l,setMounted:u}=Aw(s),d=Vr(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:qv});return Mw({open:s,ref:c,onComplete(){s||u(!1)}}),d})),Qae=H.memo(H.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=T9(),{firstItemTextRef:a,selectedItemTextRef:o}=a9(),{render:s,className:c,style:l,...u}=e;return Vr(`div`,e,{ref:[H.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]),t,r],props:u})})),E9=H.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=a9(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=h9(),_=Cw(l,c?p9.scrollUpArrowVisible:p9.scrollDownArrowVisible),v=Cw(l,p9.openMethod),y=_&&v!==`touch`,b=rb(),x=c?g:h,{mounted:S,transitionStatus:C,setMounted:w}=Aw(y);Y(()=>(p.current+=1,l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.set(`hasScrollArrows`,!1)}),[l,p]),Mw({open:y,ref:x,onComplete(){y||w(!1)}});let T=Vr(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:C},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f(e);let n=oE(e.scrollHeight,e.clientHeight),r=sE(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=$ae(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s],stateAttributesMapping:qv});return S||o?T:null});function $ae(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?sE(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?sE(l.offsetTop+l.offsetHeight-r+i,a):a}var eoe=H.forwardRef(function(e,t){return(0,G.jsx)(E9,{...e,ref:t,direction:`down`})}),toe=H.forwardRef(function(e,t){return(0,G.jsx)(E9,{...e,ref:t,direction:`up`})}),D9=Pae;function O9({className:e,size:t=`default`,children:n,...r}){return(0,G.jsxs)(Rae,{className:W(tN(t),e),"data-slot":`select-trigger`,...r,children:[n,(0,G.jsx)(Vae,{"data-slot":`select-icon`,children:(0,G.jsx)(nN,{})})]})}function k9({className:e,...t}){return(0,G.jsx)(Bae,{className:W(`flex-1 truncate data-placeholder:text-muted-foreground`,e),"data-slot":`select-value`,...t})}function A9({className:e,children:t,sideOffset:n=4,alignItemWithTrigger:r=!0,zIndex:i,...a}){let o=H.useContext(VE);return(0,G.jsx)(Hae,{children:(0,G.jsx)(Wae,{alignItemWithTrigger:r,className:`select-none`,style:{zIndex:i??o},"data-slot":`select-positioner`,sideOffset:n,children:(0,G.jsxs)(Kae,{className:`origin-(--transform-origin) transition-[scale,opacity] has-data-[side=none]:scale-100 has-data-starting-style:scale-98 has-data-starting-style:opacity-0 has-data-[side=none]:transition-none`,"data-slot":`select-popup`,...a,children:[(0,G.jsx)(toe,{className:`top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover`,"data-slot":`select-scroll-up-arrow`,children:(0,G.jsx)(xt,{className:`relative size-4.5 sm:size-4`})}),(0,G.jsx)(`span`,{className:`relative block h-full rounded-lg border bg-popover bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-lg dark:not-in-data-[slot=group]:bg-clip-border`,children:(0,G.jsx)(Jae,{className:W(`max-h-(--available-height) min-w-(--anchor-width) overflow-y-auto p-1`,e),"data-slot":`select-list`,children:t})}),(0,G.jsx)(eoe,{className:`bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover`,"data-slot":`select-scroll-down-arrow`,children:(0,G.jsx)(vt,{className:`relative size-4.5 sm:size-4`})})]})})})}function j9({className:e,children:t,...n}){return(0,G.jsxs)(Yae,{className:W(`grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),"data-slot":`select-item`,...n,children:[(0,G.jsx)(Xae,{className:`col-start-1`,children:(0,G.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/1500/svg`,children:(0,G.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})}),(0,G.jsx)(Qae,{className:`col-start-2 min-w-0`,children:t})]})}function noe(e,t,n){return e.find(e=>e.id===t)?.id??e.find(e=>e.id===n)?.id??e[0]?.id??``}var M9={supervised:`受监督(每步确认)`,"auto-edits":`自动接受编辑`,full:`完全放行`,assistant:`助手代审`},N9={minimal:`极低`,low:`低`,medium:`中`,high:`高`,xhigh:`极高`,max:`最高`};function roe({projects:e,providers:t,open:n,preferredProjectId:r,onClose:i,onCreate:a}){let[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(`full`),[m,h]=(0,H.useState)(!1),[g,_]=(0,H.useState)(`medium`),[v,y]=(0,H.useState)(n);n!==v&&(y(n),n&&s(null));let b=noe(e,o,r),x=t.find(e=>e.id===c)??t[0]??{id:``,models:[]},S=x.id,C=x.models.find(e=>e.id===u)?.id??x.models[0]?.id??``,w=!!(b&&S&&C);return(0,G.jsx)(Y7,{open:n,onOpenChange:e=>!e&&i(),children:(0,G.jsxs)(X7,{side:`bottom`,className:`pb-safe`,children:[(0,G.jsx)(Z7,{children:(0,G.jsx)(Q7,{children:`新建会话`})}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4 pt-0`,children:[(0,G.jsx)(P9,{label:`项目`,children:(0,G.jsxs)(D9,{items:e.map(e=>({value:e.id,label:G7(e)})),value:b,onValueChange:e=>s(e),children:[(0,G.jsx)(O9,{className:`w-full`,children:(0,G.jsx)(k9,{})}),(0,G.jsx)(A9,{zIndex:BE.DROPDOWN_IN_MODAL,children:e.map(e=>(0,G.jsx)(j9,{value:e.id,children:G7(e)},e.id))})]})}),(0,G.jsx)(P9,{label:`模型服务`,children:(0,G.jsxs)(D9,{items:t.map(e=>({value:e.id,label:e.name})),value:S,onValueChange:e=>{l(e),d(null)},children:[(0,G.jsx)(O9,{className:`w-full`,children:(0,G.jsx)(k9,{})}),(0,G.jsx)(A9,{zIndex:BE.DROPDOWN_IN_MODAL,children:t.map(e=>(0,G.jsx)(j9,{value:e.id,children:e.name},e.id))})]})}),(0,G.jsx)(P9,{label:`模型`,children:(0,G.jsxs)(D9,{items:x.models.map(e=>({value:e.id,label:e.label??e.id})),value:C,onValueChange:e=>d(e),children:[(0,G.jsx)(O9,{className:`w-full`,children:(0,G.jsx)(k9,{})}),(0,G.jsx)(A9,{zIndex:BE.DROPDOWN_IN_MODAL,children:x.models.map(e=>(0,G.jsx)(j9,{value:e.id,children:e.label??e.id},e.id))})]})}),(0,G.jsx)(P9,{label:`审批模式`,children:(0,G.jsxs)(D9,{items:Object.keys(M9).map(e=>({value:e,label:M9[e]})),value:f,onValueChange:e=>p(e),children:[(0,G.jsx)(O9,{className:`w-full`,children:(0,G.jsx)(k9,{})}),(0,G.jsx)(A9,{zIndex:BE.DROPDOWN_IN_MODAL,children:Object.keys(M9).map(e=>(0,G.jsx)(j9,{value:e,children:M9[e]},e))})]})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`推理`}),(0,G.jsx)(CN,{checked:m,onCheckedChange:h})]}),m&&(0,G.jsx)(P9,{label:`推理档位`,children:(0,G.jsxs)(D9,{items:Object.keys(N9).map(e=>({value:e,label:N9[e]})),value:g,onValueChange:e=>_(e),children:[(0,G.jsx)(O9,{className:`w-full`,children:(0,G.jsx)(k9,{})}),(0,G.jsx)(A9,{zIndex:BE.DROPDOWN_IN_MODAL,children:Object.keys(N9).map(e=>(0,G.jsx)(j9,{value:e,children:N9[e]},e))})]})}),e.length===0&&(0,G.jsx)(`p`,{className:`text-destructive text-xs`,children:`桌面端还没有项目,请先在桌面添加。`}),e.length>0&&t.length===0&&(0,G.jsx)(`p`,{className:`text-destructive text-xs`,children:`桌面端没有可用的模型服务。`}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-1`,children:[(0,G.jsx)(Oa,{variant:`outline`,onClick:i,children:`取消`}),(0,G.jsx)(Oa,{disabled:!w,onClick:()=>a({projectId:b,providerId:S,modelId:C,approvalMode:f,...m?{reasoningEnabled:m,thinkingLevel:g}:{}}),children:`创建`})]})]})]})})}function P9({label:e,children:t}){return(0,G.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e}),t]})}var ioe={pending:`待发送`,sending:`发送中…`,failed:`发送失败`};function aoe({items:e,readOnly:t,onRetry:n,onDiscard:r}){return e.length===0?null:(0,G.jsx)(`div`,{className:`mb-1 space-y-1`,children:e.map(e=>(0,G.jsxs)(`div`,{className:W(`flex flex-wrap items-center gap-2 rounded-xl border px-2.5 py-1.5 text-xs`,e.status===`failed`?`border-destructive/40 bg-destructive/5`:`bg-muted/40`),children:[(0,G.jsx)(`span`,{className:W(`min-w-0 flex-1`,e.status===`failed`?`whitespace-pre-wrap break-words select-text`:`truncate`),children:e.text||(e.images?.length?`[${e.images.length} 张图片]`:``)}),(0,G.jsxs)(`span`,{className:W(`min-w-0 break-words`,e.status===`failed`?`text-destructive`:`text-muted-foreground`),children:[e.error?.startsWith(`outbox-discard`)?`移除消息`:e.error===`delivery-unconfirmed`?`结果未确认`:ioe[e.status],e.status===`failed`&&e.error?`:${tae(e.error)}`:``]}),e.status===`failed`&&!e.error?.startsWith(`outbox-discard`)&&!t&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`重试`,onClick:()=>n(e.deliveryId),className:`shrink-0 rounded p-0.5 text-foreground hover:bg-accent`,children:(0,G.jsx)(Pn,{className:`h-3.5 w-3.5`})}),e.status!==`sending`&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`删除`,disabled:e.error===`outbox-discarding`,onClick:()=>r(e.deliveryId),className:`shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent`,children:(0,G.jsx)(ir,{className:`h-3.5 w-3.5`})})]},e.deliveryId))})}function ooe(){let e=globalThis.BarcodeDetector;if(!e)return null;let t=new e({formats:[`qr_code`]});return{async scan(e){return(await t.detect(e))[0]?.rawValue??null}}}async function soe(){let{default:t}=await q(async()=>{let{default:t}=await import(`./jsQR-B1eQcpQl.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([148,1])),n=document.createElement(`canvas`),r=n.getContext(`2d`,{willReadFrequently:!0});return{async scan(e){if(!r||!e.videoWidth)return null;let i=Math.min(1,640/Math.max(e.videoWidth,e.videoHeight));n.width=Math.round(e.videoWidth*i),n.height=Math.round(e.videoHeight*i),r.drawImage(e,0,0,n.width,n.height);let{data:a,width:o,height:s}=r.getImageData(0,0,n.width,n.height);return t(a,o,s,{inversionAttempts:`dontInvert`})?.data??null}}}async function coe(){return ooe()??await soe()}function loe(e){try{return De(e),!0}catch{return!1}}function uoe({onPaired:e,autoInvite:t,onCancel:n,notice:r}){let[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(!1),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=()=>{for(let e of p.current?.getTracks()??[])e.stop();p.current=null,d(!1)},h=async t=>{s(!0),l(null);try{let n=De(t),r=/iPhone|iPad|Android/i.exec(navigator.userAgent)?.[0]??`Phone`,i=await Ae(n.relay,n.publicKey,r);e({pairId:i.pairId,token:i.deviceToken,contentKey:btoa(String.fromCharCode(...i.contentKey)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``),deviceName:r,relayUrl:n.relay,pairedAt:Date.now()})}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}},g=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!t||g.current||(g.current=!0,h(t))},[t]);let _=(0,H.useRef)(()=>{});_.current=e=>{m(),h(e)};let v=async()=>{l(null);try{p.current=await navigator.mediaDevices.getUserMedia({video:{facingMode:`environment`}}),d(!0)}catch(e){l(window.isSecureContext?e instanceof DOMException&&e.name===`NotAllowedError`?`摄像头权限被拒绝,请在浏览器设置中允许后重试`:`无法访问摄像头,请粘贴配对码`:`扫码需要 HTTPS 环境,请改用粘贴配对码`),d(!1)}};return(0,H.useEffect)(()=>{if(!u)return;let e=f.current,t=p.current;if(!e||!t)return;let n=!1,r=0;return e.srcObject=t,e.muted=!0,(async()=>{try{await e.play();let t=await coe(),i=async()=>{if(!(n||!p.current)){try{let n=await t.scan(e);if(n&&loe(n)){_.current(n);return}}catch{}r=requestAnimationFrame(()=>void i())}};await i()}catch{n||l(`无法开始预览,请粘贴配对码`)}})(),()=>{n=!0,cancelAnimationFrame(r)}},[u]),(0,G.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-5 px-6 pt-safe pb-safe`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 text-center`,children:[(0,G.jsx)(`span`,{className:`mb-2 flex size-11 items-center justify-center rounded-[13px] border border-brand/20 bg-brand/8 text-brand dark:bg-brand/14`,children:(0,G.jsx)(VN,{className:`size-6`})}),(0,G.jsx)(`h1`,{className:`font-medium text-lg`,children:`连接到 EnsoCode`}),(0,G.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`在桌面端「设置 → 手机」生成配对码,扫码或粘贴。`}),r?(0,G.jsx)(`p`,{role:`status`,className:`mt-2 max-w-sm rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-left text-amber-700 text-xs dark:text-amber-300`,children:r}):null]}),u?(0,G.jsxs)(`div`,{className:`w-full max-w-sm space-y-2`,children:[(0,G.jsx)(`video`,{ref:f,playsInline:!0,muted:!0,className:`aspect-square w-full rounded-lg bg-black object-cover`}),(0,G.jsx)(Oa,{variant:`outline`,className:`w-full`,onClick:m,children:`取消扫码`})]}):(0,G.jsxs)(Oa,{className:`w-full max-w-sm`,onClick:()=>void v(),children:[(0,G.jsx)(gt,{className:`mr-1.5 h-4 w-4`}),`扫描二维码`]}),(0,G.jsxs)(`div`,{className:`flex w-full max-w-sm items-center gap-2`,children:[(0,G.jsx)(eG,{value:i,onChange:e=>a(e.target.value),placeholder:`enso://pair?relay=…`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:`font-mono text-xs`}),(0,G.jsx)(Oa,{variant:`outline`,className:`shrink-0`,disabled:o||!i.trim(),onClick:()=>void h(i.trim()),children:o?(0,G.jsx)(cn,{className:`h-4 w-4 animate-spin`}):`配对`})]}),c&&(0,G.jsx)(`p`,{className:`max-w-sm text-center text-destructive text-xs`,children:c}),n&&(0,G.jsx)(Oa,{variant:`ghost`,className:`w-full max-w-sm`,onClick:n,children:`返回`})]})}var F9={minimal:`极低`,low:`低`,medium:`中`,high:`高`,xhigh:`极高`,max:`最高`};function doe({providers:e,config:t,open:n,onClose:r,onSetModel:i,onSetReasoning:a,onSetThinking:o}){let s=e.find(e=>e.id===t.providerId),c=t.reasoningEnabled??!1,l=t.thinkingLevel??`medium`;return(0,G.jsx)(Y7,{open:n,onOpenChange:e=>!e&&r(),children:(0,G.jsxs)(X7,{side:`bottom`,className:`pb-safe`,children:[(0,G.jsx)(Z7,{children:(0,G.jsx)(Q7,{children:`会话设置`})}),(0,G.jsxs)(`div`,{className:`space-y-4 p-4 pt-0`,children:[(0,G.jsx)(I9,{label:`模型服务`,children:(0,G.jsxs)(D9,{items:e.map(e=>({value:e.id,label:e.name})),value:t.providerId??``,onValueChange:t=>{let n=e.find(e=>e.id===t),r=n?.models[0]?.id;n&&r&&i(n.id,r)},children:[(0,G.jsx)(O9,{className:`w-full`,children:(0,G.jsx)(k9,{})}),(0,G.jsx)(A9,{zIndex:BE.DROPDOWN_IN_MODAL,children:e.map(e=>(0,G.jsx)(j9,{value:e.id,children:e.name},e.id))})]})}),(0,G.jsx)(I9,{label:`模型`,children:(0,G.jsxs)(D9,{items:(s?.models??[]).map(e=>({value:e.id,label:e.label??e.id})),value:t.modelId??``,onValueChange:e=>{t.providerId&&i(t.providerId,e)},children:[(0,G.jsx)(O9,{className:`w-full`,children:(0,G.jsx)(k9,{})}),(0,G.jsx)(A9,{zIndex:BE.DROPDOWN_IN_MODAL,children:(s?.models??[]).map(e=>(0,G.jsx)(j9,{value:e.id,children:e.label??e.id},e.id))})]})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`推理`}),(0,G.jsx)(CN,{checked:c,onCheckedChange:a})]}),c&&(0,G.jsx)(I9,{label:`推理档位`,children:(0,G.jsxs)(D9,{items:Object.keys(F9).map(e=>({value:e,label:F9[e]})),value:l,onValueChange:e=>o(e),children:[(0,G.jsx)(O9,{className:`w-full`,children:(0,G.jsx)(k9,{})}),(0,G.jsx)(A9,{zIndex:BE.DROPDOWN_IN_MODAL,children:Object.keys(F9).map(e=>(0,G.jsx)(j9,{value:e,children:F9[e]},e))})]})}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`模型切换对运行中的会话在下次启动时生效;推理档位即时生效。`})]})]})})}function I9({label:e,children:t}){return(0,G.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e}),t]})}var L9=`__all__`,foe=`__ungrouped__`;function R9(e){return new Set(e.map(e=>e.id))}function z9(e,t){return t.includes(e)}function poe(e,t){let n=e.groupId;return!n||!R9(t).has(n)}function moe(e,t,n,r){let i=e.filter(e=>!z9(e.id,n));return r===`__all__`||r===`__recent__`?i:r===`__ungrouped__`?i.filter(e=>poe(e,t)):i.filter(e=>e.groupId===r)}function hoe(e,t,n){let r=e.filter(e=>!z9(e.id,n)),i=[...t].sort((e,t)=>e.order-t.order),a=R9(t),o=i.map(e=>({groupId:e.id,group:e,projects:r.filter(t=>t.groupId===e.id)})),s=r.filter(e=>!e.groupId||!a.has(e.groupId));return s.length>0&&o.push({groupId:foe,projects:s}),o}var goe=`default`;function _oe(e,t){return e===`__recent__`?{kind:`all`,fallbackFrom:`recent`}:e===`__ungrouped__`?{kind:`ungrouped`}:e!==`__all__`&&t.some(t=>t.id===e)?{kind:`group`,groupId:e}:{kind:`all`}}var voe=e=>e?.secretaryOrigin?e.secretaryOrigin.secretaryId??goe:void 0;function yoe(e,t,{projects:n,projectGroups:r,conversations:i}){switch(t.kind){case`all`:return[...e];case`secretary`:return e.map(e=>({...e,ids:e.ids.filter(e=>voe(i[e])===t.secretaryId)})).filter(e=>e.ids.length>0);default:{let i=new Set(r.map(e=>e.id));return e.filter(e=>{let r=n.find(t=>t.id===e.projectId)?.groupId;return t.kind===`group`?r===t.groupId:!r||!i.has(r)})}}}function boe(e){return e.status===`failed`&&!e.spawning?`failed`:e.queued?`queued`:(e.pendingAskCount??0)>0?`waiting`:e.status===`running`||e.spawning||e.hasRunningChild?`running`:e.hasPendingReminder?`reminder`:e.unread?`unread`:`idle`}function B9(e){return[...e].sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))}function V9(e){let t=e=>(e.pendingAskCount??0)>0||(e.pendingApprovalCount??0)>0;return[...e.filter(t),...e.filter(e=>!t(e))]}function xoe(e,t){let n=B9(e),r=new Map(n.map(e=>[e.id,e])),i=[];for(let e of t){let t=r.get(e);t&&(i.push(t),r.delete(e))}return[...i,...V9([...r.values()])]}function H9(e){return V9([...B9(e.filter(e=>e.pinned)),...B9(e.filter(e=>!e.pinned))])}function U9(e,t){return boe({status:e.queueFailed?`failed`:e.status,unread:e.unread,pendingAskCount:e.pendingAskCount,hasRunningChild:t,queued:e.status===`queued`&&!e.queueFailed||e.parked===`upstream`,hasPendingReminder:e.parked===`reminder`})}function Soe(e,t){return U9(e,t)!==`idle`||e.goal?.status===`active`}function Coe(e,t){let n=B9(e.filter(e=>Soe(e,t(e.id)))),r=e=>{let n=U9(e,t(e.id));return n===`queued`||n===`reminder`};return[...n.filter(e=>!r(e)),...n.filter(r)]}function W9(e,t){return e<=0?0:Math.min(e,5+Math.max(0,t))}function woe(e,t){return W9(e,t)>=e?0:Math.min(Math.max(0,e-5),t+15)}function Toe(e){return Math.max(0,e-15)}var Eoe=[{value:`auto`,label:`跟随桌面`},{value:`light`,label:`浅`},{value:`dark`,label:`深`}];function Doe({open:e,docked:t=!1,pinnable:n=!1,onTogglePinned:r,projects:i,groups:a=[],catalog:o,pinnedOrder:s=[],activeId:c,canCreate:l,devices:u,activeDevicePairId:d,remoteDesktop:f,connected:p,connectionLabel:m,pushEnabled:g,pushBusy:v,pushError:y,pushAvailability:b,pushConfigReady:x,onTogglePush:S,onClose:C,onSelect:w,onNewConversation:T,onSwitchDevice:E,onAddDevice:D,onRenameDevice:O,onUnpairDevice:k,botSegment:A}){let j=A?.active===!0,[M,N]=(0,H.useState)({}),[P,F]=(0,H.useState)({}),[I,ee]=(0,H.useState)(!1),[L,te]=(0,H.useState)(!1),[R,B]=(0,H.useState)(null),ne=f?u.find(e=>e.pairId===d&&e.scope!==`read`):void 0,[re,ie]=(0,H.useState)(_),[ae,oe]=(0,H.useState)(()=>{try{return localStorage.getItem(`enso-phone-selected-project-group`)??`__all__`}catch{return L9}}),[se,ce]=(0,H.useState)({}),ue=ae===`__all__`||ae===`__ungrouped__`||a.some(e=>e.id===ae)?ae:L9;(0,H.useEffect)(()=>te(!1),[ue]),(0,H.useEffect)(()=>h(()=>ie(_())),[]),(0,H.useEffect)(()=>{e||B(null)},[e]);let[de,fe]=(0,H.useState)(()=>Date.now());(0,H.useEffect)(()=>{if(!e)return;fe(Date.now());let t=setInterval(()=>fe(Date.now()),6e4);return()=>clearInterval(t)},[e]);let pe=new Set(i.filter(e=>e.archived).map(e=>e.id)),me=[...pe],he=e=>e.archived||pe.has(e.projectId),ge=moe(i,a,me,ue),_e=hoe(i,a,me),ve=new Set(ge.map(e=>e.id)),ye=o.filter(e=>!e.parentId),be=e=>!e.projectId||ve.has(e.projectId),xe=Coe(ye.filter(e=>!he(e)&&be(e)),e=>o.some(t=>t.parentId===e&&t.status===`running`)),Se=xoe(ye.filter(e=>e.pinned&&!he(e)&&be(e)),s),Ce=B9(ye.filter(he)),we=_oe(ue,a),Te=new Set(yoe(Ce.map(e=>({projectId:e.projectId,ids:[e.id]})),we,{projects:i,projectGroups:a,conversations:{}}).flatMap(e=>e.ids)),Ee=Ce.filter(e=>Te.has(e.id)),De=we.kind!==`all`,Oe=L?Ce:Ee,ke=!De||L?`范围:全部归档`:we.kind===`group`?`范围:分组「${a.find(e=>e.id===we.groupId)?.name??``}」的归档`:`范围:未分组项目的归档`,Ae=ye.filter(e=>!he(e)),je=new Set(i.map(e=>e.id)),Me=H9(Ae.filter(e=>!je.has(e.projectId)));return(0,G.jsxs)(G.Fragment,{children:[!t&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`关闭侧栏`,onClick:C,className:W(`fixed inset-0 z-40 bg-black/40 transition-[opacity,visibility] duration-200`,e?`visible opacity-100`:`invisible pointer-events-none opacity-0`)}),(0,G.jsxs)(`aside`,{className:W(`flex shrink-0 flex-col border-r bg-background`,t?`relative h-full w-72`:W(`fixed inset-y-0 left-0 z-50 w-[82vw] max-w-xs transition-transform duration-200`,e?`translate-x-0`:`-translate-x-full`)),children:[(0,G.jsxs)(`div`,{className:W(`flex h-12 shrink-0 items-center justify-between px-3 pt-safe`,a.length===0&&`border-b`),children:[A?(0,G.jsx)(`span`,{className:`flex rounded-lg bg-muted p-0.5 text-sm`,children:[`项目`,`Bot`].map(e=>{let t=e===`Bot`===A.active;return(0,G.jsx)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>A.onChange(e===`Bot`),className:W(`rounded-md px-3 py-0.5 transition-colors`,t?`bg-background font-medium shadow-xs`:`text-muted-foreground`),children:e},e)})}):(0,G.jsx)(`span`,{className:`font-medium text-sm`,children:`项目`}),t?n&&r?(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`收起侧栏`,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,G.jsx)(bn,{className:`h-4 w-4`})}):null:(0,G.jsxs)(`span`,{className:`flex items-center`,children:[n&&r&&(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`固定侧栏`,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,G.jsx)(xn,{className:`h-4 w-4`})}),(0,G.jsx)(`button`,{type:`button`,onClick:C,"aria-label":`关闭侧栏`,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,G.jsx)(ir,{className:`h-4 w-4`})})]})]}),!j&&a.length>0&&(0,G.jsx)(`div`,{className:`shrink-0 border-b px-3 pb-2`,children:(0,G.jsxs)(D9,{items:[{value:`__all__`,label:`全部`},...a.slice().sort((e,t)=>e.order-t.order).map(e=>({value:e.id,label:`${e.emoji?`${e.emoji} `:``}${e.name}`})),{value:`__ungrouped__`,label:`未分组`}],value:ue,onValueChange:e=>{if(e){oe(e);try{localStorage.setItem(`enso-phone-selected-project-group`,e)}catch{}}},children:[(0,G.jsx)(O9,{className:`w-full`,size:`sm`,children:(0,G.jsx)(k9,{})}),(0,G.jsxs)(A9,{zIndex:BE.DROPDOWN_IN_MODAL,children:[(0,G.jsx)(j9,{value:`__all__`,children:`全部`}),a.slice().sort((e,t)=>e.order-t.order).map(e=>(0,G.jsxs)(j9,{value:e.id,children:[e.emoji?`${e.emoji} `:``,e.name]},e.id)),(0,G.jsx)(j9,{value:`__ungrouped__`,children:`未分组`})]})]})}),j?A?.panel:(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2`,children:[i.length===0&&(0,G.jsx)(`p`,{className:`rounded-lg border border-dashed px-3 py-6 text-center text-muted-foreground text-sm`,children:`桌面端还没有项目`}),xe.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1.5 px-2 py-2`,children:(0,G.jsx)(`span`,{className:`font-medium text-sm`,children:`活跃中`})}),(0,G.jsx)(`div`,{className:`flex flex-col gap-y-0.5`,children:xe.map(e=>(0,G.jsx)(G9,{session:e,active:c===e.id,nowTick:de,onSelect:w},e.id))})]}),Se.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-2`,children:[(0,G.jsx)(Tn,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`font-medium text-sm`,children:`置顶`})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-y-0.5`,children:Se.map(e=>(0,G.jsx)(G9,{session:e,active:c===e.id,nowTick:de,onSelect:w},e.id))})]}),(ue===`__all__`&&a.length>0?_e.flatMap(e=>{let t=se[e.groupId]===!0;return[{kind:`header`,section:e,folded:t},...t?[]:e.projects.map(e=>({kind:`project`,project:e}))]}):ge.map(e=>({kind:`project`,project:e}))).map(e=>e.kind===`header`?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>ce(t=>({...t,[e.section.groupId]:!t[e.section.groupId]})),className:`flex h-7 w-full items-center gap-1 rounded-md px-2 text-left text-xs font-medium text-muted-foreground`,children:[(0,G.jsx)(yt,{className:W(`h-3.5 w-3.5 shrink-0 transition-transform duration-150`,!e.folded&&`rotate-90`)}),e.section.group?.emoji&&(0,G.jsx)(`span`,{className:`shrink-0 text-sm`,children:e.section.group.emoji}),e.section.group?.color&&(0,G.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:e.section.group.color}}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.section.group?.name??`未分组`}),(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground/70`,children:e.section.projects.length})]},`hdr-${e.section.groupId}`):(0,G.jsx)(K9,{name:W7(e.project),badge:U7(e.project),sessions:H9(Ae.filter(t=>t.projectId===e.project.id)),folded:M[e.project.id]===!0,revealedExtra:P[e.project.id]??0,activeId:c,nowTick:de,canCreate:l,onToggleFold:()=>N(t=>({...t,[e.project.id]:!t[e.project.id]})),onRevealMore:t=>F(n=>({...n,[e.project.id]:t})),onSelect:w,onNew:()=>T(e.project.id)},e.project.id)),Me.length>0&&(0,G.jsx)(K9,{name:`其他`,sessions:Me,folded:M.__orphan===!0,revealedExtra:P.__orphan??0,activeId:c,nowTick:de,canCreate:!1,onToggleFold:()=>N(e=>({...e,__orphan:!e.__orphan})),onRevealMore:e=>F(t=>({...t,__orphan:e})),onSelect:w})]}),!j&&(0,G.jsxs)(`div`,{className:`shrink-0 border-t p-2`,children:[I&&(0,G.jsxs)(`div`,{className:`mb-0.5 flex max-h-64 flex-col gap-y-0.5 overflow-y-auto`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1`,children:[(0,G.jsx)(`span`,{"data-slot":`archive-scope`,className:`min-w-0 flex-1 truncate text-[11px] text-muted-foreground`,children:ke}),De&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>te(e=>!e),className:`shrink-0 rounded-full border px-2 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted/60`,children:L?`仅本分组`:`全部归档`})]}),Oe.length===0&&(0,G.jsx)(`p`,{className:`px-2 py-3 text-center text-muted-foreground text-xs`,children:`没有归档会话`}),Oe.map(e=>(0,G.jsx)(G9,{session:e,active:c===e.id,nowTick:de,subtitle:(()=>{let t=i.find(t=>t.id===e.projectId);return t?W7(t):void 0})(),onSelect:w},e.id))]}),(0,G.jsxs)(`button`,{type:`button`,"data-slot":`archived-button`,"data-empty":Ee.length===0||void 0,onClick:()=>ee(e=>!e),className:W(`flex w-full items-center gap-1 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60`,Ee.length===0&&`opacity-55`),children:[(0,G.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center`,children:(0,G.jsx)(yt,{className:W(`h-3.5 w-3.5 text-muted-foreground transition-transform duration-200`,I?`-rotate-90`:`rotate-0`)})}),(0,G.jsx)(at,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground text-sm`,children:`已归档`}),(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground tabular-nums`,children:Ee.length})]})]}),(0,G.jsxs)(`div`,{className:`shrink-0 space-y-1 border-t p-2 pb-safe`,children:[!R&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,G.jsx)(yn,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:`主题`}),(0,G.jsx)(`div`,{className:`flex shrink-0 gap-0.5 rounded-md border p-0.5`,children:Eoe.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>z(e.value),className:W(`rounded px-2 py-1 text-[11px] transition-colors`,re===e.value?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-accent`),children:e.label},e.value))})]}),!R&&ne&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,G.jsx)(gn,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:`界面`}),(0,G.jsxs)(`div`,{className:`flex shrink-0 gap-0.5 rounded-md border p-0.5`,children:[(0,G.jsx)(`span`,{className:`rounded bg-primary px-2 py-1 text-[11px] text-primary-foreground`,children:`精简`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{window.location.href=V(ne.pairId)},className:`rounded px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-accent`,children:`完整`})]})]}),!R&&(0,G.jsxs)(`div`,{className:`px-2 py-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ft,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:`推送通知`}),(0,G.jsx)(CN,{checked:g,disabled:v||b!==`ok`||!p||!x,onCheckedChange:S})]}),le({busy:v,error:y,availability:b,connected:p,configReady:x}).map(e=>(0,G.jsx)(`p`,{className:W(`mt-1 pl-6 text-[11px]`,e.error?`text-destructive`:`text-muted-foreground`),children:e.text},e.text))]}),(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[u.map(e=>{let t=e.pairId===d;return R===e.pairId?(0,G.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-dashed p-3`,children:[(0,G.jsxs)(`p`,{className:`text-xs`,children:[`解绑「`,e.label,`」后需重新扫码才能连接,确定吗?`]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(Oa,{variant:`outline`,size:`sm`,onClick:()=>B(null),children:`取消`}),(0,G.jsx)(Oa,{variant:`destructive`,size:`sm`,onClick:()=>{B(null),k(e.pairId)},children:`确定解绑`})]})]},e.pairId):(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>E(e.pairId),className:W(`flex min-w-0 flex-1 items-center gap-2 rounded-lg px-2 py-2 text-left text-sm transition-colors hover:bg-muted/60`,t?`text-foreground`:`text-muted-foreground`),children:[(0,G.jsx)(an,{className:`h-4 w-4 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),t&&(0,G.jsx)(`span`,{className:W(`shrink-0 text-[10px]`,p?`text-muted-foreground`:`text-destructive`),children:m})]}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`重命名 ${e.label}`,onClick:()=>{let t=window.prompt(`给这台电脑起个名:`,e.label);t?.trim()&&O(e.pairId,t)},className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground`,children:(0,G.jsx)(wn,{className:`h-3.5 w-3.5`})}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`解绑 ${e.label}`,onClick:()=>B(e.pairId),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-colors hover:bg-accent hover:text-destructive`,children:(0,G.jsx)($n,{className:`h-3.5 w-3.5`})})]},e.pairId)}),(0,G.jsxs)(`button`,{type:`button`,onClick:D,className:`flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-muted-foreground text-sm transition-colors hover:bg-muted/60 hover:text-foreground`,children:[(0,G.jsx)(On,{className:`h-4 w-4 shrink-0`}),(0,G.jsx)(`span`,{children:`配对新电脑`})]})]}),(0,G.jsxs)(`p`,{className:`px-2 pt-0.5 text-center text-[10px] text-muted-foreground/60`,children:[`版本 `,`5182bae-dirty`]})]})]})]})}function G9({session:e,active:t,nowTick:n,subtitle:r,onSelect:i}){return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:W(`flex w-full items-center gap-2 rounded-lg py-2 pr-2 pl-4 text-left text-sm transition-colors`,t?`bg-brand/10 dark:bg-brand/15`:`hover:bg-muted/60`),children:[(0,G.jsx)(Ooe,{status:e.status,unread:e.unread,conversationId:e.id,queuePosition:e.queuePosition,queueFailed:e.queueFailed}),e.pinned&&(0,G.jsx)(Tn,{className:`h-3 w-3 shrink-0 text-muted-foreground`,"aria-hidden":!0}),e.muted&&(0,G.jsx)(dt,{className:`h-3 w-3 shrink-0 text-muted-foreground`,"aria-label":`静音`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.title||`新对话`,r&&(0,G.jsx)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:r})]}),e.updatedAt&&(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground/80 tabular-nums`,children:$7(e.updatedAt,`zh`,n)})]})}function K9({name:e,badge:t,sessions:n,folded:r,revealedExtra:i,activeId:a,nowTick:o,canCreate:s,onToggleFold:c,onRevealMore:l,onSelect:u,onNew:d}){let{t:f}=K(),p=W9(n.length,i),m=n.slice(0,p),h=n.length-p;return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex w-full items-center gap-1 rounded-lg px-2 py-2 transition-colors hover:bg-muted/60`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:c,className:`flex min-w-0 flex-1 items-center gap-1 text-left`,children:[(0,G.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center`,children:(0,G.jsx)(yt,{className:W(`h-3.5 w-3.5 text-muted-foreground transition-transform duration-200`,!r&&`rotate-90`)})}),(0,G.jsx)(Gt,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-sm`,children:[e,t&&(0,G.jsx)(`span`,{className:`ml-1.5 rounded bg-muted px-1 py-0.5 text-[10px] font-normal text-muted-foreground`,children:t})]}),(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground tabular-nums`,children:n.length})]}),s&&d&&(0,G.jsx)(`button`,{type:`button`,onClick:d,className:`shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,G.jsx)(fn,{className:`h-3.5 w-3.5`})})]}),!r&&(0,G.jsxs)(`div`,{className:`mt-0.5 flex flex-col gap-y-0.5`,children:[m.map(e=>(0,G.jsx)(G9,{session:e,active:a===e.id,nowTick:o,onSelect:u},e.id)),n.length>5&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[h>0&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>l(woe(n.length,i)),className:`flex-1 rounded-lg py-1 text-center text-muted-foreground text-xs transition-colors hover:bg-muted/60 hover:text-foreground`,children:f(`Show {{n}} more`,{n:h})}),i>0&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>l(Toe(i)),className:`flex-1 rounded-lg py-1 text-center text-muted-foreground text-xs transition-colors hover:bg-muted/60 hover:text-foreground`,children:f(`Collapse`)})]})]})]})}function Ooe({status:e,unread:t,conversationId:n,queuePosition:r,queueFailed:i}){let{t:a}=K();if(e===`queued`&&!i){let e=a(`Queued · #{{n}}, starts automatically when a slot opens`,{n:r??1});return(0,G.jsx)(it,{className:`h-3.5 w-3.5 shrink-0 text-orange-500`,"aria-label":e,title:e,"data-enso":`conversation-queued`,"data-conversation-id":n,"data-tone":`queued`})}let o=e===`running`,s=!o&&(e===`failed`||e===`queued`&&!!i),c=!o&&!s&&t===!0;return(0,G.jsx)(`span`,{title:i,className:W(`h-1.5 w-1.5 shrink-0 rounded-full`,o&&`animate-pulse bg-brand`,s&&`bg-destructive`,c&&`bg-green-500`,!o&&!s&&!c&&`bg-muted-foreground/30`)})}function koe(e,t){return e?t.some(e=>e.status===`running`||typeof e.pendingAskCount==`number`&&e.pendingAskCount>0||typeof e.pendingApprovalCount==`number`&&e.pendingApprovalCount>0):!1}var q9=null;async function J9(e,t=typeof navigator>`u`?void 0:navigator.wakeLock){if(!e||!t){if(!q9)return;let e=q9;q9=null;try{await e.release()}catch{}return}if(!q9)try{let e=await t.request(`screen`);q9=e,e.addEventListener(`release`,()=>{q9===e&&(q9=null)})}catch{q9=null}}function Aoe(){if(!window.location.hash.replace(/^#/,``).includes(`pk=`))return null;let e=window.location.href;return history.replaceState(null,``,window.location.pathname+window.location.search),e}var Y9=`enso-phone-sidebar-pinned`,joe=L();function Moe(){let e=k(window.location.search);if(!e)return null;let t=new URLSearchParams(window.location.search);t.delete(`session`);let n=t.toString();return history.replaceState(null,``,window.location.pathname+(n?`?${n}`:``)),e}function Noe(){return de()?`ok`:/iphone|ipad|ipod/i.test(navigator.userAgent)&&!ne()?`needs-install`:`unsupported`}function Poe(){let[e,t]=(0,H.useState)(F),[n,i]=(0,H.useState)(Ne),o=x(e,n),[c]=(0,H.useState)(Aoe),[u]=(0,H.useState)(ye),[f,m]=(0,H.useState)(u),[h,g]=(0,H.useState)(null),_=o!==null;(0,H.useEffect)(()=>{if(_)return;let e=!1;return r().then(t=>{e||g(C({paired:!1,marked:t,standalone:ne()}))}),()=>{e=!0}},[_]);let[b,S]=(0,H.useState)(`connecting`),[w,T]=(0,H.useState)(`relay`),[E,O]=(0,H.useState)(null),[k,A]=(0,H.useState)([]),[M,P]=(0,H.useState)([]),[I,ee]=(0,H.useState)([]),[L,z]=(0,H.useState)([]),[B,re]=(0,H.useState)([]),[ae]=(0,H.useState)(Moe),[oe]=(0,H.useState)(()=>d(o?.pairId??null,ae)),[ce,le]=(0,H.useState)(oe.activeId),[ue,de]=(0,H.useState)(null),[pe,me]=(0,H.useState)(!1),[he,ge]=(0,H.useState)(new Set),[ve,be]=(0,H.useState)([]),[Se,Ce]=(0,H.useState)(!1),we=Eae(Dae),[Te,De]=(0,H.useState)(()=>localStorage.getItem(Y9)!==`off`),Oe=we&&Te,ke=()=>{De(e=>(localStorage.setItem(Y9,e?`off`:`on`),!e))},[Ae,je]=(0,H.useState)(!1),[Me,Pe]=(0,H.useState)(null),[Le,Re]=(0,H.useState)(!1),[Be,Ve]=(0,H.useState)(()=>localStorage.getItem(fe)===`on`),[He,Ue]=(0,H.useState)(!1),[We,Ge]=(0,H.useState)(!1),[Ke,qe]=(0,H.useState)(!1),[Ye,Xe]=(0,H.useState)(!1),[Ze,Qe]=(0,H.useState)(!1),[$e,et]=(0,H.useState)(null),[tt,nt]=(0,H.useState)(!1),[rt,U]=(0,H.useState)(!1),[it,at]=(0,H.useState)(!1),ot=(0,H.useRef)(!1),[st,ct]=(0,H.useState)(!1),[lt,ut]=(0,H.useState)(!1),dt=(0,H.useRef)(!1),[ft,pt]=(0,H.useState)([]),[mt,ht]=(0,H.useState)([]),[gt,_t]=(0,H.useState)([]),[vt,yt]=(0,H.useState)(!1),[bt,xt]=(0,H.useState)([]),[St,Ct]=(0,H.useState)({items:[],offset:0}),[wt,Tt]=(0,H.useState)(()=>q7(!0,oe.botChatId)),[Et,Dt]=(0,H.useState)(oe.botChatId),[Ot,kt]=(0,H.useState)(null),[At,jt]=(0,H.useState)({}),[Mt,Nt]=(0,H.useState)({}),[Pt,Ft]=(0,H.useState)({}),[It,Lt]=(0,H.useState)(null),Rt=(0,H.useRef)(null),zt=(0,H.useMemo)(()=>new Wa(e=>Wt.current?.send(e)),[]),Bt=(0,H.useMemo)(()=>new ms(e=>Wt.current?.send(e)),[]),Vt=(0,H.useMemo)(()=>new gs(e=>Wt.current?.send(e)),[]),[Ht,Ut]=(0,H.useState)([]),Wt=(0,H.useRef)(null),Gt=(0,H.useRef)(ce),Kt=(0,H.useRef)(k),qt=(0,H.useRef)(ue);Kt.current=k,qt.current=ue,Gt.current=ce;let Jt=Et?gt.find(e=>e.id===Et):void 0,Yt=Jt?.kind===`group`?qo(Jt,ft):void 0,Xt=Yt?.current??Jt,Zt=Jt?.kind===`direct`?Jt.sessions[Jt.members[0]]?.conversationId??null:null,Qt=Et?Zt??Ot:ce,$t=(0,H.useRef)(Qt);$t.current=Qt;let en=(0,H.useRef)(gt);en.current=gt;let tn=(0,H.useRef)(Et);tn.current=Et;let nn=(0,H.useRef)(null);nn.current=Yt?.current.id??null;let rn=(0,H.useRef)(new Set);rn.current=new Set(Yt?Object.values(Yt.current.sessions).map(e=>e.conversationId):[]);let an=(0,H.useRef)(null),on=(0,H.useRef)(new Map),sn=(0,H.useRef)(null),[cn,ln]=(0,H.useState)(!1),un=(0,H.useRef)(null);(0,H.useEffect)(()=>{if(Fe(),!(`serviceWorker`in navigator))return;let e=e=>{let t=e.data;if(t?.type!==`open-session`)return;let n=p(t.sessionId);if(!n)return;let r=en.current.find(e=>Object.values(e.sessions).some(e=>e.conversationId===n));r?(Dt(r.id),kt(null)):(Dt(null),le(n)),On()};return navigator.serviceWorker.addEventListener(`message`,e),()=>navigator.serviceWorker.removeEventListener(`message`,e)},[]),(0,H.useEffect)(()=>{ja(ka(k))},[k]),(0,H.useEffect)(()=>{let e=()=>{J9(koe(document.visibilityState===`visible`&&b===`online`,k))};return e(),document.addEventListener(`visibilitychange`,e),document.addEventListener(`pointerdown`,e,{passive:!0}),()=>{document.removeEventListener(`visibilitychange`,e),document.removeEventListener(`pointerdown`,e),J9(!1)}},[k,b]),(0,H.useEffect)(()=>{if(ae){y();return}y().then(e=>{e&&(Dt(null),kt(null),le(e),On())})},[ae]),(0,H.useEffect)(()=>{c&&e.length>0&&m(!0)},[]),(0,H.useEffect)(()=>{if(!o)return;un.current=null,Ue(!1),ge(new Set),T(`relay`),Ge(!1),qe(!1),Xe(!1),U(!1),at(!1),ot.current=!1,ct(!1),ut(!1),dt.current=!1;let e=()=>{Ge(!0),Xe(!0)},t=new te(o,{onState:e=>{e!==`online`&&(Rt.current?.interrupted(),zt.reset(),Bt.reset(),Vt.reset(),U(!1),ct(!1)),S(e)},onBotArtifacts:e=>zt.receive(e),onBotArtifactImage:e=>zt.receiveImage(e),onBotNewSessionResult:t=>{Bt.receive(t),t.error===`read-only`&&e()},onBotThreadResult:t=>{Vt.receive(t),t.error===`read-only`&&e()},onTransport:e=>{T(e),O(null)},onRtt:O,onRemoteDesktop:qe,onReadOnly:e=>{Ge(e),e||Xe(!1)},onCommandRejected:(t,n)=>{n===`read-only`&&e()},onCatalog:(e,t)=>{A(e),P(t??[])},onProjects:(e,t)=>{ee(e),z(t??[])},onProviders:re,onSession:(e,t)=>{de(n=>e===$t.current?t:n),rn.current.has(e)&&Ft(n=>({...n,[e]:t}))},onBotCatalog:(e,t,n,r)=>{nt(e),U(e&&n),ct(e&&r),ht(t),!e&&(_t([]),pt([]),xt([]),Ct({items:[],offset:0}),Dt(null),kt(null),Tt(!1))},onBotChats:(e,t)=>{_t(e),pt(t),yt(!0)},onBotInbox:xt,onBotActivity:(e,t)=>{for(let t of e)on.current.set(t.conversationId,t.botId);Ct({items:e,offset:t})},onGroupTimeline:e=>{e.beforeSeq!==void 0&&sn.current===`${e.chatId}:${e.beforeSeq}`&&(sn.current=null,ln(!1)),jt(t=>({...t,[e.chatId]:Zo(t[e.chatId],e)}))},onBotChatState:({type:e,chatId:t,...n})=>Nt(e=>({...e,[t]:n})),onBotEvent:e=>{if(e.kind===`model-notice`){e.text&&(e.chatId===tn.current||e.chatId===nn.current)&&Lt(e.text);return}!e.chatId||e.chatId!==nn.current||an.current||(an.current=setTimeout(()=>{an.current=null;let e=nn.current;e&&t.send({type:`bot-chat-open`,chatId:e})},200))},onBotSendResult:t=>{Rt.current?.settle(t.deliveryId,t.ok,t.error),t.error===`read-only`&&e()},onBotRetryResult:e=>{e.chatId===nn.current&&Lt(e.ok?`已开始重试`:`重试失败:${e.error===`session-busy`?`请等当前回复结束`:`该回复已过期或无法恢复,请重新发送需求`}`)},onSync:e=>me(e===`syncing`),onGhostSession:e=>{e===Gt.current&&le(null)},onHistoryPending:(e,t)=>{ge(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},onPushConfig:e=>{un.current=e,Ue(!0),localStorage.getItem(`enso-phone-push`)===`on`&&ie(e).then(e=>{e.ok&&t.send({type:`push-subscribe`,subscription:e.subscription})})}});Wt.current=t,t.connect();let n=()=>{document.visibilityState===`visible`?(t.nudge(`visibility`),t.send({type:`presence`,visible:!0}),r()):(t.conceal(),t.send({type:`presence`,visible:!1}),t.flushCache())},r=()=>navigator.serviceWorker?.controller?.postMessage({type:`badge-clear`});r();let i=()=>{document.visibilityState===`visible`&&(t.nudge(`online`),t.send({type:`presence`,visible:!0}),r())},a=e=>{document.visibilityState===`visible`&&(t.nudge(e.persisted?`online`:`visibility`),t.send({type:`presence`,visible:!0}),r())},s=()=>{document.visibilityState===`visible`&&t.nudge(`visibility`)},c=()=>{t.conceal(),t.flushCache()};return document.addEventListener(`visibilitychange`,n),window.addEventListener(`online`,i),window.addEventListener(`pageshow`,a),window.addEventListener(`focus`,s),window.addEventListener(`pagehide`,c),()=>{document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`online`,i),window.removeEventListener(`pageshow`,a),window.removeEventListener(`focus`,s),window.removeEventListener(`pagehide`,c),an.current&&clearTimeout(an.current),an.current=null,t.close(),Wt.current=null,Bt.reset(),Vt.reset()}},[o?.pairId,o?.token,o?.relayUrl,o?.contentKey]);let dn=(0,H.useRef)(new Set);(0,H.useEffect)(()=>{let e=Qt!==null&&dn.current.has(Qt);Wt.current?.subscribe(Qt,{fresh:e});for(let e of dn.current)e!==Qt&&dn.current.delete(e);de(Qt?Wt.current?.getSession(Qt)??null:null)},[Qt,o?.pairId]);let fn=o?.pairId;(0,H.useEffect)(()=>{fn&&_e(fn,{activeId:ce,botChatId:Et})},[ce,Et,fn]),(0,H.useEffect)(()=>{if(!fn)return;let e=new R(v,fn);Rt.current=e,Ut([]);let t=e.subscribe(e=>Ut([...e]));return e.restore().catch(()=>Lt(`离线消息读取失败,请勿清除浏览器数据;恢复存储后可重试。`)),()=>{t(),Rt.current===e&&(Rt.current=null)}},[fn]),(0,H.useEffect)(()=>{if(b===`online`)for(let e of Rt.current?.drain()??[])Wt.current?.send({type:`bot-send`,chatId:e.chatId,text:e.text,...e.images?.length?{images:e.images}:{},deliveryId:e.deliveryId})},[b,Ht]),(0,H.useEffect)(()=>{let e=setInterval(()=>Rt.current?.expire(),1e3);return()=>clearInterval(e)},[]);let pn=Yt?.current.id??null;(0,H.useEffect)(()=>{!pn||b!==`online`||(sn.current=null,ln(!1),Wt.current?.send({type:`bot-chat-open`,chatId:pn}))},[pn,b]),(0,H.useEffect)(()=>{if(!cn)return;let e=setTimeout(()=>{sn.current=null,ln(!1),Lt(`历史加载未完成,请点击加载重试。`)},1e4);return()=>clearTimeout(e)},[cn]),(0,H.useEffect)(()=>{let e={};for(let t of rn.current){let n=Wt.current?.getSession(t);n&&(e[t]=n)}Ft(e)},[pn,Yt?.current.sessions]),(0,H.useEffect)(()=>{if(!ce||Et)return;let e=gt.find(e=>Object.values(e.sessions).some(e=>e.conversationId===ce));e&&(Dt(e.id),le(null))},[ce,Et,gt]),(0,H.useEffect)(()=>{let e=(e,t)=>{let n=Kt.current.find(t=>t.id===e)?.queued,r=Yie(n,e,t,z7(e===Gt.current&&qt.current?[...qt.current.messages.values()]:[]));r&&be(e=>[...e,r])};rP({removeQueuedMessage:(e,t)=>Wt.current?.send({type:`queue-remove`,sessionId:e,messageId:t}),updateQueuedMessage:(e,t,n)=>Wt.current?.send({type:`queue-update`,sessionId:e,messageId:t,text:n}),sendQueuedNow:(t,n)=>{e(t,n),Wt.current?.send({type:`queue-send-now`,sessionId:t,messageId:n})},interruptAndSendQueued:async(t,n)=>{e(t,n),Wt.current?.send({type:`queue-interrupt-send`,sessionId:t,messageId:n})},pauseGoal:e=>Wt.current?.send({type:`goal-pause`,sessionId:e}),resumeGoal:e=>Wt.current?.send({type:`goal-resume`,sessionId:e}),clearGoal:e=>Wt.current?.send({type:`goal-clear`,sessionId:e}),rewind:(e,t,n)=>Wt.current?.send({type:`rewind`,sessionId:e,userIndexFromEnd:t,...n?{restoreFiles:n}:{}}),retry:e=>Wt.current?.send({type:`retry`,sessionId:e})}),ze({stopTask:(e,t)=>Wt.current?.send({type:`task-stop`,sessionId:e,taskId:t}),stopSubagent:(e,t)=>Wt.current?.send({type:`subagent-stop`,sessionId:e,agentId:t})})},[]);let mn=(0,H.useRef)(null);(0,H.useEffect)(()=>{if(!ce)return;let e=z7(ue?[...ue.messages.values()]:[]),t=ue?.status===`running`,n=mn.current,r=n?.id===ce&&n.running&&!t;mn.current={id:ce,running:t},be(t=>{let n=Qie(t,ce,e,{turnSettled:r});return n.length===t.length&&n.every((e,n)=>e===t[n])?t:n})},[ue,ce]);let hn=k.find(e=>!e.parentId)?.id;(0,H.useEffect)(()=>{!Et&&!ce&&hn&&le(hn)},[ce,Et,hn]);let gn=(0,H.useMemo)(()=>k.find(e=>e.id===ce),[k,ce]),_n=(0,H.useMemo)(()=>{if(!gn)return;let e=gn.parentId?k.find(e=>e.id===gn.parentId):gn;if(!e)return;let t=k.filter(t=>t.parentId===e.id);return t.length>0?{parent:e,children:t}:void 0},[k,gn]),vn=gn&&!gn.parentId,yn=vn?B.find(e=>e.id===gn.providerId)?.models.find(e=>e.id===gn.modelId)?.label??gn.modelId??`选择模型`:void 0,bn=b===`online`?a(w,E):Ie[b],xn=e=>{A([]),P([]),ee([]),z([]),re([]),de(null),me(!1),be([]),O(null),nt(!1),ht([]),_t([]),pt([]),yt(!1),Dt(e.botChatId),Tt(e.botChatId!==null),kt(null),jt({}),Nt({}),Ct({items:[],offset:0}),Ft({}),Lt(null),le(e.activeId)},Cn=e=>{e!==o?.pairId&&(l(e),i(e),S(`connecting`),xn(d(e)),On())},wn=n=>{let r=j(e,n);if(D(r),l(n.pairId),u&&n.scope!==`read`){window.location.replace(V(n.pairId));return}t(r),i(n.pairId),xn(d(n.pairId)),m(!1)},Tn=n=>{n===o?.pairId&&Wt.current?.close();let{devices:r,fallback:a}=s(e,n,o?.pairId??null);t(r),a!==void 0&&(i(a?.pairId??null),a&&S(`connecting`),xn(d(a?.pairId??null)),a||On())},En=(n,r)=>{t(N(e,n,r))};if(!o||f)return(0,G.jsx)(uoe,{autoInvite:c,onPaired:wn,onCancel:o?()=>{u?window.location.replace(V(o.pairId)):m(!1)}:void 0,notice:o?null:h});if(b===`unauthorized`){let t=e.length>1;return(0,G.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 px-6 text-center`,children:[(0,G.jsx)(Hn,{className:`h-8 w-8 text-muted-foreground`}),(0,G.jsx)(`h1`,{className:`font-medium text-lg`,children:`配对已失效`}),(0,G.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`「`,o.label,`」已解绑此设备,`,t?`可移除它并切到其他电脑。`:`请重新扫码配对。`]}),(0,G.jsx)(Oa,{onClick:()=>Tn(o.pairId),children:t?`移除此配对`:`重新配对`})]})}if(b===`replaced`)return(0,G.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 px-6 text-center`,children:[(0,G.jsx)(Hn,{className:`h-8 w-8 text-muted-foreground`}),(0,G.jsx)(`h1`,{className:`font-medium text-lg`,children:`已在其他页面打开`}),(0,G.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`「`,o.label,`」正被另一个页面连着,同一时间只能有一个页面。`]}),(0,G.jsx)(Oa,{onClick:()=>window.location.reload(),children:`在这个页面重连`})]});let Dn=e=>Wt.current?.send(e),On=()=>{(localStorage.getItem(Y9)===`off`||!window.matchMedia(`(min-width: 900px)`).matches)&&Ce(!1)},kn=()=>{Tt(q7(tt,Et)),Ce(!0),tt&&Dn({type:`bot-catalog-request`})},An=(e,t,n=[])=>{Lt(null),Rt.current?.enqueue({chatId:e,text:t,images:n})},jn=e=>(0,G.jsx)(aoe,{items:Ht.filter(t=>t.chatId===e),readOnly:We,onRetry:e=>Rt.current?.retry(e),onDiscard:e=>Rt.current?.discard(e)}),Mn=new Map(mt.map(e=>[e.id,e])),Nn=e=>We?`只读设备不能新建会话`:b===`online`?rt?it?`正在新建会话…`:Ht.some(t=>t.chatId===e)?`请先处理待发送消息`:void 0:`请升级桌面端以支持新建会话`:`请先连接桌面端`,Pn=async e=>{if(Nn(e)||ot.current)return;let t=Wt.current;ot.current=!0,at(!0),Lt(null);try{let n=await Bt.start(e,()=>t===Wt.current&&tn.current===e&&window.confirm(`群聊中仍有回复、排队或委派任务。新建会话将停止成员回复,并取消未标记保留的委派。旧消息会保留。继续吗?`));if(t!==Wt.current||tn.current!==e)return;Lt(!n||n.ok?null:n.error===`read-only`?`只读设备不能新建会话`:n.error===`timeout`||n.error===`offline`?`未收到新会话确认,请连接后核对聊天状态,勿重复操作`:`新建会话失败:${n.error??`请稍后重试`}`),n?.ok&&(t?.send({type:`bot-catalog-request`}),t?.send({type:`bot-chat-open`,chatId:e}))}finally{t===Wt.current&&(ot.current=!1,at(!1))}},Fn=We?`只读设备不能切换或新建话题`:b===`online`?lt?`正在处理话题…`:void 0:`请先连接桌面端`,In=async e=>{if(Fn||dt.current)return;let t=Wt.current;dt.current=!0,ut(!0),Lt(null);try{let n=await Vt.request(e);if(t!==Wt.current||tn.current!==e.chatId)return;n.ok?kt(null):Lt(n.error===`read-only`?`只读设备不能切换或新建话题`:n.error===`timeout`||n.error===`offline`?`未收到桌面确认,请连接后核对当前话题`:n.error===`invalid`?`该话题已不存在或群已归档`:`话题操作失败:${n.error??`请稍后重试`}`)}finally{t===Wt.current&&(dt.current=!1,ut(!1))}},Ln=e=>{if(e.kind===`group`&&!Ot){let t=Object.entries(e.sessions).flatMap(([e,{conversationId:t}])=>{let n=Pt[t];return n?[{sessionId:t,botId:e,view:n}]:[]});return(0,G.jsx)(Tae,{chat:e,bots:Mn,timeline:At[e.id],state:Mt[e.id],pending:t,activities:ls(St.items,e.id),clockOffset:St.offset,connState:b,stateLabel:bn,notice:It,outbox:jn(e.id),deviceReadOnly:We,readOnlyRejected:Ye,onOpenDrawer:kn,drawerDocked:Oe,onNewSession:()=>void Pn(e.id),canCreate:!Nn(e.id),newSessionHint:Nn(e.id),newSessionBusy:it,threads:st&&Yt&&Jt?{entries:Yt.entries,currentId:e.id,rootId:Jt.id,disabledHint:Fn,onSelect:e=>void In({type:`bot-thread-select`,chatId:Jt.id,threadId:e}),onCreate:()=>void In({type:`bot-thread-create`,chatId:Jt.id})}:void 0,onLoadOlder:()=>{let t=At[e.id]?.entries[0]?.seq,n=`${e.id}:${t}`;b!==`online`||t===void 0||sn.current||(sn.current=n,ln(!0),Dn({type:`bot-timeline`,chatId:e.id,beforeSeq:t}))},historyLoading:cn,onJumpLatest:()=>{sn.current=null,ln(!1),jt(t=>{let n={...t};return delete n[e.id],n}),Dn({type:`bot-chat-open`,chatId:e.id})},onSend:(t,n)=>An(e.id,t,n),onStop:()=>Dn({type:`bot-stop`,chatId:e.id}),onRetry:t=>{Lt(`正在请求重试…`),Dn({type:`bot-retry`,chatId:e.id,entryId:t})},onOpenProcess:kt,onApproval:(e,t,n)=>Dn({type:`approval-respond`,sessionId:e,requestId:t,decision:n}),onAsk:(e,t,n)=>Dn({type:`ask-respond`,sessionId:e,requestId:t,answer:n})})}let t=e.kind===`group`,n=At[e.id]?.entries.find(e=>e.kind===`bot`&&e.conversationId===Ot),r=Ot?on.current.get(Ot):void 0,i=Mn.get(t?n?.kind===`bot`?n.botId:r??``:e.members[0]);return(0,G.jsx)(V7,{sessionId:Qt??`bot-chat:${e.id}`,clockOffset:St.offset,title:t?`${i?.name??`成员`} · 过程`:i?.name??e.title,projectName:t?e.title:i?.title??``,view:Qt?ue:joe,connState:b,stateLabel:bn,syncing:pe&&!!Qt,onOpenDrawer:kn,drawerDocked:Oe,onNewSession:()=>!t&&void Pn(e.id),canCreate:!t&&!Nn(e.id),newSessionHint:Nn(e.id),newSessionBusy:it,hasOlder:!!(Qt&&ue&&ue.messages.size>0&&Math.min(...ue.messages.keys())>0),historyLoading:!!(Qt&&he.has(Qt)),onLoadOlder:()=>Qt&&Wt.current?.requestHistory(Qt),bot:t?{readOnly:!0,onBack:()=>kt(null)}:{chatId:e.id,notice:It,outbox:jn(e.id)},artifacts:!t&&Qt?{chatId:e.id,conversationId:Qt}:void 0,deviceReadOnly:We,readOnlyRejected:Ye,onSend:(t,n)=>An(e.id,t,n),onAbort:()=>Qt&&Dn({type:`abort`,sessionId:Qt}),onApproval:(e,t)=>Qt&&Dn({type:`approval-respond`,sessionId:Qt,requestId:e,decision:t}),onAsk:(e,t)=>Qt&&Dn({type:`ask-respond`,sessionId:Qt,requestId:e,answer:t})})},Rn=async e=>{et(null);let t=se(Dn);if(!e){Ve(!1),Ee(t);return}let n=un.current;if(!n)return;Ve(!0),Qe(!0);let r=await xe(n,t);Qe(!1),r.ok||(Ve(!1),et(r.reason))};return(0,G.jsxs)(`div`,{className:`phone-app-root flex h-full min-h-0`,children:[(0,G.jsx)(Doe,{open:Oe||Se,docked:Oe,pinnable:we,onTogglePinned:ke,projects:I,groups:L,catalog:k,pinnedOrder:M,activeId:Et?null:ce,canCreate:b===`online`&&!We,devices:e,activeDevicePairId:o.pairId,remoteDesktop:Ke,connected:b===`online`,connectionLabel:bn,onClose:()=>On(),onSelect:e=>{Dt(null),kt(null),le(e),On()},onNewConversation:e=>{On(),Pe(e),je(!0)},pushEnabled:Be,pushBusy:Ze,pushError:$e,pushAvailability:Noe(),pushConfigReady:He,onTogglePush:e=>void Rn(e),onSwitchDevice:Cn,onAddDevice:()=>{On(),m(!0)},onRenameDevice:En,onUnpairDevice:Tn,botSegment:tt?{active:wt,onChange:e=>{Tt(e),uae(e?`bot`:`code`),e&&Dn({type:`bot-catalog-request`})},panel:(0,G.jsx)(ps,{bots:mt,chats:gt,activeChatId:Et,inbox:bt,activities:St.items,onDismiss:We?void 0:e=>Dn({type:`bot-inbox-dismiss`,key:e}),onSelect:e=>{Dt(e),kt(null),Lt(null),On()}})}:void 0}),(0,G.jsxs)(`div`,{className:`flex h-full min-w-0 flex-1 flex-col`,children:[we&&!Oe&&!Se&&(0,G.jsx)(`button`,{type:`button`,onClick:kn,"aria-label":`打开会话列表`,className:`fixed top-1/2 left-0 z-40 flex h-16 w-6 -translate-y-1/2 items-center justify-center rounded-r-lg border border-l-0 bg-background/90 text-muted-foreground shadow-sm backdrop-blur transition-colors hover:bg-accent hover:text-foreground`,children:(0,G.jsx)(Sn,{className:`h-4.5 w-4.5`})}),Jt?(0,G.jsx)(qa.Provider,{value:{port:zt,online:b===`online`},children:Ln(Xt??Jt)}):Et?(0,G.jsxs)(`div`,{className:`relative flex h-full flex-col items-center justify-center gap-3 px-6 text-center`,children:[!Oe&&(0,G.jsx)(`button`,{type:`button`,onClick:kn,"aria-label":`打开会话列表`,className:`absolute top-2 left-2 flex h-9 w-9 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,G.jsx)(Sn,{className:`h-4.5 w-4.5`})}),(0,G.jsx)(`p`,{children:vt?`该 Bot 聊天已不存在或不可用`:`正在恢复 Bot 聊天…`}),(0,G.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:bn}),(0,G.jsx)(Oa,{onClick:kn,children:`选择聊天`})]}):(0,G.jsx)(V7,{sessionId:ce,title:gn?.title||(ce?`会话`:`EnsoCode`),projectName:gn?.projectName??``,cwd:gn?.cwd,view:ue,connState:b,stateLabel:bn,syncing:pe&&!!ce,onOpenDrawer:kn,drawerDocked:Oe,onNewSession:()=>{Pe(null),je(!0)},canCreate:b===`online`&&I.length>0&&!We,modelLabel:b===`online`?yn:void 0,onOpenConfig:()=>Re(!0),tabGroup:_n,onSelectTab:le,hasOlder:!!(ce&&ue&&ue.messages.size>0&&Math.min(...ue.messages.keys())>0),historyLoading:!!(ce&&he.has(ce)),onLoadOlder:()=>ce&&Wt.current?.requestHistory(ce),queued:Xie(gn?.queued,ve,ce??``),echoes:ve,goal:gn?.goal,context:gn?.context,usageTotals:gn?.usageTotals,slashCommands:gn?.slashCommands,deviceReadOnly:We,readOnlyRejected:Ye,onSend:(e,t)=>{if(!ce)return;let n=Je(e);if(n){Dn({type:`compact`,sessionId:ce,...n.instructions?{instructions:n.instructions}:{}});return}let r=/^\/goal(?:\s+([\s\S]+))?$/.exec(e.trim());if(r){let e=r[1]?.trim();if(!e)return;Dn(e===`clear`?{type:`goal-clear`,sessionId:ce}:e===`pause`?{type:`goal-pause`,sessionId:ce}:e===`resume`?{type:`goal-resume`,sessionId:ce}:{type:`goal-set`,sessionId:ce,text:e});return}Dn({type:ue?.status===`running`?`enqueue`:`prompt`,sessionId:ce,text:e,...t.length?{images:t}:{}})},onAbort:()=>ce&&Dn({type:`abort`,sessionId:ce}),onApproval:(e,t)=>ce&&Dn({type:`approval-respond`,sessionId:ce,requestId:e,decision:t}),onAsk:(e,t)=>ce&&Dn({type:`ask-respond`,sessionId:ce,requestId:e,answer:t})}),(0,G.jsx)(roe,{open:Ae&&!We,projects:I,providers:B,preferredProjectId:Me,onClose:()=>{je(!1),Pe(null)},onCreate:e=>{let t=crypto.randomUUID();Dn({type:`spawn`,sessionId:t,...e}),dn.current.add(t),je(!1),Pe(null),Dt(null),kt(null),le(t)}}),vn&&ce&&!We&&(0,G.jsx)(doe,{open:Le,providers:B,config:{providerId:gn.providerId,modelId:gn.modelId,reasoningEnabled:gn.reasoningEnabled,thinkingLevel:gn.thinkingLevel},onClose:()=>Re(!1),onSetModel:(e,t)=>Dn({type:`set-model`,sessionId:ce,providerId:e,modelId:t}),onSetReasoning:e=>Dn({type:`set-reasoning`,sessionId:ce,enabled:e}),onSetThinking:e=>Dn({type:`set-thinking`,sessionId:ce,level:e})})]})]})}function Foe(e){return!e.appleMobile||!e.standalone||e.safeTop<=0||e.innerHeight<=e.innerWidth?!1:e.innerHeight>=Math.max(e.screenWidth,e.screenHeight)-1}function Ioe(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e&&!/^viewport-fit\s*=/i.test(e)).join(`, `)}function Loe(){return/iphone|ipad|ipod/i.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1}function Roe(){let e=document.querySelector(`meta[name="viewport"]`);if(!e||!Loe())return;let t=document.createElement(`div`);t.setAttribute(`aria-hidden`,`true`),t.style.cssText=`position:fixed;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)`,document.body.appendChild(t);let n=()=>{let r=getComputedStyle(t);if(!Foe({appleMobile:!0,standalone:ne(),safeTop:Number.parseFloat(r.paddingTop)||0,innerWidth:window.innerWidth,innerHeight:window.innerHeight,screenWidth:window.screen.width,screenHeight:window.screen.height}))return;let i=Number.parseFloat(r.paddingBottom)||0;document.documentElement.style.setProperty(`--phone-safe-bottom`,`${i}px`),e.content=Ioe(e.content),window.removeEventListener(`resize`,n),document.removeEventListener(`visibilitychange`,n),t.remove()};window.addEventListener(`resize`,n),document.addEventListener(`visibilitychange`,n),n()}var X9=new URLSearchParams(location.search);if(X9.get(`mode`)===`phone`){ae(`phone`),X9.delete(`mode`);let e=X9.toString();history.replaceState(null,``,`${location.pathname}${e?`?${e}`:``}${location.hash}`)}var Z9=F(),Q9=we(location.search,Oe(),Z9,Ne());Q9?location.replace(Q9):Z9.length>0&&(he(),T(!0)),ee(),Roe(),Q9||Ce(window),!Q9&&`serviceWorker`in navigator&&ke({container:navigator.serviceWorker,doc:document,storage:sessionStorage,canReloadNow:()=>!1,reload:()=>location.reload()});var $9=document.getElementById(`root`);$9&&!Q9&&(0,Ke.createRoot)($9).render((0,G.jsx)(H.StrictMode,{children:(0,G.jsx)(Poe,{})}));export{U0 as a,ip as c,Qs as d,q as f,R2 as i,Tu as l,Ka as m,w4 as n,Wg as o,K as p,L2 as r,Qp as s,t6 as t,Oc as u};