@agimon-ai/po-cloudflare 0.0.2-alpha.74 → 0.0.2-alpha.76
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/{approval-DXPV7Vm5.js → approval-BlHIxC2J.js} +18 -5
- package/dist/{approvalPrompt-CBaxjb_g.js → approvalPrompt-w2k884MA.js} +25 -3
- package/dist/{approvalSession-C9bg7tPo.js → approvalSession-UtzXVEB4.js} +6 -4
- package/dist/assets/assets/{CodeEditorView-CfrVwzvL.js → CodeEditorView-CaFk98Ji.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-B80H4Cm4.js → abnfDiagram-WEYOIA3C-gzdpxFaJ.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-Dr4hXaql.js → architecture-WOLXFQ4H-TugrtWoO.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DWyt7oXu.js → architectureDiagram-ZHVYKT53-Xy_pnmaH.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-OxNTLdmi.js → blockDiagram-RJAE7QA3-pH1-jWYL.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-B4YtcH0s.js → c4Diagram-XDPPPE54-CWmWk7y2.js} +2 -2
- package/dist/assets/assets/channel-CJxh7kPr.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-CD6FFMOX.js → chunk-2E7WHVMD-C2O60zos.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-CEIoX5oo.js → chunk-4EMNKR2T-CEHzGYY0.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CD3t0IJi.js → chunk-55XCU76K-CjyzuqJm.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-Cyt75UCF.js → chunk-7S6XSTFO-Db8_vjDs.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-DRtqYBj9.js → chunk-AQDTSKZB-92c_fipW.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-C8Fx2F8s.js → chunk-DSNLSHJZ-DFGW_rzV.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-wOLWRRnd.js → chunk-HAGFOTED-Cpx79XgA.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-CurJg4Hf.js → chunk-HNE4Q36P-cz6K5cWs.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-Dzcc5nOG.js → chunk-NQOKRVIF-Bhj8Cnrq.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-B_ULFf2h.js → chunk-UHW7PFBP-DugRZU3d.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-DH0VY4_p.js → chunk-VQ5W62QI-CFXU98Td.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-DNxfLyXM.js → chunk-WQQL4CDK-BDYjxxgH.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-B7vCmBOn.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-COuMUh9U.js → chunk-YZO67HFG-Bw3Zv3ms.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-BJrCnubF.js → chunk-ZAUX2LTX-reWd5PI6.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-D1lFKPtk.js → chunk-ZCHMQSOR-RCmNKJ0K.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-DfZIbyVL.js → classDiagram-v2-4MYWR3UA-DOBOI7kO.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-CpGhv9_S.js → cose-bilkent-JH36ORCC-Dnga9ThU.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-Cxdc6nQl.js → cynefin-EF2NZ3EQ-mbxppeTd.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-qoj0w3lp.js → cynefinDiagram-WF24UDRP-D5uSCW7P.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-DL6QbNDS.js → dagre-NK4GIZVX-D3Utujwv.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-CJB3jq1_.js → diagram-CBK3MWTC-Bg8QfzPb.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-4cPOxCxF.js → diagram-I5XIIV2D-NjETU96V.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-BG3-jAxE.js → diagram-ODIL2UCW-BRY10xxY.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-Bx8dFaXj.js → diagram-PFBEJUXE-CO5Nfc2a.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-CUUHND91.js → diagram-RJA3I4VV-jxuLnXXk.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-BDMoN-kr.js → diagram-TYUNFSNR-B-dUsynt.js} +2 -2
- package/dist/assets/assets/{dist-5AxNm-uy.js → dist-9C1WeAys.js} +2 -2
- package/dist/assets/assets/{dist-BjI0b36Z.js → dist-BMmgMuDM.js} +2 -2
- package/dist/assets/assets/{dist-9_Rmyj2I.js → dist-Bsp48Zck.js} +2 -2
- package/dist/assets/assets/{dist-BE3CLKv4.js → dist-C8son2cz.js} +2 -2
- package/dist/assets/assets/{dist-CjCWP21A.js → dist-CUuM0eUM.js} +2 -2
- package/dist/assets/assets/{dist-BfNCu-7x.js → dist-CXebcDwS.js} +2 -2
- package/dist/assets/assets/{dist-Ccxb9U1G.js → dist-DtWJqHVb.js} +2 -2
- package/dist/assets/assets/{dist-CM7b5P9a.js → dist-JCg255PN.js} +2 -2
- package/dist/assets/assets/{dist-DSTAktnR.js → dist-lOIB9DJk.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BivOMXZb.js → ebnfDiagram-V4P3TTPT-KNVNlIfc.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-CrJ1Qpy_.js → elk-QONTBCTQ-DsX7hxD1.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-w9Bqp4sV.js → erDiagram-KYQIGQAA-pjQN44eX.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-CBjFM3kV.js → eventmodeling-K75KTNOO-BCKz9w4V.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BU7xmb8h.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CsWtGaqD.js → ganttDiagram-R7GPNTJY-CeuiGYpW.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-DsBSV9_h.js → gitGraph-VSP46ZUC-BsN0Vwsr.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-D5GxuYHW.js → gitGraphDiagram-PDYL7XHY-ZIMBu3bo.js} +2 -2
- package/dist/assets/assets/{index-DWDYnZsq.js → index-fYkh5qQp.js} +86 -86
- package/dist/assets/assets/{info-OHQRW6UA-C7x5dSJu.js → info-OHQRW6UA-CJmrVYr6.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-CwpI-uAa.js → infoDiagram-MVDRKAX5-BsAIEQmU.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-DAa7J5G6.js → ishikawaDiagram-HPEHV2GE-BX_86A9r.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-BmiZnxE_.js → journeyDiagram-BOSHW7O7-DVGI0WoP.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DUR_mA3L.js → kanban-definition-FNSA4HC5-4RLBwWbL.js} +2 -2
- package/dist/assets/assets/{line-DHY49wSg.js → line-BL8hbik-.js} +2 -2
- package/dist/assets/assets/{linear-pTo-a9xT.js → linear-BWVrkBYc.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-DMg3hN3T.js → mermaid-parser.core-CMk5l3Wp.js} +4 -4
- package/dist/assets/assets/{mermaid.core-DKtPCltA.js → mermaid.core-DZuf73R_.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-DwTkFbnV.js → mindmap-definition-6OY57UG3-CPuk1tgo.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-Tu9TrQ1x.js → packet-JDAUHWVQ-pVue6YBL.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-B7My4tsz.js → pegDiagram-ECIUJNBX-B8Ly6ehm.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-QPQm5Gdx.js → pie-XZMESJXO-DXAHc3bX.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-Bv-zAD_z.js → pieDiagram-GNMPY74T-9nVo6xZM.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-HTjoGQPd.js → quadrantDiagram-D57K4MC3-DbBqshQw.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-LDBlEoFo.js → radar-ABXABTNO-CKPxbvS6.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-Dy3_ymgZ.js → railroad-I3PHUGI6-CULlMjWr.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-QLVvYs6e.js → railroad-abnf-LNEFI6M7-BRjXoZsa.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-CFRlv9a8.js → railroad-ebnf-DWYD2UWJ-CD_uPeUF.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-BOlq3d9c.js → railroad-peg-JR7BVNR7-Cv-b3SRa.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-Chg32HoU.js → railroadDiagram-Y72NRBL7-DJ77wAhA.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-VenIs_eg.js → requirementDiagram-EQYSW5RA-R7PFvkp-.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-BdByqMKF.js → sankeyDiagram-SY24JHO5-DR2gLc8z.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-D3Do4GJE.js → sequenceDiagram-BLEHNHQU-TwEQL0yK.js} +2 -2
- package/dist/assets/assets/{src-DmfN-DA-.js → src-Cv8dmcJt.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-CZkRbPlf.js → stateDiagram-v2-A6IESKWZ-ShloXczl.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-DRTdF9AF.js → swimlanes-B3ENRKFQ-D17E07lx.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-i6-zDqZm.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-BVcuws_M.js → timeline-definition-JXYKGLGB-BEvN2l_s.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-BLtOJGqO.js → treeView-D4JQ5SDB-B0QcYOKz.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-Dn3BWJ4v.js → treemap-SAJKECNS-CIGIJniE.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-CBExIKDY.js → usecaseDiagram-WPOLBNNX-DbS-GLv8.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-C6FIx2L4.js → vennDiagram-Q3Y3IDCW-CEkmUNoT.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-Cjj2xSBp.js → wardley-7MLQ67FV-D9b-h7oE.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-sQPCBCFK.js → wardleyDiagram-IVAIDKWA-BoWIYn_M.js} +2 -2
- package/dist/assets/assets/{webpack-DDCA0aDL.js → webpack-rEg3nylj.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-bZ4rifSw.js → xychartDiagram-4URNHDU4-xJdWE_nx.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +1 -1
- package/dist/assets/plugins/chunks/po-web-runtime-CQ9hLtG-.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.09e72f36-B4Y8Wjzl.js +2 -0
- package/dist/assets/plugins/slots/artifacts.50b639bb-5Kf50LM1.js +1 -0
- package/dist/assets/plugins/slots/author.ea449ace-BUAjd0RY.js +93 -0
- package/dist/assets/plugins/slots/{autocompact.ec8f713f-CDZpN7I7.js → autocompact.6f428144-DUwf4L4s.js} +1 -1
- package/dist/assets/plugins/slots/{backdrop-bamboo.1a4d85e9-qbifuMc6.js → backdrop-bamboo.6e4c928d-CT9PXrny.js} +1 -1
- package/dist/assets/plugins/slots/browse.fa1f1a50-ClrBioNv.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.75108f21-DmtavYBT.js +7 -0
- package/dist/assets/plugins/slots/calendar.d8b70190-DmudDrcG.js +2 -0
- package/dist/assets/plugins/slots/codemode.c58fb583-BkVR1X2Y.js +11 -0
- package/dist/assets/plugins/slots/domain.753f9f92-Bv-dlY79.js +1 -0
- package/dist/assets/plugins/slots/edit.804fec90-mJXCIk4G.js +7 -0
- package/dist/assets/plugins/slots/files.66ffc636-CCRW8t1-.js +2 -0
- package/dist/assets/plugins/slots/goal.45dffa01-q_Zh5QxW.js +1 -0
- package/dist/assets/plugins/slots/grep.98262cff-CTDwtVaK.js +1 -0
- package/dist/assets/plugins/slots/help.5fbd20f7-BBw7NYJI.js +3 -0
- package/dist/assets/plugins/slots/{log.07fd59a4-BRPa3cVs.js → log.cb964209-BLY7IzD1.js} +4 -4
- package/dist/assets/plugins/slots/mcp.82cc1ff5-5yoTabz8.js +55 -0
- package/dist/assets/plugins/slots/plan.3852ba52-DmdaEVVw.js +3 -0
- package/dist/assets/plugins/slots/profile.ab16dcec-DOw3MhWl.js +1 -0
- package/dist/assets/plugins/slots/prompts.ae48c07a-DQVmTxFZ.js +38 -0
- package/dist/assets/plugins/slots/read.4560591a-Bun0fKn1.js +1 -0
- package/dist/assets/plugins/slots/runner.6e494d59-BDtBIqmQ.js +9 -0
- package/dist/assets/plugins/slots/scaffold.d87a6ee0-DZOiNwOS.js +1 -0
- package/dist/assets/plugins/slots/session-mcp.2be84084-DQpF2DkA.js +2 -0
- package/dist/assets/plugins/slots/sessions.6f47cb4c-y61JDvak.js +1 -0
- package/dist/assets/plugins/slots/skill.62a0a1b3-C-mkriRv.js +4 -0
- package/dist/assets/plugins/slots/{space.056e8bbc-fbLHc-DX.js → space.65a27e5a-Cr1HSI_z.js} +1 -1
- package/dist/assets/plugins/slots/subagents.8bb9992c-CrpR1Jhi.js +7 -0
- package/dist/assets/plugins/slots/template-advanced.59f3f98a-CSuMHJ9x.js +1 -0
- package/dist/assets/plugins/slots/template-desktop.0f0b8491-C2ZheI0_.js +7 -0
- package/dist/assets/plugins/slots/template-elegant.0e3b0acf-Cq5Y_6VL.js +1 -0
- package/dist/assets/plugins/slots/vault.3cbfcdc3-ZKO66wy8.js +1 -0
- package/dist/assets/plugins/slots/voice.a952113d-CsdoPA4G.js +1 -0
- package/dist/assets/plugins/slots/{web-search.f6292793-NVh9fdvE.js → web-search.65013836-C7W5RyLj.js} +1 -1
- package/dist/assets/plugins/slots/workflows.cbc5c5c0-BLNlHcfa.js +16 -0
- package/dist/assets/pwa/sw.js +5 -5
- package/dist/{calendarSetup-CI3AACVo.js → calendarSetup-Do-hM0Li.js} +1 -1
- package/dist/{exports-CBp_9dVk.js → exports-t_BpzyPr.js} +1 -1
- package/dist/{index.edge-kJrIbDzE.js → index.edge-BRaAhap2.js} +1 -1
- package/dist/{profileSources-D1rymC97.js → profileSources-DIlA86Qk.js} +1 -1
- package/dist/{server-BcPD_6a2.js → server-2xgrdxY_.js} +2 -2
- package/dist/{server-B51reaJ9.js → server-7-DnO2Ww.js} +5 -4
- package/dist/{server-DebdjWjz.js → server-B3U0W7zD.js} +1 -1
- package/dist/{server-B3jB3q_h.js → server-BJssIIpm.js} +1 -1
- package/dist/{server-NKqdiQ5G.js → server-BLcw1z6S.js} +1 -1
- package/dist/{server-Byk0FT6E.js → server-BPS6xFya.js} +1 -1
- package/dist/{server-DLDK_aeG.js → server-BSpJMYLb.js} +2 -2
- package/dist/{server-BsjwqF7J.js → server-BUBijhBb.js} +2 -2
- package/dist/{server-CUGzeCH4.js → server-BUgDdcRW.js} +1 -1
- package/dist/{server-EYARWKpG.js → server-BeAYfrzJ.js} +1 -1
- package/dist/{server-DEKg8AVN.js → server-BlbuM_IJ.js} +2 -2
- package/dist/{server-_vSe9bTM.js → server-BqvkcVLn.js} +1 -1
- package/dist/{server-Dosi6o2W.js → server-CKQwNrO8.js} +4 -4
- package/dist/{server-B20agHjD.js → server-CLRgSPVY.js} +1 -1
- package/dist/{server-DYKXGQVY.js → server-CMov-S5-.js} +1 -1
- package/dist/{server-BsEMLlTz.js → server-CaFzaibK.js} +1 -1
- package/dist/{server-wQHKuB2m.js → server-CcKKktvn.js} +1 -1
- package/dist/{server-dBNqYUdX.js → server-D6-_DT9g.js} +1 -1
- package/dist/{server-vZL2icDV.js → server-DAFM6HnJ.js} +2 -2
- package/dist/{server-DI6YhDI5.js → server-DMbdJzSQ.js} +2 -2
- package/dist/{server-C-HBjWRo.js → server-DNpneoqA.js} +1 -1
- package/dist/{server-hJ4tYEt4.js → server-DPG7BH6w.js} +5 -5
- package/dist/{server-CpbBJ9ZU.js → server-DeFqeFTs.js} +1 -1
- package/dist/{server-BD_tbxwG.js → server-Dl3sng3O.js} +2 -2
- package/dist/{server-CqDWkfdL.js → server-Dnvp2U6V.js} +3 -3
- package/dist/{server-CQmb0lYL.js → server-HIbQWBba.js} +36 -17
- package/dist/{server-CAipGCpQ.js → server-OzzJbeaS.js} +2 -2
- package/dist/{server-DmqO6gBs.js → server-fYfb0gN8.js} +16 -8
- package/dist/{sessionConfig-UMlgu98q.js → sessionConfig-BYow7MOB.js} +1 -1
- package/dist/{web-B2sdV-F2.js → web-CLiZJpHK.js} +1 -1
- package/dist/worker.js +208 -130
- package/package.json +49 -49
- package/dist/assets/assets/channel-bXj00dGj.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-B2bMWgN9.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-C6Fnfgm0.js +0 -1
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BYr_4JUb.js +0 -9
- package/dist/assets/plugins/chunks/po-web-runtime-D8FIos2q.js +0 -1
- package/dist/assets/plugins/slots/approval.3e4ea6e4-DxS_uibk.js +0 -2
- package/dist/assets/plugins/slots/artifacts.84980c32-Cp37TAkd.js +0 -1
- package/dist/assets/plugins/slots/author.8eca1a3d-Ds9Y-tjN.js +0 -93
- package/dist/assets/plugins/slots/browse.61a8907a-CVYvo1M5.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.16ef5e25-Cq1ljoL-.js +0 -7
- package/dist/assets/plugins/slots/calendar.d337fc49-BBjpOs1v.js +0 -2
- package/dist/assets/plugins/slots/codemode.5f359b9c-DOR6OR7R.js +0 -11
- package/dist/assets/plugins/slots/domain.832848c8-CJrXxig9.js +0 -1
- package/dist/assets/plugins/slots/edit.7c802139-BFF7_xN9.js +0 -7
- package/dist/assets/plugins/slots/files.364f16c9-CzOlZrRm.js +0 -2
- package/dist/assets/plugins/slots/goal.a97b169d-BtQBp3sw.js +0 -1
- package/dist/assets/plugins/slots/grep.d8bf9f57-9bUDfjyT.js +0 -1
- package/dist/assets/plugins/slots/help.5c78c071-B4-y6gYK.js +0 -3
- package/dist/assets/plugins/slots/mcp.ea8b6aa2-CFtzPkPC.js +0 -55
- package/dist/assets/plugins/slots/plan.7b30f8d8-CH59Ff49.js +0 -3
- package/dist/assets/plugins/slots/profile.63bc3ae6-0e9fWWyE.js +0 -1
- package/dist/assets/plugins/slots/prompts.9d9b47cc-BTqYnBX5.js +0 -38
- package/dist/assets/plugins/slots/read.926c024f-C7fMXDEH.js +0 -1
- package/dist/assets/plugins/slots/runner.5393fa6c-CqrpqhW9.js +0 -9
- package/dist/assets/plugins/slots/scaffold.686222eb-9qY5gkYW.js +0 -1
- package/dist/assets/plugins/slots/session-mcp.8eb68fc9-Cf0cqopp.js +0 -2
- package/dist/assets/plugins/slots/sessions.8e378a3b-B1_eqPJQ.js +0 -1
- package/dist/assets/plugins/slots/skill.56c1cc07-D-SKX8iw.js +0 -4
- package/dist/assets/plugins/slots/subagents.31fc045b-Cm_YMEnn.js +0 -7
- package/dist/assets/plugins/slots/template-advanced.9e8350fe-L0WOM4JT.js +0 -1
- package/dist/assets/plugins/slots/template-desktop.69a46f62-By9BZlaL.js +0 -7
- package/dist/assets/plugins/slots/template-elegant.381f6acb-El05x7HK.js +0 -1
- package/dist/assets/plugins/slots/vault.587549ba-DpU_65Wy.js +0 -1
- package/dist/assets/plugins/slots/voice.9c687181-CvcuL__m.js +0 -1
- package/dist/assets/plugins/slots/workflows.8a13baad-OLKSY9PE.js +0 -16
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$r as e,$t as t,A as n,Ar as r,B as i,Bt as a,C as o,D as s,Di as c,Dn as l,Dt as u,E as d,Et as f,F as p,Fn as m,Ft as h,G as g,Ga as _,Gi as v,H as y,Hn as b,Ht as x,It as S,J as C,Jr as w,K as T,Ka as E,Ki as D,Kt as O,L as k,Lt as A,M as j,N as M,O as N,Ot as P,P as F,Pi as I,Pt as L,Q as R,R as z,Rr as B,S as ee,Si as V,St as te,T as ne,Ti as re,Tt as ie,Ut as ae,Vi as oe,Wi as H,X as U,Xi as W,Y as se,Yi as G,Z as ce,Za as le,Zi as K,_ as ue,_a as de,_i as fe,_t as q,a as pe,ai as me,at as he,b as ge,bn as _e,bt as ve,c as ye,cn as be,cr as xe,d as Se,dt as Ce,ea as J,et as we,f as Te,ft as Ee,g as De,ga as Oe,gt as ke,h as Ae,ha as je,in as Me,it as Ne,j as Pe,ji as Fe,jn as Ie,li as Le,lt as Re,mt as ze,n as Be,na as Y,ni as Ve,nn as He,nt as Ue,o as We,oa as X,ot as Ge,p as Ke,pn as qe,pt as Je,q as Ye,qi as Xe,qt as Z,r as Ze,ra as Q,rn as Qe,s as $e,sa as et,sn as tt,st as nt,t as rt,ta as it,ti as at,tn as $,u as ot,ut as st,v as ct,va as lt,w as ut,wn as dt,wt as ft,x as pt,xn as mt,xt as ht,y as gt,z as _t,zt as vt}from"../chunks/po-web-runtime-D8FIos2q.js";function yt(e){return e.slice(e.lastIndexOf(`/`)+1)||e}function bt({start:t,listDirectory:n,onSelect:r}){let[i,a]=Z(t),[o,s]=Z(null),[c,l]=Z(``);return x(()=>{let e=!1;return n(i).then(t=>{e||(`error`in t?l(t.error):(l(``),s(t)))}),()=>{e=!0}},[i,n]),A(`div`,{"data-testid":`folder-browser`,className:`flex flex-col gap-1 rounded border border-po-border bg-po-deep p-1`,children:[A(`div`,{className:`flex items-center gap-1 px-1`,children:[S(e,{variant:`ghost`,size:`icon`,"data-testid":`folder-browser-up`,title:`parent folder`,"aria-label":`parent folder`,disabled:o?.parent===void 0,onClick:()=>o?.parent!==void 0&&a(o.parent),children:S(Fe,{className:`h-3 w-3`})}),S(`span`,{className:`min-w-0 flex-1 truncate text-sm text-po-dim`,title:o?.path,children:o?.path??`loading…`}),S(e,{variant:`outline`,size:`xs`,"data-testid":`folder-browser-select`,disabled:o===null,onClick:()=>o!==null&&r(o.path),children:`use this folder`})]}),c?S(`p`,{className:`px-2 py-1 text-sm text-po-red`,children:c}):null,A(`div`,{role:`listbox`,"aria-label":`folders`,className:`max-h-40 overflow-y-auto`,children:[o!==null&&o.directories.length===0?S(`p`,{className:`px-2 py-1 text-sm text-po-dim`,children:`no folders here`}):null,o?.directories.map(e=>S(dt,{density:`compact`,"data-testid":`folder-browser-entry`,onClick:()=>a(e),className:`w-full px-2.5 py-1 `,children:yt(e)},e))]})]})}var xt=120,St=-1,Ct=/\/+$/u;function wt(e){let t=e.trim().replace(Ct,``);return t.slice(t.lastIndexOf(`/`)+1)}function Tt({suggestedPaths:e,actions:t}){let n=L(u,e=>e),r=n.path??e[0]??``,[i,a]=Z({path:``,directories:[]});return x(()=>{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)})},xt);return()=>{n=!0,clearTimeout(i)}},[r,t]),x(()=>g(r,t.discoverWorkspaces),[r,t.discoverWorkspaces]),S(Et,{suggestions:r.trim()!==``&&i.path===r?i.directories:[],suggestedPaths:e,actions:t,draft:n,updateDraft:Ee})}function Et({suggestedPaths:t,actions:n,draft:r,updateDraft:i,style:a,suggestions:o=[]}){let{name:s,nameEdited:c,instructions:l,pending:u,error:d,discovery:f}=r,p=r.path??t[0]??``,m=e=>i({name:e}),g=e=>i({nameEdited:e}),_=e=>i({path:e}),[y,b]=Z(!1),[x,C]=Z(St),T=O(null),E=c?s:wt(p),k=e=>{u||(_(e),C(St))},j=e=>{k(`${e}/`),T.current?.focus()},M=p.trim().replace(Ct,``)||(p.trim()===``?``:`/`),N=r.discovering||!!p.trim()&&n.discoverWorkspaces!==void 0&&r.discoveryPath!==p,P=f&&`error`in f?f.error:``,F=f&&`declarations`in f&&f.declarations.length>0?f.declarations:void 0,I=e=>F?.find(t=>t.name===e)?.workspaceId??r.results.find(t=>t.name===e)?.workspaceId,L=F?.filter(e=>r.checked.includes(e.name)&&!I(e.name)).map(e=>e.name)??[],R=!F&&!N&&!P,z=!u&&!N&&!P&&(F?L.length>0&&n.addDeclaredWorkspaces!==void 0:M!==``||E.trim()!==``),B=async()=>{z&&(F?await n.addDeclaredWorkspaces?.({path:f&&`root`in f?f.root:M,names:L}):await n.addWorkspace({...l===``?{}:{instructions:l},name:E.trim(),...M===``?{}:{path:M}}))};return S(H,{open:!0,onOpenChange:e=>!e&&!u&&n.closeAddWorkspace(),children:A(D,{style:a,width:`md`,"data-testid":`add-workspace-dialog`,"aria-describedby":void 0,children:[S(W,{children:S(K,{children:`Add workspace`})}),A(v,{children:[A(`label`,{htmlFor:`add-workspace-root`,className:`flex flex-col gap-1`,children:[S(`span`,{className:`text-base font-medium text-po-dim`,children:`Folder`}),A(`span`,{className:`flex items-center gap-1.5`,children:[S($,{id:`add-workspace-root`,ref:T,"data-testid":`add-workspace-root`,value:p,autoFocus:!0,disabled:u,onChange:e=>k(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`&&o.length>0)e.preventDefault(),C(e=>(e+1)%o.length);else if(e.key===`ArrowUp`&&o.length>0)e.preventDefault(),C(e=>e<=0?o.length-1:e-1);else if(e.key===`Enter`){let e=x===St?void 0:o[x];e===void 0?B():j(e)}},placeholder:`~/workspace/my-project`,className:`min-w-0 flex-1 font-mono`}),S(e,{variant:y?`subtle`:`outline`,size:`md`,"data-testid":`add-workspace-browse`,"aria-pressed":y,disabled:u,onClick:()=>b(e=>!e),children:`Browse`})]})]}),y?S(bt,{...M.startsWith(`/`)?{start:M}:{},listDirectory:n.listDirectory,onSelect:e=>{k(e),b(!1)}}):o.length>0?S(`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:o.map((e,t)=>S(dt,{density:`compact`,active:t===x,"data-testid":`add-workspace-suggestion`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>C(t),onClick:()=>j(e),className:`w-full px-2.5 py-1 `,children:e},e))}):null,t.length>0?S(`div`,{className:`flex flex-wrap gap-1`,children:t.slice(0,4).map(t=>S(e,{variant:`outline`,size:`xs`,disabled:u,onClick:()=>k(t),children:t},t))}):null,N?S(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Reading workspace declarations…`}):null,P?S(`p`,{role:`alert`,className:`text-sm text-po-red`,children:P}):null,F?A(`fieldset`,{className:`flex min-w-0 flex-col gap-1`,children:[S(`legend`,{className:`mb-1 text-base font-medium text-po-hi`,children:`Workspaces`}),S(`p`,{className:`mb-1 text-sm text-po-dim`,children:`Declared in .po/config.yaml. Choose which to add.`}),F.map((e,t)=>{let n=I(e.name)!==void 0,a=n||r.checked.includes(e.name),o=r.results.find(t=>t.name===e.name)?.error;return S(`div`,{"data-checked":a,className:`rounded-sm px-2 py-1.5 data-[checked=true]:bg-po-tint-green`,children:A(`label`,{htmlFor:`add-workspace-declaration-${t}`,className:`flex min-w-0 cursor-pointer items-start gap-2.5`,children:[S(V,{id:`add-workspace-declaration-${t}`,checked:a,disabled:n||u,onCheckedChange:()=>i({checked:a?r.checked.filter(t=>t!==e.name):[...r.checked,e.name]}),className:`mt-1`}),A(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[S(`span`,{className:`text-base font-semibold text-po-hi`,children:e.name}),S(`span`,{className:`truncate text-sm text-po-dim`,title:e.instructions,children:e.instructions}),o?S(`span`,{role:`alert`,className:`text-sm text-po-red`,children:o}):null]}),n?S(`span`,{className:`text-sm text-po-dim`,children:`Added`}):null]})},e.name)})]}):R?A(h,{children:[A(`label`,{htmlFor:`add-workspace-name`,className:`flex flex-col gap-1`,children:[S(`span`,{className:`text-base font-medium text-po-dim`,children:`Name`}),S($,{id:`add-workspace-name`,"data-testid":`add-workspace-name`,value:E,disabled:u,onChange:e=>{g(!0),m(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&B()},placeholder:`my-project`})]}),A(`label`,{htmlFor:`add-workspace-instructions`,className:`flex flex-col gap-1`,children:[A(`span`,{className:`text-base font-medium text-po-dim`,children:[`Instructions `,S(`span`,{className:`font-normal`,children:`(optional)`})]}),S(w,{id:`add-workspace-instructions`,rows:3,value:l,disabled:u,onChange:e=>i({instructions:e.target.value})}),S(`span`,{className:`text-sm text-po-dim`,children:`For main sessions in this workspace.`})]})]}):null,R&&M===``&&E.trim()!==``?A(`p`,{"data-testid":`add-workspace-default-hint`,className:`text-sm text-po-dim`,children:[`creates ~/.po/workspace/`,E.trim()]}):null,d?S(`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:d}):null,A(G,{children:[S(e,{variant:`outline`,onClick:()=>n.closeAddWorkspace(),disabled:u,children:`Cancel`}),S(e,{variant:`primary`,"data-testid":`add-workspace-confirm`,onClick:()=>void B(),disabled:!z,children:u?`Adding…`:F?`Add ${L.length} ${L.length===1?`workspace`:`workspaces`}`:`Add workspace`})]})]})]})})}var Dt=`rail/workflow-steps-expanded`,Ot=e=>e.awaitingInput||(e.waitingCount??0)>0;function kt(e){let t=new Set(e.map(({session:e})=>e.id)),n=new Map,r=[];for(let i of e){let e=i.session.parentId;i.session.provenance===`workflow`&&e!==void 0&&t.has(e)?n.set(e,[...n.get(e)??[],i]):r.push(i)}let i=r.sort((e,t)=>(t.session.lastActivityAt??0)-(e.session.lastActivityAt??0)).map(e=>[e,...n.get(e.session.id)??[]]),a=e=>e.some(({session:e})=>Ot(e));return[{key:`needs`,title:`Needs you`,data:i.filter(a).flat()},{key:`recent`,title:`Recent`,data:i.filter(e=>!a(e)).flat()}].filter(e=>e.data.length>0)}function At({sessionId:t,setup:n,actions:r}){let i=JSON.stringify([`rail/setup`,t,n.id]),[a,o,s]=q(`${i}/busy`,!1),[c,l]=q(`${i}/error`,``),u=async()=>{if(s.state)return;o(!0),l(``);let e=await r.removePendingSetup(t,n.id);o(!1),e!==void 0&&l(e.error)};return A(`div`,{"data-testid":`pending-session-${n.id}`,className:`ml-4 rounded-md border border-po-border-soft bg-po-panel p-3`,children:[A(`div`,{className:`flex items-center justify-between gap-2`,children:[S(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:n.name}),A(J,{children:[S(X,{asChild:!0,children:S(e,{variant:`ghost`,size:`icon`,title:`session setup actions`,disabled:a,"data-testid":`pending-session-menu-${n.id}`,children:S(Qe,{className:`h-3 w-3`})})}),S(Y,{children:S(Q,{variant:`destructive`,onSelect:()=>void u(),children:`remove setup`})})]})]}),S(`p`,{className:n.failed?`text-sm text-po-red`:`text-sm text-po-dim`,children:n.status}),n.recovery?S(`p`,{role:n.failed?`alert`:void 0,className:`text-sm text-po-dim`,children:n.recovery}):null,c?S(`p`,{role:`alert`,className:`text-sm text-po-red`,children:c}):null]})}function jt(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 Mt(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 Nt({groups:e}){return A(`span`,{"data-testid":`session-groups`,"aria-label":`groups`,className:`flex min-w-0 items-start gap-1.5 text-sm text-po-dim`,children:[S(Ve,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0`}),S(`span`,{className:`flex min-w-0 flex-wrap gap-1`,children:e.map(e=>S(xe,{tone:`magenta`,size:`xs`,className:`font-normal`,children:e},e))})]})}function Pt({options:t,value:n,query:r,active:i,renaming:a,deleting:o,error:s,busy:c=!1,onQueryChange:l,onToggle:u,onCreate:d,onActive:f,onRenameStart:p,onRenameDraft:m,onRenameConfirm:h,onDeleteStart:g,onDeleteConfirm:_,onRowCancel:v,onCancel:y,onSave:b}){let x=ae(),C=r.trim(),w=t.filter(e=>e.name.includes(C)),T=C!==``&&!t.some(e=>e.name===C),E=T?Mt(C,n.length):void 0;return A(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),b()},children:[S(Xe,{children:`sessions that share a group can message each other.`}),A(`div`,{className:`flex flex-col overflow-hidden rounded-md border border-po-border focus-within:border-po-edge-green`,children:[A(`div`,{className:`flex flex-wrap items-center gap-1 bg-po-deep px-2 py-1.5`,children:[n.map(e=>A(xe,{tone:`magenta`,size:`xs`,className:`font-normal`,children:[e,S(`button`,{type:`button`,"aria-label":`remove ${e}`,className:`text-po-magenta`,onClick:()=>u(e),children:S(I,{"aria-hidden":!0,className:`size-2.5`})})]},e)),S($,{variant:`bare`,"data-testid":`session-groups-query`,"aria-label":`find or create a group`,autoFocus:!0,placeholder:n.length===0?`find or create a group`:`add another`,value:r,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C!==``&&(e.preventDefault(),T?E===void 0&&d():w[0]!==void 0&&(u(w[0].name),l(``)))},className:`h-6 min-w-24 flex-1`})]}),A(`div`,{className:`flex flex-col border-t border-po-border-soft p-1`,onMouseLeave:()=>f(void 0),children:[w.map((t,r)=>{let s=n.includes(t.name),l=`${x}-${String(r)}`,d=t.members.length+ +!!s,y=d===1?`its one session`:`all ${String(d)} sessions`;return a?.group===t.name?A(`div`,{className:`flex flex-col gap-1 rounded-sm bg-po-deep px-2 py-1.5`,children:[A(`span`,{className:`flex items-center gap-2`,children:[S($,{"aria-label":`rename ${t.name}`,value:a.draft,autoFocus:!0,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),h())},className:`h-7 flex-1`}),S(e,{type:`button`,variant:`ghost`,size:`sm`,onClick:v,children:`cancel`}),S(e,{type:`button`,variant:`outline`,size:`sm`,disabled:c||a.draft.trim()===``,onClick:h,children:`rename`})]}),A(`span`,{className:`text-sm text-po-dim`,children:[`renames it on `,y,`.`]})]},t.name):o===t.name?A(`div`,{className:`flex items-center gap-2 rounded-sm border border-po-red/40 px-2 py-1.5`,children:[A(`span`,{className:`flex-1 text-sm text-po-text`,children:[`remove `,S(`span`,{className:`font-semibold text-po-hi`,children:t.name}),` from `,y,`? they can no longer message through it.`]}),S(e,{type:`button`,variant:`ghost`,size:`sm`,onClick:v,children:`cancel`}),S(e,{type:`button`,variant:`danger`,size:`sm`,disabled:c,onClick:_,children:`delete`})]},t.name):A(`div`,{"data-testid":`session-group-${t.name}`,onMouseEnter:()=>f(t.name),className:`group flex items-start gap-2.5 rounded-sm px-2 py-1.5 ${s?`bg-po-tint-green`:i===t.name?`bg-po-deep`:``}`,children:[A(`label`,{htmlFor:l,className:`flex min-w-0 flex-1 cursor-pointer items-start gap-2.5`,children:[S(V,{id:l,checked:s,onCheckedChange:()=>u(t.name),className:`mt-1`}),A(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[S(`span`,{className:`text-base ${s?`font-semibold text-po-hi`:`text-po-text`}`,children:t.name}),S(`span`,{className:`truncate text-sm text-po-dim`,title:t.members.join(`, `),children:t.members.length===0?`no other sessions yet`:t.members.join(`, `)})]})]}),A(`span`,{className:`flex shrink-0 items-center gap-0.5 ${i===t.name?`opacity-100`:`opacity-0 group-focus-within:opacity-100`}`,children:[S(e,{type:`button`,variant:`ghost`,size:`icon`,title:`rename ${t.name}`,onClick:()=>p(t.name),children:S(et,{"aria-hidden":!0,className:`size-3.5`})}),S(e,{type:`button`,variant:`ghost`,size:`icon`,title:`delete ${t.name}`,onClick:()=>g(t.name),children:S(at,{"aria-hidden":!0,className:`size-3.5`})})]})]},t.name)}),T?A(`button`,{type:`button`,"data-testid":`session-groups-create`,disabled:E!==void 0,onClick:d,className:`flex flex-col gap-0.5 rounded-sm px-2 py-1.5 text-left ${E===void 0?`bg-po-deep`:``}`,children:[A(`span`,{className:`flex items-center gap-2.5 text-base ${E===void 0?`text-po-magenta`:`text-po-faint`}`,children:[S(Ie,{"aria-hidden":!0,className:`size-3.5`}),A(`span`,{className:`truncate`,children:[`create group “`,C,`”`]})]}),E===void 0?null:S(`span`,{className:`pl-6 text-sm text-po-red`,children:E})]}):null]})]}),A(`span`,{className:`text-sm text-po-dim`,children:[n.length,` of `,8,` groups`]}),s===void 0?null:S(`span`,{"data-testid":`session-groups-error`,className:`text-sm text-po-red`,children:s}),A(G,{children:[S(e,{type:`button`,variant:`outline`,size:`md`,onClick:y,children:`cancel`}),S(e,{type:`submit`,variant:`primary`,size:`md`,disabled:c,children:`save`})]})]})}function Ft({session:e,sessions:t,actions:n,onClose:r}){let[i,a]=Z(()=>[...e.groups??[]]),[o,s]=Z(``),[c,l]=Z(),[u,d]=Z(),[f,p]=Z(),[m,h]=Z(),[g,_]=Z(!1),y=async(e,t)=>{_(!0),h(void 0);let n=await e();_(!1),n===void 0?t():h(n.error)},b=()=>{d(void 0),p(void 0)};return S(H,{open:!0,onOpenChange:e=>!e&&!g&&r(),children:A(D,{width:`sm`,"data-testid":`session-groups-dialog-${e.id}`,"aria-describedby":void 0,children:[S(W,{children:S(K,{children:`session groups`})}),S(v,{children:S(Pt,{options:jt(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(Mt(``,i.length)):a([...i,e])},onCreate:()=>{let e=o.trim();e!==``&&Mt(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?b():y(()=>n.renameGroup(u.group,e),()=>{a(t=>[...new Set(t.map(t=>t===u.group?e:t))]),b()})},onDeleteStart:e=>{d(void 0),p(e)},onDeleteConfirm:()=>{f!==void 0&&y(()=>n.deleteGroup(f),()=>{a(e=>e.filter(e=>e!==f)),b()})},onRowCancel:b,onCancel:r,onSave:()=>void y(()=>n.setSessionGroups(e.id,i),r)})})]})})}function It(e=[],t=[]){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Lt(e){return e.filter(e=>e.groups!==void 0&&e.groups.length>0)}function Rt(e,t){if(e.session!==t.session||e.actions!==t.actions||e.workspaceName!==t.workspaceName||e.coordinates!==t.coordinates||e.coordinatorEligible!==t.coordinatorEligible||e.coordinator!==t.coordinator||e.readOnly!==t.readOnly||e.stepsExpanded!==t.stepsExpanded||e.onToggleSteps!==t.onToggleSteps)return!1;let n=Lt(e.sessions),r=Lt(t.sessions);return n.length===r.length&&n.every((e,t)=>{let n=r[t];return e.id===n.id&&e.name===n.name&&It(e.groups,n.groups)})}function zt({session:e,className:t}){let n=e.waitingCount??+!!e.awaitingInput;return n<=0?null:A(h,{children:[S(mt,{ask:!0,"aria-hidden":!0,"data-testid":`session-awaiting-input`,className:t,children:n}),A(`span`,{className:`sr-only`,children:[`, `,n,` waiting for you`]})]})}var Bt=vt(function({session:t,sessions:n,actions:r,workspaceName:i,coordinates:a,coordinatorEligible:o=!1,coordinator:s,readOnly:u=!1,stepsExpanded:d,onToggleSteps:f}){let p=`rail/session/${t.id}`,[g,_]=q(`${p}/mode`,`view`),[y,x]=q(`${p}/draft`,``),[C,w]=q(`${p}/error`,``),[T,E]=q(`${p}/role-error`,``),[,k,j]=q(`${p}/removing`,!1),M=O(g),N=e=>{M.current=e,_(e)},{active:P}=t,F=C||T||t.error,I=async e=>{N(`view`),E(``);let n=await r.setSessionRole?.(t.id,e);n!==void 0&&E(n.error)},L=r.setSessionRole===void 0||!o||t.coordinatorEligible!==!0||a===void 0?null:t.coordinator?S(Q,{"data-testid":`session-make-regular-${t.id}`,disabled:t.restartBlocked===!0,onSelect:()=>void I(!1),children:`Make regular session`}):S(Q,{"data-testid":`session-make-coordinator-${t.id}`,disabled:t.restartBlocked===!0,onSelect:()=>s===void 0?void I(!0):N(`promote`),children:`Make coordinator`}),R=P?`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`,z=()=>{r.renameSession(t.id,y),N(`view`)},ee=async()=>{if(j.state)return;k(!0),N(`view`),w(``);let e=await r.removeSession(t.id);k(!1),e!==void 0&&w(e.error)},V=t.status.startsWith(`failed`)||t.status.includes(` failed`),te=t.status.startsWith(`running`),ne=A(`span`,{className:`flex min-w-0 items-start gap-1.5 text-sm leading-snug ${V?`text-po-red`:te?`text-po-yellow`:P?`text-po-text`:`text-po-dim`}`,children:[te?S(be,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0 animate-spin`}):V?S(it,{"aria-hidden":!0,className:`mt-0.5 size-3 shrink-0`}):null,t.clock?S(tt,{"data-testid":`session-status`,className:P?`line-clamp-2`:`truncate`,label:t.clock.label,since:t.clock.since}):S(`span`,{"data-testid":`session-status`,className:P?`line-clamp-2`:`truncate`,children:t.status})]}),ie=A(`span`,{className:`flex min-w-0 items-start gap-2`,children:[t.nested&&t.provenance===`workflow-session`?S(oe,{"aria-label":`workflow session`,className:`mt-1 size-3 shrink-0 ${P?`text-po-green`:`text-po-faint`}`}):t.provenance===`workflow`?S(me,{"aria-label":`workflow step`,className:`mt-1 size-3 shrink-0 ${P?`text-po-green`:`text-po-faint`}`}):t.nested&&t.provenance?S(Oe,{"aria-label":t.provenance===`worktree`?`automatic per-conversation worktree`:t.provenance,className:`mt-1 size-3 shrink-0 ${P?`text-po-green`:`text-po-faint`}`}):null,S(`span`,{className:`min-w-0 flex-1 text-base font-semibold break-words text-po-hi`,children:t.name||`Untitled`}),(t.waitingCount??+!!t.awaitingInput)>0?S(zt,{session:t,className:`mt-0.5 shrink-0 transition-opacity group-focus-within:opacity-0 group-hover:opacity-0`}):t.ordinal>=1&&t.ordinal<=9?S(`span`,{title:`press ${String(t.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:t.ordinal}):null]}),ae=A(h,{children:[ie,A(`span`,{className:`flex w-full min-w-0 items-end gap-2`,children:[A(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[ne,t.coordinator?A(`span`,{"data-testid":`session-coordinator`,className:`text-sm text-po-dim`,children:[`Coordinates `,a??`workspace`]}):null,i?A(`span`,{"data-testid":`session-workspace`,className:`flex min-w-0 items-center gap-1.5 text-sm text-po-dim`,children:[S(je,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),S(`span`,{className:`truncate`,children:i})]}):null,t.git?A(`span`,{"data-testid":`session-branch`,className:`flex min-w-0 items-center gap-1.5 text-sm text-po-dim`,children:[S(B,{className:`size-3.5 shrink-0 ${P?`text-po-green`:``}`}),S(`span`,{className:`truncate font-mono`,children:t.git.branch}),t.git.dirty?S(`span`,{className:`shrink-0 text-po-yellow`,children:`modified`}):null]}):null]}),t.profile?A(l,{"data-testid":`session-avatar`,"aria-label":t.profile.label,title:t.profile.label,className:`size-8 shrink-0 rounded-full`,children:[t.profile.avatarUrl?S(b,{src:t.profile.avatarUrl,alt:``}):null,S(m,{className:`bg-po-tint-green text-xs font-semibold text-po-green`,children:t.profile.initials})]}):null]}),t.groups!==void 0&&t.groups.length>0?S(Nt,{groups:t.groups}):null,F?S(`span`,{"data-testid":`session-error`,className:`line-clamp-3 text-sm break-words text-po-red`,children:F}):null]}),U=g===`menu`;return A(h,{children:[A(`div`,{className:Le(`group relative`,t.provenance===`workflow`?`pl-10`:(t.nested||d!==void 0)&&`pl-5`),"data-testid":`session-card-${t.id}`,"data-active":P,"data-nested":t.nested,children:[d===void 0?null:S(`button`,{type:`button`,"data-testid":`session-steps-${t.id}`,"aria-expanded":d,"aria-label":`${d?`Hide`:`Show`} steps of ${t.name||`this workflow`}`,onClick:()=>f?.(t.id),className:`absolute top-3.5 left-0 grid size-5 place-items-center rounded-sm text-po-faint outline-none hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green/50`,children:S(d?re:c,{"aria-hidden":!0,className:`size-3.5`})}),S(e,{variant:`ghost`,size:`card`,"data-testid":`session-open-${t.id}`,onClick:()=>r.openSession(t.id),className:R,children:ae}),!u&&(g===`view`||U)?S(`div`,{className:`absolute top-2 right-2 transition-opacity ${U?`opacity-100`:`opacity-0 group-focus-within:opacity-100 group-hover:opacity-100`}`,children:A(J,{open:U,onOpenChange:e=>{let t=M.current;N(e?`menu`:t===`menu`?`view`:t)},children:[S(X,{asChild:!0,children:S(e,{variant:`ghost`,size:`icon`,"data-testid":`session-menu-${t.id}`,title:`session actions`,className:P?`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:S(Qe,{className:`h-3 w-3`})})}),A(Y,{"data-testid":`session-menu-list-${t.id}`,onCloseAutoFocus:e=>{M.current!==`view`&&e.preventDefault()},children:[r.renderSessionMenuItems(t.id),t.canInteract===!1?null:A(h,{children:[L,S(Q,{"data-testid":`session-rename-${t.id}`,onSelect:()=>{x(t.name),N(`rename`)},children:`Rename`}),S(Q,{"data-testid":`session-groups-${t.id}`,onSelect:()=>N(`groups`),children:`Groups`}),S(Q,{"data-testid":`session-resume-${t.id}`,onSelect:()=>r.resumeSession(t.id),children:`Resume`}),r.openMoveSession&&t.move?S(Q,{"data-testid":`session-move-${t.id}`,disabled:t.restarting||t.move.blocked,onSelect:()=>r.openMoveSession(t.id),children:`Move to workspace…`}):null,S(Q,{"data-testid":`session-restart-${t.id}`,disabled:t.restarting||t.restartBlocked===!0,onSelect:()=>r.restartSession(t.id),children:`Restart`}),S(Q,{variant:`destructive`,"data-testid":`session-stop-${t.id}`,onSelect:()=>N(`confirm`),children:`Remove`})]})]})]})}):null,S(H,{open:t.canInteract!==!1&&g===`rename`,onOpenChange:e=>!e&&N(`view`),children:A(D,{width:`sm`,"data-testid":`session-rename-dialog-${t.id}`,"aria-describedby":void 0,children:[S(W,{children:S(K,{children:`rename session`})}),S(v,{children:A(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),z()},children:[S($,{"data-testid":`session-name-input-${t.id}`,"aria-label":`session name`,value:y,autoFocus:!0,onChange:e=>x(e.target.value)}),A(G,{children:[S(e,{type:`button`,variant:`outline`,size:`md`,"data-testid":`session-rename-cancel-${t.id}`,onClick:()=>N(`view`),children:`cancel`}),S(e,{type:`submit`,variant:`primary`,size:`md`,"data-testid":`session-rename-confirm-${t.id}`,disabled:y.trim()===``,children:`rename`})]})]})})]})}),t.canInteract!==!1&&g===`groups`?S(Ft,{session:t,sessions:n,actions:r,onClose:()=>N(`view`)}):null,S(H,{open:t.canInteract!==!1&&g===`confirm`,onOpenChange:e=>!e&&N(`view`),children:A(D,{width:`sm`,"data-testid":`session-stop-dialog-${t.id}`,"aria-describedby":void 0,children:[S(W,{children:S(K,{children:`remove session`})}),A(v,{children:[A(Xe,{children:[`this stops `,S(`span`,{className:`font-semibold text-po-hi`,children:t.name||`untitled`}),` and removes it from the rail. anything it is running ends now. you can restore it for 7 days.`]}),A(G,{children:[S(e,{variant:`outline`,size:`md`,"data-testid":`session-stop-cancel-${t.id}`,autoFocus:!0,onClick:()=>N(`view`),children:`cancel`}),S(e,{variant:`danger`,size:`md`,"data-testid":`session-stop-confirm-${t.id}`,onClick:()=>void ee(),children:`remove`})]})]})]})}),S(H,{open:t.canInteract!==!1&&g===`promote`,onOpenChange:e=>!e&&N(`view`),children:A(D,{width:`sm`,"data-testid":`session-promote-dialog-${t.id}`,"aria-describedby":void 0,children:[S(W,{children:A(K,{children:[`Make `,t.name||`Untitled`,` the coordinator of `,a,`?`]})}),A(v,{children:[A(Xe,{children:[S(`span`,{className:`font-semibold text-po-hi`,children:t.name||`Untitled`}),` will see every session in`,` `,a,`, message them, and start new ones.`,` `,S(`span`,{className:`font-semibold text-po-hi`,children:s}),` becomes a regular session. Both restart to take on their new roles, so anything they are running stops now.`]}),A(G,{children:[S(e,{variant:`outline`,size:`md`,"data-testid":`session-promote-cancel-${t.id}`,autoFocus:!0,onClick:()=>N(`view`),children:`Cancel`}),S(e,{variant:`primary`,size:`md`,"data-testid":`session-promote-confirm-${t.id}`,onClick:()=>void I(!0),children:`Make coordinator`})]})]})]})})]}),t.pendingSetups.map(e=>S(At,{sessionId:t.id,setup:e,actions:r},`setup:${e.id}`))]})},Rt);function Vt({workspace:t,sessions:n,actions:r,quiet:i=!1,readOnly:o=!1}){let s=`rail/workspace/${t.id}`,[c,l]=q(`${s}/open`,!1),[u,d]=q(`${s}/error`,``),[f,p,m]=q(`${s}/removing`,!1),[g,_]=q(`${s}/coordinator-error`,``),[y,b]=q(Dt,[]),x=a(e=>b(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[b]),{id:C,name:w,root:T,available:E,legacy:O}=t,k=t.sessions.find(e=>e.coordinator),j=le(t.sessions,new Set(y)),M=e=>j.withSteps.has(e)?{stepsExpanded:y.includes(e),onToggleSteps:x}:{},N=async()=>{_(``);let e=await r.addCoordinator?.(C);e!==void 0&&_(e.error)};if(t.kind===`session`)return t.sessions.length===0?null:S(`div`,{"data-testid":`session-group-${C}`,className:`flex flex-col gap-1`,children:j.sessions.map(e=>S(Bt,{session:e,sessions:n,actions:r,readOnly:o,coordinates:`Home`,coordinatorEligible:e.coordinatorEligible===!0,coordinator:k?.id===e.id?void 0:k?.name,...M(e.id)},e.id))});let P=async()=>{if(m.state)return;p(!0),d(``);let e=await r.deleteWorkspace(C);p(!1),e===void 0?l(!1):d(e.error)};return A(`section`,{"data-testid":`workspace-group-${C}`,"data-available":E,className:`flex flex-col gap-1.5`,children:[A(`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:[i?null:S(je,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-po-dim`}),A(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[!O&&r.openWorkspace?S(`button`,{type:`button`,"data-testid":`workspace-open-${C}`,onClick:()=>r.openWorkspace?.(C),className:`truncate rounded-sm text-left text-base text-po-hi outline-none focus-visible:ring-2 focus-visible:ring-po-green/50 ${i?`font-medium`:`font-semibold`}`,title:i?T:`Open ${w} workspace`,children:w}):S(`p`,{className:`truncate text-base text-po-hi ${i?`font-medium`:`font-semibold`}`,title:i?T:void 0,children:w}),i?null:S(`p`,{className:`truncate font-mono text-sm text-po-dim`,title:T,children:T})]}),O||o?null:A(h,{children:[S(e,{variant:`ghost`,size:`icon`,"data-testid":`workspace-new-session-${C}`,title:`New session`,"aria-label":`New session in ${w}`,disabled:!E,onClick:()=>r.createSession(C),className:`text-po-faint hover:text-po-hi`,children:S(Ie,{className:`size-3.5`})}),A(J,{children:[S(X,{asChild:!0,children:S(e,{variant:`ghost`,size:`icon`,"data-testid":`workspace-menu-${C}`,title:`Workspace actions`,"aria-label":`${w} actions`,className:`text-po-faint hover:text-po-hi`,children:S(Qe,{className:`size-3.5`})})}),A(Y,{children:[S(Q,{disabled:!E,onSelect:()=>r.resumeInWorkspace(C),children:`Resume Session`}),r.addCoordinator?S(Q,{"data-testid":`workspace-add-coordinator-${C}`,disabled:!E,onSelect:()=>void N(),children:`Add bot`}):null,S(Q,{disabled:!E,onSelect:()=>r.openWorkspaceSettings(C),children:`Workspace Settings`}),S(Q,{variant:`destructive`,"data-testid":`workspace-delete-${C}`,onSelect:()=>{d(``),l(!0)},children:`Delete Workspace`})]})]})]})]}),E?null:S(`p`,{className:`px-9 text-sm text-po-red`,children:`Workspace unavailable`}),g?S(`p`,{"data-testid":`workspace-coordinator-error-${C}`,className:`px-9 text-sm text-po-red`,children:g}):null,t.sessions.length>0?S(`div`,{className:`flex flex-col gap-1`,children:j.sessions.map(e=>S(Bt,{session:e,sessions:n,actions:r,readOnly:o,coordinates:w,coordinatorEligible:e.coordinatorEligible===!0,coordinator:k?.id===e.id?void 0:k?.name,...M(e.id)},e.id))}):null,S(H,{open:c,onOpenChange:e=>!e&&!f&&l(!1),children:A(D,{width:`sm`,"data-testid":`workspace-delete-dialog-${C}`,"aria-describedby":void 0,children:[S(W,{children:S(K,{children:`delete workspace`})}),A(v,{children:[A(Xe,{children:[`this removes `,S(`span`,{className:`font-semibold text-po-hi`,children:w}),` and all its sessions from Po. running work will stop. files at `,S(`code`,{children:T}),` stay on disk.`]}),u?S(`p`,{"data-testid":`workspace-delete-error-${C}`,className:`text-sm text-po-red`,children:u}):null,A(G,{children:[S(e,{variant:`outline`,size:`md`,"data-testid":`workspace-delete-cancel-${C}`,disabled:f,autoFocus:!0,onClick:()=>l(!1),children:`cancel`}),S(e,{variant:`danger`,size:`md`,"data-testid":`workspace-delete-confirm-${C}`,disabled:f,onClick:()=>void P(),children:f?`deleting…`:`delete`})]})]})]})})]})}var Ht=`po.session-view`,Ut=`self-host`,Wt=`po.other-workspaces-open`,Gt=[{value:`workspaces`,title:`Workspaces`,description:`Sessions grouped by workspace`,Icon:je},{value:`sessions`,title:`Sessions`,description:`Needs you first, then latest change`,Icon:qe}];function Kt(e){try{return window.localStorage.getItem(e)}catch{return null}}function qt(e,t){try{window.localStorage.setItem(e,t)}catch{}}function Jt(){return typeof window<`u`&&window.poDesktop?.cloud!==void 0}function Yt(){return typeof window<`u`&&window.poDesktop?.platform===Ut}function Xt(){window.history.pushState(null,``,`/cloud`),window.dispatchEvent(new PopStateEvent(`popstate`))}var Zt=e=>e.kind!==`session`&&e.sessions.length===0;function Qt({rail:n,onClose:r,selfHost:i=Yt(),cloud:a=Jt()&&!i}){let{actions:o}=n;return A(`div`,{className:`flex min-h-full flex-col`,children:[A(`div`,{"data-po-session-rail-header":!0,className:`flex min-h-16 items-center justify-between gap-2 px-5 py-3`,children:[A(`span`,{className:`flex items-center gap-2.5`,"aria-label":`Po`,children:[S(`img`,{src:`/favicon.svg`,alt:``,"aria-hidden":`true`,className:`size-9 rounded-lg`}),S(`span`,{"aria-hidden":`true`,className:`text-2xl font-semibold text-po-hi`,children:`Po`})]}),A(`span`,{className:`flex items-center gap-1`,children:[S(`div`,{"data-rail-status":`advanced-action`,className:`contents`,children:S(ct,{slot:P.railStatus,sessionId:null})}),S(e,{variant:`ghost`,size:`icon`,"data-testid":`mobile-sessions-close`,title:`Hide sessions`,"aria-label":`Hide sessions`,onClick:r,className:`text-po-dim md:hidden`,children:S(I,{className:`size-3.5`})})]})]}),S(`div`,{className:`px-3 pt-4`,children:A(e,{variant:`ghost`,size:`lg`,"data-testid":`home-open`,"aria-current":n.homeActive?`page`:void 0,onClick:o.openHome,className:n.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:[S(t,{"aria-hidden":`true`,className:n.homeActive?`size-5 text-po-green`:`size-5 text-po-dim`}),`Home`]})}),n.pluginContent,S($t,{rail:n}),S(`div`,{className:`flex-1`}),A(`div`,{className:`sticky bottom-0 mt-auto shrink-0 bg-po-rail`,children:[S(`div`,{"data-rail-status":`advanced-banner`,className:`contents`,children:S(ct,{slot:P.railStatus,sessionId:null})}),A(`div`,{className:`flex flex-col gap-1 border-t border-po-border-soft px-3 py-3`,children:[A(e,{variant:`ghost`,size:`lg`,"data-testid":`settings-open`,onClick:o.openSettings,className:`justify-start gap-2.5 px-2 text-po-text`,children:[S(de,{className:`size-5 text-po-dim`}),`Settings`]}),a?A(e,{variant:`ghost`,size:`lg`,"data-testid":`cloud-open`,onClick:Xt,className:`justify-start gap-2.5 px-2 text-po-text`,children:[S(lt,{className:`size-5 text-po-dim`}),`Po Cloud`]}):null,A(`span`,{className:`px-2 text-sm text-po-dim max-sm:hidden`,children:[S(He,{className:`bg-po-panel`,children:`ctrl+k`}),` commands · `,S(He,{className:`bg-po-panel`,children:`ctrl+t`}),` new session`]})]})]})]})}function $t({rail:t,createMenuDefaultOpen:n=!1}){let{actions:i}=t,o=t.coordinatorHosts??[],[s,l]=q(`rail/coordinator-error`,``),u=async e=>{l(``);let t=await i.addCoordinator?.(void 0,e);t!==void 0&&l(t.error)},d=t.workspaces.flatMap(e=>e.sessions),[f,p]=q(Dt,[]),m=a(e=>p(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[p]),g=le(d,new Set(f)),_=new Set(g.sessions.map(e=>e.id)),v=t.workspaces.every(e=>e.kind===`session`&&e.sessions.length===0),y=t.workspaces.filter(Zt),b=O(null),[C,w]=q(`rail/initial-selection-revealed`,!1),[T,E]=q(`rail/session-view`,()=>Kt(Ht)===`sessions`?`sessions`:`workspaces`),[D,k]=q(`rail/other-workspaces-open`,()=>Kt(Wt)===`true`),j=Gt.find(e=>e.value===T)??Gt[0];return x(()=>{if(C)return;let e=b.current?.querySelector(`[data-active="true"]`);e&&(e.scrollIntoView({block:`center`,inline:`nearest`,behavior:`instant`}),w(!0))},[t.workspaces,C,w]),A(h,{children:[A(`div`,{className:`flex items-center justify-between px-5 pt-4 pb-2`,children:[S(`h2`,{className:`text-lg font-semibold text-po-hi`,children:`Sessions`}),A(`span`,{className:`flex items-center gap-1`,children:[A(J,{children:[S(X,{asChild:!0,children:S(e,{variant:`ghost`,size:`icon`,"data-testid":`session-view-menu`,title:`View: ${j.title}`,"aria-label":`View: ${j.title}`,className:`text-po-dim hover:text-po-hi`,children:S(r,{className:`size-3.5`})})}),S(Y,{align:`end`,"aria-label":`View`,children:Gt.map(({value:e,title:t,description:n,Icon:r})=>A(Q,{"data-testid":`session-view-${e}`,"aria-checked":T===e,role:`menuitemradio`,onSelect:()=>{E(e),qt(Ht,e)},className:`items-start gap-2.5 ${T===e?`bg-po-tint-green`:``}`,children:[S(r,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${T===e?`text-po-green`:`text-po-dim`}`}),A(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[S(`span`,{className:`text-po-hi`,children:t}),S(`span`,{className:`text-sm text-po-dim`,children:n})]}),T===e?S(fe,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-po-green`}):null]},e))})]}),A(J,{defaultOpen:n,children:[S(X,{asChild:!0,children:S(e,{variant:`ghost`,size:`icon`,"data-testid":`session-create-menu`,title:`Create workspace, session or bot`,"aria-label":`Create workspace, session or bot`,className:`text-po-dim hover:text-po-hi`,children:S(Ie,{className:`size-3.5`})})}),A(Y,{children:[S(Q,{"data-testid":`add-workspace-open`,onSelect:i.openAddWorkspace,children:`Create workspace`}),i.createGeneralSession?S(Q,{"data-testid":`new-session-open`,onSelect:i.createGeneralSession,children:`Create session`}):null,i.addCoordinator?o.map(e=>S(Q,{"data-testid":e.hostId?`coordinator-create-${e.hostId}`:`coordinator-create`,onSelect:()=>void u(e.hostId),children:o.length>1?`Create bot on ${e.label}`:`Create bot`},e.hostId??`local`)):null]})]})]})]}),s?S(`p`,{"data-testid":`coordinator-create-error`,className:`px-5 text-sm text-po-red`,children:s}):null,A(`div`,{ref:b,className:`flex flex-col gap-4 px-3 pb-3`,children:[T===`sessions`?kt(t.workspaces.flatMap(e=>e.sessions.filter(e=>_.has(e.id)).map(t=>({session:t,workspaceName:e.kind===`session`?void 0:e.name,coordinates:e.kind===`session`?`Home`:e.name,coordinatorEligible:t.coordinatorEligible===!0,coordinator:e.sessions.find(e=>e.coordinator&&e.id!==t.id)?.name})))).map(e=>A(`section`,{"data-testid":`session-timeline-${e.key}`,className:`flex flex-col gap-1`,children:[S(`h3`,{className:`px-2 text-xs font-semibold tracking-wide text-po-dim uppercase`,children:e.title}),e.data.map(({session:e,workspaceName:t,coordinates:n,coordinatorEligible:r,coordinator:a})=>S(Bt,{session:e,sessions:d,actions:i,workspaceName:t,coordinates:n,coordinatorEligible:r,coordinator:a,...g.withSteps.has(e.id)?{stepsExpanded:f.includes(e.id),onToggleSteps:m}:{}},e.id))]},e.key)):t.workspaces.filter(e=>!Zt(e)).map(e=>S(Vt,{workspace:e,sessions:d,actions:i},e.id)),T===`workspaces`&&y.length>0?A(`section`,{"data-testid":`other-workspaces`,className:`flex flex-col gap-1`,children:[A(`button`,{type:`button`,"data-testid":`other-workspaces-toggle`,"aria-expanded":D,"aria-label":`Other workspaces, ${String(y.length)} without sessions`,onClick:()=>{k(!D),qt(Wt,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:[S(D?re:c,{"aria-hidden":!0,className:`size-4 shrink-0 text-po-dim`}),S(`span`,{className:`flex-1 text-base font-semibold text-po-hi`,children:`Other workspaces`}),S(`span`,{className:`min-w-5.5 rounded-full bg-po-panel px-1.5 text-center text-xs text-po-dim`,children:y.length})]}),D?S(`div`,{className:`flex flex-col gap-0.5 pl-4`,children:y.map(e=>S(Vt,{workspace:e,sessions:d,actions:i,quiet:!0},e.id))}):null]}):null,v||T===`sessions`&&d.length===0?S(`p`,{className:`px-2 text-sm text-po-dim`,children:`Start a session to work with Po. No workspace needed.`}):null]})]})}function en({view:t,slots:n,rail:r,navigationOpen:i,desktopActivityOpen:a,mobileActivityOpen:o,onNavigationOpenChange:s,onDesktopActivityOpenChange:c,onMobileActivityOpenChange:l}){let{scrollRef:u}=r,d=t===`conversation`||t===`welcome`,f=o?a?`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`:a?`hidden lg:flex`:`hidden`;return A(`div`,{className:`relative flex h-full min-w-0 overflow-hidden [--po-backdrop-blur:0px]`,children:[S(`aside`,{ref:u,"data-testid":`session-rail-panel`,"data-po-region":`rail`,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 ${i?`visible translate-x-0`:`invisible -translate-x-full`}`,children:S(Qt,{rail:r,onClose:()=>s(!1)})}),i?S(e,{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:()=>s(!1)}):null,A(`main`,{"data-po-region":`content`,className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:[n.notices,n.header({navigationToggle:`mobile`,activityToggle:`mobile`}),A(`div`,{"data-testid":`template-content`,className:d?`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:[n.content,n.composer,n.controls]})]}),n.activity==null?null:a||o?S(`div`,{"data-po-region":`activity`,className:f,children:n.activity}):S(e,{variant:`ghost`,"data-testid":`activity-show`,title:`Show activity`,onClick:()=>c(!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`}),o?S(e,{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:()=>l(!1)}):null,r.addWorkspace?S(Tt,{suggestedPaths:r.addWorkspace.suggestedPaths,actions:r.actions}):null]})}function tn({onDismiss:e,...t}){return S(en,{...t,rail:y({onDismiss:e})})}function nn({homeHosts:e}){ft();let t=L(Ce,e=>e.dockOpen),[n,r]=Z(!1),[a,o]=Z(!1),{kind:s,sessionId:c,tabId:l,pageId:u,pluginId:d,workspaceId:m}=ke(),g=te(c??null),_=L(Ne,e=>e.activeId),v=L(Ne,e=>e.transferringToId===null?null:e.byId[e.transferringToId]?.summary.name??`destination session`),y=ht(),b=ze(),x=b?.summary.dormant===!0?b:null,w=Je(e=>e.dialog?.id??null),E=L(st,e=>Ye(e,c,l)),D=E===void 0?void 0:R(c??null).map(e=>e.transientTab?.()).find(e=>e?.id===E.id)??E,O=(l===void 0?void 0:f(c??null).find(e=>e.id===l))??D,j=O===D?D?.composerContext:void 0,F=O!==void 0&&O===D&&D.retainComposer===!0&&D.composerAside===!0,I=ve(`(min-width: 1024px)`),B=L(Ce,e=>T(e,_)),ee=F&&O!==void 0?S(ye,{label:O.label,composer:S(k,{quiet:!0,composerContext:j})}):null,V=`${s}\u0000${c??``}\u0000${l??``}\u0000${u??``}\u0000${m??``}`,[re,ie]=Z(V);re!==V&&(ie(V),r(!1),o(!1));let[ae,oe]=Z(w);ae!==w&&(oe(w),w!==null&&(o(!1),r(!1)));let H=()=>{a?o(!1):he(!1)},U=u===void 0?s===`workspace`&&m!==void 0?S(i,{workspaceId:m,onShowSessions:()=>r(!0)}):s===`home`&&!y?S(Se,{hosts:e,onShowSessions:()=>r(!0)}):null:A(ue,{pageId:u,sessionId:null,workspaceId:m,onShowSessions:()=>r(!0),children:[u===C?S(gt,{workspaceId:m,pluginId:d}):null,u===se?S(M,{}):null]});return A(`div`,{"data-testid":`cockpit`,className:`h-full min-w-0 overflow-hidden`,children:[S(tn,{view:U||O?`panel`:y?`welcome`:`conversation`,navigationOpen:n,desktopActivityOpen:t,mobileActivityOpen:a,onNavigationOpenChange:r,onDesktopActivityOpenChange:he,onMobileActivityOpenChange:o,onDismiss:()=>r(!1),slots:{header:e=>U?null:A(h,{children:[S(z,{...e,view:O?.id??`conversation`,onShowSessions:()=>{o(!1),r(!0)},onShowActivity:()=>{r(!1),o(!0)}}),S(`div`,{className:`shrink-0 px-3 pt-2 empty:hidden sm:px-6`,children:S(ct,{slot:P.conversationStrip,sessionId:c??null})})]}),notices:v===null?null:A(`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:U||(O?F?S(We,{narrow:!I,conversationShown:I&&t&&B===`conversation`,onOpenRail:()=>{he(!0),Ge(_,`conversation`)},conversation:ee,children:S(O.panel,{...g})},O.id):S(O.panel,{...g}):S(y?_t:p,{})),composer:U?null:O?O.retainComposer===!0&&!F?S(k,{composerContext:j}):null:y?null:S(k,{}),controls:!U&&(!O||O.targetSessionId!==void 0)&&!y&&x===null?S(ne,{}):null,activity:U?null:S(ot,{conversation:F&&I&&t?ee:void 0,conversationBeside:F?D?.asideFace:void 0,conversationLabel:F?O?.label:void 0,scope:O===D&&D?.targetSessionId!==void 0?D.activityScope:void 0,onClose:H,onOpenContent:()=>o(!1)})}}),S(N,{})]})}function rn({isSignedInWorkerOrigin:t=!1,accountSettings:n,homeHosts:r,hostManagement:i=`unavailable`}={}){ft();let{section:a,workspaceId:o}=ke(),s=Be(),c=L(Ne,e=>e.activeId),[l,u]=Z(),[d,f]=Z(!1),[p,m]=q(`settings/template-target`,`global`),h=i===`available`,g=nt(a,t,{canManageHosts:h}),_=g?.workspace??(a?.startsWith(`repository-`)?`repository`:`general`);return x(()=>{if(g||a===`hosts`&&i===`loading`||_===`repository`&&!d)return;let e=!1;return we().then(()=>{if(e||nt(a,t,{canManageHosts:h}))return;let n=U(a);s(n===void 0?{to:`/settings/$section`,params:{section:Ue},search:{workspace:o},replace:!0}:{to:`/plugins/$pluginId`,params:{pluginId:n},search:{workspace:o},hash:`settings`,replace:!0})}).catch(t=>{e||u(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[g,a,s,_,o,d,i,h,t]),A(`div`,{"data-testid":`settings`,"data-po-region":`content`,className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-po-bg [--po-backdrop-blur:0px]`,children:[A(`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:[S(`h1`,{className:`order-1 min-w-0 truncate text-xl font-semibold text-po-hi sm:order-none`,children:`Settings`}),A(`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:[S(_e,{asChild:!0,active:_===`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":_===`general`?`true`:void 0,children:S(rt,{to:`/settings/$section`,params:{section:Ue},search:{workspace:o},"data-testid":`settings-workspace-general`,children:`General`})}),S(_e,{asChild:!0,active:_===`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":_===`repository`?`true`:void 0,children:S(rt,{to:`/settings/$section`,params:{section:ce},search:{workspace:o},"data-testid":`settings-workspace-repository`,children:`Workspaces`})})]}),S(e,{asChild:!0,variant:`outline`,size:`sm`,className:`order-2 gap-1.5 sm:order-none sm:justify-self-end`,children:c===null?A(rt,{to:`/`,"data-testid":`settings-close`,children:[S(Me,{"aria-hidden":!0,className:`size-3.5`}),`Back`]}):A(rt,{to:`/session/$sessionId`,params:{sessionId:c},"data-testid":`settings-close`,children:[S(Me,{"aria-hidden":!0,className:`size-3.5`}),S(`span`,{className:`sm:hidden`,children:`Back`}),S(`span`,{className:`hidden sm:inline`,children:`Back to session`})]})})]}),S(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:_===`repository`?S(ut,{current:g??{id:a??``,label:``,detail:``,workspace:`repository`},initialRepositoryId:o,onRepositoryChange:e=>{s({to:`/settings/$section`,params:{section:g?.id??a??ce},search:{workspace:e},replace:!0})},onReady:f},o??`remembered-workspace`):A(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[S(Pe,{hosts:r,isSignedInWorkerOrigin:t,canManageHosts:h,active:g?.id,workspace:`general`,repositoryId:o}),S(`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:A(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-8`,children:[!g&&l?S(`p`,{role:`alert`,children:l}):null,a===`hosts`&&i===`loading`?S(`p`,{role:`status`,children:`Checking host access…`}):null,g?.id===`hosts`?S(Te,{}):null,g?.id===`account-preferences`?n??S(`p`,{children:`Account settings are read-only on this host.`}):null,g?.id===`providers`?S(ee,{}):null,g?.id===`devices`?S(pt,{}):null,g?.id===`appearance`?S(Ae,{templateTarget:p,onTemplateTargetChange:m}):null,g?.id===`notifications`?S(De,{}):null,g?.id===`images`?S(Ke,{}):null,g?.id===`presets`?S(ge,{}):null,g?.id===`account`?S(Ze,{}):null,g?.contribution===void 0?null:S(pe,{section:g.contribution,scope:`host`}),g?.panel===void 0?null:S(j,{panel:g.panel})]})})]})})]})}var an={thread:(e,t,n)=>S(F,{sessionId:e,threadId:t,options:n}),activity:(e,t)=>S(d,{sessionId:e,onOpenConversation:t}),transcript:(e,t)=>S(n,{sessionId:e,options:t,watch:ie})};function on({isSignedInWorkerOrigin:e=!1,accountSettings:t,homeHosts:n,hostManagement:r}={}){let i=ke(),a=L(Ne,e=>e.activeId);return A(Re,{value:an,children:[i.kind===`settings`?S(rn,{homeHosts:n,isSignedInWorkerOrigin:e,hostManagement:r,accountSettings:t}):S(nn,{homeHosts:n}),S($e,{}),S(o,{}),S(s,{}),S(ct,{slot:P.overlay,sessionId:a})]})}function sn(){return A(`div`,{className:`flex size-full`,children:[A(`div`,{className:`flex w-1/4 flex-col gap-1 border-r border-po-border bg-po-rail p-1.5`,children:[S(`span`,{className:`h-1 w-1/2 rounded-full bg-po-dim`}),S(`span`,{className:`mt-1 h-3 w-full rounded-sm bg-po-tint-green`}),S(`span`,{className:`h-1 w-3/4 rounded-full bg-po-faint`}),S(`span`,{className:`h-1 w-2/3 rounded-full bg-po-faint`})]}),A(`div`,{className:`flex flex-1 flex-col justify-between p-2`,children:[A(`div`,{className:`flex flex-col gap-1`,children:[S(`span`,{className:`h-1 w-2/3 rounded-full bg-po-dim`}),S(`span`,{className:`h-1 w-1/2 rounded-full bg-po-faint`}),S(`span`,{className:`h-3 w-3/4 rounded-sm border border-po-border bg-po-panel`})]}),S(`span`,{className:`h-3 w-full rounded-sm border border-po-border bg-po-panel`})]}),A(`div`,{className:`flex w-1/4 flex-col gap-1 border-l border-po-border bg-po-rail p-1.5`,children:[S(`span`,{className:`h-3 w-full rounded-sm border border-po-border bg-po-panel`}),S(`span`,{className:`h-3 w-full rounded-sm border border-po-border bg-po-panel`})]})]})}var cn={label:`Advanced`,description:`The full cockpit with persistent session navigation and an activity dock.`,contractVersion:3,app:on,preview:sn},ln=E(cn),un=E(cn),dn=E(cn),fn=(e,t)=>t===void 0?void 0:{...e,...t},pn=_({id:`template-advanced`,packageName:`@agimon-ai/po-template-advanced`,host:{get templates(){return[fn({id:`po-template-advanced`},ln)]}},workspace:{get templates(){return[fn({id:`po-template-advanced`},un)]}},session:{get templates(){return[fn({id:`po-template-advanced`},dn)]}}});export{pn as webPlugin};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{$ as e,$r as t,$t as n,A as r,Ar as i,B as a,Bt as o,C as s,Ct as c,D as l,Di as u,Dn as d,Dt as f,E as p,Et as m,F as h,Fn as g,Ft as _,G as v,Ga as y,Gi as b,Gt as x,H as S,Hn as C,Ht as w,I as T,In as E,It as D,J as O,Jn as k,Jr as A,K as j,Ka as M,Ki as N,Kr as P,Kt as F,L as I,Lt as L,M as ee,Mn as te,Mr as R,N as ne,Nt as z,O as re,Or as ie,Ot as ae,P as oe,Pi as se,Pt as B,Q as ce,Qr as V,S as le,Si as ue,St as de,T as H,Ti as fe,Tn as pe,Tt as me,U as he,V as U,Vi as ge,Vn as _e,Vt as ve,W as ye,Wi as be,Wt as xe,X as Se,Xi as Ce,Xt as we,Y as Te,Yi as W,Z as Ee,Za as De,Zi as G,Zr as Oe,_ as ke,_a as Ae,_i as je,_t as Me,a as Ne,ai as Pe,b as Fe,bn as Ie,c as Le,cn as Re,ct as ze,d as Be,da as Ve,dt as He,ea as K,ei as q,et as Ue,f as We,ft as Ge,g as Ke,gt as qe,h as Je,ha as Ye,ht as Xe,i as Ze,ia as Qe,it as J,j as $e,ji as et,jn as Y,k as tt,lt as nt,m as rt,mn as it,mt as at,n as ot,na as st,nt as ct,o as lt,oa as ut,oi as dt,ot as ft,p as pt,pn as mt,pt as ht,q as gt,qi as _t,qt as X,r as vt,ra as Z,rn as yt,s as bt,sa as xt,sn as St,st as Ct,t as wt,ta as Tt,tn as Et,tt as Dt,ut as Ot,v as kt,va as At,vt as jt,w as Mt,wn as Nt,wt as Pt,x as Ft,xi as It,y as Lt,yt as Rt,zn as zt,zt as Bt}from"../chunks/po-web-runtime-D8FIos2q.js";var Vt=`po.web.desktop.v1`,Ht={version:1,windows:[],z:[],widgets:null,expanded:[],activityHidden:!1},Ut=[0,0,100,100],Wt={settings:[18,8,64,80],page:[14,6,72,86]},Gt=40,Kt=12,qt=48,Jt=10,Yt=1600,Xt=e=>`session:${e}`,Zt=(e,t)=>`tab:${e}:${t}`;function Q(e){return e.stackOn??(e.kind===`tab`&&e.sessionId!==void 0?Xt(e.sessionId):e.id)}function Qt(e,t){let n=!1,r=e.windows.map(r=>{let i=(r.kind===`session`||r.kind===`tab`)&&r.sessionId!==void 0?t(r.sessionId):void 0,a=i!==void 0&&$(e,Xt(i))!==void 0?Xt(i):void 0;if(r.stackOn===a)return r;n=!0;let{stackOn:o,...s}=r;return a===void 0?s:{...s,stackOn:a}});return n?{...e,windows:r}:e}function $(e,t){return e.windows.find(e=>e.id===t)}function $t(e){let t=[];for(let n of e.windows){let e=Q(n);t.includes(e)||t.push(e)}return t.map(t=>({root:t,members:e.windows.filter(e=>Q(e)===t).sort((t,n)=>e.z.indexOf(t.id)-e.z.indexOf(n.id))}))}function en(e){for(let t=e.z.length-1;t>=0;t--){let n=$(e,e.z[t]);if(n!==void 0&&n.minimized!==!0)return n}}function tn(e,t){if(e<=1)return[Ut];if(e===2)return[[0,0,50,100],[50,0,50,100]];if(e===3&&t>=Yt)return[[0,0,100/3,100],[100/3,0,100/3,100],[200/3,0,100/3,100]];if(e===3)return[[0,0,50,100],[50,0,50,50],[50,50,50,50]];let n=[[0,0,50,50],[50,0,50,50],[0,50,50,50],[50,50,50,50]];for(let t=4;t<e;t++){let e=Math.min((t-3)*3,30);n.push([50-e,50-e,50,50])}return n}function nn(e,t,n){let r=$(e,t);if(r===void 0)return Ut;let i=$(e,Q(r))??r;if(i.maximized===!0)return Ut;if(i.rect!==void 0)return i.rect;if(i.kind!==`session`&&i.kind!==`tab`)return Wt[i.kind];let a=e.windows.filter(e=>e.kind===`session`&&e.stackOn===void 0),o=a.findIndex(e=>e.id===i.id);return tn(a.length,n)[o]??Ut}function rn(e,t){let n=$(e,t);if(n===void 0)return e;let r=Q(n),i=e.z.filter(t=>{let n=$(e,t);return n!==void 0&&Q(n)===r}),a=[...e.z.filter(e=>!i.includes(e)),...i],o=e.windows.some(e=>Q(e)===r&&e.minimized===!0);return!o&&a.every((t,n)=>t===e.z[n])?e:{...e,z:a,windows:o?e.windows.map(e=>Q(e)===r?{...e,minimized:!1}:e):e.windows}}function an(e,t){let n=$(e,t);if(n===void 0)return e;let r=Q(n),i=e.z.filter(t=>{let n=$(e,t);return n!==void 0&&Q(n)===r}),a=i.filter(t=>$(e,t)?.sessionId===n.sessionId),o=[...e.z.filter(e=>!i.includes(e)),...i.filter(e=>!a.includes(e)),...a];return rn(o.some((t,n)=>t!==e.z[n])?{...e,z:o}:e,t)}function on(e,t){return $(e,t.id)===void 0?e.windows.length>=Gt?e:rn({...e,windows:[...e.windows,t],z:[...e.z,t.id]},t.id):rn(e,t.id)}function sn(e,t){let n=$(e,t);if(n===void 0)return e;let r=new Set(e.windows.filter(e=>e.id===t||n.kind===`session`&&(Q(e)===t||e.kind===`tab`&&e.sessionId===n.sessionId)).map(e=>e.id));return{...e,windows:e.windows.filter(e=>!r.has(e.id)),z:e.z.filter(e=>!r.has(e))}}function cn(e,t){let n=$t(e).find(e=>e.root===t);if(n===void 0||n.members.length<2)return rn(e,t);let r=n.members[n.members.length-1],i=n.members.slice(0,-1).map(e=>e.id),a=[...e.z.filter(e=>e!==r.id&&!i.includes(e)),r.id,...i];return rn({...e,z:a},t)}function ln(e,t,n){let r=$(e,t);if(r===void 0)return e;let i=Q(r);return{...e,windows:e.windows.map(e=>e.id===i?n(e):e)}}function un(e,t,n){return ln(e,t,e=>({...e,rect:gn(n),maximized:!1}))}function dn(e,t){return ln(e,t,e=>({...e,maximized:e.maximized!==!0}))}function fn(e,t){return ln(e,t,({rect:e,...t})=>({...t,maximized:!1}))}function pn(e,t){let n=$(e,t);if(n===void 0)return e;let r=Q(n);return{...e,windows:e.windows.map(e=>Q(e)===r?{...e,minimized:!0}:e)}}function mn(e){let t=e.windows.filter(e=>e.minimized!==!0).map(e=>e.id);return t.length===0?{layout:e,hidden:t}:{layout:{...e,windows:e.windows.map(e=>({...e,minimized:!0}))},hidden:t}}function hn(e,t){return{...e,windows:e.windows.map(e=>t.includes(e.id)?{...e,minimized:!1}:e)}}function gn([e,t,n,r]){let i=Math.min(Math.max(n,Jt),100),a=Math.min(Math.max(r,Jt),100);return[Math.min(Math.max(e,Jt-i),90),Math.min(Math.max(t,0),90),i,a]}function _n([e,t,n,r],i,a,o,s){return[e,t,i===`s`?n:Math.min(Math.max(n+a,s[0]),100-e),i===`e`?r:Math.min(Math.max(r+o,s[1]),100-t)]}function vn(e,t,n,r){let i=e<=Kt,a=e>=n-Kt;if(t<=Kt&&!i&&!a)return`max`;if(i||a){let e=i?`left`:`right`;return t<=qt?`top-${e}`:t>=r-qt?`bottom-${e}`:e}return null}function yn(e){switch(e){case`left`:return[0,0,50,100];case`right`:return[50,0,50,100];case`top-left`:return[0,0,50,50];case`top-right`:return[50,0,50,50];case`bottom-left`:return[0,50,50,50];case`bottom-right`:return[50,50,50,50];case`max`:return Ut}}function bn(e,t,n){let r=r=>r.kind===`session`?r.sessionId!==void 0&&t.has(r.sessionId):r.kind!==`tab`||r.sessionId!==void 0&&r.tabId!==void 0&&t.has(r.sessionId)&&n(r.sessionId,r.tabId)&&e.windows.some(e=>e.id===Xt(r.sessionId));if(e.windows.every(r))return e;let i=e.windows.filter(r);return{...e,windows:i,z:e.z.filter(e=>i.some(t=>t.id===e))}}function xn(e,t,n){let r=n===void 0?e:bn(e,n.sessionIds,n.tabOpen);t?.kind!==`settings`&&(r=sn(r,`settings`)),t?.kind!==`page`&&(r=sn(r,`page`));let i=n!==void 0&&t?.kind===`session`&&!n.sessionIds.has(t.sessionId);return t!==void 0&&!i&&$(r,t.id)===void 0&&(r=on(r,t)),n?.stepParent===void 0?r:Qt(r,n.stepParent)}function Sn(e,t){return e.widgets===null?t:e.widgets.filter(e=>t.includes(e))}function Cn(e,t,n){return{...e,widgets:Sn(e,n).filter(e=>e!==t)}}function wn(e,t,n){let r=Sn(e,n);return r.includes(t)?e:{...e,widgets:[...r,t]}}function Tn(e,t){let n=e.expanded.includes(t)?e.expanded.filter(e=>e!==t):[...e.expanded,t];return{...e,expanded:n}}var En=[`session`,`tab`,`settings`,`page`];function Dn(e){if(Array.isArray(e)&&e.length===4&&e.every(e=>typeof e==`number`&&Number.isFinite(e)))return gn(e)}function On(e){if(typeof e!=`object`||!e)return;let t=e;if(typeof t.id!=`string`||!En.includes(t.kind))return;let n=t.kind;if(n===`settings`||n===`page`)return;let r=typeof t.sessionId==`string`?t.sessionId:void 0,i=typeof t.tabId==`string`?t.tabId:void 0;if(n===`session`&&(r===void 0||t.id!==Xt(r))||n===`tab`&&(r===void 0||i===void 0||t.id!==Zt(r,i)))return;let a=Dn(t.rect);return{id:t.id,kind:n,...r===void 0?{}:{sessionId:r},...i===void 0?{}:{tabId:i},...a===void 0?{}:{rect:a},...t.minimized===!0?{minimized:!0}:{},...t.maximized===!0?{maximized:!0}:{}}}function kn(e){if(e===null)return Ht;let t;try{t=JSON.parse(e)}catch{return Ht}if(typeof t!=`object`||!t||t.version!==1)return Ht;let n=t,r=[];for(let e of Array.isArray(n.windows)?n.windows.slice(0,Gt):[]){let t=On(e);t!==void 0&&!r.some(e=>e.id===t.id)&&r.push(t)}let i=r.map(e=>e.id),a=Array.isArray(n.z)?n.z.filter(e=>typeof e==`string`&&i.includes(e)):[];return{version:1,windows:r,z:[...new Set([...i.filter(e=>!a.includes(e)),...a])],widgets:Array.isArray(n.widgets)?[...new Set(n.widgets.filter(e=>typeof e==`string`))]:null,expanded:Array.isArray(n.expanded)?[...new Set(n.expanded.filter(e=>typeof e==`string`))]:[],activityHidden:n.activityHidden===!0}}function An(e){let t=e.windows.filter(e=>e.kind!==`settings`&&e.kind!==`page`);return JSON.stringify({...e,windows:t,z:e.z.filter(e=>t.some(t=>t.id===e))})}function jn(e){return e.slice(e.lastIndexOf(`/`)+1)||e}function Mn({start:e,listDirectory:n,onSelect:r}){let[i,a]=X(e),[o,s]=X(null),[c,l]=X(``);return w(()=>{let e=!1;return n(i).then(t=>{e||(`error`in t?l(t.error):(l(``),s(t)))}),()=>{e=!0}},[i,n]),L(`div`,{"data-testid":`folder-browser`,className:`flex flex-col gap-1 rounded border border-po-border bg-po-deep p-1`,children:[L(`div`,{className:`flex items-center gap-1 px-1`,children:[D(t,{variant:`ghost`,size:`icon`,"data-testid":`folder-browser-up`,title:`parent folder`,"aria-label":`parent folder`,disabled:o?.parent===void 0,onClick:()=>o?.parent!==void 0&&a(o.parent),children:D(et,{className:`h-3 w-3`})}),D(`span`,{className:`min-w-0 flex-1 truncate text-sm text-po-dim`,title:o?.path,children:o?.path??`loading…`}),D(t,{variant:`outline`,size:`xs`,"data-testid":`folder-browser-select`,disabled:o===null,onClick:()=>o!==null&&r(o.path),children:`use this folder`})]}),c?D(`p`,{className:`px-2 py-1 text-sm text-po-red`,children:c}):null,L(`div`,{role:`listbox`,"aria-label":`folders`,className:`max-h-40 overflow-y-auto`,children:[o!==null&&o.directories.length===0?D(`p`,{className:`px-2 py-1 text-sm text-po-dim`,children:`no folders here`}):null,o?.directories.map(e=>D(Nt,{density:`compact`,"data-testid":`folder-browser-entry`,onClick:()=>a(e),className:`w-full px-2.5 py-1 `,children:jn(e)},e))]})]})}var Nn=120,Pn=-1,Fn=/\/+$/u;function In(e){let t=e.trim().replace(Fn,``);return t.slice(t.lastIndexOf(`/`)+1)}function Ln({suggestedPaths:e,actions:t}){let n=B(f,e=>e),r=n.path??e[0]??``,[i,a]=X({path:``,directories:[]});return w(()=>{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)})},Nn);return()=>{n=!0,clearTimeout(i)}},[r,t]),w(()=>v(r,t.discoverWorkspaces),[r,t.discoverWorkspaces]),D(Rn,{suggestions:r.trim()!==``&&i.path===r?i.directories:[],suggestedPaths:e,actions:t,draft:n,updateDraft:Ge})}function Rn({suggestedPaths:e,actions:n,draft:r,updateDraft:i,style:a,suggestions:o=[]}){let{name:s,nameEdited:c,instructions:l,pending:u,error:d,discovery:f}=r,p=r.path??e[0]??``,m=e=>i({name:e}),h=e=>i({nameEdited:e}),g=e=>i({path:e}),[v,y]=X(!1),[x,S]=X(Pn),C=F(null),w=c?s:In(p),T=e=>{u||(g(e),S(Pn))},E=e=>{T(`${e}/`),C.current?.focus()},O=p.trim().replace(Fn,``)||(p.trim()===``?``:`/`),k=r.discovering||!!p.trim()&&n.discoverWorkspaces!==void 0&&r.discoveryPath!==p,j=f&&`error`in f?f.error:``,M=f&&`declarations`in f&&f.declarations.length>0?f.declarations:void 0,P=e=>M?.find(t=>t.name===e)?.workspaceId??r.results.find(t=>t.name===e)?.workspaceId,I=M?.filter(e=>r.checked.includes(e.name)&&!P(e.name)).map(e=>e.name)??[],ee=!M&&!k&&!j,te=!u&&!k&&!j&&(M?I.length>0&&n.addDeclaredWorkspaces!==void 0:O!==``||w.trim()!==``),R=async()=>{te&&(M?await n.addDeclaredWorkspaces?.({path:f&&`root`in f?f.root:O,names:I}):await n.addWorkspace({...l===``?{}:{instructions:l},name:w.trim(),...O===``?{}:{path:O}}))};return D(be,{open:!0,onOpenChange:e=>!e&&!u&&n.closeAddWorkspace(),children:L(N,{style:a,width:`md`,"data-testid":`add-workspace-dialog`,"aria-describedby":void 0,children:[D(Ce,{children:D(G,{children:`Add workspace`})}),L(b,{children:[L(`label`,{htmlFor:`add-workspace-root`,className:`flex flex-col gap-1`,children:[D(`span`,{className:`text-base font-medium text-po-dim`,children:`Folder`}),L(`span`,{className:`flex items-center gap-1.5`,children:[D(Et,{id:`add-workspace-root`,ref:C,"data-testid":`add-workspace-root`,value:p,autoFocus:!0,disabled:u,onChange:e=>T(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`&&o.length>0)e.preventDefault(),S(e=>(e+1)%o.length);else if(e.key===`ArrowUp`&&o.length>0)e.preventDefault(),S(e=>e<=0?o.length-1:e-1);else if(e.key===`Enter`){let e=x===Pn?void 0:o[x];e===void 0?R():E(e)}},placeholder:`~/workspace/my-project`,className:`min-w-0 flex-1 font-mono`}),D(t,{variant:v?`subtle`:`outline`,size:`md`,"data-testid":`add-workspace-browse`,"aria-pressed":v,disabled:u,onClick:()=>y(e=>!e),children:`Browse`})]})]}),v?D(Mn,{...O.startsWith(`/`)?{start:O}:{},listDirectory:n.listDirectory,onSelect:e=>{T(e),y(!1)}}):o.length>0?D(`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:o.map((e,t)=>D(Nt,{density:`compact`,active:t===x,"data-testid":`add-workspace-suggestion`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>S(t),onClick:()=>E(e),className:`w-full px-2.5 py-1 `,children:e},e))}):null,e.length>0?D(`div`,{className:`flex flex-wrap gap-1`,children:e.slice(0,4).map(e=>D(t,{variant:`outline`,size:`xs`,disabled:u,onClick:()=>T(e),children:e},e))}):null,k?D(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Reading workspace declarations…`}):null,j?D(`p`,{role:`alert`,className:`text-sm text-po-red`,children:j}):null,M?L(`fieldset`,{className:`flex min-w-0 flex-col gap-1`,children:[D(`legend`,{className:`mb-1 text-base font-medium text-po-hi`,children:`Workspaces`}),D(`p`,{className:`mb-1 text-sm text-po-dim`,children:`Declared in .po/config.yaml. Choose which to add.`}),M.map((e,t)=>{let n=P(e.name)!==void 0,a=n||r.checked.includes(e.name),o=r.results.find(t=>t.name===e.name)?.error;return D(`div`,{"data-checked":a,className:`rounded-sm px-2 py-1.5 data-[checked=true]:bg-po-tint-green`,children:L(`label`,{htmlFor:`add-workspace-declaration-${t}`,className:`flex min-w-0 cursor-pointer items-start gap-2.5`,children:[D(ue,{id:`add-workspace-declaration-${t}`,checked:a,disabled:n||u,onCheckedChange:()=>i({checked:a?r.checked.filter(t=>t!==e.name):[...r.checked,e.name]}),className:`mt-1`}),L(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[D(`span`,{className:`text-base font-semibold text-po-hi`,children:e.name}),D(`span`,{className:`truncate text-sm text-po-dim`,title:e.instructions,children:e.instructions}),o?D(`span`,{role:`alert`,className:`text-sm text-po-red`,children:o}):null]}),n?D(`span`,{className:`text-sm text-po-dim`,children:`Added`}):null]})},e.name)})]}):ee?L(_,{children:[L(`label`,{htmlFor:`add-workspace-name`,className:`flex flex-col gap-1`,children:[D(`span`,{className:`text-base font-medium text-po-dim`,children:`Name`}),D(Et,{id:`add-workspace-name`,"data-testid":`add-workspace-name`,value:w,disabled:u,onChange:e=>{h(!0),m(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&R()},placeholder:`my-project`})]}),L(`label`,{htmlFor:`add-workspace-instructions`,className:`flex flex-col gap-1`,children:[L(`span`,{className:`text-base font-medium text-po-dim`,children:[`Instructions `,D(`span`,{className:`font-normal`,children:`(optional)`})]}),D(A,{id:`add-workspace-instructions`,rows:3,value:l,disabled:u,onChange:e=>i({instructions:e.target.value})}),D(`span`,{className:`text-sm text-po-dim`,children:`For main sessions in this workspace.`})]})]}):null,ee&&O===``&&w.trim()!==``?L(`p`,{"data-testid":`add-workspace-default-hint`,className:`text-sm text-po-dim`,children:[`creates ~/.po/workspace/`,w.trim()]}):null,d?D(`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:d}):null,L(W,{children:[D(t,{variant:`outline`,onClick:()=>n.closeAddWorkspace(),disabled:u,children:`Cancel`}),D(t,{variant:`primary`,"data-testid":`add-workspace-confirm`,onClick:()=>void R(),disabled:!te,children:u?`Adding…`:M?`Add ${I.length} ${I.length===1?`workspace`:`workspaces`}`:`Add workspace`})]})]})]})})}var zn=`bg-po-panel/75 backdrop-blur-2xl ring-1 ring-po-border-soft`,Bn=[360,240];function Vn(e){return{left:`${e[0]}%`,top:`${e[1]}%`,width:`${e[2]}%`,height:`${e[3]}%`}}var Hn=[[`left`,`Snap to left half`],[`right`,`Snap to right half`],[`top-left`,`Snap to top left`],[`top-right`,`Snap to top right`],[`bottom-left`,`Snap to bottom left`],[`bottom-right`,`Snap to bottom right`]];function Un({label:e,onClick:t,children:n}){return L(Oe,{children:[D(q,{asChild:!0,children:D(`button`,{type:`button`,"aria-label":e,"data-window-control":!0,onClick:t,className:`grid size-6 place-items-center rounded-full text-po-dim hover:bg-po-rail hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:n})}),D(V,{side:`bottom`,children:e})]})}function Wn({title:e,subtitle:t,rect:n,layer:r,focused:i,minimized:a,maximized:o,stacked:s,narrow:c,desktop:l,headerRegion:u,testId:d,onFocus:f,onClose:p,onRename:m,onMinimize:h,onToggleMaximize:g,onPlace:v,onResetPlace:y,onSnapPreview:b,children:x}){let S=F(null),[C,w]=X(null),T=c||o,E=c?[0,0,100,100]:C??n,O=(e,t)=>[e/Math.max(l.width,1)*100,t/Math.max(l.height,1)*100],k=(e,t)=>{e.button!==0||T||(e.currentTarget.setPointerCapture(e.pointerId),S.current=t)},A=e=>{let t=S.current;if(t===null)return;let[n,r]=O(e.clientX-t.x,e.clientY-t.y);if(t.kind===`resize`){w(_n(t.start,t.edge,n,r,O(Bn[0],Bn[1])));return}w([t.start[0]+n,t.start[1]+r,t.start[2],t.start[3]]);let i=e.currentTarget.closest(`[data-desktop-surface]`)?.getBoundingClientRect(),a=i===void 0?null:vn(e.clientX-i.left,e.clientY-i.top,i.width,i.height);a!==t.zone&&(t.zone=a,b(a===null?null:yn(a)))},j=()=>{let e=S.current;S.current=null,e!==null&&(e.kind===`move`&&e.zone!==null?v(yn(e.zone)):C!==null&&v(C),b(null),w(null))},M=T?null:D(_,{children:[`e`,`s`,`se`].map(e=>D(`span`,{"aria-hidden":!0,onPointerDown:t=>k(t,{kind:`resize`,edge:e,x:t.clientX,y:t.clientY,start:n}),onPointerMove:A,onPointerUp:j,onPointerCancel:j,className:e===`e`?`absolute inset-y-4 right-0 w-2 cursor-ew-resize touch-none`:e===`s`?`absolute inset-x-4 bottom-0 h-2 cursor-ns-resize touch-none`:`absolute right-0 bottom-0 size-4 cursor-nwse-resize touch-none`},e))});return D(`div`,{"data-testid":d,style:{...Vn(E),zIndex:r+1},onPointerDownCapture:e=>{e.target.closest(`[data-window-control]`)===null&&f()},"aria-hidden":a||void 0,className:`absolute p-1.5 ${a?`invisible`:``} ${s===`top`?`pt-5`:``} ${s===`under`?`origin-top scale-96`:``} ${C===null?`transition-[left,top,width,height] duration-150`:``}`,children:L(`section`,{"aria-label":e,className:`relative flex h-full flex-col overflow-hidden rounded-2xl bg-po-panel/90 ring-1 backdrop-blur-2xl animate-po-pop ${i?`shadow-2xl ring-po-border`:`shadow-lg ring-po-border-soft`}`,children:[L(`header`,{"data-po-region":u,onPointerDown:e=>{e.target.closest(`button, [data-window-control]`)===null&&k(e,{kind:`move`,x:e.clientX,y:e.clientY,start:n,zone:null})},onPointerMove:A,onPointerUp:j,onPointerCancel:j,onDoubleClick:e=>{e.target.closest(`button, [data-window-control]`)===null&&!c&&g()},className:`grid h-11 shrink-0 grid-cols-[1fr_auto_1fr] items-center px-3 select-none ${T?``:`cursor-grab touch-none active:cursor-grabbing`}`,children:[D(`span`,{}),L(K,{children:[D(ut,{asChild:!0,children:L(`button`,{type:`button`,"aria-label":`${e} window menu`,className:`flex min-w-0 items-baseline gap-2 rounded-lg px-2.5 py-1 hover:bg-po-rail focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:[D(`span`,{className:`truncate text-base first-letter:uppercase ${i?`font-semibold text-po-hi`:`font-medium text-po-dim`}`,children:e}),t?D(`span`,{className:`truncate text-sm text-po-dim max-md:hidden`,children:t}):null]})}),L(st,{"data-window-control":!0,align:`center`,className:`min-w-52`,children:[m===void 0?null:L(_,{children:[D(Z,{onSelect:m,children:`Rename`}),D(Qe,{})]}),c?null:L(_,{children:[D(Z,{onSelect:g,children:o?`Restore`:`Maximise`}),Hn.map(([e,t])=>D(Z,{onSelect:()=>v(yn(e)),children:t},e)),D(Z,{onSelect:y,children:`Back to default place`}),D(Qe,{})]}),D(Z,{onSelect:h,children:`Minimise`}),D(Z,{onSelect:p,children:`Close`})]})]}),L(`span`,{className:`flex justify-end gap-1 ${i?``:`opacity-60`}`,children:[D(Un,{label:`Minimise`,onClick:h,children:D(`span`,{"aria-hidden":!0,className:`h-px w-2.5 bg-current`})}),c?null:D(Un,{label:o?`Restore`:`Maximise`,onClick:g,children:D(o?ie:we,{className:`size-3`})}),D(Un,{label:`Close`,onClick:p,children:D(se,{className:`size-3.5`})})]})]}),D(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:x}),M]})})}var Gn={session:mt,tab:Ve,settings:Ae,page:we};function Kn({profile:e,className:t}){return L(d,{className:t,children:[e?.avatarUrl?D(C,{src:e.avatarUrl,alt:``}):null,D(g,{className:`bg-po-tint-magenta text-2xs font-semibold text-po-magenta`,children:e?.initials??`PO`})]})}function qn({label:e,tip:t,shape:n=`grid size-10 place-items-center`,active:r,pressed:i,onClick:a,testId:o,children:s}){return L(Oe,{children:[D(q,{asChild:!0,children:D(`button`,{type:`button`,"aria-label":e,"aria-pressed":i,"data-testid":o,onClick:a,className:`relative ${n} shrink-0 rounded-xl focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none ${r?`bg-po-panel text-po-hi shadow-sm`:`text-po-dim hover:bg-po-panel/70`}`,children:s})}),D(V,{side:`top`,sideOffset:8,children:t??e})]})}function Jn({stack:e}){return L(`span`,{"data-testid":`desktop-bar-tip-${e.root}`,className:`flex max-w-72 flex-col gap-0.5 py-0.5`,children:[D(`span`,{className:`truncate font-semibold text-po-hi`,children:e.label}),e.profile?D(`span`,{className:`truncate text-po-dim`,children:e.profile.label}):null,e.clock?D(St,{label:e.clock.label,since:e.clock.since,className:`truncate text-po-dim`}):e.status?D(`span`,{className:`truncate text-po-dim`,children:e.status}):null,e.details.map(e=>D(`span`,{className:`truncate text-po-dim`,children:e},e))]})}function Yn(){let[e,t]=X(()=>new Date);return w(()=>{let e=window.setInterval(()=>t(new Date),15e3);return()=>window.clearInterval(e)},[]),L(`time`,{dateTime:e.toISOString(),className:`flex shrink-0 flex-col items-end px-2 leading-tight max-sm:hidden`,children:[D(`span`,{className:`text-base font-semibold text-po-hi`,children:new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}).format(e)}),D(`span`,{className:`text-sm text-po-dim`,children:new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`}).format(e)})]})}function Xn({menuOpen:e,menuTrigger:t,stacks:r,waiting:i,menuWaiting:a=0,menuRunning:o=0,faces:s,face:c,railShown:l,homeShown:u,onHome:d,onStack:f,onFace:p}){let m=l?c:null,h=s.reduce((e,t)=>{let n=e.at(-1);return t.group!==void 0&&n?.[0]?.group===t.group?n.push(t):e.push([t]),e},[]);return L(`footer`,{className:`relative mx-3 mb-3 flex h-14 shrink-0 items-center gap-1 rounded-2xl px-2 shadow-lg ${zn}`,children:[t(L(`button`,{type:`button`,"aria-label":`Open the Po menu${a>0?`, ${a} waiting for you`:``}${o>0?`, ${o} running`:``}`,"data-testid":`desktop-po-button`,className:`flex h-10 shrink-0 items-center gap-2 rounded-xl pr-3 pl-1.5 focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none ${e?`bg-po-panel shadow-sm`:`hover:bg-po-panel/70`}`,children:[L(`span`,{className:`relative shrink-0`,children:[D(rt,{size:28,className:`rounded-lg shadow-sm`}),a>0?D(`span`,{"aria-hidden":!0,"data-testid":`desktop-po-waiting`,className:`absolute -top-1.5 -right-1.5 min-w-4 rounded-full bg-po-magenta px-1 text-center text-2xs leading-4 font-semibold text-po-bg`,children:a>9?`9+`:a}):null,o>0?D(`span`,{"aria-hidden":!0,"data-testid":`desktop-po-running`,className:`absolute -right-1.5 -bottom-1.5 min-w-4 rounded-full bg-po-green px-1 text-center text-2xs leading-4 font-semibold text-po-bg`,children:o>9?`9+`:o}):null]}),D(`span`,{className:`text-base font-semibold text-po-hi max-sm:hidden`,children:`Po`})]})),D(qn,{label:u?`Back to your windows`:`Show Home`,active:u,pressed:u,onClick:d,testId:`desktop-home`,children:D(n,{"aria-hidden":!0,className:`size-5`})}),D(`span`,{"aria-hidden":!0,className:`mx-1 h-6 w-px shrink-0 bg-po-border-soft`}),D(`nav`,{"aria-label":`Open windows`,className:`flex min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden py-1`,children:r.map(e=>{let t=Gn[e.kind];return L(qn,{testId:`desktop-bar-${e.root}`,label:[e.label,e.running?`running`:void 0,e.waiting?`${e.waiting} waiting for you`:void 0,e.size>1?`${e.size} windows stacked. Swap the stack`:void 0].filter(Boolean).join(`, `),tip:D(Jn,{stack:e}),shape:`flex h-10 max-w-48 items-center gap-2 pr-3 pl-2`,active:e.focused,pressed:e.focused,onClick:()=>f(e.root),children:[e.kind===`session`||e.kind===`tab`?L(`span`,{className:`relative shrink-0`,children:[D(Kn,{profile:e.profile,className:`size-6`}),e.running?D(`span`,{"aria-hidden":!0,"data-testid":`desktop-bar-running-${e.root}`,className:`absolute -inset-1 animate-spin rounded-full border-2 border-po-green/25 border-t-po-green motion-reduce:animate-none`}):null,e.waiting?D(`span`,{"aria-hidden":!0,"data-testid":`desktop-bar-waiting-${e.root}`,className:`absolute -top-2 -right-2 min-w-4 rounded-full bg-po-magenta px-1 text-center text-2xs leading-4 font-semibold text-po-bg`,children:e.waiting>99?`99+`:e.waiting}):null]}):D(t,{"aria-hidden":!0,className:`size-5 shrink-0`}),D(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.label}),e.size>1?D(`span`,{"aria-hidden":!0,className:`absolute -top-0.5 -right-0.5 grid size-4 place-items-center rounded-full bg-po-panel text-2xs font-semibold text-po-hi shadow-sm ring-1 ring-po-border`,children:e.size}):null,D(`span`,{"aria-hidden":!0,className:`absolute bottom-0.5 left-1/2 h-1 -translate-x-1/2 rounded-full ${e.focused?`w-4 bg-po-green`:e.minimized?`w-1 bg-po-faint`:`w-1.5 bg-po-dim`}`})]},e.root)})}),i>0?L(`span`,{className:`flex shrink-0 items-center gap-1.5 rounded-full bg-po-tint-magenta px-2.5 py-1 text-sm text-po-magenta max-sm:hidden`,children:[D(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-po-magenta`}),i,` waiting for you`]}):null,D(`div`,{"data-rail-status":`desktop-action`,className:`contents`,children:D(kt,{slot:ae.railStatus,sessionId:null})}),D(`span`,{"aria-hidden":!0,className:`mx-1 h-6 w-px shrink-0 bg-po-border-soft max-sm:hidden`}),D(`nav`,{"aria-label":`Rail`,className:`flex shrink-0 items-center gap-0.5 max-sm:hidden`,children:h.map(e=>{let t=e.map(({id:e,label:t,icon:n,badge:r})=>{let i=e===`activity`;return L(qn,{testId:`desktop-face-${e}`,label:`${m===e?`Hide ${t}`:t}${r>0?`, ${r} ${i?`waiting for you`:`new`}`:``}`,active:m===e,pressed:m===e,onClick:()=>p(e),children:[D(n,{"aria-hidden":!0,className:`size-4`}),r>0?D(`span`,{"aria-hidden":!0,"data-testid":`desktop-face-badge-${e}`,className:`absolute top-0.5 right-0 rounded-full px-1 text-2xs leading-4 font-semibold text-po-bg ${i?`bg-po-magenta`:`bg-po-green`}`,children:r>99?`99+`:r}):null]},e)}),n=e[0]?.group;return e.length>1&&n!==void 0?D(`div`,{role:`group`,"aria-label":n,className:`flex items-center gap-0.5 rounded-xl bg-po-panel/60`,children:t},`group-${e[0]?.id}`):D(ve,{children:t},e[0]?.id)})}),D(`span`,{className:`sm:hidden`,children:D(qn,{label:m===null?`Show the rail`:`Hide the rail`,active:m!==null,pressed:m!==null,onClick:()=>p(c),testId:`desktop-rail-toggle`,children:D(ge,{"aria-hidden":!0,className:`size-4`})})}),D(Yn,{})]})}var Zn=`rail/workflow-steps-expanded`,Qn=e=>e.awaitingInput||(e.waitingCount??0)>0;function $n(e){let t=new Set(e.map(({session:e})=>e.id)),n=new Map,r=[];for(let i of e){let e=i.session.parentId;i.session.provenance===`workflow`&&e!==void 0&&t.has(e)?n.set(e,[...n.get(e)??[],i]):r.push(i)}let i=r.sort((e,t)=>(t.session.lastActivityAt??0)-(e.session.lastActivityAt??0)).map(e=>[e,...n.get(e.session.id)??[]]),a=e=>e.some(({session:e})=>Qn(e));return[{key:`needs`,title:`Needs you`,data:i.filter(a).flat()},{key:`recent`,title:`Recent`,data:i.filter(e=>!a(e)).flat()}].filter(e=>e.data.length>0)}function er(e){return e.status.startsWith(`running`)||e.status.startsWith(`workflow`)}var tr=`desktop/menu-dialog`;function nr(e,t){ye(tr,null).setState(()=>({mode:`rename`,sessionId:e,name:t}))}var rr=`po.session-view`,ir=[{value:`workspaces`,title:`Workspaces`,description:`Sessions grouped by workspace`,Icon:Ye},{value:`sessions`,title:`Sessions`,description:`Needs you first, then latest change`,Icon:mt}];function ar(){try{return window.localStorage.getItem(rr)===`sessions`?`sessions`:`workspaces`}catch{return`workspaces`}}function or(e){try{return window.localStorage.setItem(rr,e),!0}catch{return!1}}function sr({session:e,actions:n,coordinates:r,coordinator:i,workspaceName:a,onOpen:o,onDialog:s,onRole:c,stepsExpanded:l,onToggleSteps:d}){let f=e.error!==void 0||e.status.includes(`failed`),p=er(e),m=e.name||`Untitled`,h=n.setSessionRole===void 0||e.coordinatorEligible!==!0?null:e.coordinator?D(Z,{disabled:e.restartBlocked===!0,onSelect:()=>c(!1),children:`Make regular session`}):D(Z,{"data-testid":`desktop-session-make-coordinator-${e.id}`,disabled:e.restartBlocked===!0,onSelect:()=>i===void 0?c(!0):s({mode:`promote`,sessionId:e.id,name:m,coordinates:r,coordinator:i}),children:`Make coordinator`});return L(`div`,{className:`relative`,children:[l===void 0?null:D(`button`,{type:`button`,"data-testid":`desktop-menu-steps-${e.id}`,"aria-expanded":l,"aria-label":`${l?`Hide`:`Show`} steps of ${m}`,onClick:()=>d?.(e.id),className:`absolute top-1/2 left-1.5 z-10 grid size-5 -translate-y-1/2 place-items-center rounded-sm text-po-dim hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:D(l?fe:u,{"aria-hidden":!0,className:`size-3.5`})}),L(`button`,{type:`button`,"data-testid":`desktop-menu-session-${e.id}`,"aria-current":e.active?`true`:void 0,onClick:o,className:`flex w-full items-center gap-3 rounded-xl py-2 pr-12 pl-3 text-left hover:bg-po-rail focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none ${e.provenance===`workflow`&&e.nested?`pl-14`:e.nested||l!==void 0?`pl-8`:``} ${e.active?`bg-po-rail/70`:``}`,children:[D(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg ${f?`bg-po-tint-red text-po-red`:p?`bg-po-tint-yellow text-po-yellow`:`bg-po-rail text-po-dim`}`,children:f?D(Tt,{"aria-hidden":!0,className:`size-4`}):p?D(Re,{"aria-hidden":!0,className:`size-4 animate-spin`}):D(mt,{"aria-hidden":!0,className:`size-4`})}),L(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[D(`span`,{className:`truncate text-base font-medium text-po-hi`,children:e.name}),L(`span`,{className:`truncate text-sm text-po-dim`,children:[e.clock?D(St,{label:e.clock.label,since:e.clock.since}):e.status,a?` · ${a}`:null]})]}),e.awaitingInput||(e.waitingCount??0)>0?L(`span`,{className:`flex shrink-0 items-center`,children:[D(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-po-magenta`}),D(`span`,{className:`sr-only`,children:`Waiting for you`})]}):null]}),L(K,{children:[D(ut,{asChild:!0,children:D(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Actions for ${m}`,title:`Session actions`,"data-testid":`desktop-menu-session-actions-${e.id}`,className:`absolute top-1/2 right-2 -translate-y-1/2 rounded-full text-po-dim hover:text-po-hi`,children:D(yt,{"aria-hidden":!0,className:`size-4`})})}),L(st,{align:`end`,"data-testid":`desktop-menu-session-actions-list-${e.id}`,children:[n.renderSessionMenuItems(e.id),D(Z,{"data-testid":`desktop-session-rename-${e.id}`,onSelect:()=>s({mode:`rename`,sessionId:e.id,name:m}),children:`Rename`}),h,D(Z,{onSelect:()=>n.resumeSession(e.id),children:`Resume`}),n.openMoveSession&&e.move?D(Z,{disabled:e.restarting||e.move.blocked,onSelect:()=>n.openMoveSession?.(e.id),children:`Move to workspace…`}):null,D(Z,{disabled:e.restarting||e.restartBlocked===!0,onSelect:()=>n.restartSession(e.id),children:`Restart`}),D(Z,{variant:`destructive`,"data-testid":`desktop-session-remove-${e.id}`,onSelect:()=>s({mode:`remove`,sessionId:e.id,name:m}),children:`Remove`})]})]})]})}function cr({workspace:e,actions:n,act:r,onDialog:i,onAddCoordinator:a}){let{id:o,name:s,root:c,available:l,legacy:u}=e;return L(`span`,{className:`flex min-w-0 items-center gap-0.5 pt-1 pr-2 pb-1 pl-3`,title:c,children:[!u&&n.openWorkspace?D(`button`,{type:`button`,title:`Open ${s} workspace`,onClick:()=>r(()=>n.openWorkspace?.(o)),className:`min-w-0 flex-1 truncate rounded-sm text-left text-sm font-semibold text-po-dim hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:s}):D(`span`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-po-dim`,children:s}),u?null:L(_,{children:[D(t,{variant:`ghost`,size:`icon`,"aria-label":`New session in ${s}`,title:`New session in ${s}`,disabled:!l,onClick:()=>r(()=>n.createSession(o)),className:`size-6 rounded-full text-po-dim`,children:D(Y,{className:`size-3.5`})}),L(K,{children:[D(ut,{asChild:!0,children:D(t,{variant:`ghost`,size:`icon`,"aria-label":`${s} actions`,title:`Workspace actions`,"data-testid":`desktop-workspace-actions-${o}`,className:`size-6 rounded-full text-po-dim`,children:D(yt,{"aria-hidden":!0,className:`size-3.5`})})}),L(st,{align:`end`,"data-testid":`desktop-workspace-actions-list-${o}`,children:[D(Z,{disabled:!l,onSelect:()=>r(()=>n.resumeInWorkspace(o)),children:`Resume session`}),n.addCoordinator===void 0?null:D(Z,{disabled:!l,onSelect:a,children:`Add bot`}),D(Z,{disabled:!l,onSelect:()=>r(()=>n.openWorkspaceSettings(o)),children:`Workspace settings`}),D(Z,{variant:`destructive`,"data-testid":`desktop-workspace-delete-${o}`,onSelect:()=>i({mode:`delete-workspace`,workspaceId:o,name:s,root:c}),children:`Delete workspace`})]})]})]})]})}function lr({actions:e}){let[n,r]=Me(tr,null),[i,a]=X(``),[o,s]=X(``),[c,l]=X(!1),[u,d]=X(null);n!==u&&(d(n),a(n?.mode===`rename`?n.name:``),s(``));let f=()=>{c||r(null)},p=async e=>{if(c)return;l(!0),s(``);let t=await e();l(!1),t===void 0?r(null):s(t.error)};return L(_,{children:[D(be,{open:n?.mode===`rename`,onOpenChange:e=>!e&&f(),children:L(N,{width:`sm`,"data-testid":`desktop-session-rename-dialog`,"aria-describedby":void 0,children:[D(Ce,{children:D(G,{children:`Rename session`})}),D(b,{children:L(`form`,{className:`flex flex-col gap-3`,onSubmit:t=>{t.preventDefault(),n?.mode===`rename`&&i.trim()!==``&&(e.renameSession(n.sessionId,i),f())},children:[D(Et,{"aria-label":`Session name`,"data-testid":`desktop-session-name-input`,value:i,onChange:e=>a(e.target.value)}),L(W,{children:[D(t,{type:`button`,variant:`outline`,size:`md`,onClick:f,children:`Cancel`}),D(t,{type:`submit`,variant:`primary`,size:`md`,disabled:i.trim()===``,children:`Rename`})]})]})})]})}),D(be,{open:n?.mode===`remove`,onOpenChange:e=>!e&&f(),children:L(N,{width:`sm`,"data-testid":`desktop-session-remove-dialog`,"aria-describedby":void 0,children:[D(Ce,{children:D(G,{children:`Remove session`})}),L(b,{children:[L(_t,{children:[`This stops`,` `,D(`span`,{className:`font-semibold text-po-hi`,children:n?.mode===`remove`?n.name:``}),` and removes it from the list. Anything it is running ends now. You can restore it for 7 days.`]}),o?D(`p`,{className:`text-sm text-po-red`,children:o}):null,L(W,{children:[D(t,{variant:`outline`,size:`md`,disabled:c,onClick:f,children:`Cancel`}),D(t,{variant:`danger`,size:`md`,disabled:c,"data-testid":`desktop-session-remove-confirm`,onClick:()=>n?.mode===`remove`&&void p(()=>e.removeSession(n.sessionId)),children:`Remove`})]})]})]})}),D(be,{open:n?.mode===`promote`,onOpenChange:e=>!e&&f(),children:D(N,{width:`sm`,"data-testid":`desktop-session-promote-dialog`,"aria-describedby":void 0,children:n?.mode===`promote`?L(_,{children:[D(Ce,{children:L(G,{children:[`Make `,n.name,` the coordinator of `,n.coordinates,`?`]})}),L(b,{children:[L(_t,{children:[D(`span`,{className:`font-semibold text-po-hi`,children:n.name}),` will see every session in`,` `,n.coordinates,`, message them, and start new ones.`,` `,D(`span`,{className:`font-semibold text-po-hi`,children:n.coordinator}),` becomes a regular session. Both restart to take on their new roles, so anything they are running stops now.`]}),o?D(`p`,{className:`text-sm text-po-red`,children:o}):null,L(W,{children:[D(t,{variant:`outline`,size:`md`,disabled:c,onClick:f,children:`Cancel`}),D(t,{variant:`primary`,size:`md`,disabled:c,onClick:()=>void p(()=>e.setSessionRole?.(n.sessionId,!0)),children:`Make coordinator`})]})]})]}):null})}),D(be,{open:n?.mode===`delete-workspace`,onOpenChange:e=>!e&&f(),children:D(N,{width:`sm`,"data-testid":`desktop-workspace-delete-dialog`,"aria-describedby":void 0,children:n?.mode===`delete-workspace`?L(_,{children:[D(Ce,{children:D(G,{children:`Delete workspace`})}),L(b,{children:[L(_t,{children:[`This removes `,D(`span`,{className:`font-semibold text-po-hi`,children:n.name}),` and all its sessions from Po. Running work will stop. Files at `,D(`code`,{children:n.root}),` stay on disk.`]}),o?D(`p`,{className:`text-sm text-po-red`,children:o}):null,L(W,{children:[D(t,{variant:`outline`,size:`md`,disabled:c,onClick:f,children:`Cancel`}),D(t,{variant:`danger`,size:`md`,disabled:c,"data-testid":`desktop-workspace-delete-confirm`,onClick:()=>void p(()=>e.deleteWorkspace(n.workspaceId)),children:c?`Deleting…`:`Delete`})]})]})]}):null})}),D(be,{open:n?.mode===`error`,onOpenChange:e=>!e&&f(),children:D(N,{width:`sm`,"data-testid":`desktop-menu-error-dialog`,"aria-describedby":void 0,children:n?.mode===`error`?L(_,{children:[D(Ce,{children:D(G,{children:n.title})}),L(b,{children:[D(`p`,{className:`text-sm text-po-red`,children:n.message}),D(W,{children:D(t,{variant:`outline`,size:`md`,onClick:f,children:`Close`})})]})]}):null})})]})}function ur({rail:e,onHome:r,onClose:a}){let{scrollRef:s,actions:c,pluginContent:l}=e,[u,d]=X(``),f=u.trim().toLowerCase(),[p,m]=Me(Zn,[]),h=o(e=>m(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[m]),g=e.workspaces.flatMap(e=>e.sessions),v=De(g,new Set(p)),y=new Set(v.sessions.map(e=>e.id)),b=new Set(g.filter(e=>e.name.toLowerCase().includes(f)).map(e=>e.id)),x=e=>f===``?y.has(e.id):b.has(e.id)||g.some(t=>t.parentId===e.id&&t.provenance===`workflow`&&b.has(t.id)),S=e.workspaces.map(e=>({...e,current:e.sessions.find(e=>e.coordinator),sessions:e.sessions.filter(x)})).filter(e=>f===``||e.sessions.length>0),C=e.workspaces.length===0,w=e.coordinatorHosts??[],T=g.find(e=>e.active),E=T?.profile,[O,A]=Me(`rail/session-view`,ar),j=ir.find(e=>e.value===O)??ir[0],M=O===`sessions`?$n(S.flatMap(e=>e.sessions.map(t=>({session:{...t,nested:t.provenance===`workflow`},workspace:e,workspaceName:e.kind===`session`?void 0:e.name})))):[],[,N]=Me(tr,null),P=e=>{e(),a()},F=(e,t)=>P(()=>{Promise.resolve(t()).then(t=>{t!==void 0&&N({mode:`error`,title:e,message:t.error})})}),I=(e,t,n)=>D(sr,{session:e,actions:c,coordinates:t.kind===`session`?`Home`:t.name,coordinator:t.current===void 0||t.current.id===e.id?void 0:t.current.name,workspaceName:n,onOpen:()=>P(()=>c.openSession(e.id)),onDialog:e=>P(()=>N(e)),onRole:t=>F(`Could not change the role`,()=>c.setSessionRole?.(e.id,t)),...v.withSteps.has(e.id)?{stepsExpanded:p.includes(e.id),onToggleSteps:h}:{}},e.id);return L(_,{children:[L(`label`,{className:`m-4 mb-2 flex items-center gap-2.5 rounded-xl bg-po-panel px-3.5 py-2.5 ring-1 ring-po-border-soft focus-within:ring-po-green`,children:[D(k,{"aria-hidden":!0,className:`size-4 text-po-dim`}),D(`input`,{"aria-label":`Search sessions`,placeholder:`Search sessions`,value:u,onChange:e=>d(e.target.value),className:`min-w-0 flex-1 bg-transparent text-lg text-po-text outline-none placeholder:text-po-dim`})]}),L(`section`,{ref:s,"data-po-region":`rail`,"aria-label":`Sessions`,className:`flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-2 py-2`,children:[D(`div`,{className:`flex items-center gap-1 pr-3`,children:L(`button`,{type:`button`,"data-testid":`desktop-menu-home`,onClick:()=>P(r),className:`flex min-w-0 flex-1 items-center gap-3 rounded-xl px-3 py-2 text-left text-base font-medium text-po-hi hover:bg-po-rail focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:[D(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-po-rail text-po-dim`,children:D(n,{"aria-hidden":!0,className:`size-4`})}),`Home`]})}),D(`div`,{"data-rail":`desktop`,className:`group/rail -mt-2.5 flex flex-col gap-0.5 pr-3 empty:hidden`,children:l}),L(`div`,{className:`flex items-center gap-0.5 pt-1 pr-2 pl-3`,children:[D(`h2`,{className:`min-w-0 flex-1 truncate text-base font-semibold text-po-hi`,children:`Sessions`}),L(K,{children:[D(ut,{asChild:!0,children:D(t,{variant:`ghost`,size:`icon`,"data-testid":`session-view-menu`,title:`View: ${j.title}`,"aria-label":`View: ${j.title}`,className:`size-6 rounded-full text-po-dim`,children:D(i,{className:`size-3.5`})})}),D(st,{align:`end`,"aria-label":`View`,children:ir.map(({value:e,title:t,description:n,Icon:r})=>L(Z,{"data-testid":`session-view-${e}`,"aria-checked":O===e,role:`menuitemradio`,onSelect:()=>{A(e),or(e)},className:`items-start gap-2.5 ${O===e?`bg-po-tint-green`:``}`,children:[D(r,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 ${O===e?`text-po-green`:`text-po-dim`}`}),L(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[D(`span`,{className:`text-po-hi`,children:t}),D(`span`,{className:`text-sm text-po-dim`,children:n})]}),O===e?D(je,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-po-green`}):null]},e))})]}),L(K,{children:[D(ut,{asChild:!0,children:D(t,{variant:`ghost`,size:`icon`,"aria-label":`Create workspace or session`,title:`Create workspace or session`,"data-testid":`session-create-menu`,className:`size-6 rounded-full text-po-dim`,children:D(Y,{className:`size-3.5`})})}),L(st,{align:`end`,className:`min-w-56`,children:[D(Z,{"data-testid":`add-workspace-open`,onSelect:()=>P(c.openAddWorkspace),children:`Create workspace`}),c.createGeneralSession?D(Z,{"data-testid":`new-session-open`,onSelect:()=>P(c.createGeneralSession),children:`Create session`}):null,c.addCoordinator?w.map(e=>D(Z,{"data-testid":e.hostId?`coordinator-create-${e.hostId}`:`coordinator-create`,onSelect:()=>F(`Could not add a bot`,()=>c.addCoordinator?.(void 0,e.hostId)),children:w.length>1?`Create bot on ${e.label}`:`Create bot`},e.hostId??`local`)):null]})]})]}),C?L(`div`,{className:`flex flex-col items-center gap-3 px-6 py-8 text-center`,children:[D(`p`,{className:`text-base font-semibold text-po-hi`,children:`Nothing here yet`}),D(`p`,{className:`text-sm text-po-dim`,children:`Add a folder for Po to work in. Each session opens in its own window.`}),L(t,{variant:`primary`,size:`md`,className:`gap-1.5 rounded-full px-4`,onClick:()=>P(c.openAddWorkspace),children:[D(Ye,{className:`size-4`}),`Add workspace`]}),c.createGeneralSession?D(t,{variant:`ghost`,size:`sm`,onClick:()=>P(c.createGeneralSession),children:`Start a session without a folder`}):null]}):O===`sessions`?M.map(e=>L(`div`,{"data-testid":`session-timeline-${e.key}`,className:`flex flex-col`,children:[D(`h3`,{className:`pt-1 pr-2 pb-1 pl-3 text-sm font-semibold text-po-dim`,children:e.title}),e.data.map(({session:e,workspace:t,workspaceName:n})=>I(e,t,n))]},e.key)):S.map(e=>L(`div`,{className:`flex flex-col`,children:[e.kind===`session`?null:D(cr,{workspace:e,actions:c,act:P,onDialog:e=>P(()=>N(e)),onAddCoordinator:()=>F(`Could not add a bot`,()=>c.addCoordinator?.(e.id))}),e.kind!==`session`&&!e.available?D(`p`,{className:`px-3 pb-1 text-sm text-po-red`,children:`Workspace unavailable`}):null,e.sessions.map(t=>I(t,e)),e.sessions.length===0?D(`p`,{className:`px-3 py-1 text-sm text-po-dim`,children:`No sessions yet.`}):null]},e.id)),f===``&&!C&&O===`sessions`&&M.length===0?D(`p`,{className:`px-3 py-1 text-sm text-po-dim`,children:`No sessions yet.`}):null,f!==``&&S.length===0?L(`p`,{className:`px-3 py-2 text-sm text-po-dim`,children:[`No session matches “`,u.trim(),`”.`]}):null]}),L(`footer`,{className:`flex items-center gap-2 border-t border-po-border-soft bg-po-rail/50 px-4 py-3`,children:[D(Kn,{profile:E,className:`size-8`}),L(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[D(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:E?.label??`Default profile`}),D(`span`,{className:`truncate text-sm text-po-dim`,children:T?`Working in ${T.name}`:`No session focused`})]}),C?null:D(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Add workspace`,title:`Add workspace`,onClick:()=>P(c.openAddWorkspace),className:`rounded-full text-po-dim`,children:D(Ye,{className:`size-4`})}),D(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Settings`,title:`Settings`,"data-testid":`desktop-menu-settings`,onClick:()=>P(c.openSettings),className:`rounded-full text-po-dim`,children:D(Ae,{className:`size-4`})})]})]})}function dr({face:e,ownsScroll:t,overlay:n,children:r}){let i=e.icon;return D(`aside`,{"data-po-region":`activity`,"data-testid":`desktop-rail-${e.id}`,"aria-label":e.label,className:`flex w-[22rem] max-w-[calc(100%-1.5rem)] shrink-0 flex-col py-3 pr-3 pl-2 ${n?`absolute inset-y-0 right-0 z-[60] pl-3`:``}`,children:L(`section`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl shadow-sm ${zn}`,children:[L(`header`,{className:`flex h-11 shrink-0 items-center gap-2 px-4`,children:[D(i,{"aria-hidden":!0,className:`size-4 text-po-dim`}),D(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:e.label}),D(`span`,{className:`flex-1`}),e.badge>0?L(`span`,{className:`shrink-0 text-sm text-po-dim`,children:[e.badge,` new`]}):null]}),D(`div`,{className:`flex min-h-0 flex-1 flex-col ${t?``:`overflow-y-auto overscroll-contain`}`,children:r})]})})}var fr=16;function pr({side:e,open:t,label:n,defaultWidth:r,minWidth:i,maxWidth:a,testId:o,region:s,fixed:c=!1,children:l}){let[u,d]=X(r),[f,p]=X(!1),[m,h]=X(t);t&&!m&&h(!0);let g=e=>Math.round(Math.min(a,Math.max(i,e))),_=e===`right`?-1:1;return D(`aside`,{"aria-label":n,"aria-hidden":!t,inert:!t,"data-testid":o,"data-open":t,"data-po-region":s,style:{"--sheet-width":`${u}px`},className:`relative flex shrink-0 flex-col overflow-hidden bg-po-bg motion-reduce:transition-none max-md:absolute max-md:inset-y-0 max-md:z-30 ${e===`right`?`items-end max-md:right-0`:`items-start max-md:left-0`} ${f?``:`transition-[width] duration-200 ease-out`} ${t?`max-md:w-full md:w-(--sheet-width)`:`w-0`}`,children:L(`div`,{className:`relative flex h-full shrink-0 flex-col border-po-border-soft max-md:w-screen md:w-(--sheet-width) ${c?``:e===`right`?`border-l`:`border-r`}`,children:[c?null:D(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize ${n.toLowerCase()}`,"aria-valuenow":u,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:e=>{let t=e.currentTarget,n=e.clientX;t.setPointerCapture(e.pointerId),p(!0);let r=e=>d(g(u+_*(e.clientX-n))),i=()=>{p(!1),t.removeEventListener(`pointermove`,r),t.removeEventListener(`pointerup`,i),t.removeEventListener(`pointercancel`,i)};t.addEventListener(`pointermove`,r),t.addEventListener(`pointerup`,i),t.addEventListener(`pointercancel`,i)},onKeyDown:e=>{let t=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0;t!==0&&(e.preventDefault(),d(g(u+_*t*fr)))},className:`absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none outline-none hover:bg-po-blue/20 focus-visible:bg-po-blue/30 max-md:hidden ${e===`right`?`left-0`:`right-0`}`}),m?l:null]})})}function mr(e,t){let n=[],r=[],i=()=>{r.length>0&&n.push({kind:`activity`,key:r[0].id,items:r}),r=[]};for(let a of e){let e=t(a);e!==`skip`&&(e===`activity`?r.push(a):(i(),n.push({kind:`entry`,entry:a})))}return i(),n}var hr=new z(null);function gr(){let e=B(J,e=>e.activeId),n=de(e),r=ht(e=>e.statuses),i=B(hr,e=>e),a=i!==null&&i.sessionId===e,[o,s]=X(i);return a&&i!==o&&s(i),L(pr,{side:`right`,open:a,label:`Activity`,defaultWidth:384,minWidth:280,maxWidth:800,testId:`response-activity-sheet`,children:[L(`header`,{className:`flex shrink-0 items-center justify-between gap-2 px-4 pt-3 pb-2`,children:[D(`h2`,{className:`text-lg font-semibold text-po-hi`,children:`Activity`}),D(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Close activity`,onClick:()=>hr.setState(()=>null),children:D(se,{"aria-hidden":!0,className:`size-4`})})]}),D(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-4`,children:D(it,{className:`divide-y divide-po-border-soft rounded-none border-0`,children:(o?.items??[]).map(e=>D(`div`,{className:`py-1.5`,children:e.kind===`tool`?D(T,{entry:e,slotProps:n,statuses:r,suppressOutputs:!0}):D(`p`,{className:`py-1 text-sm text-po-dim`,children:e.text})},e.id))})})]})}var _r=new z({});function vr(e,t){if(!e||!t)return;let n=e.querySelector(`[data-output-id="${CSS.escape(t.id)}"] [data-viewable-image] img`);if(!n)return;let r={kind:`image`,title:t.title,url:n.src};_r.setState(e=>e[t.id]?.url===r.url?e:{...e,[t.id]:r})}function yr({review:e,picture:t,onClose:n}){return e(t,n)}function br({items:e,review:n,initialOutput:r=0,initiallyExpanded:i=!1}){let[a,o]=X(r>0?e[r]?.id:void 0),[s,c]=X(i),l=F(null),d=F(null),f=Math.max(0,e.findIndex(e=>e.id===a)),p=e[f],m=B(_r,e=>p===void 0?void 0:e[p.id]);if(w(()=>{let t=l.current;i&&t&&(vr(d.current,e[r]),t.close(),t.showModal())},[i]),!p)return null;let h=()=>{let e=l.current;e&&!s&&(vr(d.current,p),e.close(),e.showModal(),c(!0))},g=t=>{let n=e[t];s&&vr(d.current,n),o(n.id)},_=()=>l.current?.close();return D(`section`,{"aria-label":`Response outputs`,"aria-roledescription":`carousel`,className:`mt-5 overflow-hidden rounded-lg border border-po-border-soft bg-po-panel`,children:L(`dialog`,{ref:l,open:!0,role:s?`dialog`:`group`,"aria-label":s?`Response outputs`:`Output previews`,"aria-modal":s,className:s?`fixed inset-3 m-0 flex h-[calc(100dvh-24px)] w-[calc(100vw-24px)] max-h-none max-w-none flex-col overflow-hidden rounded-lg border border-po-border bg-po-panel p-0 text-po-text shadow-2xl backdrop:bg-po-deep/70`:`static m-0 w-full max-w-none border-0 bg-po-panel p-0 text-po-text`,onClose:e=>{e.currentTarget.open||(e.currentTarget.show(),c(!1))},children:[L(`div`,{className:`flex items-center justify-between gap-2 border-b border-po-border-soft px-4 py-2`,children:[D(`h2`,{className:`text-base font-semibold text-po-hi`,children:s?`Response outputs`:`Outputs`}),D(t,{variant:`ghost`,size:`sm`,"aria-label":s?`Close outputs`:`Expand outputs`,onClick:s?_:h,children:s?D(se,{"aria-hidden":!0,className:`size-4`}):`Expand outputs`})]}),s&&m?D(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:D(pe,{media:m,action:n?D(yr,{review:n,picture:m,onClose:_}):void 0},m.url)}):null,D(`div`,{ref:d,className:s&&m?`hidden`:s?`min-h-0 flex-1 overflow-auto`:`max-h-64 min-h-32 overflow-auto`,children:e.map((e,t)=>D(`div`,{"data-output-id":e.id,hidden:t!==f,className:t===f?`flex min-h-full flex-col items-center justify-center p-3 *:self-center`:`hidden`,onClickCapture:s?void 0:e=>{e.target.closest(`[data-viewable-image]`)&&(e.stopPropagation(),h())},children:e.content},e.id))}),L(`div`,{role:`group`,"aria-label":`Output navigation`,className:`flex items-center gap-2 border-t border-po-border-soft px-3 py-2`,children:[D(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Previous output`,disabled:f===0,onClick:()=>g(f-1),children:D(u,{"aria-hidden":!0,className:`size-4 rotate-180`})}),L(`output`,{"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-center text-sm text-po-dim`,children:[f+1,` of `,e.length,` · `,p.title]}),D(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Next output`,disabled:f===e.length-1,onClick:()=>g(f+1),children:D(u,{"aria-hidden":!0,className:`size-4`})})]})]})})}var xr=`Po is working`;function Sr(e){return e.kind===`settled`||e.kind===`assistant`&&!e.text.trim()?`skip`:e.kind===`tool`||e.kind===`notice`&&e.tone===`info`?`activity`:`entry`}function Cr({turn:e,sessionId:t,slotProps:n,statuses:r,renderEntry:i,dense:a=!1}){let o=mr(e.sequence,Sr),s=e.sequence.filter(e=>e.kind===`tool`),c=o.filter(e=>e.kind===`activity`),l=c.at(-1),u=!e.settled||s.some(e=>e.running),d=s.at(-1)?.isError===!0,f=B(hr,e=>e?.sessionId===t?e.key:null);w(()=>{let e=c.find(e=>e.key===f);e&&hr.setState(()=>({sessionId:t,key:e.key,items:e.items}))});let p=e=>e.flatMap(e=>e.kind===`tool`?U(e,n,r):[]).reverse();return L(`div`,{"data-testid":`quiet-turn`,"data-turn-id":e.id,className:`flex flex-col gap-5`,children:[o.map(e=>e.kind===`entry`?D(ve,{children:i(e.entry)},e.entry.id):L(ve,{children:[D(Er,{dense:a,items:e.items,open:f===e.key,working:e.items.some(e=>e.kind===`tool`&&e.running)||u&&e===l,ended:d&&!u&&e===l,onToggle:()=>hr.setState(()=>f===e.key?null:{sessionId:t,key:e.key,items:e.items})}),D(wr,{dense:a,items:p(e.items),review:It(n)})]},e.key)),u&&o.at(-1)?.kind!==`activity`?D(`div`,{className:a?`flex min-h-8 items-center`:`ml-12 flex min-h-8 items-center`,children:D(`span`,{className:`ml-auto px-2.5`,children:D(R,{label:xr,className:`size-3.5 text-po-green`})})}):null]})}function wr({dense:e,...t}){return t.items.length===0?null:D(`div`,{className:e?`min-w-0`:`ml-12 min-w-0`,children:D(br,{...t})})}var Tr={bash:P,grep:k,find:k,ls:Ye,read:Ve,edit:xt,write:xt,exec:Pe,web_search:At,web_fetch:At};function Er({items:e,open:n,working:r,ended:i,onToggle:a,dense:o=!1}){let s=e.filter(e=>e.kind===`tool`),c=[...new Set(s.map(e=>e.name))],l=s.filter(e=>e.isError).length,d=s.length>0?`${s.length} tool${s.length===1?``:`s`} · ${c.join(`, `)}`:`Activity`;return L(`div`,{"data-testid":`activity-row`,className:o?`min-w-0 text-sm text-po-dim`:`ml-12 min-w-0 text-sm text-po-dim`,children:[i?L(`span`,{className:`flex items-center gap-1.5 px-2.5 text-po-red`,children:[D(Tt,{"aria-hidden":!0,className:`size-3.5`}),`Turn ended`]}):null,L(t,{variant:`ghost`,size:`sm`,className:`min-h-8 w-full min-w-0 justify-start gap-2 text-left font-normal`,"aria-label":`View activity, ${d}${l>0?`, ${l} failed`:``}`,"aria-expanded":n,"aria-busy":r,onClick:a,title:d,children:[D(`span`,{"aria-hidden":!0,className:`flex shrink-0 items-center gap-2`,children:c.slice(0,3).map(e=>{let t=Object.hasOwn(Tr,e)?Tr[e]:dt;return D(t,{className:`size-3.5`},e)})}),D(`span`,{className:`min-w-0 flex-1 truncate`,children:d}),r?D(R,{label:xr,className:`size-3.5 text-po-green`}):null,l>0?L(`span`,{className:`flex shrink-0 items-center gap-1 text-po-red`,children:[D(Tt,{"aria-hidden":!0,className:`size-3.5`}),l,` failed`]}):null,D(u,{"aria-hidden":!0,className:`size-3.5`})]})]})}var Dr=`flex h-8 shrink-0 items-center rounded-lg px-3 text-base focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,Or=`bg-po-rail font-semibold text-po-hi`,kr=`font-medium text-po-dim hover:bg-po-rail/60`;function Ar(){return 0}function jr(){return!0}function Mr({tab:e,sessionId:t,active:n}){let r=(e.useBadge??Ar)(t);return!(e.useVisible??jr)(t)&&!n?null:L(wt,{to:`/session/$sessionId/$tabId`,params:{sessionId:t,tabId:e.id},"data-testid":`tab-${e.id}`,"aria-current":n?`page`:void 0,className:`${Dr} gap-1.5 ${n?Or:kr}`,children:[e.label,r>0?D(`span`,{className:`rounded-full bg-po-panel px-1.5 text-sm text-po-dim`,children:r}):null]})}function Nr({tab:e,sessionId:t,active:n,onOpenInWindow:r}){let i=`grid size-6 place-items-center rounded-full text-po-dim hover:bg-po-panel hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`;return L(`span`,{"data-testid":`tab-${e.id}-chip`,className:`flex h-8 shrink-0 items-center gap-0.5 rounded-lg pr-1 ${n?Or:kr}`,children:[D(wt,{to:`/session/$sessionId/$tabId`,params:{sessionId:t,tabId:e.id},"data-testid":`tab-${e.id}`,title:e.label,"aria-current":n?`page`:void 0,className:`max-w-40 truncate rounded-lg py-1 pr-1 pl-3 focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:e.label}),n?D(`button`,{type:`button`,"aria-label":`Open ${e.label} in its own window`,title:`Open ${e.label} in its own window`,onClick:r,className:i,children:D(we,{"aria-hidden":!0,className:`size-3`})}):null,D(`button`,{type:`button`,"aria-label":`Close ${e.label}`,title:`Close ${e.label}`,"data-testid":`tab-${e.id}-close`,onClick:()=>he(t,e.id),className:i,children:D(se,{"aria-hidden":!0,className:`size-3`})})]})}var Pr=`px-[max(1rem,calc((100%-896px)/2))]`,Fr=Bt(function({sessionId:e,tabId:n,windowedTabs:r,onOpenInWindow:i,narrow:a,conversationShown:o,onAskPo:s}){let l=r===``?[]:r.split(`
|
|
2
|
-
`),u=de(e),d=n!==void 0&&l.includes(n)?void 0:n,f=B(J,e=>e.transferringToId===null?null:e.byId[e.transferringToId]?.summary.name??`destination session`),p=at()?.summary.dormant===!0,g=c(e).filter(e=>!l.includes(e.id)),v=m(e),y=B(Ot,t=>gt(t,e,d)),b=y===void 0?void 0:ce(e).map(e=>e.transientTab?.()).find(e=>e?.id===y.id)??y,x=(d===void 0?void 0:v.find(e=>e.id===d))??b,S=x===b?b?.composerContext:void 0,C=x!==void 0&&x===b&&b.retainComposer===!0&&b.composerAside===!0,w=x?.id??`conversation`,T=v.length>0||g.length>0,[E,O]=X(!1),k=(!x||x.targetSessionId!==void 0)&&!p,A=!C&&(!x||x.retainComposer===!0),j=E&&k&&A,M=x&&C?D(lt,{narrow:a,conversationShown:o,onOpenRail:s,conversation:D(Le,{label:x.label,renderTurn:Cr,composer:D(I,{composerContext:S,quiet:!0})}),children:D(x.panel,{...u})},x.id):x?D(x.panel,{...u}):D(h,{renderTurn:Cr,showThinking:!1,scrollerClassName:Pr}),N=A?D(I,{composerContext:S,quiet:!0,toolbar:k?D(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Session settings`,title:`Session settings`,"aria-expanded":E,"data-testid":`session-settings-open`,onClick:()=>O(!E),className:E?`text-po-hi`:`text-po-dim`,children:D(Ae,{"aria-hidden":!0,className:`size-4`})}):void 0}):null,P=k&&!A?D(H,{}):null;return L(_,{children:[T?L(`nav`,{"aria-label":`Conversation views`,className:`hidden shrink-0 items-center gap-1 overflow-x-auto px-3 pb-2 has-[>:nth-child(2)]:flex`,children:[D(wt,{to:`/session/$sessionId`,params:{sessionId:e},"data-testid":`tab-conversation`,"aria-current":w===`conversation`?`page`:void 0,className:`${Dr} ${w===`conversation`?Or:kr}`,children:`Chat`}),v.map(t=>D(Mr,{tab:t,sessionId:e,active:w===t.id},t.id)),g.map(t=>D(Nr,{tab:t,sessionId:e,active:w===t.id,onOpenInWindow:()=>i(e,t.id)},t.id))]}):null,f===null?null:L(`output`,{"data-testid":`voice-transfer-transition`,className:`border-y 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 `,f,`...`]}),D(Lr,{sessionId:e}),L(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[L(`div`,{"data-po-region":`content`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[M,L(`div`,{className:x?`shrink-0`:`mx-auto w-full max-w-[960px] shrink-0 px-2 sm:px-6`,children:[N===null?null:D(`div`,{className:`mb-2 sm:mb-4`,children:N}),P]})]}),x?null:D(gr,{}),j?D(pr,{side:`right`,open:!0,label:`Session`,defaultWidth:360,minWidth:360,maxWidth:360,fixed:!0,testId:`session-settings-sheet`,region:`settings`,children:D(tt,{onClose:()=>O(!1)})}):null]})]})}),Ir=Bt(function({sessionId:e}){return L(_,{children:[D(Lr,{sessionId:e}),D(`div`,{className:`mx-auto flex min-h-0 w-full max-w-[960px] flex-1 flex-col overflow-hidden px-2 sm:px-4`,children:D(r,{sessionId:e,watch:me,renderTurn:Cr,showThinking:!1})}),D(`p`,{className:`shrink-0 px-6 pb-4 text-center text-sm text-po-dim`,children:`Click to focus and reply`})]})});function Lr({sessionId:e}){return D(`div`,{className:`mx-auto w-full max-w-[960px] shrink-0 px-2 pb-2 empty:hidden sm:px-6`,children:D(kt,{slot:ae.conversationStrip,sessionId:e})})}var Rr=Bt(function({sessionId:e,tabId:t,focused:n}){let r=de(e),i=B(Ot,n=>gt(n,e,t)),a=B(J,e=>e.activeId);if(i===void 0)return null;let o=i.panel,s=i.retainComposer===!0&&n&&a===e;return L(`div`,{"data-po-region":`content`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[D(o,{...r}),s?D(I,{composerContext:i.composerContext}):null]})});function zr({isSignedInWorkerOrigin:e=!1,accountSettings:t,homeHosts:n,hostManagement:r=`unavailable`}={}){Pt();let{section:i,workspaceId:a}=qe(),o=ot(),[s,c]=X(),[l,u]=X(!1),[d,f]=Me(`settings/template-target`,`global`),p=r===`available`,m=Ct(i,e,{canManageHosts:p}),h=m?.workspace??(i?.startsWith(`repository-`)?`repository`:`general`);return w(()=>{if(m||i===`hosts`&&r===`loading`||h===`repository`&&!l)return;let t=!1;return Ue().then(()=>{if(t||Ct(i,e,{canManageHosts:p}))return;let n=Se(i);o(n===void 0?{to:`/settings/$section`,params:{section:ct},search:{workspace:a},replace:!0}:{to:`/plugins/$pluginId`,params:{pluginId:n},search:{workspace:a},hash:`settings`,replace:!0})}).catch(e=>{t||c(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[m,i,o,h,a,l,r,p,e]),L(`div`,{"data-testid":`settings`,"data-po-region":`content`,className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[D(`header`,{className:`flex shrink-0 justify-center border-b border-po-border-soft px-3 pb-2`,children:L(`nav`,{className:`flex w-full items-center gap-1 rounded-lg bg-po-rail p-1 sm:w-auto`,"aria-label":`settings workspace`,children:[D(Ie,{asChild:!0,active:h===`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":h===`general`?`true`:void 0,children:D(wt,{to:`/settings/$section`,params:{section:ct},search:{workspace:a},"data-testid":`settings-workspace-general`,children:`General`})}),D(Ie,{asChild:!0,active:h===`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":h===`repository`?`true`:void 0,children:D(wt,{to:`/settings/$section`,params:{section:Ee},search:{workspace:a},"data-testid":`settings-workspace-repository`,children:`Workspaces`})})]})}),D(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:h===`repository`?D(Mt,{current:m??{id:i??``,label:``,detail:``,workspace:`repository`},initialRepositoryId:a,onRepositoryChange:e=>{o({to:`/settings/$section`,params:{section:m?.id??i??Ee},search:{workspace:e},replace:!0})},onReady:u},a??`remembered-workspace`):L(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[D($e,{hosts:n,isSignedInWorkerOrigin:e,canManageHosts:p,active:m?.id,workspace:`general`,repositoryId:a}),D(`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:L(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-8`,children:[!m&&s?D(`p`,{role:`alert`,children:s}):null,i===`hosts`&&r===`loading`?D(`p`,{role:`status`,children:`Checking host access…`}):null,m?.id===`hosts`?D(We,{}):null,m?.id===`account-preferences`?t??D(`p`,{children:`Account settings are read-only on this host.`}):null,m?.id===`providers`?D(le,{}):null,m?.id===`devices`?D(Ft,{}):null,m?.id===`appearance`?D(Je,{templateTarget:d,onTemplateTargetChange:f}):null,m?.id===`notifications`?D(Ke,{}):null,m?.id===`images`?D(pt,{}):null,m?.id===`presets`?D(Fe,{}):null,m?.id===`account`?D(vt,{}):null,m?.contribution===void 0?null:D(Ne,{section:m.contribution,scope:`host`}),m?.panel===void 0?null:D(ee,{panel:m.panel})]})})]})})]})}function Br(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Vr({group:t,slotProps:n,editing:r,expanded:i,onRemove:a,onToggle:o}){let s=ze(e(t.name)).length>0,c=t.collapsible!==!1,l=s&&(!c||i),d=t.icon??ge,f=Br(t.name),p=t.summary||(t.active?`Working`:s?null:`Idle`),m=L(`span`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium text-po-dim`,children:[D(d,{"aria-hidden":!0,className:`size-3.5 shrink-0 ${t.active?`text-po-yellow`:``}`}),D(`span`,{className:`truncate`,children:f})]});return L(`section`,{"aria-label":f,"data-testid":`desktop-widget-${t.name}`,"data-active":t.active,className:`relative flex shrink-0 flex-col gap-2 rounded-2xl px-4 py-3.5 shadow-sm ${zn}`,children:[r?D(`button`,{type:`button`,"aria-label":`Remove ${f}`,onClick:a,className:`absolute -top-1.5 -left-1.5 grid size-5 place-items-center rounded-full bg-po-panel text-po-dim shadow-md ring-1 ring-po-border hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:D(`span`,{"aria-hidden":!0,className:`h-px w-2.5 bg-current`})}):null,L(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[t.transientTab===void 0?m:L(`button`,{type:`button`,title:`Open ${t.name}`,onClick:()=>{let e=t.transientTab?.();e!==void 0&&n.openTransientTab(e)},className:`group/heading flex min-w-0 items-center gap-1 text-left focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:[m,D(u,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-po-faint group-hover/heading:text-po-dim`})]}),s&&c?D(`button`,{type:`button`,"aria-expanded":l,"aria-label":l?`Fold ${f}`:`Unfold ${f}`,title:l?`Show less`:`Show more`,"data-testid":`desktop-widget-toggle-${t.name}`,onClick:o,className:`grid size-6 shrink-0 place-items-center rounded-full text-po-dim hover:bg-po-rail hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:D(fe,{"aria-hidden":!0,className:`size-3.5 transition-transform ${l?`rotate-180`:``}`})}):null]}),l?n.renderSlot(e(t.name)):p===null?null:D(`p`,{"data-testid":`desktop-widget-summary-${t.name}`,className:`truncate text-base first-letter:uppercase ${t.active?`text-po-yellow`:`text-po-hi`}`,children:p})]})}function Hr({layout:e,activeId:n,editing:r,overlay:a,onEditingChange:o,onRemove:s,onAdd:c,onToggleExpanded:l}){let u=ht(e=>e.statuses),d=ht(e=>e.widgets),f=Xe(u,d,n),p=de(n),m=f.map(e=>e.name),h=Sn(e,m),g=h.flatMap(e=>f.filter(t=>t.name===e)),_=f.filter(e=>!h.includes(e.name));return L(`aside`,{"data-po-region":`activity`,"data-testid":`desktop-widgets`,"aria-label":`Activity`,className:`my-1.5 flex min-h-0 w-72 shrink-0 flex-col gap-3 overflow-y-auto overscroll-contain py-1.5 pr-3 pl-2 [scrollbar-width:thin] ${a?`absolute inset-y-0 right-0 z-[60] pl-3`:``}`,children:[g.map(t=>D(Vr,{group:t,slotProps:p,editing:r,expanded:e.expanded.includes(t.name),onRemove:()=>s(t.name,m),onToggle:()=>l(t.name)},t.name)),g.length===0&&!r?D(`p`,{className:`rounded-2xl px-4 py-3.5 text-sm text-po-dim ${zn}`,children:f.length===0?`Nothing supervised yet.`:`No widgets chosen.`}):null,r?L(`div`,{className:`flex flex-col gap-0.5 rounded-2xl p-2 ${zn}`,children:[D(`span`,{className:`px-2 pt-1 pb-1 text-sm font-medium text-po-dim`,children:`Add a widget`}),_.map(e=>{let t=e.icon??ge;return L(`button`,{type:`button`,onClick:()=>c(e.name,m),className:`flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left text-base font-medium text-po-text hover:bg-po-rail focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none`,children:[D(t,{"aria-hidden":!0,className:`size-4 text-po-dim`}),D(`span`,{className:`flex-1`,children:Br(e.name)}),D(Y,{"aria-hidden":!0,className:`size-3.5 text-po-dim`})]},e.name)}),_.length===0?D(`span`,{className:`px-2 pb-1 text-sm text-po-dim`,children:`Every widget is showing.`}):null]}):null,L(t,{variant:r?`primary`:`ghost`,size:`sm`,onClick:()=>o(!r),className:`shrink-0 gap-1.5 self-center rounded-full ${r?`px-5`:`text-po-dim`}`,children:[r?null:D(i,{className:`size-3.5`}),r?`Done`:`Customise`]})]})}var Ur={thread:(e,t,n)=>D(oe,{sessionId:e,threadId:t,options:n}),activity:(e,t)=>D(p,{sessionId:e,onOpenConversation:t}),transcript:(e,t)=>D(r,{sessionId:e,options:t,watch:me})},Wr=768;function Gr(){try{return kn(window.localStorage.getItem(Vt))}catch{return Ht}}function Kr(){let[e,t]=X({width:0,height:0});return[o(e=>{if(e===null)return;let n=()=>t({width:e.clientWidth,height:e.clientHeight});n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[]),e]}function qr(){return D(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 bg-po-deep [[data-po-backdrop]_&]:hidden`})}function Jr(e,t,n){if(e===`session`&&t!==void 0)return{id:Xt(t),kind:`session`,sessionId:t};if(e===`settings`)return{id:`settings`,kind:`settings`};if(e===`page`||e===`workspace`&&n!==void 0)return{id:`page`,kind:`page`}}function Yr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Xr({isSignedInWorkerOrigin:e=!1,accountSettings:t,homeHosts:n,hostManagement:r}={}){Pt();let i=qe(),c=ot(),u=B(J,e=>e.activeId),d=B(J,e=>e.hydrated),f=B(J,e=>Object.keys(e.byId).join(`
|
|
3
|
-
`)),p=B(Ot),[m,h]=X(!1),[g,_]=X(null),[v,y]=X(!1),[b,C]=X(!1),[T,k]=X(null),[A,M]=Me(`desktop/layout`,Gr),N=S({onDismiss:()=>h(!1)}),[P,F]=Kr(),[ee,R]=Kr(),z=F.width>0&&F.width<Wr,ie=Jr(i.kind,i.sessionId,i.workspaceId),oe=x(()=>new Set(f.split(`
|
|
4
|
-
`).filter(Boolean)),[f]),se=B(J,e=>Object.values(e.byId).flatMap(({summary:e})=>e.sessionProvenance===`workflow`&&e.parentSessionId!==void 0?[`${e.id} ${e.parentSessionId}`]:[]).join(`
|
|
5
|
-
`)),ce=x(()=>new Map(se.split(`
|
|
6
|
-
`).filter(Boolean).map(e=>e.split(` `))),[se]),V=xn(A,ie,d?{sessionIds:oe,tabOpen:(e,t)=>gt(p,e,t)!==void 0,stepParent:e=>ce.get(e)}:void 0);w(()=>{V!==A&&M(V)},[V,A,M]);let le=ye(`navigation/sessionFallback`,void 0);xe(()=>{let e=A.z.slice().reverse().map(e=>$(A,e)).filter(e=>e?.kind===`session`);return le.setState(()=>e.sort((e,t)=>Number(e.minimized===!0)-Number(t.minimized===!0)).map(e=>e.sessionId)),()=>le.setState(()=>void 0)},[A,le]),w(()=>{try{window.localStorage.setItem(Vt,An(A))}catch{return}},[A]);let{kind:ue,sessionId:H,tabId:fe,pageId:pe,workspaceId:me}=i;w(()=>{let e=Jr(ue,H,me);e!==void 0&&M(t=>{let n=an(on(t,e),e.id),r=H!==void 0&&fe!==void 0?Zt(H,fe):void 0;return r!==void 0&&$(n,r)!==void 0?rn(n,r):n})},[ue,H,fe,pe,me,M]);let U=e=>M(e),ve=o((e,t)=>{M(n=>on(n,{id:Zt(e,t),kind:`tab`,sessionId:e,tabId:t})),c({to:`/session/$sessionId`,params:{sessionId:e}})},[c,M]),be=o(()=>{ft(u,`conversation`),M(e=>e.activityHidden?{...e,activityHidden:!1}:e)},[u,M]),Se=e=>{U(t=>rn(t,e.id)),(e.kind===`session`||e.kind===`tab`)&&e.sessionId!==void 0&&e.sessionId!==u&&N.actions.openSession(e.sessionId)},Ce=()=>{u!==null&&i.kind!==`session`?c({to:`/session/$sessionId`,params:{sessionId:u}}):N.actions.openHome()},we=e=>{e.kind===`settings`||e.kind===`page`?Ce():(e.kind===`tab`&&e.sessionId!==void 0&&e.tabId!==void 0&&he(e.sessionId,e.tabId),e.kind===`session`&&e.sessionId===i.sessionId?c({to:`/`}).then(()=>U(t=>sn(t,e.id))):U(t=>sn(t,e.id)))},W=$t(V),Ee=en(V),De=Ee===void 0?void 0:Q(Ee),G=e=>{if(e.kind===`settings`)return{title:`Settings`};if(e.kind===`page`){let e=N.workspaces.find(e=>e.id===i.workspaceId);return{title:i.pageId===void 0?e?.name??`Workspace`:Yr(i.pageId)}}let t=N.workspaces.find(t=>t.sessions.some(t=>t.id===e.sessionId)),n=t?.sessions.find(t=>t.id===e.sessionId),r=n?.name||(e.sessionId===void 0?``:J.state.byId[e.sessionId]?.summary.name);if(e.kind===`tab`)return{title:gt(p,e.sessionId,e.tabId)?.label??`Tab`,subtitle:r||void 0};let a=[t?.kind===`session`?void 0:t?.name,n?.git?.branch].filter(Boolean).join(` · `);return{title:r||`Untitled`,subtitle:e.sessionId===u?a||void 0:`read only`}},Oe=(o,s)=>{if(o.kind===`settings`)return D(zr,{homeHosts:n,isSignedInWorkerOrigin:e,hostManagement:r,accountSettings:t});if(o.kind===`page`)return i.pageId===void 0?i.workspaceId===void 0?null:D(a,{workspaceId:i.workspaceId,onShowSessions:()=>h(!0)}):L(ke,{pageId:i.pageId,sessionId:null,workspaceId:i.workspaceId,onShowSessions:()=>h(!0),children:[i.pageId===O?D(Lt,{workspaceId:i.workspaceId,pluginId:i.pluginId}):null,i.pageId===Te?D(ne,{}):null]});if(o.sessionId===void 0)return null;if(o.kind===`tab`)return o.tabId===void 0?null:D(Rr,{sessionId:o.sessionId,tabId:o.tabId,focused:s});if(o.sessionId!==u)return o.minimized===!0?null:D(Ir,{sessionId:o.sessionId});let c=o.sessionId,l=V.windows.filter(e=>e.kind===`tab`&&e.sessionId===c).map(e=>e.tabId).join(`
|
|
7
|
-
`);return D(Fr,{sessionId:c,tabId:i.sessionId===c?i.tabId:void 0,windowedTabs:l,onOpenInWindow:ve,narrow:z,conversationShown:it,onAskPo:be})},Ae=e=>e===void 0?void 0:N.workspaces.flatMap(e=>e.sessions).find(t=>t.id===e),je=W.map(e=>{let t=e.members[e.members.length-1],n=$(V,e.root)??t,r={root:e.root,kind:t.kind,size:e.members.length,focused:e.root===De},i=t.minimized===!0,a=e.members.length>1?`${e.members.length} windows stacked, click again to swap`:void 0,o=N.workspaces.find(e=>e.sessions.some(e=>e.id===n.sessionId)),s=o?.sessions.find(e=>e.id===n.sessionId);if(s===void 0)return{...r,minimized:i,label:G(t).title,details:[a].filter(e=>e!==void 0)};let c=[...new Set(e.members.map(e=>e.sessionId))].flatMap(e=>{let t=Ae(e);return t===void 0?[]:[t]}),l=[o?.kind===`session`?void 0:o?.name,s.git?`${s.git.branch}${s.git.dirty?`, changed`:``}`:void 0].filter(Boolean).join(` · `),d=c.reduce((e,t)=>e+(t.waitingCount??0),0),f=[t.id===n.id?void 0:`Showing ${G(t).title}`,l||void 0,d>0?`${d} waiting for you`:void 0,t.sessionId===u?void 0:`Read only, click to focus and reply`,i?`Minimized`:void 0,a];return{...r,minimized:i,label:s.name||`Untitled`,profile:s.profile,running:c.some(er),waiting:d,status:s.status,clock:s.clock,details:f.filter(e=>e!==void 0)}}),Ne=e=>{let t=W.find(t=>t.root===e);if(t===void 0)return;let n=t.members[t.members.length-1];if(e!==De||n.minimized===!0)Se(n);else if(t.members.length>1){let n=t.members[t.members.length-2];U(t=>cn(t,e)),n.sessionId!==void 0&&n.sessionId!==u&&N.actions.openSession(n.sessionId)}else U(t=>pn(t,e))},Pe=N.workspaces.flatMap(e=>e.sessions),Fe=e=>e.reduce((e,t)=>e+(t.waitingCount??+!!t.awaitingInput),0),Ie=Fe(Pe),Re=new Set(W.flatMap(e=>e.members.map(e=>e.sessionId))),ze=Pe.filter(e=>!Re.has(e.id)),Ve=z?b:!V.activityHidden,K=H===u?gt(p,H,fe):void 0,q=K!==void 0&&K.retainComposer===!0&&K.composerAside===!0&&u!==null&&$(V,Zt(u,K.id))===void 0?K:void 0,Ue=de(u),We=Rt(u).filter(e=>e.requiredMode===void 0||Ue.activeModes?.includes(e.requiredMode)),Ge=jt(We,u),Ke=B(J,e=>Dt(e.activeId===null?void 0:e.byId[e.activeId]?.summary)),Je=We.map(e=>({id:e.id,label:e.label,icon:e.icon??_e,badge:Ge[e.id]??0})),Ye=q!==void 0&&!z?Je.find(e=>e.id===q.asideFace):void 0,Xe=q===void 0?void 0:`Working on ${q.label}`,Qe=q!==void 0&&!z?[{id:`conversation`,label:`Conversation about ${q.label}`,icon:mt,badge:0,...Ye===void 0?{}:{group:Xe}}]:[],$e=[{id:`activity`,label:`Activity`,icon:ge,badge:Ke},...Ye===void 0?Qe:[],...Je.flatMap(e=>e===Ye?[{...e,group:Xe},...Qe]:[e]),{id:`context`,label:`Context`,icon:_e,badge:0}],et=B(He,e=>j(e,u)),Y=$e.some(e=>e.id===et)?et:`activity`,tt=$e.find(e=>e.id===Y),rt=We.find(e=>e.id===Y),it=Ve&&Y===`conversation`,at=V.windows.filter(e=>e.minimized!==!0),st=g!==null&&at.length===0,ct=()=>{if(st){U(e=>hn(e,g)),_(null);return}let{layout:e,hidden:t}=mn(V);U(()=>e),_(t)};return L(nt,{value:Ur,children:[L(`div`,{ref:P,"data-testid":`desktop`,className:`relative isolate flex h-full min-w-0 flex-col overflow-hidden font-sans text-po-text`,children:[D(qr,{}),L(`div`,{className:`relative flex min-h-0 flex-1`,children:[D(`main`,{"aria-label":`Desktop`,className:`relative isolate min-h-0 min-w-0 flex-1 p-1.5`,children:L(`div`,{ref:ee,"data-desktop-surface":!0,className:`relative h-full`,children:[N.workspaces.length===0?at.length===0?D(`p`,{className:`absolute inset-0 grid place-items-center px-6 text-center text-base text-po-dim`,children:`Open Po to add a folder to work in.`}):null:D(`div`,{"data-testid":`desktop-home-panel`,className:`absolute inset-0 flex overflow-hidden`,children:D(Be,{hosts:n,bare:!0,onShowSessions:()=>h(!0)})}),T===null?null:D(`div`,{"aria-hidden":!0,style:Vn(T),className:`absolute z-[55] p-1.5`,children:D(`div`,{className:`h-full rounded-2xl bg-po-panel/40 ring-2 ring-po-green backdrop-blur-sm animate-po-fade`})}),V.windows.map(e=>{let t=W.find(t=>t.root===Q(e))?.members??[],n=Ee?.id===e.id,{title:r,subtitle:i}=G(e),a=$(V,Q(e))??e,o=e.kind===`session`?e.sessionId:void 0;return D(Wn,{testId:`desktop-window-${e.id}`,title:r,subtitle:i,rect:nn(V,e.id,R.width),layer:V.z.indexOf(e.id),focused:n,minimized:e.minimized===!0,maximized:a.maximized===!0,stacked:t.length<2?`alone`:t[t.length-1]?.id===e.id?`top`:`under`,narrow:z,desktop:R,headerRegion:e.kind===`session`&&e.sessionId===u?`header`:void 0,onFocus:()=>Se(e),onClose:()=>we(e),onRename:o===void 0?void 0:()=>nr(o,r),onMinimize:()=>U(t=>pn(t,e.id)),onToggleMaximize:()=>U(t=>dn(t,e.id)),onPlace:t=>U(n=>un(n,e.id,t)),onResetPlace:()=>U(t=>fn(t,e.id)),onSnapPreview:k,children:Oe(e,n)},e.id)})]})}),Ve?Y===`activity`?D(Hr,{layout:V,activeId:u,editing:v,overlay:z,onEditingChange:y,onRemove:(e,t)=>U(n=>Cn(n,e,t)),onAdd:(e,t)=>U(n=>wn(n,e,t)),onToggleExpanded:e=>U(t=>Tn(t,e))}):Y===`conversation`&&q!==void 0&&tt!==void 0?D(dr,{face:tt,ownsScroll:!0,overlay:z,children:D(Le,{label:q.label,renderTurn:Cr,composer:D(I,{composerContext:q.composerContext,quiet:!0})})}):tt===void 0?null:D(dr,{face:tt,ownsScroll:rt?.ownsScroll===!0,overlay:z,children:rt===void 0?D(Ze,{}):D(rt.panel,{...Ue})}):null]}),L(te,{open:m,onOpenChange:h,children:[D(Xn,{menuOpen:m,menuTrigger:e=>D(zt,{asChild:!0,children:e}),stacks:je,waiting:Ie,menuWaiting:m?0:Fe(ze),menuRunning:ze.filter(er).length,faces:$e,face:Y,railShown:Ve,homeShown:st,onHome:ct,onStack:Ne,onFace:e=>{Ve&&e===Y?z?C(!1):U(e=>({...e,activityHidden:!0})):(ft(u,e),z?C(!0):U(e=>e.activityHidden?{...e,activityHidden:!1}:e))}}),D(E,{side:`top`,align:`start`,sideOffset:10,"aria-label":`Po`,className:`flex max-h-[min(40rem,calc(100vh-6rem))] w-[min(28rem,calc(100vw-1.5rem))] flex-col rounded-3xl border-0 shadow-2xl ${zn}`,children:D(ur,{rail:N,onHome:ct,onClose:()=>h(!1)})})]})]}),N.addWorkspace?D(Ln,{suggestedPaths:N.addWorkspace.suggestedPaths,actions:N.actions}):null,D(re,{}),D(lr,{actions:N.actions}),D(bt,{}),D(s,{}),D(l,{}),D(kt,{slot:ae.overlay,sessionId:u})]})}function Zr(){return L(`div`,{className:`flex size-full flex-col gap-1.5 bg-po-rail p-1.5`,children:[L(`div`,{className:`flex min-h-0 flex-1 gap-1.5`,children:[L(`div`,{className:`flex w-3/4 flex-col justify-between rounded-sm border border-po-border bg-po-panel p-1.5`,children:[L(`div`,{className:`flex flex-col gap-1`,children:[D(`span`,{className:`h-1 w-1/3 self-center rounded-full bg-po-dim`}),D(`span`,{className:`mt-0.5 h-1 w-1/2 self-end rounded-full bg-po-faint`}),D(`span`,{className:`h-1 w-2/3 rounded-full bg-po-faint`})]}),D(`span`,{className:`h-3 w-full rounded-sm border border-po-border bg-po-bg`})]}),D(`div`,{className:`flex flex-1 flex-col gap-1`,children:D(`span`,{className:`h-3 w-full rounded-sm border border-po-border bg-po-panel`})})]}),L(`div`,{className:`flex h-3 items-center gap-1 rounded-sm border border-po-border bg-po-panel px-1`,children:[D(`span`,{className:`size-1.5 rounded-full bg-po-dim`}),D(`span`,{className:`h-1.5 w-1/5 rounded-full bg-po-tint-green`})]})]})}var Qr={label:`Desktop`,description:`Po as a calm desktop: sessions in floating windows, a Po menu, and Activity widgets you choose.`,contractVersion:3,app:Xr,preview:Zr},$r=M(Qr),ei=M(Qr),ti=M(Qr),ni=(e,t)=>t===void 0?void 0:{...e,...t},ri=y({id:`template-desktop`,packageName:`@agimon-ai/po-template-desktop`,host:{get templates(){return[ni({id:`po-template-desktop`},$r)]}},workspace:{get templates(){return[ni({id:`po-template-desktop`},ei)]}},session:{get templates(){return[ni({id:`po-template-desktop`},ti)]}}});export{ri as webPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$i as e,$r as t,$t as n,A as r,B as i,Bt as a,C as o,D as s,Di as c,Dn as l,Dt as u,E as d,Et as f,F as p,Fn as m,Ft as h,G as g,Ga as _,Gi as v,H as y,Hn as b,Ht as x,I as S,It as C,J as w,Jn as T,Jr as E,K as D,Ka as O,Ki as k,Kr as A,Kt as j,L as M,Lt as N,M as P,Mr as F,N as ee,Nt as I,O as te,Ot as L,P as R,Pi as z,Pt as B,Q as ne,R as re,Rr as V,S as H,Si as ie,St as ae,T as oe,Ti as se,Tn as ce,Tt as le,V as ue,Vi as de,Vt as fe,Wi as U,X as W,Xi as G,Y as pe,Yi as K,Z as q,Za as me,Zi as J,_ as he,_a as ge,_t as Y,a as _e,ai as ve,at as ye,b as be,bn as xe,bt as Se,c as Ce,d as we,da as Te,dt as Ee,ea as De,et as Oe,f as ke,ft as Ae,g as je,ga as Me,gt as Ne,h as Pe,ha as Fe,in as Ie,it as Le,j as Re,jn as ze,k as Be,kr as Ve,l as He,li as X,lt as Ue,mn as We,mt as Ge,n as Ke,na as qe,ni as Je,nt as Ye,o as Xe,oa as Ze,oi as Qe,ot as $e,p as et,pt as tt,q as nt,qi as rt,qt as Z,r as it,ra as Q,rn as at,rt as ot,s as st,sa as ct,sn as lt,st as ut,t as dt,ta as ft,tn as pt,u as mt,ut as ht,v as gt,va as _t,w as vt,wn as yt,wt as bt,x as xt,xi as St,xn as Ct,xt as wt,y as Tt,yt as Et,z as Dt,zt as Ot}from"../chunks/po-web-runtime-D8FIos2q.js";var kt=16;function At({side:e,open:t,label:n,defaultWidth:r,minWidth:i,maxWidth:a,testId:o,region:s,fixed:c=!1,children:l}){let[u,d]=Z(r),[f,p]=Z(!1),[m,h]=Z(t);t&&!m&&h(!0);let g=e=>Math.round(Math.min(a,Math.max(i,e))),_=e===`right`?-1:1;return C(`aside`,{"aria-label":n,"aria-hidden":!t,inert:!t,"data-testid":o,"data-open":t,"data-po-region":s,style:{"--sheet-width":`${u}px`},className:`relative flex shrink-0 flex-col overflow-hidden bg-po-bg motion-reduce:transition-none max-md:absolute max-md:inset-y-0 max-md:z-30 ${e===`right`?`items-end max-md:right-0`:`items-start max-md:left-0`} ${f?``:`transition-[width] duration-200 ease-out`} ${t?`max-md:w-full md:w-(--sheet-width)`:`w-0`}`,children:N(`div`,{className:`relative flex h-full shrink-0 flex-col border-po-border-soft max-md:w-screen md:w-(--sheet-width) ${c?``:e===`right`?`border-l`:`border-r`}`,children:[c?null:C(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize ${n.toLowerCase()}`,"aria-valuenow":u,"aria-valuemin":i,"aria-valuemax":a,tabIndex:0,onPointerDown:e=>{let t=e.currentTarget,n=e.clientX;t.setPointerCapture(e.pointerId),p(!0);let r=e=>d(g(u+_*(e.clientX-n))),i=()=>{p(!1),t.removeEventListener(`pointermove`,r),t.removeEventListener(`pointerup`,i),t.removeEventListener(`pointercancel`,i)};t.addEventListener(`pointermove`,r),t.addEventListener(`pointerup`,i),t.addEventListener(`pointercancel`,i)},onKeyDown:e=>{let t=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0;t!==0&&(e.preventDefault(),d(g(u+_*t*kt)))},className:`absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none outline-none hover:bg-po-blue/20 focus-visible:bg-po-blue/30 max-md:hidden ${e===`right`?`left-0`:`right-0`}`}),m?l:null]})})}var jt=120,Mt=-1,Nt=/\/+$/u;function Pt(e){let t=e.trim().replace(Nt,``);return t.slice(t.lastIndexOf(`/`)+1)}function Ft({suggestedPaths:e,actions:t}){let n=B(u,e=>e),r=n.path??e[0]??``,[i,a]=Z({path:``,directories:[]});return x(()=>{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)})},jt);return()=>{n=!0,clearTimeout(i)}},[r,t]),x(()=>g(r,t.discoverWorkspaces),[r,t.discoverWorkspaces]),C(It,{suggestions:r.trim()!==``&&i.path===r?i.directories:[],suggestedPaths:e,actions:t,draft:n,updateDraft:Ae})}function It({suggestedPaths:e,actions:n,draft:r,updateDraft:i,style:a,suggestions:o=[]}){let{name:s,nameEdited:c,instructions:l,pending:u,error:d,discovery:f}=r,p=r.path??e[0]??``,m=e=>i({name:e}),g=e=>i({nameEdited:e}),_=e=>i({path:e}),[y,b]=Z(!1),[x,S]=Z(Mt),w=j(null),T=c?s:Pt(p),D=e=>{u||(_(e),S(Mt))},O=e=>{D(`${e}/`),w.current?.focus()},A=p.trim().replace(Nt,``)||(p.trim()===``?``:`/`),M=r.discovering||!!p.trim()&&n.discoverWorkspaces!==void 0&&r.discoveryPath!==p,P=f&&`error`in f?f.error:``,F=f&&`declarations`in f&&f.declarations.length>0?f.declarations:void 0,ee=e=>F?.find(t=>t.name===e)?.workspaceId??r.results.find(t=>t.name===e)?.workspaceId,I=F?.filter(e=>r.checked.includes(e.name)&&!ee(e.name)).map(e=>e.name)??[],te=!F&&!M&&!P,L=!u&&!M&&!P&&(F?I.length>0&&n.addDeclaredWorkspaces!==void 0:A!==``||T.trim()!==``),R=async()=>{L&&(F?await n.addDeclaredWorkspaces?.({path:f&&`root`in f?f.root:A,names:I}):await n.addWorkspace({...l===``?{}:{instructions:l},name:T.trim(),...A===``?{}:{path:A}}))};return C(U,{open:!0,onOpenChange:e=>!e&&!u&&n.closeAddWorkspace(),children:N(k,{style:a,width:`md`,"data-testid":`add-workspace-dialog`,"aria-describedby":void 0,children:[C(G,{children:C(J,{children:`Add workspace`})}),N(v,{children:[N(`label`,{htmlFor:`add-workspace-root`,className:`flex flex-col gap-1`,children:[C(`span`,{className:`text-base font-medium text-po-dim`,children:`Folder`}),N(`span`,{className:`flex items-center gap-1.5`,children:[C(pt,{id:`add-workspace-root`,ref:w,"data-testid":`add-workspace-root`,value:p,autoFocus:!0,disabled:u,onChange:e=>D(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`&&o.length>0)e.preventDefault(),S(e=>(e+1)%o.length);else if(e.key===`ArrowUp`&&o.length>0)e.preventDefault(),S(e=>e<=0?o.length-1:e-1);else if(e.key===`Enter`){let e=x===Mt?void 0:o[x];e===void 0?R():O(e)}},placeholder:`~/workspace/my-project`,className:`min-w-0 flex-1 font-mono`}),C(t,{variant:y?`subtle`:`outline`,size:`md`,"data-testid":`add-workspace-browse`,"aria-pressed":y,disabled:u,onClick:()=>b(e=>!e),children:`Browse`})]})]}),y?C(He,{...A.startsWith(`/`)?{start:A}:{},listDirectory:n.listDirectory,onSelect:e=>{D(e),b(!1)}}):o.length>0?C(`div`,{role:`listbox`,"aria-label":`matching directories`,"data-testid":`add-workspace-suggestions`,className:`max-h-40 overflow-y-auto rounded-lg border border-po-border-soft bg-po-panel/40 p-1.5`,children:o.map((e,t)=>C(yt,{density:`compact`,active:t===x,"data-testid":`add-workspace-suggestion`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>S(t),onClick:()=>O(e),className:`w-full px-2.5 py-1 `,children:e},e))}):null,e.length>0?C(`div`,{className:`flex flex-wrap gap-1`,children:e.slice(0,4).map(e=>C(t,{variant:`outline`,size:`xs`,disabled:u,onClick:()=>D(e),children:e},e))}):null,M?C(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Reading workspace declarations…`}):null,P?C(`p`,{role:`alert`,className:`text-sm text-po-red`,children:P}):null,F?N(`fieldset`,{className:`flex min-w-0 flex-col gap-1`,children:[C(`legend`,{className:`mb-1 text-base font-medium text-po-hi`,children:`Workspaces`}),C(`p`,{className:`mb-1 text-sm text-po-dim`,children:`Declared in .po/config.yaml. Choose which to add.`}),F.map((e,t)=>{let n=ee(e.name)!==void 0,a=n||r.checked.includes(e.name),o=r.results.find(t=>t.name===e.name)?.error;return C(`div`,{"data-checked":a,className:`rounded-sm px-2 py-1.5 data-[checked=true]:bg-po-tint-green`,children:N(`label`,{htmlFor:`add-workspace-declaration-${t}`,className:`flex min-w-0 cursor-pointer items-start gap-2.5`,children:[C(ie,{id:`add-workspace-declaration-${t}`,checked:a,disabled:n||u,onCheckedChange:()=>i({checked:a?r.checked.filter(t=>t!==e.name):[...r.checked,e.name]}),className:`mt-1`}),N(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[C(`span`,{className:`text-base font-semibold text-po-hi`,children:e.name}),C(`span`,{className:`truncate text-sm text-po-dim`,title:e.instructions,children:e.instructions}),o?C(`span`,{role:`alert`,className:`text-sm text-po-red`,children:o}):null]}),n?C(`span`,{className:`text-sm text-po-dim`,children:`Added`}):null]})},e.name)})]}):te?N(h,{children:[N(`label`,{htmlFor:`add-workspace-name`,className:`flex flex-col gap-1`,children:[C(`span`,{className:`text-base font-medium text-po-dim`,children:`Name`}),C(pt,{id:`add-workspace-name`,"data-testid":`add-workspace-name`,value:T,disabled:u,onChange:e=>{g(!0),m(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&R()},placeholder:`my-project`})]}),N(`label`,{htmlFor:`add-workspace-instructions`,className:`flex flex-col gap-1`,children:[N(`span`,{className:`text-base font-medium text-po-dim`,children:[`Instructions `,C(`span`,{className:`font-normal`,children:`(optional)`})]}),C(E,{id:`add-workspace-instructions`,rows:3,value:l,disabled:u,onChange:e=>i({instructions:e.target.value})}),C(`span`,{className:`text-sm text-po-dim`,children:`For main sessions in this workspace.`})]})]}):null,te&&A===``&&T.trim()!==``?N(`p`,{"data-testid":`add-workspace-default-hint`,className:`text-sm text-po-dim`,children:[`creates ~/.po/workspace/`,T.trim()]}):null,d?C(`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:d}):null,N(K,{children:[C(t,{variant:`outline`,onClick:()=>n.closeAddWorkspace(),disabled:u,children:`Cancel`}),C(t,{variant:`primary`,"data-testid":`add-workspace-confirm`,onClick:()=>void R(),disabled:!L,children:u?`Adding…`:F?`Add ${I.length} ${I.length===1?`workspace`:`workspaces`}`:`Add workspace`})]})]})]})})}function Lt({sessionId:e,setup:n,actions:r}){let i=JSON.stringify([`rail/setup`,e,n.id]),[a,o,s]=Y(`${i}/busy`,!1),[c,l]=Y(`${i}/error`,``),u=async()=>{if(s.state)return;o(!0),l(``);let t=await r.removePendingSetup(e,n.id);o(!1),t!==void 0&&l(t.error)};return N(`div`,{"data-testid":`pending-session-${n.id}`,className:`ml-9 flex flex-col gap-0.5 rounded-lg border border-dashed border-po-border-soft px-3 py-2`,children:[N(`div`,{className:`flex items-center justify-between gap-2`,children:[C(`span`,{className:`truncate text-base font-semibold text-po-hi`,children:n.name}),N(De,{children:[C(Ze,{asChild:!0,children:C(t,{variant:`ghost`,size:`icon`,title:`session setup actions`,disabled:a,"data-testid":`pending-session-menu-${n.id}`,children:C(at,{className:`h-3 w-3`})})}),C(qe,{children:C(Q,{variant:`destructive`,onSelect:()=>void u(),children:`remove setup`})})]})]}),C(`p`,{className:n.failed?`text-sm text-po-red`:`text-sm text-po-dim`,children:n.status}),n.recovery?C(`p`,{role:n.failed?`alert`:void 0,className:`text-sm text-po-dim`,children:n.recovery}):null,c?C(`p`,{role:`alert`,className:`text-sm text-po-red`,children:c}):null]})}function Rt(e){if(e===void 0)return;let t=Math.floor((Date.now()-e)/6e4);return t<1?`now`:t<60?`${String(t)}m`:t<1440?`${String(Math.floor(t/60))}h`:`${String(Math.floor(t/1440))}d`}var zt=Ot(function({session:n,actions:r,coordinates:i,coordinator:a,stepsExpanded:o,onToggleSteps:s}){let u=`rail/session/${n.id}`,[d,f]=Y(`${u}/mode`,`view`),[p,g]=Y(`${u}/draft`,``),[_,y]=Y(`${u}/error`,``),[x,S]=Y(`${u}/role-error`,``),[,w,T]=Y(`${u}/removing`,!1),E=j(d),D=e=>{E.current=e,f(e)},{active:O}=n,A=_||x||n.error,M=async e=>{D(`view`),S(``);let t=await r.setSessionRole?.(n.id,e);t!==void 0&&S(t.error)},P=r.setSessionRole===void 0||n.coordinatorEligible!==!0||i===void 0?null:n.coordinator?C(Q,{"data-testid":`session-make-regular-${n.id}`,disabled:n.restartBlocked===!0,onSelect:()=>void M(!1),children:`Make regular session`}):C(Q,{"data-testid":`session-make-coordinator-${n.id}`,disabled:n.restartBlocked===!0,onSelect:()=>a===void 0?void M(!0):D(`promote`),children:`Make coordinator`}),F=n.nested,ee=X(`flex-row items-start rounded-xl`,F?`px-2 py-1.5`:`px-2.5 py-2.5`,O?`bg-po-panel hover:bg-po-panel`:`hover:bg-po-panel/50`),I=n.status.startsWith(`failed`)||n.status.includes(` failed`),te=n.status.startsWith(`running`),L=n.waitingCount??+!!n.awaitingInput,R=I?`text-po-red`:L>0?`text-po-magenta`:te?`text-po-green`:`text-po-dim`,z=F?void 0:Rt(n.lastActivityAt),B=()=>{r.renameSession(n.id,p),D(`view`)},ne=async()=>{if(T.state)return;w(!0),D(`view`),y(``);let e=await r.removeSession(n.id);w(!1),e!==void 0&&y(e.error)},re=N(`span`,{className:X(`flex w-full min-w-0 items-start`,F?`gap-2.5`:`gap-3`),children:[N(`span`,{className:`relative shrink-0`,children:[N(l,{"data-testid":n.profile?`session-avatar`:void 0,"aria-label":n.profile?.label??`Po`,title:n.profile?.label,className:F?`size-7 rounded-full`:`size-10 rounded-full`,children:[n.profile?.avatarUrl?C(b,{src:n.profile.avatarUrl,alt:``}):null,C(m,{className:`bg-po-tint-green text-xs font-semibold text-po-green`,children:n.profile?.initials??`PO`})]}),te||I?C(e,{tone:I?`red`:`green`,size:`lg`,className:`absolute -right-0.5 -bottom-0.5 ring-2 ring-po-rail`}):null]}),N(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[N(`span`,{className:`flex min-w-0 items-center gap-2`,children:[F&&n.provenance===`workflow-session`?C(de,{"aria-label":`workflow session`,className:`size-3 shrink-0 ${O?`text-po-green`:`text-po-dim`}`}):n.provenance===`workflow`?C(ve,{"aria-label":`workflow step`,className:`size-3 shrink-0 ${O?`text-po-green`:`text-po-dim`}`}):F&&n.provenance?C(Me,{"aria-label":n.provenance===`worktree`?`automatic per-conversation worktree`:n.provenance,className:`size-3 shrink-0 ${O?`text-po-green`:`text-po-dim`}`}):null,n.coordinator?C(Je,{"aria-label":`coordinator`,className:`size-3.5 shrink-0 text-po-dim`}):null,C(`span`,{className:X(`min-w-0 flex-1 truncate text-base text-po-hi`,F&&!O?`font-normal`:`font-semibold`),children:n.name||`Untitled`}),z?C(`span`,{className:X(`shrink-0 text-sm font-normal transition-opacity group-focus-within:opacity-0 group-hover:opacity-0`,L>0?`text-po-magenta`:`text-po-dim`),children:z}):null]}),N(`span`,{className:`flex min-w-0 items-start gap-2 text-sm leading-snug font-normal`,children:[N(`span`,{"data-testid":`session-status`,className:X(`min-w-0 flex-1`,O?`line-clamp-2`:`truncate`),children:[C(`span`,{className:`font-medium text-po-text`,children:n.profile?.label??`Po`}),N(`span`,{className:R,children:[` · `,n.clock?C(lt,{label:n.clock.label,since:n.clock.since}):n.status]})]}),L>0?N(h,{children:[C(Ct,{ask:!0,"aria-hidden":!0,"data-testid":`session-awaiting-input`,children:L}),N(`span`,{className:`sr-only`,children:[`, `,L,` waiting for you`]})]}):null]}),n.git?N(`span`,{"data-testid":`session-branch`,className:`flex min-w-0 items-center gap-1.5 pt-0.5 text-sm font-normal text-po-dim`,children:[C(V,{"aria-hidden":!0,className:`size-3 shrink-0 ${O?`text-po-green`:``}`}),C(`span`,{className:`truncate font-mono`,children:n.git.branch}),n.git.dirty?C(`span`,{className:`shrink-0 text-po-yellow`,children:`modified`}):null]}):null,A?C(`span`,{"data-testid":`session-error`,className:`line-clamp-3 text-sm font-normal break-words text-po-red`,children:A}):null]})]}),H=d===`menu`;return N(h,{children:[N(`div`,{className:X(`group relative`,n.provenance===`workflow`?`ml-14 border-l border-po-border-soft pl-3`:F?`ml-7 border-l border-po-border-soft pl-3`:o!==void 0&&`ml-7`),"data-testid":`session-card-${n.id}`,"data-active":O,"data-nested":n.nested,children:[o===void 0?null:C(`button`,{type:`button`,"data-testid":`session-steps-${n.id}`,"aria-expanded":o,"aria-label":`${o?`Hide`:`Show`} steps of ${n.name||`this workflow`}`,onClick:()=>s?.(n.id),className:`absolute top-2.5 -left-6 grid size-5 place-items-center rounded-sm text-po-dim outline-none hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green/50`,children:C(o?se:c,{"aria-hidden":!0,className:`size-3.5`})}),C(t,{variant:`ghost`,size:`card`,"data-testid":`session-open-${n.id}`,onClick:()=>r.openSession(n.id),title:n.ordinal>=1&&n.ordinal<=9?`Press ${String(n.ordinal)} to focus`:void 0,className:ee,children:re}),d===`view`||H?C(`div`,{className:`absolute top-2 right-2 transition-opacity ${H?`opacity-100`:`opacity-0 group-focus-within:opacity-100 group-hover:opacity-100`}`,children:N(De,{open:H,onOpenChange:e=>{let t=E.current;D(e?`menu`:t===`menu`?`view`:t)},children:[C(Ze,{asChild:!0,children:C(t,{variant:`ghost`,size:`icon`,"data-testid":`session-menu-${n.id}`,title:`session actions`,className:`text-po-dim hover:text-po-hi`,children:C(at,{className:`h-3 w-3`})})}),N(qe,{"data-testid":`session-menu-list-${n.id}`,onCloseAutoFocus:e=>{E.current!==`view`&&e.preventDefault()},children:[r.renderSessionMenuItems(n.id),n.canInteract===!1?null:N(h,{children:[C(Q,{"data-testid":`session-rename-${n.id}`,onSelect:()=>{g(n.name),D(`rename`)},children:`Rename`}),P,C(Q,{"data-testid":`session-resume-${n.id}`,onSelect:()=>r.resumeSession(n.id),children:`Resume`}),r.openMoveSession&&n.move?C(Q,{"data-testid":`session-move-${n.id}`,disabled:n.restarting||n.move.blocked,onSelect:()=>r.openMoveSession(n.id),children:`Move to workspace…`}):null,C(Q,{"data-testid":`session-restart-${n.id}`,disabled:n.restarting||n.restartBlocked===!0,onSelect:()=>r.restartSession(n.id),children:`Restart`}),C(Q,{variant:`destructive`,"data-testid":`session-stop-${n.id}`,onSelect:()=>D(`confirm`),children:`Remove`})]})]})]})}):null,C(U,{open:n.canInteract!==!1&&d===`rename`,onOpenChange:e=>!e&&D(`view`),children:N(k,{width:`sm`,"data-testid":`session-rename-dialog-${n.id}`,"aria-describedby":void 0,children:[C(G,{children:C(J,{children:`rename session`})}),C(v,{children:N(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),B()},children:[C(pt,{"data-testid":`session-name-input-${n.id}`,"aria-label":`session name`,value:p,autoFocus:!0,onChange:e=>g(e.target.value)}),N(K,{children:[C(t,{type:`button`,variant:`outline`,size:`md`,"data-testid":`session-rename-cancel-${n.id}`,onClick:()=>D(`view`),children:`cancel`}),C(t,{type:`submit`,variant:`primary`,size:`md`,"data-testid":`session-rename-confirm-${n.id}`,disabled:p.trim()===``,children:`rename`})]})]})})]})}),C(U,{open:n.canInteract!==!1&&d===`confirm`,onOpenChange:e=>!e&&D(`view`),children:N(k,{width:`sm`,"data-testid":`session-stop-dialog-${n.id}`,"aria-describedby":void 0,children:[C(G,{children:C(J,{children:`remove session`})}),N(v,{children:[N(rt,{children:[`this stops `,C(`span`,{className:`font-semibold text-po-hi`,children:n.name||`untitled`}),` and removes it from the list. anything it is running ends now. you can restore it for 7 days.`]}),N(K,{children:[C(t,{variant:`outline`,size:`md`,"data-testid":`session-stop-cancel-${n.id}`,autoFocus:!0,onClick:()=>D(`view`),children:`cancel`}),C(t,{variant:`danger`,size:`md`,"data-testid":`session-stop-confirm-${n.id}`,onClick:()=>void ne(),children:`remove`})]})]})]})}),C(U,{open:n.canInteract!==!1&&d===`promote`,onOpenChange:e=>!e&&D(`view`),children:N(k,{width:`sm`,"data-testid":`session-promote-dialog-${n.id}`,"aria-describedby":void 0,children:[C(G,{children:N(J,{children:[`Make `,n.name||`Untitled`,` the coordinator of `,i,`?`]})}),N(v,{children:[N(rt,{children:[C(`span`,{className:`font-semibold text-po-hi`,children:n.name||`Untitled`}),` will see every session in`,` `,i,`, message them, and start new ones.`,` `,C(`span`,{className:`font-semibold text-po-hi`,children:a}),` becomes a regular session. Both restart to take on their new roles, so anything they are running stops now.`]}),N(K,{children:[C(t,{variant:`outline`,size:`md`,"data-testid":`session-promote-cancel-${n.id}`,autoFocus:!0,onClick:()=>D(`view`),children:`Cancel`}),C(t,{variant:`primary`,size:`md`,"data-testid":`session-promote-confirm-${n.id}`,onClick:()=>void M(!0),children:`Make coordinator`})]})]})]})})]}),n.pendingSetups.map(e=>C(Lt,{sessionId:n.id,setup:e,actions:r},`setup:${e.id}`))]})});function Bt({workspace:e,actions:n}){let r=`rail/workspace/${e.id}`,[i,o]=Y(`${r}/open`,!1),[s,c]=Y(`${r}/error`,``),[l,u,d]=Y(`${r}/removing`,!1),[f,p]=Y(`${r}/coordinator-error`,``),[m,h]=Y(`rail/workflow-steps-expanded`,[]),g=a(e=>h(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[h]),{id:_,name:y,root:b,available:x,legacy:S}=e,w=e.sessions.find(e=>e.coordinator),T=me(e.sessions,new Set(m)),E=t=>C(zt,{session:t,actions:n,...t.coordinatorEligible===!0?{coordinates:e.kind===`session`?`Home`:y}:{},...w===void 0||w.id===t.id?{}:{coordinator:w.name},...T.withSteps.has(t.id)?{stepsExpanded:m.includes(t.id),onToggleSteps:g}:{}},t.id),D=async()=>{p(``);let e=await n.addCoordinator?.(_);e!==void 0&&p(e.error)};if(e.kind===`session`)return e.sessions.length===0?null:C(`div`,{"data-testid":`session-group-${_}`,className:`flex flex-col gap-0.5`,children:T.sessions.map(E)});let O=async()=>{if(d.state)return;u(!0),c(``);let e=await n.deleteWorkspace(_);u(!1),e===void 0?o(!1):c(e.error)};return N(`section`,{"data-testid":`workspace-group-${_}`,"data-available":x,className:`group/ws flex flex-col gap-0.5`,children:[N(`div`,{className:`flex h-8 min-w-0 items-center gap-1 pl-2.5`,title:b,children:[C(`div`,{className:`flex min-w-0 flex-1`,children:!S&&n.openWorkspace?C(`button`,{type:`button`,"data-testid":`workspace-open-${_}`,onClick:()=>n.openWorkspace?.(_),className:`truncate rounded-sm text-left text-sm font-medium text-po-dim outline-none hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green/50`,title:`Open ${y} workspace`,children:y}):C(`p`,{className:`truncate text-sm font-medium text-po-dim`,children:y})}),S?null:N(`span`,{className:`flex items-center gap-0.5 opacity-0 transition-opacity group-focus-within/ws:opacity-100 group-hover/ws:opacity-100 pointer-coarse:opacity-100 has-[[data-state=open]]:opacity-100`,children:[C(t,{variant:`ghost`,size:`icon`,"data-testid":`workspace-new-session-${_}`,title:`New session`,"aria-label":`New session in ${y}`,disabled:!x,onClick:()=>n.createSession(_),className:`text-po-dim hover:text-po-hi`,children:C(ze,{className:`size-3.5`})}),N(De,{children:[C(Ze,{asChild:!0,children:C(t,{variant:`ghost`,size:`icon`,"data-testid":`workspace-menu-${_}`,title:`Workspace actions`,"aria-label":`${y} actions`,className:`text-po-dim hover:text-po-hi`,children:C(at,{className:`size-3.5`})})}),N(qe,{children:[C(Q,{disabled:!x,onSelect:()=>n.resumeInWorkspace(_),children:`Resume Session`}),n.addCoordinator?C(Q,{"data-testid":`workspace-add-coordinator-${_}`,disabled:!x,onSelect:()=>void D(),children:`Add bot`}):null,C(Q,{disabled:!x,onSelect:()=>n.openWorkspaceSettings(_),children:`Workspace Settings`}),C(Q,{variant:`destructive`,"data-testid":`workspace-delete-${_}`,onSelect:()=>{c(``),o(!0)},children:`Delete Workspace`})]})]})]})]}),x?null:C(`p`,{className:`px-2.5 text-sm text-po-red`,children:`Workspace unavailable`}),f?C(`p`,{"data-testid":`workspace-coordinator-error-${_}`,className:`px-2.5 text-sm text-po-red`,children:f}):null,e.sessions.length>0?C(`div`,{className:`flex flex-col gap-0.5`,children:T.sessions.map(E)}):x?C(`p`,{className:`px-2.5 pb-1 text-sm text-po-dim`,children:`No sessions yet. Start or resume one.`}):null,C(U,{open:i,onOpenChange:e=>!e&&!l&&o(!1),children:N(k,{width:`sm`,"data-testid":`workspace-delete-dialog-${_}`,"aria-describedby":void 0,children:[C(G,{children:C(J,{children:`delete workspace`})}),N(v,{children:[N(rt,{children:[`this removes `,C(`span`,{className:`font-semibold text-po-hi`,children:y}),` and all its sessions from Po. running work will stop. files at `,C(`code`,{children:b}),` stay on disk.`]}),s?C(`p`,{"data-testid":`workspace-delete-error-${_}`,className:`text-sm text-po-red`,children:s}):null,N(K,{children:[C(t,{variant:`outline`,size:`md`,"data-testid":`workspace-delete-cancel-${_}`,disabled:l,autoFocus:!0,onClick:()=>o(!1),children:`cancel`}),C(t,{variant:`danger`,size:`md`,"data-testid":`workspace-delete-confirm-${_}`,disabled:l,onClick:()=>void O(),children:l?`deleting…`:`delete`})]})]})]})})]})}var Vt=`h-9 w-full justify-start gap-3 rounded-lg border-0 px-2.5 text-base font-medium outline-none focus-visible:ring-2 focus-visible:ring-po-green/50`;function Ht({rail:e,onClose:r}){let{actions:i}=e,a=e.coordinatorHosts??[];return N(`div`,{className:`flex h-full min-h-0 flex-1 flex-col overflow-hidden`,children:[N(`div`,{"data-testid":`rail-scroll-content`,className:`min-h-0 flex-1 overflow-y-auto`,children:[N(`div`,{className:`flex items-center gap-1 px-3 pt-4 pb-3`,children:[N(`span`,{className:`flex flex-1 items-center gap-2.5 pl-1`,"aria-label":`Po`,children:[C(`img`,{src:`/favicon.svg`,alt:``,"aria-hidden":`true`,className:`size-8 rounded-lg`}),C(`span`,{"aria-hidden":`true`,className:`text-xl font-semibold text-po-hi`,children:`Po`})]}),C(t,{variant:`ghost`,size:`icon`,"data-testid":`mobile-sessions-close`,title:`Hide sessions`,"aria-label":`Hide sessions`,onClick:r,className:`text-po-dim hover:text-po-hi md:hidden`,children:C(Ve,{"aria-hidden":!0,className:`size-4`})})]}),N(`div`,{className:`flex flex-col gap-0.5 px-3`,children:[N(t,{variant:`ghost`,size:`md`,"data-testid":`home-open`,"aria-current":e.homeActive?`page`:void 0,onClick:i.openHome,className:`${Vt} ${e.homeActive?`bg-po-panel text-po-hi`:`text-po-text hover:bg-po-panel/50`}`,children:[C(n,{"aria-hidden":!0,className:e.homeActive?`size-4 text-po-green`:`size-4 text-po-dim`}),`Home`]}),C(`div`,{"data-rail":`elegant`,className:`group/rail contents`,children:e.pluginContent})]}),N(`div`,{className:`flex flex-col gap-6 px-3 pt-5 pb-4`,children:[C(Wt,{workspaces:e.workspaces,openSession:i.openSession}),C(Gt,{rail:e})]})]}),N(`div`,{"data-testid":`rail-footer`,className:`shrink-0 bg-po-rail`,children:[C(`div`,{"data-rail-status":`elegant-banner`,className:`contents`,children:C(gt,{slot:L.railStatus,sessionId:null})}),N(`div`,{className:`flex flex-col gap-0.5 border-t border-po-border-soft px-3 py-2`,children:[N(De,{children:[C(Ze,{asChild:!0,children:N(t,{variant:`ghost`,size:`md`,"data-testid":`session-create-menu`,"aria-label":`Create workspace or session`,className:`${Vt} text-po-text hover:bg-po-panel/50`,children:[C(ct,{"aria-hidden":!0,className:`size-4 text-po-dim`}),C(`span`,{className:`flex-1 text-left`,children:`New session`}),C(`span`,{"aria-hidden":!0,className:`font-mono text-sm font-normal text-po-faint`,children:`ctrl t`})]})}),N(qe,{align:`start`,className:`min-w-56`,children:[C(Q,{"data-testid":`add-workspace-open`,onSelect:i.openAddWorkspace,children:`Create workspace`}),i.createGeneralSession?C(Q,{"data-testid":`new-session-open`,onSelect:i.createGeneralSession,children:`Create session`}):null,i.addCoordinator?a.map(e=>C(Q,{"data-testid":e.hostId?`coordinator-create-${e.hostId}`:`coordinator-create`,onSelect:()=>void i.addCoordinator?.(void 0,e.hostId),children:a.length>1?`Create bot on ${e.label}`:`Create bot`},e.hostId??`local`)):null]})]}),C(`div`,{"data-rail-status":`elegant-action`,className:`contents`,children:C(gt,{slot:L.railStatus,sessionId:null})}),N(t,{variant:`ghost`,size:`md`,"data-testid":`settings-open`,onClick:i.openSettings,className:`${Vt} text-po-text hover:bg-po-panel/50`,children:[C(ge,{"aria-hidden":!0,className:`size-4 text-po-dim`}),`Settings`]})]})]})]})}function Ut(e){let t=new Map;for(let n of e.flatMap(e=>e.sessions)){let e=n.profile?.name??`po`,r=n.status.startsWith(`running`),i=t.get(e);(!i||!i.working&&r)&&t.set(e,{key:e,label:n.profile?.label??`Po`,initials:n.profile?.initials??`PO`,...n.profile?.avatarUrl?{avatarUrl:n.profile.avatarUrl}:{},working:r,sessionId:n.id})}return[...t.values()].sort((e,t)=>Number(t.working)-Number(e.working))}function Wt({workspaces:t,openSession:n}){let r=Ut(t);return r.length===0?null:N(`section`,{"aria-labelledby":`rail-team-heading`,"data-testid":`rail-team`,className:`flex flex-col gap-2 px-2.5`,children:[C(`h2`,{id:`rail-team-heading`,className:`text-sm font-medium text-po-dim`,children:`With you now`}),C(`ul`,{className:`-mx-1 flex gap-2 overflow-x-auto px-1 pb-1`,children:r.map(t=>C(`li`,{className:`shrink-0`,children:N(`button`,{type:`button`,"data-testid":`rail-team-${t.key}`,"aria-label":`${t.label}, ${t.working?`working`:`free`}`,onClick:()=>n(t.sessionId),className:`flex w-14 flex-col items-center gap-1 rounded-lg py-1 outline-none transition-colors hover:bg-po-panel/50 focus-visible:ring-2 focus-visible:ring-po-green/50`,children:[N(`span`,{className:`relative`,children:[N(l,{className:`size-11 rounded-full`,children:[t.avatarUrl?C(b,{src:t.avatarUrl,alt:``}):null,C(m,{className:`bg-po-tint-green text-xs font-semibold text-po-green`,children:t.initials})]}),t.working?C(e,{tone:`green`,size:`lg`,className:`absolute -right-0.5 -bottom-0.5 ring-2 ring-po-rail`}):null]}),C(`span`,{className:`w-full truncate text-center text-sm text-po-text`,children:t.label})]})},t.key))})]})}function Gt({rail:e}){let{actions:t}=e,n=e.workspaces.every(e=>e.kind===`session`&&e.sessions.length===0),r=j(null),[i,a]=Y(`rail/initial-selection-revealed`,!1);return x(()=>{if(i)return;let e=r.current?.querySelector(`[data-active="true"]`);e&&(e.scrollIntoView({block:`center`,inline:`nearest`,behavior:`instant`}),a(!0))},[e.workspaces,i,a]),N(`section`,{"aria-labelledby":`rail-sessions-heading`,children:[C(`h2`,{id:`rail-sessions-heading`,className:`sr-only`,children:`Sessions`}),N(`div`,{ref:r,className:`flex flex-col gap-6`,children:[e.workspaces.map(e=>C(Bt,{workspace:e,actions:t},e.id)),n?C(`p`,{className:`px-2.5 text-sm text-po-dim`,children:`Start a session to work with Po. No workspace needed.`}):null]})]})}function Kt({view:e,slots:t,rail:n,navigationOpen:r,desktopActivityOpen:i,mobileActivityOpen:a,onNavigationOpenChange:o}){let s=e===`conversation`||e===`welcome`,c=i||a,l=n.workspaces.flatMap(e=>e.sessions).reduce((e,t)=>e+(t.waitingCount??+!!t.awaitingInput),0),u=n.workspaces.flatMap(e=>e.sessions).filter(e=>e.status.startsWith(`running`)).length;return N(`div`,{className:`relative flex h-full min-w-0 overflow-hidden bg-po-bg [--po-backdrop-blur:0px] [[data-po-backdrop]_&]:bg-transparent`,children:[C(At,{side:`left`,open:r,label:`Sessions`,defaultWidth:320,minWidth:240,maxWidth:520,testId:`session-rail-panel`,region:`rail`,children:C(Ht,{rail:n,onClose:()=>o(!1)})}),N(`div`,{"data-po-region":`content`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[t.notices,t.header({navigationToggle:`always`,activityToggle:c?`mobile`:`always`,sessionsOpen:r,sessionsBadge:r?0:l,sessionsRunning:u}),C(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:N(`div`,{"data-testid":`template-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[t.content,N(`div`,{className:s?`mx-auto w-full max-w-[960px] shrink-0 px-2 sm:px-6`:`shrink-0`,children:[t.composer==null?null:C(`div`,{className:`mb-2 sm:mb-4`,children:t.composer}),t.controls==null?null:N(`details`,{className:`px-3 pb-3 text-sm text-po-dim`,children:[C(`summary`,{"data-testid":`template-controls-toggle`,className:`cursor-pointer rounded-sm px-1 py-1 focus-visible:outline focus-visible:outline-po-blue`,children:`Session controls`}),t.controls]})]})]})})]}),t.sheet,t.activity==null?null:C(At,{side:`right`,open:c,label:`Activity`,defaultWidth:360,minWidth:360,maxWidth:360,fixed:!0,testId:`activity-sheet`,region:`activity`,children:C(`div`,{className:`flex min-h-0 flex-1`,children:t.activity})}),t.settings==null?null:C(At,{side:`right`,open:!0,label:`Session`,defaultWidth:360,minWidth:360,maxWidth:360,fixed:!0,testId:`session-settings-sheet`,region:`settings`,children:t.settings}),n.addWorkspace?C(Ft,{suggestedPaths:n.addWorkspace.suggestedPaths,actions:n.actions}):null]})}function qt(e){return new Set(e.filter(e=>e.availability===`off`).map(e=>e.id))}function Jt(e,t,n,r){for(let i of t){if(i.availability!==`on`||!e.has(i.id))continue;let t=n.find(e=>e.requiredMode===i.name);if(t!==void 0)return t.id;let a=[i.name,i.id,i.activityGroup];if(r.some(e=>a.includes(e.name)))return`activity`}return null}function Yt({sessionId:e,onReveal:t}){let n=tt(e=>e.statuses),r=tt(e=>e.widgets),i=tt(e=>e.modes),a=Et(e),o=j(void 0);return x(()=>{let s=ot(n,r,i),c=o.current;if(o.current={sessionId:e,off:qt(s)},c?.sessionId!==e)return;let l=Jt(c.off,s,a,ne(e));l!==null&&t(l)},[e,n,r,i,a,t]),null}function Xt(e,t){let n=[],r=[],i=()=>{r.length>0&&n.push({kind:`activity`,key:r[0].id,items:r}),r=[]};for(let a of e){let e=t(a);e!==`skip`&&(e===`activity`?r.push(a):(i(),n.push({kind:`entry`,entry:a})))}return i(),n}var Zt=new I(null);function Qt(){let e=B(Le,e=>e.activeId),n=ae(e),r=tt(e=>e.statuses),i=B(Zt,e=>e),a=i!==null&&i.sessionId===e,[o,s]=Z(i);return a&&i!==o&&s(i),N(At,{side:`right`,open:a,label:`Activity`,defaultWidth:384,minWidth:280,maxWidth:800,testId:`response-activity-sheet`,children:[N(`header`,{className:`flex shrink-0 items-center justify-between gap-2 px-4 pt-3 pb-2`,children:[C(`h2`,{className:`text-lg font-semibold text-po-hi`,children:`Activity`}),C(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Close activity`,onClick:()=>Zt.setState(()=>null),children:C(z,{"aria-hidden":!0,className:`size-4`})})]}),C(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-4`,children:C(We,{className:`divide-y divide-po-border-soft rounded-none border-0`,children:(o?.items??[]).map(e=>C(`div`,{className:`py-1.5`,children:e.kind===`tool`?C(S,{entry:e,slotProps:n,statuses:r,suppressOutputs:!0}):C(`p`,{className:`py-1 text-sm text-po-dim`,children:e.text})},e.id))})})]})}var $t=new I({});function en(e,t){if(!e||!t)return;let n=e.querySelector(`[data-output-id="${CSS.escape(t.id)}"] [data-viewable-image] img`);if(!n)return;let r={kind:`image`,title:t.title,url:n.src};$t.setState(e=>e[t.id]?.url===r.url?e:{...e,[t.id]:r})}function tn({review:e,picture:t,onClose:n}){return e(t,n)}function nn({items:e,review:n,initialOutput:r=0,initiallyExpanded:i=!1}){let[a,o]=Z(r>0?e[r]?.id:void 0),[s,l]=Z(i),u=j(null),d=j(null),f=Math.max(0,e.findIndex(e=>e.id===a)),p=e[f],m=B($t,e=>p===void 0?void 0:e[p.id]);if(x(()=>{let t=u.current;i&&t&&(en(d.current,e[r]),t.close(),t.showModal())},[i]),!p)return null;let h=()=>{let e=u.current;e&&!s&&(en(d.current,p),e.close(),e.showModal(),l(!0))},g=t=>{let n=e[t];s&&en(d.current,n),o(n.id)},_=()=>u.current?.close();return C(`section`,{"aria-label":`Response outputs`,"aria-roledescription":`carousel`,className:`mt-5 overflow-hidden rounded-lg border border-po-border-soft bg-po-panel`,children:N(`dialog`,{ref:u,open:!0,role:s?`dialog`:`group`,"aria-label":s?`Response outputs`:`Output previews`,"aria-modal":s,className:s?`fixed inset-3 m-0 flex h-[calc(100dvh-24px)] w-[calc(100vw-24px)] max-h-none max-w-none flex-col overflow-hidden rounded-lg border border-po-border bg-po-panel p-0 text-po-text shadow-2xl backdrop:bg-po-deep/70`:`static m-0 w-full max-w-none border-0 bg-po-panel p-0 text-po-text`,onClose:e=>{e.currentTarget.open||(e.currentTarget.show(),l(!1))},children:[N(`div`,{className:`flex items-center justify-between gap-2 border-b border-po-border-soft px-4 py-2`,children:[C(`h2`,{className:`text-base font-semibold text-po-hi`,children:s?`Response outputs`:`Outputs`}),C(t,{variant:`ghost`,size:`sm`,"aria-label":s?`Close outputs`:`Expand outputs`,onClick:s?_:h,children:s?C(z,{"aria-hidden":!0,className:`size-4`}):`Expand outputs`})]}),s&&m?C(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:C(ce,{media:m,action:n?C(tn,{review:n,picture:m,onClose:_}):void 0},m.url)}):null,C(`div`,{ref:d,className:s&&m?`hidden`:s?`min-h-0 flex-1 overflow-auto`:`max-h-64 min-h-32 overflow-auto`,children:e.map((e,t)=>C(`div`,{"data-output-id":e.id,hidden:t!==f,className:t===f?`flex min-h-full flex-col items-center justify-center p-3 *:self-center`:`hidden`,onClickCapture:s?void 0:e=>{e.target.closest(`[data-viewable-image]`)&&(e.stopPropagation(),h())},children:e.content},e.id))}),N(`div`,{role:`group`,"aria-label":`Output navigation`,className:`flex items-center gap-2 border-t border-po-border-soft px-3 py-2`,children:[C(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Previous output`,disabled:f===0,onClick:()=>g(f-1),children:C(c,{"aria-hidden":!0,className:`size-4 rotate-180`})}),N(`output`,{"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-center text-sm text-po-dim`,children:[f+1,` of `,e.length,` · `,p.title]}),C(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Next output`,disabled:f===e.length-1,onClick:()=>g(f+1),children:C(c,{"aria-hidden":!0,className:`size-4`})})]})]})})}var rn=`Po is working`;function an(e){return e.kind===`settled`||e.kind===`assistant`&&!e.text.trim()?`skip`:e.kind===`tool`||e.kind===`notice`&&e.tone===`info`?`activity`:`entry`}function on({turn:e,sessionId:t,slotProps:n,statuses:r,renderEntry:i,dense:a=!1}){let o=Xt(e.sequence,an),s=e.sequence.filter(e=>e.kind===`tool`),c=o.filter(e=>e.kind===`activity`),l=c.at(-1),u=!e.settled||s.some(e=>e.running),d=s.at(-1)?.isError===!0,f=B(Zt,e=>e?.sessionId===t?e.key:null);x(()=>{let e=c.find(e=>e.key===f);e&&Zt.setState(()=>({sessionId:t,key:e.key,items:e.items}))});let p=e=>e.flatMap(e=>e.kind===`tool`?ue(e,n,r):[]).reverse();return N(`div`,{"data-testid":`quiet-turn`,"data-turn-id":e.id,className:`flex flex-col gap-5`,children:[o.map(e=>e.kind===`entry`?C(fe,{children:i(e.entry)},e.entry.id):N(fe,{children:[C(ln,{dense:a,items:e.items,open:f===e.key,working:e.items.some(e=>e.kind===`tool`&&e.running)||u&&e===l,ended:d&&!u&&e===l,onToggle:()=>Zt.setState(()=>f===e.key?null:{sessionId:t,key:e.key,items:e.items})}),C(sn,{dense:a,items:p(e.items),review:St(n)})]},e.key)),u&&o.at(-1)?.kind!==`activity`?C(`div`,{className:a?`flex min-h-8 items-center`:`ml-12 flex min-h-8 items-center`,children:C(`span`,{className:`ml-auto px-2.5`,children:C(F,{label:rn,className:`size-3.5 text-po-green`})})}):null]})}function sn({dense:e,...t}){return t.items.length===0?null:C(`div`,{className:e?`min-w-0`:`ml-12 min-w-0`,children:C(nn,{...t})})}var cn={bash:A,grep:T,find:T,ls:Fe,read:Te,edit:ct,write:ct,exec:ve,web_search:_t,web_fetch:_t};function ln({items:e,open:n,working:r,ended:i,onToggle:a,dense:o=!1}){let s=e.filter(e=>e.kind===`tool`),l=[...new Set(s.map(e=>e.name))],u=s.filter(e=>e.isError).length,d=s.length>0?`${s.length} tool${s.length===1?``:`s`} · ${l.join(`, `)}`:`Activity`;return N(`div`,{"data-testid":`activity-row`,className:o?`min-w-0 text-sm text-po-dim`:`ml-12 min-w-0 text-sm text-po-dim`,children:[i?N(`span`,{className:`flex items-center gap-1.5 px-2.5 text-po-red`,children:[C(ft,{"aria-hidden":!0,className:`size-3.5`}),`Turn ended`]}):null,N(t,{variant:`ghost`,size:`sm`,className:`min-h-8 w-full min-w-0 justify-start gap-2 text-left font-normal`,"aria-label":`View activity, ${d}${u>0?`, ${u} failed`:``}`,"aria-expanded":n,"aria-busy":r,onClick:a,title:d,children:[C(`span`,{"aria-hidden":!0,className:`flex shrink-0 items-center gap-2`,children:l.slice(0,3).map(e=>{let t=Object.hasOwn(cn,e)?cn[e]:Qe;return C(t,{className:`size-3.5`},e)})}),C(`span`,{className:`min-w-0 flex-1 truncate`,children:d}),r?C(F,{label:rn,className:`size-3.5 text-po-green`}):null,u>0?N(`span`,{className:`flex shrink-0 items-center gap-1 text-po-red`,children:[C(ft,{"aria-hidden":!0,className:`size-3.5`}),u,` failed`]}):null,C(c,{"aria-hidden":!0,className:`size-3.5`})]})]})}function un({onDismiss:e,...t}){return C(Kt,{...t,rail:y({onDismiss:e})})}function $(){return typeof window<`u`&&window.matchMedia(`(max-width: 767px)`).matches}var dn=`po.web.elegant.rail`;function fn(){try{return window.localStorage.getItem(dn)!==`closed`}catch{return!0}}function pn(e){try{window.localStorage.setItem(dn,e?`open`:`closed`)}catch{return}}function mn({homeHosts:e}){bt();let n=B(Ee,e=>e.dockOpen),[r,a]=Z(()=>!$()&&fn()),o=e=>{a(e),$()||pn(e)},s=()=>o(!r),c=()=>{$()&&a(!1)},[l,u]=Z(!1),[d,m]=Z(!1),g=()=>{$()&&(u(!1),m(!1))},{kind:_,sessionId:v,tabId:y,pageId:b,pluginId:x,workspaceId:S}=Ne(),T=ae(v??null),E=B(Le,e=>e.activeId),O=B(Le,e=>e.transferringToId===null?null:e.byId[e.transferringToId]?.summary.name??`destination session`),k=wt(),A=Ge(),j=A?.summary.dormant===!0?A:null,P=tt(e=>e.dialog?.id??null),F=B(ht,e=>nt(e,v,y)),I=F===void 0?void 0:ne(v??null).map(e=>e.transientTab?.()).find(e=>e?.id===F.id)??F,R=(y===void 0?void 0:f(v??null).find(e=>e.id===y))??I,z=R===I?I?.composerContext:void 0,V=R!==void 0&&R===I&&I.retainComposer===!0&&I.composerAside===!0,H=Se(`(max-width: 767px)`),ie=B(Ee,e=>D(e,E)),se=`${_}\u0000${v??``}\u0000${y??``}\u0000${b??``}\u0000${S??``}`,[ce,le]=Z(se);ce!==se&&(le(se),c(),g());let[ue,de]=Z(P);ue!==P&&(de(P),P!==null&&(u(!1),c()));let fe=()=>{l?u(!1):ye(!1)},U=e=>{m(!1),c(),$()?u(!0):ye(!0),$e(E,e)},W=b===void 0?_===`workspace`&&S!==void 0?C(i,{workspaceId:S,navigationToggle:`always`,onShowSessions:s}):_===`home`&&!k?C(we,{hosts:e,navigationToggle:`always`,onShowSessions:s}):null:N(he,{pageId:b,sessionId:null,workspaceId:S,navigationToggle:`always`,onShowSessions:s,children:[b===w?C(Tt,{workspaceId:S,pluginId:x}):null,b===pe?C(ee,{}):null]}),G=A?.canInteract===!0&&!W&&(!R||R.targetSessionId!==void 0)&&!k&&j===null,K=!W&&!k&&(!R||R.retainComposer===!0),q=d&&G&&K,me=e=>C(M,{composerContext:e,quiet:!0,toolbar:G?C(t,{variant:`ghost`,size:`icon-md`,"aria-label":`Session settings`,title:`Session settings`,"aria-expanded":d,"data-testid":`session-settings-open`,onClick:()=>{d||(u(!1),c()),m(!d)},className:d?`text-po-hi`:`text-po-dim`,children:C(ge,{"aria-hidden":!0,className:`size-4`})}):void 0}),J=V?C(Ce,{label:R.label,renderTurn:on,composer:me(z)}):null;return N(`div`,{"data-testid":`cockpit`,className:`h-full min-w-0 overflow-hidden`,children:[C(un,{view:W||R?`panel`:k?`welcome`:`conversation`,navigationOpen:r,desktopActivityOpen:n&&!q&&!$(),mobileActivityOpen:l,onNavigationOpenChange:o,onDesktopActivityOpenChange:ye,onMobileActivityOpenChange:u,onDismiss:c,slots:{header:e=>W?null:N(h,{children:[C(re,{...e,view:R?.id??`conversation`,onShowSessions:()=>{g(),s()},onShowActivity:()=>{c(),m(!1),$()?u(e=>!e):ye(q||!n)}}),C(`div`,{className:`mx-auto w-full max-w-[960px] shrink-0 px-2 pt-2 empty:hidden sm:px-6`,children:C(gt,{slot:L.conversationStrip,sessionId:v??null})})]}),notices:O===null?null:N(`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 `,O,`...`]}),content:W||(R?V?C(Xe,{narrow:H,conversationShown:!H&&n&&ie===`conversation`,onOpenRail:()=>U(`conversation`),conversation:J,children:C(R.panel,{...T})},R.id):C(R.panel,{...T}):k?C(Dt,{}):C(p,{renderTurn:on,showThinking:!1,scrollerClassName:`px-[max(1rem,calc((100%-896px)/2))]`})),composer:W?null:R?R.retainComposer===!0&&!V?me(z):null:k?null:me(),controls:G&&!K?C(oe,{}):null,settings:q?C(Be,{onClose:()=>m(!1)}):null,sheet:W||R||k?null:C(Qt,{}),activity:W?null:C(mt,{scope:R===I&&I?.targetSessionId!==void 0?I.activityScope:void 0,conversation:V&&!H&&n?J:void 0,conversationBeside:V?I?.asideFace:void 0,conversationLabel:V?R?.label:void 0,onClose:fe,onOpenContent:g})}}),C(te,{}),W?null:C(Yt,{sessionId:E,onReveal:U})]})}function hn({isSignedInWorkerOrigin:e=!1,accountSettings:n,homeHosts:r,hostManagement:i=`unavailable`}={}){bt();let{section:a,workspaceId:o}=Ne(),s=Ke(),c=B(Le,e=>e.activeId),[l,u]=Z(),[d,f]=Z(!1),[p,m]=Y(`settings/template-target`,`global`),h=i===`available`,g=ut(a,e,{canManageHosts:h}),_=g?.workspace??(a?.startsWith(`repository-`)?`repository`:`general`);return x(()=>{if(g||a===`hosts`&&i===`loading`||_===`repository`&&!d)return;let t=!1;return Oe().then(()=>{if(t||ut(a,e,{canManageHosts:h}))return;let n=W(a);s(n===void 0?{to:`/settings/$section`,params:{section:Ye},search:{workspace:o},replace:!0}:{to:`/plugins/$pluginId`,params:{pluginId:n},search:{workspace:o},hash:`settings`,replace:!0})}).catch(e=>{t||u(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[g,a,s,_,o,d,i,h,e]),N(`div`,{"data-testid":`settings`,"data-po-region":`content`,className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-po-bg [--po-backdrop-blur:0px]`,children:[N(`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:[C(`h1`,{className:`order-1 min-w-0 truncate text-xl font-semibold text-po-hi sm:order-none`,children:`Settings`}),N(`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:[C(xe,{asChild:!0,active:_===`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":_===`general`?`true`:void 0,children:C(dt,{to:`/settings/$section`,params:{section:Ye},search:{workspace:o},"data-testid":`settings-workspace-general`,children:`General`})}),C(xe,{asChild:!0,active:_===`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":_===`repository`?`true`:void 0,children:C(dt,{to:`/settings/$section`,params:{section:q},search:{workspace:o},"data-testid":`settings-workspace-repository`,children:`Workspaces`})})]}),C(t,{asChild:!0,variant:`outline`,size:`sm`,className:`order-2 gap-1.5 sm:order-none sm:justify-self-end`,children:c===null?N(dt,{to:`/`,"data-testid":`settings-close`,children:[C(Ie,{"aria-hidden":!0,className:`size-3.5`}),`Back`]}):N(dt,{to:`/session/$sessionId`,params:{sessionId:c},"data-testid":`settings-close`,children:[C(Ie,{"aria-hidden":!0,className:`size-3.5`}),C(`span`,{className:`sm:hidden`,children:`Back`}),C(`span`,{className:`hidden sm:inline`,children:`Back to session`})]})})]}),C(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:_===`repository`?C(vt,{current:g??{id:a??``,label:``,detail:``,workspace:`repository`},initialRepositoryId:o,onRepositoryChange:e=>{s({to:`/settings/$section`,params:{section:g?.id??a??q},search:{workspace:e},replace:!0})},onReady:f},o??`remembered-workspace`):N(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[C(Re,{hosts:r,isSignedInWorkerOrigin:e,canManageHosts:h,active:g?.id,workspace:`general`,repositoryId:o}),C(`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:N(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-8`,children:[!g&&l?C(`p`,{role:`alert`,children:l}):null,a===`hosts`&&i===`loading`?C(`p`,{role:`status`,children:`Checking host access…`}):null,g?.id===`hosts`?C(ke,{}):null,g?.id===`account-preferences`?n??C(`p`,{children:`Account settings are read-only on this host.`}):null,g?.id===`account`?C(it,{}):null,g?.id===`providers`?C(H,{}):null,g?.id===`devices`?C(xt,{}):null,g?.id===`appearance`?C(Pe,{templateTarget:p,onTemplateTargetChange:m}):null,g?.id===`notifications`?C(je,{}):null,g?.id===`images`?C(et,{}):null,g?.id===`presets`?C(be,{}):null,g?.contribution===void 0?null:C(_e,{section:g.contribution,scope:`host`}),g?.panel===void 0?null:C(P,{panel:g.panel})]})})]})})]})}var gn={thread:(e,t,n)=>C(R,{sessionId:e,threadId:t,options:n}),activity:(e,t)=>C(d,{sessionId:e,onOpenConversation:t}),transcript:(e,t)=>C(r,{sessionId:e,options:t,watch:le})};function _n({isSignedInWorkerOrigin:e=!1,accountSettings:t,homeHosts:n,hostManagement:r}={}){let i=Ne(),a=B(Le,e=>e.activeId);return N(Ue,{value:gn,children:[i.kind===`settings`?C(hn,{homeHosts:n,isSignedInWorkerOrigin:e,hostManagement:r,accountSettings:t}):C(mn,{homeHosts:n}),C(st,{}),C(o,{}),C(s,{}),C(gt,{slot:L.overlay,sessionId:a})]})}function vn(){return N(`div`,{className:`flex size-full flex-col`,children:[C(`div`,{className:`flex h-3 items-center gap-1 border-b border-po-border px-1.5`,children:C(`span`,{className:`h-1 w-1/5 rounded-full bg-po-dim`})}),N(`div`,{className:`mx-auto flex w-3/5 flex-1 flex-col justify-between py-2`,children:[N(`div`,{className:`flex flex-col gap-1`,children:[C(`span`,{className:`h-1.5 w-1/3 self-end rounded-full bg-po-border`}),C(`span`,{className:`h-1 w-3/4 rounded-full bg-po-dim`}),C(`span`,{className:`h-1 w-2/3 rounded-full bg-po-faint`})]}),C(`span`,{className:`h-3 w-full rounded-sm border border-po-border bg-po-panel`})]})]})}var yn={label:`Elegant`,description:`A focused conversation with collapsible navigation, session controls, and activity.`,contractVersion:3,app:_n,preview:vn},bn=O(yn),xn=O(yn),Sn=O(yn),Cn=(e,t)=>t===void 0?void 0:{...e,...t},wn=_({id:`template-elegant`,packageName:`@agimon-ai/po-template-elegant`,host:{get templates(){return[Cn({id:`po-template-elegant`},bn)]}},workspace:{get templates(){return[Cn({id:`po-template-elegant`},xn)]}},session:{get templates(){return[Cn({id:`po-template-elegant`},Sn)]}}});export{wn as webPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$r as e,Aa as t,At as n,Bt as r,Dr as i,Ft as a,Ga as o,Gi as s,Ht as c,It as l,Jn as u,Jr as d,Ki as f,La as p,Lt as m,Mr as h,Nr as g,Si as _,Sn as v,Wi as y,Xi as b,Yi as x,Zi as S,_r as C,an as w,ca as T,dr as E,ea as D,fr as O,gr as k,hr as A,ia as ee,jn as te,ka as j,ln as M,lr as ne,mr as re,na as ie,oa as ae,or as N,pr as oe,qi as P,qt as F,ra as I,rn as se,ti as ce,tn as L,ur as le,vr as ue,wn as R,yr as de}from"../chunks/po-web-runtime-D8FIos2q.js";var z=`/api/plugins/vault/entries`,B=`secrets`,fe=/^[A-Z][A-Z0-9_]{0,63}$/u,V=`The request did not reach Po on your computer.`,H={namespace:``,key:``,value:``},U={"content-type":`application/json`};async function pe(e){let t=await e.json().catch(()=>void 0);return{error:typeof t?.error==`string`?t.error:`Po answered ${e.status}.`,...t?.field?{field:t.field}:{}}}function me({request:e,requestWithStepUp:t}){let[n,i]=F(),[a,o]=F(),[s,l]=F(``),[u,d]=F(),[f,p]=F(H),[m,h]=F(!1),[g,_]=F(),[v,y]=F(!1),b=r(async()=>{try{let t=await e(z);if(!t.ok)throw Error((await pe(t)).error);i(await t.json()),o(void 0)}catch(e){o(e instanceof Error?e.message:V)}},[e]);c(()=>{b()},[b]);let x=(e,t=H)=>{p(t),_(void 0),d(e)},S=n?.protection===`account`,C=e=>e.kind===`remove`?t(`${z}?${new URLSearchParams({namespace:e.entry.namespace,key:e.entry.key,revision:String(e.entry.revision),shared:String(e.entry.shared)}).toString()}`,{method:`DELETE`}):e.kind===`move`?t(`${z}/move`,{method:`POST`,headers:U,body:JSON.stringify({namespace:e.entry.namespace,key:e.entry.key,revision:e.entry.revision,shared:!e.entry.shared})}):t(z,{method:`PUT`,headers:U,body:JSON.stringify({namespace:f.namespace.trim(),key:f.key,text:f.value,expectRevision:e.kind===`replace`?e.entry.revision:null,shared:e.kind===`replace`?e.entry.shared:S||m})}),w=async()=>{if(u&&!v){y(!0);try{let e=await C(u);if(!e.ok){let t=await pe(e);_({field:t.field??`form`,message:t.error});return}d(void 0),p(H),await b()}catch{_({field:`form`,message:V})}finally{y(!1)}}};return{...n?{protection:n.protection,account:n.account,entries:n.entries}:{},...a?{error:a}:{},query:s,...u?{dialog:u}:{},draft:f,shareNew:m,...g?{draftError:g}:{},busy:v,onQueryChange:l,onAdd:()=>{h(!1),x({kind:`add`})},onReplace:e=>x({kind:`replace`,entry:e},{namespace:e.namespace,key:e.key,value:``}),onRemove:e=>x({kind:`remove`,entry:e}),onMove:e=>x({kind:`move`,entry:e}),onDraftChange:(e,t)=>{p(n=>({...n,[e]:t})),_(void 0)},onShareNewChange:h,onSubmit:()=>void w(),onCancel:()=>{v||d(void 0)},onRetry:()=>void b()}}var he=new Intl.DateTimeFormat(`en-GB`,{dateStyle:`medium`,timeZone:`UTC`});function W(e){return`${e.namespace}/${e.key}`}function ge(e,t){let n=t.trim().toLowerCase();return!n||W(e).toLowerCase().includes(n)}function _e(e){return`Updated ${he.format(new Date(e.updatedAt))} · revision ${e.revision}`}function ve(e){return e.length===1?`1 saved`:`${e.length} saved`}var ye={keyring:{badge:`Protected`,title:`Key kept in your system keychain`,detail:`Every secret is encrypted in Po’s database. The key that opens them stays in the keychain, never in a file.`},file:{badge:`File key`,title:`Key kept in a file next to your secrets`,detail:`This computer has no system keychain, so the key lives in vault/key.bin in your Po folder. Anyone who can read that folder can read your secrets.`},loading:{badge:`Checking`,title:`Opening the vault`,detail:`Po is loading the key that protects your secrets.`},closed:{badge:`Not opened yet`,title:`Opens the first time Po needs a secret`,detail:`The key that protects your secrets loads when a sign-in or a plugin first asks for one, or when you add a secret here.`},account:{badge:`In your account`,title:`Secrets kept in your Po account`,detail:`Every secret is encrypted in your account and opens only inside Po. Every Po signed in to this account can use them.`},unavailable:{badge:`Unavailable`,title:`Po could not open the vault`,detail:`Saved secrets are untouched. Sign-ins that need them wait until the vault opens again.`}},G={values:`Values are never shown here. Replace a secret to change it.`,add:`Saved encrypted on this computer. You will not be able to read it back here.`,addShared:`Saved encrypted in your Po account. You will not be able to read it back here.`,value:`Text, or JSON for structured values. Up to 64 KiB.`,namespace:`Usually the plugin that uses it, such as agiflow or mcp.github.`,remove:`The plugin that uses it will ask you to sign in again the next time it needs it.`,removeShared:`Every Po signed in to your account loses it. The plugin that uses it will ask you to sign in again.`,share:`Share with your account`,shareHint:`Every Po signed in to your account can use it, including Po Cloud.`},K={device:{title:`On this computer`,empty:`Nothing kept only on this computer.`},shared:{title:`Shared with your account`,empty:`Nothing shared yet. Share a secret from its menu.`}};function q(e){return e.shared?{menu:`Keep on this computer only`,title:`Keep on this computer only?`,detail:`Only this computer can use it. Other Po signed in to your account lose it.`,confirm:`Keep on this computer`,busy:`Moving…`}:{menu:`Share with your account`,title:`Share with your account?`,detail:`Every Po signed in to your account can use it, including Po Cloud. It leaves this computer’s vault.`,confirm:`Share secret`,busy:`Sharing…`}}var be={keyring:`size-4 text-po-green`,file:`size-4 text-po-yellow`,loading:`size-4 text-po-dim`,closed:`size-4 text-po-dim`,account:`size-4 text-po-green`,unavailable:`size-4 text-po-red`},xe={keyring:`ok`,file:`running`,loading:`neutral`,closed:`neutral`,account:`ok`,unavailable:`error`};function Se(t){let{children:n,protection:r,entries:o,error:s,query:c,busy:d}=t,f=s?`unavailable`:r??`loading`,p=ye[f],h=o!==void 0&&!s,_=o?.filter(e=>ge(e,c))??[],v=t.account===!0&&r!==`account`;return m(E,{"aria-busy":o===void 0||d,children:[n?l(ne,{children:n}):null,m(k,{children:[l(ue,{children:l(de,{children:`Protection`})}),l(N,{children:m(O,{children:[l(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-po-deep`,children:l(i,{"aria-hidden":!0,className:be[f]})}),m(re,{children:[l(A,{children:p.title}),l(oe,{children:p.detail})]}),l(g,{tone:xe[f],children:p.badge})]})})]}),m(k,{children:[m(ue,{children:[l(de,{children:`Saved secrets`}),m(`div`,{className:`flex items-center gap-3`,children:[h&&o.length?l(`span`,{className:`text-sm text-po-dim`,children:ve(o)}):null,m(e,{variant:`primary`,disabled:!h||d,onClick:t.onAdd,children:[l(te,{className:`size-3.5`}),`Add secret`]})]}),l(C,{children:G.values})]}),s?m(`div`,{className:`flex flex-wrap items-center gap-3`,children:[l(`p`,{role:`alert`,className:`text-sm text-po-red`,children:s}),l(e,{variant:`ghost`,onClick:t.onRetry,children:`Try again`})]}):o===void 0?l(`p`,{role:`status`,className:`text-sm text-po-dim`,children:`Loading saved secrets…`}):o.length===0?l(T,{title:`No secrets saved yet`,description:`Po saves one when you sign in to a provider or a plugin asks for a key.`,className:`py-12`}):m(a,{children:[m(`div`,{className:`relative`,children:[l(u,{"aria-hidden":!0,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-po-dim`}),l(L,{type:`search`,"aria-label":`Search saved secrets`,placeholder:`Search by name`,className:`w-full pl-9`,value:c,onChange:e=>t.onQueryChange(e.target.value)})]}),_.length===0?m(le,{role:`status`,children:[`No saved secret matches “`,c.trim(),`”.`]}):v?[`device`,`shared`].map(e=>{let n=_.filter(t=>t.shared===(e===`shared`));return m(`div`,{className:`flex flex-col gap-2`,children:[l(`h3`,{className:`text-sm font-medium text-po-dim`,children:K[e].title}),n.length?l(Ce,{...t,label:K[e].title,entries:n,sharing:!0}):l(le,{children:K[e].empty})]},e)}):l(Ce,{...t,label:`Saved secrets`,entries:_,sharing:!1})]})]}),l(we,{...t})]})}function Ce({entries:t,label:n,sharing:r,busy:i,openMenu:a,onReplace:o,onRemove:s,onMove:c}){return l(N,{asChild:!0,children:l(`ul`,{"aria-label":n,children:t.map(t=>{let n=W(t);return l(O,{asChild:!0,children:m(`li`,{"data-testid":`vault-entry-${n}`,children:[l(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-po-deep`,children:l(M,{"aria-hidden":!0,className:`size-4 text-po-dim`})}),m(re,{children:[m(A,{className:`truncate font-mono first-letter:normal-case`,children:[t.namespace,m(`span`,{className:`text-po-dim`,children:[` / `,t.key]})]}),l(oe,{children:_e(t)})]}),m(D,{modal:!1,defaultOpen:a===n,children:[l(ae,{asChild:!0,children:l(e,{variant:`ghost`,size:`icon-md`,"aria-label":`Actions for ${n}`,disabled:i,children:l(se,{className:`size-4`})})}),m(ie,{align:`end`,children:[l(I,{onSelect:()=>o(t),children:`Replace value`}),r?l(I,{onSelect:()=>c(t),children:q(t).menu}):null,l(ee,{}),m(I,{variant:`destructive`,onSelect:()=>s(t),children:[l(ce,{className:`size-3.5`}),`Remove secret`]})]})]})]})},`${t.shared}:${n}`)})})})}function we({dialog:t,draft:n,draftError:r,busy:i,protection:o,account:c,shareNew:u,onDraftChange:p,onShareNewChange:h,onSubmit:g,onCancel:v}){let C=c===!0&&o!==`account`,T=o===`account`||C&&u,E=e=>r?.field===e?r.message:void 0,D=(e,t,r)=>{let a=E(e),o=a?`vault-${e}-error`:r?`vault-${e}-hint`:void 0,s=e===`value`?l(d,{id:`vault-${e}`,rows:4,className:`font-mono`,autoComplete:`off`,spellCheck:!1,value:n.value,disabled:i,"aria-invalid":a?!0:void 0,"aria-describedby":o,onChange:t=>p(e,t.target.value)}):l(L,{id:`vault-${e}`,className:`font-mono`,autoComplete:`off`,spellCheck:!1,value:n[e],disabled:i,"aria-invalid":a?!0:void 0,"aria-describedby":o,onChange:t=>p(e,t.target.value)});return m(`div`,{className:`flex flex-col gap-1.5`,children:[l(w,{htmlFor:`vault-${e}`,children:t}),s,a?l(`p`,{id:`vault-${e}-error`,role:`alert`,className:`text-sm text-po-red`,children:a}):r?l(`p`,{id:`vault-${e}-hint`,className:`text-sm text-po-dim`,children:r}):null]})},O=r?.field===`form`?l(`p`,{role:`alert`,className:`text-sm text-po-red`,children:r.message}):null;return l(y,{open:t!==void 0,onOpenChange:e=>e?void 0:v(),children:l(f,{children:t?.kind===`remove`?m(a,{children:[l(b,{children:m(S,{children:[`Remove `,l(`span`,{className:`font-mono`,children:W(t.entry)}),`?`]})}),m(s,{children:[l(P,{children:t.entry.shared?G.removeShared:G.remove}),O,m(x,{children:[l(e,{onClick:v,children:`Keep secret`}),l(e,{variant:`danger-outline`,disabled:i,onClick:g,children:i?`Removing…`:`Remove secret`})]})]})]}):t?.kind===`move`?m(a,{children:[l(b,{children:l(S,{children:q(t.entry).title})}),m(s,{children:[m(P,{children:[l(`span`,{className:`font-mono`,children:W(t.entry)}),`. `,q(t.entry).detail]}),O,m(x,{children:[l(e,{onClick:v,children:`Cancel`}),l(e,{variant:`primary`,disabled:i,onClick:g,children:i?q(t.entry).busy:q(t.entry).confirm})]})]})]}):t?m(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),g()},children:[l(b,{children:l(S,{children:t.kind===`add`?`Add a secret`:m(a,{children:[`Replace `,l(`span`,{className:`font-mono`,children:W(t.entry)})]})})}),m(s,{className:`gap-4`,children:[l(P,{children:t.kind===`replace`?t.entry.shared?G.addShared:G.add:T?G.addShared:G.add}),t.kind===`add`?m(a,{children:[D(`namespace`,`Namespace`,G.namespace),D(`key`,`Name`)]}):null,D(`value`,t.kind===`add`?`Value`:`New value`,G.value),t.kind===`add`&&C?m(`div`,{className:`flex items-start gap-2`,children:[l(_,{id:`vault-share`,className:`mt-0.5`,checked:u,disabled:i,"aria-describedby":`vault-share-hint`,onCheckedChange:e=>h(e===!0)}),m(`div`,{className:`flex flex-col gap-0.5`,children:[l(w,{htmlFor:`vault-share`,children:G.share}),l(`p`,{id:`vault-share-hint`,className:`text-sm text-po-dim`,children:G.shareHint})]})]}):null,O,m(x,{children:[l(e,{type:`button`,onClick:v,children:`Cancel`}),l(e,{type:`submit`,variant:`primary`,disabled:i,children:i?`Saving…`:t.kind===`add`?`Save secret`:`Replace value`})]})]})]}):null})})}function Te(e){return l(Se,{...me(e)})}var Ee=p({label:`Vault`,detail:`See which sign-ins, tokens and API keys Po keeps for you, and add, replace or remove them.`,order:15,icon:M,component:Te}),J=t(void 0);function De(){J.update(()=>!0)}function Oe(e){let t=()=>{J.store.state&&(J.reset(),e())},n=J.store.subscribe(t);return t(),()=>n.unsubscribe()}function ke(){return m(R,{role:`menuitem`,density:`compact`,"data-testid":`composer-menu-secret`,className:`w-full text-po-text hover:bg-po-tint-blue`,onClick:De,children:[l(M,{className:`h-3 w-3 shrink-0`}),l(v,{density:`compact`,children:`Secret`})]})}var Ae=j({component:ke}),je=(e,t)=>n.fetch(e,t),Y={name:``,value:``,sites:``,iosApps:``,macApps:``},Me=/[\s,]+/u,Ne=/^[a-z][a-z0-9+.-]*:\/\//iu,Pe=/^[A-Za-z0-9][A-Za-z0-9.-]{0,254}$/u,X={name:`Use capital letters, digits and _, starting with a letter, such as GITHUB_LOGIN.`,value:`Enter the secret.`,where:`Add the site it signs in to, so Po types it nowhere else.`,app:`Use app bundle ids, such as com.example.app.`};function Z(e){return`{{ secrets.${e} }}`}function Fe(e){return e.toUpperCase().replace(/[^A-Z0-9_]+/gu,`_`)}function Ie(e){return e.entries.filter(e=>e.namespace===B).map(e=>({name:e.key,shared:e.shared}))}function Q(e){return[...new Set(e.split(Me).filter(Boolean))]}function Le(e){let t=Ne.test(e)?e:`https://${e}`;if(t.includes(`*`)||!URL.canParse(t))return;let n=new URL(t);if(!(n.protocol!==`https:`&&n.protocol!==`http:`||n.username||n.password))return n.origin}function Re(e,t){let n=(e,t)=>({ok:!1,field:e,message:t});if(!fe.test(e.name))return n(`name`,X.name);if(e.value===``)return n(`value`,X.value);let r=Q(e.sites),i=[];for(let e of r){let t=Le(e);if(t===void 0)return n(`sites`,`“${e}” is not a web address, such as github.com.`);i.push(t)}let a=Q(e.iosApps),o=Q(e.macApps);if(!a.every(e=>Pe.test(e)))return n(`iosApps`,X.app);if(!o.every(e=>Pe.test(e)))return n(`macApps`,X.app);let s=a.length>0||o.length>0;if(i.length===0&&!s)return n(`sites`,X.where);let c={value:e.value,purposes:[...i.length>0?[`browser`]:[],...s?[`input`]:[]],...i.length>0?{allowedOrigins:[...new Set(i)]}:{},...s?{allowedTargets:{...a.length>0?{ios:a}:{},...o.length>0?{computer:o}:{}}}:{}};return{ok:!0,request:{namespace:B,key:e.name,text:JSON.stringify(c),expectRevision:null,shared:t}}}var ze={name:{label:`Name`},value:{label:`Secret`,secret:!0},sites:{label:`Sites`,hint:`Where Po may type it, such as github.com. Separate several with commas.`},iosApps:{label:`iPhone apps (optional)`,hint:`App bundle ids, such as com.example.app.`},macApps:{label:`Mac apps (optional)`,hint:`App bundle ids, such as com.example.desktop.`}};function Be({open:t,onOpenChange:n,secrets:r,error:i,account:o,mode:c,draft:u,draftError:d,shareNew:p,busy:g,onPick:C,onAdd:E,onBack:D,onDraftChange:O,onShareNewChange:k,onSubmit:A,onRetry:ee}){let j=e=>{let{label:t,hint:n,secret:r}=ze[e],i=d?.field===e?d.message:void 0,a=e===`name`?`Prompts use it as ${Z(u.name||`NAME`)}.`:n,o=i?`secret-${e}-error`:a?`secret-${e}-hint`:void 0;return m(`div`,{className:`flex flex-col gap-1.5`,children:[l(w,{htmlFor:`secret-${e}`,children:t}),l(L,{id:`secret-${e}`,type:r?`password`:`text`,className:r?void 0:`font-mono`,autoComplete:r?`new-password`:`off`,spellCheck:!1,value:u[e],disabled:g,"aria-invalid":i?!0:void 0,"aria-describedby":o,onChange:t=>O(e,t.target.value)}),i?l(`p`,{id:`secret-${e}-error`,role:`alert`,className:`text-sm text-po-red`,children:i}):a?l(`p`,{id:`secret-${e}-hint`,className:`text-sm text-po-dim`,children:a}):null]})},ne=i?m(`div`,{className:`flex items-center justify-between gap-3`,children:[l(`p`,{role:`alert`,className:`text-sm text-po-red`,children:i}),l(e,{onClick:ee,children:`Try again`})]}):r===void 0?l(h,{label:`Loading secrets`}):r.length===0?l(T,{title:`No saved secrets`,description:`Save a password or key once, then attach it to any prompt.`}):l(`div`,{role:`list`,className:`flex max-h-72 flex-col overflow-y-auto`,children:r.map(e=>l(`div`,{role:`listitem`,children:m(R,{density:`compact`,"data-testid":`secret-pick-${e.name}`,className:`w-full text-po-text hover:bg-po-tint-blue`,onClick:()=>C(e.name),children:[l(M,{className:`h-3 w-3 shrink-0 text-po-dim`}),l(v,{density:`compact`,className:`font-mono`,children:e.name}),e.shared?l(`span`,{className:`ml-auto text-xs text-po-dim`,children:`Shared`}):null]})},e.name))});return l(y,{open:t,onOpenChange:e=>g?void 0:n(e),children:l(f,{"data-testid":`secret-dialog`,children:c===`pick`?m(a,{children:[l(b,{children:l(S,{children:`Attach a secret`})}),m(s,{className:`gap-4`,children:[l(P,{children:`The agent gets its name, never the value. Po types it only on the sites and apps saved with it.`}),ne,m(x,{children:[l(e,{onClick:()=>n(!1),children:`Cancel`}),m(e,{variant:r?.length===0?`primary`:void 0,onClick:E,children:[l(te,{className:`h-3 w-3`}),`New secret`]})]})]})]}):m(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),A()},children:[l(b,{children:l(S,{children:`Save a secret`})}),m(s,{className:`gap-4`,children:[l(P,{children:p&&o?`Saved encrypted in your Po account. Po types it only where you list below.`:`Saved encrypted on this computer. Po types it only where you list below.`}),j(`name`),j(`value`),j(`sites`),j(`iosApps`),j(`macApps`),o?m(`div`,{className:`flex items-start gap-2`,children:[l(_,{id:`secret-share`,className:`mt-0.5`,checked:p,disabled:g,"aria-describedby":`secret-share-hint`,onCheckedChange:e=>k(e===!0)}),m(`div`,{className:`flex flex-col gap-0.5`,children:[l(w,{htmlFor:`secret-share`,children:`Share with your account`}),l(`p`,{id:`secret-share-hint`,className:`text-sm text-po-dim`,children:`Every Po signed in to your account can use it, including Po Cloud.`})]})]}):null,d?.field===`form`?l(`p`,{role:`alert`,className:`text-sm text-po-red`,children:d.message}):null,m(x,{children:[l(e,{type:`button`,disabled:g,onClick:D,children:`Back`}),l(e,{type:`submit`,variant:`primary`,disabled:g,children:g?`Saving…`:`Save and attach`})]})]})]})})})}var Ve=`The request did not reach Po on your computer.`;async function He(e){let t=await e.json().catch(()=>void 0);return{...t,error:typeof t?.error==`string`?t.error:`Po answered ${e.status}.`}}function Ue(e,t,n=!0){let[i,a]=F(),[o,s]=F(!1),[l,u]=F(),[d,f]=F(`pick`),[p,m]=F(Y),[h,g]=F(),[_,v]=F(!1),[y,b]=F(!1),x=r(async()=>{try{let t=await e(z);if(!t.ok)throw Error((await He(t)).error);let n=await t.json();a(Ie(n)),s(n.account),u(void 0)}catch(e){u(e instanceof Error?e.message:Ve)}},[e]);c(()=>{n&&(f(`pick`),g(void 0),x())},[n,x]);let S=async()=>{if(y)return;let n=Re(p,o&&_);if(!n.ok)g({field:n.field,message:n.message});else{b(!0);try{let r=await e(z,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(n.request)});if(!r.ok){let e=await He(r),t=e.field===`key`?`name`:e.field===`value`?`value`:`form`;g({field:t,message:e.error});return}t(Z(p.name)),m(Y),f(`pick`),x()}catch{g({field:`form`,message:Ve})}finally{b(!1)}}};return{...i?{secrets:i}:{},...l?{error:l}:{},account:o,mode:d,draft:p,...h?{draftError:h}:{},shareNew:_,busy:y,onPick:e=>t(Z(e)),onAdd:()=>{m(Y),g(void 0),v(!1),f(`add`)},onBack:()=>{y||f(`pick`)},onDraftChange:(e,t)=>{m(n=>({...n,[e]:e===`name`?Fe(t):t})),g(void 0)},onShareNewChange:v,onSubmit:()=>void S(),onRetry:()=>void x()}}function We({appendComposerDraft:e}){let[t,n]=F(!1);c(()=>Oe(()=>n(!0)),[]);let i=Ue(je,r(t=>{e(t),n(!1)},[e]),t);return l(Be,{open:t,onOpenChange:n,...i})}var Ge=j({component:We}),$=(e,t)=>t===void 0?void 0:{...e,...t},Ke=o({id:`vault`,packageName:`@agimon-ai/po-vault`,host:{get settingsPanels(){return[$({id:`vault`},Ee)]}},session:{get fills(){return[$({slot:`composer-menu`,id:`secret`},Ae),$({slot:`overlay`,id:`secret-dialog`},Ge)]}}});export{Ke as webPlugin};
|