@rainmanhhh/pi-web 0.32.42 → 0.32.43

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 (90) hide show
  1. package/dist/server.mjs +1 -1
  2. package/dist/static/assets/{CodeMirrorEditor-BWIfhIqx.js → CodeMirrorEditor-DZD0ukoD.js} +1 -1
  3. package/dist/static/assets/{abnfDiagram-VCTEODGH-yRG2DK1y.js → abnfDiagram-VCTEODGH-C-oOhi_7.js} +1 -1
  4. package/dist/static/assets/architecture-7GRP2DOG-CbjXW2DK.js +1 -0
  5. package/dist/static/assets/{architectureDiagram-5GKGNRK7-B69KSTSy.js → architectureDiagram-5GKGNRK7-CXy6__9e.js} +1 -1
  6. package/dist/static/assets/{blockDiagram-I7D4REHJ-CEZGmcQQ.js → blockDiagram-I7D4REHJ-C6PsmPgh.js} +1 -1
  7. package/dist/static/assets/{c4Diagram-7LVT6UL2-DFHoqZgn.js → c4Diagram-7LVT6UL2-SnZFxSOU.js} +1 -1
  8. package/dist/static/assets/channel-DCWLUY1O.js +1 -0
  9. package/dist/static/assets/{chunk-4HAMMTFA-y-6eXUuw.js → chunk-4HAMMTFA-Bhbe4n2f.js} +1 -1
  10. package/dist/static/assets/{chunk-75Z2AOVW-BJrGAjdH.js → chunk-75Z2AOVW-CUlVId3u.js} +1 -1
  11. package/dist/static/assets/{chunk-DU6HZSFF-B7yolwLa.js → chunk-DU6HZSFF-CfQK1qG0.js} +3 -3
  12. package/dist/static/assets/{chunk-F27PBJKO--7kL3nRd.js → chunk-F27PBJKO-Ca7ET8_S.js} +1 -1
  13. package/dist/static/assets/{chunk-GMAD6QVW-jFTfY1Hx.js → chunk-GMAD6QVW-DJTLZiR3.js} +1 -1
  14. package/dist/static/assets/{chunk-GVQU2GXP-DDEL0bKH.js → chunk-GVQU2GXP-ZXj_Ui7F.js} +1 -1
  15. package/dist/static/assets/{chunk-IMKFNOWR-BrCZiJCK.js → chunk-IMKFNOWR-CF2oHDkw.js} +1 -1
  16. package/dist/static/assets/{chunk-L3NEJ4N5-B2uyU-tv.js → chunk-L3NEJ4N5-BNDn0rKp.js} +1 -1
  17. package/dist/static/assets/{chunk-OSK3NFVY-BtwcWKem.js → chunk-OSK3NFVY-CdCVGm-Q.js} +1 -1
  18. package/dist/static/assets/{chunk-P2QGCYS3-DUtLAGT0.js → chunk-P2QGCYS3-DdjvN5Fv.js} +1 -1
  19. package/dist/static/assets/{chunk-POPQ4Y6H-BxIqfMf_.js → chunk-POPQ4Y6H-B6wUt4Uh.js} +1 -1
  20. package/dist/static/assets/{chunk-PWAF6VOD-odKwJ3Yn.js → chunk-PWAF6VOD-BLpd1mQv.js} +1 -1
  21. package/dist/static/assets/{chunk-SHT3W25Y-q01cI7aU.js → chunk-SHT3W25Y-_kJvZQyN.js} +1 -1
  22. package/dist/static/assets/{chunk-SVP7TREG-Crtvtxqj.js → chunk-SVP7TREG-FY7JGpLF.js} +1 -1
  23. package/dist/static/assets/{chunk-TICWLB2K-lT3y5yLT.js → chunk-TICWLB2K-BGhE-Y65.js} +1 -1
  24. package/dist/static/assets/classDiagram-ZZMXUADV-Cc6l91us.js +1 -0
  25. package/dist/static/assets/classDiagram-v2-VYDZK3BY-Cc6l91us.js +1 -0
  26. package/dist/static/assets/{cynefin-OW5HDTMX-DMFIBfe2.js → cynefin-OW5HDTMX-lNHqL3N_.js} +1 -1
  27. package/dist/static/assets/{cynefinDiagram-5FMLGOSQ-2ik6j3ZO.js → cynefinDiagram-5FMLGOSQ-CDVjBHgn.js} +1 -1
  28. package/dist/static/assets/{dagre-GXQ25YYZ-RXjQ-be6.js → dagre-GXQ25YYZ-BWCOAcDC.js} +1 -1
  29. package/dist/static/assets/{diagram-S7CK7UJ4-BpMx1iL4.js → diagram-S7CK7UJ4-c4Du0V3F.js} +1 -1
  30. package/dist/static/assets/{diagram-UQ7AKVKN-CHsypBWR.js → diagram-UQ7AKVKN-BW3m_cLr.js} +1 -1
  31. package/dist/static/assets/{diagram-VSXAHHWV-CyGJi4K9.js → diagram-VSXAHHWV-CKO7qlqg.js} +1 -1
  32. package/dist/static/assets/{diagram-VX7I27RA-Dg6nrxFF.js → diagram-VX7I27RA-B2YyB5q0.js} +1 -1
  33. package/dist/static/assets/{diagram-Z3DM3KII-Be9XmjU6.js → diagram-Z3DM3KII-DCrfHzRs.js} +1 -1
  34. package/dist/static/assets/{ebnfDiagram-PWID7BFC-CEyk1bYl.js → ebnfDiagram-PWID7BFC-DUwOS5Ig.js} +1 -1
  35. package/dist/static/assets/{erDiagram-RLTQ6QDP-DpUkWwuM.js → erDiagram-RLTQ6QDP-CzYL8NhE.js} +1 -1
  36. package/dist/static/assets/eventmodeling-NTZA5JFV-DzZWk93p.js +1 -0
  37. package/dist/static/assets/flowDiagram-HODETNUW-RXQUSDN2.js +1 -0
  38. package/dist/static/assets/{ganttDiagram-EL5Y4UJY-B68_M8b5.js → ganttDiagram-EL5Y4UJY-C_eT97YK.js} +1 -1
  39. package/dist/static/assets/{gitGraph-4MIJSDKK-D35bV--Q.js → gitGraph-4MIJSDKK-CiQWoTuJ.js} +1 -1
  40. package/dist/static/assets/{gitGraphDiagram-WWUBYQGX-Ce8uQhxl.js → gitGraphDiagram-WWUBYQGX-B6n2K9lV.js} +1 -1
  41. package/dist/static/assets/{index-OmYQzPbX.js → index-CgNbigti.js} +6 -6
  42. package/dist/static/assets/{info-A6RAGUB7-CwHHv3to.js → info-A6RAGUB7-CwMmUI1_.js} +1 -1
  43. package/dist/static/assets/{infoDiagram-27XIBGKW-Cawu_jza.js → infoDiagram-27XIBGKW-lQIqNMCN.js} +1 -1
  44. package/dist/static/assets/{ishikawaDiagram-5VMMS53U-cnzSlBgN.js → ishikawaDiagram-5VMMS53U-D8_KMtUQ.js} +1 -1
  45. package/dist/static/assets/{journeyDiagram-3NMN7TZE-C6UKv5BF.js → journeyDiagram-3NMN7TZE-DN9YXXVD.js} +1 -1
  46. package/dist/static/assets/{kanban-definition-UXKFOSKX-CRy6huMo.js → kanban-definition-UXKFOSKX-d-d87Yog.js} +1 -1
  47. package/dist/static/assets/{line-CImCwapV.js → line-DCAoErD3.js} +1 -1
  48. package/dist/static/assets/{markstream-Deoklxmw.js → markstream-CqyDsA7W.js} +2 -2
  49. package/dist/static/assets/{mermaid-parser.core-m2QFy9xG.js → mermaid-parser.core-Dd9EcGg7.js} +3 -3
  50. package/dist/static/assets/{mermaid.core-CX36n5_l.js → mermaid.core-fp2_EGmp.js} +4 -4
  51. package/dist/static/assets/{mhchem-hM2_ctQQ.js → mhchem-CRwK5apH.js} +1 -1
  52. package/dist/static/assets/{mindmap-definition-YA3MSWOX-H1NCseAg.js → mindmap-definition-YA3MSWOX-Qm64q1Ak.js} +1 -1
  53. package/dist/static/assets/{packet-AYTQ26CC-B6avgahe.js → packet-AYTQ26CC-CxAWp_iP.js} +1 -1
  54. package/dist/static/assets/{pegDiagram-XKGWAZYB-Bnp_t5iB.js → pegDiagram-XKGWAZYB-B7TAsEFk.js} +1 -1
  55. package/dist/static/assets/{pie-WAS4IAKB-COM3cUAS.js → pie-WAS4IAKB--qoOZwKG.js} +1 -1
  56. package/dist/static/assets/{pieDiagram-E7YTZNPT-D6LQQu1f.js → pieDiagram-E7YTZNPT-Dx9B4YJB.js} +1 -1
  57. package/dist/static/assets/{quadrantDiagram-AXDQQJYC-DUpPIsmn.js → quadrantDiagram-AXDQQJYC-C3vZHJGF.js} +1 -1
  58. package/dist/static/assets/{radar-RG4KPBEZ-D6TTNwUm.js → radar-RG4KPBEZ-CbTN24Su.js} +1 -1
  59. package/dist/static/assets/{railroad-74A4TZTK-C1lukRnF.js → railroad-74A4TZTK-C4iJ0C_c.js} +1 -1
  60. package/dist/static/assets/railroad-abnf-HS5TGJTU-Bgkha3Rt.js +1 -0
  61. package/dist/static/assets/railroad-ebnf-LZEXJU2U-HGTxlHy3.js +1 -0
  62. package/dist/static/assets/railroad-peg-WCYAUIDC-BnZtjiLb.js +1 -0
  63. package/dist/static/assets/{railroadDiagram-O6MQD6OU-C32q2X52.js → railroadDiagram-O6MQD6OU-Dym8V5pn.js} +1 -1
  64. package/dist/static/assets/{requirementDiagram-BXWQKSXE-BUC2pAMA.js → requirementDiagram-BXWQKSXE-B3rnE8HD.js} +1 -1
  65. package/dist/static/assets/{sankeyDiagram-P5KCCOFB-Dfhxm4o_.js → sankeyDiagram-P5KCCOFB-V3MxgoHj.js} +1 -1
  66. package/dist/static/assets/{sequenceDiagram-WJ2MYXX4-DWHwmVyt.js → sequenceDiagram-WJ2MYXX4-CEVPrR4K.js} +1 -1
  67. package/dist/static/assets/{stateDiagram-D77RDMKH-xOtl4ddz.js → stateDiagram-D77RDMKH-1u-XluGe.js} +1 -1
  68. package/dist/static/assets/stateDiagram-v2-MP3YSRHH-DKuSaos3.js +1 -0
  69. package/dist/static/assets/{swimlanes-42K2YHIH-Dk6wIfT9.js → swimlanes-42K2YHIH-DezTzpNS.js} +1 -1
  70. package/dist/static/assets/swimlanesDiagram-VR7AAH4N-Ct9nG4te.js +8 -0
  71. package/dist/static/assets/{timeline-definition-24CTP7MA-BxJkC5j6.js → timeline-definition-24CTP7MA-CJ_c0Cab.js} +1 -1
  72. package/dist/static/assets/{treeView-Q6P3EWNA-DUmz-IiI.js → treeView-Q6P3EWNA-CH9YYXFR.js} +1 -1
  73. package/dist/static/assets/{treemap-WGGIJYW6-BMnUdh5k.js → treemap-WGGIJYW6-7UAlSsyd.js} +1 -1
  74. package/dist/static/assets/{vennDiagram-4TSXK5OY-Bd_1X16P.js → vennDiagram-4TSXK5OY-CAjvuFbj.js} +1 -1
  75. package/dist/static/assets/{wardley-WFR3VGLG-CyvRLo_l.js → wardley-WFR3VGLG-CPeRF_n4.js} +1 -1
  76. package/dist/static/assets/{wardleyDiagram-VM6X3IG4-PTt8Od2V.js → wardleyDiagram-VM6X3IG4-DnXamu7P.js} +1 -1
  77. package/dist/static/assets/{xychartDiagram-S5SC5T6Z-XA2zTOlM.js → xychartDiagram-S5SC5T6Z-BgATOlEm.js} +1 -1
  78. package/dist/static/index.html +1 -1
  79. package/package.json +1 -1
  80. package/dist/static/assets/architecture-7GRP2DOG-BwTWl_C3.js +0 -1
  81. package/dist/static/assets/channel-DkNPTs8P.js +0 -1
  82. package/dist/static/assets/classDiagram-ZZMXUADV-6nF0gekr.js +0 -1
  83. package/dist/static/assets/classDiagram-v2-VYDZK3BY-6nF0gekr.js +0 -1
  84. package/dist/static/assets/eventmodeling-NTZA5JFV-BCLSWwG5.js +0 -1
  85. package/dist/static/assets/flowDiagram-HODETNUW-vqy77wnm.js +0 -1
  86. package/dist/static/assets/railroad-abnf-HS5TGJTU-CeLAnap2.js +0 -1
  87. package/dist/static/assets/railroad-ebnf-LZEXJU2U-D24IPHJz.js +0 -1
  88. package/dist/static/assets/railroad-peg-WCYAUIDC-DnQgXkbo.js +0 -1
  89. package/dist/static/assets/stateDiagram-v2-MP3YSRHH-QANbpIdj.js +0 -1
  90. package/dist/static/assets/swimlanesDiagram-VR7AAH4N-CC5vhL5I.js +0 -8
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CX36n5_l.js","assets/rolldown-runtime-hePW80VL.js","assets/chunk-75Z2AOVW-BJrGAjdH.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B6xuSHsQ.js","assets/chunk-DU6HZSFF-B7yolwLa.js","assets/dist-v5Q1xZ2K.js","assets/chunk-PWAF6VOD-odKwJ3Yn.js","assets/chunk-GMAD6QVW-jFTfY1Hx.js","assets/chunk-P2QGCYS3-DUtLAGT0.js","assets/chunk-4HAMMTFA-y-6eXUuw.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-GVQU2GXP-DDEL0bKH.js","assets/chunk-OSK3NFVY-BtwcWKem.js","assets/line-CImCwapV.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/graphlib-DS17s2tU.js","assets/chunk-L3NEJ4N5-B2uyU-tv.js","assets/angular-html-B8mrqUL5.js","assets/html-XwrE-1r6.js","assets/javascript-obGGvMPs.js","assets/css-CNuuLpMC.js","assets/angular-ts-Bzix210W.js","assets/scss-YesllqfO.js","assets/apl-Dhin1L29.js","assets/xml-BlnrEAEy.js","assets/java-DdHNQ9hk.js","assets/json-DAgxKhMr.js","assets/astro-B-4NNgOP.js","assets/typescript-BydbNFcO.js","assets/postcss-BXeXVLqQ.js","assets/tsx-CUOciP0b.js","assets/blade-C6Gedziy.js","assets/html-derivative-i4STDFnl.js","assets/sql-DdD7vxS4.js","assets/bsl-_VjlB9mv.js","assets/sdbl-bTVj8UrX.js","assets/c-iCihek07.js","assets/cairo-DLTphjLi.js","assets/python-gzcpVVnB.js","assets/chapel-DmtgEXO_.js","assets/cobol-Cw2-KvLW.js","assets/coffee-CiiSLhB6.js","assets/cpp-71xkOQct.js","assets/regexp-DR20uMnK.js","assets/glsl-D5MA2a_X.js","assets/crystal-DGPAtLeY.js","assets/shellscript-Da78Ox-3.js","assets/edge-DCY0a-ow.js","assets/elixir-DP304Xio.js","assets/elm-o4NJxfws.js","assets/erb-C7MPl934.js","assets/ruby-B8JcIHv0.js","assets/haml-CwEpbK1d.js","assets/graphql-Ctjuxyvl.js","assets/jsx-gTgmArGx.js","assets/lua-FONpmTUP.js","assets/yaml-Du_6cdrH.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-BDPpS8w6.js","assets/glimmer-js-BONyzAsu.js","assets/glimmer-ts-f9c0GCOe.js","assets/hack-Dh_ZLRbs.js","assets/handlebars-ryMP1rBR.js","assets/http-kmH8AyfE.js","assets/hurl-DCZHXKU4.js","assets/csv-Dx-8-gkx.js","assets/hxml-Dcm88srW.js","assets/haxe-C8oCnwJJ.js","assets/jinja-B-tLrNsM.js","assets/jison-CBjhYtSs.js","assets/julia-CXJVy74_.js","assets/r-BHcO8Vjq.js","assets/just-B9Xn_Dp4.js","assets/perl-DEgXgjuC.js","assets/latex-o9DRzaEe.js","assets/tex-BK-H2Wn4.js","assets/liquid-G0MH4h_m.js","assets/marko-DV5GrDmo.js","assets/less-DVTAwKKz.js","assets/mdc-BKfPFPZw.js","assets/nextflow-BJtWHP5T.js","assets/nextflow-groovy-DJMQeKeT.js","assets/nginx-BTMw9COX.js","assets/nim-B6yJ_yaC.js","assets/org-Ddi8Gs6E.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-B9UPq-vz.js","assets/vb-DOwzaHZ0.js","assets/raku-B3gFvitq.js","assets/rust-Cfkwpbl8.js","assets/scala-BiFt_7mu.js","assets/zig-CMLA9XwU.js","assets/xsl-BOPS8gLt.js","assets/pug-DkgDHZci.js","assets/qml-_a-QhfPD.js","assets/razor-BMJ0eI3p.js","assets/rst-BQCbfb9V.js","assets/cmake-Bj61d0ZC.js","assets/sas-CBpMWA2M.js","assets/shaderlab-TOUzSsQk.js","assets/hlsl-Cvrh5tZx.js","assets/shellsession-CVsQGYfZ.js","assets/soy-DEd-qcad.js","assets/sparql-D_iOobhT.js","assets/turtle-ByJddavk.js","assets/stata-CMv7m7Gi.js","assets/surrealql-BZoq2lXR.js","assets/svelte-Bj3Hmc9F.js","assets/templ-TjxbArHn.js","assets/ts-tags-Cc5do7zu.js","assets/twig-BVSnuTf-.js","assets/typst-C40W_gC6.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-BNQF7r6F.js","assets/vue-html-DkKkQnZL.js","assets/vue-vine-DFaKYU4X.js","assets/stylus-B6D30XZt.js","assets/CodeMirrorEditor-BWIfhIqx.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-fp2_EGmp.js","assets/rolldown-runtime-hePW80VL.js","assets/chunk-75Z2AOVW-CUlVId3u.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B6xuSHsQ.js","assets/chunk-DU6HZSFF-CfQK1qG0.js","assets/dist-v5Q1xZ2K.js","assets/chunk-PWAF6VOD-BLpd1mQv.js","assets/chunk-GMAD6QVW-DJTLZiR3.js","assets/chunk-P2QGCYS3-DdjvN5Fv.js","assets/chunk-4HAMMTFA-Bhbe4n2f.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-GVQU2GXP-ZXj_Ui7F.js","assets/chunk-OSK3NFVY-CdCVGm-Q.js","assets/line-DCAoErD3.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/graphlib-DS17s2tU.js","assets/chunk-L3NEJ4N5-BNDn0rKp.js","assets/angular-html-B8mrqUL5.js","assets/html-XwrE-1r6.js","assets/javascript-obGGvMPs.js","assets/css-CNuuLpMC.js","assets/angular-ts-Bzix210W.js","assets/scss-YesllqfO.js","assets/apl-Dhin1L29.js","assets/xml-BlnrEAEy.js","assets/java-DdHNQ9hk.js","assets/json-DAgxKhMr.js","assets/astro-B-4NNgOP.js","assets/typescript-BydbNFcO.js","assets/postcss-BXeXVLqQ.js","assets/tsx-CUOciP0b.js","assets/blade-C6Gedziy.js","assets/html-derivative-i4STDFnl.js","assets/sql-DdD7vxS4.js","assets/bsl-_VjlB9mv.js","assets/sdbl-bTVj8UrX.js","assets/c-iCihek07.js","assets/cairo-DLTphjLi.js","assets/python-gzcpVVnB.js","assets/chapel-DmtgEXO_.js","assets/cobol-Cw2-KvLW.js","assets/coffee-CiiSLhB6.js","assets/cpp-71xkOQct.js","assets/regexp-DR20uMnK.js","assets/glsl-D5MA2a_X.js","assets/crystal-DGPAtLeY.js","assets/shellscript-Da78Ox-3.js","assets/edge-DCY0a-ow.js","assets/elixir-DP304Xio.js","assets/elm-o4NJxfws.js","assets/erb-C7MPl934.js","assets/ruby-B8JcIHv0.js","assets/haml-CwEpbK1d.js","assets/graphql-Ctjuxyvl.js","assets/jsx-gTgmArGx.js","assets/lua-FONpmTUP.js","assets/yaml-Du_6cdrH.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-BDPpS8w6.js","assets/glimmer-js-BONyzAsu.js","assets/glimmer-ts-f9c0GCOe.js","assets/hack-Dh_ZLRbs.js","assets/handlebars-ryMP1rBR.js","assets/http-kmH8AyfE.js","assets/hurl-DCZHXKU4.js","assets/csv-Dx-8-gkx.js","assets/hxml-Dcm88srW.js","assets/haxe-C8oCnwJJ.js","assets/jinja-B-tLrNsM.js","assets/jison-CBjhYtSs.js","assets/julia-CXJVy74_.js","assets/r-BHcO8Vjq.js","assets/just-B9Xn_Dp4.js","assets/perl-DEgXgjuC.js","assets/latex-o9DRzaEe.js","assets/tex-BK-H2Wn4.js","assets/liquid-G0MH4h_m.js","assets/marko-DV5GrDmo.js","assets/less-DVTAwKKz.js","assets/mdc-BKfPFPZw.js","assets/nextflow-BJtWHP5T.js","assets/nextflow-groovy-DJMQeKeT.js","assets/nginx-BTMw9COX.js","assets/nim-B6yJ_yaC.js","assets/org-Ddi8Gs6E.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-B9UPq-vz.js","assets/vb-DOwzaHZ0.js","assets/raku-B3gFvitq.js","assets/rust-Cfkwpbl8.js","assets/scala-BiFt_7mu.js","assets/zig-CMLA9XwU.js","assets/xsl-BOPS8gLt.js","assets/pug-DkgDHZci.js","assets/qml-_a-QhfPD.js","assets/razor-BMJ0eI3p.js","assets/rst-BQCbfb9V.js","assets/cmake-Bj61d0ZC.js","assets/sas-CBpMWA2M.js","assets/shaderlab-TOUzSsQk.js","assets/hlsl-Cvrh5tZx.js","assets/shellsession-CVsQGYfZ.js","assets/soy-DEd-qcad.js","assets/sparql-D_iOobhT.js","assets/turtle-ByJddavk.js","assets/stata-CMv7m7Gi.js","assets/surrealql-BZoq2lXR.js","assets/svelte-Bj3Hmc9F.js","assets/templ-TjxbArHn.js","assets/ts-tags-Cc5do7zu.js","assets/twig-BVSnuTf-.js","assets/typst-C40W_gC6.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-BNQF7r6F.js","assets/vue-html-DkKkQnZL.js","assets/vue-vine-DFaKYU4X.js","assets/stylus-B6D30XZt.js","assets/CodeMirrorEditor-DZD0ukoD.js"])))=>i.map(i=>d[i]);
2
2
  import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ee(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P=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)},F={map:ee,forEach:function(e,t,n){ee(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ee(e,function(){t++}),t},toArray:function(e){return ee(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=F,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:te}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,P)}catch(e){P(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),i=n(((e,t)=>{t.exports=r()})),a=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}}}})),o=n(((e,t)=>{t.exports=a()})),s=n((e=>{var t=i();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 a={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},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(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=a,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 s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.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,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,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=l(t.as,t.crossOrigin);a.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??a.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=l(n,t.crossOrigin);a.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=l(t.as,t.crossOrigin);a.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 a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.8`})),c=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=s()})),l=n((e=>{var t=o(),n=i(),r=c();function a(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 s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(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 u(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 d(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 f(e){if(l(e)!==e)throw Error(a(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return f(i),e;if(o===r)return f(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function ee(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?ee(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ee(e(t))}catch{}}return null}var te=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,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function ae(e){return{current:e}}function oe(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function se(e,t){ie++,re[ie]=e.current,e.current=t}var ce=ae(null),le=ae(null),ue=ae(null),de=ae(null);function fe(e,t){switch(se(ue,t),se(le,e),se(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?of(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=of(t),e=sf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}oe(ce),se(ce,e)}function pe(){oe(ce),oe(le),oe(ue)}function me(e){e.memoizedState!==null&&se(de,e);var t=ce.current,n=sf(t,e.type);t!==n&&(se(le,e),se(ce,n))}function he(e){le.current===e&&(oe(ce),oe(le)),de.current===e&&(oe(de),gp._currentValue=ne)}var ge,_e;function ve(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ge+e+_e}var ye=!1;function be(e,t){if(!e||ye)return``;ye=!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(`
@@ -176,8 +176,8 @@ Error generating stack: `+e.message+`
176
176
  `&&n++);return t}(u),[u]),f=(0,I.useMemo)(()=>{let e=``;for(let t=1;t<=d;t++)e+=`${e?`
177
177
  `:``}${t}`;return e},[d]),p=(0,I.useMemo)(()=>{if(!0===r&&!c)return{"--markstream-pre-line-number-width":`${Math.max(2,String(d).length)}ch`,"--markstream-code-padding-left":`calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))`}},[c,r,d]),m=(0,I.useMemo)(()=>{let e=!0===t?.split(/\s+/).includes(`code-fallback-plain`),n=e?rv():{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,fontSize:16,lineHeight:28},r=e?function(e,t=8){return{top:t,bottom:t}}(0,c?0:8):{top:0,bottom:0};return{"--markstream-pre-line-number-top":`${r.top}px`,fontFamily:n.fontFamily,fontSize:`${n.fontSize}px`,lineHeight:`${n.lineHeight}px`,paddingBottom:`${r.bottom}px`,paddingTop:`${r.top}px`,tabSize:e?4:2,...i,...p}},[t,c,p,i]);return(0,L.jsx)(`pre`,{className:[o,t,r?`markstream-pre--line-numbers`:``,c?`markstream-pre--diff-preview`:``,c&&n?`markstream-pre--diff-inline`:``].filter(Boolean).join(` `),style:m,"aria-busy":!0===e?.loading,"aria-label":s,"data-language":a,"data-markstream-line-numbers":r?`1`:void 0,"data-markstream-pre":`1`,tabIndex:0,children:c?(0,L.jsx)(`code`,{translate:`no`,className:`markstream-pre__diff-code`,children:l.map(e=>(0,L.jsx)(`span`,{className:[`markstream-pre__diff-pane`,e.className].join(` `),children:e.lines.map(e=>(0,L.jsxs)(`span`,{className:[`markstream-pre__diff-line`,`markstream-pre__diff-line--${e.kind}`,e.empty?`markstream-pre__diff-line--empty`:``].filter(Boolean).join(` `),children:[(0,L.jsx)(`span`,{className:`markstream-pre__diff-rail`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`markstream-pre__diff-number`,"aria-hidden":`true`,children:e.number}),(0,L.jsx)(`span`,{className:`markstream-pre__diff-content`,children:(0,L.jsx)(`span`,{className:`markstream-pre__diff-content-inner`,children:e.code})})]},e.key))},e.key))}):(0,L.jsxs)(L.Fragment,{children:[r&&(0,L.jsx)(`span`,{className:`markstream-pre__line-numbers`,"aria-hidden":`true`,children:(0,L.jsx)(`span`,{className:`markstream-pre__line-numbers-text`,children:f})}),(0,L.jsx)(`code`,{translate:`no`,className:`markstream-pre__code`,children:u})]})})}function pv(e){return e.startsWith(`--`)?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function mv(e){let t={...e};if(Object.prototype.hasOwnProperty.call(t,`class`)&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,`for`)&&(t.htmlFor=t.for,delete t.for),typeof t.style==`string`){let e=function(e){let t=e.trim();if(!t)return;let n={};for(let e of t.split(`;`)){let t=e.trim();if(!t)continue;let r=t.indexOf(`:`);if(r===-1)continue;let i=pv(t.slice(0,r).trim()),a=t.slice(r+1).trim();i&&(n[i]=a)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}var hv=__,gv=f_;function _v(e,t){return d_(e,t)}function vv(e,t){return ire(e,t)}function yv(e,t,n=!1){let r=Object.entries(t??{}),i=r.length>0?r.map(([e,t])=>t===``?` ${e}`:` ${e}="${t}"`).join(``):``;return n?`<${e}${i} />`:`<${e}${i}>`}function bv(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function xv(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Sv(e){if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(Sv).join(``);if(!I.isValidElement(e))return``;let t=e;if(typeof t.type!=`string`)return Sv(t.props.children);let n=Object.entries(t.props).filter(([e,t])=>e!==`children`&&e!==`key`&&e!==`ref`&&t!=null&&typeof t!=`boolean`).map(([e,t])=>` ${e===`className`?`class`:e}="${String(t)}"`).join(``);return`<${t.type}${n}>${Sv(t.props.children)}</${t.type}>`}function kre(e){return Object.entries(e).map(([e,t])=>[e,t===``?null:t])}function Cv(e){let t=e.sourceNode,n=!0!==e.ctx?.final&&(!1===e.ctx?.final||!!t?.loading);return{loading:n,autoClosed:n||!!t?.autoClosed}}function wv(e,t,n){return function(e,t){return!!(t.propComponents?.[e]||t.propComponents?.[e.toLowerCase()])}(e,n)?h_(t):t}function Tv(e,t,n,r,i,a,o,s=Cv(i)){let c=Nl(e),l=a??function(e){return e.map(Sv).join(``)}(n),u={type:c,tag:c,attrs:kre(t),content:l,raw:o??`${yv(e,t)}${l}</${e}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);let d=xv(e,i);return d?I.createElement(d,{key:r,node:u}):null}function Are(e,t,n=`safe`,r={}){if(!e)return[];if(n===`escape`)return[e];try{let i=hv(e),a=0,o=r.keyPrefix??`ms-html`,s=[],c=[];for(let e of i){if(e.type===`text`){if(s.length>0&&s[s.length-1].hardBlocked)continue;(s.length>0?s[s.length-1].children:c).push(e.content??``),s.length>0&&s[s.length-1].sourceParts.push(e.content??``);continue}if(e.type===`self_closing`){let i=e.attrs||{},l=yv(e.tagName,i,!0),u=_v(e.tagName,t),d=!!xv(e.tagName,r);if(ol.has(e.tagName.toLowerCase())||!u&&!d&&i_(e.tagName,n))continue;if(!u&&!d&&r_(e.tagName,n)){(s.length>0?s[s.length-1].children:c).push(l),s.length>0&&s[s.length-1].sourceParts.push(l);continue}let f=gv(i,n,e.tagName),p=f.key,m=p!=null&&p!==``?p:`${o}-${a++}`,h=u?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,g=s.length>0?s[s.length-1].children:c;if(d)g.push(Tv(e.tagName,i,[],m,r,``,l,{loading:!1,autoClosed:!1}));else if(h){let t=wv(e.tagName,f,r);g.push(I.createElement(h,{...t,key:m}))}else g.push(I.createElement(e.tagName,{...mv(f),key:m,suppressHydrationWarning:!0}));s.length>0&&s[s.length-1].sourceParts.push(l);continue}if(e.type===`tag_open`){let i=s.length>0&&s[s.length-1].hardBlocked,a=_v(e.tagName,t),o=!!xv(e.tagName,r);s.push({tagName:e.tagName,children:[],attrs:e.attrs,sourceParts:[],customComponent:a||o,hardBlocked:i||ol.has(e.tagName.toLowerCase())||!a&&!o&&i_(e.tagName,n),softBlocked:!i&&!a&&!o&&r_(e.tagName,n)});continue}let i=e.tagName.toLowerCase(),l=-1;for(let e=s.length-1;e>=0;e--)if(s[e].tagName.toLowerCase()===i){l=e;break}if(l!==-1)for(;s.length>l;){let e=s.pop();if(!e)continue;let l=e.sourceParts.join(``),u=`${yv(e.tagName,e.attrs)}${l}</${e.tagName}>`,d;if(e.hardBlocked)d=null;else if(e.softBlocked)d=[yv(e.tagName,e.attrs),...e.children,`</${e.tagName}>`];else{let s=gv(e.attrs||{},n,e.tagName),c=s.key,f=c!=null&&c!==``?c:`${o}-${a++}`,p=e.customComponent?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0;if(xv(e.tagName,r)){let t=e.tagName.toLowerCase()===i?{loading:!1,autoClosed:!1}:Cv(r);d=Tv(e.tagName,e.attrs||{},e.children,f,r,l,u,t)}else d=p?I.createElement(p,{...wv(e.tagName,s,r),key:f},...e.children):I.createElement(e.tagName,{...mv(s),key:f,suppressHydrationWarning:!0},...e.children)}s.length>0?bv(s[s.length-1].children,d):bv(c,d),s.length>0&&!e.hardBlocked&&s[s.length-1].sourceParts.push(u)}}for(;s.length>0;){let e=s.pop();if(!e||e.hardBlocked)continue;let i=e.sourceParts.join(``),l=`${yv(e.tagName,e.attrs)}${i}`;if(e.softBlocked){bv(c,[yv(e.tagName,e.attrs),...e.children,`</${e.tagName}>`]),s.length>0&&s[s.length-1].sourceParts.push(l);continue}let u=gv(e.attrs||{},n,e.tagName),d=u.key,f=d!=null&&d!==``?d:`${o}-${a++}`,p=e.customComponent?t[e.tagName]||t[e.tagName.toLowerCase()]:void 0,m;m=xv(e.tagName,r)?Tv(e.tagName,e.attrs||{},e.children,f,r,i,l,Cv(r)):p?I.createElement(p,{...wv(e.tagName,u,r),key:f},...e.children):I.createElement(e.tagName,{...mv(u),key:f,suppressHydrationWarning:!0},...e.children),c.push(m),s.length>0&&s[s.length-1].sourceParts.push(l)}return c}catch{return null}}function Ev(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:null}function Dv(e){let t=e.split(/\r?\n/).filter(e=>/^\s*-\s+/.test(e)).length;return t>=3?500:t>0?280+60*t:360}function Ov(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function kv(e){return e?e.replace(/·/g,`⋅`).replace(/℃/g,`°C`):``}function Av(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)&&t>0?t:null}function jv(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`%%`)),n=Math.max(1,t.length),r=function(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(!(!e||e.startsWith(`%%`)))return(e.match(/^([A-Z][\w-]*)\b/i)?.[1])?.toLowerCase()||``}return``}(e);return r===`gantt`?220+28*n:r===`sequencediagram`?180+26*n:r===`classdiagram`||r===`statediagram`||r===`erdiagram`?180+24*n:r===`flowchart`||r===`graph`?170+28*n:200+22*n}function Mv(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function Nv(e,t,n){let r=Nl(e.type),i=(n??[]).map(e=>Nl(e)).filter(Boolean),a=r===`html_inline`||r===`html_block`;if(!a&&!i.includes(r))return null;let o=a?Nl(e.tag)||Il(e.content):Nl(e.tag)||r;if(!o)return null;let s=i.includes(o),c=t[o]??t[r]??null,l=s||a?c:null;return{tag:o,isWhitelisted:s,component:l,display:K_(l)}}function jre(e,t,n){return Nv(e,t,n)?.display===`block`}var Mre=new Set([`node`,`key`,`ref`,`ctx`,`renderNode`,`indexKey`,`__proto__`,`prototype`,`constructor`]);function Pv(e,t={}){let n={},r=new Set(t.omit??[]);if(!e||typeof e!=`object`)return n;let i=Object.getOwnPropertyDescriptors(e);for(let[e,t]of Object.entries(i))Mre.has(e)||r.has(e)||t.enumerable&&`value`in t&&(n[e]=t.value);return n}function Nre(e,t){let n=e.match(/^---[^\S\r\n]*(?:\r\n?|\n)[\s\S]*?(?:\r\n?|\n)---[^\S\r\n]*(?:\r\n?|\n)/)?.[0]??``,r=e.slice(n.length);return r.trimStart().startsWith(`%%{`)?e:n+t+r}function Fv(e){let{getTranslate:t,setTranslate:n,canStart:r,onActiveChange:i}=e,a=null,o={x:0,y:0},s={x:0,y:0};function c(e){let t=e?.pointerId;(t==null||t===a)&&a!=null&&(a=null,typeof window<`u`&&(window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),window.removeEventListener(`blur`,c)),i?.(!1))}function l(e){if(a!=null&&e.pointerId===a){if(e.buttons===0){c();return}n({x:s.x+(e.clientX-o.x),y:s.y+(e.clientY-o.y)})}}function u(e){if(e.button===0&&a==null&&!(r&&!r(e))){if(e.preventDefault(),a=e.pointerId,o={x:e.clientX,y:e.clientY},s=t(),typeof window>`u`){a=null;return}window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c),window.addEventListener(`blur`,c),i?.(!0)}}return{start:u,stop:c,isActive:()=>a!=null}}var Pre={plain:`plaintext`,text:`plaintext`,txt:`plaintext`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,ts:`typescript`,mts:`typescript`,cts:`typescript`,golang:`go`,py:`python`,rb:`ruby`,rs:`rust`,kt:`kotlin`,kts:`kotlin`,md:`markdown`,yml:`yaml`,sh:`shellscript`,bash:`shellscript`,zsh:`shellscript`,shell:`shellscript`,shellscript:`shellscript`,ps:`powershell`,ps1:`powershell`,pwsh:`powershell`,"c++":`cpp`,"c#":`csharp`,cs:`csharp`,objc:`objective-c`,objectivec:`objective-c`,"objective-c":`objective-c`,objectivecpp:`objective-cpp`,"objective-c++":`objective-cpp`,"objective-cpp":`objective-cpp`};function Fre(e){let t=String(e??``).trim();if(!t)return``;let[n=``]=t.split(/\s+/);return n.split(`:`)[0]?.trim().toLowerCase()??``}function Ire(e){let t=Fre(e);return Pre[t]??t}function Iv(e,t,n=1){let r=Number(e);return Number.isFinite(r)?Math.max(n,r):t}function Lv(e,t){let n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var Rv=2048,Lre=200;function zv(){return typeof performance<`u`?performance.now():Date.now()}var Rre=class{constructor(e={},t){this.source=``,this.visible=``,this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.timerId=null,this.visibilityListener=null,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.fenceScanOffset=0,this.fenceLineStart=0,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.activeFenceMarker=``,this.activeFenceLength=0,this.blockedRevealEnd=0,this.atomicRevealRanges=[],this.atomicRevealRangeIndex=0,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=e=>this.destroyed?()=>{}:(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.enqueue=e=>{if(this.destroyed||!e)return;this.done&&=!1;let t=this.source.length>0,n=this.pendingChars<=0,r=this.isRevealBlocked();if(this.source+=e,this.scanAppendedSource(),n||r&&!this.isRevealBlocked()){let e=zv();this.startedAt=t&&this.hasStarted?e-this.normalizedStartDelayMs:e,this.lastTick=e,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(e={})=>{if(!this.destroyed){if(this.done=!0,this.releaseTrailingFenceCandidate(),e.flush??this.flushOnFinish){this.visible=this.source,this.discardConsumedAtomicRanges(),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.releaseTrailingFenceCandidate(),this.visible=this.source,this.discardConsumedAtomicRanges(),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(e=``,t)=>{if(this.destroyed)return;this.cancelLoop(),t?.prefixKnown||e.startsWith(this.source)?(this.source=e,this.scanAppendedSource()):(this.resetFenceScanner(),this.source=e,this.scanAppendedSource());let n=this.getRevealableEnd();this.visible=n>=this.source.length?this.source:this.source.slice(0,n),this.discardConsumedAtomicRanges(),this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit()},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;let e=zv();this.lastTick=e,this.startedAt||=e,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.detachVisibilityListener(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=e=>{if(this.rafId=0,this.timerId=null,this.destroyed||this.paused)return;if(!this.hasRevealableChars()){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(e-this.startedAt<this.normalizedStartDelayMs){this.ensureLoop();return}let t=this.pendingChars;if(this.burstInitialContent&&t>=this.burstRevealThresholdChars){let e=this.getRevealableEnd();this.visible.length<e&&(this.visible=e>=this.source.length?this.source:this.source.slice(0,e),this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit()),this.ensureLoop();return}let n=1e3/Math.max(1,this.maxCommitFps),r=Math.min(100,Math.max(0,e-this.lastTick));if(r<n){this.ensureLoop();return}this.lastTick=e;let i=this.pendingChars,a=i>this.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,o=Vre(i/Math.max(.001,a/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(o-this.currentCps)*.2,this.charBudget+=this.currentCps*(r/1e3),this.charBudget<1){this.ensureLoop();return}let s=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),c=this.takeNextRevealSlice(s);c.text&&(this.visible+=c.text,this.charBudget=Math.max(0,this.charBudget-c.graphemeCount),this.emit()),this.ensureLoop()},this.handleVisibilityChange=()=>{if(!this.destroyed){if(this.isDocumentHidden()){this.cancelLoop(),this.ensureLoop();return}(this.timerId!=null||!this.rafId)&&(this.cancelLoop(),this.ensureLoop())}};let{minCharsPerSecond:n=40,maxCharsPerSecond:r=1e3,targetLatencyMs:i=900,catchUpLatencyMs:a=350,catchUpThreshold:o=600,maxCommitFps:s=30,startDelayMs:c=80,maxCharsPerCommit:l=80,flushOnFinish:u=!1,burstInitialContent:d=!1,burstRevealThresholdChars:f=Rv}=e;this.minCharsPerSecond=Iv(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,Iv(r,1e3,1)),this.normalizedTargetLatencyMs=Iv(i,900,1),this.normalizedCatchUpLatencyMs=Iv(a,350,1),this.normalizedCatchUpThreshold=Lv(o,600),this.normalizedStartDelayMs=Lv(c,80),this.maxCommitFps=Math.trunc(Iv(s,30,1)),this.maxCharsPerCommit=Math.trunc(Iv(l,80,1)),this.flushOnFinish=u,this.burstInitialContent=d===!0,this.burstRevealThresholdChars=Math.max(1,Math.trunc(Iv(f,Rv,1))),this.segmenter=Bre(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}attachVisibilityListener(){this.visibilityListener||typeof document>`u`||typeof document.addEventListener!=`function`||(this.visibilityListener=this.handleVisibilityChange,document.addEventListener(`visibilitychange`,this.visibilityListener))}detachVisibilityListener(){!this.visibilityListener||typeof document>`u`||typeof document.removeEventListener!=`function`||(document.removeEventListener(`visibilitychange`,this.visibilityListener),this.visibilityListener=null)}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}resetFenceScanner(){this.fenceScanOffset=0,this.fenceLineStart=0,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.activeFenceMarker=``,this.activeFenceLength=0,this.blockedRevealEnd=0,this.atomicRevealRanges.length=0,this.atomicRevealRangeIndex=0}scanAppendedSource(e=!1){for(;this.fenceScanOffset<this.source.length;){let t=this.source[this.fenceScanOffset];if(t===`\r`){if(this.fenceScanOffset+1>=this.source.length&&!e)break;if(this.source[this.fenceScanOffset+1]===`
178
178
  `){let e=this.fenceScanOffset+2;this.completeFenceLine(e),this.fenceScanOffset=e;continue}}if(t===`
179
- `){let e=this.fenceScanOffset+1;this.completeFenceLine(e),this.fenceScanOffset=e;continue}this.consumeFenceCharacter(t),this.fenceScanOffset++}this.updateFenceRevealBlock()}consumeFenceCharacter(e){if(this.fenceLineState!==`normal`){if(this.fenceLineState===`opening`){this.fenceMarker==="`"&&e==="`"&&(this.fenceLineState=`normal`);return}if(this.fenceLineState===`closing`){e!==` `&&e!==` `&&(this.fenceLineState=`normal`);return}if(!this.fenceMarker){if(e===` `&&this.fenceIndent<3){this.fenceIndent++;return}if(e==="`"||e===`~`){this.fenceMarker=e,this.fenceMarkerLength=1;return}this.fenceLineState=`normal`;return}if(e===this.fenceMarker){this.fenceMarkerLength++;return}if(this.activeFenceMarker){this.fenceLineState=this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(e===` `||e===` `)?`closing`:`normal`;return}this.fenceLineState=this.fenceMarkerLength>=3?`opening`:`normal`}}completeFenceLine(e){let t=this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3;!this.activeFenceMarker&&(this.fenceLineState===`opening`||t)?(this.atomicRevealRanges.push({start:this.fenceLineStart,end:e}),this.activeFenceMarker=this.fenceMarker,this.activeFenceLength=this.fenceMarkerLength):this.activeFenceMarker&&this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(this.fenceLineState===`closing`||t)&&(this.activeFenceMarker=``,this.activeFenceLength=0),this.fenceLineStart=e,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.blockedRevealEnd=0}updateFenceRevealBlock(){this.blockedRevealEnd=!this.activeFenceMarker&&(this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&(this.fenceIndent>0||this.fenceMarkerLength>0))?this.fenceLineStart+1:0}releaseTrailingFenceCandidate(){this.scanAppendedSource(!0),this.blockedRevealEnd&&=((this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3)&&this.source.length>this.fenceLineStart&&this.atomicRevealRanges.push({start:this.fenceLineStart,end:this.source.length}),this.fenceLineState=`normal`,0)}isRevealBlocked(){return this.blockedRevealEnd!==0}getRevealableEnd(){return this.blockedRevealEnd?Math.min(this.source.length,this.blockedRevealEnd-1):this.source.length}hasRevealableChars(){return this.visible.length<this.getRevealableEnd()}takeNextRevealSlice(e){this.discardConsumedAtomicRanges();let t=this.getRevealableEnd();if(this.visible.length>=t)return{text:``,graphemeCount:0};let n=this.atomicRevealRanges[this.atomicRevealRangeIndex];if(n&&this.visible.length>=n.start&&this.visible.length<n.end)return Bv(this.source,this.visible.length,n.end-this.visible.length,this.segmenter,Math.min(n.end,t));let r=n&&n.start>this.visible.length?Math.min(n.start,t):t;return Bv(this.source,this.visible.length,e,this.segmenter,r)}discardConsumedAtomicRanges(){for(;this.atomicRevealRangeIndex<this.atomicRevealRanges.length&&this.atomicRevealRanges[this.atomicRevealRangeIndex].end<=this.visible.length;)this.atomicRevealRangeIndex++;this.atomicRevealRangeIndex>=64&&this.atomicRevealRangeIndex*2>=this.atomicRevealRanges.length&&(this.atomicRevealRanges.splice(0,this.atomicRevealRangeIndex),this.atomicRevealRangeIndex=0)}isDocumentHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}ensureLoop(){if(!(this.destroyed||this.rafId||this.timerId!=null||this.paused||!this.hasRevealableChars())){if(typeof requestAnimationFrame!=`function`){this.flush();return}if(this.attachVisibilityListener(),this.isDocumentHidden()&&typeof setTimeout==`function`){this.timerId=setTimeout(()=>{this.timerId=null,this.tick(zv())},Lre);return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&=(typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.rafId),0),this.timerId!=null&&(clearTimeout(this.timerId),this.timerId=null),this.detachVisibilityListener()}emit(){if(!this.destroyed)for(let e of this.listeners)e()}};function zre(e={},t){let n=new Rre(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function Bre(){if(typeof Intl>`u`)return null;let e=Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null}function Bv(e,t,n,r,i=e.length){let a=Math.min(e.length,Math.max(t,i));if(t>=a||n<=0)return{text:``,graphemeCount:0};if(!r){let r=t,i=0;for(;r<a&&i<n;){let t=e.charCodeAt(r),n=e.charCodeAt(r+1);r=Math.min(a,r+(t>=55296&&t<=56319&&n>=56320&&n<=57343?2:1)),i++}return{text:e.slice(t,r),graphemeCount:i}}let o=t,s=0,c=!0;for(;s<n&&o<a;){let t=e.codePointAt(o),n=t>65535?2:1;if(o+n>a||!Vv(t)){c=!1;break}o+=n,s++}if(c&&o>t&&!(o<a&&e.charCodeAt(o-1)===13&&e.charCodeAt(o)===10)){let n=e.codePointAt(o),r=n!=null&&o+(n!=null&&n>65535?2:1)<=a&&Vv(n);if(o>=a||r)return{text:e.slice(t,o),graphemeCount:s}}let l=a-t,u=Math.min(l,Math.max(64,n*2));for(;;){let i=u>=l,a=e.slice(t,t+u),o=0,s=0;for(let i of r.segment(a)){if(s>=n)return{text:e.slice(t,t+o),graphemeCount:s};o+=i.segment.length,s++}if(i)return{text:e.slice(t,t+o),graphemeCount:s};u=Math.min(l,u*2)}}function Vre(e,t,n){return Math.min(n,Math.max(t,e))}function Hre(e){return e>=11904&&e<=12329||e>=12336&&e<=12351||e>=12352&&e<=12440||e>=12443&&e<=12543||e>=12544&&e<=12799||e>=12800&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65103||e>=65280&&e<=65437||e>=65440&&e<=65519||e>=127488&&e<=127743||e>=131072&&e<=196607}function Vv(e){return e<=127||Hre(e)}var Hv=Math.min,Uv=Math.max,Wv=Math.round,Gv=Math.floor,Kv=e=>({x:e,y:e}),Ure={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Wre(e,t,n){return Uv(e,Hv(t,n))}function qv(e,t){return typeof e==`function`?e(t):e}function Jv(e){return e.split(`-`)[0]}function Yv(e){return e.split(`-`)[1]}function Xv(e){return e===`x`?`y`:`x`}function Zv(e){return e===`y`?`height`:`width`}function Qv(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $v(e){return Xv(Qv(e))}function Gre(e,t,n){n===void 0&&(n=!1);let r=Yv(e),i=$v(e),a=Zv(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ry(o)),[o,ry(o)]}function Kre(e){let t=ry(e);return[ey(e),t,ey(t)]}function ey(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ty=[`left`,`right`],ny=[`right`,`left`],qre=[`top`,`bottom`],Jre=[`bottom`,`top`];function Yre(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ny:ty:t?ty:ny;case`left`:case`right`:return t?qre:Jre;default:return[]}}function Xre(e,t,n,r){let i=Yv(e),a=Yre(Jv(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ey)))),a}function ry(e){let t=Jv(e);return Ure[t]+e.slice(t.length)}function Zre(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Qre(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Zre(e)}function iy(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 ay(e,t,n){let{reference:r,floating:i}=e,a=Qv(t),o=$v(t),s=Zv(o),c=Jv(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=Yv(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function $re(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}=qv(t,e),p=Qre(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=iy(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=iy(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 eie=50,tie=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:$re},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ay(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<eie&&(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}=ay(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},nie=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}=qv(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Jv(r),_=Qv(o),v=Jv(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ry(o)]:Kre(o)),x=p!==`none`;!d&&x&&b.push(...Xre(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=Gre(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`||_===Qv(t)||T.every(e=>Qv(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=Qv(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{}}}},rie=new Set([`left`,`top`]);async function iie(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Jv(n),s=Yv(n),c=Qv(n)===`y`,l=rie.has(o)?-1:1,u=a&&c?-1:1,d=qv(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 aie=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 iie(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}}}}},oie=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}=qv(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Qv(i),p=Xv(f),m=u[p],h=u[f],g=(e,t)=>Wre(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}}}}}};function oy(){return typeof window<`u`}function sy(e){return uy(e)?(e.nodeName||``).toLowerCase():`#document`}function cy(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ly(e){return((uy(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function uy(e){return oy()?e instanceof Node||e instanceof cy(e).Node:!1}function dy(e){return oy()?e instanceof Element||e instanceof cy(e).Element:!1}function fy(e){return oy()?e instanceof HTMLElement||e instanceof cy(e).HTMLElement:!1}function py(e){return!oy()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof cy(e).ShadowRoot}function my(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xy(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function sie(e){return/^(table|td|th)$/.test(sy(e))}function hy(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var cie=/transform|translate|scale|rotate|perspective|filter/,lie=/paint|layout|strict|content/,gy=e=>!!e&&e!==`none`,_y;function vy(e){let t=dy(e)?xy(e):e;return gy(t.transform)||gy(t.translate)||gy(t.scale)||gy(t.rotate)||gy(t.perspective)||!yy()&&(gy(t.backdropFilter)||gy(t.filter))||cie.test(t.willChange||``)||lie.test(t.contain||``)}function uie(e){let t=Cy(e);for(;fy(t)&&!by(t);){if(vy(t))return t;if(hy(t))return null;t=Cy(t)}return null}function yy(){return _y??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),_y}function by(e){return/^(html|body|#document)$/.test(sy(e))}function xy(e){return cy(e).getComputedStyle(e)}function Sy(e){return dy(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cy(e){if(sy(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||py(e)&&e.host||ly(e);return py(t)?t.host:t}function wy(e){let t=Cy(e);return by(t)?(e.ownerDocument||e).body:fy(t)&&my(t)?t:wy(t)}function Ty(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wy(e),i=r===e.ownerDocument?.body,a=cy(r);if(i){let e=Ey(a);return t.concat(a,a.visualViewport||[],my(r)?r:[],e&&n?Ty(e):[])}return t.concat(r,Ty(r,[],n))}function Ey(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Dy(e){let t=xy(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=fy(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Wv(n)!==a||Wv(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Oy(e){return dy(e)?e:e.contextElement}function ky(e){let t=Oy(e);if(!fy(t))return Kv(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Dy(t),o=(a?Wv(n.width):n.width)/r,s=(a?Wv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var die=Kv(0);function Ay(e){let t=cy(e);return!yy()||!t.visualViewport?die:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function fie(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===cy(e)}function jy(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Oy(e),o=Kv(1);t&&(r?dy(r)&&(o=ky(r)):o=ky(e));let s=fie(a,n,r)?Ay(a):Kv(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=cy(a),t=dy(r)?cy(r):r,n=e,i=Ey(n);for(;i&&t!==n;){let e=ky(i),t=i.getBoundingClientRect(),r=xy(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=cy(i),i=Ey(n)}}return iy({width:u,height:d,x:c,y:l})}function My(e,t){let n=Sy(e).scrollLeft;return t?t.left+n:jy(ly(e)).left+n}function Ny(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-My(e,n),y:n.top+t.scrollTop}}function pie(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ly(r),s=t?hy(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Kv(1),u=Kv(0),d=fy(r);if((d||!a)&&((sy(r)!==`body`||my(o))&&(c=Sy(r)),d)){let e=jy(r);l=ky(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ny(o,c):Kv(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 mie(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function hie(e){let t=Sy(e),n=e.ownerDocument.body,r=Uv(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Uv(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+My(e),o=-t.scrollTop;return xy(n).direction===`rtl`&&(a+=Uv(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var gie=25;function _ie(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=cy(e),a=ly(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!yy()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(My(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<=gie&&(s-=o)}return{width:s,height:c,x:l,y:u}}function vie(e,t){let n=jy(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ky(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Py(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=_ie(e,n,t);else if(t===`document`)r=hie(ly(e));else if(dy(t))r=vie(t,n);else{let n=Ay(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return iy(r)}function yie(e,t){let n=t.get(e);if(n)return n;let r=Ty(e,[],!1).filter(e=>dy(e)&&sy(e)!==`body`),i=null,a=xy(e).position===`fixed`,o=a?Cy(e):e;for(;dy(o)&&!by(o);){let e=xy(o),t=vy(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Cy(o)}return t.set(e,r),r}function bie(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?hy(t)?[]:yie(t,this._c):[].concat(n),r],o=Py(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=Py(t,a[e],i);s=Uv(n.top,s),c=Hv(n.right,c),l=Hv(n.bottom,l),u=Uv(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function xie(e){let{width:t,height:n}=Dy(e);return{width:t,height:n}}function Sie(e,t,n){let r=fy(t),i=ly(t),a=n===`fixed`,o=jy(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Kv(0);if((r||!a)&&((sy(t)!==`body`||my(i))&&(s=Sy(t)),r)){let e=jy(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=My(i));let l=i&&!r&&!a?Ny(i,s):Kv(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 Fy(e){return xy(e).position===`static`}function Iy(e,t){if(!fy(e)||xy(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ly(e)===n&&(n=n.ownerDocument.body),n}function Ly(e,t){let n=cy(e);if(hy(e))return n;if(!fy(e)){let t=Cy(e);for(;t&&!by(t);){if(dy(t)&&!Fy(t))return t;t=Cy(t)}return n}let r=Iy(e,t);for(;r&&sie(r)&&Fy(r);)r=Iy(r,t);return r&&by(r)&&Fy(r)&&!vy(r)?n:r||uie(e)||n}var Cie=async function(e){let t=this.getOffsetParent||Ly,n=this.getDimensions,r=await n(e.floating);return{reference:Sie(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wie(e){return xy(e).direction===`rtl`}var Tie={convertOffsetParentRelativeRectToViewportRelativeRect:pie,getDocumentElement:ly,getClippingRect:bie,getOffsetParent:Ly,getElementRects:Cie,getClientRects:mie,getDimensions:xie,getScale:ky,isElement:dy,isRTL:wie};function Ry(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eie(e,t,n){let r=null,i,a=ly(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=Gv(d),h=Gv(a.clientWidth-(u+f)),g=Gv(a.clientHeight-(d+p)),_=Gv(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Uv(0,Hv(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ry(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=cy(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Die(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=Oy(e),u=i||a?[...l?Ty(l):[],...t?Ty(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Eie(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?jy(e):null;c&&g();function g(){let t=jy(e);h&&!Ry(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 Oie=aie,kie=oie,Aie=nie,jie=(e,t,n)=>{let r=new Map,i=n??{},a={...Tie,...i.platform,_c:r};return tie(e,t,{...i,platform:a})},zy={note:`ℹ️`,info:`ℹ️`,tip:`💡`,warning:`⚠️`,danger:`❗`,error:`⛔`,caution:`⚠️`};function Mie(e){let{node:t,ctx:n,renderNode:r,indexKey:i,isDark:a}=e,o=String(t.kind||`note`),s=(0,I.useMemo)(()=>t.title&&String(t.title).trim().length?String(t.title):o.charAt(0).toUpperCase()+o.slice(1),[o,t.title]),[c,l]=(0,I.useState)(()=>{var e;return!!t.collapsible&&!((e=t.open)==null||e)}),u=(0,I.useMemo)(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[]);return(0,L.jsxs)(`div`,{className:`admonition admonition-${o}${a?` is-dark`:``}`,"data-index-key":i,children:[(0,L.jsxs)(`div`,{id:u,className:`admonition-header`,children:[zy[o]&&(0,L.jsx)(`span`,{className:`admonition-icon`,children:zy[o]}),(0,L.jsx)(`span`,{className:`admonition-title`,children:s}),t.collapsible&&(0,L.jsx)(`button`,{type:`button`,className:`admonition-toggle`,"aria-expanded":!c,"aria-controls":`${u}-content`,title:c?`Expand`:`Collapse`,onClick:()=>l(e=>!e),children:(0,L.jsx)(`span`,{children:c?`▶`:`▼`})})]}),!c&&(0,L.jsx)(`div`,{id:`${u}-content`,className:`admonition-content`,"aria-labelledby":u,children:n&&r?L_(t.children,n,String(i??u),r):null})]})}var By=(0,I.createContext)(!1),Vy=(0,I.createContext)(null);function Hy(){return(0,I.useContext)(Vy)}var Uy=(0,I.createContext)(null);function Wy(e,t){let n=typeof window<`u`&&typeof document<`u`,r=n?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,i=n?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null,a=null,o=null,s=new Map,c=new Set,l=null,u=()=>{if(!s.size){try{a?.disconnect()}catch{}a=null,o=null,c.size||(()=>{if(l!=null){try{i?.(l)}catch{}l=null}})()}},d=e=>{let t=s.get(e);if(t){t.state.current=!0;try{t.resolve()}catch{}try{a?.unobserve(e)}catch{}s.delete(e),c.delete(e),u()}},f=()=>{r&&l==null&&c.size&&(l=r(()=>{l=null;let e=c.values().next().value;e&&(c.delete(e),d(e),c.size&&f())},{timeout:1200}))};return(r,i)=>{let l={current:!1},p,m=!1,h=new Promise(e=>{p=()=>{m||(m=!0,e())}}),g=()=>{if(s.has(r)){s.delete(r);try{a?.unobserve(r)}catch{}}c.delete(r),u()};if(!n||!t())return l.current=!0,p(),{isVisible:()=>!0,whenVisible:h,destroy:g};let _=((t,r)=>{if(!n||typeof IntersectionObserver>`u`)return null;let i=((t,n)=>({root:e()??null,rootMargin:t,threshold:n}))(t,r);if(a&&(l=i,(c=o)&&c.root===l.root&&c.rootMargin===l.rootMargin&&c.threshold===l.threshold))return a;var c,l;if(a)try{a.disconnect()}catch{}a=new IntersectionObserver(e=>{for(let t of e)(t.isIntersecting||t.intersectionRatio>0)&&d(t.target)},{root:i.root,rootMargin:i.rootMargin,threshold:i.threshold}),o=i;for(let e of s.keys())a.observe(e);return a})(i?.rootMargin??`300px`,i?.threshold??0);return _?(s.set(r,{resolve:p,state:l}),_.observe(r),c.add(r),f(),{isVisible:()=>l.current,whenVisible:h,destroy:g}):(l.current=!0,p(),{isVisible:()=>!0,whenVisible:h,destroy:g})}}var Nie=Wy(()=>null,()=>!0);function Pie({getRoot:e,enabled:t=!0,children:n}){let r=(0,I.useRef)(t);r.current=t;let i=(0,I.useRef)(e);i.current=e;let a=(0,I.useMemo)(()=>Wy(()=>i.current?.call(i)??null,()=>r.current),[]);return(0,L.jsx)(Uy.Provider,{value:a,children:n})}function Gy(){return(0,I.useContext)(Uy)??Nie}function Fie(e={}){let t=(0,I.useRef)(null);t.current||=zre(e);let n=t.current,[r,i]=(0,I.useState)(()=>n.getSnapshot());return(0,I.useEffect)(()=>{let e=n.subscribe(()=>{i(n.getSnapshot())});return n.resume(),i(n.getSnapshot()),()=>{e(),n.pause()}},[n]),(0,I.useMemo)(()=>({...r,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,getSnapshot:n.getSnapshot}),[n,r])}function Iie(e){let{node:t}=e;return(0,L.jsx)(`span`,{className:`checkbox-node`,children:(0,L.jsx)(`input`,{type:`checkbox`,checked:!!t.checked,disabled:!0,className:`checkbox-input`,readOnly:!0})})}var Ky={"common.copy":`Copy`,"common.copied":`Copied`,"common.decrease":`Decrease`,"common.reset":`Reset`,"common.increase":`Increase`,"common.expand":`Expand`,"common.collapse":`Collapse`,"common.preview":`Preview`,"common.source":`Source`,"common.export":`Export`,"common.open":`Open`,"common.close":`Close`,"common.zoomIn":`Zoom in`,"common.zoomOut":`Zoom out`,"common.resetZoom":`Reset zoom`,"image.loadError":`Image failed to load`,"image.loading":`Loading image...`};function Lie(e){Object.assign(Ky,e)}function qy(){return{t:e=>Ky[e]??function(e){return(e.split(`.`).pop()||e).replace(/[_-]/g,` `).replace(/([A-Z])/g,` $1`).replace(/\s+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}var Jy=null,Yy=null,Xy=null,Zy=null,Qy=null,$y=null,eb=0;function tb(e,t){return!(t!==eb||e!==Yy||!e.isConnected&&(ib(!0,e),1))}async function nb(e,t,n){let r=Jy;if(!r||!tb(e,n))return!1;let{x:i,y:a}=await jie(e,r,{placement:t,middleware:[Oie(8),Aie(),kie({padding:8})],strategy:`fixed`});return!!tb(e,n)&&(r.style.transform=`translate3d(${Math.round(i)}px, ${Math.round(a)}px, 0)`,!0)}function rb(e,t,n=`top`,r=!1,i,a){if(!e?.isConnected||typeof document>`u`||(Jy||typeof document>`u`||(Jy=document.createElement(`div`),Jy.className=`markstream-react ms-tooltip`,Jy.setAttribute(`role`,`tooltip`),Jy.dataset.visible=`false`,Jy.style.position=`fixed`,Jy.style.left=`0px`,Jy.style.top=`0px`,Jy.style.transform=`translate3d(0,0,0)`,document.body.appendChild(Jy)),!Jy))return;ib(!0),Yy=e;let o=eb,s=async()=>{if(Jy&&tb(e,o)){Jy.textContent=t,Jy.dataset.placement=n,Jy.dataset.dark=function(e){if(typeof e==`boolean`)return e;if(typeof document<`u`)try{if(document.documentElement.classList.contains(`dark`))return!0}catch{}if(typeof window<`u`&&typeof window.matchMedia==`function`)try{return window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{}return!1}(a)?`true`:`false`,Jy.dataset.visible=`false`,$y=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Jy.id=$y;try{e.setAttribute(`aria-describedby`,$y)}catch{}await nb(e,n,o)&&tb(e,o)&&(Jy.dataset.visible=`true`,Xy=Die(e,Jy,()=>{nb(e,n,o)}))}};r?s():Zy=setTimeout(s,80)}function ib(e=!1,t){if(t!==void 0&&t!==Yy||(eb+=1,Zy&&=(clearTimeout(Zy),null),Qy&&=(clearTimeout(Qy),null),!Jy))return;let n=()=>{if(Jy){if(Jy.dataset.visible=`false`,Yy&&$y&&Yy.getAttribute(`aria-describedby`)===$y)try{Yy.removeAttribute(`aria-describedby`)}catch{}Yy=null,$y=null,Xy&&=(Xy(),null)}};e?n():Qy=setTimeout(n,120)}function Rie(e){let{t}=qy(),n=(0,I.useMemo)(()=>{let t=e.code||``,n=t.trim().toLowerCase();return n.startsWith(`<!doctype`)||n.startsWith(`<html`)||n.startsWith(`<body`)?t:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${e.isDark?`#020617`:`#ffffff`};\n color: ${e.isDark?`#e5e7eb`:`#020617`};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${t}\n </body>\n</html>`},[e.code,e.isDark]),r=(0,I.useMemo)(()=>{return t=e.htmlPreviewSandbox,n=e.htmlPreviewAllowScripts,typeof t==`string`?t:t===void 0&&!0===n?`allow-scripts`:``;var t,n},[e.htmlPreviewAllowScripts,e.htmlPreviewSandbox]);return(0,I.useEffect)(()=>{let t=t=>{var n;t.key!==`Escape`&&t.key!==`Esc`||(n=e.onClose)==null||n.call(e)};return typeof window<`u`&&window.addEventListener(`keydown`,t),()=>{typeof window<`u`&&window.removeEventListener(`keydown`,t)}},[e]),typeof document>`u`?null:(0,P_.createPortal)((0,L.jsx)(`div`,{className:`markstream-react html-preview-frame__backdrop`+(e.isDark?` html-preview-frame__backdrop--dark`:``),onClick:()=>e.onClose?.call(e),children:(0,L.jsxs)(`div`,{className:`html-preview-frame`+(e.isDark?` html-preview-frame--dark`:``),onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`html-preview-frame__header`,children:[(0,L.jsxs)(`div`,{className:`html-preview-frame__title`,children:[(0,L.jsx)(`span`,{className:`html-preview-frame__dot`}),(0,L.jsx)(`span`,{className:`html-preview-frame__label`,children:e.title||`HTML ${t(`common.preview`)}`})]}),(0,L.jsx)(`button`,{type:`button`,className:`html-preview-frame__close`+(e.isDark?` html-preview-frame__close--dark`:``),onClick:()=>e.onClose?.call(e),children:`×`})]}),(0,L.jsx)(`iframe`,{className:`html-preview-frame__iframe`,sandbox:r,referrerPolicy:`no-referrer`,src:`about:blank`,srcDoc:n,title:e.title||`Preview`})]})}),document.body)}var ab=!1,ob=null,sb=!1,cb=null;async function lb(){if(cb)return cb;if(ob)return ob;if(sb)return null;cb=(async()=>{try{let e=function(e){let t=typeof e?.createCodeBlockRuntime==`function`||typeof e?.useMonaco==`function`?e:e?.default,n=t?.createCodeBlockRuntime??t?.useMonaco;return typeof n==`function`?{createCodeBlockRuntime:e=>n.call(t,e),detectLanguage:(t?.detectLanguage)?.bind(t),preloadStreamDiffs:(t?.preloadStreamDiffs)?.bind(t)}:null}(await R(()=>import(`./markstream-Deoklxmw.js`),[]));if(e)return await async function(e){ab||(ab=!0,e!=null&&e.preloadStreamDiffs&&await e.preloadStreamDiffs())}(e),ob=e,ob}catch{}return sb=!0,null})();try{return await cb}finally{cb=null}}var zie=typeof window<`u`?I.useLayoutEffect:I.useEffect,Bie={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0};async function ub(e,t){if(t)try{if(!await t())return!1}catch{return!1}if(typeof window>`u`||typeof window.requestAnimationFrame!=`function`)return!1;let n=()=>new Promise(e=>window.requestAnimationFrame(()=>e()));for(let t=0;t<30;t++){await n();let t=e.querySelector([`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`))??e.firstElementChild;if(!t)continue;let r=t.getBoundingClientRect();if(r.width>0&&r.height>0)return await n(),!0}return!1}function db(e,t){let n={...t||{}};for(let e of[`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`])delete n[e];if(!e)return{overflow:`wrap`,...n};let r=n.parseDiffOptions&&typeof n.parseDiffOptions==`object`?n.parseDiffOptions:{},i={overflow:`wrap`,diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,parseDiffOptions:{context:2}};return{...i,...n,parseDiffOptions:{...i.parseDiffOptions,...r}}}function fb(e){let t=String(e??``).match(/\d+(?:\.\d+)?/g);if(!t||t.length<3)return null;let[n,r,i]=t.slice(0,3).map(Number);return .2126*n+.7152*r+.0722*i}function pb(e){let t=String(e??``).trim().toLowerCase();if(!t||t===`transparent`)return!0;let n=t.match(/^#([0-9a-f]{8})$/);if(n)return Number.parseInt(n[1].slice(6),16)===0;let r=t.match(/^#([0-9a-f]{4})$/);if(r)return Number.parseInt(r[1][3]+r[1][3],16)===0;let i=(t.match(/^(?:rgba?|hsla?)\(([^)]+)\)/)?.[1])?.split(/[\s,/]+/).filter(Boolean);return i?.length===4&&Number(i[3])===0}function Vie(e){let t={...Bie,...e},{node:n,isDark:r,loading:i,stream:a,isShowPreview:o,enableFontSizeControl:s,darkTheme:c,lightTheme:l,codeBlockOptions:u,themes:d,minWidth:f,maxWidth:p,showHeader:m,showCopyButton:h,showExpandButton:g,showPreviewButton:_,showCollapseButton:v,showFontSizeButtons:y,showLineNumbers:b,showTooltips:x}=t,S=(0,I.useRef)(null),C=(0,I.useRef)(null),w=(0,I.useRef)(null),T=(0,I.useRef)(null),E=(0,I.useRef)(null),D=(0,I.useRef)(null),O=(0,I.useRef)(null),k=(0,I.useRef)(0),A=(0,I.useRef)(null),j=(0,I.useRef)(null),M=Gy(),N=(0,I.useRef)(null),ee=(0,I.useRef)(null),te=(0,I.useRef)(u),P=(0,I.useRef)(null),F=(0,I.useRef)([]),ne=(0,I.useRef)(null),re=(0,I.useRef)(!1),ie=(0,I.useRef)(void 0),[ae,oe]=(0,I.useState)(!1),[se,ce]=(0,I.useState)(()=>typeof window>`u`),[le,ue]=(0,I.useState)(!1),[de,fe]=(0,I.useState)(!1),[pe,me]=(0,I.useState)(!1),[he,ge]=(0,I.useState)(()=>n.language||`plaintext`),[_e,ve]=(0,I.useState)(()=>Q_(n.language)),[ye,be]=(0,I.useState)(!1),[xe,Se]=(0,I.useState)(!1),[Ce,we]=(0,I.useState)(!1),[Te,Ee]=(0,I.useState)(!1),[De,Oe]=(0,I.useState)(0),{t:ke}=qy();(0,I.useEffect)(()=>{re.current=xe},[xe]);let Ae=(0,I.useMemo)(()=>db(!!n.diff,u),[u,n.diff]),[je,Me]=(0,I.useState)(()=>{let e=Number(db(!!n.diff,u)?.fontSize);return Number.isFinite(e)&&e>0?e:12}),[Ne,Pe]=(0,I.useState)(je),Fe=(0,I.useMemo)(()=>!1!==x,[x]),Ie=typeof b==`boolean`?b:!0!==Ae.disableLineNumbers,Le=(0,I.useRef)(Ie),Re=Number(te.current?.fontSize),ze=Number(u?.fontSize),Be=te.current!==u&&Number.isFinite(Re)&&Re>0&&(!Number.isFinite(ze)||ze<=0),Ve=(0,I.useCallback)(()=>{let e=Ae.maxHeight??500;return typeof e==`number`&&Number.isFinite(e)?e:500},[Ae.maxHeight]);zie(()=>{let e=Number(Ae.fontSize),t=Number.isFinite(e)&&e>0?e:12;Me(t),Pe(t)},[Ae.fontSize]);let He=(0,I.useCallback)(e=>{var t;if(ae)return;let n=S.current,r=w.current;if(!n||!r)return;let i=D.current===`diff`?r.getDiffEditorView?.call(r):r.getEditorView?.call(r);if(!i)return;let a=Ve(),o=D.current===`diff`,s=o?`important`:``;e?(n.style.minHeight=`0px`,n.style.setProperty(`max-height`,`none`,s),n.style.overflow=`visible`):(n.style.minHeight=`0px`,n.style.setProperty(`max-height`,`${Math.ceil(a)}px`,s),n.style.overflow=o?`hidden`:`auto`);try{let r=Number((()=>{if(typeof i.getContentHeight==`function`)return i.getContentHeight();if(o&&typeof i.getModifiedEditor==`function`){let e=i.getModifiedEditor();if(e&&typeof e.getContentHeight==`function`)return e.getContentHeight()}})());if(Number.isFinite(r)&&r>0){let t=e?r:Math.min(r,a);n.style.setProperty(`height`,`${Math.ceil(Math.max(1,t))}px`,s)}(t=i.layout)==null||t.call(i)}catch{}},[Ve,ae]),Ue=(0,I.useCallback)(e=>{if(He(e),typeof window>`u`||typeof window.requestAnimationFrame!=`function`)return;let t=window.requestAnimationFrame(()=>{He(e),window.requestAnimationFrame(()=>He(e))});return window.setTimeout(()=>He(e),180),()=>window.cancelAnimationFrame(t)},[He]),We=(0,I.useCallback)(()=>{var e,t;for(let t of F.current)try{typeof t==`function`?t():(e=t?.dispose)==null||e.call(t)}catch{}F.current=[],(t=ne.current)==null||t.disconnect(),ne.current=null},[]),Ge=(0,I.useCallback)(()=>{We();let e=w.current,t=S.current;if(!e||!t||D.current!==`diff`)return;let n=()=>Ue(re.current),r=(e,t)=>{try{let r=e?.[t];if(typeof r!=`function`)return;let i=r.call(e,n);i&&F.current.push(i)}catch{}},i=e.getDiffEditorView?.call(e),a=(i?.getOriginalEditor)?.call(i),o=(i?.getModifiedEditor)?.call(i);if(r(i,`onDidUpdateDiff`),r(a,`onDidContentSizeChange`),r(o,`onDidContentSizeChange`),r(a,`onDidLayoutChange`),r(o,`onDidLayoutChange`),typeof window<`u`&&typeof window.MutationObserver==`function`){let e=new window.MutationObserver(e=>{e.some(e=>e.type===`childList`||e.type===`attributes`&&e.target!==t)&&n()});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`class`]}),ne.current=e}},[We,Ue]);(0,I.useEffect)(()=>Ore(()=>{Oe(e=>e+1)}),[]),(0,I.useEffect)(()=>{ve(Q_(n.language))},[n.language]);let Ke=(0,I.useRef)(n);Ke.current=n;let qe=(0,I.useCallback)(()=>{var e;k.current+=1;try{(e=T.current)==null||e.call(T)}catch{}We(),E.current=null,D.current=null,O.current=null,me(!1),fe(!1)},[We]),Je=(0,I.useMemo)(()=>r?c??d?.[0]??`vitesse-dark`:l??d?.[1]??`vitesse-light`,[c,r,l,d]),Ye=(0,I.useCallback)(()=>Je,[Je]),Xe=(0,I.useMemo)(()=>Ye(),[Ye]),Ze=(0,I.useMemo)(()=>function(e,t){let n=(function(e){return typeof e==`string`?e:null}(e)??``).toLowerCase();return n?[`dark`,`night`,`moon`,`black`,`dracula`,`mocha`,`frappe`,`macchiato`,`palenight`,`ocean`,`poimandres`,`monokai`,`laserwave`,`tokyo`,`slack-dark`,`rose-pine`,`github-dark`,`material-theme`,`one-dark`,`catppuccin-mocha`,`catppuccin-frappe`,`catppuccin-macchiato`].some(e=>n.includes(e))&&![`light`,`latte`,`dawn`,`lotus`].some(e=>n.includes(e)):t}(Xe,!!r),[r,Xe]),Qe=(0,I.useMemo)(()=>n.diff?r?`dark`:`light`:Ze?`dark`:`light`,[r,n.diff,Ze]),$e=(0,I.useMemo)(()=>n.diff?Qe===`dark`:Ze,[Qe,n.diff,Ze]),et=(0,I.useMemo)(()=>{let e=Ae,t=rv(Ae,Be?12:Ne),r=function(e){let t=typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0;return{top:t,bottom:t}}(e?.padding),i=n.diff?0:8,a=typeof e?.padding==`number`&&Number.isFinite(e.padding)&&e.padding>=0,o=nv(e?.tabSize)??4;return{...t,paddingBottom:a?r.bottom:i,paddingTop:a?r.top:i,tabSize:o}},[Be,Ne,n.diff,Ae]),tt=(0,I.useMemo)(()=>!!n.diff&&Ae.diffStyle===`unified`,[n.diff,Ae]),nt=(0,I.useMemo)(()=>{let e=String(n.diff?n.updatedCode??n.code??``:n.code??``);if(!e)return 1;let t=i?e:e.replace(/\r\n$|\n$|\r$/,``);return Math.max(1,t.split(/\r\n|\r|\n/).length)},[i,n.code,n.diff,n.updatedCode]),rt=(0,I.useMemo)(()=>Math.ceil(nt*et.lineHeight+et.paddingTop+et.paddingBottom),[nt,et]),it=(0,I.useMemo)(()=>{let e={"--markstream-code-padding-left":`62px`,"--markstream-pre-diff-line-height":`${et.lineHeight}px`,"--markstream-pre-line-number-top":`${et.paddingTop}px`,"--markstream-pre-line-number-width":`36px`,"--markstream-pre-line-number-gap":`0px`,fontSize:`${et.fontSize}px`,lineHeight:`${et.lineHeight}px`,maxHeight:`${Ve()}px`,overflow:`auto`,paddingBottom:`${et.paddingBottom}px`,paddingTop:`${et.paddingTop}px`,tabSize:et.tabSize,whiteSpace:Ae.overflow===`scroll`?`pre`:`pre-wrap`};return et.fontFamily&&(e.fontFamily=et.fontFamily),e},[Ve,et,Ae.overflow]),at=(0,I.useCallback)(()=>{let e=S.current,t=C.current;if(!e||!t)return;if(t.style.removeProperty(`--vscode-editor-foreground`),t.style.removeProperty(`--vscode-editor-background`),t.style.removeProperty(`--vscode-editor-selectionBackground`),e.style.setProperty(`--diffs-tab-size`,String(et.tabSize)),typeof Ae.padding==`number`&&Number.isFinite(Ae.padding)&&Ae.padding>=0?e.style.setProperty(`--diffs-gap-block`,`${et.paddingTop}px`):e.style.removeProperty(`--diffs-gap-block`),n.diff)return e.style.removeProperty(`--vscode-editor-foreground`),e.style.removeProperty(`--vscode-editor-background`),void e.style.removeProperty(`--vscode-editor-selectionBackground`);let r=e;try{let i=typeof window<`u`&&window.getComputedStyle?window.getComputedStyle(r):null,a=String(i?.getPropertyValue(`--vscode-editor-foreground`)??``).trim()||String(i?.color??``).trim(),o=String(i?.getPropertyValue(`--vscode-editor-background`)??``).trim(),s=String(i?.backgroundColor??``).trim(),c=pb(o)?pb(s)?``:s:o,l=String(i?.getPropertyValue(`--vscode-editor-selectionBackground`)??``).trim();if(function(e,t,n,r){if(!n)return!1;let i=fb(e),a=fb(t);return r?i!=null&&i>170||a!=null&&a<110:i!=null&&i<85||a!=null&&a>190}(c,a,$_(String(n.language||_e||he||`plaintext`))===`plaintext`,t.classList.contains(`is-dark`)))return e.style.removeProperty(`--vscode-editor-foreground`),e.style.removeProperty(`--vscode-editor-background`),void e.style.removeProperty(`--vscode-editor-selectionBackground`);a?e.style.setProperty(`--vscode-editor-foreground`,a):e.style.removeProperty(`--vscode-editor-foreground`),c?e.style.setProperty(`--vscode-editor-background`,c):e.style.removeProperty(`--vscode-editor-background`),l?e.style.setProperty(`--vscode-editor-selectionBackground`,l):e.style.removeProperty(`--vscode-editor-selectionBackground`)}catch{}},[_e,he,n.diff,n.language,et,Ae]),ot=(0,I.useCallback)(()=>{let e=Ae.maxHeight,t={...Ae||{},...e==null?{}:{MAX_HEIGHT:e},themes:d?[...d]:void 0,stream:!1,disableFileHeader:!0,disableLineNumbers:!Ie,fontSize:et.fontSize,lineHeight:et.lineHeight,...et.fontFamily?{fontFamily:et.fontFamily}:{},theme:Xe,themeType:r?`dark`:`light`,onThemeChange(){at()}};return delete t.maxHeight,delete t.padding,delete t.tabSize,t.unsafeCSS=[`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }`,typeof t.unsafeCSS==`string`?t.unsafeCSS:``].filter(Boolean).join(`
180
- `),t},[Ie,r,et,Xe,Ae,at,d]),st=(0,I.useCallback)(()=>{let e=ot(),t=N.current;if(!t)return N.current=e,e;for(let n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[ot]),ct=(0,I.useCallback)(e=>{let t=e(st());return w.current=t,T.current=typeof t.safeClean==`function`?()=>t.safeClean():typeof t.cleanupEditor==`function`?()=>t.cleanupEditor():null,t},[st]),lt=(0,I.useMemo)(()=>JSON.stringify({diffStyle:Ae.diffStyle,expandUnchanged:Ae.expandUnchanged,collapsedContextThreshold:Ae.collapsedContextThreshold,hunkSeparators:Ae.hunkSeparators,lineDiffType:Ae.lineDiffType,maxLineDiffLength:Ae.maxLineDiffLength,expansionLineCount:Ae.expansionLineCount,context:Ae.parseDiffOptions?.context}),[Ae]);(0,I.useEffect)(()=>{st()},[Ae,st]),(0,I.useEffect)(()=>()=>{var e,t,n;k.current+=1,(e=T.current)==null||e.call(T),We(),T.current=null,E.current=null,D.current=null,O.current=null,w.current=null,ee.current=null,A.current=null,(n=(t=j.current)?.destroy)==null||n.call(t),j.current=null},[We]),(0,I.useEffect)(()=>{var e,t;if(typeof window>`u`||se)return;let n=C.current;if(!n)return;(t=(e=j.current)?.destroy)==null||t.call(e);let r=M(n,{rootMargin:`400px`});return j.current=r,r.isVisible()&&ce(!0),r.whenVisible.then(()=>ce(!0)),()=>{r.destroy(),j.current===r&&(j.current=null)}},[M,se]),(0,I.useEffect)(()=>{let e=!0;return typeof window>`u`?()=>{e=!1}:w.current?(st(),()=>{e=!1}):((async()=>{try{let t=await lb();if(!e)return;if(!t)return void oe(!0);let n=t.createCodeBlockRuntime,r=t.detectLanguage;if(typeof r==`function`&&(A.current=r),typeof n!=`function`)return void oe(!0);ee.current=n,ct(n),ue(!0)}catch{e&&oe(!0)}})(),()=>{e=!1})},[ct,st]),(0,I.useEffect)(()=>{if(!n.language&&!_e&&A.current)try{let e=A.current(String(n.code??``));e&&ge(e)}catch{}},[_e,n.code,n.language]);let ut=(0,I.useMemo)(()=>String(n.language||_e||he||`plaintext`),[_e,he,n.language]),dt=(0,I.useMemo)(()=>Q_(ut),[ut]),ft=(0,I.useMemo)(()=>$_(dt),[dt]),pt=(0,I.useMemo)(()=>ft===`plaintext`,[ft]),mt=(0,I.useMemo)(()=>ev(dt),[dt,De]),ht=(0,I.useMemo)(()=>!!o&&(dt===`html`||dt===`svg`),[dt,o]),gt=(0,I.useMemo)(()=>{let e=dt;return e?tv[e]||e.charAt(0).toUpperCase()+e.slice(1):tv[``]||`Plain Text`},[dt]),_t=(0,I.useMemo)(()=>function(e,t,n){let r=function(e){let t=function(e){let t=String(e??``).split(/\r?\n/,1)[0]?.trim()??``;if(t.length<3)return``;let n=t[0];if(n!=="`"&&n!==`~`||t[1]!==n||t[2]!==n)return``;let r=3;for(;t[r]===n;)r+=1;return t.slice(r).trim()}(e);if(!t)return``;let n=t.split(/\s+/).filter(Boolean);if(!n.length)return``;let r=n[0]===`diff`?n.slice(1):n;for(let e of r){let t=e.includes(`:`)?e.slice(e.indexOf(`:`)+1):e;if(t&&/[./\\-]/.test(t))return t}return``}(e);return{title:r||t,caption:r?n?`Diff / ${t}`:t:``}}(String(n.raw??``),gt,!!n.diff),[gt,n.diff,n.raw]),vt=_t.title,yt=_t.caption,bt=(0,I.useMemo)(()=>n.diff?n.updatedCode??n.code??``:n.code??``,[n.code,n.diff,n.updatedCode]),xt=(0,I.useMemo)(()=>{let e=e=>{if(e!=null)return typeof e==`number`?`${e}px`:String(e)},t={},r=e(f),i=e(p);return r&&(t.minWidth=r),i&&(t.maxWidth=i),n.diff?(t.color=`var(--markstream-diff-shell-fg)`,t.borderColor=`var(--markstream-diff-shell-border)`):(t.color=`var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))`,t.backgroundColor=`var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))`,t.borderColor=`var(--markstream-code-border-color, var(--code-border))`),t},[p,f,n.diff]),St=(0,I.useMemo)(()=>n.code.length>0||(n.originalCode?.length??0)>0||(n.updatedCode?.length??0)>0,[n.code,n.originalCode,n.updatedCode]),Ct=!1===a&&i||!1!==a&&i&&!St;(0,I.useEffect)(()=>{if(ae||!le||!de||!se)return;let e=w.current;st();let t=()=>{var t;n.diff&&((t=e?.refreshDiffPresentation)==null||t.call(e)),at(),Ce||((typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>Ue(xe)):null)??Ue(xe))};e?.setTheme&&Xe?Promise.resolve(e.setTheme(Xe)).then(t).catch(()=>{}):t()},[Ce,de,Qe,xe,le,n.diff,Xe,Ue,at,st,ae,se]);let wt=(0,I.useCallback)(async()=>{if(ae||!se||Ce||Ct)return null;let e=w.current,t=S.current;if(!e||!t||!e.createEditor)return null;st();let n=Ke.current,r=n.diff?`diff`:`single`,i=O.current,a=r===`diff`?!!e.getDiffEditorView?.call(e):!!e.getEditorView?.call(e);if(D.current===r&&i===t&&a)return null;if(E.current)return E.current;k.current+=1;let o=k.current;fe(!0);let s=(async()=>{var r;try{(r=T.current)==null||r.call(T),D.current=null,O.current=null,me(!1);let i=ft;if(n.diff?typeof e.createDiffEditor==`function`?(D.current=`diff`,await e.createDiffEditor(t,String(n.originalCode??``),String(n.updatedCode??``),i)):(D.current=`single`,await e.createEditor(t,String(n.updatedCode??n.code??``),i)):(D.current=`single`,await e.createEditor(t,String(n.code??``),i)),O.current=t,k.current!==o)return;Ge(),at(),xe||Ce||Ue(!1);let a=await Promise.race([ub(t,e.whenVisualReady),new Promise(e=>{window.setTimeout(()=>e(!0),1500)})]);if(k.current!==o||!a)return;He(xe),me(!0)}catch{k.current===o&&(ie.current=ft,oe(!0))}})().finally(()=>{E.current===s&&(E.current=null)});return E.current=s,s},[He,Ge,Ce,xe,ft,Ue,Ct,at,st,ae,se]);(0,I.useEffect)(()=>{st();let e=te.current!==u;te.current=u;let t=Le.current!==Ie;Le.current=Ie;let r=P.current;if(P.current=lt,ae||!le)return;let i=!1;if(e||t){let e=ee.current;if(e){qe(),w.current=null,T.current=null;try{ct(e),i=!0}catch{oe(!0);return}}}let a=!!(n.diff&&r!==lt);if(!i&&!a||!se||!de&&!i||Ce||Ct)return;let o=!1;return(async()=>{if(i||qe(),!o)try{await wt()}catch{}})(),()=>{o=!0}},[Ce,u,de,Ie,wt,ct,le,lt,n.diff,qe,Ct,st,ae,se]),(0,I.useEffect)(()=>{if(ae){let e=ie.current;if(e===void 0||e===ft)return;ie.current=void 0,qe(),oe(!1);return}le&&se&&(Ce||Ct?qe():wt())},[Ce,wt,ft,le,qe,Ct,ae,se]),(0,I.useEffect)(()=>{if(ae||!le||!se||Ce||Ct)return;let e=w.current;if(!e)return;let t=String(n.code??``);(async()=>{let r=_e;if(!r&&A.current)try{r=Q_(A.current(t)),r&&ve(r)}catch{}let i=$_(r||dt);if(e.createEditor&&S.current){try{await Promise.resolve(wt())}catch{}let e=E.current;if(e)try{await e}catch{}}try{n.diff&&e.updateDiff?await Promise.resolve(e.updateDiff(String(n.originalCode??``),String(n.updatedCode??``),i)):e.updateCode&&await Promise.resolve(e.updateCode(t,i))}catch{}let a=S.current;a&&a.getAttribute(`data-markstream-enhanced`)!==`true`&&await ub(a,e.whenVisualReady)&&(He(xe),me(!0)),Ue(xe)})()},[He,dt,_e,Ce,de,wt,xe,le,n.code,n.diff,n.originalCode,n.updatedCode,Ue,Ct,ae,se]),(0,I.useEffect)(()=>{if(ae||!le||!se||Ce||Ct||!xe&&i)return;let e=typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>Ue(xe)):null;return e??Ue(xe),()=>{e!=null&&typeof window<`u`&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(e)}},[Ce,xe,i,le,Ue,Ct,ae,se]),(0,I.useEffect)(()=>{var e;if(!s||ae)return;let t=w.current;if(t){try{let n=D.current===`diff`?t.getDiffEditorView?.call(t):t.getEditorView?.call(t);(e=n?.updateOptions)==null||e.call(n,{fontSize:Ne})}catch{}Ue(xe)}},[s,xe,Ne,n.diff,Ue,ae]),(0,I.useEffect)(()=>{Fe||ib(!0)},[Fe]);let Tt=(0,I.useCallback)((e,t)=>{if(!Fe)return;let n=e.currentTarget;n&&!n.disabled&&(`clientX`in e&&(e.clientX,e.clientY),rb(n,t,`top`,!1,0,$e))},[$e,Fe]),Et=(0,I.useCallback)(()=>{Fe&&ib()},[Fe]),Dt=(0,I.useCallback)(async()=>{var e;let n=String(bt);try{t.clipboardWriter?await t.clipboardWriter(n):typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&await navigator.clipboard.writeText(n),be(!0),(e=t.onCopy)==null||e.call(t,n),setTimeout(()=>be(!1),1e3)}catch{}},[t,bt]),Ot=(0,I.useCallback)(()=>{if(!ht)return;let e=dt===`html`?`text/html`:`image/svg+xml`,r=dt===`html`?ke(`artifacts.htmlPreviewTitle`)||`HTML Preview`:ke(`artifacts.svgPreviewTitle`)||`SVG Preview`;typeof t.onPreviewCode==`function`?t.onPreviewCode({node:n,artifactType:e,artifactTitle:r,id:`temp-${dt}-${Date.now()}`}):dt===`html`&&Ee(e=>!e)},[dt,ht,n,t,ke]);return(0,L.jsxs)(`div`,{ref:C,className:[`code-block-container my-4 rounded-lg border overflow-hidden shadow-sm`,$e?`border-gray-700/30`:`border-gray-200`,i?`is-rendering`:``,$e?`is-dark`:``,n.diff?`is-diff`:``,pt?`is-plain-text`:``].join(` `),style:xt,children:[m&&(0,L.jsxs)(`div`,{className:`code-block-header`,children:[(0,L.jsxs)(`div`,{className:`code-header-main`,children:[(0,L.jsx)(`span`,{className:`icon-slot h-4 w-4 flex-shrink-0`,dangerouslySetInnerHTML:{__html:mt}}),(0,L.jsxs)(`div`,{className:`code-header-copy min-w-0`,children:[(0,L.jsx)(`div`,{className:`code-header-title truncate`,children:vt}),yt&&(0,L.jsx)(`div`,{className:`code-header-caption truncate`,children:yt})]})]}),(0,L.jsxs)(`div`,{className:`code-header-actions`,children:[v&&(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,"aria-pressed":Ce,onClick:()=>we(e=>!e),onMouseEnter:e=>Tt(e,Ce?ke(`common.expand`)||`Expand`:ke(`common.collapse`)||`Collapse`),onFocus:e=>Tt(e,Ce?ke(`common.expand`)||`Expand`:ke(`common.collapse`)||`Collapse`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{style:{rotate:Ce?`0deg`:`90deg`},xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m9 18l6-6l-6-6`})})}),y&&s&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,disabled:Ne<=10,onClick:()=>Pe(e=>Math.max(10,e-1)),onMouseEnter:e=>Tt(e,ke(`common.decrease`)||`Decrease`),onFocus:e=>Tt(e,ke(`common.decrease`)||`Decrease`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M5 12h14`})})}),(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,disabled:Ne===je,onClick:()=>Pe(je),onMouseEnter:e=>Tt(e,ke(`common.reset`)||`Reset`),onFocus:e=>Tt(e,ke(`common.reset`)||`Reset`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,L.jsx)(`path`,{d:`M3 3v5h5`})]})})}),(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,disabled:Ne>=36,onClick:()=>Pe(e=>Math.min(36,e+1)),onMouseEnter:e=>Tt(e,ke(`common.increase`)||`Increase`),onFocus:e=>Tt(e,ke(`common.increase`)||`Increase`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M5 12h14m-7-7v14`})})})]}),h&&(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,"aria-label":ye?ke(`common.copied`)||`Copied`:ke(`common.copy`)||`Copy`,onClick:Dt,onMouseEnter:e=>Tt(e,ye?ke(`common.copied`)||`Copied`:ke(`common.copy`)||`Copy`),onFocus:e=>Tt(e,ye?ke(`common.copied`)||`Copied`:ke(`common.copy`)||`Copy`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,ye?{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M20 6L9 17l-5-5`})}:{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})})}),g&&(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,"aria-pressed":xe,onClick:e=>{Se(e=>!e),Tt(e,xe?ke(`common.expand`)||`Expand`:ke(`common.collapse`)||`Collapse`)},onMouseEnter:e=>Tt(e,xe?ke(`common.collapse`)||`Collapse`:ke(`common.expand`)||`Expand`),onFocus:e=>Tt(e,xe?ke(`common.collapse`)||`Collapse`:ke(`common.expand`)||`Expand`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,xe?{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`})}:{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`})})}),ht&&_&&(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,"aria-label":ke(`common.preview`)||`Preview`,onClick:Ot,onMouseEnter:e=>Tt(e,ke(`common.preview`)||`Preview`),onFocus:e=>Tt(e,ke(`common.preview`)||`Preview`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,children:(0,L.jsxs)(`g`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,children:[(0,L.jsx)(`path`,{d:`M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496`}),(0,L.jsx)(`path`,{d:`M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23`})]})})})]})]}),(0,L.jsxs)(`div`,{className:`code-block-body${Ce?` code-block-body--collapsed`:``}${xe?` code-block-body--expanded`:``}`,children:[!Ce&&(!!a||!i)&&(ae?(0,L.jsx)(fv,{className:`code-fallback-plain m-0`,diffInline:tt,node:n,showLineNumbers:Ie,style:it}):(0,L.jsxs)(`div`,{className:`code-editor-layer`,children:[(0,L.jsx)(`div`,{ref:S,className:`code-editor-container`+(a?``:` code-height-placeholder`),"data-markstream-enhanced":pe?`true`:`false`,"data-markstream-host-hidden":pe?void 0:`true`,style:{"--markstream-editor-initial-height":`${rt}px`,visibility:pe?`visible`:`hidden`},"aria-hidden":!pe}),!pe&&(0,L.jsx)(`div`,{className:`code-editor-fallback-surface`,children:(0,L.jsx)(fv,{className:`code-fallback-plain m-0`,diffInline:tt,node:n,showLineNumbers:Ie,style:it})})]})),!a&&i&&(0,L.jsx)(`div`,{className:`code-loading-placeholder`,children:(0,L.jsxs)(`div`,{className:`loading-skeleton`,children:[(0,L.jsx)(`div`,{className:`skeleton-line`}),(0,L.jsx)(`div`,{className:`skeleton-line`}),(0,L.jsx)(`div`,{className:`skeleton-line short`})]})})]}),Te&&!t.onPreviewCode&&ht&&dt===`html`&&(0,L.jsx)(Rie,{code:String(n.code??``),htmlPreviewAllowScripts:t.htmlPreviewAllowScripts,htmlPreviewSandbox:t.htmlPreviewSandbox,isDark:r,onClose:()=>Ee(!1)}),(0,L.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,role:`status`,children:ye?ke(`common.copied`)||`Copied`:``})]})}function mb(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=mb(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function hb(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=mb(e))&&(r&&(r+=` `),r+=t);return r}var gb=0,_b=()=>R(()=>import(`./d2_markstream-react-DtM9g53j.js`),[]),vb=null,Hie=_b;async function Uie(){if(vb)return vb;let e=Hie;if(!e)return null;let t;try{t=await e()}catch(t){throw e===_b?Error(`Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.`):t}return t?(vb=function(e){if(!e)return e;if(e.D2&&typeof e.D2==`function`)return e.D2;if(e.default&&e.default.D2&&typeof e.default.D2==`function`)return e.default.D2;let t=e.default??e;return typeof t==`function`?t:t?.D2&&typeof t.D2==`function`?t.D2:t}(t),vb):null}var Wie={loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Gie={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`},Kie=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],qie=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Jie(e){if(!e)return``;let t=e.trim();return qie.test(t)?t:``}function yb(e){let t={...Wie,...e},{t:n}=qy(),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(null),[p,m]=(0,I.useState)(``),[h,g]=(0,I.useState)(null),[_,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(()=>typeof window>`u`),x=(0,I.useRef)(0),S=(0,I.useRef)(null),C=(0,I.useRef)(!1),w=(0,I.useRef)(!1),T=(0,I.useRef)(0),E=(0,I.useRef)(null),D=(0,I.useRef)(!1),O=(0,I.useRef)(null),k=(0,I.useRef)(null),A=(0,I.useRef)(null),j=(0,I.useRef)(null),M=(0,I.useRef)(!1),N=(0,I.useRef)(()=>{}),ee=Gy(),te=t.node?.code??``,P=s||!l||!p,F=!!p,ne=(0,I.useMemo)(()=>{if(!t.maxHeight)return;let e=typeof t.maxHeight==`number`?`${t.maxHeight}px`:String(t.maxHeight);return{maxHeight:e,"--ms-d2-render-max-height":e}},[t.maxHeight]),re=(0,I.useMemo)(()=>{if(P&&h)return{minHeight:`${h}px`}},[h,P]);(0,I.useEffect)(()=>{M.current=_},[_]),(0,I.useEffect)(()=>{let e=O.current;if(!e)return;let t=ee(e,{rootMargin:`160px`});return k.current=t,t.isVisible()&&b(!0),t.whenVisible.then(()=>b(!0)),()=>{t.destroy(),k.current=null}},[ee]);let ie=(0,I.useCallback)(()=>{let e=A.current;if(!e)return;let t=e.getBoundingClientRect().height;t>0&&g(e=>e===t?e:t)},[]),ae=(0,I.useCallback)((e=!1)=>{if(C.current||typeof window>`u`||w.current||!y)return;if(M.current)return void(D.current=!0);let n=Math.max(120,Number(t.progressiveIntervalMs)||0),r=Date.now()-T.current;if(!e&&r<n)return D.current=!0,void(E.current==null&&(E.current=window.setTimeout(()=>{E.current=null,D.current&&(D.current=!1,ae(!0))},Math.max(0,n-r))));C.current=!0;let i=()=>{C.current=!1,T.current=Date.now(),N.current()};typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(i):setTimeout(i,0)},[t.progressiveIntervalMs,y]),oe=(0,I.useCallback)(async()=>{if(S.current)return S.current;let e=await Uie();if(!e)return null;if(typeof e==`function`){let t=new e;return t&&typeof t.compile==`function`?S.current=t:typeof e.compile==`function`&&(S.current=e),S.current}return e?.D2&&typeof e.D2==`function`?(S.current=new e.D2,S.current):(typeof e.compile==`function`&&(S.current=e),S.current)},[]),se=(0,I.useCallback)(async()=>{if(typeof window>`u`||w.current||!y||t.loading&&!t.progressiveRender)return;if(!te)return m(``),void f(null);let e=++x.current;v(!0),f(null);try{let n=await oe();if(!n)return u(!1),c(!0),m(``),void f(`D2 is not available.`);if(typeof n.compile!=`function`||typeof n.render!=`function`)throw Error(`D2 instance is missing compile/render methods.`);u(!0);let r=await n.compile(te);if(e!==x.current)return;let i=r?.diagram??r,a=r?.renderOptions??r?.options??{},o=t.themeId??a.themeID,s=t.darkThemeId??a.darkThemeID,l={...a};if(l.themeID=t.isDark&&s!=null?s:o,l.darkThemeID=null,l.darkThemeOverrides=null,t.isDark){let e=a.themeOverrides&&typeof a.themeOverrides==`object`?a.themeOverrides:null;l.themeOverrides={...Gie,...e||{}}}l.salt=l.salt??function(e=`markstream-react-d2`){return gb+=1,`${e}-${gb}`}();let d=await n.render(i,l);if(e!==x.current)return;let p=function(e){return e?typeof e==`string`?e:typeof e.svg==`string`?e.svg:typeof e.data==`string`?e.data:``:``}(d);if(!p)throw Error(`D2 render returned empty output.`);let h=function(e){if(typeof window>`u`||typeof DOMParser>`u`||!e)return``;let t=e.replace(/["']\s*javascript:/gi,`#`).replace(/\bjavascript:/gi,`#`).replace(/["']\s*vbscript:/gi,`#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)return``;let r=n;return function(e){let t=new Set([`script`]),n=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of n){if(t.has(e.tagName.toLowerCase())){e.remove();continue}let n=Array.from(e.attributes);for(let t of n){let n=t.name;if(/^on/i.test(n))e.removeAttribute(n);else{if(n===`style`&&t.value){let r=t.value;if(Kie.some(e=>e.test(r))){e.removeAttribute(n);continue}}if((n===`href`||n===`xlink:href`)&&t.value){let r=Jie(t.value);if(!r){e.removeAttribute(n);continue}r!==t.value&&e.setAttribute(n,r)}}}}}(r),r.classList.add(`markstream-d2-root-svg`),r.outerHTML}(p);m(h||``),t.loading&&c(!1),f(null)}catch(n){if(e!==x.current)return;let r=n?.message?String(n.message):`D2 render failed.`;t.loading||f(r),r.includes(`@terrastruct/d2`)&&(u(!1),c(!0))}finally{e===x.current&&(v(!1),D.current&&(D.current=!1,ae()))}},[te,oe,t.darkThemeId,t.isDark,t.loading,t.progressiveRender,t.themeId,ae,y]);(0,I.useEffect)(()=>{N.current=se},[se]);let ce=(0,I.useCallback)(async()=>{var e;try{(e=navigator==null?void 0:navigator.clipboard)!=null&&e.writeText&&await navigator.clipboard.writeText(te),i(!0),setTimeout(()=>i(!1),1e3)}catch{}},[te]),le=(0,I.useCallback)(()=>{if(p)try{let e=new Blob([p],{type:`image/svg+xml;charset=utf-8`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`Failed to export SVG:`,e)}},[p]),ue=(0,I.useCallback)((e,n)=>{var r;(r=e.currentTarget)&&!r.disabled&&rb(e.currentTarget,n,`top`,!1,(e.clientX,e.clientY),t.isDark)},[t.isDark]),de=(0,I.useCallback)(()=>{ib()},[]);return(0,I.useEffect)(()=>{ae()},[te,t.loading,t.isDark,ae]),(0,I.useEffect)(()=>{t.loading||ae(!0)},[t.loading,ae]),(0,I.useEffect)(()=>{let e=requestAnimationFrame(()=>ie());return()=>cancelAnimationFrame(e)},[P,p,te,ie]),(0,I.useEffect)(()=>{w.current=!1,ae();let e=requestAnimationFrame(()=>ie());if(typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>{ie()});j.current=e,A.current&&e.observe(A.current)}return()=>{var t;w.current=!0,E.current!=null&&(clearTimeout(E.current),E.current=null),(t=j.current)==null||t.disconnect(),j.current=null,cancelAnimationFrame(e)}},[ae,ie]),(0,L.jsxs)(`div`,{ref:O,className:hb(`d2-block my-4 rounded-lg border overflow-hidden shadow-sm`,t.isDark?`border-gray-700/30 bg-gray-900 text-gray-100`:`border-gray-200 bg-white text-gray-900`),children:[t.showHeader&&(0,L.jsxs)(`div`,{className:`d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5`,style:{color:`var(--vscode-editor-foreground)`,backgroundColor:`var(--vscode-editor-background)`},children:[(0,L.jsx)(`div`,{className:`flex items-center gap-x-2`,children:(0,L.jsx)(`span`,{className:`text-sm font-medium font-mono`,children:`D2`})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-x-2`,children:[t.showModeToggle&&(0,L.jsxs)(`div`,{className:hb(`flex items-center gap-x-1 rounded-md p-0.5`,t.isDark?`bg-gray-700`:`bg-gray-100`),children:[(0,L.jsx)(`button`,{type:`button`,className:hb(`mode-btn px-2 py-1 text-xs rounded`,!s&&`is-active`),onClick:()=>c(!1),onMouseEnter:e=>ue(e,n(`common.preview`)||`Preview`),onFocus:e=>ue(e,n(`common.preview`)||`Preview`),onMouseLeave:de,onBlur:de,children:n(`common.preview`)||`Preview`}),(0,L.jsx)(`button`,{type:`button`,className:hb(`mode-btn px-2 py-1 text-xs rounded`,s&&`is-active`),onClick:()=>c(!0),onMouseEnter:e=>ue(e,n(`common.source`)||`Source`),onFocus:e=>ue(e,n(`common.source`)||`Source`),onMouseLeave:de,onBlur:de,children:n(`common.source`)||`Source`})]}),t.showCopyButton&&(0,L.jsx)(`button`,{type:`button`,className:`d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]`,"aria-label":r?n(`common.copied`)||`Copied`:n(`common.copy`)||`Copy`,onClick:ce,onMouseEnter:e=>ue(e,r?n(`common.copied`)||`Copied`:n(`common.copy`)||`Copy`),onFocus:e=>ue(e,r?n(`common.copied`)||`Copied`:n(`common.copy`)||`Copy`),onMouseLeave:de,onBlur:de,children:(0,L.jsx)(`svg`,r?{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M20 6L9 17l-5-5`})}:{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})})}),t.showExportButton&&p&&(0,L.jsx)(`button`,{type:`button`,className:`d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]`,"aria-label":n(`common.export`)||`Export`,onClick:le,onMouseEnter:e=>ue(e,n(`common.export`)||`Export`),onFocus:e=>ue(e,n(`common.export`)||`Export`),onMouseLeave:de,onBlur:de,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4`})})}),t.showCollapseButton&&(0,L.jsx)(`button`,{type:`button`,className:`d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]`,"aria-pressed":a,onClick:()=>o(e=>!e),onMouseEnter:e=>ue(e,a?n(`common.expand`)||`Expand`:n(`common.collapse`)||`Collapse`),onFocus:e=>ue(e,a?n(`common.expand`)||`Expand`:n(`common.collapse`)||`Collapse`),onMouseLeave:de,onBlur:de,children:(0,L.jsx)(`svg`,{style:{transform:`rotate(${a?0:90}deg)`},xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m9 18l6-6l-6-6`})})})]})]}),!a&&(0,L.jsx)(`div`,{ref:A,className:`d2-block-body`,style:re,children:t.loading&&!F?(0,L.jsxs)(`div`,{className:`d2-source px-4 py-4`,children:[(0,L.jsx)(`pre`,{className:`d2-code`,children:(0,L.jsx)(`code`,{children:te})}),d&&(0,L.jsx)(`p`,{className:`d2-error mt-2 text-xs`,children:d})]}):(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,P?{className:`d2-source px-4 py-4`,children:[(0,L.jsx)(`pre`,{className:`d2-code`,children:(0,L.jsx)(`code`,{children:te})}),d&&(0,L.jsx)(`p`,{className:`d2-error mt-2 text-xs`,children:d})]}:{className:`d2-render`,style:ne,children:[(0,L.jsx)(`div`,{className:`d2-svg`,dangerouslySetInnerHTML:{__html:p}}),d&&(0,L.jsx)(`p`,{className:`d2-error px-4 pb-3 text-xs`,children:d})]})})})]})}function bb(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e,a=Array.isArray(t.items)?t.items:[];return(0,L.jsx)(`dl`,{className:`definition-list`,"data-index-key":i,children:a.map((e,t)=>(0,L.jsxs)(`div`,{className:`mb-4`,children:[(0,L.jsx)(`dt`,{className:`definition-term font-semibold`,children:n&&r?R_(e.term,n,`${String(i??`definition`)}-term-${t}`,r):null}),(0,L.jsx)(`dd`,{className:`definition-desc ml-4`,children:n&&r?R_(e.definition,n,`${String(i??`definition`)}-desc-${t}`,r):null})]},`${String(i??`definition`)}-${t}`))})}function xb(e){let{node:t}=e;return(0,L.jsx)(`span`,{className:`emoji-node`,children:t.name??t.markup})}function Sb(e){return(0,L.jsx)(`em`,{className:`emphasis-node`,children:e.children})}var Cb=`.markdown-renderer`;function wb(e,t){if(typeof document>`u`||typeof Element>`u`)return null;let n=function(e){return`[id="${e.replace(/["\\]/g,`\\$&`)}"]`}(t),r=e instanceof Element?e.closest(Cb):null;for(;r;){let e=r.querySelector(n);if(e)return e;r=r.parentElement?.closest(Cb)??null}return document.querySelector(n)}function Tb(e){let{node:t}=e,n=(0,I.useCallback)(e=>{if(e.preventDefault(),typeof document>`u`)return;let n=wb(e.currentTarget,`fnref-${String(t.id??``)}`);n&&n.scrollIntoView({behavior:`smooth`})},[t.id]);return(0,L.jsx)(`a`,{className:`footnote-anchor text-sm hover:underline cursor-pointer`,href:`#fnref-${t.id}`,title:`返回引用 ${t.id}`,onClick:n,children:`↩︎`})}function Eb(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e;return(0,L.jsx)(`div`,{id:`fnref--${t.id}`,className:`footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2`,children:(0,L.jsx)(`div`,{className:`flex-1`,children:n&&r?L_(t.children,n,String(i??`footnote-${t.id}`),r):null})})}function Db(e){let{node:t}=e,n=(0,I.useMemo)(()=>`#fnref--${t.id}`,[t.id]),r=(0,I.useMemo)(()=>({href:n}),[n]),i=(0,I.useCallback)(e=>{if(e.preventDefault(),typeof document>`u`)return;let n=wb(e.currentTarget,`fnref--${t.id}`);n&&n.scrollIntoView({behavior:`smooth`})},[t.id]);return(0,L.jsx)(`sup`,{id:`fnref-${t.id}`,className:`footnote-reference`,onClick:i,children:(0,L.jsxs)(`span`,{...r,title:`查看脚注 ${t.id}`,className:`footnote-link cursor-pointer`,children:[`[`,t.id,`]`]})})}function Ob(e){return(0,L.jsx)(`br`,{className:`hard-break`})}function kb(e){let{node:t,ctx:n,renderNode:r,indexKey:i,children:a}=e,o=Math.min(6,Math.max(1,Number(t.level)||1)),s=`h${o}`,{class:c,className:l,style:u,...d}=t?.attrs??{};return(0,L.jsx)(s,{dir:`auto`,className:hb(`heading-node font-semibold`,`heading-${o}`,c,l),...typeof u==`object`&&u?{style:u}:{},...d,children:a??(n&&r?L_(t.children,n,String(i??`heading-${o}`),r):null)})}function Ab(e){return(0,L.jsx)(`mark`,{className:`highlight-node`,children:e.children})}function jb(e){let{node:t,placeholder:n,customId:r}=e,i=e.htmlPolicy??e.ctx?.htmlPolicy??`safe`,a=Gy(),[o,s]=(0,I.useState)(null),c=(0,I.useRef)(null),[l,u]=(0,I.useState)(()=>typeof window>`u`),[d,f]=(0,I.useState)(t.content),p=!!t.loading,m=(0,I.useSyncExternalStore)(U_,W_,W_),h=(0,I.useMemo)(()=>({...e.customComponents??e.ctx?.customComponents??G_(r),...e.ctx?.htmlComponents??{}}),[r,e.ctx?.customComponents,e.ctx?.htmlComponents,e.customComponents,m]),g=(0,I.useMemo)(()=>({...h,...e.ctx?.streamingComponents??{}}),[h,e.ctx?.streamingComponents]);(0,I.useEffect)(()=>{var e;if(typeof window>`u`)return void u(!0);if((e=c.current)==null||e.destroy(),c.current=null,!p)return u(!0),void f(t.content);if(!o)return void u(!1);let n=a(o,{rootMargin:`400px`});return c.current=n,n.isVisible()&&u(!0),n.whenVisible.then(()=>u(!0)).catch(()=>{}),()=>{n.destroy(),c.current=null}},[o,p,t.content,a]),(0,I.useEffect)(()=>()=>{var e;(e=c.current)==null||e.destroy(),c.current=null},[]),(0,I.useEffect)(()=>{p&&!l||f(t.content)},[p,t.content,l]);let _=(0,I.useMemo)(()=>{let e=I_(m_(t.attrs??void 0,i));return e?mv(e):void 0},[i,t.attrs]),v=(0,I.useMemo)(()=>String(t.tag??``).trim(),[t.tag]),y=(0,I.useMemo)(()=>Nl(v),[v]),b=(0,I.useMemo)(()=>{let e=I_(m_(t.attrs??void 0,i,v));return e?mv(e):void 0},[i,t.attrs,v]),x=(0,I.useMemo)(()=>h_(p_(m_(t.attrs??void 0,i,y))),[i,t.attrs,y]),S=(0,I.useMemo)(()=>Array.isArray(t.children)?t.children:[],[t.children]),C=S.length>0&&!!v&&!sl.has(v.toLowerCase())&&!r_(v,i)&&!!e.ctx&&!!e.renderNode,w=(0,I.useMemo)(()=>function(e){let t={...e||{}},n=typeof t.className==`string`?t.className.trim():``;return t.className=n?`html-block-node ${n}`:`html-block-node`,t}(b),[b]),T=(0,I.useMemo)(()=>i!==`escape`&&vv(t.content??``,g),[g,i,t.content]),E=(0,I.useMemo)(()=>T&&t.content?Are(t.content,h,i,{ctx:e.ctx,keyPrefix:String(e.indexKey??`html-block`),nodeComponents:e.ctx?.streamingComponents,propComponents:e.ctx?.htmlComponents,renderNode:e.renderNode,sourceNode:t}):null,[h,i,t.autoClosed,t.content,t.loading,e.ctx,e.indexKey,e.renderNode,T]),D=(0,I.useMemo)(()=>v_(d??``,i),[i,d]),O=(0,I.useMemo)(()=>C&&e.ctx&&e.renderNode?L_(S,e.ctx,`${String(e.indexKey??`html-block`)}-structured`,e.renderNode):null,[C,e.ctx,e.indexKey,e.renderNode,S]),k=y?e.ctx?.htmlComponents?.[y]:void 0,A=(0,L.jsx)(`div`,{className:`html-block-node__placeholder`,children:n??(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`html-block-node__placeholder-bar`}),(0,L.jsx)(`span`,{className:`html-block-node__placeholder-bar w-4/5`}),(0,L.jsx)(`span`,{className:`html-block-node__placeholder-bar w-2/3`})]})});return C&&k?I.createElement(k,x,O):C?I.createElement(v,{...w,ref:s},l?O:A):(0,L.jsx)(`div`,{ref:s,className:`html-block-node`,..._,children:l?T&&E?(0,L.jsx)(L.Fragment,{children:E}):(0,L.jsx)(`div`,{dangerouslySetInnerHTML:{__html:D}}):A})}var Mb=(()=>{try{return!1}catch{}return!1})();function Nb(e){Mb&&console.warn(e)}function Pb(e,t,n=!1){let r=Object.entries(t??{}),i=r.length>0?r.map(([e,t])=>t===``?` ${e}`:` ${e}="${t}"`).join(``):``;return n?`<${e}${i} />`:`<${e}${i}>`}function Fb(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function Ib(e,t){for(let n of hv(e)){if(n.type!==`tag_open`&&n.type!==`self_closing`)continue;let e=n.tagName??``;if(_v(e,t)&&K_(t[e]||t[e.toLowerCase()])===`block`)return!0}return!1}function Lb(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Rb(e){if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(Rb).join(``);if(!I.isValidElement(e))return``;let t=e;if(typeof t.type!=`string`)return Rb(t.props.children);let n=Object.entries(t.props).filter(([e,t])=>e!==`children`&&e!==`key`&&e!==`ref`&&t!=null&&typeof t!=`boolean`).map(([e,t])=>` ${e===`className`?`class`:e}="${String(t)}"`).join(``);return`<${t.type}${n}>${Rb(t.props.children)}</${t.type}>`}function zb(e){return Object.entries(e).map(([e,t])=>[e,t===``?null:t])}function Bb(e){let t=e.sourceNode,n=!0!==e.ctx?.final&&(!1===e.ctx?.final||!!t?.loading);return{loading:n,autoClosed:n||!!t?.autoClosed}}function Vb(e,t,n,r,i,a,o,s,c,l){let u=_v(e,r),d=!!Lb(e,o);if(ol.has(e.toLowerCase())||!u&&!d&&i_(e,a))return null;if(!u&&!d&&r_(e,a))return[Pb(e,t),...n,`</${e}>`];let f=gv(t,a,e),p=f.key,m=p!=null&&p!==``?p:i;if(d)return function(e,t,n,r,i,a,o,s=Bb(i)){let c=Nl(e),l=a??function(e){return e.map(Rb).join(``)}(n),u={type:c,tag:c,attrs:zb(t),content:l,raw:o??`${Pb(e,t)}${l}</${e}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);let d=Lb(e,i);return d?I.createElement(d,{key:r,node:u}):null}(e,t,n,String(m),o,s,c,l);if(u){let t=r[e]||r[e.toLowerCase()],i=h_(f);return I.createElement(t,{...i,key:m},...n)}return I.createElement(e,{...mv(f),key:m},...n)}function Hb(e){let{node:t,customId:n}=e,r=e.htmlPolicy??e.ctx?.htmlPolicy??`safe`,i=(0,I.useRef)(null),[a,o]=(0,I.useState)(!1);(0,I.useEffect)(()=>{o(!0)},[]);let s=I.useMemo(()=>({...e.ctx?.customComponents??G_(n),...e.ctx?.htmlComponents??{}}),[n,e.ctx?.customComponents,e.ctx?.htmlComponents]),c=I.useMemo(()=>({...s,...e.ctx?.streamingComponents??{}}),[s,e.ctx?.streamingComponents]),l=I.useMemo(()=>v_(t.content??``,r),[r,t.content]),u=I.useMemo(()=>String(t.tag??``).trim(),[t.tag]),d=I.useMemo(()=>Nl(u),[u]),f=I.useMemo(()=>Array.isArray(t.children)?t.children:[],[t.children]),p=I.useMemo(()=>h_(p_(m_(t.attrs??void 0,r,d))),[r,t.attrs,d]),m=d?e.ctx?.htmlComponents?.[d]:void 0,h=f.length>0&&!!u&&r!==`escape`&&!r_(u,r)&&!!e.ctx&&!!e.renderNode&&!!m,g=I.useMemo(()=>h&&e.ctx&&e.renderNode?L_(f,e.ctx,`${String(e.indexKey??`html-inline`)}-structured`,e.renderNode):null,[h,e.ctx,e.indexKey,e.renderNode,f]),_=I.useMemo(()=>{let n=t.content;if(!n)return{mode:`html`,content:``};if(r===`escape`||!vv(n,c))return{mode:`html`,content:n};let i=function(e,t,n=`safe`,r={}){if(!e)return[];try{return function(e,t,n=`safe`,r={}){let i=0,a=r.keyPrefix??`ms-html`,o=[],s=[];for(let c of e)if(c.type===`text`){if(o.length>0&&o[o.length-1].hardBlocked)continue;(o.length>0?o[o.length-1].children:s).push(c.content),o.length>0&&o[o.length-1].sourceParts.push(c.content)}else if(c.type===`self_closing`){let e=c.attrs||{},l=Pb(c.tagName,e,!0),u=_v(c.tagName,t),d=!!Lb(c.tagName,r);if(ol.has(c.tagName.toLowerCase())||!u&&!d&&i_(c.tagName,n))continue;if(!u&&!d&&r_(c.tagName,n)){(o.length>0?o[o.length-1].children:s).push(l),o.length>0&&o[o.length-1].sourceParts.push(l);continue}let f=Vb(c.tagName,e,[],t,`${a}-${i++}`,n,r,``,l,{loading:!1,autoClosed:!1});Fb(o.length>0?o[o.length-1].children:s,f),o.length>0&&o[o.length-1].sourceParts.push(l)}else if(c.type===`tag_open`){let e=o.length>0&&o[o.length-1].hardBlocked,i=_v(c.tagName,t),a=!!Lb(c.tagName,r);o.push({tagName:c.tagName,children:[],attrs:c.attrs,sourceParts:[],customComponent:i||a,hardBlocked:e||ol.has(c.tagName.toLowerCase())||!i&&!a&&i_(c.tagName,n),softBlocked:!e&&!i&&!a&&r_(c.tagName,n)})}else if(c.type===`tag_close`){let e=c.tagName.toLowerCase(),l=-1;for(let t=o.length-1;t>=0;t--)if(o[t].tagName.toLowerCase()===e){l=t;break}if(l!==-1)for(;o.length>l;){let c=o.pop(),u=c.sourceParts.join(``),d=`${Pb(c.tagName,c.attrs||{})}${u}</${c.tagName}>`,f;if(c.hardBlocked)f=null;else if(c.softBlocked)f=[Pb(c.tagName,c.attrs||{}),...c.children,`</${c.tagName}>`];else{let o=c.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:Bb(r);f=Vb(c.tagName,c.attrs||{},c.children,t,`${a}-${i++}`,n,r,u,d,o)}o.length>0?Fb(o[o.length-1].children,f):Fb(s,f),o.length>0&&!c.hardBlocked&&o[o.length-1].sourceParts.push(d),c.tagName.toLowerCase()!==e&&o.length>l&&Nb(`Auto-closing unclosed tag: <${c.tagName}>`)}else Nb(`Ignoring closing tag with no matching opening tag: </${c.tagName}>`)}for(;o.length>0;){let e=o.pop(),c=e.sourceParts.join(``),l=`${Pb(e.tagName,e.attrs||{})}${c}`,u;u=e.hardBlocked?null:e.softBlocked?[Pb(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Vb(e.tagName,e.attrs||{},e.children,t,`${a}-${i++}`,n,r,c,l,Bb(r)),Fb(s,u),o.length>0&&!e.hardBlocked&&o[o.length-1].sourceParts.push(l),Nb(`Auto-closing unclosed tag: <${e.tagName}>`)}return s}(hv(e),t,n,r)}catch(e){return i=e,Mb&&console.error(`Failed to parse HTML to React nodes:`,i),null}var i}(n,s,r,{ctx:e.ctx,keyPrefix:String(e.indexKey??`html-inline`),nodeComponents:e.ctx?.streamingComponents,renderNode:e.renderNode,sourceNode:t});return i===null?{mode:`html`,content:n}:{mode:`dynamic`,block:Ib(n,c),nodes:i}},[s,c,r,t.autoClosed,t.content,t.loading,e.ctx,e.indexKey,e.renderNode]);return(0,I.useEffect)(()=>{if(!a||!i.current||_.mode!==`html`)return;let e=i.current;e.innerHTML=``;let t=document.createElement(`template`);t.innerHTML=l,e.appendChild(t.content.cloneNode(!0))},[_.mode,a,l]),!t.loading||t.autoClosed||h||_.mode===`dynamic`?h?I.createElement(m,p,g):_.mode===`dynamic`?_.block?(0,L.jsx)(L.Fragment,{children:_.nodes}):(0,L.jsx)(`span`,{className:`html-inline-node`,style:{display:`inline`},children:_.nodes}):(0,L.jsx)(`span`,{ref:i,className:`html-inline-node`,style:{display:`inline`}}):(0,L.jsx)(`span`,{className:`html-inline-node html-inline-node--loading`,children:t.content})}var Ub={fallbackSrc:``,lazy:!0,usePlaceholder:!0};function Wb(e,t,n){return n||e?{src:e,stage:`primary`}:t?{src:t,stage:`fallback`}:{src:``,stage:`failed`}}function Gb(e){let t={...Ub,...e},n=Cl(t.node.src),r=Cl(t.fallbackSrc),i=Wb(n,r,t.node.loading),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(i.src),[d,f]=(0,I.useState)(i.stage),p=l;return(0,I.useEffect)(()=>{let e=Wb(n,r,t.node.loading);u(e.src),f(e.stage),o(!1),c(e.stage===`failed`)},[n,r,t.node.loading]),!t.node.loading&&d!==`failed`&&p?(0,L.jsx)(`img`,{src:p,alt:String(t.node.alt??t.node.title??``),title:String(t.node.title??t.node.alt??``),className:`image-node__img`+(a?` is-loaded`:``),loading:t.lazy?`lazy`:`eager`,decoding:`async`,tabIndex:a?0:-1,"aria-label":t.node.alt??`Preview image`,onError:()=>{var e;if(d===`primary`&&r&&r!==l)return u(r),f(`fallback`),o(!1),void c(!1);f(`failed`),c(!0),(e=t.onError)==null||e.call(t,l)},onLoad:()=>{var e;o(!0),c(!1),(e=t.onLoad)==null||e.call(t,p)},onClick:e=>{var n;e.preventDefault(),a&&!s&&((n=t.onClick)==null||n.call(t,[e,p]))}},`image`):t.node.loading&&!s?(0,L.jsx)(`span`,{className:`image-node__placeholder`,children:t.usePlaceholder?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`image-node__spinner`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`image-node__placeholder-text`,children:`Loading image...`})]}):(0,L.jsx)(`span`,{className:`image-node__placeholder-text`,children:t.node.raw??`Loading image…`})},`placeholder`):t.node.loading||d!==`failed`?null:(0,L.jsxs)(`span`,{className:`image-node__error`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{fill:`currentColor`,d:`M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z`})}),(0,L.jsx)(`span`,{className:`image-node__placeholder-text`,children:`Image failed to load`})]})}var Kb=null,qb=null,Jb=(0,L.jsx)(`svg`,{width:`1em`,height:`1em`,viewBox:`0 0 291 300`,fill:`none`,className:`w-4 h-4 flex-shrink-0`,xmlns:`http://www.w3.org/2000/svg`,children:(0,L.jsxs)(`g`,{children:[(0,L.jsx)(`path`,{d:`M140.904 239.376C128.83 239.683 119.675 239.299 115.448 243.843C110.902 248.07 111.288 257.227 110.979 269.302C111.118 274.675 111.118 279.478 111.472 283.52C111.662 285.638 111.95 287.547 112.406 289.224C112.411 289.243 112.416 289.259 112.422 289.28C112.462 289.419 112.496 289.558 112.539 289.691C113.168 291.787 114.088 293.491 115.446 294.758C116.662 296.064 118.283 296.963 120.264 297.69C120.36 297.614 120.464 297.646 120.555 297.675C120.56 297.68 120.56 297.68 120.566 297.68C120.848 297.768 121.142 297.846 121.443 297.923C121.454 297.923 121.464 297.928 121.478 297.934C122.875 298.272 124.424 298.507 126.11 298.678C126.326 298.696 126.542 298.718 126.763 298.739C130.79 299.086 135.558 299.088 140.904 299.222C152.974 298.912 162.128 299.302 166.36 294.758C170.904 290.526 170.515 281.371 170.824 269.302C170.515 257.227 170.907 248.07 166.36 243.843C162.131 239.299 152.974 239.683 140.904 239.376Z`,fill:`#FF6376`}),(0,L.jsx)(`path`,{d:`M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z`,fill:`#FFCCCC`}),(0,L.jsx)(`path`,{d:`M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z`,fill:`#FF939F`}),(0,L.jsx)(`path`,{d:`M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z`,fill:`#FF356A`}),(0,L.jsx)(`path`,{d:`M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z`,fill:`#FF6376`})]})}),Yb={maxHeight:`500px`,loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Xb(e){let t={...Yb,...e},{t:n}=qy(),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(()=>typeof window>`u`),p=t.node.code,m=(0,I.useMemo)(()=>t.maxHeight&&t.maxHeight!==`none`?Ev(t.maxHeight):null,[t.maxHeight]),h=(0,I.useMemo)(()=>Ev(t.estimatedPreviewHeightPx)??Dv(p),[p,t.estimatedPreviewHeightPx]),[g,_]=(0,I.useState)(()=>`${Ov(h,360,m)}px`),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(1),[w,T]=(0,I.useState)({x:0,y:0}),[E,D]=(0,I.useState)(!1),O=(0,I.useRef)(null),k=(0,I.useRef)(null),A=(0,I.useRef)(null),j=(0,I.useRef)(null),M=(0,I.useRef)(null),N=(0,I.useRef)(null),ee=(0,I.useRef)(null),te=(0,I.useRef)(0),P=(0,I.useRef)(w);P.current=w;let F=(0,I.useRef)(S);F.current=S;let ne=(0,I.useRef)(l);ne.current=l;let re=(0,I.useRef)(v);re.current=v;let ie=Gy(),ae=(0,I.useCallback)(()=>{let e=O.current;return Ev(e?getComputedStyle(e).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??360},[]),oe=(0,I.useCallback)(()=>Ov(h,ae(),m),[h,m,ae]),se=(0,I.useCallback)(e=>{let n=oe();if(!t.maxHeight||t.maxHeight===`none`)return`${Math.max(e,n)}px`;let r=Number.parseFloat(String(t.maxHeight));return Number.isFinite(r)?`${Math.max(Math.min(e,r),n)}px`:`${Math.max(e,n)}px`},[t.maxHeight,oe]),ce=(0,I.useCallback)(()=>{let e=O.current;if(!e)return;let t=e.scrollHeight;t>0&&_(se(t))},[se]);(0,I.useEffect)(()=>{s||a||_(e=>{let t=Ev(e),n=oe();return t!=null&&t>=n?e:`${n}px`})},[a,oe,s]);let le=(0,I.useCallback)(async()=>{var e;try{await navigator.clipboard?.writeText(p),i(!0),(e=t.onCopy)==null||e.call(t,p),setTimeout(()=>i(!1),1e3)}catch{}},[p,t]),ue=(0,I.useCallback)(async()=>{var e,n,r,i,a,o,s,c;if(!d||!O.current)return;let l=O.current,u=p,f=!1===t.loading,m=++te.current,h=null,g=null;try{let t=await async function(){return qb||Kb||(Kb=R(()=>import(`./infographic_markstream-react-C3vVus-4.js`).then(e=>{let t=e&&e.default?e.default:e,n=t;return typeof t==`function`&&t.prototype&&t.prototype.render?n=t:e.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),qb=n,n}),[]).catch(e=>(console.warn(`Failed to load @antv/infographic`,e),null)),Kb)}();if(m!==te.current||l!==O.current)return;if(!t)throw Error(`Infographic library failed to load.`);g=Array.from(l.childNodes),h=new t({container:l,width:`100%`,height:`100%`});let a=``,o=!1;if((e=h.on)==null||e.call(h,`error`,e=>{a=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:typeof e==`string`?e:String(e&&typeof e==`object`&&`message`in e?e.message??``:e??``)).filter(Boolean).join(`; `)}),(n=h.on)==null||n.call(h,`rendered`,()=>{o=!0}),h.render(u),a)throw Error(a);let s=Array.from(l.childNodes),c=s.length>0&&(s.length!==g.length||s.some((e,t)=>e!==g?.[t]));if(!o&&!c)throw Error(`Infographic render returned empty output.`);(i=(r=ee.current)?.destroy)==null||i.call(r),ee.current=h,h=null,y(!0),x(!1),setTimeout(()=>{ce()},0)}catch(e){if(m!==te.current||l!==O.current)return;(a=h?.destroy)==null||a.call(h),h=null,f&&!1===t.loading&&u===p?(console.error(`Failed to render infographic:`,e),(s=(o=ee.current)?.destroy)==null||s.call(o),ee.current=null,y(!1),x(!0),l.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${e instanceof Error?e.message:`Unknown error`}</div>`):g&&l.replaceChildren(...g)}finally{(c=h?.destroy)==null||c.call(h)}},[p,t.loading,ce,d]);(0,I.useEffect)(()=>{let e=k.current;if(!e)return;let t=ie(e,{rootMargin:`160px`});return A.current=t,t.isVisible()&&f(!0),t.whenVisible.then(()=>f(!0)),()=>{t.destroy(),A.current=null}},[ie]),(0,I.useEffect)(()=>{!d||s||a||ue()},[p,a,ue,s,d]),(0,I.useEffect)(()=>()=>{var e,t;te.current+=1,ee.current&&=((t=(e=ee.current).destroy)==null||t.call(e),null)},[]);let de=(0,I.useCallback)(()=>{u(!1),j.current&&(j.current.innerHTML=``),M.current=null,document.body.style.overflow=``},[]),fe=(0,I.useCallback)(()=>{u(!0),document.body.style.overflow=`hidden`},[]);(0,I.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&de()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l,de]),(0,I.useEffect)(()=>{l&&setTimeout(()=>{if(O.current&&j.current){j.current.innerHTML=``;let e=document.createElement(`div`);Object.assign(e.style,{transition:`transform 0.1s ease`,transformOrigin:`center center`,width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`});let t=O.current.cloneNode(!0);t.classList.add(`fullscreen`),t.style.height=`auto`,e.appendChild(t),j.current.appendChild(e),M.current=e,e.style.transform=`translate(${w.x}px, ${w.y}px) scale(${S})`}},0)},[l]),(0,I.useEffect)(()=>{l&&M.current&&(M.current.style.transform=`translate(${w.x}px, ${w.y}px) scale(${S})`)},[l,w,S]);let pe=(0,I.useCallback)(()=>{let e=O.current?.querySelector(`svg`);if(!e)return;let t=new XMLSerializer().serializeToString(e),n=new Blob([t],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},[]);N.current||=Fv({getTranslate:()=>P.current,setTranslate:e=>T(e),canStart:e=>!!re.current&&(e.pointerType!==`touch`||ne.current||F.current>1),onActiveChange:e=>D(e)});let me=N.current;(0,I.useEffect)(()=>()=>me.stop(),[me]);let he=t.isDark?`p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200`:`p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700`,ge=s||a,_e=l||S>1;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{ref:k,"data-markstream-infographic":`1`,"data-markstream-mode":s?`source`:b?`error`:v?`preview`:`pending`,className:hb(`my-4 rounded-lg border overflow-hidden shadow-sm`,t.isDark?`border-gray-700/30`:`border-gray-200`,{"is-rendering":t.loading}),children:[t.showHeader&&(0,L.jsxs)(`div`,{className:hb(`flex justify-between items-center px-4 py-2.5 border-b`,t.isDark?`bg-gray-800 border-gray-700/30`:`bg-gray-50 border-gray-200`),children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-x-2 overflow-hidden`,children:[Jb,(0,L.jsx)(`span`,{className:hb(`text-sm font-medium font-mono truncate`,t.isDark?`text-gray-400`:`text-gray-600`),children:`Infographic`})]}),t.showModeToggle&&(0,L.jsxs)(`div`,{className:hb(`flex items-center gap-x-1 rounded-md p-0.5`,t.isDark?`bg-gray-700`:`bg-gray-100`),children:[(0,L.jsx)(`button`,{className:hb(`px-2.5 py-1 text-xs rounded transition-colors`,s?t.isDark?`text-gray-400 hover:text-gray-200`:`text-gray-500 hover:text-gray-700`:t.isDark?`bg-gray-600 text-gray-200 shadow-sm`:`bg-white text-gray-700 shadow-sm`),onClick:()=>c(!1),onMouseEnter:e=>rb(e.currentTarget,n(`common.preview`)||`Preview`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsxs)(`div`,{className:`flex items-center gap-x-1`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}),(0,L.jsx)(`span`,{children:n(`common.preview`)||`Preview`})]})}),(0,L.jsx)(`button`,{className:hb(`px-2.5 py-1 text-xs rounded transition-colors`,s?t.isDark?`bg-gray-600 text-gray-200 shadow-sm`:`bg-white text-gray-700 shadow-sm`:t.isDark?`text-gray-400 hover:text-gray-200`:`text-gray-500 hover:text-gray-700`),onClick:()=>c(!0),onMouseEnter:e=>rb(e.currentTarget,n(`common.source`)||`Source`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsxs)(`div`,{className:`flex items-center gap-x-1`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m16 18l6-6l-6-6M8 6l-6 6l6 6`})}),(0,L.jsx)(`span`,{children:n(`common.source`)||`Source`})]})})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-x-1`,children:[t.showCollapseButton&&(0,L.jsx)(`button`,{className:he,onClick:()=>o(!a),onMouseEnter:e=>rb(e.currentTarget,a?n(`common.expand`)||`Expand`:n(`common.collapse`)||`Collapse`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsx)(`svg`,{style:{rotate:a?`0deg`:`90deg`},xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m9 18l6-6l-6-6`})})}),t.showCopyButton&&(0,L.jsx)(`button`,{className:he,onClick:le,onMouseEnter:e=>rb(e.currentTarget,r?n(`common.copied`)||`Copied`:n(`common.copy`)||`Copy`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsx)(`svg`,r?{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M20 6L9 17l-5-5`})}:{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})})}),t.showExportButton&&(0,L.jsx)(`button`,{className:hb(he,ge&&`opacity-50 cursor-not-allowed`),disabled:ge,onClick:pe,onMouseEnter:e=>rb(e.currentTarget,n(`common.export`)||`Export`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`path`,{d:`m7 10l5 5l5-5`})]})})}),t.showFullscreenButton&&(0,L.jsx)(`button`,{className:hb(he,ge&&`opacity-50 cursor-not-allowed`),disabled:ge,onClick:fe,onMouseEnter:e=>rb(e.currentTarget,l?n(`common.minimize`)||`Minimize`:n(`common.open`)||`Open`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsx)(`svg`,l?{xmlns:`http://www.w3.org/2000/svg`,width:`0.75rem`,height:`0.75rem`,viewBox:`0 0 24 24`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`})}:{xmlns:`http://www.w3.org/2000/svg`,width:`0.75rem`,height:`0.75rem`,viewBox:`0 0 24 24`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`})})})]})]}),!a&&(0,L.jsx)(`div`,{children:s?(0,L.jsx)(`div`,{className:hb(`p-4`,t.isDark?`bg-gray-900`:`bg-gray-50`),children:(0,L.jsx)(`pre`,{className:hb(`text-sm font-mono whitespace-pre-wrap`,t.isDark?`text-gray-300`:`text-gray-700`),children:p})}):(0,L.jsxs)(`div`,{className:`relative`,children:[t.showZoomControls&&(0,L.jsx)(`div`,{className:`absolute top-2 right-2 z-10 rounded-lg`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2 backdrop-blur rounded-lg`,children:[(0,L.jsx)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>C(Math.min(S+.1,3)),children:`+`}),(0,L.jsx)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>C(Math.max(S-.1,.5)),children:`-`}),(0,L.jsxs)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>{C(1),T({x:0,y:0})},children:[Math.round(100*S),`%`]})]})}),(0,L.jsxs)(`div`,{className:hb(`infographic-preview relative transition-all duration-100 overflow-hidden block`,t.isDark?`bg-gray-900`:`bg-gray-50`),style:{height:g,maxHeight:t.maxHeight??void 0,minHeight:`var(--ms-size-diagram-min-height, 360px)`,touchAction:_e?`none`:void 0},onPointerDown:e=>me.start(e.nativeEvent),children:[!v&&!b&&(0,L.jsx)(`pre`,{className:hb(`absolute inset-0 overflow-auto p-4 text-left text-sm font-mono whitespace-pre-wrap`,t.isDark?`text-gray-300`:`text-gray-700`),children:p}),(0,L.jsx)(`div`,{className:hb(`absolute inset-0 cursor-grab`,E&&`cursor-grabbing`),style:{transform:`translate(${w.x}px, ${w.y}px) scale(${S})`},children:(0,L.jsx)(`div`,{ref:O,className:`w-full text-center flex items-center justify-center min-h-full`})})]})]})})]}),l&&typeof document<`u`&&(0,P_.createPortal)((0,L.jsx)(`div`,{className:`markstream-react fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,onClick:de,role:`dialog`,"aria-modal":`true`,children:(0,L.jsxs)(`div`,{className:hb(`dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden`,t.isDark?`bg-gray-900`:`bg-white`),onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`absolute top-6 right-6 z-50 flex items-center gap-2`,children:[(0,L.jsx)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>C(Math.min(S+.1,3)),children:`+`}),(0,L.jsx)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>C(Math.max(S-.1,.5)),children:`-`}),(0,L.jsxs)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>{C(1),T({x:0,y:0})},children:[Math.round(100*S),`%`]}),(0,L.jsx)(`button`,{className:hb(`inline-flex items-center justify-center p-2 rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:de,children:`X`})]}),(0,L.jsx)(`div`,{ref:j,className:hb(`w-full h-full flex items-center justify-center p-4 overflow-hidden`,!E&&`cursor-grab`,E&&`cursor-grabbing`),style:{touchAction:_e?`none`:void 0},onPointerDown:e=>me.start(e.nativeEvent)})]})}),document.body)]})}function Zb(e,t){return e.reduce((e,n)=>{let r=t==null||n.id===t?{...n,fading:!1}:n,i=e[e.length-1];return!i||i.fading||r.fading?e.push(r):e[e.length-1]={...i,content:i.content+r.content},e},[])}function Qb(e){var t;let{node:n,children:r,ctx:i,indexKey:a,fade:o}=e,s=String(n.code??``),c=(t=o??i?.fade)==null||t,l=a==null||a===``?``:String(a),[u,d]=(0,I.useState)(s?[{id:0,content:s,fading:!1}]:[]),f=Hy(),p=(0,I.useRef)(s),m=(0,I.useRef)(1),h=(0,I.useRef)(void 0);return(0,I.useEffect)(()=>{let e=f?.getStreamRenderVersion()??i?.streamRenderVersion,t=e!==h.current;if(r!=null)return p.current=``,d([]),void(h.current=e);let n=f?.textStreamState??i?.textStreamState,a=l?n?.get(l):void 0,o=p.current,u=!!(o===s&&a&&s.startsWith(a)&&s.length>a.length);if(u&&(o=a),c){if(s!==o){if(o&&s.startsWith(o)){let e=s.slice(o.length);d(t=>{if(u)return[{id:m.current++,content:o,fading:!1},{id:m.current++,content:e,fading:!0}];let n=t[t.length-1];return n?.fading?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:m.current++,content:e,fading:!0}]})}else d(s?[{id:m.current++,content:s,fading:!1}]:[])}else t&&d(e=>e.some(e=>e.fading)?Zb(e):e)}else d(e=>e.length!==1||e[0]?.fading||e[0].content!==s?s?[{id:m.current++,content:s,fading:!1}]:[]:e);p.current=s,h.current=e,l&&n?.set(l,s)},[r,s,f,i?.textStreamState,i?.streamRenderVersion,l,c]),(0,L.jsx)(`code`,{className:`inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full`,children:r||u.map(e=>(0,L.jsx)(`span`,{className:e.fading?hb(`text-node-stream-delta`,e.id%2==0?`text-node-stream-delta--a`:`text-node-stream-delta--b`):void 0,onAnimationEnd:e.fading?()=>{t=e.id,d(e=>e.some(e=>e.id===t&&e.fading)?Zb(e,t):e);return;var t}:void 0,children:e.content},e.id))})}function $b(e){return(0,L.jsx)(`ins`,{className:`insert-node`,children:e.children})}function ex(e,t){return e.reduce((e,n)=>{let r=t==null||n.id===t?{...n,fading:!1}:n,i=e[e.length-1];return!i||i.fading||r.fading?e.push(r):e[e.length-1]={...i,content:i.content+r.content},e},[])}function tx({content:e}){let t=(0,I.useRef)(e),n=(0,I.useRef)(t.current),r=(0,I.useRef)(null);return(0,I.useEffect)(()=>{let t=r.current;if(t){if(e.startsWith(n.current)){let r=e.slice(n.current.length);r&&t.appendChild(document.createTextNode(r)),n.current=e}else t.textContent=e,n.current=e}},[e]),(0,L.jsx)(`span`,{ref:r,children:t.current})}function nx(e){var t;let{node:n,children:r,ctx:i,indexKey:a,fade:o}=e,s=String(n.content??``),c=(t=o??i?.fade)==null||t,l=a==null||a===``?``:String(a),[u,d]=(0,I.useState)(s?[{id:0,content:s,fading:!1}]:[]),f=Hy(),p=(0,I.useRef)(s),m=(0,I.useRef)(1),h=(0,I.useRef)(void 0);return(0,I.useEffect)(()=>{let e=f?.getStreamRenderVersion()??i?.streamRenderVersion,t=e!==h.current;if(r!=null)return p.current=``,d([]),void(h.current=e);let n=f?.textStreamState??i?.textStreamState,a=l?n?.get(l):void 0,o=p.current,u=!!(o===s&&a&&s.startsWith(a)&&s.length>a.length);if(u&&(o=a),c){if(s!==o){if(o&&s.startsWith(o)){let e=s.slice(o.length);d(t=>{if(u)return[{id:m.current++,content:o,fading:!1},{id:m.current++,content:e,fading:!0}];let n=t[t.length-1];return n?.fading?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:m.current++,content:e,fading:!0}]})}else d(s?[{id:m.current++,content:s,fading:!1}]:[])}else t&&d(e=>e.some(e=>e.fading)?ex(e):e)}else d(e=>{if(!s)return[];let t=e.reduce((e,t)=>e+t.content,``);return s===t?e:s.startsWith(t)?[...e,{id:m.current++,content:s.slice(t.length),fading:!1}]:[{id:m.current++,content:s,fading:!1}]});p.current=s,h.current=e,l&&n?.set(l,s)},[r,s,f,i?.textStreamState,i?.streamRenderVersion,l,c]),(0,L.jsx)(`span`,r==null?{className:hb(`text-node whitespace-pre-wrap break-words`,n.center&&`text-node-center`),children:u.map(e=>(0,L.jsx)(`span`,{className:e.fading?hb(`text-node-stream-delta`,e.id%2==0?`text-node-stream-delta--a`:`text-node-stream-delta--b`):void 0,onAnimationEnd:e.fading?()=>{t=e.id,d(e=>e.some(e=>e.id===t&&e.fading)?ex(e,t):e);return;var t}:void 0,children:e.fading?e.content:(0,L.jsx)(tx,{content:e.content})},e.id))}:{className:hb(`text-node whitespace-pre-wrap break-words`,n.center&&`text-node-center`),children:r})}function rx(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e,a=!1!==e.showTooltip,o=e.isDark??n?.isDark,s=(0,I.useRef)(null);(0,I.useEffect)(()=>{let e=s.current;return()=>{e&&ib(!0,e)}},[a,t.loading]);let c=(0,I.useMemo)(()=>{let t=e.underlineBottom===void 0?`-3px`:typeof e.underlineBottom==`number`?`${e.underlineBottom}px`:String(e.underlineBottom),n=e.animationOpacity??.35,r=Math.max(.12,Math.min(.5*n,n));return{"--link-color":e.color??`#0366d6`,"--underline-height":`${e.underlineHeight??2}px`,"--underline-bottom":t,"--underline-opacity":String(n),"--underline-rest-opacity":String(r),"--underline-duration":`${e.animationDuration??1.6}s`,"--underline-timing":e.animationTiming??`ease-in-out`,"--underline-iteration":typeof e.animationIteration==`number`?String(e.animationIteration):e.animationIteration??`infinite`}},[e.animationDuration,e.animationIteration,e.animationOpacity,e.animationTiming,e.color,e.underlineBottom,e.underlineHeight]),l=(0,I.useMemo)(()=>f_({href:String(t.href??``)}).href,[t.href]),u=typeof t.title==`string`&&t.title.trim().length>0?t.title:String(l??``),d=xl(l),f=(0,I.useCallback)(e=>{a&&rb(e.currentTarget,String(t.title||l||t.text||``),`top`,!1,(e.clientX,e.clientY),o)},[o,t.text,t.title,l,a]),p=(0,I.useCallback)(e=>{a&&ib(!1,e.currentTarget)},[a]);return t.loading?(0,L.jsx)(`span`,{className:`link-loading inline-flex items-baseline gap-1.5`,"aria-hidden":`false`,style:c,children:(0,L.jsxs)(`span`,{className:`link-text-wrapper relative inline-flex`,children:[(0,L.jsx)(`span`,{className:`leading-[normal] link-text`,children:(0,L.jsx)(nx,{node:{type:`text`,content:String(t.text??``)},ctx:n,indexKey:`${String(i??`link`)}-loading`,typewriter:e.typewriter})}),(0,L.jsx)(`span`,{className:`link-loading-indicator`,"aria-hidden":`true`})]})}):(0,L.jsx)(`a`,{ref:s,className:`link-node`,href:l||void 0,title:a?``:u,"aria-label":`Link: ${u}`,target:d?`_blank`:void 0,rel:d?`noopener noreferrer`:void 0,style:c,onMouseEnter:f,onMouseLeave:p,children:n&&r?L_(t.children,n,String(i??`link`),r):(0,L.jsx)(nx,{node:{type:`text`,content:String(t.text??``)},ctx:n,indexKey:`${String(i??`link`)}-fallback`,typewriter:e.typewriter})})}function ix(e){let{node:t,ctx:n,renderNode:r,value:i,indexKey:a,children:o}=e;return(0,L.jsx)(`li`,{className:`list-item pl-1.5 my-2`,dir:`auto`,value:i??void 0,children:o??(n&&r?L_(t.children,n,String(a??`list-item`),r):null)})}function ax(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e,a=t.ordered?`ol`:`ul`,o=t.ordered&&t.start?t.start:void 0,s=n&&G_(n.customId).list_item||ix;return(0,L.jsx)(a,{className:hb(`list-node my-5 pl-[calc(13/8*1em)]`,t.ordered?`list-decimal`:`list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]`),start:o,children:t.items?.map((e,a)=>(0,L.jsx)(s,{node:e,value:t.ordered?(t.start??1)+a:void 0,ctx:n,renderNode:r,indexKey:`${String(i??`list`)}-${a}`,customId:n?.customId,isDark:n?.isDark,typewriter:n?.typewriter},`${String(i??`list`)}-${a}`))})}var ox=null,sx=null,cx=!1,lx=new Map,ux=new Map,dx=5,fx=new Set;function px(){if(lx.size<dx&&fx.size){let e=Array.from(fx);fx.clear();for(let t of e)try{t()}catch{}}}var mx=`WORKER_BUSY`;async function hx(e,t=!0,n=2e3,r){performance.now();let i=kv(e);if(sx)return Promise.reject(sx);let a=`${t?`d`:`i`}:${i}`,o=ux.get(a);if(o)return Promise.resolve(o);let s=ox||(sx=Error(`[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().`),sx.name=`WORKER_INIT_ERROR`,sx.code=`WORKER_INIT_ERROR`,null);if(!s)return Promise.reject(sx);if(lx.size>=dx){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=mx,e.busy=!0,e.inFlight=lx.size,e.max=dx,Promise.reject(e)}return new Promise((e,a)=>{if(r?.aborted){let e=Error(`Aborted`);e.name=`AbortError`,a(e);return}let o=Math.random().toString(36).slice(2),c=setTimeout(()=>{lx.delete(o);let e=Error(`Worker render timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,a(e),px()},n),l=()=>{},u=()=>{lx.delete(o),clearTimeout(c),fx.delete(l);let e=Error(`Aborted`);e.name=`AbortError`,a(e),px()};r&&r.addEventListener(`abort`,u,{once:!0}),lx.set(o,{resolve:t=>{r&&r.removeEventListener(`abort`,u),e(t)},reject:e=>{r&&r.removeEventListener(`abort`,u),a(e)},timeoutId:c});try{s.postMessage({id:o,content:i,displayMode:t,debug:cx})}catch(e){lx.delete(o),clearTimeout(c),r&&r.removeEventListener(`abort`,u),a(e),px()}})}function gx(e,t,n){let r=`${t?`d`:`i`}:${kv(e)}`;if(ux.set(r,n),ux.size>200){let e=ux.keys().next().value;ux.delete(e)}}function _x(e=1500,t){return lx.size<dx?Promise.resolve():new Promise((n,r)=>{if(t?.aborted){let e=Error(`Aborted`);e.name=`AbortError`,r(e);return}let i=null;function a(){fx.delete(o),i!=null&&clearTimeout(i),t&&t.removeEventListener(`abort`,s)}function o(){a(),n()}function s(){a();let e=Error(`Aborted`);e.name=`AbortError`,r(e)}i=e>0?setTimeout(()=>{a(),r(Error(`Timeout waiting for worker slot`))},e):null,t&&t.addEventListener(`abort`,s,{once:!0}),fx.add(o)})}var vx={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};async function yx(e,t=!0,n={}){let r=n.timeout??vx.timeout,i=n.waitTimeout??vx.waitTimeout,a=n.backoffMs??vx.backoffMs,o=n.maxRetries??vx.maxRetries,s=Number.isFinite(o)?Math.max(0,Math.min(Math.floor(o),8)):vx.maxRetries,c=n.signal,l=0;for(;;){if(c?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}try{return await hx(e,t,r,c)}catch(e){if(e?.code!==`WORKER_BUSY`||l>=s)throw e;if(l++,await _x(i,c).catch(()=>{}),c?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}a>0&&await new Promise(e=>setTimeout(e,a*l))}}}var bx=null,xx=!1;async function Sx(){if(bx)return bx;if(xx)return null;try{return bx=await R(()=>Promise.resolve().then(()=>CL),void 0),await R(()=>import(`./mhchem-hM2_ctQQ.js`),[]),bx}catch{return xx=!0,null}}function Cx({node:e}){let t=(0,I.useRef)(null),n=(0,I.useRef)(null),r=(0,I.useRef)(null),i=Gy(),[a,o]=(0,I.useState)(!0),[s,c]=(0,I.useState)(()=>typeof window>`u`),l=(0,I.useRef)(0);return(0,I.useEffect)(()=>{let e=t.current;if(!e)return;let n=i(e,{rootMargin:`400px`});return r.current=n,n.isVisible()&&c(!0),n.whenVisible.then(()=>c(!0)),()=>{n.destroy(),r.current=null}},[i]),(0,I.useEffect)(()=>{let t=kv(e.content??``);if(!t)return n.current&&(n.current.innerHTML=``),void o(!1);if(!s)return void o(!0);let r=!1,i=new AbortController,a=++l.current;return yx(t,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{r||a!==l.current||(n.current&&(n.current.innerHTML=e),o(!1))}).catch(async i=>{if(r||a!==l.current||!n.current)return;let s=i?.code||i?.name;if(s===`WORKER_INIT_ERROR`||i?.fallbackToRenderer||s===`WORKER_BUSY`||s===`WORKER_TIMEOUT`){let i=await Sx();if(i)try{let s=i.renderToString(t,{throwOnError:e.loading,displayMode:!0});!r&&a===l.current&&n.current&&(n.current.innerHTML=s,o(!1),gx(t,!0,s));return}catch{}}e.loading||(n.current.textContent=e.raw,o(!1))}),()=>{r=!0,i.abort()}},[e.content,e.loading,e.raw,s]),(0,L.jsx)(`div`,{ref:t,className:`math-block text-center overflow-x-auto relative min-h-[40px]`,children:(0,L.jsx)(`div`,{ref:n,className:a?`math-rendering`:void 0})})}function wx({node:e}){let t=(0,I.useRef)(null),n=(0,I.useRef)(null),r=(0,I.useRef)(null),i=Gy(),[a,o]=(0,I.useState)(!0),[s,c]=(0,I.useState)(()=>typeof window>`u`),l=(0,I.useRef)(0);return(0,I.useEffect)(()=>{let e=t.current;if(!e)return;let n=i(e,{rootMargin:`400px`});return r.current=n,n.isVisible()&&c(!0),n.whenVisible.then(()=>c(!0)),()=>{n.destroy(),r.current=null}},[i]),(0,I.useEffect)(()=>{let t=kv(e.content??``);if(!t)return n.current&&(n.current.innerHTML=``),void o(!1);if(!s)return void o(!0);let r=!1,i=new AbortController,a=++l.current,c=e.markup===`$$`;return yx(t,c,{timeout:1500,waitTimeout:0,maxRetries:0,signal:i.signal}).then(e=>{r||a!==l.current||n.current&&(n.current.innerHTML=e,o(!1))}).catch(async i=>{if(r||a!==l.current||!n.current)return;let s=i?.code||i?.name;if(s===`WORKER_INIT_ERROR`||i?.fallbackToRenderer||s===`WORKER_BUSY`||s===`WORKER_TIMEOUT`){let i=await Sx();if(i)try{let s=i.renderToString(t,{throwOnError:e.loading,displayMode:c});!r&&a===l.current&&n.current&&(n.current.innerHTML=s,o(!1),gx(t,c,s));return}catch{}}e.loading||(n.current.textContent=e.raw,o(!1))}),()=>{r=!0,i.abort()}},[e.content,e.loading,e.raw,e.markup,s]),(0,L.jsxs)(`span`,{ref:t,className:`math-inline-wrapper`,children:[(0,L.jsx)(`span`,{ref:n,className:`math-inline`+(a?` math-inline--hidden`:``)}),a&&(0,L.jsxs)(`span`,{className:`math-inline__loading`,role:`status`,"aria-live":`polite`,children:[(0,L.jsx)(`span`,{className:`math-inline__spinner`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Loading`})]})]})}function Tx(e){try{if(typeof globalThis<`u`&&typeof globalThis.requestAnimationFrame==`function`)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}var Ex=null,Dx=null,Ox=new Map,kx=5,Ax=`WORKER_BUSY`;function jx(e,t,n=1400){if(Dx)return Promise.reject(Dx);let r=Ex||(Dx=Error(`[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().`),Dx.name=`WORKER_INIT_ERROR`,Dx.code=`WORKER_INIT_ERROR`,null);if(!r)return Promise.reject(Dx);if(Ox.size>=kx){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=Ax,e.inFlight=Ox.size,e.max=kx,Promise.reject(e)}return new Promise((i,a)=>{let o=Math.random().toString(36).slice(2),s=!1,c=null,l=()=>{s||(s=!0,c!=null&&clearTimeout(c),Ox.delete(o))};Ox.set(o,{resolve:e=>{l(),i(e)},reject:e=>{l(),a(e)}});try{r.postMessage({id:o,action:e,payload:t})}catch(e){Ox.delete(o),a(e);return}c=setTimeout(()=>{let e=Error(`Worker call timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,Ox.get(o)?.reject(e)},n)})}async function Mx(e,t,n=1400){return jx(`canParse`,{code:e,theme:t},n)}async function Nx(e,t,n=2400){return jx(`findPrefix`,{code:e,theme:t},n)}function Px(){var e;(e=Ex?.terminate)==null||e.call(Ex),Ex=null,Dx=null,Ox.clear()}var Fx=null,Ix=!1,Lx=null,Rx=null;function zx(e,t){var n;if(!e||!t)return;let r=function(e){return`${String(e?.securityLevel??`strict`)}|htmlLabels:${!1===e?.flowchart?.htmlLabels?`0`:`1`}`}(t);if(Lx!==r)try{typeof e.initialize==`function`?e.initialize(t):(n=e.mermaidAPI)!=null&&n.initialize&&e.mermaidAPI.initialize(t),Lx=r}catch{}}var Bx=typeof window<`u`?I.useLayoutEffect:I.useEffect,Vx={USE_PROFILES:{svg:!0},FORBID_TAGS:[`script`],FORBID_ATTR:[/^on/i],ADD_TAGS:[`style`],ADD_ATTR:[`style`],SAFE_FOR_TEMPLATES:!0};function Hx(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=``}}function Ux(e,t,n={}){if(!e)return``;let r=function(e,t){if(!e)return``;let n=mre(t);return n?(Hx(e),e.appendChild(n),e.innerHTML):``}(e,t);return r||n.keepPreviousOnFailure||Hx(e),r}function Wx(e,t,n){if(n&&e?.querySelector(`svg`))try{t?.(e)}catch{}}var Gx={maxHeight:`500px`,loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,renderDebounceMs:300,contentStableDelayMs:500,previewPollDelayMs:800,previewPollMaxDelayMs:4e3,previewPollMaxAttempts:12,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!0,enableMermaidInteractions:!1};function Kx(e){let t={...Gx,...e},{t:n}=qy(),r=(0,I.useMemo)(()=>ev(`mermaid`),[]),i=t.node?.code??``,a=(0,I.useMemo)(()=>i.replace(/\]::([^:])/g,`]:::$1`).replace(/:::subgraphNode$/gm,`::subgraphNode`),[i]),o=t.workerTimeoutMs??Gx.workerTimeoutMs,s=t.parseTimeoutMs??Gx.parseTimeoutMs,c=t.renderTimeoutMs??Gx.renderTimeoutMs,l=t.fullRenderTimeoutMs??Gx.fullRenderTimeoutMs,u=Math.max(0,t.renderDebounceMs??Gx.renderDebounceMs),d=(0,I.useMemo)(()=>t.maxHeight&&t.maxHeight!==`none`?Av(t.maxHeight):null,[t.maxHeight]),f=(0,I.useMemo)(()=>Av(t.estimatedPreviewHeightPx)??jv(a),[a,t.estimatedPreviewHeightPx]),[p,m]=(0,I.useState)(!1),[h,g]=(0,I.useState)(!1),[_,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(!1),[x,S]=(0,I.useState)(1),[C,w]=(0,I.useState)({x:0,y:0}),[T,E]=(0,I.useState)(!1),[D,O]=(0,I.useState)(!1),[k,A]=(0,I.useState)(!1),[j,M]=(0,I.useState)(null),[N,ee]=(0,I.useState)(!1),[te,P]=(0,I.useState)(()=>`${Mv(f,360,d)}px`),[F,ne]=(0,I.useState)(typeof window>`u`),re=(0,I.useRef)(null),ie=(0,I.useRef)(null),ae=(0,I.useRef)(null),oe=(0,I.useRef)(null),se=(0,I.useRef)(null),ce=(0,I.useRef)(null),le=(0,I.useRef)(null),ue=(0,I.useRef)(null),de=(0,I.useRef)(0),fe=(0,I.useRef)({}),pe=(0,I.useRef)(null),me=(0,I.useRef)(``),he=(0,I.useRef)(!1),ge=(0,I.useRef)(null),_e=(0,I.useRef)(!1),ve=(0,I.useRef)({zoom:1,translateX:0,translateY:0,containerHeight:te||`360px`}),ye=(0,I.useRef)(C);ye.current=C;let be=(0,I.useRef)(x);be.current=x;let xe=(0,I.useRef)(N);xe.current=N;let Se=Gy(),Ce=!!(t.node?.loading??t.loading),we=t.isDark?`dark`:`light`,Te=!!t.isStrict,Ee=!0===t.enableMermaidInteractions,De=(0,I.useMemo)(()=>Te?{startOnLoad:!1,securityLevel:`strict`,suppressErrorRendering:!0,dompurifyConfig:Vx,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:`loose`,suppressErrorRendering:!0},[Te]);(0,I.useEffect)(()=>{_e.current=k},[k]);let Oe=(0,I.useCallback)(()=>{let e=ie.current;return Av(e?getComputedStyle(e).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??360},[]),ke=(0,I.useCallback)(()=>Mv(f,Oe(),d),[f,d,Oe]);(0,I.useEffect)(()=>{h||_||P(e=>{let t=Av(e),n=ke();return t!=null&&t>=n?e:`${n}px`})},[_,ke,h]),(0,I.useEffect)(()=>{fe.current={}},[we,a,Te]),(0,I.useEffect)(()=>{let e=!1;return(async()=>{let t=await async function(e){if(Fx)return zx(Fx,e),Fx;if(Rx){let t=await Rx;return t&&zx(t,e),t}if(Ix)return null;try{Ix=!0,Rx=(async()=>{try{let t=await R(()=>import(`./mermaid.core-CX36n5_l.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),n=t?.default||t;if(Fx=n?.default?n.default:n?.mermaidAPI?n:n?.mermaid?n.mermaid:n,!Fx)throw Error(`Mermaid module did not export expected API`);return zx(Fx,e??{startOnLoad:!1,securityLevel:`strict`,flowchart:{htmlLabels:!1}}),Fx}catch(e){return console.warn(`[markstream-react] Failed to load mermaid:`,e),null}finally{Rx=null}})();let t=await Rx;return t&&zx(t,e),t}catch{return null}}(De);e||(re.current=t,m(!!t),he.current||g(!t))})(),()=>{e=!0}},[De]),(0,I.useEffect)(()=>{let e=ie.current;if(!e)return;let t=Se(e,{rootMargin:`400px`});return ge.current=t,t.isVisible()&&ne(!0),t.whenVisible.then(()=>ne(!0)),()=>{t.destroy(),ge.current=null}},[Se]),(0,I.useEffect)(()=>{if(typeof document>`u`||!N)return;let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[N]);let Ae=(0,I.useCallback)(()=>d,[d]),je=(0,I.useCallback)(e=>{let n=ie.current,r=oe.current;if(!n||!r)return;let i=r.querySelector(`svg`);if(!i)return;let a=0,o=0,s=i.getAttribute(`viewBox`);if(s){let e=s.split(` `);e.length===4&&(a=Number.parseFloat(e[2]),o=Number.parseFloat(e[3]))}if(a&&o||!i.hasAttribute(`width`)||!i.hasAttribute(`height`)||(a=Number.parseFloat(i.getAttribute(`width`)||`0`),o=Number.parseFloat(i.getAttribute(`height`)||`0`)),!a||!o||Number.isNaN(a)||Number.isNaN(o))try{let e=i.getBBox();a=e.width,o=e.height}catch{return}if(!(a>0&&o>0))return;let c=(e??n.clientWidth)*(o/a),l=Number.isFinite(c)&&c>0?c:o,u=Ae(),d=u==null?l:Math.min(l,u),f=ke();P(`${t.maxHeight===`none`?d:Math.max(d,f)}px`)},[t.maxHeight,ke,Ae]);(0,I.useEffect)(()=>{if(!ie.current||typeof ResizeObserver>`u`||h||_)return;let e=new ResizeObserver(e=>{if(!e.length)return;let t=e[0].contentRect.width;Tx(()=>je(t))});return e.observe(ie.current),()=>e.disconnect()},[_,h,je]),(0,I.useEffect)(()=>{h||_||je()},[_,t.maxHeight,h,je]),(0,I.useEffect)(()=>()=>{Px()},[]),(0,I.useLayoutEffect)(()=>{let e=fe.current[we];!h&&oe.current&&e!=null&&e.svg&&(Ux(oe.current,e.svg)&&(pe.current=e.bindFunctions??null,Wx(oe.current,e.bindFunctions,Ee)),Tx(()=>je()))},[Ee,h,we,je]);let Me=(0,I.useCallback)(async(e,n,r)=>{if(!re.current||!oe.current)return!1;O(!0);try{let t=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Yx(e,n),a=await $x(()=>re.current.render(t,i),{timeoutMs:l,signal:r});if(!a?.svg)return!1;let o=Ux(oe.current,a.svg);return!!o&&(pe.current=a.bindFunctions??null,Wx(oe.current,a.bindFunctions,Ee),je(),fe.current[n]={svg:o,bindFunctions:a.bindFunctions},A(!0),M(null),!0)}catch(e){if(!Ce){if(typeof t.onRenderError==`function`&&oe.current&&!0===t.onRenderError(e,a,oe.current))return!1;M(e instanceof Error?e.message:String(e))}return!1}finally{O(!1)}},[Ee,l,Ce,je]),Ne=(0,I.useCallback)(async(e,t,n)=>{if(re.current&&oe.current){O(!0);try{let r=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Yx(Qx(e)||e,t),a=await $x(()=>re.current.render(r,i),{timeoutMs:c,signal:n});if(a?.svg){let e=Ux(oe.current,a.svg,{keepPreviousOnFailure:!0});e&&(pe.current=a.bindFunctions??null,Wx(oe.current,a.bindFunctions,Ee)),e&&je()}}catch{}finally{O(!1)}}},[Ee,c,Ce,je]),Pe=(0,I.useCallback)(async(e,t)=>{if(!e.trim())return Hx(oe.current),A(!1),void(me.current=``);let n=e.replace(/\s+/g,``);if(n===me.current&&_e.current)return;let r=++de.current;if(Xx(e)===`gantt`){let i=Qx(e);if(!i.trim())return;try{if(await Jx(i,we,{workerTimeout:o,parseTimeout:s,mermaid:re.current,signal:t}),t?.aborted||de.current!==r)return;i===e?await Me(e,we,t)&&(me.current=n):await Ne(i,we,t)}catch(e){if(e?.name===`AbortError`)return}return}try{if(await Jx(e,we,{workerTimeout:o,parseTimeout:s,mermaid:re.current,signal:t}),t?.aborted||de.current!==r)return;await Me(e,we,t)&&(me.current=n);return}catch(e){if(e?.name===`AbortError`)return}try{let n=await async function(e,t,n){try{let r=await Nx(e,t,n.workerTimeout);if(r)return r}catch(e){if(e?.name===`AbortError`)throw e}return Qx(e)}(e,we,{workerTimeout:o,signal:t});if(!n||t?.aborted||de.current!==r)return;await Ne(n,we,t)}catch{}},[s,Me,Ne,we,o]),Fe=(0,I.useCallback)(()=>F&&!h&&!_,[_,h,F]);(0,I.useEffect)(()=>{if(!Fe()||!re.current)return;let e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&Fe()&&Pe(a,e.signal)},u);return()=>{e.abort(),window.clearTimeout(t)}},[a,Fe,p,Pe,u]);let Ie=(0,I.useCallback)((e,n)=>{e.clientX,e.clientY,rb(e.currentTarget,n,`top`,!1,0,t.isDark)},[t.isDark]),Le=(0,I.useCallback)(async()=>{var e;try{await navigator.clipboard?.writeText(a),b(!0),(e=t.onCopy)==null||e.call(t,a),setTimeout(()=>b(!1),1e3)}catch{}},[a,t]),Re=(0,I.useCallback)(()=>{var e;let n=oe.current?.querySelector(`svg`)??null;if(!n)return;let r=eS(n),i={payload:{type:`export`},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:n,svgString:r};(e=t.onExport)==null||e.call(t,i),i.defaultPrevented||function(e,t){let n=t??eS(e),r=new Blob([n],{type:`image/svg+xml;charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}(n,r)},[t]),ze=(0,I.useCallback)(()=>{le.current=null,Hx(ce.current)},[]),Be=(0,I.useCallback)(()=>{ee(!1),ze()},[ze]),Ve=(0,I.useCallback)(()=>{var e;let n=oe.current?.querySelector(`svg`)??null,r={payload:{type:`open-modal`},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:n,svgString:n?eS(n):null};(e=t.onOpenModal)==null||e.call(t,r),r.defaultPrevented||ee(!0)},[t]);(0,I.useEffect)(()=>{if(!N||typeof window>`u`)return;let e=e=>{e.key===`Escape`&&Be()};try{window.addEventListener(`keydown`,e)}catch{}return()=>{try{window.removeEventListener(`keydown`,e)}catch{}}},[Be,N]),Bx(()=>{if(!N)return;let e=ce.current,t=ie.current;if(!e||!t)return;let n=`translate(${C.x}px, ${C.y}px) scale(${x})`,r=t.cloneNode(!0);r.classList.add(`fullscreen`),r.style.height=`100%`,r.style.maxHeight=`100%`;let i=r.querySelector(`[data-mermaid-wrapper]`);i&&(le.current=i,i.style.transform=n),Hx(e),e.appendChild(r),Wx(e,pe.current??fe.current[we]?.bindFunctions,Ee)},[Ee,N,we]),(0,I.useEffect)(()=>{N&&le.current&&(le.current.style.transform=`translate(${C.x}px, ${C.y}px) scale(${x})`)},[N,C.x,C.y,x]);let He=h||D||_,Ue=(0,I.useMemo)(()=>t.isDark?`mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200`:`mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700`,[t.isDark]),We=(0,I.useCallback)(e=>{var n;let r={payload:{type:`toggle-mode`,target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if((n=t.onToggleMode)==null||n.call(t,e,r),!r.defaultPrevented){if(he.current=!0,e===`preview`){g(!1);let e=ve.current;S(e.zoom),w({x:e.translateX,y:e.translateY}),P(e.containerHeight)}else ve.current={zoom:x,translateX:C.x,translateY:C.y,containerHeight:te},g(!0)}},[a,te,Pe,t,we,C.x,C.y,je,x]),Ge=(0,I.useCallback)(e=>{if(!1===t.enableWheelZoom||!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=ie.current;if(!n)return;let r=n.getBoundingClientRect(),i=e.clientX-r.left-C.x,a=e.clientY-r.top-C.y,o=.01*-e.deltaY,s=qx(x+o,.5,3);if(s===x)return;let c=s/x;w({x:C.x-i*(c-1),y:C.y-a*(c-1)}),S(s)},[C,x]);ue.current||=Fv({getTranslate:()=>ye.current,setTranslate:e=>w(e),canStart:e=>!!oe.current?.querySelector(`svg`)&&(e.pointerType!==`touch`||xe.current||be.current>1),onActiveChange:e=>E(e)});let Ke=ue.current;(0,I.useEffect)(()=>()=>Ke.stop(),[Ke]);let qe=N||x>1,Je=(0,L.jsxs)(`div`,{className:`relative`,children:[t.showZoomControls&&(0,L.jsx)(`div`,{className:`absolute top-2 right-2 z-10 rounded-lg`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2 backdrop-blur rounded-lg`,children:[(0,L.jsx)(`button`,{type:`button`,className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onMouseEnter:e=>Ie(e,n(`common.zoomIn`)),onMouseLeave:()=>ib(),onClick:()=>S(qx(x+.1,.5,3)),children:`+`}),(0,L.jsx)(`button`,{type:`button`,className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onMouseEnter:e=>Ie(e,n(`common.zoomOut`)),onMouseLeave:()=>ib(),onClick:()=>S(qx(x-.1,.5,3)),children:`−`}),(0,L.jsxs)(`button`,{type:`button`,className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onMouseEnter:e=>Ie(e,n(`common.resetZoom`)),onMouseLeave:()=>ib(),onClick:()=>{S(1),w({x:0,y:0})},children:[Math.round(100*x),`%`]})]})}),(0,L.jsxs)(`div`,{ref:ie,className:hb(`relative overflow-hidden block transition-[height] duration-150 ease-out`,t.isDark?`bg-gray-900`:`bg-gray-50`),style:{height:te,maxHeight:t.maxHeight??void 0,minHeight:`var(--ms-size-diagram-min-height, 360px)`,touchAction:qe?`none`:void 0},onWheel:Ge,onPointerDown:e=>Ke.start(e.nativeEvent),children:[(0,L.jsx)(`div`,{ref:ae,"data-mermaid-wrapper":!0,className:hb(`absolute inset-0 cursor-grab`,{"cursor-grabbing":T}),style:{transform:`translate(${C.x}px, ${C.y}px) scale(${x})`},children:(0,L.jsx)(`div`,{ref:oe,className:`_mermaid w-full text-center flex items-center justify-center min-h-full`})}),(D||Ce)&&(0,L.jsxs)(`div`,{className:`mermaid-loading`,children:[(0,L.jsx)(`span`,{className:`mermaid-spinner`}),(0,L.jsx)(`span`,{children:`Rendering diagram…`})]})]})]}),Ye=t.showHeader&&(0,L.jsxs)(`div`,{className:hb(`mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b`,t.isDark?`bg-gray-800 border-gray-700/30`:`bg-gray-50 border-gray-200`),children:[(0,L.jsxs)(`div`,{className:`flex items-center space-x-2 overflow-hidden`,children:[(0,L.jsx)(`span`,{className:`icon-slot h-4 w-4 flex-shrink-0`,dangerouslySetInnerHTML:{__html:r}}),(0,L.jsx)(`span`,{className:hb(`text-sm font-medium font-mono truncate`,t.isDark?`text-gray-400`:`text-gray-600`),children:`Mermaid`})]}),t.showModeToggle&&p&&(0,L.jsxs)(`div`,{className:hb(`flex items-center space-x-1 rounded-md p-0.5`,t.isDark?`bg-gray-700`:`bg-gray-100`),children:[(0,L.jsx)(`button`,{type:`button`,className:hb(`px-2.5 py-1 text-xs rounded transition-colors`,h?t.isDark?`text-gray-400 hover:text-gray-200`:`text-gray-500 hover:text-gray-700`:t.isDark?`bg-gray-600 text-gray-200 shadow-sm`:`bg-white text-gray-700 shadow-sm`),onClick:()=>We(`preview`),onMouseEnter:e=>Ie(e,n(`common.preview`)),onFocus:e=>Ie(e,n(`common.preview`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsxs)(`div`,{className:`flex items-center space-x-1`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}),(0,L.jsx)(`span`,{children:n(`common.preview`)})]})}),(0,L.jsx)(`button`,{type:`button`,className:hb(`px-2.5 py-1 text-xs rounded transition-colors`,h?t.isDark?`bg-gray-600 text-gray-200 shadow-sm`:`bg-white text-gray-700 shadow-sm`:t.isDark?`text-gray-400 hover:text-gray-200`:`text-gray-500 hover:text-gray-700`),onClick:()=>We(`source`),onMouseEnter:e=>Ie(e,n(`common.source`)),onFocus:e=>Ie(e,n(`common.source`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsxs)(`div`,{className:`flex items-center space-x-1`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m16 18l6-6l-6-6M8 6l-6 6l6 6`})}),(0,L.jsx)(`span`,{children:n(`common.source`)})]})})]}),(0,L.jsxs)(`div`,{className:`flex items-center space-x-1`,children:[t.showCollapseButton&&(0,L.jsx)(`button`,{type:`button`,className:Ue,"aria-pressed":_,onClick:()=>v(e=>!e),onMouseEnter:e=>Ie(e,n(_?`common.expand`:`common.collapse`)),onFocus:e=>Ie(e,n(_?`common.expand`:`common.collapse`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsx)(`svg`,{style:{rotate:_?`0deg`:`90deg`},xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m9 18l6-6l-6-6`})})}),t.showCopyButton&&(0,L.jsx)(`button`,{type:`button`,className:Ue,onClick:Le,onMouseEnter:e=>Ie(e,n(y?`common.copied`:`common.copy`)),onFocus:e=>Ie(e,n(y?`common.copied`:`common.copy`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsx)(`svg`,y?{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M20 6L9 17l-5-5`})}:{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})})}),t.showExportButton&&p&&(0,L.jsx)(`button`,{type:`button`,className:hb(Ue,He?`opacity-50 cursor-not-allowed`:``),disabled:He,onClick:Re,onMouseEnter:e=>Ie(e,n(`common.export`)),onFocus:e=>Ie(e,n(`common.export`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`path`,{d:`m7 10l5 5l5-5`})]})})}),t.showFullscreenButton&&p&&(0,L.jsx)(`button`,{type:`button`,className:hb(Ue,He?`opacity-50 cursor-not-allowed`:``),disabled:He,onClick:N?Be:Ve,onMouseEnter:e=>Ie(e,n(N?`common.minimize`:`common.open`)),onFocus:e=>Ie(e,n(N?`common.minimize`:`common.open`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsx)(`svg`,N?{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`})}:{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`})})})]})]}),Xe=(0,L.jsxs)(`div`,{children:[h?(0,L.jsx)(`div`,{className:hb(`p-4`,t.isDark?`bg-gray-900 text-gray-300`:`bg-gray-50 text-gray-700`),children:(0,L.jsx)(`pre`,{className:`text-sm font-mono whitespace-pre-wrap`,children:a})}):Je,j&&(0,L.jsx)(`div`,{className:`mermaid-error`,children:j})]});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{"data-markstream-mermaid":`1`,"data-markstream-mode":h?`source`:k?`preview`:`pending`,className:hb(`my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block`,t.isDark?`border-gray-700/30`:`border-gray-200`,{"is-rendering":Ce}),children:[Ye,(0,L.jsx)(`div`,{ref:se,style:{display:_?`none`:``},children:Xe})]}),N&&typeof document<`u`&&(0,P_.createPortal)((0,L.jsx)(`div`,{className:`markstream-react mermaid-modal-overlay`,onClick:()=>Be(),children:(0,L.jsxs)(`div`,{className:hb(`mermaid-modal-panel`,{"is-dark":t.isDark}),role:`dialog`,"aria-modal":`true`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`mermaid-modal-header`,children:[(0,L.jsx)(`span`,{className:`mermaid-modal-title`,children:`Mermaid ${n(`common.preview`)}`}),(0,L.jsx)(`button`,{type:`button`,className:`mermaid-modal-close`,onClick:Be,children:n(`common.close`)})]}),(0,L.jsx)(`div`,{className:`mermaid-modal-body`,children:(0,L.jsx)(`div`,{ref:ce,className:`mermaid-modal-content`})})]})}),document.body)]})}function qx(e,t,n){return Math.min(Math.max(e,t),n)}async function Jx(e,t,n){try{if(await Mx(e,t,n.workerTimeout))return!0}catch(e){if(e?.name===`AbortError`)throw e}if(!n.mermaid)throw Error(`Mermaid not available`);let r=Yx(e,t),i=n.mermaid;if(typeof i.parse==`function`)return await $x(()=>i.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;let a=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await $x(()=>i.render(a,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function Yx(e,t){return Nre(e,`%%{init: {"theme": "${t===`dark`?`dark`:`default`}"}}%%\n`)}function Xx(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(!(!e||e.startsWith(`%%`)))return(e.match(/^([A-Z][\w-]*)\b/i)?.[1])?.toLowerCase()||``}return``}function Zx(e){let t=e.trim();return!(!t||t.startsWith(`%%`))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(`:`)}function Qx(e){if(Xx(e)===`gantt`)return function(e){let t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){let e=t[t.length-1]?.trim();if(e&&!e.startsWith(`%%`)){if(Zx(e))break;t.pop()}else t.pop()}return t.some(Zx)?t.join(`
179
+ `){let e=this.fenceScanOffset+1;this.completeFenceLine(e),this.fenceScanOffset=e;continue}this.consumeFenceCharacter(t),this.fenceScanOffset++}this.updateFenceRevealBlock()}consumeFenceCharacter(e){if(this.fenceLineState!==`normal`){if(this.fenceLineState===`opening`){this.fenceMarker==="`"&&e==="`"&&(this.fenceLineState=`normal`);return}if(this.fenceLineState===`closing`){e!==` `&&e!==` `&&(this.fenceLineState=`normal`);return}if(!this.fenceMarker){if(e===` `&&this.fenceIndent<3){this.fenceIndent++;return}if(e==="`"||e===`~`){this.fenceMarker=e,this.fenceMarkerLength=1;return}this.fenceLineState=`normal`;return}if(e===this.fenceMarker){this.fenceMarkerLength++;return}if(this.activeFenceMarker){this.fenceLineState=this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(e===` `||e===` `)?`closing`:`normal`;return}this.fenceLineState=this.fenceMarkerLength>=3?`opening`:`normal`}}completeFenceLine(e){let t=this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3;!this.activeFenceMarker&&(this.fenceLineState===`opening`||t)?(this.atomicRevealRanges.push({start:this.fenceLineStart,end:e}),this.activeFenceMarker=this.fenceMarker,this.activeFenceLength=this.fenceMarkerLength):this.activeFenceMarker&&this.fenceMarker===this.activeFenceMarker&&this.fenceMarkerLength>=this.activeFenceLength&&(this.fenceLineState===`closing`||t)&&(this.activeFenceMarker=``,this.activeFenceLength=0),this.fenceLineStart=e,this.fenceLineState=`candidate`,this.fenceIndent=0,this.fenceMarker=``,this.fenceMarkerLength=0,this.blockedRevealEnd=0}updateFenceRevealBlock(){this.blockedRevealEnd=!this.activeFenceMarker&&(this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&(this.fenceIndent>0||this.fenceMarkerLength>0))?this.fenceLineStart+1:0}releaseTrailingFenceCandidate(){this.scanAppendedSource(!0),this.blockedRevealEnd&&=((this.fenceLineState===`opening`||this.fenceLineState===`candidate`&&this.fenceMarkerLength>=3)&&this.source.length>this.fenceLineStart&&this.atomicRevealRanges.push({start:this.fenceLineStart,end:this.source.length}),this.fenceLineState=`normal`,0)}isRevealBlocked(){return this.blockedRevealEnd!==0}getRevealableEnd(){return this.blockedRevealEnd?Math.min(this.source.length,this.blockedRevealEnd-1):this.source.length}hasRevealableChars(){return this.visible.length<this.getRevealableEnd()}takeNextRevealSlice(e){this.discardConsumedAtomicRanges();let t=this.getRevealableEnd();if(this.visible.length>=t)return{text:``,graphemeCount:0};let n=this.atomicRevealRanges[this.atomicRevealRangeIndex];if(n&&this.visible.length>=n.start&&this.visible.length<n.end)return Bv(this.source,this.visible.length,n.end-this.visible.length,this.segmenter,Math.min(n.end,t));let r=n&&n.start>this.visible.length?Math.min(n.start,t):t;return Bv(this.source,this.visible.length,e,this.segmenter,r)}discardConsumedAtomicRanges(){for(;this.atomicRevealRangeIndex<this.atomicRevealRanges.length&&this.atomicRevealRanges[this.atomicRevealRangeIndex].end<=this.visible.length;)this.atomicRevealRangeIndex++;this.atomicRevealRangeIndex>=64&&this.atomicRevealRangeIndex*2>=this.atomicRevealRanges.length&&(this.atomicRevealRanges.splice(0,this.atomicRevealRangeIndex),this.atomicRevealRangeIndex=0)}isDocumentHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}ensureLoop(){if(!(this.destroyed||this.rafId||this.timerId!=null||this.paused||!this.hasRevealableChars())){if(typeof requestAnimationFrame!=`function`){this.flush();return}if(this.attachVisibilityListener(),this.isDocumentHidden()&&typeof setTimeout==`function`){this.timerId=setTimeout(()=>{this.timerId=null,this.tick(zv())},Lre);return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&=(typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.rafId),0),this.timerId!=null&&(clearTimeout(this.timerId),this.timerId=null),this.detachVisibilityListener()}emit(){if(!this.destroyed)for(let e of this.listeners)e()}};function zre(e={},t){let n=new Rre(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function Bre(){if(typeof Intl>`u`)return null;let e=Intl.Segmenter;return e?new e(void 0,{granularity:`grapheme`}):null}function Bv(e,t,n,r,i=e.length){let a=Math.min(e.length,Math.max(t,i));if(t>=a||n<=0)return{text:``,graphemeCount:0};if(!r){let r=t,i=0;for(;r<a&&i<n;){let t=e.charCodeAt(r),n=e.charCodeAt(r+1);r=Math.min(a,r+(t>=55296&&t<=56319&&n>=56320&&n<=57343?2:1)),i++}return{text:e.slice(t,r),graphemeCount:i}}let o=t,s=0,c=!0;for(;s<n&&o<a;){let t=e.codePointAt(o),n=t>65535?2:1;if(o+n>a||!Vv(t)){c=!1;break}o+=n,s++}if(c&&o>t&&!(o<a&&e.charCodeAt(o-1)===13&&e.charCodeAt(o)===10)){let n=e.codePointAt(o),r=n!=null&&o+(n!=null&&n>65535?2:1)<=a&&Vv(n);if(o>=a||r)return{text:e.slice(t,o),graphemeCount:s}}let l=a-t,u=Math.min(l,Math.max(64,n*2));for(;;){let i=u>=l,a=e.slice(t,t+u),o=0,s=0;for(let i of r.segment(a)){if(s>=n)return{text:e.slice(t,t+o),graphemeCount:s};o+=i.segment.length,s++}if(i)return{text:e.slice(t,t+o),graphemeCount:s};u=Math.min(l,u*2)}}function Vre(e,t,n){return Math.min(n,Math.max(t,e))}function Hre(e){return e>=11904&&e<=12329||e>=12336&&e<=12351||e>=12352&&e<=12440||e>=12443&&e<=12543||e>=12544&&e<=12799||e>=12800&&e<=13311||e>=13312&&e<=19903||e>=19968&&e<=40959||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65103||e>=65280&&e<=65437||e>=65440&&e<=65519||e>=127488&&e<=127743||e>=131072&&e<=196607}function Vv(e){return e<=127||Hre(e)}var Hv=Math.min,Uv=Math.max,Wv=Math.round,Gv=Math.floor,Kv=e=>({x:e,y:e}),Ure={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Wre(e,t,n){return Uv(e,Hv(t,n))}function qv(e,t){return typeof e==`function`?e(t):e}function Jv(e){return e.split(`-`)[0]}function Yv(e){return e.split(`-`)[1]}function Xv(e){return e===`x`?`y`:`x`}function Zv(e){return e===`y`?`height`:`width`}function Qv(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $v(e){return Xv(Qv(e))}function Gre(e,t,n){n===void 0&&(n=!1);let r=Yv(e),i=$v(e),a=Zv(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ry(o)),[o,ry(o)]}function Kre(e){let t=ry(e);return[ey(e),t,ey(t)]}function ey(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ty=[`left`,`right`],ny=[`right`,`left`],qre=[`top`,`bottom`],Jre=[`bottom`,`top`];function Yre(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ny:ty:t?ty:ny;case`left`:case`right`:return t?qre:Jre;default:return[]}}function Xre(e,t,n,r){let i=Yv(e),a=Yre(Jv(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ey)))),a}function ry(e){let t=Jv(e);return Ure[t]+e.slice(t.length)}function Zre(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Qre(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Zre(e)}function iy(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 ay(e,t,n){let{reference:r,floating:i}=e,a=Qv(t),o=$v(t),s=Zv(o),c=Jv(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=Yv(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function $re(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}=qv(t,e),p=Qre(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=iy(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=iy(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 eie=50,tie=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:$re},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ay(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<eie&&(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}=ay(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},nie=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}=qv(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Jv(r),_=Qv(o),v=Jv(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ry(o)]:Kre(o)),x=p!==`none`;!d&&x&&b.push(...Xre(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=Gre(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`||_===Qv(t)||T.every(e=>Qv(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=Qv(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{}}}},rie=new Set([`left`,`top`]);async function iie(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Jv(n),s=Yv(n),c=Qv(n)===`y`,l=rie.has(o)?-1:1,u=a&&c?-1:1,d=qv(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 aie=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 iie(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}}}}},oie=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}=qv(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Qv(i),p=Xv(f),m=u[p],h=u[f],g=(e,t)=>Wre(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}}}}}};function oy(){return typeof window<`u`}function sy(e){return uy(e)?(e.nodeName||``).toLowerCase():`#document`}function cy(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ly(e){return((uy(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function uy(e){return oy()?e instanceof Node||e instanceof cy(e).Node:!1}function dy(e){return oy()?e instanceof Element||e instanceof cy(e).Element:!1}function fy(e){return oy()?e instanceof HTMLElement||e instanceof cy(e).HTMLElement:!1}function py(e){return!oy()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof cy(e).ShadowRoot}function my(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xy(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function sie(e){return/^(table|td|th)$/.test(sy(e))}function hy(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var cie=/transform|translate|scale|rotate|perspective|filter/,lie=/paint|layout|strict|content/,gy=e=>!!e&&e!==`none`,_y;function vy(e){let t=dy(e)?xy(e):e;return gy(t.transform)||gy(t.translate)||gy(t.scale)||gy(t.rotate)||gy(t.perspective)||!yy()&&(gy(t.backdropFilter)||gy(t.filter))||cie.test(t.willChange||``)||lie.test(t.contain||``)}function uie(e){let t=Cy(e);for(;fy(t)&&!by(t);){if(vy(t))return t;if(hy(t))return null;t=Cy(t)}return null}function yy(){return _y??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),_y}function by(e){return/^(html|body|#document)$/.test(sy(e))}function xy(e){return cy(e).getComputedStyle(e)}function Sy(e){return dy(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cy(e){if(sy(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||py(e)&&e.host||ly(e);return py(t)?t.host:t}function wy(e){let t=Cy(e);return by(t)?(e.ownerDocument||e).body:fy(t)&&my(t)?t:wy(t)}function Ty(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wy(e),i=r===e.ownerDocument?.body,a=cy(r);if(i){let e=Ey(a);return t.concat(a,a.visualViewport||[],my(r)?r:[],e&&n?Ty(e):[])}return t.concat(r,Ty(r,[],n))}function Ey(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Dy(e){let t=xy(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=fy(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Wv(n)!==a||Wv(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Oy(e){return dy(e)?e:e.contextElement}function ky(e){let t=Oy(e);if(!fy(t))return Kv(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Dy(t),o=(a?Wv(n.width):n.width)/r,s=(a?Wv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var die=Kv(0);function Ay(e){let t=cy(e);return!yy()||!t.visualViewport?die:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function fie(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===cy(e)}function jy(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Oy(e),o=Kv(1);t&&(r?dy(r)&&(o=ky(r)):o=ky(e));let s=fie(a,n,r)?Ay(a):Kv(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=cy(a),t=dy(r)?cy(r):r,n=e,i=Ey(n);for(;i&&t!==n;){let e=ky(i),t=i.getBoundingClientRect(),r=xy(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=cy(i),i=Ey(n)}}return iy({width:u,height:d,x:c,y:l})}function My(e,t){let n=Sy(e).scrollLeft;return t?t.left+n:jy(ly(e)).left+n}function Ny(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-My(e,n),y:n.top+t.scrollTop}}function pie(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ly(r),s=t?hy(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Kv(1),u=Kv(0),d=fy(r);if((d||!a)&&((sy(r)!==`body`||my(o))&&(c=Sy(r)),d)){let e=jy(r);l=ky(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ny(o,c):Kv(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 mie(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function hie(e){let t=Sy(e),n=e.ownerDocument.body,r=Uv(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Uv(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+My(e),o=-t.scrollTop;return xy(n).direction===`rtl`&&(a+=Uv(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var gie=25;function _ie(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=cy(e),a=ly(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!yy()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(My(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<=gie&&(s-=o)}return{width:s,height:c,x:l,y:u}}function vie(e,t){let n=jy(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ky(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Py(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=_ie(e,n,t);else if(t===`document`)r=hie(ly(e));else if(dy(t))r=vie(t,n);else{let n=Ay(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return iy(r)}function yie(e,t){let n=t.get(e);if(n)return n;let r=Ty(e,[],!1).filter(e=>dy(e)&&sy(e)!==`body`),i=null,a=xy(e).position===`fixed`,o=a?Cy(e):e;for(;dy(o)&&!by(o);){let e=xy(o),t=vy(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Cy(o)}return t.set(e,r),r}function bie(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?hy(t)?[]:yie(t,this._c):[].concat(n),r],o=Py(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=Py(t,a[e],i);s=Uv(n.top,s),c=Hv(n.right,c),l=Hv(n.bottom,l),u=Uv(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function xie(e){let{width:t,height:n}=Dy(e);return{width:t,height:n}}function Sie(e,t,n){let r=fy(t),i=ly(t),a=n===`fixed`,o=jy(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Kv(0);if((r||!a)&&((sy(t)!==`body`||my(i))&&(s=Sy(t)),r)){let e=jy(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=My(i));let l=i&&!r&&!a?Ny(i,s):Kv(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 Fy(e){return xy(e).position===`static`}function Iy(e,t){if(!fy(e)||xy(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ly(e)===n&&(n=n.ownerDocument.body),n}function Ly(e,t){let n=cy(e);if(hy(e))return n;if(!fy(e)){let t=Cy(e);for(;t&&!by(t);){if(dy(t)&&!Fy(t))return t;t=Cy(t)}return n}let r=Iy(e,t);for(;r&&sie(r)&&Fy(r);)r=Iy(r,t);return r&&by(r)&&Fy(r)&&!vy(r)?n:r||uie(e)||n}var Cie=async function(e){let t=this.getOffsetParent||Ly,n=this.getDimensions,r=await n(e.floating);return{reference:Sie(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wie(e){return xy(e).direction===`rtl`}var Tie={convertOffsetParentRelativeRectToViewportRelativeRect:pie,getDocumentElement:ly,getClippingRect:bie,getOffsetParent:Ly,getElementRects:Cie,getClientRects:mie,getDimensions:xie,getScale:ky,isElement:dy,isRTL:wie};function Ry(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eie(e,t,n){let r=null,i,a=ly(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=Gv(d),h=Gv(a.clientWidth-(u+f)),g=Gv(a.clientHeight-(d+p)),_=Gv(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Uv(0,Hv(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ry(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=cy(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Die(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=Oy(e),u=i||a?[...l?Ty(l):[],...t?Ty(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Eie(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?jy(e):null;c&&g();function g(){let t=jy(e);h&&!Ry(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 Oie=aie,kie=oie,Aie=nie,jie=(e,t,n)=>{let r=new Map,i=n??{},a={...Tie,...i.platform,_c:r};return tie(e,t,{...i,platform:a})},zy={note:`ℹ️`,info:`ℹ️`,tip:`💡`,warning:`⚠️`,danger:`❗`,error:`⛔`,caution:`⚠️`};function Mie(e){let{node:t,ctx:n,renderNode:r,indexKey:i,isDark:a}=e,o=String(t.kind||`note`),s=(0,I.useMemo)(()=>t.title&&String(t.title).trim().length?String(t.title):o.charAt(0).toUpperCase()+o.slice(1),[o,t.title]),[c,l]=(0,I.useState)(()=>{var e;return!!t.collapsible&&!((e=t.open)==null||e)}),u=(0,I.useMemo)(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[]);return(0,L.jsxs)(`div`,{className:`admonition admonition-${o}${a?` is-dark`:``}`,"data-index-key":i,children:[(0,L.jsxs)(`div`,{id:u,className:`admonition-header`,children:[zy[o]&&(0,L.jsx)(`span`,{className:`admonition-icon`,children:zy[o]}),(0,L.jsx)(`span`,{className:`admonition-title`,children:s}),t.collapsible&&(0,L.jsx)(`button`,{type:`button`,className:`admonition-toggle`,"aria-expanded":!c,"aria-controls":`${u}-content`,title:c?`Expand`:`Collapse`,onClick:()=>l(e=>!e),children:(0,L.jsx)(`span`,{children:c?`▶`:`▼`})})]}),!c&&(0,L.jsx)(`div`,{id:`${u}-content`,className:`admonition-content`,"aria-labelledby":u,children:n&&r?L_(t.children,n,String(i??u),r):null})]})}var By=(0,I.createContext)(!1),Vy=(0,I.createContext)(null);function Hy(){return(0,I.useContext)(Vy)}var Uy=(0,I.createContext)(null);function Wy(e,t){let n=typeof window<`u`&&typeof document<`u`,r=n?window.requestIdleCallback??(e=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),16)):null,i=n?window.cancelIdleCallback??(e=>window.clearTimeout(e)):null,a=null,o=null,s=new Map,c=new Set,l=null,u=()=>{if(!s.size){try{a?.disconnect()}catch{}a=null,o=null,c.size||(()=>{if(l!=null){try{i?.(l)}catch{}l=null}})()}},d=e=>{let t=s.get(e);if(t){t.state.current=!0;try{t.resolve()}catch{}try{a?.unobserve(e)}catch{}s.delete(e),c.delete(e),u()}},f=()=>{r&&l==null&&c.size&&(l=r(()=>{l=null;let e=c.values().next().value;e&&(c.delete(e),d(e),c.size&&f())},{timeout:1200}))};return(r,i)=>{let l={current:!1},p,m=!1,h=new Promise(e=>{p=()=>{m||(m=!0,e())}}),g=()=>{if(s.has(r)){s.delete(r);try{a?.unobserve(r)}catch{}}c.delete(r),u()};if(!n||!t())return l.current=!0,p(),{isVisible:()=>!0,whenVisible:h,destroy:g};let _=((t,r)=>{if(!n||typeof IntersectionObserver>`u`)return null;let i=((t,n)=>({root:e()??null,rootMargin:t,threshold:n}))(t,r);if(a&&(l=i,(c=o)&&c.root===l.root&&c.rootMargin===l.rootMargin&&c.threshold===l.threshold))return a;var c,l;if(a)try{a.disconnect()}catch{}a=new IntersectionObserver(e=>{for(let t of e)(t.isIntersecting||t.intersectionRatio>0)&&d(t.target)},{root:i.root,rootMargin:i.rootMargin,threshold:i.threshold}),o=i;for(let e of s.keys())a.observe(e);return a})(i?.rootMargin??`300px`,i?.threshold??0);return _?(s.set(r,{resolve:p,state:l}),_.observe(r),c.add(r),f(),{isVisible:()=>l.current,whenVisible:h,destroy:g}):(l.current=!0,p(),{isVisible:()=>!0,whenVisible:h,destroy:g})}}var Nie=Wy(()=>null,()=>!0);function Pie({getRoot:e,enabled:t=!0,children:n}){let r=(0,I.useRef)(t);r.current=t;let i=(0,I.useRef)(e);i.current=e;let a=(0,I.useMemo)(()=>Wy(()=>i.current?.call(i)??null,()=>r.current),[]);return(0,L.jsx)(Uy.Provider,{value:a,children:n})}function Gy(){return(0,I.useContext)(Uy)??Nie}function Fie(e={}){let t=(0,I.useRef)(null);t.current||=zre(e);let n=t.current,[r,i]=(0,I.useState)(()=>n.getSnapshot());return(0,I.useEffect)(()=>{let e=n.subscribe(()=>{i(n.getSnapshot())});return n.resume(),i(n.getSnapshot()),()=>{e(),n.pause()}},[n]),(0,I.useMemo)(()=>({...r,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,getSnapshot:n.getSnapshot}),[n,r])}function Iie(e){let{node:t}=e;return(0,L.jsx)(`span`,{className:`checkbox-node`,children:(0,L.jsx)(`input`,{type:`checkbox`,checked:!!t.checked,disabled:!0,className:`checkbox-input`,readOnly:!0})})}var Ky={"common.copy":`Copy`,"common.copied":`Copied`,"common.decrease":`Decrease`,"common.reset":`Reset`,"common.increase":`Increase`,"common.expand":`Expand`,"common.collapse":`Collapse`,"common.preview":`Preview`,"common.source":`Source`,"common.export":`Export`,"common.open":`Open`,"common.close":`Close`,"common.zoomIn":`Zoom in`,"common.zoomOut":`Zoom out`,"common.resetZoom":`Reset zoom`,"image.loadError":`Image failed to load`,"image.loading":`Loading image...`};function Lie(e){Object.assign(Ky,e)}function qy(){return{t:e=>Ky[e]??function(e){return(e.split(`.`).pop()||e).replace(/[_-]/g,` `).replace(/([A-Z])/g,` $1`).replace(/\s+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}var Jy=null,Yy=null,Xy=null,Zy=null,Qy=null,$y=null,eb=0;function tb(e,t){return!(t!==eb||e!==Yy||!e.isConnected&&(ib(!0,e),1))}async function nb(e,t,n){let r=Jy;if(!r||!tb(e,n))return!1;let{x:i,y:a}=await jie(e,r,{placement:t,middleware:[Oie(8),Aie(),kie({padding:8})],strategy:`fixed`});return!!tb(e,n)&&(r.style.transform=`translate3d(${Math.round(i)}px, ${Math.round(a)}px, 0)`,!0)}function rb(e,t,n=`top`,r=!1,i,a){if(!e?.isConnected||typeof document>`u`||(Jy||typeof document>`u`||(Jy=document.createElement(`div`),Jy.className=`markstream-react ms-tooltip`,Jy.setAttribute(`role`,`tooltip`),Jy.dataset.visible=`false`,Jy.style.position=`fixed`,Jy.style.left=`0px`,Jy.style.top=`0px`,Jy.style.transform=`translate3d(0,0,0)`,document.body.appendChild(Jy)),!Jy))return;ib(!0),Yy=e;let o=eb,s=async()=>{if(Jy&&tb(e,o)){Jy.textContent=t,Jy.dataset.placement=n,Jy.dataset.dark=function(e){if(typeof e==`boolean`)return e;if(typeof document<`u`)try{if(document.documentElement.classList.contains(`dark`))return!0}catch{}if(typeof window<`u`&&typeof window.matchMedia==`function`)try{return window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{}return!1}(a)?`true`:`false`,Jy.dataset.visible=`false`,$y=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Jy.id=$y;try{e.setAttribute(`aria-describedby`,$y)}catch{}await nb(e,n,o)&&tb(e,o)&&(Jy.dataset.visible=`true`,Xy=Die(e,Jy,()=>{nb(e,n,o)}))}};r?s():Zy=setTimeout(s,80)}function ib(e=!1,t){if(t!==void 0&&t!==Yy||(eb+=1,Zy&&=(clearTimeout(Zy),null),Qy&&=(clearTimeout(Qy),null),!Jy))return;let n=()=>{if(Jy){if(Jy.dataset.visible=`false`,Yy&&$y&&Yy.getAttribute(`aria-describedby`)===$y)try{Yy.removeAttribute(`aria-describedby`)}catch{}Yy=null,$y=null,Xy&&=(Xy(),null)}};e?n():Qy=setTimeout(n,120)}function Rie(e){let{t}=qy(),n=(0,I.useMemo)(()=>{let t=e.code||``,n=t.trim().toLowerCase();return n.startsWith(`<!doctype`)||n.startsWith(`<html`)||n.startsWith(`<body`)?t:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${e.isDark?`#020617`:`#ffffff`};\n color: ${e.isDark?`#e5e7eb`:`#020617`};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${t}\n </body>\n</html>`},[e.code,e.isDark]),r=(0,I.useMemo)(()=>{return t=e.htmlPreviewSandbox,n=e.htmlPreviewAllowScripts,typeof t==`string`?t:t===void 0&&!0===n?`allow-scripts`:``;var t,n},[e.htmlPreviewAllowScripts,e.htmlPreviewSandbox]);return(0,I.useEffect)(()=>{let t=t=>{var n;t.key!==`Escape`&&t.key!==`Esc`||(n=e.onClose)==null||n.call(e)};return typeof window<`u`&&window.addEventListener(`keydown`,t),()=>{typeof window<`u`&&window.removeEventListener(`keydown`,t)}},[e]),typeof document>`u`?null:(0,P_.createPortal)((0,L.jsx)(`div`,{className:`markstream-react html-preview-frame__backdrop`+(e.isDark?` html-preview-frame__backdrop--dark`:``),onClick:()=>e.onClose?.call(e),children:(0,L.jsxs)(`div`,{className:`html-preview-frame`+(e.isDark?` html-preview-frame--dark`:``),onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`html-preview-frame__header`,children:[(0,L.jsxs)(`div`,{className:`html-preview-frame__title`,children:[(0,L.jsx)(`span`,{className:`html-preview-frame__dot`}),(0,L.jsx)(`span`,{className:`html-preview-frame__label`,children:e.title||`HTML ${t(`common.preview`)}`})]}),(0,L.jsx)(`button`,{type:`button`,className:`html-preview-frame__close`+(e.isDark?` html-preview-frame__close--dark`:``),onClick:()=>e.onClose?.call(e),children:`×`})]}),(0,L.jsx)(`iframe`,{className:`html-preview-frame__iframe`,sandbox:r,referrerPolicy:`no-referrer`,src:`about:blank`,srcDoc:n,title:e.title||`Preview`})]})}),document.body)}var ab=!1,ob=null,sb=!1,cb=null;async function lb(){if(cb)return cb;if(ob)return ob;if(sb)return null;cb=(async()=>{try{let e=function(e){let t=typeof e?.createCodeBlockRuntime==`function`||typeof e?.useMonaco==`function`?e:e?.default,n=t?.createCodeBlockRuntime??t?.useMonaco;return typeof n==`function`?{createCodeBlockRuntime:e=>n.call(t,e),detectLanguage:(t?.detectLanguage)?.bind(t),preloadStreamDiffs:(t?.preloadStreamDiffs)?.bind(t)}:null}(await R(()=>import(`./markstream-CqyDsA7W.js`),[]));if(e)return await async function(e){ab||(ab=!0,e!=null&&e.preloadStreamDiffs&&await e.preloadStreamDiffs())}(e),ob=e,ob}catch{}return sb=!0,null})();try{return await cb}finally{cb=null}}var zie=typeof window<`u`?I.useLayoutEffect:I.useEffect,Bie={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showCollapseButton:!0,showFontSizeButtons:!0};async function ub(e,t){if(t)try{if(!await t())return!1}catch{return!1}if(typeof window>`u`||typeof window.requestAnimationFrame!=`function`)return!1;let n=()=>new Promise(e=>window.requestAnimationFrame(()=>e()));for(let t=0;t<30;t++){await n();let t=e.querySelector([`.stream-diffs-shell`,`[data-stream-diffs-state]`].join(`,`))??e.firstElementChild;if(!t)continue;let r=t.getBoundingClientRect();if(r.width>0&&r.height>0)return await n(),!0}return!1}function db(e,t){let n={...t||{}};for(let e of[`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`])delete n[e];if(!e)return{overflow:`wrap`,...n};let r=n.parseDiffOptions&&typeof n.parseDiffOptions==`object`?n.parseDiffOptions:{},i={overflow:`wrap`,diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,parseDiffOptions:{context:2}};return{...i,...n,parseDiffOptions:{...i.parseDiffOptions,...r}}}function fb(e){let t=String(e??``).match(/\d+(?:\.\d+)?/g);if(!t||t.length<3)return null;let[n,r,i]=t.slice(0,3).map(Number);return .2126*n+.7152*r+.0722*i}function pb(e){let t=String(e??``).trim().toLowerCase();if(!t||t===`transparent`)return!0;let n=t.match(/^#([0-9a-f]{8})$/);if(n)return Number.parseInt(n[1].slice(6),16)===0;let r=t.match(/^#([0-9a-f]{4})$/);if(r)return Number.parseInt(r[1][3]+r[1][3],16)===0;let i=(t.match(/^(?:rgba?|hsla?)\(([^)]+)\)/)?.[1])?.split(/[\s,/]+/).filter(Boolean);return i?.length===4&&Number(i[3])===0}function Vie(e){let t={...Bie,...e},{node:n,isDark:r,loading:i,stream:a,isShowPreview:o,enableFontSizeControl:s,darkTheme:c,lightTheme:l,codeBlockOptions:u,themes:d,minWidth:f,maxWidth:p,showHeader:m,showCopyButton:h,showExpandButton:g,showPreviewButton:_,showCollapseButton:v,showFontSizeButtons:y,showLineNumbers:b,showTooltips:x}=t,S=(0,I.useRef)(null),C=(0,I.useRef)(null),w=(0,I.useRef)(null),T=(0,I.useRef)(null),E=(0,I.useRef)(null),D=(0,I.useRef)(null),O=(0,I.useRef)(null),k=(0,I.useRef)(0),A=(0,I.useRef)(null),j=(0,I.useRef)(null),M=Gy(),N=(0,I.useRef)(null),ee=(0,I.useRef)(null),te=(0,I.useRef)(u),P=(0,I.useRef)(null),F=(0,I.useRef)([]),ne=(0,I.useRef)(null),re=(0,I.useRef)(!1),ie=(0,I.useRef)(void 0),[ae,oe]=(0,I.useState)(!1),[se,ce]=(0,I.useState)(()=>typeof window>`u`),[le,ue]=(0,I.useState)(!1),[de,fe]=(0,I.useState)(!1),[pe,me]=(0,I.useState)(!1),[he,ge]=(0,I.useState)(()=>n.language||`plaintext`),[_e,ve]=(0,I.useState)(()=>Q_(n.language)),[ye,be]=(0,I.useState)(!1),[xe,Se]=(0,I.useState)(!1),[Ce,we]=(0,I.useState)(!1),[Te,Ee]=(0,I.useState)(!1),[De,Oe]=(0,I.useState)(0),{t:ke}=qy();(0,I.useEffect)(()=>{re.current=xe},[xe]);let Ae=(0,I.useMemo)(()=>db(!!n.diff,u),[u,n.diff]),[je,Me]=(0,I.useState)(()=>{let e=Number(db(!!n.diff,u)?.fontSize);return Number.isFinite(e)&&e>0?e:12}),[Ne,Pe]=(0,I.useState)(je),Fe=(0,I.useMemo)(()=>!1!==x,[x]),Ie=typeof b==`boolean`?b:!0!==Ae.disableLineNumbers,Le=(0,I.useRef)(Ie),Re=Number(te.current?.fontSize),ze=Number(u?.fontSize),Be=te.current!==u&&Number.isFinite(Re)&&Re>0&&(!Number.isFinite(ze)||ze<=0),Ve=(0,I.useCallback)(()=>{let e=Ae.maxHeight??500;return typeof e==`number`&&Number.isFinite(e)?e:500},[Ae.maxHeight]);zie(()=>{let e=Number(Ae.fontSize),t=Number.isFinite(e)&&e>0?e:12;Me(t),Pe(t)},[Ae.fontSize]);let He=(0,I.useCallback)(e=>{var t;if(ae)return;let n=S.current,r=w.current;if(!n||!r)return;let i=D.current===`diff`?r.getDiffEditorView?.call(r):r.getEditorView?.call(r);if(!i)return;let a=Ve(),o=D.current===`diff`,s=o?`important`:``;e?(n.style.minHeight=`0px`,n.style.setProperty(`max-height`,`none`,s),n.style.overflow=`visible`):(n.style.minHeight=`0px`,n.style.setProperty(`max-height`,`${Math.ceil(a)}px`,s),n.style.overflow=o?`hidden`:`auto`);try{let r=Number((()=>{if(typeof i.getContentHeight==`function`)return i.getContentHeight();if(o&&typeof i.getModifiedEditor==`function`){let e=i.getModifiedEditor();if(e&&typeof e.getContentHeight==`function`)return e.getContentHeight()}})());if(Number.isFinite(r)&&r>0){let t=e?r:Math.min(r,a);n.style.setProperty(`height`,`${Math.ceil(Math.max(1,t))}px`,s)}(t=i.layout)==null||t.call(i)}catch{}},[Ve,ae]),Ue=(0,I.useCallback)(e=>{if(He(e),typeof window>`u`||typeof window.requestAnimationFrame!=`function`)return;let t=window.requestAnimationFrame(()=>{He(e),window.requestAnimationFrame(()=>He(e))});return window.setTimeout(()=>He(e),180),()=>window.cancelAnimationFrame(t)},[He]),We=(0,I.useCallback)(()=>{var e,t;for(let t of F.current)try{typeof t==`function`?t():(e=t?.dispose)==null||e.call(t)}catch{}F.current=[],(t=ne.current)==null||t.disconnect(),ne.current=null},[]),Ge=(0,I.useCallback)(()=>{We();let e=w.current,t=S.current;if(!e||!t||D.current!==`diff`)return;let n=()=>Ue(re.current),r=(e,t)=>{try{let r=e?.[t];if(typeof r!=`function`)return;let i=r.call(e,n);i&&F.current.push(i)}catch{}},i=e.getDiffEditorView?.call(e),a=(i?.getOriginalEditor)?.call(i),o=(i?.getModifiedEditor)?.call(i);if(r(i,`onDidUpdateDiff`),r(a,`onDidContentSizeChange`),r(o,`onDidContentSizeChange`),r(a,`onDidLayoutChange`),r(o,`onDidLayoutChange`),typeof window<`u`&&typeof window.MutationObserver==`function`){let e=new window.MutationObserver(e=>{e.some(e=>e.type===`childList`||e.type===`attributes`&&e.target!==t)&&n()});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`class`]}),ne.current=e}},[We,Ue]);(0,I.useEffect)(()=>Ore(()=>{Oe(e=>e+1)}),[]),(0,I.useEffect)(()=>{ve(Q_(n.language))},[n.language]);let Ke=(0,I.useRef)(n);Ke.current=n;let qe=(0,I.useCallback)(()=>{var e;k.current+=1;try{(e=T.current)==null||e.call(T)}catch{}We(),E.current=null,D.current=null,O.current=null,me(!1),fe(!1)},[We]),Je=(0,I.useMemo)(()=>r?c??d?.[0]??`vitesse-dark`:l??d?.[1]??`vitesse-light`,[c,r,l,d]),Ye=(0,I.useCallback)(()=>Je,[Je]),Xe=(0,I.useMemo)(()=>Ye(),[Ye]),Ze=(0,I.useMemo)(()=>function(e,t){let n=(function(e){return typeof e==`string`?e:null}(e)??``).toLowerCase();return n?[`dark`,`night`,`moon`,`black`,`dracula`,`mocha`,`frappe`,`macchiato`,`palenight`,`ocean`,`poimandres`,`monokai`,`laserwave`,`tokyo`,`slack-dark`,`rose-pine`,`github-dark`,`material-theme`,`one-dark`,`catppuccin-mocha`,`catppuccin-frappe`,`catppuccin-macchiato`].some(e=>n.includes(e))&&![`light`,`latte`,`dawn`,`lotus`].some(e=>n.includes(e)):t}(Xe,!!r),[r,Xe]),Qe=(0,I.useMemo)(()=>n.diff?r?`dark`:`light`:Ze?`dark`:`light`,[r,n.diff,Ze]),$e=(0,I.useMemo)(()=>n.diff?Qe===`dark`:Ze,[Qe,n.diff,Ze]),et=(0,I.useMemo)(()=>{let e=Ae,t=rv(Ae,Be?12:Ne),r=function(e){let t=typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0;return{top:t,bottom:t}}(e?.padding),i=n.diff?0:8,a=typeof e?.padding==`number`&&Number.isFinite(e.padding)&&e.padding>=0,o=nv(e?.tabSize)??4;return{...t,paddingBottom:a?r.bottom:i,paddingTop:a?r.top:i,tabSize:o}},[Be,Ne,n.diff,Ae]),tt=(0,I.useMemo)(()=>!!n.diff&&Ae.diffStyle===`unified`,[n.diff,Ae]),nt=(0,I.useMemo)(()=>{let e=String(n.diff?n.updatedCode??n.code??``:n.code??``);if(!e)return 1;let t=i?e:e.replace(/\r\n$|\n$|\r$/,``);return Math.max(1,t.split(/\r\n|\r|\n/).length)},[i,n.code,n.diff,n.updatedCode]),rt=(0,I.useMemo)(()=>Math.ceil(nt*et.lineHeight+et.paddingTop+et.paddingBottom),[nt,et]),it=(0,I.useMemo)(()=>{let e={"--markstream-code-padding-left":`62px`,"--markstream-pre-diff-line-height":`${et.lineHeight}px`,"--markstream-pre-line-number-top":`${et.paddingTop}px`,"--markstream-pre-line-number-width":`36px`,"--markstream-pre-line-number-gap":`0px`,fontSize:`${et.fontSize}px`,lineHeight:`${et.lineHeight}px`,maxHeight:`${Ve()}px`,overflow:`auto`,paddingBottom:`${et.paddingBottom}px`,paddingTop:`${et.paddingTop}px`,tabSize:et.tabSize,whiteSpace:Ae.overflow===`scroll`?`pre`:`pre-wrap`};return et.fontFamily&&(e.fontFamily=et.fontFamily),e},[Ve,et,Ae.overflow]),at=(0,I.useCallback)(()=>{let e=S.current,t=C.current;if(!e||!t)return;if(t.style.removeProperty(`--vscode-editor-foreground`),t.style.removeProperty(`--vscode-editor-background`),t.style.removeProperty(`--vscode-editor-selectionBackground`),e.style.setProperty(`--diffs-tab-size`,String(et.tabSize)),typeof Ae.padding==`number`&&Number.isFinite(Ae.padding)&&Ae.padding>=0?e.style.setProperty(`--diffs-gap-block`,`${et.paddingTop}px`):e.style.removeProperty(`--diffs-gap-block`),n.diff)return e.style.removeProperty(`--vscode-editor-foreground`),e.style.removeProperty(`--vscode-editor-background`),void e.style.removeProperty(`--vscode-editor-selectionBackground`);let r=e;try{let i=typeof window<`u`&&window.getComputedStyle?window.getComputedStyle(r):null,a=String(i?.getPropertyValue(`--vscode-editor-foreground`)??``).trim()||String(i?.color??``).trim(),o=String(i?.getPropertyValue(`--vscode-editor-background`)??``).trim(),s=String(i?.backgroundColor??``).trim(),c=pb(o)?pb(s)?``:s:o,l=String(i?.getPropertyValue(`--vscode-editor-selectionBackground`)??``).trim();if(function(e,t,n,r){if(!n)return!1;let i=fb(e),a=fb(t);return r?i!=null&&i>170||a!=null&&a<110:i!=null&&i<85||a!=null&&a>190}(c,a,$_(String(n.language||_e||he||`plaintext`))===`plaintext`,t.classList.contains(`is-dark`)))return e.style.removeProperty(`--vscode-editor-foreground`),e.style.removeProperty(`--vscode-editor-background`),void e.style.removeProperty(`--vscode-editor-selectionBackground`);a?e.style.setProperty(`--vscode-editor-foreground`,a):e.style.removeProperty(`--vscode-editor-foreground`),c?e.style.setProperty(`--vscode-editor-background`,c):e.style.removeProperty(`--vscode-editor-background`),l?e.style.setProperty(`--vscode-editor-selectionBackground`,l):e.style.removeProperty(`--vscode-editor-selectionBackground`)}catch{}},[_e,he,n.diff,n.language,et,Ae]),ot=(0,I.useCallback)(()=>{let e=Ae.maxHeight,t={...Ae||{},...e==null?{}:{MAX_HEIGHT:e},themes:d?[...d]:void 0,stream:!1,disableFileHeader:!0,disableLineNumbers:!Ie,fontSize:et.fontSize,lineHeight:et.lineHeight,...et.fontFamily?{fontFamily:et.fontFamily}:{},theme:Xe,themeType:r?`dark`:`light`,onThemeChange(){at()}};return delete t.maxHeight,delete t.padding,delete t.tabSize,t.unsafeCSS=[`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }`,typeof t.unsafeCSS==`string`?t.unsafeCSS:``].filter(Boolean).join(`
180
+ `),t},[Ie,r,et,Xe,Ae,at,d]),st=(0,I.useCallback)(()=>{let e=ot(),t=N.current;if(!t)return N.current=e,e;for(let n of Object.keys(t))n in e||delete t[n];return Object.assign(t,e),t},[ot]),ct=(0,I.useCallback)(e=>{let t=e(st());return w.current=t,T.current=typeof t.safeClean==`function`?()=>t.safeClean():typeof t.cleanupEditor==`function`?()=>t.cleanupEditor():null,t},[st]),lt=(0,I.useMemo)(()=>JSON.stringify({diffStyle:Ae.diffStyle,expandUnchanged:Ae.expandUnchanged,collapsedContextThreshold:Ae.collapsedContextThreshold,hunkSeparators:Ae.hunkSeparators,lineDiffType:Ae.lineDiffType,maxLineDiffLength:Ae.maxLineDiffLength,expansionLineCount:Ae.expansionLineCount,context:Ae.parseDiffOptions?.context}),[Ae]);(0,I.useEffect)(()=>{st()},[Ae,st]),(0,I.useEffect)(()=>()=>{var e,t,n;k.current+=1,(e=T.current)==null||e.call(T),We(),T.current=null,E.current=null,D.current=null,O.current=null,w.current=null,ee.current=null,A.current=null,(n=(t=j.current)?.destroy)==null||n.call(t),j.current=null},[We]),(0,I.useEffect)(()=>{var e,t;if(typeof window>`u`||se)return;let n=C.current;if(!n)return;(t=(e=j.current)?.destroy)==null||t.call(e);let r=M(n,{rootMargin:`400px`});return j.current=r,r.isVisible()&&ce(!0),r.whenVisible.then(()=>ce(!0)),()=>{r.destroy(),j.current===r&&(j.current=null)}},[M,se]),(0,I.useEffect)(()=>{let e=!0;return typeof window>`u`?()=>{e=!1}:w.current?(st(),()=>{e=!1}):((async()=>{try{let t=await lb();if(!e)return;if(!t)return void oe(!0);let n=t.createCodeBlockRuntime,r=t.detectLanguage;if(typeof r==`function`&&(A.current=r),typeof n!=`function`)return void oe(!0);ee.current=n,ct(n),ue(!0)}catch{e&&oe(!0)}})(),()=>{e=!1})},[ct,st]),(0,I.useEffect)(()=>{if(!n.language&&!_e&&A.current)try{let e=A.current(String(n.code??``));e&&ge(e)}catch{}},[_e,n.code,n.language]);let ut=(0,I.useMemo)(()=>String(n.language||_e||he||`plaintext`),[_e,he,n.language]),dt=(0,I.useMemo)(()=>Q_(ut),[ut]),ft=(0,I.useMemo)(()=>$_(dt),[dt]),pt=(0,I.useMemo)(()=>ft===`plaintext`,[ft]),mt=(0,I.useMemo)(()=>ev(dt),[dt,De]),ht=(0,I.useMemo)(()=>!!o&&(dt===`html`||dt===`svg`),[dt,o]),gt=(0,I.useMemo)(()=>{let e=dt;return e?tv[e]||e.charAt(0).toUpperCase()+e.slice(1):tv[``]||`Plain Text`},[dt]),_t=(0,I.useMemo)(()=>function(e,t,n){let r=function(e){let t=function(e){let t=String(e??``).split(/\r?\n/,1)[0]?.trim()??``;if(t.length<3)return``;let n=t[0];if(n!=="`"&&n!==`~`||t[1]!==n||t[2]!==n)return``;let r=3;for(;t[r]===n;)r+=1;return t.slice(r).trim()}(e);if(!t)return``;let n=t.split(/\s+/).filter(Boolean);if(!n.length)return``;let r=n[0]===`diff`?n.slice(1):n;for(let e of r){let t=e.includes(`:`)?e.slice(e.indexOf(`:`)+1):e;if(t&&/[./\\-]/.test(t))return t}return``}(e);return{title:r||t,caption:r?n?`Diff / ${t}`:t:``}}(String(n.raw??``),gt,!!n.diff),[gt,n.diff,n.raw]),vt=_t.title,yt=_t.caption,bt=(0,I.useMemo)(()=>n.diff?n.updatedCode??n.code??``:n.code??``,[n.code,n.diff,n.updatedCode]),xt=(0,I.useMemo)(()=>{let e=e=>{if(e!=null)return typeof e==`number`?`${e}px`:String(e)},t={},r=e(f),i=e(p);return r&&(t.minWidth=r),i&&(t.maxWidth=i),n.diff?(t.color=`var(--markstream-diff-shell-fg)`,t.borderColor=`var(--markstream-diff-shell-border)`):(t.color=`var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))`,t.backgroundColor=`var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))`,t.borderColor=`var(--markstream-code-border-color, var(--code-border))`),t},[p,f,n.diff]),St=(0,I.useMemo)(()=>n.code.length>0||(n.originalCode?.length??0)>0||(n.updatedCode?.length??0)>0,[n.code,n.originalCode,n.updatedCode]),Ct=!1===a&&i||!1!==a&&i&&!St;(0,I.useEffect)(()=>{if(ae||!le||!de||!se)return;let e=w.current;st();let t=()=>{var t;n.diff&&((t=e?.refreshDiffPresentation)==null||t.call(e)),at(),Ce||((typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>Ue(xe)):null)??Ue(xe))};e?.setTheme&&Xe?Promise.resolve(e.setTheme(Xe)).then(t).catch(()=>{}):t()},[Ce,de,Qe,xe,le,n.diff,Xe,Ue,at,st,ae,se]);let wt=(0,I.useCallback)(async()=>{if(ae||!se||Ce||Ct)return null;let e=w.current,t=S.current;if(!e||!t||!e.createEditor)return null;st();let n=Ke.current,r=n.diff?`diff`:`single`,i=O.current,a=r===`diff`?!!e.getDiffEditorView?.call(e):!!e.getEditorView?.call(e);if(D.current===r&&i===t&&a)return null;if(E.current)return E.current;k.current+=1;let o=k.current;fe(!0);let s=(async()=>{var r;try{(r=T.current)==null||r.call(T),D.current=null,O.current=null,me(!1);let i=ft;if(n.diff?typeof e.createDiffEditor==`function`?(D.current=`diff`,await e.createDiffEditor(t,String(n.originalCode??``),String(n.updatedCode??``),i)):(D.current=`single`,await e.createEditor(t,String(n.updatedCode??n.code??``),i)):(D.current=`single`,await e.createEditor(t,String(n.code??``),i)),O.current=t,k.current!==o)return;Ge(),at(),xe||Ce||Ue(!1);let a=await Promise.race([ub(t,e.whenVisualReady),new Promise(e=>{window.setTimeout(()=>e(!0),1500)})]);if(k.current!==o||!a)return;He(xe),me(!0)}catch{k.current===o&&(ie.current=ft,oe(!0))}})().finally(()=>{E.current===s&&(E.current=null)});return E.current=s,s},[He,Ge,Ce,xe,ft,Ue,Ct,at,st,ae,se]);(0,I.useEffect)(()=>{st();let e=te.current!==u;te.current=u;let t=Le.current!==Ie;Le.current=Ie;let r=P.current;if(P.current=lt,ae||!le)return;let i=!1;if(e||t){let e=ee.current;if(e){qe(),w.current=null,T.current=null;try{ct(e),i=!0}catch{oe(!0);return}}}let a=!!(n.diff&&r!==lt);if(!i&&!a||!se||!de&&!i||Ce||Ct)return;let o=!1;return(async()=>{if(i||qe(),!o)try{await wt()}catch{}})(),()=>{o=!0}},[Ce,u,de,Ie,wt,ct,le,lt,n.diff,qe,Ct,st,ae,se]),(0,I.useEffect)(()=>{if(ae){let e=ie.current;if(e===void 0||e===ft)return;ie.current=void 0,qe(),oe(!1);return}le&&se&&(Ce||Ct?qe():wt())},[Ce,wt,ft,le,qe,Ct,ae,se]),(0,I.useEffect)(()=>{if(ae||!le||!se||Ce||Ct)return;let e=w.current;if(!e)return;let t=String(n.code??``);(async()=>{let r=_e;if(!r&&A.current)try{r=Q_(A.current(t)),r&&ve(r)}catch{}let i=$_(r||dt);if(e.createEditor&&S.current){try{await Promise.resolve(wt())}catch{}let e=E.current;if(e)try{await e}catch{}}try{n.diff&&e.updateDiff?await Promise.resolve(e.updateDiff(String(n.originalCode??``),String(n.updatedCode??``),i)):e.updateCode&&await Promise.resolve(e.updateCode(t,i))}catch{}let a=S.current;a&&a.getAttribute(`data-markstream-enhanced`)!==`true`&&await ub(a,e.whenVisualReady)&&(He(xe),me(!0)),Ue(xe)})()},[He,dt,_e,Ce,de,wt,xe,le,n.code,n.diff,n.originalCode,n.updatedCode,Ue,Ct,ae,se]),(0,I.useEffect)(()=>{if(ae||!le||!se||Ce||Ct||!xe&&i)return;let e=typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>Ue(xe)):null;return e??Ue(xe),()=>{e!=null&&typeof window<`u`&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(e)}},[Ce,xe,i,le,Ue,Ct,ae,se]),(0,I.useEffect)(()=>{var e;if(!s||ae)return;let t=w.current;if(t){try{let n=D.current===`diff`?t.getDiffEditorView?.call(t):t.getEditorView?.call(t);(e=n?.updateOptions)==null||e.call(n,{fontSize:Ne})}catch{}Ue(xe)}},[s,xe,Ne,n.diff,Ue,ae]),(0,I.useEffect)(()=>{Fe||ib(!0)},[Fe]);let Tt=(0,I.useCallback)((e,t)=>{if(!Fe)return;let n=e.currentTarget;n&&!n.disabled&&(`clientX`in e&&(e.clientX,e.clientY),rb(n,t,`top`,!1,0,$e))},[$e,Fe]),Et=(0,I.useCallback)(()=>{Fe&&ib()},[Fe]),Dt=(0,I.useCallback)(async()=>{var e;let n=String(bt);try{t.clipboardWriter?await t.clipboardWriter(n):typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&await navigator.clipboard.writeText(n),be(!0),(e=t.onCopy)==null||e.call(t,n),setTimeout(()=>be(!1),1e3)}catch{}},[t,bt]),Ot=(0,I.useCallback)(()=>{if(!ht)return;let e=dt===`html`?`text/html`:`image/svg+xml`,r=dt===`html`?ke(`artifacts.htmlPreviewTitle`)||`HTML Preview`:ke(`artifacts.svgPreviewTitle`)||`SVG Preview`;typeof t.onPreviewCode==`function`?t.onPreviewCode({node:n,artifactType:e,artifactTitle:r,id:`temp-${dt}-${Date.now()}`}):dt===`html`&&Ee(e=>!e)},[dt,ht,n,t,ke]);return(0,L.jsxs)(`div`,{ref:C,className:[`code-block-container my-4 rounded-lg border overflow-hidden shadow-sm`,$e?`border-gray-700/30`:`border-gray-200`,i?`is-rendering`:``,$e?`is-dark`:``,n.diff?`is-diff`:``,pt?`is-plain-text`:``].join(` `),style:xt,children:[m&&(0,L.jsxs)(`div`,{className:`code-block-header`,children:[(0,L.jsxs)(`div`,{className:`code-header-main`,children:[(0,L.jsx)(`span`,{className:`icon-slot h-4 w-4 flex-shrink-0`,dangerouslySetInnerHTML:{__html:mt}}),(0,L.jsxs)(`div`,{className:`code-header-copy min-w-0`,children:[(0,L.jsx)(`div`,{className:`code-header-title truncate`,children:vt}),yt&&(0,L.jsx)(`div`,{className:`code-header-caption truncate`,children:yt})]})]}),(0,L.jsxs)(`div`,{className:`code-header-actions`,children:[v&&(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,"aria-pressed":Ce,onClick:()=>we(e=>!e),onMouseEnter:e=>Tt(e,Ce?ke(`common.expand`)||`Expand`:ke(`common.collapse`)||`Collapse`),onFocus:e=>Tt(e,Ce?ke(`common.expand`)||`Expand`:ke(`common.collapse`)||`Collapse`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{style:{rotate:Ce?`0deg`:`90deg`},xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m9 18l6-6l-6-6`})})}),y&&s&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,disabled:Ne<=10,onClick:()=>Pe(e=>Math.max(10,e-1)),onMouseEnter:e=>Tt(e,ke(`common.decrease`)||`Decrease`),onFocus:e=>Tt(e,ke(`common.decrease`)||`Decrease`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M5 12h14`})})}),(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,disabled:Ne===je,onClick:()=>Pe(je),onMouseEnter:e=>Tt(e,ke(`common.reset`)||`Reset`),onFocus:e=>Tt(e,ke(`common.reset`)||`Reset`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,L.jsx)(`path`,{d:`M3 3v5h5`})]})})}),(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,disabled:Ne>=36,onClick:()=>Pe(e=>Math.min(36,e+1)),onMouseEnter:e=>Tt(e,ke(`common.increase`)||`Increase`),onFocus:e=>Tt(e,ke(`common.increase`)||`Increase`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M5 12h14m-7-7v14`})})})]}),h&&(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,"aria-label":ye?ke(`common.copied`)||`Copied`:ke(`common.copy`)||`Copy`,onClick:Dt,onMouseEnter:e=>Tt(e,ye?ke(`common.copied`)||`Copied`:ke(`common.copy`)||`Copy`),onFocus:e=>Tt(e,ye?ke(`common.copied`)||`Copied`:ke(`common.copy`)||`Copy`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,ye?{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M20 6L9 17l-5-5`})}:{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})})}),g&&(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,"aria-pressed":xe,onClick:e=>{Se(e=>!e),Tt(e,xe?ke(`common.expand`)||`Expand`:ke(`common.collapse`)||`Collapse`)},onMouseEnter:e=>Tt(e,xe?ke(`common.collapse`)||`Collapse`:ke(`common.expand`)||`Expand`),onFocus:e=>Tt(e,xe?ke(`common.collapse`)||`Collapse`:ke(`common.expand`)||`Expand`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,xe?{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`})}:{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`action-icon`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`})})}),ht&&_&&(0,L.jsx)(`button`,{type:`button`,className:`code-action-btn transition-colors`,"aria-label":ke(`common.preview`)||`Preview`,onClick:Ot,onMouseEnter:e=>Tt(e,ke(`common.preview`)||`Preview`),onFocus:e=>Tt(e,ke(`common.preview`)||`Preview`),onMouseLeave:Et,onBlur:Et,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,children:(0,L.jsxs)(`g`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,children:[(0,L.jsx)(`path`,{d:`M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496`}),(0,L.jsx)(`path`,{d:`M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23`})]})})})]})]}),(0,L.jsxs)(`div`,{className:`code-block-body${Ce?` code-block-body--collapsed`:``}${xe?` code-block-body--expanded`:``}`,children:[!Ce&&(!!a||!i)&&(ae?(0,L.jsx)(fv,{className:`code-fallback-plain m-0`,diffInline:tt,node:n,showLineNumbers:Ie,style:it}):(0,L.jsxs)(`div`,{className:`code-editor-layer`,children:[(0,L.jsx)(`div`,{ref:S,className:`code-editor-container`+(a?``:` code-height-placeholder`),"data-markstream-enhanced":pe?`true`:`false`,"data-markstream-host-hidden":pe?void 0:`true`,style:{"--markstream-editor-initial-height":`${rt}px`,visibility:pe?`visible`:`hidden`},"aria-hidden":!pe}),!pe&&(0,L.jsx)(`div`,{className:`code-editor-fallback-surface`,children:(0,L.jsx)(fv,{className:`code-fallback-plain m-0`,diffInline:tt,node:n,showLineNumbers:Ie,style:it})})]})),!a&&i&&(0,L.jsx)(`div`,{className:`code-loading-placeholder`,children:(0,L.jsxs)(`div`,{className:`loading-skeleton`,children:[(0,L.jsx)(`div`,{className:`skeleton-line`}),(0,L.jsx)(`div`,{className:`skeleton-line`}),(0,L.jsx)(`div`,{className:`skeleton-line short`})]})})]}),Te&&!t.onPreviewCode&&ht&&dt===`html`&&(0,L.jsx)(Rie,{code:String(n.code??``),htmlPreviewAllowScripts:t.htmlPreviewAllowScripts,htmlPreviewSandbox:t.htmlPreviewSandbox,isDark:r,onClose:()=>Ee(!1)}),(0,L.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,role:`status`,children:ye?ke(`common.copied`)||`Copied`:``})]})}function mb(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=mb(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function hb(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=mb(e))&&(r&&(r+=` `),r+=t);return r}var gb=0,_b=()=>R(()=>import(`./d2_markstream-react-DtM9g53j.js`),[]),vb=null,Hie=_b;async function Uie(){if(vb)return vb;let e=Hie;if(!e)return null;let t;try{t=await e()}catch(t){throw e===_b?Error(`Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.`):t}return t?(vb=function(e){if(!e)return e;if(e.D2&&typeof e.D2==`function`)return e.D2;if(e.default&&e.default.D2&&typeof e.default.D2==`function`)return e.default.D2;let t=e.default??e;return typeof t==`function`?t:t?.D2&&typeof t.D2==`function`?t.D2:t}(t),vb):null}var Wie={loading:!0,progressiveRender:!0,progressiveIntervalMs:700,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showCollapseButton:!0},Gie={N1:`#E5E7EB`,N2:`#CBD5E1`,N3:`#94A3B8`,N4:`#64748B`,N5:`#475569`,N6:`#334155`,N7:`#0B1220`,B1:`#60A5FA`,B2:`#3B82F6`,B3:`#2563EB`,B4:`#1D4ED8`,B5:`#1E40AF`,B6:`#111827`,AA2:`#22D3EE`,AA4:`#0EA5E9`,AA5:`#0284C7`,AB4:`#FBBF24`,AB5:`#F59E0B`},Kie=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],qie=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Jie(e){if(!e)return``;let t=e.trim();return qie.test(t)?t:``}function yb(e){let t={...Wie,...e},{t:n}=qy(),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(null),[p,m]=(0,I.useState)(``),[h,g]=(0,I.useState)(null),[_,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(()=>typeof window>`u`),x=(0,I.useRef)(0),S=(0,I.useRef)(null),C=(0,I.useRef)(!1),w=(0,I.useRef)(!1),T=(0,I.useRef)(0),E=(0,I.useRef)(null),D=(0,I.useRef)(!1),O=(0,I.useRef)(null),k=(0,I.useRef)(null),A=(0,I.useRef)(null),j=(0,I.useRef)(null),M=(0,I.useRef)(!1),N=(0,I.useRef)(()=>{}),ee=Gy(),te=t.node?.code??``,P=s||!l||!p,F=!!p,ne=(0,I.useMemo)(()=>{if(!t.maxHeight)return;let e=typeof t.maxHeight==`number`?`${t.maxHeight}px`:String(t.maxHeight);return{maxHeight:e,"--ms-d2-render-max-height":e}},[t.maxHeight]),re=(0,I.useMemo)(()=>{if(P&&h)return{minHeight:`${h}px`}},[h,P]);(0,I.useEffect)(()=>{M.current=_},[_]),(0,I.useEffect)(()=>{let e=O.current;if(!e)return;let t=ee(e,{rootMargin:`160px`});return k.current=t,t.isVisible()&&b(!0),t.whenVisible.then(()=>b(!0)),()=>{t.destroy(),k.current=null}},[ee]);let ie=(0,I.useCallback)(()=>{let e=A.current;if(!e)return;let t=e.getBoundingClientRect().height;t>0&&g(e=>e===t?e:t)},[]),ae=(0,I.useCallback)((e=!1)=>{if(C.current||typeof window>`u`||w.current||!y)return;if(M.current)return void(D.current=!0);let n=Math.max(120,Number(t.progressiveIntervalMs)||0),r=Date.now()-T.current;if(!e&&r<n)return D.current=!0,void(E.current==null&&(E.current=window.setTimeout(()=>{E.current=null,D.current&&(D.current=!1,ae(!0))},Math.max(0,n-r))));C.current=!0;let i=()=>{C.current=!1,T.current=Date.now(),N.current()};typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(i):setTimeout(i,0)},[t.progressiveIntervalMs,y]),oe=(0,I.useCallback)(async()=>{if(S.current)return S.current;let e=await Uie();if(!e)return null;if(typeof e==`function`){let t=new e;return t&&typeof t.compile==`function`?S.current=t:typeof e.compile==`function`&&(S.current=e),S.current}return e?.D2&&typeof e.D2==`function`?(S.current=new e.D2,S.current):(typeof e.compile==`function`&&(S.current=e),S.current)},[]),se=(0,I.useCallback)(async()=>{if(typeof window>`u`||w.current||!y||t.loading&&!t.progressiveRender)return;if(!te)return m(``),void f(null);let e=++x.current;v(!0),f(null);try{let n=await oe();if(!n)return u(!1),c(!0),m(``),void f(`D2 is not available.`);if(typeof n.compile!=`function`||typeof n.render!=`function`)throw Error(`D2 instance is missing compile/render methods.`);u(!0);let r=await n.compile(te);if(e!==x.current)return;let i=r?.diagram??r,a=r?.renderOptions??r?.options??{},o=t.themeId??a.themeID,s=t.darkThemeId??a.darkThemeID,l={...a};if(l.themeID=t.isDark&&s!=null?s:o,l.darkThemeID=null,l.darkThemeOverrides=null,t.isDark){let e=a.themeOverrides&&typeof a.themeOverrides==`object`?a.themeOverrides:null;l.themeOverrides={...Gie,...e||{}}}l.salt=l.salt??function(e=`markstream-react-d2`){return gb+=1,`${e}-${gb}`}();let d=await n.render(i,l);if(e!==x.current)return;let p=function(e){return e?typeof e==`string`?e:typeof e.svg==`string`?e.svg:typeof e.data==`string`?e.data:``:``}(d);if(!p)throw Error(`D2 render returned empty output.`);let h=function(e){if(typeof window>`u`||typeof DOMParser>`u`||!e)return``;let t=e.replace(/["']\s*javascript:/gi,`#`).replace(/\bjavascript:/gi,`#`).replace(/["']\s*vbscript:/gi,`#`).replace(/\bvbscript:/gi,`#`).replace(/\bdata:text\/html/gi,`#`),n=new DOMParser().parseFromString(t,`image/svg+xml`).documentElement;if(!n||n.nodeName.toLowerCase()!==`svg`)return``;let r=n;return function(e){let t=new Set([`script`]),n=[e,...Array.from(e.querySelectorAll(`*`))];for(let e of n){if(t.has(e.tagName.toLowerCase())){e.remove();continue}let n=Array.from(e.attributes);for(let t of n){let n=t.name;if(/^on/i.test(n))e.removeAttribute(n);else{if(n===`style`&&t.value){let r=t.value;if(Kie.some(e=>e.test(r))){e.removeAttribute(n);continue}}if((n===`href`||n===`xlink:href`)&&t.value){let r=Jie(t.value);if(!r){e.removeAttribute(n);continue}r!==t.value&&e.setAttribute(n,r)}}}}}(r),r.classList.add(`markstream-d2-root-svg`),r.outerHTML}(p);m(h||``),t.loading&&c(!1),f(null)}catch(n){if(e!==x.current)return;let r=n?.message?String(n.message):`D2 render failed.`;t.loading||f(r),r.includes(`@terrastruct/d2`)&&(u(!1),c(!0))}finally{e===x.current&&(v(!1),D.current&&(D.current=!1,ae()))}},[te,oe,t.darkThemeId,t.isDark,t.loading,t.progressiveRender,t.themeId,ae,y]);(0,I.useEffect)(()=>{N.current=se},[se]);let ce=(0,I.useCallback)(async()=>{var e;try{(e=navigator==null?void 0:navigator.clipboard)!=null&&e.writeText&&await navigator.clipboard.writeText(te),i(!0),setTimeout(()=>i(!1),1e3)}catch{}},[te]),le=(0,I.useCallback)(()=>{if(p)try{let e=new Blob([p],{type:`image/svg+xml;charset=utf-8`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}catch(e){console.error(`Failed to export SVG:`,e)}},[p]),ue=(0,I.useCallback)((e,n)=>{var r;(r=e.currentTarget)&&!r.disabled&&rb(e.currentTarget,n,`top`,!1,(e.clientX,e.clientY),t.isDark)},[t.isDark]),de=(0,I.useCallback)(()=>{ib()},[]);return(0,I.useEffect)(()=>{ae()},[te,t.loading,t.isDark,ae]),(0,I.useEffect)(()=>{t.loading||ae(!0)},[t.loading,ae]),(0,I.useEffect)(()=>{let e=requestAnimationFrame(()=>ie());return()=>cancelAnimationFrame(e)},[P,p,te,ie]),(0,I.useEffect)(()=>{w.current=!1,ae();let e=requestAnimationFrame(()=>ie());if(typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>{ie()});j.current=e,A.current&&e.observe(A.current)}return()=>{var t;w.current=!0,E.current!=null&&(clearTimeout(E.current),E.current=null),(t=j.current)==null||t.disconnect(),j.current=null,cancelAnimationFrame(e)}},[ae,ie]),(0,L.jsxs)(`div`,{ref:O,className:hb(`d2-block my-4 rounded-lg border overflow-hidden shadow-sm`,t.isDark?`border-gray-700/30 bg-gray-900 text-gray-100`:`border-gray-200 bg-white text-gray-900`),children:[t.showHeader&&(0,L.jsxs)(`div`,{className:`d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5`,style:{color:`var(--vscode-editor-foreground)`,backgroundColor:`var(--vscode-editor-background)`},children:[(0,L.jsx)(`div`,{className:`flex items-center gap-x-2`,children:(0,L.jsx)(`span`,{className:`text-sm font-medium font-mono`,children:`D2`})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-x-2`,children:[t.showModeToggle&&(0,L.jsxs)(`div`,{className:hb(`flex items-center gap-x-1 rounded-md p-0.5`,t.isDark?`bg-gray-700`:`bg-gray-100`),children:[(0,L.jsx)(`button`,{type:`button`,className:hb(`mode-btn px-2 py-1 text-xs rounded`,!s&&`is-active`),onClick:()=>c(!1),onMouseEnter:e=>ue(e,n(`common.preview`)||`Preview`),onFocus:e=>ue(e,n(`common.preview`)||`Preview`),onMouseLeave:de,onBlur:de,children:n(`common.preview`)||`Preview`}),(0,L.jsx)(`button`,{type:`button`,className:hb(`mode-btn px-2 py-1 text-xs rounded`,s&&`is-active`),onClick:()=>c(!0),onMouseEnter:e=>ue(e,n(`common.source`)||`Source`),onFocus:e=>ue(e,n(`common.source`)||`Source`),onMouseLeave:de,onBlur:de,children:n(`common.source`)||`Source`})]}),t.showCopyButton&&(0,L.jsx)(`button`,{type:`button`,className:`d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]`,"aria-label":r?n(`common.copied`)||`Copied`:n(`common.copy`)||`Copy`,onClick:ce,onMouseEnter:e=>ue(e,r?n(`common.copied`)||`Copied`:n(`common.copy`)||`Copy`),onFocus:e=>ue(e,r?n(`common.copied`)||`Copied`:n(`common.copy`)||`Copy`),onMouseLeave:de,onBlur:de,children:(0,L.jsx)(`svg`,r?{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M20 6L9 17l-5-5`})}:{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})})}),t.showExportButton&&p&&(0,L.jsx)(`button`,{type:`button`,className:`d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]`,"aria-label":n(`common.export`)||`Export`,onClick:le,onMouseEnter:e=>ue(e,n(`common.export`)||`Export`),onFocus:e=>ue(e,n(`common.export`)||`Export`),onMouseLeave:de,onBlur:de,children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4`})})}),t.showCollapseButton&&(0,L.jsx)(`button`,{type:`button`,className:`d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]`,"aria-pressed":a,onClick:()=>o(e=>!e),onMouseEnter:e=>ue(e,a?n(`common.expand`)||`Expand`:n(`common.collapse`)||`Collapse`),onFocus:e=>ue(e,a?n(`common.expand`)||`Expand`:n(`common.collapse`)||`Collapse`),onMouseLeave:de,onBlur:de,children:(0,L.jsx)(`svg`,{style:{transform:`rotate(${a?0:90}deg)`},xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m9 18l6-6l-6-6`})})})]})]}),!a&&(0,L.jsx)(`div`,{ref:A,className:`d2-block-body`,style:re,children:t.loading&&!F?(0,L.jsxs)(`div`,{className:`d2-source px-4 py-4`,children:[(0,L.jsx)(`pre`,{className:`d2-code`,children:(0,L.jsx)(`code`,{children:te})}),d&&(0,L.jsx)(`p`,{className:`d2-error mt-2 text-xs`,children:d})]}):(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,P?{className:`d2-source px-4 py-4`,children:[(0,L.jsx)(`pre`,{className:`d2-code`,children:(0,L.jsx)(`code`,{children:te})}),d&&(0,L.jsx)(`p`,{className:`d2-error mt-2 text-xs`,children:d})]}:{className:`d2-render`,style:ne,children:[(0,L.jsx)(`div`,{className:`d2-svg`,dangerouslySetInnerHTML:{__html:p}}),d&&(0,L.jsx)(`p`,{className:`d2-error px-4 pb-3 text-xs`,children:d})]})})})]})}function bb(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e,a=Array.isArray(t.items)?t.items:[];return(0,L.jsx)(`dl`,{className:`definition-list`,"data-index-key":i,children:a.map((e,t)=>(0,L.jsxs)(`div`,{className:`mb-4`,children:[(0,L.jsx)(`dt`,{className:`definition-term font-semibold`,children:n&&r?R_(e.term,n,`${String(i??`definition`)}-term-${t}`,r):null}),(0,L.jsx)(`dd`,{className:`definition-desc ml-4`,children:n&&r?R_(e.definition,n,`${String(i??`definition`)}-desc-${t}`,r):null})]},`${String(i??`definition`)}-${t}`))})}function xb(e){let{node:t}=e;return(0,L.jsx)(`span`,{className:`emoji-node`,children:t.name??t.markup})}function Sb(e){return(0,L.jsx)(`em`,{className:`emphasis-node`,children:e.children})}var Cb=`.markdown-renderer`;function wb(e,t){if(typeof document>`u`||typeof Element>`u`)return null;let n=function(e){return`[id="${e.replace(/["\\]/g,`\\$&`)}"]`}(t),r=e instanceof Element?e.closest(Cb):null;for(;r;){let e=r.querySelector(n);if(e)return e;r=r.parentElement?.closest(Cb)??null}return document.querySelector(n)}function Tb(e){let{node:t}=e,n=(0,I.useCallback)(e=>{if(e.preventDefault(),typeof document>`u`)return;let n=wb(e.currentTarget,`fnref-${String(t.id??``)}`);n&&n.scrollIntoView({behavior:`smooth`})},[t.id]);return(0,L.jsx)(`a`,{className:`footnote-anchor text-sm hover:underline cursor-pointer`,href:`#fnref-${t.id}`,title:`返回引用 ${t.id}`,onClick:n,children:`↩︎`})}function Eb(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e;return(0,L.jsx)(`div`,{id:`fnref--${t.id}`,className:`footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2`,children:(0,L.jsx)(`div`,{className:`flex-1`,children:n&&r?L_(t.children,n,String(i??`footnote-${t.id}`),r):null})})}function Db(e){let{node:t}=e,n=(0,I.useMemo)(()=>`#fnref--${t.id}`,[t.id]),r=(0,I.useMemo)(()=>({href:n}),[n]),i=(0,I.useCallback)(e=>{if(e.preventDefault(),typeof document>`u`)return;let n=wb(e.currentTarget,`fnref--${t.id}`);n&&n.scrollIntoView({behavior:`smooth`})},[t.id]);return(0,L.jsx)(`sup`,{id:`fnref-${t.id}`,className:`footnote-reference`,onClick:i,children:(0,L.jsxs)(`span`,{...r,title:`查看脚注 ${t.id}`,className:`footnote-link cursor-pointer`,children:[`[`,t.id,`]`]})})}function Ob(e){return(0,L.jsx)(`br`,{className:`hard-break`})}function kb(e){let{node:t,ctx:n,renderNode:r,indexKey:i,children:a}=e,o=Math.min(6,Math.max(1,Number(t.level)||1)),s=`h${o}`,{class:c,className:l,style:u,...d}=t?.attrs??{};return(0,L.jsx)(s,{dir:`auto`,className:hb(`heading-node font-semibold`,`heading-${o}`,c,l),...typeof u==`object`&&u?{style:u}:{},...d,children:a??(n&&r?L_(t.children,n,String(i??`heading-${o}`),r):null)})}function Ab(e){return(0,L.jsx)(`mark`,{className:`highlight-node`,children:e.children})}function jb(e){let{node:t,placeholder:n,customId:r}=e,i=e.htmlPolicy??e.ctx?.htmlPolicy??`safe`,a=Gy(),[o,s]=(0,I.useState)(null),c=(0,I.useRef)(null),[l,u]=(0,I.useState)(()=>typeof window>`u`),[d,f]=(0,I.useState)(t.content),p=!!t.loading,m=(0,I.useSyncExternalStore)(U_,W_,W_),h=(0,I.useMemo)(()=>({...e.customComponents??e.ctx?.customComponents??G_(r),...e.ctx?.htmlComponents??{}}),[r,e.ctx?.customComponents,e.ctx?.htmlComponents,e.customComponents,m]),g=(0,I.useMemo)(()=>({...h,...e.ctx?.streamingComponents??{}}),[h,e.ctx?.streamingComponents]);(0,I.useEffect)(()=>{var e;if(typeof window>`u`)return void u(!0);if((e=c.current)==null||e.destroy(),c.current=null,!p)return u(!0),void f(t.content);if(!o)return void u(!1);let n=a(o,{rootMargin:`400px`});return c.current=n,n.isVisible()&&u(!0),n.whenVisible.then(()=>u(!0)).catch(()=>{}),()=>{n.destroy(),c.current=null}},[o,p,t.content,a]),(0,I.useEffect)(()=>()=>{var e;(e=c.current)==null||e.destroy(),c.current=null},[]),(0,I.useEffect)(()=>{p&&!l||f(t.content)},[p,t.content,l]);let _=(0,I.useMemo)(()=>{let e=I_(m_(t.attrs??void 0,i));return e?mv(e):void 0},[i,t.attrs]),v=(0,I.useMemo)(()=>String(t.tag??``).trim(),[t.tag]),y=(0,I.useMemo)(()=>Nl(v),[v]),b=(0,I.useMemo)(()=>{let e=I_(m_(t.attrs??void 0,i,v));return e?mv(e):void 0},[i,t.attrs,v]),x=(0,I.useMemo)(()=>h_(p_(m_(t.attrs??void 0,i,y))),[i,t.attrs,y]),S=(0,I.useMemo)(()=>Array.isArray(t.children)?t.children:[],[t.children]),C=S.length>0&&!!v&&!sl.has(v.toLowerCase())&&!r_(v,i)&&!!e.ctx&&!!e.renderNode,w=(0,I.useMemo)(()=>function(e){let t={...e||{}},n=typeof t.className==`string`?t.className.trim():``;return t.className=n?`html-block-node ${n}`:`html-block-node`,t}(b),[b]),T=(0,I.useMemo)(()=>i!==`escape`&&vv(t.content??``,g),[g,i,t.content]),E=(0,I.useMemo)(()=>T&&t.content?Are(t.content,h,i,{ctx:e.ctx,keyPrefix:String(e.indexKey??`html-block`),nodeComponents:e.ctx?.streamingComponents,propComponents:e.ctx?.htmlComponents,renderNode:e.renderNode,sourceNode:t}):null,[h,i,t.autoClosed,t.content,t.loading,e.ctx,e.indexKey,e.renderNode,T]),D=(0,I.useMemo)(()=>v_(d??``,i),[i,d]),O=(0,I.useMemo)(()=>C&&e.ctx&&e.renderNode?L_(S,e.ctx,`${String(e.indexKey??`html-block`)}-structured`,e.renderNode):null,[C,e.ctx,e.indexKey,e.renderNode,S]),k=y?e.ctx?.htmlComponents?.[y]:void 0,A=(0,L.jsx)(`div`,{className:`html-block-node__placeholder`,children:n??(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`html-block-node__placeholder-bar`}),(0,L.jsx)(`span`,{className:`html-block-node__placeholder-bar w-4/5`}),(0,L.jsx)(`span`,{className:`html-block-node__placeholder-bar w-2/3`})]})});return C&&k?I.createElement(k,x,O):C?I.createElement(v,{...w,ref:s},l?O:A):(0,L.jsx)(`div`,{ref:s,className:`html-block-node`,..._,children:l?T&&E?(0,L.jsx)(L.Fragment,{children:E}):(0,L.jsx)(`div`,{dangerouslySetInnerHTML:{__html:D}}):A})}var Mb=(()=>{try{return!1}catch{}return!1})();function Nb(e){Mb&&console.warn(e)}function Pb(e,t,n=!1){let r=Object.entries(t??{}),i=r.length>0?r.map(([e,t])=>t===``?` ${e}`:` ${e}="${t}"`).join(``):``;return n?`<${e}${i} />`:`<${e}${i}>`}function Fb(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function Ib(e,t){for(let n of hv(e)){if(n.type!==`tag_open`&&n.type!==`self_closing`)continue;let e=n.tagName??``;if(_v(e,t)&&K_(t[e]||t[e.toLowerCase()])===`block`)return!0}return!1}function Lb(e,t){return t.nodeComponents?.[e]||t.nodeComponents?.[e.toLowerCase()]}function Rb(e){if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(Rb).join(``);if(!I.isValidElement(e))return``;let t=e;if(typeof t.type!=`string`)return Rb(t.props.children);let n=Object.entries(t.props).filter(([e,t])=>e!==`children`&&e!==`key`&&e!==`ref`&&t!=null&&typeof t!=`boolean`).map(([e,t])=>` ${e===`className`?`class`:e}="${String(t)}"`).join(``);return`<${t.type}${n}>${Rb(t.props.children)}</${t.type}>`}function zb(e){return Object.entries(e).map(([e,t])=>[e,t===``?null:t])}function Bb(e){let t=e.sourceNode,n=!0!==e.ctx?.final&&(!1===e.ctx?.final||!!t?.loading);return{loading:n,autoClosed:n||!!t?.autoClosed}}function Vb(e,t,n,r,i,a,o,s,c,l){let u=_v(e,r),d=!!Lb(e,o);if(ol.has(e.toLowerCase())||!u&&!d&&i_(e,a))return null;if(!u&&!d&&r_(e,a))return[Pb(e,t),...n,`</${e}>`];let f=gv(t,a,e),p=f.key,m=p!=null&&p!==``?p:i;if(d)return function(e,t,n,r,i,a,o,s=Bb(i)){let c=Nl(e),l=a??function(e){return e.map(Rb).join(``)}(n),u={type:c,tag:c,attrs:zb(t),content:l,raw:o??`${Pb(e,t)}${l}</${e}>`,loading:s.loading,autoClosed:s.autoClosed};if(i.ctx&&i.renderNode)return i.renderNode(u,r,i.ctx);let d=Lb(e,i);return d?I.createElement(d,{key:r,node:u}):null}(e,t,n,String(m),o,s,c,l);if(u){let t=r[e]||r[e.toLowerCase()],i=h_(f);return I.createElement(t,{...i,key:m},...n)}return I.createElement(e,{...mv(f),key:m},...n)}function Hb(e){let{node:t,customId:n}=e,r=e.htmlPolicy??e.ctx?.htmlPolicy??`safe`,i=(0,I.useRef)(null),[a,o]=(0,I.useState)(!1);(0,I.useEffect)(()=>{o(!0)},[]);let s=I.useMemo(()=>({...e.ctx?.customComponents??G_(n),...e.ctx?.htmlComponents??{}}),[n,e.ctx?.customComponents,e.ctx?.htmlComponents]),c=I.useMemo(()=>({...s,...e.ctx?.streamingComponents??{}}),[s,e.ctx?.streamingComponents]),l=I.useMemo(()=>v_(t.content??``,r),[r,t.content]),u=I.useMemo(()=>String(t.tag??``).trim(),[t.tag]),d=I.useMemo(()=>Nl(u),[u]),f=I.useMemo(()=>Array.isArray(t.children)?t.children:[],[t.children]),p=I.useMemo(()=>h_(p_(m_(t.attrs??void 0,r,d))),[r,t.attrs,d]),m=d?e.ctx?.htmlComponents?.[d]:void 0,h=f.length>0&&!!u&&r!==`escape`&&!r_(u,r)&&!!e.ctx&&!!e.renderNode&&!!m,g=I.useMemo(()=>h&&e.ctx&&e.renderNode?L_(f,e.ctx,`${String(e.indexKey??`html-inline`)}-structured`,e.renderNode):null,[h,e.ctx,e.indexKey,e.renderNode,f]),_=I.useMemo(()=>{let n=t.content;if(!n)return{mode:`html`,content:``};if(r===`escape`||!vv(n,c))return{mode:`html`,content:n};let i=function(e,t,n=`safe`,r={}){if(!e)return[];try{return function(e,t,n=`safe`,r={}){let i=0,a=r.keyPrefix??`ms-html`,o=[],s=[];for(let c of e)if(c.type===`text`){if(o.length>0&&o[o.length-1].hardBlocked)continue;(o.length>0?o[o.length-1].children:s).push(c.content),o.length>0&&o[o.length-1].sourceParts.push(c.content)}else if(c.type===`self_closing`){let e=c.attrs||{},l=Pb(c.tagName,e,!0),u=_v(c.tagName,t),d=!!Lb(c.tagName,r);if(ol.has(c.tagName.toLowerCase())||!u&&!d&&i_(c.tagName,n))continue;if(!u&&!d&&r_(c.tagName,n)){(o.length>0?o[o.length-1].children:s).push(l),o.length>0&&o[o.length-1].sourceParts.push(l);continue}let f=Vb(c.tagName,e,[],t,`${a}-${i++}`,n,r,``,l,{loading:!1,autoClosed:!1});Fb(o.length>0?o[o.length-1].children:s,f),o.length>0&&o[o.length-1].sourceParts.push(l)}else if(c.type===`tag_open`){let e=o.length>0&&o[o.length-1].hardBlocked,i=_v(c.tagName,t),a=!!Lb(c.tagName,r);o.push({tagName:c.tagName,children:[],attrs:c.attrs,sourceParts:[],customComponent:i||a,hardBlocked:e||ol.has(c.tagName.toLowerCase())||!i&&!a&&i_(c.tagName,n),softBlocked:!e&&!i&&!a&&r_(c.tagName,n)})}else if(c.type===`tag_close`){let e=c.tagName.toLowerCase(),l=-1;for(let t=o.length-1;t>=0;t--)if(o[t].tagName.toLowerCase()===e){l=t;break}if(l!==-1)for(;o.length>l;){let c=o.pop(),u=c.sourceParts.join(``),d=`${Pb(c.tagName,c.attrs||{})}${u}</${c.tagName}>`,f;if(c.hardBlocked)f=null;else if(c.softBlocked)f=[Pb(c.tagName,c.attrs||{}),...c.children,`</${c.tagName}>`];else{let o=c.tagName.toLowerCase()===e?{loading:!1,autoClosed:!1}:Bb(r);f=Vb(c.tagName,c.attrs||{},c.children,t,`${a}-${i++}`,n,r,u,d,o)}o.length>0?Fb(o[o.length-1].children,f):Fb(s,f),o.length>0&&!c.hardBlocked&&o[o.length-1].sourceParts.push(d),c.tagName.toLowerCase()!==e&&o.length>l&&Nb(`Auto-closing unclosed tag: <${c.tagName}>`)}else Nb(`Ignoring closing tag with no matching opening tag: </${c.tagName}>`)}for(;o.length>0;){let e=o.pop(),c=e.sourceParts.join(``),l=`${Pb(e.tagName,e.attrs||{})}${c}`,u;u=e.hardBlocked?null:e.softBlocked?[Pb(e.tagName,e.attrs||{}),...e.children,`</${e.tagName}>`]:Vb(e.tagName,e.attrs||{},e.children,t,`${a}-${i++}`,n,r,c,l,Bb(r)),Fb(s,u),o.length>0&&!e.hardBlocked&&o[o.length-1].sourceParts.push(l),Nb(`Auto-closing unclosed tag: <${e.tagName}>`)}return s}(hv(e),t,n,r)}catch(e){return i=e,Mb&&console.error(`Failed to parse HTML to React nodes:`,i),null}var i}(n,s,r,{ctx:e.ctx,keyPrefix:String(e.indexKey??`html-inline`),nodeComponents:e.ctx?.streamingComponents,renderNode:e.renderNode,sourceNode:t});return i===null?{mode:`html`,content:n}:{mode:`dynamic`,block:Ib(n,c),nodes:i}},[s,c,r,t.autoClosed,t.content,t.loading,e.ctx,e.indexKey,e.renderNode]);return(0,I.useEffect)(()=>{if(!a||!i.current||_.mode!==`html`)return;let e=i.current;e.innerHTML=``;let t=document.createElement(`template`);t.innerHTML=l,e.appendChild(t.content.cloneNode(!0))},[_.mode,a,l]),!t.loading||t.autoClosed||h||_.mode===`dynamic`?h?I.createElement(m,p,g):_.mode===`dynamic`?_.block?(0,L.jsx)(L.Fragment,{children:_.nodes}):(0,L.jsx)(`span`,{className:`html-inline-node`,style:{display:`inline`},children:_.nodes}):(0,L.jsx)(`span`,{ref:i,className:`html-inline-node`,style:{display:`inline`}}):(0,L.jsx)(`span`,{className:`html-inline-node html-inline-node--loading`,children:t.content})}var Ub={fallbackSrc:``,lazy:!0,usePlaceholder:!0};function Wb(e,t,n){return n||e?{src:e,stage:`primary`}:t?{src:t,stage:`fallback`}:{src:``,stage:`failed`}}function Gb(e){let t={...Ub,...e},n=Cl(t.node.src),r=Cl(t.fallbackSrc),i=Wb(n,r,t.node.loading),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(i.src),[d,f]=(0,I.useState)(i.stage),p=l;return(0,I.useEffect)(()=>{let e=Wb(n,r,t.node.loading);u(e.src),f(e.stage),o(!1),c(e.stage===`failed`)},[n,r,t.node.loading]),!t.node.loading&&d!==`failed`&&p?(0,L.jsx)(`img`,{src:p,alt:String(t.node.alt??t.node.title??``),title:String(t.node.title??t.node.alt??``),className:`image-node__img`+(a?` is-loaded`:``),loading:t.lazy?`lazy`:`eager`,decoding:`async`,tabIndex:a?0:-1,"aria-label":t.node.alt??`Preview image`,onError:()=>{var e;if(d===`primary`&&r&&r!==l)return u(r),f(`fallback`),o(!1),void c(!1);f(`failed`),c(!0),(e=t.onError)==null||e.call(t,l)},onLoad:()=>{var e;o(!0),c(!1),(e=t.onLoad)==null||e.call(t,p)},onClick:e=>{var n;e.preventDefault(),a&&!s&&((n=t.onClick)==null||n.call(t,[e,p]))}},`image`):t.node.loading&&!s?(0,L.jsx)(`span`,{className:`image-node__placeholder`,children:t.usePlaceholder?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`image-node__spinner`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`image-node__placeholder-text`,children:`Loading image...`})]}):(0,L.jsx)(`span`,{className:`image-node__placeholder-text`,children:t.node.raw??`Loading image…`})},`placeholder`):t.node.loading||d!==`failed`?null:(0,L.jsxs)(`span`,{className:`image-node__error`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{fill:`currentColor`,d:`M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z`})}),(0,L.jsx)(`span`,{className:`image-node__placeholder-text`,children:`Image failed to load`})]})}var Kb=null,qb=null,Jb=(0,L.jsx)(`svg`,{width:`1em`,height:`1em`,viewBox:`0 0 291 300`,fill:`none`,className:`w-4 h-4 flex-shrink-0`,xmlns:`http://www.w3.org/2000/svg`,children:(0,L.jsxs)(`g`,{children:[(0,L.jsx)(`path`,{d:`M140.904 239.376C128.83 239.683 119.675 239.299 115.448 243.843C110.902 248.07 111.288 257.227 110.979 269.302C111.118 274.675 111.118 279.478 111.472 283.52C111.662 285.638 111.95 287.547 112.406 289.224C112.411 289.243 112.416 289.259 112.422 289.28C112.462 289.419 112.496 289.558 112.539 289.691C113.168 291.787 114.088 293.491 115.446 294.758C116.662 296.064 118.283 296.963 120.264 297.69C120.36 297.614 120.464 297.646 120.555 297.675C120.56 297.68 120.56 297.68 120.566 297.68C120.848 297.768 121.142 297.846 121.443 297.923C121.454 297.923 121.464 297.928 121.478 297.934C122.875 298.272 124.424 298.507 126.11 298.678C126.326 298.696 126.542 298.718 126.763 298.739C130.79 299.086 135.558 299.088 140.904 299.222C152.974 298.912 162.128 299.302 166.36 294.758C170.904 290.526 170.515 281.371 170.824 269.302C170.515 257.227 170.907 248.07 166.36 243.843C162.131 239.299 152.974 239.683 140.904 239.376Z`,fill:`#FF6376`}),(0,L.jsx)(`path`,{d:`M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z`,fill:`#FFCCCC`}),(0,L.jsx)(`path`,{d:`M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z`,fill:`#FF939F`}),(0,L.jsx)(`path`,{d:`M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z`,fill:`#FF356A`}),(0,L.jsx)(`path`,{d:`M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z`,fill:`#FF6376`})]})}),Yb={maxHeight:`500px`,loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function Xb(e){let t={...Yb,...e},{t:n}=qy(),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(()=>typeof window>`u`),p=t.node.code,m=(0,I.useMemo)(()=>t.maxHeight&&t.maxHeight!==`none`?Ev(t.maxHeight):null,[t.maxHeight]),h=(0,I.useMemo)(()=>Ev(t.estimatedPreviewHeightPx)??Dv(p),[p,t.estimatedPreviewHeightPx]),[g,_]=(0,I.useState)(()=>`${Ov(h,360,m)}px`),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(1),[w,T]=(0,I.useState)({x:0,y:0}),[E,D]=(0,I.useState)(!1),O=(0,I.useRef)(null),k=(0,I.useRef)(null),A=(0,I.useRef)(null),j=(0,I.useRef)(null),M=(0,I.useRef)(null),N=(0,I.useRef)(null),ee=(0,I.useRef)(null),te=(0,I.useRef)(0),P=(0,I.useRef)(w);P.current=w;let F=(0,I.useRef)(S);F.current=S;let ne=(0,I.useRef)(l);ne.current=l;let re=(0,I.useRef)(v);re.current=v;let ie=Gy(),ae=(0,I.useCallback)(()=>{let e=O.current;return Ev(e?getComputedStyle(e).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??360},[]),oe=(0,I.useCallback)(()=>Ov(h,ae(),m),[h,m,ae]),se=(0,I.useCallback)(e=>{let n=oe();if(!t.maxHeight||t.maxHeight===`none`)return`${Math.max(e,n)}px`;let r=Number.parseFloat(String(t.maxHeight));return Number.isFinite(r)?`${Math.max(Math.min(e,r),n)}px`:`${Math.max(e,n)}px`},[t.maxHeight,oe]),ce=(0,I.useCallback)(()=>{let e=O.current;if(!e)return;let t=e.scrollHeight;t>0&&_(se(t))},[se]);(0,I.useEffect)(()=>{s||a||_(e=>{let t=Ev(e),n=oe();return t!=null&&t>=n?e:`${n}px`})},[a,oe,s]);let le=(0,I.useCallback)(async()=>{var e;try{await navigator.clipboard?.writeText(p),i(!0),(e=t.onCopy)==null||e.call(t,p),setTimeout(()=>i(!1),1e3)}catch{}},[p,t]),ue=(0,I.useCallback)(async()=>{var e,n,r,i,a,o,s,c;if(!d||!O.current)return;let l=O.current,u=p,f=!1===t.loading,m=++te.current,h=null,g=null;try{let t=await async function(){return qb||Kb||(Kb=R(()=>import(`./infographic_markstream-react-C3vVus-4.js`).then(e=>{let t=e&&e.default?e.default:e,n=t;return typeof t==`function`&&t.prototype&&t.prototype.render?n=t:e.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),qb=n,n}),[]).catch(e=>(console.warn(`Failed to load @antv/infographic`,e),null)),Kb)}();if(m!==te.current||l!==O.current)return;if(!t)throw Error(`Infographic library failed to load.`);g=Array.from(l.childNodes),h=new t({container:l,width:`100%`,height:`100%`});let a=``,o=!1;if((e=h.on)==null||e.call(h,`error`,e=>{a=(Array.isArray(e)?e:[e]).map(e=>e instanceof Error?e.message:typeof e==`string`?e:String(e&&typeof e==`object`&&`message`in e?e.message??``:e??``)).filter(Boolean).join(`; `)}),(n=h.on)==null||n.call(h,`rendered`,()=>{o=!0}),h.render(u),a)throw Error(a);let s=Array.from(l.childNodes),c=s.length>0&&(s.length!==g.length||s.some((e,t)=>e!==g?.[t]));if(!o&&!c)throw Error(`Infographic render returned empty output.`);(i=(r=ee.current)?.destroy)==null||i.call(r),ee.current=h,h=null,y(!0),x(!1),setTimeout(()=>{ce()},0)}catch(e){if(m!==te.current||l!==O.current)return;(a=h?.destroy)==null||a.call(h),h=null,f&&!1===t.loading&&u===p?(console.error(`Failed to render infographic:`,e),(s=(o=ee.current)?.destroy)==null||s.call(o),ee.current=null,y(!1),x(!0),l.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${e instanceof Error?e.message:`Unknown error`}</div>`):g&&l.replaceChildren(...g)}finally{(c=h?.destroy)==null||c.call(h)}},[p,t.loading,ce,d]);(0,I.useEffect)(()=>{let e=k.current;if(!e)return;let t=ie(e,{rootMargin:`160px`});return A.current=t,t.isVisible()&&f(!0),t.whenVisible.then(()=>f(!0)),()=>{t.destroy(),A.current=null}},[ie]),(0,I.useEffect)(()=>{!d||s||a||ue()},[p,a,ue,s,d]),(0,I.useEffect)(()=>()=>{var e,t;te.current+=1,ee.current&&=((t=(e=ee.current).destroy)==null||t.call(e),null)},[]);let de=(0,I.useCallback)(()=>{u(!1),j.current&&(j.current.innerHTML=``),M.current=null,document.body.style.overflow=``},[]),fe=(0,I.useCallback)(()=>{u(!0),document.body.style.overflow=`hidden`},[]);(0,I.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&de()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l,de]),(0,I.useEffect)(()=>{l&&setTimeout(()=>{if(O.current&&j.current){j.current.innerHTML=``;let e=document.createElement(`div`);Object.assign(e.style,{transition:`transform 0.1s ease`,transformOrigin:`center center`,width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`});let t=O.current.cloneNode(!0);t.classList.add(`fullscreen`),t.style.height=`auto`,e.appendChild(t),j.current.appendChild(e),M.current=e,e.style.transform=`translate(${w.x}px, ${w.y}px) scale(${S})`}},0)},[l]),(0,I.useEffect)(()=>{l&&M.current&&(M.current.style.transform=`translate(${w.x}px, ${w.y}px) scale(${S})`)},[l,w,S]);let pe=(0,I.useCallback)(()=>{let e=O.current?.querySelector(`svg`);if(!e)return;let t=new XMLSerializer().serializeToString(e),n=new Blob([t],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},[]);N.current||=Fv({getTranslate:()=>P.current,setTranslate:e=>T(e),canStart:e=>!!re.current&&(e.pointerType!==`touch`||ne.current||F.current>1),onActiveChange:e=>D(e)});let me=N.current;(0,I.useEffect)(()=>()=>me.stop(),[me]);let he=t.isDark?`p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200`:`p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700`,ge=s||a,_e=l||S>1;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{ref:k,"data-markstream-infographic":`1`,"data-markstream-mode":s?`source`:b?`error`:v?`preview`:`pending`,className:hb(`my-4 rounded-lg border overflow-hidden shadow-sm`,t.isDark?`border-gray-700/30`:`border-gray-200`,{"is-rendering":t.loading}),children:[t.showHeader&&(0,L.jsxs)(`div`,{className:hb(`flex justify-between items-center px-4 py-2.5 border-b`,t.isDark?`bg-gray-800 border-gray-700/30`:`bg-gray-50 border-gray-200`),children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-x-2 overflow-hidden`,children:[Jb,(0,L.jsx)(`span`,{className:hb(`text-sm font-medium font-mono truncate`,t.isDark?`text-gray-400`:`text-gray-600`),children:`Infographic`})]}),t.showModeToggle&&(0,L.jsxs)(`div`,{className:hb(`flex items-center gap-x-1 rounded-md p-0.5`,t.isDark?`bg-gray-700`:`bg-gray-100`),children:[(0,L.jsx)(`button`,{className:hb(`px-2.5 py-1 text-xs rounded transition-colors`,s?t.isDark?`text-gray-400 hover:text-gray-200`:`text-gray-500 hover:text-gray-700`:t.isDark?`bg-gray-600 text-gray-200 shadow-sm`:`bg-white text-gray-700 shadow-sm`),onClick:()=>c(!1),onMouseEnter:e=>rb(e.currentTarget,n(`common.preview`)||`Preview`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsxs)(`div`,{className:`flex items-center gap-x-1`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}),(0,L.jsx)(`span`,{children:n(`common.preview`)||`Preview`})]})}),(0,L.jsx)(`button`,{className:hb(`px-2.5 py-1 text-xs rounded transition-colors`,s?t.isDark?`bg-gray-600 text-gray-200 shadow-sm`:`bg-white text-gray-700 shadow-sm`:t.isDark?`text-gray-400 hover:text-gray-200`:`text-gray-500 hover:text-gray-700`),onClick:()=>c(!0),onMouseEnter:e=>rb(e.currentTarget,n(`common.source`)||`Source`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsxs)(`div`,{className:`flex items-center gap-x-1`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m16 18l6-6l-6-6M8 6l-6 6l6 6`})}),(0,L.jsx)(`span`,{children:n(`common.source`)||`Source`})]})})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-x-1`,children:[t.showCollapseButton&&(0,L.jsx)(`button`,{className:he,onClick:()=>o(!a),onMouseEnter:e=>rb(e.currentTarget,a?n(`common.expand`)||`Expand`:n(`common.collapse`)||`Collapse`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsx)(`svg`,{style:{rotate:a?`0deg`:`90deg`},xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m9 18l6-6l-6-6`})})}),t.showCopyButton&&(0,L.jsx)(`button`,{className:he,onClick:le,onMouseEnter:e=>rb(e.currentTarget,r?n(`common.copied`)||`Copied`:n(`common.copy`)||`Copy`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsx)(`svg`,r?{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M20 6L9 17l-5-5`})}:{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})})}),t.showExportButton&&(0,L.jsx)(`button`,{className:hb(he,ge&&`opacity-50 cursor-not-allowed`),disabled:ge,onClick:pe,onMouseEnter:e=>rb(e.currentTarget,n(`common.export`)||`Export`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`path`,{d:`m7 10l5 5l5-5`})]})})}),t.showFullscreenButton&&(0,L.jsx)(`button`,{className:hb(he,ge&&`opacity-50 cursor-not-allowed`),disabled:ge,onClick:fe,onMouseEnter:e=>rb(e.currentTarget,l?n(`common.minimize`)||`Minimize`:n(`common.open`)||`Open`,`top`,!1,0,t.isDark),onMouseLeave:()=>ib(),children:(0,L.jsx)(`svg`,l?{xmlns:`http://www.w3.org/2000/svg`,width:`0.75rem`,height:`0.75rem`,viewBox:`0 0 24 24`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`})}:{xmlns:`http://www.w3.org/2000/svg`,width:`0.75rem`,height:`0.75rem`,viewBox:`0 0 24 24`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`})})})]})]}),!a&&(0,L.jsx)(`div`,{children:s?(0,L.jsx)(`div`,{className:hb(`p-4`,t.isDark?`bg-gray-900`:`bg-gray-50`),children:(0,L.jsx)(`pre`,{className:hb(`text-sm font-mono whitespace-pre-wrap`,t.isDark?`text-gray-300`:`text-gray-700`),children:p})}):(0,L.jsxs)(`div`,{className:`relative`,children:[t.showZoomControls&&(0,L.jsx)(`div`,{className:`absolute top-2 right-2 z-10 rounded-lg`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2 backdrop-blur rounded-lg`,children:[(0,L.jsx)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>C(Math.min(S+.1,3)),children:`+`}),(0,L.jsx)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>C(Math.max(S-.1,.5)),children:`-`}),(0,L.jsxs)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>{C(1),T({x:0,y:0})},children:[Math.round(100*S),`%`]})]})}),(0,L.jsxs)(`div`,{className:hb(`infographic-preview relative transition-all duration-100 overflow-hidden block`,t.isDark?`bg-gray-900`:`bg-gray-50`),style:{height:g,maxHeight:t.maxHeight??void 0,minHeight:`var(--ms-size-diagram-min-height, 360px)`,touchAction:_e?`none`:void 0},onPointerDown:e=>me.start(e.nativeEvent),children:[!v&&!b&&(0,L.jsx)(`pre`,{className:hb(`absolute inset-0 overflow-auto p-4 text-left text-sm font-mono whitespace-pre-wrap`,t.isDark?`text-gray-300`:`text-gray-700`),children:p}),(0,L.jsx)(`div`,{className:hb(`absolute inset-0 cursor-grab`,E&&`cursor-grabbing`),style:{transform:`translate(${w.x}px, ${w.y}px) scale(${S})`},children:(0,L.jsx)(`div`,{ref:O,className:`w-full text-center flex items-center justify-center min-h-full`})})]})]})})]}),l&&typeof document<`u`&&(0,P_.createPortal)((0,L.jsx)(`div`,{className:`markstream-react fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,onClick:de,role:`dialog`,"aria-modal":`true`,children:(0,L.jsxs)(`div`,{className:hb(`dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden`,t.isDark?`bg-gray-900`:`bg-white`),onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`absolute top-6 right-6 z-50 flex items-center gap-2`,children:[(0,L.jsx)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>C(Math.min(S+.1,3)),children:`+`}),(0,L.jsx)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>C(Math.max(S-.1,.5)),children:`-`}),(0,L.jsxs)(`button`,{className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:()=>{C(1),T({x:0,y:0})},children:[Math.round(100*S),`%`]}),(0,L.jsx)(`button`,{className:hb(`inline-flex items-center justify-center p-2 rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onClick:de,children:`X`})]}),(0,L.jsx)(`div`,{ref:j,className:hb(`w-full h-full flex items-center justify-center p-4 overflow-hidden`,!E&&`cursor-grab`,E&&`cursor-grabbing`),style:{touchAction:_e?`none`:void 0},onPointerDown:e=>me.start(e.nativeEvent)})]})}),document.body)]})}function Zb(e,t){return e.reduce((e,n)=>{let r=t==null||n.id===t?{...n,fading:!1}:n,i=e[e.length-1];return!i||i.fading||r.fading?e.push(r):e[e.length-1]={...i,content:i.content+r.content},e},[])}function Qb(e){var t;let{node:n,children:r,ctx:i,indexKey:a,fade:o}=e,s=String(n.code??``),c=(t=o??i?.fade)==null||t,l=a==null||a===``?``:String(a),[u,d]=(0,I.useState)(s?[{id:0,content:s,fading:!1}]:[]),f=Hy(),p=(0,I.useRef)(s),m=(0,I.useRef)(1),h=(0,I.useRef)(void 0);return(0,I.useEffect)(()=>{let e=f?.getStreamRenderVersion()??i?.streamRenderVersion,t=e!==h.current;if(r!=null)return p.current=``,d([]),void(h.current=e);let n=f?.textStreamState??i?.textStreamState,a=l?n?.get(l):void 0,o=p.current,u=!!(o===s&&a&&s.startsWith(a)&&s.length>a.length);if(u&&(o=a),c){if(s!==o){if(o&&s.startsWith(o)){let e=s.slice(o.length);d(t=>{if(u)return[{id:m.current++,content:o,fading:!1},{id:m.current++,content:e,fading:!0}];let n=t[t.length-1];return n?.fading?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:m.current++,content:e,fading:!0}]})}else d(s?[{id:m.current++,content:s,fading:!1}]:[])}else t&&d(e=>e.some(e=>e.fading)?Zb(e):e)}else d(e=>e.length!==1||e[0]?.fading||e[0].content!==s?s?[{id:m.current++,content:s,fading:!1}]:[]:e);p.current=s,h.current=e,l&&n?.set(l,s)},[r,s,f,i?.textStreamState,i?.streamRenderVersion,l,c]),(0,L.jsx)(`code`,{className:`inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full`,children:r||u.map(e=>(0,L.jsx)(`span`,{className:e.fading?hb(`text-node-stream-delta`,e.id%2==0?`text-node-stream-delta--a`:`text-node-stream-delta--b`):void 0,onAnimationEnd:e.fading?()=>{t=e.id,d(e=>e.some(e=>e.id===t&&e.fading)?Zb(e,t):e);return;var t}:void 0,children:e.content},e.id))})}function $b(e){return(0,L.jsx)(`ins`,{className:`insert-node`,children:e.children})}function ex(e,t){return e.reduce((e,n)=>{let r=t==null||n.id===t?{...n,fading:!1}:n,i=e[e.length-1];return!i||i.fading||r.fading?e.push(r):e[e.length-1]={...i,content:i.content+r.content},e},[])}function tx({content:e}){let t=(0,I.useRef)(e),n=(0,I.useRef)(t.current),r=(0,I.useRef)(null);return(0,I.useEffect)(()=>{let t=r.current;if(t){if(e.startsWith(n.current)){let r=e.slice(n.current.length);r&&t.appendChild(document.createTextNode(r)),n.current=e}else t.textContent=e,n.current=e}},[e]),(0,L.jsx)(`span`,{ref:r,children:t.current})}function nx(e){var t;let{node:n,children:r,ctx:i,indexKey:a,fade:o}=e,s=String(n.content??``),c=(t=o??i?.fade)==null||t,l=a==null||a===``?``:String(a),[u,d]=(0,I.useState)(s?[{id:0,content:s,fading:!1}]:[]),f=Hy(),p=(0,I.useRef)(s),m=(0,I.useRef)(1),h=(0,I.useRef)(void 0);return(0,I.useEffect)(()=>{let e=f?.getStreamRenderVersion()??i?.streamRenderVersion,t=e!==h.current;if(r!=null)return p.current=``,d([]),void(h.current=e);let n=f?.textStreamState??i?.textStreamState,a=l?n?.get(l):void 0,o=p.current,u=!!(o===s&&a&&s.startsWith(a)&&s.length>a.length);if(u&&(o=a),c){if(s!==o){if(o&&s.startsWith(o)){let e=s.slice(o.length);d(t=>{if(u)return[{id:m.current++,content:o,fading:!1},{id:m.current++,content:e,fading:!0}];let n=t[t.length-1];return n?.fading?[...t.slice(0,-1),{...n,content:n.content+e}]:[...t,{id:m.current++,content:e,fading:!0}]})}else d(s?[{id:m.current++,content:s,fading:!1}]:[])}else t&&d(e=>e.some(e=>e.fading)?ex(e):e)}else d(e=>{if(!s)return[];let t=e.reduce((e,t)=>e+t.content,``);return s===t?e:s.startsWith(t)?[...e,{id:m.current++,content:s.slice(t.length),fading:!1}]:[{id:m.current++,content:s,fading:!1}]});p.current=s,h.current=e,l&&n?.set(l,s)},[r,s,f,i?.textStreamState,i?.streamRenderVersion,l,c]),(0,L.jsx)(`span`,r==null?{className:hb(`text-node whitespace-pre-wrap break-words`,n.center&&`text-node-center`),children:u.map(e=>(0,L.jsx)(`span`,{className:e.fading?hb(`text-node-stream-delta`,e.id%2==0?`text-node-stream-delta--a`:`text-node-stream-delta--b`):void 0,onAnimationEnd:e.fading?()=>{t=e.id,d(e=>e.some(e=>e.id===t&&e.fading)?ex(e,t):e);return;var t}:void 0,children:e.fading?e.content:(0,L.jsx)(tx,{content:e.content})},e.id))}:{className:hb(`text-node whitespace-pre-wrap break-words`,n.center&&`text-node-center`),children:r})}function rx(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e,a=!1!==e.showTooltip,o=e.isDark??n?.isDark,s=(0,I.useRef)(null);(0,I.useEffect)(()=>{let e=s.current;return()=>{e&&ib(!0,e)}},[a,t.loading]);let c=(0,I.useMemo)(()=>{let t=e.underlineBottom===void 0?`-3px`:typeof e.underlineBottom==`number`?`${e.underlineBottom}px`:String(e.underlineBottom),n=e.animationOpacity??.35,r=Math.max(.12,Math.min(.5*n,n));return{"--link-color":e.color??`#0366d6`,"--underline-height":`${e.underlineHeight??2}px`,"--underline-bottom":t,"--underline-opacity":String(n),"--underline-rest-opacity":String(r),"--underline-duration":`${e.animationDuration??1.6}s`,"--underline-timing":e.animationTiming??`ease-in-out`,"--underline-iteration":typeof e.animationIteration==`number`?String(e.animationIteration):e.animationIteration??`infinite`}},[e.animationDuration,e.animationIteration,e.animationOpacity,e.animationTiming,e.color,e.underlineBottom,e.underlineHeight]),l=(0,I.useMemo)(()=>f_({href:String(t.href??``)}).href,[t.href]),u=typeof t.title==`string`&&t.title.trim().length>0?t.title:String(l??``),d=xl(l),f=(0,I.useCallback)(e=>{a&&rb(e.currentTarget,String(t.title||l||t.text||``),`top`,!1,(e.clientX,e.clientY),o)},[o,t.text,t.title,l,a]),p=(0,I.useCallback)(e=>{a&&ib(!1,e.currentTarget)},[a]);return t.loading?(0,L.jsx)(`span`,{className:`link-loading inline-flex items-baseline gap-1.5`,"aria-hidden":`false`,style:c,children:(0,L.jsxs)(`span`,{className:`link-text-wrapper relative inline-flex`,children:[(0,L.jsx)(`span`,{className:`leading-[normal] link-text`,children:(0,L.jsx)(nx,{node:{type:`text`,content:String(t.text??``)},ctx:n,indexKey:`${String(i??`link`)}-loading`,typewriter:e.typewriter})}),(0,L.jsx)(`span`,{className:`link-loading-indicator`,"aria-hidden":`true`})]})}):(0,L.jsx)(`a`,{ref:s,className:`link-node`,href:l||void 0,title:a?``:u,"aria-label":`Link: ${u}`,target:d?`_blank`:void 0,rel:d?`noopener noreferrer`:void 0,style:c,onMouseEnter:f,onMouseLeave:p,children:n&&r?L_(t.children,n,String(i??`link`),r):(0,L.jsx)(nx,{node:{type:`text`,content:String(t.text??``)},ctx:n,indexKey:`${String(i??`link`)}-fallback`,typewriter:e.typewriter})})}function ix(e){let{node:t,ctx:n,renderNode:r,value:i,indexKey:a,children:o}=e;return(0,L.jsx)(`li`,{className:`list-item pl-1.5 my-2`,dir:`auto`,value:i??void 0,children:o??(n&&r?L_(t.children,n,String(a??`list-item`),r):null)})}function ax(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e,a=t.ordered?`ol`:`ul`,o=t.ordered&&t.start?t.start:void 0,s=n&&G_(n.customId).list_item||ix;return(0,L.jsx)(a,{className:hb(`list-node my-5 pl-[calc(13/8*1em)]`,t.ordered?`list-decimal`:`list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]`),start:o,children:t.items?.map((e,a)=>(0,L.jsx)(s,{node:e,value:t.ordered?(t.start??1)+a:void 0,ctx:n,renderNode:r,indexKey:`${String(i??`list`)}-${a}`,customId:n?.customId,isDark:n?.isDark,typewriter:n?.typewriter},`${String(i??`list`)}-${a}`))})}var ox=null,sx=null,cx=!1,lx=new Map,ux=new Map,dx=5,fx=new Set;function px(){if(lx.size<dx&&fx.size){let e=Array.from(fx);fx.clear();for(let t of e)try{t()}catch{}}}var mx=`WORKER_BUSY`;async function hx(e,t=!0,n=2e3,r){performance.now();let i=kv(e);if(sx)return Promise.reject(sx);let a=`${t?`d`:`i`}:${i}`,o=ux.get(a);if(o)return Promise.resolve(o);let s=ox||(sx=Error(`[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker().`),sx.name=`WORKER_INIT_ERROR`,sx.code=`WORKER_INIT_ERROR`,null);if(!s)return Promise.reject(sx);if(lx.size>=dx){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=mx,e.busy=!0,e.inFlight=lx.size,e.max=dx,Promise.reject(e)}return new Promise((e,a)=>{if(r?.aborted){let e=Error(`Aborted`);e.name=`AbortError`,a(e);return}let o=Math.random().toString(36).slice(2),c=setTimeout(()=>{lx.delete(o);let e=Error(`Worker render timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,a(e),px()},n),l=()=>{},u=()=>{lx.delete(o),clearTimeout(c),fx.delete(l);let e=Error(`Aborted`);e.name=`AbortError`,a(e),px()};r&&r.addEventListener(`abort`,u,{once:!0}),lx.set(o,{resolve:t=>{r&&r.removeEventListener(`abort`,u),e(t)},reject:e=>{r&&r.removeEventListener(`abort`,u),a(e)},timeoutId:c});try{s.postMessage({id:o,content:i,displayMode:t,debug:cx})}catch(e){lx.delete(o),clearTimeout(c),r&&r.removeEventListener(`abort`,u),a(e),px()}})}function gx(e,t,n){let r=`${t?`d`:`i`}:${kv(e)}`;if(ux.set(r,n),ux.size>200){let e=ux.keys().next().value;ux.delete(e)}}function _x(e=1500,t){return lx.size<dx?Promise.resolve():new Promise((n,r)=>{if(t?.aborted){let e=Error(`Aborted`);e.name=`AbortError`,r(e);return}let i=null;function a(){fx.delete(o),i!=null&&clearTimeout(i),t&&t.removeEventListener(`abort`,s)}function o(){a(),n()}function s(){a();let e=Error(`Aborted`);e.name=`AbortError`,r(e)}i=e>0?setTimeout(()=>{a(),r(Error(`Timeout waiting for worker slot`))},e):null,t&&t.addEventListener(`abort`,s,{once:!0}),fx.add(o)})}var vx={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};async function yx(e,t=!0,n={}){let r=n.timeout??vx.timeout,i=n.waitTimeout??vx.waitTimeout,a=n.backoffMs??vx.backoffMs,o=n.maxRetries??vx.maxRetries,s=Number.isFinite(o)?Math.max(0,Math.min(Math.floor(o),8)):vx.maxRetries,c=n.signal,l=0;for(;;){if(c?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}try{return await hx(e,t,r,c)}catch(e){if(e?.code!==`WORKER_BUSY`||l>=s)throw e;if(l++,await _x(i,c).catch(()=>{}),c?.aborted){let e=Error(`Aborted`);throw e.name=`AbortError`,e}a>0&&await new Promise(e=>setTimeout(e,a*l))}}}var bx=null,xx=!1;async function Sx(){if(bx)return bx;if(xx)return null;try{return bx=await R(()=>Promise.resolve().then(()=>CL),void 0),await R(()=>import(`./mhchem-CRwK5apH.js`),[]),bx}catch{return xx=!0,null}}function Cx({node:e}){let t=(0,I.useRef)(null),n=(0,I.useRef)(null),r=(0,I.useRef)(null),i=Gy(),[a,o]=(0,I.useState)(!0),[s,c]=(0,I.useState)(()=>typeof window>`u`),l=(0,I.useRef)(0);return(0,I.useEffect)(()=>{let e=t.current;if(!e)return;let n=i(e,{rootMargin:`400px`});return r.current=n,n.isVisible()&&c(!0),n.whenVisible.then(()=>c(!0)),()=>{n.destroy(),r.current=null}},[i]),(0,I.useEffect)(()=>{let t=kv(e.content??``);if(!t)return n.current&&(n.current.innerHTML=``),void o(!1);if(!s)return void o(!0);let r=!1,i=new AbortController,a=++l.current;return yx(t,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{r||a!==l.current||(n.current&&(n.current.innerHTML=e),o(!1))}).catch(async i=>{if(r||a!==l.current||!n.current)return;let s=i?.code||i?.name;if(s===`WORKER_INIT_ERROR`||i?.fallbackToRenderer||s===`WORKER_BUSY`||s===`WORKER_TIMEOUT`){let i=await Sx();if(i)try{let s=i.renderToString(t,{throwOnError:e.loading,displayMode:!0});!r&&a===l.current&&n.current&&(n.current.innerHTML=s,o(!1),gx(t,!0,s));return}catch{}}e.loading||(n.current.textContent=e.raw,o(!1))}),()=>{r=!0,i.abort()}},[e.content,e.loading,e.raw,s]),(0,L.jsx)(`div`,{ref:t,className:`math-block text-center overflow-x-auto relative min-h-[40px]`,children:(0,L.jsx)(`div`,{ref:n,className:a?`math-rendering`:void 0})})}function wx({node:e}){let t=(0,I.useRef)(null),n=(0,I.useRef)(null),r=(0,I.useRef)(null),i=Gy(),[a,o]=(0,I.useState)(!0),[s,c]=(0,I.useState)(()=>typeof window>`u`),l=(0,I.useRef)(0);return(0,I.useEffect)(()=>{let e=t.current;if(!e)return;let n=i(e,{rootMargin:`400px`});return r.current=n,n.isVisible()&&c(!0),n.whenVisible.then(()=>c(!0)),()=>{n.destroy(),r.current=null}},[i]),(0,I.useEffect)(()=>{let t=kv(e.content??``);if(!t)return n.current&&(n.current.innerHTML=``),void o(!1);if(!s)return void o(!0);let r=!1,i=new AbortController,a=++l.current,c=e.markup===`$$`;return yx(t,c,{timeout:1500,waitTimeout:0,maxRetries:0,signal:i.signal}).then(e=>{r||a!==l.current||n.current&&(n.current.innerHTML=e,o(!1))}).catch(async i=>{if(r||a!==l.current||!n.current)return;let s=i?.code||i?.name;if(s===`WORKER_INIT_ERROR`||i?.fallbackToRenderer||s===`WORKER_BUSY`||s===`WORKER_TIMEOUT`){let i=await Sx();if(i)try{let s=i.renderToString(t,{throwOnError:e.loading,displayMode:c});!r&&a===l.current&&n.current&&(n.current.innerHTML=s,o(!1),gx(t,c,s));return}catch{}}e.loading||(n.current.textContent=e.raw,o(!1))}),()=>{r=!0,i.abort()}},[e.content,e.loading,e.raw,e.markup,s]),(0,L.jsxs)(`span`,{ref:t,className:`math-inline-wrapper`,children:[(0,L.jsx)(`span`,{ref:n,className:`math-inline`+(a?` math-inline--hidden`:``)}),a&&(0,L.jsxs)(`span`,{className:`math-inline__loading`,role:`status`,"aria-live":`polite`,children:[(0,L.jsx)(`span`,{className:`math-inline__spinner`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Loading`})]})]})}function Tx(e){try{if(typeof globalThis<`u`&&typeof globalThis.requestAnimationFrame==`function`)return globalThis.requestAnimationFrame(e)}catch{}return globalThis.setTimeout(e,0)}var Ex=null,Dx=null,Ox=new Map,kx=5,Ax=`WORKER_BUSY`;function jx(e,t,n=1400){if(Dx)return Promise.reject(Dx);let r=Ex||(Dx=Error(`[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker().`),Dx.name=`WORKER_INIT_ERROR`,Dx.code=`WORKER_INIT_ERROR`,null);if(!r)return Promise.reject(Dx);if(Ox.size>=kx){let e=Error(`Worker busy`);return e.name=`WorkerBusy`,e.code=Ax,e.inFlight=Ox.size,e.max=kx,Promise.reject(e)}return new Promise((i,a)=>{let o=Math.random().toString(36).slice(2),s=!1,c=null,l=()=>{s||(s=!0,c!=null&&clearTimeout(c),Ox.delete(o))};Ox.set(o,{resolve:e=>{l(),i(e)},reject:e=>{l(),a(e)}});try{r.postMessage({id:o,action:e,payload:t})}catch(e){Ox.delete(o),a(e);return}c=setTimeout(()=>{let e=Error(`Worker call timed out`);e.name=`WorkerTimeout`,e.code=`WORKER_TIMEOUT`,Ox.get(o)?.reject(e)},n)})}async function Mx(e,t,n=1400){return jx(`canParse`,{code:e,theme:t},n)}async function Nx(e,t,n=2400){return jx(`findPrefix`,{code:e,theme:t},n)}function Px(){var e;(e=Ex?.terminate)==null||e.call(Ex),Ex=null,Dx=null,Ox.clear()}var Fx=null,Ix=!1,Lx=null,Rx=null;function zx(e,t){var n;if(!e||!t)return;let r=function(e){return`${String(e?.securityLevel??`strict`)}|htmlLabels:${!1===e?.flowchart?.htmlLabels?`0`:`1`}`}(t);if(Lx!==r)try{typeof e.initialize==`function`?e.initialize(t):(n=e.mermaidAPI)!=null&&n.initialize&&e.mermaidAPI.initialize(t),Lx=r}catch{}}var Bx=typeof window<`u`?I.useLayoutEffect:I.useEffect,Vx={USE_PROFILES:{svg:!0},FORBID_TAGS:[`script`],FORBID_ATTR:[/^on/i],ADD_TAGS:[`style`],ADD_ATTR:[`style`],SAFE_FOR_TEMPLATES:!0};function Hx(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=``}}function Ux(e,t,n={}){if(!e)return``;let r=function(e,t){if(!e)return``;let n=mre(t);return n?(Hx(e),e.appendChild(n),e.innerHTML):``}(e,t);return r||n.keepPreviousOnFailure||Hx(e),r}function Wx(e,t,n){if(n&&e?.querySelector(`svg`))try{t?.(e)}catch{}}var Gx={maxHeight:`500px`,loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,renderDebounceMs:300,contentStableDelayMs:500,previewPollDelayMs:800,previewPollMaxDelayMs:4e3,previewPollMaxAttempts:12,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!0,enableMermaidInteractions:!1};function Kx(e){let t={...Gx,...e},{t:n}=qy(),r=(0,I.useMemo)(()=>ev(`mermaid`),[]),i=t.node?.code??``,a=(0,I.useMemo)(()=>i.replace(/\]::([^:])/g,`]:::$1`).replace(/:::subgraphNode$/gm,`::subgraphNode`),[i]),o=t.workerTimeoutMs??Gx.workerTimeoutMs,s=t.parseTimeoutMs??Gx.parseTimeoutMs,c=t.renderTimeoutMs??Gx.renderTimeoutMs,l=t.fullRenderTimeoutMs??Gx.fullRenderTimeoutMs,u=Math.max(0,t.renderDebounceMs??Gx.renderDebounceMs),d=(0,I.useMemo)(()=>t.maxHeight&&t.maxHeight!==`none`?Av(t.maxHeight):null,[t.maxHeight]),f=(0,I.useMemo)(()=>Av(t.estimatedPreviewHeightPx)??jv(a),[a,t.estimatedPreviewHeightPx]),[p,m]=(0,I.useState)(!1),[h,g]=(0,I.useState)(!1),[_,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(!1),[x,S]=(0,I.useState)(1),[C,w]=(0,I.useState)({x:0,y:0}),[T,E]=(0,I.useState)(!1),[D,O]=(0,I.useState)(!1),[k,A]=(0,I.useState)(!1),[j,M]=(0,I.useState)(null),[N,ee]=(0,I.useState)(!1),[te,P]=(0,I.useState)(()=>`${Mv(f,360,d)}px`),[F,ne]=(0,I.useState)(typeof window>`u`),re=(0,I.useRef)(null),ie=(0,I.useRef)(null),ae=(0,I.useRef)(null),oe=(0,I.useRef)(null),se=(0,I.useRef)(null),ce=(0,I.useRef)(null),le=(0,I.useRef)(null),ue=(0,I.useRef)(null),de=(0,I.useRef)(0),fe=(0,I.useRef)({}),pe=(0,I.useRef)(null),me=(0,I.useRef)(``),he=(0,I.useRef)(!1),ge=(0,I.useRef)(null),_e=(0,I.useRef)(!1),ve=(0,I.useRef)({zoom:1,translateX:0,translateY:0,containerHeight:te||`360px`}),ye=(0,I.useRef)(C);ye.current=C;let be=(0,I.useRef)(x);be.current=x;let xe=(0,I.useRef)(N);xe.current=N;let Se=Gy(),Ce=!!(t.node?.loading??t.loading),we=t.isDark?`dark`:`light`,Te=!!t.isStrict,Ee=!0===t.enableMermaidInteractions,De=(0,I.useMemo)(()=>Te?{startOnLoad:!1,securityLevel:`strict`,suppressErrorRendering:!0,dompurifyConfig:Vx,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:`loose`,suppressErrorRendering:!0},[Te]);(0,I.useEffect)(()=>{_e.current=k},[k]);let Oe=(0,I.useCallback)(()=>{let e=ie.current;return Av(e?getComputedStyle(e).getPropertyValue(`--ms-size-diagram-min-height`).trim():``)??360},[]),ke=(0,I.useCallback)(()=>Mv(f,Oe(),d),[f,d,Oe]);(0,I.useEffect)(()=>{h||_||P(e=>{let t=Av(e),n=ke();return t!=null&&t>=n?e:`${n}px`})},[_,ke,h]),(0,I.useEffect)(()=>{fe.current={}},[we,a,Te]),(0,I.useEffect)(()=>{let e=!1;return(async()=>{let t=await async function(e){if(Fx)return zx(Fx,e),Fx;if(Rx){let t=await Rx;return t&&zx(t,e),t}if(Ix)return null;try{Ix=!0,Rx=(async()=>{try{let t=await R(()=>import(`./mermaid.core-fp2_EGmp.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),n=t?.default||t;if(Fx=n?.default?n.default:n?.mermaidAPI?n:n?.mermaid?n.mermaid:n,!Fx)throw Error(`Mermaid module did not export expected API`);return zx(Fx,e??{startOnLoad:!1,securityLevel:`strict`,flowchart:{htmlLabels:!1}}),Fx}catch(e){return console.warn(`[markstream-react] Failed to load mermaid:`,e),null}finally{Rx=null}})();let t=await Rx;return t&&zx(t,e),t}catch{return null}}(De);e||(re.current=t,m(!!t),he.current||g(!t))})(),()=>{e=!0}},[De]),(0,I.useEffect)(()=>{let e=ie.current;if(!e)return;let t=Se(e,{rootMargin:`400px`});return ge.current=t,t.isVisible()&&ne(!0),t.whenVisible.then(()=>ne(!0)),()=>{t.destroy(),ge.current=null}},[Se]),(0,I.useEffect)(()=>{if(typeof document>`u`||!N)return;let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[N]);let Ae=(0,I.useCallback)(()=>d,[d]),je=(0,I.useCallback)(e=>{let n=ie.current,r=oe.current;if(!n||!r)return;let i=r.querySelector(`svg`);if(!i)return;let a=0,o=0,s=i.getAttribute(`viewBox`);if(s){let e=s.split(` `);e.length===4&&(a=Number.parseFloat(e[2]),o=Number.parseFloat(e[3]))}if(a&&o||!i.hasAttribute(`width`)||!i.hasAttribute(`height`)||(a=Number.parseFloat(i.getAttribute(`width`)||`0`),o=Number.parseFloat(i.getAttribute(`height`)||`0`)),!a||!o||Number.isNaN(a)||Number.isNaN(o))try{let e=i.getBBox();a=e.width,o=e.height}catch{return}if(!(a>0&&o>0))return;let c=(e??n.clientWidth)*(o/a),l=Number.isFinite(c)&&c>0?c:o,u=Ae(),d=u==null?l:Math.min(l,u),f=ke();P(`${t.maxHeight===`none`?d:Math.max(d,f)}px`)},[t.maxHeight,ke,Ae]);(0,I.useEffect)(()=>{if(!ie.current||typeof ResizeObserver>`u`||h||_)return;let e=new ResizeObserver(e=>{if(!e.length)return;let t=e[0].contentRect.width;Tx(()=>je(t))});return e.observe(ie.current),()=>e.disconnect()},[_,h,je]),(0,I.useEffect)(()=>{h||_||je()},[_,t.maxHeight,h,je]),(0,I.useEffect)(()=>()=>{Px()},[]),(0,I.useLayoutEffect)(()=>{let e=fe.current[we];!h&&oe.current&&e!=null&&e.svg&&(Ux(oe.current,e.svg)&&(pe.current=e.bindFunctions??null,Wx(oe.current,e.bindFunctions,Ee)),Tx(()=>je()))},[Ee,h,we,je]);let Me=(0,I.useCallback)(async(e,n,r)=>{if(!re.current||!oe.current)return!1;O(!0);try{let t=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Yx(e,n),a=await $x(()=>re.current.render(t,i),{timeoutMs:l,signal:r});if(!a?.svg)return!1;let o=Ux(oe.current,a.svg);return!!o&&(pe.current=a.bindFunctions??null,Wx(oe.current,a.bindFunctions,Ee),je(),fe.current[n]={svg:o,bindFunctions:a.bindFunctions},A(!0),M(null),!0)}catch(e){if(!Ce){if(typeof t.onRenderError==`function`&&oe.current&&!0===t.onRenderError(e,a,oe.current))return!1;M(e instanceof Error?e.message:String(e))}return!1}finally{O(!1)}},[Ee,l,Ce,je]),Ne=(0,I.useCallback)(async(e,t,n)=>{if(re.current&&oe.current){O(!0);try{let r=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Yx(Qx(e)||e,t),a=await $x(()=>re.current.render(r,i),{timeoutMs:c,signal:n});if(a?.svg){let e=Ux(oe.current,a.svg,{keepPreviousOnFailure:!0});e&&(pe.current=a.bindFunctions??null,Wx(oe.current,a.bindFunctions,Ee)),e&&je()}}catch{}finally{O(!1)}}},[Ee,c,Ce,je]),Pe=(0,I.useCallback)(async(e,t)=>{if(!e.trim())return Hx(oe.current),A(!1),void(me.current=``);let n=e.replace(/\s+/g,``);if(n===me.current&&_e.current)return;let r=++de.current;if(Xx(e)===`gantt`){let i=Qx(e);if(!i.trim())return;try{if(await Jx(i,we,{workerTimeout:o,parseTimeout:s,mermaid:re.current,signal:t}),t?.aborted||de.current!==r)return;i===e?await Me(e,we,t)&&(me.current=n):await Ne(i,we,t)}catch(e){if(e?.name===`AbortError`)return}return}try{if(await Jx(e,we,{workerTimeout:o,parseTimeout:s,mermaid:re.current,signal:t}),t?.aborted||de.current!==r)return;await Me(e,we,t)&&(me.current=n);return}catch(e){if(e?.name===`AbortError`)return}try{let n=await async function(e,t,n){try{let r=await Nx(e,t,n.workerTimeout);if(r)return r}catch(e){if(e?.name===`AbortError`)throw e}return Qx(e)}(e,we,{workerTimeout:o,signal:t});if(!n||t?.aborted||de.current!==r)return;await Ne(n,we,t)}catch{}},[s,Me,Ne,we,o]),Fe=(0,I.useCallback)(()=>F&&!h&&!_,[_,h,F]);(0,I.useEffect)(()=>{if(!Fe()||!re.current)return;let e=new AbortController,t=window.setTimeout(()=>{!e.signal.aborted&&Fe()&&Pe(a,e.signal)},u);return()=>{e.abort(),window.clearTimeout(t)}},[a,Fe,p,Pe,u]);let Ie=(0,I.useCallback)((e,n)=>{e.clientX,e.clientY,rb(e.currentTarget,n,`top`,!1,0,t.isDark)},[t.isDark]),Le=(0,I.useCallback)(async()=>{var e;try{await navigator.clipboard?.writeText(a),b(!0),(e=t.onCopy)==null||e.call(t,a),setTimeout(()=>b(!1),1e3)}catch{}},[a,t]),Re=(0,I.useCallback)(()=>{var e;let n=oe.current?.querySelector(`svg`)??null;if(!n)return;let r=eS(n),i={payload:{type:`export`},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:n,svgString:r};(e=t.onExport)==null||e.call(t,i),i.defaultPrevented||function(e,t){let n=t??eS(e),r=new Blob([n],{type:`image/svg+xml;charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}(n,r)},[t]),ze=(0,I.useCallback)(()=>{le.current=null,Hx(ce.current)},[]),Be=(0,I.useCallback)(()=>{ee(!1),ze()},[ze]),Ve=(0,I.useCallback)(()=>{var e;let n=oe.current?.querySelector(`svg`)??null,r={payload:{type:`open-modal`},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:n,svgString:n?eS(n):null};(e=t.onOpenModal)==null||e.call(t,r),r.defaultPrevented||ee(!0)},[t]);(0,I.useEffect)(()=>{if(!N||typeof window>`u`)return;let e=e=>{e.key===`Escape`&&Be()};try{window.addEventListener(`keydown`,e)}catch{}return()=>{try{window.removeEventListener(`keydown`,e)}catch{}}},[Be,N]),Bx(()=>{if(!N)return;let e=ce.current,t=ie.current;if(!e||!t)return;let n=`translate(${C.x}px, ${C.y}px) scale(${x})`,r=t.cloneNode(!0);r.classList.add(`fullscreen`),r.style.height=`100%`,r.style.maxHeight=`100%`;let i=r.querySelector(`[data-mermaid-wrapper]`);i&&(le.current=i,i.style.transform=n),Hx(e),e.appendChild(r),Wx(e,pe.current??fe.current[we]?.bindFunctions,Ee)},[Ee,N,we]),(0,I.useEffect)(()=>{N&&le.current&&(le.current.style.transform=`translate(${C.x}px, ${C.y}px) scale(${x})`)},[N,C.x,C.y,x]);let He=h||D||_,Ue=(0,I.useMemo)(()=>t.isDark?`mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200`:`mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700`,[t.isDark]),We=(0,I.useCallback)(e=>{var n;let r={payload:{type:`toggle-mode`,target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if((n=t.onToggleMode)==null||n.call(t,e,r),!r.defaultPrevented){if(he.current=!0,e===`preview`){g(!1);let e=ve.current;S(e.zoom),w({x:e.translateX,y:e.translateY}),P(e.containerHeight)}else ve.current={zoom:x,translateX:C.x,translateY:C.y,containerHeight:te},g(!0)}},[a,te,Pe,t,we,C.x,C.y,je,x]),Ge=(0,I.useCallback)(e=>{if(!1===t.enableWheelZoom||!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=ie.current;if(!n)return;let r=n.getBoundingClientRect(),i=e.clientX-r.left-C.x,a=e.clientY-r.top-C.y,o=.01*-e.deltaY,s=qx(x+o,.5,3);if(s===x)return;let c=s/x;w({x:C.x-i*(c-1),y:C.y-a*(c-1)}),S(s)},[C,x]);ue.current||=Fv({getTranslate:()=>ye.current,setTranslate:e=>w(e),canStart:e=>!!oe.current?.querySelector(`svg`)&&(e.pointerType!==`touch`||xe.current||be.current>1),onActiveChange:e=>E(e)});let Ke=ue.current;(0,I.useEffect)(()=>()=>Ke.stop(),[Ke]);let qe=N||x>1,Je=(0,L.jsxs)(`div`,{className:`relative`,children:[t.showZoomControls&&(0,L.jsx)(`div`,{className:`absolute top-2 right-2 z-10 rounded-lg`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-2 backdrop-blur rounded-lg`,children:[(0,L.jsx)(`button`,{type:`button`,className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onMouseEnter:e=>Ie(e,n(`common.zoomIn`)),onMouseLeave:()=>ib(),onClick:()=>S(qx(x+.1,.5,3)),children:`+`}),(0,L.jsx)(`button`,{type:`button`,className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onMouseEnter:e=>Ie(e,n(`common.zoomOut`)),onMouseLeave:()=>ib(),onClick:()=>S(qx(x-.1,.5,3)),children:`−`}),(0,L.jsxs)(`button`,{type:`button`,className:hb(`p-2 text-xs rounded transition-colors`,t.isDark?`text-gray-400 hover:bg-gray-700`:`text-gray-600 hover:bg-gray-200`),onMouseEnter:e=>Ie(e,n(`common.resetZoom`)),onMouseLeave:()=>ib(),onClick:()=>{S(1),w({x:0,y:0})},children:[Math.round(100*x),`%`]})]})}),(0,L.jsxs)(`div`,{ref:ie,className:hb(`relative overflow-hidden block transition-[height] duration-150 ease-out`,t.isDark?`bg-gray-900`:`bg-gray-50`),style:{height:te,maxHeight:t.maxHeight??void 0,minHeight:`var(--ms-size-diagram-min-height, 360px)`,touchAction:qe?`none`:void 0},onWheel:Ge,onPointerDown:e=>Ke.start(e.nativeEvent),children:[(0,L.jsx)(`div`,{ref:ae,"data-mermaid-wrapper":!0,className:hb(`absolute inset-0 cursor-grab`,{"cursor-grabbing":T}),style:{transform:`translate(${C.x}px, ${C.y}px) scale(${x})`},children:(0,L.jsx)(`div`,{ref:oe,className:`_mermaid w-full text-center flex items-center justify-center min-h-full`})}),(D||Ce)&&(0,L.jsxs)(`div`,{className:`mermaid-loading`,children:[(0,L.jsx)(`span`,{className:`mermaid-spinner`}),(0,L.jsx)(`span`,{children:`Rendering diagram…`})]})]})]}),Ye=t.showHeader&&(0,L.jsxs)(`div`,{className:hb(`mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b`,t.isDark?`bg-gray-800 border-gray-700/30`:`bg-gray-50 border-gray-200`),children:[(0,L.jsxs)(`div`,{className:`flex items-center space-x-2 overflow-hidden`,children:[(0,L.jsx)(`span`,{className:`icon-slot h-4 w-4 flex-shrink-0`,dangerouslySetInnerHTML:{__html:r}}),(0,L.jsx)(`span`,{className:hb(`text-sm font-medium font-mono truncate`,t.isDark?`text-gray-400`:`text-gray-600`),children:`Mermaid`})]}),t.showModeToggle&&p&&(0,L.jsxs)(`div`,{className:hb(`flex items-center space-x-1 rounded-md p-0.5`,t.isDark?`bg-gray-700`:`bg-gray-100`),children:[(0,L.jsx)(`button`,{type:`button`,className:hb(`px-2.5 py-1 text-xs rounded transition-colors`,h?t.isDark?`text-gray-400 hover:text-gray-200`:`text-gray-500 hover:text-gray-700`:t.isDark?`bg-gray-600 text-gray-200 shadow-sm`:`bg-white text-gray-700 shadow-sm`),onClick:()=>We(`preview`),onMouseEnter:e=>Ie(e,n(`common.preview`)),onFocus:e=>Ie(e,n(`common.preview`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsxs)(`div`,{className:`flex items-center space-x-1`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),(0,L.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}),(0,L.jsx)(`span`,{children:n(`common.preview`)})]})}),(0,L.jsx)(`button`,{type:`button`,className:hb(`px-2.5 py-1 text-xs rounded transition-colors`,h?t.isDark?`bg-gray-600 text-gray-200 shadow-sm`:`bg-white text-gray-700 shadow-sm`:t.isDark?`text-gray-400 hover:text-gray-200`:`text-gray-500 hover:text-gray-700`),onClick:()=>We(`source`),onMouseEnter:e=>Ie(e,n(`common.source`)),onFocus:e=>Ie(e,n(`common.source`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsxs)(`div`,{className:`flex items-center space-x-1`,children:[(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m16 18l6-6l-6-6M8 6l-6 6l6 6`})}),(0,L.jsx)(`span`,{children:n(`common.source`)})]})})]}),(0,L.jsxs)(`div`,{className:`flex items-center space-x-1`,children:[t.showCollapseButton&&(0,L.jsx)(`button`,{type:`button`,className:Ue,"aria-pressed":_,onClick:()=>v(e=>!e),onMouseEnter:e=>Ie(e,n(_?`common.expand`:`common.collapse`)),onFocus:e=>Ie(e,n(_?`common.expand`:`common.collapse`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsx)(`svg`,{style:{rotate:_?`0deg`:`90deg`},xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m9 18l6-6l-6-6`})})}),t.showCopyButton&&(0,L.jsx)(`button`,{type:`button`,className:Ue,onClick:Le,onMouseEnter:e=>Ie(e,n(y?`common.copied`:`common.copy`)),onFocus:e=>Ie(e,n(y?`common.copied`:`common.copy`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsx)(`svg`,y?{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M20 6L9 17l-5-5`})}:{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})})}),t.showExportButton&&p&&(0,L.jsx)(`button`,{type:`button`,className:hb(Ue,He?`opacity-50 cursor-not-allowed`:``),disabled:He,onClick:Re,onMouseEnter:e=>Ie(e,n(`common.export`)),onFocus:e=>Ie(e,n(`common.export`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,children:[(0,L.jsx)(`path`,{d:`M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`path`,{d:`m7 10l5 5l5-5`})]})})}),t.showFullscreenButton&&p&&(0,L.jsx)(`button`,{type:`button`,className:hb(Ue,He?`opacity-50 cursor-not-allowed`:``),disabled:He,onClick:N?Be:Ve,onMouseEnter:e=>Ie(e,n(N?`common.minimize`:`common.open`)),onFocus:e=>Ie(e,n(N?`common.minimize`:`common.open`)),onMouseLeave:()=>ib(),onBlur:()=>ib(),children:(0,L.jsx)(`svg`,N?{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6`})}:{xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":`true`,role:`img`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,className:`w-3 h-3`,children:(0,L.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6`})})})]})]}),Xe=(0,L.jsxs)(`div`,{children:[h?(0,L.jsx)(`div`,{className:hb(`p-4`,t.isDark?`bg-gray-900 text-gray-300`:`bg-gray-50 text-gray-700`),children:(0,L.jsx)(`pre`,{className:`text-sm font-mono whitespace-pre-wrap`,children:a})}):Je,j&&(0,L.jsx)(`div`,{className:`mermaid-error`,children:j})]});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{"data-markstream-mermaid":`1`,"data-markstream-mode":h?`source`:k?`preview`:`pending`,className:hb(`my-4 rounded-lg border overflow-hidden shadow-sm mermaid-block`,t.isDark?`border-gray-700/30`:`border-gray-200`,{"is-rendering":Ce}),children:[Ye,(0,L.jsx)(`div`,{ref:se,style:{display:_?`none`:``},children:Xe})]}),N&&typeof document<`u`&&(0,P_.createPortal)((0,L.jsx)(`div`,{className:`markstream-react mermaid-modal-overlay`,onClick:()=>Be(),children:(0,L.jsxs)(`div`,{className:hb(`mermaid-modal-panel`,{"is-dark":t.isDark}),role:`dialog`,"aria-modal":`true`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`mermaid-modal-header`,children:[(0,L.jsx)(`span`,{className:`mermaid-modal-title`,children:`Mermaid ${n(`common.preview`)}`}),(0,L.jsx)(`button`,{type:`button`,className:`mermaid-modal-close`,onClick:Be,children:n(`common.close`)})]}),(0,L.jsx)(`div`,{className:`mermaid-modal-body`,children:(0,L.jsx)(`div`,{ref:ce,className:`mermaid-modal-content`})})]})}),document.body)]})}function qx(e,t,n){return Math.min(Math.max(e,t),n)}async function Jx(e,t,n){try{if(await Mx(e,t,n.workerTimeout))return!0}catch(e){if(e?.name===`AbortError`)throw e}if(!n.mermaid)throw Error(`Mermaid not available`);let r=Yx(e,t),i=n.mermaid;if(typeof i.parse==`function`)return await $x(()=>i.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;let a=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await $x(()=>i.render(a,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}function Yx(e,t){return Nre(e,`%%{init: {"theme": "${t===`dark`?`dark`:`default`}"}}%%\n`)}function Xx(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(!(!e||e.startsWith(`%%`)))return(e.match(/^([A-Z][\w-]*)\b/i)?.[1])?.toLowerCase()||``}return``}function Zx(e){let t=e.trim();return!(!t||t.startsWith(`%%`))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(`:`)}function Qx(e){if(Xx(e)===`gantt`)return function(e){let t=e.split(/\r?\n/);for(!/\r?\n$/.test(e)&&t.length>0&&t.pop();t.length>0;){let e=t[t.length-1]?.trim();if(e&&!e.startsWith(`%%`)){if(Zx(e))break;t.pop()}else t.pop()}return t.some(Zx)?t.join(`
181
181
  `):``}(e);let t=e.split(`
182
182
  `);for(;t.length>0;){let e=t[t.length-1].trimEnd();if(e!==``){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join(`
183
183
  `)}async function $x(e,t={}){let{timeoutMs:n,signal:r}=t;return r?.aborted?Promise.reject(new DOMException(`Aborted`,`AbortError`)):new Promise((t,i)=>{let a=!1,o=null;function s(){a||(a=!0,c(),i(new DOMException(`Aborted`,`AbortError`)))}function c(){o!=null&&clearTimeout(o),r&&r.removeEventListener(`abort`,s)}r&&r.addEventListener(`abort`,s,{once:!0}),n&&n>0&&(o=setTimeout(()=>{a||(a=!0,c(),i(Error(`Operation timed out`)))},n)),e().then(e=>{a||(a=!0,c(),t(e))}).catch(e=>{a||(a=!0,c(),i(e))})})}function eS(e){return new XMLSerializer().serializeToString(e)}function tS(e){let{node:t}=e;return(0,L.jsxs)(`div`,{className:`unknown-node text-sm text-gray-500 italic`,children:[`Unsupported node type:`,` `,String(t?.type)]})}function nS(e){return e?.type===`text`&&String(e?.content??``).trim()===``}function rS(e,t,n,r){let i=e.filter(e=>!nS(e)),a=i.length>0&&i.every(e=>e.type===`image`||function(e){let t=function(e){return e?.type===`link`&&Array.isArray(e?.children)?e.children.filter(e=>!nS(e)):[]}(e);return t.length===1&&t[0]?.type===`image`}(e));if(!a||i.length<=1)return L_(e,n,r,t);let o=[];for(let t=0;t<e.length;t++){let n=e[t];if(!nS(n)){o.push(n);continue}let r=o.length>0,i=e.slice(t+1).some(e=>!nS(e));r&&i&&o.push({...n,content:` `,raw:` `})}return o.map((e,i)=>a&&nS(e)?(0,L.jsx)(I.Fragment,{children:String(e?.content??``)},`${r}-${i}`):t(e,`${r}-${i}`,n))}function iS(e){let{node:t,ctx:n,renderNode:r,indexKey:i,children:a}=e;if(!n||!r)return(0,L.jsx)(`p`,{dir:`auto`,className:`paragraph-node`,children:a});let o=t.children??[],s={...n.customComponents??G_(n.customId),...n.htmlComponents??{},...n.streamingComponents??{}},c=[],l=[],u=()=>{if(!l.length)return;let e=c.length;c.push((0,L.jsx)(`p`,{dir:`auto`,className:`paragraph-node`,children:rS(l.slice(),r,n,`${String(i??`paragraph`)}-${e}`)},`${String(i??`paragraph`)}-inline-${e}`)),l.length=0};return o.forEach((e,t)=>{let a=(n.htmlPolicy??`safe`)!==`escape`||e.type!==`html_inline`&&e.type!==`html_block`;xre.has(e.type)||a&&jre(e,s,n.customHtmlTags)?(u(),c.push((0,L.jsx)(I.Fragment,{children:r(e,`${String(i??`paragraph`)}-block-${t}`,n)},`${String(i??`paragraph`)}-block-${t}`))):l.push(e)}),u(),c.length?(0,L.jsx)(L.Fragment,{children:c}):(0,L.jsx)(`p`,{dir:`auto`,className:`paragraph-node`,children:rS(o,r,n,String(i??`paragraph`))})}function aS(e){let{node:t}=e,n=(0,I.useCallback)(n=>{var r;(r=e.onClick)==null||r.call(e,n,t.id,e.messageId,e.threadId)},[t.id,e]);return(0,L.jsx)(`span`,{className:`reference-node cursor-pointer bg-[hsl(var(--muted))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]`,role:`button`,tabIndex:0,onClick:n,onMouseEnter:n=>{var r;(r=e.onMouseEnter)==null||r.call(e,n,t.id,e.messageId,e.threadId)},onMouseLeave:n=>{var r;(r=e.onMouseLeave)==null||r.call(e,n,t.id,e.messageId,e.threadId)},onKeyDown:e=>{e.key!==`Enter`&&e.key!==` `||n(e)},children:t.id})}function oS(e){return(0,L.jsx)(`s`,{className:`strikethrough-node`,children:e.children})}function sS(e){return(0,L.jsx)(`strong`,{className:`strong-node`,children:e.children})}function cS(e){return(0,L.jsx)(`sub`,{className:`subscript-node`,children:e.children})}function lS(e){return(0,L.jsx)(`sup`,{className:`superscript-node`,children:e.children})}function Yie(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e,a=Array.isArray(t?.header?.cells)?t.header.cells:[],o=!!t?.loading,s=Array.isArray(t?.rows)?t.rows:[],c=I.useRef(null),l=I.useRef(null),u=I.useRef(null),[d,f]=I.useState([]),p=e=>e===`right`?`text-right`:e===`center`?`text-center`:`text-left`,m=()=>{let e=u.current;e&&(window.removeEventListener(`pointermove`,e.move),window.removeEventListener(`pointerup`,e.stop),window.removeEventListener(`pointercancel`,e.stop),u.current=null),l.current=null};return I.useEffect(()=>(m(),f([]),m),[a.length]),(0,L.jsxs)(`div`,{className:`table-node-wrapper`,"data-index-key":i,children:[(0,L.jsxs)(`table`,{ref:c,className:hb(`my-8 text-sm table-node`,o&&`table-node--loading`),"aria-busy":o,children:[d.length>0&&(0,L.jsx)(`colgroup`,{children:a.map((e,t)=>(0,L.jsx)(`col`,{style:d[t]>0?{width:`${d[t]}px`}:void 0},`col-${t}`))}),(0,L.jsx)(`thead`,{className:`border-[var(--table-border,#cbd5e1)]`,children:(0,L.jsx)(`tr`,{className:`border-b`,children:a.map((e,t)=>(0,L.jsxs)(`th`,{className:hb(`font-semibold p-[calc(4/7*1em)]`,p(e.align)),dir:`auto`,children:[n&&r?R_(e.children,n,`${String(i??`table`)}-th-${t}`,r):null,t<a.length-1&&(0,L.jsx)(`button`,{type:`button`,className:`table-node__resize-handle`,"aria-label":`Resize columns ${t+1} and ${t+2}`,onPointerDown:e=>((e,t)=>{if(t.button!==0)return;let n=(()=>{let e=c.current?.querySelectorAll(`thead th`);return Array.from(e??[],e=>Math.round(e.getBoundingClientRect().width))})(),r=n[e],i=n[e+1];if(!r||!i)return;t.preventDefault(),m(),l.current={index:e,startX:t.clientX,startWidth:r,nextStartWidth:i,widths:n},f(n);let a=e=>{let t=l.current;if(!t)return;e.preventDefault();let n=t.startWidth+t.nextStartWidth,r=Math.min(48,Math.floor(n/2)),i=Math.max(r,Math.min(n-r,Math.round(t.startWidth+e.clientX-t.startX))),a=[...t.widths];a[t.index]=i,a[t.index+1]=n-i,f(a)},o=()=>{m()};u.current={move:a,stop:o},window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)})(t,e)})]},`header-${t}`))})}),(0,L.jsx)(`tbody`,{children:s.map((e,t)=>(0,L.jsx)(`tr`,{className:hb(`border-[var(--table-border,#cbd5e1)]`,t<s.length-1&&`border-b`),children:e.cells?.map((e,a)=>(0,L.jsx)(`td`,{className:hb(`p-[calc(4/7*1em)]`,p(e.align)),dir:`auto`,children:n&&r?R_(e.children,n,`${String(i??`table`)}-row-${t}-${a}`,r):null},`cell-${t}-${a}`))},`row-${t}`))})]}),o&&(0,L.jsxs)(`div`,{className:`table-node__loading`,role:`status`,"aria-live":`polite`,children:[(0,L.jsx)(`span`,{className:`table-node__spinner`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Loading`})]})]})}function Xie(){return(0,L.jsx)(`hr`,{className:`hr-node thematic-break`})}function Zie(e){let{node:t,ctx:n,renderNode:r,indexKey:i}=e,a=`vmr-container vmr-container-${t.name}`,o=(0,I.useMemo)(()=>{if(t.attrs)return Array.isArray(t.attrs)?I_(t.attrs):t.attrs},[t.attrs]);return(0,L.jsx)(`div`,{className:a,...o,children:n&&r&&Array.isArray(t.children)?t.children.map((e,t)=>(0,L.jsx)(I.Fragment,{children:r(e,`${String(i??`vmr-container`)}-${t}`,n)},`${String(i??`vmr-container`)}-${t}`)):null})}function uS(e,t,n,r,i={}){let a=Pv(r.codeBlockProps),o=r.events.onHandleArtifactClick?e=>{var i,a;let o=e.type===`image/svg+xml`?`image/svg+xml`:`text/html`;(a=(i=r.events).onHandleArtifactClick)==null||a.call(i,{node:e.content==null?t:{...t,code:e.content},artifactType:o,artifactTitle:e.title||(o===`image/svg+xml`?`SVG Preview`:`HTML Preview`),id:String(n)})}:void 0;return I.createElement(e,{key:n,node:t,loading:!!t.loading,stream:r.codeBlockStream,customId:r.customId,isDark:r.isDark,darkTheme:r.codeBlockThemes?.darkTheme,lightTheme:r.codeBlockThemes?.lightTheme,themes:r.codeBlockThemes?.themes,minWidth:r.codeBlockThemes?.minWidth,maxWidth:r.codeBlockThemes?.maxWidth,onCopy:r.events.onCopy,onPreviewCode:o,...a,codeBlockOptions:r.codeBlockOptions,...i,ctx:r,renderNode:fS,indexKey:n,typewriter:r.typewriter,fade:r.fade})}function dS(e,t,n,r,i={}){return I.createElement(e,{key:n,node:t,isDark:r.isDark,...i})}function fS(e,t,n){let r=n.customComponents??G_(n.customId),i=n.streamingComponents??{},a=n.htmlComponents??{},o=function(e){if(e.type===`html_block`||e.type===`html_inline`)return``;let t=Nl(e.type),n=Nl(e.tag);return t&&n&&t===n?t:``}(e),s=o?i[o]:null,c=o&&!s?a[o]:null,l=e.type===`code_block`?null:r[e.type];if(s)return I.createElement(s,{key:t,node:e,customId:n.customId,isDark:n.isDark,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade});if(c)return function(e,t,n,r,i){let a=h_(p_(m_(t.attrs??void 0,r.htmlPolicy??`safe`,i))),o=Array.isArray(t.children)?L_(t.children,r,`${String(n)}-html`,fS):t.content??null;return I.createElement(e,{...a,key:n},o)}(c,e,t,n,o);if(l)return I.createElement(l,{key:t,node:e,customId:n.customId,isDark:n.isDark,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade});if(e.type===`html_block`||e.type===`html_inline`){let a=Nv(e,{...r,...i},n.customHtmlTags),o=String(e.tag??``).trim().toLowerCase()||Il(e.content),s=a?.tag??o;if(s){let i=a?.component??r[s],o=a?.isWhitelisted??(n.customHtmlTags??[]).some(e=>e.toLowerCase()===s);if(o&&i){let r={...e,type:s,tag:s,content:zl(e.content,s)};return I.createElement(i,{key:t,node:r,customId:n.customId,isDark:n.isDark,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade})}let c=String(e.content??e.raw??``);if(!o&&Rl(c,s))return e.type===`html_inline`?(0,L.jsx)(nx,{node:{type:`text`,content:c,raw:c},ctx:n,indexKey:t,typewriter:n.typewriter,fade:n.fade},t):(0,L.jsx)(iS,{node:{type:`paragraph`,children:[{type:`text`,content:c,raw:c}],raw:c},ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t)}}switch(e.type){case`text`:return(0,L.jsx)(nx,{node:e,ctx:n,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`text_special`:return(0,L.jsx)(nx,{node:{type:`text`,content:e.content??``,center:e.center},ctx:n,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`paragraph`:return(0,L.jsx)(iS,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`heading`:return(0,L.jsx)(kb,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`blockquote`:return(0,L.jsx)(rae,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`list`:return(0,L.jsx)(ax,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`list_item`:return(0,L.jsx)(ix,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`table`:return(0,L.jsx)(Yie,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`definition_list`:return(0,L.jsx)(bb,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`footnote`:return(0,L.jsx)(Eb,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`footnote_reference`:return(0,L.jsx)(Db,{node:e},t);case`footnote_anchor`:return(0,L.jsx)(Tb,{node:e},t);case`admonition`:return(0,L.jsx)(Mie,{node:e,ctx:n,renderNode:fS,indexKey:t,isDark:n.isDark,typewriter:n.typewriter,fade:n.fade},t);case`hardbreak`:return(0,L.jsx)(Ob,{node:e,typewriter:n.typewriter,fade:n.fade},t);case`link`:return(0,L.jsx)(rx,{node:e,ctx:n,renderNode:fS,indexKey:t,isDark:n.isDark,showTooltip:typeof n.showTooltips==`boolean`?n.showTooltips:void 0,typewriter:n.typewriter,fade:n.fade},t);case`image`:return(0,L.jsx)(Gb,{node:e},t);case`inline_code`:return(0,L.jsx)(Qb,{node:e,ctx:n,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`code_block`:return function(e,t,n,r){let i=function(e){let t=String(e?.language||``).trim();if(!t)return``;let[n]=t.split(/\s+/),[r]=n.split(`:`);return r.toLowerCase()}(e),a=Q_(i),o=function(e,t){let n=t.trim().toLowerCase();if(!n)return null;for(let t of[n,Q_(n),Ire(n)]){let n=t&&e[t];if(n)return n}return null}(r,i);if(a===`mermaid`){let i=function(e,t){let n={...t.mermaidProps||{}};return Av(n.estimatedPreviewHeightPx)??(n.estimatedPreviewHeightPx=Mv(jv(String(e?.code??``)),void 0,n.maxHeight===`none`?null:Av(n.maxHeight)??void 0)),n}(e,n),a=o||r.mermaid;if(a)return dS(a,e,t,n,i);if(!n.renderCodeBlocksAsPre)return(0,L.jsx)(Kx,{node:e,isDark:n.isDark,loading:!!e.loading,...i},t)}if(a===`infographic`){let i=function(e,t){let n={...t.infographicProps||{}};return Ev(n.estimatedPreviewHeightPx)??(n.estimatedPreviewHeightPx=Ov(Dv(String(e?.code??``)),void 0,n.maxHeight===`none`?null:Ev(n.maxHeight)??void 0)),n}(e,n),a=o||r.infographic;return a?dS(a,e,t,n,i):(0,L.jsx)(Xb,{node:e,isDark:n.isDark,loading:!!e.loading,...i},t)}if(a===`d2`||a===`d2lang`){let i=o||r.d2;return i?dS(i,e,t,n,n.d2Props||{}):(0,L.jsx)(yb,{node:e,isDark:n.isDark,loading:!!e.loading,...n.d2Props||{}},t)}if(o)return uS(o,e,t,n);let s=r.code_block;if(s)return uS(s,e,t,n);if(n.renderCodeBlocksAsPre||a===`mermaid`){let r=n.codeBlockProps?.showLineNumbers,i=n.codeBlockOptions?.disableLineNumbers,a=n.codeBlockOptions?.overflow;return(0,L.jsx)(fv,{node:e,style:a?{whiteSpace:a===`scroll`?`pre`:`pre-wrap`}:void 0,showLineNumbers:typeof r==`boolean`?r:typeof i==`boolean`&&!i},t)}return(0,L.jsx)(Vie,{node:e,loading:!!e.loading,stream:n.codeBlockStream,themes:n.codeBlockThemes?.themes,darkTheme:n.codeBlockThemes?.darkTheme,lightTheme:n.codeBlockThemes?.lightTheme,minWidth:n.codeBlockThemes?.minWidth,maxWidth:n.codeBlockThemes?.maxWidth,isDark:n.isDark,onCopy:n.events.onCopy,...Pv(n.codeBlockProps),codeBlockOptions:n.codeBlockOptions},t)}(e,t,n,r);case`strong`:return(0,L.jsx)(sS,{node:e,children:L_(e.children,n,`${String(t)}-strong`,fS)},t);case`emphasis`:return(0,L.jsx)(Sb,{node:e,children:L_(e.children,n,`${String(t)}-em`,fS)},t);case`strikethrough`:return(0,L.jsx)(oS,{node:e,children:L_(e.children,n,`${String(t)}-strike`,fS)},t);case`highlight`:return(0,L.jsx)(Ab,{node:e,children:L_(e.children,n,`${String(t)}-highlight`,fS)},t);case`insert`:return(0,L.jsx)($b,{node:e,children:L_(e.children,n,`${String(t)}-insert`,fS)},t);case`subscript`:return(0,L.jsx)(cS,{node:e,children:L_(e.children,n,`${String(t)}-sub`,fS)},t);case`superscript`:return(0,L.jsx)(lS,{node:e,children:L_(e.children,n,`${String(t)}-sup`,fS)},t);case`checkbox`:case`checkbox_input`:return(0,L.jsx)(Iie,{node:e,typewriter:n.typewriter,fade:n.fade},t);case`emoji`:return(0,L.jsx)(xb,{node:e,typewriter:n.typewriter,fade:n.fade},t);case`thematic_break`:return(0,L.jsx)(Xie,{},t);case`math_inline`:return(0,L.jsx)(wx,{node:e},t);case`math_block`:return(0,L.jsx)(Cx,{node:e},t);case`reference`:return(0,L.jsx)(aS,{node:e,ctx:n,typewriter:n.typewriter,fade:n.fade},t);case`html_block`:case`html_inline`:return e.type===`html_block`?(0,L.jsx)(jb,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade,customId:n.customId},t):(0,L.jsx)(Hb,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade,customId:n.customId},t);case`vmr_container`:return(0,L.jsx)(Zie,{node:e,ctx:n,renderNode:fS,indexKey:t,typewriter:n.typewriter,fade:n.fade},t);case`label_open`:case`label_close`:return null;default:return(0,L.jsx)(tS,{node:e},t)}}var Qie={codeBlockStream:!0,typewriter:!1,fade:!0,smoothStreaming:`auto`,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},$ie=N_();function eae(e,t){return e.type===t.type&&e.raw===t.raw&&e.loading===t.loading&&e.autoClosed===t.autoClosed&&!!function(e,t){if(e===t)return!0;if(!e||!t||typeof e!=`object`||typeof t!=`object`)return!1;let n=e,r=t;return n.startLine===r.startLine&&n.endLine===r.endLine}(e.sourceMap,t.sourceMap)&&(e.type!==`code_block`&&t.type!==`code_block`||e.diff===t.diff)}function pS(e){let t=(0,I.useMemo)(()=>wre(e),[e]),n=(0,I.useRef)(t);return function(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}(n.current,t)||(n.current=t),n.current}var tae=I.memo(({node:e,nodeKey:t,renderCtx:n})=>fS(e,t,n),(e,t)=>e.node===t.node&&e.renderCtx===t.renderCtx&&e.nodeKey===t.nodeKey),nae=I.memo(({props:e,parsedNodes:t,renderCtx:n,indexPrefix:r,containerRef:i,showTypewriterCursor:a,typewriterCursorRef:o})=>{let s=Gy(),c=typeof window<`u`,l=typeof window<`u`&&typeof window.requestIdleCallback==`function`,u=Math.max(0,Math.trunc(e.renderBatchSize??80)),d=Math.max(0,Math.trunc(e.initialRenderBatchSize??(u||t.length))),f=!1!==e.batchRendering&&u>0&&c,p=Math.max(0,e.liveNodeBuffer??60),m=Math.max(1,e.maxLiveNodes??320),h=(e.maxLiveNodes??0)>0&&t.length>m,g=!1!==e.viewportPriority,_=f&&(e.maxLiveNodes??0)<=0,v=(0,I.useMemo)(()=>!1!==e.deferNodesUntilVisible&&!((e.maxLiveNodes??0)<=0)&&!h&&!(t.length>900)&&g,[t.length,e.deferNodesUntilVisible,e.maxLiveNodes,g,h]),[y,b]=(0,I.useState)(()=>_?Math.min(t.length,d):t.length),x=(0,I.useRef)(y);(0,I.useEffect)(()=>{x.current=y},[y]);let S=_?y:t.length,[C,w]=(0,I.useState)(0),[T,E]=(0,I.useState)({start:0,end:t.length}),D=(0,I.useRef)(new Map),[O,k]=(0,I.useState)(0),A=(0,I.useRef)({}),j=(0,I.useRef)(new Map),M=(0,I.useRef)(new Map),N=(0,I.useRef)(new Map),ee=(0,I.useRef)(new Map),te=(0,I.useRef)(new Set),P=(0,I.useRef)(y),F=(0,I.useRef)(null),ne=(0,I.useRef)(null),re=(0,I.useRef)(null),ie=(0,I.useRef)(!1),ae=(0,I.useRef)(null),oe=(0,I.useRef)(Math.max(1,u||1)),se=(0,I.useRef)(t.length),ce=(0,I.useRef)({key:e.indexKey,total:t.length}),le=(0,I.useRef)(t),ue=(0,I.useRef)({batchSize:u,initial:d,delay:e.renderBatchDelay??16,enabled:_}),de=v||h,fe=(0,I.useMemo)(()=>{let e=D.current;if(!e.size)return 32;let t=0;for(let n of e.values())t+=n;return Math.max(16,t/e.size)},[O]),pe=(0,I.useMemo)(()=>{if(!h)return t.map((e,t)=>({node:e,index:t}));let e=t.length,n=Math.max(0,Math.min(T.start,e)),r=Math.max(n,Math.min(T.end,e));return t.slice(n,r).map((e,t)=>({node:e,index:n+t}))},[t,T,h]);se.current=(0,I.useMemo)(()=>{if(!h)return t.length;let e=Math.max(T.end+p,d),n=Math.min(t.length,e);return Math.max(y,n)},[t.length,h,T.end,p,d,y]);let me=(0,I.useCallback)((e,t)=>{if(e>=t)return 0;let n=D.current,r=0;for(let i=e;i<t;i++)r+=n.get(i)??fe;return r},[fe]),he=h?me(0,Math.min(T.start,t.length)):0,ge=h?me(Math.min(T.end,t.length),t.length):0,_e=(0,I.useCallback)(()=>{F.current!=null&&typeof cancelAnimationFrame==`function`&&(cancelAnimationFrame(F.current),F.current=null),ne.current!=null&&(window.clearTimeout(ne.current),ne.current=null),re.current!=null&&typeof window.cancelIdleCallback==`function`&&(window.cancelIdleCallback(re.current),re.current=null),ie.current=!1,ae.current=null},[]),ve=(0,I.useCallback)(t=>{if(!_)return;let n=Math.max(2,e.renderBatchBudgetMs??6),r=Math.max(1,u||1),i=Math.max(1,Math.floor(r/4));t>1.2*n?oe.current=Math.max(i,Math.floor(.7*oe.current)):t<.5*n&&oe.current<r&&(oe.current=Math.min(r,Math.ceil(1.2*oe.current)))},[_,e.renderBatchBudgetMs,u]),ye=(0,I.useCallback)((t,n={})=>{if(!_)return;let r=se.current;if(x.current>=r)return;let i=Math.max(1,t),a=e=>{let t=typeof performance<`u`?performance.now():Date.now();b(t=>{let n=Math.min(se.current,t+Math.max(1,e));return x.current=n,n});let n=typeof performance<`u`?performance.now():Date.now();ve(n-t)},o=()=>{let e=Math.max(1,Math.round(oe.current));ye(e)},s=t=>{F.current=null,ne.current=null,re.current=null,ie.current=!1;let n=ae.current;if(ae.current=null,a(n??i),x.current>=se.current)return;if(!t)return void o();let r=Math.max(2,e.renderBatchBudgetMs??6);for(;x.current<se.current&&!((typeof t.timeRemaining==`function`?t.timeRemaining():0)<=.5*r);)a(Math.max(1,Math.round(oe.current)));x.current<se.current&&o()};if(!c||n.immediate)return void s();let u=Math.max(0,e.renderBatchDelay??16);if(ae.current=ae.current==null?i:Math.max(ae.current,i),!ie.current){if(ie.current=!0,l){let t=Math.max(0,e.renderBatchIdleTimeoutMs??120);re.current=window.requestIdleCallback(e=>s(e),{timeout:t});return}typeof requestAnimationFrame==`function`?F.current=requestAnimationFrame(()=>{u===0?s():ne.current=window.setTimeout(()=>s(),u)}):ne.current=window.setTimeout(()=>s(),u)}},[ve,l,_,c,e.renderBatchDelay,e.renderBatchBudgetMs,e.renderBatchIdleTimeoutMs]);(0,I.useEffect)(()=>{let n=e.indexKey,r=t.length,i=ce.current,a=n===void 0?r!==i.total:n!==i.key,o=le.current,s=Math.min(o.length,t.length),l=0;for(;l<s&&o[l]===t[l];)l+=1;ce.current={key:n,total:r};let f=ue.current,p=e.renderBatchDelay??16,m=f.batchSize!==u||f.initial!==d||f.delay!==p||f.enabled!==_;if(ue.current={batchSize:u,initial:d,delay:p,enabled:_},(a||m||!_)&&_e(),(a||m)&&(oe.current=Math.max(1,u||1)),n!==i.key)te.current.clear();else if(a)for(let e of te.current)e>=l&&te.current.delete(e);if(!r)return x.current=0,void b(0);let h=se.current;if(!_)return x.current=h,void b(h);if(a||m){let e=Math.min(h,d);x.current=e,b(e),e<h&&ye(Math.max(1,d),{immediate:!c});return}let g=Math.min(x.current,h);g!==x.current&&(x.current=g,b(g)),x.current<h&&ye(Math.max(1,u||1))},[_e,_,c,t.length,e.indexKey,e.renderBatchDelay,u,d,ye]),(0,I.useEffect)(()=>{le.current=t},[t]),(0,I.useEffect)(()=>{if(!h)return void E({start:0,end:t.length});let e=t.length;if(!e)return void E({start:0,end:0});let n=Math.max(0,Math.min(C,e-1)),r=Math.max(0,n-p),i=Math.min(e,n+p+1),a=i-r;if(a>m){let e=a-m;r+=Math.ceil(e/2),i-=Math.floor(e/2)}else if(a<m){let t=m-a;r=Math.max(0,r-Math.ceil(t/2)),i=Math.min(e,i+Math.floor(t/2))}E({start:r,end:i})},[C,p,m,t.length,h]),(0,I.useEffect)(()=>()=>{_e();for(let e of j.current.values())e.destroy();j.current.clear()},[_e]);let be=(0,I.useCallback)(e=>{for(let[t,n]of j.current.entries())t>=e&&(n.destroy(),j.current.delete(t),delete A.current[t],M.current.delete(t),N.current.delete(t),ee.current.delete(t))},[]);(0,I.useEffect)(()=>{be(S)},[be,S]),(0,I.useEffect)(()=>{let e=t.length,n=!1;for(let t of Array.from(D.current.keys()))t>=e&&(D.current.delete(t),n=!0);n&&k(e=>e+1);for(let t of Object.keys(A.current))Number(t)>=e&&delete A.current[t];for(let t of Array.from(te.current))t>=e&&te.current.delete(t)},[t.length]);let xe=(0,I.useCallback)((e,t)=>{v&&t&&(A.current[e]=!0),t&&h&&w(t=>e>t?e:t)},[v,h]),Se=(0,I.useCallback)(e=>{let t=j.current.get(e);t&&(t.destroy(),j.current.delete(e))},[]),Ce=(0,I.useCallback)((e,t)=>{let n=M.current;if(t?n.set(e,t):n.delete(e),!de||!t)return Se(e),v&&!t&&delete A.current[e],void(t&&xe(e,!0));if(e<d&&!h)return Se(e),void xe(e,!0);Se(e);let r=s(t,{rootMargin:`400px`});j.current.set(e,r),r.isVisible()&&xe(e,!0),r.whenVisible.then(()=>xe(e,!0)).catch(()=>{})},[v,Se,xe,s,d,de,h]),we=(0,I.useCallback)(e=>{let t=N.current.get(e);if(t)return t;let n=t=>Ce(e,t);return N.current.set(e,n),n},[Ce]),Te=(0,I.useCallback)((e,t)=>{if(!t)return void(D.current.has(e)&&(D.current.delete(e),k(e=>e+1)));let n=()=>{let n=t.offsetHeight;n&&D.current.get(e)!==n&&(D.current.set(e,n),k(e=>e+1))};typeof queueMicrotask==`function`?queueMicrotask(n):Promise.resolve().then(n)},[]),Ee=(0,I.useCallback)(e=>{let t=ee.current.get(e);if(t)return t;let n=t=>Te(e,t);return ee.current.set(e,n),n},[Te]),De=(0,I.useCallback)(e=>!(_&&e>=x.current)&&(!v||e<d||!0===A.current[e]),[v,_,d]),Oe=(0,I.useCallback)(e=>t=>{if(!e)return;let n=t.target;n!=null&&n.closest(`[data-node-index]`)&&e(t)},[]);(0,I.useEffect)(()=>{for(let[e,t]of M.current.entries())t&&Ce(e,t)},[Ce]),(0,I.useEffect)(()=>{h&&y>P.current&&w(y-1),P.current=y},[y,h]);let ke=h?(0,L.jsx)(`div`,{className:`node-spacer`,style:{height:`${he}px`},"aria-hidden":`true`}):null,Ae=h?(0,L.jsx)(`div`,{className:`node-spacer`,style:{height:`${ge}px`},"aria-hidden":`true`}):null;return(0,L.jsxs)(`div`,{ref:i,className:`markstream-react markdown-renderer${e.isDark?` dark`:``}${h?` virtualized`:``}`,"data-custom-id":e.customId,onClick:e.onClick,onMouseOver:Oe(e.onMouseOver),onMouseOut:Oe(e.onMouseOut),children:[ke,pe.map(({node:t,index:i})=>{let a=De(i),o=D.current.get(i)??fe,s=!1!==e.fade&&t.type!==`code_block`&&!te.current.has(i)&&a;return s&&te.current.add(i),(0,L.jsx)(`div`,{ref:we(i),className:`node-slot`,"data-node-index":i,"data-node-type":t.type,children:(0,L.jsx)(`div`,a?{ref:Ee(i),className:`node-content`+(s?` fade-node typewriter-node`:``),children:(0,L.jsx)(tae,{node:t,nodeKey:`${r}-${i}`,renderCtx:n})}:{className:`node-placeholder`,style:{height:`${o}px`}})},`${r}-${i}`)}),Ae,a&&(0,L.jsx)(`span`,{ref:o,className:`typewriter-cursor`,"aria-hidden":`true`})]})},function(e,t){if(e.renderCtx!==t.renderCtx||e.indexPrefix!==t.indexPrefix||e.containerRef!==t.containerRef||e.showTypewriterCursor!==t.showTypewriterCursor)return!1;let n=e.parsedNodes,r=t.parsedNodes;if(n===r)return!0;if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;let i=e.props,a=t.props;return i.isDark===a.isDark&&i.typewriter===a.typewriter&&i.fade===a.fade&&i.batchRendering===a.batchRendering&&i.initialRenderBatchSize===a.initialRenderBatchSize&&i.renderBatchSize===a.renderBatchSize&&i.renderBatchDelay===a.renderBatchDelay&&i.renderBatchBudgetMs===a.renderBatchBudgetMs&&i.renderBatchIdleTimeoutMs===a.renderBatchIdleTimeoutMs&&i.deferNodesUntilVisible===a.deferNodesUntilVisible&&i.maxLiveNodes===a.maxLiveNodes&&i.liveNodeBuffer===a.liveNodeBuffer&&i.viewportPriority===a.viewportPriority&&i.indexKey===a.indexKey&&i.onClick===a.onClick&&i.onMouseOver===a.onMouseOver&&i.onMouseOut===a.onMouseOut});function mS(e){let t={...Qie,...e},n=(0,I.useRef)(null),r=(0,I.useRef)(new Map),i=(0,I.useRef)(0),a=(0,I.useRef)(null),o=Fie(t.smoothStreamingOptions),s=I.useContext(By),c=(0,I.useRef)(new Set),[l,u]=(0,I.useState)(()=>!0===t.smoothStreaming);(0,I.useEffect)(()=>{u(!0)},[]);let d=Array.isArray(t.nodes)&&t.nodes.length>0,f=(0,I.useMemo)(()=>!1!==t.smoothStreaming&&!d&&(!0===t.smoothStreaming||!s)&&(!0===t.smoothStreaming||!0===t.typewriter||(t.maxLiveNodes??0)<=0),[d,s,t.maxLiveNodes,t.smoothStreaming,t.typewriter]),p=l&&f,m=p?o.visible:t.content??``,h=(0,I.useMemo)(()=>{let e=t.parseOptions??{};return t.final??e.final},[t.final,t.parseOptions]),g=t.content??``,_=d||o.source===g,v=(0,I.useMemo)(()=>p&&h!=null?!!(h&&_&&o.caughtUp):h,[h,_,o.caughtUp,p]),y=(0,I.useRef)(null),[b,x]=(0,I.useState)(!1),S=(0,I.useRef)(void 0),C=(0,I.useRef)(0),w=(0,I.useMemo)(()=>new Set([`code_block`,`admonition`,`table`,`math_block`,`html_block`,`image`]),[]),T=(0,I.useCallback)(e=>{if(!e||typeof e!=`object`)return!1;let t=e.type;return typeof t==`string`&&w.has(t)},[w]),E=(0,I.useCallback)(e=>{if(!e||typeof e!=`object`)return 0;let t=e,n=t.raw??t.content??t.code;if(typeof n==`string`)return n.length;let r=t.children;if(Array.isArray(r))return r.reduce((e,t)=>e+E(t),0);let i=t.items;return Array.isArray(i)?i.reduce((e,t)=>e+E(t),0):0},[]),D=(0,I.useCallback)(()=>t.nodes?.length?t.nodes.reduce((e,t)=>e+E(t),0):(t.content??``).length,[t.nodes,t.content,E]),O=(0,I.useCallback)(()=>{S.current&&=(clearTimeout(S.current),void 0)},[]),k=(0,I.useCallback)(e=>{let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){if(!(e.textContent??``).trim())return NodeFilter.FILTER_REJECT;let t=e.parentElement;return t?t.closest(`.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),n=null,r=t.nextNode();for(;r;)n=r,r=t.nextNode();return n},[]),A=(0,I.useCallback)(()=>{if(typeof window>`u`||!b||!n.current||!y.current)return;let e=n.current,t=y.current,r=k(e),i=e.getBoundingClientRect(),a=0,o=0,s=20;if(r?.textContent){let t=document.createRange(),n=r.textContent.length;t.setStart(r,Math.max(0,n-1)),t.setEnd(r,n);let c=typeof t.getClientRects==`function`?t.getClientRects():void 0,l=c?.[c.length-1]??r.parentElement?.getBoundingClientRect();l&&(a=l.right-i.left+e.scrollLeft,o=l.top-i.top+e.scrollTop,s=l.height||s),t.detach()}t.style.transform=`translate(${Math.max(0,a)}px, ${Math.max(0,o)}px)`,t.style.height=`${s}px`},[b,n,k]);(0,I.useEffect)(()=>{b&&requestAnimationFrame(()=>{A()})},[b,A]),(0,I.useEffect)(()=>()=>{O()},[O]);let j=d?t.nodes:m;a.current!==j&&(i.current+=1,a.current=j);let M=(0,I.useSyncExternalStore)(U_,W_,W_),N=(0,I.useMemo)(()=>G_(t.customId),[t.customId,M]),ee=pS(t.streamingComponents),te=pS(t.htmlComponents);(0,I.useEffect)(()=>{c.current},[te,ee]);let P=(0,I.useMemo)(()=>t.customId?`renderer-${t.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[t.customId]),F=(0,I.useMemo)(()=>{let e=(t.parseOptions??{}).customHtmlTags??[];return Fl(t.customHtmlTags,Array.isArray(e)?e:[],Object.keys(ee))},[t.customId,t.customHtmlTags,t.parseOptions,M,ee]),ne=(0,I.useMemo)(()=>{let e=F;return e&&e.length!==0?N_(P,{customHtmlTags:e}):N_(P)},[P,F]),re=(0,I.useMemo)(()=>{let e=ne;return t.customMarkdownIt?t.customMarkdownIt(e):e},[ne,t.customMarkdownIt]),ie=(0,I.useMemo)(()=>{let e=t.parseOptions??{},n=v,r=n!=null,i=F.length>0;return r||i?{...e,...r?{final:n}:{},...i?{customHtmlTags:F}:{}}:e},[F,v,t.parseOptions]),ae=(0,I.useMemo)(()=>{let e=!!t.debugPerformance&&typeof console<`u`&&typeof performance<`u`,n=e?performance.now():0,r=[];return d?r=t.nodes.map(e=>({...e})):m&&(r=Une(m,re??$ie,ie)),e&&console.info(`[markstream-react][perf] parse(sync)`,{ms:Math.round(performance.now()-n),nodes:r.length,contentLength:m.length}),r},[t.debugPerformance,m,d,t.nodes,ie,re,t.customId,M,F]),oe=(0,I.useCallback)(()=>{let e=ae[ae.length-1];return!T(e)},[ae,T]);(0,I.useEffect)(()=>{if(typeof window>`u`||d)return;if(v)return x(!1),void O();let e=D(),n=oe();return!1===t.typewriter||!n||e<=C.current?(!1!==t.typewriter&&n||x(!1),void(C.current=e)):(C.current=e,x(!0),O(),requestAnimationFrame(()=>{A()}),S.current=setTimeout(()=>{x(!1)},3e3),()=>{O()})},[m,t.nodes,t.typewriter,t.content,v,ae.length,d,D,oe,O,A]);let se=(0,I.useRef)([]),ce=ie?.postTransformNodes,le=(0,I.useRef)(ce);le.current!==ce&&(se.current=[],le.current=ce);let ue=function(e,t){if(!t.length)return e;let n=Array(e.length),r=e.length===t.length;for(let i=0;i<e.length;i++){let a=i<t.length?t[i]:null;a&&eae(a,e[i])?n[i]=a:(n[i]=e[i],r=!1)}return r?t:n}(ae,se.current);se.current=ue,(0,I.useEffect)(()=>{if(d)return void o.reset(``);let e=t.content??``;if(!p)return o.reset(e),void(h&&o.finish({flush:!0}));let n=o.getSnapshot().source;e?e===n||(e.startsWith(n)?o.enqueue(e.slice(n.length)):o.reset(e)):o.reset(``),h&&o.finish()},[d,t.content,h,p]),(0,I.useEffect)(()=>{if(typeof window>`u`||t.renderCodeBlocksAsPre||!ue.some(e=>e?.type===`code_block`&&Q_(String(e?.language??``))!==`mermaid`))return;let e=window.requestIdleCallback??((e,t)=>window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),t?.timeout??600)),n=window.cancelIdleCallback??(e=>window.clearTimeout(e)),r=e(()=>{lb()},{timeout:900});return()=>n(r)},[ue,t.renderCodeBlocksAsPre]);let de=(0,I.useMemo)(()=>t.indexKey==null?`markdown-renderer`:String(t.indexKey),[t.indexKey]),fe=(0,I.useMemo)(()=>({...typeof t.showTooltips==`boolean`?{showTooltips:t.showTooltips}:{},...t.codeBlockProps||{}}),[t.codeBlockProps,t.showTooltips]),pe=(0,I.useMemo)(()=>({...t.mermaidProps||{}}),[t.mermaidProps]),me=(0,I.useMemo)(()=>({...t.d2Props||{}}),[t.d2Props]),he=(0,I.useMemo)(()=>({...t.infographicProps||{}}),[t.infographicProps]),ge=(0,I.useMemo)(()=>({customId:t.customId,isDark:t.isDark,final:v,indexKey:de,typewriter:t.typewriter,fade:t.fade,textStreamState:r.current,streamRenderVersion:i.current,customComponents:N,streamingComponents:ee,htmlComponents:te,customHtmlTags:F,htmlPolicy:t.htmlPolicy??`safe`,showTooltips:t.showTooltips,renderCodeBlocksAsPre:t.renderCodeBlocksAsPre,codeBlockStream:t.codeBlockStream,codeBlockOptions:t.codeBlockOptions,codeBlockProps:fe,mermaidProps:pe,d2Props:me,infographicProps:he,codeBlockThemes:{themes:t.themes,darkTheme:t.codeBlockDarkTheme,lightTheme:t.codeBlockLightTheme,minWidth:t.codeBlockMinWidth,maxWidth:t.codeBlockMaxWidth},events:{onCopy:t.onCopy,onHandleArtifactClick:t.onHandleArtifactClick}}),[t.customId,t.isDark,v,de,t.typewriter,t.fade,t.showTooltips,t.htmlPolicy,t.renderCodeBlocksAsPre,t.codeBlockStream,t.codeBlockOptions,F,fe,pe,me,he,t.themes,t.codeBlockDarkTheme,t.codeBlockLightTheme,t.codeBlockMinWidth,t.codeBlockMaxWidth,t.onCopy,t.onHandleArtifactClick,N,ee,te]);ge.streamRenderVersion=i.current,ge.textStreamState=r.current;let _e=(0,I.useRef)(null);return _e.current||={textStreamState:r.current,getStreamRenderVersion:()=>i.current},(0,L.jsx)(Vy.Provider,{value:_e.current,children:(0,L.jsx)(By.Provider,{value:p,children:(0,L.jsx)(Pie,{getRoot:()=>n.current,enabled:!1!==t.viewportPriority,children:(0,L.jsx)(nae,{props:t,parsedNodes:ue,renderCtx:ge,indexPrefix:de,containerRef:n,showTypewriterCursor:b,typewriterCursorRef:y})})})})}function rae(e){let{node:t,ctx:n,renderNode:r,indexKey:i,children:a}=e;return(0,L.jsx)(`blockquote`,{className:`blockquote-node`,dir:`auto`,cite:t.cite,children:a??(n&&r?(0,L.jsx)(mS,{nodes:t.children||[],indexKey:`blockquote-${String(i??`blockquote`)}`,customId:n.customId,isDark:n.isDark,typewriter:n.typewriter,viewportPriority:!0,codeBlockStream:n.codeBlockStream,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockOptions:n.codeBlockOptions,codeBlockProps:n.codeBlockProps,themes:n.codeBlockThemes?.themes,codeBlockDarkTheme:n.codeBlockThemes?.darkTheme,codeBlockLightTheme:n.codeBlockThemes?.lightTheme,codeBlockMinWidth:n.codeBlockThemes?.minWidth,codeBlockMaxWidth:n.codeBlockThemes?.maxWidth,htmlPolicy:n.htmlPolicy,showTooltips:n.showTooltips,onCopy:n.events.onCopy,onHandleArtifactClick:n.events.onHandleArtifactClick}):null)})}function iae(e,t={}){return e.replace(/\{([\w.-]+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:String(r)})}function aae(e,t,n,r={}){let i=n[e]?.[t]??n.en?.[t];return i===void 0?t:iae(i,r)}function oae(e,t,n=new Date){let r=(e instanceof Date?e:new Date(e)).getTime()-n.getTime(),i=Math.abs(r),[a,o]=i<6e4?[`second`,1e3]:i<36e5?[`minute`,6e4]:i<864e5?[`hour`,36e5]:[`day`,864e5],s=Math.round(r/o);return new Intl.RelativeTimeFormat(t,{numeric:`always`}).format(s,a)}var sae={id:`en`,label:`English`,messages:{"common.ok":`OK`,"common.language":`Language`,"common.models":`Models`,"common.skills":`Skills`,"common.plugins":`Plugins`,"common.mcp":`MCP`,"sidebar.hide":`Collapse sidebar`,"sidebar.show":`Expand sidebar`,"theme.light":`Switch to light mode`,"preferences.defaultThinkingLevel":`Default thinking level`,"preferences.thinkingLevelHint":"Global default for new sessions (settings.json `defaultThinkingLevel`). Not set = field removed, falls back to pi default.","preferences.thinkingLevelNotSet":`Not set (use model default)`,"preferences.compaction":`Auto compaction`,"preferences.compactionHint":"Automatically compact long sessions (settings.json `compaction`). When not configured the pi defaults are shown; any edit writes the full object.","preferences.compactionEnabled":`Enabled`,"preferences.compactionReserveTokens":`Reserve tokens`,"preferences.compactionReserveTokensHint":`Tokens reserved for model output, keeping reply space after compaction`,"preferences.compactionKeepRecentTokens":`Keep recent tokens`,"preferences.compactionKeepRecentTokensHint":`Tokens kept after compaction, counted backwards from the most recent messages`,"preferences.retry":`API retry`,"preferences.retryHint":"Retry settings for provider API calls (settings.json `retry`). When not configured the pi defaults are shown; any edit writes the full object. Provider sub-fields left empty are not written.","preferences.retryEnabled":`Enabled`,"preferences.retryEnabledHint":`Enable retries for failed API calls`,"preferences.retryMaxRetries":`Max retries`,"preferences.retryBaseDelayMs":`Base delay (ms)`,"preferences.retryBaseDelayMsHint":`Initial delay before the first retry, in milliseconds`,"preferences.retryProviderTimeoutMs":`Provider timeout (ms)`,"preferences.retryProviderMaxRetries":`Provider max retries`,"preferences.retryProviderMaxRetryDelayMs":`Provider max delay (ms)`,"preferences.defaultProjectTrust":`Default project trust`,"preferences.projectTrustHint":"Default trust for new projects (settings.json `defaultProjectTrust`). Not set = field removed (falls back to ask).","preferences.projectTrustNotSet":`Not set (ask)`,"preferences.projectTrustAsk":`Ask`,"preferences.projectTrustAlways":`Always trust`,"preferences.projectTrustNever":`Never trust`,"preferences.notifyEvents":`Notifications`,"preferences.notifyEventsHint":`Browser notifications when the tab is not active. Permission is requested on first interaction.`,"notify.permission.request":`Enable notifications`,"notify.permission.requestHint":`Click to enable browser notifications — you'll be alerted when a task finishes even if this tab is in the background`,"notify.permission.granted":`Notifications on`,"wsHealth.disconnected":`Connection to the server lost, reconnecting…`,"wsHealth.restored":`Connection restored`,"reducedMotionNotice.message":`Your system has "Reduce motion" enabled (prefers-reduced-motion). To respect it, this app has turned off some animations. To restore them, search for "how to turn off reduce motion" or "prefers-reduced-motion" and follow your system/browser settings. Shown once per browser session.`,"notify.permission.grantedHint":`Browser notifications are enabled — you'll be alerted when a task finishes even if this tab is in the background`,"notify.permission.bannerHintBefore":`Click the`,"notify.permission.bannerHintAfter":`button in the top-left toolbar to enable notifications — you'll be alerted when a task completes, errors, or asks a question. Fine-tune in Config Center → Session → Notifications`,"notify.permission.denied":`Notifications blocked`,"notify.permission.deniedHint":`Notifications are blocked by the browser. Click the icon next to the address bar → Site settings, switch notifications to Allow, then try again`,"preferences.notifyWhileActive":`Notify while page active`,"preferences.notifyTaskComplete":`Task complete`,"preferences.notifyErrors":`Errors`,"preferences.notifyQuestions":`Questions`,"theme.dark":`Switch to dark mode`,"theme.toggleTheme":`Switch theme`,"theme.darkMode":`Dark`,"theme.lightMode":`Light`,"theme.fontSize":`Font size`,"theme.scrollStep":`Hover scroll step`,"scrollStep.hint":`Pixels scrolled per hover tick on the edge scroll arrows (shared by the panel scroll arrows and the minimap).`,"scrollStep.range":`per hover tick (1-1000)`,"scrollStep.unit":`px`,"theme.autoReloadSeconds":`Auto-sync chat messages interval`,"autoReload.off":`Off (0) — do not auto-reload`,"autoReload.range":`seconds (0 — 3600)`,"autoReload.unit":`s`,"autoReload.hint":`Interval in seconds for re-reading the session file; 0 = off. Keep 0 for single-client use (messages arrive via WebSocket in real time); set it above 0 for multi-client collaboration (several browsers on the same session) so each client refreshes periodically and picks up chat messages generated by the others.`,"recentBlocks.hint":`How many recent completed blocks stay expanded, including the newest one (default 0: completed blocks collapse by default, hover to preview or click to expand).`,"autoReload.reset":`Reset to default ({n} s)`,"chat.reloadFromDisk":`Sync session file content from disk`,"chat.reloadFromDiskHint":`Use when multiple clients read/write the same session jsonl at the same time. You can set automatic timed syncing under Config Center → Session.`,"chat.exportSession":`Export session (HTML)`,"chat.exportSessionHint":`Download the full session as a standalone HTML file (renders the message tree offline in any browser).`,"scrollStep.reset":`Reset to default ({n} px)`,"theme.recentBlocksExpanded":`Recent completed blocks kept expanded`,"theme.markdownThemeDark":`Code block theme (dark appearance)`,"theme.markdownThemeLight":`Code block theme (light appearance)`,"theme.markdownThemeHint":`Syntax-highlight palette for code blocks; set separately for dark and light appearance. Applies to message-area and document (.md) preview code blocks — file source view and mermaid source keep following dark/light only (Prism tokens, theme names are not interchangeable).`,"layout.sidebarWidth":`Left panel width`,"layout.widgetPanelWidth":`Right panel width`,"layout.widthRange":`px ({min}–{max})`,"layout.widthReset":`Reset to default ({value} px)`,"longBlock.blocks":`blocks`,"recentBlocks.reset":`Reset to default ({n})`,"recentBlocks.range":`0-20, includes the newest completed block`,"history.full":`Trajectory`,"history.unsaved":`Trajectory is available after the session is saved`,"title.generating":`Generating...`,"title.updated":`Title updated`,"title.noMessages":`Send a message before naming this session`,"title.generateSession":`Generate a session title`,"system.prompt":`System prompt`,"system.promptHint":`Shows the system prompt actually used by the latest request (derived from the session transcript); not generated until the first message is sent in a new session.`,"system.empty":`System prompt is empty (tools are disabled)`,"system.load":`Send a message to load the system prompt`,"notices.title":`Messages`,"notices.empty":`No messages yet`,"mcp.requiresCwd":`Open a working directory to view MCP server configuration`,"mcp.title":`MCP Servers`,"mcp.builtinNote":`Built-in MCP support is enabled with the session (pi 0.99+). Do not install mcp plugins — any extension registering /mcp replaces the built-in support. Configuration comes from mcp.json and servers connect at session start.`,"mcp.empty":"No MCP servers configured. Use `pi mcp add <name> -- <command>` or edit {globalPath}.","mcp.sourceGlobal":`global`,"mcp.sourceProject":`project`,"mcp.disabled":`disabled`,"mcp.exposure":`exposure`,"mcp.toolExposureCount":`{n} tool overrides`,"mcp.timeout":`{n}s timeout`,"mcp.projectUntrusted":`Project .pi/mcp.json is not active: the project is not trusted (stdio servers execute commands).`,"mcp.howToEdit":"Add, edit or remove servers with the cards above; /reload or start a new session to apply. For OAuth sign-in use `pi mcp login <server>`.","mcp.addServer":`Add server`,"mcp.addTo":`Add to`,"mcp.editServer":`Edit server`,"mcp.removeServer":`Remove server`,"mcp.removeConfirmTitle":`Remove MCP server`,"mcp.removeConfirmDesc":`“{name}” will be removed from the {source} mcp.json. /reload or start a new session to apply.`,"mcp.fieldName":`Name`,"mcp.fieldTransport":`Transport`,"mcp.transportStdio":`stdio (local command)`,"mcp.transportHttp":`HTTP (remote)`,"mcp.fieldCommand":`Command`,"mcp.fieldArgs":`Args`,"mcp.fieldArgsHint":`Space-separated, e.g. -y server-fs .`,"mcp.fieldUrl":`URL`,"mcp.fieldEnv":`Env`,"mcp.fieldHeaders":`Headers`,"mcp.fieldKvHint":`One KEY=VALUE per line`,"mcp.fieldTimeout":`Timeout (s, optional)`,"mcp.fieldEnabled":`Enabled`,"mcp.dialogTargetGlobal":`Save to {path}`,"mcp.dialogTargetProject":`Save to {path}`,"mcp.dialogTargetProjectUnavailable":`Project not trusted; cannot write to the project mcp.json`,"mcp.errNameRequired":`Name is required`,"mcp.errCommandRequired":`stdio servers require a command`,"mcp.errUrlRequired":`HTTP servers require a URL`,"mcp.autoEnableCodemode":`Auto-enable codemode`,"mcp.autoEnableCodemodeHint":`Whether codemode (model-written JS calling tools in parallel) activates when codemode-exposed MCP servers are present.`,"mcp.exposureDirect":`direct (declared to model)`,"mcp.exposureModelOnly":`model-only (not in scripts)`,"mcp.exposureCodemode":`codemode (scripts only)`,"mcp.exposureDeferred":`deferred (tool_search)`,"mcp.exposureHidden":`hidden`,"notices.filterInfo":`Show info messages`,"notices.filterWarning":`Show warning messages`,"notices.filterError":`Show error messages`,"notices.search":`Search messages`,"notices.clear":`Clear`,"notices.clearCurrentHint":`Clear message log of the current session (scope: current session)`,"notices.clearAllHint":`Clear message log of all sessions (scope: all sessions)`,"notices.clearCurrent":`Clear messages of current session`,"notices.clearAll":`Clear all messages`,"notices.remove":`Remove this message`,"notices.onlyCurrent":`Current session only`,"notices.onlyCurrentOnHint":`Show messages of the current session only (click to show all sessions)`,"notices.onlyCurrentOffHint":`Showing messages of all sessions (click to filter to current session)`,"notices.fromSession":`From session`,"notices.global":`Global`,"session.info":`Session info`,"session.reload":`Reload session (re-read config and resources)`,"session.name":`Name`,"session.file":`File`,"session.inMemory":`In-memory`,"session.id":`ID`,"session.user":`User`,"session.assistant":`Assistant`,"session.toolCalls":`Tool Calls`,"session.toolResults":`Tool Results`,"session.total":`Total`,"session.input":`Input`,"session.output":`Output`,"session.cacheRead":`Cache Read`,"session.cacheWrite":`Cache Write`,"session.inputHint":`Prompt tokens NOT served from cache: system prompt, history and tool definitions sent to the model, minus the cached portion`,"session.outputHint":`Tokens generated by the model (answers and thinking)`,"session.cacheReadHint":`Tokens served from prompt cache: unchanged context re-read from the previous request at a discounted rate`,"session.cacheWriteHint":`Tokens written to cache for the first time (billed on write, Anthropic-style)`,"session.totalHint":`input + output + cacheRead + cacheWrite`,"session.cacheHitRate":`Cache hit rate`,"session.cacheReadRate":`Cache hit rate: cache-read tokens as a share of all input prompt tokens (input + cacheRead + cacheWrite), the official formula cacheRead / (input + cacheRead + cacheWrite)`,"session.cost":`Cost`,"session.context":`Context`,"session.copy":`Copy {value}`,"session.copied":`Copied`,"session.title":`Session info`,"session.load":`Send a message or run /session to load session info`,"session.infoSection":`Session Info`,"session.messages":`Messages`,"session.tokens":`Tokens`,"session.copyFile":`Copy file path`,"session.copyId":`Copy session ID`,"workspace.opening":`Opening workspace...`,"workspace.unable":`Unable to open workspace`,"workspace.selectSession":`Select a session from the sidebar`,"workspace.selectWorkspace":`Please select a workspace`,"workspace.stepProject":`Select a project directory from the sidebar`,"workspace.stepModels":`Add models via the Models button at the bottom`,"tabs.chat":`Chat`,"tabs.widgets":`Widgets`,"tabs.updates":`Updates`,"tabs.branches":`Branches`,"branch.assistantFallback":`[assistant message]`,"branch.customMessage":`custom message`,"branch.sessionInfo":`session info`,"branch.thinkingLevelChange":`thinking level change`,"branch.modelChange":`model change`,"tabs.trajectory":`Trajectory`,"trajectory.noSession":`Select a session to view its trajectory`,"trajectory.loading":`Loading…`,"trajectory.summary":`{turns} turns · {tools} tool calls`,"trajectory.emptyTurn":`(no user message)`,"trajectory.turnStats":`{tools} tools · {errors} errors`,"trajectory.toolError":`Tool {name} failed`,"trajectory.lane.user":`user`,"trajectory.overviewEmpty":`Expand a turn to see its timeline`,"trajectory.lane.assistant":`assistant`,"trajectory.lane.tool":`tool`,"config.title":`Settings`,"config.mobileDisabled":`Config center is not available on mobile. Please open it in a desktop browser.`,"config.section.session":`Session`,"config.section.appearance":`Appearance`,"config.section.advanced":`Advanced`,"config.section.envVars":`Environment`,"config.env.hint":`Environment variables actually in effect inside the pi-web server process (covers .env, shell exports, OS-level and process inheritance). Read-only. Secret-looking values are masked.`,"config.env.filterPlaceholder":`Filter by name…`,"config.env.colName":`Name`,"config.env.colValue":`Value`,"config.env.emptyTitle":`Variable is set to an empty string`,"config.env.loadFailed":`Failed to load:`,"config.env.loading":`Loading…`,"config.env.noMatch":`No matching variables`,"config.section.tools":`Tools`,"config.search.placeholder":`Search settings (min 2 chars)…`,"config.search.open":`Search settings (Ctrl+F)`,"config.search.hint":`Click to search settings (Ctrl+F)`,"config.search.matchCount":`{count} matches`,"config.search.noResults":`No matching settings`,"config.section.fileExclusions":`File Exclusions`,"config.section.startScreen":`Start screen`,"config.section.git":`Git`,"config.section.modelThinking":`Thinking Levels`,"config.section.requiresCwd":`Select a project directory from the sidebar first to browse plugins / skills`,"updates.check":`Check for updates`,"updates.checking":`Checking…`,"updates.checkedAt":`Last checked`,"updates.upToDate":`Up to date`,"updates.updateAvailable":`Update available`,"updates.unavailable":`Check failed`,"updates.noPluginUpdates":`All plugins are up to date`,"updates.banner":`Update available: {items}`,"updates.view":`View`,"updates.copied":`Copied`,"updates.copyCommand":`Copy command`,"updates.restartNote":`Also upgrades the bundled pi SDK; restart pi-web to load it.`,"updates.enableChecking":`Enable update checks`,"updates.enableCheckingHint":`Automatically check for updates every 30 minutes (you can also click Check for updates anytime)`,"updates.disabled":`Update checks disabled`,"updates.ignoreVersion":`Ignore this version`,"updates.ignored":`Ignored {version}`,"updates.ignoredPlugin":`Ignored`,"updates.unignore":`Unignore`,"preferences.fileExclusions.title":`File exclusions`,"preferences.fileExclusions.description":"Exclusion rules shared by the file browser and @ file index: `*.xxx` matches by suffix, anything else matches a directory/file name exactly. Each level fully replaces the one below (no merging): project overrides global, global overrides built-in defaults. Separate multiple entries with commas when adding (names may contain spaces); changes take effect immediately.","preferences.fileExclusions.global":`Global`,"preferences.fileExclusions.project":`Project`,"preferences.fileExclusions.defaults":`Built-in defaults (read-only)`,"preferences.fileExclusions.inputPlaceholder":`e.g. node_modules, *.pyc (separate multiple with commas)`,"preferences.fileExclusions.importHigher":`Copy entries from the level above`,"preferences.fileExclusions.loadFailed":`Failed to load file exclusions`,"preferences.defaultTools.title":`Default tools (defaultTools)`,"preferences.defaultTools.description":`Configure tools enabled for new sessions (pi settings.json defaultTools). The options in the tool preset dropdown under the chat input (full, etc.) are managed in the Tool presets section below in this tab; selecting a preset is a session-level toggle and is not persisted here. Built-in tools that are inactive by default (grep/find/ls) and codemode can be enabled here; the MCP section has a separate autoEnableCodemode option — the two are independent. Full replace = exact whitelist; Incremental = add/remove on top of the pi default set (read/bash/edit/write); in incremental mode, hover the effective badge to preview the resulting tool list.`,"preferences.defaultTools.global":`Global default tools`,"preferences.defaultTools.project":`Project default tools`,"preferences.defaultTools.modeFull":`Full replace`,"preferences.defaultTools.modeIncremental":`Incremental`,"preferences.defaultTools.save":`Save`,"preferences.defaultTools.reset":`Reset`,"preferences.defaultTools.incrementalHint":`Incremental mode: entries are written with +/- prefixes; click a tool to emit -tool (removal), click again to restore.`,"preferences.defaultTools.confirmTitle":`Save & restart affected sessions`,"preferences.defaultTools.confirmRestartGlobal":`Saving the global default tools restarts all session processes you have opened (new sessions use the new list immediately); sessions with running tasks are not interrupted and keep the old list until they go idle.`,"preferences.defaultTools.confirmRestartProject":`Saving the project default tools restarts opened session processes of this project (new sessions use the new list immediately); sessions with running tasks are not interrupted.`,"preferences.defaultTools.saveResult":`Saved; restarted {restarted} session process(es)`,"preferences.defaultTools.saveResultSkipped":`Saved; restarted {restarted} session process(es); {skipped} running session(s) left untouched and will restart when idle`,"preferences.defaultTools.fullHint":`Full mode: the checked tools form the complete whitelist, fully replacing the pi defaults (unchecked default tools become unavailable).`,"preferences.defaultTools.toolDesc.read":`Read file contents (optional line range; read-only, never modifies files)`,"preferences.defaultTools.toolDesc.bash":`Run shell commands (general-purpose: builds, git, process management, etc.)`,"preferences.defaultTools.toolDesc.edit":`Edit files via exact-match string replacement (use write for new files or full rewrites)`,"preferences.defaultTools.toolDesc.write":`Create a new file or overwrite an entire file (use edit for partial changes)`,"preferences.defaultTools.toolDesc.grep":`Search file contents with regex (dedicated exploration tool, no bash round-trip)`,"preferences.defaultTools.toolDesc.find":`Find files by name pattern (dedicated exploration tool, no bash round-trip)`,"preferences.defaultTools.toolDesc.ls":`List directory contents (quick project overview)`,"preferences.defaultTools.toolDesc.powershell":`Run PowerShell commands (pwsh or Windows PowerShell; Windows-oriented alternative to bash)`,"preferences.defaultTools.toolDesc.codemode":`The model orchestrates other tools via a JS script (QuickJS sandbox) - running calls in parallel, filtering large results, and returning only the script output to the model.`,"preferences.defaultTools.toolDesc.tool_search":`Let the model search and lazily load undeclared tools (codemode/deferred exposure, e.g. MCP tools) on demand.`,"preferences.defaultTools.projectUntrusted":`Project is not trusted; cannot write project settings.json (trust the directory first).`,"preferences.defaultTools.loadFailed":`Failed to load default tools config`,"preferences.toolPresets.title":`Tool presets`,"preferences.toolPresets.description":`Options for the tool preset dropdown in the chat input (~/.pi/agent/pi-web/tool-presets.json)`,"preferences.toolPresets.nameLabel":`Name`,"preferences.toolPresets.namePlaceholder":`Preset name (required)`,"preferences.toolPresets.nameRequired":`Name must not be empty`,"preferences.toolPresets.nameDuplicate":`Name must be unique`,"preferences.toolPresets.descriptionLabel":`Description`,"preferences.toolPresets.descriptionPlaceholder":`Optional description shown in the dropdown`,"preferences.toolPresets.remove":`Remove`,"preferences.toolPresets.defaultHint":`Built-in preset (read-only): effective tools follow the default tools list above (project overrides global)`,"preferences.toolPresets.defaultSourceGlobal":`No project-level default tools configured — following the global list`,"preferences.toolPresets.defaultSourceSdk":`Neither project nor global configured — using pi built-in defaults (read/bash/edit/write)`,"preferences.toolPresets.staleRestart":`Default tools updated — restart pi-web to apply them to running sessions`,"preferences.toolPresets.add":`Add preset`,"preferences.toolPresets.save":`Save`,"preferences.toolPresets.reset":`Reset`,"preferences.toolPresets.saved":`Saved. The chat dropdown updates immediately.`,"preferences.toolPresets.loadFailed":`Failed to load tool presets config`,"preferences.pi.unset":`pi default`,"preferences.pi.enableAnalytics":`Enable analytics`,"preferences.pi.enableAnalyticsHint":"Send anonymous usage analytics (settings.json `enableAnalytics`)","preferences.pi.enableInstallTelemetry":`Enable install telemetry`,"preferences.pi.enableInstallTelemetryHint":"Send anonymous install telemetry (settings.json `enableInstallTelemetry`)","preferences.pi.httpProxy":`HTTP proxy`,"preferences.pi.httpProxyHint":"Proxy URL for HTTP requests (settings.json `httpProxy`). Empty input cannot clear an already-set value.","preferences.pi.trackingId":`Analytics tracking ID`,"preferences.pi.trackingIdHint":"Custom analytics tracking ID (settings.json `trackingId`). Empty input cannot clear an already-set value.","preferences.pi.httpIdleTimeoutMs":`HTTP idle timeout (ms)`,"preferences.pi.httpIdleTimeoutMsHint":"HTTP idle timeout in ms (settings.json `httpIdleTimeoutMs`). Empty input cannot clear an already-set value.","preferences.pi.websocketConnectTimeoutMs":`WebSocket connect timeout (ms)`,"preferences.pi.websocketConnectTimeoutMsHint":"WebSocket connect timeout in ms (settings.json `websocketConnectTimeoutMs`). Empty input cannot clear an already-set value.","preferences.pi.branchSummary":`Branch summary`,"preferences.pi.branchSummaryHint":"Branch summary auto-compaction (settings.json `branchSummary`)","preferences.pi.reserveTokens":`Reserve tokens`,"preferences.pi.skipPrompt":`Skip prompt`,"preferences.pi.images":`Image handling`,"preferences.pi.imagesHint":"How the pi engine handles images (settings.json `images`)","preferences.pi.autoResize":`Auto-resize`,"preferences.pi.autoResizeHint":"Downscale images returned by tools such as `read` to save tokens.","preferences.pi.blockImages":`Block images`,"preferences.pi.blockImagesHint":`Strip all image content from messages before they reach the model.`,"config.files.hint":`Edit pi's config files (JSON) directly. Validated before save; backed up automatically (last 10 kept).`,"config.widgets.empty":`No widget configurations yet. Widgets appear here automatically when an extension pops one up.`,"config.widgets.x":`x`,"config.widgets.y":`y`,"config.widgets.width":`w`,"config.widgets.height":`h`,"config.widgets.bind":`Bind message`,"config.widgets.bindTitle":`Bind custom message`,"config.widgets.bindHint":`Bind a quick message to widget "{key}"`,"config.widgets.editTitle":`Edit quick message`,"config.widgets.editHint":`Edit the label, content, and send mode.`,"config.widgets.label":`Label`,"config.widgets.labelPlaceholder":`Button text (e.g. Reload)`,"config.widgets.message":`Message`,"config.widgets.messagePlaceholder":`A slash command or any text (e.g. /reload)`,"config.widgets.messageTooltip":`Type / to see built-in, global plugin and Skill commands. Project-level plugin commands won't appear in suggestions but can still be entered and saved manually.`,"config.widgets.sendImmediately":`Send immediately`,"config.widgets.sendMode":`Send mode`,"config.widgets.fillToChatInput":`Fill into chat input`,"config.widgets.sendImmediatelyTooltip":`Send immediately: `,"config.widgets.fillToChatInputTooltip":`Fill into chat input: `,"config.widgets.nameConflict":`Name "{label}" already exists, please use another`,"config.startScreen.nameConflict":`Name "{label}" already exists, please use another`,"config.startScreen.hint":`Quick actions shown on the new-session start screen (below the Pi logo); clicking sends the message immediately or fills it into the chat input, depending on each entry's send mode.`,"config.startScreen.bind":`Bind message`,"config.startScreen.bindTitle":`Bind quick message`,"config.startScreen.bindHint":`Bind a quick message to the start screen.`,"config.startScreen.empty":`No quick messages yet; the start screen will show no quick actions.`,"config.startScreen.unbindTitle":`Unbind message`,"config.startScreen.unbindConfirm":`Unbind "{label}"?`,"config.startScreen.unbind":`Unbind`,"config.widgets.confirm":`Confirm`,"config.widgets.unbindTitle":`Unbind message`,"config.widgets.unbindConfirm":`Unbind "{label}"?`,"config.widgets.unbind":`Unbind`,"config.startScreen.editTitle":`Edit quick message`,"config.startScreen.editHint":`Edit the label, content, and send mode.`,"config.startScreen.reset":`Reset`,"config.startScreen.resetHint":`Restore the built-in default quick messages; keep your own bound messages (ones with the same label as a default are replaced by the default).`,"config.files.save":`Save`,"config.files.saving":`Saving...`,"config.files.saved":`Saved`,"config.files.missing":`Not created yet`,"config.files.placeholder":`Select a config file from the list on the left`,"layout.resizeSidebar":`Resize sidebar`,"layout.resizeWidgetPanel":`Resize widgets panel`,"layout.resizeHint":`Drag to resize. Double-click or press Enter to reset.`,"sidebar.newWorkspace":`New workspace`,"sidebar.searchSessions":`Search sessions`,"sidebar.searchSessionsPlaceholder":`Search sessions…`,"sidebar.justNow":`just now`,"sidebar.minutesAgo":`{count}m ago`,"sidebar.hoursAgo":`{count}h ago`,"sidebar.daysAgo":`{count}d ago`,"sidebar.searchSessionsNoResults":`No matching sessions`,"sidebar.newSessionTitle":`New session in {path}`,"sidebar.refresh":`Refresh`,"directoryPicker.selectDirectory":`Select directory`,"directoryPicker.goToParent":`Go to parent directory`,"directoryPicker.directoryPath":`Directory path`,"directoryPicker.goToDirectory":`Go to directory`,"directoryPicker.go":`Go`,"directoryPicker.loadingDirectories":`Loading directories…`,"directoryPicker.noSubdirectories":`No subdirectories`,"directoryPicker.openBeforeSelecting":`Open this path before selecting it`,"directoryPicker.selectCurrentDirectory":`Select current directory`,"directoryPicker.selectThisFolder":`Select this folder`,"directoryPicker.noDrives":`No drives found`,"directoryPicker.search":`Filter folders`,"directoryPicker.noMatches":`No folders match your filter`,"sidebar.checking":`Checking…`,"sidebar.open":`Open`,"sidebar.cancel":`Cancel`,"sidebar.openRepoRoot":`Worktree switch unavailable`,"sidebar.openRepoRootTitle":`Worktree switching is unavailable here — switch the current working directory to the Git repository root first (from the sidebar).`,"sidebar.gitRepoRootOnly":`Git repo root only`,"sidebar.gitRepoRootOnlyTitle":`Worktrees are available in Git repository roots.`,"sidebar.worktrees":`Worktrees...`,"sidebar.checkingWorktrees":`Checking worktrees for this directory.`,"sidebar.filterWorktrees":`Filter worktrees…`,"sidebar.noMatchingWorktrees":`No matching worktrees`,"sidebar.switchWorktree":`Switch worktree`,"sidebar.switchWorktreeTitle":`Switch worktree: {path}`,"sidebar.main":`main`,"sidebar.forceRemoveCheckout":`Uncommitted changes. Force remove checkout?`,"sidebar.force":`Force`,"sidebar.createWorktreeTitle":`Create a worktree checkout for a branch`,"sidebar.newWorktree":`New worktree…`,"sidebar.branchName":`git branch name`,"sidebar.creating":`Creating…`,"sidebar.create":`Create`,"sidebar.uploadFilesTitle":`Upload files to project root`,"sidebar.uploadFiles":`Upload files`,"sidebar.refreshExplorer":`Refresh explorer`,"sidebar.changedFiles":`{count} changed files`,"sidebar.loading":`Loading...`,"sidebar.sessionDeleted":`Session deleted — pick another session`,"sidebar.noSessions":`No sessions found`,"sidebar.workspace":`Workspace`,"sidebar.workspaceStoragePath":`Session files for the current workspace are stored in {path}`,"sidebar.newActivity":`New activity`,"sidebar.newSessionActivity":`New session activity`,"sidebar.interactionBadge":`Session waiting for interaction`,"sidebar.deleteSession":`Delete {title}?`,"sidebar.deleteWorkspace":`All {count} sessions under “{name}” and their auxiliary files will be deleted. This cannot be undone.`,"sidebar.deleteWorkspaceTitle":`Delete this workspace, its sessions and their auxiliary files`,"sidebar.deleteWorkspaceDialogTitle":`Delete workspace`,"sidebar.deletedSessionGhost":`Deleted session “{session}” in workspace “{workspace}”`,"sidebar.deletedWorkspaceGhost":`Deleted workspace “{name}” ({count} sessions + auxiliary files)`,"sidebar.copyPath":`Copy full path`,"sidebar.actions":`Session actions`,"sidebar.rename":`Rename`,"sidebar.delete":`Delete`,"aux.forkTitle":`Copy session auxiliary files`,"aux.forkDescription":`This session has same-named auxiliary files (different extension). Choose which to copy to the new session:`,"aux.deleteTitle":`Delete auxiliary files too?`,"aux.deleteDescription":`These files share the session's name (different extension). Unchecked files will be left on disk:`,"aux.copyConfirm":`Copy & fork`,"aux.deleteConfirm":`Delete selected`,"aux.fileNameHeader":`File name (click to select all)`,"aux.sizeHeader":`Size`,"aux.toggleAll":`Select all / clear`,"sidebar.deleteWithShiftClick":`Delete (Shift+click to delete without confirmation)`,"sidebar.expandForks":`Expand forks`,"sidebar.collapseForks":`Collapse forks`,"sidebar.disconnect":`Disconnect`,"sidebar.messagesCount":`{count} msgs`,"sidebar.worktreePath":`Worktree: {path}`,"sidebar.removeWorktreeTitle":`Remove worktree checkout {path}; the branch is kept`,"files.modified":`Modified`,"files.added":`Added`,"files.deleted":`Deleted`,"files.renamed":`Renamed`,"files.untracked":`Untracked`,"files.conflict":`Conflict`,"files.newlyUploaded":`Newly uploaded`,"files.containsChangedFiles":`Contains changed files`,"files.insertPath":`Insert path into chat`,"files.mention":`mention`,"files.download":`Download file`,"files.dismissError":`Dismiss error`,"files.addUploadedFile":`Add uploaded file to chat`,"files.addAllUploadedFiles":`Add all uploaded files to chat`,"files.openInSystemApp":`Open with system app`,"files.chooseOtherApp":`Choose another app…`,"files.openLaunched":`Launched with the system app`,"files.fileTooLargeForPreview":`File too large for preview (>{limit})`,"files.docTooLargeForPreview":`DOCX too large for preview (>{limit})`,"files.dismissUploadResults":`Dismiss upload results`,"files.loading":`Loading files...`,"files.noFiles":`No files found`,"files.find":`Find`,"files.findNext":`Next match (Enter)`,"files.findPrev":`Previous match (Shift+Enter)`,"files.findNoResults":`No results`,"files.findClose":`Close (Esc)`,"loading.inProgress":`Working…`,"loading.more":`{count} more…`,"errors.title":`Error`,"errors.titleCount":`Errors ({count})`,"errors.close":`Close`,"errors.clearAll":`Clear all`,"files.notFound":`Not found`,"files.accessDenied":`Access denied`,"files.empty":`Empty`,"files.uploadFailed":`{count} failed`,"files.explorer":`Explorer`,"files.changedCount":`{count} files`,"files.stagedPrefix":`Staged: `,"files.unstagedPrefix":`Unstaged: `,"files.noStagedChanges":`No staged files`,"files.noUnstagedChanges":`No unstaged changes`,"files.commitMessagePlaceholder":`Commit message`,"files.commit":`Commit`,"files.push":`Push to remote (with tags)`,"files.pushing":`Pushing...`,"files.pushSuccess":`Push succeeded`,"files.pushFailed":`Push failed`,"files.pushUpToDate":`Already up to date — nothing to push`,"files.pull":`Pull from remote`,"files.pulling":`Pulling...`,"files.pullSuccess":`Pull succeeded`,"files.pullFailed":`Pull failed`,"files.pullUpToDate":`Already up to date — nothing to pull`,"files.pullNonFastForward":`Pull rejected — local and remote have diverged. Use git pull --rebase or --merge in terminal.`,"files.committing":`Committing…`,"files.commitMessageRequired":`Enter a commit message first`,"files.commitTitle":`Commit changes`,"files.stageFileListMore":`…and {count} more`,"files.confirmStageAllCommit":`Stage the following {count} changed files and commit?`,"files.commitMessageLabel":`Commit message`,"files.stageAllAndCommit":`Stage & commit`,"files.stageFile":`Stage file`,"files.unstageFile":`Unstage file`,"files.changeStats":`{count} changed files, {additions} lines added, {deletions} lines deleted`,"git.autoFetchInterval":`Auto fetch interval (seconds)`,"git.otherSectionTitle":`Other`,"git.autoFetchIntervalHint":`How often the server fetches remotes for active session workspaces (shared by all clients). 0 disables the timer — one fetch runs when a session connects.`,"git.groupTitle":`Smart Commit Message Generation`,"git.commitModel.followCurrent":`Follow current session model`,"git.commitModel.followCurrentHint":`When on, the commit generation follows the current chat's main model. When off, the fixed model below is used (recommended for a cheap dedicated model).`,"git.commitModel.fixedModel":`Fixed model`,"git.commitModel.fixedModelHint":`Model used when "follow current session" is off (choose a cheap model).`,"git.commitModel.selectPlaceholder":`Select a model`,"git.commitModel.noModels":`No models available`,"git.commitModel.notConfiguredHint":`No fixed model selected. Pick a model before using AI generate.`,"git.ai.generate":`Smart generate`,"git.ai.generating":`Generating…`,"git.ai.notConfiguredTitle":`Model not configured`,"git.ai.notConfiguredDesc":`No model is set for Smart generate. Go to Config Center → Git to set one.`,"git.ai.goToConfig":`Go to settings`,"git.ai.noSession":`Follow-current mode requires an active session`,"git.ai.noSessionModel":`Current session has no model. Select a model in chat first`,"git.commitModel.maxTokens":`Max output tokens`,"git.commitModel.maxTokensHint":`Max output tokens for one generation (64–4096, default 512). Reasoning is minimized: disabled when the model supports it, otherwise reduced to the lowest level.`,"git.commitModel.autoGenerateOnEmpty":`Auto-generate when commit box is empty`,"git.commitModel.autoGenerateOnEmptyHint":`When on, clicking Commit with an empty box auto-generates a message first, then commits. Only when a model is configured; otherwise empty stays disabled. On by default.`,"git.ai.invalidModel":`Configured model is invalid. Reselect it in Config Center.`,"git.ai.usingCurrentModel":`Using current chat model`,"git.ai.usingModel":`Using {model}`,"git.ai.generateAndCommit":`Smart generate & commit`,"git.commitConfirmStageAll":`Confirm “stage all” on commit`,"git.commitConfirmStageAllHint":`When on, committing with only unstaged changes shows a “Stage all & commit” confirmation. When off, it stages all and commits directly. On by default.`,"modelThinking.desc":`Remember the last thinking level per model or provider. When switching models, the selector restores the remembered level; if the model's available levels don't include it, it falls back to auto (use default). All 7 levels supported: off / minimal / low / medium / high / xhigh / max.`,"modelThinking.addModelTitle":`Add model`,"modelThinking.addProviderTitle":`Add provider`,"modelThinking.byModel":`By model`,"modelThinking.byProvider":`By provider`,"modelThinking.byProviderHint":`Provider fallback: models without a per-model entry use this value.`,"modelThinking.emptyModel":`No per-model memory yet. Selecting a thinking level after switching models will remember it automatically; you can also add one here.`,"modelThinking.emptyProvider":`No per-provider memory yet.`,"modelThinking.selectModelPlaceholder":`Select a model`,"modelThinking.selectProviderPlaceholder":`Select a provider`,"modelThinking.providerInputPlaceholder":`or type a provider name`,"modelThinking.footerHint":`Stored in a standalone file pi-web/model-thinking.json, not the main config. UI-only — pi's set_thinking_level is not intercepted.`,"common.add":`Add`,"common.emptyValue":`(empty)`,"common.retry":`Retry`,"common.delete":`Delete`,"files.conflictSummary":`{count} file{countSuffix} already exist: {files}`,"files.cannotReplace":`Cannot replace: {files}`,"files.replace":`Replace`,"files.skipExisting":`Skip existing`,"files.cancel":`Cancel`,"files.checking":`Checking files`,"files.uploading":`Uploading, {progress}%`,"files.search":`Search files`,"files.searchPlaceholder":`Search files...`,"chat.loadingSession":`Loading session...`,"chat.noSessionSelected":`Create or select a session in the left panel`,"chat.loadingWindow":`Loading messages...`,"chat.runningTool":`Running tool`,"chat.runningNamedTool":`Running {name}`,"chat.runningToolsFull":`Running {names} ({count} tools)`,"chat.waitingModel":`Waiting for model`,"chat.aiQuestion":`AI question`,"chat.runningCommand":`Running command`,"chat.statusUnknown":`Unknown status`,"chat.answering":`Answering`,"chat.totalElapsed":`total {total}`,"chat.thinking":`Thinking`,"chat.message":`{count} message`,"chat.messages":`{count} messages`,"chat.toolCall":`{count} tool call`,"chat.toolCalls":`{count} tool calls`,"chat.statFiles":`files`,"chat.statMessages":`messages`,"chat.statTools":`tools`,"tool.receivingArgs":`Receiving arguments...`,"chat.collapseProcess":`Collapse process details`,"chat.expandProcess":`Expand process details`,"chat.loadEarlier":`Scroll up to load earlier messages ({count} hidden)`,"chat.searchMessages":`Search messages`,"chat.clearSearch":`Clear search query`,"chat.scrollToLatest":`Scroll to latest message`,"chat.expandMessage":`Expand full content`,"chat.collapseMessage":`Collapse`,"chat.expandTurn":`Expand turn`,"chat.collapseTurn":`Collapse turn`,"chat.thinkingCount":`thinking`,"chat.textChars":`chars of text`,"chat.searchPlaceholder":`Search chat messages…`,"chat.searchNoResults":`No results`,"chat.searchResults":`{count} results`,"chat.extensionRequest":`extension request`,"chat.cancel":`Cancel`,"chat.skipped":`Skipped`,"chat.confirm":`Confirm`,"chat.submit":`Submit`,"chat.extensionInput":`Extension terminal input`,"chat.extensionSelect":`Select an option`,"chat.extensionConfirm":`Confirm`,"chat.extensionEditor":`Edit`,"chat.extensionPanel":`Extension panel`,"chat.close":`Close`,"chat.notifyInfoTitle":`Info`,"chat.notifySuccessTitle":`Success`,"chat.notifyErrorTitle":`Error`,"chat.notifyWarningTitle":`Warning`,"chat.queued":`Queued · {count}`,"chat.queueSteer":`Steer`,"chat.queueFollowUp":`Follow-up`,"chat.recall":`Recall all`,"chat.recallTitle":`Remove all queued messages and put them back into the input box for editing (press Enter while the input is empty)`,"chat.queueWithdrawHint":`Click to recall this message`,"notices.sessionInteractionWaiting":`Session "{name}" is waiting for interaction`,"chat.retrying":`Retrying ({attempt}/{max})`,"chat.loadingCommands":`Loading commands...`,"chat.slashCommands":`Slash commands · {label}`,"chat.tabEnter":`Tab / Enter`,"chat.noCommands":`No extension, prompt, or skill commands found`,"chat.match":`1 match`,"chat.matches":`{count} matches`,"chat.command":`1 command`,"chat.commands":`{count} commands`,"chat.loadingFiles":`Loading files...`,"chat.files":`Files · {label}{hint}`,"chat.searching":`Searching…`,"chat.noMatchingFiles":`No matching files`,"chat.searchingAll":` · searching all files…`,"chat.indexTruncated":` · index truncated`,"chat.steerPlaceholder":`Steer now (Enter) / queue follow-up (Alt+Enter) / stop (Ctrl+S); F2 expands/collapses the current turn details...`,"chat.agentPlaceholder":`Agent is running… (Ctrl+S to stop; F2 expands/collapses the current turn details)`,"chat.messagePlaceholder":`Type a chat message (Enter to send, Shift+Enter for newline). / for slash commands, @ to reference files, ! for shell commands; F2 expands/collapses the current turn details`,"chat.questionNotificationTitle":`Pi — Question Asked`,"chat.taskCompleteNotificationTitle":`Pi — Task Complete`,"chat.taskErrorNotificationTitle":`Pi — Error`,"chat.sessionCompletedNotificationBody":`Session {name} completed`,"chat.sessionCompletedNotificationBodyWithWorkspace":`{workspace} · {name} completed`,"chat.questionNotificationDenied":`Notifications denied: allow them in the browser's site settings to get question alerts while the tab is hidden.`,"chat.steer":`Steer`,"chat.followUp":`Follow-up`,"chat.steerTooltip":`Send this message immediately after the current call finishes (Enter)`,"chat.followUpTooltip":`Queue this message after the agent finishes (Alt+Enter)`,"chat.send":`Send`,"chat.attachImage":`Attach image`,"chat.attachmentOnDisk":`Too large to inline; saved to disk and referenced by path (the agent reads it on demand)`,"chat.removeAttachment":`Remove attachment`,"chat.previewImage":`Preview image`,"chat.filterModels":`Filter models…`,"chat.noMatchingModels":`No matching models`,"chat.moreControls":`More controls`,"chat.shell":`Shell`,"chat.outputLocal":`output stays local`,"chat.stoppedByUser":`Stopped by user`,"chat.stoppedTooltip":`Stopped manually or aborted automatically after a timed-out interaction`,"chat.stopped":`Stopped`,"chat.errorTooltip":`Turn ended with an error`,"chat.error":`Error`,"chat.cwdPrefix":`cwd`,"chat.turnArtifacts.title":`Edited {count} files this turn`,"chat.turnDuration":`Took {duration}`,"chat.turnArtifacts.toggleList":`Toggle file list`,"chat.turnArtifacts.openFile":`Open in Files`,"chat.outputModel":`output sent to model`,"chat.shellSilentTip":` (prefix !! to skip)`,"chat.noTools":`No tools, chat only`,"chat.builtInTools":`{count} built-in tools`,"chat.allBuiltInTools":`All built-in tools`,"chat.currentReasoning":`Current reasoning level: {level}`,"chat.changeReasoningLabel":`Change reasoning level`,"chat.currentModel":`Current model: {model}`,"chat.changeModel":`Change model`,"chat.currentToolPreset":`Current tool preset: {preset}`,"chat.toolPresetDrift":`⚠ Actual tools differ from the selected preset. Currently active: {actual}`,"chat.changeToolPreset":`Change tool preset`,"chat.stopCompaction":`Stop compaction`,"chat.compactContext":`Compact context`,"chat.compacting":`Compacting…`,"chat.compactionDisabledByExtension":`Native context compaction is taken over by an extension, so it can't run here.`,"chat.compact":`Compact`,"chat.stopAgent":`Stop agent (Ctrl+S)`,"chat.stop":`Stop`,"chat.disableSound":`Disable sounds`,"chat.enableSound":`Enable sounds`,"chat.thinkingUseDefault":`Use pi default`,"chat.thinkingOff":`Reasoning off`,"chat.thinkingMinimal":`Minimal reasoning`,"chat.thinkingLow":`Low reasoning`,"chat.thinkingMedium":`Medium reasoning`,"chat.thinkingHigh":`High reasoning`,"chat.thinkingXhigh":`Extra-high reasoning`,"chat.thinkingMax":`Max reasoning`,"chat.thinkingMapTitle":`Higher thinking levels not configured`,"chat.thinkingMapBody":`pi supports up to high thinking by default. To enable {level} level reasoning, configure the "Thinking Level Map" for this model in Config → Models.`,"chat.thinkingMapGo":`Go to settings`,"chat.builtIn":`Built-in`,"chat.extensions":`Extensions`,"chat.prompts":`Prompts`,"chat.skills":`Skills`,"chat.dormant":`dormant`,"chat.commandCompact":`Compress context, optionally with instructions`,"chat.commandReload":`Reload extensions, skills, prompts, and tools`,"chat.commandName":`Set the session display name`,"chat.commandSession":`Show session message, token, and cost stats`,"chat.commandCopy":`Copy the last assistant message`,"chat.compacted":`Compacted`,"chat.tokensSaved":`{saved} saved`,"i18n.close":`Close`,"i18n.resizeList":`Resize {name} list`,"widgets.title":`Widgets`,"widgets.reopen":`Reopen widget`,"widgets.expandedToChat":`Widget [{key}] expanded to the chat view`,"widgets.collapse":`Collapse`,"widgets.open":`Open widgets`,"i18n.copy":`Copy`,"i18n.copied":`Copied`,"i18n.copyToolInput":`Copy raw JSON`,"i18n.cancel":`Cancel`,"i18n.save":`Save`,"i18n.saving":`Saving…`,"i18n.saved":`Saved`,"i18n.saveChanges":`Save changes`,"i18n.noThinking":`No thinking content`,"i18n.remove":`Remove`,"i18n.removing":`Removing…`,"i18n.delete":`Delete`,"i18n.loading":`Loading...`,"i18n.searchPlaceholder":`Search…`,"i18n.noMatch":`No matches`,"i18n.search":`Search`,"i18n.refresh":`Refresh`,"i18n.update":`Update`,"i18n.updating":`Updating...`,"i18n.check":`Check`,"i18n.checking":`Checking...`,"i18n.install":`Install`,"i18n.installing":`Installing...`,"i18n.noResults":`No results`,"i18n.searchProviders":`Search providers…`,"i18n.noProviders":`No providers match`,"i18n.newModel":`new model`,"i18n.addProvider":`Add provider`,"i18n.selectProviderModel":`Select a provider or model`,"i18n.visibleInPrompt":`Visible in model prompt — click to disable`,"i18n.hiddenFromPrompt":`Hidden from model prompt — click to enable`,"i18n.dormant":`Dormant`,"i18n.hiddenButInvocable":`Hidden from model, still manually invocable`,"i18n.skillSearchPlaceholder":`e.g. react, testing, deploy`,"i18n.searching":`Searching…`,"i18n.noSkills":`No skills found`,"i18n.checkUpdates":`Check updates`,"i18n.updates":`updates`,"i18n.noResolvedResources":`No resolved resources`,"i18n.enablePackage":`Enable package`,"i18n.disablePackage":`Disable package`,"i18n.filtered":`filtered`,"i18n.openSessionToReload":`Open a session to reload`,"i18n.notFound":`Not found`,"i18n.noPlugins":`No plugins configured`,"i18n.scopeGlobal":`Global`,"i18n.scopeProject":`Project`,"i18n.scopePath":`Path`,"i18n.name":`Name`,"i18n.description":`Description`,"trust.resourcesNotLoaded":`Restricted mode`,"trust.trustProject":`Trust project`,"trust.trusting":`Trusting...`,"trust.cancel":`Cancel`,"trust.dialogTitle":`Trust this project?`,"trust.dialogBody":`Project resources can run local code. Trust only projects whose contents you know.`,"trust.skillsNotLoaded":`Project skills are not loaded because this project is not trusted.`,"trust.trustedDesc":`This project is trusted; project resources (extensions/skills/plugins) are enabled.`,"trust.untrustedDesc":`This project is not trusted; project resources (extensions/skills/plugins) are not loaded. Click to trust.`,"trust.pluginsNotLoaded":`Project plugins are not loaded because this project is not trusted.`,"trust.projectScopeUnavailable":`Project installs are unavailable while project resources are not loaded.`,"i18n.subscription":`Subscription`,"i18n.subscriptions":`Subscriptions`,"i18n.customEndpoint":`Custom endpoint format`,"i18n.noChanges":`No changes`,"i18n.branches":`Conversation branches`,"i18n.noActiveSession":`No active session`,"i18n.noActiveSessionToCompact":`No active session to compact`,"i18n.noActiveSessionToReload":`No active session to reload`,"i18n.noActiveSessionToName":`No active session to name`,"i18n.noAssistantMessageToCopy":`No assistant message to copy`,"i18n.commandCompleted":`Command completed`,"i18n.commandFailed":`Command failed`,"i18n.extensionCommandFailed":`Extension command failed`,"i18n.compactedContext":`Compacted context`,"i18n.reloadedSessionResources":`Reloaded session resources`,"i18n.usageName":`Usage: /name <name>`,"i18n.sessionRenamedTo":`Session renamed to {name}`,"i18n.copiedLastAssistantMessage":`Copied last assistant message`,"i18n.failedToRecallQueuedMessages":`Failed to recall queued messages`,"i18n.failedToWithdrawQueuedMessage":`Failed to withdraw queued message`,"i18n.queuedResendAfterAbortTimeout":`Aborted, but queued messages could not be resent automatically; restored to the input box`,"i18n.noBranches":`This session has no branches`,"i18n.source":`Source`,"i18n.preview":`Preview`,"i18n.diff":`Diff`,"i18n.downloadFile":`Download file`,"i18n.liveSync":`Live sync active`,"i18n.notWatching":`Not watching`,"i18n.fileViewMode":`File view mode`,"i18n.editMode":`Edit mode`,"i18n.viewMode":`View mode`,"i18n.compareHead":`Compare working tree with HEAD`,"i18n.fileViewSource":`Source`,"i18n.fileViewPreview":`Preview`,"i18n.fileViewDiff":`Diff`,"i18n.fileViewSourceHint":`View as source code`,"i18n.fileViewPreviewHint":`View rendered preview`,"i18n.previewUnsupported":`Preview not supported for this format: {format}`,"i18n.lineCount":`{n} lines`,"i18n.mentionSelectedLines":`Mention selected lines`,"i18n.disableWrap":`Disable word wrap`,"i18n.enableWrap":`Enable word wrap`,"i18n.editFile":`Edit file`,"i18n.saveFile":`Save`,"i18n.saveFileShortcut":`Save (Ctrl/Cmd+S)`,"i18n.cancelEdit":`Cancel`,"i18n.saveFailed":`Save failed: {error}`,"i18n.unsavedChanges":`Unsaved changes`,"i18n.htmlPreview":`HTML preview`,"i18n.previewFile":`Preview {file}`,"i18n.invalidMermaid":`Invalid Mermaid diagram`,"i18n.renderingMermaid":`Rendering Mermaid diagram`,"i18n.previewAfterStreaming":`Preview available after streaming`,"i18n.showMermaidSource":`Show Mermaid source`,"i18n.previewMermaid":`Preview Mermaid diagram`,"i18n.openMermaidViewer":`Open diagram viewer`,"i18n.mermaidViewer":`Mermaid diagram viewer`,"i18n.mermaidDiagram":`Mermaid diagram`,"i18n.zoomOut":`Zoom out`,"i18n.zoomIn":`Zoom in`,"i18n.fitToWidth":`Fit to width`,"models.discoveryFetching":`Importing models…`,"models.deleteProviderConfirm":`Delete provider "{name}"? This writes to models.json immediately — all its settings (including the API key) will be removed and cannot be recovered.`,"models.renameProviderDialogTitle":`Rename Provider`,"models.renameProviderHint":`Renaming writes to models.json immediately and migrates this provider's API key and login credential; other unsaved edits are not saved with it.`,"models.renameProviderConflict":`Provider "{name}" already exists — pick another name.`,"models.renameProviderBuiltin":`"{name}" is a built-in provider — it can't be used as a custom provider name.`,"models.renameProviderEmpty":`Name must not be empty.`,"models.removeModelConfirm":`Remove model "{model}"? This writes to models.json immediately and cannot be recovered.`,"models.discoveryTitle":`Import models`,"models.discoveryFetch":`Import models…`,"models.discoveryFilterPlaceholder":`Filter {count} models…`,"models.discoveryFilter":`Filter upstream models`,"models.discoverySelectShown":`Select shown`,"models.discoveryNoMatches":`No matching models.`,"models.discoveryAdded":`added`,"models.discoveryShowing":`Showing first {shown} of {total}`,"models.discoveryFetched":`{count} models fetched`,"models.discoveryAddSelected":`Add selected`,"models.setDefault":`Set as default`,"models.defaultModel":`Default model`,"models.defaultModelUnavailable":`Default model {model} is unavailable (deleted or hidden). Please select a model.`,"models.syncEndpoint":`Sync from endpoint`,"models.lastSyncedAt":`Last synced {time}`,"models.neverSynced":`Never synced`,"models.discoveryFetchTooltip":`Imports from the local cache first: {path}. If absent, syncs from the endpoint once and writes the cache there.`,"models.syncingModels":`Syncing…`,"models.syncedModels":`Synced {count} models`,"models.syncEndpointTooltip":`Fetch the latest model list from {endpoint} and cache it locally; the cached list replaces the built-in one.`,"models.syncEndpointTooltipGeneric":`Fetch the latest model list from this provider's models endpoint and cache it locally; the cached list replaces the built-in one.`,"models.refreshFromCache":`Refresh from synced cache`,"models.refreshing":`Refreshing…`,"models.refreshFromCacheTooltip":`Re-read pi-web/provider/{provider}/models.json and update only the fields that differ from the current effective definition (manual fields like headers are kept).`,"models.refreshNoDiff":`Synced cache matches the effective definition — nothing to update.`,"models.refreshDone":`Override updated from synced cache.`,"models.refreshTimeout":`Refresh timed out — try again later.`,"models.builtinProviders":`Built-in providers`,"models.customProviders":`Custom providers`,"models.syncSaveFailed":`Save draft before sync failed — sync aborted.`,"models.visibleInChat":`Visible in chat`,"models.lastVisibleCannotHide":`This is the only visible model for this provider and cannot be hidden. To hide all, delete the model.`,"models.visibleModels":`Model list`,"models.visibleModelsCount":`{visible} / {total} selected`,"models.visibilityCustomized":` · Customized`,"models.visibilityUncustomized":` · Not customized (all visible by default)`,"models.showAll":`Reset`,"models.showAllHint":`All models visible`,"models.filterLabel":`Filter:`,"models.invertSelection":`Invert checks`,"models.searchModels":`Search models…`,"models.noModels":`No models for this provider.`,"models.noMatchingModels":`No matching models.`,"models.filterAll":`All`,"models.filterVisible":`Visible only`,"models.filterHidden":`Hidden only`,"models.invertDisabledTooltip":`All models are already visible; inverting changes nothing`,"models.openOverride":`Override model params`,"models.overrideHint":`Values shown are the effective definition (built-in merged with saved overrides). Only fields you change are saved as overrides; everything else keeps inheriting the built-in definition.`,"models.overrideOrphanedHint":`This model no longer exists upstream. The local override is still saved — you can remove it here. Saving will also clean up its visibility entry.`,"models.removeOverride":`Remove override`,"models.providerNameCollision":`Provider "{provider}" conflicts with built-in "{builtin}" (case-insensitive); model visibility cannot be applied. Rename or remove the provider.`,"models.providerNameCollisionShort":`Name conflicts with built-in provider`,"models.builtinVisibilityBlocked":`Model visibility is disabled: custom provider "{custom}" conflicts with "{builtin}" (case-insensitive). Rename or remove the custom provider.`,"models.discoveryAddSelectedCount":`Add selected ({count})`,"models.dataSourceLabel":`Data source:`,"models.catalogSourceEndpoint":`Models endpoint`,"models.catalogSourceDev":`models.dev catalog`,"models.catalogSourceEndpointTooltip":`Source: Provider's /models endpoint`,"models.catalogSourceDevTooltip":`Source: models.dev built-in catalog (https://models.dev)`,"models.catalogEndpointNotFound":`Model ID not found in the models endpoint response`,"models.catalogOverwriteTitle":`Overwrite existing fields?`,"models.catalogOverwriteBody":`{{count}} field(s) already have values that overwriting would change: {{fields}}. Cancel to fill empty fields only.`,"models.catalogOverwriteConfirm":`Overwrite & fill`,"models.catalogOverwriteCancel":`Fill empty only`,"models.catalogFilling":`Filling details…`,"models.catalogFill":`Fill model details`,"models.catalogFilled":`{count} fields filled`,"models.catalogNoEmptyFields":`No empty fields to fill`,"models.catalogNoExactMatch":`No exact models.dev match`,"models.catalogPriceProvider":`Price matched Provider {provider}`,"models.catalogPriceBaseUrl":`Price matched Base URL to {provider}`,"models.catalogPriceConsensus":`Price agreed by {support}/{total} records`,"models.catalogPriceUnreliable":`No reliable price found`,"models.catalogUndo":`Undo`,"models.baseUrl":`Base URL`,"models.apiKey":`API Key`,"models.api":`API Format`,"models.modelId":`ID *`,"models.name":`Name`,"models.apiOverride":`API format`,"models.reasoningThinking":`Reasoning / thinking`,"models.inputFormat":`Input formats`,"models.inputFormatPlaceholder":`Search and add, multiple allowed (Enter to confirm)`,"models.inputFormat.text":`Text`,"models.inputFormat.image":`Image`,"models.badgeReasoning":`Supports reasoning (thinking levels selectable in the chat input)`,"models.badgeInput":`Accepts {format} input`,"models.nameHint":`Leaving empty removes the name field (falls back to the model id).`,"models.apiOverrideHint":`Leaving empty or picking default removes the api field (falls back to the provider's default api).`,"models.reasoningHint":`Unchecking removes the reasoning field (falls back to off).`,"models.thinkingLevelMapHint":`Per level: Default = removes that mapping (falls back to the model's default level); Disabled = writes null; Custom = writes a custom level string.`,"models.compatSection":`Compatibility`,"models.compatInheritHint":`Fields not set on the model show values inherited from this provider (highlighted in dim color); the inherited value is what actually takes effect until overridden here.`,"models.compatHint.supportsDeveloperRole":`Whether to use the developer role for system prompts (used by reasoning models). Set to false for servers that don't support it (Ollama, vLLM, SGLang) to send system messages instead.`,"models.compatHint.supportsLongCacheRetention":`Whether the provider accepts long cache retention: prompt_cache_options.ttl "30m" for GPT-5.6+ Responses models, prompt_cache_retention "24h" for older OpenAI models, or cache_control.ttl "1h" with the anthropic cache format.`,"models.compatHint.supportsUsageInStreaming":`Whether streamed responses support stream_options: {include_usage: true} for token usage reporting.`,"models.compatHint.supportsFinishReason":`Whether streamed responses include finish_reason. When false, pi infers stop or toolUse when the stream ends.`,"models.compatHint.supportsEagerToolInputStreaming":`Whether the provider accepts per-tool eager_input_streaming. Set to false to omit that field and use the legacy fine-grained-tool-streaming beta header.`,"models.compatHint.supportsCacheControlOnTools":`Whether the provider accepts Anthropic-style cache_control markers on tool definitions (tool prompt caching).`,"models.compatHint.supportsTemperature":`Whether the provider accepts the temperature parameter. Set to false for endpoints that reject non-default temperatures (e.g. Claude Opus 4.7+).`,"models.compatHint.requiresToolResultName":`Whether tool result messages must include the name field (required by some endpoints).`,"models.compatHint.requiresAssistantAfterToolResult":`Whether an empty assistant message must be inserted after tool results and before the next user message (required by some endpoints).`,"models.compatHint.requiresThinkingAsText":`Whether thinking blocks should be converted to plain text (for endpoints without thinking block support).`,"models.compatHint.zaiToolStream":`Whether z.ai supports the top-level tool_stream: true parameter for streaming tool call deltas.`,"models.compatHint.supportsThinkingTokenBudget":`Whether the provider supports the top-level thinking_token_budget field to cap reasoning tokens (vLLM-compatible endpoints).`,"models.compatHint.supportsOpenAIGrammarTools":`Whether OpenAI-compatible APIs emit custom Lark/regex grammar tools. When false, grammar-constrained tools fall back to normal function tools.`,"models.compatHint.supportsToolSearch":`Whether the model supports client-executed tool search for deferred tools.`,"models.compatHint.supportsExplicitPromptCacheMode":`Whether the model accepts the prompt_cache_options parameter (OpenAI GPT-5.6+ prompt caching). Older OpenAI models reject it.`,"models.compatHint.forceAdaptiveThinking":`Whether to force adaptive thinking (thinking.type: "adaptive" + output_config.effort) instead of the legacy budget-based thinking payload. Built-in adaptive models set this automatically.`,"models.compatHint.allowEmptySignature":`Whether to replay empty thinking signatures as signature: "". Enable only for Anthropic-compatible endpoints that require it; real Anthropic rejects empty signatures.`,"models.compatHint.supportsStrictTools":`Whether the endpoint accepts strict JSON-schema tool definitions (Anthropic). Built-in Anthropic models enable it.`,"models.compatHint.supportsStore":`Whether the OpenAI endpoint supports the store field.`,"models.compatHint.supportsReasoningEffort":`Whether the endpoint supports the reasoning_effort parameter (often unsupported by Ollama, vLLM, SGLang).`,"models.compatHint.supportsStrictMode":`Whether the endpoint accepts strict JSON-schema function tool definitions. Defaults depend on the API; built-in OpenAI models carry explicit capability metadata.`,"models.compatHint.supportsToolReferences":`Whether tool references in tool results are supported. Default true for first-party Anthropic models except Haiku and models older than Claude 4.5.`,"models.compatHint.maxTokensField":`Field name for the max output token parameter: max_completion_tokens (new API) or max_tokens (legacy API).`,"models.compatHint.sessionAffinityFormat":`Session affinity (caching): sends the session id as an affinity key so requests from one session tend to hit the same backend replica, raising the prompt-cache hit rate — endpoints like Fireworks route prompt caches by session affinity, so leaving it off can spread a session across replicas and waste cache reuse (it does not affect the prompt_cache_key body param, which is governed by cache retention). pi sends these headers only when compat.sendSessionAffinityHeaders is true (openai-responses keys off the format alone); this dropdown writes both fields. auto = enabled with the format auto-detected from the URL; off = explicit disable (overrides a provider-level enable at model level); openai = session_id/x-client-request-id/x-session-affinity; openai-nosession = x-client-request-id/x-session-affinity; openrouter = x-session-id.`,"models.compatHint.deferredToolsMode":`Provider-specific deferred tool serialization. Currently only kimi (Kimi's OpenAI-compatible Chat Completions format).`,"models.compatHint.cacheControlFormat":`Prompt cache marker format. Currently only anthropic: adds cache_control markers on the system prompt, last tool definition, and last text content.`,"models.inheritedFromProvider":`from provider (inherited, override at model level)`,"models.thinkingFormatDeepseekHint":`Selecting "deepseek" also writes requiresReasoningContentOnAssistantMessages: true; any other value removes it.`,"models.samplingParams":`Sampling params`,"models.headers":`Headers`,"models.modelOverrides":`Model overrides`,"models.supportsDeveloperRole":`Developer role`,"models.supportsLongCacheRetention":`Long cache retention`,"models.supportsUsageInStreaming":`Usage in streaming`,"models.supportsFinishReason":`Finish reason in stream`,"models.supportsEagerToolInputStreaming":`Eager tool input streaming`,"models.supportsCacheControlOnTools":`Cache control on tools`,"models.supportsTemperature":`Temperature param`,"models.requiresToolResultName":`Tool result name required`,"models.requiresAssistantAfterToolResult":`Assistant after tool result`,"models.requiresThinkingAsText":`Thinking as text`,"models.requiresReasoningContentOnAssistantMessages":`Reasoning content on assistant`,"models.zaiToolStream":`z.ai tool stream`,"models.supportsThinkingTokenBudget":`Thinking token budget`,"models.supportsOpenAIGrammarTools":`OpenAI grammar tools`,"models.supportsToolSearch":`Tool search`,"models.supportsExplicitPromptCacheMode":`Explicit prompt cache`,"models.forceAdaptiveThinking":`Adaptive thinking`,"models.allowEmptySignature":`Empty thinking signature`,"models.supportsStrictTools":`Strict tool schemas`,"models.supportsStore":`Store param`,"models.supportsReasoningEffort":`Reasoning effort`,"models.supportsStrictMode":`Strict mode`,"models.supportsToolReferences":`Tool references`,"models.maxTokensField":`Max tokens field`,"models.sessionAffinityFormat":`Session affinity`,"models.deferredToolsMode":`Deferred tools mode`,"models.cacheControlFormat":`Cache control format`,"models.thinkingFormat":`Thinking format`,"models.chatTemplateKwargs":`Chat template kwargs`,"models.chatTemplateArgs":`Chat template args`,"models.openRouterRouting":`OpenRouter routing`,"models.vercelGatewayRouting":`Vercel gateway routing`,"models.thinkingLevelMap":`Thinking level`,"models.thinkingLevelMapReset":`Reset (clear)`,"models.thinkingLevelMapResetHint":`Clears the entire thinkingLevelMap: off, minimal, low, medium, high fall back to their defaults; xhigh and max are disabled by default.`,"models.thinkingLevelMapNone":`All disabled`,"models.contextWindow":`Context window (tokens)`,"models.maxOutputTokens":`Max output tokens`,"models.costPerMillion":`Cost (per million tokens)`,"models.cost.input":`Input`,"models.cost.output":`Output`,"models.cost.cacheRead":`Cache read`,"models.cost.cacheWrite":`Cache write`,"models.costNotSet":`Not set`,"models.costAllRequired":`All four rates are required`,"models.costClear":`Clear`,"models.apiKeyPlaceholder":`ENV_VAR_NAME, !shell-command, or literal key`,"models.apiKeyHint":`Literal keys are written to auth.json on save (shared with CLI /login, takes precedence over this field); !shell-command and $ENV references stay in models.json.`,"models.authJsonConnected":`API key provided via auth.json`,"models.authJsonRemove":`Remove`,"models.apiKeyPrompt":`Enter your {provider} API key to enable {count} model{s}.`,"models.oauthAlreadyConnected":`Already connected. You can re-login or disconnect.`,"models.oauthConnectPrompt":`Connect your {provider} account.`,"models.enterValue":`Enter value…`,"models.displayNamePlaceholder":`Display name`,"models.connectionLost":`Connection lost`,"models.networkError":`Network error`,"i18n.testingModel":`Testing model connection...`,"i18n.connected":`Connected`,"i18n.failed":`Failed`,"i18n.test":`Test`,"i18n.testConnection":`Test model connection`,"i18n.provider":`Provider`,"i18n.providers":`Providers`,"i18n.model":`Model`,"i18n.providerName":`Provider name`,"i18n.rename":`Rename`,"i18n.default":`Default`,"i18n.disabled":`Disabled`,"plugins.statusLoaded":`Loaded and active`,"plugins.statusInstalled":`Installed, not yet loaded`,"plugins.statusDisabled":`Disabled`,"plugins.statusMissing":`Configured but package not found`,"plugins.extensionFilters":`Extension filters`,"plugins.filterRules":`Filter rules`,"plugins.managePlugins":`Plugins`,"plugins.extensionFiltersHint":`Filters for auto-discovered extensions in ~/.pi/agent/extensions/ and .pi/extensions/. Only patterns starting with !, +, or - take effect; plain paths do nothing.`,"plugins.noExtensionFilters":`No filters configured`,"plugins.addFilter":`Add filter`,"plugins.filterPatternLabel":`Pattern`,"plugins.filterPlaceholder":`!pattern · +path · -path`,"plugins.filterInvalid":`Pattern must start with !, +, or -; plain paths have no effect in the extensions field.`,"plugins.filterPrefixExclude":`Exclude matching extensions`,"plugins.filterPrefixForceInclude":`Force-include exact path`,"plugins.filterPrefixForceExclude":`Force-exclude exact path`,"plugins.filterEffect":`Effect`,"plugins.removeFilter":`Remove filter`,"plugins.npmSourcePlaceholder":`npm:@scope/package`,"plugins.scopeLabel":`Install to`,"plugins.scopeInstallHint.global":`Click to install to the global plugin directory (~/.pi/agent/{npm,git})`,"plugins.scopeInstallHint.project":`Click to install to this project (.pi/agent/{npm,git})`,"plugins.sourceLabel":`Source`,"plugins.scopeGlobal":`Global`,"plugins.scopeProject":`Project`,"plugins.examplesTitle":`Examples`,"plugins.totalsSummary":`{extensions} ext · {skills} skills · {prompts} prompts · {themes} themes`,"plugins.diagnosticCount":`{n} diagnostic{s}`,"plugins.packageInstalled":`Package installed.`,"plugins.packageUpdated":`Package updated.`,"plugins.packageRemoved":`Package removed.`,"plugins.packageDisabled":`Package disabled.`,"plugins.packageEnabled":`Package enabled.`,"plugins.extensionFilterAdded":`Extension filter added.`,"plugins.extensionFilterRemoved":`Extension filter removed.`,"plugins.sessionReloaded":`Session reloaded.`,"i18n.noResources":`No resources`,"i18n.unknown":`Unknown`,"i18n.installedVersion":`installed {version}`,"i18n.configuredVersion":`configured {version}`,"i18n.extensions":`Extensions`,"i18n.prompts":`Prompts`,"i18n.themes":`Themes`,"i18n.resourceCount":`{count} {label}`,"i18n.extensionShort":`ext`,"i18n.versionShort":`ver`,"i18n.skillShort":`skills`,"i18n.promptShort":`prompts`,"i18n.themeShort":`themes`,"i18n.custom":`Custom`,"i18n.clearAll":`clear all`,"i18n.connectedSuccessfully":`Connected successfully.`,"i18n.notConnected":`not connected`,"i18n.configured":`configured`,"i18n.notConfigured":`not configured`,"i18n.openingBrowser":`Opening browser…`,"i18n.submit":`Submit`,"i18n.login":`Login`,"i18n.relogin":`Re-login`,"i18n.disconnect":`Disconnect`,"i18n.networkError":`Network error`,"i18n.continuing":`Continuing…`,"i18n.skills":`Skills`,"i18n.plugins":`Plugins`,"i18n.addSkill":`Add skill`,"i18n.addPlugin":`Add plugin`,"i18n.recommendedPlugins":`Recommended`,"i18n.selectSkill":`Select a skill`,"i18n.selectPackage":`Select a package`,"i18n.configBindings":`Bound config files`,"i18n.addBinding":`Add`,"i18n.configFileNote":`Note (optional)`,"i18n.bindConfigFile":`Bind config file`,"i18n.selectFile":`Select a file`,"i18n.noConfigBindings":`No config files bound`,"i18n.noFiles":`No files`,"i18n.allFiles":`All files`,"i18n.filterByType":`Filter by type`,"i18n.removeBinding":`Remove binding`,"i18n.confirm":`Confirm`,"i18n.updateAvailable":`Update available`,"i18n.upToDate":`Up to date`,"i18n.automaticChecksUnavailable":`Automatic checks unavailable`,"i18n.checkFailed":`Check failed`,"i18n.installed":`Installed`,"i18n.status":`Status`,"i18n.version":`Version`,"i18n.package":`Package`,"i18n.resources":`Resources`,"i18n.installedPath":`Installed path`,"i18n.readme":`README`,"i18n.readmeDetails":`Details`,"i18n.unsafeLinkBlocked":`Blocked unsafe link (only same-directory or sub-directory relative links are allowed): {href}`,"i18n.resolvedResources":`Resolved Resources`,"i18n.reloadSession":`Reload session`,"i18n.reloading":`Reloading...`,"i18n.packageRemoved":`Package removed.`,"i18n.packageInstalled":`Package installed.`,"i18n.packageUpdated":`Package updated.`,"i18n.packageDisabled":`Package disabled.`,"i18n.packageEnabled":`Package enabled.`,"i18n.sessionReloaded":`Session reloaded.`,"i18n.thinking":`Thinking`,"i18n.loadingThinking":`Loading thinking...`,"i18n.copyMessage":`Copy message`,"i18n.editFromHere":`Edit from here`,"i18n.editFromHereTitle":`Edit from here — branches within this session`,"i18n.editFromHereDisabledBusy":`Agent is running — available once it finishes`,"i18n.editFromHereDisabledNoAnchor":`The previous entry isn't an assistant reply (interrupt notice / tool result)`,"i18n.userMessageExpandHint":`Click to view full text`,"i18n.newSession":`New session`,"i18n.newSessionTitle":`New session — creates an independent copy from here`,"i18n.estimatedTokens":`Estimated token count while streaming`,"i18n.noOutput":`(no output)`,"i18n.noSummary":`(no summary)`,"i18n.conversationCompacted":`Conversation compacted`,"i18n.compactionDescription":`The conversation history before this point was compacted into the following summary:`,"i18n.fileContext":`File context: {details}`,"i18n.readFiles":`Read files`,"i18n.modifiedFiles":`Modified files`,"i18n.hiddenExtensionMessage":`hidden extension message`,"i18n.noMessage":`(no message)`,"i18n.collapse":`Collapse`,"i18n.expand":`Expand`,"i18n.hideDetails":`Hide details`,"i18n.showDetails":`Show details`,"i18n.thinkingUnavailable":`Thinking content unavailable`,"i18n.thinkingEncrypted":`Thinking content is encrypted (provider-encrypted for context continuity, plaintext not available)`,"i18n.before":`Before`,"i18n.after":`After`,"common.copy":`Copy`,"common.copied":`Copied`,"common.decrease":`Decrease font size`,"common.reset":`Reset`,"common.increase":`Increase font size`,"common.expand":`Expand`,"common.collapse":`Collapse`,"common.preview":`Preview`,"common.source":`Source`,"common.export":`Export`,"common.open":`Open`,"common.close":`Close`,"common.zoomIn":`Zoom in`,"common.zoomOut":`Zoom out`,"common.resetZoom":`Reset zoom`,"common.rotate":`Rotate image`,"image.loadError":`Image failed to load`,"image.loading":`Loading image...`}},cae={id:`zh-CN`,label:`简体中文`,messages:{"common.ok":`确定`,"common.language":`语言`,"common.models":`模型`,"common.skills":`技能`,"common.plugins":`插件`,"common.mcp":`MCP`,"sidebar.hide":`收起侧边栏`,"sidebar.show":`展开侧边栏`,"theme.light":`切换到浅色模式`,"preferences.defaultThinkingLevel":`默认思考级别`,"preferences.thinkingLevelHint":"新会话的全局默认思考级别(settings.json `defaultThinkingLevel`)。未设置=删除该字段(回落 pi 默认)。","preferences.thinkingLevelNotSet":`未设置(跟随模型默认)`,"preferences.compaction":`自动压缩`,"preferences.compactionHint":"自动压缩长会话(settings.json `compaction`)。未配置时按 pi 默认值展示,改动即写入完整对象。","preferences.compactionEnabled":`启用`,"preferences.compactionReserveTokens":`输出预留词元数`,"preferences.compactionReserveTokensHint":`为模型输出预留的词元数,压缩时保留这部分空间供回复使用`,"preferences.compactionKeepRecentTokens":`压缩后保留词元数`,"preferences.compactionKeepRecentTokensHint":`压缩后保留的词元数,从最近聊天记录开始逆向往前计算`,"preferences.retry":`API 重试`,"preferences.retryHint":"供应商 API 调用的重试设置(settings.json `retry`)。未配置时按 pi 默认值展示,改动即写入完整对象;provider 子字段留空则不写入。","preferences.retryEnabled":`启用重试`,"preferences.retryEnabledHint":`是否对失败的 API 调用启用重试`,"preferences.retryMaxRetries":`最大重试次数`,"preferences.retryBaseDelayMs":`基础延迟(毫秒)`,"preferences.retryBaseDelayMsHint":`首次重试前的初始延迟,单位毫秒`,"preferences.retryProviderTimeoutMs":`供应商超时(毫秒)`,"preferences.retryProviderMaxRetries":`供应商最大重试次数`,"preferences.retryProviderMaxRetryDelayMs":`供应商最大延迟(毫秒)`,"preferences.defaultProjectTrust":`新项目默认信任`,"preferences.projectTrustHint":"新项目的默认信任策略(settings.json `defaultProjectTrust`)。未设置=删除该字段(回落「询问」)。","preferences.projectTrustNotSet":`未设置(询问)`,"preferences.projectTrustAsk":`询问`,"preferences.projectTrustAlways":`总是信任`,"preferences.projectTrustNever":`从不信任`,"preferences.notifyEvents":`浏览器通知`,"preferences.notifyEventsHint":`标签页非激活时发浏览器通知。权限在首次交互时请求。`,"notify.permission.request":`开启通知`,"notify.permission.requestHint":`点击开启浏览器通知:任务完成时即使不在本页也会提醒`,"notify.permission.granted":`通知已开启`,"wsHealth.disconnected":`与服务的连接已断开,正在自动重连…`,"wsHealth.restored":`连接已恢复`,"reducedMotionNotice.message":`检测到系统开启了「减少动态效果」(prefers-reduced-motion):为尊重该系统设置,本应用已关闭部分动画效果。若想恢复,可搜索「如何关闭减少动态效果」或「prefers-reduced-motion」,按系统/浏览器说明关闭。每个浏览器会话只提示一次。`,"notify.permission.grantedHint":`已开启浏览器通知:任务完成时即使不在本页也会提醒`,"notify.permission.bannerHintBefore":`点击左上工具栏的`,"notify.permission.bannerHintAfter":`按钮开启通知权限,任务完成、出错或提问时都能收到浏览器通知,详细设置可在 配置中心 → 会话 → 通知 栏目中调整`,"notify.permission.denied":`通知被阻止`,"notify.permission.deniedHint":`浏览器阻止了通知。请点击地址栏左侧图标 → 站点设置,将通知改为允许后重试`,"preferences.notifyWhileActive":`页面激活时也通知`,"preferences.notifyTaskComplete":`任务完成`,"preferences.notifyErrors":`运行出错`,"preferences.notifyQuestions":`提问`,"theme.dark":`切换到深色模式`,"theme.toggleTheme":`切换主题`,"theme.darkMode":`深色`,"theme.lightMode":`浅色`,"theme.fontSize":`字体大小`,"theme.scrollStep":`悬停滚动步长`,"scrollStep.hint":`悬停滚动方向箭头时,内容每次滚动的像素数(面板滚动箭头与消息地图共用此步长)。`,"scrollStep.range":`每次悬停滚动像素(1-1000)`,"scrollStep.unit":`px`,"theme.autoReloadSeconds":`自动定时同步聊天消息间隔`,"autoReload.off":`关闭(0)— 不自动刷新`,"autoReload.range":`秒(0 — 3600)`,"autoReload.unit":`秒`,"autoReload.hint":`自动重新读取会话文件的间隔秒数;0 = 关闭。单客户端场景(消息经 WebSocket 实时推送)保持 0 即可;多客户端协作(多个浏览器同时操作同一会话)时设为大于 0,各客户端定时刷新以读取其他客户端生成的新聊天消息。`,"recentBlocks.hint":`保持展开的最近已完成块数(含最新完成的块本身;默认 0,即所有已完成块默认收起,可悬停预览/点击展开)。`,"autoReload.reset":`恢复默认({n} 秒)`,"chat.reloadFromDisk":`从磁盘同步会话文件内容`,"chat.reloadFromDiskHint":`当多个客户端同时读写同一个会话 jsonl 时使用。可在 配置中心 → 会话 页面设置自动定时同步。`,"chat.exportSession":`导出会话(HTML)`,"chat.exportSessionHint":`下载完整会话为独立 HTML 文件(可在任意浏览器离线查看消息树)。`,"scrollStep.reset":`恢复默认({n} px)`,"theme.recentBlocksExpanded":`最近完成块保持展开数`,"theme.markdownThemeDark":`代码块主题(深色外观)`,"theme.markdownThemeLight":`代码块主题(浅色外观)`,"theme.markdownThemeHint":`语法高亮调色板,深/浅色外观各自设置。作用于消息区与文档(.md)预览的代码块;代码文件源码视图与 mermaid 源码目前固定跟随外观深浅(Prism 体系,主题名不可通用)。`,"layout.sidebarWidth":`左侧面板宽度`,"layout.widgetPanelWidth":`右侧面板宽度`,"layout.widthRange":`px({min}–{max})`,"layout.widthReset":`恢复默认({value} px)`,"longBlock.blocks":`个`,"recentBlocks.reset":`恢复默认({n} 个)`,"recentBlocks.range":`0-20,含最新完成的块`,"history.full":`轨迹`,"history.unsaved":`会话保存后才能查看轨迹`,"title.generating":`正在生成...`,"title.updated":`标题已更新`,"title.noMessages":`请先发送消息,再为会话命名`,"title.generateSession":`生成会话标题`,"system.prompt":`系统提示词`,"system.promptHint":`显示最近一轮请求实际使用的系统提示词(由会话记录派生);新会话需先发送一条消息,才会有可显示的提示词。`,"system.empty":`系统提示词为空(工具已禁用)`,"system.load":`发送消息以加载系统提示词`,"notices.title":`消息中心`,"notices.empty":`暂无消息`,"mcp.requiresCwd":`打开一个工作目录后查看 MCP 服务器配置`,"mcp.title":`MCP 服务器`,"mcp.builtinNote":`内置 MCP 支持已随会话启用(pi 0.99+),无需安装 mcp 插件——安装注册 /mcp 的扩展会取代内置支持。配置来自 mcp.json,会话启动时连接。`,"mcp.empty":"尚未配置 MCP 服务器。用 `pi mcp add <name> -- <command>` 或编辑 {globalPath}。","mcp.sourceGlobal":`全局`,"mcp.sourceProject":`项目`,"mcp.disabled":`已禁用`,"mcp.exposure":`接入方式`,"mcp.toolExposureCount":`{n} 个工具覆盖`,"mcp.timeout":`{n}s 超时`,"mcp.projectUntrusted":`项目 .pi/mcp.json 未生效:项目尚未受信任(stdio 服务器会执行命令)。`,"mcp.howToEdit":"可在上方卡片直接新增/编辑/删除服务器;改后 /reload 或新会话生效。OAuth 登录用 `pi mcp login <server>`。","mcp.addServer":`添加服务器`,"mcp.addTo":`添加至`,"mcp.editServer":`编辑服务器`,"mcp.removeServer":`删除服务器`,"mcp.removeConfirmTitle":`删除 MCP 服务器`,"mcp.removeConfirmDesc":`将从{source} mcp.json 中删除“{name}”。改后 /reload 或新会话生效。`,"mcp.fieldName":`名称`,"mcp.fieldTransport":`类型`,"mcp.transportStdio":`stdio(本地命令)`,"mcp.transportHttp":`HTTP(远程)`,"mcp.fieldCommand":`命令`,"mcp.fieldArgs":`参数`,"mcp.fieldArgsHint":`空格分隔,如:-y server-fs .`,"mcp.fieldUrl":`URL`,"mcp.fieldEnv":`环境变量`,"mcp.fieldHeaders":`请求头`,"mcp.fieldKvHint":`每行一条 KEY=VALUE`,"mcp.fieldTimeout":`超时(秒,可选)`,"mcp.fieldEnabled":`启用`,"mcp.dialogTargetGlobal":`保存到 {path}`,"mcp.dialogTargetProject":`保存到 {path}`,"mcp.dialogTargetProjectUnavailable":`项目未受信任,无法写入项目 mcp.json`,"mcp.errNameRequired":`名称不能为空`,"mcp.errCommandRequired":`stdio 服务器需要填写命令`,"mcp.errUrlRequired":`HTTP 服务器需要填写 URL`,"mcp.autoEnableCodemode":`自动启用 codemode`,"mcp.autoEnableCodemodeHint":`存在以 codemode 方式接入的 MCP 服务器时,自动激活 codemode(模型编写 JS 脚本并行调用工具;codemode 接入的工具不进模型上下文,仅可在脚本中 searchTools 后调用)。`,"mcp.exposureDirect":`direct(直接声明给模型)`,"mcp.exposureModelOnly":`model-only(仅模型,不进脚本)`,"mcp.exposureCodemode":`codemode(仅脚本调用)`,"mcp.exposureDeferred":`deferred(tool_search 加载)`,"mcp.exposureHidden":`hidden(隐藏)`,"notices.filterInfo":`显示 info 级消息`,"notices.filterWarning":`显示 warning 级消息`,"notices.filterError":`显示 error 级消息`,"notices.search":`搜索消息`,"notices.clear":`清除`,"notices.clearCurrentHint":`清除当前会话的消息留痕(当前范围:仅当前会话)`,"notices.clearAllHint":`清除所有会话的消息留痕(当前范围:全部会话)`,"notices.clearCurrent":`清除当前会话的消息`,"notices.clearAll":`清除所有消息`,"notices.remove":`删除此消息`,"notices.onlyCurrent":`仅当前会话`,"notices.onlyCurrentOnHint":`只显示当前会话的消息(点击改为显示全部会话)`,"notices.onlyCurrentOffHint":`显示全部会话的消息(点击改为只看当前会话)`,"notices.fromSession":`来自会话`,"notices.global":`全局`,"session.info":`会话信息`,"session.reload":`重载会话(重读配置与资源)`,"session.name":`名称`,"session.file":`文件`,"session.inMemory":`内存中`,"session.id":`ID`,"session.user":`用户`,"session.assistant":`助手`,"session.toolCalls":`工具调用`,"session.toolResults":`工具结果`,"session.total":`总计`,"session.input":`输入`,"session.output":`输出`,"session.cacheRead":`缓存读取`,"session.cacheWrite":`缓存写入`,"session.inputHint":`未命中缓存的输入 token 数:系统提示、会话历史、工具定义等发送给模型的上下文,减去命中缓存的部分`,"session.outputHint":`模型生成回复的 token 数(回答与思考)`,"session.cacheReadHint":`命中 prompt 缓存的 token 数:与上一请求未变的上下文直接从缓存读取,按折扣价计费`,"session.cacheWriteHint":`首次写入缓存的 token 数(Anthropic 风格按写入计费)`,"session.totalHint":`输入 + 输出 + 缓存读取 + 缓存写入`,"session.cacheHitRate":`缓存命中率`,"session.cacheReadRate":`缓存命中率:命中缓存的 token(缓存读取)占全部输入 prompt(输入 + 缓存读取 + 缓存写入)的比例,即官方口径 cacheRead ÷ (input + cacheRead + cacheWrite)`,"session.cost":`费用`,"session.context":`上下文`,"session.copy":`复制{value}`,"session.copied":`已复制`,"session.title":`会话信息`,"session.load":`发送消息或运行 /session 以加载会话信息`,"session.infoSection":`会话信息`,"session.messages":`消息`,"session.tokens":`词元`,"session.copyFile":`复制文件路径`,"session.copyId":`复制会话 ID`,"workspace.opening":`正在打开工作区...`,"workspace.unable":`无法打开工作区`,"workspace.selectSession":`从侧边栏选择一个会话`,"workspace.selectWorkspace":`请选择工作区`,"workspace.stepProject":`从侧边栏选择项目目录`,"workspace.stepModels":`点击底部的“模型”按钮添加模型`,"tabs.chat":`聊天`,"tabs.widgets":`小组件`,"tabs.updates":`更新`,"tabs.branches":`对话分支`,"branch.assistantFallback":`[助手消息]`,"branch.customMessage":`自定义消息`,"branch.sessionInfo":`会话信息`,"branch.thinkingLevelChange":`思考级别变更`,"branch.modelChange":`模型切换`,"tabs.trajectory":`轨迹`,"trajectory.noSession":`选择一个会话后查看轨迹`,"trajectory.loading":`加载中…`,"trajectory.summary":`共 {turns} 轮 · {tools} 次工具调用`,"trajectory.emptyTurn":`(无用户消息)`,"trajectory.turnStats":`{tools} 工具 · {errors} 错误`,"trajectory.toolError":`工具 {name} 执行失败`,"trajectory.lane.user":`用户消息`,"trajectory.overviewEmpty":`展开轮次查看时间线`,"trajectory.lane.assistant":`助手消息`,"trajectory.lane.tool":`工具调用`,"config.title":`配置`,"config.mobileDisabled":`配置中心暂不支持移动端,请在桌面端浏览器打开`,"config.section.session":`会话`,"config.section.appearance":`外观`,"config.section.advanced":`高级`,"config.section.envVars":`环境变量`,"config.env.hint":`pi-web 服务端进程实际生效的环境变量(含 .env / shell 导出 / OS 级 / 进程继承的全部注入来源),仅查看。机密类变量已脱敏。`,"config.env.filterPlaceholder":`按变量名过滤…`,"config.env.colName":`变量名`,"config.env.colValue":`值`,"config.env.emptyTitle":`变量已设置但值为空`,"config.env.loadFailed":`加载失败:`,"config.env.loading":`加载中…`,"config.env.noMatch":`无匹配变量`,"config.section.tools":`工具`,"config.search.placeholder":`搜索配置(至少2个字符)…`,"config.search.open":`搜索配置(Ctrl+F)`,"config.search.hint":`点击搜索配置项(Ctrl+F)`,"config.search.matchCount":`{count} 处匹配`,"config.search.noResults":`无匹配配置`,"config.section.fileExclusions":`文件排除`,"config.section.startScreen":`开始屏幕`,"config.section.git":`Git`,"config.section.modelThinking":`思考级别`,"config.section.requiresCwd":`请先从侧边栏选择项目目录,再浏览插件 / 技能`,"updates.check":`检测更新`,"updates.checking":`检查中…`,"updates.checkedAt":`上次检测`,"updates.upToDate":`已是最新`,"updates.updateAvailable":`有新版本`,"updates.unavailable":`检查失败`,"updates.noPluginUpdates":`全部插件已是最新`,"updates.banner":`有可用更新:{items}`,"updates.view":`查看`,"updates.copied":`已复制`,"updates.copyCommand":`复制命令`,"updates.restartNote":`执行以上命令更新pi-web,重启服务后生效。`,"updates.enableChecking":`启用更新检测`,"updates.enableCheckingHint":`开启后每 30 分钟自动检测一次更新(也可随时手动点击「检测更新」)`,"updates.disabled":`更新检测已关闭`,"updates.ignoreVersion":`忽略此版本`,"updates.ignored":`已忽略 {version}`,"updates.ignoredPlugin":`已忽略`,"updates.unignore":`取消忽略`,"preferences.fileExclusions.title":`文件排除名单`,"preferences.fileExclusions.description":`文件浏览器与 @ 文件索引共用的排除规则:*.xxx 形式按后缀匹配,其余为目录/文件名精确匹配。各级整体替换下一级(不合并):项目级完全覆盖全局,全局完全覆盖内置默认。添加时可用逗号分隔多个条目(目录/文件名可含空格);保存后立即生效。`,"preferences.fileExclusions.global":`全局`,"preferences.fileExclusions.project":`项目`,"preferences.fileExclusions.defaults":`内置默认(只读)`,"preferences.fileExclusions.inputPlaceholder":`如 node_modules、*.pyc(多条用逗号分隔)`,"preferences.fileExclusions.importHigher":`复制上级名单到此`,"preferences.fileExclusions.loadFailed":`排除名单加载失败`,"preferences.defaultTools.title":`默认工具(defaultTools)`,"preferences.defaultTools.description":`配置新会话启动时启用的工具(pi settings.json defaultTools)。聊天框下方的工具预设下拉的选项列表(full 等)在本 tab 下方的「工具预设」区块管理;选中预设只是会话级临时切换,不写入这里。grep / find / ls 等默认不启用的内置工具、以及 codemode 都可在此开启;MCP 设置中另有 autoEnableCodemode 自动激活选项,两者独立。全量替换=精确白名单;增量修改=在 pi 默认集(read/bash/edit/write)上增减;增量模式下悬停「生效名单」徽标可查看实际启用结果。`,"preferences.defaultTools.global":`全局默认工具列表`,"preferences.defaultTools.project":`项目默认工具列表`,"preferences.defaultTools.modeFull":`全量替换`,"preferences.defaultTools.modeIncremental":`增量修改`,"preferences.defaultTools.save":`保存`,"preferences.defaultTools.reset":`重置`,"preferences.defaultTools.incrementalHint":`增量模式:条目均以 +/- 前缀写入;点击工具名生成 -tool(移除),再次点击恢复。`,"preferences.defaultTools.confirmTitle":`保存并重启受影响会话`,"preferences.defaultTools.confirmRestartGlobal":`保存全局默认工具列表将重启当前打开过的所有会话进程(新会话立即使用新名单);正在运行任务的会话不会被打断,继续用旧名单直到空闲后自动重启。`,"preferences.defaultTools.confirmRestartProject":`保存项目级默认工具列表将重启该项目下已打开的会话进程(新会话立即使用新名单);正在运行任务的会话不会被打断。`,"preferences.defaultTools.saveResult":`已保存,重启了 {restarted} 个会话进程`,"preferences.defaultTools.saveResultSkipped":`已保存,重启了 {restarted} 个会话进程;{skipped} 个正在运行的会话未重启,将在空闲后自动重启`,"preferences.defaultTools.fullHint":`全量模式:勾选的工具即完整名单,完全替换 pi 默认集(未勾选的默认工具将不可用)。`,"preferences.defaultTools.toolDesc.read":`读取文件内容(可指定行范围;只读,不修改文件)`,"preferences.defaultTools.toolDesc.bash":`执行 shell 命令(通用入口:构建、git、进程管理等)`,"preferences.defaultTools.toolDesc.edit":`编辑文件(精确匹配旧文本做局部替换;新建或整文件重写用 write)`,"preferences.defaultTools.toolDesc.write":`新建文件或整文件覆盖写入(局部修改用 edit)`,"preferences.defaultTools.toolDesc.grep":`按正则搜索文件内容(文件探索专用工具,不占 bash 轮次)`,"preferences.defaultTools.toolDesc.find":`按文件名模式查找文件(文件探索专用工具,不占 bash 轮次)`,"preferences.defaultTools.toolDesc.ls":`列出目录内容(快速浏览项目布局)`,"preferences.defaultTools.toolDesc.powershell":`执行 PowerShell 命令(pwsh 或 Windows PowerShell;面向 Windows 的 bash 替代)`,"preferences.defaultTools.toolDesc.codemode":`模型用 JS 脚本(QuickJS 沙箱)编排其他工具——一次调用内并行执行、先过滤大结果,只把脚本输出交给模型。`,"preferences.defaultTools.toolDesc.tool_search":`让模型搜索并按需加载未声明工具(codemode/deferred 暴露,如 MCP 工具)。`,"preferences.defaultTools.projectUntrusted":`项目未受信,无法写入项目级 settings.json(先在项目信任提示中信任该目录)。`,"preferences.defaultTools.loadFailed":`默认工具配置加载失败`,"preferences.toolPresets.title":`工具预设`,"preferences.toolPresets.description":`聊天框底部工具预设下拉的选项列表(~/.pi/agent/pi-web/tool-presets.json)`,"preferences.toolPresets.nameLabel":`名称`,"preferences.toolPresets.namePlaceholder":`预设名称(必填)`,"preferences.toolPresets.nameRequired":`名称不能为空`,"preferences.toolPresets.nameDuplicate":`名称不能重复`,"preferences.toolPresets.descriptionLabel":`描述`,"preferences.toolPresets.descriptionPlaceholder":`可选描述,展示在下拉选项中`,"preferences.toolPresets.remove":`删除`,"preferences.toolPresets.defaultHint":`内置预设(只读):生效名单跟随上方默认工具列表(项目优先于全局)`,"preferences.toolPresets.defaultSourceGlobal":`项目未配置默认工具,跟随全局列表`,"preferences.toolPresets.defaultSourceSdk":`项目与全局均未配置,使用 pi 内置默认(read/bash/edit/write)`,"preferences.toolPresets.staleRestart":`默认工具列表已更新,重启 pi-web 后对运行中的会话生效`,"preferences.toolPresets.add":`添加预设`,"preferences.toolPresets.save":`保存`,"preferences.toolPresets.reset":`重置`,"preferences.toolPresets.saved":`已保存,聊天框下拉即刻生效`,"preferences.toolPresets.loadFailed":`工具预设配置加载失败`,"preferences.pi.unset":`pi 默认`,"preferences.pi.enableAnalytics":`启用分析`,"preferences.pi.enableAnalyticsHint":"发送匿名使用分析(settings.json `enableAnalytics`)","preferences.pi.enableInstallTelemetry":`启用安装遥测`,"preferences.pi.enableInstallTelemetryHint":"发送匿名安装遥测(settings.json `enableInstallTelemetry`)","preferences.pi.httpProxy":`HTTP 代理`,"preferences.pi.httpProxyHint":"HTTP 请求的代理地址(settings.json `httpProxy`)。留空无法清除已设置的值。","preferences.pi.trackingId":`分析跟踪 ID`,"preferences.pi.trackingIdHint":"自定义分析跟踪 ID(settings.json `trackingId`)。留空无法清除已设置的值。","preferences.pi.httpIdleTimeoutMs":`HTTP 空闲超时(毫秒)`,"preferences.pi.httpIdleTimeoutMsHint":"HTTP 空闲超时毫秒数(settings.json `httpIdleTimeoutMs`)。留空无法清除已设置的值。","preferences.pi.websocketConnectTimeoutMs":`WebSocket 连接超时(毫秒)`,"preferences.pi.websocketConnectTimeoutMsHint":"WebSocket 连接超时毫秒数(settings.json `websocketConnectTimeoutMs`)。留空无法清除已设置的值。","preferences.pi.branchSummary":`分支摘要`,"preferences.pi.branchSummaryHint":"分支摘要自动压缩(settings.json `branchSummary`)","preferences.pi.reserveTokens":`预留 token`,"preferences.pi.skipPrompt":`跳过提示`,"preferences.pi.images":`图片处理`,"preferences.pi.imagesHint":"pi 引擎如何处理图片(settings.json `images`)","preferences.pi.autoResize":`自动缩放`,"preferences.pi.autoResizeHint":"压缩 `read` 等工具返回的图片以节省 token。","preferences.pi.blockImages":`阻止图片`,"preferences.pi.blockImagesHint":`在消息发送给模型前移除所有图片内容。`,"config.files.hint":`直接编辑 pi 的配置文件(JSON)。保存前校验,写前自动备份(保留最近 10 份)。`,"config.widgets.empty":`暂无小组件配置。插件弹出小组件时会自动在此创建条目。`,"config.widgets.x":`x`,"config.widgets.y":`y`,"config.widgets.width":`宽`,"config.widgets.height":`高`,"config.widgets.bind":`绑定消息`,"config.widgets.bindTitle":`绑定自定义消息`,"config.widgets.bindHint":`为小组件「{key}」绑定一条快捷消息`,"config.widgets.editTitle":`编辑快捷消息`,"config.widgets.editHint":`修改标题、内容与发送方式。`,"config.widgets.label":`描述`,"config.widgets.labelPlaceholder":`按钮显示的文字(如:重载)`,"config.widgets.message":`消息内容`,"config.widgets.messagePlaceholder":`斜杠命令或任意文本(如 /reload)`,"config.widgets.messageTooltip":`以 / 开头时仅提示内置、全局插件与 Skill 命令;项目级插件命令不会出现在列表中,但可手动输入后保存`,"config.widgets.sendImmediately":`立即发送`,"config.widgets.sendMode":`发送方式`,"config.widgets.fillToChatInput":`填充到聊天框`,"config.widgets.sendImmediatelyTooltip":`立即发送:`,"config.widgets.fillToChatInputTooltip":`填充到聊天框:`,"config.widgets.nameConflict":`名称「{label}」已存在,请换一个名称`,"config.startScreen.nameConflict":`名称「{label}」已存在,请换一个名称`,"config.widgets.confirm":`确认`,"config.widgets.unbindTitle":`解绑消息`,"config.widgets.unbindConfirm":`确定解绑「{label}」?`,"config.widgets.unbind":`解绑`,"config.startScreen.hint":`新会话开始屏幕(Pi Logo 下方)展示的快捷入口;点击后按各条绑定的发送方式立即发送或填充到聊天输入框。`,"config.startScreen.bind":`绑定消息`,"config.startScreen.bindTitle":`绑定快捷消息`,"config.startScreen.bindHint":`为开始屏幕绑定一条快捷消息。`,"config.startScreen.editTitle":`编辑快捷消息`,"config.startScreen.editHint":`修改标题、内容与发送方式。`,"config.startScreen.empty":`暂无快捷消息,开始屏幕不会显示快捷入口。`,"config.startScreen.unbindTitle":`解绑消息`,"config.startScreen.unbindConfirm":`确定解绑「{label}」?`,"config.startScreen.unbind":`解绑`,"config.startScreen.reset":`重置`,"config.startScreen.resetHint":`恢复内置默认快捷消息;保留你自绑定的消息(与默认同名的会被默认项覆盖)。`,"config.files.save":`保存`,"config.files.saving":`保存中...`,"config.files.saved":`已保存`,"config.files.missing":`尚未创建`,"config.files.placeholder":`从左侧选择要编辑的配置文件`,"layout.resizeSidebar":`调整侧边栏宽度`,"layout.resizeWidgetPanel":`调整小组件面板宽度`,"layout.resizeHint":`拖动调整宽度。双击或按 Enter 恢复默认值。`,"sidebar.newWorkspace":`新增工作区`,"sidebar.searchSessions":`搜索会话`,"sidebar.searchSessionsPlaceholder":`搜索会话…`,"sidebar.justNow":`刚刚`,"sidebar.minutesAgo":`{count} 分钟前`,"sidebar.hoursAgo":`{count} 小时前`,"sidebar.daysAgo":`{count} 天前`,"sidebar.searchSessionsNoResults":`无匹配会话`,"sidebar.newSessionTitle":`在 {path} 中新建会话`,"sidebar.refresh":`刷新`,"directoryPicker.selectDirectory":`选择目录`,"directoryPicker.goToParent":`转到上级目录`,"directoryPicker.directoryPath":`目录路径`,"directoryPicker.goToDirectory":`转到目录`,"directoryPicker.go":`转到`,"directoryPicker.loadingDirectories":`正在加载目录…`,"directoryPicker.noSubdirectories":`没有子目录`,"directoryPicker.openBeforeSelecting":`选择前请先打开此路径`,"directoryPicker.selectCurrentDirectory":`选择当前目录`,"directoryPicker.selectThisFolder":`选择此文件夹`,"directoryPicker.noDrives":`未找到盘符`,"directoryPicker.search":`筛选文件夹`,"directoryPicker.noMatches":`没有匹配的文件夹`,"sidebar.checking":`检查中…`,"sidebar.open":`打开`,"sidebar.cancel":`取消`,"sidebar.openRepoRoot":`worktree 切换不可用`,"sidebar.openRepoRootTitle":`worktree 切换功能当前不可用:请先在侧栏将当前工作目录切换到 Git 仓库根目录。`,"sidebar.gitRepoRootOnly":`仅 Git 仓库根目录`,"sidebar.gitRepoRootOnlyTitle":`只能在 Git 仓库根目录使用 worktree。`,"sidebar.worktrees":`Worktrees...`,"sidebar.checkingWorktrees":`正在检查此目录的 worktree。`,"sidebar.filterWorktrees":`筛选 worktree…`,"sidebar.noMatchingWorktrees":`没有匹配的 worktree`,"sidebar.switchWorktree":`切换 worktree`,"sidebar.switchWorktreeTitle":`切换 worktree:{path}`,"sidebar.main":`主分支`,"sidebar.forceRemoveCheckout":`存在未提交的更改。强制移除 checkout?`,"sidebar.force":`强制移除`,"sidebar.createWorktreeTitle":`为分支创建 worktree checkout`,"sidebar.newWorktree":`新建 worktree…`,"sidebar.branchName":`Git 分支名称`,"sidebar.creating":`创建中…`,"sidebar.create":`创建`,"sidebar.uploadFilesTitle":`将文件上传到项目根目录`,"sidebar.uploadFiles":`上传文件`,"sidebar.refreshExplorer":`刷新文件浏览器`,"sidebar.changedFiles":`{count} 个变更文件`,"sidebar.loading":`加载中...`,"sidebar.sessionDeleted":`会话已删除,请选择其他会话`,"sidebar.noSessions":`未找到会话`,"sidebar.workspace":`工作区`,"sidebar.workspaceStoragePath":`当前工作区会话文件保存路径:{path}`,"sidebar.newActivity":`有新活动`,"sidebar.newSessionActivity":`会话有新活动`,"sidebar.interactionBadge":`会话等待交互响应`,"sidebar.deleteSession":`删除 {title}?`,"sidebar.deleteWorkspace":`工作区「{name}」下的 {count} 个会话及其附件都会被一并删除,此操作不可撤销。`,"sidebar.deleteWorkspaceTitle":`删除此工作区、其所有会话及会话附件`,"sidebar.deleteWorkspaceDialogTitle":`删除工作区`,"sidebar.deletedSessionGhost":`已删除工作区「{workspace}」的会话「{session}」`,"sidebar.deletedWorkspaceGhost":`已删除工作区「{name}」({count} 个会话及附件)`,"sidebar.copyPath":`复制完整路径`,"sidebar.actions":`会话操作`,"sidebar.rename":`重命名`,"sidebar.delete":`删除`,"aux.forkTitle":`复制会话附属文件`,"aux.forkDescription":`该会话存在同名(不同后缀)的附属文件,选择哪些随新会话一起复制:`,"aux.deleteTitle":`是否一并删除附属文件?`,"aux.deleteDescription":`以下文件与会话同名(不同后缀),未勾选的将保留在磁盘上:`,"aux.copyConfirm":`复制并创建副本`,"aux.deleteConfirm":`删除所选`,"aux.fileNameHeader":`文件名(点击全选/清空)`,"aux.sizeHeader":`大小`,"aux.toggleAll":`全选/清空`,"sidebar.deleteWithShiftClick":`删除(按住 Shift 点击可跳过确认)`,"sidebar.expandForks":`展开分叉`,"sidebar.collapseForks":`折叠分叉`,"sidebar.disconnect":`断开`,"sidebar.messagesCount":`{count} 条消息`,"sidebar.worktreePath":`Worktree:{path}`,"sidebar.removeWorktreeTitle":`移除 worktree checkout {path};保留分支`,"files.modified":`已修改`,"files.added":`已添加`,"files.deleted":`已删除`,"files.renamed":`已重命名`,"files.untracked":`未跟踪`,"files.conflict":`冲突`,"files.newlyUploaded":`刚上传`,"files.containsChangedFiles":`包含已更改文件`,"files.insertPath":`将路径插入聊天`,"files.mention":`提及`,"files.download":`下载文件`,"files.dismissError":`关闭错误`,"files.addUploadedFile":`将上传的文件添加到聊天`,"files.addAllUploadedFiles":`将所有上传的文件添加到聊天`,"files.openInSystemApp":`用系统应用打开`,"files.chooseOtherApp":`选择其他应用…`,"files.openLaunched":`已调用系统应用打开(如无窗口弹出,请检查文件关联)`,"files.fileTooLargeForPreview":`文件太大,无法预览(>{limit})`,"files.docTooLargeForPreview":`DOCX 太大,无法预览(>{limit})`,"files.dismissUploadResults":`关闭上传结果`,"files.loading":`正在加载文件...`,"files.noFiles":`未找到文件`,"files.find":`查找`,"files.findNext":`下一个匹配(Enter)`,"files.findPrev":`上一个匹配(Shift+Enter)`,"files.findNoResults":`无结果`,"files.findClose":`关闭(Esc)`,"loading.inProgress":`处理中…`,"loading.more":`还有 {count} 项…`,"errors.title":`错误`,"errors.titleCount":`错误({count})`,"errors.close":`关闭`,"errors.clearAll":`全部清除`,"files.notFound":`(暂无文件)`,"files.accessDenied":`访问被拒绝`,"files.empty":`(空)`,"files.uploadFailed":`{count} 个失败`,"files.explorer":`文件浏览器`,"files.changedCount":`{count} 个文件`,"files.stagedPrefix":`已暂存:`,"files.unstagedPrefix":`未暂存:`,"files.noStagedChanges":`暂无已暂存文件`,"files.noUnstagedChanges":`暂无变更文件`,"files.commitMessagePlaceholder":`提交信息`,"files.commit":`提交`,"files.push":`推送到远端(含 tag)`,"files.pushing":`推送中...`,"files.pushSuccess":`推送成功`,"files.pushFailed":`推送失败`,"files.pushUpToDate":`已与远端同步,无需推送`,"files.pull":`从远端拉取`,"files.pulling":`拉取中...`,"files.pullSuccess":`拉取成功`,"files.pullFailed":`拉取失败`,"files.pullUpToDate":`已与远端同步,无需拉取`,"files.pullNonFastForward":`拉取被拒绝——本地与远端已分叉。请在终端使用 git pull --rebase 或 --merge 处理。`,"files.committing":`提交中…`,"files.commitMessageRequired":`请先填写 commit message`,"files.commitTitle":`提交更改`,"files.stageFileListMore":`…等其余 {count} 个文件`,"files.confirmStageAllCommit":`是否暂存以下 {count} 个改动文件并提交?`,"files.commitMessageLabel":`提交信息`,"files.stageAllAndCommit":`暂存并提交`,"files.stageFile":`暂存文件`,"files.unstageFile":`取消暂存`,"files.changeStats":`{count} 个变更文件,新增 {additions} 行,删除 {deletions} 行`,"git.autoFetchInterval":`自动 fetch 间隔(秒)`,"git.otherSectionTitle":`其他`,"git.autoFetchIntervalHint":`服务端定时为活动会话的工作区执行 git fetch(所有客户端共享结果)。0 表示关闭定时——仅在连接会话时触发一次。`,"git.groupTitle":`智能提交信息生成`,"git.commitModel.followCurrent":`跟随当前会话模型`,"git.commitModel.followCurrentHint":`开启后,生成提交信息时动态使用当前聊天的主模型;关闭则使用下方固定的模型(推荐使用免费小模型)。`,"git.commitModel.fixedModel":`固定模型`,"git.commitModel.fixedModelHint":`关闭“跟随当前会话”时使用的模型(建议选择免费小模型)。`,"git.commitModel.selectPlaceholder":`选择模型`,"git.commitModel.noModels":`暂无可用模型`,"git.commitModel.notConfiguredHint":`尚未选择固定模型,请先选择一个模型后再使用智能生成。`,"git.ai.generate":`智能生成`,"git.ai.generating":`生成中…`,"git.ai.notConfiguredTitle":`未配置模型`,"git.ai.notConfiguredDesc":`尚未为智能生成指定模型,请前往配置中心 → Git 指定模型后再试。`,"git.ai.goToConfig":`前往配置`,"git.ai.noSession":`跟随模式需要先选择一个会话`,"git.ai.noSessionModel":`当前会话无可用模型,请先在聊天中选择模型`,"git.commitModel.maxTokens":`最大输出长度`,"git.commitModel.maxTokensHint":`单次智能生成允许的最大输出 token 数(64–4096,默认 512)。已尽量降低推理开销:支持关闭的模型会关闭推理,不支持的会降至最低档位。`,"git.commitModel.autoGenerateOnEmpty":`空输入框时提交自动先智能生成`,"git.commitModel.autoGenerateOnEmptyHint":`开启后,点击提交时若输入框为空,会先自动调用智能生成填入信息再提交;仅在已指定模型时生效,未指定模型时空输入框仍禁用提交。默认开启。`,"git.ai.invalidModel":`已配置的模型格式无效,请前往配置中心重新选择`,"git.ai.usingCurrentModel":`使用聊天主模型`,"git.ai.usingModel":`使用 {model}`,"git.ai.generateAndCommit":`智能生成信息并提交`,"git.commitConfirmStageAll":`提交时需确认“暂存全部”`,"git.commitConfirmStageAllHint":`开启后,未暂存时点击提交会先弹出“暂存全部并提交”确认框;关闭则直接暂存全部并提交。默认开启。`,"modelThinking.desc":`为每个模型或供应商记忆上次选择的思考级别。切换模型时自动选中记忆的档位;若该模型的可用档位不含记忆值则回退到 auto(跟随默认)。支持全部 7 档:off / minimal / low / medium / high / xhigh / max。`,"modelThinking.addModelTitle":`添加模型`,"modelThinking.addProviderTitle":`添加供应商`,"modelThinking.byModel":`按模型`,"modelThinking.byProvider":`按供应商`,"modelThinking.byProviderHint":`供应商级别为回退:同一供应商下未单独记忆的模型会使用此值。`,"modelThinking.emptyModel":`暂无按模型的记忆。切换模型后用下方思考级别下拉选择,自动记忆;也可在此添加。`,"modelThinking.emptyProvider":`暂无按供应商的记忆。`,"modelThinking.selectModelPlaceholder":`选择模型`,"modelThinking.selectProviderPlaceholder":`选择供应商`,"modelThinking.providerInputPlaceholder":`或输入供应商名称`,"modelThinking.footerHint":`配置保存到独立文件 pi-web/model-thinking.json,不影响主配置;仅作用于 UI 下拉,不拦截 pi 的 thinking 调用。`,"common.add":`添加`,"common.emptyValue":`(空)`,"common.retry":`重试`,"common.delete":`删除`,"files.conflictSummary":`已有 {count} 个文件:{files}`,"files.cannotReplace":`无法替换:{files}`,"files.replace":`替换`,"files.skipExisting":`跳过已有文件`,"files.cancel":`取消`,"files.checking":`正在检查文件`,"files.uploading":`正在上传,{progress}%`,"files.search":`搜索文件`,"files.searchPlaceholder":`搜索文件...`,"chat.loadingSession":`正在加载会话...`,"chat.noSessionSelected":`请在左侧面板新增/选择任意会话`,"chat.loadingWindow":`正在加载消息...`,"chat.runningTool":`运行工具`,"chat.runningNamedTool":`运行 {name}`,"chat.runningToolsFull":`运行{names}等{count}个工具`,"chat.waitingModel":`等待模型`,"chat.aiQuestion":`AI 提问`,"chat.runningCommand":`运行命令`,"chat.statusUnknown":`状态未知`,"chat.answering":`回答中`,"chat.totalElapsed":`本轮总计 {total}`,"chat.thinking":`思考中`,"chat.message":`{count} 条消息`,"chat.messages":`{count} 条消息`,"chat.toolCall":`{count} 次工具调用`,"chat.toolCalls":`{count} 次工具调用`,"chat.statFiles":`文件`,"chat.statMessages":`消息`,"chat.statTools":`工具`,"tool.receivingArgs":`正在接收参数...`,"chat.collapseProcess":`收起处理详情`,"chat.expandProcess":`展开处理详情`,"chat.loadEarlier":`向上滚动以加载更早的消息(隐藏 {count} 条)`,"chat.searchMessages":`搜索消息`,"chat.clearSearch":`清空搜索关键字`,"chat.scrollToLatest":`滚动到最新消息`,"chat.expandMessage":`展开完整内容`,"chat.collapseMessage":`收起`,"chat.expandTurn":`展开整轮`,"chat.collapseTurn":`折叠整轮`,"chat.thinkingCount":`条思考`,"chat.textChars":`字正文`,"chat.searchPlaceholder":`搜索聊天消息…`,"chat.searchNoResults":`没有结果`,"chat.searchResults":`{count} 个结果`,"chat.extensionRequest":`扩展请求`,"chat.cancel":`取消`,"chat.skipped":`已跳过`,"chat.confirm":`确认`,"chat.submit":`提交`,"chat.extensionInput":`扩展终端输入`,"chat.extensionSelect":`请选择`,"chat.extensionConfirm":`确认`,"chat.extensionEditor":`编辑`,"chat.extensionPanel":`扩展面板`,"chat.close":`关闭`,"chat.notifyInfoTitle":`信息`,"chat.notifySuccessTitle":`成功`,"chat.notifyErrorTitle":`错误`,"chat.notifyWarningTitle":`警告`,"chat.queued":`已排队 · {count}`,"chat.queueSteer":`引导`,"chat.queueFollowUp":`后续消息`,"chat.recall":`全部撤回`,"chat.recallTitle":`移除所有排队消息并放回输入框编辑(输入框为空时按 Enter)`,"chat.queueWithdrawHint":`点击撤回此条消息`,"notices.sessionInteractionWaiting":`会话「{name}」正在等待交互`,"chat.retrying":`重试中({attempt}/{max})`,"chat.loadingCommands":`正在加载命令...`,"chat.slashCommands":`斜杠命令 · {label}`,"chat.tabEnter":`Tab / Enter`,"chat.noCommands":`未找到扩展、提示词或技能命令`,"chat.match":`1 个匹配项`,"chat.matches":`{count} 个匹配项`,"chat.command":`1 个命令`,"chat.commands":`{count} 个命令`,"chat.loadingFiles":`正在加载文件...`,"chat.files":`文件 · {label}{hint}`,"chat.searching":`搜索中…`,"chat.noMatchingFiles":`未找到匹配的文件`,"chat.searchingAll":` · 正在搜索所有文件…`,"chat.indexTruncated":` · 索引不完整`,"chat.steerPlaceholder":`立即引导(Enter)/ 排队后续消息(Alt+Enter)/ 停止(Ctrl+S);F2 展开/收起当前轮详情...`,"chat.agentPlaceholder":`Agent 运行中…(Ctrl+S 停止;F2 展开/收起当前轮详情)`,"chat.messagePlaceholder":`输入聊天消息(Enter 发送,Shift+Enter 换行)。/ 开头为斜杠命令,@ 引用文件,! 开头为 Shell 命令;F2 展开/收起当前轮详情`,"chat.questionNotificationTitle":`Pi — 提问`,"chat.taskCompleteNotificationTitle":`Pi — 任务完成`,"chat.taskErrorNotificationTitle":`Pi — 出错`,"chat.sessionCompletedNotificationBody":`会话 {name} 已完成`,"chat.sessionCompletedNotificationBodyWithWorkspace":`{workspace} · {name} 已完成`,"chat.questionNotificationDenied":`通知被拒绝:在浏览器站点设置中允许后,切走页面时才会收到提问提醒。`,"chat.steer":`引导`,"chat.followUp":`后续消息`,"chat.steerTooltip":`在当前调用结束后立即发送这条消息(Enter)`,"chat.followUpTooltip":`在智能体结束后排队发送这条消息(Alt+Enter)`,"chat.send":`发送`,"chat.attachImage":`附加图片`,"chat.attachmentOnDisk":`体积过大,已存到磁盘并以路径引用(由智能体按需读取)`,"chat.removeAttachment":`移除附件`,"chat.previewImage":`预览大图`,"chat.filterModels":`筛选模型…`,"chat.noMatchingModels":`没有匹配的模型`,"chat.moreControls":`更多控件`,"chat.shell":`Shell`,"chat.outputLocal":`输出保留在本地`,"chat.stoppedByUser":`已手动停止`,"chat.stoppedTooltip":`已手动中断或因交互操作超时自动中断`,"chat.stopped":`已中断`,"chat.errorTooltip":`本轮以错误结束`,"chat.error":`错误`,"chat.cwdPrefix":`工作目录`,"chat.turnArtifacts.title":`本轮修改了 {count} 个文件`,"chat.turnDuration":`耗时 {duration}`,"chat.turnArtifacts.toggleList":`展开/收起文件列表`,"chat.turnArtifacts.openFile":`在文件中打开`,"chat.outputModel":`输出发送给模型`,"chat.shellSilentTip":`(以!!开头则不发)`,"chat.noTools":`不使用任何工具,仅对话`,"chat.builtInTools":`{count} 个内置工具`,"chat.allBuiltInTools":`全部内置工具`,"chat.currentReasoning":`当前推理级别:{level}`,"chat.changeReasoningLabel":`更改推理级别`,"chat.currentModel":`当前模型:{model}`,"chat.changeModel":`更改模型`,"chat.currentToolPreset":`当前工具预设:{preset}`,"chat.toolPresetDrift":`⚠ 实际生效工具与所选预设不符,当前生效:{actual}`,"chat.changeToolPreset":`更改工具预设`,"chat.stopCompaction":`停止压缩`,"chat.compactContext":`压缩上下文`,"chat.compacting":`正在压缩…`,"chat.compactionDisabledByExtension":`原生上下文压缩已被某个扩展接管,无法在这里执行。`,"chat.compact":`压缩`,"chat.stopAgent":`停止 Agent(Ctrl+S)`,"chat.stop":`停止`,"chat.disableSound":`关闭提示音`,"chat.enableSound":`开启提示音`,"chat.thinkingUseDefault":`使用 pi 默认设置`,"chat.thinkingOff":`关闭推理`,"chat.thinkingMinimal":`最低限度推理`,"chat.thinkingLow":`低强度推理`,"chat.thinkingMedium":`中等强度推理`,"chat.thinkingHigh":`高强度推理`,"chat.thinkingXhigh":`超高强度推理`,"chat.thinkingMax":`最高强度推理`,"chat.thinkingMapTitle":`高级思考级别未配置`,"chat.thinkingMapBody":`pi 默认只支持 high 级别。若要开启 {level} 级别推理,请在 配置 → 模型 页面为该模型配置「推理级别映射」。`,"chat.thinkingMapGo":`立即前往`,"chat.builtIn":`内置`,"chat.extensions":`扩展`,"chat.prompts":`提示词`,"chat.skills":`技能`,"chat.dormant":`休眠`,"chat.commandCompact":`压缩上下文,可选附加说明`,"chat.commandReload":`重新加载扩展、技能、提示词和工具`,"chat.commandName":`设置会话显示名称`,"chat.commandSession":`显示会话消息、Token 和费用统计`,"chat.commandCopy":`复制最后一条助手消息`,"chat.compacted":`已压缩`,"chat.tokensSaved":`节省 {saved}`,"i18n.close":`关闭`,"i18n.resizeList":`调整 {name} 列表大小`,"widgets.title":`小组件`,"widgets.reopen":`重新弹出`,"widgets.expandedToChat":`小组件[{key}]已展开到聊天页面`,"widgets.collapse":`收起`,"widgets.open":`展开小组件`,"i18n.copy":`复制`,"i18n.copied":`已复制`,"i18n.copyToolInput":`复制原始 JSON`,"i18n.cancel":`取消`,"i18n.save":`保存`,"i18n.saving":`保存中…`,"i18n.saved":`已保存`,"i18n.saveChanges":`保存更改`,"i18n.noThinking":`无思考内容`,"i18n.remove":`移除`,"i18n.removing":`移除中…`,"i18n.delete":`删除`,"i18n.loading":`加载中...`,"i18n.searchPlaceholder":`搜索…`,"i18n.noMatch":`无匹配`,"i18n.search":`搜索`,"i18n.refresh":`刷新`,"i18n.update":`更新`,"i18n.updating":`更新中...`,"i18n.check":`检查`,"i18n.checking":`检查中...`,"i18n.install":`安装`,"i18n.installing":`安装中...`,"i18n.noResults":`没有结果`,"i18n.searchProviders":`搜索供应商…`,"i18n.noProviders":`没有匹配的供应商`,"i18n.newModel":`新模型`,"i18n.addProvider":`添加供应商`,"i18n.selectProviderModel":`选择供应商或模型`,"i18n.visibleInPrompt":`在模型提示词中可见,点击以禁用`,"i18n.hiddenFromPrompt":`在模型提示词中隐藏,点击以启用`,"i18n.dormant":`休眠`,"i18n.hiddenButInvocable":`对模型隐藏,仍可手动调用`,"i18n.skillSearchPlaceholder":`例如 react、testing、deploy`,"i18n.searching":`搜索中…`,"i18n.noSkills":`未找到技能`,"i18n.checkUpdates":`检查更新`,"i18n.updates":`项更新`,"i18n.noResolvedResources":`没有已解析资源`,"i18n.enablePackage":`启用包`,"i18n.disablePackage":`禁用包`,"i18n.filtered":`已筛选`,"i18n.openSessionToReload":`打开会话后才能重新加载`,"i18n.notFound":`未找到`,"i18n.noPlugins":`未配置插件`,"i18n.scopeGlobal":`全局`,"i18n.scopeProject":`项目`,"i18n.scopePath":`路径`,"i18n.name":`名称`,"i18n.description":`描述`,"trust.resourcesNotLoaded":`受限模式`,"trust.trustProject":`信任项目`,"trust.trusting":`正在信任...`,"trust.cancel":`取消`,"trust.dialogTitle":`信任此项目?`,"trust.dialogBody":`项目资源可以运行本地代码。请仅信任你了解其内容的项目。`,"trust.skillsNotLoaded":`此项目尚未受信任,项目技能未加载。`,"trust.trustedDesc":`此项目已受信任,项目资源(扩展/技能/插件)已启用。`,"trust.untrustedDesc":`此项目尚未受信任,项目资源(扩展/技能/插件)未加载。点击授信。`,"trust.pluginsNotLoaded":`此项目尚未受信任,项目插件未加载。`,"trust.projectScopeUnavailable":`项目资源未加载时,无法安装到项目范围。`,"i18n.subscription":`订阅`,"i18n.subscriptions":`订阅服务`,"i18n.customEndpoint":`自定义端点格式`,"i18n.noChanges":`没有更改`,"i18n.branches":`对话分支`,"i18n.noActiveSession":`没有活动会话`,"i18n.noActiveSessionToCompact":`没有活动会话可压缩`,"i18n.noActiveSessionToReload":`没有活动会话可重新加载`,"i18n.noActiveSessionToName":`没有活动会话可命名`,"i18n.noAssistantMessageToCopy":`没有可复制的助手消息`,"i18n.commandCompleted":`命令已完成`,"i18n.commandFailed":`命令失败`,"i18n.extensionCommandFailed":`扩展命令失败`,"i18n.compactedContext":`上下文已压缩`,"i18n.reloadedSessionResources":`会话资源已重新加载`,"i18n.usageName":`用法:/name <名称>`,"i18n.sessionRenamedTo":`会话已重命名为 {name}`,"i18n.copiedLastAssistantMessage":`已复制最后一条助手消息`,"i18n.failedToRecallQueuedMessages":`恢复排队消息失败`,"i18n.failedToWithdrawQueuedMessage":`撤回排队消息失败`,"i18n.queuedResendAfterAbortTimeout":`已打断,但排队消息未能自动重发,已放回输入框`,"i18n.noBranches":`此会话没有分支`,"i18n.source":`源代码`,"i18n.preview":`预览`,"i18n.diff":`Diff`,"i18n.downloadFile":`下载文件`,"i18n.liveSync":`实时同步已启用`,"i18n.notWatching":`未监视`,"i18n.fileViewMode":`文件视图模式`,"i18n.editMode":`编辑模式`,"i18n.viewMode":`查看模式`,"i18n.compareHead":`比较工作区与 HEAD`,"i18n.fileViewSource":`源码`,"i18n.fileViewPreview":`预览`,"i18n.fileViewDiff":`差异`,"i18n.fileViewSourceHint":`以源码形式查看`,"i18n.fileViewPreviewHint":`以渲染后的形式查看`,"i18n.previewUnsupported":`不支持预览当前格式:{format}`,"i18n.lineCount":`{n} 行`,"i18n.mentionSelectedLines":`提及所选行`,"i18n.disableWrap":`禁用自动换行`,"i18n.enableWrap":`启用自动换行`,"i18n.editFile":`编辑文件`,"i18n.saveFile":`保存`,"i18n.saveFileShortcut":`保存(Ctrl/Cmd+S)`,"i18n.cancelEdit":`取消`,"i18n.saveFailed":`保存失败:{error}`,"i18n.unsavedChanges":`有未保存的修改`,"i18n.htmlPreview":`HTML 预览`,"i18n.previewFile":`预览 {file}`,"i18n.invalidMermaid":`Mermaid 图表无效`,"i18n.renderingMermaid":`正在渲染 Mermaid 图表`,"i18n.previewAfterStreaming":`流式输出完成后可预览`,"i18n.showMermaidSource":`显示 Mermaid 源码`,"i18n.previewMermaid":`预览 Mermaid 图表`,"i18n.openMermaidViewer":`打开图表查看器`,"i18n.mermaidViewer":`Mermaid 图表查看器`,"i18n.mermaidDiagram":`Mermaid 图表`,"i18n.zoomOut":`缩小`,"i18n.zoomIn":`放大`,"i18n.fitToWidth":`适应宽度`,"models.discoveryFetching":`正在导入模型…`,"models.deleteProviderConfirm":`确定删除供应商「{name}」?该操作会立即写入 models.json,其全部配置(含 API key)将被移除且无法恢复。`,"models.renameProviderDialogTitle":`重命名供应商`,"models.renameProviderHint":`重命名会立即写入 models.json,并同步迁移该供应商的 API 密钥与登录凭证;其他未保存的修改不会一并保存。`,"models.renameProviderConflict":`供应商「{name}」已存在,请换一个名称。`,"models.renameProviderBuiltin":`「{name}」是内置供应商,不能作为自定义供应商名。`,"models.renameProviderEmpty":`名称不能为空。`,"models.removeModelConfirm":`确定移除模型「{model}」?该操作会立即写入 models.json 且无法恢复。`,"models.discoveryTitle":`导入模型`,"models.discoveryFetch":`导入模型…`,"models.discoveryFilterPlaceholder":`筛选 {count} 个模型…`,"models.discoveryFilter":`筛选上游模型`,"models.discoverySelectShown":`选择当前结果`,"models.discoveryNoMatches":`没有匹配的模型。`,"models.discoveryAdded":`已添加`,"models.discoveryShowing":`显示前 {shown} 个,共 {total} 个`,"models.discoveryFetched":`已获取 {count} 个模型`,"models.discoveryAddSelected":`添加所选模型`,"models.setDefault":`设为默认`,"models.defaultModel":`默认模型`,"models.defaultModelUnavailable":`默认模型 {model} 不可用(已删除或已隐藏),请选择模型。`,"models.syncEndpoint":`从端点同步`,"models.lastSyncedAt":`上次同步:{time}`,"models.neverSynced":`未同步过`,"models.discoveryFetchTooltip":`优先从本地缓存导入:{path};无缓存时自动执行一次从端点同步并写入该缓存。`,"models.syncingModels":`同步中…`,"models.syncedModels":`已同步 {count} 个模型`,"models.syncEndpointTooltip":`从 {endpoint} 拉取最新模型列表并缓存到本地;有缓存时优先于内置列表使用。`,"models.syncEndpointTooltipGeneric":`从该供应商的 models 端点拉取最新模型列表并缓存到本地;有缓存时优先于内置列表使用。`,"models.refreshFromCache":`从同步缓存刷新`,"models.refreshing":`刷新中…`,"models.refreshFromCacheTooltip":`重新读取 pi-web/provider/{provider}/models.json,只更新与当前生效定义不同的字段(headers 等手动字段保留)。`,"models.refreshNoDiff":`同步缓存与当前生效定义一致,无需更新。`,"models.refreshDone":`已从同步缓存更新覆写字段。`,"models.refreshTimeout":`刷新超时,请稍后重试。`,"models.builtinProviders":`内置供应商`,"models.customProviders":`自定义供应商`,"models.syncSaveFailed":`同步前保存草稿失败,已中止同步。`,"models.visibleInChat":`聊天可见`,"models.lastVisibleCannotHide":`该模型是该供应商下唯一的可见模型,无法隐藏;如需全部隐藏,请删除该模型。`,"models.visibleModels":`模型列表`,"models.visibleModelsCount":`已勾选 {visible} / 共 {total}`,"models.visibilityCustomized":` · 已自定义`,"models.visibilityUncustomized":` · 未自定义(默认全部可见)`,"models.showAll":`重置`,"models.showAllHint":`所有模型可见`,"models.filterLabel":`筛选:`,"models.invertSelection":`反向勾选`,"models.searchModels":`搜索模型…`,"models.noModels":`该供应商暂无模型。`,"models.noMatchingModels":`无匹配模型。`,"models.filterAll":`全部`,"models.filterVisible":`仅可见`,"models.filterHidden":`仅隐藏`,"models.invertDisabledTooltip":`所有模型均已可见,反选不会改变任何状态`,"models.openOverride":`覆写模型参数`,"models.overrideHint":`当前显示为合并后的有效值(内置定义 + 已保存的覆写)。只有你修改过的字段会作为覆写保存,其余字段继续继承内置定义。`,"models.overrideOrphanedHint":`该模型已从上游删除,覆写仍保留在本地。可在此删除覆写,保存后会一并清理可见性配置。`,"models.removeOverride":`移除覆写`,"models.providerNameCollision":`供应商 "{provider}" 与内置 "{builtin}"(大小写不敏感)冲突,模型可见性无法生效,请重命名或删除该供应商。`,"models.providerNameCollisionShort":`与内置供应商撞名`,"models.builtinVisibilityBlocked":`模型可见性已禁用:自定义供应商 "{custom}" 与 "{builtin}"(大小写不敏感)冲突,请重命名或删除该自定义供应商。`,"models.discoveryAddSelectedCount":`添加所选模型({count})`,"models.dataSourceLabel":`数据来源:`,"models.catalogSourceEndpoint":`模型端点`,"models.catalogSourceDev":`models.dev 目录`,"models.catalogSourceEndpointTooltip":`数据来源:供应商的 /models 端点`,"models.catalogSourceDevTooltip":`数据来源:models.dev 内置目录(https://models.dev)`,"models.catalogEndpointNotFound":`模型端点返回中未找到该模型 ID`,"models.catalogOverwriteTitle":`覆盖已有字段?`,"models.catalogOverwriteBody":`以下 {{count}} 个字段已有值,覆盖填入将修改它们:{{fields}}。取消则仅填充空字段。`,"models.catalogOverwriteConfirm":`覆盖并填入`,"models.catalogOverwriteCancel":`仅填空字段`,"models.catalogFilling":`正在填入模型信息…`,"models.catalogFill":`填入模型信息`,"models.catalogFilled":`已填入 {count} 个字段`,"models.catalogNoEmptyFields":`没有需要填入的空字段`,"models.catalogNoExactMatch":`models.dev 中没有精确匹配`,"models.catalogPriceProvider":`价格已匹配供应商 {provider}`,"models.catalogPriceBaseUrl":`价格已按 Base URL 匹配 {provider}`,"models.catalogPriceConsensus":`价格得到 {support}/{total} 条记录支持`,"models.catalogPriceUnreliable":`未找到可靠价格`,"models.catalogUndo":`撤销`,"models.baseUrl":`Base URL`,"models.apiKey":`API 密钥`,"models.api":`API 格式`,"models.modelId":`ID *`,"models.name":`名称`,"models.apiOverride":`API 格式`,"models.reasoningThinking":`推理 / 思考`,"models.inputFormat":`输入格式`,"models.inputFormatPlaceholder":`搜索添加,可多选(回车确认)`,"models.inputFormat.text":`文本`,"models.inputFormat.image":`图片`,"models.badgeReasoning":`支持思考 / 推理(聊天输入框可选思考级别)`,"models.badgeInput":`支持{format}输入`,"models.nameHint":`留空删除 name 字段(回落使用模型 id)。`,"models.apiOverrideHint":`留空或选默认删除 api 字段(回落使用供应商默认 api)。`,"models.reasoningHint":`取消勾选删除 reasoning 字段(回落关闭)。`,"models.thinkingLevelMapHint":`每个级别三种状态:默认=删除该级别映射(回落模型默认级别);已禁用=写入 null 禁用;自定义=写入自定义级别字符串。`,"models.compatSection":`兼容性`,"models.compatInheritHint":`模型自身未设置的项显示从供应商继承的生效值(以弱化颜色标注);在模型级设置后将覆盖继承值。`,"models.compatHint.supportsDeveloperRole":`是否使用 developer 角色发送系统提示(推理模型常用)。Ollama、vLLM、SGLang 等不支持该角色的服务器设为 false,改为发送 system 消息。`,"models.compatHint.supportsLongCacheRetention":`是否支持长缓存保留:GPT-5.6+ 用 prompt_cache_options.ttl(30m),旧 OpenAI 用 prompt_cache_retention(24h),Anthropic 格式用 cache_control.ttl(1h)。`,"models.compatHint.supportsUsageInStreaming":`流式响应是否支持 stream_options: {include_usage: true},用于统计 token 用量。`,"models.compatHint.supportsFinishReason":`流式响应是否包含 finish_reason。设为 false 时,pi 在流结束时自行推断 stop 或 toolUse。`,"models.compatHint.supportsEagerToolInputStreaming":`是否接受逐工具的 eager_input_streaming。设为 false 时省略该字段,改用旧版 fine-grained-tool-streaming beta 请求头。`,"models.compatHint.supportsCacheControlOnTools":`是否接受工具定义上的 Anthropic 风格 cache_control 标记(用于工具提示词缓存)。`,"models.compatHint.supportsTemperature":`是否接受 temperature 采样参数。Claude Opus 4.7+ 等拒绝非默认温度值的端点需设为 false。`,"models.compatHint.requiresToolResultName":`工具结果消息是否必须包含 name 字段(某些端点要求)。`,"models.compatHint.requiresAssistantAfterToolResult":`工具结果之后、下一条用户消息之前是否需要插入一条空 assistant 消息(某些端点要求)。`,"models.compatHint.requiresThinkingAsText":`是否将思考块转换为纯文本发送(用于不支持思考块的端点)。`,"models.compatHint.zaiToolStream":`z.ai 端点是否支持顶层 tool_stream: true 参数(流式工具调用增量)。`,"models.compatHint.supportsThinkingTokenBudget":`是否支持用顶层 thinking_token_budget 字段限制思考 token(vLLM 兼容端点)。`,"models.compatHint.supportsOpenAIGrammarTools":`OpenAI 兼容 API 是否支持 Lark/regex grammar 工具。设为 false 时,受语法约束的工具回退为普通 function 工具。`,"models.compatHint.supportsToolSearch":`模型是否支持客户端执行的工具搜索(用于延迟工具)。`,"models.compatHint.supportsExplicitPromptCacheMode":`是否接受 prompt_cache_options 参数(OpenAI GPT-5.6+ 提示缓存)。旧 OpenAI 模型会拒绝该参数。`,"models.compatHint.forceAdaptiveThinking":`是否强制 adaptive thinking(thinking.type: "adaptive" + output_config.effort)替代旧版 budget 思考格式。内置自适应模型会自动设置。`,"models.compatHint.allowEmptySignature":`是否将空思考签名重放为 signature: ""。仅对确实需要的 Anthropic 兼容端点开启;真正的 Anthropic API 拒绝空签名。`,"models.compatHint.supportsStrictTools":`端点是否接受 strict JSON-schema 工具定义(Anthropic)。内置 Anthropic 模型已启用。`,"models.compatHint.supportsStore":`OpenAI 端点是否支持 store 字段。`,"models.compatHint.supportsReasoningEffort":`端点是否支持 reasoning_effort 参数(Ollama、vLLM、SGLang 等常不支持)。`,"models.compatHint.supportsStrictMode":`端点是否接受 strict JSON-schema 函数工具定义。默认依 API 而定;内置 OpenAI 模型自带能力元数据。`,"models.compatHint.supportsToolReferences":`是否支持工具结果中的工具引用块。Anthropic 一方模型默认支持(Haiku 与 Claude 4.5 之前的模型除外)。`,"models.compatHint.maxTokensField":`最大输出 token 参数名:max_completion_tokens(新 API)或 max_tokens(旧 API)。`,"models.compatHint.sessionAffinityFormat":`会话亲和(缓存相关):把 session id 当亲和键发给端点,让同一会话的请求尽量命中同一个后端副本,以提高提示缓存命中率——Fireworks 等端点就是靠它做 prompt cache 路由,不开时同一会话的请求可能落到不同副本、缓存复用变差(不影响请求体的 prompt_cache_key,那由缓存保留策略决定)。pi 仅在 compat.sendSessionAffinityHeaders 为 true 时发送(openai-responses 只看格式),本下拉框会联动写入两个字段。auto=开启并按 URL 自动探测格式;off=显式关闭(模型级可覆盖供应商的开启);openai=session_id/x-client-request-id/x-session-affinity;openai-nosession=x-client-request-id/x-session-affinity;openrouter=x-session-id。`,"models.compatHint.deferredToolsMode":`延迟工具的专用序列化格式。目前仅支持 kimi(Kimi 的 OpenAI 兼容 Chat Completions 格式)。`,"models.compatHint.cacheControlFormat":`提示缓存标记格式。目前仅支持 anthropic:在系统提示、最后一个工具定义及最后一条文本内容上添加 cache_control 标记。`,"models.inheritedFromProvider":`来自供应商(继承值,可在模型级覆盖)`,"models.thinkingFormatDeepseekHint":`选中 deepseek 时会额外写入 requiresReasoningContentOnAssistantMessages: true;选中其他值则移除。`,"models.samplingParams":`采样参数`,"models.headers":`请求头`,"models.modelOverrides":`模型覆盖`,"models.supportsDeveloperRole":`支持 developer role`,"models.supportsLongCacheRetention":`支持长缓存保留`,"models.supportsUsageInStreaming":`流式返回 token 用量`,"models.supportsFinishReason":`流式返回 finish_reason`,"models.supportsEagerToolInputStreaming":`工具输入流式预读`,"models.supportsCacheControlOnTools":`工具定义缓存控制`,"models.supportsTemperature":`支持 temperature 参数`,"models.requiresToolResultName":`工具结果需带 name`,"models.requiresAssistantAfterToolResult":`工具结果后需 assistant 消息`,"models.requiresThinkingAsText":`思考块转为文本`,"models.requiresReasoningContentOnAssistantMessages":`assistant 消息需 reasoning_content`,"models.zaiToolStream":`z.ai tool stream`,"models.supportsThinkingTokenBudget":`支持思考 token 预算`,"models.supportsOpenAIGrammarTools":`支持 OpenAI 语法工具`,"models.supportsToolSearch":`支持工具搜索`,"models.supportsExplicitPromptCacheMode":`显式提示缓存模式`,"models.forceAdaptiveThinking":`强制自适应思考`,"models.allowEmptySignature":`允许空思考签名`,"models.supportsStrictTools":`严格工具 schema`,"models.supportsStore":`支持 store 参数`,"models.supportsReasoningEffort":`支持 reasoning_effort`,"models.supportsStrictMode":`严格模式`,"models.supportsToolReferences":`支持工具引用`,"models.maxTokensField":`最大 token 字段`,"models.sessionAffinityFormat":`会话亲和`,"models.deferredToolsMode":`延迟工具模式`,"models.cacheControlFormat":`缓存控制格式`,"models.thinkingFormat":`思考格式`,"models.chatTemplateKwargs":`聊天模板 kwargs`,"models.chatTemplateArgs":`聊天模板 args`,"models.openRouterRouting":`OpenRouter 路由`,"models.vercelGatewayRouting":`Vercel 网关路由`,"models.thinkingLevelMap":`思考级别`,"models.thinkingLevelMapReset":`重置(清空)`,"models.thinkingLevelMapResetHint":`清空整个 thinkingLevelMap:off、minimal、low、medium、high 回落各自默认,xhigh、max 默认禁用。`,"models.thinkingLevelMapNone":`全部禁用`,"models.contextWindow":`上下文窗口(tokens)`,"models.maxOutputTokens":`最大输出 tokens`,"models.costPerMillion":`成本(每百万 tokens)`,"models.cost.input":`输入`,"models.cost.output":`输出`,"models.cost.cacheRead":`缓存读取`,"models.cost.cacheWrite":`缓存写入`,"models.costNotSet":`未设置`,"models.costAllRequired":`四项费率必须全部填写`,"models.costClear":`清除`,"models.apiKeyPlaceholder":`ENV_VAR_NAME、!shell-command 或字面密钥`,"models.apiKeyHint":`字面量密钥在保存时自动写入 auth.json(与 CLI /login 共享,优先于此处配置);以 ! 开头的 shell 命令和 $ENV 插值保留在 models.json。`,"models.authJsonConnected":`已通过 auth.json 提供密钥`,"models.authJsonRemove":`移除`,"models.apiKeyPrompt":`输入 {provider} 的 API 密钥以启用 {count} 个模型。`,"models.oauthAlreadyConnected":`已连接。可重新登录或断开连接。`,"models.oauthConnectPrompt":`连接你的 {provider} 账户。`,"models.enterValue":`输入值…`,"models.displayNamePlaceholder":`显示名称`,"models.connectionLost":`连接已断开`,"models.networkError":`网络错误`,"i18n.testingModel":`正在测试模型连接...`,"i18n.connected":`已连接`,"i18n.failed":`失败`,"i18n.test":`测试`,"i18n.testConnection":`测试模型连接`,"i18n.provider":`供应商`,"i18n.providers":`供应商`,"i18n.model":`模型`,"i18n.providerName":`供应商名称`,"i18n.rename":`重命名`,"i18n.default":`默认`,"i18n.disabled":`已禁用`,"plugins.statusLoaded":`已加载并生效`,"plugins.statusInstalled":`已安装,尚未加载`,"plugins.statusDisabled":`已禁用`,"plugins.statusMissing":`已配置但包未找到`,"plugins.extensionFilters":`扩展过滤`,"plugins.filterRules":`过滤规则`,"plugins.managePlugins":`插件管理`,"plugins.extensionFiltersHint":`对 ~/.pi/agent/extensions/ 与 .pi/extensions/ 自动发现目录内扩展的过滤规则。仅以 !、+、- 开头的规则生效;纯路径填写无效。`,"plugins.noExtensionFilters":`未配置过滤规则`,"plugins.addFilter":`添加过滤`,"plugins.filterPatternLabel":`规则`,"plugins.filterPlaceholder":`!pattern · +path · -path`,"plugins.filterInvalid":`规则必须以 !、+ 或 - 开头;纯路径在 extensions 字段中无效。`,"plugins.filterPrefixExclude":`排除匹配的扩展`,"plugins.filterPrefixForceInclude":`强制包含精确路径`,"plugins.filterPrefixForceExclude":`强制排除精确路径`,"plugins.filterEffect":`效果`,"plugins.removeFilter":`移除过滤`,"plugins.npmSourcePlaceholder":`npm:@scope/package`,"plugins.scopeLabel":`安装至`,"plugins.scopeInstallHint.global":`点击立即安装至全局插件目录(~/.pi/agent/{npm,git})`,"plugins.scopeInstallHint.project":`点击立即安装至本项目(.pi/agent/{npm,git})`,"plugins.sourceLabel":`来源`,"plugins.scopeGlobal":`全局`,"plugins.scopeProject":`项目`,"plugins.examplesTitle":`示例`,"plugins.totalsSummary":`{extensions} 扩展 · {skills} 技能 · {prompts} 提示词 · {themes} 主题`,"plugins.diagnosticCount":`{n} 条诊断`,"plugins.packageInstalled":`包已安装。`,"plugins.packageUpdated":`包已更新。`,"plugins.packageRemoved":`包已移除。`,"plugins.packageDisabled":`包已禁用。`,"plugins.packageEnabled":`包已启用。`,"plugins.extensionFilterAdded":`扩展过滤已添加。`,"plugins.extensionFilterRemoved":`扩展过滤已移除。`,"plugins.sessionReloaded":`会话已重载。`,"i18n.noResources":`没有资源`,"i18n.unknown":`未知`,"i18n.installedVersion":`已安装 {version}`,"i18n.configuredVersion":`已配置 {version}`,"i18n.extensions":`扩展`,"i18n.prompts":`提示词`,"i18n.themes":`主题`,"i18n.resourceCount":`{count}{label}`,"i18n.extensionShort":`扩展`,"i18n.versionShort":`版本`,"i18n.skillShort":`技能`,"i18n.promptShort":`提示词`,"i18n.themeShort":`主题`,"i18n.custom":`自定义`,"i18n.clearAll":`清除全部`,"i18n.connectedSuccessfully":`连接成功。`,"i18n.notConnected":`未连接`,"i18n.configured":`已配置`,"i18n.notConfigured":`未配置`,"i18n.openingBrowser":`正在打开浏览器…`,"i18n.submit":`提交`,"i18n.login":`登录`,"i18n.relogin":`重新登录`,"i18n.disconnect":`断开连接`,"i18n.networkError":`网络错误`,"i18n.continuing":`继续中…`,"i18n.skills":`技能`,"i18n.plugins":`插件`,"i18n.addSkill":`添加技能`,"i18n.addPlugin":`添加插件`,"i18n.recommendedPlugins":`推荐插件`,"i18n.selectSkill":`选择技能`,"i18n.selectPackage":`选择包`,"i18n.configBindings":`绑定的配置文件`,"i18n.addBinding":`添加`,"i18n.configFileNote":`备注(可选)`,"i18n.bindConfigFile":`绑定配置文件`,"i18n.selectFile":`选择文件`,"i18n.noConfigBindings":`尚未绑定配置文件`,"i18n.noFiles":`没有文件`,"i18n.allFiles":`全部文件`,"i18n.filterByType":`按类型筛选`,"i18n.removeBinding":`删除绑定`,"i18n.confirm":`确认`,"i18n.updateAvailable":`有可用更新`,"i18n.upToDate":`已是最新`,"i18n.automaticChecksUnavailable":`自动检查不可用`,"i18n.checkFailed":`检查失败`,"i18n.installed":`已安装`,"i18n.status":`状态`,"i18n.version":`版本`,"i18n.package":`包`,"i18n.resources":`资源`,"i18n.installedPath":`安装路径`,"i18n.readme":`README`,"i18n.readmeDetails":`详情`,"i18n.unsafeLinkBlocked":`已阻止不安全链接(仅允许同目录或子目录的相对链接):{href}`,"i18n.resolvedResources":`已解析资源`,"i18n.reloadSession":`重新加载会话`,"i18n.reloading":`重新加载中...`,"i18n.packageRemoved":`包已移除。`,"i18n.packageInstalled":`包已安装。`,"i18n.packageUpdated":`包已更新。`,"i18n.packageDisabled":`包已禁用。`,"i18n.packageEnabled":`包已启用。`,"i18n.sessionReloaded":`会话已重新加载。`,"i18n.thinking":`思考`,"i18n.loadingThinking":`正在加载思考内容...`,"i18n.copyMessage":`复制消息`,"i18n.editFromHere":`从此处编辑`,"i18n.editFromHereTitle":`从此处编辑,此会话内创建分支`,"i18n.editFromHereDisabledBusy":`会话运行中,结束后可从此处编辑`,"i18n.editFromHereDisabledNoAnchor":`上一步不是答复(中断记录/工具结果),无法从此处编辑`,"i18n.userMessageExpandHint":`点击查看全文`,"i18n.newSession":`新会话`,"i18n.newSessionTitle":`新会话,从此处创建独立副本`,"i18n.estimatedTokens":`流式输出期间的估算 Token 数`,"i18n.noOutput":`(无输出)`,"i18n.noSummary":`(无摘要)`,"i18n.conversationCompacted":`会话已压缩`,"i18n.compactionDescription":`此处之前的会话历史已压缩为以下摘要:`,"i18n.fileContext":`文件上下文:{details}`,"i18n.readFiles":`读取的文件`,"i18n.modifiedFiles":`修改的文件`,"i18n.hiddenExtensionMessage":`隐藏的扩展消息`,"i18n.noMessage":`(无消息)`,"i18n.collapse":`收起`,"i18n.expand":`展开`,"i18n.hideDetails":`隐藏详情`,"i18n.showDetails":`显示详情`,"i18n.thinkingUnavailable":`思考内容不可用`,"i18n.thinkingEncrypted":`思考内容已加密(供应商加密,仅用于上下文连续,无法显示明文)`,"i18n.before":`之前`,"i18n.after":`之后`,"common.copy":`复制`,"common.copied":`已复制`,"common.decrease":`减小字号`,"common.reset":`重置`,"common.increase":`增大字号`,"common.expand":`展开`,"common.collapse":`收起`,"common.preview":`预览`,"common.source":`源码`,"common.export":`导出`,"common.open":`打开`,"common.close":`关闭`,"common.zoomIn":`放大`,"common.zoomOut":`缩小`,"common.resetZoom":`重置缩放`,"common.rotate":`旋转`,"image.loadError":`图片加载失败`,"image.loading":`图片加载中...`}},hS=new Map;function gS(e){if(!e.id.trim())throw Error(`Locale id must not be empty`);if(hS.has(e.id))throw Error(`Locale already registered: ${e.id}`);hS.set(e.id,e)}function _S(e){return hS.get(e)}function vS(){return[...hS.keys()]}function lae(e){for(let t of e){let e=t.toLowerCase();if(e===`en`||e.startsWith(`en-`))return`en`;if(e===`zh`||e.startsWith(`zh-`))return`zh-CN`}return`en`}gS(sae),gS(cae);var yS=`pi-locale`,uae=`en`,dae=[`common.copy`,`common.copied`,`common.decrease`,`common.reset`,`common.increase`,`common.expand`,`common.collapse`,`common.preview`,`common.source`,`common.export`,`common.open`,`common.close`,`common.zoomIn`,`common.zoomOut`,`common.resetZoom`,`image.loadError`,`image.loading`],bS=(0,I.createContext)(null);function fae(){return Object.fromEntries(vS().flatMap(e=>{let t=_S(e);return t?[[e,t.messages]]:[]}))}function pae(){try{let e=window.localStorage.getItem(yS);if(e===`en`||e===`zh-CN`)return e}catch{}return null}function mae({children:e,initialLocale:t=null}){let[n,r]=(0,I.useState)(()=>typeof window>`u`?t??uae:pae()??t??lae(window.navigator.languages.length?window.navigator.languages:[window.navigator.language])),i=(0,I.useMemo)(()=>vS().map(e=>_S(e)).filter(e=>!!e),[]),a=(0,I.useMemo)(()=>fae(),[]);(0,I.useEffect)(()=>{let e=_S(n);if(!e)return;let t={};for(let n of dae){let r=e.messages[n];r!==void 0&&(t[n]=r)}Lie(t)},[n]);let o=(0,I.useCallback)(e=>{if(_S(e)){r(e),document.documentElement.lang=e;try{window.localStorage.setItem(yS,e)}catch{}fetch(`/api/preferences`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({firstPaint:{locale:e}})}).catch(e=>console.error(`[pi-web] save locale:`,e))}},[]),s=(0,I.useCallback)((e,t)=>aae(n,e,a,t),[n,a]),c=(0,I.useMemo)(()=>({locale:n,setLocale:o,t:s,supportedLocales:i}),[n,o,s,i]);return(0,L.jsx)(bS.Provider,{value:c,children:e})}function z(){let e=(0,I.useContext)(bS);if(!e)throw Error(`useI18n must be used inside I18nProvider`);return e}var hae=/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1B\\))/g,gae=/^\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1B\\))/,xS=/\x1B\[([0-9;]*)m/g,SS=/\x1B_pi:c\x07/g,CS=[`#1f2937`,`#dc2626`,`#16a34a`,`#d97706`,`#2563eb`,`#9333ea`,`#0891b2`,`#6b7280`],wS=[`#9ca3af`,`#ef4444`,`#22c55e`,`#f59e0b`,`#3b82f6`,`#a855f7`,`#06b6d4`,`#e5e7eb`];function TS(e){return e.replace(SS,``).replace(hae,``)}function ES(e){let t=[],n=0;for(;n<e.length;){if(e.charCodeAt(n)===27){let t=e.slice(n).match(gae);if(t){n+=t[0].length;continue}}let r=e.codePointAt(n);if(r===void 0)break;let i=String.fromCodePoint(r);t.push({start:n,end:n+i.length,char:i}),n+=i.length}return t}function DS(e,t){let n=ES(e)[t];return n?e.slice(0,n.start)+e.slice(n.end):e}function OS(e){return ES(e)[0]?.char}function _ae(e){let t=ES(e);for(let e=t.length-1;e>=0;e--)if(t[e].char.trim()!==``)return e;return-1}function vae(e){let t=e;for(;;){let e=ES(t),n=e[e.length-1];if(n?.char.trim()!==``)return t;t=t.slice(0,n.start)+t.slice(n.end)}}function yae(e){let t=/^[┌├└╭╰][─┬┴┼]+[┐┤┘╮╯]$/,n=[];for(let r of e){let e=r.replace(SS,``),i=TS(e).trimEnd();if(t.test(i))continue;let a=e,o=OS(a);(o===`│`||o===`┃`)&&(a=DS(a,0),OS(a)===` `&&(a=DS(a,0)));let s=_ae(a),c=s>=0?ES(a)[s]?.char:void 0;(c===`│`||c===`┃`)&&(a=DS(a,s)),n.push(vae(a))}for(;n.length>0&&TS(n[0]).trim()===``;)n.shift();for(;n.length>0&&TS(n[n.length-1]).trim()===``;)n.pop();return n.length?n:e}function bae(e){if(e>=0&&e<8)return CS[e];if(e>=8&&e<16)return wS[e-8];if(e>=16&&e<=231){let t=e-16,n=Math.floor(t/36),r=Math.floor(t%36/6),i=t%6,a=e=>e===0?0:55+e*40;return`rgb(${a(n)}, ${a(r)}, ${a(i)})`}if(e>=232&&e<=255){let t=8+(e-232)*10;return`rgb(${t}, ${t}, ${t})`}}var xae={0:e=>{for(let t of Object.keys(e))delete e[t]},1:e=>{e.fontWeight=700},2:e=>{e.opacity=.65},3:e=>{e.fontStyle=`italic`},4:e=>{e.textDecoration=`underline`},22:e=>{delete e.fontWeight,delete e.opacity},23:e=>{delete e.fontStyle},24:e=>{delete e.textDecoration},39:e=>{delete e.color},49:e=>{delete e.backgroundColor}},Sae=[{min:30,max:37,target:`color`,palette:CS},{min:90,max:97,target:`color`,palette:wS},{min:40,max:47,target:`backgroundColor`,palette:CS},{min:100,max:107,target:`backgroundColor`,palette:wS}];function Cae(e,t,n,r){if(t!==38&&t!==48)return 0;if(n[r+1]===2){let[i,a,o]=[n[r+2],n[r+3],n[r+4]];if([i,a,o].every(e=>typeof e==`number`&&Number.isFinite(e))){let n=`rgb(${i}, ${a}, ${o})`;t===38?e.color=n:e.backgroundColor=n}return 4}if(n[r+1]===5){let i=bae(n[r+2]);return i&&(t===38?e.color=i:e.backgroundColor=i),2}return 0}function wae(e,t){let n={...e};for(let e=0;e<t.length;e++){let r=t[e],i=xae[r];if(i){i(n);continue}let a=!1;for(let e of Sae)if(r>=e.min&&r<=e.max){n[e.target]=e.palette[r-e.min],a=!0;break}a||(e+=Cae(n,r,t,e))}return n}function Tae(e){let t=[],n={},r=0,i;for(xS.lastIndex=0;(i=xS.exec(e))!==null;){i.index>r&&t.push({text:e.slice(r,i.index),style:n});let a=i[1]?i[1].split(`;`).map(e=>Number(e||`0`)):[0];n=wae(n,a),r=i.index+i[0].length}return r<e.length&&t.push({text:e.slice(r),style:n}),t}function kS(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}var Eae={visible:[],pending:[],modals:[]};function AS(e){let t=e.type===`info`?`[pi] notice:`:`[pi] notice (${e.type}):`;e.type===`warning`?console.warn(t,e.message):e.type===`error`?console.error(t,e.message):console.info(t,e.message)}var jS=new class{constructor(e=5){this.maxVisible=e,this.state=Eae,this.listeners=new Set,this.noticeListeners=new Set,this.subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e)),this.getSnapshot=()=>this.state,this.onNotice=e=>(this.noticeListeners.add(e),()=>this.noticeListeners.delete(e))}add(e){let t=e.message.trim();if(!t)return;let n={id:e.id??kS(),message:t,type:e.type??`info`,sessionId:e.sessionId??null};if(AS(n),e.log!==!1&&this.emit(n),this.state.visible.length>=this.maxVisible){this.set({...this.state,pending:[...this.state.pending,n]});return}this.set({...this.state,visible:[...this.state.visible,n]})}dismissToast(e){let t=this.state.visible.filter(t=>t.id!==e);if(t.length===this.state.visible.length)return;let n=t,r=this.state.pending;for(;r.length>0&&n.length<this.maxVisible;){let[e,...t]=r;n=[...n,e],r=t}this.set({visible:n,pending:r,modals:this.state.modals})}addModal(e){let t=e.message.trim();if(!t)return;let n={id:e.id??kS(),message:t,type:e.type??`warning`,sessionId:e.sessionId??null};AS(n),e.log!==!1&&this.emit(n),this.set({...this.state,modals:[...this.state.modals,n]})}dismissModal(e){this.set({...this.state,modals:this.state.modals.filter(t=>t.id!==e)})}set(e){(e.visible!==this.state.visible||e.pending!==this.state.pending||e.modals!==this.state.modals)&&(this.state=e,this.listeners.forEach(e=>e()))}emit(e){this.noticeListeners.forEach(t=>t(e))}},MS=!1,NS=performance.now();function Dae(e){MS=e,NS=performance.now(),MS&&FS(`boot`,`debug log enabled`)}function PS(e){return(t,n)=>FS(e,t,n)}function FS(e,t,n){if(!MS)return;performance.now()-NS;let r=new Date,i=(e,t=2)=>String(e).padStart(t,`0`);`${i(r.getHours())}${i(r.getMinutes())}${i(r.getSeconds())}${i(r.getMilliseconds(),3)}`}function Oae(){if(!MS)return;let e=window.fetch;window.fetch=async(t,n)=>{let r=typeof t==`string`?t:t instanceof URL?t.href:t.url,i=n?.method??`GET`,a=performance.now();try{let o=await e(t,n);return FS(`fetch`,`${i} ${r}`,`${o.status} ${Math.round(performance.now()-a)}ms`),o}catch(e){throw FS(`fetch`,`${i} ${r}`,`failed ${Math.round(performance.now()-a)}ms`),e}}}var IS=PS(`ws-bus`),LS=new Map,RS=new Map,kae=3e4,Aae=75e3,zS=1e3,jae=15e3,BS=1,VS=3,HS=null,US=0,WS=0,GS=zS,KS=!1,qS=new Set,JS=!1;function YS(e){if(e===`disconnected`){if(JS)return;JS=!0}else{if(!JS)return;JS=!1}let t={status:e,at:Date.now()};for(let e of qS)try{e(t)}catch{}}function Mae(e){return qS.add(e),()=>qS.delete(e)}function Nae(e){return e.ch===`agent`?`agent:${e.sessionId??``}`:e.ch===`watch`?`watch:${e.filePath??``}`:e.ch}function Pae(){return`${location.protocol===`https:`?`wss://`:`ws://`}${location.host}/api/ws`}function XS(e,t){e.send(JSON.stringify({type:`sub`,...t}))}function ZS(){HS&&HS.close();let e=++WS,t;try{t=new WebSocket(Pae())}catch{YS(`disconnected`),QS(e);return}HS=t,t.onopen=()=>{GS=zS,US=Date.now(),YS(`restored`),IS(`open`,`${RS.size} subs replayed`);for(let e of RS.values())try{XS(t,e)}catch{break}},t.onmessage=n=>{if(e!==WS||HS!==t||(US=Date.now(),typeof n.data!=`string`))return;let r;try{r=JSON.parse(n.data)}catch{return}if(!r.ch){if(r.type===`ping`)try{t.send(JSON.stringify({type:`pong`}))}catch{}return}for(let e of LS.get(r.ch)??[])e(r.data)},t.onclose=n=>{e===WS&&HS===t&&(IS(`close`,`code=${n?.code} wasClean=${n?.wasClean}`),HS=null,KS||YS(`disconnected`),QS(e))},t.onerror=()=>IS(`error`,`socket error (close follows)`)}function QS(e){IS(`reconnect`,`scheduled in ${GS}ms`),setTimeout(()=>{e!==WS||HS||ZS()},GS),GS=Math.min(GS*2,jae)}function $S(){if(!HS||HS.readyState!==BS||Date.now()-US<=Aae)return;IS(`stale-rebuild`,`no frame for ${Math.round((Date.now()-US)/1e3)}s`),YS(`disconnected`),WS+=1;let e=HS;HS=null;try{e.close()}catch{}ZS()}typeof window<`u`&&(setInterval($S,kae),window.addEventListener(`pagehide`,()=>{KS=!0}),window.addEventListener(`online`,()=>{!HS||HS.readyState===VS?ZS():$S()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&(!HS||HS.readyState===VS?ZS():$S())}));function Fae(e){if(e&&HS?.readyState===BS)try{HS.send(JSON.stringify({type:`unseen`,sessionId:e}))}catch{}}function eC(e,t){let n=Nae(e),r=LS.get(n);r||(r=new Set,LS.set(n,r)),r.add(t);let i=!RS.has(n);if(RS.set(n,e),HS?.readyState===BS&&i)try{XS(HS,e)}catch{}else HS||ZS();return()=>{let e=LS.get(n);if(e?.delete(t),e&&e.size===0&&(LS.delete(n),RS.delete(n),HS?.readyState===BS))try{HS.send(JSON.stringify({type:`unsub`,ch:n}))}catch{}}}if(typeof window<`u`){let e=[`connecting`,`open`,`closing`,`closed`];window.__wsBusStatus=()=>({state:HS?e[HS.readyState]:`disconnected`,lastFrameAgoSec:US?Math.round((Date.now()-US)/1e3):null,subs:[...RS.keys()],generation:WS})}var tC=`pi.notification-log.v1`;function nC(){try{let e=window.sessionStorage.getItem(tC);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>e&&typeof e.message==`string`&&(e.notifyType===`info`||e.notifyType===`success`||e.notifyType===`warning`||e.notifyType===`error`)&&typeof e.createdAt==`number`):[]}catch{return[]}}function rC(e){try{window.sessionStorage.setItem(tC,JSON.stringify(e))}catch{}}var iC=`reduced-motion`,aC=`pi.reduced-motion-notice.v1`,oC=!1;function Iae(e){if(typeof window.matchMedia!=`function`||!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=nC();if(!t.some(e=>e.id===iC)){try{if(window.sessionStorage.getItem(aC))return;window.sessionStorage.setItem(aC,`1`)}catch{}rC([{id:iC,message:e(`reducedMotionNotice.message`),notifyType:`info`,sessionId:null,createdAt:Date.now()},...t].slice(0,50)),oC=!0}}var sC=(0,I.createContext)(null);function Lae(e){return typeof e==`string`&&e?e:typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Rae({children:e}){let{t}=z(),[n]=(0,I.useState)(()=>{Iae(t);let e=nC();return{entries:e,unread:oC&&e.some(e=>e.id===iC)?1:0}}),[r,i]=(0,I.useState)(n.entries);(0,I.useEffect)(()=>{rC(r)},[r]);let[a,o]=(0,I.useState)(n.unread),s=(0,I.useCallback)(()=>o(0),[]);(0,I.useEffect)(()=>jS.onNotice(e=>{let t={id:Lae(e.id),message:TS(e.message),notifyType:e.type,sessionId:e.sessionId??null,createdAt:Date.now()};i(e=>[t,...e].slice(0,50)),o(e=>e+1)}),[]);let[c,l]=(0,I.useState)(!1);(0,I.useEffect)(()=>Mae(e=>{l(e.status===`disconnected`),i(n=>[{id:`ws-health-${e.at}`,message:e.status===`disconnected`?t(`wsHealth.disconnected`):t(`wsHealth.restored`),notifyType:e.status===`disconnected`?`error`:`info`,sessionId:null,createdAt:e.at},...n].slice(0,50)),o(e=>e+1)}),[t]);let u=(0,I.useCallback)(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=(0,I.useCallback)(e=>{i(t=>e?t.filter(t=>t.sessionId!==e):[])},[]),f=(0,I.useMemo)(()=>({entries:r,unread:a,markRead:s,remove:u,clear:d}),[r,a,s,u,d]);return(0,L.jsxs)(sC.Provider,{value:f,children:[c&&(0,L.jsx)(`div`,{role:`status`,style:{position:`fixed`,top:0,left:0,right:0,zIndex:1e3,padding:`5px 12px`,textAlign:`center`,fontSize:`var(--text-sm)`,color:`var(--status-error)`,background:`color-mix(in srgb, var(--status-error) 12%, var(--bg))`,borderBottom:`1px solid color-mix(in srgb, var(--status-error) 40%, transparent)`},children:t(`wsHealth.disconnected`)}),e]})}function cC(){let e=(0,I.useContext)(sC);if(!e)throw Error(`useNotificationLog must be used within NotificationLogProvider`);return e}var lC=`(max-width: 640px)`;function zae(e){if(typeof window>`u`||!window.matchMedia)return()=>{};let t=window.matchMedia(lC);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function Bae(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(lC).matches}function Vae(){return!1}function uC(){return(0,I.useSyncExternalStore)(zae,Bae,Vae)}var dC=null;function Hae(e){dC=e}function Uae(e){let{onNewSession:t,activeCwd:n}=e;(0,I.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(!dC)return;let t=e.target?.tagName;if(t===`TEXTAREA`||t===`INPUT`)return;e.preventDefault(),dC();return}if(e.key===`n`&&e.ctrlKey&&e.altKey){if(!n||!t)return;e.preventDefault(),t(n)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,t])}function fC(){let[e,t]=(0,I.useState)(()=>typeof Notification>`u`?`unsupported`:Notification.permission);return(0,I.useEffect)(()=>{if(typeof Notification>`u`)return;let e=!1,n,r=()=>{e||t(Notification.permission)};return typeof navigator.permissions?.query==`function`&&navigator.permissions.query({name:`notifications`}).then(t=>{e||(n=t,r(),t.addEventListener(`change`,r))}).catch(()=>{}),()=>{e=!0,n?.removeEventListener(`change`,r)}},[]),e}function pC(e){let{fetcher:t,ttlMs:n=6e4}=e,r=null,i=null,a=0,o=null,s=new Set,c=()=>{for(let e of[...s])try{e()}catch{}},l=async e=>{try{let o=await t(e);return r=o,i=null,a=Date.now()+n,o}catch(e){throw i=e instanceof Error?e.message:String(e),e}finally{o=null}},u=e=>(o||=l(e).then(e=>(c(),e)),o),d=(e,t)=>new Promise((n,r)=>{if(e.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=()=>r(new DOMException(`Aborted`,`AbortError`));e.addEventListener(`abort`,i,{once:!0}),t.then(n,r).finally(()=>e.removeEventListener(`abort`,i))});return{get:()=>r,getError:()=>i,load:e=>{if(r!==null&&Date.now()<a)return Promise.resolve(r);let t=u(!1);return e?d(e,t):t},refresh:e=>{a=0;let t=u(!0);return e?d(e,t):t},subscribe:e=>(s.add(e),()=>s.delete(e)),clear:()=>{r=null,i=null,a=0}}}async function mC(e,t){let n=await fetch(e,t);if(!n.ok)throw Error(`HTTP ${n.status}`);return await n.json()}function Wae(){return`/api/sessions`}var hC=pC({fetcher:()=>mC(`/api/models`)}),gC=pC({fetcher:()=>mC(Wae(),{cache:`no-store`})}),_C=pC({fetcher:()=>mC(`/api/preferences`)}),vC=pC({fetcher:()=>mC(`/api/models-config`)}),yC=pC({fetcher:()=>mC(`/api/plugins/global`)}),bC=null;function Gae(e){bC=e}var xC=pC({fetcher:e=>{let t=bC?`?cwd=${encodeURIComponent(bC)}`:``;return mC(`/api/updates${t}${t?`&`:`?`}refresh=${e?`1`:`0`}`)}}),SC=null;function CC(e){SC=e}var wC=pC({fetcher:()=>mC(`/api/mcp${SC?`?cwd=${encodeURIComponent(SC)}`:``}`)}),TC=pC({fetcher:e=>mC(`/api/skills/global`,e?{cache:`no-store`}:void 0)}),EC=pC({fetcher:e=>mC(`/api/commands/global`,e?{cache:`no-store`}:void 0)}),DC=pC({fetcher:()=>mC(`/api/model-thinking`)}),OC=pC({fetcher:async()=>{let[e,t]=await Promise.all([mC(`/api/auth/providers`),mC(`/api/auth/all-providers`)]);return{oauth:e.providers,apiKey:t.providers}}});function Kae(){return`/api/preferences`}var kC=new Map,qae=2e3;function AC(e,t){let n=JSON.stringify(e),r=Date.now(),i=kC.get(n);if(i!==void 0&&r-i<qae)return;kC.set(n,r);let a=t?.keepalive===!0,o=fetch(Kae(),{method:`PUT`,headers:{"Content-Type":`application/json`},keepalive:a,body:n}).catch(e=>console.error(`[pi-web] save preferences:`,e));a||o.finally(()=>{_C.refresh().catch(e=>console.error(`[pi-web] refresh preferences:`,e))})}function Jae(){let[e,t]=(0,I.useState)(()=>_C.get()?.defaultThinkingLevel??``);(0,I.useEffect)(()=>_C.subscribe(()=>t(_C.get()?.defaultThinkingLevel??``)),[]),(0,I.useEffect)(()=>{e&&AC({firstPaint:{defaultThinkingLevel:e}})},[e]);let n=(0,I.useSyncExternalStore)(_C.subscribe,()=>_C.get()?.compaction??null),r=(0,I.useMemo)(()=>JSON.stringify(n),[n]);(0,I.useEffect)(()=>{r&&AC({firstPaint:{compaction:_C.get()?.compaction??null}})},[r]);let i=(0,I.useSyncExternalStore)(_C.subscribe,()=>_C.get()?.retry??null),a=(0,I.useMemo)(()=>JSON.stringify(i),[i]);(0,I.useEffect)(()=>{a&&AC({firstPaint:{retry:_C.get()?.retry??null}})},[a]);let[o,s]=(0,I.useState)(()=>_C.get()?.defaultProjectTrust??``);return(0,I.useEffect)(()=>_C.subscribe(()=>s(_C.get()?.defaultProjectTrust??``)),[]),(0,I.useEffect)(()=>{o&&AC({firstPaint:{defaultProjectTrust:o}})},[o]),{defaultThinkingLevel:e,setDefaultThinkingLevel:t,compaction:n,retry:i,defaultProjectTrust:o,setDefaultProjectTrust:s}}var jC=`pi-web-auto-reload-seconds`,Yae=3600;function MC(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isInteger(n)||n<0||n>3600?null:n}function Xae(){if(typeof window>`u`)return 0;let e=window.localStorage.getItem(jC);if(e===null)return 0;let t=MC(e);return t===null?0:t}var Zae=`pi-web-long-block-recent-expanded`;function NC(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isFinite(n)||!Number.isInteger(n)||n<0||n>20?null:n}function Qae(){if(typeof window>`u`)return 0;try{return NC(window.localStorage.getItem(`pi-web-long-block-recent-expanded`)??``)??0}catch{return 0}}function PC(e,t,n,r){return e===`toolCall`?`tool:${n}`:`thinking:${t}:${r}`}var $ae=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],eoe=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),toe=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],noe=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],FC=[...$ae,...toe],IC=[...eoe,...noe],roe=[...FC,...IC],ioe=`github-dark`,aoe=`github-light`,ooe=`pi-web-markdown-theme-dark`,soe=`pi-web-markdown-theme-light`;function LC(e){return e===`dark`?ooe:soe}function RC(e){return e===`dark`?ioe:aoe}function zC(e,t){return typeof e==`string`&&roe.includes(e)?e:RC(t)}function coe(){let e=e=>{if(typeof window>`u`)return RC(e);try{return zC(window.localStorage.getItem(LC(e)),e)}catch{return RC(e)}};return{dark:e(`dark`),light:e(`light`)}}function loe(e,t){try{window.localStorage.setItem(LC(e),zC(t,e))}catch{}}var BC=`pi-web-notify-events`,VC={taskComplete:!0,errors:!0,questions:!0,notifyWhileActive:!1};function uoe(){if(typeof window>`u`)return VC;try{let e=window.localStorage.getItem(BC);if(!e)return VC;let t=JSON.parse(e);return{taskComplete:t.taskComplete??VC.taskComplete,errors:t.errors??VC.errors,questions:t.questions??VC.questions,notifyWhileActive:t.notifyWhileActive??VC.notifyWhileActive}}catch{return VC}}function doe(e){window.localStorage.setItem(BC,JSON.stringify(e))}var HC=`pluginConfigBindings`;function foe(){if(typeof window>`u`)return{};try{let e=window.localStorage.getItem(HC);if(!e)return{};let t=JSON.parse(e);if(t&&typeof t==`object`)return t}catch{}return{}}var poe=1e3,moe=`pi-web-scroll-step-px`;function UC(e){let t=e.trim();if(t===``)return null;let n=Number(t);return!Number.isFinite(n)||!Number.isInteger(n)||n<1||n>1e3?null:n}function hoe(){if(typeof window>`u`)return 200;try{return UC(window.localStorage.getItem(`pi-web-scroll-step-px`)??``)??200}catch{return 200}}var WC=`pi-web-font-scale`,GC=1,goe=19.2;function _oe(){let[e,t]=(0,I.useState)(()=>{if(typeof window>`u`)return GC;let e=window.localStorage.getItem(WC),t=e===null?NaN:Number(e);return Number.isFinite(t)&&t>=.85&&t<=1.3?t:GC}),[n,r]=(0,I.useState)(()=>hoe()),[i,a]=(0,I.useState)(()=>Xae()),[o,s]=(0,I.useState)(()=>Qae()),[c,l]=(0,I.useState)(()=>uoe()),[u,d]=(0,I.useState)(()=>coe()),f=(0,I.useCallback)((e,t)=>{let n=zC(t,e);loe(e,n),d(t=>t[e]===n?t:{...t,[e]:n})},[]);(0,I.useEffect)(()=>{AC({preferences:{markdownThemes:u}})},[u]),(0,I.useEffect)(()=>{doe(c),AC({preferences:{notifyEvents:c}})},[c]);let[p,m]=(0,I.useState)(()=>foe()),h=(0,I.useCallback)((e,t)=>{m(n=>{let r=n[e]??[];return r.some(e=>e.path===t.path)?n:{...n,[e]:[...r,t]}})},[]),g=(0,I.useCallback)((e,t)=>{m(n=>{let r=n[e];if(!r)return n;let i=r.filter(e=>e.path!==t),a={...n};return i.length===0?delete a[e]:a[e]=i,a})},[]);return(0,I.useEffect)(()=>{try{window.localStorage.setItem(HC,JSON.stringify(p))}catch{}AC({preferences:{pluginConfigBindings:p}})},[p]),(0,I.useEffect)(()=>{try{window.localStorage.setItem(jC,String(i))}catch{}AC({preferences:{autoReloadSeconds:i}})},[i]),(0,I.useEffect)(()=>{try{window.localStorage.setItem(moe,String(n))}catch{}AC({preferences:{minimapScrollStepPx:n}})},[n]),(0,I.useEffect)(()=>{try{window.localStorage.setItem(Zae,String(o))}catch{}AC({preferences:{recentBlocksExpanded:o}})},[o]),(0,I.useEffect)(()=>{document.documentElement.style.fontSize=`${e*goe}px`;try{window.localStorage.setItem(WC,String(e))}catch{}AC({firstPaint:{fontScale:e}})},[e]),{fontScale:e,setFontScale:t,scrollStepPx:n,setScrollStepPx:r,autoReloadSeconds:i,setAutoReloadSeconds:a,recentBlocksExpanded:o,setRecentBlocksExpanded:s,markdownThemeDark:u.dark,markdownThemeLight:u.light,setMarkdownTheme:f,notifyEvents:c,setNotifyEvents:l,pluginConfigBindings:p,addPluginConfigBinding:h,removePluginConfigBinding:g}}var KC=[{label:{en:`Explore project`,"zh-CN":`阅读项目`},message:{en:`Explore the current project and summarize the overall directory structure and responsibilities of core modules.`,"zh-CN":`阅读当前项目,总结整体目录结构与核心模块的职责。`}},{label:{en:`Review workspace changes`,"zh-CN":`审查工作区改动`},message:{en:`Review all changes in the current workspace, point out potential issues and improvements.`,"zh-CN":`审查当前工作区的所有改动,指出潜在问题与改进点。`}},{label:{en:`Find and fix bugs`,"zh-CN":`寻找并修复bug`},message:{en:`Inspect the current codebase, find and fix existing bugs.`,"zh-CN":`检查当前代码,寻找并修复其中存在的 bug。`}}];function qC(e,t){return typeof e==`string`?e:t===`zh-CN`?e[`zh-CN`]??e.zh??e.en??``:e.en??e[`zh-CN`]??e.zh??``}function JC(e){let t=e.trim();return{en:t,"zh-CN":t}}function YC(e,t,n){let r=t.trim();if(typeof e==`string`){let t=e.trim();return n===`zh-CN`?{en:t,"zh-CN":r}:{en:r,"zh-CN":t}}let i=typeof e.en==`string`?e.en:``,a=e[`zh-CN`]??e.zh??i;return n===`zh-CN`?{en:i,"zh-CN":r}:{en:r,"zh-CN":a}}function XC(e,t){let n=qC(e,`en`),r=qC(e,`zh-CN`),i=qC(t,`en`),a=qC(t,`zh-CN`);return n===i||r===a}var voe={阅读项目:{en:`Explore project`,"zh-CN":`阅读项目`},review工作区改动:{en:`Review workspace changes`,"zh-CN":`review工作区改动`},寻找并修复bug:{en:`Find and fix bugs`,"zh-CN":`寻找并修复bug`},"阅读当前项目,总结整体目录结构与核心模块的职责。":{en:`Explore the current project and summarize the overall directory structure and responsibilities of core modules.`,"zh-CN":`阅读当前项目,总结整体目录结构与核心模块的职责。`},"review 当前工作区的所有改动,指出潜在问题与改进点。":{en:`Review all changes in the current workspace, point out potential issues and improvements.`,"zh-CN":`review 当前工作区的所有改动,指出潜在问题与改进点。`},"检查当前代码,寻找并修复其中存在的 bug。":{en:`Inspect the current codebase, find and fix existing bugs.`,"zh-CN":`检查当前代码,寻找并修复其中存在的 bug。`}};function ZC(e){if(typeof e==`string`){let t=e.trim();return t===``?null:voe[t]??JC(t)}if(typeof e==`object`&&e){let t=e,n=t.en,r=t[`zh-CN`]??t.zh,i=typeof n==`string`?n.trim():``,a=typeof r==`string`?r.trim():``;return i===``&&a===``?null:{en:i===``?a:i,"zh-CN":a===``?i:a}}return null}function QC(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let{label:e,message:r,allowAppend:i}=n,a=ZC(e),o=ZC(r);if(!a||!o)continue;let s={label:a,message:o};i===!0&&(s.allowAppend=!0),t.push(s)}return t}function $C(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(e)){if(typeof n!=`string`||n===``)continue;let e=QC(r);e&&e.length>0&&(t[n]=e)}return t}function yoe({put:e}){let[t,n]=(0,I.useState)(()=>QC(_C.get()?.preferences?.startScreenMessages)??KC),r=(0,I.useCallback)(e=>{if(t.some(t=>XC(t.label,e.label))){let t=typeof e.label==`string`?e.label:e.label?.en??e.label[`zh-CN`]??JSON.stringify(e.label);throw Error(`Name conflict: "${t}"`)}n(t=>[...t,e])},[t]),i=(0,I.useCallback)(e=>{n(t=>e<0||e>=t.length?t:t.filter((t,n)=>n!==e))},[]),a=(0,I.useCallback)((e,r)=>{if(t.some((t,n)=>n!==e&&XC(t.label,r.label))){let e=typeof r.label==`string`?r.label:r.label?.en??r.label[`zh-CN`]??JSON.stringify(r.label);throw Error(`Name conflict: "${e}"`)}n(t=>{if(e<0||e>=t.length)return t;let n=[...t];return n[e]=r,n})},[t]),o=(0,I.useCallback)(()=>{n(e=>{let t=e.filter(e=>!KC.some(t=>XC(t.label,e.label)));return[...KC,...t]})},[]);return(0,I.useEffect)(()=>_C.subscribe(()=>n(QC(_C.get()?.preferences?.startScreenMessages)??KC)),[]),(0,I.useEffect)(()=>{e({preferences:{startScreenMessages:t}})},[t,e]),{startScreenMessages:t,addStartScreenMessage:r,removeStartScreenMessage:i,updateStartScreenMessage:a,resetStartScreenMessages:o}}var ew=new Set;function tw(){for(let e of[...ew])e()}function nw(){document.visibilityState===`hidden`&&tw()}function rw(e){return typeof window>`u`?()=>{}:(ew.size===0&&(window.addEventListener(`pagehide`,tw),document.addEventListener(`visibilitychange`,nw)),ew.add(e),()=>{ew.delete(e),ew.size===0&&(window.removeEventListener(`pagehide`,tw),document.removeEventListener(`visibilitychange`,nw))})}function iw(e){return typeof e==`number`&&Number.isFinite(e)}function boe(e){if(typeof e!=`object`||!e)return null;let{x:t,y:n,width:r,height:i,collapsed:a}=e;return!iw(t)||!iw(n)||!iw(r)||r<=0||!iw(i)||i<=0?null:{x:t,y:n,width:r,height:i,collapsed:typeof a==`boolean`?a:void 0}}function aw(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t={};for(let[n,r]of Object.entries(e)){if(typeof n!=`string`||n===``)continue;let e=boe(r);e&&(t[n]=e)}return t}function ow(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function xoe({put:e}){let[t,n]=(0,I.useState)(()=>aw(_C.get()?.preferences?.widgets)??{}),r=(0,I.useRef)(!1),[i,a]=(0,I.useState)(()=>$C(_C.get()?.preferences?.widgetMessages)??{}),[o,s]=(0,I.useState)(()=>ow(_C.get()?.preferences?.workspaces));(0,I.useEffect)(()=>{let e=!1;return _C.load().then(()=>{if(e)return;r.current=!0;let t=_C.get()?.preferences;n(aw(t?.widgets)??{}),a($C(t?.widgetMessages)??{}),s(ow(t?.workspaces))}).catch(()=>{r.current=!0}),()=>{e=!0}},[]);let c=(0,I.useCallback)((e,t)=>{n(n=>{let r=n[e];return r&&r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height&&r.collapsed===t.collapsed?n:{...n,[e]:t}})},[]),l=(0,I.useRef)(null);(0,I.useEffect)(()=>()=>{l.current!==null&&clearTimeout(l.current)},[]),(0,I.useEffect)(()=>{if(!r.current)return;l.current!==null&&clearTimeout(l.current);let n=n=>e({preferences:{widgets:t}},{keepalive:n});return l.current=window.setTimeout(()=>{l.current=null,n(!1)},500),rw(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null,n(!0))})},[t,e]);let u=(0,I.useCallback)((e,t)=>{if((i[e]??[]).some(e=>XC(e.label,t.label))){let e=typeof t.label==`string`?t.label:t.label?.en??t.label[`zh-CN`]??JSON.stringify(t.label);throw Error(`Name conflict: "${e}"`)}a(n=>({...n,[e]:[...n[e]??[],t]}))},[i,a]),d=(0,I.useCallback)((e,t)=>{a(n=>{let r=n[e];if(!r||t<0||t>=r.length)return n;let i={...n},a=r.filter((e,n)=>n!==t);return a.length===0?delete i[e]:i[e]=a,i})},[a]),f=(0,I.useCallback)((e,t,n)=>{if((i[e]??[]).some((e,r)=>r!==t&&XC(e.label,n.label))){let e=typeof n.label==`string`?n.label:n.label?.en??n.label[`zh-CN`]??JSON.stringify(n.label);throw Error(`Name conflict: "${e}"`)}a(r=>{let i=r[e];if(!i||t<0||t>=i.length)return r;let a={...r},o=[...i];return o[t]=n,a[e]=o,a})},[i,a]);return(0,I.useEffect)(()=>{r.current&&e({preferences:{widgetMessages:i}})},[i,e]),{widgetGeometries:t,widgetMessages:i,savedWorkspaces:o,setWidgetGeometry:c,addWidgetMessage:u,removeWidgetMessage:d,updateWidgetMessage:f,handleSavedWorkspacesChange:(0,I.useCallback)(t=>{s(t),e({preferences:{workspaces:t}})},[s,e])}}function Soe({isDark:e,toggleTheme:t}){let{fontScale:n,setFontScale:r,scrollStepPx:i,setScrollStepPx:a,autoReloadSeconds:o,setAutoReloadSeconds:s,recentBlocksExpanded:c,setRecentBlocksExpanded:l,markdownThemeDark:u,markdownThemeLight:d,setMarkdownTheme:f,notifyEvents:p,setNotifyEvents:m,pluginConfigBindings:h,addPluginConfigBinding:g,removePluginConfigBinding:_}=_oe(),{widgetGeometries:v,widgetMessages:y,savedWorkspaces:b,setWidgetGeometry:x,addWidgetMessage:S,removeWidgetMessage:C,updateWidgetMessage:w,handleSavedWorkspacesChange:T}=xoe({put:AC}),{startScreenMessages:E,addStartScreenMessage:D,removeStartScreenMessage:O,updateStartScreenMessage:k,resetStartScreenMessages:A}=yoe({put:AC}),{defaultThinkingLevel:j,setDefaultThinkingLevel:M,compaction:N,retry:ee,defaultProjectTrust:te,setDefaultProjectTrust:P}=Jae();return _C.load().catch(e=>console.error(`[pi-web] load preferences:`,e)),{settingsValue:(0,I.useMemo)(()=>({isDark:e,toggleTheme:t,fontScale:n,setFontScale:r,scrollStepPx:i,setScrollStepPx:a,autoReloadSeconds:o,setAutoReloadSeconds:s,recentBlocksExpanded:c,setRecentBlocksExpanded:l,markdownThemeDark:u,markdownThemeLight:d,setMarkdownTheme:f,notifyEvents:p,setNotifyEvents:m,widgetGeometries:v,setWidgetGeometry:x,widgetMessages:y,addWidgetMessage:S,removeWidgetMessage:C,updateWidgetMessage:w,startScreenMessages:E,addStartScreenMessage:D,removeStartScreenMessage:O,updateStartScreenMessage:k,resetStartScreenMessages:A,pluginConfigBindings:h,addPluginConfigBinding:g,removePluginConfigBinding:_}),[e,t,n,i,o,c,p,u,d,f,v,x,y,S,C,w,E,D,O,k,A,h,g,_,s,r,m,l,a]),defaultThinkingLevel:j,setDefaultThinkingLevel:M,compaction:N,retry:ee,defaultProjectTrust:te,setDefaultProjectTrust:P,savedWorkspaces:b,handleSavedWorkspacesChange:T,widgetGeometries:v,setWidgetGeometry:x,widgetMessages:y,addWidgetMessage:S,removeWidgetMessage:C,updateWidgetMessage:w,fontScale:n,setFontScale:r}}function Coe({projectTrustCwd:e,onTrusted:t}){let[n,r]=(0,I.useState)(null),[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(r(null),a(!1),l(null),!e)return;let t=new AbortController,n=new URLSearchParams(window.location.search).get(`piE2eTrustCwd`);return fetch(`/api/project-trust?cwd=${encodeURIComponent(e)}${n?`&piE2eTrustCwd=${encodeURIComponent(n)}`:``}`,{signal:t.signal}).then(async e=>{let t=await e.json();if(!e.ok||t.error)throw Error(t.error??`HTTP ${e.status}`);r(t)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||console.error(`Failed to load project trust:`,e)}),()=>t.abort()},[e]),{projectTrust:n,projectTrustDialogOpen:i,setProjectTrustDialogOpen:a,projectTrustBusy:o,projectTrustError:c,setProjectTrustError:l,handleTrustProject:(0,I.useCallback)(async()=>{if(!(!e||o)){s(!0),l(null);try{let n=await fetch(`/api/project-trust`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e})}),i=await n.json();if(!n.ok||i.error)throw Error(i.error??`HTTP ${n.status}`);r(i),a(!1),t?.()}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}},[o,e,t])}}var sw=class extends Error{constructor(e,t,n){super(e),this.name=`ApiError`,this.status=t,this.body=n}},cw=[],woe=1,lw=new Set;function uw(){for(let e of lw)e()}function Toe(e){return lw.add(e),()=>{lw.delete(e)}}function dw(){return cw}function Eoe(e){let t={id:woe++,label:e??``};cw=[...cw,t],uw();let n=!1;return()=>{n||(n=!0,cw=cw.filter(e=>e.id!==t.id),uw())}}var fw=new WeakMap;function Doe(e){if(!e.isConnected)return()=>{};let t=fw.get(e);if(!t){let n=document.createElement(`div`);n.style.cssText=`position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb, var(--bg) 50%, transparent);z-index:5;`,n.innerHTML=`<div style="width:16px;height:16px;border:2px solid var(--border);border-top-color:var(--text-dim);border-radius:50%;animation:spin 0.8s linear infinite;"></div>`;let r=null;getComputedStyle(e).position===`static`&&(r=e.style.position,e.style.position=`relative`),e.appendChild(n),t={count:0,el:n,prevPosition:r},fw.set(e,t)}t.count++;let n=!1;return()=>{n||(n=!0,t.count--,t.count<=0&&(t.el.remove(),t.prevPosition!==null&&(t.prevPosition?e.style.position=t.prevPosition:e.style.removeProperty(`position`)),fw.delete(e)))}}async function Ooe(e){try{return await e.json()}catch{return null}}function koe(e,t){return e===`fullscreen`?Eoe(t):e instanceof HTMLElement?Doe(e):null}function pw(e,t){return e instanceof Error?e.message:t}function Aoe(e,t){return e&&typeof e==`object`&&`error`in e&&typeof e.error==`string`?e.error:`HTTP ${t}`}async function mw(e,t,n){let r=koe(n?.loading??`fullscreen`,n?.label);try{let n;try{n=await fetch(e,t)}catch(e){throw new sw(pw(e,`Network error`),0)}if(!n.ok){let e=await Ooe(n);throw new sw(Aoe(e,n.status),n.status,e)}let r=await n.text();return r?JSON.parse(r):void 0}catch(e){throw e instanceof sw?e:new sw(pw(e,String(e)),0)}finally{r?.()}}var hw=e=>window.history.replaceState(null,``,e);function joe(e){let{selectedSession:t,setSelectedSession:n,setNewSessionCwd:r,setSessionKey:i,setRefreshKey:a,hydrateSelectedSession:o,extensionDialogActiveRef:s,suppressCwdBumpRef:c,setInitialSessionRestored:l,onSessionSelected:u,onTopPanelReset:d}=e,f=(0,I.useCallback)((e,t=!1)=>{!t&&s.current||(r(null),n(e),i(e=>e+1),l(!0),t&&(c.current=!0),t||hw(`?session=${encodeURIComponent(e.id)}`),u?.(t))},[s,c,r,n,i,l,u]),p=(0,I.useCallback)(async(e,t)=>{await mw(`/api/cwd/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:t})},{loading:`silent`}),n(null),r(t),i(e=>e+1),d?.(),u?.(!1),hw(`/`)},[u,d,r,n,i]),m=(0,I.useCallback)(e=>{r(null),n(e),a(e=>e+1),o(e.id),hw(`?session=${encodeURIComponent(e.id)}`)},[o,r,a,n]),h=(0,I.useCallback)(()=>{l(!0)},[l]);return{handleSelectSession:f,handleNewSession:p,handleSessionCreated:m,handleSessionForked:(0,I.useCallback)(e=>{a(e=>e+1),i(e=>e+1),r(null),n(t=>({...t??{path:``,cwd:``,created:``,modified:``,messageCount:0,firstMessage:``},id:e})),o(e),hw(`?session=${encodeURIComponent(e)}`)},[o,r,a,n,i]),handleSessionDeleted:(0,I.useCallback)(e=>{if(a(e=>e+1),t?.id===e){let e=t.cwd;n(null),r(e??null),i(e=>e+1),d?.(),hw(`/`)}},[t,d,r,a,n,i]),handleInitialRestoreDone:h}}function Moe(){let[e,t]=(0,I.useState)(0),[n,r]=(0,I.useState)(0),[i,a]=(0,I.useState)(0),[o,s]=(0,I.useState)(0);return{refreshKey:e,setRefreshKey:t,sessionKey:n,setSessionKey:r,explorerRefreshKey:i,setExplorerRefreshKey:a,modelsRefreshKey:o,setModelsRefreshKey:s,handleAgentEnd:(0,I.useCallback)(()=>{t(e=>e+1),a(e=>e+1)},[]),handleExplorerRefresh:(0,I.useCallback)(()=>{a(e=>e+1)},[])}}var Noe=e=>window.history.replaceState(null,``,e);function Poe({initialNavigation:e,onProjectSwitch:t,onSessionSelected:n,onTopPanelReset:r}){let[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(null),[c,l]=(0,I.useState)(()=>e.requestedCwd?`validating`:`idle`),[u,d]=(0,I.useState)(null),{refreshKey:f,setRefreshKey:p,sessionKey:m,setSessionKey:h,explorerRefreshKey:g,setExplorerRefreshKey:_,modelsRefreshKey:v,setModelsRefreshKey:y,handleAgentEnd:b,handleExplorerRefresh:x}=Moe(),[S,C]=(0,I.useState)(()=>!e.sessionId),[w,T]=(0,I.useState)(null),E=(0,I.useRef)(null),D=(0,I.useRef)(!1),O=(0,I.useRef)(!1);(0,I.useEffect)(()=>{let t=e.requestedCwd;if(!t)return;let n=new AbortController;return l(`validating`),d(null),fetch(`/api/cwd/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:t}),signal:n.signal}).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok||!t.cwd)throw Error(t.error??`HTTP ${e.status}`);D.current=!0,s(t.cwd),l(`ready`)}).catch(e=>{n.signal.aborted||(d(e instanceof Error?e.message:String(e)),l(`error`))}),()=>n.abort()},[e]);let k=o??(i===null&&w?w:null),A=i!==null||k!==null,j=i?.cwd??k,{projectTrust:M,projectTrustDialogOpen:N,setProjectTrustDialogOpen:ee,projectTrustBusy:te,projectTrustError:P,setProjectTrustError:F,handleTrustProject:ne}=Coe({projectTrustCwd:j,onTrusted:()=>{y(e=>e+1),h(e=>e+1)}}),{handleSelectSession:re,handleNewSession:ie,handleSessionCreated:ae,handleSessionForked:oe,handleSessionDeleted:se,handleInitialRestoreDone:ce}=joe({selectedSession:i,setSelectedSession:a,setNewSessionCwd:s,setSessionKey:h,setRefreshKey:p,hydrateSelectedSession:(0,I.useCallback)(e=>{gC.load().then(t=>{let n=t.sessions.find(t=>t.id===e);n&&a(t=>t&&t.id===e&&!t.projectRoot?n:t)}).catch(e=>console.error(`[pi-web] hydrate session:`,e))},[]),extensionDialogActiveRef:O,suppressCwdBumpRef:D,setInitialSessionRestored:C,onSessionSelected:n,onTopPanelReset:r});return{selectedSession:i,setSelectedSession:a,newSessionCwd:o,effectiveNewSessionCwd:k,showChat:A,projectTrustCwd:j,refreshKey:f,setRefreshKey:p,explorerRefreshKey:g,setExplorerRefreshKey:_,modelsRefreshKey:v,setModelsRefreshKey:y,sessionKey:m,activeCwd:w,initialCwdStatus:c,initialCwdError:u,initialSessionRestored:S,projectTrust:M,projectTrustDialogOpen:N,setProjectTrustDialogOpen:ee,projectTrustBusy:te,projectTrustError:P,setProjectTrustError:F,extensionDialogActiveRef:O,handleSelectSession:re,handleNewSession:ie,handleSessionCreated:ae,handleAgentEnd:b,handleSessionForked:oe,handleSessionDeleted:se,handleSessionUnseen:(0,I.useCallback)(e=>{i?.id===e&&(a(null),h(e=>e+1),r?.(),Noe(`/`))},[i,r,h]),handleCwdChange:(0,I.useCallback)((e,n)=>{if(T(e),!e)return;let r=n??e,o=E.current??(i?i.projectRoot??i.cwd:null);if(!o){E.current=r;return}if(E.current=r,D.current){D.current=!1;return}o!==r&&(i?i.projectRoot??i.cwd:null)!==r&&(a(null),s(t=>t&&t!==e?null:t),h(e=>e+1),t?.())},[i,t,s,h,a]),handleTrustProject:ne,handleExplorerRefresh:x,handleInitialRestoreDone:ce}}var gw=(0,I.createContext)(null);function Foe({value:e,children:t}){return(0,L.jsx)(gw.Provider,{value:e,children:t})}function _w(){let e=(0,I.useContext)(gw);if(!e)throw Error(`useSettings must be used within SettingsProvider`);return e}function vw(){return(0,I.useContext)(gw)}function yw(e,t,n){let[r,i]=(0,I.useState)(()=>{try{let t=localStorage.getItem(e);if(t!==null){let e=JSON.parse(t);return n?n(e):e}}catch{}return typeof t==`function`?t():t});return(0,I.useEffect)(()=>{try{localStorage.setItem(e,JSON.stringify(r))}catch{}},[e,r]),[r,i]}var bw=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Ioe=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Loe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),xw=e=>{let t=Loe(e);return t.charAt(0).toUpperCase()+t.slice(1)},Sw={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`},Roe=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},zoe=(0,I.createContext)({}),Boe=()=>(0,I.useContext)(zoe),Voe=(0,I.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=``}=Boe()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,I.createElement)(`svg`,{ref:c,...Sw,width:t??l??Sw.width,height:t??l??Sw.height,stroke:e??f,strokeWidth:m,className:bw(`lucide`,p,i),...!a&&!Roe(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,I.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Cw=(e,t)=>{let n=(0,I.forwardRef)(({className:n,...r},i)=>(0,I.createElement)(Voe,{ref:i,iconNode:t,className:bw(`lucide-${Ioe(xw(e))}`,`lucide-${e}`,n),...r}));return n.displayName=xw(e),n},Hoe=Cw(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),ww=Cw(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Uoe=Cw(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Tw=Cw(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ew=Cw(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Woe=Cw(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Goe=Cw(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Koe=Cw(`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`}]]),Dw=Cw(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),qoe=Cw(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]]),Joe=Cw(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),Yoe=Cw(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`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`}]]),Xoe=Cw(`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`}]]),Ow=Cw(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Zoe=Cw(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Qoe=Cw(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),kw=Cw(`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`}]]),$oe=Cw(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Aw=Cw(`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`}]]),ese=Cw(`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`}]]),tse=Cw(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),jw=Cw(`expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}],[`path`,{d:`M3 16v5h5`,key:`1t08am`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 8V3h5`,key:`1ln10m`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),nse=Cw(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Mw=Cw(`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`}]]),rse=Cw(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),Nw=Cw(`file-diff`,[[`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:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),ise=Cw(`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`}]]),Pw=Cw(`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`}]]),ase=Cw(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`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`}]]),ose=Cw(`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`}]]),Fw=Cw(`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`}]]),sse=Cw(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),cse=Cw(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Iw=Cw(`hard-drive-upload`,[[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]),lse=Cw(`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`}]]),Lw=Cw(`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`}]]),Rw=Cw(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),zw=Cw(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),use=Cw(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Bw=Cw(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Vw=Cw(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),dse=Cw(`list-end`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M16 12H3`,key:`1a2rj7`}],[`path`,{d:`M9 19H3`,key:`s61nz1`}],[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M21 5v12a2 2 0 0 1-2 2h-6`,key:`hey24a`}]]),Hw=Cw(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Uw=Cw(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),fse=Cw(`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`}]]),pse=Cw(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),mse=Cw(`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`}]]),Ww=Cw(`message-square`,[[`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`}]]),hse=Cw(`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`}]]),gse=Cw(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),_se=Cw(`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`}]]),Gw=Cw(`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`}]]),Kw=Cw(`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`}]]),vse=Cw(`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`}]]),qw=Cw(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Jw=Cw(`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`}]]),Yw=Cw(`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`}]]),Xw=Cw(`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`}]]),yse=Cw(`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`}]]),Zw=Cw(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Qw=Cw(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),$w=Cw(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),bse=Cw(`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`}]]),xse=Cw(`shield-check`,[[`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:`m9 12 2 2 4-4`,key:`dzmm74`}]]),eT=Cw(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),tT=Cw(`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`}]]),nT=Cw(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),Sse=Cw(`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`}]]),rT=Cw(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Cse=Cw(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),wse=Cw(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Tse=Cw(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),iT=Cw(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),aT=Cw(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),oT=Cw(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ese=Cw(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Dse=Cw(`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`}]]),Ose=Cw(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),kse=Cw(`volume-x`,[[`path`,{d:`M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z`,key:`1p7khw`}],[`path`,{d:`m16.5 14.5 5-5`,key:`cul3yw`}],[`path`,{d:`m16.5 9.5 5 5`,key:`1akey5`}]]),sT=Cw(`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`}]]),cT=Cw(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ase=Cw(`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`}]]),jse=Cw(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Mse=Cw(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]);function lT(e){return{value:(0,I.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get(),()=>e.get()),error:e.getError()}}function uT(e,t){let n=(0,I.useRef)(t);(n.current.length!==t.length||n.current.some((e,n)=>e!==t[n]))&&e(),n.current=t}function dT(e,t){let{onRelease:n,moveTolerancePx:r=0}=t??{},i=(0,I.useRef)(null),a=(0,I.useRef)(!1),o=(0,I.useRef)(null),s=(0,I.useRef)(e),c=(0,I.useRef)(n);(0,I.useEffect)(()=>{s.current=e,c.current=n},[e,n]);let l=(0,I.useCallback)(()=>{o.current?.(),o.current=null},[]),u=(0,I.useCallback)(()=>{i.current!==null&&(clearTimeout(i.current),i.current=null),l()},[l]);return(0,I.useEffect)(()=>u,[u]),{startLongPress:(0,I.useCallback)(e=>{if(u(),a.current=!1,i.current=window.setTimeout(()=>{i.current=null,l(),a.current=!0,s.current()},500),r<=0||e===void 0)return;let t={x:e.clientX,y:e.clientY},n=e=>{Math.hypot(e.clientX-t.x,e.clientY-t.y)>r&&u()},c=()=>l();document.addEventListener(`pointermove`,n,!0),document.addEventListener(`pointerup`,c,!0),document.addEventListener(`pointercancel`,c,!0),o.current=()=>{document.removeEventListener(`pointermove`,n,!0),document.removeEventListener(`pointerup`,c,!0),document.removeEventListener(`pointercancel`,c,!0)}},[u,r,l]),endLongPress:(0,I.useCallback)(()=>{u(),c.current?.()},[u]),suppressClickCapture:(0,I.useCallback)(e=>{a.current&&(a.current=!1,e.preventDefault(),e.stopPropagation())},[]),suppressNextClick:(0,I.useCallback)(()=>{a.current=!0},[])}}function Nse({children:e}){return(0,L.jsx)(L.Fragment,{children:e})}function Pse({mobileTrigger:e,children:t,openRef:n,show:r,hide:i,triggerRef:a}){let o=uC(),s=e??`auto`,c=Array.isArray(t)?t[0]:t,l=c&&typeof c==`object`&&`props`in c?c.props??null:null,u=l!=null&&(l.onClick!==void 0||l.onPointerDown!==void 0),d=o&&s!==`none`&&(s===`tap`||!u),f=o&&s===`auto`&&u,{startLongPress:p,endLongPress:m,suppressClickCapture:h}=dT(()=>r(),{onRelease:()=>{n.current&&i()}});return(0,I.useEffect)(()=>{if(!d)return;let e=e=>{a.current?.contains(e.target)||i()};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[d,i,a]),{tapTrigger:d,longPressTrigger:f,startLongPress:p,endLongPress:m,suppressClickCapture:h}}function Fse({tapTrigger:e,longPressTrigger:t,hoverOnly:n,show:r,hide:i,toggleTap:a,startLongPress:o,endLongPress:s,suppressClickCapture:c}){return e||t?{onPointerEnter:void 0,onPointerLeave:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onFocus:void 0,onBlur:void 0,onPointerDown:e?a:o,onPointerUp:t?s:void 0,onPointerCancel:t?s:void 0,onClickCapture:t?c:void 0}:{onPointerEnter:r,onPointerLeave:i,onMouseEnter:r,onMouseLeave:i,onFocus:n?void 0:r,onBlur:n?void 0:i,onPointerDown:void 0,onPointerUp:void 0,onPointerCancel:void 0,onClickCapture:void 0}}function fT({label:e,wrapperStyle:t,wrapperClassName:n,hoverOnly:r,mobileTrigger:i,panelMaxWidth:a,children:o}){let s=(0,I.useRef)(null),c=(0,I.useRef)(null),[l,u]=(0,I.useState)(!1),d=(0,I.useRef)(!1),f=(0,I.useRef)(!1),p=(0,I.useRef)(()=>{}),m=(0,I.useCallback)(e=>{if(!f.current)return;let t=s.current?.getBoundingClientRect();if(!t)return;let{clientX:n,clientY:r}=e;(n<t.left||n>t.right||r<t.top||r>t.bottom)&&p.current()},[]),h=(0,I.useCallback)(e=>{let t=s.current?.getBoundingClientRect();if(!t)return;try{e.showPopover()}catch{}let n=e.offsetWidth,r=e.offsetHeight;if(n){let i=t.left+t.width/2,a=n/2,o=window.innerWidth,s=window.innerHeight,c=Math.max(a+8,Math.min(i,o-a-8)),l=t.bottom+6+r<=s-8,u=t.top-6-r>=8,d=l||!u?`bottom`:`top`;e.style.top=d===`bottom`?`${t.bottom+6}px`:`${t.top-6}px`,e.style.left=`${c}px`,e.style.transform=d===`top`?`translate(-50%, -100%)`:`translateX(-50%)`}else e.style.top=`${t.bottom+6}px`,e.style.left=`${t.left+t.width/2}px`,e.style.transform=`translateX(-50%)`;document.addEventListener(`pointermove`,m,!0)},[m]),g=(0,I.useCallback)(()=>{if(f.current=!0,!d.current){d.current=!0,u(!0);return}let e=c.current;e&&h(e)},[h]),_=(0,I.useCallback)(()=>{f.current=!1,document.removeEventListener(`pointermove`,m,!0);let e=c.current;if(e)try{e.hidePopover()}catch{}},[m]);p.current=_;let v=()=>{f.current?_():g()},y=Pse({mobileTrigger:i,children:o,openRef:f,show:g,hide:_,triggerRef:s});if((0,I.useLayoutEffect)(()=>{if(!l)return;let e=c.current;e&&h(e)},[l]),!e)return(0,L.jsx)(L.Fragment,{children:o});let b=l&&typeof document<`u`?(0,P_.createPortal)((0,L.jsx)(`div`,{ref:c,role:`tooltip`,"data-slot":`tooltip-content`,popover:`hint`,style:{position:`fixed`,right:`auto`,bottom:`auto`,margin:0,zIndex:9999,width:`max-content`,maxWidth:`min(${a==null?`max(40vw, 40em)`:typeof a==`number`?`${a}px`:a}, calc(100vw - 16px))`,maxHeight:`calc(100dvh - 16px)`,overflowY:`auto`,whiteSpace:`pre-line`,overflowWrap:`break-word`,background:`var(--bg-panel)`,color:`var(--text)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md, 6px)`,padding:`4px 8px`,fontSize:`var(--text-sm)`,lineHeight:1.5,boxShadow:`0 4px 16px -2px var(--shadow-strong)`,pointerEvents:`none`},children:e}),document.body):null;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{ref:s,"data-slot":`tooltip-trigger`,className:n,title:``,...Fse({tapTrigger:y.tapTrigger,longPressTrigger:y.longPressTrigger,hoverOnly:r,show:g,hide:_,toggleTap:v,startLongPress:y.startLongPress,endLongPress:y.endLongPress,suppressClickCapture:y.suppressClickCapture}),onPointerMove:e=>e.stopPropagation(),style:{display:`inline-flex`,...t},children:o}),b]})}function pT({label:e,hint:t,children:n,bare:r}){return(0,L.jsxs)(Ise,{bare:r,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,minWidth:0},children:[(0,L.jsx)(`span`,{style:{fontSize:`var(--text-lg)`,color:`var(--text)`,fontWeight:500,whiteSpace:`nowrap`},children:e}),t&&(0,L.jsx)(fT,{label:t,children:(0,L.jsx)(`span`,{role:`img`,"aria-label":t,style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,cursor:`help`,lineHeight:1,flexShrink:0},children:`ⓘ`})})]}),(0,L.jsx)(`div`,{style:{flex:1,minWidth:0,maxWidth:320},children:n})]})}function Ise({children:e,bare:t}){return(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:16,padding:`10px 14px`,...t?{}:{border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-input)`}},children:e})}var Lse=[{key:`enableAnalytics`,kind:`bool`},{key:`enableInstallTelemetry`,kind:`bool`,default:!0},{key:`httpProxy`,kind:`string`},{key:`trackingId`,kind:`string`},{key:`httpIdleTimeoutMs`,kind:`int`},{key:`websocketConnectTimeoutMs`,kind:`int`},{key:`branchSummary`,kind:`object`,fields:[{key:`reserveTokens`,kind:`int`},{key:`skipPrompt`,kind:`bool`}]},{key:`images`,kind:`object`,fields:[{key:`autoResize`,kind:`bool`,default:!0,hint:`preferences.pi.autoResizeHint`},{key:`blockImages`,kind:`bool`,hint:`preferences.pi.blockImagesHint`}]}],Rse={};function zse(){let{t:e}=z(),t=(0,I.useSyncExternalStore)(_C.subscribe,()=>_C.get()?.piSettings??Rse),n=e=>{mw(`/api/preferences`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({firstPaint:{piSettings:e}})},{loading:`silent`}).finally(()=>void _C.refresh().catch(e=>console.error(`[pi-web] refresh preferences:`,e)))},r=(e,t)=>n({[e]:t}),i=(e,r,i)=>{let a=t[e]??{};n({[e]:{...a,[r]:i}})};return(0,L.jsx)(`div`,{style:{height:`100%`,overflowY:`auto`,padding:`18px 20px 40px`,display:`flex`,flexDirection:`column`,gap:8,maxWidth:640},children:Lse.map(n=>(0,L.jsx)(Bse,{spec:n,value:t[n.key],t:e,setValue:r,setSub:i},n.key))})}function Bse({spec:e,value:t,t:n,setValue:r,setSub:i}){return(0,L.jsx)(pT,{label:n(`preferences.pi.${e.key}`),hint:n(`preferences.pi.${e.key}Hint`),children:(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,width:`100%`},children:[e.kind===`bool`&&(0,L.jsx)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:`var(--text-base)`,color:`var(--text-muted)`,whiteSpace:`nowrap`},children:(0,L.jsx)(`input`,{type:`checkbox`,checked:(t??e.default)===!0,onChange:t=>r(e.key,t.target.checked),"aria-label":n(`preferences.pi.${e.key}`)})}),e.kind===`string`&&(0,L.jsx)(mT,{value:typeof t==`string`?t:``,placeholder:n(`preferences.pi.unset`),onCommit:t=>r(e.key,t),ariaLabel:n(`preferences.pi.${e.key}`)}),e.kind===`int`&&(0,L.jsx)(mT,{value:typeof t==`number`?String(t):``,placeholder:n(`preferences.pi.unset`),numeric:!0,onCommit:t=>r(e.key,Number(t)),ariaLabel:n(`preferences.pi.${e.key}`)}),e.kind===`object`&&e.fields?.map(r=>(0,L.jsx)(Vse,{sub:r,value:t?.[r.key],t:n,setSub:i,specKey:e.key},r.key))]})})}function Vse({specKey:e,sub:t,value:n,t:r,setSub:i}){let a=n=>i(e,t.key,n),o=r(`preferences.pi.${t.key}`);return(0,L.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:`var(--text-base)`,color:`var(--text-muted)`,whiteSpace:`nowrap`},children:[(0,L.jsx)(`span`,{style:{minWidth:120},children:o}),t.hint&&(0,L.jsx)(fT,{label:r(t.hint),children:(0,L.jsx)(`span`,{role:`img`,"aria-label":r(t.hint),style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,cursor:`help`,lineHeight:1,flexShrink:0},children:`ⓘ`})}),t.kind===`bool`&&(0,L.jsx)(`input`,{type:`checkbox`,checked:(n??t.default)===!0,onChange:e=>a(e.target.checked),"aria-label":o}),t.kind===`string`&&(0,L.jsx)(mT,{value:typeof n==`string`?n:``,placeholder:r(`preferences.pi.unset`),onCommit:a,ariaLabel:o}),t.kind===`int`&&(0,L.jsx)(mT,{value:typeof n==`number`?String(n):``,placeholder:r(`preferences.pi.unset`),numeric:!0,onCommit:e=>a(Number(e)),ariaLabel:o})]})}function mT({value:e,placeholder:t,numeric:n,onCommit:r,ariaLabel:i}){let[a,o]=(0,I.useState)(e);return uT(()=>o(e),[e]),(0,L.jsx)(`input`,{type:n?`number`:`text`,min:n?1:void 0,placeholder:t,value:a,onChange:e=>o(e.target.value),onBlur:()=>{let e=a.trim();if(e!==``){if(n){let t=Number(e);if(!Number.isInteger(t)||t<=0)return}r(e)}},"aria-label":i,style:{width:200,padding:`4px 6px`,fontSize:`var(--text-base)`,fontFamily:`var(--font-mono)`,color:`var(--text)`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:6,outline:`none`}})}var hT=1200,Hse=320,gT=420;function Use(e,t,n){return Math.round(Math.max(t,Math.min(Math.max(t,n),Number.isFinite(e)?e:t)))}function Wse(e){let{viewportWidth:t,rightPanelOpen:n,rightPanelWidth:r}=e;if(t<=640)return 480;let i=t<960,a=i?Hse:gT,o=!i&&n?r:0;return Math.min(480,t-a-o)}function Gse(e){let{viewportWidth:t,sidebarOpen:n,sidebarWidth:r}=e;if(t<960)return hT;let i=n?r:0;return Math.min(hT,t-gT-i)}var B={xs:10,sm:11,base:12,lg:13,xl:14,"2xl":15,"3xl":16,"4xl":18,"5xl":20};function _T({label:e,onClick:t}){return(0,L.jsx)(`button`,{type:`button`,onClick:t,"aria-label":e,title:e,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:22,height:22,padding:0,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,cursor:`pointer`,flexShrink:0},children:(0,L.jsxs)(`svg`,{width:B.base,height:B.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,L.jsx)(`path`,{d:`M3 3v5h5`})]})})}var vT={boxSizing:`border-box`,background:`var(--bg-input, var(--bg))`,color:`var(--text)`,border:`1px solid var(--border)`,borderRadius:4,padding:`4px 8px`,fontSize:`var(--text-base)`,fontFamily:`var(--font-mono)`};function yT({value:e,onChange:t,parse:n}){let[r,i]=(0,I.useState)(String(e));return uT(()=>{i(String(e))},[e]),{draft:r,commit:e=>{i(e);let r=n(e);r!==null&&t(r)}}}function bT({tooltip:e=!1,offText:t,...n}){let{t:r,labelKey:i,unitText:a,rangeText:o,resetText:s,defaultValue:c,min:l,max:u}=n,{draft:d,commit:f}=yT(n),p=t!=null&&n.value===c?t:o,m=(0,L.jsx)(`input`,{type:`number`,min:l,max:u,step:1,value:d,onChange:e=>f(e.target.value),"aria-label":r(i),...e?{}:{title:p},style:{flex:1,minWidth:0,...vT}}),h=(0,L.jsx)(_T,{label:s,onClick:()=>n.onChange(c)});return(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`},children:[e?(0,L.jsx)(fT,{label:p,wrapperStyle:{flex:1,display:`flex`},children:m}):m,(0,L.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,whiteSpace:`nowrap`},children:a}),e?(0,L.jsx)(fT,{label:s,children:h}):h]})}function xT({unitSuffix:e,offText:t,tooltip:n=!0,...r}){let{t:i,labelKey:a,rangeText:o,resetText:s,value:c,defaultValue:l,min:u,max:d}=r,{draft:f,commit:p}=yT(r);return(0,L.jsxs)(`div`,{role:`menu`,"aria-label":i(a),style:{background:`var(--bg-panel)`,borderLeft:`1px solid var(--border)`,borderRight:`1px solid var(--border)`,borderBottom:`1px solid var(--border)`,padding:`10px 12px 12px`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,marginBottom:8},children:[(0,L.jsx)(`span`,{children:i(a)}),(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,L.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600},children:[c,e]}),(()=>{let e=(0,L.jsx)(_T,{label:s,onClick:()=>r.onChange(l)});return n?(0,L.jsx)(fT,{label:s,children:e}):e})()]})]}),(0,L.jsx)(`input`,{type:`number`,min:u,max:d,step:1,value:f,onChange:e=>p(e.target.value),"aria-label":i(a),style:{width:`100%`,...vT}}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginTop:4,textAlign:`center`},children:t!=null&&c===l?t:o})]})}function Kse({value:e,onChange:t,t:n,embedded:r}){let i={value:e,onChange:t,parse:UC,min:1,max:poe,defaultValue:200,t:n,labelKey:`theme.scrollStep`,unitText:n(`scrollStep.unit`),rangeText:n(`scrollStep.range`),resetText:n(`scrollStep.reset`,{n:200})};return r?(0,L.jsx)(bT,{...i,tooltip:!0}):(0,L.jsx)(xT,{...i,unitSuffix:`px`})}function qse({sidebarWidth:e,onSidebarWidthChange:t,widgetPanelWidth:n,onWidgetPanelWidthChange:r}){let{t:i}=z(),{isDark:a,toggleTheme:o,fontScale:s,setFontScale:c,scrollStepPx:l,setScrollStepPx:u,recentBlocksExpanded:d,setRecentBlocksExpanded:f,markdownThemeDark:p,markdownThemeLight:m,setMarkdownTheme:h}=_w();return(0,L.jsxs)(`div`,{style:{height:`100%`,overflowY:`auto`,padding:`18px 20px 40px`,display:`flex`,flexDirection:`column`,gap:8,maxWidth:640},children:[(0,L.jsx)(pT,{label:i(`theme.toggleTheme`),children:(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16,width:`100%`},children:[{value:!0,key:`dark`,labelKey:`theme.darkMode`},{value:!1,key:`light`,labelKey:`theme.lightMode`}].map(({value:e,key:t,labelKey:n})=>(0,L.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:`var(--text-base)`,color:`var(--text)`,cursor:`pointer`,whiteSpace:`nowrap`},children:[(0,L.jsx)(`input`,{type:`radio`,name:`theme-mode`,checked:a===e,onChange:e=>{let t=e.currentTarget.getBoundingClientRect();o({x:t.left+t.width/2,y:t.top+t.height/2})},style:{accentColor:`var(--accent)`,cursor:`pointer`,margin:0}}),i(n)]},t))})}),(0,L.jsx)(pT,{label:i(`theme.markdownThemeDark`),hint:i(`theme.markdownThemeHint`),children:(0,L.jsx)(ST,{mode:`dark`,value:p,onChange:e=>h(`dark`,e),label:i(`theme.markdownThemeDark`),t:i})}),(0,L.jsx)(pT,{label:i(`theme.markdownThemeLight`),children:(0,L.jsx)(ST,{mode:`light`,value:m,onChange:e=>h(`light`,e),label:i(`theme.markdownThemeLight`),t:i})}),(0,L.jsx)(pT,{label:i(`theme.fontSize`),children:(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`},children:[(0,L.jsx)(`input`,{type:`range`,min:.85,max:1.3,step:.05,value:s,onChange:e=>c(Number(e.target.value)),"aria-label":i(`theme.fontSize`),style:{flex:1,accentColor:`var(--accent)`,cursor:`pointer`}}),(0,L.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,color:`var(--text)`,fontWeight:600,minWidth:44,textAlign:`right`},children:[Math.round(s*100),`%`]})]})}),(0,L.jsx)(pT,{label:i(`theme.scrollStep`),hint:i(`scrollStep.hint`),children:(0,L.jsx)(Kse,{value:l,onChange:u,t:i,embedded:!0})}),(0,L.jsx)(pT,{label:i(`theme.recentBlocksExpanded`),hint:i(`recentBlocks.hint`),children:(0,L.jsx)(Jse,{value:d,onChange:f,t:i})}),(0,L.jsx)(pT,{label:i(`layout.sidebarWidth`),hint:i(`layout.widthRange`,{min:180,max:480}),children:(0,L.jsx)(CT,{value:e,onChange:t,min:180,max:480,resetTo:280,label:i(`layout.sidebarWidth`),t:i})}),(0,L.jsx)(pT,{label:i(`layout.widgetPanelWidth`),hint:i(`layout.widthRange`,{min:200,max:560}),children:(0,L.jsx)(CT,{value:n,onChange:r,min:200,max:560,resetTo:280,label:i(`layout.widgetPanelWidth`),t:i})}),` `]})}function ST({mode:e,value:t,onChange:n,label:r,t:i}){let a=[{key:`light`,labelKey:`theme.lightMode`,names:FC},{key:`dark`,labelKey:`theme.darkMode`,names:IC}];return(0,L.jsx)(`select`,{value:t,onChange:e=>n(e.target.value),"aria-label":r,"data-testid":`markdown-theme-select-${e}`,style:{minWidth:190,padding:`5px 8px`,border:`1px solid var(--border)`,borderRadius:7,background:`var(--bg)`,color:`var(--text)`,fontSize:`var(--text-lg)`,outline:`none`,cursor:`pointer`},children:a.map(e=>(0,L.jsx)(`optgroup`,{label:i(e.labelKey),children:e.names.map(e=>(0,L.jsx)(`option`,{value:e,children:e},e))},e.key))})}function CT({value:e,onChange:t,min:n,max:r,resetTo:i,label:a,t:o}){return(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[(0,L.jsx)(`input`,{type:`number`,value:e,min:n,max:r,onChange:e=>{let i=Number.parseInt(e.target.value,10);Number.isFinite(i)&&t(Math.min(r,Math.max(n,i)))},onBlur:()=>t(e),"aria-label":a,style:{width:80,padding:`5px 8px`,border:`1px solid var(--border)`,borderRadius:7,background:`var(--bg)`,color:`var(--text)`,fontSize:`var(--text-lg)`,fontVariantNumeric:`tabular-nums`,outline:`none`}}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:`px`}),(0,L.jsx)(fT,{label:o(`layout.widthReset`,{value:i}),children:(0,L.jsx)(_T,{label:o(`layout.widthReset`,{value:i}),onClick:()=>t(i)})})]})}function Jse({value:e,onChange:t,t:n}){return(0,L.jsx)(bT,{tooltip:!0,value:e,onChange:t,parse:NC,min:0,max:20,defaultValue:0,t:n,labelKey:`theme.recentBlocksExpanded`,unitText:n(`longBlock.blocks`),rangeText:n(`recentBlocks.range`),resetText:n(`recentBlocks.reset`,{n:0})})}function Yse(e,t){let n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){if(!(e.nodeValue??``).trim())return NodeFilter.FILTER_REJECT;let n=e.parentElement;if(!n)return NodeFilter.FILTER_REJECT;let r=n.tagName;return r===`SCRIPT`||r===`STYLE`||r===`NOSCRIPT`||t?.(e)===!0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),i=r.nextNode();for(;i;)n.push(i),i=r.nextNode();return n}function Xse(e,t){let n=Yse(e,t),r=[],i=[],a=0;for(let e of n)i.push(a),r.push(e.nodeValue??``),a+=e.nodeValue?.length??0;return{text:r.join(``),nodes:n,starts:i}}function wT(e,t){let n=0,r=e.starts.length-1;for(;n<r;){let i=n+r+1>>1;e.starts[i]<=t?n=i:r=i-1}return{node:e.nodes[n],offset:t-e.starts[n]}}function TT(e,t,n){let r=Xse(e,n),i=r.text.toLowerCase(),a=t.toLowerCase();if(!a)return[];let o=[],s=i.indexOf(a);for(;s!==-1&&o.length<1e4;){let e=document.createRange(),t=wT(r,s),n=wT(r,s+a.length);e.setStart(t.node,t.offset),e.setEnd(n.node,n.offset),o.push(e),s=i.indexOf(a,s+a.length)}return o}function ET(){return typeof CSS<`u`&&`highlights`in CSS}var DT=`config-find-hits`,Zse=`config-pane-`,Qse=250,$se=`[data-tab-id="config"]`;function OT(e,t,n,r){return{x:Math.min(Math.max(4,e),Math.max(4,r.w-n.w-4)),y:Math.min(Math.max(4,t),Math.max(4,r.h-n.h-4))}}function ece({open:e,query:t,onQueryChange:n,onClose:r,contentRef:i,onCountsChange:a,reindexKey:o}){let{t:s}=z(),c=(0,I.useRef)(null),l=(0,I.useRef)(null),[u,d]=(0,I.useState)(0),f=t.trim(),p=(0,I.useRef)(null),m=(0,I.useRef)(null);return(0,I.useLayoutEffect)(()=>{if(!e){p.current=null;return}let t=l.current,n=t?.offsetParent;if(t&&n&&n.offsetWidth>0){let e=n.getBoundingClientRect(),r=document.querySelector($se),i,a;if(r){let t=r.getBoundingClientRect();i=t.right-e.left+12,a=t.bottom-e.top+6}else i=e.width-t.offsetWidth-12,a=8;let o=OT(i,a,{w:t.offsetWidth,h:t.offsetHeight},{w:e.width,h:e.height});t.style.left=`${o.x}px`,t.style.top=`${o.y}px`,t.style.visibility=`visible`,p.current=o}c.current?.focus()},[e]),(0,I.useEffect)(()=>{let t=i.current;if(!e||!t||f.length<2){ET()&&CSS.highlights.delete(DT),d(0),a(null);return}let n=!1,r=0,o=()=>{if(n)return;let e=TT(t,f),r={};for(let t of e){let e=t.startContainer,n=((e.nodeType===Node.TEXT_NODE?e.parentElement:e)?.closest(`[data-testid^="${Zse}"]`))?.getAttribute(`data-testid`)?.slice(12);n&&(r[n]=(r[n]??0)+1)}ET()&&CSS.highlights.set(DT,new Highlight(...e)),d(e.length),a(r)};o();let s=new MutationObserver(()=>{window.clearTimeout(r),r=window.setTimeout(o,Qse)});return s.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{n=!0,window.clearTimeout(r),s.disconnect(),ET()&&CSS.highlights.delete(DT)}},[e,f,o,i,a]),e?(0,L.jsxs)(`div`,{ref:l,className:`config-find-bar`,role:`search`,"data-testid":`config-find-bar`,style:{visibility:`hidden`},onPointerDown:e=>{e.target.closest(`input,button`)||p.current&&(e.currentTarget.setPointerCapture(e.pointerId),m.current={client:{x:e.clientX,y:e.clientY},start:p.current})},onPointerMove:e=>{let t=m.current,n=l.current,r=n?.offsetParent;if(!t||!n||!r)return;let i=r.getBoundingClientRect(),a=OT(t.start.x+e.clientX-t.client.x,t.start.y+e.clientY-t.client.y,{w:n.offsetWidth,h:n.offsetHeight},{w:i.width,h:i.height});n.style.left=`${a.x}px`,n.style.top=`${a.y}px`,p.current=a},onPointerUp:e=>{m.current=null,e.currentTarget.releasePointerCapture(e.pointerId)},children:[(0,L.jsx)(`span`,{className:`config-find-grip`,"aria-hidden":`true`,children:(0,L.jsx)(cse,{size:B.base})}),(0,L.jsx)(`input`,{ref:c,className:`file-find-input`,"data-testid":`config-find-input`,type:`text`,value:t,placeholder:s(`config.search.placeholder`),"aria-label":s(`config.search.open`),onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),r())}}),(0,L.jsx)(`span`,{className:`file-find-count`,"data-testid":`config-find-count`,children:f.length>=2?u>0?s(`config.search.matchCount`,{count:u}):s(`config.search.noResults`):``}),(0,L.jsx)(`button`,{type:`button`,className:`file-find-btn`,"aria-label":s(`i18n.close`),onClick:r,children:(0,L.jsx)(cT,{size:B.base})})]}):null}var tce=`codemode`,nce=`tool_search`,rce=[`grep`,`find`,`ls`,`powershell`];function kT({names:e,selected:t,onToggle:n,disabled:r}){let{t:i}=z();return(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:e.map(e=>{let a=t.includes(e),o=i(`preferences.defaultTools.toolDesc.${e}`);return(0,L.jsx)(fT,{label:o,children:(0,L.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>n(e),style:{padding:`3px 10px`,borderRadius:999,border:`1px solid ${a?`var(--accent)`:`var(--border)`}`,background:a?`color-mix(in srgb, var(--accent) 12%, transparent)`:`transparent`,color:a?`var(--accent)`:`var(--text-dim)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,cursor:r?`not-allowed`:`pointer`},children:e})},e)})})}function AT(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=AT(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function jT(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=AT(e))&&(r&&(r+=` `),r+=t);return r}var MT=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,NT=jT,PT=(e,t)=>n=>{if(t?.variants==null)return NT(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=MT(t)||MT(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 NT(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)},ice=Object.defineProperty,FT=(e,t)=>ice(e,`name`,{value:t,configurable:!0});function IT(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}FT(IT,`setRef`);function LT(...e){return t=>{let n=!1,r=e.map(e=>{let r=IT(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():IT(e[t],null)}}}}FT(LT,`composeRefs`);function RT(...e){return I.useCallback(LT(...e),e)}FT(RT,`useComposedRefs`);var ace=Object.defineProperty,zT=(e,t)=>ace(e,`name`,{value:t,configurable:!0});function BT(e){let t=I.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];KT(r)&&typeof JT==`function`&&(r=JT(r._payload)),I.Children.forEach(r,e=>{if(GT(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;KT(n)&&typeof JT==`function`&&(n=JT(n._payload)),a=sce(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=I.cloneElement(a,void 0,s):!o&&I.Children.count(r)===1&&I.isValidElement(r)&&(a=r);let c=a?WT(a):void 0,l=RT(n,c);if(!a){if(r||r===0)throw Error(o?uce(e):lce(e));return r}let u=UT(i,a.props??{});return a.type!==I.Fragment&&(u.ref=n?l:c),I.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}zT(BT,`createSlot`);var VT=BT(`Slot`),HT=Symbol.for(`radix.slottable`);function oce(e){let t=zT(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=HT,t}zT(oce,`createSlottable`);var sce=zT((e,t)=>{if(`child`in e.props){let t=e.props.child;return I.isValidElement(t)?I.cloneElement(t,void 0,e.props.children(t.props.children)):null}return I.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function UT(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}zT(UT,`mergeProps`);function WT(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}zT(WT,`getElementRef`);function GT(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===HT}zT(GT,`isSlottable`);var cce=Symbol.for(`react.lazy`);function KT(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===cce&&`_payload`in e&&qT(e._payload)}zT(KT,`isLazyComponent`);function qT(e){return typeof e==`object`&&!!e&&`then`in e}zT(qT,`isPromiseLike`);var lce=zT(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),uce=zT(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),JT=I.use,dce=Object.defineProperty,fce=(e,t)=>dce(e,`name`,{value:t,configurable:!0}),YT=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=BT(`Primitive.${t}`),r=I.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,L.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function XT(e,t){e&&P_.flushSync(()=>e.dispatchEvent(t))}fce(XT,`dispatchDiscreteCustomEvent`);var pce=Object.defineProperty,ZT=(e,t)=>pce(e,`name`,{value:t,configurable:!0});function mce(e,t){let n=I.createContext(t);n.displayName=e+`Context`;let r=ZT(e=>{let{children:t,...r}=e,i=I.useMemo(()=>r,Object.values(r));return(0,L.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=I.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return ZT(i,`useContext`),[r,i]}ZT(mce,`createContext`);function QT(e,t=[]){let n=[];function r(t,r){let i=I.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=ZT(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=I.useMemo(()=>o,Object.values(o));return(0,L.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=I.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return ZT(s,`useContext`),[o,s]}ZT(r,`createContext`);let i=ZT(()=>{let t=n.map(e=>I.createContext(e));return ZT(function(n){let r=n?.[e]||t;return I.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,$T(i,...t)]}ZT(QT,`createContextScope`);function $T(...e){let t=e[0];if(e.length===1)return t;let n=ZT(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return ZT(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}ZT($T,`composeContextScopes`);var hce=Object.defineProperty,eE=(e,t)=>hce(e,`name`,{value:t,configurable:!0}),tE=!!(typeof window<`u`&&window.document&&window.document.createElement);function nE(e,t,{checkForDefaultPrevented:n=!0}={}){return eE(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}eE(nE,`composeEventHandlers`);function gce(e){if(!tE)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}eE(gce,`getOwnerWindow`);function rE(e){if(!tE)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}eE(rE,`getOwnerDocument`);function iE(e,t=!1){let{activeElement:n}=rE(e);if(!n?.nodeName)return null;if(aE(n)&&n.contentDocument)return iE(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=rE(n).getElementById(e);if(t)return t}}return n}eE(iE,`getActiveElement`);function aE(e){return e.tagName===`IFRAME`}eE(aE,`isFrame`);var oE=globalThis?.document?I.useLayoutEffect:()=>{},_ce=Object.defineProperty,vce=(e,t)=>_ce(e,`name`,{value:t,configurable:!0}),sE=I.useEffectEvent,cE=I.useInsertionEffect;function lE(e){if(typeof sE==`function`)return sE(e);let t=I.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof cE==`function`?cE(()=>{t.current=e}):oE(()=>{t.current=e}),I.useMemo(()=>((...e)=>t.current?.(...e)),[])}vce(lE,`useEffectEvent`);var yce=Object.defineProperty,uE=(e,t)=>yce(e,`name`,{value:t,configurable:!0}),bce=I.useInsertionEffect||oE;function dE({prop:e,defaultProp:t,onChange:n=uE(()=>{},`onChange`),caller:r}){let[i,a,o]=fE({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,I.useCallback(t=>{if(s){let n=pE(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}uE(dE,`useControllableState`);function fE({defaultProp:e,onChange:t}){let[n,r]=I.useState(e),i=I.useRef(n),a=I.useRef(t);return bce(()=>{a.current=t},[t]),I.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}uE(fE,`useUncontrolledState`);function pE(e){return typeof e==`function`}uE(pE,`isFunction`);var mE=Symbol(`RADIX:SYNC_STATE`);function xce(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=lE(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=I.useReducer((t,n)=>{if(n.type===mE)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=I.useRef(p);I.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=I.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return I.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:mE,state:i})},[i,d.state,c]),[h,f]}uE(xce,`useControllableStateReducer`);var Sce=Object.defineProperty,hE=(e,t)=>Sce(e,`name`,{value:t,configurable:!0});function gE(e,t){return I.useReducer((e,n)=>t[e][n]??e,e)}hE(gE,`useStateMachine`);var _E=hE(e=>{let{present:t,children:n}=e,r=vE(t),i=typeof n==`function`?n({present:r.isPresent}):I.Children.only(n),a=bE(r.ref,SE(i));return typeof n==`function`||r.isPresent?I.cloneElement(i,{ref:a}):null},`Presence`);function vE(e){let[t,n]=I.useState(),r=I.useRef(null),i=I.useRef(e),a=I.useRef(`none`),o=I.useRef(void 0),[s,c]=gE(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return I.useEffect(()=>{s===`mounted`?(a.current=o.current??xE(r.current),o.current=void 0):a.current=`none`},[s]),oE(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=xE(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),oE(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=hE(a=>{let o=xE(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=hE(e=>{e.target===t&&(a.current=xE(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:I.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=xE(t)}else r.current=null;n(e)},[])}}hE(vE,`usePresence`);function yE(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}hE(yE,`setRef`);function bE(...e){let t=I.useRef(e);return t.current=e,I.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=yE(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():yE(n[e],null)}}},[])}hE(bE,`useStableComposedRefs`);function xE(e){return e?.animationName||`none`}hE(xE,`getAnimationName`);function SE(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}hE(SE,`getElementRef`);var Cce=Object.defineProperty,wce=(e,t)=>Cce(e,`name`,{value:t,configurable:!0}),Tce=I.useId||(()=>void 0),Ece=0;function CE(e){let[t,n]=I.useState(Tce());return oE(()=>{e||n(e=>e??String(Ece++))},[e]),e||(t?`radix-${t}`:``)}wce(CE,`useId`);var Dce=Object.defineProperty,wE=(e,t)=>Dce(e,`name`,{value:t,configurable:!0}),TE=`Collapsible`,[Oce,kce]=QT(TE),[Ace,EE]=Oce(TE),jce=I.forwardRef(wE(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=dE({prop:r,defaultProp:i??!1,onChange:o,caller:TE});return(0,L.jsx)(Ace,{scope:n,disabled:a,contentId:CE(),open:c,onOpenToggle:I.useCallback(()=>l(e=>!e),[l]),children:(0,L.jsx)(YT.div,{"data-state":OE(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),Mce=`CollapsibleTrigger`,Nce=I.forwardRef(wE(function(e,t){let{__scopeCollapsible:n,...r}=e,i=EE(Mce,n);return(0,L.jsx)(YT.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":OE(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:nE(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),DE=`CollapsibleContent`,Pce=I.forwardRef(wE(function(e,t){let{forceMount:n,...r}=e,i=EE(DE,e.__scopeCollapsible);return(0,L.jsx)(_E,{present:n||i.open,children:({present:e})=>(0,L.jsx)(Fce,{...r,ref:t,present:e})})},`CollapsibleContent`)),Fce=I.forwardRef(wE(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=EE(DE,n),[s,c]=I.useState(r),l=I.useRef(null),u=RT(t,l),d=I.useRef(0),f=d.current,p=I.useRef(0),m=p.current,h=o.open||s,g=I.useRef(h),_=I.useRef(void 0);return I.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),oE(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,L.jsx)(YT.div,{"data-state":OE(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})},`CollapsibleContentImpl`));function OE(e){return e?`open`:`closed`}wE(OE,`getState`);var Ice=jce,Lce=Object.defineProperty,Rce=(e,t)=>Lce(e,`name`,{value:t,configurable:!0});function kE(e){let t=I.useRef(e);return I.useEffect(()=>{t.current=e}),I.useMemo(()=>((...e)=>t.current?.(...e)),[])}Rce(kE,`useCallbackRef`);var zce=Object.defineProperty,AE=(e,t)=>zce(e,`name`,{value:t,configurable:!0}),jE=`dismissableLayer.update`,Bce=`dismissableLayer.pointerDownOutside`,Vce=`dismissableLayer.focusOutside`,ME,NE=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Hce=I.forwardRef(AE(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=I.useContext(NE),[d,f]=I.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=I.useState({}),h=RT(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=I.useRef(!1),C=FE(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:I.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=IE(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=kE(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return I.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),I.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ME=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),LE(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=ME))}},[d,p,n,u]),I.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),LE())},[d,u]),I.useEffect(()=>{let e=AE(()=>m({}),`handleUpdate`);return document.addEventListener(jE,e),()=>document.removeEventListener(jE,e)},[]),(0,L.jsx)(YT.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:nE(e.onFocusCapture,w.onFocusCapture),onBlurCapture:nE(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:nE(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function PE(){let e=I.useContext(NE),[t,n]=I.useState(null);return I.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}AE(PE,`useDismissableLayerSurface`);var Uce=AE(()=>!0,`IS_TRUE`);function FE(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Uce}=t,s=kE(e),c=I.useRef(!1),l=I.useRef(!1),u=I.useRef(new Map),d=I.useRef(()=>{});return I.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}AE(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}AE(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}AE(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}AE(p,`handleInteractionBubble`);let m=AE(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||RE(Bce,s,p,{discrete:!0})};if(AE(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:AE(()=>c.current=!0,`onPointerDownCapture`)}}AE(FE,`usePointerDownOutside`);function IE(e,t=globalThis?.document){let n=kE(e),r=I.useRef(!1);return I.useEffect(()=>{let e=AE(e=>{e.target&&!r.current&&RE(Vce,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:AE(()=>r.current=!0,`onFocusCapture`),onBlurCapture:AE(()=>r.current=!1,`onBlurCapture`)}}AE(IE,`useFocusOutside`);function LE(){let e=new CustomEvent(jE);document.dispatchEvent(e)}AE(LE,`dispatchUpdate`);function RE(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?XT(i,a):i.dispatchEvent(a)}AE(RE,`handleAndDispatchCustomEvent`);var Wce=Object.defineProperty,zE=(e,t)=>Wce(e,`name`,{value:t,configurable:!0}),BE=`focusScope.autoFocusOnMount`,VE=`focusScope.autoFocusOnUnmount`,HE={bubbles:!1,cancelable:!0},Gce=I.forwardRef(zE(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=I.useState(null),l=kE(i),u=kE(a),d=I.useRef(null),f=RT(t,c),p=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:YE(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||YE(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&YE(s)};zE(e,`handleFocusIn`),zE(t,`handleFocusOut`),zE(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),I.useEffect(()=>{if(s){XE.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(BE,HE);s.addEventListener(BE,l),s.dispatchEvent(t),t.defaultPrevented||(UE($E(GE(s)),{select:!0}),document.activeElement===e&&YE(s))}return()=>{s.removeEventListener(BE,l),setTimeout(()=>{let t=new CustomEvent(VE,HE);s.addEventListener(VE,u),s.dispatchEvent(t),t.defaultPrevented||YE(e??document.body,{select:!0}),s.removeEventListener(VE,u),XE.remove(p)},0)}}},[s,l,u,p]);let m=I.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=WE(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&YE(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&YE(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,L.jsx)(YT.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function UE(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(YE(r,{select:t}),document.activeElement!==n)return}zE(UE,`focusFirst`);function WE(e){let t=GE(e);return[KE(t,e),KE(t.reverse(),e)]}zE(WE,`getTabbableEdges`);function GE(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:zE(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}zE(GE,`getTabbableCandidates`);function KE(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):qE(r,{upTo:t})))return r}zE(KE,`findVisible`);function qE(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}zE(qE,`isHidden`);function JE(e){return e instanceof HTMLInputElement&&`select`in e}zE(JE,`isSelectableInput`);function YE(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&JE(e)&&t&&e.select()}}zE(YE,`focus`);var XE=ZE();function ZE(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=QE(e,t),e.unshift(t)},remove(t){e=QE(e,t),e[0]?.resume()}}}zE(ZE,`createFocusScopesStack`);function QE(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}zE(QE,`arrayRemove`);function $E(e){return e.filter(e=>e.tagName!==`A`)}zE($E,`removeLinks`);var Kce=Object.defineProperty,qce=I.forwardRef(((e,t)=>Kce(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=I.useState(!1);oE(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?P_.createPortal((0,L.jsx)(YT.div,{...r,ref:t}),o):null},`Portal`)),Jce=Object.defineProperty,eD=(e,t)=>Jce(e,`name`,{value:t,configurable:!0}),tD=0,nD=null;function Yce(e){return rD(),e.children}eD(Yce,`FocusGuards`);function rD(){I.useEffect(()=>{nD||={start:iD(),end:iD()};let{start:e,end:t}=nD;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),tD++,()=>{tD===1&&(nD?.start.remove(),nD?.end.remove(),nD=null),tD=Math.max(0,tD-1)}},[])}eD(rD,`useFocusGuards`);function iD(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}eD(iD,`createFocusGuard`);var aD=function(){return aD=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},aD.apply(this,arguments)};function oD(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Xce(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var sD=`right-scroll-bar-position`,cD=`width-before-scroll-bar`,Zce=`with-scroll-bars-hidden`,Qce=`--removed-body-scroll-bar-size`;function lD(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function $ce(e,t){var n=(0,I.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var ele=typeof window<`u`?I.useLayoutEffect:I.useEffect,uD=new WeakMap;function tle(e,t){var n=$ce(t||null,function(t){return e.forEach(function(e){return lD(e,t)})});return ele(function(){var t=uD.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||lD(e,null)}),i.forEach(function(e){r.has(e)||lD(e,a)})}uD.set(n,e)},[e]),n}function nle(e){return e}function rle(e,t){t===void 0&&(t=nle);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function ile(e){e===void 0&&(e={});var t=rle(null);return t.options=aD({async:!0,ssr:!1},e),t}var dD=function(e){var t=e.sideCar,n=oD(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return I.createElement(r,aD({},n))};dD.isSideCarExport=!0;function ale(e,t){return e.useMedium(t),dD}var fD=ile(),pD=function(){},mD=I.forwardRef(function(e,t){var n=I.useRef(null),r=I.useState({onScrollCapture:pD,onWheelCapture:pD,onTouchMoveCapture:pD}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=oD(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=tle([n,t]),C=aD(aD({},b),i);return I.createElement(I.Fragment,null,u&&I.createElement(x,{sideCar:fD,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?I.cloneElement(I.Children.only(s),aD(aD({},C),{ref:S})):I.createElement(v,aD({},C,{className:c,ref:S}),s))});mD.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},mD.classNames={fullWidth:cD,zeroRight:sD};var ole=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function sle(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=ole();return t&&e.setAttribute(`nonce`,t),e}function cle(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function lle(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ule=function(){var e=0,t=null;return{add:function(n){e==0&&(t=sle())&&(cle(t,n),lle(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},dle=function(){var e=ule();return function(t,n){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},hD=function(){var e=dle();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},fle={left:0,top:0,right:0,gap:0},gD=function(e){return parseInt(e||``,10)||0},ple=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[gD(n),gD(r),gD(i)]},mle=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return fle;var t=ple(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hle=hD(),_D=`data-scroll-locked`,gle=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
@@ -537,7 +537,7 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
537
537
  ${c.toFixed(0)}% / ${_X(a.contextWindow)}`:``,u=o(e?`chat.stopCompaction`:`chat.compactContext`)+l;return(0,L.jsx)(`div`,{children:(0,L.jsx)(fT,{label:u,children:(0,L.jsx)(`button`,{onClick:e?i:r,disabled:s,"aria-label":u,style:XPe(e,s,n),className:s?void 0:`hover-shift`,children:e?(0,L.jsx)(rT,{size:B.xs,fill:`currentColor`}):(0,L.jsx)(fX,{percent:a?.percent??null,size:B.base,color:`var(--text)`})})})})}function QPe({anchor:e,text:t,images:n,actions:r,onHoverEnter:i,onHoverLeave:a,onClose:o,onImageClick:s}){let c=(0,I.useRef)(null);return(0,I.useLayoutEffect)(()=>{let t=c.current;if(!(!t||typeof t.showPopover!=`function`))try{t.showPopover({source:e})}catch{}},[]),(0,L.jsxs)(`div`,{ref:c,popover:`hint`,role:`dialog`,"aria-modal":`false`,"data-testid":`user-message-tooltip`,onToggle:e=>{e.newState===`closed`&&o()},onKeyDown:e=>{e.key===`Escape`&&e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),onMouseEnter:i,onMouseLeave:a,style:{position:`fixed`,positionArea:`bottom span-left`,justifySelf:`end`,margin:`6px 0 0`,positionTryFallbacks:`flip-block`,width:`min(640px, calc(100vw - 32px))`,maxHeight:`calc(100dvh - 220px)`,display:`flex`,flexDirection:`column`,minWidth:0,padding:`10px 12px`,background:`#ffffff`,color:`#1f2328`,"--text":`#1f2328`,"--text-dim":`#57606a`,border:`1px solid rgba(27, 31, 36, 0.12)`,borderRadius:12,boxShadow:`0 8px 16px rgba(0, 0, 0, 0.18), 0 16px 48px -8px rgba(0, 0, 0, 0.38)`},children:[(0,L.jsxs)(`div`,{"data-testid":`user-message-tooltip-body`,style:{overflowY:`auto`,flexShrink:1,minHeight:0,maxHeight:`min(360px, calc(100dvh - 280px))`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontSize:`var(--text-base)`,fontFamily:`var(--font-mono)`,lineHeight:1.6,color:`var(--text)`},children:[t||null,(n??[]).map((e,n)=>(0,L.jsx)(`img`,{"data-testid":`user-message-tooltip-image`,src:e,alt:``,role:s?`button`:void 0,onClick:s?()=>s(e):void 0,style:{display:`block`,maxWidth:`100%`,maxHeight:320,objectFit:`contain`,borderRadius:4,marginTop:t?8:0,cursor:s?`zoom-in`:`default`}},n))]}),r?(0,L.jsx)(`div`,{"data-testid":`user-message-tooltip-footer`,style:{flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`flex-end`,gap:4,marginTop:8,paddingTop:8,borderTop:`1px solid rgba(27, 31, 36, 0.12)`},children:r}):null]})}function xX({text:e,fullText:t,images:n,tooltipActions:r,capsule:i=!0,alignRight:a=!0}){let o=(0,I.useRef)(void 0),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(null),[d,f]=(0,I.useState)(null),p=(0,I.useCallback)(e=>{u(e)},[]),m=(0,I.useCallback)(()=>{o.current!==void 0&&clearTimeout(o.current)},[]),h=(0,I.useCallback)(()=>{o.current!==void 0&&clearTimeout(o.current),o.current=setTimeout(()=>c(!1),160)},[]),g=(0,I.useCallback)(()=>{o.current!==void 0&&clearTimeout(o.current),c(!0)},[]);return(0,I.useEffect)(()=>()=>{o.current!==void 0&&clearTimeout(o.current)},[]),(0,L.jsxs)(`div`,{ref:p,"data-slot":`user-message-tooltip-anchor`,onMouseEnter:g,onMouseLeave:h,style:{display:`flex`,minWidth:0,flexShrink:1,...a?{marginLeft:`auto`}:null,justifyContent:`flex-end`,maxWidth:`100%`,overflow:`hidden`},children:[e||n?.length?(0,L.jsxs)(`span`,{"data-testid":`turn-preview-header-capsule`,style:{display:`inline-flex`,alignItems:`center`,gap:5,minWidth:0,maxWidth:`100%`,...i?{padding:`3px 8px`,borderRadius:8,background:`var(--user-bg)`,border:`1px solid color-mix(in srgb, var(--accent) 20%, transparent)`,fontSize:`var(--text-base)`,fontFamily:`var(--font-mono)`,lineHeight:1.6,color:`var(--text)`}:null},children:[n?.map((e,t)=>(0,L.jsx)(`span`,{"data-testid":`turn-preview-header-image`,"aria-hidden":!0,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:18,height:18,flexShrink:0,borderRadius:5,background:`color-mix(in srgb, var(--accent) 15%, transparent)`,color:`var(--text-dim)`},children:(0,L.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,L.jsx)(`circle`,{cx:`5.5`,cy:`6.5`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,L.jsx)(`path`,{d:`M2.5 12l3.5-3.5 2.5 2.5 2-2 3 3`})]})},t)),e?(0,L.jsx)(`span`,{"data-testid":`turn-preview-header-text`,style:{display:`block`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e}):null]}):null,s&&d===null&&l?(0,L.jsx)(QPe,{anchor:l,text:t??e,images:n,actions:r,onHoverEnter:m,onHoverLeave:h,onClose:()=>c(!1),onImageClick:f}):null,d?(0,L.jsx)(sX,{src:d,name:``,onClose:()=>f(null)}):null]})}function SX({active:e,label:t,desc:n}){return(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,color:e?`var(--text)`:`var(--text-muted)`,fontSize:`var(--text-base)`,textAlign:`left`,fontWeight:e?600:400,whiteSpace:`nowrap`},children:[e?(0,L.jsx)(Tw,{size:B.xs,strokeWidth:4.8,style:{flexShrink:0}}):(0,L.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,L.jsx)(`span`,{style:{flex:1},children:t}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,marginLeft:8},children:n})]})}function CX({kind:e,text:t,onWithdraw:n}){let{t:r}=z(),i=r(e===`steer`?`chat.queueSteer`:`chat.queueFollowUp`),a={flexShrink:0,fontSize:`var(--text-xs)`,fontFamily:`var(--font-mono)`,padding:`1px 7px`,borderRadius:999,border:`1px solid ${e===`steer`?`color-mix(in srgb, var(--accent) 45%, transparent)`:`var(--border)`}`,color:e===`steer`?`var(--accent)`:`var(--text-dim)`,background:`transparent`};return(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`3px 10px`,fontSize:`var(--text-base)`,color:`var(--text-muted)`,minWidth:0,flex:1},children:[n?(0,L.jsx)(fT,{label:r(`chat.queueWithdrawHint`),wrapperStyle:{display:`flex`,flexShrink:0},children:(0,L.jsx)(`button`,{type:`button`,"data-testid":`queue-withdraw`,onClick:n,style:{...a,cursor:`pointer`},children:i})}):(0,L.jsx)(`span`,{style:a,children:i}),(0,L.jsx)(xX,{text:t,capsule:!1,alignRight:!1})]})}function $Pe({queuedMessages:e,onRecallQueue:t,onWithdrawQueuedMessage:n}){let{t:r}=z(),i=(e?.steering.length??0)+(e?.followUp.length??0);return i===0?null:(0,L.jsxs)(`div`,{"data-testid":`queue-panel`,style:{marginBottom:8,border:`1px solid var(--border)`,borderRadius:6,background:`var(--bg-panel)`,padding:`5px 0`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,padding:`2px 8px 4px 10px`},children:[(0,L.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,fontFamily:`var(--font-mono)`,color:`var(--text-dim)`,textTransform:`uppercase`,letterSpacing:.4},children:r(`chat.queued`,{count:i})}),t&&(0,L.jsx)(fT,{label:r(`chat.recallTitle`),children:(0,L.jsxs)(`button`,{"data-testid":`queue-recall`,onClick:t,style:{display:`flex`,alignItems:`center`,gap:6,padding:`4px 12px`,fontSize:`var(--text-base)`,color:`var(--text)`,border:`1px solid var(--border)`,borderRadius:7,cursor:`pointer`,whiteSpace:`nowrap`},children:[(0,L.jsx)($oe,{size:B.lg}),r(`chat.recall`)]})})]}),e?.steering.map((e,t)=>(0,L.jsx)(CX,{kind:`steer`,text:e,onWithdraw:n?()=>n(`steering`,t):void 0},`steer-${t}`)),e?.followUp.map((e,t)=>(0,L.jsx)(CX,{kind:`follow-up`,text:e,onWithdraw:n?()=>n(`followUp`,t):void 0},`followup-${t}`))]})}function eFe({text:e}){return e?(0,L.jsxs)(`div`,{style:{marginBottom:8,padding:`5px 10px`,background:`color-mix(in srgb, var(--status-success) 8%, transparent)`,border:`1px solid color-mix(in srgb, var(--status-success) 24%, transparent)`,borderRadius:6,fontSize:`var(--text-base)`,color:`color-mix(in srgb, var(--status-success) 95%, transparent)`,display:`flex`,alignItems:`center`,gap:6},children:[(0,L.jsx)(Tw,{size:B.sm,style:{flexShrink:0}}),e]}):null}function tFe({isMobile:e,isStreaming:t,thinkingLevel:n,thinkingDisplayLabel:r,onThinkingLevelChange:i,availableThinkingLevels:a,thinkingLevelMap:o,thinkingMapConfirm:s,setThinkingMapConfirm:c,model:l,onOpenModelConfig:u}){let{t:d}=z(),[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(``),g=(0,I.useRef)(null),_=bde.filter(e=>!a||e===`auto`||a.includes(e)).map(e=>{let t=(n??`auto`)===e,r=d($k[e]),a=e!==`auto`&&o?o[e]:void 0,s=a!=null&&a!==e?a:e,l=a!=null&&a!==e;return{key:e,searchText:`${e} ${s} ${r}`,content:(0,L.jsx)(SX,{active:t,label:(0,L.jsxs)(L.Fragment,{children:[s,l&&(0,L.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,fontFamily:`var(--font-mono)`,marginLeft:5},children:[`(`,e,`)`]})]}),desc:r}),onSelect:()=>{if(p(!1),!t){if((e===`xhigh`||e===`max`)&&!o?.[e]){c(e);return}i?.(e)}}}});return(0,L.jsxs)(L.Fragment,{children:[i&&(0,L.jsxs)(`div`,{style:{position:`relative`},children:[(0,L.jsx)(fT,{label:`${d(`chat.currentReasoning`,{level:r})} ${d($k[n??`auto`])}`,children:(0,L.jsxs)(`button`,{ref:g,onClick:()=>!t&&p(e=>!e),disabled:t,"aria-label":d(`chat.changeReasoningLabel`),"aria-expanded":f,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,padding:`0 6px`,width:e?`auto`:void 0,height:28,background:f?`var(--bg-hover)`:`none`,border:`none`,borderRadius:7,color:`var(--text-muted)`,cursor:t?`not-allowed`:`pointer`,fontSize:`var(--text-sm)`,opacity:t?.5:1,transition:`background 0.12s, color 0.12s`,"--hover-bg":`transparent`,"--hover-color":`var(--text)`},className:t?void 0:`hover-shift`,children:[(0,L.jsx)(Bw,{size:B.base,fill:`currentColor`,style:{color:`var(--bulb-warning)`,flexShrink:0}}),e?null:(0,L.jsx)(`span`,{style:{whiteSpace:`nowrap`},children:r})]})}),f&&(0,L.jsx)(fA,{source:g.current,searchable:!1,filter:m,setFilter:h,close:()=>p(!1),items:_,emptyText:``,noMatchText:``,filterPlaceholder:``})]}),s&&l&&(0,L.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:1e3,background:`rgba(0, 0, 0, 0.45)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,L.jsxs)(`div`,{role:`alertdialog`,"aria-modal":`true`,style:{background:`var(--bg-panel)`,border:`1px solid var(--border)`,borderRadius:10,boxShadow:`0 12px 40px var(--shadow-color)`,width:`min(420px, calc(100vw - 32px))`,maxHeight:`calc(100dvh - 32px)`,overflowY:`auto`,padding:18},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xl)`,fontWeight:600,color:`var(--text)`,marginBottom:8},children:d(`chat.thinkingMapTitle`)}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text-muted)`,lineHeight:1.7,marginBottom:16},children:d(`chat.thinkingMapBody`,{level:s})}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8},children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>c(null),style:{padding:`5px 14px`,background:`var(--bg-panel)`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,fontSize:`var(--text-base)`,cursor:`pointer`},children:d(`chat.cancel`)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{u?.({provider:l.provider,modelId:l.modelId}),c(null)},style:{padding:`5px 14px`,background:`var(--accent)`,border:`none`,borderRadius:6,color:`var(--on-accent, #fff)`,fontSize:`var(--text-base)`,fontWeight:600,cursor:`pointer`},children:d(`chat.thinkingMapGo`)})]})]})})]})}function nFe(e){return e?`var(--status-warning)`:`var(--status-info)`}function rFe(e,t,n){return e?`\n${t({actual:e.length>0?e.join(`, `):n})}`:``}function iFe({isMobile:e,isStreaming:t,toolPreset:n,toolPresets:r=eq(QK,XK),toolPresetLabel:i,driftActualTools:a=null,onToolPresetChange:o}){let{t:s,locale:c}=z(),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(``),p=(0,I.useRef)(null),m=e=>(e.description?qC(e.description,c):void 0)??(e.tools.length===0?s(`chat.noTools`):e.tools.join(`, `)),h=r.find(e=>(n??`default`)===e.name),g=rFe(a,e=>s(`chat.toolPresetDrift`,e),s(`chat.noTools`)),_=nFe(!!a),v=r.map(e=>{let t=(n??`default`)===e.name,r=m(e),i=e.tools.length===0?s(`chat.noTools`):e.tools.join(`, `);return{key:e.name,searchText:`${e.name} ${r}`,content:(0,L.jsx)(`div`,{title:i,children:(0,L.jsx)(SX,{active:t,label:e.name,desc:r})}),onSelect:()=>{u(!1),t||o(e.name)}}});return(0,L.jsxs)(`div`,{style:{position:`relative`},children:[(0,L.jsx)(fT,{label:`${s(`chat.currentToolPreset`,{preset:i})}${h?` ${m(h)}`:``}${g}`,children:(0,L.jsxs)(`button`,{ref:p,onClick:()=>!t&&u(e=>!e),disabled:t,"aria-label":s(`chat.changeToolPreset`),"aria-expanded":l,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,padding:`0 6px`,width:e?`auto`:void 0,height:28,background:l?`var(--bg-hover)`:`none`,border:`none`,borderRadius:7,color:`var(--text-muted)`,cursor:t?`not-allowed`:`pointer`,fontSize:`var(--text-sm)`,opacity:t?.5:1,transition:`background 0.12s, color 0.12s`,"--hover-bg":`transparent`,"--hover-color":`var(--text)`},className:t?void 0:`hover-shift`,children:[(0,L.jsx)(sT,{size:B.base,style:{color:_,flexShrink:0}}),e?null:(0,L.jsx)(`span`,{style:{whiteSpace:`nowrap`,color:a?_:void 0},children:i})]})}),l&&(0,L.jsx)(fA,{source:p.current,searchable:!1,filter:d,setFilter:f,close:()=>u(!1),items:v,emptyText:``,noMatchText:``,filterPlaceholder:``})]})}function wX(e,t){requestAnimationFrame(()=>{e&&(e.focus(),t!==void 0&&e.setSelectionRange(t,t),e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)})}function aFe(e){e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)}function oFe(e,t){return Eq(e,t)}function sFe({cwd:e,value:t,setValue:n,textareaRef:r}){let[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(0),u=(0,I.useRef)([]),d=(0,I.useCallback)((t,n)=>{if(!e){a(null);return}let r=n??t.length;a(Sq(t.slice(0,r)))},[e]),f=i?.query??null,{fileIndex:p,fileIndexLoading:m,needsServerSearch:h,serverResultInUse:g,serverMatches:_}=oFe(e,f),v=(0,I.useMemo)(()=>f!==null&&p&&p.cwd===e?wq(p.entries,f):[],[f,p,e]),y=_??v,b=i===null?null:`${i.start}:${+!!i.quoted}:${i.query}`;uT(()=>{if(b===null){s(!1),l(0);return}s(!0),l(0)},[b]);let x=(0,I.useCallback)(e=>{if(!i)return;let o=r.current?.selectionStart??t.length,s=t.slice(0,i.start),c=t.slice(o);i.quoted&&c.startsWith(`"`)&&(c=c.slice(1));let l=oAe(e.path,e.isDir,i.quoted),u=s+l.text+c,d=s.length+l.cursorOffset;n(u),a(Sq(u.slice(0,d))),wX(r.current,d)},[i,t,n,r]);return uT(()=>{c>=y.length&&l(Math.max(0,y.length-1))},[y.length,c]),(0,I.useEffect)(()=>{u.current.length=y.length},[y.length]),(0,I.useEffect)(()=>{o&&u.current[c]?.scrollIntoView({block:`nearest`,inline:`nearest`})},[c,o]),{atQuery:i,setAtQuery:a,atMenuOpen:o,setAtMenuOpen:s,atActiveIndex:c,setAtActiveIndex:l,atItemRefs:u,atMatches:y,fileIndex:p,fileIndexLoading:m,needsServerSearch:h,serverResultInUse:g,updateAtQuery:d,applyAtCompletion:x}}var cFe=100;function lFe(e,t){return!t.open||t.composing?!1:e.key===`ArrowDown`?(e.preventDefault(),t.setActiveIndex(e=>Math.min(Math.max(0,t.items.length-1),e+1)),!0):e.key===`ArrowUp`?(e.preventDefault(),t.setActiveIndex(e=>Math.max(0,e-1)),!0):e.key===`Escape`?(e.preventDefault(),t.setOpen(!1),!0):(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)&&t.items[t.activeIndex]?(e.preventDefault(),t.onSelect(t.items[t.activeIndex]),!0):!1}function uFe(e,t){e.preventDefault(),t.value.trim().length===0&&t.onRecallQueue&&t.queuedCount>0?t.onRecallQueue():t.isStreaming&&(t.onSteer||t.onFollowUp)?t.sendQueued(t.onSteer?`steer`:`followup`):t.handleSend()}function dFe({value:e,isStreaming:t,onAbort:n,onSteer:r,onFollowUp:i,onRecallQueue:a,queuedCount:o,handleSend:s,sendQueued:c,slashPalette:l,atMenuOpen:u,setAtMenuOpen:d,atQuery:f,atMatches:p,atActiveIndex:m,setAtActiveIndex:h,applyAtCompletion:g,isComposingRef:_,lastCompositionEndAtRef:v}){return(0,I.useCallback)(y=>{let b=y.nativeEvent,x=Date.now()-v.current<cFe,S=_.current||b.isComposing||b.keyCode===229,C=()=>y.key===`Enter`&&!y.shiftKey&&(S||x)?(x&&y.preventDefault(),!0):!1,w=()=>u&&f!==null&&!S?lFe(y,{open:u&&f!==null,composing:S,items:p,setOpen:d,activeIndex:m,setActiveIndex:h,onSelect:e=>g(e)}):!1,T=()=>(y.ctrlKey||y.metaKey)&&!y.altKey&&!y.shiftKey&&y.key.toLowerCase()===`s`&&!S&&t&&n!==void 0,E=()=>y.key===`Enter`&&!y.shiftKey,D=()=>y.key===`Enter`&&y.altKey&&!S&&t&&i!==void 0;if(!C()&&!l.handleKeyDown(y)&&!w()){if(T()){y.preventDefault(),n?.();return}if(D()){y.preventDefault(),c(`followup`);return}E()&&(y.preventDefault(),uFe(y,{value:e,isStreaming:t,onSteer:r,onFollowUp:i,onRecallQueue:a,queuedCount:o,sendQueued:c,handleSend:s}))}},[t,r,i,a,o,n,l,c,s,u,d,f,p,m,h,g,e,_,v])}function fFe({dropdownRef:e,modelDropdownPanelRef:t,setModelDropdownOpen:n,setModelFilter:r}){(0,I.useEffect)(()=>{let i=i=>{e.current&&!e.current.contains(i.target)&&t.current&&!t.current.contains(i.target)&&(n(!1),r(``))};return document.addEventListener(`mousedown`,i),()=>document.removeEventListener(`mousedown`,i)},[e,t,n,r])}function pFe({draftKey:e,model:t,modelList:n}){let[r,i]=(0,I.useState)(()=>e?nX(qY(e)?.images):[]),a=(0,I.useRef)(r),o=(0,I.useRef)(0),s=(0,I.useRef)(null);(0,I.useEffect)(()=>{a.current=r});let c=t?n?.find(e=>e.provider===t.provider&&e.id===t.modelId)?.input:void 0,l=(0,I.useCallback)(e=>SPe(c,e),[c]),u=(0,I.useCallback)(async e=>{let t=Math.max(0,10-a.current.length-o.current),n=e.filter(e=>{let t=$Y(e.type);return t!==null&&l(t)}).slice(0,t);if(n.length){o.current+=n.length;try{let e=await Promise.all(n.map(NPe));i(t=>{let n=e.slice(0,Math.max(0,10-t.length));return e.slice(n.length).forEach(rX),[...t,...n]})}finally{o.current-=n.length}}},[l]),d=(0,I.useCallback)(e=>{let t=a.current[e];t?.path&&kPe(t.path),i(t=>{let n=[...t],[r]=n.splice(e,1);return r&&rX(r),n})},[]),f=(0,I.useCallback)(()=>{i(e=>(e.forEach(rX),[]))},[]),p=(0,I.useCallback)(e=>{i(t=>(t.forEach(rX),e))},[]);return(0,I.useEffect)(()=>()=>{a.current.forEach(rX)},[]),{attachedImages:r,attachedImagesRef:a,processAttachments:u,removeImage:d,clearImages:f,resetAttachments:p,visibleAttachKinds:APe.filter(({kind:e})=>l(e)),openFilePicker:(0,I.useCallback)(e=>{let t=s.current;t&&(t.accept=xPe[e],t.click())},[]),fileInputRef:s}}function mFe({draftKey:e,value:t,setValue:n,setAtQuery:r,attachedImages:i,attachedImagesRef:a,clearImages:o,resetAttachments:s,textareaRef:c}){let l=(0,I.useRef)(e),u=(0,I.useRef)(t);(0,I.useEffect)(()=>{u.current=t});let d=(0,I.useCallback)(()=>{n(``),r(null),e&&YY(e),l.current&&l.current!==e&&YY(l.current),o(),c.current&&(c.current.style.height=`auto`)},[o,e,r,n,c]);return(0,I.useEffect)(()=>{!e||l.current!==e||JY(e,{value:t,images:i.map(tX).filter(e=>e!==null)})},[i,e,t]),(0,I.useEffect)(()=>{let t=l.current;if(t===e)return;t&&JY(t,{value:u.current,images:a.current.map(tX).filter(e=>e!==null)});let i=e?qY(e):null;if(l.current=e,n(i?.value??``),r(null),s(nX(i?.images)),e){let t=bPe(e);t!==null&&(n(t),QY(e))}},[e,r,n,s,a]),{clearInput:d}}function hFe({ref:e,textareaRef:t,value:n,setValue:r,setAtQuery:i,processAttachments:a}){(0,I.useImperativeHandle)(e,()=>({insertIfEmpty(e){let a=t.current;(a?a.value:n).trim()||(r(e),i(null),wX(a))},prependText(e){if(!e.trim())return;let a=t.current,o=[e,a?a.value:n].filter(e=>e.trim()).join(`
538
538
 
539
539
  `);r(o),i(null),wX(a,o.length)},appendText(e){if(!e.trim())return;let a=t.current,o=a?a.value:n,s=o.trim()?`${o.replace(/\n+$/,``)}\n${e}`:e;r(s),i(null),wX(a,s.length)},insertText(e){let n=t.current;if(!n){r(t=>t+(t?` `:``)+e);return}let a=n.selectionStart??n.value.length,o=n.selectionEnd??n.value.length,s=n.value.slice(0,a),c=n.value.slice(o),l=s.length>0&&!s.endsWith(` `)?` `:``;r(s+l+e+c),i(null),wX(n,a+l.length+e.length)},fillInput(e){let n=t.current;r(e),i(null),wX(n,e.length)},addImages(e){a(e)}}))}function gFe({value:e,attachedImages:t,isStreaming:n,commandBusy:r,pendingSend:i,draftKey:a,setValue:o,clearInput:s,onSend:c,setPendingSend:l,onSteer:u,onFollowUp:d,onBuiltinCommand:f,onPromptWithStreamingBehavior:p,onAudioUnlock:m}){return{handleSend:(0,I.useCallback)(async()=>{let u=e.trim();if(!u&&!t.length||n||r||i)return;m?.();let d=a??``;if(!t.length&&u.startsWith(`/`)&&f){ZY(d,u),s();let e=await f(u);if(e.handled){e.error&&o(u),QY(d);return}}ZY(d,u),l(!0);let{inline:p,referenceText:h}=iX(t),g=h?u?`${u}\n\n${h}`:h:u;try{await c(g,p.length?p:void 0)&&s()}finally{l(!1),QY(d)}},[e,t,n,r,i,a,f,c,o,l,s,m]),sendQueued:(0,I.useCallback)(n=>{let r=e.trim();if(!r&&!t.length)return;m?.();let{inline:i,referenceText:a}=iX(t),o=a?r?`${r}\n\n${a}`:a:r;if(!o)return;let c=i.length?i:void 0,l=n===`steer`?`steer`:`followUp`;if(o.startsWith(`/`)&&p){p(o,l,c),s();return}n===`steer`&&u?u(o,c):n===`followup`&&d&&d(o,c),s()},[e,t,p,u,d,s,m])}}function _Fe(e){return(e?.steering.length??0)+(e?.followUp.length??0)}function vFe(e,t){return e&&t?.cwd===e?t.values:{}}function yFe(e){return e}var bFe=(0,I.forwardRef)(function({onSend:e,onAbort:t,onSteer:n,onFollowUp:r,isStreaming:i,model:a,isAutoModelSelection:o,modelNames:s,modelList:c,modelError:l,modelScopeWarnings:u,onModelChange:d,onCompact:f,onAbortCompaction:p,statusHint:m,displayContextUsage:h,isCompacting:g,compactResult:_,toolPreset:v,toolPresets:y,toolPresetDrift:b,onToolPresetChange:x,thinkingLevel:S,onThinkingLevelChange:C,availableThinkingLevels:w,thinkingLevelMap:T,onOpenModelConfig:E,queuedMessages:D,onRecallQueue:O,onWithdrawQueuedMessage:k,slashCommands:A,slashCommandsLoading:j,onLoadSlashCommands:M,onBuiltinCommand:N,commandBusy:ee,onAudioUnlock:te,onPromptWithStreamingBehavior:P,draftKey:F,cwd:ne,trustBadge:re=`none`,onTrustClick:ie},ae){let{t:oe}=z(),se=uC(),[ce,le]=(0,I.useState)(()=>F?qY(F)?.value??``:``),[ue,de]=(0,I.useState)(!1),fe=_Fe(D),[pe,me]=(0,I.useState)(!1),[he,ge]=(0,I.useState)(``),[_e,ve]=(0,I.useState)(0),ye=(0,I.useRef)(null),[be,xe]=(0,I.useState)(null),{attachedImages:Se,attachedImagesRef:Ce,processAttachments:we,removeImage:Te,clearImages:Ee,resetAttachments:De,visibleAttachKinds:Oe,openFilePicker:ke,fileInputRef:Ae}=pFe({draftKey:F,model:a,modelList:c}),je=ce.trimStart(),Me=Se.length===0&&je.startsWith(`!`),Ne=Me&&je.startsWith(`!!`),[Pe,Fe]=(0,I.useState)(null),Ie=vFe(ne,Pe),Le=(0,I.useRef)(null),Re=(0,I.useRef)(null),ze=(0,I.useRef)(null),Be=(0,I.useRef)(!1),Ve=(0,I.useRef)(0),{atQuery:He,setAtQuery:Ue,atMenuOpen:We,setAtMenuOpen:Ge,atActiveIndex:Ke,setAtActiveIndex:qe,atItemRefs:Je,atMatches:Ye,fileIndex:Xe,fileIndexLoading:Ze,needsServerSearch:Qe,serverResultInUse:$e,updateAtQuery:et,applyAtCompletion:tt}=sFe({cwd:ne,value:ce,setValue:le,textareaRef:Le});hFe({ref:ae,textareaRef:Le,value:ce,setValue:le,setAtQuery:Ue,processAttachments:we});let{clearInput:nt}=mFe({draftKey:F,value:ce,setValue:le,setAtQuery:Ue,attachedImages:Se,attachedImagesRef:Ce,clearImages:Ee,resetAttachments:De,textareaRef:Le});(0,I.useEffect)(()=>{let e=Le.current;e&&(e.style.height=`auto`,ce&&(e.style.height=`${e.scrollHeight}px`))},[ce]);let{handleSend:rt,sendQueued:it}=gFe({value:ce,attachedImages:Se,isStreaming:i,commandBusy:ee,pendingSend:ue,draftKey:F,setValue:le,clearInput:nt,onSend:e,setPendingSend:de,onSteer:n,onFollowUp:r,onBuiltinCommand:N,onPromptWithStreamingBehavior:P,onAudioUnlock:te}),at=wK({value:ce,commands:A,skillDormancy:Ie,builtinDisabled:i,onLoadCommands:M,onApply:(0,I.useCallback)(e=>{let t=`/${e.name} `;le(t),wX(Le.current,t.length)},[])}),ot=yFe(!!ce.trim()),st=dFe({value:ce,isStreaming:i,onAbort:t,onSteer:n,onFollowUp:r,onRecallQueue:O,queuedCount:fe,handleSend:rt,sendQueued:it,slashPalette:at,atMenuOpen:We,setAtMenuOpen:Ge,atQuery:He,atMatches:Ye,atActiveIndex:Ke,setAtActiveIndex:qe,applyAtCompletion:tt,isComposingRef:Be,lastCompositionEndAtRef:Ve}),ct=(0,I.useCallback)(()=>{aFe(Le.current)},[]),lt=(0,I.useCallback)(e=>{let t=Array.from(e.clipboardData?.items??[]).filter(e=>$Y(e.type));if(!t.length)return;e.preventDefault();let n=t.map(e=>e.getAsFile()).filter(e=>e!==null);we(n)},[we]);(0,I.useEffect)(()=>{if(!at.open||!ne)return;let e=ne,t=!1;return Fe({cwd:e,values:{}}),fetch(`/api/skills?cwd=${encodeURIComponent(e)}`).then(e=>{if(!e.ok)throw Error(`skills fetch failed: ${e.status}`);return e.json()}).then(n=>{if(t)return;let r={};for(let e of n.skills??[])r[e.name]=e.disableModelInvocation;Fe({cwd:e,values:r})}).catch(()=>{t||Fe({cwd:e,values:{}})}),()=>{t=!0}},[at.open,ne]);let ut=JPe(c,s,a?.provider);(0,I.useEffect)(()=>{ye.current?.scrollIntoView({block:`nearest`})},[_e,he]);let dt=YPe(_,oe),ft=qPe(S,T),pt=y?.find(e=>e.name===(v??`default`))?.name??v??`default`;fFe({dropdownRef:Re,modelDropdownPanelRef:ze,setModelDropdownOpen:me,setModelFilter:ge});let mt=(0,L.jsxs)(`div`,{className:`text-xs`,"data-testid":`chat-input-status-row`,style:{display:`flex`,alignItems:`center`,gap:10,minWidth:0,flexShrink:0},children:[(0,L.jsxs)(`div`,{style:{flexShrink:0,display:`flex`,alignItems:`center`,gap:6},children:[f&&(0,L.jsx)(ZPe,{isCompacting:g===!0,isStreaming:i,isMobile:!1,onCompact:f,onAbortCompaction:p,displayContextUsage:h}),(Me||ne)&&(0,L.jsx)(`div`,{style:{minWidth:0,flex:`0 1 auto`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:`20px`},children:Me?(0,L.jsxs)(`span`,{style:{color:Ne?`var(--text-muted)`:`var(--accent)`},children:[oe(`chat.shell`),` · `,oe(Ne?`chat.outputLocal`:`chat.outputModel`),!Ne&&oe(`chat.shellSilentTip`)]}):re===`none`?(0,L.jsx)(fT,{label:ne??``,children:(0,L.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:5,cursor:`default`},children:[(0,L.jsx)(ose,{size:B[`2xl`],style:{color:`var(--accent)`,flexShrink:0},"aria-hidden":!0}),(0,L.jsx)(`span`,{style:{color:`var(--text-muted)`},children:aP(ne??``)||ne})]})}):(0,L.jsx)(fT,{label:oe(re===`untrusted`?`trust.untrustedDesc`:`trust.trustedDesc`)+(ne?`\n${ne}`:``),children:(0,L.jsxs)(`span`,{onClick:re===`untrusted`?ie:void 0,"aria-label":re===`untrusted`?oe(`trust.resourcesNotLoaded`):void 0,role:re===`untrusted`?`button`:void 0,style:{display:`inline-flex`,alignItems:`center`,gap:5,cursor:re===`untrusted`?`pointer`:`default`},children:[re===`untrusted`?(0,L.jsx)(bse,{size:B[`2xl`],style:{color:`var(--status-warning)`,flexShrink:0},"aria-hidden":!0}):(0,L.jsx)(xse,{size:B[`2xl`],style:{color:`var(--status-success)`,flexShrink:0},"aria-hidden":!0}),(0,L.jsx)(`span`,{style:{color:`var(--text-muted)`},children:aP(ne??``)||ne})]})})})]}),(0,L.jsx)(`div`,{style:{minWidth:0,flex:`0 1 auto`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:`20px`},children:m})]}),ht=(0,L.jsxs)(L.Fragment,{children:[d&&(0,L.jsx)(mA,{value:a??null,options:ut,onChange:d,disabled:i,variant:`chat`,isAutoSelection:o,isMobile:se}),(0,L.jsx)(tFe,{isMobile:se,isStreaming:i,thinkingLevel:S,thinkingDisplayLabel:ft,onThinkingLevelChange:C,availableThinkingLevels:w,thinkingLevelMap:T,thinkingMapConfirm:be,setThinkingMapConfirm:xe,model:a,onOpenModelConfig:E}),x&&(0,L.jsx)(iFe,{isMobile:se,isStreaming:i,toolPreset:v,toolPresetLabel:pt,toolPresets:y,driftActualTools:b,onToolPresetChange:x})]}),gt=(0,L.jsx)(PPe,{kinds:Oe,files:Se,onPick:ke,t:oe,disabled:ue});return(0,L.jsxs)(`div`,{style:{position:`relative`,zIndex:140,flexShrink:0,background:`transparent`,padding:`0 16px 8px`,paddingRight:se?16:64},children:[(0,L.jsx)(`input`,{ref:Ae,"data-testid":`attach-file-input`,type:`file`,multiple:!0,style:{display:`none`},onChange:e=>{let t=Array.from(e.target.files??[]);we(t),e.target.value=``}}),(0,L.jsxs)(`div`,{style:{maxWidth:820,margin:`0 auto`},children:[(0,L.jsx)(FPe,{error:l}),(0,L.jsx)(IPe,{warnings:u}),(0,L.jsx)($Pe,{queuedMessages:D,onRecallQueue:O,onWithdrawQueuedMessage:k}),(0,L.jsx)(eFe,{text:dt}),(0,L.jsx)(`div`,{style:{position:`relative`,minWidth:0},children:(0,L.jsx)(KPe,{statusRow:mt,slashPalette:at,slashCommandsLoading:j,skillDormancy:Ie,atMenuOpen:We,bashMode:Me,atQuery:He,atMatches:Ye,atActiveIndex:Ke,atItemRefs:Je,applyAtCompletion:tt,setAtActiveIndex:qe,fileIndex:Xe,onRemoveAttachment:Te,fileIndexLoading:Ze,cwd:ne,needsServerSearch:Qe,serverResultInUse:$e,isStreaming:i,textareaRef:Le,value:ce,setValue:le,updateAtQuery:et,handleKeyDown:st,isComposingRef:Be,lastCompositionEndAtRef:Ve,handleInput:ct,handlePaste:lt,t:oe,onSteer:n,onFollowUp:r,canQueueStreamingMessage:ot,attachedImages:Se,commandBusy:ee,pendingSend:ue,onAbort:t,sendQueued:it,handleSend:rt,bottomSelectors:ht,actionLeading:gt})})]})]})}),TX={preview:`_preview_lqvof_1`,turn:`_turn_lqvof_44`,number:`_number_lqvof_65`,content:`_content_lqvof_82`,user:`_user_lqvof_87`,userText:`_userText_lqvof_108`,assistant:`_assistant_lqvof_122`,assistantJump:`_assistantJump_lqvof_133`,summary:`_summary_lqvof_161`};function xFe(e){return typeof e.content==`string`?e.content.trim():e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
540
- `).trim()}function SFe(e){return e.role===`assistant`?wFe(CFe((e.content??[]).filter(e=>e.type===`text`).map(e=>e.text).join(` `)),120):``}function CFe(e){if(!e)return``;let t=e;return t=t.replace(/```[\s\S]*?(```|$)/g,` `),t=t.replace(/`([^`]*)`/g,`$1`),t=t.replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`),t=t.replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`),t=t.split(/\n/).map(e=>e.replace(/^\s{0,3}#{1,6}\s+/,``).replace(/^\s{0,3}>\s?/,``).replace(/^\s*[-*+]\s+/,``).replace(/^\s*\d+[.)]\s+/,``).replace(/^\s*\|.*\|\s*$/,``).trim()).filter(e=>e.length>0&&!/^(---+|\*{3,}|___{3,})$/.test(e)).join(` `),t=t.replace(/(\*\*|__)([^*_]+)\1/g,`$2`),t=t.replace(/(\*|_)([^*_]+)\1/g,`$2`),t.replace(/\s+/g,` `).trim()}function wFe(e,t){return t<=0?``:e.length<=t?e:`${e.slice(0,t).trimEnd()}…`}var TFe=(0,I.memo)(function({summary:e,onClick:t}){return e?(0,L.jsx)(`button`,{type:`button`,className:TX.summary,onClick:t,children:e}):null});function EFe(e){return e.map((e,t)=>({topRatio:0,targetTurn:e,index:t}))}function DFe({allNodes:e,nearestNode:t,previewBoxRef:n,onShowPreview:r,onHidePreview:i,onJumpUser:a,onJumpAssistant:o}){return(0,L.jsx)(`div`,{ref:n,popover:`manual`,className:TX.preview,"data-minimap-preview-box":``,onMouseEnter:r,onMouseDown:e=>e.stopPropagation(),onMouseMove:e=>e.stopPropagation(),children:t!==null&&(()=>{let n=e.length,r=Math.min(Math.max(0,t.index-1),Math.max(0,n-3));return e.slice(r,r+3).map(e=>(0,L.jsxs)(`div`,{className:TX.turn,"data-minimap-preview-index":e.index,"data-located":e.index===t.index?`true`:void 0,children:[(0,L.jsx)(`span`,{className:TX.number,"aria-hidden":`true`,children:String(e.index+1)}),(0,L.jsxs)(`div`,{className:TX.content,children:[(0,L.jsx)(`button`,{type:`button`,className:TX.user,"data-minimap-preview-user":e.index,onClick:()=>{a(e),i()},children:(0,L.jsx)(`span`,{className:TX.userText,children:xFe(e.targetTurn.userMessage)})}),e.targetTurn.assistantPreviews.map((t,n)=>(0,L.jsxs)(`div`,{className:TX.assistant,children:[(0,L.jsx)(`button`,{type:`button`,className:TX.assistantJump,"data-minimap-preview-assistant":`${e.index}-${n}`,onClick:()=>{o(e,n),i()},"aria-label":`Locate assistant message`,children:`A`}),(0,L.jsx)(TFe,{summary:t.summary,onClick:()=>{o(e,n),i()}})]},n))]})]},e.index))})()})}function EX(e,t){return t?e.querySelector(`[data-row-key="message-${t.msgIdx}-answer"]`)??t.element??null:null}var OFe=1600;function kFe(e){let t=0;for(let n of e)n.role===`user`&&t++;return t}var AFe=30,jFe=2,DX=.3;function MFe(e,t,n,r,i){let a=[],o=0,s=null;for(let c=0;c<e.length;c++){let l=e[c];if(l.role!==`user`&&l.role!==`assistant`)continue;let u=t.current?.[o];o++;let d=null;if(n?d=n(c):u&&(d=u.getBoundingClientRect().top-r.top+i.scrollTop),l.role===`user`){s=null,s={userMessage:l,userMsgIdx:c,userElement:u,assistantPreviews:[],scrollTop:d},a.push(s);continue}if(!s)continue;let f=SFe(l);f&&(s.assistantPreviews=[{summary:f,element:u,msgIdx:c}])}return a}function OX(e,t,n,r){let i=e.assistantIndex===void 0?null:t.targetTurn.assistantPreviews[e.assistantIndex],a=e=>{let t=e?.getBoundingClientRect();return t?t.top-n.top+r.scrollTop:null};if(e.target===`user`){let e=t.targetTurn.userElement;return e?.isConnected?a(e):a(r.querySelector(`[data-row-key="${CSS.escape(`group-header-${t.targetTurn.userMsgIdx}`)}"]`))}return e.target===`assistant`?a(EX(r,i??void 0)):null}function NFe(e,t,n){let r=0,i=0,a=!1,o=()=>{a=!0};window.addEventListener(`wheel`,o,{once:!0,passive:!0}),window.addEventListener(`touchstart`,o,{once:!0,passive:!0});let s=()=>{if(a)return;let o=OX(t,n,e.getBoundingClientRect(),e);if(o===null)return;let c=o-e.clientHeight*DX-e.scrollTop;if(Math.abs(c)>1)e.scrollBy(0,c),i=0;else if(++i>=jFe)return;++r<=AFe&&requestAnimationFrame(s)};requestAnimationFrame(s)}function PFe({messages:e,streamingMessage:t,scrollContainer:n,messageRefs:r,resolveMessageOffset:i,containerRef:a,railBoxRef:o,allNodesRef:s,pendingNavigationRef:c}){let[l,u]=(0,I.useState)([]),d=(0,I.useMemo)(()=>kFe(e)>0,[e]),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(600),g=(0,I.useRef)(null),_=(0,I.useMemo)(()=>t?[...e,t]:e,[e,t]),v=(0,I.useRef)(_);(0,I.useEffect)(()=>{v.current=_});let y=(0,I.useCallback)(e=>{g.current={index:e,until:Date.now()+OFe},p(e)},[]),b=(0,I.useCallback)((e,t,n=!1)=>{let r=g.current;if(r&&Date.now()<r.until){if(n)g.current=null;else{p(r.index);return}}if(g.current=null,e.scrollHeight-e.clientHeight-e.scrollTop<=16&&t.length>0){p(t[t.length-1].index);return}let i=e.scrollTop+e.clientHeight/2,a=e.getBoundingClientRect().top,o=null;for(let n of t){let t=n.targetTurn.userElement,r=n.targetTurn.scrollTop;if(t?.isConnected&&(r=t.getBoundingClientRect().top-a+e.scrollTop),r!==null){if(r<=i)o=n;else break}}p(o?o.index:null)},[]),x=(0,I.useCallback)(()=>{let e=n.current;if(!e||e.scrollHeight-e.clientHeight-e.scrollTop>16)return;let t=o.current;if(!t)return;let r=Math.max(0,t.scrollHeight-t.clientHeight);t.scrollTop!==r&&(t.scrollTop=r)},[n,o]),S=(0,I.useCallback)(()=>{if(document.hidden)return;let e=n.current;e&&(b(e,s.current,!0),x())},[n,s,b,x]),C=(0,I.useRef)(null),w=(0,I.useCallback)(()=>{if(document.hidden)return;let e=n.current,t=a.current;if(!e||!t)return;let o=e.getBoundingClientRect(),l=EFe(MFe(v.current,r,i,o,e));h(t.clientHeight),s.current=l,u(l),b(e,l),x();let d=c.current;if(!d)return;let f=l[d.nodeIndex];if(!f)return;let p=OX(d,f,o,e);if(p===null)return;c.current=null,y(f.index);let m=e.clientHeight*DX;e.scrollTo({top:Math.max(0,p-m)}),NFe(e,d,f)},[y,r,i,n,a,s,c,b,x]),T=(0,I.useCallback)(()=>{document.hidden||(C.current||=setTimeout(()=>{C.current=null,!document.hidden&&w()},150))},[w]);return(0,I.useEffect)(()=>{let e=n.current;if(e)return e.addEventListener(`scroll`,S,{passive:!0}),()=>e.removeEventListener(`scroll`,S)},[n,S]),(0,I.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{document.hidden||(T(),S())},r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),t(),()=>{r.disconnect(),C.current&&=(clearTimeout(C.current),null)}},[T,n,S]),(0,I.useEffect)(()=>{let e=setTimeout(()=>{T(),S()},50);return()=>clearTimeout(e)},[e.length,T,S]),{allNodes:l,activeIndex:f,minimapHeight:m,visible:d,lockActiveNode:y,measureNodes:T}}function kX(e,t,n={}){let r=n.ratio??.3,i=n.frameBudget??40,a=n.stableFrames??2,o=n.quietFrames??0,{onDone:s}=n,c=!1,l=0,u=(n,i,d,f)=>{if(c)return;let p=e.scrollTop,m=f!==null&&Math.abs(p-f)<1?d+1:0;if(m<o&&n>0){l=requestAnimationFrame(()=>u(n-1,0,m,p));return}let h=t();if(h===null){if(n>0){l=requestAnimationFrame(()=>u(n-1,0,m,p));return}s?.();return}let g=h.getBoundingClientRect().top-e.getBoundingClientRect().top-e.clientHeight*r;if(Math.abs(g)>1)e.scrollBy(0,g),i=0;else if(++i>=a){s?.();return}if(n>0){l=requestAnimationFrame(()=>u(n-1,i,m,p));return}s?.()};return l=requestAnimationFrame(()=>u(i,0,0,null)),()=>{c=!0,cancelAnimationFrame(l)}}function FFe({scrollContainer:e,resolveMessageOffset:t,onWindowJumpTo:n,onScrollToMessageIndex:r,lockActiveNode:i,measureNodes:a,pendingNavigationRef:o,jumpToFoldedTurnEntry:s,jumpToCurrentTurn:c}){let l=(0,I.useRef)(null),u=(0,I.useCallback)((t,r=`smooth`)=>{let i=e.current;if(!i)return;let a=Math.max(0,t-i.clientHeight*.3);Math.abs(a-i.scrollTop)>i.clientHeight*3||r===`auto`?(n(a),l.current=a):i.scrollTo({top:a,behavior:r})},[n,e]),d=(0,I.useCallback)((e,n=`smooth`)=>{if(r?.(e))return!0;let i=t?.(e)??null;return i!==null&&(u(i,n),!0)},[u,r,t]);(0,I.useLayoutEffect)(()=>{let t=l.current;if(t===null)return;l.current=null;let n=e.current;n&&(n.scrollTop=t)});let f=(0,I.useCallback)((e,t,n=`smooth`)=>{if(!t.isConnected)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect().top-r.top+e.scrollTop-e.clientHeight*.3,a=Math.abs(i-e.scrollTop)>e.clientHeight*3;e.scrollTo({top:Math.max(0,i),behavior:a||n===`auto`?`auto`:n}),kX(e,()=>t.isConnected?t:null,{frameBudget:300,stableFrames:3,quietFrames:3})},[]);return{scrollToNode:(0,I.useCallback)((t,n)=>{let r=e.current;if(!r||(i(t.index),c?.(t.targetTurn.userMsgIdx)))return;if(t.targetTurn.scrollTop===null){r.scrollTo({top:r.scrollHeight,behavior:n});return}let s=t.targetTurn.userElement;if(s?.isConnected){i(t.index),f(r,s,n);return}o.current={nodeIndex:t.index,target:`user`},d(t.targetTurn.userMsgIdx,n)||setTimeout(()=>a(),400)},[d,c,i,a,e,f,o]),scrollToAssistant:(0,I.useCallback)((t,n)=>{let r=e.current;if(!r)return;let c=t.targetTurn.assistantPreviews[n],l=EX(r,c);if(!l){if(o.current={nodeIndex:t.index,target:`assistant`,assistantIndex:n},!(c&&d(c.msgIdx))){s?.(t.targetTurn.userMsgIdx);return}setTimeout(()=>a(),400);return}i(t.index),f(r,l)},[s,d,i,a,e,f,o])}}var IFe=PT(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function LFe({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?VT:`span`;return(0,L.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:HO(IFe({variant:t}),e),...r})}function AX({number:e,active:t=!1,highlighted:n=!1}){return(0,L.jsx)(LFe,{variant:`outline`,className:`h-[1.6em] w-[3em] rounded-[0.25em] border-[1.5px] p-0 font-mono text-[0.625rem] font-semibold leading-none`,style:{background:t?`color-mix(in srgb, var(--accent) 12%, transparent)`:n?`color-mix(in srgb, var(--accent) 10%, transparent)`:`transparent`,borderColor:t||n?`var(--accent)`:`color-mix(in srgb, var(--text) 65%, transparent)`,boxShadow:t?`0 0 0 2px var(--bg-panel)`:n?`0 0 0 1px var(--accent), 0 1px 2px -1px var(--shadow-color)`:`0 1px 2px -1px var(--shadow-color)`,transition:`transform 0.1s, background 0.1s, box-shadow 0.1s`,transform:n?`scale(1.15)`:`scale(1)`},children:(0,L.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,lineHeight:1,fontFamily:`var(--font-mono)`,fontWeight:600,userSelect:`none`,color:t?`var(--accent)`:`var(--text)`},children:String(e)})})}var RFe=48,jX=12,MX=26,NX=2,zFe=250;function BFe({node:e,isActive:t,isNearest:n,onSelect:r,onRevealChange:i,onMouseDown:a}){let{ref:o,handlers:s}=lJ({onChange:i});return(0,L.jsx)(`div`,{ref:o,...s,"data-minimap-node-index":e.index,"data-minimap-node-active":t?``:void 0,style:{position:`absolute`,top:jX+e.index*MX,transform:`translateY(-50%)`,left:0,right:0,height:MX,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`auto`,zIndex:2},children:(0,L.jsx)(`span`,{onClick:r,onMouseDown:a,style:{display:`inline-flex`,cursor:`pointer`},children:(0,L.jsx)(AX,{number:e.index+1,active:t,highlighted:n})})})}function VFe({messages:e,streamingMessage:t,scrollContainer:n,messageRefs:r,resolveMessageOffset:i,scrollStepPx:a=200,onWindowJumpTo:o,onScrollToMessageIndex:s,jumpToFoldedTurnEntry:c,jumpToCurrentTurn:l,sid:u,bottomInset:d=0}){let[f,p]=(0,I.useState)(0),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(null),v=(0,I.useRef)(!1),y=(0,I.useRef)(null),b=(0,I.useRef)(null),x=(0,I.useRef)(null),S=(0,I.useRef)([]),C=(0,I.useRef)(null),w=(0,I.useRef)(null),T=(0,I.useRef)(null),E=(0,I.useRef)(null),D=(0,I.useRef)(null),O=(0,I.useRef)(null),{allNodes:k,activeIndex:A,minimapHeight:j,visible:M,lockActiveNode:N,measureNodes:ee}=PFe({messages:e,streamingMessage:t,scrollContainer:n,messageRefs:r,resolveMessageOffset:i,containerRef:y,railBoxRef:b,allNodesRef:S,pendingNavigationRef:O});(0,I.useEffect)(()=>{u&&(Kje(u,A),Jje(u,A===null?null:k[A]?.targetTurn.userMsgIdx??null))},[u,A,k]);let{scrollToNode:te,scrollToAssistant:P}=FFe({scrollContainer:n,resolveMessageOffset:i,onWindowJumpTo:o,onScrollToMessageIndex:s,lockActiveNode:N,measureNodes:ee,pendingNavigationRef:O,jumpToFoldedTurnEntry:c,jumpToCurrentTurn:l}),F=(0,I.useCallback)(e=>{let t=S.current;if(t.length===0)return null;let n=Math.round((e-jX)/MX);return t[Math.max(0,Math.min(n,t.length-1))]??null},[]),ne=LN(),re=(0,I.useCallback)(()=>{ne.cancel(),h(!0)},[ne]),ie=(0,I.useCallback)(()=>{ne.cancel(),h(!1),_(null)},[ne]),ae=(0,I.useCallback)(()=>{ne.schedule(ie,zFe)},[ne,ie]);(0,I.useEffect)(()=>()=>{T.current!==null&&cancelAnimationFrame(T.current),E.current!==null&&cancelAnimationFrame(E.current)},[]);let oe=(0,I.useCallback)(()=>{if(!M)return;let e=b.current;if(!e)return;v.current=!0,re();let t=e.getBoundingClientRect(),n=e.scrollTop,r=e=>{v.current&&E.current===null&&(E.current=requestAnimationFrame(()=>{E.current=null,_(n+(e.clientY-t.top))}))},i=()=>{v.current=!1,E.current!==null&&(cancelAnimationFrame(E.current),E.current=null),window.removeEventListener(`mousemove`,r),window.removeEventListener(`mouseup`,i)};window.addEventListener(`mousemove`,r),window.addEventListener(`mouseup`,i)},[re,M]),se=g===null?null:F(g);(0,I.useLayoutEffect)(()=>{if(!m||se===null)return;let e=C.current;if(!e)return;let t=b.current;try{e.showPopover?.({source:t??void 0})}catch{}let n=t?.scrollTop??0,r=jX+se.index*MX-n,i=Math.max(0,j-e.offsetHeight),a=Math.min(Math.max(r-e.offsetHeight/2,0),i),o=t?.getBoundingClientRect().top??0;e.style.top=`${o+a}px`},[m,se,j,f]);let ce=(0,I.useCallback)(()=>{x.current===null&&(x.current=requestAnimationFrame(()=>{x.current=null;let e=b.current;e&&p(e.scrollTop)}))},[]),le=(0,I.useCallback)(e=>{let t=b.current;if(!t)return;let n=Math.max(0,t.scrollHeight-t.clientHeight);w.current=e===`top`?0:n,t.scrollTo({top:e===`top`?0:n,behavior:`smooth`})},[]),ue=(0,I.useCallback)(e=>{let t=b.current;if(!t)return;let n=Math.max(0,t.scrollHeight-t.clientHeight),r=w.current??t.scrollTop,i=Math.max(0,Math.min(n,r+e*a));w.current=i,t.scrollTo({top:i,behavior:`auto`})},[a]);if(!M)return null;let de=k.length*MX+24,fe=Math.max(1,j),pe=Math.max(0,Math.floor(f/MX)-NX),me=Math.min(k.length,Math.ceil((f+fe)/MX)+NX),he=k.slice(pe,me),ge=f<=2,_e=f>=de-fe-2;return(0,L.jsxs)(`div`,{ref:y,"data-testid":`chat-minimap`,"data-minimap":``,onMouseLeave:()=>{ae()},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=(b.current?.scrollTop??0)+(e.clientY-t.top);D.current=n,T.current===null&&(T.current=requestAnimationFrame(()=>{T.current=null,_(D.current??0)}))},style:{width:RFe,position:`absolute`,top:0,bottom:d,right:vPe,zIndex:130,cursor:`default`,userSelect:`none`},children:[(0,L.jsx)(`div`,{ref:b,"data-minimap-rail":``,onScroll:ce,onMouseMove:e=>{let t=b.current,n=e.currentTarget.getBoundingClientRect(),r=(t?.scrollTop??0)+(e.clientY-n.top);D.current=r,T.current===null&&(T.current=requestAnimationFrame(()=>{T.current=null,_(D.current??0)}))},style:{position:`absolute`,inset:0,overflowY:`auto`,scrollbarWidth:`none`,overflowAnchor:`none`,cursor:`default`,userSelect:`none`},children:(0,L.jsx)(`div`,{style:{position:`relative`,height:de},children:he.map(e=>{let t=m&&se?.index===e.index,n=A===e.index;return(0,L.jsx)(BFe,{node:e,isActive:n,isNearest:t,onSelect:()=>te(e,`smooth`),onMouseDown:oe,onRevealChange:t=>{t?(_(jX+e.index*MX),re()):ae()}},e.index)})})}),ge?null:(0,L.jsx)(OK,{direction:`up`,visible:!0,onHover:()=>ue(-1),onClick:()=>le(`top`),testId:`rail-scroll-up`}),_e?null:(0,L.jsx)(OK,{direction:`down`,visible:!0,onHover:()=>ue(1),onClick:()=>le(`bottom`),testId:`rail-scroll-down`}),m&&k.length>0&&(0,L.jsx)(DFe,{allNodes:k,nearestNode:se,previewBoxRef:C,onShowPreview:re,onHidePreview:ie,onJumpUser:e=>te(e,`smooth`),onJumpAssistant:P})]})}function HFe(e){let t=(0,I.useRef)([]);return t.current=Array(e).fill(null).map((e,n)=>t.current[n]??null),t}var PX={current:null};function FX(e){if(e.type!==`thinking`)return!1;let t=e;return t.thinking.trim()===``&&!!(t.redacted||typeof t.thinkingSignature==`string`&&t.thinkingSignature.trim().length>0)}function IX(e,t={}){return e.type===`thinking`&&!e.deferred&&!t.isStreaming&&e.thinking.trim()===``&&!FX(e)}function LX(e,t={}){return(e.content??[]).filter(e=>!IX(e,t))}function RX(e,t={}){return t.isStreaming||e.stopReason!==`error`?null:e.errorMessage?.trim()||`Unknown provider error`}function UFe(e){return e.type===`text`||e.type===`image`}function zX(e,t={}){let n=LX(e,t),r=n.findLastIndex(e=>!UFe(e));return r===-1?{answerBlocks:n,processBlocks:[]}:{answerBlocks:n.slice(r+1),processBlocks:n.slice(0,r+1)}}function BX(e){return e.filter(e=>e.type===`toolCall`).length}function VX(e){if(e.role!==`assistant`)return null;let t=RX(e);return!t||/abort/i.test(t)?null:t}function WFe(e,t={}){let n=RX(e,t);return n&&/abort/i.test(n)?!0:e.stopReason===`aborted`&&!e.suppressAbortBanner}function HX(e){let t=UX(e);if(t){let e=0,n=0;for(let r of t)for(let t of r.rows)t.type===`line`&&(t.left.type===`removed`&&(n+=1),t.right.type===`added`&&(e+=1));return{additions:e,deletions:n}}let n=0,r=0;for(let t of e.split(/\r?\n/))t.startsWith(`+`)&&!t.startsWith(`+++`)?n+=1:t.startsWith(`-`)&&!t.startsWith(`---`)&&(r+=1);return{additions:n,deletions:r}}function UX(e){let t=[],n=null,r,i=0,a=0,o=[],s=[],c=()=>({lineNo:null,text:``,type:`empty`}),l=()=>{if(!n){o=[],s=[];return}let e=Math.max(o.length,s.length);for(let t=0;t<e;t++){let e=o[t]?{lineNo:o[t].lineNo,text:o[t].text,type:`removed`}:c(),r=s[t]?{lineNo:s[t].lineNo,text:s[t].text,type:`added`}:c();n.rows.push({type:`line`,left:e,right:r})}o=[],s=[]};for(let c of e.split(/\r?\n/)){if(c.startsWith(`--- `)){l(),r=WX(c.slice(4));continue}if(c.startsWith(`+++ `)){l(),n={oldPath:r,newPath:WX(c.slice(4)),rows:[]},t.push(n);continue}let e=c.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(e){n||(n={rows:[]},t.push(n)),l(),i=Number(e[1]),a=Number(e[2]),n.rows.push({type:`hunk`,text:c});continue}if(!n)continue;if(c.startsWith(`\\ `)){l(),n.rows.push({type:`hunk`,text:c});continue}let u=c[0],d=c.slice(1);u===` `?(l(),n.rows.push({type:`line`,left:{lineNo:i++,text:d,type:`context`},right:{lineNo:a++,text:d,type:`context`}})):u===`-`?o.push({lineNo:i++,text:d}):u===`+`?s.push({lineNo:a++,text:d}):c!==``&&(l(),n.rows.push({type:`hunk`,text:c}))}l();let u=t.filter(e=>e.rows.some(e=>e.type===`line`));return u.length>0?u:null}function WX(e){return e.split(` `)[0].trim()}function GFe(e){let t=e.details;if(!rA(t))return null;let n=typeof t.patch==`string`?t.patch:null;if(n)return{text:n};let r=typeof t.diff==`string`?t.diff:null;return r?{text:r}:null}function GX(e){if(typeof e!=`string`||!e)return!1;let t=e.toLowerCase();return t===`edit`||t.startsWith(`edit_`)||t.endsWith(`.edit`)||t.endsWith(`_edit`)||t.includes(`str_replace`)||t.includes(`replace_editor`)}function KFe({diff:e}){return(0,L.jsx)(`div`,{style:{marginTop:6,borderRadius:`var(--radius-md, 6px)`,overflow:`hidden`,background:`var(--bg-subtle)`},children:(0,L.jsx)(qFe,{text:e.text})})}function qFe({text:e}){let{t}=z(),n=(0,I.useMemo)(()=>UX(e),[e]);if(!n)return(0,L.jsx)(XFe,{text:e});let r=n.length>1;return(0,L.jsx)(`div`,{style:{maxHeight:560,overflowY:`auto`,overflowX:`hidden`,background:`transparent`,contentVisibility:`auto`,containIntrinsicBlockSize:560},children:n.map((e,n)=>(0,L.jsxs)(`div`,{style:{minWidth:0,borderTop:n===0?`none`:`1px solid var(--border)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,lineHeight:1.55},children:[r&&(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) minmax(0, 1fr)`,position:`sticky`,top:0,zIndex:1,background:`var(--bg-subtle)`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsx)(KX,{title:e.oldPath||t(`i18n.before`),side:`left`}),(0,L.jsx)(KX,{title:e.newPath||t(`i18n.after`),side:`right`})]}),(0,L.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) minmax(0, 1fr)`},children:e.rows.map((e,t)=>e.type===`hunk`?null:(0,L.jsxs)(`div`,{style:{display:`contents`},children:[(0,L.jsx)(qX,{cell:e.left,side:`left`}),(0,L.jsx)(qX,{cell:e.right,side:`right`})]},t))})]},n))})}function KX({title:e,side:t}){return(0,L.jsx)(`div`,{title:e,style:{padding:`5px 10px`,color:`var(--text-dim)`,borderRight:t===`left`?`1px solid var(--border)`:`none`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e})}function qX({cell:e,side:t}){let n=e.type===`added`?`color-mix(in srgb, var(--status-success) 12%, transparent)`:e.type===`removed`?`color-mix(in srgb, var(--status-error) 13%, transparent)`:e.type===`empty`?`var(--bg-subtle)`:`transparent`,r=e.type===`added`?`+`:e.type===`removed`?`-`:` `,i=e.type===`added`?`var(--status-success)`:e.type===`removed`?`var(--status-error)`:`var(--text-dim)`;return(0,L.jsxs)(`div`,{style:{display:`flex`,minWidth:0,background:n,borderRight:t===`left`?`1px solid var(--border)`:`none`},children:[(0,L.jsx)(`span`,{style:{width:42,padding:`0 6px`,textAlign:`right`,color:`var(--text-dim)`,userSelect:`none`,background:`var(--bg)`,borderRight:`1px solid var(--border)`,flexShrink:0},children:e.lineNo??``}),(0,L.jsx)(`span`,{style:{width:18,padding:`0 5px`,color:i,userSelect:`none`,fontWeight:e.type===`context`||e.type===`empty`?400:700,flexShrink:0},children:r}),(0,L.jsx)(`span`,{style:{flex:1,minWidth:0,padding:`0 10px 0 0`,color:e.type===`empty`?`var(--text-dim)`:`var(--text)`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e.text||`\xA0`})]})}var JFe={added:{bg:`color-mix(in srgb, var(--status-success) 12%, transparent)`,color:`var(--status-success)`,borderLeft:`3px solid var(--status-success)`},removed:{bg:`color-mix(in srgb, var(--status-error) 13%, transparent)`,color:`var(--status-error)`,borderLeft:`3px solid var(--status-error)`},hunk:{bg:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`,borderLeft:`3px solid var(--accent)`},context:{bg:`transparent`,color:`var(--text)`,borderLeft:`3px solid transparent`}};function YFe(e){return e.startsWith(`@@`)?`hunk`:e.startsWith(`+`)&&!e.startsWith(`+++`)?`added`:e.startsWith(`-`)&&!e.startsWith(`---`)?`removed`:`context`}function XFe({text:e}){let t=e.split(/\r?\n/);return(0,L.jsx)(`div`,{style:{maxHeight:520,overflowY:`auto`,overflowX:`hidden`,fontFamily:`var(--font-mono)`,contentVisibility:`auto`,containIntrinsicBlockSize:520,fontSize:`var(--text-base)`,lineHeight:1.55,minWidth:0},children:t.map((e,t)=>{let{bg:n,color:r,borderLeft:i}=JFe[YFe(e)];return(0,L.jsxs)(`div`,{style:{display:`flex`,background:n,borderLeft:i},children:[(0,L.jsx)(`span`,{style:{width:48,padding:`0 8px`,color:`var(--text-dim)`,background:`var(--bg)`,borderRight:`1px solid var(--border)`,textAlign:`right`,userSelect:`none`,flexShrink:0},children:t+1}),(0,L.jsx)(`span`,{style:{padding:`0 10px`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,color:r},children:e||`\xA0`})]},t)})})}function ZFe(e){if(typeof e!=`string`||!e)return!1;let t=e.toLowerCase();return t===`write`||t.startsWith(`write_`)||t.endsWith(`.write`)||t.endsWith(`_write`)}function QFe(e){let t=`path`in e?e.path:`file_path`in e?e.file_path:void 0;return typeof t==`string`&&t.trim().length>0?t:null}function JX(e){let t=[],n=[];for(let r of e.split(/\r?\n/))r.startsWith(`+`)&&!r.startsWith(`+++`)?t.push(r.slice(1)):r.startsWith(`-`)&&!r.startsWith(`---`)&&n.push(r.slice(1));return[t,n]}function YX(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((e,t)=>e===r[t])}function $Fe(e,t){let[n,r]=JX(e),[i,a]=JX(t);return n.length+r.length===0||i.length+a.length===0?!1:YX(n,a)&&YX(r,i)}function eIe(e,t,n){let r=new Map;for(let i=t;i<n;i++){let t=e[i];if(t.role!==`toolResult`)continue;let n=t.details;if(!n||typeof n!=`object`)continue;let a=n,o=typeof a.patch==`string`&&a.patch?a.patch:typeof a.diff==`string`&&a.diff?a.diff:null;o&&r.set(t.toolCallId,o)}let i=new Map;for(let a=t;a<n;a++){let t=e[a];if(t.role===`assistant`)for(let e of t.content){if(e.type!==`toolCall`||!(GX(e.toolName)||ZFe(e.toolName)))continue;let t=QFe(e.input);if(!t)continue;let n=r.get(e.toolCallId),a={toolName:e.toolName,...n?{stats:HX(n),patchText:n}:{}},o=i.get(t)??[],s=o[o.length-1];s?.patchText&&n&&$Fe(s.patchText,n)?o.pop():o.push(a),i.set(t,o)}}return[...i.entries()].filter(([,e])=>e.length>0).map(([e,t])=>{let n=t[t.length-1];return{path:e,toolName:n.toolName,...n.stats?{stats:n.stats}:{}}})}function XX(e){return e.role===`user`?96:e.role===`assistant`?260:120}function tIe(e){return e.role===`assistant`&&zX(e).answerBlocks.some(e=>e.type===`image`||e.type===`text`&&e.text.trim().length>0)}function ZX(e,t,n){for(let r=n-1;r>t;r--)if(tIe(e[r]))return r;for(let r=n-1;r>t;r--)if(e[r]?.role===`assistant`)return r;return-1}function nIe(e,t){let n=0;for(let r of t){let t=e[r];t?.role===`assistant`&&(n+=BX(LX(t)))}return n}function QX(e){return e.role===`custom`&&!eZ(e)}function $X(e,t){let n=t+1;for(;n<e.length&&!eZ(e[n]);)n+=1;return n}function rIe(e){return e.role===`assistant`?LX(e).length>0:e.role===`custom`}function eZ(e){return e.role===`user`||e.role===`custom`&&e.customType===`compaction`}function tZ(e,t,n={}){let r={...e,content:t};return n.omitUsage&&(r.usage=void 0),n.suppressAbortBanner&&(r.suppressAbortBanner=!0),r}function iIe(e,t){let{messages:n,userIdx:r,endIdx:i,finalAssistantIdx:a,pushMessage:o,skipUserRow:s}=t;(!s||n[r].role!==`user`)&&o(r);let c=[];for(let e=r+1;e<a;e++)QX(n[e])||c.push(e);let l=c.filter(e=>rIe(n[e])),u=n[a],d=zX(u),f=d.processBlocks.length>0?tZ(u,d.processBlocks,{omitUsage:!0,suppressAbortBanner:!0}):null,p=d.answerBlocks.length>0||RX(u)||u.stopReason===`aborted`?tZ(u,d.answerBlocks):null,m=l.length+ +!!f;m>0&&(l.forEach((e,t)=>{o(e,{isProcess:!0,attachRef:t===0&&void 0,groupLast:!f&&t===l.length-1})}),f&&o(a,{isProcessFinal:!0,attachRef:!1,messageOverride:f,showTimestamp:!1,groupLast:!0})),p&&e.push({key:`message-${a}-answer`,kind:`message`,msgIdx:a,estimate:XX(n[a]),messageOverride:p,isAnswer:!0,showTimestamp:!1});let h=eIe(n,r,i),g=[];for(let e of n.slice(r+1,a+1)){if(e?.role!==`assistant`)continue;let t=VX(e);t&&g.push({kind:`error`,parts:[t]});for(let t of e.content)if(t){if(t.type===`text`&&t.text.trim().length>0){let e=g[g.length-1];e?.kind===`text`?e.parts.push(t.text):g.push({kind:`text`,parts:[t.text]})}else if(t.type===`thinking`&&t.thinking.trim().length>0){let e=g[g.length-1];e?.kind===`thinking`?e.parts[0]+=`\n\n${t.thinking}`:g.push({kind:`thinking`,parts:[t.thinking]})}}}for(let e=a+1;e<i;e++){let t=n[e];if(t?.role!==`assistant`)continue;let r=VX(t);r&&g.push({kind:`error`,parts:[r]})}let _=g.length>0?g:void 0;e.push({key:`group-header-${r}`,kind:`groupHeader`,groupUserIdx:r,finalAssistantIdx:a,messageCount:m+ +!!p,toolCallCount:nIe(n,l)+BX(d.processBlocks),artifacts:h.length>0?h:void 0,answerPreview:_,estimate:40});let v=Array.from({length:Math.max(0,i-a-1)},(e,t)=>a+1+t).filter(e=>!QX(n[e]));for(let e of v)o(e)}function aIe(e,t){let{userIdx:n,endIdx:r,pushMessage:i,skipUserRow:a}=t;a||i(n),e.push({key:`group-header-${n}`,kind:`groupHeader`,groupUserIdx:n,finalAssistantIdx:n,messageCount:0,toolCallCount:0,estimate:40});for(let e=n+1;e<r;e++)i(e)}function oIe(){return{turns:new Map}}function sIe(e,t,n,r){if(r.length!==n-t)return!1;for(let n=0;n<r.length;n++)if(e[t+n]!==r[n])return!1;return!0}function nZ(e,t,n,r){let i=[],a=(t,n={})=>{i.push({key:`message-${t}`,kind:`message`,msgIdx:t,estimate:XX(e[t]),...n})},o=ZX(e,t,n);return o===-1?aIe(i,{userIdx:t,endIdx:n,pushMessage:a,skipUserRow:r}):iIe(i,{messages:e,userIdx:t,endIdx:n,finalAssistantIdx:o,pushMessage:a,skipUserRow:r}),i}function cIe(e,t,n){let r=[],i=new Set,a=`D${t.detachedTurnUserIdx}|L${+!!t.isLiveTail}`,o=n!==void 0&&n.last!==void 0;for(let s=0;s<e.length;){let c=e[s];if(!eZ(c)){o=!1,r.push({key:`message-${s}`,kind:`message`,msgIdx:s,estimate:XX(e[s])}),s+=1;continue}let l=s,u=$X(e,l);if(a+=`|${l}:${u}`,l===t.detachedTurnUserIdx){s=u;continue}i.add(l);let d=n?.turns.get(l);if(d&&sIe(e,l,u,d.refs)){r.push(...d.rows),s=u;continue}o=!1;let f=nZ(e,l,u,!0);n&&n.turns.set(l,{refs:e.slice(l,u),rows:f}),r.push(...f),s=u}if(o&&n){let e=n.last;if(e&&e.sig===a)return e.rows}if(n){for(let e of n.turns.keys())i.has(e)||n.turns.delete(e);n.last={sig:a,rows:r}}return r}function lIe(e,t){if(t<0||t>=e.length||!eZ(e[t]))return[];let n=nZ(e,t,$X(e,t),!1);for(let e of n)e.kind===`message`&&(e.attachRef=!1);return n}function uIe(e,t){if(t<0||t>=e.length)return!0;let n=ZX(e,t,$X(e,t));if(n===-1)return!1;let r=e[n];return r?.role===`assistant`?r.stopReason===`stop`||r.stopReason===`aborted`||r.stopReason===`error`:!1}function dIe(e){let t=new Map;return e.forEach((e,n)=>{e.kind===`message`?t.set(e.msgIdx,n):e.kind===`groupHeader`&&!t.has(e.groupUserIdx)&&t.set(e.groupUserIdx,n)}),t}function fIe(e){let t=new Map;{let n=0;for(let r=0;r<e.length;r++)e[r].role===`user`?(n+=1,t.set(r,n)):e[r].role===`assistant`&&n>0&&t.set(r,n)}return t}function pIe(e,t){let n=new Map,r=new Map,i=-1,a=0,o=-1,s,c,l,u=()=>{if(!(o<0)&&typeof c==`number`&&typeof l==`number`){let e=Math.max(Math.round((l-c)/100)/10,0);r.set(o,{turnNumber:a,isTurnStart:!0,userIdx:o,turnDurationSecs:e})}};for(let d=0;d<e.length;d++){let f=e[d];if(f.role===`assistant`){s=t[d];let e=f;typeof e.timestamp==`number`&&e.timestamp>0&&(l=typeof e.durationMs==`number`&&e.durationMs>0?e.timestamp+e.durationMs:e.timestamp),a>0&&r.set(d,{turnNumber:a,isTurnStart:!1,userIdx:o})}else f.role===`toolResult`?n.set(`${s}:${f.toolCallId}`,f):f.role===`user`&&(u(),a+=1,o=d,i=d,r.set(d,{turnNumber:a,isTurnStart:!0,userIdx:d}),c=typeof f.timestamp==`number`&&f.timestamp>0?f.timestamp:void 0,l=void 0)}return u(),{toolResultsMap:n,turnInfoByMsgIdx:r,lastUserIdx:i}}function mIe(e){let t=new Map,n=0,r=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a.role===`user`){n+=1,r=i;let o;for(let t=i+1;t<e.length&&e[t].role!==`user`;t++){if(e[t].role!==`assistant`)continue;let n=e[t];typeof n.timestamp!=`number`||n.timestamp<=0||(o=typeof n.durationMs==`number`&&n.durationMs>0?n.timestamp+n.durationMs:n.timestamp)}let s=o&&typeof a.timestamp==`number`?Math.max(Math.round((o-a.timestamp)/100)/10,0):void 0;t.set(i,{turnNumber:n,isTurnStart:!0,userIdx:i,...typeof s==`number`?{turnDurationSecs:s}:{}})}else a.role===`assistant`&&n>0&&t.set(i,{turnNumber:n,isTurnStart:!1,userIdx:r})}return t}function hIe(e,t){if(t<0||t>=e.length)return[];let n=$X(e,t),r=[];for(let i=t+1;i<n;i++){let t=e[i],n=t?.role;(n===`user`||n===`assistant`||QX(t))&&r.push(i)}return r}function gIe({messageRefs:e,lastUserMsgRef:t,lastUserIdx:n}){return(r,i)=>a=>{e.current[i]=a,r===n&&(t.current=a)}}function _Ie({open:e,onOpenChange:t,title:n,header:r,children:i,className:a}){let o=(0,I.useRef)(null);return(0,I.useEffect)(()=>{let t=o.current;if(t){if(e){if(!t.matches(`:popover-open`))try{t.showPopover()}catch{}}else try{t.hidePopover()}catch{}}},[e]),(0,L.jsxs)(`div`,{ref:o,popover:`auto`,onToggle:e=>{e.target===o.current&&e.newState===`closed`&&e.oldState===`open`&&t(!1)},role:`dialog`,"aria-modal":`true`,className:HO(`turn-detail-modal`,`m-auto h-fit max-h-[calc(100dvh-2rem)]`,`w-[min(100%-2rem,48rem)] xl:w-[min(100%-2rem,64rem)]`,`flex-col gap-3 overflow-y-hidden rounded-xl bg-background p-4 text-sm text-foreground shadow-(--shadow-strong) ring-1 ring-foreground/10 outline-none`,e?`flex`:`hidden`,a),style:{position:`fixed`,inset:0,margin:`auto`},children:[r===void 0?n===void 0?null:(0,L.jsx)(`div`,{className:`pr-8 text-base font-semibold`,children:n}):(0,L.jsx)(`div`,{className:`flex flex-col gap-2 pr-8`,children:r}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`Close`,onClick:()=>t(!1),className:`absolute top-3 right-3 rounded-md p-1 text-muted-foreground opacity-70 transition-opacity hover:opacity-100`,children:(0,L.jsx)(cT,{className:`size-4`})}),(0,L.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto`,children:i})]})}var rZ=(0,I.createContext)(!1);function vIe(e){let t=e.clientHeight;return t<=0||t>=56?!1:e.scrollHeight>t+1}function iZ(e){let t=(0,I.useContext)(rZ);return e||t}var yIe=6;function bIe(e){let t=Math.max(1,String(Number.isFinite(e)?Math.max(0,Math.floor(e)):0).length);return Math.max(20,t*yIe+8)}var aZ=`--preview-rail-w`,oZ=`var(${aZ}, 20px)`;function sZ({items:e,autoScroll:t,compact:n,autoCompact:r,alwaysRender:i,stickBottomOnMount:a,testId:o,hintTestId:s,observeContent:c,wrapperStyle:l,scrollStyle:u,scrollStepPx:d,scrollElRef:f,virtualizerRef:p}){let m=(0,I.useRef)(null);(0,I.useEffect)(()=>{f&&(f.current=m.current)});let[h,g]=(0,I.useState)(!0),_=(0,I.useRef)(!1),v=(0,I.useCallback)(()=>{let e=m.current;if(e){if(e.scrollHeight-e.scrollTop-e.clientHeight<16){_.current=!1,g(!0);return}_.current&&g(!1)}},[]);(0,I.useEffect)(()=>{let e=m.current;if(!e)return;let t=0,n=e=>{e.deltaY<0&&(_.current=!0)},r=e=>{t=e.touches[0]?.clientY??0},i=e=>{let n=e.touches[0]?.clientY??0;n-t>2&&(_.current=!0),t=n},a=e=>{(e.key===`ArrowUp`||e.key===`PageUp`||e.key===`Home`)&&(_.current=!0)};return e.addEventListener(`wheel`,n,{passive:!0}),e.addEventListener(`touchstart`,r,{passive:!0}),e.addEventListener(`touchmove`,i,{passive:!0}),e.addEventListener(`keydown`,a),()=>{e.removeEventListener(`wheel`,n),e.removeEventListener(`touchstart`,r),e.removeEventListener(`touchmove`,i),e.removeEventListener(`keydown`,a)}},[]),(0,I.useEffect)(()=>{let n=m.current;if(!n||!t||!h||e.length===0)return;let r=()=>{n.scrollTop=n.scrollHeight};if(r(),typeof ResizeObserver>`u`)return;let i=0,a=new ResizeObserver(()=>{i||=requestAnimationFrame(()=>{i=0,r()})});a.observe(n);let o=n.firstElementChild;return o&&a.observe(o),()=>{a.disconnect(),cancelAnimationFrame(i)}},[e,t,h]),(0,I.useEffect)(()=>{let t=m.current;if(!t||!a||e.length===0)return;let n=0,r=0,i=!0,o=()=>{!i||r++>60||t.scrollTop+t.clientHeight>=t.scrollHeight-1||(t.scrollTop=t.scrollHeight,n=requestAnimationFrame(o))},s=()=>{i=!1,cancelAnimationFrame(n)};return t.addEventListener(`pointerdown`,s,{once:!0}),t.addEventListener(`wheel`,s,{once:!0,passive:!0}),n=requestAnimationFrame(o),()=>{s(),t.removeEventListener(`pointerdown`,s),t.removeEventListener(`wheel`,s)}},[a,e]);let y=(0,I.useMemo)(()=>({get current(){return m.current},set current(e){}}),[]),b=!i&&typeof ResizeObserver<`u`&&e.length>40,[x,S]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let e=m.current;if(!e||!r||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{S(vIe(e))});return t.observe(e),()=>t.disconnect()},[r]);let C=bIe(e.reduce((e,t)=>t.number!==void 0&&t.number>e?t.number:e,0)),w=n===!0,T=(0,I.useMemo)(()=>({...u,overflowAnchor:`none`,...w?{maxHeight:56}:{}}),[w,u]),E=(0,I.useMemo)(()=>({...l,[aZ]:`${C}px`}),[l,C]);return(0,L.jsx)(rZ.Provider,{value:x||w,children:(0,L.jsx)(MK,{direction:`vertical`,observeContent:c,testId:o,scrollStepPx:d,scrollElRef:m,onScroll:v,hintTestId:s,hintStyle:{left:1,right:`auto`,width:`calc(var(${aZ}, 20px) - 4px)`,transform:`none`},wrapperStyle:E,scrollStyle:T,hideHints:w,children:b?(0,L.jsx)(Kq,{ref:p,data:e,itemSize:200,bufferSize:400,scrollRef:y,children:e=>(0,L.jsx)(`div`,{children:e.node},e.key)}):(0,L.jsx)(`div`,{children:e.map(e=>(0,L.jsx)(`div`,{children:e.node},e.key))})})})}function cZ({mode:e,header:t,items:n,children:r,compact:i,autoScroll:a,scrollStepPx:o,wrapperStyle:s,scrollTestId:c,scrollElRef:l,virtualizerRef:u}){return(0,L.jsxs)(`div`,{style:{height:e===`live`?`100%`:void 0,background:`var(--bg)`,paddingTop:8,paddingBottom:e===`live`?8:0,boxSizing:`border-box`,display:`flex`,flexDirection:`column`},children:[t!=null&&(0,L.jsx)(`div`,{"data-testid":`turn-body-header-divider`,style:{borderBottom:`1px solid var(--border)`},children:t}),e===`live`?(0,L.jsx)(`div`,{style:{position:`relative`,flex:1,minHeight:0},children:(0,L.jsx)(sZ,{items:n??[],autoScroll:a,compact:i,autoCompact:!0,testId:c??`preview-overlay-scroll`,observeContent:!0,scrollStepPx:o,scrollElRef:l,virtualizerRef:u,wrapperStyle:s})}):r]})}function lZ(e){if(!e)return null;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 uZ(e){return typeof e==`string`?e:e.filter(e=>e.type===`text`).map(e=>e.text).join(`
540
+ `).trim()}function SFe(e){return e.role===`assistant`?wFe(CFe((e.content??[]).filter(e=>e.type===`text`).map(e=>e.text).join(` `)),120):``}function CFe(e){if(!e)return``;let t=e;return t=t.replace(/```[\s\S]*?(```|$)/g,` `),t=t.replace(/`([^`]*)`/g,`$1`),t=t.replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`),t=t.replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`),t=t.split(/\n/).map(e=>e.replace(/^\s{0,3}#{1,6}\s+/,``).replace(/^\s{0,3}>\s?/,``).replace(/^\s*[-*+]\s+/,``).replace(/^\s*\d+[.)]\s+/,``).replace(/^\s*\|.*\|\s*$/,``).trim()).filter(e=>e.length>0&&!/^(---+|\*{3,}|___{3,})$/.test(e)).join(` `),t=t.replace(/(\*\*|__)([^*_]+)\1/g,`$2`),t=t.replace(/(\*|_)([^*_]+)\1/g,`$2`),t.replace(/\s+/g,` `).trim()}function wFe(e,t){return t<=0?``:e.length<=t?e:`${e.slice(0,t).trimEnd()}…`}var TFe=(0,I.memo)(function({summary:e,onClick:t}){return e?(0,L.jsx)(`button`,{type:`button`,className:TX.summary,onClick:t,children:e}):null});function EFe(e){return e.map((e,t)=>({topRatio:0,targetTurn:e,index:t}))}function DFe({allNodes:e,nearestNode:t,previewBoxRef:n,onShowPreview:r,onHidePreview:i,onJumpUser:a,onJumpAssistant:o}){return(0,L.jsx)(`div`,{ref:n,popover:`manual`,className:TX.preview,"data-minimap-preview-box":``,onMouseEnter:r,onMouseDown:e=>e.stopPropagation(),onMouseMove:e=>e.stopPropagation(),children:t!==null&&(()=>{let n=e.length,r=Math.min(Math.max(0,t.index-1),Math.max(0,n-3));return e.slice(r,r+3).map(e=>(0,L.jsxs)(`div`,{className:TX.turn,"data-minimap-preview-index":e.index,"data-located":e.index===t.index?`true`:void 0,children:[(0,L.jsx)(`span`,{className:TX.number,"aria-hidden":`true`,children:String(e.index+1)}),(0,L.jsxs)(`div`,{className:TX.content,children:[(0,L.jsx)(`button`,{type:`button`,className:TX.user,"data-minimap-preview-user":e.index,onClick:()=>{a(e),i()},children:(0,L.jsx)(`span`,{className:TX.userText,children:xFe(e.targetTurn.userMessage)})}),e.targetTurn.assistantPreviews.map((t,n)=>(0,L.jsxs)(`div`,{className:TX.assistant,children:[(0,L.jsx)(`button`,{type:`button`,className:TX.assistantJump,"data-minimap-preview-assistant":`${e.index}-${n}`,onClick:()=>{o(e,n),i()},"aria-label":`Locate assistant message`,children:`A`}),(0,L.jsx)(TFe,{summary:t.summary,onClick:()=>{o(e,n),i()}})]},n))]})]},e.index))})()})}function EX(e,t){return t?e.querySelector(`[data-row-key="message-${t.msgIdx}-answer"]`)??t.element??null:null}var OFe=1600;function kFe(e){let t=0;for(let n of e)n.role===`user`&&t++;return t}var AFe=30,jFe=2,DX=.3;function MFe(e,t,n,r,i){let a=[],o=0,s=null;for(let c=0;c<e.length;c++){let l=e[c];if(l.role!==`user`&&l.role!==`assistant`)continue;let u=t.current?.[o];o++;let d=null;if(n?d=n(c):u&&(d=u.getBoundingClientRect().top-r.top+i.scrollTop),l.role===`user`){s=null,s={userMessage:l,userMsgIdx:c,userElement:u,assistantPreviews:[],scrollTop:d},a.push(s);continue}if(!s)continue;let f=SFe(l);f&&(s.assistantPreviews=[{summary:f,element:u,msgIdx:c}])}return a}function OX(e,t,n,r){let i=e.assistantIndex===void 0?null:t.targetTurn.assistantPreviews[e.assistantIndex],a=e=>{let t=e?.getBoundingClientRect();return t?t.top-n.top+r.scrollTop:null};if(e.target===`user`){let e=t.targetTurn.userElement;return e?.isConnected?a(e):a(r.querySelector(`[data-row-key="${CSS.escape(`group-header-${t.targetTurn.userMsgIdx}`)}"]`))}return e.target===`assistant`?a(EX(r,i??void 0)):null}function NFe(e,t,n){let r=0,i=0,a=!1,o=()=>{a=!0};window.addEventListener(`wheel`,o,{once:!0,passive:!0}),window.addEventListener(`touchstart`,o,{once:!0,passive:!0});let s=()=>{if(a)return;let o=OX(t,n,e.getBoundingClientRect(),e);if(o===null)return;let c=o-e.clientHeight*DX-e.scrollTop;if(Math.abs(c)>1)e.scrollBy(0,c),i=0;else if(++i>=jFe)return;++r<=AFe&&requestAnimationFrame(s)};requestAnimationFrame(s)}function PFe({messages:e,streamingMessage:t,scrollContainer:n,messageRefs:r,resolveMessageOffset:i,containerRef:a,railBoxRef:o,allNodesRef:s,pendingNavigationRef:c}){let[l,u]=(0,I.useState)([]),d=(0,I.useMemo)(()=>kFe(e)>0,[e]),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(600),g=(0,I.useRef)(null),_=(0,I.useMemo)(()=>t?[...e,t]:e,[e,t]),v=(0,I.useRef)(_);(0,I.useEffect)(()=>{v.current=_});let y=(0,I.useCallback)(e=>{g.current={index:e,until:Date.now()+OFe},p(e)},[]),b=(0,I.useCallback)((e,t,n=!1)=>{let r=g.current;if(r&&Date.now()<r.until){if(n)g.current=null;else{p(r.index);return}}if(g.current=null,e.scrollHeight-e.clientHeight-e.scrollTop<=16&&t.length>0){p(t[t.length-1].index);return}let i=e.scrollTop+e.clientHeight/2,a=e.getBoundingClientRect().top,o=null;for(let n of t){let t=n.targetTurn.userElement,r=n.targetTurn.scrollTop;if(t?.isConnected&&(r=t.getBoundingClientRect().top-a+e.scrollTop),r!==null){if(r<=i)o=n;else break}}p(o?o.index:null)},[]),x=(0,I.useCallback)(()=>{let e=n.current;if(!e||e.scrollHeight-e.clientHeight-e.scrollTop>16)return;let t=o.current;if(!t)return;let r=Math.max(0,t.scrollHeight-t.clientHeight);t.scrollTop!==r&&(t.scrollTop=r)},[n,o]),S=(0,I.useCallback)(()=>{if(document.hidden)return;let e=n.current;e&&(b(e,s.current,!0),x())},[n,s,b,x]),C=(0,I.useRef)(null),w=(0,I.useCallback)(()=>{if(document.hidden)return;let e=n.current,t=a.current;if(!e||!t)return;let o=e.getBoundingClientRect(),l=EFe(MFe(v.current,r,i,o,e));h(t.clientHeight),s.current=l,u(l),b(e,l),x();let d=c.current;if(!d)return;let f=l[d.nodeIndex];if(!f)return;let p=OX(d,f,o,e);if(p===null)return;c.current=null,y(f.index);let m=e.clientHeight*DX;e.scrollTo({top:Math.max(0,p-m)}),NFe(e,d,f)},[y,r,i,n,a,s,c,b,x]),T=(0,I.useCallback)(()=>{document.hidden||(C.current||=setTimeout(()=>{C.current=null,!document.hidden&&w()},150))},[w]);return(0,I.useEffect)(()=>{let e=n.current;if(e)return e.addEventListener(`scroll`,S,{passive:!0}),()=>e.removeEventListener(`scroll`,S)},[n,S]),(0,I.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{document.hidden||(T(),S())},r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),t(),()=>{r.disconnect(),C.current&&=(clearTimeout(C.current),null)}},[T,n,S]),(0,I.useEffect)(()=>{let e=setTimeout(()=>{T(),S()},50);return()=>clearTimeout(e)},[e.length,T,S]),{allNodes:l,activeIndex:f,minimapHeight:m,visible:d,lockActiveNode:y,measureNodes:T}}function kX(e,t,n={}){let r=n.ratio??.3,i=n.frameBudget??40,a=n.stableFrames??2,o=n.quietFrames??0,{onDone:s}=n,c=!1,l=0,u=(n,i,d,f)=>{if(c)return;let p=e.scrollTop,m=f!==null&&Math.abs(p-f)<1?d+1:0;if(m<o&&n>0){l=requestAnimationFrame(()=>u(n-1,0,m,p));return}let h=t();if(h===null){if(n>0){l=requestAnimationFrame(()=>u(n-1,0,m,p));return}s?.();return}let g=h.getBoundingClientRect().top-e.getBoundingClientRect().top-e.clientHeight*r;if(Math.abs(g)>1)e.scrollBy(0,g),i=0;else if(++i>=a){s?.();return}if(n>0){l=requestAnimationFrame(()=>u(n-1,i,m,p));return}s?.()};return l=requestAnimationFrame(()=>u(i,0,0,null)),()=>{c=!0,cancelAnimationFrame(l)}}function FFe({scrollContainer:e,resolveMessageOffset:t,onWindowJumpTo:n,onScrollToMessageIndex:r,lockActiveNode:i,measureNodes:a,pendingNavigationRef:o,jumpToFoldedTurnEntry:s,jumpToCurrentTurn:c}){let l=(0,I.useRef)(null),u=(0,I.useCallback)((t,r=`smooth`)=>{let i=e.current;if(!i)return;let a=Math.max(0,t-i.clientHeight*.3);Math.abs(a-i.scrollTop)>i.clientHeight*3||r===`auto`?(n(a),l.current=a):i.scrollTo({top:a,behavior:r})},[n,e]),d=(0,I.useCallback)((e,n=`smooth`)=>{if(r?.(e))return!0;let i=t?.(e)??null;return i!==null&&(u(i,n),!0)},[u,r,t]);(0,I.useLayoutEffect)(()=>{let t=l.current;if(t===null)return;l.current=null;let n=e.current;n&&(n.scrollTop=t)});let f=(0,I.useCallback)((e,t,n=`smooth`)=>{if(!t.isConnected)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect().top-r.top+e.scrollTop-e.clientHeight*.3,a=Math.abs(i-e.scrollTop)>e.clientHeight*3;e.scrollTo({top:Math.max(0,i),behavior:a||n===`auto`?`auto`:n}),kX(e,()=>t.isConnected?t:null,{frameBudget:300,stableFrames:3,quietFrames:3})},[]);return{scrollToNode:(0,I.useCallback)((t,n)=>{let r=e.current;if(!r||(i(t.index),c?.(t.targetTurn.userMsgIdx)))return;if(t.targetTurn.scrollTop===null){r.scrollTo({top:r.scrollHeight,behavior:n});return}let s=t.targetTurn.userElement;if(s?.isConnected){i(t.index),f(r,s,n);return}o.current={nodeIndex:t.index,target:`user`},d(t.targetTurn.userMsgIdx,n)||setTimeout(()=>a(),400)},[d,c,i,a,e,f,o]),scrollToAssistant:(0,I.useCallback)((t,n)=>{let r=e.current;if(!r)return;let c=t.targetTurn.assistantPreviews[n],l=EX(r,c);if(!l){if(o.current={nodeIndex:t.index,target:`assistant`,assistantIndex:n},!(c&&d(c.msgIdx))){s?.(t.targetTurn.userMsgIdx);return}setTimeout(()=>a(),400);return}i(t.index),f(r,l)},[s,d,i,a,e,f,o])}}var IFe=PT(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function LFe({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?VT:`span`;return(0,L.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:HO(IFe({variant:t}),e),...r})}function AX({number:e,active:t=!1,highlighted:n=!1}){return(0,L.jsx)(LFe,{variant:`outline`,className:`h-[1.6em] w-[3em] rounded-[0.25em] border-[1.5px] p-0 font-mono text-[0.625rem] font-semibold leading-none`,style:{background:t?`color-mix(in srgb, var(--accent) 12%, transparent)`:n?`color-mix(in srgb, var(--accent) 10%, transparent)`:`transparent`,borderColor:t||n?`var(--accent)`:`color-mix(in srgb, var(--text) 65%, transparent)`,boxShadow:t?`0 0 0 2px var(--bg-panel)`:n?`0 0 0 1px var(--accent), 0 1px 2px -1px var(--shadow-color)`:`0 1px 2px -1px var(--shadow-color)`,transition:`transform 0.1s, background 0.1s, box-shadow 0.1s`,transform:n?`scale(1.15)`:`scale(1)`},children:(0,L.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,lineHeight:1,fontFamily:`var(--font-mono)`,fontWeight:600,userSelect:`none`,color:t?`var(--accent)`:`var(--text)`},children:String(e)})})}var RFe=48,jX=12,MX=26,NX=2,zFe=250;function BFe({node:e,isActive:t,isNearest:n,onSelect:r,onRevealChange:i,onMouseDown:a}){let{ref:o,handlers:s}=lJ({onChange:i});return(0,L.jsx)(`div`,{ref:o,...s,"data-minimap-node-index":e.index,"data-minimap-node-active":t?``:void 0,style:{position:`absolute`,top:jX+e.index*MX,transform:`translateY(-50%)`,left:0,right:0,height:MX,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`auto`,zIndex:2},children:(0,L.jsx)(`span`,{onClick:r,onMouseDown:a,style:{display:`inline-flex`,cursor:`pointer`},children:(0,L.jsx)(AX,{number:e.index+1,active:t,highlighted:n})})})}function VFe({messages:e,streamingMessage:t,scrollContainer:n,messageRefs:r,resolveMessageOffset:i,scrollStepPx:a=200,onWindowJumpTo:o,onScrollToMessageIndex:s,jumpToFoldedTurnEntry:c,jumpToCurrentTurn:l,sid:u,bottomInset:d=0}){let[f,p]=(0,I.useState)(0),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(null),v=(0,I.useRef)(!1),y=(0,I.useRef)(null),b=(0,I.useRef)(null),x=(0,I.useRef)(null),S=(0,I.useRef)([]),C=(0,I.useRef)(null),w=(0,I.useRef)(null),T=(0,I.useRef)(null),E=(0,I.useRef)(null),D=(0,I.useRef)(null),O=(0,I.useRef)(null),{allNodes:k,activeIndex:A,minimapHeight:j,visible:M,lockActiveNode:N,measureNodes:ee}=PFe({messages:e,streamingMessage:t,scrollContainer:n,messageRefs:r,resolveMessageOffset:i,containerRef:y,railBoxRef:b,allNodesRef:S,pendingNavigationRef:O});(0,I.useEffect)(()=>{u&&(Kje(u,A),Jje(u,A===null?null:k[A]?.targetTurn.userMsgIdx??null))},[u,A,k]);let{scrollToNode:te,scrollToAssistant:P}=FFe({scrollContainer:n,resolveMessageOffset:i,onWindowJumpTo:o,onScrollToMessageIndex:s,lockActiveNode:N,measureNodes:ee,pendingNavigationRef:O,jumpToFoldedTurnEntry:c,jumpToCurrentTurn:l}),F=(0,I.useCallback)(e=>{let t=S.current;if(t.length===0)return null;let n=Math.round((e-jX)/MX);return t[Math.max(0,Math.min(n,t.length-1))]??null},[]),ne=LN(),re=(0,I.useCallback)(()=>{ne.cancel(),h(!0)},[ne]),ie=(0,I.useCallback)(()=>{ne.cancel(),h(!1),_(null)},[ne]),ae=(0,I.useCallback)(()=>{ne.schedule(ie,zFe)},[ne,ie]);(0,I.useEffect)(()=>()=>{T.current!==null&&cancelAnimationFrame(T.current),E.current!==null&&cancelAnimationFrame(E.current)},[]);let oe=(0,I.useCallback)(()=>{if(!M)return;let e=b.current;if(!e)return;v.current=!0,re();let t=e.getBoundingClientRect(),n=e.scrollTop,r=e=>{v.current&&E.current===null&&(E.current=requestAnimationFrame(()=>{E.current=null,_(n+(e.clientY-t.top))}))},i=()=>{v.current=!1,E.current!==null&&(cancelAnimationFrame(E.current),E.current=null),window.removeEventListener(`mousemove`,r),window.removeEventListener(`mouseup`,i)};window.addEventListener(`mousemove`,r),window.addEventListener(`mouseup`,i)},[re,M]),se=g===null?null:F(g);(0,I.useLayoutEffect)(()=>{if(!m||se===null)return;let e=C.current;if(!e)return;let t=b.current;try{e.showPopover?.({source:t??void 0})}catch{}let n=t?.scrollTop??0,r=jX+se.index*MX-n,i=Math.max(0,j-e.offsetHeight),a=Math.min(Math.max(r-e.offsetHeight/2,0),i),o=t?.getBoundingClientRect().top??0;e.style.top=`${o+a}px`},[m,se,j,f]);let ce=(0,I.useCallback)(()=>{x.current===null&&(x.current=requestAnimationFrame(()=>{x.current=null;let e=b.current;e&&p(e.scrollTop)}))},[]),le=(0,I.useCallback)(e=>{let t=b.current;if(!t)return;let n=Math.max(0,t.scrollHeight-t.clientHeight);w.current=e===`top`?0:n,t.scrollTo({top:e===`top`?0:n,behavior:`smooth`})},[]),ue=(0,I.useCallback)(e=>{let t=b.current;if(!t)return;let n=Math.max(0,t.scrollHeight-t.clientHeight),r=w.current??t.scrollTop,i=Math.max(0,Math.min(n,r+e*a));w.current=i,t.scrollTo({top:i,behavior:`auto`})},[a]);if(!M)return null;let de=k.length*MX+24,fe=Math.max(1,j),pe=Math.max(0,Math.floor(f/MX)-NX),me=Math.min(k.length,Math.ceil((f+fe)/MX)+NX),he=k.slice(pe,me),ge=f<=2,_e=f>=de-fe-2;return(0,L.jsxs)(`div`,{ref:y,"data-testid":`chat-minimap`,"data-minimap":``,onMouseLeave:()=>{ae()},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=(b.current?.scrollTop??0)+(e.clientY-t.top);D.current=n,T.current===null&&(T.current=requestAnimationFrame(()=>{T.current=null,_(D.current??0)}))},style:{width:RFe,position:`absolute`,top:0,bottom:d,right:vPe,zIndex:130,cursor:`default`,userSelect:`none`},children:[(0,L.jsx)(`div`,{ref:b,"data-minimap-rail":``,onScroll:ce,onMouseMove:e=>{let t=b.current,n=e.currentTarget.getBoundingClientRect(),r=(t?.scrollTop??0)+(e.clientY-n.top);D.current=r,T.current===null&&(T.current=requestAnimationFrame(()=>{T.current=null,_(D.current??0)}))},style:{position:`absolute`,inset:0,overflowY:`auto`,scrollbarWidth:`none`,overflowAnchor:`none`,cursor:`default`,userSelect:`none`},children:(0,L.jsx)(`div`,{style:{position:`relative`,height:de},children:he.map(e=>{let t=m&&se?.index===e.index,n=A===e.index;return(0,L.jsx)(BFe,{node:e,isActive:n,isNearest:t,onSelect:()=>te(e,`smooth`),onMouseDown:oe,onRevealChange:t=>{t?(_(jX+e.index*MX),re()):ae()}},e.index)})})}),ge?null:(0,L.jsx)(OK,{direction:`up`,visible:!0,onHover:()=>ue(-1),onClick:()=>le(`top`),testId:`rail-scroll-up`}),_e?null:(0,L.jsx)(OK,{direction:`down`,visible:!0,onHover:()=>ue(1),onClick:()=>le(`bottom`),testId:`rail-scroll-down`}),m&&k.length>0&&(0,L.jsx)(DFe,{allNodes:k,nearestNode:se,previewBoxRef:C,onShowPreview:re,onHidePreview:ie,onJumpUser:e=>te(e,`smooth`),onJumpAssistant:P})]})}function HFe(e){let t=(0,I.useRef)([]);return t.current=Array(e).fill(null).map((e,n)=>t.current[n]??null),t}var PX={current:null};function FX(e){if(e.type!==`thinking`)return!1;let t=e;return t.thinking.trim()===``&&!!(t.redacted||typeof t.thinkingSignature==`string`&&t.thinkingSignature.trim().length>0)}function IX(e,t={}){return e.type===`thinking`&&!e.deferred&&!t.isStreaming&&e.thinking.trim()===``&&!FX(e)}function LX(e,t={}){return(e.content??[]).filter(e=>!IX(e,t))}function RX(e,t={}){return t.isStreaming||e.stopReason!==`error`?null:e.errorMessage?.trim()||`Unknown provider error`}function UFe(e){return e.type===`text`||e.type===`image`}function zX(e,t={}){let n=LX(e,t),r=n.findLastIndex(e=>!UFe(e));return r===-1?{answerBlocks:n,processBlocks:[]}:{answerBlocks:n.slice(r+1),processBlocks:n.slice(0,r+1)}}function BX(e){return e.filter(e=>e.type===`toolCall`).length}function VX(e){if(e.role!==`assistant`)return null;let t=RX(e);return!t||/abort/i.test(t)?null:t}function WFe(e,t={}){let n=RX(e,t);return n&&/abort/i.test(n)?!0:e.stopReason===`aborted`&&!e.suppressAbortBanner}function HX(e){let t=UX(e);if(t){let e=0,n=0;for(let r of t)for(let t of r.rows)t.type===`line`&&(t.left.type===`removed`&&(n+=1),t.right.type===`added`&&(e+=1));return{additions:e,deletions:n}}let n=0,r=0;for(let t of e.split(/\r?\n/))t.startsWith(`+`)&&!t.startsWith(`+++`)?n+=1:t.startsWith(`-`)&&!t.startsWith(`---`)&&(r+=1);return{additions:n,deletions:r}}function UX(e){let t=[],n=null,r,i=0,a=0,o=[],s=[],c=()=>({lineNo:null,text:``,type:`empty`}),l=()=>{if(!n){o=[],s=[];return}let e=Math.max(o.length,s.length);for(let t=0;t<e;t++){let e=o[t]?{lineNo:o[t].lineNo,text:o[t].text,type:`removed`}:c(),r=s[t]?{lineNo:s[t].lineNo,text:s[t].text,type:`added`}:c();n.rows.push({type:`line`,left:e,right:r})}o=[],s=[]};for(let c of e.split(/\r?\n/)){if(c.startsWith(`--- `)){l(),r=WX(c.slice(4));continue}if(c.startsWith(`+++ `)){l(),n={oldPath:r,newPath:WX(c.slice(4)),rows:[]},t.push(n);continue}let e=c.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(e){n||(n={rows:[]},t.push(n)),l(),i=Number(e[1]),a=Number(e[2]),n.rows.push({type:`hunk`,text:c});continue}if(!n)continue;if(c.startsWith(`\\ `)){l(),n.rows.push({type:`hunk`,text:c});continue}let u=c[0],d=c.slice(1);u===` `?(l(),n.rows.push({type:`line`,left:{lineNo:i++,text:d,type:`context`},right:{lineNo:a++,text:d,type:`context`}})):u===`-`?o.push({lineNo:i++,text:d}):u===`+`?s.push({lineNo:a++,text:d}):c!==``&&(l(),n.rows.push({type:`hunk`,text:c}))}l();let u=t.filter(e=>e.rows.some(e=>e.type===`line`));return u.length>0?u:null}function WX(e){return e.split(` `)[0].trim()}function GFe(e){let t=e.details;if(!rA(t))return null;let n=typeof t.patch==`string`?t.patch:null;if(n)return{text:n};let r=typeof t.diff==`string`?t.diff:null;return r?{text:r}:null}function GX(e){if(typeof e!=`string`||!e)return!1;let t=e.toLowerCase();return t===`edit`||t.startsWith(`edit_`)||t.endsWith(`.edit`)||t.endsWith(`_edit`)||t.includes(`str_replace`)||t.includes(`replace_editor`)}function KFe({diff:e}){return(0,L.jsx)(`div`,{style:{marginTop:6,borderRadius:`var(--radius-md, 6px)`,overflow:`hidden`,background:`var(--bg-subtle)`},children:(0,L.jsx)(qFe,{text:e.text})})}function qFe({text:e}){let{t}=z(),n=(0,I.useMemo)(()=>UX(e),[e]);if(!n)return(0,L.jsx)(XFe,{text:e});let r=n.length>1;return(0,L.jsx)(`div`,{style:{maxHeight:560,overflowY:`auto`,overflowX:`hidden`,background:`transparent`,contentVisibility:`auto`,containIntrinsicBlockSize:560},children:n.map((e,n)=>(0,L.jsxs)(`div`,{style:{minWidth:0,borderTop:n===0?`none`:`1px solid var(--border)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,lineHeight:1.55},children:[r&&(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) minmax(0, 1fr)`,position:`sticky`,top:0,zIndex:1,background:`var(--bg-subtle)`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsx)(KX,{title:e.oldPath||t(`i18n.before`),side:`left`}),(0,L.jsx)(KX,{title:e.newPath||t(`i18n.after`),side:`right`})]}),(0,L.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) minmax(0, 1fr)`},children:e.rows.map((e,t)=>e.type===`hunk`?null:(0,L.jsxs)(`div`,{style:{display:`contents`},children:[(0,L.jsx)(qX,{cell:e.left,side:`left`}),(0,L.jsx)(qX,{cell:e.right,side:`right`})]},t))})]},n))})}function KX({title:e,side:t}){return(0,L.jsx)(`div`,{title:e,style:{padding:`5px 10px`,color:`var(--text-dim)`,borderRight:t===`left`?`1px solid var(--border)`:`none`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e})}function qX({cell:e,side:t}){let n=e.type===`added`?`color-mix(in srgb, var(--status-success) 12%, transparent)`:e.type===`removed`?`color-mix(in srgb, var(--status-error) 13%, transparent)`:e.type===`empty`?`var(--bg-subtle)`:`transparent`,r=e.type===`added`?`+`:e.type===`removed`?`-`:` `,i=e.type===`added`?`var(--status-success)`:e.type===`removed`?`var(--status-error)`:`var(--text-dim)`;return(0,L.jsxs)(`div`,{style:{display:`flex`,minWidth:0,background:n,borderRight:t===`left`?`1px solid var(--border)`:`none`},children:[(0,L.jsx)(`span`,{style:{width:42,padding:`0 6px`,textAlign:`right`,color:`var(--text-dim)`,userSelect:`none`,background:`var(--bg)`,borderRight:`1px solid var(--border)`,flexShrink:0},children:e.lineNo??``}),(0,L.jsx)(`span`,{style:{width:18,padding:`0 5px`,color:i,userSelect:`none`,fontWeight:e.type===`context`||e.type===`empty`?400:700,flexShrink:0},children:r}),(0,L.jsx)(`span`,{style:{flex:1,minWidth:0,padding:`0 10px 0 0`,color:e.type===`empty`?`var(--text-dim)`:`var(--text)`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e.text||`\xA0`})]})}var JFe={added:{bg:`color-mix(in srgb, var(--status-success) 12%, transparent)`,color:`var(--status-success)`,borderLeft:`3px solid var(--status-success)`},removed:{bg:`color-mix(in srgb, var(--status-error) 13%, transparent)`,color:`var(--status-error)`,borderLeft:`3px solid var(--status-error)`},hunk:{bg:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`,borderLeft:`3px solid var(--accent)`},context:{bg:`transparent`,color:`var(--text)`,borderLeft:`3px solid transparent`}};function YFe(e){return e.startsWith(`@@`)?`hunk`:e.startsWith(`+`)&&!e.startsWith(`+++`)?`added`:e.startsWith(`-`)&&!e.startsWith(`---`)?`removed`:`context`}function XFe({text:e}){let t=e.split(/\r?\n/);return(0,L.jsx)(`div`,{style:{maxHeight:520,overflowY:`auto`,overflowX:`hidden`,fontFamily:`var(--font-mono)`,contentVisibility:`auto`,containIntrinsicBlockSize:520,fontSize:`var(--text-base)`,lineHeight:1.55,minWidth:0},children:t.map((e,t)=>{let{bg:n,color:r,borderLeft:i}=JFe[YFe(e)];return(0,L.jsxs)(`div`,{style:{display:`flex`,background:n,borderLeft:i},children:[(0,L.jsx)(`span`,{style:{width:48,padding:`0 8px`,color:`var(--text-dim)`,background:`var(--bg)`,borderRight:`1px solid var(--border)`,textAlign:`right`,userSelect:`none`,flexShrink:0},children:t+1}),(0,L.jsx)(`span`,{style:{padding:`0 10px`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,color:r},children:e||`\xA0`})]},t)})})}function ZFe(e){if(typeof e!=`string`||!e)return!1;let t=e.toLowerCase();return t===`write`||t.startsWith(`write_`)||t.endsWith(`.write`)||t.endsWith(`_write`)}function QFe(e){let t=`path`in e?e.path:`file_path`in e?e.file_path:void 0;return typeof t==`string`&&t.trim().length>0?t:null}function JX(e){let t=[],n=[];for(let r of e.split(/\r?\n/))r.startsWith(`+`)&&!r.startsWith(`+++`)?t.push(r.slice(1)):r.startsWith(`-`)&&!r.startsWith(`---`)&&n.push(r.slice(1));return[t,n]}function YX(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((e,t)=>e===r[t])}function $Fe(e,t){let[n,r]=JX(e),[i,a]=JX(t);return n.length+r.length===0||i.length+a.length===0?!1:YX(n,a)&&YX(r,i)}function eIe(e,t,n){let r=new Map;for(let i=t;i<n;i++){let t=e[i];if(t.role!==`toolResult`)continue;let n=t.details;if(!n||typeof n!=`object`)continue;let a=n,o=typeof a.patch==`string`&&a.patch?a.patch:typeof a.diff==`string`&&a.diff?a.diff:null;o&&r.set(t.toolCallId,o)}let i=new Map;for(let a=t;a<n;a++){let t=e[a];if(t.role===`assistant`)for(let e of t.content){if(e.type!==`toolCall`||!(GX(e.toolName)||ZFe(e.toolName)))continue;let t=QFe(e.input);if(!t)continue;let n=r.get(e.toolCallId),a={toolName:e.toolName,...n?{stats:HX(n),patchText:n}:{}},o=i.get(t)??[],s=o[o.length-1];s?.patchText&&n&&$Fe(s.patchText,n)?o.pop():o.push(a),i.set(t,o)}}return[...i.entries()].filter(([,e])=>e.length>0).map(([e,t])=>{let n=t[t.length-1];return{path:e,toolName:n.toolName,...n.stats?{stats:n.stats}:{}}})}function XX(e){return e.role===`user`?96:e.role===`assistant`?260:120}function tIe(e){return e.role===`assistant`&&zX(e).answerBlocks.some(e=>e.type===`image`||e.type===`text`&&e.text.trim().length>0)}function ZX(e,t,n){for(let r=n-1;r>t;r--)if(tIe(e[r]))return r;for(let r=n-1;r>t;r--)if(e[r]?.role===`assistant`)return r;return-1}function nIe(e,t){let n=0;for(let r of t){let t=e[r];t?.role===`assistant`&&(n+=BX(LX(t)))}return n}function QX(e){return e.role===`custom`&&!eZ(e)}function $X(e,t){let n=t+1;for(;n<e.length&&!eZ(e[n]);)n+=1;return n}function rIe(e){return e.role===`assistant`?LX(e).length>0:e.role===`custom`}function eZ(e){return e.role===`user`||e.role===`custom`&&e.customType===`compaction`}function tZ(e,t,n={}){let r={...e,content:t};return n.omitUsage&&(r.usage=void 0),n.suppressAbortBanner&&(r.suppressAbortBanner=!0),r}function iIe(e,t){let{messages:n,userIdx:r,endIdx:i,finalAssistantIdx:a,pushMessage:o,skipUserRow:s}=t;(!s||n[r].role!==`user`)&&o(r);let c=[];for(let e=r+1;e<a;e++)QX(n[e])||c.push(e);let l=c.filter(e=>rIe(n[e])),u=n[a],d=zX(u),f=d.processBlocks.length>0?tZ(u,d.processBlocks,{omitUsage:!0,suppressAbortBanner:!0}):null,p=d.answerBlocks.length>0||RX(u)||u.stopReason===`aborted`?tZ(u,d.answerBlocks):null,m=l.length+ +!!f;m>0&&(l.forEach((e,t)=>{o(e,{isProcess:!0,attachRef:t===0&&void 0,groupLast:!f&&t===l.length-1})}),f&&o(a,{isProcessFinal:!0,attachRef:!1,messageOverride:f,showTimestamp:!1,groupLast:!0})),p&&e.push({key:`message-${a}-answer`,kind:`message`,msgIdx:a,estimate:XX(n[a]),messageOverride:p,isAnswer:!0,showTimestamp:!1});let h=eIe(n,r,i),g=[];for(let e of n.slice(r+1,a+1)){if(e?.role!==`assistant`)continue;let t=VX(e);t&&g.push({kind:`error`,parts:[t]});for(let t of e.content)if(t){if(t.type===`text`&&t.text.trim().length>0){let e=g[g.length-1];e?.kind===`text`?e.parts.push(t.text):g.push({kind:`text`,parts:[t.text]})}else if(t.type===`thinking`&&t.thinking.trim().length>0){let e=g[g.length-1];e?.kind===`thinking`?e.parts[0]+=`\n\n${t.thinking}`:g.push({kind:`thinking`,parts:[t.thinking]})}}}for(let e=a+1;e<i;e++){let t=n[e];if(t?.role!==`assistant`)continue;let r=VX(t);r&&g.push({kind:`error`,parts:[r]})}let _=g.length>0?g:void 0;e.push({key:`group-header-${r}`,kind:`groupHeader`,groupUserIdx:r,finalAssistantIdx:a,messageCount:m+ +!!p,toolCallCount:nIe(n,l)+BX(d.processBlocks),artifacts:h.length>0?h:void 0,answerPreview:_,estimate:40});let v=Array.from({length:Math.max(0,i-a-1)},(e,t)=>a+1+t).filter(e=>!QX(n[e]));for(let e of v)o(e)}function aIe(e,t){let{userIdx:n,endIdx:r,pushMessage:i,skipUserRow:a}=t;a||i(n),e.push({key:`group-header-${n}`,kind:`groupHeader`,groupUserIdx:n,finalAssistantIdx:n,messageCount:0,toolCallCount:0,estimate:40});for(let e=n+1;e<r;e++)i(e)}function oIe(){return{turns:new Map}}function sIe(e,t,n,r){if(r.length!==n-t)return!1;for(let n=0;n<r.length;n++)if(e[t+n]!==r[n])return!1;return!0}function nZ(e,t,n,r){let i=[],a=(t,n={})=>{i.push({key:`message-${t}`,kind:`message`,msgIdx:t,estimate:XX(e[t]),...n})},o=ZX(e,t,n);return o===-1?aIe(i,{userIdx:t,endIdx:n,pushMessage:a,skipUserRow:r}):iIe(i,{messages:e,userIdx:t,endIdx:n,finalAssistantIdx:o,pushMessage:a,skipUserRow:r}),i}function cIe(e,t,n){let r=[],i=new Set,a=`D${t.detachedTurnUserIdx}|L${+!!t.isLiveTail}`,o=n!==void 0&&n.last!==void 0;for(let s=0;s<e.length;){let c=e[s];if(!eZ(c)){o=!1,r.push({key:`message-${s}`,kind:`message`,msgIdx:s,estimate:XX(e[s])}),s+=1;continue}let l=s,u=$X(e,l);if(a+=`|${l}:${u}`,l===t.detachedTurnUserIdx){s=u;continue}i.add(l);let d=n?.turns.get(l);if(d&&sIe(e,l,u,d.refs)){r.push(...d.rows),s=u;continue}o=!1;let f=nZ(e,l,u,!0);n&&n.turns.set(l,{refs:e.slice(l,u),rows:f}),r.push(...f),s=u}if(o&&n){let e=n.last;if(e&&e.sig===a)return e.rows}if(n){for(let e of n.turns.keys())i.has(e)||n.turns.delete(e);n.last={sig:a,rows:r}}return r}function lIe(e,t){if(t<0||t>=e.length||!eZ(e[t]))return[];let n=nZ(e,t,$X(e,t),!1);for(let e of n)e.kind===`message`&&(e.attachRef=!1);return n}function uIe(e,t){if(t<0||t>=e.length)return!0;let n=ZX(e,t,$X(e,t));if(n===-1)return!1;let r=e[n];return r?.role===`assistant`?r.stopReason===`stop`||r.stopReason===`aborted`:!1}function dIe(e){let t=new Map;return e.forEach((e,n)=>{e.kind===`message`?t.set(e.msgIdx,n):e.kind===`groupHeader`&&!t.has(e.groupUserIdx)&&t.set(e.groupUserIdx,n)}),t}function fIe(e){let t=new Map;{let n=0;for(let r=0;r<e.length;r++)e[r].role===`user`?(n+=1,t.set(r,n)):e[r].role===`assistant`&&n>0&&t.set(r,n)}return t}function pIe(e,t){let n=new Map,r=new Map,i=-1,a=0,o=-1,s,c,l,u=()=>{if(!(o<0)&&typeof c==`number`&&typeof l==`number`){let e=Math.max(Math.round((l-c)/100)/10,0);r.set(o,{turnNumber:a,isTurnStart:!0,userIdx:o,turnDurationSecs:e})}};for(let d=0;d<e.length;d++){let f=e[d];if(f.role===`assistant`){s=t[d];let e=f;typeof e.timestamp==`number`&&e.timestamp>0&&(l=typeof e.durationMs==`number`&&e.durationMs>0?e.timestamp+e.durationMs:e.timestamp),a>0&&r.set(d,{turnNumber:a,isTurnStart:!1,userIdx:o})}else f.role===`toolResult`?n.set(`${s}:${f.toolCallId}`,f):f.role===`user`&&(u(),a+=1,o=d,i=d,r.set(d,{turnNumber:a,isTurnStart:!0,userIdx:d}),c=typeof f.timestamp==`number`&&f.timestamp>0?f.timestamp:void 0,l=void 0)}return u(),{toolResultsMap:n,turnInfoByMsgIdx:r,lastUserIdx:i}}function mIe(e){let t=new Map,n=0,r=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a.role===`user`){n+=1,r=i;let o;for(let t=i+1;t<e.length&&e[t].role!==`user`;t++){if(e[t].role!==`assistant`)continue;let n=e[t];typeof n.timestamp!=`number`||n.timestamp<=0||(o=typeof n.durationMs==`number`&&n.durationMs>0?n.timestamp+n.durationMs:n.timestamp)}let s=o&&typeof a.timestamp==`number`?Math.max(Math.round((o-a.timestamp)/100)/10,0):void 0;t.set(i,{turnNumber:n,isTurnStart:!0,userIdx:i,...typeof s==`number`?{turnDurationSecs:s}:{}})}else a.role===`assistant`&&n>0&&t.set(i,{turnNumber:n,isTurnStart:!1,userIdx:r})}return t}function hIe(e,t){if(t<0||t>=e.length)return[];let n=$X(e,t),r=[];for(let i=t+1;i<n;i++){let t=e[i],n=t?.role;(n===`user`||n===`assistant`||QX(t))&&r.push(i)}return r}function gIe({messageRefs:e,lastUserMsgRef:t,lastUserIdx:n}){return(r,i)=>a=>{e.current[i]=a,r===n&&(t.current=a)}}function _Ie({open:e,onOpenChange:t,title:n,header:r,children:i,className:a}){let o=(0,I.useRef)(null);return(0,I.useEffect)(()=>{let t=o.current;if(t){if(e){if(!t.matches(`:popover-open`))try{t.showPopover()}catch{}}else try{t.hidePopover()}catch{}}},[e]),(0,L.jsxs)(`div`,{ref:o,popover:`auto`,onToggle:e=>{e.target===o.current&&e.newState===`closed`&&e.oldState===`open`&&t(!1)},role:`dialog`,"aria-modal":`true`,className:HO(`turn-detail-modal`,`m-auto h-fit max-h-[calc(100dvh-2rem)]`,`w-[min(100%-2rem,48rem)] xl:w-[min(100%-2rem,64rem)]`,`flex-col gap-3 overflow-y-hidden rounded-xl bg-background p-4 text-sm text-foreground shadow-(--shadow-strong) ring-1 ring-foreground/10 outline-none`,e?`flex`:`hidden`,a),style:{position:`fixed`,inset:0,margin:`auto`},children:[r===void 0?n===void 0?null:(0,L.jsx)(`div`,{className:`pr-8 text-base font-semibold`,children:n}):(0,L.jsx)(`div`,{className:`flex flex-col gap-2 pr-8`,children:r}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`Close`,onClick:()=>t(!1),className:`absolute top-3 right-3 rounded-md p-1 text-muted-foreground opacity-70 transition-opacity hover:opacity-100`,children:(0,L.jsx)(cT,{className:`size-4`})}),(0,L.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto`,children:i})]})}var rZ=(0,I.createContext)(!1);function vIe(e){let t=e.clientHeight;return t<=0||t>=56?!1:e.scrollHeight>t+1}function iZ(e){let t=(0,I.useContext)(rZ);return e||t}var yIe=6;function bIe(e){let t=Math.max(1,String(Number.isFinite(e)?Math.max(0,Math.floor(e)):0).length);return Math.max(20,t*yIe+8)}var aZ=`--preview-rail-w`,oZ=`var(${aZ}, 20px)`;function sZ({items:e,autoScroll:t,compact:n,autoCompact:r,alwaysRender:i,stickBottomOnMount:a,testId:o,hintTestId:s,observeContent:c,wrapperStyle:l,scrollStyle:u,scrollStepPx:d,scrollElRef:f,virtualizerRef:p}){let m=(0,I.useRef)(null);(0,I.useEffect)(()=>{f&&(f.current=m.current)});let[h,g]=(0,I.useState)(!0),_=(0,I.useRef)(!1),v=(0,I.useCallback)(()=>{let e=m.current;if(e){if(e.scrollHeight-e.scrollTop-e.clientHeight<16){_.current=!1,g(!0);return}_.current&&g(!1)}},[]);(0,I.useEffect)(()=>{let e=m.current;if(!e)return;let t=0,n=e=>{e.deltaY<0&&(_.current=!0)},r=e=>{t=e.touches[0]?.clientY??0},i=e=>{let n=e.touches[0]?.clientY??0;n-t>2&&(_.current=!0),t=n},a=e=>{(e.key===`ArrowUp`||e.key===`PageUp`||e.key===`Home`)&&(_.current=!0)};return e.addEventListener(`wheel`,n,{passive:!0}),e.addEventListener(`touchstart`,r,{passive:!0}),e.addEventListener(`touchmove`,i,{passive:!0}),e.addEventListener(`keydown`,a),()=>{e.removeEventListener(`wheel`,n),e.removeEventListener(`touchstart`,r),e.removeEventListener(`touchmove`,i),e.removeEventListener(`keydown`,a)}},[]),(0,I.useEffect)(()=>{let n=m.current;if(!n||!t||!h||e.length===0)return;let r=()=>{n.scrollTop=n.scrollHeight};if(r(),typeof ResizeObserver>`u`)return;let i=0,a=new ResizeObserver(()=>{i||=requestAnimationFrame(()=>{i=0,r()})});a.observe(n);let o=n.firstElementChild;return o&&a.observe(o),()=>{a.disconnect(),cancelAnimationFrame(i)}},[e,t,h]),(0,I.useEffect)(()=>{let t=m.current;if(!t||!a||e.length===0)return;let n=0,r=0,i=!0,o=()=>{!i||r++>60||t.scrollTop+t.clientHeight>=t.scrollHeight-1||(t.scrollTop=t.scrollHeight,n=requestAnimationFrame(o))},s=()=>{i=!1,cancelAnimationFrame(n)};return t.addEventListener(`pointerdown`,s,{once:!0}),t.addEventListener(`wheel`,s,{once:!0,passive:!0}),n=requestAnimationFrame(o),()=>{s(),t.removeEventListener(`pointerdown`,s),t.removeEventListener(`wheel`,s)}},[a,e]);let y=(0,I.useMemo)(()=>({get current(){return m.current},set current(e){}}),[]),b=!i&&typeof ResizeObserver<`u`&&e.length>40,[x,S]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let e=m.current;if(!e||!r||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{S(vIe(e))});return t.observe(e),()=>t.disconnect()},[r]);let C=bIe(e.reduce((e,t)=>t.number!==void 0&&t.number>e?t.number:e,0)),w=n===!0,T=(0,I.useMemo)(()=>({...u,overflowAnchor:`none`,...w?{maxHeight:56}:{}}),[w,u]),E=(0,I.useMemo)(()=>({...l,[aZ]:`${C}px`}),[l,C]);return(0,L.jsx)(rZ.Provider,{value:x||w,children:(0,L.jsx)(MK,{direction:`vertical`,observeContent:c,testId:o,scrollStepPx:d,scrollElRef:m,onScroll:v,hintTestId:s,hintStyle:{left:1,right:`auto`,width:`calc(var(${aZ}, 20px) - 4px)`,transform:`none`},wrapperStyle:E,scrollStyle:T,hideHints:w,children:b?(0,L.jsx)(Kq,{ref:p,data:e,itemSize:200,bufferSize:400,scrollRef:y,children:e=>(0,L.jsx)(`div`,{children:e.node},e.key)}):(0,L.jsx)(`div`,{children:e.map(e=>(0,L.jsx)(`div`,{children:e.node},e.key))})})})}function cZ({mode:e,header:t,items:n,children:r,compact:i,autoScroll:a,scrollStepPx:o,wrapperStyle:s,scrollTestId:c,scrollElRef:l,virtualizerRef:u}){return(0,L.jsxs)(`div`,{style:{height:e===`live`?`100%`:void 0,background:`var(--bg)`,paddingTop:8,paddingBottom:e===`live`?8:0,boxSizing:`border-box`,display:`flex`,flexDirection:`column`},children:[t!=null&&(0,L.jsx)(`div`,{"data-testid":`turn-body-header-divider`,style:{borderBottom:`1px solid var(--border)`},children:t}),e===`live`?(0,L.jsx)(`div`,{style:{position:`relative`,flex:1,minHeight:0},children:(0,L.jsx)(sZ,{items:n??[],autoScroll:a,compact:i,autoCompact:!0,testId:c??`preview-overlay-scroll`,observeContent:!0,scrollStepPx:o,scrollElRef:l,virtualizerRef:u,wrapperStyle:s})}):r]})}function lZ(e){if(!e)return null;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 uZ(e){return typeof e==`string`?e:e.filter(e=>e.type===`text`).map(e=>e.text).join(`
541
541
  `)}function xIe(e){return typeof e==`string`?[]:e.filter(e=>e.type===`image`)}function dZ(e){let t=e;return e.source?e.source.type===`base64`?`data:${e.source.media_type};base64,${e.source.data}`:e.source.url??``:t.data?`data:${t.mimeType};base64,${t.data}`:``}function SIe(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function CIe(e){return e||`extension`}function wIe(e){let t=e.replace(/\s+/g,` `).trim();return t?t.length>140?`${t.slice(0,140)}...`:t:`Show extension message`}function fZ(e){let t=e.input;if(!t||typeof t!=`object`)return``;let n=Object.keys(t);if(n.length===0)return``;if(`command`in t)return String(t.command).slice(0,120);if(`path`in t)return String(t.path).slice(0,120);if(`file_path`in t)return String(t.file_path).slice(0,120);if(`pattern`in t)return String(t.pattern).slice(0,120);if(`query`in t)return String(t.query).slice(0,120);let r=t[n[0]];if(Array.isArray(r)){let e=r.map(e=>typeof e==`object`&&e&&`topic`in e?String(e.topic):null).filter(e=>e!==null&&e.length>0);return e.length>0?e.join(` | `).slice(0,120):`[${r.length} items]`}let i=String(r).slice(0,120);if(i===``||i===`[object Object]`)try{return JSON.stringify(t).slice(0,120)}catch{return i}return i}function TIe(e){return e?.role===`user`?uZ(e.content).trim().replace(/\s+/g,` `):``}function EIe(e){return e?.role===`user`?uZ(e.content):``}function DIe(e){if(e?.role!==`user`||typeof e.content==`string`)return[];let t=[];for(let n of e.content){if(n.type!==`image`)continue;let e=dZ(n);e&&t.push(e)}return t}function OIe({text:e,fullText:t,images:n,turnNumber:r,tooltipActions:i}){return!e&&!n?.length?null:(0,L.jsxs)(`div`,{"data-testid":`turn-preview-header`,style:{flexGrow:1,flexShrink:1,maxWidth:`100%`,display:`flex`,alignItems:`center`,gap:6,minWidth:0,marginBottom:6,paddingInline:8,justifyContent:`flex-start`,overflow:`hidden`},children:[r==null?null:(0,L.jsx)(`span`,{"data-testid":`turn-preview-header-turn`,style:{flexShrink:0,display:`flex`},children:(0,L.jsx)(AX,{number:r})}),(0,L.jsx)(xX,{text:e,fullText:t,images:n,tooltipActions:i,capsule:!0,alignRight:!0})]})}function pZ({userMessage:e,turnNumber:t,padRight:n,tooltipActions:r}){if(!e)return null;let i=TIe(e),a=DIe(e);if(!i&&a.length===0)return null;let o=EIe(e);return(0,L.jsx)(`div`,{"data-testid":`current-turn-area-header`,style:{display:`flex`,alignItems:`center`,justifyContent:`flex-start`,gap:8,minWidth:0,...n?{paddingRight:n}:null},children:(0,L.jsx)(OIe,{text:i,fullText:o,images:a,turnNumber:t,tooltipActions:r})})}var kIe=`min(32vh, 260px)`;function AIe({header:e,items:t,autoScroll:n,compact:r,scrollStepPx:i,scrollTestId:a,size:o=`default`}){let s=(0,I.useRef)(t);(0,I.useEffect)(()=>{s.current=t});let c=(0,I.useRef)(null),l=(0,I.useRef)(null);return(0,I.useEffect)(()=>(PX.current=e=>{let t=s.current.findIndex(t=>t.key===`turn-preview-${e}`);if(t<0)return!1;let n=c.current,r=()=>{let t=n?.querySelector(`[data-msg-idx="${e}"]`);return t?(t.classList.remove(`search-flash`),t.offsetWidth,t.classList.add(`search-flash`),window.setTimeout(()=>t.classList.remove(`search-flash`),1700),!0):!1},i=n?.querySelector(`[data-msg-idx="${e}"]`);if(i&&n)return n.scrollTo({top:Math.max(0,i.offsetTop-n.clientHeight/2+i.offsetHeight/2),behavior:`smooth`}),r(),!0;let a=l.current;return a?(a.scrollToIndex(t,{align:`center`}),window.setTimeout(()=>void r(),300),!0):!1},()=>{PX.current=null}),[]),(0,L.jsx)(`div`,{style:{position:`relative`,flex:1,minHeight:0,display:`flex`,flexDirection:`column`},children:(0,L.jsx)(`div`,{"data-testid":`current-turn-area-panel`,className:`current-turn-area-panel`,"data-size":o,style:{flex:1,minHeight:0,background:`var(--bg)`,paddingBottom:8},children:(0,L.jsx)(cZ,{mode:`live`,items:t,header:e,autoScroll:n,compact:r,scrollStepPx:i,wrapperStyle:{position:`relative`,height:r?56:`100%`},scrollTestId:a,scrollElRef:c,virtualizerRef:l})})})}function mZ({preview:e,footer:t,header:n,children:r,anchor:i,syncWidthTo:a,pointerEvents:o=`none`}){let s=(0,I.useRef)(null),c=(0,I.useRef)(null),[l,u]=(0,I.useState)({top:0,left:0}),[d,f]=(0,I.useState)(void 0),[p,m]=(0,I.useState)(!1),h=(0,I.useRef)(void 0),g=(0,I.useRef)(i);(0,I.useEffect)(()=>{g.current=i});let _=(0,I.useRef)(a);(0,I.useEffect)(()=>{_.current=a});let[v,y]=(0,I.useState)(void 0),b=(0,I.useRef)(void 0),x=(0,I.useCallback)(()=>{window.clearTimeout(b.current)},[]),S=(0,I.useCallback)(()=>{x(),b.current=window.setTimeout(()=>m(!1),jIe)},[x]),C=(0,I.useCallback)(()=>{_Z||(x(),window.clearTimeout(h.current),h.current=window.setTimeout(()=>m(!0),120))},[x]),w=(0,I.useCallback)(()=>{window.clearTimeout(h.current),S()},[S]);(0,I.useEffect)(()=>()=>{window.clearTimeout(h.current),window.clearTimeout(b.current)},[]),(0,I.useLayoutEffect)(()=>{if(!p)return;let e=c.current;if(!e)return;try{e.showPopover()}catch{}let t=s.current;if(!t)return;let n=()=>{let n=(g.current?.()??null??t).getBoundingClientRect();if(!n)return;let r=e.offsetWidth,i=e.offsetHeight,a=window.innerWidth,o=window.innerHeight,s=_.current?.();if(s){let e=s.getBoundingClientRect(),t=Math.max(120,Math.min(Math.round(e.width),a-16));y(e=>e===t?e:t)}let c=Math.max(gZ,Math.min(n.left+n.width/2-r/2,a-r-gZ)),l=o-gZ-n.bottom,d=n.top-gZ,p=l>=d,m=Math.max(96,Math.floor(p?l:d)-hZ);f(e=>e===m?e:m);let h=Math.min(i,m),v=p?n.bottom+hZ:n.top-hZ-h;u({top:v,left:c})};n();let r=window.requestAnimationFrame(n),i=new ResizeObserver(n);return i.observe(e),()=>{window.cancelAnimationFrame(r);try{e.hidePopover()}catch{}i.disconnect()}},[p]);let T=p&&typeof document<`u`?(0,P_.createPortal)((0,L.jsxs)(`div`,{ref:c,popover:`manual`,onPointerEnter:x,onPointerLeave:S,role:`tooltip`,className:`hover-preview-panel`,style:{position:`fixed`,top:l.top,left:l.left,width:v??`min(48rem, calc(100vw - 16px))`,maxHeight:d,display:`flex`,flexDirection:`column`,overflow:`hidden`,background:`var(--bg)`,color:`var(--text)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-md, 6px)`,padding:`2px 14px 6px`,fontSize:`var(--text-base)`,lineHeight:1.5,boxShadow:`0 4px 16px -2px var(--shadow-strong)`,pointerEvents:o},children:[n?(0,L.jsx)(`div`,{style:{flexShrink:0,padding:`4px 0 4px`,borderBottom:`1px solid var(--border)`,color:`var(--text-muted)`,fontSize:`var(--text-sm, 12px)`},children:n}):null,(0,L.jsx)(`div`,{className:`hover-preview-scroll`,style:{minHeight:0,flex:`0 1 auto`,overflowY:`auto`,pointerEvents:`auto`},children:e}),t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{"aria-hidden":!0,style:{height:1,marginTop:4,flexShrink:0,background:`linear-gradient(90deg, transparent 0, var(--border) 24px, var(--border) calc(100% - 24px), transparent 100%)`}}),(0,L.jsx)(`div`,{style:{padding:`4px 0 2px`,display:`flex`,justifyContent:`flex-end`,flexShrink:0,pointerEvents:`auto`},children:t})]}):null]}),document.body):null;return(0,L.jsxs)(`span`,{ref:s,onPointerEnter:C,onPointerLeave:w,style:{display:`block`,minWidth:0},children:[r,T]})}var hZ=6,gZ=8,jIe=300,_Z=!1;function MIe(){_Z=!0,document.addEventListener(`pointermove`,()=>{_Z=!1},{capture:!0,once:!0})}function vZ({estTokens:e,tps:t,marginLeft:n}){let{t:r}=z();return e<=0?null:(0,L.jsxs)(`span`,{"data-testid":`est-tokens-badge`,style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0,color:`var(--text)`,marginLeft:n},title:r(`i18n.estimatedTokens`),children:[(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:2,fontSize:`var(--text-sm)`,fontWeight:400},children:[(0,L.jsxs)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`line`,{x1:`5`,y1:`1.5`,x2:`5`,y2:`8.5`}),(0,L.jsx)(`polyline`,{points:`2 6 5 8.5 8 6`})]}),e]}),t!=null&&(0,L.jsxs)(`span`,{style:{marginLeft:6,padding:`1px 6px`,borderRadius:4,background:t>=50?`#53b3cb`:t>=30?`#9bc53d`:t>=15?`#f9c22e`:`#e01a4f`,color:`#fff`,fontSize:`var(--text-sm)`,fontWeight:400},children:[t.toFixed(1),` t/s`]})]})}function NIe({t:e,erroredRawError:t}){return(0,L.jsx)(fT,{label:t?(0,L.jsxs)(L.Fragment,{children:[e(`chat.errorTooltip`),(0,L.jsx)(`br`,{}),(0,L.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,opacity:.85,whiteSpace:`pre-wrap`},children:t})]}):e(`chat.errorTooltip`),wrapperStyle:{display:`flex`,flexShrink:0},children:(0,L.jsxs)(`span`,{"data-testid":`turn-footer-error`,"aria-label":t??e(`chat.error`),style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0,fontVariantNumeric:`tabular-nums`,color:`var(--text-muted)`,cursor:`default`,color:`var(--status-error)`},children:[(0,L.jsx)(Koe,{size:B.base,"aria-hidden":!0,fill:`currentColor`,style:{flexShrink:0}}),(0,L.jsx)(`span`,{className:`turn-footer-stat-label`,children:e(`chat.error`)})]})})}function PIe({t:e,stoppedRawError:t}){return(0,L.jsx)(fT,{label:t?(0,L.jsxs)(L.Fragment,{children:[e(`chat.stoppedTooltip`),(0,L.jsx)(`br`,{}),(0,L.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,opacity:.85,whiteSpace:`pre-wrap`},children:t})]}):e(`chat.stoppedTooltip`),wrapperStyle:{display:`flex`,flexShrink:0},children:(0,L.jsxs)(`span`,{"data-testid":`turn-footer-stopped`,"aria-label":e(`chat.stoppedTooltip`),style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0,fontVariantNumeric:`tabular-nums`,color:`var(--text-muted)`,cursor:`default`,color:`var(--status-warning)`},children:[(0,L.jsx)(rT,{size:B.base,"aria-hidden":!0,fill:`currentColor`,style:{flexShrink:0}}),(0,L.jsx)(`span`,{className:`turn-footer-stat-label`,children:e(`chat.stopped`)})]})})}var yZ={display:`flex`,alignItems:`center`,gap:4,flexShrink:0,fontVariantNumeric:`tabular-nums`,color:`var(--text-muted)`};function FIe({models:e,messageCount:t,toolCallCount:n,list:r,footerRootRef:i,onToggleArtifacts:a,artifactsOpen:o,fileListPreview:s,t:c,timestamp:l,durationSecs:u,expanded:d,stopped:f,stoppedRawError:p,errored:m,erroredRawError:h,expandMode:g,headerMode:_,streaming:v,estTokens:y,tps:b}){return(0,L.jsxs)(`div`,{"data-turn-footer-bar":``,style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`,minHeight:24,padding:`3px 10px`,...f?{background:`color-mix(in srgb, var(--status-warning) 9%, var(--bg-panel))`}:m?{background:`color-mix(in srgb, var(--status-error) 9%, var(--bg-panel))`}:{}},children:[(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:10,flex:1,minWidth:0},children:[!_&&!v&&(0,L.jsx)(`span`,{"data-turn-toggle":``,"data-testid":`turn-footer-toggle`,style:{display:`flex`,flexShrink:0,cursor:`pointer`},children:!d&&g===`modal`?(0,L.jsx)(fse,{size:B.base,"aria-hidden":!0,style:{flexShrink:0,color:`var(--text-dim)`}}):(0,L.jsx)(Woe,{size:B.base,"aria-hidden":!0,style:{flexShrink:0,color:`var(--text-dim)`,transition:`transform 0.15s`,transform:d?`rotate(-90deg)`:void 0}})}),(0,L.jsx)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.map((e,t)=>(0,L.jsxs)(`span`,{title:`${e.provider}/${e.name}`,style:{whiteSpace:`nowrap`},children:[t>0&&(0,L.jsx)(`span`,{style:{color:`var(--text-muted)`},children:` / `}),(0,L.jsxs)(`span`,{style:{color:`var(--text-dim)`},children:[e.provider,`/`]}),(0,L.jsx)(`span`,{style:{fontWeight:700,color:`var(--text)`},children:e.name})]},`${e.provider}/${e.name}`))}),y!==void 0&&y>0&&(0,L.jsx)(vZ,{estTokens:y,tps:b,marginLeft:6})]}),!v&&(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:10,flexShrink:0,background:`transparent`,borderRadius:6,padding:`1px 8px`},children:[f&&(0,L.jsx)(PIe,{t:c,stoppedRawError:p}),!f&&m&&(0,L.jsx)(NIe,{t:c,erroredRawError:h}),r.length>0&&(0,L.jsx)(`div`,{style:{display:`flex`,flexShrink:0,minWidth:0},children:(0,L.jsx)(mZ,{preview:s,header:c(`chat.turnArtifacts.title`,{count:r.length}),syncWidthTo:()=>i.current??null,pointerEvents:`auto`,children:(0,L.jsxs)(`span`,{"data-artifacts-zone":!0,"data-testid":`turn-footer-files`,"aria-label":c(`chat.turnArtifacts.title`,{count:r.length}),onClick:e=>{e.stopPropagation(),a()},style:{...yZ,cursor:`pointer`,color:`var(--text-muted)`},children:[(0,L.jsx)(ise,{size:B.base,style:{flexShrink:0,color:`var(--status-info)`}}),r.length,(0,L.jsx)(`span`,{className:`turn-footer-stat-label`,children:c(`chat.statFiles`)}),(0,L.jsx)(Ew,{size:B.base,style:{flexShrink:0,transition:`transform 0.15s`,transform:o?`rotate(180deg)`:void 0}})]})})}),(0,L.jsx)(fT,{label:c(t===1?`chat.message`:`chat.messages`,{count:t}),wrapperStyle:{display:`flex`,flexShrink:0},children:(0,L.jsxs)(`span`,{"data-testid":`turn-footer-messages`,style:yZ,children:[(0,L.jsx)(Ww,{size:B.base,style:{flexShrink:0}}),t,(0,L.jsx)(`span`,{className:`turn-footer-stat-label`,children:c(`chat.statMessages`)})]})}),n>0&&(0,L.jsx)(fT,{label:c(n===1?`chat.toolCall`:`chat.toolCalls`,{count:n}),wrapperStyle:{display:`flex`,flexShrink:0},children:(0,L.jsxs)(`span`,{"data-testid":`turn-footer-tools`,style:yZ,children:[(0,L.jsx)(sT,{size:B.base,style:{flexShrink:0}}),n,(0,L.jsx)(`span`,{className:`turn-footer-stat-label`,children:c(`chat.statTools`)})]})}),(l!==void 0||u!==void 0)&&(0,L.jsx)(fT,{label:l===void 0?void 0:new Date(l).toLocaleString([],{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),children:(0,L.jsxs)(`span`,{"data-testid":`turn-footer-duration`,style:{...yZ,cursor:`default`},children:[(0,L.jsx)(Ow,{size:B.sm,style:{flexShrink:0}}),u!==void 0&&vY(u)]})})]})]})}function bZ(e){let t=null,n=!1,r=0,i=0,a=e.length;for(;i<a;){let o=e.indexOf(`
542
542
  `,i),s=o===-1?a:o,c=e.slice(i,s),l=c.endsWith(`\r`)?c.slice(0,-1):c,u=l.trim(),d=l.match(/^ {0,3}(`{3,}|~{3,})/);t?d&&d[1][0]===t&&(t=null):n?u.endsWith(`$$`)&&(n=!1):d?t=d[1][0]:u.startsWith(`$$`)?u.endsWith(`$$`)&&u.length>2||(n=!0):(l===``||/^\s+$/.test(l))&&(r=i),i=s+1}return r}function IIe(e,t){let n=(0,I.useRef)(null),r=()=>n.current,i=e=>{n.current=e};return(0,I.useMemo)(()=>{if(!t)return{settled:``,tail:e};let n=r();if(!n||!e.startsWith(n.content)){let t=bZ(e),n={settled:e.slice(0,t),tail:e.slice(t)};return i({content:e,settled:n.settled}),n}let a=bZ(e),o=a>=n.settled.length?e.slice(0,a):n.settled;return i({content:e,settled:o}),{settled:o,tail:e.slice(o.length)}},[e,t])}var LIe={source:`i18n.fileViewSource`,preview:`i18n.fileViewPreview`,diff:`i18n.fileViewDiff`},RIe={source:`i18n.fileViewSourceHint`,preview:`i18n.fileViewPreviewHint`,diff:`i18n.compareHead`},xZ={fontFamily:`var(--font-mono)`,fontSize:`var(--text-lg)`,lineHeight:1.6},SZ={width:48,minWidth:48,padding:`0 10px`,textAlign:`right`,color:`var(--text-dim)`,background:`var(--bg-panel)`,borderRight:`1px solid var(--border)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontStyle:`normal`,fontVariantNumeric:`tabular-nums`,lineHeight:`20.8px`,userSelect:`none`,flexShrink:0,verticalAlign:`top`};function CZ({filePath:e,sourceSessionId:t}){let{t:n}=z();return(0,L.jsx)(fT,{label:n(`i18n.downloadFile`),children:(0,L.jsx)(`a`,{href:CJ(e,`download`,t),download:aP(e),"aria-label":n(`i18n.downloadFile`),className:`file-viewer-icon-button`,children:(0,L.jsxs)(`svg`,{width:B.xl,height:B.xl,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,L.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,L.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,L.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})})})}function wZ(e,t,n){let[r,i]=(0,I.useState)(!1),a=(0,I.useRef)(n);(0,I.useEffect)(()=>{a.current=n});let o=(0,I.useRef)(null);return(0,I.useEffect)(()=>(i(!1),o.current?.(),o.current=eC({ch:`watch`,filePath:e},e=>{e.event===`connected`?i(!0):e.event===`error`?i(!1):a.current(e)}),()=>{o.current?.(),o.current=null}),[e]),{watching:r,closeWatch:(0,I.useCallback)(()=>{o.current?.(),o.current=null,i(!1)},[])}}function TZ({filePath:e,cwd:t,extLabel:n,watching:r,sourceSessionId:i,ellipsis:a,children:o}){let{t:s}=z();return(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`4px 16px`,borderBottom:`1px solid var(--border)`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,background:`var(--bg)`,flexShrink:0},children:[(0,L.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,...a?{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}:{}},title:e,children:sP(e,t)}),(0,L.jsx)(`span`,{style:{marginLeft:`auto`},children:n}),o,(0,L.jsxs)(`span`,{title:s(r?`i18n.liveSync`:`i18n.notWatching`),style:{display:`flex`,alignItems:`center`,gap:4,color:r?`var(--status-success)`:`var(--text-dim)`},children:[(0,L.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:r?`var(--status-success)`:`var(--border)`,display:`inline-block`,boxShadow:r?`0 0 4px var(--status-success)`:`none`}}),r?`live`:`static`]}),(0,L.jsx)(CZ,{filePath:e,sourceSessionId:i})]})}function EZ({filePath:e,sourceSessionId:t,cwd:n}){let{t:r}=z(),[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)(null),c=typeof n==`string`&&/^[a-zA-Z]:[\\/]/.test(n)||typeof n==`string`&&n.startsWith(`\\\\`),l=(0,I.useCallback)(async n=>{a(!0),s(null);try{let i=await fetch(CJ(e,`open`,t,n?{chooseApp:1}:void 0),{method:`POST`}),a=await i.json().catch(()=>null);i.ok?s({ok:!0,text:r(`files.openLaunched`)}):s({ok:!1,text:a?.error??`HTTP ${i.status}`})}catch(e){s({ok:!1,text:String(e)})}finally{a(!1)}},[e,t,r]);return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:10,marginTop:16},children:[o&&(0,L.jsx)(`div`,{style:{color:o.ok?`var(--text-muted)`:`var(--status-error)`,fontSize:`var(--text-sm)`,maxWidth:460,textAlign:`center`,lineHeight:1.5},children:o.text}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,L.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>l(!1),className:`file-viewer-mode-button file-open-action-button`,children:r(`files.openInSystemApp`)}),c&&(0,L.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>l(!0),className:`file-viewer-mode-button file-open-action-button`,children:r(`files.chooseOtherApp`)})]})]})}var zIe=(0,I.memo)(function(e){return(0,L.jsx)(mS,{content:e.content,viewportPriority:!0,customId:e.customId,themes:e.themes,codeBlockDarkTheme:e.codeBlockDarkTheme,codeBlockLightTheme:e.codeBlockLightTheme,isDark:e.isDark,typewriter:!1,smoothStreaming:!1})});function DZ({content:e,className:t,fileLink:n,streaming:r}){let{isDark:i}=vq(),a=vw(),o=a?.markdownThemeDark??`github-dark`,s=a?.markdownThemeLight??`github-light`,c=(0,I.useId)(),l=n?`markstream-file-${c.replace(/[^a-zA-Z0-9-]/g,``)}`:void 0,u=(0,I.useRef)(null),d=(0,I.useRef)(null),{settled:f,tail:p}=IIe(e,!!r),m=(0,I.useMemo)(()=>[o,s],[o,s]),{markdownDir:h,onOpenFile:g,cwd:_,sourceSessionId:v}=n??{};return(0,I.useEffect)(()=>{let e=h??_;if(!(!l||!e))return Sre(l,{link:({node:t,children:n})=>(0,L.jsx)(nK,{href:t.href,markdownDir:e,onOpenFile:g,children:n??t.text}),img:({node:t})=>{let n=QDe(t.src,e,_??e),r=n?CJ(n,`read`,v):t.src;return(0,L.jsx)(`img`,{src:r,alt:t.alt,loading:`lazy`})}}),()=>Cre(l)},[l,h,g,_,v]),(0,I.useEffect)(()=>{if(!r)return;let e=0,t=()=>{let n=u.current,r=d.current;if(n&&r){let e=BIe(n);e&&(r.style.left=`${e.left}px`,r.style.top=`${e.top}px`,r.style.height=`${e.height}px`)}e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[r]),(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{ref:u,className:t,"data-testid":`markstream-body`,children:[f?(0,L.jsx)(zIe,{content:f,customId:l,themes:m,codeBlockDarkTheme:o,codeBlockLightTheme:s,isDark:i}):null,p?(0,L.jsx)(mS,{content:p,viewportPriority:!0,customId:l,themes:m,codeBlockDarkTheme:o,codeBlockLightTheme:s,isDark:i,typewriter:!1,smoothStreaming:!1}):null,r?(0,L.jsx)(`span`,{ref:d,className:`streaming-caret`,"aria-hidden":`true`}):null]})})}function BIe(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null,r,i=0;for(;(r=t.nextNode())&&i++<2e4;){let e=r;e.textContent&&e.textContent.trim().length>0&&(n=e)}if(!n)return null;let a=n.data,o=a.length;for(;o>0&&/\s/.test(a[o-1]);)o--;o===0&&(o=a.length);let s=document.createRange();if(s.setStart(n,o-1),s.setEnd(n,o),typeof s.getBoundingClientRect!=`function`)return null;let c=s.getBoundingClientRect(),l=e.getBoundingClientRect();return!c.width&&!c.height?null:{left:c.right-l.left,top:c.top-l.top,height:c.height}}function OZ(e){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);try{let t=document.createElement(`textarea`);return t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),Promise.resolve()}catch{return Promise.reject()}}function VIe(e,t,n){let r=[],i=(e,n)=>{r.push(`${e}: ${n.toLocaleString(t)}`)};i(n(`session.input`),e.input),i(n(`session.output`),e.output),i(n(`session.cacheRead`),e.cacheRead),i(n(`session.cacheWrite`),e.cacheWrite),e.cost?.total>0&&r.push(`${n(`session.cost`)}: $${e.cost.total.toFixed(4)}`);let a=pX(e);return r.push(`${n(`session.cacheHitRate`)}: ${a===null?`--`:`${a.toFixed(1)}%`}`),r.join(` · `)}function kZ({usage:e}){let{t,locale:n}=z();return mX(e)?(0,L.jsx)(fT,{label:VIe(e,n,t),children:(0,L.jsxs)(`div`,{"data-testid":`message-usage-stats`,style:{display:`flex`,alignItems:`center`,gap:10,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,fontVariantNumeric:`tabular-nums`},children:[bX.map(n=>{let r=e[n.key];return(0,L.jsx)(yX,{color:n.color,svg:n.svg,value:_X(r),badge:n.key===`cacheRead`?hX(pX(e),t,!1):void 0},n.key)}),e.cost?.total>0&&(0,L.jsx)(`span`,{style:gX,children:vX(e.cost.total)})]})}):null}function AZ({textContent:e}){let{t}=z(),[n,r]=(0,I.useState)(!1);return(0,L.jsxs)(`button`,{onClick:()=>{OZ(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},title:t(`i18n.copyMessage`),"aria-label":t(`i18n.copyMessage`),style:{display:`inline-flex`,alignItems:`center`,gap:4,padding:`2px 8px`,height:22,flexShrink:0,border:`none`,borderRadius:5,color:n?`var(--accent)`:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-sm)`,fontWeight:400,whiteSpace:`nowrap`,transition:`color 0.12s`},children:[n?(0,L.jsx)(`svg`,{width:B.sm,height:B.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}):(0,L.jsxs)(`svg`,{width:B.sm,height:B.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`rect`,{x:`9`,y:`9`,width:B.lg,height:B.lg,rx:`2`,ry:`2`}),(0,L.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),t(n?`i18n.copied`:`i18n.copy`)]})}function HIe({usage:e,isStreaming:t,timestamp:n,showUsage:r=!0}){let i=!!(e&&r&&!t&&mX(e)),a=!!n&&!t;return!i&&!a?null:(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:2},children:[i&&e&&(0,L.jsx)(kZ,{usage:e}),a&&n&&(0,L.jsx)(fT,{label:new Date(n).toLocaleString([],{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),children:(0,L.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginLeft:`auto`,fontVariantNumeric:`tabular-nums`},children:(0,L.jsx)(Ow,{size:B.sm})})})]})})}function UIe(e,t){return t.runningToolIds?.has(e.toolCallId)===!0&&!t.toolResults?.get(`${t.entryId}:${e.toolCallId}`)}function WIe(e,t){let n=new Set;for(let r of e){let e=r.block;e.type===`toolCall`&&UIe(e,t)&&n.add(r.originalIndex)}return n}function GIe({error:e,hasBlocks:t}){let n=`var(--status-error)`;return(0,L.jsxs)(`div`,{role:`alert`,style:{marginTop:t?8:0,padding:`7px 10px`,border:`1px solid color-mix(in srgb, ${n} 30%, transparent)`,borderRadius:6,background:`color-mix(in srgb, ${n} 7%, transparent)`,color:n,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,lineHeight:1.5,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[`Error: `,e]})}function jZ({rawError:e}){let{t}=z(),n=`var(--status-warning)`;return(0,L.jsx)(fT,{label:(0,L.jsxs)(L.Fragment,{children:[t(`chat.stoppedTooltip`),e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`br`,{}),e]}):null]}),wrapperStyle:{display:`flex`,flexShrink:0,width:`fit-content`},hoverOnly:!0,children:(0,L.jsxs)(`div`,{"data-testid":`stopped-banner`,role:`status`,style:{marginTop:8,padding:`2px 8px`,display:`flex`,alignItems:`center`,gap:6,border:`1px solid color-mix(in srgb, ${n} 30%, transparent)`,borderRadius:6,background:`color-mix(in srgb, ${n} 7%, transparent)`,color:n,fontFamily:`var(--font-mono)`,fontSize:`var(--text-base)`,lineHeight:1.5,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[(0,L.jsx)(rT,{"aria-hidden":!0,fill:`currentColor`,style:{width:8,height:8,flexShrink:0}}),t(`chat.stopped`)]})})}var MZ=24;function NZ({text:e}){let t=(0,I.useMemo)(()=>e.split(/\r?\n/),[e]);return typeof ResizeObserver>`u`||t.length<50&&e.length<5e3?(0,L.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e}):(0,L.jsx)(Kq,{data:t,itemSize:MZ,children:e=>(0,L.jsx)(`div`,{style:{minHeight:MZ,lineHeight:`${MZ}px`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e})})}function PZ({header:e,body:t,isStreaming:n=!1,defaultExpanded:r=!1,preview:i,footer:a,footerPadding:o,persistKey:s,compact:c=!1}){let l=hPe(s),[u,d]=(0,I.useState)(null),f=!c&&(l===void 0?u??r:l),p=(0,I.useCallback)(e=>{s?pPe(s,e):d(e)},[s]);return!n||c?f?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:n?`streaming-header-sweep`:void 0,style:n?{position:`relative`,overflow:`hidden`}:void 0,children:e({onClick:()=>p(!1),"aria-expanded":!0,"data-long-block-toggle":``,style:{cursor:`pointer`}},{collapsed:!1})}),t(),a?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{"aria-hidden":!0,style:{height:1,marginTop:4,flexShrink:0,background:`linear-gradient(90deg, transparent 0, var(--border) 24px, var(--border) calc(100% - 24px), transparent 100%)`}}),(0,L.jsx)(`div`,{onClick:()=>p(!1),title:`点击折叠此块`,style:{padding:o??`2px 14px 4px`,display:`flex`,justifyContent:`flex-end`,cursor:`pointer`},children:a})]}):null]}):(0,L.jsx)(mZ,{footer:a,preview:(0,L.jsx)(`div`,{className:`preview-body`,style:{minHeight:0,overflow:`hidden`,display:`flex`,flexDirection:`column`},children:i?i():t()}),children:(0,L.jsx)(`div`,{className:c&&n?`streaming-header-sweep`:void 0,style:c&&n?{position:`relative`,overflow:`hidden`}:void 0,children:e({onClick:c?FZ:()=>{MIe(),p(!0)},"aria-expanded":!1,"data-long-block-toggle":c?void 0:``,style:{cursor:c?`default`:`pointer`}},{collapsed:!0})})}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`streaming-header-sweep`,style:{position:`relative`,overflow:`hidden`},children:e(KIe,{collapsed:!1})}),t()]})}var FZ=()=>{},KIe={onClick:FZ,"aria-expanded":!0,style:{cursor:`default`}},qIe=50,JIe=400;function IZ(e,t,n){let r=(0,I.useRef)(!1),i=(0,I.useRef)(0),a=()=>{i.current=Date.now()};return(0,I.useLayoutEffect)(()=>{let n=e.current;if(!t||!n||r.current)return;let i=0,a=()=>{if(r.current)return;let e=n.scrollHeight,t=n.clientHeight;n.scrollTop!==e-t&&(n.scrollTop=e-t),typeof requestAnimationFrame==`function`&&(i=requestAnimationFrame(()=>{n.scrollHeight!==e&&a()}))};return a(),()=>cancelAnimationFrame(i)},[t,...n]),(0,I.useLayoutEffect)(()=>{let t=e.current;if(t)return t.addEventListener(`wheel`,a,{passive:!0}),t.addEventListener(`touchstart`,a,{passive:!0}),t.addEventListener(`touchmove`,a,{passive:!0}),t.addEventListener(`keydown`,a),t.addEventListener(`pointerdown`,a),()=>{t.removeEventListener(`wheel`,a),t.removeEventListener(`touchstart`,a),t.removeEventListener(`touchmove`,a),t.removeEventListener(`keydown`,a),t.removeEventListener(`pointerdown`,a)}},[e]),()=>{let t=e.current;if(!t)return;let n=t.scrollHeight-t.scrollTop-t.clientHeight>qIe;n&&Date.now()-i.current<=JIe?r.current=!0:n||(r.current=!1)}}function LZ({text:e,isStreaming:t,maxHeight:n=`var(--tool-io-max-h, 400px)`,style:r}){let i=(0,I.useRef)(null),a=IZ(i,t??!1,[e]);return(0,L.jsx)(`div`,{ref:i,onScroll:a,className:`pv-shrink`,style:{maxHeight:n,overflowY:`auto`,contentVisibility:`auto`,containIntrinsicBlockSize:n,...r},children:(0,L.jsx)(NZ,{text:e})})}var YIe=100,RZ=new Map;function XIe(e,t,n){let r=`${e}:${t}:${n}`,i=RZ.get(r);if(i)return RZ.delete(r),RZ.set(r,i),i;let a=fetch(`/api/sessions/${encodeURIComponent(e)}/entries/${encodeURIComponent(t)}/thinking?blockIndex=${n}`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(typeof t.thinking!=`string`)throw Error(`Invalid thinking response`);return t.thinking}).catch(e=>{throw RZ.delete(r),e});if(RZ.set(r,a),RZ.size>YIe){let e=RZ.keys().next().value;e&&RZ.delete(e)}return a}function zZ({block:e,sessionId:t,entryId:n,blockIndex:r,isStreaming:i=!1,keepExpanded:a=!1,footer:o,compact:s=!1}){let{t:c}=z(),l=iZ(s),[u,d]=(0,I.useState)(null),[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(null),g=(0,I.useRef)(!1);(0,I.useEffect)(()=>{e.deferred&&!g.current&&(g.current=!0,_())},[]);let _=async()=>{if(!(!e.deferred||u!==null)){if(!t||!n){h(c(`i18n.thinkingUnavailable`));return}p(!0),h(null);try{d(await XIe(t,n,r))}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}}},v=e.deferred?u:e.thinking,y={padding:`4px 14px 8px 14px`,borderTop:`1px solid var(--border)`,fontSize:`var(--text-lg)`,lineHeight:1.6,color:`var(--text-muted)`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,fontFamily:`var(--font-mono)`},b=f?(0,L.jsxs)(`span`,{style:{color:`var(--text-dim)`},children:[c(`i18n.loading`),`...`]}):m?(0,L.jsx)(`span`,{style:{color:`var(--status-error)`},children:m}):v?(0,L.jsx)(LZ,{text:v,isStreaming:i,style:y}):FX(e)?(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`,fontStyle:`italic`},children:c(`i18n.thinkingEncrypted`)}):null;return(0,L.jsx)(`div`,{className:`hover-pv-block`,style:{borderRadius:6,overflow:`hidden`,fontSize:`var(--text-base)`},children:(0,L.jsx)(PZ,{isStreaming:i,defaultExpanded:a,compact:l,persistKey:n?`${n}:t${r}`:void 0,footer:o,footerPadding:`2px 14px 4px`,header:(e,{collapsed:t})=>(0,L.jsxs)(`div`,{...e,"data-testid":`thinking-block-header`,style:{...e.style,display:`flex`,alignItems:`center`,gap:6,padding:`2px 8px`,color:`var(--status-warning)`,fontSize:`var(--text-base)`,minWidth:0},children:[(0,L.jsx)(Bw,{size:B.base,fill:`currentColor`,style:{flexShrink:0,color:`var(--bulb-warning)`}}),(0,L.jsx)(`span`,{style:{flexShrink:0},children:c(`i18n.thinking`)}),t&&v&&(0,L.jsx)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`},children:l&&i?`…${v.slice(-160)}`:v.slice(0,160)})]}),body:()=>b??(0,L.jsx)(`div`,{className:`pv-shrink`,style:y,children:(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:c(`i18n.noThinking`)})})})})}function ZIe({children:e,testId:t,style:n}){return(0,L.jsx)(`span`,{"data-testid":t,style:{position:`absolute`,top:4,right:8,zIndex:1,padding:`1px 6px`,background:`var(--bg)`,color:`var(--accent)`,border:`1px solid var(--border)`,borderRadius:`var(--radius-sm, 4px)`,fontSize:`var(--text-sm)`,fontWeight:600,lineHeight:1.5,whiteSpace:`nowrap`,pointerEvents:`none`,...n},children:e})}var QIe=`用户输入: `;function BZ(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:null}function VZ(e){return Array.isArray(e)?e.map((e,t)=>{let n=BZ(e);return{label:typeof n?.label==`string`?n.label:`#${t+1}`,description:typeof n?.description==`string`?n.description:null,value:typeof n?.value==`string`?n.value:null}}):[]}function $Ie(e){return Array.isArray(e.questions)?e.questions.map((e,t)=>{let n=BZ(e);return{id:typeof n?.id==`string`?n.id:`#${t}`,question:typeof n?.question==`string`?n.question:typeof n?.label==`string`?n.label:null,options:VZ(n?.options)}}):typeof e.question==`string`?[{id:null,question:e.question,options:VZ(e.options)}]:[]}function eLe(e){let t=BZ(e);if(!t)return[];if(Array.isArray(t.answers))return t.answers.map((e,t)=>{let n=BZ(e),r=Array.isArray(n?.selections)?n.selections:[];return{id:typeof n?.id==`string`?n.id:`#${t}`,values:r.map(e=>BZ(e)?.value??``).filter(Boolean),labels:r.map(e=>BZ(e)?.label??``).filter(Boolean),customAnswer:typeof n?.customAnswer==`string`&&n.customAnswer?n.customAnswer:null,skipped:n?.skipped===!0}});let n=Array.isArray(t.selections)?t.selections:[],r=n.map(e=>BZ(e)?.value??``).filter(Boolean),i=n.map(e=>BZ(e)?.label??``).filter(Boolean),a=typeof t.customAnswer==`string`&&t.customAnswer?t.customAnswer:null;return r.length||i.length||a||t.skipped===!0?[{id:null,values:r,labels:i,customAnswer:a,skipped:t.skipped===!0}]:[]}function tLe({block:e,result:t,duration:n,isStreaming:r=!1,receivingArgs:i=!1,footer:a,compact:o=!1}){let{t:s}=z(),c=$Ie(e.input??{}),l=nLe(t),u=rLe(t),d=u.text,f=u.isError,p=c.find(e=>e.question)?.question??null,m=p?c.length>1?`${s(`chat.aiQuestion`)} ${c.length}: ${p}`:p:d??s(`chat.aiQuestion`),h=BZ(t?.details)?.cancelled===!0,g=l.flatMap(e=>[...e.labels,...e.customAnswer?[e.customAnswer]:[]]).join(` · `);return(0,L.jsx)(`div`,{"data-testid":`pi-menu-frame`,className:`hover-pv-block`,style:{borderRadius:7,fontSize:`var(--text-base)`,...iLe()},children:(0,L.jsx)(PZ,{isStreaming:r,footer:a,compact:o,header:(e,{collapsed:t})=>(0,L.jsxs)(`div`,{...e,style:{...e.style,display:`flex`,alignItems:`center`,gap:7,padding:`6px 10px`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,minWidth:0},children:[(0,L.jsx)(`span`,{style:{color:f?`var(--status-error)`:`var(--status-info)`,fontFamily:`var(--font-mono)`,fontWeight:600,flexShrink:0},children:`pi_menu`}),t?(0,L.jsxs)(`span`,{style:{flex:1,minWidth:0,display:`flex`,alignItems:`baseline`,gap:6,overflow:`hidden`},children:[(0,L.jsx)(`span`,{"data-testid":`pi-menu-digest`,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:`var(--text)`},children:i?s(`tool.receivingArgs`):m}),g&&(0,L.jsx)(`span`,{style:{color:`var(--accent)`,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flexShrink:0,maxWidth:`55%`},children:`→ ${g}`})]}):(0,L.jsx)(`span`,{"data-testid":`pi-menu-digest`,children:s(i?`tool.receivingArgs`:`chat.aiQuestion`)}),n!==void 0&&(0,L.jsxs)(`span`,{style:{marginLeft:`auto`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,fontVariantNumeric:`tabular-nums`,flexShrink:0},children:[n,`s`]})]}),body:()=>(0,L.jsx)(`div`,{className:`pv-shrink`,style:{padding:`8px 14px`,borderTop:`1px solid var(--border)`,fontSize:`var(--text-base)`,lineHeight:1.5,color:`var(--text-muted)`},children:i?(0,L.jsx)(LZ,{text:e.streamingArgs??``,isStreaming:!0,maxHeight:`calc(var(--tool-io-max-h, 400px) - 17px)`,style:{color:`var(--text)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`}}):(0,L.jsxs)(L.Fragment,{children:[c.map((e,t)=>{let n=l.find(n=>n.id===(e.id??`#${t}`))??l[t]??null;return(0,L.jsxs)(`div`,{style:t>0?{marginTop:10}:void 0,children:[e.question&&(0,L.jsx)(`div`,{style:{fontWeight:600,color:`var(--text)`,marginBottom:6},children:e.question}),e.options.length>0&&(0,L.jsx)(aLe,{options:e.options,chosenValues:n?.values??[]}),n?.customAnswer&&(0,L.jsx)(`div`,{style:{color:`var(--text)`,fontWeight:600,whiteSpace:`pre-wrap`},children:`${QIe}${n.customAnswer}`}),n?.skipped&&(0,L.jsx)(`div`,{style:{color:`var(--text-dim)`,fontWeight:600},children:s(`chat.skipped`)})]},e.id??t)}),h&&d&&(0,L.jsx)(`div`,{style:{color:`var(--text-dim)`,fontWeight:600,whiteSpace:`pre-wrap`},children:d}),c.length===0&&d&&(0,L.jsx)(`div`,{style:{color:f?`var(--status-error)`:`var(--text-muted)`,fontWeight:600,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:d})]})})})})}function nLe(e){return e?eLe(e.details):[]}function rLe(e){return{text:(e?e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
543
543
  `).trim():null)||null,isError:e?.isError??!1}}function iLe(){return{background:`var(--bg)`}}function aLe({options:e,chosenValues:t}){return(0,L.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:3},children:e.map((e,n)=>(0,L.jsx)(oLe,{opt:e,chosenValues:t},n))})}function oLe({opt:e,chosenValues:t}){let n=e.value!==null&&t.includes(e.value)||t.includes(e.label);return(0,L.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`baseline`},children:[(0,L.jsx)(`span`,{style:{color:n?`var(--accent)`:`var(--text-dim)`},children:n?`●`:`○`}),(0,L.jsx)(`span`,{style:{color:n?`var(--accent)`:`var(--text)`,fontWeight:n?600:400},children:e.label}),e.description&&(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:e.description})]})}function HZ(e){return new Date(e).toLocaleString([],{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function UZ({secs:e,timestamp:t,endTimestamp:n,marginLeftAuto:r=!1,size:i=`sm`}){let a=(0,L.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:5,fontFamily:`var(--font-mono)`,fontSize:i===`sm`?`var(--text-sm)`:`var(--text-xs)`,fontVariantNumeric:`tabular-nums`,color:`var(--text-muted)`,marginLeft:r?`auto`:void 0},children:[(0,L.jsx)(Ow,{size:B.sm}),e!==void 0&&vY(e)]});return t===void 0?a:(0,L.jsx)(fT,{wrapperStyle:r?{marginLeft:`auto`}:void 0,label:n===void 0?HZ(t):`${HZ(t)} → ${HZ(n)}`,children:a})}function sLe({block:e,isError:t,duration:n,lineStats:r,receivingArgs:i,streamingTail:a}){let{t:o}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,width:`100%`,padding:`2px 8px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`,minWidth:0},children:[(0,L.jsx)(sT,{size:B.base,style:{flexShrink:0,color:t?`var(--status-error)`:`var(--status-info)`}}),(0,L.jsx)(`span`,{style:{color:t?`var(--status-error)`:`var(--status-info)`,fontFamily:`var(--font-mono)`,fontWeight:600,fontSize:`var(--text-sm)`,flexShrink:0},children:e.toolName}),(0,L.jsx)(`span`,{style:{color:`var(--text-muted)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1,minWidth:0},children:a?`…${a}`:i?o(`tool.receivingArgs`):fZ(e)}),r&&(r.additions>0||r.deletions>0)&&(0,L.jsxs)(`span`,{"data-testid":`tool-diff-stats`,style:{flexShrink:0,display:`flex`,alignItems:`center`,gap:5,fontFamily:`var(--font-mono)`,fontSize:`var(--text-xs)`,fontVariantNumeric:`tabular-nums`},children:[r.additions>0&&(0,L.jsxs)(`span`,{style:{color:`var(--status-success)`},children:[`+`,r.additions]}),r.deletions>0&&(0,L.jsxs)(`span`,{style:{color:`var(--status-error)`},children:[`-`,r.deletions]})]}),n!==void 0&&(0,L.jsx)(`span`,{"data-testid":`tool-duration`,style:{flexShrink:0,display:`flex`},children:(0,L.jsx)(UZ,{secs:n})})]})})}function WZ(e){return typeof e.streamingArgs==`string`&&e.streamingArgs.length>0}function cLe(e){return e.hasResult||e.settled?!1:e.isStreaming||e.hasLiveOutput||e.running}function GZ({block:e,result:t,duration:n,isStreaming:r=!1,running:i=!1,keepExpanded:a=!1,streamingOutput:o,footer:s,persistKey:c,compact:l=!1}){let u=iZ(l),d=o??e.streamingOutput,f=cLe({isStreaming:r,hasLiveOutput:!!d,running:i,hasResult:!!t,settled:e.durationSecs!==void 0}),p=(0,I.useRef)(null),m=IZ(p,f,[d]),h=t&&!t.isError?GFe(t):null,g=h?HX(h.text):null;if(e.toolName===`pi_menu`)return(0,L.jsx)(tLe,{block:e,result:t,duration:n,isStreaming:f,receivingArgs:WZ(e),footer:s,compact:u});let _=t?.isError??!1,v=u&&f?(d||(WZ(e)?e.streamingArgs:void 0))?.slice(-160):void 0;return(0,L.jsx)(`div`,{className:`hover-pv-block`,style:{borderRadius:7,fontSize:`var(--text-base)`,...uLe()},children:(0,L.jsx)(PZ,{isStreaming:f,defaultExpanded:a,persistKey:c,footer:s,compact:u,header:t=>(0,L.jsx)(`div`,{...t,style:{...t.style,minWidth:0},children:(0,L.jsx)(sLe,{block:e,isError:_,duration:n,lineStats:g,receivingArgs:WZ(e),streamingTail:v})}),body:()=>(0,L.jsx)(`div`,{className:`pv-flex`,style:{padding:`8px 14px`,borderTop:`1px solid var(--border)`,fontSize:`var(--text-base)`,lineHeight:1.5,color:`var(--text-muted)`},children:(0,L.jsx)(mLe,{block:e,result:t,resultDiff:h,isError:_,liveOutput:d,streamScrollRef:p,onStreamScroll:m,streamingArgs:e.streamingArgs})})})})}var KZ=`var(--tool-io-max-h, 400px)`,lLe=`calc(${KZ} - 18px)`;function uLe(){return{background:`var(--bg)`}}function dLe(e){return e?e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
@@ -2131,5 +2131,5 @@ diff --git`)}function L8(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
2131
2131
  `)?`${i}\n`:i}function q7(e,t,n){if(n===`leading`&&e.contextLines.length>t){let n=e.contextLines.length-t;e.contextLines.splice(0,n),e.additionStart+=n,e.deletionStart+=n}return n===`trailing`&&e.contextLines.length>t&&(e.contextLines.length=t),e.contextLines.length>0&&(e.hunkLines.push(...e.contextLines),e.additionCount+=e.contextLines.length,e.deletionCount+=e.contextLines.length,e.contextLines.length=0),e}function J7(e,t){t.push(`@@ -${Y7(e.deletionStart,e.deletionCount)} +${Y7(e.additionStart,e.additionCount)} @@`),t.push(...e.hunkLines)}function Y7(e,t){return t===1?`${e}`:`${e},${t}`}var hYe=e({ALTERNATE_FILE_NAMES_GIT:()=>w$,AttachedLanguages:()=>H1,AttachedThemes:()=>N3,COMMIT_METADATA_SPLIT:()=>v$,CORE_CSS_ATTRIBUTE:()=>M$,CUSTOM_HEADER_SLOT_ID:()=>O$,CodeToTokenTransformStream:()=>u7,CodeView:()=>pJe,DEFAULT_CODE_VIEW_FILE_METRICS:()=>L$,DEFAULT_CODE_VIEW_LAYOUT:()=>R$,DEFAULT_COLLAPSED_CONTEXT_THRESHOLD:()=>1,DEFAULT_EXPANDED_REGION:()=>B$,DEFAULT_RENDER_RANGE:()=>V$,DEFAULT_SMOOTH_SCROLL_SETTINGS:()=>z$,DEFAULT_THEMES:()=>k$,DEFAULT_TOKENIZE_MAX_LENGTH:()=>F$,DEFAULT_VIRTUAL_FILE_METRICS:()=>I$,DIFFS_DEVELOPMENT_BUILD:()=>_$,DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY:()=>P$,DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE:()=>N$,DIFFS_TAG_NAME:()=>g$,DiffHunksRenderer:()=>M5,EMPTY_RENDER_RANGE:()=>H$,EXTENSION_TO_FILE_FORMAT:()=>f6,FILENAME_HEADER_REGEX:()=>S$,FILENAME_HEADER_REGEX_GIT:()=>C$,FILE_CONTEXT_BLOB:()=>OBe,File:()=>h8,FileDiff:()=>U5,FileRenderer:()=>G6,FileStream:()=>SJe,GIT_DIFF_FILE_BREAK_REGEX:()=>y$,HEADER_METADATA_SLOT_ID:()=>D$,HEADER_PREFIX_SLOT_ID:()=>E$,HUNK_HEADER:()=>b$,INDEX_LINE_METADATA:()=>T$,InteractionManager:()=>E1,MERGE_CONFLICT_BASE_MARKER_REGEX:()=>ABe,MERGE_CONFLICT_END_MARKER_REGEX:()=>MBe,MERGE_CONFLICT_SEPARATOR_MARKER_REGEX:()=>jBe,MERGE_CONFLICT_START_MARKER_REGEX:()=>kBe,RegisteredCustomLanguages:()=>V1,ResizeManager:()=>R1,ResolvedLanguages:()=>z1,ResolvingLanguages:()=>B1,SPLIT_WITH_NEWLINES:()=>x$,SVGSpriteSheet:()=>q6,ScrollSyncManager:()=>u5,ShikiStreamTokenizer:()=>l7,THEME_CSS_ATTRIBUTE:()=>A$,UNIFIED_DIFF_FILE_BREAK_REGEX:()=>DBe,UNSAFE_CSS_ATTRIBUTE:()=>j$,UnresolvedFile:()=>RJe,VirtualizedFile:()=>y8,VirtualizedFileDiff:()=>K5,Virtualizer:()=>ZJe,areDiffLineAnnotationsEqual:()=>V5,areDiffRenderOptionsEqual:()=>d5,areDiffTargetsEqual:()=>x8,areFileRenderOptionsEqual:()=>n6,areFilesEqual:()=>r6,areHunkDataEqual:()=>H5,areLanguagesAttached:()=>U1,areLineAnnotationsEqual:()=>J6,areObjectsEqual:()=>J$,areOptionsEqual:()=>X$,arePrePropertiesEqual:()=>Y6,areRenderRangesEqual:()=>i6,areSelectionsEqual:()=>Q$,areThemesAttached:()=>e6,areThemesEqual:()=>Y$,areVirtualWindowSpecsEqual:()=>H7,areWorkerStatsEqual:()=>aYe,attachResolvedLanguages:()=>W1,attachResolvedThemes:()=>z3,cleanLastNewline:()=>_6,cleanUpResolvedLanguages:()=>G1,cleanUpResolvedThemes:()=>B3,codeToHtml:()=>oWe,createAnnotationElement:()=>a6,createAnnotationWrapperNode:()=>Z6,createCSSVariablesTheme:()=>V2,createDiffSpanDecoration:()=>y5,createEmptyRowBuffer:()=>f5,createFileHeaderElement:()=>s6,createGutterGap:()=>s1,createGutterItem:()=>o1,createGutterUtilityContentNode:()=>Q6,createGutterUtilityElement:()=>c1,createGutterWrapper:()=>a1,createHastElement:()=>n1,createIconElement:()=>r1,createNoNewlineElement:()=>p5,createPreElement:()=>c6,createPreWrapperProperties:()=>l6,createRowNodes:()=>oYe,createSeparator:()=>h5,createSpanFromToken:()=>d7,createStyleElement:()=>sYe,createTextNodeElement:()=>t1,createThemeStyleElement:()=>cYe,createTransformerWithState:()=>C6,createUnsafeCSSStyleNode:()=>$6,createWindowFromScrollPosition:()=>$$,dequeueRender:()=>K$,detachString:()=>T8,diffAcceptRejectHunk:()=>lYe,disposeHighlighter:()=>CKe,findCodeElement:()=>i1,formatCSSVariablePrefix:()=>T6,getCustomExtensionsMap:()=>OKe,getCustomExtensionsVersion:()=>DKe,getFiletypeFromFileName:()=>p6,getHighlighterIfLoaded:()=>Z3,getHighlighterOptions:()=>h6,getHighlighterThemeStyles:()=>M6,getHunkSeparatorSlotName:()=>g5,getIconForType:()=>o6,getLineAnnotationName:()=>g6,getLineEndingType:()=>uYe,getLineNodes:()=>P6,getOrCreateCodeNode:()=>l8,getResolvedLanguages:()=>QJe,getResolvedOrResolveLanguage:()=>M3,getResolvedOrResolveTheme:()=>J3,getResolvedThemes:()=>nYe,getSharedHighlighter:()=>X3,getSingularPatch:()=>dYe,getThemes:()=>$3,getTotalLineCountFromHunks:()=>_5,getUnresolvedDiffHunksRendererOptions:()=>V7,hasResolvedLanguages:()=>$Je,hasResolvedThemes:()=>t6,isDefaultRenderRange:()=>v5,isHighlighterLoaded:()=>bKe,isHighlighterLoading:()=>Q3,isHighlighterNull:()=>xKe,isWorkerContext:()=>K1,parseDiffFromFile:()=>l5,parseLineType:()=>fYe,parsePatchFiles:()=>k8,patchScrollbarGutterSize:()=>c8,pluckInteractionOptions:()=>D1,prefersReducedMotion:()=>e1,preloadHighlighter:()=>SKe,prerenderHTMLIfNecessary:()=>u8,processFile:()=>D8,processLine:()=>v6,processPatch:()=>E8,pushOrJoinSpan:()=>b5,queueRender:()=>G$,registerCustomCSSVariableTheme:()=>rYe,registerCustomLanguage:()=>eYe,registerCustomTheme:()=>K7,releaseStringDetachBuffer:()=>w8,renderDiffWithHighlighter:()=>A5,renderFileWithHighlighter:()=>L6,replaceCustomExtensions:()=>EKe,resolveConflict:()=>_7,resolveLanguage:()=>j3,resolveLanguages:()=>tYe,resolveRegion:()=>f7,resolveTheme:()=>q3,resolveThemes:()=>iYe,setCustomExtension:()=>m6,setLanguageOverride:()=>pYe,setPreNodeProperties:()=>d8,trimPatchContext:()=>mYe,wrapCoreCSS:()=>a8,wrapThemeCSS:()=>s8,wrapUnsafeCSS:()=>o8}),X7=`light-plus`,Z7=`dark-plus`,gYe=500,Q7=300,_Ye=1,vYe=2,yYe=4;function bYe(e){if(e.htmlStyle)return e.htmlStyle;let t={};e.color&&(t[`--shiki-light`]=e.color,t[`--shiki-dark`]=e.color);let n=e.fontStyle??0;return n&_Ye&&(t.fontStyle=`italic`),n&vYe&&(t.fontWeight=`bold`),n&yYe&&(t.textDecoration=`underline`),t}function xYe({content:e,language:t,isDark:n,wrapLines:r,onRenderedCountChange:i}){let a=(0,I.useMemo)(()=>e.split(`
2132
2132
  `),[e]),o=a.length,s=(0,I.useRef)(o);s.current=o;let c=(0,I.useRef)(a);c.current=a;let[l,u]=(0,I.useState)(()=>a.map(()=>null)),d=(0,I.useMemo)(()=>{let e=0;for(;e<l.length&&l[e]!==null;)e++;return e},[l]),f=(0,I.useRef)(0),p=(0,I.useRef)(null),m=(0,I.useRef)(0),h=(0,I.useRef)(0),g=(0,I.useRef)(!1),_=(0,I.useRef)(Promise.resolve()),v=async e=>{if(g.current)return;let n=f.current,r=c.current,i=Math.min(e===0?gYe:Q7,r.length-e);if(!(i<=0))try{let a=p.current;if(a||(a=new l7({highlighter:await X3({themes:[X7,Z7],langs:[t]}),lang:t,themes:{light:X7,dark:Z7},defaultColor:!1,includeExplanation:!1}),p.current=a),await a.enqueue(`${r.slice(e,e+i).join(`
2133
2133
  `)}\n`),f.current!==n)return;let o=a.tokensStable.slice(m.current);m.current=a.tokensStable.length;let s=[],c=[];for(let e of o)e.content===`
2134
- `?(s.push(c),c=[]):c.push(e);h.current=e+i,u(t=>{let n=t.slice();for(let t=0;t<s.length&&e+t<n.length;t++)n[e+t]=s[t];return n})}catch{g.current=!0}},y=e=>{_.current=_.current.then(()=>v(e)).catch(()=>{})},b=()=>{for(let e=h.current;e<s.current;e+=Q7)y(e)},x=(0,I.useRef)(b);x.current=b,(0,I.useEffect)(()=>{f.current+=1;let e=f.current;return p.current=null,m.current=0,h.current=0,g.current=!1,_.current=Promise.resolve(),u(a.map(()=>null)),y(0),()=>{f.current=e+1}},[e,t]),(0,I.useEffect)(()=>{let e=e=>{if(!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`f`)return;let t=e.target;t instanceof Element&&t.closest(`input, textarea, [contenteditable='true']`)||x.current()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let S=d<o;(0,I.useEffect)(()=>{let e=C.current;if(!S||!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&y(h.current)},{rootMargin:`600px 0px`});return t.observe(e),()=>t.disconnect()},[S,d]),(0,I.useEffect)(()=>{i?.(d)},[d,i]);let C=(0,I.useRef)(null);return(0,L.jsxs)(`pre`,{className:`file-source-view${r?` is-wrapped`:``}${n?` is-dark`:``}`,style:{margin:0,padding:`0 0 0 6px`,border:0,background:`var(--bg)`,...xZ,width:r?`100%`:`max-content`,minWidth:`100%`,minHeight:`100%`,overflow:`visible`},children:[a.map((e,t)=>{let n=l[t];return(0,L.jsxs)(`span`,{className:`file-source-line`,"data-line-number":t+1,style:{display:`flex`,minWidth:`100%`},children:[(0,L.jsx)(`span`,{className:`file-source-line-number`,style:SZ,children:t+1}),(0,L.jsx)(`span`,{className:`file-source-line-content`,style:{flex:`1 1 auto`,minWidth:0,paddingLeft:2,overflowWrap:r?`anywhere`:`normal`,whiteSpace:r?`pre-wrap`:`pre`},children:n===null?e:n.map((e,t)=>(0,L.jsx)(`span`,{className:`file-source-token`,style:bYe(e),children:e.content},t))})]},`source-line-${t}`)}),S&&(0,L.jsx)(`div`,{ref:C,"aria-hidden":`true`})]})}var $7=new Map;function SYe(e){return $7.get(e)??1}function e9(e,t){t<=1?$7.delete(e):$7.set(e,t)}var CYe=(0,I.lazy)(()=>R(()=>import(`./CodeMirrorEditor-BWIfhIqx.js`),__vite__mapDeps([144,1])));function t9({enabled:e,reindexKey:t,dataText:n,className:r,style:i,children:a,onScroll:o,scrollRef:s}){let c=(0,I.useRef)(null),[l,u]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{if(!e){u(!1);return}let t=e=>{if(!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`f`)return;let t=e.target;t instanceof Element&&t.closest(`input, textarea, [contenteditable='true']`)||(e.preventDefault(),u(!0))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,L.jsxs)(`div`,{style:{position:`relative`,height:`100%`,minWidth:0},children:[(0,L.jsx)(`div`,{ref:e=>{c.current=e,s&&(s.current=e)},onScroll:o,className:r,style:{...i,height:`100%`,overflow:`auto`,paddingBottom:e&&l?40:void 0},children:a}),e&&(0,L.jsx)(EBe,{open:l,onClose:()=>u(!1),containerRef:c,reindexKey:t,dataText:n})]})}function wYe({editMode:e,draft:t,filePath:n,language:r,isDark:i,handleEditorChange:a,handleSave:o,highlightReady:s,wrapLines:c,content:l}){let u=(0,I.useRef)(null),d=(0,I.useRef)(SYe(n)),f=()=>{let e=u.current;if(!e||e.scrollTop<=0)return 1;let t=e.querySelectorAll(`.file-source-line`);if(t.length>0){let n=1;for(let r of t){if(r.offsetTop>e.scrollTop)break;n=Number(r.dataset.lineNumber)||n}return n}let n=parseFloat(getComputedStyle(e).lineHeight);return Number.isFinite(n)&&n>0?Math.floor(e.scrollTop/n)+1:1},p=()=>{let e=u.current;if(!e||d.current<=1)return;let t=d.current,n=e.querySelectorAll(`.file-source-line`);if(n.length>0){for(let r of n)if((Number(r.dataset.lineNumber)||0)>=t){e.scrollTop=r.offsetTop;return}return}let r=parseFloat(getComputedStyle(e).lineHeight);Number.isFinite(r)&&r>0&&(e.scrollTop=(t-1)*r)};(0,I.useEffect)(()=>{e||p()},[e]);let m=(0,I.useRef)(!1);(0,I.useEffect)(()=>{e||m.current||!s||!l||(p(),m.current=!0)},[e,s,l]);let[h,g]=(0,I.useState)(0);return(0,L.jsx)(t9,{enabled:!e,reindexKey:`${l}\u0000${s}\u0000${c}\u0000${h}`,className:`file-viewer-source`,style:{display:`block`,background:`var(--bg)`},scrollRef:u,onScroll:()=>{e||(d.current=f(),e9(n,d.current))},children:e?(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`},children:(0,L.jsx)(Uw,{size:B.lg,className:`animate-spin`,"aria-hidden":`true`})}),children:(0,L.jsx)(CYe,{initialValue:t,initialTopLine:d.current,onTopVisibleLineChange:e=>{d.current=e,e9(n,e)},language:r,isDark:i,onChange:a,onSave:o},n)}):s?(0,L.jsx)(xYe,{content:l,language:r,isDark:i,wrapLines:c,onRenderedCountChange:g}):(0,L.jsx)(`pre`,{className:c?`file-source-view is-wrapped`:`file-source-view`,style:{margin:0,padding:`0 0 0 12px`,border:0,background:`var(--bg)`,...xZ,fontFamily:`var(--font-mono)`,whiteSpace:c?`pre-wrap`:`pre`,overflowWrap:c?`anywhere`:`normal`,width:c?`100%`:`max-content`,minWidth:`100%`,minHeight:`100%`,overflow:`visible`},children:l})})}function TYe({hasGitDiff:e,gitDiffPatch:t,t:n}){return e?(0,L.jsx)(t9,{enabled:!0,reindexKey:t??``,children:(0,L.jsx)(xBe,{patch:t})}):(0,L.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-lg)`},children:n(`i18n.noChanges`)})}function EYe({isHtml:e,isMarkdown:t,content:n,t:r,markdownPreview:i,markdownDirectory:a,onOpenFile:o,cwd:s,sourceSessionId:c}){return e?(0,L.jsx)(t9,{enabled:!1,reindexKey:``,children:(0,L.jsx)(`iframe`,{srcDoc:n,sandbox:`allow-scripts`,style:{width:`100%`,height:`100%`,border:`none`,background:`var(--bg)`},title:r(`i18n.htmlPreview`)})}):t?(0,L.jsx)(t9,{enabled:!0,reindexKey:i,dataText:i,children:(0,L.jsx)(SBe,{preview:i,markdownDir:a,onOpenFile:o,cwd:s,sourceSessionId:c})}):null}function DYe({contentRef:e,filePath:t,effectiveDisplayMode:n,editMode:r,draft:i,language:a,isDark:o,handleEditorChange:s,handleSave:c,highlightReady:l,wrapLines:u,content:d,hasGitDiff:f,gitDiffPatch:p,t:m,isHtml:h,isMarkdown:g,markdownPreview:_,markdownDirectory:v,onOpenFile:y,cwd:b,sourceSessionId:x}){return(0,L.jsxs)(`div`,{ref:e,className:`file-viewer-content`,style:{flex:1,overflow:`auto`,paddingRight:4,background:`var(--bg)`},children:[n===`source`&&(0,L.jsx)(wYe,{editMode:r,draft:i,filePath:t,language:a,isDark:o,handleEditorChange:s,handleSave:c,highlightReady:l,wrapLines:u,content:d}),n===`diff`&&(0,L.jsx)(TYe,{hasGitDiff:f,gitDiffPatch:p,t:m}),n===`preview`&&(0,L.jsx)(EYe,{isHtml:h,isMarkdown:g,content:d,t:m,markdownPreview:_,markdownDirectory:v,onOpenFile:y,cwd:b,sourceSessionId:x})]})}function OYe(e){return e?.language===`markdown`?BDe(e.content):``}function kYe({data:e,isDeletedDiff:t,displayMode:n,content:r,filePath:i,t:a}){let o=e?.language??`text`,s=o===`html`,c=o===`markdown`,l=s||c,u=oP(i),d=r.split(`
2135
- `);return{language:o,isHtml:s,isMarkdown:c,hasPreview:l,markdownDirectory:u,lines:d,effectiveDisplayMode:t?`diff`:n===`preview`&&!l?`source`:n,displayModes:t?[`diff`]:[`source`,`preview`,`diff`],metadata:t?a(`files.deleted`):`${o} · ${a(`i18n.lineCount`,{n:d.length})} · ${wJ(e?.size??0)}`}}function AYe({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){let{isDark:c}=vq(),{t:l}=z(),[u,d]=(0,I.useState)(`source`),[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(!1),{data:g,setData:_,loading:v,error:y,loadStatus:b,fetchContent:x}=fBe({filePath:e,sourceSessionId:n,onFileChange:()=>{d(s===`diff`?`diff`:`source`),h(!1),N(),F()}}),S=g?.content??``,{editMode:C,draft:w,dirty:T,saveState:E,saveError:D,editModeRef:O,enterEdit:k,cancelEdit:A,handleEditorChange:j,handleSave:M,resetEditState:N}=yBe({filePath:e,onSaved:a,content:S,applySavedContent:e=>_(t=>t&&{...t,content:e}),reload:()=>{x(e)}}),{gitDiff:ee,gitDiffLoading:te,fetchGitDiff:P,resetGitDiff:F}=pBe({cwd:t,filePath:e,gitRefreshKey:o}),{watching:ne,closeWatch:re}=wZ(e,n,()=>{O.current||(x(e),P(e))});(0,I.useEffect)(()=>{g?.language===`markdown`&&s!==`diff`&&d(`preview`)},[g?.language,s]);let ie=ee?.supported===!0&&typeof ee.patch==`string`,ae=ie&&ee.status===`deleted`;(0,I.useEffect)(()=>{ae&&re()},[ae,re]);let oe=(0,I.useMemo)(()=>OYe(g),[g]),{contentRef:se,selectedLineRange:ce,handleMentionSelectedLines:le}=_Be({filePath:e,cwd:t,content:S,displayMode:u,onMentionLines:i});return(0,I.useEffect)(()=>{p(!1)},[S]),(0,I.useEffect)(()=>{if((ae?`diff`:u)!==`source`||f)return;let e=setTimeout(()=>p(!0),0);return()=>clearTimeout(e)},[ae,u,f]),(0,L.jsx)(jYe,{filePath:e,cwd:t??void 0,sourceSessionId:n??void 0,onOpenFile:r,isDark:c,t:l,loading:v,error:y,loadStatus:b,displayMode:u,setDisplayMode:d,gitDiffLoading:te,data:g,watching:ne,isDeletedDiff:ae,hasGitDiff:ie,wrapLines:m,setWrapLines:h,content:S,editMode:C,dirty:T,handleSave:M,saveState:E,saveError:D,enterEdit:k,cancelEdit:A,highlightReady:f,selectedLineRange:ce,handleMentionSelectedLines:le,draft:w,handleEditorChange:j,markdownPreview:oe,gitDiffPatch:ie?ee.patch:null,contentRef:se})}function jYe({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,isDark:i,t:a,loading:o,error:s,loadStatus:c,displayMode:l,setDisplayMode:u,gitDiffLoading:d,data:f,watching:p,isDeletedDiff:m,hasGitDiff:h,wrapLines:g,setWrapLines:_,content:v,editMode:y,dirty:b,handleSave:x,saveState:S,saveError:C,enterEdit:w,cancelEdit:T,highlightReady:E,selectedLineRange:D,handleMentionSelectedLines:O,draft:k,handleEditorChange:A,markdownPreview:j,gitDiffPatch:M,contentRef:N}){if(o||l===`diff`&&d)return(0,L.jsx)(MYe,{t:a});if(s&&!m)return(0,L.jsx)(NYe,{loadStatus:c,error:s,filePath:e,sourceSessionId:n,cwd:t,t:a});if(!f&&!m)return null;let{language:ee,isHtml:te,isMarkdown:P,hasPreview:F,markdownDirectory:ne,effectiveDisplayMode:re,displayModes:ie,metadata:ae}=kYe({data:f,isDeletedDiff:m,displayMode:l,content:v,filePath:e,t:a});return(0,L.jsxs)(`div`,{className:`file-viewer-shell`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,L.jsx)(dBe,{filePath:e,cwd:t,metadata:ae,watching:p,isDeletedDiff:m,displayModes:ie,effectiveDisplayMode:re,previewSupported:F,previewFormat:ee,setDisplayMode:u,wrapLines:g,setWrapLines:_,editMode:y,dirty:b,handleSave:x,saveState:S,saveError:C,enterEdit:w,cancelEdit:T,highlightReady:E,selectedLineRange:D,handleMentionSelectedLines:O,fileContent:v,sourceSessionId:n,t:a}),(0,L.jsx)(DYe,{contentRef:N,filePath:e,effectiveDisplayMode:re,editMode:y,draft:k,language:ee,isDark:i,handleEditorChange:A,handleSave:x,highlightReady:E,wrapLines:g,content:v,hasGitDiff:h,gitDiffPatch:M,t:a,isHtml:te,isMarkdown:P,markdownPreview:j,markdownDirectory:ne,onOpenFile:r,cwd:t??void 0,sourceSessionId:n})]})}function MYe({t:e}){return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,color:`var(--text-muted)`,fontSize:`var(--text-lg)`},children:[(0,L.jsx)(Uw,{size:B.lg,className:`animate-spin`,"aria-hidden":`true`}),e(`i18n.loading`)]})}function NYe({loadStatus:e,error:t,filePath:n,sourceSessionId:r,cwd:i,t:a}){return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:24,color:`var(--status-error)`,fontSize:`var(--text-lg)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{children:e===413?a(`files.fileTooLargeForPreview`,{limit:wJ(qze)}):t}),e===413&&(0,L.jsx)(EZ,{filePath:n,sourceSessionId:r,cwd:i})]})}function PYe({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){return eBe(e)?(0,L.jsx)(rBe,{filePath:e,cwd:t,sourceSessionId:n}):tBe(e)?(0,L.jsx)(iBe,{filePath:e,cwd:t,sourceSessionId:n}):nBe(e)?(0,L.jsx)(aBe,{filePath:e,cwd:t,sourceSessionId:n}):(0,L.jsx)(AYe,{filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s})}function FYe({activeFileTab:e,activeCwd:t,explorerRefreshKey:n,setExplorerRefreshKey:r,handleFileLineMention:i,handleOpenFile:a}){return(0,L.jsx)(L.Fragment,{children:e&&(0,L.jsx)(PYe,{filePath:e.filePath,cwd:t??void 0,sourceSessionId:e.sourceSessionId,gitRefreshKey:n,initialDisplayMode:e.initialDisplayMode,onMentionLines:i,onSaved:()=>r(e=>e+1),onOpenFile:t=>a(t,aP(t),{sourceSessionId:e.sourceSessionId})})})}function IYe({currentSessionId:e}){let{unread:t,markRead:n}=cC(),[r,i]=(0,I.useState)(null);return(0,I.useEffect)(()=>{t>0&&n()},[t,n]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(BRe,{currentSessionId:e,onViewNotice:i}),(0,L.jsx)(VRe,{entry:r,onClose:()=>i(null)})]})}var LYe={user:{label:`U`,color:`var(--text)`},assistant:{label:`A`,color:`var(--accent)`},thinking:{label:`T`,color:`var(--text-muted)`},tool:{label:`⚙`,color:`var(--status-info)`},bash:{label:`$`,color:`var(--status-info)`},toolError:{label:`E`,color:`var(--status-error)`}};function RYe({row:e,highlighted:t,onHover:n,style:r}){let i=LYe[e.kind],a=e.kind!==`assistant`&&e.kind!==`thinking`,o=e.kind===`tool`||e.kind===`bash`,s=e.kind===`toolError`;return(0,L.jsxs)(`div`,{onPointerEnter:()=>e.spanId&&n?.(e.spanId),onPointerLeave:()=>n?.(null),style:{...r,display:`flex`,gap:8,alignItems:`center`,minWidth:0,borderRadius:4,padding:`1px 4px`,margin:`-1px -4px`,background:t?`var(--bg-selected)`:r?.background},children:[(0,L.jsx)(`span`,{title:e.kind,style:{flexShrink:0,width:16,display:`flex`,justifyContent:`center`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontWeight:700,color:i.color},children:o?(0,L.jsx)(sT,{size:B.sm,style:{color:`var(--status-info)`,flexShrink:0}}):s?(0,L.jsx)(sT,{size:B.sm,style:{color:`var(--status-error)`,flexShrink:0}}):e.kind===`thinking`?(0,L.jsx)(Bw,{size:B.sm,style:{color:`var(--bulb-warning)`,flexShrink:0}}):i.label}),(0,L.jsxs)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontFamily:a?`var(--font-mono)`:void 0,fontSize:`var(--text-sm)`,color:e.kind===`toolError`?`var(--status-error)`:(e.kind,`var(--text-muted)`),fontStyle:e.kind===`thinking`?`italic`:void 0},children:[e.toolName&&!s?(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(`span`,{style:{color:`var(--status-info)`,fontWeight:600,marginRight:8},children:e.toolName})}):s&&e.toolName?(0,L.jsx)(`span`,{style:{color:`var(--status-error)`,fontWeight:600,marginRight:8},children:e.toolName}):e.kind===`bash`?`$ `:null,e.text]}),e.durationSecs!=null&&(0,L.jsx)(UZ,{secs:e.durationSecs,size:`sm`})]})}function zYe(e){let t=[],n=(e,n,r)=>t.push({index:e,userText:n,timestamp:r,endTime:r,tools:0,toolErrors:0,inputTokens:0,messages:[]});for(let r=0;r<e.length;r++){let i=e[r];if(i.role===`user`){let e=typeof i.content==`string`?i.content:i.content.find(e=>e.type===`text`)?.text??``,a=t[t.length-1];a&&a.messages.length>0&&!a.userText?(a.index=r,a.userText=e.replace(/\s+/g,` `).trim(),a.timestamp=i.timestamp,a.endTime=i.timestamp):n(r,e.replace(/\s+/g,` `).trim(),i.timestamp),t[t.length-1].messages.push(i);continue}let a=t[t.length-1]??(n(e.indexOf(i),``),t[t.length-1]);a.messages.push(i),i.role!==`system`&&i.timestamp&&(a.endTime=i.timestamp),i.role===`assistant`&&(a.tools+=i.content.filter(e=>e.type===`toolCall`).length,a.inputTokens+=i.usage?.input??0),i.role===`toolResult`&&i.isError&&(a.toolErrors+=1)}return t[0]&&!t[0].userText&&(t[0].userText=`(start)`),t}var BYe=(e,t)=>t+1,n9=(e,t=160)=>e.replace(/\s+/g,` `).trim().slice(0,t);function VYe(e,t,n,r,i,a){let o=t;for(let s=0;s<e.content.length;s++){let c=e.content[s];if(c.type===`toolCall`){let e=a(c.toolCallId)??o+2e3,l=Math.max(o,t);i.push({lane:2,kind:`tool`,start:l,end:Math.max(e,l+200),label:c.toolName,turnIndex:n,spanId:`m${r}-b${s}`,detail:n9(fZ(c),120)}),o=Math.max(e,o)}else if(c.type===`text`||c.type===`thinking`){let e=c.type===`text`?c.text:c.thinking;if(!e.trim())continue;let t=Math.min(Math.max(e.length*2,2e3),8e3);i.push({lane:1,kind:`assistant`,variant:c.type===`thinking`?`thinking`:`text`,start:o,end:o+t,label:n9(e,80),turnIndex:n,spanId:`m${r}-b${s}`}),o+=t}}}function HYe(e){let t=[],n=1/0,r=0;if(e.forEach((e,i)=>{let a=new Map;for(let t of e.messages)if(t.role===`toolResult`){let e=t;e.toolCallId&&e.timestamp&&Number.isFinite(e.timestamp)&&a.set(e.toolCallId,e.timestamp)}let o=e.messages.find(e=>e.role===`assistant`&&e.timestamp&&Number.isFinite(e.timestamp));for(let s=0;s<e.messages.length;s++){let c=e.messages[s],l=c.timestamp;!l||!Number.isFinite(l)||(c.role!==`system`&&(l<n&&(n=l),l>r&&(r=l)),c.role===`user`?t.push({lane:0,kind:`user`,start:l,end:Math.max(o?.timestamp??l+600,l+200),label:e.userText,turnIndex:i,spanId:`user`}):c.role===`assistant`?VYe(c,l,i,s,t,e=>a.get(e)):c.role===`bashExecution`?t.push({lane:2,kind:`tool`,start:l,end:(()=>{let t=e.messages;for(let e=s+1;e<t.length;e++){let n=t[e].timestamp;if(n&&Number.isFinite(n)&&n>l)return n}return l+400})(),label:n9(c.command,80),turnIndex:i,spanId:`m${s}`}):c.role===`toolResult`&&c.isError&&t.push({lane:2,kind:`error`,start:l,end:l+400,label:c.toolName??`tool`,turnIndex:i,spanId:`m${s}`}))}}),!Number.isFinite(n))return{spans:[],start:0,end:1};let i=Math.max(r,n+1,...t.map(e=>e.end));return{spans:t,start:n,end:i+(i-n)*.03}}var r9=`color-mix(in srgb, var(--accent) 60%, var(--status-error))`;function UYe(e){switch(e.kind){case`user`:return`var(--accent)`;case`assistant`:return e.variant===`thinking`?`color-mix(in srgb, ${r9} 45%, var(--bg-panel))`:r9;case`tool`:return`var(--status-warning)`;case`error`:return`var(--status-error)`}}function WYe(e,t,n){for(let r=0;r<e.content.length;r++){let i=e.content[r];if(i.type===`text`){let e=n9(i.text);e&&n.push({kind:`assistant`,text:e,spanId:`m${t}-b${r}`})}else if(i.type===`thinking`){let e=n9(i.thinking,120);e&&n.push({kind:`thinking`,text:e,spanId:`m${t}-b${r}`})}else i.type===`toolCall`&&n.push({kind:`tool`,text:fZ(i),toolName:i.toolName,durationSecs:i.durationSecs,spanId:`m${t}-b${r}`})}}function GYe(e){let t=[],n=new Map;for(let t of e.messages)if(t.role===`assistant`)for(let e of t.content)e.type===`toolCall`&&n.set(e.toolCallId,fZ(e));for(let r=0;r<e.messages.length;r++){let i=e.messages[r];if(i.role===`assistant`){WYe(i,r,t);continue}if(i.role===`toolResult`){let e=i;if(!e.isError)continue;let a=n.get(e.toolCallId)??n9(e.content.filter(e=>e.type===`text`).map(e=>e.text).join(` `),120);t.push({kind:`toolError`,text:a,toolName:e.toolName,spanId:`m${r}`});continue}if(i.role===`bashExecution`){t.push({kind:`bash`,text:n9(i.command,140),spanId:`m${r}`});continue}if(!(i.role===`custom`&&!i.display)&&(i.role===`custom`||i.role===`user`)){let e=typeof i.content==`string`?n9(i.content):n9(i.content.filter(e=>e.type===`text`).map(e=>e.text).join(` `));e&&t.push({kind:i.role===`user`?`user`:`assistant`,text:e,spanId:i.role===`user`?`user`:void 0})}}return t}var KYe=18;function qYe({turn:e,spans:t,laneLabels:n,emptyLabel:r,start:i,end:a,onHoverSpan:o,hoverSpanId:s}){let c=Math.max(1,a-i),l=[0,1,2].map(e=>t.filter(t=>t.lane===e));return(0,L.jsxs)(`div`,{style:{position:`relative`,flexShrink:0,borderBottom:`1px solid var(--border)`,background:`var(--bg-input)`,userSelect:`none`},children:[[0,1,2].map(e=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,height:KYe},children:[(0,L.jsx)(`span`,{style:{width:64,flexShrink:0,textAlign:`right`,paddingRight:4,fontSize:10,lineHeight:1,color:`var(--text-muted)`},children:n[e]}),(0,L.jsx)(`div`,{style:{position:`relative`,flex:1,alignSelf:`stretch`,overflow:`hidden`,borderTop:e===0?void 0:`1px solid var(--border)`,borderLeft:`1px solid var(--border)`},children:l[e].map((e,t)=>{let n=Math.max(e.start,i),r=Math.min(e.end,a);if(r<=n)return null;let l=(n-i)/c*100,u=(r-n)/c*100,d=e=>e==null?`?`:new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});return(0,L.jsx)(fT,{label:`${e.label}${e.detail?`\n${e.detail}`:``}\n${d(e.start)} → ${d(e.end)} · ${((e.end-e.start)/1e3).toFixed(1)}s`,children:(0,L.jsx)(`div`,{onPointerEnter:()=>o?.(e.spanId),onPointerLeave:()=>o?.(null),style:{position:`absolute`,top:`50%`,transform:`translateY(-50%)`,left:`${l}%`,width:`max(6px, calc(${u}% - 1px))`,height:8,borderRadius:1,background:UYe(e),opacity:s===e.spanId||e.kind===`assistant`||e.kind===`tool`?1:.78,outline:s===e.spanId?`1px solid var(--accent)`:void 0}})},`s-${t}`)})})]},e)),!e&&(0,L.jsx)(`span`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,background:`var(--bg-input)`},children:r})]})}function JYe({turn:e,number:t,open:n,onToggle:r,hoverSpanId:i,onHoverSpan:a}){let{t:o}=z(),s=e.endTime!=null&&e.timestamp!=null?(e.endTime-e.timestamp)/1e3:void 0,c=n?GYe(e):[];return(0,L.jsx)(`div`,{children:(0,L.jsxs)(`div`,{style:{display:`flex`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,flexShrink:0,width:44,padding:`8px 0 0`},children:[(0,L.jsx)(`div`,{style:{fontSize:12},children:(0,L.jsx)(AX,{number:t})}),n&&(0,L.jsx)(`div`,{style:{width:1,flex:1,background:`var(--border)`}})]}),(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsxs)(`button`,{onClick:r,"aria-expanded":n,style:{display:`flex`,alignItems:`baseline`,gap:8,width:`100%`,textAlign:`left`,padding:`8px 12px 8px 4px`,background:`transparent`,cursor:`pointer`},children:[(0,L.jsx)(UZ,{secs:s,timestamp:e.timestamp,endTimestamp:e.endTime}),(0,L.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.userText||o(`trajectory.emptyTurn`)}),e.tools>0&&(0,L.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,flexShrink:0},children:o(`trajectory.turnStats`,{tools:e.tools,errors:e.toolErrors})})]}),n&&(0,L.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5,padding:`2px 12px 12px 4px`},children:c.map((e,t)=>(0,L.jsx)(RYe,{row:e,highlighted:e.spanId!=null&&e.spanId===i,onHover:a,style:{paddingTop:4,borderTop:`1px solid color-mix(in srgb, var(--border) 45%, transparent)`}},t))})]})]})})}function YYe({sessionId:e,active:t=!0}){let{t:n}=z(),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(null);(0,I.useSyncExternalStore)(kJ,Wje);let d=e?Gje(e):void 0,f=e!=null&&d==null;(0,I.useEffect)(()=>{if(i(null),o(null),c(null),!f||!e)return;let t=new AbortController;return fetch(`/api/sessions/${encodeURIComponent(e)}`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(String(e.status));let t=await e.json();i(t.context.messages)}).catch(e=>{t.signal.aborted||o(String(e))}),()=>t.abort()},[e,f]);let p=d??r,m=(0,I.useMemo)(()=>zYe(p??[]),[p]),h=(0,I.useMemo)(()=>m.find(e=>e.index===s)??null,[m,s]),g=(0,I.useMemo)(()=>h?HYe([h]):null,[h]),_=(0,I.useRef)(null),v=(0,I.useRef)(null),y=(0,I.useRef)(0),b=(0,I.useRef)(!1),x=(0,I.useRef)(``);if((0,I.useEffect)(()=>{if(t&&!b.current&&(y.current+=1),b.current=t,!t||!e||m.length===0)return;let n=`${y.current}:${e}`;if(x.current===n)return;x.current=n;let r=qje(e)??m.length-1;if(r>=m.length)return;let i=requestAnimationFrame(()=>{_.current?.scrollToIndex(r),c(m[r].index)});return()=>cancelAnimationFrame(i)},[t,e,m]),!e)return(0,L.jsx)(`div`,{style:{padding:24,color:`var(--text-dim)`},children:n(`trajectory.noSession`)});if(a)return(0,L.jsx)(`div`,{style:{padding:24,color:`var(--status-error)`},children:a});if(!p)return(0,L.jsx)(`div`,{style:{padding:24,color:`var(--text-dim)`},children:n(`trajectory.loading`)});let S=[n(`trajectory.lane.user`),n(`trajectory.lane.assistant`),n(`trajectory.lane.tool`)];return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,minHeight:0},children:[(0,L.jsx)(qYe,{turn:h,spans:g?.spans??[],start:g?.start??0,end:g?.end??1,laneLabels:S,emptyLabel:n(`trajectory.overviewEmpty`),onHoverSpan:u,hoverSpanId:l}),(0,L.jsx)(MK,{direction:`vertical`,scrollElRef:v,wrapperStyle:{flex:1,minHeight:0},children:(0,L.jsx)(Kq,{ref:_,scrollRef:v,children:m.map((e,t)=>(0,L.jsx)(JYe,{turn:e,number:BYe(m,t),open:s===e.index,onToggle:()=>c(t=>t===e.index?null:e.index),hoverSpanId:l,onHoverSpan:u},`${e.index}-${e.userText.slice(0,12)}`))})})]})}function XYe({sessionId:e}){let t=Ake(uq);return(0,L.jsx)(`div`,{"data-trajectory-pane":!0,"data-session-id":e??``,style:{height:`100%`},children:(0,L.jsx)(YYe,{sessionId:e,active:t})})}function ZYe(e){return`min(calc(100vw - 16px), ${Math.max(48,Math.min(e-8,window.innerWidth-e-8))*2}px)`}function QYe({geometries:e,messages:t,onAddMessage:n,onRemoveMessage:r,onUpdateMessage:i,widgets:a,closedKeys:o,onReopen:s}){let{t:c}=z(),[l,u]=(0,I.useState)(null),[d,f]=(0,I.useState)(null),p=(0,I.useRef)(null);(0,I.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]);let m=e=>a.find(t=>t.key===e)?.lines[0],h=(e,t,n)=>{s(e),f({key:e,x:t,y:n}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>f(null),2500)},g=[...new Set([...Object.keys(e),...o.keys()])].map(t=>[t,e[t]]);return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,background:`var(--bg)`},children:[g.length===0?(0,L.jsx)(`div`,{style:{padding:`32px 16px`,textAlign:`center`,color:`var(--text-dim)`,fontSize:`var(--text-lg)`,lineHeight:1.6},children:c(`config.widgets.empty`)}):(0,L.jsx)(`div`,{style:{flex:1,minHeight:0,overflowY:`auto`,padding:10,display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignContent:`flex-start`,gap:6},children:g.map(([e,a])=>{let s=t[e]??[],d=o.has(e),f=m(e);return(0,L.jsxs)(`div`,{"data-testid":`widget-config-item-${e}`,style:{flex:`1 1 200px`,maxWidth:`calc((100% - 18px) / 4)`,boxSizing:`border-box`,padding:`8px 10px`,borderRadius:5,background:`var(--bg-panel)`,border:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7,flexWrap:`wrap`},children:[(0,L.jsxs)(`div`,{style:{minWidth:0,flex:`1 1 120px`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,fontFamily:`var(--font-mono)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e}),a&&(0,L.jsxs)(`div`,{style:{marginTop:2,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,color:`var(--text-dim)`},children:[c(`config.widgets.x`),`: `,a.x,` `,c(`config.widgets.y`),`: `,a.y,` ·`,` `,c(`config.widgets.width`),`: `,a.width,` `,c(`config.widgets.height`),`:`,` `,a.height]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0},children:[d&&(0,L.jsxs)(`button`,{type:`button`,"data-testid":`widget-expand-${e}`,"aria-label":c(`widgets.reopen`),title:c(`widgets.reopen`),onClick:t=>h(e,t.clientX,t.clientY),style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 8px`,borderRadius:5,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`},className:`hover-shift`,children:[(0,L.jsx)(jw,{size:13,"aria-hidden":!0}),c(`widgets.reopen`)]}),(0,L.jsxs)(`button`,{type:`button`,"data-testid":`widget-bind-${e}`,onClick:()=>u(e),style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 8px`,borderRadius:5,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:[(0,L.jsx)(Vw,{size:13,"aria-hidden":!0}),c(`config.widgets.bind`)]})]})]}),f&&(0,L.jsx)(`div`,{style:{marginTop:4,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:f}),(0,L.jsx)(EK,{messages:s,onAdd:t=>n(e,t),onRemove:t=>r(e,t),onUpdate:(t,n)=>i(e,t,n),bindOpen:l===e,onBindOpenChange:e=>{e||u(null)},ns:`widgets`,bindTestIdPrefix:`widget-bind`,editTestIdPrefix:`widget-edit`,chipTestIdPrefix:`widget-bound-${e}`,bindHintArgs:{key:e}})]},e)})}),d&&(0,L.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`widget-expanded-toast`,style:{position:`fixed`,left:d.x,maxWidth:ZYe(d.x),top:d.y+12,transform:`translateX(-50%)`,zIndex:2e3,padding:`8px 12px`,borderRadius:7,border:`1px solid var(--status-success)`,background:`var(--bg)`,color:`var(--text)`,fontSize:`var(--text-base)`,boxShadow:`0 4px 16px var(--shadow-strong)`,whiteSpace:`normal`},children:c(`widgets.expandedToChat`,{key:d.key})})]})}function $Ye({widgetGeometries:e,widgetMessages:t,addWidgetMessage:n,removeWidgetMessage:r,updateWidgetMessage:i,extensionWidgets:a,closedWidgets:o,handleReopenWidget:s}){return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(QYe,{geometries:e,messages:t,onAddMessage:n,onRemoveMessage:r,onUpdateMessage:i,widgets:a,closedKeys:o,onReopen:s})})}function eXe({items:e,openUpdatesTab:t,onDismiss:n}){let{t:r}=z();return(0,L.jsxs)(`div`,{role:`status`,"data-testid":`update-banner`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 12px`,borderBottom:`1px solid var(--border)`,background:`color-mix(in srgb, var(--status-warning) 10%, var(--bg-panel))`,fontSize:`var(--text-sm)`,color:`var(--text)`,flexShrink:0},children:[(0,L.jsx)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r(`updates.banner`,{items:e.join(`, `)})}),(0,L.jsx)(`button`,{type:`button`,"data-testid":`update-banner-view`,onClick:()=>{t()},style:{padding:`3px 10px`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0},children:r(`updates.view`)}),(0,L.jsx)(`button`,{type:`button`,"aria-label":r(`i18n.close`),onClick:n,style:{padding:`2px 6px`,border:`none`,color:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0},children:`✕`})]})}function tXe(){let e=(0,I.useRef)(null);return{chatInputRef:e,handleAtMention:(0,I.useCallback)((t,n)=>{e.current?.insertText(Tq(t,n))},[]),handleAtMentions:(0,I.useCallback)(t=>{let n=cAe(t);n&&e.current?.insertText(n)},[]),handleFileLineMention:(0,I.useCallback)((t,n,r)=>{e.current?.insertText(sAe(t,n,r))},[])}}function nXe(e){try{let t=window.localStorage.getItem(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:null}catch{return null}}function i9(e,t){try{window.localStorage.setItem(e,String(t))}catch{}}function a9(e){let{ariaLabel:t,cssVariable:n,defaultWidth:r,getDefaultWidth:i,getMaxWidth:a,growthDirection:o,maxWidth:s,minWidth:c,storageKey:l,widthRef:u}=e,d=(0,I.useRef)(null),f=(0,I.useRef)(null),p=(0,I.useRef)(!1),[m,h]=(0,I.useState)(r),[g,_]=(0,I.useState)(!1),v=(0,I.useCallback)(()=>Math.min(s,Math.max(c,a())),[a,s,c]),y=(0,I.useCallback)(e=>Use(e,c,v()),[v,c]),b=(0,I.useCallback)(e=>{u.current=e,d.current?.style.setProperty(n,`${e}px`)},[n,u]),x=(0,I.useCallback)((e,t={})=>{let{forcePersist:n=!1,persist:r=!0}=t,i=y(e),a=i!==u.current;return b(i),h(i),r&&(a||n)&&i9(l,i),i},[b,y,l,u]),S=(0,I.useCallback)(e=>{document.body.style.cursor=e.previousCursor,document.body.style.userSelect=e.previousUserSelect},[]),C=(0,I.useCallback)(e=>{let t=f.current;if(!(!t||t.pointerId!==e)){f.current=null,S(t),_(!1),x(u.current,{forcePersist:!0});try{t.target.hasPointerCapture(e)&&t.target.releasePointerCapture(e)}catch{}}},[x,S,u]),w=(0,I.useCallback)(e=>{if(e.pointerType===`mouse`&&e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=f.current;t&&C(t.pointerId);let n=e.currentTarget;n.focus({preventScroll:!0}),n.setPointerCapture(e.pointerId),f.current={pointerId:e.pointerId,startX:e.clientX,startWidth:u.current,target:n,previousCursor:document.body.style.cursor,previousUserSelect:document.body.style.userSelect},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,_(!0)},[C,u]),T=(0,I.useCallback)(e=>{let t=f.current;if(!t||t.pointerId!==e.pointerId)return;if(e.pointerType===`mouse`&&e.buttons===0){C(e.pointerId);return}e.preventDefault();let n=o===`right`?1:-1,r=y(t.startWidth+(e.clientX-t.startX)*n);b(r),e.currentTarget.setAttribute(`aria-valuenow`,String(r)),e.currentTarget.setAttribute(`aria-valuetext`,`${r} px`)},[b,y,C,o]),E=(0,I.useCallback)(e=>{C(e.pointerId)},[C]),D=(0,I.useCallback)(e=>{C(e.pointerId)},[C]),O=(0,I.useCallback)(e=>{C(e.pointerId)},[C]),k=(0,I.useCallback)(()=>{let e=i?.()??r;x(e,{forcePersist:!0})},[x,r,i]),A=(0,I.useCallback)(()=>{x(u.current)},[x,u]),j=(0,I.useCallback)(e=>{let t=e.shiftKey?32:12,n=o===`right`?`ArrowRight`:`ArrowLeft`,r=o===`right`?`ArrowLeft`:`ArrowRight`;e.key===n?(e.preventDefault(),x(u.current+t,{forcePersist:!0})):e.key===r?(e.preventDefault(),x(u.current-t,{forcePersist:!0})):e.key===`Home`?(e.preventDefault(),x(c,{forcePersist:!0})):e.key===`End`?(e.preventDefault(),x(v(),{forcePersist:!0})):e.key===`Enter`&&(e.preventDefault(),k())},[x,v,o,c,k,u]);return(0,I.useEffect)(()=>{if(p.current)return;p.current=!0;let e=nXe(l),t=e??i?.()??r,n=x(t,{persist:!1});e!==null&&e!==n&&i9(l,n)},[x,r,i,l]),(0,I.useEffect)(()=>{if(!p.current)return;x(u.current);let e=()=>{x(u.current)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[x,u]),(0,I.useEffect)(()=>{if(!g)return;let e=()=>{let e=f.current;e&&C(e.pointerId)},t=()=>{document.visibilityState!==`visible`&&e()};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,t)}},[C,g]),(0,I.useEffect)(()=>()=>{let e=f.current;e&&(f.current=null,S(e))},[S]),{isResizing:g,panelRef:d,reclampWidth:A,resetWidth:k,setWidth:e=>x(e,{forcePersist:!0}),separatorProps:{"aria-label":t,"aria-orientation":`vertical`,"aria-valuemax":v(),"aria-valuemin":c,"aria-valuenow":m,"aria-valuetext":`${m} px`,onDoubleClick:k,onKeyDown:j,onLostPointerCapture:O,onPointerCancel:D,onPointerDown:w,onPointerMove:T,onPointerUp:E,role:`separator`,tabIndex:0},width:m}}function rXe({isMobile:e,sidebarOpen:t,setSidebarOpen:n,translate:r}){let[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(280),s=(0,I.useRef)(280),c=(0,I.useCallback)(()=>typeof window>`u`?480:Wse({viewportWidth:window.innerWidth,rightPanelOpen:!1,rightPanelWidth:0}),[]),l=a9({ariaLabel:r(`layout.resizeSidebar`),cssVariable:`--sidebar-width`,defaultWidth:280,getMaxWidth:c,growthDirection:`right`,maxWidth:480,minWidth:180,storageKey:`pi-sidebar-width`,widthRef:o}),u=l.reclampWidth,d=a9({ariaLabel:r(`layout.resizeWidgetPanel`),cssVariable:`--widget-panel-width`,defaultWidth:280,getMaxWidth:()=>typeof window>`u`?560:Gse({viewportWidth:window.innerWidth,sidebarOpen:t,sidebarWidth:l.width}),growthDirection:`left`,maxWidth:560,minWidth:200,storageKey:`pi-widget-panel-width`,widthRef:s});return(0,I.useEffect)(()=>{e&&n(!1)},[e,n]),(0,I.useEffect)(()=>{a(!0)},[]),(0,I.useEffect)(()=>{u()},[u]),{sidebarResizer:l,widgetPanelResizer:d,mobileSidebarReady:i}}var iXe=176,aXe=86;function oXe(e){let t=e.button.getBoundingClientRect(),n=e.row?.getBoundingClientRect(),r=n?.top??t.top,i=n?.bottom??t.bottom,a=Math.min(e.menuWidth,n?.width??e.tabRect.width),o=Math.min(t.left-1,Math.max(n?.left??e.tabRect.left,(n?.right??e.tabRect.right)-a)),s=i+4;return{top:s+e.estHeight>window.innerHeight-4?r-e.estHeight:s,left:o,width:a}}function sXe({activeTopPanel:e,isMobile:t,tabBarRef:n,sidebarTopBarRef:r,languageBtnRef:i}){let[a,o]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(!e)return;let a=()=>{if(document.hidden)return;let a=n.current?.getBoundingClientRect();if(a){if(e===`language`&&!t&&i.current){let e=oXe({menuWidth:iXe,estHeight:aXe,button:i.current,row:r.current,tabRect:a});o(e);return}o({top:a.bottom,left:a.left,width:a.width})}};a();let s=new ResizeObserver(a);return n.current&&s.observe(n.current),i.current&&s.observe(i.current),()=>s.disconnect()},[e,t]),a}var o9=`pi-web`;function s9(e,t){let n=c9(e),r=c9(t),i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=n[e]??0,i=r[e]??0;if(t>i)return 1;if(t<i)return-1}return 0}function c9(e){return e.replace(/^v/i,``).split(/[-+]/)[0].split(`.`).map(e=>{let t=Number.parseInt(e,10);return Number.isNaN(t)?0:t})}function l9({current:e,latest:t},n){return t!==null&&t!==n&&s9(t,e)>0}function u9(e){return e.enabled!==!1}function d9(e,t){return t[e]===`*`}function cXe(e){if(!u9(e))return 0;let t=e.ignored??{};return+!!l9(e.piWeb,t[`pi-web`])+e.plugins.filter(e=>!d9(e.source,t)).length}function lXe(e,t){if(!u9(e))return[];let n=e.ignored??{},r=[];l9(e.piWeb,n[`pi-web`])&&r.push(`pi-web`);let i=e.plugins.filter(e=>!d9(e.source,n)).length;return i>0&&r.push(`${i} ${t}`),r}function uXe({activeCwd:e,translate:t}){let{value:n}=lT(xC),r=(0,I.useMemo)(()=>n?cXe(n):0,[n]),i=(0,I.useMemo)(()=>n?lXe(n,t(`common.plugins`)):[],[n,t]),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(void 0);return(0,I.useEffect)(()=>{e!==s.current&&(s.current=e,Gae(e??null),xC.load().catch(e=>console.error(`[pi-web] load updates:`,e)))},[e]),{updatesBadge:r,updateItems:i,updatesBannerDismissed:a,setUpdatesBannerDismissed:o}}function dXe({panelOpen:e,highlighted:t,onToggle:n}){let{t:r}=z(),i=r(e?`sidebar.hide`:`sidebar.show`);return(0,L.jsx)(fT,{label:i,children:(0,L.jsx)(`button`,{onClick:n,"aria-controls":`widget-panel`,"aria-expanded":e,"aria-label":i,"data-testid":`widget-panel-toggle`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:36,padding:0,border:`none`,borderLeft:`1px solid var(--border)`,color:t?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`color 0.12s`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,L.jsxs)(`svg`,{width:B[`4xl`],height:B[`4xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`rect`,{x:`3`,y:`3`,width:B[`4xl`],height:B[`4xl`],rx:`2`}),(0,L.jsx)(`line`,{x1:`15`,y1:`3`,x2:`15`,y2:`21`})]})})})}function fXe(){return(0,L.jsxs)(`div`,{role:`status`,"aria-label":`Loading`,"data-testid":`boot-splash`,style:{position:`fixed`,inset:0,zIndex:9999,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:18,background:`var(--bg)`,color:`var(--text-muted)`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-6xl)`,fontWeight:700,color:`var(--accent)`,letterSpacing:`0.02em`},children:`pi`}),(0,L.jsx)(`div`,{style:{width:22,height:22,border:`2px solid var(--border)`,borderTopColor:`var(--accent)`,borderRadius:`50%`,animation:`boot-spin 0.8s linear infinite`}}),(0,L.jsx)(`style`,{children:`@keyframes boot-spin { to { transform: rotate(360deg); } }`})]})}function pXe(){let{t:e}=z(),t=(0,I.useSyncExternalStore)(Zje,VJ,VJ);if(t.length===0)return null;let n=t[t.length-1],r={...n,message:$J(n.message,e)},i=t.length;return(0,L.jsx)(BD,{open:!0,onOpenChange:()=>{},children:(0,L.jsxs)(UD,{children:[(0,L.jsx)(GD,{style:{position:`fixed`,inset:0,zIndex:1200,background:`rgba(0, 0, 0, 0.45)`}}),(0,L.jsxs)(qD,{role:`alertdialog`,"aria-modal":`true`,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:1200,maxWidth:480,width:`calc(100% - 48px)`,maxHeight:`calc(100dvh - 48px)`,overflowY:`auto`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:10,padding:`16px 20px`,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.35)`},children:[(0,L.jsxs)(YD,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10,fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:[(0,L.jsx)(`span`,{style:{color:`var(--status-error)`},children:`⚠`}),(0,L.jsx)(`span`,{children:i>1?e(`errors.titleCount`,{count:i}):e(`errors.title`)})]}),(0,L.jsx)(XD,{asChild:!0,children:(0,L.jsx)(`div`,{children:r.kind===`api`?(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,L.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`1px 8px`,borderRadius:999,background:`color-mix(in srgb, var(--status-error) 14%, transparent)`,color:`var(--status-error)`,fontWeight:600,whiteSpace:`nowrap`},children:[`HTTP `,r.status||`ERR`]}),r.context&&(0,L.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`},children:r.context})]}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:r.message})]}):(0,L.jsxs)(`div`,{children:[r.context&&(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginBottom:6},children:r.context}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:r.message})]})})}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:16},children:[i>1&&(0,L.jsx)(`button`,{type:`button`,onClick:$je,style:{border:`1px solid var(--border)`,color:`var(--text-muted)`,borderRadius:6,padding:`4px 12px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.clearAll`)}),(0,L.jsx)(`button`,{type:`button`,onClick:Qje,style:{border:`none`,background:`var(--accent)`,color:`#fff`,borderRadius:6,padding:`4px 14px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.close`)})]})]})]})})}var mXe=3e3,hXe=6e4;function f9(e,t){return e?e.error?e.path.split(/[\\/]/).pop()||t:e.name||e.firstMessage.slice(0,50)||t.slice(0,12):t.slice(0,12)}function p9(e){if(!e)return``;let t=e.projectRoot||e.cwd;return t?aP(t):``}function m9(e,t,n){let r=[t,n].filter(Boolean).join(` / `);return r?`${e} · ${r}`:e}function gXe(e,t){return e.filter(e=>!t.has(e))}function _Xe(e,t,n,r,i=``){switch(e.type){case`prompt_error`:case`extension_error`:{if(!n.errors)return null;let a=e.errorMessage??r(`i18n.commandFailed`);return{title:m9(r(`chat.taskErrorNotificationTitle`),i,t),body:a,tag:`agent-error-${e.sessionId}`}}case`extension_ui_request`:{if(!n.questions)return null;let a=e.method;if(a!==`select`&&a!==`confirm`&&a!==`input`&&a!==`editor`)return null;let o=e.title??r(`chat.questionNotificationTitle`);return{title:m9(r(`chat.questionNotificationTitle`),i,t),body:o,tag:`question-${e.id??e.sessionId}`}}default:return null}}function vXe(e,t,n){return t?e(`chat.sessionCompletedNotificationBodyWithWorkspace`,{workspace:t,name:n}):e(`chat.sessionCompletedNotificationBody`,{name:n})}function yXe(){let{t:e}=z(),{notifyEvents:t}=_w(),[n,r]=(0,I.useState)([]),i=(0,I.useRef)([]);(0,I.useEffect)(()=>{i.current=n});let a=(0,I.useRef)(t);(0,I.useEffect)(()=>{a.current=t});let o=(0,I.useRef)(e);(0,I.useEffect)(()=>{o.current=e});let{runningSessionIds:s}=OY(),c=(0,I.useRef)(!1),l=(0,I.useRef)([]),u=(0,I.useRef)(new Map);(0,I.useEffect)(()=>{if(!a.current.taskComplete)return;let e=c.current?l.current:null;if(l.current=[...s],c.current=!0,!e)return;let t=gXe(e,s);if(t.length===0)return;let n=Date.now();for(let e of t){let t=u.current.get(e);if(t!==void 0&&n-t<mXe)continue;i.current.some(t=>t.id===e)||f.current();let r=i.current.find(t=>t.id===e);console.info(`[notify] completion via running-snapshot (${e})`),mJ({title:o.current(`chat.taskCompleteNotificationTitle`),body:vXe(o.current,p9(r),f9(r,e)),tag:`session-complete-${e}`,notifyWhileActive:a.current.notifyWhileActive})}},[s]);let d=(0,I.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`,{cache:`no-store`});if(!e.ok)return;let t=await e.json();t.sessions&&r(t.sessions)}catch{}},[]),f=(0,I.useRef)(d);return(0,I.useEffect)(()=>{f.current=d}),(0,I.useEffect)(()=>{d();let e=setInterval(()=>void d(),hXe);return()=>clearInterval(e)},[d]),(0,I.useEffect)(()=>eC({ch:`global`},e=>{let t=e;if(!t.sessionId)return;let n=t.sessionId;(t.type===`prompt_error`||t.type===`extension_error`)&&u.current.set(n,Date.now()),i.current.some(e=>e.id===n)||f.current();let r=i.current.find(e=>e.id===n),s=_Xe(t,f9(r,n),a.current,o.current,p9(r));s&&(console.info(`[agent-events] notifying: ${s.title}${s.body?` — ${s.body.slice(0,300)}`:``}`),mJ({...s,notifyWhileActive:a.current.notifyWhileActive}))}),[]),null}var bXe=3;function xXe(){let{t:e}=z(),t=(0,I.useSyncExternalStore)(Toe,dw,dw);if(t.length===0)return null;let n=t.slice(0,bXe),r=t.length-n.length;return(0,L.jsx)(`div`,{"aria-busy":`true`,style:{position:`fixed`,inset:0,zIndex:1150,background:`color-mix(in srgb, var(--bg) 40%, transparent)`,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`},children:(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10,minWidth:220,maxWidth:`60vw`,padding:`14px 18px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,boxShadow:`0 8px 32px rgba(0,0,0,0.25)`},children:[n.map(t=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,fontSize:`var(--text-sm)`,color:`var(--text)`},children:[(0,L.jsx)(`div`,{style:{width:14,height:14,flexShrink:0,border:`2px solid var(--border)`,borderTopColor:`var(--accent)`,borderRadius:`50%`,animation:`spin 0.8s linear infinite`}}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.label||e(`loading.inProgress`)})]},t.id)),r>0&&(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:e(`loading.more`,{count:r})})]})})}function SXe({cwd:e,busy:t,error:n,onCancel:r,onConfirm:i}){let{t:a}=z();return(0,L.jsx)(YO,{open:!0,onOpenChange:e=>{!e&&!t&&r()},children:(0,L.jsxs)(QO,{className:`w-[440px] gap-0 overflow-hidden rounded-lg p-0`,style:{zIndex:1100,maxWidth:`calc(100% - 2rem)`,overflowY:`auto`},showCloseButton:!1,onPointerDownOutside:e=>{t&&e.preventDefault()},onEscapeKeyDown:e=>{t&&e.preventDefault()},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,gap:12,padding:`18px 18px 14px`},children:[(0,L.jsxs)(`svg`,{width:B[`5xl`],height:B[`5xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--status-warning)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{flexShrink:0,marginTop:1},children:[(0,L.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,L.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),(0,L.jsxs)(`div`,{style:{minWidth:0},children:[(0,L.jsx)($O,{style:{fontSize:`var(--text-2xl)`,fontWeight:700,color:`var(--text)`,lineHeight:1.4},children:a(`trust.dialogTitle`)}),(0,L.jsx)(ek,{style:{marginTop:7,fontSize:`var(--text-base)`,lineHeight:1.6,color:`var(--text-muted)`},children:a(`trust.dialogBody`)}),(0,L.jsx)(`code`,{style:{display:`block`,marginTop:10,padding:`8px 10px`,border:`1px solid var(--border)`,borderRadius:5,background:`var(--bg)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,overflowWrap:`anywhere`},children:e}),n&&(0,L.jsx)(`div`,{role:`alert`,style:{marginTop:10,color:`var(--status-error)`,fontSize:`var(--text-base)`,lineHeight:1.5},children:n})]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,padding:`10px 18px`,borderTop:`1px solid var(--border)`},children:[(0,L.jsx)(UO,{type:`button`,variant:`outline`,onClick:r,disabled:t,className:`h-8 px-3 text-xs`,children:a(`trust.cancel`)}),(0,L.jsx)(UO,{type:`button`,onClick:i,disabled:t,className:`h-8 px-3 text-xs`,style:{cursor:t?`wait`:`pointer`},children:a(t?`trust.trusting`:`trust.trustProject`)})]})]})})}var h9=2e3,g9=[],_9=new Set,v9=new Set,CXe=0;function y9(){for(let e of _9)e()}function b9(e){let t=document.querySelector(`[data-testid="session-sidebar"]`);if(!e||!t)return null;let n=Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top);return Math.max(0,n)}function x9(e,t){if(e===null)return;let n=++CXe;g9=[...g9,{id:n,y:e,text:t}],y9();let r=setTimeout(()=>S9(n),h9);v9.add(r)}function S9(e){if(g9.some(t=>t.id===e)){for(let e of v9)clearTimeout(e);v9.clear(),g9=g9.filter(t=>t.id!==e);for(let e of g9){let t=setTimeout(()=>S9(e.id),h9);v9.add(t)}y9()}}function wXe(e,t){x9(b9(e),t)}function C9(e,t){for(let n of document.querySelectorAll(`[${e}]`))if(n.getAttribute(e)===t)return n;return null}function TXe(e){return _9.add(e),()=>{_9.delete(e)}}function EXe(){return g9}function DXe(){let e=(0,I.useSyncExternalStore)(TXe,EXe);return e.length===0?null:(0,L.jsx)(L.Fragment,{children:e.map(e=>(0,L.jsx)(oJ,{open:!0,onDismiss:()=>S9(e.id),autoDismissSecs:2,closable:!1,testId:`deleted-ghost`,style:{position:`absolute`,top:e.y,left:8,zIndex:30,maxWidth:`calc(100% - 16px)`,pointerEvents:`none`,background:`var(--bg)`,color:`var(--accent)`},children:(0,L.jsx)(`span`,{style:{whiteSpace:`normal`,wordBreak:`break-word`},children:e.text})},e.id))})}var OXe=6e4,w9=new Map,T9=new Map,E9=new Map(w9),D9=new Set;function O9(){E9=new Map(w9);for(let e of D9)e()}function kXe(e){return D9.add(e),()=>D9.delete(e)}function k9(e,t){w9.set(e,t),t.status!==`running`&&T9.delete(e),O9()}function A9(){return(0,I.useSyncExternalStore)(kXe,()=>E9,()=>E9)}function j9(e,t,n,r){if(w9.get(e)?.status===`running`)return null;k9(e,{kind:t,status:`running`});let i=tA(n,OXe);return T9.set(e,i),i.promise.then(()=>{k9(e,{kind:t,status:`done`}),r?.()},n=>{k9(e,{kind:t,status:`error`,error:n instanceof Error?n.message:String(n)})}),i}function AXe(e){let t=!1;for(let[n,r]of w9)r.status!==`running`&&!e.has(n)&&(w9.delete(n),t=!0);t&&O9()}var M9=`pi-web:unread-session-ids`;function jXe(){if(typeof window>`u`)return new Set;try{let e=window.localStorage.getItem(M9);if(!e)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function N9(e){if(!(typeof window>`u`))try{e.size===0?window.localStorage.removeItem(M9):window.localStorage.setItem(M9,JSON.stringify([...e]))}catch{}}function MXe(){let[e,t]=(0,I.useState)(()=>jXe());return(0,I.useEffect)(()=>{N9(e)},[e]),{unreadSessionIds:e,setUnreadSessionIds:t}}function NXe(){let{t:e}=z();return(0,L.jsx)(`span`,{title:e(`sidebar.newActivity`),"aria-label":e(`sidebar.newSessionActivity`),style:{width:14,height:14,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,color:`var(--accent)`},children:(0,L.jsxs)(`svg`,{width:B.xl,height:B.xl,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,style:{display:`block`},children:[(0,L.jsx)(`circle`,{cx:`7`,cy:`7`,r:`2.5`,fill:`currentColor`}),(0,L.jsx)(`circle`,{cx:`7`,cy:`7`,r:`3`,stroke:`currentColor`,strokeWidth:`1.4`,opacity:`0.32`,style:{transformOrigin:`center`,animation:`session-ring-pulse 1.6s ease-in-out infinite`}})]})})}function PXe({savedWorkspaces:e,onSavedWorkspacesChange:t,setSelectedCwd:n}){let[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(``),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(!1);return{customPathOpen:r,setCustomPathOpen:i,customPathError:s,setCustomPathError:c,customPathValidating:l,commitCustomPath:(0,I.useCallback)(async r=>{let s=(r??a).trim();if(!(!s||l)){u(!0),c(null);try{let r=await fetch(`/api/cwd/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:s})}),a=await r.json().catch(()=>({}));if(!r.ok||a.error){c(a.error??`HTTP ${r.status}`);return}let l=a.cwd??s;if(n(l),i(!1),o(``),t){let n=e??[];n.some(e=>fQ(e)===fQ(l))||t([...n,l])}}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}},[a,l,e,t,n])}}function FXe({savedWorkspaces:e,onSavedWorkspacesChange:t,onSessionDeleted:n,loadSessions:r}){let[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(null),c=[...A9().values()].some(e=>e.kind===`group`&&e.status===`running`),l=(0,I.useCallback)((e,t=null)=>{a(e),s(t)},[]);return{confirmDeleteGroup:i,setConfirmDeleteGroup:l,deleteGroupAnchor:o,deletingGroup:c,handleDeleteGroup:(0,I.useCallback)(i=>{l(null);let a=j9(fQ(i.root),`group`,async e=>{await Promise.all(i.sessions.map(async t=>{try{let n=await fetch(`/api/sessions/${encodeURIComponent(t.id)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({deleteAllAuxFiles:!0}),signal:e});n.ok||console.error(`[sidebar] failed to delete ${t.id}:`,n.status)}catch(e){e instanceof Error&&e.name===`AbortError`||console.error(`[sidebar] failed to delete ${t.id}:`,e)}}))},()=>{for(let e of i.sessions)n?.(e.id);let a=e??[];t&&a.some(e=>fQ(e)===fQ(i.root))&&t(a.filter(e=>fQ(e)!==fQ(i.root))),r(!1,!0)});return a?a.promise.then(()=>!0,()=>!1):Promise.resolve(!1)},[e,t,n,r])}}var IXe=2e3;function LXe({selectedSessionId:e,refreshKey:t,runningSessionIds:n,setUnreadSessionIds:r,setRunningSessionIds:i,runningPollAuthoritativeRef:a,setError:o}){let[s,c]=(0,I.useState)([]),[l,u]=(0,I.useState)(!0),[d,f]=(0,I.useState)(``),[p,m]=(0,I.useState)(!1),h=(0,I.useRef)(new Set),g=(0,I.useRef)(null),_=(0,I.useRef)(0),v=(0,I.useCallback)(async(e=!1,t=!1)=>{try{e&&u(!0);let n=t?await gC.refresh():await gC.load();c(n.sessions),a.current||i(new Set(n.runningSessionIds??[]));let s=new Set(n.sessions.map(e=>e.id));r(e=>{if(e.size===0)return e;let t=new Set([...e].filter(e=>s.has(e)));return t.size===e.size?e:t}),o(null),e||(m(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>m(!1),2e3))}catch(e){o(String(e))}finally{e&&u(!1)}},[r,i,a,o]),y=(0,I.useRef)(!1);return(0,I.useEffect)(()=>{let e=!y.current;y.current=!0,v(e,e)},[v,t]),(0,I.useEffect)(()=>{let t=[...h.current].filter(t=>!n.has(t)&&t!==e),i=[...n];if((t.length>0||i.length>0)&&r(e=>{let n=new Set(e);return i.forEach(e=>n.delete(e)),t.forEach(e=>n.add(e)),n}),t.length>0&&v(!1),[...n].filter(e=>!s.some(t=>t.id===e)).length>0){let e=Date.now();e-_.current>=IXe&&(_.current=e,v(!1,!0))}h.current=n},[n,e,s,v,r]),(0,I.useEffect)(()=>{e&&(_Ne(e),r(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}))},[e,r]),(0,I.useEffect)(()=>{fetch(`/api/home`).then(e=>e.json()).then(e=>{e.home&&f(e.home)}).catch(e=>console.error(`[pi-web] load home dir:`,e))},[]),{allSessions:s,loading:l,sessionRefreshDone:p,homeDir:d,loadSessions:v}}var P9=(e,t)=>e.replace(/\\/g,`/`)===t.replace(/\\/g,`/`);function F9(e,t){let n=new Date(e),r=new Date().getTime()-n.getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);return i<1?t(`sidebar.justNow`):i<60?t(`sidebar.minutesAgo`,{count:i}):a<24?t(`sidebar.hoursAgo`,{count:a}):o<7?t(`sidebar.daysAgo`,{count:o}):n.toLocaleDateString()}function RXe(e){let t=new Map;for(let n of e){let e=n.projectRoot??n.cwd;if(!e)continue;let r=t.get(e);(!r||n.modified>r)&&t.set(e,n.modified)}return[...t.entries()].sort((e,t)=>t[1].localeCompare(e[1])).map(([e])=>e)}function I9(e,t){return t&&e.startsWith(t)?`~${e.slice(t.length)}`:e}function L9(e){let t=e.split(/[\\/]+/).filter(Boolean);return t.length?t[t.length-1]:e}function R9({text:e,style:t}){return(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`block`,minWidth:0,lineHeight:1.35,direction:`rtl`,textAlign:`left`,...t},children:(0,L.jsx)(`span`,{style:{unicodeBidi:`plaintext`},children:e})})}function z9({session:e}){return(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4,color:`var(--danger)`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:`${e.path}: ${e.error}`,children:[(0,L.jsxs)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{flexShrink:0},children:[(0,L.jsx)(`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`}),(0,L.jsx)(`path`,{d:`M12 9v4`}),(0,L.jsx)(`path`,{d:`M12 17h.01`})]}),e.error]})}var B9=140;function zXe({open:e,children:t,style:n}){let[r,i]=(0,I.useState)(e),[a,o]=(0,I.useState)(e);return(0,I.useEffect)(()=>{let t,n;return e?(i(!0),o(!1),t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>o(!0))})):(o(!1),n=setTimeout(()=>i(!1),B9)),()=>{t!==void 0&&window.cancelAnimationFrame(t),n&&clearTimeout(n)}},[e]),r?(0,L.jsx)(`div`,{style:{...n,opacity:+!!a,transform:a?`translateY(0) scale(1)`:`translateY(-8px) scale(0.96)`,transformOrigin:`top center`,transition:`opacity ${B9}ms ease, transform ${B9}ms ease`,pointerEvents:e?`auto`:`none`},children:t}):null}function BXe({worktreeState:e,allSessions:t,selectedCwd:n,setSelectedCwd:r,onCwdChange:i,initialSessionId:a,skipInitialProjectSelection:o,onSelectSession:s,onInitialRestoreDone:c,markSeen:l}){let u=(0,I.useCallback)(n=>n?e?.forCwd&&P9(e.forCwd,n)||e?.worktrees.some(e=>P9(e.path,n))?e.projectRoot:t.find(e=>e.cwd&&P9(e.cwd,n))?.projectRoot??n:null,[e,t]),d=(0,I.useRef)(null);(0,I.useEffect)(()=>{d.current!==n&&(d.current=n,i?.(n,u(n)))},[n,i,u]);let f=(0,I.useRef)(!1);return(0,I.useEffect)(()=>{if(!(t.length===0||o)&&n===null){if(a&&!f.current){f.current=!0;let e=t.find(e=>e.id===a);if(e){r(e.cwd),l(e.id),s(e,!0);return}c?.()}let e=RXe(t);e.length>0&&r(e[0])}},[t,n,a,o,s,c,l,r]),{projectRootFor:u}}function VXe({onUnseenSession:e}){let[t,n]=(0,I.useState)(()=>new Set);return{seenSessionIds:t,markSeen:(0,I.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),handleUnseen:(0,I.useCallback)(t=>{n(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n}),Fae(t),e?.(t)},[e])}}function HXe(e){let{selectedCwd:t,selectedCwdProp:n,refreshKey:r,setSelectedCwd:i}=e,[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(``),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(!1),[_,v]=(0,I.useState)(null),[y,b]=(0,I.useState)(null),[x,S]=(0,I.useState)(``),C=(0,I.useRef)(null),w=(0,I.useRef)(null),T=(0,I.useRef)(null);(0,I.useEffect)(()=>{n&&n!==T.current&&(T.current=n,i(n))},[n,i]);let E=(0,I.useCallback)(()=>{c(!1),u(!1),f(``),m(null),v(null),S(``)},[]),[D,O]=(0,I.useState)(0);(0,I.useLayoutEffect)(()=>{if(!t){o(null),b(null);return}let e=!1;return b(t),fetch(`/api/worktrees?cwd=${encodeURIComponent(t)}`).then(e=>e.json()).then(n=>{if(!e){if(b(null),n.error||!n.projectRoot){o(null);return}o({forCwd:t,projectRoot:n.projectRoot,isGit:n.isGit??!1,isTopLevel:n.isTopLevel??!1,worktrees:n.worktrees??[]})}}).catch(()=>{e||(b(null),o(null))}),()=>{e=!0}},[t,D,r]);let k=(0,I.useCallback)(async()=>{let e=d.trim();if(!(!e||h||!a)){g(!0),m(null);try{let t=await fetch(`/api/worktrees`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:a.projectRoot,branch:e})}),n=await t.json().catch(()=>({}));if(!t.ok||n.error||!n.path){m(n.error??`HTTP ${t.status}`);return}E(),o(t=>t&&{...t,forCwd:n.path,worktrees:[...t.worktrees,{path:n.path,branch:e,isMain:!1}]}),i(n.path),O(e=>e+1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[E,d,h,a,i]),A=(0,I.useCallback)(async(e,n)=>{if(!(!a||h)){g(!0),m(null);try{let r=await fetch(`/api/worktrees`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:a.projectRoot,path:e,force:n})}),o=await r.json().catch(()=>({}));if(!r.ok){if(o.dirty&&!n){v(e);return}m(o.error??`HTTP ${r.status}`);return}E(),t&&e&&P9(t,e)&&i(a.projectRoot),O(e=>e+1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[E,a,h,t,i]);return(0,I.useEffect)(()=>{let e=e=>{C.current&&!C.current.contains(e.target)&&E()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[E]),{worktreeState:a,worktreeLoadingCwd:y,wtDropdownOpen:s,setWtDropdownOpen:c,wtNewOpen:l,setWtNewOpen:u,wtNewBranch:d,setWtNewBranch:f,wtError:p,setWtError:m,wtBusy:h,wtConfirmRemove:_,setWtConfirmRemove:v,wtFilter:x,setWtFilter:S,wtDropdownRef:C,wtNewInputRef:w,closeWorktrees:E,handleCreateWorktree:k,handleRemoveWorktree:A}}function UXe({selectedCwd:e,worktreeState:t,selectedProject:n,worktreeLoadingCwd:r,t:i}){let a=!!(t?.isGit&&t.isTopLevel&&e&&n===t.projectRoot),o=e&&t&&n===t.projectRoot&&!a?t.isGit?{label:i(`sidebar.openRepoRoot`),title:i(`sidebar.openRepoRootTitle`)}:{label:i(`sidebar.gitRepoRootOnly`),title:i(`sidebar.gitRepoRootOnlyTitle`)}:null,s=!!(e&&r===e);return{showWorktreeSwitcher:a,worktreeLoading:s,inactiveWorktreeSelector:o??(s&&!a?{label:i(`sidebar.worktrees`),title:i(`sidebar.checkingWorktrees`)}:null)}}function WXe({selectedSession:e,selectedSessionId:t,refreshKey:n,selectedCwdProp:r,savedWorkspaces:i,onSavedWorkspacesChange:a,onUnseenSession:o,onCwdChange:s,initialSessionId:c,skipInitialProjectSelection:l,onSelectSession:u,onInitialRestoreDone:d,onSessionDeleted:f}){let{t:p}=z(),[m,h]=(0,I.useState)(null),g=PXe({savedWorkspaces:i,onSavedWorkspacesChange:a,setSelectedCwd:h}),_=HXe({selectedCwd:m,selectedCwdProp:r,refreshKey:n,setSelectedCwd:h}),{worktreeState:v,worktreeLoadingCwd:y}=_,[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(``),w=(0,I.useRef)(null);(0,I.useEffect)(()=>{b&&w.current?.focus()},[b]);let{seenSessionIds:T,markSeen:E,handleUnseen:D}=VXe({onUnseenSession:o}),{unreadSessionIds:O,setUnreadSessionIds:k}=MXe(),A=yNe(),{runningSessionIds:j,runningPhases:M,runningPhaseSince:N,runningRespondingSince:ee,runningBusySince:te,setRunningSessionIds:P,runningPollAuthoritativeRef:F}=OY(),[ne,re]=(0,I.useState)(null),{allSessions:ie,loading:ae,sessionRefreshDone:oe,homeDir:se,loadSessions:ce}=LXe({selectedSessionId:t,refreshKey:n,runningSessionIds:j,setUnreadSessionIds:k,setRunningSessionIds:P,runningPollAuthoritativeRef:F,setError:re});(0,I.useEffect)(()=>{N9(O)},[O]);let{projectRootFor:le}=BXe({worktreeState:v,allSessions:ie,selectedCwd:m,setSelectedCwd:h,onCwdChange:s,initialSessionId:c,skipInitialProjectSelection:l,onSelectSession:u,onInitialRestoreDone:d,markSeen:E}),[ue,de]=(0,I.useState)({}),[fe,pe]=(0,I.useState)(null),me=le(m),he=ie,{showWorktreeSwitcher:ge,inactiveWorktreeSelector:_e}=UXe({selectedCwd:m,worktreeState:v,selectedProject:me,worktreeLoadingCwd:y,t:p}),{confirmDeleteGroup:ve,setConfirmDeleteGroup:ye,deleteGroupAnchor:be,deletingGroup:xe,handleDeleteGroup:Se}=FXe({savedWorkspaces:i,onSavedWorkspacesChange:a,onSessionDeleted:f,loadSessions:ce}),Ce=(0,I.useMemo)(()=>iRe({filteredSessions:he,selectedSession:e,projectRootFor:le,selectedCwd:m,savedWorkspaces:i}),[he,m,le,e,i]),we=S.trim().toLowerCase(),Te=(0,I.useMemo)(()=>aRe(Ce,we),[Ce,we]);return(0,I.useEffect)(()=>{let e=new Set;for(let t of ie)e.add(t.id);for(let t of i??[])e.add(fQ(t));AXe(e)},[ie,i]),{t:p,selectedCwd:m,setSelectedCwd:h,selectedSessionId:t,customPath:g,wt:_,workspaceSearchOpen:b,setWorkspaceSearchOpen:x,workspaceSearchQuery:S,setWorkspaceSearchQuery:C,workspaceSearchInputRef:w,seenSessionIds:T,markSeen:E,handleUnseen:D,unreadSessionIds:O,interactionBadges:A,runningSessionIds:j,runningPhases:M,runningPhaseSince:N,runningRespondingSince:ee,runningBusySince:te,error:ne,setError:re,loading:ae,sessionRefreshDone:oe,homeDir:se,loadSessions:ce,groupCollapsed:ue,setGroupCollapsed:de,hoveredGroup:fe,setHoveredGroup:pe,selectedProject:me,showWorktreeSwitcher:ge,inactiveWorktreeSelector:_e,confirmDeleteGroup:ve,setConfirmDeleteGroup:ye,deleteGroupAnchor:be,deletingGroup:xe,handleDeleteGroup:Se,wsQuery:we,visibleGroups:Te}}var V9=null;function GXe(){let[e,t]=(0,I.useState)(V9);return(0,I.useEffect)(()=>{V9||(async()=>{let e=await(await fetch(`/api/agent-dir`)).json();e.dir&&(V9=e.dir,t(e.dir))})()},[]),e}function KXe({searchQuery:e,setSearchQuery:t,currentPath:n,hasUncommittedPath:r,canSelect:i,busy:a,onCancel:o,onSelect:s}){let{t:c}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{className:`directory-picker-footer`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:10,flexShrink:0,padding:`10px 18px`,borderTop:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,minWidth:0},children:[(0,L.jsxs)(`svg`,{width:B.lg,height:B.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{color:`var(--text-dim)`,flexShrink:0},children:[(0,L.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,L.jsx)(`path`,{d:`m21 21-4.3-4.3`})]}),(0,L.jsx)(BN,{className:`directory-picker-search h-8 flex-1`,type:`text`,value:e,placeholder:c(`directoryPicker.search`),"aria-label":c(`directoryPicker.search`),autoComplete:`off`,spellCheck:!1,style:uP,onChange:e=>t(e.target.value)})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,L.jsx)(`button`,{className:`directory-picker-action`,type:`button`,onClick:o,disabled:a,style:{padding:`6px 14px`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:a?`default`:`pointer`,fontSize:`var(--text-lg)`},children:c(`i18n.cancel`)}),(0,L.jsx)(`button`,{className:`directory-picker-action`,type:`button`,onClick:()=>s(n),disabled:!i,title:c(r?`directoryPicker.openBeforeSelecting`:`directoryPicker.selectCurrentDirectory`),style:{padding:`6px 16px`,border:0,borderRadius:6,background:`var(--accent)`,color:`var(--on-accent)`,fontSize:`var(--text-lg)`,fontWeight:600,opacity:i?1:.6,cursor:i?`pointer`:`default`},children:c(a?`i18n.checking`:`directoryPicker.selectThisFolder`)})]})]})})}function qXe({loading:e,drives:t,filteredDrives:n,filteredDirectories:r,query:i,navigateTo:a,loadError:o,error:s}){let{t:c}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{className:`directory-picker-list`,style:{flex:1,minHeight:0,overflow:`auto`,padding:`8px 10px`},children:[e?(0,L.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:c(`directoryPicker.loadingDirectories`)}):t===null?r.length>0?r.map(e=>(0,L.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void a(e.path),title:e.path,style:{width:`100%`,minHeight:30,display:`flex`,alignItems:`center`,gap:7,padding:`5px 8px`,border:0,borderRadius:5,color:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`},children:[(0,L.jsx)(dP,{}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.path)):(0,L.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:c(i?`directoryPicker.noMatches`:`directoryPicker.noSubdirectories`)}):n.length>0?n.map(e=>(0,L.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void a(e.path),title:e.path,style:{width:`100%`,minHeight:34,display:`flex`,alignItems:`center`,gap:7,padding:`6px 8px`,border:0,borderRadius:5,color:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`},children:[(0,L.jsx)(fP,{}),(0,L.jsx)(`span`,{children:e.name})]},e.path)):(0,L.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:c(i?`directoryPicker.noMatches`:`directoryPicker.noDrives`)}),(o||s)&&(0,L.jsx)(`div`,{style:{padding:`8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:o??s})]})})}function JXe({handlePathSubmit:e,navigateTo:t,parentDirectory:n,loading:r,canNavigateUp:i,pathInputRef:a,pathInput:o,setPathInput:s,setLoadError:c}){let{t:l}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`form`,{onSubmit:e,style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0,padding:`10px 14px`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsx)(`button`,{className:`directory-picker-back`,type:`button`,onClick:()=>void t(n??void 0),disabled:r||!i,title:l(`directoryPicker.goToParent`),"aria-label":l(`directoryPicker.goToParent`),style:{width:36,height:36,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,border:`1px solid var(--border)`,borderRadius:6,background:`#ffffff`,color:`var(--text-muted)`,cursor:i?`pointer`:`default`,opacity:i?1:.45},children:(0,L.jsx)(`svg`,{width:B[`3xl`],height:B[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m18 15-6-6-6 6`})})}),(0,L.jsx)(`label`,{htmlFor:`directory-path`,style:{position:`absolute`,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:0},children:l(`directoryPicker.directoryPath`)}),(0,L.jsx)(BN,{className:`directory-picker-path h-9 flex-1 font-mono text-xs`,id:`directory-path`,type:`text`,ref:a,value:o,placeholder:`/path/to/project or ~/project`,autoComplete:`off`,spellCheck:!1,style:uP,onChange:e=>{s(e.target.value),c(null)}}),(0,L.jsx)(`button`,{className:`directory-picker-action`,type:`submit`,disabled:!o.trim(),title:l(`directoryPicker.goToDirectory`),style:{minWidth:58,height:36,padding:`0 12px`,border:`1px solid var(--border)`,borderRadius:6,background:`#ffffff`,color:`var(--text-muted)`,cursor:o.trim()?`pointer`:`default`,opacity:o.trim()?1:.6},children:l(`directoryPicker.go`)})]})})}function YXe({onCancel:e,onSelect:t,busy:n=!1,error:r}){let{t:i}=z(),[a,o]=(0,I.useState)(``),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(``),[d,f]=(0,I.useState)([]),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(``),[_,v]=(0,I.useState)(null),[y,b]=(0,I.useState)(!0),x=(0,I.useRef)(null),S=(0,I.useCallback)(async e=>{b(!0),v(null);try{let t=await lP(e),n=t.path??e??`/`;o(n),c(t.parentPath??null),u(n),f(t.directories??[]),m(t.drives??null),g(``)}catch(e){v(e instanceof Error?e.message:String(e))}finally{b(!1)}},[]);(0,I.useEffect)(()=>{S()},[S]),(0,I.useEffect)(()=>{x.current?.focus()},[]);let C=e=>{e.preventDefault();let t=l.trim();t&&S(t)},w=l.trim()!==a,T=!!a&&!w&&!n,E=!!s||pP(a),D=h.trim().toLowerCase(),O=e=>!D||e.toLowerCase().includes(D),k=p===null?[]:p.filter(e=>O(e.name)||O(e.path)),A=d.filter(e=>O(e.name)),j=()=>{n||e()};return(0,L.jsxs)(IQ,{title:i(`directoryPicker.selectDirectory`),align:`center`,width:520,height:620,flush:!0,cardClassName:`directory-picker-light`,testId:`directory-picker`,onEscape:j,headerExtra:(0,L.jsx)(`button`,{type:`button`,"data-testid":`directory-picker-close`,disabled:n,title:i(`i18n.close`),"aria-label":i(`i18n.close`),onClick:j,style:{padding:`2px 6px`,border:0,background:`transparent`,color:`var(--text-muted)`,fontSize:`var(--text-5xl)`,lineHeight:1,cursor:n?`default`:`pointer`,opacity:n?.5:1},children:`×`}),children:[(0,L.jsx)(JXe,{handlePathSubmit:C,navigateTo:S,parentDirectory:s,loading:y,canNavigateUp:E,pathInputRef:x,pathInput:l,setPathInput:u,setLoadError:v}),(0,L.jsx)(qXe,{loading:y,drives:p,filteredDrives:k,filteredDirectories:A,query:D,navigateTo:S,loadError:_,error:r}),(0,L.jsx)(KXe,{searchQuery:h,setSearchQuery:g,currentPath:a,hasUncommittedPath:w,canSelect:T,busy:n,onCancel:e,onSelect:t})]})}function XXe({title:e,label:t}){return(0,L.jsxs)(`button`,{type:`button`,"aria-disabled":`true`,tabIndex:-1,title:e,style:{width:`100%`,height:29,boxSizing:`border-box`,marginTop:6,display:`flex`,alignItems:`center`,gap:6,padding:`0 10px`,border:`1px solid var(--border)`,borderRadius:7,background:`var(--bg-hover)`,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,lineHeight:1.35,whiteSpace:`nowrap`,textAlign:`left`,cursor:`default`,opacity:.82},children:[(0,L.jsxs)(`svg`,{width:B.sm,height:B.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:t})]})}function ZXe({open:e,root:t,count:n,busy:r,anchor:i,onConfirm:a,onCancel:o}){let{t:s}=z();return(0,L.jsx)(nk,{open:e,anchor:i,title:s(`sidebar.deleteWorkspaceDialogTitle`),description:s(`sidebar.deleteWorkspace`,{name:L9(t),count:n}),confirmText:s(`sidebar.delete`),destructive:!0,busy:r,onConfirm:a,onCancel:o})}function H9(e){return e.error?e.path.split(/[\\/]/).pop()||e.id:e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12)}function QXe({hasInteractionBadge:e,depth:t,confirmDelete:n,renaming:r,hovered:i,deleting:a,actionsOpen:o=!1}){return{height:54,position:`relative`,animation:e?`interaction-bg-blink 0.6s ease-in-out infinite`:void 0,display:`flex`,alignItems:`center`,paddingLeft:t>0?t*12+29:29,paddingRight:8,cursor:n||r?`default`:`pointer`,backgroundColor:n?`color-mix(in srgb, var(--status-error) 6%, transparent)`:i?`var(--bg-hover)`:`transparent`,transition:`background 0.1s`,opacity:a?.5:1,gap:6,overflow:o?`visible`:`hidden`,zIndex:o?5:void 0}}function $Xe(e){return{cursor:`pointer`,background:e?`var(--bg-hover)`:`var(--bg)`}}function eZe({hasInteraction:e,hasRunning:t,collapsed:n}){return{background:e&&n?`transparent`:t&&n?`linear-gradient(90deg, transparent 13%, color-mix(in srgb, var(--accent) 18%, transparent) 25%, transparent 37%, transparent 63%, color-mix(in srgb, var(--shine-highlight) 50%, transparent) 75%, transparent 87%)`:`transparent`,backgroundSize:t&&n&&!e?`200% 100%`:void 0,animation:e&&n?`interaction-bg-blink 0.6s ease-in-out infinite`:t&&n?`pi-status-shine 1.5s linear infinite`:void 0}}function tZe({group:e,groupSelected:t,hoveredGroup:n,runningSessionIds:r,interactionBadges:i,collapsed:a,setHoveredGroup:o,setGroupCollapsed:s,setConfirmDeleteGroup:c,handleNewSession:l,copyText:u}){let{t:d}=z(),f=e.sessions.some(e=>r.has(e.id)),p=e.sessions.some(e=>i.has(e.id)),m=n===e.root;return(0,L.jsx)(`div`,{"data-testid":`workspace-group-header`,"data-group-root":e.root,onMouseEnter:()=>o(e.root),onMouseLeave:()=>o(null),style:{display:`flex`,alignItems:`center`,gap:4,height:40,padding:`0 2px`,boxSizing:`border-box`,fontSize:`var(--text-base)`,fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600,textTransform:`none`,letterSpacing:.6,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,...$Xe(m)},onClick:()=>{s(t=>({...t,[e.root]:!t[e.root]}))},children:(0,L.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,flex:1,minWidth:0,height:38,boxSizing:`border-box`,padding:`0 8px`,border:`none`,borderRadius:0,...eZe({hasInteraction:p,hasRunning:f,collapsed:a}),boxShadow:`0 2px 8px var(--shadow-color)`,margin:`0 -2px`},children:[(0,L.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:B[`2xl`],flexShrink:0,color:t?`var(--accent)`:`var(--text-muted)`},"data-testid":`workspace-group-icon`,"data-open":a?`false`:`true`,"data-filled":t?`true`:`false`,children:(0,L.jsx)(PK,{size:B[`2xl`],open:!a,filled:t})}),(0,L.jsx)(fT,{label:e.root,wrapperStyle:{flex:1,minWidth:0,overflow:`hidden`},children:(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`100%`,lineHeight:`20px`},children:L9(e.root)})}),m&&(0,L.jsx)(uJ,{items:[{key:`delete-workspace`,onClick:t=>{t.stopPropagation(),c(e.root,t.currentTarget.closest(`[data-testid="workspace-group-header"]`)??t.currentTarget)},title:d(`sidebar.deleteWorkspaceTitle`),testId:`delete-workspace`,danger:!0,ghost:!0,icon:(0,L.jsx)(aT,{size:B.xl})},{key:`copy-path`,onClick:t=>{t.stopPropagation(),u(e.root)},title:d(`sidebar.copyPath`),ghost:!0,icon:(0,L.jsx)(kw,{size:B.xl})}]}),(0,L.jsx)(uJ,{items:[{key:`new-session`,onClick:t=>{t.stopPropagation(),l(e.root)},title:d(`sidebar.newSessionTitle`,{path:L9(e.root)}),ghost:!0,icon:(0,L.jsx)(qw,{size:B.xl})}]})]})})}var nZe=` (Ctrl+Enter)`;function rZe(e,t,n){return t?e.kind===`naming`?n(`title.generating`):e.kind===`success`?n(`title.updated`):`${n(`title.generateSession`)}${nZe}`:n(`title.noMessages`)}function iZe({sessionId:e,hasMessages:t,onRenamed:n,size:r=24,ref:i}){let{t:a}=z(),[o,s]=(0,I.useState)({kind:`idle`}),c=LN(),l=(0,I.useRef)(!0);(0,I.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]);let u=(0,I.useCallback)(async()=>{if(!t||o.kind===`naming`)return;c.cancel(),s({kind:`naming`});let r=!1;try{let t=await mw(`/api/sessions/${encodeURIComponent(e)}/auto-name`,{method:`POST`},{loading:`silent`});if(!t?.title)throw Error(`The server did not return a session title`);if(!l.current)return;n?.(e,t.title.trim()),r=!0,s({kind:`success`}),c.schedule(()=>s({kind:`idle`}),1800)}catch(e){BJ(e,`auto-name`)}finally{!r&&l.current&&s({kind:`idle`})}},[t,o.kind,c,e,n]);(0,I.useImperativeHandle)(i,()=>({run:()=>void u()}),[u]);let d=o.kind===`success`;return(0,L.jsx)(uJ,{size:r,gap:0,items:[{key:`auto-name`,testId:`session-auto-name`,title:rZe(o,t,a),disabled:!t||o.kind===`naming`,skipHover:d,color:d?`var(--status-success)`:void 0,icon:o.kind===`naming`?(0,L.jsx)(Uw,{className:`animate-spin`,size:B.xl,"aria-hidden":`true`}):d?(0,L.jsx)(Tw,{size:B.xl,"aria-hidden":`true`}):(0,L.jsx)(tT,{size:B.xl,"aria-hidden":`true`}),onClick:e=>{e.stopPropagation(),u()}}]})}function aZe({collapsed:e,onToggleCollapse:t}){return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(fT,{label:e?`Expand forks`:`Collapse forks`,children:(0,L.jsx)(`button`,{onClick:e=>{e.stopPropagation(),t?.()},style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:20,height:20,padding:0,flexShrink:0,border:`none`,color:`var(--text-dim)`,cursor:`pointer`,transform:e?`rotate(-90deg)`:`none`,transition:`transform 0.15s`},children:(0,L.jsx)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})})})})}function oZe({session:e,title:t,onConfirm:n,onCancel:r}){let{t:i}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),(0,L.jsxs)(`div`,{style:{marginTop:2,display:`flex`,alignItems:`center`,gap:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[e.error?(0,L.jsx)(z9,{session:e}):(0,L.jsx)(`span`,{title:e.modified,children:F9(e.modified,i)}),(0,L.jsx)(`span`,{children:i(`sidebar.messagesCount`,{count:e.messageCount})})]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:5,flexShrink:0},children:[(0,L.jsxs)(`button`,{onClick:n,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,height:30,padding:`0 11px`,background:`var(--status-error)`,border:`none`,borderRadius:6,color:`var(--on-error)`,cursor:`pointer`,fontSize:`var(--text-base)`,fontWeight:600,whiteSpace:`nowrap`},children:[(0,L.jsx)(aT,{size:B.base}),i(`sidebar.delete`)]}),(0,L.jsx)(`button`,{onClick:r,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:30,padding:`0 11px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`,fontWeight:500,whiteSpace:`nowrap`},children:i(`sidebar.cancel`)})]})]})})}var sZe=(e=!1)=>({display:`flex`,alignItems:`center`,justifyContent:`center`,width:20,height:20,padding:0,border:`1px solid transparent`,borderRadius:6,background:`transparent`,color:e?`var(--status-error)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`background 0.12s, color 0.12s, border-color 0.12s`,"--hover-bg":e?`color-mix(in srgb, var(--status-error) 8%, transparent)`:`var(--bg-selected)`,"--hover-color":e?`var(--status-error)`:`var(--accent)`,"--hover-border":`transparent`});function U9({testId:e,title:t,onClick:n,danger:r=!1,hoverOnly:i=!1,children:a}){return(0,L.jsx)(fT,{label:t,wrapperClassName:i?`hover-only`:void 0,children:(0,L.jsx)(`button`,{type:`button`,"data-testid":e,"aria-label":t,onClick:n,className:`hover-shift${i?` hover-only`:``}`,style:sZe(r),children:a})})}function cZe({session:e,isSeen:t,onUnseen:n,startRename:r,handleDeleteClick:i}){let{t:a}=z();return(0,L.jsxs)(`div`,{"data-testid":`session-item-actions`,role:`group`,"aria-label":a(`sidebar.actions`),style:{display:`flex`,alignItems:`center`,gap:2,flexShrink:0,marginLeft:6},children:[(0,L.jsxs)(`span`,{className:`session-row-actions`,style:{display:`flex`,alignItems:`center`,gap:2},children:[t&&n!=null&&(0,L.jsx)(U9,{testId:`session-unseen`,title:a(`sidebar.disconnect`),hoverOnly:!0,onClick:t=>{t.stopPropagation(),n(e.id)},children:(0,L.jsx)(Dse,{size:B.xl})}),(0,L.jsx)(U9,{testId:`session-delete`,title:a(`sidebar.deleteWithShiftClick`),danger:!0,hoverOnly:!0,onClick:i,children:(0,L.jsx)(aT,{size:B.xl})}),(0,L.jsx)(U9,{testId:`session-copy`,title:a(`sidebar.copyPath`),hoverOnly:!0,onClick:t=>{t.stopPropagation(),OZ(e.path)},children:(0,L.jsx)(kw,{size:B.xl})})]}),(0,L.jsx)(U9,{testId:`session-rename`,title:a(`sidebar.rename`),onClick:r,children:(0,L.jsx)(Gw,{size:B.xl})})]})}function lZe({session:e,title:t,isSelected:n,isSeen:r,isRunning:i,isUnread:a,phase:o,answering:s,elapsed:c,totalElapsed:l,onUnseen:u,handleDeleteClick:d,startRename:f}){let{t:p}=z();return(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,minWidth:0,fontSize:`var(--text-base)`,fontWeight:400,lineHeight:1.4,color:r?`var(--text)`:`var(--text-dim)`},title:t,children:(0,L.jsx)(`span`,{style:{flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0},children:t})}),(0,L.jsxs)(`div`,{style:{marginTop:2,display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,gap:8,color:n?`var(--text-muted)`:`var(--text-dim)`,fontSize:`var(--text-sm)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[e.error?(0,L.jsx)(z9,{session:e}):i?(0,L.jsx)(s$,{phase:o,answering:s,elapsed:c,totalElapsed:l}):a?(0,L.jsx)(NXe,{}):(0,L.jsx)(`span`,{title:e.modified,children:F9(e.modified,p)}),!e.error&&i?null:(0,L.jsx)(`span`,{children:p(`sidebar.messagesCount`,{count:e.messageCount})}),e.worktreeBranch&&(0,L.jsxs)(`span`,{title:`Worktree: ${e.cwd}`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--accent)`,minWidth:0,overflow:`hidden`},children:[(0,L.jsxs)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.worktreeBranch})]})]}),(0,L.jsx)(cZe,{session:e,isSeen:r,onUnseen:u,startRename:f,handleDeleteClick:d})]})]})}function uZe(e){return e instanceof HTMLElement&&e.closest(`[data-testid="session-auto-name"]`)!==null}function dZe({session:e,isSelected:t,isRunning:n,phase:r,phaseSince:i,respondingSince:a,busySince:o,isUnread:s,isSeen:c=!0,hasInteractionBadge:l=!1,onClick:u,onRenamed:d,onDeleted:f,onUnseen:p,depth:m=0,hasChildren:h=!1,collapsed:g=!1,onToggleCollapse:_}){let{t:v}=z(),y=kY(!!n,r?i:a),b=kY(!!n,o),x=!!n&&r==null&&a!=null,[S,C]=(0,I.useState)(!1),[w,T]=(0,I.useState)(!1),[E,D]=(0,I.useState)(``),[O,k]=(0,I.useState)(!1),A=A9().get(e.id)?.status===`running`,[j,M]=(0,I.useState)(null),[N,ee]=(0,I.useState)(null),te=(0,I.useRef)(null),P=H9(e),F=(0,I.useCallback)(t=>{t.stopPropagation(),D(e.name??``),T(!0),setTimeout(()=>te.current?.select(),0)},[e.name]),ne=(0,I.useCallback)(async()=>{let t=E.trim();if(T(!1),t!==(e.name??``))try{await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:t})}),d?.()}catch{}},[E,e.id,e.name,d]),re=(0,I.useCallback)(t=>{k(!1),M(null),j9(e.id,`session`,async n=>{let r=t===`all`?{deleteAllAuxFiles:!0}:t.length>0?{deleteAuxFiles:t}:null,i=await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`DELETE`,signal:n,...r?{headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}:{}});if(!i.ok)throw Error(`delete session failed: HTTP ${i.status}`)},()=>f?.(e.id))},[e.id,f]),ie=(0,I.useCallback)(t=>{if(t.stopPropagation(),ee(t.currentTarget.closest(`[data-testid="session-item"]`)??t.currentTarget),t.shiftKey){re(`all`);return}aY(e.id).then(e=>{e.length>0?M(e):k(!0)})},[re,e.id]),ae=(0,I.useCallback)(e=>{e.stopPropagation(),re([])},[re]),oe=(0,I.useCallback)(e=>{e.stopPropagation(),k(!1)},[]),se=(0,I.useCallback)(e=>{e.key===`Enter`&&ne(),e.key===`Escape`&&T(!1)},[ne]),ce=(0,I.useCallback)((e,t)=>{D(t),d?.()},[d]);return(0,L.jsxs)(L.Fragment,{children:[j!=null&&(0,L.jsx)(TJ,{open:!0,mode:`delete`,files:j,busy:A,anchor:N,onConfirm:e=>void re(e),onCancel:()=>M(null)}),(0,L.jsx)(`div`,{"data-testid":`session-item`,"data-session-id":e.id,onClick:O||w?void 0:u,title:l?v(`sidebar.interactionBadge`):void 0,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),style:QXe({hasInteractionBadge:l,depth:m,confirmDelete:O,renaming:w,hovered:S,deleting:A}),className:t&&!O?`row-selected-gradient`:void 0,children:(0,L.jsx)(fZe,{session:e,title:P,inputRef:te,isSelected:t,isSeen:c,isUnread:s,isRunning:n,phase:r,answering:x,elapsed:y,totalElapsed:b,depth:m,hasChildren:h,collapsed:g,onToggleCollapse:_,confirmDelete:O,renaming:w,renameValue:E,onRenameChange:D,onAutoNamed:ce,commitRename:ne,handleRenameKeyDown:se,handleDeleteClick:ie,handleDeleteConfirm:ae,handleDeleteCancel:oe,startRename:F,onUnseen:p})})]})}function fZe({session:e,title:t,inputRef:n,isSelected:r,isSeen:i,isUnread:a,isRunning:o,phase:s,answering:c,elapsed:l,totalElapsed:u,depth:d,hasChildren:f,collapsed:p,onToggleCollapse:m,confirmDelete:h,renaming:g,renameValue:_,onRenameChange:v,commitRename:y,handleRenameKeyDown:b,onAutoNamed:x,handleDeleteClick:S,handleDeleteConfirm:C,handleDeleteCancel:w,startRename:T,onUnseen:E}){let D=(0,I.useRef)(null);return h?(0,L.jsx)(oZe,{session:e,title:t,onConfirm:C,onCancel:w}):g?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`input`,{ref:n,"data-testid":`session-rename-input`,value:_,onChange:e=>v(e.target.value),onBlur:e=>{uZe(e.relatedTarget)||y()},onKeyDown:e=>{if(e.key===`Enter`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),D.current?.run();return}b(e)},autoFocus:!0,style:{flex:1,fontSize:`var(--text-base)`,padding:`5px 8px`,border:`1px solid var(--accent)`,borderRadius:5,outline:`none`,background:`var(--bg)`,color:`var(--text)`,height:30}}),(0,L.jsx)(`span`,{onMouseDown:e=>e.preventDefault(),style:{display:`flex`,flexShrink:0},children:(0,L.jsx)(iZe,{ref:D,sessionId:e.id,hasMessages:e.messageCount>0,onRenamed:x})})]}):(0,L.jsxs)(L.Fragment,{children:[d>0&&(0,L.jsxs)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--text-dim)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(lZe,{session:e,title:t,isSelected:r,isSeen:i,isRunning:o,isUnread:a,phase:s,answering:c,elapsed:l,totalElapsed:u,onUnseen:E,handleDeleteClick:S,startRename:T}),f&&(0,L.jsx)(aZe,{collapsed:p,onToggleCollapse:m})]})}function W9({node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningRespondingSince:a,runningBusySince:o,unreadSessionIds:s,seenSessionIds:c,interactionBadges:l,onSelectSession:u,onRenamed:d,onSessionDeleted:f,onUnseen:p,depth:m}){let[h,g]=(0,I.useState)(!1),_=e.children.length>0;return(0,L.jsxs)(`div`,{style:{},children:[(0,L.jsxs)(`div`,{style:{position:`relative`},children:[m>0&&(0,L.jsx)(`div`,{style:{position:`absolute`,left:m*12+6,top:0,bottom:0,width:1,background:`var(--border)`,pointerEvents:`none`}}),(0,L.jsx)(dZe,{session:e.session,isSelected:e.session.id===t,isRunning:n.has(e.session.id),phase:r[e.session.id],phaseSince:i[e.session.id],respondingSince:a[e.session.id],busySince:o[e.session.id],isUnread:s.has(e.session.id),isSeen:c.has(e.session.id),hasInteractionBadge:l.has(e.session.id),onClick:()=>u(e.session),onRenamed:d,onDeleted:e=>f?.(e),onUnseen:p,depth:m,hasChildren:_,collapsed:h,onToggleCollapse:()=>g(e=>!e)})]}),_&&!h&&(0,L.jsx)(`div`,{children:e.children.map(e=>(0,L.jsx)(W9,{node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningRespondingSince:a,runningBusySince:o,unreadSessionIds:s,seenSessionIds:c,interactionBadges:l,onSelectSession:u,onRenamed:d,onSessionDeleted:f,onUnseen:p,depth:m+1},e.session.id))})]})}function pZe(e){let t=new Map;for(let n of e)t.set(n.id,{session:n,children:[]});let n=new Map;for(let t of e)t.parentSessionId&&n.set(t.id,t.parentSessionId);function r(e){let r=n.get(e),i=new Set;for(;r;){if(i.has(r))return null;if(i.add(r),t.has(r))return r;r=n.get(r)}return null}let i=[];for(let e of t.values()){let n=r(e.session.id);n?t.get(n).children.push(e):i.push(e)}let a=e=>{e.sort((e,t)=>t.session.modified.localeCompare(e.session.modified)),e.forEach(e=>a(e.children))};return a(i),i}function mZe({visibleGroups:e,selectedSessionId:t,selectedProject:n,wsQuery:r,groupCollapsed:i,hoveredGroup:a,confirmDeleteGroup:o,deletingGroup:s,runningSessionIds:c,runningPhases:l,runningPhaseSince:u,runningRespondingSince:d,runningBusySince:f,unreadSessionIds:p,seenSessionIds:m,interactionBadges:h,setHoveredGroup:g,setGroupCollapsed:_,setConfirmDeleteGroup:v,deleteGroupAnchor:y,handleDeleteGroup:b,handleNewSession:x,copyText:S,handleSelectSessionFromList:C,onSessionDeleted:w,handleUnseen:T,loadSessions:E}){let{t:D}=z(),O=o?e.find(e=>e.root===o)??null:null;return(0,L.jsxs)(L.Fragment,{children:[e.map(o=>{let s=o.sessions.some(e=>e.id===t)||o.root===n;return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(tZe,{group:o,groupSelected:s,hoveredGroup:a,runningSessionIds:c,interactionBadges:h,collapsed:!!i[o.root],setHoveredGroup:g,setGroupCollapsed:_,setConfirmDeleteGroup:v,handleNewSession:x,copyText:S}),(r||!i[o.root])&&(o.sessions.length===0?(0,L.jsx)(`div`,{style:{padding:`10px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`},children:D(`sidebar.noSessions`)}):pZe(o.sessions).map(n=>(0,L.jsx)(W9,{node:n,selectedSessionId:t,runningSessionIds:c,runningPhases:l,runningPhaseSince:u,runningRespondingSince:d,runningBusySince:f,unreadSessionIds:p,seenSessionIds:m,interactionBadges:h,onSelectSession:C,onRenamed:()=>E(!1,!0),onSessionDeleted:t=>{let n=e.find(e=>e.sessions.some(e=>e.id===t)),r=n?.sessions.find(e=>e.id===t);wXe(C9(`data-session-id`,t),D(`sidebar.deletedSessionGhost`,{workspace:n?L9(n.root):r?.path??``,session:r?H9(r):t})),w?.(t),E(!1,!0)},onUnseen:T,depth:0},n.session.id)))]},o.root)}),(0,L.jsx)(ZXe,{open:!!O,root:O?.root??``,count:O?.sessions.length??0,busy:s,anchor:y,onConfirm:()=>{if(!O)return;let e=b9(C9(`data-group-root`,O.root)),t=O.sessions.length;b(O).then(n=>{n&&x9(e,D(`sidebar.deletedWorkspaceGhost`,{name:L9(O.root),count:t}))})},onCancel:()=>v(null)})]})}function hZe({loading:e,error:t,noSearchResults:n}){let{t:r}=z();return e?(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:[(0,L.jsx)(`div`,{style:{width:14,height:14,border:`2px solid var(--border)`,borderTopColor:`var(--text-dim)`,borderRadius:`50%`,animation:`spin 0.8s linear infinite`,flexShrink:0}}),r(`sidebar.loading`)]}):t?(0,L.jsx)(`div`,{style:{padding:`12px 14px`,color:`var(--status-error)`,fontSize:`var(--text-base)`},children:t}):n?(0,L.jsx)(`div`,{style:{padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:r(`sidebar.searchSessionsNoResults`)}):null}function gZe({searchOpen:e,onToggleSearch:t,onNewWorkspace:n,onRefresh:r,refreshDone:i}){let{t:a}=z();return(0,L.jsx)(uJ,{ghost:!0,items:[{key:`search`,testId:`workspace-search-toggle`,onClick:t,title:a(`sidebar.searchSessions`),ariaPressed:e,color:e?`var(--accent)`:`var(--text-muted)`,background:e?`var(--bg-selected)`:void 0,icon:(0,L.jsx)(Qw,{size:B.lg})},{key:`new-workspace`,testId:`new-workspace`,onClick:n,title:a(`sidebar.newWorkspace`),color:`var(--text-muted)`,icon:(0,L.jsx)(ase,{size:B.xl})},{key:`refresh`,testId:`session-refresh`,onClick:r,title:a(`sidebar.refresh`),skipHover:i,color:i?`var(--status-success)`:`var(--text-muted)`,background:i?`color-mix(in srgb, var(--status-success) 18%, transparent)`:void 0,icon:i?(0,L.jsx)(Tw,{size:B.xl,color:`var(--status-success)`,strokeWidth:2.5}):(0,L.jsx)(Yw,{size:B.xl})}]})}function _Ze({value:e,onChange:t,onClear:n,inputRef:r}){let{t:i}=z();return(0,L.jsxs)(`div`,{"data-testid":`workspace-search`,style:{display:`flex`,alignItems:`center`,gap:4,width:`100%`,minWidth:0,padding:`4px 8px`,background:`var(--bg)`,borderBottom:`1px solid var(--border)`,boxSizing:`border-box`},children:[(0,L.jsx)(Qw,{size:B.lg,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,L.jsx)(`input`,{ref:r,value:e,onChange:e=>t(e.target.value),placeholder:i(`sidebar.searchSessionsPlaceholder`),"aria-label":i(`sidebar.searchSessions`),style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`var(--text)`,fontSize:`var(--text-sm)`}}),e&&(0,L.jsx)(`button`,{type:`button`,onClick:n,"aria-label":i(`chat.clearSearch`),style:{border:`none`,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0,padding:0},children:`✕`})]})}function vZe({wtNewOpen:e,setWtNewOpen:t,wtNewBranch:n,setWtNewBranch:r,wtNewInputRef:i,handleCreateWorktree:a,wtBusy:o,setWtError:s}){let{t:c}=z();return(0,L.jsx)(L.Fragment,{children:e?(0,L.jsxs)(`div`,{style:{padding:`6px 8px`},children:[(0,L.jsx)(`input`,{ref:i,"data-testid":`worktree-new-branch-input`,value:n,onChange:e=>{r(e.target.value),s(null)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a()),e.key===`Escape`&&(t(!1),r(``),s(null))},placeholder:c(`sidebar.branchName`),style:{width:`100%`,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,padding:`5px 8px`,border:`1px solid var(--accent)`,borderRadius:5,outline:`none`,background:`var(--bg)`,color:`var(--text)`,boxSizing:`border-box`}}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:5,marginTop:5},children:[(0,L.jsx)(`button`,{"data-testid":`worktree-create`,onClick:()=>void a(),disabled:o||!n.trim(),style:{flex:1,padding:`4px 0`,background:`var(--accent)`,border:`none`,borderRadius:5,color:`var(--on-accent)`,fontSize:`var(--text-sm)`,fontWeight:600,cursor:o||!n.trim()?`not-allowed`:`pointer`,opacity:o||!n.trim()?.65:1},children:c(o?`sidebar.creating`:`sidebar.create`)}),(0,L.jsx)(`button`,{onClick:()=>{t(!1),r(``),s(null)},style:{flex:1,padding:`4px 0`,background:`var(--bg-hover)`,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:c(`sidebar.cancel`)})]})]}):(0,L.jsxs)(`button`,{"data-testid":`worktree-new`,onClick:e=>{e.stopPropagation(),t(!0),s(null),setTimeout(()=>i.current?.focus(),0)},title:c(`sidebar.createWorktreeTitle`),style:{display:`flex`,alignItems:`center`,gap:7,width:`100%`,padding:`8px 10px`,border:`none`,color:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-sm)`},children:[(0,L.jsxs)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`5`,y1:`1`,x2:`5`,y2:`9`}),(0,L.jsx)(`line`,{x1:`1`,y1:`5`,x2:`9`,y2:`5`})]}),(0,L.jsx)(`span`,{children:c(`sidebar.newWorktree`)})]})})}function yZe({worktrees:e,visibleWorktrees:t,selectedCwd:n,homeDir:r,wtConfirmRemove:i,setWtConfirmRemove:a,handleRemoveWorktree:o,wtBusy:s,setSelectedCwd:c,closeWorktrees:l,showWtFilter:u,wtFilter:d}){let{t:f}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{style:{maxHeight:`min(40vh, 300px)`,overflowY:`auto`},children:[t.map(t=>{let u=P9(t.path,n)||t.isMain&&!e.some(e=>P9(e.path,n));return i===t.path?(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 10px`,borderBottom:`1px solid var(--border)`,background:`color-mix(in srgb, var(--status-error) 6%, transparent)`},children:[(0,L.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:f(`sidebar.forceRemoveCheckout`)}),(0,L.jsx)(`button`,{"data-testid":`worktree-force-remove`,onClick:()=>void o(t.path,!0),disabled:s,style:{padding:`3px 9px`,background:`var(--status-error)`,border:`none`,borderRadius:5,color:`var(--on-error)`,fontSize:`var(--text-sm)`,fontWeight:600,cursor:`pointer`,flexShrink:0},children:f(`sidebar.force`)}),(0,L.jsx)(`button`,{onClick:()=>a(null),style:{padding:`3px 9px`,background:`var(--bg-hover)`,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`,flexShrink:0},children:f(`sidebar.cancel`)})]},t.path):(0,L.jsxs)(`div`,{className:`wt-row`,"data-testid":`worktree-row`,style:{display:`flex`,alignItems:`center`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsxs)(`button`,{"data-testid":`worktree-item`,onClick:()=>{c(t.path),l()},title:t.path,style:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,gap:7,padding:`8px 10px`,background:`var(--bg)`,border:`none`,color:u?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`},children:[u?(0,L.jsx)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:(0,L.jsx)(`polyline`,{points:`1.5 5 4 7.5 8.5 2.5`})}):(0,L.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,L.jsx)(R9,{text:t.branch??I9(t.path,r),style:{flex:1}}),t.isMain&&(0,L.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:f(`sidebar.main`)})]}),!t.isMain&&(0,L.jsx)(`button`,{"data-testid":`worktree-remove`,onClick:()=>void o(t.path,!1),disabled:s,title:f(`sidebar.removeWorktreeTitle`,{path:t.path}),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:34,height:28,padding:0,marginRight:4,border:`none`,color:`var(--text-dim)`,cursor:`pointer`,borderRadius:5,flexShrink:0,transition:`color 0.12s, background 0.12s`,"--hover-color":`var(--status-error)`,"--hover-bg":`color-mix(in srgb, var(--status-error) 8%, transparent)`},className:`hover-shift`,children:(0,L.jsxs)(`svg`,{width:B.base,height:B.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,L.jsx)(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),(0,L.jsx)(`path`,{d:`M10 11v6M14 11v6`}),(0,L.jsx)(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})]})})]},t.path)}),u&&t.length===0&&d.trim()&&(0,L.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:f(`sidebar.noMatchingWorktrees`)})]})})}function bZe({wt:e,selectedCwd:t,homeDir:n,setSelectedCwd:r}){let{t:i}=z(),{worktreeState:a,wtFilter:o,setWtFilter:s,wtDropdownOpen:c,setWtDropdownOpen:l,wtDropdownRef:u,closeWorktrees:d,handleRemoveWorktree:f,wtConfirmRemove:p,setWtConfirmRemove:m,wtBusy:h,wtNewOpen:g,setWtNewOpen:_,wtNewBranch:v,setWtNewBranch:y,wtNewInputRef:b,handleCreateWorktree:x,wtError:S,setWtError:C}=e;if(!a)return null;let w=a.worktrees.find(e=>P9(e.path,t))??a.worktrees.find(e=>e.isMain),T=a.worktrees.length>=8,E=T&&o.trim()?a.worktrees.filter(e=>(e.branch??I9(e.path,n)).toLowerCase().includes(o.trim().toLowerCase())):a.worktrees;return(0,L.jsxs)(`div`,{ref:u,"data-testid":`worktree-switcher`,style:{position:`relative`,marginTop:6},children:[(0,L.jsxs)(`button`,{"data-testid":`worktree-switcher-trigger`,onClick:()=>l(e=>!e),title:w?i(`sidebar.switchWorktreeTitle`,{path:w.path}):i(`sidebar.switchWorktree`),style:{width:`100%`,height:29,boxSizing:`border-box`,display:`flex`,alignItems:`center`,gap:6,padding:`0 10px`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:7,cursor:`pointer`,fontSize:`var(--text-sm)`,lineHeight:1.35,color:`var(--text-muted)`,textAlign:`left`},children:[(0,L.jsxs)(`svg`,{width:B.sm,height:B.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0,color:w&&!w.isMain?`var(--accent)`:`var(--text-dim)`},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(R9,{text:w?w.branch??I9(w.path,n):`…`,style:{flex:1,fontFamily:`var(--font-mono)`,color:`var(--text)`}}),w?.isMain&&(0,L.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:i(`sidebar.main`)}),a.worktrees.length>1&&(0,L.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:a.worktrees.length}),(0,L.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:(0,L.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})]}),(0,L.jsxs)(zXe,{open:c,style:{position:`absolute`,top:`calc(100% + 4px)`,left:0,right:0,zIndex:100,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 6px 20px var(--shadow-color)`,overflow:`hidden`},children:[T&&(0,L.jsx)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:(0,L.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(s(``),d())},placeholder:i(`sidebar.filterWorktrees`),autoFocus:!0,style:{width:`100%`,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,padding:`5px 8px`,border:`1px solid var(--border)`,borderRadius:5,outline:`none`,background:`var(--bg)`,color:`var(--text)`,boxSizing:`border-box`}})}),(0,L.jsx)(yZe,{worktrees:a.worktrees,visibleWorktrees:E,selectedCwd:t,homeDir:n,wtConfirmRemove:p,setWtConfirmRemove:m,handleRemoveWorktree:f,wtBusy:h,setSelectedCwd:r,closeWorktrees:d,showWtFilter:T,wtFilter:o}),(0,L.jsx)(vZe,{wtNewOpen:g,setWtNewOpen:_,wtNewBranch:v,setWtNewBranch:y,wtNewInputRef:b,handleCreateWorktree:x,wtBusy:h,setWtError:C}),S&&(0,L.jsx)(`div`,{style:{padding:`5px 10px 8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`,lineHeight:1.35,overflowWrap:`anywhere`},children:S})]})]})}function xZe({sb:e,handleSelectSessionFromList:t,handleNewSession:n,onSessionDeleted:r}){let{t:i}=z(),a=GXe(),{customPath:o,wt:s,selectedCwd:c,setSelectedCwd:l,homeDir:u,workspaceSearchOpen:d,setWorkspaceSearchOpen:f,workspaceSearchQuery:p,setWorkspaceSearchQuery:m,workspaceSearchInputRef:h,loadSessions:g,sessionRefreshDone:_,showWorktreeSwitcher:v,inactiveWorktreeSelector:y,loading:b,error:x,wsQuery:S,visibleGroups:C}=e;return(0,L.jsxs)(L.Fragment,{children:[o.customPathOpen&&(0,L.jsx)(YXe,{busy:o.customPathValidating,error:o.customPathError,onCancel:()=>{o.setCustomPathOpen(!1),o.setCustomPathError(null)},onSelect:e=>void o.commitCustomPath(e)}),(0,L.jsxs)(dJ,{title:i(`sidebar.workspace`),titleTooltip:a?i(`sidebar.workspaceStoragePath`,{path:a}):void 0,open:!0,onToggle:()=>{},collapsible:!1,testId:`workspace-scroll`,hintTestId:`workspace`,scrollStyle:{flex:`1 1 auto`,minHeight:80,background:`var(--bg)`},style:{flex:1,minHeight:0},actions:(0,L.jsx)(gZe,{searchOpen:d,onToggleSearch:()=>{d&&m(``),f(e=>!e)},onNewWorkspace:()=>o.setCustomPathOpen(!0),onRefresh:()=>g(!1,!0),refreshDone:_}),headerExtra:(0,L.jsxs)(L.Fragment,{children:[d&&(0,L.jsx)(_Ze,{value:p,onChange:m,onClear:()=>{m(``),h.current?.focus()},inputRef:h}),v&&(0,L.jsx)(bZe,{wt:s,selectedCwd:c,homeDir:u,setSelectedCwd:l}),y&&(0,L.jsx)(XXe,{title:y.title,label:y.label})]}),children:[(0,L.jsx)(hZe,{loading:b,error:x,noSearchResults:!b&&!x&&!!S&&C.length===0}),(0,L.jsx)(mZe,{visibleGroups:C,selectedSessionId:e.selectedSessionId,selectedProject:e.selectedProject,wsQuery:S,groupCollapsed:e.groupCollapsed,hoveredGroup:e.hoveredGroup,confirmDeleteGroup:e.confirmDeleteGroup,deletingGroup:e.deletingGroup,runningSessionIds:e.runningSessionIds,runningPhases:e.runningPhases,runningPhaseSince:e.runningPhaseSince,runningRespondingSince:e.runningRespondingSince,runningBusySince:e.runningBusySince,unreadSessionIds:e.unreadSessionIds,seenSessionIds:e.seenSessionIds,interactionBadges:e.interactionBadges,setHoveredGroup:e.setHoveredGroup,setGroupCollapsed:e.setGroupCollapsed,setConfirmDeleteGroup:e.setConfirmDeleteGroup,deleteGroupAnchor:e.deleteGroupAnchor,handleDeleteGroup:e.handleDeleteGroup,handleNewSession:n,copyText:OZ,handleSelectSessionFromList:t,onSessionDeleted:r,handleUnseen:e.handleUnseen,loadSessions:g})]})]})}function SZe({selectedSessionId:e,selectedSession:t,onSelectSession:n,onNewSession:r,initialSessionId:i,skipInitialProjectSelection:a,onInitialRestoreDone:o,refreshKey:s,onSessionDeleted:c,onUnseenSession:l,selectedCwd:u,onCwdChange:d,savedWorkspaces:f,onSavedWorkspacesChange:p,onOpenFile:m}){let{t:h}=z(),g=WXe({selectedSession:t,selectedSessionId:e,refreshKey:s,selectedCwdProp:u,savedWorkspaces:f,onSavedWorkspacesChange:p,onUnseenSession:l,onCwdChange:d,initialSessionId:i,skipInitialProjectSelection:a,onSelectSession:n,onInitialRestoreDone:o,onSessionDeleted:c}),{setError:_,loadSessions:v,markSeen:y,setSelectedCwd:b}=g,x=(0,I.useCallback)(async t=>{if(t.id!==e){try{if((await fetch(`/api/sessions/${encodeURIComponent(t.id)}`,{method:`HEAD`})).status===404){_(h(`sidebar.sessionDeleted`)),v(!1,!0);return}}catch{}t.cwd&&b(t.cwd),y(t.id),n(t)}},[n,h,v,y,_,b,e]),S=(0,I.useCallback)(e=>{let t=e??g.selectedCwd;if(!t)return;let n=typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;r?.(n,t)},[g.selectedCwd,r]);return(0,L.jsxs)(`div`,{"data-testid":`session-sidebar`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`,position:`relative`},children:[(0,L.jsx)(xZe,{sb:g,handleSelectSessionFromList:x,handleNewSession:S,onSessionDeleted:e=>{c?.(e),g.loadSessions(!1,!0)}}),(0,L.jsx)(DXe,{})]})}function CZe({command:e,note:t}){let{t:n}=z(),[r,i]=(0,I.useState)(!1),a=async()=>{try{await OZ(e),i(!0),setTimeout(()=>i(!1),1500)}catch{}};return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`div`,{style:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,background:`var(--bg-panel)`,border:`1px solid var(--border)`,borderRadius:6,padding:`6px 8px`},children:(0,L.jsx)(`code`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text)`},children:e})}),(0,L.jsx)(`button`,{onClick:()=>void a(),style:G9(),children:n(r?`updates.copied`:`updates.copyCommand`)})]}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:t})]})}function G9(e){return{padding:`6px 12px`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:e?`not-allowed`:`pointer`,fontSize:`var(--text-base)`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,gap:6,whiteSpace:`nowrap`,flexShrink:0}}function K9({title:e,subtitle:t,right:n,children:r,style:i}){return(0,L.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-input)`,...i},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:16,padding:`10px 14px`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2,minWidth:0},children:[(0,L.jsx)(`span`,{style:{fontSize:`var(--text-lg)`,color:`var(--text)`,fontWeight:500},children:e}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})]}),(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0},children:n})]}),r?(0,L.jsx)(`div`,{style:{borderTop:`1px solid var(--border)`,padding:`8px 14px 10px`},children:r}):null]})}var q9=new Map,J9=new Map,Y9=new Map(q9),X9=new Set;function Z9(){Y9=new Map(q9);for(let e of X9)e()}function wZe(e){return X9.add(e),()=>X9.delete(e)}function Q9(e,t){q9.set(e,t),t.status!==`running`&&J9.delete(e),Z9()}function TZe(){return(0,I.useSyncExternalStore)(wZe,()=>Y9,()=>Y9)}function EZe(e){let t=!1;for(let[n,r]of q9)r.status!==`running`&&!e.has(n)&&(q9.delete(n),t=!0);t&&Z9()}async function DZe(e,t,n,r){let i=await fetch(`/api/plugins`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`update`,source:e,scope:t,cwd:n}),signal:r}),a=await i.json();if(!i.ok||a.error)throw Error(a.error??`HTTP ${i.status}`);await xC.refresh(r),yC.load().catch(e=>console.error(`[pi-web] load home plugins:`,e))}function OZe(e,t,n){if(!n||q9.get(e)?.status===`running`)return;Q9(e,{status:`running`});let r=tA(r=>DZe(e,t,n,r),12e4);J9.set(e,r),r.promise.then(()=>Q9(e,{status:`done`}),t=>{Q9(e,{status:`error`,error:t instanceof Error?t.message:String(t)})})}var kZe=3e4;function AZe(e){let{value:t}=lT(xC),[n,r]=(0,I.useState)(null),[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)(null),c=nA(),l=(0,I.useRef)(null),u=n??t?.enabled!==!1,d=t?.ignored??{},f=(e,t)=>t!==null&&s9(t,e)>0,p=(e,t)=>{a(!0);let n=c.start(e,kZe);l.current=n.promise,n.promise.catch(e=>{e instanceof eA||(t?.(),s(e instanceof Error?e.message:String(e)))}).finally(()=>{l.current===n.promise&&a(!1)})},m=()=>{s(null),p(async e=>{await xC.refresh(e)})},h=(e,t)=>{s(null),t?.optimisticEnabled!==void 0&&r(t.optimisticEnabled),p(async t=>{let n=await fetch(`/api/updates-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t}),r=await n.json();if(!n.ok||r.error)throw Error(r.error??`HTTP ${n.status}`);await xC.refresh(t)},()=>{t?.optimisticEnabled!==void 0&&r(null)})};return{value:t,enabled:u,ignored:d,checking:i,actionError:o,piWebUpdate:t?f(t.piWeb.current,t.piWeb.latest):!1,piWebIgnored:d[o9]===t?.piWeb.latest,toggleEnabled:e=>void h({enabled:e},{optimisticEnabled:e}),ignoreVersion:(e,t)=>void h({ignored:{[e]:t}}),updatePlugin:(t,n)=>OZe(t,n,e),refresh:m}}function jZe({cwd:e}){let{t}=z(),{value:n,enabled:r,ignored:i,checking:a,actionError:o,piWebUpdate:s,piWebIgnored:c,toggleEnabled:l,ignoreVersion:u,updatePlugin:d,refresh:f}=AZe(e),p=TZe(),m=[...p.values()].some(e=>e.status===`running`);return(0,I.useEffect)(()=>{n&&EZe(new Set(n.plugins.map(e=>e.source)))},[n]),(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:16},children:[(0,L.jsx)(PZe,{t,enabled:r,value:n,actionError:o,checking:a,onToggle:l,onRefresh:f}),(0,L.jsx)(K9,{style:{maxWidth:460},title:`pi-web`,subtitle:n?`${n.piWeb.current}${s?` → ${n.piWeb.latest}`:``}`:`…`,right:(0,L.jsx)(MZe,{value:n,enabled:r,piWebUpdate:s,piWebIgnored:c,t,onIgnore:e=>u(o9,e)}),children:n&&s&&n.piWeb.latest!==null&&(0,L.jsx)(CZe,{command:`npm i -g @rainmanhhh/pi-web@${n.piWeb.latest}`,note:t(`updates.restartNote`)})}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-lg)`,color:`var(--text)`,fontWeight:500,marginTop:4},children:t(`common.plugins`)}),!r||(n?.plugins.length??0)===0?(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`,fontSize:`var(--text-base)`},children:t(`updates.noPluginUpdates`)}):(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:n?.plugins.map(e=>(0,L.jsx)(K9,{style:{flex:`1 1 300px`,minWidth:280,maxWidth:`calc((100% - 16px) / 3)`},title:e.displayName,subtitle:e.latest?`${e.current} → ${e.latest}`:e.source,children:(0,L.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8},children:(0,L.jsx)(NZe,{pluginIgnored:i[e.source]===`*`,busy:p.get(e.source)?.status===`running`,allBusy:m,error:p.get(e.source)?.error,t,onUpdate:()=>d(e.source,e.scope),onIgnore:t=>u(e.source,t)})})},`${e.scope}:${e.source}`))})]})}function MZe({value:e,enabled:t,piWebUpdate:n,piWebIgnored:r,t:i,onIgnore:a}){return e?t?n?r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(`updates.ignored`,{version:e.piWeb.latest??``})}),(0,L.jsx)(`button`,{onClick:()=>a(null),style:G9(),children:i(`updates.unignore`)})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{style:{color:`var(--status-success)`,fontWeight:500},children:i(`updates.updateAvailable`)}),(0,L.jsx)(`button`,{onClick:()=>a(e.piWeb.latest),style:G9(),children:i(`updates.ignoreVersion`)})]}):e.piWeb.latest===null?(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`updates.unavailable`)}):(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`updates.upToDate`)}):(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`updates.disabled`)}):null}function NZe({pluginIgnored:e,busy:t,allBusy:n,error:r,t:i,onUpdate:a,onIgnore:o}){return e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(`updates.ignoredPlugin`)}),(0,L.jsx)(`button`,{onClick:()=>o(null),style:G9(),children:i(`updates.unignore`)})]}):(0,L.jsxs)(L.Fragment,{children:[r&&(0,L.jsx)(`span`,{title:r,style:{color:`var(--status-error)`,fontSize:`var(--text-sm)`,maxWidth:160,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),(0,L.jsxs)(`button`,{onClick:a,disabled:t,style:G9(t),children:[t&&(0,L.jsx)(Uw,{size:14,className:`animate-spin`,"aria-hidden":`true`}),i(t?`i18n.updating`:`i18n.update`)]}),(0,L.jsx)(`button`,{onClick:()=>o(`*`),disabled:n,style:G9(n),children:i(`updates.ignoreVersion`)})]})}function PZe({t:e,enabled:t,value:n,actionError:r,checking:i,onToggle:a,onRefresh:o}){let s=i||!t;return(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,L.jsxs)(`label`,{title:e(`updates.enableCheckingHint`),style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`,fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:[(0,L.jsx)(`input`,{type:`checkbox`,"data-testid":`updates-enabled-toggle`,checked:t,onChange:e=>a(e.target.checked)}),(0,L.jsx)(`span`,{children:e(`updates.enableChecking`)})]}),(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:`var(--text-base)`,color:`var(--text-dim)`},children:[t?n?`${e(`updates.checkedAt`)} ${new Date(n.checkedAt).toLocaleTimeString()}`:e(`updates.checking`):e(`updates.disabled`),r?` · ${r}`:``]}),(0,L.jsxs)(`button`,{onClick:o,disabled:s,style:G9(s),children:[i&&(0,L.jsx)(Uw,{size:14,className:`animate-spin`,"aria-hidden":`true`}),e(i?`updates.checking`:`updates.check`)]})]})}var FZe=e=>window.history.replaceState(null,``,e);function IZe(e){return e?`Pi Web · ${e}`:`Pi Web`}function LZe(e,t){return e&&!t}function RZe(e,t,n){return e?t:n}function zZe(e,t){return e>0&&!t}function BZe(e,t){return!!(e&&t)}function VZe(e,t,n,r){t&&n(!1),r(t=>t===e?null:e)}function HZe(e,t,n){e&&t(),n(e=>!e)}function UZe(e,t,n){e&&!t&&n(!1)}function WZe(e,t,n){e?t(e=>!e):n(e=>!e)}function GZe(e){return e?aP(e)||e:null}function $9(e){return e?.id??null}function KZe(e,t){return e?.cwd??t}function qZe(e){return e?pq(e.filePath):`file:`}function JZe(){let[e,t]=(0,I.useState)(!1);(0,I.useEffect)(()=>{t(!0)},[]);let[n]=(0,I.useState)(()=>$ke(new URLSearchParams(window.location.search))),{isDark:r,toggleTheme:i}=vq(),{locale:a,setLocale:o,t:s,supportedLocales:c}=z(),l=uC();Zke();let{settingsValue:u,defaultThinkingLevel:d,setDefaultThinkingLevel:f,compaction:p,retry:m,defaultProjectTrust:h,setDefaultProjectTrust:g,savedWorkspaces:_,handleSavedWorkspacesChange:v,widgetGeometries:y,setWidgetGeometry:b,widgetMessages:x,addWidgetMessage:S,removeWidgetMessage:C,updateWidgetMessage:w}=Soe({isDark:r,toggleTheme:i}),[T,E]=(0,I.useState)(null),{selectedSession:D,effectiveNewSessionCwd:O,showChat:k,projectTrustCwd:A,refreshKey:j,sessionKey:M,explorerRefreshKey:N,setExplorerRefreshKey:ee,modelsRefreshKey:te,setModelsRefreshKey:P,activeCwd:F,initialCwdStatus:ne,initialCwdError:re,initialSessionRestored:ie,projectTrust:ae,projectTrustDialogOpen:oe,setProjectTrustDialogOpen:se,projectTrustBusy:ce,projectTrustError:le,setProjectTrustError:ue,extensionDialogActiveRef:de,handleSelectSession:fe,handleNewSession:pe,handleSessionCreated:me,handleAgentEnd:he,handleSessionForked:ge,handleSessionDeleted:_e,handleSessionUnseen:ve,handleCwdChange:ye,handleTrustProject:be,handleExplorerRefresh:xe,handleInitialRestoreDone:Se}=Poe({initialNavigation:n,onProjectSwitch:()=>{E(null),Ce(e=>e.filter(e=>e.kind!==`file`)),we(null),FZe(`/`)},onSessionSelected:e=>{e||(we(oq),_t(!1)),UZe(l,e,tt)},onTopPanelReset:()=>E(null)}),{setSavedTabs:Ce,setActiveSavedId:we,configTabOpen:Te,configSection:Ee,setConfigSection:De,configTabActive:Oe,updatesTabOpen:ke,updatesTabActive:Ae,openUpdatesTab:je,noticesTabOpen:Me,noticesTabActive:Ne,openNoticesTab:Pe,trajectoryTabOpen:Fe,trajectoryTabActive:Ie,openTrajectoryTab:Le,branchesTabOpen:Re,branchesTabActive:ze,openBranchesTab:Be,activeFileTab:Ve,fileTabs:He,modelConfigFocus:Ue,handleOpenFile:We,openConfigTab:Ge,handleOpenModelConfig:Ke,closeConfigTab:qe,handleCloseMainTab:Je}=Wke({onSessionSelected:()=>{_t(!1),l&&tt(!1)},onRefreshModels:()=>P(e=>e+1)}),{updatesBadge:Ye,updateItems:Xe,updatesBannerDismissed:Ze,setUpdatesBannerDismissed:Qe}=uXe({activeCwd:F,translate:s}),$e=(0,I.useCallback)(e=>{We(e,aP(e),{sourceSessionId:$9(D)})},[We,D]),[et,tt]=(0,I.useState)(!0),{sidebarResizer:nt,widgetPanelResizer:rt,mobileSidebarReady:it}=rXe({isMobile:l,sidebarOpen:et,setSidebarOpen:tt,translate:s}),at=(0,I.useRef)(null),ot=(0,I.useRef)(null),st=(0,I.useRef)(null),ct=LN(),lt=(0,I.useCallback)(()=>{ct.schedule(()=>{E(null)},150)},[ct]),ut=ct.cancel,dt=sXe({activeTopPanel:T,isMobile:l,tabBarRef:at,sidebarTopBarRef:ot,languageBtnRef:st}),ft=(0,I.useCallback)(e=>VZe(e,l,tt,E),[l]),pt=(0,I.useCallback)(()=>HZe(l,()=>E(null),tt),[l]),{widgetPanelOpen:mt,setWidgetPanelOpen:ht,widgetsTabActive:gt,setWidgetsTabActive:_t,extensionWidgets:vt,closedWidgets:yt,handleCloseWidget:bt,handleReopenWidget:xt,handleExtensionWidgetsChange:St,rightSidebarOpen:Ct,setRightSidebarOpen:wt,closedWidgetCount:Tt}=Qke({widgetGeometries:y,setWidgetGeometry:b}),Et=RZe(l,mt,Ct),Dt=(0,I.useRef)(null),Ot=(0,I.useRef)(null);(0,I.useEffect)(()=>{let e=Dt.current;if(e!==l){if(Dt.current=l,l)Ot.current={left:et,right:Ct},tt(!1),ht(!1);else if(e===!0){let e=Ot.current;e&&(tt(e.left),wt(e.right))}}},[l]);let{chatInputRef:kt,handleAtMention:At,handleAtMentions:jt,handleFileLineMention:Mt}=tXe(),Nt=n.sessionId;Uae({onNewSession:e=>pe(`kb-${Date.now()}`,e),activeCwd:F});let Pt=LZe(ie,k),Ft=tAe({translate:s,closedWidgetCount:Tt,configTabOpen:Te,onConfigTabActivate:(0,I.useCallback)(()=>{window.dispatchEvent(new CustomEvent(rq))},[]),updatesTabOpen:ke,noticesTabOpen:Me,trajectoryTabOpen:Fe,branchesTabOpen:Re,updatesBadge:Ye,fileTabs:He}),It=GZe(F);uT(()=>{l&&Te&&qe()},[l]);let Lt=IZe(It),Rt=$9(D),zt=KZe(D,O);(0,I.useEffect)(()=>{xq(Lt)},[Lt]),(0,I.useEffect)(()=>{let e=()=>{xq(Lt)};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Lt]);let Bt=fC(),Vt=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Dje,{topBarRef:ot,notifyPermission:Bt,isDark:r,toggleTheme:i,updatesBadge:Ye,openUpdatesTab:je,openConfigTab:Ge,openNoticesTab:Pe,isMobile:l,setSidebarOpen:tt,activeTopPanel:T,setActiveTopPanel:E,cancelCloseTopPanel:ut,scheduleCloseTopPanel:lt,languageBtnRef:st}),zZe(Ye,Ze)&&(0,L.jsx)(eXe,{items:Xe,openUpdatesTab:je,onDismiss:()=>Qe(!0)}),(0,L.jsx)(SZe,{selectedSessionId:Rt,selectedSession:D,onSelectSession:fe,onNewSession:pe,initialSessionId:Nt,skipInitialProjectSelection:n.requestedCwd!==null,onInitialRestoreDone:Se,refreshKey:j,onSessionDeleted:_e,onUnseenSession:ve,selectedCwd:zt,onCwdChange:ye,savedWorkspaces:_,onSavedWorkspacesChange:v,onOpenFile:We})]});if(!e)return(0,L.jsx)(fXe,{});let Ht=(0,L.jsx)(wje,{sidebarOpen:et,onToggle:pt}),Ut=ae?.requiresTrust===!0?ae.trusted===!0?`trusted`:`untrusted`:`none`,Wt=()=>{ue(null),se(!0)},Gt=(0,L.jsx)(dXe,{panelOpen:Et,highlighted:mt,onToggle:()=>{WZe(l,ht,wt)}});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Foe,{value:u,children:(0,L.jsx)(qke,{value:{activeTopPanel:T,toggleTopPanel:ft,closeTopPanel:()=>E(null)},children:(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(Nse,{delayDuration:0,children:[(0,L.jsx)(yXe,{}),(0,L.jsxs)(Rae,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,width:`100%`,height:`var(--app-viewport-height, 100dvh)`,paddingLeft:`env(safe-area-inset-left)`,paddingRight:`env(safe-area-inset-right)`,overflow:`hidden`,background:`var(--bg)`},children:[(0,L.jsx)(Cje,{isMobile:l,sidebarResizer:nt,sidebarOpen:et,mobileSidebarReady:it,setSidebarOpen:tt,sidebarContent:Vt,translate:s}),(0,L.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,minWidth:0},children:[(0,L.jsx)(Oje,{activeTopPanel:T,setActiveTopPanel:E,topPanelPos:dt,cancelCloseTopPanel:ut,scheduleCloseTopPanel:lt,translate:s,locale:a,setLocale:o,supportedLocales:c}),(0,L.jsxs)(YK,{tabs:Ft,activeTabId:nAe({configTabActive:Oe,updatesTabActive:Ae,noticesTabActive:Ne,widgetsTabActive:gt,trajectoryTabActive:Ie,branchesTabActive:ze,activeFileTab:Ve}),leftExtra:Ht,rightExtra:Gt,onSelectTab:e=>{let t=rAe(e);_t(t.widgetsTabActive),we(t.activeSavedId)},onCloseTab:Je,tabBarRef:at,isMobile:l,overlay:(0,L.jsx)(eAe,{initialCwdStatus:ne,requestedCwd:n.requestedCwd,initialCwdError:re,showPlaceholder:Pt,activeCwd:F,translate:s}),children:[(0,L.jsx)(qK,{id:sq,testId:`config-tab-pane`,children:(0,L.jsx)(Kze,{configSection:Ee,setConfigSection:De,projectTrustCwd:A,sessionId:Rt,closeConfigTab:qe,handleOpenFile:We,sidebarResizer:nt,widgetPanelResizer:rt,modelConfigFocus:Ue,defaultThinkingLevel:d,setDefaultThinkingLevel:f,compaction:p,retry:m,defaultProjectTrust:h,setDefaultProjectTrust:g})}),(0,L.jsx)(qK,{id:lq,testId:`updates-tab-pane`,children:(0,L.jsx)(jZe,{cwd:F})}),(0,L.jsx)(qK,{id:fq,testId:`notices-tab-pane`,children:(0,L.jsx)(IYe,{currentSessionId:Rt})}),(0,L.jsx)(qK,{id:uq,keepAlive:!0,testId:`trajectory-tab-pane`,children:(0,L.jsx)(XYe,{sessionId:Rt})}),(0,L.jsx)(qK,{id:dq,keepAlive:!0,testId:`branches-tab-pane`,children:(0,L.jsx)(Hje,{sessionId:Rt})}),(0,L.jsx)(qK,{id:qZe(Ve),testId:`file-tab-pane`,children:(0,L.jsx)(FYe,{activeFileTab:Ve,activeCwd:F,explorerRefreshKey:N,setExplorerRefreshKey:ee,handleFileLineMention:Mt,handleOpenFile:We})}),(0,L.jsx)(qK,{id:oq,keepAlive:!0,testId:`chat-tab-pane`,scroll:`hidden`,activeWhen:k,children:(0,L.jsx)(Gze,{sessionKey:M,selectedSession:D,effectiveNewSessionCwd:O,handleAgentEnd:he,handleSessionCreated:me,handleSessionForked:ge,modelsRefreshKey:te,handleOpenModelConfig:Ke,chatInputRef:kt,handleOpenLinkedFile:$e,onOpenTrajectory:Le,onOpenBranches:Be,activeCwdName:It,trustBadge:Ut,onTrustClick:Wt,closedWidgets:yt,handleCloseWidget:bt,handleExtensionWidgetsChange:St,extensionDialogActiveRef:de})}),(0,L.jsx)(qK,{id:cq,keepAlive:!0,testId:`widgets-tab-pane`,zIndex:1,activeWhen:k,children:(0,L.jsx)($Ye,{widgetGeometries:y,widgetMessages:x,addWidgetMessage:S,removeWidgetMessage:C,updateWidgetMessage:w,extensionWidgets:vt,closedWidgets:yt,handleReopenWidget:xt})})]})]}),(0,L.jsx)(Sje,{isMobile:l,rightSidebarOpen:Ct,rightSidebarOpenEffective:Et,widgetPanelResizer:rt,translate:s,cwd:zt,sessionId:Rt,handleOpenFile:We,explorerRefreshKey:N,handleExplorerRefresh:xe,handleAtMention:At,handleAtMentions:jt,openConfigTab:Ge,onMobileClose:()=>ht(!1)})]}),BZe(oe,A)&&A&&(0,L.jsx)(SXe,{cwd:A,busy:ce,error:le,onCancel:()=>{ce||se(!1)},onConfirm:()=>void be()})]})]})})})}),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(pXe,{}),(0,L.jsx)(xXe,{})]})]})}var YZe=class extends I.Component{constructor(...e){super(...e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){BJ(e,`render error`)}render(){return this.state.hasError?(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,height:`100vh`,color:`var(--text)`,fontSize:`var(--text-base)`},children:[(0,L.jsx)(`span`,{children:`⚠️`}),(0,L.jsx)(`span`,{children:`Something went wrong while rendering.`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{this.setState({hasError:!1})},style:{border:`1px solid var(--border)`,color:`var(--text)`,borderRadius:6,padding:`4px 14px`,cursor:`pointer`},children:`Try again`})]}):this.props.children}};function XZe(){return(0,I.useEffect)(()=>{if(!(`serviceWorker`in navigator))return;let e=()=>{navigator.serviceWorker.register(`/sw.js?v=0.32.42`,{scope:`/`,updateViaCache:`none`}).catch(e=>{console.error(`Failed to register the Pi Web service worker:`,e)})};if(document.readyState===`complete`){e();return}return window.addEventListener(`load`,e,{once:!0}),()=>window.removeEventListener(`load`,e)},[]),null}var ZZe=`piE2eFixtureDir`;function QZe(){return typeof window>`u`?null:new URL(window.location.href).searchParams.get(`piE2eFixtureDir`)}function $Ze(){if(typeof document>`u`)return;let e=QZe();e&&(document.cookie=`${ZZe}=${encodeURIComponent(e)}; path=/; SameSite=Lax`)}async function eQe(){$Ze(),Dae(!0),Oae();let e=PS(`boot`),t=null;try{let n=await _C.load();e(`preferences catalog loaded`,`locale=${n.firstPaint?.locale}`);let r=n.firstPaint?.locale;(r===`en`||r===`zh-CN`)&&(t=r,document.documentElement.lang=r===`zh-CN`?`zh-CN`:`en`);let i=n.theme;if(i===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`),i)try{localStorage.setItem(`pi-theme`,i)}catch{}}catch{}e(`root render`),window.addEventListener(`unhandledrejection`,e=>{BJ(e.reason,`unhandled promise rejection`)}),window.addEventListener(`error`,e=>{let t=(e.error instanceof Error?e.error.message:``)||e.message||``;t.includes(`ResizeObserver loop`)||t.startsWith(`Script error`)||BJ(e.error??e.message,`uncaught error`)}),(0,vre.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(I.StrictMode,{children:(0,L.jsx)(YZe,{children:(0,L.jsxs)(mae,{initialLocale:t,children:[(0,L.jsx)(JZe,{}),(0,L.jsx)(XZe,{})]})})}))}eQe();export{R as a,z as i,YH as n,f as o,CL as r,i as s,hYe as t};
2134
+ `?(s.push(c),c=[]):c.push(e);h.current=e+i,u(t=>{let n=t.slice();for(let t=0;t<s.length&&e+t<n.length;t++)n[e+t]=s[t];return n})}catch{g.current=!0}},y=e=>{_.current=_.current.then(()=>v(e)).catch(()=>{})},b=()=>{for(let e=h.current;e<s.current;e+=Q7)y(e)},x=(0,I.useRef)(b);x.current=b,(0,I.useEffect)(()=>{f.current+=1;let e=f.current;return p.current=null,m.current=0,h.current=0,g.current=!1,_.current=Promise.resolve(),u(a.map(()=>null)),y(0),()=>{f.current=e+1}},[e,t]),(0,I.useEffect)(()=>{let e=e=>{if(!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`f`)return;let t=e.target;t instanceof Element&&t.closest(`input, textarea, [contenteditable='true']`)||x.current()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let S=d<o;(0,I.useEffect)(()=>{let e=C.current;if(!S||!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&y(h.current)},{rootMargin:`600px 0px`});return t.observe(e),()=>t.disconnect()},[S,d]),(0,I.useEffect)(()=>{i?.(d)},[d,i]);let C=(0,I.useRef)(null);return(0,L.jsxs)(`pre`,{className:`file-source-view${r?` is-wrapped`:``}${n?` is-dark`:``}`,style:{margin:0,padding:`0 0 0 6px`,border:0,background:`var(--bg)`,...xZ,width:r?`100%`:`max-content`,minWidth:`100%`,minHeight:`100%`,overflow:`visible`},children:[a.map((e,t)=>{let n=l[t];return(0,L.jsxs)(`span`,{className:`file-source-line`,"data-line-number":t+1,style:{display:`flex`,minWidth:`100%`},children:[(0,L.jsx)(`span`,{className:`file-source-line-number`,style:SZ,children:t+1}),(0,L.jsx)(`span`,{className:`file-source-line-content`,style:{flex:`1 1 auto`,minWidth:0,paddingLeft:2,overflowWrap:r?`anywhere`:`normal`,whiteSpace:r?`pre-wrap`:`pre`},children:n===null?e:n.map((e,t)=>(0,L.jsx)(`span`,{className:`file-source-token`,style:bYe(e),children:e.content},t))})]},`source-line-${t}`)}),S&&(0,L.jsx)(`div`,{ref:C,"aria-hidden":`true`})]})}var $7=new Map;function SYe(e){return $7.get(e)??1}function e9(e,t){t<=1?$7.delete(e):$7.set(e,t)}var CYe=(0,I.lazy)(()=>R(()=>import(`./CodeMirrorEditor-DZD0ukoD.js`),__vite__mapDeps([144,1])));function t9({enabled:e,reindexKey:t,dataText:n,className:r,style:i,children:a,onScroll:o,scrollRef:s}){let c=(0,I.useRef)(null),[l,u]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{if(!e){u(!1);return}let t=e=>{if(!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`f`)return;let t=e.target;t instanceof Element&&t.closest(`input, textarea, [contenteditable='true']`)||(e.preventDefault(),u(!0))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,L.jsxs)(`div`,{style:{position:`relative`,height:`100%`,minWidth:0},children:[(0,L.jsx)(`div`,{ref:e=>{c.current=e,s&&(s.current=e)},onScroll:o,className:r,style:{...i,height:`100%`,overflow:`auto`,paddingBottom:e&&l?40:void 0},children:a}),e&&(0,L.jsx)(EBe,{open:l,onClose:()=>u(!1),containerRef:c,reindexKey:t,dataText:n})]})}function wYe({editMode:e,draft:t,filePath:n,language:r,isDark:i,handleEditorChange:a,handleSave:o,highlightReady:s,wrapLines:c,content:l}){let u=(0,I.useRef)(null),d=(0,I.useRef)(SYe(n)),f=()=>{let e=u.current;if(!e||e.scrollTop<=0)return 1;let t=e.querySelectorAll(`.file-source-line`);if(t.length>0){let n=1;for(let r of t){if(r.offsetTop>e.scrollTop)break;n=Number(r.dataset.lineNumber)||n}return n}let n=parseFloat(getComputedStyle(e).lineHeight);return Number.isFinite(n)&&n>0?Math.floor(e.scrollTop/n)+1:1},p=()=>{let e=u.current;if(!e||d.current<=1)return;let t=d.current,n=e.querySelectorAll(`.file-source-line`);if(n.length>0){for(let r of n)if((Number(r.dataset.lineNumber)||0)>=t){e.scrollTop=r.offsetTop;return}return}let r=parseFloat(getComputedStyle(e).lineHeight);Number.isFinite(r)&&r>0&&(e.scrollTop=(t-1)*r)};(0,I.useEffect)(()=>{e||p()},[e]);let m=(0,I.useRef)(!1);(0,I.useEffect)(()=>{e||m.current||!s||!l||(p(),m.current=!0)},[e,s,l]);let[h,g]=(0,I.useState)(0);return(0,L.jsx)(t9,{enabled:!e,reindexKey:`${l}\u0000${s}\u0000${c}\u0000${h}`,className:`file-viewer-source`,style:{display:`block`,background:`var(--bg)`},scrollRef:u,onScroll:()=>{e||(d.current=f(),e9(n,d.current))},children:e?(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`},children:(0,L.jsx)(Uw,{size:B.lg,className:`animate-spin`,"aria-hidden":`true`})}),children:(0,L.jsx)(CYe,{initialValue:t,initialTopLine:d.current,onTopVisibleLineChange:e=>{d.current=e,e9(n,e)},language:r,isDark:i,onChange:a,onSave:o},n)}):s?(0,L.jsx)(xYe,{content:l,language:r,isDark:i,wrapLines:c,onRenderedCountChange:g}):(0,L.jsx)(`pre`,{className:c?`file-source-view is-wrapped`:`file-source-view`,style:{margin:0,padding:`0 0 0 12px`,border:0,background:`var(--bg)`,...xZ,fontFamily:`var(--font-mono)`,whiteSpace:c?`pre-wrap`:`pre`,overflowWrap:c?`anywhere`:`normal`,width:c?`100%`:`max-content`,minWidth:`100%`,minHeight:`100%`,overflow:`visible`},children:l})})}function TYe({hasGitDiff:e,gitDiffPatch:t,t:n}){return e?(0,L.jsx)(t9,{enabled:!0,reindexKey:t??``,children:(0,L.jsx)(xBe,{patch:t})}):(0,L.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--text-muted)`,fontSize:`var(--text-lg)`},children:n(`i18n.noChanges`)})}function EYe({isHtml:e,isMarkdown:t,content:n,t:r,markdownPreview:i,markdownDirectory:a,onOpenFile:o,cwd:s,sourceSessionId:c}){return e?(0,L.jsx)(t9,{enabled:!1,reindexKey:``,children:(0,L.jsx)(`iframe`,{srcDoc:n,sandbox:`allow-scripts`,style:{width:`100%`,height:`100%`,border:`none`,background:`var(--bg)`},title:r(`i18n.htmlPreview`)})}):t?(0,L.jsx)(t9,{enabled:!0,reindexKey:i,dataText:i,children:(0,L.jsx)(SBe,{preview:i,markdownDir:a,onOpenFile:o,cwd:s,sourceSessionId:c})}):null}function DYe({contentRef:e,filePath:t,effectiveDisplayMode:n,editMode:r,draft:i,language:a,isDark:o,handleEditorChange:s,handleSave:c,highlightReady:l,wrapLines:u,content:d,hasGitDiff:f,gitDiffPatch:p,t:m,isHtml:h,isMarkdown:g,markdownPreview:_,markdownDirectory:v,onOpenFile:y,cwd:b,sourceSessionId:x}){return(0,L.jsxs)(`div`,{ref:e,className:`file-viewer-content`,style:{flex:1,overflow:`auto`,paddingRight:4,background:`var(--bg)`},children:[n===`source`&&(0,L.jsx)(wYe,{editMode:r,draft:i,filePath:t,language:a,isDark:o,handleEditorChange:s,handleSave:c,highlightReady:l,wrapLines:u,content:d}),n===`diff`&&(0,L.jsx)(TYe,{hasGitDiff:f,gitDiffPatch:p,t:m}),n===`preview`&&(0,L.jsx)(EYe,{isHtml:h,isMarkdown:g,content:d,t:m,markdownPreview:_,markdownDirectory:v,onOpenFile:y,cwd:b,sourceSessionId:x})]})}function OYe(e){return e?.language===`markdown`?BDe(e.content):``}function kYe({data:e,isDeletedDiff:t,displayMode:n,content:r,filePath:i,t:a}){let o=e?.language??`text`,s=o===`html`,c=o===`markdown`,l=s||c,u=oP(i),d=r.split(`
2135
+ `);return{language:o,isHtml:s,isMarkdown:c,hasPreview:l,markdownDirectory:u,lines:d,effectiveDisplayMode:t?`diff`:n===`preview`&&!l?`source`:n,displayModes:t?[`diff`]:[`source`,`preview`,`diff`],metadata:t?a(`files.deleted`):`${o} · ${a(`i18n.lineCount`,{n:d.length})} · ${wJ(e?.size??0)}`}}function AYe({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){let{isDark:c}=vq(),{t:l}=z(),[u,d]=(0,I.useState)(`source`),[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(!1),{data:g,setData:_,loading:v,error:y,loadStatus:b,fetchContent:x}=fBe({filePath:e,sourceSessionId:n,onFileChange:()=>{d(s===`diff`?`diff`:`source`),h(!1),N(),F()}}),S=g?.content??``,{editMode:C,draft:w,dirty:T,saveState:E,saveError:D,editModeRef:O,enterEdit:k,cancelEdit:A,handleEditorChange:j,handleSave:M,resetEditState:N}=yBe({filePath:e,onSaved:a,content:S,applySavedContent:e=>_(t=>t&&{...t,content:e}),reload:()=>{x(e)}}),{gitDiff:ee,gitDiffLoading:te,fetchGitDiff:P,resetGitDiff:F}=pBe({cwd:t,filePath:e,gitRefreshKey:o}),{watching:ne,closeWatch:re}=wZ(e,n,()=>{O.current||(x(e),P(e))});(0,I.useEffect)(()=>{g?.language===`markdown`&&s!==`diff`&&d(`preview`)},[g?.language,s]);let ie=ee?.supported===!0&&typeof ee.patch==`string`,ae=ie&&ee.status===`deleted`;(0,I.useEffect)(()=>{ae&&re()},[ae,re]);let oe=(0,I.useMemo)(()=>OYe(g),[g]),{contentRef:se,selectedLineRange:ce,handleMentionSelectedLines:le}=_Be({filePath:e,cwd:t,content:S,displayMode:u,onMentionLines:i});return(0,I.useEffect)(()=>{p(!1)},[S]),(0,I.useEffect)(()=>{if((ae?`diff`:u)!==`source`||f)return;let e=setTimeout(()=>p(!0),0);return()=>clearTimeout(e)},[ae,u,f]),(0,L.jsx)(jYe,{filePath:e,cwd:t??void 0,sourceSessionId:n??void 0,onOpenFile:r,isDark:c,t:l,loading:v,error:y,loadStatus:b,displayMode:u,setDisplayMode:d,gitDiffLoading:te,data:g,watching:ne,isDeletedDiff:ae,hasGitDiff:ie,wrapLines:m,setWrapLines:h,content:S,editMode:C,dirty:T,handleSave:M,saveState:E,saveError:D,enterEdit:k,cancelEdit:A,highlightReady:f,selectedLineRange:ce,handleMentionSelectedLines:le,draft:w,handleEditorChange:j,markdownPreview:oe,gitDiffPatch:ie?ee.patch:null,contentRef:se})}function jYe({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,isDark:i,t:a,loading:o,error:s,loadStatus:c,displayMode:l,setDisplayMode:u,gitDiffLoading:d,data:f,watching:p,isDeletedDiff:m,hasGitDiff:h,wrapLines:g,setWrapLines:_,content:v,editMode:y,dirty:b,handleSave:x,saveState:S,saveError:C,enterEdit:w,cancelEdit:T,highlightReady:E,selectedLineRange:D,handleMentionSelectedLines:O,draft:k,handleEditorChange:A,markdownPreview:j,gitDiffPatch:M,contentRef:N}){if(o||l===`diff`&&d)return(0,L.jsx)(MYe,{t:a});if(s&&!m)return(0,L.jsx)(NYe,{loadStatus:c,error:s,filePath:e,sourceSessionId:n,cwd:t,t:a});if(!f&&!m)return null;let{language:ee,isHtml:te,isMarkdown:P,hasPreview:F,markdownDirectory:ne,effectiveDisplayMode:re,displayModes:ie,metadata:ae}=kYe({data:f,isDeletedDiff:m,displayMode:l,content:v,filePath:e,t:a});return(0,L.jsxs)(`div`,{className:`file-viewer-shell`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[(0,L.jsx)(dBe,{filePath:e,cwd:t,metadata:ae,watching:p,isDeletedDiff:m,displayModes:ie,effectiveDisplayMode:re,previewSupported:F,previewFormat:ee,setDisplayMode:u,wrapLines:g,setWrapLines:_,editMode:y,dirty:b,handleSave:x,saveState:S,saveError:C,enterEdit:w,cancelEdit:T,highlightReady:E,selectedLineRange:D,handleMentionSelectedLines:O,fileContent:v,sourceSessionId:n,t:a}),(0,L.jsx)(DYe,{contentRef:N,filePath:e,effectiveDisplayMode:re,editMode:y,draft:k,language:ee,isDark:i,handleEditorChange:A,handleSave:x,highlightReady:E,wrapLines:g,content:v,hasGitDiff:h,gitDiffPatch:M,t:a,isHtml:te,isMarkdown:P,markdownPreview:j,markdownDirectory:ne,onOpenFile:r,cwd:t??void 0,sourceSessionId:n})]})}function MYe({t:e}){return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,color:`var(--text-muted)`,fontSize:`var(--text-lg)`},children:[(0,L.jsx)(Uw,{size:B.lg,className:`animate-spin`,"aria-hidden":`true`}),e(`i18n.loading`)]})}function NYe({loadStatus:e,error:t,filePath:n,sourceSessionId:r,cwd:i,t:a}){return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:24,color:`var(--status-error)`,fontSize:`var(--text-lg)`,textAlign:`center`},children:[(0,L.jsx)(`div`,{children:e===413?a(`files.fileTooLargeForPreview`,{limit:wJ(qze)}):t}),e===413&&(0,L.jsx)(EZ,{filePath:n,sourceSessionId:r,cwd:i})]})}function PYe({filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s}){return eBe(e)?(0,L.jsx)(rBe,{filePath:e,cwd:t,sourceSessionId:n}):tBe(e)?(0,L.jsx)(iBe,{filePath:e,cwd:t,sourceSessionId:n}):nBe(e)?(0,L.jsx)(aBe,{filePath:e,cwd:t,sourceSessionId:n}):(0,L.jsx)(AYe,{filePath:e,cwd:t,sourceSessionId:n,onOpenFile:r,onMentionLines:i,onSaved:a,gitRefreshKey:o,initialDisplayMode:s})}function FYe({activeFileTab:e,activeCwd:t,explorerRefreshKey:n,setExplorerRefreshKey:r,handleFileLineMention:i,handleOpenFile:a}){return(0,L.jsx)(L.Fragment,{children:e&&(0,L.jsx)(PYe,{filePath:e.filePath,cwd:t??void 0,sourceSessionId:e.sourceSessionId,gitRefreshKey:n,initialDisplayMode:e.initialDisplayMode,onMentionLines:i,onSaved:()=>r(e=>e+1),onOpenFile:t=>a(t,aP(t),{sourceSessionId:e.sourceSessionId})})})}function IYe({currentSessionId:e}){let{unread:t,markRead:n}=cC(),[r,i]=(0,I.useState)(null);return(0,I.useEffect)(()=>{t>0&&n()},[t,n]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(BRe,{currentSessionId:e,onViewNotice:i}),(0,L.jsx)(VRe,{entry:r,onClose:()=>i(null)})]})}var LYe={user:{label:`U`,color:`var(--text)`},assistant:{label:`A`,color:`var(--accent)`},thinking:{label:`T`,color:`var(--text-muted)`},tool:{label:`⚙`,color:`var(--status-info)`},bash:{label:`$`,color:`var(--status-info)`},toolError:{label:`E`,color:`var(--status-error)`}};function RYe({row:e,highlighted:t,onHover:n,style:r}){let i=LYe[e.kind],a=e.kind!==`assistant`&&e.kind!==`thinking`,o=e.kind===`tool`||e.kind===`bash`,s=e.kind===`toolError`;return(0,L.jsxs)(`div`,{onPointerEnter:()=>e.spanId&&n?.(e.spanId),onPointerLeave:()=>n?.(null),style:{...r,display:`flex`,gap:8,alignItems:`center`,minWidth:0,borderRadius:4,padding:`1px 4px`,margin:`-1px -4px`,background:t?`var(--bg-selected)`:r?.background},children:[(0,L.jsx)(`span`,{title:e.kind,style:{flexShrink:0,width:16,display:`flex`,justifyContent:`center`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,fontWeight:700,color:i.color},children:o?(0,L.jsx)(sT,{size:B.sm,style:{color:`var(--status-info)`,flexShrink:0}}):s?(0,L.jsx)(sT,{size:B.sm,style:{color:`var(--status-error)`,flexShrink:0}}):e.kind===`thinking`?(0,L.jsx)(Bw,{size:B.sm,style:{color:`var(--bulb-warning)`,flexShrink:0}}):i.label}),(0,L.jsxs)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontFamily:a?`var(--font-mono)`:void 0,fontSize:`var(--text-sm)`,color:e.kind===`toolError`?`var(--status-error)`:(e.kind,`var(--text-muted)`),fontStyle:e.kind===`thinking`?`italic`:void 0},children:[e.toolName&&!s?(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(`span`,{style:{color:`var(--status-info)`,fontWeight:600,marginRight:8},children:e.toolName})}):s&&e.toolName?(0,L.jsx)(`span`,{style:{color:`var(--status-error)`,fontWeight:600,marginRight:8},children:e.toolName}):e.kind===`bash`?`$ `:null,e.text]}),e.durationSecs!=null&&(0,L.jsx)(UZ,{secs:e.durationSecs,size:`sm`})]})}function zYe(e){let t=[],n=(e,n,r)=>t.push({index:e,userText:n,timestamp:r,endTime:r,tools:0,toolErrors:0,inputTokens:0,messages:[]});for(let r=0;r<e.length;r++){let i=e[r];if(i.role===`user`){let e=typeof i.content==`string`?i.content:i.content.find(e=>e.type===`text`)?.text??``,a=t[t.length-1];a&&a.messages.length>0&&!a.userText?(a.index=r,a.userText=e.replace(/\s+/g,` `).trim(),a.timestamp=i.timestamp,a.endTime=i.timestamp):n(r,e.replace(/\s+/g,` `).trim(),i.timestamp),t[t.length-1].messages.push(i);continue}let a=t[t.length-1]??(n(e.indexOf(i),``),t[t.length-1]);a.messages.push(i),i.role!==`system`&&i.timestamp&&(a.endTime=i.timestamp),i.role===`assistant`&&(a.tools+=i.content.filter(e=>e.type===`toolCall`).length,a.inputTokens+=i.usage?.input??0),i.role===`toolResult`&&i.isError&&(a.toolErrors+=1)}return t[0]&&!t[0].userText&&(t[0].userText=`(start)`),t}var BYe=(e,t)=>t+1,n9=(e,t=160)=>e.replace(/\s+/g,` `).trim().slice(0,t);function VYe(e,t,n,r,i,a){let o=t;for(let s=0;s<e.content.length;s++){let c=e.content[s];if(c.type===`toolCall`){let e=a(c.toolCallId)??o+2e3,l=Math.max(o,t);i.push({lane:2,kind:`tool`,start:l,end:Math.max(e,l+200),label:c.toolName,turnIndex:n,spanId:`m${r}-b${s}`,detail:n9(fZ(c),120)}),o=Math.max(e,o)}else if(c.type===`text`||c.type===`thinking`){let e=c.type===`text`?c.text:c.thinking;if(!e.trim())continue;let t=Math.min(Math.max(e.length*2,2e3),8e3);i.push({lane:1,kind:`assistant`,variant:c.type===`thinking`?`thinking`:`text`,start:o,end:o+t,label:n9(e,80),turnIndex:n,spanId:`m${r}-b${s}`}),o+=t}}}function HYe(e){let t=[],n=1/0,r=0;if(e.forEach((e,i)=>{let a=new Map;for(let t of e.messages)if(t.role===`toolResult`){let e=t;e.toolCallId&&e.timestamp&&Number.isFinite(e.timestamp)&&a.set(e.toolCallId,e.timestamp)}let o=e.messages.find(e=>e.role===`assistant`&&e.timestamp&&Number.isFinite(e.timestamp));for(let s=0;s<e.messages.length;s++){let c=e.messages[s],l=c.timestamp;!l||!Number.isFinite(l)||(c.role!==`system`&&(l<n&&(n=l),l>r&&(r=l)),c.role===`user`?t.push({lane:0,kind:`user`,start:l,end:Math.max(o?.timestamp??l+600,l+200),label:e.userText,turnIndex:i,spanId:`user`}):c.role===`assistant`?VYe(c,l,i,s,t,e=>a.get(e)):c.role===`bashExecution`?t.push({lane:2,kind:`tool`,start:l,end:(()=>{let t=e.messages;for(let e=s+1;e<t.length;e++){let n=t[e].timestamp;if(n&&Number.isFinite(n)&&n>l)return n}return l+400})(),label:n9(c.command,80),turnIndex:i,spanId:`m${s}`}):c.role===`toolResult`&&c.isError&&t.push({lane:2,kind:`error`,start:l,end:l+400,label:c.toolName??`tool`,turnIndex:i,spanId:`m${s}`}))}}),!Number.isFinite(n))return{spans:[],start:0,end:1};let i=Math.max(r,n+1,...t.map(e=>e.end));return{spans:t,start:n,end:i+(i-n)*.03}}var r9=`color-mix(in srgb, var(--accent) 60%, var(--status-error))`;function UYe(e){switch(e.kind){case`user`:return`var(--accent)`;case`assistant`:return e.variant===`thinking`?`color-mix(in srgb, ${r9} 45%, var(--bg-panel))`:r9;case`tool`:return`var(--status-warning)`;case`error`:return`var(--status-error)`}}function WYe(e,t,n){for(let r=0;r<e.content.length;r++){let i=e.content[r];if(i.type===`text`){let e=n9(i.text);e&&n.push({kind:`assistant`,text:e,spanId:`m${t}-b${r}`})}else if(i.type===`thinking`){let e=n9(i.thinking,120);e&&n.push({kind:`thinking`,text:e,spanId:`m${t}-b${r}`})}else i.type===`toolCall`&&n.push({kind:`tool`,text:fZ(i),toolName:i.toolName,durationSecs:i.durationSecs,spanId:`m${t}-b${r}`})}}function GYe(e){let t=[],n=new Map;for(let t of e.messages)if(t.role===`assistant`)for(let e of t.content)e.type===`toolCall`&&n.set(e.toolCallId,fZ(e));for(let r=0;r<e.messages.length;r++){let i=e.messages[r];if(i.role===`assistant`){WYe(i,r,t);continue}if(i.role===`toolResult`){let e=i;if(!e.isError)continue;let a=n.get(e.toolCallId)??n9(e.content.filter(e=>e.type===`text`).map(e=>e.text).join(` `),120);t.push({kind:`toolError`,text:a,toolName:e.toolName,spanId:`m${r}`});continue}if(i.role===`bashExecution`){t.push({kind:`bash`,text:n9(i.command,140),spanId:`m${r}`});continue}if(!(i.role===`custom`&&!i.display)&&(i.role===`custom`||i.role===`user`)){let e=typeof i.content==`string`?n9(i.content):n9(i.content.filter(e=>e.type===`text`).map(e=>e.text).join(` `));e&&t.push({kind:i.role===`user`?`user`:`assistant`,text:e,spanId:i.role===`user`?`user`:void 0})}}return t}var KYe=18;function qYe({turn:e,spans:t,laneLabels:n,emptyLabel:r,start:i,end:a,onHoverSpan:o,hoverSpanId:s}){let c=Math.max(1,a-i),l=[0,1,2].map(e=>t.filter(t=>t.lane===e));return(0,L.jsxs)(`div`,{style:{position:`relative`,flexShrink:0,borderBottom:`1px solid var(--border)`,background:`var(--bg-input)`,userSelect:`none`},children:[[0,1,2].map(e=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,height:KYe},children:[(0,L.jsx)(`span`,{style:{width:64,flexShrink:0,textAlign:`right`,paddingRight:4,fontSize:10,lineHeight:1,color:`var(--text-muted)`},children:n[e]}),(0,L.jsx)(`div`,{style:{position:`relative`,flex:1,alignSelf:`stretch`,overflow:`hidden`,borderTop:e===0?void 0:`1px solid var(--border)`,borderLeft:`1px solid var(--border)`},children:l[e].map((e,t)=>{let n=Math.max(e.start,i),r=Math.min(e.end,a);if(r<=n)return null;let l=(n-i)/c*100,u=(r-n)/c*100,d=e=>e==null?`?`:new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});return(0,L.jsx)(fT,{label:`${e.label}${e.detail?`\n${e.detail}`:``}\n${d(e.start)} → ${d(e.end)} · ${((e.end-e.start)/1e3).toFixed(1)}s`,children:(0,L.jsx)(`div`,{onPointerEnter:()=>o?.(e.spanId),onPointerLeave:()=>o?.(null),style:{position:`absolute`,top:`50%`,transform:`translateY(-50%)`,left:`${l}%`,width:`max(6px, calc(${u}% - 1px))`,height:8,borderRadius:1,background:UYe(e),opacity:s===e.spanId||e.kind===`assistant`||e.kind===`tool`?1:.78,outline:s===e.spanId?`1px solid var(--accent)`:void 0}})},`s-${t}`)})})]},e)),!e&&(0,L.jsx)(`span`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`,background:`var(--bg-input)`},children:r})]})}function JYe({turn:e,number:t,open:n,onToggle:r,hoverSpanId:i,onHoverSpan:a}){let{t:o}=z(),s=e.endTime!=null&&e.timestamp!=null?(e.endTime-e.timestamp)/1e3:void 0,c=n?GYe(e):[];return(0,L.jsx)(`div`,{children:(0,L.jsxs)(`div`,{style:{display:`flex`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,flexShrink:0,width:44,padding:`8px 0 0`},children:[(0,L.jsx)(`div`,{style:{fontSize:12},children:(0,L.jsx)(AX,{number:t})}),n&&(0,L.jsx)(`div`,{style:{width:1,flex:1,background:`var(--border)`}})]}),(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsxs)(`button`,{onClick:r,"aria-expanded":n,style:{display:`flex`,alignItems:`baseline`,gap:8,width:`100%`,textAlign:`left`,padding:`8px 12px 8px 4px`,background:`transparent`,cursor:`pointer`},children:[(0,L.jsx)(UZ,{secs:s,timestamp:e.timestamp,endTimestamp:e.endTime}),(0,L.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.userText||o(`trajectory.emptyTurn`)}),e.tools>0&&(0,L.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-muted)`,flexShrink:0},children:o(`trajectory.turnStats`,{tools:e.tools,errors:e.toolErrors})})]}),n&&(0,L.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:5,padding:`2px 12px 12px 4px`},children:c.map((e,t)=>(0,L.jsx)(RYe,{row:e,highlighted:e.spanId!=null&&e.spanId===i,onHover:a,style:{paddingTop:4,borderTop:`1px solid color-mix(in srgb, var(--border) 45%, transparent)`}},t))})]})]})})}function YYe({sessionId:e,active:t=!0}){let{t:n}=z(),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(null);(0,I.useSyncExternalStore)(kJ,Wje);let d=e?Gje(e):void 0,f=e!=null&&d==null;(0,I.useEffect)(()=>{if(i(null),o(null),c(null),!f||!e)return;let t=new AbortController;return fetch(`/api/sessions/${encodeURIComponent(e)}`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(String(e.status));let t=await e.json();i(t.context.messages)}).catch(e=>{t.signal.aborted||o(String(e))}),()=>t.abort()},[e,f]);let p=d??r,m=(0,I.useMemo)(()=>zYe(p??[]),[p]),h=(0,I.useMemo)(()=>m.find(e=>e.index===s)??null,[m,s]),g=(0,I.useMemo)(()=>h?HYe([h]):null,[h]),_=(0,I.useRef)(null),v=(0,I.useRef)(null),y=(0,I.useRef)(0),b=(0,I.useRef)(!1),x=(0,I.useRef)(``);if((0,I.useEffect)(()=>{if(t&&!b.current&&(y.current+=1),b.current=t,!t||!e||m.length===0)return;let n=`${y.current}:${e}`;if(x.current===n)return;x.current=n;let r=qje(e)??m.length-1;if(r>=m.length)return;let i=requestAnimationFrame(()=>{_.current?.scrollToIndex(r),c(m[r].index)});return()=>cancelAnimationFrame(i)},[t,e,m]),!e)return(0,L.jsx)(`div`,{style:{padding:24,color:`var(--text-dim)`},children:n(`trajectory.noSession`)});if(a)return(0,L.jsx)(`div`,{style:{padding:24,color:`var(--status-error)`},children:a});if(!p)return(0,L.jsx)(`div`,{style:{padding:24,color:`var(--text-dim)`},children:n(`trajectory.loading`)});let S=[n(`trajectory.lane.user`),n(`trajectory.lane.assistant`),n(`trajectory.lane.tool`)];return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100%`,minHeight:0},children:[(0,L.jsx)(qYe,{turn:h,spans:g?.spans??[],start:g?.start??0,end:g?.end??1,laneLabels:S,emptyLabel:n(`trajectory.overviewEmpty`),onHoverSpan:u,hoverSpanId:l}),(0,L.jsx)(MK,{direction:`vertical`,scrollElRef:v,wrapperStyle:{flex:1,minHeight:0},children:(0,L.jsx)(Kq,{ref:_,scrollRef:v,children:m.map((e,t)=>(0,L.jsx)(JYe,{turn:e,number:BYe(m,t),open:s===e.index,onToggle:()=>c(t=>t===e.index?null:e.index),hoverSpanId:l,onHoverSpan:u},`${e.index}-${e.userText.slice(0,12)}`))})})]})}function XYe({sessionId:e}){let t=Ake(uq);return(0,L.jsx)(`div`,{"data-trajectory-pane":!0,"data-session-id":e??``,style:{height:`100%`},children:(0,L.jsx)(YYe,{sessionId:e,active:t})})}function ZYe(e){return`min(calc(100vw - 16px), ${Math.max(48,Math.min(e-8,window.innerWidth-e-8))*2}px)`}function QYe({geometries:e,messages:t,onAddMessage:n,onRemoveMessage:r,onUpdateMessage:i,widgets:a,closedKeys:o,onReopen:s}){let{t:c}=z(),[l,u]=(0,I.useState)(null),[d,f]=(0,I.useState)(null),p=(0,I.useRef)(null);(0,I.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]);let m=e=>a.find(t=>t.key===e)?.lines[0],h=(e,t,n)=>{s(e),f({key:e,x:t,y:n}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>f(null),2500)},g=[...new Set([...Object.keys(e),...o.keys()])].map(t=>[t,e[t]]);return(0,L.jsxs)(`div`,{style:{height:`100%`,display:`flex`,flexDirection:`column`,background:`var(--bg)`},children:[g.length===0?(0,L.jsx)(`div`,{style:{padding:`32px 16px`,textAlign:`center`,color:`var(--text-dim)`,fontSize:`var(--text-lg)`,lineHeight:1.6},children:c(`config.widgets.empty`)}):(0,L.jsx)(`div`,{style:{flex:1,minHeight:0,overflowY:`auto`,padding:10,display:`flex`,flexDirection:`row`,flexWrap:`wrap`,alignContent:`flex-start`,gap:6},children:g.map(([e,a])=>{let s=t[e]??[],d=o.has(e),f=m(e);return(0,L.jsxs)(`div`,{"data-testid":`widget-config-item-${e}`,style:{flex:`1 1 200px`,maxWidth:`calc((100% - 18px) / 4)`,boxSizing:`border-box`,padding:`8px 10px`,borderRadius:5,background:`var(--bg-panel)`,border:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:7,flexWrap:`wrap`},children:[(0,L.jsxs)(`div`,{style:{minWidth:0,flex:`1 1 120px`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-base)`,fontWeight:600,fontFamily:`var(--font-mono)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e}),a&&(0,L.jsxs)(`div`,{style:{marginTop:2,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,color:`var(--text-dim)`},children:[c(`config.widgets.x`),`: `,a.x,` `,c(`config.widgets.y`),`: `,a.y,` ·`,` `,c(`config.widgets.width`),`: `,a.width,` `,c(`config.widgets.height`),`:`,` `,a.height]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0},children:[d&&(0,L.jsxs)(`button`,{type:`button`,"data-testid":`widget-expand-${e}`,"aria-label":c(`widgets.reopen`),title:c(`widgets.reopen`),onClick:t=>h(e,t.clientX,t.clientY),style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 8px`,borderRadius:5,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`},className:`hover-shift`,children:[(0,L.jsx)(jw,{size:13,"aria-hidden":!0}),c(`widgets.reopen`)]}),(0,L.jsxs)(`button`,{type:`button`,"data-testid":`widget-bind-${e}`,onClick:()=>u(e),style:{display:`flex`,alignItems:`center`,gap:4,padding:`4px 8px`,borderRadius:5,border:`1px solid var(--border)`,background:`var(--bg)`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:[(0,L.jsx)(Vw,{size:13,"aria-hidden":!0}),c(`config.widgets.bind`)]})]})]}),f&&(0,L.jsx)(`div`,{style:{marginTop:4,fontSize:`var(--text-sm)`,color:`var(--text-muted)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:f}),(0,L.jsx)(EK,{messages:s,onAdd:t=>n(e,t),onRemove:t=>r(e,t),onUpdate:(t,n)=>i(e,t,n),bindOpen:l===e,onBindOpenChange:e=>{e||u(null)},ns:`widgets`,bindTestIdPrefix:`widget-bind`,editTestIdPrefix:`widget-edit`,chipTestIdPrefix:`widget-bound-${e}`,bindHintArgs:{key:e}})]},e)})}),d&&(0,L.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`widget-expanded-toast`,style:{position:`fixed`,left:d.x,maxWidth:ZYe(d.x),top:d.y+12,transform:`translateX(-50%)`,zIndex:2e3,padding:`8px 12px`,borderRadius:7,border:`1px solid var(--status-success)`,background:`var(--bg)`,color:`var(--text)`,fontSize:`var(--text-base)`,boxShadow:`0 4px 16px var(--shadow-strong)`,whiteSpace:`normal`},children:c(`widgets.expandedToChat`,{key:d.key})})]})}function $Ye({widgetGeometries:e,widgetMessages:t,addWidgetMessage:n,removeWidgetMessage:r,updateWidgetMessage:i,extensionWidgets:a,closedWidgets:o,handleReopenWidget:s}){return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(QYe,{geometries:e,messages:t,onAddMessage:n,onRemoveMessage:r,onUpdateMessage:i,widgets:a,closedKeys:o,onReopen:s})})}function eXe({items:e,openUpdatesTab:t,onDismiss:n}){let{t:r}=z();return(0,L.jsxs)(`div`,{role:`status`,"data-testid":`update-banner`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 12px`,borderBottom:`1px solid var(--border)`,background:`color-mix(in srgb, var(--status-warning) 10%, var(--bg-panel))`,fontSize:`var(--text-sm)`,color:`var(--text)`,flexShrink:0},children:[(0,L.jsx)(`span`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r(`updates.banner`,{items:e.join(`, `)})}),(0,L.jsx)(`button`,{type:`button`,"data-testid":`update-banner-view`,onClick:()=>{t()},style:{padding:`3px 10px`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0},children:r(`updates.view`)}),(0,L.jsx)(`button`,{type:`button`,"aria-label":r(`i18n.close`),onClick:n,style:{padding:`2px 6px`,border:`none`,color:`var(--text-dim)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0},children:`✕`})]})}function tXe(){let e=(0,I.useRef)(null);return{chatInputRef:e,handleAtMention:(0,I.useCallback)((t,n)=>{e.current?.insertText(Tq(t,n))},[]),handleAtMentions:(0,I.useCallback)(t=>{let n=cAe(t);n&&e.current?.insertText(n)},[]),handleFileLineMention:(0,I.useCallback)((t,n,r)=>{e.current?.insertText(sAe(t,n,r))},[])}}function nXe(e){try{let t=window.localStorage.getItem(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:null}catch{return null}}function i9(e,t){try{window.localStorage.setItem(e,String(t))}catch{}}function a9(e){let{ariaLabel:t,cssVariable:n,defaultWidth:r,getDefaultWidth:i,getMaxWidth:a,growthDirection:o,maxWidth:s,minWidth:c,storageKey:l,widthRef:u}=e,d=(0,I.useRef)(null),f=(0,I.useRef)(null),p=(0,I.useRef)(!1),[m,h]=(0,I.useState)(r),[g,_]=(0,I.useState)(!1),v=(0,I.useCallback)(()=>Math.min(s,Math.max(c,a())),[a,s,c]),y=(0,I.useCallback)(e=>Use(e,c,v()),[v,c]),b=(0,I.useCallback)(e=>{u.current=e,d.current?.style.setProperty(n,`${e}px`)},[n,u]),x=(0,I.useCallback)((e,t={})=>{let{forcePersist:n=!1,persist:r=!0}=t,i=y(e),a=i!==u.current;return b(i),h(i),r&&(a||n)&&i9(l,i),i},[b,y,l,u]),S=(0,I.useCallback)(e=>{document.body.style.cursor=e.previousCursor,document.body.style.userSelect=e.previousUserSelect},[]),C=(0,I.useCallback)(e=>{let t=f.current;if(!(!t||t.pointerId!==e)){f.current=null,S(t),_(!1),x(u.current,{forcePersist:!0});try{t.target.hasPointerCapture(e)&&t.target.releasePointerCapture(e)}catch{}}},[x,S,u]),w=(0,I.useCallback)(e=>{if(e.pointerType===`mouse`&&e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=f.current;t&&C(t.pointerId);let n=e.currentTarget;n.focus({preventScroll:!0}),n.setPointerCapture(e.pointerId),f.current={pointerId:e.pointerId,startX:e.clientX,startWidth:u.current,target:n,previousCursor:document.body.style.cursor,previousUserSelect:document.body.style.userSelect},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,_(!0)},[C,u]),T=(0,I.useCallback)(e=>{let t=f.current;if(!t||t.pointerId!==e.pointerId)return;if(e.pointerType===`mouse`&&e.buttons===0){C(e.pointerId);return}e.preventDefault();let n=o===`right`?1:-1,r=y(t.startWidth+(e.clientX-t.startX)*n);b(r),e.currentTarget.setAttribute(`aria-valuenow`,String(r)),e.currentTarget.setAttribute(`aria-valuetext`,`${r} px`)},[b,y,C,o]),E=(0,I.useCallback)(e=>{C(e.pointerId)},[C]),D=(0,I.useCallback)(e=>{C(e.pointerId)},[C]),O=(0,I.useCallback)(e=>{C(e.pointerId)},[C]),k=(0,I.useCallback)(()=>{let e=i?.()??r;x(e,{forcePersist:!0})},[x,r,i]),A=(0,I.useCallback)(()=>{x(u.current)},[x,u]),j=(0,I.useCallback)(e=>{let t=e.shiftKey?32:12,n=o===`right`?`ArrowRight`:`ArrowLeft`,r=o===`right`?`ArrowLeft`:`ArrowRight`;e.key===n?(e.preventDefault(),x(u.current+t,{forcePersist:!0})):e.key===r?(e.preventDefault(),x(u.current-t,{forcePersist:!0})):e.key===`Home`?(e.preventDefault(),x(c,{forcePersist:!0})):e.key===`End`?(e.preventDefault(),x(v(),{forcePersist:!0})):e.key===`Enter`&&(e.preventDefault(),k())},[x,v,o,c,k,u]);return(0,I.useEffect)(()=>{if(p.current)return;p.current=!0;let e=nXe(l),t=e??i?.()??r,n=x(t,{persist:!1});e!==null&&e!==n&&i9(l,n)},[x,r,i,l]),(0,I.useEffect)(()=>{if(!p.current)return;x(u.current);let e=()=>{x(u.current)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[x,u]),(0,I.useEffect)(()=>{if(!g)return;let e=()=>{let e=f.current;e&&C(e.pointerId)},t=()=>{document.visibilityState!==`visible`&&e()};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,t)}},[C,g]),(0,I.useEffect)(()=>()=>{let e=f.current;e&&(f.current=null,S(e))},[S]),{isResizing:g,panelRef:d,reclampWidth:A,resetWidth:k,setWidth:e=>x(e,{forcePersist:!0}),separatorProps:{"aria-label":t,"aria-orientation":`vertical`,"aria-valuemax":v(),"aria-valuemin":c,"aria-valuenow":m,"aria-valuetext":`${m} px`,onDoubleClick:k,onKeyDown:j,onLostPointerCapture:O,onPointerCancel:D,onPointerDown:w,onPointerMove:T,onPointerUp:E,role:`separator`,tabIndex:0},width:m}}function rXe({isMobile:e,sidebarOpen:t,setSidebarOpen:n,translate:r}){let[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(280),s=(0,I.useRef)(280),c=(0,I.useCallback)(()=>typeof window>`u`?480:Wse({viewportWidth:window.innerWidth,rightPanelOpen:!1,rightPanelWidth:0}),[]),l=a9({ariaLabel:r(`layout.resizeSidebar`),cssVariable:`--sidebar-width`,defaultWidth:280,getMaxWidth:c,growthDirection:`right`,maxWidth:480,minWidth:180,storageKey:`pi-sidebar-width`,widthRef:o}),u=l.reclampWidth,d=a9({ariaLabel:r(`layout.resizeWidgetPanel`),cssVariable:`--widget-panel-width`,defaultWidth:280,getMaxWidth:()=>typeof window>`u`?560:Gse({viewportWidth:window.innerWidth,sidebarOpen:t,sidebarWidth:l.width}),growthDirection:`left`,maxWidth:560,minWidth:200,storageKey:`pi-widget-panel-width`,widthRef:s});return(0,I.useEffect)(()=>{e&&n(!1)},[e,n]),(0,I.useEffect)(()=>{a(!0)},[]),(0,I.useEffect)(()=>{u()},[u]),{sidebarResizer:l,widgetPanelResizer:d,mobileSidebarReady:i}}var iXe=176,aXe=86;function oXe(e){let t=e.button.getBoundingClientRect(),n=e.row?.getBoundingClientRect(),r=n?.top??t.top,i=n?.bottom??t.bottom,a=Math.min(e.menuWidth,n?.width??e.tabRect.width),o=Math.min(t.left-1,Math.max(n?.left??e.tabRect.left,(n?.right??e.tabRect.right)-a)),s=i+4;return{top:s+e.estHeight>window.innerHeight-4?r-e.estHeight:s,left:o,width:a}}function sXe({activeTopPanel:e,isMobile:t,tabBarRef:n,sidebarTopBarRef:r,languageBtnRef:i}){let[a,o]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(!e)return;let a=()=>{if(document.hidden)return;let a=n.current?.getBoundingClientRect();if(a){if(e===`language`&&!t&&i.current){let e=oXe({menuWidth:iXe,estHeight:aXe,button:i.current,row:r.current,tabRect:a});o(e);return}o({top:a.bottom,left:a.left,width:a.width})}};a();let s=new ResizeObserver(a);return n.current&&s.observe(n.current),i.current&&s.observe(i.current),()=>s.disconnect()},[e,t]),a}var o9=`pi-web`;function s9(e,t){let n=c9(e),r=c9(t),i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=n[e]??0,i=r[e]??0;if(t>i)return 1;if(t<i)return-1}return 0}function c9(e){return e.replace(/^v/i,``).split(/[-+]/)[0].split(`.`).map(e=>{let t=Number.parseInt(e,10);return Number.isNaN(t)?0:t})}function l9({current:e,latest:t},n){return t!==null&&t!==n&&s9(t,e)>0}function u9(e){return e.enabled!==!1}function d9(e,t){return t[e]===`*`}function cXe(e){if(!u9(e))return 0;let t=e.ignored??{};return+!!l9(e.piWeb,t[`pi-web`])+e.plugins.filter(e=>!d9(e.source,t)).length}function lXe(e,t){if(!u9(e))return[];let n=e.ignored??{},r=[];l9(e.piWeb,n[`pi-web`])&&r.push(`pi-web`);let i=e.plugins.filter(e=>!d9(e.source,n)).length;return i>0&&r.push(`${i} ${t}`),r}function uXe({activeCwd:e,translate:t}){let{value:n}=lT(xC),r=(0,I.useMemo)(()=>n?cXe(n):0,[n]),i=(0,I.useMemo)(()=>n?lXe(n,t(`common.plugins`)):[],[n,t]),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(void 0);return(0,I.useEffect)(()=>{e!==s.current&&(s.current=e,Gae(e??null),xC.load().catch(e=>console.error(`[pi-web] load updates:`,e)))},[e]),{updatesBadge:r,updateItems:i,updatesBannerDismissed:a,setUpdatesBannerDismissed:o}}function dXe({panelOpen:e,highlighted:t,onToggle:n}){let{t:r}=z(),i=r(e?`sidebar.hide`:`sidebar.show`);return(0,L.jsx)(fT,{label:i,children:(0,L.jsx)(`button`,{onClick:n,"aria-controls":`widget-panel`,"aria-expanded":e,"aria-label":i,"data-testid":`widget-panel-toggle`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:36,height:36,padding:0,border:`none`,borderLeft:`1px solid var(--border)`,color:t?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`color 0.12s`,"--hover-color":`var(--text)`},className:`hover-shift`,children:(0,L.jsxs)(`svg`,{width:B[`4xl`],height:B[`4xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`rect`,{x:`3`,y:`3`,width:B[`4xl`],height:B[`4xl`],rx:`2`}),(0,L.jsx)(`line`,{x1:`15`,y1:`3`,x2:`15`,y2:`21`})]})})})}function fXe(){return(0,L.jsxs)(`div`,{role:`status`,"aria-label":`Loading`,"data-testid":`boot-splash`,style:{position:`fixed`,inset:0,zIndex:9999,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:18,background:`var(--bg)`,color:`var(--text-muted)`},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-6xl)`,fontWeight:700,color:`var(--accent)`,letterSpacing:`0.02em`},children:`pi`}),(0,L.jsx)(`div`,{style:{width:22,height:22,border:`2px solid var(--border)`,borderTopColor:`var(--accent)`,borderRadius:`50%`,animation:`boot-spin 0.8s linear infinite`}}),(0,L.jsx)(`style`,{children:`@keyframes boot-spin { to { transform: rotate(360deg); } }`})]})}function pXe(){let{t:e}=z(),t=(0,I.useSyncExternalStore)(Zje,VJ,VJ);if(t.length===0)return null;let n=t[t.length-1],r={...n,message:$J(n.message,e)},i=t.length;return(0,L.jsx)(BD,{open:!0,onOpenChange:()=>{},children:(0,L.jsxs)(UD,{children:[(0,L.jsx)(GD,{style:{position:`fixed`,inset:0,zIndex:1200,background:`rgba(0, 0, 0, 0.45)`}}),(0,L.jsxs)(qD,{role:`alertdialog`,"aria-modal":`true`,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:1200,maxWidth:480,width:`calc(100% - 48px)`,maxHeight:`calc(100dvh - 48px)`,overflowY:`auto`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:10,padding:`16px 20px`,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.35)`},children:[(0,L.jsxs)(YD,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10,fontSize:`var(--text-base)`,fontWeight:600,color:`var(--text)`},children:[(0,L.jsx)(`span`,{style:{color:`var(--status-error)`},children:`⚠`}),(0,L.jsx)(`span`,{children:i>1?e(`errors.titleCount`,{count:i}):e(`errors.title`)})]}),(0,L.jsx)(XD,{asChild:!0,children:(0,L.jsx)(`div`,{children:r.kind===`api`?(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,L.jsxs)(`span`,{style:{fontSize:`var(--text-xs)`,padding:`1px 8px`,borderRadius:999,background:`color-mix(in srgb, var(--status-error) 14%, transparent)`,color:`var(--status-error)`,fontWeight:600,whiteSpace:`nowrap`},children:[`HTTP `,r.status||`ERR`]}),r.context&&(0,L.jsx)(`span`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`},children:r.context})]}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:r.message})]}):(0,L.jsxs)(`div`,{children:[r.context&&(0,L.jsx)(`div`,{style:{fontSize:`var(--text-xs)`,color:`var(--text-dim)`,marginBottom:6},children:r.context}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text)`,wordBreak:`break-word`},children:r.message})]})})}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:16},children:[i>1&&(0,L.jsx)(`button`,{type:`button`,onClick:$je,style:{border:`1px solid var(--border)`,color:`var(--text-muted)`,borderRadius:6,padding:`4px 12px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.clearAll`)}),(0,L.jsx)(`button`,{type:`button`,onClick:Qje,style:{border:`none`,background:`var(--accent)`,color:`#fff`,borderRadius:6,padding:`4px 14px`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:e(`errors.close`)})]})]})]})})}var mXe=3e3,hXe=6e4;function f9(e,t){return e?e.error?e.path.split(/[\\/]/).pop()||t:e.name||e.firstMessage.slice(0,50)||t.slice(0,12):t.slice(0,12)}function p9(e){if(!e)return``;let t=e.projectRoot||e.cwd;return t?aP(t):``}function m9(e,t,n){let r=[t,n].filter(Boolean).join(` / `);return r?`${e} · ${r}`:e}function gXe(e,t){return e.filter(e=>!t.has(e))}function _Xe(e,t,n,r,i=``){switch(e.type){case`prompt_error`:case`extension_error`:{if(!n.errors)return null;let a=e.errorMessage??r(`i18n.commandFailed`);return{title:m9(r(`chat.taskErrorNotificationTitle`),i,t),body:a,tag:`agent-error-${e.sessionId}`}}case`extension_ui_request`:{if(!n.questions)return null;let a=e.method;if(a!==`select`&&a!==`confirm`&&a!==`input`&&a!==`editor`)return null;let o=e.title??r(`chat.questionNotificationTitle`);return{title:m9(r(`chat.questionNotificationTitle`),i,t),body:o,tag:`question-${e.id??e.sessionId}`}}default:return null}}function vXe(e,t,n){return t?e(`chat.sessionCompletedNotificationBodyWithWorkspace`,{workspace:t,name:n}):e(`chat.sessionCompletedNotificationBody`,{name:n})}function yXe(){let{t:e}=z(),{notifyEvents:t}=_w(),[n,r]=(0,I.useState)([]),i=(0,I.useRef)([]);(0,I.useEffect)(()=>{i.current=n});let a=(0,I.useRef)(t);(0,I.useEffect)(()=>{a.current=t});let o=(0,I.useRef)(e);(0,I.useEffect)(()=>{o.current=e});let{runningSessionIds:s}=OY(),c=(0,I.useRef)(!1),l=(0,I.useRef)([]),u=(0,I.useRef)(new Map);(0,I.useEffect)(()=>{if(!a.current.taskComplete)return;let e=c.current?l.current:null;if(l.current=[...s],c.current=!0,!e)return;let t=gXe(e,s);if(t.length===0)return;let n=Date.now();for(let e of t){let t=u.current.get(e);if(t!==void 0&&n-t<mXe)continue;i.current.some(t=>t.id===e)||f.current();let r=i.current.find(t=>t.id===e);console.info(`[notify] completion via running-snapshot (${e})`),mJ({title:o.current(`chat.taskCompleteNotificationTitle`),body:vXe(o.current,p9(r),f9(r,e)),tag:`session-complete-${e}`,notifyWhileActive:a.current.notifyWhileActive})}},[s]);let d=(0,I.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`,{cache:`no-store`});if(!e.ok)return;let t=await e.json();t.sessions&&r(t.sessions)}catch{}},[]),f=(0,I.useRef)(d);return(0,I.useEffect)(()=>{f.current=d}),(0,I.useEffect)(()=>{d();let e=setInterval(()=>void d(),hXe);return()=>clearInterval(e)},[d]),(0,I.useEffect)(()=>eC({ch:`global`},e=>{let t=e;if(!t.sessionId)return;let n=t.sessionId;(t.type===`prompt_error`||t.type===`extension_error`)&&u.current.set(n,Date.now()),i.current.some(e=>e.id===n)||f.current();let r=i.current.find(e=>e.id===n),s=_Xe(t,f9(r,n),a.current,o.current,p9(r));s&&(console.info(`[agent-events] notifying: ${s.title}${s.body?` — ${s.body.slice(0,300)}`:``}`),mJ({...s,notifyWhileActive:a.current.notifyWhileActive}))}),[]),null}var bXe=3;function xXe(){let{t:e}=z(),t=(0,I.useSyncExternalStore)(Toe,dw,dw);if(t.length===0)return null;let n=t.slice(0,bXe),r=t.length-n.length;return(0,L.jsx)(`div`,{"aria-busy":`true`,style:{position:`fixed`,inset:0,zIndex:1150,background:`color-mix(in srgb, var(--bg) 40%, transparent)`,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`},children:(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10,minWidth:220,maxWidth:`60vw`,padding:`14px 18px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,boxShadow:`0 8px 32px rgba(0,0,0,0.25)`},children:[n.map(t=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,fontSize:`var(--text-sm)`,color:`var(--text)`},children:[(0,L.jsx)(`div`,{style:{width:14,height:14,flexShrink:0,border:`2px solid var(--border)`,borderTopColor:`var(--accent)`,borderRadius:`50%`,animation:`spin 0.8s linear infinite`}}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.label||e(`loading.inProgress`)})]},t.id)),r>0&&(0,L.jsx)(`div`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:e(`loading.more`,{count:r})})]})})}function SXe({cwd:e,busy:t,error:n,onCancel:r,onConfirm:i}){let{t:a}=z();return(0,L.jsx)(YO,{open:!0,onOpenChange:e=>{!e&&!t&&r()},children:(0,L.jsxs)(QO,{className:`w-[440px] gap-0 overflow-hidden rounded-lg p-0`,style:{zIndex:1100,maxWidth:`calc(100% - 2rem)`,overflowY:`auto`},showCloseButton:!1,onPointerDownOutside:e=>{t&&e.preventDefault()},onEscapeKeyDown:e=>{t&&e.preventDefault()},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,gap:12,padding:`18px 18px 14px`},children:[(0,L.jsxs)(`svg`,{width:B[`5xl`],height:B[`5xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--status-warning)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{flexShrink:0,marginTop:1},children:[(0,L.jsx)(`path`,{d:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z`}),(0,L.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),(0,L.jsxs)(`div`,{style:{minWidth:0},children:[(0,L.jsx)($O,{style:{fontSize:`var(--text-2xl)`,fontWeight:700,color:`var(--text)`,lineHeight:1.4},children:a(`trust.dialogTitle`)}),(0,L.jsx)(ek,{style:{marginTop:7,fontSize:`var(--text-base)`,lineHeight:1.6,color:`var(--text-muted)`},children:a(`trust.dialogBody`)}),(0,L.jsx)(`code`,{style:{display:`block`,marginTop:10,padding:`8px 10px`,border:`1px solid var(--border)`,borderRadius:5,background:`var(--bg)`,color:`var(--text)`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,overflowWrap:`anywhere`},children:e}),n&&(0,L.jsx)(`div`,{role:`alert`,style:{marginTop:10,color:`var(--status-error)`,fontSize:`var(--text-base)`,lineHeight:1.5},children:n})]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,padding:`10px 18px`,borderTop:`1px solid var(--border)`},children:[(0,L.jsx)(UO,{type:`button`,variant:`outline`,onClick:r,disabled:t,className:`h-8 px-3 text-xs`,children:a(`trust.cancel`)}),(0,L.jsx)(UO,{type:`button`,onClick:i,disabled:t,className:`h-8 px-3 text-xs`,style:{cursor:t?`wait`:`pointer`},children:a(t?`trust.trusting`:`trust.trustProject`)})]})]})})}var h9=2e3,g9=[],_9=new Set,v9=new Set,CXe=0;function y9(){for(let e of _9)e()}function b9(e){let t=document.querySelector(`[data-testid="session-sidebar"]`);if(!e||!t)return null;let n=Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top);return Math.max(0,n)}function x9(e,t){if(e===null)return;let n=++CXe;g9=[...g9,{id:n,y:e,text:t}],y9();let r=setTimeout(()=>S9(n),h9);v9.add(r)}function S9(e){if(g9.some(t=>t.id===e)){for(let e of v9)clearTimeout(e);v9.clear(),g9=g9.filter(t=>t.id!==e);for(let e of g9){let t=setTimeout(()=>S9(e.id),h9);v9.add(t)}y9()}}function wXe(e,t){x9(b9(e),t)}function C9(e,t){for(let n of document.querySelectorAll(`[${e}]`))if(n.getAttribute(e)===t)return n;return null}function TXe(e){return _9.add(e),()=>{_9.delete(e)}}function EXe(){return g9}function DXe(){let e=(0,I.useSyncExternalStore)(TXe,EXe);return e.length===0?null:(0,L.jsx)(L.Fragment,{children:e.map(e=>(0,L.jsx)(oJ,{open:!0,onDismiss:()=>S9(e.id),autoDismissSecs:2,closable:!1,testId:`deleted-ghost`,style:{position:`absolute`,top:e.y,left:8,zIndex:30,maxWidth:`calc(100% - 16px)`,pointerEvents:`none`,background:`var(--bg)`,color:`var(--accent)`},children:(0,L.jsx)(`span`,{style:{whiteSpace:`normal`,wordBreak:`break-word`},children:e.text})},e.id))})}var OXe=6e4,w9=new Map,T9=new Map,E9=new Map(w9),D9=new Set;function O9(){E9=new Map(w9);for(let e of D9)e()}function kXe(e){return D9.add(e),()=>D9.delete(e)}function k9(e,t){w9.set(e,t),t.status!==`running`&&T9.delete(e),O9()}function A9(){return(0,I.useSyncExternalStore)(kXe,()=>E9,()=>E9)}function j9(e,t,n,r){if(w9.get(e)?.status===`running`)return null;k9(e,{kind:t,status:`running`});let i=tA(n,OXe);return T9.set(e,i),i.promise.then(()=>{k9(e,{kind:t,status:`done`}),r?.()},n=>{k9(e,{kind:t,status:`error`,error:n instanceof Error?n.message:String(n)})}),i}function AXe(e){let t=!1;for(let[n,r]of w9)r.status!==`running`&&!e.has(n)&&(w9.delete(n),t=!0);t&&O9()}var M9=`pi-web:unread-session-ids`;function jXe(){if(typeof window>`u`)return new Set;try{let e=window.localStorage.getItem(M9);if(!e)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function N9(e){if(!(typeof window>`u`))try{e.size===0?window.localStorage.removeItem(M9):window.localStorage.setItem(M9,JSON.stringify([...e]))}catch{}}function MXe(){let[e,t]=(0,I.useState)(()=>jXe());return(0,I.useEffect)(()=>{N9(e)},[e]),{unreadSessionIds:e,setUnreadSessionIds:t}}function NXe(){let{t:e}=z();return(0,L.jsx)(`span`,{title:e(`sidebar.newActivity`),"aria-label":e(`sidebar.newSessionActivity`),style:{width:14,height:14,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,color:`var(--accent)`},children:(0,L.jsxs)(`svg`,{width:B.xl,height:B.xl,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,style:{display:`block`},children:[(0,L.jsx)(`circle`,{cx:`7`,cy:`7`,r:`2.5`,fill:`currentColor`}),(0,L.jsx)(`circle`,{cx:`7`,cy:`7`,r:`3`,stroke:`currentColor`,strokeWidth:`1.4`,opacity:`0.32`,style:{transformOrigin:`center`,animation:`session-ring-pulse 1.6s ease-in-out infinite`}})]})})}function PXe({savedWorkspaces:e,onSavedWorkspacesChange:t,setSelectedCwd:n}){let[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(``),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(!1);return{customPathOpen:r,setCustomPathOpen:i,customPathError:s,setCustomPathError:c,customPathValidating:l,commitCustomPath:(0,I.useCallback)(async r=>{let s=(r??a).trim();if(!(!s||l)){u(!0),c(null);try{let r=await fetch(`/api/cwd/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:s})}),a=await r.json().catch(()=>({}));if(!r.ok||a.error){c(a.error??`HTTP ${r.status}`);return}let l=a.cwd??s;if(n(l),i(!1),o(``),t){let n=e??[];n.some(e=>fQ(e)===fQ(l))||t([...n,l])}}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}},[a,l,e,t,n])}}function FXe({savedWorkspaces:e,onSavedWorkspacesChange:t,onSessionDeleted:n,loadSessions:r}){let[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(null),c=[...A9().values()].some(e=>e.kind===`group`&&e.status===`running`),l=(0,I.useCallback)((e,t=null)=>{a(e),s(t)},[]);return{confirmDeleteGroup:i,setConfirmDeleteGroup:l,deleteGroupAnchor:o,deletingGroup:c,handleDeleteGroup:(0,I.useCallback)(i=>{l(null);let a=j9(fQ(i.root),`group`,async e=>{await Promise.all(i.sessions.map(async t=>{try{let n=await fetch(`/api/sessions/${encodeURIComponent(t.id)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({deleteAllAuxFiles:!0}),signal:e});n.ok||console.error(`[sidebar] failed to delete ${t.id}:`,n.status)}catch(e){e instanceof Error&&e.name===`AbortError`||console.error(`[sidebar] failed to delete ${t.id}:`,e)}}))},()=>{for(let e of i.sessions)n?.(e.id);let a=e??[];t&&a.some(e=>fQ(e)===fQ(i.root))&&t(a.filter(e=>fQ(e)!==fQ(i.root))),r(!1,!0)});return a?a.promise.then(()=>!0,()=>!1):Promise.resolve(!1)},[e,t,n,r])}}var IXe=2e3;function LXe({selectedSessionId:e,refreshKey:t,runningSessionIds:n,setUnreadSessionIds:r,setRunningSessionIds:i,runningPollAuthoritativeRef:a,setError:o}){let[s,c]=(0,I.useState)([]),[l,u]=(0,I.useState)(!0),[d,f]=(0,I.useState)(``),[p,m]=(0,I.useState)(!1),h=(0,I.useRef)(new Set),g=(0,I.useRef)(null),_=(0,I.useRef)(0),v=(0,I.useCallback)(async(e=!1,t=!1)=>{try{e&&u(!0);let n=t?await gC.refresh():await gC.load();c(n.sessions),a.current||i(new Set(n.runningSessionIds??[]));let s=new Set(n.sessions.map(e=>e.id));r(e=>{if(e.size===0)return e;let t=new Set([...e].filter(e=>s.has(e)));return t.size===e.size?e:t}),o(null),e||(m(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>m(!1),2e3))}catch(e){o(String(e))}finally{e&&u(!1)}},[r,i,a,o]),y=(0,I.useRef)(!1);return(0,I.useEffect)(()=>{let e=!y.current;y.current=!0,v(e,e)},[v,t]),(0,I.useEffect)(()=>{let t=[...h.current].filter(t=>!n.has(t)&&t!==e),i=[...n];if((t.length>0||i.length>0)&&r(e=>{let n=new Set(e);return i.forEach(e=>n.delete(e)),t.forEach(e=>n.add(e)),n}),t.length>0&&v(!1),[...n].filter(e=>!s.some(t=>t.id===e)).length>0){let e=Date.now();e-_.current>=IXe&&(_.current=e,v(!1,!0))}h.current=n},[n,e,s,v,r]),(0,I.useEffect)(()=>{e&&(_Ne(e),r(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}))},[e,r]),(0,I.useEffect)(()=>{fetch(`/api/home`).then(e=>e.json()).then(e=>{e.home&&f(e.home)}).catch(e=>console.error(`[pi-web] load home dir:`,e))},[]),{allSessions:s,loading:l,sessionRefreshDone:p,homeDir:d,loadSessions:v}}var P9=(e,t)=>e.replace(/\\/g,`/`)===t.replace(/\\/g,`/`);function F9(e,t){let n=new Date(e),r=new Date().getTime()-n.getTime(),i=Math.floor(r/6e4),a=Math.floor(r/36e5),o=Math.floor(r/864e5);return i<1?t(`sidebar.justNow`):i<60?t(`sidebar.minutesAgo`,{count:i}):a<24?t(`sidebar.hoursAgo`,{count:a}):o<7?t(`sidebar.daysAgo`,{count:o}):n.toLocaleDateString()}function RXe(e){let t=new Map;for(let n of e){let e=n.projectRoot??n.cwd;if(!e)continue;let r=t.get(e);(!r||n.modified>r)&&t.set(e,n.modified)}return[...t.entries()].sort((e,t)=>t[1].localeCompare(e[1])).map(([e])=>e)}function I9(e,t){return t&&e.startsWith(t)?`~${e.slice(t.length)}`:e}function L9(e){let t=e.split(/[\\/]+/).filter(Boolean);return t.length?t[t.length-1]:e}function R9({text:e,style:t}){return(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`block`,minWidth:0,lineHeight:1.35,direction:`rtl`,textAlign:`left`,...t},children:(0,L.jsx)(`span`,{style:{unicodeBidi:`plaintext`},children:e})})}function z9({session:e}){return(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4,color:`var(--danger)`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:`${e.path}: ${e.error}`,children:[(0,L.jsxs)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{flexShrink:0},children:[(0,L.jsx)(`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`}),(0,L.jsx)(`path`,{d:`M12 9v4`}),(0,L.jsx)(`path`,{d:`M12 17h.01`})]}),e.error]})}var B9=140;function zXe({open:e,children:t,style:n}){let[r,i]=(0,I.useState)(e),[a,o]=(0,I.useState)(e);return(0,I.useEffect)(()=>{let t,n;return e?(i(!0),o(!1),t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>o(!0))})):(o(!1),n=setTimeout(()=>i(!1),B9)),()=>{t!==void 0&&window.cancelAnimationFrame(t),n&&clearTimeout(n)}},[e]),r?(0,L.jsx)(`div`,{style:{...n,opacity:+!!a,transform:a?`translateY(0) scale(1)`:`translateY(-8px) scale(0.96)`,transformOrigin:`top center`,transition:`opacity ${B9}ms ease, transform ${B9}ms ease`,pointerEvents:e?`auto`:`none`},children:t}):null}function BXe({worktreeState:e,allSessions:t,selectedCwd:n,setSelectedCwd:r,onCwdChange:i,initialSessionId:a,skipInitialProjectSelection:o,onSelectSession:s,onInitialRestoreDone:c,markSeen:l}){let u=(0,I.useCallback)(n=>n?e?.forCwd&&P9(e.forCwd,n)||e?.worktrees.some(e=>P9(e.path,n))?e.projectRoot:t.find(e=>e.cwd&&P9(e.cwd,n))?.projectRoot??n:null,[e,t]),d=(0,I.useRef)(null);(0,I.useEffect)(()=>{d.current!==n&&(d.current=n,i?.(n,u(n)))},[n,i,u]);let f=(0,I.useRef)(!1);return(0,I.useEffect)(()=>{if(!(t.length===0||o)&&n===null){if(a&&!f.current){f.current=!0;let e=t.find(e=>e.id===a);if(e){r(e.cwd),l(e.id),s(e,!0);return}c?.()}let e=RXe(t);e.length>0&&r(e[0])}},[t,n,a,o,s,c,l,r]),{projectRootFor:u}}function VXe({onUnseenSession:e}){let[t,n]=(0,I.useState)(()=>new Set);return{seenSessionIds:t,markSeen:(0,I.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),handleUnseen:(0,I.useCallback)(t=>{n(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n}),Fae(t),e?.(t)},[e])}}function HXe(e){let{selectedCwd:t,selectedCwdProp:n,refreshKey:r,setSelectedCwd:i}=e,[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(``),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(!1),[_,v]=(0,I.useState)(null),[y,b]=(0,I.useState)(null),[x,S]=(0,I.useState)(``),C=(0,I.useRef)(null),w=(0,I.useRef)(null),T=(0,I.useRef)(null);(0,I.useEffect)(()=>{n&&n!==T.current&&(T.current=n,i(n))},[n,i]);let E=(0,I.useCallback)(()=>{c(!1),u(!1),f(``),m(null),v(null),S(``)},[]),[D,O]=(0,I.useState)(0);(0,I.useLayoutEffect)(()=>{if(!t){o(null),b(null);return}let e=!1;return b(t),fetch(`/api/worktrees?cwd=${encodeURIComponent(t)}`).then(e=>e.json()).then(n=>{if(!e){if(b(null),n.error||!n.projectRoot){o(null);return}o({forCwd:t,projectRoot:n.projectRoot,isGit:n.isGit??!1,isTopLevel:n.isTopLevel??!1,worktrees:n.worktrees??[]})}}).catch(()=>{e||(b(null),o(null))}),()=>{e=!0}},[t,D,r]);let k=(0,I.useCallback)(async()=>{let e=d.trim();if(!(!e||h||!a)){g(!0),m(null);try{let t=await fetch(`/api/worktrees`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:a.projectRoot,branch:e})}),n=await t.json().catch(()=>({}));if(!t.ok||n.error||!n.path){m(n.error??`HTTP ${t.status}`);return}E(),o(t=>t&&{...t,forCwd:n.path,worktrees:[...t.worktrees,{path:n.path,branch:e,isMain:!1}]}),i(n.path),O(e=>e+1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[E,d,h,a,i]),A=(0,I.useCallback)(async(e,n)=>{if(!(!a||h)){g(!0),m(null);try{let r=await fetch(`/api/worktrees`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:a.projectRoot,path:e,force:n})}),o=await r.json().catch(()=>({}));if(!r.ok){if(o.dirty&&!n){v(e);return}m(o.error??`HTTP ${r.status}`);return}E(),t&&e&&P9(t,e)&&i(a.projectRoot),O(e=>e+1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}},[E,a,h,t,i]);return(0,I.useEffect)(()=>{let e=e=>{C.current&&!C.current.contains(e.target)&&E()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[E]),{worktreeState:a,worktreeLoadingCwd:y,wtDropdownOpen:s,setWtDropdownOpen:c,wtNewOpen:l,setWtNewOpen:u,wtNewBranch:d,setWtNewBranch:f,wtError:p,setWtError:m,wtBusy:h,wtConfirmRemove:_,setWtConfirmRemove:v,wtFilter:x,setWtFilter:S,wtDropdownRef:C,wtNewInputRef:w,closeWorktrees:E,handleCreateWorktree:k,handleRemoveWorktree:A}}function UXe({selectedCwd:e,worktreeState:t,selectedProject:n,worktreeLoadingCwd:r,t:i}){let a=!!(t?.isGit&&t.isTopLevel&&e&&n===t.projectRoot),o=e&&t&&n===t.projectRoot&&!a?t.isGit?{label:i(`sidebar.openRepoRoot`),title:i(`sidebar.openRepoRootTitle`)}:{label:i(`sidebar.gitRepoRootOnly`),title:i(`sidebar.gitRepoRootOnlyTitle`)}:null,s=!!(e&&r===e);return{showWorktreeSwitcher:a,worktreeLoading:s,inactiveWorktreeSelector:o??(s&&!a?{label:i(`sidebar.worktrees`),title:i(`sidebar.checkingWorktrees`)}:null)}}function WXe({selectedSession:e,selectedSessionId:t,refreshKey:n,selectedCwdProp:r,savedWorkspaces:i,onSavedWorkspacesChange:a,onUnseenSession:o,onCwdChange:s,initialSessionId:c,skipInitialProjectSelection:l,onSelectSession:u,onInitialRestoreDone:d,onSessionDeleted:f}){let{t:p}=z(),[m,h]=(0,I.useState)(null),g=PXe({savedWorkspaces:i,onSavedWorkspacesChange:a,setSelectedCwd:h}),_=HXe({selectedCwd:m,selectedCwdProp:r,refreshKey:n,setSelectedCwd:h}),{worktreeState:v,worktreeLoadingCwd:y}=_,[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(``),w=(0,I.useRef)(null);(0,I.useEffect)(()=>{b&&w.current?.focus()},[b]);let{seenSessionIds:T,markSeen:E,handleUnseen:D}=VXe({onUnseenSession:o}),{unreadSessionIds:O,setUnreadSessionIds:k}=MXe(),A=yNe(),{runningSessionIds:j,runningPhases:M,runningPhaseSince:N,runningRespondingSince:ee,runningBusySince:te,setRunningSessionIds:P,runningPollAuthoritativeRef:F}=OY(),[ne,re]=(0,I.useState)(null),{allSessions:ie,loading:ae,sessionRefreshDone:oe,homeDir:se,loadSessions:ce}=LXe({selectedSessionId:t,refreshKey:n,runningSessionIds:j,setUnreadSessionIds:k,setRunningSessionIds:P,runningPollAuthoritativeRef:F,setError:re});(0,I.useEffect)(()=>{N9(O)},[O]);let{projectRootFor:le}=BXe({worktreeState:v,allSessions:ie,selectedCwd:m,setSelectedCwd:h,onCwdChange:s,initialSessionId:c,skipInitialProjectSelection:l,onSelectSession:u,onInitialRestoreDone:d,markSeen:E}),[ue,de]=(0,I.useState)({}),[fe,pe]=(0,I.useState)(null),me=le(m),he=ie,{showWorktreeSwitcher:ge,inactiveWorktreeSelector:_e}=UXe({selectedCwd:m,worktreeState:v,selectedProject:me,worktreeLoadingCwd:y,t:p}),{confirmDeleteGroup:ve,setConfirmDeleteGroup:ye,deleteGroupAnchor:be,deletingGroup:xe,handleDeleteGroup:Se}=FXe({savedWorkspaces:i,onSavedWorkspacesChange:a,onSessionDeleted:f,loadSessions:ce}),Ce=(0,I.useMemo)(()=>iRe({filteredSessions:he,selectedSession:e,projectRootFor:le,selectedCwd:m,savedWorkspaces:i}),[he,m,le,e,i]),we=S.trim().toLowerCase(),Te=(0,I.useMemo)(()=>aRe(Ce,we),[Ce,we]);return(0,I.useEffect)(()=>{let e=new Set;for(let t of ie)e.add(t.id);for(let t of i??[])e.add(fQ(t));AXe(e)},[ie,i]),{t:p,selectedCwd:m,setSelectedCwd:h,selectedSessionId:t,customPath:g,wt:_,workspaceSearchOpen:b,setWorkspaceSearchOpen:x,workspaceSearchQuery:S,setWorkspaceSearchQuery:C,workspaceSearchInputRef:w,seenSessionIds:T,markSeen:E,handleUnseen:D,unreadSessionIds:O,interactionBadges:A,runningSessionIds:j,runningPhases:M,runningPhaseSince:N,runningRespondingSince:ee,runningBusySince:te,error:ne,setError:re,loading:ae,sessionRefreshDone:oe,homeDir:se,loadSessions:ce,groupCollapsed:ue,setGroupCollapsed:de,hoveredGroup:fe,setHoveredGroup:pe,selectedProject:me,showWorktreeSwitcher:ge,inactiveWorktreeSelector:_e,confirmDeleteGroup:ve,setConfirmDeleteGroup:ye,deleteGroupAnchor:be,deletingGroup:xe,handleDeleteGroup:Se,wsQuery:we,visibleGroups:Te}}var V9=null;function GXe(){let[e,t]=(0,I.useState)(V9);return(0,I.useEffect)(()=>{V9||(async()=>{let e=await(await fetch(`/api/agent-dir`)).json();e.dir&&(V9=e.dir,t(e.dir))})()},[]),e}function KXe({searchQuery:e,setSearchQuery:t,currentPath:n,hasUncommittedPath:r,canSelect:i,busy:a,onCancel:o,onSelect:s}){let{t:c}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{className:`directory-picker-footer`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:10,flexShrink:0,padding:`10px 18px`,borderTop:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flex:1,minWidth:0},children:[(0,L.jsxs)(`svg`,{width:B.lg,height:B.lg,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{color:`var(--text-dim)`,flexShrink:0},children:[(0,L.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,L.jsx)(`path`,{d:`m21 21-4.3-4.3`})]}),(0,L.jsx)(BN,{className:`directory-picker-search h-8 flex-1`,type:`text`,value:e,placeholder:c(`directoryPicker.search`),"aria-label":c(`directoryPicker.search`),autoComplete:`off`,spellCheck:!1,style:uP,onChange:e=>t(e.target.value)})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexShrink:0},children:[(0,L.jsx)(`button`,{className:`directory-picker-action`,type:`button`,onClick:o,disabled:a,style:{padding:`6px 14px`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:a?`default`:`pointer`,fontSize:`var(--text-lg)`},children:c(`i18n.cancel`)}),(0,L.jsx)(`button`,{className:`directory-picker-action`,type:`button`,onClick:()=>s(n),disabled:!i,title:c(r?`directoryPicker.openBeforeSelecting`:`directoryPicker.selectCurrentDirectory`),style:{padding:`6px 16px`,border:0,borderRadius:6,background:`var(--accent)`,color:`var(--on-accent)`,fontSize:`var(--text-lg)`,fontWeight:600,opacity:i?1:.6,cursor:i?`pointer`:`default`},children:c(a?`i18n.checking`:`directoryPicker.selectThisFolder`)})]})]})})}function qXe({loading:e,drives:t,filteredDrives:n,filteredDirectories:r,query:i,navigateTo:a,loadError:o,error:s}){let{t:c}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{className:`directory-picker-list`,style:{flex:1,minHeight:0,overflow:`auto`,padding:`8px 10px`},children:[e?(0,L.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:c(`directoryPicker.loadingDirectories`)}):t===null?r.length>0?r.map(e=>(0,L.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void a(e.path),title:e.path,style:{width:`100%`,minHeight:30,display:`flex`,alignItems:`center`,gap:7,padding:`5px 8px`,border:0,borderRadius:5,color:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`},children:[(0,L.jsx)(dP,{}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]},e.path)):(0,L.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:c(i?`directoryPicker.noMatches`:`directoryPicker.noSubdirectories`)}):n.length>0?n.map(e=>(0,L.jsxs)(`button`,{className:`directory-picker-entry`,type:`button`,onClick:()=>void a(e.path),title:e.path,style:{width:`100%`,minHeight:34,display:`flex`,alignItems:`center`,gap:7,padding:`6px 8px`,border:0,borderRadius:5,color:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`},children:[(0,L.jsx)(fP,{}),(0,L.jsx)(`span`,{children:e.name})]},e.path)):(0,L.jsx)(`div`,{style:{padding:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:c(i?`directoryPicker.noMatches`:`directoryPicker.noDrives`)}),(o||s)&&(0,L.jsx)(`div`,{style:{padding:`8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`},children:o??s})]})})}function JXe({handlePathSubmit:e,navigateTo:t,parentDirectory:n,loading:r,canNavigateUp:i,pathInputRef:a,pathInput:o,setPathInput:s,setLoadError:c}){let{t:l}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`form`,{onSubmit:e,style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0,padding:`10px 14px`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsx)(`button`,{className:`directory-picker-back`,type:`button`,onClick:()=>void t(n??void 0),disabled:r||!i,title:l(`directoryPicker.goToParent`),"aria-label":l(`directoryPicker.goToParent`),style:{width:36,height:36,padding:0,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,border:`1px solid var(--border)`,borderRadius:6,background:`#ffffff`,color:`var(--text-muted)`,cursor:i?`pointer`:`default`,opacity:i?1:.45},children:(0,L.jsx)(`svg`,{width:B[`3xl`],height:B[`3xl`],viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,L.jsx)(`path`,{d:`m18 15-6-6-6 6`})})}),(0,L.jsx)(`label`,{htmlFor:`directory-path`,style:{position:`absolute`,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,border:0},children:l(`directoryPicker.directoryPath`)}),(0,L.jsx)(BN,{className:`directory-picker-path h-9 flex-1 font-mono text-xs`,id:`directory-path`,type:`text`,ref:a,value:o,placeholder:`/path/to/project or ~/project`,autoComplete:`off`,spellCheck:!1,style:uP,onChange:e=>{s(e.target.value),c(null)}}),(0,L.jsx)(`button`,{className:`directory-picker-action`,type:`submit`,disabled:!o.trim(),title:l(`directoryPicker.goToDirectory`),style:{minWidth:58,height:36,padding:`0 12px`,border:`1px solid var(--border)`,borderRadius:6,background:`#ffffff`,color:`var(--text-muted)`,cursor:o.trim()?`pointer`:`default`,opacity:o.trim()?1:.6},children:l(`directoryPicker.go`)})]})})}function YXe({onCancel:e,onSelect:t,busy:n=!1,error:r}){let{t:i}=z(),[a,o]=(0,I.useState)(``),[s,c]=(0,I.useState)(null),[l,u]=(0,I.useState)(``),[d,f]=(0,I.useState)([]),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(``),[_,v]=(0,I.useState)(null),[y,b]=(0,I.useState)(!0),x=(0,I.useRef)(null),S=(0,I.useCallback)(async e=>{b(!0),v(null);try{let t=await lP(e),n=t.path??e??`/`;o(n),c(t.parentPath??null),u(n),f(t.directories??[]),m(t.drives??null),g(``)}catch(e){v(e instanceof Error?e.message:String(e))}finally{b(!1)}},[]);(0,I.useEffect)(()=>{S()},[S]),(0,I.useEffect)(()=>{x.current?.focus()},[]);let C=e=>{e.preventDefault();let t=l.trim();t&&S(t)},w=l.trim()!==a,T=!!a&&!w&&!n,E=!!s||pP(a),D=h.trim().toLowerCase(),O=e=>!D||e.toLowerCase().includes(D),k=p===null?[]:p.filter(e=>O(e.name)||O(e.path)),A=d.filter(e=>O(e.name)),j=()=>{n||e()};return(0,L.jsxs)(IQ,{title:i(`directoryPicker.selectDirectory`),align:`center`,width:520,height:620,flush:!0,cardClassName:`directory-picker-light`,testId:`directory-picker`,onEscape:j,headerExtra:(0,L.jsx)(`button`,{type:`button`,"data-testid":`directory-picker-close`,disabled:n,title:i(`i18n.close`),"aria-label":i(`i18n.close`),onClick:j,style:{padding:`2px 6px`,border:0,background:`transparent`,color:`var(--text-muted)`,fontSize:`var(--text-5xl)`,lineHeight:1,cursor:n?`default`:`pointer`,opacity:n?.5:1},children:`×`}),children:[(0,L.jsx)(JXe,{handlePathSubmit:C,navigateTo:S,parentDirectory:s,loading:y,canNavigateUp:E,pathInputRef:x,pathInput:l,setPathInput:u,setLoadError:v}),(0,L.jsx)(qXe,{loading:y,drives:p,filteredDrives:k,filteredDirectories:A,query:D,navigateTo:S,loadError:_,error:r}),(0,L.jsx)(KXe,{searchQuery:h,setSearchQuery:g,currentPath:a,hasUncommittedPath:w,canSelect:T,busy:n,onCancel:e,onSelect:t})]})}function XXe({title:e,label:t}){return(0,L.jsxs)(`button`,{type:`button`,"aria-disabled":`true`,tabIndex:-1,title:e,style:{width:`100%`,height:29,boxSizing:`border-box`,marginTop:6,display:`flex`,alignItems:`center`,gap:6,padding:`0 10px`,border:`1px solid var(--border)`,borderRadius:7,background:`var(--bg-hover)`,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,lineHeight:1.35,whiteSpace:`nowrap`,textAlign:`left`,cursor:`default`,opacity:.82},children:[(0,L.jsxs)(`svg`,{width:B.sm,height:B.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:t})]})}function ZXe({open:e,root:t,count:n,busy:r,anchor:i,onConfirm:a,onCancel:o}){let{t:s}=z();return(0,L.jsx)(nk,{open:e,anchor:i,title:s(`sidebar.deleteWorkspaceDialogTitle`),description:s(`sidebar.deleteWorkspace`,{name:L9(t),count:n}),confirmText:s(`sidebar.delete`),destructive:!0,busy:r,onConfirm:a,onCancel:o})}function H9(e){return e.error?e.path.split(/[\\/]/).pop()||e.id:e.name||e.firstMessage.slice(0,50)||e.id.slice(0,12)}function QXe({hasInteractionBadge:e,depth:t,confirmDelete:n,renaming:r,hovered:i,deleting:a,actionsOpen:o=!1}){return{height:54,position:`relative`,animation:e?`interaction-bg-blink 0.6s ease-in-out infinite`:void 0,display:`flex`,alignItems:`center`,paddingLeft:t>0?t*12+29:29,paddingRight:8,cursor:n||r?`default`:`pointer`,backgroundColor:n?`color-mix(in srgb, var(--status-error) 6%, transparent)`:i?`var(--bg-hover)`:`transparent`,transition:`background 0.1s`,opacity:a?.5:1,gap:6,overflow:o?`visible`:`hidden`,zIndex:o?5:void 0}}function $Xe(e){return{cursor:`pointer`,background:e?`var(--bg-hover)`:`var(--bg)`}}function eZe({hasInteraction:e,hasRunning:t,collapsed:n}){return{background:e&&n?`transparent`:t&&n?`linear-gradient(90deg, transparent 13%, color-mix(in srgb, var(--accent) 18%, transparent) 25%, transparent 37%, transparent 63%, color-mix(in srgb, var(--shine-highlight) 50%, transparent) 75%, transparent 87%)`:`transparent`,backgroundSize:t&&n&&!e?`200% 100%`:void 0,animation:e&&n?`interaction-bg-blink 0.6s ease-in-out infinite`:t&&n?`pi-status-shine 1.5s linear infinite`:void 0}}function tZe({group:e,groupSelected:t,hoveredGroup:n,runningSessionIds:r,interactionBadges:i,collapsed:a,setHoveredGroup:o,setGroupCollapsed:s,setConfirmDeleteGroup:c,handleNewSession:l,copyText:u}){let{t:d}=z(),f=e.sessions.some(e=>r.has(e.id)),p=e.sessions.some(e=>i.has(e.id)),m=n===e.root;return(0,L.jsx)(`div`,{"data-testid":`workspace-group-header`,"data-group-root":e.root,onMouseEnter:()=>o(e.root),onMouseLeave:()=>o(null),style:{display:`flex`,alignItems:`center`,gap:4,height:40,padding:`0 2px`,boxSizing:`border-box`,fontSize:`var(--text-base)`,fontFamily:`var(--font-mono)`,color:`var(--text)`,fontWeight:600,textTransform:`none`,letterSpacing:.6,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,...$Xe(m)},onClick:()=>{s(t=>({...t,[e.root]:!t[e.root]}))},children:(0,L.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,flex:1,minWidth:0,height:38,boxSizing:`border-box`,padding:`0 8px`,border:`none`,borderRadius:0,...eZe({hasInteraction:p,hasRunning:f,collapsed:a}),boxShadow:`0 2px 8px var(--shadow-color)`,margin:`0 -2px`},children:[(0,L.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:B[`2xl`],flexShrink:0,color:t?`var(--accent)`:`var(--text-muted)`},"data-testid":`workspace-group-icon`,"data-open":a?`false`:`true`,"data-filled":t?`true`:`false`,children:(0,L.jsx)(PK,{size:B[`2xl`],open:!a,filled:t})}),(0,L.jsx)(fT,{label:e.root,wrapperStyle:{flex:1,minWidth:0,overflow:`hidden`},children:(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`100%`,lineHeight:`20px`},children:L9(e.root)})}),m&&(0,L.jsx)(uJ,{items:[{key:`delete-workspace`,onClick:t=>{t.stopPropagation(),c(e.root,t.currentTarget.closest(`[data-testid="workspace-group-header"]`)??t.currentTarget)},title:d(`sidebar.deleteWorkspaceTitle`),testId:`delete-workspace`,danger:!0,ghost:!0,icon:(0,L.jsx)(aT,{size:B.xl})},{key:`copy-path`,onClick:t=>{t.stopPropagation(),u(e.root)},title:d(`sidebar.copyPath`),ghost:!0,icon:(0,L.jsx)(kw,{size:B.xl})}]}),(0,L.jsx)(uJ,{items:[{key:`new-session`,onClick:t=>{t.stopPropagation(),l(e.root)},title:d(`sidebar.newSessionTitle`,{path:L9(e.root)}),ghost:!0,icon:(0,L.jsx)(qw,{size:B.xl})}]})]})})}var nZe=` (Ctrl+Enter)`;function rZe(e,t,n){return t?e.kind===`naming`?n(`title.generating`):e.kind===`success`?n(`title.updated`):`${n(`title.generateSession`)}${nZe}`:n(`title.noMessages`)}function iZe({sessionId:e,hasMessages:t,onRenamed:n,size:r=24,ref:i}){let{t:a}=z(),[o,s]=(0,I.useState)({kind:`idle`}),c=LN(),l=(0,I.useRef)(!0);(0,I.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]);let u=(0,I.useCallback)(async()=>{if(!t||o.kind===`naming`)return;c.cancel(),s({kind:`naming`});let r=!1;try{let t=await mw(`/api/sessions/${encodeURIComponent(e)}/auto-name`,{method:`POST`},{loading:`silent`});if(!t?.title)throw Error(`The server did not return a session title`);if(!l.current)return;n?.(e,t.title.trim()),r=!0,s({kind:`success`}),c.schedule(()=>s({kind:`idle`}),1800)}catch(e){BJ(e,`auto-name`)}finally{!r&&l.current&&s({kind:`idle`})}},[t,o.kind,c,e,n]);(0,I.useImperativeHandle)(i,()=>({run:()=>void u()}),[u]);let d=o.kind===`success`;return(0,L.jsx)(uJ,{size:r,gap:0,items:[{key:`auto-name`,testId:`session-auto-name`,title:rZe(o,t,a),disabled:!t||o.kind===`naming`,skipHover:d,color:d?`var(--status-success)`:void 0,icon:o.kind===`naming`?(0,L.jsx)(Uw,{className:`animate-spin`,size:B.xl,"aria-hidden":`true`}):d?(0,L.jsx)(Tw,{size:B.xl,"aria-hidden":`true`}):(0,L.jsx)(tT,{size:B.xl,"aria-hidden":`true`}),onClick:e=>{e.stopPropagation(),u()}}]})}function aZe({collapsed:e,onToggleCollapse:t}){return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(fT,{label:e?`Expand forks`:`Collapse forks`,children:(0,L.jsx)(`button`,{onClick:e=>{e.stopPropagation(),t?.()},style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:20,height:20,padding:0,flexShrink:0,border:`none`,color:`var(--text-dim)`,cursor:`pointer`,transform:e?`rotate(-90deg)`:`none`,transition:`transform 0.15s`},children:(0,L.jsx)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,L.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})})})})}function oZe({session:e,title:t,onConfirm:n,onCancel:r}){let{t:i}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsx)(`div`,{style:{fontSize:`var(--text-base)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t}),(0,L.jsxs)(`div`,{style:{marginTop:2,display:`flex`,alignItems:`center`,gap:8,color:`var(--text-dim)`,fontSize:`var(--text-sm)`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[e.error?(0,L.jsx)(z9,{session:e}):(0,L.jsx)(`span`,{title:e.modified,children:F9(e.modified,i)}),(0,L.jsx)(`span`,{children:i(`sidebar.messagesCount`,{count:e.messageCount})})]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:5,flexShrink:0},children:[(0,L.jsxs)(`button`,{onClick:n,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:4,height:30,padding:`0 11px`,background:`var(--status-error)`,border:`none`,borderRadius:6,color:`var(--on-error)`,cursor:`pointer`,fontSize:`var(--text-base)`,fontWeight:600,whiteSpace:`nowrap`},children:[(0,L.jsx)(aT,{size:B.base}),i(`sidebar.delete`)]}),(0,L.jsx)(`button`,{onClick:r,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:30,padding:`0 11px`,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-base)`,fontWeight:500,whiteSpace:`nowrap`},children:i(`sidebar.cancel`)})]})]})})}var sZe=(e=!1)=>({display:`flex`,alignItems:`center`,justifyContent:`center`,width:20,height:20,padding:0,border:`1px solid transparent`,borderRadius:6,background:`transparent`,color:e?`var(--status-error)`:`var(--text-muted)`,cursor:`pointer`,flexShrink:0,transition:`background 0.12s, color 0.12s, border-color 0.12s`,"--hover-bg":e?`color-mix(in srgb, var(--status-error) 8%, transparent)`:`var(--bg-selected)`,"--hover-color":e?`var(--status-error)`:`var(--accent)`,"--hover-border":`transparent`});function U9({testId:e,title:t,onClick:n,danger:r=!1,hoverOnly:i=!1,children:a}){return(0,L.jsx)(fT,{label:t,wrapperClassName:i?`hover-only`:void 0,children:(0,L.jsx)(`button`,{type:`button`,"data-testid":e,"aria-label":t,onClick:n,className:`hover-shift${i?` hover-only`:``}`,style:sZe(r),children:a})})}function cZe({session:e,isSeen:t,onUnseen:n,startRename:r,handleDeleteClick:i}){let{t:a}=z();return(0,L.jsxs)(`div`,{"data-testid":`session-item-actions`,role:`group`,"aria-label":a(`sidebar.actions`),style:{display:`flex`,alignItems:`center`,gap:2,flexShrink:0,marginLeft:6},children:[(0,L.jsxs)(`span`,{className:`session-row-actions`,style:{display:`flex`,alignItems:`center`,gap:2},children:[t&&n!=null&&(0,L.jsx)(U9,{testId:`session-unseen`,title:a(`sidebar.disconnect`),hoverOnly:!0,onClick:t=>{t.stopPropagation(),n(e.id)},children:(0,L.jsx)(Dse,{size:B.xl})}),(0,L.jsx)(U9,{testId:`session-delete`,title:a(`sidebar.deleteWithShiftClick`),danger:!0,hoverOnly:!0,onClick:i,children:(0,L.jsx)(aT,{size:B.xl})}),(0,L.jsx)(U9,{testId:`session-copy`,title:a(`sidebar.copyPath`),hoverOnly:!0,onClick:t=>{t.stopPropagation(),OZ(e.path)},children:(0,L.jsx)(kw,{size:B.xl})})]}),(0,L.jsx)(U9,{testId:`session-rename`,title:a(`sidebar.rename`),onClick:r,children:(0,L.jsx)(Gw,{size:B.xl})})]})}function lZe({session:e,title:t,isSelected:n,isSeen:r,isRunning:i,isUnread:a,phase:o,answering:s,elapsed:c,totalElapsed:l,onUnseen:u,handleDeleteClick:d,startRename:f}){let{t:p}=z();return(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,minWidth:0,fontSize:`var(--text-base)`,fontWeight:400,lineHeight:1.4,color:r?`var(--text)`:`var(--text-dim)`},title:t,children:(0,L.jsx)(`span`,{style:{flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:0},children:t})}),(0,L.jsxs)(`div`,{style:{marginTop:2,display:`flex`,alignItems:`center`,gap:8,minWidth:0},children:[(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,gap:8,color:n?`var(--text-muted)`:`var(--text-dim)`,fontSize:`var(--text-sm)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[e.error?(0,L.jsx)(z9,{session:e}):i?(0,L.jsx)(s$,{phase:o,answering:s,elapsed:c,totalElapsed:l}):a?(0,L.jsx)(NXe,{}):(0,L.jsx)(`span`,{title:e.modified,children:F9(e.modified,p)}),!e.error&&i?null:(0,L.jsx)(`span`,{children:p(`sidebar.messagesCount`,{count:e.messageCount})}),e.worktreeBranch&&(0,L.jsxs)(`span`,{title:`Worktree: ${e.cwd}`,style:{display:`flex`,alignItems:`center`,gap:3,color:`var(--accent)`,minWidth:0,overflow:`hidden`},children:[(0,L.jsxs)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.worktreeBranch})]})]}),(0,L.jsx)(cZe,{session:e,isSeen:r,onUnseen:u,startRename:f,handleDeleteClick:d})]})]})}function uZe(e){return e instanceof HTMLElement&&e.closest(`[data-testid="session-auto-name"]`)!==null}function dZe({session:e,isSelected:t,isRunning:n,phase:r,phaseSince:i,respondingSince:a,busySince:o,isUnread:s,isSeen:c=!0,hasInteractionBadge:l=!1,onClick:u,onRenamed:d,onDeleted:f,onUnseen:p,depth:m=0,hasChildren:h=!1,collapsed:g=!1,onToggleCollapse:_}){let{t:v}=z(),y=kY(!!n,r?i:a),b=kY(!!n,o),x=!!n&&r==null&&a!=null,[S,C]=(0,I.useState)(!1),[w,T]=(0,I.useState)(!1),[E,D]=(0,I.useState)(``),[O,k]=(0,I.useState)(!1),A=A9().get(e.id)?.status===`running`,[j,M]=(0,I.useState)(null),[N,ee]=(0,I.useState)(null),te=(0,I.useRef)(null),P=H9(e),F=(0,I.useCallback)(t=>{t.stopPropagation(),D(e.name??``),T(!0),setTimeout(()=>te.current?.select(),0)},[e.name]),ne=(0,I.useCallback)(async()=>{let t=E.trim();if(T(!1),t!==(e.name??``))try{await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:t})}),d?.()}catch{}},[E,e.id,e.name,d]),re=(0,I.useCallback)(t=>{k(!1),M(null),j9(e.id,`session`,async n=>{let r=t===`all`?{deleteAllAuxFiles:!0}:t.length>0?{deleteAuxFiles:t}:null,i=await fetch(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`DELETE`,signal:n,...r?{headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}:{}});if(!i.ok)throw Error(`delete session failed: HTTP ${i.status}`)},()=>f?.(e.id))},[e.id,f]),ie=(0,I.useCallback)(t=>{if(t.stopPropagation(),ee(t.currentTarget.closest(`[data-testid="session-item"]`)??t.currentTarget),t.shiftKey){re(`all`);return}aY(e.id).then(e=>{e.length>0?M(e):k(!0)})},[re,e.id]),ae=(0,I.useCallback)(e=>{e.stopPropagation(),re([])},[re]),oe=(0,I.useCallback)(e=>{e.stopPropagation(),k(!1)},[]),se=(0,I.useCallback)(e=>{e.key===`Enter`&&ne(),e.key===`Escape`&&T(!1)},[ne]),ce=(0,I.useCallback)((e,t)=>{D(t),d?.()},[d]);return(0,L.jsxs)(L.Fragment,{children:[j!=null&&(0,L.jsx)(TJ,{open:!0,mode:`delete`,files:j,busy:A,anchor:N,onConfirm:e=>void re(e),onCancel:()=>M(null)}),(0,L.jsx)(`div`,{"data-testid":`session-item`,"data-session-id":e.id,onClick:O||w?void 0:u,title:l?v(`sidebar.interactionBadge`):void 0,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),style:QXe({hasInteractionBadge:l,depth:m,confirmDelete:O,renaming:w,hovered:S,deleting:A}),className:t&&!O?`row-selected-gradient`:void 0,children:(0,L.jsx)(fZe,{session:e,title:P,inputRef:te,isSelected:t,isSeen:c,isUnread:s,isRunning:n,phase:r,answering:x,elapsed:y,totalElapsed:b,depth:m,hasChildren:h,collapsed:g,onToggleCollapse:_,confirmDelete:O,renaming:w,renameValue:E,onRenameChange:D,onAutoNamed:ce,commitRename:ne,handleRenameKeyDown:se,handleDeleteClick:ie,handleDeleteConfirm:ae,handleDeleteCancel:oe,startRename:F,onUnseen:p})})]})}function fZe({session:e,title:t,inputRef:n,isSelected:r,isSeen:i,isUnread:a,isRunning:o,phase:s,answering:c,elapsed:l,totalElapsed:u,depth:d,hasChildren:f,collapsed:p,onToggleCollapse:m,confirmDelete:h,renaming:g,renameValue:_,onRenameChange:v,commitRename:y,handleRenameKeyDown:b,onAutoNamed:x,handleDeleteClick:S,handleDeleteConfirm:C,handleDeleteCancel:w,startRename:T,onUnseen:E}){let D=(0,I.useRef)(null);return h?(0,L.jsx)(oZe,{session:e,title:t,onConfirm:C,onCancel:w}):g?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`input`,{ref:n,"data-testid":`session-rename-input`,value:_,onChange:e=>v(e.target.value),onBlur:e=>{uZe(e.relatedTarget)||y()},onKeyDown:e=>{if(e.key===`Enter`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),D.current?.run();return}b(e)},autoFocus:!0,style:{flex:1,fontSize:`var(--text-base)`,padding:`5px 8px`,border:`1px solid var(--accent)`,borderRadius:5,outline:`none`,background:`var(--bg)`,color:`var(--text)`,height:30}}),(0,L.jsx)(`span`,{onMouseDown:e=>e.preventDefault(),style:{display:`flex`,flexShrink:0},children:(0,L.jsx)(iZe,{ref:D,sessionId:e.id,hasMessages:e.messageCount>0,onRenamed:x})})]}):(0,L.jsxs)(L.Fragment,{children:[d>0&&(0,L.jsxs)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--text-dim)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(lZe,{session:e,title:t,isSelected:r,isSeen:i,isRunning:o,isUnread:a,phase:s,answering:c,elapsed:l,totalElapsed:u,onUnseen:E,handleDeleteClick:S,startRename:T}),f&&(0,L.jsx)(aZe,{collapsed:p,onToggleCollapse:m})]})}function W9({node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningRespondingSince:a,runningBusySince:o,unreadSessionIds:s,seenSessionIds:c,interactionBadges:l,onSelectSession:u,onRenamed:d,onSessionDeleted:f,onUnseen:p,depth:m}){let[h,g]=(0,I.useState)(!1),_=e.children.length>0;return(0,L.jsxs)(`div`,{style:{},children:[(0,L.jsxs)(`div`,{style:{position:`relative`},children:[m>0&&(0,L.jsx)(`div`,{style:{position:`absolute`,left:m*12+6,top:0,bottom:0,width:1,background:`var(--border)`,pointerEvents:`none`}}),(0,L.jsx)(dZe,{session:e.session,isSelected:e.session.id===t,isRunning:n.has(e.session.id),phase:r[e.session.id],phaseSince:i[e.session.id],respondingSince:a[e.session.id],busySince:o[e.session.id],isUnread:s.has(e.session.id),isSeen:c.has(e.session.id),hasInteractionBadge:l.has(e.session.id),onClick:()=>u(e.session),onRenamed:d,onDeleted:e=>f?.(e),onUnseen:p,depth:m,hasChildren:_,collapsed:h,onToggleCollapse:()=>g(e=>!e)})]}),_&&!h&&(0,L.jsx)(`div`,{children:e.children.map(e=>(0,L.jsx)(W9,{node:e,selectedSessionId:t,runningSessionIds:n,runningPhases:r,runningPhaseSince:i,runningRespondingSince:a,runningBusySince:o,unreadSessionIds:s,seenSessionIds:c,interactionBadges:l,onSelectSession:u,onRenamed:d,onSessionDeleted:f,onUnseen:p,depth:m+1},e.session.id))})]})}function pZe(e){let t=new Map;for(let n of e)t.set(n.id,{session:n,children:[]});let n=new Map;for(let t of e)t.parentSessionId&&n.set(t.id,t.parentSessionId);function r(e){let r=n.get(e),i=new Set;for(;r;){if(i.has(r))return null;if(i.add(r),t.has(r))return r;r=n.get(r)}return null}let i=[];for(let e of t.values()){let n=r(e.session.id);n?t.get(n).children.push(e):i.push(e)}let a=e=>{e.sort((e,t)=>t.session.modified.localeCompare(e.session.modified)),e.forEach(e=>a(e.children))};return a(i),i}function mZe({visibleGroups:e,selectedSessionId:t,selectedProject:n,wsQuery:r,groupCollapsed:i,hoveredGroup:a,confirmDeleteGroup:o,deletingGroup:s,runningSessionIds:c,runningPhases:l,runningPhaseSince:u,runningRespondingSince:d,runningBusySince:f,unreadSessionIds:p,seenSessionIds:m,interactionBadges:h,setHoveredGroup:g,setGroupCollapsed:_,setConfirmDeleteGroup:v,deleteGroupAnchor:y,handleDeleteGroup:b,handleNewSession:x,copyText:S,handleSelectSessionFromList:C,onSessionDeleted:w,handleUnseen:T,loadSessions:E}){let{t:D}=z(),O=o?e.find(e=>e.root===o)??null:null;return(0,L.jsxs)(L.Fragment,{children:[e.map(o=>{let s=o.sessions.some(e=>e.id===t)||o.root===n;return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(tZe,{group:o,groupSelected:s,hoveredGroup:a,runningSessionIds:c,interactionBadges:h,collapsed:!!i[o.root],setHoveredGroup:g,setGroupCollapsed:_,setConfirmDeleteGroup:v,handleNewSession:x,copyText:S}),(r||!i[o.root])&&(o.sessions.length===0?(0,L.jsx)(`div`,{style:{padding:`10px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-sm)`},children:D(`sidebar.noSessions`)}):pZe(o.sessions).map(n=>(0,L.jsx)(W9,{node:n,selectedSessionId:t,runningSessionIds:c,runningPhases:l,runningPhaseSince:u,runningRespondingSince:d,runningBusySince:f,unreadSessionIds:p,seenSessionIds:m,interactionBadges:h,onSelectSession:C,onRenamed:()=>E(!1,!0),onSessionDeleted:t=>{let n=e.find(e=>e.sessions.some(e=>e.id===t)),r=n?.sessions.find(e=>e.id===t);wXe(C9(`data-session-id`,t),D(`sidebar.deletedSessionGhost`,{workspace:n?L9(n.root):r?.path??``,session:r?H9(r):t})),w?.(t),E(!1,!0)},onUnseen:T,depth:0},n.session.id)))]},o.root)}),(0,L.jsx)(ZXe,{open:!!O,root:O?.root??``,count:O?.sessions.length??0,busy:s,anchor:y,onConfirm:()=>{if(!O)return;let e=b9(C9(`data-group-root`,O.root)),t=O.sessions.length;b(O).then(n=>{n&&x9(e,D(`sidebar.deletedWorkspaceGhost`,{name:L9(O.root),count:t}))})},onCancel:()=>v(null)})]})}function hZe({loading:e,error:t,noSearchResults:n}){let{t:r}=z();return e?(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:[(0,L.jsx)(`div`,{style:{width:14,height:14,border:`2px solid var(--border)`,borderTopColor:`var(--text-dim)`,borderRadius:`50%`,animation:`spin 0.8s linear infinite`,flexShrink:0}}),r(`sidebar.loading`)]}):t?(0,L.jsx)(`div`,{style:{padding:`12px 14px`,color:`var(--status-error)`,fontSize:`var(--text-base)`},children:t}):n?(0,L.jsx)(`div`,{style:{padding:`16px 14px`,color:`var(--text-muted)`,fontSize:`var(--text-base)`},children:r(`sidebar.searchSessionsNoResults`)}):null}function gZe({searchOpen:e,onToggleSearch:t,onNewWorkspace:n,onRefresh:r,refreshDone:i}){let{t:a}=z();return(0,L.jsx)(uJ,{ghost:!0,items:[{key:`search`,testId:`workspace-search-toggle`,onClick:t,title:a(`sidebar.searchSessions`),ariaPressed:e,color:e?`var(--accent)`:`var(--text-muted)`,background:e?`var(--bg-selected)`:void 0,icon:(0,L.jsx)(Qw,{size:B.lg})},{key:`new-workspace`,testId:`new-workspace`,onClick:n,title:a(`sidebar.newWorkspace`),color:`var(--text-muted)`,icon:(0,L.jsx)(ase,{size:B.xl})},{key:`refresh`,testId:`session-refresh`,onClick:r,title:a(`sidebar.refresh`),skipHover:i,color:i?`var(--status-success)`:`var(--text-muted)`,background:i?`color-mix(in srgb, var(--status-success) 18%, transparent)`:void 0,icon:i?(0,L.jsx)(Tw,{size:B.xl,color:`var(--status-success)`,strokeWidth:2.5}):(0,L.jsx)(Yw,{size:B.xl})}]})}function _Ze({value:e,onChange:t,onClear:n,inputRef:r}){let{t:i}=z();return(0,L.jsxs)(`div`,{"data-testid":`workspace-search`,style:{display:`flex`,alignItems:`center`,gap:4,width:`100%`,minWidth:0,padding:`4px 8px`,background:`var(--bg)`,borderBottom:`1px solid var(--border)`,boxSizing:`border-box`},children:[(0,L.jsx)(Qw,{size:B.lg,color:`var(--text-muted)`,style:{flexShrink:0}}),(0,L.jsx)(`input`,{ref:r,value:e,onChange:e=>t(e.target.value),placeholder:i(`sidebar.searchSessionsPlaceholder`),"aria-label":i(`sidebar.searchSessions`),style:{flex:1,minWidth:0,background:`transparent`,border:`none`,outline:`none`,color:`var(--text)`,fontSize:`var(--text-sm)`}}),e&&(0,L.jsx)(`button`,{type:`button`,onClick:n,"aria-label":i(`chat.clearSearch`),style:{border:`none`,background:`transparent`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`var(--text-sm)`,flexShrink:0,padding:0},children:`✕`})]})}function vZe({wtNewOpen:e,setWtNewOpen:t,wtNewBranch:n,setWtNewBranch:r,wtNewInputRef:i,handleCreateWorktree:a,wtBusy:o,setWtError:s}){let{t:c}=z();return(0,L.jsx)(L.Fragment,{children:e?(0,L.jsxs)(`div`,{style:{padding:`6px 8px`},children:[(0,L.jsx)(`input`,{ref:i,"data-testid":`worktree-new-branch-input`,value:n,onChange:e=>{r(e.target.value),s(null)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a()),e.key===`Escape`&&(t(!1),r(``),s(null))},placeholder:c(`sidebar.branchName`),style:{width:`100%`,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,padding:`5px 8px`,border:`1px solid var(--accent)`,borderRadius:5,outline:`none`,background:`var(--bg)`,color:`var(--text)`,boxSizing:`border-box`}}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:5,marginTop:5},children:[(0,L.jsx)(`button`,{"data-testid":`worktree-create`,onClick:()=>void a(),disabled:o||!n.trim(),style:{flex:1,padding:`4px 0`,background:`var(--accent)`,border:`none`,borderRadius:5,color:`var(--on-accent)`,fontSize:`var(--text-sm)`,fontWeight:600,cursor:o||!n.trim()?`not-allowed`:`pointer`,opacity:o||!n.trim()?.65:1},children:c(o?`sidebar.creating`:`sidebar.create`)}),(0,L.jsx)(`button`,{onClick:()=>{t(!1),r(``),s(null)},style:{flex:1,padding:`4px 0`,background:`var(--bg-hover)`,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`},children:c(`sidebar.cancel`)})]})]}):(0,L.jsxs)(`button`,{"data-testid":`worktree-new`,onClick:e=>{e.stopPropagation(),t(!0),s(null),setTimeout(()=>i.current?.focus(),0)},title:c(`sidebar.createWorktreeTitle`),style:{display:`flex`,alignItems:`center`,gap:7,width:`100%`,padding:`8px 10px`,border:`none`,color:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-sm)`},children:[(0,L.jsxs)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`,style:{flexShrink:0},children:[(0,L.jsx)(`line`,{x1:`5`,y1:`1`,x2:`5`,y2:`9`}),(0,L.jsx)(`line`,{x1:`1`,y1:`5`,x2:`9`,y2:`5`})]}),(0,L.jsx)(`span`,{children:c(`sidebar.newWorktree`)})]})})}function yZe({worktrees:e,visibleWorktrees:t,selectedCwd:n,homeDir:r,wtConfirmRemove:i,setWtConfirmRemove:a,handleRemoveWorktree:o,wtBusy:s,setSelectedCwd:c,closeWorktrees:l,showWtFilter:u,wtFilter:d}){let{t:f}=z();return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(`div`,{style:{maxHeight:`min(40vh, 300px)`,overflowY:`auto`},children:[t.map(t=>{let u=P9(t.path,n)||t.isMain&&!e.some(e=>P9(e.path,n));return i===t.path?(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`7px 10px`,borderBottom:`1px solid var(--border)`,background:`color-mix(in srgb, var(--status-error) 6%, transparent)`},children:[(0,L.jsx)(`span`,{style:{flex:1,fontSize:`var(--text-sm)`,color:`var(--text)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:f(`sidebar.forceRemoveCheckout`)}),(0,L.jsx)(`button`,{"data-testid":`worktree-force-remove`,onClick:()=>void o(t.path,!0),disabled:s,style:{padding:`3px 9px`,background:`var(--status-error)`,border:`none`,borderRadius:5,color:`var(--on-error)`,fontSize:`var(--text-sm)`,fontWeight:600,cursor:`pointer`,flexShrink:0},children:f(`sidebar.force`)}),(0,L.jsx)(`button`,{onClick:()=>a(null),style:{padding:`3px 9px`,background:`var(--bg-hover)`,border:`1px solid var(--border)`,borderRadius:5,color:`var(--text-muted)`,fontSize:`var(--text-sm)`,cursor:`pointer`,flexShrink:0},children:f(`sidebar.cancel`)})]},t.path):(0,L.jsxs)(`div`,{className:`wt-row`,"data-testid":`worktree-row`,style:{display:`flex`,alignItems:`center`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsxs)(`button`,{"data-testid":`worktree-item`,onClick:()=>{c(t.path),l()},title:t.path,style:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,gap:7,padding:`8px 10px`,background:`var(--bg)`,border:`none`,color:u?`var(--text)`:`var(--text-muted)`,cursor:`pointer`,textAlign:`left`,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`},children:[u?(0,L.jsx)(`svg`,{width:B.xs,height:B.xs,viewBox:`0 0 10 10`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:(0,L.jsx)(`polyline`,{points:`1.5 5 4 7.5 8.5 2.5`})}):(0,L.jsx)(`span`,{style:{width:10,flexShrink:0}}),(0,L.jsx)(R9,{text:t.branch??I9(t.path,r),style:{flex:1}}),t.isMain&&(0,L.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:f(`sidebar.main`)})]}),!t.isMain&&(0,L.jsx)(`button`,{"data-testid":`worktree-remove`,onClick:()=>void o(t.path,!1),disabled:s,title:f(`sidebar.removeWorktreeTitle`,{path:t.path}),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:34,height:28,padding:0,marginRight:4,border:`none`,color:`var(--text-dim)`,cursor:`pointer`,borderRadius:5,flexShrink:0,transition:`color 0.12s, background 0.12s`,"--hover-color":`var(--status-error)`,"--hover-bg":`color-mix(in srgb, var(--status-error) 8%, transparent)`},className:`hover-shift`,children:(0,L.jsxs)(`svg`,{width:B.base,height:B.base,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,L.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,L.jsx)(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),(0,L.jsx)(`path`,{d:`M10 11v6M14 11v6`}),(0,L.jsx)(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})]})})]},t.path)}),u&&t.length===0&&d.trim()&&(0,L.jsx)(`div`,{style:{padding:`8px 10px`,fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:f(`sidebar.noMatchingWorktrees`)})]})})}function bZe({wt:e,selectedCwd:t,homeDir:n,setSelectedCwd:r}){let{t:i}=z(),{worktreeState:a,wtFilter:o,setWtFilter:s,wtDropdownOpen:c,setWtDropdownOpen:l,wtDropdownRef:u,closeWorktrees:d,handleRemoveWorktree:f,wtConfirmRemove:p,setWtConfirmRemove:m,wtBusy:h,wtNewOpen:g,setWtNewOpen:_,wtNewBranch:v,setWtNewBranch:y,wtNewInputRef:b,handleCreateWorktree:x,wtError:S,setWtError:C}=e;if(!a)return null;let w=a.worktrees.find(e=>P9(e.path,t))??a.worktrees.find(e=>e.isMain),T=a.worktrees.length>=8,E=T&&o.trim()?a.worktrees.filter(e=>(e.branch??I9(e.path,n)).toLowerCase().includes(o.trim().toLowerCase())):a.worktrees;return(0,L.jsxs)(`div`,{ref:u,"data-testid":`worktree-switcher`,style:{position:`relative`,marginTop:6},children:[(0,L.jsxs)(`button`,{"data-testid":`worktree-switcher-trigger`,onClick:()=>l(e=>!e),title:w?i(`sidebar.switchWorktreeTitle`,{path:w.path}):i(`sidebar.switchWorktree`),style:{width:`100%`,height:29,boxSizing:`border-box`,display:`flex`,alignItems:`center`,gap:6,padding:`0 10px`,background:`var(--bg-input)`,border:`1px solid var(--border)`,borderRadius:7,cursor:`pointer`,fontSize:`var(--text-sm)`,lineHeight:1.35,color:`var(--text-muted)`,textAlign:`left`},children:[(0,L.jsxs)(`svg`,{width:B.sm,height:B.sm,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0,color:w&&!w.isMain?`var(--accent)`:`var(--text-dim)`},children:[(0,L.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`15`}),(0,L.jsx)(`circle`,{cx:`18`,cy:`6`,r:`3`}),(0,L.jsx)(`circle`,{cx:`6`,cy:`18`,r:`3`}),(0,L.jsx)(`path`,{d:`M18 9a9 9 0 0 1-9 9`})]}),(0,L.jsx)(R9,{text:w?w.branch??I9(w.path,n):`…`,style:{flex:1,fontFamily:`var(--font-mono)`,color:`var(--text)`}}),w?.isMain&&(0,L.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:i(`sidebar.main`)}),a.worktrees.length>1&&(0,L.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-dim)`,fontSize:`var(--text-xs)`},children:a.worktrees.length}),(0,L.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 10 10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:(0,L.jsx)(`polyline`,{points:`2 3.5 5 6.5 8 3.5`})})]}),(0,L.jsxs)(zXe,{open:c,style:{position:`absolute`,top:`calc(100% + 4px)`,left:0,right:0,zIndex:100,background:`var(--bg)`,border:`1px solid var(--border)`,borderRadius:8,boxShadow:`0 6px 20px var(--shadow-color)`,overflow:`hidden`},children:[T&&(0,L.jsx)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:(0,L.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(s(``),d())},placeholder:i(`sidebar.filterWorktrees`),autoFocus:!0,style:{width:`100%`,fontSize:`var(--text-sm)`,fontFamily:`var(--font-mono)`,padding:`5px 8px`,border:`1px solid var(--border)`,borderRadius:5,outline:`none`,background:`var(--bg)`,color:`var(--text)`,boxSizing:`border-box`}})}),(0,L.jsx)(yZe,{worktrees:a.worktrees,visibleWorktrees:E,selectedCwd:t,homeDir:n,wtConfirmRemove:p,setWtConfirmRemove:m,handleRemoveWorktree:f,wtBusy:h,setSelectedCwd:r,closeWorktrees:d,showWtFilter:T,wtFilter:o}),(0,L.jsx)(vZe,{wtNewOpen:g,setWtNewOpen:_,wtNewBranch:v,setWtNewBranch:y,wtNewInputRef:b,handleCreateWorktree:x,wtBusy:h,setWtError:C}),S&&(0,L.jsx)(`div`,{style:{padding:`5px 10px 8px`,color:`var(--status-error)`,fontSize:`var(--text-sm)`,lineHeight:1.35,overflowWrap:`anywhere`},children:S})]})]})}function xZe({sb:e,handleSelectSessionFromList:t,handleNewSession:n,onSessionDeleted:r}){let{t:i}=z(),a=GXe(),{customPath:o,wt:s,selectedCwd:c,setSelectedCwd:l,homeDir:u,workspaceSearchOpen:d,setWorkspaceSearchOpen:f,workspaceSearchQuery:p,setWorkspaceSearchQuery:m,workspaceSearchInputRef:h,loadSessions:g,sessionRefreshDone:_,showWorktreeSwitcher:v,inactiveWorktreeSelector:y,loading:b,error:x,wsQuery:S,visibleGroups:C}=e;return(0,L.jsxs)(L.Fragment,{children:[o.customPathOpen&&(0,L.jsx)(YXe,{busy:o.customPathValidating,error:o.customPathError,onCancel:()=>{o.setCustomPathOpen(!1),o.setCustomPathError(null)},onSelect:e=>void o.commitCustomPath(e)}),(0,L.jsxs)(dJ,{title:i(`sidebar.workspace`),titleTooltip:a?i(`sidebar.workspaceStoragePath`,{path:a}):void 0,open:!0,onToggle:()=>{},collapsible:!1,testId:`workspace-scroll`,hintTestId:`workspace`,scrollStyle:{flex:`1 1 auto`,minHeight:80,background:`var(--bg)`},style:{flex:1,minHeight:0},actions:(0,L.jsx)(gZe,{searchOpen:d,onToggleSearch:()=>{d&&m(``),f(e=>!e)},onNewWorkspace:()=>o.setCustomPathOpen(!0),onRefresh:()=>g(!1,!0),refreshDone:_}),headerExtra:(0,L.jsxs)(L.Fragment,{children:[d&&(0,L.jsx)(_Ze,{value:p,onChange:m,onClear:()=>{m(``),h.current?.focus()},inputRef:h}),v&&(0,L.jsx)(bZe,{wt:s,selectedCwd:c,homeDir:u,setSelectedCwd:l}),y&&(0,L.jsx)(XXe,{title:y.title,label:y.label})]}),children:[(0,L.jsx)(hZe,{loading:b,error:x,noSearchResults:!b&&!x&&!!S&&C.length===0}),(0,L.jsx)(mZe,{visibleGroups:C,selectedSessionId:e.selectedSessionId,selectedProject:e.selectedProject,wsQuery:S,groupCollapsed:e.groupCollapsed,hoveredGroup:e.hoveredGroup,confirmDeleteGroup:e.confirmDeleteGroup,deletingGroup:e.deletingGroup,runningSessionIds:e.runningSessionIds,runningPhases:e.runningPhases,runningPhaseSince:e.runningPhaseSince,runningRespondingSince:e.runningRespondingSince,runningBusySince:e.runningBusySince,unreadSessionIds:e.unreadSessionIds,seenSessionIds:e.seenSessionIds,interactionBadges:e.interactionBadges,setHoveredGroup:e.setHoveredGroup,setGroupCollapsed:e.setGroupCollapsed,setConfirmDeleteGroup:e.setConfirmDeleteGroup,deleteGroupAnchor:e.deleteGroupAnchor,handleDeleteGroup:e.handleDeleteGroup,handleNewSession:n,copyText:OZ,handleSelectSessionFromList:t,onSessionDeleted:r,handleUnseen:e.handleUnseen,loadSessions:g})]})]})}function SZe({selectedSessionId:e,selectedSession:t,onSelectSession:n,onNewSession:r,initialSessionId:i,skipInitialProjectSelection:a,onInitialRestoreDone:o,refreshKey:s,onSessionDeleted:c,onUnseenSession:l,selectedCwd:u,onCwdChange:d,savedWorkspaces:f,onSavedWorkspacesChange:p,onOpenFile:m}){let{t:h}=z(),g=WXe({selectedSession:t,selectedSessionId:e,refreshKey:s,selectedCwdProp:u,savedWorkspaces:f,onSavedWorkspacesChange:p,onUnseenSession:l,onCwdChange:d,initialSessionId:i,skipInitialProjectSelection:a,onSelectSession:n,onInitialRestoreDone:o,onSessionDeleted:c}),{setError:_,loadSessions:v,markSeen:y,setSelectedCwd:b}=g,x=(0,I.useCallback)(async t=>{if(t.id!==e){try{if((await fetch(`/api/sessions/${encodeURIComponent(t.id)}`,{method:`HEAD`})).status===404){_(h(`sidebar.sessionDeleted`)),v(!1,!0);return}}catch{}t.cwd&&b(t.cwd),y(t.id),n(t)}},[n,h,v,y,_,b,e]),S=(0,I.useCallback)(e=>{let t=e??g.selectedCwd;if(!t)return;let n=typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;r?.(n,t)},[g.selectedCwd,r]);return(0,L.jsxs)(`div`,{"data-testid":`session-sidebar`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`,position:`relative`},children:[(0,L.jsx)(xZe,{sb:g,handleSelectSessionFromList:x,handleNewSession:S,onSessionDeleted:e=>{c?.(e),g.loadSessions(!1,!0)}}),(0,L.jsx)(DXe,{})]})}function CZe({command:e,note:t}){let{t:n}=z(),[r,i]=(0,I.useState)(!1),a=async()=>{try{await OZ(e),i(!0),setTimeout(()=>i(!1),1500)}catch{}};return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`div`,{style:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,background:`var(--bg-panel)`,border:`1px solid var(--border)`,borderRadius:6,padding:`6px 8px`},children:(0,L.jsx)(`code`,{style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontFamily:`var(--font-mono)`,fontSize:`var(--text-sm)`,color:`var(--text)`},children:e})}),(0,L.jsx)(`button`,{onClick:()=>void a(),style:G9(),children:n(r?`updates.copied`:`updates.copyCommand`)})]}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`},children:t})]})}function G9(e){return{padding:`6px 12px`,border:`1px solid var(--border)`,borderRadius:6,color:`var(--text-muted)`,cursor:e?`not-allowed`:`pointer`,fontSize:`var(--text-base)`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,gap:6,whiteSpace:`nowrap`,flexShrink:0}}function K9({title:e,subtitle:t,right:n,children:r,style:i}){return(0,L.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:10,background:`var(--bg-input)`,...i},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:16,padding:`10px 14px`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2,minWidth:0},children:[(0,L.jsx)(`span`,{style:{fontSize:`var(--text-lg)`,color:`var(--text)`,fontWeight:500},children:e}),(0,L.jsx)(`span`,{style:{fontSize:`var(--text-sm)`,color:`var(--text-dim)`,fontFamily:`var(--font-mono)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})]}),(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0},children:n})]}),r?(0,L.jsx)(`div`,{style:{borderTop:`1px solid var(--border)`,padding:`8px 14px 10px`},children:r}):null]})}var q9=new Map,J9=new Map,Y9=new Map(q9),X9=new Set;function Z9(){Y9=new Map(q9);for(let e of X9)e()}function wZe(e){return X9.add(e),()=>X9.delete(e)}function Q9(e,t){q9.set(e,t),t.status!==`running`&&J9.delete(e),Z9()}function TZe(){return(0,I.useSyncExternalStore)(wZe,()=>Y9,()=>Y9)}function EZe(e){let t=!1;for(let[n,r]of q9)r.status!==`running`&&!e.has(n)&&(q9.delete(n),t=!0);t&&Z9()}async function DZe(e,t,n,r){let i=await fetch(`/api/plugins`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`update`,source:e,scope:t,cwd:n}),signal:r}),a=await i.json();if(!i.ok||a.error)throw Error(a.error??`HTTP ${i.status}`);await xC.refresh(r),yC.load().catch(e=>console.error(`[pi-web] load home plugins:`,e))}function OZe(e,t,n){if(!n||q9.get(e)?.status===`running`)return;Q9(e,{status:`running`});let r=tA(r=>DZe(e,t,n,r),12e4);J9.set(e,r),r.promise.then(()=>Q9(e,{status:`done`}),t=>{Q9(e,{status:`error`,error:t instanceof Error?t.message:String(t)})})}var kZe=3e4;function AZe(e){let{value:t}=lT(xC),[n,r]=(0,I.useState)(null),[i,a]=(0,I.useState)(!1),[o,s]=(0,I.useState)(null),c=nA(),l=(0,I.useRef)(null),u=n??t?.enabled!==!1,d=t?.ignored??{},f=(e,t)=>t!==null&&s9(t,e)>0,p=(e,t)=>{a(!0);let n=c.start(e,kZe);l.current=n.promise,n.promise.catch(e=>{e instanceof eA||(t?.(),s(e instanceof Error?e.message:String(e)))}).finally(()=>{l.current===n.promise&&a(!1)})},m=()=>{s(null),p(async e=>{await xC.refresh(e)})},h=(e,t)=>{s(null),t?.optimisticEnabled!==void 0&&r(t.optimisticEnabled),p(async t=>{let n=await fetch(`/api/updates-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t}),r=await n.json();if(!n.ok||r.error)throw Error(r.error??`HTTP ${n.status}`);await xC.refresh(t)},()=>{t?.optimisticEnabled!==void 0&&r(null)})};return{value:t,enabled:u,ignored:d,checking:i,actionError:o,piWebUpdate:t?f(t.piWeb.current,t.piWeb.latest):!1,piWebIgnored:d[o9]===t?.piWeb.latest,toggleEnabled:e=>void h({enabled:e},{optimisticEnabled:e}),ignoreVersion:(e,t)=>void h({ignored:{[e]:t}}),updatePlugin:(t,n)=>OZe(t,n,e),refresh:m}}function jZe({cwd:e}){let{t}=z(),{value:n,enabled:r,ignored:i,checking:a,actionError:o,piWebUpdate:s,piWebIgnored:c,toggleEnabled:l,ignoreVersion:u,updatePlugin:d,refresh:f}=AZe(e),p=TZe(),m=[...p.values()].some(e=>e.status===`running`);return(0,I.useEffect)(()=>{n&&EZe(new Set(n.plugins.map(e=>e.source)))},[n]),(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12,padding:16},children:[(0,L.jsx)(PZe,{t,enabled:r,value:n,actionError:o,checking:a,onToggle:l,onRefresh:f}),(0,L.jsx)(K9,{style:{maxWidth:460},title:`pi-web`,subtitle:n?`${n.piWeb.current}${s?` → ${n.piWeb.latest}`:``}`:`…`,right:(0,L.jsx)(MZe,{value:n,enabled:r,piWebUpdate:s,piWebIgnored:c,t,onIgnore:e=>u(o9,e)}),children:n&&s&&n.piWeb.latest!==null&&(0,L.jsx)(CZe,{command:`npm i -g @rainmanhhh/pi-web@${n.piWeb.latest}`,note:t(`updates.restartNote`)})}),(0,L.jsx)(`div`,{style:{fontSize:`var(--text-lg)`,color:`var(--text)`,fontWeight:500,marginTop:4},children:t(`common.plugins`)}),!r||(n?.plugins.length??0)===0?(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`,fontSize:`var(--text-base)`},children:t(`updates.noPluginUpdates`)}):(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:n?.plugins.map(e=>(0,L.jsx)(K9,{style:{flex:`1 1 300px`,minWidth:280,maxWidth:`calc((100% - 16px) / 3)`},title:e.displayName,subtitle:e.latest?`${e.current} → ${e.latest}`:e.source,children:(0,L.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8},children:(0,L.jsx)(NZe,{pluginIgnored:i[e.source]===`*`,busy:p.get(e.source)?.status===`running`,allBusy:m,error:p.get(e.source)?.error,t,onUpdate:()=>d(e.source,e.scope),onIgnore:t=>u(e.source,t)})})},`${e.scope}:${e.source}`))})]})}function MZe({value:e,enabled:t,piWebUpdate:n,piWebIgnored:r,t:i,onIgnore:a}){return e?t?n?r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(`updates.ignored`,{version:e.piWeb.latest??``})}),(0,L.jsx)(`button`,{onClick:()=>a(null),style:G9(),children:i(`updates.unignore`)})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{style:{color:`var(--status-success)`,fontWeight:500},children:i(`updates.updateAvailable`)}),(0,L.jsx)(`button`,{onClick:()=>a(e.piWeb.latest),style:G9(),children:i(`updates.ignoreVersion`)})]}):e.piWeb.latest===null?(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`updates.unavailable`)}):(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`updates.upToDate`)}):(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`},children:i(`updates.disabled`)}):null}function NZe({pluginIgnored:e,busy:t,allBusy:n,error:r,t:i,onUpdate:a,onIgnore:o}){return e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{style:{color:`var(--text-dim)`,fontSize:`var(--text-sm)`},children:i(`updates.ignoredPlugin`)}),(0,L.jsx)(`button`,{onClick:()=>o(null),style:G9(),children:i(`updates.unignore`)})]}):(0,L.jsxs)(L.Fragment,{children:[r&&(0,L.jsx)(`span`,{title:r,style:{color:`var(--status-error)`,fontSize:`var(--text-sm)`,maxWidth:160,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),(0,L.jsxs)(`button`,{onClick:a,disabled:t,style:G9(t),children:[t&&(0,L.jsx)(Uw,{size:14,className:`animate-spin`,"aria-hidden":`true`}),i(t?`i18n.updating`:`i18n.update`)]}),(0,L.jsx)(`button`,{onClick:()=>o(`*`),disabled:n,style:G9(n),children:i(`updates.ignoreVersion`)})]})}function PZe({t:e,enabled:t,value:n,actionError:r,checking:i,onToggle:a,onRefresh:o}){let s=i||!t;return(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,L.jsxs)(`label`,{title:e(`updates.enableCheckingHint`),style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`,fontSize:`var(--text-base)`,color:`var(--text-muted)`},children:[(0,L.jsx)(`input`,{type:`checkbox`,"data-testid":`updates-enabled-toggle`,checked:t,onChange:e=>a(e.target.checked)}),(0,L.jsx)(`span`,{children:e(`updates.enableChecking`)})]}),(0,L.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:`var(--text-base)`,color:`var(--text-dim)`},children:[t?n?`${e(`updates.checkedAt`)} ${new Date(n.checkedAt).toLocaleTimeString()}`:e(`updates.checking`):e(`updates.disabled`),r?` · ${r}`:``]}),(0,L.jsxs)(`button`,{onClick:o,disabled:s,style:G9(s),children:[i&&(0,L.jsx)(Uw,{size:14,className:`animate-spin`,"aria-hidden":`true`}),e(i?`updates.checking`:`updates.check`)]})]})}var FZe=e=>window.history.replaceState(null,``,e);function IZe(e){return e?`Pi Web · ${e}`:`Pi Web`}function LZe(e,t){return e&&!t}function RZe(e,t,n){return e?t:n}function zZe(e,t){return e>0&&!t}function BZe(e,t){return!!(e&&t)}function VZe(e,t,n,r){t&&n(!1),r(t=>t===e?null:e)}function HZe(e,t,n){e&&t(),n(e=>!e)}function UZe(e,t,n){e&&!t&&n(!1)}function WZe(e,t,n){e?t(e=>!e):n(e=>!e)}function GZe(e){return e?aP(e)||e:null}function $9(e){return e?.id??null}function KZe(e,t){return e?.cwd??t}function qZe(e){return e?pq(e.filePath):`file:`}function JZe(){let[e,t]=(0,I.useState)(!1);(0,I.useEffect)(()=>{t(!0)},[]);let[n]=(0,I.useState)(()=>$ke(new URLSearchParams(window.location.search))),{isDark:r,toggleTheme:i}=vq(),{locale:a,setLocale:o,t:s,supportedLocales:c}=z(),l=uC();Zke();let{settingsValue:u,defaultThinkingLevel:d,setDefaultThinkingLevel:f,compaction:p,retry:m,defaultProjectTrust:h,setDefaultProjectTrust:g,savedWorkspaces:_,handleSavedWorkspacesChange:v,widgetGeometries:y,setWidgetGeometry:b,widgetMessages:x,addWidgetMessage:S,removeWidgetMessage:C,updateWidgetMessage:w}=Soe({isDark:r,toggleTheme:i}),[T,E]=(0,I.useState)(null),{selectedSession:D,effectiveNewSessionCwd:O,showChat:k,projectTrustCwd:A,refreshKey:j,sessionKey:M,explorerRefreshKey:N,setExplorerRefreshKey:ee,modelsRefreshKey:te,setModelsRefreshKey:P,activeCwd:F,initialCwdStatus:ne,initialCwdError:re,initialSessionRestored:ie,projectTrust:ae,projectTrustDialogOpen:oe,setProjectTrustDialogOpen:se,projectTrustBusy:ce,projectTrustError:le,setProjectTrustError:ue,extensionDialogActiveRef:de,handleSelectSession:fe,handleNewSession:pe,handleSessionCreated:me,handleAgentEnd:he,handleSessionForked:ge,handleSessionDeleted:_e,handleSessionUnseen:ve,handleCwdChange:ye,handleTrustProject:be,handleExplorerRefresh:xe,handleInitialRestoreDone:Se}=Poe({initialNavigation:n,onProjectSwitch:()=>{E(null),Ce(e=>e.filter(e=>e.kind!==`file`)),we(null),FZe(`/`)},onSessionSelected:e=>{e||(we(oq),_t(!1)),UZe(l,e,tt)},onTopPanelReset:()=>E(null)}),{setSavedTabs:Ce,setActiveSavedId:we,configTabOpen:Te,configSection:Ee,setConfigSection:De,configTabActive:Oe,updatesTabOpen:ke,updatesTabActive:Ae,openUpdatesTab:je,noticesTabOpen:Me,noticesTabActive:Ne,openNoticesTab:Pe,trajectoryTabOpen:Fe,trajectoryTabActive:Ie,openTrajectoryTab:Le,branchesTabOpen:Re,branchesTabActive:ze,openBranchesTab:Be,activeFileTab:Ve,fileTabs:He,modelConfigFocus:Ue,handleOpenFile:We,openConfigTab:Ge,handleOpenModelConfig:Ke,closeConfigTab:qe,handleCloseMainTab:Je}=Wke({onSessionSelected:()=>{_t(!1),l&&tt(!1)},onRefreshModels:()=>P(e=>e+1)}),{updatesBadge:Ye,updateItems:Xe,updatesBannerDismissed:Ze,setUpdatesBannerDismissed:Qe}=uXe({activeCwd:F,translate:s}),$e=(0,I.useCallback)(e=>{We(e,aP(e),{sourceSessionId:$9(D)})},[We,D]),[et,tt]=(0,I.useState)(!0),{sidebarResizer:nt,widgetPanelResizer:rt,mobileSidebarReady:it}=rXe({isMobile:l,sidebarOpen:et,setSidebarOpen:tt,translate:s}),at=(0,I.useRef)(null),ot=(0,I.useRef)(null),st=(0,I.useRef)(null),ct=LN(),lt=(0,I.useCallback)(()=>{ct.schedule(()=>{E(null)},150)},[ct]),ut=ct.cancel,dt=sXe({activeTopPanel:T,isMobile:l,tabBarRef:at,sidebarTopBarRef:ot,languageBtnRef:st}),ft=(0,I.useCallback)(e=>VZe(e,l,tt,E),[l]),pt=(0,I.useCallback)(()=>HZe(l,()=>E(null),tt),[l]),{widgetPanelOpen:mt,setWidgetPanelOpen:ht,widgetsTabActive:gt,setWidgetsTabActive:_t,extensionWidgets:vt,closedWidgets:yt,handleCloseWidget:bt,handleReopenWidget:xt,handleExtensionWidgetsChange:St,rightSidebarOpen:Ct,setRightSidebarOpen:wt,closedWidgetCount:Tt}=Qke({widgetGeometries:y,setWidgetGeometry:b}),Et=RZe(l,mt,Ct),Dt=(0,I.useRef)(null),Ot=(0,I.useRef)(null);(0,I.useEffect)(()=>{let e=Dt.current;if(e!==l){if(Dt.current=l,l)Ot.current={left:et,right:Ct},tt(!1),ht(!1);else if(e===!0){let e=Ot.current;e&&(tt(e.left),wt(e.right))}}},[l]);let{chatInputRef:kt,handleAtMention:At,handleAtMentions:jt,handleFileLineMention:Mt}=tXe(),Nt=n.sessionId;Uae({onNewSession:e=>pe(`kb-${Date.now()}`,e),activeCwd:F});let Pt=LZe(ie,k),Ft=tAe({translate:s,closedWidgetCount:Tt,configTabOpen:Te,onConfigTabActivate:(0,I.useCallback)(()=>{window.dispatchEvent(new CustomEvent(rq))},[]),updatesTabOpen:ke,noticesTabOpen:Me,trajectoryTabOpen:Fe,branchesTabOpen:Re,updatesBadge:Ye,fileTabs:He}),It=GZe(F);uT(()=>{l&&Te&&qe()},[l]);let Lt=IZe(It),Rt=$9(D),zt=KZe(D,O);(0,I.useEffect)(()=>{xq(Lt)},[Lt]),(0,I.useEffect)(()=>{let e=()=>{xq(Lt)};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Lt]);let Bt=fC(),Vt=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Dje,{topBarRef:ot,notifyPermission:Bt,isDark:r,toggleTheme:i,updatesBadge:Ye,openUpdatesTab:je,openConfigTab:Ge,openNoticesTab:Pe,isMobile:l,setSidebarOpen:tt,activeTopPanel:T,setActiveTopPanel:E,cancelCloseTopPanel:ut,scheduleCloseTopPanel:lt,languageBtnRef:st}),zZe(Ye,Ze)&&(0,L.jsx)(eXe,{items:Xe,openUpdatesTab:je,onDismiss:()=>Qe(!0)}),(0,L.jsx)(SZe,{selectedSessionId:Rt,selectedSession:D,onSelectSession:fe,onNewSession:pe,initialSessionId:Nt,skipInitialProjectSelection:n.requestedCwd!==null,onInitialRestoreDone:Se,refreshKey:j,onSessionDeleted:_e,onUnseenSession:ve,selectedCwd:zt,onCwdChange:ye,savedWorkspaces:_,onSavedWorkspacesChange:v,onOpenFile:We})]});if(!e)return(0,L.jsx)(fXe,{});let Ht=(0,L.jsx)(wje,{sidebarOpen:et,onToggle:pt}),Ut=ae?.requiresTrust===!0?ae.trusted===!0?`trusted`:`untrusted`:`none`,Wt=()=>{ue(null),se(!0)},Gt=(0,L.jsx)(dXe,{panelOpen:Et,highlighted:mt,onToggle:()=>{WZe(l,ht,wt)}});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Foe,{value:u,children:(0,L.jsx)(qke,{value:{activeTopPanel:T,toggleTopPanel:ft,closeTopPanel:()=>E(null)},children:(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(Nse,{delayDuration:0,children:[(0,L.jsx)(yXe,{}),(0,L.jsxs)(Rae,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,width:`100%`,height:`var(--app-viewport-height, 100dvh)`,paddingLeft:`env(safe-area-inset-left)`,paddingRight:`env(safe-area-inset-right)`,overflow:`hidden`,background:`var(--bg)`},children:[(0,L.jsx)(Cje,{isMobile:l,sidebarResizer:nt,sidebarOpen:et,mobileSidebarReady:it,setSidebarOpen:tt,sidebarContent:Vt,translate:s}),(0,L.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,overflow:`hidden`,minWidth:0},children:[(0,L.jsx)(Oje,{activeTopPanel:T,setActiveTopPanel:E,topPanelPos:dt,cancelCloseTopPanel:ut,scheduleCloseTopPanel:lt,translate:s,locale:a,setLocale:o,supportedLocales:c}),(0,L.jsxs)(YK,{tabs:Ft,activeTabId:nAe({configTabActive:Oe,updatesTabActive:Ae,noticesTabActive:Ne,widgetsTabActive:gt,trajectoryTabActive:Ie,branchesTabActive:ze,activeFileTab:Ve}),leftExtra:Ht,rightExtra:Gt,onSelectTab:e=>{let t=rAe(e);_t(t.widgetsTabActive),we(t.activeSavedId)},onCloseTab:Je,tabBarRef:at,isMobile:l,overlay:(0,L.jsx)(eAe,{initialCwdStatus:ne,requestedCwd:n.requestedCwd,initialCwdError:re,showPlaceholder:Pt,activeCwd:F,translate:s}),children:[(0,L.jsx)(qK,{id:sq,testId:`config-tab-pane`,children:(0,L.jsx)(Kze,{configSection:Ee,setConfigSection:De,projectTrustCwd:A,sessionId:Rt,closeConfigTab:qe,handleOpenFile:We,sidebarResizer:nt,widgetPanelResizer:rt,modelConfigFocus:Ue,defaultThinkingLevel:d,setDefaultThinkingLevel:f,compaction:p,retry:m,defaultProjectTrust:h,setDefaultProjectTrust:g})}),(0,L.jsx)(qK,{id:lq,testId:`updates-tab-pane`,children:(0,L.jsx)(jZe,{cwd:F})}),(0,L.jsx)(qK,{id:fq,testId:`notices-tab-pane`,children:(0,L.jsx)(IYe,{currentSessionId:Rt})}),(0,L.jsx)(qK,{id:uq,keepAlive:!0,testId:`trajectory-tab-pane`,children:(0,L.jsx)(XYe,{sessionId:Rt})}),(0,L.jsx)(qK,{id:dq,keepAlive:!0,testId:`branches-tab-pane`,children:(0,L.jsx)(Hje,{sessionId:Rt})}),(0,L.jsx)(qK,{id:qZe(Ve),testId:`file-tab-pane`,children:(0,L.jsx)(FYe,{activeFileTab:Ve,activeCwd:F,explorerRefreshKey:N,setExplorerRefreshKey:ee,handleFileLineMention:Mt,handleOpenFile:We})}),(0,L.jsx)(qK,{id:oq,keepAlive:!0,testId:`chat-tab-pane`,scroll:`hidden`,activeWhen:k,children:(0,L.jsx)(Gze,{sessionKey:M,selectedSession:D,effectiveNewSessionCwd:O,handleAgentEnd:he,handleSessionCreated:me,handleSessionForked:ge,modelsRefreshKey:te,handleOpenModelConfig:Ke,chatInputRef:kt,handleOpenLinkedFile:$e,onOpenTrajectory:Le,onOpenBranches:Be,activeCwdName:It,trustBadge:Ut,onTrustClick:Wt,closedWidgets:yt,handleCloseWidget:bt,handleExtensionWidgetsChange:St,extensionDialogActiveRef:de})}),(0,L.jsx)(qK,{id:cq,keepAlive:!0,testId:`widgets-tab-pane`,zIndex:1,activeWhen:k,children:(0,L.jsx)($Ye,{widgetGeometries:y,widgetMessages:x,addWidgetMessage:S,removeWidgetMessage:C,updateWidgetMessage:w,extensionWidgets:vt,closedWidgets:yt,handleReopenWidget:xt})})]})]}),(0,L.jsx)(Sje,{isMobile:l,rightSidebarOpen:Ct,rightSidebarOpenEffective:Et,widgetPanelResizer:rt,translate:s,cwd:zt,sessionId:Rt,handleOpenFile:We,explorerRefreshKey:N,handleExplorerRefresh:xe,handleAtMention:At,handleAtMentions:jt,openConfigTab:Ge,onMobileClose:()=>ht(!1)})]}),BZe(oe,A)&&A&&(0,L.jsx)(SXe,{cwd:A,busy:ce,error:le,onCancel:()=>{ce||se(!1)},onConfirm:()=>void be()})]})]})})})}),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(pXe,{}),(0,L.jsx)(xXe,{})]})]})}var YZe=class extends I.Component{constructor(...e){super(...e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){BJ(e,`render error`)}render(){return this.state.hasError?(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,height:`100vh`,color:`var(--text)`,fontSize:`var(--text-base)`},children:[(0,L.jsx)(`span`,{children:`⚠️`}),(0,L.jsx)(`span`,{children:`Something went wrong while rendering.`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{this.setState({hasError:!1})},style:{border:`1px solid var(--border)`,color:`var(--text)`,borderRadius:6,padding:`4px 14px`,cursor:`pointer`},children:`Try again`})]}):this.props.children}};function XZe(){return(0,I.useEffect)(()=>{if(!(`serviceWorker`in navigator))return;let e=()=>{navigator.serviceWorker.register(`/sw.js?v=0.32.43`,{scope:`/`,updateViaCache:`none`}).catch(e=>{console.error(`Failed to register the Pi Web service worker:`,e)})};if(document.readyState===`complete`){e();return}return window.addEventListener(`load`,e,{once:!0}),()=>window.removeEventListener(`load`,e)},[]),null}var ZZe=`piE2eFixtureDir`;function QZe(){return typeof window>`u`?null:new URL(window.location.href).searchParams.get(`piE2eFixtureDir`)}function $Ze(){if(typeof document>`u`)return;let e=QZe();e&&(document.cookie=`${ZZe}=${encodeURIComponent(e)}; path=/; SameSite=Lax`)}async function eQe(){$Ze(),Dae(!0),Oae();let e=PS(`boot`),t=null;try{let n=await _C.load();e(`preferences catalog loaded`,`locale=${n.firstPaint?.locale}`);let r=n.firstPaint?.locale;(r===`en`||r===`zh-CN`)&&(t=r,document.documentElement.lang=r===`zh-CN`?`zh-CN`:`en`);let i=n.theme;if(i===`dark`?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`),i)try{localStorage.setItem(`pi-theme`,i)}catch{}}catch{}e(`root render`),window.addEventListener(`unhandledrejection`,e=>{BJ(e.reason,`unhandled promise rejection`)}),window.addEventListener(`error`,e=>{let t=(e.error instanceof Error?e.error.message:``)||e.message||``;t.includes(`ResizeObserver loop`)||t.startsWith(`Script error`)||BJ(e.error??e.message,`uncaught error`)}),(0,vre.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(I.StrictMode,{children:(0,L.jsx)(YZe,{children:(0,L.jsxs)(mae,{initialLocale:t,children:[(0,L.jsx)(JZe,{}),(0,L.jsx)(XZe,{})]})})}))}eQe();export{R as a,z as i,YH as n,f as o,CL as r,i as s,hYe as t};