@computesdk/loops 0.1.16 → 0.1.17
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.
- package/dist/assets/{abnfDiagram-VCTEODGH-CphjrZ91.js → abnfDiagram-VCTEODGH-2gclQRGh.js} +1 -1
- package/dist/assets/{arc-BzIwyCJX.js → arc-DtReEw8T.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-D7OVuLhk.js → architectureDiagram-5GKGNRK7-C1fv9eXI.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-CLbKN_jM.js → blockDiagram-I7D4REHJ-DFuNcOLt.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-CPPOW6JF.js → c4Diagram-7LVT6UL2-DQz_MRya.js} +1 -1
- package/dist/assets/channel-pD_8KIrd.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-VVCqOk0J.js → chunk-2Q5K7J3B-CQgaTjJd.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-BiFpWfsW.js → chunk-5VM5RSS4-gZG_-PeP.js} +1 -1
- package/dist/assets/{chunk-F27PBJKO-DI5e7nE3.js → chunk-F27PBJKO-1Cb9D6pU.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-Bqz_nn1B.js → chunk-IMKFNOWR-Ct_xfX5B.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BpgjeST0.js → chunk-JWPE2WC7-Dam6LS4i.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-CYmh6gqF.js → chunk-POPQ4Y6H-udnf2ytC.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-B7EyuU7i.js → chunk-SVP7TREG-tubXGfrE.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-DyJGdPA1.js → chunk-TICWLB2K-BVuphxBq.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CH9UdxhU.js → chunk-XXDRQBXY-CaQBCK8o.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-Bpzh2rc-.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-Bpzh2rc-.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-B6zSSHu8.js → cose-bilkent-JH36ORCC-D9k5qepP.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-Bckjyb2G.js → cynefin-OW5HDTMX-lvV6C7_5.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-C7uT-ctR.js → cynefinDiagram-5FMLGOSQ-CyI-Lc3p.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-BVPB8dh2.js → dagre-GXQ25YYZ-kpgqGmru.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-BbE5qqP5.js → diagram-S7CK7UJ4-BAM2BpKM.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-FYCSPhT1.js → diagram-UQ7AKVKN-7q-3qd8K.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-CAwgXpg2.js → diagram-VSXAHHWV-DyDN2Dy5.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-B_yjQRRp.js → diagram-VX7I27RA-Crx3iBbP.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-DAb7Xasg.js → diagram-Z3DM3KII-BbzQVgBH.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-Del2ZzP3.js → ebnfDiagram-PWID7BFC-C8atccSR.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-e3FQY9Rr.js → erDiagram-RLTQ6QDP-DPPCOsm4.js} +1 -1
- package/dist/assets/{flowDiagram-HODETNUW-B9GitqYh.js → flowDiagram-HODETNUW-C8Pk4nlG.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-DwrnCu8t.js → ganttDiagram-EL5Y4UJY-DbMFVwCm.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-C8koRqxv.js → gitGraphDiagram-WWUBYQGX-DW3KfzJc.js} +1 -1
- package/dist/assets/{highlighted-body-JLMTFACH-BmVap5zb.js → highlighted-body-JLMTFACH-k1IRl1ju.js} +1 -1
- package/dist/assets/{index-CIi27S0p.js → index-ixORUVkg.js} +6 -6
- package/dist/assets/{infoDiagram-27XIBGKW-BWCh1S5G.js → infoDiagram-27XIBGKW-skA1iBH3.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-BuU7xP78.js → ishikawaDiagram-5VMMS53U-DMctgGQX.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-L9IMZVhC.js → journeyDiagram-3NMN7TZE-q7_9pZeg.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-B4Vf9yAl.js → kanban-definition-UXKFOSKX-B_PA8OOl.js} +1 -1
- package/dist/assets/{layout-CxBtYmRd.js → layout-Dhv0cpCY.js} +1 -1
- package/dist/assets/{linear-Cs8_gAxW.js → linear-Ab2cV3G4.js} +1 -1
- package/dist/assets/{mindmap-definition-YA3MSWOX-COA02VQG.js → mindmap-definition-YA3MSWOX-DvvsGhiU.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-Dx1GejmQ.js → pegDiagram-XKGWAZYB-B_yksjYt.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-Bl2haRSH.js → pieDiagram-E7YTZNPT-BMs8-MyD.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-DhaIYSM8.js → quadrantDiagram-AXDQQJYC-l4z3n_F0.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-GmTKop1N.js → railroadDiagram-O6MQD6OU-Dc_OE3KY.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-CGf_8iny.js → requirementDiagram-BXWQKSXE-Cd7jowGB.js} +1 -1
- package/dist/assets/{sankeyDiagram-P5KCCOFB-CcjRfS7v.js → sankeyDiagram-P5KCCOFB-BQ7SGhVJ.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-CbhdwHX8.js → sequenceDiagram-WJ2MYXX4-CVi8WWvl.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-B3t4qjgE.js → sizeCapture-INFHLROL-DoCKzHEB.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-dM87lznP.js → stateDiagram-D77RDMKH-BLh6fljO.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-BQGzXwru.js +1 -0
- package/dist/assets/{swimlanes-42K2YHIH-D0kSxg5-.js → swimlanes-42K2YHIH-Uc_hTPY0.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-B8EmeXGy.js +8 -0
- package/dist/assets/{timeline-definition-24CTP7MA-rKssvoZk.js → timeline-definition-24CTP7MA-DtJY8yTa.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-Brg4DKGj.js → vennDiagram-4TSXK5OY-CFSuq2L2.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-DHcxw4ey.js → wardleyDiagram-VM6X3IG4-CKvvJBcc.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-CW42Yw1K.js → xychartDiagram-S5SC5T6Z-DddbcYvo.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-BZ2munWB.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-D2T063ZF.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-D2T063ZF.js +0 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-6W0qW5cq.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-DkTwk5rQ.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-D_SYSyRt.js","assets/html-BlS82ilI.js","assets/javascript-wDzz0qaB.js","assets/css-Z72CF80r.js","assets/angular-ts-DGq0tZX5.js","assets/scss-Cw6XMfVs.js","assets/apl-ChzvTHjC.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-DTjqU0_L.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-k33SngOZ.js","assets/html-derivative-DZhk3IEZ.js","assets/sql-DkvoVjww.js","assets/bsl-DlhNcFeZ.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/chapel-DTp_pixX.js","assets/c-BIGW1oBm.js","assets/cobol-BBKr1ja6.js","assets/coffee-Ch7k5sss.js","assets/cpp-BMRokrvK.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/crystal-LUwhHfY5.js","assets/shellscript-Yzrsuije.js","assets/edge-CJaD-t2L.js","assets/elixir-DkJLSxtU.js","assets/elm-DbKCFpqz.js","assets/erb-CSMaCouu.js","assets/ruby-C8rp0wew.js","assets/haml-GN_XdMnF.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-TyuKm33G.js","assets/gdshader-DkwncUOv.js","assets/gdscript-DqcFQ5yU.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-Drrc9bTt.js","assets/glimmer-ts-zeybXsvi.js","assets/hack-Ck6-gGSS.js","assets/handlebars-DPT5vKgj.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-2-FPmUDs.js","assets/haxe-CfZj7gIn.js","assets/jinja-DFQZVq3b.js","assets/jison-wvAkD_A8.js","assets/julia-Cu79e8SL.js","assets/r-Cf5RLm7j.js","assets/just-CMxyWJJc.js","assets/perl-5klg-GXX.js","assets/latex-DJVikpzR.js","assets/tex-D96PA37w.js","assets/liquid-B-duXHXw.js","assets/marko-BYgDmDgU.js","assets/less-B1dDrJ26.js","assets/mdc-DF4WjDMn.js","assets/nextflow-BCxp2Aob.js","assets/nextflow-groovy-CedDknKX.js","assets/nginx-BpAMiNFr.js","assets/nim-nV83PyhX.js","assets/org-6a7ccXN_.js","assets/ini-BEwlwnbL.js","assets/make-CHLpvVh8.js","assets/php-DoruYMF0.js","assets/vb-Cu-pLBUe.js","assets/clojure-P80f7IUj.js","assets/objective-c-DXmwc3jG.js","assets/docker-BcOcwvcX.js","assets/go-C27-OAKa.js","assets/groovy-gcz8RCvz.js","assets/raku-DXvB9xmW.js","assets/rust-DPvrY3IQ.js","assets/scala-CqE71os6.js","assets/csharp-B_TYUkTI.js","assets/dart-CtKP3W-j.js","assets/ocaml-C0hk2d4L.js","assets/zig-VOosw3JB.js","assets/xsl-CtQFsRM5.js","assets/pug-BtYPkAgq.js","assets/qml-3beO22l8.js","assets/razor-CyjPwjZj.js","assets/rst-CVOjT0e7.js","assets/cmake-D1j8_8rp.js","assets/sas-BGn39htG.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-zscZBeg6.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-DACIj5bg.js","assets/surrealql-Cjom0U5J.js","assets/svelte-D84K1R2Q.js","assets/templ-Vpw5XpSW.js","assets/ts-tags-Ls60c9xG.js","assets/twig-D9-LOF2p.js","assets/typst-DamkJZ1Q.js","assets/bat-CickPsom.js","assets/bibtex-CHM0blh-.js","assets/jsonc-Des-eS-w.js","assets/log-2UxHyX5q.js","assets/powershell-Dd0kTxKP.js","assets/swift-C2oV4EkX.js","assets/verilog-nZwndyjY.js","assets/system-verilog-0hqHdDBg.js","assets/vue-DSqPwMUe.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-C0RcJ6UU.js","assets/stylus-BEDo0Tqx.js","assets/dagre-GXQ25YYZ-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-D_SYSyRt.js","assets/html-BlS82ilI.js","assets/javascript-wDzz0qaB.js","assets/css-Z72CF80r.js","assets/angular-ts-DGq0tZX5.js","assets/scss-Cw6XMfVs.js","assets/apl-ChzvTHjC.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-DTjqU0_L.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-k33SngOZ.js","assets/html-derivative-DZhk3IEZ.js","assets/sql-DkvoVjww.js","assets/bsl-DlhNcFeZ.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/chapel-DTp_pixX.js","assets/c-BIGW1oBm.js","assets/cobol-BBKr1ja6.js","assets/coffee-Ch7k5sss.js","assets/cpp-BMRokrvK.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/crystal-LUwhHfY5.js","assets/shellscript-Yzrsuije.js","assets/edge-CJaD-t2L.js","assets/elixir-DkJLSxtU.js","assets/elm-DbKCFpqz.js","assets/erb-CSMaCouu.js","assets/ruby-C8rp0wew.js","assets/haml-GN_XdMnF.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-TyuKm33G.js","assets/gdshader-DkwncUOv.js","assets/gdscript-DqcFQ5yU.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-Drrc9bTt.js","assets/glimmer-ts-zeybXsvi.js","assets/hack-Ck6-gGSS.js","assets/handlebars-DPT5vKgj.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-2-FPmUDs.js","assets/haxe-CfZj7gIn.js","assets/jinja-DFQZVq3b.js","assets/jison-wvAkD_A8.js","assets/julia-Cu79e8SL.js","assets/r-Cf5RLm7j.js","assets/just-CMxyWJJc.js","assets/perl-5klg-GXX.js","assets/latex-DJVikpzR.js","assets/tex-D96PA37w.js","assets/liquid-B-duXHXw.js","assets/marko-BYgDmDgU.js","assets/less-B1dDrJ26.js","assets/mdc-DF4WjDMn.js","assets/nextflow-BCxp2Aob.js","assets/nextflow-groovy-CedDknKX.js","assets/nginx-BpAMiNFr.js","assets/nim-nV83PyhX.js","assets/org-6a7ccXN_.js","assets/ini-BEwlwnbL.js","assets/make-CHLpvVh8.js","assets/php-DoruYMF0.js","assets/vb-Cu-pLBUe.js","assets/clojure-P80f7IUj.js","assets/objective-c-DXmwc3jG.js","assets/docker-BcOcwvcX.js","assets/go-C27-OAKa.js","assets/groovy-gcz8RCvz.js","assets/raku-DXvB9xmW.js","assets/rust-DPvrY3IQ.js","assets/scala-CqE71os6.js","assets/csharp-B_TYUkTI.js","assets/dart-CtKP3W-j.js","assets/ocaml-C0hk2d4L.js","assets/zig-VOosw3JB.js","assets/xsl-CtQFsRM5.js","assets/pug-BtYPkAgq.js","assets/qml-3beO22l8.js","assets/razor-CyjPwjZj.js","assets/rst-CVOjT0e7.js","assets/cmake-D1j8_8rp.js","assets/sas-BGn39htG.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-zscZBeg6.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-DACIj5bg.js","assets/surrealql-Cjom0U5J.js","assets/svelte-D84K1R2Q.js","assets/templ-Vpw5XpSW.js","assets/ts-tags-Ls60c9xG.js","assets/twig-D9-LOF2p.js","assets/typst-DamkJZ1Q.js","assets/bat-CickPsom.js","assets/bibtex-CHM0blh-.js","assets/jsonc-Des-eS-w.js","assets/log-2UxHyX5q.js","assets/powershell-Dd0kTxKP.js","assets/swift-C2oV4EkX.js","assets/verilog-nZwndyjY.js","assets/system-verilog-0hqHdDBg.js","assets/vue-DSqPwMUe.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-C0RcJ6UU.js","assets/stylus-BEDo0Tqx.js","assets/dagre-GXQ25YYZ-kpgqGmru.js","assets/layout-Dhv0cpCY.js","assets/cose-bilkent-JH36ORCC-D9k5qepP.js","assets/cytoscape.esm-BDkkwuE4.js","assets/c4Diagram-7LVT6UL2-DQz_MRya.js","assets/chunk-F27PBJKO-1Cb9D6pU.js","assets/flowDiagram-HODETNUW-C8Pk4nlG.js","assets/chunk-5VM5RSS4-gZG_-PeP.js","assets/chunk-XXDRQBXY-CaQBCK8o.js","assets/chunk-POPQ4Y6H-udnf2ytC.js","assets/channel-pD_8KIrd.js","assets/swimlanesDiagram-VR7AAH4N-B8EmeXGy.js","assets/erDiagram-RLTQ6QDP-DPPCOsm4.js","assets/gitGraphDiagram-WWUBYQGX-DW3KfzJc.js","assets/chunk-2Q5K7J3B-CQgaTjJd.js","assets/chunk-JWPE2WC7-Dam6LS4i.js","assets/cynefin-OW5HDTMX-lvV6C7_5.js","assets/ganttDiagram-EL5Y4UJY-DbMFVwCm.js","assets/linear-Ab2cV3G4.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-27XIBGKW-skA1iBH3.js","assets/pieDiagram-E7YTZNPT-BMs8-MyD.js","assets/arc-DtReEw8T.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AXDQQJYC-l4z3n_F0.js","assets/xychartDiagram-S5SC5T6Z-DddbcYvo.js","assets/requirementDiagram-BXWQKSXE-Cd7jowGB.js","assets/sequenceDiagram-WJ2MYXX4-CVi8WWvl.js","assets/classDiagram-ZZMXUADV-Bpzh2rc-.js","assets/chunk-TICWLB2K-BVuphxBq.js","assets/classDiagram-v2-VYDZK3BY-Bpzh2rc-.js","assets/stateDiagram-D77RDMKH-BLh6fljO.js","assets/chunk-IMKFNOWR-Ct_xfX5B.js","assets/stateDiagram-v2-MP3YSRHH-BQGzXwru.js","assets/journeyDiagram-3NMN7TZE-q7_9pZeg.js","assets/timeline-definition-24CTP7MA-DtJY8yTa.js","assets/mindmap-definition-YA3MSWOX-DvvsGhiU.js","assets/kanban-definition-UXKFOSKX-B_PA8OOl.js","assets/sankeyDiagram-P5KCCOFB-BQ7SGhVJ.js","assets/diagram-Z3DM3KII-BbzQVgBH.js","assets/diagram-UQ7AKVKN-7q-3qd8K.js","assets/blockDiagram-I7D4REHJ-DFuNcOLt.js","assets/diagram-S7CK7UJ4-BAM2BpKM.js","assets/architectureDiagram-5GKGNRK7-C1fv9eXI.js","assets/diagram-VSXAHHWV-DyDN2Dy5.js","assets/diagram-VX7I27RA-Crx3iBbP.js","assets/wardleyDiagram-VM6X3IG4-CKvvJBcc.js","assets/cynefinDiagram-5FMLGOSQ-CyI-Lc3p.js","assets/railroadDiagram-O6MQD6OU-Dc_OE3KY.js","assets/chunk-SVP7TREG-tubXGfrE.js","assets/ebnfDiagram-PWID7BFC-C8atccSR.js","assets/abnfDiagram-VCTEODGH-2gclQRGh.js","assets/pegDiagram-XKGWAZYB-B_yksjYt.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();function V2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var A4={exports:{}},yp={};var F9;function nte(){if(F9)return yp;F9=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,i,a){var s=null;if(a!==void 0&&(s=""+a),i.key!==void 0&&(s=""+i.key),"key"in i){a={};for(var l in i)l!=="key"&&(a[l]=i[l])}else a=i;return i=a.ref,{$$typeof:e,type:n,key:s,ref:i!==void 0?i:null,props:a}}return yp.Fragment=t,yp.jsx=r,yp.jsxs=r,yp}var $9;function ite(){return $9||($9=1,A4.exports=nte()),A4.exports}var C=ite(),L4={exports:{}},Gt={};var z9;function ate(){if(z9)return Gt;z9=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),m=Symbol.for("react.view_transition"),g=Symbol.iterator;function b(ne){return ne===null||typeof ne!="object"?null:(ne=g&&ne[g]||ne["@@iterator"],typeof ne=="function"?ne:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,w={};function _(ne,me,he){this.props=ne,this.context=me,this.refs=w,this.updater=he||x}_.prototype.isReactComponent={},_.prototype.setState=function(ne,me){if(typeof ne!="object"&&typeof ne!="function"&&ne!=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,ne,me,"setState")},_.prototype.forceUpdate=function(ne){this.updater.enqueueForceUpdate(this,ne,"forceUpdate")};function S(){}S.prototype=_.prototype;function N(ne,me,he){this.props=ne,this.context=me,this.refs=w,this.updater=he||x}var B=N.prototype=new S;B.constructor=N,k(B,_.prototype),B.isPureReactComponent=!0;var I=Array.isArray;function P(){}var O={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function j(ne,me,he){var Oe=he.ref;return{$$typeof:e,type:ne,key:me,ref:Oe!==void 0?Oe:null,props:he}}function Z(ne,me){return j(ne.type,me,ne.props)}function se(ne){return typeof ne=="object"&&ne!==null&&ne.$$typeof===e}function ue(ne){var me={"=":"=0",":":"=2"};return"$"+ne.replace(/[=:]/g,function(he){return me[he]})}var K=/\/+/g;function W(ne,me){return typeof ne=="object"&&ne!==null&&ne.key!=null?ue(""+ne.key):me.toString(36)}function z(ne){switch(ne.status){case"fulfilled":return ne.value;case"rejected":throw ne.reason;default:switch(typeof ne.status=="string"?ne.then(P,P):(ne.status="pending",ne.then(function(me){ne.status==="pending"&&(ne.status="fulfilled",ne.value=me)},function(me){ne.status==="pending"&&(ne.status="rejected",ne.reason=me)})),ne.status){case"fulfilled":return ne.value;case"rejected":throw ne.reason}}throw ne}function te(ne,me,he,Oe,tt){var Ne=typeof ne;(Ne==="undefined"||Ne==="boolean")&&(ne=null);var Je=!1;if(ne===null)Je=!0;else switch(Ne){case"bigint":case"string":case"number":Je=!0;break;case"object":switch(ne.$$typeof){case e:case t:Je=!0;break;case d:return Je=ne._init,te(Je(ne._payload),me,he,Oe,tt)}}if(Je)return tt=tt(ne),Je=Oe===""?"."+W(ne,0):Oe,I(tt)?(he="",Je!=null&&(he=Je.replace(K,"$&/")+"/"),te(tt,me,he,"",function(qt){return qt})):tt!=null&&(se(tt)&&(tt=Z(tt,he+(tt.key==null||ne&&ne.key===tt.key?"":(""+tt.key).replace(K,"$&/")+"/")+Je)),me.push(tt)),1;Je=0;var qe=Oe===""?".":Oe+":";if(I(ne))for(var rt=0;rt<ne.length;rt++)Oe=ne[rt],Ne=qe+W(Oe,rt),Je+=te(Oe,me,he,Ne,tt);else if(rt=b(ne),typeof rt=="function")for(ne=rt.call(ne),rt=0;!(Oe=ne.next()).done;)Oe=Oe.value,Ne=qe+W(Oe,rt++),Je+=te(Oe,me,he,Ne,tt);else if(Ne==="object"){if(typeof ne.then=="function")return te(z(ne),me,he,Oe,tt);throw me=String(ne),Error("Objects are not valid as a React child (found: "+(me==="[object Object]"?"object with keys {"+Object.keys(ne).join(", ")+"}":me)+"). If you meant to render a collection of children, use an array instead.")}return Je}function q(ne,me,he){if(ne==null)return ne;var Oe=[],tt=0;return te(ne,Oe,"","",function(Ne){return me.call(he,Ne,tt++)}),Oe}function pe(ne){if(ne._status===-1){var me=ne._result,he=me();he.then(function(Oe){(ne._status===0||ne._status===-1)&&(ne._status=1,ne._result=Oe,he.status===void 0&&(he.status="fulfilled",he.value=Oe))},function(Oe){(ne._status===0||ne._status===-1)&&(ne._status=2,ne._result=Oe,he.status===void 0&&(he.status="rejected",he.reason=Oe))}),ne._status===-1&&(ne._status=0,ne._result=he)}if(ne._status===1)return ne._result.default;throw ne._result}var F=typeof reportError=="function"?reportError:function(ne){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var me=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof ne=="object"&&ne!==null&&typeof ne.message=="string"?String(ne.message):String(ne),error:ne});if(!window.dispatchEvent(me))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",ne);return}console.error(ne)};function Ee(ne){var me=O.T,he={};he.types=me!==null?me.types:null,O.T=he;try{var Oe=ne(),tt=O.S;tt!==null&&tt(he,Oe),typeof Oe=="object"&&Oe!==null&&typeof Oe.then=="function"&&Oe.then(P,F)}catch(Ne){F(Ne)}finally{me!==null&&he.types!==null&&(me.types=he.types),O.T=me}}function $e(ne){var me=O.T;if(me!==null){var he=me.types;he===null?me.types=[ne]:he.indexOf(ne)===-1&&he.push(ne)}else Ee($e.bind(null,ne))}var ee={map:q,forEach:function(ne,me,he){q(ne,function(){me.apply(this,arguments)},he)},count:function(ne){var me=0;return q(ne,function(){me++}),me},toArray:function(ne){return q(ne,function(me){return me})||[]},only:function(ne){if(!se(ne))throw Error("React.Children.only expected to receive a single React element child.");return ne}};return Gt.Activity=f,Gt.Children=ee,Gt.Component=_,Gt.Fragment=r,Gt.Profiler=i,Gt.PureComponent=N,Gt.StrictMode=n,Gt.Suspense=c,Gt.ViewTransition=m,Gt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Gt.__COMPILER_RUNTIME={__proto__:null,c:function(ne){return O.H.useMemoCache(ne)}},Gt.addTransitionType=$e,Gt.cache=function(ne){return function(){return ne.apply(null,arguments)}},Gt.cacheSignal=function(){return null},Gt.cloneElement=function(ne,me,he){if(ne==null)throw Error("The argument must be a React element, but you passed "+ne+".");var Oe=k({},ne.props),tt=ne.key;if(me!=null)for(Ne in me.key!==void 0&&(tt=""+me.key),me)!X.call(me,Ne)||Ne==="key"||Ne==="__self"||Ne==="__source"||Ne==="ref"&&me.ref===void 0||(Oe[Ne]=me[Ne]);var Ne=arguments.length-2;if(Ne===1)Oe.children=he;else if(1<Ne){for(var Je=Array(Ne),qe=0;qe<Ne;qe++)Je[qe]=arguments[qe+2];Oe.children=Je}return j(ne.type,tt,Oe)},Gt.createContext=function(ne){return ne={$$typeof:s,_currentValue:ne,_currentValue2:ne,_threadCount:0,Provider:null,Consumer:null},ne.Provider=ne,ne.Consumer={$$typeof:a,_context:ne},ne},Gt.createElement=function(ne,me,he){var Oe,tt={},Ne=null;if(me!=null)for(Oe in me.key!==void 0&&(Ne=""+me.key),me)X.call(me,Oe)&&Oe!=="key"&&Oe!=="__self"&&Oe!=="__source"&&(tt[Oe]=me[Oe]);var Je=arguments.length-2;if(Je===1)tt.children=he;else if(1<Je){for(var qe=Array(Je),rt=0;rt<Je;rt++)qe[rt]=arguments[rt+2];tt.children=qe}if(ne&&ne.defaultProps)for(Oe in Je=ne.defaultProps,Je)tt[Oe]===void 0&&(tt[Oe]=Je[Oe]);return j(ne,Ne,tt)},Gt.createRef=function(){return{current:null}},Gt.forwardRef=function(ne){return{$$typeof:l,render:ne}},Gt.isValidElement=se,Gt.lazy=function(ne){return{$$typeof:d,_payload:{_status:-1,_result:ne},_init:pe}},Gt.memo=function(ne,me){return{$$typeof:h,type:ne,compare:me===void 0?null:me}},Gt.startTransition=Ee,Gt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Gt.use=function(ne){return O.H.use(ne)},Gt.useActionState=function(ne,me,he){return O.H.useActionState(ne,me,he)},Gt.useCallback=function(ne,me){return O.H.useCallback(ne,me)},Gt.useContext=function(ne){return O.H.useContext(ne)},Gt.useDebugValue=function(){},Gt.useDeferredValue=function(ne,me){return O.H.useDeferredValue(ne,me)},Gt.useEffect=function(ne,me){return O.H.useEffect(ne,me)},Gt.useEffectEvent=function(ne){return O.H.useEffectEvent(ne)},Gt.useId=function(){return O.H.useId()},Gt.useImperativeHandle=function(ne,me,he){return O.H.useImperativeHandle(ne,me,he)},Gt.useInsertionEffect=function(ne,me){return O.H.useInsertionEffect(ne,me)},Gt.useLayoutEffect=function(ne,me){return O.H.useLayoutEffect(ne,me)},Gt.useMemo=function(ne,me){return O.H.useMemo(ne,me)},Gt.useOptimistic=function(ne,me){return O.H.useOptimistic(ne,me)},Gt.useReducer=function(ne,me,he){return O.H.useReducer(ne,me,he)},Gt.useRef=function(ne){return O.H.useRef(ne)},Gt.useState=function(ne){return O.H.useState(ne)},Gt.useSyncExternalStore=function(ne,me,he){return O.H.useSyncExternalStore(ne,me,he)},Gt.useTransition=function(){return O.H.useTransition()},Gt.version="19.3.1",Gt}var j9;function Qw(){return j9||(j9=1,L4.exports=ate()),L4.exports}var $=Qw(),N4={exports:{}},bp={},M4={exports:{}},B4={};var H9;function ste(){return H9||(H9=1,(function(e){function t(z,te){var q=z.length;z.push(te);e:for(;0<q;){var pe=q-1>>>1,F=z[pe];if(0<i(F,te))z[pe]=te,z[q]=F,q=pe;else break e}}function r(z){return z.length===0?null:z[0]}function n(z){if(z.length===0)return null;var te=z[0],q=z.pop();if(q!==te){z[0]=q;e:for(var pe=0,F=z.length,Ee=F>>>1;pe<Ee;){var $e=2*(pe+1)-1,ee=z[$e],ne=$e+1,me=z[ne];if(0>i(ee,q))ne<F&&0>i(me,ee)?(z[pe]=me,z[ne]=q,pe=ne):(z[pe]=ee,z[$e]=q,pe=$e);else if(ne<F&&0>i(me,q))z[pe]=me,z[ne]=q,pe=ne;else break e}}return te}function i(z,te){var q=z.sortIndex-te.sortIndex;return q!==0?q:z.id-te.id}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 s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var c=[],h=[],d=1,f=null,m=3,g=!1,b=!1,x=!1,k=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function N(z){for(var te=r(h);te!==null;){if(te.callback===null)n(h);else if(te.startTime<=z)n(h),te.sortIndex=te.expirationTime,t(c,te);else break;te=r(h)}}function B(z){if(x=!1,N(z),!b)if(r(c)!==null)b=!0,I||(I=!0,se());else{var te=r(h);te!==null&&W(B,te.startTime-z)}}var I=!1,P=-1,O=5,X=-1;function j(){return k?!0:!(e.unstable_now()-X<O)}function Z(){if(k=!1,I){var z=e.unstable_now();X=z;var te=!0;try{e:{b=!1,x&&(x=!1,_(P),P=-1),g=!0;var q=m;try{t:{for(N(z),f=r(c);f!==null&&!(f.expirationTime>z&&j());){var pe=f.callback;if(typeof pe=="function"){f.callback=null,m=f.priorityLevel;var F=pe(f.expirationTime<=z);if(z=e.unstable_now(),typeof F=="function"){f.callback=F,N(z),te=!0;break t}f===r(c)&&n(c),N(z)}else n(c);f=r(c)}if(f!==null)te=!0;else{var Ee=r(h);Ee!==null&&W(B,Ee.startTime-z),te=!1}}break e}finally{f=null,m=q,g=!1}te=void 0}}finally{te?se():I=!1}}}var se;if(typeof S=="function")se=function(){S(Z)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,K=ue.port2;ue.port1.onmessage=Z,se=function(){K.postMessage(null)}}else se=function(){w(Z,0)};function W(z,te){P=w(function(){z(e.unstable_now())},te)}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(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(z){switch(m){case 1:case 2:case 3:var te=3;break;default:te=m}var q=m;m=te;try{return z()}finally{m=q}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(z,te){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var q=m;m=z;try{return te()}finally{m=q}},e.unstable_scheduleCallback=function(z,te,q){var pe=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?pe+q:pe):q=pe,z){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=q+F,z={id:d++,callback:te,priorityLevel:z,startTime:q,expirationTime:F,sortIndex:-1},q>pe?(z.sortIndex=q,t(h,z),r(c)===null&&z===r(h)&&(x?(_(P),P=-1):x=!0,W(B,q-pe))):(z.sortIndex=F,t(c,z),b||g||(b=!0,I||(I=!0,se()))),z},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(z){var te=m;return function(){var q=m;m=te;try{return z.apply(this,arguments)}finally{m=q}}}})(B4)),B4}var U9;function ote(){return U9||(U9=1,M4.exports=ste()),M4.exports}var R4={exports:{}},Ai={};var q9;function lte(){if(q9)return Ai;q9=1;var e=Qw();function t(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)f+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal"),a=Symbol.for("react.recoverable"),s=Symbol.for("react.optimistic_key");function l(d,f,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:g===s?s:""+g,children:d,containerInfo:f,implementation:m}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Ai.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Ai.browser=function(d){return{$$typeof:a,_reason:d}},Ai.createPortal=function(d,f){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return l(d,f,null,m)},Ai.flushSync=function(d){var f=c.T,m=n.p;try{if(c.T=null,n.p=2,d)return d()}finally{c.T=f,n.p=m,n.d.f()}},Ai.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,n.d.C(d,f))},Ai.prefetchDNS=function(d){typeof d=="string"&&n.d.D(d)},Ai.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var m=f.as,g=h(m,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,x=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;m==="style"?n.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:x}):m==="script"&&n.d.X(d,{crossOrigin:g,integrity:b,fetchPriority:x,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Ai.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var m=h(f.as,f.crossOrigin);n.d.M(d,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0})}}else f==null&&n.d.M(d)},Ai.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var m=f.as,g=h(m,f.crossOrigin);n.d.L(d,m,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Ai.preloadModule=function(d,f){if(typeof d=="string")if(f){var m=h(f.as,f.crossOrigin);n.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0})}else n.d.m(d)},Ai.requestFormReset=function(d){n.d.r(d)},Ai.unstable_batchedUpdates=function(d,f){return d(f)},Ai.useFormState=function(d,f,m){return c.H.useFormState(d,f,m)},Ai.useFormStatus=function(){return c.H.useHostTransitionStatus()},Ai.version="19.3.1",Ai}var V9;function LP(){if(V9)return R4.exports;V9=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),R4.exports=lte(),R4.exports}var G9;function cte(){if(G9)return bp;G9=1;var e=ote(),t=Qw(),r=LP();function n(o){var u="https://react.dev/errors/"+o;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)u+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+o+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function a(o){for(var u=o,p=u;p&&!p.alternate;)u=p,(u.flags&4098)!==0&&(o=u.return),p=u.return;for(;u.return;)u=u.return;return u.tag===3?o:null}function s(o){if(o.tag===13){var u=o.memoizedState;if(u===null&&(o=o.alternate,o!==null&&(u=o.memoizedState)),u!==null)return u.dehydrated}return null}function l(o){if(o.tag===31){var u=o.memoizedState;if(u===null&&(o=o.alternate,o!==null&&(u=o.memoizedState)),u!==null)return u.dehydrated}return null}function c(o){if(a(o)!==o)throw Error(n(188))}function h(o){var u=o.alternate;if(!u){if(u=a(o),u===null)throw Error(n(188));return u!==o?null:o}for(var p=o,y=u;;){var v=p.return;if(v===null)break;var T=v.alternate;if(T===null){if(y=v.return,y!==null){p=y;continue}break}if(v.child===T.child){for(T=v.child;T;){if(T===p)return c(v),o;if(T===y)return c(v),u;T=T.sibling}throw Error(n(188))}if(p.return!==y.return)p=v,y=T;else{for(var R=!1,G=v.child;G;){if(G===p){R=!0,p=v,y=T;break}if(G===y){R=!0,y=v,p=T;break}G=G.sibling}if(!R){for(G=T.child;G;){if(G===p){R=!0,p=T,y=v;break}if(G===y){R=!0,y=T,p=v;break}G=G.sibling}if(!R)throw Error(n(189))}}if(p.alternate!==y)throw Error(n(190))}if(p.tag!==3)throw Error(n(188));return p.stateNode.current===p?o:u}function d(o){var u=o.tag;if(u===5||u===26||u===27||u===6)return o;for(o=o.child;o!==null;){if(u=d(o),u!==null)return u;o=o.sibling}return null}function f(o,u,p,y,v,T){for(;o!==null;){if((o.tag===5||o.tag===27||o.tag===6)&&p(o,y,v,T)||(o.tag!==22||o.memoizedState===null)&&(u||o.tag!==5&&o.tag!==27)&&f(o.child,u,p,y,v,T))return!0;o=o.sibling}return!1}function m(o){for(o=o.return;o!==null;){if(o.tag===3||o.tag===5||o.tag===27)return o;o=o.return}return null}function g(o){var u=!1;for(o=o.return;o!==null&&(o.tag===4&&(u=!0),!(o.tag===3||o.tag===5||o.tag===27));)o=o.return;return u}function b(o){var u=[null,null],p=m(o);return p===null||x(u,o,p.child,{foundSelf:!1}),u}function x(o,u,p,y){for(;p!==null;){if(p===u)y.foundSelf=!0;else if(p.tag===5||p.tag===27||p.tag===6){if(y.foundSelf)return o[1]=p,!0;o[0]=p}else if((p.tag!==22||p.memoizedState===null)&&x(o,u,p.child,y))return!0;p=p.sibling}return!1}function k(o){switch(o.tag){case 5:case 27:case 6:return o.stateNode;case 3:return o.stateNode.containerInfo;default:throw Error(n(559))}}var w=null,_=null;function S(o,u,p){return o===p?!0:o===u?(w=o,!0):!1}function N(o,u,p){return o===p?(_=o,!1):o===u?(_!==null&&(w=o),!0):!1}function B(o){if(o===null)return null;do o=o===null?null:o.return;while(o&&o.tag!==5&&o.tag!==27&&o.tag!==3);return o||null}function I(o,u,p){for(var y=0,v=o;v;v=p(v))y++;v=0;for(var T=u;T;T=p(T))v++;for(;0<y-v;)o=p(o),y--;for(;0<v-y;)u=p(u),v--;for(;y--;){if(o===u||u!==null&&o===u.alternate)return o;o=p(o),u=p(u)}return null}var P=Object.assign,O=Symbol.for("react.element"),X=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),se=Symbol.for("react.strict_mode"),ue=Symbol.for("react.profiler"),K=Symbol.for("react.consumer"),W=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),pe=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),Ee=Symbol.for("react.activity"),$e=Symbol.for("react.legacy_hidden"),ee=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.for("react.view_transition"),me=Symbol.for("react.recoverable"),he=Symbol.iterator;function Oe(o){return o===null||typeof o!="object"?null:(o=he&&o[he]||o["@@iterator"],typeof o=="function"?o:null)}var tt=Symbol.for("react.client.reference");function Ne(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===tt?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case Z:return"Fragment";case ue:return"Profiler";case se:return"StrictMode";case te:return"Suspense";case q:return"SuspenseList";case Ee:return"Activity";case ne:return"ViewTransition"}if(typeof o=="object")switch(o.$$typeof){case j:return"Portal";case W:return o.displayName||"Context";case K:return(o._context.displayName||"Context")+".Consumer";case z:var u=o.render;return o=o.displayName,o||(o=u.displayName||u.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case pe:return u=o.displayName||null,u!==null?u:Ne(o.type)||"Memo";case F:u=o._payload,o=o._init;try{return Ne(o(u))}catch{}}return null}var Je=Array.isArray,qe=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,rt=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,qt={pending:!1,data:null,method:null,action:null},Cr=[],Ar=-1;function Nt(o){return{current:o}}function zt(o){0>Ar||(o.current=Cr[Ar],Cr[Ar]=null,Ar--)}function vt(o,u){Ar++,Cr[Ar]=o.current,o.current=u}var Sr=Nt(null),er=Nt(null),Lr=Nt(null),Sn=Nt(null);function mr(o,u){switch(vt(Lr,u),vt(er,o),vt(Sr,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?WA(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=WA(u),o=YA(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}zt(Sr),vt(Sr,o)}function an(){zt(Sr),zt(er),zt(Lr)}function Xr(o){var u=o.memoizedState;u!==null&&(Fd._currentValue=u.memoizedState,vt(Sn,o)),u=Sr.current;var p=YA(u,o.type);u!==p&&(vt(er,o),vt(Sr,p))}function bt(o){er.current===o&&(zt(Sr),zt(er)),Sn.current===o&&(zt(Sn),Fd._currentValue=qt)}var ke,E;function ae(o){if(ke===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);ke=u&&u[1]||"",E=-1<p.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+ke+o+E}var be=!1;function Re(o,u){if(!o||be)return"";be=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var y={DetermineComponentFrameRoot:function(){try{if(u){var Xe=function(){throw Error()};if(Object.defineProperty(Xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Xe,[])}catch(ft){var ve=ft}Reflect.construct(o,[],Xe)}else{try{Xe.call()}catch(ft){ve=ft}Xe=!1;try{var Be=Object.getOwnPropertyDescriptor(o.prototype,"props");Object.defineProperty(o.prototype,"props",{configurable:!0,set:function(){throw Error()}}),Xe=!0,new o}finally{Xe&&(Be!==void 0?Object.defineProperty(o.prototype,"props",Be):delete o.prototype.props)}}}else{try{throw Error()}catch(ft){ve=ft}(Xe=o())&&typeof Xe.catch=="function"&&Xe.catch(function(){})}}catch(ft){if(ft&&ve&&typeof ft.stack=="string")return[ft.stack,ve.stack]}return[null,null]}};y.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(y.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(y.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var T=y.DetermineComponentFrameRoot(),R=T[0],G=T[1];if(R&&G){var le=R.split(`
|
|
@@ -706,7 +706,7 @@ ${a.join(`
|
|
|
706
706
|
L0,20`)},"requirement_arrow"),Vxe=L((e,t,r)=>{const n=pn(),{themeVariables:i}=n,{strokeWidth:a}=i;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${a}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
|
|
707
707
|
L20,10
|
|
708
708
|
M20,10
|
|
709
|
-
L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),Gxe=L((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),Wxe=L((e,t,r)=>{const n=pn(),{themeVariables:i}=n,{strokeWidth:a}=i,s=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");s.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),s.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),s.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),s.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),Yxe={extension:Sxe,composition:Exe,aggregation:Axe,dependency:Lxe,lollipop:Nxe,point:Mxe,circle:Bxe,cross:Rxe,barb:Oxe,barbNeo:Dxe,only_one:Ixe,zero_or_one:Pxe,one_or_more:Fxe,zero_or_more:$xe,only_one_neo:zxe,zero_or_one_neo:jxe,one_or_more_neo:Hxe,zero_or_more_neo:Uxe,requirement_arrow:qxe,requirement_contains:Gxe,requirement_arrow_neo:Vxe,requirement_contains_neo:Wxe},HV=_xe,UV=typeof global=="object"&&global&&global.Object===Object&&global,Xxe=typeof self=="object"&&self&&self.Object===Object&&self,ic=UV||Xxe||Function("return this")(),Jo=ic.Symbol,qV=Object.prototype,Kxe=qV.hasOwnProperty,Qxe=qV.toString,Bp=Jo?Jo.toStringTag:void 0;function Zxe(e){var t=Kxe.call(e,Bp),r=e[Bp];try{e[Bp]=void 0;var n=!0}catch{}var i=Qxe.call(e);return n&&(t?e[Bp]=r:delete e[Bp]),i}var Jxe=Object.prototype,eve=Jxe.toString;function tve(e){return eve.call(e)}var rve="[object Null]",nve="[object Undefined]",qB=Jo?Jo.toStringTag:void 0;function bf(e){return e==null?e===void 0?nve:rve:qB&&qB in Object(e)?Zxe(e):tve(e)}function $h(e){return e!=null&&typeof e=="object"}var ive="[object Symbol]";function F_(e){return typeof e=="symbol"||$h(e)&&bf(e)==ive}function VV(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var Sa=Array.isArray,VB=Jo?Jo.prototype:void 0,GB=VB?VB.toString:void 0;function GV(e){if(typeof e=="string")return e;if(Sa(e))return VV(e,GV)+"";if(F_(e))return GB?GB.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function $_(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Px(e){return e}var ave="[object AsyncFunction]",sve="[object Function]",ove="[object GeneratorFunction]",lve="[object Proxy]";function b2(e){if(!$_(e))return!1;var t=bf(e);return t==sve||t==ove||t==ave||t==lve}var VC=ic["__core-js_shared__"],WB=(function(){var e=/[^.]+$/.exec(VC&&VC.keys&&VC.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function cve(e){return!!WB&&WB in e}var uve=Function.prototype,hve=uve.toString;function Jh(e){if(e!=null){try{return hve.call(e)}catch{}try{return e+""}catch{}}return""}var dve=/[\\^$.*+?()[\]{}|]/g,fve=/^\[object .+?Constructor\]$/,pve=Function.prototype,mve=Object.prototype,gve=pve.toString,yve=mve.hasOwnProperty,bve=RegExp("^"+gve.call(yve).replace(dve,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xve(e){if(!$_(e)||cve(e))return!1;var t=b2(e)?bve:fve;return t.test(Jh(e))}function vve(e,t){return e?.[t]}function ed(e,t){var r=vve(e,t);return xve(r)?r:void 0}var FT=ed(ic,"WeakMap");function Cve(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function kve(){}var Tve=800,wve=16,_ve=Date.now;function Sve(e){var t=0,r=0;return function(){var n=_ve(),i=wve-(n-r);if(r=n,i>0){if(++t>=Tve)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function em(e){return function(){return e}}var YB=(function(){try{var e=ed(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Eve=YB?function(e,t){return YB(e,"toString",{configurable:!0,enumerable:!1,value:em(t),writable:!0})}:Px,Ave=Sve(Eve);function Lve(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}function Nve(e,t,r,n){for(var i=e.length,a=r+-1;++a<i;)if(t(e[a],a,e))return a;return-1}function Mve(e){return e!==e}function Bve(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function Rve(e,t,r){return t===t?Bve(e,t,r):Nve(e,Mve,r)}function Ove(e,t){var r=e==null?0:e.length;return!!r&&Rve(e,t,0)>-1}var Dve=9007199254740991,Ive=/^(?:0|[1-9]\d*)$/;function WV(e,t){var r=typeof e;return t=t??Dve,!!t&&(r=="number"||r!="symbol"&&Ive.test(e))&&e>-1&&e%1==0&&e<t}function YV(e,t){return e===t||e!==e&&t!==t}var XB=Math.max;function Pve(e,t,r){return t=XB(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=XB(n.length-t,0),s=Array(a);++i<a;)s[i]=n[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=n[i];return l[t]=r(s),Cve(e,this,l)}}function Fve(e,t){return Ave(Pve(e,t,Px),e+"")}var $ve=9007199254740991;function z_(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$ve}function Fx(e){return e!=null&&z_(e.length)&&!b2(e)}var zve=Object.prototype;function XV(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||zve;return e===r}function jve(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Hve="[object Arguments]";function KB(e){return $h(e)&&bf(e)==Hve}var KV=Object.prototype,Uve=KV.hasOwnProperty,qve=KV.propertyIsEnumerable,$x=KB((function(){return arguments})())?KB:function(e){return $h(e)&&Uve.call(e,"callee")&&!qve.call(e,"callee")};function Vve(){return!1}var QV=typeof exports=="object"&&exports&&!exports.nodeType&&exports,QB=QV&&typeof module=="object"&&module&&!module.nodeType&&module,Gve=QB&&QB.exports===QV,ZB=Gve?ic.Buffer:void 0,Wve=ZB?ZB.isBuffer:void 0,x2=Wve||Vve,Yve="[object Arguments]",Xve="[object Array]",Kve="[object Boolean]",Qve="[object Date]",Zve="[object Error]",Jve="[object Function]",e3e="[object Map]",t3e="[object Number]",r3e="[object Object]",n3e="[object RegExp]",i3e="[object Set]",a3e="[object String]",s3e="[object WeakMap]",o3e="[object ArrayBuffer]",l3e="[object DataView]",c3e="[object Float32Array]",u3e="[object Float64Array]",h3e="[object Int8Array]",d3e="[object Int16Array]",f3e="[object Int32Array]",p3e="[object Uint8Array]",m3e="[object Uint8ClampedArray]",g3e="[object Uint16Array]",y3e="[object Uint32Array]",en={};en[c3e]=en[u3e]=en[h3e]=en[d3e]=en[f3e]=en[p3e]=en[m3e]=en[g3e]=en[y3e]=!0;en[Yve]=en[Xve]=en[o3e]=en[Kve]=en[l3e]=en[Qve]=en[Zve]=en[Jve]=en[e3e]=en[t3e]=en[r3e]=en[n3e]=en[i3e]=en[a3e]=en[s3e]=!1;function b3e(e){return $h(e)&&z_(e.length)&&!!en[bf(e)]}function x3e(e){return function(t){return e(t)}}var ZV=typeof exports=="object"&&exports&&!exports.nodeType&&exports,mm=ZV&&typeof module=="object"&&module&&!module.nodeType&&module,v3e=mm&&mm.exports===ZV,GC=v3e&&UV.process,JB=(function(){try{var e=mm&&mm.require&&mm.require("util").types;return e||GC&&GC.binding&&GC.binding("util")}catch{}})(),eR=JB&&JB.isTypedArray,j_=eR?x3e(eR):b3e,C3e=Object.prototype,k3e=C3e.hasOwnProperty;function T3e(e,t){var r=Sa(e),n=!r&&$x(e),i=!r&&!n&&x2(e),a=!r&&!n&&!i&&j_(e),s=r||n||i||a,l=s?jve(e.length,String):[],c=l.length;for(var h in e)(t||k3e.call(e,h))&&!(s&&(h=="length"||i&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||WV(h,c)))&&l.push(h);return l}function w3e(e,t){return function(r){return e(t(r))}}var _3e=w3e(Object.keys,Object),S3e=Object.prototype,E3e=S3e.hasOwnProperty;function JV(e){if(!XV(e))return _3e(e);var t=[];for(var r in Object(e))E3e.call(e,r)&&r!="constructor"&&t.push(r);return t}function qo(e){return Fx(e)?T3e(e):JV(e)}var A3e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,L3e=/^\w*$/;function H_(e,t){if(Sa(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||F_(e)?!0:L3e.test(e)||!A3e.test(e)||t!=null&&e in Object(t)}var jm=ed(Object,"create");function N3e(){this.__data__=jm?jm(null):{},this.size=0}function M3e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var B3e="__lodash_hash_undefined__",R3e=Object.prototype,O3e=R3e.hasOwnProperty;function D3e(e){var t=this.__data__;if(jm){var r=t[e];return r===B3e?void 0:r}return O3e.call(t,e)?t[e]:void 0}var I3e=Object.prototype,P3e=I3e.hasOwnProperty;function F3e(e){var t=this.__data__;return jm?t[e]!==void 0:P3e.call(t,e)}var $3e="__lodash_hash_undefined__";function z3e(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=jm&&t===void 0?$3e:t,this}function zh(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}zh.prototype.clear=N3e;zh.prototype.delete=M3e;zh.prototype.get=D3e;zh.prototype.has=F3e;zh.prototype.set=z3e;function j3e(){this.__data__=[],this.size=0}function zx(e,t){for(var r=e.length;r--;)if(YV(e[r][0],t))return r;return-1}var H3e=Array.prototype,U3e=H3e.splice;function q3e(e){var t=this.__data__,r=zx(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():U3e.call(t,r,1),--this.size,!0}function V3e(e){var t=this.__data__,r=zx(t,e);return r<0?void 0:t[r][1]}function G3e(e){return zx(this.__data__,e)>-1}function W3e(e,t){var r=this.__data__,n=zx(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ac(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ac.prototype.clear=j3e;ac.prototype.delete=q3e;ac.prototype.get=V3e;ac.prototype.has=G3e;ac.prototype.set=W3e;var Hm=ed(ic,"Map");function Y3e(){this.size=0,this.__data__={hash:new zh,map:new(Hm||ac),string:new zh}}function X3e(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function jx(e,t){var r=e.__data__;return X3e(t)?r[typeof t=="string"?"string":"hash"]:r.map}function K3e(e){var t=jx(this,e).delete(e);return this.size-=t?1:0,t}function Q3e(e){return jx(this,e).get(e)}function Z3e(e){return jx(this,e).has(e)}function J3e(e,t){var r=jx(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function sc(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}sc.prototype.clear=Y3e;sc.prototype.delete=K3e;sc.prototype.get=Q3e;sc.prototype.has=Z3e;sc.prototype.set=J3e;var e4e="Expected a function";function U_(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(e4e);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var s=e.apply(this,n);return r.cache=a.set(i,s)||a,s};return r.cache=new(U_.Cache||sc),r}U_.Cache=sc;var t4e=500;function r4e(e){var t=U_(e,function(n){return r.size===t4e&&r.clear(),n}),r=t.cache;return t}var n4e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i4e=/\\(\\)?/g,a4e=r4e(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(n4e,function(r,n,i,a){t.push(i?a.replace(i4e,"$1"):n||r)}),t});function s4e(e){return e==null?"":GV(e)}function eG(e,t){return Sa(e)?e:H_(e,t)?[e]:a4e(s4e(e))}function Hx(e){if(typeof e=="string"||F_(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function tG(e,t){t=eG(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Hx(t[r++])];return r&&r==n?e:void 0}function o4e(e,t,r){var n=e==null?void 0:tG(e,t);return n===void 0?r:n}function rG(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var tR=Jo?Jo.isConcatSpreadable:void 0;function l4e(e){return Sa(e)||$x(e)||!!(tR&&e&&e[tR])}function c4e(e,t,r,n,i){var a=-1,s=e.length;for(r||(r=l4e),i||(i=[]);++a<s;){var l=e[a];r(l)?rG(i,l):n||(i[i.length]=l)}return i}function u4e(e,t,r,n){var i=-1,a=e==null?0:e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function h4e(){this.__data__=new ac,this.size=0}function d4e(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function f4e(e){return this.__data__.get(e)}function p4e(e){return this.__data__.has(e)}var m4e=200;function g4e(e,t){var r=this.__data__;if(r instanceof ac){var n=r.__data__;if(!Hm||n.length<m4e-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new sc(n)}return r.set(e,t),this.size=r.size,this}function Xl(e){var t=this.__data__=new ac(e);this.size=t.size}Xl.prototype.clear=h4e;Xl.prototype.delete=d4e;Xl.prototype.get=f4e;Xl.prototype.has=p4e;Xl.prototype.set=g4e;function nG(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var s=e[r];t(s,r,e)&&(a[i++]=s)}return a}function y4e(){return[]}var b4e=Object.prototype,x4e=b4e.propertyIsEnumerable,rR=Object.getOwnPropertySymbols,v4e=rR?function(e){return e==null?[]:(e=Object(e),nG(rR(e),function(t){return x4e.call(e,t)}))}:y4e;function C4e(e,t,r){var n=t(e);return Sa(e)?n:rG(n,r(e))}function nR(e){return C4e(e,qo,v4e)}var $T=ed(ic,"DataView"),zT=ed(ic,"Promise"),x0=ed(ic,"Set"),iR="[object Map]",k4e="[object Object]",aR="[object Promise]",sR="[object Set]",oR="[object WeakMap]",lR="[object DataView]",T4e=Jh($T),w4e=Jh(Hm),_4e=Jh(zT),S4e=Jh(x0),E4e=Jh(FT),Ul=bf;($T&&Ul(new $T(new ArrayBuffer(1)))!=lR||Hm&&Ul(new Hm)!=iR||zT&&Ul(zT.resolve())!=aR||x0&&Ul(new x0)!=sR||FT&&Ul(new FT)!=oR)&&(Ul=function(e){var t=bf(e),r=t==k4e?e.constructor:void 0,n=r?Jh(r):"";if(n)switch(n){case T4e:return lR;case w4e:return iR;case _4e:return aR;case S4e:return sR;case E4e:return oR}return t});var cR=ic.Uint8Array,A4e="__lodash_hash_undefined__";function L4e(e){return this.__data__.set(e,A4e),this}function N4e(e){return this.__data__.has(e)}function Um(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new sc;++t<r;)this.add(e[t])}Um.prototype.add=Um.prototype.push=L4e;Um.prototype.has=N4e;function M4e(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function iG(e,t){return e.has(t)}var B4e=1,R4e=2;function aG(e,t,r,n,i,a){var s=r&B4e,l=e.length,c=t.length;if(l!=c&&!(s&&c>l))return!1;var h=a.get(e),d=a.get(t);if(h&&d)return h==t&&d==e;var f=-1,m=!0,g=r&R4e?new Um:void 0;for(a.set(e,t),a.set(t,e);++f<l;){var b=e[f],x=t[f];if(n)var k=s?n(x,b,f,t,e,a):n(b,x,f,e,t,a);if(k!==void 0){if(k)continue;m=!1;break}if(g){if(!M4e(t,function(w,_){if(!iG(g,_)&&(b===w||i(b,w,r,n,a)))return g.push(_)})){m=!1;break}}else if(!(b===x||i(b,x,r,n,a))){m=!1;break}}return a.delete(e),a.delete(t),m}function O4e(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function q_(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var D4e=1,I4e=2,P4e="[object Boolean]",F4e="[object Date]",$4e="[object Error]",z4e="[object Map]",j4e="[object Number]",H4e="[object RegExp]",U4e="[object Set]",q4e="[object String]",V4e="[object Symbol]",G4e="[object ArrayBuffer]",W4e="[object DataView]",uR=Jo?Jo.prototype:void 0,WC=uR?uR.valueOf:void 0;function Y4e(e,t,r,n,i,a,s){switch(r){case W4e:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case G4e:return!(e.byteLength!=t.byteLength||!a(new cR(e),new cR(t)));case P4e:case F4e:case j4e:return YV(+e,+t);case $4e:return e.name==t.name&&e.message==t.message;case H4e:case q4e:return e==t+"";case z4e:var l=O4e;case U4e:var c=n&D4e;if(l||(l=q_),e.size!=t.size&&!c)return!1;var h=s.get(e);if(h)return h==t;n|=I4e,s.set(e,t);var d=aG(l(e),l(t),n,i,a,s);return s.delete(e),d;case V4e:if(WC)return WC.call(e)==WC.call(t)}return!1}var X4e=1,K4e=Object.prototype,Q4e=K4e.hasOwnProperty;function Z4e(e,t,r,n,i,a){var s=r&X4e,l=nR(e),c=l.length,h=nR(t),d=h.length;if(c!=d&&!s)return!1;for(var f=c;f--;){var m=l[f];if(!(s?m in t:Q4e.call(t,m)))return!1}var g=a.get(e),b=a.get(t);if(g&&b)return g==t&&b==e;var x=!0;a.set(e,t),a.set(t,e);for(var k=s;++f<c;){m=l[f];var w=e[m],_=t[m];if(n)var S=s?n(_,w,m,t,e,a):n(w,_,m,e,t,a);if(!(S===void 0?w===_||i(w,_,r,n,a):S)){x=!1;break}k||(k=m=="constructor")}if(x&&!k){var N=e.constructor,B=t.constructor;N!=B&&"constructor"in e&&"constructor"in t&&!(typeof N=="function"&&N instanceof N&&typeof B=="function"&&B instanceof B)&&(x=!1)}return a.delete(e),a.delete(t),x}var J4e=1,hR="[object Arguments]",dR="[object Array]",ky="[object Object]",eCe=Object.prototype,fR=eCe.hasOwnProperty;function tCe(e,t,r,n,i,a){var s=Sa(e),l=Sa(t),c=s?dR:Ul(e),h=l?dR:Ul(t);c=c==hR?ky:c,h=h==hR?ky:h;var d=c==ky,f=h==ky,m=c==h;if(m&&x2(e)){if(!x2(t))return!1;s=!0,d=!1}if(m&&!d)return a||(a=new Xl),s||j_(e)?aG(e,t,r,n,i,a):Y4e(e,t,c,r,n,i,a);if(!(r&J4e)){var g=d&&fR.call(e,"__wrapped__"),b=f&&fR.call(t,"__wrapped__");if(g||b){var x=g?e.value():e,k=b?t.value():t;return a||(a=new Xl),i(x,k,r,n,a)}}return m?(a||(a=new Xl),Z4e(e,t,r,n,i,a)):!1}function V_(e,t,r,n,i){return e===t?!0:e==null||t==null||!$h(e)&&!$h(t)?e!==e&&t!==t:tCe(e,t,r,n,V_,i)}var rCe=1,nCe=2;function iCe(e,t,r,n){var i=r.length,a=i;if(e==null)return!a;for(e=Object(e);i--;){var s=r[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=r[i];var l=s[0],c=e[l],h=s[1];if(s[2]){if(c===void 0&&!(l in e))return!1}else{var d=new Xl,f;if(!(f===void 0?V_(h,c,rCe|nCe,n,d):f))return!1}}return!0}function sG(e){return e===e&&!$_(e)}function aCe(e){for(var t=qo(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,sG(i)]}return t}function oG(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function sCe(e){var t=aCe(e);return t.length==1&&t[0][2]?oG(t[0][0],t[0][1]):function(r){return r===e||iCe(r,e,t)}}function oCe(e,t){return e!=null&&t in Object(e)}function lCe(e,t,r){t=eG(t,e);for(var n=-1,i=t.length,a=!1;++n<i;){var s=Hx(t[n]);if(!(a=e!=null&&r(e,s)))break;e=e[s]}return a||++n!=i?a:(i=e==null?0:e.length,!!i&&z_(i)&&WV(s,i)&&(Sa(e)||$x(e)))}function cCe(e,t){return e!=null&&lCe(e,t,oCe)}var uCe=1,hCe=2;function dCe(e,t){return H_(e)&&sG(t)?oG(Hx(e),t):function(r){var n=o4e(r,e);return n===void 0&&n===t?cCe(r,e):V_(t,n,uCe|hCe)}}function fCe(e){return function(t){return t?.[e]}}function pCe(e){return function(t){return tG(t,e)}}function mCe(e){return H_(e)?fCe(Hx(e)):pCe(e)}function lG(e){return typeof e=="function"?e:e==null?Px:typeof e=="object"?Sa(e)?dCe(e[0],e[1]):sCe(e):mCe(e)}function gCe(e){return function(t,r,n){for(var i=-1,a=Object(t),s=n(t),l=s.length;l--;){var c=s[++i];if(r(a[c],c,a)===!1)break}return t}}var yCe=gCe();function bCe(e,t){return e&&yCe(e,t,qo)}function xCe(e,t){return function(r,n){if(r==null)return r;if(!Fx(r))return e(r,n);for(var i=r.length,a=-1,s=Object(r);++a<i&&n(s[a],a,s)!==!1;);return r}}var G_=xCe(bCe);function vCe(e){return $h(e)&&Fx(e)}function CCe(e){return typeof e=="function"?e:Px}function rh(e,t){var r=Sa(e)?Lve:G_;return r(e,CCe(t))}function kCe(e,t){var r=[];return G_(e,function(n,i,a){t(n,i,a)&&r.push(n)}),r}function Ty(e,t){var r=Sa(e)?nG:kCe;return r(e,lG(t))}function TCe(e,t){return VV(t,function(r){return e[r]})}function YC(e){return e==null?[]:TCe(e,qo(e))}var wCe="[object Map]",_Ce="[object Set]",SCe=Object.prototype,ECe=SCe.hasOwnProperty;function pR(e){if(e==null)return!0;if(Fx(e)&&(Sa(e)||typeof e=="string"||typeof e.splice=="function"||x2(e)||j_(e)||$x(e)))return!e.length;var t=Ul(e);if(t==wCe||t==_Ce)return!e.size;if(XV(e))return!JV(e).length;for(var r in e)if(ECe.call(e,r))return!1;return!0}function i0(e){return e===void 0}function ACe(e,t,r,n,i){return i(e,function(a,s,l){r=n?(n=!1,a):t(r,a,s,l)}),r}function LCe(e,t,r){var n=Sa(e)?u4e:ACe,i=arguments.length<3;return n(e,lG(t),r,i,G_)}var NCe=1/0,MCe=x0&&1/q_(new x0([,-0]))[1]==NCe?function(e){return new x0(e)}:kve,BCe=200;function RCe(e,t,r){var n=-1,i=Ove,a=e.length,s=!0,l=[],c=l;if(a>=BCe){var h=MCe(e);if(h)return q_(h);s=!1,i=iG,c=new Um}else c=l;e:for(;++n<a;){var d=e[n],f=d;if(d=d!==0?d:0,s&&f===f){for(var m=c.length;m--;)if(c[m]===f)continue e;l.push(d)}else i(c,f,r)||(c!==l&&c.push(f),l.push(d))}return l}var OCe=Fve(function(e){return RCe(c4e(e,1,vCe,!0))}),DCe="\0",nh="\0",mR="";class Ux{constructor(t={}){this._isDirected=Object.prototype.hasOwnProperty.call(t,"directed")?t.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(t,"multigraph")?t.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=em(void 0),this._defaultEdgeLabelFn=em(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[nh]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return b2(t)||(t=em(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return qo(this._nodes)}sources(){var t=this;return Ty(this.nodes(),function(r){return pR(t._in[r])})}sinks(){var t=this;return Ty(this.nodes(),function(r){return pR(t._out[r])})}setNodes(t,r){var n=arguments,i=this;return rh(t,function(a){n.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=nh,this._children[t]={},this._children[nh][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],rh(this.children(t),n=>{this.setParent(n)}),delete this._children[t]),rh(qo(this._in[t]),r),delete this._in[t],delete this._preds[t],rh(qo(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i0(r))r=nh;else{r+="";for(var n=r;!i0(n);n=this.parent(n))if(n===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==nh)return r}}children(t){if(i0(t)&&(t=nh),this._isCompound){var r=this._children[t];if(r)return qo(r)}else{if(t===nh)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return qo(r)}successors(t){var r=this._sucs[t];if(r)return qo(r)}neighbors(t){var r=this.predecessors(t);if(r)return OCe(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;rh(this._nodes,function(s,l){t(l)&&r.setNode(l,s)}),rh(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,n.edge(s))});var i={};function a(s){var l=n.parent(s);return l===void 0||r.hasNode(l)?(i[s]=l,l):l in i?i[l]:a(l)}return this._isCompound&&rh(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(t){return b2(t)||(t=em(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return YC(this._edgeObjs)}setPath(t,r){var n=this,i=arguments;return LCe(t,function(a,s){return i.length>1?n.setEdge(a,s,r):n.setEdge(a,s),s}),this}setEdge(){var t,r,n,i,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(t=s.v,r=s.w,n=s.name,arguments.length===2&&(i=arguments[1],a=!0)):(t=s,r=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),t=""+t,r=""+r,i0(n)||(n=""+n);var l=tm(this._isDirected,t,r,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,l))return a&&(this._edgeLabels[l]=i),this;if(!i0(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[l]=a?i:this._defaultEdgeLabelFn(t,r,n);var c=ICe(this._isDirected,t,r,n);return t=c.v,r=c.w,Object.freeze(c),this._edgeObjs[l]=c,gR(this._preds[r],t),gR(this._sucs[t],r),this._in[r][l]=c,this._out[t][l]=c,this._edgeCount++,this}edge(t,r,n){var i=arguments.length===1?XC(this._isDirected,arguments[0]):tm(this._isDirected,t,r,n);return this._edgeLabels[i]}hasEdge(t,r,n){var i=arguments.length===1?XC(this._isDirected,arguments[0]):tm(this._isDirected,t,r,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(t,r,n){var i=arguments.length===1?XC(this._isDirected,arguments[0]):tm(this._isDirected,t,r,n),a=this._edgeObjs[i];return a&&(t=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],yR(this._preds[r],t),yR(this._sucs[t],r),delete this._in[r][i],delete this._out[t][i],this._edgeCount--),this}inEdges(t,r){var n=this._in[t];if(n){var i=YC(n);return r?Ty(i,function(a){return a.v===r}):i}}outEdges(t,r){var n=this._out[t];if(n){var i=YC(n);return r?Ty(i,function(a){return a.w===r}):i}}nodeEdges(t,r){var n=this.inEdges(t,r);if(n)return n.concat(this.outEdges(t,r))}}Ux.prototype._nodeCount=0;Ux.prototype._edgeCount=0;function gR(e,t){e[t]?e[t]++:e[t]=1}function yR(e,t){--e[t]||delete e[t]}function tm(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var s=i;i=a,a=s}return i+mR+a+mR+(i0(n)?DCe:n)}function ICe(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var s=i;i=a,a=s}var l={v:i,w:a};return n&&(l.name=n),l}function XC(e,t){return tm(e,t.v,t.w,t.name)}function cG(e,{edgePathsClass:t="edges edgePaths"}={}){const r=e.insert("g").attr("class","root"),n=r.insert("g").attr("class","clusters"),i=r.insert("g").attr("class",t),a=r.insert("g").attr("class","edgeLabels"),s=r.insert("g").attr("class","nodes");return{clusters:n,edgePaths:i,edgeLabels:a,nodes:s,rootGroups:r}}L(cG,"createLayoutElementGroups");async function uG(e,t){if(t.label){const{shapeSvg:r,bbox:n}=await Mt(e,t);t.labelBBox={width:n.width,height:n.height},r.remove()}else t.labelBBox={width:0,height:0}}L(uG,"measureGroupLabel");async function hG(e,t,r){const n=await I_(e,t,r),i=n.node()?.getBBox()??{width:0,height:0};return t.width=i.width,t.height=i.height,n}L(hG,"insertMeasuredNode");async function dG(e,t){const r=new Ux({multigraph:!0,compound:!0}),n=[...t.edges],i=ur(),a=cG(e),{edgeLabels:s,nodes:l}=a,c=new Map,h=e.node()!=null;await Promise.all(t.nodes.map(async d=>{if(d.isGroup)h&&await uG(l,d),r.setNode(d.id,{...d});else{if(h){const f=await hG(l,d,{config:i,dir:d.dir});c.set(d.id,f)}r.setNode(d.id,{...d})}}));for(const d of n)h&&PV(d)&&await P_(s,d),r.setEdge(d.start,d.end,{...d},d.id),t.edges.some(m=>m.id===d.id)||t.edges.push(d);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:d}=await Q(async()=>{const{captureNodeSizes:f}=await import("./sizeCapture-INFHLROL-B3t4qjgE.js");return{captureNodeSizes:f}},[]);d(e,t)}return{graph:r,groups:a,nodeElements:c}}L(dG,"createGraphWithElements");var xr=new Map,vh=new Map,fG=new Map,PCe=L(()=>{vh.clear(),fG.clear(),xr.clear()},"clear"),qm=L((e,t)=>{const r=vh.get(t)||[];return De.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),FCe=L((e,t)=>{const r=vh.get(t)||[];return De.info("Descendants of ",t," is ",r),De.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||qm(e.v,t)||qm(e.w,t)||r.includes(e.w):(De.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),pG=L((e,t,r,n)=>{De.debug("Copying children of ",e,"root",n,"data",t.node(e),n);const i=t.children(e)||[];e!==n&&i.push(e),De.debug("Copying (nodes) clusterId",e,"nodes",i),i.forEach(a=>{if(t.children(a).length>0)pG(a,t,r,n);else{const s=t.node(a);De.info("cp ",a," to ",n," with parent ",e),r.setNode(a,s),n!==t.parent(a)&&(De.debug("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==n&&a!==e?(De.debug("Setting parent",a,e),r.setParent(a,e)):(De.info("In copy ",e,"root",n,"data",t.node(e),n),De.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==n,"node!==clusterId",a!==e));const l=t.edges(a);De.debug("Copying Edges",l),l.forEach(c=>{De.info("Edge",c);const h=t.edge(c.v,c.w,c.name);De.info("Edge data",h,n);try{FCe(c,n)?(De.info("Copying as ",c.v,c.w,h,c.name),r.setEdge(c.v,c.w,h,c.name),De.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):De.info("Skipping copy of edge ",c.v,"-->",c.w," rootId: ",n," clusterId:",e)}catch(d){De.error(d)}})}De.debug("Removing node",a),t.removeNode(a)})},"copy"),mG=L((e,t)=>{const r=t.children(e);let n=[...r];for(const i of r)fG.set(i,e),n=[...n,...mG(i,t)];return n},"extractDescendants"),$Ce=L((e,t,r)=>{const n=e.edges().filter(c=>c.v===t||c.w===t),i=e.edges().filter(c=>c.v===r||c.w===r),a=n.map(c=>({v:c.v===t?r:c.v,w:c.w===t?t:c.w})),s=i.map(c=>({v:c.v,w:c.w}));return a.filter(c=>s.some(h=>c.v===h.v&&c.w===h.w))},"findCommonEdges"),v2=L((e,t,r)=>{const n=t.children(e);if(De.trace("Searching children of id ",e,n),n.length<1)return e;let i;for(const a of n){const s=v2(a,t,r),l=$Ce(t,r,s);if(s)if(l.length>0)i=s;else return s}return i},"findNonClusterChild"),bR=L(e=>!xr.has(e)||!xr.get(e).externalConnections?e:xr.has(e)?xr.get(e).id:e,"getAnchorId"),lje=L((e,t)=>{if(!e||t>10){De.debug("Opting out, no graph ");return}else De.debug("Opting in, graph ");e.nodes().forEach(function(r){e.children(r).length>0&&(De.debug("Cluster identified",r," Replacement id in edges: ",v2(r,e,r)),vh.set(r,mG(r,e)),xr.set(r,{id:v2(r,e,r),clusterData:e.node(r)}))}),e.nodes().forEach(function(r){const n=e.children(r),i=e.edges();n.length>0?(De.debug("Cluster identified",r,vh),i.forEach(a=>{const s=qm(a.v,r),l=qm(a.w,r);s^l&&(De.debug("Edge: ",a," leaves cluster ",r),De.debug("Descendants of XXX ",r,": ",vh.get(r)),xr.get(r).externalConnections=!0)})):De.debug("Not a cluster ",r,vh)});for(let r of xr.keys()){const n=xr.get(r).id,i=e.parent(n);i!==r&&xr.has(i)&&!xr.get(i).externalConnections&&(xr.get(r).id=i);const a=e.edges().some(s=>s.v===r);if(n&&xr.get(r)?.externalConnections&&a&&bG(e,n,r)){const s=zCe(e,r,e.parent(n));s&&(xr.get(r).id=s)}}e.edges().forEach(function(r){const n=e.edge(r);De.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),De.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(e.edge(r)));let i=r.v,a=r.w;if(De.debug("Fix XXX",xr,"ids:",r.v,r.w,"Translating: ",xr.get(r.v)," --- ",xr.get(r.w)),xr.get(r.v)||xr.get(r.w)){if(De.debug("Fixing and trying - removing XXX",r.v,r.w,r.name),i=bR(r.v),a=bR(r.w),e.removeEdge(r.v,r.w,r.name),i!==r.v){const s=e.parent(i);xr.get(s).externalConnections=!0,n.fromCluster=r.v}if(a!==r.w){const s=e.parent(a);xr.get(s).externalConnections=!0,n.toCluster=r.w}De.debug("Fix Replacing with XXX",i,a,r.name),e.setEdge(i,a,n,r.name)}}),gG(e,0),De.trace(xr)},"adjustClustersAndEdges"),gG=L((e,t)=>{if(t>10){De.error("Bailing out");return}let r=e.nodes(),n=!1;for(const i of r){const a=e.children(i);n=n||a.length>0}if(!n){De.debug("Done, no node has children",e.nodes());return}De.debug("Nodes = ",r,t);for(const i of r)if(De.debug("Extracting node",i,xr,xr.has(i)&&!xr.get(i).externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),!xr.has(i))De.debug("Not a cluster",i,t);else if(!xr.get(i).externalConnections&&e.children(i)&&e.children(i).length>0){De.debug("Cluster without external connections, without a parent and with children",i,t);let s=e.graph().rankdir==="TB"?"LR":"TB";xr.get(i)?.clusterData?.dir&&(s=xr.get(i).clusterData.dir,De.debug("Fixing dir",xr.get(i).clusterData.dir,s));const l=new Ux({multigraph:!0,compound:!0}).setGraph({rankdir:s,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});pG(i,e,l,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:xr.get(i).clusterData,label:xr.get(i).label,graph:l})}else De.debug("Cluster ** ",i," **not meeting the criteria !externalConnections:",!xr.get(i).externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),De.debug(xr);r=e.nodes(),De.debug("New list of nodes",r);for(const i of r){const a=e.node(i);De.debug(" Now next level",i,a),a?.clusterNode&&gG(a.graph,t+1)}},"extractor"),yG=L((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(n=>{const i=e.children(n),a=yG(e,i);r=[...r,...a]}),r},"sorter"),cje=L(e=>yG(e,e.children()),"sortNodesByHierarchy"),bG=L((e,t,r)=>{let n=e.parent(t);for(;n&&n!==r;){const i=xr.get(n);if(i&&!i.externalConnections)return!0;n=e.parent(n)}return!1},"isNodeInExtractableCluster"),zCe=L((e,t,r)=>{const n=e.children(t)??[];for(const i of n){if(i===r||qm(i,r))continue;const a=v2(i,e,t);if(a&&!bG(e,a,t))return a}return null},"findSafeAnchorNode");function jCe({prepareLayout:e,measureLayout:t,runLayoutCore:r,paintLayout:n,afterPaint:i,paintOptions:a}){const s=t??vG;return L(async function(c,h,d,f){const m=h.select("g");(d?.insertMarkers??HV)(m,c.markers,c.type,c.diagramId),xG();const g={element:m,helpers:d,options:f};g.preparedLayout=await e?.(c,g);const b=await s(c,g),x=await r(c,g),k={...g,measure:b};n?await n(c,k,x):await CG(c,k,a),await i?.(c,k,x)},"render")}L(jCe,"createCommonLayoutRenderer");function xG(){ixe(),bxe(),dxe(),PCe()}L(xG,"clearLayoutRenderState");async function vG(e,{element:t}){return await dG(t,e)}L(vG,"defaultMeasureLayout");async function CG(e,t,r={}){const{measure:n}=t,{groups:i}=n;for(const s of r.getNodes?.(e,t)??e.nodes)r.skipNode?.(s,t)||await kG(i,s,t,r);const a=wG(e.nodes);for(const s of e.edges)_G(s,r)||await SG(i,s,a,e,r,t)}L(CG,"paintLayoutData");async function kG(e,t,r,n){t.clusterNode?$B(t):TG(t,r,n)?await IV(e.clusters,t):$B(t)}L(kG,"paintLayoutNode");function TG(e,t,r){return e.isGroup===!0&&(r.isCluster?.(e,t)??!0)}L(TG,"shouldPaintAsCluster");function wG(e){const t=new Map;for(const r of e)r?.id&&t.set(r.id,r);return t}L(wG,"buildNodeLookup");function _G(e,t){return e.isLayoutOnly||!!t.skipEdge?.(e)}L(_G,"shouldSkipPaintEdge");async function SG(e,t,r,n,i,a){const s=$V(e.edgePaths,{...t},i.clusterDb??new Map,n.type,jT(t.start,t,r,a,i),jT(t.end,t,r,a,i),n.diagramId,EG(t,i));PV(t)&&(X0.has(t.id)||await P_(e.edgeLabels,t),AG(t,s))}L(SG,"paintLayoutEdge");function jT(e,t,r,n,i){return i.getEdgeNode?.(e,t,n)??(e?r.get(e)??{}:{})}L(jT,"getRenderedNode");function EG(e,t){return typeof t.skipIntersect=="function"?t.skipIntersect(e):t.skipIntersect??!1}L(EG,"shouldSkipIntersect");function AG(e,t){const r=t?.updatedPath??t?.originalPath,n=pn(),{subGraphTitleTotalMargin:i}=Dx({flowchart:n.flowchart??{}});if(e.label){const a=X0.get(e.id);let s=e.x,l=e.y;if(r){const c=Vi.calcLabelPosition(r);De.debug("Moving label "+e.label+" from (",s,",",l,") to (",c.x,",",c.y,") abc88"),t?.updatedPath&&(s=c.x,l=c.y)}a.attr("transform",`translate(${s}, ${l+i/2})`)}if(e?.startLabelLeft){const a=Mn.get(e.id).startLeft;let s=e?.x,l=e?.y;if(r){const c=Vi.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=c.x,l=c.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.startLabelRight){const a=Mn.get(e.id).startRight;let s=e.x,l=e.y;if(r){const c=Vi.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=c.x,l=c.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.endLabelLeft){const a=Mn.get(e.id).endLeft;let s=e.x,l=e.y;if(r){const c=Vi.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=c.x,l=c.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.endLabelRight){const a=Mn.get(e.id).endRight;let s=e.x,l=e.y;if(r){const c=Vi.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=c.x,l=c.y}a.attr("transform",`translate(${s}, ${l})`)}}L(AG,"positionRenderedEdgeLabel");function LG(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}L(LG,"getDefaultExportFromCjs");var zi={},wy={},jc={},xR;function xf(){if(xR)return jc;xR=1;function e(s){return typeof s>"u"||s===null}L(e,"isNothing");function t(s){return typeof s=="object"&&s!==null}L(t,"isObject");function r(s){return Array.isArray(s)?s:e(s)?[]:[s]}L(r,"toArray");function n(s,l){if(l){const c=Object.keys(l);for(let h=0,d=c.length;h<d;h+=1){const f=c[h];s[f]=l[f]}}return s}L(n,"extend");function i(s,l){let c="";for(let h=0;h<l;h+=1)c+=s;return c}L(i,"repeat");function a(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return L(a,"isNegativeZero"),jc.isNothing=e,jc.isObject=t,jc.toArray=r,jc.repeat=i,jc.isNegativeZero=a,jc.extend=n,jc}L(xf,"requireCommon");var KC,vR;function vf(){if(vR)return KC;vR=1;function e(r,n){let i="";const a=r.reason||"(unknown reason)";return r.mark?(r.mark.name&&(i+='in "'+r.mark.name+'" '),i+="("+(r.mark.line+1)+":"+(r.mark.column+1)+")",!n&&r.mark.snippet&&(i+=`
|
|
709
|
+
L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),Gxe=L((e,t,r)=>{const n=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");n.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),n.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),n.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),Wxe=L((e,t,r)=>{const n=pn(),{themeVariables:i}=n,{strokeWidth:a}=i,s=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");s.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),s.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),s.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),s.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),Yxe={extension:Sxe,composition:Exe,aggregation:Axe,dependency:Lxe,lollipop:Nxe,point:Mxe,circle:Bxe,cross:Rxe,barb:Oxe,barbNeo:Dxe,only_one:Ixe,zero_or_one:Pxe,one_or_more:Fxe,zero_or_more:$xe,only_one_neo:zxe,zero_or_one_neo:jxe,one_or_more_neo:Hxe,zero_or_more_neo:Uxe,requirement_arrow:qxe,requirement_contains:Gxe,requirement_arrow_neo:Vxe,requirement_contains_neo:Wxe},HV=_xe,UV=typeof global=="object"&&global&&global.Object===Object&&global,Xxe=typeof self=="object"&&self&&self.Object===Object&&self,ic=UV||Xxe||Function("return this")(),Jo=ic.Symbol,qV=Object.prototype,Kxe=qV.hasOwnProperty,Qxe=qV.toString,Bp=Jo?Jo.toStringTag:void 0;function Zxe(e){var t=Kxe.call(e,Bp),r=e[Bp];try{e[Bp]=void 0;var n=!0}catch{}var i=Qxe.call(e);return n&&(t?e[Bp]=r:delete e[Bp]),i}var Jxe=Object.prototype,eve=Jxe.toString;function tve(e){return eve.call(e)}var rve="[object Null]",nve="[object Undefined]",qB=Jo?Jo.toStringTag:void 0;function bf(e){return e==null?e===void 0?nve:rve:qB&&qB in Object(e)?Zxe(e):tve(e)}function $h(e){return e!=null&&typeof e=="object"}var ive="[object Symbol]";function F_(e){return typeof e=="symbol"||$h(e)&&bf(e)==ive}function VV(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var Sa=Array.isArray,VB=Jo?Jo.prototype:void 0,GB=VB?VB.toString:void 0;function GV(e){if(typeof e=="string")return e;if(Sa(e))return VV(e,GV)+"";if(F_(e))return GB?GB.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function $_(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Px(e){return e}var ave="[object AsyncFunction]",sve="[object Function]",ove="[object GeneratorFunction]",lve="[object Proxy]";function b2(e){if(!$_(e))return!1;var t=bf(e);return t==sve||t==ove||t==ave||t==lve}var VC=ic["__core-js_shared__"],WB=(function(){var e=/[^.]+$/.exec(VC&&VC.keys&&VC.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function cve(e){return!!WB&&WB in e}var uve=Function.prototype,hve=uve.toString;function Jh(e){if(e!=null){try{return hve.call(e)}catch{}try{return e+""}catch{}}return""}var dve=/[\\^$.*+?()[\]{}|]/g,fve=/^\[object .+?Constructor\]$/,pve=Function.prototype,mve=Object.prototype,gve=pve.toString,yve=mve.hasOwnProperty,bve=RegExp("^"+gve.call(yve).replace(dve,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xve(e){if(!$_(e)||cve(e))return!1;var t=b2(e)?bve:fve;return t.test(Jh(e))}function vve(e,t){return e?.[t]}function ed(e,t){var r=vve(e,t);return xve(r)?r:void 0}var FT=ed(ic,"WeakMap");function Cve(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function kve(){}var Tve=800,wve=16,_ve=Date.now;function Sve(e){var t=0,r=0;return function(){var n=_ve(),i=wve-(n-r);if(r=n,i>0){if(++t>=Tve)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function em(e){return function(){return e}}var YB=(function(){try{var e=ed(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Eve=YB?function(e,t){return YB(e,"toString",{configurable:!0,enumerable:!1,value:em(t),writable:!0})}:Px,Ave=Sve(Eve);function Lve(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}function Nve(e,t,r,n){for(var i=e.length,a=r+-1;++a<i;)if(t(e[a],a,e))return a;return-1}function Mve(e){return e!==e}function Bve(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function Rve(e,t,r){return t===t?Bve(e,t,r):Nve(e,Mve,r)}function Ove(e,t){var r=e==null?0:e.length;return!!r&&Rve(e,t,0)>-1}var Dve=9007199254740991,Ive=/^(?:0|[1-9]\d*)$/;function WV(e,t){var r=typeof e;return t=t??Dve,!!t&&(r=="number"||r!="symbol"&&Ive.test(e))&&e>-1&&e%1==0&&e<t}function YV(e,t){return e===t||e!==e&&t!==t}var XB=Math.max;function Pve(e,t,r){return t=XB(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=XB(n.length-t,0),s=Array(a);++i<a;)s[i]=n[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=n[i];return l[t]=r(s),Cve(e,this,l)}}function Fve(e,t){return Ave(Pve(e,t,Px),e+"")}var $ve=9007199254740991;function z_(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$ve}function Fx(e){return e!=null&&z_(e.length)&&!b2(e)}var zve=Object.prototype;function XV(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||zve;return e===r}function jve(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Hve="[object Arguments]";function KB(e){return $h(e)&&bf(e)==Hve}var KV=Object.prototype,Uve=KV.hasOwnProperty,qve=KV.propertyIsEnumerable,$x=KB((function(){return arguments})())?KB:function(e){return $h(e)&&Uve.call(e,"callee")&&!qve.call(e,"callee")};function Vve(){return!1}var QV=typeof exports=="object"&&exports&&!exports.nodeType&&exports,QB=QV&&typeof module=="object"&&module&&!module.nodeType&&module,Gve=QB&&QB.exports===QV,ZB=Gve?ic.Buffer:void 0,Wve=ZB?ZB.isBuffer:void 0,x2=Wve||Vve,Yve="[object Arguments]",Xve="[object Array]",Kve="[object Boolean]",Qve="[object Date]",Zve="[object Error]",Jve="[object Function]",e3e="[object Map]",t3e="[object Number]",r3e="[object Object]",n3e="[object RegExp]",i3e="[object Set]",a3e="[object String]",s3e="[object WeakMap]",o3e="[object ArrayBuffer]",l3e="[object DataView]",c3e="[object Float32Array]",u3e="[object Float64Array]",h3e="[object Int8Array]",d3e="[object Int16Array]",f3e="[object Int32Array]",p3e="[object Uint8Array]",m3e="[object Uint8ClampedArray]",g3e="[object Uint16Array]",y3e="[object Uint32Array]",en={};en[c3e]=en[u3e]=en[h3e]=en[d3e]=en[f3e]=en[p3e]=en[m3e]=en[g3e]=en[y3e]=!0;en[Yve]=en[Xve]=en[o3e]=en[Kve]=en[l3e]=en[Qve]=en[Zve]=en[Jve]=en[e3e]=en[t3e]=en[r3e]=en[n3e]=en[i3e]=en[a3e]=en[s3e]=!1;function b3e(e){return $h(e)&&z_(e.length)&&!!en[bf(e)]}function x3e(e){return function(t){return e(t)}}var ZV=typeof exports=="object"&&exports&&!exports.nodeType&&exports,mm=ZV&&typeof module=="object"&&module&&!module.nodeType&&module,v3e=mm&&mm.exports===ZV,GC=v3e&&UV.process,JB=(function(){try{var e=mm&&mm.require&&mm.require("util").types;return e||GC&&GC.binding&&GC.binding("util")}catch{}})(),eR=JB&&JB.isTypedArray,j_=eR?x3e(eR):b3e,C3e=Object.prototype,k3e=C3e.hasOwnProperty;function T3e(e,t){var r=Sa(e),n=!r&&$x(e),i=!r&&!n&&x2(e),a=!r&&!n&&!i&&j_(e),s=r||n||i||a,l=s?jve(e.length,String):[],c=l.length;for(var h in e)(t||k3e.call(e,h))&&!(s&&(h=="length"||i&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||WV(h,c)))&&l.push(h);return l}function w3e(e,t){return function(r){return e(t(r))}}var _3e=w3e(Object.keys,Object),S3e=Object.prototype,E3e=S3e.hasOwnProperty;function JV(e){if(!XV(e))return _3e(e);var t=[];for(var r in Object(e))E3e.call(e,r)&&r!="constructor"&&t.push(r);return t}function qo(e){return Fx(e)?T3e(e):JV(e)}var A3e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,L3e=/^\w*$/;function H_(e,t){if(Sa(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||F_(e)?!0:L3e.test(e)||!A3e.test(e)||t!=null&&e in Object(t)}var jm=ed(Object,"create");function N3e(){this.__data__=jm?jm(null):{},this.size=0}function M3e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var B3e="__lodash_hash_undefined__",R3e=Object.prototype,O3e=R3e.hasOwnProperty;function D3e(e){var t=this.__data__;if(jm){var r=t[e];return r===B3e?void 0:r}return O3e.call(t,e)?t[e]:void 0}var I3e=Object.prototype,P3e=I3e.hasOwnProperty;function F3e(e){var t=this.__data__;return jm?t[e]!==void 0:P3e.call(t,e)}var $3e="__lodash_hash_undefined__";function z3e(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=jm&&t===void 0?$3e:t,this}function zh(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}zh.prototype.clear=N3e;zh.prototype.delete=M3e;zh.prototype.get=D3e;zh.prototype.has=F3e;zh.prototype.set=z3e;function j3e(){this.__data__=[],this.size=0}function zx(e,t){for(var r=e.length;r--;)if(YV(e[r][0],t))return r;return-1}var H3e=Array.prototype,U3e=H3e.splice;function q3e(e){var t=this.__data__,r=zx(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():U3e.call(t,r,1),--this.size,!0}function V3e(e){var t=this.__data__,r=zx(t,e);return r<0?void 0:t[r][1]}function G3e(e){return zx(this.__data__,e)>-1}function W3e(e,t){var r=this.__data__,n=zx(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ac(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ac.prototype.clear=j3e;ac.prototype.delete=q3e;ac.prototype.get=V3e;ac.prototype.has=G3e;ac.prototype.set=W3e;var Hm=ed(ic,"Map");function Y3e(){this.size=0,this.__data__={hash:new zh,map:new(Hm||ac),string:new zh}}function X3e(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function jx(e,t){var r=e.__data__;return X3e(t)?r[typeof t=="string"?"string":"hash"]:r.map}function K3e(e){var t=jx(this,e).delete(e);return this.size-=t?1:0,t}function Q3e(e){return jx(this,e).get(e)}function Z3e(e){return jx(this,e).has(e)}function J3e(e,t){var r=jx(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function sc(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}sc.prototype.clear=Y3e;sc.prototype.delete=K3e;sc.prototype.get=Q3e;sc.prototype.has=Z3e;sc.prototype.set=J3e;var e4e="Expected a function";function U_(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(e4e);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var s=e.apply(this,n);return r.cache=a.set(i,s)||a,s};return r.cache=new(U_.Cache||sc),r}U_.Cache=sc;var t4e=500;function r4e(e){var t=U_(e,function(n){return r.size===t4e&&r.clear(),n}),r=t.cache;return t}var n4e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i4e=/\\(\\)?/g,a4e=r4e(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(n4e,function(r,n,i,a){t.push(i?a.replace(i4e,"$1"):n||r)}),t});function s4e(e){return e==null?"":GV(e)}function eG(e,t){return Sa(e)?e:H_(e,t)?[e]:a4e(s4e(e))}function Hx(e){if(typeof e=="string"||F_(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function tG(e,t){t=eG(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Hx(t[r++])];return r&&r==n?e:void 0}function o4e(e,t,r){var n=e==null?void 0:tG(e,t);return n===void 0?r:n}function rG(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var tR=Jo?Jo.isConcatSpreadable:void 0;function l4e(e){return Sa(e)||$x(e)||!!(tR&&e&&e[tR])}function c4e(e,t,r,n,i){var a=-1,s=e.length;for(r||(r=l4e),i||(i=[]);++a<s;){var l=e[a];r(l)?rG(i,l):n||(i[i.length]=l)}return i}function u4e(e,t,r,n){var i=-1,a=e==null?0:e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}function h4e(){this.__data__=new ac,this.size=0}function d4e(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function f4e(e){return this.__data__.get(e)}function p4e(e){return this.__data__.has(e)}var m4e=200;function g4e(e,t){var r=this.__data__;if(r instanceof ac){var n=r.__data__;if(!Hm||n.length<m4e-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new sc(n)}return r.set(e,t),this.size=r.size,this}function Xl(e){var t=this.__data__=new ac(e);this.size=t.size}Xl.prototype.clear=h4e;Xl.prototype.delete=d4e;Xl.prototype.get=f4e;Xl.prototype.has=p4e;Xl.prototype.set=g4e;function nG(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var s=e[r];t(s,r,e)&&(a[i++]=s)}return a}function y4e(){return[]}var b4e=Object.prototype,x4e=b4e.propertyIsEnumerable,rR=Object.getOwnPropertySymbols,v4e=rR?function(e){return e==null?[]:(e=Object(e),nG(rR(e),function(t){return x4e.call(e,t)}))}:y4e;function C4e(e,t,r){var n=t(e);return Sa(e)?n:rG(n,r(e))}function nR(e){return C4e(e,qo,v4e)}var $T=ed(ic,"DataView"),zT=ed(ic,"Promise"),x0=ed(ic,"Set"),iR="[object Map]",k4e="[object Object]",aR="[object Promise]",sR="[object Set]",oR="[object WeakMap]",lR="[object DataView]",T4e=Jh($T),w4e=Jh(Hm),_4e=Jh(zT),S4e=Jh(x0),E4e=Jh(FT),Ul=bf;($T&&Ul(new $T(new ArrayBuffer(1)))!=lR||Hm&&Ul(new Hm)!=iR||zT&&Ul(zT.resolve())!=aR||x0&&Ul(new x0)!=sR||FT&&Ul(new FT)!=oR)&&(Ul=function(e){var t=bf(e),r=t==k4e?e.constructor:void 0,n=r?Jh(r):"";if(n)switch(n){case T4e:return lR;case w4e:return iR;case _4e:return aR;case S4e:return sR;case E4e:return oR}return t});var cR=ic.Uint8Array,A4e="__lodash_hash_undefined__";function L4e(e){return this.__data__.set(e,A4e),this}function N4e(e){return this.__data__.has(e)}function Um(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new sc;++t<r;)this.add(e[t])}Um.prototype.add=Um.prototype.push=L4e;Um.prototype.has=N4e;function M4e(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function iG(e,t){return e.has(t)}var B4e=1,R4e=2;function aG(e,t,r,n,i,a){var s=r&B4e,l=e.length,c=t.length;if(l!=c&&!(s&&c>l))return!1;var h=a.get(e),d=a.get(t);if(h&&d)return h==t&&d==e;var f=-1,m=!0,g=r&R4e?new Um:void 0;for(a.set(e,t),a.set(t,e);++f<l;){var b=e[f],x=t[f];if(n)var k=s?n(x,b,f,t,e,a):n(b,x,f,e,t,a);if(k!==void 0){if(k)continue;m=!1;break}if(g){if(!M4e(t,function(w,_){if(!iG(g,_)&&(b===w||i(b,w,r,n,a)))return g.push(_)})){m=!1;break}}else if(!(b===x||i(b,x,r,n,a))){m=!1;break}}return a.delete(e),a.delete(t),m}function O4e(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function q_(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var D4e=1,I4e=2,P4e="[object Boolean]",F4e="[object Date]",$4e="[object Error]",z4e="[object Map]",j4e="[object Number]",H4e="[object RegExp]",U4e="[object Set]",q4e="[object String]",V4e="[object Symbol]",G4e="[object ArrayBuffer]",W4e="[object DataView]",uR=Jo?Jo.prototype:void 0,WC=uR?uR.valueOf:void 0;function Y4e(e,t,r,n,i,a,s){switch(r){case W4e:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case G4e:return!(e.byteLength!=t.byteLength||!a(new cR(e),new cR(t)));case P4e:case F4e:case j4e:return YV(+e,+t);case $4e:return e.name==t.name&&e.message==t.message;case H4e:case q4e:return e==t+"";case z4e:var l=O4e;case U4e:var c=n&D4e;if(l||(l=q_),e.size!=t.size&&!c)return!1;var h=s.get(e);if(h)return h==t;n|=I4e,s.set(e,t);var d=aG(l(e),l(t),n,i,a,s);return s.delete(e),d;case V4e:if(WC)return WC.call(e)==WC.call(t)}return!1}var X4e=1,K4e=Object.prototype,Q4e=K4e.hasOwnProperty;function Z4e(e,t,r,n,i,a){var s=r&X4e,l=nR(e),c=l.length,h=nR(t),d=h.length;if(c!=d&&!s)return!1;for(var f=c;f--;){var m=l[f];if(!(s?m in t:Q4e.call(t,m)))return!1}var g=a.get(e),b=a.get(t);if(g&&b)return g==t&&b==e;var x=!0;a.set(e,t),a.set(t,e);for(var k=s;++f<c;){m=l[f];var w=e[m],_=t[m];if(n)var S=s?n(_,w,m,t,e,a):n(w,_,m,e,t,a);if(!(S===void 0?w===_||i(w,_,r,n,a):S)){x=!1;break}k||(k=m=="constructor")}if(x&&!k){var N=e.constructor,B=t.constructor;N!=B&&"constructor"in e&&"constructor"in t&&!(typeof N=="function"&&N instanceof N&&typeof B=="function"&&B instanceof B)&&(x=!1)}return a.delete(e),a.delete(t),x}var J4e=1,hR="[object Arguments]",dR="[object Array]",ky="[object Object]",eCe=Object.prototype,fR=eCe.hasOwnProperty;function tCe(e,t,r,n,i,a){var s=Sa(e),l=Sa(t),c=s?dR:Ul(e),h=l?dR:Ul(t);c=c==hR?ky:c,h=h==hR?ky:h;var d=c==ky,f=h==ky,m=c==h;if(m&&x2(e)){if(!x2(t))return!1;s=!0,d=!1}if(m&&!d)return a||(a=new Xl),s||j_(e)?aG(e,t,r,n,i,a):Y4e(e,t,c,r,n,i,a);if(!(r&J4e)){var g=d&&fR.call(e,"__wrapped__"),b=f&&fR.call(t,"__wrapped__");if(g||b){var x=g?e.value():e,k=b?t.value():t;return a||(a=new Xl),i(x,k,r,n,a)}}return m?(a||(a=new Xl),Z4e(e,t,r,n,i,a)):!1}function V_(e,t,r,n,i){return e===t?!0:e==null||t==null||!$h(e)&&!$h(t)?e!==e&&t!==t:tCe(e,t,r,n,V_,i)}var rCe=1,nCe=2;function iCe(e,t,r,n){var i=r.length,a=i;if(e==null)return!a;for(e=Object(e);i--;){var s=r[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=r[i];var l=s[0],c=e[l],h=s[1];if(s[2]){if(c===void 0&&!(l in e))return!1}else{var d=new Xl,f;if(!(f===void 0?V_(h,c,rCe|nCe,n,d):f))return!1}}return!0}function sG(e){return e===e&&!$_(e)}function aCe(e){for(var t=qo(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,sG(i)]}return t}function oG(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function sCe(e){var t=aCe(e);return t.length==1&&t[0][2]?oG(t[0][0],t[0][1]):function(r){return r===e||iCe(r,e,t)}}function oCe(e,t){return e!=null&&t in Object(e)}function lCe(e,t,r){t=eG(t,e);for(var n=-1,i=t.length,a=!1;++n<i;){var s=Hx(t[n]);if(!(a=e!=null&&r(e,s)))break;e=e[s]}return a||++n!=i?a:(i=e==null?0:e.length,!!i&&z_(i)&&WV(s,i)&&(Sa(e)||$x(e)))}function cCe(e,t){return e!=null&&lCe(e,t,oCe)}var uCe=1,hCe=2;function dCe(e,t){return H_(e)&&sG(t)?oG(Hx(e),t):function(r){var n=o4e(r,e);return n===void 0&&n===t?cCe(r,e):V_(t,n,uCe|hCe)}}function fCe(e){return function(t){return t?.[e]}}function pCe(e){return function(t){return tG(t,e)}}function mCe(e){return H_(e)?fCe(Hx(e)):pCe(e)}function lG(e){return typeof e=="function"?e:e==null?Px:typeof e=="object"?Sa(e)?dCe(e[0],e[1]):sCe(e):mCe(e)}function gCe(e){return function(t,r,n){for(var i=-1,a=Object(t),s=n(t),l=s.length;l--;){var c=s[++i];if(r(a[c],c,a)===!1)break}return t}}var yCe=gCe();function bCe(e,t){return e&&yCe(e,t,qo)}function xCe(e,t){return function(r,n){if(r==null)return r;if(!Fx(r))return e(r,n);for(var i=r.length,a=-1,s=Object(r);++a<i&&n(s[a],a,s)!==!1;);return r}}var G_=xCe(bCe);function vCe(e){return $h(e)&&Fx(e)}function CCe(e){return typeof e=="function"?e:Px}function rh(e,t){var r=Sa(e)?Lve:G_;return r(e,CCe(t))}function kCe(e,t){var r=[];return G_(e,function(n,i,a){t(n,i,a)&&r.push(n)}),r}function Ty(e,t){var r=Sa(e)?nG:kCe;return r(e,lG(t))}function TCe(e,t){return VV(t,function(r){return e[r]})}function YC(e){return e==null?[]:TCe(e,qo(e))}var wCe="[object Map]",_Ce="[object Set]",SCe=Object.prototype,ECe=SCe.hasOwnProperty;function pR(e){if(e==null)return!0;if(Fx(e)&&(Sa(e)||typeof e=="string"||typeof e.splice=="function"||x2(e)||j_(e)||$x(e)))return!e.length;var t=Ul(e);if(t==wCe||t==_Ce)return!e.size;if(XV(e))return!JV(e).length;for(var r in e)if(ECe.call(e,r))return!1;return!0}function i0(e){return e===void 0}function ACe(e,t,r,n,i){return i(e,function(a,s,l){r=n?(n=!1,a):t(r,a,s,l)}),r}function LCe(e,t,r){var n=Sa(e)?u4e:ACe,i=arguments.length<3;return n(e,lG(t),r,i,G_)}var NCe=1/0,MCe=x0&&1/q_(new x0([,-0]))[1]==NCe?function(e){return new x0(e)}:kve,BCe=200;function RCe(e,t,r){var n=-1,i=Ove,a=e.length,s=!0,l=[],c=l;if(a>=BCe){var h=MCe(e);if(h)return q_(h);s=!1,i=iG,c=new Um}else c=l;e:for(;++n<a;){var d=e[n],f=d;if(d=d!==0?d:0,s&&f===f){for(var m=c.length;m--;)if(c[m]===f)continue e;l.push(d)}else i(c,f,r)||(c!==l&&c.push(f),l.push(d))}return l}var OCe=Fve(function(e){return RCe(c4e(e,1,vCe,!0))}),DCe="\0",nh="\0",mR="";class Ux{constructor(t={}){this._isDirected=Object.prototype.hasOwnProperty.call(t,"directed")?t.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(t,"multigraph")?t.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=em(void 0),this._defaultEdgeLabelFn=em(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[nh]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return b2(t)||(t=em(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return qo(this._nodes)}sources(){var t=this;return Ty(this.nodes(),function(r){return pR(t._in[r])})}sinks(){var t=this;return Ty(this.nodes(),function(r){return pR(t._out[r])})}setNodes(t,r){var n=arguments,i=this;return rh(t,function(a){n.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=nh,this._children[t]={},this._children[nh][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],rh(this.children(t),n=>{this.setParent(n)}),delete this._children[t]),rh(qo(this._in[t]),r),delete this._in[t],delete this._preds[t],rh(qo(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i0(r))r=nh;else{r+="";for(var n=r;!i0(n);n=this.parent(n))if(n===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==nh)return r}}children(t){if(i0(t)&&(t=nh),this._isCompound){var r=this._children[t];if(r)return qo(r)}else{if(t===nh)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return qo(r)}successors(t){var r=this._sucs[t];if(r)return qo(r)}neighbors(t){var r=this.predecessors(t);if(r)return OCe(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;rh(this._nodes,function(s,l){t(l)&&r.setNode(l,s)}),rh(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,n.edge(s))});var i={};function a(s){var l=n.parent(s);return l===void 0||r.hasNode(l)?(i[s]=l,l):l in i?i[l]:a(l)}return this._isCompound&&rh(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(t){return b2(t)||(t=em(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return YC(this._edgeObjs)}setPath(t,r){var n=this,i=arguments;return LCe(t,function(a,s){return i.length>1?n.setEdge(a,s,r):n.setEdge(a,s),s}),this}setEdge(){var t,r,n,i,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(t=s.v,r=s.w,n=s.name,arguments.length===2&&(i=arguments[1],a=!0)):(t=s,r=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),t=""+t,r=""+r,i0(n)||(n=""+n);var l=tm(this._isDirected,t,r,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,l))return a&&(this._edgeLabels[l]=i),this;if(!i0(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[l]=a?i:this._defaultEdgeLabelFn(t,r,n);var c=ICe(this._isDirected,t,r,n);return t=c.v,r=c.w,Object.freeze(c),this._edgeObjs[l]=c,gR(this._preds[r],t),gR(this._sucs[t],r),this._in[r][l]=c,this._out[t][l]=c,this._edgeCount++,this}edge(t,r,n){var i=arguments.length===1?XC(this._isDirected,arguments[0]):tm(this._isDirected,t,r,n);return this._edgeLabels[i]}hasEdge(t,r,n){var i=arguments.length===1?XC(this._isDirected,arguments[0]):tm(this._isDirected,t,r,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(t,r,n){var i=arguments.length===1?XC(this._isDirected,arguments[0]):tm(this._isDirected,t,r,n),a=this._edgeObjs[i];return a&&(t=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],yR(this._preds[r],t),yR(this._sucs[t],r),delete this._in[r][i],delete this._out[t][i],this._edgeCount--),this}inEdges(t,r){var n=this._in[t];if(n){var i=YC(n);return r?Ty(i,function(a){return a.v===r}):i}}outEdges(t,r){var n=this._out[t];if(n){var i=YC(n);return r?Ty(i,function(a){return a.w===r}):i}}nodeEdges(t,r){var n=this.inEdges(t,r);if(n)return n.concat(this.outEdges(t,r))}}Ux.prototype._nodeCount=0;Ux.prototype._edgeCount=0;function gR(e,t){e[t]?e[t]++:e[t]=1}function yR(e,t){--e[t]||delete e[t]}function tm(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var s=i;i=a,a=s}return i+mR+a+mR+(i0(n)?DCe:n)}function ICe(e,t,r,n){var i=""+t,a=""+r;if(!e&&i>a){var s=i;i=a,a=s}var l={v:i,w:a};return n&&(l.name=n),l}function XC(e,t){return tm(e,t.v,t.w,t.name)}function cG(e,{edgePathsClass:t="edges edgePaths"}={}){const r=e.insert("g").attr("class","root"),n=r.insert("g").attr("class","clusters"),i=r.insert("g").attr("class",t),a=r.insert("g").attr("class","edgeLabels"),s=r.insert("g").attr("class","nodes");return{clusters:n,edgePaths:i,edgeLabels:a,nodes:s,rootGroups:r}}L(cG,"createLayoutElementGroups");async function uG(e,t){if(t.label){const{shapeSvg:r,bbox:n}=await Mt(e,t);t.labelBBox={width:n.width,height:n.height},r.remove()}else t.labelBBox={width:0,height:0}}L(uG,"measureGroupLabel");async function hG(e,t,r){const n=await I_(e,t,r),i=n.node()?.getBBox()??{width:0,height:0};return t.width=i.width,t.height=i.height,n}L(hG,"insertMeasuredNode");async function dG(e,t){const r=new Ux({multigraph:!0,compound:!0}),n=[...t.edges],i=ur(),a=cG(e),{edgeLabels:s,nodes:l}=a,c=new Map,h=e.node()!=null;await Promise.all(t.nodes.map(async d=>{if(d.isGroup)h&&await uG(l,d),r.setNode(d.id,{...d});else{if(h){const f=await hG(l,d,{config:i,dir:d.dir});c.set(d.id,f)}r.setNode(d.id,{...d})}}));for(const d of n)h&&PV(d)&&await P_(s,d),r.setEdge(d.start,d.end,{...d},d.id),t.edges.some(m=>m.id===d.id)||t.edges.push(d);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:d}=await Q(async()=>{const{captureNodeSizes:f}=await import("./sizeCapture-INFHLROL-DoCKzHEB.js");return{captureNodeSizes:f}},[]);d(e,t)}return{graph:r,groups:a,nodeElements:c}}L(dG,"createGraphWithElements");var xr=new Map,vh=new Map,fG=new Map,PCe=L(()=>{vh.clear(),fG.clear(),xr.clear()},"clear"),qm=L((e,t)=>{const r=vh.get(t)||[];return De.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),FCe=L((e,t)=>{const r=vh.get(t)||[];return De.info("Descendants of ",t," is ",r),De.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||qm(e.v,t)||qm(e.w,t)||r.includes(e.w):(De.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),pG=L((e,t,r,n)=>{De.debug("Copying children of ",e,"root",n,"data",t.node(e),n);const i=t.children(e)||[];e!==n&&i.push(e),De.debug("Copying (nodes) clusterId",e,"nodes",i),i.forEach(a=>{if(t.children(a).length>0)pG(a,t,r,n);else{const s=t.node(a);De.info("cp ",a," to ",n," with parent ",e),r.setNode(a,s),n!==t.parent(a)&&(De.debug("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==n&&a!==e?(De.debug("Setting parent",a,e),r.setParent(a,e)):(De.info("In copy ",e,"root",n,"data",t.node(e),n),De.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==n,"node!==clusterId",a!==e));const l=t.edges(a);De.debug("Copying Edges",l),l.forEach(c=>{De.info("Edge",c);const h=t.edge(c.v,c.w,c.name);De.info("Edge data",h,n);try{FCe(c,n)?(De.info("Copying as ",c.v,c.w,h,c.name),r.setEdge(c.v,c.w,h,c.name),De.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):De.info("Skipping copy of edge ",c.v,"-->",c.w," rootId: ",n," clusterId:",e)}catch(d){De.error(d)}})}De.debug("Removing node",a),t.removeNode(a)})},"copy"),mG=L((e,t)=>{const r=t.children(e);let n=[...r];for(const i of r)fG.set(i,e),n=[...n,...mG(i,t)];return n},"extractDescendants"),$Ce=L((e,t,r)=>{const n=e.edges().filter(c=>c.v===t||c.w===t),i=e.edges().filter(c=>c.v===r||c.w===r),a=n.map(c=>({v:c.v===t?r:c.v,w:c.w===t?t:c.w})),s=i.map(c=>({v:c.v,w:c.w}));return a.filter(c=>s.some(h=>c.v===h.v&&c.w===h.w))},"findCommonEdges"),v2=L((e,t,r)=>{const n=t.children(e);if(De.trace("Searching children of id ",e,n),n.length<1)return e;let i;for(const a of n){const s=v2(a,t,r),l=$Ce(t,r,s);if(s)if(l.length>0)i=s;else return s}return i},"findNonClusterChild"),bR=L(e=>!xr.has(e)||!xr.get(e).externalConnections?e:xr.has(e)?xr.get(e).id:e,"getAnchorId"),lje=L((e,t)=>{if(!e||t>10){De.debug("Opting out, no graph ");return}else De.debug("Opting in, graph ");e.nodes().forEach(function(r){e.children(r).length>0&&(De.debug("Cluster identified",r," Replacement id in edges: ",v2(r,e,r)),vh.set(r,mG(r,e)),xr.set(r,{id:v2(r,e,r),clusterData:e.node(r)}))}),e.nodes().forEach(function(r){const n=e.children(r),i=e.edges();n.length>0?(De.debug("Cluster identified",r,vh),i.forEach(a=>{const s=qm(a.v,r),l=qm(a.w,r);s^l&&(De.debug("Edge: ",a," leaves cluster ",r),De.debug("Descendants of XXX ",r,": ",vh.get(r)),xr.get(r).externalConnections=!0)})):De.debug("Not a cluster ",r,vh)});for(let r of xr.keys()){const n=xr.get(r).id,i=e.parent(n);i!==r&&xr.has(i)&&!xr.get(i).externalConnections&&(xr.get(r).id=i);const a=e.edges().some(s=>s.v===r);if(n&&xr.get(r)?.externalConnections&&a&&bG(e,n,r)){const s=zCe(e,r,e.parent(n));s&&(xr.get(r).id=s)}}e.edges().forEach(function(r){const n=e.edge(r);De.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),De.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(e.edge(r)));let i=r.v,a=r.w;if(De.debug("Fix XXX",xr,"ids:",r.v,r.w,"Translating: ",xr.get(r.v)," --- ",xr.get(r.w)),xr.get(r.v)||xr.get(r.w)){if(De.debug("Fixing and trying - removing XXX",r.v,r.w,r.name),i=bR(r.v),a=bR(r.w),e.removeEdge(r.v,r.w,r.name),i!==r.v){const s=e.parent(i);xr.get(s).externalConnections=!0,n.fromCluster=r.v}if(a!==r.w){const s=e.parent(a);xr.get(s).externalConnections=!0,n.toCluster=r.w}De.debug("Fix Replacing with XXX",i,a,r.name),e.setEdge(i,a,n,r.name)}}),gG(e,0),De.trace(xr)},"adjustClustersAndEdges"),gG=L((e,t)=>{if(t>10){De.error("Bailing out");return}let r=e.nodes(),n=!1;for(const i of r){const a=e.children(i);n=n||a.length>0}if(!n){De.debug("Done, no node has children",e.nodes());return}De.debug("Nodes = ",r,t);for(const i of r)if(De.debug("Extracting node",i,xr,xr.has(i)&&!xr.get(i).externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),!xr.has(i))De.debug("Not a cluster",i,t);else if(!xr.get(i).externalConnections&&e.children(i)&&e.children(i).length>0){De.debug("Cluster without external connections, without a parent and with children",i,t);let s=e.graph().rankdir==="TB"?"LR":"TB";xr.get(i)?.clusterData?.dir&&(s=xr.get(i).clusterData.dir,De.debug("Fixing dir",xr.get(i).clusterData.dir,s));const l=new Ux({multigraph:!0,compound:!0}).setGraph({rankdir:s,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});pG(i,e,l,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:xr.get(i).clusterData,label:xr.get(i).label,graph:l})}else De.debug("Cluster ** ",i," **not meeting the criteria !externalConnections:",!xr.get(i).externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),De.debug(xr);r=e.nodes(),De.debug("New list of nodes",r);for(const i of r){const a=e.node(i);De.debug(" Now next level",i,a),a?.clusterNode&&gG(a.graph,t+1)}},"extractor"),yG=L((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(n=>{const i=e.children(n),a=yG(e,i);r=[...r,...a]}),r},"sorter"),cje=L(e=>yG(e,e.children()),"sortNodesByHierarchy"),bG=L((e,t,r)=>{let n=e.parent(t);for(;n&&n!==r;){const i=xr.get(n);if(i&&!i.externalConnections)return!0;n=e.parent(n)}return!1},"isNodeInExtractableCluster"),zCe=L((e,t,r)=>{const n=e.children(t)??[];for(const i of n){if(i===r||qm(i,r))continue;const a=v2(i,e,t);if(a&&!bG(e,a,t))return a}return null},"findSafeAnchorNode");function jCe({prepareLayout:e,measureLayout:t,runLayoutCore:r,paintLayout:n,afterPaint:i,paintOptions:a}){const s=t??vG;return L(async function(c,h,d,f){const m=h.select("g");(d?.insertMarkers??HV)(m,c.markers,c.type,c.diagramId),xG();const g={element:m,helpers:d,options:f};g.preparedLayout=await e?.(c,g);const b=await s(c,g),x=await r(c,g),k={...g,measure:b};n?await n(c,k,x):await CG(c,k,a),await i?.(c,k,x)},"render")}L(jCe,"createCommonLayoutRenderer");function xG(){ixe(),bxe(),dxe(),PCe()}L(xG,"clearLayoutRenderState");async function vG(e,{element:t}){return await dG(t,e)}L(vG,"defaultMeasureLayout");async function CG(e,t,r={}){const{measure:n}=t,{groups:i}=n;for(const s of r.getNodes?.(e,t)??e.nodes)r.skipNode?.(s,t)||await kG(i,s,t,r);const a=wG(e.nodes);for(const s of e.edges)_G(s,r)||await SG(i,s,a,e,r,t)}L(CG,"paintLayoutData");async function kG(e,t,r,n){t.clusterNode?$B(t):TG(t,r,n)?await IV(e.clusters,t):$B(t)}L(kG,"paintLayoutNode");function TG(e,t,r){return e.isGroup===!0&&(r.isCluster?.(e,t)??!0)}L(TG,"shouldPaintAsCluster");function wG(e){const t=new Map;for(const r of e)r?.id&&t.set(r.id,r);return t}L(wG,"buildNodeLookup");function _G(e,t){return e.isLayoutOnly||!!t.skipEdge?.(e)}L(_G,"shouldSkipPaintEdge");async function SG(e,t,r,n,i,a){const s=$V(e.edgePaths,{...t},i.clusterDb??new Map,n.type,jT(t.start,t,r,a,i),jT(t.end,t,r,a,i),n.diagramId,EG(t,i));PV(t)&&(X0.has(t.id)||await P_(e.edgeLabels,t),AG(t,s))}L(SG,"paintLayoutEdge");function jT(e,t,r,n,i){return i.getEdgeNode?.(e,t,n)??(e?r.get(e)??{}:{})}L(jT,"getRenderedNode");function EG(e,t){return typeof t.skipIntersect=="function"?t.skipIntersect(e):t.skipIntersect??!1}L(EG,"shouldSkipIntersect");function AG(e,t){const r=t?.updatedPath??t?.originalPath,n=pn(),{subGraphTitleTotalMargin:i}=Dx({flowchart:n.flowchart??{}});if(e.label){const a=X0.get(e.id);let s=e.x,l=e.y;if(r){const c=Vi.calcLabelPosition(r);De.debug("Moving label "+e.label+" from (",s,",",l,") to (",c.x,",",c.y,") abc88"),t?.updatedPath&&(s=c.x,l=c.y)}a.attr("transform",`translate(${s}, ${l+i/2})`)}if(e?.startLabelLeft){const a=Mn.get(e.id).startLeft;let s=e?.x,l=e?.y;if(r){const c=Vi.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=c.x,l=c.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.startLabelRight){const a=Mn.get(e.id).startRight;let s=e.x,l=e.y;if(r){const c=Vi.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=c.x,l=c.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.endLabelLeft){const a=Mn.get(e.id).endLeft;let s=e.x,l=e.y;if(r){const c=Vi.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=c.x,l=c.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.endLabelRight){const a=Mn.get(e.id).endRight;let s=e.x,l=e.y;if(r){const c=Vi.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=c.x,l=c.y}a.attr("transform",`translate(${s}, ${l})`)}}L(AG,"positionRenderedEdgeLabel");function LG(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}L(LG,"getDefaultExportFromCjs");var zi={},wy={},jc={},xR;function xf(){if(xR)return jc;xR=1;function e(s){return typeof s>"u"||s===null}L(e,"isNothing");function t(s){return typeof s=="object"&&s!==null}L(t,"isObject");function r(s){return Array.isArray(s)?s:e(s)?[]:[s]}L(r,"toArray");function n(s,l){if(l){const c=Object.keys(l);for(let h=0,d=c.length;h<d;h+=1){const f=c[h];s[f]=l[f]}}return s}L(n,"extend");function i(s,l){let c="";for(let h=0;h<l;h+=1)c+=s;return c}L(i,"repeat");function a(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return L(a,"isNegativeZero"),jc.isNothing=e,jc.isObject=t,jc.toArray=r,jc.repeat=i,jc.isNegativeZero=a,jc.extend=n,jc}L(xf,"requireCommon");var KC,vR;function vf(){if(vR)return KC;vR=1;function e(r,n){let i="";const a=r.reason||"(unknown reason)";return r.mark?(r.mark.name&&(i+='in "'+r.mark.name+'" '),i+="("+(r.mark.line+1)+":"+(r.mark.column+1)+")",!n&&r.mark.snippet&&(i+=`
|
|
710
710
|
|
|
711
711
|
`+r.mark.snippet),a+" "+i):a}L(e,"formatError");function t(r,n){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=n,this.message=e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return L(t,"YAMLException2"),t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t.prototype.toString=L(function(n){return this.name+": "+e(this,n)},"toString"),KC=t,KC}L(vf,"requireException");var QC,CR;function NG(){if(CR)return QC;CR=1;const e=xf();function t(i,a,s,l,c){let h="",d="";const f=Math.floor(c/2)-1;return l-a>f&&(h=" ... ",a=l-f+h.length),s-l>f&&(d=" ...",s=l+f-d.length),{str:h+i.slice(a,s).replace(/\t/g,"→")+d,pos:l-a+h.length}}L(t,"getLine");function r(i,a){return e.repeat(" ",a-i.length)+i}L(r,"padStart");function n(i,a){if(a=Object.create(a||null),!i.buffer)return null;a.maxLength||(a.maxLength=79),typeof a.indent!="number"&&(a.indent=1),typeof a.linesBefore!="number"&&(a.linesBefore=3),typeof a.linesAfter!="number"&&(a.linesAfter=2);const s=/\r?\n|\r|\0/g,l=[0],c=[];let h,d=-1;for(;h=s.exec(i.buffer);)c.push(h.index),l.push(h.index+h[0].length),i.position<=h.index&&d<0&&(d=l.length-2);d<0&&(d=l.length-1);let f="";const m=Math.min(i.line+a.linesAfter,c.length).toString().length,g=a.maxLength-(a.indent+m+3);for(let x=1;x<=a.linesBefore&&!(d-x<0);x++){const k=t(i.buffer,l[d-x],c[d-x],i.position-(l[d]-l[d-x]),g);f=e.repeat(" ",a.indent)+r((i.line-x+1).toString(),m)+" | "+k.str+`
|
|
712
712
|
`+f}const b=t(i.buffer,l[d],c[d],i.position,g);f+=e.repeat(" ",a.indent)+r((i.line+1).toString(),m)+" | "+b.str+`
|
|
@@ -737,8 +737,8 @@ ${a.join(`
|
|
|
737
737
|
`+V.slice(Ve,Ge),Ve=Ge+1),He=dt;return st+=`
|
|
738
738
|
`,V.length-Ve>we&&He>Ve?st+=V.slice(Ve,He)+`
|
|
739
739
|
`+V.slice(He+1):st+=V.slice(Ve),st.slice(1)}L(mr,"foldLine");function an(V){let we="",Ye=0;for(let ze=0;ze<V.length;Ye>=65536?ze+=2:ze++){Ye=qe(V,ze);const Ve=K[Ye];!Ve&&he(Ye)?(we+=V[ze],Ye>=65536&&(we+=V[ze+1])):we+=Ve||q(Ye)}return we}L(an,"escapeString");function Xr(V,we,Ye){let ze="";const Ve=V.tag;for(let Ge=0,He=Ye.length;Ge<He;Ge+=1){let dt=Ye[Ge];V.replacer&&(dt=V.replacer.call(Ye,String(Ge),dt)),(be(V,we,dt,!1,!1)||typeof dt>"u"&&be(V,we,null,!1,!1))&&(ze!==""&&(ze+=","+(V.condenseFlow?"":" ")),ze+=V.dump)}V.tag=Ve,V.dump="["+ze+"]"}L(Xr,"writeFlowSequence");function bt(V,we,Ye,ze){let Ve="";const Ge=V.tag;for(let He=0,dt=Ye.length;He<dt;He+=1){let st=Ye[He];V.replacer&&(st=V.replacer.call(Ye,String(He),st)),(be(V,we+1,st,!0,!0,!1,!0)||typeof st>"u"&&be(V,we+1,null,!0,!0,!1,!0))&&((!ze||Ve!=="")&&(Ve+=ee(V,we)),V.dump&&l===V.dump.charCodeAt(0)?Ve+="-":Ve+="- ",Ve+=V.dump)}V.tag=Ge,V.dump=Ve||"[]"}L(bt,"writeBlockSequence");function ke(V,we,Ye){let ze="";const Ve=V.tag,Ge=Object.keys(Ye);for(let He=0,dt=Ge.length;He<dt;He+=1){let st="";ze!==""&&(st+=", "),V.condenseFlow&&(st+='"');const mt=Ge[He];let At=Ye[mt];V.replacer&&(At=V.replacer.call(Ye,mt,At)),be(V,we,mt,!1,!1)&&(V.dump.length>1024&&(st+="? "),st+=V.dump+(V.condenseFlow?'"':"")+":"+(V.condenseFlow?"":" "),be(V,we,At,!1,!1)&&(st+=V.dump,ze+=st))}V.tag=Ve,V.dump="{"+ze+"}"}L(ke,"writeFlowMapping");function E(V,we,Ye,ze){let Ve="";const Ge=V.tag,He=Object.keys(Ye);if(V.sortKeys===!0)He.sort();else if(typeof V.sortKeys=="function")He.sort(V.sortKeys);else if(V.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let dt=0,st=He.length;dt<st;dt+=1){let mt="";(!ze||Ve!=="")&&(mt+=ee(V,we));const At=He[dt];let It=Ye[At];if(V.replacer&&(It=V.replacer.call(Ye,At,It)),!be(V,we+1,At,!0,!0,!0))continue;const tr=V.tag!==null&&V.tag!=="?"||V.dump&&V.dump.length>1024;tr&&(V.dump&&l===V.dump.charCodeAt(0)?mt+="?":mt+="? "),mt+=V.dump,tr&&(mt+=ee(V,we)),be(V,we+1,It,!0,tr)&&(V.dump&&l===V.dump.charCodeAt(0)?mt+=":":mt+=": ",mt+=V.dump,Ve+=mt)}V.tag=Ge,V.dump=Ve||"{}"}L(E,"writeBlockMapping");function ae(V,we,Ye){const ze=Ye?V.explicitTypes:V.implicitTypes;for(let Ve=0,Ge=ze.length;Ve<Ge;Ve+=1){const He=ze[Ve];if((He.instanceOf||He.predicate)&&(!He.instanceOf||typeof we=="object"&&we instanceof He.instanceOf)&&(!He.predicate||He.predicate(we))){if(Ye?He.multi&&He.representName?V.tag=He.representName(we):V.tag=He.tag:V.tag="?",He.represent){const dt=V.styleMap[He.tag]||He.defaultStyle;let st;if(n.call(He.represent)==="[object Function]")st=He.represent(we,dt);else if(i.call(He.represent,dt))st=He.represent[dt](we,dt);else throw new t("!<"+He.tag+'> tag resolver accepts not "'+dt+'" style');V.dump=st}return!0}}return!1}L(ae,"detectType");function be(V,we,Ye,ze,Ve,Ge,He){V.tag=null,V.dump=Ye,ae(V,Ye,!1)||ae(V,Ye,!0);const dt=n.call(V.dump),st=ze;ze&&(ze=V.flowLevel<0||V.flowLevel>we);const mt=dt==="[object Object]"||dt==="[object Array]";let At,It;if(mt&&(At=V.duplicates.indexOf(Ye),It=At!==-1),(V.tag!==null&&V.tag!=="?"||It||V.indent!==2&&we>0)&&(Ve=!1),It&&V.usedDuplicates[At])V.dump="*ref_"+At;else{if(mt&&It&&!V.usedDuplicates[At]&&(V.usedDuplicates[At]=!0),dt==="[object Object]")ze&&Object.keys(V.dump).length!==0?(E(V,we,V.dump,Ve),It&&(V.dump="&ref_"+At+V.dump)):(ke(V,we,V.dump),It&&(V.dump="&ref_"+At+" "+V.dump));else if(dt==="[object Array]")ze&&V.dump.length!==0?(V.noArrayIndent&&!He&&we>0?bt(V,we-1,V.dump,Ve):bt(V,we,V.dump,Ve),It&&(V.dump="&ref_"+At+V.dump)):(Xr(V,we,V.dump),It&&(V.dump="&ref_"+At+" "+V.dump));else if(dt==="[object String]")V.tag!=="?"&&Sr(V,V.dump,we,Ge,st);else{if(dt==="[object Undefined]")return!1;if(V.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+dt)}if(V.tag!==null&&V.tag!=="?"){let tr=encodeURI(V.tag[0]==="!"?V.tag.slice(1):V.tag).replace(/!/g,"%21");V.tag[0]==="!"?tr="!"+tr:tr.slice(0,18)==="tag:yaml.org,2002:"?tr="!!"+tr.slice(18):tr="!<"+tr+">",V.dump=tr+" "+V.dump}}return!0}L(be,"writeNode");function Re(V,we){const Ye=[],ze=[];Se(V,Ye,ze);const Ve=ze.length;for(let Ge=0;Ge<Ve;Ge+=1)we.duplicates.push(Ye[ze[Ge]]);we.usedDuplicates=new Array(Ve)}L(Re,"getDuplicateReferences");function Se(V,we,Ye){if(V!==null&&typeof V=="object"){const ze=we.indexOf(V);if(ze!==-1)Ye.indexOf(ze)===-1&&Ye.push(ze);else if(we.push(V),Array.isArray(V))for(let Ve=0,Ge=V.length;Ve<Ge;Ve+=1)Se(V[Ve],we,Ye);else{const Ve=Object.keys(V);for(let Ge=0,He=Ve.length;Ge<He;Ge+=1)Se(V[Ve[Ge]],we,Ye)}}}L(Se,"inspectNode");function Qe(V,we){we=we||{};const Ye=new Ee(we);Ye.noRefs||Re(V,Ye);let ze=V;return Ye.replacer&&(ze=Ye.replacer.call({"":ze},"",ze)),be(Ye,0,ze,!0,!0)?Ye.dump+`
|
|
740
|
-
`:""}return L(Qe,"dump2"),y5.dump=Qe,y5}L(BG,"requireDumper");var UR;function RG(){if(UR)return zi;UR=1;const e=MG(),t=BG();function r(n,i){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}return L(r,"renamed"),zi.Type=Xi(),zi.Schema=W_(),zi.FAILSAFE_SCHEMA=Q_(),zi.JSON_SCHEMA=rS(),zi.CORE_SCHEMA=nS(),zi.DEFAULT_SCHEMA=qx(),zi.load=e.load,zi.loadAll=e.loadAll,zi.dump=t.dump,zi.YAMLException=vf(),zi.types={binary:sS(),float:tS(),map:K_(),null:Z_(),pairs:lS(),set:cS(),timestamp:iS(),bool:J_(),int:eS(),merge:aS(),omap:oS(),seq:X_(),str:Y_()},zi.safeLoad=r("safeLoad","load"),zi.safeLoadAll=r("safeLoadAll","loadAll"),zi.safeDump=r("safeDump","dump"),zi}L(RG,"requireJsYaml");var HCe=RG(),UCe=LG(HCe),{Type:uje,Schema:hje,FAILSAFE_SCHEMA:dje,JSON_SCHEMA:qCe,CORE_SCHEMA:fje,DEFAULT_SCHEMA:pje,load:VCe,loadAll:mje,dump:gje,YAMLException:yje,types:bje,safeLoad:xje,safeLoadAll:vje,safeDump:Cje}=UCe,GCe={common:hg,getConfig:pn,insertCluster:IV,insertEdge:$V,insertEdgeLabel:P_,insertMarkers:HV,insertNode:I_,interpolateToCurve:f_,labelHelper:Mt,log:De,positionEdgeLabel:xxe},Vm={},OG=L(e=>{for(const t of e)Vm[t.name]=t},"registerLayoutLoaders"),WCe=L(()=>{OG([{name:"dagre",loader:L(async()=>await Q(()=>import("./dagre-GXQ25YYZ-BVPB8dh2.js"),__vite__mapDeps([125,126])),"loader")},{name:"swimlane",loader:L(async()=>await Q(()=>import("./swimlanes-42K2YHIH-D0kSxg5-.js"),[]),"loader")},{name:"cose-bilkent",loader:L(async()=>await Q(()=>import("./cose-bilkent-JH36ORCC-B6zSSHu8.js"),__vite__mapDeps([127,128])),"loader")}])},"registerDefaultLayoutLoaders");WCe();var kje=L(async(e,t)=>{if(!(e.layoutAlgorithm in Vm))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const d of e.nodes){const f=d.domId||d.id;d.domId=`${e.diagramId}-${f}`}const r=Vm[e.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:a}=e.config,{useGradient:s,gradientStart:l,gradientStop:c}=a,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i?.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i?.includes("dark")?"#FFFFFF":"#000000"}`),s){const d=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");d.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),d.append("svg:stop").attr("offset","100%").attr("stop-color",c).attr("stop-opacity",1)}return n.render(e,t,GCe,{algorithm:r.algorithm})},"render"),Tje=L((e="",{fallback:t="dagre"}={})=>{if(e in Vm)return e;if(t in Vm)return De.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),uS="comm",DG="rule",IG="decl",YCe="@media",XCe="@import",KCe="@supports",QCe="@namespace",HT="@keyframes",PG="@layer",ZCe="@scope",JCe=Math.abs,gm=String.fromCharCode;function FG(e){return e.trim()}function UT(e,t,r){return e.replace(t,r)}function v0(e,t){return e.charCodeAt(t)|0}function K0(e,t,r){return e.slice(t,r)}function Ho(e){return e.length}function $G(e){return e.length}function _y(e,t){return t.push(e),e}var Vx=1,Q0=1,zG=0,As=0,$n=0,Cf="";function hS(e,t,r,n,i,a,s,l){return{value:e,root:t,parent:r,type:n,props:i,children:a,line:Vx,column:Q0,length:s,return:"",siblings:l}}function e5e(){return $n}function t5e(){return $n=As>0?v0(Cf,--As):0,Q0--,$n===10&&(Q0=1,Vx--),$n}function io(){return $n=As<zG?v0(Cf,As++):0,Q0++,$n===10&&(Q0=1,Vx++),$n}function ru(){return v0(Cf,As)}function rb(){return As}function Gx(e,t){return K0(Cf,e,t)}function Gm(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function r5e(e){return Vx=Q0=1,zG=Ho(Cf=e),As=0,[]}function n5e(e){return Cf="",e}function b5(e){return FG(Gx(As-1,qT(e===91?e+2:e===40?e+1:e)))}function i5e(e){for(;($n=ru())&&$n<33;)io();return Gm(e)>2||Gm($n)>3?"":" "}function a5e(e,t){for(;--t&&io()&&!($n<48||$n>102||$n>57&&$n<65||$n>70&&$n<97););return Gx(e,rb()+(t<6&&ru()==32&&io()==32))}function qT(e){for(;io();)switch($n){case e:return As;case 34:case 39:e!==34&&e!==39&&qT($n);break;case 40:e===41&&qT(e);break;case 92:io();break}return As}function s5e(e,t){for(;io()&&e+$n!==57;)if(e+$n===84&&ru()===47)break;return"/*"+Gx(t,As-1)+"*"+gm(e===47?e:io())}function o5e(e){for(;!Gm(ru());)io();return Gx(e,As)}function l5e(e){return n5e(nb("",null,null,null,[""],e=r5e(e),0,[0],e))}function nb(e,t,r,n,i,a,s,l,c){for(var h=0,d=0,f=s,m=0,g=0,b=0,x=1,k=1,w=1,_=0,S=0,N="",B=i,I=a,P=n,O=N;k;)switch(b=S,S=io()){case 40:b!=108&&v0(O,f-1)==58?(_++,O+="("):O+=b5(S);break;case 41:_--,O+=")";break;case 34:case 39:case 91:O+=b5(S);break;case 9:case 10:case 13:case 32:if(_>0){O+=gm(S);break}O+=i5e(b);break;case 92:O+=a5e(rb()-1,7);continue;case 47:switch(ru()){case 42:case 47:_y(c5e(s5e(io(),rb()),t,r,c),c),(Gm(b||1)==5||Gm(ru()||1)==5)&&Ho(O)&&K0(O,-1,void 0)!==" "&&(O+=" ");break;default:O+="/"}break;case 123*x:l[h++]=Ho(O)*w;case 125*x:case 59:case 0:if(_>0&&S){O+=gm(S);break}switch(S){case 0:case 125:k=0;case 59+d:w==-1&&(O=UT(O,/\f/g,"")),g>0&&(Ho(O)-f||x===0)&&_y(g>32?VR(O+";",n,r,f-1,c):VR(UT(O," ","")+";",n,r,f-2,c),c);break;case 59:O+=";";default:if(_y(P=qR(O,t,r,h,d,i,l,N,B=[],I=[],f,a),a),S===123)if(d===0)nb(O,t,P,P,B,a,f,l,I);else{switch(m){case 99:if(v0(O,3)===110)break;case 108:if(v0(O,2)===97)break;default:d=0;case 100:case 109:case 115:}d?nb(e,P,P,n&&_y(qR(e,P,P,0,0,i,l,N,i,B=[],f,I),I),i,I,f,l,n?B:I):nb(O,P,P,P,[""],I,0,l,I)}}h=d=g=0,x=w=1,N=O="",f=s;break;case 58:f=1+Ho(O),g=b;default:if(x<1){if(S==123)--x;else if(S==125&&x++==0&&t5e()==125)continue}switch(O+=gm(S),S*x){case 38:w=d>0?1:(O+="\f",-1);break;case 44:if(_>0)break;l[h++]=(Ho(O)-1)*w,w=1;break;case 64:ru()===45&&(O+=b5(io())),m=ru(),d=f=Ho(N=O+=o5e(rb())),S++;break;case 45:b===45&&Ho(O)==2&&(x=0)}}return a}function qR(e,t,r,n,i,a,s,l,c,h,d,f){for(var m=i-1,g=i===0?a:[""],b=$G(g),x=0,k=0,w=0;x<n;++x)for(var _=0,S=K0(e,m+1,m=JCe(k=s[x])),N=e;_<b;++_)(N=FG(k>0?g[_]+" "+S:UT(S,/&\f/g,g[_])))&&(c[w++]=N);return hS(e,t,r,i===0?DG:l,c,h,d,f)}function c5e(e,t,r,n){return hS(e,t,r,uS,gm(e5e()),K0(e,2,-2),0,n)}function VR(e,t,r,n,i){return hS(e,t,r,IG,K0(e,0,n),K0(e,n+1,-1),n,i)}function VT(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function u5e(e,t,r,n){switch(e.type){case PG:if(e.children.length)break;case XCe:case QCe:case IG:return e.return=e.return||e.value;case uS:return"";case HT:return e.return=e.value+"{"+VT(e.children,n)+"}";case DG:if(!Ho(e.value=e.props.join(",")))return""}return Ho(r=VT(e.children,n))?e.return=e.value+"{"+r+"}":""}function h5e(e){var t=$G(e);return function(r,n,i,a){for(var s="",l=0;l<t;l++)s+=e[l](r,n,i,a)||"";return s}}var jG="c4",d5e=L(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),f5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./c4Diagram-7LVT6UL2-CPPOW6JF.js");return{diagram:t}},__vite__mapDeps([129,130]));return{id:jG,diagram:e}},"loader"),p5e={id:jG,detector:d5e,loader:f5e},m5e=p5e,HG="flowchart",g5e=L((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),y5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-B9GitqYh.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([131,132,133,134,130,135]));return{id:HG,diagram:e}},"loader"),b5e={id:HG,detector:g5e,loader:y5e},x5e=b5e,UG="flowchart-v2",v5e=L((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),C5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-B9GitqYh.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([131,132,133,134,130,135]));return{id:UG,diagram:e}},"loader"),k5e={id:UG,detector:v5e,loader:C5e},T5e=k5e,qG="swimlane",w5e=L(e=>/^\s*swimlane-beta\b/.test(e),"detector"),_5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./swimlanesDiagram-VR7AAH4N-DkTwk5rQ.js");return{diagram:t}},__vite__mapDeps([136,131,132,133,134,130,135]));return{id:qG,diagram:e}},"loader"),S5e={id:qG,detector:w5e,loader:_5e},E5e=S5e,VG="er",A5e=L(e=>/^\s*erDiagram/.test(e),"detector"),L5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./erDiagram-RLTQ6QDP-e3FQY9Rr.js");return{diagram:t}},__vite__mapDeps([137,133,134,135]));return{id:VG,diagram:e}},"loader"),N5e={id:VG,detector:A5e,loader:L5e},M5e=N5e,GG="gitGraph",B5e=L(e=>/^\s*gitGraph/.test(e),"detector"),R5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./gitGraphDiagram-WWUBYQGX-C8koRqxv.js");return{diagram:t}},__vite__mapDeps([138,139,140,141]));return{id:GG,diagram:e}},"loader"),O5e={id:GG,detector:B5e,loader:R5e},D5e=O5e,WG="gantt",I5e=L(e=>/^\s*gantt/.test(e),"detector"),P5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./ganttDiagram-EL5Y4UJY-DwrnCu8t.js");return{diagram:t}},__vite__mapDeps([142,143,144,145]));return{id:WG,diagram:e}},"loader"),F5e={id:WG,detector:I5e,loader:P5e},$5e=F5e,YG="info",z5e=L(e=>/^\s*info/.test(e),"detector"),j5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./infoDiagram-27XIBGKW-BWCh1S5G.js");return{diagram:t}},__vite__mapDeps([146,141]));return{id:YG,diagram:e}},"loader"),H5e={id:YG,detector:z5e,loader:j5e},XG="pie",U5e=L(e=>/^\s*pie/.test(e),"detector"),q5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./pieDiagram-E7YTZNPT-Bl2haRSH.js");return{diagram:t}},__vite__mapDeps([147,140,141,148,149,144]));return{id:XG,diagram:e}},"loader"),V5e={id:XG,detector:U5e,loader:q5e},KG="quadrantChart",G5e=L(e=>/^\s*quadrantChart/.test(e),"detector"),W5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./quadrantDiagram-AXDQQJYC-DhaIYSM8.js");return{diagram:t}},__vite__mapDeps([150,143,144,145]));return{id:KG,diagram:e}},"loader"),Y5e={id:KG,detector:G5e,loader:W5e},X5e=Y5e,QG="xychart",K5e=L(e=>/^\s*xychart(-beta)?/.test(e),"detector"),Q5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./xychartDiagram-S5SC5T6Z-CW42Yw1K.js");return{diagram:t}},__vite__mapDeps([151,144,149,143,145]));return{id:QG,diagram:e}},"loader"),Z5e={id:QG,detector:K5e,loader:Q5e},J5e=Z5e,ZG="requirement",eke=L(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),tke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./requirementDiagram-BXWQKSXE-CGf_8iny.js");return{diagram:t}},__vite__mapDeps([152,133,134]));return{id:ZG,diagram:e}},"loader"),rke={id:ZG,detector:eke,loader:tke},nke=rke,JG="sequence",ike=L(e=>/^\s*sequenceDiagram/.test(e),"detector"),ake=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./sequenceDiagram-WJ2MYXX4-CbhdwHX8.js");return{diagram:t}},__vite__mapDeps([153,139,130]));return{id:JG,diagram:e}},"loader"),ske={id:JG,detector:ike,loader:ake},oke=ske,eW="class",lke=L((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),cke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./classDiagram-ZZMXUADV-D2T063ZF.js");return{diagram:t}},__vite__mapDeps([154,155,132,133,134,130]));return{id:eW,diagram:e}},"loader"),uke={id:eW,detector:lke,loader:cke},hke=uke,tW="classDiagram",dke=L((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),fke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./classDiagram-v2-VYDZK3BY-D2T063ZF.js");return{diagram:t}},__vite__mapDeps([156,155,132,133,134,130]));return{id:tW,diagram:e}},"loader"),pke={id:tW,detector:dke,loader:fke},mke=pke,rW="state",gke=L((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),yke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./stateDiagram-D77RDMKH-dM87lznP.js");return{diagram:t}},__vite__mapDeps([157,158,133,134,130,126]));return{id:rW,diagram:e}},"loader"),bke={id:rW,detector:gke,loader:yke},xke=bke,nW="stateDiagram",vke=L((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),Cke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./stateDiagram-v2-MP3YSRHH-6W0qW5cq.js");return{diagram:t}},__vite__mapDeps([159,158,133,134,130]));return{id:nW,diagram:e}},"loader"),kke={id:nW,detector:vke,loader:Cke},Tke=kke,iW="journey",wke=L(e=>/^\s*journey/.test(e),"detector"),_ke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./journeyDiagram-3NMN7TZE-L9IMZVhC.js");return{diagram:t}},__vite__mapDeps([160,132,130,148]));return{id:iW,diagram:e}},"loader"),Ske={id:iW,detector:wke,loader:_ke},Eke=Ske,Ake=L((e,t,r)=>{De.debug(`rendering svg for syntax error
|
|
741
|
-
`);const n=W1e(t),i=n.append("g");n.attr("viewBox","0 0 2412 512"),fH(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),aW={draw:Ake},Lke=aW,Nke={db:{},renderer:aW,parser:{parse:L(()=>{},"parse")}},Mke=Nke,sW="flowchart-elk",Bke=L((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),Rke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-B9GitqYh.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([131,132,133,134,130,135]));return{id:sW,diagram:e}},"loader"),Oke={id:sW,detector:Bke,loader:Rke},Dke=Oke,oW="timeline",Ike=L(e=>/^\s*timeline/.test(e),"detector"),Pke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./timeline-definition-24CTP7MA-rKssvoZk.js");return{diagram:t}},__vite__mapDeps([161,148]));return{id:oW,diagram:e}},"loader"),Fke={id:oW,detector:Ike,loader:Pke},$ke=Fke,lW="mindmap",zke=L(e=>/^\s*mindmap/.test(e),"detector"),jke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./mindmap-definition-YA3MSWOX-COA02VQG.js");return{diagram:t}},__vite__mapDeps([162,133,134]));return{id:lW,diagram:e}},"loader"),Hke={id:lW,detector:zke,loader:jke},Uke=Hke,cW="kanban",qke=L(e=>/^\s*kanban/.test(e),"detector"),Vke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./kanban-definition-UXKFOSKX-B4Vf9yAl.js");return{diagram:t}},__vite__mapDeps([163,132]));return{id:cW,diagram:e}},"loader"),Gke={id:cW,detector:qke,loader:Vke},Wke=Gke,uW="sankey",Yke=L(e=>/^\s*sankey(-beta)?/.test(e),"detector"),Xke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./sankeyDiagram-P5KCCOFB-CcjRfS7v.js");return{diagram:t}},__vite__mapDeps([164,149,144]));return{id:uW,diagram:e}},"loader"),Kke={id:uW,detector:Yke,loader:Xke},Qke=Kke,hW="packet",Zke=L(e=>/^\s*packet(-beta)?/.test(e),"detector"),Jke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-Z3DM3KII-DAb7Xasg.js");return{diagram:t}},__vite__mapDeps([165,140,141]));return{id:hW,diagram:e}},"loader"),eTe={id:hW,detector:Zke,loader:Jke},dW="radar",tTe=L(e=>/^\s*radar-beta/.test(e),"detector"),rTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-UQ7AKVKN-FYCSPhT1.js");return{diagram:t}},__vite__mapDeps([166,140,141]));return{id:dW,diagram:e}},"loader"),nTe={id:dW,detector:tTe,loader:rTe},fW="block",iTe=L(e=>/^\s*block(-beta)?/.test(e),"detector"),aTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./blockDiagram-I7D4REHJ-CLbKN_jM.js");return{diagram:t}},__vite__mapDeps([167,132,135]));return{id:fW,diagram:e}},"loader"),sTe={id:fW,detector:iTe,loader:aTe},oTe=sTe,pW="treeView",lTe=L(e=>/^\s*treeView-beta/.test(e),"detector"),cTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-S7CK7UJ4-BbE5qqP5.js");return{diagram:t}},__vite__mapDeps([168,139,140,141]));return{id:pW,diagram:e}},"loader"),uTe={id:pW,detector:lTe,loader:cTe},hTe=uTe,mW="architecture",dTe=L(e=>/^\s*architecture/.test(e),"detector"),fTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./architectureDiagram-5GKGNRK7-D7OVuLhk.js");return{diagram:t}},__vite__mapDeps([169,140,141,128]));return{id:mW,diagram:e}},"loader"),pTe={id:mW,detector:dTe,loader:fTe},mTe=pTe,gW="eventmodeling",gTe=L(e=>/^\s*eventmodeling/.test(e),"detector"),yTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-VSXAHHWV-CAwgXpg2.js");return{diagram:t}},__vite__mapDeps([170,140,141]));return{id:gW,diagram:e}},"loader"),bTe={id:gW,detector:gTe,loader:yTe},xTe=bTe,yW="ishikawa",vTe=L(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),CTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./ishikawaDiagram-5VMMS53U-BuU7xP78.js");return{diagram:t}},[]);return{id:yW,diagram:e}},"loader"),kTe={id:yW,detector:vTe,loader:CTe},bW="venn",TTe=L(e=>/^\s*venn-beta/.test(e),"detector"),wTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./vennDiagram-4TSXK5OY-Brg4DKGj.js");return{diagram:t}},[]);return{id:bW,diagram:e}},"loader"),_Te={id:bW,detector:TTe,loader:wTe},STe=_Te,xW="treemap",ETe=L(e=>/^\s*treemap/.test(e),"detector"),ATe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-VX7I27RA-B_yjQRRp.js");return{diagram:t}},__vite__mapDeps([171,140,134,141,145,149,144]));return{id:xW,diagram:e}},"loader"),LTe={id:xW,detector:ETe,loader:ATe},vW="wardley",NTe=L(e=>/^\s*wardley-beta/i.test(e),"detector"),MTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./wardleyDiagram-VM6X3IG4-DHcxw4ey.js");return{diagram:t}},__vite__mapDeps([172,140,141]));return{id:vW,diagram:e}},"loader"),BTe={id:vW,detector:NTe,loader:MTe},RTe=BTe,CW="cynefin",OTe=L(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),DTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./cynefinDiagram-5FMLGOSQ-C7uT-ctR.js");return{diagram:t}},__vite__mapDeps([173,140,141]));return{id:CW,diagram:e}},"loader"),ITe={id:CW,detector:OTe,loader:DTe},kW="railroad",PTe=L(e=>/^\s*railroad-beta/i.test(e),"detector"),FTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./railroadDiagram-O6MQD6OU-GmTKop1N.js");return{diagram:t}},__vite__mapDeps([174,175,140,141]));return{id:kW,diagram:e}},"loader"),$Te={id:kW,detector:PTe,loader:FTe},TW="railroadEbnf",zTe=L(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),jTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./ebnfDiagram-PWID7BFC-Del2ZzP3.js");return{diagram:t}},__vite__mapDeps([176,175,140,141]));return{id:TW,diagram:e}},"loader"),HTe={id:TW,detector:zTe,loader:jTe},wW="railroadAbnf",UTe=L(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),qTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./abnfDiagram-VCTEODGH-CphjrZ91.js");return{diagram:t}},__vite__mapDeps([177,175,140,141]));return{id:wW,diagram:e}},"loader"),VTe={id:wW,detector:UTe,loader:qTe},_W="railroadPeg",GTe=L(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),WTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./pegDiagram-XKGWAZYB-Dx1GejmQ.js");return{diagram:t}},__vite__mapDeps([178,175,140,141]));return{id:_W,diagram:e}},"loader"),YTe={id:_W,detector:GTe,loader:WTe},GR=!1,Wx=L(()=>{GR||(GR=!0,Jb("error",Mke,e=>e.toLowerCase().trim()==="error"),Jb("---",{db:{clear:L(()=>{},"clear")},styles:{},renderer:{draw:L(()=>{},"draw")},parser:{parse:L(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:L(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),oT(Dke,Uke,mTe),oT(m5e,Wke,mke,hke,M5e,$5e,H5e,V5e,nke,oke,E5e,T5e,x5e,$ke,D5e,Tke,xke,Eke,X5e,Qke,eTe,J5e,oTe,xTe,hTe,nTe,kTe,LTe,$Te,HTe,VTe,YTe,STe,RTe,ITe))},"addDiagrams"),XTe=L(async()=>{De.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Dh).map(async([r,{detector:n,loader:i}])=>{if(i)try{hT(r)}catch{try{const{diagram:a,id:s}=await i();Jb(s,a,n)}catch(a){throw De.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Dh[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){De.error(`Failed to load ${t.length} external diagrams`);for(const r of t)De.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),KTe="graphics-document document";function SW(e,t){e.attr("role",KTe),t!==""&&e.attr("aria-roledescription",t)}L(SW,"setA11yDiagramInfo");function EW(e,t,r,n){if(e.insert!==void 0){if(r){const i=`chart-desc-${n}`;e.attr("aria-describedby",i),e.insert("desc",":first-child").attr("id",i).text(r)}if(t){const i=`chart-title-${n}`;e.attr("aria-labelledby",i),e.insert("title",":first-child").attr("id",i).text(t)}}}L(EW,"addSVGa11yTitleDescription");var Nh,GT=(Nh=class{constructor(t,r,n,i,a){this.type=t,this.text=r,this.db=n,this.parser=i,this.renderer=a}static async fromText(t,r={}){const n=pn(),i=W6(t,n);t=gbe(t)+`
|
|
740
|
+
`:""}return L(Qe,"dump2"),y5.dump=Qe,y5}L(BG,"requireDumper");var UR;function RG(){if(UR)return zi;UR=1;const e=MG(),t=BG();function r(n,i){return function(){throw new Error("Function yaml."+n+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}return L(r,"renamed"),zi.Type=Xi(),zi.Schema=W_(),zi.FAILSAFE_SCHEMA=Q_(),zi.JSON_SCHEMA=rS(),zi.CORE_SCHEMA=nS(),zi.DEFAULT_SCHEMA=qx(),zi.load=e.load,zi.loadAll=e.loadAll,zi.dump=t.dump,zi.YAMLException=vf(),zi.types={binary:sS(),float:tS(),map:K_(),null:Z_(),pairs:lS(),set:cS(),timestamp:iS(),bool:J_(),int:eS(),merge:aS(),omap:oS(),seq:X_(),str:Y_()},zi.safeLoad=r("safeLoad","load"),zi.safeLoadAll=r("safeLoadAll","loadAll"),zi.safeDump=r("safeDump","dump"),zi}L(RG,"requireJsYaml");var HCe=RG(),UCe=LG(HCe),{Type:uje,Schema:hje,FAILSAFE_SCHEMA:dje,JSON_SCHEMA:qCe,CORE_SCHEMA:fje,DEFAULT_SCHEMA:pje,load:VCe,loadAll:mje,dump:gje,YAMLException:yje,types:bje,safeLoad:xje,safeLoadAll:vje,safeDump:Cje}=UCe,GCe={common:hg,getConfig:pn,insertCluster:IV,insertEdge:$V,insertEdgeLabel:P_,insertMarkers:HV,insertNode:I_,interpolateToCurve:f_,labelHelper:Mt,log:De,positionEdgeLabel:xxe},Vm={},OG=L(e=>{for(const t of e)Vm[t.name]=t},"registerLayoutLoaders"),WCe=L(()=>{OG([{name:"dagre",loader:L(async()=>await Q(()=>import("./dagre-GXQ25YYZ-kpgqGmru.js"),__vite__mapDeps([125,126])),"loader")},{name:"swimlane",loader:L(async()=>await Q(()=>import("./swimlanes-42K2YHIH-Uc_hTPY0.js"),[]),"loader")},{name:"cose-bilkent",loader:L(async()=>await Q(()=>import("./cose-bilkent-JH36ORCC-D9k5qepP.js"),__vite__mapDeps([127,128])),"loader")}])},"registerDefaultLayoutLoaders");WCe();var kje=L(async(e,t)=>{if(!(e.layoutAlgorithm in Vm))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const d of e.nodes){const f=d.domId||d.id;d.domId=`${e.diagramId}-${f}`}const r=Vm[e.layoutAlgorithm],n=await r.loader(),{theme:i,themeVariables:a}=e.config,{useGradient:s,gradientStart:l,gradientStop:c}=a,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i?.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${i?.includes("dark")?"#FFFFFF":"#000000"}`),s){const d=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");d.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),d.append("svg:stop").attr("offset","100%").attr("stop-color",c).attr("stop-opacity",1)}return n.render(e,t,GCe,{algorithm:r.algorithm})},"render"),Tje=L((e="",{fallback:t="dagre"}={})=>{if(e in Vm)return e;if(t in Vm)return De.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),uS="comm",DG="rule",IG="decl",YCe="@media",XCe="@import",KCe="@supports",QCe="@namespace",HT="@keyframes",PG="@layer",ZCe="@scope",JCe=Math.abs,gm=String.fromCharCode;function FG(e){return e.trim()}function UT(e,t,r){return e.replace(t,r)}function v0(e,t){return e.charCodeAt(t)|0}function K0(e,t,r){return e.slice(t,r)}function Ho(e){return e.length}function $G(e){return e.length}function _y(e,t){return t.push(e),e}var Vx=1,Q0=1,zG=0,As=0,$n=0,Cf="";function hS(e,t,r,n,i,a,s,l){return{value:e,root:t,parent:r,type:n,props:i,children:a,line:Vx,column:Q0,length:s,return:"",siblings:l}}function e5e(){return $n}function t5e(){return $n=As>0?v0(Cf,--As):0,Q0--,$n===10&&(Q0=1,Vx--),$n}function io(){return $n=As<zG?v0(Cf,As++):0,Q0++,$n===10&&(Q0=1,Vx++),$n}function ru(){return v0(Cf,As)}function rb(){return As}function Gx(e,t){return K0(Cf,e,t)}function Gm(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function r5e(e){return Vx=Q0=1,zG=Ho(Cf=e),As=0,[]}function n5e(e){return Cf="",e}function b5(e){return FG(Gx(As-1,qT(e===91?e+2:e===40?e+1:e)))}function i5e(e){for(;($n=ru())&&$n<33;)io();return Gm(e)>2||Gm($n)>3?"":" "}function a5e(e,t){for(;--t&&io()&&!($n<48||$n>102||$n>57&&$n<65||$n>70&&$n<97););return Gx(e,rb()+(t<6&&ru()==32&&io()==32))}function qT(e){for(;io();)switch($n){case e:return As;case 34:case 39:e!==34&&e!==39&&qT($n);break;case 40:e===41&&qT(e);break;case 92:io();break}return As}function s5e(e,t){for(;io()&&e+$n!==57;)if(e+$n===84&&ru()===47)break;return"/*"+Gx(t,As-1)+"*"+gm(e===47?e:io())}function o5e(e){for(;!Gm(ru());)io();return Gx(e,As)}function l5e(e){return n5e(nb("",null,null,null,[""],e=r5e(e),0,[0],e))}function nb(e,t,r,n,i,a,s,l,c){for(var h=0,d=0,f=s,m=0,g=0,b=0,x=1,k=1,w=1,_=0,S=0,N="",B=i,I=a,P=n,O=N;k;)switch(b=S,S=io()){case 40:b!=108&&v0(O,f-1)==58?(_++,O+="("):O+=b5(S);break;case 41:_--,O+=")";break;case 34:case 39:case 91:O+=b5(S);break;case 9:case 10:case 13:case 32:if(_>0){O+=gm(S);break}O+=i5e(b);break;case 92:O+=a5e(rb()-1,7);continue;case 47:switch(ru()){case 42:case 47:_y(c5e(s5e(io(),rb()),t,r,c),c),(Gm(b||1)==5||Gm(ru()||1)==5)&&Ho(O)&&K0(O,-1,void 0)!==" "&&(O+=" ");break;default:O+="/"}break;case 123*x:l[h++]=Ho(O)*w;case 125*x:case 59:case 0:if(_>0&&S){O+=gm(S);break}switch(S){case 0:case 125:k=0;case 59+d:w==-1&&(O=UT(O,/\f/g,"")),g>0&&(Ho(O)-f||x===0)&&_y(g>32?VR(O+";",n,r,f-1,c):VR(UT(O," ","")+";",n,r,f-2,c),c);break;case 59:O+=";";default:if(_y(P=qR(O,t,r,h,d,i,l,N,B=[],I=[],f,a),a),S===123)if(d===0)nb(O,t,P,P,B,a,f,l,I);else{switch(m){case 99:if(v0(O,3)===110)break;case 108:if(v0(O,2)===97)break;default:d=0;case 100:case 109:case 115:}d?nb(e,P,P,n&&_y(qR(e,P,P,0,0,i,l,N,i,B=[],f,I),I),i,I,f,l,n?B:I):nb(O,P,P,P,[""],I,0,l,I)}}h=d=g=0,x=w=1,N=O="",f=s;break;case 58:f=1+Ho(O),g=b;default:if(x<1){if(S==123)--x;else if(S==125&&x++==0&&t5e()==125)continue}switch(O+=gm(S),S*x){case 38:w=d>0?1:(O+="\f",-1);break;case 44:if(_>0)break;l[h++]=(Ho(O)-1)*w,w=1;break;case 64:ru()===45&&(O+=b5(io())),m=ru(),d=f=Ho(N=O+=o5e(rb())),S++;break;case 45:b===45&&Ho(O)==2&&(x=0)}}return a}function qR(e,t,r,n,i,a,s,l,c,h,d,f){for(var m=i-1,g=i===0?a:[""],b=$G(g),x=0,k=0,w=0;x<n;++x)for(var _=0,S=K0(e,m+1,m=JCe(k=s[x])),N=e;_<b;++_)(N=FG(k>0?g[_]+" "+S:UT(S,/&\f/g,g[_])))&&(c[w++]=N);return hS(e,t,r,i===0?DG:l,c,h,d,f)}function c5e(e,t,r,n){return hS(e,t,r,uS,gm(e5e()),K0(e,2,-2),0,n)}function VR(e,t,r,n,i){return hS(e,t,r,IG,K0(e,0,n),K0(e,n+1,-1),n,i)}function VT(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function u5e(e,t,r,n){switch(e.type){case PG:if(e.children.length)break;case XCe:case QCe:case IG:return e.return=e.return||e.value;case uS:return"";case HT:return e.return=e.value+"{"+VT(e.children,n)+"}";case DG:if(!Ho(e.value=e.props.join(",")))return""}return Ho(r=VT(e.children,n))?e.return=e.value+"{"+r+"}":""}function h5e(e){var t=$G(e);return function(r,n,i,a){for(var s="",l=0;l<t;l++)s+=e[l](r,n,i,a)||"";return s}}var jG="c4",d5e=L(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),f5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./c4Diagram-7LVT6UL2-DQz_MRya.js");return{diagram:t}},__vite__mapDeps([129,130]));return{id:jG,diagram:e}},"loader"),p5e={id:jG,detector:d5e,loader:f5e},m5e=p5e,HG="flowchart",g5e=L((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),y5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-C8Pk4nlG.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([131,132,133,134,130,135]));return{id:HG,diagram:e}},"loader"),b5e={id:HG,detector:g5e,loader:y5e},x5e=b5e,UG="flowchart-v2",v5e=L((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),C5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-C8Pk4nlG.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([131,132,133,134,130,135]));return{id:UG,diagram:e}},"loader"),k5e={id:UG,detector:v5e,loader:C5e},T5e=k5e,qG="swimlane",w5e=L(e=>/^\s*swimlane-beta\b/.test(e),"detector"),_5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./swimlanesDiagram-VR7AAH4N-B8EmeXGy.js");return{diagram:t}},__vite__mapDeps([136,131,132,133,134,130,135]));return{id:qG,diagram:e}},"loader"),S5e={id:qG,detector:w5e,loader:_5e},E5e=S5e,VG="er",A5e=L(e=>/^\s*erDiagram/.test(e),"detector"),L5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./erDiagram-RLTQ6QDP-DPPCOsm4.js");return{diagram:t}},__vite__mapDeps([137,133,134,135]));return{id:VG,diagram:e}},"loader"),N5e={id:VG,detector:A5e,loader:L5e},M5e=N5e,GG="gitGraph",B5e=L(e=>/^\s*gitGraph/.test(e),"detector"),R5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./gitGraphDiagram-WWUBYQGX-DW3KfzJc.js");return{diagram:t}},__vite__mapDeps([138,139,140,141]));return{id:GG,diagram:e}},"loader"),O5e={id:GG,detector:B5e,loader:R5e},D5e=O5e,WG="gantt",I5e=L(e=>/^\s*gantt/.test(e),"detector"),P5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./ganttDiagram-EL5Y4UJY-DbMFVwCm.js");return{diagram:t}},__vite__mapDeps([142,143,144,145]));return{id:WG,diagram:e}},"loader"),F5e={id:WG,detector:I5e,loader:P5e},$5e=F5e,YG="info",z5e=L(e=>/^\s*info/.test(e),"detector"),j5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./infoDiagram-27XIBGKW-skA1iBH3.js");return{diagram:t}},__vite__mapDeps([146,141]));return{id:YG,diagram:e}},"loader"),H5e={id:YG,detector:z5e,loader:j5e},XG="pie",U5e=L(e=>/^\s*pie/.test(e),"detector"),q5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./pieDiagram-E7YTZNPT-BMs8-MyD.js");return{diagram:t}},__vite__mapDeps([147,140,141,148,149,144]));return{id:XG,diagram:e}},"loader"),V5e={id:XG,detector:U5e,loader:q5e},KG="quadrantChart",G5e=L(e=>/^\s*quadrantChart/.test(e),"detector"),W5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./quadrantDiagram-AXDQQJYC-l4z3n_F0.js");return{diagram:t}},__vite__mapDeps([150,143,144,145]));return{id:KG,diagram:e}},"loader"),Y5e={id:KG,detector:G5e,loader:W5e},X5e=Y5e,QG="xychart",K5e=L(e=>/^\s*xychart(-beta)?/.test(e),"detector"),Q5e=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./xychartDiagram-S5SC5T6Z-DddbcYvo.js");return{diagram:t}},__vite__mapDeps([151,144,149,143,145]));return{id:QG,diagram:e}},"loader"),Z5e={id:QG,detector:K5e,loader:Q5e},J5e=Z5e,ZG="requirement",eke=L(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),tke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./requirementDiagram-BXWQKSXE-Cd7jowGB.js");return{diagram:t}},__vite__mapDeps([152,133,134]));return{id:ZG,diagram:e}},"loader"),rke={id:ZG,detector:eke,loader:tke},nke=rke,JG="sequence",ike=L(e=>/^\s*sequenceDiagram/.test(e),"detector"),ake=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./sequenceDiagram-WJ2MYXX4-CVi8WWvl.js");return{diagram:t}},__vite__mapDeps([153,139,130]));return{id:JG,diagram:e}},"loader"),ske={id:JG,detector:ike,loader:ake},oke=ske,eW="class",lke=L((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),cke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./classDiagram-ZZMXUADV-Bpzh2rc-.js");return{diagram:t}},__vite__mapDeps([154,155,132,133,134,130]));return{id:eW,diagram:e}},"loader"),uke={id:eW,detector:lke,loader:cke},hke=uke,tW="classDiagram",dke=L((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),fke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./classDiagram-v2-VYDZK3BY-Bpzh2rc-.js");return{diagram:t}},__vite__mapDeps([156,155,132,133,134,130]));return{id:tW,diagram:e}},"loader"),pke={id:tW,detector:dke,loader:fke},mke=pke,rW="state",gke=L((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),yke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./stateDiagram-D77RDMKH-BLh6fljO.js");return{diagram:t}},__vite__mapDeps([157,158,133,134,130,126]));return{id:rW,diagram:e}},"loader"),bke={id:rW,detector:gke,loader:yke},xke=bke,nW="stateDiagram",vke=L((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),Cke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./stateDiagram-v2-MP3YSRHH-BQGzXwru.js");return{diagram:t}},__vite__mapDeps([159,158,133,134,130]));return{id:nW,diagram:e}},"loader"),kke={id:nW,detector:vke,loader:Cke},Tke=kke,iW="journey",wke=L(e=>/^\s*journey/.test(e),"detector"),_ke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./journeyDiagram-3NMN7TZE-q7_9pZeg.js");return{diagram:t}},__vite__mapDeps([160,132,130,148]));return{id:iW,diagram:e}},"loader"),Ske={id:iW,detector:wke,loader:_ke},Eke=Ske,Ake=L((e,t,r)=>{De.debug(`rendering svg for syntax error
|
|
741
|
+
`);const n=W1e(t),i=n.append("g");n.attr("viewBox","0 0 2412 512"),fH(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),aW={draw:Ake},Lke=aW,Nke={db:{},renderer:aW,parser:{parse:L(()=>{},"parse")}},Mke=Nke,sW="flowchart-elk",Bke=L((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),Rke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./flowDiagram-HODETNUW-C8Pk4nlG.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([131,132,133,134,130,135]));return{id:sW,diagram:e}},"loader"),Oke={id:sW,detector:Bke,loader:Rke},Dke=Oke,oW="timeline",Ike=L(e=>/^\s*timeline/.test(e),"detector"),Pke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./timeline-definition-24CTP7MA-DtJY8yTa.js");return{diagram:t}},__vite__mapDeps([161,148]));return{id:oW,diagram:e}},"loader"),Fke={id:oW,detector:Ike,loader:Pke},$ke=Fke,lW="mindmap",zke=L(e=>/^\s*mindmap/.test(e),"detector"),jke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./mindmap-definition-YA3MSWOX-DvvsGhiU.js");return{diagram:t}},__vite__mapDeps([162,133,134]));return{id:lW,diagram:e}},"loader"),Hke={id:lW,detector:zke,loader:jke},Uke=Hke,cW="kanban",qke=L(e=>/^\s*kanban/.test(e),"detector"),Vke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./kanban-definition-UXKFOSKX-B_PA8OOl.js");return{diagram:t}},__vite__mapDeps([163,132]));return{id:cW,diagram:e}},"loader"),Gke={id:cW,detector:qke,loader:Vke},Wke=Gke,uW="sankey",Yke=L(e=>/^\s*sankey(-beta)?/.test(e),"detector"),Xke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./sankeyDiagram-P5KCCOFB-BQ7SGhVJ.js");return{diagram:t}},__vite__mapDeps([164,149,144]));return{id:uW,diagram:e}},"loader"),Kke={id:uW,detector:Yke,loader:Xke},Qke=Kke,hW="packet",Zke=L(e=>/^\s*packet(-beta)?/.test(e),"detector"),Jke=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-Z3DM3KII-BbzQVgBH.js");return{diagram:t}},__vite__mapDeps([165,140,141]));return{id:hW,diagram:e}},"loader"),eTe={id:hW,detector:Zke,loader:Jke},dW="radar",tTe=L(e=>/^\s*radar-beta/.test(e),"detector"),rTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-UQ7AKVKN-7q-3qd8K.js");return{diagram:t}},__vite__mapDeps([166,140,141]));return{id:dW,diagram:e}},"loader"),nTe={id:dW,detector:tTe,loader:rTe},fW="block",iTe=L(e=>/^\s*block(-beta)?/.test(e),"detector"),aTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./blockDiagram-I7D4REHJ-DFuNcOLt.js");return{diagram:t}},__vite__mapDeps([167,132,135]));return{id:fW,diagram:e}},"loader"),sTe={id:fW,detector:iTe,loader:aTe},oTe=sTe,pW="treeView",lTe=L(e=>/^\s*treeView-beta/.test(e),"detector"),cTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-S7CK7UJ4-BAM2BpKM.js");return{diagram:t}},__vite__mapDeps([168,139,140,141]));return{id:pW,diagram:e}},"loader"),uTe={id:pW,detector:lTe,loader:cTe},hTe=uTe,mW="architecture",dTe=L(e=>/^\s*architecture/.test(e),"detector"),fTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./architectureDiagram-5GKGNRK7-C1fv9eXI.js");return{diagram:t}},__vite__mapDeps([169,140,141,128]));return{id:mW,diagram:e}},"loader"),pTe={id:mW,detector:dTe,loader:fTe},mTe=pTe,gW="eventmodeling",gTe=L(e=>/^\s*eventmodeling/.test(e),"detector"),yTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-VSXAHHWV-DyDN2Dy5.js");return{diagram:t}},__vite__mapDeps([170,140,141]));return{id:gW,diagram:e}},"loader"),bTe={id:gW,detector:gTe,loader:yTe},xTe=bTe,yW="ishikawa",vTe=L(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),CTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./ishikawaDiagram-5VMMS53U-DMctgGQX.js");return{diagram:t}},[]);return{id:yW,diagram:e}},"loader"),kTe={id:yW,detector:vTe,loader:CTe},bW="venn",TTe=L(e=>/^\s*venn-beta/.test(e),"detector"),wTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./vennDiagram-4TSXK5OY-CFSuq2L2.js");return{diagram:t}},[]);return{id:bW,diagram:e}},"loader"),_Te={id:bW,detector:TTe,loader:wTe},STe=_Te,xW="treemap",ETe=L(e=>/^\s*treemap/.test(e),"detector"),ATe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./diagram-VX7I27RA-Crx3iBbP.js");return{diagram:t}},__vite__mapDeps([171,140,134,141,145,149,144]));return{id:xW,diagram:e}},"loader"),LTe={id:xW,detector:ETe,loader:ATe},vW="wardley",NTe=L(e=>/^\s*wardley-beta/i.test(e),"detector"),MTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./wardleyDiagram-VM6X3IG4-CKvvJBcc.js");return{diagram:t}},__vite__mapDeps([172,140,141]));return{id:vW,diagram:e}},"loader"),BTe={id:vW,detector:NTe,loader:MTe},RTe=BTe,CW="cynefin",OTe=L(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),DTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./cynefinDiagram-5FMLGOSQ-CyI-Lc3p.js");return{diagram:t}},__vite__mapDeps([173,140,141]));return{id:CW,diagram:e}},"loader"),ITe={id:CW,detector:OTe,loader:DTe},kW="railroad",PTe=L(e=>/^\s*railroad-beta/i.test(e),"detector"),FTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./railroadDiagram-O6MQD6OU-Dc_OE3KY.js");return{diagram:t}},__vite__mapDeps([174,175,140,141]));return{id:kW,diagram:e}},"loader"),$Te={id:kW,detector:PTe,loader:FTe},TW="railroadEbnf",zTe=L(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),jTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./ebnfDiagram-PWID7BFC-C8atccSR.js");return{diagram:t}},__vite__mapDeps([176,175,140,141]));return{id:TW,diagram:e}},"loader"),HTe={id:TW,detector:zTe,loader:jTe},wW="railroadAbnf",UTe=L(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),qTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./abnfDiagram-VCTEODGH-2gclQRGh.js");return{diagram:t}},__vite__mapDeps([177,175,140,141]));return{id:wW,diagram:e}},"loader"),VTe={id:wW,detector:UTe,loader:qTe},_W="railroadPeg",GTe=L(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),WTe=L(async()=>{const{diagram:e}=await Q(async()=>{const{diagram:t}=await import("./pegDiagram-XKGWAZYB-B_yksjYt.js");return{diagram:t}},__vite__mapDeps([178,175,140,141]));return{id:_W,diagram:e}},"loader"),YTe={id:_W,detector:GTe,loader:WTe},GR=!1,Wx=L(()=>{GR||(GR=!0,Jb("error",Mke,e=>e.toLowerCase().trim()==="error"),Jb("---",{db:{clear:L(()=>{},"clear")},styles:{},renderer:{draw:L(()=>{},"draw")},parser:{parse:L(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:L(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),oT(Dke,Uke,mTe),oT(m5e,Wke,mke,hke,M5e,$5e,H5e,V5e,nke,oke,E5e,T5e,x5e,$ke,D5e,Tke,xke,Eke,X5e,Qke,eTe,J5e,oTe,xTe,hTe,nTe,kTe,LTe,$Te,HTe,VTe,YTe,STe,RTe,ITe))},"addDiagrams"),XTe=L(async()=>{De.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Dh).map(async([r,{detector:n,loader:i}])=>{if(i)try{hT(r)}catch{try{const{diagram:a,id:s}=await i();Jb(s,a,n)}catch(a){throw De.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Dh[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){De.error(`Failed to load ${t.length} external diagrams`);for(const r of t)De.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),KTe="graphics-document document";function SW(e,t){e.attr("role",KTe),t!==""&&e.attr("aria-roledescription",t)}L(SW,"setA11yDiagramInfo");function EW(e,t,r,n){if(e.insert!==void 0){if(r){const i=`chart-desc-${n}`;e.attr("aria-describedby",i),e.insert("desc",":first-child").attr("id",i).text(r)}if(t){const i=`chart-title-${n}`;e.attr("aria-labelledby",i),e.insert("title",":first-child").attr("id",i).text(t)}}}L(EW,"addSVGa11yTitleDescription");var Nh,GT=(Nh=class{constructor(t,r,n,i,a){this.type=t,this.text=r,this.db=n,this.parser=i,this.renderer=a}static async fromText(t,r={}){const n=pn(),i=W6(t,n);t=gbe(t)+`
|
|
742
742
|
`;try{hT(i)}catch{const h=jfe(i);if(!h)throw new oH(`Diagram ${i} not found.`);const{id:d,diagram:f}=await h();Jb(d,f)}const{db:a,parser:s,renderer:l,init:c}=hT(i);return s.parser&&(s.parser.yy=a),a.clear?.(),c?.(n),r.title&&a.setDiagramTitle?.(r.title),await s.parse(t),new Nh(i,t,a,s,l)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},L(Nh,"Diagram"),Nh),WR=[],QTe=L(()=>{WR.forEach(e=>{e()}),WR=[]},"attachFunctions"),ZTe=L(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function AW(e){const t=e.match(sH);if(!t)return{text:e,metadata:{}};const r=t[1],n=r?t[2].split(`
|
|
743
743
|
`).map(s=>s.startsWith(r)?s.slice(r.length):s).join(`
|
|
744
744
|
`):t[2];let i=VCe(n,{schema:qCe})??{};i=typeof i=="object"&&!Array.isArray(i)?i:{};const a={};return i.displayMode&&(a.displayMode=i.displayMode.toString()),i.title&&(a.title=i.title.toString()),i.config&&(a.config=i.config),{text:e.slice(t[0].length),metadata:a}}L(AW,"extractFrontMatter");var JTe=L(e=>e.replace(/\r\n?/g,`
|
|
@@ -853,7 +853,7 @@ ${e}</tr>
|
|
|
853
853
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${$o(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let n=this.parser.parseInline(r),i=nD(e);if(i===null)return n;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+$o(t)+'"'),a+=">"+n+"</a>",a}image({href:e,title:t,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let i=nD(e);if(i===null)return $o(r);e=i;let a=`<img src="${e}" alt="${$o(r)}"`;return t&&(a+=` title="${$o(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:$o(e.text)}},jS=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Ks=class cw{options;renderer;textRenderer;constructor(t){this.options=t||nd,this.options.renderer=this.options.renderer||new N2,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new jS}static parse(t,r){return new cw(r).parse(t)}static parseInline(t,r){return new cw(r).parseInline(t)}parse(t){this.renderer.parser=this;let r="";for(let n=0;n<t.length;n++){let i=t[n];if(this.options.extensions?.renderers?.[i.type]){let s=i,l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(s.type)){r+=l||"";continue}}let a=i;switch(a.type){case"space":{r+=this.renderer.space(a);break}case"hr":{r+=this.renderer.hr(a);break}case"heading":{r+=this.renderer.heading(a);break}case"code":{r+=this.renderer.code(a);break}case"table":{r+=this.renderer.table(a);break}case"blockquote":{r+=this.renderer.blockquote(a);break}case"list":{r+=this.renderer.list(a);break}case"checkbox":{r+=this.renderer.checkbox(a);break}case"html":{r+=this.renderer.html(a);break}case"def":{r+=this.renderer.def(a);break}case"paragraph":{r+=this.renderer.paragraph(a);break}case"text":{r+=this.renderer.text(a);break}default:{let s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return r}parseInline(t,r=this.renderer){this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(a.type)){n+=l||"";continue}}let s=a;switch(s.type){case"escape":{n+=r.text(s);break}case"html":{n+=r.html(s);break}case"link":{n+=r.link(s);break}case"image":{n+=r.image(s);break}case"checkbox":{n+=r.checkbox(s);break}case"strong":{n+=r.strong(s);break}case"em":{n+=r.em(s);break}case"codespan":{n+=r.codespan(s);break}case"br":{n+=r.br(s);break}case"del":{n+=r.del(s);break}case"text":{n+=r.text(s);break}default:{let l='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}},nm=class{options;block;constructor(e){this.options=e||nd}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?xs.lex:xs.lexInline}provideParser(e=this.block){return e?Ks.parse:Ks.parseInline}},TMe=class{defaults=OS();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ks;Renderer=N2;TextRenderer=jS;Lexer=xs;Tokenizer=L2;Hooks=nm;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let n of e)switch(r=r.concat(t.call(this,n)),n.type){case"table":{let i=n;for(let a of i.header)r=r.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let s of a)r=r.concat(this.walkTokens(s.tokens,t));break}case"list":{let i=n;r=r.concat(this.walkTokens(i.items,t));break}default:{let i=n;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let s=i[a].flat(1/0);r=r.concat(this.walkTokens(s,t))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...s){let l=i.renderer.apply(this,s);return l===!1&&(l=a.apply(this,s)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),n.extensions=t),r.renderer){let i=this.defaults.renderer||new N2(this.defaults);for(let a in r.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let s=a,l=r.renderer[s],c=i[s];i[s]=(...h)=>{let d=l.apply(i,h);return d===!1&&(d=c.apply(i,h)),d||""}}n.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new L2(this.defaults);for(let a in r.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let s=a,l=r.tokenizer[s],c=i[s];i[s]=(...h)=>{let d=l.apply(i,h);return d===!1&&(d=c.apply(i,h)),d}}n.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new nm;for(let a in r.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let s=a,l=r.hooks[s],c=i[s];nm.passThroughHooks.has(a)?i[s]=h=>{if(this.defaults.async&&nm.passThroughHooksRespectAsync.has(a))return(async()=>{let f=await l.call(i,h);return c.call(i,f)})();let d=l.call(i,h);return c.call(i,d)}:i[s]=(...h)=>{if(this.defaults.async)return(async()=>{let f=await l.apply(i,h);return f===!1&&(f=await c.apply(i,h)),f})();let d=l.apply(i,h);return d===!1&&(d=c.apply(i,h)),d}}n.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,a=r.walkTokens;n.walkTokens=function(s){let l=[];return l.push(a.call(this,s)),i&&(l=l.concat(i.call(this,s))),l}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return xs.lex(e,t??this.defaults)}parser(e,t){return Ks.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let n={...r},i={...this.defaults,...n},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let s=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer(e):e?xs.lex:xs.lexInline)(s,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let h=await(i.hooks?await i.hooks.provideParser(e):e?Ks.parse:Ks.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(h):h})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let s=(i.hooks?i.hooks.provideLexer(e):e?xs.lex:xs.lexInline)(t,i);i.hooks&&(s=i.hooks.processAllTokens(s)),i.walkTokens&&this.walkTokens(s,i.walkTokens);let l=(i.hooks?i.hooks.provideParser(e):e?Ks.parse:Ks.parseInline)(s,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(s){return a(s)}}}onError(e,t){return r=>{if(r.message+=`
|
|
854
854
|
Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+$o(r.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(r);throw r}}},Uh=new TMe;function Vr(e,t){return Uh.parse(e,t)}Vr.options=Vr.setOptions=function(e){return Uh.setOptions(e),Vr.defaults=Uh.defaults,dX(Vr.defaults),Vr};Vr.getDefaults=OS;Vr.defaults=nd;function wMe(...e){return Uh.use(...e),Vr.defaults=Uh.defaults,dX(Vr.defaults),Vr}Vr.use=wMe;Vr.walkTokens=function(e,t){return Uh.walkTokens(e,t)};Vr.parseInline=Uh.parseInline;Vr.Parser=Ks;Vr.parser=Ks.parse;Vr.Renderer=N2;Vr.TextRenderer=jS;Vr.Lexer=xs;Vr.lexer=xs.lex;Vr.Tokenizer=L2;Vr.Hooks=nm;Vr.parse=Vr;Vr.options;Vr.setOptions;Vr.walkTokens;Vr.parseInline;Ks.parse;xs.lex;var _Me=300,SMe="300px",EMe=500;function AMe(e={}){let{immediate:t=!1,debounceDelay:r=_Me,rootMargin:n=SMe,idleTimeout:i=EMe}=e,[a,s]=$.useState(!1),l=$.useRef(null),c=$.useRef(null),h=$.useRef(null),d=$.useMemo(()=>g=>{let b=Date.now();return window.setTimeout(()=>{g({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-b))})},1)},[]),f=$.useMemo(()=>typeof window<"u"&&window.requestIdleCallback?(g,b)=>window.requestIdleCallback(g,b):d,[d]),m=$.useMemo(()=>typeof window<"u"&&window.cancelIdleCallback?g=>window.cancelIdleCallback(g):g=>{clearTimeout(g)},[]);return $.useEffect(()=>{if(t){s(!0);return}let g=l.current;if(!g)return;c.current&&(clearTimeout(c.current),c.current=null),h.current&&(m(h.current),h.current=null);let b=()=>{c.current&&(clearTimeout(c.current),c.current=null),h.current&&(m(h.current),h.current=null)},x=S=>{h.current=f(N=>{N.timeRemaining()>0||N.didTimeout?(s(!0),S.disconnect()):h.current=f(()=>{s(!0),S.disconnect()},{timeout:i/2})},{timeout:i})},k=S=>{b(),c.current=window.setTimeout(()=>{var N,B;let I=S.takeRecords();(I.length===0||(B=(N=I.at(-1))==null?void 0:N.isIntersecting)!=null&&B)&&x(S)},r)},w=(S,N)=>{S.isIntersecting?k(N):b()},_=new IntersectionObserver(S=>{for(let N of S)w(N,_)},{rootMargin:n,threshold:0});return _.observe(g),()=>{c.current&&clearTimeout(c.current),h.current&&m(h.current),_.disconnect()}},[t,r,n,i,m,f]),{shouldRender:a,containerRef:l}}var LMe=320,NMe=4,kX=()=>typeof performance>"u"?Date.now():performance.now();function oD(e){var t,r;let n=(t=e?.now)!=null?t:kX,i=(r=e?.maxBacklogMs)!=null?r:LMe,a=0,s=0;return{now:n,beginPass(l){s=Math.min(Math.max(a,l),l+i)},mark(){return s},rewind(l){s=l},take(l,c,h){if(l<=0)return{baseDelay:0,step:Math.max(0,c)};let d=Math.max(0,c),f=d===0?0:Math.min(d,NMe),m=Math.max(s,h),g=h+i,b=m+Math.max(0,l-1)*d,x=d;if(b>g&&l>1)if(m<g){let w=g-m;x=Math.max(f,w/(l-1))}else x=f;let k=Math.max(0,Math.round(m-h));return s=m+l*x,{baseDelay:k,step:x}},commitPass(){a=s}}}var TX=/\s/,MMe=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\u3000-\u303F\uFF00-\uFFEF]/u,HS=/^\s+$/,BMe=new Set(["pre","svg","math","annotation"]),RMe=new Set(["img","hr"]),_g=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",US=e=>e.some(t=>_g(t)&&BMe.has(t.tagName)),OMe=e=>{for(let t=e.length-1;t>=0;t--){let r=e[t];if(_g(r)&&r.tagName==="li")return r}},DMe=(e,t,r,n)=>{e.properties!=null||(e.properties={}),e.properties["data-sd-animate-marker"]=!0;let i=typeof e.properties.style=="string"?`${e.properties.style};`:"";e.properties.style=`${i}--sd-marker-duration:${t}ms;--sd-marker-delay:${Math.round(r)}ms;--sd-marker-easing:${n}`},IMe=new Set(["ul","ol","li"]),wX=e=>{for(let t of e.children)if(_g(t)){if(t.tagName==="input")return t;if(IMe.has(t.tagName))continue;let r=wX(t);if(r)return r}},_X=(e,t,r,n)=>{e.properties!=null||(e.properties={}),e.properties["data-sd-animate"]=!0;let i=typeof e.properties.style=="string"?`${e.properties.style};`:"";e.properties.style=`${i}--sd-animation:sd-${t.animation};--sd-duration:${r}ms;--sd-easing:${t.easing};--sd-delay:${Math.round(n)}ms`},PMe=(e,t,r,n)=>{let i=wX(e);i&&_X(i,t,r,n)},FMe=(e,t,r,n,i,a)=>{if(US(t))return;let s=n.prevContentLength,l=i.count;i.count+=1;let c=s>0&&l<s,h=c?0:a.baseDelay+i.newIndex++*a.step;_X(e,r,c?0:r.duration,h)},$Me=e=>{var t;for(let r=e.length-1;r>=0;r-=1){let n=e[r];if(_g(n)){if((t=n.properties)!=null&&t["data-sd-animated"])break;n.properties={...n.properties,"data-sd-animated":!0}}}},SX=e=>{let t=[],r="",n=!1,i=!1;for(let a of e){let s=TX.test(a),l=!s&&MMe.test(a);if(!s&&r!==""&&(l||i))t.push(r),r="",n=!1;else if(s!==n&&r){if(s){r+=a,n=!0;continue}t.push(r),r=""}r+=a,n=s,i=l}return r&&t.push(r),t},EX=e=>{let t=[],r="";for(let n of e)TX.test(n)?t.length>0&&!HS.test(t.at(-1))?t[t.length-1]+=n:r+=n:(r&&(t.push(r),r=""),t.push(n));return r&&(t.length>0?t[t.length-1]+=r:t.push(r)),t},lD=/^[^\s;:'"\\/](?:[^;:'"\\/\r\n]*[^\s;:'"\\/])?$/,zMe=(e,t,r,n)=>{let i=`sd-${t.animation}`,a=`${r?0:t.duration}ms`,s;return t.styleObjects?(s={"--sd-animation":i,"--sd-duration":a,"--sd-easing":t.easing},n&&(s["--sd-delay"]=`${Math.round(n)}ms`)):(s=`--sd-animation:${i};--sd-duration:${a};--sd-easing:${t.easing}`,n&&(s+=`;--sd-delay:${Math.round(n)}ms`)),{type:"element",tagName:"span",properties:{"data-sd-animate":!0,style:s},children:[{type:"text",value:e}]}},cD=(e,t)=>!(e>0&&t<e),uw=e=>_g(e)&&RMe.has(e.tagName),jMe=(e,t,r)=>{let n=0,i=0;return z0(e,a=>a.type==="text"||uw(a),(a,s)=>{if(US(s))return Wo;if(uw(a)){cD(r,i)&&(n+=1),i+=1;return}let l=a.value;if(!l.trim()){i+=l.length;return}let c=t.sep==="char"?EX(l):SX(l);for(let h of c){let d=i;i+=h.length,!HS.test(h)&&cD(r,d)&&(n+=1)}}),n},HMe=(e,t,r,n,i,a)=>{var s;let l=t.at(-1);if(!(l&&"children"in l))return;if(US(t))return Wo;let c=l,h=c.children.indexOf(e);if(h===-1)return;let d=e.value;if(!d.trim()){i.count+=d.length;return}let f=r.sep==="char"?EX(d):SX(d),m=n.prevContentLength,g=!1,b=OMe(t),x=!!(b&&!((s=b.properties)!=null&&s["data-sd-animate-marker"])),k=!1,w=f.map(_=>{let S=i.count;if(i.count+=_.length,HS.test(_))return{type:"text",value:_};let N=m>0&&S<m,B=N?0:a.baseDelay+i.newIndex++*a.step;if(g=!0,b&&x&&!k){let I=N?0:r.duration;DMe(b,I,B,r.easing),PMe(b,r,I,B),k=!0}return zMe(_,r,N,B)});return g&&$Me(t),c.children.splice(h,1,...w),h+w.length},UMe=0;function qMe(e){return AX(e,!1)}var VMe=e=>AX(e,!0);function AX(e,t){var r,n,i,a,s;let l=(r=e?.animation)!=null?r:"fadeIn",c=(n=e?.easing)!=null?n:"ease",h={animation:l,duration:(i=e?.duration)!=null?i:150,easing:c,sep:(a=e?.sep)!=null?a:"word",stagger:(s=e?.stagger)!=null?s:40,styleObjects:t&&lD.test(l)&&lD.test(c),timeline:e?.timeline},d={committedCharCount:0,prevContentLength:0,lastRenderCharCount:0,pendingMark:null},f=UMe++,m=()=>g=>{var b;let x={count:0,newIndex:0};d.prevContentLength=d.committedCharCount;let k=h.timeline,w=(b=k?.now())!=null?b:kX();k&&(d.pendingMark===null?d.pendingMark=k.mark():k.rewind(d.pendingMark));let _=k?k.take(jMe(g,h,d.prevContentLength),h.stagger,w):{baseDelay:0,step:h.stagger};z0(g,S=>S.type==="text"||uw(S),(S,N)=>{if(S.type==="text")return HMe(S,N,h,d,x,_);FMe(S,N,h,d,x,_)}),d.lastRenderCharCount=x.count,d.prevContentLength=0};return Object.defineProperty(m,"name",{value:`rehypeAnimate$${f}`}),{name:"animate",type:"animate",rehypePlugin:m,setPrevContentLength(g){d.committedCharCount=g,d.prevContentLength=g},getLastRenderCharCount(){return d.lastRenderCharCount},commit(){d.committedCharCount=d.lastRenderCharCount,d.pendingMark=null}}}qMe();var LX=$.createContext(!1),NX=()=>$.useContext(LX),nv=(...e)=>r6(Jw(e)),GMe=(e,t)=>{if(!e||!t)return t;let r=`${e}:`;return t.split(/\s+/).filter(Boolean).map(n=>n.startsWith(r)?n:`${e}:${n}`).join(" ")},WMe=e=>e?(...t)=>GMe(e,r6(Jw(t))):nv,C0=(e,t,r)=>{let n=typeof t=="string"&&r.startsWith("text/csv")?"\uFEFF":"",i=typeof t=="string"?new Blob([n+t],{type:r}):t,a=URL.createObjectURL(i),s=document.createElement("a");s.href=a,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(a)},hw=$.createContext(nv),hr=()=>$.useContext(hw),YMe=8,MX=e=>{if(!(e===void 0||e===0||e===Number.POSITIVE_INFINITY)){if(typeof e=="number")return Number.isFinite(e)&&e>0?`${e}px`:void 0;if(!(e==="0"||e==="none"||e==="Infinity"))return e}},BX=(e,t,r)=>{let n=$.useRef(null),i=$.useRef(!0),a=$.useRef(!1),s=$.useRef(null);return $.useEffect(()=>{let l=n.current;if(!(l&&t))return;let c=()=>{let h=l.scrollHeight-l.scrollTop-l.clientHeight<YMe;i.current=h};return l.addEventListener("scroll",c,{passive:!0}),()=>l.removeEventListener("scroll",c)},[t]),$.useEffect(()=>{e&&!a.current&&(i.current=!0),e||(i.current=!0),a.current=e},[e]),$.useEffect(()=>()=>{s.current!==null&&cancelAnimationFrame(s.current)},[]),$.useEffect(()=>{let l=n.current;!(l&&t&&e&&i.current)||s.current!==null||(s.current=requestAnimationFrame(()=>{s.current=null,i.current&&l.scrollTo({top:l.scrollHeight,behavior:"instant"})}))},[e,t,r]),n},XMe=nv("block"),KMe=nv("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),QMe=e=>{let t={};for(let r of e.split(";")){let n=r.indexOf(":");if(n>0){let i=r.slice(0,n).trim(),a=r.slice(n+1).trim();i&&a&&(t[i]=a)}}return t},ZMe=$.memo(({children:e,result:t,language:r,className:n,maxHeight:i,startLine:a,lineNumbers:s=!0,...l})=>{let c=hr(),{isAnimating:h}=$.useContext(xi),d=MX(i),f=BX(h,!!d,t),m=$.useMemo(()=>c(KMe),[c]),g=$.useMemo(()=>c(XMe),[c]),b=$.useMemo(()=>{let x={};return t.bg&&(x["--sdm-bg"]=t.bg),t.fg&&(x["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(x,QMe(t.rootStyle)),x},[t.bg,t.fg,t.rootStyle]);return C.jsx("div",{className:c(n,d?"overflow-y-auto":null,"overflow-x-auto rounded-md border border-border bg-background p-4 text-sm"),"data-language":r,"data-streamdown":"code-block-body",ref:f,style:d?{maxHeight:d}:void 0,...l,children:C.jsx("pre",{className:c(n,"bg-[var(--sdm-bg,inherit)]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]"),style:b,children:C.jsx("code",{className:s?c("[counter-increment:line_0] [counter-reset:line]"):void 0,style:s&&a&&a>1?{counterReset:`line ${a-1}`}:void 0,children:t.tokens.map((x,k)=>C.jsx("span",{className:s?m:g,children:x.length===0||x.length===1&&x[0].content===""?`
|
|
855
855
|
`:x.map((w,_)=>{let S={},N=!!w.bgColor;if(w.color&&(S["--sdm-c"]=w.color),w.bgColor&&(S["--sdm-tbg"]=w.bgColor),w.htmlStyle)for(let[B,I]of Object.entries(w.htmlStyle))B==="color"?S["--sdm-c"]=I:B==="background-color"?(S["--sdm-tbg"]=I,N=!0):S[B]=I;return C.jsx("span",{className:c("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",N&&"bg-[var(--sdm-tbg)]",N&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:S,...w.htmlAttrs,children:w.content},_)})},k))})})})}),JMe=({className:e,language:t,style:r,isIncomplete:n,...i})=>{let a=hr();return C.jsx("div",{className:a("relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":n||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...r},...i})},RX=$.createContext({code:""}),OX=()=>$.useContext(RX),eBe=({language:e})=>{let t=hr();return C.jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:C.jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})},tBe=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
856
|
-
`;)t--;return e.slice(0,t)},rBe=$.lazy(()=>Q(()=>import("./highlighted-body-JLMTFACH-
|
|
856
|
+
`;)t--;return e.slice(0,t)},rBe=$.lazy(()=>Q(()=>import("./highlighted-body-JLMTFACH-k1IRl1ju.js"),[]).then(e=>({default:e.HighlightedCodeBlockBody}))),nBe=({code:e,language:t,className:r,children:n,isIncomplete:i=!1,startLine:a,lineNumbers:s,...l})=>{let c=hr(),{codeBlockMaxHeight:h}=$.useContext(xi),d=$.useMemo(()=>tBe(e),[e]),f=$.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:d.split(`
|
|
857
857
|
`).map(m=>[{content:m,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[d]);return C.jsx(RX.Provider,{value:{code:e},children:C.jsxs(JMe,{dir:"ltr",isIncomplete:i,language:t,children:[C.jsx(eBe,{language:t}),n?C.jsx("div",{className:c("pointer-events-none absolute top-2 right-2 z-10 flex items-center"),children:C.jsx("div",{className:c("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"code-block-actions",children:n})}):null,C.jsx($.Suspense,{fallback:C.jsx(ZMe,{className:r,language:t,lineNumbers:s,maxHeight:h,result:f,startLine:a,...l}),children:C.jsx(rBe,{className:r,code:d,isIncomplete:i,language:t,lineNumbers:s,maxHeight:h,raw:f,startLine:a,...l})})]})})},iBe=e=>C.jsx("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:C.jsx("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),aBe=e=>C.jsx("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:C.jsx("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),sBe=e=>C.jsx("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:C.jsx("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),oBe=e=>C.jsxs("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[C.jsx("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),C.jsx("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),lBe=e=>C.jsx("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:C.jsx("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),cBe=e=>C.jsx("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:C.jsx("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),uBe=e=>C.jsx("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:C.jsx("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),hBe=e=>C.jsx("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:C.jsx("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),dBe=e=>C.jsx("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:C.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),fBe=e=>C.jsx("svg",{"aria-hidden":"true",color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:C.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),im={CheckIcon:iBe,CopyIcon:aBe,DownloadIcon:sBe,ExternalLinkIcon:hBe,Loader2Icon:oBe,Maximize2Icon:lBe,RotateCcwIcon:cBe,XIcon:uBe,ZoomInIcon:dBe,ZoomOutIcon:fBe},DX=$.createContext(im),pBe=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let r=Object.keys(e),n=Object.keys(t);return r.length!==n.length?!1:r.every(i=>e[i]===t[i])},uD=({icons:e,children:t})=>{let r=$.useRef(e),n=$.useRef(e?{...im,...e}:im);pBe(r.current,e)||(r.current=e,n.current=e?{...im,...e}:im);let i=n.current;return C.jsx(DX.Provider,{value:i,children:t})},po=()=>$.useContext(DX),IX={copyCode:"Copy Code",downloadFile:"Download file",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",zoomIn:"Zoom in",zoomOut:"Zoom out",resetView:"Reset zoom and pan",mermaidAriaLabel:"Mermaid chart",errorMermaid:"Failed to render Mermaid chart",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAsMarkdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},dw=$.createContext(IX),mo=()=>$.useContext(dw),fw=({onCopy:e,onError:t,timeout:r=2e3,children:n,className:i,code:a,...s})=>{let l=hr(),[c,h]=$.useState(!1),d=$.useRef(0),{code:f}=OX(),{isAnimating:m}=$.useContext(xi),g=mo(),b=a??f,x=async()=>{var _;if(typeof window>"u"||!((_=navigator?.clipboard)!=null&&_.writeText)){t?.(new Error("Clipboard API not available"));return}try{c||(await navigator.clipboard.writeText(b),h(!0),e?.(),d.current=window.setTimeout(()=>h(!1),r))}catch(S){t?.(S)}};$.useEffect(()=>()=>{window.clearTimeout(d.current)},[]);let k=po(),w=c?k.CheckIcon:k.CopyIcon;return C.jsxs(C.Fragment,{children:[C.jsx("button",{"aria-label":g.copyCode,className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),"data-streamdown":"code-block-copy-button",disabled:m,onClick:x,title:g.copyCode,type:"button",...s,children:n??C.jsx(w,{"aria-hidden":"true",size:14})}),c&&C.jsx("output",{"aria-live":"polite",className:"sr-only",children:g.copied})]})},qS=(e,t,r)=>{if(typeof e=="boolean")return r;let n=e[t];if(typeof n!="object")return r;let i=n.download;return typeof i!="object"?r:i.filename||r},hD=(e,t)=>{if(typeof e=="boolean")return{};let r=e[t];if(typeof r!="object")return{};let n=r.copy;return typeof n!="object"||n===null?{}:{onCopy:n.onCopy,onError:n.onError}},dD={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",文言:"wy"},mBe=({onDownload:e,onError:t,language:r,children:n,className:i,code:a,...s})=>{let l=hr(),{code:c}=OX(),{isAnimating:h,controls:d}=$.useContext(xi),f=mo(),m=po(),g=a??c,b=r&&r in dD?dD[r]:"txt",x=`${qS(d,"code","file")}.${b}`,k="text/plain",w=()=>{try{C0(x,g,k),e?.()}catch(_){t?.(_)}};return C.jsx("button",{"aria-label":f.downloadFile,className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),"data-streamdown":"code-block-download-button",disabled:h,onClick:w,title:f.downloadFile,type:"button",...s,children:n??C.jsx(m.DownloadIcon,{size:14})})},fD=()=>{let{Loader2Icon:e}=po(),t=hr();return C.jsxs("div",{className:t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),children:[C.jsx("div",{className:t("h-[46px] w-full bg-muted/80")}),C.jsx("div",{className:t("flex w-full items-center justify-center p-4"),children:C.jsx(e,{className:t("size-4 animate-spin")})})]})},gBe=/\.[^/.]+$/,yBe=({node:e,className:t,src:r,alt:n,onLoad:i,onError:a,showControls:s=!0,showDownloadControl:l=!0,...c})=>{let{DownloadIcon:h}=po(),d=hr(),f=$.useRef(null),[m,g]=$.useState(!1),[b,x]=$.useState(!1),k=mo(),w=c.width!=null||c.height!=null,_=(m||w)&&!b&&s&&l,S=b&&!w;$.useEffect(()=>{let P=f.current;if(P!=null&&P.complete){let O=P.naturalWidth>0;g(O),x(!O)}},[]);let N=$.useCallback(P=>{g(!0),x(!1),i?.(P)},[i]),B=$.useCallback(P=>{g(!1),x(!0),a?.(P)},[a]),I=async()=>{if(r)try{let P=await(await fetch(r)).blob(),O=new URL(r,window.location.origin).pathname.split("/").pop()||"",X=O.split(".").pop(),j=O.includes(".")&&X!==void 0&&X.length<=4,Z="";if(j)Z=O;else{let se=P.type,ue="png";se.includes("jpeg")||se.includes("jpg")?ue="jpg":se.includes("png")?ue="png":se.includes("svg")?ue="svg":se.includes("gif")?ue="gif":se.includes("webp")&&(ue="webp"),Z=`${(n||O||"image").replace(gBe,"")}.${ue}`}C0(Z,P,P.type)}catch{window.open(r,"_blank")}};return r?r===Ym?C.jsx("div",{className:d("group relative my-4 inline-block"),"data-incomplete":"true","data-streamdown":"image-wrapper",children:C.jsx("div",{className:d("h-24 w-48 animate-pulse rounded-lg bg-muted"),"data-streamdown":"image-placeholder"})}):C.jsxs("div",{className:d("group relative my-4 inline-block"),"data-streamdown":"image-wrapper",children:[C.jsx("img",{alt:n,className:d("max-w-full rounded-lg",S&&"hidden",t),"data-streamdown":"image",onError:B,onLoad:N,ref:f,src:r,...c}),S&&C.jsx("span",{className:d("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:k.imageNotAvailable}),s&&C.jsx("div",{className:d("pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"),"data-streamdown":"image-overlay"}),_&&C.jsx("button",{className:d("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:I,title:k.downloadImage,type:"button",children:C.jsx(h,{size:14})})]}):null},VS=e=>{let t=typeof e=="function"?e():e;return t??document.body},_m=0,GS=()=>{_m+=1,_m===1&&(document.body.style.overflow="hidden")},WS=()=>{_m=Math.max(0,_m-1),_m===0&&(document.body.style.overflow="")},bBe=({url:e,isOpen:t,onClose:r,onConfirm:n})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:s,XIcon:l}=po(),c=hr(),[h,d]=$.useState(!1),f=mo(),{portal:m}=$.useContext(xi),g=$.useCallback(async()=>{try{await navigator.clipboard.writeText(e),d(!0),setTimeout(()=>d(!1),2e3)}catch{}},[e]),b=$.useCallback(()=>{n(),r()},[n,r]);if($.useEffect(()=>{if(t){GS();let k=w=>{w.key==="Escape"&&r()};return document.addEventListener("keydown",k),()=>{document.removeEventListener("keydown",k),WS()}}},[t,r]),!t||typeof document>"u")return null;let x=C.jsx("div",{className:c("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:r,onKeyDown:k=>{k.key==="Escape"&&r()},role:"button",tabIndex:0,children:C.jsxs("div",{className:c("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),onClick:k=>k.stopPropagation(),onKeyDown:k=>k.stopPropagation(),role:"presentation",children:[C.jsx("button",{className:c("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:r,title:f.close,type:"button",children:C.jsx(l,{size:16})}),C.jsxs("div",{className:c("flex flex-col gap-2"),children:[C.jsxs("div",{className:c("flex items-center gap-2 font-semibold text-lg"),children:[C.jsx(s,{size:20}),C.jsx("span",{children:f.openExternalLink})]}),C.jsx("p",{className:c("text-muted-foreground text-sm"),children:f.externalLinkWarning})]}),C.jsx("div",{className:c("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),C.jsxs("div",{className:c("flex gap-2"),children:[C.jsx("button",{className:c("flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted"),onClick:g,type:"button",children:h?C.jsxs(C.Fragment,{children:[C.jsx(i,{size:14}),C.jsx("span",{children:f.copied})]}):C.jsxs(C.Fragment,{children:[C.jsx(a,{size:14}),C.jsx("span",{children:f.copyLink})]})}),C.jsxs("button",{className:c("flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90"),onClick:b,type:"button",children:[C.jsx(s,{size:14}),C.jsx("span",{children:f.openLink})]})]})]})});return tv.createPortal(x,VS(m))},pw=$.createContext(null),YS=()=>$.useContext(pw),_je=()=>{var e;let t=YS();return(e=t?.code)!=null?e:null},XS=()=>{var e;let t=YS();return(e=t?.mermaid)!=null?e:null},xBe=e=>{var t;let r=YS();return r!=null&&r.renderers&&e&&(t=r.renderers.find(n=>Array.isArray(n.language)?n.language.includes(e):n.language===e))!=null?t:null},PX=/<svg\b[^>]*>/i,vBe=/\bviewBox=(['"])(.*?)\1/i,CBe=/[\s,]+/,kBe=/\swidth=(['"]).*?\1/gi,TBe=/\sheight=(['"]).*?\1/gi,pD=/\sstyle=(['"])(.*?)\1/i,wBe=/^width\s*:/i,_Be=/^height\s*:/i,SBe=/^max-width\s*:/i,mD=/^<svg/i,FX=e=>{let t=e.match(PX);if(!t)return null;let r=t[0].match(vBe),n=r?.[2];if(!n)return null;let i=n.trim().split(CBe).map(l=>Number.parseFloat(l));if(i.length<4||i.slice(0,4).some(Number.isNaN))return null;let a=i[2],s=i[3];return a>0&&s>0?{height:s,width:a}:null},EBe=e=>{let t=e.match(PX);if(!t)return e;try{let r=t[0],n=FX(e);if(!n)return e;let{width:i,height:a}=n,s=r.replace(kBe,"").replace(TBe,""),l=s.match(pD),c=`width:${i}px;height:${a}px;max-width:none;`;if(l){let h=l[1],d=l[2].split(";").map(m=>m.trim()).filter(Boolean).filter(m=>!(wBe.test(m)||_Be.test(m)||SBe.test(m))).join(";"),f=`${c}${d?`${d};`:""}`;s=s.replace(pD,` style=${h}${f}${h}`)}else s=s.replace(mD,`<svg style="${c}"`);return s=s.replace(mD,`<svg width="${i}" height="${a}"`),e.replace(r,s)}catch{return e}},ABe=e=>{if(typeof DOMParser>"u"||typeof XMLSerializer>"u")return e;let t=new DOMParser().parseFromString(e,"text/html").querySelector("svg");return t?new XMLSerializer().serializeToString(t):e},LBe=(e,t)=>{var r;let n=(r=void 0)!=null?r:5;return new Promise((i,a)=>{let s="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),l=new Image;l.crossOrigin="anonymous",l.onload=()=>{let c=document.createElement("canvas"),h=l.width*n,d=l.height*n;c.width=h,c.height=d;let f=c.getContext("2d");if(!f){a(new Error("Failed to create 2D canvas context for PNG export"));return}f.drawImage(l,0,0,h,d),c.toBlob(m=>{if(!m){a(new Error("Failed to create PNG blob"));return}i(m)},"image/png")},l.onerror=()=>a(new Error("Failed to load SVG image")),l.src=s})},$X=({chart:e,children:t,className:r,onDownload:n,config:i,onError:a})=>{let s=hr(),[l,c]=$.useState(!1),h=$.useRef(null),{isAnimating:d,controls:f}=$.useContext(xi),m=po(),g=XS(),b=mo(),x=qS(f,"mermaid","diagram"),k=async w=>{try{if(w==="mmd"){let P=`${x}.mmd`;C0(P,e,"text/plain"),c(!1),n?.(w);return}if(!g){a?.(new Error("Mermaid plugin not available"));return}let _=g.getMermaid(i),S=e.split("").reduce((P,O)=>(P<<5)-P+O.charCodeAt(0)|0,0),N=`mermaid-${Math.abs(S)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:B}=await _.render(N,e);if(!B){a?.(new Error("SVG not found. Please wait for the diagram to render."));return}let I=ABe(B);if(w==="svg"){let P=`${x}.svg`;C0(P,I,"image/svg+xml"),c(!1),n?.(w);return}if(w==="png"){let P=await LBe(I);C0(`${x}.png`,P,"image/png"),n?.(w),c(!1);return}}catch(_){a?.(_)}};return $.useEffect(()=>{let w=_=>{let S=_.composedPath();h.current&&!S.includes(h.current)&&c(!1)};return document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[]),C.jsxs("div",{className:s("relative"),ref:h,children:[C.jsx("button",{"aria-label":b.downloadDiagram,className:s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:d,onClick:()=>c(!l),title:b.downloadDiagram,type:"button",children:t??C.jsx(m.DownloadIcon,{"aria-hidden":"true",size:14})}),l?C.jsxs("div",{className:s("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[C.jsx("button",{"aria-label":b.downloadDiagramAsSvg,className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>k("svg"),title:b.downloadDiagramAsSvg,type:"button",children:b.mermaidFormatSvg}),C.jsx("button",{"aria-label":b.downloadDiagramAsPng,className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>k("png"),title:b.downloadDiagramAsPng,type:"button",children:b.mermaidFormatPng}),C.jsx("button",{"aria-label":b.downloadDiagramAsMmd,className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>k("mmd"),title:b.downloadDiagramAsMmd,type:"button",children:b.mermaidFormatMmd})]}):null]})},NBe=({chart:e,config:t,onFullscreen:r,onExit:n,className:i,...a})=>{let{Maximize2Icon:s,XIcon:l}=po(),c=hr(),[h,d]=$.useState(!1),{isAnimating:f,controls:m,portal:g}=$.useContext(xi),b=mo(),x=(()=>{if(typeof m=="boolean")return m;let S=m.mermaid;return S===!1?!1:S===!0||S===void 0?!0:S.panZoom!==!1})(),k=(()=>{if(typeof m=="boolean")return m;let S=m.mermaid;return S===!1?!1:S===!0||S===void 0?!0:S.download!==!1})(),w=(()=>{if(typeof m=="boolean")return m;let S=m.mermaid;return S===!1?!1:S===!0||S===void 0?!0:S.copy!==!1})(),_=()=>{d(!h)};return $.useEffect(()=>{if(h){GS();let S=N=>{N.key==="Escape"&&d(!1)};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S),WS()}}},[h]),$.useEffect(()=>{h?r?.():n&&n()},[h,r,n]),C.jsxs(C.Fragment,{children:[C.jsx("button",{className:c("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),disabled:f,onClick:_,title:b.viewFullscreen,type:"button",...a,"aria-label":b.viewFullscreen,children:C.jsx(s,{"aria-hidden":"true",size:14})}),h?tv.createPortal(C.jsxs("div",{"aria-label":b.viewFullscreen,"aria-modal":"true",className:c("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),"data-streamdown":"mermaid-fullscreen",onClick:_,onKeyDown:S=>{S.key==="Escape"&&_()},role:"dialog",children:[C.jsxs("div",{className:c("absolute top-4 right-4 z-10 flex items-center gap-1"),onClick:S=>S.stopPropagation(),onKeyDown:S=>S.stopPropagation(),role:"presentation",children:[k?C.jsx($X,{chart:e,config:t}):null,w?C.jsx(fw,{code:e}):null,C.jsx("button",{"aria-label":b.exitFullscreen,className:c("rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:_,title:b.exitFullscreen,type:"button",children:C.jsx(l,{"aria-hidden":"true",size:20})})]}),C.jsx("div",{className:c("flex size-full items-center justify-center p-4"),onClick:S=>S.stopPropagation(),onKeyDown:S=>S.stopPropagation(),role:"presentation",children:C.jsx(AK,{chart:e,className:c("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:t,fullscreen:!0,showControls:x})})]}),VS(g)):null]})};function mw(e){var t;if(e.nodeType===Node.TEXT_NODE)return(t=e.textContent)!=null?t:"";if(e.nodeType!==Node.ELEMENT_NODE)return"";let r=e;return r.tagName==="BR"?`
|
|
858
858
|
`:Array.from(r.childNodes).map(mw).join("")}var zX=e=>{let t=[],r=[],n=e.querySelectorAll("thead th");for(let a of n)t.push(mw(a).trim());let i=e.querySelectorAll("tbody tr");for(let a of i){let s=[],l=a.querySelectorAll("td");for(let c of l)s.push(mw(c).trim());r.push(s)}return{headers:t,rows:r}},jX=e=>{var t;if(typeof e!="object")return",";let r=e.table;return typeof r!="object"?",":(t=r.csvSeparator)!=null?t:","},HX=(e,t=",")=>{let r;t==="auto"?Intl.NumberFormat().format(1.1).includes(",")?r=";":r=",":r=t;let{headers:n,rows:i}=e,a=h=>{let d=!1;for(let f of h)if(f===r||f==='"'||f===`
|
|
859
859
|
`||f==="\r"){d=!0;break}return d?`"${h.replace(/"/g,'""')}"`:h},s=n.length>0?i.length+1:i.length,l=new Array(s),c=0;n.length>0&&(l[c]=n.map(a).join(r),c+=1);for(let h of i)l[c]=h.map(a).join(r),c+=1;return l.join(`
|
|
@@ -896,7 +896,7 @@ ${f}`,i=e.length;break}return i===0?e:n+e.slice(i)},TRe=(e,t)=>{if(!t.length)ret
|
|
|
896
896
|
`);let n=0,i=0,a=!1,s=!1;for(const h of r){if(h.startsWith("diff ")){const d=h.match(/^(diff --git )(.*)$/);t.push({kind:"file",text:h,head:d?.[1]??"",paths:d?.[2]??h,adds:0,dels:0}),a=!0,s=!0;continue}if(!a){t.push({kind:"pre",text:h});continue}if(h.startsWith("@@")){const d=h.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);d&&(n=Number(d[1]),i=Number(d[2])),t.push({kind:"hunk",text:h,adds:0,dels:0}),s=!1;continue}if(s){t.push({kind:"meta",text:h});continue}h.startsWith("+")?(t.push({kind:"add",text:h.slice(1),newNo:i}),i+=1):h.startsWith("-")?(t.push({kind:"del",text:h.slice(1),oldNo:n}),n+=1):h.startsWith("\\")?t.push({kind:"note",text:h}):(t.push({kind:"ctx",text:h.slice(1),oldNo:n,newNo:i}),n+=1,i+=1)}let l=null,c=null;for(const h of t)h.kind==="file"?(l=h,c=null):h.kind==="hunk"?c=h:h.kind==="add"?(l&&(l.adds+=1),c&&(c.adds+=1)):h.kind==="del"&&(l&&(l.dels+=1),c&&(c.dels+=1));return t}function pP({adds:e,dels:t}){return!e&&!t?null:C.jsxs("span",{className:"flex shrink-0 items-center gap-1 font-sans text-[10px] font-medium leading-none",children:[e>0&&C.jsxs("span",{className:"rounded bg-emerald-100 px-1.5 py-0.5 text-emerald-700",children:["+",e]}),t>0&&C.jsxs("span",{className:"rounded bg-red-100 px-1.5 py-0.5 text-red-700",children:["−",t]})]})}function Xw({run:e,name:t,version:r,className:n=""}){const i=JSON.stringify([e,t,r]),[a,s]=$.useState(null),[l,c]=$.useState(0);$.useEffect(()=>{let m=!1;const g=new AbortController;return s({key:i}),C$e(`/api/diff?run=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,{signal:g.signal}).then(b=>{m||s({key:i,text:b})}).catch(b=>{m||s({key:i,error:b instanceof Error?b.message:String(b)})}),()=>{m=!0,g.abort()}},[i,l]);const h=a?.key===i?a:null;if(h?.error)return C.jsxs("div",{role:"alert",className:`p-3 text-xs [overflow-wrap:anywhere] ${n}`,children:[C.jsxs("p",{children:["Could not load diff: ",h.error]}),C.jsx("button",{onClick:()=>c(m=>m+1),className:"mt-2 underline",children:"Retry diff"})]});const d=h?.text;if(d==null)return C.jsx("div",{role:"status",className:`p-3 text-xs text-muted-foreground ${n}`,children:"Loading diff…"});if(!d.trim())return C.jsx("div",{className:`p-3 text-xs text-muted-foreground ${n}`,children:"no code changes"});const f=T$e(d);return C.jsx("pre",{className:`overflow-auto bg-background font-mono text-[11px] leading-[1.55] ${n}`,children:f.map((m,g)=>{if(m.kind==="file")return C.jsxs("div",{className:"sticky top-0 z-20 flex w-max min-w-full items-center gap-2 border-y border-border bg-muted px-3 py-1.5",children:[C.jsx(_te,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}),C.jsxs("span",{className:"whitespace-pre",children:[C.jsx("span",{className:"text-[10px] text-muted-foreground",children:m.head}),C.jsx("span",{className:"text-xs font-semibold text-foreground",children:m.paths})]}),C.jsx(pP,{adds:m.adds,dels:m.dels})]},g);if(m.kind==="meta")return C.jsx("div",{className:"w-max min-w-full whitespace-pre bg-muted/40 px-3 py-0.5 text-[10px] leading-[1.4] text-neutral-400",children:m.text},g);if(m.kind==="hunk")return C.jsxs("div",{className:"flex w-max min-w-full items-center gap-2.5 border-y border-blue-100 bg-blue-50 px-3 py-1",children:[C.jsx("span",{className:"whitespace-pre font-semibold text-blue-700",children:m.text}),C.jsx(pP,{adds:m.adds,dels:m.dels})]},g);if(m.kind==="pre")return C.jsx("div",{className:"w-max min-w-full whitespace-pre px-3 py-0.5 text-[10px] leading-[1.4] text-neutral-400",children:m.text},g);if(m.kind==="note")return C.jsx("div",{className:"flex w-max min-w-full whitespace-pre bg-muted/40 px-3 py-0.5 italic text-muted-foreground",children:m.text},g);const b=m.kind==="add",x=m.kind==="del";return C.jsxs("div",{className:`flex w-max min-w-full ${b?"bg-emerald-50":x?"bg-red-50":"bg-background"}`,children:[C.jsxs("div",{className:`sticky left-0 z-10 flex shrink-0 border-r ${b||x?"":"bg-muted"}`,children:[C.jsx("span",{className:`w-9 pr-2 text-right text-[10px] tabular-nums text-neutral-400 ${x?"bg-red-100":b?"bg-emerald-50":"bg-muted"}`,children:m.oldNo??""}),C.jsx("span",{className:`w-9 pr-2 text-right text-[10px] tabular-nums text-neutral-400 ${b?"bg-emerald-100":x?"bg-red-50":"bg-muted"}`,children:m.newNo??""})]}),C.jsx("span",{className:`w-5 shrink-0 text-center font-bold ${b?"bg-emerald-200/70 text-emerald-700":x?"bg-red-200/60 text-red-600":"text-neutral-300"}`,children:b?"+":x?"−":" "}),C.jsx("span",{className:`whitespace-pre pr-4 ${b||x?"":"text-neutral-500"}`,children:m.text||" "})]},g)})})}function PE(e){return e.src?C.jsx(w$e,{...e,src:e.src},e.src):C.jsx(vZ,{title:e.progress?"Preview not ready yet":"No preview available",...e})}function vZ({title:e,progress:t,compact:r,retry:n,detail:i}){return C.jsxs("div",{role:"status",className:`flex h-full w-full flex-col items-center justify-center gap-2 text-center text-muted-foreground ${r?"p-2 text-[10px]":"min-h-40 p-6 text-sm"}`,children:[C.jsx("span",{children:e}),!r&&t&&C.jsx("span",{className:"text-xs",children:t}),!r&&i&&C.jsx("span",{className:"text-xs",children:i}),n&&!r&&C.jsx("button",{type:"button",onClick:n,className:"rounded border px-2 py-1 text-xs hover:bg-muted",children:"Retry preview"})]})}function w$e({src:e,version:t,progress:r,compact:n,allowOpen:i,imageClassName:a}){const[s,l]=$.useState(0),[c,h]=$.useState({phase:"loading",id:0}),d=$.useRef(0),f=$.useRef(!1),m=$.useRef(t);return $.useEffect(()=>{m.current!==t&&(m.current=t,f.current||l(g=>g+1))},[t]),$.useEffect(()=>{const g=++d.current,b=new AbortController;let x;f.current=!1,h({phase:"loading",id:g});const k=w=>{!b.signal.aborted&&d.current===g&&h({phase:"failed",detail:w,id:g})};return(async()=>{try{const w=new URL(e,location.origin),_=new URL(Ag("/api/"),location.origin);if(w.origin===_.origin&&/^\/api\/(shot|sheet)$/.test(w.pathname)){const S=U2(),N=await fetch(w,{signal:b.signal,cache:"no-store",redirect:"error",referrerPolicy:"no-referrer",headers:S?{authorization:`Bearer ${S}`}:{}});if(!N.ok)throw new Error(`Screenshot request returned ${N.status}.`);const B=await N.blob();if(b.signal.aborted||d.current!==g)return;x=URL.createObjectURL(B)}!b.signal.aborted&&d.current===g&&h({phase:"loading",src:x??e,id:g})}catch(w){k(w instanceof Error&&/^Screenshot request returned \d+\.$/.test(w.message)?w.message:"The screenshot request failed.")}})(),()=>{b.abort(),++d.current,x&&URL.revokeObjectURL(x)}},[e,s]),C.jsxs("div",{className:"relative h-full w-full",children:[c.src&&c.phase!=="failed"&&C.jsx("img",{src:c.src,alt:"Preview screenshot",referrerPolicy:"no-referrer",className:`${a??"h-full w-full object-contain object-top"} ${c.phase==="loaded"?"":"invisible"}`,onLoad:()=>{d.current===c.id&&(f.current=!0,h(g=>({...g,phase:"loaded"})))},onError:()=>{d.current===c.id&&(f.current=!1,h({phase:"failed",detail:"The screenshot could not be decoded.",id:c.id}))}},c.id),c.phase!=="loaded"&&C.jsx("div",{className:"absolute inset-0",children:C.jsx(vZ,{version:t,compact:n,progress:r,title:c.phase==="failed"?"Preview could not load":"Loading preview…",detail:c.detail,retry:c.phase==="failed"?()=>l(g=>g+1):void 0})}),i&&c.phase==="loaded"&&C.jsx("a",{href:c.src,target:"_blank",rel:"noopener noreferrer",className:"absolute bottom-2 right-2 rounded border bg-background px-2 py-1 text-xs",children:"Open screenshot"})]})}function CZ(e){const t=e.rounds.at(-1),r=e.best.shot??t?.attempts.find(c=>c.kept||c.humanPick)?.shot,n=e.rounds.some(c=>!c.inProgress||(c.shots?.[e.best.label]?.length??0)>0||e.best.round===0&&(c.shots?.CURRENT?.length??0)>0),i=r&&new URL(r,"http://preview.invalid").pathname==="/api/shot"&&new URL(r,"http://preview.invalid").searchParams.get("attempt")==="base",a=e.alive&&e.best.round===0&&!n&&i,s=t?.attempts.filter(c=>c.status!=="running").length??0,l=e.alive?t?`Round ${t.n} · ${t.judging?"judging candidates":`${s} of ${t.attempts.length} attempts finished`}`:"Waiting for the first round":void 0;return{shot:a?void 0:r,progress:l,version:kZ(e)}}function kZ(e){return JSON.stringify([e.id,e.alive,e.status,e.best.round,e.best.label,e.rounds.map(t=>[t.n,t.inProgress,t.judging,t.status,t.endedAt,Object.entries(t.shots??{}).sort(([r],[n])=>r.localeCompare(n)),t.attempts.map(r=>[r.name,r.status,r.shot,r.kept,r.humanPick])])])}function mP(e){const t=e.rounds[e.rounds.length-1];if(e.status==="paused")return`Paused before round ${e.rounds.length+1}`;if(e.alive&&t?.inProgress){if(t.judging)return`Round ${t.n} · judging`;const r=t.attempts.filter(n=>n.status!=="running").length;return`Round ${t.n} · ${r}/${t.attempts.length} attempts done`}return e.alive?"Starting next round":FE(e)}const sf=(e,t)=>t==null?"–":e.kind==="bench"?`${t<10?t.toFixed(1):Math.round(t)} ${e.metric?.unit??""}`.trim():t.toFixed(1),TZ=(e,t)=>{if(t==null)return"–";if(e.kind!=="bench")return t.toFixed(1);const r=Math.abs(t);return`${r!==0&&r<1?t.toFixed(3):r<10?t.toFixed(2):Math.round(t)} ${e.metric?.unit??""}`.trim()},cv=(e,t)=>{if(e.kind!=="bench"||t==null||!e.baseline)return"";const r=e.metric?.better==="higher"?t/e.baseline:e.baseline/t;return r>=1?`${r<10?r.toFixed(1):Math.round(r)}× ${e.metric?.better==="higher"?"better":"faster"}`:`${(1/r).toFixed(1)}× worse`};function uv(e){const t=e.rounds.flatMap(r=>r.attempts);return!e.alive&&t.length>0&&t.every(r=>!["done","unchanged","no-change"].includes(r.status))}function Kw(e){const t=e.rounds.at(-1);return!e.alive&&!!t&&(!!t.inconclusive||!!t.unseen?.length||t.attempts.some(r=>r.status==="done"&&!!r.commit&&r.score==null&&!r.humanPick&&!r.vetoed&&r.bench?.passed!==!1))}function FE(e){const t=e.rounds[e.rounds.length-1];return e.status==="paused"?"Paused":e.alive&&t?.inProgress?t.judging?`Round ${t.n}: comparing versions…`:`Round ${t.n}: making candidates…`:e.alive?"Starting the next round…":e.status==="error"?`Error: ${e.stopReason||"run failed"}`:e.status==="stalled"?"Interrupted — no signal from the round":e.stopReason==="aborted"?"Stopped — worktrees kept":Kw(e)?"Inconclusive — judging incomplete":uv(e)?"No candidates completed":e.rounds.length?`Done after ${e.rounds.length} round${e.rounds.length===1?"":"s"}`:"No usable result — no rounds completed"}function _$e({text:e}){const[t,r]=$.useState(!1),n=e.startsWith("Message from the human"),i=e.replace(/^Message from the human reviewing your work: /,"You: ").replace(/\nMake the change in index.html[\s\S]*$/,"");return C.jsx("button",{onClick:()=>r(!t),className:`w-full whitespace-pre-wrap rounded-md px-3 py-2 text-left text-xs ${n?"bg-violet-50 text-violet-900":"bg-muted text-muted-foreground"} ${t||n?"":"line-clamp-3"}`,children:n?i:C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"font-medium text-foreground/70",children:"from parent: "}),i]})})}function S$e({run:e,round:t,a:r,onBack:n,steer:i}){const[a,s]=$.useState(null),[l,c]=$.useState([]),[h,d]=$.useState(!1),[f,m]=$.useState("desktop"),[g,b]=$.useState(""),[x,k]=$.useState(0),[w,_]=$.useState(""),S=$.useRef(null),[N,B]=$.useState(0),I=l.some(K=>K.status==="running");$.useEffect(()=>{if(!S.current)return;const K=new ResizeObserver(([W])=>B(W.contentRect.width));return K.observe(S.current),()=>K.disconnect()},[e.kind]),$.useEffect(()=>{let K=!1;const W=async()=>{const te=`run=${e.id}&name=${r.name}`,[q,pe]=await Promise.all([zr(`/api/session?${te}`),zr(`/api/talk?${te}`)]);K||(s(q),c(F=>(F.some(Ee=>Ee.status==="running")&&!pe.some(Ee=>Ee.status==="running")&&k(Date.now()),pe)))};W();const z=setInterval(W,3e3);return()=>{K=!0,clearInterval(z)}},[e.id,r.name,r.status]);const P=a?.filter(K=>K.inherited)??[],O=a?.filter(K=>!K.inherited)??[],X=r.live?r.live+(x?`${r.live.includes("?")?"&":"?"}v=${x}`:""):void 0,j=f==="desktop"?{w:1280,h:800,s:N/1280}:{w:390,h:780,s:Math.min(1,N/390)},Z=[];if(r.shot){const K=new URL(r.shot,"http://preview.invalid");if(Z.push({src:r.shot,label:K.searchParams.get("f")?.split("/").at(-1)??"Screenshot"}),K.pathname==="/api/shot"&&K.searchParams.get("run")===e.id&&K.searchParams.get("attempt")===r.name)for(const W of t.shots?.[r.name]??[]){const z=new URL(K);z.searchParams.set("f",W);const te=r.shot.startsWith("/")?z.pathname+z.search:z.href;Z.some(q=>q.src===te)||Z.push({src:te,label:W.split("/").at(-1)??W})}}const se=Z.find(K=>K.src===w)??Z[0],ue=({l:K})=>K.t==="tool"?C.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[C.jsx(Hte,{className:"size-3 shrink-0"})," ",K.name,C.jsxs("span",{className:"truncate opacity-70",children:["(",K.args,")"]}),K.out&&C.jsxs("span",{className:"ml-1 truncate text-foreground/60",children:["→ ",K.out]})]}):K.t==="user"?C.jsx(_$e,{text:K.text}):C.jsx("p",{className:"whitespace-pre-wrap",children:K.text});return C.jsxs("div",{className:"flex h-full flex-col animate-in fade-in slide-in-from-right-4",onClick:K=>K.stopPropagation(),children:[C.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[C.jsxs("button",{onClick:n,className:"inline-flex items-center gap-1 hover:text-foreground",children:[C.jsx(BP,{className:"size-3"})," ",e.name," · R",t.n]}),C.jsx("span",{children:"/"}),C.jsxs("span",{className:"text-foreground",children:[r.label," · ",r.model," · ",r.style]}),C.jsx("span",{className:"font-mono",children:sf(e,r.score)}),e.kind!=="bench"&&X&&C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"ml-auto flex gap-1",children:["desktop","mobile"].map(K=>C.jsx("button",{onClick:()=>m(K),className:`rounded px-1.5 ${f===K?"bg-muted text-foreground":""}`,children:K},K))}),C.jsxs("a",{href:r.live,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 hover:text-foreground",children:["open ",C.jsx(zP,{className:"size-3"})]})]})]}),e.kind!=="bench"&&!X&&Z.length>1&&C.jsxs("label",{className:"mb-2 flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:["Capture",C.jsx("select",{"aria-label":"Screenshot capture",value:se?.src,onChange:K=>_(K.target.value),className:"min-w-0 max-w-full flex-1 rounded border bg-background px-2 py-1",children:Z.map(K=>C.jsx("option",{value:K.src,children:K.label},K.src))})]}),e.kind==="bench"?r.status==="running"?C.jsx("div",{className:"flex h-[230px] shrink-0 items-center justify-center rounded-md border bg-muted text-xs text-muted-foreground",children:C.jsx("span",{className:"animate-pulse",children:"child is working…"})}):C.jsxs("div",{className:"shrink-0 rounded-md border",children:[C.jsx(E$e,{run:e,a:r}),C.jsx(Xw,{run:e.id,name:r.name,version:r.score,className:"max-h-[260px] border-t"})]}):C.jsxs("div",{ref:S,className:"relative w-full max-w-[556px] shrink-0 overflow-hidden rounded-md border bg-muted",style:{height:X?Math.min(350,j.h*j.s):300},children:[X?C.jsx("iframe",{src:X,title:"Attempt live preview",referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",className:"absolute left-0 top-0 origin-top-left",style:{width:j.w,height:j.h,transform:`scale(${j.s})`,left:f==="mobile"?(N-j.w*j.s)/2:0}},X+f):C.jsx(PE,{src:se?.src,version:kZ(e),progress:r.status==="running"||t.inProgress?`Round ${t.n} · ${r.status==="running"?"attempt working":"judging candidates"}`:void 0,allowOpen:!0}),I&&C.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 text-xs backdrop-blur-[1px]",children:C.jsx("span",{className:"animate-pulse",children:"applying your feedback…"})})]}),C.jsxs("div",{className:"mt-2 flex items-center gap-2 text-[11px] text-muted-foreground",children:[r.reason&&C.jsxs("span",{className:"flex-1",children:["Judge: ",r.reason]}),!r.kept&&!r.humanPick&&r.status==="done"&&!!r.commit&&!t.inProgress&&C.jsx("button",{onClick:()=>i(e.id,{action:"pick",attempt:r.name}),className:"shrink-0 rounded border px-2 py-0.5 text-foreground hover:bg-muted",children:"Continue the loop from this one"}),r.humanPick&&C.jsx("span",{className:"text-violet-600",children:"your pick: the loop continues from this one"})]}),C.jsxs("div",{className:"mt-3 min-h-0 flex-1 space-y-2.5 overflow-auto pr-2 text-[13px]",children:[a===null&&C.jsx("div",{className:"text-xs text-muted-foreground",children:"loading session…"}),P.length>0&&C.jsxs("button",{onClick:()=>d(!h),className:"flex w-full items-center gap-1.5 border-b border-dashed pb-2 text-left text-[11px] text-muted-foreground hover:text-foreground",children:[C.jsx(Ate,{className:"size-3"})," forked from R",t.from.round," ",t.from.label,": ",P.length," earlier steps inherited",C.jsx(Zw,{className:`ml-auto size-3 transition ${h?"rotate-90":""}`})]}),h&&C.jsx("div",{className:"space-y-2.5 border-l-2 border-dashed pl-3 opacity-60",children:P.map((K,W)=>C.jsx(ue,{l:K},"i"+W))}),O.map((K,W)=>C.jsx(ue,{l:K},W)),l.filter(K=>K.status==="running"&&!O.some(W=>W.t==="user"&&W.text.includes(K.text))).map(K=>C.jsxs("div",{className:"rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",children:["You: ",K.text," ",C.jsx("span",{className:"animate-pulse",children:"· working…"})]},K.t)),C.jsx("form",{className:"pt-2",onSubmit:async K=>{if(K.preventDefault(),!g.trim())return;const W=g.trim();b(""),c(z=>[...z,{t:Date.now(),text:W,status:"running"}]),await zr("/api/talk",{method:"POST",json:{run:e.id,name:r.name,text:W}})},children:C.jsx("input",{value:g,onChange:K=>b(K.target.value),disabled:r.status==="running"||I,placeholder:r.status==="running"?"wait for this child to finish…":`Message ${r.model} about this attempt (it edits its own copy)…`,className:"w-full rounded-md border bg-background px-3 py-2 text-xs outline-none focus:ring-1 focus:ring-foreground/30 disabled:opacity-50"})})]})]})}function E$e({run:e,a:t}){const r=t.bench;return r?C.jsxs("div",{className:"grid grid-cols-3 gap-3 px-3 py-2 text-xs",children:[C.jsxs("div",{children:[C.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"tests"}),C.jsx("div",{className:r.passed?"text-emerald-700":"text-red-600",children:r.passed?"✓ "+(r.tests??"pass"):"✗ failing"})]}),C.jsxs("div",{children:[C.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e.metric?.label??"benchmark"}),C.jsx("div",{className:"font-mono",children:r.value!=null?`${sf(e,r.value)} · ${cv(e,r.value)}`:r.error?"failed":"–"})]}),C.jsxs("div",{children:[C.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"review"}),C.jsx("div",{className:t.vetoed?"text-red-600":"",children:t.review?(t.review.ok?"✓ ":"✗ ")+t.review.note:"–"})]}),!r.passed&&r.tests&&C.jsx("pre",{className:"col-span-3 max-h-24 overflow-auto whitespace-pre-wrap rounded bg-red-500/5 p-2 font-mono text-[10px] text-red-800",children:r.tests})]}):C.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:t.status==="done"?"waiting to be measured…":t.status})}function sh({tone:e,children:t}){const r={ok:"bg-emerald-600/10 text-emerald-700",bad:"bg-red-500/10 text-red-600",pending:"bg-amber-500/15 text-amber-700",plain:"bg-muted text-muted-foreground"};return C.jsx("span",{className:`inline-flex max-w-full items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium ${r[e]}`,children:t})}function A$e({run:e}){if(e.alive||e.status!=="done"||e.rounds.some(f=>f.inProgress))return null;if(e.best.round===0)return C.jsx("div",{"aria-label":"Loop results summary",className:"min-w-0 basis-full border-t pt-3 text-xs text-muted-foreground",children:uv(e)?"No candidate completed. Inspect the round before trying again.":"No improved candidate was kept. Inspect a round for details."});const r=e.rounds.find(f=>f.n===e.best.round)?.attempts.find(f=>f.name===e.best.label),n=r?.bench,i=e.winnerFiles?[...new Set([...e.winnerFiles.changed,...e.winnerFiles.added,...e.winnerFiles.removed])]:[],a=e.questions.filter(f=>f.kind==="apply"&&!f.expired&&!f.superseded&&(f.round==null||f.round===e.best.round)&&(!f.label||f.label===e.best.label||f.label===r?.style)).at(-1),s=!!a&&!a.answered,l=e.best.applied?.trim(),c=!!(e.winnerFiles?.added.length||e.winnerFiles?.removed.length),h=r?.summary||r?.review?.note||r?.reason,d=l?c?"Added and removed files are not included in the tracked-file apply. Review them separately.":"Next: keep iterating, or clean up the worktrees.":s&&a?`Next: review “${a.text}” in the conversation.`:a?.answered?"No successful apply is recorded. Check the conversation before applying again.":"Next: inspect the changes, then ask the agent to apply the winner.";return C.jsxs("div",{"aria-label":"Loop results summary",className:"min-w-0 basis-full border-t pt-3",children:[C.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5",children:[n&&(n.passed?C.jsxs(sh,{tone:"ok",children:[C.jsx($0,{className:"size-3 shrink-0"})," Candidate check passed"]}):C.jsxs(sh,{tone:"bad",children:[C.jsx(Gh,{className:"size-3 shrink-0"})," Candidate check failed"]})),!n&&C.jsx(sh,{tone:"plain",children:"Candidate check not recorded"}),i.length>0&&C.jsxs(sh,{tone:"plain",children:[C.jsxs("span",{className:"shrink-0",children:[i.length," file",i.length===1?"":"s"," changed"]}),C.jsx("span",{className:"min-w-0 max-w-[160px] truncate font-mono",title:i.join(", "),children:i.join(", ")})]}),l?C.jsxs(sh,{tone:"ok",children:[C.jsx($0,{className:"size-3 shrink-0"})," Tracked edits applied ",C.jsx("span",{className:"font-mono",title:l,children:l.slice(0,7)})]}):s?C.jsxs(sh,{tone:"pending",children:[C.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-amber-600"})," Awaiting apply decision"]}):C.jsx(sh,{tone:"plain",children:"Application unconfirmed"})]}),h&&C.jsx("div",{className:"mt-1.5 line-clamp-2 text-xs text-muted-foreground",title:h,children:h}),d&&C.jsx("div",{className:"mt-1.5 text-xs font-medium",children:d})]})}const Jc=(e,t)=>t==null?"–":e.kind==="bench"?`${t<10?t.toFixed(1):Math.round(t)} ${e.metric?.unit??""}`.trim():t.toFixed(1),L$e=(e,t)=>t==null?"–":e.kind==="bench"?t<10?t.toFixed(1):`${Math.round(t)}`:t.toFixed(1),N$e=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:`${Math.round(e/1e3)}k`,Em=(e,t)=>{if(e.kind!=="bench"||t==null||!e.baseline)return"";const r=e.metric?.better==="higher"?t/e.baseline:e.baseline/t;return r>=1?`${r<10?r.toFixed(1):Math.round(r)}× ${e.metric?.better==="higher"?"better":"faster"}`:`${(1/r).toFixed(1)}× worse`};function M$e(){const e=$.useRef(null),[t,r]=$.useState(0);return $.useLayoutEffect(()=>{if(!e.current)return;const n=new ResizeObserver(([i])=>r(i.contentRect.width));return n.observe(e.current),()=>n.disconnect()},[]),[e,t]}function B$e({run:e,h:t=76}){const[r,n]=M$e(),i=e.kind==="bench"&&e.metric?.better!=="higher",a=e.kind==="bench"?[[0,e.baseline??NaN]]:[];e.rounds.filter(S=>!S.inProgress).forEach((S,N)=>a.push([S.n,e.scores[N]]));const s=e.rounds.flatMap(S=>S.attempts.filter(N=>N.status!=="running").flatMap(N=>{const B=N.score??N.bench?.value??void 0;return B==null&&(S.inProgress||N.status==="no-change")?[]:[{x:S.n,y:B,bad:B==null,rejected:N.score==null&&B!=null,kept:!!(N.kept||N.humanPick)}]})),l=[...a.map(S=>S[1]),...s.map(S=>S.y)].filter(S=>S!=null&&isFinite(S)&&S>0);if(!l.length)return C.jsx("div",{ref:r,style:{height:t}});const c=Math.log(Math.min(...l))-.15,h=Math.log(Math.max(...l))+.15,d=Math.max(e.maxRounds,e.rounds.length,1),f=20,m=S=>f+S/d*(n-f*2),g=S=>{const N=(Math.log(S)-c)/(h-c||1);return 16+(i?N:1-N)*(t-34)},b=a.filter(S=>isFinite(S[1])),x=b.map((S,N)=>`${N?"L":"M"}${m(S[0])},${g(S[1])}`).join(" "),k=b.length>1?`${x} L${m(b[b.length-1][0])},${t-14} L${m(b[0][0])},${t-14} Z`:"",w=Array.from({length:d+1},(S,N)=>N).filter(S=>e.kind==="bench"||S>0),_=e.kind==="bench"&&e.baseline&&isFinite(e.baseline)?e.baseline:null;return C.jsx("div",{ref:r,style:{height:t},className:"w-full",children:n>0&&C.jsxs("svg",{width:n,height:t,className:"overflow-visible",children:[C.jsxs("text",{x:2,y:9,className:"fill-muted-foreground text-[9px]",children:["● accepted · ",C.jsx("tspan",{className:"fill-red-500",children:"○ rejected · × failed"})]}),_!=null&&C.jsx("line",{x1:f,x2:n-f,y1:g(_),y2:g(_),strokeDasharray:"3 3",className:"stroke-muted-foreground/40",strokeWidth:1}),k&&C.jsx("path",{d:k,className:"fill-blue-500/[0.06]",stroke:"none"}),s.map((S,N)=>S.bad?C.jsx("text",{x:m(S.x)+(N%3-1)*6,y:24,textAnchor:"middle",className:"fill-red-500 text-[10px]",children:"×"},N):S.rejected?C.jsx("circle",{cx:m(S.x)+(N%3-1)*5,cy:g(S.y),r:3.5,className:"fill-none stroke-red-500",strokeWidth:1.5},N):C.jsx("circle",{cx:m(S.x)+(N%3-1)*5,cy:g(S.y),r:2.5,className:S.kept?"fill-foreground":"fill-foreground/25"},N)),C.jsx("path",{d:x,fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"text-blue-600"}),b.map((S,N)=>C.jsxs("g",{children:[C.jsx("circle",{cx:m(S[0]),cy:g(S[1]),r:3,className:"fill-blue-600"}),N===b.length-1&&C.jsx("circle",{cx:m(S[0]),cy:g(S[1]),r:5.5,className:"fill-none stroke-blue-600/30",strokeWidth:2}),(N===0||N===b.length-1)&&C.jsx("text",{x:m(S[0]),y:g(S[1])-8,textAnchor:"middle",className:"fill-foreground font-mono text-[9px]",children:Jc(e,S[1])})]},N)),w.map(S=>C.jsx("text",{x:m(S),y:t-4,textAnchor:"middle",className:"fill-muted-foreground text-[9px]",children:S===0?"start":`R${S}`},S))]})})}function R$e({run:e}){return e.alive?C.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-md bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-700",children:[C.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-blue-500"}),"Running"]}):e.status==="paused"?C.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-md bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700",children:[C.jsx("span",{className:"size-1.5 rounded-full bg-amber-500"}),"Paused"]}):e.stopReason==="aborted"?C.jsx("span",{className:"rounded-md bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700",children:"Stopped"}):uv(e)||e.status==="error"||e.status==="stalled"?C.jsx("span",{className:"inline-flex shrink-0 items-center rounded-md bg-red-50 px-2 py-0.5 text-xs font-medium text-red-700",children:e.status==="stalled"?"Interrupted":"Failed"}):Kw(e)||!e.rounds.length?C.jsx("span",{className:"rounded-md bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700",children:Kw(e)?"Inconclusive":"No result"}):C.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-md bg-green-50 px-2 py-0.5 text-xs font-medium text-green-700",children:[C.jsx($0,{className:"size-3"}),"Done"]})}function O$e({a:e,roundInProgress:t}){if(e.status==="running")return C.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-blue-500",title:`${e.label} · ${e.model} · running`});const r=e.score??e.bench?.value,n=`${e.label} · ${e.model}`;return e.kept||e.humanPick?C.jsx("span",{className:"size-1.5 rounded-full bg-foreground",title:`${n} · kept`}):r==null?e.status==="no-change"||t&&e.status==="done"?C.jsx("span",{className:"size-1.5 rounded-full border border-muted-foreground/40",title:`${n} · no change`}):C.jsx("span",{className:"text-[9px] font-medium leading-none text-red-500",title:`${n} · failed`,children:"×"}):e.score==null?C.jsx("span",{className:"size-1.5 rounded-full border border-red-500",title:`${n} · rejected`}):C.jsx("span",{className:"size-1.5 rounded-full bg-foreground/25",title:`${n} · not kept`})}function D$e({run:e}){const t=e.best.score;if(e.kind==="bench")return t==null||e.baseline==null?C.jsx("span",{className:"rounded-md bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:e.baseline==null?"baseline not measured":"candidate not measured"}):t===0||e.baseline===0?C.jsxs("span",{className:"rounded-md bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[Jc(e,e.baseline)," → ",Jc(e,t)]}):(e.metric?.better==="higher"?t/e.baseline:e.baseline/t)>=1?C.jsx("span",{className:"rounded-md bg-green-50 px-2 py-0.5 text-xs font-medium text-green-700",children:Em(e,t)}):C.jsx("span",{className:"rounded-md bg-red-50 px-2 py-0.5 text-xs font-medium text-red-600",children:Em(e,t)});const r=e.rounds[0]?.current?.score??e.scores[0];if(r==null||t==null)return C.jsx("span",{className:"rounded-md bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:r==null?"baseline not measured":"candidate not measured"});const n=t!=null&&r!=null?t-r:0;return n>0?C.jsxs("span",{className:"rounded-md bg-green-50 px-2 py-0.5 text-xs font-medium text-green-700",title:`started at ${r?.toFixed(1)}`,children:["+",n.toFixed(1)," since start"]}):C.jsx("span",{className:"rounded-md bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:"no gain yet"})}function I$e({run:e,selectedRound:t,onSelectRound:r,children:n,title:i,actions:a}){const s=$.useRef(null);$.useEffect(()=>{s.current?.scrollTo({left:99999})},[e.id]);const l=e.kind==="bench"&&e.metric?.better!=="higher",c=e.best.round===0?"baseline":`R${e.best.round}`;return C.jsxs("div",{className:"relative flex h-full flex-col",children:[C.jsx("div",{className:"px-4 pr-11 pt-4",children:C.jsxs("div",{className:"@container flex flex-wrap items-center gap-x-5 gap-y-3 rounded-xl border bg-card px-4 py-3",children:[C.jsxs("div",{className:"min-w-0 basis-[200px] grow",children:[C.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[C.jsx(R$e,{run:e}),i??C.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.name}),C.jsx("span",{className:"shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground max-2xl:hidden",children:e.kind==="bench"?`benchmark · ${e.metric?.unit??"ms"}`:"visual · score /10"}),a&&C.jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:a})]}),C.jsx("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:FE(e)}),C.jsx("div",{className:"mt-0.5 truncate text-xs text-muted-foreground/70",title:e.goal,children:e.goal})]}),C.jsxs("div",{className:"min-w-0 max-w-full",children:[C.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[C.jsx("span",{className:"font-mono text-[26px] font-semibold leading-none tracking-tight text-foreground",children:L$e(e,e.best.score)}),C.jsx("span",{className:"text-xs text-muted-foreground",children:e.kind==="bench"?e.metric?.unit:"/ 10"}),C.jsx(D$e,{run:e})]}),C.jsxs("div",{className:"mt-1.5 text-[11px] text-muted-foreground",children:[e.kind==="bench"&&e.baseline!=null&&C.jsxs(C.Fragment,{children:["started at ",Jc(e,e.baseline)," · "]}),"best in ",c," of ",e.maxRounds," · ",l?"lower":"higher"," is better"]})]}),C.jsx("div",{className:"h-[76px] min-w-[180px] flex-1 rounded-lg border bg-background px-1 @max-[820px]:hidden",children:C.jsx(B$e,{run:e})}),!t&&C.jsx(A$e,{run:e})]})}),C.jsx("div",{className:"min-h-0 flex-1 px-4 py-3",children:n}),C.jsxs("div",{className:"border-t px-4 pb-3 pt-2",children:[C.jsxs("div",{className:"mb-1.5 flex flex-wrap items-baseline justify-between gap-2",children:[C.jsxs("span",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/70",children:["How it got here",C.jsx("span",{className:"normal-case tracking-normal text-muted-foreground/50",children:" · click a round to inspect it"})]}),C.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[C.jsx(lk,{className:"mr-1 inline size-3 text-green-600"}),"best · ",c," · ",C.jsx("span",{className:"font-mono text-foreground",children:Jc(e,e.best.score)}),e.kind==="bench"&&e.best.round>0&&e.baseline!==0&&e.best.score!==0&&Em(e,e.best.score)&&C.jsxs(C.Fragment,{children:[" · ",Em(e,e.best.score)]}),C.jsxs("span",{className:"text-muted-foreground/60",children:[" · ",N$e(e.tokens)," tokens"]})]})]}),C.jsxs("div",{ref:s,className:"flex gap-1.5 overflow-x-auto pb-1",children:[e.rounds.map(h=>{const d=h.attempts.find(b=>b.kept||b.humanPick),f=t===h.n,m=e.best.round===h.n&&h.n>0,g=!h.inProgress&&h.attempts.every(b=>b.status.startsWith("error"));return C.jsxs("button",{onClick:()=>r(f?void 0:h.n),title:h.why??void 0,className:`w-24 shrink-0 rounded-lg border bg-card p-1 text-left transition ${f?"border-blue-500 ring-1 ring-blue-500/60":m?"border-green-600/50 hover:border-green-600":"hover:border-foreground/40"}`,children:[C.jsxs("div",{className:"flex items-center justify-between px-0.5",children:[C.jsxs("span",{className:`text-[11px] leading-4 ${m?"font-semibold text-foreground":"font-medium text-muted-foreground"}`,children:["R",h.n]}),h.inProgress?C.jsx(YP,{className:"size-3 animate-spin text-blue-600"}):m?C.jsx(lk,{className:"size-3 text-green-600"}):d?C.jsx(OP,{className:"size-3 text-muted-foreground/70"}):C.jsx(Nte,{className:"size-3 text-muted-foreground/40"})]}),C.jsx("div",{className:"mt-1 h-11 overflow-hidden rounded bg-muted",children:h.inProgress?C.jsx("div",{className:"flex h-full items-center justify-center text-[10px] text-muted-foreground",children:C.jsx("span",{className:"animate-pulse",children:"working…"})}):e.kind==="bench"?d?C.jsxs("div",{className:"flex h-full flex-col items-center justify-center bg-background",children:[C.jsx("div",{className:"font-mono text-[13px] font-semibold leading-4",children:Jc(e,d.score)}),C.jsx("div",{className:"font-mono text-[9px] text-muted-foreground",children:Em(e,d.score)})]}):C.jsx("div",{className:"flex h-full items-center justify-center px-1 text-center text-[10px] leading-3 text-muted-foreground",children:g?"all failed":"no change"}):d?d.shot?C.jsx("img",{src:d.shot,alt:"",className:"h-full w-full object-cover object-top"}):C.jsx("div",{className:"flex h-full items-center justify-center bg-background font-mono text-[13px] font-semibold",children:Jc(e,d.score)}):C.jsx("div",{className:"flex h-full items-center justify-center text-[10px] text-muted-foreground",children:g?"all failed":"no change"})}),C.jsx("div",{className:`mt-1 truncate px-0.5 text-[10px] leading-4 ${m?"font-medium text-green-700":"text-muted-foreground"}`,children:h.inProgress?h.judging?"judging":"round running":d?C.jsxs(C.Fragment,{children:[d.label,d.humanPick?" (you)":""," · ",C.jsx("span",{className:"font-mono",children:Jc(e,d.score)}),m&&" · best"]}):g?"failed":"kept previous"}),C.jsx("div",{className:"mt-1 flex h-2 items-center gap-[3px] px-0.5",children:h.attempts.map(b=>C.jsx(O$e,{a:b,roundInProgress:h.inProgress},b.name))})]},h.n)}),Array.from({length:Math.min(Math.max(0,e.maxRounds-e.rounds.length),3)},(h,d)=>{const f=e.rounds.length+d+1;return C.jsxs("div",{className:"w-24 shrink-0 rounded-lg border border-dashed p-1",children:[C.jsx("div",{className:"flex items-center justify-between px-0.5",children:C.jsxs("span",{className:"text-[11px] font-medium leading-4 text-muted-foreground/60",children:["R",f]})}),C.jsx("div",{className:"mt-1 flex h-11 items-center justify-center rounded text-[10px] text-muted-foreground/50",children:"upcoming"}),C.jsx("div",{className:"mt-1 px-0.5 text-[10px] leading-4 text-muted-foreground/50",children:"—"}),C.jsx("div",{className:"mt-1 h-2"})]},`upcoming-${f}`)}),e.maxRounds-e.rounds.length>3&&C.jsxs("div",{className:"flex shrink-0 items-center px-1 text-[10px] text-muted-foreground/50",children:["+",e.maxRounds-e.rounds.length-3," more"]})]})]})]})}function wZ(){const e=$.useRef(null),[t,r]=$.useState(0);return $.useLayoutEffect(()=>{if(!e.current)return;const n=new ResizeObserver(([i])=>r(i.contentRect.width));return n.observe(e.current),()=>n.disconnect()},[]),[e,t]}function P$e({run:e,mobile:t}){const r=e.best.live,n=CZ(e),[i,a]=wZ(),[s,l]=$.useState(0);$.useEffect(()=>{if(!i.current)return;const d=new ResizeObserver(([f])=>l(f.contentRect.height));return d.observe(i.current),()=>d.disconnect()},[i]);const c=t?390:1280,h=t?Math.min(1,s/844):a/c;return r?C.jsx("div",{ref:i,className:"relative h-full w-full overflow-hidden",children:r&&a>0&&C.jsx("div",{className:"absolute top-0 overflow-hidden rounded-lg border bg-white shadow-sm",style:{width:c*h,height:t?844*h:s,left:t?(a-c*h)/2:0},children:C.jsx("iframe",{src:r,title:"preview",referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",className:"origin-top-left",style:{width:c,height:t?844:s/h,transform:`scale(${h})`}},r)})}):C.jsx("div",{ref:i,className:"relative h-full w-full overflow-hidden",children:C.jsx(PE,{src:n.shot,version:n.version,progress:n.progress,imageClassName:"mx-auto block h-full w-full rounded-lg border object-contain object-top"})})}function F$e({run:e,h:t=200,mini:r=!1}){const[n,i]=wZ(),a=e.metric?.better!=="higher",s=[[0,e.baseline??NaN]];e.rounds.filter(w=>!w.inProgress).forEach((w,_)=>s.push([w.n,e.scores[_]]));const c=e.rounds.flatMap(w=>w.attempts.filter(_=>_.status!=="running").map(_=>{const S=_.score??_.bench?.value;return{x:w.n,y:S,bad:S==null,rejected:_.score==null&&S!=null,kept:!!(_.kept||_.humanPick)}})),h=[...s.map(w=>w[1]),...c.map(w=>w.y)].filter(w=>w!=null&&isFinite(w)&&w>0);if(!h.length)return C.jsx("div",{ref:n,style:{height:t}});const d=Math.log(Math.min(...h))-.15,f=Math.log(Math.max(...h))+.15,m=Math.max(e.maxRounds,e.rounds.length,1),g=r?4:28,b=w=>g+w/m*(i-g*2),x=w=>{const _=(Math.log(w)-d)/(f-d||1);return r?4+(a?_:1-_)*(t-8):14+(a?_:1-_)*(t-36)},k=s.filter(w=>isFinite(w[1])).map((w,_)=>`${_?"L":"M"}${b(w[0])},${x(w[1])}`).join(" ");return C.jsx("div",{ref:n,style:{height:t},className:"w-full",children:i>0&&C.jsxs("svg",{width:i,height:t,className:"overflow-visible",children:[!r&&Array.from({length:m+1},(w,_)=>C.jsx("text",{x:b(_),y:t-6,textAnchor:"middle",className:"fill-muted-foreground text-[10px]",children:_===0?"start":`R${_}`},_)),!r&&C.jsxs("text",{x:4,y:10,className:"fill-muted-foreground text-[10px]",children:[a?"↓ lower is better":"↑ higher is better"," · log scale · ",C.jsx("tspan",{className:"fill-blue-600",children:"— best"})," · ● accepted · ",C.jsx("tspan",{className:"fill-red-500",children:"○ rejected · × failed"})]}),c.map((w,_)=>w.bad?C.jsx("text",{x:b(w.x)+(_%3-1)*6,y:r?6:24,textAnchor:"middle",className:"fill-red-500 text-[10px]",children:"×"},_):w.rejected?C.jsx("circle",{cx:b(w.x)+(_%3-1)*5,cy:x(w.y),r:r?1.5:3.5,className:"fill-none stroke-red-500",strokeWidth:1.5,children:C.jsx("title",{children:"measured but rejected"})},_):C.jsx("circle",{cx:b(w.x)+(_%3-1)*5,cy:x(w.y),r:r?1.5:3,className:w.kept?"fill-foreground":"fill-foreground/25"},_)),C.jsx("path",{d:k,fill:"none",stroke:"currentColor",strokeWidth:r?1.5:2,className:"text-blue-600"}),s.filter(w=>isFinite(w[1])).map((w,_)=>!r&&C.jsxs("g",{children:[C.jsx("circle",{cx:b(w[0]),cy:x(w[1]),r:3.5,className:"fill-blue-600"}),C.jsx("text",{x:b(w[0]),y:x(w[1])-8,textAnchor:"middle",className:"fill-foreground font-mono text-[10px]",children:sf(e,w[1])})]},_))]})})}function gP({run:e,className:t=""}){const r=CZ(e);return C.jsx("div",{className:`aspect-[16/10] shrink-0 overflow-hidden rounded-md border bg-muted ${t}`,children:e.kind==="bench"?C.jsxs("div",{className:"relative h-full bg-background p-1",children:[C.jsx(F$e,{run:e,h:58,mini:!0}),C.jsx("div",{className:"absolute bottom-1 right-2 font-mono text-[10px]",children:e.best.round>0?cv(e,e.best.score):""})]}):C.jsx(PE,{src:r.shot,version:r.version,progress:r.progress,compact:!0,imageClassName:"h-full w-full object-cover object-top"})})}function $$e({run:e,runs:t,focus:r,setFocus:n,steer:i,onLiveChange:a}){const[s,l]=$.useState(!1),c=r.round?e.rounds.find(N=>N.n===r.round):void 0,h=c?.attempts.find(N=>N.name===r.attempt),d=c?C.jsxs("button",{onClick:()=>n(h?{loop:e.id,round:c.n}:{loop:e.id}),className:"inline-flex min-w-0 items-center gap-1 truncate text-sm text-muted-foreground hover:text-foreground",children:[C.jsx(BP,{className:"size-3.5 shrink-0"})," ",h?`Round ${c.n}`:e.name]}):t.length>1?C.jsxs("span",{className:"relative inline-flex min-w-0 items-center overflow-hidden",children:[C.jsx("select",{value:e.id,onChange:N=>n({loop:N.target.value}),style:{fieldSizing:"content"},className:"max-w-full cursor-pointer appearance-none truncate rounded-md bg-transparent py-0.5 pl-1 pr-5 text-sm font-medium hover:bg-muted focus:outline-none",title:"Switch loop",children:t.map(N=>C.jsx("option",{value:N.id,children:N.name},N.id))}),C.jsx(wte,{className:"pointer-events-none absolute right-1 size-3.5 text-muted-foreground"})]}):void 0,f=e.rounds.flatMap(N=>N.attempts).filter(N=>N.dir&&!N.cleaned),m=!c&&!e.alive&&f.length>0?C.jsx("button",{onClick:async()=>{const{bytes:N}=await zr(`/api/size?run=${encodeURIComponent(e.id)}`).catch(()=>({bytes:0})),B=Math.round(N/1e6);confirm(`Remove ${f.length} attempt worktree${f.length===1?"":"s"}${B?` (~${B} MB)`:""}?
|
|
897
897
|
|
|
898
898
|
Commits, branches of the winner, screenshots and the run itself stay.`)&&i(e.id,{action:"clean"})},className:"ml-1 inline-flex items-center gap-1 hover:text-foreground",title:"Free the attempt worktrees (the commits stay)",children:"clean up"}):null,[g,b]=$.useState(null),[x,k]=$.useState(!1),w=async N=>{k(!0),b(null);try{const B=await zr(N?"/api/live":"/api/live/stop",{method:"POST",json:{run:e.id}});B.ok||b(B.error??"could not start the app")}catch(B){b(String(B))}k(!1),a?.()},_=e.kind!=="bench"&&!e.alive?C.jsx("button",{onClick:()=>w(!e.best.live),disabled:x,className:`ml-1 inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition ${e.best.live?"bg-muted text-foreground":"hover:text-foreground"} disabled:opacity-50`,title:e.best.live?"Stop the app":"Run the winner (one server at a time)",children:e.best.live?C.jsxs(C.Fragment,{children:[C.jsx($te,{className:"size-3"})," stop"]}):C.jsxs(C.Fragment,{children:[C.jsx(Rte,{className:"size-3"})," ",x?"starting…":"run it"]})}):null,S=c?void 0:C.jsxs(C.Fragment,{children:[e.kind!=="bench"&&e.best.live&&C.jsxs(C.Fragment,{children:[C.jsx("button",{onClick:()=>l(!1),className:`rounded p-1 ${s?"":"bg-muted text-foreground"}`,title:"desktop",children:C.jsx(Mte,{className:"size-3.5"})}),C.jsx("button",{onClick:()=>l(!0),className:`rounded p-1 ${s?"bg-muted text-foreground":""}`,title:"phone",children:C.jsx(Fte,{className:"size-3.5"})}),C.jsxs("a",{href:e.best.live,target:"_blank",rel:"noopener noreferrer",className:"ml-1 inline-flex items-center gap-1 hover:text-foreground",children:["open ",C.jsx(zP,{className:"size-3"})]})]}),_,m]});return C.jsxs("div",{className:"relative h-full",children:[C.jsx(I$e,{run:e,selectedRound:r.round,onSelectRound:N=>n({loop:e.id,round:N}),title:d,actions:S,children:c?C.jsxs("div",{className:"flex h-full flex-col overflow-y-auto pb-2 animate-in fade-in",children:[C.jsx(x$e,{run:e,round:c,onOpen:N=>n({loop:e.id,round:c.n,attempt:N}),onPick:N=>i(e.id,{action:"pick",attempt:N})}),e.kind==="bench"&&(()=>{const N=c.attempts.find(B=>B.kept||B.humanPick);return N?C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"mb-2 mt-4 text-[11px] uppercase tracking-wide text-muted-foreground/70",children:["What ",N.model,"’s kept version changed"]}),C.jsx(Xw,{run:e.id,name:N.name,version:N.score,className:"min-h-[300px] flex-1 rounded-lg border"})]}):null})()]}):e.kind==="bench"?C.jsxs("div",{className:"flex h-full flex-col gap-2",children:[C.jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/70",children:"Best version vs. original"}),C.jsx(Xw,{run:e.id,name:"best",version:`${e.best.round}${e.best.label}`,className:"min-h-0 flex-1 rounded-lg border"})]}):C.jsx(P$e,{run:e,mobile:s})}),c&&h&&C.jsxs("div",{className:"absolute inset-y-0 right-0 z-10 w-[620px] max-w-full border-l bg-background p-8 shadow-2xl animate-in slide-in-from-right-8",children:[C.jsx("button",{onClick:()=>n({loop:e.id,round:c.n}),className:"absolute right-4 top-4 text-muted-foreground hover:text-foreground",children:C.jsx(Gh,{className:"size-4"})}),C.jsx(S$e,{run:e,round:c,a:h,onBack:()=>n({loop:e.id,round:c.n}),steer:i})]})]})}function z$e({runs:e,focus:t,setFocus:r,steer:n,onClose:i,onLiveChange:a}){const s=e.find(l=>l.id===t.loop);return $.useEffect(()=>{const l=c=>{c.key==="Escape"&&(t.attempt?r({loop:t.loop,round:t.round}):t.round?r({loop:t.loop}):t.loop?r({}):i?.())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)}),s?C.jsx($$e,{run:s,runs:e,focus:t,setFocus:r,steer:n,onLiveChange:a}):null}const Va=()=>{throw new Error("Invalid workspace URL. Use /workspaces or a workspace, chat, and loop link.")},q2=e=>e.length>0&&!/[\u0000-\u001f\u007f]/.test(e)&&e!=="."&&e!=="..";function j$e(e){const t=e.split(/[?#]/,1)[0];(t.includes("\\")||/(?:^|\/)(?:\.|%2e){1,2}(?:\/|$)/i.test(t))&&Va();let r;try{r=new URL(e,"http://loops.invalid")}catch{return Va()}const n={},i=r.pathname.split("/");if(r.pathname!=="/"&&r.pathname!=="/workspaces"){(i[1]!=="workspaces"||![3,5,7].includes(i.length)||i.length>=5&&i[3]!=="chats"||i.length===7&&i[5]!=="loops")&&Va();const a=s=>{let l;try{l=decodeURIComponent(s)}catch{return Va()}return q2(l)||Va(),l};n.workspace=a(i[2]),i.length>=5&&(n.chat=a(i[4])),i.length===7&&(n.loop=a(i[6]))}for(const a of["round","attempt"])r.searchParams.getAll(a).length>1&&Va();for(const a of r.search.slice(1).split("&")){const[s,...l]=a.split("=");if(!(s!=="round"&&s!=="attempt"))try{decodeURIComponent(l.join("=").replace(/\+/g," "))}catch{Va()}}if(r.searchParams.has("round")){const a=r.searchParams.get("round");(!n.loop||!/^[1-9]\d*$/.test(a)||!Number.isSafeInteger(Number(a)))&&Va(),n.round=Number(a)}if(r.searchParams.has("attempt")){const a=r.searchParams.get("attempt");(!n.round||!q2(a))&&Va(),n.attempt=a}return n}const H$e=()=>j$e(location.href);function Fl(e){(e.chat&&!e.workspace||e.loop&&!e.chat||e.round!==void 0&&!e.loop||e.attempt!==void 0&&e.round===void 0)&&Va();let t="/workspaces";for(const[i,a]of[["workspace","/"],["chat","/chats/"],["loop","/loops/"]]){const s=e[i];s!==void 0&&(q2(s)||Va(),t+=a+encodeURIComponent(s))}const r=new URLSearchParams,n=eo();return n&&n!==location.origin&&r.set("server",n),e.round!==void 0&&((!Number.isSafeInteger(e.round)||e.round<1)&&Va(),r.set("round",String(e.round))),e.attempt!==void 0&&(q2(e.attempt)||Va(),r.set("attempt",e.attempt)),t+(r.size?`?${r}`:"")}function U$e(e){return!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey}function Ga({href:e,onNavigate:t,disabled:r,...n}){const i=a=>{if(r){a.preventDefault();return}!U$e(a)||n.target&&n.target!=="_self"||n.download!=null&&n.download!==!1||(a.preventDefault(),t())};return C.jsx("a",{...n,href:r?void 0:e,"aria-disabled":r||void 0,onClick:i})}const q$e=[{state:["needs"],title:"Needs you"},{state:["running"],title:"Running"},{state:["new","stuck"],title:"New results"},{state:["done","idle"],title:"Earlier"}],V$e={needs:"font-semibold text-amber-950",running:"font-medium text-foreground",new:"font-medium text-foreground",stuck:"font-medium text-foreground",done:"text-muted-foreground",idle:"text-muted-foreground"},G$e={needs:"text-amber-700",running:"text-muted-foreground",new:"text-muted-foreground",stuck:"text-red-600",done:"text-muted-foreground/70",idle:"text-muted-foreground/70"};function W$e({rows:e,activeId:t,onOpen:r,onNew:n,hrefForChat:i,canCreate:a=!0,workspaces:s,activeWs:l,onSwitchWs:c,onAddFolder:h,onDelete:d,loading:f,footer:m,onRename:g,renaming:b,onRenameChange:x,onRenameSubmit:k,onRenameCancel:w}){return C.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[C.jsx("div",{className:"px-3 pb-2 pt-4 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Chats"}),C.jsxs("button",{onClick:n,disabled:!a,title:a?void 0:"Open a workspace before creating a chat",className:"mx-2 mb-1 flex min-h-9 items-center justify-center gap-1.5 rounded-lg border bg-background px-3 text-[13px] font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40",children:[C.jsx(rF,{className:"size-4"})," New chat"]}),C.jsxs("nav",{className:"min-h-0 flex-1 overflow-auto px-2 pb-4",children:[f&&C.jsx("div",{className:"space-y-1.5 px-1 pt-1",children:[0,1,2].map(_=>C.jsxs("div",{className:"animate-pulse rounded-lg bg-muted/60 px-2.5 py-2",children:[C.jsx("div",{className:"h-2.5 w-2/3 rounded bg-muted-foreground/20"}),C.jsx("div",{className:"mt-1.5 h-2 w-1/2 rounded bg-muted-foreground/10"})]},_))}),q$e.map(_=>{const S=e.filter(B=>_.state.includes(B.state));if(!S.length)return null;const N=S.reduce((B,I)=>B+I.asks,0);return C.jsxs("section",{className:"mt-3 border-t border-border/60 pt-2 first:mt-2 first:border-t-0 first:pt-0",children:[C.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2 px-2.5",children:[C.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:_.title}),_.state[0]==="needs"&&N>0&&C.jsx("span",{className:"rounded-md bg-amber-100 px-1.5 py-px text-[11px] font-semibold tabular-nums text-amber-800",children:N})]}),S.map(B=>{const I=B.id===t,P=B.progress!=null?Math.round(B.progress*100):null,O=I?B.state==="needs"?"bg-amber-50 ring-1 ring-amber-200 shadow-sm":"bg-card ring-1 ring-border shadow-sm":B.state==="needs"?"bg-amber-50/70 hover:bg-amber-100/70":"hover:bg-muted";return C.jsxs("div",{className:`group/row relative mb-0.5 flex min-h-9 w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors ${O}`,children:[C.jsx(Ga,{href:i?.(B.id)??"#",onNavigate:()=>{b?.id!==B.id&&r(B.id)},"aria-current":I?"page":void 0,"aria-label":B.title,title:B.title,className:"absolute inset-0 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),I&&C.jsx("span",{className:"pointer-events-none absolute left-0.5 top-2 bottom-2 w-[3px] rounded-full bg-blue-500","aria-hidden":!0}),C.jsxs("span",{className:"pointer-events-none relative min-w-0 flex-1",children:[b?.id===B.id?C.jsx("input",{autoFocus:!0,value:b.value,onChange:X=>x?.(X.target.value),onClick:X=>X.stopPropagation(),onKeyDown:X=>{X.stopPropagation(),X.key==="Enter"&&k?.(),X.key==="Escape"&&w?.()},onBlur:()=>k?.(),className:"pointer-events-auto block w-full rounded border bg-background px-1.5 py-0.5 text-[13px] outline-none focus-visible:ring-1 focus-visible:ring-foreground/20"}):C.jsx("span",{className:`block truncate text-[13px] leading-5 ${I?"font-medium text-foreground":V$e[B.state]}`,children:B.title}),B.line&&C.jsx("span",{className:`block truncate text-[12px] leading-4 ${G$e[B.state]}`,children:B.line}),B.state==="running"&&P!=null&&C.jsx("span",{className:"mt-1.5 block h-1.5 overflow-hidden rounded-full bg-border",children:C.jsx("span",{className:"block h-full rounded-full bg-blue-500",style:{width:`${P}%`}})})]}),B.state==="needs"&&B.asks>0&&C.jsxs("span",{className:"pointer-events-none inline-flex shrink-0 items-center gap-1 rounded-md bg-amber-100 px-1.5 py-0.5 text-[11px] font-semibold tabular-nums text-amber-800",children:[C.jsx(Lte,{className:"size-3"}),B.asks]}),B.state==="running"&&P!=null&&C.jsxs("span",{className:"pointer-events-none shrink-0 text-[11px] font-medium tabular-nums text-muted-foreground",children:[P,"%"]}),B.state==="new"&&C.jsx("span",{className:"pointer-events-none shrink-0 rounded-md bg-green-50 px-1.5 py-0.5 text-[11px] font-medium text-green-700",children:"New"}),B.state==="stuck"&&C.jsx(jte,{className:"pointer-events-none size-3.5 shrink-0 text-red-500","aria-label":"Errored"}),d&&C.jsx("button",{type:"button",title:"Delete this chat (its loops stay in the repo)",onClick:X=>{X.stopPropagation(),d(B.id)},className:"relative shrink-0 rounded p-0.5 text-muted-foreground/40 opacity-0 transition group-hover/row:opacity-100 focus-visible:opacity-100 hover:bg-red-50 hover:text-red-600",children:"✕"}),g&&I&&C.jsx("button",{type:"button",title:"Rename",onClick:X=>{X.stopPropagation(),g(B.id,B.title)},className:"relative shrink-0 rounded p-0.5 text-muted-foreground/60 hover:bg-muted hover:text-foreground",children:C.jsx(Bte,{className:"size-3"})})]},B.id)})]},_.title)})]}),m&&C.jsx("div",{className:"border-t px-2 py-2",children:m})]})}const Y$e=["A","B","C"];function X$e(e){const t=e.split(new RegExp("(?<=[.!?])\\s+(?=[A-Z])")).filter(Boolean),r=t.findIndex(n=>/\?$/.test(n.trim()));return r===-1?{pre:"",ask:e,post:""}:{pre:t.slice(0,r).join(" "),ask:t[r],post:t.slice(r+1).join(" ")}}function K$e({text:e}){return C.jsx("div",{className:"mt-1.5 space-y-1 rounded-lg border border-neutral-100 bg-neutral-50 px-2.5 py-2 text-[13px] leading-5 text-neutral-500",children:e.split(`
|
|
899
|
-
`).map((t,r)=>{const n=t.match(/^([A-Z]):\s+(.*)$/),i=t.match(/^([A-Za-z][A-Za-z ]{0,9}:)\s+(.*)$/);return C.jsx("p",{className:"flex items-start gap-1.5",children:n?C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-md bg-neutral-100 text-[11px] font-medium text-neutral-500",children:n[1]}),C.jsx("span",{className:"min-w-0",children:n[2]})]}):i?C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"font-medium text-neutral-700",children:i[1]}),C.jsx("span",{className:"min-w-0",children:i[2]})]}):C.jsx("span",{children:t})},r)})})}function Q$e({runName:e,q:t,onAnswer:r,onOpen:n,compare:i}){const[a,s]=$.useState(null),l=t.answered?.i!=null?t.options[t.answered.i]?.label:void 0;if(!t.answered&&(t.superseded||t.expired))return C.jsxs("div",{className:"text-[13px] leading-5 text-muted-foreground",children:[C.jsx("button",{onClick:n,className:"font-medium underline-offset-2 hover:underline",children:e})," · ",t.text,C.jsx("span",{className:"block text-xs",children:t.superseded?`Superseded — ${t.superseded}`:"Expired — decision deadline passed."})]});if(t.answered)return C.jsxs("div",{className:"flex items-start gap-1.5 text-[13px] leading-5 text-muted-foreground",children:[C.jsx($0,{className:"mt-0.5 size-3.5 shrink-0 text-neutral-400"}),C.jsxs("p",{className:"min-w-0",children:[C.jsx("button",{onClick:n,className:"font-medium text-neutral-600 underline-offset-2 hover:text-foreground hover:underline",children:e}),C.jsx("span",{className:"text-neutral-300",children:" · "}),t.text.replace(/ (Which|What|Was).*$/,""),C.jsx("span",{className:"text-neutral-300",children:" → "}),C.jsx("span",{className:"font-medium text-neutral-700",children:l??t.answered.auto})]})]});const{pre:c,ask:h,post:d}=X$e(t.text);return C.jsxs("div",{className:"rounded-xl border border-neutral-200 border-l-2 border-l-amber-400 bg-white shadow-sm",children:[C.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2",children:[C.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-amber-500"}),C.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-neutral-500",children:"Needs you"}),C.jsxs("button",{onClick:n,className:"-my-1 ml-auto -mr-1 flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] text-neutral-500 transition hover:bg-neutral-100 hover:text-neutral-900",children:[e,t.round?` · round ${t.round}`:"",C.jsx(OP,{className:"size-3"})]})]}),C.jsxs("div",{className:"px-3.5 pb-3",children:[c&&C.jsx("p",{className:"text-[13px] leading-5 text-neutral-500",children:c}),C.jsx("p",{className:`${c?"mt-1":""} text-sm font-medium leading-5 text-neutral-900`,children:h}),d&&C.jsx("p",{className:"mt-1 text-[13px] leading-5 text-neutral-500",children:d}),!i&&t.detail&&C.jsx(K$e,{text:t.detail}),i?.(a,f=>{s(f),r(f)})]}),!i&&C.jsx("div",{className:"flex flex-col gap-1 border-t border-neutral-100 px-3.5 py-2.5",children:t.options.map((f,m)=>C.jsxs("button",{disabled:a!=null,onClick:()=>{s(m),r(m)},className:`flex min-h-9 w-full items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm font-medium transition disabled:opacity-50 ${m===0?"bg-neutral-950 text-white hover:bg-neutral-800":"border border-neutral-200 bg-white text-neutral-900 hover:bg-neutral-50"}`,children:[C.jsx("span",{className:`flex size-5 shrink-0 items-center justify-center rounded-md text-[11px] font-medium ${m===0?"bg-white/15 text-white":"bg-neutral-100 text-neutral-500"}`,children:Y$e[m]}),C.jsx("span",{className:"min-w-0 flex-1",children:a===m?"…":f.label}),m===0&&C.jsx("span",{className:"shrink-0 text-[10px] font-normal uppercase tracking-wide text-white/60",children:"Suggested"})]},m))})]})}const $E=(e,t)=>{const r=e.rounds.find(n=>n.n===t.round)?.attempts??[];return r.find(n=>n.name===t.label)??r.find(n=>n.style===String(t.label??"").replace(/^R\d+-/,""))},zE=(e,t)=>{const r=e.rounds.find(i=>i.n===t.round);return r?.attempts.find(i=>(i.kept||i.humanPick)&&!i.name?.includes(String(t.label??"#")))??r?.attempts.find(i=>(i.kept||i.humanPick)&&!i.vetoed)};function Z$e({run:e,q:t,busy:r,onPick:n,onOpenAttempt:i}){const a=e.rounds.find(d=>d.n===t.round),s=$E(e,t),l=zE(e,t);if(!a||!s)return null;const c=l?.score??a.current?.score,h=[{key:"kept",title:l?l.model:a.from.round>0?`R${a.from.round} ${a.from.label}`:"the original",tag:l?"kept now":"before this round",time:c,ok:!0,note:l?.review?.note??a.current?.reason??"the version this round started from",open:l?.name,i:0,btn:"Reviewer was right"},{key:"rej",title:s.model,tag:"rejected by review",time:s.bench?.value??s.score,ok:!1,note:s.review?.note,open:s.name,i:1,btn:`Use ${s.label} anyway`}];return C.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2.5",children:h.map(d=>C.jsxs("div",{className:"flex min-w-0 flex-col rounded-lg border bg-background p-2.5",children:[C.jsxs("div",{className:"flex items-baseline gap-1.5 text-sm",children:[C.jsx("span",{className:"font-medium",children:d.title}),C.jsx("span",{className:`text-[11px] ${d.ok?"text-muted-foreground":"text-red-600"}`,children:d.tag})]}),C.jsxs("div",{className:"mt-1.5 flex items-baseline gap-2",children:[C.jsx("span",{className:"font-mono text-xl font-semibold",children:TZ(e,d.time)}),d.time!=null&&e.baseline&&Math.abs(Math.log(d.time/e.baseline))>.05&&C.jsx("span",{className:"font-mono text-[11px] text-muted-foreground",children:cv(e,d.time)})]}),d.note&&C.jsxs("p",{className:`mt-1 line-clamp-3 text-xs leading-snug ${d.ok?"text-muted-foreground":"text-red-700/80"}`,children:[d.ok?"":"Reviewer: ",d.note]}),d.open&&C.jsx("button",{onClick:()=>i(d.open),className:"mb-2 mt-1.5 w-fit text-[11px] text-muted-foreground underline decoration-dotted underline-offset-2 hover:text-foreground",children:"see the code change →"}),C.jsx("button",{disabled:r!=null,onClick:()=>n(d.i),className:`mt-auto min-h-9 translate-y-0 rounded-md border text-xs font-medium transition disabled:opacity-50 ${d.i===0?"border-foreground bg-foreground text-background hover:opacity-90":"bg-background hover:bg-muted"}`,children:r===d.i?"…":d.btn})]},d.key))})}function J$e({run:e,q:t,busy:r,onPick:n,onOpenAttempt:i}){const a=e.rounds.find(h=>h.n===t.round),s=zE(e,t),l=$E(e,t);if(!a||!s||!l||!s.shot||!l.shot)return null;const c=[{a:s,i:0,tag:"kept now"},{a:l,i:1,tag:"runner-up"}];return C.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2.5",children:c.map(({a:h,i:d,tag:f})=>C.jsxs("div",{className:"flex min-w-0 flex-col rounded-lg border bg-background p-1.5",children:[C.jsxs("button",{onClick:()=>i(h.name),title:"Open this version",className:"group relative block aspect-[16/10] overflow-hidden rounded-md border bg-muted",children:[C.jsx("img",{src:h.shot,alt:"",className:"h-full w-full object-cover object-top transition group-hover:scale-[1.02]"}),C.jsx("span",{className:"absolute left-1.5 top-1.5 flex size-5 items-center justify-center rounded-md bg-foreground text-[11px] font-semibold text-background",children:h.label})]}),C.jsxs("div",{className:"mt-1.5 flex items-baseline gap-1.5 px-0.5 text-sm",children:[C.jsx("span",{className:"font-medium",children:h.model}),C.jsx("span",{className:"text-[11px] text-muted-foreground",children:f}),C.jsx("span",{className:"ml-auto font-mono text-xs",children:TZ(e,h.score)})]}),h.reason&&C.jsx("p",{className:"mt-0.5 line-clamp-2 px-0.5 text-xs leading-snug text-muted-foreground",children:h.reason}),C.jsx("button",{disabled:r!=null,onClick:()=>n(d),className:`mt-2 min-h-9 rounded-md border text-xs font-medium transition disabled:opacity-50 ${d===0?"border-foreground bg-foreground text-background hover:opacity-90":"bg-background hover:bg-muted"}`,children:r===d?"…":d===0?`Keep ${h.label}`:`Switch to ${h.label}`})]},h.name))})}function yP({run:e,q:t,onAnswer:r,onOpen:n,onOpenAttempt:i}){const a=$E(e,t),s=zE(e,t),l=e.rounds.find(d=>d.n===t.round),c=!t.answered&&t.kind==="veto"&&e.kind==="bench"&&!!a&&l?.attempts.some(d=>d.kept||d.humanPick),h=!t.answered&&t.kind==="close"&&!!a?.shot&&!!s?.shot;return C.jsx(Q$e,{runName:e.name,q:t,onAnswer:r,onOpen:n,compare:c?(d,f)=>C.jsx(Z$e,{run:e,q:t,busy:d,onPick:f,onOpenAttempt:i}):h?(d,f)=>C.jsx(J$e,{run:e,q:t,busy:d,onPick:f,onOpenAttempt:i}):void 0})}function of({title:e,onClose:t,children:r,variant:n="default"}){const i=$.useRef(null);return $.useEffect(()=>{const a=i.current,s=document.activeElement instanceof HTMLElement?document.activeElement:null;return a?.showModal(),a?.querySelector("[data-dialog-autofocus]")?.focus(),()=>{a?.close();const l=document.activeElement;s?.isConnected&&(!l||l===document.body||a?.contains(l))&&s.focus({preventScroll:!0})}},[]),C.jsx("dialog",{ref:i,"data-dialog-variant":n,onKeyDown:a=>{a.key==="Escape"&&a.stopPropagation()},onCancel:a=>{a.preventDefault(),t()},onClick:a=>{a.target===a.currentTarget&&t()},"aria-label":e,className:`overflow-y-auto border bg-background p-0 text-foreground shadow-2xl backdrop:bg-black/30 ${n==="sheet"?"fixed inset-y-0 right-0 left-auto m-0 h-dvh max-h-dvh w-[min(26.25rem,100%)] border-y-0 border-r-0":"m-auto max-h-[85dvh] w-[min(36rem,calc(100%-2rem))] rounded-xl"}`,children:n==="palette"?r:C.jsxs("div",{className:"p-5",children:[C.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[C.jsx("h2",{className:"font-semibold",children:e}),C.jsx("button",{onClick:t,"aria-label":`Close ${e}`,className:"rounded px-2 py-1 text-muted-foreground hover:bg-muted",children:"✕"})]}),r]})})}const eze=["serve","check","bench","attempts","rounds","timeoutMin","tokenBudget","judgeSamples","judgePairs"],tze=new Set(["serve","check","bench","metric","protect"]),ak=e=>e==null?"—":typeof e=="object"?JSON.stringify(e):String(e);function rze({chat:e,onClose:t,onPrompt:r,onProviders:n}){const[i,a]=$.useState(null),[s,l]=$.useState(!0),[c,h]=$.useState({}),d=$.useRef(new Set),[f,m]=$.useState({}),[g,b]=$.useState(null),[x,k]=$.useState(null),[w,_]=$.useState(!1),[S,N]=$.useState(null),B=$.useCallback(async()=>{l(!0);try{const O=await zr(`/api/config?chat=${encodeURIComponent(e)}`);if(O.error)throw new Error(O.error);a(O.keys??[])}catch(O){N(O instanceof Error?O.message:String(O))}finally{l(!1)}},[e]);$.useEffect(()=>{B()},[B]);const I=async O=>{const X=f[O];if(X===void 0||d.current.has(O))return;d.current.add(O),h(Z=>({...Z,[O]:!0})),N(null);let j=X.trim();["attempts","rounds","timeoutMin","judgeSamples","judgePairs"].includes(O)&&(j=X.trim()===""?null:Number(X)),O==="tokenBudget"&&(j=X.trim()===""?null:X.trim());try{const Z=await zr("/api/config",{method:"POST",json:{chat:e,key:O,value:j}});if(!Z.ok)throw new Error(Z.error||"Could not save this setting.");m(se=>{if(se[O]!==X)return se;const ue={...se};return delete ue[O],ue}),await B()}catch(Z){N(Z instanceof Error?Z.message:String(Z))}finally{d.current.delete(O),h(Z=>({...Z,[O]:!1}))}},P=async()=>{_(!0),b(null),k(null);try{const O=await zr("/api/doctor",{method:"POST",json:{chat:e}});b(O.checks??[]),k(O.verdict??null)}catch(O){N(String(O))}_(!1)};return C.jsxs(of,{title:"Loop settings",variant:"sheet",onClose:t,children:[S&&C.jsx("div",{role:"alert",className:"mb-3 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[12px] text-red-700",children:S}),C.jsxs("div",{className:"mb-4 rounded-xl border p-3",children:[C.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[C.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Can this repo run a round?"}),C.jsxs("button",{onClick:P,disabled:w,className:"ml-auto inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] hover:bg-muted disabled:opacity-50",children:[C.jsx(Ote,{className:`size-3 ${w?"animate-spin":""}`})," ",w?"checking…":"run checks"]})]}),x&&C.jsx("div",{className:`mb-2 rounded-md px-2 py-1 text-[11px] font-medium ${x==="ready"?"bg-emerald-50 text-emerald-700":x==="will-fail"?"bg-red-50 text-red-700":"bg-amber-50 text-amber-800"}`,children:x==="ready"?"ready":x==="will-fail"?"a round would fail":"running, but blind in places"}),!g&&!w&&C.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Boots the app, runs the tests, and asks the judge to read a code off a generated image."}),(g??[]).map(O=>C.jsxs("div",{className:"mt-1.5 flex items-start gap-1.5 text-[12px] leading-5",children:[O.ok?C.jsx($0,{className:"mt-0.5 size-3.5 shrink-0 text-emerald-600"}):C.jsx(Gh,{className:"mt-0.5 size-3.5 shrink-0 text-red-500"}),C.jsxs("span",{className:"min-w-0",children:[C.jsx("span",{className:O.ok?"text-foreground":"font-medium text-foreground",children:O.name}),C.jsxs("span",{className:"text-muted-foreground",children:[" — ",O.detail]}),O.ms>0&&C.jsxs("span",{className:"ml-1 font-mono text-[10px] text-muted-foreground/70",children:[O.ms,"ms"]})]})]},O.name))]}),C.jsxs("div",{className:"mb-4 rounded-xl border p-3",children:[C.jsx("div",{className:"mb-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Provider connections"}),C.jsx("p",{className:"mb-2 text-[12px] leading-5 text-muted-foreground",children:"Pi owns provider connections and credentials on the connected server. Connect with OAuth or an API key in the provider dialog; this does not change chat or loop models."}),C.jsx("button",{onClick:n,className:"rounded-md border px-3 py-1.5 text-xs hover:bg-muted",children:"Manage providers"})]}),C.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"In force"}),s&&C.jsx("p",{role:"status",className:"mb-2 text-xs text-muted-foreground",children:"Loading settings…"}),!s&&i===null&&C.jsx("button",{onClick:()=>{B()},className:"mb-2 text-xs underline",children:"Retry loading settings"}),C.jsx("div",{className:"divide-y rounded-xl border",children:(i??[]).map(O=>C.jsxs("div",{className:"px-3 py-2",children:[C.jsxs("div",{className:"flex items-baseline gap-2",children:[C.jsx("span",{className:`font-mono text-[12px] ${tze.has(O.key)?"text-foreground":"text-muted-foreground"}`,children:O.key}),C.jsx("span",{className:`rounded px-1 text-[10px] ${O.source==="project"?"bg-foreground/10 text-foreground":O.source==="user"?"bg-muted text-muted-foreground":"text-muted-foreground/70"}`,children:O.source}),O.key==="models"&&C.jsx("button",{onClick:()=>r("/loop models"),className:"ml-auto rounded-md border px-2 py-0.5 text-[11px] hover:bg-muted",title:"The engine asks for each role in turn",children:"pick…"})]}),O.key==="models"?C.jsx("div",{className:"mt-1 space-y-0.5",children:Object.entries(O.value??{}).filter(([X])=>X!=="pool").map(([X,j])=>C.jsxs("div",{className:"flex gap-2 text-[12px]",children:[C.jsx("span",{className:"w-12 shrink-0 text-muted-foreground",children:X}),C.jsx("span",{className:"truncate font-mono",children:ak(j)})]},X))}):eze.includes(O.key)?C.jsxs("div",{className:"mt-1 flex gap-1.5",children:[C.jsx("input",{"aria-label":`${O.key} setting`,value:f[O.key]??ak(O.value),onChange:X=>m(j=>({...j,[O.key]:X.target.value})),onKeyDown:X=>{X.key==="Enter"&&I(O.key)},placeholder:O.key==="tokenBudget"?"e.g. 800k":"",className:"min-w-0 flex-1 rounded-md border bg-background px-2 py-1 font-mono text-[12px] outline-none focus-visible:ring-1 focus-visible:ring-foreground/20"}),f[O.key]!==void 0&&C.jsx("button",{"aria-label":`Save ${O.key}`,disabled:c[O.key],onClick:()=>{I(O.key)},className:"rounded-md bg-foreground px-2 py-1 text-[11px] font-medium text-background disabled:opacity-50",children:c[O.key]?"saving…":"save"})]}):C.jsx("div",{className:"mt-0.5 break-words font-mono text-[12px] text-muted-foreground",children:ak(O.value)})]},O.key))}),C.jsxs("p",{className:"mt-3 text-[11px] leading-4 text-muted-foreground",children:["Written to ",C.jsx("span",{className:"font-mono",children:".pi/loops.json"})," (this repo). Your defaults live in ",C.jsx("span",{className:"font-mono",children:"~/.pi/agent/loops.json"}),". Models are picked by the engine so a judge can never be a model that cannot see."]})]})}function nze({workspaces:e,active:t,onSwitch:r,onAdd:n,onRemove:i,hrefForWorkspace:a,launcherHref:s="/workspaces"}){const l=$.useRef(null),c=e.map(h=>`${h.id}:${h.title}:${h.path}:${h.available}`).join("\0");return $.useEffect(()=>{l.current?.querySelector('[aria-current="page"]')?.scrollIntoView({block:"nearest",inline:"nearest"})},[t,c]),C.jsxs("nav",{ref:l,"aria-label":"Workspaces",className:"flex min-h-9 min-w-0 shrink-0 items-stretch gap-0 overflow-x-auto border-b bg-foreground/10 [scrollbar-width:thin]",children:[e.map(h=>{const d=h.id===t;return C.jsxs("div",{className:Qo("group/tab relative flex min-w-0 shrink-0 items-center",d?"bg-background":"hover:bg-muted/50"),children:[C.jsx(Ga,{href:a?.(h.id)??"#",onNavigate:()=>r(h.id),disabled:h.available===!1,title:h.available===!1?`${h.path} (unavailable)`:h.path,"aria-current":d?"page":void 0,className:Qo("flex h-9 min-w-0 max-w-[220px] items-center gap-1.5 pl-3 text-[12px] transition-colors",e.length>1?"pr-2":"pr-3",d?"font-medium text-foreground":"text-foreground/70","aria-disabled:opacity-40"),children:C.jsxs("span",{className:"truncate",children:[h.title,e.some(f=>f.id!==h.id&&f.title===h.title)?` · ${h.path.split("/").filter(Boolean).slice(-2,-1)[0]??"/"}`:"",h.available===!1?" · unavailable":""]})}),C.jsx("button",{onClick:()=>i(h.id),title:`Close ${h.title} (its loops stay on disk)`,"aria-label":`Close ${h.title}`,className:"-ml-0.5 mr-1.5 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-red-600",children:C.jsx(Gh,{className:"size-3"})}),d&&C.jsx("span",{className:"absolute inset-x-0 -bottom-px h-[2px] bg-foreground","aria-hidden":!0})]},h.id)}),C.jsx(Ga,{href:s,onNavigate:n,title:"Open workspace","aria-label":"Open workspace",className:"flex h-9 w-9 shrink-0 items-center justify-center text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:C.jsx(rF,{className:"size-3.5"})})]})}function ize(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.path=="string"&&(typeof t.parent=="string"||t.parent===null)&&typeof t.home=="string"&&typeof t.truncated=="boolean"&&typeof t.loopable=="boolean"&&Array.isArray(t.entries)&&t.entries.every(r=>{if(!r||typeof r!="object")return!1;const n=r;return typeof n.name=="string"&&typeof n.path=="string"&&typeof n.symlink=="boolean"})}function aze(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&!!t.id&&typeof t.path=="string"&&typeof t.title=="string"&&typeof t.sessionDir=="string"}function sze({workspaces:e,onOpen:t,hrefForWorkspace:r}){const[n,i]=$.useState(null),[a,s]=$.useState(""),[l,c]=$.useState(!1),[h,d]=$.useState(!1),[f,m]=$.useState(!1),[g,b]=$.useState(null),x=$.useRef(0),k=$.useRef(!0),w=eo()||location.origin,_=async(B,I=l)=>{const P=++x.current;d(!0),b(null);try{const O=new URLSearchParams;B&&O.set("path",B),I&&O.set("hidden","1");const X=await zr(`/api/directories?${O}`);if(!ize(X))throw new Error("The server returned an invalid directory response. The server may be outdated; restart the Loops server and try again.");P===x.current&&(i(X),s(X.path))}catch(O){P===x.current&&(i(null),B!==void 0&&s(B),b(O instanceof Error?O.message:String(O)))}finally{P===x.current&&d(!1)}};$.useEffect(()=>(k.current=!0,_(),()=>{k.current=!1,x.current++}),[]);const S=async B=>{m(!0),b(null);try{const I=await zr("/api/workspaces",{method:"POST",json:{path:B}});if(!I?.ok)throw new Error(I?.error||"Unable to open workspace");if(!aze(I.workspace))throw new Error("The server returned an invalid workspace response. Restart the Loops server and try again.");k.current&&t(I.workspace)}catch(I){k.current&&b(I instanceof Error?I.message:String(I))}finally{k.current&&m(!1)}},N=n?.path.split("/").filter(Boolean)??[];return C.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:C.jsxs("div",{className:"mx-auto max-w-3xl space-y-6 px-6 py-8",children:[C.jsxs("div",{children:[C.jsx("h1",{className:"text-xl font-semibold",children:"Open a workspace"}),C.jsxs("p",{className:"mt-1 text-muted-foreground",children:["Choose a directory on ",C.jsx("span",{className:"font-medium text-foreground break-all",children:w}),". Opening it won't start a chat."]})]}),e.length>0&&C.jsxs("section",{children:[C.jsx("h2",{className:"mb-2 text-sm font-medium",children:"Recent workspaces"}),C.jsx("div",{className:"rounded-lg border",children:e.map(B=>C.jsxs("div",{className:"flex items-center gap-3 border-b p-3 last:border-0",children:[C.jsx(Ste,{className:"size-4 shrink-0 text-muted-foreground"}),C.jsxs("div",{className:"min-w-0 flex-1",children:[C.jsxs("div",{className:"font-medium",children:[B.title,B.open!==!1&&C.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:"Open"}),B.available===!1&&C.jsx("span",{className:"ml-2 text-xs text-amber-700",children:"Unavailable"})]}),C.jsx("div",{className:"break-all text-xs text-muted-foreground",children:B.path})]}),C.jsx(Ga,{href:r?.(B.id)??"#",disabled:B.available===!1||f,onNavigate:()=>{S(B.path)},className:"rounded-md border px-3 py-1.5 text-xs hover:bg-muted aria-disabled:opacity-40",children:"Open"})]},B.id))})]}),C.jsxs("section",{className:"space-y-3",children:[C.jsx("h2",{className:"font-medium",children:"Browse directories"}),C.jsxs("form",{onSubmit:B=>{if(B.preventDefault(),!a.trim()){x.current++,d(!1),i(null),b("Enter a directory path.");return}_(a.trim())},className:"flex gap-2",children:[C.jsx("label",{htmlFor:"workspace-path",className:"sr-only",children:"Directory path"}),C.jsx("input",{id:"workspace-path",value:a,onChange:B=>s(B.target.value),placeholder:"Absolute path or ~",className:"min-w-0 flex-1 rounded-md border bg-background px-3 py-2 font-mono text-xs"}),C.jsx("button",{className:"rounded-md border px-3 text-xs hover:bg-muted",children:"Go"})]}),C.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[C.jsx("button",{onClick:()=>{_(n?.home)},className:"rounded border px-2 py-1 hover:bg-muted",children:"Home"}),C.jsx("button",{disabled:!n?.parent,onClick:()=>{_(n?.parent??void 0)},className:"rounded border px-2 py-1 hover:bg-muted disabled:opacity-40",children:"Up"}),C.jsxs("nav",{"aria-label":"Directory breadcrumbs",className:"flex min-w-0 max-w-full items-center gap-1 overflow-x-auto whitespace-nowrap",children:[C.jsx("button",{onClick:()=>{_("/")},className:"hover:underline",children:"/"}),N.map((B,I)=>C.jsxs("span",{children:[C.jsx("button",{onClick:()=>{_("/"+N.slice(0,I+1).join("/"))},className:"hover:underline",children:B})," /"]},I))]}),C.jsxs("label",{className:"ml-auto flex items-center gap-1",children:[C.jsx("input",{type:"checkbox",checked:l,onChange:B=>{c(B.target.checked),_(n?.path,B.target.checked)}})," Show hidden"]})]}),g&&C.jsx("p",{role:"alert",className:"text-sm text-red-600",children:g}),C.jsx("div",{"aria-busy":h,className:"max-h-64 overflow-y-auto rounded-lg border",children:h?C.jsx("p",{className:"p-3 text-muted-foreground",children:"Loading directories…"}):n?.entries.length?n.entries.map(B=>C.jsxs("button",{onClick:()=>{_(B.path)},className:"flex w-full items-center gap-2 border-b px-3 py-2 text-left text-sm last:border-0 hover:bg-muted",children:[C.jsx(Ete,{className:"size-4 shrink-0 text-muted-foreground"}),C.jsx("span",{className:"break-all",children:B.name}),B.symlink&&C.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"symlink"})]},B.path)):C.jsx("p",{className:"p-3 text-muted-foreground",children:n?"No directories found.":"Enter a path to browse directories."})}),n?.truncated&&C.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory list truncated."}),n&&C.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[C.jsx("p",{className:"flex-1 text-xs text-muted-foreground",children:n.loopable?"Git repository ready for loops.":"Not a git repository with a commit. You can open it, but loops need git to be ready."}),C.jsx("button",{disabled:h||f||a!==n.path,onClick:()=>{S(n.path)},className:"rounded-md bg-foreground px-4 py-2 text-xs font-medium text-background disabled:opacity-40",children:f?"Opening…":"Open workspace"})]})]})]})})}function oze(e){const t=[];let r="",n=null;for(let i=0;i<e.length;i++){const a=e[i];n?(r+=a,a===n&&(n=null)):a==='"'||a==="'"?(n=a,r+=a):(a==="&"||a==="|")&&e[i+1]===a?(t.push(r),r="",i++):a===";"||a==="|"?(t.push(r),r=""):r+=a}return t.push(r),t.filter(i=>i.trim())}function bP(e){const t=[],r=/"([^"]*)"|'([^']*)'|(\S+)/g;let n;for(;n=r.exec(e);)t.push(n[1]??n[2]??n[3]);return t}const xP=e=>/\s/.test(e)?`"${e}"`:e,lze=e=>/^\d*[<>]/.test(e)||/^\d*>&\d*$/.test(e);function _Z(e){const t=[];for(const r of oze(e)){const n=bP(r.trim()),i=n.indexOf("factory"),a=n[i+1];if(i<0||!a||a.startsWith("-"))continue;const s=n.slice(i+2).filter(l=>!lze(l));t.push({sub:a,detail:s.map(xP).join(" ")})}return t.length?{sub:t[0].sub,detail:t[0].detail,extra:t.length-1}:{detail:bP(e.trim()).map(xP).join(" "),extra:0}}function cze(e){const t=e.map(n=>_Z(n.cmd));if(e.length<=2)return t.map(n=>(n.sub??n.detail.split(" ")[0])+(n.sub&&n.detail?` ${n.detail.split(" ")[0]}`:"")).join(" · ");const r=new Map;for(const n of t){const i=n.sub??n.detail.split(" ")[0];r.set(i,(r.get(i)??0)+1)}return[...r].map(([n,i])=>i>1?`${n} ×${i}`:n).join(" · ")}function uze({cmd:e,out:t,running:r,open:n}){const[i,a]=$.useState(!!n),{sub:s,detail:l,extra:c}=_Z(e);return C.jsxs("li",{children:[C.jsxs("button",{type:"button","aria-expanded":i,title:e,onClick:()=>a(!i),className:"grid w-full grid-cols-[1fr_auto] items-center gap-2.5 px-3 py-1.5 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50 focus-visible:outline-none",children:[C.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:s?C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"shrink-0 font-mono text-[12px] text-muted-foreground/70",children:"factory"}),C.jsx("span",{className:"shrink-0 font-mono text-[12px] font-medium text-foreground",children:s}),l&&C.jsx("span",{className:"truncate text-[12.5px] text-muted-foreground",children:l})]}):C.jsx("span",{className:"truncate font-mono text-[12px] text-muted-foreground",children:l})}),C.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[c>0&&C.jsxs("span",{title:`${c} more command${c===1?"":"s"} in this call`,className:"rounded bg-muted px-1 font-mono text-[10px] leading-4 text-muted-foreground",children:["+",c]}),r&&C.jsxs("span",{className:"flex items-center gap-1 text-[11px] font-medium text-blue-600",children:[C.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-blue-500"}),"running"]}),C.jsx(Zw,{className:`size-3.5 text-muted-foreground/40 transition-transform ${i?"rotate-90":""}`})]})]}),i&&C.jsxs("div",{className:"border-t border-border/70 px-3 pb-2.5 pt-1.5",children:[C.jsxs("div",{className:"flex items-start gap-1.5 font-mono text-[11px] leading-4 text-muted-foreground",children:[C.jsx("span",{className:"select-none text-muted-foreground/40",children:"$"}),C.jsx("span",{className:"min-w-0 break-all",children:e})]}),t?C.jsx("pre",{className:"mt-1.5 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted px-2.5 py-2 font-mono text-[11px] leading-5 text-foreground/80",children:t}):r?C.jsx("div",{className:"mt-1 text-[11px] italic text-muted-foreground/60",children:"waiting for output…"}):null]})]})}function vP({calls:e,defaultOpen:t}){const[r,n]=$.useState(!0);if(!e.length)return null;const i=e.filter(a=>a.running).length;return C.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card text-[13px]",children:[C.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>n(!r),className:"flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50 focus-visible:outline-none",children:[C.jsx(zte,{className:"size-3.5 shrink-0 text-muted-foreground/60"}),C.jsxs("span",{className:"shrink-0 text-[12px] font-medium text-foreground/80",children:[e.length," tool call",e.length===1?"":"s"]}),C.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground/70",children:cze(e)}),i>0&&C.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[11px] font-medium text-blue-600",children:[C.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-blue-500"}),i," running"]}),C.jsx(Zw,{className:`size-3.5 shrink-0 text-muted-foreground/40 transition-transform ${r?"rotate-90":""}`})]}),r&&C.jsx("ul",{className:"divide-y divide-border/70 border-t border-border/70",children:e.map((a,s)=>C.jsx(uze,{...a,open:s===t},s))})]})}function SZ(e){const t=$.useRef(null);return $.useEffect(()=>{if(!e||!t.current)return;const n=document.activeElement,i=n?.closest("dialog"),a=n?.closest("[data-choice-navigation]");n instanceof HTMLElement&&(n.matches("input, textarea, select")&&!n.matches("textarea[data-choice-ready=true]")||n.isContentEditable)||i&&!i.contains(t.current)||a&&a!==t.current||t.current.querySelector("button:not(:disabled)")?.focus()},[e]),{ref:t,onKeyDown:n=>{if(!e||n.nativeEvent.isComposing||n.altKey||n.ctrlKey||n.metaKey||!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;const i=[...n.currentTarget.querySelectorAll("button:not(:disabled)")],a=i.indexOf(n.target);if(a<0)return;n.preventDefault();const s=n.key==="Home"?0:n.key==="End"?i.length-1:(a+(n.key==="ArrowDown"?1:-1)+i.length)%i.length;i[s]?.focus()},"data-choice-navigation":""}}function hze({dialog:e,onAnswer:t}){const[r,n]=$.useState(e.value??e.prefill??""),[i,a]=$.useState(!1),[s,l]=$.useState(""),c=$.useRef(!1),h=SZ(e.method==="select"||e.method==="confirm"?e.id:void 0),d=async g=>{if(!c.current){c.current=!0,a(!0),l("");try{await t(g)}catch(b){c.current=!1,a(!1),l(b instanceof Error?b.message:"Could not send your answer. Please try again.")}}},f=e.options??[],m=String(e.title??e.message??"").split(`
|
|
899
|
+
`).map((t,r)=>{const n=t.match(/^([A-Z]):\s+(.*)$/),i=t.match(/^([A-Za-z][A-Za-z ]{0,9}:)\s+(.*)$/);return C.jsx("p",{className:"flex items-start gap-1.5",children:n?C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-md bg-neutral-100 text-[11px] font-medium text-neutral-500",children:n[1]}),C.jsx("span",{className:"min-w-0",children:n[2]})]}):i?C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"font-medium text-neutral-700",children:i[1]}),C.jsx("span",{className:"min-w-0",children:i[2]})]}):C.jsx("span",{children:t})},r)})})}function Q$e({runName:e,q:t,onAnswer:r,onOpen:n,compare:i}){const[a,s]=$.useState(null),l=t.answered?.i!=null?t.options[t.answered.i]?.label:void 0;if(!t.answered&&(t.superseded||t.expired))return C.jsxs("div",{className:"text-[13px] leading-5 text-muted-foreground",children:[C.jsx("button",{onClick:n,className:"font-medium underline-offset-2 hover:underline",children:e})," · ",t.text,C.jsx("span",{className:"block text-xs",children:t.superseded?`Superseded — ${t.superseded}`:"Expired — decision deadline passed."})]});if(t.answered)return C.jsxs("div",{className:"flex items-start gap-1.5 text-[13px] leading-5 text-muted-foreground",children:[C.jsx($0,{className:"mt-0.5 size-3.5 shrink-0 text-neutral-400"}),C.jsxs("p",{className:"min-w-0",children:[C.jsx("button",{onClick:n,className:"font-medium text-neutral-600 underline-offset-2 hover:text-foreground hover:underline",children:e}),C.jsx("span",{className:"text-neutral-300",children:" · "}),t.text.replace(/ (Which|What|Was).*$/,""),C.jsx("span",{className:"text-neutral-300",children:" → "}),C.jsx("span",{className:"font-medium text-neutral-700",children:l??t.answered.auto})]})]});const{pre:c,ask:h,post:d}=X$e(t.text);return C.jsxs("div",{className:"rounded-xl border border-neutral-200 border-l-2 border-l-amber-400 bg-white shadow-sm",children:[C.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2",children:[C.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-amber-500"}),C.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-neutral-500",children:"Needs you"}),C.jsxs("button",{onClick:n,className:"-my-1 ml-auto -mr-1 flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] text-neutral-500 transition hover:bg-neutral-100 hover:text-neutral-900",children:[e,t.round?` · round ${t.round}`:"",C.jsx(OP,{className:"size-3"})]})]}),C.jsxs("div",{className:"px-3.5 pb-3",children:[c&&C.jsx("p",{className:"text-[13px] leading-5 text-neutral-500",children:c}),C.jsx("p",{className:`${c?"mt-1":""} text-sm font-medium leading-5 text-neutral-900`,children:h}),d&&C.jsx("p",{className:"mt-1 text-[13px] leading-5 text-neutral-500",children:d}),!i&&t.detail&&C.jsx(K$e,{text:t.detail}),i?.(a,f=>{s(f),r(f)})]}),!i&&C.jsx("div",{className:"flex flex-col gap-1 border-t border-neutral-100 px-3.5 py-2.5",children:t.options.map((f,m)=>C.jsxs("button",{disabled:a!=null,onClick:()=>{s(m),r(m)},className:`flex min-h-9 w-full items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm font-medium transition disabled:opacity-50 ${m===0?"bg-neutral-950 text-white hover:bg-neutral-800":"border border-neutral-200 bg-white text-neutral-900 hover:bg-neutral-50"}`,children:[C.jsx("span",{className:`flex size-5 shrink-0 items-center justify-center rounded-md text-[11px] font-medium ${m===0?"bg-white/15 text-white":"bg-neutral-100 text-neutral-500"}`,children:Y$e[m]}),C.jsx("span",{className:"min-w-0 flex-1",children:a===m?"…":f.label}),m===0&&C.jsx("span",{className:"shrink-0 text-[10px] font-normal uppercase tracking-wide text-white/60",children:"Suggested"})]},m))})]})}const $E=(e,t)=>{const r=e.rounds.find(n=>n.n===t.round)?.attempts??[];return r.find(n=>n.name===t.label)??r.find(n=>n.style===String(t.label??"").replace(/^R\d+-/,""))},zE=(e,t)=>{const r=e.rounds.find(i=>i.n===t.round);return r?.attempts.find(i=>(i.kept||i.humanPick)&&!i.name?.includes(String(t.label??"#")))??r?.attempts.find(i=>(i.kept||i.humanPick)&&!i.vetoed)};function Z$e({run:e,q:t,busy:r,onPick:n,onOpenAttempt:i}){const a=e.rounds.find(d=>d.n===t.round),s=$E(e,t),l=zE(e,t);if(!a||!s)return null;const c=l?.score??a.current?.score,h=[{key:"kept",title:l?l.model:a.from.round>0?`R${a.from.round} ${a.from.label}`:"the original",tag:l?"kept now":"before this round",time:c,ok:!0,note:l?.review?.note??a.current?.reason??"the version this round started from",open:l?.name,i:0,btn:"Reviewer was right"},{key:"rej",title:s.model,tag:"rejected by review",time:s.bench?.value??s.score,ok:!1,note:s.review?.note,open:s.name,i:1,btn:`Use ${s.label} anyway`}];return C.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2.5",children:h.map(d=>C.jsxs("div",{className:"flex min-w-0 flex-col rounded-lg border bg-background p-2.5",children:[C.jsxs("div",{className:"flex items-baseline gap-1.5 text-sm",children:[C.jsx("span",{className:"font-medium",children:d.title}),C.jsx("span",{className:`text-[11px] ${d.ok?"text-muted-foreground":"text-red-600"}`,children:d.tag})]}),C.jsxs("div",{className:"mt-1.5 flex items-baseline gap-2",children:[C.jsx("span",{className:"font-mono text-xl font-semibold",children:TZ(e,d.time)}),d.time!=null&&e.baseline&&Math.abs(Math.log(d.time/e.baseline))>.05&&C.jsx("span",{className:"font-mono text-[11px] text-muted-foreground",children:cv(e,d.time)})]}),d.note&&C.jsxs("p",{className:`mt-1 line-clamp-3 text-xs leading-snug ${d.ok?"text-muted-foreground":"text-red-700/80"}`,children:[d.ok?"":"Reviewer: ",d.note]}),d.open&&C.jsx("button",{onClick:()=>i(d.open),className:"mb-2 mt-1.5 w-fit text-[11px] text-muted-foreground underline decoration-dotted underline-offset-2 hover:text-foreground",children:"see the code change →"}),C.jsx("button",{disabled:r!=null,onClick:()=>n(d.i),className:`mt-auto min-h-9 translate-y-0 rounded-md border text-xs font-medium transition disabled:opacity-50 ${d.i===0?"border-foreground bg-foreground text-background hover:opacity-90":"bg-background hover:bg-muted"}`,children:r===d.i?"…":d.btn})]},d.key))})}function J$e({run:e,q:t,busy:r,onPick:n,onOpenAttempt:i}){const a=e.rounds.find(h=>h.n===t.round),s=zE(e,t),l=$E(e,t);if(!a||!s||!l||!s.shot||!l.shot)return null;const c=[{a:s,i:0,tag:"kept now"},{a:l,i:1,tag:"runner-up"}];return C.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2.5",children:c.map(({a:h,i:d,tag:f})=>C.jsxs("div",{className:"flex min-w-0 flex-col rounded-lg border bg-background p-1.5",children:[C.jsxs("button",{onClick:()=>i(h.name),title:"Open this version",className:"group relative block aspect-[16/10] overflow-hidden rounded-md border bg-muted",children:[C.jsx("img",{src:h.shot,alt:"",className:"h-full w-full object-cover object-top transition group-hover:scale-[1.02]"}),C.jsx("span",{className:"absolute left-1.5 top-1.5 flex size-5 items-center justify-center rounded-md bg-foreground text-[11px] font-semibold text-background",children:h.label})]}),C.jsxs("div",{className:"mt-1.5 flex items-baseline gap-1.5 px-0.5 text-sm",children:[C.jsx("span",{className:"font-medium",children:h.model}),C.jsx("span",{className:"text-[11px] text-muted-foreground",children:f}),C.jsx("span",{className:"ml-auto font-mono text-xs",children:TZ(e,h.score)})]}),h.reason&&C.jsx("p",{className:"mt-0.5 line-clamp-2 px-0.5 text-xs leading-snug text-muted-foreground",children:h.reason}),C.jsx("button",{disabled:r!=null,onClick:()=>n(d),className:`mt-2 min-h-9 rounded-md border text-xs font-medium transition disabled:opacity-50 ${d===0?"border-foreground bg-foreground text-background hover:opacity-90":"bg-background hover:bg-muted"}`,children:r===d?"…":d===0?`Keep ${h.label}`:`Switch to ${h.label}`})]},h.name))})}function yP({run:e,q:t,onAnswer:r,onOpen:n,onOpenAttempt:i}){const a=$E(e,t),s=zE(e,t),l=e.rounds.find(d=>d.n===t.round),c=!t.answered&&t.kind==="veto"&&e.kind==="bench"&&!!a&&l?.attempts.some(d=>d.kept||d.humanPick),h=!t.answered&&t.kind==="close"&&!!a?.shot&&!!s?.shot;return C.jsx(Q$e,{runName:e.name,q:t,onAnswer:r,onOpen:n,compare:c?(d,f)=>C.jsx(Z$e,{run:e,q:t,busy:d,onPick:f,onOpenAttempt:i}):h?(d,f)=>C.jsx(J$e,{run:e,q:t,busy:d,onPick:f,onOpenAttempt:i}):void 0})}function of({title:e,onClose:t,children:r,variant:n="default"}){const i=$.useRef(null);return $.useEffect(()=>{const a=i.current,s=document.activeElement instanceof HTMLElement?document.activeElement:null;return a?.showModal(),a?.querySelector("[data-dialog-autofocus]")?.focus(),()=>{a?.close();const l=document.activeElement;s?.isConnected&&(!l||l===document.body||a?.contains(l))&&s.focus({preventScroll:!0})}},[]),C.jsx("dialog",{ref:i,"data-dialog-variant":n,onKeyDown:a=>{a.key==="Escape"&&a.stopPropagation()},onCancel:a=>{a.preventDefault(),t()},onClick:a=>{a.target===a.currentTarget&&t()},"aria-label":e,className:`overflow-y-auto border bg-background p-0 text-foreground shadow-2xl backdrop:bg-black/30 ${n==="sheet"?"fixed inset-y-0 right-0 left-auto m-0 h-dvh max-h-dvh w-[min(26.25rem,100%)] border-y-0 border-r-0":"m-auto max-h-[85dvh] w-[min(36rem,calc(100%-2rem))] rounded-xl"}`,children:n==="palette"?r:C.jsxs("div",{className:"p-5",children:[C.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[C.jsx("h2",{className:"font-semibold",children:e}),C.jsx("button",{onClick:t,"aria-label":`Close ${e}`,className:"rounded px-2 py-1 text-muted-foreground hover:bg-muted",children:"✕"})]}),r]})})}const eze=["serve","check","bench","attempts","rounds","timeoutMin","tokenBudget","judgeSamples","judgePairs"],tze=new Set(["serve","check","bench","metric","protect"]),ak=e=>e==null?"—":typeof e=="object"?JSON.stringify(e):String(e);function rze({chat:e,onClose:t,onPrompt:r,onProviders:n}){const[i,a]=$.useState(null),[s,l]=$.useState(!0),[c,h]=$.useState({}),d=$.useRef(new Set),[f,m]=$.useState({}),[g,b]=$.useState(null),[x,k]=$.useState(null),[w,_]=$.useState(!1),[S,N]=$.useState(null),B=$.useCallback(async()=>{l(!0);try{const O=await zr(`/api/config?chat=${encodeURIComponent(e)}`);if(O.error)throw new Error(O.error);a(O.keys??[])}catch(O){N(O instanceof Error?O.message:String(O))}finally{l(!1)}},[e]);$.useEffect(()=>{B()},[B]);const I=async O=>{const X=f[O];if(X===void 0||d.current.has(O))return;d.current.add(O),h(Z=>({...Z,[O]:!0})),N(null);let j=X.trim();["attempts","rounds","timeoutMin","judgeSamples","judgePairs"].includes(O)&&(j=X.trim()===""?null:Number(X)),O==="tokenBudget"&&(j=X.trim()===""?null:X.trim());try{const Z=await zr("/api/config",{method:"POST",json:{chat:e,key:O,value:j}});if(!Z.ok)throw new Error(Z.error||"Could not save this setting.");m(se=>{if(se[O]!==X)return se;const ue={...se};return delete ue[O],ue}),await B()}catch(Z){N(Z instanceof Error?Z.message:String(Z))}finally{d.current.delete(O),h(Z=>({...Z,[O]:!1}))}},P=async()=>{_(!0),b(null),k(null);try{const O=await zr("/api/doctor",{method:"POST",json:{chat:e}});b(O.checks??[]),k(O.verdict??null)}catch(O){N(String(O))}_(!1)};return C.jsxs(of,{title:"Loop settings",variant:"sheet",onClose:t,children:[S&&C.jsx("div",{role:"alert",className:"mb-3 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[12px] text-red-700",children:S}),C.jsxs("div",{className:"mb-4 rounded-xl border p-3",children:[C.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[C.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Can this repo run a round?"}),C.jsxs("button",{onClick:P,disabled:w,className:"ml-auto inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] hover:bg-muted disabled:opacity-50",children:[C.jsx(Ote,{className:`size-3 ${w?"animate-spin":""}`})," ",w?"checking…":"run checks"]})]}),x&&C.jsx("div",{className:`mb-2 rounded-md px-2 py-1 text-[11px] font-medium ${x==="ready"?"bg-emerald-50 text-emerald-700":x==="will-fail"?"bg-red-50 text-red-700":"bg-amber-50 text-amber-800"}`,children:x==="ready"?"ready":x==="will-fail"?"a round would fail":"running, but blind in places"}),!g&&!w&&C.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Boots the app, runs the tests, and asks the judge to read a code off a generated image."}),(g??[]).map(O=>C.jsxs("div",{className:"mt-1.5 flex items-start gap-1.5 text-[12px] leading-5",children:[O.ok?C.jsx($0,{className:"mt-0.5 size-3.5 shrink-0 text-emerald-600"}):C.jsx(Gh,{className:"mt-0.5 size-3.5 shrink-0 text-red-500"}),C.jsxs("span",{className:"min-w-0",children:[C.jsx("span",{className:O.ok?"text-foreground":"font-medium text-foreground",children:O.name}),C.jsxs("span",{className:"text-muted-foreground",children:[" — ",O.detail]}),O.ms>0&&C.jsxs("span",{className:"ml-1 font-mono text-[10px] text-muted-foreground/70",children:[O.ms,"ms"]})]})]},O.name))]}),C.jsxs("div",{className:"mb-4 rounded-xl border p-3",children:[C.jsx("div",{className:"mb-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Provider connections"}),C.jsx("p",{className:"mb-2 text-[12px] leading-5 text-muted-foreground",children:"Pi owns provider connections and credentials on the connected server. Connect with OAuth or an API key in the provider dialog; this does not change chat or loop models."}),C.jsx("button",{onClick:n,className:"rounded-md border px-3 py-1.5 text-xs hover:bg-muted",children:"Manage providers"})]}),C.jsx("div",{className:"mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"In force"}),s&&C.jsx("p",{role:"status",className:"mb-2 text-xs text-muted-foreground",children:"Loading settings…"}),!s&&i===null&&C.jsx("button",{onClick:()=>{B()},className:"mb-2 text-xs underline",children:"Retry loading settings"}),C.jsx("div",{className:"divide-y rounded-xl border",children:(i??[]).map(O=>C.jsxs("div",{className:"px-3 py-2",children:[C.jsxs("div",{className:"flex items-baseline gap-2",children:[C.jsx("span",{className:`font-mono text-[12px] ${tze.has(O.key)?"text-foreground":"text-muted-foreground"}`,children:O.key}),C.jsx("span",{className:`rounded px-1 text-[10px] ${O.source==="project"?"bg-foreground/10 text-foreground":O.source==="user"?"bg-muted text-muted-foreground":"text-muted-foreground/70"}`,children:O.source}),O.key==="models"&&C.jsx("button",{onClick:()=>r("/loop models"),className:"ml-auto rounded-md border px-2 py-0.5 text-[11px] hover:bg-muted",title:"The engine asks for each role in turn",children:"pick…"})]}),O.key==="models"?C.jsx("div",{className:"mt-1 space-y-0.5",children:Object.entries(O.value??{}).filter(([X])=>X!=="pool").map(([X,j])=>C.jsxs("div",{className:"flex gap-2 text-[12px]",children:[C.jsx("span",{className:"w-12 shrink-0 text-muted-foreground",children:X}),C.jsx("span",{className:"truncate font-mono",children:ak(j)})]},X))}):eze.includes(O.key)?C.jsxs("div",{className:"mt-1 flex gap-1.5",children:[C.jsx("input",{"aria-label":`${O.key} setting`,value:f[O.key]??ak(O.value),onChange:X=>m(j=>({...j,[O.key]:X.target.value})),onKeyDown:X=>{X.key==="Enter"&&I(O.key)},placeholder:O.key==="tokenBudget"?"e.g. 800k":"",className:"min-w-0 flex-1 rounded-md border bg-background px-2 py-1 font-mono text-[12px] outline-none focus-visible:ring-1 focus-visible:ring-foreground/20"}),f[O.key]!==void 0&&C.jsx("button",{"aria-label":`Save ${O.key}`,disabled:c[O.key],onClick:()=>{I(O.key)},className:"rounded-md bg-foreground px-2 py-1 text-[11px] font-medium text-background disabled:opacity-50",children:c[O.key]?"saving…":"save"})]}):C.jsx("div",{className:"mt-0.5 break-words font-mono text-[12px] text-muted-foreground",children:ak(O.value)})]},O.key))}),C.jsxs("p",{className:"mt-3 text-[11px] leading-4 text-muted-foreground",children:["Written to ",C.jsx("span",{className:"font-mono",children:".pi/loops.json"})," (this repo). Your defaults live in ",C.jsx("span",{className:"font-mono",children:"~/.pi/agent/loops.json"}),". Models are picked by the engine so a judge can never be a model that cannot see."]})]})}function nze({workspaces:e,active:t,onSwitch:r,onAdd:n,onRemove:i,hrefForWorkspace:a,launcherHref:s="/workspaces"}){const l=$.useRef(null),c=e.map(h=>`${h.id}:${h.title}:${h.path}:${h.available}`).join("\0");return $.useEffect(()=>{l.current?.querySelector('[aria-current="page"]')?.scrollIntoView({block:"nearest",inline:"nearest"})},[t,c]),C.jsxs("nav",{ref:l,"aria-label":"Workspaces",className:"flex min-h-9 min-w-0 shrink-0 items-stretch gap-0 overflow-x-auto border-b bg-muted/20 [scrollbar-width:thin]",children:[e.map(h=>{const d=h.id===t;return C.jsxs("div",{className:Qo("group/tab relative flex min-w-0 shrink-0 items-center",d?"bg-background":"hover:bg-muted/50"),children:[C.jsx(Ga,{href:a?.(h.id)??"#",onNavigate:()=>r(h.id),disabled:h.available===!1,title:h.available===!1?`${h.path} (unavailable)`:h.path,"aria-current":d?"page":void 0,className:Qo("flex h-9 min-w-0 max-w-[220px] items-center gap-1.5 pl-3 text-[12px] transition-colors",e.length>1?"pr-2":"pr-3",d?"font-medium text-foreground":"text-muted-foreground","aria-disabled:opacity-40"),children:C.jsxs("span",{className:"truncate",children:[h.title,e.some(f=>f.id!==h.id&&f.title===h.title)?` · ${h.path.split("/").filter(Boolean).slice(-2,-1)[0]??"/"}`:"",h.available===!1?" · unavailable":""]})}),C.jsx("button",{onClick:()=>i(h.id),title:`Close ${h.title} (its loops stay on disk)`,"aria-label":`Close ${h.title}`,className:"-ml-0.5 mr-1.5 rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-red-600",children:C.jsx(Gh,{className:"size-3"})}),d&&C.jsx("span",{className:"absolute inset-x-0 -bottom-px h-[2px] bg-foreground","aria-hidden":!0})]},h.id)}),C.jsx(Ga,{href:s,onNavigate:n,title:"Open workspace","aria-label":"Open workspace",className:"flex h-9 w-9 shrink-0 items-center justify-center text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:C.jsx(rF,{className:"size-3.5"})})]})}function ize(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.path=="string"&&(typeof t.parent=="string"||t.parent===null)&&typeof t.home=="string"&&typeof t.truncated=="boolean"&&typeof t.loopable=="boolean"&&Array.isArray(t.entries)&&t.entries.every(r=>{if(!r||typeof r!="object")return!1;const n=r;return typeof n.name=="string"&&typeof n.path=="string"&&typeof n.symlink=="boolean"})}function aze(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&!!t.id&&typeof t.path=="string"&&typeof t.title=="string"&&typeof t.sessionDir=="string"}function sze({workspaces:e,onOpen:t,hrefForWorkspace:r}){const[n,i]=$.useState(null),[a,s]=$.useState(""),[l,c]=$.useState(!1),[h,d]=$.useState(!1),[f,m]=$.useState(!1),[g,b]=$.useState(null),x=$.useRef(0),k=$.useRef(!0),w=eo()||location.origin,_=async(B,I=l)=>{const P=++x.current;d(!0),b(null);try{const O=new URLSearchParams;B&&O.set("path",B),I&&O.set("hidden","1");const X=await zr(`/api/directories?${O}`);if(!ize(X))throw new Error("The server returned an invalid directory response. The server may be outdated; restart the Loops server and try again.");P===x.current&&(i(X),s(X.path))}catch(O){P===x.current&&(i(null),B!==void 0&&s(B),b(O instanceof Error?O.message:String(O)))}finally{P===x.current&&d(!1)}};$.useEffect(()=>(k.current=!0,_(),()=>{k.current=!1,x.current++}),[]);const S=async B=>{m(!0),b(null);try{const I=await zr("/api/workspaces",{method:"POST",json:{path:B}});if(!I?.ok)throw new Error(I?.error||"Unable to open workspace");if(!aze(I.workspace))throw new Error("The server returned an invalid workspace response. Restart the Loops server and try again.");k.current&&t(I.workspace)}catch(I){k.current&&b(I instanceof Error?I.message:String(I))}finally{k.current&&m(!1)}},N=n?.path.split("/").filter(Boolean)??[];return C.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:C.jsxs("div",{className:"mx-auto max-w-3xl space-y-6 px-6 py-8",children:[C.jsxs("div",{children:[C.jsx("h1",{className:"text-xl font-semibold",children:"Open a workspace"}),C.jsxs("p",{className:"mt-1 text-muted-foreground",children:["Choose a directory on ",C.jsx("span",{className:"font-medium text-foreground break-all",children:w}),". Opening it won't start a chat."]})]}),e.length>0&&C.jsxs("section",{children:[C.jsx("h2",{className:"mb-2 text-sm font-medium",children:"Recent workspaces"}),C.jsx("div",{className:"rounded-lg border",children:e.map(B=>C.jsxs("div",{className:"flex items-center gap-3 border-b p-3 last:border-0",children:[C.jsx(Ste,{className:"size-4 shrink-0 text-muted-foreground"}),C.jsxs("div",{className:"min-w-0 flex-1",children:[C.jsxs("div",{className:"font-medium",children:[B.title,B.open!==!1&&C.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:"Open"}),B.available===!1&&C.jsx("span",{className:"ml-2 text-xs text-amber-700",children:"Unavailable"})]}),C.jsx("div",{className:"break-all text-xs text-muted-foreground",children:B.path})]}),C.jsx(Ga,{href:r?.(B.id)??"#",disabled:B.available===!1||f,onNavigate:()=>{S(B.path)},className:"rounded-md border px-3 py-1.5 text-xs hover:bg-muted aria-disabled:opacity-40",children:"Open"})]},B.id))})]}),C.jsxs("section",{className:"space-y-3",children:[C.jsx("h2",{className:"font-medium",children:"Browse directories"}),C.jsxs("form",{onSubmit:B=>{if(B.preventDefault(),!a.trim()){x.current++,d(!1),i(null),b("Enter a directory path.");return}_(a.trim())},className:"flex gap-2",children:[C.jsx("label",{htmlFor:"workspace-path",className:"sr-only",children:"Directory path"}),C.jsx("input",{id:"workspace-path",value:a,onChange:B=>s(B.target.value),placeholder:"Absolute path or ~",className:"min-w-0 flex-1 rounded-md border bg-background px-3 py-2 font-mono text-xs"}),C.jsx("button",{className:"rounded-md border px-3 text-xs hover:bg-muted",children:"Go"})]}),C.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[C.jsx("button",{onClick:()=>{_(n?.home)},className:"rounded border px-2 py-1 hover:bg-muted",children:"Home"}),C.jsx("button",{disabled:!n?.parent,onClick:()=>{_(n?.parent??void 0)},className:"rounded border px-2 py-1 hover:bg-muted disabled:opacity-40",children:"Up"}),C.jsxs("nav",{"aria-label":"Directory breadcrumbs",className:"flex min-w-0 max-w-full items-center gap-1 overflow-x-auto whitespace-nowrap",children:[C.jsx("button",{onClick:()=>{_("/")},className:"hover:underline",children:"/"}),N.map((B,I)=>C.jsxs("span",{children:[C.jsx("button",{onClick:()=>{_("/"+N.slice(0,I+1).join("/"))},className:"hover:underline",children:B})," /"]},I))]}),C.jsxs("label",{className:"ml-auto flex items-center gap-1",children:[C.jsx("input",{type:"checkbox",checked:l,onChange:B=>{c(B.target.checked),_(n?.path,B.target.checked)}})," Show hidden"]})]}),g&&C.jsx("p",{role:"alert",className:"text-sm text-red-600",children:g}),C.jsx("div",{"aria-busy":h,className:"max-h-64 overflow-y-auto rounded-lg border",children:h?C.jsx("p",{className:"p-3 text-muted-foreground",children:"Loading directories…"}):n?.entries.length?n.entries.map(B=>C.jsxs("button",{onClick:()=>{_(B.path)},className:"flex w-full items-center gap-2 border-b px-3 py-2 text-left text-sm last:border-0 hover:bg-muted",children:[C.jsx(Ete,{className:"size-4 shrink-0 text-muted-foreground"}),C.jsx("span",{className:"break-all",children:B.name}),B.symlink&&C.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"symlink"})]},B.path)):C.jsx("p",{className:"p-3 text-muted-foreground",children:n?"No directories found.":"Enter a path to browse directories."})}),n?.truncated&&C.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory list truncated."}),n&&C.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[C.jsx("p",{className:"flex-1 text-xs text-muted-foreground",children:n.loopable?"Git repository ready for loops.":"Not a git repository with a commit. You can open it, but loops need git to be ready."}),C.jsx("button",{disabled:h||f||a!==n.path,onClick:()=>{S(n.path)},className:"rounded-md bg-foreground px-4 py-2 text-xs font-medium text-background disabled:opacity-40",children:f?"Opening…":"Open workspace"})]})]})]})})}function oze(e){const t=[];let r="",n=null;for(let i=0;i<e.length;i++){const a=e[i];n?(r+=a,a===n&&(n=null)):a==='"'||a==="'"?(n=a,r+=a):(a==="&"||a==="|")&&e[i+1]===a?(t.push(r),r="",i++):a===";"||a==="|"?(t.push(r),r=""):r+=a}return t.push(r),t.filter(i=>i.trim())}function bP(e){const t=[],r=/"([^"]*)"|'([^']*)'|(\S+)/g;let n;for(;n=r.exec(e);)t.push(n[1]??n[2]??n[3]);return t}const xP=e=>/\s/.test(e)?`"${e}"`:e,lze=e=>/^\d*[<>]/.test(e)||/^\d*>&\d*$/.test(e);function _Z(e){const t=[];for(const r of oze(e)){const n=bP(r.trim()),i=n.indexOf("factory"),a=n[i+1];if(i<0||!a||a.startsWith("-"))continue;const s=n.slice(i+2).filter(l=>!lze(l));t.push({sub:a,detail:s.map(xP).join(" ")})}return t.length?{sub:t[0].sub,detail:t[0].detail,extra:t.length-1}:{detail:bP(e.trim()).map(xP).join(" "),extra:0}}function cze(e){const t=e.map(n=>_Z(n.cmd));if(e.length<=2)return t.map(n=>(n.sub??n.detail.split(" ")[0])+(n.sub&&n.detail?` ${n.detail.split(" ")[0]}`:"")).join(" · ");const r=new Map;for(const n of t){const i=n.sub??n.detail.split(" ")[0];r.set(i,(r.get(i)??0)+1)}return[...r].map(([n,i])=>i>1?`${n} ×${i}`:n).join(" · ")}function uze({cmd:e,out:t,running:r,open:n}){const[i,a]=$.useState(!!n),{sub:s,detail:l,extra:c}=_Z(e);return C.jsxs("li",{children:[C.jsxs("button",{type:"button","aria-expanded":i,title:e,onClick:()=>a(!i),className:"grid w-full grid-cols-[1fr_auto] items-center gap-2.5 px-3 py-1.5 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50 focus-visible:outline-none",children:[C.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:s?C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"shrink-0 font-mono text-[12px] text-muted-foreground/70",children:"factory"}),C.jsx("span",{className:"shrink-0 font-mono text-[12px] font-medium text-foreground",children:s}),l&&C.jsx("span",{className:"truncate text-[12.5px] text-muted-foreground",children:l})]}):C.jsx("span",{className:"truncate font-mono text-[12px] text-muted-foreground",children:l})}),C.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[c>0&&C.jsxs("span",{title:`${c} more command${c===1?"":"s"} in this call`,className:"rounded bg-muted px-1 font-mono text-[10px] leading-4 text-muted-foreground",children:["+",c]}),r&&C.jsxs("span",{className:"flex items-center gap-1 text-[11px] font-medium text-blue-600",children:[C.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-blue-500"}),"running"]}),C.jsx(Zw,{className:`size-3.5 text-muted-foreground/40 transition-transform ${i?"rotate-90":""}`})]})]}),i&&C.jsxs("div",{className:"border-t border-border/70 px-3 pb-2.5 pt-1.5",children:[C.jsxs("div",{className:"flex items-start gap-1.5 font-mono text-[11px] leading-4 text-muted-foreground",children:[C.jsx("span",{className:"select-none text-muted-foreground/40",children:"$"}),C.jsx("span",{className:"min-w-0 break-all",children:e})]}),t?C.jsx("pre",{className:"mt-1.5 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted px-2.5 py-2 font-mono text-[11px] leading-5 text-foreground/80",children:t}):r?C.jsx("div",{className:"mt-1 text-[11px] italic text-muted-foreground/60",children:"waiting for output…"}):null]})]})}function vP({calls:e,defaultOpen:t}){const[r,n]=$.useState(!0);if(!e.length)return null;const i=e.filter(a=>a.running).length;return C.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card text-[13px]",children:[C.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>n(!r),className:"flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50 focus-visible:outline-none",children:[C.jsx(zte,{className:"size-3.5 shrink-0 text-muted-foreground/60"}),C.jsxs("span",{className:"shrink-0 text-[12px] font-medium text-foreground/80",children:[e.length," tool call",e.length===1?"":"s"]}),C.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground/70",children:cze(e)}),i>0&&C.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-[11px] font-medium text-blue-600",children:[C.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-blue-500"}),i," running"]}),C.jsx(Zw,{className:`size-3.5 shrink-0 text-muted-foreground/40 transition-transform ${r?"rotate-90":""}`})]}),r&&C.jsx("ul",{className:"divide-y divide-border/70 border-t border-border/70",children:e.map((a,s)=>C.jsx(uze,{...a,open:s===t},s))})]})}function SZ(e){const t=$.useRef(null);return $.useEffect(()=>{if(!e||!t.current)return;const n=document.activeElement,i=n?.closest("dialog"),a=n?.closest("[data-choice-navigation]");n instanceof HTMLElement&&(n.matches("input, textarea, select")&&!n.matches("textarea[data-choice-ready=true]")||n.isContentEditable)||i&&!i.contains(t.current)||a&&a!==t.current||t.current.querySelector("button:not(:disabled)")?.focus()},[e]),{ref:t,onKeyDown:n=>{if(!e||n.nativeEvent.isComposing||n.altKey||n.ctrlKey||n.metaKey||!["ArrowDown","ArrowUp","Home","End"].includes(n.key))return;const i=[...n.currentTarget.querySelectorAll("button:not(:disabled)")],a=i.indexOf(n.target);if(a<0)return;n.preventDefault();const s=n.key==="Home"?0:n.key==="End"?i.length-1:(a+(n.key==="ArrowDown"?1:-1)+i.length)%i.length;i[s]?.focus()},"data-choice-navigation":""}}function hze({dialog:e,onAnswer:t}){const[r,n]=$.useState(e.value??e.prefill??""),[i,a]=$.useState(!1),[s,l]=$.useState(""),c=$.useRef(!1),h=SZ(e.method==="select"||e.method==="confirm"?e.id:void 0),d=async g=>{if(!c.current){c.current=!0,a(!0),l("");try{await t(g)}catch(b){c.current=!1,a(!1),l(b instanceof Error?b.message:"Could not send your answer. Please try again.")}}},f=e.options??[],m=String(e.title??e.message??"").split(`
|
|
900
900
|
`);return C.jsxs("div",{className:"mb-3 rounded-xl border border-amber-200 bg-amber-50/60 p-3 shadow-sm",children:[C.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[C.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-amber-800",children:e.method==="select"?"A decision":e.method==="confirm"?"Confirm":e.method==="editor"?"Read":"Input"}),C.jsx("button",{disabled:i,onClick:()=>{d({cancelled:!0})},className:"rounded p-0.5 text-amber-900/60 hover:bg-amber-100 hover:text-amber-900 disabled:opacity-50",title:"Cancel (esc)",children:C.jsx(Gh,{className:"size-3.5"})})]}),C.jsx("div",{className:"space-y-1 whitespace-pre-wrap font-mono text-[12px] leading-relaxed text-foreground",children:m.map((g,b)=>C.jsx("div",{children:g||" "},b))}),e.method==="input"&&C.jsx("input",{autoFocus:!0,disabled:i,value:r,onChange:g=>n(g.target.value),placeholder:e.placeholder,onKeyDown:g=>{g.key==="Enter"&&d({value:r})},className:"mt-2 w-full rounded-md border bg-background px-2.5 py-1.5 text-sm outline-none focus-visible:ring-1 focus-visible:ring-foreground/20"}),e.method==="editor"&&C.jsx("textarea",{autoFocus:!0,disabled:i,value:r,onChange:g=>n(g.target.value),placeholder:e.placeholder,className:"mt-2 w-full rounded-md border bg-background px-2.5 py-1.5 text-sm outline-none focus-visible:ring-1 focus-visible:ring-foreground/20"}),s&&C.jsxs("p",{role:"alert",className:"mt-2 text-xs text-red-700",children:["Could not send your answer: ",s]}),C.jsxs("div",{...h,className:"mt-2.5 flex flex-wrap gap-1.5 [&>button]:focus-visible:outline-2 [&>button]:focus-visible:outline-offset-2 [&>button]:focus-visible:outline-amber-800",children:[e.method==="confirm"&&C.jsxs(C.Fragment,{children:[C.jsx("button",{disabled:i,onClick:()=>{d({confirmed:!0})},className:"rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background disabled:opacity-50",children:"Yes"}),C.jsx("button",{disabled:i,onClick:()=>{d({confirmed:!1})},className:"rounded-md border px-3 py-1.5 text-xs font-medium hover:bg-muted disabled:opacity-50",children:"No"})]}),f.map((g,b)=>C.jsx("button",{disabled:i,onClick:()=>{d({value:g})},className:`rounded-md px-3 py-1.5 text-xs font-medium disabled:opacity-50 ${b===0?"bg-foreground text-background":"border bg-background hover:bg-muted"}`,children:g},g)),(e.method==="input"||e.method==="editor")&&C.jsx("button",{disabled:i,onClick:()=>{d({value:r})},className:"rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background disabled:opacity-50",children:"Send"})]})]})}function CP({label:e,active:t,title:r,request:n,host:i}){const[a,s]=$.useState(!1),[l,c]=$.useState(""),h=$.useRef(!1),d=$.useRef(!0),f=$.useRef(void 0);$.useEffect(()=>(d.current=!0,()=>{d.current=!1,clearTimeout(f.current)}),[]),$.useEffect(()=>{t||(clearTimeout(f.current),h.current=!1,s(!1),c(""))},[t]);const m=async()=>{if(!(!t||h.current)){h.current=!0,s(!0),c("");try{await n(),d.current&&h.current&&(f.current=setTimeout(()=>{c("Stop was requested, but the session has not confirmed stopping yet. Check the connection or reload to recover the latest state.")},1e4))}catch(b){d.current&&(h.current=!1,s(!1),c(b instanceof Error?b.message:String(b)))}}};if(!t)return null;const g=C.jsxs("div",{className:"min-w-0",children:[C.jsxs("button",{type:"button",onClick:()=>{m()},disabled:!t||a,title:r,"aria-label":e,className:"rounded-md border px-2 py-1 text-xs hover:bg-muted disabled:opacity-40",children:[e,a?" · stopping…":""]}),a&&C.jsx("p",{role:"status",className:"mt-1 text-xs text-muted-foreground",children:"Waiting for session state…"}),l&&C.jsx("p",{role:"alert",className:"mt-1 text-xs text-red-600 [overflow-wrap:anywhere]",children:l})]});return i?tv.createPortal(g,i):null}function dze({chat:e,busy:t,runs:r,host:n,loopHost:i}){return C.jsxs(C.Fragment,{children:[C.jsx(CP,{host:n,label:"Stop response",active:t,title:"Abort this chat's parent turn. Background loops are independent.",request:()=>zr("/api/abort",{method:"POST",signal:AbortSignal.timeout(2e4),json:{chat:e}})}),r.map(a=>C.jsx(CP,{host:i,label:r.filter(s=>s.alive).length===1?"Stop loop":`Stop loop: ${a.name}`,active:a.alive,title:`Stop background loop ${a.id}, not the parent turn. Its worktrees are kept.`,request:()=>zr("/api/steer",{method:"POST",signal:AbortSignal.timeout(2e4),json:{chat:e,run:a.id,action:"stop"}})},a.id))]})}function fze({run:e,event:t}){const r=e.rounds.find(s=>s.n===t.round);if(r?.status==="aborted")return C.jsx("span",{children:"stopped before comparison completed."});if(r?.status==="error")return C.jsx("span",{children:"failed before comparison completed."});if(!t.pick||r?.inProgress||r?.inconclusive||r?.unseen?.length||r?.status==="running")return C.jsx("span",{children:"no completed comparison."});if(t.pick==="CURRENT"){const s=r?.attempts??[],l=[s.filter(c=>c.vetoed).length&&`${s.filter(c=>c.vetoed).length} rejected by review`,s.filter(c=>c.bench&&!c.bench.passed).length&&`${s.filter(c=>c.bench&&!c.bench.passed).length} failed tests`,s.filter(c=>!["done","unchanged","no-change"].includes(c.status)).length&&`${s.filter(c=>!["done","unchanged","no-change"].includes(c.status)).length} didn’t finish`].filter(Boolean);return C.jsx("span",{className:"text-muted-foreground",children:l.length?`nothing accepted (${l.join(", ")}), kept the previous best.`:"no improvement, kept the previous best."})}const n=r?.attempts.find(s=>s.name===t.pick||s.style===t.pick?.replace(/^R\d+-/,""));if(!n)return C.jsxs("span",{children:["recorded selection ",t.pick,"; candidate details unavailable."]});const i=t.scores?.[t.pick],a=cv(e,i);return C.jsxs(C.Fragment,{children:["kept ",n.model,"’s version",i!=null&&C.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[" ",sf(e,i),a&&` · ${a}`]})]})}const kP=()=>({draft:"",revision:0,submitting:!1,pending:[],failures:[]});function pze(e,t,r,n){const i=$.useRef(new Map),[,a]=$.useState(0),s=t?`loops-composer:${JSON.stringify([e,t])}`:null;let l=s?i.current.get(s):void 0;if(s&&!l){l=kP();try{const g=JSON.parse(localStorage.getItem(s)||"null");typeof g?.draft=="string"&&(l.draft=g.draft),Array.isArray(g?.failures)&&(l.failures=g.failures.filter(b=>typeof b?.text=="string"&&typeof b?.error=="string"))}catch{}i.current.set(s,l)}const c=l??kP(),h=(g,b)=>{try{g.draft||g.failures.length?localStorage.setItem(b,JSON.stringify({draft:g.draft,failures:g.failures})):localStorage.removeItem(b)}catch{}a(x=>x+1)},d=g=>{s&&(c.draft=g,c.revision++,h(c,s))},f=async g=>{const b=g??c.draft;if(!s||!t||!b.trim()||r||c.submitting)return;c.submitting=!0,c.pending=[b];const x=c.revision;h(c,s);try{if(n)await n(b);else{if(b.trimStart().startsWith("/"))throw new Error("Slash commands must be selected from Commands before sending.");await zr("/api/prompt",{method:"POST",json:{chat:t,text:b}})}g===void 0&&x===c.revision&&(c.draft="",c.revision++),c.failures=c.failures.filter(k=>k.text!==b)}catch(k){const w={text:b,error:k instanceof Error?k.message:String(k)};c.failures=[...c.failures.filter(_=>_.text!==b),w]}finally{c.submitting=!1,c.pending=[],h(c,s)}},m=g=>{s&&(c.draft.trim()!==g.text&&(c.draft=c.draft?`${c.draft}
|
|
901
901
|
|
|
902
902
|
${g.text}`:g.text,c.revision++),c.failures=c.failures.filter(b=>b!==g),h(c,s))};return{input:c.draft,setInput:d,pending:c.pending,submitting:c.submitting,failures:c.failures,restore:m,send:f}}const mze=[{action:"new",description:"Create a new app chat in the selected workspace"},{action:"model",description:"Choose this chat’s Pi model (not loop attempt models)"},{action:"compact",description:"Confirm session compaction — uses model tokens"},{action:"login",description:"Connect a provider with OAuth or an API key"}];function TP(e,t){let r=e;for(;t.some(n=>n.name===r);)r=`app:${r}`;return r}function gze(e,t,r,n,i=!1){return[...mze.map(({action:a,description:s})=>({id:`app:${a}`,name:TP(a,e),description:e.some(l=>l.name===a)?`${s}. Pi owns /${a}; this app action uses /${TP(a,e)}.`:s,source:"Local app action",action:a,disabled:a==="new"?r?void 0:"Select a workspace first":a!=="login"?t?n?"Wait for work to stop":i?"Complete the agent’s startup questions first":void 0:"Select a chat first":void 0})),...e.map(a=>({id:`pi:${a.source}:${a.name}`,name:a.name,description:a.description||"Run this Pi command",source:a.source==="prompt"?"Pi prompt template":a.source==="skill"?"Pi skill":a.source==="extension"?"Pi extension":`Pi ${a.source}`,command:a,disabled:t?n?"Wait for work to stop":i?"Complete the agent’s startup questions first":void 0:"Select a chat first"}))]}function EZ(e,t){const r=t.replace(/^\//,"").toLowerCase().trim(),n=i=>i.toLowerCase()===r?0:i.toLowerCase().startsWith(r)?1:2;return e.filter(i=>`${i.name} ${i.description} ${i.source}`.toLowerCase().includes(r)).sort((i,a)=>n(i.name)-n(a.name))}function yze(e){const t=/^\/([^\s]+)(?:\s([\s\S]*))?$/.exec(e);return t?{name:t[1],args:t[2]??""}:null}function wP({items:e,query:t,onQuery:r,onChoose:n,onClose:i,loading:a,error:s,onRetry:l,info:c,inline:h=!1,activeIndex:d=0,onActiveIndex:f}){const[m,g]=$.useState(0),b=$.useRef(null),x=EZ(e,t),k=Math.min(h?d:m,Math.max(0,x.length-1));$.useEffect(()=>{g(0)},[t]),$.useEffect(()=>{b.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})},[k]);const w=S=>{if(S.nativeEvent.isComposing||S.altKey||S.ctrlKey||S.metaKey)return;S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),i());const N=S.target,B=N.closest('[role="option"]'),I=[...b.current?.querySelectorAll('[role="option"]')??[]],P=B?I.indexOf(B):k;if((S.key==="ArrowDown"||S.key==="ArrowUp")&&(N.tagName==="INPUT"||B)){S.preventDefault();const O=(P+(S.key==="ArrowDown"?1:-1)+x.length)%(x.length||1);(f??g)(O),B&&I[O]?.focus()}if(S.key==="Enter"){if(N.tagName!=="INPUT"&&!B)return;S.preventDefault();const O=x[P];O&&!O.disabled&&n(O)}},_=C.jsxs("div",{ref:b,className:`w-full overflow-hidden bg-background ${h?"rounded-xl border shadow-xl":""}`,onKeyDown:w,children:[!h&&C.jsxs("div",{className:"flex border-b",children:[C.jsx("input",{autoFocus:!0,"data-dialog-autofocus":!0,role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":"command-list","aria-activedescendant":x[k]?`command-menu-${k}`:void 0,"aria-label":"Search commands",value:t,onChange:S=>r(S.target.value),placeholder:"Search commands…",className:"min-w-0 flex-1 bg-transparent px-4 py-3 outline-none"}),C.jsx("button",{type:"button",onClick:i,className:"px-4 text-muted-foreground","aria-label":"Close commands",children:"Esc"})]}),C.jsx("div",{className:"border-b px-3 py-2 text-xs text-muted-foreground",children:"App actions + this chat’s Pi extensions, prompt templates and skills. Not the full terminal command list."}),c&&C.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:c}),a&&C.jsx("p",{role:"status",className:"p-3 text-xs text-muted-foreground",children:"Loading Pi commands…"}),s&&C.jsxs("div",{role:"alert",className:"p-3 text-xs text-red-600",children:[s," ",C.jsx("button",{type:"button",onClick:l,className:"underline",children:"Retry"})]}),C.jsxs("div",{role:"listbox","aria-label":"Commands",id:h?"slash-commands":"command-list",className:"max-h-[min(50dvh,24rem)] overflow-y-auto p-1",children:[x.map((S,N)=>C.jsxs("button",{id:`command-${h?"slash":"menu"}-${N}`,type:"button",role:"option","aria-selected":N===k,"aria-disabled":!!S.disabled,title:S.disabled,onFocus:()=>(f??g)(N),onMouseEnter:()=>(f??g)(N),onMouseDown:B=>{h&&B.preventDefault()},onClick:()=>{S.disabled||n(S)},className:`block w-full rounded-lg px-3 py-2 text-left ${N===k?"bg-muted":"hover:bg-muted/60"} ${S.disabled?"opacity-50":""}`,children:[C.jsxs("span",{className:"flex flex-wrap items-center gap-x-3",children:[C.jsxs("span",{className:"font-mono text-sm",children:["/",S.name]}),C.jsx("span",{className:"text-[11px] text-muted-foreground",children:S.source})]}),C.jsx("span",{className:"block text-xs text-muted-foreground",children:S.disabled??S.description})]},S.id)),!x.length&&!a&&C.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:"No matching commands. Unknown slash commands are not sent to the model."})]})]});return h?C.jsx("div",{className:"absolute inset-x-0 bottom-full z-30 mb-2",children:_}):C.jsx(of,{title:"Commands",variant:"palette",onClose:i,children:_})}function bze(e,t={}){const r=t.signal?AbortSignal.any([t.signal,AbortSignal.timeout(2e4)]):AbortSignal.timeout(2e4);return zr(e,{...t,signal:r})}function jE(){const e={server:eo(),token:U2()},t=n=>n||location.origin,r=()=>t(eo())===t(e.server)&&U2()===e.token;return async function(i,a={}){if(!r())throw new Error("The connected server changed. Close and reopen this dialog before continuing.");const s=a.signal?AbortSignal.any([a.signal,AbortSignal.timeout(2e4)]):AbortSignal.timeout(2e4),l=await zr(i,{...a,signal:s},e);if(!r())throw new Error("The connected server changed. Close and reopen this dialog before continuing.");return l}}const sk=e=>{try{const t=new URL(e??"");return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password?t.href:void 0}catch{return}};function xze({onClose:e,onConnected:t}){const r=$.useMemo(()=>jE(),[]),n=$.useRef(!0),i=$.useRef(null),[a,s]=$.useState(null),[l,c]=$.useState(""),[h,d]=$.useState(""),[f,m]=$.useState(""),[g,b]=$.useState(!1),[x,k]=$.useState(!0),[w,_]=$.useState(null),[S,N]=$.useState(null),[B,I]=$.useState(0),P=$.useRef(void 0),O=$.useRef(!1),X=$.useRef(new Set),j=$.useRef(t);j.current=t;const Z=q=>{(P.current?.prompt?.id!==q.flow?.prompt?.id||q.flow?.status!=="pending")&&m(""),q.flow&&q.flow.status!=="pending"&&d(""),s(q),P.current=q.flow,c(F=>F||q.providers[0]?.id||"")};$.useEffect(()=>{const q=new AbortController;let pe,F=0;const Ee=async()=>{try{const $e=await r("/api/providers",{signal:q.signal});if(q.signal.aborted)return;Z($e),_(null),$e.flow?.status==="succeeded"&&!X.current.has($e.flow.id)&&(X.current.add($e.flow.id),N("Provider connected. Credentials stored by Pi; not live-verified."),j.current?.()),$e.flow?.status==="pending"&&(++F<300?pe=setTimeout(()=>{Ee()},1500):_("Stopped waiting for login. Check the provider, then Retry status or cancel."))}catch($e){q.signal.aborted||_($e instanceof Error?$e.message:String($e))}finally{q.signal.aborted||k(!1)}};return k(!0),Ee(),()=>{q.abort(),pe&&clearTimeout(pe)}},[B]),$.useEffect(()=>{n.current=!0;const q=new AbortController;return i.current=q,()=>{n.current=!1,q.abort();const pe=P.current;pe?.status==="pending"&&r("/api/providers/cancel",{method:"POST",json:{id:pe.id},keepalive:!0}).catch(()=>{})}},[r]);const se=async(q,pe,F)=>{if(!O.current){O.current=!0,b(!0),_(null),N(null);try{const Ee=q.endsWith("/login")||q.endsWith("/key"),$e=await r(q,{method:"POST",json:pe,...Ee?{}:{signal:i.current?.signal}});if(!n.current){$e.flow?.status==="pending"&&r("/api/providers/cancel",{method:"POST",json:{id:$e.flow.id},keepalive:!0}).catch(()=>{});return}$e.flow&&(P.current?.prompt?.id!==$e.flow.prompt?.id&&m(""),P.current=$e.flow,$e.flow.status==="pending"&&s(ne=>ne&&{...ne,flow:$e.flow})),F(),I(ee=>ee+1)}catch(Ee){n.current&&_(Ee instanceof Error?Ee.message:String(Ee))}finally{O.current=!1,n.current&&b(!1)}}},ue=a?.providers.find(q=>q.id===l),K=a?.flow,W=K?.status==="pending",z=SZ(W&&K.prompt?.type==="select"?`${K.id}:${K.prompt.id}`:void 0),te=sk(K?.authorizationUrl);return C.jsxs(of,{title:"Connect provider",onClose:e,children:[C.jsx("p",{className:"mb-4 text-xs text-muted-foreground",children:"Credentials are stored by Pi on the connected server, not in your browser or chat. Connecting does not change this chat’s model."}),w&&C.jsxs("div",{role:"alert",className:"mb-3 text-sm text-red-600",children:[w," ",C.jsx("button",{disabled:g,onClick:()=>I(q=>q+1),className:"underline",children:"Retry status"})]}),S&&C.jsx("p",{role:"status",className:"mb-3 text-sm",children:S}),x&&!a?C.jsx("p",{role:"status",children:"Loading providers…"}):C.jsxs(C.Fragment,{children:[C.jsxs("label",{className:"block text-xs font-medium",children:["Provider",C.jsx("select",{autoFocus:!0,"data-dialog-autofocus":!0,"aria-label":"Provider",value:l,disabled:g||W,onChange:q=>{c(q.target.value),d(""),N(null)},className:"mt-1 mb-3 block w-full rounded-md border bg-background px-3 py-2 text-sm",children:a?.providers.map(q=>C.jsxs("option",{value:q.id,children:[q.name,q.connected?" — connected":""]},q.id))})]}),ue?.connected&&C.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Pi has credentials for this provider. This is not a live verification."}),ue?.oauth&&C.jsxs("button",{disabled:g||W,onClick:()=>{se("/api/providers/login",{provider:l},()=>{m("")})},className:"mb-3 rounded-md border px-3 py-2 disabled:opacity-40",children:["Start ",ue.name," login"]}),ue?.apiKey&&C.jsxs("form",{onSubmit:q=>{q.preventDefault(),h.trim()&&se("/api/providers/key",{provider:l,key:h.trim()},()=>{d(""),N("Key submitted. Finish any provider prompts and wait for Pi to confirm connection.")})},className:"mb-3 space-y-2",children:[C.jsxs("label",{className:"block text-xs font-medium",children:["API key",C.jsx("input",{type:"password",autoComplete:"off",spellCheck:!1,"aria-label":"Provider API key",value:h,onChange:q=>d(q.target.value),disabled:g||W,className:"mt-1 block w-full rounded-md border bg-transparent px-3 py-2 text-sm"})]}),C.jsx("button",{type:"submit",disabled:!h.trim()||g||W,className:"rounded-md bg-foreground px-3 py-2 text-background disabled:opacity-40",children:"Save API key"})]}),K&&C.jsxs("section",{className:"mt-3 space-y-3 rounded-lg border p-3",children:[C.jsxs("p",{className:"text-sm font-medium",children:[a?.providers.find(q=>q.id===K.provider)?.name??K.provider,": ",K.status==="succeeded"?"Connected":K.status]}),K.instructions&&C.jsx("p",{className:"whitespace-pre-wrap break-words text-xs",children:K.instructions}),W&&te&&C.jsx("a",{href:te,target:"_blank",rel:"noopener noreferrer",className:"inline-block rounded-md border px-3 py-2 text-sm underline",children:"Open provider authorization ↗"}),W&&K.authorizationUrl&&!te&&C.jsx("p",{role:"alert",className:"text-red-600",children:"The provider returned an unsafe authorization link."}),W&&C.jsx("p",{className:"text-xs text-muted-foreground",children:"On a remote VM, follow the provider’s instructions and paste its callback URL or code below when requested. This dialog polls only while login is pending; closing it cancels login."}),W&&K.deviceCode&&C.jsxs("div",{className:"space-y-2",children:[C.jsx("p",{className:"text-xs",children:"Enter this code at the provider:"}),C.jsx("p",{className:"select-all break-all rounded border p-3 font-mono text-lg font-semibold",children:K.deviceCode.userCode}),sk(K.deviceCode.verificationUri)?C.jsx("a",{href:sk(K.deviceCode.verificationUri),target:"_blank",rel:"noopener noreferrer",className:"text-sm underline",children:"Open device authorization ↗"}):C.jsx("p",{role:"alert",children:"The provider returned an unsafe device authorization link."})]}),W&&K.prompt?.type==="select"&&C.jsxs("div",{...z,className:"space-y-2",children:[C.jsx("p",{className:"text-xs font-medium",children:K.prompt.message}),K.prompt.options?.map(q=>C.jsxs("button",{type:"button",disabled:g,onClick:()=>{se("/api/providers/answer",{id:K.id,promptId:K.prompt.id,value:q.id},()=>m(""))},className:"block w-full rounded-md border px-3 py-2 text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground disabled:opacity-40",children:[C.jsx("span",{className:"block",children:q.label}),q.description&&C.jsx("span",{className:"block text-xs text-muted-foreground",children:q.description})]},q.id))]}),W&&K.prompt&&K.prompt.type!=="select"&&C.jsxs("form",{className:"space-y-2",onSubmit:q=>{q.preventDefault(),(f||K.prompt?.allowEmpty)&&se("/api/providers/answer",{id:K.id,promptId:K.prompt.id,value:f},()=>m(""))},children:[C.jsxs("label",{className:"block text-xs",children:[K.prompt.message,C.jsx("input",{type:K.prompt.type==="text"?"text":"password",autoComplete:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":K.prompt.message,placeholder:K.prompt.placeholder,value:f,onChange:q=>m(q.target.value),disabled:g,className:"mt-1 block w-full rounded-md border bg-transparent px-3 py-2"})]}),C.jsx("button",{disabled:g||!f&&!K.prompt.allowEmpty,className:"rounded-md border px-3 py-2 disabled:opacity-40",children:"Submit response"})]}),K.error&&C.jsx("p",{role:"alert",className:"text-sm text-red-600",children:K.error}),W&&C.jsx("button",{disabled:g,onClick:()=>{se("/api/providers/cancel",{id:K.id},()=>{m("")})},className:"text-xs underline",children:"Cancel login"})]}),!a?.providers.length&&C.jsx("p",{className:"text-muted-foreground",children:"No providers available."})]})]})}function vze({chat:e,busy:t,onClose:r,onChanged:n}){const i=$.useMemo(()=>jE(),[]),[a,s]=$.useState(null),[l,c]=$.useState(""),[h,d]=$.useState(""),[f,m]=$.useState(null),[g,b]=$.useState(!0),[x,k]=$.useState(!1),[w,_]=$.useState(0),S=$.useRef(null),N=$.useRef(null),B=$.useRef(!1),I=X=>JSON.stringify([X.provider,X.id]),P=a?.models.filter(X=>`${X.provider} ${X.id} ${X.name??""}`.toLowerCase().includes(h.toLowerCase()))??[];$.useEffect(()=>{const X=new AbortController;return S.current=X,b(!0),m(null),i(`/api/models?chat=${encodeURIComponent(e)}`,{signal:X.signal}).then(j=>{X.signal.aborted||(s(j),j.error&&m(j.error),j.current&&c(JSON.stringify([j.current.provider,j.current.id])))}).catch(j=>{X.signal.aborted||m(j.message)}).finally(()=>{X.signal.aborted||b(!1)}),()=>X.abort()},[e,w]);const O=async(X=l)=>{const j=a?.models.find(se=>I(se)===X);if(!j||t||B.current||a?.setupBlocked)return;const Z=S.current?.signal;B.current=!0,k(!0),m(null);try{if(await i("/api/models",{method:"POST",signal:Z,json:{chat:e,provider:j.provider,modelId:j.id}}),Z?.aborted)return;n?.(),r()}catch(se){Z?.aborted||m(se instanceof Error?se.message:String(se))}finally{B.current=!1,Z?.aborted||k(!1)}};return C.jsxs(of,{title:"Chat model",onClose:r,children:[C.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Changes only this chat’s Pi model. Loops use their configured attempt models."}),a?.current&&C.jsxs("p",{className:"mb-3 text-xs",children:["Current: ",C.jsxs("span",{className:"font-mono",children:[a.current.provider,"/",a.current.id]})]}),t&&C.jsx("p",{role:"status",className:"mb-3 text-amber-700",children:"Wait for the agent and running loops to stop before changing models."}),a?.warning&&C.jsx("p",{role:"status",className:"mb-3 text-amber-700",children:a.warning}),a?.requiresRestart&&!a.warning&&C.jsx("p",{role:"status",className:"mb-3 text-amber-700",children:"This Pi runtime requires an explicit agent restart to refresh newly connected provider models. No restart was performed automatically."}),a?.setupBlocked&&C.jsx("p",{role:"status",className:"mb-3 text-amber-700",children:"Complete the agent’s startup questions first."}),f&&C.jsxs("p",{role:"alert",className:"mb-3 text-red-600",children:[f," ",C.jsx("button",{disabled:x,onClick:()=>_(X=>X+1),className:"underline",children:"Reload models"})]}),g?C.jsx("p",{role:"status",children:"Loading models…"}):C.jsxs(C.Fragment,{children:[C.jsx("input",{autoFocus:!0,"data-dialog-autofocus":!0,"aria-label":"Filter models","aria-describedby":"model-keyboard-help",placeholder:"Filter by provider or model…",value:h,onChange:X=>d(X.target.value),onKeyDown:X=>{if(!(X.nativeEvent.isComposing||X.altKey||X.ctrlKey||X.metaKey)){if(X.key==="ArrowDown"||X.key==="ArrowUp"){X.preventDefault();const j=N.current?.querySelectorAll("input[type=radio]:not(:disabled)"),Z=j?.[X.key==="ArrowDown"?0:j.length-1];Z&&(c(Z.value),Z.focus())}else if(X.key==="Enter"){X.preventDefault();const j=P.find(Z=>I(Z)===l)??P[0];if(j){const Z=I(j);c(Z),O(Z)}}}},className:"mb-2 w-full rounded-md border bg-transparent px-3 py-2"}),C.jsx("p",{id:"model-keyboard-help",className:"mb-3 text-xs text-muted-foreground",children:"↑/↓ browse · Enter uses the selected model · Esc cancels"}),C.jsx("div",{ref:N,className:"max-h-[40dvh] space-y-1 overflow-y-auto",role:"radiogroup","aria-label":"Available chat models",children:P.map(X=>{const j=I(X);return C.jsxs("label",{className:`flex cursor-pointer items-start gap-2 rounded-md border p-2 ${l===j?"bg-muted":""}`,children:[C.jsx("input",{type:"radio",name:"chat-model",value:j,checked:l===j,onChange:()=>c(j),onKeyDown:Z=>{Z.key==="Enter"&&!Z.nativeEvent.isComposing&&!Z.altKey&&!Z.ctrlKey&&!Z.metaKey&&(Z.preventDefault(),O(j))},disabled:x,className:"mt-1"}),C.jsxs("span",{className:"min-w-0",children:[C.jsx("span",{className:"block text-sm",children:X.name??X.id}),C.jsxs("span",{className:"block break-all font-mono text-xs text-muted-foreground",children:[X.provider,"/",X.id]})]})]},j)})}),!!a?.models.length&&!P.length&&C.jsx("p",{className:"text-muted-foreground",children:"No models match your filter."}),!a?.models.length&&C.jsx("p",{className:"text-muted-foreground",children:"No available models. Connect a provider, then reopen this picker."})]}),C.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[C.jsx("button",{onClick:r,className:"rounded-md border px-3 py-2",children:"Cancel"}),C.jsx("button",{onClick:()=>{O()},disabled:t||g||x||!l||!!a?.setupBlocked,className:"rounded-md bg-foreground px-3 py-2 text-background disabled:opacity-40",children:x?"Changing…":"Use model"})]})]})}function Cze(e,t,r,n){if(!e)return null;const i=t&&(!r||t.startedAt!==r.startedAt||t.finishedAt!==r.finishedAt||t.status!==r.status);return i&&t.status==="succeeded"?{status:"succeeded",title:"Completed",detail:"Pi reports that this compaction completed.",...t.result!==void 0?{result:typeof t.result=="string"?t.result:JSON.stringify(t.result,null,2)}:{}}:i&&t.status==="error"?{status:"error",title:"Compaction failed",detail:t.error||"Pi reported a compaction error."}:i&&t.status==="uncertain"?{status:"uncertain",title:"Outcome uncertain",detail:t.error||n||"Pi has not confirmed the outcome. Inspect session status before any explicit retry."}:i&&t.status==="running"?{status:"running",title:"Compacting…",detail:n?`${n} Pi still reports this compaction running.`:"Pi reports this compaction is running. This uses model tokens."}:{status:"waiting",title:"Waiting for Pi session status",detail:n||"Compaction was requested. Waiting for Pi to confirm the operation; no automatic retry will be sent."}}const qc=e=>e.questions.filter(t=>!t.answered&&!t.expired&&!t.superseded),_P={close:e=>`Close call in round ${e.round}`,veto:e=>`Reviewer veto in round ${e.round}`,stall:()=>"Stuck: what next?",apply:()=>"Done: apply the winner?",ask:()=>"A question for you"},SP=e=>e.log[e.log.length-1]?.t??0;function kze(e,t,r=[]){const n=e.summary;if(!n||!n.loops)return{id:e.id,title:e.title,state:"idle",asks:0};if(n.open&&n.question){const c=(_P[n.question.kind]??_P.ask)(n.question);return{id:e.id,title:e.title,state:"needs",asks:n.open,line:n.open>1?`${n.open} questions · ${c.toLowerCase()}`:c}}if(n.running)return{id:e.id,title:e.title,state:"running",asks:0,progress:.5,line:n.running>1?`${n.running} loops running`:`Round ${Math.max(1,n.latest?.rounds??1)} · working`};const i=r.reduce((c,h)=>!c||SP(h)>SP(c)?h:c,void 0);if(i&&i.name===n.latest?.name&&uv(i))return{id:e.id,title:e.title,state:"stuck",asks:0,line:n.latest?.outcome??"No candidates completed"};if(n.latest?.status==="error")return{id:e.id,title:e.title,state:"stuck",asks:0,line:n.latest.outcome??`${n.latest.name} failed`};if(n.latest?.status==="stalled")return{id:e.id,title:e.title,state:"stuck",asks:0,line:`${n.latest.name} interrupted — no signal from the round`};if(n.latest?.outcome)return{id:e.id,title:e.title,state:"stuck",asks:0,line:n.latest.outcome};const a=t[e.id]!=null&&n.lastT>t[e.id],s=n.latest?.score,l=n.latest?`Done · ${n.latest.name}`:"Done";return{id:e.id,title:e.title,state:a?"new":"done",asks:0,line:s!=null?`${l} · ${n.latest.kind==="bench"?`${Math.round(s)} ${n.latest.unit??""}`.trim():s.toFixed(1)}`:l}}const Tze=new Set(["pick","pause","resume","stop","more","unrule"]);function wze(){return C.jsxs("div",{className:"space-y-6","aria-busy":"true","aria-label":"Loading chat",children:[C.jsxs("div",{className:"space-y-2 animate-pulse",children:[C.jsx("div",{className:"h-3 w-1/4 rounded bg-muted-foreground/20"}),C.jsx("div",{className:"h-3 w-full rounded bg-muted-foreground/10"}),C.jsx("div",{className:"h-3 w-11/12 rounded bg-muted-foreground/10"}),C.jsx("div",{className:"h-3 w-2/3 rounded bg-muted-foreground/10"})]}),C.jsx("div",{className:"ml-auto w-3/5 animate-pulse rounded-lg bg-muted/60 px-4 py-3",children:C.jsx("div",{className:"h-3 w-3/4 rounded bg-muted-foreground/15"})}),C.jsxs("div",{className:"space-y-2 animate-pulse",children:[C.jsx("div",{className:"h-3 w-1/3 rounded bg-muted-foreground/20"}),C.jsx("div",{className:"h-3 w-10/12 rounded bg-muted-foreground/10"})]})]})}function _ze(e,t,r=0){const n=[];for(const a of e)a.log.forEach((s,l)=>{const h=Tze.has(s.kind)||s.kind==="rule"&&s.source&&s.source!=="config"?s.source==="parent"?"applied":"user":s.kind==="round"?"tool":"parent";s.t>=r&&n.push({key:`${a.id}-${l}`,t:s.t,run:a,ev:s,who:h})});for(const a of e)a.pending.forEach((s,l)=>{s.source!=="parent"&&n.push({key:`${a.id}-q${l}`,t:s.t,run:a,ev:s,who:"user",queued:!0})});t.forEach((a,s)=>n.push({key:`c${s}`,t:a.ts,who:"chat",item:a}));for(const a of e)a.questions.forEach(s=>{(s.answered||s.expired||s.superseded)&&n.push({key:`${a.id}-ask-${s.id}`,t:s.t,who:"ask",run:a,q:s})});n.sort((a,s)=>a.t-s.t);const i=[];for(const a of n)if(a.who==="chat"&&a.item.t==="tool"){const s={cmd:a.item.cmd,out:a.item.out},l=i[i.length-1];l?.who==="tools"?l.calls.push(s):i.push({key:a.key,t:a.t,who:"tools",calls:[s]})}else{if(a.who==="tool"&&i[i.length-1]?.who==="tools")continue;i.push(a)}return i}function EP(e){switch(e.kind){case"pick":return`Continue from round ${e.round}, ${e.label}.${e.note?" "+e.note:""}`;case"rule":return e.text;case"unrule":return`Drop the rule “${e.text}”.`;case"pause":return"Pause.";case"resume":return"Resume.";case"stop":return"Stop after this round.";case"more":return`Run ${e.text.replace(/\D/g,"")||2} more rounds.`;default:return e.text}}function AP(e){for(const t of e.runs??[]){t.best?.shot&&(t.best.shot=Fy(t.best.shot));for(const r of t.rounds??[]){r.sheet&&(r.sheet=Fy(r.sheet)),r.current?.shot&&(r.current.shot=Fy(r.current.shot));for(const n of r.attempts??[])n.shot&&(n.shot=Fy(n.shot))}}return e}function Sze(){const[e,t]=$.useState(null),[r,n]=$.useState(null),[i,a]=$.useState({}),[s,l]=$.useState(!1),[c,h]=$.useState(!1),[d,f]=$.useState(!1),[m,g]=$.useState(null),[b,x]=$.useState(null),[k,w]=$.useState(null),[_,S]=$.useState([]),[N,B]=$.useState([]),[I,P]=$.useState();$.useEffect(()=>{f(!1)},[I,r,i.loop]);const[O,X]=$.useState(!0),[j,Z]=$.useState({}),[se,ue]=$.useState(null),[K,W]=$.useState(!1),[z,te]=$.useState(null),q=$.useRef(!1),pe=$.useRef(null),[F,Ee]=$.useState(!1),[$e,ee]=$.useState(""),[ne,me]=$.useState([]),[he,Oe]=$.useState(null),[tt,Ne]=$.useState(!1),[Je,qe]=$.useState(0),[rt,qt]=$.useState(0),[Cr,Ar]=$.useState(null),[Nt,zt]=$.useState(null),[vt,Sr]=$.useState(!1),[er,Lr]=$.useState(!1),[Sn,mr]=$.useState(),[an,Xr]=$.useState(null),bt=$.useRef(!1),ke=$.useRef(null),E=$.useCallback(Y=>{let Ae={};try{Ae=JSON.parse(localStorage.getItem("loops-seen")||"{}")}catch{}Y&&(Ae[Y]=Date.now(),localStorage.setItem("loops-seen",JSON.stringify(Ae))),Z(Ae)},[]),ae=$.useRef(0),be=$.useRef({}),Re=$.useRef({state:null}),[Se,Qe]=$.useState(0),[V,we]=$.useState(null),Ye=()=>eo()||location.origin,ze=()=>`loops-ws:${Ye()}`,Ve=Y=>`loops-chat:${Ye()}:${Y}`,Ge=()=>{f(!1),h(!1),l(!1),a({}),t(null),n(null),ue(null),we(null),W(!1),te(null),q.current=!1,ns(!1),zt(null),Ee(!1),me([]),Ar(null),ke.current?.abort()},He=(Y,Ae)=>{const et=Fl(Y);location.pathname+location.search!==et&&history[Ae==="push"?"pushState":"replaceState"](null,"",et)},dt=(Y,Ae)=>{try{if(Y.loop){const et=Ae.runs.find(Xt=>Xt.id===Y.loop);if(!et)throw new Error("This loop does not belong to the selected chat, or is unavailable.");const kr=Y.round===void 0?void 0:et.rounds.find(Xt=>Xt.n===Y.round);if(Y.round!==void 0&&!kr)throw new Error("This round is unavailable in the selected loop.");if(Y.attempt!==void 0&&!kr?.attempts.some(Xt=>Xt.name===Y.attempt))throw new Error("This attempt is unavailable in the selected round.")}we(null),a({loop:Y.loop,round:Y.round,attempt:Y.attempt}),l(!!Y.loop)}catch(et){we(et instanceof Error?et.message:String(et)),a({}),l(!1)}},st=$.useCallback(async(Y,Ae,et=!1,kr=!1)=>{f(!1),be.current=Y,Ae!=="pop"&&He(Y,Ae);const Xt=Re.current;if(Ye()===Xt.server&&Y.workspace===Xt.workspace&&Y.chat===Xt.chat&&Xt.state){h(!1),dt(Y,Xt.state);return}const Nr=++ae.current;Ge(),P(Y.workspace),S([]),X(!0),Re.current={workspace:Y.workspace,server:Ye(),state:null},Qe(Nr);try{const as=await zr("/api/workspaces");if(Nr!==ae.current)return;let Fs=Array.isArray(as)?as:[];if(B(Fs),kr){const Ue=Fs.filter(Ke=>Ke.open!==!1&&Ke.available!==!1),re=localStorage.getItem(ze()),ye=Ue.find(Ke=>Ke.id===re)??Ue[0];Y=ye?{workspace:ye.id}:{},be.current=Y,P(Y.workspace),Re.current.workspace=Y.workspace}if(!Y.workspace){(Ae!=="pop"||kr)&&He(Y,"replace");return}const Ba=Fs.find(Ue=>Ue.id===Y.workspace);if(!Ba)throw new Error("This workspace is unknown on the connected server.");if(Ba.available===!1)throw new Error(`Workspace unavailable: ${Ba.path}`);if(Ba.open===!1){const Ue=await zr("/api/workspaces",{method:"POST",json:{path:Ba.path}});if(Nr!==ae.current)return;const re=Ue.workspace;if(re.id!==Y.workspace)throw new Error("The reopened directory does not match the requested workspace.");Fs=Fs.map(ye=>ye.id===Ba.id?{...ye,...re,open:!0}:ye),B(Fs)}const Ra=await zr(`/api/chats?ws=${encodeURIComponent(Y.workspace)}`);if(Nr!==ae.current)return;const ss=Array.isArray(Ra)?Ra:[];S(ss);let li=Y.chat;if(!li&&et){const Ue=localStorage.getItem(Ve(Y.workspace));Ue&&ss.some(re=>re.id===Ue)&&(li=Ue)}if(li){if(!ss.some(re=>re.id===li&&(!re.ws||re.ws===Y.workspace)))throw new Error("This chat does not belong to the requested workspace, or is unavailable.");const Ue=await zr("/api/chat",{method:"POST",json:{id:li,ws:Y.workspace}});if(Nr!==ae.current)return;if(Ue.chat!==li||Ue.ws&&Ue.ws!==Y.workspace)throw new Error("The server returned a different chat or workspace.");Y={...Y,chat:li},be.current=Y,Re.current.chat=li,n(li),E(li),localStorage.setItem(Ve(Y.workspace),li)}localStorage.setItem(ze(),Y.workspace),(Ae!=="pop"||kr)&&He(Y,"replace")}catch(as){Nr===ae.current&&we(as instanceof Error?as.message:String(as))}finally{Nr===ae.current&&X(!1)}},[E]),mt=Y=>st({workspace:Y},"push",!0),At=Y=>({workspace:I,chat:r??void 0,loop:Y.loop,round:Y.round&&Y.round>0?Y.round:void 0,attempt:Y.round&&Y.round>0?Y.attempt:void 0}),It=Y=>Fl(At(Y)),tr=Y=>{st(At(Y),"push")},go=()=>tr({}),qn=async(Y,Ae)=>{const et=Ae??I;if(!et)return!1;if(Y){await st({workspace:et,chat:Y},"push");return}const kr=++ae.current;Ge(),P(et),X(!0),Re.current={workspace:et,server:Ye(),state:null},Qe(kr);try{const Xt=await zr("/api/chat",{method:"POST",json:{ws:et}});if(kr!==ae.current)return;if(!Xt.chat||Xt.ws&&Xt.ws!==et)throw new Error("The new chat belongs to a different workspace.");const Nr={workspace:et,chat:Xt.chat};return be.current=Nr,He(Nr,"push"),Re.current.chat=Xt.chat,n(Xt.chat),E(Xt.chat),localStorage.setItem(Ve(et),Xt.chat),localStorage.setItem(ze(),et),!0}catch(Xt){return kr===ae.current&&ue(Xt instanceof Error?Xt.message:String(Xt)),!1}finally{kr===ae.current&&X(!1)}};$.useEffect(()=>{const Y=(et=!1)=>{v$e({explicitOrigin:location.pathname!=="/"});try{const kr=H$e(),Xt=et&&location.pathname==="/";st(kr,"pop",Xt,Xt)}catch(kr){++ae.current,Ge(),Re.current={state:null},P(void 0),S([]),X(!1),we(kr instanceof Error?kr.message:String(kr))}};Y(!0);const Ae=()=>Y();return window.addEventListener("popstate",Ae),()=>{++ae.current,window.removeEventListener("popstate",Ae)}},[st]);const sn=$.useCallback(async Y=>{if(!Y)return;const Ae=ae.current;try{const et=await zr(`/api/chats?ws=${encodeURIComponent(Y)}`);Ae===ae.current&&S(Array.isArray(et)?et:[])}catch(et){Ae===ae.current&&ue(et instanceof Error?et.message:String(et))}},[]);$.useEffect(()=>{const Y=_.reduce((Ae,et)=>Ae+(et.summary?.open??0),0);document.title=Y?`(${Y}) Loops`:"Loops"},[_]),$.useEffect(()=>{if(!r)return;const Y=ae.current;return k$e(r,{state:Ae=>{if(Y===ae.current){if(Ae.chat!==r||Ae.ws&&Ae.ws!==I){we("The server returned state for a different chat or workspace.");return}Re.current.state=AP(Ae),t(Re.current.state),dt(be.current,Ae),Ae.chats&&S(Ae.chats.filter(et=>!et.ws||et.ws===I)),ue(Ae.error??null)}},proposals:Ae=>{Y===ae.current&&t(et=>et&&{...et,proposals:Ae})},error:Ae=>{Y===ae.current&&ue(Ae)}})},[r,I,Se]);const ar=$.useMemo(()=>e?.runs??[],[e]),on=$.useMemo(()=>e?.items??[],[e]),Vn=e?.live??null,Ii=$.useMemo(()=>jE(),[Ye(),Se]),ai=e?.sessionActions?.compaction,Pi=Cze(er,ai,Sn,an),La=!!e?.sessionActions?.busy||!!Vn||ar.some(Y=>Y.alive)||ai?.status==="running",dl=N.find(Y=>Y.id===I&&Y.open!==!1&&Y.available!==!1),vi=gze(ne,!!r&&!O&&!V,!!dl&&!O,La,!!e?.sessionActions?.setupBlocked);$.useEffect(()=>{const Y=new AbortController;if(me([]),Oe(null),Ne(!!r),r){const Ae=ae.current;bze(`/api/commands?chat=${encodeURIComponent(r)}`,{signal:Y.signal}).then(et=>{Y.signal.aborted||Ae!==ae.current||(me(et.commands??[]),Oe(et.error??(et.setupBlocked?"Complete the agent’s startup questions, then retry Pi commands.":et.supported===!1?"This Pi runtime does not support command discovery. App actions are still available.":null)))}).catch(et=>{!Y.signal.aborted&&Ae===ae.current&&Oe(et.message)}).finally(()=>{!Y.signal.aborted&&Ae===ae.current&&Ne(!1)})}return()=>Y.abort()},[r,Se,Je]),$.useEffect(()=>{const Y=new AbortController;return ke.current=Y,()=>Y.abort()},[r,Se]),$.useEffect(()=>{const Y=Ae=>{if((Ae.metaKey||Ae.ctrlKey)&&Ae.key.toLowerCase()==="k"){if(Ae.preventDefault(),document.querySelector('dialog[open]:not([data-dialog-variant="palette"])'))return;ee(""),Ee(et=>!et),qe(et=>et+1)}};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[]);const Ms=async Y=>{const Ae=vi.find(et=>et.action===Y);if(!Ae||Ae.disabled)throw new Error(Ae?.disabled??"Action unavailable.");if(Ee(!1),Y==="new"){if(!await qn(void 0,dl?.id))throw new Error("Could not create a new chat. Your draft is retained.");return}Y==="compact"&&(Sr(!1),Lr(!1),Xr(null),mr(void 0)),zt({kind:Y,chat:r,epoch:ae.current})},yo=async Y=>{if(!Y.trimStart().startsWith("/")){await Ii("/api/prompt",{method:"POST",json:{chat:r,text:Y},signal:ke.current?.signal});return}const Ae=yze(Y);if(!Ae)throw new Error("Invalid slash command. Choose a command from Commands.");const et=vi.find(Xt=>Xt.action&&(Xt.name===Ae.name||`app:${Xt.action}`===Ae.name&&!ne.some(Nr=>Nr.name===Ae.name)));if(et?.action){if(Ae.args.trim())throw new Error(`/${Ae.name} does not accept arguments. Open it from Commands instead.`);await Ms(et.action);return}if(tt)throw new Error("Pi commands are still loading. Try again when discovery completes.");const kr=vi.find(Xt=>Xt.command?.name===Ae.name);if(!kr)throw new Error(`Unknown slash command /${Ae.name}. It was not sent to the model. Open Commands${he?" and retry command discovery":" to see available commands"}.`);if(kr.disabled)throw new Error(kr.disabled);await Ii("/api/commands/run",{method:"POST",json:{chat:r,name:Ae.name,args:Ae.args},signal:ke.current?.signal})},{input:yn,setInput:_u,pending:ts,submitting:bo,failures:fl,restore:Jr,send:Zi}=pze(Ye(),r,!!Vn,yo),xo=/^\/[^\s]*$/.test(yn)&&Cr!==yn&&!F&&!Nt,Bs=EZ(vi,yn),Rs=Y=>{if(!Y.disabled){if(Y.action){Ar(yn),Ms(Y.action).catch(Ae=>ue(Ae.message));return}_u(`/${Y.name} `),Ee(!1),Ar(null),qt(0),requestAnimationFrame(()=>pe.current?.focus())}},cc=e?.dialogs??[],Su=async()=>{if(!r||q.current)return;const Y=ae.current;q.current=!0,W(!0),te(null);try{const Ae=await zr("/api/chat/retry",{method:"POST",json:{chat:r}});if(!Ae?.ok)throw new Error(Ae?.error||"Unable to retry the agent.")}catch(Ae){Y===ae.current&&te(Ae instanceof Error?Ae.message:String(Ae))}finally{Y===ae.current&&(q.current=!1,W(!1))}},[Eu,ha]=$.useState(null),bn=$.useRef(new Set),si=$.useCallback(async(Y,Ae)=>{if(!r)return;const et=`${r}:${Y}:${Ae.action}`;if(!bn.current.has(et)){bn.current.add(et),ha(null);try{await zr("/api/steer",{method:"POST",json:{chat:r,run:Y,...Ae}})}catch(kr){ha({chat:r,error:kr instanceof Error?kr.message:String(kr)})}finally{bn.current.delete(et)}}},[r]),ln=$.useCallback(async()=>{if(!r)return;const Y=ae.current,Ae=await zr(`/api/state?chat=${encodeURIComponent(r)}`).catch(()=>null);!Ae||Y!==ae.current||(Re.current.state=AP(Ae),t(Re.current.state),dt(be.current,Ae),S((Ae.chats??[]).filter(et=>!et.ws||et.ws===I)))},[r,I]),[pl,vo]=$.useState(null),Co=$.useCallback((Y,Ae)=>vo({id:Y,value:Ae}),[]),Au=$.useCallback(()=>{const Y=pl;vo(null),!(!Y||!Y.value.trim())&&(S(Ae=>Ae.map(et=>et.id===Y.id?{...et,title:Y.value.trim()}:et)),zr("/api/rename",{method:"POST",json:{chat:Y.id,name:Y.value.trim()}}).then(()=>(sn(I),ln())))},[pl,ln]),Na=()=>{localStorage.removeItem(ze()),st({},"push")},ko=async Y=>{const Ae=ae.current;try{const et=await zr("/api/workspaces/remove",{method:"POST",json:{id:Y}});if(!et.ok)throw new Error(et.error||"Could not close workspace");const kr=N.map(Xt=>Xt.id===Y?{...Xt,open:!1}:Xt);if(B(kr),Y===I&&Ae===ae.current){const Xt=kr.find(Nr=>Nr.open!==!1&&Nr.available!==!1);Xt?mt(Xt.id):Na()}}catch(et){ue(et instanceof Error?et.message:String(et))}},Os=async(Y,Ae,et)=>{await zr("/api/answer",{method:"POST",json:{chat:r,question:Ae.id,choice:Ae.options[et]?.label??""}}).catch(()=>{})},Ds=async(Y,Ae)=>{await zr("/api/ui",{method:"POST",json:{chat:r,id:Y,response:Ae}})},Is=_.find(Y=>Y.id===r),Ci=N.find(Y=>Y.id===I&&Y.open!==!1&&Y.available!==!1),da=s&&!V,cn=$.useMemo(()=>_ze(ar,on),[ar,on]),Ps=$.useMemo(()=>ar.flatMap(Y=>qc(Y).map(Ae=>({run:Y,q:Ae}))).sort((Y,Ae)=>Ae.q.t-Y.q.t),[ar]),[ml,id]=$.useState(!1),Ma=async(Y,Ae)=>{await zr(`/api/proposals/${encodeURIComponent(Y)}/${Ae}`,{method:"POST"}).catch(()=>{}),await ln()},[rs,ns]=$.useState(!1),uc=$.useMemo(()=>{const Y=new Set;let Ae;for(const et of cn){if(et.who==="chat"||et.who==="ask"||et.who==="tools"){Ae=void 0;continue}!("run"in et)||!et.run||(Ae===et.run.id&&Y.add(et.key),Ae=et.run.id)}return Y},[cn]),Lu=_.map(Y=>kze(Y,j,Y.id===r?ar:[])),gl=ar.filter(Y=>Y.alive).length,Qt=ar.reduce((Y,Ae)=>Y+Ae.tokens,0),is=ar.reduce((Y,Ae)=>Y+qc(Ae).length,0),En=O||r!=null&&e==null&&!se&&!V,To=({run:Y,round:Ae,children:et})=>C.jsx(Ga,{href:It({loop:Y.id,round:Ae}),onNavigate:()=>tr({loop:Y.id,round:Ae}),className:"font-semibold underline decoration-foreground/30 decoration-dotted underline-offset-4 hover:decoration-foreground",children:et}),Fi=({run:Y,ev:Ae,key:et})=>{switch(Ae.kind){case"start":return C.jsxs("p",{children:["Started ",C.jsx(To,{run:Y,children:Y.name}),": “",Y.goal,"”. Each round uses the configured attempt models and styles to create candidates from the current best, then evaluates them against the loop’s rules and checks."]});case"judged":return C.jsxs("p",{children:[C.jsx(To,{run:Y,round:Ae.round,children:uc.has(et)?`Round ${Ae.round}`:`${Y.name} · round ${Ae.round}`})," ",C.jsx(fze,{run:Y,event:Ae})]});case"rule":return C.jsxs("p",{className:"inline-flex items-center gap-1.5 text-xs",children:[C.jsx(X9,{className:"size-3 text-violet-500"})," New rule: ",Ae.text]});case"done":return C.jsxs("p",{className:"text-muted-foreground",children:[C.jsx(To,{run:Y,children:Y.name}),": ",Ae.text.replace(/^Finished: /,"finished: ")]});default:return C.jsx("p",{children:Ae.text})}},oi=C.jsxs(C.Fragment,{children:[Eu?.chat===r&&C.jsx("p",{role:"alert",className:"px-3 py-2 text-red-600",children:Eu.error}),(e?.notices??[]).filter(Y=>Y.level==="error").slice(-2).map((Y,Ae)=>C.jsx("p",{role:"alert",className:"px-3 py-1 text-xs text-red-600",children:Y.message},`${Y.t}-${Ae}`)),(e?.configErrors??[]).map(Y=>C.jsx("p",{role:"alert",className:"px-3 py-2 text-xs text-red-600 [overflow-wrap:anywhere]",children:Y.error},Y.ws))]});return C.jsxs("div",{className:"relative flex h-dvh flex-col overflow-hidden bg-background text-sm",children:[C.jsx(nze,{hrefForWorkspace:Y=>Fl({workspace:Y}),launcherHref:Fl({}),workspaces:N.filter(Y=>Y.open!==!1),active:I,onSwitch:Y=>{mt(Y)},onAdd:Na,onRemove:Y=>{ko(Y)}}),C.jsxs("div",{className:"relative flex min-h-0 min-w-0 flex-1",children:[c&&C.jsx("div",{className:"absolute inset-0 z-30 bg-black/20 lg:hidden",onClick:()=>h(!1)}),C.jsxs("aside",{id:"chat-sessions","aria-label":"Chat sessions",className:`flex w-56 shrink-0 flex-col border-r bg-sidebar max-lg:absolute max-lg:inset-y-0 max-lg:left-0 max-lg:z-40 max-lg:shadow-xl max-lg:transition-transform ${c?"":"max-lg:-translate-x-full"}`,children:[C.jsx(W$e,{hrefForChat:Y=>Fl({workspace:I,chat:Y}),rows:Lu,activeId:r,loading:En,canCreate:!!Ci&&!O,onOpen:Y=>qn(Y),onNew:()=>{Ci&&qn(void 0,Ci.id)},onRename:Co,renaming:pl,onRenameChange:Y=>vo(Ae=>Ae&&{...Ae,value:Y}),onRenameSubmit:Au,onRenameCancel:()=>vo(null)}),C.jsxs("div",{className:"mx-2 mb-2 mt-1 flex items-center gap-1",children:[C.jsxs("button",{disabled:!r,onClick:()=>ns(!0),className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40",title:"Loop settings (this repo)",children:[C.jsx(Pte,{className:"size-3.5"})," settings"]}),C.jsxs("button",{onClick:()=>{const Y=eo()||location.origin,Ae=prompt("Server to attach to (leave empty for this one):",Y===location.origin?"":Y);if(Ae===null)return;const et=prompt("Token (printed when the server started; empty for a loopback server):","");et!==null&&(Yw(Ae,et),location.assign("/"))},className:"ml-auto flex min-w-0 items-center gap-1 rounded-lg px-2 py-1.5 text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground",title:`Attached to ${eo()||location.origin}`,children:[C.jsx(Dte,{className:"size-3"}),C.jsx("span",{className:"truncate",children:eo()?eo().replace(/^https?:\/\//,""):"this server"})]})]})]}),C.jsxs("div",{className:`relative flex h-full min-h-0 flex-col transition-[width] duration-300 ${da?"w-[40%] min-w-[360px] border-r max-lg:hidden":"min-w-0 flex-1"}`,children:[C.jsxs("header",{className:"flex min-h-12 shrink-0 items-center gap-3 border-b px-4 py-2",children:[!da&&C.jsx("button",{onClick:()=>h(!0),className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted lg:hidden","aria-label":"Chats","aria-expanded":c,"aria-controls":"chat-sessions",children:C.jsx(Y9,{className:"size-4"})}),C.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[C.jsx("button",{onClick:()=>f(!0),className:"max-w-[40%] shrink-0 truncate rounded text-left text-xs text-muted-foreground hover:underline","aria-label":"Repository details",children:N.find(Y=>Y.id===I)?.title??"Workspaces"}),C.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground/50",children:"/"}),C.jsx("p",{className:"min-w-0 truncate font-medium",children:Is?.title??(En?"Loading…":"Conversation")})]}),C.jsx("button",{onClick:()=>{ee(""),Ee(!0),qe(Y=>Y+1)},className:"rounded-lg border px-3 py-2 text-xs font-medium hover:bg-muted",children:"Commands"})]}),ai&&ai.status!=="idle"&&C.jsxs("p",{role:"status",className:"px-5 py-2 text-xs text-muted-foreground",children:["Compaction: ",ai.status,ai.error?` — ${ai.error}`:""]}),V&&C.jsx("p",{role:"alert",className:"px-4 py-2 text-red-600",children:V}),V?C.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-6",children:[C.jsx("p",{className:"font-medium",children:"This link is unavailable"}),C.jsx("p",{className:"text-muted-foreground",children:"Choose a valid destination to continue."}),Ci&&r&&C.jsx(Ga,{href:Fl({workspace:Ci.id,chat:r}),onNavigate:()=>{st({workspace:Ci.id,chat:r},"push")},className:"underline",children:"Open selected chat"}),Ci&&C.jsx(Ga,{href:Fl({workspace:Ci.id}),onNavigate:()=>{st({workspace:Ci.id},"push")},className:"underline",children:"Open workspace"}),C.jsx(Ga,{href:Fl({}),onNavigate:Na,className:"underline",children:"Open workspaces"})]}):!I&&!O?C.jsxs(C.Fragment,{children:[C.jsx(sze,{hrefForWorkspace:Y=>Fl({workspace:Y}),workspaces:N,onOpen:Y=>{B(Ae=>[...Ae.filter(et=>et.id!==Y.id),{...Y,open:!0,available:!0}]),mt(Y.id)}}),se&&C.jsx("p",{role:"alert",className:"px-6 pb-3 text-red-600",children:se})]}):!r&&!O?C.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3",children:[C.jsx("p",{className:"font-medium",children:"No chat selected"}),C.jsx("p",{className:"text-muted-foreground",children:"Choose a chat from the sidebar or start a new one."}),C.jsx("button",{onClick:()=>{qn(void 0,I)},className:"rounded-md bg-foreground px-4 py-2 text-background",children:"New chat"}),se&&C.jsx("p",{role:"alert",className:"text-red-600",children:se})]}):C.jsxs(C.Fragment,{children:[!s&&oi,C.jsxs("div",{className:"flex min-h-0 flex-1",children:[C.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[ar.length>0&&C.jsx("div",{className:"flex gap-3 overflow-x-auto border-b px-3 py-2 md:hidden",children:ar.map(Y=>C.jsxs(Ga,{href:It({loop:Y.id}),onNavigate:()=>tr({loop:Y.id}),className:"w-28 shrink-0 text-left",children:[C.jsxs("div",{className:"relative",children:[C.jsx(gP,{run:Y,className:"w-full"}),qc(Y).length>0&&C.jsx("span",{className:"absolute right-1 top-1 size-2.5 rounded-full bg-amber-500 ring-2 ring-background"})]}),C.jsxs("div",{className:"mt-1 flex gap-1 text-[11px]",children:[C.jsx("span",{className:"min-w-0 flex-1 truncate",children:Y.name}),C.jsx("span",{className:"font-mono text-muted-foreground",children:sf(Y,Y.best.score)})]})]},Y.id))}),C.jsxs(Ure,{className:"min-h-0 flex-1",children:[C.jsxs(qre,{className:`mx-auto w-full gap-5 py-8 ${s?"px-5":"max-w-2xl px-6"}`,children:[En&&C.jsx(wze,{}),!En&&on.length===0&&!Vn&&ts.length===0&&C.jsxs("div",{className:"space-y-1.5",children:[C.jsx("p",{className:"font-medium text-foreground",children:ar.length?"This chat has no messages":"Start with a goal"}),C.jsx("p",{className:"text-muted-foreground",children:ar.length?`It has ${ar.length} loop${ar.length===1?"":"s"}. Ask how they're going, or steer them.`:"Say what to improve and how to measure it, and the agent will start a loop (e.g. “make search.mjs faster, results must stay identical”)."})]}),cn.map(Y=>Y.who==="ask"?C.jsx(yP,{run:Y.run,q:Y.q,onAnswer:Ae=>Os(Y.run,Y.q,Ae),onOpen:()=>tr({loop:Y.run.id,round:Y.q.round}),onOpenAttempt:Ae=>tr({loop:Y.run.id,round:Y.q.round,attempt:Ae})},Y.key):Y.who==="chat"?Y.item.t==="user"?C.jsx(Qd,{from:"user",children:C.jsx(Zd,{children:Y.item.text})},Y.key):Y.item.t==="tool"?null:C.jsx(Qd,{from:"assistant",children:C.jsx(Zd,{className:"w-full leading-relaxed",children:C.jsx(xw,{children:Y.item.text})})},Y.key):Y.who==="tools"?C.jsx(vP,{calls:Y.calls},Y.key):Y.who==="applied"?C.jsxs("div",{className:"-my-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[C.jsx(X9,{className:"size-3 text-violet-500"})," ",Y.run.name,": ",Y.ev.kind==="rule"?`rule now active: “${Y.ev.text}”`:EP(Y.ev).replace(/\.$/,"")+" (applied)"]},Y.key):Y.who==="tool"?null:Y.who==="user"?C.jsx(Qd,{from:"user",children:C.jsxs(Zd,{children:[C.jsx("span",{className:"mb-0.5 block text-[10px] uppercase tracking-wide text-muted-foreground",children:Y.run.name}),EP(Y.ev),Y.queued&&C.jsx("span",{className:"mt-1 block text-[10px] text-muted-foreground",children:Y.run.alive?"queued · applies at the start of the next round":"queued"})]})},Y.key):C.jsx(Qd,{from:"assistant",children:C.jsx(Zd,{className:"w-full space-y-2 leading-relaxed",children:Fi(Y)})},Y.key)),ts.filter(Y=>!on.some(Ae=>Ae.t==="user"&&Ae.text===Y)).map((Y,Ae)=>C.jsx(Qd,{from:"user",children:C.jsx(Zd,{className:"opacity-60",children:Y})},"p"+Ae)),Vn&&C.jsxs("div",{className:"space-y-2",children:[(()=>{const Y=Vn.tools.filter(Ae=>!on.some(et=>et.t==="tool"&&et.cmd===Ae.cmd&&et.ts>=Vn.startedAt)).map(Ae=>({cmd:Ae.cmd,running:!Ae.done}));return Y.length?C.jsx(vP,{calls:Y}):null})(),Vn.text?C.jsx(Qd,{from:"assistant",children:C.jsx(Zd,{className:"w-full leading-relaxed",children:C.jsx(xw,{children:Vn.text})})}):C.jsx("div",{className:"text-xs text-muted-foreground",children:C.jsx(fP,{children:"parent is thinking…"})})]}),(se||e?.error||z)&&C.jsxs("div",{role:"alert",className:"space-y-2 text-xs text-red-600",children:[e?.error&&C.jsx("p",{children:e.error}),se&&se!==e?.error&&C.jsx("p",{children:se}),z&&C.jsx("p",{children:z}),e?.error&&C.jsx("button",{disabled:K,onClick:()=>{Su()},className:"rounded-md border px-3 py-1.5 font-medium hover:bg-muted disabled:opacity-40",children:K?"Retrying agent…":"Retry agent"})]}),ar.filter(Y=>Y.alive).map(Y=>C.jsx("div",{className:"text-xs text-muted-foreground",children:C.jsx(Ga,{href:It({loop:Y.id,round:Y.rounds[Y.rounds.length-1]?.n}),onNavigate:()=>tr({loop:Y.id,round:Y.rounds[Y.rounds.length-1]?.n}),children:C.jsx(fP,{children:`${Y.name} · ${mP(Y)}`})})},Y.id))]}),C.jsx(Vre,{})]}),C.jsx("div",{className:"w-full",children:C.jsxs("div",{className:`mx-auto w-full pb-[max(1rem,env(safe-area-inset-bottom))] ${s?"px-4":"max-w-2xl px-6"}`,children:[(e?.proposals??[]).map(Y=>C.jsxs("div",{className:"mb-2 rounded-xl border border-amber-200 bg-amber-50/70 p-3",children:[C.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[C.jsx("span",{className:"size-1.5 rounded-full bg-amber-500"}),C.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-amber-800",children:"Approval needed"}),C.jsx("span",{className:"ml-auto font-mono text-[11px] text-amber-900/60",children:Y.file})]}),C.jsx("p",{className:"text-[13px] font-medium text-amber-950",children:"An agent changed the settings that decide how loops are judged"}),C.jsx("div",{className:"mt-1.5 space-y-1 rounded-lg border border-amber-200/70 bg-background px-2.5 py-2 font-mono text-[11px] leading-4 text-muted-foreground",children:Y.changes.map(Ae=>C.jsxs("div",{className:"break-all",children:[C.jsx("span",{className:"text-foreground",children:Ae.key})," ",Ae.from," ",C.jsx("span",{className:"text-amber-700",children:"→"})," ",Ae.to]},Ae.key))}),C.jsx("p",{className:"mt-1.5 text-[11px] text-amber-800/80",children:"Held: the file still has the old values, so no round can run on this."}),C.jsxs("div",{className:"mt-2 flex gap-1.5",children:[C.jsx("button",{onClick:()=>{Ma(Y.id,"apply")},className:"rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background",children:"A Apply"}),C.jsx("button",{onClick:()=>{Ma(Y.id,"keep")},className:"rounded-md border bg-background px-3 py-1.5 text-xs font-medium hover:bg-muted",children:"B Keep previous"})]})]},Y.id)),cc.filter(Y=>["select","confirm","input","editor"].includes(Y.method)).slice(0,1).map(Y=>C.jsx(hze,{dialog:Y,onAnswer:Ae=>Ds(Y.id,Ae)},Y.id)),Ps.length>0&&C.jsxs("div",{className:"mb-3 max-h-[55dvh] space-y-2 overflow-y-auto",children:[(ml?Ps:Ps.slice(0,1)).map(({run:Y,q:Ae})=>C.jsx(yP,{run:Y,q:Ae,onAnswer:et=>Os(Y,Ae,et),onOpen:()=>tr({loop:Y.id,round:Ae.round}),onOpenAttempt:et=>tr({loop:Y.id,round:Ae.round,attempt:et})},`${Y.id}-${Ae.id}`)),Ps.length>1&&C.jsx("button",{onClick:()=>id(!ml),className:"text-xs text-amber-700 hover:underline dark:text-amber-400",children:ml?"Show only the newest question":`+${Ps.length-1} more question${Ps.length>2?"s":""}`})]}),C.jsxs("div",{className:"mb-2 flex flex-wrap items-start gap-2",children:[ar.some(Y=>Y.alive)&&C.jsx("span",{className:"min-w-0 flex-1 text-xs text-muted-foreground",children:ar.filter(Y=>Y.alive).map(Y=>C.jsxs(Ga,{href:It({loop:Y.id}),onNavigate:()=>tr({loop:Y.id}),className:"mr-2 hover:underline",children:[Y.name," · ",mP(Y)]},Y.id))}),C.jsx("div",{ref:g,className:"flex flex-wrap items-start gap-2"})]}),(ar.length>0||i.loop)&&C.jsxs("div",{className:"mb-2 flex items-center gap-3 text-xs text-muted-foreground",children:[C.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap",children:[gl>0&&C.jsx("span",{className:"size-1.5 animate-pulse rounded-full bg-blue-500"})," ",ar.length," loop",ar.length===1?"":"s"," · ",gl," running"]}),is>0&&C.jsxs("span",{className:"shrink-0 whitespace-nowrap font-medium text-amber-700 dark:text-amber-400",children:[is," need",is===1?"s":""," you"]}),C.jsxs("span",{className:"shrink-0 whitespace-nowrap font-mono",children:[(Qt/1e6).toFixed(2),"M tokens"]}),i.loop&&C.jsxs("span",{className:"ml-auto truncate",children:["👁 ",C.jsx("b",{className:"text-foreground",children:ar.find(Y=>Y.id===i.loop)?.name}),i.round?` R${i.round}`:""]})]}),C.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:(ar.length?["How are the loops doing?","What got rejected, and why?","What kinds of loops can you start?"]:["What kinds of loops can you start?","Make a slow function faster","Improve a landing page"]).map(Y=>C.jsx("button",{onClick:()=>Zi(Y),disabled:!!Vn||bo,className:"rounded-full border px-2.5 py-0.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:Y},Y))}),fl.map(Y=>C.jsxs("div",{role:"alert",className:"mb-2 rounded-lg border border-red-500/30 px-3 py-2 text-sm [overflow-wrap:anywhere]",children:[C.jsxs("p",{children:["Could not confirm sending: ",Y.error]}),C.jsx("p",{className:"text-xs text-muted-foreground",children:"Your message is saved. Review the chat before retrying."}),yn.trim()!==Y.text&&C.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:Y.text}),C.jsx("button",{type:"button",onClick:()=>Jr(Y),className:"mt-1 text-xs underline",children:yn.trim()===Y.text?"Keep draft and dismiss error":"Add saved message to draft"})]},Y.text)),C.jsxs("div",{className:"mb-3 flex flex-wrap items-start gap-2",children:[r&&C.jsx("button",{disabled:La,onClick:()=>zt({kind:"model",chat:r,epoch:ae.current}),className:"rounded-md border px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-muted disabled:opacity-40",children:"Chat model"}),C.jsx("div",{ref:x,className:"ml-auto flex flex-wrap items-start gap-2"})]}),C.jsxs("form",{onSubmit:Y=>{Y.preventDefault(),Ar(yn),Zi()},className:"relative rounded-xl border bg-background shadow-xs focus-within:ring-1 focus-within:ring-foreground/20",children:[xo&&C.jsx(wP,{inline:!0,items:vi,query:yn,onQuery:_u,onChoose:Rs,onClose:()=>Ar(yn),loading:tt,error:he,onRetry:()=>qe(Y=>Y+1),activeIndex:rt,onActiveIndex:qt}),C.jsx("textarea",{ref:pe,value:yn,"data-choice-ready":yn===""||bo&&ts.includes(yn)||void 0,onChange:Y=>{Y.target.value.startsWith("/")&&!yn.startsWith("/")&&qe(Ae=>Ae+1),_u(Y.target.value),qt(0),Ar(null)},role:"combobox","aria-autocomplete":"list","aria-expanded":xo,"aria-controls":xo?"slash-commands":void 0,"aria-activedescendant":xo&&Bs[rt]?`command-slash-${rt}`:void 0,"aria-label":"Message or slash command",onKeyDown:Y=>{if(!Y.nativeEvent.isComposing){if(xo&&["ArrowDown","ArrowUp","Escape","Enter"].includes(Y.key)&&!Y.shiftKey){Y.preventDefault(),Y.key==="Escape"?Ar(yn):Y.key==="ArrowDown"||Y.key==="ArrowUp"?qt(Ae=>(Ae+(Y.key==="ArrowDown"?1:-1)+Bs.length)%(Bs.length||1)):Bs[rt]?Rs(Bs[rt]):(Ar(yn),Zi());return}Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),Zi())}},placeholder:Vn?"working…":"Ask how the loops are going, give feedback, change direction…",rows:2,className:"block w-full resize-none bg-transparent px-3.5 py-3 pr-12 outline-none placeholder:text-muted-foreground/70"}),C.jsx("button",{type:"submit","aria-label":bo?"Sending message":"Send message",className:"absolute bottom-2.5 right-2.5 flex size-8 items-center justify-center rounded-lg bg-foreground text-background disabled:opacity-30",disabled:!yn.trim()||!!Vn||bo,children:C.jsx(Tte,{className:"size-4"})})]})]})})]}),!s&&ar.length>0&&C.jsx("nav",{"aria-label":"Loop runs",className:"hidden min-h-0 w-[172px] shrink-0 overflow-y-auto border-l md:block xl:w-[220px]",children:C.jsx("ul",{className:"flex flex-col gap-5 p-3",children:ar.map(Y=>C.jsx("li",{children:C.jsxs(Ga,{href:It({loop:Y.id}),onNavigate:()=>tr({loop:Y.id}),className:"group block w-full text-left",children:[C.jsxs("div",{className:"relative transition group-hover:-translate-y-0.5 group-hover:shadow-md",children:[C.jsx(gP,{run:Y,className:"w-full"}),qc(Y).length>0?C.jsx("span",{className:"absolute right-1.5 top-1.5 rounded-full bg-amber-500 px-1.5 py-px text-[10px] font-medium text-white ring-2 ring-background",children:"needs you"}):Y.alive&&C.jsx("span",{className:"absolute right-1.5 top-1.5 size-2 animate-pulse rounded-full bg-blue-500 ring-2 ring-background"})]}),C.jsxs("div",{className:"mt-1.5 flex items-baseline gap-2 text-xs",children:[C.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:Y.name}),C.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:sf(Y,Y.best.score)})]}),C.jsx("div",{className:`truncate text-[11px] ${qc(Y).length?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:qc(Y).length?`${qc(Y).length} question${qc(Y).length>1?"s":""} for you`:FE(Y)})]})},Y.id))})})]})]})]}),r&&C.jsx(dze,{chat:r,busy:!!Vn,runs:ar,host:da?k:b,loopHost:da?k:m},r),d&&C.jsxs(of,{title:"Repository details",onClose:()=>f(!1),children:[C.jsx("p",{className:"break-all font-mono text-sm",children:N.find(Y=>Y.id===I)?.path??"No workspace selected"}),C.jsx("button",{className:"mt-4 rounded-md border px-3 py-2",onClick:()=>f(!1),children:"Done"})]},I),F&&C.jsx(wP,{items:vi,query:$e,onQuery:ee,onChoose:Rs,onClose:()=>Ee(!1),loading:tt,error:he,info:r?void 0:"Select a chat to discover its Pi commands. No chat is created automatically.",onRetry:()=>qe(Y=>Y+1)}),Nt?.kind==="login"&&Nt.epoch===ae.current&&C.jsx(xze,{onClose:()=>zt(null),onConnected:()=>{qe(Y=>Y+1)}}),Nt?.kind==="model"&&Nt.chat&&Nt.epoch===ae.current&&C.jsx(vze,{chat:Nt.chat,busy:La,onClose:()=>zt(null),onChanged:()=>{ln()}}),Nt?.kind==="compact"&&Nt.chat&&Nt.epoch===ae.current&&C.jsxs(of,{title:"Compact session",onClose:()=>zt(null),children:[C.jsx("p",{className:"mb-3 text-sm",children:"Pi will summarize the current session to reduce context. This calls the chat’s model and uses model tokens. It does not create a chat or change loop settings."}),Pi&&C.jsxs("section",{role:Pi.status==="error"?"alert":"status",className:"mb-3 rounded-lg border p-3",children:[C.jsx("p",{className:"font-medium",children:Pi.title}),C.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:Pi.detail}),Pi.result!==void 0&&C.jsxs("details",{className:"mt-2",children:[C.jsx("summary",{className:"cursor-pointer text-xs",children:"Pi compaction result"}),C.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs",children:Pi.result})]})]}),C.jsxs("div",{className:"flex justify-end gap-2",children:[C.jsx("button",{onClick:()=>zt(null),className:"rounded-md border px-3 py-2",children:er?"Close":"Cancel"}),C.jsx("button",{disabled:La||vt||er,onClick:()=>{if(bt.current||!Nt.chat)return;const Y=Nt.chat,Ae=Nt.epoch;bt.current=!0,Sr(!0),Lr(!0),Xr(null),mr(ai?{...ai}:void 0),Ii("/api/compact",{method:"POST",json:{chat:Y},signal:ke.current?.signal}).then(()=>{Ae===ae.current&&(Xr("Request acknowledged. Waiting for Pi session status to confirm the outcome."),ln())}).catch(et=>{Ae===ae.current&&(Xr(`Compaction was not confirmed: ${et.message}. It may still be running. Check session status before any explicit retry; no automatic retry was sent.`),ln())}).finally(()=>{bt.current=!1,Ae===ae.current&&Sr(!1)})},className:"rounded-md bg-foreground px-3 py-2 text-background disabled:opacity-40",children:Pi?.status==="succeeded"?"Completed":vt?"Compacting…":"Compact — use model tokens"})]}),er&&C.jsx("button",{onClick:()=>{ln()},className:"mt-3 text-xs underline",children:"Refresh session status"})]}),rs&&C.jsx(rze,{chat:r??"",onClose:()=>ns(!1),onProviders:()=>{ns(!1),zt({kind:"login",chat:r,epoch:ae.current})},onPrompt:Y=>{ns(!1),Zi(Y)}}),da&&C.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col bg-muted/20 animate-in fade-in slide-in-from-right-4",children:[C.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2 pr-12 lg:hidden",children:[C.jsx("button",{onClick:()=>h(!0),className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted","aria-label":"Chats","aria-expanded":c,"aria-controls":"chat-sessions",children:C.jsx(Y9,{className:"size-4"})}),C.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:"Chat sessions"}),C.jsx("button",{"aria-label":"Commands",onClick:()=>{ee(""),Ee(!0),qe(Y=>Y+1)},className:"shrink-0 rounded-md border px-2 py-1 text-xs hover:bg-muted",children:"Commands"})]}),C.jsx(Ga,{href:It({}),onNavigate:go,title:"Close (Esc)",className:"absolute right-3 top-3 z-20 rounded-md p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:C.jsx(Gh,{className:"size-4"})}),C.jsx("div",{ref:w,className:"flex flex-wrap items-start gap-2 border-b px-4 py-3 pr-12"}),oi,C.jsx("div",{className:"min-h-0 flex-1",children:C.jsx(z$e,{runs:ar,focus:i,setFocus:tr,steer:si,onClose:go,onLiveChange:ln})})]})]})]})}hte.createRoot(document.getElementById("root")).render(C.jsx($.StrictMode,{children:C.jsx(Sze,{})}));const Eze=Object.freeze(Object.defineProperty({__proto__:null,Mermaid:AK},Symbol.toStringTag,{value:"Module"}));export{Gze as $,kje as A,Vi as B,Zo as C,pn as D,ppe as E,b_ as F,eH as G,lbe as H,ZMe as I,W1e as J,O1e as K,UM as L,HM as M,Vze as N,zze as O,Uze as P,Hze as Q,xi as R,Fze as S,s_ as T,Vt as U,qze as V,_je as W,$ze as X,qd as Y,Wze as Z,L as _,lpe as a,Hye as a$,jze as a0,pfe as a1,Dze as a2,VCe as a3,qCe as a4,Im as a5,Oze as a6,Lx as a7,Jye as a8,Yfe as a9,v2 as aA,hG as aB,Dx as aC,P_ as aD,$V as aE,xxe as aF,Ui as aG,u2e as aH,h_ as aI,mU as aJ,eB as aK,fm as aL,Fye as aM,Pye as aN,Iye as aO,Dye as aP,Eye as aQ,gU as aR,Nye as aS,Sye as aT,Rye as aU,yU as aV,Lye as aW,jye as aX,zye as aY,$ye as aZ,Uye as a_,dH as aa,V0 as ab,TM as ac,Ux as ad,F1e as ae,CT as af,obe as ag,co as ah,Pe as ai,Fe as aj,rpe as ak,pH as al,IV as am,I_ as an,$B as ao,pg as ap,bye as aq,g_ as ar,xt as as,cje as at,lje as au,jCe as av,xr as aw,cG as ax,Ct as ay,oje as az,ope as b,Nve as b$,Aye as b0,bU as b1,Oye as b2,Bye as b3,Mye as b4,xU as b5,HV as b6,EU as b7,Vj as b8,D1e as b9,Fve as bA,XV as bB,T3e as bC,c4e as bD,Ave as bE,Pve as bF,w3e as bG,$h as bH,bf as bI,ic as bJ,cR as bK,Jo as bL,Ul as bM,x3e as bN,JB as bO,x2 as bP,Xl as bQ,Lve as bR,Sa as bS,nR as bT,j_ as bU,vCe as bV,$x as bW,b2 as bX,yCe as bY,lG as bZ,qo as b_,Rze as ba,V2 as bb,ho as bc,yye as bd,Ize as be,r_ as bf,Kc as bg,$m as bh,IM as bi,pge as bj,Tt as bk,uU as bl,_a as bm,oge as bn,t_ as bo,AH as bp,fg as bq,MH as br,Pze as bs,w0e as bt,F_ as bu,$_ as bv,YB as bw,YV as bx,Fx as by,WV as bz,ur as c,G_ as c0,VV as c1,CCe as c2,bCe as c3,lCe as c4,Px as c5,eG as c6,Hx as c7,tG as c8,cCe as c9,s4e as ca,rh as cb,em as cc,i0 as cd,Ty as ce,YC as cf,LCe as cg,nxe as ch,Q as ci,fH as d,mi as e,Zl as f,upe as g,RV as h,Es as i,C as j,Kt as k,De as l,hg as m,LU as n,ug as o,kye as p,hpe as q,$ as r,cpe as s,dpe as t,spe as u,Yze as v,hbe as w,au as x,v0e as y,Tje as z};
|