@agimon-ai/po-cloudflare 0.0.2-alpha.13 → 0.0.2-alpha.15
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/{agent-DYFqCLl2.js → agent-DTjnYFAN.js} +1 -1
- package/dist/{apiContracts-CDJ9sPkE.js → apiContracts-DepyzMNr.js} +80 -80
- package/dist/{approval-BSX-MRTE.js → approval-Biq3NCWj.js} +2 -2
- package/dist/{approvalPrompt-1FPgNwMA.js → approvalPrompt-DoHlIPkU.js} +2 -2
- package/dist/assets/assets/{CodeEditorView-h_xe1UJU.js → CodeEditorView-CwbnhMdA.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-DDdlyJrb.js → abnfDiagram-WEYOIA3C-CHNJg3MT.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-x6IR7rBA.js → architecture-WOLXFQ4H-DyY-mL57.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-Byzzrb1I.js → architectureDiagram-ZHVYKT53-DAmYv-wl.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-BaA8lxBI.js → blockDiagram-RJAE7QA3-D3b-qGaj.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-CjuzAtkj.js → c4Diagram-XDPPPE54-DWlB2YrZ.js} +2 -2
- package/dist/assets/assets/channel-CxmAFINg.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-BSKphbwa.js → chunk-2E7WHVMD-25JA89WA.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-BU9JMt7X.js → chunk-4EMNKR2T-DtIGivhN.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CN6ZaT2n.js → chunk-55XCU76K-CZgd1X4f.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-BCyoT8SS.js → chunk-7S6XSTFO-ZPC-jzOu.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-CGDxScjE.js → chunk-AQDTSKZB-HuXQEJ0Y.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-D7PyFZYQ.js → chunk-DSNLSHJZ-DyyXCNh6.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-CXq7ApM-.js → chunk-HAGFOTED-CO80Pld1.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-CPYiMdDp.js → chunk-HNE4Q36P-Irin3wRJ.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-B_vl6qXP.js → chunk-NQOKRVIF-Dip7Ab8s.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-C-LHs5I5.js → chunk-UHW7PFBP-Cl9mRLzP.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-DHKzZI3A.js → chunk-VQ5W62QI-DgYuTmZQ.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-DnpYl5Ue.js → chunk-WQQL4CDK-BqHJLjHL.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-CJfKl316.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-BapPpuua.js → chunk-YZO67HFG-DutTp5Gm.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-CR7C-KoP.js → chunk-ZAUX2LTX-B_VX-mAd.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-CJZ4YysD.js → chunk-ZCHMQSOR-CKGinFsU.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-BNR2sMZj.js → classDiagram-v2-4MYWR3UA-D-Y3jX3x.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-d4L13wmM.js → cose-bilkent-JH36ORCC-C7NHmyLp.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-CgjKQ2wc.js → cynefin-EF2NZ3EQ-PMuf45vU.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-DtWQ8S8A.js → cynefinDiagram-WF24UDRP-DowrjbAT.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-CUNbT4H0.js → dagre-NK4GIZVX-BAIzEaka.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-BhsdNnti.js → diagram-CBK3MWTC-D0Czl2Ag.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-Cr68iKL4.js → diagram-I5XIIV2D-DFeqxsMK.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-DfaBisiv.js → diagram-ODIL2UCW-AOUguWbV.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-Bhp28TWu.js → diagram-PFBEJUXE-CA1cSt8a.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-Cen3NRx1.js → diagram-RJA3I4VV-B0u2juqJ.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-Dj4JKR8a.js → diagram-TYUNFSNR-es0LzaB8.js} +2 -2
- package/dist/assets/assets/{dist-CZmUvmAF.js → dist-BLQ7nnrh.js} +2 -2
- package/dist/assets/assets/{dist-CYdwEnPD.js → dist-BskON3r9.js} +2 -2
- package/dist/assets/assets/{dist-DUzzYLG8.js → dist-CXvoTeFe.js} +2 -2
- package/dist/assets/assets/{dist-B0srxbs3.js → dist-CdxMcTMT.js} +2 -2
- package/dist/assets/assets/{dist-4J5bU5cD.js → dist-Cp0KQVwU.js} +2 -2
- package/dist/assets/assets/{dist-DRrjAKQ8.js → dist-DHg2eGm9.js} +2 -2
- package/dist/assets/assets/{dist-DMqunHta.js → dist-DtPgUq6U.js} +2 -2
- package/dist/assets/assets/{dist-D0ii-m5d.js → dist-DwtF7q4e.js} +2 -2
- package/dist/assets/assets/{dist-Bxzqghpf.js → dist-HHSi5Pa8.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-fifrsTZ8.js → ebnfDiagram-V4P3TTPT-PyNabPMn.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-B-gK4R6G.js → elk-QONTBCTQ-CBhXV7nb.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-DxFcJ8Gb.js → erDiagram-KYQIGQAA-D6Doh0oj.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-Cr1DPcrt.js → eventmodeling-K75KTNOO-Bqcnmw1J.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-mBLhK-es.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-uH4ZFlQE.js → ganttDiagram-R7GPNTJY-Ci8zfIAD.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-BzfRujF5.js → gitGraph-VSP46ZUC-1sECbRbw.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-B7MorrfJ.js → gitGraphDiagram-PDYL7XHY-DToXoQsv.js} +2 -2
- package/dist/assets/assets/{index-CMZb-g_r.js → index-B7gbu-ML.js} +7 -7
- package/dist/assets/assets/{info-OHQRW6UA-Dfn541Im.js → info-OHQRW6UA-BlA5SoJx.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-CELYuiOm.js → infoDiagram-MVDRKAX5-BDWxp3Ha.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-XUl-Hr0g.js → ishikawaDiagram-HPEHV2GE-F4S899E1.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-gmxMN7KY.js → journeyDiagram-BOSHW7O7-CvoI9Nsf.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-hYbMpxdQ.js → kanban-definition-FNSA4HC5-CnSJXuYT.js} +2 -2
- package/dist/assets/assets/{line-eStYUf1q.js → line-DhD-9yAH.js} +2 -2
- package/dist/assets/assets/{linear-DPDvRE44.js → linear-B-SQzEcY.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-zFTETYCU.js → mermaid-parser.core-B5A9rCTB.js} +4 -4
- package/dist/assets/assets/{mermaid.core-Bkht5CEJ.js → mermaid.core-DNUNsYna.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-CZ9623cU.js → mindmap-definition-6OY57UG3-BIy7hTKR.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-B2oHDZuP.js → packet-JDAUHWVQ-7Z0kK0Bg.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-CZgc0fZ6.js → pegDiagram-ECIUJNBX-Di9m0F_u.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-BBSikIUV.js → pie-XZMESJXO-C3iKOmXD.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-Ch_cxp2m.js → pieDiagram-GNMPY74T-Px8II-Db.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-OYq6X-8G.js → quadrantDiagram-D57K4MC3-SosgMm5z.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-CRfcXanu.js → radar-ABXABTNO-B4qm97Pf.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-D1XymudG.js → railroad-I3PHUGI6-d2qfxO5G.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-k0hgtxQk.js → railroad-abnf-LNEFI6M7-TDZHyV6i.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-C-QyXDks.js → railroad-ebnf-DWYD2UWJ-NcQ9gUMJ.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-BuHnYaiY.js → railroad-peg-JR7BVNR7-Bb-t8Vbs.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-D9N-pNww.js → railroadDiagram-Y72NRBL7-DgLmH4DZ.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-qf-1Zblj.js → requirementDiagram-EQYSW5RA-auaJ7ZvR.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-D8wE86jL.js → sankeyDiagram-SY24JHO5-B2R-eq3C.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-74mVMj0m.js → sequenceDiagram-BLEHNHQU-CNufgwlS.js} +2 -2
- package/dist/assets/assets/{src-zg274ZWT.js → src-B8irHfML.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-DIBiESyI.js → stateDiagram-v2-A6IESKWZ-DnOwGwvs.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-pUHRnBcg.js → swimlanes-B3ENRKFQ-Dse-rWzV.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-C-6oBziD.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-B0dcIPgn.js → timeline-definition-JXYKGLGB-B82nGDHO.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-xackbunK.js → treeView-D4JQ5SDB-CRJbThh1.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-qiDqJfbc.js → treemap-SAJKECNS-BcJkKL_S.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-Bokdfw2g.js → usecaseDiagram-WPOLBNNX-BhL8YMbv.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-D0ObPPH8.js → vennDiagram-Q3Y3IDCW-CzmROCxJ.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-CYyy9ZPM.js → wardley-7MLQ67FV-DR9Tfc02.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-zo5nETrV.js → wardleyDiagram-IVAIDKWA-BxEA5YVI.js} +2 -2
- package/dist/assets/assets/{webpack-D_Ha02Xw.js → webpack-C_MATgNb.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-CYtidI4I.js → xychartDiagram-4URNHDU4-DobsgzbD.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +1 -1
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/{atomicJson-BF1fVXy1.js → atomicJson-DCIsEywH.js} +3 -3
- package/dist/{backgroundWork-BaczP3Z1.js → backgroundWork-Bswjs1av.js} +1 -1
- package/dist/{codemode-CZ_eYTwm.js → codemode-CgVosRtU.js} +1 -1
- package/dist/{contracts-CnRs-Twx.js → contracts-CylyLZC8.js} +1 -1
- package/dist/{domains-Bl6T2dKV.js → domains-BqChtBLN.js} +23 -5
- package/dist/{exports-DlcCEAe3.js → exports-DERO0cQf.js} +760 -147
- package/dist/{exports-CxkWsXI9.js → exports-wbNFqW1I.js} +9 -9
- package/dist/{extensionFile-D7wk8tFr.js → extensionFile-Ds7RCpnb.js} +1 -1
- package/dist/{harnessStore-flLz1I0F.js → harnessStore-BectazJQ.js} +4 -4
- package/dist/harnessStore-C0Zwvny8.js +1 -0
- package/dist/{help-DjybmnPW.js → help-Dpm82qDr.js} +2 -2
- package/dist/{hubChannel-Bi3PQrfD.js → hubChannel-COvmdWGO.js} +4 -2
- package/dist/{index.edge-CJ2TFpgF.js → index.edge-B0D_Lgbx.js} +2 -2
- package/dist/{index.edge-C9_xuXyy.js → index.edge-BLmsRNW8.js} +2 -2
- package/dist/{index.edge-uSjRpm6Z.js → index.edge-b0z7PQ6b.js} +1 -1
- package/dist/{layeredConfig-B4s0eZ5o.js → layeredConfig-pQGjhAks.js} +92 -6
- package/dist/{majorModes-IygGmbb8.js → majorModes-BrL4EtzH.js} +5 -14
- package/dist/majorModes-WXt22_km.js +1 -0
- package/dist/{mcpProjection-BA6baFpi.js → mcpProjection-pbPBBuvs.js} +2 -2
- package/dist/{notification-bGq1frYG.js → notification-CINsJWDL.js} +7 -4
- package/dist/{piConfig-CcoMX-1L.js → piConfig-BDUpA6w0.js} +5 -5
- package/dist/piSettings-tdui0CZI.js +1 -0
- package/dist/{platform-CyvF7X-b.js → platform-yhQXrrM_.js} +1 -1
- package/dist/{platformFiles-Ccj9HCvA.js → platformFiles-DB3Cw1l_.js} +1 -1
- package/dist/{protocol-Q7TFrOIs.js → protocol-B6LbEIe6.js} +2 -2
- package/dist/{server-C9gff7gU.js → server-B2G-c0hg.js} +5 -5
- package/dist/{server-CIhwIcbA.js → server-B8P-UkxF.js} +14 -5
- package/dist/{server-CxGGQFJs.js → server-BQABuCfr.js} +7 -7
- package/dist/{server-il_s2Ycz.js → server-BXFDsLgm.js} +340 -44
- package/dist/{server-C82Qzoh3.js → server-Bf1Y5E15.js} +10 -10
- package/dist/{server-Co57A8MH.js → server-Bt6Zsqo8.js} +2 -2
- package/dist/{server-CjsKNdSN.js → server-CCwwnpH0.js} +5 -5
- package/dist/{server-4CmqIbH2.js → server-CbcLCzQF.js} +55 -14
- package/dist/{server-COE7BKSa.js → server-Ci_BGVwd.js} +3 -3
- package/dist/{server-CTSvwoDy.js → server-CyYesT-G.js} +9 -9
- package/dist/{server-ziNfBZ2M.js → server-CzJjYgVk.js} +3 -3
- package/dist/{server-CQXqMpeC.js → server-DFCXmDed.js} +117 -55
- package/dist/{server-CMaTba5B.js → server-DL6UyXfJ.js} +8 -8
- package/dist/{server-5vLvBTTs.js → server-DPTp6GXS.js} +4 -4
- package/dist/{server-C_34VM3M.js → server-DRcCuj6P.js} +4 -4
- package/dist/{server-CcNMwEFQ.js → server-Dgn4el5K.js} +5 -5
- package/dist/{server-DSu_uLDX.js → server-DhkR6ugd.js} +6 -6
- package/dist/{server-C8HyW7wN.js → server-GIQIpf33.js} +8 -8
- package/dist/{server-CpJNq249.js → server-Ki0zw2Ro.js} +11 -11
- package/dist/{server-C_3jK2WM.js → server-MdXt445f.js} +41 -13
- package/dist/{server-DeSuziRK.js → server-OerXqXJT.js} +4 -4
- package/dist/{server-ZsazKk-n.js → server-V8W5mcGu.js} +6 -6
- package/dist/{server-Bm6pAAw8.js → server-_0288DYR.js} +4 -4
- package/dist/{server-BHhb0oir.js → server-cStfn1Yv.js} +4 -4
- package/dist/{server-ClsNJwdv.js → server-pY027myK.js} +14 -14
- package/dist/{serverPlugin-pCqlBqQG.js → serverPlugin-OOfjB8tm.js} +1114 -1111
- package/dist/{sessionConfig-DzAs6Pt-.js → sessionConfig-CDE3J31u.js} +263 -55
- package/dist/{validation-CkjZwpf-.js → validation-DuOGOKEi.js} +2 -2
- package/dist/{value-DGT5IoiK.js → value-DyVsxCwZ.js} +1 -1
- package/dist/{vaultSettings-BRr8n821.js → vaultSettings-BFCRCBM3.js} +1 -1
- package/dist/web-cN41ySs9.js +3 -0
- package/dist/worker.js +15830 -1106
- package/dist/workflow-BgwWq0nq.js +79 -0
- package/package.json +32 -32
- package/dist/assets/assets/channel-Bv5Xg5j2.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-Dx3Rd1jG.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BatlEhjt.js +0 -1
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-C4juagrq.js +0 -9
- package/dist/contextProjection-DlB6wzhm.js +0 -209
- package/dist/harnessStore-Bap8lsAg.js +0 -1
- package/dist/majorModes-xpLK9HpD.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/web-Cfvbn9H1.js +0 -3
- package/dist/workflow-w5JPZXgc.js +0 -23
- /package/dist/assets/plugins/slots/{approval.8b3f37d9-CqQk6XG_.js → approval.09e72f36-CqQk6XG_.js} +0 -0
- /package/dist/assets/plugins/slots/{artifacts.47d00f81-D-vQ-7Iz.js → artifacts.50b639bb-D-vQ-7Iz.js} +0 -0
- /package/dist/assets/plugins/slots/{autocompact.9a92993d-B3KTYwW1.js → autocompact.6f428144-B3KTYwW1.js} +0 -0
- /package/dist/assets/plugins/slots/{builtin-tools.939bbfff-CZRYQVIP.js → builtin-tools.75108f21-CZRYQVIP.js} +0 -0
- /package/dist/assets/plugins/slots/{codemode.782e5bb1-Bzl_K_vt.js → codemode.c58fb583-Bzl_K_vt.js} +0 -0
- /package/dist/assets/plugins/slots/{domain.21790b66-CvnpuKCY.js → domain.753f9f92-CvnpuKCY.js} +0 -0
- /package/dist/assets/plugins/slots/{edit.c7c85129-kaxIknZ-.js → edit.804fec90-kaxIknZ-.js} +0 -0
- /package/dist/assets/plugins/slots/{files.bbcef824-wuB8gcQA.js → files.66ffc636-wuB8gcQA.js} +0 -0
- /package/dist/assets/plugins/slots/{grep.3dfd3214-3FnU8p-d.js → grep.98262cff-3FnU8p-d.js} +0 -0
- /package/dist/assets/plugins/slots/{log.33bc7d38-C0PXQ0O1.js → log.cb964209-C0PXQ0O1.js} +0 -0
- /package/dist/assets/plugins/slots/{mcp.59c68bcb-D0CkHnIw.js → mcp.82cc1ff5-D0CkHnIw.js} +0 -0
- /package/dist/assets/plugins/slots/{profile.ea55f5e1-BSY3iYfJ.js → profile.ab16dcec-BSY3iYfJ.js} +0 -0
- /package/dist/assets/plugins/slots/{prompts.9957cc84-xdCkNkoA.js → prompts.ae48c07a-xdCkNkoA.js} +0 -0
- /package/dist/assets/plugins/slots/{read.30a617e7-qqaxVlEX.js → read.4560591a-qqaxVlEX.js} +0 -0
- /package/dist/assets/plugins/slots/{runner.9f3559b0-DfO2Z9HG.js → runner.6e494d59-DfO2Z9HG.js} +0 -0
- /package/dist/assets/plugins/slots/{skill.f506a5ea-CL_n-l4h.js → skill.62a0a1b3-CL_n-l4h.js} +0 -0
- /package/dist/assets/plugins/slots/{vault.01657352-DbG3F_on.js → vault.3cbfcdc3-DbG3F_on.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DwtF7q4e.js","assets/dist-C1hGqmUi.js","assets/rolldown-runtime-COiEfhsA.js","assets/dist-BskON3r9.js","assets/dist-CmiBJZOk.js","assets/dist-CXvoTeFe.js","assets/dist-Cp0KQVwU.js","assets/dist-DtPgUq6U.js","assets/dist-CdxMcTMT.js","assets/dist-DHg2eGm9.js","assets/dist-BLQ7nnrh.js","assets/dist-HHSi5Pa8.js","assets/mermaid.core-DNUNsYna.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B8irHfML.js","assets/chunk-DSNLSHJZ-DyyXCNh6.js","assets/chunk-7S6XSTFO-ZPC-jzOu.js","assets/dist-CumnGVmJ.js","assets/chunk-YZO67HFG-DutTp5Gm.js","assets/chunk-AQDTSKZB-HuXQEJ0Y.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-UHW7PFBP-Cl9mRLzP.js","assets/chunk-HAGFOTED-CO80Pld1.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-ZAUX2LTX-B_VX-mAd.js","assets/chunk-WQQL4CDK-BqHJLjHL.js","assets/line-DhD-9yAH.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-HNE4Q36P-Irin3wRJ.js","assets/CodeEditorView-CwbnhMdA.js","assets/xterm-BrP-ENHg.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{i as e,n as t,t as n}from"./rolldown-runtime-COiEfhsA.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=`/api/remote`,i=`${r}/channel`,a=`${r}/request`,o=`${r}/trusted-devices`,s=`${r}/push`,c=`${s}/key`,l=`po://pair?link=`,u=`x-po-assertion`,d=`/bundle-manifest.json`,f=`/index.html`,p=`/composition.js`,m=`text/javascript`,h=4194304,g=/^\/[A-Za-z0-9._-]+\.js$/u,_=/^po\/[a-z0-9-]+\/v[1-9][0-9]*$/u,v=/^[0-9a-f]{64}$/u,y=/^[A-Za-z0-9_-]+$/u,b=/^[a-z0-9][a-z0-9!#$&^_.+-]*\/[a-z0-9][a-z0-9!#$&^_.+-]*$/u;function x(e,t){let n=Object.keys(e).sort();return n.length===t.length&&n.every((e,n)=>e===t[n])}function S(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=t}function C(e){return typeof e!=`string`||e.length<2||!e.startsWith(`/`)||e.includes(`\\`)||e.includes(`\0`)||e.includes(`?`)||e.includes(`#`)||/[^\x21-\x7e]/u.test(e)||e.includes(`//`)||/%(?![0-9a-f]{2})/iu.test(e)||/%(?:2e|2f|5c)/iu.test(e)?!1:e.split(`/`).slice(1).every(e=>e!==``&&e!==`.`&&e!==`..`)}function w(e){let t=[...e.assets].sort((e,t)=>e.path<t.path?-1:+(e.path>t.path)).map(e=>`${e.path}\0${e.sha256}\0${String(e.byteLength)}\0${e.contentType}`);return[String(e.version),String(e.revision),String(e.builtAt),...t].join(`
|
|
3
3
|
`)}function T(e,t){if(!_.test(e))throw Error(`invalid attestation tag: ${e}`);if(!Array.isArray(t)||!t.every(e=>typeof e==`string`))throw Error(`invalid attestation fields for ${e}`);return new TextEncoder().encode(`${e}\n${JSON.stringify(t)}`)}function E(e,t,n){return n===`web`?t.has(f):n===`native`&&e.every(e=>g.test(e.path)&&e.contentType===`text/javascript`&&e.byteLength<=4194304)}function D(e,t=`web`){if(typeof e!=`object`||!e||!x(e,[`assets`,`builtAt`,`revision`,`version`]))return!1;let n=e;if(n.version!==2||!S(n.revision,1)||!S(n.builtAt,0)||!Array.isArray(n.assets)||n.assets.length===0)return!1;let r=new Set;for(let e of n.assets){if(typeof e!=`object`||!e||!x(e,[`byteLength`,`contentType`,`path`,`sha256`]))return!1;let t=e;if(!C(t.path)||r.has(t.path)||typeof t.sha256!=`string`||!v.test(t.sha256)||!S(t.byteLength,0)||typeof t.contentType!=`string`||!b.test(t.contentType))return!1;r.add(t.path)}return E(n.assets,r,t)}function O(e,t=`web`){if(typeof e!=`object`||!e||!x(e,[`manifest`,`publicKey`,`signature`]))return!1;let n=e;return D(n.manifest,t)&&typeof n.signature==`string`&&n.signature.length===86&&y.test(n.signature)&&typeof n.publicKey==`string`&&n.publicKey.length<=512&&y.test(n.publicKey)}function k(e,t){return e.assets.find(e=>e.path===t)}function A(e,t){return k(e,t)?.sha256}function j(e){let t=e.replaceAll(`-`,`+`).replaceAll(`_`,`/`),n=t.padEnd(Math.ceil(t.length/4)*4,`=`),r=atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e+=1)i[e]=r.charCodeAt(e);return i.buffer}function M(e){return[...new Uint8Array(e)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}var N=/^[A-Za-z0-9_-]+$/u;function P(e){return crypto.subtle.importKey(`spki`,j(e),{name:`ECDSA`,namedCurve:`P-256`},!1,[`verify`])}async function ee(e,t,n=0,r=`web`){if(!O(e,r))return{ok:!1,failure:{code:`invalid-envelope`}};let i=e;if(i.publicKey!==t)return{ok:!1,failure:{code:`untrusted-public-key`}};if(!Number.isSafeInteger(n)||n<0||i.manifest.revision<n)return{ok:!1,failure:{code:`stale-revision`,minimumRevision:n,actualRevision:i.manifest.revision}};let a;try{a=await P(t)}catch{return{ok:!1,failure:{code:`invalid-public-key`}}}try{return await crypto.subtle.verify({name:`ECDSA`,hash:`SHA-256`},a,j(i.signature),new TextEncoder().encode(w(i.manifest)))?{ok:!0,manifest:i.manifest}:{ok:!1,failure:{code:`invalid-signature`}}}catch{return{ok:!1,failure:{code:`invalid-signature`}}}}async function F(e,t,n,r){let i=T(t,n);if(typeof e!=`string`||e.length===0||e.length>512||!N.test(e)||typeof r!=`string`||r.length!==86||!N.test(r))return!1;try{let t=await P(e);return await crypto.subtle.verify({name:`ECDSA`,hash:`SHA-256`},t,j(r),i)}catch{return!1}}async function te(e,t,n){let r=k(e,t);return r===void 0?{ok:!1,failure:{code:`asset-not-listed`,path:t}}:n.byteLength===r.byteLength?M(await crypto.subtle.digest(`SHA-256`,n))===r.sha256?{ok:!0}:{ok:!1,failure:{code:`digest-mismatch`}}:{ok:!1,failure:{code:`byte-length-mismatch`,expected:r.byteLength,actual:n.byteLength}}}var ne=2**32,re=`po/sealed/c2s/v1`,ie=`po/sealed/s2c/v1`;function ae(e){return e===`c2s`?re:ie}function oe(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.v===1&&typeof t.n==`string`&&typeof t.c==`string`}function se(e){switch(e){case`version`:return`The other end is speaking a different envelope version.`;case`malformed`:return`A sealed message was not shaped like one.`;case`replay`:return`A sealed message arrived out of order or twice.`;case`auth`:return`A sealed message failed its authentication tag, so it was altered in transit.`;case`exhausted`:return`This channel reached its message limit and must be re-established.`}}var ce={name:`ECDH`,namedCurve:`P-256`},le=`AES-GCM`;function ue(e){let t;try{t=atob(e.replaceAll(`-`,`+`).replaceAll(`_`,`/`))}catch{return}let n=new Uint8Array(new ArrayBuffer(t.length));for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}function de(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replaceAll(`=`,``)}function fe(e){let t=new Uint8Array(new ArrayBuffer(e.length));return t.set(e),t.buffer}async function pe(e,t){let n=await crypto.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveKey`]);return await crypto.subtle.deriveKey({name:`HKDF`,hash:`SHA-256`,salt:fe(new TextEncoder().encode(`po/sealed/v1`)),info:fe(new TextEncoder().encode(ae(t)))},n,{name:le,length:256},!1,[`encrypt`,`decrypt`])}function me(e,t){let n=new Uint8Array(12);return n.set(e.subarray(0,4),0),new DataView(n.buffer).setBigUint64(4,t,!1),n}function he(e,t,n){let r=0n,i=-1n;return{async seal(t){if(r>=BigInt(ne))return{ok:!1,failure:`exhausted`};let i=me(n,r),a=await crypto.subtle.encrypt({name:le,iv:fe(i),tagLength:128},e,fe(t));return r+=1n,{ok:!0,envelope:{v:1,n:de(i),c:de(new Uint8Array(a))}}},async open(e){let n=e;if(typeof n?.n!=`string`||typeof n.c!=`string`)return{ok:!1,failure:`malformed`};if(n.v!==1)return{ok:!1,failure:`version`};if(!oe(e))return{ok:!1,failure:`malformed`};let r=ue(e.n),a=ue(e.c);if(r===void 0||a===void 0||r.length!==12||a.length<16)return{ok:!1,failure:`malformed`};let o=new DataView(fe(r)).getBigUint64(4,!1);if(o<=i)return{ok:!1,failure:`replay`};let s;try{s=await crypto.subtle.decrypt({name:le,iv:fe(r),tagLength:128},t,fe(a))}catch{return{ok:!1,failure:`auth`}}return o<=i?{ok:!1,failure:`replay`}:(i=o,{ok:!0,plaintext:new Uint8Array(s)})}}}async function ge(e){if(globalThis.crypto?.subtle!==void 0)try{let t=await crypto.subtle.generateKey(ce,!1,[`deriveBits`]),n=ue(e);if(n===void 0)return;let r=await crypto.subtle.importKey(`raw`,fe(n),ce,!1,[]),i=await crypto.subtle.deriveBits({name:`ECDH`,public:r},t.privateKey,256),a=de(new Uint8Array(await crypto.subtle.exportKey(`raw`,t.publicKey)));return{channel:he(await pe(i,`c2s`),await pe(i,`s2c`),new Uint8Array(4)),clientPublicKey:a}}catch{return}}async function _e(e,t,n){return he(await pe(e,t),await pe(e,t===`c2s`?`s2c`:`c2s`),n)}var ve,ye;function be(e,t){return ve=e,ye=t,()=>{ve===e&&(ve=void 0,ye=void 0)}}async function xe(e,t){if(!ye)throw Error(`Client identity name updates are unavailable.`);await ye(e,t)}function Se(){return ve?.()}async function Ce(e,t){let n=await t();if(n.status===404)return;if(!n.ok)throw Error(`Client device refresh failed (${n.status}).`);let r=await n.json();if(typeof r!=`object`||!r||!(`devices`in r)||!Array.isArray(r.devices))return;let i=r.devices.find(t=>typeof t==`object`&&!!t&&`deviceId`in t&&t.deviceId===e.current().deviceId);typeof i==`object`&&i&&`deviceName`in i&&`nameUpdatedAt`in i&&(typeof i.deviceName!=`string`||typeof i.nameUpdatedAt!=`number`||!Number.isSafeInteger(i.nameUpdatedAt)||i.nameUpdatedAt<0||await e.updateName(i.deviceName,i.nameUpdatedAt))}var we=`po.client.device.v1`,Te=`po.client.instance.v1`;async function Ee(e){let t={...e.initial},n=!0,r=new Set;try{await e.exclusive(async()=>{let n=e.parse(await e.read());if(n)t={...n,...t.instanceId?{instanceId:t.instanceId}:{}};else{let{instanceId:n,...r}=t;await e.write(r)}})}catch{n=!1}return{current:()=>({...t}),persistent:()=>n,subscribe(e){return r.add(e),()=>r.delete(e)},async updateName(i,a){let o=e.normalizeName(i);if(!o)throw Error(`Enter a device name from 1 to 64 characters.`);let s=a??Math.max(e.now(),t.nameUpdatedAt+1);if(!Number.isSafeInteger(s)||s<0)throw Error(`Invalid device name timestamp.`);if(s<t.nameUpdatedAt||s===t.nameUpdatedAt&&o===t.deviceName)return;let c=async()=>{let n=e.parse(await e.read());if(n&&n.deviceId===t.deviceId&&n.nameUpdatedAt>t.nameUpdatedAt&&(t={...t,deviceName:n.deviceName,nameUpdatedAt:n.nameUpdatedAt}),s<t.nameUpdatedAt||s===t.nameUpdatedAt&&o===t.deviceName)return;let r={...t,deviceName:o,nameUpdatedAt:s},{instanceId:i,...a}=r;await e.write(a),t=r};if(n)try{await e.exclusive(c)}catch{n=!1,t={...t,deviceName:o,nameUpdatedAt:s}}else t={...t,deviceName:o,nameUpdatedAt:s};for(let e of r)e()}}}async function De(e){let t=e.randomId(),n=!0;try{let n=e.sessionStorage.getItem(Te);if(e.isToken(n)&&n&&await e.claimInstance(n))t=n;else if(!await e.claimInstance(t))throw Error(`The tab identity could not be claimed.`);e.sessionStorage.setItem(Te,t)}catch{n=!1}let r=await Ee({...e,initial:{...e.initial,instanceId:t},read:async()=>{let t=e.localStorage.getItem(we);return t===null?void 0:JSON.parse(t)},write:async t=>e.localStorage.setItem(we,JSON.stringify(t)),exclusive:t=>e.exclusive(we,t)}),i=r.current(),a=new Set,o=()=>{for(let e of a)e()},s=r.subscribe(()=>{i=r.current(),o()}),c=e.onStorage(()=>{try{let t=e.localStorage.getItem(we),n=t===null?void 0:e.parse(JSON.parse(t));n&&n.deviceId===i.deviceId&&(n.nameUpdatedAt>i.nameUpdatedAt||n.nameUpdatedAt===i.nameUpdatedAt&&n.deviceName!==i.deviceName)&&(i={...i,deviceName:n.deviceName,nameUpdatedAt:n.nameUpdatedAt},o())}catch{n=!1}});return{current:()=>({...i}),persistent:()=>n&&r.persistent(),async updateName(t,n){await r.updateName(t,n??Math.max(e.now(),i.nameUpdatedAt+1))},subscribe(e){return a.add(e),()=>a.delete(e)},dispose(){c(),s(),a.clear()}}}function Oe(){let e=Promise.resolve();return{run(t){let n=e.then(t,t);return e=n.catch(()=>void 0),n}}}function ke(e,t){if(/[\\\\\u0000-\u0020]/u.test(e)||e.startsWith(`//`))return t;let n=typeof location>`u`?void 0:location,r=n?.origin??`https://po.invalid`;if(!n&&!e.startsWith(`/`))return t;let i=new URL(e,r);if(i.origin!==r||i.username||i.password||!/^\/(?:api(?:\/|$)|hosts\/[^/]+\/api(?:\/|$))/u.test(i.pathname)||/\/api\/web-plugins(?:\/|$)/u.test(i.pathname)||i.pathname.endsWith(`/api/remote/request`))return t;let a=Se();if(!a)return t;let o=new Headers(t?.headers);return o.set(`x-po-client-metadata`,a),{...t,headers:o,redirect:`error`}}var Ae=new TextEncoder,je=new TextDecoder;function Me(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function Ne(e){let t=atob(e);return Uint8Array.from(t,e=>e.charCodeAt(0))}async function Pe(e){if(e!=null){if(typeof e==`string`)return Ae.encode(e);if(e instanceof URLSearchParams)return Ae.encode(e.toString());if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`The sealed HTTP transport does not support this request body type.`)}}function Fe(e){if(!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`))throw Error(`A sealed HTTP request must use a root-relative URL.`);return e}function Ie(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.v===1&&typeof t.status==`number`&&Array.isArray(t.headers)&&t.headers.every(e=>Array.isArray(e)&&e.length===2&&e.every(e=>typeof e==`string`))&&typeof t.body==`string`}function Le(){let e,t,n,r=!1,i=Oe(),a=Oe(),o=Oe(),s,c=e=>{t=se(e)},l=async t=>{if(e===void 0)return;let n=await e.seal(t);return n.ok?JSON.stringify(n.envelope):c(n.failure)},u=async t=>{if(e===void 0)return;let n;try{n=JSON.parse(t)}catch{return c(`malformed`)}let r=await e.open(n);return r.ok?r.plaintext:c(r.failure)};return{active:()=>e!==void 0,invalidate(){r=!0},onAuthorizationFailure(e){n=e},lastFailure:()=>t,async connect(n){let i=await ge(n);if(i===void 0)t=`This browser could not establish a sealed channel.`;else return e=i.channel,r=!1,t=void 0,i.clientPublicKey},relayRequestsThrough(e){s=e},reset(){r=!1,e=void 0,t=void 0},async sealText(n){if(r)throw Error(`Sign in to Po again.`);return e===void 0?n:await i.run(async()=>{let e=await l(Ae.encode(n));if(e===void 0)throw Error(t??`The active sealed channel could not encrypt a message.`);return e})},async openText(t){if(r)throw Error(`Sign in to Po again.`);return e===void 0?t:await a.run(async()=>{let e=await u(t);return e===void 0?void 0:je.decode(e)})},async sealBinary(n){if(r)throw Error(`Sign in to Po again.`);return e===void 0?n:await i.run(async()=>{let e=await l(n);if(e===void 0)throw Error(t??`The active sealed channel could not encrypt a message.`);return Ae.encode(e)})},async openBinary(t){if(r)throw Error(`Sign in to Po again.`);return e===void 0?t:await a.run(async()=>await u(je.decode(t)))},async fetch(i,a){if(a?.signal?.throwIfAborted(),r)throw Error(`Sign in to Po again.`);let c=s;if(e===void 0||c===void 0)return await fetch(i,ke(i,a));let d=new AbortController,f=()=>d.abort(a?.signal?.reason),p=setTimeout(()=>d.abort(new DOMException(`The request timed out.`,`TimeoutError`)),3e4);a?.signal?.addEventListener(`abort`,f,{once:!0}),a?.signal?.aborted&&f();let m,h=new Promise((e,t)=>{m=()=>t(d.signal.reason),d.signal.addEventListener(`abort`,m,{once:!0}),d.signal.aborted&&m()}),g=e,_=()=>{if(d.signal.throwIfAborted(),r||e!==g)throw Error(`The sealed channel was replaced.`)};try{return _(),await Promise.race([o.run(()=>Promise.race([(async()=>{_();let e=await Pe(a?.body);_();let o={v:1,method:(a?.method??`GET`).toUpperCase(),target:Fe(i),headers:Array.from(new Headers(ke(i,a)?.headers).entries()),...e===void 0?{}:{body:Me(e)}},s=await l(Ae.encode(JSON.stringify(o)));if(_(),s===void 0)return new Response(JSON.stringify({error:t}),{status:502});let f=await fetch(c,{method:`POST`,signal:d.signal,credentials:`same-origin`,headers:{"content-type":`application/json`},body:s});if(_(),f.status===401||f.status===403)throw r=!0,t=`Sign in to Po again.`,n?.(),Error(t);let p=await f.text();_();let m=await u(p);if(_(),m===void 0)return new Response(JSON.stringify({error:t}),{status:502});let h;try{h=JSON.parse(je.decode(m))}catch{h=void 0}if(!Ie(h))return t=`The sealed HTTP response was malformed.`,new Response(JSON.stringify({error:t}),{status:502});let g=Ne(h.body);return new Response(h.status===204||h.status===205||h.status===304?null:g,{status:h.status,headers:h.headers})})(),h])),h])}finally{clearTimeout(p),a?.signal?.removeEventListener(`abort`,f),m&&d.signal.removeEventListener(`abort`,m)}}}}var Re=new Map;function ze(e,t=``){return Re.set(t,e),()=>{Re.get(t)===e&&Re.delete(t)}}function Be(e){return{active:()=>Re.get(e)?.active()??!1,async fetch(t,n){n?.signal?.throwIfAborted();let r=Re.get(e);if(!r)throw Error(`The host transport is not connected.`);let i=Ve(t,e);return r.fetch(i.input,n)}}}function Ve(e,t){let n=t,r=e=>{let t=decodeURIComponent(e),r=t.indexOf(`/`);if(r<1)return e;let i=t.slice(0,r);if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu.test(i))return e;if(n!==void 0&&i!==n)throw Error(`The request spans different hosts.`);return n=i,encodeURIComponent(t.slice(r+1))},i=e.indexOf(`?`),a=(i===-1?e:e.slice(0,i)).replace(/(\/(?:workspaces|sessions)\/)([^/]+)/gu,(e,t,n)=>t+r(n)),o=i===-1?``:e.slice(i).replace(/([?&]session=)([^&]*)/gu,(e,t,n)=>t+r(n));return{hostId:n,input:a+o}}var He={active:()=>Re.get(``)?.active()??!1,async fetch(e,t){t?.signal?.throwIfAborted();let n=Ve(e);if(n.hostId!==void 0)return Be(n.hostId).fetch(n.input,t);let r=Re.get(``);return r?r.fetch(e,t):fetch(e,ke(e,t))}},Ue={token:6e5,delegatedToken:36e5,envelope:6e4,clockSkew:3e4,manifest:864e5,grant:2592e6,grantRenewalWindow:6048e5,roster:6e5,rosterRelayCache:3e4,jwks:36e5,jwksRefetch:6e4,accountPurge:2592e6};function We(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return JSON.stringify(e);if(Array.isArray(e)){if(Object.keys(e).length!==e.length)throw Error(`Envelope arrays must be dense JSON arrays`);return`[${e.map(We).join(`,`)}]`}if(typeof e==`object`&&e&&Object.getPrototypeOf(e)===Object.prototype)return`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${We(Reflect.get(e,t))}`).join(`,`)}}`;throw Error(`Envelope fields must be finite JSON values`)}function Ge(e){if(!e||Object.getPrototypeOf(e)!==Object.prototype)throw Error(`Invalid envelope payload`);return Object.keys(e).sort().flatMap(t=>[t,We(Reflect.get(e,t))])}var Ke=t({ATTESTATION_TAG:()=>_,BUNDLE_MANIFEST_ROUTE:()=>d,BUNDLE_MANIFEST_VERSION:()=>2,FEDERATION_FRESHNESS:()=>Ue,NATIVE_COMPOSITION_MAX_BYTES:()=>h,NATIVE_ENTRY_CONTENT_TYPE:()=>m,NATIVE_ENTRY_PATH:()=>p,WEB_ENTRY_PATH:()=>f,assetFor:()=>k,attestationBytes:()=>T,bindBrowserTransport:()=>ze,bindClientMetadata:()=>be,browserTransport:()=>He,browserTransportForHost:()=>Be,canonicalManifest:()=>w,channelFromSecret:()=>_e,clientMetadata:()=>Se,connectSealedChannel:()=>ge,createBrowserClientIdentity:()=>De,createClientIdentity:()=>Ee,createSealedTransport:()=>Le,digestFor:()=>A,federationEnvelopeFields:()=>Ge,isBundleManifest:()=>D,isSignedBundleManifest:()=>O,poRequestInit:()=>ke,refreshClientDeviceName:()=>Ce,updateClientDeviceName:()=>xe,verifyAttestation:()=>F,verifyBundleAsset:()=>te,verifySignedBundleManifest:()=>ee}),qe=Le(),Je=Le(),Ye=Le();ze(Ye),Ye.relayRequestsThrough(a);var Xe=[[`session`,qe],[`protocol`,Je],[`http`,Ye]],Ze=`po.channelKey`,Qe,$e=!1,et=new Set;function tt(e){return et.add(e),()=>{et.delete(e)}}function nt(){if(!$e){$e=!0;for(let[,e]of Xe)e.invalidate();Qe=void 0;try{window.sessionStorage.removeItem(Ze)}catch{}for(let e of et)e()}}for(let[,e]of Xe)e.onAuthorizationFailure(nt);function rt(e){Qe=void 0,$e=!1;try{window.sessionStorage.setItem(Ze,e)}catch{}}function it(){try{return window.sessionStorage.getItem(Ze)??void 0}catch{return}}async function at(){let e=it();if(e===void 0)return!1;for(let[t,n]of Xe){let r=await n.connect(e);if(r===void 0||!await ct(t,r)){for(let[,e]of Xe)e.invalidate();return Qe=void 0,!1}}return!0}function ot(e=!1){return $e?Promise.resolve(!1):(e&&(Qe=void 0),Qe??=at(),Qe)}function st(){for(let[,e]of Xe)e.reset();Qe=void 0}async function ct(e,t){try{let n=await fetch(i,ke(i,{method:`POST`,signal:AbortSignal.timeout(1e4),headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify({scope:e,clientPublicKey:t})}));return(n.status===401||n.status===403)&&nt(),n.ok}catch{return!1}}function lt(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function ut(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function dt(){return ft.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var ft={stubThis:e=>e};function pt(e){let{id:t}=e;return{...e,id:ut(t),transports:e.transports,type:e.type}}function mt(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var ht=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function gt({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new ht({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new ht({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new ht({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new ht({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new ht({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new ht({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new ht({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new ht({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!mt(t))return new ht({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new ht({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new ht({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new ht({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var _t=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},vt=[`cross-platform`,`platform`];function yt(e){if(e&&!(vt.indexOf(e)<0))return e}async function bt(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!dt())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:ut(t.challenge),user:{...t.user,id:ut(t.user.id)},excludeCredentials:t.excludeCredentials?.map(pt)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=_t.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw gt({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){xt(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=lt(e))}catch(e){xt(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=lt(c.getAuthenticatorData())}catch(e){xt(`getAuthenticatorData()`,e)}return{id:o,rawId:lt(s),response:{attestationObject:lt(c.attestationObject),clientDataJSON:lt(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:yt(a.authenticatorAttachment)}}function xt(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function St(){if(!dt())return Ct.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?Ct.stubThis(new Promise(e=>e(!1))):Ct.stubThis(e.isConditionalMediationAvailable())}var Ct={stubThis:e=>e};function wt({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new ht({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new ht({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!mt(t))return new ht({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new ht({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new ht({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function Tt(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!dt())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(pt));let a={...t,challenge:ut(t.challenge),allowCredentials:i},o={};if(n){if(!await St())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=_t.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw wt({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=lt(u.userHandle)),{id:c,rawId:lt(l),response:{authenticatorData:lt(u.authenticatorData),clientDataJSON:lt(u.clientDataJSON),signature:lt(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:yt(s.authenticatorAttachment)}}function Et(e){return e instanceof Error?e.name===`NotAllowedError`?`That was cancelled.`:e.message:String(e)}function Dt(){return dt()}async function Ot(e,t){let n=await Ye.fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`same-origin`,body:JSON.stringify(t??{})});if(!n.ok)return;let r=await n.json();return typeof r==`object`&&r?r:void 0}async function kt(){if(!Dt())return{ok:!1,error:`This browser has no passkey support.`};try{let e=await Ot(`${r}/passkeys/register/begin`,{});if(typeof e?.ceremonyId!=`string`||e.options===void 0)return{ok:!1,error:`Passkeys are unavailable on this tunnel.`};let t=await bt({optionsJSON:e.options});return await Ot(`/api/remote/passkeys/register/finish`,{ceremonyId:e.ceremonyId,response:t})===void 0?{ok:!1,error:`That passkey was not accepted.`}:{ok:!0}}catch(e){return{ok:!1,error:Et(e)}}}async function At(){if(!Dt())return{ok:!1,error:`This browser has no passkey support.`};try{let e=await Ot(`${r}/passkeys/authenticate/begin`,{});if(typeof e?.ceremonyId!=`string`||e.options===void 0)return{ok:!1,error:`Passkeys are unavailable on this tunnel.`};let t=await Tt({optionsJSON:e.options}),n=await Ot(`${r}/passkeys/authenticate/finish`,{ceremonyId:e.ceremonyId,response:t});return typeof n?.hostPublicKey!=`string`||n.hostPublicKey===``?{ok:!1,error:`That passkey was not accepted.`}:(rt(n.hostPublicKey),{ok:!0})}catch(e){return{ok:!1,error:Et(e)}}}async function jt(e){if(Dt())try{let t=await Ot(`${r}/challenge`,{action:e});if(typeof t?.ceremonyId!=`string`||t.options===void 0)return;let n=await Tt({optionsJSON:t.options});return btoa(JSON.stringify({ceremonyId:t.ceremonyId,response:n})).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replaceAll(`=`,``)}catch{return}}var Mt=u,Nt=401;async function Pt(e,t,n=jt){let r=await He.fetch(e,t);if(r.status!==Nt)return r;let i;try{i=(await r.clone().json()).action}catch{return r}if(typeof i!=`string`)return r;let a=await n(i);return a===void 0?r:await He.fetch(e,{...t,headers:{...t?.headers,[u]:a}})}var Ft=`/api/plugins/po/providers`,It=`/api/plugins/po/logins`,Lt=`The cockpit hub is unreachable.`,Rt={"Content-Type":`application/json`};function zt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Bt(e,t,n){let r;try{r=await Pt(e,t)}catch{return{error:Lt}}let i;try{i=await r.json()}catch{i=void 0}if(r.ok&&zt(i)){let e=n(i);if(e!==void 0)return e}return{error:zt(i)&&typeof i.error==`string`?i.error:`The hub answered ${r.status}.`}}var Vt=e=>zt(e.flow)?{flow:e.flow}:void 0;function Ht(){return Bt(Ft,void 0,e=>Array.isArray(e.providers)?{providers:e.providers}:void 0)}function Ut(e,t){return Bt(It,{method:`POST`,headers:Rt,body:JSON.stringify({providerId:e,type:t})},Vt)}function Wt(e){return Bt(`${It}/${encodeURIComponent(e)}`,void 0,Vt)}function Gt(e,t,n){return Bt(`${It}/${encodeURIComponent(e)}/answer`,{method:`POST`,headers:Rt,body:JSON.stringify({promptId:t,value:n})},Vt)}function Kt(e){return Bt(`${It}/${encodeURIComponent(e)}`,{method:`DELETE`},Vt)}function qt(e){return Bt(`${Ft}/${encodeURIComponent(e)}`,{method:`DELETE`},()=>({ok:!0}))}function Jt(){return typeof Notification>`u`?`unsupported`:Notification.permission}async function Yt(){if(typeof Notification>`u`)return`unsupported`;try{return await Notification.requestPermission()}catch{return`request-error`}}function Xt(e,t,n,r){if(typeof Notification>`u`)return`unsupported`;let i=Notification.permission;if(i!==`granted`)return i===`denied`?`permission-denied`:`permission-default`;try{let i=n.subtitle===``?n.body:`${n.subtitle}\n${n.body}`,a=r?.trim()||e;return new Notification(`${a}: ${n.title||`Po`}`,{body:i,tag:`po:${encodeURIComponent(e)}:${encodeURIComponent(t)}`}),`delivered`}catch{return`constructor-error`}}var Zt=`/api/telemetry/browser`,Qt=32,$t=10,en=1e3,tn=3e4,nn=120,rn=300,an=800,on=64,sn=`web.browser.error`,cn=[],ln=0,un,dn=!1,fn=en,pn=!1,mn=performance.now();function hn(){pn=!0,cn.length=0,ln=0,un!==void 0&&clearTimeout(un),un=void 0}function gn(e=en){un!==void 0||dn||cn.length===0||(un=setTimeout(()=>{un=void 0,Tn()},e))}function _n(){return Math.max(0,performance.now()-mn)}function vn(e){pn||(cn.length>=Qt&&(cn.shift(),ln+=1),cn.push(e),gn())}function yn(e){vn({name:e.name,...e.duration_ms===void 0?{}:{duration_ms:Math.max(0,Math.min(6e5,Math.round(e.duration_ms)))},...e.count===void 0?{}:{count:Math.max(0,Math.min(1e4,Math.round(e.count)))}})}function bn(e){for(let t of e)vn({name:t.event===`ui.renders`?`web.browser.ui_renders`:`web.browser.ui_store_updates`,...t.level===`warn`?{level:`warn`}:{},attributes:t.attributes})}function xn(e){if(e instanceof Error)return{error_name:(e.name||`Error`).slice(0,nn),message:(e.message||`Unknown error`).slice(0,rn),...typeof e.stack==`string`&&e.stack.length>0?{stack:e.stack.slice(0,an)}:{}};let t=typeof e==`string`?e:Sn(e);return{error_name:typeof e==`string`?`StringError`:`ObjectError`,message:(t||`Unknown error`).slice(0,rn)}}function Sn(e){try{return JSON.stringify(e)??String(e)}catch{return`Unserializable error`}}function Cn(e,t,n){let r=xn(t),i=typeof n==`string`&&n.length>0&&n.length<=on?n:void 0;vn({name:sn,source:e,...r,...i===void 0?{}:{session_id:i}})}function wn(e={}){let t=e.target??window,n=e.sessionId??(()=>null),r=e=>{let t=`error`in e?e.error:void 0,r=`message`in e?e.message:void 0;Cn(`window_error`,t??r??`Unknown error`,n())},i=e=>{Cn(`unhandled_rejection`,`reason`in e?e.reason:void 0,n())};return t.addEventListener(`error`,r),t.addEventListener(`unhandledrejection`,i),()=>{t.removeEventListener(`error`,r),t.removeEventListener(`unhandledrejection`,i)}}async function Tn(){if(dn||cn.length===0)return;dn=!0,ln>0&&(cn.unshift({name:`web.browser.telemetry_drop`,count:Math.min(ln,1e4)}),ln=0,cn.length>Qt&&cn.pop());let e=cn.splice(0,$t),t=!1;try{let n=await Ye.fetch(Zt,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({v:1,events:e})});t=n.status===429||n.status>=500}catch{t=!0}finally{if(t){for(let t of e.reverse())cn.unshift(t);for(;cn.length>Qt;)cn.pop(),ln+=1}if(dn=!1,t){let e=fn;fn=Math.min(tn,fn*2),gn(e)}else fn=en,gn()}}function En(e,t=[]){return{type:`prompt`,message:e,...t.length>0?{images:t}:{}}}function Dn(e,t=[]){return{type:`steer`,message:e,...t.length>0?{images:t}:{}}}function On(e,t=[]){return{type:`follow_up`,message:e,...t.length>0?{images:t}:{}}}function kn(e,t=[]){return{type:`enqueue_automatic`,message:e,...t.length>0?{images:t}:{}}}function An(e){return{type:`remove_queued`,id:e}}function jn(e,t){return{type:`promote_queued`,id:e,...t===void 0?{}:{operationId:t}}}function Mn(){return{type:`resume_queue`}}function Nn(e){return{type:`rewind`,itemId:e}}function Pn(e){return e===void 0?{type:`abort`}:{type:`abort`,operationId:e}}function Fn(){return{type:`clear_queue`}}function In(){return{type:`get_state`}}function Ln(){return{type:`get_session_stats`}}function Rn(){return{type:`get_commands`}}function zn(e){return{type:`compact`,...e===void 0?{}:{customInstructions:e}}}var Bn=`compact`,Vn=[{name:Bn,description:`Manually compact the session context`}];function Hn(e){let t=/^\/(\S+)(?:\s+([\s\S]*))?$/u.exec(e.trim());if(t?.[1]!==Bn)return;let n=(t[2]??``).trim();return zn(n.length>0?n:void 0)}function Un(){return{type:`get_available_models`}}function Wn(){return{type:`get_available_thinking_levels`}}function Gn(e,t){return{type:`set_model`,provider:e,modelId:t}}function Kn(e){return{type:`set_thinking_level`,level:e}}function qn(e){return{type:`set_session_name`,name:e}}function Jn(e,t){return{type:`extension_ui_response`,id:e,value:t}}function Yn(e,t){return{type:`extension_ui_response`,id:e,confirmed:t}}function Xn(e){return{type:`extension_ui_response`,id:e,cancelled:!0}}var Zn=`skill:`,Qn={command:`/`,skill:`$`,file:`@`};function $n(e,t){let n=e.slice(0,t),r=Math.max(n.lastIndexOf(` `),n.lastIndexOf(`
|
|
4
4
|
`))+1,i=n.slice(r);return i.startsWith(`/`)&&r===0?{kind:`command`,start:r,query:i.slice(1)}:i.startsWith(`$`)&&r===0?{kind:`skill`,start:r,query:i.slice(1)}:i.startsWith(`@`)&&i.length<=64?{kind:`file`,start:r,query:i.slice(1)}:null}function er(e,t,n){let r=n.toLowerCase();return e.flatMap(e=>{let n=e.name.startsWith(Zn);if(n!==(t===`skill`))return[];let i=n?e.name.slice(6):e.name;return i.toLowerCase().startsWith(r)?[{insert:`/${e.name} `,label:`${Qn[t]}${i}`,detail:e.description}]:[]}).sort((e,t)=>e.label.localeCompare(t.label)).slice(0,20)}function tr(e,t=[]){return[...t.map(({path:e,detail:t})=>({insert:`@${e} `,label:`@${e}`,...t?{detail:t}:{}})),...e.map(e=>({insert:`@${e} `,label:`@${e}`}))].slice(0,20)}var nr=new Set;function rr(e){return nr.add(e),()=>nr.delete(e)}function ir(e){let t={...e,contextItems:e.contextItems.map(e=>({...e}))};for(let e of nr)try{e(t)}catch{}}var ar=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;function or(e,t){if(!ar.test(e))throw Error(`Invalid host identity.`);return t.startsWith(`${e}/`)?t:`${e}/${t}`}function sr(e){let t=e.indexOf(`/`);if(t<1||t===e.length-1)return;let n=e.slice(0,t);return ar.test(n)?{hostId:n,localId:e.slice(t+1)}:void 0}function cr(e,t){let n=sr(t);if(!n)return t;if(n.hostId!==e)throw Error(`The identifier belongs to another host.`);return n.localId}var lr=or,ur=sr,dr;function fr(e){dr=e}function pr(){return dr}var mr=`leader`;function hr(e,t){let n=e;for(let[e,r]of t.path.entries()){let i=e===t.path.length-1,a=n.children.get(r.key);a?!a.detail&&r.detail&&(a.detail=r.detail):(a={key:r.key,label:r.label,detail:r.detail??``,children:new Map},n.children.set(r.key,a)),i?(a.children.clear(),a.binding=t,a.label=r.label,a.detail=r.detail??``):a.binding&&delete a.binding,n=a}}function gr(e){let t=[];e.binding&&t.push(e.binding);for(let n of e.children.values())t.push(...gr(n));return t}function _r(e){let t=[],n={key:``,label:mr,detail:``,children:new Map},r=new Map;for(let i of e){let e=n,a=[];for(let[n,o]of i.path.entries()){a.push(o.key);let s=a.join(` `),c=n===i.path.length-1,l=e.children.get(o.key);if(l){if(c)for(let e of gr(l))e!==i&&t.push({kind:`leaf-override`,path:s,winner:i,loser:e});else{l.binding&&l.binding!==i&&t.push({kind:`leaf-override`,path:s,winner:i,loser:l.binding});let e=r.get(l);e!==void 0&&e!==i&&l.label!==o.label&&t.push({kind:`group-label`,path:s,winner:e,loser:i})}}else l={key:o.key,label:o.label,detail:``,children:new Map},e.children.set(o.key,l),r.set(l,i);c?(l.children.clear(),l.binding=i,l.label=o.label,r.set(l,i)):l.binding&&delete l.binding,e=l}}return t}function vr(e){let t=[...e.children.values()].sort((e,t)=>e.key.localeCompare(t.key)).map(e=>({key:e.key,label:e.label,detail:e.detail,children:[]}));return{key:e.key,label:e.label,detail:e.detail,...e.binding?{binding:e.binding}:{},children:t}}function yr(e,t){let n={key:``,label:mr,detail:``,children:new Map};for(let t of e)hr(n,t);let r=n;for(let e of t){let t=r.children.get(e);if(!t||t.binding)return;r=t}let i=[...r.children.values()].sort((e,t)=>e.key.localeCompare(t.key)).map(vr);return{label:r.label,options:i}}function br(e,t){return e.flatMap(e=>{let n=e[t];return n===void 0?[]:[{id:e.id,...n}]})}function xr(e){if(typeof e==`object`&&e){if(`slot`in e&&typeof e.slot==`string`&&`id`in e&&typeof e.id==`string`)return`${e.slot}\0${e.id}`;if(`id`in e&&typeof e.id==`string`)return e.id;if(`name`in e&&typeof e.name==`string`)return e.name;if(`frameType`in e&&typeof e.frameType==`string`)return e.frameType;if(`slot`in e&&typeof e.slot==`string`)return e.slot;if(`tools`in e&&Array.isArray(e.tools)&&e.tools.length)return e.tools.join(`\0`)}}function Sr(...e){let t=new Map;for(let n of e)for(let e of n){let n=t.get(e.id)??{id:e.id};for(let[t,r]of Object.entries(e))if(t!==`start`){if(Array.isArray(r)){let e=n[t],i=Array.isArray(e)?[...e]:[];for(let e of r){let t=xr(e),n=t===void 0?-1:i.findIndex(e=>xr(e)===t);n===-1?i.push(e):i[n]=e}n[t]=i}else n[t]=r}t.set(e.id,n)}return[...t.values()]}var Cr={assign:0,create:0,clone:0,discard:0,update:0};function wr(e){let t=0,n=0,r=0;for(;n<e.length;){let i=e.charCodeAt(n++)>>10;t+=+((r<<8|i)!=13879),r=i}return t}function Tr(e,t){return e.length<=t||e.length<=t<<1&&wr(e)<=t}function Er(e,t){return e.length>=t<<1||e.length>=t&&wr(e)>=t}function Dr(e){return Array.isArray(e)}function Or(e){return I(typeof e,`bigint`)}function kr(e){return I(typeof e,`boolean`)}function Ar(e){if(zr(e)||!jr(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function jr(e){return I(typeof e,`function`)}function Mr(e){return Number.isInteger(e)}function Nr(e){return I(e,null)}function Pr(e){return Number.isFinite(e)}function Fr(e){return Ir(e)&&!Dr(e)}function Ir(e){return I(typeof e,`object`)&&!Nr(e)}function Lr(e){return I(typeof e,`string`)}function Rr(e){return I(typeof e,`symbol`)}function zr(e){return I(e,void 0)}function I(e,t){return e===t}function Br(e,t){return e>t}function Vr(e,t){return e<t}function Hr(e,t){return e<=t}function Ur(e,t){return e>=t}function Wr(e,t){if(Or(e)||Or(t))return BigInt(e)%BigInt(t)===0n;if(!Pr(e)||Mr(e)&&1/t%1==0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<1e-10}function Gr(e){return Or(e)||kr(e)||Nr(e)||Pr(e)||Lr(e)||zr(e)}function Kr(e,t){return Tr(e,t)}function qr(e,t){return Er(e,t)}function Jr(e,t,n){return e.every((e,r)=>r<t||n(e,r))}function Yr(e,t){return e.some((e,n)=>t(e,n))}function Xr(e,t){let n=!1;return e.forEach((e,r)=>{t(e,r)&&(n=!0)}),n}function Zr(e,t){return e.reduce((e,n,r)=>t(n,r)?++e:e,0)}function Qr(e,t,n){return I(e.length,0)?n():t(e[0],e.slice(1))}function $r(e){return I(e,`__proto__`)||I(e,`constructor`)||I(e,`prototype`)}function L(e,t){return $r(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ei(e){return Object.entries(e)}function ti(e){return Object.getOwnPropertyNames(e)}function ni(e){return Object.getOwnPropertySymbols(e)}function ri(e){return Object.values(e)}function ii(e,t){if(!Ir(t))return!1;let n=ti(e);return I(n.length,ti(t).length)&&n.every(n=>oi(e[n],t[n]))}function ai(e,t){return Dr(t)&&I(e.length,t.length)&&e.every((n,r)=>oi(e[r],t[r]))}function oi(e,t){return Dr(e)?ai(e,t):Ir(e)?ii(e,t):I(e,t)}function si(e){return e instanceof Boolean}function eee(e){return e instanceof Number}function tee(e){return e instanceof String}function nee(e){return globalThis.ArrayBuffer.isView(e)}function ci(e){return e instanceof globalThis.RegExp}function li(e){return e instanceof globalThis.Date}var ui={immutableTypes:!1,maxErrors:8,maxParseErrors:1,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function di(){return ui}function fi(e){return[...ti(e),...ni(e)]}function pi(e,t){if(!t.has(e)){t.add(e);for(let n of fi(e)){let r=Object.getOwnPropertyDescriptor(e,n);r&&`value`in r&&Ir(r.value)&&pi(r.value,t)}Object.freeze(e)}}function mi(e){return di().immutableTypes&&pi(e,new WeakSet),e}function hi(e,t){Cr.assign+=1;let n={},r=fi(t),i=fi(e);for(let t of i)r.includes(t)||Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t));for(let e of r)Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e));return mi(n)}function gi(e,t){return{...e,...t}}function _i(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function vi(e,t,n={}){Cr.create+=1;let r=gi(t,n);return mi(di().enumerableKind?gi(r,e):_i(r,e))}function yi(e,t){Cr.discard+=1;let n={};for(let r of fi(e)){if(t.includes(r))continue;let i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i)}return mi(n)}function bi(e,t,n,r){for(let i of fi(e)){if($r(i)||t.includes(i)||n.includes(i))continue;let a=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,a)}}function xi(e,t,n){let r=di().enumerableKind;for(let i of t)$r(i)||Object.defineProperty(n,i,{configurable:!0,writable:!0,enumerable:r,value:e[i]})}function Si(e,t,n){for(let r of t)$r(r)||Object.defineProperty(n,r,{configurable:!0,enumerable:!0,writable:!0,value:e[r]})}function Ci(e,t,n){Cr.update+=1;let r={},i=fi(t),a=fi(n);return bi(e,i,a,r),xi(t,i,r),Si(n,a,r),mi(r)}function wi(e,t){return Ir(e)&&L(e,`~kind`)&&I(e[`~kind`],t)}function Ti(e){return Ir(e)}function Ei(e,t,n){return vi({"~kind":`Deferred`},{type:`deferred`,action:e,parameters:t,options:n},{})}function Di(e){return wi(e,`Deferred`)}function Oi(e,t){return Ci(e,{"~readonly":!0},t)}function ki(e,t,n,r){return Oi(yh(e,t,n),r)}function Ai(e,t){return Ci(e,{"~optional":!0},t)}function ji(e,t,n,r){return Ai(yh(e,t,n),r)}function Mi(e,t){return vi({"~kind":`Array`},{type:`array`,items:e},t)}function Ni(e){return wi(e,`Array`)}function Pi(e){return yi(e,[`~kind`,`type`,`items`])}function Fi(e,t,n={}){return vi({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function Ii(e){return wi(e,`Constructor`)}function Li(e){return yi(e,[`~kind`,`type`,`parameters`,`instanceType`])}function Ri(e,t,n={}){return vi({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function zi(e){return wi(e,`Function`)}function Bi(e){return yi(e,[`~kind`,`type`,`parameters`,`returnType`])}function Vi(e,t){return vi({"~kind":`Ref`},{$ref:e},t)}function Hi(e){return wi(e,`Ref`)}function Ui(e,t){return vi({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function Wi(e){return wi(e,`Generic`)}function Gi(e){return vi({"~kind":`Any`},{},e)}function Ki(e){return wi(e,`Any`)}var qi=`(?!)`;function Ji(e){return vi({"~kind":`Never`},{not:{}},e)}function Yi(e){return wi(e,`Never`)}function Xi(e,t={}){return Ai(e,t)}function Zi(e){return Xi(e)}function Qi(e){return Ti(e)&&L(e,`~optional`)}function $i(e){return ti(e).filter(t=>!Qi(e[t]))}function ea(e){return ti(e)}function ta(e){return ri(e)}function R(e,t={}){let n=$i(e);return vi({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function na(e){return wi(e,`Object`)}function ra(e){return yi(e,[`~kind`,`type`,`properties`,`required`])}function ia(e){return vi({"~kind":`Unknown`},{},e)}function aa(e){return wi(e,`Unknown`)}function oa(e,t,n){return vi({"~kind":`Cyclic`},{$defs:ti(e).reduce((t,n)=>({...t,[n]:Ci(e[n],{},{$id:n})}),{}),$ref:t},n)}function sa(e){return wi(e,`Cyclic`)}function ca(e){return Ci(e,{"~unsafe":null},{})}function la(e){return Fr(e)&&L(e,`~unsafe`)&&Nr(e[`~unsafe`])}function ua(e,t){return t[e.length]?.(...e)??(()=>{throw Error(`Invalid Arguments`)})()}function da(e){return wi(e,`Infer`)}function fa(e,t,n,r={}){return vi({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function pa(e){return wi(e,`Dependent`)}function ma(e){return yi(e,[`~kind`,`if`,`then`,`else`])}function ha(e){return wi(e,`Enum`)}function ga(e,t={}){return vi({"~kind":`Intersect`},{allOf:e},t)}function _a(e){return wi(e,`Intersect`)}function va(e){return yi(e,[`~kind`,`allOf`])}function ya(){throw Error(`Unreachable`)}function ba(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function xa(e){return typeof e==`number`}var Sa={Array:0,BigInt:1,Boolean:2,Date:3,Constructor:4,Function:5,Null:6,Number:7,Object:8,RegExp:9,String:10,Symbol:11,TypeArray:12,Undefined:13},Ca=8997,wa=33826,Ta=40164,Ea=52210,Da=new Float64Array(1),Oa=new DataView(Da.buffer),ka=new Uint8Array(Da.buffer);function Aa(e){let t=Ca^e,n=t*435,r=wa*435+(n>>>16),i=Ta*435+(r>>>16)+(t<<8),a=Ea*435+(i>>>16)+(wa<<8);Ca=n&65535,wa=r&65535,Ta=i&65535,Ea=a&65535}function ja(e){Aa(Sa.Array);for(let t of e)Ga(t)}function Ma(e){Aa(Sa.BigInt),Oa.setBigInt64(0,e);for(let e of ka)Aa(e)}function Na(e){Aa(Sa.Boolean),Aa(+!!e)}function Pa(e){Aa(Sa.Constructor),Ga(e.toString())}function Fa(e){Aa(Sa.Date),Ga(e.getTime())}function Ia(e){Aa(Sa.Function),Ga(e.toString())}function La(e){Aa(Sa.Null)}function Ra(e){Aa(Sa.Number),Oa.setFloat64(0,e,!0);for(let e of ka)Aa(e)}function ree(e){Aa(Sa.Object);for(let t of ba(e).sort())Ga(t),Ga(e[t])}function za(e){Aa(Sa.RegExp),Va(e.toString())}var Ba=new TextEncoder;function Va(e){Aa(Sa.String);for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>127){for(let n of Ba.encode(e.slice(t)))Aa(n);return}Aa(n)}}function Ha(e){Aa(Sa.Symbol),Ga(e.toString())}function Ua(e){Aa(Sa.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)Aa(t[e])}function Wa(e){return Aa(Sa.Undefined)}function Ga(e){return nee(e)?Ua(e):li(e)?Fa(e):ci(e)?za(e):si(e)?Na(e.valueOf()):tee(e)?Va(e.valueOf()):eee(e)?Ra(e.valueOf()):xa(e)?Ra(e):Dr(e)?ja(e):kr(e)?Na(e):Or(e)?Ma(e):Ar(e)?Pa(e):Nr(e)?La(e):Ir(e)?ree(e):Lr(e)?Va(e):Rr(e)?Ha(e):zr(e)?Wa(e):jr(e)?Ia(e):ya()}function Ka(e){return e.toString(16).padStart(4,`0`)}function qa(e){return Ca=8997,wa=33826,Ta=40164,Ea=52210,Ga(e),`${Ka(Ea)}${Ka(Ta)}${Ka(wa)}${Ka(Ca)}`}function Ja(e){return Ti(e)&&L(e,`~immutable`)}function Ya(e,t={}){return Oi(e,t)}function Xa(e){return Ti(e)&&L(e,`~readonly`)}var Za=`-?(?:0|[1-9][0-9]*)n`;function Qa(e){return vi({"~kind":`BigInt`},{type:`bigint`},e)}function $a(e){return wi(e,`BigInt`)}function eo(e){return vi({"~kind":`Boolean`},{type:`boolean`},e)}function to(e){return wi(e,`Boolean`)}var no=`-?(?:0|[1-9][0-9]*)`;function ro(e){return vi({"~kind":`Integer`},{type:`integer`},e)}function io(e){return wi(e,`Integer`)}var ao=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function oo(e){return Or(e)?`bigint`:kr(e)?`boolean`:Pr(e)?`number`:Lr(e)?`string`:(()=>{throw new ao(e)})()}function z(e,t){return vi({"~kind":`Literal`},{type:oo(e),const:e},t)}function so(e){return Or(e)||kr(e)||Pr(e)||Lr(e)}function co(e){return uo(e)&&Pr(e.const)}function lo(e){return uo(e)&&Lr(e.const)}function uo(e){return wi(e,`Literal`)}function fo(e){return vi({"~kind":`Null`},{type:`null`},e)}function po(e){return wi(e,`Null`)}var mo=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function ho(e){return vi({"~kind":`Number`},{type:`number`},e)}function go(e){return wi(e,`Number`)}function _o(e){return vi({"~kind":`Symbol`},{type:`symbol`},e)}function vo(e){return wi(e,`Symbol`)}function yo(e){return vi({"~kind":`String`},{type:`string`},e)}function bo(e){return wi(e,`String`)}function B(e,t={}){return vi({"~kind":`Union`},{anyOf:e},t)}function xo(e){return wi(e,`Union`)}function So(e){return yi(e,[`~kind`,`anyOf`])}function Co(e){let t=Jc(e);return I(t.length,2)?t[0]:[]}function wo(e){return!0}function To(e){return Qr(e,(e,t)=>Do(e)?To(t):!1,()=>!0)}function Eo(e){return!I(e.length,0)&&To(e)}function Do(e){return xo(e)?Eo(e.anyOf):uo(e)?wo(e.const):!1}function Oo(e){return Eo(e)}function ko(e){return vi({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function Ao(e,t,n=[]){return Qr(e,(e,r)=>Ao(r,t,[...n,`${e}${t}`]),()=>n)}function jo(e,t){return I(e.length,0)?[`${t}`]:Ao(e,t)}function Mo(e,t,n=[]){return Qr(t,(t,r)=>Mo(e,r,[...n,...No(e,t)]),()=>n)}function No(e,t){return xo(t)?Mo(e,t.anyOf):uo(t)?jo(e,t.const):ya()}function Po(e,t){return Qr(t,(t,n)=>Po(No(e,t),n),()=>e)}function Fo(e){return e.map(e=>z(e))}function Io(e){return B(Fo(Po([],e)))}function Lo(e){return I(e.length,0)?ya():I(e.length,1)&&uo(e[0])?e[0]:Io(e)}function Ro(e){let t=Co(e);return I(t.length,0)?yo():Oo(t)?Lo(t):ko(e)}function zo(e){let t=Ro(e);return hl(t)?yo():t}function Bo(e,t){return vi({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function Vo(e){return Bo(Us,e)}function Ho(e){return R({true:e,false:e})}function Uo(e,t={}){let[n,r,i]=[e,e.length,!1];return vi({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function Wo(e){return wi(e,`Tuple`)}function Go(e){return yi(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function Ko(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function qo(e){return R(Ko(e.items))}function Jo(e){return yi(e,[`~optional`])}function Yo(e,t){return Ci(Jo(e),{},t)}function Xo(e,t,n,r){return Yo(yh(e,t,n),r)}function iee(e){return yi(e,[`~readonly`])}function Zo(e,t){return Ci(iee(e),{},t)}function Qo(e,t,n,r){return Zo(yh(e,t,n),r)}function $o(e,t){let n=Xa(e)&&Xa(t),r=Qi(e)&&Qi(t),i=Zo(Yo(ys([e,t]),{}),{});return n&&r?Oi(Ai(i,{}),{}):n?Oi(i,{}):r?Ai(i,{}):i}function es(e,t){let n=Xa(e)||Xa(t),r=Qi(e)||Qi(t),i=xs([Zo(Yo(e,{}),{}),Zo(Yo(t,{}),{})]);return n&&r?Oi(Ai(i,{}),{}):n?Oi(i,{}):r?Ai(i,{}):i}function ts(e,t,n){return n in e?n in t?$o(e[n],t[n]):e[n]:n in t?t[n]:Ji()}function ns(e,t){return[...new Set([...ti(e),...ti(t)])].reduce((n,r)=>({...n,[r]:ts(e,t,r)}),{})}function rs(e){return na(e)?e.properties:Wo(e)?Ko(e.items):{}}function is(e,t){return R(ns(rs(e),rs(t)))}function as(e,t){let n=bd(e,t);return I(n,2)?e:I(n,3)||I(n,0)?t:Ji()}function os(e){return na(e)||Wo(e)}function ss(e,t){let n=os(e),r=os(t);return n&&r?is(e,t):n&&!r?e:!n&&r?t:as(e,t)}function cs(e,t){return Yi(e)||Ki(e)?e:aa(e)||Yi(t)||Ki(t)?t:aa(t)?e:ss(e,t)}function ls(e,t){return xo(e)||xo(t)}function us(e,t){let n=Ss(e),r=Ss(t);return ls(n,r)?ys([n,r]):cs(n,r)}function ds(e,t,n=[]){return Qr(t,(t,r)=>ds(e,r,[...n,us(t,e)]),()=>I(n.length,0)?[e]:n)}function fs(e,t,n=[]){return Qr(e,(e,r)=>fs(r,t,[...n,...ps([e],t)]),()=>n)}function ps(e,t=[]){return Qr(e,(e,n)=>xo(e)?ps(n,fs(e.anyOf,t)):ps(n,ds(e,t)),()=>t)}function ms(e,t){return Sl(yd({},e,t))?[]:[e]}function hs(e,t,n=[]){return Qr(e,(e,r)=>hs(r,t,[...n,...ms(e,t)]),()=>n)}function gs(e,t){let n=Ss(e);return xs(hs(xo(n)?n.anyOf:[n],t))}function _s(e,t,n){return xs([ys([e,t]),gs(n,e)])}function vs(e,t=[]){return Qr(e,(e,n)=>vs(n,[...t,z(e)]),()=>xs(t))}function ys(e){return xs(wd(ps(e)))}function bs(e){return Ss(zo(e))}function xs(e){return Cs(wd(e))}function Ss(e){return pa(e)?_s(e.if,e.then,e.else):ha(e)?vs(e.enum):_a(e)?ys(e.allOf):hl(e)?bs(e.pattern):xo(e)?xs(e.anyOf):e}function Cs(e){return I(e.length,1)?e[0]:I(e.length,0)?Ji():B(e)}function ws(e,t){return Rs(vs(e),t)}function Ts(e,t){return Bo(Vs,t)}function Es(e,t){return Rs(ys(e),t)}function Ds(e,t){return Lr(e)||Pr(e)?R({[e]:t}):I(e,!1)?R({false:t}):I(e,!0)?R({true:t}):R({})}function Os(e,t){return Bo(Hs,t)}function ks(e,t){return L(e,`pattern`)&&(Lr(e.pattern)||e.pattern instanceof RegExp)?Bo(e.pattern.toString(),t):Bo(Us,t)}function As(e,t){return Oo(Co(e))?Rs(bs(e),t):Bo(e,t)}function js(e){return xo(e)?Ms(e.anyOf):[e]}function Ms(e,t=[]){return Qr(e,(e,n)=>Ms(n,[...t,...js(e)]),()=>t)}function Ns(e){return e.some(e=>bo(e)||go(e)||io(e))}function Ps(e,t){return I(Ns(e),!0)?Bo(Us,t):void 0}function Fs(e,t){return e.reduce((e,n)=>uo(n)&&(Lr(n.const)||Pr(n.const))?{...e,[n.const]:t}:e,{})}function Is(e,t){return R(Fs(e,t))}function Ls(e,t){let n=Ms(e),r=Ps(n,t);return Ti(r)?r:Is(n,t)}function Rs(e,t){return Ki(e)?Vo(t):to(e)?Ho(t):ha(e)?ws(e.enum,t):io(e)?Ts(e,t):_a(e)?Es(e.allOf,t):uo(e)?Ds(e.const,t):go(e)?Os(e,t):xo(e)?Ls(e.anyOf,t):bo(e)?ks(e,t):hl(e)?As(e.pattern,t):R({})}function zs(e,t,n){return fh([e])?Ci(Rs(e,t),{},n):Ws(e,t,n)}function Bs(e,t,n,r,i){return zs(yh(e,t,n),yh(e,t,r),i)}var Vs=`^${no}$`,Hs=`^${mo}$`,Us=`^.*$`;function Ws(e,t,n={}){return Ei(`Record`,[e,t],n)}function Gs(e,t,n={}){return zs(e,t,n)}function Ks(e,t){return Bo(e,t)}function qs(e){return I(e,Us)?yo():I(e,Vs)?ro():I(e,Hs)?ho():Ro(e)}function Js(e){return ti(e.patternProperties)[0]}function Ys(e){return qs(Js(e))}function Xs(e){return e.patternProperties[Js(e)]}function Zs(e){return wi(e,`Record`)}function Qs(e){return vi({"~kind":`Rest`},{type:`rest`,items:e},{})}function $s(e){return wi(e,`Rest`)}function ec(e){return wi(e,`This`)}function tc(e){return vi({"~kind":`Undefined`},{type:`undefined`},e)}function nc(e){return wi(e,`Undefined`)}function rc(e){return wi(e,`Void`)}function ic(e){return Qa()}function ac(e){return yo()}function oc(e){return ho()}function sc(e){return ro()}function cc(e){return Ji()}function lc(e){return z(e)}function uc(e){return e}function dc(e){return B(e[1])}function aee(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function fc(e){return[e[0],...e[1]]}function pc(e){return e}function mc(e){return e[1]}function hc(e){return I(e.length,2)}function gc(e,t,n){return hc(e)?t(e[0],e[1]):n()}function _c(e,t){return I(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function vc(e,t){for(let n=0;n<e.length;n++){let r=_c(e[n],t);if(hc(r))return r}return[]}function yc(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var bc=[...yc(97,122),...yc(65,90)],xc=[`0`,...yc(49,57)],Sc=`//`,Cc=`/*`,wc=`*/`;function Tc(e){let t=e.indexOf(wc);return I(t,-1)?``:e.slice(t+2)}function Ec(e){let t=e.indexOf(`
|
|
@@ -18,8 +18,8 @@ import{i as e,n as t,t as n}from"./rolldown-runtime-COiEfhsA.js";(function(){let
|
|
|
18
18
|
`).map(e=>`> ${e}`).join(`
|
|
19
19
|
`);return`### ${uhe(e)}\n\n${t}\n\n${e.body.trim()}`}).join(`
|
|
20
20
|
|
|
21
|
-
`);return`${t??dhe(e.length)}\n\n${n}`}var phe=`modulepreload`,mhe=function(e){return`/`+e},hhe={},ghe=function(e){return e.pathname.endsWith(`.css`)},_he=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},pO=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=mhe(t,n);let r=s(t),i=ghe(r);return _he(hhe,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:phe,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},vhe={cjs:`javascript`,js:`javascript`,mjs:`javascript`,jsx:`jsx`,cts:`typescript`,mts:`typescript`,ts:`typescript`,tsx:`tsx`,json:`json`,jsonc:`json`,markdown:`markdown`,md:`markdown`,htm:`html`,html:`html`,xhtml:`html`,css:`css`,py:`python`,pyi:`python`,yaml:`yaml`,yml:`yaml`,bash:`shell`,sh:`shell`,zsh:`shell`,toml:`toml`},yhe={".bashrc":`shell`,".zshrc":`shell`,containerfile:`dockerfile`,dockerfile:`dockerfile`};function bhe(e){return(e.split(`/`).at(-1)??``).toLowerCase()}function mO(e){let t=bhe(e),n=yhe[t];if(n!==void 0)return n;let r=t.lastIndexOf(`.`);if(!(r<1))return vhe[t.slice(r+1)]}async function hO(e){let[{StreamLanguage:t},n]=await Promise.all([pO(()=>import(`./dist-
|
|
22
|
-
`,1)[0]??``;for(let t of whe)if(t.pattern.test(e))return t.grammar;return`shell`}return The.test(n)?`json`:void 0}function Ehe(e){return e===void 0?void 0:Che[e]}async function Dhe(){let{tagHighlighter:e,tags:t}=await pO(async()=>{let{tagHighlighter:e,tags:t}=await import(`./dist-C1hGqmUi.js`).then(e=>e.n);return{tagHighlighter:e,tags:t}},__vite__mapDeps([1,2]));return e([{tag:t.comment,class:`comment`},{tag:t.keyword,class:`keyword`},{tag:[t.atom,t.bool,t.null,t.self],class:`constant`},{tag:t.number,class:`literal`},{tag:[t.string,t.special(t.string)],class:`string`},{tag:t.regexp,class:`regexp`},{tag:[t.operator,t.operatorKeyword],class:`operator`},{tag:[t.punctuation,t.separator,t.bracket],class:`punctuation`},{tag:[t.variableName,t.definition(t.variableName)],class:`variable`},{tag:[t.propertyName,t.definition(t.propertyName)],class:`property`},{tag:[t.function(t.variableName),t.function(t.propertyName)],class:`callable`},{tag:[t.typeName,t.className,t.namespace],class:`type`},{tag:[t.tagName,t.angleBracket],class:`tag`},{tag:t.attributeName,class:`attribute`},{tag:[t.meta,t.processingInstruction,t.documentMeta],class:`meta`},{tag:t.heading,class:`heading`},{tag:[t.link,t.url],class:`link`},{tag:t.emphasis,class:`emphasis`},{tag:t.strong,class:`strong`},{tag:t.strikethrough,class:`strikethrough`},{tag:t.invalid,class:`invalid`}])}async function Ohe(e){let[{Language:t,LanguageSupport:n},r]=await Promise.all([pO(()=>import(`./dist-
|
|
21
|
+
`);return`${t??dhe(e.length)}\n\n${n}`}var phe=`modulepreload`,mhe=function(e){return`/`+e},hhe={},ghe=function(e){return e.pathname.endsWith(`.css`)},_he=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},pO=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=mhe(t,n);let r=s(t),i=ghe(r);return _he(hhe,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:phe,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},vhe={cjs:`javascript`,js:`javascript`,mjs:`javascript`,jsx:`jsx`,cts:`typescript`,mts:`typescript`,ts:`typescript`,tsx:`tsx`,json:`json`,jsonc:`json`,markdown:`markdown`,md:`markdown`,htm:`html`,html:`html`,xhtml:`html`,css:`css`,py:`python`,pyi:`python`,yaml:`yaml`,yml:`yaml`,bash:`shell`,sh:`shell`,zsh:`shell`,toml:`toml`},yhe={".bashrc":`shell`,".zshrc":`shell`,containerfile:`dockerfile`,dockerfile:`dockerfile`};function bhe(e){return(e.split(`/`).at(-1)??``).toLowerCase()}function mO(e){let t=bhe(e),n=yhe[t];if(n!==void 0)return n;let r=t.lastIndexOf(`.`);if(!(r<1))return vhe[t.slice(r+1)]}async function hO(e){let[{StreamLanguage:t},n]=await Promise.all([pO(()=>import(`./dist-DwtF7q4e.js`),__vite__mapDeps([0,1,2])),e()]);return t.define(n)}async function xhe(e){switch(e){case`javascript`:return(await pO(async()=>{let{javascript:e}=await import(`./dist-BskON3r9.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([3,2,1,4,0,5]))).javascript();case`jsx`:return(await pO(async()=>{let{javascript:e}=await import(`./dist-BskON3r9.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([3,2,1,4,0,5]))).javascript({jsx:!0});case`typescript`:return(await pO(async()=>{let{javascript:e}=await import(`./dist-BskON3r9.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([3,2,1,4,0,5]))).javascript({typescript:!0});case`tsx`:return(await pO(async()=>{let{javascript:e}=await import(`./dist-BskON3r9.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([3,2,1,4,0,5]))).javascript({jsx:!0,typescript:!0});case`json`:return(await pO(async()=>{let{json:e}=await import(`./dist-Cp0KQVwU.js`);return{json:e}},__vite__mapDeps([6,1,2,4,0]))).json();case`markdown`:return(await pO(async()=>{let{markdown:e}=await import(`./dist-DtPgUq6U.js`);return{markdown:e}},__vite__mapDeps([7,1,2,0,5,8,4,9,3]))).markdown();case`html`:return(await pO(async()=>{let{html:e}=await import(`./dist-CdxMcTMT.js`);return{html:e}},__vite__mapDeps([8,1,2,4,9,0,3,5]))).html();case`css`:return(await pO(async()=>{let{css:e}=await import(`./dist-DHg2eGm9.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([9,2,1,4,0]))).css();case`python`:return(await pO(async()=>{let{python:e}=await import(`./dist-BLQ7nnrh.js`);return{python:e}},__vite__mapDeps([10,1,2,4,0,5]))).python();case`yaml`:return(await pO(async()=>{let{yaml:e}=await import(`./dist-HHSi5Pa8.js`);return{yaml:e}},__vite__mapDeps([11,1,2,4,0]))).yaml();case`shell`:return hO(async()=>(await pO(async()=>{let{shell:e}=await import(`./shell-DwuoZtxw.js`);return{shell:e}},[])).shell);case`toml`:return hO(async()=>(await pO(async()=>{let{toml:e}=await import(`./toml-BPTmHmyx.js`);return{toml:e}},[])).toml);case`dockerfile`:return hO(async()=>(await pO(async()=>{let{dockerFile:e}=await import(`./dockerfile-BDePf5PZ.js`);return{dockerFile:e}},[])).dockerFile)}}var She={"&":{color:`var(--po-text)`,backgroundColor:`var(--po-deep)`,fontSize:`12px`,height:`100%`},".cm-scroller":{fontFamily:`var(--po-font-mono)`,lineHeight:`1.5`},".cm-content":{caretColor:`var(--po-blue)`,padding:`8px 0`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--po-blue)`,borderLeftWidth:`2px`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`var(--po-selected)`},".cm-gutters":{backgroundColor:`var(--po-deep)`,color:`var(--po-faint)`,borderRight:`1px solid var(--po-border-soft)`},".cm-activeLine":{backgroundColor:`var(--po-panel)`},".cm-activeLineGutter":{backgroundColor:`var(--po-panel)`,color:`var(--po-dim)`},".cm-foldPlaceholder":{backgroundColor:`var(--po-panel)`,border:`1px solid var(--po-border)`,color:`var(--po-dim)`},".cm-searchMatch":{backgroundColor:`var(--po-tint-yellow)`,outline:`1px solid var(--po-edge-yellow)`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`var(--po-tint-orange)`},".cm-selectionMatch":{backgroundColor:`var(--po-tint-blue)`},".cm-closed-tone":{backgroundColor:`var(--po-tint-green)`,textDecoration:`line-through`,textDecorationColor:`var(--po-edge-green)`},".cm-matchingBracket, &.cm-focused .cm-matchingBracket":{backgroundColor:`var(--po-tint-green)`,outline:`1px solid var(--po-edge-green)`},".cm-nonmatchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`var(--po-tint-red)`},".cm-panels":{backgroundColor:`var(--po-panel)`,color:`var(--po-text)`,fontFamily:`var(--font-sans)`,fontSize:`12px`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid var(--po-border)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid var(--po-border)`},".cm-panel input, .cm-panel button, .cm-panel select":{backgroundColor:`var(--po-deep)`,color:`var(--po-text)`,border:`1px solid var(--po-border)`,borderRadius:`2px`,fontSize:`12px`},".cm-panel input":{fontFamily:`var(--po-font-mono)`},".cm-tooltip":{backgroundColor:`var(--po-panel)`,border:`1px solid var(--po-border)`,color:`var(--po-text)`}},Che={comment:{color:`var(--po-faint)`,fontStyle:`italic`},keyword:{color:`var(--po-magenta)`},constant:{color:`var(--po-violet)`},literal:{color:`var(--po-orange)`},string:{color:`var(--po-green)`},regexp:{color:`var(--po-teal)`},operator:{color:`var(--po-blue)`},punctuation:{color:`var(--po-dim)`},variable:{color:`var(--po-text)`},property:{color:`var(--po-cyan)`},callable:{color:`var(--po-blue)`},type:{color:`var(--po-yellow)`},tag:{color:`var(--po-red)`},attribute:{color:`var(--po-yellow)`},meta:{color:`var(--po-faint)`},heading:{color:`var(--po-hi)`,fontWeight:`bold`},link:{color:`var(--po-cyan)`,textDecoration:`underline`},emphasis:{fontStyle:`italic`},strong:{fontWeight:`bold`},strikethrough:{textDecoration:`line-through`},invalid:{color:`var(--po-red)`}},whe=[{pattern:/^#!.*\b(?:bash|sh|zsh|dash|ksh)\b/,grammar:`shell`},{pattern:/^#!.*\bpython[\d.]*\b/,grammar:`python`},{pattern:/^#!.*\b(?:node|bun|deno)\b/,grammar:`javascript`}],The=/^\s*[[{][\s\S]*[\]}]\s*$/;function gO(e){let t=e.path===void 0||e.path.length===0?void 0:mO(e.path);if(t!==void 0)return t;let n=e.text??``;if(n.length===0)return;let r=n.slice(0,200);if(r.startsWith(`#!`)){let e=r.split(`
|
|
22
|
+
`,1)[0]??``;for(let t of whe)if(t.pattern.test(e))return t.grammar;return`shell`}return The.test(n)?`json`:void 0}function Ehe(e){return e===void 0?void 0:Che[e]}async function Dhe(){let{tagHighlighter:e,tags:t}=await pO(async()=>{let{tagHighlighter:e,tags:t}=await import(`./dist-C1hGqmUi.js`).then(e=>e.n);return{tagHighlighter:e,tags:t}},__vite__mapDeps([1,2]));return e([{tag:t.comment,class:`comment`},{tag:t.keyword,class:`keyword`},{tag:[t.atom,t.bool,t.null,t.self],class:`constant`},{tag:t.number,class:`literal`},{tag:[t.string,t.special(t.string)],class:`string`},{tag:t.regexp,class:`regexp`},{tag:[t.operator,t.operatorKeyword],class:`operator`},{tag:[t.punctuation,t.separator,t.bracket],class:`punctuation`},{tag:[t.variableName,t.definition(t.variableName)],class:`variable`},{tag:[t.propertyName,t.definition(t.propertyName)],class:`property`},{tag:[t.function(t.variableName),t.function(t.propertyName)],class:`callable`},{tag:[t.typeName,t.className,t.namespace],class:`type`},{tag:[t.tagName,t.angleBracket],class:`tag`},{tag:t.attributeName,class:`attribute`},{tag:[t.meta,t.processingInstruction,t.documentMeta],class:`meta`},{tag:t.heading,class:`heading`},{tag:[t.link,t.url],class:`link`},{tag:t.emphasis,class:`emphasis`},{tag:t.strong,class:`strong`},{tag:t.strikethrough,class:`strikethrough`},{tag:t.invalid,class:`invalid`}])}async function Ohe(e){let[{Language:t,LanguageSupport:n},r]=await Promise.all([pO(()=>import(`./dist-DwtF7q4e.js`),__vite__mapDeps([0,1,2])),xhe(e)]);if(r instanceof n)return r.language.parser;if(r instanceof t)return r.parser}async function khe(e,t,n){let[{highlightCode:r},i,a]=await Promise.all([pO(()=>import(`./dist-C1hGqmUi.js`).then(e=>e.n),__vite__mapDeps([1,2])),Dhe(),Ohe(t)]);if(n.aborted||a===void 0)return;let o=[[]];return r(e,a.parse(e),i,(e,t)=>{o[o.length-1]?.push(t===``?{text:e}:{text:e,token:t})},()=>o.push([])),o}var Ahe=4194304,_O=new Map,vO=0,yO=new Map;function jhe(e,t){let n=e.length*2+t.length*64;for(let e of t)for(let t of e)n+=t.text.length*2+64;if(!(n>Ahe)){for(;vO+n>Ahe||_O.size>=128;){let e=_O.entries().next().value;if(e===void 0)break;_O.delete(e[0]),vO-=e[1].bytes}_O.set(e,{lines:t,bytes:n}),vO+=n}}async function bO(e,t,n){if(n?.aborted||e.length===0||e.length>2e5)return;let r=`${t}\u0000${e}`,i=_O.get(r);if(i!==void 0)return _O.delete(r),_O.set(r,i),i.lines;let a=yO.get(r);if(a===void 0){let n=new AbortController;a={controller:n,users:0,promise:khe(e,t,n.signal)};let i=a;a.promise=a.promise.then(e=>(!n.signal.aborted&&e!==void 0&&jhe(r,e),e)).finally(()=>{yO.get(r)===i&&yO.delete(r)}),yO.set(r,a)}let o=a;return o.users+=1,new Promise((e,t)=>{let i=!1,a=()=>!i&&(i=!0,n?.removeEventListener(`abort`,s),--o.users,!0),s=()=>{a()&&(o.users===0&&(o.controller.abort(),yO.get(r)===o&&yO.delete(r)),e(void 0))};n?.addEventListener(`abort`,s,{once:!0}),o.promise.then(t=>{a()&&e(t)},e=>{a()&&t(e)})})}function Mhe(e,t){let n=[],r=t,i=[],a=[],o=()=>{i.length>0&&n.push({path:r,indices:i,text:a.join(`
|
|
23
23
|
`)}),i=[],a=[]};for(let[t,n]of e.entries())n.type===`tagged`?(i.push(t),a.push(n.value.content)):(o(),n.type===`file`&&(r=n.path));return o(),n}function Nhe(e){return JSON.stringify(e.map(({path:e,indices:t,text:n})=>[e,t,n]))}var Phe=`default`,Fhe=`none`,Ihe=`profile:`,Lhe=`Workspace default`,Rhe=`No profile`;function xO(e){return e===void 0?Phe:e===null?Fhe:`${Ihe}${e}`}function zhe(e){if(e===`none`)return null;if(e.startsWith(Ihe))return e.slice(8)}function SO(e){return e.identity?.name||e.name}function Bhe(e){return[e.identity?.role,e.identity?.contact].filter(Boolean).join(` · `)||(SO(e)===e.name?void 0:e.name)}function Vhe(e){return[{value:Phe,title:Lhe,subtitle:`Use what this workspace sets, if anything`},{value:Fhe,title:Rhe,subtitle:`Start without a profile`},...e.map(e=>{let t=Bhe(e);return{value:xO(e.name),title:SO(e),...t===void 0?{}:{subtitle:t}}})]}function Hhe(e,t){if(e===void 0)return Lhe;if(e===null)return Rhe;let n=t.find(t=>t.name===e);return n===void 0?e:SO(n)}var Uhe=/^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/;function CO(e){return typeof e==`string`&&e.length<=262144&&Uhe.test(e)?e:void 0}function wO(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Whe(e){if(!wO(e)||typeof e.name!=`string`||e.name===``||typeof e.sourceId!=`string`||e.sourceId===``)return;let t=wO(e.identity)?e.identity:void 0,n={};for(let e of[`name`,`icon`,`role`,`contact`]){let r=t?.[e];if(e===`icon`){let e=CO(r);e&&(n.icon=e)}else typeof r==`string`&&r!==``&&(n[e]=r)}return{name:e.name,sourceId:e.sourceId,...Object.keys(n).length===0?{}:{identity:n}}}function TO(e){if(!wO(e)||!Array.isArray(e.profiles)||e.readiness!==`ready`&&e.readiness!==`unavailable`)return;let t=new Set,n=[];for(let r of e.profiles){let e=Whe(r);e===void 0||t.has(e.name)||(t.add(e.name),n.push(e))}return{profiles:n,readiness:e.readiness}}var Ghe={status:`unavailable`,profiles:[]};async function Khe(e,t){let n;try{n=await e(t)}catch{n=void 0}if(t.aborted)return;let r=TO(n);return r===void 0?Ghe:{status:r.readiness,profiles:r.profiles}}var EO=6e4,DO=36e5;function qhe(e){if(e<EO)return`<1m`;if(e<DO)return`${Math.floor(e/EO)}m`;let t=Math.floor(e/DO),n=Math.floor(e%DO/EO);return`${t}h ${String(n).padStart(2,`0`)}m`}function OO(e,t){return`${e.label} · ${qhe(Math.max(0,t-e.since))}`}function Jhe(e,t){return EO-Math.max(0,t-e)%EO}function kO(e,t,n){return n||e.length<=t?{shown:[...e],hidden:0}:{shown:e.slice(0,t),hidden:e.length-t}}var Yhe=/^@file (.+)#([A-Za-z0-9_-]{8})$/u,Xhe=/^(>> | {3})?(\d+)#[a-z]{3}\|(.*)$/u;function Zhe(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function Qhe(e,t){let n=e?.content.filter(Zhe)??[],r=e===null?t:n.flatMap(e=>e.type===`text`?[e.text??``]:[]).join(`
|
|
24
24
|
`);if(r.length===0)return n.some(e=>e.type===`image`)?[`[Image attached]`]:[];let i=r.replaceAll(` `,` `).replaceAll(`\r
|
|
25
25
|
`,`
|
|
@@ -97,7 +97,7 @@ Defaulting to \`null\`.`}dW(bW,`getInvalidValueError`);var zke=Object.defineProp
|
|
|
97
97
|
`).map(e=>dO(e)),[e]);return(0,H.jsx)(`pre`,{"data-slot":`ansi-text`,...t,children:n.map((e,t)=>(0,H.jsxs)(V.Fragment,{children:[t>0?`
|
|
98
98
|
`:null,(0,H.jsx)(LK,{spans:e})]},t))})}function RK({className:e,...t}){return(0,H.jsx)(EEe,{"data-slot":`avatar`,className:J(`relative flex h-6 w-6 shrink-0 overflow-hidden rounded-full bg-po-deep`,e),...t})}function zK({className:e,...t}){return(0,H.jsx)(OEe,{"data-slot":`avatar-image`,className:J(`h-full w-full object-cover`,e),...t})}function BK({className:e,...t}){return(0,H.jsx)(AEe,{"data-slot":`avatar-fallback`,className:J(`flex h-full w-full items-center justify-center text-xs font-semibold text-po-dim`,e),...t})}var VK=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,HK=cSe,UK=(e,t)=>n=>{if(t?.variants==null)return HK(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=VK(t)||VK(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return HK(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},WK=UK(`inline-block shrink-0 rounded-full`,{variants:{tone:{neutral:`bg-po-faint`,muted:`bg-po-faint/40`,blue:`bg-po-blue`,green:`bg-po-green`,yellow:`bg-po-yellow`,red:`bg-po-red`,magenta:`bg-po-magenta`,violet:`bg-po-violet`,cyan:`bg-po-cyan`,orange:`bg-po-orange`,teal:`bg-po-teal`},size:{xs:`h-1 w-1`,sm:`h-1.5 w-1.5`,md:`h-2 w-2`,lg:`h-2.5 w-2.5`},pulse:{true:`animate-pulse`,false:``}},defaultVariants:{tone:`neutral`,size:`sm`,pulse:!1}});function GK({className:e,tone:t,size:n,pulse:r,...i}){return(0,H.jsx)(`span`,{"data-slot":`dot`,"aria-hidden":!0,className:J(WK({tone:t,size:n,pulse:r}),e),...i})}function KK(e){return e.split(/[-_.\s]+/u).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)}var qK=[`bg-po-tint-green`,`bg-po-tint-teal`,`bg-po-tint-blue`,`bg-po-tint-cyan`,`bg-po-tint-yellow`,`bg-po-tint-violet`],bMe={running:`green`,waiting:`yellow`,done:`neutral`,failed:`red`};function xMe(e){let t=0;for(let n of e)t=(t*31+n.charCodeAt(0))%997;return qK[t%qK.length]??qK[0]}function JK({name:e,seed:t=e,image:n,state:r,size:i=`md`}){return(0,H.jsxs)(`span`,{role:`img`,"aria-label":r?`${e}, ${r}`:e,"data-testid":`agent-avatar`,className:`relative inline-flex shrink-0`,children:[(0,H.jsxs)(RK,{className:`${i===`sm`?`size-6`:`size-8`} ${xMe(t)}`,children:[n?(0,H.jsx)(zK,{src:n,alt:``}):null,(0,H.jsx)(BK,{className:`text-sm text-po-hi`,children:KK(e)})]}),r?(0,H.jsx)(GK,{tone:bMe[r],size:`md`,pulse:r===`running`,className:`absolute -right-0.5 -bottom-0.5 ring-2 ring-po-panel`}):null]})}var YK=UK(`inline-flex items-center gap-1.5 whitespace-nowrap rounded border`,{variants:{tone:{neutral:`border-po-border text-po-dim`,blue:`border-po-blue/40 text-po-blue`,green:`border-po-green/40 text-po-green`,yellow:`border-po-yellow/40 text-po-yellow`,red:`border-po-red/40 text-po-red`,magenta:`border-po-magenta/40 text-po-magenta`,violet:`border-po-violet/40 text-po-violet`,cyan:`border-po-cyan/40 text-po-cyan`,orange:`border-po-orange/40 text-po-orange`,teal:`border-po-teal/40 text-po-teal`},size:{xs:`px-1.5 py-px text-sm font-semibold`,sm:`px-2 py-0.5 text-sm`,md:`px-2.5 py-1 text-sm`,lg:`px-3 py-1.5 text-base`}},defaultVariants:{tone:`neutral`,size:`sm`}});function XK({className:e,tone:t,size:n,asChild:r=!1,...i}){let a=r?tz:`span`;return(0,H.jsx)(a,{"data-slot":`badge`,className:J(YK({tone:t,size:n}),e),...i})}function ZK({delayDuration:e=300,...t}){return(0,H.jsx)(sMe,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function QK(e){return(0,H.jsx)(lMe,{"data-slot":`tooltip`,...e})}function $K(e){return(0,H.jsx)(uMe,{"data-slot":`tooltip-trigger`,...e})}function eq({className:e,sideOffset:t=4,children:n,...r}){return(0,H.jsx)(pMe,{children:(0,H.jsx)(mMe,{"data-slot":`tooltip-content`,sideOffset:t,className:J(`z-50 rounded border border-po-border bg-po-deep px-2 py-1 text-sm text-po-text shadow-lg data-[state=delayed-open]:animate-po-fade`,e),...r,children:n})})}function tq(e,t=4){let n=e.split(`/`).filter(e=>e!==``);if(n.length===0)return[e];let r=Math.max(3,t);return n.length<=r?n:[n[0]??``,`…`,...n.slice(n.length-(r-2))]}function SMe({path:e,keep:t,className:n,"data-testid":r}){let i=tq(e,t),a=i.length-1;return(0,H.jsx)(ZK,{children:(0,H.jsxs)(QK,{children:[(0,H.jsx)($K,{asChild:!0,children:(0,H.jsx)(`span`,{"data-slot":`breadcrumb`,"data-testid":r,title:void 0,className:J(`flex min-w-0 items-baseline gap-1 truncate font-mono text-sm`,n),children:i.map((e,t)=>(0,H.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1`,children:[t>0?(0,H.jsx)(`span`,{className:`shrink-0 text-po-faint`,children:`/`}):null,(0,H.jsx)(`span`,{className:t===a?`truncate font-semibold text-po-hi`:`min-w-0 truncate text-po-dim`,children:e})]},`${e}-${String(t)}`))})}),(0,H.jsx)(eq,{className:`max-w-[32rem] break-all whitespace-normal`,children:e})]})})}function nq({className:e,label:t,...n}){let r=(0,H.jsx)(yR,{"data-slot":`spinner`,"aria-hidden":!0,className:J(`h-3 w-3 animate-spin`,e),...n});return t===void 0?r:(0,H.jsxs)(`output`,{"data-slot":`spinner-status`,className:`inline-flex items-center`,children:[r,(0,H.jsx)(`span`,{className:`sr-only`,children:t})]})}var rq=UK(`inline-flex min-h-6 min-w-6 shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-medium transition-[color,background-color,border-color,filter] outline-none focus-visible:ring-2 focus-visible:ring-po-green/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{primary:`bg-po-selected font-semibold text-po-on-selected hover:brightness-110`,secondary:`border border-po-edge-magenta bg-po-tint-magenta font-semibold text-po-magenta hover:brightness-110`,outline:`border border-po-border text-po-dim hover:border-po-green/50 hover:text-po-hi`,ghost:`text-po-dim hover:bg-po-panel hover:text-po-hi`,subtle:`bg-po-panel text-po-dim hover:bg-po-deep hover:text-po-hi`,danger:`bg-po-red font-semibold text-po-rail hover:brightness-110`,"danger-outline":`border border-po-edge-red bg-po-tint-red font-semibold text-po-red hover:brightness-110`,success:`bg-po-green font-semibold text-po-rail hover:brightness-110`,link:`text-po-blue hover:underline`},size:{xs:`h-6 rounded px-1.5 text-sm`,sm:`h-7 px-2.5 text-sm`,md:`h-8 px-3 text-base`,lg:`h-9 px-3.5 text-base`,icon:`h-6 w-6 rounded p-0`,"icon-md":`h-8 w-8 p-0`,card:`h-auto w-full flex-col items-stretch justify-start gap-1 px-[11px] py-2.5 text-left whitespace-normal`}},defaultVariants:{variant:`outline`,size:`md`}});function Z({className:e,variant:t,size:n,asChild:r=!1,loading:i=!1,loadingLabel:a,disabled:o,type:s,children:c,...l}){let u=r?tz:`button`,d=!r&&i;return(0,H.jsx)(u,{"data-slot":`button`,type:r?void 0:s??`button`,"aria-busy":d?!0:void 0,disabled:r?void 0:o??d,className:J(rq({variant:t,size:n}),e),...l,children:r?c:(0,H.jsxs)(H.Fragment,{children:[d?(0,H.jsx)(nq,{label:a}):null,c]})})}var iq=(0,V.createContext)(void 0);function aq(e){let t=e.onOpenChange===void 0?void 0:t=>e.onOpenChange?.(t);return(0,H.jsx)(iq.Provider,{value:t,children:(0,H.jsx)(XB,{"data-slot":`dialog`,...e,onOpenChange:t})})}function CMe(e){return(0,H.jsx)(ZB,{"data-slot":`dialog-trigger`,...e})}function oq(e){return(0,H.jsx)(eV,{"data-slot":`dialog-portal`,...e})}function wMe(e){return(0,H.jsx)(cV,{"data-slot":`dialog-close`,...e})}function sq({className:e,onPointerDownCapture:t,...n}){let r=(0,V.useContext)(iq);return(0,H.jsx)(nV,{"data-slot":`dialog-overlay`,className:J(`fixed inset-0 z-40 bg-po-deep/70 data-[state=open]:animate-po-fade`,e),onPointerDownCapture:e=>{if(t?.(e),e.defaultPrevented||r===void 0)return;let n=e.currentTarget.nextElementSibling;if(n?.querySelector(`[data-slot="select-trigger"][data-state="open"]`)==null)return;let i=n?.getBoundingClientRect();i&&e.clientX>=i.left&&e.clientX<=i.right&&e.clientY>=i.top&&e.clientY<=i.bottom||(e.stopPropagation(),r(!1))},...n})}var TMe={sm:`w-[360px]`,md:`w-[480px]`,lg:`w-[620px]`};function cq({className:e,children:t,width:n=`md`,...r}){return(0,H.jsxs)(oq,{children:[(0,H.jsx)(sq,{}),(0,H.jsx)(iV,{"data-slot":`dialog-content`,className:J(`fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-24px)] max-w-[calc(100vw-24px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-po-border bg-po-panel shadow-2xl outline-none data-[state=open]:animate-po-pop`,TMe[n],e),...r,children:t})]})}function lq({className:e,dismissible:t=!1,closeLabel:n=`close`,children:r,...i}){return(0,H.jsxs)(`div`,{"data-slot":`dialog-header`,className:J(`flex min-w-0 items-center justify-between gap-3 border-b border-po-border px-3 py-3 sm:px-4`,e),...i,children:[r,t?(0,H.jsx)(cV,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"aria-label":n,className:`text-po-faint hover:text-po-hi`,children:(0,H.jsx)(jR,{className:`h-3 w-3`})})}):null]})}function uq({className:e,...t}){return(0,H.jsx)(oV,{"data-slot":`dialog-title`,className:J(`text-xl font-semibold text-po-hi`,e),...t})}function dq({className:e,...t}){return(0,H.jsx)(sV,{"data-slot":`dialog-description`,className:J(`text-sm leading-relaxed text-po-dim`,e),...t})}function fq({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`dialog-body`,className:J(`flex min-h-0 flex-col gap-3 overflow-y-auto px-3 py-3 sm:px-4 sm:py-4`,e),...t})}var pq=UK(`flex shrink-0 items-center gap-2`,{variants:{variant:{plain:`justify-end`,bar:`min-h-[34px] flex-wrap justify-between border-t border-po-border-soft bg-po-deep px-3 py-1.5 sm:flex-nowrap sm:px-4 sm:py-0`}},defaultVariants:{variant:`plain`}});function mq({className:e,variant:t,...n}){return(0,H.jsx)(`div`,{"data-slot":`dialog-footer`,className:J(pq({variant:t}),e),...n})}var EMe={"+":`bg-po-tint-green text-po-green`,"-":`bg-po-tint-red text-po-red`," ":`text-po-dim`};function DMe(e){return e===`+`||e===`-`||e===` `}function OMe({hunks:e,testId:t,onSelect:n,renderAfterRow:r,className:i}){let a=che(e);return e.length===0?(0,H.jsx)(`p`,{"data-testid":`${t}-empty`,className:`px-2 py-1 text-sm text-po-dim`,children:`no lines changed`}):(0,H.jsx)(`div`,{"data-testid":t,"data-diff-surface":t,onMouseUp:()=>{if(n===void 0)return;let e=globalThis.getSelection?.(),r=e?.toString()??``;if(r.trim()===``)return;let i=lhe([...document.querySelectorAll(`[data-diff-surface="${t}"] [data-diff-line]`)].filter(t=>e?.containsNode(t,!0)===!0).map(e=>({marker:e.dataset.diffMarker,line:Number(e.dataset.diffLine)})).filter(e=>DMe(e.marker)));i!==void 0&&n({...i,snippet:r})},className:J(`overflow-x-auto font-mono text-sm leading-normal`,i),children:e.map((e,t)=>(0,H.jsxs)(`div`,{children:[t>0?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-0.5 text-2xs text-po-faint`,children:[(0,H.jsx)(`span`,{className:`h-px flex-1 bg-po-border-soft`}),(0,H.jsx)(`span`,{children:`⋯`}),(0,H.jsx)(`span`,{className:`h-px flex-1 bg-po-border-soft`})]}):null,e.rows.map((e,t)=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsxs)(`div`,{"data-diff-line":e.line,"data-diff-marker":e.marker,className:J(`flex whitespace-pre`,EMe[e.marker]),children:[n===void 0?(0,H.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 select-none pr-2 pl-2 text-right text-po-faint`,style:{width:`${a+2}ch`},children:e.line}):(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,"data-diff-gutter":e.line,"aria-label":`comment on ${e.marker===`-`?`removed `:``}line ${e.line}`,onClick:()=>n({side:e.marker===`-`?`old`:`new`,startLine:e.line,endLine:e.line,snippet:e.content}),className:`h-auto min-h-0 min-w-0 shrink-0 select-none justify-end rounded-none py-0 pr-2 pl-2 font-normal text-sm text-po-faint hover:bg-transparent hover:text-po-blue`,style:{width:`${a+2}ch`},children:e.line}),(0,H.jsx)(`span`,{className:`shrink-0 select-none pr-1`,children:e.marker}),(0,H.jsx)(`span`,{className:`min-w-0`,children:e.content})]}),r?.(e)]},`${e.marker}-${e.line}-${t}`))]},`${e.start}-${t}`))})}function kMe({open:e,onOpenChange:t,side:n,title:r,children:i,className:a,showHeader:o=!0,"data-testid":s,backdropTestId:c}){let l=(0,V.useRef)(null);return(0,H.jsx)(aq,{open:e,onOpenChange:t,children:(0,H.jsxs)(oq,{children:[(0,H.jsx)(sq,{"data-testid":c}),(0,H.jsxs)(iV,{"aria-describedby":void 0,"data-testid":s,className:J(`fixed inset-y-0 z-50 flex w-[min(300px,calc(100vw-48px))] flex-col overflow-y-auto border-po-border bg-po-rail outline-none`,n===`left`?`left-0 border-r`:`right-0 border-l`,a),onOpenAutoFocus:()=>{l.current=document.activeElement instanceof HTMLElement?document.activeElement:null},onCloseAutoFocus:e=>{e.preventDefault(),l.current?.isConnected&&l.current.focus()},children:[o?(0,H.jsx)(lq,{dismissible:!0,closeLabel:`hide ${r.toLowerCase()}`,children:(0,H.jsx)(uq,{children:r})}):(0,H.jsx)(uq,{className:`sr-only`,children:r}),i]})]})})}function hq(e){return(0,H.jsx)(JOe,{"data-slot":`dropdown-menu`,...e})}function gq(e){return(0,H.jsx)(XOe,{"data-slot":`dropdown-menu-trigger`,...e})}function AMe(e){return(0,H.jsx)($Oe,{"data-slot":`dropdown-menu-group`,...e})}var _q=`z-50 flex min-w-[120px] flex-col overflow-hidden rounded border border-po-border bg-po-panel py-1 shadow-xl outline-none data-[state=open]:animate-po-rise`;function vq({className:e,align:t=`end`,sideOffset:n=4,...r}){return(0,H.jsx)($U,{children:(0,H.jsx)(QOe,{"data-slot":`dropdown-menu-content`,align:t,sideOffset:n,className:J(_q,e),...r})})}var yq=UK(`flex w-full cursor-pointer items-center gap-2 px-2.5 py-1.5 text-left text-base outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-40 data-[highlighted]:bg-po-deep`,{variants:{variant:{default:`text-po-hi`,destructive:`text-po-red`},indented:{true:`pl-7`,false:``}},defaultVariants:{variant:`default`,indented:!1}});function bq({className:e,variant:t,indented:n,...r}){return(0,H.jsx)(tke,{"data-slot":`dropdown-menu-item`,"data-variant":t??`default`,className:J(yq({variant:t,indented:n}),e),...r})}function xq({children:e}){return(0,H.jsx)(`span`,{className:`pointer-events-none absolute left-2.5 flex h-3 w-3 items-center justify-center`,children:(0,H.jsx)(ake,{children:e})})}function jMe({className:e,variant:t,children:n,...r}){return(0,H.jsxs)(nke,{"data-slot":`dropdown-menu-checkbox-item`,className:J(`relative`,yq({variant:t,indented:!0}),e),...r,children:[(0,H.jsx)(xq,{children:(0,H.jsx)(LL,{className:`h-3 w-3 text-po-blue`})}),n]})}function Sq(e){return(0,H.jsx)(rke,{"data-slot":`dropdown-menu-radio-group`,...e})}function Cq({className:e,variant:t,children:n,...r}){return(0,H.jsxs)(ike,{"data-slot":`dropdown-menu-radio-item`,className:J(`relative`,yq({variant:t,indented:!0}),e),...r,children:[(0,H.jsx)(xq,{children:(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-po-blue`})}),n]})}function MMe(e){return(0,H.jsx)(ske,{"data-slot":`dropdown-menu-sub`,...e})}function NMe({className:e,children:t,...n}){return(0,H.jsxs)(cke,{"data-slot":`dropdown-menu-sub-trigger`,className:J(yq(),`data-[state=open]:bg-po-deep`,e),...n,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),(0,H.jsx)(VL,{className:`h-3 w-3 shrink-0 text-po-faint`})]})}function PMe({className:e,sideOffset:t=2,...n}){return(0,H.jsx)($U,{children:(0,H.jsx)(lke,{"data-slot":`dropdown-menu-sub-content`,sideOffset:t,className:J(_q,e),...n})})}function wq({className:e,...t}){return(0,H.jsx)(eke,{"data-slot":`dropdown-menu-label`,className:J(`px-2.5 py-1 text-sm font-semibold text-po-dim first-letter:uppercase`,e),...t})}function FMe({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:J(`ml-auto shrink-0 text-sm text-po-dim`,e),...t})}function Tq({className:e,...t}){return(0,H.jsx)(oke,{"data-slot":`dropdown-menu-separator`,className:J(`my-1 h-px bg-po-border-soft`,e),...t})}function Eq({className:e,...t}){return(0,H.jsx)(BEe,{"data-slot":`checkbox`,className:J(`flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-sm border border-po-border bg-po-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-po-green/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-po-green data-[state=indeterminate]:border-po-green`,e),...t,children:(0,H.jsx)(HEe,{"data-slot":`checkbox-indicator`,className:`text-po-green`,children:(0,H.jsx)(LL,{className:`h-2.5 w-2.5`})})})}var Dq={slot:`author.media-review`,description:`Provide an annotation and feedback panel for an image or diagram opened from Markdown.`,parse:e=>{if(typeof e!=`object`||!e)return null;let t=e;return t.version===1&&typeof t.panel==`function`?t:null}},Oq=(0,V.createContext)(void 0);function kq(e){let t=typeof e?.slotData==`function`?e.slotData(Dq)[0]?.data.panel:void 0;if(e!==void 0&&t!==void 0)return(n,r)=>(0,V.createElement)(t,{...e,media:n,onClose:r})}var Aq=/^\s*\d*\.?\d+(?:px)?\s*$/u;function jq(e){let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`svg`);if(t===null)return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;let n=t.getAttribute(`width`),r=t.getAttribute(`height`),i=n!==null&&r!==null&&Aq.test(n)&&Aq.test(r),a=(t.getAttribute(`viewBox`)??``).trim().split(/[\s,]+/u).map(Number);return!i&&a.length===4&&a[2]>0&&a[3]>0&&(t.setAttribute(`width`,String(a[2])),t.setAttribute(`height`,String(a[3]))),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(t))}`}async function IMe(e,t){if(!e.startsWith(`blob:`))return e;let n=await(await fetch(e,t===void 0?{}:{signal:t})).blob();return n.type.startsWith(`image/svg+xml`)?jq(await n.text()):e}function Mq(e,t={}){let{path:n,grammar:r}=t,i=r??gO({path:n,text:e}),a=`${i??``}\u0000${e}`,[o,s]=(0,V.useState)(void 0);return(0,V.useEffect)(()=>{if(i===void 0)return;let t=!0,n=new AbortController;return bO(e,i,n.signal).then(e=>{t&&e!==void 0&&s({signature:a,lines:e})},()=>void 0),()=>{t=!1,n.abort()}},[e,i,a]),o?.signature===a?o.lines:void 0}function Nq({spans:e,text:t,...n}){return e===void 0?(0,H.jsx)(`span`,{...n,children:t}):(0,H.jsx)(`span`,{...n,children:e.map((e,t)=>(0,H.jsx)(`span`,{style:Ehe(e.token),children:e.text},t))})}function Pq({className:e,text:t,path:n,grammar:r,...i}){let a=Mq(t,{path:n,grammar:r}),o=t.split(`
|
|
99
99
|
`);return(0,H.jsx)(`pre`,{"data-slot":`syntax-text`,"data-highlighted":a!==void 0,className:J(`whitespace-pre-wrap break-words [overflow-wrap:anywhere] font-mono`,e),...i,children:(a??o).map((e,t)=>(0,H.jsxs)(V.Fragment,{children:[t>0?`
|
|
100
|
-
`:null,(0,H.jsx)(Nq,{spans:typeof e==`string`?void 0:e,text:typeof e==`string`?e:``})]},t))})}var LMe={javascript:`javascript`,typescript:`typescript`,python:`python`,shell:`shell`,console:`shell`,docker:`dockerfile`};function RMe(e){return/(?:^|\s)language-(\S+)/.exec(e??``)?.[1]?.toLowerCase()}function zMe(e){if(e===void 0||e.length===0)return;let t=LMe[e];return t===void 0?mO(e)??mO(`fence.${e}`):t}var BMe={idle:`copy`,copied:`copied`,failed:`copying was blocked by the browser`};function VMe({text:e,className:t}){let[n,r]=(0,V.useState)(`idle`);(0,V.useEffect)(()=>{if(n===`idle`)return;let e=setTimeout(()=>r(`idle`),1500);return()=>clearTimeout(e)},[n]);let i=(0,V.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>r(`copied`),()=>r(`failed`))},[e]),a=BMe[n];return(0,H.jsx)(Z,{type:`button`,variant:`ghost`,size:`icon`,"data-testid":`copy-button`,"data-state":n,title:a,"aria-label":a,onClick:i,className:J(`opacity-60 hover:opacity-100`,t),children:n===`copied`?(0,H.jsx)(LL,{className:`size-3 text-po-green`}):(0,H.jsx)(YL,{className:`size-3`})})}var Fq;async function HMe(){return Fq??=pO(async()=>{let{default:e}=await import(`./mermaid.core-Bkht5CEJ.js`);return{default:e}},__vite__mapDeps([12,13,14,2,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30])).then(({default:e})=>(e.initialize({startOnLoad:!1,fontFamily:`inherit`,theme:`dark`,securityLevel:`strict`,suppressErrorRendering:!0}),e)),Fq}async function UMe(e,t){let{svg:n}=await(await HMe()).render(e,t);return n}function WMe({code:e}){let t=`mermaid-${(0,V.useId)().replaceAll(/[^a-zA-Z0-9]/g,``)}`,[n,r]=(0,V.useState)(void 0),i=(0,V.useContext)(Oq);if((0,V.useEffect)(()=>{let n=!0;return UMe(t,e).then(t=>{n&&r({source:e,svg:t})},()=>void 0),()=>{n=!1}},[e,t]),n?.source!==e)return(0,H.jsx)(Pq,{text:e,className:`text-po-text`});let a=(0,H.jsx)(`div`,{"data-testid":`mermaid-diagram`,dangerouslySetInnerHTML:{__html:n.svg},className:`flex justify-center overflow-x-auto [&_svg]:h-auto [&_svg]:max-w-full`});return i===void 0?a:(0,H.jsx)(`button`,{type:`button`,"data-testid":`markdown-media-open`,"aria-label":`Open diagram full screen`,onClick:()=>i.open({kind:`mermaid`,title:`Diagram`,url:jq(n.svg.replaceAll(`font-family:inherit`,`font-family:"IBM Plex Sans",ui-sans-serif,system-ui,sans-serif`)),mermaidSource:e}),className:`block w-full cursor-zoom-in rounded focus-visible:ring-2 focus-visible:ring-po-blue focus-visible:outline-none`,children:a})}function Iq({text:e,className:t}){let n=RMe(t),r=n===`mermaid`?(0,H.jsx)(WMe,{code:e}):(0,H.jsx)(Pq,{text:e,grammar:zMe(n),className:`overflow-x-auto text-sm leading-relaxed text-po-text`});return(0,H.jsxs)(`div`,{"data-slot":`code-block`,"data-language":n??``,className:`relative rounded border border-po-border bg-po-deep p-2.5`,children:[r,(0,H.jsx)(VMe,{text:e,className:`absolute top-1.5 right-1.5`})]})}function Lq({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`skeleton`,"aria-hidden":!0,className:J(`animate-pulse rounded bg-po-border-soft`,e),...t})}var GMe=(0,V.lazy)(async()=>({default:(await pO(async()=>{let{CodeEditorView:e}=await import(`./CodeEditorView-h_xe1UJU.js`);return{CodeEditorView:e}},__vite__mapDeps([31,2,1,0]))).CodeEditorView}));function KMe({className:e,...t}){return(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Lq,{className:J(`min-h-0`,e)}),children:(0,H.jsx)(GMe,{className:e,...t})})}function qMe(e){return(0,H.jsx)(wwe,{"data-slot":`collapsible`,...e})}function JMe(e){return(0,H.jsx)(Ewe,{"data-slot":`collapsible-trigger`,...e})}function YMe({className:e,...t}){return(0,H.jsx)(Owe,{"data-slot":`collapsible-content`,className:J(`overflow-hidden`,e),...t})}var Rq=UK(`min-w-0 pointer-coarse:text-xl text-po-hi outline-none placeholder:text-po-faint disabled:opacity-50 aria-invalid:border-po-edge-red aria-invalid:text-po-red`,{variants:{variant:{default:`rounded border border-po-border bg-po-deep transition-colors focus:border-po-green/60`,bare:`border-0 bg-transparent`},size:{xs:`min-h-6 px-1.5 py-0.5 text-sm`,sm:`min-h-7 px-2 py-1 text-sm`,md:`min-h-8 px-2.5 py-1.5 text-base`,lg:`min-h-9 px-3 py-1.5 text-base`}},compoundVariants:[{variant:`bare`,class:`min-h-0 p-0`}],defaultVariants:{variant:`default`,size:`md`}});function zq({className:e,type:t,variant:n,size:r,...i}){return(0,H.jsx)(`input`,{type:t??`text`,"data-slot":`input`,spellCheck:!1,className:J(Rq({variant:n,size:r}),e),...i})}function Bq(e,t){let{options:n,cursor:r,onCursorChange:i,onSelect:a}=t,o=n.length;if(o===0)return;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),i((r+(e.key===`ArrowDown`?1:-1)+o)%o);return}if(e.key===`Enter`){let t=n[r];if(t===void 0)return;e.preventDefault(),e.stopPropagation(),a(t);return}let s=Number.parseInt(e.key,10)-1,c=Number.isInteger(s)&&s<9?n[s]:void 0;c!==void 0&&(e.preventDefault(),e.stopPropagation(),a(c))}function Vq(e){return e>9?`up/down move · enter select · 1-9 jump`:`1-9 select · enter confirm`}function Hq(e){return e<9?String(e+1):`·`}var Uq=UK(`flex min-h-0 flex-1 flex-col overflow-y-auto`,{variants:{density:{compact:`gap-0.5 p-1.5`,comfortable:`gap-1.5`}},defaultVariants:{density:`comfortable`}}),Wq=UK(`flex shrink-0 cursor-pointer items-center text-left outline-none`,{variants:{density:{compact:`gap-2.5 rounded-md px-2 py-[7px]`,comfortable:`min-h-[42px] gap-3 rounded-md border px-[11px] py-2 text-sm text-po-text transition-colors`},active:{true:``,false:``}},compoundVariants:[{density:`compact`,active:!0,class:`bg-po-tint-green`},{density:`comfortable`,active:!0,class:`border-po-edge-green bg-po-tint-green`},{density:`comfortable`,active:!1,class:`border-po-border-soft`}],defaultVariants:{density:`comfortable`,active:!1}}),Gq=UK(`flex shrink-0 items-center justify-center rounded-full font-semibold`,{variants:{density:{compact:`h-[15px] w-[15px] border border-po-border text-2xs text-po-faint`,comfortable:`h-[18px] w-[18px] bg-po-deep text-xs text-po-dim`}},defaultVariants:{density:`comfortable`}});function Kq({className:e,density:t,active:n,marker:r,children:i,...a}){return(0,H.jsxs)(`button`,{type:`button`,role:`option`,"data-slot":`option-row`,"aria-selected":n??!1,"data-cursor":n??!1,className:J(Wq({density:t,active:n}),e),...a,children:[r===void 0?null:(0,H.jsx)(`span`,{className:Gq({density:t}),children:r}),i]})}function qq({className:e,density:t,...n}){return(0,H.jsx)(`span`,{"data-slot":`option-label`,className:J(`min-w-0 flex-1`,t===`compact`?`truncate text-sm text-po-text`:`break-words`,e),...n})}function Jq({className:e,options:t,cursor:n,onCursorChange:r,onSelect:i,testIdPrefix:a,density:o=`comfortable`,...s}){let c=(0,V.useRef)(null);return(0,V.useEffect)(()=>{c.current?.children[n]?.scrollIntoView({block:`nearest`})},[n]),(0,H.jsx)(`div`,{ref:c,role:`listbox`,"aria-label":`options`,"data-slot":`option-list`,"data-testid":`${a}s`,className:J(Uq({density:o}),e),...s,children:t.map((e,t)=>(0,H.jsx)(Kq,{density:o,active:t===n,marker:Hq(t),"data-testid":`${a}-${String(t)}`,title:e,onMouseEnter:()=>r(t),onClick:()=>i(e),children:(0,H.jsx)(qq,{density:o,children:e})},e))})}function XMe({open:e,onOpenChange:t,title:n,titleVisible:r=!1,className:i,children:a,width:o=`lg`,...s}){return(0,H.jsx)(aq,{open:e,onOpenChange:t,children:(0,H.jsxs)(cq,{"data-slot":`command-dialog`,width:o,className:J(`max-h-[70vh]`,i),...s,children:[(0,H.jsx)(uq,{className:r?void 0:`sr-only`,children:n}),a]})})}function Yq({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-header`,className:J(`flex shrink-0 items-center gap-2 border-b border-po-border px-3 py-2.5`,e),...t})}function Xq({className:e,...t}){return(0,H.jsx)(zq,{"data-slot":`command-input`,variant:`bare`,autoFocus:!0,autoComplete:`off`,className:J(`flex-1`,e),...t})}function Zq({className:e,...t}){return(0,H.jsx)(`div`,{role:`listbox`,"data-slot":`command-list`,className:J(`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5`,e),...t})}function ZMe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-group`,className:J(`flex flex-col gap-0.5`,e),...t})}function Qq({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-group-label`,className:J(`px-2 pt-2 pb-1 text-sm font-semibold text-po-dim first-letter:uppercase`,e),...t})}function $q({density:e=`compact`,...t}){return(0,H.jsx)(Kq,{"data-slot":`command-item`,density:e,...t})}function eJ(e){return(0,H.jsx)(qq,{"data-slot":`command-item-label`,density:`compact`,...e})}function tJ({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-empty`,className:J(`px-2 py-6 text-center text-base text-po-dim`,e),...t})}function nJ({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-footer`,className:J(`flex min-h-[30px] shrink-0 items-center justify-between gap-3 border-t border-po-border-soft bg-po-deep px-3 text-sm text-po-dim`,e),...t})}function rJ({title:e,description:t,children:n,className:r,asChild:i=!1,...a}){let o=i?tz:`div`;return(0,H.jsx)(o,{"data-slot":`empty-state`,className:J(`flex min-w-0 flex-1 items-center justify-center px-3 py-4 sm:px-4`,r),...a,children:(0,H.jsxs)(`div`,{className:`flex min-w-0 w-full max-w-[520px] flex-col items-center gap-3 text-center`,children:[(0,H.jsx)(`span`,{className:`text-lg font-semibold text-po-hi`,children:e}),t?(0,H.jsx)(`span`,{className:`text-base leading-relaxed text-po-dim`,children:t}):null,n]})})}function iJ(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=iJ(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var QMe={value:()=>{}};function aJ(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new oJ(n)}function oJ(e){this._=e}function $Me(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}oJ.prototype=aJ.prototype={constructor:oJ,on:function(e,t){var n=this._,r=$Me(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=eNe(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=sJ(n[i],e.name,t);else if(t==null)for(i in n)n[i]=sJ(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new oJ(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function eNe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function sJ(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=QMe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var cJ={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function lJ(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),cJ.hasOwnProperty(t)?{space:cJ[t],local:e}:e}function tNe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function nNe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function uJ(e){var t=lJ(e);return(t.local?nNe:tNe)(t)}function rNe(){}function dJ(e){return e==null?rNe:function(){return this.querySelector(e)}}function iNe(e){typeof e!=`function`&&(e=dJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new EJ(r,this._parents)}function aNe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function oNe(){return[]}function fJ(e){return e==null?oNe:function(){return this.querySelectorAll(e)}}function sNe(e){return function(){return aNe(e.apply(this,arguments))}}function cNe(e){e=typeof e==`function`?sNe(e):fJ(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new EJ(r,i)}function pJ(e){return function(){return this.matches(e)}}function mJ(e){return function(t){return t.matches(e)}}var lNe=Array.prototype.find;function uNe(e){return function(){return lNe.call(this.children,e)}}function dNe(){return this.firstElementChild}function fNe(e){return this.select(e==null?dNe:uNe(typeof e==`function`?e:mJ(e)))}var pNe=Array.prototype.filter;function mNe(){return Array.from(this.children)}function hNe(e){return function(){return pNe.call(this.children,e)}}function gNe(e){return this.selectAll(e==null?mNe:hNe(typeof e==`function`?e:mJ(e)))}function _Ne(e){typeof e!=`function`&&(e=pJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new EJ(r,this._parents)}function hJ(e){return Array(e.length)}function vNe(){return new EJ(this._enter||this._groups.map(hJ),this._parents)}function gJ(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}gJ.prototype={constructor:gJ,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function yNe(e){return function(){return e}}function bNe(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new gJ(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function xNe(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new gJ(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function SNe(e){return e.__data__}function CNe(e,t){if(!arguments.length)return Array.from(this,SNe);var n=t?xNe:bNe,r=this._parents,i=this._groups;typeof e!=`function`&&(e=yNe(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=wNe(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new EJ(o,r),o._enter=s,o._exit=c,o}function wNe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function TNe(){return new EJ(this._exit||this._groups.map(hJ),this._parents)}function ENe(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function DNe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new EJ(s,this._parents)}function ONe(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function kNe(e){e||=ANe;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new EJ(i,this._parents).order()}function ANe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function jNe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function MNe(){return Array.from(this)}function NNe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function PNe(){let e=0;for(let t of this)++e;return e}function FNe(){return!this.node()}function INe(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function LNe(e){return function(){this.removeAttribute(e)}}function RNe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zNe(e,t){return function(){this.setAttribute(e,t)}}function BNe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function VNe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function HNe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function UNe(e,t){var n=lJ(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?RNe:LNe:typeof t==`function`?n.local?HNe:VNe:n.local?BNe:zNe)(n,t))}function _J(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function WNe(e){return function(){this.style.removeProperty(e)}}function GNe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function KNe(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function qNe(e,t,n){return arguments.length>1?this.each((t==null?WNe:typeof t==`function`?KNe:GNe)(e,t,n??``)):vJ(this.node(),e)}function vJ(e,t){return e.style.getPropertyValue(t)||_J(e).getComputedStyle(e,null).getPropertyValue(t)}function JNe(e){return function(){delete this[e]}}function YNe(e,t){return function(){this[e]=t}}function XNe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ZNe(e,t){return arguments.length>1?this.each((t==null?JNe:typeof t==`function`?XNe:YNe)(e,t)):this.node()[e]}function yJ(e){return e.trim().split(/^|\s+/)}function bJ(e){return e.classList||new xJ(e)}function xJ(e){this._node=e,this._names=yJ(e.getAttribute(`class`)||``)}xJ.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function SJ(e,t){for(var n=bJ(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function CJ(e,t){for(var n=bJ(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function QNe(e){return function(){SJ(this,e)}}function $Ne(e){return function(){CJ(this,e)}}function ePe(e,t){return function(){(t.apply(this,arguments)?SJ:CJ)(this,e)}}function tPe(e,t){var n=yJ(e+``);if(arguments.length<2){for(var r=bJ(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?ePe:t?QNe:$Ne)(n,t))}function nPe(){this.textContent=``}function rPe(e){return function(){this.textContent=e}}function iPe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function aPe(e){return arguments.length?this.each(e==null?nPe:(typeof e==`function`?iPe:rPe)(e)):this.node().textContent}function oPe(){this.innerHTML=``}function sPe(e){return function(){this.innerHTML=e}}function cPe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function lPe(e){return arguments.length?this.each(e==null?oPe:(typeof e==`function`?cPe:sPe)(e)):this.node().innerHTML}function uPe(){this.nextSibling&&this.parentNode.appendChild(this)}function dPe(){return this.each(uPe)}function fPe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pPe(){return this.each(fPe)}function mPe(e){var t=typeof e==`function`?e:uJ(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function hPe(){return null}function gPe(e,t){var n=typeof e==`function`?e:uJ(e),r=t==null?hPe:typeof t==`function`?t:dJ(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function _Pe(){var e=this.parentNode;e&&e.removeChild(this)}function vPe(){return this.each(_Pe)}function yPe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bPe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function xPe(e){return this.select(e?bPe:yPe)}function SPe(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function CPe(e){return function(t){e.call(this,t,this.__data__)}}function wPe(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function TPe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function EPe(e,t,n){return function(){var r=this.__on,i,a=CPe(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function DPe(e,t,n){var r=wPe(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?EPe:TPe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function wJ(e,t,n){var r=_J(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function OPe(e,t){return function(){return wJ(this,e,t)}}function kPe(e,t){return function(){return wJ(this,e,t.apply(this,arguments))}}function APe(e,t){return this.each((typeof t==`function`?kPe:OPe)(e,t))}function*jPe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var TJ=[null];function EJ(e,t){this._groups=e,this._parents=t}function DJ(){return new EJ([[document.documentElement]],TJ)}function MPe(){return this}EJ.prototype=DJ.prototype={constructor:EJ,select:iNe,selectAll:cNe,selectChild:fNe,selectChildren:gNe,filter:_Ne,data:CNe,enter:vNe,exit:TNe,join:ENe,merge:DNe,selection:MPe,order:ONe,sort:kNe,call:jNe,nodes:MNe,node:NNe,size:PNe,empty:FNe,each:INe,attr:UNe,style:qNe,property:ZNe,classed:tPe,text:aPe,html:lPe,raise:dPe,lower:pPe,append:mPe,insert:gPe,remove:vPe,clone:xPe,datum:SPe,on:DPe,dispatch:APe,[Symbol.iterator]:jPe};function OJ(e){return typeof e==`string`?new EJ([[document.querySelector(e)]],[document.documentElement]):new EJ([[e]],TJ)}function NPe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function kJ(e,t){if(e=NPe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var PPe={passive:!1},AJ={capture:!0,passive:!1};function jJ(e){e.stopImmediatePropagation()}function MJ(e){e.preventDefault(),e.stopImmediatePropagation()}function NJ(e){var t=e.document.documentElement,n=OJ(e).on(`dragstart.drag`,MJ,AJ);`onselectstart`in t?n.on(`selectstart.drag`,MJ,AJ):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function PJ(e,t){var n=e.document.documentElement,r=OJ(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,MJ,AJ),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var FJ=e=>()=>e;function IJ(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}IJ.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function FPe(e){return!e.ctrlKey&&!e.button}function IPe(){return this.parentNode}function LPe(e,t){return t??{x:e.x,y:e.y}}function RPe(){return navigator.maxTouchPoints||`ontouchstart`in this}function LJ(){var e=FPe,t=IPe,n=LPe,r=RPe,i={},a=aJ(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,PPe).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(OJ(n.view).on(`mousemove.drag`,m,AJ).on(`mouseup.drag`,h,AJ),NJ(n.view),jJ(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(MJ(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){OJ(e.view).on(`mousemove.drag mouseup.drag`,null),PJ(e.view,l),MJ(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(jJ(n),c(`start`,n,i[s]))}function _(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(MJ(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(jJ(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=kJ(l||r,t),p,m,h;if((h=n.call(e,new IJ(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=kJ(l||a,t),_=o}u.call(r,e,new IJ(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:FJ(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:FJ(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:FJ(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:FJ(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function RJ(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function zJ(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function BJ(){}var VJ=.7,HJ=1/VJ,UJ=`\\s*([+-]?\\d+)\\s*`,WJ=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,GJ=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,zPe=/^#([0-9a-f]{3,8})$/,BPe=RegExp(`^rgb\\(${UJ},${UJ},${UJ}\\)$`),VPe=RegExp(`^rgb\\(${GJ},${GJ},${GJ}\\)$`),HPe=RegExp(`^rgba\\(${UJ},${UJ},${UJ},${WJ}\\)$`),UPe=RegExp(`^rgba\\(${GJ},${GJ},${GJ},${WJ}\\)$`),WPe=RegExp(`^hsl\\(${WJ},${GJ},${GJ}\\)$`),GPe=RegExp(`^hsla\\(${WJ},${GJ},${GJ},${WJ}\\)$`),KJ={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};RJ(BJ,YJ,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qJ,formatHex:qJ,formatHex8:KPe,formatHsl:qPe,formatRgb:JJ,toString:JJ});function qJ(){return this.rgb().formatHex()}function KPe(){return this.rgb().formatHex8()}function qPe(){return sY(this).formatHsl()}function JJ(){return this.rgb().formatRgb()}function YJ(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=zPe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?XJ(t):n===3?new eY(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ZJ(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ZJ(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=BPe.exec(e))?new eY(t[1],t[2],t[3],1):(t=VPe.exec(e))?new eY(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=HPe.exec(e))?ZJ(t[1],t[2],t[3],t[4]):(t=UPe.exec(e))?ZJ(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=WPe.exec(e))?oY(t[1],t[2]/100,t[3]/100,1):(t=GPe.exec(e))?oY(t[1],t[2]/100,t[3]/100,t[4]):KJ.hasOwnProperty(e)?XJ(KJ[e]):e===`transparent`?new eY(NaN,NaN,NaN,0):null}function XJ(e){return new eY(e>>16&255,e>>8&255,e&255,1)}function ZJ(e,t,n,r){return r<=0&&(e=t=n=NaN),new eY(e,t,n,r)}function QJ(e){return e instanceof BJ||(e=YJ(e)),e?(e=e.rgb(),new eY(e.r,e.g,e.b,e.opacity)):new eY}function $J(e,t,n,r){return arguments.length===1?QJ(e):new eY(e,t,n,r??1)}function eY(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}RJ(eY,$J,zJ(BJ,{brighter(e){return e=e==null?HJ:HJ**+e,new eY(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?VJ:VJ**+e,new eY(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new eY(iY(this.r),iY(this.g),iY(this.b),rY(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tY,formatHex:tY,formatHex8:JPe,formatRgb:nY,toString:nY}));function tY(){return`#${aY(this.r)}${aY(this.g)}${aY(this.b)}`}function JPe(){return`#${aY(this.r)}${aY(this.g)}${aY(this.b)}${aY((isNaN(this.opacity)?1:this.opacity)*255)}`}function nY(){let e=rY(this.opacity);return`${e===1?`rgb(`:`rgba(`}${iY(this.r)}, ${iY(this.g)}, ${iY(this.b)}${e===1?`)`:`, ${e})`}`}function rY(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function iY(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function aY(e){return e=iY(e),(e<16?`0`:``)+e.toString(16)}function oY(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new cY(e,t,n,r)}function sY(e){if(e instanceof cY)return new cY(e.h,e.s,e.l,e.opacity);if(e instanceof BJ||(e=YJ(e)),!e)return new cY;if(e instanceof cY)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new cY(o,s,c,e.opacity)}function YPe(e,t,n,r){return arguments.length===1?sY(e):new cY(e,t,n,r??1)}function cY(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}RJ(cY,YPe,zJ(BJ,{brighter(e){return e=e==null?HJ:HJ**+e,new cY(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?VJ:VJ**+e,new cY(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new eY(dY(e>=240?e-240:e+120,i,r),dY(e,i,r),dY(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new cY(lY(this.h),uY(this.s),uY(this.l),rY(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=rY(this.opacity);return`${e===1?`hsl(`:`hsla(`}${lY(this.h)}, ${uY(this.s)*100}%, ${uY(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function lY(e){return e=(e||0)%360,e<0?e+360:e}function uY(e){return Math.max(0,Math.min(1,e||0))}function dY(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var fY=e=>()=>e;function pY(e,t){return function(n){return e+n*t}}function XPe(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ZPe(e,t){var n=t-e;return n?pY(e,n>180||n<-180?n-360*Math.round(n/360):n):fY(isNaN(e)?t:e)}function QPe(e){return(e=+e)==1?mY:function(t,n){return n-t?XPe(t,n,e):fY(isNaN(t)?n:t)}}function mY(e,t){var n=t-e;return n?pY(e,n):fY(isNaN(e)?t:e)}var hY=(function e(t){var n=QPe(t);function r(e,t){var r=n((e=$J(e)).r,(t=$J(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=mY(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function $Pe(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function eFe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function tFe(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o=0;o<r;++o)i[o]=bY(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function nFe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function gY(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function rFe(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=bY(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var _Y=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vY=new RegExp(_Y.source,`g`);function iFe(e){return function(){return e}}function aFe(e){return function(t){return e(t)+``}}function yY(e,t){var n=_Y.lastIndex=vY.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=_Y.exec(e))&&(i=vY.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:gY(r,i)})),n=vY.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?aFe(c[0].x):iFe(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function bY(e,t){var n=typeof t,r;return t==null||n===`boolean`?fY(t):(n===`number`?gY:n===`string`?(r=YJ(t))?(t=r,hY):yY:t instanceof YJ?hY:t instanceof Date?nFe:eFe(t)?$Pe:Array.isArray(t)?tFe:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?rFe:gY)(e,t)}var xY=180/Math.PI,SY={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function CY(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*xY,skewX:Math.atan(c)*xY,scaleX:o,scaleY:s}}var wY;function oFe(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?SY:CY(t.a,t.b,t.c,t.d,t.e,t.f)}function sFe(e){return e==null||(wY||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),wY.setAttribute(`transform`,e),!(e=wY.transform.baseVal.consolidate()))?SY:(e=e.matrix,CY(e.a,e.b,e.c,e.d,e.e,e.f))}function TY(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:gY(e,i)},{i:c-2,x:gY(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:gY(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:gY(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:gY(e,n)},{i:s-2,x:gY(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var cFe=TY(oFe,`px, `,`px)`,`deg)`),lFe=TY(sFe,`, `,`)`,`)`),uFe=1e-12;function EY(e){return((e=Math.exp(e))+1/e)/2}function dFe(e){return((e=Math.exp(e))-1/e)/2}function fFe(e){return((e=Math.exp(2*e))-1)/(e+1)}var DY=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<uFe)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=EY(y),c=s/(n*g)*(i*fFe(t*r+y)-dFe(y));return[a+c*d,o+c*f,s*i/EY(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),OY=0,kY=0,AY=0,jY=1e3,MY,NY,PY=0,FY=0,IY=0,LY=typeof performance==`object`&&performance.now?performance:Date,RY=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function zY(){return FY||=(RY(pFe),LY.now()+IY)}function pFe(){FY=0}function BY(){this._call=this._time=this._next=null}BY.prototype=VY.prototype={constructor:BY,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?zY():+n)+(t==null?0:+t),!this._next&&NY!==this&&(NY?NY._next=this:MY=this,NY=this),this._call=e,this._time=n,UY()},stop:function(){this._call&&(this._call=null,this._time=1/0,UY())}};function VY(e,t,n){var r=new BY;return r.restart(e,t,n),r}function mFe(){zY(),++OY;for(var e=MY,t;e;)(t=FY-e._time)>=0&&e._call.call(void 0,t),e=e._next;--OY}function HY(){FY=(PY=LY.now())+IY,OY=kY=0;try{mFe()}finally{OY=0,gFe(),FY=0}}function hFe(){var e=LY.now(),t=e-PY;t>jY&&(IY-=t,PY=e)}function gFe(){for(var e,t=MY,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:MY=n);NY=e,UY(r)}function UY(e){OY||(kY&&=clearTimeout(kY),e-FY>24?(e<1/0&&(kY=setTimeout(HY,e-LY.now()-IY)),AY&&=clearInterval(AY)):(AY||=(PY=LY.now(),setInterval(hFe,jY)),OY=1,RY(HY)))}function WY(e,t,n){var r=new BY;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var _Fe=aJ(`start`,`end`,`cancel`,`interrupt`),vFe=[];function GY(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;yFe(e,n,{name:t,index:r,group:i,on:_Fe,tween:vFe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function KY(e,t){var n=JY(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function qY(e,t){var n=JY(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function JY(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function yFe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=VY(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return WY(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(WY(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function YY(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function bFe(e){return this.each(function(){YY(this,e)})}function xFe(e,t){var n,r;return function(){var i=qY(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function SFe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=qY(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function CFe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=JY(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?xFe:SFe)(n,e,t))}function XY(e,t,n){var r=e._id;return e.each(function(){var e=qY(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return JY(e,r).value[t]}}function ZY(e,t){var n;return(typeof t==`number`?gY:t instanceof YJ?hY:(n=YJ(t))?(t=n,hY):yY)(e,t)}function wFe(e){return function(){this.removeAttribute(e)}}function TFe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function EFe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function DFe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function OFe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function kFe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function AFe(e,t){var n=lJ(e),r=n===`transform`?lFe:ZY;return this.attrTween(e,typeof t==`function`?(n.local?kFe:OFe)(n,r,XY(this,`attr.`+e,t)):t==null?(n.local?TFe:wFe)(n):(n.local?DFe:EFe)(n,r,t))}function jFe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function MFe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function NFe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&MFe(e,i)),n}return i._value=t,i}function PFe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&jFe(e,i)),n}return i._value=t,i}function FFe(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=lJ(e);return this.tween(n,(r.local?NFe:PFe)(r,t))}function IFe(e,t){return function(){KY(this,e).delay=+t.apply(this,arguments)}}function LFe(e,t){return t=+t,function(){KY(this,e).delay=t}}function RFe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?IFe:LFe)(t,e)):JY(this.node(),t).delay}function zFe(e,t){return function(){qY(this,e).duration=+t.apply(this,arguments)}}function BFe(e,t){return t=+t,function(){qY(this,e).duration=t}}function VFe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?zFe:BFe)(t,e)):JY(this.node(),t).duration}function HFe(e,t){if(typeof t!=`function`)throw Error();return function(){qY(this,e).ease=t}}function UFe(e){var t=this._id;return arguments.length?this.each(HFe(t,e)):JY(this.node(),t).ease}function WFe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();qY(this,e).ease=n}}function GFe(e){if(typeof e!=`function`)throw Error();return this.each(WFe(this._id,e))}function KFe(e){typeof e!=`function`&&(e=pJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new $Y(r,this._parents,this._name,this._id)}function qFe(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new $Y(o,this._parents,this._name,this._id)}function JFe(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function YFe(e,t,n){var r,i,a=JFe(t)?KY:qY;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function XFe(e,t){var n=this._id;return arguments.length<2?JY(this.node(),n).on.on(e):this.each(YFe(n,e,t))}function ZFe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function QFe(){return this.on(`end.remove`,ZFe(this._id))}function $Fe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=dJ(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,GY(l[f],t,n,f,l,JY(u,n)));return new $Y(a,this._parents,t,n)}function eIe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=fJ(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=JY(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&GY(p,t,n,h,f,m);a.push(f),o.push(u)}return new $Y(a,o,t,n)}var tIe=DJ.prototype.constructor;function nIe(){return new tIe(this._groups,this._parents)}function rIe(e,t){var n,r,i;return function(){var a=vJ(this,e),o=(this.style.removeProperty(e),vJ(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function QY(e){return function(){this.style.removeProperty(e)}}function iIe(e,t,n){var r,i=n+``,a;return function(){var o=vJ(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function aIe(e,t,n){var r,i,a;return function(){var o=vJ(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),vJ(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function oIe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=qY(this,e),l=c.on,u=c.value[a]==null?s||=QY(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function sIe(e,t,n){var r=(e+=``)==`transform`?cFe:ZY;return t==null?this.styleTween(e,rIe(e,r)).on(`end.style.`+e,QY(e)):typeof t==`function`?this.styleTween(e,aIe(e,r,XY(this,`style.`+e,t))).each(oIe(this._id,e)):this.styleTween(e,iIe(e,r,t),n).on(`end.style.`+e,null)}function cIe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function lIe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&cIe(e,a,n)),r}return a._value=t,a}function uIe(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,lIe(e,t,n??``))}function dIe(e){return function(){this.textContent=e}}function fIe(e){return function(){var t=e(this);this.textContent=t??``}}function pIe(e){return this.tween(`text`,typeof e==`function`?fIe(XY(this,`text`,e)):dIe(e==null?``:e+``))}function mIe(e){return function(t){this.textContent=e.call(this,t)}}function hIe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&mIe(r)),t}return r._value=e,r}function gIe(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,hIe(e))}function _Ie(){for(var e=this._name,t=this._id,n=eX(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=JY(c,t);GY(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new $Y(r,this._parents,e,n)}function vIe(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=qY(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var yIe=0;function $Y(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function eX(){return++yIe}var tX=DJ.prototype;$Y.prototype={constructor:$Y,select:$Fe,selectAll:eIe,selectChild:tX.selectChild,selectChildren:tX.selectChildren,filter:KFe,merge:qFe,selection:nIe,transition:_Ie,call:tX.call,nodes:tX.nodes,node:tX.node,size:tX.size,empty:tX.empty,each:tX.each,on:XFe,attr:AFe,attrTween:FFe,style:sIe,styleTween:uIe,text:pIe,textTween:gIe,remove:QFe,tween:CFe,delay:RFe,duration:VFe,ease:UFe,easeVarying:GFe,end:vIe,[Symbol.iterator]:tX[Symbol.iterator]};function bIe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var xIe={time:null,delay:0,duration:250,ease:bIe};function SIe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function CIe(e){var t,n;e instanceof $Y?(t=e._id,e=e._name):(t=eX(),(n=xIe).time=zY(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&GY(c,e,t,l,o,n||SIe(c,t));return new $Y(r,this._parents,e,t)}DJ.prototype.interrupt=bFe,DJ.prototype.transition=CIe;var nX=e=>()=>e;function wIe(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function rX(e,t,n){this.k=e,this.x=t,this.y=n}rX.prototype={constructor:rX,scale:function(e){return e===1?this:new rX(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new rX(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var iX=new rX(1,0,0);aX.prototype=rX.prototype;function aX(e){for(;!e.__zoom;)if(!(e=e.parentNode))return iX;return e.__zoom}function oX(e){e.stopImmediatePropagation()}function sX(e){e.preventDefault(),e.stopImmediatePropagation()}function TIe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function EIe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function cX(){return this.__zoom||iX}function DIe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function OIe(){return navigator.maxTouchPoints||`ontouchstart`in this}function kIe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function lX(){var e=TIe,t=EIe,n=kIe,r=DIe,i=OIe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=DY,l=aJ(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,cX).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,cX),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(iX.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new rX(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new rX(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new rX(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=OJ(this.that).datum();l.call(e,this.that,new wIe(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=kJ(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],YY(this),s.start();sX(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=OJ(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=kJ(t,i),l=t.clientX,u=t.clientY;NJ(t.view),oX(t),a.mouse=[c,this.__zoom.invert(c)],YY(this),a.start();function d(e){if(sX(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=kJ(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),PJ(e.view,a.moved),sX(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=kJ(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);sX(r),s>0?OJ(this).transition().duration(s).call(x,d,c,r):OJ(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(oX(t),s=0;s<i;++s)c=r[s],l=kJ(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),YY(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(sX(e),s=0;s<a;++s)c=i[s],l=kJ(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(oX(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=kJ(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=OJ(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:nX(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:nX(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:nX(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:nX([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var uX={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},dX=[[-1/0,-1/0],[1/0,1/0]],fX=[`Enter`,` `,`Escape`],pX={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},mX;(function(e){e.Strict=`strict`,e.Loose=`loose`})(mX||={});var hX;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(hX||={});var gX;(function(e){e.Partial=`partial`,e.Full=`full`})(gX||={});var _X={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},vX;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(vX||={});var yX;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(yX||={});var bX;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(bX||={});var xX={[bX.Left]:bX.Right,[bX.Right]:bX.Left,[bX.Top]:bX.Bottom,[bX.Bottom]:bX.Top},SX=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,AIe=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),CX=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),wX=(e,t=[0,0])=>{let{width:n,height:r}=ZX(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},jIe=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):CX(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,NX(e,LX(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?FX(r):{x:0,y:0,width:0,height:0}},TX=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=NX(n,LX(e)),r=!0)}),r?FX(n):{x:0,y:0,width:0,height:0}},EX=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=zX(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},MIe=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function NIe(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=ZX(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function PIe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=JX(TX(NIe(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function DX({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,uX.error005());else{let{width:e,height:t}=ZX(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&XX(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=XX(d)?kX(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,uX.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function FIe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=MIe(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var OX=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),kX=(e={x:0,y:0},t,n)=>({x:OX(e.x,t[0][0],t[1][0]-(n?.width??0)),y:OX(e.y,t[0][1],t[1][1]-(n?.height??0))});function AX(e,t,n){let{width:r,height:i}=ZX(n),{x:a,y:o}=n.internals.positionAbsolute;return kX(e,[[a,o],[a+r,o+i]],t)}var jX=(e,t,n)=>e<t?OX(Math.abs(e-t),1,t)/t:e>n?-OX(Math.abs(e-n),1,t)/t:0,MX=(e,t,n=15,r=40)=>[jX(e.x,r,t.width-r)*n,jX(e.y,r,t.height-r)*n],NX=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),PX=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),FX=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),IX=(e,t=[0,0])=>{let{x:n,y:r}=CX(e)?e.internals.positionAbsolute:wX(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},LX=(e,t=[0,0])=>{let{x:n,y:r}=CX(e)?e.internals.positionAbsolute:wX(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},RX=(e,t)=>FX(NX(PX(e),PX(t))),zX=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},BX=(e,t)=>zX(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),VX=e=>HX(e.width)&&HX(e.height)&&HX(e.x)&&HX(e.y),HX=e=>!isNaN(e)&&isFinite(e),UX=(e,t)=>(e,t)=>{},WX=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),GX=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?WX(s,o):s},KX=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function qX(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function IIe(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=qX(e,n),i=qX(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=qX(e.top??e.y??0,n),i=qX(e.bottom??e.y??0,n),a=qX(e.left??e.x??0,t),o=qX(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function LIe(e,t,n,r,i,a){let{x:o,y:s}=KX(e,[t,n,r]),{x:c,y:l}=KX({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var JX=(e,t,n,r,i,a)=>{let o=IIe(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=OX(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=LIe(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},YX=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function XX(e){return e!=null&&e!==`parent`}function ZX(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function QX(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function $X(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function eZ(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function RIe(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function zIe(e){return{...pX,...e||{}}}function tZ(e){return e===null?null:e?`valid`:`invalid`}function nZ(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=sZ(e),s=GX({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?WX(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var rZ=e=>({width:e.offsetWidth,height:e.offsetHeight}),iZ=e=>e?.getRootNode?.()||window?.document,BIe=[`INPUT`,`SELECT`,`TEXTAREA`];function aZ(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?BIe.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var oZ=e=>`clientX`in e,sZ=(e,t)=>{let n=oZ(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},cZ=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...rZ(t)}})};function lZ({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function uZ(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function dZ({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case bX.Left:return[t-uZ(t-r,a),n];case bX.Right:return[t+uZ(r-t,a),n];case bX.Top:return[t,n-uZ(n-i,a)];case bX.Bottom:return[t,n+uZ(i-n,a)]}}function fZ({sourceX:e,sourceY:t,sourcePosition:n=bX.Bottom,targetX:r,targetY:i,targetPosition:a=bX.Top,curvature:o=.25}){let[s,c]=dZ({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=dZ({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=lZ({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function pZ({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function VIe({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function HIe({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=NX(LX(e),LX(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),BX({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},FX(a))>0}var UIe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,WIe=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),GIe=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,uX.error006()),t;let r=n.getEdgeId||UIe,i;return i=SX(e)?{...e}:{...e,id:r(e)},WIe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function mZ({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=pZ({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var hZ={[bX.Left]:{x:-1,y:0},[bX.Right]:{x:1,y:0},[bX.Top]:{x:0,y:-1},[bX.Bottom]:{x:0,y:1}},KIe=({source:e,sourcePosition:t=bX.Bottom,target:n})=>t===bX.Left||t===bX.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},gZ=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function qIe({source:e,sourcePosition:t=bX.Bottom,target:n,targetPosition:r=bX.Top,center:i,offset:a,stepPosition:o}){let s=hZ[t],c=hZ[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=KIe({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=pZ({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function JIe(e,t,n,r){let i=Math.min(gZ(e,t)/2,gZ(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function _Z({sourceX:e,sourceY:t,sourcePosition:n=bX.Bottom,targetX:r,targetY:i,targetPosition:a=bX.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=qIe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=JIe(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function vZ(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function YIe(e){let{sourceNode:t,targetNode:n}=e;if(!vZ(t)||!vZ(n))return null;let r=t.internals.handleBounds||yZ(t.handles),i=n.internals.handleBounds||yZ(n.handles),a=xZ(r?.source??[],e.sourceHandle),o=xZ(e.connectionMode===mX.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,uX.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||bX.Bottom,c=o?.position||bX.Top,l=bZ(t,a,s),u=bZ(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function yZ(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function bZ(e,t,n=bX.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??ZX(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case bX.Top:return{x:i+o/2,y:a};case bX.Right:return{x:i+o,y:a+s/2};case bX.Bottom:return{x:i+o/2,y:a+s};case bX.Left:return{x:i,y:a+s/2}}}function xZ(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function SZ(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function XIe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=SZ(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var CZ=1e3,ZIe=10,wZ={nodeOrigin:[0,0],nodeExtent:dX,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},QIe={...wZ,checkEquality:!0};function TZ(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function $Ie(e,t,n){let r=TZ(wZ,n);for(let n of e.values())if(n.parentId)OZ(n,e,t,r);else{let e=kX(wX(n,r.nodeOrigin),XX(n.extent)?n.extent:r.nodeExtent,ZX(n));n.internals.positionAbsolute=e}}function eLe(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function EZ(e){return e===`manual`}function DZ(e,t,n,r={}){let i=TZ(QIe,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!EZ(i.zIndexMode)?CZ:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=kX(wX(u,i.nodeOrigin),XX(u.extent)?u.extent:i.nodeExtent,ZX(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:eLe(u,e),z:kZ(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&OZ(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function tLe(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function OZ(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=TZ(wZ,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}tLe(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*ZIe),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=nLe(e,u,o,s,a&&!EZ(c)?CZ:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function kZ(e,t,n){let r=HX(e.zIndex)?e.zIndex:0;return EZ(n)?r:r+(e.selected?t:0)}function nLe(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=ZX(e),l=wX(e,n),u=XX(e.extent)?kX(l,e.extent,c):l,d=kX({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=AX(d,c,t));let f=kZ(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function AZ(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=RX(a.get(n.parentId)?.expandedRect??IX(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=ZX(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function rLe(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=rZ(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=XX(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=AX(h,s,n))}else m&&(h=kX(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:cZ(`source`,r.nodeElement,p,d,e.id),target:cZ(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&OZ(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:IX(g,i)}))}}if(f.length>0){let e=AZ(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function iLe({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function jZ(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function MZ(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;jZ(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),jZ(`target`,s,c,e,i,o),t.set(r.id,r)}}function NZ(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:NZ(n,t):!1}function PZ(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function aLe(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!NZ(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function FZ({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function oLe({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=WX(a,t);return{x:o.x-a.x,y:o.y-a.y}}function sLe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=OJ(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?PX(TX(s)):null,x=v&&l?oLe({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:WX(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=DX({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=FZ({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=MX(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=nZ(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=aLe(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=FZ({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=LJ().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=nZ(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=sZ(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=nZ(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=sZ(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=sZ(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p)p&&s.size>0&&t().updateNodePositions(s,!1);else if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=FZ({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!PZ(t,`.${g}`,v))&&(!_||PZ(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function cLe(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())BX(i,IX(e))>0&&r.push(e);return r}var lLe=250;function uLe(e,t,n,r){let i=[],a=1/0,o=cLe(e,n,t+lLe);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=bZ(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function IZ(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...bZ(o,c,c.position,!0)}:c}function LZ(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function dLe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var RZ=()=>!0;function fLe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=RZ,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=iZ(e.target),E=0,D,{x:O,y:k}=sZ(e),A=LZ(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=IZ(i,A,r,c,t);if(!N)return;let P=sZ(e,j),ee=!1,F=null,te=!1,ne=null;function re(){if(!u||!j)return;let[e,t]=MX(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(re)}let ie={...N,nodeId:i,type:A,position:N.position},ae=c.get(i),oe={inProgress:!0,isValid:null,from:bZ(ae,ie,bX.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:ae,to:P,toHandle:null,toPosition:xX[ie.position],toNode:null,pointer:P};function se(){M=!0,y(oe),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&se();function ce(e){if(!M){let{x:t,y:n}=sZ(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;se()}if(!x()||!ie){le(e);return}let a=b();P=sZ(e,j),D=uLe(GX(P,a,!1,[1,1]),n,c,ie),ee||=(re(),!0);let s=zZ(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});ne=s.handleDomNode,F=s.connection,te=dLe(!!D,s.isValid);let u=c.get(i),f=u?bZ(u,ie,bX.Left,!0):oe.from,p={...oe,from:f,isValid:te,to:s.toHandle&&te?KX({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:te&&s.toHandle?s.toHandle.position:xX[ie.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),oe=p}function le(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||ne)&&F&&te&&h?.(F);let{inProgress:t,...n}=oe,r={...n,toPosition:oe.toHandle?oe.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),ee=!1,te=!1,F=null,ne=null,T.removeEventListener(`mousemove`,ce),T.removeEventListener(`mouseup`,le),T.removeEventListener(`touchmove`,ce),T.removeEventListener(`touchend`,le)}}T.addEventListener(`mousemove`,ce),T.addEventListener(`mouseup`,le),T.addEventListener(`touchmove`,ce),T.addEventListener(`touchend`,le)}function zZ(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=RZ,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=sZ(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=LZ(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===mX.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=IZ(t,e,a,u,n,!0)}return _}var BZ={onPointerDown:fLe,isValid:zZ};function pLe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=OJ(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&YX()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=lX().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:kJ}}var VZ=e=>({x:e.x,y:e.y,zoom:e.k}),HZ=({x:e,y:t,zoom:n})=>iX.translate(e,t).scale(n),UZ=(e,t)=>e.target.closest(`.${t}`),WZ=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),mLe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,GZ=(e,t=0,n=mLe,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},KZ=e=>{let t=e.ctrlKey&&YX()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function hLe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(UZ(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=kJ(u),t=d*2**KZ(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===hX.Vertical?0:u.deltaX*f,m=i===hX.Horizontal?0:u.deltaY*f;!YX()&&u.shiftKey&&i!==hX.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=VZ(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function gLe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=UZ(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function _Le({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=VZ(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function vLe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&WZ(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,VZ(a.transform))}}function yLe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&WZ(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=VZ(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function bLe({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(UZ(f,`${u}-flow__node`)||UZ(f,`${u}-flow__edge`)||UZ(f,`${u}-flow__selection`)||UZ(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||UZ(f,c)&&h||UZ(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function xLe({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=lX().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=OJ(e).call(f);y({x:i.x,y:i.y,zoom:OX(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(KZ);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bY:DY).transform(GZ(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,panActivationKeyPressed:S=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:T,connectionInProgress:E,paneClickDistance:D,selectionOnDrag:O}){r&&!l.isZoomingOrPanning&&v();let k=i&&!C&&!r;f.clickDistance(O?1/0:!HX(D)||D<0?0:D);let A=k?hLe({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):gLe({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=_Le({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=vLe({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=yLe({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=bLe({panActivationKeyPressed:S,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:E});f.filter(P),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=HZ(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=HZ(e);return await g(n,t),n}function x(e){if(p){let t=HZ(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?aX(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bY:DY).scaleTo(GZ(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bY:DY).scaleBy(GZ(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!HX(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var qZ;(function(e){e.Line=`line`,e.Handle=`handle`})(qZ||={});function SLe({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function JZ(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function YZ(e,t){return Math.max(0,t-e)}function XZ(e,t){return Math.max(0,e-t)}function ZZ(e,t,n){return Math.max(0,t-e,e-n)}function QZ(e,t){return e?!t:t}function CLe(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=ZZ(E,h,g),j=ZZ(D,_,v);if(o){let e=0,t=0;c&&w<0?e=YZ(y+w+O,o[0][0]):!c&&w>0&&(e=XZ(y+E+O,o[1][0])),l&&T<0?t=YZ(b+T+k,o[0][1]):!l&&T>0&&(t=XZ(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=XZ(y+w,s[0][0]):!c&&w<0&&(e=YZ(y+E,s[1][0])),l&&T>0?t=XZ(b+T,s[0][1]):!l&&T<0&&(t=YZ(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=ZZ(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?XZ(b+k+E/C,o[1][1])*C:YZ(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?YZ(b+E/C,s[1][1])*C:XZ(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=ZZ(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?XZ(y+D*C+O,o[1][0])/C:YZ(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?YZ(y+D*C,s[1][0])/C:XZ(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(QZ(c,l)?-w:w)/C:w=(QZ(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var $Z={width:0,height:0,x:0,y:0},wLe={...$Z,pointerX:0,pointerY:0,aspectRatio:1};function TLe(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function ELe({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=OJ(e),o={controlDirection:JZ(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...$Z},h={...wLe};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:JZ(e)};let g,_=null,v=[],y,b,x,S=LJ().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=nZ(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=XX(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=TLe(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=nZ(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:S,height:C}=m,w={},T=g.origin??s,{width:E,height:D,x:O,y:k}=CLe(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,T,b,x),A=E!==S,j=D!==C,M=O!==u&&A,N=k!==f&&j;if(!M&&!N&&!A&&!j)return;let P={prevValues:{...m},startX:h.x,startY:h.y,childNodes:v.map(e=>({...e,position:{...e.position}}))};if((M||N||T[0]===1||T[1]===1)&&(w.x=M?O:m.x,w.y=N?k:m.y,m.x=w.x,m.y=w.y,v.length>0)){let e=O-u,t=k-f;for(let n of v)n.position={x:n.position.x-e+T[0]*(E-S),y:n.position.y-t+T[1]*(D-C)},l.push(n)}if((A||j)&&(w.width=A&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?E:m.width,w.height=j&&(!o.resizeDirection||o.resizeDirection===`vertical`)?D:m.height,m.width=w.width,m.height=w.height),y&&g.expandParent){let e=T[0]*(w.width??0);w.x&&w.x<e&&(m.x=e,h.x-=w.x-e);let t=T[1]*(w.height??0);w.y&&w.y<t&&(m.y=t,h.y-=w.y-t)}let ee=SLe({width:m.width,prevWidth:S,height:m.height,prevHeight:C,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),F={...m,direction:ee};p?.(e,F)===!1?(m=P.prevValues,h.x=P.startX,h.y=P.startY,v.forEach((e,t)=>{e.position=P.childNodes[t].position})):(d?.(e,F),r(w,l))}).on(`end`,e=>{f?.(e,{...m}),i?.({...m})});a.call(S)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var eQ=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},DLe=e=>e?eQ(e):eQ,{useDebugValue:OLe}=V.default,{useSyncExternalStoreWithSelector:kLe}=gx.default,ALe=e=>e;function tQ(e,t=ALe,n){let r=kLe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return OLe(r),r}var nQ=(e,t)=>{let n=DLe(e),r=(e,r=t)=>tQ(n,e,r);return Object.assign(r,n),r},jLe=(e,t)=>e?nQ(e,t):nQ;function rQ(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var iQ=(0,V.createContext)(null),MLe=iQ.Provider,aQ=uX.error001(`react`);function oQ(e,t){let n=(0,V.useContext)(iQ);if(n===null)throw Error(aQ);return tQ(n,e,t)}function sQ(){let e=(0,V.useContext)(iQ);if(e===null)throw Error(aQ);return(0,V.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var cQ={display:`none`},NLe={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},lQ=`react-flow__node-desc`,uQ=`react-flow__edge-desc`,PLe=`react-flow__aria-live`,FLe=e=>e.ariaLiveMessage,ILe=e=>e.ariaLabelConfig;function LLe({rfId:e}){let t=oQ(FLe);return(0,H.jsx)(`div`,{id:`${PLe}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:NLe,children:t})}function RLe({rfId:e,disableKeyboardA11y:t}){let n=oQ(ILe);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{id:`${lQ}-${e}`,style:cQ,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,H.jsx)(`div`,{id:`${uQ}-${e}`,style:cQ,children:n[`edge.a11yDescription.default`]}),!t&&(0,H.jsx)(LLe,{rfId:e})]})}var dQ=(0,V.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,H.jsx)(`div`,{className:iJ([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});dQ.displayName=`Panel`;var fQ=`https://reactflow.dev?utm_source=attribution`;function zLe({proOptions:e,position:t=`bottom-right`}){return(0,V.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,H.jsx)(dQ,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${fQ}`,children:(0,H.jsx)(`a`,{href:fQ,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var BLe=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},pQ=e=>e.id;function VLe(e,t){return rQ(e.selectedNodes.map(pQ),t.selectedNodes.map(pQ))&&rQ(e.selectedEdges.map(pQ),t.selectedEdges.map(pQ))}function HLe({onSelectionChange:e}){let t=sQ(),{selectedNodes:n,selectedEdges:r}=oQ(BLe,VLe);return(0,V.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var ULe=e=>!!e.onSelectionChangeHandlers;function WLe({onSelectionChange:e}){let t=oQ(ULe);return e||t?(0,H.jsx)(HLe,{onSelectionChange:e}):null}var mQ=[0,0],GLe={x:0,y:0,zoom:1},hQ=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],KLe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),gQ={translateExtent:dX,nodeOrigin:mQ,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function qLe(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=oQ(KLe,rQ),l=sQ();(0,V.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=gQ,s()}),[]);let u=(0,V.useRef)(gQ);return(0,V.useEffect)(()=>{for(let s of hQ){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:zIe(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},hQ.map(t=>e[t])),null}function _Q(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function JLe(e){let[t,n]=(0,V.useState)(e===`system`?null:e);return(0,V.useEffect)(()=>{if(e!==`system`){n(e);return}let t=_Q(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?_Q()?.matches?`dark`:`light`:t}var vQ=typeof document<`u`?document:null;function yQ(e=null,t={target:vQ,actInsideInputWithModifier:!0}){let[n,r]=(0,V.useState)(!1),i=(0,V.useRef)(!1),a=(0,V.useRef)(new Set([])),[o,s]=(0,V.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
|
|
100
|
+
`:null,(0,H.jsx)(Nq,{spans:typeof e==`string`?void 0:e,text:typeof e==`string`?e:``})]},t))})}var LMe={javascript:`javascript`,typescript:`typescript`,python:`python`,shell:`shell`,console:`shell`,docker:`dockerfile`};function RMe(e){return/(?:^|\s)language-(\S+)/.exec(e??``)?.[1]?.toLowerCase()}function zMe(e){if(e===void 0||e.length===0)return;let t=LMe[e];return t===void 0?mO(e)??mO(`fence.${e}`):t}var BMe={idle:`copy`,copied:`copied`,failed:`copying was blocked by the browser`};function VMe({text:e,className:t}){let[n,r]=(0,V.useState)(`idle`);(0,V.useEffect)(()=>{if(n===`idle`)return;let e=setTimeout(()=>r(`idle`),1500);return()=>clearTimeout(e)},[n]);let i=(0,V.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>r(`copied`),()=>r(`failed`))},[e]),a=BMe[n];return(0,H.jsx)(Z,{type:`button`,variant:`ghost`,size:`icon`,"data-testid":`copy-button`,"data-state":n,title:a,"aria-label":a,onClick:i,className:J(`opacity-60 hover:opacity-100`,t),children:n===`copied`?(0,H.jsx)(LL,{className:`size-3 text-po-green`}):(0,H.jsx)(YL,{className:`size-3`})})}var Fq;async function HMe(){return Fq??=pO(async()=>{let{default:e}=await import(`./mermaid.core-DNUNsYna.js`);return{default:e}},__vite__mapDeps([12,13,14,2,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30])).then(({default:e})=>(e.initialize({startOnLoad:!1,fontFamily:`inherit`,theme:`dark`,securityLevel:`strict`,suppressErrorRendering:!0}),e)),Fq}async function UMe(e,t){let{svg:n}=await(await HMe()).render(e,t);return n}function WMe({code:e}){let t=`mermaid-${(0,V.useId)().replaceAll(/[^a-zA-Z0-9]/g,``)}`,[n,r]=(0,V.useState)(void 0),i=(0,V.useContext)(Oq);if((0,V.useEffect)(()=>{let n=!0;return UMe(t,e).then(t=>{n&&r({source:e,svg:t})},()=>void 0),()=>{n=!1}},[e,t]),n?.source!==e)return(0,H.jsx)(Pq,{text:e,className:`text-po-text`});let a=(0,H.jsx)(`div`,{"data-testid":`mermaid-diagram`,dangerouslySetInnerHTML:{__html:n.svg},className:`flex justify-center overflow-x-auto [&_svg]:h-auto [&_svg]:max-w-full`});return i===void 0?a:(0,H.jsx)(`button`,{type:`button`,"data-testid":`markdown-media-open`,"aria-label":`Open diagram full screen`,onClick:()=>i.open({kind:`mermaid`,title:`Diagram`,url:jq(n.svg.replaceAll(`font-family:inherit`,`font-family:"IBM Plex Sans",ui-sans-serif,system-ui,sans-serif`)),mermaidSource:e}),className:`block w-full cursor-zoom-in rounded focus-visible:ring-2 focus-visible:ring-po-blue focus-visible:outline-none`,children:a})}function Iq({text:e,className:t}){let n=RMe(t),r=n===`mermaid`?(0,H.jsx)(WMe,{code:e}):(0,H.jsx)(Pq,{text:e,grammar:zMe(n),className:`overflow-x-auto text-sm leading-relaxed text-po-text`});return(0,H.jsxs)(`div`,{"data-slot":`code-block`,"data-language":n??``,className:`relative rounded border border-po-border bg-po-deep p-2.5`,children:[r,(0,H.jsx)(VMe,{text:e,className:`absolute top-1.5 right-1.5`})]})}function Lq({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`skeleton`,"aria-hidden":!0,className:J(`animate-pulse rounded bg-po-border-soft`,e),...t})}var GMe=(0,V.lazy)(async()=>({default:(await pO(async()=>{let{CodeEditorView:e}=await import(`./CodeEditorView-CwbnhMdA.js`);return{CodeEditorView:e}},__vite__mapDeps([31,2,1,0]))).CodeEditorView}));function KMe({className:e,...t}){return(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Lq,{className:J(`min-h-0`,e)}),children:(0,H.jsx)(GMe,{className:e,...t})})}function qMe(e){return(0,H.jsx)(wwe,{"data-slot":`collapsible`,...e})}function JMe(e){return(0,H.jsx)(Ewe,{"data-slot":`collapsible-trigger`,...e})}function YMe({className:e,...t}){return(0,H.jsx)(Owe,{"data-slot":`collapsible-content`,className:J(`overflow-hidden`,e),...t})}var Rq=UK(`min-w-0 pointer-coarse:text-xl text-po-hi outline-none placeholder:text-po-faint disabled:opacity-50 aria-invalid:border-po-edge-red aria-invalid:text-po-red`,{variants:{variant:{default:`rounded border border-po-border bg-po-deep transition-colors focus:border-po-green/60`,bare:`border-0 bg-transparent`},size:{xs:`min-h-6 px-1.5 py-0.5 text-sm`,sm:`min-h-7 px-2 py-1 text-sm`,md:`min-h-8 px-2.5 py-1.5 text-base`,lg:`min-h-9 px-3 py-1.5 text-base`}},compoundVariants:[{variant:`bare`,class:`min-h-0 p-0`}],defaultVariants:{variant:`default`,size:`md`}});function zq({className:e,type:t,variant:n,size:r,...i}){return(0,H.jsx)(`input`,{type:t??`text`,"data-slot":`input`,spellCheck:!1,className:J(Rq({variant:n,size:r}),e),...i})}function Bq(e,t){let{options:n,cursor:r,onCursorChange:i,onSelect:a}=t,o=n.length;if(o===0)return;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),i((r+(e.key===`ArrowDown`?1:-1)+o)%o);return}if(e.key===`Enter`){let t=n[r];if(t===void 0)return;e.preventDefault(),e.stopPropagation(),a(t);return}let s=Number.parseInt(e.key,10)-1,c=Number.isInteger(s)&&s<9?n[s]:void 0;c!==void 0&&(e.preventDefault(),e.stopPropagation(),a(c))}function Vq(e){return e>9?`up/down move · enter select · 1-9 jump`:`1-9 select · enter confirm`}function Hq(e){return e<9?String(e+1):`·`}var Uq=UK(`flex min-h-0 flex-1 flex-col overflow-y-auto`,{variants:{density:{compact:`gap-0.5 p-1.5`,comfortable:`gap-1.5`}},defaultVariants:{density:`comfortable`}}),Wq=UK(`flex shrink-0 cursor-pointer items-center text-left outline-none`,{variants:{density:{compact:`gap-2.5 rounded-md px-2 py-[7px]`,comfortable:`min-h-[42px] gap-3 rounded-md border px-[11px] py-2 text-sm text-po-text transition-colors`},active:{true:``,false:``}},compoundVariants:[{density:`compact`,active:!0,class:`bg-po-tint-green`},{density:`comfortable`,active:!0,class:`border-po-edge-green bg-po-tint-green`},{density:`comfortable`,active:!1,class:`border-po-border-soft`}],defaultVariants:{density:`comfortable`,active:!1}}),Gq=UK(`flex shrink-0 items-center justify-center rounded-full font-semibold`,{variants:{density:{compact:`h-[15px] w-[15px] border border-po-border text-2xs text-po-faint`,comfortable:`h-[18px] w-[18px] bg-po-deep text-xs text-po-dim`}},defaultVariants:{density:`comfortable`}});function Kq({className:e,density:t,active:n,marker:r,children:i,...a}){return(0,H.jsxs)(`button`,{type:`button`,role:`option`,"data-slot":`option-row`,"aria-selected":n??!1,"data-cursor":n??!1,className:J(Wq({density:t,active:n}),e),...a,children:[r===void 0?null:(0,H.jsx)(`span`,{className:Gq({density:t}),children:r}),i]})}function qq({className:e,density:t,...n}){return(0,H.jsx)(`span`,{"data-slot":`option-label`,className:J(`min-w-0 flex-1`,t===`compact`?`truncate text-sm text-po-text`:`break-words`,e),...n})}function Jq({className:e,options:t,cursor:n,onCursorChange:r,onSelect:i,testIdPrefix:a,density:o=`comfortable`,...s}){let c=(0,V.useRef)(null);return(0,V.useEffect)(()=>{c.current?.children[n]?.scrollIntoView({block:`nearest`})},[n]),(0,H.jsx)(`div`,{ref:c,role:`listbox`,"aria-label":`options`,"data-slot":`option-list`,"data-testid":`${a}s`,className:J(Uq({density:o}),e),...s,children:t.map((e,t)=>(0,H.jsx)(Kq,{density:o,active:t===n,marker:Hq(t),"data-testid":`${a}-${String(t)}`,title:e,onMouseEnter:()=>r(t),onClick:()=>i(e),children:(0,H.jsx)(qq,{density:o,children:e})},e))})}function XMe({open:e,onOpenChange:t,title:n,titleVisible:r=!1,className:i,children:a,width:o=`lg`,...s}){return(0,H.jsx)(aq,{open:e,onOpenChange:t,children:(0,H.jsxs)(cq,{"data-slot":`command-dialog`,width:o,className:J(`max-h-[70vh]`,i),...s,children:[(0,H.jsx)(uq,{className:r?void 0:`sr-only`,children:n}),a]})})}function Yq({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-header`,className:J(`flex shrink-0 items-center gap-2 border-b border-po-border px-3 py-2.5`,e),...t})}function Xq({className:e,...t}){return(0,H.jsx)(zq,{"data-slot":`command-input`,variant:`bare`,autoFocus:!0,autoComplete:`off`,className:J(`flex-1`,e),...t})}function Zq({className:e,...t}){return(0,H.jsx)(`div`,{role:`listbox`,"data-slot":`command-list`,className:J(`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5`,e),...t})}function ZMe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-group`,className:J(`flex flex-col gap-0.5`,e),...t})}function Qq({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-group-label`,className:J(`px-2 pt-2 pb-1 text-sm font-semibold text-po-dim first-letter:uppercase`,e),...t})}function $q({density:e=`compact`,...t}){return(0,H.jsx)(Kq,{"data-slot":`command-item`,density:e,...t})}function eJ(e){return(0,H.jsx)(qq,{"data-slot":`command-item-label`,density:`compact`,...e})}function tJ({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-empty`,className:J(`px-2 py-6 text-center text-base text-po-dim`,e),...t})}function nJ({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-footer`,className:J(`flex min-h-[30px] shrink-0 items-center justify-between gap-3 border-t border-po-border-soft bg-po-deep px-3 text-sm text-po-dim`,e),...t})}function rJ({title:e,description:t,children:n,className:r,asChild:i=!1,...a}){let o=i?tz:`div`;return(0,H.jsx)(o,{"data-slot":`empty-state`,className:J(`flex min-w-0 flex-1 items-center justify-center px-3 py-4 sm:px-4`,r),...a,children:(0,H.jsxs)(`div`,{className:`flex min-w-0 w-full max-w-[520px] flex-col items-center gap-3 text-center`,children:[(0,H.jsx)(`span`,{className:`text-lg font-semibold text-po-hi`,children:e}),t?(0,H.jsx)(`span`,{className:`text-base leading-relaxed text-po-dim`,children:t}):null,n]})})}function iJ(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=iJ(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var QMe={value:()=>{}};function aJ(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new oJ(n)}function oJ(e){this._=e}function $Me(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}oJ.prototype=aJ.prototype={constructor:oJ,on:function(e,t){var n=this._,r=$Me(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=eNe(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=sJ(n[i],e.name,t);else if(t==null)for(i in n)n[i]=sJ(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new oJ(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function eNe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function sJ(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=QMe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var cJ={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function lJ(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),cJ.hasOwnProperty(t)?{space:cJ[t],local:e}:e}function tNe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function nNe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function uJ(e){var t=lJ(e);return(t.local?nNe:tNe)(t)}function rNe(){}function dJ(e){return e==null?rNe:function(){return this.querySelector(e)}}function iNe(e){typeof e!=`function`&&(e=dJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new EJ(r,this._parents)}function aNe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function oNe(){return[]}function fJ(e){return e==null?oNe:function(){return this.querySelectorAll(e)}}function sNe(e){return function(){return aNe(e.apply(this,arguments))}}function cNe(e){e=typeof e==`function`?sNe(e):fJ(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new EJ(r,i)}function pJ(e){return function(){return this.matches(e)}}function mJ(e){return function(t){return t.matches(e)}}var lNe=Array.prototype.find;function uNe(e){return function(){return lNe.call(this.children,e)}}function dNe(){return this.firstElementChild}function fNe(e){return this.select(e==null?dNe:uNe(typeof e==`function`?e:mJ(e)))}var pNe=Array.prototype.filter;function mNe(){return Array.from(this.children)}function hNe(e){return function(){return pNe.call(this.children,e)}}function gNe(e){return this.selectAll(e==null?mNe:hNe(typeof e==`function`?e:mJ(e)))}function _Ne(e){typeof e!=`function`&&(e=pJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new EJ(r,this._parents)}function hJ(e){return Array(e.length)}function vNe(){return new EJ(this._enter||this._groups.map(hJ),this._parents)}function gJ(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}gJ.prototype={constructor:gJ,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function yNe(e){return function(){return e}}function bNe(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new gJ(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function xNe(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new gJ(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function SNe(e){return e.__data__}function CNe(e,t){if(!arguments.length)return Array.from(this,SNe);var n=t?xNe:bNe,r=this._parents,i=this._groups;typeof e!=`function`&&(e=yNe(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=wNe(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new EJ(o,r),o._enter=s,o._exit=c,o}function wNe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function TNe(){return new EJ(this._exit||this._groups.map(hJ),this._parents)}function ENe(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function DNe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new EJ(s,this._parents)}function ONe(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function kNe(e){e||=ANe;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new EJ(i,this._parents).order()}function ANe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function jNe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function MNe(){return Array.from(this)}function NNe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function PNe(){let e=0;for(let t of this)++e;return e}function FNe(){return!this.node()}function INe(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function LNe(e){return function(){this.removeAttribute(e)}}function RNe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zNe(e,t){return function(){this.setAttribute(e,t)}}function BNe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function VNe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function HNe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function UNe(e,t){var n=lJ(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?RNe:LNe:typeof t==`function`?n.local?HNe:VNe:n.local?BNe:zNe)(n,t))}function _J(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function WNe(e){return function(){this.style.removeProperty(e)}}function GNe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function KNe(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function qNe(e,t,n){return arguments.length>1?this.each((t==null?WNe:typeof t==`function`?KNe:GNe)(e,t,n??``)):vJ(this.node(),e)}function vJ(e,t){return e.style.getPropertyValue(t)||_J(e).getComputedStyle(e,null).getPropertyValue(t)}function JNe(e){return function(){delete this[e]}}function YNe(e,t){return function(){this[e]=t}}function XNe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ZNe(e,t){return arguments.length>1?this.each((t==null?JNe:typeof t==`function`?XNe:YNe)(e,t)):this.node()[e]}function yJ(e){return e.trim().split(/^|\s+/)}function bJ(e){return e.classList||new xJ(e)}function xJ(e){this._node=e,this._names=yJ(e.getAttribute(`class`)||``)}xJ.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function SJ(e,t){for(var n=bJ(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function CJ(e,t){for(var n=bJ(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function QNe(e){return function(){SJ(this,e)}}function $Ne(e){return function(){CJ(this,e)}}function ePe(e,t){return function(){(t.apply(this,arguments)?SJ:CJ)(this,e)}}function tPe(e,t){var n=yJ(e+``);if(arguments.length<2){for(var r=bJ(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?ePe:t?QNe:$Ne)(n,t))}function nPe(){this.textContent=``}function rPe(e){return function(){this.textContent=e}}function iPe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function aPe(e){return arguments.length?this.each(e==null?nPe:(typeof e==`function`?iPe:rPe)(e)):this.node().textContent}function oPe(){this.innerHTML=``}function sPe(e){return function(){this.innerHTML=e}}function cPe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function lPe(e){return arguments.length?this.each(e==null?oPe:(typeof e==`function`?cPe:sPe)(e)):this.node().innerHTML}function uPe(){this.nextSibling&&this.parentNode.appendChild(this)}function dPe(){return this.each(uPe)}function fPe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pPe(){return this.each(fPe)}function mPe(e){var t=typeof e==`function`?e:uJ(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function hPe(){return null}function gPe(e,t){var n=typeof e==`function`?e:uJ(e),r=t==null?hPe:typeof t==`function`?t:dJ(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function _Pe(){var e=this.parentNode;e&&e.removeChild(this)}function vPe(){return this.each(_Pe)}function yPe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bPe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function xPe(e){return this.select(e?bPe:yPe)}function SPe(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function CPe(e){return function(t){e.call(this,t,this.__data__)}}function wPe(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function TPe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function EPe(e,t,n){return function(){var r=this.__on,i,a=CPe(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function DPe(e,t,n){var r=wPe(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?EPe:TPe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function wJ(e,t,n){var r=_J(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function OPe(e,t){return function(){return wJ(this,e,t)}}function kPe(e,t){return function(){return wJ(this,e,t.apply(this,arguments))}}function APe(e,t){return this.each((typeof t==`function`?kPe:OPe)(e,t))}function*jPe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var TJ=[null];function EJ(e,t){this._groups=e,this._parents=t}function DJ(){return new EJ([[document.documentElement]],TJ)}function MPe(){return this}EJ.prototype=DJ.prototype={constructor:EJ,select:iNe,selectAll:cNe,selectChild:fNe,selectChildren:gNe,filter:_Ne,data:CNe,enter:vNe,exit:TNe,join:ENe,merge:DNe,selection:MPe,order:ONe,sort:kNe,call:jNe,nodes:MNe,node:NNe,size:PNe,empty:FNe,each:INe,attr:UNe,style:qNe,property:ZNe,classed:tPe,text:aPe,html:lPe,raise:dPe,lower:pPe,append:mPe,insert:gPe,remove:vPe,clone:xPe,datum:SPe,on:DPe,dispatch:APe,[Symbol.iterator]:jPe};function OJ(e){return typeof e==`string`?new EJ([[document.querySelector(e)]],[document.documentElement]):new EJ([[e]],TJ)}function NPe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function kJ(e,t){if(e=NPe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var PPe={passive:!1},AJ={capture:!0,passive:!1};function jJ(e){e.stopImmediatePropagation()}function MJ(e){e.preventDefault(),e.stopImmediatePropagation()}function NJ(e){var t=e.document.documentElement,n=OJ(e).on(`dragstart.drag`,MJ,AJ);`onselectstart`in t?n.on(`selectstart.drag`,MJ,AJ):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function PJ(e,t){var n=e.document.documentElement,r=OJ(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,MJ,AJ),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var FJ=e=>()=>e;function IJ(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}IJ.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function FPe(e){return!e.ctrlKey&&!e.button}function IPe(){return this.parentNode}function LPe(e,t){return t??{x:e.x,y:e.y}}function RPe(){return navigator.maxTouchPoints||`ontouchstart`in this}function LJ(){var e=FPe,t=IPe,n=LPe,r=RPe,i={},a=aJ(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,PPe).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(OJ(n.view).on(`mousemove.drag`,m,AJ).on(`mouseup.drag`,h,AJ),NJ(n.view),jJ(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(MJ(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){OJ(e.view).on(`mousemove.drag mouseup.drag`,null),PJ(e.view,l),MJ(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(jJ(n),c(`start`,n,i[s]))}function _(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(MJ(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(jJ(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=kJ(l||r,t),p,m,h;if((h=n.call(e,new IJ(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=kJ(l||a,t),_=o}u.call(r,e,new IJ(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:FJ(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:FJ(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:FJ(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:FJ(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function RJ(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function zJ(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function BJ(){}var VJ=.7,HJ=1/VJ,UJ=`\\s*([+-]?\\d+)\\s*`,WJ=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,GJ=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,zPe=/^#([0-9a-f]{3,8})$/,BPe=RegExp(`^rgb\\(${UJ},${UJ},${UJ}\\)$`),VPe=RegExp(`^rgb\\(${GJ},${GJ},${GJ}\\)$`),HPe=RegExp(`^rgba\\(${UJ},${UJ},${UJ},${WJ}\\)$`),UPe=RegExp(`^rgba\\(${GJ},${GJ},${GJ},${WJ}\\)$`),WPe=RegExp(`^hsl\\(${WJ},${GJ},${GJ}\\)$`),GPe=RegExp(`^hsla\\(${WJ},${GJ},${GJ},${WJ}\\)$`),KJ={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};RJ(BJ,YJ,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qJ,formatHex:qJ,formatHex8:KPe,formatHsl:qPe,formatRgb:JJ,toString:JJ});function qJ(){return this.rgb().formatHex()}function KPe(){return this.rgb().formatHex8()}function qPe(){return sY(this).formatHsl()}function JJ(){return this.rgb().formatRgb()}function YJ(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=zPe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?XJ(t):n===3?new eY(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ZJ(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ZJ(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=BPe.exec(e))?new eY(t[1],t[2],t[3],1):(t=VPe.exec(e))?new eY(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=HPe.exec(e))?ZJ(t[1],t[2],t[3],t[4]):(t=UPe.exec(e))?ZJ(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=WPe.exec(e))?oY(t[1],t[2]/100,t[3]/100,1):(t=GPe.exec(e))?oY(t[1],t[2]/100,t[3]/100,t[4]):KJ.hasOwnProperty(e)?XJ(KJ[e]):e===`transparent`?new eY(NaN,NaN,NaN,0):null}function XJ(e){return new eY(e>>16&255,e>>8&255,e&255,1)}function ZJ(e,t,n,r){return r<=0&&(e=t=n=NaN),new eY(e,t,n,r)}function QJ(e){return e instanceof BJ||(e=YJ(e)),e?(e=e.rgb(),new eY(e.r,e.g,e.b,e.opacity)):new eY}function $J(e,t,n,r){return arguments.length===1?QJ(e):new eY(e,t,n,r??1)}function eY(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}RJ(eY,$J,zJ(BJ,{brighter(e){return e=e==null?HJ:HJ**+e,new eY(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?VJ:VJ**+e,new eY(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new eY(iY(this.r),iY(this.g),iY(this.b),rY(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tY,formatHex:tY,formatHex8:JPe,formatRgb:nY,toString:nY}));function tY(){return`#${aY(this.r)}${aY(this.g)}${aY(this.b)}`}function JPe(){return`#${aY(this.r)}${aY(this.g)}${aY(this.b)}${aY((isNaN(this.opacity)?1:this.opacity)*255)}`}function nY(){let e=rY(this.opacity);return`${e===1?`rgb(`:`rgba(`}${iY(this.r)}, ${iY(this.g)}, ${iY(this.b)}${e===1?`)`:`, ${e})`}`}function rY(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function iY(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function aY(e){return e=iY(e),(e<16?`0`:``)+e.toString(16)}function oY(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new cY(e,t,n,r)}function sY(e){if(e instanceof cY)return new cY(e.h,e.s,e.l,e.opacity);if(e instanceof BJ||(e=YJ(e)),!e)return new cY;if(e instanceof cY)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new cY(o,s,c,e.opacity)}function YPe(e,t,n,r){return arguments.length===1?sY(e):new cY(e,t,n,r??1)}function cY(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}RJ(cY,YPe,zJ(BJ,{brighter(e){return e=e==null?HJ:HJ**+e,new cY(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?VJ:VJ**+e,new cY(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new eY(dY(e>=240?e-240:e+120,i,r),dY(e,i,r),dY(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new cY(lY(this.h),uY(this.s),uY(this.l),rY(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=rY(this.opacity);return`${e===1?`hsl(`:`hsla(`}${lY(this.h)}, ${uY(this.s)*100}%, ${uY(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function lY(e){return e=(e||0)%360,e<0?e+360:e}function uY(e){return Math.max(0,Math.min(1,e||0))}function dY(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var fY=e=>()=>e;function pY(e,t){return function(n){return e+n*t}}function XPe(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ZPe(e,t){var n=t-e;return n?pY(e,n>180||n<-180?n-360*Math.round(n/360):n):fY(isNaN(e)?t:e)}function QPe(e){return(e=+e)==1?mY:function(t,n){return n-t?XPe(t,n,e):fY(isNaN(t)?n:t)}}function mY(e,t){var n=t-e;return n?pY(e,n):fY(isNaN(e)?t:e)}var hY=(function e(t){var n=QPe(t);function r(e,t){var r=n((e=$J(e)).r,(t=$J(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=mY(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function $Pe(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function eFe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function tFe(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o=0;o<r;++o)i[o]=bY(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function nFe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function gY(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function rFe(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=bY(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var _Y=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vY=new RegExp(_Y.source,`g`);function iFe(e){return function(){return e}}function aFe(e){return function(t){return e(t)+``}}function yY(e,t){var n=_Y.lastIndex=vY.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=_Y.exec(e))&&(i=vY.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:gY(r,i)})),n=vY.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?aFe(c[0].x):iFe(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function bY(e,t){var n=typeof t,r;return t==null||n===`boolean`?fY(t):(n===`number`?gY:n===`string`?(r=YJ(t))?(t=r,hY):yY:t instanceof YJ?hY:t instanceof Date?nFe:eFe(t)?$Pe:Array.isArray(t)?tFe:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?rFe:gY)(e,t)}var xY=180/Math.PI,SY={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function CY(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*xY,skewX:Math.atan(c)*xY,scaleX:o,scaleY:s}}var wY;function oFe(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?SY:CY(t.a,t.b,t.c,t.d,t.e,t.f)}function sFe(e){return e==null||(wY||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),wY.setAttribute(`transform`,e),!(e=wY.transform.baseVal.consolidate()))?SY:(e=e.matrix,CY(e.a,e.b,e.c,e.d,e.e,e.f))}function TY(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:gY(e,i)},{i:c-2,x:gY(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:gY(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:gY(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:gY(e,n)},{i:s-2,x:gY(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var cFe=TY(oFe,`px, `,`px)`,`deg)`),lFe=TY(sFe,`, `,`)`,`)`),uFe=1e-12;function EY(e){return((e=Math.exp(e))+1/e)/2}function dFe(e){return((e=Math.exp(e))-1/e)/2}function fFe(e){return((e=Math.exp(2*e))-1)/(e+1)}var DY=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<uFe)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=EY(y),c=s/(n*g)*(i*fFe(t*r+y)-dFe(y));return[a+c*d,o+c*f,s*i/EY(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),OY=0,kY=0,AY=0,jY=1e3,MY,NY,PY=0,FY=0,IY=0,LY=typeof performance==`object`&&performance.now?performance:Date,RY=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function zY(){return FY||=(RY(pFe),LY.now()+IY)}function pFe(){FY=0}function BY(){this._call=this._time=this._next=null}BY.prototype=VY.prototype={constructor:BY,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?zY():+n)+(t==null?0:+t),!this._next&&NY!==this&&(NY?NY._next=this:MY=this,NY=this),this._call=e,this._time=n,UY()},stop:function(){this._call&&(this._call=null,this._time=1/0,UY())}};function VY(e,t,n){var r=new BY;return r.restart(e,t,n),r}function mFe(){zY(),++OY;for(var e=MY,t;e;)(t=FY-e._time)>=0&&e._call.call(void 0,t),e=e._next;--OY}function HY(){FY=(PY=LY.now())+IY,OY=kY=0;try{mFe()}finally{OY=0,gFe(),FY=0}}function hFe(){var e=LY.now(),t=e-PY;t>jY&&(IY-=t,PY=e)}function gFe(){for(var e,t=MY,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:MY=n);NY=e,UY(r)}function UY(e){OY||(kY&&=clearTimeout(kY),e-FY>24?(e<1/0&&(kY=setTimeout(HY,e-LY.now()-IY)),AY&&=clearInterval(AY)):(AY||=(PY=LY.now(),setInterval(hFe,jY)),OY=1,RY(HY)))}function WY(e,t,n){var r=new BY;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var _Fe=aJ(`start`,`end`,`cancel`,`interrupt`),vFe=[];function GY(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;yFe(e,n,{name:t,index:r,group:i,on:_Fe,tween:vFe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function KY(e,t){var n=JY(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function qY(e,t){var n=JY(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function JY(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function yFe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=VY(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return WY(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(WY(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function YY(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function bFe(e){return this.each(function(){YY(this,e)})}function xFe(e,t){var n,r;return function(){var i=qY(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function SFe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=qY(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function CFe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=JY(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?xFe:SFe)(n,e,t))}function XY(e,t,n){var r=e._id;return e.each(function(){var e=qY(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return JY(e,r).value[t]}}function ZY(e,t){var n;return(typeof t==`number`?gY:t instanceof YJ?hY:(n=YJ(t))?(t=n,hY):yY)(e,t)}function wFe(e){return function(){this.removeAttribute(e)}}function TFe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function EFe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function DFe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function OFe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function kFe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function AFe(e,t){var n=lJ(e),r=n===`transform`?lFe:ZY;return this.attrTween(e,typeof t==`function`?(n.local?kFe:OFe)(n,r,XY(this,`attr.`+e,t)):t==null?(n.local?TFe:wFe)(n):(n.local?DFe:EFe)(n,r,t))}function jFe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function MFe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function NFe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&MFe(e,i)),n}return i._value=t,i}function PFe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&jFe(e,i)),n}return i._value=t,i}function FFe(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=lJ(e);return this.tween(n,(r.local?NFe:PFe)(r,t))}function IFe(e,t){return function(){KY(this,e).delay=+t.apply(this,arguments)}}function LFe(e,t){return t=+t,function(){KY(this,e).delay=t}}function RFe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?IFe:LFe)(t,e)):JY(this.node(),t).delay}function zFe(e,t){return function(){qY(this,e).duration=+t.apply(this,arguments)}}function BFe(e,t){return t=+t,function(){qY(this,e).duration=t}}function VFe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?zFe:BFe)(t,e)):JY(this.node(),t).duration}function HFe(e,t){if(typeof t!=`function`)throw Error();return function(){qY(this,e).ease=t}}function UFe(e){var t=this._id;return arguments.length?this.each(HFe(t,e)):JY(this.node(),t).ease}function WFe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();qY(this,e).ease=n}}function GFe(e){if(typeof e!=`function`)throw Error();return this.each(WFe(this._id,e))}function KFe(e){typeof e!=`function`&&(e=pJ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new $Y(r,this._parents,this._name,this._id)}function qFe(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new $Y(o,this._parents,this._name,this._id)}function JFe(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function YFe(e,t,n){var r,i,a=JFe(t)?KY:qY;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function XFe(e,t){var n=this._id;return arguments.length<2?JY(this.node(),n).on.on(e):this.each(YFe(n,e,t))}function ZFe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function QFe(){return this.on(`end.remove`,ZFe(this._id))}function $Fe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=dJ(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,GY(l[f],t,n,f,l,JY(u,n)));return new $Y(a,this._parents,t,n)}function eIe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=fJ(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=JY(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&GY(p,t,n,h,f,m);a.push(f),o.push(u)}return new $Y(a,o,t,n)}var tIe=DJ.prototype.constructor;function nIe(){return new tIe(this._groups,this._parents)}function rIe(e,t){var n,r,i;return function(){var a=vJ(this,e),o=(this.style.removeProperty(e),vJ(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function QY(e){return function(){this.style.removeProperty(e)}}function iIe(e,t,n){var r,i=n+``,a;return function(){var o=vJ(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function aIe(e,t,n){var r,i,a;return function(){var o=vJ(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),vJ(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function oIe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=qY(this,e),l=c.on,u=c.value[a]==null?s||=QY(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function sIe(e,t,n){var r=(e+=``)==`transform`?cFe:ZY;return t==null?this.styleTween(e,rIe(e,r)).on(`end.style.`+e,QY(e)):typeof t==`function`?this.styleTween(e,aIe(e,r,XY(this,`style.`+e,t))).each(oIe(this._id,e)):this.styleTween(e,iIe(e,r,t),n).on(`end.style.`+e,null)}function cIe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function lIe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&cIe(e,a,n)),r}return a._value=t,a}function uIe(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,lIe(e,t,n??``))}function dIe(e){return function(){this.textContent=e}}function fIe(e){return function(){var t=e(this);this.textContent=t??``}}function pIe(e){return this.tween(`text`,typeof e==`function`?fIe(XY(this,`text`,e)):dIe(e==null?``:e+``))}function mIe(e){return function(t){this.textContent=e.call(this,t)}}function hIe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&mIe(r)),t}return r._value=e,r}function gIe(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,hIe(e))}function _Ie(){for(var e=this._name,t=this._id,n=eX(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=JY(c,t);GY(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new $Y(r,this._parents,e,n)}function vIe(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=qY(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var yIe=0;function $Y(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function eX(){return++yIe}var tX=DJ.prototype;$Y.prototype={constructor:$Y,select:$Fe,selectAll:eIe,selectChild:tX.selectChild,selectChildren:tX.selectChildren,filter:KFe,merge:qFe,selection:nIe,transition:_Ie,call:tX.call,nodes:tX.nodes,node:tX.node,size:tX.size,empty:tX.empty,each:tX.each,on:XFe,attr:AFe,attrTween:FFe,style:sIe,styleTween:uIe,text:pIe,textTween:gIe,remove:QFe,tween:CFe,delay:RFe,duration:VFe,ease:UFe,easeVarying:GFe,end:vIe,[Symbol.iterator]:tX[Symbol.iterator]};function bIe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var xIe={time:null,delay:0,duration:250,ease:bIe};function SIe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function CIe(e){var t,n;e instanceof $Y?(t=e._id,e=e._name):(t=eX(),(n=xIe).time=zY(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&GY(c,e,t,l,o,n||SIe(c,t));return new $Y(r,this._parents,e,t)}DJ.prototype.interrupt=bFe,DJ.prototype.transition=CIe;var nX=e=>()=>e;function wIe(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function rX(e,t,n){this.k=e,this.x=t,this.y=n}rX.prototype={constructor:rX,scale:function(e){return e===1?this:new rX(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new rX(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var iX=new rX(1,0,0);aX.prototype=rX.prototype;function aX(e){for(;!e.__zoom;)if(!(e=e.parentNode))return iX;return e.__zoom}function oX(e){e.stopImmediatePropagation()}function sX(e){e.preventDefault(),e.stopImmediatePropagation()}function TIe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function EIe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function cX(){return this.__zoom||iX}function DIe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function OIe(){return navigator.maxTouchPoints||`ontouchstart`in this}function kIe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function lX(){var e=TIe,t=EIe,n=kIe,r=DIe,i=OIe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=DY,l=aJ(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,cX).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,cX),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(iX.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new rX(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new rX(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new rX(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=OJ(this.that).datum();l.call(e,this.that,new wIe(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=kJ(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],YY(this),s.start();sX(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=OJ(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=kJ(t,i),l=t.clientX,u=t.clientY;NJ(t.view),oX(t),a.mouse=[c,this.__zoom.invert(c)],YY(this),a.start();function d(e){if(sX(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=kJ(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),PJ(e.view,a.moved),sX(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=kJ(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);sX(r),s>0?OJ(this).transition().duration(s).call(x,d,c,r):OJ(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(oX(t),s=0;s<i;++s)c=r[s],l=kJ(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),YY(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(sX(e),s=0;s<a;++s)c=i[s],l=kJ(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(oX(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=kJ(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=OJ(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:nX(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:nX(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:nX(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:nX([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var uX={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},dX=[[-1/0,-1/0],[1/0,1/0]],fX=[`Enter`,` `,`Escape`],pX={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},mX;(function(e){e.Strict=`strict`,e.Loose=`loose`})(mX||={});var hX;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(hX||={});var gX;(function(e){e.Partial=`partial`,e.Full=`full`})(gX||={});var _X={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},vX;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(vX||={});var yX;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(yX||={});var bX;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(bX||={});var xX={[bX.Left]:bX.Right,[bX.Right]:bX.Left,[bX.Top]:bX.Bottom,[bX.Bottom]:bX.Top},SX=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,AIe=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),CX=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),wX=(e,t=[0,0])=>{let{width:n,height:r}=ZX(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},jIe=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):CX(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,NX(e,LX(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?FX(r):{x:0,y:0,width:0,height:0}},TX=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=NX(n,LX(e)),r=!0)}),r?FX(n):{x:0,y:0,width:0,height:0}},EX=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=zX(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},MIe=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function NIe(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=ZX(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function PIe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=JX(TX(NIe(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function DX({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,uX.error005());else{let{width:e,height:t}=ZX(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&XX(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=XX(d)?kX(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,uX.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function FIe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=MIe(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var OX=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),kX=(e={x:0,y:0},t,n)=>({x:OX(e.x,t[0][0],t[1][0]-(n?.width??0)),y:OX(e.y,t[0][1],t[1][1]-(n?.height??0))});function AX(e,t,n){let{width:r,height:i}=ZX(n),{x:a,y:o}=n.internals.positionAbsolute;return kX(e,[[a,o],[a+r,o+i]],t)}var jX=(e,t,n)=>e<t?OX(Math.abs(e-t),1,t)/t:e>n?-OX(Math.abs(e-n),1,t)/t:0,MX=(e,t,n=15,r=40)=>[jX(e.x,r,t.width-r)*n,jX(e.y,r,t.height-r)*n],NX=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),PX=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),FX=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),IX=(e,t=[0,0])=>{let{x:n,y:r}=CX(e)?e.internals.positionAbsolute:wX(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},LX=(e,t=[0,0])=>{let{x:n,y:r}=CX(e)?e.internals.positionAbsolute:wX(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},RX=(e,t)=>FX(NX(PX(e),PX(t))),zX=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},BX=(e,t)=>zX(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),VX=e=>HX(e.width)&&HX(e.height)&&HX(e.x)&&HX(e.y),HX=e=>!isNaN(e)&&isFinite(e),UX=(e,t)=>(e,t)=>{},WX=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),GX=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?WX(s,o):s},KX=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function qX(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function IIe(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=qX(e,n),i=qX(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=qX(e.top??e.y??0,n),i=qX(e.bottom??e.y??0,n),a=qX(e.left??e.x??0,t),o=qX(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function LIe(e,t,n,r,i,a){let{x:o,y:s}=KX(e,[t,n,r]),{x:c,y:l}=KX({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var JX=(e,t,n,r,i,a)=>{let o=IIe(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=OX(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=LIe(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},YX=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function XX(e){return e!=null&&e!==`parent`}function ZX(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function QX(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function $X(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function eZ(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function RIe(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function zIe(e){return{...pX,...e||{}}}function tZ(e){return e===null?null:e?`valid`:`invalid`}function nZ(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=sZ(e),s=GX({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?WX(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var rZ=e=>({width:e.offsetWidth,height:e.offsetHeight}),iZ=e=>e?.getRootNode?.()||window?.document,BIe=[`INPUT`,`SELECT`,`TEXTAREA`];function aZ(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?BIe.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var oZ=e=>`clientX`in e,sZ=(e,t)=>{let n=oZ(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},cZ=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...rZ(t)}})};function lZ({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function uZ(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function dZ({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case bX.Left:return[t-uZ(t-r,a),n];case bX.Right:return[t+uZ(r-t,a),n];case bX.Top:return[t,n-uZ(n-i,a)];case bX.Bottom:return[t,n+uZ(i-n,a)]}}function fZ({sourceX:e,sourceY:t,sourcePosition:n=bX.Bottom,targetX:r,targetY:i,targetPosition:a=bX.Top,curvature:o=.25}){let[s,c]=dZ({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=dZ({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=lZ({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function pZ({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function VIe({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function HIe({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=NX(LX(e),LX(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),BX({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},FX(a))>0}var UIe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,WIe=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),GIe=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,uX.error006()),t;let r=n.getEdgeId||UIe,i;return i=SX(e)?{...e}:{...e,id:r(e)},WIe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function mZ({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=pZ({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var hZ={[bX.Left]:{x:-1,y:0},[bX.Right]:{x:1,y:0},[bX.Top]:{x:0,y:-1},[bX.Bottom]:{x:0,y:1}},KIe=({source:e,sourcePosition:t=bX.Bottom,target:n})=>t===bX.Left||t===bX.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},gZ=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function qIe({source:e,sourcePosition:t=bX.Bottom,target:n,targetPosition:r=bX.Top,center:i,offset:a,stepPosition:o}){let s=hZ[t],c=hZ[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=KIe({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=pZ({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function JIe(e,t,n,r){let i=Math.min(gZ(e,t)/2,gZ(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function _Z({sourceX:e,sourceY:t,sourcePosition:n=bX.Bottom,targetX:r,targetY:i,targetPosition:a=bX.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=qIe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=JIe(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function vZ(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function YIe(e){let{sourceNode:t,targetNode:n}=e;if(!vZ(t)||!vZ(n))return null;let r=t.internals.handleBounds||yZ(t.handles),i=n.internals.handleBounds||yZ(n.handles),a=xZ(r?.source??[],e.sourceHandle),o=xZ(e.connectionMode===mX.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,uX.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||bX.Bottom,c=o?.position||bX.Top,l=bZ(t,a,s),u=bZ(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function yZ(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function bZ(e,t,n=bX.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??ZX(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case bX.Top:return{x:i+o/2,y:a};case bX.Right:return{x:i+o,y:a+s/2};case bX.Bottom:return{x:i+o/2,y:a+s};case bX.Left:return{x:i,y:a+s/2}}}function xZ(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function SZ(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function XIe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=SZ(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var CZ=1e3,ZIe=10,wZ={nodeOrigin:[0,0],nodeExtent:dX,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},QIe={...wZ,checkEquality:!0};function TZ(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function $Ie(e,t,n){let r=TZ(wZ,n);for(let n of e.values())if(n.parentId)OZ(n,e,t,r);else{let e=kX(wX(n,r.nodeOrigin),XX(n.extent)?n.extent:r.nodeExtent,ZX(n));n.internals.positionAbsolute=e}}function eLe(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function EZ(e){return e===`manual`}function DZ(e,t,n,r={}){let i=TZ(QIe,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!EZ(i.zIndexMode)?CZ:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=kX(wX(u,i.nodeOrigin),XX(u.extent)?u.extent:i.nodeExtent,ZX(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:eLe(u,e),z:kZ(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&OZ(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function tLe(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function OZ(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=TZ(wZ,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}tLe(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*ZIe),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=nLe(e,u,o,s,a&&!EZ(c)?CZ:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function kZ(e,t,n){let r=HX(e.zIndex)?e.zIndex:0;return EZ(n)?r:r+(e.selected?t:0)}function nLe(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=ZX(e),l=wX(e,n),u=XX(e.extent)?kX(l,e.extent,c):l,d=kX({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=AX(d,c,t));let f=kZ(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function AZ(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=RX(a.get(n.parentId)?.expandedRect??IX(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=ZX(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function rLe(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=rZ(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=XX(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=AX(h,s,n))}else m&&(h=kX(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:cZ(`source`,r.nodeElement,p,d,e.id),target:cZ(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&OZ(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:IX(g,i)}))}}if(f.length>0){let e=AZ(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function iLe({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function jZ(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function MZ(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;jZ(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),jZ(`target`,s,c,e,i,o),t.set(r.id,r)}}function NZ(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:NZ(n,t):!1}function PZ(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function aLe(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!NZ(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function FZ({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function oLe({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=WX(a,t);return{x:o.x-a.x,y:o.y-a.y}}function sLe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=OJ(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?PX(TX(s)):null,x=v&&l?oLe({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:WX(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=DX({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=FZ({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=MX(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=nZ(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=aLe(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=FZ({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=LJ().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=nZ(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=sZ(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=nZ(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=sZ(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=sZ(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p)p&&s.size>0&&t().updateNodePositions(s,!1);else if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=FZ({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!PZ(t,`.${g}`,v))&&(!_||PZ(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function cLe(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())BX(i,IX(e))>0&&r.push(e);return r}var lLe=250;function uLe(e,t,n,r){let i=[],a=1/0,o=cLe(e,n,t+lLe);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=bZ(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function IZ(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...bZ(o,c,c.position,!0)}:c}function LZ(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function dLe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var RZ=()=>!0;function fLe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=RZ,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=iZ(e.target),E=0,D,{x:O,y:k}=sZ(e),A=LZ(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=IZ(i,A,r,c,t);if(!N)return;let P=sZ(e,j),ee=!1,F=null,te=!1,ne=null;function re(){if(!u||!j)return;let[e,t]=MX(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(re)}let ie={...N,nodeId:i,type:A,position:N.position},ae=c.get(i),oe={inProgress:!0,isValid:null,from:bZ(ae,ie,bX.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:ae,to:P,toHandle:null,toPosition:xX[ie.position],toNode:null,pointer:P};function se(){M=!0,y(oe),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&se();function ce(e){if(!M){let{x:t,y:n}=sZ(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;se()}if(!x()||!ie){le(e);return}let a=b();P=sZ(e,j),D=uLe(GX(P,a,!1,[1,1]),n,c,ie),ee||=(re(),!0);let s=zZ(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});ne=s.handleDomNode,F=s.connection,te=dLe(!!D,s.isValid);let u=c.get(i),f=u?bZ(u,ie,bX.Left,!0):oe.from,p={...oe,from:f,isValid:te,to:s.toHandle&&te?KX({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:te&&s.toHandle?s.toHandle.position:xX[ie.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),oe=p}function le(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||ne)&&F&&te&&h?.(F);let{inProgress:t,...n}=oe,r={...n,toPosition:oe.toHandle?oe.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),ee=!1,te=!1,F=null,ne=null,T.removeEventListener(`mousemove`,ce),T.removeEventListener(`mouseup`,le),T.removeEventListener(`touchmove`,ce),T.removeEventListener(`touchend`,le)}}T.addEventListener(`mousemove`,ce),T.addEventListener(`mouseup`,le),T.addEventListener(`touchmove`,ce),T.addEventListener(`touchend`,le)}function zZ(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=RZ,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=sZ(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=LZ(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===mX.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=IZ(t,e,a,u,n,!0)}return _}var BZ={onPointerDown:fLe,isValid:zZ};function pLe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=OJ(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&YX()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=lX().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:kJ}}var VZ=e=>({x:e.x,y:e.y,zoom:e.k}),HZ=({x:e,y:t,zoom:n})=>iX.translate(e,t).scale(n),UZ=(e,t)=>e.target.closest(`.${t}`),WZ=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),mLe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,GZ=(e,t=0,n=mLe,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},KZ=e=>{let t=e.ctrlKey&&YX()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function hLe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(UZ(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=kJ(u),t=d*2**KZ(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===hX.Vertical?0:u.deltaX*f,m=i===hX.Horizontal?0:u.deltaY*f;!YX()&&u.shiftKey&&i!==hX.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=VZ(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function gLe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=UZ(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function _Le({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=VZ(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function vLe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&WZ(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,VZ(a.transform))}}function yLe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&WZ(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=VZ(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function bLe({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(UZ(f,`${u}-flow__node`)||UZ(f,`${u}-flow__edge`)||UZ(f,`${u}-flow__selection`)||UZ(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||UZ(f,c)&&h||UZ(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function xLe({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=lX().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=OJ(e).call(f);y({x:i.x,y:i.y,zoom:OX(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(KZ);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bY:DY).transform(GZ(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,panActivationKeyPressed:S=!1,zoomActivationKeyPressed:C,lib:w,onTransformChange:T,connectionInProgress:E,paneClickDistance:D,selectionOnDrag:O}){r&&!l.isZoomingOrPanning&&v();let k=i&&!C&&!r;f.clickDistance(O?1/0:!HX(D)||D<0?0:D);let A=k?hLe({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):gLe({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,A,{passive:!1});let j=_Le({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,j);let M=vLe({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:T});f.on(`zoom`,M);let N=yLe({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,N);let P=bLe({panActivationKeyPressed:S,zoomActivationKeyPressed:C,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:w,connectionInProgress:E});f.filter(P),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=HZ(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=HZ(e);return await g(n,t),n}function x(e){if(p){let t=HZ(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?aX(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bY:DY).scaleTo(GZ(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bY:DY).scaleBy(GZ(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!HX(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var qZ;(function(e){e.Line=`line`,e.Handle=`handle`})(qZ||={});function SLe({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function JZ(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function YZ(e,t){return Math.max(0,t-e)}function XZ(e,t){return Math.max(0,e-t)}function ZZ(e,t,n){return Math.max(0,t-e,e-n)}function QZ(e,t){return e?!t:t}function CLe(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=ZZ(E,h,g),j=ZZ(D,_,v);if(o){let e=0,t=0;c&&w<0?e=YZ(y+w+O,o[0][0]):!c&&w>0&&(e=XZ(y+E+O,o[1][0])),l&&T<0?t=YZ(b+T+k,o[0][1]):!l&&T>0&&(t=XZ(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=XZ(y+w,s[0][0]):!c&&w<0&&(e=YZ(y+E,s[1][0])),l&&T>0?t=XZ(b+T,s[0][1]):!l&&T<0&&(t=YZ(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=ZZ(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?XZ(b+k+E/C,o[1][1])*C:YZ(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?YZ(b+E/C,s[1][1])*C:XZ(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=ZZ(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?XZ(y+D*C+O,o[1][0])/C:YZ(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?YZ(y+D*C,s[1][0])/C:XZ(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(QZ(c,l)?-w:w)/C:w=(QZ(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var $Z={width:0,height:0,x:0,y:0},wLe={...$Z,pointerX:0,pointerY:0,aspectRatio:1};function TLe(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function ELe({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=OJ(e),o={controlDirection:JZ(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...$Z},h={...wLe};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:JZ(e)};let g,_=null,v=[],y,b,x,S=LJ().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=nZ(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=XX(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=TLe(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=nZ(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:S,height:C}=m,w={},T=g.origin??s,{width:E,height:D,x:O,y:k}=CLe(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,T,b,x),A=E!==S,j=D!==C,M=O!==u&&A,N=k!==f&&j;if(!M&&!N&&!A&&!j)return;let P={prevValues:{...m},startX:h.x,startY:h.y,childNodes:v.map(e=>({...e,position:{...e.position}}))};if((M||N||T[0]===1||T[1]===1)&&(w.x=M?O:m.x,w.y=N?k:m.y,m.x=w.x,m.y=w.y,v.length>0)){let e=O-u,t=k-f;for(let n of v)n.position={x:n.position.x-e+T[0]*(E-S),y:n.position.y-t+T[1]*(D-C)},l.push(n)}if((A||j)&&(w.width=A&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?E:m.width,w.height=j&&(!o.resizeDirection||o.resizeDirection===`vertical`)?D:m.height,m.width=w.width,m.height=w.height),y&&g.expandParent){let e=T[0]*(w.width??0);w.x&&w.x<e&&(m.x=e,h.x-=w.x-e);let t=T[1]*(w.height??0);w.y&&w.y<t&&(m.y=t,h.y-=w.y-t)}let ee=SLe({width:m.width,prevWidth:S,height:m.height,prevHeight:C,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),F={...m,direction:ee};p?.(e,F)===!1?(m=P.prevValues,h.x=P.startX,h.y=P.startY,v.forEach((e,t)=>{e.position=P.childNodes[t].position})):(d?.(e,F),r(w,l))}).on(`end`,e=>{f?.(e,{...m}),i?.({...m})});a.call(S)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var eQ=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},DLe=e=>e?eQ(e):eQ,{useDebugValue:OLe}=V.default,{useSyncExternalStoreWithSelector:kLe}=gx.default,ALe=e=>e;function tQ(e,t=ALe,n){let r=kLe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return OLe(r),r}var nQ=(e,t)=>{let n=DLe(e),r=(e,r=t)=>tQ(n,e,r);return Object.assign(r,n),r},jLe=(e,t)=>e?nQ(e,t):nQ;function rQ(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var iQ=(0,V.createContext)(null),MLe=iQ.Provider,aQ=uX.error001(`react`);function oQ(e,t){let n=(0,V.useContext)(iQ);if(n===null)throw Error(aQ);return tQ(n,e,t)}function sQ(){let e=(0,V.useContext)(iQ);if(e===null)throw Error(aQ);return(0,V.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var cQ={display:`none`},NLe={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},lQ=`react-flow__node-desc`,uQ=`react-flow__edge-desc`,PLe=`react-flow__aria-live`,FLe=e=>e.ariaLiveMessage,ILe=e=>e.ariaLabelConfig;function LLe({rfId:e}){let t=oQ(FLe);return(0,H.jsx)(`div`,{id:`${PLe}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:NLe,children:t})}function RLe({rfId:e,disableKeyboardA11y:t}){let n=oQ(ILe);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{id:`${lQ}-${e}`,style:cQ,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,H.jsx)(`div`,{id:`${uQ}-${e}`,style:cQ,children:n[`edge.a11yDescription.default`]}),!t&&(0,H.jsx)(LLe,{rfId:e})]})}var dQ=(0,V.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,H.jsx)(`div`,{className:iJ([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});dQ.displayName=`Panel`;var fQ=`https://reactflow.dev?utm_source=attribution`;function zLe({proOptions:e,position:t=`bottom-right`}){return(0,V.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,H.jsx)(dQ,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${fQ}`,children:(0,H.jsx)(`a`,{href:fQ,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var BLe=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},pQ=e=>e.id;function VLe(e,t){return rQ(e.selectedNodes.map(pQ),t.selectedNodes.map(pQ))&&rQ(e.selectedEdges.map(pQ),t.selectedEdges.map(pQ))}function HLe({onSelectionChange:e}){let t=sQ(),{selectedNodes:n,selectedEdges:r}=oQ(BLe,VLe);return(0,V.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var ULe=e=>!!e.onSelectionChangeHandlers;function WLe({onSelectionChange:e}){let t=oQ(ULe);return e||t?(0,H.jsx)(HLe,{onSelectionChange:e}):null}var mQ=[0,0],GLe={x:0,y:0,zoom:1},hQ=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],KLe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),gQ={translateExtent:dX,nodeOrigin:mQ,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function qLe(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=oQ(KLe,rQ),l=sQ();(0,V.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=gQ,s()}),[]);let u=(0,V.useRef)(gQ);return(0,V.useEffect)(()=>{for(let s of hQ){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:zIe(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},hQ.map(t=>e[t])),null}function _Q(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function JLe(e){let[t,n]=(0,V.useState)(e===`system`?null:e);return(0,V.useEffect)(()=>{if(e!==`system`){n(e);return}let t=_Q(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?_Q()?.matches?`dark`:`light`:t}var vQ=typeof document<`u`?document:null;function yQ(e=null,t={target:vQ,actInsideInputWithModifier:!0}){let[n,r]=(0,V.useState)(!1),i=(0,V.useRef)(!1),a=(0,V.useRef)(new Set([])),[o,s]=(0,V.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
|
|
101
101
|
`).replace(`
|
|
102
102
|
|
|
103
103
|
`,`
|
|
@@ -133,14 +133,14 @@ Defaulting to \`null\`.`}dW(bW,`getInvalidValueError`);var zke=Object.defineProp
|
|
|
133
133
|
`,...a.current()});return/^[\t ]/.test(l)&&(l=C2(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}E2.peek=hGe;function E2(e){return e.value||``}function hGe(){return`<`}D2.peek=gGe;function D2(e,t,n,r){let i=S2(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function gGe(){return`!`}O2.peek=_Ge;function O2(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function _Ge(){return`!`}k2.peek=vGe;function k2(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function vGe(){return"`"}function A2(e,t){let n=C1(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][a-z+.-]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}j2.peek=yGe;function j2(e,t,n,r){let i=S2(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(A2(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function yGe(e,t,n){return A2(e,n)?`<`:`[`}M2.peek=bGe;function M2(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function bGe(){return`[`}function N2(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function xGe(e){let t=N2(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function SGe(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function P2(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function CGe(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?SGe(n):N2(n),s=e.ordered?o===`.`?`)`:`.`:xGe(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),P2(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function wGe(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function TGe(e,t,n,r){let i=wGe(n),a=n.bulletCurrent||N2(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function EGe(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var DGe=L0([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function OGe(e,t,n,r){return(e.children.some(function(e){return DGe(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function kGe(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}F2.peek=AGe;function F2(e,t,n,r){let i=kGe(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=w2(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=C2(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=w2(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+C2(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function AGe(e,t,n){return n.options.strong||`*`}function jGe(e,t,n,r){return n.safe(e.value,r)}function MGe(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function NGe(e,t,n){let r=(P2(n)+(n.options.ruleSpaces?` `:``)).repeat(MGe(n));return n.options.ruleSpaces?r.slice(0,-1):r}var I2={blockquote:nGe,break:x2,code:cGe,definition:uGe,emphasis:T2,hardBreak:x2,heading:mGe,html:E2,image:D2,imageReference:O2,inlineCode:k2,link:j2,linkReference:M2,list:CGe,listItem:TGe,paragraph:EGe,root:OGe,strong:F2,text:jGe,thematicBreak:NGe};function PGe(){return{enter:{table:FGe,tableData:R2,tableHeader:R2,tableRow:LGe},exit:{codeText:RGe,table:IGe,tableData:L2,tableHeader:L2,tableRow:L2}}}function FGe(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function IGe(e){this.exit(e),this.data.inTable=void 0}function LGe(e){this.enter({type:`tableRow`,children:[]},e)}function L2(e){this.exit(e)}function R2(e){this.enter({type:`tableCell`,children:[]},e)}function RGe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,zGe));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function zGe(e,t){return t===`|`?t:e}function BGe(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
134
134
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
135
135
|
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return eGe(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=I2.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function VGe(){return{exit:{taskListCheckValueChecked:z2,taskListCheckValueUnchecked:z2,paragraph:UGe}}}function HGe(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:WGe}}}function z2(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function UGe(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function WGe(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=I2.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function GGe(){return[CWe(),WWe(),JWe(),PGe(),VGe()]}function KGe(e){return{extensions:[wWe(),GWe(e),YWe(),BGe(e),HGe()]}}var qGe={tokenize:$Ge,partial:!0},B2={tokenize:eKe,partial:!0},V2={tokenize:tKe,partial:!0},H2={tokenize:nKe,partial:!0},JGe={tokenize:rKe,partial:!0},U2={name:`wwwAutolink`,tokenize:ZGe,previous:J2},W2={name:`protocolAutolink`,tokenize:QGe,previous:Y2},G2={name:`emailAutolink`,tokenize:XGe,previous:X2},K2={};function YGe(){return{text:K2}}for(var q2=48;q2<123;)K2[q2]=G2,q2++,q2===58?q2=65:q2===91&&(q2=97);K2[43]=G2,K2[45]=G2,K2[46]=G2,K2[95]=G2,K2[72]=[G2,W2],K2[104]=[G2,W2],K2[87]=[G2,U2],K2[119]=[G2,U2];function XGe(e,t,n){let r=this,i,a;return o;function o(t){return!Z2(t)||!X2.call(r,r.previous)||Q2(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Z2(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(JGe,u,l)(t):t===45||t===95||F1(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&P1(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function ZGe(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!J2.call(r,r.previous)||Q2(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(qGe,e.attempt(B2,e.attempt(V2,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function QGe(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Y2.call(r,r.previous)&&!Q2(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(P1(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||I1(t)||z1(t)||H1(t)||V1(t)?n(t):e.attempt(B2,e.attempt(V2,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function $Ge(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function eKe(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(H2,c,s)(t):t===null||z1(t)||H1(t)||t!==45&&V1(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function tKe(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(H2,t,a)(o):o===null||z1(o)||H1(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function nKe(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||z1(o)||H1(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||z1(e)||H1(e)?t(e):r(e)}function a(e){return P1(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):P1(t)?(e.consume(t),o):n(t)}}function rKe(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return F1(e)?n(e):t(e)}}function J2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||z1(e)}function Y2(e){return!P1(e)}function X2(e){return!(e===47||Z2(e))}function Z2(e){return e===43||e===45||e===46||e===95||F1(e)}function Q2(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var iKe={tokenize:fKe,partial:!0};function aKe(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:lKe,continuation:{tokenize:uKe},exit:dKe}},text:{91:{name:`gfmFootnoteCall`,tokenize:cKe},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:oKe,resolveTo:sKe}}}}function oKe(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=N1(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function sKe(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function cKe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||z1(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(N1(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return z1(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function lKe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||z1(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=N1(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return z1(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),G1(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function uKe(e,t,n){return e.check(Z1,t,e.attempt(iKe,t,n))}function dKe(e){e.exit(`gfmFootnoteDefinition`)}function fKe(e,t,n){let r=this;return G1(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function pKe(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&O1(o,o.length,0,J1(s,e.slice(r+1,n),t)),O1(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),O1(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=q1(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=q1(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var mKe=class{constructor(){this.map=[]}add(e,t,n){hKe(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function hKe(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function gKe(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function _Ke(){return{flow:{null:{name:`table`,tokenize:vKe,resolveAll:yKe}}}}function vKe(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):R1(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):B1(t)?G1(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||z1(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,B1(t)?G1(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return B1(t)?G1(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||R1(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return B1(t)?G1(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||R1(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||R1(n)?(e.exit(`tableRow`),t(n)):B1(n)?G1(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||z1(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function yKe(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new mKe;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(e4(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=$2(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=$2(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=$2(f,t,o,i,n,d)):(o[0]=o[1],d=$2(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&e4(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=gKe(t.events,n))}return e}function $2(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},t4(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=t4(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=t4(t.events,n[2]),a=t4(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},t4(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function e4(e,t,n,r,i){let a=[],o=t4(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function t4(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var bKe={name:`tasklistCheck`,tokenize:SKe};function xKe(){return{text:{91:bKe}}}function SKe(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return z1(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return R1(r)?t(r):B1(r)?e.check({tokenize:CKe},t,n)(r):n(r)}}function CKe(e,t,n){return G1(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function wKe(e){return j1([YGe(),aKe(),pKe(e),_Ke(),xKe()])}var TKe={};function EKe(e){let t=this,n=e||TKe,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(wKe(n)),a.push(GGe()),o.push(KGe(n))}var DKe=[EKe],n4=`rounded bg-po-deep px-1 py-px font-mono text-po-green`,r4=(0,V.createContext)(void 0),OKe=(0,V.createContext)(void 0);function kKe({src:e,alt:t}){let n=(0,V.useContext)(OKe),r=(0,V.useContext)(Oq),i=typeof e==`string`&&/^@?artifact:/u.test(e),a;if(typeof e==`string`&&e!==``&&(i||!/^(?:[a-z][a-z\d+.-]*:|\/\/|#|\?)/i.test(e)))try{a=decodeURIComponent((i&&e.startsWith(`@`)?e.slice(1):e).split(/[?#]/,1)[0])}catch{a=``}let[o,s]=(0,V.useState)();(0,V.useEffect)(()=>{if(n===void 0||a===void 0)return;let e=!0,t;return Promise.resolve().then(()=>{if(e&&s(void 0),a===``)throw Error(`Invalid image path.`);return n(a)}).then(r=>{e?(t=r,s({path:a,loader:n,url:r.url,sourcePath:r.path??a})):r.dispose()}).catch(()=>{e&&s({path:a,loader:n,failed:!0})}),()=>{e=!1,t?.dispose()}},[a,n]);let c=o?.path===a&&o?.loader===n?o:void 0,l=c?.failed===!0||i&&n===void 0;if(l||n!==void 0&&a!==void 0&&c?.url===void 0)return(0,H.jsxs)(`span`,{role:l?`alert`:`status`,title:a,children:[t||a||`Image`,` (`,l?`unavailable`:`loading...`,`)`]});let u=n!==void 0&&a!==void 0?c?.url:e,d=(0,H.jsx)(`img`,{src:u,alt:t??``,onError:n!==void 0&&a!==void 0?()=>s({path:a,loader:n,failed:!0}):void 0,className:`max-h-[480px] max-w-full rounded border border-po-border`});if(r===void 0||typeof u!=`string`||u===``)return d;let f=t||a||`Image`;return(0,H.jsx)(`button`,{type:`button`,"data-testid":`markdown-media-open`,"aria-label":`Open ${f} full screen`,onClick:()=>r.open({kind:`image`,title:f,url:u,sourcePath:c?.sourcePath??a}),className:`max-w-full cursor-zoom-in rounded focus-visible:ring-2 focus-visible:ring-po-blue focus-visible:outline-none`,children:d})}function AKe({className:e,children:t,...n}){let r=(0,V.useContext)(r4),i=typeof t==`string`&&!t.includes(`
|
|
136
|
-
`)?t:void 0,a=i===void 0||e!==void 0?void 0:r?.(i);return a!==void 0&&i!==void 0?(0,H.jsx)(`button`,{type:`button`,"data-testid":`markdown-file-link`,title:`open ${i}`,onClick:a,className:`${n4} cursor-pointer underline decoration-po-green/40 underline-offset-2 hover:text-po-hi hover:decoration-po-hi`,children:i}):(0,H.jsx)(`code`,{...n,className:`${e??``} ${n4} [pre_&]:bg-transparent [pre_&]:p-0 [pre_&]:text-po-hi`,children:t})}function jKe({href:e,children:t}){let n=(0,V.useContext)(r4),r=e;try{r=e===void 0?void 0:decodeURIComponent(e)}catch{r=void 0}let i=r!==void 0&&r!==``&&!/^(?:[a-z][a-z\d+.-]*:|\/\/|#|\?)/i.test(r)?n?.(r,!0):void 0;return i===void 0?(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-po-blue underline decoration-po-blue/50`,children:t}):(0,H.jsx)(`button`,{type:`button`,"data-testid":`markdown-file-link`,title:`open ${r}`,onClick:i,className:`text-po-blue underline decoration-po-blue/50`,children:t})}function i4(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>i4(e)).join(``):``}function MKe({children:e}){let t=(0,V.isValidElement)(e)?e:void 0;return t===void 0?(0,H.jsx)(`pre`,{className:`overflow-x-auto rounded border border-po-border bg-po-deep p-2.5 text-sm leading-relaxed`,children:e}):(0,H.jsx)(Iq,{text:i4(t.props.children).replace(/\n$/,``),className:t.props.className})}var NKe={p:({children:e})=>(0,H.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:e}),strong:({children:e})=>(0,H.jsx)(`strong`,{className:`font-semibold text-po-hi`,children:e}),em:({children:e})=>(0,H.jsx)(`em`,{className:`italic`,children:e}),del:({children:e})=>(0,H.jsx)(`del`,{className:`text-po-dim line-through`,children:e}),a:jKe,code:AKe,pre:MKe,ul:({children:e})=>(0,H.jsx)(`ul`,{className:`list-disc pl-5`,children:e}),ol:({children:e})=>(0,H.jsx)(`ol`,{className:`list-decimal pl-5`,children:e}),li:({children:e})=>(0,H.jsx)(`li`,{className:`whitespace-pre-wrap break-words`,children:e}),h1:({children:e})=>(0,H.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold text-po-hi first:mt-0`,children:e}),h2:({children:e})=>(0,H.jsx)(`h2`,{className:`mt-2 text-xl font-semibold text-po-hi first:mt-0`,children:e}),h3:({children:e})=>(0,H.jsx)(`h3`,{className:`mt-1 text-lg font-semibold text-po-hi first:mt-0`,children:e}),h4:({children:e})=>(0,H.jsx)(`h4`,{className:`font-semibold text-po-hi`,children:e}),h5:({children:e})=>(0,H.jsx)(`h5`,{className:`font-semibold text-po-text`,children:e}),h6:({children:e})=>(0,H.jsx)(`h6`,{className:`font-semibold text-po-dim`,children:e}),blockquote:({children:e})=>(0,H.jsx)(`blockquote`,{className:`border-l-2 border-po-border pl-3 text-po-dim`,children:e}),hr:()=>(0,H.jsx)(`hr`,{className:`border-po-border-soft`}),table:({children:e})=>(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsx)(`table`,{className:`border-collapse`,children:e})}),th:({children:e})=>(0,H.jsx)(`th`,{className:`border border-po-border bg-po-deep px-2 py-1 text-left font-semibold text-po-hi`,children:e}),td:({children:e})=>(0,H.jsx)(`td`,{className:`border border-po-border px-2 py-1 align-top`,children:e}),img:kKe};function a4({text:e,onFileLink:t,loadImage:n,documentPath:r,renderMediaReview:i}){let[a,o]=(0,V.useState)(),s=(0,V.useMemo)(()=>({open:e=>o({...e,...r===void 0?{}:{documentPath:r}})}),[r]),c=()=>o(void 0);return(0,H.jsx)(r4.Provider,{value:t,children:(0,H.jsx)(OKe.Provider,{value:n,children:(0,H.jsxs)(Oq.Provider,{value:s,children:[(0,H.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:(0,H.jsx)(mWe,{remarkPlugins:DKe,components:NKe,urlTransform:(e,t,n)=>t===`src`&&n.tagName===`img`&&/^@?artifact:/u.test(e)?e:u2(e),children:e})}),(0,H.jsx)(N$,{media:a,onClose:c,review:a===void 0?void 0:i?.(a,c)})]})})})}function o4({src:e,alt:t,title:n,renderReview:r,...i}){let[a,o]=(0,V.useState)(),s=()=>o(void 0),c=n||t||`Image`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":`Open ${c} full screen`,onClick:()=>o({kind:`image`,title:c,url:e}),className:`max-w-full cursor-zoom-in self-start rounded focus-visible:ring-2 focus-visible:ring-po-blue focus-visible:outline-none`,children:(0,H.jsx)(`img`,{...i,src:e,alt:t})}),(0,H.jsx)(N$,{media:a,onClose:s,review:a===void 0?void 0:r?.(a,s)})]})}var PKe={avif:`image`,bmp:`image`,gif:`image`,ico:`image`,jpeg:`image`,jpg:`image`,png:`image`,svg:`image`,webp:`image`,m4v:`video`,mov:`video`,mp4:`video`,webm:`video`,pdf:`pdf`};function FKe(e){let t=e.split(`/`).at(-1)??``,n=t.lastIndexOf(`.`);return n<1?``:t.slice(n+1).toLowerCase()}function s4(e){return PKe[FKe(e)]??`download`}var c4={page:1,pageCount:0,sourceWidth:0,sourceHeight:0};function l4(e,t){return!Number.isFinite(e)||t<=0?1:Math.min(t,Math.max(1,Math.trunc(e)))}function u4(e,t,n){if(t.width<=0||t.height<=0)return null;let r=Math.max(t.left,Math.min(t.right,n.left)),i=Math.max(t.left,Math.min(t.right,n.right)),a=Math.max(t.top,Math.min(t.bottom,n.top)),o=Math.max(t.top,Math.min(t.bottom,n.bottom));return i<=r||o<=a?null:{page:e,rect:{x:(r-t.left)/t.width,y:(a-t.top)/t.height,width:(i-r)/t.width,height:(o-a)/t.height}}}function IKe(e,t,n){return new Promise(r=>e.toBlob(r,t,n))}function d4({src:e,path:t,className:n,controllerRef:r,"data-testid":i}){let a=(0,V.useRef)(null),o=(0,V.useRef)(null),s=(0,V.useRef)(null),[c,l]=(0,V.useState)(1),[u,d]=(0,V.useState)(c4),[f,p]=(0,V.useState)();return(0,V.useEffect)(()=>{let t=!1,n;return pO(async()=>{let{getDocument:e}=await import(`./webpack-D_Ha02Xw.js`);return{getDocument:e}},[]).then(({getDocument:r})=>{if(!t)return n=r({url:e}),n.promise.then(e=>{t||(o.current=e,p(void 0),l(1),d({...c4,pageCount:e.numPages}))})}).catch(e=>{t||p(e instanceof Error?e.message:String(e))}),()=>{t=!0,n?.destroy(),s.current?.cancel(),s.current=null,o.current=null}},[e]),(0,V.useEffect)(()=>{let e=o.current,t=a.current;if(e===null||t===null)return;let n=!1;return e.getPage(c).then(r=>{if(n)return;let i=r.getViewport({scale:1}),a=r.getViewport({scale:1.5});t.width=Math.ceil(a.width),t.height=Math.ceil(a.height),d({page:c,pageCount:e.numPages,sourceWidth:i.width,sourceHeight:i.height});let o=t.getContext(`2d`);if(o===null)return;let l=r.render({canvas:t,canvasContext:o,viewport:a});return s.current=l,l.promise}).catch(e=>{!n&&e.name!==`RenderingCancelledException`&&p(e instanceof Error?e.message:String(e))}),()=>{n=!0,s.current?.cancel(),s.current=null}},[c,u.pageCount]),(0,V.useImperativeHandle)(r,()=>({getState:()=>u,setPage:e=>l(l4(e,u.pageCount)),resolveViewportRegion:e=>{let t=a.current;return t===null||u.pageCount===0?null:u4(u.page,t.getBoundingClientRect(),e)},capturePage:async(e=`image/png`,t)=>{let n=a.current;return n===null?null:await IKe(n,e,t)}}),[u]),(0,H.jsxs)(`section`,{"data-testid":i,"data-kind":`pdf`,className:J(`flex min-h-0 flex-col gap-2`,n),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm text-po-dim`,children:[(0,H.jsx)(`span`,{children:t}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Z,{size:`xs`,variant:`ghost`,disabled:c<=1,onClick:()=>l(e=>Math.max(1,e-1)),children:`previous`}),(0,H.jsx)(`span`,{"data-testid":i===void 0?void 0:`${i}-page`,children:u.pageCount===0?`loading`:`${c} / ${u.pageCount}`}),(0,H.jsx)(Z,{size:`xs`,variant:`ghost`,disabled:u.pageCount===0||c>=u.pageCount,onClick:()=>l(e=>l4(e+1,u.pageCount)),children:`next`})]})]}),f===void 0?null:(0,H.jsx)(`output`,{className:`text-sm text-po-red`,children:f}),(0,H.jsx)(`div`,{className:`min-h-0 overflow-auto rounded border border-po-border bg-po-deep`,children:(0,H.jsx)(`canvas`,{ref:a,"aria-label":t,className:`mx-auto block max-w-full`})})]})}function LKe(e,t){if(!Number.isFinite(e))throw RangeError(`Media seek time must be finite`);return Math.min(Math.max(e,0),Number.isFinite(t)&&t>=0?t:1/0)}var f4=`max-w-full rounded border border-po-border bg-po-deep`;function p4(e){return{playing:!e.paused&&!e.ended,currentTime:e.currentTime,duration:Number.isFinite(e.duration)?e.duration:0}}function RKe(e,t={current:void 0}){return{play:async()=>{let t=e.current;t!==null&&await t.play()},pause:()=>e.current?.pause(),seek:t=>{let n=e.current;n!==null&&(n.currentTime=LKe(t,n.duration))},getState:()=>{let t=e.current;return t===null?{playing:!1,currentTime:0,duration:0}:p4(t)},isFrameReady:()=>{let n=e.current;return n!==null&&!n.seeking&&n.readyState>=2&&(n.requestVideoFrameCallback===void 0||t.current!==void 0)},getIntrinsicSize:()=>{let t=e.current;return t===null||t.videoWidth<=0||t.videoHeight<=0?null:{width:t.videoWidth,height:t.videoHeight}},captureFrame:async(n=`image/png`,r)=>{let i=e.current;if(i===null||i.videoWidth<=0||i.videoHeight<=0||i.seeking)return null;let a=t.current===void 0?void 0:{...t.current},o=a?.mediaTime??i.currentTime,s=document.createElement(`canvas`);s.width=i.videoWidth,s.height=i.videoHeight;let c=s.getContext(`2d`);if(c===null)return null;c.drawImage(i,0,0,s.width,s.height);let l=await new Promise(e=>s.toBlob(e,n,r));return l===null?null:{blob:l,width:s.width,height:s.height,timeSeconds:o,...a===void 0?{}:{metadata:a}}}}}function zKe({src:e,className:t,testId:n,controllerRef:r,onPlaybackStateChange:i,videoControls:a=!0}){let o=(0,V.useRef)(null),s=(0,V.useRef)(void 0),c=()=>{let e=o.current;e!==null&&i?.(p4(e))},l=(0,V.useRef)(c);return(0,V.useEffect)(()=>{l.current=c}),(0,V.useImperativeHandle)(r,()=>RKe(o,s),[]),(0,V.useEffect)(()=>{let e=o.current;if(e===null||e.requestVideoFrameCallback===void 0)return;let t=0,n=(r,i)=>{s.current={mediaTime:i.mediaTime,...Number.isFinite(i.presentedFrames)?{presentedFrames:i.presentedFrames}:{}},l.current(),t=e.requestVideoFrameCallback(n)};return t=e.requestVideoFrameCallback(n),()=>e.cancelVideoFrameCallback(t)},[]),(0,H.jsx)(`video`,{ref:o,src:e,controls:a,playsInline:!0,preload:`metadata`,"data-testid":n,"data-kind":`video`,className:J(f4,`max-h-[36rem]`,t),onPlay:c,onPause:c,onTimeUpdate:c,onDurationChange:c,onEnded:c,onLoadedMetadata:c,onLoadedData:c,onSeeking:()=>{s.current=void 0,c()},onSeeked:c,children:(0,H.jsx)(`track`,{kind:`captions`})})}function BKe({src:e,path:t,kind:n,contentType:r,className:i,controllerRef:a,pdfControllerRef:o,onPlaybackStateChange:s,videoControls:c,"data-testid":l}){let u=n??s4(t),d=t.split(`/`).at(-1)??t;if(u===`image`){let n=/^image\/(?:avif|bmp|gif|jpeg|png|webp)$/i.test(r??``),a=(0,H.jsx)(`img`,{src:e,alt:t,className:J(f4,`max-h-[36rem]`,i)});return n?(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,"data-testid":l,"data-kind":u,children:a}):(0,H.jsx)(`span`,{"data-testid":l,"data-kind":u,children:a})}return u===`video`?(0,H.jsx)(zKe,{src:e,className:i,controllerRef:a,onPlaybackStateChange:s,testId:l,videoControls:c}):u===`pdf`?(0,H.jsx)(d4,{src:e,path:t,controllerRef:o,"data-testid":l,className:i}):(0,H.jsx)(XK,{asChild:!0,size:`md`,"data-testid":l,"data-kind":u,className:J(`self-start bg-po-panel text-po-text hover:border-po-blue/50`,i),children:(0,H.jsxs)(`a`,{href:e,download:d,children:[(0,H.jsx)(rR,{className:`h-3 w-3 shrink-0 text-po-faint`}),`download `,d]})})}var m4=UK(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-sm font-semibold`,{variants:{tone:{neutral:`bg-po-panel text-po-faint`,running:`bg-po-tint-yellow text-po-yellow`,ok:`bg-po-tint-green text-po-green`,error:`bg-po-tint-red text-po-red`,info:`bg-po-tint-blue text-po-blue`,accent:`bg-po-tint-magenta text-po-magenta`},size:{xs:`px-1.5 py-px text-sm`,sm:`px-[7px] py-[3px] text-sm`,md:`h-[21px] px-2 text-sm normal-case`,lg:`h-6 px-2.5 text-base normal-case`}},defaultVariants:{tone:`neutral`,size:`sm`}}),h4={neutral:`border-po-border`,running:`border-po-edge-yellow`,ok:`border-po-edge-green`,error:`border-po-edge-red`,info:`border-po-edge-blue`,accent:`border-po-edge-magenta`};function g4({className:e,tone:t,size:n,asChild:r=!1,...i}){let a=r?tz:`span`;return(0,H.jsx)(a,{"data-slot":`status-badge`,className:J(m4({tone:t,size:n}),e),...i})}var _4=(0,V.createContext)(null),VKe=(0,V.createContext)({tone:`neutral`,expandable:!1,expanded:!1,toggle:()=>void 0}),HKe=(0,V.createContext)(!1);function v4(){return(0,V.useContext)(VKe)}var y4=(0,V.createContext)(null),UKe=UK(`overflow-hidden rounded-lg border transition-colors`,{variants:{tone:{...h4,ok:`border-po-border-soft`}},defaultVariants:{tone:`neutral`}}),WKe=UK(`overflow-hidden border-l-2 transition-colors`,{variants:{tone:{...h4,ok:`border-transparent`,neutral:`border-transparent`}},defaultVariants:{tone:`neutral`}});function GKe({title:e,children:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`grid size-9 shrink-0 place-items-center rounded-full bg-po-rail text-po-dim max-sm:hidden`,children:(0,H.jsx)(iSe,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`Tool call`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-base`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-po-hi`,children:e}),(0,H.jsx)(`div`,{"data-slot":`message-item-summary`,className:`flex min-w-0 flex-1 items-center gap-2 overflow-hidden`,children:t})]})]})]})}function b4({className:e,tone:t,expandable:n=!1,defaultExpanded:r=!1,expanded:i,onExpandedChange:a,children:o,...s}){let[c,l]=(0,V.useState)(r),u=(0,V.useContext)(y4),d=(0,V.useContext)(_4),f=u!==null,p=(0,V.useContext)(HKe)&&!f,m=i??c,h={tone:t??`neutral`,headerAccessory:d,expandable:n,expanded:m,nested:p,toggle:()=>{let e=!m;i===void 0&&l(e),a?.(e)}};return(0,H.jsx)(VKe.Provider,{value:h,children:(0,H.jsx)(_4,{value:null,children:(0,H.jsx)(HKe,{value:!0,children:(0,H.jsx)(`div`,{"data-slot":`message-item`,"data-expanded":m,"data-grouped":f,"data-nested":p,className:J(f?WKe({tone:t}):p?`min-w-0`:UKe({tone:t}),e),...s,children:typeof o==`function`?o(h):o})})})})}function KKe({className:e,tone:t,title:n,summary:r,badge:i,children:a,defaultExpanded:o=!1,...s}){return(0,H.jsx)(b4,{tone:t,expandable:!0,defaultExpanded:o,className:e,"data-slot":`message-item-group`,...s,children:({expanded:e})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S4,{title:n,badge:i,children:(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-po-faint`,children:r})}),e?(0,H.jsx)(y4.Provider,{value:{tone:t??`neutral`},children:(0,H.jsx)(`div`,{className:`flex flex-col divide-y divide-po-border-soft border-t border-po-border-soft`,children:a})}):null]})})}function qKe(e){return e.running?`running`:e.isError?`error`:`ok`}var JKe={neutral:``,running:`Running`,ok:`Completed`,error:`Failed`,info:`Info`,accent:`Note`},x4={running:(0,H.jsx)(yR,{"aria-hidden":!0,className:`size-3 animate-spin`}),ok:(0,H.jsx)(LL,{"aria-hidden":!0,className:`size-3`}),error:(0,H.jsx)(GL,{"aria-hidden":!0,className:`size-3`})};function YKe({tone:e,children:t,...n}){return(0,H.jsxs)(g4,{tone:e,size:`md`,className:`gap-1 font-semibold`,...n,children:[x4[e],(0,H.jsx)(`span`,{className:x4[e]?`max-sm:sr-only`:void 0,children:t})]})}var XKe=new Set([`ok`,`neutral`]);function S4({className:e,title:t,badge:n,children:r,...i}){let{headerAccessory:a,tone:o,expandable:s,expanded:c,toggle:l,nested:u}=v4(),d=(0,V.useContext)(y4),f=d!==null&&XKe.has(o)?null:JKe[o],p=n===void 0?f:n;return(0,H.jsxs)(`div`,{"data-slot":`message-item-header`,className:J(`flex min-h-11 items-center gap-3 px-4 py-3 text-sm text-po-dim`,u&&`min-h-9 px-0 py-0`,e),...i,children:[d===null?u?(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 text-base`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-po-hi`,children:t}),(0,H.jsx)(`div`,{"data-slot":`message-item-summary`,className:`flex min-w-0 flex-1 items-center gap-2 overflow-hidden`,children:r})]}):(0,H.jsx)(GKe,{title:t,children:r}):(0,H.jsx)(`div`,{"data-slot":`message-item-summary`,className:`flex min-w-0 flex-1 items-center gap-2`,children:r}),a,p===null||p===``?null:u&&x4[o]?(0,H.jsxs)(`span`,{"data-testid":`tool-status`,className:J(C4({tone:o}),`flex w-3 justify-center`),children:[x4[o],(0,H.jsx)(`span`,{className:`sr-only`,children:p})]}):(0,H.jsx)(YKe,{tone:o,"data-testid":`tool-status`,children:p}),s?(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`tool-expand`,"aria-expanded":c,"aria-label":c?`collapse`:`expand`,onClick:l,className:`text-po-dim hover:text-po-blue`,children:(0,H.jsx)(c?UL:zL,{className:`size-4`})}):null]})}function ZKe({className:e,...t}){let{nested:n}=v4();return(0,H.jsx)(`div`,{"data-slot":`message-item-body`,className:J(`border-t border-po-border-soft px-4 py-3 text-base text-po-dim`,n&&`border-t-0 px-0 py-1`,e),...t})}var QKe={neutral:`…`,running:`◐`,ok:`✓`,error:`✗`,info:`●`,accent:`●`},C4=UK(`shrink-0`,{variants:{tone:{neutral:`text-po-faint`,running:`text-po-yellow`,ok:`text-po-green`,error:`text-po-red`,info:`text-po-blue`,accent:`text-po-magenta`}},defaultVariants:{tone:`neutral`}});function $Ke({className:e,tone:t,glyph:n,expands:r=!1,children:i,...a}){let{toggle:o}=v4(),s=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:C4({tone:t}),children:n??QKe[t??`neutral`]}),(0,H.jsx)(`span`,{children:i})]});return r?(0,H.jsx)(`button`,{type:`button`,"data-slot":`message-item-status`,"data-testid":`tool-more`,onClick:o,className:J(`flex min-h-6 min-w-6 cursor-pointer items-center gap-1.5 text-po-faint hover:text-po-blue`,e),children:s}):(0,H.jsx)(`span`,{"data-slot":`message-item-status`,className:J(`flex items-center gap-1.5 text-po-faint`,e),...a,children:s})}var eqe=UK(`whitespace-pre-wrap break-words`,{variants:{tone:{hi:`text-po-hi`,text:`text-po-text`,dim:`text-po-dim`,muted:`text-po-faint`,success:`text-po-green`,error:`text-po-red`,warning:`text-po-yellow`,accent:`text-po-blue`},bold:{true:`font-bold`,false:``},indent:{true:`pl-4`,false:``}},defaultVariants:{tone:`dim`,bold:!1,indent:!1}});function tqe({className:e,lines:t,...n}){return(0,H.jsx)(`div`,{"data-slot":`message-lines`,className:J(`flex flex-col gap-0.5`,e),...n,children:t.map((e,t)=>(0,H.jsx)(`div`,{className:eqe({tone:e.tone,bold:e.bold===!0,indent:e.indent===!0}),children:e.text},`${String(t)}-${e.text}`))})}function w4({className:e,asChild:t=!1,...n}){let r=t?tz:`div`;return(0,H.jsx)(r,{"data-slot":`panel`,className:J(`overflow-hidden rounded-md border border-po-border bg-po-panel`,e),...n})}function nqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`panel-header`,className:J(`flex min-h-8 items-center gap-2 px-[11px]`,e),...t})}function rqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`panel-body`,className:J(`border-t border-po-border-soft bg-po-deep px-3 py-2 text-sm text-po-dim`,e),...t})}function T4(e){return(0,H.jsx)(_ke,{"data-slot":`popover`,...e})}function E4(e){return(0,H.jsx)(xke,{"data-slot":`popover-trigger`,...e})}function D4(e){return(0,H.jsx)(yke,{"data-slot":`popover-anchor`,...e})}function iqe(e){return(0,H.jsx)(Ake,{"data-slot":`popover-close`,...e})}function O4({className:e,align:t=`start`,sideOffset:n=6,...r}){return(0,H.jsx)(wke,{children:(0,H.jsx)(Tke,{"data-slot":`popover-content`,align:t,sideOffset:n,className:J(`z-50 flex max-w-[calc(100vw-24px)] flex-col overflow-hidden rounded-lg border border-po-border bg-po-panel shadow-2xl outline-none data-[state=open]:animate-po-rise`,e),...r})})}function aqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`popover-header`,className:J(`flex h-[34px] shrink-0 items-center justify-between gap-3 border-b border-po-border-soft bg-po-deep px-3`,e),...t})}function k4({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`popover-footer`,className:J(`flex min-h-[30px] shrink-0 items-center justify-between gap-3 border-t border-po-border-soft bg-po-deep px-3 text-sm text-po-dim`,e),...t})}function oqe(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>`${e.title} ${e.subtitle??``} ${e.value}`.toLowerCase().includes(n))}function sqe(e,t){return Math.max(0,e.findIndex(e=>t.includes(e.value)))}function cqe(e,t){let n=new Set(e);return n.delete(t)||n.add(t),n}function lqe(e,t){return e.size!==t.length||t.some(t=>!e.has(t))}function uqe(e,t){return e.filter(e=>t.has(e.value)).map(e=>e.value)}function dqe(e,t){return e?t?`enter toggles · tab to Apply`:`1-9, space or enter toggles · tab to Apply`:t?`type to filter · enter picks`:`1-9 or enter picks`}function fqe(e,t){let{count:n,cursor:r,multiple:i,filterable:a}=t;if(e===`ArrowDown`||e===`ArrowUp`)return n===0?null:{kind:`move`,cursor:(r+(e===`ArrowDown`?1:-1)+n)%n};if(e===`Enter`)return n===0?null:{kind:`pick`,index:r};if(a)return null;if(e===` `&&i)return n===0?null:{kind:`pick`,index:r};let o=Number.parseInt(e,10)-1;return!Number.isInteger(o)||o<0||o>=Math.min(n,9)?null:{kind:`pick`,index:o}}function A4({title:e,meta:t,items:n,value:r,multiple:i=!1,actions:a=!1,onSelect:o,onApply:s,onCancel:c,filterable:l=n.length>9,filterPlaceholder:u=`Filter`,filterProps:d,loading:f,footer:p,className:m,onKeyDown:h,...g}){let[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(()=>new Set(r)),x=oqe(n,_),[S,C]=(0,V.useState)(()=>sqe(n,r)),w=Math.min(S,Math.max(0,x.length-1)),[T,E]=(0,V.useState)(null),D=(0,V.useId)(),O=(0,V.useId)(),k=x.length>0?`${D}-${String(w)}`:void 0;(0,V.useEffect)(()=>{let e=T?.children[w];T!==null&&e!==void 0&&(e.offsetTop<T.scrollTop?T.scrollTo({top:e.offsetTop-6}):e.offsetTop+e.offsetHeight>T.scrollTop+T.clientHeight&&T.scrollTo({top:e.offsetTop+e.offsetHeight-T.clientHeight+6}))},[w,T]);let A=e=>i?y.has(e.value):r.includes(e.value),j=i&&lqe(y,r),M=e=>{e!==void 0&&e.disabledReason===void 0&&(i?b(t=>cqe(t,e.value)):o?.(e.value))},N=()=>s?.(uqe(n,y)),P=e=>{if(h?.(e),e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||e.nativeEvent.isComposing)return;let t=e.target;if(t.closest(`[data-slot="picker-slot"], [data-slot="popover-footer"]`)||t.closest(`[data-slot="picker-item"]`)&&(e.key===`Enter`||e.key===` `))return;let n=fqe(e.key,{count:x.length,cursor:w,multiple:i,filterable:l});n!==null&&(e.preventDefault(),e.stopPropagation(),n.kind===`move`?(C(n.cursor),t.closest(`[data-slot="picker-item"]`)&&(T?.children[n.cursor])?.focus()):(C(n.index),M(x[n.index])))},ee=a?`enter opens`:dqe(i,l);return(0,H.jsxs)(O4,{side:`top`,"data-slot":`picker`,onKeyDown:P,className:J(`w-[400px]`,m),...g,children:[(0,H.jsxs)(aqe,{className:`h-10 bg-po-panel`,children:[(0,H.jsx)(`span`,{id:O,"data-slot":`picker-title`,className:`truncate text-base font-semibold text-po-hi`,children:e}),t===void 0?null:(0,H.jsx)(`span`,{"data-slot":`picker-meta`,className:`min-w-0 truncate text-sm text-po-dim`,children:t})]}),l?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-po-border-soft px-3`,children:[(0,H.jsx)(wR,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-po-faint`}),(0,H.jsx)(zq,{variant:`bare`,"data-slot":`picker-filter`,role:a?`searchbox`:`combobox`,"aria-expanded":!a||void 0,"aria-controls":D,"aria-haspopup":a?void 0:`listbox`,"aria-autocomplete":a?void 0:`list`,"aria-activedescendant":k,"aria-label":u,autoFocus:!0,value:_,placeholder:u,onChange:e=>{v(e.target.value),C(0)},className:`h-9 w-full`,...d})]}):null,(0,H.jsxs)(`div`,{ref:E,id:D,role:a?`menu`:`listbox`,"aria-labelledby":O,"aria-multiselectable":a?void 0:i,"aria-activedescendant":l?void 0:k,tabIndex:l?void 0:0,"data-slot":`picker-list`,className:`relative flex max-h-80 min-h-0 flex-col gap-0.5 overflow-y-auto p-1.5`,children:[f!==void 0&&n.length===0?(0,H.jsx)(`div`,{className:`flex items-center gap-2 px-2.5 py-2 text-base text-po-dim`,children:f}):x.length===0?(0,H.jsx)(`div`,{className:`px-2.5 py-2 text-base text-po-dim`,children:`Nothing matches`}):null,x.map((e,t)=>{let n=A(e),r=e.disabledReason!==void 0;return(0,H.jsxs)(`button`,{type:`button`,id:`${D}-${String(t)}`,role:a?`menuitem`:`option`,tabIndex:-1,"data-slot":`picker-item`,"data-value":e.value,"data-cursor":t===w,"aria-selected":a?void 0:n,"aria-disabled":r,disabled:r,...e.props,title:e.disabledReason??e.subtitle,onMouseMove:()=>{t!==w&&C(t)},onClick:()=>{C(t),M(e)},className:J(`flex w-full shrink-0 cursor-pointer items-center gap-3 rounded-md px-2.5 py-2 text-left outline-none transition-colors`,t===w&&`bg-po-deep`,n&&`bg-po-tint-green`,n&&t===w&&`brightness-110`,r&&`cursor-not-allowed opacity-60`),children:[e.lead===void 0?null:(0,H.jsx)(`span`,{className:`flex shrink-0 items-center`,children:e.lead}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:J(`truncate text-base`,n?`font-semibold text-po-hi`:`font-medium text-po-text`),children:e.title}),e.disabledReason!==void 0||e.subtitle!==void 0?(0,H.jsx)(`span`,{className:`truncate text-sm text-po-dim`,children:e.disabledReason??e.subtitle}):null]}),e.trail===void 0?null:(0,H.jsx)(`span`,{className:`flex shrink-0 items-center text-sm text-po-dim`,children:e.trail}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:J(`flex size-4 shrink-0 items-center justify-center text-po-green`,!a&&(i?`rounded-sm border`:`rounded-full border`),!a&&(n?`border-po-green`:`border-po-border`),i&&n&&`bg-po-green text-po-on-selected`),children:a?(0,H.jsx)(`span`,{className:J(`size-1.5 rounded-full`,n?`bg-po-green`:`bg-po-faint`)}):i?n?(0,H.jsx)(LL,{className:`size-3`}):null:n?(0,H.jsx)(`span`,{className:`size-2 rounded-full bg-po-green`}):null})]},e.value)})]}),p===void 0?null:(0,H.jsx)(`div`,{"data-slot":`picker-slot`,className:`flex flex-col border-t border-po-border-soft`,children:p}),(0,H.jsxs)(k4,{className:`min-h-10`,children:[(0,H.jsxs)(`span`,{"data-slot":`picker-hint`,className:`flex min-w-0 items-center gap-1.5 truncate`,children:[ee,i?null:(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(k$,{children:`esc`}),` closes`]})]}),i?(0,H.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-slot":`picker-cancel`,onClick:c,children:`Cancel`}),(0,H.jsxs)(Z,{variant:`primary`,size:`sm`,"data-slot":`picker-apply`,disabled:!j,onClick:N,children:[`Apply`,y.size>0?` (${String(y.size)})`:``]})]}):null]})]})}function pqe({profiles:e,status:t,value:n,onChange:r,disabled:i,id:a,className:o}){let[s,c]=(0,V.useState)(!1),l=(0,V.useId)(),u=new Map(e.map(e=>[xO(e.name),e])),d=Vhe(e).map(e=>{let t=u.get(e.value);return{...e,...t?{lead:(0,H.jsx)(JK,{name:e.title,seed:t.name,image:CO(t.identity?.icon),size:`sm`})}:{},props:{"data-testid":`profile-option-${e.value}`}}});return(0,H.jsxs)(`div`,{"data-slot":`profile-picker`,"data-testid":`profile-picker`,className:J(`flex flex-col gap-1`,o),children:[(0,H.jsx)(`span`,{id:l,className:`text-base font-medium text-po-text`,children:`Profile (optional)`}),(0,H.jsxs)(T4,{open:s,onOpenChange:c,children:[(0,H.jsx)(E4,{asChild:!0,children:(0,H.jsxs)(Z,{id:a,variant:`outline`,"data-testid":`profile-picker-trigger`,"aria-haspopup":`listbox`,"aria-expanded":s,"aria-labelledby":l,disabled:i,className:`w-full justify-between px-2.5 text-po-text`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:Hhe(n,e)}),t===`loading`?(0,H.jsx)(nq,{className:`size-3 shrink-0`}):(0,H.jsx)(zL,{className:`size-3.5 shrink-0 opacity-60`})]})}),(0,H.jsx)(A4,{side:`bottom`,align:`start`,"data-testid":`profile-picker-list`,title:`Profile`,meta:t===`loading`?`loading`:`${String(e.length)} available`,items:d,value:[xO(n)],filterable:d.length>9,filterPlaceholder:`Filter profiles`,className:`w-[min(360px,calc(100vw-24px))]`,onSelect:e=>{r(zhe(e)),c(!1)}})]}),t===`loading`?(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Loading profiles…`}):t===`unavailable`?(0,H.jsxs)(`p`,{role:`status`,"data-testid":`profile-picker-note`,className:`text-sm text-po-dim`,children:[e.length===0?`Profiles could not be loaded.`:`Some profiles could not be loaded.`,` `,`You can still start a session without one.`]}):null]})}function mqe(e,t){let[n,r]=(0,V.useState)(),i=(0,V.useRef)(t);(0,V.useEffect)(()=>{i.current=t});let a=t!==void 0;if((0,V.useEffect)(()=>{if(!a)return;let t=new AbortController;return Khe(e=>i.current?.(e)??Promise.resolve(void 0),t.signal).then(t=>{t!==void 0&&r({key:e,state:t})}),()=>t.abort()},[e,a]),a)return n?.key===e?n.state:{status:`loading`,profiles:[]}}function hqe({label:e,since:t,...n}){let r=(0,V.useRef)(null),[i]=(0,V.useState)(Date.now);return(0,V.useEffect)(()=>{let n,i=()=>{let a=Date.now(),o=r.current?.firstChild;o&&(o.nodeValue=OO({label:e,since:t},a)),n=setTimeout(i,Jhe(t,a))};return i(),()=>clearTimeout(n)},[e,t]),(0,H.jsx)(`span`,{ref:r,"data-slot":`live-duration`,...n,children:OO({label:e,since:t},i)})}function gqe({className:e,value:t,...n}){return(0,H.jsx)(Ike,{"data-slot":`progress`,value:t,className:J(`relative h-1 w-full overflow-hidden rounded-full bg-po-deep`,e),...n,children:(0,H.jsx)(Rke,{"data-slot":`progress-indicator`,className:`h-full w-full flex-1 bg-po-blue transition-transform`,style:{transform:`translateX(-${String(100-(t??0))}%)`}})})}function j4({className:e,...t}){return(0,H.jsx)($ke,{"data-slot":`radio-group`,className:J(`flex flex-col gap-2`,e),...t})}function _qe({className:e,...t}){return(0,H.jsx)(MW,{"data-slot":`radio-group-item`,className:J(`flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-full border border-po-border bg-po-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-po-green/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-po-green`,e),...t,children:(0,H.jsx)(iAe,{"data-slot":`radio-group-indicator`,className:`block h-1.5 w-1.5 rounded-full bg-po-green`})})}function M4({className:e,...t}){return(0,H.jsx)(MW,{"data-slot":`radio-group-card`,className:J(`cursor-pointer rounded-md border border-po-border bg-po-panel p-2 text-left outline-none transition-colors hover:border-po-green/50 focus-visible:ring-2 focus-visible:ring-po-green/50 data-[state=checked]:border-po-green data-[state=checked]:bg-po-tint-green`,e),...t})}function N4({className:e,variant:t,size:n,...r}){return(0,H.jsx)(`textarea`,{"data-slot":`textarea`,className:J(`resize-none`,Rq({variant:t,size:n}),e),...r})}function vqe(e,t,n){if(e===void 0)return`no line anchor: this selection came from the rendered preview`;let r=n===`old`?`removed `:``;return t===void 0||t===e?`${r}line ${e}`:`${r}lines ${e} to ${t}`}function yqe({snippet:e,startLine:t,endLine:n,side:r,onSubmit:i,onCancel:a,testIdPrefix:o=`review-comment`}){let[s,c]=(0,V.useState)(``);return(0,H.jsxs)(`div`,{"data-testid":`${o}-draft`,className:`flex flex-col gap-1.5 border-t border-po-border p-2`,children:[(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:vqe(t,n,r)}),(0,H.jsx)(`pre`,{className:`max-h-24 overflow-y-auto whitespace-pre-wrap break-words rounded border border-po-border-soft bg-po-deep p-1.5 font-mono text-xs text-po-dim`,children:fO(e,8,600)}),(0,H.jsx)(N4,{"data-testid":`${o}-body`,value:s,rows:3,autoFocus:!0,placeholder:`what should change here?`,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Escape`&&a(),e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s.trim()!==``&&i(s))},className:`text-sm`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(Z,{variant:`outline`,size:`xs`,"data-testid":`${o}-add`,disabled:s.trim()===``,onClick:()=>i(s),children:`Add comment`}),(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,"data-testid":`${o}-cancel`,onClick:a,children:`Cancel`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`⌘⏎ to add`})]})]})}function bqe({className:e,children:t,...n}){return(0,H.jsxs)(cAe,{"data-slot":`scroll-area`,className:J(`relative overflow-hidden`,e),...n,children:[(0,H.jsx)(lAe,{"data-slot":`scroll-area-viewport`,className:`h-full w-full rounded-[inherit]`,children:t}),(0,H.jsx)(xqe,{}),(0,H.jsx)(bAe,{})]})}function xqe({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(fAe,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:J(`flex touch-none select-none`,t===`vertical`?`h-full w-2.5 p-px`:`h-2.5 flex-col p-px`,e),...n,children:(0,H.jsx)(vAe,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-po-border`})})}function P4({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`section-label`,className:J(`inline-block text-sm font-semibold text-po-dim first-letter:uppercase`,e),...t})}function F4(e){return(0,H.jsx)(MAe,{"data-slot":`select`,...e})}function I4(e){return(0,H.jsx)(ZAe,{"data-slot":`select-group`,...e})}function L4(e){return(0,H.jsx)(IAe,{"data-slot":`select-value`,...e})}function R4({className:e,children:t,...n}){return(0,H.jsxs)(PAe,{"data-slot":`select-trigger`,className:J(`flex h-7 cursor-pointer items-center justify-between gap-2 rounded border border-po-border bg-po-deep px-2.5 text-left text-base text-po-hi outline-none transition-colors hover:border-po-green/50 focus-visible:ring-2 focus-visible:ring-po-green/50 disabled:pointer-events-none disabled:opacity-40 data-[placeholder]:text-po-faint *:data-[slot=select-value]:truncate`,e),...n,children:[t,(0,H.jsx)(LAe,{asChild:!0,children:(0,H.jsx)(zL,{className:`h-3 w-3 shrink-0 text-po-faint`})})]})}function z4({className:e,position:t=`popper`,sideOffset:n=4,children:r,...i}){return(0,H.jsx)(BAe,{children:(0,H.jsx)(VAe,{"data-slot":`select-content`,position:t,sideOffset:n,className:J(`z-50 max-h-[320px] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded border border-po-border bg-po-panel shadow-xl outline-none data-[state=open]:animate-po-rise`,e),...i,children:(0,H.jsx)(JAe,{className:`p-1`,children:r})})})}function B4({className:e,...t}){return(0,H.jsx)($Ae,{"data-slot":`select-label`,className:J(`px-2 py-1 text-sm font-semibold text-po-dim first-letter:uppercase`,e),...t})}function V4({className:e,children:t,...n}){return(0,H.jsxs)(tje,{"data-slot":`select-item`,className:J(`relative flex cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-2 pl-7 text-base text-po-hi outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-40 data-[highlighted]:bg-po-deep`,e),...n,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex h-3 w-3 items-center justify-center`,children:(0,H.jsx)(ije,{children:(0,H.jsx)(LL,{className:`h-3 w-3 text-po-green`})})}),(0,H.jsx)(nje,{children:t})]})}function Sqe({className:e,...t}){return(0,H.jsx)(aje,{"data-slot":`select-separator`,className:J(`my-1 h-px bg-po-border-soft`,e),...t})}function H4({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,H.jsx)(uje,{"data-slot":`separator`,orientation:t,decorative:n,className:J(`shrink-0 bg-po-border-soft`,t===`vertical`?`h-full w-px`:`h-px w-full`,e),...r})}function U4({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`settings-page`,className:J(`flex min-w-0 flex-col gap-10`,e),...t})}function W4({className:e,...t}){return(0,H.jsx)(`header`,{"data-slot":`settings-header`,className:J(`flex min-w-0 flex-col gap-2`,e),...t})}function G4({className:e,children:t,...n}){return(0,H.jsx)(`h2`,{"data-slot":`settings-title`,className:J(`text-2xl font-semibold text-po-hi first-letter:uppercase`,e),...n,children:t})}function K4({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`settings-description`,className:J(`max-w-[60ch] text-base leading-relaxed text-po-dim first-letter:uppercase`,e),...t})}var Cqe=(0,V.createContext)(void 0);function q4({className:e,...t}){let n=(0,V.useId)();return(0,H.jsx)(Cqe.Provider,{value:n,children:(0,H.jsx)(`section`,{"data-slot":`settings-section`,"aria-labelledby":n,className:J(`flex min-w-0 flex-col gap-4`,e),...t})})}function J4({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`settings-section-header`,className:J(`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-end gap-x-4 gap-y-1`,e),...t})}function Y4({className:e,children:t,...n}){let r=(0,V.useContext)(Cqe);return(0,H.jsx)(`h3`,{"data-slot":`settings-section-title`,id:r,className:J(`text-lg font-semibold text-po-hi first-letter:uppercase`,e),...n,children:t})}function X4({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`settings-section-description`,className:J(`col-span-full row-start-2 max-w-[60ch] text-sm leading-relaxed text-po-dim first-letter:uppercase`,e),...t})}function Z4({className:e,...t}){return(0,H.jsx)(w4,{"data-slot":`settings-card`,className:J(`flex min-w-0 flex-col divide-y divide-po-border-soft rounded-lg`,e),...t})}function Q4({className:e,asChild:t=!1,changed:n=!1,...r}){let i=t?tz:`div`;return(0,H.jsx)(i,{"data-slot":`settings-row`,"data-changed":n||void 0,className:J(`relative flex min-w-0 flex-wrap items-center gap-x-6 gap-y-3 px-5 py-4`,n&&`before:absolute before:inset-y-4 before:left-0 before:w-0.5 before:rounded-r before:bg-po-green`,e),...r})}function $4({id:e,label:t,description:n,children:r,className:i,...a}){return(0,H.jsxs)(Q4,{className:i,...a,children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:(0,H.jsx)(`label`,{htmlFor:e,children:t})}),n===void 0?null:(0,H.jsx)(n3,{children:n})]}),(0,H.jsx)(`div`,{"data-slot":`settings-field-control`,className:`w-full sm:w-72 [&>*]:w-full`,children:r})]})}function e3({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`settings-row-text`,className:J(`flex min-w-0 flex-1 flex-col gap-0.5`,e),...t})}function t3({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`settings-row-title`,className:J(`block text-base font-medium text-po-hi first-letter:uppercase`,e),...t})}function n3({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`settings-row-description`,className:J(`block text-sm leading-relaxed text-po-dim first-letter:uppercase`,e),...t})}function r3({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`settings-note`,className:J(`text-sm leading-relaxed text-po-dim`,e),...t})}function i3({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`settings-actions`,className:J(`flex flex-wrap items-center gap-2`,e),...t})}function wqe(e){return(0,H.jsx)(XB,{"data-slot":`sheet`,...e})}function Tqe(e){return(0,H.jsx)(ZB,{"data-slot":`sheet-trigger`,...e})}function Eqe(e){return(0,H.jsx)(cV,{"data-slot":`sheet-close`,...e})}function Dqe({className:e,...t}){return(0,H.jsx)(nV,{"data-slot":`sheet-overlay`,className:J(`fixed inset-0 z-40 bg-po-deep/70 data-[state=open]:animate-po-fade`,e),...t})}var Oqe={right:`inset-y-0 right-0 border-l data-[state=open]:animate-po-slide-right`,left:`inset-y-0 left-0 border-r data-[state=open]:animate-po-slide-left`},kqe={sm:`w-[360px]`,md:`w-[440px]`,lg:`w-[560px]`};function Aqe({className:e,children:t,side:n=`right`,width:r=`md`,...i}){return(0,H.jsxs)(eV,{children:[(0,H.jsx)(Dqe,{}),(0,H.jsx)(iV,{"data-slot":`sheet-content`,"data-side":n,className:J(`fixed z-50 flex max-w-[calc(100vw-24px)] flex-col overflow-hidden border-po-border bg-po-rail shadow-2xl outline-none`,Oqe[n],kqe[r],e),...i,children:t})]})}function jqe({className:e,dismissible:t=!0,closeLabel:n=`close`,children:r,...i}){return(0,H.jsxs)(`div`,{"data-slot":`sheet-header`,className:J(`flex h-11 min-w-0 shrink-0 items-center gap-2.5 border-b border-po-border px-4`,e),...i,children:[r,t?(0,H.jsx)(cV,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"aria-label":n,className:`ml-auto text-po-faint hover:text-po-hi`,children:(0,H.jsx)(jR,{className:`h-3 w-3`})})}):null]})}function Mqe({className:e,...t}){return(0,H.jsx)(oV,{"data-slot":`sheet-title`,className:J(`truncate text-lg font-semibold text-po-hi`,e),...t})}function Nqe({className:e,...t}){return(0,H.jsx)(sV,{"data-slot":`sheet-description`,className:J(`text-sm leading-relaxed text-po-dim`,e),...t})}function Pqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`sheet-body`,className:J(`flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-4 py-3`,e),...t})}function Fqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`sheet-footer`,className:J(`flex min-h-[34px] shrink-0 flex-wrap items-center justify-between gap-2 border-t border-po-border-soft bg-po-deep px-4 py-1.5`,e),...t})}function Iqe({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`stream-cursor`,"aria-hidden":!0,className:J(`ml-0.5 inline-block h-3.5 w-2 translate-y-0.5 animate-po-blink bg-po-blue`,e),...t})}function a3({className:e,...t}){return(0,H.jsx)(_je,{"data-slot":`switch`,className:J(`inline-flex h-4 w-7 shrink-0 cursor-pointer items-center rounded-full border border-po-border bg-po-deep p-px outline-none transition-colors focus-visible:ring-2 focus-visible:ring-po-green/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-po-green data-[state=checked]:bg-po-tint-green`,e),...t,children:(0,H.jsx)(yje,{"data-slot":`switch-thumb`,className:`block h-3 w-3 rounded-full bg-po-faint transition-transform data-[state=checked]:translate-x-3 data-[state=checked]:bg-po-green`})})}var o3=UK(`flex min-h-6 min-w-6 cursor-pointer items-center gap-1.5 rounded px-2 py-1 text-base font-medium transition-colors outline-none`,{variants:{active:{true:`bg-po-tint-green font-semibold text-po-green`,false:`text-po-dim hover:bg-po-panel hover:text-po-hi`}},defaultVariants:{active:!1}}),Lqe=UK(`flex h-[15px] min-w-[15px] items-center justify-center rounded-full px-1 text-2xs font-semibold`,{variants:{active:{true:`bg-po-green text-po-rail`,false:`bg-po-panel text-po-dim`},ask:{true:`bg-po-magenta text-po-bg`}},defaultVariants:{active:!1}});function s3({className:e,active:t,asChild:n=!1,...r}){let i=n?tz:`a`;return(0,H.jsx)(i,{"data-slot":`nav-tab`,"data-active":t??!1,className:J(o3({active:t}),e),...r})}function c3({className:e,active:t,ask:n,...r}){return(0,H.jsx)(`span`,{"data-slot":`nav-tab-badge`,className:J(Lqe({active:t,ask:n}),e),...r})}function l3(e){return(0,H.jsx)(Eje,{"data-slot":`tabs`,...e})}function u3({className:e,...t}){return(0,H.jsx)(Oje,{"data-slot":`tabs-list`,className:J(`flex items-center gap-1`,e),...t})}function d3({className:e,...t}){return(0,H.jsx)(Aje,{"data-slot":`tabs-trigger`,className:J(o3({active:!1}),`data-[state=active]:bg-po-tint-green data-[state=active]:font-semibold data-[state=active]:text-po-green`,e),...t})}function Rqe({className:e,...t}){return(0,H.jsx)(Mje,{"data-slot":`tabs-content`,className:J(`min-h-0 flex-1`,e),...t})}function f3(e,t){return getComputedStyle(e).getPropertyValue(eI(t)).trim()}function zqe({onData:e,onReady:t,ref:n,fontSize:r=11,className:i,...a}){let o=(0,V.useRef)(null),s=(0,V.useRef)(void 0),c=(0,V.useRef)(e),[l,u]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{c.current=e}),(0,V.useImperativeHandle)(n,()=>({write:e=>s.current?.write(e),reset:()=>s.current?.reset()})),(0,V.useEffect)(()=>{let e=o.current;if(e===null)return;let n=!1,i=()=>void 0;return(async()=>{let[{Terminal:a}]=await Promise.all([pO(()=>import(`./xterm-CerOhKYV.js`),[]),pO(()=>Promise.resolve({}),__vite__mapDeps([32]))]);if(n)return;let o=new a({cursorBlink:!0,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:r,allowTransparency:!0,theme:{background:f3(e,`deep`),foreground:f3(e,`dim`),cursor:f3(e,`hi`),selectionBackground:f3(e,`selected`)}});o.open(e),o.onData(e=>c.current?.(e)),s.current={write:e=>o.write(e),reset:()=>o.reset()},u(!0),t?.(),i=()=>{s.current=void 0,o.dispose()}})(),()=>{n=!0,i()}},[]),(0,H.jsx)(`div`,{ref:o,"data-slot":`terminal-view`,"data-ready":l,className:J(`h-full min-w-0 w-full overflow-auto`,i),...a})}function Bqe(e){return(0,H.jsx)(Lje,{...e})}function Vqe({className:e,...t}){return(0,H.jsx)(Bje,{"data-slot":`toast-viewport`,className:J(`fixed right-4 bottom-4 z-50 flex w-[360px] max-w-full flex-col gap-2 outline-none`,e),...t})}var Hqe=UK(`flex items-start gap-3 rounded-md border bg-po-panel px-3 py-2.5 shadow-2xl data-[state=open]:animate-po-rise`,{variants:{tone:{neutral:`border-po-border`,running:`border-po-edge-yellow`,ok:`border-po-edge-green`,error:`border-po-edge-red`,info:`border-po-edge-blue`,accent:`border-po-edge-magenta`}},defaultVariants:{tone:`neutral`}});function Uqe({className:e,tone:t,...n}){return(0,H.jsx)(Kje,{"data-slot":`toast`,className:J(Hqe({tone:t}),e),...n})}function Wqe({className:e,...t}){return(0,H.jsx)(Zje,{"data-slot":`toast-title`,className:J(`text-base font-semibold text-po-hi`,e),...t})}function Gqe({className:e,...t}){return(0,H.jsx)(Qje,{"data-slot":`toast-description`,className:J(`text-sm leading-relaxed text-po-dim`,e),...t})}function Kqe(e){return(0,H.jsx)(eMe,{"data-slot":`toast-action`,...e})}function qqe({className:e,...t}){return(0,H.jsx)(oK,{"data-slot":`toast-close`,"aria-label":`dismiss`,className:J(`inline-flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-po-faint transition-colors hover:text-po-hi`,e),...t,children:(0,H.jsx)(jR,{className:`h-3 w-3`})})}var Jqe=/(?<![\w./:~-])\/(?:[^\s"'`<>()[\]{}/]+\/)*[^\s"'`<>()[\]{}/]+\.[A-Za-z\d]+(?![\w/])/gu;function Yqe({text:e,onFileLink:t}){if(t===void 0)return e;let n=[],r=0;for(let i of e.matchAll(Jqe)){let a=t(i[0],!0);a!==void 0&&(n.push(e.slice(r,i.index),(0,H.jsx)(`button`,{type:`button`,"data-testid":`path-text-link`,title:`open ${i[0]}`,onClick:a,className:`cursor-pointer break-all text-left text-po-blue underline decoration-po-blue/50 hover:text-po-hi`,children:i[0]},i.index)),r=i.index+i[0].length)}return r===0?e:(n.push(e.slice(r)),(0,H.jsx)(H.Fragment,{children:n}))}function Xqe({path:e,onOpen:t,className:n,"data-testid":r=`tool-path`,...i}){return t===void 0?(0,H.jsx)(`span`,{"data-slot":`tool-path`,"data-testid":r,className:J(`inline-block max-w-full min-w-0 truncate align-bottom text-po-text`,n),...i,children:e}):(0,H.jsx)(`button`,{type:`button`,"data-slot":`tool-path`,"data-testid":r,title:`open ${e}`,onClick:t,className:J(`min-h-6 max-w-full min-w-0 cursor-pointer truncate text-left text-po-text hover:text-po-blue hover:underline`,n),...i,children:e})}function Zqe(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function Qqe(e,t){let n=e.split(`/`),r=t.split(`/`),i=[];for(let e=0;e<Math.min(n.length,r.length)&&n[e]===r[e];e+=1)i.push(n[e]);return i.join(`/`)}function $qe(e,t){let n=new Map;for(let r of e){let e=t(r),i=e.indexOf(`/`),a=i===-1?``:e.slice(0,i),o=n.get(a);o===void 0?n.set(a,[r]):o.push(r)}let r=[];for(let[e,i]of n){let n=[...i].sort((e,n)=>t(e).localeCompare(t(n))),a=e===``?``:n.map(e=>Zqe(t(e))).reduce(Qqe);r.push({prefix:a,items:n})}return r.sort((e,t)=>e.prefix.localeCompare(t.prefix))}function eJe(e,t){return e===``?t:t.slice(e.length+1)}var tJe={neutral:`neutral`,running:`yellow`,ok:`green`,error:`red`,info:`blue`,accent:`magenta`},nJe={neutral:`muted`,running:`yellow`,ok:`green`,error:`red`,info:`blue`,accent:`magenta`},rJe={neutral:`neutral`,blue:`info`,green:`ok`,yellow:`running`,red:`error`,magenta:`accent`,violet:`accent`,cyan:`info`,orange:`running`,teal:`info`},iJe={hi:`neutral`,text:`neutral`,dim:`neutral`,muted:`neutral`,success:`ok`,error:`error`,warning:`running`,accent:`info`},aJe=[`image`,`video`,`pdf`,`download`],p3=[`blue`,`green`,`yellow`,`red`,`magenta`,`violet`,`cyan`,`orange`,`teal`],oJe=[`neutral`,...p3],sJe=[`neutral`,`muted`,...p3],cJe=[`neutral`,`running`,`ok`,`error`,`info`,`accent`],lJe=[`hi`,`text`,`dim`,`muted`,`success`,`error`,`warning`,`accent`],uJe=t({ACCENT_TONES:()=>p3,Accordion:()=>NK,AccordionContent:()=>IK,AccordionItem:()=>PK,AccordionTrigger:()=>FK,ActivityIcon:()=>EL,AgentAvatar:()=>JK,AlertIcon:()=>GL,AnsiLine:()=>vMe,AnsiText:()=>yMe,AppWindowIcon:()=>Ybe,ArrowLeftIcon:()=>kL,ArrowRightIcon:()=>Xbe,AudioLinesIcon:()=>Zbe,Avatar:()=>RK,AvatarFallback:()=>BK,AvatarImage:()=>zK,BREADCRUMB_ELLIPSIS:()=>`…`,Badge:()=>XK,BellIcon:()=>NL,BookmarkPlusIcon:()=>Qbe,BranchIcon:()=>sR,Breadcrumb:()=>SMe,Button:()=>Z,CHIP_TONES:()=>oJe,CHIP_TO_STATUS:()=>rJe,CalendarIcon:()=>$be,CheckIcon:()=>LL,Checkbox:()=>Eq,ChevronDownIcon:()=>zL,ChevronRightIcon:()=>VL,ChevronUpIcon:()=>UL,CloseIcon:()=>jR,CodeBlock:()=>Iq,CodeEditor:()=>KMe,Collapsible:()=>qMe,CollapsibleContent:()=>YMe,CollapsibleTrigger:()=>JMe,CommandDialog:()=>XMe,CommandEmpty:()=>tJ,CommandFooter:()=>nJ,CommandGroup:()=>ZMe,CommandGroupLabel:()=>Qq,CommandHeader:()=>Yq,CommandInput:()=>Xq,CommandItem:()=>$q,CommandItemLabel:()=>eJ,CommandList:()=>Zq,CopyIcon:()=>YL,DOT_TONES:()=>sJe,Dialog:()=>aq,DialogBody:()=>fq,DialogClose:()=>wMe,DialogContent:()=>cq,DialogDescription:()=>dq,DialogFooter:()=>mq,DialogHeader:()=>lq,DialogTitle:()=>uq,DialogTrigger:()=>CMe,DiffView:()=>OMe,Dot:()=>GK,DownloadIcon:()=>rxe,Drawer:()=>kMe,DropdownMenu:()=>hq,DropdownMenuCheckboxItem:()=>jMe,DropdownMenuContent:()=>vq,DropdownMenuGroup:()=>AMe,DropdownMenuItem:()=>bq,DropdownMenuLabel:()=>wq,DropdownMenuRadioGroup:()=>Sq,DropdownMenuRadioItem:()=>Cq,DropdownMenuSeparator:()=>Tq,DropdownMenuShortcut:()=>FMe,DropdownMenuSub:()=>MMe,DropdownMenuSubContent:()=>PMe,DropdownMenuSubTrigger:()=>NMe,DropdownMenuTrigger:()=>gq,EditIcon:()=>Cxe,EmptyState:()=>rJ,EnterIcon:()=>nxe,ExternalLinkIcon:()=>tR,FileIcon:()=>rR,FlowGraph:()=>eBe,FolderIcon:()=>aR,ForkIcon:()=>lR,GREP_COLLAPSED_LINES:()=>15,GearIcon:()=>TR,GlobeIcon:()=>dR,GridIcon:()=>_R,HashlineLines:()=>rBe,HelpIcon:()=>txe,HomeIcon:()=>pR,ImageIcon:()=>hR,Input:()=>zq,Kbd:()=>k$,KebabIcon:()=>$L,LINE_TONE_TO_STATUS:()=>iJe,Label:()=>j$,LightbulbIcon:()=>ixe,ListIcon:()=>oxe,LiveDuration:()=>hqe,LoaderIcon:()=>yR,LockIcon:()=>bR,MAX_DIGIT_SHORTCUT:()=>9,MEDIA_KINDS:()=>aJe,MESSAGE_LINE_TONES:()=>lJe,Markdown:()=>a4,McpToolFields:()=>aBe,McpToolFrame:()=>iBe,McpToolOutput:()=>oBe,MediaPreview:()=>BKe,MediaViewerDialog:()=>N$,MenuIcon:()=>fxe,MessageIcon:()=>xR,MessageItem:()=>b4,MessageItemBody:()=>ZKe,MessageItemGroup:()=>KKe,MessageItemHeader:()=>S4,MessageItemHeaderAccessoryContext:()=>_4,MessageItemStatus:()=>$Ke,MessageLines:()=>tqe,MicIcon:()=>hxe,MonitorIcon:()=>_xe,NavTab:()=>s3,NavTabBadge:()=>c3,OptionLabel:()=>qq,OptionList:()=>Jq,OptionRow:()=>Kq,PaletteIcon:()=>yxe,Panel:()=>w4,PanelBody:()=>rqe,PanelHeader:()=>nqe,PaperclipIcon:()=>xxe,PathText:()=>Yqe,PdfPreview:()=>d4,PickerContent:()=>A4,PlayCircleIcon:()=>exe,PlusIcon:()=>SR,Popover:()=>T4,PopoverAnchor:()=>D4,PopoverClose:()=>iqe,PopoverContent:()=>O4,PopoverFooter:()=>k4,PopoverHeader:()=>aqe,PopoverTrigger:()=>E4,ProfilePicker:()=>pqe,Progress:()=>gqe,PuzzleIcon:()=>Exe,QuoteIcon:()=>Oxe,READ_COLLAPSED_LINES:()=>10,RadioGroup:()=>j4,RadioGroupCard:()=>M4,RadioGroupItem:()=>_qe,RefreshIcon:()=>CR,ReviewCommentDraft:()=>yqe,RewindIcon:()=>jxe,STATUS_EDGE:()=>h4,STATUS_GLYPH:()=>QKe,STATUS_LABEL:()=>JKe,STATUS_TONES:()=>cJe,STATUS_TO_CHIP:()=>tJe,STATUS_TO_DOT:()=>nJe,ScrollArea:()=>bqe,ScrollBar:()=>xqe,SearchIcon:()=>wR,SectionLabel:()=>P4,Select:()=>F4,SelectContent:()=>z4,SelectGroup:()=>I4,SelectItem:()=>V4,SelectLabel:()=>B4,SelectSeparator:()=>Sqe,SelectTrigger:()=>R4,SelectValue:()=>L4,SendIcon:()=>Pxe,Separator:()=>H4,ServerIcon:()=>Ixe,SettingsActions:()=>i3,SettingsCard:()=>Z4,SettingsDescription:()=>K4,SettingsField:()=>$4,SettingsHeader:()=>W4,SettingsNote:()=>r3,SettingsPage:()=>U4,SettingsRow:()=>Q4,SettingsRowDescription:()=>n3,SettingsRowText:()=>e3,SettingsRowTitle:()=>t3,SettingsSection:()=>q4,SettingsSectionDescription:()=>X4,SettingsSectionHeader:()=>J4,SettingsSectionTitle:()=>Y4,SettingsTitle:()=>G4,Sheet:()=>wqe,SheetBody:()=>Pqe,SheetClose:()=>Eqe,SheetContent:()=>Aqe,SheetDescription:()=>Nqe,SheetFooter:()=>Fqe,SheetHeader:()=>jqe,SheetOverlay:()=>Dqe,SheetTitle:()=>Mqe,SheetTrigger:()=>Tqe,ShieldIcon:()=>ER,ShrinkIcon:()=>Bxe,Skeleton:()=>Lq,SlidersIcon:()=>DR,SmartphoneIcon:()=>Uxe,SparklesIcon:()=>OR,Spinner:()=>nq,StatusBadge:()=>g4,StopIcon:()=>Jxe,StreamCursor:()=>Iqe,Switch:()=>a3,SyntaxLine:()=>Nq,SyntaxText:()=>Pq,Tabs:()=>l3,TabsContent:()=>Rqe,TabsList:()=>u3,TabsTrigger:()=>d3,TaskIcon:()=>Kxe,TerminalView:()=>zqe,Textarea:()=>N4,Toast:()=>Uqe,ToastAction:()=>Kqe,ToastClose:()=>qqe,ToastDescription:()=>Gqe,ToastProvider:()=>Bqe,ToastTitle:()=>Wqe,ToastViewport:()=>Vqe,ToolPathLink:()=>Xqe,Tooltip:()=>QK,TooltipContent:()=>eq,TooltipProvider:()=>ZK,TooltipTrigger:()=>$K,TrashIcon:()=>kR,UnlockIcon:()=>lxe,UserIcon:()=>AR,UsersIcon:()=>Qxe,ViewableImage:()=>o4,VolumeIcon:()=>eSe,WorkflowIcon:()=>nSe,WrenchIcon:()=>iSe,agentInitials:()=>KK,ansiSpans:()=>dO,badgeVariants:()=>YK,breadcrumbSegments:()=>tq,buildReviewPrompt:()=>fhe,buttonVariants:()=>rq,clockRefreshMs:()=>Jhe,clockText:()=>OO,cn:()=>J,collapseLines:()=>kO,compactDetails:()=>ige,defaultReviewHeading:()=>dhe,detectGrammar:()=>gO,dialogFooterVariants:()=>pq,diffGutterWidth:()=>che,diffRangeOf:()=>lhe,dotVariants:()=>WK,drawableImageUrl:()=>IMe,dropdownMenuItemVariants:()=>yq,fieldVariants:()=>Rq,formatRunDuration:()=>qhe,grammarKeyOf:()=>mO,groupByDirectory:()=>$qe,groupRowLabel:()=>eJe,handleOptionListKey:()=>Bq,hashlineBody:()=>rge,hashlineGroups:()=>Mhe,hashlineGroupsKey:()=>Nhe,highlightToLines:()=>bO,inlineProfileIcon:()=>CO,markdownMediaReview:()=>kq,markdownMediaReviewSlot:()=>Dq,mediaKindOf:()=>s4,messageItemRowVariants:()=>WKe,messageItemStatusVariants:()=>C4,messageItemVariants:()=>UKe,messageLineVariants:()=>eqe,optionListHint:()=>Vq,optionListVariants:()=>Uq,optionMarker:()=>Hq,optionMarkerVariants:()=>Gq,optionRowVariants:()=>Wq,parseFileHeader:()=>tge,parseProfileCatalog:()=>TO,parseTaggedLine:()=>ege,presentHashlineLines:()=>nge,resolvePdfViewportRegion:()=>u4,resultTextLines:()=>Qhe,reviewCommentAnchor:()=>uhe,statusBadgeVariants:()=>m4,svgImageUrl:()=>jq,syntaxStyleOf:()=>Ehe,tabBadgeVariants:()=>Lqe,tabVariants:()=>o3,takeTrailingNotice:()=>$he,toastVariants:()=>Hqe,toolTone:()=>qKe,trimSnippet:()=>fO,useMessageItem:()=>v4,useProfileCatalog:()=>mqe,useSyntaxLines:()=>Mq}),dJe={small:``,wide:`@min-[340px]:col-span-2`,tall:`row-span-2`,large:`row-span-2 @min-[340px]:col-span-2`};function fJe({tiles:e}){let t=e.some(e=>e.column!==void 0)?[{name:`main`,tiles:e.filter(e=>e.column!==`side`)},{name:`side`,tiles:e.filter(e=>e.column===`side`)}].filter(e=>e.tiles.length>0):void 0;return(0,H.jsx)(`div`,{className:`@container min-w-0`,children:(0,H.jsx)(`div`,{"data-testid":`dashboard-tile-grid`,className:t?t.length>1?`grid grid-cols-1 items-start gap-4 @min-[768px]:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`:`grid grid-cols-1 items-start gap-4`:`grid grid-cols-1 items-start gap-4 @min-[340px]:grid-cols-2 @min-[960px]:grid-cols-4`,children:t?t.map(e=>(0,H.jsx)(`div`,{"data-dashboard-column":e.name,className:`flex min-w-0 flex-col gap-4`,children:e.tiles.map(e=>(0,H.jsx)(pJe,{tile:e},e.id))},e.name)):e.map(e=>(0,H.jsx)(pJe,{tile:e,span:!0},e.id))})})}function pJe({tile:e,span:t=!1}){let{id:n,size:r=`small`,title:i,icon:a,body:o,onOpen:s,legacy:c=!1}=e;return(0,H.jsx)(`div`,{"data-tile-id":n,"data-tile-size":r,className:`min-w-0 empty:hidden ${t?dJe[r]:``}`,children:(0,H.jsx)(Mk,{toolName:n,children:e=>e?null:c?o:(0,H.jsxs)(w4,{className:`flex min-w-0 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-11 items-center gap-2 px-3 py-2`,children:[a?(0,H.jsx)(a,{"aria-hidden":!0,className:`size-4 shrink-0 text-po-dim`}):null,(0,H.jsx)(`h2`,{className:`min-w-0 flex-1 break-words text-base font-semibold text-po-hi`,children:i}),s?(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"aria-label":`Open ${i}`,onClick:s,children:(0,H.jsx)(VL,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,H.jsx)(`div`,{className:`min-w-0 border-t border-po-border-soft p-3`,children:o})]})})})}function m3({tiles:e,main:t=[],side:n=[],title:r=`Home`,emptyTitle:i=`Nothing on Home yet`,emptyDescription:a=`Apps you add show up here.`,onShowSessions:o,navigationToggle:s=`mobile`}){let c=e??[...t.map((e,t)=>({id:`main-${t}`,size:`wide`,body:e,legacy:!0})),...n.map((e,t)=>({id:`side-${t}`,size:`small`,body:e,legacy:!0}))];return(0,H.jsxs)(`section`,{"aria-label":r,"data-testid":`home-page`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto bg-po-bg font-sans text-base text-po-text`,children:[o?(0,H.jsx)(`div`,{className:`shrink-0 px-3 pt-2 ${s===`mobile`?`md:hidden`:``}`,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"data-testid":`mobile-sessions-open`,title:`Show sessions`,"aria-label":`Show sessions`,onClick:o,className:`text-po-dim`,children:(0,H.jsx)(aR,{className:`size-4`})})}):null,(0,H.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-6 px-4 py-6 md:px-8 md:py-8`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-semibold text-po-hi`,children:r}),c.length===0?(0,H.jsx)(rJ,{title:i,description:a}):(0,H.jsx)(fJe,{tiles:c})]})]})}function mJe({onShowSessions:e,navigationToggle:t}){let n=KI(null),r=[...ov({scope:`global`}),...Poe()].sort((e,t)=>e.order-t.order||e.pluginId.localeCompare(t.pluginId)||e.id.localeCompare(t.id)),i=av(s_.homeAttention).flatMap(e=>e.component===void 0?[]:[{id:JSON.stringify([e.pluginId,e.id]),size:`wide`,legacy:!0,body:(0,V.createElement)(e.component,n)}]);for(let e of r){let t=e.component;if(t===void 0)continue;let r=JSON.stringify([e.pluginId,e.id]),a=O_(e.data),o=a?.open,s=o?.kind===`page`?n.openPage:n.openSettings;i.push({id:r,size:a===null?e.data?.column===`side`?`small`:`wide`:a.size??`small`,...a===null?{legacy:!0}:{title:a.title,icon:a.icon,column:a.column},...o===void 0||s===void 0?{}:{onOpen:()=>s(o.id)},body:(0,V.createElement)(t,n)})}return(0,H.jsx)(m3,{tiles:i,...e===void 0?{}:{onShowSessions:e},...t===void 0?{}:{navigationToggle:t}})}function hJe({title:e,state:t=`ready`,error:n,tiles:r=[],...i}){let a={ready:[`Nothing in this workspace yet`,`Apps for this workspace will show up here.`],loading:[`Loading workspace`,`Your workspace is getting ready.`],missing:[`Workspace not found`,`This workspace may have been removed. Choose another from the session list.`],unavailable:[`Workspace unavailable`,`Po cannot open this workspace right now. Reconnect to its host and try again.`],error:[`Workspace apps could not load`,n??`Reconnect to this host and try again.`]};return(0,H.jsx)(m3,{...i,title:e,tiles:t===`ready`?r:[],emptyTitle:a[t][0],emptyDescription:a[t][1]})}function gJe({workspaceId:e,...t}){WI();let n=U(gP,t=>t.byId[e]),r=U(gP,e=>e.hydrated),i={scope:`workspace`,workspaceId:e},a=ok(i,U(tk,e=>e)),o=KI(null,void 0,void 0,e),s=ov(i).flatMap(e=>{if(e.component===void 0)return[];let t=e.data,n=t.open,r=n?.kind===`page`?o.openPage:o.openSettings;return[{id:JSON.stringify([e.pluginId,e.id]),title:t.title,icon:t.icon,size:t.size??`small`,column:t.column,...n===void 0||r===void 0?{}:{onOpen:()=>r(n.id)},body:(0,V.createElement)(e.component,o)}]}),c=r?n===void 0?`missing`:n.available===!1?`unavailable`:a.phase===`error`?`error`:a.phase===`ready`?`ready`:`loading`:`loading`;return(0,H.jsx)(hJe,{...t,title:n?.name??`Workspace`,state:c,error:a.error,tiles:s})}function _Je({size:e=24,className:t}){return(0,H.jsx)(`img`,{src:`/favicon.svg`,width:e,height:e,className:t,alt:``,"aria-hidden":`true`,draggable:!1})}function vJe({pageId:e,sessionId:t,workspaceId:n,onShowSessions:r,navigationToggle:i=`mobile`}){let a=KI(t,void 0,void 0,n),o=Pk(s_.page,t,n).find(t=>t.id===e);return(0,H.jsxs)(`div`,{"data-testid":`plugin-page-${e}`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[r?(0,H.jsx)(`div`,{className:`shrink-0 px-3 pt-2 ${i===`mobile`?`md:hidden`:``}`,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"data-testid":`mobile-sessions-open`,title:`Show sessions`,"aria-label":`Show sessions`,onClick:r,className:`text-po-dim`,children:(0,H.jsx)(aR,{className:`size-4`})})}):null,o?.component===void 0?(0,H.jsx)(rJ,{title:`This page is not available`,description:`The plugin that draws it is not installed here.`}):(0,V.createElement)(o.component,a)]})}function h3({slot:e,sessionId:t,sessionReservationId:n}){return(0,H.jsx)(H.Fragment,{children:KI(t,void 0,n).renderSlot(e)})}var yJe=4;function bJe({value:e,size:t=208,className:n,label:r}){let i=DA(e),a=i.length+8,o=i.flatMap((e,t)=>e.map((e,n)=>e?`M${String(n+yJe)} ${String(t+yJe)}h1v1h-1z`:``)).join(``);return(0,H.jsx)(`svg`,{viewBox:`0 0 ${String(a)} ${String(a)}`,width:t,height:t,className:J(`shrink-0`,n),role:`img`,"aria-label":r??`Pairing QR code`,shapeRendering:`crispEdges`,children:(0,H.jsx)(`path`,{d:o,fill:`currentColor`})})}var xJe=`load_context`,SJe=`load_extra_tools`,CJe=`use_extra_tools`;function wJe(e,t){return t?`${t}_${e}`:e}function TJe(e,t){let n=new Set(e.map(e=>e.name)),r=e=>wJe(e,t),i=[`Use the Po MCP tools below for work in the Po session repository. They run on the Po host, not on your local machine.`,`Prefer them over your built-in bash, read, edit, write, grep, find, or ls tools for that repository.`];return t&&i.push(`Every tool name starts with "${t}_".`),n.has(xJe)&&i.push(`Start each task with ${r(xJe)}.`),n.has(SJe)&&n.has(CJe)&&i.push(`${r(SJe)} lists tools added or changed after you connected. Run one of those with ${r(CJe)}, passing the exact name it returns.`),i.push(`If a tool below is not in your visible tool list, find it in ALL_TOOLS (code mode) before concluding it is missing; do not use tool search or guess names.`,`Await every call, print its result, and check isError. If a call may have changed files or state, inspect before retrying.`,``,`Tools:`,...e.map(e=>`- ${r(e.name)}: ${e.description.replace(/\s+/g,` `).trim()}`)),i.join(`
|
|
136
|
+
`)?t:void 0,a=i===void 0||e!==void 0?void 0:r?.(i);return a!==void 0&&i!==void 0?(0,H.jsx)(`button`,{type:`button`,"data-testid":`markdown-file-link`,title:`open ${i}`,onClick:a,className:`${n4} cursor-pointer underline decoration-po-green/40 underline-offset-2 hover:text-po-hi hover:decoration-po-hi`,children:i}):(0,H.jsx)(`code`,{...n,className:`${e??``} ${n4} [pre_&]:bg-transparent [pre_&]:p-0 [pre_&]:text-po-hi`,children:t})}function jKe({href:e,children:t}){let n=(0,V.useContext)(r4),r=e;try{r=e===void 0?void 0:decodeURIComponent(e)}catch{r=void 0}let i=r!==void 0&&r!==``&&!/^(?:[a-z][a-z\d+.-]*:|\/\/|#|\?)/i.test(r)?n?.(r,!0):void 0;return i===void 0?(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-po-blue underline decoration-po-blue/50`,children:t}):(0,H.jsx)(`button`,{type:`button`,"data-testid":`markdown-file-link`,title:`open ${r}`,onClick:i,className:`text-po-blue underline decoration-po-blue/50`,children:t})}function i4(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>i4(e)).join(``):``}function MKe({children:e}){let t=(0,V.isValidElement)(e)?e:void 0;return t===void 0?(0,H.jsx)(`pre`,{className:`overflow-x-auto rounded border border-po-border bg-po-deep p-2.5 text-sm leading-relaxed`,children:e}):(0,H.jsx)(Iq,{text:i4(t.props.children).replace(/\n$/,``),className:t.props.className})}var NKe={p:({children:e})=>(0,H.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:e}),strong:({children:e})=>(0,H.jsx)(`strong`,{className:`font-semibold text-po-hi`,children:e}),em:({children:e})=>(0,H.jsx)(`em`,{className:`italic`,children:e}),del:({children:e})=>(0,H.jsx)(`del`,{className:`text-po-dim line-through`,children:e}),a:jKe,code:AKe,pre:MKe,ul:({children:e})=>(0,H.jsx)(`ul`,{className:`list-disc pl-5`,children:e}),ol:({children:e})=>(0,H.jsx)(`ol`,{className:`list-decimal pl-5`,children:e}),li:({children:e})=>(0,H.jsx)(`li`,{className:`whitespace-pre-wrap break-words`,children:e}),h1:({children:e})=>(0,H.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold text-po-hi first:mt-0`,children:e}),h2:({children:e})=>(0,H.jsx)(`h2`,{className:`mt-2 text-xl font-semibold text-po-hi first:mt-0`,children:e}),h3:({children:e})=>(0,H.jsx)(`h3`,{className:`mt-1 text-lg font-semibold text-po-hi first:mt-0`,children:e}),h4:({children:e})=>(0,H.jsx)(`h4`,{className:`font-semibold text-po-hi`,children:e}),h5:({children:e})=>(0,H.jsx)(`h5`,{className:`font-semibold text-po-text`,children:e}),h6:({children:e})=>(0,H.jsx)(`h6`,{className:`font-semibold text-po-dim`,children:e}),blockquote:({children:e})=>(0,H.jsx)(`blockquote`,{className:`border-l-2 border-po-border pl-3 text-po-dim`,children:e}),hr:()=>(0,H.jsx)(`hr`,{className:`border-po-border-soft`}),table:({children:e})=>(0,H.jsx)(`div`,{className:`overflow-x-auto`,children:(0,H.jsx)(`table`,{className:`border-collapse`,children:e})}),th:({children:e})=>(0,H.jsx)(`th`,{className:`border border-po-border bg-po-deep px-2 py-1 text-left font-semibold text-po-hi`,children:e}),td:({children:e})=>(0,H.jsx)(`td`,{className:`border border-po-border px-2 py-1 align-top`,children:e}),img:kKe};function a4({text:e,onFileLink:t,loadImage:n,documentPath:r,renderMediaReview:i}){let[a,o]=(0,V.useState)(),s=(0,V.useMemo)(()=>({open:e=>o({...e,...r===void 0?{}:{documentPath:r}})}),[r]),c=()=>o(void 0);return(0,H.jsx)(r4.Provider,{value:t,children:(0,H.jsx)(OKe.Provider,{value:n,children:(0,H.jsxs)(Oq.Provider,{value:s,children:[(0,H.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:(0,H.jsx)(mWe,{remarkPlugins:DKe,components:NKe,urlTransform:(e,t,n)=>t===`src`&&n.tagName===`img`&&/^@?artifact:/u.test(e)?e:u2(e),children:e})}),(0,H.jsx)(N$,{media:a,onClose:c,review:a===void 0?void 0:i?.(a,c)})]})})})}function o4({src:e,alt:t,title:n,renderReview:r,...i}){let[a,o]=(0,V.useState)(),s=()=>o(void 0),c=n||t||`Image`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":`Open ${c} full screen`,onClick:()=>o({kind:`image`,title:c,url:e}),className:`max-w-full cursor-zoom-in self-start rounded focus-visible:ring-2 focus-visible:ring-po-blue focus-visible:outline-none`,children:(0,H.jsx)(`img`,{...i,src:e,alt:t})}),(0,H.jsx)(N$,{media:a,onClose:s,review:a===void 0?void 0:r?.(a,s)})]})}var PKe={avif:`image`,bmp:`image`,gif:`image`,ico:`image`,jpeg:`image`,jpg:`image`,png:`image`,svg:`image`,webp:`image`,m4v:`video`,mov:`video`,mp4:`video`,webm:`video`,pdf:`pdf`};function FKe(e){let t=e.split(`/`).at(-1)??``,n=t.lastIndexOf(`.`);return n<1?``:t.slice(n+1).toLowerCase()}function s4(e){return PKe[FKe(e)]??`download`}var c4={page:1,pageCount:0,sourceWidth:0,sourceHeight:0};function l4(e,t){return!Number.isFinite(e)||t<=0?1:Math.min(t,Math.max(1,Math.trunc(e)))}function u4(e,t,n){if(t.width<=0||t.height<=0)return null;let r=Math.max(t.left,Math.min(t.right,n.left)),i=Math.max(t.left,Math.min(t.right,n.right)),a=Math.max(t.top,Math.min(t.bottom,n.top)),o=Math.max(t.top,Math.min(t.bottom,n.bottom));return i<=r||o<=a?null:{page:e,rect:{x:(r-t.left)/t.width,y:(a-t.top)/t.height,width:(i-r)/t.width,height:(o-a)/t.height}}}function IKe(e,t,n){return new Promise(r=>e.toBlob(r,t,n))}function d4({src:e,path:t,className:n,controllerRef:r,"data-testid":i}){let a=(0,V.useRef)(null),o=(0,V.useRef)(null),s=(0,V.useRef)(null),[c,l]=(0,V.useState)(1),[u,d]=(0,V.useState)(c4),[f,p]=(0,V.useState)();return(0,V.useEffect)(()=>{let t=!1,n;return pO(async()=>{let{getDocument:e}=await import(`./webpack-C_MATgNb.js`);return{getDocument:e}},[]).then(({getDocument:r})=>{if(!t)return n=r({url:e}),n.promise.then(e=>{t||(o.current=e,p(void 0),l(1),d({...c4,pageCount:e.numPages}))})}).catch(e=>{t||p(e instanceof Error?e.message:String(e))}),()=>{t=!0,n?.destroy(),s.current?.cancel(),s.current=null,o.current=null}},[e]),(0,V.useEffect)(()=>{let e=o.current,t=a.current;if(e===null||t===null)return;let n=!1;return e.getPage(c).then(r=>{if(n)return;let i=r.getViewport({scale:1}),a=r.getViewport({scale:1.5});t.width=Math.ceil(a.width),t.height=Math.ceil(a.height),d({page:c,pageCount:e.numPages,sourceWidth:i.width,sourceHeight:i.height});let o=t.getContext(`2d`);if(o===null)return;let l=r.render({canvas:t,canvasContext:o,viewport:a});return s.current=l,l.promise}).catch(e=>{!n&&e.name!==`RenderingCancelledException`&&p(e instanceof Error?e.message:String(e))}),()=>{n=!0,s.current?.cancel(),s.current=null}},[c,u.pageCount]),(0,V.useImperativeHandle)(r,()=>({getState:()=>u,setPage:e=>l(l4(e,u.pageCount)),resolveViewportRegion:e=>{let t=a.current;return t===null||u.pageCount===0?null:u4(u.page,t.getBoundingClientRect(),e)},capturePage:async(e=`image/png`,t)=>{let n=a.current;return n===null?null:await IKe(n,e,t)}}),[u]),(0,H.jsxs)(`section`,{"data-testid":i,"data-kind":`pdf`,className:J(`flex min-h-0 flex-col gap-2`,n),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm text-po-dim`,children:[(0,H.jsx)(`span`,{children:t}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Z,{size:`xs`,variant:`ghost`,disabled:c<=1,onClick:()=>l(e=>Math.max(1,e-1)),children:`previous`}),(0,H.jsx)(`span`,{"data-testid":i===void 0?void 0:`${i}-page`,children:u.pageCount===0?`loading`:`${c} / ${u.pageCount}`}),(0,H.jsx)(Z,{size:`xs`,variant:`ghost`,disabled:u.pageCount===0||c>=u.pageCount,onClick:()=>l(e=>l4(e+1,u.pageCount)),children:`next`})]})]}),f===void 0?null:(0,H.jsx)(`output`,{className:`text-sm text-po-red`,children:f}),(0,H.jsx)(`div`,{className:`min-h-0 overflow-auto rounded border border-po-border bg-po-deep`,children:(0,H.jsx)(`canvas`,{ref:a,"aria-label":t,className:`mx-auto block max-w-full`})})]})}function LKe(e,t){if(!Number.isFinite(e))throw RangeError(`Media seek time must be finite`);return Math.min(Math.max(e,0),Number.isFinite(t)&&t>=0?t:1/0)}var f4=`max-w-full rounded border border-po-border bg-po-deep`;function p4(e){return{playing:!e.paused&&!e.ended,currentTime:e.currentTime,duration:Number.isFinite(e.duration)?e.duration:0}}function RKe(e,t={current:void 0}){return{play:async()=>{let t=e.current;t!==null&&await t.play()},pause:()=>e.current?.pause(),seek:t=>{let n=e.current;n!==null&&(n.currentTime=LKe(t,n.duration))},getState:()=>{let t=e.current;return t===null?{playing:!1,currentTime:0,duration:0}:p4(t)},isFrameReady:()=>{let n=e.current;return n!==null&&!n.seeking&&n.readyState>=2&&(n.requestVideoFrameCallback===void 0||t.current!==void 0)},getIntrinsicSize:()=>{let t=e.current;return t===null||t.videoWidth<=0||t.videoHeight<=0?null:{width:t.videoWidth,height:t.videoHeight}},captureFrame:async(n=`image/png`,r)=>{let i=e.current;if(i===null||i.videoWidth<=0||i.videoHeight<=0||i.seeking)return null;let a=t.current===void 0?void 0:{...t.current},o=a?.mediaTime??i.currentTime,s=document.createElement(`canvas`);s.width=i.videoWidth,s.height=i.videoHeight;let c=s.getContext(`2d`);if(c===null)return null;c.drawImage(i,0,0,s.width,s.height);let l=await new Promise(e=>s.toBlob(e,n,r));return l===null?null:{blob:l,width:s.width,height:s.height,timeSeconds:o,...a===void 0?{}:{metadata:a}}}}}function zKe({src:e,className:t,testId:n,controllerRef:r,onPlaybackStateChange:i,videoControls:a=!0}){let o=(0,V.useRef)(null),s=(0,V.useRef)(void 0),c=()=>{let e=o.current;e!==null&&i?.(p4(e))},l=(0,V.useRef)(c);return(0,V.useEffect)(()=>{l.current=c}),(0,V.useImperativeHandle)(r,()=>RKe(o,s),[]),(0,V.useEffect)(()=>{let e=o.current;if(e===null||e.requestVideoFrameCallback===void 0)return;let t=0,n=(r,i)=>{s.current={mediaTime:i.mediaTime,...Number.isFinite(i.presentedFrames)?{presentedFrames:i.presentedFrames}:{}},l.current(),t=e.requestVideoFrameCallback(n)};return t=e.requestVideoFrameCallback(n),()=>e.cancelVideoFrameCallback(t)},[]),(0,H.jsx)(`video`,{ref:o,src:e,controls:a,playsInline:!0,preload:`metadata`,"data-testid":n,"data-kind":`video`,className:J(f4,`max-h-[36rem]`,t),onPlay:c,onPause:c,onTimeUpdate:c,onDurationChange:c,onEnded:c,onLoadedMetadata:c,onLoadedData:c,onSeeking:()=>{s.current=void 0,c()},onSeeked:c,children:(0,H.jsx)(`track`,{kind:`captions`})})}function BKe({src:e,path:t,kind:n,contentType:r,className:i,controllerRef:a,pdfControllerRef:o,onPlaybackStateChange:s,videoControls:c,"data-testid":l}){let u=n??s4(t),d=t.split(`/`).at(-1)??t;if(u===`image`){let n=/^image\/(?:avif|bmp|gif|jpeg|png|webp)$/i.test(r??``),a=(0,H.jsx)(`img`,{src:e,alt:t,className:J(f4,`max-h-[36rem]`,i)});return n?(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,"data-testid":l,"data-kind":u,children:a}):(0,H.jsx)(`span`,{"data-testid":l,"data-kind":u,children:a})}return u===`video`?(0,H.jsx)(zKe,{src:e,className:i,controllerRef:a,onPlaybackStateChange:s,testId:l,videoControls:c}):u===`pdf`?(0,H.jsx)(d4,{src:e,path:t,controllerRef:o,"data-testid":l,className:i}):(0,H.jsx)(XK,{asChild:!0,size:`md`,"data-testid":l,"data-kind":u,className:J(`self-start bg-po-panel text-po-text hover:border-po-blue/50`,i),children:(0,H.jsxs)(`a`,{href:e,download:d,children:[(0,H.jsx)(rR,{className:`h-3 w-3 shrink-0 text-po-faint`}),`download `,d]})})}var m4=UK(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-sm font-semibold`,{variants:{tone:{neutral:`bg-po-panel text-po-faint`,running:`bg-po-tint-yellow text-po-yellow`,ok:`bg-po-tint-green text-po-green`,error:`bg-po-tint-red text-po-red`,info:`bg-po-tint-blue text-po-blue`,accent:`bg-po-tint-magenta text-po-magenta`},size:{xs:`px-1.5 py-px text-sm`,sm:`px-[7px] py-[3px] text-sm`,md:`h-[21px] px-2 text-sm normal-case`,lg:`h-6 px-2.5 text-base normal-case`}},defaultVariants:{tone:`neutral`,size:`sm`}}),h4={neutral:`border-po-border`,running:`border-po-edge-yellow`,ok:`border-po-edge-green`,error:`border-po-edge-red`,info:`border-po-edge-blue`,accent:`border-po-edge-magenta`};function g4({className:e,tone:t,size:n,asChild:r=!1,...i}){let a=r?tz:`span`;return(0,H.jsx)(a,{"data-slot":`status-badge`,className:J(m4({tone:t,size:n}),e),...i})}var _4=(0,V.createContext)(null),VKe=(0,V.createContext)({tone:`neutral`,expandable:!1,expanded:!1,toggle:()=>void 0}),HKe=(0,V.createContext)(!1);function v4(){return(0,V.useContext)(VKe)}var y4=(0,V.createContext)(null),UKe=UK(`overflow-hidden rounded-lg border transition-colors`,{variants:{tone:{...h4,ok:`border-po-border-soft`}},defaultVariants:{tone:`neutral`}}),WKe=UK(`overflow-hidden border-l-2 transition-colors`,{variants:{tone:{...h4,ok:`border-transparent`,neutral:`border-transparent`}},defaultVariants:{tone:`neutral`}});function GKe({title:e,children:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`grid size-9 shrink-0 place-items-center rounded-full bg-po-rail text-po-dim max-sm:hidden`,children:(0,H.jsx)(iSe,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`Tool call`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-base`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-po-hi`,children:e}),(0,H.jsx)(`div`,{"data-slot":`message-item-summary`,className:`flex min-w-0 flex-1 items-center gap-2 overflow-hidden`,children:t})]})]})]})}function b4({className:e,tone:t,expandable:n=!1,defaultExpanded:r=!1,expanded:i,onExpandedChange:a,children:o,...s}){let[c,l]=(0,V.useState)(r),u=(0,V.useContext)(y4),d=(0,V.useContext)(_4),f=u!==null,p=(0,V.useContext)(HKe)&&!f,m=i??c,h={tone:t??`neutral`,headerAccessory:d,expandable:n,expanded:m,nested:p,toggle:()=>{let e=!m;i===void 0&&l(e),a?.(e)}};return(0,H.jsx)(VKe.Provider,{value:h,children:(0,H.jsx)(_4,{value:null,children:(0,H.jsx)(HKe,{value:!0,children:(0,H.jsx)(`div`,{"data-slot":`message-item`,"data-expanded":m,"data-grouped":f,"data-nested":p,className:J(f?WKe({tone:t}):p?`min-w-0`:UKe({tone:t}),e),...s,children:typeof o==`function`?o(h):o})})})})}function KKe({className:e,tone:t,title:n,summary:r,badge:i,children:a,defaultExpanded:o=!1,...s}){return(0,H.jsx)(b4,{tone:t,expandable:!0,defaultExpanded:o,className:e,"data-slot":`message-item-group`,...s,children:({expanded:e})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S4,{title:n,badge:i,children:(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-po-faint`,children:r})}),e?(0,H.jsx)(y4.Provider,{value:{tone:t??`neutral`},children:(0,H.jsx)(`div`,{className:`flex flex-col divide-y divide-po-border-soft border-t border-po-border-soft`,children:a})}):null]})})}function qKe(e){return e.running?`running`:e.isError?`error`:`ok`}var JKe={neutral:``,running:`Running`,ok:`Completed`,error:`Failed`,info:`Info`,accent:`Note`},x4={running:(0,H.jsx)(yR,{"aria-hidden":!0,className:`size-3 animate-spin`}),ok:(0,H.jsx)(LL,{"aria-hidden":!0,className:`size-3`}),error:(0,H.jsx)(GL,{"aria-hidden":!0,className:`size-3`})};function YKe({tone:e,children:t,...n}){return(0,H.jsxs)(g4,{tone:e,size:`md`,className:`gap-1 font-semibold`,...n,children:[x4[e],(0,H.jsx)(`span`,{className:x4[e]?`max-sm:sr-only`:void 0,children:t})]})}var XKe=new Set([`ok`,`neutral`]);function S4({className:e,title:t,badge:n,children:r,...i}){let{headerAccessory:a,tone:o,expandable:s,expanded:c,toggle:l,nested:u}=v4(),d=(0,V.useContext)(y4),f=d!==null&&XKe.has(o)?null:JKe[o],p=n===void 0?f:n;return(0,H.jsxs)(`div`,{"data-slot":`message-item-header`,className:J(`flex min-h-11 items-center gap-3 px-4 py-3 text-sm text-po-dim`,u&&`min-h-9 px-0 py-0`,e),...i,children:[d===null?u?(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 text-base`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-po-hi`,children:t}),(0,H.jsx)(`div`,{"data-slot":`message-item-summary`,className:`flex min-w-0 flex-1 items-center gap-2 overflow-hidden`,children:r})]}):(0,H.jsx)(GKe,{title:t,children:r}):(0,H.jsx)(`div`,{"data-slot":`message-item-summary`,className:`flex min-w-0 flex-1 items-center gap-2`,children:r}),a,p===null||p===``?null:u&&x4[o]?(0,H.jsxs)(`span`,{"data-testid":`tool-status`,className:J(C4({tone:o}),`flex w-3 justify-center`),children:[x4[o],(0,H.jsx)(`span`,{className:`sr-only`,children:p})]}):(0,H.jsx)(YKe,{tone:o,"data-testid":`tool-status`,children:p}),s?(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`tool-expand`,"aria-expanded":c,"aria-label":c?`collapse`:`expand`,onClick:l,className:`text-po-dim hover:text-po-blue`,children:(0,H.jsx)(c?UL:zL,{className:`size-4`})}):null]})}function ZKe({className:e,...t}){let{nested:n}=v4();return(0,H.jsx)(`div`,{"data-slot":`message-item-body`,className:J(`border-t border-po-border-soft px-4 py-3 text-base text-po-dim`,n&&`border-t-0 px-0 py-1`,e),...t})}var QKe={neutral:`…`,running:`◐`,ok:`✓`,error:`✗`,info:`●`,accent:`●`},C4=UK(`shrink-0`,{variants:{tone:{neutral:`text-po-faint`,running:`text-po-yellow`,ok:`text-po-green`,error:`text-po-red`,info:`text-po-blue`,accent:`text-po-magenta`}},defaultVariants:{tone:`neutral`}});function $Ke({className:e,tone:t,glyph:n,expands:r=!1,children:i,...a}){let{toggle:o}=v4(),s=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:C4({tone:t}),children:n??QKe[t??`neutral`]}),(0,H.jsx)(`span`,{children:i})]});return r?(0,H.jsx)(`button`,{type:`button`,"data-slot":`message-item-status`,"data-testid":`tool-more`,onClick:o,className:J(`flex min-h-6 min-w-6 cursor-pointer items-center gap-1.5 text-po-faint hover:text-po-blue`,e),children:s}):(0,H.jsx)(`span`,{"data-slot":`message-item-status`,className:J(`flex items-center gap-1.5 text-po-faint`,e),...a,children:s})}var eqe=UK(`whitespace-pre-wrap break-words`,{variants:{tone:{hi:`text-po-hi`,text:`text-po-text`,dim:`text-po-dim`,muted:`text-po-faint`,success:`text-po-green`,error:`text-po-red`,warning:`text-po-yellow`,accent:`text-po-blue`},bold:{true:`font-bold`,false:``},indent:{true:`pl-4`,false:``}},defaultVariants:{tone:`dim`,bold:!1,indent:!1}});function tqe({className:e,lines:t,...n}){return(0,H.jsx)(`div`,{"data-slot":`message-lines`,className:J(`flex flex-col gap-0.5`,e),...n,children:t.map((e,t)=>(0,H.jsx)(`div`,{className:eqe({tone:e.tone,bold:e.bold===!0,indent:e.indent===!0}),children:e.text},`${String(t)}-${e.text}`))})}function w4({className:e,asChild:t=!1,...n}){let r=t?tz:`div`;return(0,H.jsx)(r,{"data-slot":`panel`,className:J(`overflow-hidden rounded-md border border-po-border bg-po-panel`,e),...n})}function nqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`panel-header`,className:J(`flex min-h-8 items-center gap-2 px-[11px]`,e),...t})}function rqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`panel-body`,className:J(`border-t border-po-border-soft bg-po-deep px-3 py-2 text-sm text-po-dim`,e),...t})}function T4(e){return(0,H.jsx)(_ke,{"data-slot":`popover`,...e})}function E4(e){return(0,H.jsx)(xke,{"data-slot":`popover-trigger`,...e})}function D4(e){return(0,H.jsx)(yke,{"data-slot":`popover-anchor`,...e})}function iqe(e){return(0,H.jsx)(Ake,{"data-slot":`popover-close`,...e})}function O4({className:e,align:t=`start`,sideOffset:n=6,...r}){return(0,H.jsx)(wke,{children:(0,H.jsx)(Tke,{"data-slot":`popover-content`,align:t,sideOffset:n,className:J(`z-50 flex max-w-[calc(100vw-24px)] flex-col overflow-hidden rounded-lg border border-po-border bg-po-panel shadow-2xl outline-none data-[state=open]:animate-po-rise`,e),...r})})}function aqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`popover-header`,className:J(`flex h-[34px] shrink-0 items-center justify-between gap-3 border-b border-po-border-soft bg-po-deep px-3`,e),...t})}function k4({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`popover-footer`,className:J(`flex min-h-[30px] shrink-0 items-center justify-between gap-3 border-t border-po-border-soft bg-po-deep px-3 text-sm text-po-dim`,e),...t})}function oqe(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>`${e.title} ${e.subtitle??``} ${e.value}`.toLowerCase().includes(n))}function sqe(e,t){return Math.max(0,e.findIndex(e=>t.includes(e.value)))}function cqe(e,t){let n=new Set(e);return n.delete(t)||n.add(t),n}function lqe(e,t){return e.size!==t.length||t.some(t=>!e.has(t))}function uqe(e,t){return e.filter(e=>t.has(e.value)).map(e=>e.value)}function dqe(e,t){return e?t?`enter toggles · tab to Apply`:`1-9, space or enter toggles · tab to Apply`:t?`type to filter · enter picks`:`1-9 or enter picks`}function fqe(e,t){let{count:n,cursor:r,multiple:i,filterable:a}=t;if(e===`ArrowDown`||e===`ArrowUp`)return n===0?null:{kind:`move`,cursor:(r+(e===`ArrowDown`?1:-1)+n)%n};if(e===`Enter`)return n===0?null:{kind:`pick`,index:r};if(a)return null;if(e===` `&&i)return n===0?null:{kind:`pick`,index:r};let o=Number.parseInt(e,10)-1;return!Number.isInteger(o)||o<0||o>=Math.min(n,9)?null:{kind:`pick`,index:o}}function A4({title:e,meta:t,items:n,value:r,multiple:i=!1,actions:a=!1,onSelect:o,onApply:s,onCancel:c,filterable:l=n.length>9,filterPlaceholder:u=`Filter`,filterProps:d,loading:f,footer:p,className:m,onKeyDown:h,...g}){let[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(()=>new Set(r)),x=oqe(n,_),[S,C]=(0,V.useState)(()=>sqe(n,r)),w=Math.min(S,Math.max(0,x.length-1)),[T,E]=(0,V.useState)(null),D=(0,V.useId)(),O=(0,V.useId)(),k=x.length>0?`${D}-${String(w)}`:void 0;(0,V.useEffect)(()=>{let e=T?.children[w];T!==null&&e!==void 0&&(e.offsetTop<T.scrollTop?T.scrollTo({top:e.offsetTop-6}):e.offsetTop+e.offsetHeight>T.scrollTop+T.clientHeight&&T.scrollTo({top:e.offsetTop+e.offsetHeight-T.clientHeight+6}))},[w,T]);let A=e=>i?y.has(e.value):r.includes(e.value),j=i&&lqe(y,r),M=e=>{e!==void 0&&e.disabledReason===void 0&&(i?b(t=>cqe(t,e.value)):o?.(e.value))},N=()=>s?.(uqe(n,y)),P=e=>{if(h?.(e),e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||e.nativeEvent.isComposing)return;let t=e.target;if(t.closest(`[data-slot="picker-slot"], [data-slot="popover-footer"]`)||t.closest(`[data-slot="picker-item"]`)&&(e.key===`Enter`||e.key===` `))return;let n=fqe(e.key,{count:x.length,cursor:w,multiple:i,filterable:l});n!==null&&(e.preventDefault(),e.stopPropagation(),n.kind===`move`?(C(n.cursor),t.closest(`[data-slot="picker-item"]`)&&(T?.children[n.cursor])?.focus()):(C(n.index),M(x[n.index])))},ee=a?`enter opens`:dqe(i,l);return(0,H.jsxs)(O4,{side:`top`,"data-slot":`picker`,onKeyDown:P,className:J(`w-[400px]`,m),...g,children:[(0,H.jsxs)(aqe,{className:`h-10 bg-po-panel`,children:[(0,H.jsx)(`span`,{id:O,"data-slot":`picker-title`,className:`truncate text-base font-semibold text-po-hi`,children:e}),t===void 0?null:(0,H.jsx)(`span`,{"data-slot":`picker-meta`,className:`min-w-0 truncate text-sm text-po-dim`,children:t})]}),l?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-po-border-soft px-3`,children:[(0,H.jsx)(wR,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-po-faint`}),(0,H.jsx)(zq,{variant:`bare`,"data-slot":`picker-filter`,role:a?`searchbox`:`combobox`,"aria-expanded":!a||void 0,"aria-controls":D,"aria-haspopup":a?void 0:`listbox`,"aria-autocomplete":a?void 0:`list`,"aria-activedescendant":k,"aria-label":u,autoFocus:!0,value:_,placeholder:u,onChange:e=>{v(e.target.value),C(0)},className:`h-9 w-full`,...d})]}):null,(0,H.jsxs)(`div`,{ref:E,id:D,role:a?`menu`:`listbox`,"aria-labelledby":O,"aria-multiselectable":a?void 0:i,"aria-activedescendant":l?void 0:k,tabIndex:l?void 0:0,"data-slot":`picker-list`,className:`relative flex max-h-80 min-h-0 flex-col gap-0.5 overflow-y-auto p-1.5`,children:[f!==void 0&&n.length===0?(0,H.jsx)(`div`,{className:`flex items-center gap-2 px-2.5 py-2 text-base text-po-dim`,children:f}):x.length===0?(0,H.jsx)(`div`,{className:`px-2.5 py-2 text-base text-po-dim`,children:`Nothing matches`}):null,x.map((e,t)=>{let n=A(e),r=e.disabledReason!==void 0;return(0,H.jsxs)(`button`,{type:`button`,id:`${D}-${String(t)}`,role:a?`menuitem`:`option`,tabIndex:-1,"data-slot":`picker-item`,"data-value":e.value,"data-cursor":t===w,"aria-selected":a?void 0:n,"aria-disabled":r,disabled:r,...e.props,title:e.disabledReason??e.subtitle,onMouseMove:()=>{t!==w&&C(t)},onClick:()=>{C(t),M(e)},className:J(`flex w-full shrink-0 cursor-pointer items-center gap-3 rounded-md px-2.5 py-2 text-left outline-none transition-colors`,t===w&&`bg-po-deep`,n&&`bg-po-tint-green`,n&&t===w&&`brightness-110`,r&&`cursor-not-allowed opacity-60`),children:[e.lead===void 0?null:(0,H.jsx)(`span`,{className:`flex shrink-0 items-center`,children:e.lead}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:J(`truncate text-base`,n?`font-semibold text-po-hi`:`font-medium text-po-text`),children:e.title}),e.disabledReason!==void 0||e.subtitle!==void 0?(0,H.jsx)(`span`,{className:`truncate text-sm text-po-dim`,children:e.disabledReason??e.subtitle}):null]}),e.trail===void 0?null:(0,H.jsx)(`span`,{className:`flex shrink-0 items-center text-sm text-po-dim`,children:e.trail}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:J(`flex size-4 shrink-0 items-center justify-center text-po-green`,!a&&(i?`rounded-sm border`:`rounded-full border`),!a&&(n?`border-po-green`:`border-po-border`),i&&n&&`bg-po-green text-po-on-selected`),children:a?(0,H.jsx)(`span`,{className:J(`size-1.5 rounded-full`,n?`bg-po-green`:`bg-po-faint`)}):i?n?(0,H.jsx)(LL,{className:`size-3`}):null:n?(0,H.jsx)(`span`,{className:`size-2 rounded-full bg-po-green`}):null})]},e.value)})]}),p===void 0?null:(0,H.jsx)(`div`,{"data-slot":`picker-slot`,className:`flex flex-col border-t border-po-border-soft`,children:p}),(0,H.jsxs)(k4,{className:`min-h-10`,children:[(0,H.jsxs)(`span`,{"data-slot":`picker-hint`,className:`flex min-w-0 items-center gap-1.5 truncate`,children:[ee,i?null:(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsx)(k$,{children:`esc`}),` closes`]})]}),i?(0,H.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-slot":`picker-cancel`,onClick:c,children:`Cancel`}),(0,H.jsxs)(Z,{variant:`primary`,size:`sm`,"data-slot":`picker-apply`,disabled:!j,onClick:N,children:[`Apply`,y.size>0?` (${String(y.size)})`:``]})]}):null]})]})}function pqe({profiles:e,status:t,value:n,onChange:r,disabled:i,id:a,className:o}){let[s,c]=(0,V.useState)(!1),l=(0,V.useId)(),u=new Map(e.map(e=>[xO(e.name),e])),d=Vhe(e).map(e=>{let t=u.get(e.value);return{...e,...t?{lead:(0,H.jsx)(JK,{name:e.title,seed:t.name,image:CO(t.identity?.icon),size:`sm`})}:{},props:{"data-testid":`profile-option-${e.value}`}}});return(0,H.jsxs)(`div`,{"data-slot":`profile-picker`,"data-testid":`profile-picker`,className:J(`flex flex-col gap-1`,o),children:[(0,H.jsx)(`span`,{id:l,className:`text-base font-medium text-po-text`,children:`Profile (optional)`}),(0,H.jsxs)(T4,{open:s,onOpenChange:c,children:[(0,H.jsx)(E4,{asChild:!0,children:(0,H.jsxs)(Z,{id:a,variant:`outline`,"data-testid":`profile-picker-trigger`,"aria-haspopup":`listbox`,"aria-expanded":s,"aria-labelledby":l,disabled:i,className:`w-full justify-between px-2.5 text-po-text`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:Hhe(n,e)}),t===`loading`?(0,H.jsx)(nq,{className:`size-3 shrink-0`}):(0,H.jsx)(zL,{className:`size-3.5 shrink-0 opacity-60`})]})}),(0,H.jsx)(A4,{side:`bottom`,align:`start`,"data-testid":`profile-picker-list`,title:`Profile`,meta:t===`loading`?`loading`:`${String(e.length)} available`,items:d,value:[xO(n)],filterable:d.length>9,filterPlaceholder:`Filter profiles`,className:`w-[min(360px,calc(100vw-24px))]`,onSelect:e=>{r(zhe(e)),c(!1)}})]}),t===`loading`?(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Loading profiles…`}):t===`unavailable`?(0,H.jsxs)(`p`,{role:`status`,"data-testid":`profile-picker-note`,className:`text-sm text-po-dim`,children:[e.length===0?`Profiles could not be loaded.`:`Some profiles could not be loaded.`,` `,`You can still start a session without one.`]}):null]})}function mqe(e,t){let[n,r]=(0,V.useState)(),i=(0,V.useRef)(t);(0,V.useEffect)(()=>{i.current=t});let a=t!==void 0;if((0,V.useEffect)(()=>{if(!a)return;let t=new AbortController;return Khe(e=>i.current?.(e)??Promise.resolve(void 0),t.signal).then(t=>{t!==void 0&&r({key:e,state:t})}),()=>t.abort()},[e,a]),a)return n?.key===e?n.state:{status:`loading`,profiles:[]}}function hqe({label:e,since:t,...n}){let r=(0,V.useRef)(null),[i]=(0,V.useState)(Date.now);return(0,V.useEffect)(()=>{let n,i=()=>{let a=Date.now(),o=r.current?.firstChild;o&&(o.nodeValue=OO({label:e,since:t},a)),n=setTimeout(i,Jhe(t,a))};return i(),()=>clearTimeout(n)},[e,t]),(0,H.jsx)(`span`,{ref:r,"data-slot":`live-duration`,...n,children:OO({label:e,since:t},i)})}function gqe({className:e,value:t,...n}){return(0,H.jsx)(Ike,{"data-slot":`progress`,value:t,className:J(`relative h-1 w-full overflow-hidden rounded-full bg-po-deep`,e),...n,children:(0,H.jsx)(Rke,{"data-slot":`progress-indicator`,className:`h-full w-full flex-1 bg-po-blue transition-transform`,style:{transform:`translateX(-${String(100-(t??0))}%)`}})})}function j4({className:e,...t}){return(0,H.jsx)($ke,{"data-slot":`radio-group`,className:J(`flex flex-col gap-2`,e),...t})}function _qe({className:e,...t}){return(0,H.jsx)(MW,{"data-slot":`radio-group-item`,className:J(`flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-full border border-po-border bg-po-deep outline-none transition-colors focus-visible:ring-2 focus-visible:ring-po-green/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-po-green`,e),...t,children:(0,H.jsx)(iAe,{"data-slot":`radio-group-indicator`,className:`block h-1.5 w-1.5 rounded-full bg-po-green`})})}function M4({className:e,...t}){return(0,H.jsx)(MW,{"data-slot":`radio-group-card`,className:J(`cursor-pointer rounded-md border border-po-border bg-po-panel p-2 text-left outline-none transition-colors hover:border-po-green/50 focus-visible:ring-2 focus-visible:ring-po-green/50 data-[state=checked]:border-po-green data-[state=checked]:bg-po-tint-green`,e),...t})}function N4({className:e,variant:t,size:n,...r}){return(0,H.jsx)(`textarea`,{"data-slot":`textarea`,className:J(`resize-none`,Rq({variant:t,size:n}),e),...r})}function vqe(e,t,n){if(e===void 0)return`no line anchor: this selection came from the rendered preview`;let r=n===`old`?`removed `:``;return t===void 0||t===e?`${r}line ${e}`:`${r}lines ${e} to ${t}`}function yqe({snippet:e,startLine:t,endLine:n,side:r,onSubmit:i,onCancel:a,testIdPrefix:o=`review-comment`}){let[s,c]=(0,V.useState)(``);return(0,H.jsxs)(`div`,{"data-testid":`${o}-draft`,className:`flex flex-col gap-1.5 border-t border-po-border p-2`,children:[(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:vqe(t,n,r)}),(0,H.jsx)(`pre`,{className:`max-h-24 overflow-y-auto whitespace-pre-wrap break-words rounded border border-po-border-soft bg-po-deep p-1.5 font-mono text-xs text-po-dim`,children:fO(e,8,600)}),(0,H.jsx)(N4,{"data-testid":`${o}-body`,value:s,rows:3,autoFocus:!0,placeholder:`what should change here?`,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Escape`&&a(),e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s.trim()!==``&&i(s))},className:`text-sm`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(Z,{variant:`outline`,size:`xs`,"data-testid":`${o}-add`,disabled:s.trim()===``,onClick:()=>i(s),children:`Add comment`}),(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,"data-testid":`${o}-cancel`,onClick:a,children:`Cancel`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`⌘⏎ to add`})]})]})}function bqe({className:e,children:t,...n}){return(0,H.jsxs)(cAe,{"data-slot":`scroll-area`,className:J(`relative overflow-hidden`,e),...n,children:[(0,H.jsx)(lAe,{"data-slot":`scroll-area-viewport`,className:`h-full w-full rounded-[inherit]`,children:t}),(0,H.jsx)(xqe,{}),(0,H.jsx)(bAe,{})]})}function xqe({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(fAe,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:J(`flex touch-none select-none`,t===`vertical`?`h-full w-2.5 p-px`:`h-2.5 flex-col p-px`,e),...n,children:(0,H.jsx)(vAe,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-po-border`})})}function P4({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`section-label`,className:J(`inline-block text-sm font-semibold text-po-dim first-letter:uppercase`,e),...t})}function F4(e){return(0,H.jsx)(MAe,{"data-slot":`select`,...e})}function I4(e){return(0,H.jsx)(ZAe,{"data-slot":`select-group`,...e})}function L4(e){return(0,H.jsx)(IAe,{"data-slot":`select-value`,...e})}function R4({className:e,children:t,...n}){return(0,H.jsxs)(PAe,{"data-slot":`select-trigger`,className:J(`flex h-7 cursor-pointer items-center justify-between gap-2 rounded border border-po-border bg-po-deep px-2.5 text-left text-base text-po-hi outline-none transition-colors hover:border-po-green/50 focus-visible:ring-2 focus-visible:ring-po-green/50 disabled:pointer-events-none disabled:opacity-40 data-[placeholder]:text-po-faint *:data-[slot=select-value]:truncate`,e),...n,children:[t,(0,H.jsx)(LAe,{asChild:!0,children:(0,H.jsx)(zL,{className:`h-3 w-3 shrink-0 text-po-faint`})})]})}function z4({className:e,position:t=`popper`,sideOffset:n=4,children:r,...i}){return(0,H.jsx)(BAe,{children:(0,H.jsx)(VAe,{"data-slot":`select-content`,position:t,sideOffset:n,className:J(`z-50 max-h-[320px] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded border border-po-border bg-po-panel shadow-xl outline-none data-[state=open]:animate-po-rise`,e),...i,children:(0,H.jsx)(JAe,{className:`p-1`,children:r})})})}function B4({className:e,...t}){return(0,H.jsx)($Ae,{"data-slot":`select-label`,className:J(`px-2 py-1 text-sm font-semibold text-po-dim first-letter:uppercase`,e),...t})}function V4({className:e,children:t,...n}){return(0,H.jsxs)(tje,{"data-slot":`select-item`,className:J(`relative flex cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-2 pl-7 text-base text-po-hi outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-40 data-[highlighted]:bg-po-deep`,e),...n,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex h-3 w-3 items-center justify-center`,children:(0,H.jsx)(ije,{children:(0,H.jsx)(LL,{className:`h-3 w-3 text-po-green`})})}),(0,H.jsx)(nje,{children:t})]})}function Sqe({className:e,...t}){return(0,H.jsx)(aje,{"data-slot":`select-separator`,className:J(`my-1 h-px bg-po-border-soft`,e),...t})}function H4({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,H.jsx)(uje,{"data-slot":`separator`,orientation:t,decorative:n,className:J(`shrink-0 bg-po-border-soft`,t===`vertical`?`h-full w-px`:`h-px w-full`,e),...r})}function U4({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`settings-page`,className:J(`flex min-w-0 flex-col gap-10`,e),...t})}function W4({className:e,...t}){return(0,H.jsx)(`header`,{"data-slot":`settings-header`,className:J(`flex min-w-0 flex-col gap-2`,e),...t})}function G4({className:e,children:t,...n}){return(0,H.jsx)(`h2`,{"data-slot":`settings-title`,className:J(`text-2xl font-semibold text-po-hi first-letter:uppercase`,e),...n,children:t})}function K4({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`settings-description`,className:J(`max-w-[60ch] text-base leading-relaxed text-po-dim first-letter:uppercase`,e),...t})}var Cqe=(0,V.createContext)(void 0);function q4({className:e,...t}){let n=(0,V.useId)();return(0,H.jsx)(Cqe.Provider,{value:n,children:(0,H.jsx)(`section`,{"data-slot":`settings-section`,"aria-labelledby":n,className:J(`flex min-w-0 flex-col gap-4`,e),...t})})}function J4({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`settings-section-header`,className:J(`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-end gap-x-4 gap-y-1`,e),...t})}function Y4({className:e,children:t,...n}){let r=(0,V.useContext)(Cqe);return(0,H.jsx)(`h3`,{"data-slot":`settings-section-title`,id:r,className:J(`text-lg font-semibold text-po-hi first-letter:uppercase`,e),...n,children:t})}function X4({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`settings-section-description`,className:J(`col-span-full row-start-2 max-w-[60ch] text-sm leading-relaxed text-po-dim first-letter:uppercase`,e),...t})}function Z4({className:e,...t}){return(0,H.jsx)(w4,{"data-slot":`settings-card`,className:J(`flex min-w-0 flex-col divide-y divide-po-border-soft rounded-lg`,e),...t})}function Q4({className:e,asChild:t=!1,changed:n=!1,...r}){let i=t?tz:`div`;return(0,H.jsx)(i,{"data-slot":`settings-row`,"data-changed":n||void 0,className:J(`relative flex min-w-0 flex-wrap items-center gap-x-6 gap-y-3 px-5 py-4`,n&&`before:absolute before:inset-y-4 before:left-0 before:w-0.5 before:rounded-r before:bg-po-green`,e),...r})}function $4({id:e,label:t,description:n,children:r,className:i,...a}){return(0,H.jsxs)(Q4,{className:i,...a,children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:(0,H.jsx)(`label`,{htmlFor:e,children:t})}),n===void 0?null:(0,H.jsx)(n3,{children:n})]}),(0,H.jsx)(`div`,{"data-slot":`settings-field-control`,className:`w-full sm:w-72 [&>*]:w-full`,children:r})]})}function e3({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`settings-row-text`,className:J(`flex min-w-0 flex-1 flex-col gap-0.5`,e),...t})}function t3({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`settings-row-title`,className:J(`block text-base font-medium text-po-hi first-letter:uppercase`,e),...t})}function n3({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`settings-row-description`,className:J(`block text-sm leading-relaxed text-po-dim first-letter:uppercase`,e),...t})}function r3({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`settings-note`,className:J(`text-sm leading-relaxed text-po-dim`,e),...t})}function i3({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`settings-actions`,className:J(`flex flex-wrap items-center gap-2`,e),...t})}function wqe(e){return(0,H.jsx)(XB,{"data-slot":`sheet`,...e})}function Tqe(e){return(0,H.jsx)(ZB,{"data-slot":`sheet-trigger`,...e})}function Eqe(e){return(0,H.jsx)(cV,{"data-slot":`sheet-close`,...e})}function Dqe({className:e,...t}){return(0,H.jsx)(nV,{"data-slot":`sheet-overlay`,className:J(`fixed inset-0 z-40 bg-po-deep/70 data-[state=open]:animate-po-fade`,e),...t})}var Oqe={right:`inset-y-0 right-0 border-l data-[state=open]:animate-po-slide-right`,left:`inset-y-0 left-0 border-r data-[state=open]:animate-po-slide-left`},kqe={sm:`w-[360px]`,md:`w-[440px]`,lg:`w-[560px]`};function Aqe({className:e,children:t,side:n=`right`,width:r=`md`,...i}){return(0,H.jsxs)(eV,{children:[(0,H.jsx)(Dqe,{}),(0,H.jsx)(iV,{"data-slot":`sheet-content`,"data-side":n,className:J(`fixed z-50 flex max-w-[calc(100vw-24px)] flex-col overflow-hidden border-po-border bg-po-rail shadow-2xl outline-none`,Oqe[n],kqe[r],e),...i,children:t})]})}function jqe({className:e,dismissible:t=!0,closeLabel:n=`close`,children:r,...i}){return(0,H.jsxs)(`div`,{"data-slot":`sheet-header`,className:J(`flex h-11 min-w-0 shrink-0 items-center gap-2.5 border-b border-po-border px-4`,e),...i,children:[r,t?(0,H.jsx)(cV,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"aria-label":n,className:`ml-auto text-po-faint hover:text-po-hi`,children:(0,H.jsx)(jR,{className:`h-3 w-3`})})}):null]})}function Mqe({className:e,...t}){return(0,H.jsx)(oV,{"data-slot":`sheet-title`,className:J(`truncate text-lg font-semibold text-po-hi`,e),...t})}function Nqe({className:e,...t}){return(0,H.jsx)(sV,{"data-slot":`sheet-description`,className:J(`text-sm leading-relaxed text-po-dim`,e),...t})}function Pqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`sheet-body`,className:J(`flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-4 py-3`,e),...t})}function Fqe({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`sheet-footer`,className:J(`flex min-h-[34px] shrink-0 flex-wrap items-center justify-between gap-2 border-t border-po-border-soft bg-po-deep px-4 py-1.5`,e),...t})}function Iqe({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`stream-cursor`,"aria-hidden":!0,className:J(`ml-0.5 inline-block h-3.5 w-2 translate-y-0.5 animate-po-blink bg-po-blue`,e),...t})}function a3({className:e,...t}){return(0,H.jsx)(_je,{"data-slot":`switch`,className:J(`inline-flex h-4 w-7 shrink-0 cursor-pointer items-center rounded-full border border-po-border bg-po-deep p-px outline-none transition-colors focus-visible:ring-2 focus-visible:ring-po-green/50 disabled:pointer-events-none disabled:opacity-40 data-[state=checked]:border-po-green data-[state=checked]:bg-po-tint-green`,e),...t,children:(0,H.jsx)(yje,{"data-slot":`switch-thumb`,className:`block h-3 w-3 rounded-full bg-po-faint transition-transform data-[state=checked]:translate-x-3 data-[state=checked]:bg-po-green`})})}var o3=UK(`flex min-h-6 min-w-6 cursor-pointer items-center gap-1.5 rounded px-2 py-1 text-base font-medium transition-colors outline-none`,{variants:{active:{true:`bg-po-tint-green font-semibold text-po-green`,false:`text-po-dim hover:bg-po-panel hover:text-po-hi`}},defaultVariants:{active:!1}}),Lqe=UK(`flex h-[15px] min-w-[15px] items-center justify-center rounded-full px-1 text-2xs font-semibold`,{variants:{active:{true:`bg-po-green text-po-rail`,false:`bg-po-panel text-po-dim`},ask:{true:`bg-po-magenta text-po-bg`}},defaultVariants:{active:!1}});function s3({className:e,active:t,asChild:n=!1,...r}){let i=n?tz:`a`;return(0,H.jsx)(i,{"data-slot":`nav-tab`,"data-active":t??!1,className:J(o3({active:t}),e),...r})}function c3({className:e,active:t,ask:n,...r}){return(0,H.jsx)(`span`,{"data-slot":`nav-tab-badge`,className:J(Lqe({active:t,ask:n}),e),...r})}function l3(e){return(0,H.jsx)(Eje,{"data-slot":`tabs`,...e})}function u3({className:e,...t}){return(0,H.jsx)(Oje,{"data-slot":`tabs-list`,className:J(`flex items-center gap-1`,e),...t})}function d3({className:e,...t}){return(0,H.jsx)(Aje,{"data-slot":`tabs-trigger`,className:J(o3({active:!1}),`data-[state=active]:bg-po-tint-green data-[state=active]:font-semibold data-[state=active]:text-po-green`,e),...t})}function Rqe({className:e,...t}){return(0,H.jsx)(Mje,{"data-slot":`tabs-content`,className:J(`min-h-0 flex-1`,e),...t})}function f3(e,t){return getComputedStyle(e).getPropertyValue(eI(t)).trim()}function zqe({onData:e,onReady:t,ref:n,fontSize:r=11,className:i,...a}){let o=(0,V.useRef)(null),s=(0,V.useRef)(void 0),c=(0,V.useRef)(e),[l,u]=(0,V.useState)(!1);return(0,V.useEffect)(()=>{c.current=e}),(0,V.useImperativeHandle)(n,()=>({write:e=>s.current?.write(e),reset:()=>s.current?.reset()})),(0,V.useEffect)(()=>{let e=o.current;if(e===null)return;let n=!1,i=()=>void 0;return(async()=>{let[{Terminal:a}]=await Promise.all([pO(()=>import(`./xterm-CerOhKYV.js`),[]),pO(()=>Promise.resolve({}),__vite__mapDeps([32]))]);if(n)return;let o=new a({cursorBlink:!0,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:r,allowTransparency:!0,theme:{background:f3(e,`deep`),foreground:f3(e,`dim`),cursor:f3(e,`hi`),selectionBackground:f3(e,`selected`)}});o.open(e),o.onData(e=>c.current?.(e)),s.current={write:e=>o.write(e),reset:()=>o.reset()},u(!0),t?.(),i=()=>{s.current=void 0,o.dispose()}})(),()=>{n=!0,i()}},[]),(0,H.jsx)(`div`,{ref:o,"data-slot":`terminal-view`,"data-ready":l,className:J(`h-full min-w-0 w-full overflow-auto`,i),...a})}function Bqe(e){return(0,H.jsx)(Lje,{...e})}function Vqe({className:e,...t}){return(0,H.jsx)(Bje,{"data-slot":`toast-viewport`,className:J(`fixed right-4 bottom-4 z-50 flex w-[360px] max-w-full flex-col gap-2 outline-none`,e),...t})}var Hqe=UK(`flex items-start gap-3 rounded-md border bg-po-panel px-3 py-2.5 shadow-2xl data-[state=open]:animate-po-rise`,{variants:{tone:{neutral:`border-po-border`,running:`border-po-edge-yellow`,ok:`border-po-edge-green`,error:`border-po-edge-red`,info:`border-po-edge-blue`,accent:`border-po-edge-magenta`}},defaultVariants:{tone:`neutral`}});function Uqe({className:e,tone:t,...n}){return(0,H.jsx)(Kje,{"data-slot":`toast`,className:J(Hqe({tone:t}),e),...n})}function Wqe({className:e,...t}){return(0,H.jsx)(Zje,{"data-slot":`toast-title`,className:J(`text-base font-semibold text-po-hi`,e),...t})}function Gqe({className:e,...t}){return(0,H.jsx)(Qje,{"data-slot":`toast-description`,className:J(`text-sm leading-relaxed text-po-dim`,e),...t})}function Kqe(e){return(0,H.jsx)(eMe,{"data-slot":`toast-action`,...e})}function qqe({className:e,...t}){return(0,H.jsx)(oK,{"data-slot":`toast-close`,"aria-label":`dismiss`,className:J(`inline-flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-po-faint transition-colors hover:text-po-hi`,e),...t,children:(0,H.jsx)(jR,{className:`h-3 w-3`})})}var Jqe=/(?<![\w./:~-])\/(?:[^\s"'`<>()[\]{}/]+\/)*[^\s"'`<>()[\]{}/]+\.[A-Za-z\d]+(?![\w/])/gu;function Yqe({text:e,onFileLink:t}){if(t===void 0)return e;let n=[],r=0;for(let i of e.matchAll(Jqe)){let a=t(i[0],!0);a!==void 0&&(n.push(e.slice(r,i.index),(0,H.jsx)(`button`,{type:`button`,"data-testid":`path-text-link`,title:`open ${i[0]}`,onClick:a,className:`cursor-pointer break-all text-left text-po-blue underline decoration-po-blue/50 hover:text-po-hi`,children:i[0]},i.index)),r=i.index+i[0].length)}return r===0?e:(n.push(e.slice(r)),(0,H.jsx)(H.Fragment,{children:n}))}function Xqe({path:e,onOpen:t,className:n,"data-testid":r=`tool-path`,...i}){return t===void 0?(0,H.jsx)(`span`,{"data-slot":`tool-path`,"data-testid":r,className:J(`inline-block max-w-full min-w-0 truncate align-bottom text-po-text`,n),...i,children:e}):(0,H.jsx)(`button`,{type:`button`,"data-slot":`tool-path`,"data-testid":r,title:`open ${e}`,onClick:t,className:J(`min-h-6 max-w-full min-w-0 cursor-pointer truncate text-left text-po-text hover:text-po-blue hover:underline`,n),...i,children:e})}function Zqe(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function Qqe(e,t){let n=e.split(`/`),r=t.split(`/`),i=[];for(let e=0;e<Math.min(n.length,r.length)&&n[e]===r[e];e+=1)i.push(n[e]);return i.join(`/`)}function $qe(e,t){let n=new Map;for(let r of e){let e=t(r),i=e.indexOf(`/`),a=i===-1?``:e.slice(0,i),o=n.get(a);o===void 0?n.set(a,[r]):o.push(r)}let r=[];for(let[e,i]of n){let n=[...i].sort((e,n)=>t(e).localeCompare(t(n))),a=e===``?``:n.map(e=>Zqe(t(e))).reduce(Qqe);r.push({prefix:a,items:n})}return r.sort((e,t)=>e.prefix.localeCompare(t.prefix))}function eJe(e,t){return e===``?t:t.slice(e.length+1)}var tJe={neutral:`neutral`,running:`yellow`,ok:`green`,error:`red`,info:`blue`,accent:`magenta`},nJe={neutral:`muted`,running:`yellow`,ok:`green`,error:`red`,info:`blue`,accent:`magenta`},rJe={neutral:`neutral`,blue:`info`,green:`ok`,yellow:`running`,red:`error`,magenta:`accent`,violet:`accent`,cyan:`info`,orange:`running`,teal:`info`},iJe={hi:`neutral`,text:`neutral`,dim:`neutral`,muted:`neutral`,success:`ok`,error:`error`,warning:`running`,accent:`info`},aJe=[`image`,`video`,`pdf`,`download`],p3=[`blue`,`green`,`yellow`,`red`,`magenta`,`violet`,`cyan`,`orange`,`teal`],oJe=[`neutral`,...p3],sJe=[`neutral`,`muted`,...p3],cJe=[`neutral`,`running`,`ok`,`error`,`info`,`accent`],lJe=[`hi`,`text`,`dim`,`muted`,`success`,`error`,`warning`,`accent`],uJe=t({ACCENT_TONES:()=>p3,Accordion:()=>NK,AccordionContent:()=>IK,AccordionItem:()=>PK,AccordionTrigger:()=>FK,ActivityIcon:()=>EL,AgentAvatar:()=>JK,AlertIcon:()=>GL,AnsiLine:()=>vMe,AnsiText:()=>yMe,AppWindowIcon:()=>Ybe,ArrowLeftIcon:()=>kL,ArrowRightIcon:()=>Xbe,AudioLinesIcon:()=>Zbe,Avatar:()=>RK,AvatarFallback:()=>BK,AvatarImage:()=>zK,BREADCRUMB_ELLIPSIS:()=>`…`,Badge:()=>XK,BellIcon:()=>NL,BookmarkPlusIcon:()=>Qbe,BranchIcon:()=>sR,Breadcrumb:()=>SMe,Button:()=>Z,CHIP_TONES:()=>oJe,CHIP_TO_STATUS:()=>rJe,CalendarIcon:()=>$be,CheckIcon:()=>LL,Checkbox:()=>Eq,ChevronDownIcon:()=>zL,ChevronRightIcon:()=>VL,ChevronUpIcon:()=>UL,CloseIcon:()=>jR,CodeBlock:()=>Iq,CodeEditor:()=>KMe,Collapsible:()=>qMe,CollapsibleContent:()=>YMe,CollapsibleTrigger:()=>JMe,CommandDialog:()=>XMe,CommandEmpty:()=>tJ,CommandFooter:()=>nJ,CommandGroup:()=>ZMe,CommandGroupLabel:()=>Qq,CommandHeader:()=>Yq,CommandInput:()=>Xq,CommandItem:()=>$q,CommandItemLabel:()=>eJ,CommandList:()=>Zq,CopyIcon:()=>YL,DOT_TONES:()=>sJe,Dialog:()=>aq,DialogBody:()=>fq,DialogClose:()=>wMe,DialogContent:()=>cq,DialogDescription:()=>dq,DialogFooter:()=>mq,DialogHeader:()=>lq,DialogTitle:()=>uq,DialogTrigger:()=>CMe,DiffView:()=>OMe,Dot:()=>GK,DownloadIcon:()=>rxe,Drawer:()=>kMe,DropdownMenu:()=>hq,DropdownMenuCheckboxItem:()=>jMe,DropdownMenuContent:()=>vq,DropdownMenuGroup:()=>AMe,DropdownMenuItem:()=>bq,DropdownMenuLabel:()=>wq,DropdownMenuRadioGroup:()=>Sq,DropdownMenuRadioItem:()=>Cq,DropdownMenuSeparator:()=>Tq,DropdownMenuShortcut:()=>FMe,DropdownMenuSub:()=>MMe,DropdownMenuSubContent:()=>PMe,DropdownMenuSubTrigger:()=>NMe,DropdownMenuTrigger:()=>gq,EditIcon:()=>Cxe,EmptyState:()=>rJ,EnterIcon:()=>nxe,ExternalLinkIcon:()=>tR,FileIcon:()=>rR,FlowGraph:()=>eBe,FolderIcon:()=>aR,ForkIcon:()=>lR,GREP_COLLAPSED_LINES:()=>15,GearIcon:()=>TR,GlobeIcon:()=>dR,GridIcon:()=>_R,HashlineLines:()=>rBe,HelpIcon:()=>txe,HomeIcon:()=>pR,ImageIcon:()=>hR,Input:()=>zq,Kbd:()=>k$,KebabIcon:()=>$L,LINE_TONE_TO_STATUS:()=>iJe,Label:()=>j$,LightbulbIcon:()=>ixe,ListIcon:()=>oxe,LiveDuration:()=>hqe,LoaderIcon:()=>yR,LockIcon:()=>bR,MAX_DIGIT_SHORTCUT:()=>9,MEDIA_KINDS:()=>aJe,MESSAGE_LINE_TONES:()=>lJe,Markdown:()=>a4,McpToolFields:()=>aBe,McpToolFrame:()=>iBe,McpToolOutput:()=>oBe,MediaPreview:()=>BKe,MediaViewerDialog:()=>N$,MenuIcon:()=>fxe,MessageIcon:()=>xR,MessageItem:()=>b4,MessageItemBody:()=>ZKe,MessageItemGroup:()=>KKe,MessageItemHeader:()=>S4,MessageItemHeaderAccessoryContext:()=>_4,MessageItemStatus:()=>$Ke,MessageLines:()=>tqe,MicIcon:()=>hxe,MonitorIcon:()=>_xe,NavTab:()=>s3,NavTabBadge:()=>c3,OptionLabel:()=>qq,OptionList:()=>Jq,OptionRow:()=>Kq,PaletteIcon:()=>yxe,Panel:()=>w4,PanelBody:()=>rqe,PanelHeader:()=>nqe,PaperclipIcon:()=>xxe,PathText:()=>Yqe,PdfPreview:()=>d4,PickerContent:()=>A4,PlayCircleIcon:()=>exe,PlusIcon:()=>SR,Popover:()=>T4,PopoverAnchor:()=>D4,PopoverClose:()=>iqe,PopoverContent:()=>O4,PopoverFooter:()=>k4,PopoverHeader:()=>aqe,PopoverTrigger:()=>E4,ProfilePicker:()=>pqe,Progress:()=>gqe,PuzzleIcon:()=>Exe,QuoteIcon:()=>Oxe,READ_COLLAPSED_LINES:()=>10,RadioGroup:()=>j4,RadioGroupCard:()=>M4,RadioGroupItem:()=>_qe,RefreshIcon:()=>CR,ReviewCommentDraft:()=>yqe,RewindIcon:()=>jxe,STATUS_EDGE:()=>h4,STATUS_GLYPH:()=>QKe,STATUS_LABEL:()=>JKe,STATUS_TONES:()=>cJe,STATUS_TO_CHIP:()=>tJe,STATUS_TO_DOT:()=>nJe,ScrollArea:()=>bqe,ScrollBar:()=>xqe,SearchIcon:()=>wR,SectionLabel:()=>P4,Select:()=>F4,SelectContent:()=>z4,SelectGroup:()=>I4,SelectItem:()=>V4,SelectLabel:()=>B4,SelectSeparator:()=>Sqe,SelectTrigger:()=>R4,SelectValue:()=>L4,SendIcon:()=>Pxe,Separator:()=>H4,ServerIcon:()=>Ixe,SettingsActions:()=>i3,SettingsCard:()=>Z4,SettingsDescription:()=>K4,SettingsField:()=>$4,SettingsHeader:()=>W4,SettingsNote:()=>r3,SettingsPage:()=>U4,SettingsRow:()=>Q4,SettingsRowDescription:()=>n3,SettingsRowText:()=>e3,SettingsRowTitle:()=>t3,SettingsSection:()=>q4,SettingsSectionDescription:()=>X4,SettingsSectionHeader:()=>J4,SettingsSectionTitle:()=>Y4,SettingsTitle:()=>G4,Sheet:()=>wqe,SheetBody:()=>Pqe,SheetClose:()=>Eqe,SheetContent:()=>Aqe,SheetDescription:()=>Nqe,SheetFooter:()=>Fqe,SheetHeader:()=>jqe,SheetOverlay:()=>Dqe,SheetTitle:()=>Mqe,SheetTrigger:()=>Tqe,ShieldIcon:()=>ER,ShrinkIcon:()=>Bxe,Skeleton:()=>Lq,SlidersIcon:()=>DR,SmartphoneIcon:()=>Uxe,SparklesIcon:()=>OR,Spinner:()=>nq,StatusBadge:()=>g4,StopIcon:()=>Jxe,StreamCursor:()=>Iqe,Switch:()=>a3,SyntaxLine:()=>Nq,SyntaxText:()=>Pq,Tabs:()=>l3,TabsContent:()=>Rqe,TabsList:()=>u3,TabsTrigger:()=>d3,TaskIcon:()=>Kxe,TerminalView:()=>zqe,Textarea:()=>N4,Toast:()=>Uqe,ToastAction:()=>Kqe,ToastClose:()=>qqe,ToastDescription:()=>Gqe,ToastProvider:()=>Bqe,ToastTitle:()=>Wqe,ToastViewport:()=>Vqe,ToolPathLink:()=>Xqe,Tooltip:()=>QK,TooltipContent:()=>eq,TooltipProvider:()=>ZK,TooltipTrigger:()=>$K,TrashIcon:()=>kR,UnlockIcon:()=>lxe,UserIcon:()=>AR,UsersIcon:()=>Qxe,ViewableImage:()=>o4,VolumeIcon:()=>eSe,WorkflowIcon:()=>nSe,WrenchIcon:()=>iSe,agentInitials:()=>KK,ansiSpans:()=>dO,badgeVariants:()=>YK,breadcrumbSegments:()=>tq,buildReviewPrompt:()=>fhe,buttonVariants:()=>rq,clockRefreshMs:()=>Jhe,clockText:()=>OO,cn:()=>J,collapseLines:()=>kO,compactDetails:()=>ige,defaultReviewHeading:()=>dhe,detectGrammar:()=>gO,dialogFooterVariants:()=>pq,diffGutterWidth:()=>che,diffRangeOf:()=>lhe,dotVariants:()=>WK,drawableImageUrl:()=>IMe,dropdownMenuItemVariants:()=>yq,fieldVariants:()=>Rq,formatRunDuration:()=>qhe,grammarKeyOf:()=>mO,groupByDirectory:()=>$qe,groupRowLabel:()=>eJe,handleOptionListKey:()=>Bq,hashlineBody:()=>rge,hashlineGroups:()=>Mhe,hashlineGroupsKey:()=>Nhe,highlightToLines:()=>bO,inlineProfileIcon:()=>CO,markdownMediaReview:()=>kq,markdownMediaReviewSlot:()=>Dq,mediaKindOf:()=>s4,messageItemRowVariants:()=>WKe,messageItemStatusVariants:()=>C4,messageItemVariants:()=>UKe,messageLineVariants:()=>eqe,optionListHint:()=>Vq,optionListVariants:()=>Uq,optionMarker:()=>Hq,optionMarkerVariants:()=>Gq,optionRowVariants:()=>Wq,parseFileHeader:()=>tge,parseProfileCatalog:()=>TO,parseTaggedLine:()=>ege,presentHashlineLines:()=>nge,resolvePdfViewportRegion:()=>u4,resultTextLines:()=>Qhe,reviewCommentAnchor:()=>uhe,statusBadgeVariants:()=>m4,svgImageUrl:()=>jq,syntaxStyleOf:()=>Ehe,tabBadgeVariants:()=>Lqe,tabVariants:()=>o3,takeTrailingNotice:()=>$he,toastVariants:()=>Hqe,toolTone:()=>qKe,trimSnippet:()=>fO,useMessageItem:()=>v4,useProfileCatalog:()=>mqe,useSyntaxLines:()=>Mq}),dJe={small:``,wide:`@min-[340px]:col-span-2`,tall:`row-span-2`,large:`row-span-2 @min-[340px]:col-span-2`};function fJe({tiles:e}){let t=e.some(e=>e.column!==void 0)?[{name:`main`,tiles:e.filter(e=>e.column!==`side`)},{name:`side`,tiles:e.filter(e=>e.column===`side`)}].filter(e=>e.tiles.length>0):void 0;return(0,H.jsx)(`div`,{className:`@container min-w-0`,children:(0,H.jsx)(`div`,{"data-testid":`dashboard-tile-grid`,className:t?t.length>1?`grid grid-cols-1 items-start gap-4 @min-[768px]:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]`:`grid grid-cols-1 items-start gap-4`:`grid grid-cols-1 items-start gap-4 @min-[340px]:grid-cols-2 @min-[960px]:grid-cols-4`,children:t?t.map(e=>(0,H.jsx)(`div`,{"data-dashboard-column":e.name,className:`flex min-w-0 flex-col gap-4`,children:e.tiles.map(e=>(0,H.jsx)(pJe,{tile:e},e.id))},e.name)):e.map(e=>(0,H.jsx)(pJe,{tile:e,span:!0},e.id))})})}function pJe({tile:e,span:t=!1}){let{id:n,size:r=`small`,title:i,icon:a,body:o,onOpen:s,legacy:c=!1}=e;return(0,H.jsx)(`div`,{"data-tile-id":n,"data-tile-size":r,className:`min-w-0 empty:hidden ${t?dJe[r]:``}`,children:(0,H.jsx)(Mk,{toolName:n,children:e=>e?null:c?o:(0,H.jsxs)(w4,{className:`flex min-w-0 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex min-h-11 items-center gap-2 px-3 py-2`,children:[a?(0,H.jsx)(a,{"aria-hidden":!0,className:`size-4 shrink-0 text-po-dim`}):null,(0,H.jsx)(`h2`,{className:`min-w-0 flex-1 break-words text-base font-semibold text-po-hi`,children:i}),s?(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"aria-label":`Open ${i}`,onClick:s,children:(0,H.jsx)(VL,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,H.jsx)(`div`,{className:`min-w-0 border-t border-po-border-soft p-3`,children:o})]})})})}function m3({tiles:e,main:t=[],side:n=[],title:r=`Home`,emptyTitle:i=`Nothing on Home yet`,emptyDescription:a=`Apps you add show up here.`,onShowSessions:o,navigationToggle:s=`mobile`}){let c=e??[...t.map((e,t)=>({id:`main-${t}`,size:`wide`,body:e,legacy:!0})),...n.map((e,t)=>({id:`side-${t}`,size:`small`,body:e,legacy:!0}))];return(0,H.jsxs)(`section`,{"aria-label":r,"data-testid":`home-page`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto bg-po-bg font-sans text-base text-po-text`,children:[o?(0,H.jsx)(`div`,{className:`shrink-0 px-3 pt-2 ${s===`mobile`?`md:hidden`:``}`,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"data-testid":`mobile-sessions-open`,title:`Show sessions`,"aria-label":`Show sessions`,onClick:o,className:`text-po-dim`,children:(0,H.jsx)(aR,{className:`size-4`})})}):null,(0,H.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-6 px-4 py-6 md:px-8 md:py-8`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-semibold text-po-hi`,children:r}),c.length===0?(0,H.jsx)(rJ,{title:i,description:a}):(0,H.jsx)(fJe,{tiles:c})]})]})}function mJe({onShowSessions:e,navigationToggle:t}){let n=KI(null),r=[...ov({scope:`global`}),...Poe()].sort((e,t)=>e.order-t.order||e.pluginId.localeCompare(t.pluginId)||e.id.localeCompare(t.id)),i=av(s_.homeAttention).flatMap(e=>e.component===void 0?[]:[{id:JSON.stringify([e.pluginId,e.id]),size:`wide`,legacy:!0,body:(0,V.createElement)(e.component,n)}]);for(let e of r){let t=e.component;if(t===void 0)continue;let r=JSON.stringify([e.pluginId,e.id]),a=O_(e.data),o=a?.open,s=o?.kind===`page`?n.openPage:n.openSettings;i.push({id:r,size:a===null?e.data?.column===`side`?`small`:`wide`:a.size??`small`,...a===null?{legacy:!0}:{title:a.title,icon:a.icon,column:a.column},...o===void 0||s===void 0?{}:{onOpen:()=>s(o.id)},body:(0,V.createElement)(t,n)})}return(0,H.jsx)(m3,{tiles:i,...e===void 0?{}:{onShowSessions:e},...t===void 0?{}:{navigationToggle:t}})}function hJe({title:e,state:t=`ready`,error:n,tiles:r=[],...i}){let a={ready:[`Nothing in this workspace yet`,`Apps for this workspace will show up here.`],loading:[`Loading workspace`,`Your workspace is getting ready.`],missing:[`Workspace not found`,`This workspace may have been removed. Choose another from the session list.`],unavailable:[`Workspace unavailable`,`Po cannot open this workspace right now. Reconnect to its host and try again.`],error:[`Workspace apps could not load`,n??`Reconnect to this host and try again.`]};return(0,H.jsx)(m3,{...i,title:e,tiles:t===`ready`?r:[],emptyTitle:a[t][0],emptyDescription:a[t][1]})}function gJe({workspaceId:e,...t}){WI();let n=U(gP,t=>t.byId[e]),r=U(gP,e=>e.hydrated),i={scope:`workspace`,workspaceId:e},a=ok(i,U(tk,e=>e)),o=KI(null,void 0,void 0,e),s=ov(i).flatMap(e=>{if(e.component===void 0)return[];let t=e.data,n=t.open,r=n?.kind===`page`?o.openPage:o.openSettings;return[{id:JSON.stringify([e.pluginId,e.id]),title:t.title,icon:t.icon,size:t.size??`small`,column:t.column,...n===void 0||r===void 0?{}:{onOpen:()=>r(n.id)},body:(0,V.createElement)(e.component,o)}]}),c=r?n===void 0?`missing`:n.available===!1?`unavailable`:a.phase===`error`?`error`:a.phase===`ready`?`ready`:`loading`:`loading`;return(0,H.jsx)(hJe,{...t,title:n?.name??`Workspace`,state:c,error:a.error,tiles:s})}function _Je({size:e=24,className:t}){return(0,H.jsx)(`img`,{src:`/favicon.svg`,width:e,height:e,className:t,alt:``,"aria-hidden":`true`,draggable:!1})}function vJe({pageId:e,sessionId:t,workspaceId:n,onShowSessions:r,navigationToggle:i=`mobile`}){let a=KI(t,void 0,void 0,n),o=Pk(s_.page,t,n).find(t=>t.id===e);return(0,H.jsxs)(`div`,{"data-testid":`plugin-page-${e}`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[r?(0,H.jsx)(`div`,{className:`shrink-0 px-3 pt-2 ${i===`mobile`?`md:hidden`:``}`,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"data-testid":`mobile-sessions-open`,title:`Show sessions`,"aria-label":`Show sessions`,onClick:r,className:`text-po-dim`,children:(0,H.jsx)(aR,{className:`size-4`})})}):null,o?.component===void 0?(0,H.jsx)(rJ,{title:`This page is not available`,description:`The plugin that draws it is not installed here.`}):(0,V.createElement)(o.component,a)]})}function h3({slot:e,sessionId:t,sessionReservationId:n}){return(0,H.jsx)(H.Fragment,{children:KI(t,void 0,n).renderSlot(e)})}var yJe=4;function bJe({value:e,size:t=208,className:n,label:r}){let i=DA(e),a=i.length+8,o=i.flatMap((e,t)=>e.map((e,n)=>e?`M${String(n+yJe)} ${String(t+yJe)}h1v1h-1z`:``)).join(``);return(0,H.jsx)(`svg`,{viewBox:`0 0 ${String(a)} ${String(a)}`,width:t,height:t,className:J(`shrink-0`,n),role:`img`,"aria-label":r??`Pairing QR code`,shapeRendering:`crispEdges`,children:(0,H.jsx)(`path`,{d:o,fill:`currentColor`})})}var xJe=`load_context`,SJe=`load_extra_tools`,CJe=`use_extra_tools`;function wJe(e,t){return t?`${t}_${e}`:e}function TJe(e,t){let n=new Set(e.map(e=>e.name)),r=e=>wJe(e,t),i=[`Use the Po MCP tools below for work in the Po session repository. They run on the Po host, not on your local machine.`,`Prefer them over your built-in bash, read, edit, write, grep, find, or ls tools for that repository.`];return t&&i.push(`Every tool name starts with "${t}_".`),n.has(xJe)&&i.push(`Start each task with ${r(xJe)}.`),n.has(SJe)&&n.has(CJe)&&i.push(`${r(SJe)} lists tools added or changed after you connected. Run one of those with ${r(CJe)}, passing the exact name it returns.`),i.push(`If a tool below is not in your visible tool list, find it in ALL_TOOLS (code mode) before concluding it is missing; do not use tool search or guess names.`,`Await every call, print its result, and check isError. If a call may have changed files or state, inspect before retrying.`,``,`Tools:`,...e.map(e=>`- ${r(e.name)}: ${e.description.replace(/\s+/g,` `).trim()}`)),i.join(`
|
|
137
137
|
`)}var EJe={running:`running`,succeeded:`ok`,failed:`error`,cancelled:`neutral`,interrupted:`neutral`};function DJe({status:e}){return(0,H.jsx)(g4,{tone:EJe[e],size:`xs`,children:e})}function OJe({state:e}){return e.error===void 0?null:(0,H.jsxs)(`div`,{role:`alert`,className:`flex items-center justify-between gap-3 border-b border-po-border px-4 py-3 text-sm text-po-red`,children:[(0,H.jsxs)(`span`,{children:[e.error,` Displayed data may be out of date.`]}),(0,H.jsx)(Z,{variant:`outline`,size:`xs`,onClick:e.refresh,children:`retry`})]})}function kJe({state:e}){let t=e.snapshot?.calls??[];return(0,H.jsxs)(`section`,{"data-testid":`session-mcp-history`,"aria-label":`MCP call history`,className:`flex h-full min-h-0 flex-col bg-po-bg text-po-text`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-po-border px-5 py-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-po-hi`,children:`Remote MCP activity`}),(0,H.jsxs)(`p`,{className:`mt-1 text-sm text-po-dim`,children:[e.snapshot?.total??0,` calls recorded · `,e.before===void 0?`latest calls`:`older calls`]})]}),e.before===void 0?(0,H.jsx)(g4,{tone:e.error?`error`:`info`,size:`sm`,children:e.error?`offline`:`live`}):(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:e.showLatest,children:`latest calls`})]}),(0,H.jsx)(OJe,{state:e}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5`,"aria-busy":e.loading,children:e.loading?(0,H.jsx)(rJ,{title:`loading MCP calls`,description:`Reading this session's remote tool history.`,className:`py-8`}):t.length===0?(0,H.jsx)(rJ,{title:`no MCP calls recorded yet`,description:`Remote tool calls will appear here as they start. Calls made before history capture was added are not available.`,className:`py-8`}):(0,H.jsx)(NK,{type:`multiple`,children:t.map(e=>(0,H.jsxs)(PK,{value:e.id,children:[(0,H.jsx)(FK,{className:`py-3`,"data-testid":`mcp-call-${e.id}`,children:(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,H.jsx)(DJe,{status:e.status}),(0,H.jsx)(`span`,{className:`min-w-0 break-all text-base font-semibold text-po-hi`,children:e.toolName}),(0,H.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-3 text-sm text-po-dim`,children:[(0,H.jsx)(`span`,{children:e.finishedAt===void 0?`in progress`:`${Math.max(0,e.finishedAt-e.startedAt).toLocaleString()} ms`}),(0,H.jsx)(`time`,{dateTime:new Date(e.startedAt).toISOString(),title:new Date(e.startedAt).toLocaleString(),children:new Date(e.startedAt).toLocaleTimeString()})]})]})}),(0,H.jsxs)(IK,{className:`space-y-3 pb-4`,children:[(0,H.jsxs)(`p`,{className:`text-sm text-po-dim`,children:[e.clientName,` · `,new Date(e.startedAt).toLocaleString()]}),(0,H.jsx)(P4,{children:`arguments`}),(0,H.jsx)(`div`,{className:`max-h-64 overflow-auto`,children:(0,H.jsx)(Iq,{text:e.input,className:`language-json`})}),(0,H.jsx)(P4,{children:`result`}),e.output===void 0?(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:e.status===`interrupted`?`The host stopped before a result was recorded.`:`Waiting for the tool result.`}):(0,H.jsx)(`div`,{className:`max-h-80 overflow-auto`,children:(0,H.jsx)(Iq,{text:e.output,className:`language-json`})})]})]},e.id))})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-po-border px-5 py-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`Text previews are limited to 16 KB. Common credential fields are redacted.`}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,disabled:e.loading||e.snapshot?.nextBefore===void 0,onClick:e.loadOlder,children:`older calls`})]})]})}function AJe({state:e}){let[t,n]=(0,V.useState)(``),[r,i]=(0,V.useState)(`idle`),a=e.snapshot?.tools??[],o=e.snapshot?.toolPrefix;async function s(){if(navigator.clipboard===void 0)i(`failed`);else try{await navigator.clipboard.writeText(TJe(a,o)),i(`copied`)}catch{i(`failed`)}}let c=a.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(t.trim().toLowerCase()));return(0,H.jsxs)(`section`,{"data-testid":`session-mcp-tools`,"aria-label":`Available MCP tools`,className:`flex min-h-0 flex-1 flex-col text-po-text`,children:[(0,H.jsxs)(`div`,{className:`space-y-3 border-b border-po-border-soft px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(P4,{children:`available tools`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Z,{type:`button`,variant:`outline`,size:`xs`,"data-testid":`session-mcp-copy-prompt`,disabled:!e.snapshot?.available||a.length===0,onClick:()=>void s(),children:r===`copied`?`copied`:`copy as prompt`}),(0,H.jsx)(g4,{tone:`info`,size:`xs`,children:a.length})]})]}),(0,H.jsxs)(`div`,{className:`text-sm text-po-dim`,children:[(0,H.jsx)(`p`,{children:`Tools granted to this session's remote connections.`}),o?(0,H.jsxs)(`p`,{className:`mt-1`,"data-testid":`session-mcp-remote-prefix`,children:[`remote names start with `,(0,H.jsxs)(`code`,{className:`text-po-text`,children:[o,`_`]})]}):null,(0,H.jsxs)(`output`,{"aria-live":`polite`,children:[r===`failed`?`copying the prompt was blocked. allow clipboard access and try again.`:``,r===`copied`?`prompt copied.`:``]})]}),(0,H.jsx)(zq,{"aria-label":`Search MCP tools`,placeholder:`search tools...`,value:t,onChange:e=>n(e.target.value)})]}),(0,H.jsx)(OJe,{state:e}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4`,"aria-busy":e.loading,children:e.snapshot===void 0&&e.loading?(0,H.jsx)(rJ,{title:`loading tools`,className:`py-5`}):e.snapshot?.available?c.length===0?(0,H.jsx)(rJ,{title:t?`no matching tools`:`no tools granted`,description:t?`Try a different tool name.`:`This connection does not currently grant any tools.`,className:`py-5`}):(0,H.jsx)(NK,{type:`multiple`,children:c.map(e=>(0,H.jsxs)(PK,{value:e.name,children:[(0,H.jsx)(FK,{className:`py-3`,children:(0,H.jsx)(`span`,{className:`min-w-0 break-all text-base font-semibold text-po-hi`,children:e.name})}),(0,H.jsxs)(IK,{className:`space-y-3 pb-3`,children:[(0,H.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-base leading-relaxed`,children:e.description}),(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:e.connections.join(`, `)}),(0,H.jsx)(P4,{children:`input schema`}),(0,H.jsx)(`div`,{className:`max-h-64 overflow-auto`,children:(0,H.jsx)(Iq,{text:JSON.stringify(e.inputSchema,null,2),className:`language-json`})})]})]},e.name))}):(0,H.jsx)(rJ,{title:`no active MCP connection`,description:`History is retained. Available tools return when the session and its remote connection are active.`,className:`py-5`})})]})}function g3(e){return`~${e.toLocaleString()}`}function jJe({sessionId:e,target:t,warnings:n,onClose:r}){let[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),c=t?.itemKind??null,l=t?.name??null,u=e===null||c===null||l===null?null:`${e}\u0000${c}\u0000${l}`,[d,f]=(0,V.useState)(null);return d!==u&&(f(u),a(null),s(null)),(0,V.useEffect)(()=>{if(e===null||c===null||l===null)return;let t=!0;return cy(e,c,l).then(e=>{t&&(e.ok?a(e.detail):s(e.error))}),()=>{t=!1}},[e,c,l]),t===null?null:(0,H.jsx)(aq,{open:!0,onOpenChange:e=>{e||r()},children:(0,H.jsxs)(cq,{width:`lg`,"data-testid":`context-item-dialog`,"aria-describedby":void 0,children:[(0,H.jsxs)(lq,{children:[(0,H.jsx)(uq,{"data-testid":`context-item-title`,children:t.itemKind===`prompt`?`system prompt`:t.name}),(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[t.itemKind,` · `,t.owner]})]}),(0,H.jsxs)(fq,{children:[t.itemKind===`tool`&&n&&n.length>0?(0,H.jsx)(_3,{title:`warnings`,children:(0,H.jsx)(`ul`,{"data-testid":`context-item-warnings`,"aria-live":`polite`,className:`flex flex-col gap-3`,children:n.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex flex-col gap-1 text-sm break-words`,children:[(0,H.jsx)(`span`,{className:`text-po-yellow`,children:e.source}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:e.path}),(0,H.jsx)(`p`,{className:`text-po-text`,children:e.message})]},t))})}):null,o===null?i===null?(0,H.jsxs)(`p`,{"data-testid":`context-item-loading`,className:`flex items-center gap-2 text-sm text-po-dim`,children:[(0,H.jsx)(nq,{}),`reading the session's inventory`]}):(0,H.jsx)(MJe,{detail:i}):(0,H.jsx)(`p`,{"data-testid":`context-item-error`,className:`text-sm text-po-dim`,children:o})]})]})})}function MJe({detail:e}){return e.itemKind===`prompt`?(0,H.jsx)(NJe,{detail:e}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.itemKind===`tool`?(0,H.jsx)(PJe,{detail:e}):(0,H.jsx)(FJe,{detail:e}),e.itemKind===`skill`||e.description!==void 0?(0,H.jsx)(_3,{title:`description`,children:(0,H.jsx)(`p`,{"data-testid":`context-item-description`,className:`text-base leading-relaxed whitespace-pre-wrap text-po-text`,children:e.description})}):null,e.itemKind===`skill`&&e.body!==void 0?(0,H.jsx)(_3,{title:`body`,children:(0,H.jsx)(v3,{testId:`context-item-body`,children:e.body})}):null,e.itemKind===`tool`&&e.promptSnippet!==void 0?(0,H.jsx)(_3,{title:`prompt snippet`,children:(0,H.jsx)(v3,{testId:`context-item-snippet`,children:e.promptSnippet})}):null,e.itemKind===`tool`&&e.promptGuidelines!==void 0?(0,H.jsx)(_3,{title:`prompt guidelines`,children:(0,H.jsx)(`ul`,{"data-testid":`context-item-guidelines`,className:`flex flex-col gap-1`,children:e.promptGuidelines.map(e=>(0,H.jsx)(`li`,{className:`text-sm leading-relaxed text-po-dim`,children:e},e))})}):null,e.itemKind===`tool`&&e.parameters!==void 0?(0,H.jsx)(_3,{title:`parameters`,children:(0,H.jsx)(v3,{testId:`context-item-schema`,children:JSON.stringify(e.parameters,null,2)})}):null]})}function _3({title:e,children:t}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-lg font-semibold text-po-hi`,children:e}),t]})}function v3({testId:e,children:t,tall:n=!1}){return(0,H.jsx)(w4,{className:`overflow-auto bg-po-deep px-3 py-2 ${n?`max-h-[60vh]`:`max-h-64`}`,children:(0,H.jsx)(`pre`,{"data-testid":e,className:`text-sm leading-relaxed whitespace-pre-wrap text-po-dim`,children:t})})}function NJe({detail:e}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{"data-testid":`context-item-cost`,className:`flex flex-col gap-1`,children:[(0,H.jsx)(y3,{label:`prompt`,value:g3(e.tokens),strong:!0}),(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`counted apart from the panel total: the tool and skill prose priced there is part of this text`}),e.stage===`base`?(0,H.jsx)(`p`,{"data-testid":`context-item-stage`,className:`text-sm text-po-dim`,children:`this session has sent nothing yet, so this is the prompt before packages add to it at the first message`}):null]}),(0,H.jsx)(_3,{title:`text`,children:(0,H.jsx)(v3,{testId:`context-item-prompt`,tall:!0,children:e.text})})]})}function PJe({detail:e}){return(0,H.jsxs)(`div`,{"data-testid":`context-item-cost`,className:`flex flex-col gap-1`,children:[(0,H.jsx)(y3,{label:`schema`,value:g3(e.tokens.schemaTokens)}),(0,H.jsx)(y3,{label:`system prompt`,value:g3(e.tokens.promptTokens)}),(0,H.jsx)(y3,{label:`total`,value:g3(e.tokens.totalTokens),strong:!0}),e.active?null:(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`not sent to the model; costs nothing until switched on`})]})}function FJe({detail:e}){return(0,H.jsxs)(`div`,{"data-testid":`context-item-cost`,className:`flex flex-col gap-1`,children:[(0,H.jsx)(y3,{label:`listing`,value:g3(e.tokens),strong:!0}),e.filePath?(0,H.jsx)(y3,{label:`file`,value:e.filePath}):null,e.modelInvocable?null:(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`not offered to the model`})]})}function y3({label:e,value:t,strong:n=!1}){return(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:e}),(0,H.jsx)(`span`,{className:`truncate text-sm ${n?`font-semibold text-po-text`:`text-po-dim`}`,children:t})]})}function b3(e){return e===null?`-`:`~${e.toLocaleString()}`}var IJe=`Not sent to the model; costs nothing until switched on`;function x3({active:e,value:t,idle:n,className:r,testId:i}){return e?(0,H.jsx)(`span`,{"data-testid":i,className:`w-16 shrink-0 text-right text-sm tabular-nums ${r}`,children:b3(t)}):(0,H.jsxs)(`span`,{"data-testid":i,title:IJe,className:`flex shrink-0 items-center justify-end gap-1.5 text-sm text-po-dim tabular-nums`,children:[(0,H.jsx)(`span`,{className:`rounded-md border border-dashed border-po-border px-1.5`,children:`Off`}),(0,H.jsx)(`span`,{children:`+${b3(n)}`})]})}function LJe(e){return e.map(e=>{let t=e.items.filter(e=>e.source===`mcp`),n=t.reduce((e,t)=>e+(t.active?t.tokens??0:0),0),r=t.reduce((e,t)=>e+(t.active?0:t.tokens??0),0);return{...e,items:e.items.filter(e=>e.source!==`mcp`),tokens:e.tokens===null?null:Math.max(0,e.tokens-n),inactiveTokens:Math.max(0,e.inactiveTokens-r)}})}function RJe(){let e=oN(e=>e.statuses),t=oN(e=>e.widgets),n=oN(e=>e.minorModes),r=oN(e=>e.context),i=xM()?.summary.id??null,[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(i);s!==i&&(c(i),o(null));let l=ose(e[Xoe]),u=r?ey(r):$v(e,t,n);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(zJe,{groups:LJe(u),total:ty(u),idle:iy(u),systemPrompt:r?.systemPrompt,estimator:r?.estimator,warnings:l,onSelect:o,children:(0,H.jsx)(h3,{slot:s_.context,sessionId:i})},i),(0,H.jsx)(jJe,{sessionId:i,target:a,warnings:a?.itemKind===`tool`&&Object.hasOwn(l,a.name)?l[a.name]:void 0,onClose:()=>o(null)})]})}function zJe({groups:e,total:t,idle:n,systemPrompt:r,estimator:i=`gpt-tokenizer`,warnings:a={},onSelect:o,children:s}){let[c,l]=(0,V.useState)(``),u=c.trim().toLowerCase(),d=e=>e.toLowerCase().includes(u),f=e.filter(e=>d(e.label)||e.items.some(e=>d(e.owner)||d(e.name)));return(0,H.jsxs)(`div`,{"data-testid":`context-panel`,className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`shrink-0 space-y-3 p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-po-border-soft bg-po-panel p-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`text-sm text-po-dim`,children:`Active context`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,H.jsx)(`span`,{"data-testid":`context-total`,className:`text-3xl font-semibold text-po-hi tabular-nums`,children:b3(t)}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`tokens`})]})]}),n>0?(0,H.jsxs)(`div`,{className:`shrink-0 border-l border-po-border pl-3`,children:[(0,H.jsx)(`div`,{className:`text-sm text-po-dim`,children:`Inactive`}),(0,H.jsx)(`span`,{"data-testid":`context-inactive`,className:`text-lg font-medium text-po-dim tabular-nums`,children:`+${b3(n)}`})]}):null]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(wR,{"aria-hidden":!0,className:`pointer-events-none absolute top-2 left-3 size-4 text-po-dim`}),(0,H.jsx)(zq,{type:`search`,"aria-label":`Find in context`,placeholder:`Find in context`,value:c,onChange:e=>l(e.target.value),className:`w-full pl-9 placeholder:text-po-dim`})]})]}),(0,H.jsxs)(`div`,{"data-testid":`context-scroll`,className:`min-h-0 flex-1 overflow-y-auto px-3 pb-3`,children:[s,e.length===0?(0,H.jsx)(rJ,{"data-testid":`context-empty`,className:`px-4 py-5`,title:`No composition yet`,description:`The session reports its major mode, minor modes, and domains once it has started.`}):f.length===0?(0,H.jsx)(rJ,{title:`No matches`,description:`Try a mode, package, tool, or skill name.`}):(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-po-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-po-border-soft px-3 py-3 text-sm text-po-dim`,children:[(0,H.jsx)(`span`,{children:`Loaded context`}),(0,H.jsx)(`span`,{children:`Est. tokens`})]}),f.map(e=>(0,H.jsx)(BJe,{group:e,query:u,warnings:a,onSelect:o},`${e.kind}:${e.id}:${u?`search`:`browse`}`))]})]}),(0,H.jsxs)(`div`,{className:`shrink-0 space-y-2 border-t border-po-border px-4 py-3`,children:[r?(0,H.jsxs)(Z,{variant:`ghost`,size:`card`,"data-testid":`context-system-prompt`,title:`Read the system prompt this session is running under`,onClick:()=>o({itemKind:`prompt`,name:`system`,owner:`session`}),className:`flex-row items-center justify-between gap-2 px-0 py-1`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-text`,children:r.stage===`base`?`System prompt (base)`:`System prompt`}),(0,H.jsx)(`span`,{className:`shrink-0 text-sm text-po-text tabular-nums`,children:b3(r.tokens)})]}):null,(0,H.jsxs)(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:[`Token counts are estimates.`,(0,H.jsx)(`br`,{}),`${i} BPE · Not a billed total`]})]})]})}function BJe({group:e,query:t,warnings:n,onSelect:r}){let i=e.items.length===0||e.items.some(e=>e.active),a=e.label.toLowerCase().includes(t);return(0,H.jsxs)(`details`,{open:!0,"data-testid":`context-group-${e.id}`,"data-kind":e.kind,"data-active":i,className:`group/mode border-b border-po-border-soft last:border-b-0`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-3 focus-visible:outline-2 focus-visible:outline-po-selected [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(VL,{"aria-hidden":!0,className:`size-3 shrink-0 text-po-dim group-open/mode:rotate-90`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-base font-semibold ${i?`text-po-hi`:`text-po-dim`}`,children:e.label}),(0,H.jsx)(`span`,{className:`rounded-md border border-po-border px-1.5 text-sm text-po-dim first-letter:uppercase`,children:e.kind}),(0,H.jsx)(x3,{active:i,value:e.tokens,idle:e.inactiveTokens,testId:`context-subtotal-${e.id}`,className:`font-semibold text-po-text`})]}),e.items.length===0?(0,H.jsx)(`p`,{"data-testid":`context-pending-${e.id}`,className:`px-3 pb-3 text-sm text-po-dim`,children:e.detail||`No tools or skills reported`}):ry(e).map(e=>{let i=a||e.owner.toLowerCase().includes(t),o=e.items.filter(e=>i||e.name.toLowerCase().includes(t));if(o.length===0)return null;let s=e.items.some(e=>e.active);return(0,H.jsxs)(`details`,{open:t?!0:e.items.length>1,className:`group/owner border-t border-po-border-soft`,children:[(0,H.jsxs)(`summary`,{"data-testid":`context-owner-${e.owner}`,"data-active":s,title:`${e.owner} (${e.source})`,className:`flex cursor-pointer list-none items-center gap-2 py-2.5 pr-3 pl-8 focus-visible:outline-2 focus-visible:outline-po-selected [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(VL,{"aria-hidden":!0,className:`size-3 shrink-0 text-po-dim group-open/owner:rotate-90`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-base font-semibold ${s?`text-po-hi`:`text-po-dim`}`,children:ny(e.owner)}),e.source===`extension`?null:(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:e.source}),(0,H.jsx)(x3,{active:s,value:e.tokens,idle:e.inactiveTokens,className:`text-po-dim`})]}),(0,H.jsx)(`div`,{className:`mb-2 ml-9 border-l border-po-border pl-2`,children:o.map(e=>(0,H.jsxs)(Z,{variant:`ghost`,size:`card`,"data-testid":`context-row-${e.name}`,"data-active":e.active,title:e.name,onClick:()=>r({itemKind:e.itemKind,name:e.name,owner:e.owner}),className:`flex-row items-center gap-2 rounded-md py-2 pr-3 pl-2`,children:[(0,H.jsx)(`span`,{className:`shrink-0 rounded-md border px-1.5 text-sm text-po-dim first-letter:uppercase ${e.active?`border-po-border`:`border-dashed border-po-border`}`,children:e.itemKind}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-base ${e.active?`font-medium text-po-hi`:`text-po-dim`}`,children:e.name}),e.itemKind===`tool`&&Object.hasOwn(n,e.name)&&(n[e.name]?.length??0)>0?(0,H.jsx)(`abbr`,{"data-testid":`context-warning-${e.name}`,"aria-label":`${e.name} has warnings`,title:`Warnings: open tool details for origins`,className:`shrink-0 text-sm font-semibold text-po-yellow no-underline`,children:`!`}):null,(0,H.jsx)(x3,{active:e.active,value:e.tokens,idle:e.tokens,className:`text-po-text`})]},`${e.itemKind}:${e.name}`))})]},e.owner)})]})}var VJe={id:`activity`,label:`Activity`,icon:EL},HJe={id:`context`,label:`Context`,icon:Exe};function UJe({contributed:e=[],mcpEnabled:t=!1,active:n,onSelect:r,badges:i={},waiting:a=0,attention:o=[]}){let s=[VJe,...t?[{id:`mcp`,label:`MCP`,icon:Ixe}]:[],...e.map(({id:e,label:t,icon:n})=>({id:e,label:t,icon:n})),HJe],c=(0,V.useRef)(null),l=o.at(-1)??n;return(0,V.useEffect)(()=>{let e=c.current,t=Array.from(e?.querySelectorAll(`[role="tab"]`)??[]).find(e=>e.dataset.testid===`dock-tab-${l}`);if(!e||!t)return;let n=t.offsetLeft,r=n+t.offsetWidth,i=n<e.scrollLeft?n:r>e.scrollLeft+e.clientWidth?r-e.clientWidth:e.scrollLeft;if(i===e.scrollLeft)return;let a=globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0;e.scrollTo({left:i,behavior:a?`auto`:`smooth`})},[l]),(0,H.jsx)(`div`,{ref:c,role:`tablist`,"aria-label":`Dock view`,onWheel:e=>{Math.abs(e.deltaY)>Math.abs(e.deltaX)&&(e.currentTarget.scrollLeft+=e.deltaY)},className:`relative flex min-w-0 items-end gap-6 overflow-x-scroll overflow-y-hidden pr-2 [scrollbar-width:thin]`,children:s.map(e=>{let t=e.id===VJe.id,s=t?a:i[e.id]??0;return(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,role:`tab`,"aria-selected":e.id===n,"aria-label":e.icon?e.label:void 0,title:e.icon?e.label:void 0,"data-testid":`dock-tab-${e.id}`,"data-active":e.id===n,"data-attention":o.includes(e.id)||void 0,onClick:()=>r(e.id),className:`h-auto shrink-0 gap-1.5 rounded-none border-b-2 px-0 pt-2 pb-3 text-base hover:bg-transparent ${e.id===n?`border-po-green font-semibold text-po-hi`:`border-transparent font-medium text-po-text hover:text-po-text`}`,children:(0,H.jsxs)(`span`,{className:`relative -mx-1.5 flex items-center rounded px-1.5 py-0.5 transition-colors duration-700 ${o.includes(e.id)?`bg-po-tint-green text-po-green`:``}`,children:[e.icon?(0,H.jsx)(e.icon,{className:`size-5`}):e.label,s>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c3,{active:!0,ask:t,"aria-hidden":!0,className:e.icon?`absolute -top-2 -right-2`:`ml-1.5`,children:s}),(0,H.jsxs)(`span`,{className:`sr-only`,children:[`, `,s,` `,t?`waiting for you`:`new`]})]}):null]})},e.id)})})}var WJe=2400;function GJe(e,t){return e===void 0||e.sessionId!==t.sessionId?[]:[...t.ids].filter(t=>!e.ids.has(t))}function KJe(e,t){let n=(0,V.useRef)(void 0),[r,i]=(0,V.useState)([]),a=t.join(`
|
|
138
138
|
`);return(0,V.useEffect)(()=>{let t={sessionId:e,ids:new Set(a===``?[]:a.split(`
|
|
139
139
|
`))},r=n.current;n.current=t,r?.sessionId!==e&&i([]);let o=GJe(r,t);o.length!==0&&(i(e=>[...e,...o]),setTimeout(()=>i(e=>e.filter(e=>!o.includes(e))),WJe))},[e,a]),r}function qJe({onClose:e,onOpenContent:t,mcp:n,scope:r}){let i=U(q,e=>e.activeId),a=U(q,e=>{let t=e.activeId===null?void 0:e.byId[e.activeId];return t?.attach===`offline`?t.reason||`Reconnecting`:null}),o=U(q,e=>e.updateRequired),s=oN(e=>e.statuses),c=oN(e=>e.widgets),l=KI(i,t),u=U(LI,e=>RI(e,i)),d=Rv(i),f=d.filter(e=>e.requiredMinorMode===void 0||l.activeMinorModes?.includes(e.requiredMinorMode)),p=d.some(e=>e.id===u&&e.requiredMinorMode!==void 0&&!l.activeMinorModes?.includes(e.requiredMinorMode));(0,V.useEffect)(()=>{p&&BI(i,`activity`)},[i,p]);let m=f.find(e=>e.id===u),h=n?.snapshot?.enabled===!0,g=u===`context`||u===`activity`||u===`mcp`&&h||m!==void 0?u:`activity`,_=m?.panel,v=zv(f,i),y=U(q,e=>cj(e.activeId===null?void 0:e.byId[e.activeId]?.summary)),b=KJe(i,f.map(e=>e.id)).filter(e=>e!==g),x=U(q,e=>e.activeId===null?void 0:e.byId[e.activeId]?.summary.workspaceId),S=U(tk),C=ok(i===null?{scope:`global`}:{scope:`session`,sessionId:i,workspaceId:x??``},S),w=Bv(s,c,i),T=w.filter(e=>e.placement!==`bottom`),E=w.filter(e=>e.placement===`bottom`),D=w.filter(e=>e.active).length;return(0,H.jsxs)(`aside`,{"data-testid":`activity-dock`,className:`flex w-[min(360px,calc(100vw-48px))] shrink-0 flex-col overflow-hidden border-l border-po-border-soft bg-po-rail sm:w-[360px]`,children:[(0,H.jsxs)(`div`,{className:`flex h-16 shrink-0 items-end gap-6 border-b border-po-border-soft px-5`,children:[(0,H.jsx)(UJe,{contributed:f,mcpEnabled:h,active:g,onSelect:e=>BI(i,e),badges:v,waiting:y,attention:b}),(0,H.jsx)(`span`,{className:`flex-1`}),(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`activity-close`,"aria-label":`Hide activity`,title:`Hide activity`,onClick:e,className:`mb-4 text-po-dim`,children:(0,H.jsx)(jR,{"aria-hidden":!0,className:`size-3.5`})})]}),g===`mcp`&&n!==void 0?(0,H.jsx)(AJe,{state:n},i):_===void 0?g===`context`?(0,H.jsx)(RJe,{}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{"data-testid":`activity-scroll`,className:`flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4`,children:[r===void 0?null:(0,H.jsx)(`p`,{"data-testid":`activity-scope`,className:`px-1 text-sm text-po-dim`,children:r}),a===null?null:(0,H.jsx)(`output`,{"data-testid":`activity-offline`,className:o?`block px-1 text-sm text-po-magenta`:`block px-1 text-sm text-po-dim`,children:a}),C.phase===`error`?(0,H.jsxs)(`div`,{"data-testid":`activity-error`,role:`alert`,className:`flex items-center justify-between gap-3 rounded-lg border border-po-border-soft px-4 py-3`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`Activity failed to load`}),(0,H.jsx)(Z,{variant:`outline`,size:`xs`,"data-testid":`activity-retry`,onClick:()=>void rk().catch(e=>console.error(e)),children:`Retry`})]}):null,w.length===0&&C.phase===`loading`?(0,H.jsx)(YJe,{testId:`activity-loading`,title:`Loading activity`,description:`Loading the package extensions that supervise work.`}):null,w.length===0&&C.phase!==`loading`&&C.phase!==`error`?(0,H.jsx)(YJe,{testId:`activity-empty`,title:`Nothing supervised yet`,description:`A package's group appears here once its extension reports in.`}):null,T.map(e=>(0,H.jsx)(ZJe,{group:e,slotProps:l},e.name)),(0,H.jsx)(h3,{slot:s_.activity,sessionId:i}),(0,H.jsx)(XJe,{sessionId:i})]}),E.length>0?(0,H.jsx)(`div`,{"data-testid":`activity-pinned`,className:`flex shrink-0 flex-col gap-3 px-4 pb-4`,children:E.map(e=>(0,H.jsx)(ZJe,{group:e,slotProps:l},e.name))}):null,(0,H.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,H.jsxs)(`p`,{className:`flex gap-2 border-t border-po-border-soft px-5 py-3 text-sm leading-relaxed text-po-dim`,children:[(0,H.jsx)(ixe,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`Each group is rendered by the package that owns it. The session's summary line stands in until that package publishes per-run detail.`]}),D>0?(0,H.jsx)(`div`,{className:`absolute inset-0 flex items-center border-t border-po-border-soft bg-po-rail px-4`,children:(0,H.jsxs)(`output`,{"data-testid":`activity-busy`,className:`flex flex-1 items-center gap-2 rounded-lg bg-po-tint-yellow px-3 py-2 text-sm text-po-yellow`,children:[(0,H.jsx)(yR,{"aria-hidden":!0,className:`size-3.5 animate-spin`}),D,` running in the background`]})}):null]})]}):(0,H.jsx)(_,{...l})]})}function JJe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function YJe({testId:e,title:t,description:n}){return(0,H.jsxs)(`div`,{"data-testid":e,className:`flex flex-col gap-1 rounded-lg border border-dashed border-po-border px-4 py-5`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:t}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:n})]})}function XJe({sessionId:e}){return(0,H.jsxs)(`div`,{className:`relative shrink-0 overflow-hidden rounded-lg border border-po-border-soft px-4 pt-3.5 pb-16`,children:[(0,H.jsxs)(`span`,{className:`relative z-10 flex items-start gap-3`,children:[(0,H.jsx)(OR,{"aria-hidden":!0,className:`mt-0.5 size-5 shrink-0 text-po-green`}),(0,H.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:`A more capable you`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`Agents, tools, and your codebase. All in one place.`}),(0,H.jsx)(`span`,{className:`flex flex-wrap gap-2 pt-1 empty:hidden`,children:(0,H.jsx)(h3,{slot:s_.activityPromo,sessionId:e})})]})]}),(0,H.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 320 80`,preserveAspectRatio:`none`,className:`absolute inset-x-0 bottom-0 h-16 w-full`,children:[(0,H.jsx)(`path`,{d:`M0 50 C60 30 110 70 170 46 S280 18 320 34 V80 H0Z`,className:`fill-po-tint-green`}),(0,H.jsx)(`path`,{d:`M0 64 C70 46 120 78 190 58 S290 44 320 52 V80 H0Z`,className:`fill-po-edge-green opacity-40`}),(0,H.jsx)(`path`,{d:`M0 74 C80 62 150 82 220 70 S300 64 320 68 V80 H0Z`,className:`fill-po-green opacity-20`})]})]})}function ZJe({group:e,slotProps:t}){let n=e.icon??EL,r=JJe(e.name),i=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left text-base font-semibold text-po-hi`,children:r}),e.keys?(0,H.jsx)(k$,{"data-testid":`activity-keys-${e.name}`,className:`bg-po-bg`,children:e.keys}):null]});return(0,H.jsxs)(`div`,{"data-testid":`activity-${e.name}`,"data-active":e.active,className:`flex shrink-0 gap-3 rounded-lg border border-po-border-soft px-4 py-4`,children:[(0,H.jsx)(n,{"aria-hidden":!0,className:`mt-0.5 size-5 shrink-0 ${e.active?`text-po-yellow`:`text-po-hi`}`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[e.transientTab===void 0?(0,H.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:i}):(0,H.jsxs)(Z,{variant:`ghost`,size:`xs`,"data-testid":`activity-open-${e.name}`,title:`Open ${e.name}`,onClick:()=>{let n=e.transientTab?.();n!==void 0&&t.openTransientTab(n)},className:`group/heading h-auto min-w-0 justify-start gap-2 px-0 py-0 hover:bg-transparent`,children:[i,(0,H.jsx)(VL,{"aria-hidden":!0,className:`size-4 shrink-0 text-po-faint group-hover/heading:text-po-dim`})]}),rv(c_(e.name)).length>0?t.renderSlot(c_(e.name)):(0,H.jsx)(`p`,{"data-testid":`activity-summary-${e.name}`,className:`text-sm first-letter:uppercase ${e.active?`text-po-yellow`:`text-po-dim`}`,children:e.summary||`Idle`})]})]})}function S3({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-sm text-po-dim`,children:e}),(0,H.jsx)(`span`,{className:`truncate text-sm text-po-text`,children:t})]})}function QJe(){let e=xM();return e===null||e.attach!==`refused`?null:(0,H.jsx)(aq,{open:!0,children:(0,H.jsxs)(cq,{width:`lg`,"data-testid":`refused-card`,"aria-describedby":void 0,className:`w-[520px] border-po-red/50`,onEscapeKeyDown:e=>e.preventDefault(),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,H.jsxs)(lq,{className:`border-po-red/40 bg-po-red/10`,children:[(0,H.jsx)(uq,{"data-testid":`refused-title`,className:`text-po-red`,children:`session already attached`}),(0,H.jsx)(nq,{className:`text-po-red/70`})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 py-4`,children:[(0,H.jsx)(`p`,{className:`text-sm leading-relaxed text-po-text`,children:`This session is already controlled by another browser connection. Po keeps retrying in the background.`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded border border-po-border bg-po-deep px-3 py-2.5`,children:[(0,H.jsx)(S3,{label:`reason`,value:e.reason||`attach_error`}),(0,H.jsx)(S3,{label:`cwd`,value:Wk(e.summary.cwd)}),(0,H.jsx)(S3,{label:`retry`,value:`automatic, with backoff`})]}),(0,H.jsx)(`p`,{"data-testid":`refused-hint`,className:`text-sm text-po-dim`,children:`close the other browser connection and this one takes over on the next attempt.`})]})]})})}function $Je(){let e=oN(e=>e.dialog),t=U(lP,e=>e.claimed),n=qI(),r=U(q,e=>e.activeId),{value:i,cursor:a}=iL(r,e),o=t=>rL(r,e,{value:t}),s=t=>rL(r,e,{cursor:t});return!e||e.method===`select`&&t!==null&&t.dialogId===e.id||n!==null&&n.dialog.id===e.id?null:(0,H.jsx)(aq,{open:!0,onOpenChange:t=>{t||qN(e.id)},children:(0,H.jsxs)(cq,{width:`lg`,"data-testid":`dialog`,"data-dialog-method":e.method,"aria-describedby":void 0,onKeyDown:t=>{e.method===`select`&&Bq(t,{options:e.options,cursor:a,onCursorChange:s,onSelect:t=>GN(e.id,t)})},onCloseAutoFocus:e=>{e.preventDefault(),Rk()},className:`rounded-lg border-po-edge-magenta`,children:[(0,H.jsxs)(lq,{className:`h-[42px] border-po-edge-magenta bg-po-tint-magenta py-0`,children:[(0,H.jsxs)(uq,{"data-testid":`dialog-title`,className:`flex items-center gap-2 text-po-magenta`,children:[(0,H.jsx)(ER,{className:`h-[13px] w-[13px] shrink-0`}),e.title]}),(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[`extension · `,e.method]})]}),(0,H.jsxs)(fq,{children:[e.message&&e.method===`select`?(0,H.jsx)(w4,{"data-testid":`dialog-command`,className:`bg-po-deep px-3 py-2.5`,children:(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-green`,children:`$`}),(0,H.jsx)(`pre`,{"data-testid":`dialog-message`,className:`min-w-0 flex-1 whitespace-pre-wrap break-words text-sm leading-relaxed text-po-hi`,children:e.message})]})}):e.message?(0,H.jsx)(`p`,{"data-testid":`dialog-message`,className:`text-base leading-relaxed text-po-text`,children:e.message}):null,e.method===`select`?(0,H.jsx)(Jq,{options:e.options,cursor:a,onCursorChange:s,testIdPrefix:`dialog-option`,onSelect:t=>GN(e.id,t)}):null,e.method===`input`||e.method===`editor`?(0,H.jsx)(N4,{"data-testid":`dialog-input`,value:i,autoFocus:!0,rows:e.method===`editor`?5:1,placeholder:e.placeholder,onChange:e=>o(e.target.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&e.method===`input`&&(t.preventDefault(),GN(e.id,i))}}):null]}),(0,H.jsxs)(mq,{variant:`bar`,className:`h-auto min-h-[34px]`,children:[(0,H.jsxs)(`span`,{"data-testid":`dialog-hints`,className:`w-full text-sm text-po-dim sm:flex sm:w-auto sm:items-center sm:gap-1.5`,children:[e.method===`select`?Vq(e.options.length):e.method===`editor`?`submit saves`:`enter confirm`,` `,`· `,(0,H.jsx)(k$,{children:`esc`}),` cancels and tells the agent`]}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,H.jsx)(Z,{variant:`outline`,size:`sm`,"data-testid":`dialog-cancel`,onClick:()=>qN(e.id),children:`cancel`}),e.method===`confirm`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Z,{variant:`danger-outline`,size:`sm`,"data-testid":`dialog-deny`,onClick:()=>KN(e.id,!1),children:`no`}),(0,H.jsx)(Z,{variant:`success`,size:`sm`,"data-testid":`dialog-confirm`,onClick:()=>KN(e.id,!0),children:`yes`})]}):null,e.method===`input`||e.method===`editor`?(0,H.jsx)(Z,{variant:`primary`,size:`sm`,"data-testid":`dialog-submit`,onClick:()=>GN(e.id,i),children:`submit`}):null]})]})]})})}var eYe=`SPC`,tYe=`/`,nYe=/^[a-z0-9]$/;function rYe(e){return[eYe,...e].join(` `)}function iYe(){WI();let e=oN(e=>e.commands),{open:t,path:n}=U(YP),r=U(q,e=>e.activeId),i=VI(),a=e=>{r!==null&&(kI(r,e),i(e.id))},[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(0),u=(0,V.useRef)(null),d=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=e=>{(e.key===`k`||e.key===` `)&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),QP())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[f,p]=(0,V.useState)(t);f!==t&&(p(t),t&&(s(``),l(0)));let m=(0,V.useMemo)(()=>n.split(``),[n]),h=uv(),g=(0,V.useMemo)(()=>yr(h,m)??yr(h,[]),[h,m]),_=g?.options??[],v=o.trim().toLowerCase(),y=v.length>0,b=(0,V.useMemo)(()=>y?e.filter(e=>e.name.toLowerCase().includes(v)):[],[e,v,y]),x=m.length===0&&!y?sv():[],S=y?b.length:_.length,C=Math.min(c,Math.max(S-1,0)),w=y?void 0:_[C],T=y?b[C]:void 0,E=e=>{ZP(),`command`in e?WN(e.command):e.run({sessionId:r,openTab:i,openTransientTab:a,sendSessionFrame:Dk})},D=(e,t=m)=>{e.binding?E(e.binding):($P([...t,e.key].join(``)),l(0))},O=()=>{m.length===0?ZP():($P(m.slice(0,-1).join(``)),l(0))},k=e=>{ZP(),WN(e)},A=e=>{let t=sv().find(t=>t.id===e);t&&(ZP(),t.run({sessionId:r,openTab:i,openTransientTab:a,sendSessionFrame:Dk}))};return(0,H.jsx)(aq,{open:t,onOpenChange:e=>{e||ZP()},children:(0,H.jsxs)(cq,{ref:u,width:`lg`,"data-testid":`palette`,"data-path":n,"aria-describedby":void 0,onKeyDown:e=>{if(e.target===d.current)return;if(e.key===`Backspace`){e.preventDefault(),O();return}if(e.key===`ArrowDown`){e.preventDefault(),l(Math.min(C+1,Math.max(S-1,0)));return}if(e.key===`ArrowUp`){e.preventDefault(),l(Math.max(C-1,0));return}if(e.key===`Enter`){e.preventDefault(),w&&D(w);return}if(e.key===tYe){e.preventDefault(),d.current?.focus();return}if(e.ctrlKey||e.metaKey||e.altKey)return;let t=e.key.toLowerCase();if(!nYe.test(t))return;let n=_.find(e=>e.key===t);n&&(e.preventDefault(),D(n))},onOpenAutoFocus:e=>{e.preventDefault(),u.current?.focus()},onCloseAutoFocus:e=>{e.preventDefault(),Rk()},onEscapeKeyDown:e=>{y&&document.activeElement===d.current&&(e.preventDefault(),s(``),l(0),u.current?.focus())},className:`top-[12vh] w-[720px] max-w-[92vw] translate-y-0`,children:[(0,H.jsx)(uq,{className:`sr-only`,children:`Leader Space`}),(0,H.jsxs)(Yq,{className:`gap-3 px-4 py-3`,children:[(0,H.jsx)(g4,{tone:`accent`,size:`xs`,children:eYe}),(0,H.jsx)(`span`,{"data-testid":`palette-path`,className:`text-base font-semibold text-po-hi`,children:m.length===0?`Leader Space`:`${m.join(` `)} · ${g?.label??``}`}),(0,H.jsx)(Xq,{ref:d,"data-testid":`palette-filter`,value:o,autoFocus:!1,placeholder:`/ search commands…`,onChange:e=>{s(e.target.value),l(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),l(Math.min(C+1,Math.max(S-1,0)))):e.key===`ArrowUp`?(e.preventDefault(),l(Math.max(C-1,0))):e.key===`Enter`&&T&&(e.preventDefault(),k(T.name))},className:`text-right`}),(0,H.jsx)(`span`,{"data-testid":`palette-count`,className:`text-sm text-po-dim`,children:S})]}),(0,H.jsxs)(`div`,{className:`flex min-h-[260px] flex-col sm:flex-row`,children:[(0,H.jsxs)(Zq,{"data-testid":`palette-keys`,className:`w-full shrink-0 gap-0 border-b border-po-border p-1 sm:w-[280px] sm:border-r sm:border-b-0`,children:[y?b.length===0?(0,H.jsx)(tJ,{"data-testid":`palette-no-match`,children:`no command matches`}):b.map((e,t)=>(0,H.jsxs)($q,{"data-testid":`palette-sub-${e.name}`,active:t===C,onMouseEnter:()=>l(t),onClick:()=>k(e.name),className:J(`w-full gap-2.5 px-3 py-1.5`,t===C&&`bg-po-magenta/10`),children:[(0,H.jsxs)(`span`,{className:`text-base font-semibold text-po-hi`,children:[`/`,e.name]}),(0,H.jsx)(eJ,{className:`text-sm text-po-dim`,children:e.description})]},e.name)):_.length===0?(0,H.jsx)(tJ,{"data-testid":`palette-empty`,children:m.length===0?`no package in this bundle registered leader keys · / searches the session’s commands`:`nothing bound under this key`}):_.map((e,t)=>(0,H.jsxs)($q,{"data-testid":`palette-item-${t}`,"data-key":e.key,active:t===C,onMouseEnter:()=>l(t),onClick:()=>D(e),className:J(`w-full gap-2.5 px-3 py-1.5`,t===C&&`bg-po-magenta/10`),children:[(0,H.jsx)(k$,{className:J(`w-5 text-center`,t===C?`bg-po-deep text-po-magenta`:`bg-po-deep text-po-dim`),children:e.key}),(0,H.jsx)(eJ,{children:e.label}),e.binding?null:(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[e.children.length,` `,e.children.length===1?`key`:`keys`]})]},e.key)),x.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Qq,{children:`plugins`}),x.map(e=>(0,H.jsxs)($q,{"data-testid":`palette-plugin-${e.id}`,onClick:()=>A(e.id),className:`w-full gap-2.5 px-3 py-1.5 hover:bg-po-magenta/10`,children:[(0,H.jsx)(eJ,{children:e.title}),e.description?(0,H.jsx)(`span`,{className:`truncate text-sm text-po-dim`,children:e.description}):null]},e.id))]}):null]}),(0,H.jsxs)(`div`,{"data-testid":`palette-detail`,className:`hidden min-w-0 flex-1 flex-col gap-2 px-4 py-3 sm:flex`,children:[T?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`text-base font-semibold text-po-hi`,children:[`/`,T.name]}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:T.description})]}):null,w?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm font-semibold text-po-magenta`,children:rYe([...m,w.key])}),(0,H.jsx)(`span`,{className:`text-sm text-po-hi`,children:w.label})]}),w.detail?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:w.detail}):null,w.binding?(0,H.jsx)(`span`,{"data-testid":`palette-target`,className:`text-base font-semibold text-po-hi`,children:`command`in w.binding?`/${w.binding.command}`:`in the cockpit`}):(0,H.jsx)(`div`,{className:`flex flex-col gap-1`,children:w.children.map(e=>(0,H.jsxs)(Kq,{"data-testid":`palette-child-${e.key}`,onClick:()=>D(e,[...m,w.key]),className:`min-h-0 gap-3 border-po-border-soft bg-po-deep px-3 py-1.5 hover:border-po-blue/50`,children:[(0,H.jsx)(`span`,{className:`w-5 text-center text-xs font-semibold text-po-magenta`,children:e.key}),(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:e.label}),(0,H.jsx)(qq,{className:`truncate text-sm text-po-dim`,children:e.detail})]},e.key))})]}):null]})]}),(0,H.jsxs)(nJ,{className:`px-4 py-2.5`,children:[(0,H.jsx)(`span`,{className:`flex items-center gap-1.5 text-sm text-po-dim`,children:y?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(k$,{children:`↑↓`}),` move · `,(0,H.jsx)(k$,{children:`enter`}),` run · `,(0,H.jsx)(k$,{children:`esc`}),` back to keys`]}):(0,H.jsxs)(H.Fragment,{children:[`keys walk · `,(0,H.jsx)(k$,{children:`⌫`}),` up · `,(0,H.jsx)(k$,{children:`enter`}),` select · `,(0,H.jsx)(k$,{children:`/`}),` search · `,(0,H.jsx)(k$,{children:`esc`}),` close`]})}),(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[h.length,` keys · `,e.length,` commands`]})]})]})})}function aYe(){let e=U(eP),[t,n]=gL(`dev-proxy/name`,``),[r,i]=gL(`dev-proxy/port`,``);(0,V.useEffect)(()=>{nP()},[]);let a=async()=>{await rP(t.trim(),Number(r))&&(n(e=>e===t?``:e),i(e=>e===r?``:e))};return(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[(0,H.jsx)(P4,{children:`dev sites`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`Reach a local dev server from a paired device, on this same address.`}),e.targets.map(t=>(0,H.jsxs)(`div`,{"data-testid":`dev-proxy-target-${t.name}`,className:`flex items-center justify-between gap-3 rounded border border-po-border px-2.5 py-1.5`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,H.jsxs)(`a`,{href:e.canRegister?`http://localhost:${String(t.port)}${hS}${t.name}/`:`${hS}${t.name}/`,target:`_blank`,rel:`noreferrer`,className:`truncate text-sm text-po-hi underline`,"data-testid":`dev-proxy-open-${t.name}`,children:[hS,t.name,`/`]}),(0,H.jsxs)(`span`,{className:`truncate text-sm text-po-dim`,children:[`port `,t.port,` · set base: '`,hS,t.name,`/' in the dev server`]})]}),e.canRegister?(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-testid":`dev-proxy-remove-${t.name}`,onClick:()=>void iP(t.name),children:`Remove`}):null]},t.name)),e.canRegister?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(zq,{"aria-label":`dev site name`,"data-testid":`dev-proxy-name`,placeholder:`storefront`,className:`min-w-0 flex-1`,value:t,onChange:e=>n(e.target.value)}),(0,H.jsx)(zq,{"aria-label":`dev site port`,"data-testid":`dev-proxy-port`,type:`number`,min:1,max:65535,placeholder:`3000`,className:`w-24`,value:r,onChange:e=>i(e.target.value)}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,"data-testid":`dev-proxy-add`,disabled:e.busy||t.trim()===``||r===``,onClick:()=>void a(),children:`Add`})]}):(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`Add a dev site on the host. A paired device can open the ones already listed, but not name new ones.`}),e.error===void 0?null:(0,H.jsx)(`span`,{"data-testid":`dev-proxy-error`,className:`text-sm text-po-yellow`,children:e.error})]})}function C3(){let e=U(fF).view?.devices??[];return e.length===0?null:(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[(0,H.jsx)(P4,{children:`paired devices`}),e.map(e=>(0,H.jsxs)(`div`,{"data-testid":`remote-device-${e.id}`,className:`flex items-center justify-between gap-3 rounded border border-po-border px-2.5 py-1.5`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,H.jsxs)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:[e.label,e.self?` · this device`:``]}),(0,H.jsx)(`span`,{className:`truncate text-sm text-po-dim`,children:e.userAgent})]}),(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-testid":`remote-revoke-${e.id}`,onClick:()=>void kF(e.id),children:`Revoke`})]},e.id))]})}function oYe(){let e=U(fF).view?.pending?.[0];return e===void 0?null:(0,H.jsx)(aq,{open:!0,children:(0,H.jsxs)(cq,{"data-testid":`pairing-approval`,className:`max-w-md`,children:[(0,H.jsxs)(lq,{className:`flex-col items-start`,children:[(0,H.jsx)(uq,{children:`Pair this device?`}),(0,H.jsx)(dq,{children:`Something scanned your code. Approve it only if it is the device in your hand.`})]}),(0,H.jsxs)(fq,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`p`,{"data-testid":`pairing-approval-agent`,className:`break-words text-base text-po-text`,children:e.userAgent}),(0,H.jsxs)(`p`,{className:`text-sm text-po-dim`,children:[`Address reported by the edge: `,e.edgeIp]}),(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`Approving grants the same access you have here, including running shell commands.`})]}),(0,H.jsxs)(mq,{className:`px-3 pb-3 sm:px-4 sm:pb-4`,children:[(0,H.jsx)(Z,{variant:`outline`,"data-testid":`pairing-deny`,onClick:()=>void OF(e.id),children:`Deny`}),(0,H.jsx)(Z,{variant:`primary`,"data-testid":`pairing-approve`,onClick:()=>void DF(e.id),children:`Approve`})]})]})})}var sYe={ios:`iOS`,android:`Android`};function cYe({devices:e,busy:t=!1,onRevoke:n}){return e.length===0?null:(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,"data-testid":`remote-trusted-devices`,children:[(0,H.jsx)(P4,{children:`trusted phones`}),(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`A trusted phone signs back in on its own. Revoking one signs it out now, and it pairs again by QR.`}),e.map(e=>(0,H.jsxs)(`div`,{"data-testid":`remote-trusted-device-${e.id}`,className:`flex items-center justify-between gap-3 rounded border border-po-border px-2.5 py-1.5`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,H.jsxs)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:[e.label,e.self?` · this device`:``]}),(0,H.jsxs)(`span`,{className:`truncate text-sm text-po-dim`,children:[sYe[e.platform],` `,`·`,` trusted since `,e.createdAt.slice(0,10)]})]}),(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:t,"data-testid":`remote-trusted-revoke-${e.id}`,onClick:()=>n(e.id),children:`Revoke`})]},e.id))]})}function lYe(){let e=U(fF);return(0,H.jsx)(cYe,{devices:e.view?.trustedDevices??[],busy:e.busy,onRevoke:e=>void AF(e)})}var uYe=1440,dYe=720;function fYe(){let e=U(fF).view?.settings;return e===void 0?(0,H.jsx)(nq,{}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`label`,{htmlFor:`remote-autoclose-switch`,className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`text-base font-medium text-po-text`,children:`Close the tunnel automatically`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`So a tunnel you forgot about does not stay open for weeks.`})]}),(0,H.jsx)(a3,{id:`remote-autoclose-switch`,"data-testid":`remote-autoclose-switch`,checked:e.autoCloseEnabled,onCheckedChange:e=>void MF({autoCloseEnabled:e})})]}),e.autoCloseEnabled?(0,H.jsxs)(`label`,{htmlFor:`remote-autoclose-minutes`,className:`flex items-center justify-between gap-4 pl-4`,children:[(0,H.jsx)(`span`,{className:`text-base font-medium text-po-text`,children:`After this many minutes`}),(0,H.jsx)(zq,{id:`remote-autoclose-minutes`,"data-testid":`remote-autoclose-minutes`,type:`number`,min:1,max:uYe,className:`w-24`,value:e.autoCloseMinutes,onChange:e=>void MF({autoCloseMinutes:Number(e.target.value)})})]}):null,(0,H.jsxs)(`label`,{htmlFor:`remote-expiry-switch`,className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`text-base font-medium text-po-text`,children:`Expire paired sessions`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`A device that goes quiet, or has simply been paired a long time, has to pair again.`})]}),(0,H.jsx)(a3,{id:`remote-expiry-switch`,"data-testid":`remote-expiry-switch`,checked:e.sessionExpiryEnabled,onCheckedChange:e=>void MF({sessionExpiryEnabled:e})})]}),e.sessionExpiryEnabled?(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pl-4`,children:[(0,H.jsxs)(`label`,{htmlFor:`remote-idle-minutes`,className:`flex items-center gap-2 text-base font-medium text-po-text`,children:[`Idle minutes`,(0,H.jsx)(zq,{id:`remote-idle-minutes`,"data-testid":`remote-idle-minutes`,type:`number`,min:1,max:uYe,className:`w-20`,value:e.idleMinutes,onChange:e=>void MF({idleMinutes:Number(e.target.value)})})]}),(0,H.jsxs)(`label`,{htmlFor:`remote-absolute-hours`,className:`flex items-center gap-2 text-base font-medium text-po-text`,children:[`Total hours`,(0,H.jsx)(zq,{id:`remote-absolute-hours`,"data-testid":`remote-absolute-hours`,type:`number`,min:1,max:dYe,className:`w-20`,value:e.absoluteHours,onChange:e=>void MF({absoluteHours:Number(e.target.value)})})]})]}):null,(0,H.jsxs)(`p`,{className:`text-sm text-po-dim`,children:[`Switching remote access off always revokes every paired device. Requires `,(0,H.jsx)(`code`,{children:`cloudflared`}),` on PATH.`]}),(0,H.jsx)(C3,{}),(0,H.jsx)(lYe,{}),(0,H.jsx)(aYe,{})]})}function pYe(){let e=U(fF);if(e.pairUrl===void 0||e.pairCode===void 0||e.pairFingerprint===void 0)return(0,H.jsx)(nq,{});let t=e.pairTarget??`web`,n=t===`native`?`${l}${encodeURIComponent(e.pairUrl)}`:e.pairUrl;return(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,H.jsx)(l3,{value:t,onValueChange:e=>EF(e),children:(0,H.jsxs)(u3,{"aria-label":`Pair with`,children:[(0,H.jsx)(d3,{value:`web`,"data-testid":`remote-pair-target-web`,children:`Browser`}),(0,H.jsx)(d3,{value:`native`,"data-testid":`remote-pair-target-native`,children:`Po app`})]})}),(0,H.jsx)(`p`,{className:`text-center text-sm text-po-dim`,children:t===`native`?`Scan with the phone camera to open the Po app. Scanning from inside Po? Use the Browser code, or paste the address below.`:`Scan with the phone camera to open Po in the phone browser.`}),(0,H.jsx)(`div`,{className:`rounded-lg bg-po-hi p-3 text-po-deep`,children:(0,H.jsx)(bJe,{value:n,size:288,label:`Scan to pair this device`})}),t===`web`?(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,H.jsx)(P4,{children:`or enter this pairing code`}),(0,H.jsx)(`code`,{"data-testid":`remote-pair-code`,className:`rounded bg-po-deep p-2 text-center font-mono text-lg tracking-widest text-po-text`,children:e.pairCode})]}):null,(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,H.jsx)(P4,{children:`signing-key fingerprint`}),(0,H.jsx)(`code`,{"data-testid":`remote-signing-fingerprint`,className:`break-all rounded bg-po-deep p-2 text-center font-mono text-sm text-po-text`,children:e.pairFingerprint.match(/.{1,8}/gu)?.join(` `)??e.pairFingerprint}),(0,H.jsxs)(`p`,{className:`text-sm text-po-dim`,children:[t===`web`?`Compare this on the phone when entering the manual code. `:``,`Bundle revision `,String(e.pairRevision),`.`]})]}),(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,H.jsx)(P4,{children:t===`native`?`or paste this address in the app`:`or open this address`}),(0,H.jsx)(`code`,{"data-testid":`remote-pair-url`,className:`break-all rounded bg-po-deep p-2 text-sm text-po-dim`,children:e.pairUrl})]}),(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-testid":`remote-new-code`,onClick:()=>void TF(),children:`Show a new code`}),e.passkeys?.supported===!0?(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5 border-t border-po-border pt-3`,children:[(0,H.jsx)(P4,{children:`passkeys`}),(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:e.passkeys.count===0?`Add one on the device you just paired and it will not need the code again.`:`${String(e.passkeys.count)} registered. A paired device signs in with a gesture instead of a code.`}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,"data-testid":`remote-add-passkey`,onClick:()=>void xF(),children:`Add a passkey for this device`})]}):e.passkeys?.reason===void 0?null:(0,H.jsx)(`p`,{"data-testid":`remote-passkey-unavailable`,className:`w-full text-sm text-po-dim`,children:e.passkeys.reason}),(0,H.jsx)(C3,{})]})}function mYe(){let e=U(fF),t=e.view,n=e.step===`pairing`,r=e.busy||t?.status===`starting`;return t?.pending?.length?null:(0,H.jsx)(aq,{open:e.step!==`closed`,onOpenChange:e=>e?void 0:vF(),children:(0,H.jsxs)(cq,{width:`lg`,"data-testid":`remote-access-dialog`,"aria-describedby":void 0,children:[(0,H.jsxs)(lq,{children:[(0,H.jsx)(uq,{children:n?`Pair a device`:`Remote access`}),(0,H.jsx)(dq,{children:n?`Scan this with the device you want to use. You will be asked to approve it here.`:`Reach this cockpit from your phone over a public tunnel.`})]}),(0,H.jsxs)(fq,{className:`flex flex-col gap-5`,children:[(0,H.jsx)(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`A paired device can prompt the agent, approve its tool calls, and run shell commands as you. Pair only devices you hold, and only when you mean to.`}),n?(0,H.jsx)(pYe,{}):(0,H.jsx)(fYe,{}),e.error===void 0?null:(0,H.jsx)(`p`,{"data-testid":`remote-access-error`,className:`text-sm text-po-red`,children:e.error})]}),(0,H.jsx)(mq,{className:`px-3 pb-3 sm:px-4 sm:pb-4`,children:t?.status===`on`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Z,{variant:`danger-outline`,"data-testid":`remote-access-off`,disabled:e.busy,onClick:()=>void wF(),children:`Turn off`}),n?(0,H.jsx)(Z,{variant:`ghost`,"data-testid":`remote-access-back`,onClick:yF,children:`Options`}):(0,H.jsx)(Z,{variant:`primary`,"data-testid":`remote-access-pair`,disabled:e.busy,onClick:()=>void TF(),children:`Pair a device`})]}):(0,H.jsxs)(Z,{variant:`primary`,"data-testid":`remote-access-on`,disabled:r,onClick:()=>void CF(),children:[r?(0,H.jsx)(nq,{}):null,`Turn on and show the code`]})})]})})}var w3=`underline decoration-2 underline-offset-4`,T3={mode:`decoration-po-blue`,profile:`decoration-po-magenta`,domains:`decoration-po-violet`,minor:`decoration-po-teal`,model:`decoration-po-cyan`},hYe={mode:`Major mode`,profile:`Profile`,domains:`Domains`,minor:`Minor modes`},gYe=`po-domains-selection`,_Ye=1,vYe=`po-team-cost`;function yYe({menu:e,dialog:t,values:n=[],multiple:r=!1}){let i=hYe[e]??e,a=t.options.map((n,i)=>{let a=e===`mode`||r?n.replace(/^\[[ x]\]\s*/,``):n,o=e===`mode`?a.indexOf(`:`):-1,s=t.descriptions?.[i]||void 0,c=o<0?a:a.slice(0,o),l=e===`profile`&&n!==`None`;return{value:r?a:n,title:c,subtitle:o<0?s:a.slice(o+1).trim(),...l?{lead:(0,H.jsx)(JK,{name:c,image:t.icons?.[i]||void 0,size:`sm`})}:{},props:{"data-testid":`dialog-option-${i}`}}}),o=a.filter((e,n)=>t.options[n].startsWith(`[x]`)).map(e=>e.value),s=t.options.some(e=>/^\[[ x]\]/.test(e))?o:a.filter(e=>n.includes(e.title)).map(e=>e.value);return(0,H.jsx)(A4,{align:`start`,"data-testid":`dialog`,"data-dialog-method":t.method,"data-dialog-menu":e,title:(0,H.jsx)(`span`,{"data-testid":`dialog-title`,children:i}),meta:r?`${s.length} active`:n.join(`, `)||t.title,items:a,value:s,multiple:r,filterable:!0,filterPlaceholder:`Filter ${e===`mode`?`major modes`:i.toLowerCase()}`,onSelect:e=>GN(t.id,e),onApply:e=>GN(t.id,JSON.stringify({kind:gYe,version:_Ye,domains:e})),onCancel:()=>qN(t.id),onCloseAutoFocus:e=>{e.preventDefault(),Rk()}})}function bYe({name:e,command:t,values:n,multi:r=!1,sessionId:i,pending:a,claimedDialog:o,children:s,className:c}){let l=o!==null,u=e===`domains`&&t.replace(/^\//,``)===`domains`&&r;return(0,H.jsxs)(T4,{open:l,onOpenChange:e=>{!e&&o&&qN(o.id)},children:[(0,H.jsx)(D4,{asChild:!0,children:(0,H.jsxs)(Z,{"data-testid":`axis-${e}`,"data-pending":a,"aria-haspopup":`dialog`,"aria-expanded":l,title:a?`Asking the session for ${e}…`:`Change ${e}${n.length?`: ${n.join(`, `)}`:``}`,onClick:()=>{dP(e),WN(t)},className:c,children:[s,a?(0,H.jsx)(nq,{className:`size-3 shrink-0`}):(0,H.jsx)(zL,{className:`size-3.5 shrink-0 opacity-60`})]})}),o?(0,H.jsx)(yYe,{menu:e,dialog:o,values:n,multiple:u},`${i}:${o.id}`):null]})}function xYe({modes:e,onClose:t}){let n=e.map(e=>({value:e.id,title:e.name,disabledReason:e.availability===`unavailable`?e.unavailableReason||`Unavailable in this session`:void 0,lead:(0,H.jsx)(k$,{className:`w-8 justify-center`,children:e.keys}),trail:e.availability===`unavailable`?(0,H.jsx)(`span`,{"data-testid":`minor-reason-${e.name}`,className:`sr-only`,children:e.unavailableReason}):e.detail?(0,H.jsx)(`span`,{"data-testid":`minor-detail-${e.name}`,className:`truncate`,children:e.detail}):void 0,props:{"data-testid":`minor-${e.name}`,"data-availability":e.availability}})),r=e.filter(e=>e.availability===`on`).map(e=>e.id);return(0,H.jsx)(A4,{align:`start`,"data-testid":`minor-popup`,title:`Minor modes`,meta:`${r.length} on`,items:n,value:r,actions:!0,filterable:!0,filterPlaceholder:`Filter minor modes`,onSelect:n=>{let r=e.find(e=>e.id===n);r!==void 0&&(r.activityGroup===void 0?(dP(`minor`),WN(`/minor ${r.id}${r.toggle===void 0?``:` ${r.toggle}`}`)):(zI(!0),BI(q.state.activeId,`activity`)),t())}})}function SYe({agent:e,models:t,levels:n,fastMode:r=!1,onClose:i}){(0,V.useEffect)(()=>{AN()},[]);let a=t.map(t=>({value:`${t.provider}/${t.id}`,title:t.id,subtitle:t.name===t.id?void 0:t.name,lead:(0,H.jsx)(`span`,{className:`w-24 truncate text-sm text-po-dim`,children:t.provider}),trail:t.reasoning?`thinks`:void 0,props:{"data-testid":`model-${t.provider}-${t.id}`,"data-current":e?.model===t.id&&e.provider===t.provider}}));return(0,H.jsx)(A4,{align:`end`,"data-testid":`model-popup`,title:`Model`,meta:e?`${e.provider}/${e.model}`:``,items:a,value:e?[`${e.provider}/${e.model}`]:[],filterable:!0,filterPlaceholder:`Filter models`,filterProps:{"data-testid":`model-filter`},loading:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(nq,{label:`asking the session for its models`}),`asking the session for its models…`]}),onSelect:e=>{let n=t.find(t=>`${t.provider}/${t.id}`===e);n!==void 0&&(jN(n.provider,n.id),i())},footer:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-3 py-2`,children:[(0,H.jsx)(`span`,{className:`mr-1 text-sm font-semibold text-po-dim`,children:`Thinking`}),n.length===0?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`…`}):null,n.map(t=>{let n=e?.thinkingLevel===t;return(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,"data-testid":`thinking-${t}`,"data-current":n,onClick:()=>{PN(t),i()},className:J(n&&`bg-po-tint-green font-semibold text-po-green`),children:t},t)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-po-border-soft px-3 py-2`,children:[(0,H.jsxs)(Z,{variant:`ghost`,size:`xs`,role:`switch`,"aria-label":`Codex Fast`,"aria-checked":e?.provider===`openai-codex`&&r,"aria-describedby":`codex-fast-description`,"data-testid":`fast-toggle`,disabled:e?.provider!==`openai-codex`,onClick:()=>MN(!r),className:J(e?.provider===`openai-codex`&&r&&`bg-po-tint-green text-po-green`),children:[`Fast `,e?.provider===`openai-codex`&&r?`on`:`off`]}),(0,H.jsx)(`span`,{id:`codex-fast-description`,className:`text-sm text-po-dim`,children:e?.provider===`openai-codex`?`Priority processing may cost more.`:`Fast is available only for Codex.`})]})]})})}function CYe(){let e=U(q,e=>e.activeId),t=oN(e=>e.statuses[`po-major-mode`]??``),n=oN(e=>e.statuses),r=oN(e=>e.widgets),i=oN(e=>e.minorModes),a=oN(e=>e.agent),o=oN(e=>e.stats),s=oN(e=>e.liveCost),c=oN(e=>e.models),l=oN(e=>e.fastMode),u=oN(e=>e.thinkingLevels),d=oN(e=>e.dialog),f=U(lP,e=>e.pending),p=U(lP,e=>e.claimed),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(!1),v=kv(t),y=oN(e=>e.profileIdentity),b=jv(n).map(e=>e.name===`profile`&&y?.name&&e.values[0]===y.profile?{...e,values:[y.name]}:e),x=Pv(n,r,i),S=x.filter(e=>e.availability===`on`),C=Number(n[vYe]??``),w=Number.isFinite(C)?C:0,T=o===null?null:o.cost+s,E=e=>d!==null&&p!==null&&p.dialogId===d.id&&p.menu===e?d:null,D=E(`minor`),O=J(rq({variant:`outline`,size:`lg`}),`min-w-0 max-w-48 gap-1.5 px-3 font-sans font-medium text-po-text max-sm:min-w-24 max-sm:max-w-28 max-sm:flex-1 max-sm:basis-0 max-sm:shrink`);return(0,H.jsxs)(`footer`,{"data-testid":`selection-bar`,"data-pending":v.pending,className:`relative flex shrink-0 items-center gap-1.5 overflow-x-auto px-3 pb-3 [scrollbar-width:none] sm:gap-2 sm:px-5 [&::-webkit-scrollbar]:hidden`,children:[(0,H.jsx)(bYe,{name:`mode`,command:`mode`,values:v.majorMode?[v.majorMode]:[],sessionId:e,pending:f===`mode`,claimedDialog:E(`mode`),className:J(O,`max-sm:max-w-24`),children:(0,H.jsx)(`span`,{"data-testid":`selection-mode`,className:J(`min-w-0 truncate`,w3,v.pending?`decoration-po-yellow`:T3.mode),children:v.majorMode||`Major mode`})}),b.map(t=>(0,H.jsxs)(bYe,{name:t.name,command:t.command,values:t.values.length===0&&!t.multi?[t.emptyLabel]:t.values,multi:t.multi,sessionId:e,pending:f===t.name,claimedDialog:E(t.name),className:O,children:[(0,H.jsx)(`span`,{"data-testid":`selection-${t.name}`,className:J(`min-w-0 truncate`,w3,T3[t.name]??`decoration-po-faint`),children:t.values[0]??t.emptyLabel}),t.values.length>1?(0,H.jsxs)(`span`,{"data-testid":`selection-${t.name}-more`,className:`shrink-0 text-xs`,children:[`+`,t.values.length-1]}):null]},t.name)),(0,H.jsxs)(T4,{open:m||D!==null,onOpenChange:e=>{e?h(!0):(D&&qN(D.id),h(!1))},children:[(0,H.jsx)(E4,{asChild:!0,children:(0,H.jsxs)(Z,{"data-testid":`axis-minor`,title:`Minor modes${S.length?`: ${S.map(e=>e.name).join(`, `)}`:``}`,className:J(O,`max-sm:max-w-24`),children:[(0,H.jsx)(`span`,{"data-testid":`minor-summary`,className:J(`min-w-0 truncate`,w3,T3.minor),children:S[0]?.name??`Minor modes`}),S.length>1?(0,H.jsxs)(`span`,{className:`shrink-0 text-xs`,children:[`+`,S.length-1]}):null,(0,H.jsx)(zL,{className:`size-3.5 shrink-0 opacity-60`})]})}),D?(0,H.jsx)(yYe,{menu:`minor`,dialog:D},`${e}:${D.id}`):m?(0,H.jsx)(xYe,{modes:x,onClose:()=>h(!1)},e):null]}),(0,H.jsx)(h3,{slot:s_.selectionBar,sessionId:e}),(0,H.jsx)(`div`,{className:`min-w-0 flex-1 max-sm:hidden`}),(0,H.jsxs)(T4,{open:g,onOpenChange:_,children:[(0,H.jsx)(E4,{asChild:!0,children:(0,H.jsxs)(Z,{"data-testid":`axis-model`,title:a?`${a.provider}/${a.model}${a.thinkingLevel?` · ${a.thinkingLevel}`:``}`:`Model and thinking level`,className:O,children:[(0,H.jsx)(`span`,{"data-testid":`agent-model`,className:J(`min-w-0 truncate`,w3,T3.model),children:a?.model??`Model`}),(0,H.jsx)(`span`,{"data-testid":`agent-thinking`,className:`shrink-0 text-sm text-po-dim max-sm:hidden`,children:a?.thinkingLevel??``}),(0,H.jsx)(zL,{className:`size-3.5 shrink-0 opacity-60`})]})}),g?(0,H.jsx)(SYe,{agent:a,models:c,levels:u,fastMode:l,onClose:()=>_(!1)},e):null]}),(0,H.jsx)(`span`,{"data-testid":`top-context`,title:o?.contextTokens!=null&&o.contextWindow!=null?`${o.contextTokens.toLocaleString()} of ${o.contextWindow.toLocaleString()} tokens`:`Context usage, once the session reports it`,className:`shrink-0 text-sm text-po-dim max-sm:hidden`,children:o?.contextPercent==null?``:`ctx ${Math.round(o.contextPercent)}%`}),(0,H.jsx)(`span`,{"data-testid":`top-cost`,title:o===null||T===null?``:w>0?`$${T.toFixed(2)} session + $${w.toFixed(2)} agents, ${o.totalTokens.toLocaleString()} tokens this session`:`${o.totalTokens.toLocaleString()} tokens this session`,className:`shrink-0 text-sm text-po-dim max-sm:hidden`,children:T===null?``:`$${(T+w).toFixed(2)}`})]})}function wYe({dialogId:e}){return(0,V.useEffect)(()=>TI(e),[e]),null}function TYe({claim:e,sessionId:t}){let n=U(aN(t),e=>e.statuses),r=KI(t),i={dialog:e.dialog,answer:n=>GN(e.dialog.id,n,t),cancel:()=>qN(e.dialog.id,t)},a=e.entry?(0,H.jsx)(e.prompt.component,{...eM(r,e.entry,n),...i}):(0,H.jsx)(e.prompt.component,{...r,...i});return(0,H.jsx)(Mk,{toolName:e.entry?.name??`dialog`,children:t=>t?(0,H.jsx)(wYe,{dialogId:e.dialog.id}):(0,H.jsx)(`div`,{"data-testid":`composer-prompt`,"data-tool-name":e.entry?.name,className:`flex min-h-0 flex-col`,children:a})},e.dialog.id)}function EYe({meta:e}){let[t,n,r]=gL(`dormant/${e.summary.id}/waking`,!1),[i,a]=gL(`dormant/${e.summary.id}/error`,``),o=e.summary,s=async()=>{if(r.state)return;n(!0),a(``);let e=await yge(o.id);n(!1),`error`in e&&a(e.error)};return(0,H.jsxs)(`div`,{"data-testid":`dormant-session`,className:`flex flex-wrap items-center justify-between gap-4 rounded-xl border border-po-border bg-po-panel px-4 py-3.5 shadow-sm`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-base font-semibold text-po-hi`,children:`Session stopped`}),(0,H.jsxs)(`p`,{className:`mt-0.5 text-sm leading-relaxed text-po-dim`,children:[`Review the conversation above, then wake to continue. History is on disk in `,Wk(o.cwd),`.`]}),i?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`dormant-error`,className:`mt-1 text-sm break-words text-po-red`,children:i}):null]}),(0,H.jsxs)(Z,{variant:`primary`,size:`lg`,className:`gap-2`,"data-testid":`dormant-wake`,disabled:t,onClick:()=>{s()},children:[(0,H.jsx)(CR,{className:`size-4`}),t?`Waking…`:`Wake session`]})]})}function DYe({sessionId:e,count:t,disabled:n=!1,entries:r,onClear:i,onDelete:a,onPromote:o,onResume:s,operationId:c,paused:l=!1}){let u=JSON.stringify([`queue`,e]),[d,f]=gL(`${u}/open`,!1),[p,m,h]=gL(`${u}/pending`,null),[g,_]=gL(`${u}/error`,null),[v,y]=gL(`${u}/cleared`,!1),b=Math.max(0,t-r.length),x=`${String(t)} queued message${t===1?``:`s`}`;t===0&&p===null&&(d||v)&&(v||g===null)&&(y(!1),f(!1));let S=async(e,t)=>{if(!(n||h.state!==null)){m(e),_(null),y(!1);try{await t(),e===`clear`&&y(!0)}catch(e){_(e instanceof Error?e.message:String(e))}finally{m(null)}}},C=n||p!==null;return t===0&&!d?null:(0,H.jsxs)(H.Fragment,{children:[t>0?(0,H.jsxs)(Z,{variant:`subtle`,size:`sm`,"data-testid":`composer-queued`,"aria-haspopup":`dialog`,"aria-expanded":d,onClick:()=>f(!0),className:`mb-2 h-7 w-full justify-between rounded-md border border-po-border-soft bg-po-panel/60 px-2.5 text-base font-medium text-po-dim hover:text-po-hi`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(CR,{className:`h-3 w-3 shrink-0 text-po-cyan`}),(0,H.jsx)(`span`,{className:`shrink-0 font-semibold text-po-hi`,children:x}),(0,H.jsx)(`span`,{className:`min-w-0 truncate text-sm font-normal text-po-dim`,children:l?`paused until resumed`:`waiting for the current run`})]}),(0,H.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-sm text-po-dim`,children:[`view queue`,(0,H.jsx)(UL,{className:`h-3 w-3`})]})]}):null,(0,H.jsx)(aq,{open:d,onOpenChange:f,children:(0,H.jsxs)(cq,{width:`lg`,"data-testid":`queue-sheet`,"aria-describedby":void 0,className:`top-auto bottom-0 left-1/2 max-h-[min(72dvh,560px)] !w-full !max-w-2xl -translate-x-1/2 translate-y-0 rounded-t-xl rounded-b-none border-b-0 data-[state=open]:animate-none`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-po-border`}),(0,H.jsxs)(lq,{dismissible:!0,closeLabel:`close queued messages`,className:`py-2.5`,children:[(0,H.jsx)(uq,{children:`queued messages`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:l?`paused`:`${x} waiting`})]}),(0,H.jsxs)(fq,{className:`overflow-y-auto p-2 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:[(0,H.jsxs)(`ol`,{className:`flex flex-col gap-1.5`,children:[r.map((e,t)=>(0,H.jsxs)(`li`,{"data-testid":`queue-sheet-item`,className:`flex min-w-0 gap-3 rounded-md border border-po-border-soft bg-po-deep px-3 py-2.5`,children:[(0,H.jsx)(`span`,{className:`pt-0.5 text-xs font-semibold text-po-cyan`,children:String(t+1).padStart(2,`0`)}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-lg leading-relaxed text-po-text`,children:e.text}),e.images&&e.images.length>0?(0,H.jsxs)(`p`,{className:`mt-1 text-sm text-po-dim`,children:[e.images.length,` image`,e.images.length===1?``:`s`,` attached`]}):null]}),e.disposition===`pending`&&o?(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-testid":`queue-steer-${String(t)}`,"aria-label":`${c===void 0?`send now`:`steer`} queued message ${String(t+1)}`,disabled:C,onClick:()=>void S(`send:${e.id}`,()=>o(e.id,c)),className:`h-7 shrink-0 text-po-cyan`,children:p===`send:${e.id}`?`sending…`:c===void 0?`send now`:`steer`}):null,(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`queue-delete-${String(t)}`,"aria-label":`delete queued message ${String(t+1)}`,title:e.disposition===`handoff`?`This message is already being delivered`:`Delete this message`,disabled:C||e.disposition!==`pending`,onClick:()=>void S(`delete:${e.id}`,()=>a(e.id)),className:`h-7 w-7 shrink-0 text-po-faint hover:text-po-red`,children:(0,H.jsx)(kR,{className:`h-3.5 w-3.5`})})]},e.id)),b>0?(0,H.jsxs)(`li`,{"data-testid":`queue-sheet-unlisted`,className:`rounded-md border border-dashed border-po-border px-3 py-2.5 text-sm text-po-dim`,children:[b,` more queued message`,b===1?` is`:`s are`,` waiting in the session. Their text is not available in this browser.`]}):null]}),l&&s?(0,H.jsx)(Z,{variant:`subtle`,size:`sm`,"data-testid":`queue-resume`,className:`mt-2 w-full`,disabled:C,onClick:()=>void S(`resume`,s),children:p===`resume`?`resuming…`:`resume queued messages`}):null,t>0?(0,H.jsx)(Z,{variant:`danger`,size:`sm`,"data-testid":`queue-clear`,className:`mt-2 w-full`,disabled:C,onClick:()=>void S(`clear`,i),children:p===`clear`?`deleting…`:`delete all queued messages`}):null,p===null?null:(0,H.jsx)(`output`,{className:`mt-2 block text-sm text-po-dim`,children:`waiting for the session to acknowledge this action…`}),g===null?v&&t>0?(0,H.jsx)(`output`,{"data-testid":`queue-clear-remaining`,className:`mt-2 block text-sm text-po-dim`,children:`Messages remain or await confirmation. Messages being delivered or with uncertain delivery cannot be cleared.`}):null:(0,H.jsx)(`p`,{role:`alert`,"data-testid":`queue-error`,className:`mt-2 text-sm text-po-red`,children:g})]})]})})]})}function OYe({sessionId:e}){return(0,H.jsxs)(`div`,{"data-testid":`agent-locked`,className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border border-po-border bg-po-deep px-3 py-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`text-base font-semibold text-po-hi`,children:`local agent locked`}),(0,H.jsx)(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`it will not start turns, so remote MCP agents can work without it. unlock to chat here.`})]}),(0,H.jsxs)(Z,{variant:`primary`,size:`md`,"data-testid":`agent-unlock`,onClick:()=>NN(!1,e),children:[(0,H.jsx)(lxe,{className:`h-3 w-3`}),`unlock agent`]})]})}var kYe=192,AYe=300,jYe=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),MYe=new Set(`c.cpp.css.csv.go.h.hpp.html.ini.java.js.json.jsonl.jsx.log.md.markdown.py.rb.rs.sh.sql.toml.ts.tsv.tsx.txt.xml.yaml.yml`.split(`.`));function NYe(e){let t=e.name.toLowerCase().split(`.`).pop()??``;return e.type.startsWith(`text/`)||MYe.has(t)}function PYe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>typeof r.result==`string`?t(r.result):n(Error(`No file data`)),r.onerror=()=>n(r.error??Error(`Could not read file`)),r.readAsDataURL(e)})}async function FYe(e,t){try{return(await VA(e,t)).path}catch{return}}var E3=`Only 8 attachments are allowed.`;function D3(e,t,n,r){return t===`image`?e.reduce((e,t)=>e+(t.kind===`image`?t.size:0),0)+r>20971520?`${n} exceeds the 20 MB total image limit.`:``:t===`text`&&IM(e)+r>204800?`${n} exceeds the 200 KB total text limit.`:``}async function IYe(e,t,n){let r=[...n.attachments],i=[],a=n.nextAttachmentId;for(let n of t){if(r.length>=8){i.push(E3);break}let t=`attachment-${String(a++)}`;if(jYe.has(n.type)){if(n.size>10485760){i.push(`${n.name} exceeds the 10 MB image limit.`);continue}let a=D3(r,`image`,n.name,n.size);if(a){i.push(a);continue}try{let i=await PYe(n),a=n.size>8388608?void 0:await FYe(e,n);r.push({id:t,kind:`image`,name:n.name,size:n.size,dataUrl:i,data:i.slice(i.indexOf(`,`)+1),mimeType:n.type,...a===void 0?{}:{path:a}})}catch{i.push(`${n.name} could not be read.`)}continue}if(!NYe(n)){if(n.size>8388608){i.push(`"${n.name}" exceeds the 8 MB file limit.`);continue}try{let i=await VA(e,n);r.push({id:t,kind:`file`,name:n.name,size:i.size,mimeType:i.mimeType,path:i.path})}catch{i.push(`"${n.name}" could not be uploaded.`)}continue}if(n.size>102400){i.push(`${n.name} exceeds the 100 KB text file limit.`);continue}let o=D3(r,`text`,n.name,n.size);if(o)i.push(o);else try{let i=await n.text(),a=await FYe(e,n);r.push({id:t,kind:`text`,name:n.name,size:n.size,content:i,...a===void 0?{}:{path:a}})}catch{i.push(`${n.name} could not be read.`)}}return{attachments:r.slice(n.attachments.length),attachmentError:i.join(` `)}}async function LYe(e,t){if(t.length===0)return;let n={attachments:[],nextAttachmentId:0};RM(e,e=>(n=e,{...e,nextAttachmentId:e.nextAttachmentId+t.length,pendingAttachments:e.pendingAttachments+1}));let r=await IYe(e,t,n);LM.state[e]!==void 0&&RM(e,e=>{let t=[...e.attachments],n=r.attachmentError?[r.attachmentError]:[];for(let e of r.attachments){if(t.length>=8){r.attachmentError.includes(E3)||n.push(E3);break}let i=D3(t,e.kind,e.name,e.size);i?n.push(i):t.push(e)}return{...e,attachments:t,attachmentError:n.join(` `),pendingAttachments:Math.max(0,e.pendingAttachments-1)}})}function RYe(e){let t=e.items[e.selected];return t!==void 0&&t.insert.trimEnd()===`${Qn[e.kind]}${e.query}`}function zYe(e){let t=oN(e=>e.entries);return(0,H.jsx)(DYe,{...e,entries:t.filter(e=>e.kind===`queued`)})}function O3({composerContext:e}={}){C_(`Composer`);let t=U(q,e=>e.activeId),n=xM(),r=oN(e=>e.streaming),i=oN(e=>e.lifecycle),a=oN(e=>e.agentLocked),o=i===null?r:i.operation!==null,s=i?.operation?.status===`aborting`,c=oN(e=>e.entries.reduce((e,t)=>e+Number(t.kind===`queued`),0)),l=oN(e=>e.commands),u=oN(e=>e.editorTextRequest),d=qI(),{draft:f,caret:p,dismissedToken:m,attachments:h,attachmentError:g,pendingAttachments:_}=Sye(t),[v,y]=(0,V.useState)(null),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(!1),w=U(ZN,e=>t!==null&&e.has(t)),T=(0,V.useRef)(null),E=(0,V.useRef)(null),D=(0,V.useRef)(void 0),O=n?.summary.dormant===!0,k=!O&&n?.attach===`attached`,A=i===null?c:i.queue.length,[j,M]=(0,V.useState)(t);j!==t&&(M(t),y(null),x(!1),C(!1)),S&&v!==null&&C(!1),(0,V.useEffect)(()=>{D.current&&clearTimeout(D.current)},[t]),(0,V.useEffect)(()=>Lk(T.current),[O,d]),(0,V.useEffect)(()=>{u!==null&&(RM(t,e=>{let t=u.append?`${e.draft}${e.draft&&!/\s$/u.test(e.draft)?` `:``}${u.text}`:u.text;return{...e,draft:t,caret:t.length,dismissedToken:null}}),requestAnimationFrame(()=>{T.current?.focus();let e=T.current?.value.length??0;T.current?.setSelectionRange(e,e)}))},[u,t]);let N=(0,V.useCallback)(()=>{let e=T.current;e&&(e.style.height=`auto`,e.style.height=`${String(Math.min(e.scrollHeight,kYe))}px`)},[]);(0,V.useEffect)(()=>N(),[f,N]);let P=(0,V.useCallback)(()=>{D.current&&clearTimeout(D.current),y(null)},[]),ee=(0,V.useCallback)(()=>{let e=$n(f,p);RM(t,t=>({...t,dismissedToken:e?.start??null})),P()},[f,p,P,t]);(0,V.useEffect)(()=>{let e=$n(f,p);if(!e||!k||m===e.start)P();else if(e.kind===`command`||e.kind===`skill`){let t=er(l,e.kind,e.query);y(t.length>0?{kind:e.kind,tokenStart:e.start,query:e.query,items:t,selected:0}:null)}else return D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{t!==null&&kge(t,e.query).then(n=>{let r=T.current;if(q.state.activeId!==t||!r||$n(r.value,r.selectionStart)?.query!==e.query)return;let i=tr(n,qv(t,e.query));y(i.length>0?{kind:`file`,tokenStart:e.start,query:e.query,items:i,selected:0}:null)})},AYe),()=>{D.current&&clearTimeout(D.current)}},[f,p,l,k,m,P,t]),(0,V.useEffect)(()=>{if(!v)return;let e=e=>{E.current&&e.target instanceof Node&&!E.current.contains(e.target)&&P()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[v,P]);let F=(e,n)=>{let r=e.items[n];if(!r)return;let i=f.slice(0,e.tokenStart)+r.insert+f.slice(p),a=e.tokenStart+r.insert.length;RM(t,t=>({...t,draft:i,caret:a,dismissedToken:e.tokenStart})),requestAnimationFrame(()=>{T.current?.focus(),T.current?.setSelectionRange(a,a)})},te=(0,V.useCallback)(async e=>{t!==null&&await LYe(t,e)},[t]),ne=()=>{$N(t,`submit`,e)},re=()=>{$N(t,`queue`,e)},ie=k?o?`Interrupt the run and respond…`:`Ask anything · / for commands · $ for skills · @ for files…`:`Waiting for the session…`,ae=(0,H.jsxs)(Z,{variant:`danger-outline`,size:`lg`,"data-testid":`composer-abort`,disabled:s,onClick:()=>UN(t),children:[(0,H.jsx)(Jxe,{className:`h-2 w-2 fill-current`}),s?`Aborting…`:`Abort`]});return O&&n?.summary.sessionProvenance===`workflow`?null:O&&n!==null&&t!==null?(0,H.jsx)(`div`,{className:`shrink-0 px-3 pt-3 pb-2.5 sm:px-5`,children:(0,H.jsx)(EYe,{meta:n},t)}):d===null?a&&t!==null?(0,H.jsx)(`div`,{className:`shrink-0 px-3 pt-3 pb-2.5 sm:px-5`,children:(0,H.jsx)(OYe,{sessionId:t},t)}):(0,H.jsxs)(`div`,{className:`shrink-0 px-3 pt-3 pb-2.5 sm:px-5`,children:[(0,H.jsx)(zYe,{sessionId:t,count:A,disabled:!k||i===null||s,onClear:()=>RN(t),onDelete:e=>zN(e,A,t),onPromote:(e,n)=>BN(e,n,t),onResume:()=>VN(t),operationId:i?.operation?.id,paused:i?.paused},t),(0,H.jsx)(T4,{open:v!==null,onOpenChange:e=>{e||ee()},children:(0,H.jsx)(D4,{asChild:!0,children:(0,H.jsxs)(`div`,{ref:E,onDragOver:e=>{k&&e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,x(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||x(!1)},onDrop:e=>{x(!1),k&&e.dataTransfer.files.length!==0&&(e.preventDefault(),te(Array.from(e.dataTransfer.files)))},className:`relative rounded-xl border transition-colors focus-within:border-po-blue/60 focus-within:ring-2 focus-within:ring-po-blue/10 ${b?`border-po-blue bg-po-blue/5`:o?`border-po-edge-yellow`:`border-po-border`}`,children:[v?(0,H.jsxs)(O4,{side:`top`,align:`start`,sideOffset:8,"data-testid":`composer-completion`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{E.current?.contains(e.target)===!0&&e.preventDefault()},className:`max-h-[min(16rem,40dvh,var(--radix-popover-content-available-height))] w-[420px] max-w-[85vw] rounded-md p-0 shadow-xl sm:max-h-[min(20rem,50dvh,var(--radix-popover-content-available-height))]`,children:[(0,H.jsx)(`div`,{className:`min-h-0 overflow-y-auto overscroll-contain`,"data-testid":`composer-completion-options`,children:v.items.map((e,t)=>(0,H.jsxs)(Kq,{density:`compact`,active:t===v.selected,"data-testid":`composer-completion-item-${String(t)}`,onMouseEnter:()=>y({...v,selected:t}),onMouseDown:e=>{e.preventDefault(),F(v,t)},className:`w-full items-baseline gap-2.5 rounded-none px-3 py-1.5`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-base font-semibold text-po-hi`,children:e.label}),e.detail?(0,H.jsx)(qq,{density:`compact`,className:`text-sm text-po-dim`,children:e.detail}):null]},e.label))}),(0,H.jsx)(k4,{className:`py-1`,children:(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(k$,{children:`tab`}),` or `,(0,H.jsx)(k$,{children:`enter`}),` completes · `,(0,H.jsx)(k$,{children:`esc`}),` closes`]})})]}):null,(0,H.jsx)(`div`,{className:`flex min-w-0 items-start px-3 pt-3 sm:px-4 sm:pt-3.5`,children:(0,H.jsx)(N4,{variant:`bare`,ref:T,"data-testid":`composer-input`,value:f,disabled:!k,onChange:e=>{RM(t,t=>({...t,draft:e.target.value,caret:e.target.selectionStart,dismissedToken:null}))},onClick:e=>RM(t,t=>({...t,caret:e.currentTarget.selectionStart})),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length!==0&&(e.preventDefault(),te(t))},onKeyUp:e=>RM(t,t=>({...t,caret:e.currentTarget.selectionStart})),onKeyDown:e=>{if(e.key===` `&&f===``)e.preventDefault(),XP();else{if(v){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1,n=v.items.length;y({...v,selected:(v.selected+t+n)%n});return}if(e.key===`Tab`||e.key===`Enter`&&!RYe(v)){e.preventDefault(),F(v,v.selected);return}if(e.key===`Escape`){e.preventDefault(),ee();return}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ne()),e.key===`Escape`&&o&&!s&&(e.preventDefault(),UN(t))}},rows:1,placeholder:ie,className:`min-h-12 min-w-0 flex-1 text-lg leading-relaxed`})}),h.length>0?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3.5 pt-2`,"data-testid":`composer-attachments`,children:h.map(e=>(0,H.jsxs)(`span`,{"data-testid":`composer-attachment-${e.id}`,className:`flex max-w-full items-center gap-1.5 rounded border border-po-border bg-po-panel px-1.5 py-1 text-sm text-po-dim`,children:[e.kind===`image`?(0,H.jsx)(`img`,{src:e.dataUrl,alt:``,className:`h-6 w-6 rounded object-cover`}):(0,H.jsx)(`span`,{className:`font-semibold text-po-hi`,children:e.kind===`context`?`CTX`:e.kind===`file`?`FILE`:`TXT`}),(0,H.jsx)(`span`,{className:`max-w-40 truncate`,children:e.name}),(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"aria-label":`Remove ${e.name}`,className:`text-po-faint hover:text-po-text`,onClick:()=>{RM(t,t=>({...t,attachments:t.attachments.filter(t=>t.id!==e.id),attachmentError:``}))},children:(0,H.jsx)(jR,{className:`h-2.5 w-2.5`})})]},e.id))}):null,g?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`composer-attachment-error`,className:`px-3.5 pt-1.5 text-sm text-po-red`,children:g}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-2 pt-2 pb-2.5 sm:flex-nowrap sm:px-3 sm:pb-3`,children:[(0,H.jsxs)(T4,{open:S,onOpenChange:e=>{C(e),e&&ee()},children:[(0,H.jsx)(E4,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"data-testid":`composer-attach`,title:`Add to this message`,"aria-label":`Add to this message`,"aria-haspopup":`menu`,"aria-expanded":S,className:`shrink-0 text-po-dim`,children:(0,H.jsx)(SR,{className:`size-4`})})}),S?(0,H.jsxs)(O4,{side:`top`,align:`start`,sideOffset:8,"data-testid":`composer-menu`,className:`w-56 rounded-md p-1.5 shadow-xl`,onClick:e=>{e.target?.closest(`[data-testid="composer-attach-row"]`)||C(!1)},children:[(0,H.jsxs)(`label`,{"aria-disabled":!k,"data-testid":`composer-attach-row`,className:`relative overflow-hidden text-base font-medium text-po-text hover:bg-po-tint-blue ${Wq({density:`compact`})} ${k?``:`pointer-events-none opacity-40`}`,children:[(0,H.jsx)(SR,{className:`h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`File upload`}),(0,H.jsx)(`input`,{type:`file`,multiple:!0,disabled:!k,"aria-label":`Attach files`,className:`absolute inset-0 cursor-pointer opacity-0`,"data-testid":`composer-file-input`,onChange:e=>{te(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``,C(!1)}})]}),(0,H.jsx)(`span`,{className:`contents`,"data-testid":`composer-menu-items`,children:(0,H.jsx)(h3,{slot:s_.composerMenu,sessionId:t})})]}):null]}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1`}),(0,H.jsx)(`span`,{"data-testid":`composer-hint`,className:`text-sm text-po-dim max-md:hidden`,children:o?s?`Abort requested · waiting for the turn to stop`:`Enter steers the run · esc aborts`:`Shift + Enter for a new line`}),o?ae:null,(0,H.jsx)(`span`,{className:`contents`,"data-testid":`composer-actions`,children:(0,H.jsx)(h3,{slot:s_.composerActions,sessionId:t})}),(0,H.jsx)(Z,{variant:`outline`,size:`lg`,"data-testid":`composer-queue`,onClick:re,disabled:!k||w||_>0||!f.trim()&&h.length===0,title:`Deliver after the current run settles`,children:`Queue`}),(0,H.jsxs)(Z,{variant:`primary`,size:`lg`,"data-testid":`composer-send`,onClick:ne,disabled:!k||w||_>0||!f.trim()&&h.length===0,className:`gap-2 px-3 disabled:opacity-60 sm:px-4`,children:[(0,H.jsx)(Pxe,{"aria-hidden":!0,className:`size-4`}),o?`Steer`:`Send`]})]})]})})})]}):(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col px-3 pt-3 pb-2.5 sm:px-5`,children:[(0,H.jsx)(zYe,{sessionId:t,count:A,disabled:!k||i===null||s,onClear:()=>RN(t),onDelete:e=>zN(e,A,t),onPromote:(e,n)=>BN(e,n,t),onResume:()=>VN(t),operationId:i?.operation?.id,paused:i?.paused},t),(0,H.jsx)(`div`,{className:`flex min-h-0 flex-col rounded-lg border border-po-edge-magenta bg-po-deep`,children:(0,H.jsx)(TYe,{claim:d,sessionId:t})}),o?(0,H.jsx)(`div`,{className:`mt-2 flex justify-end`,children:ae}):null]})}var BYe=/^[a-z][a-z0-9+.-]*:/iu;function k3(e){return e.split(`/`).at(-1)||`download`}function VYe({mention:e,asset:t,openFile:n}){if(e.kind===`image`){let n=(0,H.jsx)(`img`,{src:t.url,alt:e.path,className:`max-h-[360px] max-w-full rounded border border-po-border`});return t.contentType===`image/svg+xml`?(0,H.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[n,(0,H.jsx)(XK,{asChild:!0,size:`md`,className:`max-w-full whitespace-normal break-all bg-po-panel text-po-text hover:border-po-blue/50`,children:(0,H.jsxs)(`a`,{href:t.url,download:k3(e.path),children:[(0,H.jsx)(rR,{className:`h-3 w-3 shrink-0 text-po-faint`}),`Download `,k3(e.path)]})})]}):(0,H.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,children:n})}return e.kind===`video`?(0,H.jsx)(`video`,{src:t.url,controls:!0,preload:`metadata`,className:`max-h-[360px] max-w-full rounded border border-po-border`,children:(0,H.jsx)(`track`,{kind:`captions`})}):e.kind===`pdf`?(0,H.jsx)(`iframe`,{src:t.url,title:e.path,sandbox:``,className:`h-[480px] w-full rounded border border-po-border bg-po-deep`}):n?(0,H.jsx)(XK,{asChild:!0,size:`md`,className:`max-w-full self-start whitespace-normal break-all bg-po-panel text-po-text hover:border-po-blue/50`,children:(0,H.jsxs)(`button`,{type:`button`,onClick:n,children:[(0,H.jsx)(rR,{className:`h-3 w-3 shrink-0 text-po-faint`}),e.path]})}):(0,H.jsx)(XK,{asChild:!0,size:`md`,className:`max-w-full self-start whitespace-normal break-all bg-po-panel text-po-text hover:border-po-blue/50`,children:(0,H.jsxs)(`a`,{href:t.url,download:k3(e.path),children:[(0,H.jsx)(rR,{className:`h-3 w-3 shrink-0 text-po-faint`}),e.path]})})}function HYe({sessionId:e,mention:t,onFileLink:n}){return BYe.test(t.path)?(0,H.jsx)(UYe,{mention:t,onFileLink:n}):(0,H.jsx)(WYe,{sessionId:e,mention:t,onFileLink:n})}function UYe({mention:e,onFileLink:t}){let n=t?.(e.path,!0),r=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(rR,{className:`h-3 w-3 shrink-0 text-po-faint`}),e.path]});return n?(0,H.jsx)(XK,{asChild:!0,size:`md`,className:`max-w-full self-start whitespace-normal break-all bg-po-panel text-po-text hover:border-po-blue/50`,children:(0,H.jsx)(`button`,{type:`button`,onClick:n,children:r})}):(0,H.jsx)(XK,{size:`md`,className:`max-w-full self-start whitespace-normal break-all bg-po-panel text-po-dim`,children:r})}function WYe({sessionId:e,mention:t,onFileLink:n}){let[r,i]=(0,V.useState)();return(0,V.useEffect)(()=>{let n=!0,r;return BA(e,t.path).then(e=>{n?(r=e,i(e)):e.dispose()}).catch(()=>{n&&i(null)}),()=>{n=!1,r?.dispose()}},[t.path,e]),r?(0,H.jsx)(VYe,{mention:t,asset:r,openFile:n?.(t.path,!0)}):(0,H.jsxs)(XK,{size:`md`,className:`max-w-full self-start whitespace-normal break-all bg-po-panel text-po-dim`,children:[(0,H.jsx)(rR,{className:`h-3 w-3 shrink-0`}),r===null?`Could not load ${t.path}`:t.path]})}function GYe({sessionId:e,mentions:t,onFileLink:n}){let r=t.filter(e=>e.kind!==`directory`);return r.length===0?null:(0,H.jsx)(`div`,{"data-testid":`mention-previews`,className:`flex flex-col gap-2`,children:r.map(t=>(0,H.jsx)(`div`,{"data-testid":`mention-preview`,"data-kind":t.kind,"data-path":t.path,children:(0,H.jsx)(HYe,{sessionId:e,mention:t,onFileLink:n},`${e}\u0000${t.path}`)},t.path))})}var A3=(0,V.memo)(function({sessionId:e,onFileLink:t,text:n,slotProps:r}){let i=(0,V.useCallback)(t=>e===null?Promise.reject(Error(`The session is unavailable.`)):BA(e,t).then(e=>({...e,path:t})),[e]),a=(0,V.useMemo)(()=>kq(r),[r]);return(0,H.jsx)(a4,{text:n,onFileLink:t,loadImage:i,renderMediaReview:a})});function KYe(e){let t=e.findLast(e=>e.kind===`assistant`&&e.text.trim()!==``);return t?.kind===`assistant`?t.text:void 0}function qYe(e,t){return e===void 0?{status:`unavailable`,tone:`dim`}:e.attach===`offline`&&e.reason===`This app is older than the Po server. Update Po to reconnect.`?{status:`update required`,tone:`magenta`}:e.attach===`refused`?{status:`another cockpit holds this session`,tone:`red`}:e.summary.dormant===!0||e.attach===`closed`?{status:`stopped`,tone:`dim`}:e.attach===`offline`||e.attach===`detached`?{status:`disconnected`,tone:`red`}:e.attach===`connecting`?{status:`connecting`,tone:`yellow`}:e.summary.awaitingInput?{status:`waiting for your input`,tone:`yellow`}:(e.summary.pendingApprovalCount??0)>0?{status:`waiting for your approval`,tone:`magenta`}:e.summary.phase!==`idle`||!t.hasNewerHistory&&t.streaming?{status:`working`,tone:`yellow`}:{status:`idle`,tone:`green`}}function JYe(e,t){return{...qYe(e,t),message:t.hasNewerHistory?`Latest message unavailable while viewing older history.`:KYe(t.entries)??`No assistant message in loaded history.`}}function YYe({sessionId:e,onOpenConversation:t}){let n=U(aN(e),e=>e),r=JYe(oye(e),n);return(0,H.jsxs)(`section`,{"data-testid":`session-activity`,"aria-label":`Session activity`,className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 text-lg font-semibold text-po-hi`,children:[(0,H.jsx)(GK,{tone:r.tone===`dim`?`neutral`:r.tone}),`session activity`]}),(0,H.jsx)(`span`,{className:`truncate text-sm text-po-dim`,children:r.status})]}),(0,H.jsx)(`p`,{className:`max-h-[5.5rem] overflow-y-auto text-base leading-snug break-words text-po-text`,children:r.message}),(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-auto px-0 text-po-dim hover:text-po-hi`,onClick:t,children:`open conversation`})]})}var XYe=12;function j3(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ZYe(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:e===`application/pdf`?`pdf`:e.startsWith(`text/`)?`text`:`file`}function QYe(e,t){for(let t of[`title`,`name`,`filename`,`fileName`])if(typeof e[t]==`string`&&e[t].length>0)return e[t];return typeof e.uri==`string`&&e.uri.length>0?e.uri.split(`/`).at(-1)||e.uri:`attachment-${String(t+1)}`}function $Ye(e){let t=e.result?.content??[],n=aA(t).flatMap((t,n)=>t.data===void 0?[]:[{kind:`image`,mimeType:t.mimeType,name:`${e.name}-result-${String(n+1)}`,data:t.data}]),r=j3(e.result?.details)?e.result.details:void 0,i=[...t,...Array.isArray(r?.blocks)?r.blocks:[]].flatMap((e,t)=>{if(!j3(e)||e.type===`text`||e.type===`image`)return[];let n=e.type===`resource`&&j3(e.resource)?e.resource:e,r=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,i=typeof n.data==`string`?n.data:typeof n.blob==`string`?n.blob:void 0,a=typeof n.text==`string`?n.text:void 0,o=typeof n.uri==`string`?n.uri:void 0;return i===void 0&&a===void 0&&o===void 0?[]:[{kind:ZYe(r),mimeType:r,name:QYe(n,t),data:i,text:a,uri:o}]});return[...n,...i]}function eXe(e){if(e.data!==void 0)return`data:${e.mimeType};base64,${e.data}`;if(e.uri!==void 0)return/^(?:https?):\/\//u.test(e.uri)?e.uri:void 0}function tXe({attachment:e,index:t}){let n=eXe(e);return e.kind===`text`&&e.text!==void 0?(0,H.jsx)(`pre`,{"data-testid":`tool-output-text-file`,className:`max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md border border-po-border-soft p-2`,children:e.text}):n!==void 0&&e.kind===`image`?(0,H.jsx)(o4,{src:n,alt:e.name,"data-testid":`tool-output-image`,className:`h-auto max-h-96 max-w-full rounded-md border border-po-border-soft object-contain`}):n!==void 0&&e.kind===`video`?(0,H.jsx)(`video`,{src:n,controls:!0,preload:`metadata`,"data-testid":`tool-output-video`,className:`max-h-96 max-w-full self-start rounded-md border border-po-border-soft`,children:(0,H.jsx)(`track`,{kind:`captions`})}):n!==void 0&&e.kind===`audio`?(0,H.jsx)(`audio`,{src:n,controls:!0,preload:`metadata`,"data-testid":`tool-output-audio`,className:`w-full`,children:(0,H.jsx)(`track`,{kind:`captions`})}):n!==void 0&&e.kind===`pdf`?(0,H.jsx)(`iframe`,{src:n,title:e.name,"data-testid":`tool-output-pdf`,className:`h-[480px] w-full rounded-md border border-po-border-soft bg-po-deep`}):n===void 0?(0,H.jsxs)(`span`,{"data-testid":`tool-output-file`,className:`self-start rounded-md border border-po-border px-3 py-2 text-base text-po-dim`,children:[e.name,` · `,e.mimeType]},t):(0,H.jsxs)(`a`,{href:n,download:e.name,target:`_blank`,rel:`noreferrer`,"data-testid":`tool-output-file`,className:`self-start rounded-md border border-po-border px-3 py-2 text-po-blue hover:border-po-blue/60`,children:[e.name,` · `,e.mimeType]})}function nXe(e){return e.running?`running`:e.isError?`error`:`ok`}function rXe({entry:e,slotProps:t}){let n=e.output.length>0?e.output.split(`
|
|
140
140
|
`):[],r=$Ye(e);return(0,H.jsx)(b4,{tone:nXe(e),expandable:n.length>XYe,children:({expanded:i})=>{let{shown:a,hidden:o}=kO(n,XYe,i);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S4,{title:e.name,children:(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.argSummary})}),a.length>0||r.length>0?(0,H.jsxs)(ZKe,{className:`flex flex-col gap-2`,children:[a.length>0?(0,H.jsx)(`pre`,{"data-testid":`tool-output`,className:`whitespace-pre-wrap break-words`,children:(0,H.jsx)(Yqe,{text:a.join(`
|
|
141
141
|
`),onFileLink:e=>{let n=t.fileTabFor(e);return n&&(()=>t.openTransientTab(n))}})}):null,r.map((e,t)=>(0,H.jsx)(tXe,{attachment:e,index:t},`${e.mimeType}:${e.name}:${String(t)}`)),o>0?(0,H.jsxs)($Ke,{expands:!0,children:[`show `,o,` more line(s)`]}):null]}):null]})}})}function iXe(e,t,n,r){let i=hv(t.toolName,r,t.result?.details);if(!i)return null;let a={...n,toolCallId:`${e.toolCallId}:${t.toolName}`,toolName:t.toolName,args:t.args,statuses:r,result:t.result,output:rA(t.result?.content),running:!1,isError:t.isError};return(0,H.jsx)(Mk,{toolName:t.toolName,children:e=>e?(0,H.jsx)(`pre`,{className:`whitespace-pre-wrap break-words text-sm`,children:a.output}):(0,H.jsx)(i.message,{...a})})}var M3=(0,V.memo)(function({entry:e,slotProps:t,statuses:n}){let r=KP(e.result),i=(0,V.useMemo)(()=>r===e.result?e:{...e,result:r},[e,r]),a=hv(i.name,n,i.result?.details),o=nXe(i),s={...eM(t,i,n),renderTool:e=>iXe(i,e,t,n)},c=n[`repository-hooks:${i.toolCallId}:post`]?.trim(),l=c?(0,H.jsx)(g4,{tone:`running`,title:c,"aria-label":c,"data-testid":`tool-hook-status`,children:`HOOK`}):null;return(0,H.jsx)(Mk,{toolName:i.name,children:e=>(0,H.jsx)(`div`,{"data-testid":`entry-tool`,"data-tool-name":i.name,"data-tool-state":o,"data-tool-renderer":e?`failed`:a?`plugin`:`host`,children:(0,H.jsx)(_4,{value:l,children:a&&!e?(0,H.jsx)(a.message,{...s}):(0,H.jsx)(rXe,{entry:i,slotProps:t})})})},i.toolCallId)});function aXe(e){return typeof e==`object`?e.key:e}function oXe(e,t){let n=e.length;return new Proxy(e,{get(e,r,i){if(typeof r==`string`){let i=r.charCodeAt(0);if(i>=48&&i<=57){let i=+r;if(Number.isInteger(i)&&i>=0&&i<n){let n=e[i];if(typeof n!=`object`){let r=t[i*2];n=e[i]={index:i,key:n,start:r,size:t[i*2+1],end:r+t[i*2+1],lane:0}}return n}}if(r===`length`)return n}return Reflect.get(e,r,i)}})}function N3(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return(o.length!==r.length||o.some((e,t)=>r[t]!==e))&&(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1),i}return o.updateDeps=e=>{r=e},o}function sXe(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var P3=(e,t)=>Math.abs(e-t)<1.01,cXe=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})};function lXe({offset:e,isScrolling:t,elementMax:n,holdOffset:r,scrollOffset:i,pendingWrite:a,clampedMaxAtWrite:o}){return t&&a===null&&e===i?`spurious`:a!==null&&Math.abs(e-a.target)<1.5?`readBack`:a!==null&&!a.smooth&&n!==null&&a.target>n+r+.5&&Math.abs(e-(n+r))<1.5||a!==null&&!a.smooth&&a.lowMaxes?.some(t=>Math.abs(e-t)<1.5)?`clampedReadBack`:o!==null&&Math.abs(e-o)<1.5?`clampedEcho`:`external`}var uXe=e=>e===`smooth`||e===`smoothFinishing`;function dXe({kind:e,offset:t,command:n,target:r}){return e!==`spurious`&&e!==`readBack`&&e!==`clampedReadBack`&&n?.index!=null&&n.phase!==`queued`&&!uXe(n.phase)&&!P3(t,n.lastTargetOffset)&&!P3(t,r())&&e!==`clampedEcho`}var F3=40;function fXe(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<F3;)n--;if(n<0)return!1;let r=e[n],i=n-1;for(;i>=0&&r.t-e[i].t<F3;)i--;if(i<0)return!1;let a=e[i],o=(t.offset-r.offset)/(t.t-r.t),s=(r.offset-a.offset)/(r.t-a.t);return o*s>=0&&Math.abs(o)>=2*Math.abs(s)&&Math.abs(o)-Math.abs(s)>=.8}function pXe(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<F3;)n--;if(n<0)return!1;let r=e[n];return Math.abs(t.offset-r.offset)/(t.t-r.t)>=.05}var I3,L3=()=>{if(I3!==void 0)return I3;if(typeof navigator>`u`)return I3=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return I3=!0;let e=navigator.maxTouchPoints;return I3=navigator.platform===`MacIntel`&&e!==void 0&&e>0},R3,mXe=()=>R3===void 0?R3=L3()&&typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`overflow-anchor: auto`):R3,z3={capture:!0,passive:!0},hXe=class{constructor(e){this.host=e,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!==`lateFling`,this.dragging=()=>this._touch?.phase===`down`&&this._touch.moved,this.tail=()=>this._touch?.phase===`tail`?this._touch.moved?`fling`:`tap`:null,this.onScroll=({isScrolling:e,ownReadBack:t,moved:n,external:r})=>(e&&this._touch?.phase===`tail`?this._openTail(this._touch.moved||!t,!1):this._touch?.phase===`lateFling`&&(this.host.now()>this._touch.until?this._touch=null:r&&e&&n&&this._openTail(!0,!1)),!t&&e&&n&&this._touch?.phase===`down`?(this._touch.moved=!0,!0):!1),this.touchStart=()=>{this.end(),this._touch={phase:`down`,moved:!1}},this.touchEnd=()=>{let e=this._touch?.phase===`down`&&this._touch.moved;this.end(),this._openTail(e,e)},this.end=()=>{let e=this.host.getWindow();this._touch?.phase===`tail`&&e!=null&&e.clearTimeout(this._touch.timerId),this._touch=null},this.listen=e=>{let t=()=>this.touchStart(),n=()=>this.touchEnd();return e.addEventListener(`touchstart`,t,z3),e.addEventListener(`touchend`,n,z3),e.addEventListener(`touchcancel`,n,z3),()=>{e.removeEventListener(`touchstart`,t,z3),e.removeEventListener(`touchend`,n,z3),e.removeEventListener(`touchcancel`,n,z3),this.end()}},this._openTail=(e,t)=>{let n=this.host.getWindow();if(!L3()||n==null)return;this.end();let r={phase:`tail`,moved:e,awaitingFling:t,timerId:n.setTimeout(()=>{this.host.tailStillMoving()?this._openTail(r.moved,r.awaitingFling):(this._touch=r.awaitingFling?{phase:`lateFling`,until:this.host.now()+1e3}:null,this.host.onTailClosed())},150)};this._touch=r}}get touch(){return this._touch}},gXe=e=>{let{clientWidth:t,clientHeight:n}=e;return{width:t,height:n}},_Xe=e=>{let t=new Set;return{schedule:n=>{let r=e.requestAnimationFrame(()=>{t.delete(r),n()});t.add(r)},cancel:()=>{t.forEach(t=>e.cancelAnimationFrame(t)),t.clear()}}},vXe=e=>e,yXe=e=>{let t=e.overscan*Math.max(e.lanes??1,1),n=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-n+1,i=Array(r);for(let e=0;e<r;e++)i[e]=n+e;return i},bXe=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(gXe(n)),!r.ResizeObserver)return()=>{};let a=_Xe(r),o=new r.ResizeObserver(()=>{let t=()=>{i(gXe(n))};e.options.useAnimationFrameWithResizeObserver?a.schedule(t):t()});return o.observe(n,{box:`content-box`}),()=>{o.unobserve(n),a.cancel()}},xXe={passive:!0},SXe=typeof window>`u`||`onscrollend`in window,CXe=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&SXe,o=0,s=a?null:cXe(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,xXe),a&&r.addEventListener(`scrollend`,u,xXe),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},wXe=(e,t)=>CXe(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),TXe=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},EXe=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},DXe=(e,t)=>e===`smooth`?t?`smoothLanded`:`smooth`:`instant`,B3=e=>e?.phase===`smooth`||e?.phase===`smoothLanded`;function OXe(e,t,n,r){if(t===0)return!1;let i=r(0),a=new Set,o=0;for(;o<e;){let e=n(o);if(e===i)break;a.add(e),o++}let s=e-o;if(s===0||s>=t)return!1;for(let e=0;e<s;e++)if(r(e)!==n(o+e))return!1;for(let e=s;e<t;e++)if(a.has(r(e)))return!1;return!0}var kXe=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new hXe({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let e=this.scrollState;if(e?.phase!==`queued`||this.pendingWrite!==null)return!1;let t=this._readElementOffset();return t===null||this._lastElementOffset===null||Math.abs(t-this._lastElementOffset)<1?!1:(this._lastElementOffset=t,e.samples=[...e.samples??[],{t:this.now(),offset:t}],!0)},onTailClosed:()=>{let e=this.scrollState;e?.phase===`queued`&&pXe(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=null,n=()=>{if(e)return e;let n=this.targetWindow;if(!n||!n.ResizeObserver)return null;let i=t=_Xe(n);return e=new n.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(r)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment())}};this.options.useAnimationFrameWithResizeObserver?i.schedule(t):t()})},r=e=>{let t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),t?.cancel(),e=null,t=null},observe:e=>n()?.observe(e,{box:`border-box`}),unobserve:e=>n()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:vXe,rangeExtractor:yXe,onChange:()=>{},measureElement:TXe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=this._singleLaneMeasurements?.items??s,l=e=>aXe(c[e]),u=e>0?l(0):null,d=e>0?l(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==u||t.getItemKey(o-1)!==d)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==d)&&(o>e||OXe(e,o,l,t.getItemKey))&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=null;if(r&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[e,t]=r,n=this.getMeasurements(),{count:a,getItemKey:s}=this.options,c=0;for(;c<a&&s(c)!==e;)c++;if(c<a){let e=n[c];if(e){let n=Math.max(0,e.start+t);!i&&n!==this.scrollOffset&&(o=n-this.scrollOffset,this.scrollOffset=n)}}}i?this.pendingScrollAnchor={kind:`follow`,behavior:i}:o!==null&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:`anchor`,delta:o}:(this._holdOffset+=o,this._followOffsetTarget(o)))},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=N3(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var e;this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(e=this._momentumStop)==null||e.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{let n=t?this._elementMaxScrollOffset():null,r=this._reportedOverscroll;this._reportedOverscroll=e<0||n!==null&&e>n+1;let i=e;this._lastElementOffset=i,e=this._toLayoutOffset(e);let a=this._classifyScrollEvent(e,t,n);if(a===`spurious`)return;a===`readBack`?e=this.pendingWrite.target:a===`clampedReadBack`&&this.scrollState?.index!=null&&e<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=e:dXe({kind:a,offset:e,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let o=this.getScrollOffset(),s=this.scrollDirection;this.scrollDirection=t?o===e?this.scrollDirection:o<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t;let c=this.scrollState;if(c?.phase===`queued`&&a===`external`&&t){if(r||this._reportedOverscroll)c.samples=[];else{let e=this.now();c.samples=[...(c.samples??[]).filter(t=>e-t.t<=200),{t:e,offset:i}],(s!==null&&this.scrollDirection!==s||fXe(c.samples))&&(this.scrollState=null)}}this._iosGesture.onScroll({isScrolling:t,ownReadBack:a===`readBack`,moved:e!==o,external:a===`external`&&this.scrollState?.phase!==`smooth`&&this.scrollState?.phase!==`smoothFinishing`})&&this.scrollState?.phase===`queued`&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let t=this.pendingScrollAnchor;this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled&&(t.kind===`anchor`?this._canWriteScroll()?B3(this.scrollState)&&!P3(this.getScrollOffset()-t.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(t.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=t.delta,this._followOffsetTarget(t.delta),this.notify(!1)):this.scrollToEnd({behavior:t.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(e,t,n)=>lXe({offset:e,isScrolling:t,elementMax:n,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:this._clampedAdjustment?.maxAtWrite??null}),this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>t+.5&&(this._clampedAdjustment=e>n+.5?{target:e,maxAtWrite:n}:null,this._scrollToOffset(e))},this._writeAwaitingCommand=()=>{let e=this.scrollState;if(e===null||e.phase!==`queued`)return;let{behavior:t}=e;this.getMeasurements();let n=this.getScrollStateTarget(e);e.lastTargetOffset=n,this._clampedAdjustment=null,e.phase=DXe(t,e.index!=null&&P3(n,this.getScrollOffset())),this._scrollToOffset(n,{behavior:t}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let e=this.scrollElement;if(e==null)return null;let{horizontal:t,isRtl:n}=this.options;return typeof e.scrollTop==`number`?t?e.scrollLeft*(n&&-1||1):e.scrollTop:typeof e.scrollY==`number`?t?e.scrollX:e.scrollY:null},this._canWriteScroll=()=>!(L3()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=e=>{if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||this.scrollState?.phase===`smooth`)return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(e);let t=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(t),this._scrollToOffset(t)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=N3(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=N3(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._singleLaneMeasurements?.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e}let o=u===0?Array(e):this._singleLaneMeasurements.items.slice(),c;if(u===0)c=t+n;else{let e=u-1;c=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t);o[t]=e;let n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=c,a[t*2+1]=i,c+=i+s}this._singleLaneMeasurements={flat:a,items:o};let d=oXe(o,a);return this.measurementsCache=d,d}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=N3(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=MXe(e,t,n,r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=N3(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,n,r,i,a)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n,lanes:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!B3(this.scrollState))return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;if(!this.isIndexInRange(e))return;this._resizeBatch?.sync&&this.getMeasurements();let r,i,a,o=this._singleLaneMeasurements?.flat;if(this.options.lanes===1&&o!=null)a=this.options.getItemKey(e),i=o[e*2],r=o[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let s=this.itemSizeCache.get(a)??r,c=t-s;if(c!==0){let o=this.options.anchorTo===`end`&&!B3(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,l=o?this._getLayoutTotalSize():0,u=this.getScrollOffset(),d=this.itemSizeCache.has(a)?i+s<=u&&this.scrollDirection!==`backward`:i<u,f=!B3(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?d:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},c,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++;let p=!1;if(this._awaitingCommandReadBack()||(o?p=this.applyScrollAdjustment(this._getLayoutTotalSize()-l):f&&(p=this.applyScrollAdjustment(c))),this._resizeBatch){this._resizeBatch.notify=!0,(n=this._resizeBatch).sync||(n.sync=p);return}this.notify(p),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=N3(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(e,t,n)=>{let r=[];for(let i=0,a=e.length;i<a;i++){let a=t[e[i]];r.push(n===0?a:{...a,start:a.start-n,end:a.end-n})}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._singleLaneMeasurements?.flat,r=this.options.lanes===1&&n!=null;return sXe(t[AXe(0,t.length-1,r?e=>n[e*2]:e=>sXe(t[e]).start,e)])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let e=this._elementMaxScrollOffset();if(e===null)return;let t=this.pendingWrite,n=Math.max(e,0)+this._holdOffset;if(n>=t.target)return;let r=t.lowMaxes??=[];r[r.length-1]!==n&&r.push(n)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=e=>{let t=e+this._holdOffset;return this.pendingScrollAnchor?.kind===`anchor`&&(t+=this.pendingScrollAnchor.delta),t},this._elementMaxScrollOffset=()=>{let e=this.scrollElement;if(e===null)return null;if(`scrollHeight`in e)return this.options.horizontal?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight;if(`document`in e){let t=e.document.documentElement;return this.options.horizontal?t.scrollWidth-e.innerWidth:t.scrollHeight-e.innerHeight}return null},this._momentumStop=null,this._stopMomentum=e=>{let t=this.scrollElement,n=this.targetWindow;if(t===null||n===null)return;let r=`document`in t?t.document.scrollingElement:t;if(!r?.style)return;if(this._momentumStop){this._momentumStop.done=e;return}let{style:i}=r,a=this.options.horizontal?`overflow-x`:`overflow-y`,o=i.getPropertyValue(a),s=i.getPropertyPriority(a);i.setProperty(a,`hidden`,`important`);let c={restore:()=>i.getPropertyValue(a)!==`hidden`||i.getPropertyPriority(a)!==`important`?!1:(i.setProperty(a,o,s),!0),done:e};this._momentumStop=c,n.requestAnimationFrame(()=>n.requestAnimationFrame(()=>{this._momentumStop===c&&(this._momentumStop=null,c.restore()&&c.done())}))},this._clampedBy=e=>{let t=this._elementMaxScrollOffset();if(t===null)return null;let n=t+this._holdOffset;return e>n+.5?{target:e,maxAtWrite:n}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1){let e=this.getMaxScrollOffset(),n=e-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(n,e),0),t]}let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._startScroll({index:null,align:t},this.getOffsetForAlignment(e,t),n,`absolute`)},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r;this._startScroll({index:e,align:a},i,n,`absolute`)},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+e,`start`);this._startScroll({index:null,align:`start`},n,t,`relative`)},this.scrollToEnd=({behavior:e=`auto`}={})=>{this.options.count>0?this._startScroll({index:this.options.count-1,align:`end`,toEnd:!0},Math.max(this.getMaxScrollOffset(),0),e,`absolute`):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._singleLaneMeasurements?.flat;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n}={})=>{let r={target:e+(t??0),smooth:n===`smooth`};return this.pendingWrite=r,this.options.scrollToFn(e-this._holdOffset,{behavior:n,adjustments:t},this),r},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let e=this.getCommandWrittenOffset();return!(L3()&&this._iosGesture.dragging())&&e!==null&&!P3(e,this.getScrollOffset())},this._followOffsetTarget=e=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=e)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}get scrollAdjustments(){return 0}applyScrollAdjustment(e,t){if(e===0)return!1;if(this._followOffsetTarget(e),this._canWriteScroll()){let n=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(n+e);let r=this._scrollToOffset(n,{adjustments:e,behavior:t});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=e),this.scrollOffset<0&&(this.scrollOffset=0)),!0}return this._holdOffset+=e,this.scrollOffset!==null&&(this.scrollOffset+=e),!0}scheduleScrollReconcile(){this.targetWindow?this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}):this.scrollState=null}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:e.index==null?void 0:this.getOffsetForIndex(e.index,e.align);return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase===`queued`){this.scheduleScrollReconcile();return}this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,n=e!==this.scrollState.lastTargetOffset;if(!n&&P3(e,this.getScrollOffset())){if(this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothLanded`:this.scrollState.phase===`smoothFinishing`&&(this.scrollState.phase=`instant`),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let t=this.getSize()||600,n=Math.abs(e-this.getScrollOffset()),r=B3(this.scrollState)&&n>t;this.scrollState.lastTargetOffset=e,r?this.scrollState.phase=`smooth`:this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothFinishing`:this.scrollState.phase===`smoothLanded`&&(this.scrollState.phase=`instant`),this._scrollToOffset(e,{behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}_startScroll(e,t,n,r){let i=this._iosGesture.tail();if(r===`absolute`&&i!==null){if(i===`fling`&&mXe()){this._stopMomentum(()=>{this.scrollState?.phase!==`queued`||this._iosGesture.tail()!==`fling`||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:`queued`,behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:n,phase:DXe(n,e.index!=null&&P3(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}},AXe=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function jXe(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function MXe(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=jXe(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=AXe(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var V3=typeof document<`u`?V.useLayoutEffect:V.useEffect;function NXe({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=V.useReducer(e=>e+1,0)[1],a=V.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=V.useRef(!1),s=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},c=(e,t,n)=>{let r=a.current,i=!!e.options.horizontal,o=t.start-e.options.scrollMargin;r.lastPositions.get(n)!==o&&(r.lastPositions.set(n,o),r.mode===`transform`?n.style.transform=i?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:n.style[i?`left`:`top`]=`${o}px`)},l=e=>{let t=a.current;if(t.enabled&&t.container){s(e);for(let t of e.getVirtualItems()){let n=e.elementsCache.get(t.key);n&&c(e,t,n)}}},u={...r,onChange:(t,n)=>{var s;let c=a.current,u=!0;if(c.enabled){l(t);let e=t.range,n=c.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n&&!o.current?(0,az.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[d]=V.useState(()=>{let e=new kXe(u),t=e.measureElement;return e.measureElement=n=>{o.current=!0;try{t(n)}finally{o.current=!1}let r=a.current;if(n!==null&&r.enabled&&r.container){let t=e.measurementsCache[e.indexFromElement(n)];t&&c(e,t,n)}},Object.assign(e,{containerRef:t=>{let n=a.current;n.container=t,n.lastSize=null,t!==null&&l(e)}})});return d.setOptions(u),V3(()=>d._didMount(),[]),V3(()=>(s(d),d._willUpdate())),V3(()=>{l(d)}),d}function PXe(e){return NXe({observeElementRect:bXe,observeElementOffset:wXe,scrollToFn:EXe,...e})}var FXe=new WeakMap,IXe=[`Review the working tree and summarise the diff`,`Run the affected nx targets and report failures`,`Explain how the session socket handshake works`],LXe=200,RXe=400;function zXe(e){if(/\s/u.test(e)||!/^https?:\/\//i.test(e))return null;try{let t=new URL(e);return t.protocol!==`http:`&&t.protocol!==`https:`||!t.host||t.username||t.password?null:t.href}catch{return null}}function BXe({speaker:e,identity:t,sender:n,unattributed:r=!1}){if(e===`assistant`){let e=t?.name??t?.profile??`Po`,n=t?Uk(e):`PO`;return(0,H.jsxs)(RK,{"aria-label":e,className:`size-9 shrink-0 border border-po-border-soft bg-po-deep`,children:[(0,H.jsx)(zK,{src:t?.icon??`/favicon.svg`,alt:``,className:t?.icon?`rounded-full p-0.5`:`object-contain p-1`}),(0,H.jsx)(BK,{className:`text-po-magenta`,children:n})]})}if(n&&n.kind!==`human`)return(0,H.jsxs)(RK,{"aria-label":n.name,className:`size-9 shrink-0 border border-po-border-soft bg-po-deep`,children:[(0,H.jsx)(zK,{src:`/favicon.svg`,alt:``,className:`object-contain p-1`}),(0,H.jsx)(BK,{className:`text-po-magenta`,children:Uk(n.name)})]});let i=r&&!n;return(0,H.jsx)(RK,{"aria-label":n?.name??(i?VXe:`You`),className:`size-9 shrink-0 border border-po-border bg-po-panel`,children:(0,H.jsx)(BK,{className:`bg-po-panel text-po-dim`,children:i?`?`:(0,H.jsx)(AR,{"aria-hidden":`true`,className:`size-4`})})})}var VXe=`Sender not recorded`;function HXe({actions:e,disabled:t,actionsDisabled:n,onQuote:r,onRewind:i,userMessage:a}){return(0,H.jsxs)(`div`,{"data-testid":`entry-actions`,className:`pointer-events-none absolute right-1 bottom-0 z-10 flex max-w-[calc(100%-0.5rem)] translate-y-1/2 flex-wrap justify-end gap-1 rounded-md border border-po-border-soft bg-po-panel p-0.5 opacity-0 shadow-sm transition-opacity group-hover/message:pointer-events-auto group-hover/message:opacity-100 group-focus-within/message:pointer-events-auto group-focus-within/message:opacity-100 [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100`,children:[a?e.map(e=>{let t=e.icon;return(0,H.jsx)(Z,{variant:`subtle`,size:t?`icon`:`sm`,"data-testid":`entry-plugin-action`,"aria-label":e.label,title:e.label,disabled:n,onMouseDown:e=>e.preventDefault(),onClick:()=>e.run(a),className:t?`border-0 shadow-none`:`h-6 border-0 px-2 shadow-none`,children:t?(0,H.jsx)(t,{"aria-hidden":!0,className:`h-3 w-3`}):e.label},`${e.pluginId}.${e.id}`)}):null,(0,H.jsx)(Z,{variant:`subtle`,size:`icon`,"data-testid":`entry-rewind`,"aria-label":`Rewind to message`,title:t?`Wait for the current response before rewinding`:`Rewind to message`,disabled:t||n,onMouseDown:e=>e.preventDefault(),onClick:i,className:`border-0 shadow-none`,children:(0,H.jsx)(jxe,{"aria-hidden":`true`,className:`h-3 w-3`})}),(0,H.jsx)(Z,{variant:`subtle`,size:`icon`,"data-testid":`entry-quote`,"aria-label":`Quote message`,title:`Quote message`,disabled:n,onMouseDown:e=>e.preventDefault(),onClick:r,className:`border-0 shadow-none`,children:(0,H.jsx)(Oxe,{"aria-hidden":`true`,className:`h-3 w-3`})})]})}var UXe=[],WXe=new Intl.NumberFormat(void 0,{style:`unit`,unit:`kilobyte`,maximumFractionDigits:0});function GXe({images:e,files:t}){let n=KP(e).filter(e=>e.data!==void 0&&iA(e.mimeType));return n.length===0&&t.length===0?null:(0,H.jsxs)(`div`,{"data-testid":`user-attachments`,className:`flex flex-wrap items-start gap-2`,children:[n.map((e,t)=>(0,H.jsx)(o4,{src:`data:${e.mimeType};base64,${e.data}`,alt:`Attachment ${String(t+1)}`,"data-testid":`user-attached-image`,className:`h-32 w-auto max-w-60 rounded-md border border-po-border-soft object-cover`},`${e.mimeType}:${e.ref?.entryId??e.data?.slice(0,24)}:${String(t)}`)),t.map(e=>(0,H.jsxs)(`span`,{"data-testid":`user-attached-file`,title:e.path,className:`flex max-w-60 items-center gap-2 rounded-md border border-po-border-soft bg-po-panel px-2.5 py-1.5 text-sm`,children:[(0,H.jsx)(rR,{"aria-hidden":!0,className:`size-4 shrink-0 text-po-dim`}),(0,H.jsx)(`span`,{className:`truncate text-po-text`,children:e.name}),(0,H.jsx)(`span`,{className:`shrink-0 text-po-dim`,children:WXe.format(Math.max(1,Math.round(e.size/1024)))})]},e.path))]})}function H3({timestamp:e}){if(e===void 0)return null;let t=new Date(e);return(0,H.jsx)(`time`,{"data-testid":`entry-time`,dateTime:t.toISOString(),className:`shrink-0 pt-0.5 text-sm text-po-dim tabular-nums`,children:t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})})}function KXe({entry:e,slotProps:t,statuses:n}){let r=hv(e.name,n)?.timelinePresentation??`tool`;return(0,H.jsx)(`div`,{"data-testid":`entry-tool-row`,"data-tool-presentation":r,className:r===`tool`?`min-w-0 sm:pl-12`:`min-w-0`,children:(0,H.jsx)(M3,{entry:e,slotProps:t,statuses:n})})}function qXe({name:e,entries:t,slotProps:n,statuses:r}){return(0,H.jsx)(`div`,{"data-testid":`entry-tool-row`,"data-tool-presentation":`tool`,className:`min-w-0 sm:pl-12`,children:(0,H.jsx)(KKe,{"data-testid":`entry-tool-group`,"data-tool-name":e,"data-tool-count":t.length,tone:Xj(t),title:e,summary:`· ${Zj(t)}`,className:`min-w-0`,children:t.map(e=>(0,H.jsx)(M3,{entry:e,slotProps:n,statuses:r},e.id))})})}var JXe=(0,V.memo)(function({entry:e,onFileLink:t,pluginActions:n,sessionId:r,sessionIdentity:i,sessionStreaming:a,runtimeActionsDisabled:o,slotProps:s,toolStatuses:c,compact:l,childThread:u}){let d=(0,V.useRef)(null),f=e=>{let t=window.getSelection(),n=d.current,i=Dye(r,n!==null&&t!==null&&!t.isCollapsed&&t.anchorNode!==null&&t.focusNode!==null&&n.contains(t.anchorNode)&&n.contains(t.focusNode)?t.toString():e);i!==null&&requestAnimationFrame(()=>Rk(i))};if(e.kind===`user`){let i=e.sender?.name??(u?VXe:void 0),c=Zye(e.text,(e.images?.length??0)>0);return(0,H.jsxs)(`div`,{"data-testid":`entry-user`,className:`group/message flex flex-row-reverse items-start gap-3`,children:[(0,H.jsx)(BXe,{speaker:`user`,sender:e.sender,unattributed:u}),(0,H.jsxs)(`div`,{className:`relative min-w-0 max-w-4/5`,children:[i?(0,H.jsx)(`div`,{"data-testid":`entry-user-sender`,className:`mb-1 truncate text-right text-sm text-po-dim`,children:i}):null,(0,H.jsxs)(`div`,{ref:d,className:`flex flex-col gap-2 rounded-lg bg-po-rail px-4 py-3 leading-relaxed break-words text-po-hi ${l?`text-base`:`text-lg`}`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:c.text?(0,H.jsx)(A3,{sessionId:r,slotProps:s,onFileLink:t,text:c.text}):null}),(0,H.jsx)(H3,{timestamp:e.timestamp})]}),(0,H.jsx)(GXe,{images:e.images??UXe,files:c.files}),r?(0,H.jsx)(GYe,{sessionId:r,mentions:CS(e.text),onFileLink:t}):null]}),(0,H.jsx)(HXe,{actions:n,disabled:a,actionsDisabled:o,onQuote:()=>f(c.text),onRewind:()=>IN(e.id,r),userMessage:r!==null&&e.text.trim().length>0?{sessionId:r,messageId:e.id,text:e.text}:void 0})]})]})}if(e.kind===`assistant`)return(0,H.jsxs)(`div`,{"data-testid":`entry-assistant`,"data-streaming":e.streaming,className:`group/message flex items-start gap-3`,children:[(0,H.jsx)(BXe,{speaker:`assistant`,identity:e.identity??i}),(0,H.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-4 px-1 pt-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[e.thinking?(0,H.jsx)(`div`,{"data-testid":`entry-thinking`,className:`font-normal text-po-dim [&_p]:whitespace-pre-wrap [&_strong]:font-normal [&_strong]:text-po-dim ${l?`text-sm`:`text-base`}`,children:(0,H.jsx)(A3,{sessionId:r,slotProps:s,onFileLink:t,text:e.thinking})}):null,(0,H.jsxs)(`div`,{ref:d,"data-testid":`entry-text`,className:`leading-relaxed break-words text-po-text ${l?`text-base`:`text-lg`}`,children:[(0,H.jsx)(A3,{sessionId:r,slotProps:s,onFileLink:t,text:e.text}),e.streaming?(0,H.jsx)(Iqe,{}):null]})]}),e.streaming?null:(0,H.jsx)(H3,{timestamp:e.timestamp})]}),(0,H.jsx)(HXe,{actions:n,disabled:a,actionsDisabled:o,onQuote:()=>f(e.text),onRewind:()=>IN(e.id,r)})]})]});if(e.kind===`tool`)return(0,H.jsx)(KXe,{entry:e,slotProps:s,statuses:c});if(e.kind===`intercom`){let n=e.intent===`ask`?{text:`Asked you`,className:`bg-po-tint-magenta text-po-magenta`}:e.intent===`reply`?{text:`Replied`,className:`bg-po-tint-green text-po-green`}:null;return e.intent===`no_reply`?(0,H.jsxs)(`div`,{"data-testid":`entry-intercom`,"data-intent":`no_reply`,className:`flex items-center gap-3`,children:[(0,H.jsx)(JK,{name:e.name,seed:e.seed}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2 text-base text-po-dim`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full bg-po-yellow`}),e.name,` did not reply`]}),(0,H.jsx)(H3,{timestamp:e.timestamp})]}):(0,H.jsxs)(`div`,{"data-testid":`entry-intercom`,"data-intent":e.intent,className:`flex items-start gap-3`,children:[(0,H.jsx)(JK,{name:e.name,seed:e.seed}),(0,H.jsxs)(`div`,{className:`min-w-0 max-w-4/5 rounded-lg bg-po-rail px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:e.name}),e.role?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:e.role}):null,n?(0,H.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-sm ${n.className}`,children:n.text}):null]}),(0,H.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1 leading-relaxed break-words text-po-hi ${l?`text-base`:`text-lg`}`,children:(0,H.jsx)(A3,{sessionId:r,slotProps:s,onFileLink:t,text:e.text})}),(0,H.jsx)(H3,{timestamp:e.timestamp})]})]})]})}if(e.kind===`settled`)return(0,H.jsxs)(`div`,{"data-testid":`entry-settled`,className:`flex items-center gap-3 sm:pl-12`,children:[(0,H.jsx)(H4,{className:`flex-1`}),(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[`Agent settled`,e.tools>0?` · ${e.tools} tool${e.tools===1?``:`s`}`:``]}),(0,H.jsx)(H4,{className:`flex-1`})]});if(e.kind===`queued`)return null;let p=e.tone===`error`;return(0,H.jsxs)(`div`,{"data-testid":`entry-notice`,"data-tone":e.tone,className:`flex items-start gap-2.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`grid size-5 shrink-0 place-items-center rounded-full ${p?`bg-po-tint-red text-po-red`:`bg-po-tint-green text-po-green`}`,children:p?(0,H.jsx)(GL,{className:`size-3.5`}):(0,H.jsx)(OR,{className:`size-3`})}),(0,H.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words text-base ${p?`text-po-red`:`text-po-dim`}`,children:e.text.split(/(\s+)/u).map((e,t)=>{let n=zXe(e);return(0,H.jsx)(V.Fragment,{children:n===null?e:(0,H.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2`,children:e})},t)})})]})},YXe);function YXe(e,t){return e.entry!==t.entry||e.sessionId!==t.sessionId||e.compact!==t.compact||e.childThread!==t.childThread?!1:t.entry.kind===`tool`?e.slotProps===t.slotProps&&e.toolStatuses===t.toolStatuses:t.entry.kind===`user`?e.onFileLink===t.onFileLink&&e.pluginActions===t.pluginActions&&e.sessionStreaming===t.sessionStreaming&&e.runtimeActionsDisabled===t.runtimeActionsDisabled:t.entry.kind!==`assistant`||e.onFileLink===t.onFileLink&&e.sessionIdentity===t.sessionIdentity&&e.sessionStreaming===t.sessionStreaming&&e.runtimeActionsDisabled===t.runtimeActionsDisabled}function XXe(){return(0,H.jsx)(`output`,{"data-testid":`background-work-notice`,className:`mt-auto flex shrink-0 justify-center px-3 pt-2 pb-3`,children:(0,H.jsx)(`span`,{className:`max-w-lg rounded-md border border-po-yellow/40 bg-po-panel px-3 py-2 text-center text-sm leading-relaxed text-po-yellow`,children:`Background work is still running. The agent will resume when results are ready.`})})}function U3({store:e,sessionId:t,historyKey:n=t,empty:r,testId:i=`timeline`,backgroundWorkActive:a=!1,runtimeActionsDisabled:o=!1,limit:s,compact:c=!1,childThread:l=!1}){"use no memo";let u=U(e,e=>e.entries),d=U(e,e=>e.hasNewerHistory),f=U(e,e=>e.profileIdentity),p=oN(e=>e.streaming),m=oN(e=>e.statuses),h=Yv(t),g=VI(),_=WI(),v=KI(t),y=(0,V.useMemo)(()=>lv(),[_]),b=(0,V.useCallback)((e,n=!1)=>{if(t===null)return;let r=n?Jv(t,e):h(e);if(r!==void 0)return()=>{kI(t,r),g(r.id)}},[g,h,t]),x=(0,V.useMemo)(()=>{let e=u.filter(e=>e.kind!==`queued`);return s===void 0?e:e.slice(-s)},[u,s]),S=(0,V.useMemo)(()=>Yj(x,e=>(hv(e,m)?.timelinePresentation??`tool`)===`tool`),[_,m,x]),C=(0,V.useRef)(null),w=(0,V.useCallback)(e=>{let t=S[e];return t.kind===`group`?`group-${t.entries[0]?.id??``}`:t.entry.id},[S]),T=PXe({count:S.length,getScrollElement:()=>C.current,estimateSize:()=>80,overscan:8,getItemKey:w,initialRect:{width:0,height:800}}),E=T.getTotalSize(),D=(0,V.useRef)(0),O=(0,V.useRef)(x),k=(0,V.useRef)(!0),[A,j]=(0,V.useState)(!1),M=(0,V.useRef)(null),N=(0,V.useRef)(null),P=(e,t)=>e.scrollTop+e.clientHeight>=t-LXe,ee=()=>{let e=C.current;e&&k.current&&(e.scrollTop=Math.max(0,e.scrollHeight-e.clientHeight),j(!1))},F=()=>{k.current=!0,j(!1),hN(n)||ee()},te=()=>{let t=C.current;if(!t)return;let r=P(t,t.scrollHeight);if(k.current=r,c||FXe.set(e,r?null:t.scrollTop),r&&j(!1),!c&&(t.scrollTop<=RXe&&bN(n)||r&&mN(n))){k.current=!1;let e=T.getVirtualItems().find(e=>e.end>t.scrollTop);e&&(M.current={key:String(e.key),offset:t.scrollTop-e.start})}},ne=()=>{k.current=!1},[re,ie]=(0,V.useState)(e);return re!==e&&(ie(e),j(!1)),(0,V.useLayoutEffect)(()=>{D.current=0,N.current=null,M.current=null,k.current=!0},[e]),(0,V.useLayoutEffect)(()=>{let t=C.current;if(!t)return;let n=O.current!==x;if(O.current=x,!n&&t.scrollHeight===D.current)return;let r=M.current,i=x.length>0&&N.current!==null&&x[0]?.id!==N.current;if(N.current=x[0]?.id??null,r!==null&&i){M.current=null;let e=S.findIndex((e,t)=>w(t)===r.key);if(e>=0){let n=T.getOffsetForIndex(e,`start`)?.[0];n!==void 0&&(t.scrollTop=n+r.offset),D.current=t.scrollHeight;return}}if(D.current===0){let n=c?null:FXe.get(e);t.scrollTop=n??t.scrollHeight,D.current=t.scrollHeight,k.current=n==null,j(!1);return}if(!n){let e=t.scrollTop+t.clientHeight>=D.current-1;D.current=t.scrollHeight,e&&(k.current=!0,ee());return}let a=k.current||P(t,D.current);D.current=t.scrollHeight,a?(k.current=!0,j(!1),ee()):j(!0)},[S,x,T,w,E]),x.length===0?(0,H.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[r,a?(0,H.jsx)(XXe,{}):null]}):(0,H.jsx)(HP,{value:n??null,children:(0,H.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{ref:C,onScroll:te,onWheel:ne,"data-testid":i,className:c?`flex-1 overflow-y-auto px-2.5 py-2`:`flex-1 overflow-y-auto px-2 py-4 sm:py-5`,children:[(0,H.jsx)(`div`,{style:{height:E,position:`relative`,width:`100%`},children:T.getVirtualItems().map(e=>{let n=S[e.index];return(0,H.jsx)(`div`,{"data-index":e.index,ref:T.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`,paddingBottom:c?8:20},children:n.kind===`group`?(0,H.jsx)(qXe,{name:n.name,entries:n.entries,slotProps:v,statuses:m}):(0,H.jsx)(JXe,{entry:n.entry,onFileLink:b,pluginActions:y,sessionId:t,sessionIdentity:f,sessionStreaming:p,runtimeActionsDisabled:o,slotProps:v,toolStatuses:m,compact:c,childThread:l})},e.key)})}),a?(0,H.jsx)(XXe,{}):null]}),(A||d)&&!c?(0,H.jsxs)(Z,{variant:`subtle`,size:`sm`,"data-testid":`timeline-jump`,onClick:F,className:`absolute bottom-3 left-1/2 -translate-x-1/2 border border-po-border shadow-lg animate-po-rise`,children:[(0,H.jsx)(zL,{className:`h-3 w-3`}),`New activity below`]}):null]})})}function ZXe(){C_(`Timeline`);let e=U(q,e=>e.activeId),t=U(q,e=>e.activeId!==null&&e.byId[e.activeId]?.summary.dormant===!0),n=U(q,e=>e.activeId!==null&&e.byId[e.activeId]?.summary.phase===`idle`),r=oN(e=>e.statuses),i=oN(e=>e.widgets),a=oN(e=>e.settled),o=Bv(r,i,e).some(e=>e.active),s=n&&a&&o;return(0,H.jsx)(U3,{store:aN(e),sessionId:e,runtimeActionsDisabled:t,backgroundWorkActive:s,empty:(0,H.jsx)(rJ,{"data-testid":`timeline`,title:(0,H.jsx)(`span`,{className:`text-xl`,children:`No messages yet`}),description:t?`There is no saved conversation to show yet. Waking starts the agent again when you are ready.`:`This session is attached and waiting. Anything you send goes straight to the supervised agent.`,children:t?null:(0,H.jsx)(`div`,{"data-testid":`timeline-empty`,className:`mt-2 flex w-full flex-col gap-1.5`,children:IXe.map((e,t)=>(0,H.jsxs)(Z,{variant:`outline`,size:`lg`,"data-testid":`suggestion-${t}`,onClick:()=>{FN(e)},className:`h-auto justify-between bg-po-panel px-3 py-2 text-left font-normal text-po-text`,children:[(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:e}),(0,H.jsx)(tR,{className:`h-3 w-3 shrink-0 text-po-faint`})]},e))})})})}var QXe=`session-transcript`;function $Xe({sessionId:e,options:t,watch:n}){let r=U(q,e=>e.activeId),i=U(q,t=>t.byId[e]?.summary.dormant===!0);return(0,V.useEffect)(()=>r===e?void 0:n(e),[e,r,i,n]),(0,H.jsx)(U3,{store:aN(e),sessionId:e,historyKey:e,testId:QXe,limit:t?.limit,compact:t?.compact,empty:(0,H.jsx)(rJ,{"data-testid":`session-transcript-empty`,title:`no messages yet`,description:`the session's conversation shows here as soon as its agent starts.`})})}var eZe=`thread-timeline`;function tZe({sessionId:e,threadId:t,options:n}){return(0,V.useEffect)(()=>(bI(e,t),()=>xI(e,t)),[e,t]),(0,H.jsx)(U3,{store:aN(yI(e,t)),sessionId:e,historyKey:yI(e,t),testId:eZe,limit:n?.limit,compact:n?.compact,childThread:!0,empty:(0,H.jsx)(rJ,{"data-testid":`thread-empty`,title:`no messages yet`,description:`the agent's journal shows here as soon as it starts writing.`})})}var nZe=`The session was created but has not appeared yet; it will show up in the rail.`;function W3(e,t,n){let r=Tx(),i=async e=>{if(!await bM(e))return nZe;t(),await r({to:`/session/$sessionId`,params:{sessionId:e}})},a=async(i,a)=>{let o=e===null?await PP(i,n,a):await NP(e,i,a);if(!(`sessionId`in o))return o.error;t(),await r({to:`/session/$sessionId`,params:{sessionId:o.sessionId}})},o=e===null?void 0:t=>hge(e,t);return{createPlain:a,openCreated:i,...o===void 0?{}:{loadProfiles:o}}}function G3({workspaceId:e,workspaceRoot:t,hostId:n,onClose:r}){let{createPlain:i,loadProfiles:a}=W3(e??null,r,n),o=e??TP(n),s=U(OP,e=>e[o]??DP),c=mqe(o,a);return(0,H.jsx)(rZe,{workspaceRoot:t,name:s.name,error:s.error,busy:s.pending,profilePicker:c===void 0?void 0:{profiles:c.profiles,status:c.status,value:s.profile,onChange:e=>jP(o,e)},onName:e=>AP(o,e),onCreate:()=>void i(s.name),onClose:r})}function rZe({workspaceRoot:e,name:t,error:n,busy:r,profilePicker:i,onName:a,onCreate:o,onClose:s}){return(0,H.jsx)(aq,{open:!0,onOpenChange:e=>!e&&!r&&s(),children:(0,H.jsxs)(cq,{width:`md`,"data-testid":`new-session-dialog`,"aria-describedby":void 0,children:[(0,H.jsx)(lq,{children:(0,H.jsx)(uq,{children:`New session`})}),(0,H.jsxs)(fq,{children:[e===void 0?null:(0,H.jsx)(`p`,{className:`truncate text-sm text-po-dim`,title:e,children:e}),(0,H.jsxs)(`label`,{htmlFor:`new-session-name`,className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-base font-medium text-po-text`,children:`Name (optional)`}),(0,H.jsx)(zq,{id:`new-session-name`,"data-testid":`new-session-name`,value:t,autoFocus:!0,disabled:r,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!r&&o()},placeholder:`Session name`})]}),i===void 0?null:(0,H.jsx)(pqe,{...i,disabled:r}),n?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`new-session-error`,className:`text-sm text-po-red`,children:n}):null,(0,H.jsxs)(mq,{children:[(0,H.jsx)(Z,{variant:`outline`,"data-testid":`new-session-cancel`,onClick:s,disabled:r,children:`Cancel`}),(0,H.jsx)(Z,{variant:`primary`,"data-testid":`new-session-create`,onClick:o,disabled:r,children:r?`Creating…`:`Create`})]})]})]})})}function iZe(e){return e.name?.trim()||e.firstMessage.trim().split(`
|
|
142
142
|
`,1)[0]||`untitled`}function K3(e){return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function aZe(e,t){return`${e.name??``}\n${e.firstMessage}`.toLowerCase().includes(t)}function oZe({thread:e}){return(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-base font-semibold text-po-hi`,children:iZe(e)}),e.name&&e.firstMessage?(0,H.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-base text-po-text`,children:e.firstMessage}):null]})}function q3({sessionId:e,workspaceId:t,onClose:n}){let r=Tx(),i=t??e,a=SM(),o=t??a[e]?.summary.workspaceId,[s,c]=(0,V.useState)([]),[l,u]=(0,V.useState)([]),{view:d,query:f,selectedId:p,resumedId:m,busy:h,error:g}=U(aF),[_,v]=(0,V.useState)(!0),[y,b]=(0,V.useState)(!0),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(``),[T,E]=(0,V.useState)(0);(0,V.useEffect)(()=>{let n=!1;return(t===void 0?Cge(e):wge(t)).then(e=>{n||(v(!1),`error`in e?S(e.error):(S(``),c(e.sessions)))}),()=>{n=!0}},[e,t,T]),(0,V.useEffect)(()=>{if(d!==`removed`||o===void 0)return;let e=!1;return Tge(o).then(t=>{e||(b(!1),`error`in t?w(t.error):(w(``),u(t.sessions)))}),()=>{e=!0}},[d,o,T]);let D=f.trim().toLowerCase(),O=(0,V.useMemo)(()=>D?s.filter(e=>aZe(e,D)):s,[D,s]),k=(0,V.useMemo)(()=>D?l.filter(e=>aZe(e,D)):l,[D,l]),A=d===`removed`&&o!==void 0,j=A?C:x,M=async e=>{o!==void 0&&await lF(o,e)&&E(e=>e+1)},N=async()=>{let i=await uF(t===void 0?{sessionId:e}:{workspaceId:t});i!==void 0&&(n(),await r({to:`/session/$sessionId`,params:{sessionId:i}}))};return(0,H.jsx)(aq,{open:!0,onOpenChange:e=>!e&&!h&&n(),children:(0,H.jsxs)(cq,{width:`md`,"data-testid":`session-resume-dialog-${i}`,"aria-describedby":void 0,children:[(0,H.jsx)(lq,{children:(0,H.jsx)(uq,{children:`resume Pi thread`})}),(0,H.jsxs)(fq,{children:[o===void 0?null:(0,H.jsx)(l3,{value:d,onValueChange:e=>cF(e),children:(0,H.jsxs)(u3,{"aria-label":`Which threads`,children:[(0,H.jsx)(d3,{value:`history`,"data-testid":`session-history-tab`,disabled:h,children:`history`}),(0,H.jsx)(d3,{value:`removed`,"data-testid":`session-removed-tab`,disabled:h,children:`recently removed`})]})}),(0,H.jsx)(zq,{"data-testid":`session-history-search`,value:f,autoFocus:!0,onChange:e=>sF({query:e.target.value}),placeholder:A?`search recently removed`:`search thread history`}),A?(0,H.jsxs)(`div`,{role:`list`,"aria-label":`Recently removed Pi threads`,"data-testid":`session-removed-list`,className:`max-h-80 overflow-y-auto rounded border border-po-border bg-po-deep p-1`,children:[k.map(e=>(0,H.jsxs)(`div`,{role:`listitem`,"data-testid":`session-removed-${e.id}`,className:`flex items-start gap-3 rounded-md px-2.5 py-2`,children:[(0,H.jsx)(oZe,{thread:e}),(0,H.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end gap-1.5`,children:[(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[`removed `,K3(e.removedAt),`, deleted `,K3(e.purgeAt)]}),(0,H.jsx)(Z,{variant:`outline`,size:`xs`,"data-testid":`session-restore-${e.id}`,disabled:h,onClick:()=>void M(e.id),children:`restore`})]})]},e.id)),!y&&k.length===0?(0,H.jsx)(`p`,{className:`px-2.5 py-6 text-center text-sm text-po-dim`,children:D?`no matching threads`:`nothing removed in the last 7 days`}):null,y?(0,H.jsx)(`p`,{className:`px-2.5 py-6 text-center text-sm text-po-dim`,children:`loading…`}):null]}):(0,H.jsxs)(`div`,{role:`listbox`,"aria-label":`Pi thread history`,"data-testid":`session-history-list`,className:`max-h-80 overflow-y-auto rounded border border-po-border bg-po-deep p-1`,children:[O.map(e=>{let t=a[e.id]!==void 0;return(0,H.jsxs)(Kq,{density:`compact`,active:p===e.id,disabled:t||h,"aria-selected":p===e.id,"data-testid":`session-history-${e.id}`,onClick:()=>sF({selectedId:e.id}),className:`w-full items-start px-2.5 py-2 text-left`,children:[(0,H.jsx)(oZe,{thread:e}),(0,H.jsx)(`span`,{className:`shrink-0 pl-3 text-sm text-po-dim`,children:t?`running`:K3(e.updatedAt)})]},e.id)}),!_&&O.length===0?(0,H.jsx)(`p`,{className:`px-2.5 py-6 text-center text-sm text-po-dim`,children:D?`no matching threads`:`no Pi history for this workspace`}):null,_?(0,H.jsx)(`p`,{className:`px-2.5 py-6 text-center text-sm text-po-dim`,children:`loading history…`}):null]}),g||j?(0,H.jsx)(`p`,{"data-testid":`session-resume-error`,role:`alert`,className:`text-sm text-po-red`,children:g||j}):null,(0,H.jsxs)(mq,{children:[(0,H.jsx)(Z,{variant:`outline`,onClick:n,disabled:h,children:`cancel`}),A?null:(0,H.jsx)(Z,{variant:`primary`,"data-testid":`session-resume-confirm`,onClick:()=>void N(),disabled:p===null||h||!m&&a[p]!==void 0,children:h?`resuming…`:`resume`})]})]})]})})}function sZe({component:e,workspaceId:t,workspaceRoot:n}){let r=KI(null),i=W3(t,EP);return(0,V.createElement)(e,{...r,newSession:{workspaceId:t,workspaceRoot:n,close:EP,requestWithStepUp:Pt,...i}})}function cZe(){WI();let e=U(SP,e=>e),t=U(gP,e=>e.byId),n=U(tF,e=>e.resume),r=e.workspaceId===null?void 0:t[e.workspaceId],i=r===void 0?void 0:iv(r.id,s_.newSession).find(e=>e.component!==void 0);return(0,H.jsxs)(H.Fragment,{children:[e.open&&e.kind===`general`?(0,H.jsx)(G3,{hostId:e.hostId,onClose:EP},`general:${e.hostId??``}`):e.open&&r!==void 0?i?.component===void 0?(0,H.jsx)(G3,{workspaceId:r.id,workspaceRoot:r.root,onClose:EP}):(0,H.jsx)(sZe,{component:i.component,workspaceId:r.id,workspaceRoot:r.root},`${i.pluginId}:${i.id}`):null,n===null?null:`sessionId`in n?(0,H.jsx)(q3,{sessionId:n.sessionId,onClose:rF}):(0,H.jsx)(q3,{workspaceId:n.workspaceId,onClose:rF})]})}function lZe(){let e=U(q,e=>e.updateRequired);return(0,H.jsxs)(rJ,{"data-testid":`welcome`,title:`no session yet`,description:`Start a session to work with Po. No workspace needed.`,children:[(0,H.jsxs)(Z,{variant:`primary`,size:`lg`,"data-testid":`welcome-new-session`,onClick:()=>wP(),children:[(0,H.jsx)(SR,{className:`h-3 w-3`}),`new session`]}),(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-1.5 text-sm text-po-dim`,children:[(0,H.jsx)(k$,{children:`ctrl+t`}),` new session · `,(0,H.jsx)(k$,{children:`ctrl+k`}),` commands`]}),e?(0,H.jsx)(`output`,{"data-testid":`welcome-update-required`,className:`block text-sm text-po-magenta`,children:dM}):null]})}function uZe(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`:!1}function dZe(e){return e instanceof Element&&e.closest(`[role="dialog"], [role="menu"], [role="alertdialog"]`)!==null}function fZe(e,t){let n=new Map;for(let r of e){let e=t[r]?.summary.profile;e?.iconVersion!==void 0&&n.set(r,`${e.name}:${e.iconVersion}`)}let r=[...n].map(([e,t])=>`${e}=${t}`).join(`
|
|
143
|
-
`),[i,a]=(0,V.useState)({}),o=(0,V.useRef)(new Set);(0,V.useEffect)(()=>{let e=new Set(n.values());for(let[e,t]of n)o.current.has(t)||(o.current.add(t),HA(e,t.slice(t.lastIndexOf(`:`)+1)).then(e=>a(n=>({...n,[t]:e})),()=>void 0));a(t=>{let n=Object.keys(t).filter(t=>!e.has(t));if(n.length===0)return t;let r={...t};for(let e of n)URL.revokeObjectURL(r[e]),delete r[e],o.current.delete(e);return r})},[r]),(0,V.useEffect)(()=>()=>{a(e=>{for(let t of Object.values(e))URL.revokeObjectURL(t);return{}})},[]);let s={};for(let[e,t]of n){let n=i[t];n!==void 0&&(s[e]=n)}return s}function pZe({onDismiss:e}){let t=Tx(),n=(0,V.useRef)(0),r=(0,V.useCallback)(e=>{if(e!==null)return e.scrollTop=n.current,()=>{n.current=e.scrollTop}},[]),i=U(q,e=>e.order),a=SM(),o=U(q,e=>e.activeId),s=U(gP,e=>e.order),c=U(gP,e=>e.byId),l=U(gP,e=>e.selectedId),u=U(gP,e=>e.hydrated),d=U(aN(o),e=>e.dialog!==null),f=U(fF,e=>e.view),p=U(SP,e=>e),m=U(oF),h=fZe(i,a);(0,V.useEffect)(()=>{if(u)return;let e=!1;return jO().then(t=>{!e&&`workspaces`in t&&_P(t)}),()=>{e=!0}},[u]),(0,V.useEffect)(()=>{let e=o===null?void 0:a[o]?.summary.workspaceId;e!==void 0&&c[e]!==void 0&&bP(e)},[o,a,c]),(0,V.useEffect)(()=>{let n=n=>{if(n.ctrlKey&&!n.metaKey&&!n.altKey&&n.key===`t`){n.preventDefault(),e?.(),l!==null&&c[l]?.kind===`session`?wP(sr(l)?.hostId):CP(l);return}if(n.ctrlKey||n.metaKey||n.altKey||n.defaultPrevented||uZe(n.target)||dZe(n.target)||YP.state.open||d)return;let r=Number.parseInt(n.key,10);if(!Number.isInteger(r)||r<1||r>9)return;let a=i[r-1];a!==void 0&&(n.preventDefault(),e?.(),t({to:`/session/$sessionId`,params:{sessionId:a}}))};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[i,d,t,e,l,c]);let g=(0,V.useRef)([]),_=(0,V.useMemo)(()=>fj(g.current,dj({order:i,byId:a,activeId:o,workspaceOrder:s,workspacesById:c,nested:new Set(i.filter(e=>fM(a,e)!==void 0)),now:Date.now(),restarts:m,avatarUrls:h})),[i,a,o,s,c,m,h]);(0,V.useEffect)(()=>{g.current=_},[_]);let v=(0,V.useRef)({navigate:t,onDismiss:e,selectedWorkspaceId:l});(0,V.useEffect)(()=>{v.current={navigate:t,onDismiss:e,selectedWorkspaceId:l}});let y=(0,V.useMemo)(()=>({openSession(e){v.current.onDismiss?.(),v.current.navigate({to:`/session/$sessionId`,params:{sessionId:e}})},renameSession(e,t){let n=t.trim();n!==``&&n!==q.state.byId[e]?.summary.name&&HN(n,e)},async setSessionGroups(e,t){let n=await bge(e,t);return`error`in n?{error:n.error}:void 0},async renameGroup(e,t){let n=await xge(e,t);return`error`in n?{error:n.error}:void 0},async deleteGroup(e){let t=await Sge(e);return`error`in t?{error:t.error}:void 0},restartSession(e){dF(e)},async removeSession(e){let t=await _ge(e);if(`error`in t)return{error:t.error};nye({sessionId:e})},resumeSession(e){nF({sessionId:e})},createSession(e){bP(e),v.current.onDismiss?.(),gP.state.byId[e]?.kind===`session`?wP(sr(e)?.hostId):CP(e)},createGeneralSession(){v.current.onDismiss?.(),wP()},resumeInWorkspace(e){nF({workspaceId:e})},openWorkspaceSettings(e){bP(e),v.current.onDismiss?.(),v.current.navigate({to:`/settings/$section`,params:{section:Wj},search:{workspace:e}})},async deleteWorkspace(e){let t=await dge(e);if(`error`in t)return{error:t.error};yP({workspaceId:e})},openAddWorkspace(){v.current.onDismiss?.(),CP(null)},closeAddWorkspace(){YI.state.pending||(ZI(),EP())},async addWorkspace(e){let t=await QI(e);return t===void 0&&EP(),t},discoverWorkspaces:oge,async addDeclaredWorkspaces(e){let t=await eL(e);return t.results.length>0&&t.results.every(e=>e.workspaceId!==void 0&&!e.error)&&(ZI(),EP()),t},searchDirectories:Age,listDirectory:age,async removePendingSetup(e,t){let n=q.state.byId[e]?.summary.workspaceId;if(n===void 0)return{error:`This session belongs to no workspace.`};let r=await tj(n,e,t);return`error`in r?{error:r.error}:void 0},openWorkspace(e){v.current.onDismiss?.(),v.current.navigate({to:`/workspace/$workspaceId`,params:{workspaceId:e}})},openHome(){v.current.onDismiss?.(),v.current.navigate({to:`/`})},openSettings(){v.current.onDismiss?.(),v.current.navigate({to:`/settings/$section`,params:{section:Uj},search:{workspace:v.current.selectedWorkspaceId??void 0}})},openRemoteAccess(){v.current.onDismiss?.(),_F()},turnRemoteAccessOff(){wF()},renderSessionMenuItems:e=>(0,H.jsx)(h3,{slot:s_.sessionMenu,sessionId:e})}),[]),b=iS({select:e=>lS(e).kind===`home`}),x=p.open&&p.kind!==`general`&&(p.workspaceId===null||c[p.workspaceId]===void 0);return{workspaces:_,scrollRef:r,remote:{status:f?.status??`off`,deviceCount:f?.devices.length??0,...f?.publicUrl===void 0?{}:{host:new URL(f.publicUrl).host},...f?.error===void 0?{}:{error:f.error}},pluginContent:(0,H.jsx)(h3,{slot:s_.rail,sessionId:o}),homeActive:b,...x?{addWorkspace:{suggestedPaths:[]}}:{},actions:y}}function mZe({team:e=Lve(),signOut:t=Rve()}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(),o=async()=>{if(t){r(!0),a(void 0);try{await t()}catch(e){a(e instanceof Error?e.message:String(e)),r(!1)}}};return(0,H.jsxs)(U4,{"data-testid":`account-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Account`}),(0,H.jsx)(K4,{children:`Who can use this Po, and signing out of it in this browser.`})]}),(0,H.jsxs)(Z4,{children:[e===void 0?null:(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`Members`}),(0,H.jsx)(n3,{children:`Invite people by email, see pending invitations, and remove people from this team.`})]}),(0,H.jsx)(Z,{asChild:!0,variant:`outline`,size:`sm`,children:(0,H.jsx)(`a`,{href:e,"data-testid":`account-members`,children:`Manage members`})})]}),t===void 0?null:(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`Sign out`}),(0,H.jsx)(n3,{children:i??`Ends your sign-in on this browser.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,disabled:n,onClick:()=>void o(),"data-testid":`account-sign-out`,children:`Sign out`})]})]})]})}var hZe=`workspace:`;function gZe({target:e,onTargetChange:t}){WI();let n=U(gP,e=>e),r=e.startsWith(hZe)?e.slice(10):void 0,i=JF(r),a=W_(r===void 0?{scope:`global`}:{scope:`workspace`,workspaceId:r}),o=XF(i),s=p_(a.templates,o),[c,l]=gL(`template/draft`,null),u=c?.target===e?c.id:s.template?.id,d=i.saving||i.loading,f=i.config?.values[`web.template`]?.origin??`default`,p=r!==void 0&&n.byId[r]===void 0,m=u!==void 0&&u!==o;return(0,H.jsxs)(q4,{"data-testid":`template-settings`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Layout`}),(0,H.jsx)(X4,{children:`The arrangement Po opens with. Set it for everyone, or let one workspace choose its own.`})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,H.jsx)(`span`,{id:`template-scope-label`,className:`text-sm text-po-dim`,children:`Applies to`}),(0,H.jsxs)(F4,{value:e,onValueChange:e=>{t(e),l(null)},disabled:i.saving,children:[(0,H.jsx)(R4,{"aria-labelledby":`template-scope-label`,"data-testid":`template-scope`,className:`w-auto min-w-56 max-w-full`,children:(0,H.jsx)(L4,{})}),(0,H.jsxs)(z4,{children:[(0,H.jsx)(V4,{value:`global`,children:`Global default`}),n.order.filter(e=>n.byId[e]?.kind!==`session`).map(e=>(0,H.jsxs)(V4,{value:`${hZe}${e}`,children:[`Workspace: `,n.byId[e]?.root??e]},e))]})]})]}),(0,H.jsx)(j4,{"aria-label":`Layout`,value:u??``,onValueChange:t=>l({target:e,id:t}),className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,disabled:d||p,children:a.templates.map(e=>(0,H.jsxs)(M4,{value:e.id,"data-testid":`template-${e.id}`,"data-selected":u===e.id,className:`flex items-start gap-2 rounded-lg p-4`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:e.label}),(0,H.jsx)(`span`,{className:`text-sm leading-relaxed text-po-dim`,children:e.description}),(0,H.jsx)(`span`,{className:`font-mono text-sm text-po-dim`,children:e.pluginId})]}),u===e.id?(0,H.jsx)(LL,{className:`size-4 shrink-0 text-po-green`}):null]},e.id))}),s.warning?(0,H.jsx)(`output`,{className:`block text-sm text-po-yellow`,children:s.warning}):null,a.diagnostics.map((e,t)=>(0,H.jsx)(`output`,{className:`block text-sm text-po-yellow`,children:e.message},`${e.pluginId}:${t}`)),i.error?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`template-save-error`,className:`text-sm text-po-red`,children:i.error}):null,(0,H.jsxs)(i3,{children:[(0,H.jsx)(Z,{"data-testid":`template-save`,size:`sm`,variant:m?`primary`:`outline`,disabled:d||p||u===void 0||i.config===void 0,onClick:()=>{u!==void 0&&YF(u,r).then(e=>{e&&(l(null),ak())})},children:i.saving?`Saving…`:`Set as default`}),(0,H.jsx)(Z,{"data-testid":`template-inherit`,size:`sm`,variant:`ghost`,disabled:d||p||i.config===void 0,onClick:()=>{YF(null,r).then(e=>{e&&(l(null),ak())})},children:r===void 0?`Use automatic fallback`:`Inherit global default`}),(0,H.jsx)(Z,{"data-testid":`template-reload`,size:`sm`,variant:`ghost`,disabled:d,onClick:()=>{KF(r).then(()=>ak())},children:`Reload configuration`})]}),(0,H.jsxs)(r3,{"data-testid":`template-origin`,children:[`Saved to`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:r===void 0?`~/.po/config.yaml`:`${i.config?.repoRoot??n.byId[r]?.root??r}/.po/config.yaml`}),`. Currently using`,` `,o===void 0?`automatic fallback`:(0,H.jsx)(`code`,{className:`font-mono`,children:o}),` (`,f,`).`]})]})}var _Ze=[`blue`,`green`,`yellow`,`red`,`magenta`,`cyan`];function vZe({theme:e}){let{tokens:t}=e;return(0,H.jsxs)(`div`,{"aria-hidden":!0,className:`flex h-[74px] w-full overflow-hidden rounded border`,style:{backgroundColor:t.bg,borderColor:t.border},children:[(0,H.jsxs)(`div`,{className:`flex w-[34%] flex-col gap-1 p-1.5`,style:{backgroundColor:t.rail},children:[(0,H.jsx)(`span`,{className:`h-[7px] w-full rounded-sm`,style:{backgroundColor:t.selected}}),(0,H.jsx)(`span`,{className:`h-[7px] w-3/4 rounded-sm`,style:{backgroundColor:t.panel}}),(0,H.jsx)(`span`,{className:`h-[7px] w-3/4 rounded-sm`,style:{backgroundColor:t.panel}})]}),(0,H.jsxs)(`div`,{className:`flex flex-1 flex-col justify-between p-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`h-[5px] w-2/3 rounded-sm`,style:{backgroundColor:t.text}}),(0,H.jsx)(`span`,{className:`h-[5px] w-1/2 rounded-sm`,style:{backgroundColor:t.dim}})]}),(0,H.jsx)(`div`,{className:`flex gap-1`,children:_Ze.map(e=>(0,H.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:t[e]}},e))})]})]})}function yZe({templateTarget:e,onTemplateTargetChange:t}){let n=U(lI,e=>e.name);return(0,H.jsxs)(U4,{"data-testid":`appearance-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Appearance`}),(0,H.jsx)(K4,{children:`Choose how Po looks and which layout it opens with.`})]}),(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Theme`}),(0,H.jsx)(X4,{children:`Applies straight away and is remembered in this browser. Plugin tabs follow it too.`})]}),(0,H.jsx)(j4,{"aria-label":`Theme`,"data-testid":`theme-list`,className:`grid grid-cols-1 gap-3 min-[480px]:grid-cols-2 lg:grid-cols-3`,value:n,onValueChange:pI,children:uI().map(e=>{let t=e.name===n;return(0,H.jsxs)(M4,{value:e.name,"data-testid":`theme-${e.name}`,"data-selected":t,className:`flex flex-col gap-3 rounded-lg p-3`,children:[(0,H.jsx)(vZe,{theme:e}),(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.label}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim first-letter:uppercase`,children:e.scheme})]}),t?(0,H.jsx)(LL,{className:`size-4 shrink-0 text-po-green`}):null]})]},e.name)})}),(0,H.jsxs)(r3,{children:[`A theme is a JSON file of twenty colour tokens. The format lives in`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`@agimon-ai/po-web-components`}),`.`]})]}),(0,H.jsx)(gZe,{target:e,onTargetChange:t})]})}function bZe(e){return!e.trim()||Array.from(e.trim()).length>64}function xZe(e){let t=bZe(e.name),n=bZe(e.renameName);return(0,H.jsxs)(U4,{className:`max-w-2xl`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Devices`}),(0,H.jsxs)(K4,{children:[`Names help you recognise where voice is active. This list belongs to `,e.hostLabel,`.`]})]}),(0,H.jsxs)(q4,{children:[(0,H.jsx)(Y4,{children:`This device`}),(0,H.jsx)(Z4,{children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,H.jsx)($4,{id:`device-name`,label:`Device name`,children:(0,H.jsx)(zq,{id:`device-name`,value:e.name,onChange:t=>e.onNameChange(t.target.value),"aria-describedby":`name-help`,"aria-invalid":t,disabled:e.pending})}),(0,H.jsx)(r3,{id:`name-help`,children:`Default: ${e.defaultName}. Use 1 to 64 characters.`}),t?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-po-red`,children:`Enter a name from 1 to 64 characters.`}):null,e.error?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-po-red`,children:e.error}):null,(0,H.jsx)(`div`,{children:(0,H.jsx)(Z,{disabled:!!e.editing||t||e.pending||!e.deviceId,onClick:e.onSave,children:`Save name`})})]})})]}),(0,H.jsxs)(q4,{children:[(0,H.jsxs)(Y4,{children:[`Devices on `,e.hostLabel]}),(0,H.jsx)(r3,{children:`Names are labels, not permission to access this computer. Last seen does not confirm a live connection.`}),e.status===`loading`?(0,H.jsx)(r3,{role:`status`,children:`Loading devices…`}):e.status===`error`?(0,H.jsx)(r3,{children:(0,H.jsx)(Z,{variant:`ghost`,onClick:e.onRetry,children:`Try again`})}):e.devices.length===0?(0,H.jsx)(r3,{children:`No devices have been recorded yet.`}):(0,H.jsx)(Z4,{children:e.devices.map(t=>(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsxs)(t3,{children:[t.deviceName,t.deviceId===e.deviceId?` · This device`:``]}),(0,H.jsx)(n3,{children:t.description})]}),(0,H.jsxs)(hq,{children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,"aria-label":`Actions for ${t.deviceName}`,disabled:e.pending,children:`•••`})}),(0,H.jsx)(vq,{children:(0,H.jsx)(bq,{onSelect:()=>e.onRename(t),children:`Rename`})})]})]},t.deviceId))})]}),e.editing?(0,H.jsxs)(q4,{children:[(0,H.jsxs)(Y4,{children:[`Rename `,e.editing.deviceName]}),(0,H.jsx)(Z4,{children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,H.jsx)(j$,{htmlFor:`other-name`,children:`Device name`}),(0,H.jsx)(zq,{id:`other-name`,value:e.renameName,onChange:t=>e.onRenameNameChange(t.target.value),"aria-describedby":`rename-result`,"aria-invalid":n,disabled:e.pending}),e.renameError?(0,H.jsx)(`p`,{id:`rename-result`,role:`alert`,className:`text-sm text-po-red`,children:e.renameError}):(0,H.jsx)(`p`,{id:`rename-result`,className:`text-sm text-po-dim`,children:`Changes the name recorded on ${e.hostLabel}, even while this device is offline.`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Z,{disabled:n||e.pending,onClick:e.onSaveRename,children:`Save name`}),(0,H.jsx)(Z,{variant:`ghost`,disabled:e.pending,onClick:e.onCancel,children:`Cancel`})]})]})})]}):null]})}var SZe=(e,t)=>He.fetch(e,t);function CZe({hostLabel:e=`this Po host`,request:t=SZe}){let n=YO({header:Se()}),r=n.status===`ok`?n.metadata:void 0,[i,a]=(0,V.useState)([]),[o,s]=(0,V.useState)(r?.deviceName??``),[c,l]=(0,V.useState)(`loading`),[u,d]=(0,V.useState)(),[f,p]=(0,V.useState)(),[m,h]=(0,V.useState)(),[g,_]=(0,V.useState)(``),[v,y]=(0,V.useState)(!1),b=(0,V.useCallback)(async()=>{let e=await t(`/api/client-devices`,{cache:`no-store`});if(!e.ok)throw Error(`Devices could not be loaded (${e.status}).`);let n=await e.json(),i=n.devices.find(e=>e.deviceId===r?.deviceId);i&&(await xe(i.deviceName,i.nameUpdatedAt),s(i.deviceName)),a(n.devices),l(`ready`)},[t,r?.deviceId]),x=(0,V.useCallback)(async()=>{l(`loading`),d(void 0);try{await b()}catch(e){d(e instanceof Error?e.message:String(e)),l(`error`)}},[b]);(0,V.useEffect)(()=>{x()},[x]);async function S(e,n,i){if(!v){y(!0),(i?p:d)(void 0);try{let a=await t(`/api/client-devices/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`,"x-po-csrf":`1`},body:JSON.stringify({deviceName:n})});if(!a.ok)throw Error(`The name could not be saved. Your edit is still here. Try again.`);let o=await a.json();o.device.deviceId===r?.deviceId&&await xe(o.device.deviceName,o.device.nameUpdatedAt),await b(),i&&h(void 0)}catch(e){(i?p:d)(e instanceof Error?e.message:String(e))}finally{y(!1)}}}let C=i.map(e=>({deviceId:e.deviceId,deviceName:e.deviceName,description:[e.clientKind===`web`?`Web`:e.clientKind===`desktop`?`Desktop`:e.clientKind===`ios`?`iOS`:`Android`,e.platform,e.browser,`Last seen ${new Date(e.lastSeen).toLocaleString()}`].filter(Boolean).join(` · `)}));return(0,H.jsx)(xZe,{hostLabel:e,deviceId:r?.deviceId,defaultName:Zge(navigator.userAgent),name:o,onNameChange:s,devices:C,status:c,editing:m,renameName:g,onRenameNameChange:_,onRename:e=>{h(e),_(e.deviceName),p(void 0)},onCancel:()=>h(void 0),onSave:()=>{r&&S(r.deviceId,o,!1)},onSaveRename:()=>{m&&S(m.deviceId,g,!0)},pending:v,error:u,renameError:f,onRetry:()=>{x()}})}var J3=`__inherit__`;function wZe({origin:e,scope:t}){return e==="default"?null:e===t?(0,H.jsx)(`span`,{className:`sr-only`,children:`, set here`}):e===`global`?(0,H.jsx)(`span`,{className:`text-sm font-normal text-po-dim`,children:`From global`}):(0,H.jsx)(XK,{tone:`yellow`,className:`shrink-0`,children:`Overridden by repository`})}function TZe({field:e}){return(0,H.jsx)(`code`,{className:`min-w-0 max-w-full break-all font-mono text-sm text-po-dim`,children:Nj(e)})}function EZe({field:e,view:t,scope:n,draft:r,busy:i,onDraft:a}){let o=Pj(t,n),s=r!==void 0;return(0,H.jsxs)(H.Fragment,{children:[t===void 0?null:(0,H.jsx)(wZe,{origin:t.origin,scope:n}),o===void 0?null:(0,H.jsxs)(`span`,{"data-testid":`settings-locked-${e.id}`,className:`inline-flex items-center gap-1 text-sm font-normal text-po-dim`,children:[(0,H.jsx)(bR,{"aria-hidden":!0,className:`size-3`}),(0,H.jsx)(`span`,{className:`inline-block first-letter:uppercase`,children:o})]}),s?(0,H.jsx)(XK,{tone:`cyan`,"data-testid":`settings-dirty-${e.id}`,className:`shrink-0`,children:`Unsaved`}):null,s?(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,"data-testid":`settings-revert-${e.id}`,disabled:i,onClick:()=>a(e,void 0),className:`text-po-dim`,children:`Revert`}):t?.origin===n&&o===void 0?(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,"data-testid":`settings-clear-${e.id}`,disabled:i,onClick:()=>a(e,null),className:`text-po-dim`,children:`Reset`}):null]})}function DZe({field:e,view:t,scope:n,draft:r,busy:i,onDraft:a}){let o=Pj(t,n),s=r===void 0?t?.value??``:r??``;return(0,H.jsxs)(`div`,{"data-testid":`settings-field-${e.id}`,"data-dirty":r!==void 0,className:`flex min-w-0 flex-col gap-2`,children:[(0,H.jsx)(j4,{"aria-label":e.label,value:s===``?e.defaultValue??``:s,disabled:i||o!==void 0,onValueChange:t=>a(e,t),className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:(e.options??[]).map(t=>(0,H.jsxs)(M4,{value:t.value,"data-testid":`settings-card-${e.id}-${t.value}`,className:`flex flex-col gap-1.5 p-4`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:t.label}),t.detail===void 0?null:(0,H.jsx)(`span`,{className:`text-sm leading-relaxed text-po-dim`,children:t.detail})]},t.value))}),(0,H.jsxs)(`div`,{className:`flex min-h-6 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,H.jsx)(TZe,{field:e}),(0,H.jsx)(EZe,{field:e,view:t,scope:n,draft:r,busy:i,onDraft:a})]})]})}function OZe({providerId:e,groupLabel:t}){let[n,r]=gL(`providers/list`,null);(0,V.useEffect)(()=>{Ht().then(e=>{`providers`in e&&r(e.providers)})},[r]);let i=n?.find(t=>t.id===e),a=i?.authenticated!==void 0;return(0,H.jsxs)(Q4,{"data-testid":`settings-signin-${e}`,className:`items-start`,children:[(0,H.jsxs)(e3,{className:`gap-1`,children:[(0,H.jsx)(t3,{className:`flex min-h-6 items-center`,children:i?.name??`Sign-in`}),(0,H.jsx)(n3,{children:a?`${t} uses this sign-in.`:`${t} uses this sign-in. Sign in whenever you are ready.`})]}),a?(0,H.jsx)(XK,{tone:`green`,"data-testid":`settings-signed-in-${e}`,children:`Signed in`}):(0,H.jsx)(Z,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,H.jsx)(Mx,{"data-testid":`settings-sign-in-${e}`,to:`/settings/$section`,params:{section:`providers`},children:`Sign in`})})]})}function kZe({field:e,view:t,scope:n,models:r,draft:i,busy:a,onDraft:o}){let s=Pj(t,n),c=i!==void 0,l=i===void 0?t?.value??``:i??``,u=(0,V.useMemo)(()=>e.optionsFrom===`models`?r.map(e=>({value:e.value,label:e.label,group:e.group})):e.options??[],[e.options,e.optionsFrom,r]),d=(0,V.useMemo)(()=>[...new Set(u.map(e=>e.group??``))],[u]),f=e.kind===`select`&&u.length===0?`text`:e.kind,p=f===`select`&&l!==``&&!u.some(e=>e.value===l)?l:void 0,m=f===`info`?(0,H.jsx)(`span`,{className:`text-sm text-po-text`,children:l||`-`}):f===`toggle`?(0,H.jsx)(a3,{"data-testid":`settings-toggle-${e.id}`,"aria-label":e.label,checked:l===`true`,disabled:a||s!==void 0,onCheckedChange:t=>o(e,String(t))}):f===`select`?(0,H.jsxs)(F4,{value:l===``?J3:l,disabled:a||s!==void 0,onValueChange:t=>o(e,t===J3?null:t),children:[(0,H.jsx)(R4,{"data-testid":`settings-select-${e.id}`,"aria-label":e.label,className:`w-full text-sm sm:w-64`,children:(0,H.jsx)(L4,{placeholder:e.placeholder??`Inherit`})}),(0,H.jsxs)(z4,{children:[(0,H.jsx)(V4,{value:J3,children:e.placeholder??`Inherit`}),p===void 0?null:(0,H.jsxs)(V4,{value:p,children:[p,` · not in catalog`]}),d.map(e=>(0,H.jsxs)(I4,{children:[e===``?null:(0,H.jsx)(B4,{children:e}),u.filter(t=>(t.group??``)===e).map(e=>(0,H.jsx)(V4,{value:e.value,children:e.label},e.value))]},e))]})]}):(0,H.jsx)(zq,{"data-testid":`settings-input-${e.id}`,"aria-label":e.label,value:l,type:f===`number`?`number`:`text`,spellCheck:!1,disabled:a||s!==void 0,placeholder:e.placeholder??`Inherit`,onChange:t=>o(e,t.target.value===``?null:t.target.value),className:`w-full text-sm sm:w-64`});return(0,H.jsxs)(Q4,{"data-testid":`settings-field-${e.id}`,"data-dirty":c,changed:f!==`info`&&t?.origin===n,className:`items-start`,children:[(0,H.jsxs)(e3,{className:`gap-1`,children:[(0,H.jsxs)(t3,{className:`flex min-h-6 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,H.jsx)(`span`,{className:`inline-block min-w-0 first-letter:uppercase`,children:e.label}),f===`info`?null:(0,H.jsx)(EZe,{field:e,view:t,scope:n,draft:i,busy:a,onDraft:o})]}),e.detail===void 0?null:(0,H.jsx)(n3,{children:e.detail}),(0,H.jsx)(TZe,{field:e})]}),m]})}function AZe({fields:e,values:t,drafts:n,group:r,...i}){let a=e=>({field:e,view:t?.[Nj(e)],draft:Nj(e)in n?n[Nj(e)]:void 0,scope:i.scope,busy:i.busy,onDraft:i.onDraft}),o=e.filter(e=>e.presentation===`cards`&&e.kind===`select`),s=e.filter(e=>!o.includes(e)),c=r?.signInProvider;return(0,H.jsxs)(H.Fragment,{children:[o.map(e=>(0,H.jsx)(DZe,{...a(e)},e.id)),s.length===0&&c===void 0?null:(0,H.jsxs)(Z4,{children:[c===void 0||r===void 0?null:(0,H.jsx)(OZe,{providerId:c,groupLabel:r.label}),s.map(e=>(0,H.jsx)(kZe,{...a(e),models:i.models},e.id))]})]})}function Y3({section:e,scope:t,repoRoot:n=``,workspaceId:r}){let[i,a]=(0,V.useState)([]),o=(0,V.useMemo)(()=>({section:e,scope:t,repoRoot:n,workspaceId:r}),[e,t,n,r]),s=cL(o),{config:c,drafts:l,error:u,note:d,busy:f}=U(oL,e=>e[s]??aL),p=e.fields.some(e=>e.optionsFrom===`models`),m=e.fields.filter(e=>Nj(e)in l);(0,V.useEffect)(()=>{p&&Ej().then(a)},[p]),(0,V.useEffect)(()=>{uL(o)},[o]);let h=(e,t)=>dL(o,e,t),g=()=>pL(o),_=()=>fL(o),v=e.groups??[],y=e.fields.filter(e=>e.group===void 0||!v.some(t=>t.id===e.group)),b={values:c?.values,drafts:l,scope:t,models:i,busy:f,onDraft:h};return(0,H.jsxs)(U4,{"data-testid":`settings-contributed-${e.id}`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:e.label}),e.detail?(0,H.jsx)(K4,{children:e.detail}):null,t===`repository`&&n===``?(0,H.jsx)(r3,{"data-testid":`settings-no-repositories`,children:`Pick a repository above to edit its config.`}):null]}),u===``?null:(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't load or save these settings`}),(0,H.jsx)(n3,{"data-testid":`settings-error`,className:`text-po-red`,children:u})]}),(0,H.jsx)(Z,{size:`sm`,variant:`outline`,disabled:f,onClick:()=>void uL(o),children:`Reload configuration`})]})}),v.map(t=>(0,H.jsxs)(q4,{"data-testid":`settings-group-${t.id}`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:t.label}),t.detail===void 0?null:(0,H.jsx)(X4,{children:t.detail})]}),(0,H.jsx)(AZe,{...b,group:t,fields:e.fields.filter(e=>e.group===t.id)})]},t.id)),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,H.jsx)(AZe,{...b,fields:y}),(0,H.jsxs)(i3,{children:[(0,H.jsx)(Z,{variant:m.length>0?`primary`:`outline`,size:`sm`,"data-testid":`settings-save`,loading:f,disabled:f||!Ij({dirty:m.length,scope:t,repoRoot:n}),onClick:()=>void g(),children:`Save`}),m.length===0?null:(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-testid":`settings-discard`,disabled:f,onClick:_,children:`Discard`}),(0,H.jsx)(r3,{"data-testid":`settings-save-note`,children:m.length>0?`${String(m.length)} unsaved. Saves to ${t===`global`?`the global config`:`this repository`}.`:d})]})]})]})}function jZe(){let[e,t,n]=gL(`images/view`,void 0),[r,i]=gL(`images/draft`,``),[a,o]=gL(`images/error`,void 0),[s,c,l]=gL(`images/busy`,!1),u=(e=()=>!1)=>{Oj().then(r=>{e()||l.state||n.state!==void 0||(r.ok?(t(r.images),i(String(r.images.maxDimension)),o(void 0)):o(r.error))})};(0,V.useEffect)(()=>{if(n.state!==void 0)return;let e=!1;return u(()=>e),()=>{e=!0}},[n,l,t,i,o]);let d=async e=>{if(l.state)return;c(!0);let n;try{n=await kj(e)}finally{c(!1)}n.ok?(t(n.images),e.maxDimension!==void 0&&i(e=>e===r?String(n.images.maxDimension):e),o(void 0)):o(n.error)},f=Number.parseInt(r,10),p=e!==void 0&&Number.isFinite(f)&&f!==e.maxDimension;return(0,H.jsxs)(U4,{"data-testid":`image-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Images`}),(0,H.jsx)(K4,{children:`How large an image can be when it reaches a model. This covers images the agent reads and the ones you attach. Pi's own settings screen changes the same values.`})]}),e===void 0&&a!==void 0?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{"data-testid":`image-settings-error`,title:a,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't read your image settings just now`}),(0,H.jsx)(n3,{children:`Nothing has changed. Images are handled as they were before.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>u(),children:`Try again`})]})}):null,e!==void 0&&a!==void 0?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`image-settings-error`,className:`text-sm leading-relaxed text-po-red`,children:a}):null,e===void 0&&a===void 0?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading image settings`}),(0,H.jsx)(Lq,{className:`h-4 w-48`}),(0,H.jsx)(Lq,{className:`h-4 w-72`})]}):null,e===void 0?null:(0,H.jsxs)(Z4,{children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{id:`image-auto-resize-label`,children:`Resize large images`}),(0,H.jsx)(n3,{children:`When off, images go out at the size they arrived, and some providers then reject the whole conversation.`})]}),(0,H.jsx)(a3,{"data-testid":`image-auto-resize`,"aria-labelledby":`image-auto-resize-label`,checked:e.autoResize,disabled:s,onCheckedChange:e=>void d({autoResize:e})})]}),(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{id:`image-max-dimension-label`,children:`Longest edge`}),(0,H.jsxs)(n3,{children:[`In pixels, from `,e.minDimension,` to `,e.maxAllowedDimension,`; anything outside is clamped. Tool results are always capped at `,e.maxAllowedDimension,`.`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(zq,{"data-testid":`image-max-dimension`,"aria-labelledby":`image-max-dimension-label`,value:r,inputMode:`numeric`,spellCheck:!1,disabled:s||!e.autoResize,onChange:e=>i(e.target.value),className:`w-24 text-right font-mono text-sm tabular-nums`}),(0,H.jsx)(Z,{size:`sm`,variant:p?`primary`:`outline`,"data-testid":`image-max-dimension-save`,disabled:s||!p,onClick:()=>void d({maxDimension:f}),children:`Save`})]})]})]})]})}var MZe={api_key:`API key`,oauth:`OAuth`},X3=`inline break-all decoration-po-blue/40 hover:decoration-po-blue`;function NZe({event:e}){return e.type===`auth_url`?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-po-text`,children:[(0,H.jsx)(`span`,{children:`Open this link to sign in:`}),(0,H.jsx)(Z,{asChild:!0,variant:`link`,size:`xs`,className:X3,children:(0,H.jsx)(`a`,{"data-testid":`login-flow-auth-url`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.url})}),e.instructions?(0,H.jsx)(`span`,{className:`text-po-dim`,children:e.instructions}):null]}):e.type===`device_code`?(0,H.jsx)(`div`,{className:`flex flex-col gap-1 text-sm text-po-text`,children:(0,H.jsxs)(`span`,{children:[`Enter the code`,` `,(0,H.jsx)(`span`,{"data-testid":`login-flow-device-code`,className:`font-mono font-medium text-po-hi`,children:e.userCode}),` `,`at`,` `,(0,H.jsx)(`a`,{href:e.verificationUri,target:`_blank`,rel:`noreferrer`,className:X3,children:e.verificationUri})]})}):e.type===`info`?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-po-text`,children:[(0,H.jsx)(`span`,{children:e.message}),e.links?.map(e=>(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:X3,children:e.label??e.url},e.url))]}):(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:e.message})}function PZe({prompt:e,value:t,remote:n,onChange:r,onSubmit:i,onSelect:a}){return e.type===`select`?(0,H.jsxs)(`div`,{"data-testid":`login-prompt`,"data-prompt-type":e.type,className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-text`,children:e.message}),(0,H.jsx)(`div`,{className:`flex flex-col gap-1`,children:(e.options??[]).map(e=>(0,H.jsxs)(Z,{variant:`outline`,"data-testid":`login-prompt-option-${e.id}`,onClick:()=>a(e.id),className:`h-auto flex-col items-start gap-0.5 px-2.5 py-1.5 text-left whitespace-normal focus-visible:border-po-blue/50 focus-visible:ring-0`,children:[(0,H.jsx)(`span`,{className:`text-base font-medium text-po-hi`,children:e.label}),e.description?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:e.description}):null]},e.id))})]}):(0,H.jsxs)(`label`,{"data-testid":`login-prompt`,"data-prompt-type":e.type,className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-text`,children:e.message}),n&&e.type===`manual_code`?(0,H.jsx)(`span`,{"data-testid":`login-prompt-remote-hint`,className:`text-sm text-po-dim`,children:`The page it sends you to will not load from here. Copy the whole address from your browser's address bar and paste it below.`}):null,(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(zq,{"data-testid":`login-prompt-input`,type:e.type===`secret`?`password`:`text`,value:t,autoFocus:!0,autoComplete:`off`,placeholder:e.placeholder,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i()},className:`flex-1`}),(0,H.jsx)(Z,{variant:`primary`,"data-testid":`login-prompt-submit`,disabled:t.trim()===``,onClick:i,children:`Continue`})]})]})}function FZe({flow:e,onAnswer:t,onCancel:n,onClose:r}){let i=e.prompt,a=JSON.stringify([e.id,i?.id]),o=e.status===`running`,[s,c]=gL(`providers/answer`,``),[l,u]=gL(`providers/prompt`,a);(l!==a||!o&&s!==``)&&(u(a),c(``));let d=()=>{i&&s.trim()!==``&&t(i.id,s)},f;return e.status===`succeeded`?f={text:`You're signed in to ${e.providerName}. Every session can use it now.`,className:`text-po-green`}:e.status===`failed`?f={text:e.error??`Sign-in failed.`,className:`text-po-red`}:e.status===`cancelled`&&(f={text:`Sign-in cancelled.`,className:`text-po-dim`}),(0,H.jsx)(aq,{open:!0,onOpenChange:e=>{e||(o?n():r())},children:(0,H.jsxs)(cq,{width:`md`,"data-testid":`login-flow`,"data-status":e.status,"aria-describedby":void 0,children:[(0,H.jsxs)(lq,{children:[(0,H.jsxs)(uq,{children:[`Sign in to `,e.providerName]}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:MZe[e.type]})]}),(0,H.jsxs)(fq,{children:[e.events.length>0?(0,H.jsx)(`ol`,{"data-testid":`login-flow-events`,className:`flex flex-col gap-2`,children:e.events.map((e,t)=>(0,H.jsx)(`li`,{children:(0,H.jsx)(NZe,{event:e})},t))}):null,o&&i?(0,H.jsx)(PZe,{prompt:i,value:s,remote:e.remote===!0,onChange:c,onSubmit:d,onSelect:e=>t(i.id,e)}):null,o&&!i?(0,H.jsxs)(`p`,{"data-testid":`login-flow-waiting`,className:`flex items-center gap-2 text-sm text-po-dim`,children:[(0,H.jsx)(nq,{}),e.events.length===0?`Starting…`:`Waiting for ${e.providerName}…`]}):null,f?(0,H.jsx)(`p`,{"data-testid":`login-flow-result`,className:`text-sm ${f.className}`,children:f.text}):null,(0,H.jsx)(mq,{children:o?(0,H.jsx)(Z,{variant:`outline`,"data-testid":`login-flow-cancel`,onClick:n,children:`Cancel`}):(0,H.jsx)(Z,{variant:`outline`,"data-testid":`login-flow-close`,autoFocus:!0,onClick:r,children:e.status===`succeeded`?`Done`:`Close`})})]})]})})}var IZe={granted:`Allowed in this browser.`,denied:`Blocked in this browser. Turn them on in your browser's site settings.`,default:`This browser hasn't been asked yet.`,unsupported:`This browser doesn't support notifications.`,"request-error":`The browser couldn't finish the request. Try again.`},LZe={enabled:`On for this paired device.`,disabled:`Off. Turn on to hear from Po when the app is closed.`,denied:`Notifications are blocked in this browser.`,unsupported:`Not available in this browser. On iPhone, add Po to your Home Screen first.`,error:`Po couldn't update the alert subscription. Try again.`};function RZe(){let[e,t]=(0,V.useState)(Jt),[n,r]=(0,V.useState)(`disabled`);(0,V.useEffect)(()=>{Ige().then(r)},[]);let i=async()=>{r(await Lge()),t(Jt())},a=async()=>{r(await Rge())},o=async()=>{t(await Yt())};return(0,H.jsxs)(U4,{"data-testid":`notification-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Notifications`}),(0,H.jsx)(K4,{children:`An open page shows the full notification. When Po is closed you get a short alert with no session content, and alerts missed while offline are not replayed.`})]}),(0,H.jsxs)(Z4,{children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`Browser notifications`}),(0,H.jsx)(n3,{"data-testid":`notification-permission-status`,children:IZe[e]})]}),e==="default"?(0,H.jsx)(Z,{size:`sm`,variant:`outline`,"data-testid":`browser-notification-request`,onClick:()=>void o(),children:`Allow`}):null]}),(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`Alerts when Po is closed`}),(0,H.jsx)(n3,{"data-testid":`push-subscription-status`,children:LZe[n]})]}),n===`enabled`?(0,H.jsx)(Z,{size:`sm`,variant:`outline`,"data-testid":`push-disable`,onClick:()=>void a(),children:`Turn off`}):n!==`denied`&&n!==`unsupported`?(0,H.jsx)(Z,{size:`sm`,"data-testid":`notification-permission-request`,onClick:()=>void i(),children:`Turn on`}):null]})]})]})}function Z3(e,t){return`${String(e)} ${t}${e===1?``:`s`}`}function zZe(e,t){if(e.layers.length===0)return`Only the ${String(t)} Po plugins every preset includes`;let n=e.layers.reduce((e,t)=>e+t.packages.length,0);return`${Z3(e.layers.length,`layer`)}, ${Z3(n,`Po plugin`)} on top of the ${String(t)} always included`}function BZe(){let[e,t,n]=gL(`presets/view`,void 0),[r,i]=gL(`presets/selected`,void 0),[a,o]=gL(`presets/error`,void 0),[s,c,l]=gL(`presets/busy`,!1),u=(e=()=>!1)=>{jj().then(r=>{e()||l.state||n.state!==void 0||(r.ok?(t(r.presets),o(void 0)):o(r.error))})};(0,V.useEffect)(()=>{if(n.state!==void 0)return;let e=!1;return u(()=>e),()=>{e=!0}},[n,l,t,o]);let d=async e=>{if(l.state)return;c(!0);let n;try{n=await Mj({defaultPreset:e})}finally{c(!1)}n.ok?(t(n.presets),o(void 0)):o(n.error)},f=e?.presets.find(e=>e.name===r)??e?.presets.find(t=>t.name===e.defaultPreset)??e?.presets[0];return(0,H.jsxs)(U4,{"data-testid":`preset-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Presets`}),(0,H.jsxs)(K4,{children:[`A preset is a major mode: the Po plugins a session starts with. A session runs one preset, and new sessions start with the default. Your presets come from `,(0,H.jsx)(`code`,{className:`font-mono`,children:`~/.po/modes.yaml`}),`; a repository can pick its own in Workspaces.`]})]}),e===void 0&&a!==void 0?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{"data-testid":`preset-settings-error`,title:a,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't read your presets just now`}),(0,H.jsx)(n3,{children:`Nothing has changed. New sessions start as they did before.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>u(),children:`Try again`})]})}):null,e!==void 0&&a!==void 0?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`preset-settings-error`,className:`text-sm leading-relaxed text-po-red`,children:a}):null,e===void 0&&a===void 0?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading presets`}),(0,H.jsx)(Lq,{className:`h-4 w-48`}),(0,H.jsx)(Lq,{className:`h-4 w-72`})]}):null,e===void 0?null:(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Presets`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim tabular-nums`,children:Z3(e.presets.length,`preset`)})]}),e.presets.length===0?(0,H.jsx)(Z4,{children:(0,H.jsx)(Q4,{"data-testid":`preset-settings-empty`,children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No presets yet`}),(0,H.jsxs)(n3,{children:[`Run `,(0,H.jsx)(`code`,{className:`font-mono`,children:`po init`}),` to write the starter presets into`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`~/.po/modes.yaml`}),`.`]})]})})}):(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{children:e.presets.map(t=>{let n=t.name===e.defaultPreset,r=t.name===f?.name;return(0,H.jsx)(Q4,{asChild:!0,className:r?`bg-po-deep`:void 0,children:(0,H.jsxs)(`li`,{"data-testid":`preset-${t.name}`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-current":r?`true`:void 0,onClick:()=>i(t.name),className:`min-w-0 flex-1 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-po-green`,children:(0,H.jsxs)(e3,{children:[(0,H.jsxs)(t3,{className:`flex items-center gap-2 first-letter:normal-case`,children:[(0,H.jsx)(`span`,{className:`font-mono`,children:t.name}),n?(0,H.jsx)(XK,{tone:`green`,children:`Default`}):null]}),t.description?(0,H.jsx)(n3,{children:t.description}):null,(0,H.jsx)(n3,{children:zZe(t,e.alwaysIncluded.length)})]})}),(0,H.jsxs)(hq,{children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"aria-label":`Actions for ${t.name}`,"data-testid":`preset-actions-${t.name}`,children:(0,H.jsx)($L,{"aria-hidden":!0,className:`size-4`})})}),(0,H.jsx)(vq,{align:`end`,children:(0,H.jsx)(bq,{disabled:n||s,"data-testid":`preset-make-default-${t.name}`,onSelect:()=>void d(t.name),children:`Make default`})})]})]})},t.name)})})})]}),e===void 0||f===void 0?null:(0,H.jsxs)(q4,{children:[(0,H.jsx)(J4,{children:(0,H.jsxs)(Y4,{children:[`In `,(0,H.jsx)(`span`,{className:`font-mono`,children:f.name})]})}),(0,H.jsx)(X4,{children:`Its layers load in this order, each with the Po plugins it bundles.`}),(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{"data-testid":`preset-layers`,children:f.layers.length>0?f.layers.map(e=>(0,H.jsx)(Q4,{asChild:!0,children:(0,H.jsxs)(`li`,{children:[(0,H.jsx)(e3,{children:(0,H.jsx)(t3,{className:`font-mono first-letter:normal-case`,children:e.name})}),(0,H.jsx)(`span`,{className:`flex flex-wrap justify-end gap-1.5`,children:e.packages.map(e=>(0,H.jsx)(XK,{className:`font-mono`,children:e},e))})]})},e.name)):(0,H.jsx)(Q4,{asChild:!0,children:(0,H.jsx)(`li`,{children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No layers`}),(0,H.jsx)(n3,{children:`Sessions on this preset get only the Po plugins every preset includes.`})]})})})})})]}),e===void 0||e.alwaysIncluded.length===0?null:(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Always included`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim tabular-nums`,children:Z3(e.alwaysIncluded.length,`Po plugin`)})]}),(0,H.jsx)(X4,{children:`Every preset starts with these.`}),(0,H.jsx)(Z4,{className:`p-4`,children:(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.alwaysIncluded.map(e=>(0,H.jsx)(XK,{className:`font-mono`,children:e},e))})})]})]})}var VZe={anthropic:[`M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z`],aws:[`M6.763 11.212c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 01-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 01-.287-.375 6.18 6.18 0 01-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.39-.384-.59-.894-.59-1.533 0-.678.24-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272-.09.04-.184.075-.28.104a.488.488 0 01-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 01.224-.167 4.577 4.577 0 011.005-.36 4.84 4.84 0 011.246-.151c.95 0 1.644.216 2.091.647.44.43.662 1.085.662 1.963v2.586h.016zm-3.24 1.214c.263 0 .534-.048.822-.144a1.78 1.78 0 00.758-.51 1.27 1.27 0 00.272-.512c.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 00-.735-.136 6.02 6.02 0 00-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 6.726a1.398 1.398 0 01-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 01.32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 01.311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 01-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 01-.303.08h-.687c-.15 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32L12.32 7.747l-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08l-.686.001zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 01-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.32.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 00.415-.758.777.777 0 00-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 01-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .36.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 01.24.2.43.43 0 01.071.263v.375c0 .168-.064.256-.184.256a.83.83 0 01-.303-.096 3.652 3.652 0 00-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.16.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926a2.157 2.157 0 01-.583.703c-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167z`,`M.378 15.475c3.384 1.963 7.56 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.44-.2.814.287.383.607-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351zm23.531-.2c.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151l.175-.439c.343-.88.802-2.198.52-2.555-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399z`],azure:[{d:`M18.397 15.296H7.4a.51.51 0 00-.347.882l7.066 6.595c.206.192.477.298.758.298h6.226l-2.706-7.775z`,opacity:.75},{d:`M8.295.857c-.477 0-.9.304-1.053.756L.495 21.605a1.11 1.11 0 001.052 1.466h5.43c.477 0 .9-.304 1.053-.755l1.341-3.975-2.318-2.163a.51.51 0 01.347-.882h3L15.271.857H8.295z`,opacity:.5},`M17.193 1.613a1.11 1.11 0 00-1.052-.756h-7.81.035c.477 0 .9.304 1.052.756l6.748 19.992a1.11 1.11 0 01-1.052 1.466h-.12 7.895a1.11 1.11 0 001.052-1.466L17.193 1.613z`],baseten:[`M2.316 4.8h14.682v4.8H7.31a.302.302 0 00-.308.3v4.2c0 .171.14.3.308.3h9.688v4.8h-4.686a.302.302 0 00-.308.3v4.2c0 .171.141.3.308.3h4.378a.297.297 0 00.308-.3v-4.5h4.694a.302.302 0 00.308-.3v-4.2c0-.171-.14-.3-.308-.3h-4.694V9.6h4.694A.302.302 0 0022 9.3V5.1c0-.171-.14-.3-.308-.3h-4.694V.3c0-.171-.14-.3-.308-.3H2.316A.31.31 0 002 .3v4.2c0 .171.14.3.316.3z`],cerebras:[`M14.121 2.701a9.299 9.299 0 000 18.598V22.7c-5.91 0-10.7-4.791-10.7-10.701S8.21 1.299 14.12 1.299V2.7zm4.752 3.677A7.353 7.353 0 109.42 17.643l-.901 1.074a8.754 8.754 0 01-1.08-12.334 8.755 8.755 0 0112.335-1.08l-.901 1.075zm-2.255.844a5.407 5.407 0 00-5.048 9.563l-.656 1.24a6.81 6.81 0 016.358-12.043l-.654 1.24zM14.12 8.539a3.46 3.46 0 100 6.922v1.402a4.863 4.863 0 010-9.726v1.402z`,`M15.407 10.836a2.24 2.24 0 00-.51-.409 1.084 1.084 0 00-.544-.152c-.255 0-.483.047-.684.14a1.58 1.58 0 00-.84.912c-.074.203-.11.416-.11.631 0 .218.036.43.11.631a1.594 1.594 0 00.84.913c.2.093.43.14.684.14.216 0 .417-.046.602-.135.188-.09.35-.225.475-.392l.928 1.006c-.14.14-.3.261-.482.363a3.367 3.367 0 01-1.083.38c-.17.026-.317.04-.44.04a3.315 3.315 0 01-1.182-.21 2.825 2.825 0 01-.961-.597 2.816 2.816 0 01-.644-.929 2.987 2.987 0 01-.238-1.21c0-.444.08-.847.238-1.21.15-.35.368-.666.643-.929.278-.261.605-.464.962-.596a3.315 3.315 0 011.182-.21c.355 0 .712.068 1.072.204.361.138.685.36.944.649l-.962.97z`],claude:[`M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z`],cloudflare:[`M16.493 17.4c.135-.52.08-.983-.161-1.338-.215-.328-.592-.519-1.05-.519l-8.663-.109a.148.148 0 01-.135-.082c-.027-.054-.027-.109-.027-.163.027-.082.108-.164.189-.164l8.744-.11c1.05-.054 2.153-.9 2.556-1.937l.511-1.31c.027-.055.027-.11.027-.164C17.92 8.91 15.66 7 12.942 7c-2.503 0-4.628 1.638-5.381 3.903a2.432 2.432 0 00-1.803-.491c-1.21.109-2.153 1.092-2.287 2.32-.027.328 0 .628.054.9C1.56 13.688 0 15.326 0 17.319c0 .19.027.355.027.545 0 .082.08.137.161.137h15.983c.08 0 .188-.055.215-.164l.107-.437`,`M19.238 11.75h-.242c-.054 0-.108.054-.135.109l-.35 1.2c-.134.52-.08.983.162 1.338.215.328.592.518 1.05.518l1.855.11c.054 0 .108.027.135.082.027.054.027.109.027.163-.027.082-.108.164-.188.164l-1.91.11c-1.05.054-2.153.9-2.557 1.937l-.134.355c-.027.055.026.137.107.137h6.592c.081 0 .162-.055.162-.137.107-.41.188-.846.188-1.31-.027-2.62-2.153-4.777-4.762-4.777`],deepseek:[`M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z`],fireworks:[`M14.8 5l-2.801 6.795L9.195 5H7.397l3.072 7.428a1.64 1.64 0 003.038.002L16.598 5H14.8zm1.196 10.352l5.124-5.244-.699-1.669-5.596 5.739a1.664 1.664 0 00-.343 1.807 1.642 1.642 0 001.516 1.012L16 17l8-.02-.699-1.669-7.303.041h-.002zM2.88 10.104l.699-1.669 5.596 5.739c.468.479.603 1.189.343 1.807a1.643 1.643 0 01-1.516 1.012l-8-.018-.002.002.699-1.669 7.303.042-5.122-5.246z`],githubcopilot:[`M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z`],google:[`M23 12.245c0-.905-.075-1.565-.236-2.25h-10.54v4.083h6.186c-.124 1.014-.797 2.542-2.294 3.569l-.021.136 3.332 2.53.23.022C21.779 18.417 23 15.593 23 12.245z`,`M12.225 23c3.03 0 5.574-.978 7.433-2.665l-3.542-2.688c-.948.648-2.22 1.1-3.891 1.1a6.745 6.745 0 01-6.386-4.572l-.132.011-3.465 2.628-.045.124C4.043 20.531 7.835 23 12.225 23z`,`M5.84 14.175A6.65 6.65 0 015.463 12c0-.758.138-1.491.361-2.175l-.006-.147-3.508-2.67-.115.054A10.831 10.831 0 001 12c0 1.772.436 3.447 1.197 4.938l3.642-2.763z`,`M12.225 5.253c2.108 0 3.529.892 4.34 1.638l3.167-3.031C17.787 2.088 15.255 1 12.225 1 7.834 1 4.043 3.469 2.197 7.062l3.63 2.763a6.77 6.77 0 016.398-4.572z`],groq:[`M12.036 2c-3.853-.035-7 3-7.036 6.781-.035 3.782 3.055 6.872 6.908 6.907h2.42v-2.566h-2.292c-2.407.028-4.38-1.866-4.408-4.23-.029-2.362 1.901-4.298 4.308-4.326h.1c2.407 0 4.358 1.915 4.365 4.278v6.305c0 2.342-1.944 4.25-4.323 4.279a4.375 4.375 0 01-3.033-1.252l-1.851 1.818A7 7 0 0012.029 22h.092c3.803-.056 6.858-3.083 6.879-6.816v-6.5C18.907 4.963 15.817 2 12.036 2z`],huggingface:[`M16.781 3.277c2.997 1.704 4.844 4.851 4.844 8.258 0 .995-.155 1.955-.443 2.857a1.332 1.332 0 011.125.4 1.41 1.41 0 01.2 1.723c.204.165.352.385.428.632l.017.062c.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.255.57-.893 1.018-2.128 1.5l-.202.078-.131.048c-.478.173-.89.295-1.061.345l-.086.024c-.89.243-1.808.375-2.732.394-1.32 0-2.3-.36-2.923-1.067a9.852 9.852 0 01-3.18.018C9.778 21.647 8.802 22 7.494 22a11.249 11.249 0 01-2.541-.343l-.221-.06-.273-.08a16.574 16.574 0 01-1.175-.405c-1.237-.483-1.875-.93-2.13-1.501-.186-.4-.151-.867.093-1.236a1.42 1.42 0 01-.2-1.166c.069-.273.226-.516.447-.694a1.41 1.41 0 01.2-1.722c.233-.248.557-.391.917-.407l.078-.001a9.385 9.385 0 01-.44-2.85c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0zM4.188 14.758c.125.687 2.357 2.35 2.14 2.707-.19.315-.796-.239-.948-.386l-.041-.04-.168-.147c-.561-.479-2.304-1.9-2.74-1.432-.43.46.119.859 1.055 1.42l.784.467.136.083c1.045.643 1.12.84.95 1.113-.188.295-3.07-2.1-3.34-1.083-.27 1.011 2.942 1.304 2.744 2.006-.2.7-2.265-1.324-2.685-.537-.425.79 2.913 1.718 2.94 1.725l.16.04.175.042c1.227.284 3.565.65 4.435-.604.673-.973.64-1.709-.248-2.61l-.057-.057c-.945-.928-1.495-2.288-1.495-2.288l-.017-.058-.025-.072c-.082-.22-.284-.639-.63-.584-.46.073-.798 1.21.12 1.933l.05.038c.977.721-.195 1.21-.573.534l-.058-.104-.143-.25c-.463-.799-1.282-2.111-1.739-2.397-.532-.332-.907-.148-.782.541zm14.842-.541c-.533.335-1.563 2.074-1.94 2.751a.613.613 0 01-.687.302.436.436 0 01-.176-.098.303.303 0 01-.049-.06l-.014-.028-.008-.02-.007-.019-.003-.013-.003-.017a.289.289 0 01-.004-.048c0-.12.071-.266.25-.427.026-.024.054-.047.084-.07l.047-.036c.022-.016.043-.032.063-.049.883-.71.573-1.81.131-1.917l-.031-.006-.056-.004a.368.368 0 00-.062.006l-.028.005-.042.014-.039.017-.028.015-.028.019-.036.027-.023.02c-.173.158-.273.428-.31.542l-.016.054s-.53 1.309-1.439 2.234l-.054.054c-.365.358-.596.69-.702 1.018-.143.437-.066.868.21 1.353.055.097.117.195.187.296.882 1.275 3.282.876 4.494.59l.286-.07.25-.074c.276-.084.736-.233 1.2-.42l.188-.077.065-.028.064-.028.124-.056.081-.038c.529-.252.964-.543.994-.827l.001-.036a.299.299 0 00-.037-.139c-.094-.176-.271-.212-.491-.168l-.045.01c-.044.01-.09.024-.136.04l-.097.035-.054.022c-.559.23-1.238.705-1.607.745h.006a.452.452 0 01-.05.003h-.024l-.024-.003-.023-.005c-.068-.016-.116-.06-.14-.142a.22.22 0 01-.005-.1c.062-.345.958-.595 1.713-.91l.066-.028c.528-.224.97-.483.985-.832v-.04a.47.47 0 00-.016-.098c-.048-.18-.175-.251-.36-.251-.785 0-2.55 1.36-2.92 1.36-.025 0-.048-.007-.058-.024a.6.6 0 01-.046-.088c-.1-.238.068-.462 1.06-1.066l.209-.126c.538-.32 1.01-.588 1.341-.831.29-.212.475-.406.503-.6l.003-.028c.008-.113-.038-.227-.147-.344a.266.266 0 00-.07-.054l-.034-.015-.013-.005a.403.403 0 00-.13-.02c-.162 0-.369.07-.595.18-.637.313-1.431.952-1.826 1.285l-.249.215-.033.033c-.08.078-.288.27-.493.386l-.071.037-.041.019a.535.535 0 01-.122.036h.005a.346.346 0 01-.031.003l.01-.001-.013.001c-.079.005-.145-.021-.19-.095a.113.113 0 01-.014-.065c.027-.465 2.034-1.991 2.152-2.642l.009-.048c.1-.65-.271-.817-.791-.493zM11.938 2.984c-4.798 0-8.688 3.829-8.688 8.55 0 .692.083 1.364.24 2.008l.008-.009c.252-.298.612-.46 1.017-.46.355.008.699.117.993.312.22.14.465.384.715.694.261-.372.69-.598 1.15-.605.852 0 1.367.728 1.562 1.383l.047.105.06.127c.192.396.595 1.139 1.143 1.68 1.06 1.04 1.324 2.115.8 3.266a8.865 8.865 0 002.024-.014c-.505-1.12-.26-2.17.74-3.186l.066-.066c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-.553.718-.694a1.87 1.87 0 01.99-.312c.357 0 .682.126.925.36.14-.61.215-1.245.215-1.898 0-4.722-3.89-8.55-8.687-8.55zm1.857 8.926l.439-.212c.553-.264.89-.383.89.152 0 1.093-.771 3.208-3.155 3.262h-.184c-2.325-.052-3.116-2.06-3.156-3.175l-.001-.087c0-1.107 1.452.586 3.25.586.716 0 1.379-.272 1.917-.526zm4.017-3.143c.45 0 .813.358.813.8 0 .441-.364.8-.813.8a.806.806 0 01-.812-.8c0-.442.364-.8.812-.8zm-11.624 0c.448 0 .812.358.812.8 0 .441-.364.8-.812.8a.806.806 0 01-.813-.8c0-.442.364-.8.813-.8zm7.79-.841c.32-.384.846-.54 1.33-.394.483.146.83.564.878 1.06.048.495-.212.97-.659 1.203-.322.168-.447-.477-.767-.585l.002-.003c-.287-.098-.772.362-.925.079a1.215 1.215 0 01.14-1.36zm-4.323 0c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003c-.108.036-.194.134-.273.24l-.118.165c-.11.15-.22.262-.377.18a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394z`],kimi:[`M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z`,`M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z`],ling:[`M9.561 0.074a0.46 0.46 0 0 1 0.517 0.011l2.848 1.357a0.222 0.222 0 0 1-0.033 0.374C9.008 3.93 6.663 5.994 5.43 7.997c-0.798 1.296-2.264 4.83-0.937 8.02 1.375 3.301 4.49 4.493 6.797 4.493 1.743 0 2.927-0.522 4.13-1.334 3.262-2.204 3.638-6.503 1.21-9.46a10 10 0 0 1 2.2 2.902 6.5 6.5 0 0 0-0.72-1.664c-0.72-1.176-1.688-2.163-3.056-2.849-3.045-1.526-9.397-0.79-10.397 5.78 0.1-4.557 3.127-7.416 5.868-8.3a9.7 9.7 0 0 1 4.654-0.314c2.029-1.639 4.272-2.376 5.075-2.601a0.53 0.53 0 0 1 0.522 0.137c0.23 0.23 0.63 0.632 1.142 1.135h0.003c0.152 0.15 0.073 0.41-0.138 0.45-1.974 0.38-3.322 0.755-4.746 1.412 1.727 0.698 3.206 1.92 4.108 3.606a0.367 0.367 0 0 1-0.199 0.52l-1.207 0.437c1.061 1.8 1.334 4.006 0.813 6.266-0.884 3.843-3.845 6.562-7.626 7.209a9.5 9.5 0 0 1-1.756 0.157 0.37 0.37 0 0 1-0.363-0.341 0.36 0.36 0 0 1-0.043-0.245l0.231-1.295c-1.055-0.074-2.045-0.248-3.036-0.648C2.077 19.094 1.46 13.297 2.304 9.785 3.4 5.23 6.766 1.78 9.561 0.074`],meta:[`M6.897 4c1.915 0 3.516.932 5.43 3.376l.282-.373c.19-.246.383-.484.58-.71l.313-.35C14.588 4.788 15.792 4 17.225 4c1.273 0 2.469.557 3.491 1.516l.218.213c1.73 1.765 2.917 4.71 3.053 8.026l.011.392.002.25c0 1.501-.28 2.759-.818 3.7l-.14.23-.108.153c-.301.42-.664.758-1.086 1.009l-.265.142-.087.04a3.493 3.493 0 01-.302.118 4.117 4.117 0 01-1.33.208c-.524 0-.996-.067-1.438-.215-.614-.204-1.163-.56-1.726-1.116l-.227-.235c-.753-.812-1.534-1.976-2.493-3.586l-1.43-2.41-.544-.895-1.766 3.13-.343.592C7.597 19.156 6.227 20 4.356 20c-1.21 0-2.205-.42-2.936-1.182l-.168-.184c-.484-.573-.837-1.311-1.043-2.189l-.067-.32a8.69 8.69 0 01-.136-1.288L0 14.468c.002-.745.06-1.49.174-2.23l.1-.573c.298-1.53.828-2.958 1.536-4.157l.209-.34c1.177-1.83 2.789-3.053 4.615-3.16L6.897 4zm-.033 2.615l-.201.01c-.83.083-1.606.673-2.252 1.577l-.138.199-.01.018c-.67 1.017-1.185 2.378-1.456 3.845l-.004.022a12.591 12.591 0 00-.207 2.254l.002.188c.004.18.017.36.04.54l.043.291c.092.503.257.908.486 1.208l.117.137c.303.323.698.492 1.17.492 1.1 0 1.796-.676 3.696-3.641l2.175-3.4.454-.701-.139-.198C9.11 7.3 8.084 6.616 6.864 6.616zm10.196-.552l-.176.007c-.635.048-1.223.359-1.82.933l-.196.198c-.439.462-.887 1.064-1.367 1.807l.266.398c.18.274.362.56.55.858l.293.475 1.396 2.335.695 1.114c.583.926 1.03 1.6 1.408 2.082l.213.262c.282.326.529.54.777.673l.102.05c.227.1.457.138.718.138.176.002.35-.023.518-.073.338-.104.61-.32.813-.637l.095-.163.077-.162c.194-.459.29-1.06.29-1.785l-.006-.449c-.08-2.871-.938-5.372-2.2-6.798l-.176-.189c-.67-.683-1.444-1.074-2.27-1.074z`],minimax:[`M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z`],mistral:[`M3.428 3.4h3.429v3.428h3.429v3.429h-.002 3.431V6.828h3.427V3.4h3.43v13.714H24v3.429H13.714v-3.428h-3.428v-3.429h-3.43v3.428h3.43v3.429H0v-3.429h3.428V3.4zm10.286 13.715h3.428v-3.429h-3.427v3.429z`],moonshot:[`M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z`],nvidia:[`M10.212 8.976V7.62c.127-.01.256-.017.388-.021 3.596-.117 5.957 3.184 5.957 3.184s-2.548 3.647-5.282 3.647a3.227 3.227 0 01-1.063-.175v-4.109c1.4.174 1.681.812 2.523 2.258l1.873-1.627a4.905 4.905 0 00-3.67-1.846 6.594 6.594 0 00-.729.044m0-4.476v2.025c.13-.01.259-.019.388-.024 5.002-.174 8.261 4.226 8.261 4.226s-3.743 4.69-7.643 4.69c-.338 0-.675-.031-1.007-.092v1.25c.278.038.558.057.838.057 3.629 0 6.253-1.91 8.794-4.169.421.347 2.146 1.193 2.501 1.564-2.416 2.083-8.048 3.763-11.24 3.763-.308 0-.603-.02-.894-.048V19.5H24v-15H10.21zm0 9.756v1.068c-3.356-.616-4.287-4.21-4.287-4.21a7.173 7.173 0 014.287-2.138v1.172h-.005a3.182 3.182 0 00-2.502 1.178s.615 2.276 2.507 2.931m-5.961-3.3c1.436-1.935 3.604-3.148 5.961-3.336V6.523C5.81 6.887 2 10.723 2 10.723s2.158 6.427 8.21 7.015v-1.166C5.77 16 4.25 10.958 4.25 10.958h-.002z`],openai:[`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`],opencode:[`M16 6H8v12h8V6zm4 16H4V2h16v20z`],openrouter:[`M18.654 3.87a5.087 5.087 0 110 10.174L23.7 19.09c.64.641.187 1.737-.72 1.737H8.48a8.479 8.479 0 010-16.958h10.175zM8.479 7.26a5.087 5.087 0 100 10.176 5.087 5.087 0 000-10.175z`],qwen:[`M19.713 2.825h-5.907c0-.251-.066-.503-.196-.728L12.819.728A1.46 1.46 0 0 0 11.559 0h-1.58c-.52 0-1 .275-1.26.728l-2.42 4.19a1.45 1.45 0 0 0 0 1.453l.791 1.37c.26.448.74.727 1.26.727h11.36c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-.79-1.37a1.46 1.46 0 0 0-1.26-.728zM.195 9.905l2.951 5.115a1.46 1.46 0 0 0-.531.531l-.791 1.37a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h4.84c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451L5.086 7.083a1.46 1.46 0 0 0-1.26-.728h-1.58c-.52 0-1 .276-1.26.728l-.79 1.37a1.45 1.45 0 0 0 0 1.452m15.888 13.367 2.951-5.115c.217.125.469.196.728.196h1.582c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-2.42-4.191a1.46 1.46 0 0 0-1.259-.728h-1.582c-.52 0-1 .276-1.259.728l-5.678 9.838a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h1.582c.52 0 1-.275 1.26-.728z`],together:[`M23.197 4.503A6 6 0 0015 2.307a5.973 5.973 0 00-2.995 4.933l5.996.008v.515h-5.996c.039.937.298 1.87.8 2.74a6 6 0 1010.39-6z`,`M.805 4.5A6 6 0 003 12.697a5.972 5.972 0 005.77.127L5.779 7.627l.446-.257 2.997 5.192A6 6 0 10.804 4.5z`,`M12 23.894a6 6 0 005.999-6c0-2.13-1.1-3.996-2.775-5.06l-3.005 5.189-.444-.258 2.997-5.192A6 6 0 1012 23.894z`],typesafeai:[`M16.512 2.928L16.512 7.067 20.242 9.487 20.243 18.652 12 24 7.489 21.073 7.489 16.82 3.756 14.399 3.756 5.35 4.111 5.118 12 0ZM9.697 20.65L11.998 22.144 18.032 18.227 15.732 16.735ZM12.779 10.332L12.779 14.4 9.046 16.822 9.046 19.216 14.953 15.383 14.953 8.921ZM16.512 15.384L18.684 16.794 18.684 10.332 16.512 8.922ZM5.966 13.976L8.268 15.47 10.569 13.976 8.268 12.485ZM5.316 6.193L5.316 12.544 7.487 11.134 7.487 7.066 11.221 4.643 11.221 2.36 5.316 6.193ZM9.047 11.132L11.22 12.542 11.22 10.332 9.049 8.921 9.049 11.132ZM9.697 7.487L12 8.981 14.3 7.488 12 5.994ZM12.78 4.643L14.953 6.054 14.953 3.774 12.78 2.359Z`],vercel:[`M12 0l12 20.785H0L12 0z`],vertexai:[`M11.995 20.216a1.892 1.892 0 100 3.785 1.892 1.892 0 000-3.785zm0 2.806a.927.927 0 11.927-.914.914.914 0 01-.927.914z`,`M21.687 14.144c.237.038.452.16.605.344a.978.978 0 01-.18 1.3l-8.24 6.082a1.892 1.892 0 00-1.147-1.508l8.28-6.08a.991.991 0 01.682-.138z`,`M10.122 21.842l-8.217-6.066a.952.952 0 01-.206-1.287.978.978 0 011.287-.206l8.28 6.08a1.893 1.893 0 00-1.144 1.479z`,`M4.273 4.475a.978.978 0 01-.965-.965V1.09a.978.978 0 111.943 0v2.42a.978.978 0 01-.978.965zM4.247 13.034a.978.978 0 100-1.956.978.978 0 000 1.956zM4.247 10.19a.978.978 0 100-1.956.978.978 0 000 1.956zM4.247 7.332a.978.978 0 100-1.956.978.978 0 000 1.956z`,`M19.718 7.307a.978.978 0 01-.965-.979v-2.42a.965.965 0 011.93 0v2.42a.964.964 0 01-.965.979zM19.743 13.047a.978.978 0 100-1.956.978.978 0 000 1.956zM19.743 10.151a.978.978 0 100-1.956.978.978 0 000 1.956zM19.743 2.068a.978.978 0 100-1.956.978.978 0 000 1.956z`,`M11.995 15.917a.978.978 0 01-.965-.965v-2.459a.978.978 0 011.943 0v2.433a.976.976 0 01-.978.991zM11.995 18.762a.978.978 0 100-1.956.978.978 0 000 1.956zM11.995 10.64a.978.978 0 100-1.956.978.978 0 000 1.956zM11.995 7.783a.978.978 0 100-1.956.978.978 0 000 1.956z`,`M15.856 10.177a.978.978 0 01-.965-.965v-2.42a.977.977 0 011.702-.763.979.979 0 01.241.763v2.42a.978.978 0 01-.978.965zM15.869 4.913a.978.978 0 100-1.956.978.978 0 000 1.956zM15.869 15.853a.978.978 0 100-1.956.978.978 0 000 1.956zM15.869 12.996a.978.978 0 100-1.956.978.978 0 000 1.956z`,`M8.121 15.853a.978.978 0 100-1.956.978.978 0 000 1.956zM8.121 7.783a.978.978 0 100-1.956.978.978 0 000 1.956zM8.121 4.913a.978.978 0 100-1.957.978.978 0 000 1.957zM8.134 12.996a.978.978 0 01-.978-.94V9.611a.965.965 0 011.93 0v2.445a.966.966 0 01-.952.94z`],xai:[`M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z`],xiaomimimo:[`M.958 15.936a.459.459 0 01.459.44v2.729a.46.46 0 01-.918 0v-2.729a.459.459 0 01.459-.44zm4.814-2.035a.46.46 0 01.553.45v4.754a.458.458 0 11-.918 0V15.48L3.74 17.202a.462.462 0 01-.655.016.462.462 0 01-.065-.082L.628 14.67a.459.459 0 01.658-.637l2.124 2.187 2.127-2.188a.46.46 0 01.235-.13zm2.068.004a.46.46 0 01.458.445v4.755a.46.46 0 01-.458.458.459.459 0 01-.458-.458V14.35a.459.459 0 01.458-.445zm1.973 2.014a.46.46 0 01.46.457v2.729a.46.46 0 01-.784.324.46.46 0 01-.134-.324v-2.729a.46.46 0 01.458-.458zm.002-2.045a.458.458 0 01.328.157l2.127 2.19 2.125-2.19a.459.459 0 01.784.318v4.756a.46.46 0 01-.455.458.46.46 0 01-.458-.458V15.48l-1.667 1.723a.46.46 0 01-.65.008l-.005-.005c0-.002-.002-.002-.004-.003l-2.455-2.534a.46.46 0 01-.008-.667.461.461 0 01.338-.128zm6.797 1.206a.46.46 0 01.53.651A1.966 1.966 0 0019.81 18.4a.462.462 0 01.623.18.46.46 0 01-.181.624 2.863 2.863 0 01-1.38.353l-.142-.004a2.88 2.88 0 01-2.393-4.263.461.461 0 01.274-.21zm.864-.931a2.884 2.884 0 013.915 3.914.46.46 0 01-.402.24l-.057-.004a.458.458 0 01-.164-.055.46.46 0 01-.182-.622 1.967 1.967 0 00-2.669-2.67.459.459 0 11-.441-.803zM9.59 6.368c1.481 0 1.696 1.202 1.696 1.654v2.648h-.917v-.432c-.26.346-.792.535-1.36.535-.133 0-1.289-.03-1.384-1.136-.082-.932.675-1.61 2.053-1.61h.691c0-.563-.367-.886-.983-.886-.44.013-.864.174-1.2.458l-.36-.664c.484-.379 1.012-.567 1.764-.567zm4.427.1c1.263 0 2.082.97 2.083 2.15 0 1.181-.824 2.154-2.083 2.154-1.26 0-2.084-.972-2.084-2.152 0-1.18.82-2.153 2.084-2.153zm6.801.015c.68 0 1.202.465 1.197 1.548v2.642H21.1V8.29c0-.312-.002-.98-.63-.98s-.628.667-.628.838v2.524h-.89V8.148c0-.17-.001-.838-.63-.838-.628 0-.628.668-.628.98v2.383h-.917v-4.03h.917V7a1.22 1.22 0 01.947-.516c.398 0 .76.193.982.686a1.321 1.321 0 011.195-.686zm-18.093.872l1.457-1.772H5.32L3.311 8.07l2.14 2.602H4.24L2.725 8.796 1.21 10.672H0L2.138 8.07.13 5.583h1.138l1.458 1.772zm4.149 3.317h-.916V6.644h.916v4.028zm16.99 0h-.916V6.644h.916v4.028zM9.925 8.71c-1.055 0-1.359.412-1.326.742.032.329.324.537.757.537a1.013 1.013 0 001.014-.968l.002-.31h-.447zM14.018 7.3c-.663 0-1.184.487-1.184 1.32 0 .832.52 1.32 1.184 1.32.662 0 1.182-.49 1.182-1.32 0-.832-.52-1.32-1.182-1.32zM6.417 5.001a.568.568 0 01.587.582.588.588 0 01-1.175 0A.57.57 0 016.417 5zm16.991 0a.57.57 0 01.592.582.588.588 0 01-1.174 0 .57.57 0 01.357-.542.572.572 0 01.225-.04z`],zai:[`M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z`]},HZe={"amazon-bedrock":`aws`,"ant-ling":`ling`,anthropic:`anthropic`,azure:`azure`,"azure-openai-responses":`azure`,baseten:`baseten`,cerebras:`cerebras`,"claude-bridge":`claude`,"cloudflare-ai-gateway":`cloudflare`,"cloudflare-workers-ai":`cloudflare`,deepseek:`deepseek`,fireworks:`fireworks`,"github-copilot":`githubcopilot`,google:`google`,"google-vertex":`vertexai`,groq:`groq`,huggingface:`huggingface`,"kimi-coding":`kimi`,meta:`meta`,minimax:`minimax`,"minimax-cn":`minimax`,mistral:`mistral`,moonshotai:`moonshot`,"moonshotai-cn":`moonshot`,nvidia:`nvidia`,openai:`openai`,"openai-codex":`openai`,opencode:`opencode`,"opencode-go":`opencode`,openrouter:`openrouter`,"po-chatgpt":`openai`,"qwen-token-plan":`qwen`,"qwen-token-plan-cn":`qwen`,"qwen-token-plan-individual":`qwen`,together:`together`,typesafe:`typesafeai`,"vercel-ai-gateway":`vercel`,xai:`xai`,xiaomi:`xiaomimimo`,"xiaomi-token-plan-ams":`xiaomimimo`,"xiaomi-token-plan-cn":`xiaomimimo`,"xiaomi-token-plan-sgp":`xiaomimimo`,zai:`zai`,"zai-coding-cn":`zai`};function UZe(e){let[t=`?`,n]=e.match(/[A-Za-z0-9]+/g)??[];return(n?t.charAt(0)+n.charAt(0):t.slice(0,2)).toUpperCase()}function WZe({id:e,name:t,className:n}){let r=VZe[HZe[e]??``];return(0,H.jsx)(`span`,{"aria-hidden":!0,className:J(`flex size-10 shrink-0 items-center justify-center rounded-lg border border-po-border-soft bg-po-deep text-po-hi`,n),children:r?(0,H.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,className:`size-5`,children:r.map(e=>typeof e==`string`?(0,H.jsx)(`path`,{d:e},e):(0,H.jsx)(`path`,{d:e.d,fillOpacity:e.opacity},e.d))}):(0,H.jsx)(`span`,{className:`text-sm font-semibold`,children:UZe(t)})})}var GZe=`stored`,KZe={oauth:`Sign in`,api_key:`Add API key`},qZe={oauth:`OAuth`,api_key:`an API key`};function JZe({type:e,source:t}){return t===GZe?(0,H.jsxs)(H.Fragment,{children:[`Signed in with `,qZe[e],`, saved on this machine`]}):t?(0,H.jsxs)(H.Fragment,{children:[`Using the key in `,(0,H.jsx)(`code`,{className:`font-mono text-po-hi`,children:t})]}):(0,H.jsxs)(H.Fragment,{children:[`Signed in with `,qZe[e]]})}function YZe({provider:e,busy:t,onLogout:n}){let r=e.authenticated;return r?(0,H.jsx)(Q4,{asChild:!0,className:`gap-x-4 py-4`,children:(0,H.jsxs)(`li`,{"data-testid":`provider-${e.id}`,"data-authenticated":!0,children:[(0,H.jsx)(WZe,{id:e.id,name:e.name}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-56 flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.name}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,H.jsxs)(XK,{tone:`green`,className:`rounded-full border-po-edge-green bg-po-tint-green px-2.5 font-medium`,children:[(0,H.jsx)(GK,{tone:`green`}),`Connected`]}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`hidden h-4 w-px bg-po-border sm:block`}),(0,H.jsx)(`span`,{"data-testid":`provider-status-${e.id}`,className:`min-w-0 break-words text-sm text-po-dim`,children:(0,H.jsx)(JZe,{...r})})]})]}),r.source===GZe?(0,H.jsx)(Z,{variant:`outline`,size:`sm`,"data-testid":`provider-logout-${e.id}`,disabled:t,onClick:n,children:`Sign out`}):r.source?(0,H.jsx)(`span`,{className:`shrink-0 text-sm text-po-dim`,children:`Set by your environment`}):null]})}):null}function XZe({provider:e,busy:t,onLogin:n}){return(0,H.jsx)(Q4,{asChild:!0,className:`gap-x-4 py-3`,children:(0,H.jsxs)(`li`,{"data-testid":`provider-${e.id}`,"data-authenticated":!1,children:[(0,H.jsx)(WZe,{id:e.id,name:e.name}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-40 flex-col`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.name}),(0,H.jsx)(`span`,{className:`truncate font-mono text-sm text-po-dim`,children:e.id}),(0,H.jsx)(`span`,{"data-testid":`provider-status-${e.id}`,className:`sr-only`,children:`Not connected`})]}),(0,H.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:e.methods.length===0?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`Reads credentials from your environment`}):e.methods.map(r=>(0,H.jsx)(Z,{variant:`outline`,size:`sm`,"data-testid":`provider-login-${r.type}-${e.id}`,title:r.label,disabled:t,onClick:()=>n(r.type),children:KZe[r.type]},r.type))})]})})}function ZZe(){let e=Qg(`providers`),t=(0,V.useSyncExternalStore)(t=>t_(e,t),()=>e_(e)),[n,r]=gL(`providers/list`,null),[i,a]=gL(`providers/error`,``),[o,s,c]=gL(`providers/flow`,null),[l,u,d]=gL(`providers/busy`,null),[f,p]=gL(`providers/filter`,``),m=(0,V.useCallback)(async()=>{let e=await Ht();`providers`in e?(r(e.providers),a(``)):a(e.error)},[r,a]);(0,V.useEffect)(()=>{m()},[m,t]);let h=o?.id,g=o?.status===`running`;(0,V.useEffect)(()=>{if(h===void 0||!g)return;let e=!1;return(async()=>{let t=await Wt(h);e||(`error`in t?s(e=>e&&e.id===h?{...e,status:`failed`,error:t.error}:e):(s(t.flow),t.flow.status!==`running`&&m()))})(),()=>{e=!0}},[h,g,m,s,t]);let _=async(e,t)=>{if(d.state!==null||c.state?.status===`running`)return;u(e);let n=await Ut(e,t);u(null),`flow`in n?s(n.flow):a(n.error)},v=async(e,t)=>{if(!o||d.state!==null)return;u(o.providerId);let n=await Gt(o.id,e,t);if(u(null),`flow`in n){let e=await Wt(o.id);s(`flow`in e?e.flow:n.flow),m()}else a(n.error)},y=async()=>{if(!o||d.state!==null)return;u(o.providerId);let e=await Kt(o.id);u(null),s(`flow`in e?e.flow:null),m()},b=async e=>{if(d.state!==null)return;u(e);let t=await qt(e);`error`in t?a(t.error):await m(),u(null)},x=f.trim().toLowerCase(),S=(n??[]).filter(e=>e.kind===`po-feature`),C=(n??[]).filter(e=>e.kind!==`po-feature`),w=C.filter(e=>e.authenticated!==void 0),T=C.filter(e=>e.authenticated===void 0).filter(e=>`${e.name} ${e.id}`.toLowerCase().includes(x)),E=l!==null||g;return(0,H.jsxs)(U4,{"data-testid":`provider-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Providers`}),(0,H.jsxs)(K4,{children:[`Connect the model providers Po can work with. Sign in once and every session on this machine can use it. Credentials stay on this machine, in Pi's `,(0,H.jsx)(`code`,{className:`font-mono text-po-hi`,children:`auth.json`}),`.`]})]}),n===null&&!i?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading providers`}),(0,H.jsx)(Lq,{className:`h-4 w-40`}),(0,H.jsx)(Lq,{className:`h-4 w-64`}),(0,H.jsx)(Lq,{className:`h-4 w-52`})]}):null,n===null&&i?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{"data-testid":`provider-settings-error`,title:i,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't reach your providers just now`}),(0,H.jsx)(n3,{children:`Nothing has changed. Your sign-ins are where you left them.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>void m(),children:`Try again`})]})}):null,n&&i?(0,H.jsx)(`p`,{"data-testid":`provider-settings-error`,role:`alert`,className:`text-sm leading-relaxed text-po-red`,children:i}):null,n?.length===0?(0,H.jsx)(rJ,{"data-testid":`provider-list-empty`,className:`rounded-lg border border-dashed border-po-border py-8`,title:`No providers to connect`,description:`Pi hasn't offered any model providers on this machine yet.`}):null,n&&n.length>0?(0,H.jsxs)(H.Fragment,{children:[S.length>0?(0,H.jsxs)(q4,{"data-testid":`provider-po-features`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Po features`}),(0,H.jsx)(X4,{children:`Image generation, Web search, and Voice share one ChatGPT sign-in. It is separate from the OpenAI Codex sign-in your chat models use.`})]}),(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{children:S.map(e=>e.authenticated?(0,H.jsx)(YZe,{provider:e,busy:E,onLogout:()=>void b(e.id)},e.id):(0,H.jsx)(XZe,{provider:e,busy:E,onLogin:t=>void _(e.id,t)},e.id))})})]}):null,(0,H.jsxs)(q4,{children:[(0,H.jsx)(J4,{children:(0,H.jsx)(Y4,{children:`Connected`})}),w.length>0?(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{children:w.map(e=>(0,H.jsx)(YZe,{provider:e,busy:E,onLogout:()=>void b(e.id)},e.id))})}):(0,H.jsx)(rJ,{className:`rounded-lg border border-dashed border-po-border py-8`,title:`Nothing connected yet`,description:`Pick a provider below. Po takes it from there.`})]}),(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Available`}),(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[w.length,` of `,C.length,` connected`]})]}),(0,H.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2.5 rounded-lg border border-po-border bg-po-panel px-3.5 transition-colors focus-within:border-po-green/60`,children:[(0,H.jsx)(wR,{className:`size-4 shrink-0 text-po-faint`}),(0,H.jsx)(zq,{variant:`bare`,"data-testid":`provider-filter`,value:f,placeholder:`Search providers`,"aria-label":`Search providers`,onChange:e=>p(e.target.value),className:`flex-1`})]}),T.length>0?(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{"data-testid":`provider-list`,children:T.map(e=>(0,H.jsx)(XZe,{provider:e,busy:E,onLogin:t=>void _(e.id,t)},e.id))})}):x?(0,H.jsx)(rJ,{"data-testid":`provider-no-match`,className:`rounded-lg border border-po-border bg-po-panel py-8`,title:`No provider called “${f.trim()}”`,description:`Try the company name, like Google or Mistral.`}):(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`Every provider Po knows about is connected.`})]})]}):null,o?(0,H.jsx)(FZe,{flow:o,onAnswer:(e,t)=>void v(e,t),onCancel:()=>void y(),onClose:()=>s(null)}):null]})}var Q3=`/api/hosts`,QZe=`Quick-tunnel hosts cannot be added here. Add this host in the Po app instead.`;function $Ze(e){try{return new URL(e).hostname.toLowerCase().replace(/\.$/u,``).endsWith(`.trycloudflare.com`)}catch{return!1}}function eQe(e,t){let n=e.toLowerCase().replace(/[^a-z0-9_-]+/gu,`-`).replace(/^-+|-+$/gu,``).slice(0,72)||`host`,r=n;for(let e=2;t.some(e=>e.hostKey===r);e+=1)r=`${n}-${e}`;return r}async function $3(e){let t=await e.json().catch(()=>void 0);return typeof t?.error==`string`?t.error:`Po could not reach the host table (${e.status}).`}var tQe=(e,t)=>fetch(e,ke(e,t));function nQe({request:e=tQe}){let[t,n]=(0,V.useState)({kind:`loading`}),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(),h=(0,V.useCallback)(async()=>{n({kind:`loading`});try{let t=await e(Q3,{credentials:`same-origin`});if(!t.ok){n({kind:`error`,message:await $3(t)});return}let r=await t.json();n({kind:`ready`,hosts:r.hosts??[]})}catch(e){n({kind:`error`,message:e instanceof Error?e.message:String(e)})}},[e]);(0,V.useEffect)(()=>{h()},[h]);let g=t.kind===`ready`?t.hosts:[],_=$Ze(s.trim());async function v(){if(!(d||_)){f(!0),u(void 0);try{let t=await e(Q3,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({hostKey:eQe(a,g),origin:s.trim(),label:a.trim()})});if(!t.ok){u(await $3(t));return}i(!1),o(``),c(``),await h()}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}}}async function y(t){f(!0);try{let r=await e(`${Q3}/${encodeURIComponent(t.hostKey)}`,{method:`DELETE`,credentials:`same-origin`});if(!r.ok&&r.status!==404){n({kind:`error`,message:await $3(r)});return}m(void 0),await h()}catch(e){n({kind:`error`,message:e instanceof Error?e.message:String(e)})}finally{f(!1)}}return(0,H.jsxs)(U4,{"data-testid":`hosts-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Hosts`}),(0,H.jsx)(K4,{children:`Each host has its own connection and trusted plugins.`})]}),t.kind===`loading`?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading your hosts`}),(0,H.jsx)(Lq,{className:`h-4 w-48`}),(0,H.jsx)(Lq,{className:`h-4 w-72`})]}):t.kind===`error`?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{title:t.message,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{className:`text-po-red`,children:`Po couldn't read your hosts`}),(0,H.jsx)(n3,{children:t.message})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:`Try again`})]})}):(0,H.jsx)(Z4,{"aria-label":`Paired hosts`,children:g.length===0?(0,H.jsx)(Q4,{children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No other hosts yet`}),(0,H.jsx)(n3,{children:`Add a named-tunnel host to see its sessions here.`})]})}):g.map(e=>(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:e.label}),(0,H.jsx)(n3,{className:`break-all first-letter:normal-case`,children:new URL(e.origin).host})]}),(0,H.jsx)(Z,{variant:`danger-outline`,size:`sm`,onClick:()=>m(e),children:`Forget`})]},e.hostKey))}),r?(0,H.jsxs)(Z4,{className:`flex max-w-lg flex-col gap-4 p-5`,"data-testid":`add-host`,children:[(0,H.jsx)(`p`,{children:`Add a named-tunnel host to this cockpit. Pairing trusts its plugin code, but does not link hosts.`}),(0,H.jsx)(j$,{htmlFor:`host-label`,children:`Host label`}),(0,H.jsx)(zq,{id:`host-label`,value:a,onChange:e=>o(e.target.value)}),(0,H.jsx)(j$,{htmlFor:`host-origin`,children:`Host address`}),(0,H.jsx)(zq,{id:`host-origin`,value:s,placeholder:`https://host.example.com`,onChange:e=>c(e.target.value),"aria-invalid":_||l!==void 0,"aria-describedby":`host-help`}),(0,H.jsx)(`p`,{id:`host-help`,role:_||l!==void 0?`alert`:void 0,"data-denied":_||l!==void 0||void 0,className:`text-sm text-po-dim data-denied:text-po-red`,children:_?QZe:l??`Your sign-in stays separate for every host.`}),(0,H.jsx)(Z,{variant:`primary`,disabled:_||d||!a.trim()||!s.trim(),onClick:()=>void v(),children:`Continue to pairing`}),(0,H.jsx)(Z,{variant:`outline`,onClick:()=>{i(!1),u(void 0)},children:`Cancel`})]}):t.kind===`ready`?(0,H.jsx)(`div`,{children:(0,H.jsx)(Z,{variant:`outline`,onClick:()=>i(!0),children:`Add host`})}):null,(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`Forgetting a host here keeps its host links. Unlinking is separate.`}),(0,H.jsx)(aq,{open:p!==void 0,onOpenChange:e=>e?void 0:m(void 0),children:(0,H.jsxs)(cq,{children:[(0,H.jsxs)(lq,{className:`flex-col items-start`,children:[(0,H.jsxs)(uq,{children:[`Forget `,p?.label,`?`]}),(0,H.jsxs)(dq,{children:[`Remove `,p?.label,` from this cockpit. Pair again to reconnect. Its host links stay in place.`]})]}),(0,H.jsx)(fq,{children:`Your other hosts stay connected.`}),(0,H.jsxs)(mq,{className:`px-4 pb-4`,children:[(0,H.jsx)(Z,{variant:`outline`,onClick:()=>m(void 0),children:`Cancel`}),(0,H.jsx)(Z,{variant:`danger`,disabled:d,onClick:()=>p&&void y(p),children:`Forget host`})]})]})})]})}function rQe(e){try{let t=new URL(e);return t.protocol===`https:`&&t.username===``&&t.password===``&&t.hash===``}catch{return!1}}function iQe(e){let{clientSecret:t,connectionUrl:n,mcpAppConnectionUrl:r,...i}=e;return i}var aQe={url_token:`Signed URL`,api_key:`API key`,client_secret_post:`OAuth`};function e6({label:e,value:t,testId:n}){let[r,i]=(0,V.useState)(`idle`);async function a(){if(navigator.clipboard===void 0)i(`failed`);else try{await navigator.clipboard.writeText(t),i(`copied`)}catch{i(`failed`)}}return(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:e}),(0,H.jsx)(`code`,{className:`break-all font-mono text-sm text-po-text`,"data-testid":n,children:t}),(0,H.jsxs)(`output`,{"aria-live":`polite`,className:`text-sm text-po-dim empty:hidden`,children:[r===`failed`?`Copying was blocked. Select the value above to copy it by hand.`:``,r===`copied`?`${e} copied.`:``]})]}),(0,H.jsx)(Z,{type:`button`,variant:`outline`,size:`sm`,"data-testid":`${n}-copy`,"aria-label":`Copy ${e}`,onClick:()=>void a(),children:r===`copied`?`Copied`:`Copy`})]})}function oQe(){let e=SM(),t=U(q,e=>e.order),n=U(q,e=>e.activeId),r=(0,V.useMemo)(()=>t.map(t=>e[t]).filter(e=>e!==void 0&&!e.summary.dormant),[e,t]),[i,a]=gL(`session-mcp/session`,()=>n??r[0]?.summary.id??``),o=i===``?void 0:e[i],s=o?.summary.workspaceId,c=o?.attach===`attached`&&s!==void 0,l=`${s??``}\u0000${i}`,[,u,d]=gL(`session-mcp/selection`,l),f=it()!==void 0,p=U(fF,e=>e.view?.publicUrl),[m,h]=gL(`session-mcp/config`,void 0),[g,_,v]=gL(`session-mcp/clients`,[]),[y,b]=gL(`session-mcp/redirect`,``),[x,S]=gL(`session-mcp/tool-prefix`,``),[C,w]=gL(`session-mcp/auth-method`,`url_token`),[T,E]=gL(`session-mcp/created`,void 0),D=T?.sessionId===i?T.client:void 0,[O,k]=gL(`session-mcp/loading`,!1),[A,j,M]=gL(`session-mcp/busy`,!1),[N,P]=gL(`session-mcp/error`,void 0);(0,V.useLayoutEffect)(()=>{d.state===l&&c||(u(l),E(void 0),b(``),S(``),h(void 0),_([]),P(void 0),j(!1))},[c,l,d,u,E,b,S,h,_,P,j]),(0,V.useEffect)(()=>()=>E(void 0),[E]),(0,V.useEffect)(()=>{if(r.some(e=>e.summary.id===i))return;let e=r.find(e=>e.summary.id===n)??r[0];a(e?.summary.id??``)},[r,i,n,a]),(0,V.useEffect)(()=>{let e=!0,t=v.state;return!c||s===void 0?(k(!1),()=>{e=!1}):(k(!0),Promise.all([p===void 0?void 0:ZA(s,i),QA(s,i)]).then(([n,r])=>{e&&(n===void 0?h(void 0):`error`in n?P(n.error):h(n.config),`error`in r?P(e=>e??r.error):!M.state&&v.state===t&&_(r.clients),k(!1))}),()=>{e=!1})},[c,p,i,s,v,M,h,_,P,k]);let ee=C===`oauth`&&y!==``&&!rQe(y),F=c&&!f&&m!==void 0&&(C!==`oauth`||rQe(y))&&!A;async function te(){if(!F||s===void 0||M.state)return;let e=l;j(!0),P(void 0);let t=x.trim(),n=t===``?{}:{toolPrefix:t},r=await $A(s,i,C===`oauth`?{redirectUri:y.trim(),scope:`session`,routing:`conversation`,...n}:{authMethod:C,scope:`session`,routing:`conversation`,...n});d.state===e&&(j(!1),`error`in r?P(r.error):(E({sessionId:i,client:r.client}),_(e=>[iQe(r.client),...e]),b(``),S(``)))}async function ne(e){if(s===void 0||M.state)return;let t=l;j(!0),P(void 0);let n=await ej(s,i,e);d.state===t&&(j(!1),`error`in n?P(n.error):(_(t=>t.filter(t=>t.clientId!==e)),D?.clientId===e&&E(void 0)))}return(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-10`,"data-testid":`session-mcp-settings`,children:[(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Session MCP`}),(0,H.jsx)(X4,{children:`Let ChatGPT or another MCP client work inside one live Po session. This is separate from the MCP servers Po calls out to.`})]}),(0,H.jsxs)(Z4,{children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{id:`session-mcp-picker-label`,children:`Session`}),(0,H.jsx)(n3,{children:O?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,H.jsx)(nq,{label:`Reading the session MCP connection`}),`Reading the connection…`]}):o===void 0?`Start a session first, then come back to connect a client to it.`:c?!O&&m===void 0&&N===void 0?`Turn on remote control with a public HTTPS address first. Clients connect through it.`:`Clients connect to this session and work with its tools and permissions.`:`This session is disconnected. Reconnect it to manage its clients.`})]}),(0,H.jsxs)(F4,{value:i,disabled:r.length===0,onValueChange:a,children:[(0,H.jsx)(R4,{id:`session-mcp-picker`,"data-testid":`session-mcp-session`,"aria-labelledby":`session-mcp-picker-label`,className:`w-full sm:w-72`,children:(0,H.jsx)(L4,{placeholder:`No live session`})}),(0,H.jsx)(z4,{children:r.map(e=>(0,H.jsxs)(V4,{value:e.summary.id,children:[e.summary.name,` · `,e.summary.cwd]},e.summary.id))})]})]}),m===void 0?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(e6,{label:`MCP`,value:m.mcpUrl,testId:`session-mcp-url`}),(0,H.jsx)(e6,{label:`MCP with widgets`,value:m.mcpAppUrl,testId:`session-mcp-app-url`}),(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{className:`cursor-pointer px-5 py-3 text-sm text-po-dim hover:text-po-hi`,children:`OAuth endpoints`}),(0,H.jsxs)(`dl`,{className:`grid gap-x-6 gap-y-1 border-t border-po-border-soft px-5 py-4 text-sm sm:grid-cols-[auto_minmax(0,1fr)]`,children:[(0,H.jsx)(`dt`,{className:`text-po-dim`,children:`Authorization`}),(0,H.jsx)(`dd`,{className:`break-all font-mono text-po-text`,children:m.authorizationEndpoint}),(0,H.jsx)(`dt`,{className:`text-po-dim`,children:`Token`}),(0,H.jsx)(`dd`,{className:`break-all font-mono text-po-text`,children:m.tokenEndpoint})]})]})]})]}),N?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm leading-relaxed text-po-red`,children:N}):null]}),m===void 0||f?null:(0,H.jsxs)(q4,{"data-testid":`session-mcp-create`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Connect a client`}),(0,H.jsx)(X4,{children:`A signed URL is the simplest way to connect ChatGPT: the key travels inside the URL, so there is no OAuth callback or header to set up. Other clients can use an API key or OAuth.`})]}),(0,H.jsxs)(Z4,{children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{id:`session-mcp-auth-method-label`,children:`Sign-in method`}),(0,H.jsx)(n3,{children:`How the client proves it is allowed in.`})]}),(0,H.jsxs)(F4,{value:C,onValueChange:e=>w(e),children:[(0,H.jsx)(R4,{id:`session-mcp-auth-method`,"data-testid":`session-mcp-auth-method`,"aria-labelledby":`session-mcp-auth-method-label`,className:`w-full sm:w-72`,children:(0,H.jsx)(L4,{})}),(0,H.jsxs)(z4,{children:[(0,H.jsx)(V4,{value:`url_token`,children:`Signed URL (JWT)`}),(0,H.jsx)(V4,{value:`api_key`,children:`API key (Bearer)`}),(0,H.jsx)(V4,{value:`oauth`,children:`OAuth (callback required)`})]})]})]}),C===`oauth`?(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:(0,H.jsx)(`label`,{htmlFor:`session-mcp-callback`,children:`Redirect URL`})}),(0,H.jsx)(n3,{id:`session-mcp-callback-help`,children:ee?(0,H.jsx)(`span`,{className:`text-po-red`,children:`Use an absolute HTTPS URL without credentials or a fragment.`}):`Copy it from your OAuth client. Don’t work it out from the MCP URL.`})]}),(0,H.jsx)(zq,{id:`session-mcp-callback`,"data-testid":`session-mcp-callback`,type:`url`,value:y,placeholder:`https://chatgpt.com/connector/oauth/…`,"aria-invalid":ee,"aria-describedby":`session-mcp-callback-help`,spellCheck:!1,onChange:e=>b(e.target.value),className:`w-full font-mono text-sm sm:w-72`})]}):null,(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:(0,H.jsx)(`label`,{htmlFor:`session-mcp-tool-prefix`,children:`Tool prefix`})}),(0,H.jsxs)(n3,{id:`session-mcp-tool-prefix-help`,children:[`Tools appear as `,(0,H.jsx)(`code`,{className:`font-mono`,children:`prefix_bash`}),`,`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`prefix_read`}),`. Lowercase letters and digits, joined by single underscores, up to 24 characters.`]})]}),(0,H.jsx)(zq,{id:`session-mcp-tool-prefix`,"data-testid":`session-mcp-tool-prefix`,value:x,placeholder:`The session name`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`session-mcp-tool-prefix-help`,onChange:e=>S(e.target.value),className:`w-full font-mono text-sm sm:w-72`})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-testid":`session-mcp-routing`,children:[(0,H.jsx)(r3,{children:`Every conversation is automatically routed to its own worktree before tools run, never to the checkout this session uses. While a worktree is provisioning or recovering, tools wait; if recovery can't finish, the conversation reports it rather than falling back to this session.`}),(0,H.jsx)(r3,{children:`Access follows this session's mode, domains and profile as they change, and tools run with its permissions.`})]}),(0,H.jsx)(i3,{children:(0,H.jsx)(Z,{"data-testid":`session-mcp-create-button`,size:`sm`,variant:F?`primary`:`outline`,loading:A,disabled:!F,onClick:()=>void te(),children:C===`url_token`?`Create signed URL`:C===`api_key`?`Create API key`:`Create OAuth client`})})]}),(0,H.jsxs)(q4,{"data-testid":`session-mcp-clients`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Clients`}),g.length>0?(0,H.jsxs)(`span`,{className:`text-sm text-po-dim tabular-nums`,children:[g.length,` connected`]}):null]}),f?(0,H.jsx)(r3,{"data-testid":`session-mcp-remote-note`,children:`New clients can only be created on the machine Po runs on. From here you can still see and revoke existing ones, if the host allows it.`}):null,D===void 0?null:(0,H.jsxs)(Z4,{className:`border-po-green/50`,"data-testid":`session-mcp-secret`,children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsxs)(t3,{className:`flex flex-wrap items-center gap-2`,children:[`Save these details now`,D.toolPrefix?(0,H.jsxs)(XK,{tone:`neutral`,className:`font-mono`,"data-testid":`session-mcp-created-prefix`,children:[D.toolPrefix,`_*`]}):null]}),(0,H.jsxs)(n3,{children:[D.tokenEndpointAuthMethod===`url_token`?`In ChatGPT, paste either URL into Server URL and choose no additional authentication. Treat both like a password: they are shown once and work until you revoke the client.`:D.tokenEndpointAuthMethod===`api_key`?`In ChatGPT, choose API key with a Bearer header and paste the key. It is shown once and disappears when you dismiss it, leave this page or switch session.`:null,D.tokenEndpointAuthMethod===`url_token`||D.tokenEndpointAuthMethod===`api_key`?null:(0,H.jsxs)(H.Fragment,{children:[`Paste the client ID and secret into your OAuth client and choose`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`client_secret_post`}),` as the token endpoint auth method. The secret is shown once.`]})]})]}),(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:()=>E(void 0),children:`Dismiss`})]}),D.tokenEndpointAuthMethod===`url_token`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(e6,{label:`Signed MCP URL`,value:D.connectionUrl,testId:`session-mcp-created-url`}),(0,H.jsx)(e6,{label:`Signed MCP with widgets URL`,value:D.mcpAppConnectionUrl,testId:`session-mcp-created-app-url`})]}):(0,H.jsxs)(H.Fragment,{children:[m===void 0?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(e6,{label:`MCP`,value:m.mcpUrl,testId:`session-mcp-created-url`}),(0,H.jsx)(e6,{label:`MCP with widgets`,value:m.mcpAppUrl,testId:`session-mcp-created-app-url`})]}),D.tokenEndpointAuthMethod===`api_key`?null:(0,H.jsx)(e6,{label:`Client ID`,value:D.clientId,testId:`session-mcp-created-id`}),(0,H.jsx)(e6,{label:D.tokenEndpointAuthMethod===`api_key`?`API key`:`Client secret`,value:D.clientSecret,testId:`session-mcp-created-secret`})]})]}),g.length===0?O?null:(0,H.jsx)(Z4,{children:(0,H.jsx)(Q4,{children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No clients yet`}),(0,H.jsx)(n3,{children:`Clients you connect to this session will be listed here.`})]})})}):(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{children:g.map(e=>(0,H.jsx)(Q4,{asChild:!0,children:(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsxs)(t3,{className:`flex flex-wrap items-center gap-2`,children:[e.name,(0,H.jsx)(XK,{tone:`neutral`,children:aQe[e.tokenEndpointAuthMethod]??e.tokenEndpointAuthMethod}),e.toolPrefix?(0,H.jsxs)(XK,{tone:`neutral`,className:`font-mono`,children:[e.toolPrefix,`_*`]}):null]}),(0,H.jsx)(n3,{children:e.scope===`session`?`Session access. Worktree per conversation.`:`Restricted access. Tools: ${e.tools.join(`, `)||`none`}. Skills: ${e.skills.join(`, `)||`none`}.`}),(0,H.jsx)(`code`,{className:`block break-all font-mono text-sm text-po-dim`,children:e.clientId}),e.redirectUri?(0,H.jsx)(`span`,{className:`block break-all font-mono text-sm text-po-dim`,children:e.redirectUri}):null]}),(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:A,onClick:()=>void ne(e.clientId),children:`Revoke`})]})},e.clientId))})}),(0,H.jsx)(r3,{children:`Signed URLs and API keys belong to this session and survive a restart until you revoke them. OAuth sign-ins last only while Po runs, so a client may ask to authorise again.`})]})]})}var sQe=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/iu;function t6(e){return e.kind===`named`?e:{kind:`named`,hostname:``}}function n6(e){let t=e.trim();return t===``?void 0:t}var cQe=[{kind:`quick`,label:`Quick tunnel`,detail:`No account needed. The address changes each time.`},{kind:`named`,label:`Named tunnel`,detail:`Your own domain, and the address stays put.`}];function lQe({tunnel:e}){let[t,n]=gL(`tunnel/draft`,e),[r,i]=gL(`tunnel/source`,e),[a,o,s]=gL(`tunnel/saving`,!1);r!==e&&JSON.stringify(t)===JSON.stringify(r)&&(i(e),n(e));let c=t.kind===`named`?t.hostname.trim():``,l=t.kind===`named`&&!sQe.test(c),u=JSON.stringify(t)!==JSON.stringify(e);function d(e){n(t=>({...t6(t),...e}))}async function f(){if(s.state)return;o(!0);let e=t6(t),r=n6(e.tokenFile??``),a=n6(e.name??``),l=n6(e.configFile??``),u=t.kind===`quick`?t:{kind:`named`,hostname:c,...r===void 0?{}:{tokenFile:r},...a===void 0?{}:{name:a},...l===void 0?{}:{configFile:l}};try{await MF({tunnel:u})&&(i(u),n(e=>e===t?u:e))}finally{o(!1)}}return(0,H.jsxs)(q4,{"data-testid":`remote-tunnel-settings`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Tunnel`}),(0,H.jsx)(X4,{children:`How your other devices reach Po. A named tunnel gives you a stable address, which passkeys need.`})]}),(0,H.jsx)(j4,{value:t.kind,onValueChange:e=>n(e===`named`?t6(t):{kind:`quick`}),className:`grid grid-cols-1 gap-3 min-[480px]:grid-cols-2`,"aria-label":`Tunnel type`,children:cQe.map(e=>(0,H.jsxs)(M4,{value:e.kind,"data-testid":`remote-tunnel-${e.kind}`,className:`flex items-start gap-2 rounded-lg p-4`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:e.label}),(0,H.jsx)(`span`,{className:`text-sm leading-relaxed text-po-dim`,children:e.detail})]}),t.kind===e.kind?(0,H.jsx)(LL,{className:`size-4 shrink-0 text-po-green`}):null]},e.kind))}),t.kind===`named`?(0,H.jsxs)(Z4,{children:[(0,H.jsx)($4,{id:`remote-tunnel-hostname`,label:`Hostname`,description:l?(0,H.jsx)(`span`,{className:`text-po-red`,children:`Enter the hostname only, without https://, a port or a path.`}):`The domain your devices will open.`,children:(0,H.jsx)(zq,{id:`remote-tunnel-hostname`,"data-testid":`remote-tunnel-hostname`,value:t.hostname,placeholder:`po.example.com`,"aria-invalid":l,spellCheck:!1,onChange:e=>d({hostname:e.target.value}),className:`font-mono text-sm`})}),(0,H.jsx)($4,{id:`remote-tunnel-token-file`,label:`Token file`,description:`A local file holding your Cloudflare connector token. Po reads the file and never stores the token itself.`,children:(0,H.jsx)(zq,{id:`remote-tunnel-token-file`,"data-testid":`remote-tunnel-token-file`,value:t.tokenFile??``,placeholder:`~/.cloudflared/po.token`,spellCheck:!1,onChange:e=>d({tokenFile:e.target.value}),className:`font-mono text-sm`})}),(0,H.jsxs)(`details`,{className:`group`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer px-5 py-3 text-sm text-po-dim hover:text-po-hi`,children:`Tunnel you manage with cloudflared`}),(0,H.jsxs)(`div`,{className:`flex flex-col divide-y divide-po-border-soft border-t border-po-border-soft`,children:[(0,H.jsx)($4,{id:`remote-tunnel-name`,label:`Tunnel name`,children:(0,H.jsx)(zq,{id:`remote-tunnel-name`,"data-testid":`remote-tunnel-name`,value:t.name??``,placeholder:`po`,spellCheck:!1,onChange:e=>d({name:e.target.value}),className:`font-mono text-sm`})}),(0,H.jsx)($4,{id:`remote-tunnel-config-file`,label:`Config file`,children:(0,H.jsx)(zq,{id:`remote-tunnel-config-file`,"data-testid":`remote-tunnel-config-file`,value:t.configFile??``,placeholder:`~/.cloudflared/config.yml`,spellCheck:!1,onChange:e=>d({configFile:e.target.value}),className:`font-mono text-sm`})})]})]})]}):null,(0,H.jsxs)(i3,{children:[(0,H.jsx)(Z,{variant:u&&!l?`primary`:`outline`,size:`sm`,"data-testid":`remote-tunnel-save`,loading:a,disabled:a||!u||l,onClick:()=>void f(),children:`Save tunnel`}),(0,H.jsxs)(r3,{children:[`Takes effect the next time remote access starts. Install `,(0,H.jsx)(`code`,{className:`font-mono`,children:`cloudflared`}),` on this machine first.`]})]})]})}function uQe(){let e=U(fF);return(0,V.useEffect)(()=>{SF()},[]),(0,H.jsxs)(U4,{"data-testid":`remote-control-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Remote control`}),(0,H.jsx)(K4,{children:`Reach this Po from your phone or another computer. You turn access on and pair devices from the remote access dialog; this page holds what stays the same between visits.`})]}),e.view===void 0&&e.error?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{title:e.error,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't read your remote settings just now`}),(0,H.jsx)(n3,{children:`Nothing has changed. Remote access is as you left it.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>void SF(),children:`Try again`})]})}):e.view===void 0?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading remote settings`}),(0,H.jsx)(Lq,{className:`h-4 w-48`}),(0,H.jsx)(Lq,{className:`h-4 w-72`})]}):(0,H.jsx)(lQe,{tunnel:e.view.settings.tunnel}),(0,H.jsx)(oQe,{})]})}function dQe({value:e,saving:t=!1,loading:n=!1,error:r=``,onChange:i,onSave:a,onRetry:o}){return(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Instructions`}),(0,H.jsx)(X4,{children:`How you want Po to work in this workspace.`})]}),(0,H.jsx)(Z4,{children:(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 px-5 py-4`,children:[(0,H.jsx)(`label`,{htmlFor:`workspace-instructions`,className:`text-base font-medium text-po-hi`,children:`Workspace instructions`}),(0,H.jsx)(N4,{id:`workspace-instructions`,value:e,onChange:e=>i(e.target.value),rows:6,className:`w-full resize-y`,placeholder:`For example, ask before pushing changes.`,disabled:t||n,"aria-describedby":r?`instructions-help instructions-error`:`instructions-help`}),(0,H.jsx)(r3,{id:`instructions-help`,children:`Applies to new and reopened sessions.`}),r?(0,H.jsx)(`p`,{id:`instructions-error`,role:`alert`,className:`text-sm leading-relaxed text-po-red`,children:r}):null]})}),n?(0,H.jsx)(r3,{children:`Reading instructions…`}):null,(0,H.jsxs)(i3,{children:[n&&r?(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:o,children:`Try again`}):null,(0,H.jsx)(Z,{variant:`primary`,size:`sm`,loading:t,loadingLabel:`Saving instructions`,disabled:t||n,onClick:a,children:t?`Saving instructions…`:`Save instructions`})]})]})}function fQe({workspaceId:e}){let[t,n]=(0,V.useState)(0),[r,i,a]=gL(JSON.stringify([`workspace-instructions`,e]),{value:``,loaded:!1,saving:!1,error:``});(0,V.useEffect)(()=>{if(a.state.loaded)return;let t=!0;return cge(e).then(e=>{t&&i(t=>`error`in e?{...t,error:`Instructions could not be loaded. ${e.error}`}:{...t,value:e.workspace.instructions??``,loaded:!0,error:``})}),()=>{t=!1}},[e,i,a,t]);let o=async()=>{if(a.state.saving||!a.state.loaded)return;let t=a.state.value;i(e=>({...e,saving:!0,error:``}));let n=await lge(e,t);`error`in n?i(e=>({...e,saving:!1,error:`Instructions could not be saved. Your changes are still here. Try saving again.`})):(vP({workspace:n.workspace}),i(e=>({...e,saving:!1,error:``})))};return(0,H.jsx)(dQe,{value:r.value,saving:r.saving,loading:!r.loaded,error:r.error,onRetry:()=>n(e=>e+1),onChange:e=>i(t=>({...t,value:e})),onSave:()=>void o()})}var r6=`container`,pQe=`The container provider is not available.`,mQe=`The workspace folder could not be opened.`,hQe=`The container did not start, so new sessions still run on this computer.`,gQe=`The container did not stop, so new sessions still start in it.`,_Qe=`The container stopped, so new sessions cannot start in it.`;function i6(e){return hL(JSON.stringify([`run-in-container`,e]),{})}function vQe(e,t){return t===void 0?e:`${e} ${t}`}function yQe(e,t){if(t.pending!==void 0)return{kind:t.pending===r6?`starting`:`stopping`};if(t.error!==void 0)return{kind:`error`,message:t.error};let n=e.sandbox!==void 0,r=e.sandboxReason;if(e.available===!1&&!n)return{kind:`unavailable`,reason:mQe};switch(e.sandboxState){case`starting`:return{kind:`starting`};case`stopping`:return{kind:`stopping`};case`unavailable`:return n?{kind:`on-unavailable`,reason:r??pQe}:{kind:`unavailable`,reason:r??pQe};case`failed`:return{kind:`error`,message:vQe(n?_Qe:hQe,r)};default:return{kind:n?`on`:`off`}}}function bQe(e,t,n,r){return t.flatMap(t=>{let i=e[t];if(i===void 0)return[];let{summary:a}=i;if(a.workspaceId!==n||a.dormant===!0)return[];let o=Hk({attach:i.attach,phase:a.phase,phaseSince:a.phaseSince,awaitingInput:a.awaitingInput,everPrompted:a.everPrompted,backgroundWorkActive:a.backgroundWorkActive,lastSettledAt:a.lastSettledAt,...a.activity===void 0?{}:{activity:a.activity}},r);return[{id:t,name:a.name,status:o}]})}function xQe(e,t){let n=i6(e);n.state.pending===void 0&&n.setState(e=>({...e,dialog:t?`on`:`off`}))}function SQe(e){i6(e).setState(e=>({...e,dialog:void 0}))}async function CQe(e,t){let n=i6(e);if(n.state.pending!==void 0)return;n.setState(()=>({pending:t,last:t}));let r=await uge(e,t);`workspace`in r?(vP({workspace:r.workspace}),n.setState(e=>({last:e.last}))):n.setState(e=>({last:e.last,error:vQe(t===r6?hQe:gQe,r.error)}))}async function wQe(e){let t=i6(e).state.dialog;t!==void 0&&await CQe(e,t===`on`?r6:null)}async function TQe(e){let t=i6(e).state.last;await CQe(e,t===void 0?r6:t)}var EQe=`run-in-container`,a6=`run-in-container-help`,o6=`run-in-container-status`;function DQe({state:e,onRetry:t}){switch(e.kind){case`off`:return null;case`on`:return(0,H.jsx)(`p`,{id:o6,className:`basis-full text-sm leading-relaxed text-po-dim`,children:`On. New sessions start in the container.`});case`unavailable`:return(0,H.jsxs)(`p`,{id:o6,"data-testid":`run-in-container-unavailable`,className:`basis-full rounded-md border border-po-border-soft bg-po-deep px-3 py-2 text-sm leading-relaxed text-po-text`,children:[`Not available on this computer right now. `,e.reason]});case`on-unavailable`:return(0,H.jsxs)(`p`,{id:o6,"data-testid":`run-in-container-paused`,className:`basis-full rounded-md border border-po-border-soft bg-po-deep px-3 py-2 text-sm leading-relaxed text-po-text`,children:[`Container sessions are paused on this computer. `,e.reason,` New sessions cannot start until it is back.`]});case`starting`:case`stopping`:return(0,H.jsxs)(`p`,{id:o6,className:`flex basis-full items-center gap-2 text-sm leading-relaxed text-po-dim`,children:[(0,H.jsx)(nq,{label:e.kind===`starting`?`Starting the container`:`Stopping the container`}),e.kind===`starting`?`Starting the container…`:`Stopping the container and moving sessions back to this computer…`]});case`error`:return(0,H.jsxs)(`div`,{id:o6,role:`alert`,"data-testid":`run-in-container-error`,className:`flex basis-full flex-col items-start gap-2 rounded-md border border-po-edge-red bg-po-tint-red px-3 py-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,H.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-start gap-2 text-sm leading-relaxed text-po-text`,children:[(0,H.jsx)(GL,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-po-red`}),(0,H.jsx)(`span`,{children:e.message})]}),(0,H.jsx)(Z,{variant:`outline`,size:`xs`,"data-testid":`run-in-container-retry`,onClick:t,children:`Try again`})]})}}function OQe(e){return t=>{t.preventDefault(),e.current?.focus()}}function kQe({workspaceName:e,returnFocus:t,onCancel:n,onConfirm:r}){return(0,H.jsx)(aq,{open:!0,onOpenChange:e=>e?void 0:n(),children:(0,H.jsxs)(cq,{"data-testid":`run-in-container-confirm-on`,onCloseAutoFocus:OQe(t),children:[(0,H.jsxs)(lq,{className:`flex-col items-start gap-1`,children:[(0,H.jsxs)(uq,{children:[`Run `,e,` in a container?`]}),(0,H.jsx)(dq,{children:`New sessions in this workspace will start inside a container on this computer.`})]}),(0,H.jsxs)(fq,{children:[(0,H.jsx)(`p`,{className:`text-base leading-relaxed text-po-text`,children:`Saved sessions of this workspace move into the container, so you can resume them there.`}),(0,H.jsx)(`p`,{className:`text-base leading-relaxed text-po-text`,children:`Sessions still running on this computer keep running here. Each one moves when it closes.`}),(0,H.jsx)(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Conversations and artifacts stay on this computer. Credentials stay with Po on the host.`})]}),(0,H.jsxs)(mq,{className:`flex-wrap px-3 pb-3 sm:px-4 sm:pb-4`,children:[(0,H.jsx)(Z,{variant:`outline`,"data-testid":`run-in-container-cancel`,onClick:n,children:`Cancel`}),(0,H.jsx)(Z,{variant:`primary`,"data-testid":`run-in-container-confirm`,onClick:r,children:`Run in container`})]})]})})}function AQe({sessions:e}){return(0,H.jsx)(`ul`,{"aria-label":`Running container sessions`,className:`flex flex-col divide-y divide-po-border-soft rounded-md border border-po-border-soft`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-center justify-between gap-3 px-3 py-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-base text-po-text`,children:e.name}),(0,H.jsx)(`span`,{className:`shrink-0 text-sm text-po-dim first-letter:uppercase`,children:e.status})]},e.id))})}function jQe({workspaceName:e,sessions:t,returnFocus:n,onCancel:r,onConfirm:i}){let a=t.length===1?`One session is`:`${String(t.length)} sessions are`,o=t.length>0;return(0,H.jsx)(aq,{open:!0,onOpenChange:e=>e?void 0:r(),children:(0,H.jsxs)(cq,{"data-testid":`run-in-container-confirm-off`,onCloseAutoFocus:OQe(n),children:[(0,H.jsxs)(lq,{className:`flex-col items-start gap-1`,children:[(0,H.jsxs)(uq,{children:[`Stop running `,e,` in a container?`]}),(0,H.jsx)(dq,{children:o?`${a} running in the container. Turning this off stops them, and their current turns are interrupted.`:`Everything moves back to this computer, and you can resume its sessions here.`})]}),(0,H.jsxs)(fq,{children:[o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(AQe,{sessions:t}),(0,H.jsx)(`p`,{className:`text-base leading-relaxed text-po-text`,children:`Then everything moves back to this computer, and you can resume those sessions here.`})]}):null,(0,H.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-po-border-soft bg-po-deep px-3 py-2 text-sm leading-relaxed text-po-text`,children:[(0,H.jsx)(ER,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-po-dim`}),(0,H.jsx)(`span`,{children:`Switching off means trusting what this workspace produced while it was contained: its files, settings, and conversations.`})]})]}),(0,H.jsxs)(mq,{className:`flex-wrap px-3 pb-3 sm:px-4 sm:pb-4`,children:[(0,H.jsx)(Z,{variant:`outline`,"data-testid":`run-in-container-cancel`,onClick:r,children:`Keep in container`}),(0,H.jsx)(Z,{variant:`secondary`,"data-testid":`run-in-container-confirm`,onClick:i,children:o?`Stop and move back`:`Switch off`})]})]})})}var MQe=[],s6=()=>void 0;function NQe({workspaceName:e,state:t,dialog:n,runningSessions:r=MQe,onCheckedChange:i=s6,onRetry:a=s6,onCancel:o=s6,onConfirm:s=s6}){let c=(0,V.useRef)(null),l=t.kind===`on`||t.kind===`starting`||t.kind===`on-unavailable`,u=t.kind===`starting`||t.kind===`stopping`,d=t.kind===`unavailable`||t.kind===`on-unavailable`,f=t.kind===`off`?a6:`${a6} ${o6}`;return(0,H.jsxs)(q4,{"data-testid":`run-in-container`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Where sessions run`}),(0,H.jsx)(X4,{children:`Applies to new sessions in this workspace.`})]}),(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{"data-state":t.kind,changed:t.kind===`on`||t.kind===`on-unavailable`,className:`items-start`,children:[(0,H.jsxs)(e3,{className:`gap-1`,children:[(0,H.jsx)(t3,{className:`flex min-h-6 items-center`,children:(0,H.jsx)(`label`,{htmlFor:EQe,children:`Run in container`})}),(0,H.jsx)(n3,{id:a6,children:`New sessions run inside a container on this computer. Conversations and artifacts stay here, and credentials stay with Po on the host.`})]}),(0,H.jsx)(a3,{ref:c,id:EQe,"data-testid":`run-in-container-switch`,checked:l,disabled:d,"aria-disabled":u||void 0,"aria-busy":u||void 0,"aria-describedby":f,onCheckedChange:e=>u?void 0:i(e),className:`mt-1 aria-disabled:pointer-events-none aria-disabled:opacity-40`}),(0,H.jsx)(DQe,{state:t,onRetry:a})]})}),n===`on`?(0,H.jsx)(kQe,{workspaceName:e,returnFocus:c,onCancel:o,onConfirm:s}):null,n===`off`?(0,H.jsx)(jQe,{workspaceName:e,sessions:r,returnFocus:c,onCancel:o,onConfirm:s}):null]})}function PQe({repository:e}){let t=e.id,n=U(gP,e=>e.byId[t]),r=U(i6(t)),i=SM(),a=U(q,e=>e.order);if(n===void 0)return null;let o=yQe(n,r);return(0,H.jsx)(NQe,{workspaceName:e.name,state:o,dialog:r.dialog,runningSessions:r.dialog===`off`?bQe(i,a,t,Date.now()):MQe,onCheckedChange:e=>xQe(t,e),onRetry:()=>void TQe(t),onCancel:()=>SQe(t),onConfirm:()=>void wQe(t)})}var c6=`__inherit__`;function FQe(e,t){if(t===void 0)return``;let n=e.find(e=>e.name===t);return n===void 0?`Configured value '${t}' is not in the effective catalog.`:n.description??(n.layers?`Layers: ${n.layers.join(`, `)||`none`}.`:``)}function IQe({label:e,dirty:t,origin:n,busy:r,children:i,onRevert:a,onClear:o}){return(0,H.jsxs)(e3,{className:`gap-1`,children:[(0,H.jsxs)(t3,{className:`flex min-h-6 flex-wrap items-center gap-x-2 gap-y-1`,children:[e,n===`repository`?(0,H.jsx)(`span`,{className:`sr-only`,children:`, set for this repository`}):null,n===`global`?(0,H.jsx)(`span`,{className:`text-sm font-normal text-po-dim`,children:`From global`}):null,t?(0,H.jsx)(XK,{tone:`cyan`,children:`Unsaved`}):null,t?(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,disabled:r,onClick:a,className:`text-po-dim`,children:`Revert`}):n===`repository`?(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,disabled:r,onClick:o,className:`text-po-dim`,children:`Reset`}):null]}),(0,H.jsx)(n3,{children:i})]})}function l6(e,t){return Object.hasOwn(e,t)}function LQe({id:e,label:t,detail:n,options:r,effective:i,repositoryValue:a,origin:o,draft:s,dirty:c,busy:l,onChange:u,onRevert:d}){let f=c?s:a,p=f??c6,m=i===void 0?`Inherit (none)`:`Inherit (${i})`,h=f??i;return(0,H.jsxs)(Q4,{"data-testid":`repository-axis-${e}`,"data-dirty":c,changed:o===`repository`,className:`items-start`,children:[(0,H.jsx)(IQe,{label:t,dirty:c,origin:o,busy:l,onRevert:d,onClear:()=>u(null),children:FQe(r,h)||n}),(0,H.jsxs)(F4,{value:p,disabled:l,onValueChange:e=>u(e===c6?null:e),children:[(0,H.jsx)(R4,{"data-testid":`repository-select-${e}`,"aria-label":t,className:`w-full text-sm sm:w-64`,children:(0,H.jsx)(L4,{})}),(0,H.jsxs)(z4,{children:[(0,H.jsx)(V4,{value:c6,children:m}),r.map(e=>(0,H.jsx)(V4,{value:e.name,children:e.name},e.name))]})]})]})}function RQe({view:e,draft:t,dirty:n,busy:r,onChange:i,onRevert:a}){let o=e.selection.domains,s=o.effective??[],c=n?t??s:o.repository??s,l=new Set(c),u=e=>l.has(e)?c.filter(t=>t!==e):[...c,e];return(0,H.jsxs)(Q4,{"data-testid":`repository-axis-domains`,"data-dirty":n,changed:o.origin===`repository`,className:`items-start`,children:[(0,H.jsx)(IQe,{label:`Domains`,dirty:n,origin:o.origin,busy:r,onRevert:a,onClear:()=>i(null),children:`The plugin sets a new session in this repository loads. Pick any number.`}),(0,H.jsxs)(`div`,{role:`group`,"aria-label":`Domains`,className:`flex basis-full flex-wrap items-center gap-2`,children:[e.catalogs.domains.map(e=>{let t=l.has(e.name);return(0,H.jsxs)(Z,{variant:`ghost`,size:`sm`,"data-testid":`repository-domain-${e.name}`,"data-active":t,"aria-pressed":t,disabled:r,title:e.description,onClick:()=>i(u(e.name)),className:t?`gap-1.5 rounded-full border border-po-green/50 bg-po-green/10 pl-2 pr-3 font-medium text-po-green hover:bg-po-green/15 hover:text-po-green`:`rounded-full border border-po-border-soft px-3 text-po-dim hover:border-po-border hover:text-po-hi`,children:[t?(0,H.jsx)(LL,{"aria-hidden":!0,className:`size-3.5`}):null,e.name]},e.name)}),e.catalogs.domains.length===0?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`No domains are configured.`}):null]})]})}function zQe({repository:e,containerSection:t}){let n=e?.id??``,r=JSON.stringify([`repository`,n]),[i,a,o]=gL(`${r}/view`,void 0),[s,c]=gL(`${r}/drafts`,{}),[l,u,d]=gL(`${r}/busy`,!1),[f,p]=gL(`${r}/error`,``),[m,h]=gL(`${r}/note`,``),g=Object.keys(s).length,_=(0,V.useCallback)(async()=>{if(n===``){a(void 0);return}if(d.state)return;let e=o.state,t=await wj(n);d.state||o.state!==e||(t.ok?(a(t.settings),p(``)):(a(void 0),p(t.error)))},[n,d,o,a,p]);(0,V.useEffect)(()=>{_()},[_]);let v=(0,V.useCallback)((e,t)=>{h(``),c(n=>({...n,[e]:t}))},[h,c]),y=(0,V.useCallback)(e=>{c(t=>{let n={...t};return delete n[e],n})},[c]),b=(0,V.useCallback)(async()=>{if(d.state||i===void 0||g===0)return;u(!0),p(``);let e=await Tj({repositoryId:i.repository.id,expectedHash:i.hash,changes:s});if(u(!1),!e.ok)p(e.error),await _();else{a(e.settings),c(e=>e===s?{}:e),h(`Saved. Run po sync, and the next session starts with these.`);for(let e of Object.keys(q.state.byId))ON(e)}},[d,g,s,_,i,u,p,a,c,h]),x=l6(s,`majorMode`),S=l6(s,`domains`),C=l6(s,`profile`);return(0,H.jsxs)(U4,{"data-testid":`repository-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Defaults`}),(0,H.jsx)(K4,{children:`What a new session in this repository starts with. Sessions already open keep what they have.`})]}),e===null?(0,H.jsx)(Z4,{children:(0,H.jsx)(Q4,{"data-testid":`repository-settings-empty`,children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No repository yet`}),(0,H.jsxs)(n3,{children:[`Open a session inside a Git or `,(0,H.jsx)(`code`,{className:`font-mono`,children:`.po`}),` repository to set its defaults here.`]})]})})}):null,f===``?null:(0,H.jsx)(`p`,{"data-testid":`repository-settings-error`,role:`alert`,className:`text-sm leading-relaxed text-po-red`,children:f}),i===void 0?null:(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,H.jsxs)(Z4,{children:[(0,H.jsx)(LQe,{id:`major-mode`,label:`Major mode`,detail:`The extensions and package layers a session is built from.`,options:i.catalogs.majorModes,effective:i.selection.majorMode.effective,repositoryValue:i.selection.majorMode.repository,origin:i.selection.majorMode.origin,draft:x?s.majorMode:void 0,dirty:x,busy:l,onChange:e=>v(`majorMode`,e),onRevert:()=>y(`majorMode`)}),(0,H.jsx)(RQe,{view:i,draft:S?s.domains:void 0,dirty:S,busy:l,onChange:e=>v(`domains`,e),onRevert:()=>y(`domains`)}),(0,H.jsx)(LQe,{id:`profile`,label:`Profile`,detail:`The persona a new session in this repository starts with.`,options:i.catalogs.profiles,effective:i.selection.profile.effective,repositoryValue:i.selection.profile.repository,origin:i.selection.profile.origin,draft:C?s.profile:void 0,dirty:C,busy:l,onChange:e=>v(`profile`,e),onRevert:()=>y(`profile`)})]}),(0,H.jsxs)(i3,{children:[(0,H.jsx)(Z,{variant:g>0?`primary`:`outline`,size:`sm`,"data-testid":`repository-settings-save`,loading:l,disabled:l||g===0,onClick:()=>void b(),children:`Save defaults`}),g===0?null:(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>c({}),children:`Discard`}),(0,H.jsx)(r3,{children:g>0?`${String(g)} unsaved ${g===1?`change`:`changes`}.`:m})]})]}),e===null?null:t??(0,H.jsx)(PQe,{repository:e}),e===null?null:(0,H.jsx)(fQe,{workspaceId:e.id})]})}var BQe={providers:OR,appearance:yxe,notifications:NL,images:hR,remote:dR,presets:_R,repositories:aR,account:AR};function VQe({active:e,sections:t,onNavigate:n,repositoryId:r}){return t.map(t=>{let i=t.id===e,a=t.icon??BQe[t.id]??DR;return(0,H.jsx)(s3,{asChild:!0,active:i,className:`min-h-9 min-w-0 gap-2.5 rounded-md px-3 py-2 text-po-text focus-visible:ring-2 focus-visible:ring-po-green data-[active=true]:text-po-green`,children:(0,H.jsxs)(Mx,{to:`/settings/$section`,params:{section:t.id},search:{workspace:r},"data-testid":`settings-section-${t.id}`,"aria-current":i?`page`:void 0,onClick:n,children:[(0,H.jsx)(a,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:`block min-w-0 truncate first-letter:uppercase`,children:t.label})]})},t.id)})}function HQe(e){let{workspace:t,sections:n,...r}=e,i=e=>e.contribution!==void 0||e.panel!==void 0&&e.panel.menuGroup!==`general`||e.repositoryPanel!==void 0;return[{label:t,sections:n.filter(e=>!i(e))},{label:`from plugins`,sections:n.filter(i)}].filter(e=>e.sections.length>0).map((e,t)=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5 ${t>0?`pt-5`:``}`,children:[(0,H.jsx)(P4,{className:`px-3 pb-2`,children:e.label}),(0,H.jsx)(VQe,{...r,sections:e.sections})]},e.label))}function u6({active:e,workspace:t,repositoryId:n}){let[r,i]=(0,V.useState)(!1),a=Kj(t),o=a.find(t=>t.id===e)??a[0],s=o?o.icon??BQe[o.id]??DR:TR;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`shrink-0 border-b border-po-border bg-po-panel/40 p-2 lg:hidden`,children:(0,H.jsxs)(Z,{variant:`outline`,size:`sm`,"data-testid":`settings-menu-open`,"aria-haspopup":`dialog`,"aria-expanded":r,onClick:()=>i(!0),className:`h-auto w-full justify-between gap-3 px-3 py-2 text-left whitespace-normal`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,H.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-po-green`}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-medium text-po-hi first-letter:uppercase`,children:o?.label??t}),(0,H.jsx)(`span`,{className:`truncate text-sm font-normal text-po-dim`,children:o?.detail})]})]}),(0,H.jsx)(UL,{className:`h-3.5 w-3.5 shrink-0 text-po-faint`})]})}),(0,H.jsx)(`nav`,{"data-testid":`settings-menu`,"aria-label":`${t} settings sections`,className:`hidden w-56 shrink-0 flex-col overflow-y-auto border-r border-po-border-soft px-3 py-6 lg:flex`,children:(0,H.jsx)(HQe,{active:e,workspace:t,sections:a,repositoryId:n})}),(0,H.jsx)(aq,{open:r,onOpenChange:i,children:(0,H.jsxs)(cq,{width:`lg`,"data-testid":`settings-menu-sheet`,"aria-describedby":void 0,className:`top-auto bottom-0 left-0 max-h-[min(72dvh,560px)] !w-full !max-w-none translate-x-0 translate-y-0 rounded-t-xl rounded-b-none border-x-0 border-b-0 data-[state=open]:animate-none lg:hidden`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-po-border`}),(0,H.jsx)(lq,{dismissible:!0,closeLabel:`close settings menu`,className:`py-2.5`,children:(0,H.jsxs)(uq,{className:`first-letter:uppercase`,children:[t,` settings`]})}),(0,H.jsx)(fq,{className:`gap-1 p-2 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:(0,H.jsx)(`nav`,{"aria-label":`${t} settings sections`,className:`flex flex-col`,children:(0,H.jsx)(HQe,{active:e,workspace:t,sections:a,repositoryId:n,onNavigate:()=>i(!1)})})})]})})]})}var UQe=`po.settings.repository`,WQe=(e,t)=>Ye.fetch(e,t);function GQe(){try{return localStorage.getItem(UQe)??``}catch{return``}}function KQe(e){try{localStorage.setItem(UQe,e)}catch{}}function qQe({current:e,initialRepositoryId:t,onRepositoryChange:n,onReady:r}){let i=U(gP,e=>e.order.join(`
|
|
143
|
+
`),[i,a]=(0,V.useState)({}),o=(0,V.useRef)(new Set);(0,V.useEffect)(()=>{let e=new Set(n.values());for(let[e,t]of n)o.current.has(t)||(o.current.add(t),HA(e,t.slice(t.lastIndexOf(`:`)+1)).then(e=>a(n=>({...n,[t]:e})),()=>void 0));a(t=>{let n=Object.keys(t).filter(t=>!e.has(t));if(n.length===0)return t;let r={...t};for(let e of n)URL.revokeObjectURL(r[e]),delete r[e],o.current.delete(e);return r})},[r]),(0,V.useEffect)(()=>()=>{a(e=>{for(let t of Object.values(e))URL.revokeObjectURL(t);return{}})},[]);let s={};for(let[e,t]of n){let n=i[t];n!==void 0&&(s[e]=n)}return s}function pZe({onDismiss:e}){let t=Tx(),n=(0,V.useRef)(0),r=(0,V.useCallback)(e=>{if(e!==null)return e.scrollTop=n.current,()=>{n.current=e.scrollTop}},[]),i=U(q,e=>e.order),a=SM(),o=U(q,e=>e.activeId),s=U(gP,e=>e.order),c=U(gP,e=>e.byId),l=U(gP,e=>e.selectedId),u=U(gP,e=>e.hydrated),d=U(aN(o),e=>e.dialog!==null),f=U(fF,e=>e.view),p=U(SP,e=>e),m=U(oF),h=fZe(i,a);(0,V.useEffect)(()=>{if(u)return;let e=!1;return jO().then(t=>{!e&&`workspaces`in t&&_P(t)}),()=>{e=!0}},[u]),(0,V.useEffect)(()=>{let e=o===null?void 0:a[o]?.summary.workspaceId;e!==void 0&&c[e]!==void 0&&bP(e)},[o,a,c]),(0,V.useEffect)(()=>{let n=n=>{if(n.ctrlKey&&!n.metaKey&&!n.altKey&&n.key===`t`){n.preventDefault(),e?.(),l!==null&&c[l]?.kind===`session`?wP(sr(l)?.hostId):CP(l);return}if(n.ctrlKey||n.metaKey||n.altKey||n.defaultPrevented||uZe(n.target)||dZe(n.target)||YP.state.open||d)return;let r=Number.parseInt(n.key,10);if(!Number.isInteger(r)||r<1||r>9)return;let a=i[r-1];a!==void 0&&(n.preventDefault(),e?.(),t({to:`/session/$sessionId`,params:{sessionId:a}}))};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[i,d,t,e,l,c]);let g=(0,V.useRef)([]),_=(0,V.useMemo)(()=>fj(g.current,dj({order:i,byId:a,activeId:o,workspaceOrder:s,workspacesById:c,nested:new Set(i.filter(e=>fM(a,e)!==void 0)),now:Date.now(),restarts:m,avatarUrls:h})),[i,a,o,s,c,m,h]);(0,V.useEffect)(()=>{g.current=_},[_]);let v=(0,V.useRef)({navigate:t,onDismiss:e,selectedWorkspaceId:l});(0,V.useEffect)(()=>{v.current={navigate:t,onDismiss:e,selectedWorkspaceId:l}});let y=(0,V.useMemo)(()=>({openSession(e){v.current.onDismiss?.(),v.current.navigate({to:`/session/$sessionId`,params:{sessionId:e}})},renameSession(e,t){let n=t.trim();n!==``&&n!==q.state.byId[e]?.summary.name&&HN(n,e)},async setSessionGroups(e,t){let n=await bge(e,t);return`error`in n?{error:n.error}:void 0},async renameGroup(e,t){let n=await xge(e,t);return`error`in n?{error:n.error}:void 0},async deleteGroup(e){let t=await Sge(e);return`error`in t?{error:t.error}:void 0},restartSession(e){dF(e)},async removeSession(e){let t=await _ge(e);if(`error`in t)return{error:t.error};nye({sessionId:e})},resumeSession(e){nF({sessionId:e})},createSession(e){bP(e),v.current.onDismiss?.(),gP.state.byId[e]?.kind===`session`?wP(sr(e)?.hostId):CP(e)},createGeneralSession(){v.current.onDismiss?.(),wP()},resumeInWorkspace(e){nF({workspaceId:e})},openWorkspaceSettings(e){bP(e),v.current.onDismiss?.(),v.current.navigate({to:`/settings/$section`,params:{section:Wj},search:{workspace:e}})},async deleteWorkspace(e){let t=await dge(e);if(`error`in t)return{error:t.error};yP({workspaceId:e})},openAddWorkspace(){v.current.onDismiss?.(),CP(null)},closeAddWorkspace(){YI.state.pending||(ZI(),EP())},async addWorkspace(e){let t=await QI(e);return t===void 0&&EP(),t},discoverWorkspaces:oge,async addDeclaredWorkspaces(e){let t=await eL(e);return t.results.length>0&&t.results.every(e=>e.workspaceId!==void 0&&!e.error)&&(ZI(),EP()),t},searchDirectories:Age,listDirectory:age,async removePendingSetup(e,t){let n=q.state.byId[e]?.summary.workspaceId;if(n===void 0)return{error:`This session belongs to no workspace.`};let r=await tj(n,e,t);return`error`in r?{error:r.error}:void 0},openWorkspace(e){v.current.onDismiss?.(),v.current.navigate({to:`/workspace/$workspaceId`,params:{workspaceId:e}})},openHome(){v.current.onDismiss?.(),v.current.navigate({to:`/`})},openSettings(){v.current.onDismiss?.(),v.current.navigate({to:`/settings/$section`,params:{section:Uj},search:{workspace:v.current.selectedWorkspaceId??void 0}})},openRemoteAccess(){v.current.onDismiss?.(),_F()},turnRemoteAccessOff(){wF()},renderSessionMenuItems:e=>(0,H.jsx)(h3,{slot:s_.sessionMenu,sessionId:e})}),[]),b=iS({select:e=>lS(e).kind===`home`}),x=p.open&&p.kind!==`general`&&(p.workspaceId===null||c[p.workspaceId]===void 0);return{workspaces:_,scrollRef:r,remote:{status:f?.status??`off`,deviceCount:f?.devices.length??0,...f?.publicUrl===void 0?{}:{host:new URL(f.publicUrl).host},...f?.error===void 0?{}:{error:f.error}},pluginContent:(0,H.jsx)(h3,{slot:s_.rail,sessionId:o}),homeActive:b,...x?{addWorkspace:{suggestedPaths:[]}}:{},actions:y}}function mZe({team:e=Lve(),signOut:t=Rve()}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(),o=async()=>{if(t){r(!0),a(void 0);try{await t()}catch(e){a(e instanceof Error?e.message:String(e)),r(!1)}}};return(0,H.jsxs)(U4,{"data-testid":`account-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Account`}),(0,H.jsx)(K4,{children:`Who can use this Po, and signing out of it in this browser.`})]}),(0,H.jsxs)(Z4,{children:[e===void 0?null:(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`Members`}),(0,H.jsx)(n3,{children:`Invite people by email, see pending invitations, and remove people from this team.`})]}),(0,H.jsx)(Z,{asChild:!0,variant:`outline`,size:`sm`,children:(0,H.jsx)(`a`,{href:e,"data-testid":`account-members`,children:`Manage members`})})]}),t===void 0?null:(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`Sign out`}),(0,H.jsx)(n3,{children:i??`Ends your sign-in on this browser.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,disabled:n,onClick:()=>void o(),"data-testid":`account-sign-out`,children:`Sign out`})]})]})]})}var hZe=`workspace:`;function gZe({target:e,onTargetChange:t}){WI();let n=U(gP,e=>e),r=e.startsWith(hZe)?e.slice(10):void 0,i=JF(r),a=W_(r===void 0?{scope:`global`}:{scope:`workspace`,workspaceId:r}),o=XF(i),s=p_(a.templates,o),[c,l]=gL(`template/draft`,null),u=c?.target===e?c.id:s.template?.id,d=i.saving||i.loading,f=i.config?.values[`web.template`]?.origin??`default`,p=r!==void 0&&n.byId[r]===void 0,m=u!==void 0&&u!==o;return(0,H.jsxs)(q4,{"data-testid":`template-settings`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Layout`}),(0,H.jsx)(X4,{children:`The arrangement Po opens with. Set it for everyone, or let one workspace choose its own.`})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,H.jsx)(`span`,{id:`template-scope-label`,className:`text-sm text-po-dim`,children:`Applies to`}),(0,H.jsxs)(F4,{value:e,onValueChange:e=>{t(e),l(null)},disabled:i.saving,children:[(0,H.jsx)(R4,{"aria-labelledby":`template-scope-label`,"data-testid":`template-scope`,className:`w-auto min-w-56 max-w-full`,children:(0,H.jsx)(L4,{})}),(0,H.jsxs)(z4,{children:[(0,H.jsx)(V4,{value:`global`,children:`Global default`}),n.order.filter(e=>n.byId[e]?.kind!==`session`).map(e=>(0,H.jsxs)(V4,{value:`${hZe}${e}`,children:[`Workspace: `,n.byId[e]?.root??e]},e))]})]})]}),(0,H.jsx)(j4,{"aria-label":`Layout`,value:u??``,onValueChange:t=>l({target:e,id:t}),className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,disabled:d||p,children:a.templates.map(e=>(0,H.jsxs)(M4,{value:e.id,"data-testid":`template-${e.id}`,"data-selected":u===e.id,className:`flex items-start gap-2 rounded-lg p-4`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:e.label}),(0,H.jsx)(`span`,{className:`text-sm leading-relaxed text-po-dim`,children:e.description}),(0,H.jsx)(`span`,{className:`font-mono text-sm text-po-dim`,children:e.pluginId})]}),u===e.id?(0,H.jsx)(LL,{className:`size-4 shrink-0 text-po-green`}):null]},e.id))}),s.warning?(0,H.jsx)(`output`,{className:`block text-sm text-po-yellow`,children:s.warning}):null,a.diagnostics.map((e,t)=>(0,H.jsx)(`output`,{className:`block text-sm text-po-yellow`,children:e.message},`${e.pluginId}:${t}`)),i.error?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`template-save-error`,className:`text-sm text-po-red`,children:i.error}):null,(0,H.jsxs)(i3,{children:[(0,H.jsx)(Z,{"data-testid":`template-save`,size:`sm`,variant:m?`primary`:`outline`,disabled:d||p||u===void 0||i.config===void 0,onClick:()=>{u!==void 0&&YF(u,r).then(e=>{e&&(l(null),ak())})},children:i.saving?`Saving…`:`Set as default`}),(0,H.jsx)(Z,{"data-testid":`template-inherit`,size:`sm`,variant:`ghost`,disabled:d||p||i.config===void 0,onClick:()=>{YF(null,r).then(e=>{e&&(l(null),ak())})},children:r===void 0?`Use automatic fallback`:`Inherit global default`}),(0,H.jsx)(Z,{"data-testid":`template-reload`,size:`sm`,variant:`ghost`,disabled:d,onClick:()=>{KF(r).then(()=>ak())},children:`Reload configuration`})]}),(0,H.jsxs)(r3,{"data-testid":`template-origin`,children:[`Saved to`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:r===void 0?`~/.po/config.yaml`:`${i.config?.repoRoot??n.byId[r]?.root??r}/.po/config.yaml`}),`. Currently using`,` `,o===void 0?`automatic fallback`:(0,H.jsx)(`code`,{className:`font-mono`,children:o}),` (`,f,`).`]})]})}var _Ze=[`blue`,`green`,`yellow`,`red`,`magenta`,`cyan`];function vZe({theme:e}){let{tokens:t}=e;return(0,H.jsxs)(`div`,{"aria-hidden":!0,className:`flex h-[74px] w-full overflow-hidden rounded border`,style:{backgroundColor:t.bg,borderColor:t.border},children:[(0,H.jsxs)(`div`,{className:`flex w-[34%] flex-col gap-1 p-1.5`,style:{backgroundColor:t.rail},children:[(0,H.jsx)(`span`,{className:`h-[7px] w-full rounded-sm`,style:{backgroundColor:t.selected}}),(0,H.jsx)(`span`,{className:`h-[7px] w-3/4 rounded-sm`,style:{backgroundColor:t.panel}}),(0,H.jsx)(`span`,{className:`h-[7px] w-3/4 rounded-sm`,style:{backgroundColor:t.panel}})]}),(0,H.jsxs)(`div`,{className:`flex flex-1 flex-col justify-between p-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`h-[5px] w-2/3 rounded-sm`,style:{backgroundColor:t.text}}),(0,H.jsx)(`span`,{className:`h-[5px] w-1/2 rounded-sm`,style:{backgroundColor:t.dim}})]}),(0,H.jsx)(`div`,{className:`flex gap-1`,children:_Ze.map(e=>(0,H.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:t[e]}},e))})]})]})}function yZe({templateTarget:e,onTemplateTargetChange:t}){let n=U(lI,e=>e.name);return(0,H.jsxs)(U4,{"data-testid":`appearance-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Appearance`}),(0,H.jsx)(K4,{children:`Choose how Po looks and which layout it opens with.`})]}),(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Theme`}),(0,H.jsx)(X4,{children:`Applies straight away and is remembered in this browser. Plugin tabs follow it too.`})]}),(0,H.jsx)(j4,{"aria-label":`Theme`,"data-testid":`theme-list`,className:`grid grid-cols-1 gap-3 min-[480px]:grid-cols-2 lg:grid-cols-3`,value:n,onValueChange:pI,children:uI().map(e=>{let t=e.name===n;return(0,H.jsxs)(M4,{value:e.name,"data-testid":`theme-${e.name}`,"data-selected":t,className:`flex flex-col gap-3 rounded-lg p-3`,children:[(0,H.jsx)(vZe,{theme:e}),(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.label}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim first-letter:uppercase`,children:e.scheme})]}),t?(0,H.jsx)(LL,{className:`size-4 shrink-0 text-po-green`}):null]})]},e.name)})}),(0,H.jsxs)(r3,{children:[`A theme is a JSON file of twenty colour tokens. The format lives in`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`@agimon-ai/po-web-components`}),`.`]})]}),(0,H.jsx)(gZe,{target:e,onTargetChange:t})]})}function bZe(e){return!e.trim()||Array.from(e.trim()).length>64}function xZe(e){let t=bZe(e.name),n=bZe(e.renameName);return(0,H.jsxs)(U4,{className:`max-w-2xl`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Devices`}),(0,H.jsxs)(K4,{children:[`Names help you recognise where voice is active. This list belongs to `,e.hostLabel,`.`]})]}),(0,H.jsxs)(q4,{children:[(0,H.jsx)(Y4,{children:`This device`}),(0,H.jsx)(Z4,{children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,H.jsx)($4,{id:`device-name`,label:`Device name`,children:(0,H.jsx)(zq,{id:`device-name`,value:e.name,onChange:t=>e.onNameChange(t.target.value),"aria-describedby":`name-help`,"aria-invalid":t,disabled:e.pending})}),(0,H.jsx)(r3,{id:`name-help`,children:`Default: ${e.defaultName}. Use 1 to 64 characters.`}),t?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-po-red`,children:`Enter a name from 1 to 64 characters.`}):null,e.error?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-po-red`,children:e.error}):null,(0,H.jsx)(`div`,{children:(0,H.jsx)(Z,{disabled:!!e.editing||t||e.pending||!e.deviceId,onClick:e.onSave,children:`Save name`})})]})})]}),(0,H.jsxs)(q4,{children:[(0,H.jsxs)(Y4,{children:[`Devices on `,e.hostLabel]}),(0,H.jsx)(r3,{children:`Names are labels, not permission to access this computer. Last seen does not confirm a live connection.`}),e.status===`loading`?(0,H.jsx)(r3,{role:`status`,children:`Loading devices…`}):e.status===`error`?(0,H.jsx)(r3,{children:(0,H.jsx)(Z,{variant:`ghost`,onClick:e.onRetry,children:`Try again`})}):e.devices.length===0?(0,H.jsx)(r3,{children:`No devices have been recorded yet.`}):(0,H.jsx)(Z4,{children:e.devices.map(t=>(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsxs)(t3,{children:[t.deviceName,t.deviceId===e.deviceId?` · This device`:``]}),(0,H.jsx)(n3,{children:t.description})]}),(0,H.jsxs)(hq,{children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,"aria-label":`Actions for ${t.deviceName}`,disabled:e.pending,children:`•••`})}),(0,H.jsx)(vq,{children:(0,H.jsx)(bq,{onSelect:()=>e.onRename(t),children:`Rename`})})]})]},t.deviceId))})]}),e.editing?(0,H.jsxs)(q4,{children:[(0,H.jsxs)(Y4,{children:[`Rename `,e.editing.deviceName]}),(0,H.jsx)(Z4,{children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,H.jsx)(j$,{htmlFor:`other-name`,children:`Device name`}),(0,H.jsx)(zq,{id:`other-name`,value:e.renameName,onChange:t=>e.onRenameNameChange(t.target.value),"aria-describedby":`rename-result`,"aria-invalid":n,disabled:e.pending}),e.renameError?(0,H.jsx)(`p`,{id:`rename-result`,role:`alert`,className:`text-sm text-po-red`,children:e.renameError}):(0,H.jsx)(`p`,{id:`rename-result`,className:`text-sm text-po-dim`,children:`Changes the name recorded on ${e.hostLabel}, even while this device is offline.`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Z,{disabled:n||e.pending,onClick:e.onSaveRename,children:`Save name`}),(0,H.jsx)(Z,{variant:`ghost`,disabled:e.pending,onClick:e.onCancel,children:`Cancel`})]})]})})]}):null]})}var SZe=(e,t)=>He.fetch(e,t);function CZe({hostLabel:e=`this Po host`,request:t=SZe}){let n=YO({header:Se()}),r=n.status===`ok`?n.metadata:void 0,[i,a]=(0,V.useState)([]),[o,s]=(0,V.useState)(r?.deviceName??``),[c,l]=(0,V.useState)(`loading`),[u,d]=(0,V.useState)(),[f,p]=(0,V.useState)(),[m,h]=(0,V.useState)(),[g,_]=(0,V.useState)(``),[v,y]=(0,V.useState)(!1),b=(0,V.useCallback)(async()=>{let e=await t(`/api/client-devices`,{cache:`no-store`});if(!e.ok)throw Error(`Devices could not be loaded (${e.status}).`);let n=await e.json(),i=n.devices.find(e=>e.deviceId===r?.deviceId);i&&(await xe(i.deviceName,i.nameUpdatedAt),s(i.deviceName)),a(n.devices),l(`ready`)},[t,r?.deviceId]),x=(0,V.useCallback)(async()=>{l(`loading`),d(void 0);try{await b()}catch(e){d(e instanceof Error?e.message:String(e)),l(`error`)}},[b]);(0,V.useEffect)(()=>{x()},[x]);async function S(e,n,i){if(!v){y(!0),(i?p:d)(void 0);try{let a=await t(`/api/client-devices/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`,"x-po-csrf":`1`},body:JSON.stringify({deviceName:n})});if(!a.ok)throw Error(`The name could not be saved. Your edit is still here. Try again.`);let o=await a.json();o.device.deviceId===r?.deviceId&&await xe(o.device.deviceName,o.device.nameUpdatedAt),await b(),i&&h(void 0)}catch(e){(i?p:d)(e instanceof Error?e.message:String(e))}finally{y(!1)}}}let C=i.map(e=>({deviceId:e.deviceId,deviceName:e.deviceName,description:[e.clientKind===`web`?`Web`:e.clientKind===`desktop`?`Desktop`:e.clientKind===`ios`?`iOS`:`Android`,e.platform,e.browser,`Last seen ${new Date(e.lastSeen).toLocaleString()}`].filter(Boolean).join(` · `)}));return(0,H.jsx)(xZe,{hostLabel:e,deviceId:r?.deviceId,defaultName:Zge(navigator.userAgent),name:o,onNameChange:s,devices:C,status:c,editing:m,renameName:g,onRenameNameChange:_,onRename:e=>{h(e),_(e.deviceName),p(void 0)},onCancel:()=>h(void 0),onSave:()=>{r&&S(r.deviceId,o,!1)},onSaveRename:()=>{m&&S(m.deviceId,g,!0)},pending:v,error:u,renameError:f,onRetry:()=>{x()}})}var J3=`__inherit__`;function wZe({origin:e,scope:t}){return e==="default"?null:e===t?(0,H.jsx)(`span`,{className:`sr-only`,children:`, set here`}):e===`global`?(0,H.jsx)(`span`,{className:`text-sm font-normal text-po-dim`,children:`From global`}):(0,H.jsx)(XK,{tone:`yellow`,className:`shrink-0`,children:`Overridden by repository`})}function TZe({field:e}){return(0,H.jsx)(`code`,{className:`min-w-0 max-w-full break-all font-mono text-sm text-po-dim`,children:Nj(e)})}function EZe({field:e,view:t,scope:n,draft:r,busy:i,onDraft:a}){let o=Pj(t,n),s=r!==void 0;return(0,H.jsxs)(H.Fragment,{children:[t===void 0?null:(0,H.jsx)(wZe,{origin:t.origin,scope:n}),o===void 0?null:(0,H.jsxs)(`span`,{"data-testid":`settings-locked-${e.id}`,className:`inline-flex items-center gap-1 text-sm font-normal text-po-dim`,children:[(0,H.jsx)(bR,{"aria-hidden":!0,className:`size-3`}),(0,H.jsx)(`span`,{className:`inline-block first-letter:uppercase`,children:o})]}),s?(0,H.jsx)(XK,{tone:`cyan`,"data-testid":`settings-dirty-${e.id}`,className:`shrink-0`,children:`Unsaved`}):null,s?(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,"data-testid":`settings-revert-${e.id}`,disabled:i,onClick:()=>a(e,void 0),className:`text-po-dim`,children:`Revert`}):t?.origin===n&&o===void 0?(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,"data-testid":`settings-clear-${e.id}`,disabled:i,onClick:()=>a(e,null),className:`text-po-dim`,children:`Reset`}):null]})}function DZe({field:e,view:t,scope:n,draft:r,busy:i,onDraft:a}){let o=Pj(t,n),s=r===void 0?t?.value??``:r??``;return(0,H.jsxs)(`div`,{"data-testid":`settings-field-${e.id}`,"data-dirty":r!==void 0,className:`flex min-w-0 flex-col gap-2`,children:[(0,H.jsx)(j4,{"aria-label":e.label,value:s===``?e.defaultValue??``:s,disabled:i||o!==void 0,onValueChange:t=>a(e,t),className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:(e.options??[]).map(t=>(0,H.jsxs)(M4,{value:t.value,"data-testid":`settings-card-${e.id}-${t.value}`,className:`flex flex-col gap-1.5 p-4`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:t.label}),t.detail===void 0?null:(0,H.jsx)(`span`,{className:`text-sm leading-relaxed text-po-dim`,children:t.detail})]},t.value))}),(0,H.jsxs)(`div`,{className:`flex min-h-6 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,H.jsx)(TZe,{field:e}),(0,H.jsx)(EZe,{field:e,view:t,scope:n,draft:r,busy:i,onDraft:a})]})]})}function OZe({providerId:e,groupLabel:t}){let[n,r]=gL(`providers/list`,null);(0,V.useEffect)(()=>{Ht().then(e=>{`providers`in e&&r(e.providers)})},[r]);let i=n?.find(t=>t.id===e),a=i?.authenticated!==void 0;return(0,H.jsxs)(Q4,{"data-testid":`settings-signin-${e}`,className:`items-start`,children:[(0,H.jsxs)(e3,{className:`gap-1`,children:[(0,H.jsx)(t3,{className:`flex min-h-6 items-center`,children:i?.name??`Sign-in`}),(0,H.jsx)(n3,{children:a?`${t} uses this sign-in.`:`${t} uses this sign-in. Sign in whenever you are ready.`})]}),a?(0,H.jsx)(XK,{tone:`green`,"data-testid":`settings-signed-in-${e}`,children:`Signed in`}):(0,H.jsx)(Z,{asChild:!0,variant:`secondary`,size:`sm`,children:(0,H.jsx)(Mx,{"data-testid":`settings-sign-in-${e}`,to:`/settings/$section`,params:{section:`providers`},children:`Sign in`})})]})}function kZe({field:e,view:t,scope:n,models:r,draft:i,busy:a,onDraft:o}){let s=Pj(t,n),c=i!==void 0,l=i===void 0?t?.value??``:i??``,u=(0,V.useMemo)(()=>e.optionsFrom===`models`?r.map(e=>({value:e.value,label:e.label,group:e.group})):e.options??[],[e.options,e.optionsFrom,r]),d=(0,V.useMemo)(()=>[...new Set(u.map(e=>e.group??``))],[u]),f=e.kind===`select`&&u.length===0?`text`:e.kind,p=f===`select`&&l!==``&&!u.some(e=>e.value===l)?l:void 0,m=f===`info`?(0,H.jsx)(`span`,{className:`text-sm text-po-text`,children:l||`-`}):f===`toggle`?(0,H.jsx)(a3,{"data-testid":`settings-toggle-${e.id}`,"aria-label":e.label,checked:l===`true`,disabled:a||s!==void 0,onCheckedChange:t=>o(e,String(t))}):f===`select`?(0,H.jsxs)(F4,{value:l===``?J3:l,disabled:a||s!==void 0,onValueChange:t=>o(e,t===J3?null:t),children:[(0,H.jsx)(R4,{"data-testid":`settings-select-${e.id}`,"aria-label":e.label,className:`w-full text-sm sm:w-64`,children:(0,H.jsx)(L4,{placeholder:e.placeholder??`Inherit`})}),(0,H.jsxs)(z4,{children:[(0,H.jsx)(V4,{value:J3,children:e.placeholder??`Inherit`}),p===void 0?null:(0,H.jsxs)(V4,{value:p,children:[p,` · not in catalog`]}),d.map(e=>(0,H.jsxs)(I4,{children:[e===``?null:(0,H.jsx)(B4,{children:e}),u.filter(t=>(t.group??``)===e).map(e=>(0,H.jsx)(V4,{value:e.value,children:e.label},e.value))]},e))]})]}):(0,H.jsx)(zq,{"data-testid":`settings-input-${e.id}`,"aria-label":e.label,value:l,type:f===`number`?`number`:`text`,spellCheck:!1,disabled:a||s!==void 0,placeholder:e.placeholder??`Inherit`,onChange:t=>o(e,t.target.value===``?null:t.target.value),className:`w-full text-sm sm:w-64`});return(0,H.jsxs)(Q4,{"data-testid":`settings-field-${e.id}`,"data-dirty":c,changed:f!==`info`&&t?.origin===n,className:`items-start`,children:[(0,H.jsxs)(e3,{className:`gap-1`,children:[(0,H.jsxs)(t3,{className:`flex min-h-6 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,H.jsx)(`span`,{className:`inline-block min-w-0 first-letter:uppercase`,children:e.label}),f===`info`?null:(0,H.jsx)(EZe,{field:e,view:t,scope:n,draft:i,busy:a,onDraft:o})]}),e.detail===void 0?null:(0,H.jsx)(n3,{children:e.detail}),(0,H.jsx)(TZe,{field:e})]}),m]})}function AZe({fields:e,values:t,drafts:n,group:r,...i}){let a=e=>({field:e,view:t?.[Nj(e)],draft:Nj(e)in n?n[Nj(e)]:void 0,scope:i.scope,busy:i.busy,onDraft:i.onDraft}),o=e.filter(e=>e.presentation===`cards`&&e.kind===`select`),s=e.filter(e=>!o.includes(e)),c=r?.signInProvider;return(0,H.jsxs)(H.Fragment,{children:[o.map(e=>(0,H.jsx)(DZe,{...a(e)},e.id)),s.length===0&&c===void 0?null:(0,H.jsxs)(Z4,{children:[c===void 0||r===void 0?null:(0,H.jsx)(OZe,{providerId:c,groupLabel:r.label}),s.map(e=>(0,H.jsx)(kZe,{...a(e),models:i.models},e.id))]})]})}function Y3({section:e,scope:t,repoRoot:n=``,workspaceId:r}){let[i,a]=(0,V.useState)([]),o=(0,V.useMemo)(()=>({section:e,scope:t,repoRoot:n,workspaceId:r}),[e,t,n,r]),s=cL(o),{config:c,drafts:l,error:u,note:d,busy:f}=U(oL,e=>e[s]??aL),p=e.fields.some(e=>e.optionsFrom===`models`),m=e.fields.filter(e=>Nj(e)in l);(0,V.useEffect)(()=>{p&&Ej().then(a)},[p]),(0,V.useEffect)(()=>{uL(o)},[o]);let h=(e,t)=>dL(o,e,t),g=()=>pL(o),_=()=>fL(o),v=e.groups??[],y=e.fields.filter(e=>e.group===void 0||!v.some(t=>t.id===e.group)),b={values:c?.values,drafts:l,scope:t,models:i,busy:f,onDraft:h};return(0,H.jsxs)(U4,{"data-testid":`settings-contributed-${e.id}`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:e.label}),e.detail?(0,H.jsx)(K4,{children:e.detail}):null,t===`repository`&&n===``?(0,H.jsx)(r3,{"data-testid":`settings-no-repositories`,children:`Pick a repository above to edit its config.`}):null]}),u===``?null:(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't load or save these settings`}),(0,H.jsx)(n3,{"data-testid":`settings-error`,className:`text-po-red`,children:u})]}),(0,H.jsx)(Z,{size:`sm`,variant:`outline`,disabled:f,onClick:()=>void uL(o),children:`Reload configuration`})]})}),v.map(t=>(0,H.jsxs)(q4,{"data-testid":`settings-group-${t.id}`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:t.label}),t.detail===void 0?null:(0,H.jsx)(X4,{children:t.detail})]}),(0,H.jsx)(AZe,{...b,group:t,fields:e.fields.filter(e=>e.group===t.id)})]},t.id)),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,H.jsx)(AZe,{...b,fields:y}),(0,H.jsxs)(i3,{children:[(0,H.jsx)(Z,{variant:m.length>0?`primary`:`outline`,size:`sm`,"data-testid":`settings-save`,loading:f,disabled:f||!Ij({dirty:m.length,scope:t,repoRoot:n}),onClick:()=>void g(),children:`Save`}),m.length===0?null:(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-testid":`settings-discard`,disabled:f,onClick:_,children:`Discard`}),(0,H.jsx)(r3,{"data-testid":`settings-save-note`,children:m.length>0?`${String(m.length)} unsaved. Saves to ${t===`global`?`the global config`:`this repository`}.`:d})]})]})]})}function jZe(){let[e,t,n]=gL(`images/view`,void 0),[r,i]=gL(`images/draft`,``),[a,o]=gL(`images/error`,void 0),[s,c,l]=gL(`images/busy`,!1),u=(e=()=>!1)=>{Oj().then(r=>{e()||l.state||n.state!==void 0||(r.ok?(t(r.images),i(String(r.images.maxDimension)),o(void 0)):o(r.error))})};(0,V.useEffect)(()=>{if(n.state!==void 0)return;let e=!1;return u(()=>e),()=>{e=!0}},[n,l,t,i,o]);let d=async e=>{if(l.state)return;c(!0);let n;try{n=await kj(e)}finally{c(!1)}n.ok?(t(n.images),e.maxDimension!==void 0&&i(e=>e===r?String(n.images.maxDimension):e),o(void 0)):o(n.error)},f=Number.parseInt(r,10),p=e!==void 0&&Number.isFinite(f)&&f!==e.maxDimension;return(0,H.jsxs)(U4,{"data-testid":`image-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Images`}),(0,H.jsx)(K4,{children:`How large an image can be when it reaches a model. This covers images the agent reads and the ones you attach. Pi's own settings screen changes the same values.`})]}),e===void 0&&a!==void 0?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{"data-testid":`image-settings-error`,title:a,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't read your image settings just now`}),(0,H.jsx)(n3,{children:`Nothing has changed. Images are handled as they were before.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>u(),children:`Try again`})]})}):null,e!==void 0&&a!==void 0?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`image-settings-error`,className:`text-sm leading-relaxed text-po-red`,children:a}):null,e===void 0&&a===void 0?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading image settings`}),(0,H.jsx)(Lq,{className:`h-4 w-48`}),(0,H.jsx)(Lq,{className:`h-4 w-72`})]}):null,e===void 0?null:(0,H.jsxs)(Z4,{children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{id:`image-auto-resize-label`,children:`Resize large images`}),(0,H.jsx)(n3,{children:`When off, images go out at the size they arrived, and some providers then reject the whole conversation.`})]}),(0,H.jsx)(a3,{"data-testid":`image-auto-resize`,"aria-labelledby":`image-auto-resize-label`,checked:e.autoResize,disabled:s,onCheckedChange:e=>void d({autoResize:e})})]}),(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{id:`image-max-dimension-label`,children:`Longest edge`}),(0,H.jsxs)(n3,{children:[`In pixels, from `,e.minDimension,` to `,e.maxAllowedDimension,`; anything outside is clamped. Tool results are always capped at `,e.maxAllowedDimension,`.`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(zq,{"data-testid":`image-max-dimension`,"aria-labelledby":`image-max-dimension-label`,value:r,inputMode:`numeric`,spellCheck:!1,disabled:s||!e.autoResize,onChange:e=>i(e.target.value),className:`w-24 text-right font-mono text-sm tabular-nums`}),(0,H.jsx)(Z,{size:`sm`,variant:p?`primary`:`outline`,"data-testid":`image-max-dimension-save`,disabled:s||!p,onClick:()=>void d({maxDimension:f}),children:`Save`})]})]})]})]})}var MZe={api_key:`API key`,oauth:`OAuth`},X3=`inline break-all decoration-po-blue/40 hover:decoration-po-blue`;function NZe({event:e}){return e.type===`auth_url`?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-po-text`,children:[(0,H.jsx)(`span`,{children:`Open this link to sign in:`}),(0,H.jsx)(Z,{asChild:!0,variant:`link`,size:`xs`,className:X3,children:(0,H.jsx)(`a`,{"data-testid":`login-flow-auth-url`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.url})}),e.instructions?(0,H.jsx)(`span`,{className:`text-po-dim`,children:e.instructions}):null]}):e.type===`device_code`?(0,H.jsx)(`div`,{className:`flex flex-col gap-1 text-sm text-po-text`,children:(0,H.jsxs)(`span`,{children:[`Enter the code`,` `,(0,H.jsx)(`span`,{"data-testid":`login-flow-device-code`,className:`font-mono font-medium text-po-hi`,children:e.userCode}),` `,`at`,` `,(0,H.jsx)(`a`,{href:e.verificationUri,target:`_blank`,rel:`noreferrer`,className:X3,children:e.verificationUri})]})}):e.type===`info`?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-po-text`,children:[(0,H.jsx)(`span`,{children:e.message}),e.links?.map(e=>(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:X3,children:e.label??e.url},e.url))]}):(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:e.message})}function PZe({prompt:e,value:t,remote:n,onChange:r,onSubmit:i,onSelect:a}){return e.type===`select`?(0,H.jsxs)(`div`,{"data-testid":`login-prompt`,"data-prompt-type":e.type,className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-text`,children:e.message}),(0,H.jsx)(`div`,{className:`flex flex-col gap-1`,children:(e.options??[]).map(e=>(0,H.jsxs)(Z,{variant:`outline`,"data-testid":`login-prompt-option-${e.id}`,onClick:()=>a(e.id),className:`h-auto flex-col items-start gap-0.5 px-2.5 py-1.5 text-left whitespace-normal focus-visible:border-po-blue/50 focus-visible:ring-0`,children:[(0,H.jsx)(`span`,{className:`text-base font-medium text-po-hi`,children:e.label}),e.description?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:e.description}):null]},e.id))})]}):(0,H.jsxs)(`label`,{"data-testid":`login-prompt`,"data-prompt-type":e.type,className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-sm text-po-text`,children:e.message}),n&&e.type===`manual_code`?(0,H.jsx)(`span`,{"data-testid":`login-prompt-remote-hint`,className:`text-sm text-po-dim`,children:`The page it sends you to will not load from here. Copy the whole address from your browser's address bar and paste it below.`}):null,(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(zq,{"data-testid":`login-prompt-input`,type:e.type===`secret`?`password`:`text`,value:t,autoFocus:!0,autoComplete:`off`,placeholder:e.placeholder,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i()},className:`flex-1`}),(0,H.jsx)(Z,{variant:`primary`,"data-testid":`login-prompt-submit`,disabled:t.trim()===``,onClick:i,children:`Continue`})]})]})}function FZe({flow:e,onAnswer:t,onCancel:n,onClose:r}){let i=e.prompt,a=JSON.stringify([e.id,i?.id]),o=e.status===`running`,[s,c]=gL(`providers/answer`,``),[l,u]=gL(`providers/prompt`,a);(l!==a||!o&&s!==``)&&(u(a),c(``));let d=()=>{i&&s.trim()!==``&&t(i.id,s)},f;return e.status===`succeeded`?f={text:`You're signed in to ${e.providerName}. Every session can use it now.`,className:`text-po-green`}:e.status===`failed`?f={text:e.error??`Sign-in failed.`,className:`text-po-red`}:e.status===`cancelled`&&(f={text:`Sign-in cancelled.`,className:`text-po-dim`}),(0,H.jsx)(aq,{open:!0,onOpenChange:e=>{e||(o?n():r())},children:(0,H.jsxs)(cq,{width:`md`,"data-testid":`login-flow`,"data-status":e.status,"aria-describedby":void 0,children:[(0,H.jsxs)(lq,{children:[(0,H.jsxs)(uq,{children:[`Sign in to `,e.providerName]}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:MZe[e.type]})]}),(0,H.jsxs)(fq,{children:[e.events.length>0?(0,H.jsx)(`ol`,{"data-testid":`login-flow-events`,className:`flex flex-col gap-2`,children:e.events.map((e,t)=>(0,H.jsx)(`li`,{children:(0,H.jsx)(NZe,{event:e})},t))}):null,o&&i?(0,H.jsx)(PZe,{prompt:i,value:s,remote:e.remote===!0,onChange:c,onSubmit:d,onSelect:e=>t(i.id,e)}):null,o&&!i?(0,H.jsxs)(`p`,{"data-testid":`login-flow-waiting`,className:`flex items-center gap-2 text-sm text-po-dim`,children:[(0,H.jsx)(nq,{}),e.events.length===0?`Starting…`:`Waiting for ${e.providerName}…`]}):null,f?(0,H.jsx)(`p`,{"data-testid":`login-flow-result`,className:`text-sm ${f.className}`,children:f.text}):null,(0,H.jsx)(mq,{children:o?(0,H.jsx)(Z,{variant:`outline`,"data-testid":`login-flow-cancel`,onClick:n,children:`Cancel`}):(0,H.jsx)(Z,{variant:`outline`,"data-testid":`login-flow-close`,autoFocus:!0,onClick:r,children:e.status===`succeeded`?`Done`:`Close`})})]})]})})}var IZe={granted:`Allowed in this browser.`,denied:`Blocked in this browser. Turn them on in your browser's site settings.`,default:`This browser hasn't been asked yet.`,unsupported:`This browser doesn't support notifications.`,"request-error":`The browser couldn't finish the request. Try again.`},LZe={enabled:`On for this paired device.`,disabled:`Off. Turn on to hear from Po when the app is closed.`,denied:`Notifications are blocked in this browser.`,unsupported:`Not available in this browser. On iPhone, add Po to your Home Screen first.`,error:`Po couldn't update the alert subscription. Try again.`};function RZe(){let[e,t]=(0,V.useState)(Jt),[n,r]=(0,V.useState)(`disabled`);(0,V.useEffect)(()=>{Ige().then(r)},[]);let i=async()=>{r(await Lge()),t(Jt())},a=async()=>{r(await Rge())},o=async()=>{t(await Yt())};return(0,H.jsxs)(U4,{"data-testid":`notification-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Notifications`}),(0,H.jsx)(K4,{children:`An open page shows the full notification. When Po is closed you get a short alert with no session content, and alerts missed while offline are not replayed.`})]}),(0,H.jsxs)(Z4,{children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`Browser notifications`}),(0,H.jsx)(n3,{"data-testid":`notification-permission-status`,children:IZe[e]})]}),e==="default"?(0,H.jsx)(Z,{size:`sm`,variant:`outline`,"data-testid":`browser-notification-request`,onClick:()=>void o(),children:`Allow`}):null]}),(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`Alerts when Po is closed`}),(0,H.jsx)(n3,{"data-testid":`push-subscription-status`,children:LZe[n]})]}),n===`enabled`?(0,H.jsx)(Z,{size:`sm`,variant:`outline`,"data-testid":`push-disable`,onClick:()=>void a(),children:`Turn off`}):n!==`denied`&&n!==`unsupported`?(0,H.jsx)(Z,{size:`sm`,"data-testid":`notification-permission-request`,onClick:()=>void i(),children:`Turn on`}):null]})]})]})}function Z3(e,t){return`${String(e)} ${t}${e===1?``:`s`}`}function zZe(e,t){if(e.layers.length===0)return`Only the ${String(t)} Po plugins every preset includes`;let n=e.layers.reduce((e,t)=>e+t.packages.length,0);return`${Z3(e.layers.length,`layer`)}, ${Z3(n,`Po plugin`)} on top of the ${String(t)} always included`}function BZe(){let[e,t,n]=gL(`presets/view`,void 0),[r,i]=gL(`presets/selected`,void 0),[a,o]=gL(`presets/error`,void 0),[s,c,l]=gL(`presets/busy`,!1),u=(e=()=>!1)=>{jj().then(r=>{e()||l.state||n.state!==void 0||(r.ok?(t(r.presets),o(void 0)):o(r.error))})};(0,V.useEffect)(()=>{if(n.state!==void 0)return;let e=!1;return u(()=>e),()=>{e=!0}},[n,l,t,o]);let d=async e=>{if(l.state)return;c(!0);let n;try{n=await Mj({defaultPreset:e})}finally{c(!1)}n.ok?(t(n.presets),o(void 0)):o(n.error)},f=e?.presets.find(e=>e.name===r)??e?.presets.find(t=>t.name===e.defaultPreset)??e?.presets[0];return(0,H.jsxs)(U4,{"data-testid":`preset-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Presets`}),(0,H.jsxs)(K4,{children:[`A preset is a major mode: the Po plugins a session starts with. A session runs one preset, and new sessions start with the default. Your presets come from `,(0,H.jsx)(`code`,{className:`font-mono`,children:`~/.po/modes.yaml`}),`; a repository can pick its own in Workspaces.`]})]}),e===void 0&&a!==void 0?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{"data-testid":`preset-settings-error`,title:a,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't read your presets just now`}),(0,H.jsx)(n3,{children:`Nothing has changed. New sessions start as they did before.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>u(),children:`Try again`})]})}):null,e!==void 0&&a!==void 0?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`preset-settings-error`,className:`text-sm leading-relaxed text-po-red`,children:a}):null,e===void 0&&a===void 0?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading presets`}),(0,H.jsx)(Lq,{className:`h-4 w-48`}),(0,H.jsx)(Lq,{className:`h-4 w-72`})]}):null,e===void 0?null:(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Presets`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim tabular-nums`,children:Z3(e.presets.length,`preset`)})]}),e.presets.length===0?(0,H.jsx)(Z4,{children:(0,H.jsx)(Q4,{"data-testid":`preset-settings-empty`,children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No presets yet`}),(0,H.jsxs)(n3,{children:[`Run `,(0,H.jsx)(`code`,{className:`font-mono`,children:`po init`}),` to write the starter presets into`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`~/.po/modes.yaml`}),`.`]})]})})}):(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{children:e.presets.map(t=>{let n=t.name===e.defaultPreset,r=t.name===f?.name;return(0,H.jsx)(Q4,{asChild:!0,className:r?`bg-po-deep`:void 0,children:(0,H.jsxs)(`li`,{"data-testid":`preset-${t.name}`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-current":r?`true`:void 0,onClick:()=>i(t.name),className:`min-w-0 flex-1 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-po-green`,children:(0,H.jsxs)(e3,{children:[(0,H.jsxs)(t3,{className:`flex items-center gap-2 first-letter:normal-case`,children:[(0,H.jsx)(`span`,{className:`font-mono`,children:t.name}),n?(0,H.jsx)(XK,{tone:`green`,children:`Default`}):null]}),t.description?(0,H.jsx)(n3,{children:t.description}):null,(0,H.jsx)(n3,{children:zZe(t,e.alwaysIncluded.length)})]})}),(0,H.jsxs)(hq,{children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"aria-label":`Actions for ${t.name}`,"data-testid":`preset-actions-${t.name}`,children:(0,H.jsx)($L,{"aria-hidden":!0,className:`size-4`})})}),(0,H.jsx)(vq,{align:`end`,children:(0,H.jsx)(bq,{disabled:n||s,"data-testid":`preset-make-default-${t.name}`,onSelect:()=>void d(t.name),children:`Make default`})})]})]})},t.name)})})})]}),e===void 0||f===void 0?null:(0,H.jsxs)(q4,{children:[(0,H.jsx)(J4,{children:(0,H.jsxs)(Y4,{children:[`In `,(0,H.jsx)(`span`,{className:`font-mono`,children:f.name})]})}),(0,H.jsx)(X4,{children:`Its layers load in this order, each with the Po plugins it bundles.`}),(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{"data-testid":`preset-layers`,children:f.layers.length>0?f.layers.map(e=>(0,H.jsx)(Q4,{asChild:!0,children:(0,H.jsxs)(`li`,{children:[(0,H.jsx)(e3,{children:(0,H.jsx)(t3,{className:`font-mono first-letter:normal-case`,children:e.name})}),(0,H.jsx)(`span`,{className:`flex flex-wrap justify-end gap-1.5`,children:e.packages.map(e=>(0,H.jsx)(XK,{className:`font-mono`,children:e},e))})]})},e.name)):(0,H.jsx)(Q4,{asChild:!0,children:(0,H.jsx)(`li`,{children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No layers`}),(0,H.jsx)(n3,{children:`Sessions on this preset get only the Po plugins every preset includes.`})]})})})})})]}),e===void 0||e.alwaysIncluded.length===0?null:(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Always included`}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim tabular-nums`,children:Z3(e.alwaysIncluded.length,`Po plugin`)})]}),(0,H.jsx)(X4,{children:`Every preset starts with these.`}),(0,H.jsx)(Z4,{className:`p-4`,children:(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.alwaysIncluded.map(e=>(0,H.jsx)(XK,{className:`font-mono`,children:e},e))})})]})]})}var VZe={anthropic:[`M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z`],aws:[`M6.763 11.212c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 01-.208.072c-.08 0-.16-.04-.239-.112a2.47 2.47 0 01-.287-.375 6.18 6.18 0 01-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.67 0-1.205-.191-1.596-.574-.39-.384-.59-.894-.59-1.533 0-.678.24-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272-.09.04-.184.075-.28.104a.488.488 0 01-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 01.224-.167 4.577 4.577 0 011.005-.36 4.84 4.84 0 011.246-.151c.95 0 1.644.216 2.091.647.44.43.662 1.085.662 1.963v2.586h.016zm-3.24 1.214c.263 0 .534-.048.822-.144a1.78 1.78 0 00.758-.51 1.27 1.27 0 00.272-.512c.047-.191.08-.423.08-.694v-.335a6.66 6.66 0 00-.735-.136 6.02 6.02 0 00-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.655.295.846.191.2.47.296.838.296zm6.41.862c-.144 0-.24-.024-.304-.08-.064-.048-.12-.16-.168-.311L7.586 6.726a1.398 1.398 0 01-.072-.32c0-.128.064-.2.191-.2h.783c.151 0 .255.025.31.08.065.048.113.16.16.312l1.342 5.284 1.245-5.284c.04-.16.088-.264.151-.312a.549.549 0 01.32-.08h.638c.152 0 .256.025.32.08.063.048.12.16.151.312l1.261 5.348 1.381-5.348c.048-.16.104-.264.16-.312a.52.52 0 01.311-.08h.743c.127 0 .2.065.2.2 0 .04-.009.08-.017.128a1.137 1.137 0 01-.056.2l-1.923 6.17c-.048.16-.104.263-.168.311a.51.51 0 01-.303.08h-.687c-.15 0-.255-.024-.32-.08-.063-.056-.119-.16-.15-.32L12.32 7.747l-1.23 5.14c-.04.16-.087.264-.15.32-.065.056-.177.08-.32.08l-.686.001zm10.256.215c-.415 0-.83-.048-1.229-.143-.399-.096-.71-.2-.918-.32-.128-.071-.215-.151-.247-.223a.563.563 0 01-.048-.224v-.407c0-.167.064-.247.183-.247.048 0 .096.008.144.024.048.016.12.048.2.08.271.12.566.215.878.279.32.064.63.096.95.096.502 0 .894-.088 1.165-.264a.86.86 0 00.415-.758.777.777 0 00-.215-.559c-.144-.151-.416-.287-.807-.415l-1.157-.36c-.583-.183-1.014-.454-1.277-.813a1.902 1.902 0 01-.4-1.158c0-.335.073-.63.216-.886.144-.255.335-.479.575-.654.24-.184.51-.32.83-.415.32-.096.655-.136 1.006-.136.175 0 .36.008.535.032.183.024.35.056.518.088.16.04.312.08.455.127.144.048.256.096.336.144a.69.69 0 01.24.2.43.43 0 01.071.263v.375c0 .168-.064.256-.184.256a.83.83 0 01-.303-.096 3.652 3.652 0 00-1.532-.311c-.455 0-.815.071-1.062.223-.248.152-.375.383-.375.71 0 .224.08.416.24.567.16.152.454.304.877.44l1.134.358c.574.184.99.44 1.237.767.247.327.367.702.367 1.117 0 .343-.072.655-.207.926a2.157 2.157 0 01-.583.703c-.248.2-.543.343-.886.447-.36.111-.734.167-1.142.167z`,`M.378 15.475c3.384 1.963 7.56 3.153 11.877 3.153 2.914 0 6.114-.607 9.06-1.852.44-.2.814.287.383.607-2.626 1.94-6.442 2.969-9.722 2.969-4.598 0-8.74-1.7-11.87-4.526-.247-.223-.024-.527.272-.351zm23.531-.2c.287.36-.08 2.826-1.485 4.007-.215.184-.423.088-.327-.151l.175-.439c.343-.88.802-2.198.52-2.555-.336-.43-2.22-.207-3.074-.103-.255.032-.295-.192-.063-.36 1.5-1.053 3.967-.75 4.254-.399z`],azure:[{d:`M18.397 15.296H7.4a.51.51 0 00-.347.882l7.066 6.595c.206.192.477.298.758.298h6.226l-2.706-7.775z`,opacity:.75},{d:`M8.295.857c-.477 0-.9.304-1.053.756L.495 21.605a1.11 1.11 0 001.052 1.466h5.43c.477 0 .9-.304 1.053-.755l1.341-3.975-2.318-2.163a.51.51 0 01.347-.882h3L15.271.857H8.295z`,opacity:.5},`M17.193 1.613a1.11 1.11 0 00-1.052-.756h-7.81.035c.477 0 .9.304 1.052.756l6.748 19.992a1.11 1.11 0 01-1.052 1.466h-.12 7.895a1.11 1.11 0 001.052-1.466L17.193 1.613z`],baseten:[`M2.316 4.8h14.682v4.8H7.31a.302.302 0 00-.308.3v4.2c0 .171.14.3.308.3h9.688v4.8h-4.686a.302.302 0 00-.308.3v4.2c0 .171.141.3.308.3h4.378a.297.297 0 00.308-.3v-4.5h4.694a.302.302 0 00.308-.3v-4.2c0-.171-.14-.3-.308-.3h-4.694V9.6h4.694A.302.302 0 0022 9.3V5.1c0-.171-.14-.3-.308-.3h-4.694V.3c0-.171-.14-.3-.308-.3H2.316A.31.31 0 002 .3v4.2c0 .171.14.3.316.3z`],cerebras:[`M14.121 2.701a9.299 9.299 0 000 18.598V22.7c-5.91 0-10.7-4.791-10.7-10.701S8.21 1.299 14.12 1.299V2.7zm4.752 3.677A7.353 7.353 0 109.42 17.643l-.901 1.074a8.754 8.754 0 01-1.08-12.334 8.755 8.755 0 0112.335-1.08l-.901 1.075zm-2.255.844a5.407 5.407 0 00-5.048 9.563l-.656 1.24a6.81 6.81 0 016.358-12.043l-.654 1.24zM14.12 8.539a3.46 3.46 0 100 6.922v1.402a4.863 4.863 0 010-9.726v1.402z`,`M15.407 10.836a2.24 2.24 0 00-.51-.409 1.084 1.084 0 00-.544-.152c-.255 0-.483.047-.684.14a1.58 1.58 0 00-.84.912c-.074.203-.11.416-.11.631 0 .218.036.43.11.631a1.594 1.594 0 00.84.913c.2.093.43.14.684.14.216 0 .417-.046.602-.135.188-.09.35-.225.475-.392l.928 1.006c-.14.14-.3.261-.482.363a3.367 3.367 0 01-1.083.38c-.17.026-.317.04-.44.04a3.315 3.315 0 01-1.182-.21 2.825 2.825 0 01-.961-.597 2.816 2.816 0 01-.644-.929 2.987 2.987 0 01-.238-1.21c0-.444.08-.847.238-1.21.15-.35.368-.666.643-.929.278-.261.605-.464.962-.596a3.315 3.315 0 011.182-.21c.355 0 .712.068 1.072.204.361.138.685.36.944.649l-.962.97z`],claude:[`M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z`],cloudflare:[`M16.493 17.4c.135-.52.08-.983-.161-1.338-.215-.328-.592-.519-1.05-.519l-8.663-.109a.148.148 0 01-.135-.082c-.027-.054-.027-.109-.027-.163.027-.082.108-.164.189-.164l8.744-.11c1.05-.054 2.153-.9 2.556-1.937l.511-1.31c.027-.055.027-.11.027-.164C17.92 8.91 15.66 7 12.942 7c-2.503 0-4.628 1.638-5.381 3.903a2.432 2.432 0 00-1.803-.491c-1.21.109-2.153 1.092-2.287 2.32-.027.328 0 .628.054.9C1.56 13.688 0 15.326 0 17.319c0 .19.027.355.027.545 0 .082.08.137.161.137h15.983c.08 0 .188-.055.215-.164l.107-.437`,`M19.238 11.75h-.242c-.054 0-.108.054-.135.109l-.35 1.2c-.134.52-.08.983.162 1.338.215.328.592.518 1.05.518l1.855.11c.054 0 .108.027.135.082.027.054.027.109.027.163-.027.082-.108.164-.188.164l-1.91.11c-1.05.054-2.153.9-2.557 1.937l-.134.355c-.027.055.026.137.107.137h6.592c.081 0 .162-.055.162-.137.107-.41.188-.846.188-1.31-.027-2.62-2.153-4.777-4.762-4.777`],deepseek:[`M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z`],fireworks:[`M14.8 5l-2.801 6.795L9.195 5H7.397l3.072 7.428a1.64 1.64 0 003.038.002L16.598 5H14.8zm1.196 10.352l5.124-5.244-.699-1.669-5.596 5.739a1.664 1.664 0 00-.343 1.807 1.642 1.642 0 001.516 1.012L16 17l8-.02-.699-1.669-7.303.041h-.002zM2.88 10.104l.699-1.669 5.596 5.739c.468.479.603 1.189.343 1.807a1.643 1.643 0 01-1.516 1.012l-8-.018-.002.002.699-1.669 7.303.042-5.122-5.246z`],githubcopilot:[`M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z`],google:[`M23 12.245c0-.905-.075-1.565-.236-2.25h-10.54v4.083h6.186c-.124 1.014-.797 2.542-2.294 3.569l-.021.136 3.332 2.53.23.022C21.779 18.417 23 15.593 23 12.245z`,`M12.225 23c3.03 0 5.574-.978 7.433-2.665l-3.542-2.688c-.948.648-2.22 1.1-3.891 1.1a6.745 6.745 0 01-6.386-4.572l-.132.011-3.465 2.628-.045.124C4.043 20.531 7.835 23 12.225 23z`,`M5.84 14.175A6.65 6.65 0 015.463 12c0-.758.138-1.491.361-2.175l-.006-.147-3.508-2.67-.115.054A10.831 10.831 0 001 12c0 1.772.436 3.447 1.197 4.938l3.642-2.763z`,`M12.225 5.253c2.108 0 3.529.892 4.34 1.638l3.167-3.031C17.787 2.088 15.255 1 12.225 1 7.834 1 4.043 3.469 2.197 7.062l3.63 2.763a6.77 6.77 0 016.398-4.572z`],groq:[`M12.036 2c-3.853-.035-7 3-7.036 6.781-.035 3.782 3.055 6.872 6.908 6.907h2.42v-2.566h-2.292c-2.407.028-4.38-1.866-4.408-4.23-.029-2.362 1.901-4.298 4.308-4.326h.1c2.407 0 4.358 1.915 4.365 4.278v6.305c0 2.342-1.944 4.25-4.323 4.279a4.375 4.375 0 01-3.033-1.252l-1.851 1.818A7 7 0 0012.029 22h.092c3.803-.056 6.858-3.083 6.879-6.816v-6.5C18.907 4.963 15.817 2 12.036 2z`],huggingface:[`M16.781 3.277c2.997 1.704 4.844 4.851 4.844 8.258 0 .995-.155 1.955-.443 2.857a1.332 1.332 0 011.125.4 1.41 1.41 0 01.2 1.723c.204.165.352.385.428.632l.017.062c.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.255.57-.893 1.018-2.128 1.5l-.202.078-.131.048c-.478.173-.89.295-1.061.345l-.086.024c-.89.243-1.808.375-2.732.394-1.32 0-2.3-.36-2.923-1.067a9.852 9.852 0 01-3.18.018C9.778 21.647 8.802 22 7.494 22a11.249 11.249 0 01-2.541-.343l-.221-.06-.273-.08a16.574 16.574 0 01-1.175-.405c-1.237-.483-1.875-.93-2.13-1.501-.186-.4-.151-.867.093-1.236a1.42 1.42 0 01-.2-1.166c.069-.273.226-.516.447-.694a1.41 1.41 0 01.2-1.722c.233-.248.557-.391.917-.407l.078-.001a9.385 9.385 0 01-.44-2.85c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0zM4.188 14.758c.125.687 2.357 2.35 2.14 2.707-.19.315-.796-.239-.948-.386l-.041-.04-.168-.147c-.561-.479-2.304-1.9-2.74-1.432-.43.46.119.859 1.055 1.42l.784.467.136.083c1.045.643 1.12.84.95 1.113-.188.295-3.07-2.1-3.34-1.083-.27 1.011 2.942 1.304 2.744 2.006-.2.7-2.265-1.324-2.685-.537-.425.79 2.913 1.718 2.94 1.725l.16.04.175.042c1.227.284 3.565.65 4.435-.604.673-.973.64-1.709-.248-2.61l-.057-.057c-.945-.928-1.495-2.288-1.495-2.288l-.017-.058-.025-.072c-.082-.22-.284-.639-.63-.584-.46.073-.798 1.21.12 1.933l.05.038c.977.721-.195 1.21-.573.534l-.058-.104-.143-.25c-.463-.799-1.282-2.111-1.739-2.397-.532-.332-.907-.148-.782.541zm14.842-.541c-.533.335-1.563 2.074-1.94 2.751a.613.613 0 01-.687.302.436.436 0 01-.176-.098.303.303 0 01-.049-.06l-.014-.028-.008-.02-.007-.019-.003-.013-.003-.017a.289.289 0 01-.004-.048c0-.12.071-.266.25-.427.026-.024.054-.047.084-.07l.047-.036c.022-.016.043-.032.063-.049.883-.71.573-1.81.131-1.917l-.031-.006-.056-.004a.368.368 0 00-.062.006l-.028.005-.042.014-.039.017-.028.015-.028.019-.036.027-.023.02c-.173.158-.273.428-.31.542l-.016.054s-.53 1.309-1.439 2.234l-.054.054c-.365.358-.596.69-.702 1.018-.143.437-.066.868.21 1.353.055.097.117.195.187.296.882 1.275 3.282.876 4.494.59l.286-.07.25-.074c.276-.084.736-.233 1.2-.42l.188-.077.065-.028.064-.028.124-.056.081-.038c.529-.252.964-.543.994-.827l.001-.036a.299.299 0 00-.037-.139c-.094-.176-.271-.212-.491-.168l-.045.01c-.044.01-.09.024-.136.04l-.097.035-.054.022c-.559.23-1.238.705-1.607.745h.006a.452.452 0 01-.05.003h-.024l-.024-.003-.023-.005c-.068-.016-.116-.06-.14-.142a.22.22 0 01-.005-.1c.062-.345.958-.595 1.713-.91l.066-.028c.528-.224.97-.483.985-.832v-.04a.47.47 0 00-.016-.098c-.048-.18-.175-.251-.36-.251-.785 0-2.55 1.36-2.92 1.36-.025 0-.048-.007-.058-.024a.6.6 0 01-.046-.088c-.1-.238.068-.462 1.06-1.066l.209-.126c.538-.32 1.01-.588 1.341-.831.29-.212.475-.406.503-.6l.003-.028c.008-.113-.038-.227-.147-.344a.266.266 0 00-.07-.054l-.034-.015-.013-.005a.403.403 0 00-.13-.02c-.162 0-.369.07-.595.18-.637.313-1.431.952-1.826 1.285l-.249.215-.033.033c-.08.078-.288.27-.493.386l-.071.037-.041.019a.535.535 0 01-.122.036h.005a.346.346 0 01-.031.003l.01-.001-.013.001c-.079.005-.145-.021-.19-.095a.113.113 0 01-.014-.065c.027-.465 2.034-1.991 2.152-2.642l.009-.048c.1-.65-.271-.817-.791-.493zM11.938 2.984c-4.798 0-8.688 3.829-8.688 8.55 0 .692.083 1.364.24 2.008l.008-.009c.252-.298.612-.46 1.017-.46.355.008.699.117.993.312.22.14.465.384.715.694.261-.372.69-.598 1.15-.605.852 0 1.367.728 1.562 1.383l.047.105.06.127c.192.396.595 1.139 1.143 1.68 1.06 1.04 1.324 2.115.8 3.266a8.865 8.865 0 002.024-.014c-.505-1.12-.26-2.17.74-3.186l.066-.066c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-.553.718-.694a1.87 1.87 0 01.99-.312c.357 0 .682.126.925.36.14-.61.215-1.245.215-1.898 0-4.722-3.89-8.55-8.687-8.55zm1.857 8.926l.439-.212c.553-.264.89-.383.89.152 0 1.093-.771 3.208-3.155 3.262h-.184c-2.325-.052-3.116-2.06-3.156-3.175l-.001-.087c0-1.107 1.452.586 3.25.586.716 0 1.379-.272 1.917-.526zm4.017-3.143c.45 0 .813.358.813.8 0 .441-.364.8-.813.8a.806.806 0 01-.812-.8c0-.442.364-.8.812-.8zm-11.624 0c.448 0 .812.358.812.8 0 .441-.364.8-.812.8a.806.806 0 01-.813-.8c0-.442.364-.8.813-.8zm7.79-.841c.32-.384.846-.54 1.33-.394.483.146.83.564.878 1.06.048.495-.212.97-.659 1.203-.322.168-.447-.477-.767-.585l.002-.003c-.287-.098-.772.362-.925.079a1.215 1.215 0 01.14-1.36zm-4.323 0c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003c-.108.036-.194.134-.273.24l-.118.165c-.11.15-.22.262-.377.18a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394z`],kimi:[`M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z`,`M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z`],ling:[`M9.561 0.074a0.46 0.46 0 0 1 0.517 0.011l2.848 1.357a0.222 0.222 0 0 1-0.033 0.374C9.008 3.93 6.663 5.994 5.43 7.997c-0.798 1.296-2.264 4.83-0.937 8.02 1.375 3.301 4.49 4.493 6.797 4.493 1.743 0 2.927-0.522 4.13-1.334 3.262-2.204 3.638-6.503 1.21-9.46a10 10 0 0 1 2.2 2.902 6.5 6.5 0 0 0-0.72-1.664c-0.72-1.176-1.688-2.163-3.056-2.849-3.045-1.526-9.397-0.79-10.397 5.78 0.1-4.557 3.127-7.416 5.868-8.3a9.7 9.7 0 0 1 4.654-0.314c2.029-1.639 4.272-2.376 5.075-2.601a0.53 0.53 0 0 1 0.522 0.137c0.23 0.23 0.63 0.632 1.142 1.135h0.003c0.152 0.15 0.073 0.41-0.138 0.45-1.974 0.38-3.322 0.755-4.746 1.412 1.727 0.698 3.206 1.92 4.108 3.606a0.367 0.367 0 0 1-0.199 0.52l-1.207 0.437c1.061 1.8 1.334 4.006 0.813 6.266-0.884 3.843-3.845 6.562-7.626 7.209a9.5 9.5 0 0 1-1.756 0.157 0.37 0.37 0 0 1-0.363-0.341 0.36 0.36 0 0 1-0.043-0.245l0.231-1.295c-1.055-0.074-2.045-0.248-3.036-0.648C2.077 19.094 1.46 13.297 2.304 9.785 3.4 5.23 6.766 1.78 9.561 0.074`],meta:[`M6.897 4c1.915 0 3.516.932 5.43 3.376l.282-.373c.19-.246.383-.484.58-.71l.313-.35C14.588 4.788 15.792 4 17.225 4c1.273 0 2.469.557 3.491 1.516l.218.213c1.73 1.765 2.917 4.71 3.053 8.026l.011.392.002.25c0 1.501-.28 2.759-.818 3.7l-.14.23-.108.153c-.301.42-.664.758-1.086 1.009l-.265.142-.087.04a3.493 3.493 0 01-.302.118 4.117 4.117 0 01-1.33.208c-.524 0-.996-.067-1.438-.215-.614-.204-1.163-.56-1.726-1.116l-.227-.235c-.753-.812-1.534-1.976-2.493-3.586l-1.43-2.41-.544-.895-1.766 3.13-.343.592C7.597 19.156 6.227 20 4.356 20c-1.21 0-2.205-.42-2.936-1.182l-.168-.184c-.484-.573-.837-1.311-1.043-2.189l-.067-.32a8.69 8.69 0 01-.136-1.288L0 14.468c.002-.745.06-1.49.174-2.23l.1-.573c.298-1.53.828-2.958 1.536-4.157l.209-.34c1.177-1.83 2.789-3.053 4.615-3.16L6.897 4zm-.033 2.615l-.201.01c-.83.083-1.606.673-2.252 1.577l-.138.199-.01.018c-.67 1.017-1.185 2.378-1.456 3.845l-.004.022a12.591 12.591 0 00-.207 2.254l.002.188c.004.18.017.36.04.54l.043.291c.092.503.257.908.486 1.208l.117.137c.303.323.698.492 1.17.492 1.1 0 1.796-.676 3.696-3.641l2.175-3.4.454-.701-.139-.198C9.11 7.3 8.084 6.616 6.864 6.616zm10.196-.552l-.176.007c-.635.048-1.223.359-1.82.933l-.196.198c-.439.462-.887 1.064-1.367 1.807l.266.398c.18.274.362.56.55.858l.293.475 1.396 2.335.695 1.114c.583.926 1.03 1.6 1.408 2.082l.213.262c.282.326.529.54.777.673l.102.05c.227.1.457.138.718.138.176.002.35-.023.518-.073.338-.104.61-.32.813-.637l.095-.163.077-.162c.194-.459.29-1.06.29-1.785l-.006-.449c-.08-2.871-.938-5.372-2.2-6.798l-.176-.189c-.67-.683-1.444-1.074-2.27-1.074z`],minimax:[`M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z`],mistral:[`M3.428 3.4h3.429v3.428h3.429v3.429h-.002 3.431V6.828h3.427V3.4h3.43v13.714H24v3.429H13.714v-3.428h-3.428v-3.429h-3.43v3.428h3.43v3.429H0v-3.429h3.428V3.4zm10.286 13.715h3.428v-3.429h-3.427v3.429z`],moonshot:[`M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z`],nvidia:[`M10.212 8.976V7.62c.127-.01.256-.017.388-.021 3.596-.117 5.957 3.184 5.957 3.184s-2.548 3.647-5.282 3.647a3.227 3.227 0 01-1.063-.175v-4.109c1.4.174 1.681.812 2.523 2.258l1.873-1.627a4.905 4.905 0 00-3.67-1.846 6.594 6.594 0 00-.729.044m0-4.476v2.025c.13-.01.259-.019.388-.024 5.002-.174 8.261 4.226 8.261 4.226s-3.743 4.69-7.643 4.69c-.338 0-.675-.031-1.007-.092v1.25c.278.038.558.057.838.057 3.629 0 6.253-1.91 8.794-4.169.421.347 2.146 1.193 2.501 1.564-2.416 2.083-8.048 3.763-11.24 3.763-.308 0-.603-.02-.894-.048V19.5H24v-15H10.21zm0 9.756v1.068c-3.356-.616-4.287-4.21-4.287-4.21a7.173 7.173 0 014.287-2.138v1.172h-.005a3.182 3.182 0 00-2.502 1.178s.615 2.276 2.507 2.931m-5.961-3.3c1.436-1.935 3.604-3.148 5.961-3.336V6.523C5.81 6.887 2 10.723 2 10.723s2.158 6.427 8.21 7.015v-1.166C5.77 16 4.25 10.958 4.25 10.958h-.002z`],openai:[`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`],opencode:[`M16 6H8v12h8V6zm4 16H4V2h16v20z`],openrouter:[`M18.654 3.87a5.087 5.087 0 110 10.174L23.7 19.09c.64.641.187 1.737-.72 1.737H8.48a8.479 8.479 0 010-16.958h10.175zM8.479 7.26a5.087 5.087 0 100 10.176 5.087 5.087 0 000-10.175z`],qwen:[`M19.713 2.825h-5.907c0-.251-.066-.503-.196-.728L12.819.728A1.46 1.46 0 0 0 11.559 0h-1.58c-.52 0-1 .275-1.26.728l-2.42 4.19a1.45 1.45 0 0 0 0 1.453l.791 1.37c.26.448.74.727 1.26.727h11.36c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-.79-1.37a1.46 1.46 0 0 0-1.26-.728zM.195 9.905l2.951 5.115a1.46 1.46 0 0 0-.531.531l-.791 1.37a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h4.84c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451L5.086 7.083a1.46 1.46 0 0 0-1.26-.728h-1.58c-.52 0-1 .276-1.26.728l-.79 1.37a1.45 1.45 0 0 0 0 1.452m15.888 13.367 2.951-5.115c.217.125.469.196.728.196h1.582c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-2.42-4.191a1.46 1.46 0 0 0-1.259-.728h-1.582c-.52 0-1 .276-1.259.728l-5.678 9.838a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h1.582c.52 0 1-.275 1.26-.728z`],together:[`M23.197 4.503A6 6 0 0015 2.307a5.973 5.973 0 00-2.995 4.933l5.996.008v.515h-5.996c.039.937.298 1.87.8 2.74a6 6 0 1010.39-6z`,`M.805 4.5A6 6 0 003 12.697a5.972 5.972 0 005.77.127L5.779 7.627l.446-.257 2.997 5.192A6 6 0 10.804 4.5z`,`M12 23.894a6 6 0 005.999-6c0-2.13-1.1-3.996-2.775-5.06l-3.005 5.189-.444-.258 2.997-5.192A6 6 0 1012 23.894z`],typesafeai:[`M16.512 2.928L16.512 7.067 20.242 9.487 20.243 18.652 12 24 7.489 21.073 7.489 16.82 3.756 14.399 3.756 5.35 4.111 5.118 12 0ZM9.697 20.65L11.998 22.144 18.032 18.227 15.732 16.735ZM12.779 10.332L12.779 14.4 9.046 16.822 9.046 19.216 14.953 15.383 14.953 8.921ZM16.512 15.384L18.684 16.794 18.684 10.332 16.512 8.922ZM5.966 13.976L8.268 15.47 10.569 13.976 8.268 12.485ZM5.316 6.193L5.316 12.544 7.487 11.134 7.487 7.066 11.221 4.643 11.221 2.36 5.316 6.193ZM9.047 11.132L11.22 12.542 11.22 10.332 9.049 8.921 9.049 11.132ZM9.697 7.487L12 8.981 14.3 7.488 12 5.994ZM12.78 4.643L14.953 6.054 14.953 3.774 12.78 2.359Z`],vercel:[`M12 0l12 20.785H0L12 0z`],vertexai:[`M11.995 20.216a1.892 1.892 0 100 3.785 1.892 1.892 0 000-3.785zm0 2.806a.927.927 0 11.927-.914.914.914 0 01-.927.914z`,`M21.687 14.144c.237.038.452.16.605.344a.978.978 0 01-.18 1.3l-8.24 6.082a1.892 1.892 0 00-1.147-1.508l8.28-6.08a.991.991 0 01.682-.138z`,`M10.122 21.842l-8.217-6.066a.952.952 0 01-.206-1.287.978.978 0 011.287-.206l8.28 6.08a1.893 1.893 0 00-1.144 1.479z`,`M4.273 4.475a.978.978 0 01-.965-.965V1.09a.978.978 0 111.943 0v2.42a.978.978 0 01-.978.965zM4.247 13.034a.978.978 0 100-1.956.978.978 0 000 1.956zM4.247 10.19a.978.978 0 100-1.956.978.978 0 000 1.956zM4.247 7.332a.978.978 0 100-1.956.978.978 0 000 1.956z`,`M19.718 7.307a.978.978 0 01-.965-.979v-2.42a.965.965 0 011.93 0v2.42a.964.964 0 01-.965.979zM19.743 13.047a.978.978 0 100-1.956.978.978 0 000 1.956zM19.743 10.151a.978.978 0 100-1.956.978.978 0 000 1.956zM19.743 2.068a.978.978 0 100-1.956.978.978 0 000 1.956z`,`M11.995 15.917a.978.978 0 01-.965-.965v-2.459a.978.978 0 011.943 0v2.433a.976.976 0 01-.978.991zM11.995 18.762a.978.978 0 100-1.956.978.978 0 000 1.956zM11.995 10.64a.978.978 0 100-1.956.978.978 0 000 1.956zM11.995 7.783a.978.978 0 100-1.956.978.978 0 000 1.956z`,`M15.856 10.177a.978.978 0 01-.965-.965v-2.42a.977.977 0 011.702-.763.979.979 0 01.241.763v2.42a.978.978 0 01-.978.965zM15.869 4.913a.978.978 0 100-1.956.978.978 0 000 1.956zM15.869 15.853a.978.978 0 100-1.956.978.978 0 000 1.956zM15.869 12.996a.978.978 0 100-1.956.978.978 0 000 1.956z`,`M8.121 15.853a.978.978 0 100-1.956.978.978 0 000 1.956zM8.121 7.783a.978.978 0 100-1.956.978.978 0 000 1.956zM8.121 4.913a.978.978 0 100-1.957.978.978 0 000 1.957zM8.134 12.996a.978.978 0 01-.978-.94V9.611a.965.965 0 011.93 0v2.445a.966.966 0 01-.952.94z`],xai:[`M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z`],xiaomimimo:[`M.958 15.936a.459.459 0 01.459.44v2.729a.46.46 0 01-.918 0v-2.729a.459.459 0 01.459-.44zm4.814-2.035a.46.46 0 01.553.45v4.754a.458.458 0 11-.918 0V15.48L3.74 17.202a.462.462 0 01-.655.016.462.462 0 01-.065-.082L.628 14.67a.459.459 0 01.658-.637l2.124 2.187 2.127-2.188a.46.46 0 01.235-.13zm2.068.004a.46.46 0 01.458.445v4.755a.46.46 0 01-.458.458.459.459 0 01-.458-.458V14.35a.459.459 0 01.458-.445zm1.973 2.014a.46.46 0 01.46.457v2.729a.46.46 0 01-.784.324.46.46 0 01-.134-.324v-2.729a.46.46 0 01.458-.458zm.002-2.045a.458.458 0 01.328.157l2.127 2.19 2.125-2.19a.459.459 0 01.784.318v4.756a.46.46 0 01-.455.458.46.46 0 01-.458-.458V15.48l-1.667 1.723a.46.46 0 01-.65.008l-.005-.005c0-.002-.002-.002-.004-.003l-2.455-2.534a.46.46 0 01-.008-.667.461.461 0 01.338-.128zm6.797 1.206a.46.46 0 01.53.651A1.966 1.966 0 0019.81 18.4a.462.462 0 01.623.18.46.46 0 01-.181.624 2.863 2.863 0 01-1.38.353l-.142-.004a2.88 2.88 0 01-2.393-4.263.461.461 0 01.274-.21zm.864-.931a2.884 2.884 0 013.915 3.914.46.46 0 01-.402.24l-.057-.004a.458.458 0 01-.164-.055.46.46 0 01-.182-.622 1.967 1.967 0 00-2.669-2.67.459.459 0 11-.441-.803zM9.59 6.368c1.481 0 1.696 1.202 1.696 1.654v2.648h-.917v-.432c-.26.346-.792.535-1.36.535-.133 0-1.289-.03-1.384-1.136-.082-.932.675-1.61 2.053-1.61h.691c0-.563-.367-.886-.983-.886-.44.013-.864.174-1.2.458l-.36-.664c.484-.379 1.012-.567 1.764-.567zm4.427.1c1.263 0 2.082.97 2.083 2.15 0 1.181-.824 2.154-2.083 2.154-1.26 0-2.084-.972-2.084-2.152 0-1.18.82-2.153 2.084-2.153zm6.801.015c.68 0 1.202.465 1.197 1.548v2.642H21.1V8.29c0-.312-.002-.98-.63-.98s-.628.667-.628.838v2.524h-.89V8.148c0-.17-.001-.838-.63-.838-.628 0-.628.668-.628.98v2.383h-.917v-4.03h.917V7a1.22 1.22 0 01.947-.516c.398 0 .76.193.982.686a1.321 1.321 0 011.195-.686zm-18.093.872l1.457-1.772H5.32L3.311 8.07l2.14 2.602H4.24L2.725 8.796 1.21 10.672H0L2.138 8.07.13 5.583h1.138l1.458 1.772zm4.149 3.317h-.916V6.644h.916v4.028zm16.99 0h-.916V6.644h.916v4.028zM9.925 8.71c-1.055 0-1.359.412-1.326.742.032.329.324.537.757.537a1.013 1.013 0 001.014-.968l.002-.31h-.447zM14.018 7.3c-.663 0-1.184.487-1.184 1.32 0 .832.52 1.32 1.184 1.32.662 0 1.182-.49 1.182-1.32 0-.832-.52-1.32-1.182-1.32zM6.417 5.001a.568.568 0 01.587.582.588.588 0 01-1.175 0A.57.57 0 016.417 5zm16.991 0a.57.57 0 01.592.582.588.588 0 01-1.174 0 .57.57 0 01.357-.542.572.572 0 01.225-.04z`],zai:[`M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z`]},HZe={"amazon-bedrock":`aws`,"ant-ling":`ling`,anthropic:`anthropic`,azure:`azure`,"azure-openai-responses":`azure`,baseten:`baseten`,cerebras:`cerebras`,"claude-bridge":`claude`,"cloudflare-ai-gateway":`cloudflare`,"cloudflare-workers-ai":`cloudflare`,deepseek:`deepseek`,fireworks:`fireworks`,"github-copilot":`githubcopilot`,google:`google`,"google-vertex":`vertexai`,groq:`groq`,huggingface:`huggingface`,"kimi-coding":`kimi`,meta:`meta`,minimax:`minimax`,"minimax-cn":`minimax`,mistral:`mistral`,moonshotai:`moonshot`,"moonshotai-cn":`moonshot`,nvidia:`nvidia`,openai:`openai`,"openai-codex":`openai`,opencode:`opencode`,"opencode-go":`opencode`,openrouter:`openrouter`,"po-chatgpt":`openai`,"qwen-token-plan":`qwen`,"qwen-token-plan-cn":`qwen`,"qwen-token-plan-individual":`qwen`,together:`together`,typesafe:`typesafeai`,"vercel-ai-gateway":`vercel`,xai:`xai`,xiaomi:`xiaomimimo`,"xiaomi-token-plan-ams":`xiaomimimo`,"xiaomi-token-plan-cn":`xiaomimimo`,"xiaomi-token-plan-sgp":`xiaomimimo`,zai:`zai`,"zai-coding-cn":`zai`};function UZe(e){let[t=`?`,n]=e.match(/[A-Za-z0-9]+/g)??[];return(n?t.charAt(0)+n.charAt(0):t.slice(0,2)).toUpperCase()}function WZe({id:e,name:t,className:n}){let r=VZe[HZe[e]??``];return(0,H.jsx)(`span`,{"aria-hidden":!0,className:J(`flex size-10 shrink-0 items-center justify-center rounded-lg border border-po-border-soft bg-po-deep text-po-hi`,n),children:r?(0,H.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,className:`size-5`,children:r.map(e=>typeof e==`string`?(0,H.jsx)(`path`,{d:e},e):(0,H.jsx)(`path`,{d:e.d,fillOpacity:e.opacity},e.d))}):(0,H.jsx)(`span`,{className:`text-sm font-semibold`,children:UZe(t)})})}var GZe=`stored`,KZe={oauth:`Sign in`,api_key:`Add API key`},qZe={oauth:`OAuth`,api_key:`an API key`};function JZe({type:e,source:t}){return t===GZe?(0,H.jsxs)(H.Fragment,{children:[`Signed in with `,qZe[e],`, saved on this machine`]}):t?(0,H.jsxs)(H.Fragment,{children:[`Using the key in `,(0,H.jsx)(`code`,{className:`font-mono text-po-hi`,children:t})]}):(0,H.jsxs)(H.Fragment,{children:[`Signed in with `,qZe[e]]})}function YZe({provider:e,busy:t,onLogout:n}){let r=e.authenticated;return r?(0,H.jsx)(Q4,{asChild:!0,className:`gap-x-4 py-4`,children:(0,H.jsxs)(`li`,{"data-testid":`provider-${e.id}`,"data-authenticated":!0,children:[(0,H.jsx)(WZe,{id:e.id,name:e.name}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-56 flex-col gap-1.5`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.name}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,H.jsxs)(XK,{tone:`green`,className:`rounded-full border-po-edge-green bg-po-tint-green px-2.5 font-medium`,children:[(0,H.jsx)(GK,{tone:`green`}),`Connected`]}),(0,H.jsx)(`span`,{"aria-hidden":!0,className:`hidden h-4 w-px bg-po-border sm:block`}),(0,H.jsx)(`span`,{"data-testid":`provider-status-${e.id}`,className:`min-w-0 break-words text-sm text-po-dim`,children:(0,H.jsx)(JZe,{...r})})]})]}),r.source===GZe?(0,H.jsx)(Z,{variant:`outline`,size:`sm`,"data-testid":`provider-logout-${e.id}`,disabled:t,onClick:n,children:`Sign out`}):r.source?(0,H.jsx)(`span`,{className:`shrink-0 text-sm text-po-dim`,children:`Set by your environment`}):null]})}):null}function XZe({provider:e,busy:t,onLogin:n}){return(0,H.jsx)(Q4,{asChild:!0,className:`gap-x-4 py-3`,children:(0,H.jsxs)(`li`,{"data-testid":`provider-${e.id}`,"data-authenticated":!1,children:[(0,H.jsx)(WZe,{id:e.id,name:e.name}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-40 flex-col`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.name}),(0,H.jsx)(`span`,{className:`truncate font-mono text-sm text-po-dim`,children:e.id}),(0,H.jsx)(`span`,{"data-testid":`provider-status-${e.id}`,className:`sr-only`,children:`Not connected`})]}),(0,H.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:e.methods.length===0?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`Reads credentials from your environment`}):e.methods.map(r=>(0,H.jsx)(Z,{variant:`outline`,size:`sm`,"data-testid":`provider-login-${r.type}-${e.id}`,title:r.label,disabled:t,onClick:()=>n(r.type),children:KZe[r.type]},r.type))})]})})}function ZZe(){let e=Qg(`providers`),t=(0,V.useSyncExternalStore)(t=>t_(e,t),()=>e_(e)),[n,r]=gL(`providers/list`,null),[i,a]=gL(`providers/error`,``),[o,s,c]=gL(`providers/flow`,null),[l,u,d]=gL(`providers/busy`,null),[f,p]=gL(`providers/filter`,``),m=(0,V.useCallback)(async()=>{let e=await Ht();`providers`in e?(r(e.providers),a(``)):a(e.error)},[r,a]);(0,V.useEffect)(()=>{m()},[m,t]);let h=o?.id,g=o?.status===`running`,_=o?.pollIntervalMs;(0,V.useEffect)(()=>{if(h===void 0||!g)return;let e=!1,t,n=async()=>{let r=await Wt(h);e||c.state?.id!==h||c.state.status!==`running`||(`error`in r?s(e=>e&&e.id===h?{...e,status:`failed`,error:r.error}:e):(s(r.flow),r.flow.status===`running`?_!==void 0&&_>0&&(t=setTimeout(()=>void n(),_)):m()))};return n(),()=>{e=!0,t!==void 0&&clearTimeout(t)}},[h,g,_,c,m,s,t]);let v=async(e,t)=>{if(d.state!==null||c.state?.status===`running`)return;u(e);let n=await Ut(e,t);u(null),`flow`in n?s(n.flow):a(n.error)},y=async(e,t)=>{if(!o||d.state!==null)return;u(o.providerId);let n=await Gt(o.id,e,t);if(u(null),`flow`in n){let e=await Wt(o.id);s(`flow`in e?e.flow:n.flow),m()}else a(n.error)},b=async()=>{if(!o||d.state!==null)return;u(o.providerId);let e=await Kt(o.id);u(null),s(`flow`in e?e.flow:null),m()},x=async e=>{if(d.state!==null)return;u(e);let t=await qt(e);`error`in t?a(t.error):await m(),u(null)},S=f.trim().toLowerCase(),C=(n??[]).filter(e=>e.kind===`po-feature`),w=(n??[]).filter(e=>e.kind!==`po-feature`),T=w.filter(e=>e.authenticated!==void 0),E=w.filter(e=>e.authenticated===void 0).filter(e=>`${e.name} ${e.id}`.toLowerCase().includes(S)),D=l!==null||g;return(0,H.jsxs)(U4,{"data-testid":`provider-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Providers`}),(0,H.jsxs)(K4,{children:[`Connect the model providers Po can work with. Sign in once and every session on this machine can use it. Credentials stay on this machine, in Pi's `,(0,H.jsx)(`code`,{className:`font-mono text-po-hi`,children:`auth.json`}),`.`]})]}),n===null&&!i?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading providers`}),(0,H.jsx)(Lq,{className:`h-4 w-40`}),(0,H.jsx)(Lq,{className:`h-4 w-64`}),(0,H.jsx)(Lq,{className:`h-4 w-52`})]}):null,n===null&&i?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{"data-testid":`provider-settings-error`,title:i,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't reach your providers just now`}),(0,H.jsx)(n3,{children:`Nothing has changed. Your sign-ins are where you left them.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>void m(),children:`Try again`})]})}):null,n&&i?(0,H.jsx)(`p`,{"data-testid":`provider-settings-error`,role:`alert`,className:`text-sm leading-relaxed text-po-red`,children:i}):null,n?.length===0?(0,H.jsx)(rJ,{"data-testid":`provider-list-empty`,className:`rounded-lg border border-dashed border-po-border py-8`,title:`No providers to connect`,description:`Pi hasn't offered any model providers on this machine yet.`}):null,n&&n.length>0?(0,H.jsxs)(H.Fragment,{children:[C.length>0?(0,H.jsxs)(q4,{"data-testid":`provider-po-features`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Po features`}),(0,H.jsx)(X4,{children:`Image generation, Web search, and Voice share one ChatGPT sign-in. It is separate from the OpenAI Codex sign-in your chat models use.`})]}),(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{children:C.map(e=>e.authenticated?(0,H.jsx)(YZe,{provider:e,busy:D,onLogout:()=>void x(e.id)},e.id):(0,H.jsx)(XZe,{provider:e,busy:D,onLogin:t=>void v(e.id,t)},e.id))})})]}):null,(0,H.jsxs)(q4,{children:[(0,H.jsx)(J4,{children:(0,H.jsx)(Y4,{children:`Connected`})}),T.length>0?(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{children:T.map(e=>(0,H.jsx)(YZe,{provider:e,busy:D,onLogout:()=>void x(e.id)},e.id))})}):(0,H.jsx)(rJ,{className:`rounded-lg border border-dashed border-po-border py-8`,title:`Nothing connected yet`,description:`Pick a provider below. Po takes it from there.`})]}),(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Available`}),(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[T.length,` of `,w.length,` connected`]})]}),(0,H.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2.5 rounded-lg border border-po-border bg-po-panel px-3.5 transition-colors focus-within:border-po-green/60`,children:[(0,H.jsx)(wR,{className:`size-4 shrink-0 text-po-faint`}),(0,H.jsx)(zq,{variant:`bare`,"data-testid":`provider-filter`,value:f,placeholder:`Search providers`,"aria-label":`Search providers`,onChange:e=>p(e.target.value),className:`flex-1`})]}),E.length>0?(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{"data-testid":`provider-list`,children:E.map(e=>(0,H.jsx)(XZe,{provider:e,busy:D,onLogin:t=>void v(e.id,t)},e.id))})}):S?(0,H.jsx)(rJ,{"data-testid":`provider-no-match`,className:`rounded-lg border border-po-border bg-po-panel py-8`,title:`No provider called “${f.trim()}”`,description:`Try the company name, like Google or Mistral.`}):(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`Every provider Po knows about is connected.`})]})]}):null,o?(0,H.jsx)(FZe,{flow:o,onAnswer:(e,t)=>void y(e,t),onCancel:()=>void b(),onClose:()=>s(null)}):null]})}var Q3=`/api/hosts`,QZe=`Quick-tunnel hosts cannot be added here. Add this host in the Po app instead.`;function $Ze(e){try{return new URL(e).hostname.toLowerCase().replace(/\.$/u,``).endsWith(`.trycloudflare.com`)}catch{return!1}}function eQe(e,t){let n=e.toLowerCase().replace(/[^a-z0-9_-]+/gu,`-`).replace(/^-+|-+$/gu,``).slice(0,72)||`host`,r=n;for(let e=2;t.some(e=>e.hostKey===r);e+=1)r=`${n}-${e}`;return r}async function $3(e){let t=await e.json().catch(()=>void 0);return typeof t?.error==`string`?t.error:`Po could not reach the host table (${e.status}).`}var tQe=(e,t)=>fetch(e,ke(e,t));function nQe({request:e=tQe}){let[t,n]=(0,V.useState)({kind:`loading`}),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(),h=(0,V.useCallback)(async()=>{n({kind:`loading`});try{let t=await e(Q3,{credentials:`same-origin`});if(!t.ok){n({kind:`error`,message:await $3(t)});return}let r=await t.json();n({kind:`ready`,hosts:r.hosts??[]})}catch(e){n({kind:`error`,message:e instanceof Error?e.message:String(e)})}},[e]);(0,V.useEffect)(()=>{h()},[h]);let g=t.kind===`ready`?t.hosts:[],_=$Ze(s.trim());async function v(){if(!(d||_)){f(!0),u(void 0);try{let t=await e(Q3,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({hostKey:eQe(a,g),origin:s.trim(),label:a.trim()})});if(!t.ok){u(await $3(t));return}i(!1),o(``),c(``),await h()}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}}}async function y(t){f(!0);try{let r=await e(`${Q3}/${encodeURIComponent(t.hostKey)}`,{method:`DELETE`,credentials:`same-origin`});if(!r.ok&&r.status!==404){n({kind:`error`,message:await $3(r)});return}m(void 0),await h()}catch(e){n({kind:`error`,message:e instanceof Error?e.message:String(e)})}finally{f(!1)}}return(0,H.jsxs)(U4,{"data-testid":`hosts-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Hosts`}),(0,H.jsx)(K4,{children:`Each host has its own connection and trusted plugins.`})]}),t.kind===`loading`?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading your hosts`}),(0,H.jsx)(Lq,{className:`h-4 w-48`}),(0,H.jsx)(Lq,{className:`h-4 w-72`})]}):t.kind===`error`?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{title:t.message,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{className:`text-po-red`,children:`Po couldn't read your hosts`}),(0,H.jsx)(n3,{children:t.message})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:`Try again`})]})}):(0,H.jsx)(Z4,{"aria-label":`Paired hosts`,children:g.length===0?(0,H.jsx)(Q4,{children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No other hosts yet`}),(0,H.jsx)(n3,{children:`Add a named-tunnel host to see its sessions here.`})]})}):g.map(e=>(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:e.label}),(0,H.jsx)(n3,{className:`break-all first-letter:normal-case`,children:new URL(e.origin).host})]}),(0,H.jsx)(Z,{variant:`danger-outline`,size:`sm`,onClick:()=>m(e),children:`Forget`})]},e.hostKey))}),r?(0,H.jsxs)(Z4,{className:`flex max-w-lg flex-col gap-4 p-5`,"data-testid":`add-host`,children:[(0,H.jsx)(`p`,{children:`Add a named-tunnel host to this cockpit. Pairing trusts its plugin code, but does not link hosts.`}),(0,H.jsx)(j$,{htmlFor:`host-label`,children:`Host label`}),(0,H.jsx)(zq,{id:`host-label`,value:a,onChange:e=>o(e.target.value)}),(0,H.jsx)(j$,{htmlFor:`host-origin`,children:`Host address`}),(0,H.jsx)(zq,{id:`host-origin`,value:s,placeholder:`https://host.example.com`,onChange:e=>c(e.target.value),"aria-invalid":_||l!==void 0,"aria-describedby":`host-help`}),(0,H.jsx)(`p`,{id:`host-help`,role:_||l!==void 0?`alert`:void 0,"data-denied":_||l!==void 0||void 0,className:`text-sm text-po-dim data-denied:text-po-red`,children:_?QZe:l??`Your sign-in stays separate for every host.`}),(0,H.jsx)(Z,{variant:`primary`,disabled:_||d||!a.trim()||!s.trim(),onClick:()=>void v(),children:`Continue to pairing`}),(0,H.jsx)(Z,{variant:`outline`,onClick:()=>{i(!1),u(void 0)},children:`Cancel`})]}):t.kind===`ready`?(0,H.jsx)(`div`,{children:(0,H.jsx)(Z,{variant:`outline`,onClick:()=>i(!0),children:`Add host`})}):null,(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`Forgetting a host here keeps its host links. Unlinking is separate.`}),(0,H.jsx)(aq,{open:p!==void 0,onOpenChange:e=>e?void 0:m(void 0),children:(0,H.jsxs)(cq,{children:[(0,H.jsxs)(lq,{className:`flex-col items-start`,children:[(0,H.jsxs)(uq,{children:[`Forget `,p?.label,`?`]}),(0,H.jsxs)(dq,{children:[`Remove `,p?.label,` from this cockpit. Pair again to reconnect. Its host links stay in place.`]})]}),(0,H.jsx)(fq,{children:`Your other hosts stay connected.`}),(0,H.jsxs)(mq,{className:`px-4 pb-4`,children:[(0,H.jsx)(Z,{variant:`outline`,onClick:()=>m(void 0),children:`Cancel`}),(0,H.jsx)(Z,{variant:`danger`,disabled:d,onClick:()=>p&&void y(p),children:`Forget host`})]})]})})]})}function rQe(e){try{let t=new URL(e);return t.protocol===`https:`&&t.username===``&&t.password===``&&t.hash===``}catch{return!1}}function iQe(e){let{clientSecret:t,connectionUrl:n,mcpAppConnectionUrl:r,...i}=e;return i}var aQe={url_token:`Signed URL`,api_key:`API key`,client_secret_post:`OAuth`};function e6({label:e,value:t,testId:n}){let[r,i]=(0,V.useState)(`idle`);async function a(){if(navigator.clipboard===void 0)i(`failed`);else try{await navigator.clipboard.writeText(t),i(`copied`)}catch{i(`failed`)}}return(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:e}),(0,H.jsx)(`code`,{className:`break-all font-mono text-sm text-po-text`,"data-testid":n,children:t}),(0,H.jsxs)(`output`,{"aria-live":`polite`,className:`text-sm text-po-dim empty:hidden`,children:[r===`failed`?`Copying was blocked. Select the value above to copy it by hand.`:``,r===`copied`?`${e} copied.`:``]})]}),(0,H.jsx)(Z,{type:`button`,variant:`outline`,size:`sm`,"data-testid":`${n}-copy`,"aria-label":`Copy ${e}`,onClick:()=>void a(),children:r===`copied`?`Copied`:`Copy`})]})}function oQe(){let e=SM(),t=U(q,e=>e.order),n=U(q,e=>e.activeId),r=(0,V.useMemo)(()=>t.map(t=>e[t]).filter(e=>e!==void 0&&!e.summary.dormant),[e,t]),[i,a]=gL(`session-mcp/session`,()=>n??r[0]?.summary.id??``),o=i===``?void 0:e[i],s=o?.summary.workspaceId,c=o?.attach===`attached`&&s!==void 0,l=`${s??``}\u0000${i}`,[,u,d]=gL(`session-mcp/selection`,l),f=it()!==void 0,p=U(fF,e=>e.view?.publicUrl),[m,h]=gL(`session-mcp/config`,void 0),[g,_,v]=gL(`session-mcp/clients`,[]),[y,b]=gL(`session-mcp/redirect`,``),[x,S]=gL(`session-mcp/tool-prefix`,``),[C,w]=gL(`session-mcp/auth-method`,`url_token`),[T,E]=gL(`session-mcp/created`,void 0),D=T?.sessionId===i?T.client:void 0,[O,k]=gL(`session-mcp/loading`,!1),[A,j,M]=gL(`session-mcp/busy`,!1),[N,P]=gL(`session-mcp/error`,void 0);(0,V.useLayoutEffect)(()=>{d.state===l&&c||(u(l),E(void 0),b(``),S(``),h(void 0),_([]),P(void 0),j(!1))},[c,l,d,u,E,b,S,h,_,P,j]),(0,V.useEffect)(()=>()=>E(void 0),[E]),(0,V.useEffect)(()=>{if(r.some(e=>e.summary.id===i))return;let e=r.find(e=>e.summary.id===n)??r[0];a(e?.summary.id??``)},[r,i,n,a]),(0,V.useEffect)(()=>{let e=!0,t=v.state;return!c||s===void 0?(k(!1),()=>{e=!1}):(k(!0),Promise.all([p===void 0?void 0:ZA(s,i),QA(s,i)]).then(([n,r])=>{e&&(n===void 0?h(void 0):`error`in n?P(n.error):h(n.config),`error`in r?P(e=>e??r.error):!M.state&&v.state===t&&_(r.clients),k(!1))}),()=>{e=!1})},[c,p,i,s,v,M,h,_,P,k]);let ee=C===`oauth`&&y!==``&&!rQe(y),F=c&&!f&&m!==void 0&&(C!==`oauth`||rQe(y))&&!A;async function te(){if(!F||s===void 0||M.state)return;let e=l;j(!0),P(void 0);let t=x.trim(),n=t===``?{}:{toolPrefix:t},r=await $A(s,i,C===`oauth`?{redirectUri:y.trim(),scope:`session`,routing:`conversation`,...n}:{authMethod:C,scope:`session`,routing:`conversation`,...n});d.state===e&&(j(!1),`error`in r?P(r.error):(E({sessionId:i,client:r.client}),_(e=>[iQe(r.client),...e]),b(``),S(``)))}async function ne(e){if(s===void 0||M.state)return;let t=l;j(!0),P(void 0);let n=await ej(s,i,e);d.state===t&&(j(!1),`error`in n?P(n.error):(_(t=>t.filter(t=>t.clientId!==e)),D?.clientId===e&&E(void 0)))}return(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-10`,"data-testid":`session-mcp-settings`,children:[(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Session MCP`}),(0,H.jsx)(X4,{children:`Let ChatGPT or another MCP client work inside one live Po session. This is separate from the MCP servers Po calls out to.`})]}),(0,H.jsxs)(Z4,{children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{id:`session-mcp-picker-label`,children:`Session`}),(0,H.jsx)(n3,{children:O?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,H.jsx)(nq,{label:`Reading the session MCP connection`}),`Reading the connection…`]}):o===void 0?`Start a session first, then come back to connect a client to it.`:c?!O&&m===void 0&&N===void 0?`Turn on remote control with a public HTTPS address first. Clients connect through it.`:`Clients connect to this session and work with its tools and permissions.`:`This session is disconnected. Reconnect it to manage its clients.`})]}),(0,H.jsxs)(F4,{value:i,disabled:r.length===0,onValueChange:a,children:[(0,H.jsx)(R4,{id:`session-mcp-picker`,"data-testid":`session-mcp-session`,"aria-labelledby":`session-mcp-picker-label`,className:`w-full sm:w-72`,children:(0,H.jsx)(L4,{placeholder:`No live session`})}),(0,H.jsx)(z4,{children:r.map(e=>(0,H.jsxs)(V4,{value:e.summary.id,children:[e.summary.name,` · `,e.summary.cwd]},e.summary.id))})]})]}),m===void 0?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(e6,{label:`MCP`,value:m.mcpUrl,testId:`session-mcp-url`}),(0,H.jsx)(e6,{label:`MCP with widgets`,value:m.mcpAppUrl,testId:`session-mcp-app-url`}),(0,H.jsxs)(`details`,{children:[(0,H.jsx)(`summary`,{className:`cursor-pointer px-5 py-3 text-sm text-po-dim hover:text-po-hi`,children:`OAuth endpoints`}),(0,H.jsxs)(`dl`,{className:`grid gap-x-6 gap-y-1 border-t border-po-border-soft px-5 py-4 text-sm sm:grid-cols-[auto_minmax(0,1fr)]`,children:[(0,H.jsx)(`dt`,{className:`text-po-dim`,children:`Authorization`}),(0,H.jsx)(`dd`,{className:`break-all font-mono text-po-text`,children:m.authorizationEndpoint}),(0,H.jsx)(`dt`,{className:`text-po-dim`,children:`Token`}),(0,H.jsx)(`dd`,{className:`break-all font-mono text-po-text`,children:m.tokenEndpoint})]})]})]})]}),N?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm leading-relaxed text-po-red`,children:N}):null]}),m===void 0||f?null:(0,H.jsxs)(q4,{"data-testid":`session-mcp-create`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Connect a client`}),(0,H.jsx)(X4,{children:`A signed URL is the simplest way to connect ChatGPT: the key travels inside the URL, so there is no OAuth callback or header to set up. Other clients can use an API key or OAuth.`})]}),(0,H.jsxs)(Z4,{children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{id:`session-mcp-auth-method-label`,children:`Sign-in method`}),(0,H.jsx)(n3,{children:`How the client proves it is allowed in.`})]}),(0,H.jsxs)(F4,{value:C,onValueChange:e=>w(e),children:[(0,H.jsx)(R4,{id:`session-mcp-auth-method`,"data-testid":`session-mcp-auth-method`,"aria-labelledby":`session-mcp-auth-method-label`,className:`w-full sm:w-72`,children:(0,H.jsx)(L4,{})}),(0,H.jsxs)(z4,{children:[(0,H.jsx)(V4,{value:`url_token`,children:`Signed URL (JWT)`}),(0,H.jsx)(V4,{value:`api_key`,children:`API key (Bearer)`}),(0,H.jsx)(V4,{value:`oauth`,children:`OAuth (callback required)`})]})]})]}),C===`oauth`?(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:(0,H.jsx)(`label`,{htmlFor:`session-mcp-callback`,children:`Redirect URL`})}),(0,H.jsx)(n3,{id:`session-mcp-callback-help`,children:ee?(0,H.jsx)(`span`,{className:`text-po-red`,children:`Use an absolute HTTPS URL without credentials or a fragment.`}):`Copy it from your OAuth client. Don’t work it out from the MCP URL.`})]}),(0,H.jsx)(zq,{id:`session-mcp-callback`,"data-testid":`session-mcp-callback`,type:`url`,value:y,placeholder:`https://chatgpt.com/connector/oauth/…`,"aria-invalid":ee,"aria-describedby":`session-mcp-callback-help`,spellCheck:!1,onChange:e=>b(e.target.value),className:`w-full font-mono text-sm sm:w-72`})]}):null,(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:(0,H.jsx)(`label`,{htmlFor:`session-mcp-tool-prefix`,children:`Tool prefix`})}),(0,H.jsxs)(n3,{id:`session-mcp-tool-prefix-help`,children:[`Tools appear as `,(0,H.jsx)(`code`,{className:`font-mono`,children:`prefix_bash`}),`,`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`prefix_read`}),`. Lowercase letters and digits, joined by single underscores, up to 24 characters.`]})]}),(0,H.jsx)(zq,{id:`session-mcp-tool-prefix`,"data-testid":`session-mcp-tool-prefix`,value:x,placeholder:`The session name`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`session-mcp-tool-prefix-help`,onChange:e=>S(e.target.value),className:`w-full font-mono text-sm sm:w-72`})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-testid":`session-mcp-routing`,children:[(0,H.jsx)(r3,{children:`Every conversation is automatically routed to its own worktree before tools run, never to the checkout this session uses. While a worktree is provisioning or recovering, tools wait; if recovery can't finish, the conversation reports it rather than falling back to this session.`}),(0,H.jsx)(r3,{children:`Access follows this session's mode, domains and profile as they change, and tools run with its permissions.`})]}),(0,H.jsx)(i3,{children:(0,H.jsx)(Z,{"data-testid":`session-mcp-create-button`,size:`sm`,variant:F?`primary`:`outline`,loading:A,disabled:!F,onClick:()=>void te(),children:C===`url_token`?`Create signed URL`:C===`api_key`?`Create API key`:`Create OAuth client`})})]}),(0,H.jsxs)(q4,{"data-testid":`session-mcp-clients`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Clients`}),g.length>0?(0,H.jsxs)(`span`,{className:`text-sm text-po-dim tabular-nums`,children:[g.length,` connected`]}):null]}),f?(0,H.jsx)(r3,{"data-testid":`session-mcp-remote-note`,children:`New clients can only be created on the machine Po runs on. From here you can still see and revoke existing ones, if the host allows it.`}):null,D===void 0?null:(0,H.jsxs)(Z4,{className:`border-po-green/50`,"data-testid":`session-mcp-secret`,children:[(0,H.jsxs)(Q4,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsxs)(t3,{className:`flex flex-wrap items-center gap-2`,children:[`Save these details now`,D.toolPrefix?(0,H.jsxs)(XK,{tone:`neutral`,className:`font-mono`,"data-testid":`session-mcp-created-prefix`,children:[D.toolPrefix,`_*`]}):null]}),(0,H.jsxs)(n3,{children:[D.tokenEndpointAuthMethod===`url_token`?`In ChatGPT, paste either URL into Server URL and choose no additional authentication. Treat both like a password: they are shown once and work until you revoke the client.`:D.tokenEndpointAuthMethod===`api_key`?`In ChatGPT, choose API key with a Bearer header and paste the key. It is shown once and disappears when you dismiss it, leave this page or switch session.`:null,D.tokenEndpointAuthMethod===`url_token`||D.tokenEndpointAuthMethod===`api_key`?null:(0,H.jsxs)(H.Fragment,{children:[`Paste the client ID and secret into your OAuth client and choose`,` `,(0,H.jsx)(`code`,{className:`font-mono`,children:`client_secret_post`}),` as the token endpoint auth method. The secret is shown once.`]})]})]}),(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:()=>E(void 0),children:`Dismiss`})]}),D.tokenEndpointAuthMethod===`url_token`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(e6,{label:`Signed MCP URL`,value:D.connectionUrl,testId:`session-mcp-created-url`}),(0,H.jsx)(e6,{label:`Signed MCP with widgets URL`,value:D.mcpAppConnectionUrl,testId:`session-mcp-created-app-url`})]}):(0,H.jsxs)(H.Fragment,{children:[m===void 0?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(e6,{label:`MCP`,value:m.mcpUrl,testId:`session-mcp-created-url`}),(0,H.jsx)(e6,{label:`MCP with widgets`,value:m.mcpAppUrl,testId:`session-mcp-created-app-url`})]}),D.tokenEndpointAuthMethod===`api_key`?null:(0,H.jsx)(e6,{label:`Client ID`,value:D.clientId,testId:`session-mcp-created-id`}),(0,H.jsx)(e6,{label:D.tokenEndpointAuthMethod===`api_key`?`API key`:`Client secret`,value:D.clientSecret,testId:`session-mcp-created-secret`})]})]}),g.length===0?O?null:(0,H.jsx)(Z4,{children:(0,H.jsx)(Q4,{children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No clients yet`}),(0,H.jsx)(n3,{children:`Clients you connect to this session will be listed here.`})]})})}):(0,H.jsx)(Z4,{asChild:!0,children:(0,H.jsx)(`ul`,{children:g.map(e=>(0,H.jsx)(Q4,{asChild:!0,children:(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(e3,{children:[(0,H.jsxs)(t3,{className:`flex flex-wrap items-center gap-2`,children:[e.name,(0,H.jsx)(XK,{tone:`neutral`,children:aQe[e.tokenEndpointAuthMethod]??e.tokenEndpointAuthMethod}),e.toolPrefix?(0,H.jsxs)(XK,{tone:`neutral`,className:`font-mono`,children:[e.toolPrefix,`_*`]}):null]}),(0,H.jsx)(n3,{children:e.scope===`session`?`Session access. Worktree per conversation.`:`Restricted access. Tools: ${e.tools.join(`, `)||`none`}. Skills: ${e.skills.join(`, `)||`none`}.`}),(0,H.jsx)(`code`,{className:`block break-all font-mono text-sm text-po-dim`,children:e.clientId}),e.redirectUri?(0,H.jsx)(`span`,{className:`block break-all font-mono text-sm text-po-dim`,children:e.redirectUri}):null]}),(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:A,onClick:()=>void ne(e.clientId),children:`Revoke`})]})},e.clientId))})}),(0,H.jsx)(r3,{children:`Signed URLs and API keys belong to this session and survive a restart until you revoke them. OAuth sign-ins last only while Po runs, so a client may ask to authorise again.`})]})]})}var sQe=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/iu;function t6(e){return e.kind===`named`?e:{kind:`named`,hostname:``}}function n6(e){let t=e.trim();return t===``?void 0:t}var cQe=[{kind:`quick`,label:`Quick tunnel`,detail:`No account needed. The address changes each time.`},{kind:`named`,label:`Named tunnel`,detail:`Your own domain, and the address stays put.`}];function lQe({tunnel:e}){let[t,n]=gL(`tunnel/draft`,e),[r,i]=gL(`tunnel/source`,e),[a,o,s]=gL(`tunnel/saving`,!1);r!==e&&JSON.stringify(t)===JSON.stringify(r)&&(i(e),n(e));let c=t.kind===`named`?t.hostname.trim():``,l=t.kind===`named`&&!sQe.test(c),u=JSON.stringify(t)!==JSON.stringify(e);function d(e){n(t=>({...t6(t),...e}))}async function f(){if(s.state)return;o(!0);let e=t6(t),r=n6(e.tokenFile??``),a=n6(e.name??``),l=n6(e.configFile??``),u=t.kind===`quick`?t:{kind:`named`,hostname:c,...r===void 0?{}:{tokenFile:r},...a===void 0?{}:{name:a},...l===void 0?{}:{configFile:l}};try{await MF({tunnel:u})&&(i(u),n(e=>e===t?u:e))}finally{o(!1)}}return(0,H.jsxs)(q4,{"data-testid":`remote-tunnel-settings`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Tunnel`}),(0,H.jsx)(X4,{children:`How your other devices reach Po. A named tunnel gives you a stable address, which passkeys need.`})]}),(0,H.jsx)(j4,{value:t.kind,onValueChange:e=>n(e===`named`?t6(t):{kind:`quick`}),className:`grid grid-cols-1 gap-3 min-[480px]:grid-cols-2`,"aria-label":`Tunnel type`,children:cQe.map(e=>(0,H.jsxs)(M4,{value:e.kind,"data-testid":`remote-tunnel-${e.kind}`,className:`flex items-start gap-2 rounded-lg p-4`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:e.label}),(0,H.jsx)(`span`,{className:`text-sm leading-relaxed text-po-dim`,children:e.detail})]}),t.kind===e.kind?(0,H.jsx)(LL,{className:`size-4 shrink-0 text-po-green`}):null]},e.kind))}),t.kind===`named`?(0,H.jsxs)(Z4,{children:[(0,H.jsx)($4,{id:`remote-tunnel-hostname`,label:`Hostname`,description:l?(0,H.jsx)(`span`,{className:`text-po-red`,children:`Enter the hostname only, without https://, a port or a path.`}):`The domain your devices will open.`,children:(0,H.jsx)(zq,{id:`remote-tunnel-hostname`,"data-testid":`remote-tunnel-hostname`,value:t.hostname,placeholder:`po.example.com`,"aria-invalid":l,spellCheck:!1,onChange:e=>d({hostname:e.target.value}),className:`font-mono text-sm`})}),(0,H.jsx)($4,{id:`remote-tunnel-token-file`,label:`Token file`,description:`A local file holding your Cloudflare connector token. Po reads the file and never stores the token itself.`,children:(0,H.jsx)(zq,{id:`remote-tunnel-token-file`,"data-testid":`remote-tunnel-token-file`,value:t.tokenFile??``,placeholder:`~/.cloudflared/po.token`,spellCheck:!1,onChange:e=>d({tokenFile:e.target.value}),className:`font-mono text-sm`})}),(0,H.jsxs)(`details`,{className:`group`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer px-5 py-3 text-sm text-po-dim hover:text-po-hi`,children:`Tunnel you manage with cloudflared`}),(0,H.jsxs)(`div`,{className:`flex flex-col divide-y divide-po-border-soft border-t border-po-border-soft`,children:[(0,H.jsx)($4,{id:`remote-tunnel-name`,label:`Tunnel name`,children:(0,H.jsx)(zq,{id:`remote-tunnel-name`,"data-testid":`remote-tunnel-name`,value:t.name??``,placeholder:`po`,spellCheck:!1,onChange:e=>d({name:e.target.value}),className:`font-mono text-sm`})}),(0,H.jsx)($4,{id:`remote-tunnel-config-file`,label:`Config file`,children:(0,H.jsx)(zq,{id:`remote-tunnel-config-file`,"data-testid":`remote-tunnel-config-file`,value:t.configFile??``,placeholder:`~/.cloudflared/config.yml`,spellCheck:!1,onChange:e=>d({configFile:e.target.value}),className:`font-mono text-sm`})})]})]})]}):null,(0,H.jsxs)(i3,{children:[(0,H.jsx)(Z,{variant:u&&!l?`primary`:`outline`,size:`sm`,"data-testid":`remote-tunnel-save`,loading:a,disabled:a||!u||l,onClick:()=>void f(),children:`Save tunnel`}),(0,H.jsxs)(r3,{children:[`Takes effect the next time remote access starts. Install `,(0,H.jsx)(`code`,{className:`font-mono`,children:`cloudflared`}),` on this machine first.`]})]})]})}function uQe(){let e=U(fF);return(0,V.useEffect)(()=>{SF()},[]),(0,H.jsxs)(U4,{"data-testid":`remote-control-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Remote control`}),(0,H.jsx)(K4,{children:`Reach this Po from your phone or another computer. You turn access on and pair devices from the remote access dialog; this page holds what stays the same between visits.`})]}),e.view===void 0&&e.error?(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{title:e.error,children:[(0,H.jsxs)(e3,{role:`alert`,children:[(0,H.jsx)(t3,{children:`Po couldn't read your remote settings just now`}),(0,H.jsx)(n3,{children:`Nothing has changed. Remote access is as you left it.`})]}),(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:()=>void SF(),children:`Try again`})]})}):e.view===void 0?(0,H.jsxs)(Z4,{role:`status`,"aria-busy":!0,className:`gap-4 p-5`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Reading remote settings`}),(0,H.jsx)(Lq,{className:`h-4 w-48`}),(0,H.jsx)(Lq,{className:`h-4 w-72`})]}):(0,H.jsx)(lQe,{tunnel:e.view.settings.tunnel}),(0,H.jsx)(oQe,{})]})}function dQe({value:e,saving:t=!1,loading:n=!1,error:r=``,onChange:i,onSave:a,onRetry:o}){return(0,H.jsxs)(q4,{children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Instructions`}),(0,H.jsx)(X4,{children:`How you want Po to work in this workspace.`})]}),(0,H.jsx)(Z4,{children:(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 px-5 py-4`,children:[(0,H.jsx)(`label`,{htmlFor:`workspace-instructions`,className:`text-base font-medium text-po-hi`,children:`Workspace instructions`}),(0,H.jsx)(N4,{id:`workspace-instructions`,value:e,onChange:e=>i(e.target.value),rows:6,className:`w-full resize-y`,placeholder:`For example, ask before pushing changes.`,disabled:t||n,"aria-describedby":r?`instructions-help instructions-error`:`instructions-help`}),(0,H.jsx)(r3,{id:`instructions-help`,children:`Applies to new and reopened sessions.`}),r?(0,H.jsx)(`p`,{id:`instructions-error`,role:`alert`,className:`text-sm leading-relaxed text-po-red`,children:r}):null]})}),n?(0,H.jsx)(r3,{children:`Reading instructions…`}):null,(0,H.jsxs)(i3,{children:[n&&r?(0,H.jsx)(Z,{variant:`outline`,size:`sm`,onClick:o,children:`Try again`}):null,(0,H.jsx)(Z,{variant:`primary`,size:`sm`,loading:t,loadingLabel:`Saving instructions`,disabled:t||n,onClick:a,children:t?`Saving instructions…`:`Save instructions`})]})]})}function fQe({workspaceId:e}){let[t,n]=(0,V.useState)(0),[r,i,a]=gL(JSON.stringify([`workspace-instructions`,e]),{value:``,loaded:!1,saving:!1,error:``});(0,V.useEffect)(()=>{if(a.state.loaded)return;let t=!0;return cge(e).then(e=>{t&&i(t=>`error`in e?{...t,error:`Instructions could not be loaded. ${e.error}`}:{...t,value:e.workspace.instructions??``,loaded:!0,error:``})}),()=>{t=!1}},[e,i,a,t]);let o=async()=>{if(a.state.saving||!a.state.loaded)return;let t=a.state.value;i(e=>({...e,saving:!0,error:``}));let n=await lge(e,t);`error`in n?i(e=>({...e,saving:!1,error:`Instructions could not be saved. Your changes are still here. Try saving again.`})):(vP({workspace:n.workspace}),i(e=>({...e,saving:!1,error:``})))};return(0,H.jsx)(dQe,{value:r.value,saving:r.saving,loading:!r.loaded,error:r.error,onRetry:()=>n(e=>e+1),onChange:e=>i(t=>({...t,value:e})),onSave:()=>void o()})}var r6=`container`,pQe=`The container provider is not available.`,mQe=`The workspace folder could not be opened.`,hQe=`The container did not start, so new sessions still run on this computer.`,gQe=`The container did not stop, so new sessions still start in it.`,_Qe=`The container stopped, so new sessions cannot start in it.`;function i6(e){return hL(JSON.stringify([`run-in-container`,e]),{})}function vQe(e,t){return t===void 0?e:`${e} ${t}`}function yQe(e,t){if(t.pending!==void 0)return{kind:t.pending===r6?`starting`:`stopping`};if(t.error!==void 0)return{kind:`error`,message:t.error};let n=e.sandbox!==void 0,r=e.sandboxReason;if(e.available===!1&&!n)return{kind:`unavailable`,reason:mQe};switch(e.sandboxState){case`starting`:return{kind:`starting`};case`stopping`:return{kind:`stopping`};case`unavailable`:return n?{kind:`on-unavailable`,reason:r??pQe}:{kind:`unavailable`,reason:r??pQe};case`failed`:return{kind:`error`,message:vQe(n?_Qe:hQe,r)};default:return{kind:n?`on`:`off`}}}function bQe(e,t,n,r){return t.flatMap(t=>{let i=e[t];if(i===void 0)return[];let{summary:a}=i;if(a.workspaceId!==n||a.dormant===!0)return[];let o=Hk({attach:i.attach,phase:a.phase,phaseSince:a.phaseSince,awaitingInput:a.awaitingInput,everPrompted:a.everPrompted,backgroundWorkActive:a.backgroundWorkActive,lastSettledAt:a.lastSettledAt,...a.activity===void 0?{}:{activity:a.activity}},r);return[{id:t,name:a.name,status:o}]})}function xQe(e,t){let n=i6(e);n.state.pending===void 0&&n.setState(e=>({...e,dialog:t?`on`:`off`}))}function SQe(e){i6(e).setState(e=>({...e,dialog:void 0}))}async function CQe(e,t){let n=i6(e);if(n.state.pending!==void 0)return;n.setState(()=>({pending:t,last:t}));let r=await uge(e,t);`workspace`in r?(vP({workspace:r.workspace}),n.setState(e=>({last:e.last}))):n.setState(e=>({last:e.last,error:vQe(t===r6?hQe:gQe,r.error)}))}async function wQe(e){let t=i6(e).state.dialog;t!==void 0&&await CQe(e,t===`on`?r6:null)}async function TQe(e){let t=i6(e).state.last;await CQe(e,t===void 0?r6:t)}var EQe=`run-in-container`,a6=`run-in-container-help`,o6=`run-in-container-status`;function DQe({state:e,onRetry:t}){switch(e.kind){case`off`:return null;case`on`:return(0,H.jsx)(`p`,{id:o6,className:`basis-full text-sm leading-relaxed text-po-dim`,children:`On. New sessions start in the container.`});case`unavailable`:return(0,H.jsxs)(`p`,{id:o6,"data-testid":`run-in-container-unavailable`,className:`basis-full rounded-md border border-po-border-soft bg-po-deep px-3 py-2 text-sm leading-relaxed text-po-text`,children:[`Not available on this computer right now. `,e.reason]});case`on-unavailable`:return(0,H.jsxs)(`p`,{id:o6,"data-testid":`run-in-container-paused`,className:`basis-full rounded-md border border-po-border-soft bg-po-deep px-3 py-2 text-sm leading-relaxed text-po-text`,children:[`Container sessions are paused on this computer. `,e.reason,` New sessions cannot start until it is back.`]});case`starting`:case`stopping`:return(0,H.jsxs)(`p`,{id:o6,className:`flex basis-full items-center gap-2 text-sm leading-relaxed text-po-dim`,children:[(0,H.jsx)(nq,{label:e.kind===`starting`?`Starting the container`:`Stopping the container`}),e.kind===`starting`?`Starting the container…`:`Stopping the container and moving sessions back to this computer…`]});case`error`:return(0,H.jsxs)(`div`,{id:o6,role:`alert`,"data-testid":`run-in-container-error`,className:`flex basis-full flex-col items-start gap-2 rounded-md border border-po-edge-red bg-po-tint-red px-3 py-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,H.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-start gap-2 text-sm leading-relaxed text-po-text`,children:[(0,H.jsx)(GL,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-po-red`}),(0,H.jsx)(`span`,{children:e.message})]}),(0,H.jsx)(Z,{variant:`outline`,size:`xs`,"data-testid":`run-in-container-retry`,onClick:t,children:`Try again`})]})}}function OQe(e){return t=>{t.preventDefault(),e.current?.focus()}}function kQe({workspaceName:e,returnFocus:t,onCancel:n,onConfirm:r}){return(0,H.jsx)(aq,{open:!0,onOpenChange:e=>e?void 0:n(),children:(0,H.jsxs)(cq,{"data-testid":`run-in-container-confirm-on`,onCloseAutoFocus:OQe(t),children:[(0,H.jsxs)(lq,{className:`flex-col items-start gap-1`,children:[(0,H.jsxs)(uq,{children:[`Run `,e,` in a container?`]}),(0,H.jsx)(dq,{children:`New sessions in this workspace will start inside a container on this computer.`})]}),(0,H.jsxs)(fq,{children:[(0,H.jsx)(`p`,{className:`text-base leading-relaxed text-po-text`,children:`Saved sessions of this workspace move into the container, so you can resume them there.`}),(0,H.jsx)(`p`,{className:`text-base leading-relaxed text-po-text`,children:`Sessions still running on this computer keep running here. Each one moves when it closes.`}),(0,H.jsx)(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Conversations and artifacts stay on this computer. Credentials stay with Po on the host.`})]}),(0,H.jsxs)(mq,{className:`flex-wrap px-3 pb-3 sm:px-4 sm:pb-4`,children:[(0,H.jsx)(Z,{variant:`outline`,"data-testid":`run-in-container-cancel`,onClick:n,children:`Cancel`}),(0,H.jsx)(Z,{variant:`primary`,"data-testid":`run-in-container-confirm`,onClick:r,children:`Run in container`})]})]})})}function AQe({sessions:e}){return(0,H.jsx)(`ul`,{"aria-label":`Running container sessions`,className:`flex flex-col divide-y divide-po-border-soft rounded-md border border-po-border-soft`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-center justify-between gap-3 px-3 py-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-base text-po-text`,children:e.name}),(0,H.jsx)(`span`,{className:`shrink-0 text-sm text-po-dim first-letter:uppercase`,children:e.status})]},e.id))})}function jQe({workspaceName:e,sessions:t,returnFocus:n,onCancel:r,onConfirm:i}){let a=t.length===1?`One session is`:`${String(t.length)} sessions are`,o=t.length>0;return(0,H.jsx)(aq,{open:!0,onOpenChange:e=>e?void 0:r(),children:(0,H.jsxs)(cq,{"data-testid":`run-in-container-confirm-off`,onCloseAutoFocus:OQe(n),children:[(0,H.jsxs)(lq,{className:`flex-col items-start gap-1`,children:[(0,H.jsxs)(uq,{children:[`Stop running `,e,` in a container?`]}),(0,H.jsx)(dq,{children:o?`${a} running in the container. Turning this off stops them, and their current turns are interrupted.`:`Everything moves back to this computer, and you can resume its sessions here.`})]}),(0,H.jsxs)(fq,{children:[o?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(AQe,{sessions:t}),(0,H.jsx)(`p`,{className:`text-base leading-relaxed text-po-text`,children:`Then everything moves back to this computer, and you can resume those sessions here.`})]}):null,(0,H.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-po-border-soft bg-po-deep px-3 py-2 text-sm leading-relaxed text-po-text`,children:[(0,H.jsx)(ER,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-po-dim`}),(0,H.jsx)(`span`,{children:`Switching off means trusting what this workspace produced while it was contained: its files, settings, and conversations.`})]})]}),(0,H.jsxs)(mq,{className:`flex-wrap px-3 pb-3 sm:px-4 sm:pb-4`,children:[(0,H.jsx)(Z,{variant:`outline`,"data-testid":`run-in-container-cancel`,onClick:r,children:`Keep in container`}),(0,H.jsx)(Z,{variant:`secondary`,"data-testid":`run-in-container-confirm`,onClick:i,children:o?`Stop and move back`:`Switch off`})]})]})})}var MQe=[],s6=()=>void 0;function NQe({workspaceName:e,state:t,dialog:n,runningSessions:r=MQe,onCheckedChange:i=s6,onRetry:a=s6,onCancel:o=s6,onConfirm:s=s6}){let c=(0,V.useRef)(null),l=t.kind===`on`||t.kind===`starting`||t.kind===`on-unavailable`,u=t.kind===`starting`||t.kind===`stopping`,d=t.kind===`unavailable`||t.kind===`on-unavailable`,f=t.kind===`off`?a6:`${a6} ${o6}`;return(0,H.jsxs)(q4,{"data-testid":`run-in-container`,children:[(0,H.jsxs)(J4,{children:[(0,H.jsx)(Y4,{children:`Where sessions run`}),(0,H.jsx)(X4,{children:`Applies to new sessions in this workspace.`})]}),(0,H.jsx)(Z4,{children:(0,H.jsxs)(Q4,{"data-state":t.kind,changed:t.kind===`on`||t.kind===`on-unavailable`,className:`items-start`,children:[(0,H.jsxs)(e3,{className:`gap-1`,children:[(0,H.jsx)(t3,{className:`flex min-h-6 items-center`,children:(0,H.jsx)(`label`,{htmlFor:EQe,children:`Run in container`})}),(0,H.jsx)(n3,{id:a6,children:`New sessions run inside a container on this computer. Conversations and artifacts stay here, and credentials stay with Po on the host.`})]}),(0,H.jsx)(a3,{ref:c,id:EQe,"data-testid":`run-in-container-switch`,checked:l,disabled:d,"aria-disabled":u||void 0,"aria-busy":u||void 0,"aria-describedby":f,onCheckedChange:e=>u?void 0:i(e),className:`mt-1 aria-disabled:pointer-events-none aria-disabled:opacity-40`}),(0,H.jsx)(DQe,{state:t,onRetry:a})]})}),n===`on`?(0,H.jsx)(kQe,{workspaceName:e,returnFocus:c,onCancel:o,onConfirm:s}):null,n===`off`?(0,H.jsx)(jQe,{workspaceName:e,sessions:r,returnFocus:c,onCancel:o,onConfirm:s}):null]})}function PQe({repository:e}){let t=e.id,n=U(gP,e=>e.byId[t]),r=U(i6(t)),i=SM(),a=U(q,e=>e.order);if(n===void 0)return null;let o=yQe(n,r);return(0,H.jsx)(NQe,{workspaceName:e.name,state:o,dialog:r.dialog,runningSessions:r.dialog===`off`?bQe(i,a,t,Date.now()):MQe,onCheckedChange:e=>xQe(t,e),onRetry:()=>void TQe(t),onCancel:()=>SQe(t),onConfirm:()=>void wQe(t)})}var c6=`__inherit__`;function FQe(e,t){if(t===void 0)return``;let n=e.find(e=>e.name===t);return n===void 0?`Configured value '${t}' is not in the effective catalog.`:n.description??(n.layers?`Layers: ${n.layers.join(`, `)||`none`}.`:``)}function IQe({label:e,dirty:t,origin:n,busy:r,children:i,onRevert:a,onClear:o}){return(0,H.jsxs)(e3,{className:`gap-1`,children:[(0,H.jsxs)(t3,{className:`flex min-h-6 flex-wrap items-center gap-x-2 gap-y-1`,children:[e,n===`repository`?(0,H.jsx)(`span`,{className:`sr-only`,children:`, set for this repository`}):null,n===`global`?(0,H.jsx)(`span`,{className:`text-sm font-normal text-po-dim`,children:`From global`}):null,t?(0,H.jsx)(XK,{tone:`cyan`,children:`Unsaved`}):null,t?(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,disabled:r,onClick:a,className:`text-po-dim`,children:`Revert`}):n===`repository`?(0,H.jsx)(Z,{variant:`ghost`,size:`xs`,disabled:r,onClick:o,className:`text-po-dim`,children:`Reset`}):null]}),(0,H.jsx)(n3,{children:i})]})}function l6(e,t){return Object.hasOwn(e,t)}function LQe({id:e,label:t,detail:n,options:r,effective:i,repositoryValue:a,origin:o,draft:s,dirty:c,busy:l,onChange:u,onRevert:d}){let f=c?s:a,p=f??c6,m=i===void 0?`Inherit (none)`:`Inherit (${i})`,h=f??i;return(0,H.jsxs)(Q4,{"data-testid":`repository-axis-${e}`,"data-dirty":c,changed:o===`repository`,className:`items-start`,children:[(0,H.jsx)(IQe,{label:t,dirty:c,origin:o,busy:l,onRevert:d,onClear:()=>u(null),children:FQe(r,h)||n}),(0,H.jsxs)(F4,{value:p,disabled:l,onValueChange:e=>u(e===c6?null:e),children:[(0,H.jsx)(R4,{"data-testid":`repository-select-${e}`,"aria-label":t,className:`w-full text-sm sm:w-64`,children:(0,H.jsx)(L4,{})}),(0,H.jsxs)(z4,{children:[(0,H.jsx)(V4,{value:c6,children:m}),r.map(e=>(0,H.jsx)(V4,{value:e.name,children:e.name},e.name))]})]})]})}function RQe({view:e,draft:t,dirty:n,busy:r,onChange:i,onRevert:a}){let o=e.selection.domains,s=o.effective??[],c=n?t??s:o.repository??s,l=new Set(c),u=e=>l.has(e)?c.filter(t=>t!==e):[...c,e];return(0,H.jsxs)(Q4,{"data-testid":`repository-axis-domains`,"data-dirty":n,changed:o.origin===`repository`,className:`items-start`,children:[(0,H.jsx)(IQe,{label:`Domains`,dirty:n,origin:o.origin,busy:r,onRevert:a,onClear:()=>i(null),children:`The plugin sets a new session in this repository loads. Pick any number.`}),(0,H.jsxs)(`div`,{role:`group`,"aria-label":`Domains`,className:`flex basis-full flex-wrap items-center gap-2`,children:[e.catalogs.domains.map(e=>{let t=l.has(e.name);return(0,H.jsxs)(Z,{variant:`ghost`,size:`sm`,"data-testid":`repository-domain-${e.name}`,"data-active":t,"aria-pressed":t,disabled:r,title:e.description,onClick:()=>i(u(e.name)),className:t?`gap-1.5 rounded-full border border-po-green/50 bg-po-green/10 pl-2 pr-3 font-medium text-po-green hover:bg-po-green/15 hover:text-po-green`:`rounded-full border border-po-border-soft px-3 text-po-dim hover:border-po-border hover:text-po-hi`,children:[t?(0,H.jsx)(LL,{"aria-hidden":!0,className:`size-3.5`}):null,e.name]},e.name)}),e.catalogs.domains.length===0?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`No domains are configured.`}):null]})]})}function zQe({repository:e,containerSection:t}){let n=e?.id??``,r=JSON.stringify([`repository`,n]),[i,a,o]=gL(`${r}/view`,void 0),[s,c]=gL(`${r}/drafts`,{}),[l,u,d]=gL(`${r}/busy`,!1),[f,p]=gL(`${r}/error`,``),[m,h]=gL(`${r}/note`,``),g=Object.keys(s).length,_=(0,V.useCallback)(async()=>{if(n===``){a(void 0);return}if(d.state)return;let e=o.state,t=await wj(n);d.state||o.state!==e||(t.ok?(a(t.settings),p(``)):(a(void 0),p(t.error)))},[n,d,o,a,p]);(0,V.useEffect)(()=>{_()},[_]);let v=(0,V.useCallback)((e,t)=>{h(``),c(n=>({...n,[e]:t}))},[h,c]),y=(0,V.useCallback)(e=>{c(t=>{let n={...t};return delete n[e],n})},[c]),b=(0,V.useCallback)(async()=>{if(d.state||i===void 0||g===0)return;u(!0),p(``);let e=await Tj({repositoryId:i.repository.id,expectedHash:i.hash,changes:s});if(u(!1),!e.ok)p(e.error),await _();else{a(e.settings),c(e=>e===s?{}:e),h(`Saved. Run po sync, and the next session starts with these.`);for(let e of Object.keys(q.state.byId))ON(e)}},[d,g,s,_,i,u,p,a,c,h]),x=l6(s,`majorMode`),S=l6(s,`domains`),C=l6(s,`profile`);return(0,H.jsxs)(U4,{"data-testid":`repository-settings`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:`Defaults`}),(0,H.jsx)(K4,{children:`What a new session in this repository starts with. Sessions already open keep what they have.`})]}),e===null?(0,H.jsx)(Z4,{children:(0,H.jsx)(Q4,{"data-testid":`repository-settings-empty`,children:(0,H.jsxs)(e3,{children:[(0,H.jsx)(t3,{children:`No repository yet`}),(0,H.jsxs)(n3,{children:[`Open a session inside a Git or `,(0,H.jsx)(`code`,{className:`font-mono`,children:`.po`}),` repository to set its defaults here.`]})]})})}):null,f===``?null:(0,H.jsx)(`p`,{"data-testid":`repository-settings-error`,role:`alert`,className:`text-sm leading-relaxed text-po-red`,children:f}),i===void 0?null:(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,H.jsxs)(Z4,{children:[(0,H.jsx)(LQe,{id:`major-mode`,label:`Major mode`,detail:`The extensions and package layers a session is built from.`,options:i.catalogs.majorModes,effective:i.selection.majorMode.effective,repositoryValue:i.selection.majorMode.repository,origin:i.selection.majorMode.origin,draft:x?s.majorMode:void 0,dirty:x,busy:l,onChange:e=>v(`majorMode`,e),onRevert:()=>y(`majorMode`)}),(0,H.jsx)(RQe,{view:i,draft:S?s.domains:void 0,dirty:S,busy:l,onChange:e=>v(`domains`,e),onRevert:()=>y(`domains`)}),(0,H.jsx)(LQe,{id:`profile`,label:`Profile`,detail:`The persona a new session in this repository starts with.`,options:i.catalogs.profiles,effective:i.selection.profile.effective,repositoryValue:i.selection.profile.repository,origin:i.selection.profile.origin,draft:C?s.profile:void 0,dirty:C,busy:l,onChange:e=>v(`profile`,e),onRevert:()=>y(`profile`)})]}),(0,H.jsxs)(i3,{children:[(0,H.jsx)(Z,{variant:g>0?`primary`:`outline`,size:`sm`,"data-testid":`repository-settings-save`,loading:l,disabled:l||g===0,onClick:()=>void b(),children:`Save defaults`}),g===0?null:(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>c({}),children:`Discard`}),(0,H.jsx)(r3,{children:g>0?`${String(g)} unsaved ${g===1?`change`:`changes`}.`:m})]})]}),e===null?null:t??(0,H.jsx)(PQe,{repository:e}),e===null?null:(0,H.jsx)(fQe,{workspaceId:e.id})]})}var BQe={providers:OR,appearance:yxe,notifications:NL,images:hR,remote:dR,presets:_R,repositories:aR,account:AR};function VQe({active:e,sections:t,onNavigate:n,repositoryId:r}){return t.map(t=>{let i=t.id===e,a=t.icon??BQe[t.id]??DR;return(0,H.jsx)(s3,{asChild:!0,active:i,className:`min-h-9 min-w-0 gap-2.5 rounded-md px-3 py-2 text-po-text focus-visible:ring-2 focus-visible:ring-po-green data-[active=true]:text-po-green`,children:(0,H.jsxs)(Mx,{to:`/settings/$section`,params:{section:t.id},search:{workspace:r},"data-testid":`settings-section-${t.id}`,"aria-current":i?`page`:void 0,onClick:n,children:[(0,H.jsx)(a,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:`block min-w-0 truncate first-letter:uppercase`,children:t.label})]})},t.id)})}function HQe(e){let{workspace:t,sections:n,...r}=e,i=e=>e.contribution!==void 0||e.panel!==void 0&&e.panel.menuGroup!==`general`||e.repositoryPanel!==void 0;return[{label:t,sections:n.filter(e=>!i(e))},{label:`from plugins`,sections:n.filter(i)}].filter(e=>e.sections.length>0).map((e,t)=>(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5 ${t>0?`pt-5`:``}`,children:[(0,H.jsx)(P4,{className:`px-3 pb-2`,children:e.label}),(0,H.jsx)(VQe,{...r,sections:e.sections})]},e.label))}function u6({active:e,workspace:t,repositoryId:n}){let[r,i]=(0,V.useState)(!1),a=Kj(t),o=a.find(t=>t.id===e)??a[0],s=o?o.icon??BQe[o.id]??DR:TR;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`shrink-0 border-b border-po-border bg-po-panel/40 p-2 lg:hidden`,children:(0,H.jsxs)(Z,{variant:`outline`,size:`sm`,"data-testid":`settings-menu-open`,"aria-haspopup":`dialog`,"aria-expanded":r,onClick:()=>i(!0),className:`h-auto w-full justify-between gap-3 px-3 py-2 text-left whitespace-normal`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,H.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-po-green`}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-medium text-po-hi first-letter:uppercase`,children:o?.label??t}),(0,H.jsx)(`span`,{className:`truncate text-sm font-normal text-po-dim`,children:o?.detail})]})]}),(0,H.jsx)(UL,{className:`h-3.5 w-3.5 shrink-0 text-po-faint`})]})}),(0,H.jsx)(`nav`,{"data-testid":`settings-menu`,"aria-label":`${t} settings sections`,className:`hidden w-56 shrink-0 flex-col overflow-y-auto border-r border-po-border-soft px-3 py-6 lg:flex`,children:(0,H.jsx)(HQe,{active:e,workspace:t,sections:a,repositoryId:n})}),(0,H.jsx)(aq,{open:r,onOpenChange:i,children:(0,H.jsxs)(cq,{width:`lg`,"data-testid":`settings-menu-sheet`,"aria-describedby":void 0,className:`top-auto bottom-0 left-0 max-h-[min(72dvh,560px)] !w-full !max-w-none translate-x-0 translate-y-0 rounded-t-xl rounded-b-none border-x-0 border-b-0 data-[state=open]:animate-none lg:hidden`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-po-border`}),(0,H.jsx)(lq,{dismissible:!0,closeLabel:`close settings menu`,className:`py-2.5`,children:(0,H.jsxs)(uq,{className:`first-letter:uppercase`,children:[t,` settings`]})}),(0,H.jsx)(fq,{className:`gap-1 p-2 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:(0,H.jsx)(`nav`,{"aria-label":`${t} settings sections`,className:`flex flex-col`,children:(0,H.jsx)(HQe,{active:e,workspace:t,sections:a,repositoryId:n,onNavigate:()=>i(!1)})})})]})})]})}var UQe=`po.settings.repository`,WQe=(e,t)=>Ye.fetch(e,t);function GQe(){try{return localStorage.getItem(UQe)??``}catch{return``}}function KQe(e){try{localStorage.setItem(UQe,e)}catch{}}function qQe({current:e,initialRepositoryId:t,onRepositoryChange:n,onReady:r}){let i=U(gP,e=>e.order.join(`
|
|
144
144
|
`)),[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(()=>t??GQe()),[l,u]=(0,V.useState)(!0),d=(0,V.useMemo)(()=>a.find(e=>e.id===s)??null,[a,s]);(0,V.useEffect)(()=>{let e=!0;return u(!0),Cj().then(t=>{e&&(o(t),c(e=>{let n=t.some(t=>t.id===e)?e:t.find(e=>e.active)?.id??t[0]?.id??``;return n&&KQe(n),n}),u(!1))}),()=>{e=!1}},[i]),(0,V.useEffect)(()=>{if(l)return;let e=!1;return ik(s||null).then(()=>{e||r?.(!0)}).catch(e=>console.error(e)),()=>{e=!0}},[s,l,r]);let f=e=>{c(e),KQe(e),n?.(e)},p=e.repositoryPanel,m=p?.component,h=[{label:`Open`,items:a.filter(e=>e.active)},{label:`Recent`,items:a.filter(e=>!e.active)}].filter(e=>e.items.length>0);return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-3 border-b border-po-border-soft px-3 py-2.5 sm:px-5 lg:px-6`,children:[(0,H.jsxs)(F4,{value:s,disabled:l||a.length===0,onValueChange:f,children:[(0,H.jsx)(R4,{"data-testid":`repository-workspace-picker`,"aria-label":`Repository`,className:`w-48 shrink-0 text-sm font-medium sm:w-60`,children:(0,H.jsx)(L4,{placeholder:l?`Reading repositories…`:`Pick a repository`})}),(0,H.jsx)(z4,{children:h.map(e=>(0,H.jsxs)(I4,{children:[(0,H.jsx)(B4,{children:e.label}),e.items.map(e=>(0,H.jsx)(V4,{value:e.id,children:e.name},e.id))]},e.label))})]}),(0,H.jsx)(`span`,{title:d?.path,className:`min-w-0 flex-1 truncate font-mono text-sm text-po-dim`,children:d?.path}),(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"aria-label":`Refresh repositories`,title:`Refresh repositories`,loading:l,disabled:l,onClick:()=>{u(!0),Cj().then(e=>{o(e),u(!1)})},className:`shrink-0 text-po-dim`,children:(0,H.jsx)(CR,{"aria-hidden":!0,className:`size-4`})})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[(0,H.jsx)(u6,{active:e.id,workspace:`repository`,repositoryId:s}),(0,H.jsx)(`section`,{"data-testid":`settings-content`,className:`min-w-0 flex-1 overflow-y-auto px-3 py-3 sm:px-5 sm:py-5 lg:px-8`,children:(0,H.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-8`,children:[e.id===`repositories`?(0,H.jsx)(zQe,{repository:d}):null,e.contribution===void 0?null:(0,H.jsx)(Y3,{section:e.contribution,scope:`repository`,repoRoot:d?.path??``,workspaceId:d?.id}),p===void 0||m===void 0?null:(0,H.jsxs)(U4,{"data-testid":`repository-settings-panel-${p.pluginId}`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:p.label}),p.detail?(0,H.jsx)(K4,{children:p.detail}):null]}),(0,H.jsx)(m,{repository:d,request:WQe,requestWithStepUp:Pt})]})]})})]})]})}var JQe=(e,t)=>Ye.fetch(e,t);function YQe({panel:e}){let t=e.component;return(0,H.jsxs)(U4,{"data-testid":`settings-panel-${e.id}`,children:[(0,H.jsxs)(W4,{children:[(0,H.jsx)(G4,{children:e.label}),e.detail?(0,H.jsx)(K4,{children:e.detail}):null]}),(0,H.jsx)(t,{request:JQe,requestWithStepUp:Pt})]})}function XQe({tab:e,sessionId:t,active:n}){let r=(e.useBadge??ZQe)(t);return(0,H.jsx)(s3,{asChild:!0,active:n,children:(0,H.jsxs)(Mx,{to:`/session/$sessionId/$tabId`,params:{sessionId:t,tabId:e.id},"data-testid":`tab-${e.id}`,className:`shrink-0`,children:[e.label,r>0?(0,H.jsx)(c3,{active:n,"data-testid":`tab-${e.id}-count`,children:r}):null]})})}function ZQe(){return 0}function QQe({tab:e,sessionId:t,active:n}){return(0,H.jsxs)(`span`,{"data-testid":`tab-${e.id}-chip`,"data-active":n,className:`flex shrink-0 items-center gap-0.5`,children:[(0,H.jsx)(s3,{asChild:!0,active:n,children:(0,H.jsx)(Mx,{to:`/session/$sessionId/$tabId`,params:{sessionId:t,tabId:e.id},"data-testid":`tab-${e.id}`,title:e.label,className:`block min-w-0 max-w-[160px] truncate`,children:e.label})}),(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`tab-${e.id}-close`,title:`close this tab`,onClick:()=>jI(t,e.id),className:`h-5 w-5 shrink-0`,children:(0,H.jsx)(jR,{className:`h-2.5 w-2.5`})})]})}function $Qe({tab:e,sessionId:t}){let n=(e.useBadge??ZQe)(t);return n>0?(0,H.jsx)(c3,{className:`ml-auto`,children:n}):null}var d6=`min-h-11 data-[state=checked]:font-semibold data-[state=checked]:text-po-green`;function e$e({sessionId:e,view:t,mcpEnabled:n,transientTabs:r,onLock:i}){let a=Tx(),o=$_(e);return(0,H.jsxs)(hq,{children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"data-testid":`mobile-tabs-open`,title:`Show tabs`,"aria-label":`Show tabs`,className:`shrink-0 text-po-dim sm:hidden`,children:(0,H.jsx)(_R,{className:`size-4`})})}),(0,H.jsxs)(vq,{"data-testid":`mobile-tabs-menu`,className:`min-w-56 max-w-[calc(100vw-24px)]`,children:[(0,H.jsx)(wq,{children:`Tabs`}),(0,H.jsxs)(Sq,{value:t,onValueChange:t=>{a(t===`conversation`?{to:`/session/$sessionId`,params:{sessionId:e}}:{to:`/session/$sessionId/$tabId`,params:{sessionId:e,tabId:t}})},children:[(0,H.jsx)(Cq,{value:`conversation`,"data-testid":`mobile-tab-conversation`,className:d6,children:`Conversation`}),n?(0,H.jsx)(Cq,{value:`mcp`,"data-testid":`mobile-tab-mcp`,className:d6,children:`MCP`}):null,o.map(t=>(0,H.jsxs)(Cq,{value:t.id,"data-testid":`mobile-tab-${t.id}`,className:d6,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label}),(0,H.jsx)($Qe,{tab:t,sessionId:e})]},t.id)),r.map(e=>(0,H.jsx)(Cq,{value:e.id,"data-testid":`mobile-tab-${e.id}`,className:d6,children:(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label})},e.id))]}),i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Tq,{}),(0,H.jsxs)(bq,{"data-testid":`mobile-agent-lock`,onSelect:i,className:`min-h-11 pl-2`,children:[(0,H.jsx)(bR,{"aria-hidden":!0,className:`size-4 shrink-0`}),`Lock agent`]})]}):null]})]})}function t$e({view:e=`conversation`,mcpEnabled:t=!1,onShowSessions:n,onShowActivity:r,navigationToggle:i=`mobile`,activityToggle:a=`mobile`}){let o=xM(),s=oN(e=>e),c=U(q,e=>e.activeId),l=CM(),u=U(q,e=>e.tabOwnerId??e.activeId),d=NI(u),f=U(q,e=>u===null?void 0:e.byId[u]?.summary.name),p=U(aN(u),e=>e.agent?.sessionName),m=f||p||`Untitled`,[h,g]=gL(`session-title/${u}/open`,!1),[_,v]=gL(`session-title/${u}/draft`,``),y=Bv(s.statuses,s.widgets,c).some(e=>e.active),b=()=>{let e=_.trim();e&&e!==m&&HN(e,u),g(!1)},x=c!==null&&o?.summary.dormant!==!0&&!s.agentLocked?()=>NN(!0,c):void 0;return(0,H.jsxs)(`header`,{"data-testid":`top-bar`,className:`flex min-h-16 shrink-0 items-center justify-between gap-2 border-b border-po-border-soft px-3 py-2 sm:gap-3 sm:px-6`,children:[(0,H.jsxs)(`div`,{"data-testid":`session-switcher`,className:`flex min-w-0 flex-1 items-center gap-2 sm:gap-3`,children:[n?(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"data-testid":`mobile-sessions-open`,title:`Show sessions`,"aria-label":`Show sessions`,onClick:n,className:`shrink-0 text-po-dim ${i===`mobile`?`md:hidden`:``}`,children:(0,H.jsx)(aR,{className:`size-4`})}):null,l?null:h&&u!==null?(0,H.jsx)(zq,{"data-testid":`session-title-input`,value:_,autoFocus:!0,"aria-label":`Session name`,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&b(),e.key===`Escape`&&g(!1)},onBlur:b,className:`h-9 w-56 shrink-0 border-po-blue/60 px-1.5 text-lg font-semibold`}):(0,H.jsx)(Z,{variant:`ghost`,"data-testid":`session-title`,title:u===null?void 0:`Rename this session`,disabled:u===null,onClick:()=>{v(m),g(!0)},className:`block h-9 min-w-0 shrink truncate px-1.5 text-lg leading-9 font-semibold text-po-hi sm:max-w-80 sm:shrink-0`,children:m}),u===null?null:(0,H.jsxs)(`nav`,{"aria-label":`Conversation views`,className:`flex min-w-0 items-center gap-1 overflow-x-auto [scrollbar-width:none] max-sm:shrink-0 max-sm:[&>*:not([data-active=true])]:hidden [&::-webkit-scrollbar]:hidden [&>*]:min-h-8 [&>*]:rounded-md [&>*]:px-3`,children:[(0,H.jsx)(s3,{asChild:!0,active:e===`conversation`,children:(0,H.jsxs)(Mx,{to:`/session/$sessionId`,params:{sessionId:u},"data-testid":`tab-conversation`,className:`shrink-0 gap-1.5`,children:[(0,H.jsx)(xR,{"aria-hidden":!0,className:`size-4`}),`Conversation`]})}),t?(0,H.jsx)(s3,{asChild:!0,active:e===`mcp`,children:(0,H.jsx)(Mx,{to:`/session/$sessionId/$tabId`,params:{sessionId:u,tabId:`mcp`},"data-testid":`tab-mcp`,className:`shrink-0`,children:`MCP`})}):null,$_(u).map(t=>(0,H.jsx)(XQe,{tab:t,sessionId:u,active:e===t.id},t.id)),d.map(t=>(0,H.jsx)(QQe,{tab:t,sessionId:u,active:e===t.id},t.id))]})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[x?(0,H.jsxs)(Z,{variant:`ghost`,"data-testid":`agent-lock`,size:`lg`,title:`Stop the local agent and keep it from starting turns`,onClick:x,className:`hidden shrink-0 gap-2 text-po-text sm:inline-flex`,children:[(0,H.jsx)(bR,{className:`size-4`}),`Lock agent`]}):null,u===null?null:(0,H.jsx)(e$e,{sessionId:u,view:e,mcpEnabled:t,transientTabs:d,onLock:x}),r?(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"data-testid":`mobile-activity-open`,"data-active":y,title:y?`Background work is running`:`Show activity`,"aria-label":`Show activity`,onClick:r,className:`shrink-0 ${a===`mobile`?`lg:hidden`:``} ${y?`text-po-yellow`:`text-po-dim`}`,children:(0,H.jsx)(EL,{className:`size-4`})}):null]})]})}var n$e=t({AccountSettings:()=>mZe,ActivityDock:()=>qJe,AppearanceSettings:()=>yZe,ClientDevices:()=>CZe,CommandPalette:()=>iYe,Composer:()=>O3,ComposerPrompt:()=>TYe,ContextItemDialog:()=>jJe,ContextPanel:()=>RJe,ContextPanelView:()=>zJe,ContributedSettings:()=>Y3,DashboardTileGrid:()=>fJe,DevProxyTargets:()=>aYe,DialogOverlay:()=>$Je,DockTabs:()=>UJe,DormantPanel:()=>EYe,HomePage:()=>mJe,HomeView:()=>m3,HostsSettings:()=>nQe,ImageSettings:()=>jZe,LoginFlowDialog:()=>FZe,METHOD_LABEL:()=>MZe,MascotMark:()=>_Je,MentionPreviewAsset:()=>VYe,MentionPreviews:()=>GYe,MessageMarkdown:()=>A3,ModelPopup:()=>SYe,NewSessionDialog:()=>G3,NewSessionDialogView:()=>rZe,NotificationSettings:()=>RZe,PairedDeviceList:()=>C3,PairingApprovalDialog:()=>oYe,PluginPage:()=>vJe,PluginSurface:()=>h3,PresetSettings:()=>BZe,ProviderSettings:()=>ZZe,QrCode:()=>bJe,QueueSheet:()=>DYe,RefusedCard:()=>QJe,RemoteAccessDialog:()=>mYe,RemoteAccessOptions:()=>fYe,RemoteAccessPairing:()=>pYe,RemoteControlSettings:()=>uQe,RepositorySettings:()=>zQe,RepositoryWorkspace:()=>qQe,ResumeSessionDialog:()=>q3,SelectionBar:()=>CYe,SessionActivity:()=>YYe,SessionMcp:()=>kJe,SessionMcpSettings:()=>oQe,SessionMcpTools:()=>AJe,SessionRailDialogs:()=>cZe,SessionTranscriptView:()=>$Xe,SettingsMenu:()=>u6,SettingsPanelHost:()=>YQe,TemplateSettings:()=>gZe,ThreadView:()=>tZe,Timeline:()=>ZXe,ToolCard:()=>M3,ToolRendererBoundary:()=>Mk,TopBar:()=>t$e,Transcript:()=>U3,TrustedDeviceList:()=>lYe,TrustedDeviceListView:()=>cYe,TunnelSettings:()=>lQe,WelcomePanel:()=>lZe,WorkspacePage:()=>gJe,WorkspaceView:()=>hJe,addComposerFiles:()=>LYe,appearedFaces:()=>GJe,hostKeyFor:()=>eQe,isQuickTunnel:()=>$Ze,nestedToolCard:()=>iXe,readComposerFiles:()=>IYe,sessionActivity:()=>JYe,useNewSessionActions:()=>W3,useSessionRail:()=>pZe});function r$e(e){return e.slice(e.lastIndexOf(`/`)+1)||e}function i$e({start:e,listDirectory:t,onSelect:n}){let[r,i]=(0,V.useState)(e),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(``);return(0,V.useEffect)(()=>{let e=!1;return t(r).then(t=>{e||(`error`in t?c(t.error):(c(``),o(t)))}),()=>{e=!0}},[r,t]),(0,H.jsxs)(`div`,{"data-testid":`folder-browser`,className:`flex flex-col gap-1 rounded border border-po-border bg-po-deep p-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1 px-1`,children:[(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`folder-browser-up`,title:`parent folder`,"aria-label":`parent folder`,disabled:a?.parent===void 0,onClick:()=>a?.parent!==void 0&&i(a.parent),children:(0,H.jsx)(UL,{className:`h-3 w-3`})}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-po-dim`,title:a?.path,children:a?.path??`loading…`}),(0,H.jsx)(Z,{variant:`outline`,size:`xs`,"data-testid":`folder-browser-select`,disabled:a===null,onClick:()=>a!==null&&n(a.path),children:`use this folder`})]}),s?(0,H.jsx)(`p`,{className:`px-2 py-1 text-sm text-po-red`,children:s}):null,(0,H.jsxs)(`div`,{role:`listbox`,"aria-label":`folders`,className:`max-h-40 overflow-y-auto`,children:[a!==null&&a.directories.length===0?(0,H.jsx)(`p`,{className:`px-2 py-1 text-sm text-po-dim`,children:`no folders here`}):null,a?.directories.map(e=>(0,H.jsx)(Kq,{density:`compact`,"data-testid":`folder-browser-entry`,onClick:()=>i(e),className:`w-full px-2.5 py-1 `,children:r$e(e)},e))]})]})}var a$e=120,f6=-1,o$e=/\/+$/u;function s$e(e){let t=e.trim().replace(o$e,``);return t.slice(t.lastIndexOf(`/`)+1)}function c$e({suggestedPaths:e,actions:t}){let n=U(YI,e=>e),r=n.path??e[0]??``,[i,a]=(0,V.useState)({path:``,directories:[]});return(0,V.useEffect)(()=>{let e=r.trim();if(e===``)return;let n=!1,i=setTimeout(async()=>{let i=await t.searchDirectories(e);n||a({path:r,directories:i.filter(t=>t!==e)})},a$e);return()=>{n=!0,clearTimeout(i)}},[r,t]),(0,V.useEffect)(()=>$I(r,t.discoverWorkspaces),[r,t.discoverWorkspaces]),(0,H.jsx)(l$e,{suggestions:r.trim()!==``&&i.path===r?i.directories:[],suggestedPaths:e,actions:t,draft:n,updateDraft:XI})}function l$e({suggestedPaths:e,actions:t,draft:n,updateDraft:r,style:i,suggestions:a=[]}){let{name:o,nameEdited:s,instructions:c,pending:l,error:u,discovery:d}=n,f=n.path??e[0]??``,p=e=>r({name:e}),m=e=>r({nameEdited:e}),h=e=>r({path:e}),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(f6),b=(0,V.useRef)(null),x=s?o:s$e(f),S=e=>{l||(h(e),y(f6))},C=e=>{S(`${e}/`),b.current?.focus()},w=f.trim().replace(o$e,``)||(f.trim()===``?``:`/`),T=n.discovering||!!f.trim()&&t.discoverWorkspaces!==void 0&&n.discoveryPath!==f,E=d&&`error`in d?d.error:``,D=d&&`declarations`in d&&d.declarations.length>0?d.declarations:void 0,O=e=>D?.find(t=>t.name===e)?.workspaceId??n.results.find(t=>t.name===e)?.workspaceId,k=D?.filter(e=>n.checked.includes(e.name)&&!O(e.name)).map(e=>e.name)??[],A=!D&&!T&&!E,j=!l&&!T&&!E&&(D?k.length>0&&t.addDeclaredWorkspaces!==void 0:w!==``||x.trim()!==``),M=async()=>{j&&(D?await t.addDeclaredWorkspaces?.({path:d&&`root`in d?d.root:w,names:k}):await t.addWorkspace({...c===``?{}:{instructions:c},name:x.trim(),...w===``?{}:{path:w}}))};return(0,H.jsx)(aq,{open:!0,onOpenChange:e=>!e&&!l&&t.closeAddWorkspace(),children:(0,H.jsxs)(cq,{style:i,width:`md`,"data-testid":`add-workspace-dialog`,"aria-describedby":void 0,children:[(0,H.jsx)(lq,{children:(0,H.jsx)(uq,{children:`Add workspace`})}),(0,H.jsxs)(fq,{children:[(0,H.jsxs)(`label`,{htmlFor:`add-workspace-root`,className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-base font-medium text-po-dim`,children:`Folder`}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(zq,{id:`add-workspace-root`,ref:b,"data-testid":`add-workspace-root`,value:f,autoFocus:!0,disabled:l,onChange:e=>S(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`&&a.length>0)e.preventDefault(),y(e=>(e+1)%a.length);else if(e.key===`ArrowUp`&&a.length>0)e.preventDefault(),y(e=>e<=0?a.length-1:e-1);else if(e.key===`Enter`){let e=v===f6?void 0:a[v];e===void 0?M():C(e)}},placeholder:`~/workspace/my-project`,className:`min-w-0 flex-1 font-mono`}),(0,H.jsx)(Z,{variant:g?`subtle`:`outline`,size:`md`,"data-testid":`add-workspace-browse`,"aria-pressed":g,disabled:l,onClick:()=>_(e=>!e),children:`Browse`})]})]}),g?(0,H.jsx)(i$e,{...w.startsWith(`/`)?{start:w}:{},listDirectory:t.listDirectory,onSelect:e=>{S(e),_(!1)}}):a.length>0?(0,H.jsx)(`div`,{role:`listbox`,"aria-label":`matching directories`,"data-testid":`add-workspace-suggestions`,className:`max-h-40 overflow-y-auto rounded border border-po-border bg-po-deep p-1`,children:a.map((e,t)=>(0,H.jsx)(Kq,{density:`compact`,active:t===v,"data-testid":`add-workspace-suggestion`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>y(t),onClick:()=>C(e),className:`w-full px-2.5 py-1 `,children:e},e))}):null,e.length>0?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.slice(0,4).map(e=>(0,H.jsx)(Z,{variant:`outline`,size:`xs`,disabled:l,onClick:()=>S(e),children:e},e))}):null,T?(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Reading workspace declarations…`}):null,E?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-po-red`,children:E}):null,D?(0,H.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,H.jsx)(`legend`,{className:`mb-1 text-base font-medium text-po-hi`,children:`Workspaces`}),(0,H.jsx)(`p`,{className:`mb-1 text-sm text-po-dim`,children:`Declared in .po/config.yaml. Choose which to add.`}),D.map((e,t)=>{let i=O(e.name)!==void 0,a=i||n.checked.includes(e.name),o=n.results.find(t=>t.name===e.name)?.error;return(0,H.jsx)(`div`,{"data-checked":a,className:`rounded-sm px-2 py-1.5 data-[checked=true]:bg-po-tint-green`,children:(0,H.jsxs)(`label`,{htmlFor:`add-workspace-declaration-${t}`,className:`flex min-w-0 cursor-pointer items-start gap-2.5`,children:[(0,H.jsx)(Eq,{id:`add-workspace-declaration-${t}`,checked:a,disabled:i||l,onCheckedChange:()=>r({checked:a?n.checked.filter(t=>t!==e.name):[...n.checked,e.name]}),className:`mt-1`}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:`text-base font-semibold text-po-hi`,children:e.name}),(0,H.jsx)(`span`,{className:`truncate text-sm text-po-dim`,title:e.instructions,children:e.instructions}),o?(0,H.jsx)(`span`,{role:`alert`,className:`text-sm text-po-red`,children:o}):null]}),i?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`Added`}):null]})},e.name)})]}):A?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{htmlFor:`add-workspace-name`,className:`flex flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-base font-medium text-po-dim`,children:`Name`}),(0,H.jsx)(zq,{id:`add-workspace-name`,"data-testid":`add-workspace-name`,value:x,disabled:l,onChange:e=>{m(!0),p(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&M()},placeholder:`my-project`})]}),(0,H.jsxs)(`label`,{htmlFor:`add-workspace-instructions`,className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`span`,{className:`text-base font-medium text-po-dim`,children:[`Instructions `,(0,H.jsx)(`span`,{className:`font-normal`,children:`(optional)`})]}),(0,H.jsx)(N4,{id:`add-workspace-instructions`,rows:3,value:c,disabled:l,onChange:e=>r({instructions:e.target.value})}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:`For main sessions in this workspace.`})]})]}):null,A&&w===``&&x.trim()!==``?(0,H.jsxs)(`p`,{"data-testid":`add-workspace-default-hint`,className:`text-sm text-po-dim`,children:[`creates ~/.po/workspace/`,x.trim()]}):null,u?(0,H.jsx)(`pre`,{className:`max-h-28 overflow-y-auto rounded border border-po-edge-red bg-po-tint-red/40 px-2.5 py-2 text-sm whitespace-pre-wrap text-po-red`,children:u}):null,(0,H.jsxs)(mq,{children:[(0,H.jsx)(Z,{variant:`outline`,onClick:()=>t.closeAddWorkspace(),disabled:l,children:`Cancel`}),(0,H.jsx)(Z,{variant:`primary`,"data-testid":`add-workspace-confirm`,onClick:()=>void M(),disabled:!j,children:l?`Adding…`:D?`Add ${k.length} ${k.length===1?`workspace`:`workspaces`}`:`Add workspace`})]})]})]})})}var u$e=e=>e.awaitingInput||(e.waitingCount??0)>0;function d$e(e){let t=[...e].sort((e,t)=>(t.session.lastActivityAt??0)-(e.session.lastActivityAt??0));return[{key:`needs`,title:`Needs you`,data:t.filter(({session:e})=>u$e(e))},{key:`recent`,title:`Recent`,data:t.filter(({session:e})=>!u$e(e))}].filter(e=>e.data.length>0)}function f$e({sessionId:e,setup:t,actions:n}){let r=JSON.stringify([`rail/setup`,e,t.id]),[i,a,o]=gL(`${r}/busy`,!1),[s,c]=gL(`${r}/error`,``),l=async()=>{if(o.state)return;a(!0),c(``);let r=await n.removePendingSetup(e,t.id);a(!1),r!==void 0&&c(r.error)};return(0,H.jsxs)(`div`,{"data-testid":`pending-session-${t.id}`,className:`ml-4 rounded-md border border-po-border-soft bg-po-panel p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:t.name}),(0,H.jsxs)(hq,{children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,title:`session setup actions`,disabled:i,"data-testid":`pending-session-menu-${t.id}`,children:(0,H.jsx)($L,{className:`h-3 w-3`})})}),(0,H.jsx)(vq,{children:(0,H.jsx)(bq,{variant:`destructive`,onSelect:()=>void l(),children:`remove setup`})})]})]}),(0,H.jsx)(`p`,{className:t.failed?`text-sm text-po-red`:`text-sm text-po-dim`,children:t.status}),t.recovery?(0,H.jsx)(`p`,{role:t.failed?`alert`:void 0,className:`text-sm text-po-dim`,children:t.recovery}):null,s?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-po-red`,children:s}):null]})}function p$e(e,t,n=[]){return[...new Set([...e.flatMap(e=>e.groups??[]),...n])].map(n=>({name:n,members:e.filter(e=>e.id!==t&&e.groups?.includes(n)===!0).map(e=>e.name||`Untitled`)}))}function p6(e,t){if(e.length>32)return`group names are at most 32 characters.`;if(t>=8)return`a session can belong to at most 8 groups.`}function m$e({groups:e}){return(0,H.jsxs)(`span`,{"data-testid":`session-groups`,"aria-label":`groups`,className:`flex min-w-0 items-start gap-1.5 text-sm text-po-dim`,children:[(0,H.jsx)(Qxe,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`flex min-w-0 flex-wrap gap-1`,children:e.map(e=>(0,H.jsx)(XK,{tone:`magenta`,size:`xs`,className:`font-normal`,children:e},e))})]})}function h$e({options:e,value:t,query:n,active:r,renaming:i,deleting:a,error:o,busy:s=!1,onQueryChange:c,onToggle:l,onCreate:u,onActive:d,onRenameStart:f,onRenameDraft:p,onRenameConfirm:m,onDeleteStart:h,onDeleteConfirm:g,onRowCancel:_,onCancel:v,onSave:y}){let b=(0,V.useId)(),x=n.trim(),S=e.filter(e=>e.name.includes(x)),C=x!==``&&!e.some(e=>e.name===x),w=C?p6(x,t.length):void 0;return(0,H.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,H.jsx)(dq,{children:`sessions that share a group can message each other.`}),(0,H.jsxs)(`div`,{className:`flex flex-col overflow-hidden rounded-md border border-po-border focus-within:border-po-edge-green`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 bg-po-deep px-2 py-1.5`,children:[t.map(e=>(0,H.jsxs)(XK,{tone:`magenta`,size:`xs`,className:`font-normal`,children:[e,(0,H.jsx)(`button`,{type:`button`,"aria-label":`remove ${e}`,className:`text-po-magenta`,onClick:()=>l(e),children:(0,H.jsx)(jR,{"aria-hidden":!0,className:`size-2.5`})})]},e)),(0,H.jsx)(zq,{variant:`bare`,"data-testid":`session-groups-query`,"aria-label":`find or create a group`,autoFocus:!0,placeholder:t.length===0?`find or create a group`:`add another`,value:n,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&x!==``&&(e.preventDefault(),C?w===void 0&&u():S[0]!==void 0&&(l(S[0].name),c(``)))},className:`h-6 min-w-24 flex-1`})]}),(0,H.jsxs)(`div`,{className:`flex flex-col border-t border-po-border-soft p-1`,onMouseLeave:()=>d(void 0),children:[S.map((e,n)=>{let o=t.includes(e.name),c=`${b}-${String(n)}`,u=e.members.length+ +!!o,v=u===1?`its one session`:`all ${String(u)} sessions`;return i?.group===e.name?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-sm bg-po-deep px-2 py-1.5`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(zq,{"aria-label":`rename ${e.name}`,value:i.draft,autoFocus:!0,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),m())},className:`h-7 flex-1`}),(0,H.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:_,children:`cancel`}),(0,H.jsx)(Z,{type:`button`,variant:`outline`,size:`sm`,disabled:s||i.draft.trim()===``,onClick:m,children:`rename`})]}),(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[`renames it on `,v,`.`]})]},e.name):a===e.name?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-sm border border-po-red/40 px-2 py-1.5`,children:[(0,H.jsxs)(`span`,{className:`flex-1 text-sm text-po-text`,children:[`remove `,(0,H.jsx)(`span`,{className:`font-semibold text-po-hi`,children:e.name}),` from `,v,`? they can no longer message through it.`]}),(0,H.jsx)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:_,children:`cancel`}),(0,H.jsx)(Z,{type:`button`,variant:`danger`,size:`sm`,disabled:s,onClick:g,children:`delete`})]},e.name):(0,H.jsxs)(`div`,{"data-testid":`session-group-${e.name}`,onMouseEnter:()=>d(e.name),className:`group flex items-start gap-2.5 rounded-sm px-2 py-1.5 ${o?`bg-po-tint-green`:r===e.name?`bg-po-deep`:``}`,children:[(0,H.jsxs)(`label`,{htmlFor:c,className:`flex min-w-0 flex-1 cursor-pointer items-start gap-2.5`,children:[(0,H.jsx)(Eq,{id:c,checked:o,onCheckedChange:()=>l(e.name),className:`mt-1`}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:`text-base ${o?`font-semibold text-po-hi`:`text-po-text`}`,children:e.name}),(0,H.jsx)(`span`,{className:`truncate text-sm text-po-dim`,title:e.members.join(`, `),children:e.members.length===0?`no other sessions yet`:e.members.join(`, `)})]})]}),(0,H.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 ${r===e.name?`opacity-100`:`opacity-0 group-focus-within:opacity-100`}`,children:[(0,H.jsx)(Z,{type:`button`,variant:`ghost`,size:`icon`,title:`rename ${e.name}`,onClick:()=>f(e.name),children:(0,H.jsx)(Cxe,{"aria-hidden":!0,className:`size-3.5`})}),(0,H.jsx)(Z,{type:`button`,variant:`ghost`,size:`icon`,title:`delete ${e.name}`,onClick:()=>h(e.name),children:(0,H.jsx)(kR,{"aria-hidden":!0,className:`size-3.5`})})]})]},e.name)}),C?(0,H.jsxs)(`button`,{type:`button`,"data-testid":`session-groups-create`,disabled:w!==void 0,onClick:u,className:`flex flex-col gap-0.5 rounded-sm px-2 py-1.5 text-left ${w===void 0?`bg-po-deep`:``}`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2.5 text-base ${w===void 0?`text-po-magenta`:`text-po-faint`}`,children:[(0,H.jsx)(SR,{"aria-hidden":!0,className:`size-3.5`}),(0,H.jsxs)(`span`,{className:`truncate`,children:[`create group “`,x,`”`]})]}),w===void 0?null:(0,H.jsx)(`span`,{className:`pl-6 text-sm text-po-red`,children:w})]}):null]})]}),(0,H.jsxs)(`span`,{className:`text-sm text-po-dim`,children:[t.length,` of `,8,` groups`]}),o===void 0?null:(0,H.jsx)(`span`,{"data-testid":`session-groups-error`,className:`text-sm text-po-red`,children:o}),(0,H.jsxs)(mq,{children:[(0,H.jsx)(Z,{type:`button`,variant:`outline`,size:`md`,onClick:v,children:`cancel`}),(0,H.jsx)(Z,{type:`submit`,variant:`primary`,size:`md`,disabled:s,children:`save`})]})]})}function g$e({session:e,sessions:t,actions:n,onClose:r}){let[i,a]=(0,V.useState)(()=>[...e.groups??[]]),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(),[u,d]=(0,V.useState)(),[f,p]=(0,V.useState)(),[m,h]=(0,V.useState)(),[g,_]=(0,V.useState)(!1),v=async(e,t)=>{_(!0),h(void 0);let n=await e();_(!1),n===void 0?t():h(n.error)},y=()=>{d(void 0),p(void 0)};return(0,H.jsx)(aq,{open:!0,onOpenChange:e=>!e&&!g&&r(),children:(0,H.jsxs)(cq,{width:`sm`,"data-testid":`session-groups-dialog-${e.id}`,"aria-describedby":void 0,children:[(0,H.jsx)(lq,{children:(0,H.jsx)(uq,{children:`session groups`})}),(0,H.jsx)(fq,{children:(0,H.jsx)(h$e,{options:p$e(t,e.id,i),value:i,query:o,active:c,renaming:u,deleting:f,error:m,busy:g,onQueryChange:s,onToggle:e=>{h(void 0),i.includes(e)?a(i.filter(t=>t!==e)):i.length>=8?h(p6(``,i.length)):a([...i,e])},onCreate:()=>{let e=o.trim();e!==``&&p6(e,i.length)===void 0&&(a([...i,e]),s(``))},onActive:l,onRenameStart:e=>{p(void 0),d({group:e,draft:e})},onRenameDraft:e=>d(t=>t===void 0?t:{...t,draft:e}),onRenameConfirm:()=>{if(u===void 0)return;let e=u.draft.trim();e===``||e===u.group?y():v(()=>n.renameGroup(u.group,e),()=>{a(t=>[...new Set(t.map(t=>t===u.group?e:t))]),y()})},onDeleteStart:e=>{d(void 0),p(e)},onDeleteConfirm:()=>{f!==void 0&&v(()=>n.deleteGroup(f),()=>{a(e=>e.filter(e=>e!==f)),y()})},onRowCancel:y,onCancel:r,onSave:()=>void v(()=>n.setSessionGroups(e.id,i),r)})})]})})}function _$e(e=[],t=[]){return e.length===t.length&&e.every((e,n)=>e===t[n])}function v$e(e){return e.filter(e=>e.groups!==void 0&&e.groups.length>0)}function y$e(e,t){if(e.session!==t.session||e.actions!==t.actions||e.workspaceName!==t.workspaceName||e.readOnly!==t.readOnly)return!1;let n=v$e(e.sessions),r=v$e(t.sessions);return n.length===r.length&&n.every((e,t)=>{let n=r[t];return e.id===n.id&&e.name===n.name&&_$e(e.groups,n.groups)})}function b$e({session:e,className:t}){let n=e.waitingCount??+!!e.awaitingInput;return n<=0?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(c3,{ask:!0,"aria-hidden":!0,"data-testid":`session-awaiting-input`,className:t,children:n}),(0,H.jsxs)(`span`,{className:`sr-only`,children:[`, `,n,` waiting for you`]})]})}var m6=(0,V.memo)(function({session:e,sessions:t,actions:n,workspaceName:r,readOnly:i=!1}){let a=`rail/session/${e.id}`,[o,s]=gL(`${a}/mode`,`view`),[c,l]=gL(`${a}/draft`,``),[u,d]=gL(`${a}/error`,``),[,f,p]=gL(`${a}/removing`,!1),m=(0,V.useRef)(o),h=e=>{m.current=e,s(e)},{active:g}=e,_=u||e.error,v=g?`rounded-lg border border-po-edge-green bg-po-tint-green px-3 py-3 hover:bg-po-tint-green`:`rounded-lg border border-transparent px-3 py-3 hover:bg-po-panel`,y=()=>{n.renameSession(e.id,c),h(`view`)},b=async()=>{if(p.state)return;f(!0),h(`view`),d(``);let t=await n.removeSession(e.id);f(!1),t!==void 0&&d(t.error)},x=e.status.startsWith(`failed`)||e.status.includes(` failed`),S=e.status.startsWith(`running`),C=(0,H.jsxs)(`span`,{className:`flex min-w-0 items-start gap-1.5 text-sm leading-snug ${x?`text-po-red`:S?`text-po-yellow`:g?`text-po-text`:`text-po-dim`}`,children:[S?(0,H.jsx)(yR,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0 animate-spin`}):x?(0,H.jsx)(GL,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}):null,e.clock?(0,H.jsx)(hqe,{"data-testid":`session-status`,className:g?`line-clamp-2`:`truncate`,label:e.clock.label,since:e.clock.since}):(0,H.jsx)(`span`,{"data-testid":`session-status`,className:g?`line-clamp-2`:`truncate`,children:e.status})]}),w=(0,H.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[e.nested&&e.provenance===`workflow-session`?(0,H.jsx)(EL,{"aria-label":`workflow session`,className:`mt-1 size-3 shrink-0 ${g?`text-po-green`:`text-po-faint`}`}):e.nested&&e.provenance?(0,H.jsx)(lR,{"aria-label":e.provenance===`worktree`?`automatic per-conversation worktree`:e.provenance,className:`mt-1 size-3 shrink-0 ${g?`text-po-green`:`text-po-faint`}`}):null,(0,H.jsx)(`span`,{className:`min-w-0 flex-1 text-base font-semibold break-words text-po-hi`,children:e.name||`Untitled`}),(e.waitingCount??+!!e.awaitingInput)>0?(0,H.jsx)(b$e,{session:e,className:`mt-0.5 shrink-0 transition-opacity group-focus-within:opacity-0 group-hover:opacity-0`}):e.ordinal<=9?(0,H.jsx)(`span`,{title:`press ${String(e.ordinal)} to focus`,className:`grid size-5 shrink-0 place-items-center rounded-full bg-po-panel text-2xs text-po-dim transition-opacity group-focus-within:opacity-0 group-hover:opacity-0`,children:e.ordinal}):null]}),T=(0,H.jsxs)(H.Fragment,{children:[w,(0,H.jsxs)(`span`,{className:`flex w-full min-w-0 items-end gap-2`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[C,r?(0,H.jsxs)(`span`,{"data-testid":`session-workspace`,className:`flex min-w-0 items-center gap-1.5 text-sm text-po-dim`,children:[(0,H.jsx)(aR,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate`,children:r})]}):null,e.git?(0,H.jsxs)(`span`,{"data-testid":`session-branch`,className:`flex min-w-0 items-center gap-1.5 text-sm text-po-dim`,children:[(0,H.jsx)(sR,{className:`size-3.5 shrink-0 ${g?`text-po-green`:``}`}),(0,H.jsx)(`span`,{className:`truncate font-mono`,children:e.git.branch}),e.git.dirty?(0,H.jsx)(`span`,{className:`shrink-0 text-po-yellow`,children:`modified`}):null]}):null]}),e.profile?(0,H.jsxs)(RK,{"data-testid":`session-avatar`,"aria-label":e.profile.label,title:e.profile.label,className:`size-8 shrink-0 rounded-full`,children:[e.profile.avatarUrl?(0,H.jsx)(zK,{src:e.profile.avatarUrl,alt:``}):null,(0,H.jsx)(BK,{className:`bg-po-tint-green text-xs font-semibold text-po-green`,children:e.profile.initials})]}):null]}),e.groups!==void 0&&e.groups.length>0?(0,H.jsx)(m$e,{groups:e.groups}):null,_?(0,H.jsx)(`span`,{"data-testid":`session-error`,className:`line-clamp-3 text-sm break-words text-po-red`,children:_}):null]}),E=o===`menu`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:J(`group relative`,e.nested&&`pl-5`),"data-testid":`session-card-${e.id}`,"data-active":g,"data-nested":e.nested,children:[(0,H.jsx)(Z,{variant:`ghost`,size:`card`,"data-testid":`session-open-${e.id}`,onClick:()=>n.openSession(e.id),className:v,children:T}),!i&&(o===`view`||E)?(0,H.jsx)(`div`,{className:`absolute top-2 right-2 transition-opacity ${E?`opacity-100`:`opacity-0 group-focus-within:opacity-100 group-hover:opacity-100`}`,children:(0,H.jsxs)(hq,{open:E,onOpenChange:e=>{let t=m.current;h(e?`menu`:t===`menu`?`view`:t)},children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`session-menu-${e.id}`,title:`session actions`,className:g?`text-po-dim hover:bg-po-tint-green hover:text-po-hi data-[state=open]:bg-po-tint-green data-[state=open]:text-po-hi`:`text-po-faint hover:bg-po-deep hover:text-po-hi data-[state=open]:bg-po-deep data-[state=open]:text-po-hi`,children:(0,H.jsx)($L,{className:`h-3 w-3`})})}),(0,H.jsxs)(vq,{"data-testid":`session-menu-list-${e.id}`,onCloseAutoFocus:e=>{m.current!==`view`&&e.preventDefault()},children:[n.renderSessionMenuItems(e.id),(0,H.jsx)(bq,{"data-testid":`session-rename-${e.id}`,onSelect:()=>{l(e.name),h(`rename`)},children:`Rename`}),(0,H.jsx)(bq,{"data-testid":`session-groups-${e.id}`,onSelect:()=>h(`groups`),children:`Groups`}),(0,H.jsx)(bq,{"data-testid":`session-resume-${e.id}`,onSelect:()=>n.resumeSession(e.id),children:`Resume`}),(0,H.jsx)(bq,{"data-testid":`session-restart-${e.id}`,disabled:e.restarting||e.restartBlocked===!0,onSelect:()=>n.restartSession(e.id),children:`Restart`}),(0,H.jsx)(bq,{variant:`destructive`,"data-testid":`session-stop-${e.id}`,onSelect:()=>h(`confirm`),children:`Remove`})]})]})}):null,(0,H.jsx)(aq,{open:o===`rename`,onOpenChange:e=>!e&&h(`view`),children:(0,H.jsxs)(cq,{width:`sm`,"data-testid":`session-rename-dialog-${e.id}`,"aria-describedby":void 0,children:[(0,H.jsx)(lq,{children:(0,H.jsx)(uq,{children:`rename session`})}),(0,H.jsx)(fq,{children:(0,H.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,H.jsx)(zq,{"data-testid":`session-name-input-${e.id}`,"aria-label":`session name`,value:c,autoFocus:!0,onChange:e=>l(e.target.value)}),(0,H.jsxs)(mq,{children:[(0,H.jsx)(Z,{type:`button`,variant:`outline`,size:`md`,"data-testid":`session-rename-cancel-${e.id}`,onClick:()=>h(`view`),children:`cancel`}),(0,H.jsx)(Z,{type:`submit`,variant:`primary`,size:`md`,"data-testid":`session-rename-confirm-${e.id}`,disabled:c.trim()===``,children:`rename`})]})]})})]})}),o===`groups`?(0,H.jsx)(g$e,{session:e,sessions:t,actions:n,onClose:()=>h(`view`)}):null,(0,H.jsx)(aq,{open:o===`confirm`,onOpenChange:e=>!e&&h(`view`),children:(0,H.jsxs)(cq,{width:`sm`,"data-testid":`session-stop-dialog-${e.id}`,"aria-describedby":void 0,children:[(0,H.jsx)(lq,{children:(0,H.jsx)(uq,{children:`remove session`})}),(0,H.jsxs)(fq,{children:[(0,H.jsxs)(dq,{children:[`this stops `,(0,H.jsx)(`span`,{className:`font-semibold text-po-hi`,children:e.name||`untitled`}),` and removes it from the rail. anything it is running ends now. you can restore it for 7 days.`]}),(0,H.jsxs)(mq,{children:[(0,H.jsx)(Z,{variant:`outline`,size:`md`,"data-testid":`session-stop-cancel-${e.id}`,autoFocus:!0,onClick:()=>h(`view`),children:`cancel`}),(0,H.jsx)(Z,{variant:`danger`,size:`md`,"data-testid":`session-stop-confirm-${e.id}`,onClick:()=>void b(),children:`remove`})]})]})]})})]}),e.pendingSetups.map(t=>(0,H.jsx)(f$e,{sessionId:e.id,setup:t,actions:n},`setup:${t.id}`))]})},y$e);function x$e({workspace:e,sessions:t,actions:n,quiet:r=!1,readOnly:i=!1}){let a=`rail/workspace/${e.id}`,[o,s]=gL(`${a}/open`,!1),[c,l]=gL(`${a}/error`,``),[u,d,f]=gL(`${a}/removing`,!1),{id:p,name:m,root:h,available:g,legacy:_}=e;if(e.kind===`session`)return e.sessions.length===0?null:(0,H.jsx)(`div`,{"data-testid":`session-group-${p}`,className:`flex flex-col gap-1`,children:e.sessions.map(e=>(0,H.jsx)(m6,{session:e,sessions:t,actions:n,readOnly:i},e.id))});let v=async()=>{if(f.state)return;d(!0),l(``);let e=await n.deleteWorkspace(p);d(!1),e===void 0?s(!1):l(e.error)};return(0,H.jsxs)(`section`,{"data-testid":`workspace-group-${p}`,"data-available":g,className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5 rounded-md px-2 py-1 transition-colors hover:bg-po-panel/60`,children:[r?null:(0,H.jsx)(aR,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-po-dim`}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[!_&&n.openWorkspace?(0,H.jsx)(`button`,{type:`button`,"data-testid":`workspace-open-${p}`,onClick:()=>n.openWorkspace?.(p),className:`truncate rounded-sm text-left text-base text-po-hi outline-none focus-visible:ring-2 focus-visible:ring-po-green/50 ${r?`font-medium`:`font-semibold`}`,title:r?h:`Open ${m} workspace`,children:m}):(0,H.jsx)(`p`,{className:`truncate text-base text-po-hi ${r?`font-medium`:`font-semibold`}`,title:r?h:void 0,children:m}),r?null:(0,H.jsx)(`p`,{className:`truncate font-mono text-sm text-po-dim`,title:h,children:h})]}),_||i?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`workspace-new-session-${p}`,title:`New session`,"aria-label":`New session in ${m}`,disabled:!g,onClick:()=>n.createSession(p),className:`text-po-faint hover:text-po-hi`,children:(0,H.jsx)(SR,{className:`size-3.5`})}),(0,H.jsxs)(hq,{children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`workspace-menu-${p}`,title:`Workspace actions`,"aria-label":`${m} actions`,className:`text-po-faint hover:text-po-hi`,children:(0,H.jsx)($L,{className:`size-3.5`})})}),(0,H.jsxs)(vq,{children:[(0,H.jsx)(bq,{disabled:!g,onSelect:()=>n.resumeInWorkspace(p),children:`Resume Session`}),(0,H.jsx)(bq,{disabled:!g,onSelect:()=>n.openWorkspaceSettings(p),children:`Workspace Settings`}),(0,H.jsx)(bq,{variant:`destructive`,"data-testid":`workspace-delete-${p}`,onSelect:()=>{l(``),s(!0)},children:`Delete Workspace`})]})]})]})]}),g?null:(0,H.jsx)(`p`,{className:`px-9 text-sm text-po-red`,children:`Workspace unavailable`}),e.sessions.length>0?(0,H.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.sessions.map(e=>(0,H.jsx)(m6,{session:e,sessions:t,actions:n,readOnly:i},e.id))}):null,(0,H.jsx)(aq,{open:o,onOpenChange:e=>!e&&!u&&s(!1),children:(0,H.jsxs)(cq,{width:`sm`,"data-testid":`workspace-delete-dialog-${p}`,"aria-describedby":void 0,children:[(0,H.jsx)(lq,{children:(0,H.jsx)(uq,{children:`delete workspace`})}),(0,H.jsxs)(fq,{children:[(0,H.jsxs)(dq,{children:[`this removes `,(0,H.jsx)(`span`,{className:`font-semibold text-po-hi`,children:m}),` and all its sessions from Po. running work will stop. files at `,(0,H.jsx)(`code`,{children:h}),` stay on disk.`]}),c?(0,H.jsx)(`p`,{"data-testid":`workspace-delete-error-${p}`,className:`text-sm text-po-red`,children:c}):null,(0,H.jsxs)(mq,{children:[(0,H.jsx)(Z,{variant:`outline`,size:`md`,"data-testid":`workspace-delete-cancel-${p}`,disabled:u,autoFocus:!0,onClick:()=>s(!1),children:`cancel`}),(0,H.jsx)(Z,{variant:`danger`,size:`md`,"data-testid":`workspace-delete-confirm-${p}`,disabled:u,onClick:()=>void v(),children:u?`deleting…`:`delete`})]})]})]})})]})}var S$e=`po.session-view`,C$e=`self-host`,w$e=`po.other-workspaces-open`,h6=[{value:`workspaces`,title:`Workspaces`,description:`Sessions grouped by workspace`,Icon:aR},{value:`sessions`,title:`Sessions`,description:`Needs you first, then latest change`,Icon:xR}];function T$e(e){try{return window.localStorage.getItem(e)}catch{return null}}function E$e(e,t){try{window.localStorage.setItem(e,t)}catch{}}function D$e(){return typeof window<`u`&&window.poDesktop?.cloud!==void 0}function O$e(){return typeof window<`u`&&window.poDesktop?.platform===C$e}function k$e(){window.history.pushState(null,``,`/cloud`),window.dispatchEvent(new PopStateEvent(`popstate`))}var A$e=e=>e.kind!==`session`&&e.sessions.length===0;function j$e({rail:e,onClose:t,selfHost:n=O$e(),cloud:r=D$e()&&!n}){let{remote:i,actions:a}=e,o=i.status===`on`||i.status===`starting`,s=i.status===`on`?`Remote access on, ${String(i.deviceCount)} device${i.deviceCount===1?``:`s`} paired`:void 0;return(0,H.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,H.jsxs)(`div`,{"data-po-session-rail-header":!0,className:`flex min-h-16 items-center justify-between gap-2 px-5 py-3`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2.5`,"aria-label":`Po`,children:[(0,H.jsx)(`img`,{src:`/favicon.svg`,alt:``,"aria-hidden":`true`,className:`size-9 rounded-lg`}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-2xl font-semibold text-po-hi`,children:`Po`})]}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[n?null:(0,H.jsxs)(Z,{variant:i.status===`failed`?`danger-outline`:`outline`,size:`md`,"data-testid":`remote-access-open`,title:s??`Remote access`,"aria-label":s??`Remote access is ${i.status}`,onClick:a.openRemoteAccess,className:`gap-1.5 rounded-md ${i.status===`failed`?``:`bg-po-panel`}`,children:[o?(0,H.jsx)(GK,{tone:`yellow`,pulse:!0,"data-testid":`remote-access-live`}):(0,H.jsx)(ER,{className:`size-4`}),`Remote access`]}),(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`mobile-sessions-close`,title:`Hide sessions`,"aria-label":`Hide sessions`,onClick:t,className:`text-po-dim md:hidden`,children:(0,H.jsx)(jR,{className:`size-3.5`})})]})]}),(0,H.jsx)(`div`,{className:`px-3 pt-4`,children:(0,H.jsxs)(Z,{variant:`ghost`,size:`lg`,"data-testid":`home-open`,"aria-current":e.homeActive?`page`:void 0,onClick:a.openHome,className:e.homeActive?`w-full justify-start gap-2.5 border border-po-edge-green bg-po-tint-green px-2 text-po-hi`:`w-full justify-start gap-2.5 border border-transparent px-2 text-po-text`,children:[(0,H.jsx)(pR,{"aria-hidden":`true`,className:e.homeActive?`size-5 text-po-green`:`size-5 text-po-dim`}),`Home`]})}),e.pluginContent,(0,H.jsx)(M$e,{rail:e}),(0,H.jsx)(`div`,{className:`flex-1`}),(0,H.jsxs)(`div`,{className:`sticky bottom-0 mt-auto shrink-0 bg-po-rail`,children:[i.status===`off`||n?null:(0,H.jsxs)(`div`,{"data-testid":`remote-banner`,className:`flex flex-col gap-1.5 border-t border-po-border-soft px-4 py-2 text-sm ${i.status===`failed`?`bg-po-tint-red text-po-red`:`bg-po-tint-yellow text-po-yellow`}`,children:[(0,H.jsxs)(`output`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(GK,{tone:i.status===`failed`?`red`:`yellow`}),(0,H.jsx)(`span`,{className:`truncate`,children:i.status===`failed`?`Remote access failed: ${i.error??`the tunnel stopped`}`:`Remote access is ${i.status===`starting`?`starting`:`on`}${i.host===void 0?``:` · ${i.host}`} · ${String(i.deviceCount)} device${i.deviceCount===1?``:`s`} paired`})]}),(0,H.jsxs)(`span`,{className:`flex items-center justify-end gap-1`,children:[(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-testid":`remote-banner-open`,onClick:a.openRemoteAccess,children:`Manage`}),(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,"data-testid":`remote-banner-off`,onClick:a.turnRemoteAccessOff,children:`Turn off`})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 border-t border-po-border-soft px-3 py-3`,children:[(0,H.jsxs)(Z,{variant:`ghost`,size:`lg`,"data-testid":`settings-open`,onClick:a.openSettings,className:`justify-start gap-2.5 px-2 text-po-text`,children:[(0,H.jsx)(TR,{className:`size-5 text-po-dim`}),`Settings`]}),r?(0,H.jsxs)(Z,{variant:`ghost`,size:`lg`,"data-testid":`cloud-open`,onClick:k$e,className:`justify-start gap-2.5 px-2 text-po-text`,children:[(0,H.jsx)(dR,{className:`size-5 text-po-dim`}),`Po Cloud`]}):null,(0,H.jsxs)(`span`,{className:`px-2 text-sm text-po-dim max-sm:hidden`,children:[(0,H.jsx)(k$,{className:`bg-po-panel`,children:`ctrl+k`}),` commands · `,(0,H.jsx)(k$,{className:`bg-po-panel`,children:`ctrl+t`}),` new session`]})]})]})]})}function M$e({rail:e,createMenuDefaultOpen:t=!1}){let{actions:n}=e,r=e.workspaces.flatMap(e=>e.sessions),i=e.workspaces.every(e=>e.kind===`session`&&e.sessions.length===0),a=e.workspaces.filter(A$e),o=(0,V.useRef)(null),[s,c]=gL(`rail/initial-selection-revealed`,!1),[l,u]=gL(`rail/session-view`,()=>T$e(S$e)===`sessions`?`sessions`:`workspaces`),[d,f]=gL(`rail/other-workspaces-open`,()=>T$e(w$e)===`true`),p=h6.find(e=>e.value===l)??h6[0];return(0,V.useEffect)(()=>{if(s)return;let e=o.current?.querySelector(`[data-active="true"]`);e&&(e.scrollIntoView({block:`center`,inline:`nearest`,behavior:`instant`}),c(!0))},[e.workspaces,s,c]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between px-5 pt-4 pb-2`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-po-hi`,children:`Sessions`}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(hq,{children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`session-view-menu`,title:`View: ${p.title}`,"aria-label":`View: ${p.title}`,className:`text-po-dim hover:text-po-hi`,children:(0,H.jsx)(DR,{className:`size-3.5`})})}),(0,H.jsx)(vq,{align:`end`,"aria-label":`View`,children:h6.map(({value:e,title:t,description:n,Icon:r})=>(0,H.jsxs)(bq,{"data-testid":`session-view-${e}`,"aria-checked":l===e,role:`menuitemradio`,onSelect:()=>{u(e),E$e(S$e,e)},className:`items-start gap-2.5 ${l===e?`bg-po-tint-green`:``}`,children:[(0,H.jsx)(r,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${l===e?`text-po-green`:`text-po-dim`}`}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsx)(`span`,{className:`text-po-hi`,children:t}),(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:n})]}),l===e?(0,H.jsx)(LL,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-po-green`}):null]},e))})]}),(0,H.jsxs)(hq,{defaultOpen:t,children:[(0,H.jsx)(gq,{asChild:!0,children:(0,H.jsx)(Z,{variant:`ghost`,size:`icon`,"data-testid":`session-create-menu`,title:`Create workspace or session`,"aria-label":`Create workspace or session`,className:`text-po-dim hover:text-po-hi`,children:(0,H.jsx)(SR,{className:`size-3.5`})})}),(0,H.jsxs)(vq,{children:[(0,H.jsx)(bq,{"data-testid":`add-workspace-open`,onSelect:n.openAddWorkspace,children:`Create workspace`}),n.createGeneralSession?(0,H.jsx)(bq,{"data-testid":`new-session-open`,onSelect:n.createGeneralSession,children:`Create session`}):null]})]})]})]}),(0,H.jsxs)(`div`,{ref:o,className:`flex flex-col gap-4 px-3 pb-3`,children:[l===`sessions`?d$e(e.workspaces.flatMap(e=>e.sessions.map(t=>({session:t,workspaceName:e.kind===`session`?void 0:e.name})))).map(e=>(0,H.jsxs)(`section`,{"data-testid":`session-timeline-${e.key}`,className:`flex flex-col gap-1`,children:[(0,H.jsx)(`h3`,{className:`px-2 text-xs font-semibold tracking-wide text-po-dim uppercase`,children:e.title}),e.data.map(({session:e,workspaceName:t})=>(0,H.jsx)(m6,{session:e,sessions:r,actions:n,workspaceName:t},e.id))]},e.key)):e.workspaces.filter(e=>!A$e(e)).map(e=>(0,H.jsx)(x$e,{workspace:e,sessions:r,actions:n},e.id)),l===`workspaces`&&a.length>0?(0,H.jsxs)(`section`,{"data-testid":`other-workspaces`,className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`button`,{type:`button`,"data-testid":`other-workspaces-toggle`,"aria-expanded":d,"aria-label":`Other workspaces, ${String(a.length)} without sessions`,onClick:()=>{f(!d),E$e(w$e,String(!d))},className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors outline-none hover:bg-po-panel/60 focus-visible:ring-2 focus-visible:ring-po-green/50`,children:[d?(0,H.jsx)(zL,{"aria-hidden":!0,className:`size-4 shrink-0 text-po-dim`}):(0,H.jsx)(VL,{"aria-hidden":!0,className:`size-4 shrink-0 text-po-dim`}),(0,H.jsx)(`span`,{className:`flex-1 text-base font-semibold text-po-hi`,children:`Other workspaces`}),(0,H.jsx)(`span`,{className:`min-w-5.5 rounded-full bg-po-panel px-1.5 text-center text-xs text-po-dim`,children:a.length})]}),d?(0,H.jsx)(`div`,{className:`flex flex-col gap-0.5 pl-4`,children:a.map(e=>(0,H.jsx)(x$e,{workspace:e,sessions:r,actions:n,quiet:!0},e.id))}):null]}):null,i||l===`sessions`&&r.length===0?(0,H.jsx)(`p`,{className:`px-2 text-sm text-po-dim`,children:`Start a session to work with Po. No workspace needed.`}):null]})]})}function N$e({view:e,slots:t,rail:n,navigationOpen:r,desktopActivityOpen:i,mobileActivityOpen:a,onNavigationOpenChange:o,onDesktopActivityOpenChange:s,onMobileActivityOpenChange:c}){let{scrollRef:l}=n,u=e===`conversation`||e===`welcome`,d=a?i?`fixed inset-y-0 right-0 z-40 flex lg:static lg:z-auto`:`fixed inset-y-0 right-0 z-40 flex lg:hidden`:i?`hidden lg:flex`:`hidden`;return(0,H.jsxs)(`div`,{className:`relative flex h-full min-w-0 overflow-hidden`,children:[(0,H.jsx)(`aside`,{ref:l,"data-testid":`session-rail-panel`,className:`fixed inset-y-0 left-0 z-40 flex w-[min(320px,calc(100vw-48px))] shrink-0 flex-col overflow-y-auto border-r border-po-border-soft bg-po-rail transition-transform md:visible md:static md:z-auto md:w-[320px] md:translate-x-0 ${r?`visible translate-x-0`:`invisible -translate-x-full`}`,children:(0,H.jsx)(j$e,{rail:n,onClose:()=>o(!1)})}),r?(0,H.jsx)(Z,{variant:`ghost`,"data-testid":`mobile-drawer-backdrop`,"aria-label":`Hide sessions`,className:`fixed inset-0 z-30 h-auto w-auto rounded-none bg-black/55 p-0 hover:bg-black/55 md:hidden`,onClick:()=>o(!1)}):null,(0,H.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:[t.notices,t.header({navigationToggle:`mobile`,activityToggle:`mobile`}),(0,H.jsxs)(`div`,{"data-testid":`template-content`,className:u?`mx-auto flex min-h-0 w-full max-w-[960px] flex-1 flex-col overflow-hidden px-2 sm:px-4`:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[t.content,t.composer,t.controls]})]}),t.activity==null?null:i||a?(0,H.jsx)(`div`,{className:d,children:t.activity}):(0,H.jsx)(Z,{variant:`ghost`,"data-testid":`activity-show`,title:`Show activity`,onClick:()=>s(!0),className:`hidden h-auto shrink-0 rounded-none border-l border-po-border-soft bg-po-rail px-2 py-3 font-semibold text-po-dim hover:bg-po-panel hover:text-po-hi lg:flex`,style:{writingMode:`vertical-rl`},children:`Activity`}),a?(0,H.jsx)(Z,{variant:`ghost`,"data-testid":`mobile-activity-backdrop`,"aria-label":`Hide activity`,className:`fixed inset-0 z-30 h-auto w-auto rounded-none bg-black/55 p-0 hover:bg-black/55 lg:hidden`,onClick:()=>c(!1)}):null,n.addWorkspace?(0,H.jsx)(c$e,{suggestedPaths:n.addWorkspace.suggestedPaths,actions:n.actions}):null]})}function P$e({onDismiss:e,...t}){return(0,H.jsx)(N$e,{...t,rail:pZe({onDismiss:e})})}function F$e(){WI();let e=U(LI,e=>e.dockOpen),[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(!1),{kind:a,sessionId:o,tabId:s,pageId:c,workspaceId:l}=uS(),u=KI(o??null),d=U(q,e=>o===void 0?void 0:e.byId[o]?.summary.workspaceId),f=U(gP,e=>e.selectedId),p=a===`workspace`?l:o===void 0?f??void 0:d,m=U(q,e=>e.activeId),h=nM(p,a===`workspace`?void 0:m??void 0),g=s===`mcp`,_=h.snapshot?.enabled===!0||g,v=U(q,e=>e.transferringToId===null?null:e.byId[e.transferringToId]?.summary.name??`destination session`),y=CM(),b=xM(),x=b?.summary.dormant===!0?b:null,S=oN(e=>e.dialog?.id??null),C=U(EI,e=>OI(e,o,s)),w=C===void 0?void 0:pv(o??null).map(e=>e.transientTab?.()).find(e=>e?.id===C.id)??C,T=(s===void 0?void 0:$_(o??null).find(e=>e.id===s))??w,E=T===w?w?.composerContext:void 0,D=`${a}\u0000${o??``}\u0000${s??``}\u0000${c??``}\u0000${l??``}`,[O,k]=(0,V.useState)(D);O!==D&&(k(D),n(!1),i(!1));let[A,j]=(0,V.useState)(S);A!==S&&(j(S),S!==null&&(i(!1),n(!1)));let M=()=>{r?i(!1):zI(!1)},N=c===void 0?a===`workspace`&&l!==void 0?(0,H.jsx)(gJe,{workspaceId:l,onShowSessions:()=>n(!0)}):a===`home`&&!y?(0,H.jsx)(mJe,{onShowSessions:()=>n(!0)}):null:(0,H.jsx)(vJe,{pageId:c,sessionId:null,workspaceId:l,onShowSessions:()=>n(!0)});return(0,H.jsxs)(`div`,{"data-testid":`cockpit`,className:`h-full min-w-0 overflow-hidden`,children:[(0,H.jsx)(P$e,{view:N||g||T?`panel`:y?`welcome`:`conversation`,navigationOpen:t,desktopActivityOpen:e,mobileActivityOpen:r,onNavigationOpenChange:n,onDesktopActivityOpenChange:zI,onMobileActivityOpenChange:i,onDismiss:()=>n(!1),slots:{header:e=>N?null:(0,H.jsx)(t$e,{...e,view:g?`mcp`:T?.id??`conversation`,mcpEnabled:_,onShowSessions:()=>{i(!1),n(!0)},onShowActivity:()=>{n(!1),i(!0)}}),notices:v===null?null:(0,H.jsxs)(`output`,{"data-testid":`voice-transfer-transition`,className:`border-b border-po-cyan/30 bg-po-cyan/10 px-4 py-2 text-center text-base font-medium text-po-cyan`,children:[`Transferring voice to `,v,`...`]}),content:N||(g?(0,H.jsx)(kJe,{state:h},o):T?(0,H.jsx)(T.panel,{...u}):y?(0,H.jsx)(lZe,{}):(0,H.jsx)(ZXe,{})),composer:N||g?null:T?T.retainComposer===!0?(0,H.jsx)(O3,{composerContext:E}):null:y?null:(0,H.jsx)(O3,{}),controls:!N&&!g&&(!T||T.targetSessionId!==void 0)&&!y&&x===null?(0,H.jsx)(CYe,{}):null,activity:N?null:(0,H.jsx)(qJe,{mcp:h,scope:T===w&&w?.targetSessionId!==void 0?w.activityScope:void 0,onClose:M,onOpenContent:()=>i(!1)})}}),(0,H.jsx)(cZe,{})]})}function I$e(){WI();let{section:e,workspaceId:t}=uS(),n=Tx(),r=U(q,e=>e.activeId),[i,a]=(0,V.useState)(),[o,s]=(0,V.useState)(!1),[c,l]=gL(`settings/template-target`,`global`),u=qj(e),d=u?.workspace??(e?.startsWith(`repository-`)?`repository`:`general`);return(0,V.useEffect)(()=>{if(u||d===`repository`&&!o)return;let r=!1;return i_e().then(()=>{r||qj(e)||n({to:`/settings/$section`,params:{section:Uj},search:{workspace:t},replace:!0})}).catch(e=>{r||a(e instanceof Error?e.message:String(e))}),()=>{r=!0}},[u,e,n,d,t,o]),(0,H.jsxs)(`div`,{"data-testid":`settings`,className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-po-bg`,children:[(0,H.jsxs)(`header`,{className:`grid shrink-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2 gap-y-2 border-b border-po-border px-3 py-2 sm:h-14 sm:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] sm:px-6 sm:py-0`,children:[(0,H.jsx)(`h1`,{className:`order-1 min-w-0 truncate text-xl font-semibold text-po-hi sm:order-none`,children:`Settings`}),(0,H.jsxs)(`nav`,{className:`order-3 col-span-2 flex w-full items-center gap-1 rounded-lg bg-po-panel p-1 sm:order-none sm:col-span-1 sm:w-auto`,"aria-label":`settings workspace`,children:[(0,H.jsx)(s3,{asChild:!0,active:d===`general`,className:`min-h-8 flex-1 justify-center rounded-md px-4 focus-visible:ring-2 focus-visible:ring-po-green sm:flex-none`,"aria-current":d===`general`?`true`:void 0,children:(0,H.jsx)(Mx,{to:`/settings/$section`,params:{section:Uj},search:{workspace:t},"data-testid":`settings-workspace-general`,children:`General`})}),(0,H.jsx)(s3,{asChild:!0,active:d===`repository`,className:`min-h-8 flex-1 justify-center rounded-md px-4 focus-visible:ring-2 focus-visible:ring-po-green sm:flex-none`,"aria-current":d===`repository`?`true`:void 0,children:(0,H.jsx)(Mx,{to:`/settings/$section`,params:{section:Wj},search:{workspace:t},"data-testid":`settings-workspace-repository`,children:`Workspaces`})})]}),(0,H.jsx)(Z,{asChild:!0,variant:`outline`,size:`sm`,className:`order-2 gap-1.5 sm:order-none sm:justify-self-end`,children:r===null?(0,H.jsxs)(Mx,{to:`/`,"data-testid":`settings-close`,children:[(0,H.jsx)(kL,{"aria-hidden":!0,className:`size-3.5`}),`Back`]}):(0,H.jsxs)(Mx,{to:`/session/$sessionId`,params:{sessionId:r},"data-testid":`settings-close`,children:[(0,H.jsx)(kL,{"aria-hidden":!0,className:`size-3.5`}),(0,H.jsx)(`span`,{className:`sm:hidden`,children:`Back`}),(0,H.jsx)(`span`,{className:`hidden sm:inline`,children:`Back to session`})]})})]}),(0,H.jsx)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:d===`repository`?(0,H.jsx)(qQe,{current:u??{id:e??``,label:``,detail:``,workspace:`repository`},initialRepositoryId:t,onRepositoryChange:t=>{n({to:`/settings/$section`,params:{section:u?.id??e??Wj},search:{workspace:t},replace:!0})},onReady:s},t??`remembered-workspace`):(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[(0,H.jsx)(u6,{active:u?.id,workspace:`general`,repositoryId:t}),(0,H.jsx)(`section`,{"data-testid":`settings-content`,className:`min-w-0 flex-1 overflow-y-auto px-4 py-6 sm:px-6 sm:py-8 lg:px-8 lg:py-10`,children:(0,H.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-8`,children:[!u&&i?(0,H.jsx)(`p`,{role:`alert`,children:i}):null,u?.id===`providers`?(0,H.jsx)(ZZe,{}):null,u?.id===`devices`?(0,H.jsx)(CZe,{}):null,u?.id===`appearance`?(0,H.jsx)(yZe,{templateTarget:c,onTemplateTargetChange:l}):null,u?.id===`notifications`?(0,H.jsx)(RZe,{}):null,u?.id===`images`?(0,H.jsx)(jZe,{}):null,u?.id===`remote`?(0,H.jsx)(uQe,{}):null,u?.id===`presets`?(0,H.jsx)(BZe,{}):null,u?.id===`account`?(0,H.jsx)(mZe,{}):null,u?.contribution===void 0?null:(0,H.jsx)(Y3,{section:u.contribution,scope:`global`}),u?.panel===void 0?null:(0,H.jsx)(YQe,{panel:u.panel})]})})]})})]})}var L$e={thread:(e,t,n)=>(0,H.jsx)(tZe,{sessionId:e,threadId:t,options:n}),activity:(e,t)=>(0,H.jsx)(YYe,{sessionId:e,onOpenConversation:t}),transcript:(e,t)=>(0,H.jsx)($Xe,{sessionId:e,options:t,watch:pS})};function R$e(){let e=uS(),t=U(q,e=>e.activeId);return(0,H.jsxs)(UI,{value:L$e,children:[e.kind===`settings`?(0,H.jsx)(I$e,{}):(0,H.jsx)(F$e,{}),(0,H.jsx)($Je,{}),(0,H.jsx)(QJe,{}),(0,H.jsx)(iYe,{}),(0,H.jsx)(h3,{slot:s_.overlay,sessionId:t}),(0,H.jsx)(mYe,{}),(0,H.jsx)(oYe,{})]})}var g6={label:`Advanced`,description:`The full cockpit with persistent session navigation and an activity dock.`,contractVersion:2,app:R$e},z$e=Tg(g6),B$e=Tg(g6),V$e=Tg(g6),_6=(e,t)=>t===void 0?void 0:{...e,...t},H$e=Wie({id:`template-advanced`,global:{get templates(){return[_6({id:`po-template-advanced`},z$e)]}},workspace:{get templates(){return[_6({id:`po-template-advanced`},B$e)]}},session:{get templates(){return[_6({id:`po-template-advanced`},V$e)]}}}),v6=[],U$e=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?U$e:v6).push(n+=e[t])})();function W$e(e){if(e<768)return!1;for(let t=0,n=v6.length;;){let r=t+n>>1;if(e<v6[r])n=r;else if(e>=U$e[r])t=r+1;else return!0;if(t==n)return!1}}function G$e(e){return e>=127462&&e<=127487}var K$e=8205;function q$e(e,t,n=!0,r=!0){return(n?J$e:Y$e)(e,t,r)}function J$e(e,t,n){if(t==e.length)return t;t&&X$e(e.charCodeAt(t))&&Z$e(e.charCodeAt(t-1))&&t--;let r=y6(e,t);for(t+=Q$e(r);t<e.length;){let i=y6(e,t);if(r==K$e||i==K$e||n&&W$e(i))t+=Q$e(i),r=i;else if(G$e(i)){let n=0,r=t-2;for(;r>=0&&G$e(y6(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function Y$e(e,t,n){for(;t>1;){let r=J$e(e,t-2,n);if(r<t)return r;t--}return 0}function y6(e,t){let n=e.charCodeAt(t);if(!Z$e(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return X$e(r)?(n-55296<<10)+(r-56320)+65536:n}function X$e(e){return e>=56320&&e<57344}function Z$e(e){return e>=55296&&e<56320}function Q$e(e){return e<65536?1:2}var $$e=t({Annotation:()=>t8,AnnotationType:()=>x1e,ChangeDesc:()=>j6,ChangeSet:()=>M6,CharCategory:()=>o8,Compartment:()=>X6,EditorSelection:()=>z6,EditorState:()=>c8,Facet:()=>V6,Line:()=>i1e,MapMode:()=>A6,Prec:()=>Y6,Range:()=>f8,RangeSet:()=>m8,RangeSetBuilder:()=>g8,RangeValue:()=>u8,SelectionRange:()=>R6,StateEffect:()=>n8,StateEffectType:()=>S1e,StateField:()=>K6,Text:()=>b6,Transaction:()=>r8,codePointAt:()=>D6,codePointSize:()=>O6,combineConfig:()=>l8,countColumn:()=>C8,findClusterBreak:()=>E6,findColumn:()=>w8,fromCodePoint:()=>s1e}),b6=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=T6(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),S6.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=T6(this,e,t);let n=[];return this.decompose(e,t,n,0),S6.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new w6(this),i=new w6(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new w6(this,e)}iterRange(e,t=this.length){return new n1e(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new r1e(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new x6(t):S6.from(x6.split(t,[]))}},x6=class e extends b6{constructor(e,t=e1e(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new i1e(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(t1e(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=C6(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=T6(this,t,n);let i=C6(this.text,C6(r.text,t1e(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):S6.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
145
145
|
`){[e,t]=T6(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},S6=class e extends b6{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=T6(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
|
|
146
146
|
`){[e,t]=T6(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new x6(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof x6&&c&&(n=u[u.length-1])instanceof x6&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new x6(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};b6.empty=new x6([``],0);function e1e(e){let t=-1;for(let n of e)t+=n.length+1;return t}function C6(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function t1e(e,t,n){return C6(e,[``],t,n)}var w6=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof x6?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof x6?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
@@ -152,4 +152,4 @@ Defaulting to \`null\`.`}dW(bW,`getInvalidValueError`);var zke=Object.defineProp
|
|
|
152
152
|
`&&e.lineWrapping&&(r&&=z6.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:b6.of([` `])}),n)return a7(e,n,r,o);if(r&&!o7(r,a)){let t=!1,n=`select`;return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin==`select`&&(t=!0),n=e.inputState.lastSelectionOrigin,n==`select.pointer`&&(r=E2e(i.facet(N5).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function a7(e,t,n,r=-1){if($.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if($.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==` `)&&t.insert.length==1&&t.insert.lines==2&&l5(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&l5(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&l5(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=F2e(e,t,n);return e.state.facet(I0e).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function F2e(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let n=t.from<a.from?-1:1,r=n<0?a.from:a.to,s=e7(i.facet(N5).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:z6.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=a.from<t.from?i.sliceDoc(a.from,t.from):``,o=a.to>t.to?i.sliceDoc(t.to,a.to):``;r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),s=n&&n.main.to<=o.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let c=e.state.sliceDoc(t.from,t.to),l,u=n&&d2e(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(a.head);let d=a.to-t.to;r=i.changeByRange(n=>{if(n.from==a.from&&n.to==a.to)return{changes:o,range:s||n.map(o)};let r=n.to-d,u=r-c.length;if(e.state.sliceDoc(u,r)!=c||r>=l.from&&u<=l.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-a.to;return{changes:f,range:s?z6.range(Math.max(0,s.anchor+p),Math.max(0,s.head+p)):n.map(f)}})}else r={changes:o,selection:s&&i.selection.replaceRange(s)}}let s=`input.type`;return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=`.compose`,e.inputState.compositionFirstChange&&(s+=`.start`,e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}function I2e(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a<i&&e.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==i&&e.length==t.length)return null;let o=e.length,s=t.length;for(;o>0&&s>0&&e.charCodeAt(o-1)==t.charCodeAt(s-1);)o--,s--;if(r==`end`){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o<a&&e.length<t.length){let e=n<=a&&n>=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s<a){let e=n<=a&&n>=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function L2e(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new j2e(n,r)),(i!=n||a!=r)&&t.push(new j2e(i,a))),t}function R2e(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?z6.create([z6.cursor(r+t,-1)]):z6.single(n+t,r+t)}function o7(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var z2e=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText=``,this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,$.safari&&e.contentDOM.addEventListener(`input`,()=>null),$.gecko&&g4e(e.contentDOM.ownerDocument)}handleEvent(e){Z2e(this.view,e)&&!this.ignoreDuringComposition(e)&&(e.type==`keydown`&&this.keydown(e)||(this.view.updateState==0?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e))))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=H2e(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if(e!=`scroll`){let i=!t[e].handlers.length,a=n[e];a&&i!=!a.handlers.length&&(r.removeEventListener(e,this.handleEvent),a=null),a||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)e!=`scroll`&&!t[e]&&r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&G2e.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),$.android&&$.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if($.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(U2e.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||W2e.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&$.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&B2e(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key==`Enter`&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,l5(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:$.safari&&!$.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function B2e(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function V2e(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){T5(n.state,e)}}}function H2e(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(V2e(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(V2e(t.value,r))}}for(let e in l7)n(e).handlers.push(l7[e]);for(let e in u7)n(e).observers.push(u7[e]);return t}var U2e=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],W2e=`dthko`,G2e=[16,17,18,20,91,92,224,225],s7=6;function c7(e){return Math.max(0,e)*.7+8}function K2e(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var q2e=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=s0e(e.contentDOM),this.atoms=e.state.facet(N5).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener(`mousemove`,this.move=this.move.bind(this)),i.addEventListener(`mouseup`,this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(c8.allowMultipleSelections)&&J2e(e,t),this.dragging=X2e(e,t)&&o4e(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&K2e(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let s=P5(this.view);e.clientX-s.left<=r+s7?t=-c7(r-e.clientX):e.clientX+s.right>=a-s7&&(t=c7(e.clientX-a)),e.clientY-s.top<=i+s7?n=-c7(i-e.clientY):e.clientY+s.bottom>=o-s7&&(n=c7(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging??this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener(`mousemove`,this.move),e.removeEventListener(`mouseup`,this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=E2e(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:`select.pointer`}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent(`input.type`))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function J2e(e,t){let n=e.state.facet(M0e);return n.length?n[0](t):$.mac?t.metaKey:t.ctrlKey}function Y2e(e,t){let n=e.state.facet(N0e);return n.length?n[0](t):$.mac?!t.altKey:!t.ctrlKey}function X2e(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Q8(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function Z2e(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=R5.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var l7=Object.create(null),u7=Object.create(null),Q2e=$.ie&&$.ie_version<15||$.ios&&$.webkit_version<604;function $2e(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement(`textarea`));n.style.cssText=`position: fixed; left: -10000px; top: 10px`,n.focus(),setTimeout(()=>{e.focus(),n.remove(),e4e(e,n.value)},50)}function d7(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function e4e(e,t){t=d7(e.state,x5,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(f7!=null&&n.selection.ranges.every(e=>e.empty)&&f7==a.toString()){let e=-1;r=n.changeByRange(r=>{let s=n.doc.lineAt(r.from);if(s.from==e)return{range:r};e=s.from;let c=n.toText((o?a.line(i++).text:t)+n.lineBreak);return{changes:{from:s.from,insert:c},range:z6.cursor(r.from+c.length,-1)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:z6.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}u7.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,$.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},u7.wheel=u7.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},l7.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),u7.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},u7.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},u7.touchend=(e,t)=>{e.inputState.touchActive=!1},l7.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(P0e))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=s4e(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new q2e(e,t,n,r)),r&&e.observer.ignore(()=>{d0e(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin(`select.pointer`);return!1};function t4e(e,t,n,r){if(r==1)return z6.cursor(t,n);if(r==2)return b2e(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),a=r?r.posAtStart:i.from,o=r?r.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,z6.undirectionalRange(a,o)}}var n4e=$.ie&&$.ie_version<=11,r4e=null,i4e=0,a4e=0;function o4e(e){if(!n4e)return e.detail;let t=r4e,n=a4e;return r4e=e,a4e=Date.now(),i4e=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(i4e+1)%3:1}function s4e(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=o4e(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,a,o){let s=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c,l=t4e(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=t4e(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?z6.range(i,a,l.assoc):z6.range(a,i,l.assoc)}return a?i.replaceRange(i.main.extend(l.from,l.to,l.assoc)):o&&r==1&&i.ranges.length>1&&(c=c4e(i,s.pos))?c:o?i.addRange(l):z6.create([l])}}}function c4e(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return z6.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}l7.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=z6.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,d7(e.state,S5,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},l7.dragend=e=>(e.inputState.draggedContent=null,!1);function l4e(e,t,n,r){if(n=d7(e.state,x5,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&Y2e(e,t)?{from:a.from,to:a.to}:null,s={from:i,insert:n},c=e.state.changes(o?[o,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:o?`move.drop`:`input.drop`}),e.inputState.draggedContent=null}l7.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,a=()=>{++i==n.length&&l4e(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=a,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData(`Text`);if(n)return l4e(e,t,n,!0),!0}return!1},l7.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Q2e?null:t.clipboardData;return n?(e4e(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):($2e(e),!1)};function u4e(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement(`textarea`));r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function d4e(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let a=e.doc.lineAt(r);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:d7(e,S5,t.join(e.lineBreak)),ranges:n,linewise:r}}var f7=null;l7.copy=l7.cut=(e,t)=>{if(!e5(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=d4e(e.state);if(!n&&!i)return!1;f7=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=Q2e?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(u4e(e,n),!1)};var f4e=t8.define();function p4e(e,t){let n=[];for(let r of e.facet(L0e)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:f4e.of(!0)}):null}function m4e(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=p4e(e.state,t);n?e.dispatch(n):e.update([])}},10)}u7.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),m4e(e)},u7.blur=e=>{e.observer.clearSelectionRange(),m4e(e)},u7.compositionstart=u7.compositionupdate=(e,t)=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&!e.state.readOnly&&e.dispatch({changes:e.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:`input`}),e.inputState.composing=0}},u7.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,$.chrome&&$.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},u7.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},l7.beforeinput=(e,t)=>{if((t.inputType==`insertText`||t.inputType==`insertCompositionText`)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType==`insertReplacementText`&&e.observer.editContext){let n=t.dataTransfer?.getData(`text/plain`),r=t.getTargetRanges();if(n&&r.length){let t=r[0];return a7(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(n)},null),!0}}let n;if($.chrome&&$.android&&(n=U2e.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(n.key,n.keyCode),n.key==`Backspace`||n.key==`Delete`)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return $.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),$.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>u7.compositionend(e,t),20),!1};var h4e=new Set;function g4e(e){h4e.has(e)||(h4e.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var _4e=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],p7=!1;function m7(){p7=!1}var v4e=class{constructor(e){this.lineWrapping=e,this.doc=b6.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return _4e.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,i,a){let o=_4e.indexOf(e)>-1,s=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,s){this.heightSamples={};for(let e=0;e<a.length;e++){let t=a[e];t<0?e++:this.heightSamples[Math.floor(t*10)]=!0}}return s}},y4e=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},h7=class e{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return typeof this._content==`number`?U8.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof q8?this._content.widget:null}get widgetLineBreaks(){return typeof this._content==`number`?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new e(this.from,this.length+t.length,this.top,this.height+t.height,n)}},g7=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(g7||={}),_7=.001,v7=class e{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>_7&&(p7=!0),this.height=e)}replace(t,n,r){return e.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,a=n.doc;for(let o=r.length-1;o>=0;o--){let{fromA:s,toA:c,fromB:l,toB:u}=r[o],d=i.lineAt(s,g7.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,g7.ByPosNoHeight,n,0,0);for(u+=f.to-c,c=f.to;o>0&&d.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,s<d.from&&(d=i.lineAt(s,g7.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=T4e.build(n.setDoc(a),e,l,u);i=y7(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new b7(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,i=0,a=0;for(;;)if(n==r){if(i>a*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break}else if(i<a){let e=t[n++];e&&(i+=e.size)}else{let e=t[--r];e&&(a+=e.size)}let o=!1;return t[n-1]==null?(o=!0,n--):t[n]??(o=!0,r++),new S4e(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function y7(e,t){return e==t?e:(e.constructor!=t.constructor&&(p7=!0),t)}v7.prototype.size=1;var b4e=W8.replace({}),x4e=class extends v7{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new h7(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new h7(r,0,n,this.spaceAbove,b4e):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let a=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(a):a}forEachLine(e,t,n,r,i,a){e<=i+this.length&&t>=i&&a(this.lineAt(0,g7.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},b7=class e extends x4e{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new h7(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof x7&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof x7?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):v7.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:``}${this.widgetHeight?`:`+this.widgetHeight:``})`}},x7=class e extends v7{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,a,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);a=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else a=this.height/i;return{firstLine:n,lastLine:r,perLine:a,perChar:o}}blockAt(e,t,n,r){let{firstLine:i,lastLine:a,perLine:o,perChar:s}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),a=t.doc.lineAt(i),c=o+a.length*s,l=Math.max(n,e-c/2);return new h7(a.from,a.length,l,c,0)}{let r=Math.max(0,Math.min(a-i,Math.floor((e-n)/o))),{from:s,length:c}=t.doc.line(i+r);return new h7(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==g7.ByHeight)return this.blockAt(e,n,r,i);if(t==g7.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new h7(t,r-t,0,0,0)}let{firstLine:a,perLine:o,perChar:s}=this.heightMetrics(n,i),c=n.doc.lineAt(e),l=o+c.length*s,u=c.number-a,d=r+o*u+s*(c.from-i-u);return new h7(c.from,c.length,Math.max(r,Math.min(d,r+this.height-l)),l,0)}forEachLine(e,t,n,r,i,a){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:o,perLine:s,perChar:c}=this.heightMetrics(n,i);for(let l=e,u=r;l<=t;){let t=n.doc.lineAt(l);if(l==e){let n=t.number-o;u+=s*n+c*(e-i-n)}let r=s+c*t.length;a(new h7(t.from,t.length,u,r,0)),u+=r,l=t.to+1}}replace(t,n,r){let i=this.length-n;if(i>0){let t=r[r.length-1];t instanceof e?r[r.length-1]=new e(t.length+i):r.push(null,new e(i-1))}if(t>0){let n=r[0];n instanceof e?r[0]=new e(t+n.length):r.unshift(new e(t-1),null)}return v7.of(r)}decomposeLeft(t,n){n.push(new e(t-1),null)}decomposeRight(t,n){n.push(null,new e(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let a=n+this.length;if(i&&i.from<=n+this.length&&i.more){let r=[],o=Math.max(n,i.from),s=-1;for(i.from>n&&r.push(new e(i.from-n-1).updateHeight(t,n));o<=a&&i.more;){let e=t.doc.lineAt(o).length;r.length&&r.push(null);let n=i.heights[i.index++],a=0;n<0&&(a=-n,n=i.heights[i.index++]),s==-1?s=n:Math.abs(n-s)>=_7&&(s=-2);let c=new b7(e,n,a);c.outdated=!1,r.push(c),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=v7.of(r);return(s<0||Math.abs(c.height-this.height)>=_7||Math.abs(s-this.heightMetrics(t,n).perLine)>=_7)&&(p7=!0),y7(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},S4e=class extends v7{constructor(e,t,n){super(e.length+ +!!t+n.length,e.height+n.height,+!!t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let a=r+this.left.height,o=i+this.left.length+this.break,s=t==g7.ByHeight?e<a:e<o,c=s?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,a,o);if(this.break||(s?c.to<o:c.from>o))return c;let l=t==g7.ByPosNoHeight?g7.ByPosNoHeight:g7.ByPos;return s?c.join(this.right.lineAt(o,l,n,a,o)):this.left.lineAt(o,l,n,r,i).join(c)}forEachLine(e,t,n,r,i,a){let o=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e<s&&this.left.forEachLine(e,t,n,r,i,a),t>=s&&this.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,g7.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,Math.min(t,c.from-1),n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(Math.max(e,c.to+1),t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&C4e(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),C4e(i,e)}return v7.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?v7.of(this.break?[e,null,t]:[e,t]):(this.left=y7(this.left,e),this.right=y7(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:a}=this,o=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=o+a.length&&r.more?s=a=a.updateHeight(e,o,n,r):a.updateHeight(e,o,n),s?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?` `:`-`)+this.right}};function C4e(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof x7&&(r=e[t+1])instanceof x7&&e.splice(t-1,3,new x7(n.length+1+r.length))}var w4e=5,T4e=class e{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof b7?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new b7(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new x4e(a,r,n)):(a||i||r>=w4e)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new b7(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new x7(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof b7)return e;let t=new b7(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos+=n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof b7)&&!this.isCovered?this.nodes.push(new b7(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let e of this.nodes)e instanceof b7&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(t,n,r,i){let a=new e(r,t);return m8.spans(n,r,i,a,0),a.finish(r)}};function E4e(e,t,n){let r=new D4e;return m8.compare(e,t,n,r,0),r.changes}var D4e=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&J8(e,t,this.changes,5)}};function O4e(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,a=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),c=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(X8(t)){let n=window.getComputedStyle(t);if((t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&n.overflow!=`visible`){let n=t.getBoundingClientRect();a=Math.max(a,n.left),o=Math.min(o,n.right),s=Math.max(s,n.top),c=Math.min(t==e.parentNode?i.innerHeight:c,n.bottom)}t=n.position==`absolute`||n.position==`fixed`?t.offsetParent:t.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function k4e(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function A4e(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var S7=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return W8.replace({widget:new j4e(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},j4e=class extends H8{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement(`div`);return this.vertical?e.style.height=this.size+`px`:(e.style.width=this.size+`px`,e.style.height=`2px`,e.style.display=`inline-block`),e}get estimatedHeight(){return this.vertical?this.size:-1}},M4e=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=F4e,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=d5.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(A5).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new v4e(n),this.stateDeco=I4e(t),this.heightMap=v7.empty().applyChanges(this.stateDeco,b6.empty,this.heightOracle.setDoc(t.doc),[new I5(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=W8.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new C7(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?F4e:new L4e(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(E7(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=I4e(this.state);let r=e.changedRanges,i=I5.extendWithRanges(r,E4e(n,this.stateDeco,e?e.changes:M6.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);m7(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||p7)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let s=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<s.from||t.range.head>s.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t));let c=s.from!=this.viewport.from||s.to!=this.viewport.to;this.viewport=s,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(z0e)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?d5.RTL:d5.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent===`refresh`,o=t.getBoundingClientRect(),s=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,l=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=a0e(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,a=s=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=s0e(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=h0e(this.scrollParent||e.win);let m=(this.printing?A4e:O4e)(t,this.paddingTop),h=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let _=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(_!=this.inView&&(this.inView=_,_&&(s=!0)),!this.inView&&!this.scrollTarget&&!k4e(e.dom))return 0;let v=o.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),s){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(a=!0),a||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:o,textHeight:s}=e.docView.measureTextSize();a=n>0&&r.refresh(i,n,o,s,Math.max(5,v/o),t),a&&(e.docView.minWidth=0,c|=16)}h>0&&g>0?l=Math.max(h,g):h<0&&g<0&&(l=Math.min(h,g)),m7();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?v7.empty().applyChanges(this.stateDeco,b6.empty,this.heightOracle,[new I5(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new y4e(n.from,i))}p7&&(c|=2)}let y=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,s=new C7(r.lineAt(a-n*1e3,g7.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,g7.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<s.from||e>s.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,g7.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e<s.from?a.top:a.bottom-n,s=new C7(r.lineAt(o-500,g7.ByHeight,i,0,0).from,r.lineAt(o+n+500,g7.ByHeight,i,0,0).to)}}return s}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new C7(this.heightMap.lineAt(n,g7.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,g7.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,g7.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,g7.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(n,250)))&&r>a-2e3&&i<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new S7(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,a=r<<1;if(this.defaultTextDirection!=d5.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-r<i)return;let u=this.state.selection.main,d=[u.from];u.empty||d.push(u.to);for(let e of d)if(e>r&&e<a){s(r,e-10,c,l),s(e+10,a,c,l);return}let f=P4e(e,e=>e.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-a)<i&&!d.some(t=>e.from<t&&e.to>t));if(!f){if(a<c.to&&t&&n&&t.visibleRanges.some(e=>e.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(z6.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new S7(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=U8.Text)return;let i=N4e(t.from,t.to,this.stateDeco);if(i.total<a)return;let o=this.scrollTarget?this.scrollTarget.range.head:null,c,l;if(n){let e=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,n,a;if(o!=null){let r=T7(i,o),s=((this.visibleBottom-this.visibleTop)/2+e)/t.height;n=r-s,a=r+s}else n=(this.visibleTop-t.top-e)/t.height,a=(this.visibleBottom-t.top+e)/t.height;c=w7(i,n),l=w7(i,a)}else{let n=i.total*this.heightOracle.charWidth,a=r*this.heightOracle.charWidth,s=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+s<this.pixelViewport.left&&(s=n.size-n.displaySize);let u=this.pixelViewport.left+s,d=this.pixelViewport.right+s,f,p;if(o!=null){let e=T7(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=w7(i,f),l=w7(i,p)}c>t.from&&s(t.from,c,t,i),l<t.to&&s(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(c):c(e);return o}gapSize(e,t,n,r){let i=T7(r,n)-T7(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){S7.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=W8.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];m8.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(r&8);t++){let i=this.visibleRanges[t],a=n[t];(i.from!=a.from||i.to!=a.to)&&(r|=4,e&&e.mapPos(i.from,-1)==a.from&&e.mapPos(i.to,1)==a.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||E7(this.heightMap.lineAt(e,g7.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||E7(this.heightMap.lineAt(this.scaler.fromDOM(e),g7.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return E7(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},C7=class{constructor(e,t){this.from=e,this.to=t}};function N4e(e,t,n){let r=[],i=e,a=0;return m8.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),a+=t-i),{total:a,ranges:r}}function w7({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],a=i-n;if(r<=a)return n+r;r-=a}}function T7(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function P4e(e,t){for(let n of e)if(t(n))return n}var F4e={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function I4e(e){let t=e.facet(j5).filter(e=>typeof e!=`function`),n=e.facet(M5).filter(e=>typeof e!=`function`);return n.length&&t.push(m8.join(n)),t}var L4e=class e{constructor(e,t,n){let r=0,i=0,a=0;this.viewports=n.map(({from:n,to:i})=>{let a=t.lineAt(n,g7.ByPos,e,0,0).top,o=t.lineAt(i,g7.ByPos,e,0,0).bottom;return r+=o-a,{from:n,to:i,top:a,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=a+(e.top-i)*this.scale,a=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(t){return t instanceof e&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to)}};function E7(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new h7(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>E7(e,t)):e._content)}var D7=V6.define({combine:e=>e.join(` `)}),O7=V6.define({combine:e=>e.indexOf(!0)>-1}),k7=E8.newName(),R4e=E8.newName(),z4e=E8.newName(),B4e={"&light":`.`+R4e,"&dark":`.`+z4e};function A7(e,t,n){return new E8(t,{finish(t){return/&/.test(t)?t.replace(/&\w*/,t=>{if(t==`&`)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+` `+t}})}var V4e=A7(`.`+k7,{"&":{position:`relative !important`,boxSizing:`border-box`,"&.cm-focused":{outline:`1px dotted #212121`},display:`flex !important`,flexDirection:`column`},".cm-scroller":{display:`flex !important`,alignItems:`flex-start !important`,fontFamily:`monospace`,lineHeight:1.4,height:`100%`,overflowX:`auto`,position:`relative`,zIndex:0,overflowAnchor:`none`},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:`block`,whiteSpace:`pre`,wordWrap:`normal`,boxSizing:`border-box`,minHeight:`100%`,padding:`4px 0`,outline:`none`,"&[contenteditable=true]":{WebkitUserModify:`read-write-plaintext-only`}},".cm-lineWrapping":{whiteSpace_fallback:`pre-wrap`,whiteSpace:`break-spaces`,wordBreak:`break-word`,overflowWrap:`anywhere`,flexShrink:1},"&light .cm-content":{caretColor:`black`},"&dark .cm-content":{caretColor:`white`},".cm-line":{display:`block`,padding:`0 2px 0 6px`},".cm-layer":{userSelect:`none`,position:`absolute`,left:0,top:0,contain:`size style`,"& > *":{position:`absolute`}},"&light .cm-selectionBackground":{background:`#d9d9d9`},"&dark .cm-selectionBackground":{background:`#222`},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#d7d4f0`},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#233`},".cm-cursorLayer":{pointerEvents:`none`},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:`steps(1) cm-blink 1.2s infinite`},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:`1.2px solid black`,marginLeft:`-0.6px`,pointerEvents:`none`},".cm-cursor":{display:`none`},"&dark .cm-cursor":{borderLeftColor:`#ddd`},".cm-selectionHandle":{backgroundColor:`currentColor`,width:`1.5px`},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:`""`,backgroundColor:`inherit`,borderRadius:`50%`,width:`8px`,height:`8px`,position:`absolute`,left:`-3.25px`},".cm-selectionHandle-start::before":{top:`-8px`},".cm-selectionHandle-end::before":{bottom:`-8px`},".cm-dropCursor":{position:`absolute`},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:`block`},".cm-iso":{unicodeBidi:`isolate`},".cm-announced":{position:`fixed`,top:`-10000px`},"@media print":{".cm-announced":{display:`none`}},"&light .cm-activeLine":{backgroundColor:`#cceeff44`},"&dark .cm-activeLine":{backgroundColor:`#99eeff33`},"&light .cm-specialChar":{color:`red`},"&dark .cm-specialChar":{color:`#f78`},".cm-gutters":{flexShrink:0,display:`flex`,height:`100%`,boxSizing:`border-box`,zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:`#f5f5f5`,color:`#6c6c6c`,border:`0px solid #ddd`,"&.cm-gutters-before":{borderRightWidth:`1px`},"&.cm-gutters-after":{borderLeftWidth:`1px`}},"&dark .cm-gutters":{backgroundColor:`#333338`,color:`#ccc`},".cm-gutter":{display:`flex !important`,flexDirection:`column`,flexShrink:0,boxSizing:`border-box`,minHeight:`100%`,overflow:`hidden`},".cm-gutterElement":{boxSizing:`border-box`},".cm-lineNumbers .cm-gutterElement":{padding:`0 3px 0 5px`,minWidth:`20px`,textAlign:`right`,whiteSpace:`nowrap`},"&light .cm-activeLineGutter":{backgroundColor:`#e2f2ff`},"&dark .cm-activeLineGutter":{backgroundColor:`#222227`},".cm-panels":{boxSizing:`border-box`,position:`sticky`,left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:`#f5f5f5`,color:`black`},".cm-panels-top":{top:`0`},".cm-panels-bottom":{bottom:`0`},"&light .cm-panels-top":{borderBottom:`1px solid #ddd`},"&light .cm-panels-bottom":{borderTop:`1px solid #ddd`},"&dark .cm-panels":{backgroundColor:`#333338`,color:`white`},".cm-dialog":{padding:`2px 19px 4px 6px`,position:`relative`,"& label":{fontSize:`80%`}},".cm-dialog-close":{position:`absolute`,top:`3px`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,fontSize:`14px`,padding:`0`},".cm-tab":{display:`inline-block`,overflow:`hidden`,verticalAlign:`bottom`},".cm-widgetBuffer":{verticalAlign:`baseline`,height:`1em`,width:0,display:`inline`},".cm-placeholder":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},".cm-highlightSpace":{background:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat`,backgroundSize:`.4em`,backgroundPosition:`calc(min(50%, 0px)) center`},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:`auto 100%`,backgroundPosition:`right 90%`,backgroundRepeat:`no-repeat`},".cm-trailingSpace":{backgroundColor:`#ff332255`},".cm-button":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,padding:`.2em 1em`,borderRadius:`1px`},"&light .cm-button":{backgroundImage:`linear-gradient(#eff1f5, #d9d9df)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#b4b4b4, #d0d3d6)`}},"&dark .cm-button":{backgroundImage:`linear-gradient(#393939, #111)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#111, #333)`}},".cm-textfield":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,border:`1px solid silver`,padding:`.2em .5em`},"&light .cm-textfield":{backgroundColor:`white`},"&dark .cm-textfield":{border:`1px solid #555`,backgroundColor:`inherit`}},B4e),H4e={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},j7=$.ie&&$.ie_version<=11,U4e=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new c0e,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);($.ie&&$.ie_version<=11||$.ios&&e.composing)&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&$.android&&e.constructor.EDIT_CONTEXT!==!1&&!($.chrome&&$.chrome_version<126)&&(this.editContext=new q4e(e),e.state.facet(E5)&&(e.contentDOM.editContext=this.editContext.editContext)),j7&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia(`print`)),typeof ResizeObserver==`function`&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver==`function`&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type!=`change`&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(E5)?n.root.activeElement!=this.dom:!e5(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):($.ie&&$.ie_version<=11||$.android&&$.chrome)&&!n.state.selection.main.empty&&r.focusNode&&n5(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Q8(e.root);if(!t)return!1;let n=$.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&K4e(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=e5(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&m0e(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(X8(n))!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener(`scroll`,this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,H4e),j7&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),j7&&this.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&l5(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}(!this.delayedAndroidKey||e==`Enter`)&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!this.delayedAndroidKey?.force})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),t==-1?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&e5(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new M2e(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=P2e(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type==`attributes`),e.type==`childList`){let n=W4e(t,e.previousSibling||e.target.previousSibling,-1),r=W4e(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return e.type==`characterData`?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener(`change`,this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener(`beforeprint`,this.onPrint),e.addEventListener(`scroll`,this.onScroll),e.document.addEventListener(`selectionchange`,this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener(`scroll`,this.onScroll),e.removeEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener(`change`,this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener(`beforeprint`,this.onPrint),e.document.removeEventListener(`selectionchange`,this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(E5)!=e.state.facet(E5)&&(e.view.contentDOM.editContext=e.state.facet(E5)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)==null||e.disconnect(),(t=this.gapIntersection)==null||t.disconnect(),(n=this.resizeScroll)==null||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function W4e(e,t,n){for(;t;){let r=R5.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i==e.dom?n>0?t.nextSibling:t.previousSibling:i}return null}function G4e(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return n5(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function K4e(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return G4e(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener(`beforeinput`,r,!0),e.dom.ownerDocument.execCommand(`indent`),e.contentDOM.removeEventListener(`beforeinput`,r,!0),n?G4e(e,n):null}var q4e=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:a}=r,o=this.toEditorPos(n.updateRangeStart),s=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let c=s-o>n.text.length;o==this.from&&i<this.from?o=i:s==this.to&&i>this.to&&(s=i);let l=I2e(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=z6.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));o7(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:b6.of(n.text.slice(l.from,l.toB).split(`
|
|
153
153
|
`))};if(($.mac||$.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:b6.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);a7(e,u,z6.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);t<a;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(i<a){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+` `:t==`Dashed`?`dashed `:t==`Squiggle`?`wavy `:``}${/thin/i.test(r)?1:2}px`;n.push(W8.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:V0e.of(W8.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{let t=Q8(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to){if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}r=null,this.revertPending(e.state)}if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},M7=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement(`div`),this.scrollDOM=document.createElement(`div`),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=`cm-scroller`,this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(`div`),this.announceDOM.className=`cm-announced`,this.announceDOM.setAttribute(`aria-live`,`polite`),this.dom=document.createElement(`div`),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||p0e(e.parent)||document,this.viewState=new M4e(this,e.state||c8.create(e)),e.scrollTo&&e.scrollTo.is(w5)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(D5).map(e=>new k5(e));for(let e of this.plugins)e.update(this);this.observer=new U4e(this),this.inputState=new z2e(this),this.inputState.ensureHandlers(this.plugins),this.docView=new l2e(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=`refresh`,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof r8?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let n=!1,r=!1,i,a=this.state;for(let e of t){if(e.startState!=a)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);a=e.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,s=0,c=null;t.some(e=>e.annotation(f4e))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=p4e(a,o),c||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(u=null)):this.observer.clear(),a.facet(c8.phrases)!=this.state.facet(c8.phrases))return this.setState(a);i=L5.create(this,a,t),i.flags|=s;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let n of t){if(d&&=d.map(n.changes),n.scrollIntoView){let{main:t}=n.state.selection,{x:r,y:i}=this.state.facet(e.cursorScrollMargin);d=new C5(t.empty?t:z6.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(w5)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=X4e.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(F5)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(i.startState.facet(D7)!=i.state.facet(D7)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let e of this.state.facet(b5))try{e(i)}catch(e){T5(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!P2e(this,u)&&l.force&&l5(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw Error(`Calls to EditorView.setState are not allowed while an update is in progress`);if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new M4e(this,e),this.plugins=e.facet(D5).map(e=>new k5(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new l2e(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(D5),n=e.state.facet(D5);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new k5(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){T5(this.state,e,`doc view update listener`)}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a,scaleY:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0){if(h0e(n||this.win))i=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}o=this.viewState.scaleY}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let c=[];s&4||([this.measureRequests,c]=[c,this.measureRequests]);let l=c.map(e=>{try{return e.read(this)}catch(e){return T5(this.state,e),Y4e}}),u=L5.create(this,this.state,[]),d=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let e=0;e<c.length;e++)if(l[e]!=Y4e)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){T5(this.state,e)}if(d&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)/this.viewState.scaleY-a/o;if((e>1||e<-1)&&!($.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?i<0?n.scrollTop=n.scrollHeight:n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(b5))e(t)}get themeClasses(){return k7+` `+(this.state.facet(O7)?z4e:R4e)+` `+this.state.facet(D7)}updateAttrs(){let e=Z4e(this,U0e,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(E5)?`true`:`false`,class:`cm-content`,style:`${$.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),Z4e(this,A5,t);let n=this.observer.ignore(()=>{let n=$1e(this.contentDOM,this.contentAttrs,t),r=$1e(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&=(this.announceDOM.textContent=``,this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=`\xA0`},200),!1);let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(F5);let t=this.state.facet(e.cspNonce);E8.mount(this.root,this.styleModules.concat(V4e).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw Error(`Reading the editor layout isn't allowed during an update`);this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return t7(this,e,C2e(this,e,t,n))}moveByGroup(e,t){return t7(this,e,C2e(this,e,t,t=>w2e(this,e.head,t)))}visualLineSide(e,t){return t?z6.cursor(e.to,1):z6.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return S2e(this,e,t,n)}moveVertically(e,t,n){return t7(this,e,T2e(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=r7(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),r7(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[g5.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&i.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+i.from,t=1):(e=n.from+i.to,t=-1)),this.docView.coordsAt(e,t,i.dir==d5.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(R0e)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>J4e)return O0e(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||C0e(r.isolates,n=K0e(this,e))))return r.order;n||=K0e(this,e);let r=D0e(e.text,t,n);return this.bidiCache.push(new X4e(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||$.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{d0e(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return w5.of(new C5(typeof e==`number`?z6.cursor(e):e,t.y??`nearest`,t.x??`nearest`,t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return w5.of(new C5(z6.cursor(n.from),`start`,`start`,n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e==`boolean`?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return O5.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return O5.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=E8.newName(),r=[D7.of(n),F5.of(A7(`.${n}`,e))];return t&&t.dark&&r.push(O7.of(!0)),r}static baseTheme(e){return Y6.lowest(F5.of(A7(`.`+k7,e,B4e)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&R5.get(t)||R5.get(e))?.root?.view||null}};M7.styleModule=F5,M7.inputHandler=I0e,M7.clipboardInputFilter=x5,M7.clipboardOutputFilter=S5,M7.scrollHandler=B0e,M7.focusChangeEffect=L0e,M7.perLineTextDirection=R0e,M7.exceptionSink=F0e,M7.updateListener=b5,M7.editable=E5,M7.mouseSelectionStyle=P0e,M7.dragMovesSelection=N0e,M7.clickAddsSelectionRange=M0e,M7.decorations=j5,M7.blockWrappers=W0e,M7.outerDecorations=M5,M7.atomicRanges=N5,M7.bidiIsolatedRanges=G0e,M7.cursorScrollMargin=V6.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r==`number`?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),M7.scrollMargins=q0e,M7.darkTheme=O7,M7.cspNonce=V6.define({combine:e=>e.length?e[0]:``}),M7.contentAttributes=A5,M7.editorAttributes=U0e,M7.lineWrapping=M7.contentAttributes.of({class:`cm-lineWrapping`}),M7.announce=n8.define();var J4e=4096,Y4e={},X4e=class e{constructor(e,t,n,r,i,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(e=>e.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:d5.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new e(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function Z4e(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&z8(a,n)}return n}var Q4e=$.mac?`mac`:$.windows?`win`:$.linux?`linux`:`key`;function $4e(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;e<n.length-1;++e){let r=n[e];if(/^(cmd|meta|m)$/i.test(r))s=!0;else if(/^a(lt)?$/i.test(r))i=!0;else if(/^(c|ctrl|control)$/i.test(r))a=!0;else if(/^s(hift)?$/i.test(r))o=!0;else if(/^mod$/i.test(r))t==`mac`?s=!0:a=!0;else throw Error(`Unrecognized modifier name: `+r)}return i&&(r=`Alt-`+r),a&&(r=`Ctrl-`+r),s&&(r=`Meta-`+r),o&&(r=`Shift-`+r),r}function N7(e,t,n){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n!==!1&&t.shiftKey&&(e=`Shift-`+e),e}var e3e=Y6.default(M7.domEventHandlers({keydown(e,t){return o3e(n3e(t.state),e,t,`editor`)}})),P7=V6.define({enables:e3e}),t3e=new WeakMap;function n3e(e){let t=e.facet(P7),n=t3e.get(t);return n||t3e.set(t,n=a3e(t.reduce((e,t)=>e.concat(t),[]))),n}function r3e(e,t,n){return o3e(n3e(e.state),t,e,n)}var F7=null,i3e=4e3;function a3e(e,t=Q4e){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(n==null)r[e]=t;else if(n!=t)throw Error(`Key binding `+e+` is used both as a regular binding and as a multi-stroke prefix`)},a=(e,r,a,o,s)=>{let c=n[e]||(n[e]=Object.create(null)),l=r.split(/ (?!$)/).map(e=>$4e(e,t));for(let t=1;t<l.length;t++){let n=l.slice(0,t).join(` `);i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=F7={view:t,prefix:n,scope:e};return setTimeout(()=>{F7==r&&(F7=null)},i3e),!0}]})}let u=l.join(` `);i(u,!1);let d=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(c._any?.run)?.slice()||[]});a&&d.run.push(a),o&&(d.preventDefault=!0),s&&(d.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(` `):[`editor`];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,I7))}let i=r[t]||r.key;if(i)for(let t of e)a(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&a(t,`Shift-`+i,r.shift,r.preventDefault,r.stopPropagation)}return n}var I7=null;function o3e(e,t,n,r){I7=t;let i=G1e(t),a=O6(D6(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;F7&&F7.view==n&&F7.scope==r&&(o=F7.prefix+` `,G2e.indexOf(t.keyCode)<0&&(c=!0,F7=null));let u=new Set,d=e=>{if(e){for(let t of e.run)if(!u.has(t)&&(u.add(t),t(n)))return e.stopPropagation&&(l=!0),!0;e.preventDefault&&(e.stopPropagation&&(l=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[o+N7(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!($.windows&&t.ctrlKey&&t.altKey)&&!($.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=D8[t.keyCode])&&p!=i?(d(f[o+N7(p,t,!0)])||t.shiftKey&&(m=O8[t.keyCode])!=i&&m!=p&&d(f[o+N7(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+N7(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),I7=null,s}var L7=class e{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,this.width!=null&&(e.style.width=this.width+`px`),e.style.height=this.height+`px`}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let a=s3e(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}return l3e(t,n,r)}};function s3e(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==d5.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function c3e(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let a=e.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,s=e.posAtCoords({x:a.left+1,y:o}),c=e.posAtCoords({x:a.right-1,y:o});return s==null||c==null?r:{from:Math.max(r.from,Math.min(s,c)),to:Math.min(r.to,Math.max(s,c))}}function l3e(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),a=e.textDirection==d5.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=s3e(e),l=o.querySelector(`.cm-line`),u=l&&window.getComputedStyle(l),d=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=s.right-(u?parseInt(u.paddingRight):0),p=$5(e,r,1),m=$5(e,i,-1),h=p.type==U8.Text?p:null,g=m.type==U8.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=c3e(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=c3e(e,i,-1,g)),h&&g&&h.from==g.from&&h.to==g.to)return v(y(n.from,n.to,h));{let t=h?y(n.from,null,h):b(p,!1),r=g?y(null,n.to,g):b(m,!0),i=[];return(h||p).to<(g||m).from-(h&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(_(d,t.bottom,f,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==U8.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new L7(t,e-c.left,n-c.top,Math.max(0,r-e),i-n)}function v({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(_(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,o=-1e9,s=[];function c(t,n,c,l,u){let p=e.coordsAtPos(t,t==r.to?-2:2),m=e.coordsAtPos(c,c==r.from?2:-2);p&&m&&(i=Math.min(p.top,m.top,i),o=Math.max(p.bottom,m.bottom,o),u==d5.LTR?s.push(a&&n?d:p.left,a&&l?f:m.right):s.push(!a&&l?d:m.left,!a&&n?f:p.right))}let l=t??r.from,u=n??r.to;for(let r of e.visibleRanges)if(r.to>l&&r.from<u)for(let i=Math.max(r.from,l),a=Math.min(r.to,u);;){let r=e.state.doc.lineAt(i);for(let o of e.bidiSpans(r)){let e=o.from+r.from,s=o.to+r.from;if(e>=a)break;s>i&&c(Math.max(e,i),t==null&&e<=l,Math.min(s,a),n==null&&s>=u,o.dir)}if(i=r.to+1,i>=a)break}return s.length==0&&c(l,t==null,u,n==null,e.textDirection),{top:i,bottom:o,horizontal:s}}function b(e,t){let n=s.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}function u3e(e,t){return e.constructor==t.constructor&&e.eq(t)}var d3e=class{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement(`div`)),this.dom.classList.add(`cm-layer`),t.above&&this.dom.classList.add(`cm-layer-above`),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute(`aria-hidden`,`true`),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(R7)!=e.state.facet(R7)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(R7);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>!u3e(e,this.drawn[t]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,$.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},R7=V6.define();function z7(e){return[O5.define(t=>new d3e(t,e)),R7.of(e)]}var B7=!$.ios,V7=V6.define({combine(e){return l8(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function f3e(e={}){return[V7.of(e),h3e,_3e,y3e,z0e.of(!0)]}function p3e(e){return e.facet(V7)}function m3e(e){return e.startState.facet(V7)!=e.state.facet(V7)}var h3e=z7({above:!0,markers(e){let{state:t}=e,n=t.facet(V7),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&$.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:z6.cursor(i.head,i.assoc);for(let i of L7.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName=t.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`);let n=m3e(e);return n&&g3e(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){g3e(t.state,e)},class:`cm-cursorLayer`});function g3e(e,t){t.style.animationDuration=e.facet(V7).cursorBlinkRate+`ms`}var _3e=z7({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty&&(B7||i!=n))for(let n of L7.forRange(e,`cm-selectionBackground`,i))t.push(n);if($.ios&&!n.empty&&e.state.facet(V7).iosSelectionHandles){for(let r of L7.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,z6.cursor(n.from,1)))t.push(r);for(let r of L7.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,z6.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||m3e(e)},class:`cm-selectionLayer`}),v3e=$.gecko&&$.gecko_version==153?`#ffffff01`:`transparent`,y3e=Y6.highest(M7.theme({".cm-line":{...B7?{"& ::selection, &::selection":{backgroundColor:`${v3e} !important`}}:{},caretColor:`transparent !important`},".cm-content":{caretColor:`transparent !important`,"& :focus":{caretColor:`initial !important`,...B7?{"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}:{}}}})),b3e=n8.define({map(e,t){return e==null?null:t.mapPos(e)}}),H7=K6.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(b3e)?t.value:e,e)}}),x3e=O5.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(H7);n==null?this.cursor!=null&&((t=this.cursor)==null||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement(`div`)),this.cursor.className=`cm-dropCursor`),(e.startState.field(H7)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(H7),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+`px`,this.cursor.style.top=e.top/n+`px`,this.cursor.style.height=e.height/n+`px`):this.cursor.style.left=`-100000px`}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(H7)!=e&&this.view.dispatch({effects:b3e.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function S3e(){return[H7,x3e]}function C3e(e,t,n,r,i){t.lastIndex=0;for(let a=e.iterRange(n,r),o=n,s;!a.next().done;o+=a.value.length)if(!a.lineBreak)for(;s=t.exec(a.value);)i(o+s.index,s)}function w3e(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:a}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),a=Math.min(e.state.doc.lineAt(a).to,a+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=a:r.push({from:i,to:a});return r}var U7=class{constructor(e){let{regexp:t,decoration:n,decorate:r,boundary:i,maxLength:a=1e3}=e;if(!t.global)throw RangeError(`The regular expression given to MatchDecorator should have its 'g' flag set`);if(this.regexp=t,r)this.addMatch=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if(typeof n==`function`)this.addMatch=(e,t,r,i)=>{let a=n(e,t,r);a&&i(r,r+e[0].length,a)};else if(n)this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n);else throw RangeError(`Either 'decorate' or 'decoration' should be provided to MatchDecorator`);this.boundary=i,this.maxLength=a}createDeco(e){let t=new g8,n=t.add.bind(t);for(let{from:t,to:r}of w3e(e,this.maxLength))C3e(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((t,i,a,o)=>{o>=e.view.viewport.from&&a<=e.view.viewport.to&&(n=Math.min(a,n),r=Math.max(o,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let a=Math.max(i.from,n),o=Math.min(i.to,r);if(o>=a){let n=e.state.doc.lineAt(a),r=n.to<o?e.state.doc.lineAt(o):n,s=Math.max(i.from,n.from),c=Math.min(i.to,r.to);if(this.boundary){for(;a>n.from;a--)if(this.boundary.test(n.text[a-1-n.from])){s=a;break}for(;o<r.to;o++)if(this.boundary.test(r.text[o-r.from])){c=o;break}}let l=[],u,d=(e,t,n)=>l.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=s-n.from;(u=this.regexp.exec(n.text))&&u.index<c-n.from;)this.addMatch(u,e,u.index+n.from,d);else C3e(e.state.doc,this.regexp,s,c,(t,n)=>this.addMatch(n,e,t,d));t=t.update({filterFrom:s,filterTo:c,filter:(e,t)=>e<s||t>c,add:l})}}return t}},W7=/x/.unicode==null?`g`:`gu`,T3e=RegExp(`[\0-\b
|
|
154
154
|
--\u2028\u2029-]`,W7),E3e={0:`null`,7:`bell`,8:`backspace`,10:`newline`,11:`vertical tab`,13:`carriage return`,27:`escape`,8203:`zero width space`,8204:`zero width non-joiner`,8205:`zero width joiner`,8206:`left-to-right mark`,8207:`right-to-left mark`,8232:`line separator`,8237:`left-to-right override`,8238:`right-to-left override`,8294:`left-to-right isolate`,8295:`right-to-left isolate`,8297:`pop directional isolate`,8233:`paragraph separator`,65279:`zero width no-break space`,65532:`object replacement`},G7=null;function D3e(){if(G7==null&&typeof document<`u`&&document.body){let e=document.body.style;G7=(e.tabSize??e.MozTabSize)!=null}return G7||!1}var K7=V6.define({combine(e){let t=l8(e,{render:null,specialChars:T3e,addSpecialChars:null});return(t.replaceTabs=!D3e())&&(t.specialChars=RegExp(` |`+t.specialChars.source,W7)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+`|`+t.addSpecialChars.source,W7)),t}});function O3e(e={}){return[K7.of(e),A3e()]}var k3e=null;function A3e(){return k3e||=O5.fromClass(class{constructor(e){this.view=e,this.decorations=W8.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(K7)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new U7({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,a=D6(t[0],0);if(a==9){let e=i.lineAt(r),t=n.state.tabSize,a=C8(e.text,t,r-e.from);return W8.replace({widget:new P3e((t-a%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=W8.replace({widget:new N3e(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(K7);e.startState.facet(K7)==t?this.decorations=this.decorator.updateDeco(e,this.decorations):(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view))}},{decorations:e=>e.decorations})}var j3e=`•`;function M3e(e){return e>=32?j3e:e==10?``:String.fromCharCode(9216+e)}var N3e=class extends H8{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=M3e(this.code),n=e.state.phrase(`Control character`)+` `+(E3e[this.code]||`0x`+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let i=document.createElement(`span`);return i.textContent=t,i.title=n,i.setAttribute(`aria-label`,n),i.className=`cm-specialChar`,i}ignoreEvent(){return!1}},P3e=class extends H8{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement(`span`);return e.textContent=` `,e.className=`cm-tab`,e.style.width=this.width+`px`,e}ignoreEvent(){return!1}},F3e=O5.fromClass(class{constructor(){this.height=1e3,this.attrs={style:`padding-bottom: 1000px`}}update(e){let{view:t}=e,n=t.viewState.editorHeight-t.defaultLineHeight-t.documentPadding.top-.5;n>=0&&n!=this.height&&(this.height=n,this.attrs={style:`padding-bottom: ${n}px`})}});function I3e(){return[F3e,A5.of(e=>e.plugin(F3e)?.attrs||null)]}function L3e(){return z3e}var R3e=W8.line({class:`cm-activeLine`}),z3e=O5.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(R3e.range(i.from)),t=i.from)}return W8.set(n)}},{decorations:e=>e.decorations}),B3e=class extends H8{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement(`span`);return t.className=`cm-placeholder`,t.style.pointerEvents=`none`,t.appendChild(typeof this.content==`string`?document.createTextNode(this.content):typeof this.content==`function`?this.content(e):this.content.cloneNode(!0)),t.setAttribute(`aria-hidden`,`true`),t}coordsAt(e){let t=e.firstChild?t5(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=o5(t[0],n.direction!=`rtl`),i=parseInt(n.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}};function V3e(e){let t=O5.fromClass(class{constructor(t){this.view=t,this.placeholder=e?W8.set([W8.widget({widget:new B3e(e),side:1}).range(0)]):W8.none}get decorations(){return this.view.state.doc.length?W8.none:this.placeholder}},{decorations:e=>e.decorations});return typeof e==`string`?[t,M7.contentAttributes.of({"aria-placeholder":e})]:t}var q7=2e3;function H3e(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),a=[];if(t.off>q7||n.off>q7||t.col<0||n.col<0){let o=Math.min(t.off,n.off),s=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=s&&a.push(z6.range(n.from+o,n.to+s))}}else{let o=Math.min(t.col,n.col),s=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=w8(n.text,o,e.tabSize,!0);if(r<0)a.push(z6.cursor(n.to));else{let t=w8(n.text,s,e.tabSize);a.push(z6.range(n.from+r,n.from+t))}}}return a}function U3e(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function W3e(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,a=i>q7?-1:i==r.length?U3e(e,t.clientX):C8(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:a,off:i}}function G3e(e,t){let n=W3e(e,t),r=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get(t,i,a){let o=W3e(e,t);if(!o)return r;let s=H3e(e.state,n,o);return s.length?a?z6.create(s.concat(r.ranges)):z6.create(s):r}}:null}function K3e(e){let t=e?.eventFilter||(e=>e.altKey&&e.button==0);return M7.mouseSelectionStyle.of((e,n)=>t(n)?G3e(e,n):null)}var q3e={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},J3e={style:`cursor: crosshair`};function Y3e(e={}){let[t,n]=q3e[e.key||`Alt`],r=O5.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){(e.keyCode==t||!n(e))&&this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,M7.contentAttributes.of(e=>e.plugin(r)?.isDown?J3e:null)]}var J7=`-10000px`,X3e=class{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let a=[],o=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],s=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(s=e)}if(s<0)a[n]=this.createTooltipView(r,n?a[n-1]:null),o&&(o[n]=!!r.above);else{let r=a[n]=this.tooltipViews[s];o&&(o[n]=t[s]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)a.indexOf(e)<0&&(this.removeTooltipView(e),(n=e.destroy)==null||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=r,this.tooltips=i,this.tooltipViews=a,!0}};function Z3e(e={}){return Y7.of(e)}function Q3e(e){let t=e.dom.ownerDocument.documentElement,n=t.clientWidth,r=getComputedStyle(t);if(!/stable/.test(r.scrollbarGutter||``))return{left:0,right:n};let i=t.getBoundingClientRect(),a=e.win.scrollX;return{left:Math.max(0,i.left+a-parseFloat(r.marginLeft)),right:Math.min(n,i.right+a+parseFloat(r.marginRight))}}function $3e(e){let{left:t,right:n}=Q3e(e);return{top:0,left:t,right:n,bottom:e.dom.ownerDocument.documentElement.clientHeight}}var Y7=V6.define({combine:e=>({position:$.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||$3e})}),e6e=new WeakMap,X7=O5.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Y7);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==`function`?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new X3e(e,Z7,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener(`resize`,this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(`div`),this.container.style.position=`relative`,this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(Y7);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add(`cm-tooltip`),e.arrow&&!n.dom.querySelector(`.cm-tooltip > .cm-tooltip-arrow`)){let e=document.createElement(`div`);e.className=`cm-tooltip-arrow`,n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=J7,n.dom.style.left=`0px`,this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener(`resize`,this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(e=t.destroy)==null||e.call(t);this.parent&&this.container.remove(),(t=this.resizeObserver)==null||t.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1,r=0;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if($.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||this.position==`absolute`){if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState)}else r=Q3e(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),a=P5(this.view);return{visible:{left:i.left+a.left,top:i.top+a.top,right:i.right-a.right,bottom:i.bottom-a.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Y7).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n,fixedLeft:r}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position=`absolute`;for(let e of this.manager.tooltipViews)e.dom.style.position=`absolute`}let{visible:t,space:n,scaleX:r,scaleY:i}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let s=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:l}=c,u=e.pos[o],d=e.size[o];if(!u||s.clip!==!1&&(u.bottom<=Math.max(t.top,n.top)||u.top>=Math.min(t.bottom,n.bottom)||u.right<Math.max(t.left,n.left)-.1||u.left>Math.min(t.right,n.right)+.1)){l.style.top=J7;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=e6e.get(c)??d.bottom-d.top,g=c.offset||r6e,_=this.view.textDirection==d5.LTR,v=d.width>n.right-n.left?_?n.left:n.right-d.width:_?Math.max(n.left,Math.min(u.left-(f?14:0)+g.x,n.right-m)):Math.min(Math.max(n.left,u.left-m+(f?14:0)-g.x),n.right-m),y=this.above[o];!s.strictSide&&(y?u.top-h-p-g.y<n.top:u.bottom+h+p+g.y>n.bottom)&&y==n.bottom-u.bottom>u.top-n.top&&(y=this.above[o]=!y);let b=(y?u.top-n.top:n.bottom-u.bottom)-p;if(b<h&&c.resize!==!1){if(b<this.view.defaultLineHeight){l.style.top=J7;continue}e6e.set(c,h),l.style.height=(h=b)/i+`px`}else l.style.height&&(l.style.height=``);let x=y?u.top-h-p-g.y:u.bottom+p+g.y,S=v+m;if(c.overlap!==!0)for(let e of a)e.left<S&&e.right>v&&e.top<x+h&&e.bottom>x&&(x=y?e.top-h-2-p:e.bottom+p+2);if(this.position==`absolute`?(l.style.top=(x-e.parent.top)/i+`px`,t6e(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,t6e(l,(v-e.fixedLeft)/r)),f){let e=u.left+(_?g.x:-g.x)-(v+14-7);f.style.left=e/r+`px`}c.overlap!==!0&&a.push({left:v,top:x,right:S,bottom:x+h}),l.classList.toggle(`cm-tooltip-above`,y),l.classList.toggle(`cm-tooltip-below`,!y),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=J7}},{eventObservers:{scroll(){this.maybeMeasure()}}});function t6e(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var n6e=M7.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:`border-box`},"&light .cm-tooltip":{border:`1px solid #bbb`,backgroundColor:`#f5f5f5`},"&light .cm-tooltip-section:not(:first-child)":{borderTop:`1px solid #bbb`},"&dark .cm-tooltip":{backgroundColor:`#333338`,color:`white`},".cm-tooltip-arrow":{height:`7px`,width:`14px`,position:`absolute`,zIndex:-1,overflow:`hidden`,"&:before, &:after":{content:`''`,position:`absolute`,width:0,height:0,borderLeft:`7px solid transparent`,borderRight:`7px solid transparent`},".cm-tooltip-above &":{bottom:`-7px`,"&:before":{borderTop:`7px solid #bbb`},"&:after":{borderTop:`7px solid #f5f5f5`,bottom:`1px`}},".cm-tooltip-below &":{top:`-7px`,"&:before":{borderBottom:`7px solid #bbb`},"&:after":{borderBottom:`7px solid #f5f5f5`,top:`1px`}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:`#333338`,borderBottomColor:`#333338`},"&:after":{borderTopColor:`transparent`,borderBottomColor:`transparent`}}}),r6e={x:0,y:0},Z7=V6.define({enables:[X7,n6e]}),Q7=V6.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])}),i6e=class e{static create(t){return new e(t)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement(`div`),this.dom.classList.add(`cm-tooltip-hover`),this.manager=new X3e(e,Q7,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add(`cm-tooltip-section`),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)==null||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(r!==void 0){if(t===void 0)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp(`offset`)}get getCoords(){return this.passProp(`getCoords`)}get overlap(){return this.passProp(`overlap`)}get resize(){return this.passProp(`resize`)}},a6e=Z7.compute([Q7],e=>{let t=e.facet(Q7);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>e.end??e.pos)),create:i6e.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),o6e=V6.define(),s6e=class{constructor(e,t,n,r,i,a){this.view=e,this.source=t,this.field=n,this.locked=r,this.setHover=i,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener(`mouseleave`,this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener(`mousemove`,this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let r,i=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(t),r==null)return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),o=a&&a.dir==d5.RTL?-1:1;i=t.x<n.left?-o:o}this.activateHover(e,r,i)}activateHover(e,t,n,r){let i=this.source(e,t,n),a=t=>{if(t&&(!Array.isArray(t)||t.length)){let n=Array.isArray(t)?t:[t];r&&this.locked.set(n,r),e.dispatch({effects:this.setHover.of(n)})}};if(i&&`then`in i){let n=this.pending={pos:t};i.then(e=>{this.pending==n&&(this.pending=null,a(e))},t=>T5(e.state,t,`hover tooltip`))}else a(i)}get tooltip(){let e=this.view.plugin(X7),t=e?e.manager.tooltips.findIndex(e=>e.create==i6e.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:t,tooltip:n}=this;if(t.length&&!this.locked.has(t)&&n&&!c6e(n.dom,e)||this.pending){let{pos:n}=t[0]||this.pending,r=t[0]?.end??n;(n==r?this.view.posAtCoords(this.lastMove)!=n:!l6e(this.view,n,r,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener(`mouseleave`,t);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener(`mouseleave`,t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener(`mouseleave`,this.mouseleave),this.view.dom.removeEventListener(`mousemove`,this.mousemove)}},$7=4;function c6e(e,t){let{left:n,right:r,top:i,bottom:a}=e.getBoundingClientRect(),o;if(o=e.querySelector(`.cm-tooltip-arrow`)){let e=o.getBoundingClientRect();i=Math.min(e.top,i),a=Math.max(e.bottom,a)}return t.clientX>=n-$7&&t.clientX<=r+$7&&t.clientY>=i-$7&&t.clientY<=a+$7}function l6e(e,t,n,r,i,a){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,s)<i)return!1;let c=e.posAtCoords({x:r,y:i},!1);return c>=t&&c<=n}function u6e(e,t={}){let n=n8.define(),r=new WeakMap,i=K6.define({create(){return[]},update(e,a){let o=r.get(e);if(e.length&&(t.hideOnChange&&(a.docChanged||a.selection)||o&&o(a)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(a,e)))),a.docChanged&&e.length){let t=[];for(let n of e){let e=a.changes.mapPos(n.pos,-1,A6.TrackDel);if(e!=null){let r=Object.assign(Object.create(null),n);r.pos=e,r.end!=null&&(r.end=a.changes.mapPos(r.end)),t.push(r)}}e=t}for(let t of a.effects)t.is(n)&&(e=t.value,o=void 0),(t.is(e9)&&!t.value||t.value==i)&&(e=[]);return e.length&&o&&r.set(e,o),e},provide:e=>Q7.from(e)}),a=O5.define(a=>new s6e(a,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,a,o6e.of(a),a6e]}}function d6e(e,t,n,r={}){let i=e.state.facet(o6e).map(t=>e.plugin(t)).filter(e=>!!e);if(r.tooltip&&r.tooltip.active){let e=i.find(e=>e.field==r.tooltip.active);e&&(i=[e])}for(let a of i)a.activateHover(e,t,n,r.until??(()=>!1))}function f6e(e,t){let n=e.plugin(X7);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}function p6e(e){return e.facet(Q7).some(e=>e)}var e9=n8.define(),m6e=e9.of(null);function h6e(e){return e9.of(e.active)}function g6e(e){let t=e.plugin(X7);t&&t.maybeMeasure()}var t9=V6.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function _6e(e){return e?[t9.of(e)]:[]}function n9(e,t){let n=e.plugin(v6e),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var v6e=O5.fromClass(class{constructor(e){this.input=e.state.facet(i9),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(t9);this.top=new r9(e,!0,t.topContainer),this.bottom=new r9(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(t9);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new r9(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new r9(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(i9);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>M7.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),r9=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes=``,this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&=(this.dom.remove(),void 0);return}if(!this.dom){this.dom=document.createElement(`div`),this.dom.className=this.top?`cm-panels cm-panels-top`:`cm-panels cm-panels-bottom`;let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=y6e(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=y6e(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(` `))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(` `))e&&this.container.classList.add(e)}}};function y6e(e){let t=e.nextSibling;return e.remove(),t}var i9=V6.define({enables:v6e});function b6e(e,t){let n,r=new Promise(e=>n=e),i=e=>w6e(e,t,n);e.state.field(a9,!1)?e.dispatch({effects:S6e.of(i)}):e.dispatch({effects:n8.appendConfig.of(a9.init(()=>[i]))});let a=C6e.of(i);return{close:a,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(a9).indexOf(i)>-1&&e.dispatch({effects:a})}),t))}}function x6e(e,t){let n=e.state.field(a9,!1)||[];for(let r of n){let n=n9(e,r);if(n&&n.dom.classList.contains(t))return n}return null}var a9=K6.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(S6e)?e=[n.value].concat(e):n.is(C6e)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>i9.computeN([e],t=>t.field(e))}),S6e=n8.define(),C6e=n8.define();function w6e(e,t,n){let r=t.content?t.content(e,()=>o(null)):null;if(!r){if(r=j8(`form`),t.input){let e=j8(`input`,t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add(`cm-textfield`),e.name||=`input`,r.appendChild(j8(`label`,(t.label||``)+`: `,e))}else r.appendChild(document.createTextNode(t.label||``));r.appendChild(document.createTextNode(` `)),r.appendChild(j8(`button`,{class:`cm-button`,type:`submit`},t.submitLabel||`OK`))}let i=r.nodeName==`FORM`?[r]:r.querySelectorAll(`form`);for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener(`keydown`,e=>{e.keyCode==27?(e.preventDefault(),o(null)):e.keyCode==13&&(e.preventDefault(),o(t))}),t.addEventListener(`submit`,e=>{e.preventDefault(),o(t)})}let a=j8(`div`,r,j8(`button`,{onclick:()=>o(null),"aria-label":e.state.phrase(`close`),class:`cm-dialog-close`,type:`button`},[`×`]));t.class&&(a.className=t.class),a.classList.add(`cm-dialog`);function o(t){a.contains(a.ownerDocument.activeElement)&&e.focus(),n(t)}return{dom:a,top:t.top,mount:()=>{if(t.focus){let e;e=typeof t.focus==`string`?r.querySelector(t.focus):r.querySelector(`input`)||r.querySelector(`button`),e&&`select`in e?e.select():e&&`focus`in e&&e.focus()}}}}var o9=class extends u8{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};o9.prototype.elementClass=``,o9.prototype.toDOM=void 0,o9.prototype.mapMode=A6.TrackBefore,o9.prototype.startSide=o9.prototype.endSide=-1,o9.prototype.point=!0;var s9=V6.define(),T6e=V6.define(),E6e={class:``,renderEmptyElements:!1,elementStyle:``,markers:()=>m8.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:`before`},c9=V6.define();function D6e(e){return[u9(),c9.of({...E6e,...e})]}var l9=V6.define({combine:e=>e.some(e=>e)});function u9(e){let t=[O6e];return e&&e.fixed===!1&&t.push(l9.of(!0)),t}var O6e=O5.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement(`div`),this.dom.className=`cm-gutters cm-gutters-before`,this.dom.setAttribute(`aria-hidden`,`true`),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.gutters=e.state.facet(c9).map(t=>new j6e(e,t)),this.fixed=!e.state.facet(l9);for(let e of this.gutters)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position=`sticky`),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement(`div`),this.domAfter.className=`cm-gutters cm-gutters-after`,this.domAfter.setAttribute(`aria-hidden`,`true`),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.domAfter.style.position=this.fixed?`sticky`:``,this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+`px`;this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(l9)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?`sticky`:``,this.domAfter&&(this.domAfter.style.position=this.fixed?`sticky`:``)),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=m8.iter(this.view.state.facet(s9),this.view.viewport.from),r=[],i=this.gutters.map(e=>new A6e(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let a of e.type)if(a.type==U8.Text&&t){d9(n,r,a.from);for(let e of i)e.line(this.view,a,r);t=!1}else if(a.widget)for(let e of i)e.widget(this.view,a)}else if(e.type==U8.Text){d9(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(c9),n=e.state.facet(c9),r=e.docChanged||e.heightChanged||e.viewportChanged||!m8.eq(e.startState.facet(s9),e.state.facet(s9),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new j6e(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>M7.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==d5.LTR?{left:r,right:i}:{right:r,left:i}})});function k6e(e){return Array.isArray(e)?e:[e]}function d9(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var A6e=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=m8.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==r.elements.length){let t=new M6e(e,a,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,a,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];d9(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let a=this.gutter;(r.length!=0||a.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(T6e)){let i=n(e,t.widget,t);i&&(r||=[]).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},j6e=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement(`div`),this.dom.className=`cm-gutter`+(this.config.class?` `+this.config.class:``);for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i=r.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();a=(e.top+e.bottom)/2}else a=r.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[n](e,o,r)&&r.preventDefault()});this.markers=k6e(t.markers(e)),t.initialSpacer&&(this.spacer=new M6e(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+=`visibility: hidden; pointer-events: none`)}update(e){let t=this.markers;if(this.markers=k6e(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!m8.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},M6e=class{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(`div`),this.dom.className=`cm-gutterElement`,this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+`px`),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+`px`:``),N6e(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n=`cm-gutterElement`,r=this.dom.firstChild;for(let i=0,a=0;;){let o=a,s=i<t.length?t[i++]:null,c=!1;if(s){let e=s.elementClass;e&&(n+=` `+e);for(let e=a;e<this.markers.length;e++)if(this.markers[e].compare(s)){o=e,c=!0;break}}else o=this.markers.length;for(;a<o;){let e=this.markers[a++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!s)break;s.toDOM&&(c?r=r.nextSibling:this.dom.insertBefore(s.toDOM(e),r)),c&&a++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}};function N6e(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}var P6e=V6.define(),F6e=V6.define(),f9=V6.define({combine(e){return l8(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})}}),p9=class extends o9{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function m9(e,t){return e.state.facet(f9).formatNumber(t,e.state)}var I6e=c9.compute([f9],e=>({class:`cm-lineNumbers`,renderEmptyElements:!1,markers(e){return e.state.facet(P6e)},lineMarker(e,t,n){return n.some(e=>e.toDOM)?null:new p9(m9(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(F6e)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(f9)!=e.state.facet(f9),initialSpacer(e){return new p9(m9(e,R6e(e.state.doc.lines)))},updateSpacer(e,t){let n=m9(t.view,R6e(t.view.state.doc.lines));return n==e.number?e:new p9(n)},domEventHandlers:e.facet(f9).domEventHandlers,side:`before`}));function L6e(e={}){return[f9.of(e),u9(),I6e]}function R6e(e){let t=9;for(;t<e;)t=t*10+9;return t}var z6e=new class extends o9{constructor(){super(...arguments),this.elementClass=`cm-activeLineGutter`}},B6e=s9.compute([`selection`],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(z6e.range(i)))}return m8.of(t)});function V6e(){return B6e}function H6e(e){return O5.define(t=>({decorations:e.createDeco(t),update(t){this.decorations=e.updateDeco(t,this.decorations)}}),{decorations:e=>e.decorations})}var U6e=W8.mark({class:`cm-highlightTab`}),W6e=W8.mark({class:`cm-highlightSpace`}),G6e=H6e(new U7({regexp:/\t| /g,decoration:e=>e[0]==` `?U6e:W6e,boundary:/\S/}));function K6e(){return G6e}var q6e=H6e(new U7({regexp:/\s+$/g,decoration:W8.mark({class:`cm-trailingSpace`})}));function J6e(){return q6e}var Y6e={HeightMap:v7,HeightOracle:v4e,MeasuredHeights:y4e,QueryType:g7,ChangedRange:I5,computeOrder:D0e,moveVisually:A0e,clearHeightChangeFlag:m7,getHeightChangeFlag:()=>p7},X6e=n((e=>{e.Fragment=Symbol.for(`react.fragment`),e.jsxDEV=void 0})),Z6e=e(n(((e,t)=>{t.exports=X6e()}))(),1),Q6e=`po:plugin-fetch`,h9=`po:plugin-fetch-result`;function $6e(e){if(typeof e!=`object`||!e)return;let t=e;if(t.type===Q6e&&Number.isSafeInteger(t.requestId)&&typeof t.path==`string`&&t.path.startsWith(`/api/web-plugins/`))return t}async function e8e(e,t){try{let n=await He.fetch(t.path,{cache:`no-store`,credentials:`include`}),r=await n.arrayBuffer();e.postMessage({type:h9,requestId:t.requestId,ok:!0,status:n.status,headers:[...n.headers.entries()],body:r},[r])}catch(n){e.postMessage({type:h9,requestId:t.requestId,ok:!1,message:n instanceof Error?n.message:String(n)})}}function t8e(e){return typeof e!=`object`||!e||!(`ok`in e)||typeof e.ok!=`boolean`?!1:e.ok?!(`revision`in e)||typeof e.revision==`number`:`code`in e&&typeof e.code==`string`&&`message`in e&&typeof e.message==`string`}async function n8e(){if(!(`serviceWorker`in navigator))throw Error(`The trusted service worker is unavailable.`);let e,t=await Promise.race([navigator.serviceWorker.ready,new Promise((t,n)=>{e=setTimeout(()=>n(Error(`The trusted service worker is not ready.`)),1e4)})]).finally(()=>clearTimeout(e)),n=t.active??t.waiting??t.installing;if(n===null)throw Error(`The trusted service worker is unavailable.`);return n}async function g9(e){let t=await n8e(),n=new MessageChannel;return await new Promise(r=>{let i=window.setTimeout(()=>{n.port1.close(),r({ok:!1,code:`worker-timeout`,message:`The trusted service worker did not answer.`})},12e4);n.port1.addEventListener(`message`,e=>{if(typeof e.data==`object`&&e.data!==null&&e.data.type===Q6e){let t=$6e(e.data);if(t!==void 0)e8e(n.port1,t);else{let t=e.data.requestId;n.port1.postMessage({type:h9,requestId:Number.isSafeInteger(t)?t:-1,ok:!1,message:`The trusted service worker requested an invalid plugin path.`})}}else window.clearTimeout(i),n.port1.close(),r(t8e(e.data)?e.data:{ok:!1,code:`invalid-worker-response`,message:`The trusted service worker returned invalid data.`})}),n.port1.start(),t.postMessage(e,[n.port2])})}async function r8e(e){return await g9({type:`po:activate-bundle`,...e})}async function i8e(e){return await g9({type:`po:activate-plugin-composition`,compositionId:e.id,revision:e.revision,manifestUrl:e.manifestUrl,rawAssetBaseUrl:e.rawAssetBaseUrl,verifiedAssetBaseUrl:e.verifiedAssetBaseUrl,assetPaths:e.assetPaths,relayThroughClient:He.active()})}async function a8e(){return await g9({type:`po:refresh-bundle`})}async function o8e(e){return await pO(()=>import(e),[])}var s8e=`PoWebPluginRuntime`,c8e=Object.freeze({react:V,reactJsxRuntime:H,reactJsxDevRuntime:Z6e,reactDom:az,reactDomClient:oSe,tanstackStore:yae,tanstackReactStore:ale,webContracts:aoe,webComponents:uJe,dashboard:Nbe,dashboardViews:n$e,tanstackRouter:Zle,webSecurityBrowser:Ke,codemirrorState:$$e,codemirrorView:q1e});Object.defineProperty(globalThis,s8e,{configurable:!1,enumerable:!1,writable:!1,value:c8e}),r_e({refresh:I9,retry:y8e,focusWorkspace:b8e,reloadTemplate:v8e});var _9={read:g8e,sameOrigin:!1},v9=new Map,y9={scope:`global`},b9={scope:`global`},x9=new Map,S9=new Map,C9,w9=0,T9=0,E9,D9=_9,O9,k9,A9;async function l8e(e){if(typeof location>`u`||![`localhost`,`127.0.0.1`,`[::1]`].includes(location.hostname)||e===void 0)return;let t=`${e.publicKey}:${String(e.revision)}`;if(E9?.key!==t){let n=(async()=>{await navigator.serviceWorker.register(`/sw.js`,{scope:`/`});let t=await r8e({publicKey:e.publicKey,minimumRevision:e.revision});if(!t.ok)throw Error(`The local cockpit bundle was refused (${t.code}): ${t.message}`);navigator.serviceWorker.controller||await new Promise((e,t)=>{let n=()=>{navigator.serviceWorker.controller&&(clearTimeout(r),navigator.serviceWorker.removeEventListener(`controllerchange`,n),e())},r=setTimeout(()=>{navigator.serviceWorker.removeEventListener(`controllerchange`,n),t(Error(`The local verification worker did not take control.`))},1e4);navigator.serviceWorker.addEventListener(`controllerchange`,n),n()})})();E9={key:t,ready:n},n.catch(()=>{E9?.ready===n&&(E9=void 0)})}await E9.ready}function u8e(e){return e.scope===`global`?`global`:e.scope===`workspace`?`workspace:${e.workspaceId}`:`session:${e.sessionId}`}function d8e(e,t=e){y9=e,b9=t;let n=new Set([`global`,...e.scope===`session`?[u8e(e)]:[],...e.scope===`global`?[]:[`workspace:${e.workspaceId}`],...t.scope===`global`?[]:[`workspace:${t.workspaceId}`]]);for(let[e,t]of v9)for(let r of t.styles)r.dataset.poPluginMount=e,r.media=n.has(e)?`all`:`not all`;for(let e of n)for(let t of v9.get(e)?.styles??[])document.head.append(t)}function f8e(e){return`${e.id}:${String(e.revision)}:${(e.plugins??[]).join(`,`)}:${e.stylePaths.join(`,`)}`}async function p8e(e,t){let n=await Promise.allSettled(e.pluginEntries.map(async([,e])=>{let{webPlugin:n}=await o8e(t(e));if(typeof n!=`object`||!n)throw Error(`The slot entry '${e}' exported no webPlugin.`);return n})),r=[],i=[];return n.forEach((t,n)=>{t.status===`fulfilled`?r.push(t.value):i.push({pluginId:e.pluginEntries[n][0],kind:`slot-load-failed`,message:`could not load: ${N9(t.reason)}`})}),{definitions:r,failures:i}}function j9(e){x9.set(e,(x9.get(e)??0)+1);let t=v9.get(e);if(t){v9.delete(e);try{t.stop()}finally{for(let e of t.styles)e.remove();t.releaseAssets()}}}async function m8e(e,t=t=>`${e.verifiedAssetBaseUrl}${t}`){let n=e.stylePaths.map(n=>{let r=document.createElement(`link`);return r.rel=`stylesheet`,r.media=`not all`,r.href=t(n),r.dataset.poPluginComposition=e.id,document.head.append(r),r});try{return await Promise.all(n.map(async e=>await new Promise((t,n)=>{e.addEventListener(`load`,()=>t(),{once:!0}),e.addEventListener(`error`,()=>n(Error(`The verified plugin style '${e.href}' failed to load.`)),{once:!0})}))),n}catch(e){for(let e of n)e.remove();throw e}}function h8e(){for(let e of Q_())console.warn(`web plugin '${e.pluginId}' ${e.kind}: ${e.message}`)}async function M9(e,t){if(!C9)return;let n=u8e(e);if(t===null&&e.scope===`session`){J_(e.sessionId,e.workspaceId),Y_(e.sessionId,[]),Z_(e,[]),v9.set(n,{key:`stopped`,stop:()=>{},styles:[],releaseAssets:()=>{}}),F9(n,{phase:`ready`});return}if(t===null&&e.scope===`workspace`){let t=v9.get(n);t?.stop(),t?.releaseAssets();for(let e of t?.styles??[])e.remove();K_(e.workspaceId,[]),Z_(e,[]),v9.set(n,{key:`sandboxed`,stop:()=>{},styles:[],releaseAssets:()=>{}}),F9(n,{phase:`ready`});return}let r=w9,i=x9.get(n)??0,a=()=>r!==w9||i!==(x9.get(n)??0);if(F9(n,{phase:`loading`}),!t){let e=`No synchronized web composition exists for ${n}.`;throw F9(n,{phase:`error`,error:e}),Error(e)}let o=f8e(t),s=async()=>{if(a())return;if(v9.get(n)?.key===o){F9(n,{phase:`ready`});return}let r=()=>{},i=e=>`${t.verifiedAssetBaseUrl}${e}`,s=[],c,l;try{if(!D9.sameOrigin){let e=await i8e(t);if(!e.ok)throw Error(`The plugin composition was refused (${e.code}): ${e.message}`)}if(a()||({definitions:c,failures:l}=await p8e(t,i),a()))return;if(s=await m8e(t,i),a()||!C9){for(let e of s)e.remove();return}}catch(e){throw e}let u=br(c,e.scope),d=v9.get(n);d?.stop(),d?.releaseAssets();for(let e of d?.styles??[])e.remove();v9.delete(n);try{let t=[...l];Z_(e,t),e.scope===`global`?G_(c):e.scope===`workspace`?K_(e.workspaceId,c):(J_(e.sessionId,e.workspaceId),Y_(e.sessionId,u));let i=yv(u,{...C9,mount:e},(n,r)=>{t.push({pluginId:n,kind:`start-failed`,message:`start failed: ${r instanceof Error?r.message:String(r)}`}),Z_(e,t)});v9.set(n,{key:o,stop:i,styles:s,releaseAssets:r}),d8e(y9,b9),F9(n,{phase:`ready`}),h8e()}catch(e){for(let e of s)e.remove();throw e}},c=(S9.get(n)??Promise.resolve()).then(s,s);S9.set(n,c);try{await c}catch(e){throw a()||F9(n,{phase:`error`,error:N9(e)}),e}finally{S9.get(n)===c&&S9.delete(n)}}function N9(e){return e instanceof Error?e.message:String(e)}function P9(e){tk.setState(t=>({...t,...e}))}function F9(e,t){tk.setState(n=>({...n,mounts:{...n.mounts,[e]:t}}))}async function g8e(){let e=await Ye.fetch(`/api/compositions`,{cache:`no-store`});if(!e.ok)throw Error(`Could not load web compositions (${e.status}).`);let t=await e.json();if(!t||!Array.isArray(t.workspaces)||!t.workspaces.every(e=>e&&typeof e.id==`string`))throw Error(`Invalid web compositions response.`);return{...t,template:_8e(t.template)}}function _8e(e){if(e===void 0)return{mount:{scope:`global`}};if(typeof e!=`object`||!e)throw Error(`Invalid web template decision.`);let{id:t,mount:n}=e;if(t!==void 0&&(typeof t!=`string`||t.length===0))throw Error(`Invalid web template id.`);if(typeof n!=`object`||!n)throw Error(`Invalid web template mount.`);if(`scope`in n&&n.scope===`global`)return{id:t,mount:{scope:`global`}};if(`scope`in n&&n.scope===`workspace`&&`workspaceId`in n&&typeof n.workspaceId==`string`&&n.workspaceId.length>0)return{id:t,mount:{scope:`workspace`,workspaceId:n.workspaceId}};throw Error(`Invalid web template mount.`)}async function v8e(){let e=w9;try{let t=await D9.read();if(e!==w9)return;tk.setState(e=>({...e,template:t.template,templateError:void 0}))}catch(t){e===w9&&tk.setState(e=>({...e,templateError:N9(t)}))}}function I9(){if(O9!==void 0)return O9;P9({phase:`loading`,error:void 0}),F9(`global`,{phase:`loading`});let e=w9,t=(async()=>{let t=await D9.read();if(e!==w9||(tk.setState(e=>({...e,template:e.template??t.template})),await l8e(t.shell),e!==w9))return;await M9({scope:`global`},t.global);let n=[];for(let r of t.workspaces){if(e!==w9)return;try{await M9({scope:`workspace`,workspaceId:r.id},r.webComposition)}catch(e){n.push(N9(e))}}if(e!==w9)return;let r=new Set(t.workspaces.map(e=>`workspace:${e.id}`));for(let e of Object.keys(tk.state.mounts))e.startsWith(`workspace:`)&&!r.has(e)&&(j9(e),q_(e.slice(10)),tk.setState(t=>{let n={...t.mounts};return delete n[e],{...t,mounts:n}}));if(n.length>0)throw Error(n.join(`; `))})(),n;return n=t.then(()=>{e===w9&&P9({phase:`ready`,error:void 0})}).catch(t=>{if(e===w9){let e={phase:`error`,error:N9(t)};tk.state.mounts.global?.phase===`loading`&&F9(`global`,e),P9(e)}throw t}).finally(()=>{O9===n&&(O9=void 0)}),O9=n,n}async function y8e(){try{await I9()}catch(e){let t=k9?.workspaceId;if(t===void 0||ok({scope:`workspace`,workspaceId:t}).phase!==`ready`)throw e}let e=k9;e!==void 0&&C9!==void 0&&await L9(e.sessionId,e.composition,e.workspaceId)}async function b8e(e){if(Cv(e),!e)return;if(O9!==void 0||!v9.has(`workspace:${e}`))try{await I9()}catch(t){if(ok({scope:`workspace`,workspaceId:e}).phase!==`ready`)throw t}let t=ok({scope:`workspace`,workspaceId:e});if(t.phase===`error`)throw Error(t.error)}function L9(e,t,n){let r=t==null?t:f8e(t),i=A9;if(e!==null&&i?.sessionId===e&&i.key===r&&i.workspaceId===n&&i.runtimeEpoch===w9&&i.ownerEpoch===(x9.get(`session:${e}`)??0))return Sv(e),i.promise;let a=x8e(e,t,n);return A9=e===null?void 0:{sessionId:e,key:r,workspaceId:n,runtimeEpoch:w9,ownerEpoch:x9.get(`session:${e}`)??0,promise:a},a.catch(()=>{A9?.promise===a&&(A9=void 0)}),a}async function x8e(e,t,n){let r=++T9,i=w9;if(k9=e===null?void 0:{sessionId:e,composition:t,workspaceId:n},Sv(e),!e||!C9)return;let a=`session:${e}`;t===null?j9(a):x9.set(a,(x9.get(a)??0)+1);let o=x9.get(a)??0;F9(a,{phase:`loading`});try{if(!n)throw Error(`Session '${e}' has no workspace identity.`);if(await b8e(n),i!==w9||o!==(x9.get(a)??0))return;await M9({scope:`session`,sessionId:e,workspaceId:n},t),r===T9&&Sv(e)}catch(t){throw r===T9&&i===w9&&F9(`session:${e}`,{phase:`error`,error:N9(t)}),t}}function S8e(e){T9+=1,k9?.sessionId===e&&(k9=void 0),j9(`session:${e}`),F9(`session:${e}`,{phase:`idle`}),X_(e)}function C8e(e,t=_9){w9+=1,O9=void 0,C9=e,D9=t,tk.setState(()=>({phase:`loading`,mounts:{}}));let n=()=>{I9().catch(e=>console.error(e))},r=e.onHubConnected(n);return n(),()=>{w9+=1,T9+=1,O9=void 0,r();for(let e of v9.keys())j9(e),e.startsWith(`session:`)&&X_(e.slice(8)),e.startsWith(`workspace:`)&&q_(e.slice(10));G_([]),y9={scope:`global`},b9={scope:`global`},k9=void 0,C9=void 0,D9=_9,Sv(null),Cv(null),tk.setState(()=>({phase:`idle`,mounts:{}}))}}var R9=`00000000-0000-4000-8000-0000000c10d0`,z9=`/hosts/cloud`,w8e=`/cloud`,T8e=`po-pwa`,B9=`state`;function E8e(e){return new Promise((t,n)=>{e.addEventListener(`success`,()=>t(e.result),{once:!0}),e.addEventListener(`error`,()=>n(e.error??Error(`The PWA database request failed.`)),{once:!0})})}function D8e(e){return new Promise((t,n)=>{e.addEventListener(`complete`,()=>t(),{once:!0}),e.addEventListener(`abort`,()=>n(e.error??Error(`The PWA transaction aborted.`)),{once:!0}),e.addEventListener(`error`,()=>n(e.error??Error(`The PWA transaction failed.`)),{once:!0})})}async function O8e(){let e=indexedDB.open(T8e,1);return e.addEventListener(`upgradeneeded`,()=>{let t=e.result;t.objectStoreNames.contains(`state`)||t.createObjectStore(B9)}),await E8e(e)}async function k8e(e){let{instanceId:t,...n}=e,r=await O8e();try{let e=r.transaction(B9,`readwrite`,{durability:`strict`});e.objectStore(B9).put(n,`client-device`),await D8e(e)}finally{r.close()}}var A8e,V9;function H9(){if(!V9)throw Error(`Client identity is not ready.`);return V9.current()}async function U9(e){await Ce(await W9(),e)}function W9(){return A8e??=j8e()}async function j8e(){let e=window.poDesktop?.identity;if(e){let t=await e.read(),n=new Set;e.onChange(()=>{e.read().then(e=>{t=e;for(let e of n)e()})}),V9={current:()=>({...t.metadata}),persistent:()=>t.persistent,async updateName(r,i){t=await e.updateName(r,i);for(let e of n)e()},subscribe(e){return n.add(e),()=>n.delete(e)}}}else{let e=e=>({getItem:t=>window[e].getItem(t),setItem:(t,n)=>window[e].setItem(t,n)}),t=new Map;window.addEventListener(`pagehide`,e=>{if(!e.persisted)for(let e of t.values())e()}),V9=await De({initial:{version:1,deviceId:crypto.randomUUID(),clientKind:`web`,deviceName:Zge(navigator.userAgent),...XO(navigator.userAgent),nameUpdatedAt:Date.now()},localStorage:e(`localStorage`),sessionStorage:e(`sessionStorage`),randomId:()=>crypto.randomUUID(),isToken:WO,normalizeName:GO,now:Date.now,parse(e){let t=YO({preface:{poClient:e}});return t.status===`ok`?{...t.metadata,...XO(navigator.userAgent)}:void 0},exclusive:(e,t)=>navigator.locks.request(e,t),claimInstance:e=>new Promise((n,r)=>{navigator.locks.request(`po.client.instance:${e}`,{ifAvailable:!0},async r=>{r?(await new Promise(r=>{t.set(e,r),n(!0)}),t.delete(e)):n(!1)}).catch(r)}),onStorage(e){return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)}})}let t=V9;return be(()=>JO(t.current()),(e,n)=>t.updateName(e,n)),await k8e(t.current()).catch(()=>{}),t.subscribe(()=>{k8e(t.current()).catch(()=>{})}),t}var G9={workspaces:[],sessions:[]};function M8e(e){_M({sessions:e.sessions},R9),_P({workspaces:e.workspaces},R9)}var K9=(e,t={})=>{let n=e instanceof Request?e:void 0,r=(t.method??n?.method??`GET`).toUpperCase(),i=new Headers(t.headers??n?.headers);r!==`GET`&&r!==`HEAD`&&i.set(`x-po-csrf`,`1`);let a=typeof e==`string`?e:e instanceof URL?e.href:e.url;return fetch(e,ke(a,{...t,headers:i,credentials:`same-origin`}))};function N8e(e,t=K9){return yL({hostId:R9,origin:`${e.origin}${z9}`,fetch:(e,n)=>t(e,n)})}var P8e=(e,t)=>e instanceof Error?e.message:t;function F8e(e){let t=e.publish??M8e,n=new zg({phase:`checking`,email:``,busy:!1,listed:!1,snapshot:G9}),r,i=!1,a=0,o=e=>{i||n.setState(t=>({...t,...e}))},s=e=>{i||(t(e),o({snapshot:e,listed:!0,error:void 0}))},c=()=>{r?.(),r=e.hub.poll({intervalMs:e.pollMs,onSnapshot(e){s(e),U9(()=>K9(`${z9}/api/client-devices`)).catch(()=>void 0)},onError:e=>o({error:e.message})})},l=e=>{o({phase:`signedIn`,account:e,busy:!1,error:void 0}),c()},u=async(e,t)=>{if(!n.state.busy){o({busy:!0,error:void 0});try{await t()}catch(t){o({error:P8e(t,e)})}finally{o({busy:!1})}}};return{store:n,start(){i=!1;let t=++a;return e.bridge.status().then(e=>{t===a&&(e.signedIn?l(e):o({phase:`email`}))},e=>{t===a&&o({phase:`email`,error:P8e(e,`Po Cloud status is unavailable.`)})}),()=>{i=!0,a+=1,r?.(),r=void 0}},sendCode(t){return u(`Po Cloud could not send a code.`,async()=>{let n=t.trim();await e.bridge.signIn(n),o({phase:`code`,email:n})})},verify(t){return u(`Po Cloud sign-in failed.`,async()=>{let r=await e.bridge.verify(n.state.email,t.trim());r.signedIn?l(r):o({phase:`email`})})},changeEmail:()=>{o({phase:`email`,error:void 0})},signOut(){return u(`Po Cloud could not sign out.`,async()=>{await e.bridge.signOut(),r?.(),r=void 0,t(G9),o({phase:`email`,account:void 0,snapshot:G9,listed:!1})})},createSession(t){return u(`Po Cloud could not start the session.`,async()=>{let n=await e.hub.createSession(t);try{s(await e.hub.list())}catch{}i||e.openSession(n)})},deleteSession(t,n){return u(`Po Cloud could not delete the session.`,async()=>{await e.hub.deleteSession(t,n),s(await e.hub.list())})}}}function I8e({step:e,email:t,busy:n,error:r,onSendCode:i,onVerify:a,onChangeEmail:o}){let[s,c]=(0,V.useState)(t),[l,u]=(0,V.useState)(``);return(0,H.jsx)(w4,{"data-testid":`cloud-sign-in`,className:`w-full max-w-md`,children:(0,H.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),e===`email`?i(s):a(l)},className:`flex flex-col gap-4 p-5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-po-hi`,children:`Sign in to Po Cloud`}),(0,H.jsx)(`p`,{className:`text-base text-po-dim`,children:e===`email`?`Po sends a short code to your email. Your cloud sessions then show up next to the ones on this computer.`:`Po sent a code to ${t}. Enter it whenever you are ready.`})]}),e===`email`?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(j$,{htmlFor:`cloud-email`,children:`Email`}),(0,H.jsx)(zq,{id:`cloud-email`,"data-testid":`cloud-email`,type:`email`,autoComplete:`email`,required:!0,value:s,disabled:n,onChange:e=>c(e.target.value)})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(j$,{htmlFor:`cloud-code`,children:`Code`}),(0,H.jsx)(zq,{id:`cloud-code`,"data-testid":`cloud-code`,autoComplete:`one-time-code`,inputMode:`text`,required:!0,value:l,disabled:n,onChange:e=>u(e.target.value),className:`font-mono`})]}),r?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`cloud-sign-in-error`,className:`text-sm text-po-red`,children:r}):null,(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[e===`code`?(0,H.jsx)(Z,{type:`button`,variant:`ghost`,disabled:n,onClick:o,children:`Use another email`}):null,(0,H.jsx)(Z,{type:`submit`,variant:`primary`,disabled:n,"data-testid":`cloud-sign-in-submit`,children:e===`email`?`Send code`:`Sign in`})]})]})})}function L8e({state:e,onBack:t,onSendCode:n,onVerify:r,onChangeEmail:i,onSignOut:a,onCreateSession:o,onOpenSession:s,onDeleteSession:c}){let{workspaces:l,sessions:u}=e.snapshot;return(0,H.jsxs)(`main`,{"data-testid":`cloud-page`,className:`flex h-full flex-col overflow-y-auto bg-po-bg font-sans text-po-text`,children:[(0,H.jsxs)(`header`,{className:`flex min-h-16 items-center gap-3 border-b border-po-border-soft px-5 py-3`,children:[(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,"aria-label":`Back`,title:`Back`,onClick:t,children:(0,H.jsx)(kL,{className:`size-4`})}),(0,H.jsx)(`h1`,{className:`flex-1 text-2xl font-semibold text-po-hi`,children:`Po Cloud`}),e.phase===`signedIn`?(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.account?.email?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:e.account.email}):null,(0,H.jsx)(Z,{variant:`ghost`,size:`sm`,disabled:e.busy,onClick:a,"data-testid":`cloud-sign-out`,children:`Sign out`})]}):null]}),e.phase===`checking`?(0,H.jsx)(`output`,{className:`block p-5 text-base text-po-dim`,children:`Checking your Po Cloud account…`}):e.phase===`signedIn`?(0,H.jsxs)(`div`,{className:`flex flex-col gap-6 p-5`,children:[e.error?(0,H.jsx)(`p`,{role:`alert`,"data-testid":`cloud-error`,className:`text-sm text-po-red`,children:e.error}):null,e.listed?l.length===0?(0,H.jsx)(rJ,{title:`No cloud workspaces yet`,description:`Po Cloud lists workspaces here once your organization has one.`}):l.map(t=>{let n=u.filter(e=>e.workspaceId===t.id);return(0,H.jsxs)(`section`,{"data-testid":`cloud-workspace`,className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold text-po-hi`,children:aj(t)}),(0,H.jsxs)(Z,{variant:`outline`,size:`sm`,disabled:e.busy,onClick:()=>o(t.id),className:`gap-1.5`,children:[(0,H.jsx)(SR,{className:`size-3.5`}),`New session`]})]}),n.length===0?(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`No sessions in this workspace yet.`}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(n=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(Z,{variant:`ghost`,size:`card`,"data-testid":`cloud-session`,onClick:()=>s(n.id),className:`min-w-0 flex-1 border border-po-border-soft`,children:[(0,H.jsx)(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:n.name}),typeof n.phase==`string`?(0,H.jsx)(`span`,{className:`text-sm text-po-dim`,children:sj({summary:n,attach:n.attach},Date.now()).status}):null]}),(0,H.jsx)(Z,{variant:`ghost`,size:`icon-md`,disabled:e.busy,"aria-label":`Delete ${n.name}`,title:`Delete session`,"data-testid":`cloud-session-delete`,onClick:()=>c(t.id,n.id),children:(0,H.jsx)(kR,{className:`size-4`})})]},n.id))})]},t.id)}):(0,H.jsx)(`output`,{className:`block text-base text-po-dim`,children:`Reading your cloud workspaces…`})]}):(0,H.jsx)(`div`,{className:`flex flex-1 items-start justify-center p-5 pt-16`,children:(0,H.jsx)(I8e,{step:e.phase,email:e.email,busy:e.busy,error:e.error,onSendCode:n,onVerify:r,onChangeEmail:i},e.phase)})]})}function R8e({bridge:e}){let t=Tx(),[n]=(0,V.useState)(()=>F8e({bridge:e,hub:N8e(window.location),openSession:e=>void t({to:`/session/$sessionId`,params:{sessionId:e}})}));(0,V.useEffect)(()=>n.start(),[n]);let r=U(n.store,e=>e);return(0,H.jsx)(L8e,{state:r,onBack:()=>void t({to:`/`}),onSendCode:e=>void n.sendCode(e),onVerify:e=>void n.verify(e),onChangeEmail:n.changeEmail,onSignOut:()=>void n.signOut(),onCreateSession:e=>void n.createSession(e),onOpenSession:e=>void t({to:`/session/$sessionId`,params:{sessionId:e}}),onDeleteSession:(e,t)=>{window.confirm(`Delete this session and everything in it?`)&&n.deleteSession(e,t)}})}var z8e={scope:`global`},B8e=class extends V.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){this.props.onFailure()}render(){return this.state.failed?null:(0,H.jsx)(V.Profiler,{id:`webTemplate`,onRender:w_,children:this.props.children})}};function V8e({mount:e=z8e}){WI();let t=U(tk,e=>e),n=t.template?.mount??z8e,r=n.scope===`workspace`?n.workspaceId:void 0,i=ok(n,t),[a,o]=(0,V.useState)([]),s=W_(n),c=s.templates.filter(e=>a.some(t=>t.id===e.id&&t.app===e.app)).map(e=>e.id),{template:l,warning:u}=p_(s.templates,t.template?.id,c),[d,f]=(0,V.useState)({revision:0}),p=d.template,m=p!==void 0&&a.some(e=>e.id===p.id&&e.app===p.app),h=t.templateError??i.error,g=i.phase!==`error`&&h===void 0&&(t.template===void 0||i.phase===`idle`||i.phase===`loading`);(0,V.useLayoutEffect)(()=>{g||d8e(e,n)},[e,n,g]);let _=p===void 0&&g;!g&&(l===void 0&&p!==void 0||l!==void 0&&(p===void 0||p.id!==l.id||p.pluginId!==l.pluginId||p.app!==l.app||m))&&f({revision:d.revision+1,template:l});let v=h??(g?void 0:u??s.diagnostics[0]?.message),y=p?.app;return(0,H.jsxs)(`div`,{"data-template":p?.id??(_?`loading`:`recovery`),className:`flex h-full min-w-0 flex-col overflow-hidden`,children:[v?(0,H.jsxs)(`div`,{role:`status`,"data-testid":`template-diagnostic`,className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-po-border bg-po-panel px-3 py-2 text-sm text-po-dim`,children:[(0,H.jsx)(`span`,{className:`flex-1`,children:v}),(0,H.jsx)(Mx,{to:`/settings/$section`,params:{section:`appearance`},search:{workspace:r},children:`Template settings`}),h?(0,H.jsx)(Z,{size:`xs`,variant:`ghost`,onClick:()=>{t.templateError&&ak(),i.error&&rk().catch(()=>void 0)},children:`Retry templates`}):c.length>0?(0,H.jsx)(Z,{size:`xs`,variant:`ghost`,onClick:()=>o([]),children:`Retry`}):null]}):null,(0,H.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:y&&p?(0,H.jsx)(B8e,{onFailure:()=>o(e=>[...e,p]),children:(0,H.jsx)(y,{})},d.revision):_?(0,H.jsx)(`div`,{"data-testid":`template-loading`,role:`status`,className:`flex h-full items-center justify-center text-sm text-po-dim`,children:`loading web template…`}):(0,H.jsxs)(`main`,{"data-testid":`template-recovery`,className:`flex h-full flex-col gap-3 overflow-y-auto p-5 text-base`,children:[(0,H.jsx)(`h1`,{className:`font-bold text-po-hi`,children:h?`Web template failed to load`:`Web template unavailable`}),(0,H.jsx)(`p`,{children:`Retry loading the template, or choose an installed dashboard below.`}),(0,H.jsx)(H8e,{templates:s.templates,workspaceId:r,onSaved:()=>{o([]),ak()}}),(0,H.jsx)(`p`,{className:`text-sm text-po-dim`,children:`Your sessions continue running independently of this view.`})]})})]})}function H8e({templates:e,workspaceId:t,onSaved:n}){let r=JF(t);return(0,H.jsxs)(H.Fragment,{children:[r.error?(0,H.jsxs)(`p`,{role:`alert`,"data-testid":`template-recovery-error`,className:`text-sm text-po-red`,children:[r.error,` `,(0,H.jsx)(Z,{size:`xs`,variant:`ghost`,onClick:()=>void KF(t),children:`Reload configuration`})]}):null,e.map(e=>(0,H.jsxs)(Z,{variant:`outline`,disabled:r.saving||r.config===void 0,onClick:()=>{YF(e.id,t).then(e=>{e&&n()})},children:[`Use `,e.label]},e.id))]})}function q9(e){return typeof e.workspace==`string`&&e.workspace!==``?{workspace:e.workspace}:{}}function U8e(){let e=uS(),{sessionId:t,tabId:n}=e,r=Tx(),i=iS({select:e=>e.location.pathname===w8e}),a=typeof window>`u`?void 0:window.poDesktop?.cloud;WI();let o=U(q,e=>t===void 0?void 0:e.byId[t]?.summary.workspaceId),s=U(q,e=>e.hydrated),c=U(q,e=>e.order),l=e.kind===`session`?o:e.kind===`home`?void 0:e.workspaceId,u=U(gP,e=>l===void 0?void 0:e.byId[l]),d=(0,V.useMemo)(()=>l===void 0?{scope:`global`}:t===void 0?{scope:`workspace`,workspaceId:l}:{scope:`session`,workspaceId:l,sessionId:t},[l,t]),f=U(tk,e=>ok(d,e).phase),p=U(EI,e=>OI(e,t,n)),m=(n===void 0?void 0:$_(t??null).find(e=>e.id===n))??p,h=m?.targetSessionId??t??null,g=n===void 0||n===`mcp`||m!==void 0,_=e.kind!==`session`||i;return(0,V.useLayoutEffect)(()=>{_||wM(h,t??null)},[_,t,h]),(0,V.useEffect)(()=>{e.kind!==`workspace`&&e.kind!==`page`||l===void 0||u===void 0||u.available===!1||ik(l).catch(()=>void 0)},[e.kind,l,u]),(0,V.useEffect)(()=>{if(!(_||t===void 0||h===t))return FF(t)},[_,t,h]),(0,V.useEffect)(()=>{if(_||!s)return;if(t!==void 0&&c.includes(t)){f===`ready`&&!g&&r({to:`/session/$sessionId`,params:{sessionId:t},replace:!0});return}let e=c[0];e===void 0?t!==void 0&&r({to:`/`,replace:!0}):r({to:`/session/$sessionId`,params:{sessionId:e},replace:!0})},[_,s,c,t,g,f,r]),(0,V.useEffect)(()=>{i&&a===void 0&&r({to:`/`,replace:!0})},[i,a,r]),i&&a!==void 0?(0,H.jsx)(R8e,{bridge:a}):(0,H.jsx)(V8e,{mount:d})}var J9=Rx({component:U8e}),W8e=Fx({getParentRoute:()=>J9,path:`/`}),G8e=Fx({getParentRoute:()=>J9,path:`/session/$sessionId`}),K8e=Fx({getParentRoute:()=>J9,path:`/session/$sessionId/$tabId`}),q8e=Fx({getParentRoute:()=>J9,path:`/settings`,validateSearch:q9}),J8e=Fx({getParentRoute:()=>J9,path:`/settings/$section`,validateSearch:q9}),Y8e=Fx({getParentRoute:()=>J9,path:`/page/$pageId`,validateSearch:q9}),X8e=Fx({getParentRoute:()=>J9,path:`/workspace/$workspaceId`}),Z8e=Fx({getParentRoute:()=>J9,path:w8e}),Q8e=J9.addChildren([W8e,G8e,K8e,q8e,J8e,Y8e,X8e,Z8e]),$8e={sealText:e=>Promise.resolve(e),openText:e=>Promise.resolve(e)};function Y9(e){return e.startsWith(`${R9}/`)}function e5e(e,t,n){let r=e.protocol===`https:`?`wss:`:`ws:`,i=encodeURIComponent(cr(R9,t)),a=encodeURIComponent(cr(R9,n));return`${r}//${e.host}${z9}/api/workspaces/${i}/sessions/${a}/ws`}function t5e(e,t,n){return{hostId:R9,openLink:ek(e5e(e,t,n),$8e,{current:H9}),async restore(){return U9(()=>K9(`${z9}/api/client-devices`)).catch(()=>void 0),!0},onSignInRequired:()=>()=>void 0}}var n5e=700,X9=`po.protocol-mismatch-reload`;function r5e(){try{return!sessionStorage.getItem(X9)&&(sessionStorage.setItem(X9,`1`),!0)}catch{return!1}}function i5e(){try{sessionStorage.removeItem(X9)}catch{}}async function a5e(){let e=await Ye.fetch(`/api/client-devices`,{method:`GET`});if(e.status===404)return!1;if(!e.ok)throw Error(`Client device probe failed (${e.status}).`);let t=await e.json();if(typeof t==`object`&&t&&`devices`in t&&Array.isArray(t.devices)){let e=t.devices.find(e=>typeof e==`object`&&!!e&&`deviceId`in e&&e.deviceId===H9().deviceId);e&&typeof e.nameUpdatedAt==`number`&&await(await W9()).updateName(e.deviceName,e.nameUpdatedAt)}return!0}function Z9(e=window.location,t=(e,t,n)=>sN(e,t,{replay:n}),n,r){let i=_me({name:`browser`,openLink:r?.openLink??ek($O(e),void 0,{current:H9,...it()===void 0?{}:{probe:a5e}})}),a,o=null,s,c=!1,l=!1,u=(r?.onSignInRequired??tt)(()=>{l=!0,s&&clearTimeout(s),f(),i.dispose()}),d=e=>{s&&clearTimeout(s),!c&&!l&&!i.updateRequired&&(s=setTimeout(()=>{s=void 0,e()},n5e))},f=()=>{let e=a;a=void 0,e?.release()},p=e=>{f();let s=r===void 0?e:cr(r.hostId,e),c=i.host.hold(the,{sessionId:s}),l=hme(ED),u={readTranscriptPage:e=>c.readTranscriptPage(e)},m=JP(e,u,t,l.context,yn,n),h=_I(e,u,l.context,yn),g=gk(e,c,n=>t(e,n,!1)),_=!1,v=[],y={release:()=>{l.cancel(Error(`The session binding was replaced.`));for(let e of v)e();g(),m.dispose(),h(),cN(e),c.release()}};a=y;let b=e=>{a===y&&(jD(e)?i.reportError(e):(f(),i.connected&&d(()=>{o!==null&&a===void 0&&p(o)})))};v.push(c.onStatus(e=>{e===`live`?_=!0:e===`gone`?b(c.error):e===`loading`&&_&&b()}),c.alive.subscribe(e=>{e===!1&&b()}),c.state.subscribe(e=>{e&&m.publish(e)})),(async()=>{try{if(await c.ready,await m.initialize(),a!==y)return;t(e,{type:`bridge_status`,state:`attached`},!1),ON(e)}catch(e){b(e)}})()},m=async()=>{if(c||l)return;let e=performance.now();try{if(!(r===void 0?it()===void 0||await ot(!0):await r.restore())){l||d(()=>void m());return}if(c||l)return;await i.connect(),r===void 0&&it()===void 0&&U9(()=>Ye.fetch(`/api/client-devices`,{method:`GET`})).catch(()=>void 0),yn({name:`web.browser.protocol_ready`,duration_ms:performance.now()-e}),o!==null&&a===void 0&&p(o)}catch{o!==null&&cN(o),d(()=>void m())}};i.onConnectionStateChange(t=>{if(!c){if(t.state===`update_required`){if(s&&clearTimeout(s),f(),yn({name:`web.browser.update_required`}),r!==void 0){yM(r.hostId);return}r5e()&&(BM(),e.reload())}else t.state===`disconnected`&&d(()=>void m())}});let h=r===void 0?Tk(i5e):()=>void 0;return m(),{client:i,focus(e){r!==void 0&&e!==null&&(e=or(r.hostId,cr(r.hostId,e))),e!==o&&(o=e,e===null?f():p(e))},stop(){c||(c=!0,s&&clearTimeout(s),h(),u(),f(),i.dispose())}}}var o5e=`po-self-host`,s5e=`self-host`,c5e=`/api/owner/session`,l5e=`/api/owner/sign-in`,u5e=`/plugins/compositions.json`,d5e=new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`]);function Q9(e=document,t=window.location){return!d5e.has(t.hostname)&&e.querySelector(`meta[name="${o5e}"]`)!==null}function f5e(e=K9,t=e=>window.location.assign(e)){let n=()=>Promise.reject(Error(`Sign in with the attach token on the sign-in page.`));return{signIn:n,verify:n,async status(){let n=await e(c5e);if(!n.ok)throw Error(`Po answered ${n.status}.`);let r=await n.json();return r.signedIn!==!0&&t(l5e),{signedIn:r.signedIn===!0}},async signOut(){let n=await e(c5e,{method:`DELETE`});if(!n.ok)throw Error(`Po answered ${n.status}.`);return t(l5e),{signedIn:!1}}}}function p5e(){let e={id:`none`,revision:1,manifestUrl:u5e,rawAssetBaseUrl:`/plugins`,verifiedAssetBaseUrl:`/plugins`,pluginEntries:[],assetPaths:[],stylePaths:[],channels:[],plugins:[]};return{global:e,workspace:e,session:e}}function m5e(e=fetch){let t,n=async()=>{let t=await e(u5e,{credentials:`same-origin`,cache:`no-store`});if(t.status===404||!t.headers.get(`content-type`)?.includes(`json`))return p5e();if(!t.ok)throw Error(`Po answered ${t.status} for its web plugins.`);let n=await t.json();if(!n?.global||!n.workspace||!n.session)throw Error(`Invalid web plugin composition.`);return{global:n.global,workspace:n.workspace,session:n.session}};return()=>(t??=n().catch(e=>{throw t=void 0,e}),t)}function h5e(){return gP.state.hydrated?Promise.resolve():new Promise(e=>{let t=gP.subscribe(()=>{gP.state.hydrated&&(t.unsubscribe(),e())})})}function g5e(e){return{sameOrigin:!0,async read(){let[{global:t,workspace:n}]=await Promise.all([e(),h5e()]);return{global:t,workspaces:gP.state.order.map(e=>({id:e,webComposition:n})),template:{mount:{scope:`global`}}}}}}var _5e={active:()=>!1,fetch:(e,t)=>K9(e.startsWith(`/`)?`${z9}${e}`:e,t)};function v5e(e={}){let t=e.hub??N8e(window.location),n=e.publish??M8e,r=e.focusRuntime??((e,t)=>Z9(window.location,void 0,void 0,t5e(window.location,e,t)));fr(R9);let i=ze(_5e),a=ze(_5e,R9),o={phase:`ready`},{plugins:s}=e;s===void 0&&tk.setState(()=>({...o,mounts:{global:o},template:{mount:{scope:`global`}}}));let c,l=()=>{let{activeId:e,byId:t}=q.state,n=e!==null&&Y9(e)?t[e]:void 0;if(c!==void 0&&c.sessionId===n?.summary.id)return;if(c?.runtime.stop(),c=void 0,n?.summary.workspaceId===void 0){s?.focus(null);return}let{workspaceId:i,id:a}=n.summary;s===void 0?tk.setState(e=>({...e,mounts:{...e.mounts,[`workspace:${i}`]:o,[`session:${a}`]:o}})):s.focus(a,i);let l=r(i,a);c={sessionId:a,runtime:l},l.focus(a)},u=t.poll({onSnapshot(e){U9(()=>K9(`${z9}/api/client-devices`)).catch(()=>void 0),n(e),l()},onError:e=>console.error(`Po list failed.`,e)}),d=q.subscribe(l);return()=>{u(),d.unsubscribe(),a(),i(),fr(void 0),c?.runtime.stop(),c=void 0}}var y5e=`po:bundle-updated`;function b5e(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e;if(t.type===`po:bundle-updated`&&!(!Number.isSafeInteger(t.revision)||Number(t.revision)<1))return{type:y5e,revision:Number(t.revision)}}var x5e=`voice_ownership`;function $9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S5e(e){if(e.type!==x5e||!$9(e.payload))return;let t=e.payload.activeSessionId;return t===null||typeof t==`string`?t:void 0}function C5e(e){window.history.pushState(null,``,`/session/${encodeURIComponent(e)}`),window.dispatchEvent(new Event(`popstate`))}function w5e(e,t){let{activeId:n,tabOwnerId:r}=q.state,i=e===n?r??e:e;kI(i,i===e?t:{...t,targetSessionId:t.targetSessionId??e}),n===e&&(window.history.pushState(null,``,`/session/${encodeURIComponent(i)}/${encodeURIComponent(t.id)}`),window.dispatchEvent(new Event(`popstate`)))}function T5e(){BM(),window.location.reload()}function E5e(){if(typeof navigator>`u`||!(`serviceWorker`in navigator)||typeof document>`u`||typeof window>`u`)return()=>{};let e,t=()=>{document.visibilityState===`visible`&&e===void 0&&(e=a8e().then(()=>void 0,()=>void 0).finally(()=>{e=void 0}))},n=e=>{b5e(e.data)!==void 0&&T5e()},r=()=>{document.visibilityState===`visible`&&t()},i=()=>t(),a=t_(Qg(`web-bundle`),t),o=Tk(t);return navigator.serviceWorker.addEventListener(`message`,n),document.addEventListener(`visibilitychange`,r),window.addEventListener(`online`,i),t(),()=>{a(),o(),navigator.serviceWorker.removeEventListener(`message`,n),document.removeEventListener(`visibilitychange`,r),window.removeEventListener(`online`,i)}}function D5e(){Aye();let e=E5e(),t=sP(),n=new Set,r=!1,i=$j(w5e),a=(e,t,n)=>i.apply(e,t,n,aN(e).state.statuses),o=null,s,c,l,u=(e,t,n,r)=>{if(sN(e,t,{replay:n,source:r}),vv({...t,sessionId:e}),!n&&(gye(e,t),e===q.state.activeId)){if(t.type===`extension_ui_request`&&t.method===`select`&&mP(typeof t.id==`string`?t.id:``),t.type===`entry_appended`){let n=$9(t.entry)?t.entry:void 0;n?.type===`custom`&&n.customType===`po-resource-catalog`&&_k(e)&&ON(e)}t.type===`message_end`&&_k(e)&&kN(e),t.type===`agent_settled`&&(fP(),_k(e)&&ON(e))}},d=(e,t)=>{let n=q.state.byId[e]?.summary;if(e===q.state.activeId&&typeof document<`u`&&document.visibilityState===`visible`&&document.hasFocus())return;let r=Qk(t);if(r){Xt(e,r.entryId,r.data,n?.name);return}if(t.type!==`extension_ui_request`||typeof t.id!=`string`||n?.phase!==`turn`)return;let i=[t.title,t.message].find(e=>typeof e==`string`&&e.trim()!==``),a=S_e({title:`Input needed`,body:typeof i==`string`?i:`The agent is waiting for your answer.`});a&&Xt(e,`input:${t.id}`,a,n.name)},f=Z9(window.location,u,a),p,m=()=>{let e=p;p=void 0,e?.runtime.stop()},h=(e,t)=>{if(p?.sessionId===e||(m(),t===void 0))return;let n=Z9(window.location,u,a,t5e(window.location,t,e));p={sessionId:e,runtime:n},n.focus(e)},g=new Map,_=e=>{let t=g.get(e);t!==void 0&&(g.delete(e),t.dispose())},v=e=>{if(g.has(e))return;let t=JP(e,{readTranscriptPage:(t,n)=>IO(e,t,n.abortSignal)},u,ED,yn);g.set(e,t),t.initialize().catch(n=>{g.get(e)===t&&u(e,{type:`error`,message:n instanceof Error?n.message:String(n)},!1)})},y=()=>{for(let e of g.keys())_(e)},b=()=>{for(let e of n)TN(e);n.clear()},x=e=>{console.error(e instanceof Error?e:Error(String(e)))},S=(e=!1)=>{let{activeId:t,byId:i}=q.state,a=t!==null&&t in i?t:null,u=a!==null&&i[a].summary.dormant===!0,d=a!==null&&Y9(a),p=L9(a,a===null?void 0:u||d?null:i[a].summary.webComposition,a===null?void 0:i[a].summary.workspaceId);for(let e of g.keys())(e!==a||!u)&&_(e);if(d?(f.focus(null),h(a,i[a].summary.workspaceId)):(m(),u?(f.focus(null),v(a)):f.focus(a)),l!==void 0&&a!==null&&s===a){let e=l,t=c??=p;t.then(()=>{q.state.activeId===a&&s===a&&(l=void 0,c=void 0,s=void 0,vv(e),TM(a))},e=>{c===t&&(c=void 0),x(e)})}else p.catch(x);let y=new Set;a!==null&&!u&&y.add(a),o!==null&&o in i&&y.add(o);for(let e of AM.state)e in i&&y.add(e);for(let e of NF.state.keys())e in i&&!i[e].summary.dormant&&y.add(e);for(let e of y)Y9(e)&&y.delete(e);if(e&&b(),r){for(let e of n)y.has(e)||(n.delete(e),TN(e),FM(e));for(let e of y)n.add(e);N.watchSessions(y)}},C=e=>{FM(e),_(e),kye(e),DN(e),S8e(e),CI(e),MI(e),n.delete(e),o===e&&(o=null)},w=!1,T=!1,E=[],D=e=>{w||(w=!0,yn({name:`web.browser.ready`,duration_ms:_n()}));let t=new Set(e.flatMap(e=>$9(e)&&typeof e.id==`string`?[e.id]:[]));for(let e of Object.keys(q.state.byId))!t.has(e)&&sr(e)===void 0&&C(e);let n=new Map(E.map(e=>[e.id,e]));_M({sessions:e.map(e=>$9(e)&&typeof e.id==`string`?{...e,...n.get(e.id)}:e)}),S()},O=!1,k=0,A,j=!1,M=()=>{if(O){j=!0;return}O=!0;let e=k,t=new AbortController;A=t;let n=setTimeout(()=>t.abort(),1e4),r,i=new Promise((e,n)=>{r=()=>n(t.signal.reason),t.signal.addEventListener(`abort`,r,{once:!0})});Promise.race([(async()=>{let n=await jO(t.signal);if(`error`in n||T||e!==k||t.signal.aborted)return;let r=await sge(n.workspaces.map(e=>e.id),t.signal);`error`in r||T||e!==k||t.signal.aborted||(_P({workspaces:n.workspaces}),D(r.sessions))})(),i]).catch(e=>{t.signal.aborted||console.error(`Session listing failed.`,e)}).finally(()=>{clearTimeout(n),r&&t.signal.removeEventListener(`abort`,r),A===t&&(A=void 0),O=!1,j&&!T&&(j=!1,M())})},N=Bk(f.client,{onSessions(e){E=e;let{byId:t}=q.state,n=Object.keys(t).filter(e=>sr(e)===void 0);e.length!==n.length||e.some(e=>!(e.id in t))?M():(_M({sessions:e}),S())},onWorkspaces(){M()},onNotice(e,t){t.type!==`extension_ui_request`&&e!==q.state.activeId&&u(e,t,!1),d(e,t)},onThreadFrame(e,t,n){vI(e,t,n)||lN(yI(e,t),n)},onChannel(e){let t=S5e(e);if(t!==void 0){let n=o!==null&&t!==null&&t!==o;if(o=t,n){s=t,c=void 0,l=e,cye(t),C5e(t),wM(t),S();return}if(s!==void 0&&s!==t){let e=s;s=void 0,c=void 0,l=void 0,TM(e)}if(s===t){l=e;return}}vv(e),IF(e),t!==void 0&&S()},onOpen(){r=!0,S(!0),Ek(),M()},onClose(){k+=1,A?.abort(),r=!1,FM(),y(),iye(),b()},onCompositions:Ek,onUpdateRequired:yM});h_e(e=>N.send(e),e=>N.invokePlugin(e),(e,t)=>N.watchThread(e,t)),SI();let P=q.subscribe(()=>S());M();let ee=AM.subscribe(()=>S()),F=NF.subscribe(()=>S());return()=>{T=!0,k+=1,A?.abort(),e(),t(),i.dispose(),P.unsubscribe(),ee.unsubscribe(),F.unsubscribe(),y(),b(),L9(null,void 0),m(),f.stop(),FM(),g_e(),N.close()}}function O5e(e){let{activeId:t,byId:n}=q.state;if(e===t)return()=>void 0;let r=(e,t,n)=>sN(e,t,{replay:n});if(n[e]?.summary.dormant===!0){let t=JP(e,{readTranscriptPage:(t,n)=>IO(e,t,n.abortSignal)},r,ED,yn);return t.initialize().catch(t=>{r(e,{type:`error`,message:t instanceof Error?t.message:String(t)},!1)}),()=>t.dispose()}let i=Z9(window.location,r);return i.focus(e),()=>i.stop()}ooe([H$e]),fS(O5e),Aoe()||koe([]);for(let e of Q_())console.warn(`web plugin '${e.pluginId}' ${e.kind}: ${e.message}`);var k5e=Qx({routeTree:Q8e}),A5e=()=>({sendSessionFrame:Dk,sendHubFrame:kk,invokeServerMethod:jk,onHubConnected:Tk,acquireModelContext:UO,minorModes:oP,onComposerSubmitted:rr,onCaptureStatus:dye,openSession:e=>{q.state.byId[e]!==void 0&&k5e.navigate({to:`/session/$sessionId`,params:{sessionId:e}})},openSessionTab:(e,t)=>{q.state.byId[e]!==void 0&&kI(e,t)},closeSessionTab:jI});function j5e(){let[e,t]=(0,V.useState)(()=>Q9()?`ready`:`loading`);return(0,V.useEffect)(()=>{let e,n,r,i=!1,a=()=>{r?.(),r=void 0,n?.(),n=void 0,e?.(),e=void 0,Wge()};if(Q9()){let t=f5e();window.poDesktop={...window.poDesktop,platform:s5e,cloud:t},t.status().catch(e=>console.error(`Po sign-in status failed.`,e));let r=m5e();return n=C8e(A5e(),g5e(r)),e=v5e({plugins:{focus:(e,t)=>{r().then(({session:n})=>L9(e,n,t)).catch(e=>console.error(`Po web plugins failed to mount.`,e))}}}),a}let o=tt(()=>{a(),t(`error`)});return ot().then(a=>{i||(!a&&![`localhost`,`127.0.0.1`,`[::1]`].includes(location.hostname)?t(`error`):(n=C8e(A5e()),e=D5e(),t(`ready`),r=t_(Qg(`remote`),()=>{SF()}),SF(),zge()))}).catch(e=>{i||(a(),console.error(`Cockpit connection failed.`,e),t(`error`))}),()=>{i=!0,o(),a()}},[]),e===`ready`?(0,H.jsx)(ZK,{children:(0,H.jsx)(tS,{router:k5e})}):(0,H.jsx)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 bg-po-bg p-5 text-base text-po-text`,children:e===`loading`?(0,H.jsx)(`p`,{role:`status`,"data-testid":`connection-loading`,className:`text-po-dim`,children:`Connecting to Po…`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{role:`alert`,"data-testid":`connection-error`,children:`Could not establish a connection to Po. Reload or sign in again.`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-4`,children:[(0,H.jsx)(Z,{variant:`outline`,onClick:()=>location.reload(),children:`Reload`}),(0,H.jsx)(`a`,{href:`/pair`,className:`text-po-blue underline`,children:`Sign in or pair again`})]})]})})}var M5e=`po:stale-chunk-reload-attempted`,N5e=`Failed to fetch dynamically imported module`;function P5e(e){if(!(`payload`in e))return!1;let t=e.payload;return t instanceof Error&&t.message.startsWith(N5e)}function F5e(e={}){let t=e.target??window,n=e.storage??window.sessionStorage,r=e.reload??(()=>window.location.reload()),i=e=>{if(P5e(e)){try{if(n.getItem(M5e))return;n.setItem(M5e,`1`)}catch{return}e.preventDefault(),r()}};return t.addEventListener(`vite:preloadError`,i),()=>t.removeEventListener(`vite:preloadError`,i)}F5e(),Q9()&&hn(),wn({sessionId:EM}),D_(bn);var I5e=document.getElementById(`root`);if(!I5e)throw Error(`The cockpit needs a #root element.`);fI(),W9().then(()=>{(0,oSe.createRoot)(I5e).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(j5e,{})}))});export{zJ as $,A6 as A,O6 as B,j6 as C,z6 as D,X6 as E,n8 as F,bY as G,C8 as H,K6 as I,mY as J,gY as K,b6 as L,m8 as M,g8 as N,c8 as O,u8 as P,RJ as Q,r8 as R,t8 as S,o8 as T,E6 as U,l8 as V,s1e as W,eY as X,BJ as Y,QJ as Z,r3e as _,O5 as a,mO as at,j8 as b,x6e as c,m_ as ct,L3e as d,OJ as et,V6e as f,K3e as g,T5 as h,o9 as i,xhe as it,Y6 as j,V6 as k,n9 as l,L6e as m,d5 as n,She as nt,H8 as o,pO as ot,P7 as p,ZPe as q,M7 as r,Che as rt,f3e as s,ox as st,W8 as t,J as tt,D6e as u,b6e as v,M6 as w,E8 as x,i9 as y,D6 as z};
|
|
155
|
-
//# sourceMappingURL=index-
|
|
155
|
+
//# sourceMappingURL=index-B7gbu-ML.js.map
|