@ensocode/server 0.3.15-beta.239 → 0.3.15-beta.240
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/out/phone/assets/{EditDiff-CZAwhdT_.js → EditDiff-XiL-l5PI.js} +1 -1
- package/out/phone/assets/{ReadFileView-mh_jsUup.js → ReadFileView-CpFSSRpt.js} +1 -1
- package/out/phone/assets/{abnfDiagram-VCTEODGH-DtD268_6.js → abnfDiagram-VCTEODGH-DazQZSv_.js} +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-BuIF9Mkk.js +1 -0
- package/out/phone/assets/{architectureDiagram-5GKGNRK7-B-aYOAqp.js → architectureDiagram-5GKGNRK7-DG5K6Su1.js} +1 -1
- package/out/phone/assets/{blockDiagram-I7D4REHJ-CHvgs9_4.js → blockDiagram-I7D4REHJ-ajgyqJXe.js} +1 -1
- package/out/phone/assets/{c4Diagram-7LVT6UL2-DQZM5IBy.js → c4Diagram-7LVT6UL2-qHAVjxM_.js} +1 -1
- package/out/phone/assets/channel-vHP6f3Jd.js +1 -0
- package/out/phone/assets/{chunk-4HAMMTFA-C4MaRcS_.js → chunk-4HAMMTFA-u69nZNu9.js} +1 -1
- package/out/phone/assets/{chunk-75Z2AOVW-CUJqmHkI.js → chunk-75Z2AOVW-kY4F26Wh.js} +1 -1
- package/out/phone/assets/{chunk-DU6HZSFF-DtNotje4.js → chunk-DU6HZSFF-BgKQRmB0.js} +1 -1
- package/out/phone/assets/{chunk-F27PBJKO-C3VQP_G-.js → chunk-F27PBJKO-c1ETtt2d.js} +1 -1
- package/out/phone/assets/{chunk-GMAD6QVW-BAx6DPiq.js → chunk-GMAD6QVW-DdXUBdDH.js} +1 -1
- package/out/phone/assets/{chunk-GVQU2GXP-BOcjR7pN.js → chunk-GVQU2GXP-dKT6pw8a.js} +1 -1
- package/out/phone/assets/{chunk-IMKFNOWR-Ca86q7OY.js → chunk-IMKFNOWR-DvdOmIA1.js} +1 -1
- package/out/phone/assets/{chunk-L3NEJ4N5-CfYUzC3j.js → chunk-L3NEJ4N5-BxVxA1MI.js} +1 -1
- package/out/phone/assets/{chunk-OSK3NFVY-CNP8QwPS.js → chunk-OSK3NFVY-BUQykTA7.js} +1 -1
- package/out/phone/assets/{chunk-P2QGCYS3-P5bFoLeX.js → chunk-P2QGCYS3-PEfAPaln.js} +1 -1
- package/out/phone/assets/{chunk-POPQ4Y6H-CJomhwpw.js → chunk-POPQ4Y6H-BFPZeUpT.js} +1 -1
- package/out/phone/assets/{chunk-PWAF6VOD-DyMTCGaK.js → chunk-PWAF6VOD-hSMQrZMV.js} +1 -1
- package/out/phone/assets/{chunk-SHT3W25Y-mJ2zPnam.js → chunk-SHT3W25Y-k9LZnAbd.js} +1 -1
- package/out/phone/assets/{chunk-SVP7TREG-CdYqcKmY.js → chunk-SVP7TREG-BuSNDJ4M.js} +1 -1
- package/out/phone/assets/{chunk-TICWLB2K-z-k2311x.js → chunk-TICWLB2K-CenNvPLg.js} +1 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-BaifMI8p.js +1 -0
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-BaifMI8p.js +1 -0
- package/out/phone/assets/{codeHighlighter-ofRh4xLX.js → codeHighlighter-Vw6QAm1k.js} +1 -1
- package/out/phone/assets/{cynefin-OW5HDTMX-B8wb0nU4.js → cynefin-OW5HDTMX-DFvQp9Qe.js} +1 -1
- package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-BtGcxp6l.js → cynefinDiagram-5FMLGOSQ-DznqjwdD.js} +1 -1
- package/out/phone/assets/{dagre-GXQ25YYZ-C2lcoUd4.js → dagre-GXQ25YYZ-Co1sLXqm.js} +1 -1
- package/out/phone/assets/{desk-CS8nrm0j.js → desk-YcsUZG7u.js} +1 -1
- package/out/phone/assets/{diagram-S7CK7UJ4-DEbZ0g_a.js → diagram-S7CK7UJ4-BVZwukFL.js} +1 -1
- package/out/phone/assets/{diagram-UQ7AKVKN-CIRb6Yut.js → diagram-UQ7AKVKN-FnuPXxn9.js} +1 -1
- package/out/phone/assets/{diagram-VSXAHHWV-q1goodaw.js → diagram-VSXAHHWV-CL0_vSmH.js} +1 -1
- package/out/phone/assets/{diagram-VX7I27RA-B_haM3ye.js → diagram-VX7I27RA-CBWnoa7C.js} +1 -1
- package/out/phone/assets/{diagram-Z3DM3KII-DGxZgza1.js → diagram-Z3DM3KII-DP2i6Nab.js} +1 -1
- package/out/phone/assets/{ebnfDiagram-PWID7BFC-Dz-a1GEk.js → ebnfDiagram-PWID7BFC-AzdUDwlS.js} +1 -1
- package/out/phone/assets/{erDiagram-RLTQ6QDP-C3Q1YeMJ.js → erDiagram-RLTQ6QDP-Dsf_M2LC.js} +1 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-DJUGNkPF.js +1 -0
- package/out/phone/assets/flowDiagram-HODETNUW-CEnrRqZZ.js +1 -0
- package/out/phone/assets/{ganttDiagram-EL5Y4UJY-B-KFaZt7.js → ganttDiagram-EL5Y4UJY-XRioaZLM.js} +1 -1
- package/out/phone/assets/{gitGraph-4MIJSDKK-6p4ChxFy.js → gitGraph-4MIJSDKK-D0ivix8u.js} +1 -1
- package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-0xHp9wXD.js → gitGraphDiagram-WWUBYQGX-CqmFJCAU.js} +1 -1
- package/out/phone/assets/{info-A6RAGUB7-D1A4c4Sg.js → info-A6RAGUB7-BZ69g_fw.js} +1 -1
- package/out/phone/assets/{infoDiagram-27XIBGKW-DoeS9mLn.js → infoDiagram-27XIBGKW-aYsMvhe5.js} +1 -1
- package/out/phone/assets/{ishikawaDiagram-5VMMS53U-Ch3u7Wz6.js → ishikawaDiagram-5VMMS53U-CmBVBjJT.js} +1 -1
- package/out/phone/assets/{journeyDiagram-3NMN7TZE-CULvGf6o.js → journeyDiagram-3NMN7TZE-BoY_lC0j.js} +1 -1
- package/out/phone/assets/{kanban-definition-UXKFOSKX-S1gQlAUD.js → kanban-definition-UXKFOSKX-B5aEO9tu.js} +1 -1
- package/out/phone/assets/{line-Cm7lFbjW.js → line-D57BAt5Y.js} +1 -1
- package/out/phone/assets/{main-DdEaoHYI.js → main-BZYGEXQW.js} +4 -4
- package/out/phone/assets/{mermaid-parser.core-gQDTUPnF.js → mermaid-parser.core-DHwLXlJr.js} +3 -3
- package/out/phone/assets/{mermaid.core-CYOjADrb.js → mermaid.core-jjfo4hhh.js} +4 -4
- package/out/phone/assets/{mindmap-definition-YA3MSWOX-CN7sy__W.js → mindmap-definition-YA3MSWOX-4Kk3P_nC.js} +1 -1
- package/out/phone/assets/{packet-AYTQ26CC-DmgSr7TL.js → packet-AYTQ26CC-Bbt8I8of.js} +1 -1
- package/out/phone/assets/{pegDiagram-XKGWAZYB-B02NL9ni.js → pegDiagram-XKGWAZYB-D9TJYzFE.js} +1 -1
- package/out/phone/assets/{pie-WAS4IAKB-5pPjCq92.js → pie-WAS4IAKB-CpRv0soJ.js} +1 -1
- package/out/phone/assets/{pieDiagram-E7YTZNPT-DutkXKUS.js → pieDiagram-E7YTZNPT-wsiDXZiI.js} +1 -1
- package/out/phone/assets/{quadrantDiagram-AXDQQJYC-DUDIkWVS.js → quadrantDiagram-AXDQQJYC-Q6yFFpVe.js} +1 -1
- package/out/phone/assets/{radar-RG4KPBEZ-DC-CtYET.js → radar-RG4KPBEZ-D03KgP_q.js} +1 -1
- package/out/phone/assets/{railroad-74A4TZTK-Bhfj7gvp.js → railroad-74A4TZTK-BLFYq0jd.js} +1 -1
- package/out/phone/assets/railroad-abnf-HS5TGJTU-BnGgFPSB.js +1 -0
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-BZD06tbs.js +1 -0
- package/out/phone/assets/railroad-peg-WCYAUIDC-DhA8WMVS.js +1 -0
- package/out/phone/assets/{railroadDiagram-O6MQD6OU-DlFKdEYr.js → railroadDiagram-O6MQD6OU-ZdYiXn62.js} +1 -1
- package/out/phone/assets/{requirementDiagram-BXWQKSXE-DgHN5by1.js → requirementDiagram-BXWQKSXE-B_7vc64X.js} +1 -1
- package/out/phone/assets/{sankeyDiagram-P5KCCOFB-CgipqlWt.js → sankeyDiagram-P5KCCOFB-4n6yLwLB.js} +1 -1
- package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-UgZtILgO.js → sequenceDiagram-WJ2MYXX4-C_l-LHIg.js} +1 -1
- package/out/phone/assets/{stateDiagram-D77RDMKH-B3x2H6vo.js → stateDiagram-D77RDMKH-CgPcsrGk.js} +1 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-Cd0PzZb6.js +1 -0
- package/out/phone/assets/{swimlanes-42K2YHIH-DzeY11R8.js → swimlanes-42K2YHIH-DXhwzVlA.js} +1 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-B2aaipbb.js +8 -0
- package/out/phone/assets/{timeline-definition-24CTP7MA-0wZixfql.js → timeline-definition-24CTP7MA-Dhqcybib.js} +1 -1
- package/out/phone/assets/{treeView-Q6P3EWNA-w394XCr0.js → treeView-Q6P3EWNA-D944lb0J.js} +1 -1
- package/out/phone/assets/{treemap-WGGIJYW6-D2Zai2pY.js → treemap-WGGIJYW6-SvjVIc_e.js} +1 -1
- package/out/phone/assets/{vennDiagram-4TSXK5OY-JvkpTZVg.js → vennDiagram-4TSXK5OY-BoJHneQg.js} +1 -1
- package/out/phone/assets/{wardley-WFR3VGLG-CnIC0T3M.js → wardley-WFR3VGLG-BooUrlYZ.js} +1 -1
- package/out/phone/assets/{wardleyDiagram-VM6X3IG4-Irrj8RCE.js → wardleyDiagram-VM6X3IG4-BGNB94BV.js} +1 -1
- package/out/phone/assets/{xychartDiagram-S5SC5T6Z-BmtiUEnA.js → xychartDiagram-S5SC5T6Z-cwmBbDMK.js} +1 -1
- package/out/phone/desk.html +2 -2
- package/out/phone/index.html +2 -2
- package/out/phone/sw.js +2 -2
- package/out/renderer/assets/{EditDiff-DqoogY4S.js → EditDiff-C5tSOQb2.js} +1 -1
- package/out/renderer/assets/{ReadFileView-uORu2Gdg.js → ReadFileView-VbAe6o1G.js} +1 -1
- package/out/renderer/assets/{SidePanel-Dnt_MZWO.js → SidePanel-BGXusuy3.js} +1 -1
- package/out/renderer/assets/{abnfDiagram-VCTEODGH-BPj3_SYP.js → abnfDiagram-VCTEODGH-BxdReQfq.js} +1 -1
- package/out/renderer/assets/{arc-Bm9xu1Wo.js → arc-8V7jHSRR.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-5GKGNRK7-BfOWydj9.js → architectureDiagram-5GKGNRK7-o4VFatqe.js} +1 -1
- package/out/renderer/assets/{blockDiagram-I7D4REHJ-7iL_f9Py.js → blockDiagram-I7D4REHJ-yNuNnW72.js} +1 -1
- package/out/renderer/assets/{c4Diagram-7LVT6UL2-C-e_tKvj.js → c4Diagram-7LVT6UL2-B3IZXQYK.js} +1 -1
- package/out/renderer/assets/channel-67Lz8TBw.js +1 -0
- package/out/renderer/assets/{chunk-2Q5K7J3B-D4GmLDBL.js → chunk-2Q5K7J3B-DlsQFyyV.js} +1 -1
- package/out/renderer/assets/{chunk-5VM5RSS4-ukWkkavu.js → chunk-5VM5RSS4-Du1d7WRE.js} +1 -1
- package/out/renderer/assets/{chunk-F27PBJKO-72i3iG2c.js → chunk-F27PBJKO-BHG4Cmdu.js} +1 -1
- package/out/renderer/assets/{chunk-IMKFNOWR-C1LBOV6P.js → chunk-IMKFNOWR-BnSfItoF.js} +1 -1
- package/out/renderer/assets/{chunk-JWPE2WC7-D0xDlqyh.js → chunk-JWPE2WC7-BC8tfm2i.js} +1 -1
- package/out/renderer/assets/{chunk-POPQ4Y6H-Qv-ey-sB.js → chunk-POPQ4Y6H-UsUDNVEz.js} +1 -1
- package/out/renderer/assets/{chunk-SVP7TREG-DcXPcP-s.js → chunk-SVP7TREG-Bgkn_YQq.js} +1 -1
- package/out/renderer/assets/{chunk-TICWLB2K-LPyGLuzJ.js → chunk-TICWLB2K-BqUXAsWB.js} +1 -1
- package/out/renderer/assets/{chunk-XXDRQBXY-BIVCIrOg.js → chunk-XXDRQBXY-LfY-ZzDR.js} +1 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-Brn4il5L.js +1 -0
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-Brn4il5L.js +1 -0
- package/out/renderer/assets/{cose-bilkent-JH36ORCC-DXibAGYE.js → cose-bilkent-JH36ORCC-CgtI1_Gy.js} +1 -1
- package/out/renderer/assets/{cynefin-OW5HDTMX-Dt-aNI5c.js → cynefin-OW5HDTMX-DLFr8vmt.js} +1 -1
- package/out/renderer/assets/{cynefinDiagram-5FMLGOSQ-BXDhU25n.js → cynefinDiagram-5FMLGOSQ-BcT60hkk.js} +1 -1
- package/out/renderer/assets/{dagre-GXQ25YYZ-H3A9EYBH.js → dagre-GXQ25YYZ-48Dz0fF7.js} +1 -1
- package/out/renderer/assets/{diagram-S7CK7UJ4-BkztC9a5.js → diagram-S7CK7UJ4-96rXPSnH.js} +1 -1
- package/out/renderer/assets/{diagram-UQ7AKVKN-CSwMNUis.js → diagram-UQ7AKVKN-DMHZUHdH.js} +1 -1
- package/out/renderer/assets/{diagram-VSXAHHWV-DKWQNU_X.js → diagram-VSXAHHWV-CTqw8eFX.js} +1 -1
- package/out/renderer/assets/{diagram-VX7I27RA-Bh8kGb8g.js → diagram-VX7I27RA-BtRe1HVA.js} +1 -1
- package/out/renderer/assets/{diagram-Z3DM3KII-Cumr98es.js → diagram-Z3DM3KII-Hj9lO76-.js} +1 -1
- package/out/renderer/assets/{ebnfDiagram-PWID7BFC-BTCksl6M.js → ebnfDiagram-PWID7BFC-C5t3c4Se.js} +1 -1
- package/out/renderer/assets/{erDiagram-RLTQ6QDP-DpjAcDW9.js → erDiagram-RLTQ6QDP-B-eR6akq.js} +1 -1
- package/out/renderer/assets/{flowDiagram-HODETNUW-BUfu9Ylq.js → flowDiagram-HODETNUW-Bw9VQ570.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-EL5Y4UJY-DqB0xT46.js → ganttDiagram-EL5Y4UJY-DuJm4569.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-WWUBYQGX-DWO9mHhX.js → gitGraphDiagram-WWUBYQGX-DbRtG2nJ.js} +1 -1
- package/out/renderer/assets/{index-oBYEGVaR.js → index-mJjIny4N.js} +6 -6
- package/out/renderer/assets/{infoDiagram-27XIBGKW-wvKtGi6y.js → infoDiagram-27XIBGKW-DhQK0Qdj.js} +1 -1
- package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-DIJf-gVZ.js → ishikawaDiagram-5VMMS53U-lvDqP9aC.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-3NMN7TZE-D3Bjz_Oq.js → journeyDiagram-3NMN7TZE-CjhsT3Ie.js} +1 -1
- package/out/renderer/assets/{kanban-definition-UXKFOSKX-u9-8jhJ4.js → kanban-definition-UXKFOSKX-CnNxr_wk.js} +1 -1
- package/out/renderer/assets/{layout-_p9_2zXV.js → layout-Cr2KdY-M.js} +1 -1
- package/out/renderer/assets/{linear-Csj9U5Dq.js → linear-DkNm1Gso.js} +1 -1
- package/out/renderer/assets/{mermaid.core-DYNgKgJW.js → mermaid.core-ioNz7ync.js} +5 -5
- package/out/renderer/assets/{mindmap-definition-YA3MSWOX-8HK_f66l.js → mindmap-definition-YA3MSWOX-DwYNeUyM.js} +1 -1
- package/out/renderer/assets/{pegDiagram-XKGWAZYB-D2vT8SZy.js → pegDiagram-XKGWAZYB-iOfmwe_o.js} +1 -1
- package/out/renderer/assets/{pieDiagram-E7YTZNPT-DpU7X7GB.js → pieDiagram-E7YTZNPT-BB5H6jIJ.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-yVodPLsI.js → quadrantDiagram-AXDQQJYC-DPCGd1Lz.js} +1 -1
- package/out/renderer/assets/{railroadDiagram-O6MQD6OU-C681oxL1.js → railroadDiagram-O6MQD6OU-SAFinsIi.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-BXWQKSXE-D7ywrtKP.js → requirementDiagram-BXWQKSXE-Ch7UA4PM.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-C5F8hszf.js → sankeyDiagram-P5KCCOFB-DE8_TU0r.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-BQVLxqgL.js → sequenceDiagram-WJ2MYXX4-g61Xe6T0.js} +1 -1
- package/out/renderer/assets/{sessionChanges-XLrYNBd5.js → sessionChanges-DJKK-W-b.js} +1 -1
- package/out/renderer/assets/{sizeCapture-INFHLROL-CQjsSghu.js → sizeCapture-INFHLROL-CVrBFmtN.js} +1 -1
- package/out/renderer/assets/{stateDiagram-D77RDMKH-l8OzK7i6.js → stateDiagram-D77RDMKH-CMlTHXDm.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-GJVYcTB4.js +1 -0
- package/out/renderer/assets/{swimlanes-42K2YHIH-iFNrwywV.js → swimlanes-42K2YHIH-DV_Cima1.js} +1 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-Bac5YQUH.js +8 -0
- package/out/renderer/assets/{timeline-definition-24CTP7MA-kv12syCn.js → timeline-definition-24CTP7MA-CXvrSM6T.js} +1 -1
- package/out/renderer/assets/{vennDiagram-4TSXK5OY-MQl2bz96.js → vennDiagram-4TSXK5OY-BfyXZwR6.js} +1 -1
- package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-RABSCw_U.js → wardleyDiagram-VM6X3IG4-DVert9YG.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-B5-5ToKY.js → xychartDiagram-S5SC5T6Z-DIhAS62p.js} +1 -1
- package/out/renderer/index.html +1 -1
- package/out/server/agent.js +4 -4
- package/out/server/chunks/{builtinOccupancy-nunr72_1.js → builtinOccupancy-DFegpcXc.js} +3 -3
- package/out/server/chunks/{dispatchModel-Dx6bj4GE.js → dispatchModel-Cxe1soBb.js} +2 -2
- package/out/server/chunks/{loadProvider-CGBwuI_o.js → loadProvider-B3ukq5Fy.js} +2 -2
- package/out/server/chunks/{menuSkills-CtGB8_pv.js → menuSkills-D6ieuD0G.js} +3 -3
- package/out/server/chunks/{projectCode-XQKRRChV.js → projectCode-DweDyxNg.js} +2 -2
- package/out/server/chunks/{web-ComQU7PG.js → web-Bw_WHFTz.js} +2 -2
- package/out/server/chunks/{workflowPresets-c1VnWNBg.js → workflowPresets-BsPcimG1.js} +2 -2
- package/out/server/index.js +11 -6
- package/package.json +1 -1
- package/out/phone/assets/architecture-7GRP2DOG-DwD9pWke.js +0 -1
- package/out/phone/assets/channel-lquKKS5w.js +0 -1
- package/out/phone/assets/classDiagram-ZZMXUADV-CLQrkAdv.js +0 -1
- package/out/phone/assets/classDiagram-v2-VYDZK3BY-CLQrkAdv.js +0 -1
- package/out/phone/assets/eventmodeling-NTZA5JFV-FosgawEZ.js +0 -1
- package/out/phone/assets/flowDiagram-HODETNUW-BklgCWjp.js +0 -1
- package/out/phone/assets/railroad-abnf-HS5TGJTU-DqHhYDlp.js +0 -1
- package/out/phone/assets/railroad-ebnf-LZEXJU2U-DHa2oESM.js +0 -1
- package/out/phone/assets/railroad-peg-WCYAUIDC-CmnmPChu.js +0 -1
- package/out/phone/assets/stateDiagram-v2-MP3YSRHH-D-IWJhTN.js +0 -1
- package/out/phone/assets/swimlanesDiagram-VR7AAH4N-DE_9MT5v.js +0 -8
- package/out/renderer/assets/channel-BXUzcBZ2.js +0 -1
- package/out/renderer/assets/classDiagram-ZZMXUADV-Ov66-2se.js +0 -1
- package/out/renderer/assets/classDiagram-v2-VYDZK3BY-Ov66-2se.js +0 -1
- package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-DCF99maM.js +0 -1
- package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-CKuCgjAl.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-DA-rfuFy.js","./html-pp8916En.js","./javascript-wDzz0qaB.js","./css-CLj8gQPS.js","./angular-ts-BrjP3tb8.js","./scss-D5BDwBP9.js","./apl-CORt7UWP.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./json-Cp-IABpG.js","./astro-HNnZUWAn.js","./typescript-BPQ3VLAy.js","./postcss-CXtECtnM.js","./tsx-COt5Ahok.js","./blade-2xfisSek.js","./html-derivative-DlHx6ybY.js","./sql-CRqJ_cUM.js","./bsl-DlhNcFeZ.js","./sdbl-DVxCFoDh.js","./cairo-KRGpt6FW.js","./python-B6aJPvgy.js","./chapel-DTp_pixX.js","./c-BIGW1oBm.js","./cobol-nBiQ_Alo.js","./coffee-Ch7k5sss.js","./cpp-BMRokrvK.js","./regexp-CDVJQ6XC.js","./glsl-DplSGwfg.js","./crystal-DGywbUpC.js","./shellscript-Yzrsuije.js","./edge-FbVlp4U3.js","./elixir-CkH2-t6x.js","./elm-DbKCFpqz.js","./erb-DXfck5VN.js","./ruby-C0TQ7zu5.js","./haml-D5jkg6IW.js","./graphql-ChdNCCLP.js","./jsx-g9-lgVsj.js","./lua-BaeVxFsk.js","./yaml-Buea-lGh.js","./erlang-DsQrWhSR.js","./markdown-Cvjx9yec.js","./fortran-fixed-form-CkoXwp7k.js","./fortran-free-form-BxgE0vQu.js","./fsharp-CXgrBDvD.js","./gdresource-TyuKm33G.js","./gdshader-DkwncUOv.js","./gdscript-DqcFQ5yU.js","./git-commit-F4YmCXRG.js","./diff-D97Zzqfu.js","./git-rebase-r7XF79zn.js","./glimmer-js-ByusRIyA.js","./glimmer-ts-BfAWNZQY.js","./hack-BWmVpMyf.js","./handlebars-BpdQsYii.js","./http-jrhK8wxY.js","./hurl-irOxFIW8.js","./csv-fuZLfV_i.js","./hxml-2-FPmUDs.js","./haxe-CfZj7gIn.js","./jinja-f2NsQr07.js","./jison-wvAkD_A8.js","./julia-5Bft2YPA.js","./r-Cf5RLm7j.js","./just-Cwhn7H3k.js","./perl-B9cMNwum.js","./latex-D5pSuvFb.js","./tex-D96PA37w.js","./liquid-C0sCDyMI.js","./marko-DjSrsDqO.js","./less-B1dDrJ26.js","./mdc-D1_yUvq7.js","./nextflow-C-mBbutL.js","./nextflow-groovy-vE_lwT2v.js","./nginx-BpAMiNFr.js","./nim-BIad80T-.js","./org-DM6o9KBp.js","./ini-BEwlwnbL.js","./make-CHLpvVh8.js","./php-Csjmro_R.js","./vb-Cu-pLBUe.js","./clojure-P80f7IUj.js","./objective-c-DXmwc3jG.js","./docker-BcOcwvcX.js","./go-C27-OAKa.js","./groovy-gcz8RCvz.js","./raku-DXvB9xmW.js","./rust-B1yitclQ.js","./scala-CqE71os6.js","./csharp-DSvCPggb.js","./dart-bE4Kk8sk.js","./ocaml-C0hk2d4L.js","./zig-VOosw3JB.js","./xsl-CtQFsRM5.js","./pug-DKIMFp6K.js","./qml-3beO22l8.js","./razor-BjBPvh-w.js","./rst-bs7f0vWN.js","./cmake-D1j8_8rp.js","./sas-DEy46yEz.js","./shaderlab-Dg9Lc6iA.js","./hlsl-D3lLCCz7.js","./shellsession-BADoaaVG.js","./soy-8wufbnw4.js","./sparql-rVzFXLq3.js","./turtle-BsS91CYL.js","./stata-DI20mbqo.js","./surrealql-Cjom0U5J.js","./svelte-Cy7k_4gC.js","./templ-DhtptRzy.js","./ts-tags-D351s5mN.js","./twig-27uCiNez.js","./typst-BUadGCkm.js","./bat-CickPsom.js","./bibtex-CHM0blh-.js","./jsonc-Des-eS-w.js","./log-2UxHyX5q.js","./powershell-BmBUJMz7.js","./swift-C2oV4EkX.js","./verilog-nZwndyjY.js","./system-verilog-0hqHdDBg.js","./vue-BqiEGhQt.js","./vue-html-AaS7Mt5G.js","./vue-vine-BoDAl6tE.js","./stylus-BEDo0Tqx.js","./EditDiff-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-DA-rfuFy.js","./html-pp8916En.js","./javascript-wDzz0qaB.js","./css-CLj8gQPS.js","./angular-ts-BrjP3tb8.js","./scss-D5BDwBP9.js","./apl-CORt7UWP.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./json-Cp-IABpG.js","./astro-HNnZUWAn.js","./typescript-BPQ3VLAy.js","./postcss-CXtECtnM.js","./tsx-COt5Ahok.js","./blade-2xfisSek.js","./html-derivative-DlHx6ybY.js","./sql-CRqJ_cUM.js","./bsl-DlhNcFeZ.js","./sdbl-DVxCFoDh.js","./cairo-KRGpt6FW.js","./python-B6aJPvgy.js","./chapel-DTp_pixX.js","./c-BIGW1oBm.js","./cobol-nBiQ_Alo.js","./coffee-Ch7k5sss.js","./cpp-BMRokrvK.js","./regexp-CDVJQ6XC.js","./glsl-DplSGwfg.js","./crystal-DGywbUpC.js","./shellscript-Yzrsuije.js","./edge-FbVlp4U3.js","./elixir-CkH2-t6x.js","./elm-DbKCFpqz.js","./erb-DXfck5VN.js","./ruby-C0TQ7zu5.js","./haml-D5jkg6IW.js","./graphql-ChdNCCLP.js","./jsx-g9-lgVsj.js","./lua-BaeVxFsk.js","./yaml-Buea-lGh.js","./erlang-DsQrWhSR.js","./markdown-Cvjx9yec.js","./fortran-fixed-form-CkoXwp7k.js","./fortran-free-form-BxgE0vQu.js","./fsharp-CXgrBDvD.js","./gdresource-TyuKm33G.js","./gdshader-DkwncUOv.js","./gdscript-DqcFQ5yU.js","./git-commit-F4YmCXRG.js","./diff-D97Zzqfu.js","./git-rebase-r7XF79zn.js","./glimmer-js-ByusRIyA.js","./glimmer-ts-BfAWNZQY.js","./hack-BWmVpMyf.js","./handlebars-BpdQsYii.js","./http-jrhK8wxY.js","./hurl-irOxFIW8.js","./csv-fuZLfV_i.js","./hxml-2-FPmUDs.js","./haxe-CfZj7gIn.js","./jinja-f2NsQr07.js","./jison-wvAkD_A8.js","./julia-5Bft2YPA.js","./r-Cf5RLm7j.js","./just-Cwhn7H3k.js","./perl-B9cMNwum.js","./latex-D5pSuvFb.js","./tex-D96PA37w.js","./liquid-C0sCDyMI.js","./marko-DjSrsDqO.js","./less-B1dDrJ26.js","./mdc-D1_yUvq7.js","./nextflow-C-mBbutL.js","./nextflow-groovy-vE_lwT2v.js","./nginx-BpAMiNFr.js","./nim-BIad80T-.js","./org-DM6o9KBp.js","./ini-BEwlwnbL.js","./make-CHLpvVh8.js","./php-Csjmro_R.js","./vb-Cu-pLBUe.js","./clojure-P80f7IUj.js","./objective-c-DXmwc3jG.js","./docker-BcOcwvcX.js","./go-C27-OAKa.js","./groovy-gcz8RCvz.js","./raku-DXvB9xmW.js","./rust-B1yitclQ.js","./scala-CqE71os6.js","./csharp-DSvCPggb.js","./dart-bE4Kk8sk.js","./ocaml-C0hk2d4L.js","./zig-VOosw3JB.js","./xsl-CtQFsRM5.js","./pug-DKIMFp6K.js","./qml-3beO22l8.js","./razor-BjBPvh-w.js","./rst-bs7f0vWN.js","./cmake-D1j8_8rp.js","./sas-DEy46yEz.js","./shaderlab-Dg9Lc6iA.js","./hlsl-D3lLCCz7.js","./shellsession-BADoaaVG.js","./soy-8wufbnw4.js","./sparql-rVzFXLq3.js","./turtle-BsS91CYL.js","./stata-DI20mbqo.js","./surrealql-Cjom0U5J.js","./svelte-Cy7k_4gC.js","./templ-DhtptRzy.js","./ts-tags-D351s5mN.js","./twig-27uCiNez.js","./typst-BUadGCkm.js","./bat-CickPsom.js","./bibtex-CHM0blh-.js","./jsonc-Des-eS-w.js","./log-2UxHyX5q.js","./powershell-BmBUJMz7.js","./swift-C2oV4EkX.js","./verilog-nZwndyjY.js","./system-verilog-0hqHdDBg.js","./vue-BqiEGhQt.js","./vue-html-AaS7Mt5G.js","./vue-vine-BoDAl6tE.js","./stylus-BEDo0Tqx.js","./EditDiff-C5tSOQb2.js","./sessionChanges-DJKK-W-b.js","./SidePanel-BGXusuy3.js","./SidePanel-DN2RL6QD.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
function OPe(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(r,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Oy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function DPe(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){var s=!1;try{s=this instanceof r}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var j8={exports:{}},LS={};var lJ;function BPe(){if(lJ)return LS;lJ=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var l in s)l!=="key"&&(o[l]=s[l])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:o}}return LS.Fragment=t,LS.jsx=n,LS.jsxs=n,LS}var cJ;function FPe(){return cJ||(cJ=1,j8.exports=BPe()),j8.exports}var a=FPe(),R8={exports:{}},us={};var uJ;function zPe(){if(uJ)return us;uJ=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),i=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),h=Symbol.iterator;function p(T){return T===null||typeof T!="object"?null:(T=h&&T[h]||T["@@iterator"],typeof T=="function"?T:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,b={};function x(T,U,P){this.props=T,this.context=U,this.refs=b,this.updater=P||m}x.prototype.isReactComponent={},x.prototype.setState=function(T,U){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,U,"setState")},x.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function S(){}S.prototype=x.prototype;function k(T,U,P){this.props=T,this.context=U,this.refs=b,this.updater=P||m}var C=k.prototype=new S;C.constructor=k,v(C,x.prototype),C.isPureReactComponent=!0;var A=Array.isArray;function N(){}var j={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function _(T,U,P){var K=P.ref;return{$$typeof:e,type:T,key:U,ref:K!==void 0?K:null,props:P}}function L(T,U){return _(T.type,U,T.props)}function M(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function F(T){var U={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(P){return U[P]})}var D=/\/+/g;function R(T,U){return typeof T=="object"&&T!==null&&T.key!=null?F(""+T.key):U.toString(36)}function z(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(N,N):(T.status="pending",T.then(function(U){T.status==="pending"&&(T.status="fulfilled",T.value=U)},function(U){T.status==="pending"&&(T.status="rejected",T.reason=U)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function B(T,U,P,K,J){var ee=typeof T;(ee==="undefined"||ee==="boolean")&&(T=null);var X=!1;if(T===null)X=!0;else switch(ee){case"bigint":case"string":case"number":X=!0;break;case"object":switch(T.$$typeof){case e:case t:X=!0;break;case d:return X=T._init,B(X(T._payload),U,P,K,J)}}if(X)return J=J(T),X=K===""?"."+R(T,0):K,A(J)?(P="",X!=null&&(P=X.replace(D,"$&/")+"/"),B(J,U,P,"",function(oe){return oe})):J!=null&&(M(J)&&(J=L(J,P+(J.key==null||T&&T.key===J.key?"":(""+J.key).replace(D,"$&/")+"/")+X)),U.push(J)),1;X=0;var ne=K===""?".":K+":";if(A(T))for(var Q=0;Q<T.length;Q++)K=T[Q],ee=ne+R(K,Q),X+=B(K,U,P,ee,J);else if(Q=p(T),typeof Q=="function")for(T=Q.call(T),Q=0;!(K=T.next()).done;)K=K.value,ee=ne+R(K,Q++),X+=B(K,U,P,ee,J);else if(ee==="object"){if(typeof T.then=="function")return B(z(T),U,P,K,J);throw U=String(T),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return X}function H(T,U,P){if(T==null)return T;var K=[],J=0;return B(T,K,"","",function(ee){return U.call(P,ee,J++)}),K}function G(T){if(T._status===-1){var U=T._result;U=U(),U.then(function(P){(T._status===0||T._status===-1)&&(T._status=1,T._result=P)},function(P){(T._status===0||T._status===-1)&&(T._status=2,T._result=P)}),T._status===-1&&(T._status=0,T._result=U)}if(T._status===1)return T._result.default;throw T._result}var te=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},W={map:H,forEach:function(T,U,P){H(T,function(){U.apply(this,arguments)},P)},count:function(T){var U=0;return H(T,function(){U++}),U},toArray:function(T){return H(T,function(U){return U})||[]},only:function(T){if(!M(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return us.Activity=f,us.Children=W,us.Component=x,us.Fragment=n,us.Profiler=s,us.PureComponent=k,us.StrictMode=r,us.Suspense=c,us.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,us.__COMPILER_RUNTIME={__proto__:null,c:function(T){return j.H.useMemoCache(T)}},us.cache=function(T){return function(){return T.apply(null,arguments)}},us.cacheSignal=function(){return null},us.cloneElement=function(T,U,P){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var K=v({},T.props),J=T.key;if(U!=null)for(ee in U.key!==void 0&&(J=""+U.key),U)!I.call(U,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&U.ref===void 0||(K[ee]=U[ee]);var ee=arguments.length-2;if(ee===1)K.children=P;else if(1<ee){for(var X=Array(ee),ne=0;ne<ee;ne++)X[ne]=arguments[ne+2];K.children=X}return _(T.type,J,K)},us.createContext=function(T){return T={$$typeof:i,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:o,_context:T},T},us.createElement=function(T,U,P){var K,J={},ee=null;if(U!=null)for(K in U.key!==void 0&&(ee=""+U.key),U)I.call(U,K)&&K!=="key"&&K!=="__self"&&K!=="__source"&&(J[K]=U[K]);var X=arguments.length-2;if(X===1)J.children=P;else if(1<X){for(var ne=Array(X),Q=0;Q<X;Q++)ne[Q]=arguments[Q+2];J.children=ne}if(T&&T.defaultProps)for(K in X=T.defaultProps,X)J[K]===void 0&&(J[K]=X[K]);return _(T,ee,J)},us.createRef=function(){return{current:null}},us.forwardRef=function(T){return{$$typeof:l,render:T}},us.isValidElement=M,us.lazy=function(T){return{$$typeof:d,_payload:{_status:-1,_result:T},_init:G}},us.memo=function(T,U){return{$$typeof:u,type:T,compare:U===void 0?null:U}},us.startTransition=function(T){var U=j.T,P={};j.T=P;try{var K=T(),J=j.S;J!==null&&J(P,K),typeof K=="object"&&K!==null&&typeof K.then=="function"&&K.then(N,te)}catch(ee){te(ee)}finally{U!==null&&P.types!==null&&(U.types=P.types),j.T=U}},us.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},us.use=function(T){return j.H.use(T)},us.useActionState=function(T,U,P){return j.H.useActionState(T,U,P)},us.useCallback=function(T,U){return j.H.useCallback(T,U)},us.useContext=function(T){return j.H.useContext(T)},us.useDebugValue=function(){},us.useDeferredValue=function(T,U){return j.H.useDeferredValue(T,U)},us.useEffect=function(T,U){return j.H.useEffect(T,U)},us.useEffectEvent=function(T){return j.H.useEffectEvent(T)},us.useId=function(){return j.H.useId()},us.useImperativeHandle=function(T,U,P){return j.H.useImperativeHandle(T,U,P)},us.useInsertionEffect=function(T,U){return j.H.useInsertionEffect(T,U)},us.useLayoutEffect=function(T,U){return j.H.useLayoutEffect(T,U)},us.useMemo=function(T,U){return j.H.useMemo(T,U)},us.useOptimistic=function(T,U){return j.H.useOptimistic(T,U)},us.useReducer=function(T,U,P){return j.H.useReducer(T,U,P)},us.useRef=function(T){return j.H.useRef(T)},us.useState=function(T){return j.H.useState(T)},us.useSyncExternalStore=function(T,U,P){return j.H.useSyncExternalStore(T,U,P)},us.useTransition=function(){return j.H.useTransition()},us.version="19.2.8",us}var dJ;function Dy(){return dJ||(dJ=1,R8.exports=zPe()),R8.exports}var y=Dy();const Hn=Oy(y),Xge=OPe({__proto__:null,default:Hn},[y]);var M8={exports:{}},OS={},_8={exports:{}},P8={};var fJ;function HPe(){return fJ||(fJ=1,(function(e){function t(B,H){var G=B.length;B.push(H);e:for(;0<G;){var te=G-1>>>1,W=B[te];if(0<s(W,H))B[te]=H,B[G]=W,G=te;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var H=B[0],G=B.pop();if(G!==H){B[0]=G;e:for(var te=0,W=B.length,T=W>>>1;te<T;){var U=2*(te+1)-1,P=B[U],K=U+1,J=B[K];if(0>s(P,G))K<W&&0>s(J,P)?(B[te]=J,B[K]=G,te=K):(B[te]=P,B[U]=G,te=U);else if(K<W&&0>s(J,G))B[te]=J,B[K]=G,te=K;else break e}}return H}function s(B,H){var G=B.sortIndex-H.sortIndex;return G!==0?G:B.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,v=!1,b=!1,x=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function C(B){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=B)r(u),H.sortIndex=H.expirationTime,t(c,H);else break;H=n(u)}}function A(B){if(v=!1,C(B),!m)if(n(c)!==null)m=!0,N||(N=!0,F());else{var H=n(u);H!==null&&z(A,H.startTime-B)}}var N=!1,j=-1,I=5,_=-1;function L(){return b?!0:!(e.unstable_now()-_<I)}function M(){if(b=!1,N){var B=e.unstable_now();_=B;var H=!0;try{e:{m=!1,v&&(v=!1,S(j),j=-1),p=!0;var G=h;try{t:{for(C(B),f=n(c);f!==null&&!(f.expirationTime>B&&L());){var te=f.callback;if(typeof te=="function"){f.callback=null,h=f.priorityLevel;var W=te(f.expirationTime<=B);if(B=e.unstable_now(),typeof W=="function"){f.callback=W,C(B),H=!0;break t}f===n(c)&&r(c),C(B)}else r(c);f=n(c)}if(f!==null)H=!0;else{var T=n(u);T!==null&&z(A,T.startTime-B),H=!1}}break e}finally{f=null,h=G,p=!1}H=void 0}}finally{H?F():N=!1}}}var F;if(typeof k=="function")F=function(){k(M)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,R=D.port2;D.port1.onmessage=M,F=function(){R.postMessage(null)}}else F=function(){x(M,0)};function z(B,H){j=x(function(){B(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(B){switch(h){case 1:case 2:case 3:var H=3;break;default:H=h}var G=h;h=H;try{return B()}finally{h=G}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(B,H){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var G=h;h=B;try{return H()}finally{h=G}},e.unstable_scheduleCallback=function(B,H,G){var te=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?te+G:te):G=te,B){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=G+W,B={id:d++,callback:H,priorityLevel:B,startTime:G,expirationTime:W,sortIndex:-1},G>te?(B.sortIndex=G,t(u,B),n(c)===null&&B===n(u)&&(v?(S(j),j=-1):v=!0,z(A,G-te))):(B.sortIndex=W,t(c,B),m||p||(m=!0,N||(N=!0,F()))),B},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(B){var H=h;return function(){var G=h;h=H;try{return B.apply(this,arguments)}finally{h=G}}}})(P8)),P8}var hJ;function UPe(){return hJ||(hJ=1,_8.exports=HPe()),_8.exports}var L8={exports:{}},mc={};var pJ;function VPe(){if(pJ)return mc;pJ=1;var e=Dy();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(c,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:c,containerInfo:u,implementation:d}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return mc.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,mc.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return o(c,u,null,d)},mc.flushSync=function(c){var u=i.T,d=r.p;try{if(i.T=null,r.p=2,c)return c()}finally{i.T=u,r.p=d,r.d.f()}},mc.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},mc.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},mc.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin),h=typeof u.integrity=="string"?u.integrity:void 0,p=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:p}):d==="script"&&r.d.X(c,{crossOrigin:f,integrity:h,fetchPriority:p,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},mc.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=l(u.as,u.crossOrigin);r.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(c)},mc.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin);r.d.L(c,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},mc.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=l(u.as,u.crossOrigin);r.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(c)},mc.requestFormReset=function(c){r.d.r(c)},mc.unstable_batchedUpdates=function(c,u){return c(u)},mc.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},mc.useFormStatus=function(){return i.H.useHostTransitionStatus()},mc.version="19.2.8",mc}var mJ;function L4(){if(mJ)return L8.exports;mJ=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),L8.exports=VPe(),L8.exports}var gJ;function GPe(){if(gJ)return OS;gJ=1;var e=UPe(),t=Dy(),n=L4();function r(g){var w="https://react.dev/errors/"+g;if(1<arguments.length){w+="?args[]="+encodeURIComponent(arguments[1]);for(var E=2;E<arguments.length;E++)w+="&args[]="+encodeURIComponent(arguments[E])}return"Minified React error #"+g+"; visit "+w+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(g){return!(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)}function o(g){var w=g,E=g;if(g.alternate)for(;w.return;)w=w.return;else{g=w;do w=g,(w.flags&4098)!==0&&(E=w.return),g=w.return;while(g)}return w.tag===3?E:null}function i(g){if(g.tag===13){var w=g.memoizedState;if(w===null&&(g=g.alternate,g!==null&&(w=g.memoizedState)),w!==null)return w.dehydrated}return null}function l(g){if(g.tag===31){var w=g.memoizedState;if(w===null&&(g=g.alternate,g!==null&&(w=g.memoizedState)),w!==null)return w.dehydrated}return null}function c(g){if(o(g)!==g)throw Error(r(188))}function u(g){var w=g.alternate;if(!w){if(w=o(g),w===null)throw Error(r(188));return w!==g?null:g}for(var E=g,O=w;;){var Z=E.return;if(Z===null)break;var re=Z.alternate;if(re===null){if(O=Z.return,O!==null){E=O;continue}break}if(Z.child===re.child){for(re=Z.child;re;){if(re===E)return c(Z),g;if(re===O)return c(Z),w;re=re.sibling}throw Error(r(188))}if(E.return!==O.return)E=Z,O=re;else{for(var Ce=!1,Qe=Z.child;Qe;){if(Qe===E){Ce=!0,E=Z,O=re;break}if(Qe===O){Ce=!0,O=Z,E=re;break}Qe=Qe.sibling}if(!Ce){for(Qe=re.child;Qe;){if(Qe===E){Ce=!0,E=re,O=Z;break}if(Qe===O){Ce=!0,O=re,E=Z;break}Qe=Qe.sibling}if(!Ce)throw Error(r(189))}}if(E.alternate!==O)throw Error(r(190))}if(E.tag!==3)throw Error(r(188));return E.stateNode.current===E?g:w}function d(g){var w=g.tag;if(w===5||w===26||w===27||w===6)return g;for(g=g.child;g!==null;){if(w=d(g),w!==null)return w;g=g.sibling}return null}var f=Object.assign,h=Symbol.for("react.element"),p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),k=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),M=Symbol.iterator;function F(g){return g===null||typeof g!="object"?null:(g=M&&g[M]||g["@@iterator"],typeof g=="function"?g:null)}var D=Symbol.for("react.client.reference");function R(g){if(g==null)return null;if(typeof g=="function")return g.$$typeof===D?null:g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case v:return"Fragment";case x:return"Profiler";case b:return"StrictMode";case A:return"Suspense";case N:return"SuspenseList";case _:return"Activity"}if(typeof g=="object")switch(g.$$typeof){case m:return"Portal";case k:return g.displayName||"Context";case S:return(g._context.displayName||"Context")+".Consumer";case C:var w=g.render;return g=g.displayName,g||(g=w.displayName||w.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case j:return w=g.displayName||null,w!==null?w:R(g.type)||"Memo";case I:w=g._payload,g=g._init;try{return R(g(w))}catch{}}return null}var z=Array.isArray,B=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},te=[],W=-1;function T(g){return{current:g}}function U(g){0>W||(g.current=te[W],te[W]=null,W--)}function P(g,w){W++,te[W]=g.current,g.current=w}var K=T(null),J=T(null),ee=T(null),X=T(null);function ne(g,w){switch(P(ee,w),P(J,g),P(K,null),w.nodeType){case 9:case 11:g=(g=w.documentElement)&&(g=g.namespaceURI)?RZ(g):0;break;default:if(g=w.tagName,w=w.namespaceURI)w=RZ(w),g=MZ(w,g);else switch(g){case"svg":g=1;break;case"math":g=2;break;default:g=0}}U(K),P(K,g)}function Q(){U(K),U(J),U(ee)}function oe(g){g.memoizedState!==null&&P(X,g);var w=K.current,E=MZ(w,g.type);w!==E&&(P(J,g),P(K,E))}function de(g){J.current===g&&(U(K),U(J)),X.current===g&&(U(X),RS._currentValue=G)}var ie,ue;function ve(g){if(ie===void 0)try{throw Error()}catch(E){var w=E.stack.trim().match(/\n( *(at )?)/);ie=w&&w[1]||"",ue=-1<E.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<E.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+ie+g+ue}var ge=!1;function Te(g,w){if(!g||ge)return"";ge=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var O={DetermineComponentFrameRoot:function(){try{if(w){var Sn=function(){throw Error()};if(Object.defineProperty(Sn.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Sn,[])}catch(tn){var Yt=tn}Reflect.construct(g,[],Sn)}else{try{Sn.call()}catch(tn){Yt=tn}g.call(Sn.prototype)}}else{try{throw Error()}catch(tn){Yt=tn}(Sn=g())&&typeof Sn.catch=="function"&&Sn.catch(function(){})}}catch(tn){if(tn&&Yt&&typeof tn.stack=="string")return[tn.stack,Yt.stack]}return[null,null]}};O.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var Z=Object.getOwnPropertyDescriptor(O.DetermineComponentFrameRoot,"name");Z&&Z.configurable&&Object.defineProperty(O.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var re=O.DetermineComponentFrameRoot(),Ce=re[0],Qe=re[1];if(Ce&&Qe){var bt=Ce.split(`
|
|
@@ -323,7 +323,7 @@ XID_Continue XIDC
|
|
|
323
323
|
XID_Start XIDS`.split(/\s/).map(e=>[LP(e),e])),GCt=new Map([["s",cl(383)],[cl(383),"s"]]),WCt=new Map([[cl(223),cl(7838)],[cl(107),cl(8490)],[cl(229),cl(8491)],[cl(969),cl(8486)]]),qCt=new Map([tv(453),tv(456),tv(459),tv(498),...HD(8072,8079),...HD(8088,8095),...HD(8104,8111),tv(8124),tv(8140),tv(8188)]),YCt=new Map([["alnum",ps`[\p{Alpha}\p{Nd}]`],["alpha",ps`\p{Alpha}`],["ascii",ps`\p{ASCII}`],["blank",ps`[\p{Zs}\t]`],["cntrl",ps`\p{Cc}`],["digit",ps`\p{Nd}`],["graph",ps`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",ps`\p{Lower}`],["print",ps`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",ps`[\p{P}\p{S}]`],["space",ps`\p{space}`],["upper",ps`\p{Upper}`],["word",ps`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",ps`\p{AHex}`]]);function $Ct(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}function tv(e){const t=cl(e);return[t.toLowerCase(),t]}function HD(e,t){return $Ct(e,t).map(n=>tv(n))}var _Te=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function KCt(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};PTe(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:CU(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};GE(e,XCt,r);const s={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},o={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};GE(e,QCt,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return GE(e,ZCt,i),e._originMap=o.groupOriginByCopy,e._strategy=r.strategy,e}var XCt={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:s}=e;if(s==="repeater"){const o=ph();o.body[0].body.push(Mb({negate:!0,body:r}),vw("Any"));const i=ph();i.body[0].body.push(ETe("greedy",0,1/0,o)),n(wa(i,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){const s=e.body.filter(o=>o.kind==="flags");for(let o=n+1;o<t.body.length;o++){const i=t.body[o];ZT(r,i,[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=OTe(t.get(e));if(n){const r=ph({flags:n});r.body[0].body=e.body,e.body=[wa(r,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:s,remove:o,replaceWith:i},l){const{kind:c,negate:u}=e,{asciiWordBoundaries:d,avoidSubclass:f,supportedGNodes:h,wordIsAscii:p}=l;if(c==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${u?"Y":"y"}"`);if(c==="line_end")i(wa(Mb({body:[Cy({body:[yU("string_end")]}),Cy({body:[PP(10)]})]}),t));else if(c==="line_start")i(wa(Vm(ps`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c==="search_start")if(h.has(e))s.flags.sticky=!0,o();else{const m=r[n-1];if(m&&sEt(m))i(wa(Mb({negate:!0}),t));else{if(f)throw new Error(ps`Uses "\G" in a way that requires a subclass`);i(nv(yU("string_start"),t)),l.strategy="clip_search"}}else if(!(c==="string_end"||c==="string_start"))if(c==="string_end_newline")i(wa(Vm(ps`(?=\n?\z)`),t));else if(c==="word_boundary"){if(!p&&!d){const m=`(?:(?<=${Um})(?!${Um})|(?<!${Um})(?=${Um}))`,v=`(?:(?<=${Um})(?=${Um})|(?<!${Um})(?!${Um}))`;i(wa(Vm(u?v:m),t))}}else throw new Error(`Unexpected assertion kind "${c}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!VD(n)&&(n=UD(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!VD(r)&&(r=UD(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if(t.kind==="intersection"){const r=tR({body:[e]});n(wa(r,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:l}){const{kind:c,negate:u,value:d}=e;if(o&&(c==="digit"||d==="digit")){n(nv(kU("digit",{negate:u}),t));return}if(i&&(c==="space"||d==="space")){n(wa(GD(Vm(UCt),u),t));return}if(l&&(c==="word"||d==="word")){n(nv(kU("word",{negate:u}),t));return}if(c==="any")n(nv(vw("Any"),t));else if(c==="digit")n(nv(vw("Nd",{negate:u}),t));else if(c!=="dot")if(c==="text_segment"){if(r==="strict")throw new Error(ps`Use of "\X" requires non-strict accuracy`);const f="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",h=ps`\p{RI}{2}|${f}(?:\u200D${f})*`;n(wa(Vm(ps`(?>\r\n|${s?ps`\p{RGI_Emoji}`:h}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c==="hex")n(nv(vw("AHex",{negate:u}),t));else if(c==="newline")n(wa(Vm(u?`[^
|
|
324
324
|
]`:`(?>\r
|
|
325
325
|
?|[
|
|
326
|
-
\v\f
\u2028\u2029])`),t));else if(c==="posix")if(!s&&(d==="graph"||d==="print")){if(r==="strict")throw new Error(`POSIX class "${d}" requires min target ES2024 or non-strict accuracy`);let f={graph:"!-~",print:" -~"}[d];u&&(f=`\0-${cl(f.codePointAt(0)-1)}${cl(f.codePointAt(2)+1)}-`),n(wa(Vm(`[${f}]`),t))}else n(wa(GD(Vm(YCt.get(d)),u),t));else if(c==="property")F$.has(LP(d))||(e.key="sc");else if(c==="space")n(nv(vw("space",{negate:u}),t));else if(c==="word")n(wa(GD(Vm(Um),u),t));else throw new Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:l,flags:c}=e;if(l==="flags")if(!c.enable&&!c.disable)r();else{const u=ph({flags:c});u.body[0].body=i(),s(wa(u,t),{traverse:!0})}else if(l==="keep"){const u=n.body[0],f=n.body.length===1&&kTe(u,{type:"Group"})&&u.body[0].body.length===1?u.body[0]:n;if(t.parent!==f||f.body.length>1)throw new Error(ps`Uses "\K" in a way that's unsupported`);const h=Mb({behind:!0});h.body[0].body=o(),s(wa(h,t))}else throw new Error(`Unexpected directive kind "${l}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if(r==="fail")n(wa(Mb({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=ph();t.body[0].body.push(e.body),e.body=wa(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,s=!1;for(const o of e.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=BTe(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>t.add(o))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t==="strict"&&n&&r)throw new Error(ps`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!VD(n)&&(n=UD(n,t),e.ref=n)}},QCt={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=e;r||n.set(e,[...t.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:l,reffedNodesByReferencer:c}){const u=s.get(e);if(u&&l.has(e.number)){const f=nv(cae(e.number),t);c.set(f,l.get(e.number)),n(f);return}l.set(e.number,e),i.set(e.number,[]),e.name&&ZT(i,e.name,[]);const d=i.get(e.name??e.number);for(let f=0;f<d.length;f++){const h=d[f];if(u===h.node||u&&u===h.origin||e===h.origin){d.splice(f,1);break}}if(i.get(e.number).push({node:e,origin:u}),e.name&&i.get(e.name).push({node:e,origin:u}),e.name){const f=ZT(o,e.name,new Map);let h=!1;if(u)h=!0;else for(const p of f.values())if(!p.hasDuplicateNameToRemove){h=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:h})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=I6(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:s,ref:o}=e;if(s){let d=t;for(;(d=d.parent)&&!(d.type==="CapturingGroup"&&(d.name===o||d.number===o)););r.reffedNodesByReferencer.set(e,d);return}const i=r.subroutineRefMap.get(o),l=o===0,c=l?cae(0):LTe(i,r.groupOriginByCopy,null);let u=c;if(!l){const d=OTe(tEt(i,h=>h.type==="Group"&&!!h.flags)),f=d?I6(r.globalFlags,d):r.globalFlags;JCt(f,r.currentFlags)||(u=ph({flags:nEt(f)}),u.body[0].body.push(c))}n(wa(u,t),{traverse:!l})}},ZCt={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}const o=r.reffedNodesByReferencer.get(e).filter(i=>eEt(i,e));if(!o.length)n(wa(Mb({negate:!0}),t));else if(o.length>1){const i=ph({atomic:!0,body:o.reverse().map(l=>Cy({body:[wU(l.number)]}))});n(wa(i,t))}else e.ref=o[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=CTe();e.body.at(-1).body.push(s)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function PTe(e){GE(e,{"*"({node:t,parent:n}){t.parent=n}})}function JCt(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function eEt(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const r=DTe(n.parent);for(const s of r){if(s===n)break;if(s===e||FTe(s,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function LTe(e,t,n,r){const s=Array.isArray(e)?[]:{};for(const[o,i]of Object.entries(e))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=LTe(i,t,s,n):(o==="type"&&i==="CapturingGroup"&&t.set(s,t.get(e)??e),s[o]=i);return s}function cae(e){const t=TTe(e);return t.isRecursive=!0,t}function tEt(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function UD(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function OTe(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:r})=>{t.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function nEt({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function DTe(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function BTe(e){const t=e.find(n=>n.kind==="search_start"||oEt(n,{negate:!1})||!rEt(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const r of t.body){const s=BTe(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function FTe(e,t){const n=DTe(e)??[];for(const r of n)if(r===t||FTe(r,t))return!0;return!1}function rEt({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function sEt(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function oEt(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&kTe(e.body[0],{type:"Assertion",kind:"search_start"})}function VD(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Vm(e,t){const r=STe(e,{...t,unicodePropertyMap:F$}).body;return r.length>1||r[0].body.length>1?ph({body:r}):r[0].body[0]}function GD(e,t){return e.negate=t,e}function nv(e,t){return e.parent=t,e}function wa(e,t){return PTe(e),e.parent=t,e}function iEt(e,t){const n=RTe(t),r=CU(n.target,"ES2024"),s=CU(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,l=null;if(!s){const p=[e.flags.ignoreCase];GE(e,aEt,{getCurrentModI:()=>p.at(-1),popModI(){p.pop()},pushModI(m){p.push(m)},setHasCasedChar(){p.at(-1)?i=!0:l=!0}})}const c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||i)&&!l)};let u=e;const d={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:u,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&l),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(p){return d.lastNode=u,u=p,zCt(lEt[p.type],`Unexpected node type "${p.type}"`)(p,d,f)}const h={pattern:e.body.map(f).join("|"),flags:f(e.flags),options:{...e.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],d.captureMap.forEach((p,m)=>{p.hidden&&h._hiddenCaptures.push(m),p.transferTo&&ZT(h._captureTransfers,p.transferTo,[]).push(m)}),h}var aEt={"*":{enter({node:e},t){if(dae(e)){const n=t.getCurrentModI();t.pushModI(e.flags?I6({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){dae(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){z$(cl(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),zTe(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&_Te.has(e.value)&&t.setHasCasedChar()}},lEt={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?ps`\B`:ps`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:s,number:o}=e,i={ignoreCase:t.currentFlags.ignoreCase},l=t.originMap.get(e);return l&&(i.hidden=!0,o>l.number&&(i.transferTo=l.number)),t.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=cl(e),r=G1(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&z$(n)){const s=MTe(n);return t.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:s,parent:o}=e;let{body:i}=e;if(r==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");kh.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(fae)&&(i=[PP(45),...i.filter(u=>!fae(u))]);const l=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||kh.bugNestedClassIgnoresNegation)&&!s){const d=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(d.length){const f=ph(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(p=>!d.includes(p)),e.body=i,i.length?(e.parent=h,h.body.push(e)):f.body.pop(),d.forEach(p=>{const m=Cy({body:[p]});p.parent=m,m.parent=f,f.body.push(m)}),n(f)}}t.inCharClass=!0;const u=l();return t.inCharClass=!1,u}const c=i[0];if(r==="union"&&!s&&c&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(kh.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&i.length===1&&c.type!=="CharacterClassRange"))return i.map(n).join("");if(!t.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return l()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=G1(n,s),i=G1(r,s),l=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const c=zTe(e);hEt(c).forEach(d=>{l.add(Array.isArray(d)?`${G1(d[0],s)}-${G1(d[1],s)}`:G1(d,s))})}return`${o}-${i}${[...l].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":ps`[^\n]`;if(e==="digit")return t?ps`\D`:ps`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&_Te.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?ps`\P`:ps`\p`}{${r?`${r}=`:""}${n}}`}if(e==="word")return t?ps`\W`:ps`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=I6(i,n));const l=t.map(o).join("|"),c=!s.verbose&&t.length===1&&r.type!=="Quantifier"&&!e&&(!s.useFlagMods||!n)?l:`(?${pEt(e,n,s.useFlagMods)}${l})`;return s.currentFlags=i,c},LookaroundAssertion({body:e,kind:t,negate:n},r,s){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(s).join("|")})`},Quantifier(e,t,n){return n(e.body)+mEt(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return t===0?`(?R=${r})`:ps`\g<${t}&R=${r}>`}},cEt=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),uEt=new Set(["-","\\","]","^","["]),dEt=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),uae=new Map([[9,ps`\t`],[10,ps`\n`],[11,ps`\v`],[12,ps`\f`],[13,ps`\r`],[8232,ps`\u2028`],[8233,ps`\u2029`],[65279,ps`\uFEFF`]]),fEt=new RegExp("^\\p{Cased}$","u");function z$(e){return fEt.test(e)}function zTe(e,t){const n=!!t?.firstOnly,r=e.min.value,s=e.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const l=cl(i);if(!z$(l))continue;const c=MTe(l).filter(u=>{const d=u.codePointAt(0);return d<r||d>s});if(c.length&&(o.push(...c),n))break}return o}function G1(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(uae.has(e))return uae.get(e);if(e<32||e>126&&e<160||e>262143||t&&gEt(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?dEt:uEt:cEt,o=cl(e);return(s.has(o)?"\\":"")+o}function hEt(e){const t=e.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<t.length;s++)t[s+1]===t[s]+1?r??=t[s]:r===null?n.push(t[s]):(n.push([r,t[s]]),r=null);return n}function pEt(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:s,disable:o}=t;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function mEt({kind:e,max:t,min:n}){let r;return!n&&t===1?r="?":!n&&t===1/0?r="*":n===1&&t===1/0?r="+":n===t?r=`{${n}}`:r=`{${n},${t===1/0?"":t}}`,r+{greedy:"",lazy:"?",possessive:"+"}[e]}function dae({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function gEt(e){return e>47&&e<58}function fae({type:e,value:t}){return e==="Character"&&t===45}var vEt=class EU extends RegExp{#t=new Map;#e=null;#s;#n=null;#i=null;rawOptions={};get source(){return this.#s||"(?:)"}constructor(t,n,r){const s=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=t;super(o,n),this.#s=o.source,o instanceof EU&&(this.#t=o.#t,this.#n=o.#n,this.#i=o.#i,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":t,n),this.#s=t,this.#t=bEt(o.hiddenCaptures,o.transfers),this.#i=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(t){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new EU(this.#s,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#i==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#l(t.slice(r));return s&&(xEt(s,r,t,this.hasIndices),this.lastIndex+=r),s}return this.#l(t)}#l(t){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,t);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:l,transferTo:c}=this.#t.get(i)??{};if(l?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),c&&r[i]!==void 0){const u=o[c];if(!u)throw new Error(`Invalid capture transfer to "${u}"`);if(n[u]=r[i],this.hasIndices&&(n.indices[u]=s[i]),n.groups){this.#n||(this.#n=yEt(this.source));const d=this.#n.get(c);d&&(n.groups[d]=r[i],this.hasIndices&&(n.indices.groups[d]=s[i]))}}}return n}};function xEt(e,t,n,r){if(e.index+=t,e.input=n,r){const s=e.indices;for(let i=0;i<s.length;i++){const l=s[i];l&&(s[i]=[l[0]+t,l[1]+t])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const l=o[i];l&&(o[i]=[l[0]+t,l[1]+t])})}}function bEt(e,t){const n=new Map;for(const r of e)n.set(r,{hidden:!0});for(const[r,s]of t)for(const o of s)ZT(n,o,{}).transferTo=r;return n}function yEt(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=t.exec(e);){const{0:i,groups:{capture:l,name:c}}=o;i==="["?r++:r?i==="]"&&r--:l&&(s++,c&&n.set(s,c))}return n}function wEt(e,t){const n=kEt(e,t);return n.options?new vEt(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function kEt(e,t){const n=RTe(t),r=STe(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:F$}),s=KCt(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=iEt(s,n),i=BCt(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),l=OCt(i.pattern),c=LCt(l.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),u={pattern:c.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const d=c.hiddenCaptures.sort((m,v)=>m-v),f=Array.from(c.captureTransfers),h=s._strategy,p=u.pattern.length>=n.lazyCompileLength;(d.length||f.length||h||p)&&(u.options={...d.length&&{hiddenCaptures:d},...f.length&&{transfers:f},...h&&{strategy:h},...p&&{lazyCompile:p}})}return u}function SEt(e,t){return wEt(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function HTe(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||=n=>SEt(n,{target:t.target}),{createScanner(n){return new FSt(n,t)},createString(n){return{content:n}}}}const CEt=["markdown","typescript","tsx","javascript","jsx","json","css","html","html-derivative","python","rust","go","shellscript","yaml"];let hae=null;function EEt(){return hae??=gTe({themes:["github-dark","github-light"],langs:[...CEt],engine:HTe()}),hae}const TEt=200,AEt=20*1024*1024,Sp=new Map;let WD=0;function NEt(e){const t=Sp.get(e);return t!==void 0&&(Sp.delete(e),Sp.set(e,t)),t}function IEt(e,t){if(!Sp.has(e))for(Sp.set(e,t),WD+=t.length*2;(Sp.size>TEt||WD>AEt)&&Sp.size>0;){const n=Sp.keys().next().value;WD-=(Sp.get(n)?.length??0)*2,Sp.delete(n)}}async function UTe(e,t,n=!0){const r=`${t}\0${e}`;if(n){const s=NEt(r);if(s!==void 0)return s}try{const s=await EEt(),o=s.getLoadedLanguages().includes(t)?t:"text",i=s.codeToHtml(e,{lang:o,themes:{light:"github-light",dark:"github-dark"},defaultColor:"light"});return n&&IEt(r,i),i}catch(s){return console.error("snippet highlight failed:",s),null}}const pae="my-2 overflow-x-auto rounded-lg border bg-[var(--sunken,var(--muted))] text-(length:--chat-code-block-size) [font-weight:var(--chat-code-block-weight)] leading-relaxed";function jEt(e){const t=e.trimStart();return/^<[a-zA-Z!/]/.test(t)?"html":/^[{[]/.test(t)?"json":/^[$#] /.test(t)?"shellscript":"text"}function j6({code:e,language:t,streaming:n=!1}){const[r,s]=y.useState(null);y.useEffect(()=>{if(n){s(null);return}let i=!0;return UTe(e,t??jEt(e),!0).then(l=>{i&&s(l)}),()=>{i=!1}},[e,t,n]);const o=!n&&a.jsx(px,{text:e,className:"absolute top-1.5 right-1.5 rounded-md border bg-background/80 p-1.5 text-muted-foreground opacity-0 backdrop-blur transition-opacity group-hover/code:opacity-100"});return r==null?a.jsxs("div",{"data-enso":"code-block","data-language":t,className:"group/code relative",children:[a.jsx("pre",{className:`${pae} p-3 font-mono`,children:a.jsx("code",{children:e})}),o]}):a.jsxs("div",{"data-enso":"code-block","data-language":t,className:"group/code relative",children:[a.jsx("div",{className:`${pae} [&_pre]:m-0 [&_pre]:overflow-x-auto [&_pre]:bg-transparent! [&_pre]:p-3 [&_pre]:font-mono [&_pre]:[--shiki-dark-bg:transparent]!`,dangerouslySetInnerHTML:{__html:r}}),o]})}const REt=50,mae=200,MEt=3e4,VTe={status:"missing"},R6=new Map,nR=new Map,TU=new Set,M6=new Map;let GTe=null,H$=0;const qD={batches:0,paths:0,ms:0},_Et=e=>e.cwd??`conversation:${e.conversationId}`,BP=(e,t)=>`${_Et(e)}\0${t}`;function PEt(e){return e?e.state.status==="ok"?e.epoch===H$:Date.now()-e.at<MEt:!1}function WTe(e,t){const n=R6.get(e)?.state,r=n?.status===t.status&&(t.status==="missing"||n.status==="ok"&&n.rel===t.rel&&n.kind===t.kind);if(R6.set(e,{state:r&&n?n:t,epoch:H$,at:Date.now()}),!r)for(const s of nR.get(e)??[])s()}function LEt(e){return e?{status:"ok",rel:e.rel,kind:e.kind}:VTe}async function qTe(e,t){const n=performance.now();try{const r=await window.electronAPI.workspaceFiles.resolveLinks({conversationId:e.conversationId,projectId:e.projectId,rels:t});return t.map((s,o)=>LEt(r.ok?r.items[o]:null))}catch{return t.map(()=>VTe)}finally{qD.batches+=1,qD.paths+=t.length,qD.ms+=performance.now()-n}}function OEt(){GTe=null;const e=[...M6.values()];M6.clear();for(const{scope:t,rels:n}of e){const r=[...n];for(let s=0;s<r.length;s+=mae){const o=r.slice(s,s+mae);qTe(t,o).then(i=>{o.forEach((l,c)=>{const u=BP(t,l);TU.delete(u),WTe(u,i[c])})})}}}function DEt(e,t){const n=BP(e,t);if(TU.has(n)||PEt(R6.get(n)))return;TU.add(n);const r=`${e.conversationId}\0${e.projectId}`,s=M6.get(r)??{scope:e,rels:new Set};s.rels.add(t),M6.set(r,s),GTe??=setTimeout(OEt,REt)}function BEt(){H$+=1}async function YTe(e,t){const[n]=await qTe(e,[t]);return WTe(BP(e,t),n),n}function $Te(e,t,n){const r=e&&t?BP(e,t):null,s=y.useCallback(i=>{if(!r)return()=>{};const l=nR.get(r)??new Set;return nR.set(r,l),l.add(i),()=>{l.delete(i),l.size===0&&nR.delete(r)}},[r]),o=y.useSyncExternalStore(s,()=>r?R6.get(r)?.state:void 0);return y.useEffect(()=>{n&&e&&t&&DEt(e,t)},[n,r]),o}const KTe=y.createContext({query:"",activeKey:"",activeNth:-1});function FEt(){return y.useContext(KTe)}const XTe="rounded-[2px] px-0.5 py-px",zEt=`${XTe} bg-yellow-300 text-foreground dark:bg-yellow-500/80`,HEt=`${XTe} bg-orange-600 text-white dark:bg-orange-500`;function QTe(e,t,n,r){const s=t.trim();if(!s)return e;const o=e.toLowerCase(),i=s.toLowerCase();let l=0,c=o.indexOf(i,l);if(c<0)return e;const u=[];for(;c>=0;){c>l&&u.push(e.slice(l,c));const d=r.n++;u.push(a.jsx("mark",{className:d===n?HEt:zEt,children:e.slice(c,c+s.length)},d)),l=c+s.length,c=o.indexOf(i,l)}return l<e.length&&u.push(e.slice(l)),u}function ZTe(e,t,n,r){return e==null||typeof e=="boolean"?e:typeof e=="string"||typeof e=="number"?QTe(String(e),t,n,r):Array.isArray(e)?e.map((s,o)=>a.jsx(y.Fragment,{children:ZTe(s,t,n,r)},o)):e}const UEt=2;function VEt({value:e}){return typeof e=="string"?a.jsx("span",{className:"text-emerald-700 dark:text-emerald-400",children:JSON.stringify(e)}):typeof e=="number"?a.jsx("span",{className:"text-sky-700 dark:text-sky-400",children:String(e)}):a.jsx("span",{className:"text-violet-700 dark:text-violet-400",children:String(e)})}function JTe({name:e,value:t,depth:n}){const[r,s]=y.useState(n<UEt),o=e!==void 0&&a.jsxs("span",{className:"text-foreground/80",children:[e,a.jsx("span",{className:"text-muted-foreground",children:": "})]});if(t===null||typeof t!="object")return a.jsxs("div",{className:"pl-4",children:[o,a.jsx(VEt,{value:t})]});const i=Array.isArray(t),l=i?t.map((d,f)=>[String(f),d]):Object.entries(t),[c,u]=i?["[","]"]:["{","}"];return a.jsxs("div",{className:n>0?"pl-4":void 0,children:[a.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>s(!r),className:"-ml-4 inline-flex items-center text-left hover:text-foreground",children:[a.jsx(Bs,{className:xe("h-3 w-3 shrink-0 transition-transform",r&&"rotate-90")}),a.jsxs("span",{className:"ml-1",children:[o,a.jsxs("span",{className:"text-muted-foreground",children:[c,!r&&` ${l.length} ${u}`]})]})]}),r&&a.jsxs(a.Fragment,{children:[l.map(([d,f])=>a.jsx(JTe,{name:i?void 0:d,value:f,depth:n+1},d)),a.jsx("div",{className:"text-muted-foreground",children:u})]})]})}function GEt({source:e,value:t}){const{t:n}=Se(),[r,s]=y.useState(!1),o=i=>xe("rounded px-1.5 py-0.5",i?"bg-muted text-foreground":"hover:text-foreground");return a.jsxs("div",{"data-enso":"json-tree",className:"group/code relative my-2 rounded-lg border",children:[a.jsxs("div",{className:"flex items-center gap-1 border-b px-2 py-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{className:"mr-auto font-mono",children:"JSON"}),a.jsx("button",{type:"button",className:o(!r),onClick:()=>s(!1),children:n("Tree view")}),a.jsx("button",{type:"button",className:o(r),onClick:()=>s(!0),children:n("Raw text")}),a.jsx(px,{text:e,className:"rounded p-1"})]}),r?a.jsx("div",{className:"px-2",children:a.jsx(j6,{code:e,language:"json"})}):a.jsx("div",{className:"max-h-[480px] overflow-auto py-2 pr-3 pl-6 font-mono text-(length:--chat-code-block-size) leading-relaxed",children:a.jsx(JTe,{value:t,depth:0})})]})}function WEt(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function U$(){const e=be(s=>s.theme),t=be(s=>s.terminalTheme),[n,r]=y.useState(WEt);return y.useEffect(()=>{const s=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>r(s.matches);return o(),s.addEventListener("change",o),()=>s.removeEventListener("change",o)},[]),qbe(e,{prefersDark:n,terminalIsDark:Xbe(t)})}function qEt(e){const t=U$();return y.useMemo(()=>({...e,themeType:t}),[e,t])}const YEt="http://www.w3.org/2000/svg",$Et="http://www.w3.org/1999/xlink",eAe=/<svg\b(?:[^>"']|"[^"]*"|'[^']*')*>/i,_6=16384,KEt=_6*_6,XEt=2;function V$(e){return new RegExp(`\\s${e}\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s"'>]+)`,"i")}function rR(e,t){const n=e.match(V$(t));return n?n[0].replace(/^[^=]*=\s*/,"").replace(/^["']|["']$/g,""):null}function aC(e,t,n){const r=` ${t}="${n}"`,s=V$(t);return s.test(e)?e.replace(s,r):e.replace(/\s*\/?>$/,o=>`${r}${o}`)}function tAe(e){const t=e.match(eAe)?.[0],n=t?rR(t,"viewBox"):null;if(!n)return null;const r=n.trim().split(/[\s,]+/).map(Number);if(r.length!==4)return null;const[,,s,o]=r;return Number.isFinite(s)&&Number.isFinite(o)&&s>0&&o>0?{width:s,height:o}:null}function G$(e){const t=e.match(eAe);if(!t)return e;let n=t[0];rR(n,"xmlns")||(n=aC(n,"xmlns",YEt)),e.includes("xlink:")&&!rR(n,"xmlns:xlink")&&(n=aC(n,"xmlns:xlink",$Et));const r=tAe(e);if(r){n=aC(n,"width",String(r.width)),n=aC(n,"height",String(r.height));const s=rR(n,"style");if(s!==null){const o=s.split(";").filter(i=>i.trim()&&!/^\s*max-width\s*:/i.test(i)).join(";").trim();n=o?aC(n,"style",o):n.replace(V$("style"),"")}}return e.replace(t[0],()=>n)}function AU(e,t=new Date){const n=o=>String(o).padStart(2,"0"),r=`${t.getFullYear()}${n(t.getMonth()+1)}${n(t.getDate())}`,s=`${n(t.getHours())}${n(t.getMinutes())}${n(t.getSeconds())}`;return`mermaid-${r}-${s}.${e}`}function QEt(e,t){const n=Math.min(XEt,_6/e,_6/t,Math.sqrt(KEt/(e*t)));return n>=1?n:null}function nAe(e){return new Blob([G$(e)],{type:"image/svg+xml"})}function NU(e){return G$(new XMLSerializer().serializeToString(e))}function ZEt(e){const t=new DOMParser().parseFromString(e,"text/html").querySelector("svg");if(!t)throw new Error("No svg in markup");return NU(t)}function gae(e,t){const n=typeof e=="string"?e:URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.click(),typeof e!="string"&&setTimeout(()=>URL.revokeObjectURL(n),0)}async function JEt(e,t,n,r,s){const o=new Image;o.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,await o.decode();const i=document.createElement("canvas");i.width=Math.floor(t*r),i.height=Math.floor(n*r);const l=i.getContext("2d");if(!l)throw new Error("Canvas unavailable");l.fillStyle=s,l.fillRect(0,0,i.width,i.height),l.drawImage(o,0,0,i.width,i.height);const c=i.toDataURL("image/png");if(!c.startsWith("data:image/png"))throw new Error("Canvas export failed");return c}async function eTt(e){const t=o=>{try{const i=e.currentSvg();return i?(e.download(nAe(i),AU("svg")),{kind:"svg",reason:o}):{kind:"failed"}}catch{return{kind:"failed"}}};let n;try{n=G$(await e.rerender())}catch{return t("rerender-failed")}if(/<foreignObject\b/i.test(n))return t("rerender-failed");const r=tAe(n);if(!r)return t("draw-failed");const s=QEt(r.width,r.height);if(s===null)return t("too-large");try{const o=await e.rasterize(n,r.width,r.height,s);return e.download(o,AU("png")),{kind:"png"}}catch{return t("draw-failed")}}const tTt="position:fixed;left:0;top:0;width:800px;height:600px;overflow:hidden;opacity:0;pointer-events:none;visibility:hidden;contain:strict;";function nTt(e){return!e.includes("<svg")||/\bfocusable=/.test(e)?e:e.replace("<svg",'<svg focusable="false" tabindex="-1"')}function rTt(e){return{startOnLoad:!1,theme:e,securityLevel:"strict",fontFamily:"inherit",suppressErrorRendering:!0,flowchart:{htmlLabels:!1,useMaxWidth:!0}}}const sTt=/<(?:a|area)\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,oTt=/\s(?:xlink:)?(?:href|target)\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]+)/gi;function iTt(e){return e.replace(sTt,t=>t.replace(oTt,""))}let s3=null,o3=null,vae=Promise.resolve(),aTt=0;async function lTt(){return o3||(s3||(s3=Be(()=>import("./mermaid.core-DYNgKgJW.js").then(e=>e.cb),[],import.meta.url).then(e=>(o3=e.default,o3)).catch(e=>{throw s3=null,e})),s3)}function cTt(e){const t=vae.then(e,e);return vae=t.then(()=>{},()=>{}),t}async function xae(e,t,n={}){return cTt(async()=>{const r=await lTt();r.initialize({...rTt(t),...n});const s=`ensoMermaid${++aTt}`,o=document.createElement("div");o.setAttribute("aria-hidden","true"),o.style.cssText=tTt,document.body.appendChild(o);try{const{svg:i}=await r.render(s,e,o);return nTt(iTt(i))}finally{o.remove(),document.getElementById(s)?.remove(),document.getElementById(`d${s}`)?.remove()}})}const i3=.1,uTt={dark:"#1f2020",default:"#ffffff"},a3=.1;function dTt({code:e,streaming:t=!1,className:n}){const{t:r}=Se(),s=y.useRef(null),[o,i]=y.useState(null),[l,c]=y.useState(null),[u,d]=y.useState(1),[f,h]=y.useState({x:0,y:0}),[p,m]=y.useState(!1),[v,b]=y.useState(!1);MN(v);const x=y.useRef({x:0,y:0}),S=y.useRef({x:0,y:0}),k=y.useRef(null),C=y.useRef(!1),N=U$()==="dark"?"dark":"default";y.useEffect(()=>{if(t){i(null),c(null);return}let T=!1;return(async()=>{if(!e.trim()){i(null),c(null);return}try{const P=await xae(e,N);T||(i(P),c(null),d(1),h({x:0,y:0}))}catch(P){T||(c(P instanceof Error?P.message:"Mermaid render failed"),i(null))}})(),()=>{T=!0}},[e,N,t]);const j=y.useCallback(()=>d(T=>T+i3),[]),I=y.useCallback(()=>d(T=>Math.max(T-i3,a3)),[]),_=y.useCallback(()=>{d(1),h({x:0,y:0})},[]),L=y.useCallback(()=>{b(!1),d(1),h({x:0,y:0})},[]),M=y.useCallback(()=>{b(!0),requestAnimationFrame(()=>{const T=k.current,U=T?.firstElementChild;if(!T||!U?.offsetWidth||!U.offsetHeight)return;const P=24,K=Math.min((T.clientWidth-P*2)/U.offsetWidth,(T.clientHeight-P*2)/U.offsetHeight);d(Math.round(K*100)/100),h({x:0,y:0})})},[]),F=y.useCallback(T=>{if(!v)return;T.preventDefault();const U=T.deltaY>0?-i3:i3;d(P=>Math.round(Math.max(P+U,a3)*100)/100)},[v]),D=y.useCallback(T=>{!v||T.button!==0||(m(!0),C.current=!1,x.current={x:T.clientX,y:T.clientY},S.current={...f})},[v,f]),R=y.useCallback(T=>{if(!p)return;const U=T.clientX-x.current.x,P=T.clientY-x.current.y;(Math.abs(U)>2||Math.abs(P)>2)&&(C.current=!0),h({x:S.current.x+U,y:S.current.y+P})},[p]),z=y.useCallback(()=>m(!1),[]),B=y.useCallback(T=>{T.stopPropagation()},[]),H=y.useCallback(()=>{C.current||L()},[L]),G=y.useCallback(()=>{try{const T=s.current?.querySelector("svg");if(!T)throw new Error("No svg");gae(nAe(NU(T)),AU("svg"))}catch{Ht({type:"error",title:r("Export failed")})}},[r]),te=y.useCallback(async()=>{const T=await eTt({currentSvg:()=>{const U=s.current?.querySelector("svg");return U?NU(U):null},rerender:async()=>ZEt(await xae(e,N,{htmlLabels:!1})),rasterize:(U,P,K,J)=>JEt(U,P,K,J,uTt[N]),download:gae});T.kind==="failed"?Ht({type:"error",title:r("Export failed")}):T.kind==="svg"&&Ht({type:"warning",title:T.reason==="too-large"?r("Diagram is too large for PNG, exported SVG instead"):r("PNG export failed, exported SVG instead")})},[e,N,r]),W=T=>{const U=T==="sm"?"h-6 w-6":"h-7 w-7",P=T==="sm"?"h-3.5 w-3.5":"h-4 w-4",K=T==="sm"?"h-6 min-w-[2.5rem]":"h-7 min-w-[3rem]";return a.jsxs("div",{className:"flex items-center gap-1 rounded-md border border-border bg-background/95 p-1 shadow-sm",children:[a.jsx("button",{type:"button",onClick:j,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Zoom in"),children:a.jsx(xs,{className:P})}),a.jsxs("button",{type:"button",onClick:_,className:xe("flex items-center justify-center rounded text-xs transition-colors hover:bg-accent hover:text-accent-foreground",K),title:r("Reset zoom"),children:[Math.round(u*100),"%"]}),a.jsx("button",{type:"button",onClick:I,disabled:u<=a3,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U,u<=a3&&"cursor-not-allowed opacity-50"),title:r("Zoom out"),children:a.jsx(kxe,{className:P})}),u!==1&&a.jsx("button",{type:"button",onClick:_,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Fit to original size"),children:a.jsx($u,{className:P})}),a.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),a.jsx("button",{type:"button",onClick:G,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Export SVG"),children:a.jsx(Lf,{className:P})}),a.jsx("button",{type:"button",onClick:()=>{te()},className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Export PNG"),children:a.jsx(yHe,{className:P})}),v?a.jsx("button",{type:"button",onClick:L,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Exit fullscreen"),children:a.jsx(aUe,{className:P})}):a.jsx("button",{type:"button",onClick:M,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("View fullscreen"),children:a.jsx(wxe,{className:P})})]})};return l?a.jsxs("div",{className:xe("overflow-x-auto rounded-lg border border-destructive/50",n),children:[a.jsx("div",{className:"flex items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:a.jsx("span",{children:r("Mermaid render error")})}),a.jsx("pre",{className:"p-4 text-sm",children:a.jsx("code",{className:"block font-mono leading-relaxed text-muted-foreground",children:e})}),a.jsx("div",{className:"border-t border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:l})]}):o?a.jsxs("div",{className:xe("relative rounded-lg border border-border bg-muted/30",n),style:{userSelect:"none",WebkitUserSelect:"none"},children:[a.jsx("div",{ref:s,className:xe("max-h-[min(50vh,20rem)] overflow-hidden [overflow-anchor:none]",v&&(p?"cursor-grabbing":"cursor-grab")),onWheel:F,onMouseDown:D,onMouseMove:R,onMouseUp:z,onMouseLeave:z,onDoubleClick:v?void 0:M,children:a.jsx("div",{className:"origin-center transition-transform duration-100 ease-out",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${u})`},children:a.jsx("div",{className:"p-4",dangerouslySetInnerHTML:{__html:o}})})}),a.jsx("div",{className:"absolute right-2 bottom-2",children:W("sm")}),v&&a.jsxs("div",{className:"fixed inset-0 flex select-none flex-col bg-background",style:{zIndex:_r.TOAST},"data-enso-float":"",onClick:H,onKeyDown:T=>{T.key==="Escape"&&L()},children:[a.jsxs("div",{className:"relative z-10 flex shrink-0 items-center justify-between border-b border-border bg-muted/30 px-4 py-2",onClick:T=>T.stopPropagation(),onKeyDown:T=>T.stopPropagation(),children:[a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:r("Mermaid preview")}),a.jsx("button",{type:"button",onClick:L,className:"flex h-7 w-7 items-center justify-center rounded-md border border-border bg-background/95 text-sm transition-colors hover:bg-accent hover:text-accent-foreground",title:r("Exit fullscreen"),children:a.jsx(Jr,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[a.jsx("div",{ref:k,className:xe("flex min-h-0 flex-1 select-none overflow-hidden",p?"cursor-grabbing":"cursor-grab"),onWheel:F,onMouseDown:D,onMouseMove:R,onMouseUp:z,onMouseLeave:z,onClick:B,onKeyDown:B,children:a.jsx("div",{className:"m-auto origin-center transition-transform duration-100 ease-out",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${u})`},children:a.jsx("div",{className:"p-4",dangerouslySetInnerHTML:{__html:o}})})}),a.jsx("div",{className:"absolute right-4 bottom-4",children:W("md")})]})]})]}):a.jsx("div",{className:xe("flex items-center justify-center rounded-lg border border-border bg-muted/30 p-8",n),children:a.jsx("div",{className:"text-sm text-muted-foreground",children:r("Loading Mermaid diagram...")})})}const fTt=/^[a-z][a-z\d+.-]*:/i,hTt=/^(?:https?|ircs?|mailto|xmpp):/i,pTt=/^(?:[a-z]:[\\/]|\\\\)/i;function mTt(e){const t=e?.trim();if(!t||!/^https?:\/\//i.test(t))return null;try{return new URL(t)}catch{return null}}function rAe(e){const t=/^(.*?):(\d+)(?:-\d+)?$/.exec(e);if(!t)return{path:e};const n=Number(t[2]);return n>0?{path:t[1],line:n}:{path:t[1]}}function gTt(e){try{return decodeURIComponent(e)}catch{return null}}function vTt(e){const t=e.search(/[?#]/);return t<0?e:e.slice(0,t)}function xTt(e){try{const t=new URL(e);if(t.protocol!=="file:")return null;let n=decodeURIComponent(t.pathname);return n?(t.hostname&&t.hostname.toLowerCase()!=="localhost"?n=`//${t.hostname}${n}`:/^\/[a-z]:[\\/]/i.test(n)&&(n=n.slice(1)),n):null}catch{return null}}function bae(e){const t=e.trim();if(!t||t.startsWith("#")||t.startsWith("?"))return{kind:"external"};if(/^file:/i.test(t)){const r=xTt(t);return r?{kind:"local",path:r}:{kind:"blocked"}}if(hTt.test(t)||t.startsWith("//"))return{kind:"external"};const n=gTt(vTt(t));return n==null||n.includes("\0")?{kind:"blocked"}:fTt.test(n)&&!pTt.test(n)?{kind:"blocked"}:{kind:"local",path:n}}function Kw(e){const t=e.replace(/\\/g,"/"),n=/^[a-z]:\//i.test(t)||t.startsWith("//");if(!n&&!t.startsWith("/"))return null;const r=/^[a-z]:\//i.test(t)?t.slice(0,2).toLowerCase():null,o=(r||n?t.slice(2):t.slice(1)).split("/"),i=[];for(const l of o)if(!(!l||l==="."))if(l===".."){if(i.length===0)return null;i.pop()}else i.push(l);return r?{value:`${r}/${i.join("/")}`.replace(/\/$/,""),windows:!0}:n?{value:`//${i.join("/")}`,windows:!0}:{value:`/${i.join("/")}`.replace(/\/$/,"")||"/",windows:!1}}function YD(e){const t=e.replace(/\\/g,"/"),n=[];for(const r of t.split("/"))if(!(!r||r==="."))if(r===".."){if(n.length===0)return null;n.pop()}else{if(r.includes("\0"))return null;n.push(r)}return n.join("/")}function Zln(e){return Kw(e)!==null}function r1(e,t){if(!t)return Kw(e)?null:YD(e);const n=Kw(t);if(!n)return null;const r=n.windows&&/^\/[a-z]:[\\/]/i.test(e)?e.slice(1):e,s=Kw(r);if(!s)return r===e?YD(e):null;if(s.windows!==n.windows)return null;const o=n.value.toLowerCase(),i=s.value.toLowerCase();if(i===o)return"";const l=n.value.endsWith("/")?n.value:`${n.value}/`;return i.startsWith(l.toLowerCase())?YD(s.value.slice(l.length)):null}function bTt(e,t){const n=t?Kw(t):null;if(!n||r1(e,t)!==null)return null;const r=n.windows&&/^\/[a-z]:[\\/]/i.test(e)?e.slice(1):e;return Kw(r)?r:null}const yTt=/^(?:%|ms|s|sec|min|h|ms\/op|ns|µs|us|b|kb|mb|gb|tb|kib|mib|gib|x|×|k|m|bn)$/i;function IU(e){let t=e.trim().replace(/^[$€£¥₹]\s*/,""),n=!1;/^\(.*\)$/.test(t)&&(n=!0,t=t.slice(1,-1));const r=/^([+-]?(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?)\s*(\S*)$/.exec(t);if(!r||r[2]&&!yTt.test(r[2]))return null;const s=Number(r[1].replace(/,/g,""));return n?-s:s}function wTt(e){const t=Math.max(0,...e.map(n=>n.length));return Array.from({length:t},(n,r)=>{const s=e.map(o=>o[r]?.trim()??"").filter(Boolean);return s.length>0&&s.every(o=>IU(o)!==null)})}function kTt(e,t,n){return n?(IU(e)??0)-(IU(t)??0):e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function STt(e,t,n){const r=e.map((i,l)=>l);if(!t)return r;const s=t.dir==="asc"?1:-1,o=i=>e[i][t.column]?.trim()??"";return r.sort((i,l)=>{const c=o(i),u=o(l);return!c||!u?c?-1:u?1:0:s*kTt(c,u,n[t.column]??!1)||i-l})}function CTt(e,t){return e?.column!==t?{column:t,dir:"asc"}:e.dir==="asc"?{column:t,dir:"desc"}:null}const ETt=new Set(["json","jsonc","json5"]),TTt=new Set(["console","shell-session","terminal","output","ansi"]),ATt=new Set(["sh","bash","shell","zsh","shellscript"]),P6="$ ";function NTt(e,t){const n=e?.toLowerCase();if(n&&ETt.has(n))return yae(t)?"json":null;if(!n&&/^\s*[{[]/.test(t)&&yae(t))return"json";if(n&&TTt.has(n)||t.includes("\x1B["))return"terminal";if(!n||ATt.has(n)){const r=t.split(`
|
|
326
|
+
\v\f
\u2028\u2029])`),t));else if(c==="posix")if(!s&&(d==="graph"||d==="print")){if(r==="strict")throw new Error(`POSIX class "${d}" requires min target ES2024 or non-strict accuracy`);let f={graph:"!-~",print:" -~"}[d];u&&(f=`\0-${cl(f.codePointAt(0)-1)}${cl(f.codePointAt(2)+1)}-`),n(wa(Vm(`[${f}]`),t))}else n(wa(GD(Vm(YCt.get(d)),u),t));else if(c==="property")F$.has(LP(d))||(e.key="sc");else if(c==="space")n(nv(vw("space",{negate:u}),t));else if(c==="word")n(wa(GD(Vm(Um),u),t));else throw new Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:l,flags:c}=e;if(l==="flags")if(!c.enable&&!c.disable)r();else{const u=ph({flags:c});u.body[0].body=i(),s(wa(u,t),{traverse:!0})}else if(l==="keep"){const u=n.body[0],f=n.body.length===1&&kTe(u,{type:"Group"})&&u.body[0].body.length===1?u.body[0]:n;if(t.parent!==f||f.body.length>1)throw new Error(ps`Uses "\K" in a way that's unsupported`);const h=Mb({behind:!0});h.body[0].body=o(),s(wa(h,t))}else throw new Error(`Unexpected directive kind "${l}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if(r==="fail")n(wa(Mb({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=ph();t.body[0].body.push(e.body),e.body=wa(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,s=!1;for(const o of e.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=BTe(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>t.add(o))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t==="strict"&&n&&r)throw new Error(ps`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!VD(n)&&(n=UD(n,t),e.ref=n)}},QCt={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=e;r||n.set(e,[...t.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:l,reffedNodesByReferencer:c}){const u=s.get(e);if(u&&l.has(e.number)){const f=nv(cae(e.number),t);c.set(f,l.get(e.number)),n(f);return}l.set(e.number,e),i.set(e.number,[]),e.name&&ZT(i,e.name,[]);const d=i.get(e.name??e.number);for(let f=0;f<d.length;f++){const h=d[f];if(u===h.node||u&&u===h.origin||e===h.origin){d.splice(f,1);break}}if(i.get(e.number).push({node:e,origin:u}),e.name&&i.get(e.name).push({node:e,origin:u}),e.name){const f=ZT(o,e.name,new Map);let h=!1;if(u)h=!0;else for(const p of f.values())if(!p.hasDuplicateNameToRemove){h=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:h})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=I6(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:s,ref:o}=e;if(s){let d=t;for(;(d=d.parent)&&!(d.type==="CapturingGroup"&&(d.name===o||d.number===o)););r.reffedNodesByReferencer.set(e,d);return}const i=r.subroutineRefMap.get(o),l=o===0,c=l?cae(0):LTe(i,r.groupOriginByCopy,null);let u=c;if(!l){const d=OTe(tEt(i,h=>h.type==="Group"&&!!h.flags)),f=d?I6(r.globalFlags,d):r.globalFlags;JCt(f,r.currentFlags)||(u=ph({flags:nEt(f)}),u.body[0].body.push(c))}n(wa(u,t),{traverse:!l})}},ZCt={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}const o=r.reffedNodesByReferencer.get(e).filter(i=>eEt(i,e));if(!o.length)n(wa(Mb({negate:!0}),t));else if(o.length>1){const i=ph({atomic:!0,body:o.reverse().map(l=>Cy({body:[wU(l.number)]}))});n(wa(i,t))}else e.ref=o[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=CTe();e.body.at(-1).body.push(s)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function PTe(e){GE(e,{"*"({node:t,parent:n}){t.parent=n}})}function JCt(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function eEt(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const r=DTe(n.parent);for(const s of r){if(s===n)break;if(s===e||FTe(s,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function LTe(e,t,n,r){const s=Array.isArray(e)?[]:{};for(const[o,i]of Object.entries(e))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=LTe(i,t,s,n):(o==="type"&&i==="CapturingGroup"&&t.set(s,t.get(e)??e),s[o]=i);return s}function cae(e){const t=TTe(e);return t.isRecursive=!0,t}function tEt(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function UD(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function OTe(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:r})=>{t.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function nEt({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function DTe(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function BTe(e){const t=e.find(n=>n.kind==="search_start"||oEt(n,{negate:!1})||!rEt(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const r of t.body){const s=BTe(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function FTe(e,t){const n=DTe(e)??[];for(const r of n)if(r===t||FTe(r,t))return!0;return!1}function rEt({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function sEt(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function oEt(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&kTe(e.body[0],{type:"Assertion",kind:"search_start"})}function VD(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Vm(e,t){const r=STe(e,{...t,unicodePropertyMap:F$}).body;return r.length>1||r[0].body.length>1?ph({body:r}):r[0].body[0]}function GD(e,t){return e.negate=t,e}function nv(e,t){return e.parent=t,e}function wa(e,t){return PTe(e),e.parent=t,e}function iEt(e,t){const n=RTe(t),r=CU(n.target,"ES2024"),s=CU(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,l=null;if(!s){const p=[e.flags.ignoreCase];GE(e,aEt,{getCurrentModI:()=>p.at(-1),popModI(){p.pop()},pushModI(m){p.push(m)},setHasCasedChar(){p.at(-1)?i=!0:l=!0}})}const c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||i)&&!l)};let u=e;const d={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:u,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&l),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(p){return d.lastNode=u,u=p,zCt(lEt[p.type],`Unexpected node type "${p.type}"`)(p,d,f)}const h={pattern:e.body.map(f).join("|"),flags:f(e.flags),options:{...e.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],d.captureMap.forEach((p,m)=>{p.hidden&&h._hiddenCaptures.push(m),p.transferTo&&ZT(h._captureTransfers,p.transferTo,[]).push(m)}),h}var aEt={"*":{enter({node:e},t){if(dae(e)){const n=t.getCurrentModI();t.pushModI(e.flags?I6({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){dae(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){z$(cl(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),zTe(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&_Te.has(e.value)&&t.setHasCasedChar()}},lEt={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?ps`\B`:ps`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:s,number:o}=e,i={ignoreCase:t.currentFlags.ignoreCase},l=t.originMap.get(e);return l&&(i.hidden=!0,o>l.number&&(i.transferTo=l.number)),t.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=cl(e),r=G1(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&z$(n)){const s=MTe(n);return t.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:s,parent:o}=e;let{body:i}=e;if(r==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");kh.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(fae)&&(i=[PP(45),...i.filter(u=>!fae(u))]);const l=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||kh.bugNestedClassIgnoresNegation)&&!s){const d=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(d.length){const f=ph(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(p=>!d.includes(p)),e.body=i,i.length?(e.parent=h,h.body.push(e)):f.body.pop(),d.forEach(p=>{const m=Cy({body:[p]});p.parent=m,m.parent=f,f.body.push(m)}),n(f)}}t.inCharClass=!0;const u=l();return t.inCharClass=!1,u}const c=i[0];if(r==="union"&&!s&&c&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(kh.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&i.length===1&&c.type!=="CharacterClassRange"))return i.map(n).join("");if(!t.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return l()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=G1(n,s),i=G1(r,s),l=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const c=zTe(e);hEt(c).forEach(d=>{l.add(Array.isArray(d)?`${G1(d[0],s)}-${G1(d[1],s)}`:G1(d,s))})}return`${o}-${i}${[...l].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":ps`[^\n]`;if(e==="digit")return t?ps`\D`:ps`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&_Te.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?ps`\P`:ps`\p`}{${r?`${r}=`:""}${n}}`}if(e==="word")return t?ps`\W`:ps`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=I6(i,n));const l=t.map(o).join("|"),c=!s.verbose&&t.length===1&&r.type!=="Quantifier"&&!e&&(!s.useFlagMods||!n)?l:`(?${pEt(e,n,s.useFlagMods)}${l})`;return s.currentFlags=i,c},LookaroundAssertion({body:e,kind:t,negate:n},r,s){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(s).join("|")})`},Quantifier(e,t,n){return n(e.body)+mEt(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return t===0?`(?R=${r})`:ps`\g<${t}&R=${r}>`}},cEt=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),uEt=new Set(["-","\\","]","^","["]),dEt=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),uae=new Map([[9,ps`\t`],[10,ps`\n`],[11,ps`\v`],[12,ps`\f`],[13,ps`\r`],[8232,ps`\u2028`],[8233,ps`\u2029`],[65279,ps`\uFEFF`]]),fEt=new RegExp("^\\p{Cased}$","u");function z$(e){return fEt.test(e)}function zTe(e,t){const n=!!t?.firstOnly,r=e.min.value,s=e.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const l=cl(i);if(!z$(l))continue;const c=MTe(l).filter(u=>{const d=u.codePointAt(0);return d<r||d>s});if(c.length&&(o.push(...c),n))break}return o}function G1(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(uae.has(e))return uae.get(e);if(e<32||e>126&&e<160||e>262143||t&&gEt(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?dEt:uEt:cEt,o=cl(e);return(s.has(o)?"\\":"")+o}function hEt(e){const t=e.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<t.length;s++)t[s+1]===t[s]+1?r??=t[s]:r===null?n.push(t[s]):(n.push([r,t[s]]),r=null);return n}function pEt(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:s,disable:o}=t;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function mEt({kind:e,max:t,min:n}){let r;return!n&&t===1?r="?":!n&&t===1/0?r="*":n===1&&t===1/0?r="+":n===t?r=`{${n}}`:r=`{${n},${t===1/0?"":t}}`,r+{greedy:"",lazy:"?",possessive:"+"}[e]}function dae({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function gEt(e){return e>47&&e<58}function fae({type:e,value:t}){return e==="Character"&&t===45}var vEt=class EU extends RegExp{#t=new Map;#e=null;#s;#n=null;#i=null;rawOptions={};get source(){return this.#s||"(?:)"}constructor(t,n,r){const s=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=t;super(o,n),this.#s=o.source,o instanceof EU&&(this.#t=o.#t,this.#n=o.#n,this.#i=o.#i,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":t,n),this.#s=t,this.#t=bEt(o.hiddenCaptures,o.transfers),this.#i=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(t){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new EU(this.#s,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#i==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#l(t.slice(r));return s&&(xEt(s,r,t,this.hasIndices),this.lastIndex+=r),s}return this.#l(t)}#l(t){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,t);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:l,transferTo:c}=this.#t.get(i)??{};if(l?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),c&&r[i]!==void 0){const u=o[c];if(!u)throw new Error(`Invalid capture transfer to "${u}"`);if(n[u]=r[i],this.hasIndices&&(n.indices[u]=s[i]),n.groups){this.#n||(this.#n=yEt(this.source));const d=this.#n.get(c);d&&(n.groups[d]=r[i],this.hasIndices&&(n.indices.groups[d]=s[i]))}}}return n}};function xEt(e,t,n,r){if(e.index+=t,e.input=n,r){const s=e.indices;for(let i=0;i<s.length;i++){const l=s[i];l&&(s[i]=[l[0]+t,l[1]+t])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const l=o[i];l&&(o[i]=[l[0]+t,l[1]+t])})}}function bEt(e,t){const n=new Map;for(const r of e)n.set(r,{hidden:!0});for(const[r,s]of t)for(const o of s)ZT(n,o,{}).transferTo=r;return n}function yEt(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=t.exec(e);){const{0:i,groups:{capture:l,name:c}}=o;i==="["?r++:r?i==="]"&&r--:l&&(s++,c&&n.set(s,c))}return n}function wEt(e,t){const n=kEt(e,t);return n.options?new vEt(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function kEt(e,t){const n=RTe(t),r=STe(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:F$}),s=KCt(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=iEt(s,n),i=BCt(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),l=OCt(i.pattern),c=LCt(l.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),u={pattern:c.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const d=c.hiddenCaptures.sort((m,v)=>m-v),f=Array.from(c.captureTransfers),h=s._strategy,p=u.pattern.length>=n.lazyCompileLength;(d.length||f.length||h||p)&&(u.options={...d.length&&{hiddenCaptures:d},...f.length&&{transfers:f},...h&&{strategy:h},...p&&{lazyCompile:p}})}return u}function SEt(e,t){return wEt(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function HTe(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||=n=>SEt(n,{target:t.target}),{createScanner(n){return new FSt(n,t)},createString(n){return{content:n}}}}const CEt=["markdown","typescript","tsx","javascript","jsx","json","css","html","html-derivative","python","rust","go","shellscript","yaml"];let hae=null;function EEt(){return hae??=gTe({themes:["github-dark","github-light"],langs:[...CEt],engine:HTe()}),hae}const TEt=200,AEt=20*1024*1024,Sp=new Map;let WD=0;function NEt(e){const t=Sp.get(e);return t!==void 0&&(Sp.delete(e),Sp.set(e,t)),t}function IEt(e,t){if(!Sp.has(e))for(Sp.set(e,t),WD+=t.length*2;(Sp.size>TEt||WD>AEt)&&Sp.size>0;){const n=Sp.keys().next().value;WD-=(Sp.get(n)?.length??0)*2,Sp.delete(n)}}async function UTe(e,t,n=!0){const r=`${t}\0${e}`;if(n){const s=NEt(r);if(s!==void 0)return s}try{const s=await EEt(),o=s.getLoadedLanguages().includes(t)?t:"text",i=s.codeToHtml(e,{lang:o,themes:{light:"github-light",dark:"github-dark"},defaultColor:"light"});return n&&IEt(r,i),i}catch(s){return console.error("snippet highlight failed:",s),null}}const pae="my-2 overflow-x-auto rounded-lg border bg-[var(--sunken,var(--muted))] text-(length:--chat-code-block-size) [font-weight:var(--chat-code-block-weight)] leading-relaxed";function jEt(e){const t=e.trimStart();return/^<[a-zA-Z!/]/.test(t)?"html":/^[{[]/.test(t)?"json":/^[$#] /.test(t)?"shellscript":"text"}function j6({code:e,language:t,streaming:n=!1}){const[r,s]=y.useState(null);y.useEffect(()=>{if(n){s(null);return}let i=!0;return UTe(e,t??jEt(e),!0).then(l=>{i&&s(l)}),()=>{i=!1}},[e,t,n]);const o=!n&&a.jsx(px,{text:e,className:"absolute top-1.5 right-1.5 rounded-md border bg-background/80 p-1.5 text-muted-foreground opacity-0 backdrop-blur transition-opacity group-hover/code:opacity-100"});return r==null?a.jsxs("div",{"data-enso":"code-block","data-language":t,className:"group/code relative",children:[a.jsx("pre",{className:`${pae} p-3 font-mono`,children:a.jsx("code",{children:e})}),o]}):a.jsxs("div",{"data-enso":"code-block","data-language":t,className:"group/code relative",children:[a.jsx("div",{className:`${pae} [&_pre]:m-0 [&_pre]:overflow-x-auto [&_pre]:bg-transparent! [&_pre]:p-3 [&_pre]:font-mono [&_pre]:[--shiki-dark-bg:transparent]!`,dangerouslySetInnerHTML:{__html:r}}),o]})}const REt=50,mae=200,MEt=3e4,VTe={status:"missing"},R6=new Map,nR=new Map,TU=new Set,M6=new Map;let GTe=null,H$=0;const qD={batches:0,paths:0,ms:0},_Et=e=>e.cwd??`conversation:${e.conversationId}`,BP=(e,t)=>`${_Et(e)}\0${t}`;function PEt(e){return e?e.state.status==="ok"?e.epoch===H$:Date.now()-e.at<MEt:!1}function WTe(e,t){const n=R6.get(e)?.state,r=n?.status===t.status&&(t.status==="missing"||n.status==="ok"&&n.rel===t.rel&&n.kind===t.kind);if(R6.set(e,{state:r&&n?n:t,epoch:H$,at:Date.now()}),!r)for(const s of nR.get(e)??[])s()}function LEt(e){return e?{status:"ok",rel:e.rel,kind:e.kind}:VTe}async function qTe(e,t){const n=performance.now();try{const r=await window.electronAPI.workspaceFiles.resolveLinks({conversationId:e.conversationId,projectId:e.projectId,rels:t});return t.map((s,o)=>LEt(r.ok?r.items[o]:null))}catch{return t.map(()=>VTe)}finally{qD.batches+=1,qD.paths+=t.length,qD.ms+=performance.now()-n}}function OEt(){GTe=null;const e=[...M6.values()];M6.clear();for(const{scope:t,rels:n}of e){const r=[...n];for(let s=0;s<r.length;s+=mae){const o=r.slice(s,s+mae);qTe(t,o).then(i=>{o.forEach((l,c)=>{const u=BP(t,l);TU.delete(u),WTe(u,i[c])})})}}}function DEt(e,t){const n=BP(e,t);if(TU.has(n)||PEt(R6.get(n)))return;TU.add(n);const r=`${e.conversationId}\0${e.projectId}`,s=M6.get(r)??{scope:e,rels:new Set};s.rels.add(t),M6.set(r,s),GTe??=setTimeout(OEt,REt)}function BEt(){H$+=1}async function YTe(e,t){const[n]=await qTe(e,[t]);return WTe(BP(e,t),n),n}function $Te(e,t,n){const r=e&&t?BP(e,t):null,s=y.useCallback(i=>{if(!r)return()=>{};const l=nR.get(r)??new Set;return nR.set(r,l),l.add(i),()=>{l.delete(i),l.size===0&&nR.delete(r)}},[r]),o=y.useSyncExternalStore(s,()=>r?R6.get(r)?.state:void 0);return y.useEffect(()=>{n&&e&&t&&DEt(e,t)},[n,r]),o}const KTe=y.createContext({query:"",activeKey:"",activeNth:-1});function FEt(){return y.useContext(KTe)}const XTe="rounded-[2px] px-0.5 py-px",zEt=`${XTe} bg-yellow-300 text-foreground dark:bg-yellow-500/80`,HEt=`${XTe} bg-orange-600 text-white dark:bg-orange-500`;function QTe(e,t,n,r){const s=t.trim();if(!s)return e;const o=e.toLowerCase(),i=s.toLowerCase();let l=0,c=o.indexOf(i,l);if(c<0)return e;const u=[];for(;c>=0;){c>l&&u.push(e.slice(l,c));const d=r.n++;u.push(a.jsx("mark",{className:d===n?HEt:zEt,children:e.slice(c,c+s.length)},d)),l=c+s.length,c=o.indexOf(i,l)}return l<e.length&&u.push(e.slice(l)),u}function ZTe(e,t,n,r){return e==null||typeof e=="boolean"?e:typeof e=="string"||typeof e=="number"?QTe(String(e),t,n,r):Array.isArray(e)?e.map((s,o)=>a.jsx(y.Fragment,{children:ZTe(s,t,n,r)},o)):e}const UEt=2;function VEt({value:e}){return typeof e=="string"?a.jsx("span",{className:"text-emerald-700 dark:text-emerald-400",children:JSON.stringify(e)}):typeof e=="number"?a.jsx("span",{className:"text-sky-700 dark:text-sky-400",children:String(e)}):a.jsx("span",{className:"text-violet-700 dark:text-violet-400",children:String(e)})}function JTe({name:e,value:t,depth:n}){const[r,s]=y.useState(n<UEt),o=e!==void 0&&a.jsxs("span",{className:"text-foreground/80",children:[e,a.jsx("span",{className:"text-muted-foreground",children:": "})]});if(t===null||typeof t!="object")return a.jsxs("div",{className:"pl-4",children:[o,a.jsx(VEt,{value:t})]});const i=Array.isArray(t),l=i?t.map((d,f)=>[String(f),d]):Object.entries(t),[c,u]=i?["[","]"]:["{","}"];return a.jsxs("div",{className:n>0?"pl-4":void 0,children:[a.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>s(!r),className:"-ml-4 inline-flex items-center text-left hover:text-foreground",children:[a.jsx(Bs,{className:xe("h-3 w-3 shrink-0 transition-transform",r&&"rotate-90")}),a.jsxs("span",{className:"ml-1",children:[o,a.jsxs("span",{className:"text-muted-foreground",children:[c,!r&&` ${l.length} ${u}`]})]})]}),r&&a.jsxs(a.Fragment,{children:[l.map(([d,f])=>a.jsx(JTe,{name:i?void 0:d,value:f,depth:n+1},d)),a.jsx("div",{className:"text-muted-foreground",children:u})]})]})}function GEt({source:e,value:t}){const{t:n}=Se(),[r,s]=y.useState(!1),o=i=>xe("rounded px-1.5 py-0.5",i?"bg-muted text-foreground":"hover:text-foreground");return a.jsxs("div",{"data-enso":"json-tree",className:"group/code relative my-2 rounded-lg border",children:[a.jsxs("div",{className:"flex items-center gap-1 border-b px-2 py-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{className:"mr-auto font-mono",children:"JSON"}),a.jsx("button",{type:"button",className:o(!r),onClick:()=>s(!1),children:n("Tree view")}),a.jsx("button",{type:"button",className:o(r),onClick:()=>s(!0),children:n("Raw text")}),a.jsx(px,{text:e,className:"rounded p-1"})]}),r?a.jsx("div",{className:"px-2",children:a.jsx(j6,{code:e,language:"json"})}):a.jsx("div",{className:"max-h-[480px] overflow-auto py-2 pr-3 pl-6 font-mono text-(length:--chat-code-block-size) leading-relaxed",children:a.jsx(JTe,{value:t,depth:0})})]})}function WEt(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function U$(){const e=be(s=>s.theme),t=be(s=>s.terminalTheme),[n,r]=y.useState(WEt);return y.useEffect(()=>{const s=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>r(s.matches);return o(),s.addEventListener("change",o),()=>s.removeEventListener("change",o)},[]),qbe(e,{prefersDark:n,terminalIsDark:Xbe(t)})}function qEt(e){const t=U$();return y.useMemo(()=>({...e,themeType:t}),[e,t])}const YEt="http://www.w3.org/2000/svg",$Et="http://www.w3.org/1999/xlink",eAe=/<svg\b(?:[^>"']|"[^"]*"|'[^']*')*>/i,_6=16384,KEt=_6*_6,XEt=2;function V$(e){return new RegExp(`\\s${e}\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s"'>]+)`,"i")}function rR(e,t){const n=e.match(V$(t));return n?n[0].replace(/^[^=]*=\s*/,"").replace(/^["']|["']$/g,""):null}function aC(e,t,n){const r=` ${t}="${n}"`,s=V$(t);return s.test(e)?e.replace(s,r):e.replace(/\s*\/?>$/,o=>`${r}${o}`)}function tAe(e){const t=e.match(eAe)?.[0],n=t?rR(t,"viewBox"):null;if(!n)return null;const r=n.trim().split(/[\s,]+/).map(Number);if(r.length!==4)return null;const[,,s,o]=r;return Number.isFinite(s)&&Number.isFinite(o)&&s>0&&o>0?{width:s,height:o}:null}function G$(e){const t=e.match(eAe);if(!t)return e;let n=t[0];rR(n,"xmlns")||(n=aC(n,"xmlns",YEt)),e.includes("xlink:")&&!rR(n,"xmlns:xlink")&&(n=aC(n,"xmlns:xlink",$Et));const r=tAe(e);if(r){n=aC(n,"width",String(r.width)),n=aC(n,"height",String(r.height));const s=rR(n,"style");if(s!==null){const o=s.split(";").filter(i=>i.trim()&&!/^\s*max-width\s*:/i.test(i)).join(";").trim();n=o?aC(n,"style",o):n.replace(V$("style"),"")}}return e.replace(t[0],()=>n)}function AU(e,t=new Date){const n=o=>String(o).padStart(2,"0"),r=`${t.getFullYear()}${n(t.getMonth()+1)}${n(t.getDate())}`,s=`${n(t.getHours())}${n(t.getMinutes())}${n(t.getSeconds())}`;return`mermaid-${r}-${s}.${e}`}function QEt(e,t){const n=Math.min(XEt,_6/e,_6/t,Math.sqrt(KEt/(e*t)));return n>=1?n:null}function nAe(e){return new Blob([G$(e)],{type:"image/svg+xml"})}function NU(e){return G$(new XMLSerializer().serializeToString(e))}function ZEt(e){const t=new DOMParser().parseFromString(e,"text/html").querySelector("svg");if(!t)throw new Error("No svg in markup");return NU(t)}function gae(e,t){const n=typeof e=="string"?e:URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.click(),typeof e!="string"&&setTimeout(()=>URL.revokeObjectURL(n),0)}async function JEt(e,t,n,r,s){const o=new Image;o.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,await o.decode();const i=document.createElement("canvas");i.width=Math.floor(t*r),i.height=Math.floor(n*r);const l=i.getContext("2d");if(!l)throw new Error("Canvas unavailable");l.fillStyle=s,l.fillRect(0,0,i.width,i.height),l.drawImage(o,0,0,i.width,i.height);const c=i.toDataURL("image/png");if(!c.startsWith("data:image/png"))throw new Error("Canvas export failed");return c}async function eTt(e){const t=o=>{try{const i=e.currentSvg();return i?(e.download(nAe(i),AU("svg")),{kind:"svg",reason:o}):{kind:"failed"}}catch{return{kind:"failed"}}};let n;try{n=G$(await e.rerender())}catch{return t("rerender-failed")}if(/<foreignObject\b/i.test(n))return t("rerender-failed");const r=tAe(n);if(!r)return t("draw-failed");const s=QEt(r.width,r.height);if(s===null)return t("too-large");try{const o=await e.rasterize(n,r.width,r.height,s);return e.download(o,AU("png")),{kind:"png"}}catch{return t("draw-failed")}}const tTt="position:fixed;left:0;top:0;width:800px;height:600px;overflow:hidden;opacity:0;pointer-events:none;visibility:hidden;contain:strict;";function nTt(e){return!e.includes("<svg")||/\bfocusable=/.test(e)?e:e.replace("<svg",'<svg focusable="false" tabindex="-1"')}function rTt(e){return{startOnLoad:!1,theme:e,securityLevel:"strict",fontFamily:"inherit",suppressErrorRendering:!0,flowchart:{htmlLabels:!1,useMaxWidth:!0}}}const sTt=/<(?:a|area)\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,oTt=/\s(?:xlink:)?(?:href|target)\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]+)/gi;function iTt(e){return e.replace(sTt,t=>t.replace(oTt,""))}let s3=null,o3=null,vae=Promise.resolve(),aTt=0;async function lTt(){return o3||(s3||(s3=Be(()=>import("./mermaid.core-ioNz7ync.js").then(e=>e.cb),[],import.meta.url).then(e=>(o3=e.default,o3)).catch(e=>{throw s3=null,e})),s3)}function cTt(e){const t=vae.then(e,e);return vae=t.then(()=>{},()=>{}),t}async function xae(e,t,n={}){return cTt(async()=>{const r=await lTt();r.initialize({...rTt(t),...n});const s=`ensoMermaid${++aTt}`,o=document.createElement("div");o.setAttribute("aria-hidden","true"),o.style.cssText=tTt,document.body.appendChild(o);try{const{svg:i}=await r.render(s,e,o);return nTt(iTt(i))}finally{o.remove(),document.getElementById(s)?.remove(),document.getElementById(`d${s}`)?.remove()}})}const i3=.1,uTt={dark:"#1f2020",default:"#ffffff"},a3=.1;function dTt({code:e,streaming:t=!1,className:n}){const{t:r}=Se(),s=y.useRef(null),[o,i]=y.useState(null),[l,c]=y.useState(null),[u,d]=y.useState(1),[f,h]=y.useState({x:0,y:0}),[p,m]=y.useState(!1),[v,b]=y.useState(!1);MN(v);const x=y.useRef({x:0,y:0}),S=y.useRef({x:0,y:0}),k=y.useRef(null),C=y.useRef(!1),N=U$()==="dark"?"dark":"default";y.useEffect(()=>{if(t){i(null),c(null);return}let T=!1;return(async()=>{if(!e.trim()){i(null),c(null);return}try{const P=await xae(e,N);T||(i(P),c(null),d(1),h({x:0,y:0}))}catch(P){T||(c(P instanceof Error?P.message:"Mermaid render failed"),i(null))}})(),()=>{T=!0}},[e,N,t]);const j=y.useCallback(()=>d(T=>T+i3),[]),I=y.useCallback(()=>d(T=>Math.max(T-i3,a3)),[]),_=y.useCallback(()=>{d(1),h({x:0,y:0})},[]),L=y.useCallback(()=>{b(!1),d(1),h({x:0,y:0})},[]),M=y.useCallback(()=>{b(!0),requestAnimationFrame(()=>{const T=k.current,U=T?.firstElementChild;if(!T||!U?.offsetWidth||!U.offsetHeight)return;const P=24,K=Math.min((T.clientWidth-P*2)/U.offsetWidth,(T.clientHeight-P*2)/U.offsetHeight);d(Math.round(K*100)/100),h({x:0,y:0})})},[]),F=y.useCallback(T=>{if(!v)return;T.preventDefault();const U=T.deltaY>0?-i3:i3;d(P=>Math.round(Math.max(P+U,a3)*100)/100)},[v]),D=y.useCallback(T=>{!v||T.button!==0||(m(!0),C.current=!1,x.current={x:T.clientX,y:T.clientY},S.current={...f})},[v,f]),R=y.useCallback(T=>{if(!p)return;const U=T.clientX-x.current.x,P=T.clientY-x.current.y;(Math.abs(U)>2||Math.abs(P)>2)&&(C.current=!0),h({x:S.current.x+U,y:S.current.y+P})},[p]),z=y.useCallback(()=>m(!1),[]),B=y.useCallback(T=>{T.stopPropagation()},[]),H=y.useCallback(()=>{C.current||L()},[L]),G=y.useCallback(()=>{try{const T=s.current?.querySelector("svg");if(!T)throw new Error("No svg");gae(nAe(NU(T)),AU("svg"))}catch{Ht({type:"error",title:r("Export failed")})}},[r]),te=y.useCallback(async()=>{const T=await eTt({currentSvg:()=>{const U=s.current?.querySelector("svg");return U?NU(U):null},rerender:async()=>ZEt(await xae(e,N,{htmlLabels:!1})),rasterize:(U,P,K,J)=>JEt(U,P,K,J,uTt[N]),download:gae});T.kind==="failed"?Ht({type:"error",title:r("Export failed")}):T.kind==="svg"&&Ht({type:"warning",title:T.reason==="too-large"?r("Diagram is too large for PNG, exported SVG instead"):r("PNG export failed, exported SVG instead")})},[e,N,r]),W=T=>{const U=T==="sm"?"h-6 w-6":"h-7 w-7",P=T==="sm"?"h-3.5 w-3.5":"h-4 w-4",K=T==="sm"?"h-6 min-w-[2.5rem]":"h-7 min-w-[3rem]";return a.jsxs("div",{className:"flex items-center gap-1 rounded-md border border-border bg-background/95 p-1 shadow-sm",children:[a.jsx("button",{type:"button",onClick:j,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Zoom in"),children:a.jsx(xs,{className:P})}),a.jsxs("button",{type:"button",onClick:_,className:xe("flex items-center justify-center rounded text-xs transition-colors hover:bg-accent hover:text-accent-foreground",K),title:r("Reset zoom"),children:[Math.round(u*100),"%"]}),a.jsx("button",{type:"button",onClick:I,disabled:u<=a3,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U,u<=a3&&"cursor-not-allowed opacity-50"),title:r("Zoom out"),children:a.jsx(kxe,{className:P})}),u!==1&&a.jsx("button",{type:"button",onClick:_,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Fit to original size"),children:a.jsx($u,{className:P})}),a.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),a.jsx("button",{type:"button",onClick:G,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Export SVG"),children:a.jsx(Lf,{className:P})}),a.jsx("button",{type:"button",onClick:()=>{te()},className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Export PNG"),children:a.jsx(yHe,{className:P})}),v?a.jsx("button",{type:"button",onClick:L,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("Exit fullscreen"),children:a.jsx(aUe,{className:P})}):a.jsx("button",{type:"button",onClick:M,className:xe("flex items-center justify-center rounded text-sm transition-colors hover:bg-accent hover:text-accent-foreground",U),title:r("View fullscreen"),children:a.jsx(wxe,{className:P})})]})};return l?a.jsxs("div",{className:xe("overflow-x-auto rounded-lg border border-destructive/50",n),children:[a.jsx("div",{className:"flex items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:a.jsx("span",{children:r("Mermaid render error")})}),a.jsx("pre",{className:"p-4 text-sm",children:a.jsx("code",{className:"block font-mono leading-relaxed text-muted-foreground",children:e})}),a.jsx("div",{className:"border-t border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:l})]}):o?a.jsxs("div",{className:xe("relative rounded-lg border border-border bg-muted/30",n),style:{userSelect:"none",WebkitUserSelect:"none"},children:[a.jsx("div",{ref:s,className:xe("max-h-[min(50vh,20rem)] overflow-hidden [overflow-anchor:none]",v&&(p?"cursor-grabbing":"cursor-grab")),onWheel:F,onMouseDown:D,onMouseMove:R,onMouseUp:z,onMouseLeave:z,onDoubleClick:v?void 0:M,children:a.jsx("div",{className:"origin-center transition-transform duration-100 ease-out",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${u})`},children:a.jsx("div",{className:"p-4",dangerouslySetInnerHTML:{__html:o}})})}),a.jsx("div",{className:"absolute right-2 bottom-2",children:W("sm")}),v&&a.jsxs("div",{className:"fixed inset-0 flex select-none flex-col bg-background",style:{zIndex:_r.TOAST},"data-enso-float":"",onClick:H,onKeyDown:T=>{T.key==="Escape"&&L()},children:[a.jsxs("div",{className:"relative z-10 flex shrink-0 items-center justify-between border-b border-border bg-muted/30 px-4 py-2",onClick:T=>T.stopPropagation(),onKeyDown:T=>T.stopPropagation(),children:[a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:r("Mermaid preview")}),a.jsx("button",{type:"button",onClick:L,className:"flex h-7 w-7 items-center justify-center rounded-md border border-border bg-background/95 text-sm transition-colors hover:bg-accent hover:text-accent-foreground",title:r("Exit fullscreen"),children:a.jsx(Jr,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[a.jsx("div",{ref:k,className:xe("flex min-h-0 flex-1 select-none overflow-hidden",p?"cursor-grabbing":"cursor-grab"),onWheel:F,onMouseDown:D,onMouseMove:R,onMouseUp:z,onMouseLeave:z,onClick:B,onKeyDown:B,children:a.jsx("div",{className:"m-auto origin-center transition-transform duration-100 ease-out",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${u})`},children:a.jsx("div",{className:"p-4",dangerouslySetInnerHTML:{__html:o}})})}),a.jsx("div",{className:"absolute right-4 bottom-4",children:W("md")})]})]})]}):a.jsx("div",{className:xe("flex items-center justify-center rounded-lg border border-border bg-muted/30 p-8",n),children:a.jsx("div",{className:"text-sm text-muted-foreground",children:r("Loading Mermaid diagram...")})})}const fTt=/^[a-z][a-z\d+.-]*:/i,hTt=/^(?:https?|ircs?|mailto|xmpp):/i,pTt=/^(?:[a-z]:[\\/]|\\\\)/i;function mTt(e){const t=e?.trim();if(!t||!/^https?:\/\//i.test(t))return null;try{return new URL(t)}catch{return null}}function rAe(e){const t=/^(.*?):(\d+)(?:-\d+)?$/.exec(e);if(!t)return{path:e};const n=Number(t[2]);return n>0?{path:t[1],line:n}:{path:t[1]}}function gTt(e){try{return decodeURIComponent(e)}catch{return null}}function vTt(e){const t=e.search(/[?#]/);return t<0?e:e.slice(0,t)}function xTt(e){try{const t=new URL(e);if(t.protocol!=="file:")return null;let n=decodeURIComponent(t.pathname);return n?(t.hostname&&t.hostname.toLowerCase()!=="localhost"?n=`//${t.hostname}${n}`:/^\/[a-z]:[\\/]/i.test(n)&&(n=n.slice(1)),n):null}catch{return null}}function bae(e){const t=e.trim();if(!t||t.startsWith("#")||t.startsWith("?"))return{kind:"external"};if(/^file:/i.test(t)){const r=xTt(t);return r?{kind:"local",path:r}:{kind:"blocked"}}if(hTt.test(t)||t.startsWith("//"))return{kind:"external"};const n=gTt(vTt(t));return n==null||n.includes("\0")?{kind:"blocked"}:fTt.test(n)&&!pTt.test(n)?{kind:"blocked"}:{kind:"local",path:n}}function Kw(e){const t=e.replace(/\\/g,"/"),n=/^[a-z]:\//i.test(t)||t.startsWith("//");if(!n&&!t.startsWith("/"))return null;const r=/^[a-z]:\//i.test(t)?t.slice(0,2).toLowerCase():null,o=(r||n?t.slice(2):t.slice(1)).split("/"),i=[];for(const l of o)if(!(!l||l==="."))if(l===".."){if(i.length===0)return null;i.pop()}else i.push(l);return r?{value:`${r}/${i.join("/")}`.replace(/\/$/,""),windows:!0}:n?{value:`//${i.join("/")}`,windows:!0}:{value:`/${i.join("/")}`.replace(/\/$/,"")||"/",windows:!1}}function YD(e){const t=e.replace(/\\/g,"/"),n=[];for(const r of t.split("/"))if(!(!r||r==="."))if(r===".."){if(n.length===0)return null;n.pop()}else{if(r.includes("\0"))return null;n.push(r)}return n.join("/")}function Zln(e){return Kw(e)!==null}function r1(e,t){if(!t)return Kw(e)?null:YD(e);const n=Kw(t);if(!n)return null;const r=n.windows&&/^\/[a-z]:[\\/]/i.test(e)?e.slice(1):e,s=Kw(r);if(!s)return r===e?YD(e):null;if(s.windows!==n.windows)return null;const o=n.value.toLowerCase(),i=s.value.toLowerCase();if(i===o)return"";const l=n.value.endsWith("/")?n.value:`${n.value}/`;return i.startsWith(l.toLowerCase())?YD(s.value.slice(l.length)):null}function bTt(e,t){const n=t?Kw(t):null;if(!n||r1(e,t)!==null)return null;const r=n.windows&&/^\/[a-z]:[\\/]/i.test(e)?e.slice(1):e;return Kw(r)?r:null}const yTt=/^(?:%|ms|s|sec|min|h|ms\/op|ns|µs|us|b|kb|mb|gb|tb|kib|mib|gib|x|×|k|m|bn)$/i;function IU(e){let t=e.trim().replace(/^[$€£¥₹]\s*/,""),n=!1;/^\(.*\)$/.test(t)&&(n=!0,t=t.slice(1,-1));const r=/^([+-]?(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?)\s*(\S*)$/.exec(t);if(!r||r[2]&&!yTt.test(r[2]))return null;const s=Number(r[1].replace(/,/g,""));return n?-s:s}function wTt(e){const t=Math.max(0,...e.map(n=>n.length));return Array.from({length:t},(n,r)=>{const s=e.map(o=>o[r]?.trim()??"").filter(Boolean);return s.length>0&&s.every(o=>IU(o)!==null)})}function kTt(e,t,n){return n?(IU(e)??0)-(IU(t)??0):e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function STt(e,t,n){const r=e.map((i,l)=>l);if(!t)return r;const s=t.dir==="asc"?1:-1,o=i=>e[i][t.column]?.trim()??"";return r.sort((i,l)=>{const c=o(i),u=o(l);return!c||!u?c?-1:u?1:0:s*kTt(c,u,n[t.column]??!1)||i-l})}function CTt(e,t){return e?.column!==t?{column:t,dir:"asc"}:e.dir==="asc"?{column:t,dir:"desc"}:null}const ETt=new Set(["json","jsonc","json5"]),TTt=new Set(["console","shell-session","terminal","output","ansi"]),ATt=new Set(["sh","bash","shell","zsh","shellscript"]),P6="$ ";function NTt(e,t){const n=e?.toLowerCase();if(n&&ETt.has(n))return yae(t)?"json":null;if(!n&&/^\s*[{[]/.test(t)&&yae(t))return"json";if(n&&TTt.has(n)||t.includes("\x1B["))return"terminal";if(!n||ATt.has(n)){const r=t.split(`
|
|
327
327
|
`).filter(s=>s.trim());if(r[0]?.startsWith(P6)&&r.some(s=>!s.startsWith(P6)))return"terminal"}return null}function yae(e){const t=sAe(e);return t.ok&&typeof t.value=="object"&&t.value!==null}function sAe(e){let t="",n=0;for(;n<e.length;){const r=e[n];if(r==='"'){let s=n+1;for(;s<e.length&&e[s]!=='"';)s+=e[s]==="\\"?2:1;t+=e.slice(n,s+1),n=s+1}else if(r==="/"&&e[n+1]==="/")for(;n<e.length&&e[n]!==`
|
|
328
328
|
`;)n++;else if(r==="/"&&e[n+1]==="*"){const s=e.indexOf("*/",n+2);n=s<0?e.length:s+2}else r===","&&/^\s*[}\]]/.test(e.slice(n+1))||(t+=r),n++}try{return{ok:!0,value:JSON.parse(t)}}catch{return{ok:!1}}}const Nw=["black","red","green","yellow","blue","magenta","cyan","white"],$D=[0,95,135,175,215,255],lC="\x1B",wae="\x07",oAe=new RegExp(`${lC}\\[([0-9;?]*)([A-Za-z])|${lC}\\][^${wae}${lC}]*(?:${wae}|${lC}\\\\)?|${lC}[@-Z\\\\-_]`,"g");function kae(...e){return`#${e.map(t=>t.toString(16).padStart(2,"0")).join("")}`}function ITt(e){if(e<0||e>255)return;if(e<8)return Nw[e];if(e<16)return`bright-${Nw[e-8]}`;if(e<232){const n=e-16;return kae($D[Math.floor(n/36)],$D[Math.floor(n/6)%6],$D[n%6])}const t=8+(e-232)*10;return kae(t,t,t)}function jTt(e,t){if(e[t+1]===5)return[ITt(e[t+2]??-1),3];if(e[t+1]===2){const[n,r,s]=e.slice(t+2,t+5);return[n===void 0||r===void 0||s===void 0?void 0:`rgb(${n},${r},${s})`,5]}return[void 0,1]}function RTt(e,t){const n=t?t.split(";").map(s=>Number(s||0)):[0];let r={...e};for(let s=0;s<n.length;s++){const o=n[s];if(o===0)r={};else if(o===1)r.bold=!0;else if(o===2)r.dim=!0;else if(o===3)r.italic=!0;else if(o===4)r.underline=!0;else if(o===22)delete r.bold,delete r.dim;else if(o===23)delete r.italic;else if(o===24)delete r.underline;else if(o>=30&&o<=37)r.fg=Nw[o-30];else if(o>=90&&o<=97)r.fg=`bright-${Nw[o-90]}`;else if(o>=40&&o<=47)r.bg=Nw[o-40];else if(o>=100&&o<=107)r.bg=`bright-${Nw[o-100]}`;else if(o===39)delete r.fg;else if(o===49)delete r.bg;else if(o===38||o===48){const[i,l]=jTt(n,s);i&&(r[o===38?"fg":"bg"]=i),s+=l-1}}return r}const MTt=(e,t)=>e.fg===t.fg&&e.bg===t.bg&&e.bold===t.bold&&e.dim===t.dim&&e.italic===t.italic&&e.underline===t.underline;function _Tt(e){const t=[];let n={};const r=o=>{if(!o)return;const i=t.at(-1);i&&MTt(i,n)?i.text+=o:t.push({text:o,...n})};let s=0;for(const o of e.matchAll(oAe))r(e.slice(s,o.index)),s=o.index+o[0].length,o[2]==="m"&&!o[1]?.includes("?")&&(n=RTt(n,o[1]??""));return r(e.slice(s)),t}function Sae(e){return e.replace(oAe,"")}function PTt(e){const t=[];for(const n of e.split(`
|
|
329
329
|
`)){if(n.startsWith(P6)){t.push({kind:"command",text:n.slice(P6.length)});continue}const r=t.at(-1);r?.kind==="output"?r.text+=`
|
|
@@ -377,12 +377,12 @@ ${e.value}
|
|
|
377
377
|
`).filter(n=>n.trim()&&!/^\s*(```|~~~)/.test(n)).map(n=>n.replace(/^\s*#{1,6}\s+/,"").trimEnd());return{preview:t.slice(0,Ile).join(`
|
|
378
378
|
`),folded:t.length>Ile||e.length>320}}function e5e({label:e,text:t}){const{t:n}=Se(),{preview:r,folded:s}=LRt(t),[o,i]=y.useState(!1),l=o||!s;return a.jsxs("section",{"data-enso":"tool-card-prompt","data-open":l?"true":"false",className:"min-w-0",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-3 pt-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{className:"min-w-0 truncate",children:e}),a.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-2.5",children:[s&&a.jsx("button",{type:"button","data-enso":"tool-card-prompt-toggle","aria-expanded":o,onClick:()=>i(c=>!c),className:"hover:text-foreground",children:n(o?"Show less":"Show full text")}),a.jsx(px,{text:t,label:n("Copy")})]})]}),l?a.jsx("div",{"data-enso":"tool-card-prompt-body",style:PRt,className:"max-h-80 min-w-0 overflow-y-auto overscroll-contain px-3 pt-1 pb-2 text-xs leading-relaxed [&_:is(h1,h2,h3,h4)]:mt-2.5 [&_:is(h1,h2,h3,h4)]:mb-1 [&_[data-enso=code-block]>:first-child]:border-0",children:a.jsx(ua,{text:t})}):a.jsx("button",{type:"button","data-enso":"tool-card-prompt-preview",onClick:()=>i(!0),className:"line-clamp-4 block w-full min-w-0 px-3 pt-1 pb-2 text-left text-xs leading-relaxed text-muted-foreground break-words whitespace-pre-wrap",children:r})]})}function ORt({row:e}){const{t}=Se(),[n,r]=y.useState(!1),s=e.display==="long"&&(e.value.length>120||e.value.includes(`
|
|
379
379
|
`));return a.jsxs("div",{className:"contents",children:[a.jsx("dt",{className:"whitespace-nowrap text-muted-foreground",children:e.label}),a.jsxs("dd",{"data-enso":"tool-card-kv-value","data-display":e.display,title:e.display==="path"?e.value:void 0,className:xe("min-w-0",e.display==="path"?"truncate":"whitespace-pre-wrap break-words"),children:[s&&!n?a.jsx("span",{className:"line-clamp-2",children:e.value}):e.value,s&&a.jsx("button",{type:"button","data-enso":"tool-card-kv-toggle","aria-expanded":n,onClick:()=>r(o=>!o),className:"block text-[11px] text-muted-foreground hover:text-foreground",children:t(n?"Show less":"Show more")})]})]})}function DRt({block:e,known:t,onOpen:n}){const{t:r}=Se(),[s,o]=y.useState(!1);if(e.kind==="error")return a.jsx("p",{className:"rounded-md bg-destructive/10 px-2 py-1 text-destructive text-xs whitespace-pre-wrap",children:e.text});if(e.kind==="note")return a.jsx("p",{className:"whitespace-pre-wrap text-xs",children:e.text});if(e.kind==="prompt")return a.jsx(e5e,{label:e.label,text:e.text});if(e.kind==="markdown"){const i=e.collapsed&&!s;return a.jsxs("div",{className:"text-sm",children:[i?a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.text.split(`
|
|
380
|
-
`).find(l=>l.trim())}):a.jsx(ua,{text:e.text}),e.collapsed&&a.jsx("button",{type:"button","data-enso":"tool-card-fold",onClick:()=>o(l=>!l),className:"text-[11px] text-muted-foreground hover:text-foreground",children:r(s?"Show less":"Show more")})]})}return e.kind==="image"?a.jsx("div",{"data-enso":"tool-card-image",children:a.jsx(QNe,{image:e.image,path:e.path,alt:e.alt})}):e.kind==="session"?t[e.id]?a.jsx("button",{type:"button","data-enso":"tool-card-session","data-conversation-id":e.id,onClick:()=>n(e.id),className:"truncate text-left text-xs text-foreground underline-offset-2 hover:underline",children:e.label}):a.jsx("p",{className:"text-xs",children:e.label}):e.kind==="kv"?a.jsx("dl",{className:"grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 text-xs",children:e.rows.map(i=>a.jsx(ORt,{row:i},i.label))}):e.kind==="diff"?a.jsx("div",{className:"space-y-0.5 text-xs",children:e.rows.map(i=>a.jsxs("p",{className:"min-w-0 break-words",children:[a.jsxs("span",{className:"text-muted-foreground",children:[i.label," "]}),a.jsx("span",{className:"text-muted-foreground line-through",children:i.before}),a.jsxs("span",{children:[" → ",i.after]})]},i.label))}):e.kind!=="list"?null:a.jsx("ul",{className:"space-y-0.5",children:e.items.map((i,l)=>a.jsxs("li",{className:"flex min-w-0 items-baseline gap-1.5 text-xs",children:[i.sessionId&&t[i.sessionId]?a.jsx("button",{type:"button","data-enso":"tool-card-session","data-conversation-id":i.sessionId,onClick:()=>n(i.sessionId),className:"min-w-0 truncate text-left hover:underline",children:i.title}):a.jsx("span",{className:"min-w-0 truncate",children:i.title}),i.badge&&a.jsx("span",{"data-enso":"tool-card-badge","data-tone":i.badgeTone,className:xe("shrink-0 rounded px-1 py-px text-[10px]",i.badgeTone==="error"&&"bg-destructive/15 text-destructive",i.badgeTone==="ok"&&"bg-success/15 text-success",i.badgeTone==="pending"&&"bg-warning/15 text-warning",(!i.badgeTone||i.badgeTone==="neutral"||i.badgeTone==="queued")&&"bg-muted text-muted-foreground"),children:i.badge}),i.detail&&a.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:i.detail})]},`${i.title}-${l}`))})}const BRt={report:()=>{},scroller:{current:null}},t5e=y.createContext(BRt),FRt=t5e.Provider;function zRt(){return y.useContext(t5e)}const jle=y.lazy(()=>Be(()=>import("./EditDiff-
|
|
380
|
+
`).find(l=>l.trim())}):a.jsx(ua,{text:e.text}),e.collapsed&&a.jsx("button",{type:"button","data-enso":"tool-card-fold",onClick:()=>o(l=>!l),className:"text-[11px] text-muted-foreground hover:text-foreground",children:r(s?"Show less":"Show more")})]})}return e.kind==="image"?a.jsx("div",{"data-enso":"tool-card-image",children:a.jsx(QNe,{image:e.image,path:e.path,alt:e.alt})}):e.kind==="session"?t[e.id]?a.jsx("button",{type:"button","data-enso":"tool-card-session","data-conversation-id":e.id,onClick:()=>n(e.id),className:"truncate text-left text-xs text-foreground underline-offset-2 hover:underline",children:e.label}):a.jsx("p",{className:"text-xs",children:e.label}):e.kind==="kv"?a.jsx("dl",{className:"grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 text-xs",children:e.rows.map(i=>a.jsx(ORt,{row:i},i.label))}):e.kind==="diff"?a.jsx("div",{className:"space-y-0.5 text-xs",children:e.rows.map(i=>a.jsxs("p",{className:"min-w-0 break-words",children:[a.jsxs("span",{className:"text-muted-foreground",children:[i.label," "]}),a.jsx("span",{className:"text-muted-foreground line-through",children:i.before}),a.jsxs("span",{children:[" → ",i.after]})]},i.label))}):e.kind!=="list"?null:a.jsx("ul",{className:"space-y-0.5",children:e.items.map((i,l)=>a.jsxs("li",{className:"flex min-w-0 items-baseline gap-1.5 text-xs",children:[i.sessionId&&t[i.sessionId]?a.jsx("button",{type:"button","data-enso":"tool-card-session","data-conversation-id":i.sessionId,onClick:()=>n(i.sessionId),className:"min-w-0 truncate text-left hover:underline",children:i.title}):a.jsx("span",{className:"min-w-0 truncate",children:i.title}),i.badge&&a.jsx("span",{"data-enso":"tool-card-badge","data-tone":i.badgeTone,className:xe("shrink-0 rounded px-1 py-px text-[10px]",i.badgeTone==="error"&&"bg-destructive/15 text-destructive",i.badgeTone==="ok"&&"bg-success/15 text-success",i.badgeTone==="pending"&&"bg-warning/15 text-warning",(!i.badgeTone||i.badgeTone==="neutral"||i.badgeTone==="queued")&&"bg-muted text-muted-foreground"),children:i.badge}),i.detail&&a.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:i.detail})]},`${i.title}-${l}`))})}const BRt={report:()=>{},scroller:{current:null}},t5e=y.createContext(BRt),FRt=t5e.Provider;function zRt(){return y.useContext(t5e)}const jle=y.lazy(()=>Be(()=>import("./EditDiff-C5tSOQb2.js"),__vite__mapDeps([125,126]),import.meta.url).then(e=>({default:e.EditDiff}))),f9=y.lazy(()=>Be(()=>import("./ReadFileView-VbAe6o1G.js"),[],import.meta.url).then(e=>({default:e.ReadFileView}))),HRt=(e,t)=>e===t||!!e&&!!t&&e.runMs===t.runMs&&e.turnMs===t.turnMs&&e.ttftMs===t.ttftMs&&e.tps===t.tps;function URt(e,t){const n=e??[],r=t??[];return n.length===r.length&&n.every((s,o)=>{const i=r[o];return i!==void 0&&s.key===i.key&&s.state===i.state&&s.output===i.output&&s.image?.data===i.image?.data&&JSON.stringify(s.args??null)===JSON.stringify(i.args??null)})}function VRt(e,t){if(e.secretarySession!==t.secretarySession)return!1;const n=e.item,r=t.item;if(n===r)return!0;if(n.kind!==r.kind||n.key!==r.key)return!1;switch(n.kind){case"user":return r.kind!=="user"||n.text!==r.text||n.images.length!==r.images.length||n.timestamp!==r.timestamp||n.deliveryState!==r.deliveryState||n.turnDurationMs!==r.turnDurationMs||n.collapsed!==r.collapsed||n.canCollapse!==r.canCollapse||n.hostTaskWrapUp!==r.hostTaskWrapUp?!1:n.images.every((s,o)=>s===r.images[o]);case"text":case"thinking":return r.kind===n.kind&&n.text===r.text&&n.streaming===r.streaming&&(n.kind!=="text"||r.kind==="text"&&HRt(n.perf,r.perf)&&n.timestamp===r.timestamp&&n.turnDurationMs===r.turnDurationMs)&&(n.kind!=="thinking"||r.kind==="thinking"&&n.durationMs===r.durationMs);case"tool":return r.kind==="tool"&&n.state===r.state&&n.name===r.name&&n.summary===r.summary&&n.output===r.output&&n.edits===r.edits&&n.writeContent===r.writeContent&&n.fileChanges===r.fileChanges&&n.imagePath===r.imagePath&&n.image?.data===r.image?.data&&n.image?.mimeType===r.image?.mimeType&&n.generatedImages===r.generatedImages&&n.todos===r.todos&&n.durationMs===r.durationMs&&n.startedAt===r.startedAt&&n.agentMeta===r.agentMeta&&n.source===r.source&&n.nestedPending===r.nestedPending&&JSON.stringify(n.sandbox)===JSON.stringify(r.sandbox)&&n.rtk===r.rtk&&n.approvalReview===r.approvalReview&&n.plan?.title===r.plan?.title&&n.plan?.text===r.plan?.text&&n.sentMessage===r.sentMessage&&n.memoryContent===r.memoryContent&&n.ask?.question===r.ask?.question&&n.ask?.options.join(`
|
|
381
381
|
`)===r.ask?.options.join(`
|
|
382
382
|
`)&&n.ask?.answer===r.ask?.answer&&n.ask?.autoSelected===r.ask?.autoSelected&&n.subagentOp===r.subagentOp&&JSON.stringify(n.subagentTitles)===JSON.stringify(r.subagentTitles)&&n.waiting===r.waiting&&n.pluginArtifacts===r.pluginArtifacts&&n.shellFailure===r.shellFailure&&n.dcgWarning===r.dcgWarning&&JSON.stringify(n.args??null)===JSON.stringify(r.args??null)&&URt(n.cardPeers,r.cardPeers);case"tool-group":return r.kind==="tool-group"&&n.expanded===r.expanded&&n.count===r.count&&n.stats.commands===r.stats.commands&&n.stats.reads===r.stats.reads&&n.stats.searches===r.stats.searches&&n.stats.others===r.stats.others&&n.exploring===r.exploring&&n.live===r.live&&n.activity?.thinking===r.activity?.thinking&&n.activity?.workedMs===r.activity?.workedMs&&n.explore?.goal===r.explore?.goal&&n.explore?.report===r.explore?.report&&n.explore?.steps===r.explore?.steps&&n.notice===r.notice;case"error":return r.kind==="error"&&n.text===r.text;case"interrupted":return r.kind==="interrupted"&&n.at===r.at&&n.exitKind===r.exitKind&&n.unfinishedTools.length===r.unfinishedTools.length;case"task-note":return r.kind==="task-note"&&n.detail===r.detail;case"compaction":case"compaction-notice":return(r.kind==="compaction"||r.kind==="compaction-notice")&&n.kind===r.kind&&n.summary===r.summary&&n.tokensBefore===r.tokensBefore&&n.tokensAfter===r.tokensAfter&&n.verified===r.verified;case"compaction-progress":return r.kind==="compaction-progress"&&n.state===r.state;case"session-custom":return r.kind==="session-custom"&&n.entry===r.entry;case"divider":return r.kind==="divider"&&n.text===r.text;case"plugin-message":return r.kind==="plugin-message"&&n.text===r.text&&n.pluginId===r.pluginId;case"resumed-reply":return r.kind==="resumed-reply"&&n.expanded===r.expanded&&n.text===r.text&&n.thinking===r.thinking&&n.tools.length===r.tools.length;case"discarded-turn":return r.kind==="discarded-turn"&&n.expanded===r.expanded&&n.reason===r.reason&&n.messages.length===r.messages.length&&n.messages.every((s,o)=>s===r.messages[o])&&n.tools.length===r.tools.length}}const n5e=/^<role>\n?([\s\S]*?)\n?<\/role>\s*/,GRt=/^<workspace-migrated>\n?([\s\S]*?)\n?<\/workspace-migrated>\s*/,WRt=/^<workspace-branch-changed>\n?([\s\S]*?)\n?<\/workspace-branch-changed>\s*/;function qRt({note:e}){const{t}=Se(),n=/on Git branch ("(?:[^"\\]|\\.)*")/.exec(e)?.[1];let r="";try{r=n?String(JSON.parse(n)):""}catch{}return a.jsxs("aside",{title:e,className:"flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground",children:[a.jsx(wf,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0 break-all",children:r?t("Workspace switched to branch {{branch}}",{branch:r}):t("Workspace switched branch")})]})}function r5e({items:e}){const t=Ud(),n=it(s=>t?void 0:Wa(s)?.id),r=it(s=>t?void 0:Wa(s)?.backgroundTasks);return a.jsx(CRt,{items:e,live:r,onOpen:n?s=>it.setState({pendingAgentOpen:{sessionId:n,agentId:s}}):void 0})}function YRt({note:e}){const{t}=Se(),n=/(?:moved to|main working tree): (.+)$/m.exec(e)?.[1]?.trim(),r=e.includes("main working tree");return a.jsxs("aside",{title:e,className:"flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground",children:[a.jsx(wf,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),a.jsxs("span",{className:"min-w-0",children:[t(r?"Workspace fell back to the main working tree":"Workspace moved to an isolated worktree"),n&&a.jsx("span",{className:"ml-1.5 break-all font-mono text-[11px] opacity-80",children:n})]})]})}function s5e({note:e}){const{t}=Se();return a.jsxs("aside",{className:"flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground",children:[a.jsx(rx,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0",children:t(e==="on"?"Plan mode on: read-only research, then a plan for your approval":e==="off"?"Plan mode off":"Context compacted: the approved plan was attached again")})]})}function o5e({note:e}){const{t}=Se(),n=e==="on";return a.jsxs("aside",{className:"flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground",children:[n?a.jsx(rM,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}):a.jsx(zW,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0",children:t(n?"Unattended mode on: no one is watching, so it decides and keeps going":"Unattended mode off: a person is available again")})]})}function $Rt({tag:e,body:t}){const n=e==="agent-notification"?Sjt(t):null;return n?a.jsx(QRt,{notices:n}):a.jsx(ZRt,{tag:e,body:t})}function KRt({goal:e,instructions:t}){const{t:n}=Se(),[r,s]=y.useState(!1),o=xIt(e);return a.jsxs("div",{"data-enso":"goal-continuation","data-open":r?"true":"false",className:xe("my-1 w-full min-w-0",zNe),children:[a.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>s(i=>!i),className:"flex w-full min-w-0 items-center gap-2 text-left text-muted-foreground hover:text-foreground",children:[a.jsx(HNe,{}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:n("Continue goal: {{summary}}",{summary:o||e})})]}),r&&a.jsxs("div",{className:"mt-1.5 space-y-1.5 border-t border-border/60 pt-1.5",children:[a.jsx("p",{className:"whitespace-pre-wrap text-foreground",children:e}),t&&a.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] leading-relaxed text-muted-foreground",children:t})]})]})}function Rle({enso:e,icon:t,title:n,body:r}){const[s,o]=y.useState(!1);return a.jsxs("div",{"data-enso":e,"data-open":s?"true":"false",className:_K,children:[a.jsxs("button",{type:"button","aria-expanded":s,onClick:()=>o(i=>!i),className:"flex w-full items-start gap-2 text-left enabled:hover:text-foreground",children:[a.jsx(t,{className:$P}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:n})]}),s&&r&&a.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-foreground",children:r})]})}function XRt({segments:e,searchQuery:t,activeNth:n}){const{t:r}=Se();return a.jsx(a.Fragment,{children:e.map((s,o)=>{const i=`${s.kind}-${o}`;if(s.kind==="text"){const l=s.text.trim();return l?a.jsx(bp,{text:l,searchQuery:t,activeNth:n},i):null}if(s.kind==="goal")return a.jsx(KRt,{goal:s.goal,instructions:s.instructions},i);if(s.kind==="schedule"){const l=SIt(s.raw),c=l.length>0?l:[{summary:"",body:""}];return a.jsx(y.Fragment,{children:c.map((u,d)=>a.jsx(Rle,{enso:"secretary-schedule-card",icon:mT,title:u.summary?r("Scheduled: {{summary}}",{summary:u.summary}):r("Scheduled"),body:u.body},d))},i)}if(s.kind==="updates"){const l=ANe(s.raw);if(l)return a.jsx(i5e,{lines:l},i);const c=CIt(s.raw);return a.jsx(Rle,{enso:"session-updates-card",icon:vg,title:c.summary?r("Session updates: {{summary}}",{summary:c.summary}):r("Session updates"),body:c.body},i)}return a.jsx($Rt,{tag:s.tag,body:s.body},i)})})}function QRt({notices:e}){const{t}=Se(),[n,r]=y.useState(!1);return a.jsxs("div",{className:MK,children:[a.jsxs("button",{type:"button",onClick:()=>r(s=>!s),className:"flex w-full items-start gap-2 px-3 py-2 text-left hover:text-foreground",children:[a.jsx(Jl,{className:$P}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.map(s=>s.header).join(" · ")})]}),n&&e.map((s,o)=>a.jsxs("div",{className:"border-border/60 border-t",children:[e.length>1&&a.jsx("p",{className:"truncate px-3 pt-2",children:s.header}),s.report&&a.jsx("div",{className:"max-h-80 overflow-auto px-3 py-2 text-sm text-foreground",children:a.jsx(ua,{text:s.report})}),s.usage&&a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 border-border/60 border-t px-3 py-1 text-[10px]",children:[a.jsx("span",{className:"font-semibold tracking-wide text-foreground/75",children:"Subagent"}),a.jsx("span",{"aria-hidden":"true",children:"·"}),a.jsx("span",{children:t("{{count}} tokens",{count:Va(s.usage.tokens)})}),a.jsx("span",{"aria-hidden":"true",children:"·"}),a.jsx("span",{children:t("{{count}} tool calls",{count:s.usage.toolUses})}),a.jsx("span",{"aria-hidden":"true",children:"·"}),a.jsx("span",{children:pl(s.usage.durationMs)})]}),s.tasks&&a.jsxs("div",{className:"border-border/60 border-t px-3 py-1 text-[11px]",children:[a.jsx("p",{className:"text-foreground/75",children:t("Background tasks started by this subagent")}),s.tasks.map(i=>a.jsx("p",{className:"truncate font-mono text-muted-foreground",children:i},i))]})]},o))]})}function ZRt({tag:e,body:t}){const[n,r]=y.useState(!1),s=NK(t);if(!s)return null;const o=s.indexOf(`
|
|
383
383
|
`),i=o>0,l=e.startsWith("coworker-")||e==="agent-notification"?Jl:Mg;return a.jsxs("div",{className:_K,children:[a.jsxs("button",{type:"button",disabled:!i,onClick:()=>r(c=>!c),className:"flex w-full items-start gap-2 text-left enabled:hover:text-foreground",children:[a.jsx(l,{className:$P}),a.jsx("span",{className:xe("min-w-0 flex-1",i?"truncate":"whitespace-pre-wrap"),children:i?s.slice(0,o):s})]}),i&&n&&a.jsx("pre",{className:"mt-1.5 max-h-80 overflow-auto font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words",children:s.slice(o+1)})]})}const JRt={"goal-complete":Is,"goal-blocked":qa,"needs-user":zW,"turn-ended":vg,failed:SW,stalled:mE,interrupted:Kp,proposal:EW,schedule:mT,pending:mE,"ask-relay":bT,leftover:mE,queued:mT};function i5e({lines:e}){return a.jsx("div",{"data-enso":"secretary-updates",className:xe(MK,"divide-y divide-border/60"),children:e.map((t,n)=>a.jsx(eMt,{line:t,onOpen:cA},n))})}function eMt({line:e,onOpen:t}){const{t:n}=Se(),[r,s]=y.useState(!1),o=JRt[e.kind],i="conversationId"in e?e.conversationId:void 0,l=a.jsxs(a.Fragment,{children:[a.jsx(o,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1",children:e.text})]});return a.jsxs("div",{"data-enso":"secretary-update","data-open":r?"true":"false",className:"px-3 py-2",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[e.detail?a.jsx("button",{type:"button","data-enso":"secretary-update-expand","aria-expanded":r,onClick:()=>s(c=>!c),className:"flex min-w-0 flex-1 items-start gap-2 text-left hover:text-foreground",children:l}):a.jsx("div",{className:"flex min-w-0 flex-1 items-start gap-2",children:l}),i&&t?a.jsx("button",{type:"button","data-enso":"secretary-update-open",title:n("Open session"),"aria-label":n("Open session"),onClick:c=>{c.stopPropagation(),t(i)},className:"-mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-[5px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:a.jsx(r2,{className:"h-3.5 w-3.5"})}):null]}),e.detail&&r&&a.jsx("pre",{className:"mt-1.5 ml-5.5 max-h-60 overflow-auto font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words",children:e.detail})]})}const a5e=/^<message-from-main-agent>\n?([\s\S]*?)\n?<\/message-from-main-agent>\s*$/;function tMt(e){const t=n5e.exec(e);return a5e.test(t?e.slice(t[0].length):e)}function nMt({name:e,content:t}){const{t:n}=Se();return a.jsxs(gr,{children:[a.jsxs(yut,{className:$Ne("skill",!0),children:[a.jsx(du,{className:"h-3 w-3"}),e]}),a.jsxs(vr,{className:"max-w-lg",children:[a.jsx(xr,{children:a.jsxs(dr,{className:"text-base",children:[n("Skill")," · ",e]})}),a.jsx(rr,{className:"max-h-[50vh] text-sm",children:a.jsx(ua,{text:t})})]})]})}function eV({chip:e,extra:t}){return a.jsxs("div",{className:"max-w-[80%] rounded-2xl rounded-br-md bg-muted px-4 py-2.5 text-sm",children:[a.jsx("div",{className:"flex flex-wrap items-center gap-1",children:e}),t?a.jsx("div",{className:"mt-1.5 whitespace-pre-wrap break-words leading-relaxed",children:a.jsx(YC,{text:t})}):null]})}function rMt({blocks:e,hostTaskWrapUp:t}){const n=h_(e.rest),r=t?Uz(e.rest):void 0,s=a.jsx(eV,{chip:a.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:e.skills.map(o=>a.jsx(nMt,{name:o.name,content:o.body},o.location))}),extra:n.rest.trim()});return!n.plan&&!n.unattended&&!r?s:a.jsxs(a.Fragment,{children:[n.plan&&a.jsx(s5e,{note:n.plan}),n.unattended&&a.jsx(o5e,{note:n.unattended}),r&&a.jsx(r5e,{items:r.items}),s]})}function sMt({text:e}){const t=p_(e);if(t.names.length>1)return a.jsx(eV,{chip:a.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:t.names.map(r=>a.jsx(H6,{name:`/skill:${r}`},r))}),extra:t.rest});const n=z6(e);return n.slash?a.jsx(eV,{chip:a.jsx(H6,{name:n.slash}),extra:n.rest.trim()}):null}function oMt({preset:e}){const{t}=Se();return a.jsxs("div",{className:"min-w-64 max-w-[80%] overflow-hidden rounded-2xl rounded-br-md bg-muted text-sm",children:[a.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 py-2.5",children:[a.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-info/15 text-info",children:a.jsx(r_,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[11px] text-muted-foreground",children:t("Workflow preset")}),a.jsx("p",{className:"truncate font-medium",title:e.id,children:e.name||e.id})]})]}),e.args.length>0&&a.jsx("dl",{className:"space-y-1 border-t border-border/60 px-3.5 py-2 text-xs",children:e.args.map(([n,r])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx("dt",{className:"shrink-0 font-mono text-muted-foreground",children:n}),a.jsx("dd",{className:"min-w-0 whitespace-pre-wrap break-words",children:r})]},n))})]})}function uA({kind:e,label:t,title:n}){const r=e==="file"?$p:e==="chat"?Kp:iVe;return a.jsxs("span",{className:xe(KP(e),"mx-0.5 max-w-52 rounded-md px-1.5 align-middle leading-4"),title:n,children:[a.jsx(r,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{className:"truncate",children:t})]})}function iMt({label:e,sessionFile:t}){const n=it(s=>s.conversations),r=e3t(n,t);return r?a.jsxs("button",{type:"button","data-enso":"chat-ref",onClick:()=>cA(r),title:t,className:xe(KP("chat"),"mx-0.5 inline-flex max-w-52 items-center gap-1 rounded-md px-1.5 align-middle leading-4 hover:bg-muted"),children:[a.jsx(Kp,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{className:"truncate",children:e})]}):a.jsx(uA,{kind:"chat",label:e,title:t})}const Mle=240;function aMt({text:e,originalLines:t}){const{t:n}=Se(),r=y.useRef(null),[s,o]=y.useState(!1),[i,l]=y.useState(!1);y.useLayoutEffect(()=>{const u=r.current;if(!u)return;const d=()=>o(u.scrollHeight>Mle+1);if(d(),typeof ResizeObserver>"u")return;const f=new ResizeObserver(d);return f.observe(u),()=>f.disconnect()},[]);const c=s&&!i;return a.jsxs("span",{"data-enso":"quote-block",className:"mt-1 mb-2.5 block border-l-2 border-brand/40 pl-2.5 text-muted-foreground",children:[t?a.jsx("span",{"data-quote-truncated":"",className:"mb-0.5 block text-[11px] text-warning",children:n("Truncated · original {{count}} lines",{count:t})}):null,a.jsx("span",{ref:r,"data-quote-body":"","data-clipped":c?"":void 0,style:c?{maxHeight:Mle}:void 0,className:xe("block",c&&"overflow-hidden mask-b-from-60%"),children:rIt(e).map((u,d)=>u.type==="code"?a.jsx("span",{"data-quote-code":"",className:"my-1 block overflow-x-auto whitespace-pre rounded-md bg-background/60 px-2 py-1 font-mono text-xs",children:u.code},d):a.jsx("span",{children:u.text},d))}),s?a.jsx("button",{type:"button","data-quote-toggle":"","data-quote-skip":"",onClick:()=>l(u=>!u),className:"mt-0.5 text-[11px] text-muted-foreground/80 select-none hover:text-foreground",children:n(i?"Show less":"Show more")}):null]})}function YC({text:e,searchQuery:t="",activeNth:n=-1}){const r=DJe(vq(e)),s={n:0};return a.jsx("span",{className:"whitespace-pre-wrap",children:r.map((o,i)=>o.type==="file"?a.jsx(Y$,{path:o.path,children:a.jsx(uA,{kind:"file",label:g_(o.path),title:o.path})},i):o.type==="chat"?a.jsx(iMt,{label:o.label,sessionFile:o.sessionFile},i):o.type==="ui-element"?a.jsx(uA,{kind:"ui-element",label:o.label,title:`${o.path}${o.text?` · ${o.text}`:""}`},i):o.type==="quote"?a.jsx(aMt,{text:o.text,originalLines:o.originalLines},i):a.jsx("span",{children:t.trim()?QTe(o.text,t,n,s):o.text},i))})}function lMt({files:e,chats:t}){return a.jsxs("span",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[e.map(n=>a.jsx(Y$,{path:n,children:a.jsx(uA,{kind:"file",label:g_(n),title:n})},`f:${n}`)),t.map(n=>a.jsx(uA,{kind:"chat",label:n.label,title:n.sessionFile},`c:${n.sessionFile}`))]})}const aR="max-w-[82%] rounded-[10px] bg-muted px-3.5 py-[9px] text-(length:--chat-body-size) leading-[1.6]";function bp({text:e,searchQuery:t="",activeNth:n=-1,thumbnails:r=0,align:s="end",hostTaskWrapUp:o=!1}){const{t:i}=Se(),l=Ud(),c=!!(l?.speaker||l?.botSession),u=qet(e,r);if(u)return a.jsxs(a.Fragment,{children:[u.text&&a.jsx(bp,{text:u.text,searchQuery:t,activeNth:n,hostTaskWrapUp:o}),a.jsx(LNe,{entries:u.entries,thumbnails:r,align:s})]});const d=pIt(e);if(d)return a.jsx($3t,{message:d});const f=c?Y2e(e):null;if(f)return a.jsx(JIt,{message:f});const h=c?rP(e):e;if(h!==e)return a.jsx(bp,{text:h,searchQuery:t,activeNth:n,hostTaskWrapUp:o});const p=c?DY(e):null;if(p?.refs.length)return a.jsxs("div",{className:"flex w-full flex-col items-end gap-1.5",children:[p.body&&a.jsx(bp,{text:p.body,searchQuery:t,activeNth:n}),a.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:p.refs.map(R=>a.jsxs("span",{title:i("Referenced chat"),className:"inline-flex h-6 max-w-56 items-center gap-1 rounded-md bg-muted px-1.5 text-xs",children:[a.jsx(vg,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{className:"min-w-0 truncate",children:R.title})]},R.id))})]});const m=c_(e);if(m.note){const R=m.rest.trim();return a.jsxs(a.Fragment,{children:[a.jsx(s5e,{note:m.note}),R&&a.jsx(bp,{text:R,searchQuery:t,activeNth:n,hostTaskWrapUp:o})]})}const v=u2(e);if(v.note){const R=v.rest.trim();return a.jsxs(a.Fragment,{children:[a.jsx(o5e,{note:v.note}),R&&a.jsx(bp,{text:R,searchQuery:t,activeNth:n,hostTaskWrapUp:o})]})}const b=o?$ye(e):null;if(b){const R=b.rest.trim();return a.jsxs(a.Fragment,{children:[a.jsx(r5e,{items:b.items}),R&&a.jsx(bp,{text:R,searchQuery:t,activeNth:n})]})}const x=WRt.exec(e);if(x){const R=e.slice(x[0].length).trim();return a.jsxs(a.Fragment,{children:[a.jsx(qRt,{note:x[1]??""}),R&&a.jsx(bp,{text:R,searchQuery:t,activeNth:n})]})}const S=aQe(e);if(S?.kind==="approved")return a.jsxs("div",{className:"flex w-full items-start gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground",children:[a.jsx(EW,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),a.jsxs("span",{className:"min-w-0",children:[i("Plan approved, executing"),a.jsx("span",{className:"ml-1.5 text-foreground",children:S.title})]})]});if(S?.kind==="feedback")return a.jsxs("div",{className:xe(aR,"whitespace-pre-wrap"),children:[a.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[10px] font-medium tracking-wide text-muted-foreground uppercase",children:[a.jsx(rx,{className:"h-3 w-3"}),i("Plan feedback")]}),a.jsx(YC,{text:S.feedback,searchQuery:t,activeNth:n})]});const k=Xye(e);if(k)return a.jsx(oMt,{preset:k});const C=VJe(e);if(C.files.length>0||C.chats.length>0){const R=z6(C.body);return a.jsxs("div",{className:aR,children:[R.slash?a.jsxs(a.Fragment,{children:[a.jsx(H6,{name:R.slash}),R.rest.trim()?a.jsx("span",{className:"ml-1.5 align-middle",children:a.jsx(YC,{text:R.rest.trim(),searchQuery:t,activeNth:n})}):null]}):a.jsx(YC,{text:C.body,searchQuery:t,activeNth:n}),a.jsx(lMt,{files:C.files,chats:C.chats})]})}const N=m_(e);if(N)return a.jsx(rMt,{blocks:N,hostTaskWrapUp:o});if(z6(e).slash)return a.jsx(sMt,{text:e});const j=GRt.exec(e);if(j){const R=e.slice(j[0].length).trim();return a.jsxs(a.Fragment,{children:[a.jsx(YRt,{note:j[1]}),R&&a.jsx(bp,{text:R,searchQuery:t,activeNth:n})]})}const I=yIt(e);if(I)return a.jsx(XRt,{segments:I,searchQuery:t,activeNth:n});const _=ANe(e);if(_)return a.jsx(i5e,{lines:_});const L=n5e.exec(e),M=L?e.slice(L[0].length):e,F=a5e.exec(M),D=F?F[1]:M;return a.jsxs("div",{className:xe(F?"max-w-[80%] rounded-2xl rounded-bl-md border border-blue-500/20 bg-blue-500/8 px-4 py-2.5 text-sm":xe(aR,"whitespace-pre-wrap")),children:[F&&a.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[10px] font-medium tracking-wide text-blue-600 uppercase dark:text-blue-400",children:[a.jsx(Jl,{className:"h-3 w-3"}),i("From main agent")]}),L?.[1]&&!cIt(L[1])&&a.jsxs("div",{className:"mb-2 rounded-md bg-background/60 px-2.5 py-1.5 text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-semibold",children:i("Role")})," · ",L[1]]}),F?a.jsx(ua,{text:D,searchQuery:t,activeNth:n}):a.jsx(YC,{text:D,searchQuery:t,activeNth:n})]})}function _le(e){return e.kind==="tool-group"||e.kind==="thinking"||e.kind==="tool"&&LM(e)}const Ch="text-[color:var(--subtle-foreground,var(--muted-foreground))]",ek="animate-pulse motion-reduce:animate-none";function cMt({model:e,at:t,privacyMask:n,secretarySession:r=!1,face:s,conversationId:o}){const i=Ud(),l=xNe(o),c=r?s??l:null,u=i?.speaker??(i?null:c),d=!i&&c?!0:void 0,f=[e,typeof t=="number"?QP(t):null].filter(Boolean).join(" · ");return!u&&!f&&!n?null:a.jsxs("div",{"data-quote-skip":"",className:"mb-2 flex h-6 min-w-0 items-center gap-2 text-xs select-none",children:[u&&(u.image?a.jsx("img",{"data-enso":d?"secretary-chat-avatar":void 0,"data-image":d?"true":void 0,src:u.image,alt:"",draggable:!1,className:"size-[22px] shrink-0 rounded-full object-cover",style:{backgroundColor:u.color}}):d?a.jsx(NN,{name:u.name,color:u.color,enso:"secretary-chat-avatar",className:"size-[22px] rounded-full"}):a.jsx("span",{className:"flex size-[22px] shrink-0 items-center justify-center rounded-full font-semibold text-[11px] text-white",style:{backgroundColor:u.color},children:[...u.name.trim()][0]?.toUpperCase()??"?"})),u&&a.jsx("span",{className:"shrink-0 truncate text-[13px] font-semibold text-foreground",children:u.name}),f&&a.jsx("span",{className:xe("min-w-0 truncate text-[11.5px]",Ch),children:f}),n&&a.jsx(Xjt,{report:n})]})}const uMt=y.memo(function({item:t,secretarySession:n=!1,onToggleGroup:r,onToggleTurn:s}){const o=FEt(),i=o.query,l=o.activeKey===t.key?o.activeNth:-1,c=n;switch(t.kind){case"user":{const u=t.text?tMt(t.text):!1,d=t.collapsed===!0,f=t.hostTaskWrapUp?kJe(t.text):t.text;return a.jsxs("div",{"data-enso":"message-user",className:xe("group/user flex flex-col gap-1.5",u?"items-start":"items-end"),children:[t.images.map((h,p)=>a.jsx(XN,{src:`data:${h.mimeType};base64,${h.data}`,className:"max-h-48 max-w-full rounded-lg border object-contain"},p)),t.text&&a.jsx(bp,{text:t.text,searchQuery:i,activeNth:l,thumbnails:t.images.length,align:u?"start":"end",hostTaskWrapUp:t.hostTaskWrapUp===!0}),d?a.jsx(CMt,{turnKey:t.key,text:f,timestamp:t.timestamp,turnDurationMs:t.turnDurationMs,onToggle:s}):a.jsx(EMt,{turnKey:t.key,messageIndex:Number(t.key),text:f,timestamp:t.timestamp,deliveryState:t.deliveryState,canCollapse:t.canCollapse,onToggleTurn:s})]})}case"text":return a.jsx(AMt,{item:t,searchQuery:i,activeNth:l});case"thinking":return a.jsx(RMt,{itemKey:t.key,text:t.text,streaming:t.streaming,durationMs:t.durationMs,startedAt:t.startedAt});case"tool":{const u=A3t(t),d=oN(t.name,c),f=a.jsxs(a.Fragment,{children:[a.jsx(Nwt,{name:t.name,output:t.output,state:t.state}),d?a.jsx(MRt,{item:t,framed:c}):a.jsx(BMt,{item:t}),u?a.jsx(j3t,{proposalId:u}):null,t.pluginArtifacts?a.jsx(djt,{artifacts:t.pluginArtifacts,align:d?"card":"tool-row"}):null]});return d?a.jsx("div",{"data-enso":"tool-card-pair",className:"w-full min-w-0",children:f}):f}case"tool-group":return a.jsx(LMt,{item:t,onToggle:r});case"error":return a.jsxs("div",{className:"flex items-start gap-2 text-sm text-destructive",children:[a.jsx(qa,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),a.jsx("p",{className:"min-w-0 flex-1 whitespace-pre-wrap",children:t.text}),a.jsx(u5e,{})]});case"interrupted":return a.jsx(gMt,{item:t});case"task-note":return a.jsx(MMt,{item:t});case"compaction":case"compaction-notice":return a.jsx(PMt,{item:t});case"compaction-progress":return a.jsx(_Mt,{state:t.state});case"session-custom":return a.jsx(mMt,{entry:t.entry});case"plugin-message":return a.jsx(fMt,{item:t});case"discarded-turn":return a.jsx(hMt,{item:t,onToggle:r});case"resumed-reply":return a.jsx(pMt,{item:t,onToggle:r});case"divider":return a.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[a.jsx("span",{className:"h-px flex-1 bg-border"}),t.text,a.jsx("span",{className:"h-px flex-1 bg-border"})]})}},VRt),Ple=e=>{if(typeof e=="string")return e;if(e===void 0)return"—";try{return JSON.stringify(e)}catch{return String(e)}};function dMt({entry:e}){const{t}=Se(),n=X3t(),r=n.get(e.accountKey),s=e.previousAccountKey?n.get(e.previousAccountKey):void 0,o=e.previousAccountKey?s&&r?t("ChatGPT account switched: {{previous}} → {{current}}",{previous:s,current:r}):t("ChatGPT account switched"):r?t("ChatGPT account selected: {{account}}",{account:r}):t("ChatGPT account selected");return a.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-2 text-xs",children:[a.jsx(Lo,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-primary"}),a.jsx("p",{className:"min-w-0 break-words text-muted-foreground",children:o})]})}function fMt({item:e}){const{t}=Se();return a.jsxs("div",{"data-plugin-message":e.pluginId,className:"rounded-md border border-dashed border-border bg-muted/20 px-3 py-2 text-xs",children:[a.jsxs("p",{className:"mb-1 flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(YP,{pluginId:e.pluginId,className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{children:t("From plugin {{name}}",{name:e.pluginName})}),a.jsx("span",{className:"font-mono opacity-70",children:e.pluginId})]}),a.jsx("div",{className:l5e,children:a.jsx(ua,{text:e.text})})]})}const l5e="break-words text-foreground [&_p]:whitespace-pre-line";function hMt({item:e,onToggle:t}){const{t:n}=Se();return a.jsxs("div",{"data-discarded-turn":e.pluginId,children:[a.jsxs("button",{type:"button",onClick:()=>t?.(e.key),"data-enso":"tool-row",className:xe("group/step flex min-h-6 w-full items-center gap-2 text-left text-[13px] transition-colors hover:text-foreground",Ch),children:[a.jsx(FW,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"shrink-0 text-muted-foreground group-hover/step:text-foreground",children:yg("turn_discard",n)}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:[e.pluginName,e.reason].filter(Boolean).join(" · ")}),a.jsx(Bs,{className:xe("h-3 w-3 shrink-0 transition-transform",e.expanded&&"rotate-90")})]}),e.expanded&&a.jsxs("div",{className:"t-acc-reveal mt-1 mb-1.5 ml-5 space-y-2 rounded-md border border-dashed border-border bg-muted/20 px-3 py-2 text-xs",children:[a.jsxs("p",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(YP,{pluginId:e.pluginId,className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{children:n("From plugin {{name}}",{name:e.pluginName})})]}),e.messages.map((r,s)=>a.jsx("div",{className:l5e,children:a.jsx(ua,{text:r})},s)),e.tools.map((r,s)=>a.jsxs("p",{className:xe("truncate",Ch),children:[yg(r.name,n)," ",r.summary]},s))]})]})}function pMt({item:e,onToggle:t}){const{t:n}=Se();return a.jsxs("div",{"data-resumed-reply":"",children:[a.jsxs("button",{type:"button",onClick:()=>t?.(e.key),"aria-expanded":e.expanded,"data-enso":"tool-row",className:xe("group/step flex min-h-6 w-full items-center gap-2 text-left text-[13px] transition-colors hover:text-foreground",Ch),children:[a.jsx(Exe,{className:"h-3.5 w-3.5 shrink-0"}),a.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[n("Interrupted by a restart, continued below"),a.jsx("span",{className:"ml-1.5 opacity-70",children:e.expanded?n("Hide the interrupted part"):n("Show the interrupted part")})]}),a.jsx(Bs,{className:xe("h-3 w-3 shrink-0 transition-transform",e.expanded&&"rotate-90")})]}),e.expanded&&a.jsxs("div",{className:"t-acc-reveal mt-1 mb-1.5 ml-5 space-y-2 rounded-md border border-dashed border-border bg-muted/20 px-3 py-2 text-xs",children:[e.thinking&&a.jsx("p",{className:xe("whitespace-pre-wrap break-words",Ch),children:e.thinking}),e.text&&a.jsx("p",{className:"whitespace-pre-wrap break-words text-foreground",children:e.text}),e.tools.map((r,s)=>a.jsxs("p",{className:xe("truncate",Ch),children:[yg(r.name,n)," ",r.summary]},s))]})]})}function mMt({entry:e}){const{t}=Se();if(e.kind==="oauth-account-selected")return a.jsx(dMt,{entry:e});if(e.kind==="agent-dispatch")return a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-2 text-xs",children:[a.jsx(Jl,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),a.jsx("span",{className:"text-muted-foreground",children:t("Dispatched to")}),a.jsx("span",{className:"font-medium",children:e.child.instanceName})]});if(e.kind==="agent-completed")return a.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-emerald-500/20 bg-emerald-500/5 px-2.5 py-2 text-xs",children:[a.jsx(Is,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-500"}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"font-medium",children:[e.child.instanceName," · ",t("Completed")]}),e.receiptSummary&&a.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-muted-foreground",children:e.receiptSummary})]})]});if(e.kind==="agent-failed")return a.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/20 bg-destructive/5 px-2.5 py-2 text-xs",children:[a.jsx(qa,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive"}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"font-medium",children:[e.child.instanceName," · ",t("Failed")]}),a.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-muted-foreground",children:e.message})]})]});if(e.kind==="tool-batch-label")return null;if(e.kind==="task-wrap-up-nudge")return a.jsxs("div",{"data-enso":"task-wrap-up-nudge",className:"my-1 flex items-center gap-1.5 text-[12px] text-subtle-foreground",children:[a.jsx(gg,{className:"size-3.5 shrink-0"}),t("{{count}} background tasks are still undeclared; the next message asks the agent to stop each one or state why it keeps running",{count:e.count})]});const n=e.receipt,r=n.outcome==="succeeded";return a.jsx("div",{className:xe("rounded-md border px-2.5 py-2 text-xs",r?"border-emerald-500/20 bg-emerald-500/5":n.outcome==="failed"?"border-destructive/20 bg-destructive/5":"border-amber-500/20 bg-amber-500/5"),children:a.jsxs("div",{className:"flex items-start gap-2",children:[r?a.jsx(Is,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-emerald-500"}):a.jsx(qa,{className:xe("mt-0.5 h-3.5 w-3.5 shrink-0",n.outcome==="failed"?"text-destructive":"text-amber-500")}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"font-medium",children:[n.subject.label," · ",t(n.outcome)]}),a.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-muted-foreground",children:n.summary}),n.changes&&n.changes.length>0&&a.jsx("dl",{className:"mt-2 space-y-1 border-t border-border/50 pt-2",children:n.changes.map(s=>a.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2",children:[a.jsx("dt",{className:"truncate text-muted-foreground",children:s.field}),a.jsxs("dd",{className:"text-right font-mono",children:[Ple(s.previous)," → ",Ple(s.value)]})]},s.field))})]})]})})}function Wa(e){const t=e.activeId?e.conversations[e.activeId]:null;return t?t.activeTabId?e.conversations[t.activeTabId]??t:t:null}const c5e=()=>()=>{};function gMt({item:e}){const{locale:t}=Se(),n=fIt({at:e.at,kind:e.exitKind,unfinishedTools:e.unfinishedTools,lang:t});return a.jsxs("div",{"data-enso":"timeline-interrupted",className:"flex items-start gap-2 text-sm text-warning",children:[a.jsx(qa,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),a.jsx("p",{className:"min-w-0 flex-1 whitespace-pre-wrap",children:n}),a.jsx(vMt,{})]})}function vMt(){const{t:e}=Se();return it(n=>{const r=Wa(n);return!!(r&&!r.spawning&&r.status!=="running")})?a.jsxs("button",{type:"button","data-enso":"timeline-interrupted-retry",title:e("Retry"),onClick:()=>{const n=Wa(it.getState());n&&it.getState().retryInterrupted(n.id)},className:"mt-0.5 inline-flex shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",children:[a.jsx(Lo,{className:"h-3 w-3"}),e("Retry")]}):null}function u5e(){const{t:e}=Se(),t=Ud(),n=t?.botControls,r=it(l=>{if(t&&(!t.canRetry||t.botControls))return!1;const c=Wa(l);return!!(c?.started&&!c.spawning&&c.status!=="running")}),s=()=>{if(!n||!t?.canRetry)return!1;const l=n.projection();return!!(l&&l.status!=="running")},o=y.useSyncExternalStore(n?.subscribe??c5e,s,s);return(n?o:r)?a.jsxs("button",{type:"button",title:e("Retry"),onClick:()=>{if(n)return n.retry();const l=Wa(it.getState());l&&it.getState().retry(l.id)},className:"mt-0.5 inline-flex shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",children:[a.jsx(Lo,{className:"h-3 w-3"}),e("Retry")]}):null}function xMt(e,t){return eet(Wa(e),t)}const LK="flex items-center gap-1 text-[11px] text-muted-foreground transition-opacity hover:text-foreground";function bMt({messageIndex:e}){const{t}=Se(),n=Ud();return it(s=>{const o=Wa(s);return tet(o,n,o?y_(s.conversations,o.id):1)})?a.jsxs("button",{type:"button",className:LK,title:t("Keep this session and start a parallel one from here"),onClick:()=>{const s=it.getState(),o=Wa(s);o&&s.forkFromTurn(o.id,e)},children:[a.jsx(wf,{className:"h-3 w-3"}),t("Conversation branch")]}):null}function yMt({messageIndex:e}){const{t}=Se(),n=Ud(),r=it(o=>Wa(o)?.id),s=it(o=>{const i=r?o.conversations[r]:void 0;if(n||!i||i.historyOnly||i.rewinding||i.restoringFiles||i.workspaceMigrating)return;const l=i.messages[e-(i.historyBaseIndex??0)];return OM(l)||i.status==="running"&&$1e(l)?l?.deliveryId:void 0});return!r||!s?null:a.jsxs("button",{type:"button",title:t("Withdraw message"),onClick:()=>it.getState().withdrawMessage(r,{kind:"delivery",id:s}),className:"inline-flex items-center gap-1 hover:text-foreground",children:[a.jsx(kT,{className:"h-3 w-3"}),t("Withdraw message")]})}function wMt(){const{t:e}=Se(),t=it(n=>Wa(n)?.id);return t?a.jsxs("button",{type:"button",onClick:()=>{INe(t,e)},className:"inline-flex items-center gap-1 hover:text-foreground",children:[a.jsx($u,{className:"h-3 w-3"}),e("Restart conversation")]}):null}function kMt({messageIndex:e}){const{t}=Se(),n=Ud(),r=it(o=>Wa(o)?.id),s=it(o=>{const i=r?o.conversations[r]:void 0;if(n||!i||i.historyOnly)return;const l=i.messages[e-(i.historyBaseIndex??0)];return OM(l)?l?.deliveryId:void 0});return!r||!s?null:a.jsxs("button",{type:"button",title:t("Resend"),onClick:()=>it.getState().resendMessage(r,s),className:"inline-flex items-center gap-1 hover:text-foreground",children:[a.jsx(Lo,{className:"h-3 w-3"}),t("Resend")]})}function SMt({messageIndex:e}){const{t}=Se(),[n,r]=y.useState(!1),[s,o]=y.useState(null),i=Ud(),l=i?.botControls,c=it(v=>{if(i?.botControls)return!1;const b=Wa(v);return xMt(v,i)&&!!(b&&kI(b.id,b.id,b,e))}),u=()=>{if(!l||!i?.canRewind||!i.sessionId)return null;const v=l.projection();return!v||v.status==="running"?null:kI(i.sessionId,i.sessionId,v,e)?.entryId??null},d=y.useSyncExternalStore(l?.subscribe??c5e,u,u);if(!(l?d!==null:c))return null;const h=v=>{if(l&&i?.sessionId&&d){o({restoreFiles:v,conversationId:i.sessionId,entryId:d});return}const b=Wa(it.getState());if(!b)return;const x=kI(b.id,b.id,b,e);x&&o({restoreFiles:v,conversationId:b.id,entryId:x.entryId})},p=(v,b,x)=>{if(l)return l.rewind(x,v);const S=it.getState(),k=Wa(S),C=kI(b,k?.id,S.conversations[b],e,x);C&&S.rewind(C.conversationId,C.entryId,v)},m=[{icon:kT,label:t("Conversation only"),desc:t("Rewind to this message"),restoreFiles:!1,action:()=>h(!1)},{icon:Kp,label:t("Conversation + files"),desc:t("Rewind and restore files to before this turn"),restoreFiles:!0,action:()=>h(!0)}];return a.jsxs(Gu,{open:n,onOpenChange:r,children:[a.jsxs(Wu,{className:LK,title:t("Rewind to this message"),children:[a.jsx(kT,{className:"h-3 w-3"}),t("Rewind")]}),a.jsx(qu,{side:"bottom",align:"end",className:"w-72 [&_[data-slot=popover-viewport]]:p-1",children:m.map(v=>a.jsxs("button",{type:"button",onClick:()=>{r(!1),v.action()},className:"flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-muted/60",children:[a.jsx(v.icon,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block",children:v.label}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:v.desc})]})]},v.label))}),a.jsx(ec,{open:s!==null,onOpenChange:v=>{v||o(null)},title:t("Rewind to this message?"),description:s?.restoreFiles?t("Later messages leave the current branch and working-tree files are restored to before this turn."):t("Later messages leave the current branch; the text returns to the input box."),confirmLabel:t("Rewind"),onConfirm:()=>{s&&p(s.restoreFiles,s.conversationId,s.entryId)}})]})}function CMt({turnKey:e,text:t,timestamp:n,turnDurationMs:r,onToggle:s}){const{t:o}=Se();return a.jsxs("div",{"data-quote-skip":"",className:"flex items-center gap-1.5 text-[11px] text-muted-foreground/80 select-none",children:[a.jsxs("button",{type:"button",onClick:()=>s?.(e,!1),className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground cursor-pointer border border-border/40",title:o("Expand"),children:[a.jsx(Bs,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{children:o("Expand")})]}),a.jsx(d5e,{text:t}),typeof n=="number"&&a.jsx("span",{children:QP(n)}),r!==void 0&&a.jsxs("span",{children:["· ",o("took {{duration}}",{duration:pl(r)})]})]})}function d5e({text:e}){return e.trim()?a.jsx("span",{"data-enso":"copy-user-prompt",className:"inline-flex",children:a.jsx(f5e,{text:d_(e),className:"opacity-0 transition-opacity group-hover/user:opacity-100 focus-visible:opacity-100"})}):null}function EMt({turnKey:e,messageIndex:t,text:n,timestamp:r,canCollapse:s,deliveryState:o,onToggleTurn:i}){const{t:l}=Se(),c=be(u=>u.autoCollapseTurns);return a.jsxs("div",{"data-quote-skip":"",className:"flex items-center gap-2 text-[11px] text-muted-foreground/75 select-none",children:[a.jsx(SMt,{messageIndex:t}),a.jsx(kMt,{messageIndex:t}),a.jsx(yMt,{messageIndex:t}),a.jsx(d5e,{text:n}),o&&a.jsx("span",{children:l(o==="stuck"?"Not sent: the previous turn is stuck and could not be interrupted. Restart the conversation, then resend.":o==="rejected"?"Not sent":"Delivery unconfirmed")}),o==="stuck"&&a.jsx(wMt,{}),c&&s&&i&&a.jsxs("button",{type:"button",onClick:()=>i(e,!0),className:xe(LK,"cursor-pointer opacity-0 group-hover/user:opacity-100"),title:l("Collapse"),children:[a.jsx(Ho,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{children:l("Collapse")})]}),typeof r=="number"&&a.jsx("span",{children:QP(r)})]})}function TMt({turnKey:e,canCollapse:t,collapsed:n,onToggleTurn:r}){const{t:s}=Se();return!be(i=>i.autoCollapseTurns)||!t||!r||n?null:a.jsxs("button",{type:"button","data-enso":"turn-collapse","data-quote-skip":"",onClick:()=>r(e,!0),className:xe("mt-1 flex min-h-6 select-none items-center gap-1 text-[12px] transition-colors hover:text-foreground [@media(hover:none)]:min-h-10 [@media(hover:none)]:pr-3",Ch),children:[a.jsx($4,{className:"h-3 w-3"}),a.jsx("span",{children:s("Collapse")})]})}function AMt({item:e,searchQuery:t="",activeNth:n=-1}){const{t:r}=Se(),s=Ud(),o=e.perf?NMt(e.perf,r,e.turnDurationMs!==void 0):"",i=it(u=>Wa(u)?.id??null),l=Number(e.key.split("-")[0]),c={text:e.text,messageIndex:l,sessionId:s?s.sessionId:i};return a.jsxs("div",{"data-enso":"message-assistant",className:"group text-(length:--chat-body-size)",children:[a.jsx(ua,{text:e.text,streaming:e.streaming,searchQuery:t,activeNth:n,leaf:{messageIndex:c.messageIndex,sessionId:c.sessionId}}),e.turnEnd&&!e.streaming&&s?.turnFooter?.(Number(e.key.split("-")[0])),!e.streaming&&a.jsxs("div",{"data-quote-skip":"",className:"mt-1 flex items-center gap-2 text-[11px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[a.jsx(Tie,{position:"left",...c}),a.jsx(f5e,{text:e.text}),a.jsx(Tie,{position:"right",...c}),e.turnEnd&&a.jsx(bMt,{messageIndex:Number(e.key.split("-")[0])}),e.timestamp&&!e.turnEnd&&a.jsx("span",{children:QP(e.timestamp)}),e.turnDurationMs!==void 0&&a.jsxs("span",{children:[e.timestamp&&!e.turnEnd&&"· ",r("took {{duration}}",{duration:pl(e.turnDurationMs)})]}),o&&a.jsxs("span",{children:["· ",o]})]})]})}function f5e({text:e,className:t}){const{t:n}=Se(),[r,s]=y.useState(!1);return a.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),1e3)})},className:xe("flex items-center gap-1 transition-colors hover:text-foreground",t),title:n("Copy"),children:r?a.jsx(Is,{className:"h-3 w-3"}):a.jsx(zd,{className:"h-3 w-3"})})}const Lle=e=>String(e).padStart(2,"0"),QP=e=>{const t=new Date(e);return`${Lle(t.getHours())}:${Lle(t.getMinutes())}`},Ole=e=>{const t=e/1e3;return t<10?String(Math.round(t*10)/10):String(Math.round(t))};function NMt(e,t,n=!1){const r=[];return(!n||e.turnMs!==void 0)&&r.push(`${Ole(e.runMs)}s`),e.ttftMs!==void 0&&r.push(`TTFT ${Ole(e.ttftMs)}s`),e.tps!==void 0&&r.push(`${Math.round(e.tps)} tok/s`),!n&&e.turnMs!==void 0&&r.push(t("total {{duration}}",{duration:pl(e.turnMs)})),r.join(" · ")}function IMt(e,t,n=16){return e.top<t.top?e.top-t.top-n:e.bottom>t.bottom?e.bottom-t.bottom+n:0}function jMt(e){let t=e.parentElement;for(;t;){if(t.hasAttribute("data-virtuoso-scroller"))return t;const n=typeof window.getComputedStyle=="function"?window.getComputedStyle(t).overflowY:t.style.overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return t;t=t.parentElement}return null}function h5e(e,t=jMt(e)){if(!t){e.getBoundingClientRect().top<0&&e.scrollIntoView?.({block:"nearest"});return}const n=IMt(e.getBoundingClientRect(),t.getBoundingClientRect());n!==0&&(t.scrollTop=Math.max(0,t.scrollTop+n))}function RMt({itemKey:e,text:t,streaming:n,durationMs:r,startedAt:s}){const{t:o}=Se(),i=be(h=>h.expandLiveReasoning),[l,c]=y.useState(null),u=Xtt(l,n,i),d=y.useRef(null),f=y.useRef(!1);return y.useLayoutEffect(()=>{u||!f.current||(f.current=!1,d.current&&h5e(d.current))},[u]),a.jsxs("div",{ref:d,"data-enso":"thinking","data-live":n||void 0,children:[a.jsxs("button",{type:"button","data-quote-skip":"",onClick:()=>c(!u),className:xe("flex min-h-6 select-none items-center gap-2 text-[13px] transition-colors hover:text-foreground",Ch),children:[a.jsx("span",{className:"flex size-3 shrink-0 items-center justify-center",children:a.jsx(vT,{className:xe("size-3",n&&"animate-pulse text-brand")})}),n?a.jsx("span",{className:xe("text-foreground",ek),children:o("Thinking…")}):r!==null?a.jsx("span",{children:o("Thought for {{duration}}",{duration:pl(r)})}):a.jsx("span",{children:o("Thought process")}),n&&a.jsx(p5e,{itemKey:e,since:s}),a.jsx(Bs,{className:xe("h-3 w-3 transition-transform",u&&"rotate-90")})]}),u&&a.jsx(Iwt,{text:t,streaming:n,itemKey:e}),u&&!n&&a.jsxs("button",{type:"button","data-enso":"thinking-collapse","data-quote-skip":"",onClick:()=>{f.current=!0,c(!1)},className:xe("mt-1 ml-[31px] flex min-h-6 select-none items-center gap-1 text-[12px] transition-colors hover:text-foreground",Ch),children:[a.jsx($4,{className:"h-3 w-3"}),a.jsx("span",{children:o("Collapse thinking")})]})]})}function MMt({item:e}){const{t}=Se(),[n,r]=y.useState(!1),[s,o]=y.useState(void 0),i=/^Background task (\S+) finished \((.+?), ran (.+?)\)/.exec(e.summary),l=i?`${i[1]} · ${i[2]} · ${i[3]}`:e.summary,c=/(?:read ((?:\/|[A-Za-z]:[\\/]).+?\.log) for the complete log|Full log: ((?:\/|[A-Za-z]:[\\/])\S+?\.log))/.exec(e.detail)?.slice(1).find(Boolean)??null;return y.useEffect(()=>{!n||!c||s!==void 0||window.electronAPI.files.read(c).then(u=>{o(typeof u=="string"?u:null)}).catch(()=>o(null))},[n,c,s]),a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>r(u=>!u),className:"flex w-full items-center gap-3",title:e.detail,children:[a.jsx("span",{className:"h-px flex-1 bg-border"}),a.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[a.jsx(Is,{className:"h-3 w-3 text-green-600 dark:text-green-500"}),l,a.jsx(Bs,{className:xe("h-3 w-3 transition-transform",n&&"rotate-90")})]}),a.jsx("span",{className:"h-px flex-1 bg-border"})]}),n&&a.jsxs("div",{className:"mt-1.5 rounded-lg border border-border/60 bg-muted/20",children:[a.jsx("pre",{className:"border-b border-border/60 px-3 py-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground",children:e.detail}),a.jsx("pre",{className:"max-h-64 overflow-auto px-3 py-2 font-mono text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground",children:c?s===void 0?t("Loading…"):If(s??t("(log unavailable)")):t("(no log available)")})]})]})}function _Mt({state:e}){const{t}=Se();return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[a.jsx(Jn,{className:"h-3 w-3 animate-spin"}),a.jsx("span",{children:t(e==="queued"?"Compacts after this turn":"Compacting…")})]})}function PMt({item:e}){const{t}=Se(),[n,r]=y.useState(!1),s=e.kind==="compaction",o=e.tokensBefore===null?null:Va(e.tokensBefore),i=Tjt(e.tokensBefore,e.tokensAfter),l=i!==null&&e.tokensBefore!==null&&e.tokensAfter!==void 0?t("{{kind}} · {{before}} → {{after}} · freed {{percent}}%",{kind:t(e.memory?"Memory context compacted":e.verified?"Verified context compacted":"Context compacted"),before:Va(e.tokensBefore),after:Va(e.tokensAfter),percent:i}):e.memory?o===null?t("Memory context compacted"):t("Memory context compacted ({{tokens}} tokens before)",{tokens:o}):e.verified?o===null?t("Verified context compacted"):t("Verified context compacted ({{tokens}} tokens before)",{tokens:o}):o===null?t("Context compacted"):t("Context compacted ({{tokens}} tokens before)",{tokens:o});return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>r(c=>!c),className:xe("flex items-center gap-3",s&&"w-full"),title:e.memory?t("Summary rendered from continuous memory. Messages above are no longer in the model context; use recall for sources."):e.verified?t("Verified summary from smart compaction. Messages above are no longer in the model context."):t(s?"Messages above are no longer in the model context; only this summary is.":"Latest compaction summary — expand to read what the model kept."),children:[s&&a.jsx("span",{className:"h-px flex-1 bg-border"}),a.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:[a.jsx(fUe,{className:"h-3 w-3"}),l,a.jsx(Bs,{className:xe("h-3 w-3 transition-transform",n&&"rotate-90")})]}),s&&a.jsx("span",{className:"h-px flex-1 bg-border"})]}),n&&a.jsx("pre",{className:"mt-1.5 max-h-80 overflow-auto rounded-lg border border-border/60 bg-muted/20 px-3 py-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground",children:e.summary||t("(summary unavailable)")})]})}function LMt({item:e,onToggle:t}){const{t:n}=Se(),r=be(m=>m.compactReadOnlyTools),s=[];e.stats.commands>0&&s.push(n("ran {{count}} commands",{count:e.stats.commands})),e.stats.reads>0&&s.push(n("read {{count}} files",{count:e.stats.reads})),e.stats.searches>0&&s.push(n("searched {{count}} times",{count:e.stats.searches})),e.stats.others>0&&s.push(n("{{count}} other calls",{count:e.stats.others}));const o=[];r&&(e.stats.reads>0&&o.push(n("{{count}} files",{count:e.stats.reads})),e.stats.searches>0&&o.push(n("{{count}} searches",{count:e.stats.searches})));const i=e.activity,l=[];i&&(i.thinking>0&&l.push(n("{{count}} thinking steps",{count:i.thinking})),e.count>0&&l.push(n("{{count}} tool calls",{count:e.count})));const c=e.explore,u=e.exploring||!!(i&&e.live),d=e.notice==="patrol"?n("Patrol clear"):e.notice==="seen"?n("Update seen"):null,f=c?yg("explore_fold",n):d||(i?n("Worked for {{duration}}",{duration:pl(i.workedMs)}):r?e.exploring?n("Exploring"):n("Explored"):n("{{count}} tool calls",{count:e.count})),h=c?[c.goal,n("{{count}} tool calls",{count:e.count})].filter(Boolean):d?l:e.summary&&!e.exploring?[e.summary]:i?l:r?o:s,p=a.jsxs("button",{type:"button",onClick:()=>{c?.steps&&t?.(tH(e.key)),t?.(e.key)},title:c?.goal,"data-explore-head":c?"":void 0,"data-enso":"tool-row","data-notice":e.notice,className:xe("group/step flex min-h-6 w-full items-center gap-2 text-left text-[13px] transition-colors hover:text-foreground",Ch),children:[a.jsx(J$,{state:e.exploring?"running":"ok"}),a.jsx("span",{className:xe("shrink-0 text-muted-foreground group-hover/step:text-foreground",u&&xe(ek,"text-foreground"),e.exploring&&"font-medium"),children:f}),a.jsx("span",{className:xe("min-w-0 flex-1 truncate",u&&ek),children:h.join(" · ")}),a.jsx(Bs,{className:xe("h-3 w-3 shrink-0 transition-transform",e.expanded&&"rotate-90")})]});return!c||!e.expanded?p:a.jsxs(a.Fragment,{children:[p,a.jsxs("div",{"data-slot":"tool-details",className:"t-acc-reveal mt-1 mb-1.5 ml-5 overflow-hidden rounded-lg border border-border/70 bg-card text-sm shadow-xs",children:[c.goal&&a.jsxs("div",{className:"border-b border-border/60 px-3 py-2",children:[a.jsx("div",{className:"mb-0.5 text-[11px] text-muted-foreground",children:n("Goal")}),a.jsx("p",{className:"whitespace-pre-wrap",children:c.goal})]}),c.report&&a.jsxs("div",{className:"border-b border-border/60 px-3 py-2",children:[a.jsx("div",{className:"mb-0.5 text-[11px] text-muted-foreground",children:n("Result")}),a.jsx(ua,{text:c.report})]}),a.jsxs("button",{type:"button",onClick:()=>t?.(tH(e.key)),className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",children:[a.jsx(Bs,{className:xe("h-3 w-3 shrink-0 transition-transform",c.steps&&"rotate-90")}),a.jsx("span",{children:c.steps?n("Hide process"):n("Show process")}),a.jsxs("span",{children:["· ",n("{{count}} tool calls",{count:e.count})]})]})]})]})}function cC({children:e,className:t,follow:n}){const r=y.useRef(null),s=y.useRef(null),o=y.useRef(n),i=y.useRef(n),l=y.useRef(null),c=y.useRef(null),u=y.useRef(0);i.current=n;const d=y.useCallback(()=>{o.current=!1,l.current=null,cancelAnimationFrame(u.current)},[]),f=y.useCallback(()=>{!i.current||!o.current||(cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{const h=r.current;if(!h||!i.current||!o.current)return;const p=Math.max(0,h.scrollHeight-h.clientHeight);l.current=p,h.scrollTop=p}))},[]);return y.useEffect(()=>{n?(o.current=!0,f()):(l.current=null,cancelAnimationFrame(u.current))},[n,f]),y.useEffect(f),y.useEffect(()=>{const h=s.current;if(!h)return;const p=new ResizeObserver(f);return p.observe(h),()=>p.disconnect()},[f]),y.useEffect(()=>()=>cancelAnimationFrame(u.current),[]),a.jsx("div",{ref:r,onWheel:h=>{h.deltaY<0&&d()},onPointerDown:h=>{h.target===h.currentTarget&&d()},onTouchStart:h=>{c.current=h.touches[0]?.clientY??null},onTouchMove:h=>{const p=h.touches[0]?.clientY;p!==void 0&&c.current!==null&&p>c.current&&d(),c.current=p??null},onTouchEnd:()=>{c.current=null},onScroll:h=>{if(!i.current)return;const p=h.currentTarget;if(p.scrollHeight-p.scrollTop-p.clientHeight<=2){o.current=!0,l.current=null;return}const v=l.current;if(v!==null&&p.scrollTop>=v-2){l.current=null,f();return}d()},className:xe("max-h-96 overflow-auto [overflow-anchor:none]",t),children:a.jsx("div",{ref:s,children:e})})}function OMt(e){if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)??""}catch{return String(e)}}function DMt({source:e,output:t,view:n}){const r=n?.status==="completed"?OMt(n.value):n?.error??t;return a.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e?a.jsx(j6,{code:e,language:"javascript"}):null,n&&n.calls.length>0?a.jsx("div",{className:"flex flex-wrap gap-1",children:[...new Map(n.calls.map(s=>[s.name,s])).keys()].map(s=>{const o=n.calls.filter(c=>c.name===s),i=o.find(c=>!c.ok),l=`${s} ×${o.length}`;return a.jsx("span",{className:xe("rounded-md border px-1.5 py-0.5 font-mono text-[10px]",i?"border-destructive/40 text-destructive":"text-muted-foreground"),title:o.map(c=>c.summary).filter(Boolean).join(`
|
|
384
384
|
`),children:i?`${l} · ${i.error??"error"}`:l},s)})}):null,r?n?.status==="completed"&&typeof n.value!="string"?a.jsx(j6,{code:r,language:"json"}):a.jsx("pre",{className:"font-mono text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap",children:If(r)}):null,n?.console?a.jsx("pre",{className:"border-l-2 pl-2 font-mono text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap",children:If(n.console)}):null]})}function Dle({path:e,fallback:t}){const[n,r]=y.useState(!1);return n?t:a.jsx("div",{"data-slot":"read-image",className:"w-full min-w-0 px-3 py-3",children:a.jsx(XN,{src:CT(e),onError:()=>r(!0),frameClassName:"block w-full",className:"mx-auto block max-h-80 max-w-full rounded-md bg-muted/40 object-contain"})})}function BMt({item:e}){const{t}=Se(),n=Ud(),r=be(B=>B.compactReadOnlyTools),s=be(B=>B.expandLiveEdits),o=r&&e.name!=="bash"&&LM(e),i=!!(e.edits&&e.edits.length>0),l=!!e.writeContent,c=!!(e.fileChanges&&e.fileChanges.length>0),u=e.sandbox??null,d=e.state==="error"?null:e.sentMessage,f=!!e.imagePath&&e.state!=="error",h=Rq[e.name],p=rN(e.name),m=e.state!=="error"&&e.todos?.length===0,v=m?t("Todo list cleared"):e.subagentOp?[t(Ttt[e.subagentOp]),e.summary].filter(Boolean).join(" · "):e.summary,b=e.nestedPending&&e.state==="running"?`${v} · ${e.nestedPending} pending`:u?.calls.length&&e.state!=="error"?dnt(u.calls):v,x=!m&&!!(e.output||e.source||d||e.ask),S=e.state==="running"&&e.waiting==="subagent"&&!n,k=i||l||c||x||S||f,C=s&&(i||l||f)&&e.state==="running",[A,N]=y.useState(C),[j,I]=y.useState(!1),_=y.useRef(null),L=zRt();y.useEffect(()=>{if(!j)return;const B=_.current;if(!B)return;const H=e.key,G=L.report,te=new IntersectionObserver(([W])=>G(H,W?.isIntersecting===!0),{root:L.scroller.current});return te.observe(B),()=>{te.disconnect(),G(H,!1)}},[j,e.key,L]);const M=A&&e.name==="memory_search"?E1e(e.output):null,F=A&&e.name==="memory_capture"?T1e(e.output,e.memoryContent):null,D=A&&e.name==="subagent"&&e.state!=="error"?wRt(e.subagentOp,e.output):null,R=e.name==="subagent"&&e.state==="error"?SRt(e.output):null,z=y.useRef(c);return y.useEffect(()=>{const B=Ktt(e,z.current);z.current=c,(C||s&&B)&&N(!0)},[C,s,c,e]),e.todos&&e.todos.length>0?a.jsx(HMt,{todos:e.todos}):e.name.startsWith("goal_")?a.jsx(FMt,{item:e}):e.plan&&e.state!=="error"?a.jsx(zMt,{plan:e.plan}):a.jsxs("div",{ref:_,"data-enso":"tool-row","data-tool-style":o?"compact":"full","data-user-open":j?"true":void 0,children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",disabled:!k,onClick:()=>{const B=!A;N(B),I(B),L.report(e.key,B)},className:xe("group/step flex min-h-6 min-w-0 flex-1 items-center gap-2 text-left text-[13px]",Ch,k&&"cursor-pointer"),children:[a.jsx(J$,{state:e.state}),a.jsx("span",{className:xe("shrink-0 text-muted-foreground transition-colors group-hover/step:text-foreground",e.state==="running"&&xe(ek,"text-foreground")),children:h?t(h):p?.tool??e.name}),a.jsx("span",{className:xe("min-w-0 flex-1 truncate font-mono text-[12px]",e.state==="error"?"text-destructive":"text-muted-foreground",e.state==="running"&&ek),children:e.state==="error"&&e.output?v&&e.name==="apply_patch"&&c?`${b} · ${$Mt(e.output)}`:R?t(R):ZIt(If(e.output)):v?b:null}),e.backgroundTaskId&&a.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",title:e.backgroundTaskId,children:t("Moved to background")}),e.shellFailure&&e.state!=="running"&&a.jsx(cRt,{failure:e.shellFailure}),e.dcgWarning&&a.jsx(uRt,{warning:e.dcgWarning}),e.state==="reviewing"?a.jsx("span",{className:xe("shrink-0 text-[11px] text-foreground",ek),children:t("Assistant reviewing…")}):e.state==="running"&&e.startedAt!==null?a.jsxs(a.Fragment,{children:[e.callId&&(e.name==="bash"||e.name==="powershell")&&a.jsx(YMt,{callId:e.callId,startedAt:e.startedAt,output:e.output??""}),a.jsx(p5e,{itemKey:e.key,since:e.startedAt??void 0})]}):(e.agentMeta||e.durationMs!==null)&&a.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:[e.agentMeta?.modelId,e.agentMeta?.outputTokens?`${e.agentMeta.outputTokens} tok`:null,e.durationMs!==null?pl(e.durationMs):null].filter(Boolean).join(" · ")}),k&&a.jsx(Bs,{className:xe("h-3 w-3 shrink-0 text-muted-foreground opacity-0 transition-[opacity,transform] group-hover/step:opacity-100",A&&"rotate-90 opacity-100")})]}),e.state==="running"&&e.callId&&!n&&a.jsx(UMt,{callId:e.callId,waiting:!!e.waiting}),(i||l||c)&&(e.state==="ok"||c)&&a.jsx("button",{type:"button",title:t("Open in side panel"),className:"flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>TEe(),children:a.jsx(iHe,{className:"h-3 w-3"})})]}),e.generatedImages?.length?a.jsx("div",{"data-slot":"generated-images",className:"mt-2 mb-3 ml-5 grid gap-3",children:e.generatedImages.map(B=>a.jsx(Dle,{path:B,fallback:a.jsx("p",{className:"break-all px-3 py-2 text-xs text-muted-foreground",children:B})},B))}):null,A&&k&&a.jsxs("div",{"data-slot":"tool-details",className:"t-acc-reveal mt-1 mb-1.5 ml-5 overflow-hidden rounded-lg border border-border/70 bg-card shadow-xs",children:[p&&a.jsxs("div",{className:"truncate border-b border-border/60 px-3 py-1 font-mono text-[10px] text-muted-foreground",children:[p.server,".",p.tool]}),S&&a.jsx(qMt,{agentIds:e.subagentTitles?Object.keys(e.subagentTitles):void 0}),i&&e.edits&&a.jsx(cC,{follow:e.state==="running",children:a.jsx(y.Suspense,{fallback:null,children:a.jsx(jle,{path:e.summary,blocks:e.edits})})}),c&&e.fileChanges&&a.jsx(cC,{follow:e.state==="running",children:e.fileChanges.map((B,H)=>a.jsxs("div",{children:[a.jsxs("div",{className:xe("flex items-center gap-2 border-border/60 px-3 py-1 font-mono text-[10px] text-muted-foreground",(H>0||i)&&"border-t"),children:[a.jsx("span",{className:"uppercase",children:B.type}),a.jsx("span",{className:"min-w-0 flex-1 truncate",title:B.path,children:B.path}),B.truncated&&a.jsx("span",{children:t("Truncated preview")})]}),a.jsx(y.Suspense,{fallback:null,children:a.jsx(jle,{path:B.path,blocks:[B],snapshot:B})})]},`${B.type}:${Q3t(B.path,B.oldText,B.newText)}`))}),Qtt(e)&&a.jsx(cC,{follow:!1,className:"border-t border-border/60",children:a.jsx("pre",{className:"px-3 py-2 font-mono text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap",children:If(e.output??"")})}),l&&e.writeContent&&a.jsx(cC,{follow:e.state==="running",className:xe((i||c)&&"border-t border-border/60"),children:a.jsx(y.Suspense,{fallback:null,children:a.jsx(f9,{path:e.summary,contents:e.writeContent})})}),!i&&!l&&!c&&(x||f)&&a.jsxs(cC,{follow:e.state==="running",children:[F1e(e.name)?a.jsx(DMt,{source:e.source,output:e.output,view:u}):e.name==="bash"||e.name==="powershell"?a.jsx(TRt,{command:e.summary,output:e.output??"",failure:e.shellFailure}):e.name==="read"&&f&&e.imagePath?a.jsx(Dle,{path:e.imagePath,fallback:a.jsx(y.Suspense,{fallback:null,children:a.jsx(f9,{path:e.summary,contents:e.output??""})})},e.imagePath):e.name==="image_view"&&e.state==="ok"?a.jsx(IRt,{image:e.image,output:e.output}):e.name==="read"?a.jsx(y.Suspense,{fallback:null,children:a.jsx(f9,{path:e.summary,contents:e.output??""})}):e.name==="subagent"&&e.state!=="error"&&!d&&!D?a.jsx("div",{className:"px-3 py-2 text-sm",children:a.jsx(ua,{text:e.output??""})}):M?a.jsx(QU,{hits:M}):F?a.jsx(Ijt,{view:F}):a.jsxs(a.Fragment,{children:[e.ask&&a.jsx(vjt,{ask:e.ask,waiting:e.state==="running"}),d&&a.jsx("div",{className:"px-3 py-2 text-sm",children:a.jsx(ua,{text:d})}),D?a.jsx(vRt,{view:D,titles:e.subagentTitles}):e.output&&a.jsx("pre",{className:"px-3 py-2 font-mono text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap",children:If(e.output)})]}),a.jsx(Jjt,{value:e.rtk}),a.jsx(gjt,{value:e.approvalReview})]})]})]})}function FMt({item:e}){const{t}=Se(),n=e.name.replace("goal_",""),r=t(n==="complete"?"Goal completed":n==="blocked"?"Goal blocked":"Goal waiting");return a.jsxs("div",{className:xe("flex items-start gap-2 rounded-lg border px-3 py-2 text-sm",n==="complete"&&"border-green-500/50 bg-green-500/5",n==="blocked"&&"border-destructive/50 bg-destructive/5",n==="wait"&&"border-amber-500/50 bg-amber-500/5"),children:[a.jsx(i2,{className:xe("mt-0.5 h-4 w-4 shrink-0",n==="complete"&&"text-green-600 dark:text-green-500",n==="blocked"&&"text-destructive",n==="wait"&&"text-amber-500")}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"font-medium",children:r}),e.summary&&a.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-muted-foreground text-xs",children:e.summary})]})]})}function zMt({plan:e}){const{t}=Se(),[n,r]=y.useState(!1);return a.jsxs("div",{className:"rounded-lg border border-border/60 bg-muted/30 px-3 py-2",children:[a.jsxs("button",{type:"button",onClick:()=>r(s=>!s),className:"flex w-full min-w-0 items-center gap-2 text-left text-xs",children:[a.jsx(rx,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"shrink-0 font-medium text-muted-foreground",children:t("Plan")}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.title}),a.jsx(Bs,{className:xe("h-3 w-3 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")})]}),n&&a.jsx("div",{className:"mt-2 border-border/60 border-t pt-2 text-sm",children:a.jsx(ua,{text:e.text})})]})}function HMt({todos:e}){const{t}=Se(),n=e.filter(r=>r.status==="completed").length;return a.jsxs("div",{"data-enso":"todo",className:"rounded-lg border bg-card px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a.jsx(RW,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"font-medium text-foreground",children:t("Todos")}),a.jsxs("span",{className:"ml-auto tabular-nums",children:[n,"/",e.length]})]}),a.jsx(XNe,{done:n,total:e.length,className:"mt-1.5 mb-2"}),a.jsx(KNe,{todos:e})]})}const Ble=new Map;function UMt({callId:e,waiting:t}){const{t:n}=Se(),r=it(c=>Wa(c)?.id??""),[s,o]=y.useState(!1);if(y.useEffect(()=>{if(!s)return;const c=setTimeout(()=>o(!1),5e3);return()=>clearTimeout(c)},[s]),!r)return null;const i=n(t?s?"Stopping wait…":"Stop waiting":s?"Moving to background…":"Move to background"),l=t?FW:oFe;return a.jsxs("button",{type:"button",disabled:s,title:i,className:"flex h-6 shrink-0 items-center gap-1 rounded-md px-1.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-60",onClick:()=>{o(!0),window.electronAPI.agent.backgroundTool(r,e).then(c=>{c.ok||o(!1)},()=>o(!1))},children:[a.jsx(l,{className:"h-3 w-3"}),i]})}const VMt=5e3,GMt=[];function WMt(e,t){if(e.status==="queued")return t("Queued");const n=e.activity;return n?.phase==="tool"?[n.tool,n.detail].filter(Boolean).join(" "):n?.phase==="writing"?t("Writing reply…"):t("Thinking…")}function qMt({agentIds:e}){const{t}=Se(),n=it(l=>Wa(l)?.id??""),r=jM(l=>l.byConversation[n]??GMt),[s,o]=y.useState(!1);if(y.useEffect(()=>{if(!n)return;let l=!0;const c=h=>{l&&(jM.getState().replace(n,h),o(!0))},u=()=>window.electronAPI.agent.subagentProgress(n).then(c,()=>{}),d=window.electronAPI.agent.onSubagentProgress(h=>{h.sessionId===n&&c(h.runs)});u();const f=setInterval(u,VMt);return()=>{l=!1,clearInterval(f),d()}},[n]),!s)return null;const i=e?.length?r.filter(l=>e.includes(l.agentId)):r;return a.jsxs("div",{className:"border-b border-border/60 px-3 py-2 text-xs",children:[i.length===0?a.jsx("div",{className:"text-muted-foreground",children:t("No running subagents")}):i.map(l=>a.jsxs("div",{className:"py-0.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"max-w-[40%] shrink-0 truncate font-medium",children:l.title??l.agentId.slice(0,8)}),a.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-muted-foreground",children:WMt(l,t)}),a.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:pl(l.elapsedMs)})]}),l.text&&a.jsx("div",{className:"line-clamp-2 break-words pl-2 text-[11px] text-muted-foreground/80",children:l.text.replace(/\s+/g," ")})]},l.runId)),a.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground/80",children:t("Stopping the wait does not stop subagents; the assistant is notified when they finish.")})]})}function p5e({itemKey:e,since:t}){const n=Ud(),r=it(c=>Wa(c)?.id??""),s=n?n.sessionId??"":r,o=y.useRef(null);if(o.current===null){const c=`${s}:${e}`;o.current=t??Ble.get(c)??Date.now(),t===void 0&&Ble.set(c,o.current)}const i=t??o.current,[,l]=y.useState(0);return y.useEffect(()=>{const c=setInterval(()=>l(u=>u+1),1e3);return()=>clearInterval(c)},[]),a.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:pl(Date.now()-i)})}function YMt({callId:e,startedAt:t,output:n}){const r=Ud(),s=it(o=>r?void 0:Wa(o)?.toolDeadlineAt?.[e]);return a.jsx(lRt,{startedAt:t,deadlineAt:s,output:n})}function Fle(e){return e.kind==="tool-group"?!0:e.kind==="tool"&&!e.todos?.length&&!e.name.startsWith("goal_")}const $Mt=e=>If(e.split(`
|
|
385
|
-
`,1)[0]??""),KMt=100;function XMt(e,t,n,r,s=KMt){if(r||!n)return{hiddenSince:t,delayMs:null};const o=t??e;return{hiddenSince:o,delayMs:Math.max(0,s-(e-o))}}const QMt=1e6;function ZMt(e,t,n=QMt){if(t.length===0)return{anchor:null,firstItemIndex:n,remount:!1};if(!e)return{anchor:{keys:t,index:n},firstItemIndex:n,remount:!1};const r=new Map(t.map((s,o)=>[s,o]));for(let s=0;s<e.keys.length;s++){const o=r.get(e.keys[s]);if(o===void 0)continue;const i=e.index+s-o;return{anchor:{keys:t,index:i},firstItemIndex:i,remount:!1}}return{anchor:{keys:t,index:n},firstItemIndex:n,remount:!0}}function zle(e,t){return t}const JMt=new Set(["text","thinking","tool","tool-group"]);function e6t(e,t,n,r){const s=y.useRef(rH),[o,i]=y.useState(()=>Date.now()),l=r.compact,c=r.autoCollapseCompletedTurns,u=r.collapseCompletedActivity===!0,d=r.collapseLiveActivity===!0,f=r.turnOverrides,h={compact:l,autoCollapseCompletedTurns:c,turnOverrides:f},p=d?irt(e,t,r,s.current,o):null;s.current=p?.witness??rH;const m=p?.wakeAt??null,v=hrt(e,t,n,{...h,collapseCompletedActivity:u,collapseLiveActivity:d,releasedLiveActivity:p?.released,heldOpenTools:r.heldOpenTools,foldToolOnlyTurns:r.foldToolOnlyTurns===!0,readableToolCards:r.readableToolCards===!0});return y.useEffect(()=>{if(m===null||m<=o)return;const b=window.setTimeout(()=>i(m),m-o);return()=>window.clearTimeout(b)},[m,o]),v}const t6t=[{icon:lze,title:"Map the project",hint:"Entry points, modules and key dependencies",prompt:"Walk me through this project's structure: entry points, module layout and key dependencies."},{icon:hxe,title:"Find potential issues",hint:"Suspicious logic and unhandled edge cases",prompt:"Review this project for potential bugs, suspicious logic and unhandled edge cases, and list them by severity."},{icon:NW,title:"Add unit tests",hint:"Cover the core modules with tests",prompt:"Find the core modules that lack tests and add unit tests for them."},{icon:Kp,title:"Summarize recent changes",hint:"A digest based on git log",prompt:"Summarize the recent changes in this repository based on git log."}],n6t=[{icon:Ixe,title:"Check today's progress",hint:"Progress report and items waiting on you",prompt:"Summarize today's progress and list anything waiting on me."},{icon:zy,title:"Assign a task",hint:"A one-off job for the secretary to run",prompt:"Take care of a one-off task: "},{icon:rx,title:"Organize the to-do list",hint:"Sort the board into clear next steps",prompt:"Go through the board and organize it into clear next steps."},{icon:wf,title:"Clean up merged branches",hint:"Remove branches that are already merged",prompt:"Clean up merged branches and worktrees you no longer need."}];function r6t({onPick:e,variant:t="project"}){const{t:n}=Se(),r=t==="secretary"?n6t:t6t;return a.jsx("div",{className:"mx-auto grid w-full max-w-[560px] grid-cols-1 gap-2.5 text-left @min-[36rem]:grid-cols-2",children:r.map(({icon:s,title:o,hint:i,prompt:l})=>a.jsxs("button",{type:"button",onClick:()=>e(n(l)),"data-slot":"welcome-suggestion",className:"group flex items-start gap-3 rounded-xl border bg-card px-3.5 py-3 text-left shadow-xs transition-[border-color,box-shadow,transform] duration-200 hover:-translate-y-px hover:border-brand/25 hover:shadow-float",children:[a.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg bg-brand/8 text-brand dark:bg-brand/14",children:a.jsx(s,{className:"size-3.5"})}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block text-[13px] font-medium",children:n(o)}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:n(i)})]})]},o))})}const Og="enso-chat-col mx-auto w-full max-w-2xl px-4 @min-[56rem]:max-w-3xl @min-[72rem]:max-w-4xl @min-[84rem]:max-w-5xl @min-[96rem]:max-w-6xl @min-[112rem]:max-w-7xl",Hle=1e3;function Ule({className:e,children:t}){const[n,r]=y.useState(!1);return y.useEffect(()=>{const s=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(s)},[]),a.jsx("div",{className:xe("t-stagger",n&&"is-shown",e),children:t})}const Vle=40,s6t={index:"LAST",align:"end"},o6t={top:600,bottom:600},i6t=e=>e&&!AK()?"auto":!1,a6t={owners:new Map,ends:new Map};function l6t(e){const t=new Map,n=new Map;let r=null,s=null;const o=()=>{r&&s&&n.set(s,r)};for(const i of e)i.kind==="user"?(o(),r=!i.collapsed&&i.canCollapse===!0?i.key:null,s=null,r&&t.set(i.key,r)):r&&(t.set(i.key,r),s=i.key);return o(),{owners:t,ends:n}}const c6t='input, textarea, select, [contenteditable=""], [contenteditable="true"]';function u6t({style:e,...t}){const n=e?.visibility==="hidden",[r,s]=y.useState(!1),o=y.useRef(null);return y.useEffect(()=>{const i=XMt(Date.now(),o.current,n,r);if(o.current=i.hiddenSince,i.delayMs===null)return;const l=window.setTimeout(()=>s(!0),i.delayMs);return()=>window.clearTimeout(l)},[n,r]),a.jsx("div",{...t,style:n&&r?{...e,visibility:"visible"}:e})}function OK({ref:e,items:t,busy:n,loading:r=!1,running:s,runStartedAt:o,lastOutputAt:i,error:l,emptyTitle:c,emptyDescription:u,onSuggestion:d,emptyVariant:f,onRetryResume:h,onRetrySync:p,virtualize:m=!0,onStartReached:v,historyLoading:b=!1,hasOlder:x,olderCursor:S,searchQuery:k="",activeHit:C=null,secretarySession:A=!1,secretaryFace:N,conversationId:j,quotable:I=!1}){const{t:_}=Se(),L=Ud(),M=xNe(j),F=A?N??M:null,D=!L&&F?F:null,R=A,z=y.useRef(null),[B,H]=y.useState(!0),[G,te]=y.useState(!1),W=y.useRef(!0),T=y.useRef(null),U=y.useRef(null),P=y.useRef(0),K=y.useRef(0),J=y.useRef(null),ee=y.useRef(!1),X=y.useRef(!1),ne=y.useRef(0),Q=y.useRef(!1),[oe,de]=y.useState(null),ie=y.useRef(0),ue=y.useCallback(ze=>{cancelAnimationFrame(ie.current),ie.current=requestAnimationFrame(()=>de(ze()))},[]);y.useEffect(()=>()=>cancelAnimationFrame(ie.current),[]);const[ve,ge]=y.useState(new Set),Te=y.useRef(new Set),[De,Me]=y.useState(()=>new Set),Fe=y.useCallback((ze,We)=>{const lt=Te.current;We!==lt.has(ze)&&(We?lt.add(ze):lt.delete(ze),Me(new Set(lt)))},[]),He=y.useRef({report:Fe,scroller:T});He.current.report=Fe;const tt=y.useCallback(ze=>{ge(We=>{const lt=new Set(We);return lt.has(ze)?lt.delete(ze):lt.add(ze),lt})},[]),[$e,Ue]=y.useState(new Map),Pe=be(ze=>ze.autoCollapseTurns),we=be(ze=>ze.collapseCompletedActivity),ye=be(ze=>ze.collapseLiveActivity),Re=be(ze=>ze.liveActivityFoldDelaySec),_e=be(ze=>ze.compactReadOnlyTools),Ve=e6t(t,s,ve,{compact:_e,autoCollapseCompletedTurns:Pe,collapseCompletedActivity:we,collapseLiveActivity:ye,liveActivityFoldDelaySec:Re,heldOpenTools:De,turnOverrides:$e,foldToolOnlyTurns:!L&&R,readableToolCards:R}),he=y.useRef({state:$5t,collapse:new Map,reveal:new Map}),Ye=y.useMemo(()=>{const ze=he.current,We=Bt=>T.current?.querySelector(`[data-nav-key="${CSS.escape(Bt)}"]`),lt=K5t(ze.state,Ve,(Bt,Qt)=>{const dn=We(Bt)?.getBoundingClientRect().top,mn=We(Qt)?.getBoundingClientRect().bottom;return dn===void 0||mn===void 0?0:mn-dn}),yt=Date.now();ze.state=lt.next;for(const{key:Bt,...Qt}of lt.collapses)ze.collapse.set(Bt,{at:yt,...Qt});for(const Bt of lt.expands)ze.reveal.set(Bt,yt);return lt.children},[Ve]),Le=y.useRef(null),Ne=y.useRef(0),Ge=y.useRef(null),ft=ZMt(Le.current,Ve.map(ze=>ze.key));Le.current=ft.anchor,ft.remount&&(Ne.current+=1,Ge.current=null);const Ze=ft.firstItemIndex,je=y.useCallback((ze,We)=>{Ue(lt=>lt.get(ze)===We?lt:new Map(lt).set(ze,We))},[]),Je=y.useMemo(()=>Pe?l6t(Ve):a6t,[Pe,Ve]),st=y.useRef(null),gt=y.useMemo(()=>{const ze=[];for(let We=0;We<t.length;We++){const lt=t[We];if(lt.kind!=="user")continue;let yt="";for(let Bt=We+1;Bt<t.length;Bt++){const Qt=t[Bt];if(Qt.kind==="user")break;if(Qt.kind==="text"){yt=Qt.text;break}}ze.push({key:lt.key,question:fq(lt.text)||"[image]",answer:yt})}return ze},[t]),ut=y.useCallback(()=>{const ze=T.current;ze&&ze.scrollHeight-ze.scrollTop-ze.clientHeight>2&&(ee.current=!0,ze.scrollTop=ze.scrollHeight)},[]),pt=y.useCallback(()=>{cancelAnimationFrame(P.current);const ze=Date.now()+1200;let We=null;const lt=()=>{cancelAnimationFrame(P.current),ee.current=!1,We?.removeEventListener("touchstart",lt),We?.removeEventListener("wheel",lt)},yt=()=>{if(X.current){lt();return}!We&&T.current&&(We=T.current,We.addEventListener("touchstart",lt,{passive:!0,once:!0}),We.addEventListener("wheel",lt,{passive:!0,once:!0})),ut(),W.current=!0,H(!0),Date.now()<ze?P.current=requestAnimationFrame(yt):lt()};yt(),H(!0),W.current=!0},[ut]);y.useEffect(()=>()=>{cancelAnimationFrame(P.current),cancelAnimationFrame(K.current),window.clearTimeout(ne.current)},[]),y.useEffect(()=>TK.subscribe(({active:ze},We)=>{if(ze===We.active)return;if(ze){cancelAnimationFrame(P.current),cancelAnimationFrame(K.current),ee.current=!1;return}const lt=Q.current;Q.current=!1,lt&&W.current&&!X.current&&ut()}),[ut]);const It=()=>{X.current=!0,window.clearTimeout(ne.current)},kt=()=>{window.clearTimeout(ne.current),ne.current=window.setTimeout(()=>{X.current=!1},400)},ln=()=>{It(),kt()},qt=()=>[...T.current?.querySelectorAll("[data-nav-key]")??[]],Jt=ze=>{ln(),st.current=ze,je(ze,!0)},cn=ze=>{if(ze.key!=="Escape"||ze.defaultPrevented||Je.owners.size===0)return;const We=T.current,lt=ze.target;if(!We?.contains(lt)||lt.closest?.(c6t)||I2e()||document.querySelector('[role="dialog"], [role="alertdialog"]'))return;const yt=We.getBoundingClientRect();for(const Bt of qt()){const Qt=Je.owners.get(Bt.getAttribute("data-nav-key")??"");if(!Qt)continue;const dn=Bt.getBoundingClientRect();if(dn.bottom<=yt.top||dn.top>=yt.bottom)continue;const mn=ze.nativeEvent;window.addEventListener("keydown",Zt=>{Zt!==mn||Zt.defaultPrevented||(Zt.preventDefault(),Jt(Qt))},{once:!0});return}},hn=()=>{cancelAnimationFrame(P.current),cancelAnimationFrame(K.current),ee.current=!1,W.current=!1,H(!1)},St=y.useCallback(ze=>{if(J.current?.disconnect(),J.current=null,!ze)return;const We=new ResizeObserver(()=>{if(!W.current&&!ee.current)return;cancelAnimationFrame(K.current);let lt=8;const yt=()=>{ut();const Bt=T.current;(Bt?Bt.scrollHeight-Bt.scrollTop-Bt.clientHeight:0)<=2||(--lt>0?K.current=requestAnimationFrame(yt):pt())};yt()});We.observe(ze),J.current=We,pt()},[ut,pt]);y.useEffect(()=>()=>J.current?.disconnect(),[]);const wt=ze=>Ve.findIndex(We=>We.key===ze||We.kind==="tool-group"&&m5e(We,ze)),Dt=ze=>{if(!m){T.current?.querySelector(`[data-nav-key="${CSS.escape(ze)}"]`)?.scrollIntoView({block:"center"});return}const We=wt(ze);We>=0&&z.current?.scrollToIndex({index:zle(Ze,We),align:"center"})},fe=y.useRef(null),Ie=ze=>{if(hn(),wt(ze)>=0){fe.current=null,Dt(ze);return}let We=null,lt=!1;for(const yt of t)if(yt.kind==="user"&&(We=yt.key),yt.key===ze){lt=!0;break}!lt||!We||(fe.current=ze,je(We,!1))};y.useLayoutEffect(()=>{const ze=fe.current;!ze||wt(ze)<0||(fe.current=null,Dt(ze))},[Ve]),y.useLayoutEffect(()=>{const ze=st.current;if(!ze)return;st.current=null;const We=qt().find(yt=>yt.getAttribute("data-nav-key")===ze);if(We){h5e(We,T.current);return}const lt=Ve.findIndex(yt=>yt.key===ze);m&<>=0&&z.current?.scrollToIndex({index:zle(Ze,lt),align:"start"})},[Ve]),y.useImperativeHandle(e,()=>({scrollToBottom:pt,pinToBottom:ut,isAtBottom:()=>W.current,getScroller:()=>m?null:T.current,scrollToKey:Ie}));const Ae=y.useRef(!1),ce=`${S}:${Ze}`,Oe=y.useRef(ce);Oe.current!==ce&&(Oe.current=ce,Ae.current=!1);const dt=()=>{!v||Ae.current||(Ae.current=!0,v())};y.useEffect(()=>{m&&!b&&Ge.current===Ze&&dt()},[S,b]);const vt=y.useMemo(()=>({query:k,activeKey:C?.key??"",activeNth:C?.nth??-1}),[k,C?.key,C?.nth]),Et=(ze,We)=>{const lt=Ve[We+1];if(lt!==void 0&&Fle(ze)&&Fle(lt))return"pb-0";if(!_e)return"pb-4";const yt=lt!==void 0&&_le(lt);return _le(ze)?yt?"pb-1":"pb-2":ze.kind==="text"&&yt?"pb-1":"pb-4"},Ct=(ze,We)=>{const lt=Ve[We-1],yt=lt?.kind==="user"&&!lt.collapsed&&JMt.has(ze.kind)?lt:void 0,Bt=Date.now(),Qt=he.current.collapse.get(ze.key),dn=Qt&&Bt-Qt.at<Hle?Qt:void 0,mn=Ye.get(ze.key),Zt=mn&&he.current.reveal.get(mn.group),An=mn&&Zt!==void 0&&Bt-Zt<Hle,bn=Je.ends.get(ze.key);return a.jsxs("div",{"data-nav-key":ze.key,"data-fold-collapse":dn?dn.pair?"pair":"toggle":void 0,style:dn?{"--fold-from":`${dn.height}px`}:An?{"--fold-i":mn.index}:void 0,className:xe(Og,Et(ze,We),An&&"t-fold-reveal","[overflow-wrap:anywhere]"),children:[yt&&a.jsx(cMt,{model:yt.replyModel,at:yt.replyAt,privacyMask:yt.replyPrivacyMask,secretarySession:R,face:F,conversationId:j}),a.jsx(g6t,{itemKey:ze.key,children:a.jsx(uMt,{item:ze,secretarySession:R,onToggleGroup:tt,onToggleTurn:je})}),bn&&a.jsx(TMt,{turnKey:bn,canCollapse:!0,collapsed:!1,onToggleTurn:Jt})]},ze.key)},xn=y.useRef(!1);x===!0&&(xn.current=!0);const yn=ant(t.length>0,b,x,xn.current,!m&&G);y.useLayoutEffect(()=>{if(m){te(!1);return}const ze=T.current;te(!!ze&&lnt(x===!0,b,ze.scrollHeight,ze.clientHeight))},[m,x,b,Ze,Ve.length,t.length]);const er={pageChrome:yn,onLoadMore:yn==="more"?dt:void 0,busy:n,loading:!!r,since:X5t({loading:!!r,runStartedAt:o}),error:l,onRetryResume:h};return a.jsx(KTe.Provider,{value:vt,children:a.jsx(FRt,{value:He.current,children:a.jsxs("div",{ref:U,"data-enso":"timeline",className:"@container relative min-h-24 flex-1",onWheel:ln,onKeyDown:ze=>{ln(),cn(ze)},onTouchStart:ze=>{T.current?.contains(ze.target)&&It()},onTouchEnd:kt,onPointerDown:ze=>{ze.target===T.current&&(It(),window.addEventListener("pointerup",kt,{once:!0}))},children:[a.jsx(J5t,{items:gt,activeKey:oe,onJump:Ie}),I&&a.jsx(lIt,{containerRef:U}),t.length===0&&!n?a.jsxs(Ule,{className:"flex h-full flex-col items-center justify-center gap-2 overflow-y-auto px-4 text-center",children:[a.jsx("span",{className:"t-stagger-line t-stagger-line--1 mb-3",children:D?a.jsx(KN,{name:D.name,color:D.color,image:D.image,needsYou:0,running:0,size:"lg",enso:"secretary-chat-avatar"}):a.jsx("span",{className:"flex size-11 items-center justify-center rounded-[13px] border border-brand/20 bg-brand/8 text-brand dark:bg-brand/14",children:a.jsx(Y5t,{className:"size-6"})})}),a.jsx("p",{className:"t-stagger-line t-stagger-line--1 text-[22px] font-semibold tracking-tight",children:c}),l?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"t-stagger-line t-stagger-line--2 max-w-md text-sm text-destructive whitespace-pre-wrap",children:_(l)}),h&&a.jsx(Ke,{size:"sm",variant:"outline",onClick:h,children:_("Retry resume")})]}):a.jsxs(a.Fragment,{children:[p?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"t-stagger-line t-stagger-line--2 max-w-md text-sm text-muted-foreground",children:_("Session is not ready yet — no history to show.")}),a.jsx(Ke,{size:"sm",variant:"outline",onClick:p,children:_("Retry sync")})]}):u!==""?a.jsx("p",{className:"t-stagger-line t-stagger-line--2 text-sm text-muted-foreground",children:u??_(f==="secretary"?"Tell the secretary what to take care of…":"Ask the agent…")}):null,d&&a.jsx("div",{className:"t-stagger-line t-stagger-line--3 mt-5 w-full",children:a.jsx(r6t,{onPick:d,variant:f})})]})]}):t.length===0&&l?a.jsxs(Ule,{className:"flex h-full flex-col items-center justify-center gap-2 text-center",children:[a.jsx("p",{className:"t-stagger-line t-stagger-line--1 max-w-md text-sm text-destructive whitespace-pre-wrap",children:_(l)}),h&&a.jsx(Ke,{size:"sm",variant:"outline",onClick:h,children:_("Retry resume")})]}):t.length===0?a.jsxs("div",{"data-timeline-loading":"",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[a.jsx(Jn,{className:"h-5 w-5 animate-spin text-muted-foreground"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:_("Preparing session…")})]}):m?a.jsx(N5t,{ref:z,data:Ve,defaultItemHeight:80,computeItemKey:(ze,We)=>We.key,firstItemIndex:Ze,startReached:dt,followOutput:i6t,atBottomThreshold:Vle,atBottomStateChange:ze=>{if(!ze&&W.current&&!X.current){if(AK()){Q.current=!0;return}pt();return}H(ze),W.current=ze},increaseViewportBy:o6t,initialTopMostItemIndex:s6t,rangeChanged:({startIndex:ze})=>{Ge.current=ze,ze>Ze+4&&(Ae.current=!1),ue(()=>{const We=Math.max(0,ze-Ze);let lt=null;for(let yt=0;yt<=Math.min(We+1,Ve.length-1);yt++)Ve[yt]?.kind==="user"&&(lt=Ve[yt].key);return lt})},scrollerRef:ze=>{T.current=ze instanceof HTMLElement?ze:null},className:"h-full select-text",context:er,components:f6t,itemContent:(ze,We)=>Ct(We,ze-Ze)},Ne.current):a.jsx("div",{ref:ze=>{T.current=ze},onScroll:ze=>{const We=ze.currentTarget;if(ee.current){ee.current=!1,W.current=!0,H(!0);return}if(!X.current){W.current&&ut();return}const lt=We.scrollHeight-We.scrollTop-We.clientHeight<=Vle;lt!==W.current&&(W.current=lt,H(lt)),v&&(We.scrollTop<80&&!Ae.current?(Ae.current=!0,v()):We.scrollTop>240&&(Ae.current=!1))},className:"h-full select-text overflow-y-auto [overflow-anchor:none]",children:a.jsxs("div",{ref:St,children:[a.jsx(g5e,{context:er}),Ve.map((ze,We)=>Ct(ze,We)),a.jsx(v5e,{context:er})]})}),!B&&t.length>0&&a.jsxs("button",{type:"button",onClick:pt,className:"absolute bottom-4 left-1/2 z-10 inline-flex h-7 -translate-x-1/2 items-center gap-1.5 rounded-full border bg-card px-3 text-xs text-muted-foreground shadow-float transition-colors hover:text-foreground",children:[a.jsx(Y4,{className:"h-3 w-3"}),_("Scroll to bottom")]})]})})})}function m5e(e,t){return e.children.some(n=>n.key===t||n.kind==="tool-group"&&m5e(n,t))}function d6t({chrome:e,onLoadMore:t}){const{t:n}=Se();return e==="none"?a.jsx("div",{className:"h-6"}):a.jsx("div",{className:xe(Og,"flex items-center justify-center gap-2 py-3"),children:e==="loading"?a.jsxs(a.Fragment,{children:[a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:n("Loading earlier messages…")})]}):e==="more"?a.jsx("button",{type:"button",className:"text-xs text-muted-foreground underline-offset-2 hover:underline",onClick:t,children:n("Load earlier messages")}):a.jsx("p",{className:"text-xs text-muted-foreground",children:n("Beginning of conversation")})})}function g5e({context:e}){return a.jsx(d6t,{chrome:e.pageChrome,onLoadMore:e.onLoadMore})}function v5e({context:e}){const{t}=Se(),{busy:n,loading:r,since:s,error:o,onRetryResume:i}=e;return a.jsxs("div",{className:xe(Og,"pb-6 [overflow-wrap:anywhere]"),children:[n&&a.jsxs("div",{className:"flex min-h-[26px] items-center gap-2 text-[13px]",children:[a.jsx(h6t,{}),a.jsx("span",{className:"animate-pulse text-foreground motion-reduce:animate-none",children:t(r?"Loading…":"Working…")}),s!==void 0&&a.jsx(m6t,{since:s})]}),o&&a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("p",{className:"min-w-0 flex-1 text-sm text-destructive whitespace-pre-wrap",children:t(o)}),a.jsx(u5e,{}),i&&a.jsx(Ke,{size:"sm",variant:"outline",onClick:i,children:t("Retry resume")})]})]})}const f6t={List:u6t,Header:g5e,Footer:v5e};function h6t(){return a.jsxs("span",{className:"relative flex size-[22px] shrink-0 items-center justify-center",children:[a.jsx("span",{className:"absolute size-2 animate-ping rounded-full bg-brand/50"}),a.jsx("span",{className:"relative size-2 rounded-full bg-brand"})]})}const p6t=e=>{const t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60}s`},m6t=y.memo(function({since:t}){const[,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>n(s=>s+1),1e3);return()=>clearInterval(r)},[]),a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground tabular-nums",children:p6t(Date.now()-t)})});class g6t extends y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidUpdate(t){t.itemKey!==this.props.itemKey&&this.state.failed&&this.setState({failed:!1})}render(){return this.state.failed?a.jsxs("p",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-1.5 text-xs text-destructive",children:["message render failed · ",this.props.itemKey]}):this.props.children}}const tk={type:"spring",stiffness:400,damping:30},U6={type:"tween",duration:.22,ease:[.2,0,0,1]},h9={initial:{height:0,opacity:0},animate:{height:"auto",opacity:1,transition:U6},exit:{height:0,opacity:0,transition:U6}};function ocn(e){return e.resizing?!0:e.previousConversationId!==void 0&&e.conversationId!==void 0&&e.previousConversationId!==e.conversationId}function v6t(e){return e.skip?{duration:0}:e.cover||e.targetW===0?U6:tk}const x6t={ts:hw,tsx:hw,js:hw,jsx:hw,mjs:hw,json:X4,html:sze,css:pz,scss:pz,md:$p,sh:wT,bash:wT,yml:Md,yaml:Md,toml:Md},b6t={ts:"text-blue-500",tsx:"text-blue-500",js:"text-yellow-500",jsx:"text-yellow-500",mjs:"text-yellow-500",json:"text-yellow-600",html:"text-orange-500",css:"text-pink-500",scss:"text-pink-500",md:"text-sky-500",sh:"text-muted-foreground"};function y6t(e,t,n=!1){if(t)return n?Yu:Q4;const r=e.split(".").pop()?.toLowerCase()??"";return x6t[r]??Oze}function w6t(e,t){if(t)return"text-amber-500";const n=e.split(".").pop()?.toLowerCase()??"";return b6t[n]??"text-muted-foreground"}const k6t=y.lazy(()=>Be(()=>import("./ReadFileView-uORu2Gdg.js"),[],import.meta.url).then(e=>({default:e.ReadFileView}))),S6t={artifacts:[],media:[]},p9=new Map,m9=new Map,C6t=new Set(["image","markdown","html","text"]),E6t=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function T6t(e){const t=JSON.stringify(e),[n,r]=y.useState(()=>p9.get(t)??S6t);return y.useEffect(()=>{if(p9.has(t))return;let s=!0;return window.electronAPI.bots.artifacts.list(JSON.parse(t)).then(o=>{if(!s||!o.ok)return;const i={artifacts:o.artifacts,media:o.media??[]};(i.artifacts.length>0||i.media.length>0)&&p9.set(t,i),r(i)}).catch(()=>{}),()=>{s=!1}},[t]),n}function A6t(e){const{t}=Se();return(n,r)=>{window.electronAPI.bots.artifacts.open({...e,rel:n.rel,action:r}).then(s=>{s.ok||Ht({type:"error",title:s.error==="not-openable"?t("This file type is only shown in Finder"):t("Could not open the file")})})}}function V6({target:e}){const{artifacts:t,media:n}=T6t(e);return a.jsxs(a.Fragment,{children:[n.length>0&&a.jsx(I6t,{target:e,media:n}),t.length>0&&a.jsx(M6t,{target:e,artifacts:t})]})}function N6t(){const{t:e}=Se();return({source:t,name:n})=>t==="upload"?"":t==="web"?e("Web screenshot"):t==="desktop"?e("Desktop screenshot"):n&&/^(?:\/|[A-Za-z]:[\\/])/.test(n)?e("This computer"):e("Workspace image")}function x5e(e,t,n){const r=JSON.stringify(e),s=t&&n==="thumb"?m9.get(t):void 0,[o,i]=y.useState(s?{ok:!0,kind:"image",dataUrl:s}:null);return y.useEffect(()=>{const l=t&&n==="thumb"?m9.get(t):void 0;if(i(l?{ok:!0,kind:"image",dataUrl:l}:null),!t||l)return;let c=!0;return window.electronAPI.bots.artifacts.read({...JSON.parse(r),mediaId:t,variant:n}).then(u=>{n==="thumb"&&u.ok&&u.kind==="image"&&m9.set(t,u.dataUrl),c&&i(u)}).catch(()=>c&&i({ok:!1,error:"unavailable"})),()=>{c=!1}},[r,t,n]),o}function I6t({target:e,media:t}){const{t:n}=Se(),r=N6t(),[s,o]=y.useState(null),i=t.some(l=>l.ok&&l.source==="desktop");return a.jsxs("div",{className:"mt-2","data-bot-media":"",children:[a.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map((l,c)=>l.ok?a.jsx(j6t,{target:e,item:l,label:r(l),onOpen:()=>o(l)},l.mediaId):a.jsxs("div",{className:"flex w-40 flex-col gap-1 rounded-lg border border-destructive/60 border-dashed p-2 text-destructive text-xs",children:[a.jsxs("span",{className:"flex items-center gap-1 font-medium",children:[a.jsx(sM,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"truncate",children:l.name??r(l)})]}),a.jsx("span",{children:l.error==="quota"?n("Chat image storage is full (200 MiB); not saved"):n("Not sent: still over 10 MiB after compression")})]},`failed-${c}`))}),i&&a.jsx("p",{className:"mt-1 text-warning text-xs",children:n("Desktop screenshots may capture sensitive content from other windows.")}),a.jsx(R6t,{target:e,item:s,label:s?r(s):"",onClose:()=>o(null)})]})}function j6t({target:e,item:t,label:n,onOpen:r}){const s=x5e(e,t.mediaId,"thumb"),o=t.caption??t.name??n;return a.jsxs("button",{type:"button",title:o,onClick:r,className:"relative h-24 w-36 overflow-hidden rounded-lg border bg-muted",children:[s?.ok&&s.kind==="image"?a.jsx("img",{src:s.dataUrl,alt:o,className:"h-full w-full object-cover"}):s?a.jsx(sM,{className:"m-auto h-4 w-4 text-muted-foreground"}):a.jsx(Jn,{className:"m-auto h-4 w-4 animate-spin text-muted-foreground"}),n&&a.jsx("span",{className:xe("absolute top-1 left-1 rounded px-1 text-[10px] leading-4",t.source==="desktop"?"bg-warning text-warning-foreground":"bg-black/60 text-white"),children:n}),(t.caption||t.name)&&a.jsx("span",{className:"absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/70 to-transparent px-1.5 pt-3 pb-0.5 text-left text-[10px] text-white",children:t.caption??t.name})]})}function R6t({target:e,item:t,label:n,onClose:r}){const{t:s}=Se(),o=x5e(e,t?.mediaId??null,"full"),i=t?.caption??t?.name??n;return a.jsx(gr,{open:t!==null,onOpenChange:l=>!l&&r(),children:a.jsxs(vr,{className:"flex h-[80vh] max-w-4xl flex-col",children:[a.jsx(xr,{children:a.jsxs(dr,{className:"flex min-w-0 items-center gap-2 pr-8",children:[a.jsx("span",{className:"truncate",children:i}),a.jsx("span",{className:"shrink-0 font-normal text-muted-foreground text-xs",children:n})]})}),t?.source==="desktop"&&a.jsx("p",{className:"text-warning text-xs",children:s("Desktop screenshots may capture sensitive content from other windows.")}),t?.source==="file"&&a.jsx("p",{className:"text-muted-foreground text-xs",children:s("Copied into this chat: later edits or deletion of the original do not change it. Deleted together with the chat.")}),a.jsx(b5e,{name:i,content:o})]})})}function M6t({target:e,artifacts:t}){const{t:n}=Se(),r=A6t(e),[s,o]=y.useState(null);return a.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5","data-bot-artifacts":"",children:[t.map(i=>{const l=y6t(i.name,!1),c=C6t.has(i.kind)||i.kind==="pdf";return a.jsxs("div",{"data-slot":"bot-card",className:"group/artifact flex max-w-64 items-center gap-1 rounded-lg border bg-card py-1 pr-1 pl-2 text-xs",children:[a.jsxs("button",{type:"button",title:i.rel,disabled:!c,onClick:()=>i.kind==="pdf"?r(i,"preview"):o(i),className:"flex min-w-0 items-center gap-1.5 text-left enabled:hover:underline disabled:cursor-default",children:[a.jsx(l,{className:xe("h-3.5 w-3.5 shrink-0",w6t(i.name,!1))}),a.jsx("span",{className:"truncate",children:i.name}),a.jsx("span",{className:"shrink-0 text-muted-foreground",children:E6t(i.size)})]}),a.jsx("button",{type:"button",title:n("Show in Finder"),onClick:()=>r(i,"reveal"),className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(Yu,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",title:n("Open with default app"),onClick:()=>r(i,"open"),className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(dy,{className:"h-3.5 w-3.5"})})]},i.rel)}),a.jsx(_6t,{target:e,artifact:s,onOpen:r,onClose:()=>o(null)})]})}function _6t({target:e,artifact:t,onOpen:n,onClose:r}){const{t:s}=Se(),[o,i]=y.useState(null),l=t?.rel,c=JSON.stringify(e);return y.useEffect(()=>{if(i(null),!l)return;let u=!0;return window.electronAPI.bots.artifacts.read({...JSON.parse(c),rel:l}).then(d=>u&&i(d)).catch(()=>u&&i({ok:!1,error:"unavailable"})),()=>{u=!1}},[c,l]),a.jsx(gr,{open:t!==null,onOpenChange:u=>!u&&r(),children:a.jsxs(vr,{className:"flex h-[80vh] max-w-4xl flex-col",children:[a.jsx(xr,{children:a.jsxs(dr,{className:"flex min-w-0 items-center gap-2 pr-8",children:[a.jsx("span",{className:"truncate",children:t?.name}),a.jsx("span",{className:"truncate font-normal text-muted-foreground text-xs",children:t?.rel}),a.jsx("span",{className:"flex-1"}),t&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",title:s("Show in Finder"),onClick:()=>n(t,"reveal"),className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(Yu,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",title:s("Open with default app"),onClick:()=>n(t,"open"),className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(dy,{className:"h-4 w-4"})})]})]})}),a.jsx(b5e,{name:t?.name??"",content:o})]})})}function b5e({name:e,content:t}){const{t:n}=Se();return a.jsxs("div",{className:"min-h-0 flex-1 select-text overflow-auto border-t","data-bot-artifact-preview":"",children:[!t&&a.jsx("div",{className:"flex justify-center p-6 text-muted-foreground",children:a.jsx(Jn,{className:"h-4 w-4 animate-spin"})}),t&&!t.ok&&a.jsx("p",{className:"p-6 text-muted-foreground text-sm",children:t.error==="too-large"?n("The file is too large to preview"):n("Could not open the file")}),t?.ok&&t.kind==="image"&&a.jsx("img",{src:t.dataUrl,alt:e,className:"mx-auto max-h-full max-w-full object-contain p-4"}),t?.ok&&t.kind==="markdown"&&a.jsx("div",{className:"px-6 py-4 text-sm",children:a.jsx(ua,{text:t.text})}),t?.ok&&t.kind==="html"&&a.jsx("iframe",{title:e,sandbox:"",srcDoc:t.text,className:"h-full w-full bg-white"}),t?.ok&&t.kind==="text"&&a.jsx("div",{className:"p-2 text-xs",children:a.jsx(y.Suspense,{fallback:null,children:a.jsx(k6t,{path:e,contents:t.text})})})]})}var fb={},uC={};var Gle;function P6t(){if(Gle)return uC;Gle=1;var e=Dy(),t=L4();function n(q){var $="https://react.dev/errors/"+q;if(1<arguments.length){$+="?args[]="+encodeURIComponent(arguments[1]);for(var ae=2;ae<arguments.length;ae++)$+="&args[]="+encodeURIComponent(arguments[ae])}return"Minified React error #"+q+"; visit "+$+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.scope"),b=Symbol.for("react.activity"),x=Symbol.for("react.legacy_hidden"),S=Symbol.for("react.memo_cache_sentinel"),k=Symbol.for("react.view_transition"),C=Symbol.iterator;function A(q){return q===null||typeof q!="object"?null:(q=C&&q[C]||q["@@iterator"],typeof q=="function"?q:null)}var N=Array.isArray;function j(q,$){var ae=q.length&3,me=q.length-ae,Ee=$;for($=0;$<me;){var et=q.charCodeAt($)&255|(q.charCodeAt(++$)&255)<<8|(q.charCodeAt(++$)&255)<<16|(q.charCodeAt(++$)&255)<<24;++$,et=3432918353*(et&65535)+((3432918353*(et>>>16)&65535)<<16)&4294967295,et=et<<15|et>>>17,et=461845907*(et&65535)+((461845907*(et>>>16)&65535)<<16)&4294967295,Ee^=et,Ee=Ee<<13|Ee>>>19,Ee=5*(Ee&65535)+((5*(Ee>>>16)&65535)<<16)&4294967295,Ee=(Ee&65535)+27492+(((Ee>>>16)+58964&65535)<<16)}switch(et=0,ae){case 3:et^=(q.charCodeAt($+2)&255)<<16;case 2:et^=(q.charCodeAt($+1)&255)<<8;case 1:et^=q.charCodeAt($)&255,et=3432918353*(et&65535)+((3432918353*(et>>>16)&65535)<<16)&4294967295,et=et<<15|et>>>17,Ee^=461845907*(et&65535)+((461845907*(et>>>16)&65535)<<16)&4294967295}return Ee^=q.length,Ee^=Ee>>>16,Ee=2246822507*(Ee&65535)+((2246822507*(Ee>>>16)&65535)<<16)&4294967295,Ee^=Ee>>>13,Ee=3266489909*(Ee&65535)+((3266489909*(Ee>>>16)&65535)<<16)&4294967295,(Ee^Ee>>>16)>>>0}var I=Object.assign,_=Object.prototype.hasOwnProperty,L=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),M={},F={};function D(q){return _.call(F,q)?!0:_.call(M,q)?!1:L.test(q)?F[q]=!0:(M[q]=!0,!1)}var R=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" ")),z=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),B=/["'&<>]/;function H(q){if(typeof q=="boolean"||typeof q=="number"||typeof q=="bigint")return""+q;q=""+q;var $=B.exec(q);if($){var ae="",me,Ee=0;for(me=$.index;me<q.length;me++){switch(q.charCodeAt(me)){case 34:$=""";break;case 38:$="&";break;case 39:$="'";break;case 60:$="<";break;case 62:$=">";break;default:continue}Ee!==me&&(ae+=q.slice(Ee,me)),Ee=me+1,ae+=$}q=Ee!==me?ae+q.slice(Ee,me):ae}return q}var G=/([A-Z])/g,te=/^ms-/,W=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function T(q){return W.test(""+q)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":q}var U=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},J=P.d;P.d={f:J.f,r:J.r,D:lt,C:yt,L:Bt,m:Qt,X:mn,S:dn,M:Zt};var ee=[],X=null,ne=/(<\/|<)(s)(cript)/gi;function Q(q,$,ae,me){return""+$+(ae==="s"?"\\u0073":"\\u0053")+me}function oe(q,$,ae,me,Ee){return{idPrefix:q===void 0?"":q,nextFormID:0,streamingFormat:0,bootstrapScriptContent:ae,bootstrapScripts:me,bootstrapModules:Ee,instructions:0,hasBody:!1,hasHtml:!1,unknownResources:{},dnsResources:{},connectResources:{default:{},anonymous:{},credentials:{}},imageResources:{},styleResources:{},scriptResources:{},moduleUnknownResources:{},moduleScriptResources:{}}}function de(q,$,ae,me){return{insertionMode:q,selectedValue:$,tagScope:ae,viewTransition:me}}function ie(q,$,ae){var me=q.tagScope&-25;switch($){case"noscript":return de(2,null,me|1,null);case"select":return de(2,ae.value!=null?ae.value:ae.defaultValue,me,null);case"svg":return de(4,null,me,null);case"picture":return de(2,null,me|2,null);case"math":return de(5,null,me,null);case"foreignObject":return de(2,null,me,null);case"table":return de(6,null,me,null);case"thead":case"tbody":case"tfoot":return de(7,null,me,null);case"colgroup":return de(9,null,me,null);case"tr":return de(8,null,me,null);case"head":if(2>q.insertionMode)return de(3,null,me,null);break;case"html":if(q.insertionMode===0)return de(1,null,me,null)}return 6<=q.insertionMode||2>q.insertionMode?de(2,null,me,null):q.tagScope!==me?de(q.insertionMode,q.selectedValue,me,null):q}function ue(q){return q===null?null:{update:q.update,enter:"none",exit:"none",share:q.update,name:q.autoName,autoName:q.autoName,nameIdx:0}}function ve(q,$){return $.tagScope&32&&(q.instructions|=128),de($.insertionMode,$.selectedValue,$.tagScope|12,ue($.viewTransition))}function ge(q,$){q=ue($.viewTransition);var ae=$.tagScope|16;return q!==null&&q.share!=="none"&&(ae|=64),de($.insertionMode,$.selectedValue,ae,q)}var Te=new Map;function De(q,$){if(typeof $!="object")throw Error(n(62));var ae=!0,me;for(me in $)if(_.call($,me)){var Ee=$[me];if(Ee!=null&&typeof Ee!="boolean"&&Ee!==""){if(me.indexOf("--")===0){var et=H(me);Ee=H((""+Ee).trim())}else et=Te.get(me),et===void 0&&(et=H(me.replace(G,"-$1").toLowerCase().replace(te,"-ms-")),Te.set(me,et)),Ee=typeof Ee=="number"?Ee===0||R.has(me)?""+Ee:Ee+"px":H((""+Ee).trim());ae?(ae=!1,q.push(' style="',et,":",Ee)):q.push(";",et,":",Ee)}}ae||q.push('"')}function Me(q,$,ae){ae&&typeof ae!="function"&&typeof ae!="symbol"&&q.push(" ",$,'=""')}function Fe(q,$,ae){typeof ae!="function"&&typeof ae!="symbol"&&typeof ae!="boolean"&&q.push(" ",$,'="',H(ae),'"')}var He=H("javascript:throw new Error('React form unexpectedly submitted.')");function tt(q,$){this.push('<input type="hidden"'),$e(q),Fe(this,"name",$),Fe(this,"value",q),this.push("/>")}function $e(q){if(typeof q!="string")throw Error(n(480))}function Ue(q,$){if(typeof $.$$FORM_ACTION=="function"){var ae=q.nextFormID++;q=q.idPrefix+ae;try{var me=$.$$FORM_ACTION(q);if(me){var Ee=me.data;Ee?.forEach($e)}return me}catch(et){if(typeof et=="object"&&et!==null&&typeof et.then=="function")throw et}}return null}function Pe(q,$,ae,me,Ee,et,ct,$t){var At=null;if(typeof me=="function"){var Kt=Ue($,me);Kt!==null?($t=Kt.name,me=Kt.action||"",Ee=Kt.encType,et=Kt.method,ct=Kt.target,At=Kt.data):(q.push(" ","formAction",'="',He,'"'),ct=et=Ee=me=$t=null,_e($,ae))}return $t!=null&&we(q,"name",$t),me!=null&&we(q,"formAction",me),Ee!=null&&we(q,"formEncType",Ee),et!=null&&we(q,"formMethod",et),ct!=null&&we(q,"formTarget",ct),At}function we(q,$,ae){switch($){case"className":Fe(q,"class",ae);break;case"tabIndex":Fe(q,"tabindex",ae);break;case"dir":case"role":case"viewBox":case"width":case"height":Fe(q,$,ae);break;case"style":De(q,ae);break;case"src":case"href":if(ae==="")break;case"action":case"formAction":if(ae==null||typeof ae=="function"||typeof ae=="symbol"||typeof ae=="boolean")break;ae=T(""+ae),q.push(" ",$,'="',H(ae),'"');break;case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":case"ref":break;case"autoFocus":case"multiple":case"muted":Me(q,$.toLowerCase(),ae);break;case"xlinkHref":if(typeof ae=="function"||typeof ae=="symbol"||typeof ae=="boolean")break;ae=T(""+ae),q.push(" ","xlink:href",'="',H(ae),'"');break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":typeof ae!="function"&&typeof ae!="symbol"&&q.push(" ",$,'="',H(ae),'"');break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":ae&&typeof ae!="function"&&typeof ae!="symbol"&&q.push(" ",$,'=""');break;case"capture":case"download":ae===!0?q.push(" ",$,'=""'):ae!==!1&&typeof ae!="function"&&typeof ae!="symbol"&&q.push(" ",$,'="',H(ae),'"');break;case"cols":case"rows":case"size":case"span":typeof ae!="function"&&typeof ae!="symbol"&&!isNaN(ae)&&1<=ae&&q.push(" ",$,'="',H(ae),'"');break;case"rowSpan":case"start":typeof ae=="function"||typeof ae=="symbol"||isNaN(ae)||q.push(" ",$,'="',H(ae),'"');break;case"xlinkActuate":Fe(q,"xlink:actuate",ae);break;case"xlinkArcrole":Fe(q,"xlink:arcrole",ae);break;case"xlinkRole":Fe(q,"xlink:role",ae);break;case"xlinkShow":Fe(q,"xlink:show",ae);break;case"xlinkTitle":Fe(q,"xlink:title",ae);break;case"xlinkType":Fe(q,"xlink:type",ae);break;case"xmlBase":Fe(q,"xml:base",ae);break;case"xmlLang":Fe(q,"xml:lang",ae);break;case"xmlSpace":Fe(q,"xml:space",ae);break;default:if((!(2<$.length)||$[0]!=="o"&&$[0]!=="O"||$[1]!=="n"&&$[1]!=="N")&&($=z.get($)||$,D($))){switch(typeof ae){case"function":case"symbol":return;case"boolean":var me=$.toLowerCase().slice(0,5);if(me!=="data-"&&me!=="aria-")return}q.push(" ",$,'="',H(ae),'"')}}}function ye(q,$,ae){if($!=null){if(ae!=null)throw Error(n(60));if(typeof $!="object"||!("__html"in $))throw Error(n(61));$=$.__html,$!=null&&q.push(""+$)}}function Re(q){var $="";return e.Children.forEach(q,function(ae){ae!=null&&($+=ae)}),$}function _e(q,$){if((q.instructions&16)===0){q.instructions|=16;var ae=$.preamble,me=$.bootstrapChunks;(ae.htmlChunks||ae.headChunks)&&me.length===0?(me.push($.startInlineScript),yn(me,q),me.push(">",`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,"<\/script>")):me.unshift($.startInlineScript,">",`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,"<\/script>")}}function Ve(q,$){q.push(st("link"));for(var ae in $)if(_.call($,ae)){var me=$[ae];if(me!=null)switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(n(399,"link"));default:we(q,ae,me)}}return q.push("/>"),null}var he=/(<\/|<)(s)(tyle)/gi;function Ye(q,$,ae,me){return""+$+(ae==="s"?"\\73 ":"\\53 ")+me}function Le(q,$,ae){q.push(st(ae));for(var me in $)if(_.call($,me)){var Ee=$[me];if(Ee!=null)switch(me){case"children":case"dangerouslySetInnerHTML":throw Error(n(399,ae));default:we(q,me,Ee)}}return q.push("/>"),null}function Ne(q,$){q.push(st("title"));var ae=null,me=null,Ee;for(Ee in $)if(_.call($,Ee)){var et=$[Ee];if(et!=null)switch(Ee){case"children":ae=et;break;case"dangerouslySetInnerHTML":me=et;break;default:we(q,Ee,et)}}return q.push(">"),$=Array.isArray(ae)?2>ae.length?ae[0]:null:ae,typeof $!="function"&&typeof $!="symbol"&&$!==null&&$!==void 0&&q.push(H(""+$)),ye(q,me,ae),q.push(pt("title")),null}function Ge(q,$){q.push(st("script"));var ae=null,me=null,Ee;for(Ee in $)if(_.call($,Ee)){var et=$[Ee];if(et!=null)switch(Ee){case"children":ae=et;break;case"dangerouslySetInnerHTML":me=et;break;default:we(q,Ee,et)}}return q.push(">"),ye(q,me,ae),typeof ae=="string"&&q.push((""+ae).replace(ne,Q)),q.push(pt("script")),null}function ft(q,$,ae){q.push(st(ae));var me=ae=null,Ee;for(Ee in $)if(_.call($,Ee)){var et=$[Ee];if(et!=null)switch(Ee){case"children":ae=et;break;case"dangerouslySetInnerHTML":me=et;break;default:we(q,Ee,et)}}return q.push(">"),ye(q,me,ae),ae}function Ze(q,$,ae){q.push(st(ae));var me=ae=null,Ee;for(Ee in $)if(_.call($,Ee)){var et=$[Ee];if(et!=null)switch(Ee){case"children":ae=et;break;case"dangerouslySetInnerHTML":me=et;break;default:we(q,Ee,et)}}return q.push(">"),ye(q,me,ae),typeof ae=="string"?(q.push(H(ae)),null):ae}var je=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Je=new Map;function st(q){var $=Je.get(q);if($===void 0){if(!je.test(q))throw Error(n(65,q));$="<"+q,Je.set(q,$)}return $}function gt(q,$,ae,me,Ee,et,ct,$t,At){switch($){case"div":case"span":case"svg":case"path":break;case"a":q.push(st("a"));var Kt=null,kn=null,rn;for(rn in ae)if(_.call(ae,rn)){var zn=ae[rn];if(zn!=null)switch(rn){case"children":Kt=zn;break;case"dangerouslySetInnerHTML":kn=zn;break;case"href":zn===""?Fe(q,"href",""):we(q,rn,zn);break;default:we(q,rn,zn)}}if(q.push(">"),ye(q,kn,Kt),typeof Kt=="string"){q.push(H(Kt));var ir=null}else ir=Kt;return ir;case"g":case"p":case"li":break;case"select":q.push(st("select"));var cs=null,Qr=null,qr;for(qr in ae)if(_.call(ae,qr)){var Hr=ae[qr];if(Hr!=null)switch(qr){case"children":cs=Hr;break;case"dangerouslySetInnerHTML":Qr=Hr;break;case"defaultValue":case"value":break;default:we(q,qr,Hr)}}return q.push(">"),ye(q,Qr,cs),cs;case"option":var ts=$t.selectedValue;q.push(st("option"));var Ks=null,Go=null,ys=null,ws=null,Rs;for(Rs in ae)if(_.call(ae,Rs)){var No=ae[Rs];if(No!=null)switch(Rs){case"children":Ks=No;break;case"selected":ys=No;break;case"dangerouslySetInnerHTML":ws=No;break;case"value":Go=No;default:we(q,Rs,No)}}if(ts!=null){var Ts=Go!==null?""+Go:Re(Ks);if(N(ts)){for(var Si=0;Si<ts.length;Si++)if(""+ts[Si]===Ts){q.push(' selected=""');break}}else""+ts===Ts&&q.push(' selected=""')}else ys&&q.push(' selected=""');return q.push(">"),ye(q,ws,Ks),Ks;case"textarea":q.push(st("textarea"));var Xs=null,ri=null,Do=null,Io;for(Io in ae)if(_.call(ae,Io)){var Ra=ae[Io];if(Ra!=null)switch(Io){case"children":Do=Ra;break;case"value":Xs=Ra;break;case"defaultValue":ri=Ra;break;case"dangerouslySetInnerHTML":throw Error(n(91));default:we(q,Io,Ra)}}if(Xs===null&&ri!==null&&(Xs=ri),q.push(">"),Do!=null){if(Xs!=null)throw Error(n(92));if(N(Do)){if(1<Do.length)throw Error(n(93));Xs=""+Do[0]}Xs=""+Do}return typeof Xs=="string"&&Xs[0]===`
|
|
385
|
+
`,1)[0]??""),KMt=100;function XMt(e,t,n,r,s=KMt){if(r||!n)return{hiddenSince:t,delayMs:null};const o=t??e;return{hiddenSince:o,delayMs:Math.max(0,s-(e-o))}}const QMt=1e6;function ZMt(e,t,n=QMt){if(t.length===0)return{anchor:null,firstItemIndex:n,remount:!1};if(!e)return{anchor:{keys:t,index:n},firstItemIndex:n,remount:!1};const r=new Map(t.map((s,o)=>[s,o]));for(let s=0;s<e.keys.length;s++){const o=r.get(e.keys[s]);if(o===void 0)continue;const i=e.index+s-o;return{anchor:{keys:t,index:i},firstItemIndex:i,remount:!1}}return{anchor:{keys:t,index:n},firstItemIndex:n,remount:!0}}function zle(e,t){return t}const JMt=new Set(["text","thinking","tool","tool-group"]);function e6t(e,t,n,r){const s=y.useRef(rH),[o,i]=y.useState(()=>Date.now()),l=r.compact,c=r.autoCollapseCompletedTurns,u=r.collapseCompletedActivity===!0,d=r.collapseLiveActivity===!0,f=r.turnOverrides,h={compact:l,autoCollapseCompletedTurns:c,turnOverrides:f},p=d?irt(e,t,r,s.current,o):null;s.current=p?.witness??rH;const m=p?.wakeAt??null,v=hrt(e,t,n,{...h,collapseCompletedActivity:u,collapseLiveActivity:d,releasedLiveActivity:p?.released,heldOpenTools:r.heldOpenTools,foldToolOnlyTurns:r.foldToolOnlyTurns===!0,readableToolCards:r.readableToolCards===!0});return y.useEffect(()=>{if(m===null||m<=o)return;const b=window.setTimeout(()=>i(m),m-o);return()=>window.clearTimeout(b)},[m,o]),v}const t6t=[{icon:lze,title:"Map the project",hint:"Entry points, modules and key dependencies",prompt:"Walk me through this project's structure: entry points, module layout and key dependencies."},{icon:hxe,title:"Find potential issues",hint:"Suspicious logic and unhandled edge cases",prompt:"Review this project for potential bugs, suspicious logic and unhandled edge cases, and list them by severity."},{icon:NW,title:"Add unit tests",hint:"Cover the core modules with tests",prompt:"Find the core modules that lack tests and add unit tests for them."},{icon:Kp,title:"Summarize recent changes",hint:"A digest based on git log",prompt:"Summarize the recent changes in this repository based on git log."}],n6t=[{icon:Ixe,title:"Check today's progress",hint:"Progress report and items waiting on you",prompt:"Summarize today's progress and list anything waiting on me."},{icon:zy,title:"Assign a task",hint:"A one-off job for the secretary to run",prompt:"Take care of a one-off task: "},{icon:rx,title:"Organize the to-do list",hint:"Sort the board into clear next steps",prompt:"Go through the board and organize it into clear next steps."},{icon:wf,title:"Clean up merged branches",hint:"Remove branches that are already merged",prompt:"Clean up merged branches and worktrees you no longer need."}];function r6t({onPick:e,variant:t="project"}){const{t:n}=Se(),r=t==="secretary"?n6t:t6t;return a.jsx("div",{className:"mx-auto grid w-full max-w-[560px] grid-cols-1 gap-2.5 text-left @min-[36rem]:grid-cols-2",children:r.map(({icon:s,title:o,hint:i,prompt:l})=>a.jsxs("button",{type:"button",onClick:()=>e(n(l)),"data-slot":"welcome-suggestion",className:"group flex items-start gap-3 rounded-xl border bg-card px-3.5 py-3 text-left shadow-xs transition-[border-color,box-shadow,transform] duration-200 hover:-translate-y-px hover:border-brand/25 hover:shadow-float",children:[a.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg bg-brand/8 text-brand dark:bg-brand/14",children:a.jsx(s,{className:"size-3.5"})}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block text-[13px] font-medium",children:n(o)}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:n(i)})]})]},o))})}const Og="enso-chat-col mx-auto w-full max-w-2xl px-4 @min-[56rem]:max-w-3xl @min-[72rem]:max-w-4xl @min-[84rem]:max-w-5xl @min-[96rem]:max-w-6xl @min-[112rem]:max-w-7xl",Hle=1e3;function Ule({className:e,children:t}){const[n,r]=y.useState(!1);return y.useEffect(()=>{const s=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(s)},[]),a.jsx("div",{className:xe("t-stagger",n&&"is-shown",e),children:t})}const Vle=40,s6t={index:"LAST",align:"end"},o6t={top:600,bottom:600},i6t=e=>e&&!AK()?"auto":!1,a6t={owners:new Map,ends:new Map};function l6t(e){const t=new Map,n=new Map;let r=null,s=null;const o=()=>{r&&s&&n.set(s,r)};for(const i of e)i.kind==="user"?(o(),r=!i.collapsed&&i.canCollapse===!0?i.key:null,s=null,r&&t.set(i.key,r)):r&&(t.set(i.key,r),s=i.key);return o(),{owners:t,ends:n}}const c6t='input, textarea, select, [contenteditable=""], [contenteditable="true"]';function u6t({style:e,...t}){const n=e?.visibility==="hidden",[r,s]=y.useState(!1),o=y.useRef(null);return y.useEffect(()=>{const i=XMt(Date.now(),o.current,n,r);if(o.current=i.hiddenSince,i.delayMs===null)return;const l=window.setTimeout(()=>s(!0),i.delayMs);return()=>window.clearTimeout(l)},[n,r]),a.jsx("div",{...t,style:n&&r?{...e,visibility:"visible"}:e})}function OK({ref:e,items:t,busy:n,loading:r=!1,running:s,runStartedAt:o,lastOutputAt:i,error:l,emptyTitle:c,emptyDescription:u,onSuggestion:d,emptyVariant:f,onRetryResume:h,onRetrySync:p,virtualize:m=!0,onStartReached:v,historyLoading:b=!1,hasOlder:x,olderCursor:S,searchQuery:k="",activeHit:C=null,secretarySession:A=!1,secretaryFace:N,conversationId:j,quotable:I=!1}){const{t:_}=Se(),L=Ud(),M=xNe(j),F=A?N??M:null,D=!L&&F?F:null,R=A,z=y.useRef(null),[B,H]=y.useState(!0),[G,te]=y.useState(!1),W=y.useRef(!0),T=y.useRef(null),U=y.useRef(null),P=y.useRef(0),K=y.useRef(0),J=y.useRef(null),ee=y.useRef(!1),X=y.useRef(!1),ne=y.useRef(0),Q=y.useRef(!1),[oe,de]=y.useState(null),ie=y.useRef(0),ue=y.useCallback(ze=>{cancelAnimationFrame(ie.current),ie.current=requestAnimationFrame(()=>de(ze()))},[]);y.useEffect(()=>()=>cancelAnimationFrame(ie.current),[]);const[ve,ge]=y.useState(new Set),Te=y.useRef(new Set),[De,Me]=y.useState(()=>new Set),Fe=y.useCallback((ze,We)=>{const lt=Te.current;We!==lt.has(ze)&&(We?lt.add(ze):lt.delete(ze),Me(new Set(lt)))},[]),He=y.useRef({report:Fe,scroller:T});He.current.report=Fe;const tt=y.useCallback(ze=>{ge(We=>{const lt=new Set(We);return lt.has(ze)?lt.delete(ze):lt.add(ze),lt})},[]),[$e,Ue]=y.useState(new Map),Pe=be(ze=>ze.autoCollapseTurns),we=be(ze=>ze.collapseCompletedActivity),ye=be(ze=>ze.collapseLiveActivity),Re=be(ze=>ze.liveActivityFoldDelaySec),_e=be(ze=>ze.compactReadOnlyTools),Ve=e6t(t,s,ve,{compact:_e,autoCollapseCompletedTurns:Pe,collapseCompletedActivity:we,collapseLiveActivity:ye,liveActivityFoldDelaySec:Re,heldOpenTools:De,turnOverrides:$e,foldToolOnlyTurns:!L&&R,readableToolCards:R}),he=y.useRef({state:$5t,collapse:new Map,reveal:new Map}),Ye=y.useMemo(()=>{const ze=he.current,We=Bt=>T.current?.querySelector(`[data-nav-key="${CSS.escape(Bt)}"]`),lt=K5t(ze.state,Ve,(Bt,Qt)=>{const dn=We(Bt)?.getBoundingClientRect().top,mn=We(Qt)?.getBoundingClientRect().bottom;return dn===void 0||mn===void 0?0:mn-dn}),yt=Date.now();ze.state=lt.next;for(const{key:Bt,...Qt}of lt.collapses)ze.collapse.set(Bt,{at:yt,...Qt});for(const Bt of lt.expands)ze.reveal.set(Bt,yt);return lt.children},[Ve]),Le=y.useRef(null),Ne=y.useRef(0),Ge=y.useRef(null),ft=ZMt(Le.current,Ve.map(ze=>ze.key));Le.current=ft.anchor,ft.remount&&(Ne.current+=1,Ge.current=null);const Ze=ft.firstItemIndex,je=y.useCallback((ze,We)=>{Ue(lt=>lt.get(ze)===We?lt:new Map(lt).set(ze,We))},[]),Je=y.useMemo(()=>Pe?l6t(Ve):a6t,[Pe,Ve]),st=y.useRef(null),gt=y.useMemo(()=>{const ze=[];for(let We=0;We<t.length;We++){const lt=t[We];if(lt.kind!=="user")continue;let yt="";for(let Bt=We+1;Bt<t.length;Bt++){const Qt=t[Bt];if(Qt.kind==="user")break;if(Qt.kind==="text"){yt=Qt.text;break}}ze.push({key:lt.key,question:fq(lt.text)||"[image]",answer:yt})}return ze},[t]),ut=y.useCallback(()=>{const ze=T.current;ze&&ze.scrollHeight-ze.scrollTop-ze.clientHeight>2&&(ee.current=!0,ze.scrollTop=ze.scrollHeight)},[]),pt=y.useCallback(()=>{cancelAnimationFrame(P.current);const ze=Date.now()+1200;let We=null;const lt=()=>{cancelAnimationFrame(P.current),ee.current=!1,We?.removeEventListener("touchstart",lt),We?.removeEventListener("wheel",lt)},yt=()=>{if(X.current){lt();return}!We&&T.current&&(We=T.current,We.addEventListener("touchstart",lt,{passive:!0,once:!0}),We.addEventListener("wheel",lt,{passive:!0,once:!0})),ut(),W.current=!0,H(!0),Date.now()<ze?P.current=requestAnimationFrame(yt):lt()};yt(),H(!0),W.current=!0},[ut]);y.useEffect(()=>()=>{cancelAnimationFrame(P.current),cancelAnimationFrame(K.current),window.clearTimeout(ne.current)},[]),y.useEffect(()=>TK.subscribe(({active:ze},We)=>{if(ze===We.active)return;if(ze){cancelAnimationFrame(P.current),cancelAnimationFrame(K.current),ee.current=!1;return}const lt=Q.current;Q.current=!1,lt&&W.current&&!X.current&&ut()}),[ut]);const It=()=>{X.current=!0,window.clearTimeout(ne.current)},kt=()=>{window.clearTimeout(ne.current),ne.current=window.setTimeout(()=>{X.current=!1},400)},ln=()=>{It(),kt()},qt=()=>[...T.current?.querySelectorAll("[data-nav-key]")??[]],Jt=ze=>{ln(),st.current=ze,je(ze,!0)},cn=ze=>{if(ze.key!=="Escape"||ze.defaultPrevented||Je.owners.size===0)return;const We=T.current,lt=ze.target;if(!We?.contains(lt)||lt.closest?.(c6t)||I2e()||document.querySelector('[role="dialog"], [role="alertdialog"]'))return;const yt=We.getBoundingClientRect();for(const Bt of qt()){const Qt=Je.owners.get(Bt.getAttribute("data-nav-key")??"");if(!Qt)continue;const dn=Bt.getBoundingClientRect();if(dn.bottom<=yt.top||dn.top>=yt.bottom)continue;const mn=ze.nativeEvent;window.addEventListener("keydown",Zt=>{Zt!==mn||Zt.defaultPrevented||(Zt.preventDefault(),Jt(Qt))},{once:!0});return}},hn=()=>{cancelAnimationFrame(P.current),cancelAnimationFrame(K.current),ee.current=!1,W.current=!1,H(!1)},St=y.useCallback(ze=>{if(J.current?.disconnect(),J.current=null,!ze)return;const We=new ResizeObserver(()=>{if(!W.current&&!ee.current)return;cancelAnimationFrame(K.current);let lt=8;const yt=()=>{ut();const Bt=T.current;(Bt?Bt.scrollHeight-Bt.scrollTop-Bt.clientHeight:0)<=2||(--lt>0?K.current=requestAnimationFrame(yt):pt())};yt()});We.observe(ze),J.current=We,pt()},[ut,pt]);y.useEffect(()=>()=>J.current?.disconnect(),[]);const wt=ze=>Ve.findIndex(We=>We.key===ze||We.kind==="tool-group"&&m5e(We,ze)),Dt=ze=>{if(!m){T.current?.querySelector(`[data-nav-key="${CSS.escape(ze)}"]`)?.scrollIntoView({block:"center"});return}const We=wt(ze);We>=0&&z.current?.scrollToIndex({index:zle(Ze,We),align:"center"})},fe=y.useRef(null),Ie=ze=>{if(hn(),wt(ze)>=0){fe.current=null,Dt(ze);return}let We=null,lt=!1;for(const yt of t)if(yt.kind==="user"&&(We=yt.key),yt.key===ze){lt=!0;break}!lt||!We||(fe.current=ze,je(We,!1))};y.useLayoutEffect(()=>{const ze=fe.current;!ze||wt(ze)<0||(fe.current=null,Dt(ze))},[Ve]),y.useLayoutEffect(()=>{const ze=st.current;if(!ze)return;st.current=null;const We=qt().find(yt=>yt.getAttribute("data-nav-key")===ze);if(We){h5e(We,T.current);return}const lt=Ve.findIndex(yt=>yt.key===ze);m&<>=0&&z.current?.scrollToIndex({index:zle(Ze,lt),align:"start"})},[Ve]),y.useImperativeHandle(e,()=>({scrollToBottom:pt,pinToBottom:ut,isAtBottom:()=>W.current,getScroller:()=>m?null:T.current,scrollToKey:Ie}));const Ae=y.useRef(!1),ce=`${S}:${Ze}`,Oe=y.useRef(ce);Oe.current!==ce&&(Oe.current=ce,Ae.current=!1);const dt=()=>{!v||Ae.current||(Ae.current=!0,v())};y.useEffect(()=>{m&&!b&&Ge.current===Ze&&dt()},[S,b]);const vt=y.useMemo(()=>({query:k,activeKey:C?.key??"",activeNth:C?.nth??-1}),[k,C?.key,C?.nth]),Et=(ze,We)=>{const lt=Ve[We+1];if(lt!==void 0&&Fle(ze)&&Fle(lt))return"pb-0";if(!_e)return"pb-4";const yt=lt!==void 0&&_le(lt);return _le(ze)?yt?"pb-1":"pb-2":ze.kind==="text"&&yt?"pb-1":"pb-4"},Ct=(ze,We)=>{const lt=Ve[We-1],yt=lt?.kind==="user"&&!lt.collapsed&&JMt.has(ze.kind)?lt:void 0,Bt=Date.now(),Qt=he.current.collapse.get(ze.key),dn=Qt&&Bt-Qt.at<Hle?Qt:void 0,mn=Ye.get(ze.key),Zt=mn&&he.current.reveal.get(mn.group),An=mn&&Zt!==void 0&&Bt-Zt<Hle,bn=Je.ends.get(ze.key);return a.jsxs("div",{"data-nav-key":ze.key,"data-fold-collapse":dn?dn.pair?"pair":"toggle":void 0,style:dn?{"--fold-from":`${dn.height}px`}:An?{"--fold-i":mn.index}:void 0,className:xe(Og,Et(ze,We),An&&"t-fold-reveal","[overflow-wrap:anywhere]"),children:[yt&&a.jsx(cMt,{model:yt.replyModel,at:yt.replyAt,privacyMask:yt.replyPrivacyMask,secretarySession:R,face:F,conversationId:j}),a.jsx(g6t,{itemKey:ze.key,children:a.jsx(uMt,{item:ze,secretarySession:R,onToggleGroup:tt,onToggleTurn:je})}),bn&&a.jsx(TMt,{turnKey:bn,canCollapse:!0,collapsed:!1,onToggleTurn:Jt})]},ze.key)},xn=y.useRef(!1);x===!0&&(xn.current=!0);const yn=ant(t.length>0,b,x,xn.current,!m&&G);y.useLayoutEffect(()=>{if(m){te(!1);return}const ze=T.current;te(!!ze&&lnt(x===!0,b,ze.scrollHeight,ze.clientHeight))},[m,x,b,Ze,Ve.length,t.length]);const er={pageChrome:yn,onLoadMore:yn==="more"?dt:void 0,busy:n,loading:!!r,since:X5t({loading:!!r,runStartedAt:o}),error:l,onRetryResume:h};return a.jsx(KTe.Provider,{value:vt,children:a.jsx(FRt,{value:He.current,children:a.jsxs("div",{ref:U,"data-enso":"timeline",className:"@container relative min-h-24 flex-1",onWheel:ln,onKeyDown:ze=>{ln(),cn(ze)},onTouchStart:ze=>{T.current?.contains(ze.target)&&It()},onTouchEnd:kt,onPointerDown:ze=>{ze.target===T.current&&(It(),window.addEventListener("pointerup",kt,{once:!0}))},children:[a.jsx(J5t,{items:gt,activeKey:oe,onJump:Ie}),I&&a.jsx(lIt,{containerRef:U}),t.length===0&&!n?a.jsxs(Ule,{className:"flex h-full flex-col items-center justify-center gap-2 overflow-y-auto px-4 text-center",children:[a.jsx("span",{className:"t-stagger-line t-stagger-line--1 mb-3",children:D?a.jsx(KN,{name:D.name,color:D.color,image:D.image,needsYou:0,running:0,size:"lg",enso:"secretary-chat-avatar"}):a.jsx("span",{className:"flex size-11 items-center justify-center rounded-[13px] border border-brand/20 bg-brand/8 text-brand dark:bg-brand/14",children:a.jsx(Y5t,{className:"size-6"})})}),a.jsx("p",{className:"t-stagger-line t-stagger-line--1 text-[22px] font-semibold tracking-tight",children:c}),l?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"t-stagger-line t-stagger-line--2 max-w-md text-sm text-destructive whitespace-pre-wrap",children:_(l)}),h&&a.jsx(Ke,{size:"sm",variant:"outline",onClick:h,children:_("Retry resume")})]}):a.jsxs(a.Fragment,{children:[p?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"t-stagger-line t-stagger-line--2 max-w-md text-sm text-muted-foreground",children:_("Session is not ready yet — no history to show.")}),a.jsx(Ke,{size:"sm",variant:"outline",onClick:p,children:_("Retry sync")})]}):u!==""?a.jsx("p",{className:"t-stagger-line t-stagger-line--2 text-sm text-muted-foreground",children:u??_(f==="secretary"?"Tell the secretary what to take care of…":"Ask the agent…")}):null,d&&a.jsx("div",{className:"t-stagger-line t-stagger-line--3 mt-5 w-full",children:a.jsx(r6t,{onPick:d,variant:f})})]})]}):t.length===0&&l?a.jsxs(Ule,{className:"flex h-full flex-col items-center justify-center gap-2 text-center",children:[a.jsx("p",{className:"t-stagger-line t-stagger-line--1 max-w-md text-sm text-destructive whitespace-pre-wrap",children:_(l)}),h&&a.jsx(Ke,{size:"sm",variant:"outline",onClick:h,children:_("Retry resume")})]}):t.length===0?a.jsxs("div",{"data-timeline-loading":"",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[a.jsx(Jn,{className:"h-5 w-5 animate-spin text-muted-foreground"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:_("Preparing session…")})]}):m?a.jsx(N5t,{ref:z,data:Ve,defaultItemHeight:80,computeItemKey:(ze,We)=>We.key,firstItemIndex:Ze,startReached:dt,followOutput:i6t,atBottomThreshold:Vle,atBottomStateChange:ze=>{if(!ze&&W.current&&!X.current){if(AK()){Q.current=!0;return}pt();return}H(ze),W.current=ze},increaseViewportBy:o6t,initialTopMostItemIndex:s6t,rangeChanged:({startIndex:ze})=>{Ge.current=ze,ze>Ze+4&&(Ae.current=!1),ue(()=>{const We=Math.max(0,ze-Ze);let lt=null;for(let yt=0;yt<=Math.min(We+1,Ve.length-1);yt++)Ve[yt]?.kind==="user"&&(lt=Ve[yt].key);return lt})},scrollerRef:ze=>{T.current=ze instanceof HTMLElement?ze:null},className:"h-full select-text",context:er,components:f6t,itemContent:(ze,We)=>Ct(We,ze-Ze)},Ne.current):a.jsx("div",{ref:ze=>{T.current=ze},onScroll:ze=>{const We=ze.currentTarget;if(ee.current){ee.current=!1,W.current=!0,H(!0);return}if(!X.current){W.current&&ut();return}const lt=We.scrollHeight-We.scrollTop-We.clientHeight<=Vle;lt!==W.current&&(W.current=lt,H(lt)),v&&(We.scrollTop<80&&!Ae.current?(Ae.current=!0,v()):We.scrollTop>240&&(Ae.current=!1))},className:"h-full select-text overflow-y-auto [overflow-anchor:none]",children:a.jsxs("div",{ref:St,children:[a.jsx(g5e,{context:er}),Ve.map((ze,We)=>Ct(ze,We)),a.jsx(v5e,{context:er})]})}),!B&&t.length>0&&a.jsxs("button",{type:"button",onClick:pt,className:"absolute bottom-4 left-1/2 z-10 inline-flex h-7 -translate-x-1/2 items-center gap-1.5 rounded-full border bg-card px-3 text-xs text-muted-foreground shadow-float transition-colors hover:text-foreground",children:[a.jsx(Y4,{className:"h-3 w-3"}),_("Scroll to bottom")]})]})})})}function m5e(e,t){return e.children.some(n=>n.key===t||n.kind==="tool-group"&&m5e(n,t))}function d6t({chrome:e,onLoadMore:t}){const{t:n}=Se();return e==="none"?a.jsx("div",{className:"h-6"}):a.jsx("div",{className:xe(Og,"flex items-center justify-center gap-2 py-3"),children:e==="loading"?a.jsxs(a.Fragment,{children:[a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:n("Loading earlier messages…")})]}):e==="more"?a.jsx("button",{type:"button",className:"text-xs text-muted-foreground underline-offset-2 hover:underline",onClick:t,children:n("Load earlier messages")}):a.jsx("p",{className:"text-xs text-muted-foreground",children:n("Beginning of conversation")})})}function g5e({context:e}){return a.jsx(d6t,{chrome:e.pageChrome,onLoadMore:e.onLoadMore})}function v5e({context:e}){const{t}=Se(),{busy:n,loading:r,since:s,error:o,onRetryResume:i}=e;return a.jsxs("div",{className:xe(Og,"pb-6 [overflow-wrap:anywhere]"),children:[n&&a.jsxs("div",{className:"flex min-h-[26px] items-center gap-2 text-[13px]",children:[a.jsx(h6t,{}),a.jsx("span",{className:"animate-pulse text-foreground motion-reduce:animate-none",children:t(r?"Loading…":"Working…")}),s!==void 0&&a.jsx(m6t,{since:s})]}),o&&a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("p",{className:"min-w-0 flex-1 text-sm text-destructive whitespace-pre-wrap",children:t(o)}),a.jsx(u5e,{}),i&&a.jsx(Ke,{size:"sm",variant:"outline",onClick:i,children:t("Retry resume")})]})]})}const f6t={List:u6t,Header:g5e,Footer:v5e};function h6t(){return a.jsxs("span",{className:"relative flex size-[22px] shrink-0 items-center justify-center",children:[a.jsx("span",{className:"absolute size-2 animate-ping rounded-full bg-brand/50"}),a.jsx("span",{className:"relative size-2 rounded-full bg-brand"})]})}const p6t=e=>{const t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m${t%60}s`},m6t=y.memo(function({since:t}){const[,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>n(s=>s+1),1e3);return()=>clearInterval(r)},[]),a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground tabular-nums",children:p6t(Date.now()-t)})});class g6t extends y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidUpdate(t){t.itemKey!==this.props.itemKey&&this.state.failed&&this.setState({failed:!1})}render(){return this.state.failed?a.jsxs("p",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-1.5 text-xs text-destructive",children:["message render failed · ",this.props.itemKey]}):this.props.children}}const tk={type:"spring",stiffness:400,damping:30},U6={type:"tween",duration:.22,ease:[.2,0,0,1]},h9={initial:{height:0,opacity:0},animate:{height:"auto",opacity:1,transition:U6},exit:{height:0,opacity:0,transition:U6}};function ocn(e){return e.resizing?!0:e.previousConversationId!==void 0&&e.conversationId!==void 0&&e.previousConversationId!==e.conversationId}function v6t(e){return e.skip?{duration:0}:e.cover||e.targetW===0?U6:tk}const x6t={ts:hw,tsx:hw,js:hw,jsx:hw,mjs:hw,json:X4,html:sze,css:pz,scss:pz,md:$p,sh:wT,bash:wT,yml:Md,yaml:Md,toml:Md},b6t={ts:"text-blue-500",tsx:"text-blue-500",js:"text-yellow-500",jsx:"text-yellow-500",mjs:"text-yellow-500",json:"text-yellow-600",html:"text-orange-500",css:"text-pink-500",scss:"text-pink-500",md:"text-sky-500",sh:"text-muted-foreground"};function y6t(e,t,n=!1){if(t)return n?Yu:Q4;const r=e.split(".").pop()?.toLowerCase()??"";return x6t[r]??Oze}function w6t(e,t){if(t)return"text-amber-500";const n=e.split(".").pop()?.toLowerCase()??"";return b6t[n]??"text-muted-foreground"}const k6t=y.lazy(()=>Be(()=>import("./ReadFileView-VbAe6o1G.js"),[],import.meta.url).then(e=>({default:e.ReadFileView}))),S6t={artifacts:[],media:[]},p9=new Map,m9=new Map,C6t=new Set(["image","markdown","html","text"]),E6t=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function T6t(e){const t=JSON.stringify(e),[n,r]=y.useState(()=>p9.get(t)??S6t);return y.useEffect(()=>{if(p9.has(t))return;let s=!0;return window.electronAPI.bots.artifacts.list(JSON.parse(t)).then(o=>{if(!s||!o.ok)return;const i={artifacts:o.artifacts,media:o.media??[]};(i.artifacts.length>0||i.media.length>0)&&p9.set(t,i),r(i)}).catch(()=>{}),()=>{s=!1}},[t]),n}function A6t(e){const{t}=Se();return(n,r)=>{window.electronAPI.bots.artifacts.open({...e,rel:n.rel,action:r}).then(s=>{s.ok||Ht({type:"error",title:s.error==="not-openable"?t("This file type is only shown in Finder"):t("Could not open the file")})})}}function V6({target:e}){const{artifacts:t,media:n}=T6t(e);return a.jsxs(a.Fragment,{children:[n.length>0&&a.jsx(I6t,{target:e,media:n}),t.length>0&&a.jsx(M6t,{target:e,artifacts:t})]})}function N6t(){const{t:e}=Se();return({source:t,name:n})=>t==="upload"?"":t==="web"?e("Web screenshot"):t==="desktop"?e("Desktop screenshot"):n&&/^(?:\/|[A-Za-z]:[\\/])/.test(n)?e("This computer"):e("Workspace image")}function x5e(e,t,n){const r=JSON.stringify(e),s=t&&n==="thumb"?m9.get(t):void 0,[o,i]=y.useState(s?{ok:!0,kind:"image",dataUrl:s}:null);return y.useEffect(()=>{const l=t&&n==="thumb"?m9.get(t):void 0;if(i(l?{ok:!0,kind:"image",dataUrl:l}:null),!t||l)return;let c=!0;return window.electronAPI.bots.artifacts.read({...JSON.parse(r),mediaId:t,variant:n}).then(u=>{n==="thumb"&&u.ok&&u.kind==="image"&&m9.set(t,u.dataUrl),c&&i(u)}).catch(()=>c&&i({ok:!1,error:"unavailable"})),()=>{c=!1}},[r,t,n]),o}function I6t({target:e,media:t}){const{t:n}=Se(),r=N6t(),[s,o]=y.useState(null),i=t.some(l=>l.ok&&l.source==="desktop");return a.jsxs("div",{className:"mt-2","data-bot-media":"",children:[a.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map((l,c)=>l.ok?a.jsx(j6t,{target:e,item:l,label:r(l),onOpen:()=>o(l)},l.mediaId):a.jsxs("div",{className:"flex w-40 flex-col gap-1 rounded-lg border border-destructive/60 border-dashed p-2 text-destructive text-xs",children:[a.jsxs("span",{className:"flex items-center gap-1 font-medium",children:[a.jsx(sM,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"truncate",children:l.name??r(l)})]}),a.jsx("span",{children:l.error==="quota"?n("Chat image storage is full (200 MiB); not saved"):n("Not sent: still over 10 MiB after compression")})]},`failed-${c}`))}),i&&a.jsx("p",{className:"mt-1 text-warning text-xs",children:n("Desktop screenshots may capture sensitive content from other windows.")}),a.jsx(R6t,{target:e,item:s,label:s?r(s):"",onClose:()=>o(null)})]})}function j6t({target:e,item:t,label:n,onOpen:r}){const s=x5e(e,t.mediaId,"thumb"),o=t.caption??t.name??n;return a.jsxs("button",{type:"button",title:o,onClick:r,className:"relative h-24 w-36 overflow-hidden rounded-lg border bg-muted",children:[s?.ok&&s.kind==="image"?a.jsx("img",{src:s.dataUrl,alt:o,className:"h-full w-full object-cover"}):s?a.jsx(sM,{className:"m-auto h-4 w-4 text-muted-foreground"}):a.jsx(Jn,{className:"m-auto h-4 w-4 animate-spin text-muted-foreground"}),n&&a.jsx("span",{className:xe("absolute top-1 left-1 rounded px-1 text-[10px] leading-4",t.source==="desktop"?"bg-warning text-warning-foreground":"bg-black/60 text-white"),children:n}),(t.caption||t.name)&&a.jsx("span",{className:"absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/70 to-transparent px-1.5 pt-3 pb-0.5 text-left text-[10px] text-white",children:t.caption??t.name})]})}function R6t({target:e,item:t,label:n,onClose:r}){const{t:s}=Se(),o=x5e(e,t?.mediaId??null,"full"),i=t?.caption??t?.name??n;return a.jsx(gr,{open:t!==null,onOpenChange:l=>!l&&r(),children:a.jsxs(vr,{className:"flex h-[80vh] max-w-4xl flex-col",children:[a.jsx(xr,{children:a.jsxs(dr,{className:"flex min-w-0 items-center gap-2 pr-8",children:[a.jsx("span",{className:"truncate",children:i}),a.jsx("span",{className:"shrink-0 font-normal text-muted-foreground text-xs",children:n})]})}),t?.source==="desktop"&&a.jsx("p",{className:"text-warning text-xs",children:s("Desktop screenshots may capture sensitive content from other windows.")}),t?.source==="file"&&a.jsx("p",{className:"text-muted-foreground text-xs",children:s("Copied into this chat: later edits or deletion of the original do not change it. Deleted together with the chat.")}),a.jsx(b5e,{name:i,content:o})]})})}function M6t({target:e,artifacts:t}){const{t:n}=Se(),r=A6t(e),[s,o]=y.useState(null);return a.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5","data-bot-artifacts":"",children:[t.map(i=>{const l=y6t(i.name,!1),c=C6t.has(i.kind)||i.kind==="pdf";return a.jsxs("div",{"data-slot":"bot-card",className:"group/artifact flex max-w-64 items-center gap-1 rounded-lg border bg-card py-1 pr-1 pl-2 text-xs",children:[a.jsxs("button",{type:"button",title:i.rel,disabled:!c,onClick:()=>i.kind==="pdf"?r(i,"preview"):o(i),className:"flex min-w-0 items-center gap-1.5 text-left enabled:hover:underline disabled:cursor-default",children:[a.jsx(l,{className:xe("h-3.5 w-3.5 shrink-0",w6t(i.name,!1))}),a.jsx("span",{className:"truncate",children:i.name}),a.jsx("span",{className:"shrink-0 text-muted-foreground",children:E6t(i.size)})]}),a.jsx("button",{type:"button",title:n("Show in Finder"),onClick:()=>r(i,"reveal"),className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(Yu,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",title:n("Open with default app"),onClick:()=>r(i,"open"),className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(dy,{className:"h-3.5 w-3.5"})})]},i.rel)}),a.jsx(_6t,{target:e,artifact:s,onOpen:r,onClose:()=>o(null)})]})}function _6t({target:e,artifact:t,onOpen:n,onClose:r}){const{t:s}=Se(),[o,i]=y.useState(null),l=t?.rel,c=JSON.stringify(e);return y.useEffect(()=>{if(i(null),!l)return;let u=!0;return window.electronAPI.bots.artifacts.read({...JSON.parse(c),rel:l}).then(d=>u&&i(d)).catch(()=>u&&i({ok:!1,error:"unavailable"})),()=>{u=!1}},[c,l]),a.jsx(gr,{open:t!==null,onOpenChange:u=>!u&&r(),children:a.jsxs(vr,{className:"flex h-[80vh] max-w-4xl flex-col",children:[a.jsx(xr,{children:a.jsxs(dr,{className:"flex min-w-0 items-center gap-2 pr-8",children:[a.jsx("span",{className:"truncate",children:t?.name}),a.jsx("span",{className:"truncate font-normal text-muted-foreground text-xs",children:t?.rel}),a.jsx("span",{className:"flex-1"}),t&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",title:s("Show in Finder"),onClick:()=>n(t,"reveal"),className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(Yu,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",title:s("Open with default app"),onClick:()=>n(t,"open"),className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(dy,{className:"h-4 w-4"})})]})]})}),a.jsx(b5e,{name:t?.name??"",content:o})]})})}function b5e({name:e,content:t}){const{t:n}=Se();return a.jsxs("div",{className:"min-h-0 flex-1 select-text overflow-auto border-t","data-bot-artifact-preview":"",children:[!t&&a.jsx("div",{className:"flex justify-center p-6 text-muted-foreground",children:a.jsx(Jn,{className:"h-4 w-4 animate-spin"})}),t&&!t.ok&&a.jsx("p",{className:"p-6 text-muted-foreground text-sm",children:t.error==="too-large"?n("The file is too large to preview"):n("Could not open the file")}),t?.ok&&t.kind==="image"&&a.jsx("img",{src:t.dataUrl,alt:e,className:"mx-auto max-h-full max-w-full object-contain p-4"}),t?.ok&&t.kind==="markdown"&&a.jsx("div",{className:"px-6 py-4 text-sm",children:a.jsx(ua,{text:t.text})}),t?.ok&&t.kind==="html"&&a.jsx("iframe",{title:e,sandbox:"",srcDoc:t.text,className:"h-full w-full bg-white"}),t?.ok&&t.kind==="text"&&a.jsx("div",{className:"p-2 text-xs",children:a.jsx(y.Suspense,{fallback:null,children:a.jsx(k6t,{path:e,contents:t.text})})})]})}var fb={},uC={};var Gle;function P6t(){if(Gle)return uC;Gle=1;var e=Dy(),t=L4();function n(q){var $="https://react.dev/errors/"+q;if(1<arguments.length){$+="?args[]="+encodeURIComponent(arguments[1]);for(var ae=2;ae<arguments.length;ae++)$+="&args[]="+encodeURIComponent(arguments[ae])}return"Minified React error #"+q+"; visit "+$+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.scope"),b=Symbol.for("react.activity"),x=Symbol.for("react.legacy_hidden"),S=Symbol.for("react.memo_cache_sentinel"),k=Symbol.for("react.view_transition"),C=Symbol.iterator;function A(q){return q===null||typeof q!="object"?null:(q=C&&q[C]||q["@@iterator"],typeof q=="function"?q:null)}var N=Array.isArray;function j(q,$){var ae=q.length&3,me=q.length-ae,Ee=$;for($=0;$<me;){var et=q.charCodeAt($)&255|(q.charCodeAt(++$)&255)<<8|(q.charCodeAt(++$)&255)<<16|(q.charCodeAt(++$)&255)<<24;++$,et=3432918353*(et&65535)+((3432918353*(et>>>16)&65535)<<16)&4294967295,et=et<<15|et>>>17,et=461845907*(et&65535)+((461845907*(et>>>16)&65535)<<16)&4294967295,Ee^=et,Ee=Ee<<13|Ee>>>19,Ee=5*(Ee&65535)+((5*(Ee>>>16)&65535)<<16)&4294967295,Ee=(Ee&65535)+27492+(((Ee>>>16)+58964&65535)<<16)}switch(et=0,ae){case 3:et^=(q.charCodeAt($+2)&255)<<16;case 2:et^=(q.charCodeAt($+1)&255)<<8;case 1:et^=q.charCodeAt($)&255,et=3432918353*(et&65535)+((3432918353*(et>>>16)&65535)<<16)&4294967295,et=et<<15|et>>>17,Ee^=461845907*(et&65535)+((461845907*(et>>>16)&65535)<<16)&4294967295}return Ee^=q.length,Ee^=Ee>>>16,Ee=2246822507*(Ee&65535)+((2246822507*(Ee>>>16)&65535)<<16)&4294967295,Ee^=Ee>>>13,Ee=3266489909*(Ee&65535)+((3266489909*(Ee>>>16)&65535)<<16)&4294967295,(Ee^Ee>>>16)>>>0}var I=Object.assign,_=Object.prototype.hasOwnProperty,L=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),M={},F={};function D(q){return _.call(F,q)?!0:_.call(M,q)?!1:L.test(q)?F[q]=!0:(M[q]=!0,!1)}var R=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" ")),z=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),B=/["'&<>]/;function H(q){if(typeof q=="boolean"||typeof q=="number"||typeof q=="bigint")return""+q;q=""+q;var $=B.exec(q);if($){var ae="",me,Ee=0;for(me=$.index;me<q.length;me++){switch(q.charCodeAt(me)){case 34:$=""";break;case 38:$="&";break;case 39:$="'";break;case 60:$="<";break;case 62:$=">";break;default:continue}Ee!==me&&(ae+=q.slice(Ee,me)),Ee=me+1,ae+=$}q=Ee!==me?ae+q.slice(Ee,me):ae}return q}var G=/([A-Z])/g,te=/^ms-/,W=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function T(q){return W.test(""+q)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":q}var U=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},J=P.d;P.d={f:J.f,r:J.r,D:lt,C:yt,L:Bt,m:Qt,X:mn,S:dn,M:Zt};var ee=[],X=null,ne=/(<\/|<)(s)(cript)/gi;function Q(q,$,ae,me){return""+$+(ae==="s"?"\\u0073":"\\u0053")+me}function oe(q,$,ae,me,Ee){return{idPrefix:q===void 0?"":q,nextFormID:0,streamingFormat:0,bootstrapScriptContent:ae,bootstrapScripts:me,bootstrapModules:Ee,instructions:0,hasBody:!1,hasHtml:!1,unknownResources:{},dnsResources:{},connectResources:{default:{},anonymous:{},credentials:{}},imageResources:{},styleResources:{},scriptResources:{},moduleUnknownResources:{},moduleScriptResources:{}}}function de(q,$,ae,me){return{insertionMode:q,selectedValue:$,tagScope:ae,viewTransition:me}}function ie(q,$,ae){var me=q.tagScope&-25;switch($){case"noscript":return de(2,null,me|1,null);case"select":return de(2,ae.value!=null?ae.value:ae.defaultValue,me,null);case"svg":return de(4,null,me,null);case"picture":return de(2,null,me|2,null);case"math":return de(5,null,me,null);case"foreignObject":return de(2,null,me,null);case"table":return de(6,null,me,null);case"thead":case"tbody":case"tfoot":return de(7,null,me,null);case"colgroup":return de(9,null,me,null);case"tr":return de(8,null,me,null);case"head":if(2>q.insertionMode)return de(3,null,me,null);break;case"html":if(q.insertionMode===0)return de(1,null,me,null)}return 6<=q.insertionMode||2>q.insertionMode?de(2,null,me,null):q.tagScope!==me?de(q.insertionMode,q.selectedValue,me,null):q}function ue(q){return q===null?null:{update:q.update,enter:"none",exit:"none",share:q.update,name:q.autoName,autoName:q.autoName,nameIdx:0}}function ve(q,$){return $.tagScope&32&&(q.instructions|=128),de($.insertionMode,$.selectedValue,$.tagScope|12,ue($.viewTransition))}function ge(q,$){q=ue($.viewTransition);var ae=$.tagScope|16;return q!==null&&q.share!=="none"&&(ae|=64),de($.insertionMode,$.selectedValue,ae,q)}var Te=new Map;function De(q,$){if(typeof $!="object")throw Error(n(62));var ae=!0,me;for(me in $)if(_.call($,me)){var Ee=$[me];if(Ee!=null&&typeof Ee!="boolean"&&Ee!==""){if(me.indexOf("--")===0){var et=H(me);Ee=H((""+Ee).trim())}else et=Te.get(me),et===void 0&&(et=H(me.replace(G,"-$1").toLowerCase().replace(te,"-ms-")),Te.set(me,et)),Ee=typeof Ee=="number"?Ee===0||R.has(me)?""+Ee:Ee+"px":H((""+Ee).trim());ae?(ae=!1,q.push(' style="',et,":",Ee)):q.push(";",et,":",Ee)}}ae||q.push('"')}function Me(q,$,ae){ae&&typeof ae!="function"&&typeof ae!="symbol"&&q.push(" ",$,'=""')}function Fe(q,$,ae){typeof ae!="function"&&typeof ae!="symbol"&&typeof ae!="boolean"&&q.push(" ",$,'="',H(ae),'"')}var He=H("javascript:throw new Error('React form unexpectedly submitted.')");function tt(q,$){this.push('<input type="hidden"'),$e(q),Fe(this,"name",$),Fe(this,"value",q),this.push("/>")}function $e(q){if(typeof q!="string")throw Error(n(480))}function Ue(q,$){if(typeof $.$$FORM_ACTION=="function"){var ae=q.nextFormID++;q=q.idPrefix+ae;try{var me=$.$$FORM_ACTION(q);if(me){var Ee=me.data;Ee?.forEach($e)}return me}catch(et){if(typeof et=="object"&&et!==null&&typeof et.then=="function")throw et}}return null}function Pe(q,$,ae,me,Ee,et,ct,$t){var At=null;if(typeof me=="function"){var Kt=Ue($,me);Kt!==null?($t=Kt.name,me=Kt.action||"",Ee=Kt.encType,et=Kt.method,ct=Kt.target,At=Kt.data):(q.push(" ","formAction",'="',He,'"'),ct=et=Ee=me=$t=null,_e($,ae))}return $t!=null&&we(q,"name",$t),me!=null&&we(q,"formAction",me),Ee!=null&&we(q,"formEncType",Ee),et!=null&&we(q,"formMethod",et),ct!=null&&we(q,"formTarget",ct),At}function we(q,$,ae){switch($){case"className":Fe(q,"class",ae);break;case"tabIndex":Fe(q,"tabindex",ae);break;case"dir":case"role":case"viewBox":case"width":case"height":Fe(q,$,ae);break;case"style":De(q,ae);break;case"src":case"href":if(ae==="")break;case"action":case"formAction":if(ae==null||typeof ae=="function"||typeof ae=="symbol"||typeof ae=="boolean")break;ae=T(""+ae),q.push(" ",$,'="',H(ae),'"');break;case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":case"ref":break;case"autoFocus":case"multiple":case"muted":Me(q,$.toLowerCase(),ae);break;case"xlinkHref":if(typeof ae=="function"||typeof ae=="symbol"||typeof ae=="boolean")break;ae=T(""+ae),q.push(" ","xlink:href",'="',H(ae),'"');break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":typeof ae!="function"&&typeof ae!="symbol"&&q.push(" ",$,'="',H(ae),'"');break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":ae&&typeof ae!="function"&&typeof ae!="symbol"&&q.push(" ",$,'=""');break;case"capture":case"download":ae===!0?q.push(" ",$,'=""'):ae!==!1&&typeof ae!="function"&&typeof ae!="symbol"&&q.push(" ",$,'="',H(ae),'"');break;case"cols":case"rows":case"size":case"span":typeof ae!="function"&&typeof ae!="symbol"&&!isNaN(ae)&&1<=ae&&q.push(" ",$,'="',H(ae),'"');break;case"rowSpan":case"start":typeof ae=="function"||typeof ae=="symbol"||isNaN(ae)||q.push(" ",$,'="',H(ae),'"');break;case"xlinkActuate":Fe(q,"xlink:actuate",ae);break;case"xlinkArcrole":Fe(q,"xlink:arcrole",ae);break;case"xlinkRole":Fe(q,"xlink:role",ae);break;case"xlinkShow":Fe(q,"xlink:show",ae);break;case"xlinkTitle":Fe(q,"xlink:title",ae);break;case"xlinkType":Fe(q,"xlink:type",ae);break;case"xmlBase":Fe(q,"xml:base",ae);break;case"xmlLang":Fe(q,"xml:lang",ae);break;case"xmlSpace":Fe(q,"xml:space",ae);break;default:if((!(2<$.length)||$[0]!=="o"&&$[0]!=="O"||$[1]!=="n"&&$[1]!=="N")&&($=z.get($)||$,D($))){switch(typeof ae){case"function":case"symbol":return;case"boolean":var me=$.toLowerCase().slice(0,5);if(me!=="data-"&&me!=="aria-")return}q.push(" ",$,'="',H(ae),'"')}}}function ye(q,$,ae){if($!=null){if(ae!=null)throw Error(n(60));if(typeof $!="object"||!("__html"in $))throw Error(n(61));$=$.__html,$!=null&&q.push(""+$)}}function Re(q){var $="";return e.Children.forEach(q,function(ae){ae!=null&&($+=ae)}),$}function _e(q,$){if((q.instructions&16)===0){q.instructions|=16;var ae=$.preamble,me=$.bootstrapChunks;(ae.htmlChunks||ae.headChunks)&&me.length===0?(me.push($.startInlineScript),yn(me,q),me.push(">",`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,"<\/script>")):me.unshift($.startInlineScript,">",`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,"<\/script>")}}function Ve(q,$){q.push(st("link"));for(var ae in $)if(_.call($,ae)){var me=$[ae];if(me!=null)switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(n(399,"link"));default:we(q,ae,me)}}return q.push("/>"),null}var he=/(<\/|<)(s)(tyle)/gi;function Ye(q,$,ae,me){return""+$+(ae==="s"?"\\73 ":"\\53 ")+me}function Le(q,$,ae){q.push(st(ae));for(var me in $)if(_.call($,me)){var Ee=$[me];if(Ee!=null)switch(me){case"children":case"dangerouslySetInnerHTML":throw Error(n(399,ae));default:we(q,me,Ee)}}return q.push("/>"),null}function Ne(q,$){q.push(st("title"));var ae=null,me=null,Ee;for(Ee in $)if(_.call($,Ee)){var et=$[Ee];if(et!=null)switch(Ee){case"children":ae=et;break;case"dangerouslySetInnerHTML":me=et;break;default:we(q,Ee,et)}}return q.push(">"),$=Array.isArray(ae)?2>ae.length?ae[0]:null:ae,typeof $!="function"&&typeof $!="symbol"&&$!==null&&$!==void 0&&q.push(H(""+$)),ye(q,me,ae),q.push(pt("title")),null}function Ge(q,$){q.push(st("script"));var ae=null,me=null,Ee;for(Ee in $)if(_.call($,Ee)){var et=$[Ee];if(et!=null)switch(Ee){case"children":ae=et;break;case"dangerouslySetInnerHTML":me=et;break;default:we(q,Ee,et)}}return q.push(">"),ye(q,me,ae),typeof ae=="string"&&q.push((""+ae).replace(ne,Q)),q.push(pt("script")),null}function ft(q,$,ae){q.push(st(ae));var me=ae=null,Ee;for(Ee in $)if(_.call($,Ee)){var et=$[Ee];if(et!=null)switch(Ee){case"children":ae=et;break;case"dangerouslySetInnerHTML":me=et;break;default:we(q,Ee,et)}}return q.push(">"),ye(q,me,ae),ae}function Ze(q,$,ae){q.push(st(ae));var me=ae=null,Ee;for(Ee in $)if(_.call($,Ee)){var et=$[Ee];if(et!=null)switch(Ee){case"children":ae=et;break;case"dangerouslySetInnerHTML":me=et;break;default:we(q,Ee,et)}}return q.push(">"),ye(q,me,ae),typeof ae=="string"?(q.push(H(ae)),null):ae}var je=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Je=new Map;function st(q){var $=Je.get(q);if($===void 0){if(!je.test(q))throw Error(n(65,q));$="<"+q,Je.set(q,$)}return $}function gt(q,$,ae,me,Ee,et,ct,$t,At){switch($){case"div":case"span":case"svg":case"path":break;case"a":q.push(st("a"));var Kt=null,kn=null,rn;for(rn in ae)if(_.call(ae,rn)){var zn=ae[rn];if(zn!=null)switch(rn){case"children":Kt=zn;break;case"dangerouslySetInnerHTML":kn=zn;break;case"href":zn===""?Fe(q,"href",""):we(q,rn,zn);break;default:we(q,rn,zn)}}if(q.push(">"),ye(q,kn,Kt),typeof Kt=="string"){q.push(H(Kt));var ir=null}else ir=Kt;return ir;case"g":case"p":case"li":break;case"select":q.push(st("select"));var cs=null,Qr=null,qr;for(qr in ae)if(_.call(ae,qr)){var Hr=ae[qr];if(Hr!=null)switch(qr){case"children":cs=Hr;break;case"dangerouslySetInnerHTML":Qr=Hr;break;case"defaultValue":case"value":break;default:we(q,qr,Hr)}}return q.push(">"),ye(q,Qr,cs),cs;case"option":var ts=$t.selectedValue;q.push(st("option"));var Ks=null,Go=null,ys=null,ws=null,Rs;for(Rs in ae)if(_.call(ae,Rs)){var No=ae[Rs];if(No!=null)switch(Rs){case"children":Ks=No;break;case"selected":ys=No;break;case"dangerouslySetInnerHTML":ws=No;break;case"value":Go=No;default:we(q,Rs,No)}}if(ts!=null){var Ts=Go!==null?""+Go:Re(Ks);if(N(ts)){for(var Si=0;Si<ts.length;Si++)if(""+ts[Si]===Ts){q.push(' selected=""');break}}else""+ts===Ts&&q.push(' selected=""')}else ys&&q.push(' selected=""');return q.push(">"),ye(q,ws,Ks),Ks;case"textarea":q.push(st("textarea"));var Xs=null,ri=null,Do=null,Io;for(Io in ae)if(_.call(ae,Io)){var Ra=ae[Io];if(Ra!=null)switch(Io){case"children":Do=Ra;break;case"value":Xs=Ra;break;case"defaultValue":ri=Ra;break;case"dangerouslySetInnerHTML":throw Error(n(91));default:we(q,Io,Ra)}}if(Xs===null&&ri!==null&&(Xs=ri),q.push(">"),Do!=null){if(Xs!=null)throw Error(n(92));if(N(Do)){if(1<Do.length)throw Error(n(93));Xs=""+Do[0]}Xs=""+Do}return typeof Xs=="string"&&Xs[0]===`
|
|
386
386
|
`&&q.push(`
|
|
387
387
|
`),Xs!==null&&q.push(H(""+Xs)),null;case"input":q.push(st("input"));var sd=null,yl=null,Ma=null,Fc=null,Ci=null,Ka=null,Xa=null,fi=null,Oi=null,Qa;for(Qa in ae)if(_.call(ae,Qa)){var ko=ae[Qa];if(ko!=null)switch(Qa){case"children":case"dangerouslySetInnerHTML":throw Error(n(399,"input"));case"name":sd=ko;break;case"formAction":yl=ko;break;case"formEncType":Ma=ko;break;case"formMethod":Fc=ko;break;case"formTarget":Ci=ko;break;case"defaultChecked":Oi=ko;break;case"defaultValue":Xa=ko;break;case"checked":fi=ko;break;case"value":Ka=ko;break;default:we(q,Qa,ko)}}var _a=Pe(q,me,Ee,yl,Ma,Fc,Ci,sd);return fi!==null?Me(q,"checked",fi):Oi!==null&&Me(q,"checked",Oi),Ka!==null?we(q,"value",Ka):Xa!==null&&we(q,"value",Xa),q.push("/>"),_a?.forEach(tt,q),null;case"button":q.push(st("button"));var Hl=null,r0=null,xm=null,s0=null,o0=null,Ei=null,jo=null,os;for(os in ae)if(_.call(ae,os)){var pa=ae[os];if(pa!=null)switch(os){case"children":Hl=pa;break;case"dangerouslySetInnerHTML":r0=pa;break;case"name":xm=pa;break;case"formAction":s0=pa;break;case"formEncType":o0=pa;break;case"formMethod":Ei=pa;break;case"formTarget":jo=pa;break;default:we(q,os,pa)}}var ra=Pe(q,me,Ee,s0,o0,Ei,jo,xm);if(q.push(">"),ra?.forEach(tt,q),ye(q,r0,Hl),typeof Hl=="string"){q.push(H(Hl));var Hh=null}else Hh=Hl;return Hh;case"form":q.push(st("form"));var Za=null,i0=null,Ul=null,wu=null,cc=null,Jd=null,od;for(od in ae)if(_.call(ae,od)){var zc=ae[od];if(zc!=null)switch(od){case"children":Za=zc;break;case"dangerouslySetInnerHTML":i0=zc;break;case"action":Ul=zc;break;case"encType":wu=zc;break;case"method":cc=zc;break;case"target":Jd=zc;break;default:we(q,od,zc)}}var id=null,So=null;if(typeof Ul=="function"){var Ja=Ue(me,Ul);Ja!==null?(Ul=Ja.action||"",wu=Ja.encType,cc=Ja.method,Jd=Ja.target,id=Ja.data,So=Ja.name):(q.push(" ","action",'="',He,'"'),Jd=cc=wu=Ul=null,_e(me,Ee))}if(Ul!=null&&we(q,"action",Ul),wu!=null&&we(q,"encType",wu),cc!=null&&we(q,"method",cc),Jd!=null&&we(q,"target",Jd),q.push(">"),So!==null&&(q.push('<input type="hidden"'),Fe(q,"name",So),q.push("/>"),id?.forEach(tt,q)),ye(q,i0,Za),typeof Za=="string"){q.push(H(Za));var wl=null}else wl=Za;return wl;case"menuitem":q.push(st("menuitem"));for(var ku in ae)if(_.call(ae,ku)){var Uh=ae[ku];if(Uh!=null)switch(ku){case"children":case"dangerouslySetInnerHTML":throw Error(n(400));default:we(q,ku,Uh)}}return q.push(">"),null;case"object":q.push(st("object"));var ma=null,Hc=null,Vl;for(Vl in ae)if(_.call(ae,Vl)){var co=ae[Vl];if(co!=null)switch(Vl){case"children":ma=co;break;case"dangerouslySetInnerHTML":Hc=co;break;case"data":var Di=T(""+co);if(Di==="")break;q.push(" ","data",'="',H(Di),'"');break;default:we(q,Vl,co)}}if(q.push(">"),ye(q,Hc,ma),typeof ma=="string"){q.push(H(ma));var Wf=null}else Wf=ma;return Wf;case"title":var Pa=$t.tagScope&1,Rx=$t.tagScope&4;if($t.insertionMode===4||Pa||ae.itemProp!=null)var bm=Ne(q,ae);else Rx?bm=null:(Ne(Ee.hoistableChunks,ae),bm=void 0);return bm;case"link":var Wo=$t.tagScope&1,a0=$t.tagScope&4,Vh=ae.rel,Gl=ae.href,ad=ae.precedence;if($t.insertionMode===4||Wo||ae.itemProp!=null||typeof Vh!="string"||typeof Gl!="string"||Gl===""){Ve(q,ae);var Wl=null}else if(ae.rel==="stylesheet")if(typeof ad!="string"||ae.disabled!=null||ae.onLoad||ae.onError)Wl=Ve(q,ae);else{var hi=Ee.styles.get(ad),Gh=me.styleResources.hasOwnProperty(Gl)?me.styleResources[Gl]:void 0;if(Gh!==null){me.styleResources[Gl]=null,hi||(hi={precedence:H(ad),rules:[],hrefs:[],sheets:new Map},Ee.styles.set(ad,hi));var qf={state:0,props:I({},ae,{"data-precedence":ae.precedence,precedence:null})};if(Gh){Gh.length===2&&An(qf.props,Gh);var l0=Ee.preloads.stylesheets.get(Gl);l0&&0<l0.length?l0.length=0:qf.state=1}hi.sheets.set(Gl,qf),ct&&ct.stylesheets.add(qf)}else if(hi){var ym=hi.sheets.get(Gl);ym&&ct&&ct.stylesheets.add(ym)}At&&q.push("<!-- -->"),Wl=null}else ae.onLoad||ae.onError?Wl=Ve(q,ae):(At&&q.push("<!-- -->"),Wl=a0?null:Ve(Ee.hoistableChunks,ae));return Wl;case"script":var ld=$t.tagScope&1,Wh=ae.async;if(typeof ae.src!="string"||!ae.src||!Wh||typeof Wh=="function"||typeof Wh=="symbol"||ae.onLoad||ae.onError||$t.insertionMode===4||ld||ae.itemProp!=null)var qh=Ge(q,ae);else{var pi=ae.src;if(ae.type==="module")var cd=me.moduleScriptResources,ef=Ee.preloads.moduleScripts;else cd=me.scriptResources,ef=Ee.preloads.scripts;var ud=cd.hasOwnProperty(pi)?cd[pi]:void 0;if(ud!==null){cd[pi]=null;var tf=ae;if(ud){ud.length===2&&(tf=I({},ae),An(tf,ud));var wm=ef.get(pi);wm&&(wm.length=0)}var Yh=[];Ee.scripts.add(Yh),Ge(Yh,tf)}At&&q.push("<!-- -->"),qh=null}return qh;case"style":var Uc=$t.tagScope&1,el=ae.precedence,kl=ae.href,c0=ae.nonce;if($t.insertionMode===4||Uc||ae.itemProp!=null||typeof el!="string"||typeof kl!="string"||kl===""){q.push(st("style"));var ql=null,Yf=null,uc;for(uc in ae)if(_.call(ae,uc)){var Vc=ae[uc];if(Vc!=null)switch(uc){case"children":ql=Vc;break;case"dangerouslySetInnerHTML":Yf=Vc;break;default:we(q,uc,Vc)}}q.push(">");var dc=Array.isArray(ql)?2>ql.length?ql[0]:null:ql;typeof dc!="function"&&typeof dc!="symbol"&&dc!==null&&dc!==void 0&&q.push((""+dc).replace(he,Ye)),ye(q,Yf,ql),q.push(pt("style"));var $f=null}else{var tl=Ee.styles.get(el);if((me.styleResources.hasOwnProperty(kl)?me.styleResources[kl]:void 0)!==null){me.styleResources[kl]=null,tl||(tl={precedence:H(el),rules:[],hrefs:[],sheets:new Map},Ee.styles.set(el,tl));var u0=Ee.nonce.style;if(!u0||u0===c0){tl.hrefs.push(H(kl));var Su=tl.rules,Gc=null,Kf=null,Sl;for(Sl in ae)if(_.call(ae,Sl)){var La=ae[Sl];if(La!=null)switch(Sl){case"children":Gc=La;break;case"dangerouslySetInnerHTML":Kf=La}}var fc=Array.isArray(Gc)?2>Gc.length?Gc[0]:null:Gc;typeof fc!="function"&&typeof fc!="symbol"&&fc!==null&&fc!==void 0&&Su.push((""+fc).replace(he,Ye)),ye(Su,Kf,Gc)}}tl&&ct&&ct.styles.add(tl),At&&q.push("<!-- -->"),$f=void 0}return $f;case"meta":var Cl=$t.tagScope&1,$h=$t.tagScope&4;if($t.insertionMode===4||Cl||ae.itemProp!=null)var Xf=Le(q,ae,"meta");else At&&q.push("<!-- -->"),Xf=$h?null:typeof ae.charSet=="string"?Le(Ee.charsetChunks,ae,"meta"):ae.name==="viewport"?Le(Ee.viewportChunks,ae,"meta"):Le(Ee.hoistableChunks,ae,"meta");return Xf;case"listing":case"pre":q.push(st($));var Cu=null,V=null,Y;for(Y in ae)if(_.call(ae,Y)){var se=ae[Y];if(se!=null)switch(Y){case"children":Cu=se;break;case"dangerouslySetInnerHTML":V=se;break;default:we(q,Y,se)}}if(q.push(">"),V!=null){if(Cu!=null)throw Error(n(60));if(typeof V!="object"||!("__html"in V))throw Error(n(61));var pe=V.__html;pe!=null&&(typeof pe=="string"&&0<pe.length&&pe[0]===`
|
|
388
388
|
`?q.push(`
|
|
@@ -784,7 +784,7 @@ Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),r.put(o,13)}},x7=n,x
|
|
|
784
784
|
The chosen QR Code version cannot contain this amount of data.
|
|
785
785
|
Minimum version required to store current data is: `+M+`.
|
|
786
786
|
`);const F=k(j,I,L),D=e.getSymbolSize(j),R=new r(D);return p(R,j),m(R),v(R,j),x(R,I,0),j>=7&&b(R,j),S(R,F),isNaN(_)&&(_=i.getBestMask(R,x.bind(null,R,I))),i.applyMask(_,R),x(R,I,_),{modules:R,version:j,errorCorrectionLevel:I,maskPattern:_,segments:L}}return t7.create=function(j,I){if(typeof j>"u"||j==="")throw new Error("No input text");let _=t.M,L,M;return typeof I<"u"&&(_=t.from(I.errorCorrectionLevel,t.M),L=u.from(I.version),M=i.from(I.maskPattern),I.toSJISFunc&&e.setToSJISFunction(I.toSJISFunc)),A(j,L,_,M)},t7}var y7={},w7={},Bde;function QRe(){return Bde||(Bde=1,(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(o){return[o,o]}))),r.length===6&&r.push("F","F");const s=parseInt(r.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const s=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,o=r.width&&r.width>=21?r.width:void 0,i=r.scale||4;return{width:o,scale:o?4:i,margin:s,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,s){return s.width&&s.width>=r+s.margin*2?s.width/(r+s.margin*2):s.scale},e.getImageWidth=function(r,s){const o=e.getScale(r,s);return Math.floor((r+s.margin*2)*o)},e.qrToImageData=function(r,s,o){const i=s.modules.size,l=s.modules.data,c=e.getScale(i,o),u=Math.floor((i+o.margin*2)*c),d=o.margin*c,f=[o.color.light,o.color.dark];for(let h=0;h<u;h++)for(let p=0;p<u;p++){let m=(h*u+p)*4,v=o.color.light;if(h>=d&&p>=d&&h<u-d&&p<u-d){const b=Math.floor((h-d)/c),x=Math.floor((p-d)/c);v=f[l[b*i+x]?1:0]}r[m++]=v.r,r[m++]=v.g,r[m++]=v.b,r[m]=v.a}}})(w7)),w7}var Fde;function cVt(){return Fde||(Fde=1,(function(e){const t=QRe();function n(s,o,i){s.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=i,o.width=i,o.style.height=i+"px",o.style.width=i+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(o,i,l){let c=l,u=i;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),i||(u=r()),c=t.getOptions(c);const d=t.getImageWidth(o.modules.size,c),f=u.getContext("2d"),h=f.createImageData(d,d);return t.qrToImageData(h.data,o,c),n(f,u,d),f.putImageData(h,0,0),u},e.renderToDataURL=function(o,i,l){let c=l;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),c||(c={});const u=e.render(o,i,c),d=c.type||"image/png",f=c.rendererOpts||{};return u.toDataURL(d,f.quality)}})(y7)),y7}var k7={},zde;function uVt(){if(zde)return k7;zde=1;const e=QRe();function t(s,o){const i=s.a/255,l=o+'="'+s.hex+'"';return i<1?l+" "+o+'-opacity="'+i.toFixed(2).slice(1)+'"':l}function n(s,o,i){let l=s+o;return typeof i<"u"&&(l+=" "+i),l}function r(s,o,i){let l="",c=0,u=!1,d=0;for(let f=0;f<s.length;f++){const h=Math.floor(f%o),p=Math.floor(f/o);!h&&!u&&(u=!0),s[f]?(d++,f>0&&h>0&&s[f-1]||(l+=u?n("M",h+i,.5+p+i):n("m",c,0),c=0,u=!1),h+1<o&&s[f+1]||(l+=n("h",d),d=0)):c++}return l}return k7.render=function(o,i,l){const c=e.getOptions(i),u=o.modules.size,d=o.modules.data,f=u+c.margin*2,h=c.color.light.a?"<path "+t(c.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",p="<path "+t(c.color.dark,"stroke")+' d="'+r(d,u,c.margin)+'"/>',m='viewBox="0 0 '+f+" "+f+'"',b='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+m+' shape-rendering="crispEdges">'+h+p+`</svg>
|
|
787
|
-
`;return typeof l=="function"&&l(null,b),b},k7}var Hde;function dVt(){if(Hde)return tw;Hde=1;const e=WUt(),t=lVt(),n=cVt(),r=uVt();function s(o,i,l,c,u){const d=[].slice.call(arguments,1),f=d.length,h=typeof d[f-1]=="function";if(!h&&!e())throw new Error("Callback required as last argument");if(h){if(f<2)throw new Error("Too few arguments provided");f===2?(u=l,l=i,i=c=void 0):f===3&&(i.getContext&&typeof u>"u"?(u=c,c=void 0):(u=c,c=l,l=i,i=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(l=i,i=c=void 0):f===2&&!i.getContext&&(c=l,l=i,i=void 0),new Promise(function(p,m){try{const v=t.create(l,c);p(o(v,i,c))}catch(v){m(v)}})}try{const p=t.create(l,c);u(null,o(p,i,c))}catch(p){u(p)}}return tw.create=t.create,tw.toCanvas=s.bind(null,n.render),tw.toDataURL=s.bind(null,n.renderToDataURL),tw.toString=s.bind(null,function(o,i,l){return r.render(o,l)}),tw}var fVt=dVt();const ZRe=Oy(fVt);function hVt(e,t){const n=t.trim();if(n.length===0||n.length>512||n.startsWith("/")||n.startsWith("\\")||n.includes("\\")||n.includes("\0")||n.includes("?")||n.includes("#")||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n))return null;const r=kJ(e)&&e!=="."?e:e.split("/").pop()??"",s=r.lastIndexOf("/"),o=s===-1?"":r.slice(0,s),i=o?`${o}/${n}`:n,l=[];for(const u of i.split("/"))if(!(u===""||u===".")){if(u===".."){if(l.length===0)return null;l.pop();continue}l.push(u)}const c=l.join("/");return!c||!kJ(c)?null:c}function Ude(e,t){const n=new RegExp(`\\b${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'=<>]+))`,"i").exec(e);return n?n[1]??n[2]??n[3]??"":null}function pVt(e,t,n){return e.replace(new RegExp(`\\b${t}\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s"'=<>]+)`,"i"),`${t}="${n}"`)}function mVt(e){return e?.trim().toLowerCase().split(/\s+/).includes("stylesheet")??!1}function gVt(e){try{return new TextDecoder().decode(Uint8Array.from(atob(e),t=>t.charCodeAt(0)))}catch{return null}}function vVt(e,t){const n=[],r=(s,o,i,l)=>{const c=o[1]??"";if(!l(c))return;const u=Ude(c,i);if(u===null)return;const d=hVt(t,u);d&&n.push({start:o.index,end:o.index+o[0].length,kind:s,rel:d,attrs:c,full:o[0]})};for(const s of e.matchAll(/<script\b([^>]*)>[\s\S]*?<\/script>/gi))r("script",s,"src",()=>!0);for(const s of e.matchAll(/<link\b([^>]*?)\/?>/gi))r("style",s,"href",o=>mVt(Ude(o,"rel")));for(const s of e.matchAll(/<img\b([^>]*?)\/?>/gi))r("img",s,"src",()=>!0);return n.sort((s,o)=>s.start-o.start),n}async function xVt(e,t,n){const r=vVt(e,t),s=new Map;await Promise.all([...new Set(r.map(l=>l.rel))].map(async l=>{s.set(l,await n(l))}));let o=0,i="";for(const l of r){i+=e.slice(o,l.start),o=l.end;const c=s.get(l.rel);if(!c){i+=l.full;continue}if(l.kind==="img"){const d=c.mime||"application/octet-stream";i+=`<img${pVt(l.attrs,"src",`data:${d};base64,${c.base64}`)}>`;continue}const u=gVt(c.base64);if(u===null){i+=l.full;continue}i+=l.kind==="script"?`<script>${u.replace(/<\/script/gi,"<\\/script")}<\/script>`:`<style>${u.replace(/<\/style/gi,"<\\/style")}</style>`}return i+e.slice(o)}const bVt="plugin-view.html";function Vde(){return document.documentElement.classList.contains("dark")?"dark":"light"}function lcn({pluginId:e,viewId:t,sessionId:n}){const{t:r}=Se(),s=HGe().find(o=>o.pluginId===e&&o.id===t);return s?a.jsx(JRe,{pluginId:e,entry:s.entry,title:s.title,sessionId:n}):a.jsx("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:r("Plugin is not enabled")})}function JRe({pluginId:e,entry:t,title:n,sessionId:r,file:s}){const o=y.useRef(null),[i,l]=y.useState(null),c=y.useRef(r);c.current=r;const u=it(b=>r?b.conversations[r]?.projectId??null:null),d=y.useRef(u);d.current=u;const f=y.useRef(s);f.current=s;const h=y.useRef(null),p=y.useRef(null);y.useEffect(()=>{const b=o.current;if(!b)return;l(null);let x=!1,S=null;const k=()=>{try{S?.port1.postMessage(DGe(Vde()))}catch{}},C=new MutationObserver(k);C.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});const A=window.electronAPI.extensionPlugins.onViewEvent(I=>{if(!(I.pluginId!==e||typeof I.name!="string"))try{S?.port1.postMessage(BGe(I.name,I.data))}catch{}}),N=LGe(async(I,_)=>{const L=await window.electronAPI.extensionPlugins.call({pluginId:e,method:"renderer.call",payload:{method:I,args:_},sessionId:c.current});if(!L.ok)throw new Error(L.error);return L.value}),j=async I=>{if(I.source!==b.contentWindow||I.data?.type!=="enso-view-ready")return;S?.port1.close();const _=new MessageChannel;S=_,h.current=_,_.port1.onmessage=R=>{const z=OGe(R.data);if(z){window.electronAPI.extensionPlugins.viewStateSet(e,z);return}const B=zGe(R.data);if(B!==null){p.current=B,f.current?.onEdit(B);return}N(R.data).then(H=>{H&&!x&&S===_&&_.port1.postMessage(H)})};const[L,M]=await Promise.all([window.electronAPI.extensionPlugins.asset(e,t),window.electronAPI.extensionPlugins.viewStateGet(e)]);if(x||S!==_)return;if(!L.ok){l(L.error);return}const F=await xVt(VW(L.base64),t,async R=>{const z=await window.electronAPI.extensionPlugins.asset(e,R);return z.ok?{mime:z.mime,base64:z.base64}:null});if(x||S!==_)return;const D=f.current;b.contentWindow?.postMessage({type:"enso-view-init",html:F,theme:Vde(),storage:M.ok?M.state:{},session:ate(c.current,d.current),...D?{file:{rel:D.rel,text:D.text}}:{}},"*",[_.port2])};return window.addEventListener("message",j),b.src=new URL(bVt,document.baseURI).href,()=>{x=!0,C.disconnect(),A(),window.removeEventListener("message",j),S?.port1.close(),h.current=null,b.removeAttribute("src")}},[e,t]),y.useEffect(()=>{try{h.current?.port1.postMessage(ate(r,u))}catch{}},[r,u]);const m=s?.rel,v=s?.text;return y.useEffect(()=>{if(!(m===void 0||v===void 0)){if(p.current===v){p.current=null;return}try{h.current?.port1.postMessage(FGe(m,v))}catch{}}},[m,v]),a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i&&a.jsx("div",{className:"shrink-0 px-3 py-2 text-xs text-destructive",children:i}),a.jsx("iframe",{ref:o,title:n,className:"min-h-0 w-full flex-1 border-0 bg-background"})]})}const yVt="1",nw="inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-[12.5px] transition-colors hover:bg-muted disabled:opacity-50",Gde={network:"Cannot reach api.telegram.org. Check the proxy.",unauthorized:"Telegram rejected this token",api:"Telegram returned an error","token-required":"Paste a bot token first","not-group":"This chat is not a group","invalid-chat-id":"Group chat IDs are numbers, e.g. -1001234567890","invalid-topic":"Pick at least one topic","route-conflict":"Another secretary already has this group or one of these topics"};function wVt({checked:e,disabled:t,label:n,onClick:r,enso:s}){return a.jsxs("button",{type:"button",role:"checkbox","aria-checked":e,"data-enso":s,disabled:t,onClick:r,className:"flex items-center gap-1.5 text-left text-[12px] disabled:opacity-50",children:[a.jsx("span",{className:xe("flex size-3.5 shrink-0 items-center justify-center rounded ring-1 ring-border",e&&"bg-foreground text-background ring-foreground"),children:e&&a.jsx(Is,{className:"size-2.5"})}),n]})}function Wde({checked:e,disabled:t,label:n,onClick:r,enso:s}){return a.jsx("button",{type:"button",role:"radio","aria-checked":e,"data-enso":s,disabled:t,onClick:r,className:xe("rounded-md px-2 py-0.5 text-[11.5px] transition-colors disabled:opacity-50",e?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"),children:n})}function kVt({group:e,secretaryId:t,busy:n,onRemove:r,onSaved:s}){const{t:o}=Se(),[i,l]=y.useState(!1),[c,u]=y.useState({state:"idle"}),[d,f]=y.useState(e.topics.map(L=>L.id)),[h,p]=y.useState(!1),[m,v]=y.useState(null),b=L=>L.id===yVt?o("General (default topic)"):L.title??o("Topic #{{id}}",{id:L.id}),x=(L,M)=>{const F=o(Gde[L]??Gde.api),D=L==="api"?` ${o("Make sure the bot is in this group.")}`:"";return`${F}${M?`: ${M}`:""}${D}`},S=()=>{u({state:"loading"}),window.electronAPI.secretary.contactTelegramTopics(e.id,t).then(L=>u(L.ok?{state:"ready",forum:L.forum,topics:L.topics}:{state:"error",error:L.error,...L.detail?{detail:L.detail}:{}}),()=>u({state:"error",error:"api"}))},k=()=>{f(e.topics.map(L=>L.id)),v(null),l(!0),S()},C=L=>{p(!0),v(null),window.electronAPI.secretary.contactSettings({telegramGroupScope:{chatId:e.id,scope:L}},t).then(M=>{M.ok?(l(!1),s()):v(M.error)},()=>v("api")).finally(()=>p(!1))},A=()=>{i&&l(!1),e.all||C("all")},N=e.title??e.id,j=c.state==="ready"?[...c.topics,...e.topics.filter(L=>!c.topics.some(M=>M.id===L.id))]:[],I=n||h,_=i||!e.all;return a.jsxs("li",{"data-enso":"secretary-contact-group",className:"flex flex-col gap-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{"data-enso":"secretary-contact-group-name",className:"min-w-0 flex-1 truncate text-[12px]",children:e.title?a.jsxs(a.Fragment,{children:[e.title," ",a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground",children:e.id})]}):a.jsx("span",{className:"font-mono text-[11.5px]",children:e.id})}),a.jsxs("div",{role:"radiogroup","aria-label":o("What {{name}} hands to this secretary",{name:N}),className:"inline-flex shrink-0 rounded-lg bg-muted p-0.5",children:[a.jsx(Wde,{enso:"secretary-contact-scope-all",checked:!_,disabled:I,label:o("Whole group"),onClick:A}),a.jsx(Wde,{enso:"secretary-contact-scope-topics",checked:_,disabled:I,label:o("Pick topics"),onClick:()=>{i||k()}})]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-group-remove",disabled:n,"aria-label":o("Remove {{name}}",{name:N}),className:nw,onClick:r,children:a.jsx(Jr,{className:"size-3.5"})})]}),!e.all&&!i&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{"data-enso":"secretary-contact-group-scope",className:"min-w-0 flex-1 truncate text-[11.5px] text-muted-foreground",children:o("Topics: {{names}}",{names:e.topics.map(b).join(", ")})}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-group-topics",disabled:n,className:nw,onClick:k,children:[a.jsx(OHe,{className:"size-3.5"}),o("Change topics")]})]}),m&&!i&&a.jsx("p",{className:"text-[11.5px] text-destructive",children:x(m)}),i&&a.jsxs("div",{"data-enso":"secretary-contact-group-picker",className:"flex flex-col gap-1.5 rounded-lg bg-muted/40 px-2.5 py-2",children:[c.state==="loading"&&a.jsxs("p",{className:"flex items-center gap-1.5 text-[11.5px] text-muted-foreground",children:[a.jsx(Jn,{className:"size-3.5 animate-spin"}),o("Loading topics…")]}),c.state==="error"&&a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("p",{"data-enso":"secretary-contact-topics-error",className:"min-w-0 flex-1 text-[11.5px] text-destructive",children:o("Could not load topics: {{reason}}",{reason:x(c.error,c.detail)})}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-topics-retry",className:nw,onClick:S,children:[a.jsx(Lo,{className:"size-3.5"}),o("Retry")]})]}),c.state==="ready"&&(c.forum?a.jsxs(a.Fragment,{children:[j.map(L=>a.jsx(wVt,{enso:"secretary-contact-topic",checked:d.includes(L.id),disabled:I||!!L.owner&&!d.includes(L.id),label:L.owner?`${b(L)} · ${o("taken by {{owner}}",{owner:L.owner})}`:b(L),onClick:()=>f(M=>M.includes(L.id)?M.filter(F=>F!==L.id):[...M,L.id])},L.id)),a.jsx("p",{className:"text-[11px] text-subtle-foreground",children:o("Only topics the bot has seen are listed. If one is missing, send a message in that topic, then refresh. Topics you leave unchecked are ignored.")})]}):a.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:o("This group has no topics, so it can only be bound as a whole.")})),m&&a.jsx("p",{className:"text-[11.5px] text-destructive",children:x(m)}),a.jsxs("div",{className:"flex gap-1.5",children:[c.state==="ready"&&c.forum&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button","data-enso":"secretary-contact-scope-save",disabled:I||d.length===0,className:nw,onClick:()=>C(d),children:[a.jsx(Is,{className:"size-3.5"}),o("Save")]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-topics-refresh",disabled:I,className:nw,onClick:S,children:[a.jsx(Lo,{className:"size-3.5"}),o("Refresh")]})]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-topics-cancel",disabled:h,className:nw,onClick:()=>l(!1),children:o("Cancel")})]})]})]})}const SVt="border-border border-b py-3",qde="inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-[12.5px] transition-colors hover:bg-muted disabled:opacity-50",CVt="inline-flex items-center gap-1.5 rounded-lg bg-muted px-2.5 py-1.5 text-[12.5px] text-foreground transition-colors hover:bg-muted/80";function EVt(e){return e?.find(t=>!t.self&&t.privateChat)?.name??null}const TVt={"private-owned":'Your private chat with this bot already belongs to secretary "{{owner}}". One person has only one private chat with a bot, so bind this secretary to a group or forum topic below, or give it a different bot.',"route-conflict":'That group or topic already belongs to secretary "{{owner}}". Send the code in another group or topic.',expired:"The code expired. Generate a new one.","missing-code":"The bot got /start without the code. Open the bot with the button or QR code (the link carries the code), or send /start {{code}} yourself."};function AVt({bind:e}){const{t}=Se(),n=e.rejected;return n?a.jsxs("p",{"data-enso":"secretary-contact-bind-rejected","data-reason":n.reason,className:"mt-2 flex gap-1.5 rounded-lg bg-warning/10 px-2.5 py-2 text-[11.5px] text-warning",children:[a.jsx(Nd,{className:"mt-px size-3.5 shrink-0"}),a.jsx("span",{children:t(TVt[n.reason],{owner:n.owner??"",code:e.code})})]}):null}function NVt({bind:e,bot:t,now:n,busy:r,onNewCode:s,onCopied:o}){const{t:i}=Se(),l=e?e.expiresAt<=n:!1,c=e?Math.max(0,Math.ceil((e.expiresAt-n)/6e4)):0,u=e?.topicCommand??(t?`/bind@${t} ${i("<code>")}`:null);return a.jsxs("ol",{"data-enso":"secretary-contact-bind-places",className:"mt-1.5 flex flex-col gap-1.5",children:[a.jsxs("li",{className:"flex flex-col gap-1 text-[11.5px] text-muted-foreground",children:[a.jsxs("span",{children:[a.jsx("span",{className:"font-medium text-foreground",children:"1."})," ",i("Add the bot to the group: tap the button, or add @{{bot}} as a member in Telegram. For a forum group, turn on Topics first.",{bot:t??"bot"})]}),e?.groupLink&&a.jsxs("a",{"data-enso":"secretary-contact-group-link",href:e.groupLink,target:"_blank",rel:"noreferrer",className:`${CVt} self-start`,children:[a.jsx(dy,{className:"size-3.5"}),i("Add the bot to a group")]})]}),a.jsxs("li",{className:"flex flex-col gap-1 text-[11.5px] text-muted-foreground",children:[a.jsxs("span",{children:[a.jsx("span",{className:"font-medium text-foreground",children:"2."})," ",i("Send this in the group to hand the whole group to this secretary, or inside a forum topic to hand over only that topic:")]}),u?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("code",{"data-enso":"secretary-contact-topic-command",className:"min-w-0 flex-1 truncate rounded bg-muted px-1.5 py-1 font-mono text-[11.5px] text-foreground",children:u}),e&&!l&&a.jsx("button",{type:"button","data-enso":"secretary-contact-copy-topic-command",className:qde,"aria-label":i("Copy"),onClick:()=>{navigator.clipboard.writeText(e.topicCommand??""),o()},children:a.jsx(zd,{className:"size-3.5"})})]}):a.jsx("span",{className:"text-subtle-foreground",children:i("Verify a bot above first; the binding code shows up here.")}),e&&a.jsxs("span",{"data-enso":"secretary-contact-groups-code",className:l?"text-warning":"text-subtle-foreground",children:[i("Binding code of this secretary: {{code}}",{code:e.code})," ·"," ",l?i("This code has expired"):i("Valid for {{minutes}} more minutes",{minutes:c})]}),t&&(!e||l)&&a.jsxs("button",{type:"button","data-enso":"secretary-contact-groups-new-code",disabled:r,className:`${qde} self-start text-foreground`,onClick:s,children:[a.jsx(J4,{className:"size-3.5"}),i(e?"New code":"Get a binding code")]})]}),a.jsxs("li",{className:"text-[11.5px] text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-foreground",children:"3."})," ",i("Bound groups show up in the list of this section, where you can switch between the whole group and picked topics.")]})]})}function IVt({shared:e}){const{t}=Se(),n=(e??[]).filter(r=>!r.self).flatMap(r=>r.groups.map(s=>({owner:r.name,group:s})));return n.length===0?null:a.jsxs("div",{className:"mt-2",children:[a.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:t("Claimed by other secretaries on this bot (read only):")}),a.jsx("ul",{className:"mt-1 flex flex-col gap-0.5",children:n.map(({owner:r,group:s})=>a.jsxs("li",{"data-enso":"secretary-contact-group-other",className:"flex items-center gap-1.5 text-[12px] text-muted-foreground",children:[a.jsx(GHe,{className:"size-3 shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:jVt(s,t)}),a.jsx("span",{className:"shrink-0 text-[11px]",children:t("belongs to {{owner}}",{owner:r})})]},`${r}:${s.id}`))})]})}function jVt(e,t){const n=e.title??e.id;if(e.all)return`${n} · ${t("Whole group")}`;const r=e.topics.map(s=>s.id==="1"?t("General (default topic)"):s.title??t("Topic #{{id}}",{id:s.id})).join(", ");return`${n} · ${t("Topics: {{names}}",{names:r})}`}function RVt({shared:e,bot:t}){const{t:n}=Se();return a.jsxs("div",{"data-enso":"secretary-contact-shared",className:SVt,children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium text-muted-foreground",children:[a.jsx(Hv,{className:"size-3.5"}),n("@{{bot}} is shared by {{count}} secretaries",{bot:t??"",count:e.length})]}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("Each private chat, group or forum topic belongs to one secretary. A topic bound on its own wins over the whole group. Places nobody bound get no reply.")}),a.jsx("ul",{className:"mt-1.5 flex flex-col gap-1.5",children:e.map(r=>{const s=[...r.privateChat?[n("Private chat with @{{name}}",{name:r.privateChat.username??String(r.privateChat.id)})]:[],...r.groups.length>0?[n("Groups and topics: {{count}}",{count:r.groups.length})]:[]];return a.jsxs("li",{"data-enso":"secretary-contact-shared-user","data-self":r.self||void 0,className:"text-[12px]",children:[a.jsx("span",{className:"font-medium",children:r.name}),r.self&&a.jsxs("span",{className:"ml-1 text-[11px] text-muted-foreground",children:["(",n("this secretary"),")"]}),!r.enabled&&a.jsxs("span",{className:"ml-1 text-[11px] text-subtle-foreground",children:["· ",n("Telegram off")]}),s.length===0?a.jsx("p",{className:"text-[11.5px] text-subtle-foreground",children:n("Nothing bound yet")}):a.jsx("ul",{className:"text-[11.5px] text-muted-foreground",children:s.map(o=>a.jsxs("li",{className:"truncate",children:["· ",o]},o))})]},r.secretaryId)})})]})}const MVt="https://t.me/BotFather",_Vt={"token-invalid":"That does not look like a bot token",network:"Cannot reach api.telegram.org. Check the proxy.",unauthorized:"Telegram rejected this token",api:"Telegram returned an error","token-required":"Paste a bot token first","not-bound":"Not bound yet","not-found":"That task is already gone","no-secretary":"No secretary conversation is available","deliver-failed":"Could not reach the secretary session","invalid-chat-id":"Group chat IDs are numbers, e.g. -1001234567890","channel-paused":"Pushes to this channel are paused after repeated failures","invalid sender":"Not allowed from this window","invalid-github-login":"That is not a GitHub login"},Qm="border-border border-b py-3",Yc="inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-[12.5px] transition-colors hover:bg-muted disabled:opacity-50",PVt="inline-flex items-center gap-1.5 rounded-lg bg-muted px-2.5 py-1.5 text-[12.5px] text-foreground transition-colors hover:bg-muted/80",bR="inline-flex items-center gap-1.5 rounded-lg bg-foreground px-2.5 py-1.5 text-[12.5px] font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-50";function S7({index:e,label:t}){return a.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium text-muted-foreground",children:[a.jsx("span",{className:"flex size-4 items-center justify-center rounded-full bg-muted text-[10px] tabular-nums",children:e}),t]})}const LVt={unconfigured:"Not set up",pending:"Waiting to bind",connected:"Connected",error:"Error"},OVt={unconfigured:"bg-muted text-muted-foreground",pending:"bg-warning/15 text-warning",connected:"bg-success/15 text-success",error:"bg-destructive/15 text-destructive"},eMe="enso.secretary.contact.collapsed";function DVt(){try{const e=JSON.parse(window.localStorage.getItem(eMe)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,t])=>t===!0))}catch{return{}}}function BVt(e){try{window.localStorage.setItem(eMe,JSON.stringify(e))}catch{}}function FVt({outbound:e,busy:t,onRetry:n}){const{t:r,locale:s}=Se(),o=Date.now(),i=e.state==="paused",l=i&&e.pausedUntil!==void 0&&e.pausedUntil>o;return a.jsxs("div",{"data-enso":"secretary-contact-outbound","data-state":e.state,className:xe("border-l-2 px-2.5 py-2 text-[12px]",i?"border-warning bg-warning/5":"border-destructive bg-destructive/5"),children:[a.jsxs("div",{className:xe("flex items-center gap-1.5 font-medium",i?"text-warning":"text-destructive"),children:[i?a.jsx(VFe,{className:"size-3.5 shrink-0"}):a.jsx(Rf,{className:"size-3.5 shrink-0"}),i?r("Pushes paused: {{count}} sends failed in a row",{count:e.consecutiveFailures}):r("The last send failed ({{count}} in a row)",{count:e.consecutiveFailures})]}),e.userMessage&&a.jsx("p",{"data-enso":"secretary-contact-outbound-hint",className:"mt-1 text-[12.5px]",children:e.userMessage}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:r("Last failure: {{time}}",{time:`${Vce(e.lastErrorAt,s)} (${Ng(e.lastErrorAt,s,o)})`})}),e.detail&&a.jsx("p",{"data-enso":"secretary-contact-outbound-detail",className:"mt-0.5 break-all font-mono text-[11px] text-muted-foreground",children:e.detail}),i&&a.jsxs("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:[l?r("Next try at {{time}}. A message from this channel or Retry now resumes pushes right away.",{time:Vce(e.pausedUntil??o,s)}):r("The next push will try again."),e.suppressedCount>0&&` ${r("{{count}} pushes held back.",{count:e.suppressedCount})}`]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-outbound-retry",disabled:t,className:xe(Yc,"mt-1.5"),onClick:n,children:[a.jsx(Lo,{className:"size-3.5"}),r("Retry now")]}),a.jsx("span",{className:"ml-2 text-[11px] text-subtle-foreground",children:r("Sends a test message to this channel.")})]})}const zVt="enso.telegram";function B3({label:e,hint:t,checked:n,disabled:r,dataEnso:s,onChange:o}){return a.jsx("div",{"data-enso":s,children:a.jsx(vo,{label:e,description:t,children:a.jsx($r,{checked:n,disabled:r,onCheckedChange:o})})})}function HVt({channel:e,collapsed:t,busy:n,onToggle:r,onPrefs:s,onRetry:o,children:i}){const{t:l}=Se(),c=e.id==="telegram",{prefs:u,caps:d}=e,f=[!d.buttons&&l("No buttons: questions and cards arrive as numbered text."),!d.edit&&l("Cannot edit sent messages: answered questions are not marked there."),!d.typing&&l("No typing indicator.")].filter(h=>typeof h=="string");return a.jsxs("div",{"data-enso":"secretary-contact-channel","data-channel":e.id,className:"border-border border-b",children:[a.jsxs("div",{className:"flex items-center gap-2 py-2",children:[a.jsxs("button",{type:"button","data-enso":"secretary-contact-channel-toggle","aria-expanded":!t,className:"flex min-w-0 flex-1 items-center gap-2 text-left",onClick:r,children:[t?a.jsx(Bs,{className:"size-3.5 shrink-0 text-muted-foreground"}):a.jsx(Ho,{className:"size-3.5 shrink-0 text-muted-foreground"}),e.pluginId?a.jsx(YP,{pluginId:e.pluginId,icon:e.icon,className:"size-4"}):a.jsx(zy,{className:"size-4 shrink-0"}),a.jsx("span",{className:"truncate text-[13px] font-medium",children:e.title}),a.jsx("span",{className:"shrink-0 rounded bg-muted px-1 text-[10.5px] text-muted-foreground",children:e.builtin?l("Built-in"):l("Plugin")}),a.jsx("span",{"data-enso":"secretary-contact-channel-status",className:xe("shrink-0 rounded px-1 text-[10.5px]",OVt[e.status]),children:l(LVt[e.status])}),e.outbound&&a.jsx("span",{"data-enso":"secretary-contact-channel-outbound",className:xe("shrink-0 rounded px-1 text-[10.5px]",e.outbound.state==="paused"?"bg-warning/15 text-warning":"bg-destructive/15 text-destructive"),children:e.outbound.state==="paused"?l("Pushes paused"):l("Send failed")})]}),a.jsx(Xi,{"data-enso":"secretary-contact-channel-enabled",checked:u.enabled,disabled:n,"aria-label":l("Enable {{name}}",{name:e.title}),onCheckedChange:h=>s({enabled:h})})]}),!t&&a.jsxs("div",{className:"flex flex-col gap-2 border-border border-t py-2.5",children:[e.detail&&e.status==="error"&&a.jsx("p",{className:"text-[11.5px] text-destructive",children:e.detail}),e.outbound&&a.jsx(FVt,{outbound:e.outbound,busy:n,onRetry:o}),a.jsx(B3,{dataEnso:"secretary-contact-push",label:l("Push to this channel"),hint:l("Milestones, questions from the secretary, cards and approval notices go out here."),checked:u.push,disabled:n,onChange:h=>s({push:h})}),a.jsx(B3,{dataEnso:c?"secretary-contact-allow-dispatch":"secretary-contact-card-confirm",label:l(c?"Allow confirming cards from Telegram":"Confirm cards from the phone"),hint:c?l("On by default. A tap on your phone can confirm settings, skill, tool, takeover and cleanup cards. Those cards change which projects the secretary sees, what it may take over, which skills and tools it installs and what it cleans up. Approvals are never handled from Telegram."):d.buttons?l("Off by default. Approvals are never handled from the phone."):l('Off by default. Reply "confirm 1" to confirm a card. Approvals are never handled from the phone.'),checked:u.cardConfirm,disabled:n,onChange:h=>s({cardConfirm:h})}),a.jsx(B3,{dataEnso:"secretary-contact-mirror",label:l("Mirror every reply"),hint:l("Off by default. Every reply in the secretary conversation is sent here, not just milestones."),checked:u.syncMirror,disabled:n,onChange:h=>s({syncMirror:h})}),a.jsx(B3,{dataEnso:c?"secretary-contact-allow-memory":"secretary-contact-memory",label:l(c?"Allow viewing memory titles on Telegram":"Allow viewing memory titles"),hint:l("Off by default. /memory lists titles only, never the memory text."),checked:u.memory,disabled:n,onChange:h=>s({memory:h})}),f.length>0&&a.jsx("ul",{"data-enso":"secretary-contact-limits",className:"flex flex-col gap-0.5 text-[11.5px] text-subtle-foreground",children:f.map(h=>a.jsxs("li",{children:["· ",h]},h))}),i]})]})}function UVt({owner:e,secretaryId:t,busy:n,error:r,run:s,showHeading:o=!0}){const{t:i}=Se(),l=e.githubLogins.join(", "),c=e.githubLogins.length>0,[u,d]=y.useState(l),[f,h]=y.useState(!1),[p,m]=y.useState(null);y.useEffect(()=>{f||d(l)},[l,f]),y.useEffect(()=>{if(c){m(null);return}const b=window.electronAPI.secretary.contactGithubSuggest;if(!b)return;let x=!0;return b().then(S=>{x&&m(S.login)}),()=>{x=!1}},[c]);const v=b=>{h(!0),d(x=>{const S=x.split(/[\s,]+/).filter(Boolean);return S.some(k=>k.toLowerCase()===b.toLowerCase())?x:S.length>0?`${S.join(", ")}, ${b}`:b})};return a.jsxs("div",{"data-enso":"secretary-contact-owner",className:Qm,children:[o&&a.jsx("div",{className:"text-[12.5px] font-medium",children:i("Owner identity")}),a.jsx("p",{className:xe("text-[11.5px] text-muted-foreground",o&&"mt-1"),children:i("GitHub accounts that count as you. Events from anyone else are left to the agent unless you require confirmation.")}),a.jsx("label",{className:"mt-2 block text-[12px] text-muted-foreground",htmlFor:"secretary-github-logins",children:i("GitHub accounts")}),a.jsx("input",{id:"secretary-github-logins","data-enso":"secretary-contact-github-logins",value:u,disabled:n,placeholder:i("Comma or space separated"),className:"mt-1 w-full rounded-lg border border-border bg-transparent px-2.5 py-1.5 font-mono text-[12px] outline-none focus:border-foreground/40",onChange:b=>{h(!0),d(b.target.value)}}),p&&a.jsxs("div",{className:"mt-1.5 flex items-center justify-between gap-2",children:[a.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:i("Detected the gh login {{login}} on this machine",{login:p})}),a.jsx("button",{type:"button","data-enso":"secretary-contact-github-fill",disabled:n,className:Yc,onClick:()=>v(p),children:i("Fill in")})]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-github-save",disabled:n,className:xe(bR,"mt-2"),onClick:()=>{const b=u.split(/[\s,]+/).map(x=>x.trim()).filter(Boolean);s(async()=>{const x=await window.electronAPI.secretary.contactSettings({githubLogins:b},t);return x.ok&&h(!1),x})},children:i("Save GitHub accounts")}),r==="invalid-github-login"&&a.jsx("p",{className:"mt-1 text-[11.5px] text-destructive",children:i("That is not a GitHub login")}),a.jsx("div",{className:"mt-3 text-[12px] text-muted-foreground",children:i("Messages that are not from you")}),a.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[a.jsx("button",{type:"button","data-enso":"secretary-contact-external-agent","aria-pressed":!e.externalConfirm,disabled:n,className:xe(Yc,!e.externalConfirm&&"bg-muted"),onClick:()=>{e.externalConfirm&&s(()=>window.electronAPI.secretary.contactSettings({externalConfirm:!1},t))},children:i("Let the agent decide")}),a.jsx("button",{type:"button","data-enso":"secretary-contact-external-confirm","aria-pressed":e.externalConfirm,disabled:n,className:xe(Yc,e.externalConfirm&&"bg-muted"),onClick:()=>{e.externalConfirm||s(()=>window.electronAPI.secretary.contactSettings({externalConfirm:!0},t))},children:i("Require your confirmation")})]})]})}function Yde({checked:e,disabled:t,label:n,onCheckedChange:r}){const s=Dg();return a.jsx(Xi,{...s,"data-enso":"secretary-contact-enabled",checked:e,disabled:t,"aria-label":s["aria-labelledby"]?void 0:n,onCheckedChange:r})}function VVt({secretaryId:e,frames:t}={}){const{t:n}=Se(),[r,s]=y.useState(null),[o,i]=y.useState(""),[l,c]=y.useState(!1),[u,d]=y.useState(null),[f,h]=y.useState(null),[p,m]=y.useState(null),[v,b]=y.useState(DVt),[x,S]=y.useState([]),[k,C]=y.useState(""),[A,N]=y.useState(()=>Date.now());y.useEffect(()=>{const ue=window.electronAPI.extensionPlugins,ve=()=>{ue.list().then(S).catch(()=>S([]))};return ve(),ue.onChanged(ve)},[]);const j=ue=>{b(ve=>{const ge={...ve};return ge[ue]?delete ge[ue]:ge[ue]=!0,BVt(ge),ge})},I=y.useCallback(()=>{window.electronAPI.secretary.contactState(e).then(s)},[e]);y.useEffect(()=>(I(),window.electronAPI.secretary.onContactChanged(ue=>{e&&ue.secretaryId&&ue.secretaryId!==e||s(ue)})),[I,e]);const _=r?.telegram.bind?.expiresAt;y.useEffect(()=>{if(_===void 0)return;N(Date.now());const ue=window.setInterval(()=>N(Date.now()),15e3);return()=>window.clearInterval(ue)},[_]);const L=r?.telegram.bind?.link;y.useEffect(()=>{if(!L){m(null);return}let ue=!0;return ZRe.toDataURL(L,{width:320,margin:1}).then(ve=>{ue&&m(ve)}).catch(()=>m(null)),()=>{ue=!1}},[L]);const M=ue=>{c(!0),d(null),h(null),ue().then(ve=>{ve.ok||d(ve.error??"api")}).finally(()=>{c(!1),I()})};if(!r)return null;const F=r.telegram,D=r.channels??[],R=x.some(ue=>ue.id===zVt&&ue.state==="enabled"),z=(ue,ve)=>M(()=>window.electronAPI.secretary.contactSettings({channelId:ue,prefs:ve},e)),B=ue=>M(()=>window.electronAPI.secretary.contactTest(e,ue).then(ve=>{if(ve.ok)h(n("Test message sent"));else if(["api","network","unauthorized","channel-paused"].includes(ve.error))return{ok:!0};return ve})),H=F.poll.state==="error"||F.poll.state==="backoff",G=F.poll.state!=="stopped"&&F.poll.state!=="error",te=u==="network"&&G?null:u,W=F.groups??[],T=k.trim(),U=(ue,ve)=>M(()=>window.electronAPI.secretary.contactSettings({telegramGroup:{action:ue,chatId:ve}},e).then(ge=>(ge.ok&&ue==="add"&&C(""),ge))),P=F.bind?Math.max(0,Math.ceil((F.bind.expiresAt-A)/6e4)):0,K=F.bind?F.bind.expiresAt<=A:!1,J=F.chat?null:EVt(F.shared),ee=a.jsx(NVt,{bind:F.bind,bot:F.bot?.username,now:A,busy:l,onNewCode:()=>M(()=>window.electronAPI.secretary.contactBind(void 0,e)),onCopied:()=>h(n("Copied"))}),X=a.jsxs("div",{"data-enso":"secretary-contact-groups",className:Qm,children:[a.jsx("div",{className:"text-[12px] font-medium text-muted-foreground",children:n("Groups and topics")}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("Only groups on this list reach the secretary, and only messages from the bound account count. Messages from anyone else in the group are not received.")}),W.length===0?a.jsxs(a.Fragment,{children:[ee,a.jsx("p",{className:"mt-1.5 text-[11.5px] text-subtle-foreground",children:n("No groups yet: group messages are not received.")})]}):a.jsxs(a.Fragment,{children:[a.jsx("ul",{className:"mt-1.5 flex flex-col gap-1",children:W.map(ue=>a.jsx(kVt,{group:ue,secretaryId:e,busy:l,onRemove:()=>U("remove",ue.id),onSaved:I},ue.id))}),a.jsx("p",{className:"mt-2.5 text-[11.5px] font-medium text-muted-foreground",children:n("Bind another group or topic")}),ee]}),a.jsx(IVt,{shared:F.shared}),a.jsx("p",{className:"mt-2 text-[11px] text-subtle-foreground",children:n("Or add a group by its chat ID:")}),a.jsxs("form",{className:"mt-1 flex gap-1.5",onSubmit:ue=>{if(ue.preventDefault(),!!T){if(W.some(ve=>ve.id===T)){C("");return}U("add",T)}},children:[a.jsx("input",{"data-enso":"secretary-contact-group-input",value:k,spellCheck:!1,autoComplete:"off",placeholder:n("Group chat ID, e.g. -1001234567890"),onChange:ue=>C(ue.target.value),className:"min-w-0 flex-1 rounded-lg border border-border bg-transparent px-2.5 py-1.5 font-mono text-[12px] outline-none focus:border-foreground/40"}),a.jsxs("button",{type:"submit","data-enso":"secretary-contact-group-add",disabled:l||!T,className:Yc,children:[a.jsx(xs,{className:"size-3.5"}),n("Add group")]})]})]}),ne=a.jsxs(a.Fragment,{children:[R&&a.jsx("p",{"data-enso":"secretary-contact-token-conflict",className:"text-[11.5px] text-warning",children:n("The Telegram remote plugin (enso.telegram) is enabled. Do not give both the same bot token: only one place can poll a bot, so they would steal each other's messages.")}),F.status==="bound"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-enso":"secretary-contact-bound",className:Qm,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-success/15 text-success",children:a.jsx(Is,{className:"size-3.5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-[13px] font-medium",children:F.chat?n("Bound to @{{username}}",{username:F.chat.username??String(F.chat.id)}):n("Bound to groups and topics")}),a.jsxs("p",{className:"truncate text-[11.5px] text-muted-foreground",children:[n("Bot @{{bot}}",{bot:F.bot?.username??""}),F.tokenHint?` · ${F.tokenHint}`:""]})]})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.jsxs("button",{type:"button","data-enso":"secretary-contact-test",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactTest(e).then(ue=>(ue.ok&&h(n("Test message sent")),ue))),children:[a.jsx(zy,{className:"size-3.5"}),n("Send a test message")]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-unbind",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactUnbind(e)),children:[a.jsx(RVe,{className:"size-3.5"}),n("Unbind")]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-replace",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactForgetBot(e)),children:[a.jsx(Lo,{className:"size-3.5"}),n("Change bot")]})]})]}),X,a.jsx("div",{"data-enso":"secretary-contact-sync",className:xe(Qm,F.syncMirror&&"border-warning/50 bg-warning/5"),children:F.syncMirror?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[12.5px] font-medium text-warning",children:[a.jsx(RUe,{className:"size-3.5 shrink-0"}),n("Mirroring every conversation to Telegram")]}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("Every reply in the secretary conversation is sent to your phone, not just milestones. Silent turns arrive as a one-line summary. Telegram messages are not end-to-end encrypted and stay on Telegram servers. Send /sync off in Telegram to stop.")})]}):a.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:n("Only milestones go to Telegram. Send /sync in Telegram to mirror every reply; /last replays the latest round.")})}),a.jsxs("div",{"data-enso":"secretary-contact-commands",className:Qm,children:[a.jsx("div",{className:"text-[12px] font-medium text-muted-foreground",children:n("Commands you can send")}),a.jsx("ul",{className:"mt-1 flex flex-col gap-0.5",children:GUt.filter(ue=>!ue.gated||F.allowMemory).map(ue=>a.jsxs("li",{className:"text-[12px]",children:[a.jsxs("code",{className:"rounded bg-muted px-1 text-[11.5px]",children:["/",ue.name]})," ",a.jsx("span",{className:"text-muted-foreground",children:n(ue.en)})]},ue.name))}),a.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:n("Telegram messages are not end-to-end encrypted and stay on Telegram servers. /status, /board and /feed show titles and short summaries; /last and /sync send conversation text. Memory text and tool output never leave the app.")})]}),!F.secure&&a.jsx("p",{className:"px-1 text-[11.5px] text-warning",children:n("No system keychain available: the bot token is stored unencrypted on this machine.")})]}),F.status==="awaiting-start"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-enso":"secretary-contact-verified",className:Qm,children:[a.jsx(S7,{index:2,label:n("Bot verified")}),a.jsxs("p",{className:"mt-1 text-[13px] font-medium",children:[F.bot?.name," ",a.jsxs("span",{className:"text-muted-foreground",children:["@",F.bot?.username]})]})]}),a.jsxs("div",{"data-enso":"secretary-contact-code",className:Qm,children:[a.jsx(S7,{index:3,label:n("Open the bot and press Start")}),a.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[p&&a.jsx("img",{"data-enso":"secretary-contact-qr",src:p,alt:n("Binding QR code"),className:"size-28 shrink-0 rounded-lg bg-white p-1"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:n("Binding code")}),a.jsx("p",{"data-enso":"secretary-contact-code-value",className:"font-mono text-[22px] tracking-[0.2em] tabular-nums",children:F.bind?.code}),K?a.jsx("p",{"data-enso":"secretary-contact-code-expired",className:"mt-1 text-[11.5px] text-warning",children:n("This code has expired")}):a.jsx("p",{className:"mt-1 text-[11.5px] text-subtle-foreground",children:n("Valid for {{minutes}} more minutes",{minutes:P})})]})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.jsxs("a",{"data-enso":"secretary-contact-open-bot",href:F.bind?.link,target:"_blank",rel:"noreferrer",className:bR,children:[a.jsx(dy,{className:"size-3.5"}),n("Open @{{bot}}",{bot:F.bot?.username??""})]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-copy",className:Yc,onClick:()=>{navigator.clipboard.writeText(F.bind?.link??""),h(n("Link copied"))},children:[a.jsx(zd,{className:"size-3.5"}),n("Copy link")]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-regenerate",disabled:l,className:K?bR:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactBind(void 0,e)),children:[a.jsx(Lo,{className:"size-3.5"}),n("New code")]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-cancel",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactCancel(e)),children:n("Cancel")})]}),F.bind&&a.jsx(AVt,{bind:F.bind}),J&&F.bind?.rejected?.reason!=="private-owned"&&a.jsx("p",{"data-enso":"secretary-contact-private-owned",className:"mt-2 text-[11.5px] text-warning",children:n('Your private chat with this bot already belongs to secretary "{{owner}}". Bind this secretary to a group or forum topic instead.',{owner:J})}),a.jsx("p",{className:"mt-2 text-[11.5px] text-subtle-foreground",children:n("The code works once. Press Start in a private chat with the bot, or send it in a group or forum topic to bind that place to this secretary instead.")})]}),X]}),F.shared&&F.status!=="unbound"&&a.jsx(RVt,{shared:F.shared,bot:F.bot?.username}),F.status==="unbound"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-enso":"secretary-contact-step1",className:Qm,children:[a.jsx(S7,{index:1,label:n("Create a bot with @BotFather")}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("Send /newbot, pick a name, and copy the token it gives you.")}),a.jsxs("a",{"data-enso":"secretary-contact-botfather",href:MVt,target:"_blank",rel:"noreferrer",className:xe(PVt,"mt-2"),children:[a.jsx(dy,{className:"size-3.5"}),n("Open @BotFather")]}),a.jsx("input",{"data-enso":"secretary-contact-token",type:"password",value:o,spellCheck:!1,autoComplete:"off",placeholder:n("Paste the bot token"),onChange:ue=>i(ue.target.value),className:"mt-2 w-full rounded-lg border border-border bg-transparent px-2.5 py-1.5 font-mono text-[12px] outline-none focus:border-foreground/40"}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-verify",disabled:l||o.trim().length===0,className:xe(bR,"mt-2"),onClick:()=>M(()=>window.electronAPI.secretary.contactBind(o.trim(),e)),children:[l?a.jsx(Jn,{className:"size-3.5 animate-spin"}):a.jsx(Is,{className:"size-3.5"}),n("Verify and continue")]}),F.bot&&a.jsxs("button",{type:"button","data-enso":"secretary-contact-reconnect",disabled:l,className:xe(Yc,"mt-1.5"),onClick:()=>M(()=>window.electronAPI.secretary.contactBind(void 0,e)),children:[a.jsx(Lo,{className:"size-3.5"}),n("Bind again with @{{bot}}",{bot:F.bot.username})]})]}),a.jsx("p",{className:"px-1 text-[11.5px] text-subtle-foreground",children:n("The token is stored with the system keychain and never written to logs.")}),X]})]}),Q=ue=>M(()=>window.electronAPI.secretary.contactSettings({enabled:ue},e)),oe=t?a.jsx("div",{"data-enso":"secretary-contact-master",children:a.jsx(jn,{label:n("Enable contacts"),children:a.jsx(Yde,{checked:r.enabled,disabled:l,label:n("Enable contacts"),onCheckedChange:Q})})}):a.jsxs("div",{"data-enso":"secretary-contact-master",className:"flex items-center justify-between gap-2 border-border border-b py-2",children:[a.jsx("span",{className:"text-[13px] font-medium",children:n("Enable contacts")}),a.jsx(Yde,{checked:r.enabled,disabled:l,label:n("Enable contacts"),onCheckedChange:Q})]}),de=a.jsx(UVt,{owner:r.owner,secretaryId:e,busy:l,error:u,run:M,showHeading:!t}),ie=r.enabled?a.jsxs(a.Fragment,{children:[(te||H)&&a.jsxs("div",{"data-enso":"secretary-contact-error",className:"flex items-start gap-1.5 border-destructive border-l-2 bg-destructive/5 px-2.5 py-2 text-[12px] text-destructive",children:[a.jsx(Rf,{className:"mt-0.5 size-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1",children:n(te?_Vt[te]??"Telegram returned an error":"Cannot reach api.telegram.org. Check the proxy.")})]}),f&&a.jsxs("div",{className:"flex items-center gap-1.5 border-success border-l-2 bg-success/5 px-2.5 py-2 text-[12px] text-success",children:[a.jsx(Is,{className:"size-3.5 shrink-0"}),a.jsx("span",{children:f})]}),D.map(ue=>a.jsx(HVt,{channel:ue,collapsed:v[ue.id]===!0,busy:l,onToggle:()=>j(ue.id),onPrefs:ve=>z(ue.id,ve),onRetry:()=>B(ue.id),children:ue.id==="telegram"?ne:ue.pluginId&&ue.settingsView?a.jsx("div",{"data-enso":"secretary-contact-plugin-view",className:"h-72 overflow-hidden border-border border-y",children:a.jsx(JRe,{pluginId:ue.pluginId,entry:ue.settingsView,title:ue.title,sessionId:null})}):null},ue.id)),a.jsxs("div",{"data-enso":"secretary-contact-following",className:Qm,children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("div",{className:"text-[12.5px] font-medium",children:n("Followed from the phone: {{count}}",{count:F.following.length})}),F.following.length>0&&a.jsx("button",{type:"button","data-enso":"secretary-contact-following-clear",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactFollowing({action:"clear"},e)),children:n("Clear all")})]}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("What you dispatch or schedule from the phone keeps reporting here until it finishes or fails once, even with /sync off.")}),F.following.length>0&&a.jsx("ul",{className:"mt-1.5 flex flex-col gap-1",children:F.following.map(ue=>a.jsxs("li",{className:"flex items-start justify-between gap-2",children:[a.jsxs("span",{className:"min-w-0 flex-1 text-[12px]",children:[a.jsxs("span",{className:"text-muted-foreground",children:[ue.kind==="schedule"?n("Scheduled"):n("Session")," ·"," "]}),ue.summary]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-following-cancel",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactFollowing({action:"cancel",id:ue.id},e)),children:n("Drop")})]},ue.id))})]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-market",className:xe(Yc,t?"mt-3":"self-start"),onClick:()=>nu({category:"plugins",rowId:"plugins.enso",marketQuery:"contact"}),children:[a.jsx(su,{className:"size-3.5"}),n("Find more contact channels in the plugin market")]})]}):a.jsx("p",{className:t?"border-border border-b py-3 text-[13px] text-muted-foreground":"px-1 text-[11.5px] text-subtle-foreground",children:n("Contacts are off: nothing is sent or received on any channel.")});return t?a.jsxs("div",{"data-enso":"secretary-contact",children:[t.owner(de),t.channels(a.jsxs(a.Fragment,{children:[oe,ie]}))]}):a.jsxs("div",{"data-enso":"secretary-contact",className:"flex flex-col gap-2 px-3 py-3",children:[a.jsx("p",{className:"px-1 text-[11.5px] text-muted-foreground",children:n("Reach the secretary from your phone. Milestones go out; your replies come back.")}),oe,de,ie]})}function GVt(){try{return localStorage.getItem(r4)??void 0}catch{return}}function tMe(){const[e,t]=y.useState([]),[n,r]=y.useState(GVt),s=y.useCallback(async()=>{t(await window.electronAPI.secretary.list())},[]);y.useEffect(()=>(s(),window.electronAPI.secretary.onListChanged(t)),[s]),y.useEffect(()=>{const l=c=>{c.key===r4&&c.newValue&&r(c.newValue)};return window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]);const o=y.useCallback(l=>{r(l);try{l&&localStorage.setItem(r4,l)}catch{}},[]),i=e.find(l=>l.id===n)?.id??e[0]?.id??void 0;return{secretaries:e,setSecretaries:t,current:i,multiple:e.length>1,select:o,reload:s}}function nMe({secretaries:e,current:t,onSelect:n}){const{t:r}=Se();return e.map(s=>a.jsx("button",{type:"button","data-enso":"secretary-settings-pick","data-secretary-id":s.id,"data-selected":s.id===t||void 0,onClick:()=>n(s.id),className:xe("relative rounded-full px-2.5 py-1 text-xs ring-1 transition-colors",s.id===t?"bg-foreground/5 text-foreground ring-foreground/40":"text-muted-foreground ring-border hover:text-foreground"),children:s.name??r("Secretary")},s.id))}function WVt(){const{t:e}=Se(),{secretaries:t,current:n,multiple:r,select:s}=tMe();return a.jsxs(yi,{title:e("Contacts & owner"),description:e("Reach the secretary from your phone. Milestones go out; your replies come back."),children:[r&&a.jsx("div",{className:"mt-4 flex max-w-full flex-wrap items-center gap-1.5",children:a.jsx(nMe,{secretaries:t,current:n,onSelect:s})}),a.jsx(VVt,{secretaryId:n,frames:{owner:o=>a.jsx(Xn,{title:e("Owner identity"),rowId:"contacts.owner",children:o}),channels:o=>a.jsx(Xn,{title:e("Contact channels"),rowId:"contacts.channels",children:o})}},n??"single")]})}const qVt={body:"Body",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4–6",table:"Table",inlineCode:"Inline code",codeBlock:"Code block"},$de=YW.map(e=>({value:String(e),label:String(e)}));function YVt(){const{t:e}=Se(),t=be(c=>c.chatTypography),n=be(c=>c.setChatTypography),r=be(c=>c.resetChatTypography),[s,o]=y.useState(t.body.size);y.useEffect(()=>{o(t.body.size)},[t.body.size]);const i=(c,u)=>{const d=be.getState().chatTypography;n({...d,[c]:{...d[c],size:u}})},l=(c,u)=>{const d=be.getState().chatTypography;n({...d,[c]:{...d[c],weight:u}})};return a.jsxs(Xn,{rowId:"appearance.chatTypography",title:e("Conversation typography"),description:e("Headings, tables and inline code scale with the body text"),children:[ET.map(c=>a.jsx($Vt,{role:c,label:e(qVt[c]),size:t[c].size,weight:t[c].weight,bodyPreview:s,onPreview:c==="body"?o:void 0,onCommit:u=>i(c,u),onWeight:u=>l(c,u)},c)),a.jsx("div",{className:"flex justify-end py-2",children:a.jsx(fn,{onClick:()=>r(),children:e("Reset to defaults")})})]})}function $Vt({role:e,label:t,size:n,weight:r,bodyPreview:s,onPreview:o,onCommit:i,onWeight:l}){const c=xk[e],[u,d]=y.useState(n);y.useEffect(()=>{d(n)},[n]);const f=c.unit==="%"?`${(s*u/100).toFixed(1)}px`:void 0;return a.jsxs(jn,{label:t,children:[a.jsx("div",{className:"w-[140px] sm:w-[180px]",children:a.jsx(KK,{min:c.min,max:c.max,step:c.step,value:u,onValueChange:h=>{const p=Array.isArray(h)?h[0]:h;d(p),o?.(p)},onValueCommitted:h=>i(Array.isArray(h)?h[0]:h)})}),a.jsxs("span",{className:"shrink-0 text-right text-[12px] text-muted-foreground tabular-nums",children:[u,c.unit==="%"?"%":"px",f?` · ${f}`:""]}),a.jsxs(Ps,{items:$de,value:String(r),onValueChange:h=>{const p=Number(h);YW.includes(p)&&l(p)},children:[a.jsx(Ls,{size:"sm",className:"w-24 max-w-full","aria-label":t,children:a.jsx(Os,{})}),a.jsx(Ds,{children:$de.map(h=>a.jsx(ls,{value:h.value,children:h.label},h.value))})]})]})}function KVt({seconds:e,onCommit:t}){const{t:n}=Se(),[r,s]=y.useState(String(e));y.useEffect(()=>s(String(e)),[e]);const o=()=>{const i=Number(r);if(!Number.isInteger(i)){s(String(e));return}const l=XW(i);t(l),s(String(l))};return a.jsxs(jn,{rowId:"appearance.liveActivityFoldDelaySec",label:n("Wait before folding"),description:n("Seconds to wait after tools and thinking finish"),children:[a.jsx(En,{type:"number",min:1,max:60,value:r,onChange:i=>s(i.target.value),onBlur:o,onKeyDown:i=>{i.key==="Enter"&&(o(),i.currentTarget.blur())},className:"w-20 max-w-full"}),a.jsx("span",{className:"text-[12px] text-muted-foreground",children:n("sec")})]})}function ap({rowId:e,label:t,description:n,checked:r,onChange:s,extra:o}){return a.jsxs(jn,{rowId:e,label:t,description:n,children:[o,a.jsx($r,{checked:r,onCheckedChange:i=>s(i===!0)})]})}function XVt({revealRowId:e}={}){const{t}=Se(),n=be(M=>M.openChangesOnFileEdit),r=be(M=>M.setOpenChangesOnFileEdit),s=be(M=>M.compactReadOnlyTools),o=be(M=>M.setCompactReadOnlyTools),i=be(M=>M.expandLiveEdits),l=be(M=>M.setExpandLiveEdits),c=be(M=>M.expandLiveReasoning),u=be(M=>M.setExpandLiveReasoning),d=be(M=>M.autoCollapseTurns),f=be(M=>M.setAutoCollapseTurns),h=be(M=>M.quoteSelectionButton),p=be(M=>M.setQuoteSelectionButton),m=be(M=>M.collapseCompletedActivity),v=be(M=>M.setCollapseCompletedActivity),b=be(M=>M.collapseLiveActivity),x=be(M=>M.setCollapseLiveActivity),S=be(M=>M.liveActivityFoldDelaySec),k=be(M=>M.setLiveActivityFoldDelaySec),C=be(M=>M.pinUnfinishedTodos),A=be(M=>M.setPinUnfinishedTodos),N=be(M=>M.headerSessionTabs),j=be(M=>M.setHeaderSessionTabs),I=be(M=>M.headerRecentMinutes),_=be(M=>M.setHeaderRecentMinutes),L=M=>M===0?t("Off"):t("{{count}} min",{count:M});return a.jsxs(yi,{title:t("Conversation display"),children:[a.jsx(YVt,{}),a.jsxs(Xn,{children:[a.jsx(ap,{rowId:"appearance.openChangesOnFileEdit",label:t("Open Changes when files are edited"),description:t("Automatically show the side panel Changes tab after the agent edits a file"),checked:n,onChange:r}),a.jsx(ap,{rowId:"appearance.compactReadOnlyTools",label:t("Compact read-only tool calls"),description:t("Show read/grep/find/ls as one-line rows and fold consecutive tool calls while the agent is still running"),checked:s,onChange:o}),a.jsx(ap,{rowId:"appearance.expandLiveEdits",label:t("Expand file edits while running"),description:t("Automatically unfold diffs or written content from file modification tools while the agent is still running"),checked:i,onChange:l}),a.jsx(ap,{rowId:"appearance.expandLiveReasoning",label:t("Expand reasoning while streaming"),description:t("Automatically unfold the thinking block while the model is still reasoning. It collapses again when reasoning ends."),checked:c,onChange:u}),a.jsx(ap,{rowId:"appearance.autoCollapseTurns",label:t("Auto-collapse previous turns"),description:t("After you send a new message, fold earlier turns down to the question, timestamp and duration; the latest turn stays expanded"),checked:d,onChange:f}),a.jsx(ap,{rowId:"appearance.quoteSelectionButton",label:t("Quote button on text selection"),description:t("Show a floating Quote button when you select text in the conversation; click it to put the selection into the input box as a quote"),checked:h,onChange:p}),a.jsx(ap,{rowId:"appearance.collapseCompletedActivity",label:t("Collapse activity after reply"),description:t("When a reply finishes, fold consecutive thinking and tool calls (including edits and commands) into one summary row; failed calls stay visible"),checked:m,onChange:v}),a.jsx(ap,{rowId:"appearance.collapseLiveActivity",label:t("Collapse finished activity while replying"),description:t("While a reply is still running, wait a moment after tools and thinking finish, then fold that stretch into one row. Calls still running stay visible, and failed calls stay visible"),checked:b,onChange:x}),b||e==="appearance.liveActivityFoldDelaySec"?a.jsx(KVt,{seconds:S,onCommit:k}):null,a.jsx(ap,{rowId:"appearance.pinUnfinishedTodos",label:t("Pin unfinished todos"),description:t("Keep the latest todo list above the input while it has unfinished items, so it does not scroll away with the timeline"),checked:C,onChange:A}),a.jsx(ap,{rowId:"appearance.headerSessionTabs",label:t("Show active sessions in the title bar"),description:t("Show active conversations as tabs above the conversation. Hold ⌘/Ctrl to see number shortcuts. Hidden while Bot mode is enabled."),checked:N,onChange:j,extra:N?a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:[a.jsx("span",{className:"max-w-full text-[12px] text-muted-foreground",children:t("Also show recent conversations")}),a.jsxs(Ps,{items:Object.fromEntries(IT.map(M=>[String(M),L(M)])),value:String(I),onValueChange:M=>_(Number(M)),children:[a.jsx(Ls,{size:"sm",className:"w-28 max-w-full",children:a.jsx(Os,{})}),a.jsx(Ds,{children:IT.map(M=>a.jsx(ls,{value:String(M),children:L(M)},M))})]})]}):null})]})]})}const gA="text-muted-foreground";function QVt(){const{t:e}=Se();return a.jsxs(yi,{title:e("Devices"),children:[a.jsx(ZVt,{}),!window.electronAPI.remote&&a.jsx(JVt,{}),a.jsx(nGt,{})]})}function ZVt(){const{t:e}=Se(),[t,n]=y.useState(null),[r,s]=y.useState(null),[o,i]=y.useState(!1),[l,c]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(!1),p=t?.pairingExpiresAt;y.useEffect(()=>{if(!p){d(null);return}const x=()=>d(Math.max(0,Math.ceil((p-Date.now())/1e3)));x();const S=setInterval(x,1e3);return()=>clearInterval(S)},[p]);const m=x=>{navigator.clipboard.writeText(x).then(()=>{h(!0),setTimeout(()=>h(!1),1500)})};y.useEffect(()=>{if(!Yv())return window.electronAPI.pair.status().then(n),window.electronAPI.pair.onStatusChanged(x=>{n(x),(x.pairing||x.devices.length>0)&&c(null)})},[]),y.useEffect(()=>{const x=t?.inviteUri;if(!x){s(null);return}ZRe.toDataURL(x,{width:320,margin:1}).then(s).catch(()=>{})},[t?.inviteUri]);const v=async()=>{i(!0),c(null);const x=await window.electronAPI.pair.start();i(!1),x.ok||c(x.error??e("Failed to start pairing"))},b=t?.devices??[];return a.jsxs(Xn,{rowId:"phone.root",title:e("Allow connections"),description:e("Let your phone or another EnsoCode desktop connect to this computer. Keep this app running."),actions:t?.pairing?a.jsx(fn,{onClick:()=>{window.electronAPI.pair.cancel()},children:e("Cancel pairing")}):a.jsxs(fn,{disabled:o,onClick:()=>{v()},children:[o?a.jsx(Jn,{className:"h-4 w-4 animate-spin"}):a.jsx(yT,{className:"h-4 w-4"}),e("Generate pairing code")]}),children:[t&&!t.secureStorage&&a.jsx(rMe,{}),l&&a.jsx("p",{className:"border-border border-b py-3 text-xs text-destructive",children:l}),t?.pairing&&a.jsxs("div",{className:"border-border border-b py-4 text-center",children:[r?a.jsx("img",{src:r,alt:e("Pairing QR code"),className:"mx-auto h-52 w-52"}):a.jsx(Jn,{className:"mx-auto h-5 w-5 animate-spin text-muted-foreground"}),a.jsx("p",{className:"mt-3 font-medium text-sm",children:e("Scan with your phone camera")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("Scanning opens the app and pairs it. To keep it handy, add it to your home screen.")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("On another EnsoCode desktop, paste the link below into Settings → Devices → Connect to a node.")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:u===null?e("The code expires in 60 seconds and can only be used once."):u>0?e("Expires in {{seconds}}s · single use",{seconds:u}):e("Code expired")}),t.inviteUri&&a.jsxs("div",{className:"mt-3 flex items-center gap-2 text-left",children:[a.jsx("code",{className:"min-w-0 flex-1 truncate bg-muted px-2 py-1.5 font-mono text-[11px] text-muted-foreground",children:t.inviteUri}),a.jsxs(fn,{className:"shrink-0",onClick:()=>m(t.inviteUri),children:[f?a.jsx(Is,{className:"h-3.5 w-3.5"}):a.jsx(zd,{className:"h-3.5 w-3.5"}),e(f?"Copied":"Copy")]})]})]}),a.jsx("p",{className:"border-border border-b py-3 font-medium text-[13px]",children:e("Paired devices")}),b.length===0?a.jsxs("div",{className:"border-border border-b py-8 text-center",children:[a.jsx(yT,{className:"mx-auto h-5 w-5 text-muted-foreground"}),a.jsx("p",{className:"mt-3 font-medium text-sm",children:e("No paired devices")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("Generate a pairing code to let a phone or another desktop connect.")})]}):b.map(x=>a.jsx(eGt,{device:x},x.pairId))]})}function rMe(){const{t:e}=Se();return a.jsxs("p",{className:"flex items-start gap-2 border-border border-b py-3 text-xs text-muted-foreground",children:[a.jsx(Nd,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),a.jsx("span",{children:e("Secure storage is unavailable on this system, so pairing keys are stored unencrypted.")})]})}function JVt(){const{t:e}=Se(),t=jd(i=>i.nodes),n=jd(i=>i.secureStorage),r=jd(i=>i.refresh),[s,o]=y.useState(!1);return y.useEffect(()=>jd.getState().bind(),[]),a.jsxs(Xn,{title:e("Connect to a node"),description:e("Browse and drive conversations on another EnsoCode desktop. Its agent, keys and history stay there."),actions:a.jsxs(fn,{onClick:()=>o(!0),children:[a.jsx(xs,{className:"h-4 w-4"}),e("Connect to a node")]}),children:[!n&&a.jsx(rMe,{}),a.jsx("p",{className:"border-border border-b py-3 font-medium text-[13px]",children:e("Connected nodes")}),t.length===0?a.jsxs("div",{className:"border-border border-b py-8 text-center",children:[a.jsx(e_,{className:"mx-auto h-5 w-5 text-muted-foreground"}),a.jsx("p",{className:"mt-3 font-medium text-sm",children:e("No connected nodes")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("Each connecting computer needs its own pairing code from the other desktop.")})]}):t.map(i=>a.jsx(tGt,{node:i,onChanged:()=>{r()}},i.nodeId)),a.jsx(wRe,{open:s,onOpenChange:o,switchOnSuccess:!1})]})}function sMe({transport:e,rttMs:t}){const{t:n}=Se(),r=e==="direct",s=cRe(t);return a.jsxs("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-[10px] leading-none",r?"bg-success/15 text-success":"bg-muted text-muted-foreground"),children:[n(r?"Direct link":"Via relay"),s?` · ${s}`:""]})}function eGt({device:e}){const{t}=Se(),[n,r]=y.useState(null),s=async()=>{n!==null&&(n.trim()&&n.trim()!==e.deviceName&&await window.electronAPI.pair.rename(e.pairId,n),r(null))};return a.jsxs("div",{className:"group flex flex-wrap items-center justify-between gap-3 border-border border-b py-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a.jsx("span",{className:xe("h-2 w-2 shrink-0 rounded-full",e.phoneOnline?"bg-success":e.connected?"bg-warning":"bg-muted-foreground/40")}),n===null?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"truncate font-medium text-sm",children:e.deviceName}),a.jsx("span",{className:"shrink-0 text-muted-foreground text-xs",children:e.phoneOnline?t("Online"):e.connected?t("Waiting for device"):t("Offline")}),e.phoneOnline&&a.jsx(sMe,{transport:e.transport,rttMs:e.rttMs}),a.jsx("button",{type:"button",title:t("Click to switch: view-only devices cannot send, approve or stop."),onClick:()=>{window.electronAPI.pair.setScope(e.pairId,e.scope==="read"?"operate":"read")},className:xe("relative shrink-0 rounded px-1.5 py-0.5 text-[10px] leading-none transition-colors",e.scope==="read"?"bg-warning/15 text-warning hover:bg-warning/25":"bg-muted text-muted-foreground hover:bg-accent"),children:e.scope==="read"?t("View only"):t("Can operate")})]}):a.jsx(En,{value:n,autoFocus:!0,onChange:o=>r(o.target.value),onBlur:()=>{s()},onKeyDown:o=>{o.key==="Enter"&&s(),o.key==="Escape"&&r(null)},className:"h-7 w-full max-w-full text-sm sm:w-[220px]"})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity pointer-coarse:opacity-100 group-hover:opacity-100",children:[a.jsx(Ke,{variant:"ghost",size:"icon",className:gA,title:t("Rename"),onClick:()=>r(e.deviceName),children:a.jsx(Pi,{className:"h-3.5 w-3.5"})}),a.jsx(Ke,{variant:"ghost",size:"icon",className:xe(gA,"hover:text-destructive"),onClick:()=>{window.electronAPI.pair.revoke(e.pairId)},children:a.jsx(io,{className:"h-3.5 w-3.5"})})]})]})}function tGt({node:e,onChanged:t}){const{t:n}=Se(),[r,s]=y.useState(null),o=async()=>{r!==null&&(r.trim()&&r.trim()!==e.label&&(await window.electronAPI.nodes.rename(e.nodeId,r),t()),s(null))};return a.jsxs("div",{className:"group flex flex-wrap items-center justify-between gap-3 border-border border-b py-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a.jsx(LV,{node:e}),r===null?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"truncate font-medium text-sm",children:e.label}),e.hostname&&e.hostname!==e.label&&a.jsx("span",{className:"shrink-0 truncate font-mono text-[10px] text-muted-foreground",children:e.hostname}),a.jsx("span",{className:"shrink-0 text-muted-foreground text-xs",children:e.hostOnline?n("Online"):e.connected?n("Remote desktop is offline"):n("Offline")}),e.hostOnline&&a.jsx(sMe,{transport:e.transport,rttMs:e.rttMs})]}):a.jsx(En,{value:r,autoFocus:!0,onChange:i=>s(i.target.value),onBlur:()=>{o()},onKeyDown:i=>{i.key==="Enter"&&o(),i.key==="Escape"&&s(null)},className:"h-7 w-full max-w-full text-sm sm:w-[220px]"})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity pointer-coarse:opacity-100 group-hover:opacity-100",children:[a.jsx(Ke,{variant:"ghost",size:"icon",className:gA,title:n("Rename"),onClick:()=>s(e.label),children:a.jsx(Pi,{className:"h-3.5 w-3.5"})}),a.jsx(Ke,{variant:"ghost",size:"icon",className:xe(gA,"hover:text-destructive"),title:n("Disconnect"),onClick:()=>{window.electronAPI.nodes.remove(e.nodeId).then(t)},children:a.jsx(io,{className:"h-3.5 w-3.5"})})]})]})}function nGt(){const{t:e}=Se(),[t,n]=y.useState(null),[r,s]=y.useState(null);y.useEffect(()=>(window.electronAPI.pair.status().then(n),window.electronAPI.pair.onStatusChanged(n)),[]);const o=async()=>{r!==null&&(n(await window.electronAPI.pair.setRelayUrl(r)),s(null))};return a.jsx(Xn,{children:a.jsxs(jn,{label:e("Relay server"),description:e("The relay only forwards encrypted frames and cannot read your messages."),children:[a.jsx(En,{value:r??t?.relayUrl??"",onChange:i=>s(i.target.value),placeholder:"https://relay.example.com",className:"w-full font-mono text-xs sm:w-[220px]"}),r===null?a.jsx(Ke,{variant:"ghost",size:"icon-sm",className:gA,onClick:()=>s(t?.relayUrl??""),children:a.jsx(Pi,{className:"h-3.5 w-3.5"})}):a.jsxs(fn,{variant:"default",onClick:()=>{o()},children:[a.jsx(Is,{className:"h-3.5 w-3.5"}),e("Save")]})]})})}function rGt({onOpenBots:e}){const{t}=Se(),n=be(f=>f.botModeEnabled),r=be(f=>f.setBotModeEnabled),s=be(f=>f.scratchSessionsEnabled),o=be(f=>f.setScratchSessionsEnabled),i=be(f=>f.dropShelfEnabled),l=be(f=>f.setDropShelfEnabled),c=be(f=>f.secretaryEnabled),u=be(f=>f.setSecretaryEnabled),d=window.electronAPI.env.platform==="darwin"&&!window.electronAPI.remote;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-medium",children:t("Experimental")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:t("Features still being tested. They may change or be removed.")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(jn,{rowId:"experimental.botMode",label:t("Bot mode"),description:t("Adds a Code | Bot switch to the sidebar. Create members with their own persona, model and tools, and chat with them alone or in groups."),children:a.jsx($r,{checked:n,onCheckedChange:r})}),n&&a.jsx(Ke,{variant:"outline",size:"sm",onClick:e,children:t("Bot mode settings")}),a.jsx(jn,{rowId:"experimental.scratchSessions",label:t("Temporary chats"),description:t("Chats that are not tied to a project. Tools follow your global settings."),children:a.jsx($r,{checked:s,onCheckedChange:o})}),d&&a.jsx(jn,{rowId:"experimental.dropShelf",label:t("Drop shelf"),description:t("When you drag files in Finder, a small panel appears at the top right of the screen. Drop them on it to reference them in the current conversation, or drop folders to open them as projects, even when EnsoCode is minimized or in the tray."),children:a.jsx($r,{checked:i,onCheckedChange:l})}),a.jsx(jn,{rowId:"experimental.secretary",label:t("Secretary"),description:t("A global agent that watches your projects and sessions, creates sessions to do the work, and reports results back to you."),children:a.jsx($r,{checked:c,onCheckedChange:u})})]})]})}const sGt=["pem","crt","cer"],oGt=[{category:"providers",label:"Model Providers"},{category:"presets",label:"Presets"},{category:"agentTypes",label:"Agent types"},{category:"skills",label:"Skills"},{category:"mcpServers",label:"MCP Servers"},{category:"instructions",label:"Instruction Files"},{category:"subagentModels",label:"Subagent Models"},{category:"settings",label:"Scalar settings"}];function iGt(){const{t:e}=Se(),[t,n]=y.useState(!1),[r,s]=y.useState(!1),[o,i]=y.useState(null),[l,c]=y.useState(null),u=()=>{i(null),n(!0)},d=async()=>{s(!0),i(null);try{const f=await window.electronAPI.configSync.openImport();if(!f.ok){i({kind:f.cancelled?"cancelled":"error",text:f.cancelled?e("Import cancelled."):e(f.error)});return}c(f)}catch{i({kind:"error",text:e("Could not open configuration package.")})}finally{s(!1)}};return a.jsxs(Xn,{rowId:"general.configSync",title:e("Configuration transfer"),description:e("Move models, presets, agent types, skills, MCP servers and instruction files between devices."),children:[a.jsxs(jn,{label:e("Portable Enso configuration"),description:a.jsxs(a.Fragment,{children:[e("Export a package or preview one before importing it.")," ",e("OAuth login sessions are never transferred. Skill, instruction, and system prompt contents require an encrypted export.")]}),children:[a.jsxs(fn,{disabled:r,onClick:()=>{d()},children:[r?a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Lf,{className:"h-3.5 w-3.5"}),e("Import configuration")]}),a.jsxs(fn,{variant:"default",disabled:r,onClick:u,children:[a.jsx(Rxe,{className:"h-3.5 w-3.5"}),e("Export configuration")]})]}),o&&a.jsx("p",{className:o.kind==="error"?"border-border border-b py-2 text-[12px] text-destructive":"border-border border-b py-2 text-[12px] text-muted-foreground",role:o.kind==="error"?"alert":"status",children:o.text}),a.jsx(aGt,{open:t,onOpenChange:n}),l&&a.jsx(lGt,{file:l,onClose:()=>c(null)})]})}function aGt({open:e,onOpenChange:t}){const{t:n}=Se(),[r,s]=y.useState(!1),[o,i]=y.useState(""),[l,c]=y.useState(""),[u,d]=y.useState(!1),[f,h]=y.useState(null),[p,m]=y.useState(!1),[v,b]=y.useState(null),[x,S]=y.useState([]);y.useEffect(()=>{e&&(s(!1),i(""),c(""),d(!1),h(null),m(!1),b(null),S([]))},[e]);const k=()=>{u||(i(""),c(""),t(!1))},C=async()=>{if(r&&o.length<8){h(n("Password must be at least 8 characters."));return}if(r&&o!==l){h(n("Passwords do not match."));return}d(!0),h(null),m(!1);try{const A=await window.electronAPI.configSync.exportConfig({includeSecrets:r,...r?{password:o}:{}});if(i(""),c(""),!A.ok){A.cancelled?m(!0):h(n(A.error));return}b(A.filePath),S(A.skippedInstructions??[])}catch{i(""),c(""),h(n("Could not export configuration."))}finally{d(!1)}};return a.jsx(gr,{open:e,onOpenChange:A=>!A&&k(),children:a.jsxs(vr,{className:"max-w-xl",showCloseButton:!u,children:[a.jsxs(xr,{children:[a.jsx(dr,{children:n("Export configuration")}),a.jsx(oo,{children:n("Create a portable .enso-config package for another device.")})]}),a.jsx(rr,{className:"max-h-[55vh] space-y-4",children:v?a.jsxs(a.Fragment,{children:[a.jsxs(kd,{variant:"success",children:[a.jsx(By,{}),a.jsx(Rw,{children:n("Configuration exported")}),a.jsxs(Sd,{children:[a.jsx("p",{children:n("Saved package:")}),a.jsx("p",{className:"break-all font-mono text-xs text-foreground",children:v})]})]}),x.length>0&&a.jsxs(kd,{variant:"warning",children:[a.jsx(Nd,{}),a.jsxs(Sd,{children:[a.jsx("p",{children:n("These instructions were skipped because their source files are missing or unreadable:")}),a.jsx("p",{className:"break-all text-foreground",children:x.join(", ")})]})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs(kd,{variant:"warning",children:[a.jsx(Rf,{}),a.jsx(Rw,{children:n("File contents can be private")}),a.jsx(Sd,{children:n("Skill and instruction file contents may contain private data, so configurations containing them can only be exported with encryption.")})]}),a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 border-border border-b py-3",children:[a.jsx(yo,{checked:r,onCheckedChange:A=>{const N=A===!0;s(N),h(null),N||(i(""),c(""))}}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block text-sm font-medium",children:n("Include sensitive configuration")}),a.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:n("Encrypt the entire package with a password. OAuth login sessions are still excluded.")})]})]}),!r&&a.jsxs(kd,{variant:"info",children:[a.jsx(gg,{}),a.jsx(Sd,{children:n("API keys, provider account links, MCP arguments and environment values, plus credentials and private URL parts in MCP endpoints, will be omitted. Configurations containing skill or instruction files require encryption.")})]}),r&&a.jsxs("div",{className:"space-y-3 border-border border-t py-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a.jsx(yxe,{className:"h-4 w-4 text-muted-foreground"}),n("Encryption password")]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(aV,{htmlFor:"config-export-password",children:n("Password")}),a.jsx(En,{id:"config-export-password",type:"password",autoComplete:"new-password",value:o,"aria-invalid":!!(f&&o.length<8),onChange:A=>{i(A.target.value),h(null)}})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(aV,{htmlFor:"config-export-confirmation",children:n("Confirm password")}),a.jsx(En,{id:"config-export-confirmation",type:"password",autoComplete:"new-password",value:l,"aria-invalid":!!(f&&l!==o),onChange:A=>{c(A.target.value),h(null)}})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:n("Use at least 8 characters. This password cannot be recovered.")})]}),p&&a.jsx("p",{className:"text-xs text-muted-foreground",role:"status",children:n("Export cancelled.")}),f&&a.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-destructive",role:"alert",children:[a.jsx(qa,{className:"h-3.5 w-3.5 shrink-0"}),f]})]})}),a.jsx(Wr,{children:v?a.jsx(Ke,{size:"sm",onClick:k,children:n("Done")}):a.jsxs(a.Fragment,{children:[a.jsx(Ke,{variant:"outline",size:"sm",disabled:u,onClick:k,children:n("Cancel")}),a.jsxs(Ke,{size:"sm",disabled:u,onClick:()=>{C()},children:[u?a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Rxe,{className:"h-3.5 w-3.5"}),n(u?"Exporting…":"Export")]})]})})]})})}function lGt({file:e,onClose:t}){const{t:n}=Se(),[r,s]=y.useState(e.encrypted?"password":"preview"),[o,i]=y.useState(""),[l,c]=y.useState("merge"),[u,d]=y.useState(null),[f,h]=y.useState([]),[p,m]=y.useState(null),[v,b]=y.useState(!1),[x,S]=y.useState(null),[k,C]=y.useState(null),[A,N]=y.useState(!1),j=y.useRef(0),I=y.useCallback(async(R,z)=>{const B=++j.current;S("preview"),C(null),d(null),h([]);try{const H=await window.electronAPI.configSync.previewImport({token:e.token,mode:R,...z?{password:z}:{}});if(B!==j.current)return;if(i(""),!H.ok){C(n(H.error));return}c(H.mode),d(H.summary),h(H.warnings),s("preview")}catch{B===j.current&&(i(""),C(n("Could not preview configuration package.")))}finally{B===j.current&&S(null)}},[e.token,n]);y.useEffect(()=>{e.encrypted||I("merge")},[e.encrypted,I]);const _=()=>{x||(j.current+=1,N(!1),i(""),window.electronAPI.configSync.cancelImport(e.token).catch(()=>{}),t())},L=R=>{R===l||x||(c(R),I(R))},M=!!u?.some(R=>(R.category==="skills"||R.category==="mcpServers")&&R.added+R.updated+R.skipped>0),F=u!==null,D=async()=>{if(u){S("commit"),C(null);try{const R=await window.electronAPI.configSync.commitImport({token:e.token,mode:l});if(!R.ok){d(null),h([]),C(n(R.error));return}i("");try{await be.persist.rehydrate()}catch{b(!0)}h(R.warnings),m(R.backupPath),s("success")}catch{d(null),h([]),C(n("Could not import configuration."))}finally{S(null)}}};return a.jsxs(gr,{open:!0,onOpenChange:R=>!R&&_(),children:[a.jsxs(vr,{className:"max-w-2xl",showCloseButton:x===null,children:[a.jsxs(xr,{children:[a.jsx(dr,{children:n(r==="success"?"Configuration imported":"Import configuration")}),a.jsx(oo,{children:r==="success"?n(v?"Configuration was imported, but this window could not refresh automatically.":"This window has been refreshed with the imported settings."):n("Review {{fileName}} before changing this device.",{fileName:e.fileName})})]}),r==="password"&&a.jsxs(rr,{className:"space-y-4",children:[a.jsxs(kd,{variant:"info",children:[a.jsx(yxe,{}),a.jsx(Rw,{children:n("Encrypted configuration package")}),a.jsx(Sd,{children:n("Enter the export password to decrypt and preview this package.")})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(aV,{htmlFor:"config-import-password",children:n("Password")}),a.jsx(En,{id:"config-import-password",type:"password",autoFocus:!0,autoComplete:"current-password",value:o,"aria-invalid":!!k,onChange:R=>{i(R.target.value),C(null)},onKeyDown:R=>{R.key==="Enter"&&o.length>0&&!x&&I("merge",o)}})]}),k&&a.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-destructive",role:"alert",children:[a.jsx(qa,{className:"h-3.5 w-3.5 shrink-0"}),k]})]}),r==="preview"&&a.jsxs(rr,{className:"max-h-[58vh] space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium",children:n("Import mode")}),a.jsxs(lRe,{value:l,onValueChange:R=>L(R),className:"grid gap-2 sm:grid-cols-2","aria-label":n("Import mode"),children:[a.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 border-border border-b py-3",children:[a.jsx(PV,{value:"merge",disabled:x!==null}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:n("Merge")}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:n("Add and update matching items while keeping items only on this device.")})]})]}),a.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 border-border border-b py-3",children:[a.jsx(PV,{value:"replace",disabled:x!==null}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:n("Replace")}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:n("Replace transferred item categories, removing local-only items in them.")})]})]})]})]}),x==="preview"&&a.jsxs("div",{className:"flex items-center justify-center gap-2 py-6",children:[a.jsx(Jn,{className:"h-4 w-4 animate-spin text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:n("Preparing preview…")})]}),!x&&u&&a.jsx("div",{className:"min-w-0 overflow-x-auto",children:a.jsxs("table",{className:"w-max min-w-full text-sm",children:[a.jsx("thead",{className:"text-xs text-muted-foreground",children:a.jsxs("tr",{className:"border-border border-b",children:[a.jsx("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:n("Category")}),a.jsx("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:n("Added")}),a.jsx("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:n("Updated")}),a.jsx("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:n("Skipped")}),a.jsx("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:n("Removed")})]})}),a.jsx("tbody",{children:oGt.map(({category:R,label:z})=>{const B=u.find(H=>H.category===R);return a.jsxs("tr",{className:"border-border border-t",children:[a.jsx("th",{scope:"row",className:"px-3 py-2 text-left font-medium",children:n(z)}),a.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:B?.added??0}),a.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:B?.updated??0}),a.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:B?.skipped??0}),a.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:B?.removed??0})]},R)})})]})}),!x&&u?.find(R=>R.category==="settings")?.fields?.length?a.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("Portable settings changed:")," ",u.find(R=>R.category==="settings")?.fields?.join(", ")]}):null,l==="replace"&&u&&!x&&a.jsxs(kd,{variant:"error",children:[a.jsx(Nd,{}),a.jsx(Rw,{children:n("Local-only configuration will be deleted")}),a.jsx(Sd,{children:n("Items in transferred collections that exist only on this device will be removed. Removed counts are shown above. Included portable preferences are overwritten. A complete backup is created first.")})]}),f.map(R=>a.jsxs(kd,{variant:"warning",children:[a.jsx(Nd,{}),a.jsx(Sd,{children:n(R)})]},R)),u&&!x&&a.jsxs(kd,{variant:"warning",children:[a.jsx(Rf,{}),a.jsx(Rw,{children:n("Only import packages you trust")}),a.jsx(Sd,{children:n("An imported package can change portable preferences and configuration. Skills and MCP servers may also run commands later when you use them. Previewing does not execute them; continue only if you trust the package.")})]}),k&&a.jsxs(kd,{variant:"error",children:[a.jsx(qa,{}),a.jsx(Sd,{children:k})]})]}),r==="success"&&p&&a.jsxs(rr,{className:"space-y-4",children:[a.jsxs(kd,{variant:"success",children:[a.jsx(By,{}),a.jsx(Rw,{children:n("Import complete")}),a.jsxs(Sd,{children:[a.jsx("p",{children:n("Backup of previous settings:")}),a.jsx("p",{className:"break-all font-mono text-xs text-foreground",children:p})]})]}),v&&a.jsxs(kd,{variant:"warning",children:[a.jsx(Nd,{}),a.jsx(Sd,{children:n("Reopen Settings to load the imported configuration in this window.")})]}),f.map(R=>a.jsxs(kd,{variant:"warning",children:[a.jsx(Nd,{}),a.jsx(Sd,{children:n(R)})]},R))]}),a.jsxs(Wr,{children:[r==="password"&&a.jsxs(a.Fragment,{children:[a.jsx(Ke,{variant:"outline",size:"sm",disabled:x!==null,onClick:_,children:n("Cancel")}),a.jsxs(Ke,{size:"sm",disabled:x!==null||o.length===0,onClick:()=>{I("merge",o)},children:[x==="preview"&&a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin"}),n("Preview")]})]}),r==="preview"&&a.jsxs(a.Fragment,{children:[a.jsx(Ke,{variant:"outline",size:"sm",disabled:x!==null,onClick:_,children:n("Cancel")}),k&&!u?a.jsx(Ke,{size:"sm",disabled:x!==null,onClick:()=>{I(l)},children:n("Refresh preview")}):a.jsxs(Ke,{variant:l==="replace"?"destructive":"default",size:"sm",disabled:x!==null||!u,onClick:()=>{u&&(F?N(!0):D())},children:[x==="commit"?a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Lf,{className:"h-3.5 w-3.5"}),n(x==="commit"?"Importing…":"Import")]})]}),r==="success"&&a.jsx(Ke,{size:"sm",onClick:_,children:n("Done")})]})]}),a.jsx(cGt,{open:A,mode:l,hasImportedExecutableResources:M,onOpenChange:N,onConfirm:()=>{D()}})]})}function cGt({open:e,mode:t,hasImportedExecutableResources:n,onOpenChange:r,onConfirm:s}){const{t:o}=Se();return a.jsx(Zp,{open:e,onOpenChange:r,children:a.jsxs(Jp,{className:"sm:max-w-md",zIndexLevel:"nested",children:[a.jsxs(em,{children:[a.jsxs(nm,{className:"flex items-start gap-2 text-base",children:[a.jsx(Nd,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),o("Confirm configuration import")]}),a.jsxs(rm,{className:"space-y-2",children:[a.jsx("span",{className:"block",children:o("This package can change portable preferences and configuration. Continue only if you trust this package.")}),n&&a.jsx("span",{className:"block",children:o("It includes skills or MCP servers that may execute commands when you use them.")}),t==="replace"&&a.jsx("span",{className:"block",children:o("Replace mode removes local-only items from transferred collections and overwrites included portable preferences. A complete backup will be created first.")}),a.jsx("span",{className:"block",children:o("Do you want to continue with this import?")})]})]}),a.jsxs(tm,{variant:"bare",children:[a.jsx(dx,{render:a.jsx(Ke,{variant:"outline",size:"sm"}),children:o("Cancel")}),a.jsx(Ke,{variant:t==="replace"?"destructive":"default",size:"sm",onClick:()=>{r(!1),s()},children:o("Confirm import")})]})]})})}function uGt({className:e,...t}){const n=Dg();return a.jsx(En,{size:"sm",...n,...t,className:xe("w-[220px] max-w-full",e)})}function dGt(){const{language:e,setLanguage:t}=be(),{t:n}=Se();return a.jsxs(yi,{title:n("General"),description:n("General application settings"),children:[a.jsxs(Xn,{title:n("Application"),children:[a.jsx(jn,{rowId:"general.language",label:n("Language"),children:a.jsx(Zo,{value:e,onValueChange:t,options:[{value:"en",label:"English"},{value:"zh",label:"简体中文"}]})}),a.jsx(fGt,{})]}),a.jsxs(Xn,{title:n("Network"),children:[a.jsx(hGt,{}),a.jsx(pGt,{})]}),a.jsx(iGt,{}),a.jsx(gGt,{}),window.electronAPI.env.platform==="darwin"&&a.jsxs(Xn,{title:n("Integrations"),children:[a.jsx(Kde,{kind:"ensoCommand",title:n("'enso' terminal command"),description:n("Run `enso .` in a terminal to open the current folder in EnsoCode. Links the command into /usr/local/bin and may ask for your password.")}),a.jsx(Kde,{kind:"finderQuickAction",title:n("Finder Quick Action"),description:n("Right-click a folder in Finder and choose Services > Open with EnsoCode.")})]})]})}function Kde({kind:e,title:t,description:n}){const{t:r}=Se(),[s,o]=y.useState(!1),[i,l]=y.useState(!1);y.useEffect(()=>{let u=!0;const d=()=>{Yv()||window.electronAPI.window.shellIntegrationStatus().then(f=>{u&&o(f[e])})};return d(),window.addEventListener("focus",d),()=>{u=!1,window.removeEventListener("focus",d)}},[e]);const c=async()=>{l(!0);try{await window.electronAPI.window.installShellIntegration(e)}finally{try{const u=await window.electronAPI.window.shellIntegrationStatus();o(u[e])}finally{l(!1)}}};return a.jsx(jn,{rowId:`general.${e}`,label:t,description:n,children:a.jsx(fn,{disabled:i,onClick:()=>{c()},children:r(i?"In progress…":s?"Uninstall":"Install")})})}function fGt(){const{t:e}=Se(),t=be(r=>r.notifyMainAgentOnly),n=be(r=>r.setNotifyMainAgentOnly);return a.jsx(jn,{rowId:"general.notifyMainAgentOnly",label:e("Notify only for the main agent"),description:e("Skip coworker completion and failure notifications on this computer and the paired phone. Questions and approvals still notify."),children:a.jsx($r,{checked:t,onCheckedChange:n})})}function Xde(e,t){window.electronAPI.proxy.apply({mode:e,customUrl:t})}function hGt(){const{t:e}=Se(),t=be(f=>f.proxyMode),n=be(f=>f.customProxyUrl),r=be(f=>f.setProxyMode),s=be(f=>f.setCustomProxyUrl),[o,i]=y.useState(n),[l,c]=y.useState(null);y.useEffect(()=>{i(n)},[n]);const u=f=>{r(f),Xde(f,n)},d=()=>{const f=o.trim();if(f&&!eq(f)){c(e("Enter an http(s) proxy URL"));return}c(null),s(f),Xde(t,f)};return a.jsxs("div",{"data-settings-row":"general.proxy",children:[a.jsx(jn,{label:e("Network proxy"),description:e("Used by model requests, the built-in browser, and agent tools"),children:a.jsx(Zo,{value:t,onValueChange:u,options:[{value:"system",label:e("Follow system proxy")},{value:"none",label:e("No proxy")},{value:"custom",label:e("Custom proxy")}]})}),t==="custom"&&a.jsx(jn,{label:e("Proxy URL"),children:a.jsxs("div",{className:"flex w-full max-w-[220px] flex-col items-end gap-1",children:[a.jsx(uGt,{value:o,placeholder:"http://127.0.0.1:7890",onChange:f=>i(f.target.value),onBlur:d,onKeyDown:f=>{f.key==="Enter"&&d()}}),l&&a.jsx("p",{className:"text-right text-[12px] text-destructive",children:l})]})})]})}function pGt(){const{t:e}=Se(),t=be(f=>f.customCaCertPath),n=be(f=>f.setCustomCaCertPath),[r,s]=y.useState(null),[o,i]=y.useState(!1);y.useEffect(()=>{let f=!0;return window.electronAPI.caCert.status().then(h=>{f&&s(h)}).catch(()=>{}),()=>{f=!1}},[]);const l=async f=>{n(f),i(!0);try{s(await window.electronAPI.caCert.apply(f))}catch{}finally{i(!1)}},c=async()=>{const f=await window.electronAPI.dialog.selectFile([...sGt]);f&&await l(f)},u={"not-absolute":e("Path must be absolute"),"not-found":e("File not found"),"not-file":e("Not a file"),"not-readable":e("File is not readable")},d=()=>r?r.source==="env"?e("Using NODE_EXTRA_CA_CERTS from the launch environment: {{path}}",{path:r.path}):r.source==="setting"?e("Set: {{path}}",{path:r.path}):r.source==="shell"?e("Not set; using NODE_EXTRA_CA_CERTS from the login shell: {{path}}",{path:r.path}):e("Not set"):"";return a.jsxs(jn,{rowId:"general.caCert",label:e("Custom CA certificate"),description:a.jsxs(a.Fragment,{children:[e("Trust an extra CA (PEM file) for model endpoints signed by a private CA. TLS verification stays on."),r?.error?a.jsx("span",{className:"mt-1 block break-all text-destructive",children:e("Certificate file unavailable ({{reason}}): {{path}}",{reason:u[r.error],path:r.settingPath})}):d()&&a.jsx("span",{className:"mt-1 block break-all",children:d()}),a.jsx("span",{className:"mt-1 block",children:e("Changes restart the agent process right away (running turns are interrupted). Requests made by the app main process take effect after restarting the app.")})]}),children:[a.jsx(fn,{disabled:o,onClick:()=>{c()},children:e("Choose certificate file")}),t&&a.jsx(fn,{variant:"ghost",disabled:o,onClick:()=>{l("")},children:e("Clear")})]})}function mGt(e,t,n){return e==="npm"?n("Server updates install the new version with npm and restart gracefully: running tasks finish first (up to a limit), then the server restarts and tasks resume."):a.jsxs(a.Fragment,{children:[n("This server must be updated on the machine itself."),a.jsxs("code",{"data-server-manual-command":!0,className:"mt-0.5 block",children:["npm i -g ",Vqe(t)]})]})}const Qde="0.3.15-beta.239";function gGt(){const{t:e}=Se(),t=be(N=>N.autoUpdate),n=be(N=>N.setAutoUpdate),r=be(N=>N.autoRestartForUpdate),s=be(N=>N.setAutoRestartForUpdate),o=be(N=>N.updateChannel==="beta"?"beta":"stable"),i=be(N=>N.setUpdateChannel),[l,c]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(!1),[p,m]=y.useState(!1);y.useEffect(()=>{let N=!0;window.electronAPI.updater.getState().then(I=>{N&&(d(I),I.status&&c(_=>_??I.status))}).catch(()=>{});const j=window.electronAPI.updater.onStatus(c);return()=>{N=!1,j()}},[]);const v=u?.host==="server"?u:null,b=u?.host==="desktop"||v!==null&&v.mode!=="manual",x=(l?.status==="available"||l?.status==="downloaded")&&!!l.info,S=l?.status==="applying",C=(()=>{if(!l)return null;switch(l.status){case"checking":return e("Checking for updates…");case"available":return l.manualInstall?e("New version {{version}} found. This local build can't install it automatically.",{version:l.info?.version??""}):e("New version {{version}} found",{version:l.info?.version??""});case"not-available":return e("You are on the latest version");case"downloading":return e("Downloading update… {{percent}}%",{percent:Math.round(l.progress?.percent??0)});case"downloaded":return v?.restartMethod==="manual"?e("New version {{version}} is downloaded. Applying it installs and then stops the server — you will need to restart it externally (container or process manager).",{version:l.info?.version??""}):e("New version {{version}} is downloaded. Restarting waits for the current tool to finish; background commands keep running.",{version:l.info?.version??""});case"applying":{const N=l.applying?.stage;return N==="waiting-tasks"?e("Waiting for {{count}} running tasks to finish before installing…",{count:l.applying?.busyCount??0}):N==="installing"?e("Installing {{version}}…",{version:l.info?.version??""}):e("Restarting server…")}case"error":return l.manualInstall?e("This local build is signed differently from the release and can't install updates automatically. Download it manually."):v&&l.error?e("Update failed: {{error}}",{error:l.error}):e("Update check failed");default:return null}})(),A=l?.status==="checking"||l?.status==="downloading";return a.jsxs(Xn,{rowId:"general.updates",title:e("Updates"),description:v?mGt(v.mode,o,e):e("Application update settings"),children:[a.jsxs(jn,{label:a.jsxs(a.Fragment,{children:[e("Current version")," · ",Qde]}),description:C?a.jsx("span",{className:xe("block",!l?.manualInstall&&"truncate"),children:C}):void 0,children:[x&&a.jsx(fn,{variant:"ghost",onClick:()=>m(!0),children:e("Release notes")}),l?.manualInstall?a.jsx(UY,{manualInstall:l.manualInstall}):S?a.jsx(fn,{variant:"default",disabled:!0,children:e("Updating…")}):l?.status==="downloaded"?a.jsx(fn,{variant:"default",onClick:()=>{Q$(e)},children:e("Restart to update")}):b&&l?.status==="available"?a.jsx(fn,{variant:"default",onClick:()=>{window.electronAPI.updater.downloadUpdate()},children:e("Download update")}):a.jsx(fn,{disabled:A,onClick:()=>{window.electronAPI.updater.checkForUpdates()},children:e("Check for updates")}),a.jsx(mAe,{open:p,onOpenChange:m,status:l,canDownload:b})]}),v?.canRestart&&a.jsxs(jn,{label:e("Restart server"),description:e("Running tasks are interrupted; this page reconnects after the server is back."),children:[a.jsx(fn,{onClick:()=>h(!0),children:e("Restart")}),a.jsx(ec,{open:f,onOpenChange:h,title:e("Restart server?"),description:e("Running tasks are interrupted; this page reconnects after the server is back."),confirmLabel:e("Restart"),onConfirm:()=>{h(!1),window.electronAPI.updater.restart()}})]}),a.jsx(jn,{label:e("Automatic updates"),description:v?.mode==="manual"?e("Not available for this install: it cannot update itself. Update manually instead."):e("Download and install updates automatically"),children:a.jsx($r,{checked:t,disabled:v?.mode==="manual",onCheckedChange:N=>{n(N),window.electronAPI.updater.setAutoUpdateEnabled(N)}})}),a.jsx("div",{className:t?void 0:"opacity-60",children:a.jsx(jn,{label:e("Restart automatically to apply updates"),description:e(r==="immediate"?"Restart as soon as the update is downloaded, even while agents are running or messages are queued. The restart happens after the current tool finishes, and running sessions keep going afterwards. It still waits while you're using the window (input in the last 2 minutes), while an input box has an unsent draft, or while a question or approval is pending.":r==="idle"?"After the update is downloaded, restart automatically if no agent is running, nothing is queued, and there are no pending questions or approvals. The idle state must last 5 minutes, and a focused window also blocks it.":"Only notify when an update is ready; never restart automatically."),children:a.jsx(Zo,{value:r,disabled:!t,onValueChange:N=>{cye(N)&&(s(N),window.electronAPI.updater.setAutoRestartMode(N))},options:[{value:"off",label:e("Off")},{value:"idle",label:e("When idle")},{value:"immediate",label:e("Don't wait for idle")}]})})}),(u?.host==="desktop"||u?.host==="server")&&a.jsx(jn,{rowId:"general.updateChannel",label:e("Update channel"),description:a.jsxs(a.Fragment,{children:[e(o==="beta"?"Beta builds come from the latest main branch and may be unstable. You get whichever of beta and stable is newer.":"Only stable releases."),o==="stable"&&Uqe(Qde)&&a.jsx("span",{className:"mt-0.5 block",children:e("You're on a beta build. Switching to stable doesn't downgrade; you'll move to the next stable release once it's out.")})]}),children:a.jsx(Zo,{value:o,onValueChange:N=>{const j=N==="beta"?"beta":"stable";i(j),window.electronAPI.updater.setChannel(j)},options:[{value:"stable",label:e("Stable")},{value:"beta",label:e("Beta")}]})})]})}function vGt({instruction:e,onClose:t}){const{t:n}=Se(),r=be(j=>j.addInstructions),s=be(j=>j.updateInstruction),o=e==="new",i=o||!e?null:e,[l,c]=y.useState(""),[u,d]=y.useState(""),[f,h]=y.useState(!1),[p,m]=y.useState(!1),[v,b]=y.useState(null),[x,S]=y.useState(!1),[k,C]=y.useState(!1);y.useEffect(()=>{if(e){if(e==="new"){c(""),d(""),S(!1),b(null),C(!1),h(!1);return}c(e.name),S(!1),b(null),C(!1),h(!0),window.electronAPI.instructions.read(e.id,e.local,e.sourcePath).then(j=>{j.ok?d(j.content):(d(""),b(j.error??n("Failed to read content")))}).finally(()=>h(!1))}},[e,n]);const A=!!(i&&!i.local&&i.sourcePath),N=async()=>{if(!e||!l.trim())return;if(m(!0),o){const I=crypto.randomUUID(),_=await window.electronAPI.instructions.write(I,u);if(!_.ok){m(!1),b(n("Failed to save"));return}const L=r([{id:I,name:l.trim(),source:"Manual",local:!0,bytes:_.bytes,enabled:!0}]);if(m(!1),L===0){window.electronAPI.instructions.delete(I),b(n("An instruction with this name already exists"));return}t();return}if(!i){m(!1);return}if(A&&k&&i.sourcePath){const I=await window.electronAPI.instructions.writeSource(i.id,i.sourcePath,u);if(m(!1),!I.ok){b(I.error??n("Failed to save"));return}s(i.id,{name:l.trim(),bytes:I.bytes}),t();return}const j=await window.electronAPI.instructions.write(i.id,u);if(m(!1),!j.ok){b(n("Failed to save"));return}s(i.id,{name:l.trim(),local:!0,bytes:j.bytes}),t()};return a.jsx(gr,{open:e!==null,onOpenChange:j=>!j&&t(),children:a.jsxs(vr,{className:"max-w-2xl",children:[a.jsx(xr,{children:a.jsx(dr,{children:n(o?"Add Instruction":"Edit Instruction")})}),a.jsxs(rr,{className:"space-y-4",children:[o?null:A?a.jsxs("div",{className:xe("w-full rounded-md px-3 py-2.5 transition-colors",k?"bg-destructive/8":"bg-amber-500/8"),children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[k?a.jsx(Nd,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):a.jsx(gg,{className:"h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-500"}),a.jsx("span",{className:"font-medium text-xs",children:n("Write back to original file")})]}),a.jsx(Xi,{checked:k,onCheckedChange:C})]}),a.jsx("p",{className:"mt-1.5 pl-5.5 text-muted-foreground text-xs leading-relaxed",children:k?n("Saving overwrites {{path}} directly — {{source}} will pick up the change.",{path:i?.sourcePath??"",source:i?.source??""}):n("Saving creates a local copy — {{path}} is left untouched, and this entry stops following its updates.",{path:i?.sourcePath??""})})]}):a.jsxs("div",{className:"flex w-full items-start gap-2 rounded-md bg-muted/50 px-3 py-2",children:[a.jsx(gg,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:n("Local copy — edits stay in this app.")})]}),a.jsxs(Tr,{children:[a.jsx(jr,{children:n("Name")}),a.jsx(En,{value:l,onChange:j=>c(j.target.value)})]}),a.jsxs(Tr,{children:[a.jsx(jr,{children:n("Content")}),f?a.jsxs("div",{className:"flex w-full items-center justify-center gap-2 py-12",children:[a.jsx(Jn,{className:"h-4 w-4 animate-spin text-muted-foreground"}),a.jsx("span",{className:"text-muted-foreground text-xs",children:n("Loading...")})]}):a.jsx(_i,{value:u,onChange:j=>{d(j.target.value),S(!0)},rows:16,className:"font-mono text-xs"})]}),v&&a.jsxs("p",{className:"flex items-center gap-1.5 text-destructive text-xs",children:[a.jsx(qa,{className:"h-3.5 w-3.5 shrink-0"}),v]})]}),a.jsxs(Wr,{children:[a.jsx(Ke,{variant:"outline",size:"sm",onClick:t,children:n("Cancel")}),a.jsxs(Ke,{size:"sm",variant:A&&k?"destructive":"default",disabled:!l.trim()||f||p,onClick:N,children:[p&&a.jsx(Jn,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),n(A?k?"Overwrite original":x?"Save as local copy":"Save":"Save")]})]})]})})}const Zde=e=>e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`;function xGt(){const{t:e}=Se(),t=be(f=>f.instructions),n=be(f=>f.updateInstruction),r=be(f=>f.removeInstruction),[s,o]=y.useState(!1),[i,l]=y.useState(null),c=t.map(f=>f.id),u=xL(c,f=>window.electronAPI.assets.instructionOccupancy(f)),d=mL(t.filter(f=>f.enabled).map(f=>f.id),u.rows);return a.jsxs(yi,{rowId:"instructions.root",title:a.jsxs(a.Fragment,{children:[e("Instruction Files"),a.jsx(vL,{tokens:d}),a.jsx(Df,{})]}),description:e("Global CLAUDE.md / AGENTS.md style files from local AI tools"),actions:a.jsxs(a.Fragment,{children:[a.jsxs(fn,{onClick:()=>o(!0),children:[a.jsx(XA,{className:"h-4 w-4"}),e("Import from local apps")]}),a.jsxs(fn,{onClick:()=>l("new"),children:[a.jsx(xs,{className:"h-4 w-4"}),e("Add instruction")]})]}),children:[a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:e("Only one file is active at a time; enabling one disables the others")}),a.jsx(Xn,{children:t.length===0?a.jsxs("div",{className:"border-border border-b py-8 text-center",children:[a.jsx($p,{className:"mx-auto h-5 w-5 text-muted-foreground"}),a.jsx("p",{className:"mt-3 font-medium text-[13px]",children:e("No instruction files yet")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("Import instruction files from local apps or add one manually to get started")})]}):t.map(f=>a.jsxs(jn,{rowId:`instructions.${f.id}`,label:a.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx("span",{className:xe(!f.enabled&&"text-muted-foreground line-through"),children:f.name}),a.jsx($n,{variant:"secondary",className:"text-[11px]",children:f.source}),!f.local&&a.jsxs($n,{variant:"outline",className:"gap-1 text-[11px]",children:[a.jsx(xxe,{className:"h-3 w-3"}),e("Linked")]})]}),description:a.jsx("span",{className:"block truncate",children:f.local?`${e("Local copy")} · ${Zde(f.bytes)}`:`${f.sourcePath} · ${Zde(f.bytes)}`}),status:a.jsx(gL,{row:u.rows[f.id],pending:u.pending&&!u.rows[f.id]}),children:[a.jsx($r,{checked:f.enabled,onCheckedChange:h=>n(f.id,{enabled:h})}),a.jsx(Ke,{variant:"ghost",size:"icon-sm","aria-label":e("Edit"),className:"text-muted-foreground",onClick:()=>l(f),children:a.jsx(Pi,{className:"h-3.5 w-3.5"})}),a.jsx(Ke,{variant:"ghost",size:"icon-sm","aria-label":e("Delete"),className:"text-muted-foreground hover:text-destructive-text",onClick:()=>r(f.id),children:a.jsx(io,{className:"h-3.5 w-3.5"})})]},f.id))}),a.jsx(pL,{kind:"instruction",open:s,onOpenChange:o}),a.jsx(vGt,{instruction:i,onClose:()=>l(null)})]})}const bGt=(e,t)=>`plugin:${e}:${t}`;function oMe(e,t,n){const r=new Map;for(const[i,l]of Object.entries(n))l&&r.set(l,i);const s=new Map;return{rows:e.map(i=>{const l=bGt(i.pluginId,i.id),c=t[l]!==void 0,u=c?t[l]:i.key??"",d=u?r.get(u):void 0;return u&&!d&&(r.set(u,l),s.set(u,i)),{action:l,command:i,binding:u,custom:c,...d?{conflict:d}:{}}}),byBinding:s}}const iMe="relative inline-flex h-(--settings-control-h) min-w-14 items-center justify-center rounded-md px-1.5 transition-colors";function i4({title:e,onClick:t,children:n}){return a.jsx(Ke,{size:"icon-xs",variant:"ghost",title:e,onClick:t,className:"text-muted-foreground hover:text-foreground pointer-coarse:size-[44px]",children:n})}function yGt(){const{t:e}=Se();return a.jsxs(yi,{rowId:"shortcuts.root",title:e("Shortcuts"),description:e("Click a shortcut to rebind it. Backspace removes it; Esc cancels."),children:[a.jsx(SGt,{}),a.jsx(kGt,{})]})}function wGt(){const[e,t]=y.useState([]);return y.useEffect(()=>{const n=window.electronAPI.extensionPlugins;let r=!0;const s=()=>{n.list().then(i=>r&&t(xje(i)))};s();const o=n.onChanged(s);return()=>{r=!1,o()}},[]),e}function kGt(){const{t:e}=Se(),t=wGt(),n=be(m=>m.keybindings),r=be(m=>m.setKeybinding),s=be(m=>m.resetKeybinding),[o,i]=y.useState(null),[l,c]=y.useState(null);if(t.length===0)return null;const u=jh(n),{rows:d}=oMe(t,n,u),f=m=>d.find(v=>v.action===m)?.command.title??e(NH[m]??m),h=()=>{i(null),c(null)},p=(m,v,b)=>{if(m.preventDefault(),m.stopPropagation(),m.key==="Escape")return h();if(m.key==="Backspace"||m.key==="Delete")return r(v,""),h();const x=qv(m);if(!x)return;const S=AH.find(k=>u[k]===x)??d.find(k=>k.action!==v&&!k.conflict&&k.binding===x)?.action;if(S)return c(S);x===b?s(v):r(v,x),h()};return a.jsx(Xn,{title:"插件命令",children:d.map(({action:m,command:v,binding:b,custom:x,conflict:S})=>{const k=o===m;return a.jsxs(jn,{label:v.title,description:a.jsxs(a.Fragment,{children:[v.pluginName,S&&!k&&a.jsx("span",{className:"ml-2 text-destructive-text",children:e('Already used by "{{label}}"',{label:f(S)})})]}),status:k&&l&&a.jsx("span",{className:"text-[12px] text-destructive-text",children:e('Already used by "{{label}}"',{label:f(l)})}),children:[b&&!k&&a.jsx(i4,{title:e("Remove shortcut"),onClick:()=>r(m,""),children:a.jsx(Jr,{className:"h-3.5 w-3.5"})}),x&&!k&&a.jsx(i4,{title:e("Reset to default"),onClick:()=>s(m),children:a.jsx($u,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",onClick:()=>{i(m),c(null)},onKeyDown:k?C=>p(C,m,v.key):void 0,onBlur:()=>k&&h(),autoFocus:k,className:xe(iMe,k?"ring-1 ring-ring":"hover:bg-muted",S&&!k&&"opacity-50 line-through"),children:k?a.jsx("span",{className:"text-muted-foreground text-xs",children:e("Press shortcut…")}):b?a.jsx(Ed,{children:Fd(b)}):a.jsx("span",{className:"text-muted-foreground text-xs",children:e("No shortcut")})})]},m)})})}function SGt(){const{t:e}=Se(),t=be(d=>d.keybindings),n=be(d=>d.setKeybinding),r=be(d=>d.resetKeybinding),[s,o]=y.useState(null),[i,l]=y.useState(null),c=jh(t),u=d=>{if(d.preventDefault(),d.stopPropagation(),!s)return;if(d.key==="Escape"){o(null),l(null);return}if(d.key==="Backspace"||d.key==="Delete"){n(s,""),o(null),l(null);return}const f=qv(d,{allowBare:s==="send-message"});if(!f)return;const h=AH.find(p=>p!==s&&c[p]===f);if(h){l(h);return}f===i2e[s]?r(s):n(s,f),o(null),l(null)};return a.jsx(Xn,{children:AH.map(d=>{const f=s===d,h=t[d]!==void 0,p=c[d],m=ect[d];return a.jsxs(jn,{label:e(NH[d]),description:m&&e(m),status:f&&i&&a.jsx("span",{className:"text-[12px] text-destructive-text",children:e('Already used by "{{label}}"',{label:e(NH[i])})}),children:[p&&!f&&a.jsx(i4,{title:e("Remove shortcut"),onClick:()=>n(d,""),children:a.jsx(Jr,{className:"h-3.5 w-3.5"})}),h&&!f&&a.jsx(i4,{title:e("Reset to default"),onClick:()=>r(d),children:a.jsx($u,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",onClick:()=>{o(d),l(null)},onKeyDown:f?u:void 0,onBlur:()=>{f&&(o(null),l(null))},autoFocus:f,className:xe(iMe,f?"ring-1 ring-ring":"hover:bg-muted"),children:f?a.jsx("span",{className:"text-xs text-muted-foreground",children:e("Press shortcut…")}):p?a.jsx(Ed,{children:Fd(p)}):a.jsx("span",{className:"text-xs text-muted-foreground",children:e("No shortcut")})})]},d)})})}const Jde=[1,6,24,72,168],CGt=24;function EGt(){const{t:e}=Se();if(Yv())return null;const t=async()=>{try{const n=await window.electronAPI.window.openDevTools();if(n.ok)return;Ht({type:"error",title:e("Could not open developer tools"),description:n.error==="main-window-unavailable"?e("The main window is closed. Open it and try again."):n.error})}catch(n){Ht({type:"error",title:e("Could not open developer tools"),description:n instanceof Error?n.message:String(n)})}};return a.jsx(jn,{rowId:"logs.devTools",label:e("Developer tools"),description:e("Open the console of the main window to see errors and logs."),children:a.jsx(fn,{onClick:()=>{t()},children:e("Open")})})}const TGt={main:"Main process",agent:"Agent worker",plugin:"Plugin",mcp:"MCP"},AGt={main:"bg-sky-500/10 text-sky-600 dark:text-sky-400",agent:"bg-violet-500/10 text-violet-600 dark:text-violet-400",plugin:"bg-amber-500/10 text-amber-600 dark:text-amber-400",mcp:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"},NGt={1:"Last hour",6:"Last 6 hours",24:"Last 24 hours",72:"Last 3 days",168:"Last 7 days"};function IGt(){const{t:e}=Se();return a.jsxs(yi,{title:e("Logs"),description:e("Recent errors and log export. API keys, tokens and passwords are masked."),children:[a.jsx(jGt,{}),a.jsx(RGt,{}),a.jsx(MGt,{}),a.jsx(Xn,{title:e("Troubleshooting"),children:a.jsx(EGt,{})})]})}function jGt(){const{t:e}=Se(),t=be(o=>o.appLoggingEnabled===!0),n=be(o=>o.setAppLoggingEnabled),r=be(o=>o.pluginLoggingEnabled===!0),s=be(o=>o.setPluginLoggingEnabled);return a.jsxs(Xn,{children:[a.jsx(jn,{label:e("Record app logs"),description:e("Off by default. Write main process and agent logs to disk. Files needed for restart recovery are always kept."),children:a.jsx($r,{checked:t,onCheckedChange:n})}),a.jsx(jn,{label:e("Record plugin logs"),description:e("Off by default. Record plugin console output and runtime logs to disk. Startup failures and crashes are still shown."),children:a.jsx($r,{checked:r,onCheckedChange:s})})]})}function RGt(){const{t:e}=Se(),t=be(p=>p.appLoggingEnabled===!0),n=be(p=>p.setAppLoggingEnabled),[r,s]=y.useState("error"),[o,i]=y.useState(null),[l,c]=y.useState(!1),[u,d]=y.useState(null),f=y.useRef(0),h=y.useCallback(async p=>{const m=++f.current;c(!0);try{const v=await window.electronAPI.logs.errors(p);if(f.current!==m)return;i(v.map((b,x)=>({key:`${x}:${b.time}`,entry:b}))),d(null)}catch{if(f.current!==m)return;i([])}finally{f.current===m&&c(!1)}},[]);return y.useEffect(()=>{h(r)},[r,h]),a.jsxs(Xn,{title:e("Recent errors"),actions:a.jsxs(a.Fragment,{children:[a.jsx(nX,{"aria-label":e("Recent errors"),value:r,onValueChange:s,options:[{value:"error",label:e("Errors only")},{value:"warn",label:e("Warnings and errors")}]}),a.jsx(fn,{"aria-label":e("Refresh"),disabled:l,onClick:()=>{h(r)},children:a.jsx(Lo,{className:xe("h-3.5 w-3.5",l&&"animate-spin")})})]}),children:[!t&&a.jsx(jn,{label:e("App logging is off"),description:e("New app logs are not recorded while off. Existing logs are kept below."),children:a.jsx(fn,{onClick:()=>n(!0),children:e("Enable app logging")})}),o&&o.length===0?a.jsx("p",{className:"border-border border-b py-6 text-center text-[13px] text-muted-foreground",children:e("No errors recorded.")}):a.jsx("ul",{children:(o??[]).map(({key:p,entry:m})=>{const v=u===p;return a.jsxs("li",{className:"border-border border-b",children:[a.jsxs("button",{type:"button",className:"-mx-2 flex min-h-[44px] w-[calc(100%+1rem)] items-center gap-2 rounded-md px-2 py-2 text-left text-[13px] hover:bg-accent/50","aria-expanded":v,onClick:()=>d(v?null:p),children:[a.jsx(Bs,{className:xe("h-3.5 w-3.5 shrink-0 transition-transform",v&&"rotate-90")}),a.jsx("span",{className:"shrink-0 tabular-nums text-xs text-muted-foreground",children:new Date(m.time).toLocaleString()}),a.jsx("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-xs",AGt[m.source]),children:e(TGt[m.source])}),m.level==="warn"&&a.jsx("span",{className:"shrink-0 text-xs text-amber-600 dark:text-amber-400",children:e("Warning")}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.message})]}),v&&a.jsx("pre",{className:"mb-3 max-h-72 overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted/40 px-3 py-2 font-mono text-xs",children:m.detail})]},p)})})]})}function MGt(){const{t:e}=Se(),t=be(l=>l.appLoggingEnabled===!0),[n,r]=y.useState(CGt),[s,o]=y.useState(!1),i=async()=>{o(!0);try{const l=await window.electronAPI.logs.export(n);l.ok?l.cancelled||Ht({type:"success",title:e("Logs exported"),description:l.path,actions:[{label:e("Show in folder"),onClick:()=>{window.electronAPI.logs.revealExport()}}]}):Ht({type:"error",title:e("Log export failed"),description:l.error})}finally{o(!1)}};return a.jsx(Xn,{title:e("Export logs"),description:e("Pack logs from the selected period into a zip file for troubleshooting."),children:a.jsxs(jn,{label:e("Time range"),description:t?void 0:e("App logging is off. The export only includes logs recorded earlier."),children:[a.jsx(Zo,{value:String(n),onValueChange:l=>{const c=Jde.find(u=>String(u)===l);c&&r(c)},options:Jde.map(l=>({value:String(l),label:e(NGt[l])}))}),a.jsxs(fn,{variant:"default",disabled:s,onClick:()=>{i()},children:[a.jsx(Lf,{className:"h-3.5 w-3.5"}),e(s?"Exporting...":"Export")]})]})})}function _Gt(e){return e.serverId??e.serverName}function aMe(e,t){const n={...e};return t.serverId&&delete n[t.serverName],n[_Gt(t)]={state:t.state,...t.toolCount!==void 0?{toolCount:t.toolCount}:{},...t.error?{error:t.error}:{}},n}function PGt(e){return e.reduce((t,n)=>aMe(t,n),{})}function LGt(e,t){return{...e,[t]:{state:"connecting"}}}function OGt(e,t,n){return{...e,[t]:{state:"error",...n?{error:n}:{}}}}const C7=(e,t)=>{const n={...e};return delete n[t],n},vb=bi()((e,t)=>({statuses:{},authorized:{},pending:{},bind:()=>(window.electronAPI.mcp.authState().then(n=>e({authorized:n})).catch(()=>{}),window.electronAPI.mcp.statusSnapshot().then(n=>e({statuses:{...t().statuses,...PGt(n)}})).catch(()=>{}),window.electronAPI.mcp.onStatus(n=>{if(n.type==="mcp-status-cleared"){e({statuses:{}});return}e({statuses:aMe(t().statuses,n)}),window.electronAPI.mcp.authState().then(r=>e({authorized:r})).catch(()=>{})})),authorize:async n=>{e({statuses:LGt(t().statuses,n),pending:{...t().pending,[n]:!0}});let r;try{r=await window.electronAPI.mcp.authorize(n)}catch(s){r={ok:!1,error:s instanceof Error?s.message:String(s)}}e({pending:C7(t().pending,n),...r.ok?{authorized:{...t().authorized,[n]:!0}}:{statuses:OGt(t().statuses,n,r.error)}})},revoke:async n=>{await window.electronAPI.mcp.revoke(n),e({authorized:C7(t().authorized,n),statuses:C7(t().statuses,n)})}})),zp=e=>typeof e=="string"?e.trim():"",DGt=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[],lMe=e=>{if(!e||typeof e!="object")return{};const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t};function BGt(e){const t=lMe(e);return delete t[""],Object.keys(t).length>0?t:void 0}function efe(e){const t={};for(const n of e.split(`
|
|
787
|
+
`;return typeof l=="function"&&l(null,b),b},k7}var Hde;function dVt(){if(Hde)return tw;Hde=1;const e=WUt(),t=lVt(),n=cVt(),r=uVt();function s(o,i,l,c,u){const d=[].slice.call(arguments,1),f=d.length,h=typeof d[f-1]=="function";if(!h&&!e())throw new Error("Callback required as last argument");if(h){if(f<2)throw new Error("Too few arguments provided");f===2?(u=l,l=i,i=c=void 0):f===3&&(i.getContext&&typeof u>"u"?(u=c,c=void 0):(u=c,c=l,l=i,i=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(l=i,i=c=void 0):f===2&&!i.getContext&&(c=l,l=i,i=void 0),new Promise(function(p,m){try{const v=t.create(l,c);p(o(v,i,c))}catch(v){m(v)}})}try{const p=t.create(l,c);u(null,o(p,i,c))}catch(p){u(p)}}return tw.create=t.create,tw.toCanvas=s.bind(null,n.render),tw.toDataURL=s.bind(null,n.renderToDataURL),tw.toString=s.bind(null,function(o,i,l){return r.render(o,l)}),tw}var fVt=dVt();const ZRe=Oy(fVt);function hVt(e,t){const n=t.trim();if(n.length===0||n.length>512||n.startsWith("/")||n.startsWith("\\")||n.includes("\\")||n.includes("\0")||n.includes("?")||n.includes("#")||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n))return null;const r=kJ(e)&&e!=="."?e:e.split("/").pop()??"",s=r.lastIndexOf("/"),o=s===-1?"":r.slice(0,s),i=o?`${o}/${n}`:n,l=[];for(const u of i.split("/"))if(!(u===""||u===".")){if(u===".."){if(l.length===0)return null;l.pop();continue}l.push(u)}const c=l.join("/");return!c||!kJ(c)?null:c}function Ude(e,t){const n=new RegExp(`\\b${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'=<>]+))`,"i").exec(e);return n?n[1]??n[2]??n[3]??"":null}function pVt(e,t,n){return e.replace(new RegExp(`\\b${t}\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s"'=<>]+)`,"i"),`${t}="${n}"`)}function mVt(e){return e?.trim().toLowerCase().split(/\s+/).includes("stylesheet")??!1}function gVt(e){try{return new TextDecoder().decode(Uint8Array.from(atob(e),t=>t.charCodeAt(0)))}catch{return null}}function vVt(e,t){const n=[],r=(s,o,i,l)=>{const c=o[1]??"";if(!l(c))return;const u=Ude(c,i);if(u===null)return;const d=hVt(t,u);d&&n.push({start:o.index,end:o.index+o[0].length,kind:s,rel:d,attrs:c,full:o[0]})};for(const s of e.matchAll(/<script\b([^>]*)>[\s\S]*?<\/script>/gi))r("script",s,"src",()=>!0);for(const s of e.matchAll(/<link\b([^>]*?)\/?>/gi))r("style",s,"href",o=>mVt(Ude(o,"rel")));for(const s of e.matchAll(/<img\b([^>]*?)\/?>/gi))r("img",s,"src",()=>!0);return n.sort((s,o)=>s.start-o.start),n}async function xVt(e,t,n){const r=vVt(e,t),s=new Map;await Promise.all([...new Set(r.map(l=>l.rel))].map(async l=>{s.set(l,await n(l))}));let o=0,i="";for(const l of r){i+=e.slice(o,l.start),o=l.end;const c=s.get(l.rel);if(!c){i+=l.full;continue}if(l.kind==="img"){const d=c.mime||"application/octet-stream";i+=`<img${pVt(l.attrs,"src",`data:${d};base64,${c.base64}`)}>`;continue}const u=gVt(c.base64);if(u===null){i+=l.full;continue}i+=l.kind==="script"?`<script>${u.replace(/<\/script/gi,"<\\/script")}<\/script>`:`<style>${u.replace(/<\/style/gi,"<\\/style")}</style>`}return i+e.slice(o)}const bVt="plugin-view.html";function Vde(){return document.documentElement.classList.contains("dark")?"dark":"light"}function lcn({pluginId:e,viewId:t,sessionId:n}){const{t:r}=Se(),s=HGe().find(o=>o.pluginId===e&&o.id===t);return s?a.jsx(JRe,{pluginId:e,entry:s.entry,title:s.title,sessionId:n}):a.jsx("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:r("Plugin is not enabled")})}function JRe({pluginId:e,entry:t,title:n,sessionId:r,file:s}){const o=y.useRef(null),[i,l]=y.useState(null),c=y.useRef(r);c.current=r;const u=it(b=>r?b.conversations[r]?.projectId??null:null),d=y.useRef(u);d.current=u;const f=y.useRef(s);f.current=s;const h=y.useRef(null),p=y.useRef(null);y.useEffect(()=>{const b=o.current;if(!b)return;l(null);let x=!1,S=null;const k=()=>{try{S?.port1.postMessage(DGe(Vde()))}catch{}},C=new MutationObserver(k);C.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});const A=window.electronAPI.extensionPlugins.onViewEvent(I=>{if(!(I.pluginId!==e||typeof I.name!="string"))try{S?.port1.postMessage(BGe(I.name,I.data))}catch{}}),N=LGe(async(I,_)=>{const L=await window.electronAPI.extensionPlugins.call({pluginId:e,method:"renderer.call",payload:{method:I,args:_},sessionId:c.current});if(!L.ok)throw new Error(L.error);return L.value}),j=async I=>{if(I.source!==b.contentWindow||I.data?.type!=="enso-view-ready")return;S?.port1.close();const _=new MessageChannel;S=_,h.current=_,_.port1.onmessage=R=>{const z=OGe(R.data);if(z){window.electronAPI.extensionPlugins.viewStateSet(e,z);return}const B=zGe(R.data);if(B!==null){p.current=B,f.current?.onEdit(B);return}N(R.data).then(H=>{H&&!x&&S===_&&_.port1.postMessage(H)})};const[L,M]=await Promise.all([window.electronAPI.extensionPlugins.asset(e,t),window.electronAPI.extensionPlugins.viewStateGet(e)]);if(x||S!==_)return;if(!L.ok){l(L.error);return}const F=await xVt(VW(L.base64),t,async R=>{const z=await window.electronAPI.extensionPlugins.asset(e,R);return z.ok?{mime:z.mime,base64:z.base64}:null});if(x||S!==_)return;const D=f.current;b.contentWindow?.postMessage({type:"enso-view-init",html:F,theme:Vde(),storage:M.ok?M.state:{},session:ate(c.current,d.current),...D?{file:{rel:D.rel,text:D.text}}:{}},"*",[_.port2])};return window.addEventListener("message",j),b.src=new URL(bVt,document.baseURI).href,()=>{x=!0,C.disconnect(),A(),window.removeEventListener("message",j),S?.port1.close(),h.current=null,b.removeAttribute("src")}},[e,t]),y.useEffect(()=>{try{h.current?.port1.postMessage(ate(r,u))}catch{}},[r,u]);const m=s?.rel,v=s?.text;return y.useEffect(()=>{if(!(m===void 0||v===void 0)){if(p.current===v){p.current=null;return}try{h.current?.port1.postMessage(FGe(m,v))}catch{}}},[m,v]),a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i&&a.jsx("div",{className:"shrink-0 px-3 py-2 text-xs text-destructive",children:i}),a.jsx("iframe",{ref:o,title:n,className:"min-h-0 w-full flex-1 border-0 bg-background"})]})}const yVt="1",nw="inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-[12.5px] transition-colors hover:bg-muted disabled:opacity-50",Gde={network:"Cannot reach api.telegram.org. Check the proxy.",unauthorized:"Telegram rejected this token",api:"Telegram returned an error","token-required":"Paste a bot token first","not-group":"This chat is not a group","invalid-chat-id":"Group chat IDs are numbers, e.g. -1001234567890","invalid-topic":"Pick at least one topic","route-conflict":"Another secretary already has this group or one of these topics"};function wVt({checked:e,disabled:t,label:n,onClick:r,enso:s}){return a.jsxs("button",{type:"button",role:"checkbox","aria-checked":e,"data-enso":s,disabled:t,onClick:r,className:"flex items-center gap-1.5 text-left text-[12px] disabled:opacity-50",children:[a.jsx("span",{className:xe("flex size-3.5 shrink-0 items-center justify-center rounded ring-1 ring-border",e&&"bg-foreground text-background ring-foreground"),children:e&&a.jsx(Is,{className:"size-2.5"})}),n]})}function Wde({checked:e,disabled:t,label:n,onClick:r,enso:s}){return a.jsx("button",{type:"button",role:"radio","aria-checked":e,"data-enso":s,disabled:t,onClick:r,className:xe("rounded-md px-2 py-0.5 text-[11.5px] transition-colors disabled:opacity-50",e?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"),children:n})}function kVt({group:e,secretaryId:t,busy:n,onRemove:r,onSaved:s}){const{t:o}=Se(),[i,l]=y.useState(!1),[c,u]=y.useState({state:"idle"}),[d,f]=y.useState(e.topics.map(L=>L.id)),[h,p]=y.useState(!1),[m,v]=y.useState(null),b=L=>L.id===yVt?o("General (default topic)"):L.title??o("Topic #{{id}}",{id:L.id}),x=(L,M)=>{const F=o(Gde[L]??Gde.api),D=L==="api"?` ${o("Make sure the bot is in this group.")}`:"";return`${F}${M?`: ${M}`:""}${D}`},S=()=>{u({state:"loading"}),window.electronAPI.secretary.contactTelegramTopics(e.id,t).then(L=>u(L.ok?{state:"ready",forum:L.forum,topics:L.topics}:{state:"error",error:L.error,...L.detail?{detail:L.detail}:{}}),()=>u({state:"error",error:"api"}))},k=()=>{f(e.topics.map(L=>L.id)),v(null),l(!0),S()},C=L=>{p(!0),v(null),window.electronAPI.secretary.contactSettings({telegramGroupScope:{chatId:e.id,scope:L}},t).then(M=>{M.ok?(l(!1),s()):v(M.error)},()=>v("api")).finally(()=>p(!1))},A=()=>{i&&l(!1),e.all||C("all")},N=e.title??e.id,j=c.state==="ready"?[...c.topics,...e.topics.filter(L=>!c.topics.some(M=>M.id===L.id))]:[],I=n||h,_=i||!e.all;return a.jsxs("li",{"data-enso":"secretary-contact-group",className:"flex flex-col gap-1.5",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{"data-enso":"secretary-contact-group-name",className:"min-w-0 flex-1 truncate text-[12px]",children:e.title?a.jsxs(a.Fragment,{children:[e.title," ",a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground",children:e.id})]}):a.jsx("span",{className:"font-mono text-[11.5px]",children:e.id})}),a.jsxs("div",{role:"radiogroup","aria-label":o("What {{name}} hands to this secretary",{name:N}),className:"inline-flex shrink-0 rounded-lg bg-muted p-0.5",children:[a.jsx(Wde,{enso:"secretary-contact-scope-all",checked:!_,disabled:I,label:o("Whole group"),onClick:A}),a.jsx(Wde,{enso:"secretary-contact-scope-topics",checked:_,disabled:I,label:o("Pick topics"),onClick:()=>{i||k()}})]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-group-remove",disabled:n,"aria-label":o("Remove {{name}}",{name:N}),className:nw,onClick:r,children:a.jsx(Jr,{className:"size-3.5"})})]}),!e.all&&!i&&a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{"data-enso":"secretary-contact-group-scope",className:"min-w-0 flex-1 truncate text-[11.5px] text-muted-foreground",children:o("Topics: {{names}}",{names:e.topics.map(b).join(", ")})}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-group-topics",disabled:n,className:nw,onClick:k,children:[a.jsx(OHe,{className:"size-3.5"}),o("Change topics")]})]}),m&&!i&&a.jsx("p",{className:"text-[11.5px] text-destructive",children:x(m)}),i&&a.jsxs("div",{"data-enso":"secretary-contact-group-picker",className:"flex flex-col gap-1.5 rounded-lg bg-muted/40 px-2.5 py-2",children:[c.state==="loading"&&a.jsxs("p",{className:"flex items-center gap-1.5 text-[11.5px] text-muted-foreground",children:[a.jsx(Jn,{className:"size-3.5 animate-spin"}),o("Loading topics…")]}),c.state==="error"&&a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("p",{"data-enso":"secretary-contact-topics-error",className:"min-w-0 flex-1 text-[11.5px] text-destructive",children:o("Could not load topics: {{reason}}",{reason:x(c.error,c.detail)})}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-topics-retry",className:nw,onClick:S,children:[a.jsx(Lo,{className:"size-3.5"}),o("Retry")]})]}),c.state==="ready"&&(c.forum?a.jsxs(a.Fragment,{children:[j.map(L=>a.jsx(wVt,{enso:"secretary-contact-topic",checked:d.includes(L.id),disabled:I||!!L.owner&&!d.includes(L.id),label:L.owner?`${b(L)} · ${o("taken by {{owner}}",{owner:L.owner})}`:b(L),onClick:()=>f(M=>M.includes(L.id)?M.filter(F=>F!==L.id):[...M,L.id])},L.id)),a.jsx("p",{className:"text-[11px] text-subtle-foreground",children:o("Only topics the bot has seen are listed. If one is missing, send a message in that topic, then refresh. Topics you leave unchecked are ignored.")})]}):a.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:o("This group has no topics, so it can only be bound as a whole.")})),m&&a.jsx("p",{className:"text-[11.5px] text-destructive",children:x(m)}),a.jsxs("div",{className:"flex gap-1.5",children:[c.state==="ready"&&c.forum&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button","data-enso":"secretary-contact-scope-save",disabled:I||d.length===0,className:nw,onClick:()=>C(d),children:[a.jsx(Is,{className:"size-3.5"}),o("Save")]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-topics-refresh",disabled:I,className:nw,onClick:S,children:[a.jsx(Lo,{className:"size-3.5"}),o("Refresh")]})]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-topics-cancel",disabled:h,className:nw,onClick:()=>l(!1),children:o("Cancel")})]})]})]})}const SVt="border-border border-b py-3",qde="inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-[12.5px] transition-colors hover:bg-muted disabled:opacity-50",CVt="inline-flex items-center gap-1.5 rounded-lg bg-muted px-2.5 py-1.5 text-[12.5px] text-foreground transition-colors hover:bg-muted/80";function EVt(e){return e?.find(t=>!t.self&&t.privateChat)?.name??null}const TVt={"private-owned":'Your private chat with this bot already belongs to secretary "{{owner}}". One person has only one private chat with a bot, so bind this secretary to a group or forum topic below, or give it a different bot.',"route-conflict":'That group or topic already belongs to secretary "{{owner}}". Send the code in another group or topic.',expired:"The code expired. Generate a new one.","missing-code":"The bot got /start without the code. Open the bot with the button or QR code (the link carries the code), or send /start {{code}} yourself."};function AVt({bind:e}){const{t}=Se(),n=e.rejected;return n?a.jsxs("p",{"data-enso":"secretary-contact-bind-rejected","data-reason":n.reason,className:"mt-2 flex gap-1.5 rounded-lg bg-warning/10 px-2.5 py-2 text-[11.5px] text-warning",children:[a.jsx(Nd,{className:"mt-px size-3.5 shrink-0"}),a.jsx("span",{children:t(TVt[n.reason],{owner:n.owner??"",code:e.code})})]}):null}function NVt({bind:e,bot:t,now:n,busy:r,onNewCode:s,onCopied:o}){const{t:i}=Se(),l=e?e.expiresAt<=n:!1,c=e?Math.max(0,Math.ceil((e.expiresAt-n)/6e4)):0,u=e?.topicCommand??(t?`/bind@${t} ${i("<code>")}`:null);return a.jsxs("ol",{"data-enso":"secretary-contact-bind-places",className:"mt-1.5 flex flex-col gap-1.5",children:[a.jsxs("li",{className:"flex flex-col gap-1 text-[11.5px] text-muted-foreground",children:[a.jsxs("span",{children:[a.jsx("span",{className:"font-medium text-foreground",children:"1."})," ",i("Add the bot to the group: tap the button, or add @{{bot}} as a member in Telegram. For a forum group, turn on Topics first.",{bot:t??"bot"})]}),e?.groupLink&&a.jsxs("a",{"data-enso":"secretary-contact-group-link",href:e.groupLink,target:"_blank",rel:"noreferrer",className:`${CVt} self-start`,children:[a.jsx(dy,{className:"size-3.5"}),i("Add the bot to a group")]})]}),a.jsxs("li",{className:"flex flex-col gap-1 text-[11.5px] text-muted-foreground",children:[a.jsxs("span",{children:[a.jsx("span",{className:"font-medium text-foreground",children:"2."})," ",i("Send this in the group to hand the whole group to this secretary, or inside a forum topic to hand over only that topic:")]}),u?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("code",{"data-enso":"secretary-contact-topic-command",className:"min-w-0 flex-1 truncate rounded bg-muted px-1.5 py-1 font-mono text-[11.5px] text-foreground",children:u}),e&&!l&&a.jsx("button",{type:"button","data-enso":"secretary-contact-copy-topic-command",className:qde,"aria-label":i("Copy"),onClick:()=>{navigator.clipboard.writeText(e.topicCommand??""),o()},children:a.jsx(zd,{className:"size-3.5"})})]}):a.jsx("span",{className:"text-subtle-foreground",children:i("Verify a bot above first; the binding code shows up here.")}),e&&a.jsxs("span",{"data-enso":"secretary-contact-groups-code",className:l?"text-warning":"text-subtle-foreground",children:[i("Binding code of this secretary: {{code}}",{code:e.code})," ·"," ",l?i("This code has expired"):i("Valid for {{minutes}} more minutes",{minutes:c})]}),t&&(!e||l)&&a.jsxs("button",{type:"button","data-enso":"secretary-contact-groups-new-code",disabled:r,className:`${qde} self-start text-foreground`,onClick:s,children:[a.jsx(J4,{className:"size-3.5"}),i(e?"New code":"Get a binding code")]})]}),a.jsxs("li",{className:"text-[11.5px] text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-foreground",children:"3."})," ",i("Bound groups show up in the list of this section, where you can switch between the whole group and picked topics.")]})]})}function IVt({shared:e}){const{t}=Se(),n=(e??[]).filter(r=>!r.self).flatMap(r=>r.groups.map(s=>({owner:r.name,group:s})));return n.length===0?null:a.jsxs("div",{className:"mt-2",children:[a.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:t("Claimed by other secretaries on this bot (read only):")}),a.jsx("ul",{className:"mt-1 flex flex-col gap-0.5",children:n.map(({owner:r,group:s})=>a.jsxs("li",{"data-enso":"secretary-contact-group-other",className:"flex items-center gap-1.5 text-[12px] text-muted-foreground",children:[a.jsx(GHe,{className:"size-3 shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:jVt(s,t)}),a.jsx("span",{className:"shrink-0 text-[11px]",children:t("belongs to {{owner}}",{owner:r})})]},`${r}:${s.id}`))})]})}function jVt(e,t){const n=e.title??e.id;if(e.all)return`${n} · ${t("Whole group")}`;const r=e.topics.map(s=>s.id==="1"?t("General (default topic)"):s.title??t("Topic #{{id}}",{id:s.id})).join(", ");return`${n} · ${t("Topics: {{names}}",{names:r})}`}function RVt({shared:e,bot:t}){const{t:n}=Se();return a.jsxs("div",{"data-enso":"secretary-contact-shared",className:SVt,children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium text-muted-foreground",children:[a.jsx(Hv,{className:"size-3.5"}),n("@{{bot}} is shared by {{count}} secretaries",{bot:t??"",count:e.length})]}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("Each private chat, group or forum topic belongs to one secretary. A topic bound on its own wins over the whole group. Places nobody bound get no reply.")}),a.jsx("ul",{className:"mt-1.5 flex flex-col gap-1.5",children:e.map(r=>{const s=[...r.privateChat?[n("Private chat with @{{name}}",{name:r.privateChat.username??String(r.privateChat.id)})]:[],...r.groups.length>0?[n("Groups and topics: {{count}}",{count:r.groups.length})]:[]];return a.jsxs("li",{"data-enso":"secretary-contact-shared-user","data-self":r.self||void 0,className:"text-[12px]",children:[a.jsx("span",{className:"font-medium",children:r.name}),r.self&&a.jsxs("span",{className:"ml-1 text-[11px] text-muted-foreground",children:["(",n("this secretary"),")"]}),!r.enabled&&a.jsxs("span",{className:"ml-1 text-[11px] text-subtle-foreground",children:["· ",n("Telegram off")]}),s.length===0?a.jsx("p",{className:"text-[11.5px] text-subtle-foreground",children:n("Nothing bound yet")}):a.jsx("ul",{className:"text-[11.5px] text-muted-foreground",children:s.map(o=>a.jsxs("li",{className:"truncate",children:["· ",o]},o))})]},r.secretaryId)})})]})}const MVt="https://t.me/BotFather",_Vt={"token-invalid":"That does not look like a bot token",network:"Cannot reach api.telegram.org. Check the proxy.",unauthorized:"Telegram rejected this token",api:"Telegram returned an error","token-required":"Paste a bot token first","not-bound":"Not bound yet","not-found":"That task is already gone","no-secretary":"No secretary conversation is available","deliver-failed":"Could not reach the secretary session","invalid-chat-id":"Group chat IDs are numbers, e.g. -1001234567890","channel-paused":"Pushes to this channel are paused after repeated failures","invalid sender":"Not allowed from this window","invalid-github-login":"That is not a GitHub login"},Qm="border-border border-b py-3",Yc="inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-[12.5px] transition-colors hover:bg-muted disabled:opacity-50",PVt="inline-flex items-center gap-1.5 rounded-lg bg-muted px-2.5 py-1.5 text-[12.5px] text-foreground transition-colors hover:bg-muted/80",bR="inline-flex items-center gap-1.5 rounded-lg bg-foreground px-2.5 py-1.5 text-[12.5px] font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-50";function S7({index:e,label:t}){return a.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium text-muted-foreground",children:[a.jsx("span",{className:"flex size-4 items-center justify-center rounded-full bg-muted text-[10px] tabular-nums",children:e}),t]})}const LVt={unconfigured:"Not set up",pending:"Waiting to bind",connected:"Connected",error:"Error"},OVt={unconfigured:"bg-muted text-muted-foreground",pending:"bg-warning/15 text-warning",connected:"bg-success/15 text-success",error:"bg-destructive/15 text-destructive"},eMe="enso.secretary.contact.collapsed";function DVt(){try{const e=JSON.parse(window.localStorage.getItem(eMe)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([,t])=>t===!0))}catch{return{}}}function BVt(e){try{window.localStorage.setItem(eMe,JSON.stringify(e))}catch{}}function FVt({outbound:e,busy:t,onRetry:n}){const{t:r,locale:s}=Se(),o=Date.now(),i=e.state==="paused",l=i&&e.pausedUntil!==void 0&&e.pausedUntil>o;return a.jsxs("div",{"data-enso":"secretary-contact-outbound","data-state":e.state,className:xe("border-l-2 px-2.5 py-2 text-[12px]",i?"border-warning bg-warning/5":"border-destructive bg-destructive/5"),children:[a.jsxs("div",{className:xe("flex items-center gap-1.5 font-medium",i?"text-warning":"text-destructive"),children:[i?a.jsx(VFe,{className:"size-3.5 shrink-0"}):a.jsx(Rf,{className:"size-3.5 shrink-0"}),i?r("Pushes paused: {{count}} sends failed in a row",{count:e.consecutiveFailures}):r("The last send failed ({{count}} in a row)",{count:e.consecutiveFailures})]}),e.userMessage&&a.jsx("p",{"data-enso":"secretary-contact-outbound-hint",className:"mt-1 text-[12.5px]",children:e.userMessage}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:r("Last failure: {{time}}",{time:`${Vce(e.lastErrorAt,s)} (${Ng(e.lastErrorAt,s,o)})`})}),e.detail&&a.jsx("p",{"data-enso":"secretary-contact-outbound-detail",className:"mt-0.5 break-all font-mono text-[11px] text-muted-foreground",children:e.detail}),i&&a.jsxs("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:[l?r("Next try at {{time}}. A message from this channel or Retry now resumes pushes right away.",{time:Vce(e.pausedUntil??o,s)}):r("The next push will try again."),e.suppressedCount>0&&` ${r("{{count}} pushes held back.",{count:e.suppressedCount})}`]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-outbound-retry",disabled:t,className:xe(Yc,"mt-1.5"),onClick:n,children:[a.jsx(Lo,{className:"size-3.5"}),r("Retry now")]}),a.jsx("span",{className:"ml-2 text-[11px] text-subtle-foreground",children:r("Sends a test message to this channel.")})]})}const zVt="enso.telegram";function B3({label:e,hint:t,checked:n,disabled:r,dataEnso:s,onChange:o}){return a.jsx("div",{"data-enso":s,children:a.jsx(vo,{label:e,description:t,children:a.jsx($r,{checked:n,disabled:r,onCheckedChange:o})})})}function HVt({channel:e,collapsed:t,busy:n,onToggle:r,onPrefs:s,onRetry:o,children:i}){const{t:l}=Se(),c=e.id==="telegram",{prefs:u,caps:d}=e,f=[!d.buttons&&l("No buttons: questions and cards arrive as numbered text."),!d.edit&&l("Cannot edit sent messages: answered questions are not marked there."),!d.typing&&l("No typing indicator.")].filter(h=>typeof h=="string");return a.jsxs("div",{"data-enso":"secretary-contact-channel","data-channel":e.id,className:"border-border border-b",children:[a.jsxs("div",{className:"flex items-center gap-2 py-2",children:[a.jsxs("button",{type:"button","data-enso":"secretary-contact-channel-toggle","aria-expanded":!t,className:"flex min-w-0 flex-1 items-center gap-2 text-left",onClick:r,children:[t?a.jsx(Bs,{className:"size-3.5 shrink-0 text-muted-foreground"}):a.jsx(Ho,{className:"size-3.5 shrink-0 text-muted-foreground"}),e.pluginId?a.jsx(YP,{pluginId:e.pluginId,icon:e.icon,className:"size-4"}):a.jsx(zy,{className:"size-4 shrink-0"}),a.jsx("span",{className:"truncate text-[13px] font-medium",children:e.title}),a.jsx("span",{className:"shrink-0 rounded bg-muted px-1 text-[10.5px] text-muted-foreground",children:e.builtin?l("Built-in"):l("Plugin")}),a.jsx("span",{"data-enso":"secretary-contact-channel-status",className:xe("shrink-0 rounded px-1 text-[10.5px]",OVt[e.status]),children:l(LVt[e.status])}),e.outbound&&a.jsx("span",{"data-enso":"secretary-contact-channel-outbound",className:xe("shrink-0 rounded px-1 text-[10.5px]",e.outbound.state==="paused"?"bg-warning/15 text-warning":"bg-destructive/15 text-destructive"),children:e.outbound.state==="paused"?l("Pushes paused"):l("Send failed")})]}),a.jsx(Xi,{"data-enso":"secretary-contact-channel-enabled",checked:u.enabled,disabled:n,"aria-label":l("Enable {{name}}",{name:e.title}),onCheckedChange:h=>s({enabled:h})})]}),!t&&a.jsxs("div",{className:"flex flex-col gap-2 border-border border-t py-2.5",children:[e.detail&&e.status==="error"&&a.jsx("p",{className:"text-[11.5px] text-destructive",children:e.detail}),e.outbound&&a.jsx(FVt,{outbound:e.outbound,busy:n,onRetry:o}),a.jsx(B3,{dataEnso:"secretary-contact-push",label:l("Push to this channel"),hint:l("Milestones, questions from the secretary, cards and approval notices go out here."),checked:u.push,disabled:n,onChange:h=>s({push:h})}),a.jsx(B3,{dataEnso:c?"secretary-contact-allow-dispatch":"secretary-contact-card-confirm",label:l(c?"Allow confirming cards from Telegram":"Confirm cards from the phone"),hint:c?l("On by default. A tap on your phone can confirm settings, skill, tool, takeover and cleanup cards. Those cards change which projects the secretary sees, what it may take over, which skills and tools it installs and what it cleans up. Approvals are never handled from Telegram."):d.buttons?l("Off by default. Approvals are never handled from the phone."):l('Off by default. Reply "confirm 1" to confirm a card. Approvals are never handled from the phone.'),checked:u.cardConfirm,disabled:n,onChange:h=>s({cardConfirm:h})}),a.jsx(B3,{dataEnso:"secretary-contact-mirror",label:l("Mirror every reply"),hint:l("Off by default. Every reply in the secretary conversation is sent here, not just milestones."),checked:u.syncMirror,disabled:n,onChange:h=>s({syncMirror:h})}),a.jsx(B3,{dataEnso:c?"secretary-contact-allow-memory":"secretary-contact-memory",label:l(c?"Allow viewing memory titles on Telegram":"Allow viewing memory titles"),hint:l("Off by default. /memory lists titles only, never the memory text."),checked:u.memory,disabled:n,onChange:h=>s({memory:h})}),f.length>0&&a.jsx("ul",{"data-enso":"secretary-contact-limits",className:"flex flex-col gap-0.5 text-[11.5px] text-subtle-foreground",children:f.map(h=>a.jsxs("li",{children:["· ",h]},h))}),i]})]})}function UVt({owner:e,secretaryId:t,busy:n,error:r,run:s,showHeading:o=!0}){const{t:i}=Se(),l=e.githubLogins.join(", "),c=e.githubLogins.length>0,[u,d]=y.useState(l),[f,h]=y.useState(!1),[p,m]=y.useState(null);y.useEffect(()=>{f||d(l)},[l,f]),y.useEffect(()=>{if(c){m(null);return}const b=window.electronAPI.secretary.contactGithubSuggest;if(!b)return;let x=!0;return b().then(S=>{x&&m(S.login)}),()=>{x=!1}},[c]);const v=b=>{h(!0),d(x=>{const S=x.split(/[\s,]+/).filter(Boolean);return S.some(k=>k.toLowerCase()===b.toLowerCase())?x:S.length>0?`${S.join(", ")}, ${b}`:b})};return a.jsxs("div",{"data-enso":"secretary-contact-owner",className:Qm,children:[o&&a.jsx("div",{className:"text-[12.5px] font-medium",children:i("Owner identity")}),a.jsx("p",{className:xe("text-[11.5px] text-muted-foreground",o&&"mt-1"),children:i("GitHub accounts that count as you. Events from anyone else are left to the agent unless you require confirmation.")}),a.jsx("label",{className:"mt-2 block text-[12px] text-muted-foreground",htmlFor:"secretary-github-logins",children:i("GitHub accounts")}),a.jsx("input",{id:"secretary-github-logins","data-enso":"secretary-contact-github-logins",value:u,disabled:n,placeholder:i("Comma or space separated"),className:"mt-1 w-full rounded-lg border border-border bg-transparent px-2.5 py-1.5 font-mono text-[12px] outline-none focus:border-foreground/40",onChange:b=>{h(!0),d(b.target.value)}}),p&&a.jsxs("div",{className:"mt-1.5 flex items-center justify-between gap-2",children:[a.jsx("span",{className:"min-w-0 text-[11.5px] text-muted-foreground",children:i("Detected the gh login {{login}} on this machine",{login:p})}),a.jsx("button",{type:"button","data-enso":"secretary-contact-github-fill",disabled:n,className:Yc,onClick:()=>v(p),children:i("Fill in")})]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-github-save",disabled:n,className:xe(bR,"mt-2"),onClick:()=>{const b=u.split(/[\s,]+/).map(x=>x.trim()).filter(Boolean);s(async()=>{const x=await window.electronAPI.secretary.contactSettings({githubLogins:b},t);return x.ok&&h(!1),x})},children:i("Save GitHub accounts")}),r==="invalid-github-login"&&a.jsx("p",{className:"mt-1 text-[11.5px] text-destructive",children:i("That is not a GitHub login")}),a.jsx("div",{className:"mt-3 text-[12px] text-muted-foreground",children:i("Messages that are not from you")}),a.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[a.jsx("button",{type:"button","data-enso":"secretary-contact-external-agent","aria-pressed":!e.externalConfirm,disabled:n,className:xe(Yc,!e.externalConfirm&&"bg-muted"),onClick:()=>{e.externalConfirm&&s(()=>window.electronAPI.secretary.contactSettings({externalConfirm:!1},t))},children:i("Let the agent decide")}),a.jsx("button",{type:"button","data-enso":"secretary-contact-external-confirm","aria-pressed":e.externalConfirm,disabled:n,className:xe(Yc,e.externalConfirm&&"bg-muted"),onClick:()=>{e.externalConfirm||s(()=>window.electronAPI.secretary.contactSettings({externalConfirm:!0},t))},children:i("Require your confirmation")})]})]})}function Yde({checked:e,disabled:t,label:n,onCheckedChange:r}){const s=Dg();return a.jsx(Xi,{...s,"data-enso":"secretary-contact-enabled",checked:e,disabled:t,"aria-label":s["aria-labelledby"]?void 0:n,onCheckedChange:r})}function VVt({secretaryId:e,frames:t}={}){const{t:n}=Se(),[r,s]=y.useState(null),[o,i]=y.useState(""),[l,c]=y.useState(!1),[u,d]=y.useState(null),[f,h]=y.useState(null),[p,m]=y.useState(null),[v,b]=y.useState(DVt),[x,S]=y.useState([]),[k,C]=y.useState(""),[A,N]=y.useState(()=>Date.now());y.useEffect(()=>{const ue=window.electronAPI.extensionPlugins,ve=()=>{ue.list().then(S).catch(()=>S([]))};return ve(),ue.onChanged(ve)},[]);const j=ue=>{b(ve=>{const ge={...ve};return ge[ue]?delete ge[ue]:ge[ue]=!0,BVt(ge),ge})},I=y.useCallback(()=>{window.electronAPI.secretary.contactState(e).then(s)},[e]);y.useEffect(()=>(I(),window.electronAPI.secretary.onContactChanged(ue=>{e&&ue.secretaryId&&ue.secretaryId!==e||s(ue)})),[I,e]);const _=r?.telegram.bind?.expiresAt;y.useEffect(()=>{if(_===void 0)return;N(Date.now());const ue=window.setInterval(()=>N(Date.now()),15e3);return()=>window.clearInterval(ue)},[_]);const L=r?.telegram.bind?.link;y.useEffect(()=>{if(!L){m(null);return}let ue=!0;return ZRe.toDataURL(L,{width:320,margin:1}).then(ve=>{ue&&m(ve)}).catch(()=>m(null)),()=>{ue=!1}},[L]);const M=ue=>{c(!0),d(null),h(null),ue().then(ve=>{ve.ok||d(ve.error??"api")}).finally(()=>{c(!1),I()})};if(!r)return null;const F=r.telegram,D=r.channels??[],R=x.some(ue=>ue.id===zVt&&ue.state==="enabled"),z=(ue,ve)=>M(()=>window.electronAPI.secretary.contactSettings({channelId:ue,prefs:ve},e)),B=ue=>M(()=>window.electronAPI.secretary.contactTest(e,ue).then(ve=>{if(ve.ok)h(n("Test message sent"));else if(["api","network","unauthorized","channel-paused"].includes(ve.error))return{ok:!0};return ve})),H=F.poll.state==="error"||F.poll.state==="backoff",G=F.poll.state!=="stopped"&&F.poll.state!=="error",te=u==="network"&&G?null:u,W=F.groups??[],T=k.trim(),U=(ue,ve)=>M(()=>window.electronAPI.secretary.contactSettings({telegramGroup:{action:ue,chatId:ve}},e).then(ge=>(ge.ok&&ue==="add"&&C(""),ge))),P=F.bind?Math.max(0,Math.ceil((F.bind.expiresAt-A)/6e4)):0,K=F.bind?F.bind.expiresAt<=A:!1,J=F.chat?null:EVt(F.shared),ee=a.jsx(NVt,{bind:F.bind,bot:F.bot?.username,now:A,busy:l,onNewCode:()=>M(()=>window.electronAPI.secretary.contactBind(void 0,e)),onCopied:()=>h(n("Copied"))}),X=a.jsxs("div",{"data-enso":"secretary-contact-groups",className:Qm,children:[a.jsx("div",{className:"text-[12px] font-medium text-muted-foreground",children:n("Groups and topics")}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("Only groups on this list reach the secretary, and only messages from the bound account count. Messages from anyone else in the group are not received.")}),W.length===0?a.jsxs(a.Fragment,{children:[ee,a.jsx("p",{className:"mt-1.5 text-[11.5px] text-subtle-foreground",children:n("No groups yet: group messages are not received.")})]}):a.jsxs(a.Fragment,{children:[a.jsx("ul",{className:"mt-1.5 flex flex-col gap-1",children:W.map(ue=>a.jsx(kVt,{group:ue,secretaryId:e,busy:l,onRemove:()=>U("remove",ue.id),onSaved:I},ue.id))}),a.jsx("p",{className:"mt-2.5 text-[11.5px] font-medium text-muted-foreground",children:n("Bind another group or topic")}),ee]}),a.jsx(IVt,{shared:F.shared}),a.jsx("p",{className:"mt-2 text-[11px] text-subtle-foreground",children:n("Or add a group by its chat ID:")}),a.jsxs("form",{className:"mt-1 flex gap-1.5",onSubmit:ue=>{if(ue.preventDefault(),!!T){if(W.some(ve=>ve.id===T)){C("");return}U("add",T)}},children:[a.jsx("input",{"data-enso":"secretary-contact-group-input",value:k,spellCheck:!1,autoComplete:"off",placeholder:n("Group chat ID, e.g. -1001234567890"),onChange:ue=>C(ue.target.value),className:"min-w-0 flex-1 rounded-lg border border-border bg-transparent px-2.5 py-1.5 font-mono text-[12px] outline-none focus:border-foreground/40"}),a.jsxs("button",{type:"submit","data-enso":"secretary-contact-group-add",disabled:l||!T,className:Yc,children:[a.jsx(xs,{className:"size-3.5"}),n("Add group")]})]})]}),ne=a.jsxs(a.Fragment,{children:[R&&a.jsx("p",{"data-enso":"secretary-contact-token-conflict",className:"text-[11.5px] text-warning",children:n("The Telegram remote plugin (enso.telegram) is enabled. Do not give both the same bot token: only one place can poll a bot, so they would steal each other's messages.")}),F.status==="bound"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-enso":"secretary-contact-bound",className:Qm,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-success/15 text-success",children:a.jsx(Is,{className:"size-3.5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-[13px] font-medium",children:F.chat?n("Bound to @{{username}}",{username:F.chat.username??String(F.chat.id)}):n("Bound to groups and topics")}),a.jsxs("p",{className:"truncate text-[11.5px] text-muted-foreground",children:[n("Bot @{{bot}}",{bot:F.bot?.username??""}),F.tokenHint?` · ${F.tokenHint}`:""]})]})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.jsxs("button",{type:"button","data-enso":"secretary-contact-test",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactTest(e).then(ue=>(ue.ok&&h(n("Test message sent")),ue))),children:[a.jsx(zy,{className:"size-3.5"}),n("Send a test message")]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-unbind",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactUnbind(e)),children:[a.jsx(RVe,{className:"size-3.5"}),n("Unbind")]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-replace",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactForgetBot(e)),children:[a.jsx(Lo,{className:"size-3.5"}),n("Change bot")]})]})]}),X,a.jsx("div",{"data-enso":"secretary-contact-sync",className:xe(Qm,F.syncMirror&&"border-warning/50 bg-warning/5"),children:F.syncMirror?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-[12.5px] font-medium text-warning",children:[a.jsx(RUe,{className:"size-3.5 shrink-0"}),n("Mirroring every conversation to Telegram")]}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("Every reply in the secretary conversation is sent to your phone, not just milestones. Silent turns arrive as a one-line summary. Telegram messages are not end-to-end encrypted and stay on Telegram servers. Send /sync off in Telegram to stop.")})]}):a.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:n("Only milestones go to Telegram. Send /sync in Telegram to mirror every reply; /last replays the latest round.")})}),a.jsxs("div",{"data-enso":"secretary-contact-commands",className:Qm,children:[a.jsx("div",{className:"text-[12px] font-medium text-muted-foreground",children:n("Commands you can send")}),a.jsx("ul",{className:"mt-1 flex flex-col gap-0.5",children:GUt.filter(ue=>!ue.gated||F.allowMemory).map(ue=>a.jsxs("li",{className:"text-[12px]",children:[a.jsxs("code",{className:"rounded bg-muted px-1 text-[11.5px]",children:["/",ue.name]})," ",a.jsx("span",{className:"text-muted-foreground",children:n(ue.en)})]},ue.name))}),a.jsx("p",{className:"mt-1.5 text-[11.5px] text-muted-foreground",children:n("Telegram messages are not end-to-end encrypted and stay on Telegram servers. /status, /board and /feed show titles and short summaries; /last and /sync send conversation text. Memory text and tool output never leave the app.")})]}),!F.secure&&a.jsx("p",{className:"px-1 text-[11.5px] text-warning",children:n("No system keychain available: the bot token is stored unencrypted on this machine.")})]}),F.status==="awaiting-start"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-enso":"secretary-contact-verified",className:Qm,children:[a.jsx(S7,{index:2,label:n("Bot verified")}),a.jsxs("p",{className:"mt-1 text-[13px] font-medium",children:[F.bot?.name," ",a.jsxs("span",{className:"text-muted-foreground",children:["@",F.bot?.username]})]})]}),a.jsxs("div",{"data-enso":"secretary-contact-code",className:Qm,children:[a.jsx(S7,{index:3,label:n("Open the bot and press Start")}),a.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[p&&a.jsx("img",{"data-enso":"secretary-contact-qr",src:p,alt:n("Binding QR code"),className:"size-28 shrink-0 rounded-lg bg-white p-1"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-[11.5px] text-muted-foreground",children:n("Binding code")}),a.jsx("p",{"data-enso":"secretary-contact-code-value",className:"font-mono text-[22px] tracking-[0.2em] tabular-nums",children:F.bind?.code}),K?a.jsx("p",{"data-enso":"secretary-contact-code-expired",className:"mt-1 text-[11.5px] text-warning",children:n("This code has expired")}):a.jsx("p",{className:"mt-1 text-[11.5px] text-subtle-foreground",children:n("Valid for {{minutes}} more minutes",{minutes:P})})]})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[a.jsxs("a",{"data-enso":"secretary-contact-open-bot",href:F.bind?.link,target:"_blank",rel:"noreferrer",className:bR,children:[a.jsx(dy,{className:"size-3.5"}),n("Open @{{bot}}",{bot:F.bot?.username??""})]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-copy",className:Yc,onClick:()=>{navigator.clipboard.writeText(F.bind?.link??""),h(n("Link copied"))},children:[a.jsx(zd,{className:"size-3.5"}),n("Copy link")]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-regenerate",disabled:l,className:K?bR:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactBind(void 0,e)),children:[a.jsx(Lo,{className:"size-3.5"}),n("New code")]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-cancel",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactCancel(e)),children:n("Cancel")})]}),F.bind&&a.jsx(AVt,{bind:F.bind}),J&&F.bind?.rejected?.reason!=="private-owned"&&a.jsx("p",{"data-enso":"secretary-contact-private-owned",className:"mt-2 text-[11.5px] text-warning",children:n('Your private chat with this bot already belongs to secretary "{{owner}}". Bind this secretary to a group or forum topic instead.',{owner:J})}),a.jsx("p",{className:"mt-2 text-[11.5px] text-subtle-foreground",children:n("The code works once. Press Start in a private chat with the bot, or send it in a group or forum topic to bind that place to this secretary instead.")})]}),X]}),F.shared&&F.status!=="unbound"&&a.jsx(RVt,{shared:F.shared,bot:F.bot?.username}),F.status==="unbound"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{"data-enso":"secretary-contact-step1",className:Qm,children:[a.jsx(S7,{index:1,label:n("Create a bot with @BotFather")}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("Send /newbot, pick a name, and copy the token it gives you.")}),a.jsxs("a",{"data-enso":"secretary-contact-botfather",href:MVt,target:"_blank",rel:"noreferrer",className:xe(PVt,"mt-2"),children:[a.jsx(dy,{className:"size-3.5"}),n("Open @BotFather")]}),a.jsx("input",{"data-enso":"secretary-contact-token",type:"password",value:o,spellCheck:!1,autoComplete:"off",placeholder:n("Paste the bot token"),onChange:ue=>i(ue.target.value),className:"mt-2 w-full rounded-lg border border-border bg-transparent px-2.5 py-1.5 font-mono text-[12px] outline-none focus:border-foreground/40"}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-verify",disabled:l||o.trim().length===0,className:xe(bR,"mt-2"),onClick:()=>M(()=>window.electronAPI.secretary.contactBind(o.trim(),e)),children:[l?a.jsx(Jn,{className:"size-3.5 animate-spin"}):a.jsx(Is,{className:"size-3.5"}),n("Verify and continue")]}),F.bot&&a.jsxs("button",{type:"button","data-enso":"secretary-contact-reconnect",disabled:l,className:xe(Yc,"mt-1.5"),onClick:()=>M(()=>window.electronAPI.secretary.contactBind(void 0,e)),children:[a.jsx(Lo,{className:"size-3.5"}),n("Bind again with @{{bot}}",{bot:F.bot.username})]})]}),a.jsx("p",{className:"px-1 text-[11.5px] text-subtle-foreground",children:n("The token is stored with the system keychain and never written to logs.")}),X]})]}),Q=ue=>M(()=>window.electronAPI.secretary.contactSettings({enabled:ue},e)),oe=t?a.jsx("div",{"data-enso":"secretary-contact-master",children:a.jsx(jn,{label:n("Enable contacts"),children:a.jsx(Yde,{checked:r.enabled,disabled:l,label:n("Enable contacts"),onCheckedChange:Q})})}):a.jsxs("div",{"data-enso":"secretary-contact-master",className:"flex items-center justify-between gap-2 border-border border-b py-2",children:[a.jsx("span",{className:"text-[13px] font-medium",children:n("Enable contacts")}),a.jsx(Yde,{checked:r.enabled,disabled:l,label:n("Enable contacts"),onCheckedChange:Q})]}),de=a.jsx(UVt,{owner:r.owner,secretaryId:e,busy:l,error:u,run:M,showHeading:!t}),ie=r.enabled?a.jsxs(a.Fragment,{children:[(te||H)&&a.jsxs("div",{"data-enso":"secretary-contact-error",className:"flex items-start gap-1.5 border-destructive border-l-2 bg-destructive/5 px-2.5 py-2 text-[12px] text-destructive",children:[a.jsx(Rf,{className:"mt-0.5 size-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1",children:n(te?_Vt[te]??"Telegram returned an error":"Cannot reach api.telegram.org. Check the proxy.")})]}),f&&a.jsxs("div",{className:"flex items-center gap-1.5 border-success border-l-2 bg-success/5 px-2.5 py-2 text-[12px] text-success",children:[a.jsx(Is,{className:"size-3.5 shrink-0"}),a.jsx("span",{children:f})]}),D.map(ue=>a.jsx(HVt,{channel:ue,collapsed:v[ue.id]===!0,busy:l,onToggle:()=>j(ue.id),onPrefs:ve=>z(ue.id,ve),onRetry:()=>B(ue.id),children:ue.id==="telegram"?ne:ue.pluginId&&ue.settingsView?a.jsx("div",{"data-enso":"secretary-contact-plugin-view",className:"h-72 overflow-hidden border-border border-y",children:a.jsx(JRe,{pluginId:ue.pluginId,entry:ue.settingsView,title:ue.title,sessionId:null})}):null},ue.id)),a.jsxs("div",{"data-enso":"secretary-contact-following",className:Qm,children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("div",{className:"text-[12.5px] font-medium",children:n("Followed from the phone: {{count}}",{count:F.following.length})}),F.following.length>0&&a.jsx("button",{type:"button","data-enso":"secretary-contact-following-clear",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactFollowing({action:"clear"},e)),children:n("Clear all")})]}),a.jsx("p",{className:"mt-1 text-[11.5px] text-muted-foreground",children:n("What you dispatch or schedule from the phone keeps reporting here until it finishes or fails once, even with /sync off.")}),F.following.length>0&&a.jsx("ul",{className:"mt-1.5 flex flex-col gap-1",children:F.following.map(ue=>a.jsxs("li",{className:"flex items-start justify-between gap-2",children:[a.jsxs("span",{className:"min-w-0 flex-1 text-[12px]",children:[a.jsxs("span",{className:"text-muted-foreground",children:[ue.kind==="schedule"?n("Scheduled"):n("Session")," ·"," "]}),ue.summary]}),a.jsx("button",{type:"button","data-enso":"secretary-contact-following-cancel",disabled:l,className:Yc,onClick:()=>M(()=>window.electronAPI.secretary.contactFollowing({action:"cancel",id:ue.id},e)),children:n("Drop")})]},ue.id))})]}),a.jsxs("button",{type:"button","data-enso":"secretary-contact-market",className:xe(Yc,t?"mt-3":"self-start"),onClick:()=>nu({category:"plugins",rowId:"plugins.enso",marketQuery:"contact"}),children:[a.jsx(su,{className:"size-3.5"}),n("Find more contact channels in the plugin market")]})]}):a.jsx("p",{className:t?"border-border border-b py-3 text-[13px] text-muted-foreground":"px-1 text-[11.5px] text-subtle-foreground",children:n("Contacts are off: nothing is sent or received on any channel.")});return t?a.jsxs("div",{"data-enso":"secretary-contact",children:[t.owner(de),t.channels(a.jsxs(a.Fragment,{children:[oe,ie]}))]}):a.jsxs("div",{"data-enso":"secretary-contact",className:"flex flex-col gap-2 px-3 py-3",children:[a.jsx("p",{className:"px-1 text-[11.5px] text-muted-foreground",children:n("Reach the secretary from your phone. Milestones go out; your replies come back.")}),oe,de,ie]})}function GVt(){try{return localStorage.getItem(r4)??void 0}catch{return}}function tMe(){const[e,t]=y.useState([]),[n,r]=y.useState(GVt),s=y.useCallback(async()=>{t(await window.electronAPI.secretary.list())},[]);y.useEffect(()=>(s(),window.electronAPI.secretary.onListChanged(t)),[s]),y.useEffect(()=>{const l=c=>{c.key===r4&&c.newValue&&r(c.newValue)};return window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[]);const o=y.useCallback(l=>{r(l);try{l&&localStorage.setItem(r4,l)}catch{}},[]),i=e.find(l=>l.id===n)?.id??e[0]?.id??void 0;return{secretaries:e,setSecretaries:t,current:i,multiple:e.length>1,select:o,reload:s}}function nMe({secretaries:e,current:t,onSelect:n}){const{t:r}=Se();return e.map(s=>a.jsx("button",{type:"button","data-enso":"secretary-settings-pick","data-secretary-id":s.id,"data-selected":s.id===t||void 0,onClick:()=>n(s.id),className:xe("relative rounded-full px-2.5 py-1 text-xs ring-1 transition-colors",s.id===t?"bg-foreground/5 text-foreground ring-foreground/40":"text-muted-foreground ring-border hover:text-foreground"),children:s.name??r("Secretary")},s.id))}function WVt(){const{t:e}=Se(),{secretaries:t,current:n,multiple:r,select:s}=tMe();return a.jsxs(yi,{title:e("Contacts & owner"),description:e("Reach the secretary from your phone. Milestones go out; your replies come back."),children:[r&&a.jsx("div",{className:"mt-4 flex max-w-full flex-wrap items-center gap-1.5",children:a.jsx(nMe,{secretaries:t,current:n,onSelect:s})}),a.jsx(VVt,{secretaryId:n,frames:{owner:o=>a.jsx(Xn,{title:e("Owner identity"),rowId:"contacts.owner",children:o}),channels:o=>a.jsx(Xn,{title:e("Contact channels"),rowId:"contacts.channels",children:o})}},n??"single")]})}const qVt={body:"Body",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4–6",table:"Table",inlineCode:"Inline code",codeBlock:"Code block"},$de=YW.map(e=>({value:String(e),label:String(e)}));function YVt(){const{t:e}=Se(),t=be(c=>c.chatTypography),n=be(c=>c.setChatTypography),r=be(c=>c.resetChatTypography),[s,o]=y.useState(t.body.size);y.useEffect(()=>{o(t.body.size)},[t.body.size]);const i=(c,u)=>{const d=be.getState().chatTypography;n({...d,[c]:{...d[c],size:u}})},l=(c,u)=>{const d=be.getState().chatTypography;n({...d,[c]:{...d[c],weight:u}})};return a.jsxs(Xn,{rowId:"appearance.chatTypography",title:e("Conversation typography"),description:e("Headings, tables and inline code scale with the body text"),children:[ET.map(c=>a.jsx($Vt,{role:c,label:e(qVt[c]),size:t[c].size,weight:t[c].weight,bodyPreview:s,onPreview:c==="body"?o:void 0,onCommit:u=>i(c,u),onWeight:u=>l(c,u)},c)),a.jsx("div",{className:"flex justify-end py-2",children:a.jsx(fn,{onClick:()=>r(),children:e("Reset to defaults")})})]})}function $Vt({role:e,label:t,size:n,weight:r,bodyPreview:s,onPreview:o,onCommit:i,onWeight:l}){const c=xk[e],[u,d]=y.useState(n);y.useEffect(()=>{d(n)},[n]);const f=c.unit==="%"?`${(s*u/100).toFixed(1)}px`:void 0;return a.jsxs(jn,{label:t,children:[a.jsx("div",{className:"w-[140px] sm:w-[180px]",children:a.jsx(KK,{min:c.min,max:c.max,step:c.step,value:u,onValueChange:h=>{const p=Array.isArray(h)?h[0]:h;d(p),o?.(p)},onValueCommitted:h=>i(Array.isArray(h)?h[0]:h)})}),a.jsxs("span",{className:"shrink-0 text-right text-[12px] text-muted-foreground tabular-nums",children:[u,c.unit==="%"?"%":"px",f?` · ${f}`:""]}),a.jsxs(Ps,{items:$de,value:String(r),onValueChange:h=>{const p=Number(h);YW.includes(p)&&l(p)},children:[a.jsx(Ls,{size:"sm",className:"w-24 max-w-full","aria-label":t,children:a.jsx(Os,{})}),a.jsx(Ds,{children:$de.map(h=>a.jsx(ls,{value:h.value,children:h.label},h.value))})]})]})}function KVt({seconds:e,onCommit:t}){const{t:n}=Se(),[r,s]=y.useState(String(e));y.useEffect(()=>s(String(e)),[e]);const o=()=>{const i=Number(r);if(!Number.isInteger(i)){s(String(e));return}const l=XW(i);t(l),s(String(l))};return a.jsxs(jn,{rowId:"appearance.liveActivityFoldDelaySec",label:n("Wait before folding"),description:n("Seconds to wait after tools and thinking finish"),children:[a.jsx(En,{type:"number",min:1,max:60,value:r,onChange:i=>s(i.target.value),onBlur:o,onKeyDown:i=>{i.key==="Enter"&&(o(),i.currentTarget.blur())},className:"w-20 max-w-full"}),a.jsx("span",{className:"text-[12px] text-muted-foreground",children:n("sec")})]})}function ap({rowId:e,label:t,description:n,checked:r,onChange:s,extra:o}){return a.jsxs(jn,{rowId:e,label:t,description:n,children:[o,a.jsx($r,{checked:r,onCheckedChange:i=>s(i===!0)})]})}function XVt({revealRowId:e}={}){const{t}=Se(),n=be(M=>M.openChangesOnFileEdit),r=be(M=>M.setOpenChangesOnFileEdit),s=be(M=>M.compactReadOnlyTools),o=be(M=>M.setCompactReadOnlyTools),i=be(M=>M.expandLiveEdits),l=be(M=>M.setExpandLiveEdits),c=be(M=>M.expandLiveReasoning),u=be(M=>M.setExpandLiveReasoning),d=be(M=>M.autoCollapseTurns),f=be(M=>M.setAutoCollapseTurns),h=be(M=>M.quoteSelectionButton),p=be(M=>M.setQuoteSelectionButton),m=be(M=>M.collapseCompletedActivity),v=be(M=>M.setCollapseCompletedActivity),b=be(M=>M.collapseLiveActivity),x=be(M=>M.setCollapseLiveActivity),S=be(M=>M.liveActivityFoldDelaySec),k=be(M=>M.setLiveActivityFoldDelaySec),C=be(M=>M.pinUnfinishedTodos),A=be(M=>M.setPinUnfinishedTodos),N=be(M=>M.headerSessionTabs),j=be(M=>M.setHeaderSessionTabs),I=be(M=>M.headerRecentMinutes),_=be(M=>M.setHeaderRecentMinutes),L=M=>M===0?t("Off"):t("{{count}} min",{count:M});return a.jsxs(yi,{title:t("Conversation display"),children:[a.jsx(YVt,{}),a.jsxs(Xn,{children:[a.jsx(ap,{rowId:"appearance.openChangesOnFileEdit",label:t("Open Changes when files are edited"),description:t("Automatically show the side panel Changes tab after the agent edits a file"),checked:n,onChange:r}),a.jsx(ap,{rowId:"appearance.compactReadOnlyTools",label:t("Compact read-only tool calls"),description:t("Show read/grep/find/ls as one-line rows and fold consecutive tool calls while the agent is still running"),checked:s,onChange:o}),a.jsx(ap,{rowId:"appearance.expandLiveEdits",label:t("Expand file edits while running"),description:t("Automatically unfold diffs or written content from file modification tools while the agent is still running"),checked:i,onChange:l}),a.jsx(ap,{rowId:"appearance.expandLiveReasoning",label:t("Expand reasoning while streaming"),description:t("Automatically unfold the thinking block while the model is still reasoning. It collapses again when reasoning ends."),checked:c,onChange:u}),a.jsx(ap,{rowId:"appearance.autoCollapseTurns",label:t("Auto-collapse previous turns"),description:t("After you send a new message, fold earlier turns down to the question, timestamp and duration; the latest turn stays expanded"),checked:d,onChange:f}),a.jsx(ap,{rowId:"appearance.quoteSelectionButton",label:t("Quote button on text selection"),description:t("Show a floating Quote button when you select text in the conversation; click it to put the selection into the input box as a quote"),checked:h,onChange:p}),a.jsx(ap,{rowId:"appearance.collapseCompletedActivity",label:t("Collapse activity after reply"),description:t("When a reply finishes, fold consecutive thinking and tool calls (including edits and commands) into one summary row; failed calls stay visible"),checked:m,onChange:v}),a.jsx(ap,{rowId:"appearance.collapseLiveActivity",label:t("Collapse finished activity while replying"),description:t("While a reply is still running, wait a moment after tools and thinking finish, then fold that stretch into one row. Calls still running stay visible, and failed calls stay visible"),checked:b,onChange:x}),b||e==="appearance.liveActivityFoldDelaySec"?a.jsx(KVt,{seconds:S,onCommit:k}):null,a.jsx(ap,{rowId:"appearance.pinUnfinishedTodos",label:t("Pin unfinished todos"),description:t("Keep the latest todo list above the input while it has unfinished items, so it does not scroll away with the timeline"),checked:C,onChange:A}),a.jsx(ap,{rowId:"appearance.headerSessionTabs",label:t("Show active sessions in the title bar"),description:t("Show active conversations as tabs above the conversation. Hold ⌘/Ctrl to see number shortcuts. Hidden while Bot mode is enabled."),checked:N,onChange:j,extra:N?a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:[a.jsx("span",{className:"max-w-full text-[12px] text-muted-foreground",children:t("Also show recent conversations")}),a.jsxs(Ps,{items:Object.fromEntries(IT.map(M=>[String(M),L(M)])),value:String(I),onValueChange:M=>_(Number(M)),children:[a.jsx(Ls,{size:"sm",className:"w-28 max-w-full",children:a.jsx(Os,{})}),a.jsx(Ds,{children:IT.map(M=>a.jsx(ls,{value:String(M),children:L(M)},M))})]})]}):null})]})]})}const gA="text-muted-foreground";function QVt(){const{t:e}=Se();return a.jsxs(yi,{title:e("Devices"),children:[a.jsx(ZVt,{}),!window.electronAPI.remote&&a.jsx(JVt,{}),a.jsx(nGt,{})]})}function ZVt(){const{t:e}=Se(),[t,n]=y.useState(null),[r,s]=y.useState(null),[o,i]=y.useState(!1),[l,c]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(!1),p=t?.pairingExpiresAt;y.useEffect(()=>{if(!p){d(null);return}const x=()=>d(Math.max(0,Math.ceil((p-Date.now())/1e3)));x();const S=setInterval(x,1e3);return()=>clearInterval(S)},[p]);const m=x=>{navigator.clipboard.writeText(x).then(()=>{h(!0),setTimeout(()=>h(!1),1500)})};y.useEffect(()=>{if(!Yv())return window.electronAPI.pair.status().then(n),window.electronAPI.pair.onStatusChanged(x=>{n(x),(x.pairing||x.devices.length>0)&&c(null)})},[]),y.useEffect(()=>{const x=t?.inviteUri;if(!x){s(null);return}ZRe.toDataURL(x,{width:320,margin:1}).then(s).catch(()=>{})},[t?.inviteUri]);const v=async()=>{i(!0),c(null);const x=await window.electronAPI.pair.start();i(!1),x.ok||c(x.error??e("Failed to start pairing"))},b=t?.devices??[];return a.jsxs(Xn,{rowId:"phone.root",title:e("Allow connections"),description:e("Let your phone or another EnsoCode desktop connect to this computer. Keep this app running."),actions:t?.pairing?a.jsx(fn,{onClick:()=>{window.electronAPI.pair.cancel()},children:e("Cancel pairing")}):a.jsxs(fn,{disabled:o,onClick:()=>{v()},children:[o?a.jsx(Jn,{className:"h-4 w-4 animate-spin"}):a.jsx(yT,{className:"h-4 w-4"}),e("Generate pairing code")]}),children:[t&&!t.secureStorage&&a.jsx(rMe,{}),l&&a.jsx("p",{className:"border-border border-b py-3 text-xs text-destructive",children:l}),t?.pairing&&a.jsxs("div",{className:"border-border border-b py-4 text-center",children:[r?a.jsx("img",{src:r,alt:e("Pairing QR code"),className:"mx-auto h-52 w-52"}):a.jsx(Jn,{className:"mx-auto h-5 w-5 animate-spin text-muted-foreground"}),a.jsx("p",{className:"mt-3 font-medium text-sm",children:e("Scan with your phone camera")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("Scanning opens the app and pairs it. To keep it handy, add it to your home screen.")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("On another EnsoCode desktop, paste the link below into Settings → Devices → Connect to a node.")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:u===null?e("The code expires in 60 seconds and can only be used once."):u>0?e("Expires in {{seconds}}s · single use",{seconds:u}):e("Code expired")}),t.inviteUri&&a.jsxs("div",{className:"mt-3 flex items-center gap-2 text-left",children:[a.jsx("code",{className:"min-w-0 flex-1 truncate bg-muted px-2 py-1.5 font-mono text-[11px] text-muted-foreground",children:t.inviteUri}),a.jsxs(fn,{className:"shrink-0",onClick:()=>m(t.inviteUri),children:[f?a.jsx(Is,{className:"h-3.5 w-3.5"}):a.jsx(zd,{className:"h-3.5 w-3.5"}),e(f?"Copied":"Copy")]})]})]}),a.jsx("p",{className:"border-border border-b py-3 font-medium text-[13px]",children:e("Paired devices")}),b.length===0?a.jsxs("div",{className:"border-border border-b py-8 text-center",children:[a.jsx(yT,{className:"mx-auto h-5 w-5 text-muted-foreground"}),a.jsx("p",{className:"mt-3 font-medium text-sm",children:e("No paired devices")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("Generate a pairing code to let a phone or another desktop connect.")})]}):b.map(x=>a.jsx(eGt,{device:x},x.pairId))]})}function rMe(){const{t:e}=Se();return a.jsxs("p",{className:"flex items-start gap-2 border-border border-b py-3 text-xs text-muted-foreground",children:[a.jsx(Nd,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),a.jsx("span",{children:e("Secure storage is unavailable on this system, so pairing keys are stored unencrypted.")})]})}function JVt(){const{t:e}=Se(),t=jd(i=>i.nodes),n=jd(i=>i.secureStorage),r=jd(i=>i.refresh),[s,o]=y.useState(!1);return y.useEffect(()=>jd.getState().bind(),[]),a.jsxs(Xn,{title:e("Connect to a node"),description:e("Browse and drive conversations on another EnsoCode desktop. Its agent, keys and history stay there."),actions:a.jsxs(fn,{onClick:()=>o(!0),children:[a.jsx(xs,{className:"h-4 w-4"}),e("Connect to a node")]}),children:[!n&&a.jsx(rMe,{}),a.jsx("p",{className:"border-border border-b py-3 font-medium text-[13px]",children:e("Connected nodes")}),t.length===0?a.jsxs("div",{className:"border-border border-b py-8 text-center",children:[a.jsx(e_,{className:"mx-auto h-5 w-5 text-muted-foreground"}),a.jsx("p",{className:"mt-3 font-medium text-sm",children:e("No connected nodes")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("Each connecting computer needs its own pairing code from the other desktop.")})]}):t.map(i=>a.jsx(tGt,{node:i,onChanged:()=>{r()}},i.nodeId)),a.jsx(wRe,{open:s,onOpenChange:o,switchOnSuccess:!1})]})}function sMe({transport:e,rttMs:t}){const{t:n}=Se(),r=e==="direct",s=cRe(t);return a.jsxs("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-[10px] leading-none",r?"bg-success/15 text-success":"bg-muted text-muted-foreground"),children:[n(r?"Direct link":"Via relay"),s?` · ${s}`:""]})}function eGt({device:e}){const{t}=Se(),[n,r]=y.useState(null),s=async()=>{n!==null&&(n.trim()&&n.trim()!==e.deviceName&&await window.electronAPI.pair.rename(e.pairId,n),r(null))};return a.jsxs("div",{className:"group flex flex-wrap items-center justify-between gap-3 border-border border-b py-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a.jsx("span",{className:xe("h-2 w-2 shrink-0 rounded-full",e.phoneOnline?"bg-success":e.connected?"bg-warning":"bg-muted-foreground/40")}),n===null?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"truncate font-medium text-sm",children:e.deviceName}),a.jsx("span",{className:"shrink-0 text-muted-foreground text-xs",children:e.phoneOnline?t("Online"):e.connected?t("Waiting for device"):t("Offline")}),e.phoneOnline&&a.jsx(sMe,{transport:e.transport,rttMs:e.rttMs}),a.jsx("button",{type:"button",title:t("Click to switch: view-only devices cannot send, approve or stop."),onClick:()=>{window.electronAPI.pair.setScope(e.pairId,e.scope==="read"?"operate":"read")},className:xe("relative shrink-0 rounded px-1.5 py-0.5 text-[10px] leading-none transition-colors",e.scope==="read"?"bg-warning/15 text-warning hover:bg-warning/25":"bg-muted text-muted-foreground hover:bg-accent"),children:e.scope==="read"?t("View only"):t("Can operate")})]}):a.jsx(En,{value:n,autoFocus:!0,onChange:o=>r(o.target.value),onBlur:()=>{s()},onKeyDown:o=>{o.key==="Enter"&&s(),o.key==="Escape"&&r(null)},className:"h-7 w-full max-w-full text-sm sm:w-[220px]"})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity pointer-coarse:opacity-100 group-hover:opacity-100",children:[a.jsx(Ke,{variant:"ghost",size:"icon",className:gA,title:t("Rename"),onClick:()=>r(e.deviceName),children:a.jsx(Pi,{className:"h-3.5 w-3.5"})}),a.jsx(Ke,{variant:"ghost",size:"icon",className:xe(gA,"hover:text-destructive"),onClick:()=>{window.electronAPI.pair.revoke(e.pairId)},children:a.jsx(io,{className:"h-3.5 w-3.5"})})]})]})}function tGt({node:e,onChanged:t}){const{t:n}=Se(),[r,s]=y.useState(null),o=async()=>{r!==null&&(r.trim()&&r.trim()!==e.label&&(await window.electronAPI.nodes.rename(e.nodeId,r),t()),s(null))};return a.jsxs("div",{className:"group flex flex-wrap items-center justify-between gap-3 border-border border-b py-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a.jsx(LV,{node:e}),r===null?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"truncate font-medium text-sm",children:e.label}),e.hostname&&e.hostname!==e.label&&a.jsx("span",{className:"shrink-0 truncate font-mono text-[10px] text-muted-foreground",children:e.hostname}),a.jsx("span",{className:"shrink-0 text-muted-foreground text-xs",children:e.hostOnline?n("Online"):e.connected?n("Remote desktop is offline"):n("Offline")}),e.hostOnline&&a.jsx(sMe,{transport:e.transport,rttMs:e.rttMs})]}):a.jsx(En,{value:r,autoFocus:!0,onChange:i=>s(i.target.value),onBlur:()=>{o()},onKeyDown:i=>{i.key==="Enter"&&o(),i.key==="Escape"&&s(null)},className:"h-7 w-full max-w-full text-sm sm:w-[220px]"})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity pointer-coarse:opacity-100 group-hover:opacity-100",children:[a.jsx(Ke,{variant:"ghost",size:"icon",className:gA,title:n("Rename"),onClick:()=>s(e.label),children:a.jsx(Pi,{className:"h-3.5 w-3.5"})}),a.jsx(Ke,{variant:"ghost",size:"icon",className:xe(gA,"hover:text-destructive"),title:n("Disconnect"),onClick:()=>{window.electronAPI.nodes.remove(e.nodeId).then(t)},children:a.jsx(io,{className:"h-3.5 w-3.5"})})]})]})}function nGt(){const{t:e}=Se(),[t,n]=y.useState(null),[r,s]=y.useState(null);y.useEffect(()=>(window.electronAPI.pair.status().then(n),window.electronAPI.pair.onStatusChanged(n)),[]);const o=async()=>{r!==null&&(n(await window.electronAPI.pair.setRelayUrl(r)),s(null))};return a.jsx(Xn,{children:a.jsxs(jn,{label:e("Relay server"),description:e("The relay only forwards encrypted frames and cannot read your messages."),children:[a.jsx(En,{value:r??t?.relayUrl??"",onChange:i=>s(i.target.value),placeholder:"https://relay.example.com",className:"w-full font-mono text-xs sm:w-[220px]"}),r===null?a.jsx(Ke,{variant:"ghost",size:"icon-sm",className:gA,onClick:()=>s(t?.relayUrl??""),children:a.jsx(Pi,{className:"h-3.5 w-3.5"})}):a.jsxs(fn,{variant:"default",onClick:()=>{o()},children:[a.jsx(Is,{className:"h-3.5 w-3.5"}),e("Save")]})]})})}function rGt({onOpenBots:e}){const{t}=Se(),n=be(f=>f.botModeEnabled),r=be(f=>f.setBotModeEnabled),s=be(f=>f.scratchSessionsEnabled),o=be(f=>f.setScratchSessionsEnabled),i=be(f=>f.dropShelfEnabled),l=be(f=>f.setDropShelfEnabled),c=be(f=>f.secretaryEnabled),u=be(f=>f.setSecretaryEnabled),d=window.electronAPI.env.platform==="darwin"&&!window.electronAPI.remote;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-medium",children:t("Experimental")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:t("Features still being tested. They may change or be removed.")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(jn,{rowId:"experimental.botMode",label:t("Bot mode"),description:t("Adds a Code | Bot switch to the sidebar. Create members with their own persona, model and tools, and chat with them alone or in groups."),children:a.jsx($r,{checked:n,onCheckedChange:r})}),n&&a.jsx(Ke,{variant:"outline",size:"sm",onClick:e,children:t("Bot mode settings")}),a.jsx(jn,{rowId:"experimental.scratchSessions",label:t("Temporary chats"),description:t("Chats that are not tied to a project. Tools follow your global settings."),children:a.jsx($r,{checked:s,onCheckedChange:o})}),d&&a.jsx(jn,{rowId:"experimental.dropShelf",label:t("Drop shelf"),description:t("When you drag files in Finder, a small panel appears at the top right of the screen. Drop them on it to reference them in the current conversation, or drop folders to open them as projects, even when EnsoCode is minimized or in the tray."),children:a.jsx($r,{checked:i,onCheckedChange:l})}),a.jsx(jn,{rowId:"experimental.secretary",label:t("Secretary"),description:t("A global agent that watches your projects and sessions, creates sessions to do the work, and reports results back to you."),children:a.jsx($r,{checked:c,onCheckedChange:u})})]})]})}const sGt=["pem","crt","cer"],oGt=[{category:"providers",label:"Model Providers"},{category:"presets",label:"Presets"},{category:"agentTypes",label:"Agent types"},{category:"skills",label:"Skills"},{category:"mcpServers",label:"MCP Servers"},{category:"instructions",label:"Instruction Files"},{category:"subagentModels",label:"Subagent Models"},{category:"settings",label:"Scalar settings"}];function iGt(){const{t:e}=Se(),[t,n]=y.useState(!1),[r,s]=y.useState(!1),[o,i]=y.useState(null),[l,c]=y.useState(null),u=()=>{i(null),n(!0)},d=async()=>{s(!0),i(null);try{const f=await window.electronAPI.configSync.openImport();if(!f.ok){i({kind:f.cancelled?"cancelled":"error",text:f.cancelled?e("Import cancelled."):e(f.error)});return}c(f)}catch{i({kind:"error",text:e("Could not open configuration package.")})}finally{s(!1)}};return a.jsxs(Xn,{rowId:"general.configSync",title:e("Configuration transfer"),description:e("Move models, presets, agent types, skills, MCP servers and instruction files between devices."),children:[a.jsxs(jn,{label:e("Portable Enso configuration"),description:a.jsxs(a.Fragment,{children:[e("Export a package or preview one before importing it.")," ",e("OAuth login sessions are never transferred. Skill, instruction, and system prompt contents require an encrypted export.")]}),children:[a.jsxs(fn,{disabled:r,onClick:()=>{d()},children:[r?a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Lf,{className:"h-3.5 w-3.5"}),e("Import configuration")]}),a.jsxs(fn,{variant:"default",disabled:r,onClick:u,children:[a.jsx(Rxe,{className:"h-3.5 w-3.5"}),e("Export configuration")]})]}),o&&a.jsx("p",{className:o.kind==="error"?"border-border border-b py-2 text-[12px] text-destructive":"border-border border-b py-2 text-[12px] text-muted-foreground",role:o.kind==="error"?"alert":"status",children:o.text}),a.jsx(aGt,{open:t,onOpenChange:n}),l&&a.jsx(lGt,{file:l,onClose:()=>c(null)})]})}function aGt({open:e,onOpenChange:t}){const{t:n}=Se(),[r,s]=y.useState(!1),[o,i]=y.useState(""),[l,c]=y.useState(""),[u,d]=y.useState(!1),[f,h]=y.useState(null),[p,m]=y.useState(!1),[v,b]=y.useState(null),[x,S]=y.useState([]);y.useEffect(()=>{e&&(s(!1),i(""),c(""),d(!1),h(null),m(!1),b(null),S([]))},[e]);const k=()=>{u||(i(""),c(""),t(!1))},C=async()=>{if(r&&o.length<8){h(n("Password must be at least 8 characters."));return}if(r&&o!==l){h(n("Passwords do not match."));return}d(!0),h(null),m(!1);try{const A=await window.electronAPI.configSync.exportConfig({includeSecrets:r,...r?{password:o}:{}});if(i(""),c(""),!A.ok){A.cancelled?m(!0):h(n(A.error));return}b(A.filePath),S(A.skippedInstructions??[])}catch{i(""),c(""),h(n("Could not export configuration."))}finally{d(!1)}};return a.jsx(gr,{open:e,onOpenChange:A=>!A&&k(),children:a.jsxs(vr,{className:"max-w-xl",showCloseButton:!u,children:[a.jsxs(xr,{children:[a.jsx(dr,{children:n("Export configuration")}),a.jsx(oo,{children:n("Create a portable .enso-config package for another device.")})]}),a.jsx(rr,{className:"max-h-[55vh] space-y-4",children:v?a.jsxs(a.Fragment,{children:[a.jsxs(kd,{variant:"success",children:[a.jsx(By,{}),a.jsx(Rw,{children:n("Configuration exported")}),a.jsxs(Sd,{children:[a.jsx("p",{children:n("Saved package:")}),a.jsx("p",{className:"break-all font-mono text-xs text-foreground",children:v})]})]}),x.length>0&&a.jsxs(kd,{variant:"warning",children:[a.jsx(Nd,{}),a.jsxs(Sd,{children:[a.jsx("p",{children:n("These instructions were skipped because their source files are missing or unreadable:")}),a.jsx("p",{className:"break-all text-foreground",children:x.join(", ")})]})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs(kd,{variant:"warning",children:[a.jsx(Rf,{}),a.jsx(Rw,{children:n("File contents can be private")}),a.jsx(Sd,{children:n("Skill and instruction file contents may contain private data, so configurations containing them can only be exported with encryption.")})]}),a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 border-border border-b py-3",children:[a.jsx(yo,{checked:r,onCheckedChange:A=>{const N=A===!0;s(N),h(null),N||(i(""),c(""))}}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block text-sm font-medium",children:n("Include sensitive configuration")}),a.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:n("Encrypt the entire package with a password. OAuth login sessions are still excluded.")})]})]}),!r&&a.jsxs(kd,{variant:"info",children:[a.jsx(gg,{}),a.jsx(Sd,{children:n("API keys, provider account links, MCP arguments and environment values, plus credentials and private URL parts in MCP endpoints, will be omitted. Configurations containing skill or instruction files require encryption.")})]}),r&&a.jsxs("div",{className:"space-y-3 border-border border-t py-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a.jsx(yxe,{className:"h-4 w-4 text-muted-foreground"}),n("Encryption password")]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(aV,{htmlFor:"config-export-password",children:n("Password")}),a.jsx(En,{id:"config-export-password",type:"password",autoComplete:"new-password",value:o,"aria-invalid":!!(f&&o.length<8),onChange:A=>{i(A.target.value),h(null)}})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(aV,{htmlFor:"config-export-confirmation",children:n("Confirm password")}),a.jsx(En,{id:"config-export-confirmation",type:"password",autoComplete:"new-password",value:l,"aria-invalid":!!(f&&l!==o),onChange:A=>{c(A.target.value),h(null)}})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:n("Use at least 8 characters. This password cannot be recovered.")})]}),p&&a.jsx("p",{className:"text-xs text-muted-foreground",role:"status",children:n("Export cancelled.")}),f&&a.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-destructive",role:"alert",children:[a.jsx(qa,{className:"h-3.5 w-3.5 shrink-0"}),f]})]})}),a.jsx(Wr,{children:v?a.jsx(Ke,{size:"sm",onClick:k,children:n("Done")}):a.jsxs(a.Fragment,{children:[a.jsx(Ke,{variant:"outline",size:"sm",disabled:u,onClick:k,children:n("Cancel")}),a.jsxs(Ke,{size:"sm",disabled:u,onClick:()=>{C()},children:[u?a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Rxe,{className:"h-3.5 w-3.5"}),n(u?"Exporting…":"Export")]})]})})]})})}function lGt({file:e,onClose:t}){const{t:n}=Se(),[r,s]=y.useState(e.encrypted?"password":"preview"),[o,i]=y.useState(""),[l,c]=y.useState("merge"),[u,d]=y.useState(null),[f,h]=y.useState([]),[p,m]=y.useState(null),[v,b]=y.useState(!1),[x,S]=y.useState(null),[k,C]=y.useState(null),[A,N]=y.useState(!1),j=y.useRef(0),I=y.useCallback(async(R,z)=>{const B=++j.current;S("preview"),C(null),d(null),h([]);try{const H=await window.electronAPI.configSync.previewImport({token:e.token,mode:R,...z?{password:z}:{}});if(B!==j.current)return;if(i(""),!H.ok){C(n(H.error));return}c(H.mode),d(H.summary),h(H.warnings),s("preview")}catch{B===j.current&&(i(""),C(n("Could not preview configuration package.")))}finally{B===j.current&&S(null)}},[e.token,n]);y.useEffect(()=>{e.encrypted||I("merge")},[e.encrypted,I]);const _=()=>{x||(j.current+=1,N(!1),i(""),window.electronAPI.configSync.cancelImport(e.token).catch(()=>{}),t())},L=R=>{R===l||x||(c(R),I(R))},M=!!u?.some(R=>(R.category==="skills"||R.category==="mcpServers")&&R.added+R.updated+R.skipped>0),F=u!==null,D=async()=>{if(u){S("commit"),C(null);try{const R=await window.electronAPI.configSync.commitImport({token:e.token,mode:l});if(!R.ok){d(null),h([]),C(n(R.error));return}i("");try{await be.persist.rehydrate()}catch{b(!0)}h(R.warnings),m(R.backupPath),s("success")}catch{d(null),h([]),C(n("Could not import configuration."))}finally{S(null)}}};return a.jsxs(gr,{open:!0,onOpenChange:R=>!R&&_(),children:[a.jsxs(vr,{className:"max-w-2xl",showCloseButton:x===null,children:[a.jsxs(xr,{children:[a.jsx(dr,{children:n(r==="success"?"Configuration imported":"Import configuration")}),a.jsx(oo,{children:r==="success"?n(v?"Configuration was imported, but this window could not refresh automatically.":"This window has been refreshed with the imported settings."):n("Review {{fileName}} before changing this device.",{fileName:e.fileName})})]}),r==="password"&&a.jsxs(rr,{className:"space-y-4",children:[a.jsxs(kd,{variant:"info",children:[a.jsx(yxe,{}),a.jsx(Rw,{children:n("Encrypted configuration package")}),a.jsx(Sd,{children:n("Enter the export password to decrypt and preview this package.")})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(aV,{htmlFor:"config-import-password",children:n("Password")}),a.jsx(En,{id:"config-import-password",type:"password",autoFocus:!0,autoComplete:"current-password",value:o,"aria-invalid":!!k,onChange:R=>{i(R.target.value),C(null)},onKeyDown:R=>{R.key==="Enter"&&o.length>0&&!x&&I("merge",o)}})]}),k&&a.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-destructive",role:"alert",children:[a.jsx(qa,{className:"h-3.5 w-3.5 shrink-0"}),k]})]}),r==="preview"&&a.jsxs(rr,{className:"max-h-[58vh] space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm font-medium",children:n("Import mode")}),a.jsxs(lRe,{value:l,onValueChange:R=>L(R),className:"grid gap-2 sm:grid-cols-2","aria-label":n("Import mode"),children:[a.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 border-border border-b py-3",children:[a.jsx(PV,{value:"merge",disabled:x!==null}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:n("Merge")}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:n("Add and update matching items while keeping items only on this device.")})]})]}),a.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 border-border border-b py-3",children:[a.jsx(PV,{value:"replace",disabled:x!==null}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:n("Replace")}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:n("Replace transferred item categories, removing local-only items in them.")})]})]})]})]}),x==="preview"&&a.jsxs("div",{className:"flex items-center justify-center gap-2 py-6",children:[a.jsx(Jn,{className:"h-4 w-4 animate-spin text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:n("Preparing preview…")})]}),!x&&u&&a.jsx("div",{className:"min-w-0 overflow-x-auto",children:a.jsxs("table",{className:"w-max min-w-full text-sm",children:[a.jsx("thead",{className:"text-xs text-muted-foreground",children:a.jsxs("tr",{className:"border-border border-b",children:[a.jsx("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:n("Category")}),a.jsx("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:n("Added")}),a.jsx("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:n("Updated")}),a.jsx("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:n("Skipped")}),a.jsx("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:n("Removed")})]})}),a.jsx("tbody",{children:oGt.map(({category:R,label:z})=>{const B=u.find(H=>H.category===R);return a.jsxs("tr",{className:"border-border border-t",children:[a.jsx("th",{scope:"row",className:"px-3 py-2 text-left font-medium",children:n(z)}),a.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:B?.added??0}),a.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:B?.updated??0}),a.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:B?.skipped??0}),a.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:B?.removed??0})]},R)})})]})}),!x&&u?.find(R=>R.category==="settings")?.fields?.length?a.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("Portable settings changed:")," ",u.find(R=>R.category==="settings")?.fields?.join(", ")]}):null,l==="replace"&&u&&!x&&a.jsxs(kd,{variant:"error",children:[a.jsx(Nd,{}),a.jsx(Rw,{children:n("Local-only configuration will be deleted")}),a.jsx(Sd,{children:n("Items in transferred collections that exist only on this device will be removed. Removed counts are shown above. Included portable preferences are overwritten. A complete backup is created first.")})]}),f.map(R=>a.jsxs(kd,{variant:"warning",children:[a.jsx(Nd,{}),a.jsx(Sd,{children:n(R)})]},R)),u&&!x&&a.jsxs(kd,{variant:"warning",children:[a.jsx(Rf,{}),a.jsx(Rw,{children:n("Only import packages you trust")}),a.jsx(Sd,{children:n("An imported package can change portable preferences and configuration. Skills and MCP servers may also run commands later when you use them. Previewing does not execute them; continue only if you trust the package.")})]}),k&&a.jsxs(kd,{variant:"error",children:[a.jsx(qa,{}),a.jsx(Sd,{children:k})]})]}),r==="success"&&p&&a.jsxs(rr,{className:"space-y-4",children:[a.jsxs(kd,{variant:"success",children:[a.jsx(By,{}),a.jsx(Rw,{children:n("Import complete")}),a.jsxs(Sd,{children:[a.jsx("p",{children:n("Backup of previous settings:")}),a.jsx("p",{className:"break-all font-mono text-xs text-foreground",children:p})]})]}),v&&a.jsxs(kd,{variant:"warning",children:[a.jsx(Nd,{}),a.jsx(Sd,{children:n("Reopen Settings to load the imported configuration in this window.")})]}),f.map(R=>a.jsxs(kd,{variant:"warning",children:[a.jsx(Nd,{}),a.jsx(Sd,{children:n(R)})]},R))]}),a.jsxs(Wr,{children:[r==="password"&&a.jsxs(a.Fragment,{children:[a.jsx(Ke,{variant:"outline",size:"sm",disabled:x!==null,onClick:_,children:n("Cancel")}),a.jsxs(Ke,{size:"sm",disabled:x!==null||o.length===0,onClick:()=>{I("merge",o)},children:[x==="preview"&&a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin"}),n("Preview")]})]}),r==="preview"&&a.jsxs(a.Fragment,{children:[a.jsx(Ke,{variant:"outline",size:"sm",disabled:x!==null,onClick:_,children:n("Cancel")}),k&&!u?a.jsx(Ke,{size:"sm",disabled:x!==null,onClick:()=>{I(l)},children:n("Refresh preview")}):a.jsxs(Ke,{variant:l==="replace"?"destructive":"default",size:"sm",disabled:x!==null||!u,onClick:()=>{u&&(F?N(!0):D())},children:[x==="commit"?a.jsx(Jn,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Lf,{className:"h-3.5 w-3.5"}),n(x==="commit"?"Importing…":"Import")]})]}),r==="success"&&a.jsx(Ke,{size:"sm",onClick:_,children:n("Done")})]})]}),a.jsx(cGt,{open:A,mode:l,hasImportedExecutableResources:M,onOpenChange:N,onConfirm:()=>{D()}})]})}function cGt({open:e,mode:t,hasImportedExecutableResources:n,onOpenChange:r,onConfirm:s}){const{t:o}=Se();return a.jsx(Zp,{open:e,onOpenChange:r,children:a.jsxs(Jp,{className:"sm:max-w-md",zIndexLevel:"nested",children:[a.jsxs(em,{children:[a.jsxs(nm,{className:"flex items-start gap-2 text-base",children:[a.jsx(Nd,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),o("Confirm configuration import")]}),a.jsxs(rm,{className:"space-y-2",children:[a.jsx("span",{className:"block",children:o("This package can change portable preferences and configuration. Continue only if you trust this package.")}),n&&a.jsx("span",{className:"block",children:o("It includes skills or MCP servers that may execute commands when you use them.")}),t==="replace"&&a.jsx("span",{className:"block",children:o("Replace mode removes local-only items from transferred collections and overwrites included portable preferences. A complete backup will be created first.")}),a.jsx("span",{className:"block",children:o("Do you want to continue with this import?")})]})]}),a.jsxs(tm,{variant:"bare",children:[a.jsx(dx,{render:a.jsx(Ke,{variant:"outline",size:"sm"}),children:o("Cancel")}),a.jsx(Ke,{variant:t==="replace"?"destructive":"default",size:"sm",onClick:()=>{r(!1),s()},children:o("Confirm import")})]})]})})}function uGt({className:e,...t}){const n=Dg();return a.jsx(En,{size:"sm",...n,...t,className:xe("w-[220px] max-w-full",e)})}function dGt(){const{language:e,setLanguage:t}=be(),{t:n}=Se();return a.jsxs(yi,{title:n("General"),description:n("General application settings"),children:[a.jsxs(Xn,{title:n("Application"),children:[a.jsx(jn,{rowId:"general.language",label:n("Language"),children:a.jsx(Zo,{value:e,onValueChange:t,options:[{value:"en",label:"English"},{value:"zh",label:"简体中文"}]})}),a.jsx(fGt,{})]}),a.jsxs(Xn,{title:n("Network"),children:[a.jsx(hGt,{}),a.jsx(pGt,{})]}),a.jsx(iGt,{}),a.jsx(gGt,{}),window.electronAPI.env.platform==="darwin"&&a.jsxs(Xn,{title:n("Integrations"),children:[a.jsx(Kde,{kind:"ensoCommand",title:n("'enso' terminal command"),description:n("Run `enso .` in a terminal to open the current folder in EnsoCode. Links the command into /usr/local/bin and may ask for your password.")}),a.jsx(Kde,{kind:"finderQuickAction",title:n("Finder Quick Action"),description:n("Right-click a folder in Finder and choose Services > Open with EnsoCode.")})]})]})}function Kde({kind:e,title:t,description:n}){const{t:r}=Se(),[s,o]=y.useState(!1),[i,l]=y.useState(!1);y.useEffect(()=>{let u=!0;const d=()=>{Yv()||window.electronAPI.window.shellIntegrationStatus().then(f=>{u&&o(f[e])})};return d(),window.addEventListener("focus",d),()=>{u=!1,window.removeEventListener("focus",d)}},[e]);const c=async()=>{l(!0);try{await window.electronAPI.window.installShellIntegration(e)}finally{try{const u=await window.electronAPI.window.shellIntegrationStatus();o(u[e])}finally{l(!1)}}};return a.jsx(jn,{rowId:`general.${e}`,label:t,description:n,children:a.jsx(fn,{disabled:i,onClick:()=>{c()},children:r(i?"In progress…":s?"Uninstall":"Install")})})}function fGt(){const{t:e}=Se(),t=be(r=>r.notifyMainAgentOnly),n=be(r=>r.setNotifyMainAgentOnly);return a.jsx(jn,{rowId:"general.notifyMainAgentOnly",label:e("Notify only for the main agent"),description:e("Skip coworker completion and failure notifications on this computer and the paired phone. Questions and approvals still notify."),children:a.jsx($r,{checked:t,onCheckedChange:n})})}function Xde(e,t){window.electronAPI.proxy.apply({mode:e,customUrl:t})}function hGt(){const{t:e}=Se(),t=be(f=>f.proxyMode),n=be(f=>f.customProxyUrl),r=be(f=>f.setProxyMode),s=be(f=>f.setCustomProxyUrl),[o,i]=y.useState(n),[l,c]=y.useState(null);y.useEffect(()=>{i(n)},[n]);const u=f=>{r(f),Xde(f,n)},d=()=>{const f=o.trim();if(f&&!eq(f)){c(e("Enter an http(s) proxy URL"));return}c(null),s(f),Xde(t,f)};return a.jsxs("div",{"data-settings-row":"general.proxy",children:[a.jsx(jn,{label:e("Network proxy"),description:e("Used by model requests, the built-in browser, and agent tools"),children:a.jsx(Zo,{value:t,onValueChange:u,options:[{value:"system",label:e("Follow system proxy")},{value:"none",label:e("No proxy")},{value:"custom",label:e("Custom proxy")}]})}),t==="custom"&&a.jsx(jn,{label:e("Proxy URL"),children:a.jsxs("div",{className:"flex w-full max-w-[220px] flex-col items-end gap-1",children:[a.jsx(uGt,{value:o,placeholder:"http://127.0.0.1:7890",onChange:f=>i(f.target.value),onBlur:d,onKeyDown:f=>{f.key==="Enter"&&d()}}),l&&a.jsx("p",{className:"text-right text-[12px] text-destructive",children:l})]})})]})}function pGt(){const{t:e}=Se(),t=be(f=>f.customCaCertPath),n=be(f=>f.setCustomCaCertPath),[r,s]=y.useState(null),[o,i]=y.useState(!1);y.useEffect(()=>{let f=!0;return window.electronAPI.caCert.status().then(h=>{f&&s(h)}).catch(()=>{}),()=>{f=!1}},[]);const l=async f=>{n(f),i(!0);try{s(await window.electronAPI.caCert.apply(f))}catch{}finally{i(!1)}},c=async()=>{const f=await window.electronAPI.dialog.selectFile([...sGt]);f&&await l(f)},u={"not-absolute":e("Path must be absolute"),"not-found":e("File not found"),"not-file":e("Not a file"),"not-readable":e("File is not readable")},d=()=>r?r.source==="env"?e("Using NODE_EXTRA_CA_CERTS from the launch environment: {{path}}",{path:r.path}):r.source==="setting"?e("Set: {{path}}",{path:r.path}):r.source==="shell"?e("Not set; using NODE_EXTRA_CA_CERTS from the login shell: {{path}}",{path:r.path}):e("Not set"):"";return a.jsxs(jn,{rowId:"general.caCert",label:e("Custom CA certificate"),description:a.jsxs(a.Fragment,{children:[e("Trust an extra CA (PEM file) for model endpoints signed by a private CA. TLS verification stays on."),r?.error?a.jsx("span",{className:"mt-1 block break-all text-destructive",children:e("Certificate file unavailable ({{reason}}): {{path}}",{reason:u[r.error],path:r.settingPath})}):d()&&a.jsx("span",{className:"mt-1 block break-all",children:d()}),a.jsx("span",{className:"mt-1 block",children:e("Changes restart the agent process right away (running turns are interrupted). Requests made by the app main process take effect after restarting the app.")})]}),children:[a.jsx(fn,{disabled:o,onClick:()=>{c()},children:e("Choose certificate file")}),t&&a.jsx(fn,{variant:"ghost",disabled:o,onClick:()=>{l("")},children:e("Clear")})]})}function mGt(e,t,n){return e==="npm"?n("Server updates install the new version with npm and restart gracefully: running tasks finish first (up to a limit), then the server restarts and tasks resume."):a.jsxs(a.Fragment,{children:[n("This server must be updated on the machine itself."),a.jsxs("code",{"data-server-manual-command":!0,className:"mt-0.5 block",children:["npm i -g ",Vqe(t)]})]})}const Qde="0.3.15-beta.240";function gGt(){const{t:e}=Se(),t=be(N=>N.autoUpdate),n=be(N=>N.setAutoUpdate),r=be(N=>N.autoRestartForUpdate),s=be(N=>N.setAutoRestartForUpdate),o=be(N=>N.updateChannel==="beta"?"beta":"stable"),i=be(N=>N.setUpdateChannel),[l,c]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(!1),[p,m]=y.useState(!1);y.useEffect(()=>{let N=!0;window.electronAPI.updater.getState().then(I=>{N&&(d(I),I.status&&c(_=>_??I.status))}).catch(()=>{});const j=window.electronAPI.updater.onStatus(c);return()=>{N=!1,j()}},[]);const v=u?.host==="server"?u:null,b=u?.host==="desktop"||v!==null&&v.mode!=="manual",x=(l?.status==="available"||l?.status==="downloaded")&&!!l.info,S=l?.status==="applying",C=(()=>{if(!l)return null;switch(l.status){case"checking":return e("Checking for updates…");case"available":return l.manualInstall?e("New version {{version}} found. This local build can't install it automatically.",{version:l.info?.version??""}):e("New version {{version}} found",{version:l.info?.version??""});case"not-available":return e("You are on the latest version");case"downloading":return e("Downloading update… {{percent}}%",{percent:Math.round(l.progress?.percent??0)});case"downloaded":return v?.restartMethod==="manual"?e("New version {{version}} is downloaded. Applying it installs and then stops the server — you will need to restart it externally (container or process manager).",{version:l.info?.version??""}):e("New version {{version}} is downloaded. Restarting waits for the current tool to finish; background commands keep running.",{version:l.info?.version??""});case"applying":{const N=l.applying?.stage;return N==="waiting-tasks"?e("Waiting for {{count}} running tasks to finish before installing…",{count:l.applying?.busyCount??0}):N==="installing"?e("Installing {{version}}…",{version:l.info?.version??""}):e("Restarting server…")}case"error":return l.manualInstall?e("This local build is signed differently from the release and can't install updates automatically. Download it manually."):v&&l.error?e("Update failed: {{error}}",{error:l.error}):e("Update check failed");default:return null}})(),A=l?.status==="checking"||l?.status==="downloading";return a.jsxs(Xn,{rowId:"general.updates",title:e("Updates"),description:v?mGt(v.mode,o,e):e("Application update settings"),children:[a.jsxs(jn,{label:a.jsxs(a.Fragment,{children:[e("Current version")," · ",Qde]}),description:C?a.jsx("span",{className:xe("block",!l?.manualInstall&&"truncate"),children:C}):void 0,children:[x&&a.jsx(fn,{variant:"ghost",onClick:()=>m(!0),children:e("Release notes")}),l?.manualInstall?a.jsx(UY,{manualInstall:l.manualInstall}):S?a.jsx(fn,{variant:"default",disabled:!0,children:e("Updating…")}):l?.status==="downloaded"?a.jsx(fn,{variant:"default",onClick:()=>{Q$(e)},children:e("Restart to update")}):b&&l?.status==="available"?a.jsx(fn,{variant:"default",onClick:()=>{window.electronAPI.updater.downloadUpdate()},children:e("Download update")}):a.jsx(fn,{disabled:A,onClick:()=>{window.electronAPI.updater.checkForUpdates()},children:e("Check for updates")}),a.jsx(mAe,{open:p,onOpenChange:m,status:l,canDownload:b})]}),v?.canRestart&&a.jsxs(jn,{label:e("Restart server"),description:e("Running tasks are interrupted; this page reconnects after the server is back."),children:[a.jsx(fn,{onClick:()=>h(!0),children:e("Restart")}),a.jsx(ec,{open:f,onOpenChange:h,title:e("Restart server?"),description:e("Running tasks are interrupted; this page reconnects after the server is back."),confirmLabel:e("Restart"),onConfirm:()=>{h(!1),window.electronAPI.updater.restart()}})]}),a.jsx(jn,{label:e("Automatic updates"),description:v?.mode==="manual"?e("Not available for this install: it cannot update itself. Update manually instead."):e("Download and install updates automatically"),children:a.jsx($r,{checked:t,disabled:v?.mode==="manual",onCheckedChange:N=>{n(N),window.electronAPI.updater.setAutoUpdateEnabled(N)}})}),a.jsx("div",{className:t?void 0:"opacity-60",children:a.jsx(jn,{label:e("Restart automatically to apply updates"),description:e(r==="immediate"?"Restart as soon as the update is downloaded, even while agents are running or messages are queued. The restart happens after the current tool finishes, and running sessions keep going afterwards. It still waits while you're using the window (input in the last 2 minutes), while an input box has an unsent draft, or while a question or approval is pending.":r==="idle"?"After the update is downloaded, restart automatically if no agent is running, nothing is queued, and there are no pending questions or approvals. The idle state must last 5 minutes, and a focused window also blocks it.":"Only notify when an update is ready; never restart automatically."),children:a.jsx(Zo,{value:r,disabled:!t,onValueChange:N=>{cye(N)&&(s(N),window.electronAPI.updater.setAutoRestartMode(N))},options:[{value:"off",label:e("Off")},{value:"idle",label:e("When idle")},{value:"immediate",label:e("Don't wait for idle")}]})})}),(u?.host==="desktop"||u?.host==="server")&&a.jsx(jn,{rowId:"general.updateChannel",label:e("Update channel"),description:a.jsxs(a.Fragment,{children:[e(o==="beta"?"Beta builds come from the latest main branch and may be unstable. You get whichever of beta and stable is newer.":"Only stable releases."),o==="stable"&&Uqe(Qde)&&a.jsx("span",{className:"mt-0.5 block",children:e("You're on a beta build. Switching to stable doesn't downgrade; you'll move to the next stable release once it's out.")})]}),children:a.jsx(Zo,{value:o,onValueChange:N=>{const j=N==="beta"?"beta":"stable";i(j),window.electronAPI.updater.setChannel(j)},options:[{value:"stable",label:e("Stable")},{value:"beta",label:e("Beta")}]})})]})}function vGt({instruction:e,onClose:t}){const{t:n}=Se(),r=be(j=>j.addInstructions),s=be(j=>j.updateInstruction),o=e==="new",i=o||!e?null:e,[l,c]=y.useState(""),[u,d]=y.useState(""),[f,h]=y.useState(!1),[p,m]=y.useState(!1),[v,b]=y.useState(null),[x,S]=y.useState(!1),[k,C]=y.useState(!1);y.useEffect(()=>{if(e){if(e==="new"){c(""),d(""),S(!1),b(null),C(!1),h(!1);return}c(e.name),S(!1),b(null),C(!1),h(!0),window.electronAPI.instructions.read(e.id,e.local,e.sourcePath).then(j=>{j.ok?d(j.content):(d(""),b(j.error??n("Failed to read content")))}).finally(()=>h(!1))}},[e,n]);const A=!!(i&&!i.local&&i.sourcePath),N=async()=>{if(!e||!l.trim())return;if(m(!0),o){const I=crypto.randomUUID(),_=await window.electronAPI.instructions.write(I,u);if(!_.ok){m(!1),b(n("Failed to save"));return}const L=r([{id:I,name:l.trim(),source:"Manual",local:!0,bytes:_.bytes,enabled:!0}]);if(m(!1),L===0){window.electronAPI.instructions.delete(I),b(n("An instruction with this name already exists"));return}t();return}if(!i){m(!1);return}if(A&&k&&i.sourcePath){const I=await window.electronAPI.instructions.writeSource(i.id,i.sourcePath,u);if(m(!1),!I.ok){b(I.error??n("Failed to save"));return}s(i.id,{name:l.trim(),bytes:I.bytes}),t();return}const j=await window.electronAPI.instructions.write(i.id,u);if(m(!1),!j.ok){b(n("Failed to save"));return}s(i.id,{name:l.trim(),local:!0,bytes:j.bytes}),t()};return a.jsx(gr,{open:e!==null,onOpenChange:j=>!j&&t(),children:a.jsxs(vr,{className:"max-w-2xl",children:[a.jsx(xr,{children:a.jsx(dr,{children:n(o?"Add Instruction":"Edit Instruction")})}),a.jsxs(rr,{className:"space-y-4",children:[o?null:A?a.jsxs("div",{className:xe("w-full rounded-md px-3 py-2.5 transition-colors",k?"bg-destructive/8":"bg-amber-500/8"),children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[k?a.jsx(Nd,{className:"h-3.5 w-3.5 shrink-0 text-destructive"}):a.jsx(gg,{className:"h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-500"}),a.jsx("span",{className:"font-medium text-xs",children:n("Write back to original file")})]}),a.jsx(Xi,{checked:k,onCheckedChange:C})]}),a.jsx("p",{className:"mt-1.5 pl-5.5 text-muted-foreground text-xs leading-relaxed",children:k?n("Saving overwrites {{path}} directly — {{source}} will pick up the change.",{path:i?.sourcePath??"",source:i?.source??""}):n("Saving creates a local copy — {{path}} is left untouched, and this entry stops following its updates.",{path:i?.sourcePath??""})})]}):a.jsxs("div",{className:"flex w-full items-start gap-2 rounded-md bg-muted/50 px-3 py-2",children:[a.jsx(gg,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:n("Local copy — edits stay in this app.")})]}),a.jsxs(Tr,{children:[a.jsx(jr,{children:n("Name")}),a.jsx(En,{value:l,onChange:j=>c(j.target.value)})]}),a.jsxs(Tr,{children:[a.jsx(jr,{children:n("Content")}),f?a.jsxs("div",{className:"flex w-full items-center justify-center gap-2 py-12",children:[a.jsx(Jn,{className:"h-4 w-4 animate-spin text-muted-foreground"}),a.jsx("span",{className:"text-muted-foreground text-xs",children:n("Loading...")})]}):a.jsx(_i,{value:u,onChange:j=>{d(j.target.value),S(!0)},rows:16,className:"font-mono text-xs"})]}),v&&a.jsxs("p",{className:"flex items-center gap-1.5 text-destructive text-xs",children:[a.jsx(qa,{className:"h-3.5 w-3.5 shrink-0"}),v]})]}),a.jsxs(Wr,{children:[a.jsx(Ke,{variant:"outline",size:"sm",onClick:t,children:n("Cancel")}),a.jsxs(Ke,{size:"sm",variant:A&&k?"destructive":"default",disabled:!l.trim()||f||p,onClick:N,children:[p&&a.jsx(Jn,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),n(A?k?"Overwrite original":x?"Save as local copy":"Save":"Save")]})]})]})})}const Zde=e=>e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`;function xGt(){const{t:e}=Se(),t=be(f=>f.instructions),n=be(f=>f.updateInstruction),r=be(f=>f.removeInstruction),[s,o]=y.useState(!1),[i,l]=y.useState(null),c=t.map(f=>f.id),u=xL(c,f=>window.electronAPI.assets.instructionOccupancy(f)),d=mL(t.filter(f=>f.enabled).map(f=>f.id),u.rows);return a.jsxs(yi,{rowId:"instructions.root",title:a.jsxs(a.Fragment,{children:[e("Instruction Files"),a.jsx(vL,{tokens:d}),a.jsx(Df,{})]}),description:e("Global CLAUDE.md / AGENTS.md style files from local AI tools"),actions:a.jsxs(a.Fragment,{children:[a.jsxs(fn,{onClick:()=>o(!0),children:[a.jsx(XA,{className:"h-4 w-4"}),e("Import from local apps")]}),a.jsxs(fn,{onClick:()=>l("new"),children:[a.jsx(xs,{className:"h-4 w-4"}),e("Add instruction")]})]}),children:[a.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:e("Only one file is active at a time; enabling one disables the others")}),a.jsx(Xn,{children:t.length===0?a.jsxs("div",{className:"border-border border-b py-8 text-center",children:[a.jsx($p,{className:"mx-auto h-5 w-5 text-muted-foreground"}),a.jsx("p",{className:"mt-3 font-medium text-[13px]",children:e("No instruction files yet")}),a.jsx("p",{className:"mt-1 text-muted-foreground text-xs",children:e("Import instruction files from local apps or add one manually to get started")})]}):t.map(f=>a.jsxs(jn,{rowId:`instructions.${f.id}`,label:a.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx("span",{className:xe(!f.enabled&&"text-muted-foreground line-through"),children:f.name}),a.jsx($n,{variant:"secondary",className:"text-[11px]",children:f.source}),!f.local&&a.jsxs($n,{variant:"outline",className:"gap-1 text-[11px]",children:[a.jsx(xxe,{className:"h-3 w-3"}),e("Linked")]})]}),description:a.jsx("span",{className:"block truncate",children:f.local?`${e("Local copy")} · ${Zde(f.bytes)}`:`${f.sourcePath} · ${Zde(f.bytes)}`}),status:a.jsx(gL,{row:u.rows[f.id],pending:u.pending&&!u.rows[f.id]}),children:[a.jsx($r,{checked:f.enabled,onCheckedChange:h=>n(f.id,{enabled:h})}),a.jsx(Ke,{variant:"ghost",size:"icon-sm","aria-label":e("Edit"),className:"text-muted-foreground",onClick:()=>l(f),children:a.jsx(Pi,{className:"h-3.5 w-3.5"})}),a.jsx(Ke,{variant:"ghost",size:"icon-sm","aria-label":e("Delete"),className:"text-muted-foreground hover:text-destructive-text",onClick:()=>r(f.id),children:a.jsx(io,{className:"h-3.5 w-3.5"})})]},f.id))}),a.jsx(pL,{kind:"instruction",open:s,onOpenChange:o}),a.jsx(vGt,{instruction:i,onClose:()=>l(null)})]})}const bGt=(e,t)=>`plugin:${e}:${t}`;function oMe(e,t,n){const r=new Map;for(const[i,l]of Object.entries(n))l&&r.set(l,i);const s=new Map;return{rows:e.map(i=>{const l=bGt(i.pluginId,i.id),c=t[l]!==void 0,u=c?t[l]:i.key??"",d=u?r.get(u):void 0;return u&&!d&&(r.set(u,l),s.set(u,i)),{action:l,command:i,binding:u,custom:c,...d?{conflict:d}:{}}}),byBinding:s}}const iMe="relative inline-flex h-(--settings-control-h) min-w-14 items-center justify-center rounded-md px-1.5 transition-colors";function i4({title:e,onClick:t,children:n}){return a.jsx(Ke,{size:"icon-xs",variant:"ghost",title:e,onClick:t,className:"text-muted-foreground hover:text-foreground pointer-coarse:size-[44px]",children:n})}function yGt(){const{t:e}=Se();return a.jsxs(yi,{rowId:"shortcuts.root",title:e("Shortcuts"),description:e("Click a shortcut to rebind it. Backspace removes it; Esc cancels."),children:[a.jsx(SGt,{}),a.jsx(kGt,{})]})}function wGt(){const[e,t]=y.useState([]);return y.useEffect(()=>{const n=window.electronAPI.extensionPlugins;let r=!0;const s=()=>{n.list().then(i=>r&&t(xje(i)))};s();const o=n.onChanged(s);return()=>{r=!1,o()}},[]),e}function kGt(){const{t:e}=Se(),t=wGt(),n=be(m=>m.keybindings),r=be(m=>m.setKeybinding),s=be(m=>m.resetKeybinding),[o,i]=y.useState(null),[l,c]=y.useState(null);if(t.length===0)return null;const u=jh(n),{rows:d}=oMe(t,n,u),f=m=>d.find(v=>v.action===m)?.command.title??e(NH[m]??m),h=()=>{i(null),c(null)},p=(m,v,b)=>{if(m.preventDefault(),m.stopPropagation(),m.key==="Escape")return h();if(m.key==="Backspace"||m.key==="Delete")return r(v,""),h();const x=qv(m);if(!x)return;const S=AH.find(k=>u[k]===x)??d.find(k=>k.action!==v&&!k.conflict&&k.binding===x)?.action;if(S)return c(S);x===b?s(v):r(v,x),h()};return a.jsx(Xn,{title:"插件命令",children:d.map(({action:m,command:v,binding:b,custom:x,conflict:S})=>{const k=o===m;return a.jsxs(jn,{label:v.title,description:a.jsxs(a.Fragment,{children:[v.pluginName,S&&!k&&a.jsx("span",{className:"ml-2 text-destructive-text",children:e('Already used by "{{label}}"',{label:f(S)})})]}),status:k&&l&&a.jsx("span",{className:"text-[12px] text-destructive-text",children:e('Already used by "{{label}}"',{label:f(l)})}),children:[b&&!k&&a.jsx(i4,{title:e("Remove shortcut"),onClick:()=>r(m,""),children:a.jsx(Jr,{className:"h-3.5 w-3.5"})}),x&&!k&&a.jsx(i4,{title:e("Reset to default"),onClick:()=>s(m),children:a.jsx($u,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",onClick:()=>{i(m),c(null)},onKeyDown:k?C=>p(C,m,v.key):void 0,onBlur:()=>k&&h(),autoFocus:k,className:xe(iMe,k?"ring-1 ring-ring":"hover:bg-muted",S&&!k&&"opacity-50 line-through"),children:k?a.jsx("span",{className:"text-muted-foreground text-xs",children:e("Press shortcut…")}):b?a.jsx(Ed,{children:Fd(b)}):a.jsx("span",{className:"text-muted-foreground text-xs",children:e("No shortcut")})})]},m)})})}function SGt(){const{t:e}=Se(),t=be(d=>d.keybindings),n=be(d=>d.setKeybinding),r=be(d=>d.resetKeybinding),[s,o]=y.useState(null),[i,l]=y.useState(null),c=jh(t),u=d=>{if(d.preventDefault(),d.stopPropagation(),!s)return;if(d.key==="Escape"){o(null),l(null);return}if(d.key==="Backspace"||d.key==="Delete"){n(s,""),o(null),l(null);return}const f=qv(d,{allowBare:s==="send-message"});if(!f)return;const h=AH.find(p=>p!==s&&c[p]===f);if(h){l(h);return}f===i2e[s]?r(s):n(s,f),o(null),l(null)};return a.jsx(Xn,{children:AH.map(d=>{const f=s===d,h=t[d]!==void 0,p=c[d],m=ect[d];return a.jsxs(jn,{label:e(NH[d]),description:m&&e(m),status:f&&i&&a.jsx("span",{className:"text-[12px] text-destructive-text",children:e('Already used by "{{label}}"',{label:e(NH[i])})}),children:[p&&!f&&a.jsx(i4,{title:e("Remove shortcut"),onClick:()=>n(d,""),children:a.jsx(Jr,{className:"h-3.5 w-3.5"})}),h&&!f&&a.jsx(i4,{title:e("Reset to default"),onClick:()=>r(d),children:a.jsx($u,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",onClick:()=>{o(d),l(null)},onKeyDown:f?u:void 0,onBlur:()=>{f&&(o(null),l(null))},autoFocus:f,className:xe(iMe,f?"ring-1 ring-ring":"hover:bg-muted"),children:f?a.jsx("span",{className:"text-xs text-muted-foreground",children:e("Press shortcut…")}):p?a.jsx(Ed,{children:Fd(p)}):a.jsx("span",{className:"text-xs text-muted-foreground",children:e("No shortcut")})})]},d)})})}const Jde=[1,6,24,72,168],CGt=24;function EGt(){const{t:e}=Se();if(Yv())return null;const t=async()=>{try{const n=await window.electronAPI.window.openDevTools();if(n.ok)return;Ht({type:"error",title:e("Could not open developer tools"),description:n.error==="main-window-unavailable"?e("The main window is closed. Open it and try again."):n.error})}catch(n){Ht({type:"error",title:e("Could not open developer tools"),description:n instanceof Error?n.message:String(n)})}};return a.jsx(jn,{rowId:"logs.devTools",label:e("Developer tools"),description:e("Open the console of the main window to see errors and logs."),children:a.jsx(fn,{onClick:()=>{t()},children:e("Open")})})}const TGt={main:"Main process",agent:"Agent worker",plugin:"Plugin",mcp:"MCP"},AGt={main:"bg-sky-500/10 text-sky-600 dark:text-sky-400",agent:"bg-violet-500/10 text-violet-600 dark:text-violet-400",plugin:"bg-amber-500/10 text-amber-600 dark:text-amber-400",mcp:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"},NGt={1:"Last hour",6:"Last 6 hours",24:"Last 24 hours",72:"Last 3 days",168:"Last 7 days"};function IGt(){const{t:e}=Se();return a.jsxs(yi,{title:e("Logs"),description:e("Recent errors and log export. API keys, tokens and passwords are masked."),children:[a.jsx(jGt,{}),a.jsx(RGt,{}),a.jsx(MGt,{}),a.jsx(Xn,{title:e("Troubleshooting"),children:a.jsx(EGt,{})})]})}function jGt(){const{t:e}=Se(),t=be(o=>o.appLoggingEnabled===!0),n=be(o=>o.setAppLoggingEnabled),r=be(o=>o.pluginLoggingEnabled===!0),s=be(o=>o.setPluginLoggingEnabled);return a.jsxs(Xn,{children:[a.jsx(jn,{label:e("Record app logs"),description:e("Off by default. Write main process and agent logs to disk. Files needed for restart recovery are always kept."),children:a.jsx($r,{checked:t,onCheckedChange:n})}),a.jsx(jn,{label:e("Record plugin logs"),description:e("Off by default. Record plugin console output and runtime logs to disk. Startup failures and crashes are still shown."),children:a.jsx($r,{checked:r,onCheckedChange:s})})]})}function RGt(){const{t:e}=Se(),t=be(p=>p.appLoggingEnabled===!0),n=be(p=>p.setAppLoggingEnabled),[r,s]=y.useState("error"),[o,i]=y.useState(null),[l,c]=y.useState(!1),[u,d]=y.useState(null),f=y.useRef(0),h=y.useCallback(async p=>{const m=++f.current;c(!0);try{const v=await window.electronAPI.logs.errors(p);if(f.current!==m)return;i(v.map((b,x)=>({key:`${x}:${b.time}`,entry:b}))),d(null)}catch{if(f.current!==m)return;i([])}finally{f.current===m&&c(!1)}},[]);return y.useEffect(()=>{h(r)},[r,h]),a.jsxs(Xn,{title:e("Recent errors"),actions:a.jsxs(a.Fragment,{children:[a.jsx(nX,{"aria-label":e("Recent errors"),value:r,onValueChange:s,options:[{value:"error",label:e("Errors only")},{value:"warn",label:e("Warnings and errors")}]}),a.jsx(fn,{"aria-label":e("Refresh"),disabled:l,onClick:()=>{h(r)},children:a.jsx(Lo,{className:xe("h-3.5 w-3.5",l&&"animate-spin")})})]}),children:[!t&&a.jsx(jn,{label:e("App logging is off"),description:e("New app logs are not recorded while off. Existing logs are kept below."),children:a.jsx(fn,{onClick:()=>n(!0),children:e("Enable app logging")})}),o&&o.length===0?a.jsx("p",{className:"border-border border-b py-6 text-center text-[13px] text-muted-foreground",children:e("No errors recorded.")}):a.jsx("ul",{children:(o??[]).map(({key:p,entry:m})=>{const v=u===p;return a.jsxs("li",{className:"border-border border-b",children:[a.jsxs("button",{type:"button",className:"-mx-2 flex min-h-[44px] w-[calc(100%+1rem)] items-center gap-2 rounded-md px-2 py-2 text-left text-[13px] hover:bg-accent/50","aria-expanded":v,onClick:()=>d(v?null:p),children:[a.jsx(Bs,{className:xe("h-3.5 w-3.5 shrink-0 transition-transform",v&&"rotate-90")}),a.jsx("span",{className:"shrink-0 tabular-nums text-xs text-muted-foreground",children:new Date(m.time).toLocaleString()}),a.jsx("span",{className:xe("shrink-0 rounded px-1.5 py-0.5 text-xs",AGt[m.source]),children:e(TGt[m.source])}),m.level==="warn"&&a.jsx("span",{className:"shrink-0 text-xs text-amber-600 dark:text-amber-400",children:e("Warning")}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.message})]}),v&&a.jsx("pre",{className:"mb-3 max-h-72 overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted/40 px-3 py-2 font-mono text-xs",children:m.detail})]},p)})})]})}function MGt(){const{t:e}=Se(),t=be(l=>l.appLoggingEnabled===!0),[n,r]=y.useState(CGt),[s,o]=y.useState(!1),i=async()=>{o(!0);try{const l=await window.electronAPI.logs.export(n);l.ok?l.cancelled||Ht({type:"success",title:e("Logs exported"),description:l.path,actions:[{label:e("Show in folder"),onClick:()=>{window.electronAPI.logs.revealExport()}}]}):Ht({type:"error",title:e("Log export failed"),description:l.error})}finally{o(!1)}};return a.jsx(Xn,{title:e("Export logs"),description:e("Pack logs from the selected period into a zip file for troubleshooting."),children:a.jsxs(jn,{label:e("Time range"),description:t?void 0:e("App logging is off. The export only includes logs recorded earlier."),children:[a.jsx(Zo,{value:String(n),onValueChange:l=>{const c=Jde.find(u=>String(u)===l);c&&r(c)},options:Jde.map(l=>({value:String(l),label:e(NGt[l])}))}),a.jsxs(fn,{variant:"default",disabled:s,onClick:()=>{i()},children:[a.jsx(Lf,{className:"h-3.5 w-3.5"}),e(s?"Exporting...":"Export")]})]})})}function _Gt(e){return e.serverId??e.serverName}function aMe(e,t){const n={...e};return t.serverId&&delete n[t.serverName],n[_Gt(t)]={state:t.state,...t.toolCount!==void 0?{toolCount:t.toolCount}:{},...t.error?{error:t.error}:{}},n}function PGt(e){return e.reduce((t,n)=>aMe(t,n),{})}function LGt(e,t){return{...e,[t]:{state:"connecting"}}}function OGt(e,t,n){return{...e,[t]:{state:"error",...n?{error:n}:{}}}}const C7=(e,t)=>{const n={...e};return delete n[t],n},vb=bi()((e,t)=>({statuses:{},authorized:{},pending:{},bind:()=>(window.electronAPI.mcp.authState().then(n=>e({authorized:n})).catch(()=>{}),window.electronAPI.mcp.statusSnapshot().then(n=>e({statuses:{...t().statuses,...PGt(n)}})).catch(()=>{}),window.electronAPI.mcp.onStatus(n=>{if(n.type==="mcp-status-cleared"){e({statuses:{}});return}e({statuses:aMe(t().statuses,n)}),window.electronAPI.mcp.authState().then(r=>e({authorized:r})).catch(()=>{})})),authorize:async n=>{e({statuses:LGt(t().statuses,n),pending:{...t().pending,[n]:!0}});let r;try{r=await window.electronAPI.mcp.authorize(n)}catch(s){r={ok:!1,error:s instanceof Error?s.message:String(s)}}e({pending:C7(t().pending,n),...r.ok?{authorized:{...t().authorized,[n]:!0}}:{statuses:OGt(t().statuses,n,r.error)}})},revoke:async n=>{await window.electronAPI.mcp.revoke(n),e({authorized:C7(t().authorized,n),statuses:C7(t().statuses,n)})}})),zp=e=>typeof e=="string"?e.trim():"",DGt=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[],lMe=e=>{if(!e||typeof e!="object")return{};const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t};function BGt(e){const t=lMe(e);return delete t[""],Object.keys(t).length>0?t:void 0}function efe(e){const t={};for(const n of e.split(`
|
|
788
788
|
`)){const r=n.indexOf(":"),s=r>0?n.slice(0,r).trim():"";s&&(t[s]=n.slice(r+1).trim())}return Object.keys(t).length>0?t:void 0}const tfe=e=>Object.entries(e??{}).map(([t,n])=>`${t}: ${n}`).join(`
|
|
789
789
|
`);function FGt(e,t){const n=zp(e).toLowerCase();return n==="sse"?"sse":n==="http"||n==="streamable-http"?"http":n==="stdio"?"stdio":t?"http":"stdio"}function nfe(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,r]of Object.entries(e)){if(!r||typeof r!="object")continue;const s=r,o=zp(s.url)||zp(s.serverUrl),i=zp(s.command);if(!i&&!o)continue;const l=i?void 0:BGt(s.headers);t.push({name:n,transport:FGt(s.type??s.transport,o),command:i||void 0,args:i?DGt(s.args):void 0,env:i?lMe(s.env):void 0,url:o||void 0,...l?{headers:l}:{}})}return t}const zGt=e=>{const t=e.trim();return(t.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i)?.[1]??t).trim()},HGt=e=>e.startsWith('"')&&!e.startsWith("{")&&!e.startsWith("[")?`{${e}}`:e,UGt=e=>{if(!e||typeof e!="object"||Array.isArray(e))return e;const t=e;if(t.mcpServers!=null)return t.mcpServers;if(t.mcp_servers!=null)return t.mcp_servers;if(t.servers!=null)return t.servers;const n=t.mcp;if(n&&typeof n=="object"&&!Array.isArray(n)){const r=n.servers;if(r!=null)return r}return e},VGt=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return!!(zp(t.command)||zp(t.url)||zp(t.serverUrl))},GGt=e=>{const t=zp(e.command);return t&&t.split(/[\\/]/).pop()?.trim()||"mcp"},HV=e=>{if(Array.isArray(e))return e.flatMap(HV);if(VGt(e)){const t=zp(e.name)||zp(e.id)||GGt(e);return nfe({[t]:e})}return nfe(e)};function E7(e){let t;try{t=JSON.parse(HGt(zGt(e)))}catch{return{ok:!1,error:"invalid-json"}}const n=Array.isArray(t)?t.flatMap(HV):HV(UGt(t));return n.length===0?{ok:!1,error:"empty"}:{ok:!0,servers:n}}const WGt=1e4,qGt=12e4,YGt=600,$Gt=3600;function rfe(e,t){let n;if(typeof e=="string"){const r=e.trim();if(!r||!/^\d+$/.test(r))return;n=Number(r)}else if(typeof e=="number")n=e;else return;if(!(!Number.isInteger(n)||n<=0))return t===void 0?n:Math.min(n,t)}const a4=10,l4=13,KGt=4,XGt=40;function GX(e){const t=[0];let n=e.indexOf("\r"),r=e.indexOf(`
|
|
790
790
|
`),s=0,o=0;for(;n!==-1||r!==-1;){let i;if(n!==-1&&(r===-1||n<r)?r===n+1?(i=r+1,n=e.indexOf("\r",i),r=e.indexOf(`
|
|
@@ -3000,4 +3000,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3000
3000
|
${l.waitingIds.join(`
|
|
3001
3001
|
`)}`}),[n,...r]=t.split(`
|
|
3002
3002
|
`).filter((i,l)=>l===0||i),s=Number(n);if(s===0&&r.length===0)return null;const o=[s>0?e("{{n}} sessions running",{n:s}):null,r.length>0?e("{{n}} waiting for you",{n:r.length}):null].filter(Boolean);return a.jsxs("button",{type:"button","data-enso":"settings-activity",onClick:()=>{lT();const i=r[0];i&&(oP(),it.getState().selectConversation(i))},className:"mx-2 mb-2 flex min-h-9 shrink-0 items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground max-md:min-h-11",children:[a.jsx("span",{"aria-hidden":!0,className:xe("h-1.5 w-1.5 shrink-0 rounded-full",r.length>0?"bg-amber-500":"bg-emerald-500")}),a.jsx("span",{className:"truncate",children:o.join(" · ")})]})}function van({navWidth:e,onNavResize:t,open:n}){const r=wc(l=>l.settings),s=wc(l=>l.lastCategory),o=wc(l=>l.mobileDetail);y.useEffect(()=>{if(!n)return;let l=!1;const c=d=>{d.key==="Escape"&&(l=oUt(document))},u=d=>{iUt(d,l)&&(d.preventDefault(),lT())};return window.addEventListener("keydown",c,!0),window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",c,!0),window.removeEventListener("keydown",u)}},[n]);const i=y.useMemo(()=>({initialCategory:s,onCategoryChange:dLe,mobileDetail:o,onMobileDetailChange:n0e,onBack:lT,navWidth:e,onNavResize:t,footer:a.jsx(gan,{})}),[s,o,e,t]);return a.jsx(man,{link:r?.link??null,linkSeq:r?.linkSeq??0,embedded:i})}function RQ(){return Ql()&&it.persist.hasHydrated()&&be.persist.hasHydrated()}function _ge(e,t){RQ()&&e>0&&(async()=>(t&&await it.getState().refreshWorktreeStatuses(),await it.getState().autoArchiveStaleConversations()))()}function Pge(e){!RQ()||!(e>0)||it.getState().autoDeleteStaleArchived()}function xan(){const e=be(r=>r.autoArchiveIdleDays),t=be(r=>r.autoArchiveMergedWorktrees),n=be(r=>r.autoDeleteArchivedDays);y.useEffect(()=>{if(RQ()){_ge(e,t),Pge(n);return}const r=()=>{_ge(e,t),Pge(n)},s=[it.persist.onFinishHydration(r),be.persist.onFinishHydration(r)];return()=>{for(const o of s)o()}},[e,t,n])}function ban(){const e=it(t=>Math.min(999,Met(t.order,jN(t.conversations))));y.useEffect(()=>{window.electronAPI.app.setBadgeCount(e)},[e])}function yan(){const e=be(n=>n.generationStallTimeoutMin),{t}=Se();y.useEffect(()=>{if(e<=0)return;const n=new Set,r=new Set,s=new Map,o=setInterval(()=>{if(!Ql())return;const i=e*6e4,l=Date.now(),c=it.getState();for(const u of Object.values(c.conversations)){u.status==="running"&&u.lastOutputAt&&s.delete(u.id);const d=(u.coworkerIds??[]).some(h=>!!c.conversations[h]?.spawning),f=hon({shouldAbort:con({status:u.status,spawning:u.spawning,lastOutputAt:fon(u,c.conversations),now:l,timeoutMs:i,hasLiveWork:don({...uon(u),spawningCoworker:d})}),status:u.status,spawning:u.spawning,pendingRetry:r.has(u.id),attempts:s.get(u.id)??0});if(f==="abort"){if(n.has(u.id))continue;n.add(u.id),r.add(u.id),window.electronAPI.agent.abort(u.id).finally(()=>{n.delete(u.id)}),Ht(Lge(u,t("No output for {{minutes}} minutes — retrying",{minutes:e})));continue}if(f==="retry"){r.delete(u.id),s.set(u.id,(s.get(u.id)??0)+1),c.retry(u.id);continue}f==="give-up"&&(r.delete(u.id),s.delete(u.id),Ht(Lge(u,t("Stopped after repeated stalls"))))}},1e3);return()=>clearInterval(o)},[e,t])}function Lge(e,t){const n=(e.coworkerName||e.title).split(`
|
|
3003
|
-
`)[0].trim();return n?{type:"warning",title:n,description:t}:{type:"warning",title:t}}function wan(e){return{at:e.exitAt,kind:e.kind,unfinishedTools:[...e.unfinishedTools],...e.suppressedError?{suppressedError:e.suppressedError}:{}}}function kan(e){return e?e.status!=="running":!1}const San=3e4;function Can(e,t=San){return e()?Promise.resolve(!0):new Promise(n=>{const r=l=>{clearTimeout(i);for(const c of o)c();n(l)},s=()=>e()&&r(!0),o=[it.subscribe(s),Ri.subscribe(s),be.subscribe(s)],i=setTimeout(()=>r(e()),t)})}function Ean(){const e=Ri.getState().snapshot.availability.status;return it.persist.hasHydrated()&&be.persist.hasHydrated()&&e!=="unloaded"&&e!=="loading"}function Tan(){const{t:e}=Se();y.useEffect(()=>{Ql()&&(async()=>{const t=await window.electronAPI.agent.takeInterruptedTurns().catch(()=>[]);if(t.length===0||!await Can(Ean))return;const n=new Set;for(const r of t)kan(it.getState().conversations[r.conversationId])&&(n.add(r.conversationId),it.setState(s=>{const o=s.conversations[r.conversationId];return!o||o.status==="running"?s:{conversations:{...s.conversations,[r.conversationId]:{...o,status:"interrupted",interrupted:wan(r),error:void 0}}}}));n.size!==0&&Ht({type:"info",title:e("{{count}} conversation(s) interrupted by app exit",{count:n.size})})})()},[e])}const Aan=3e4;function Nan(e,t=Aan){return e()?Promise.resolve(!0):new Promise(n=>{const r=l=>{clearTimeout(i);for(const c of o)c();n(l)},s=()=>e()&&r(!0),o=[it.subscribe(s),be.subscribe(s)],i=setTimeout(()=>r(e()),t)})}function Ian(){return it.persist.hasHydrated()&&be.persist.hasHydrated()}function jan(){const{t:e}=Se();y.useEffect(()=>{if(!Ql())return;const t=()=>{OH(async()=>{if(!await Nan(Ian))return;const r=await window.electronAPI.window.takeOpenFolders().catch(()=>[]);let s=!1;for(const o of r)try{if(!await V2e(o)){Ht({type:"error",title:e("Failed to add project")});continue}s=!0}catch(i){Ht({type:"error",title:e("Failed to add project"),description:i instanceof Error?i.message:String(i)})}s&&oP()})},n=window.electronAPI.window.onOpenFolderRequested(t);return t(),n},[e])}const Oge="enso-win",M_e="enso-win-flush",hj="enso-win-pending",Dge="enso-win-native";function Ran(e,t,n){return{maximized:n.maximized?e.maximized:t.maximized,fullscreen:n.fullscreen?e.fullscreen:t.fullscreen}}function Man(e,t){return e||t}function _an(e,t){document.documentElement.classList.toggle(M_e,Man(e,t))}function Pan(){y.useEffect(()=>{if(window.electronAPI?.env.platform!=="win32")return;const e=document.documentElement;e.classList.add(Oge,hj),e.classList.add(Dge);let t={maximized:!1,fullscreen:!1};const n={maximized:0,fullscreen:0};let r=!1,s=0,o;const i=()=>_an(t.maximized,t.fullscreen),l=window.electronAPI.window,c=()=>{const h=++s,p={...n};Promise.all([l.isMaximized(),l.isFullScreen()]).then(([m,v])=>{r||h!==s||(t=Ran(t,{maximized:m,fullscreen:v},{maximized:n.maximized!==p.maximized,fullscreen:n.fullscreen!==p.fullscreen}),e.classList.remove(hj),i())}).catch(()=>{!r&&h===s&&e.classList.remove(hj)})};c();const u=()=>{o&&clearTimeout(o),o=setTimeout(c,50)};window.addEventListener("resize",u);const d=l.onMaximizedChange(h=>{n.maximized+=1,t.maximized=h,i()}),f=l.onFullScreenChange(h=>{n.fullscreen+=1,t.fullscreen=h,i()});return()=>{r=!0,o&&clearTimeout(o),window.removeEventListener("resize",u),d(),f(),e.classList.remove(Oge,M_e,hj,Dge)}},[])}function Lan(e){const t=()=>{e.consumeSettingsDeepLink().then(n=>{n&&nu(n.link)})};return t(),e.onSettingsDeepLink(t)}const __e="ensoSettingsDepth",Bge=e=>{const t=e?.[__e];return typeof t=="number"?t:0};function Oan(e,t){let n=Bge(e.history.state),r=!1;const s=()=>{if(r)return;const l=t.depth();for(;n<l;)n+=1,e.history.pushState({[__e]:n},"");n>l&&(r=!0,e.history.go(l-n))},o=l=>{if(n=Bge(l.state),r){r=!1,s();return}t.depth()!==n&&t.apply(n)};e.addEventListener("popstate",o);const i=t.subscribe(s);return s(),()=>{i(),e.removeEventListener("popstate",o)}}const Fge=new Set;function Dan(e){return Fge.add(e),()=>Fge.delete(e)}const pj={duration:180,easing:"cubic-bezier(0.22, 1, 0.36, 1)",shift:10,underlayHold:.6};function Ban(e){let t=null,n=[];const r=()=>{for(const i of n)i.cancel();n=[]},s=()=>{t&&(n.push(...t.animations),t=null,e.onSettle())};return{run:(i,l)=>{if(e.reducedMotion())return s(),r(),{animating:!1,top:i};if(t){if(t.to!==i){t.to=i;for(const v of t.animations)v.reverse()}return{animating:!0,top:t.top}}r();const c=i==="settings"?"workbench":"settings",u=pj.shift*(i==="settings"?1:-1),d=v=>({duration:pj.duration,easing:v,fill:"both"}),f=d(pj.easing),h=v=>`translateX(${v}px)`,p=[l[c].sidebar?.animate([{opacity:1,transform:h(0)},{opacity:0,transform:h(-u)}],f),l[i].sidebar?.animate([{opacity:0,transform:h(u)},{opacity:1,transform:h(0)}],f),l[c].main?.animate([{opacity:1},{opacity:1,offset:pj.underlayHold},{opacity:0}],d("linear")),l[i].main?.animate([{opacity:0},{opacity:1}],f)].filter(v=>v!==void 0),m={to:i,top:i,animations:p};return t=m,Promise.all(p.map(v=>v.finished)).then(()=>{t===m&&s()},()=>{}),{animating:!0,top:i}},target:()=>t?.to??null,release:r,finish:()=>{s(),r()}}}function Fan(e){return{settingsMounted:e.open||e.shown||e.animating,workbenchHidden:e.open&&e.shown&&!e.animating}}const zan=()=>typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Han(e){return{category:"plugins",rowId:"plugins.enso",pluginId:e}}const FF=e=>typeof e=="string"&&e.length>0?e:null;function Uan(e){if(!e||typeof e!="object")return null;const t=e,n=FF(t.pluginId),r=FF(t.name);if(!n||!r)return null;if(t.kind==="inject-denied")return{type:"warning",titleKey:"{{name}} tried to message another session and was blocked",params:{name:r},actionKey:"Turn on",pluginId:n};const s=FF(t.version);return s?t.kind==="update-needs-approval"?{type:"warning",titleKey:"{{name}} {{version}} needs new permissions",params:{name:r,version:s},actionKey:"Review permissions",pluginId:n}:t.kind==="auto-updated"?{type:"success",titleKey:"{{name}} updated to {{version}}",params:{name:r,version:s},actionKey:"View",pluginId:n}:null:null}function Van(){const{t:e}=Se();return y.useEffect(()=>window.electronAPI.extensionPlugins.onNotice(t=>{const n=Uan(t);n&&Ht({type:n.type,title:e(n.titleKey,n.params),...n.actionKey?{actions:[{label:e(n.actionKey),onClick:()=>{nu(Han(n.pluginId))}}]}:{}})}),[e]),null}function Gan(e,t){const n=new Set,r=[];for(const s of e)for(const o of s.interceptBreakers??[]){const i=`${s.id}:${o.event}:${o.until}`;n.add(i),t.has(i)||r.push({pluginName:s.name,event:o.event})}t.clear();for(const s of n)t.add(s);return r}function Wan(e,t){let n=0;for(const r of t)e.length>r.length&&e.endsWith(r)&&r.length>n&&(n=r.length);return n}function Rcn(e,t){const n=(e.split("/").at(-1)??"").toLowerCase();return t.map(r=>({viewer:r,length:Wan(n,r.extensions)})).filter(r=>r.length>0).sort((r,s)=>s.length-r.length).map(r=>r.viewer)}const Mcn=e=>`${e.pluginId}:${e.id}`;let P_e=[];const LG=new Set;function zge(e){P_e=e;for(const t of LG)t()}function qan(e){return LG.add(e),()=>LG.delete(e)}const Hge=()=>P_e;function _cn(){return y.useSyncExternalStore(qan,Hge,Hge)}function Uge(e){const t=e.permissions.includes("composer.draft")?"1":"0";return`${e.id}\0${e.version}\0${e.build}\0${e.renderer??""}\0${t}`}function L_e(e,t){try{t?.dispose()}catch(n){console.warn(`[plugin] ${e} 渲染模块卸载失败`,n)}}async function Yan(e,t,n,r){if(!r())return;const s=new Map;for(const i of t)i.state==="enabled"&&i.renderer&&s.set(i.id,{...i,renderer:i.renderer});const o=[];for(const[i,l]of e){const c=s.get(i);(!c||Uge(c)!==l.key)&&o.push(i)}for(const i of o)L_e(i,e.get(i)),e.delete(i);await Promise.allSettled([...s.values()].filter(i=>!e.has(i.id)).map(async i=>{if(!r())return;let l;try{l=await n(i)}catch(d){if(!r())return;console.warn(`[plugin] ${i.id} 渲染模块加载失败`,d);return}if(!r()){l.dispose();return}const c=Uge(i),u=e.get(i.id);if(u?.key===c){l.dispose();return}u?.dispose(),e.set(i.id,{key:c,dispose:()=>l.dispose()})}))}const Kl=(e,t)=>({ok:!1,code:e,error:t});async function $an(e,t){if(e.op==="focusSession"){const i=e.payload.sessionId;if(typeof i!="string"||!i)return Kl("BAD_REQUEST","缺少会话 id");const l=t.conversation(i);if(l)return t.focus(l.parentId??i,i),{ok:!0,value:null};const c=i.indexOf("::");if(c>0){const u=i.slice(0,c);return t.conversation(u)?(t.focusSubagent(u,i),{ok:!0,value:null}):Kl("NOT_FOUND","会话不在本窗口")}return Kl("NOT_FOUND","会话不在本窗口")}if(e.op==="openChildRun"){const i=e.payload.parentId,l=e.payload.childId;return typeof i!="string"||!i?Kl("BAD_REQUEST","缺少父会话 id"):typeof l!="string"||!l?Kl("BAD_REQUEST","缺少子会话 id"):t.conversation(i)?(t.openChildRun(i,l),{ok:!0,value:null}):Kl("NOT_FOUND","会话不在本窗口")}if(e.op==="focusSubagent"){const i=e.payload.sessionId,l=e.payload.agentId;return typeof i!="string"||!t.conversation(i)?Kl("NOT_FOUND","会话不在本窗口"):typeof l!="string"||!l?Kl("BAD_REQUEST","缺少子代理 id"):(t.focusSubagent(i,l),{ok:!0,value:null})}if(e.op==="ensureSession"){const i=t.conversation(e.sessionId);if(!i)return Kl("NOT_FOUND","会话不在本窗口");if(i.parentId)return Kl("UNSUPPORTED","子会话随主会话恢复");const l=await t.ensure(e.sessionId);return l?Kl("SESSION_FAILED",l):{ok:!0,value:null}}if(e.op==="openPluginView"){if(!t.conversation(e.sessionId))return Kl("NOT_FOUND","会话不在本窗口");const{pluginId:i,viewId:l,title:c}=e.payload;return typeof i!="string"||!i||typeof l!="string"||!l||typeof c!="string"||!c?Kl("BAD_REQUEST","缺少视图标识"):(t.openPluginView?.(e.sessionId,{pluginId:i,viewId:l,title:c}),{ok:!0,value:null})}if(e.op==="closePluginView"){if(!t.conversation(e.sessionId))return Kl("NOT_FOUND","会话不在本窗口");const{pluginId:i,viewId:l}=e.payload;return typeof i!="string"||!i||typeof l!="string"||!l?Kl("BAD_REQUEST","缺少视图标识"):(t.closePluginView?.(e.sessionId,{pluginId:i,viewId:l}),{ok:!0,value:null})}const n=t.conversation(e.sessionId);if(!n)return Kl("NO_SESSION","发起调用的会话不在本窗口");const r=typeof e.payload.presetId=="string"?e.payload.presetId:void 0,s=await t.create(n.projectId,r);if(!s)return Kl("CREATE_FAILED","新建会话失败");const o=e.payload.text;return typeof o=="string"&&o&&t.prefill(s,o),{ok:!0,value:{sessionId:s}}}const Kan={conversation:e=>it.getState().conversations[e]??null,focus:(e,t)=>{const n=it.getState();n.selectConversation(e),t!==e&&n.selectTab(e,t)},focusSubagent:(e,t)=>it.getState().focusSubagent(e,t),openChildRun:(e,t)=>it.getState().openChildRun(e,t),create:(e,t)=>it.getState().newConversation(e,t?{presetId:t}:void 0),prefill:ywt,ensure:async e=>{const t=it.getState(),n=t.conversations[e];if(n?.started||n?.spawning)return null;await t.resumeConversation(e,{fresh:!0});const r=it.getState().conversations[e];return r?.started||r?.spawning?null:r?.error??"无法启动会话:请检查默认模型与登录状态"},openPluginView:(e,t)=>NEe({conversationId:e,...t}),closePluginView:(e,t)=>nwt({conversationId:e,...t})};function Xan(){return y.useEffect(()=>{const e=Swt(()=>yDt(it.getState()));let t=0;const n=new Map,r=new Set,s=()=>{const l=++t;window.electronAPI.extensionPlugins.list().then(async c=>{if(l!==t)return;for(const{pluginName:d,event:f}of Gan(c,r))Ht({type:"warning",title:`插件 ${d} 的检查连续失败,已临时放行`,description:`${f} 事件 30 秒内不再经过该插件;详情见设置里的插件日志`});const u=c.filter(d=>d.state==="enabled");fjt(Object.fromEntries(c.flatMap(d=>d.icon?[[d.id,d.icon]]:[]))),Jce(xje(c)),oue(m9t(c)),lte(u.flatMap(d=>d.views.map(f=>({pluginId:d.id,pluginName:d.name,...f})))),$1t(c),zge(u.flatMap(d=>(d.fileViewers??[]).map(f=>({pluginId:d.id,pluginName:d.name,...f})))),lue(u.flatMap(d=>d.triggers.filter(f=>f.symbol==="#").map(f=>({pluginId:d.id,name:f.name})))),await Yan(n,c,d=>Ewt(d.id,d.renderer,e,{draft:d.permissions.includes("composer.draft")}),()=>l===t)})};s();const o=window.electronAPI.extensionPlugins.onChanged(s),i=window.electronAPI.extensionPlugins.onDraftRequest(l=>{if(l.op==="focusSession"||l.op==="focusSubagent"||l.op==="openChildRun"||l.op==="createSession"||l.op==="ensureSession"||l.op==="openPluginView"||l.op==="closePluginView"){$an(l,Kan).catch(c=>({ok:!1,code:"SESSION_FAILED",error:c instanceof Error?c.message:String(c)})).then(c=>window.electronAPI.extensionPlugins.respondDraft({requestId:l.requestId,...c}));return}window.electronAPI.extensionPlugins.respondDraft({requestId:l.requestId,...jEe(l)})});return()=>{t+=1,o(),i(),Jce([]),lue([]),lte([]),zge([]),oue([]);for(const[l,c]of n)L_e(l,c);n.clear()}},[]),null}function Qan(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zF={exports:{}};const Zan={},Jan=Object.freeze(Object.defineProperty({__proto__:null,default:Zan},Symbol.toStringTag,{value:"Module"})),eln=DPe(Jan);var Vge;function tln(){return Vge||(Vge=1,(function(e){(function(t){var n=function(fe){var Ie,Ae=new Float64Array(16);if(fe)for(Ie=0;Ie<fe.length;Ie++)Ae[Ie]=fe[Ie];return Ae},r=function(){throw new Error("no PRNG")},s=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var i=n(),l=n([1]),c=n([56129,1]),u=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),h=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(fe,Ie,Ae,ce){fe[Ie]=Ae>>24&255,fe[Ie+1]=Ae>>16&255,fe[Ie+2]=Ae>>8&255,fe[Ie+3]=Ae&255,fe[Ie+4]=ce>>24&255,fe[Ie+5]=ce>>16&255,fe[Ie+6]=ce>>8&255,fe[Ie+7]=ce&255}function v(fe,Ie,Ae,ce,Oe){var dt,vt=0;for(dt=0;dt<Oe;dt++)vt|=fe[Ie+dt]^Ae[ce+dt];return(1&vt-1>>>8)-1}function b(fe,Ie,Ae,ce){return v(fe,Ie,Ae,ce,16)}function x(fe,Ie,Ae,ce){return v(fe,Ie,Ae,ce,32)}function S(fe,Ie,Ae,ce){for(var Oe=ce[0]&255|(ce[1]&255)<<8|(ce[2]&255)<<16|(ce[3]&255)<<24,dt=Ae[0]&255|(Ae[1]&255)<<8|(Ae[2]&255)<<16|(Ae[3]&255)<<24,vt=Ae[4]&255|(Ae[5]&255)<<8|(Ae[6]&255)<<16|(Ae[7]&255)<<24,Et=Ae[8]&255|(Ae[9]&255)<<8|(Ae[10]&255)<<16|(Ae[11]&255)<<24,Ct=Ae[12]&255|(Ae[13]&255)<<8|(Ae[14]&255)<<16|(Ae[15]&255)<<24,xn=ce[4]&255|(ce[5]&255)<<8|(ce[6]&255)<<16|(ce[7]&255)<<24,yn=Ie[0]&255|(Ie[1]&255)<<8|(Ie[2]&255)<<16|(Ie[3]&255)<<24,er=Ie[4]&255|(Ie[5]&255)<<8|(Ie[6]&255)<<16|(Ie[7]&255)<<24,ze=Ie[8]&255|(Ie[9]&255)<<8|(Ie[10]&255)<<16|(Ie[11]&255)<<24,We=Ie[12]&255|(Ie[13]&255)<<8|(Ie[14]&255)<<16|(Ie[15]&255)<<24,lt=ce[8]&255|(ce[9]&255)<<8|(ce[10]&255)<<16|(ce[11]&255)<<24,yt=Ae[16]&255|(Ae[17]&255)<<8|(Ae[18]&255)<<16|(Ae[19]&255)<<24,Bt=Ae[20]&255|(Ae[21]&255)<<8|(Ae[22]&255)<<16|(Ae[23]&255)<<24,Qt=Ae[24]&255|(Ae[25]&255)<<8|(Ae[26]&255)<<16|(Ae[27]&255)<<24,dn=Ae[28]&255|(Ae[29]&255)<<8|(Ae[30]&255)<<16|(Ae[31]&255)<<24,mn=ce[12]&255|(ce[13]&255)<<8|(ce[14]&255)<<16|(ce[15]&255)<<24,Zt=Oe,An=dt,bn=vt,Ln=Et,Un=Ct,gn=xn,Tt=yn,Lt=er,nn=ze,Ft=We,en=lt,Wt=yt,nt=Bt,Mn=Qt,Zn=dn,sr=mn,at,fr=0;fr<20;fr+=2)at=Zt+nt|0,Un^=at<<7|at>>>25,at=Un+Zt|0,nn^=at<<9|at>>>23,at=nn+Un|0,nt^=at<<13|at>>>19,at=nt+nn|0,Zt^=at<<18|at>>>14,at=gn+An|0,Ft^=at<<7|at>>>25,at=Ft+gn|0,Mn^=at<<9|at>>>23,at=Mn+Ft|0,An^=at<<13|at>>>19,at=An+Mn|0,gn^=at<<18|at>>>14,at=en+Tt|0,Zn^=at<<7|at>>>25,at=Zn+en|0,bn^=at<<9|at>>>23,at=bn+Zn|0,Tt^=at<<13|at>>>19,at=Tt+bn|0,en^=at<<18|at>>>14,at=sr+Wt|0,Ln^=at<<7|at>>>25,at=Ln+sr|0,Lt^=at<<9|at>>>23,at=Lt+Ln|0,Wt^=at<<13|at>>>19,at=Wt+Lt|0,sr^=at<<18|at>>>14,at=Zt+Ln|0,An^=at<<7|at>>>25,at=An+Zt|0,bn^=at<<9|at>>>23,at=bn+An|0,Ln^=at<<13|at>>>19,at=Ln+bn|0,Zt^=at<<18|at>>>14,at=gn+Un|0,Tt^=at<<7|at>>>25,at=Tt+gn|0,Lt^=at<<9|at>>>23,at=Lt+Tt|0,Un^=at<<13|at>>>19,at=Un+Lt|0,gn^=at<<18|at>>>14,at=en+Ft|0,Wt^=at<<7|at>>>25,at=Wt+en|0,nn^=at<<9|at>>>23,at=nn+Wt|0,Ft^=at<<13|at>>>19,at=Ft+nn|0,en^=at<<18|at>>>14,at=sr+Zn|0,nt^=at<<7|at>>>25,at=nt+sr|0,Mn^=at<<9|at>>>23,at=Mn+nt|0,Zn^=at<<13|at>>>19,at=Zn+Mn|0,sr^=at<<18|at>>>14;Zt=Zt+Oe|0,An=An+dt|0,bn=bn+vt|0,Ln=Ln+Et|0,Un=Un+Ct|0,gn=gn+xn|0,Tt=Tt+yn|0,Lt=Lt+er|0,nn=nn+ze|0,Ft=Ft+We|0,en=en+lt|0,Wt=Wt+yt|0,nt=nt+Bt|0,Mn=Mn+Qt|0,Zn=Zn+dn|0,sr=sr+mn|0,fe[0]=Zt>>>0&255,fe[1]=Zt>>>8&255,fe[2]=Zt>>>16&255,fe[3]=Zt>>>24&255,fe[4]=An>>>0&255,fe[5]=An>>>8&255,fe[6]=An>>>16&255,fe[7]=An>>>24&255,fe[8]=bn>>>0&255,fe[9]=bn>>>8&255,fe[10]=bn>>>16&255,fe[11]=bn>>>24&255,fe[12]=Ln>>>0&255,fe[13]=Ln>>>8&255,fe[14]=Ln>>>16&255,fe[15]=Ln>>>24&255,fe[16]=Un>>>0&255,fe[17]=Un>>>8&255,fe[18]=Un>>>16&255,fe[19]=Un>>>24&255,fe[20]=gn>>>0&255,fe[21]=gn>>>8&255,fe[22]=gn>>>16&255,fe[23]=gn>>>24&255,fe[24]=Tt>>>0&255,fe[25]=Tt>>>8&255,fe[26]=Tt>>>16&255,fe[27]=Tt>>>24&255,fe[28]=Lt>>>0&255,fe[29]=Lt>>>8&255,fe[30]=Lt>>>16&255,fe[31]=Lt>>>24&255,fe[32]=nn>>>0&255,fe[33]=nn>>>8&255,fe[34]=nn>>>16&255,fe[35]=nn>>>24&255,fe[36]=Ft>>>0&255,fe[37]=Ft>>>8&255,fe[38]=Ft>>>16&255,fe[39]=Ft>>>24&255,fe[40]=en>>>0&255,fe[41]=en>>>8&255,fe[42]=en>>>16&255,fe[43]=en>>>24&255,fe[44]=Wt>>>0&255,fe[45]=Wt>>>8&255,fe[46]=Wt>>>16&255,fe[47]=Wt>>>24&255,fe[48]=nt>>>0&255,fe[49]=nt>>>8&255,fe[50]=nt>>>16&255,fe[51]=nt>>>24&255,fe[52]=Mn>>>0&255,fe[53]=Mn>>>8&255,fe[54]=Mn>>>16&255,fe[55]=Mn>>>24&255,fe[56]=Zn>>>0&255,fe[57]=Zn>>>8&255,fe[58]=Zn>>>16&255,fe[59]=Zn>>>24&255,fe[60]=sr>>>0&255,fe[61]=sr>>>8&255,fe[62]=sr>>>16&255,fe[63]=sr>>>24&255}function k(fe,Ie,Ae,ce){for(var Oe=ce[0]&255|(ce[1]&255)<<8|(ce[2]&255)<<16|(ce[3]&255)<<24,dt=Ae[0]&255|(Ae[1]&255)<<8|(Ae[2]&255)<<16|(Ae[3]&255)<<24,vt=Ae[4]&255|(Ae[5]&255)<<8|(Ae[6]&255)<<16|(Ae[7]&255)<<24,Et=Ae[8]&255|(Ae[9]&255)<<8|(Ae[10]&255)<<16|(Ae[11]&255)<<24,Ct=Ae[12]&255|(Ae[13]&255)<<8|(Ae[14]&255)<<16|(Ae[15]&255)<<24,xn=ce[4]&255|(ce[5]&255)<<8|(ce[6]&255)<<16|(ce[7]&255)<<24,yn=Ie[0]&255|(Ie[1]&255)<<8|(Ie[2]&255)<<16|(Ie[3]&255)<<24,er=Ie[4]&255|(Ie[5]&255)<<8|(Ie[6]&255)<<16|(Ie[7]&255)<<24,ze=Ie[8]&255|(Ie[9]&255)<<8|(Ie[10]&255)<<16|(Ie[11]&255)<<24,We=Ie[12]&255|(Ie[13]&255)<<8|(Ie[14]&255)<<16|(Ie[15]&255)<<24,lt=ce[8]&255|(ce[9]&255)<<8|(ce[10]&255)<<16|(ce[11]&255)<<24,yt=Ae[16]&255|(Ae[17]&255)<<8|(Ae[18]&255)<<16|(Ae[19]&255)<<24,Bt=Ae[20]&255|(Ae[21]&255)<<8|(Ae[22]&255)<<16|(Ae[23]&255)<<24,Qt=Ae[24]&255|(Ae[25]&255)<<8|(Ae[26]&255)<<16|(Ae[27]&255)<<24,dn=Ae[28]&255|(Ae[29]&255)<<8|(Ae[30]&255)<<16|(Ae[31]&255)<<24,mn=ce[12]&255|(ce[13]&255)<<8|(ce[14]&255)<<16|(ce[15]&255)<<24,Zt=Oe,An=dt,bn=vt,Ln=Et,Un=Ct,gn=xn,Tt=yn,Lt=er,nn=ze,Ft=We,en=lt,Wt=yt,nt=Bt,Mn=Qt,Zn=dn,sr=mn,at,fr=0;fr<20;fr+=2)at=Zt+nt|0,Un^=at<<7|at>>>25,at=Un+Zt|0,nn^=at<<9|at>>>23,at=nn+Un|0,nt^=at<<13|at>>>19,at=nt+nn|0,Zt^=at<<18|at>>>14,at=gn+An|0,Ft^=at<<7|at>>>25,at=Ft+gn|0,Mn^=at<<9|at>>>23,at=Mn+Ft|0,An^=at<<13|at>>>19,at=An+Mn|0,gn^=at<<18|at>>>14,at=en+Tt|0,Zn^=at<<7|at>>>25,at=Zn+en|0,bn^=at<<9|at>>>23,at=bn+Zn|0,Tt^=at<<13|at>>>19,at=Tt+bn|0,en^=at<<18|at>>>14,at=sr+Wt|0,Ln^=at<<7|at>>>25,at=Ln+sr|0,Lt^=at<<9|at>>>23,at=Lt+Ln|0,Wt^=at<<13|at>>>19,at=Wt+Lt|0,sr^=at<<18|at>>>14,at=Zt+Ln|0,An^=at<<7|at>>>25,at=An+Zt|0,bn^=at<<9|at>>>23,at=bn+An|0,Ln^=at<<13|at>>>19,at=Ln+bn|0,Zt^=at<<18|at>>>14,at=gn+Un|0,Tt^=at<<7|at>>>25,at=Tt+gn|0,Lt^=at<<9|at>>>23,at=Lt+Tt|0,Un^=at<<13|at>>>19,at=Un+Lt|0,gn^=at<<18|at>>>14,at=en+Ft|0,Wt^=at<<7|at>>>25,at=Wt+en|0,nn^=at<<9|at>>>23,at=nn+Wt|0,Ft^=at<<13|at>>>19,at=Ft+nn|0,en^=at<<18|at>>>14,at=sr+Zn|0,nt^=at<<7|at>>>25,at=nt+sr|0,Mn^=at<<9|at>>>23,at=Mn+nt|0,Zn^=at<<13|at>>>19,at=Zn+Mn|0,sr^=at<<18|at>>>14;fe[0]=Zt>>>0&255,fe[1]=Zt>>>8&255,fe[2]=Zt>>>16&255,fe[3]=Zt>>>24&255,fe[4]=gn>>>0&255,fe[5]=gn>>>8&255,fe[6]=gn>>>16&255,fe[7]=gn>>>24&255,fe[8]=en>>>0&255,fe[9]=en>>>8&255,fe[10]=en>>>16&255,fe[11]=en>>>24&255,fe[12]=sr>>>0&255,fe[13]=sr>>>8&255,fe[14]=sr>>>16&255,fe[15]=sr>>>24&255,fe[16]=Tt>>>0&255,fe[17]=Tt>>>8&255,fe[18]=Tt>>>16&255,fe[19]=Tt>>>24&255,fe[20]=Lt>>>0&255,fe[21]=Lt>>>8&255,fe[22]=Lt>>>16&255,fe[23]=Lt>>>24&255,fe[24]=nn>>>0&255,fe[25]=nn>>>8&255,fe[26]=nn>>>16&255,fe[27]=nn>>>24&255,fe[28]=Ft>>>0&255,fe[29]=Ft>>>8&255,fe[30]=Ft>>>16&255,fe[31]=Ft>>>24&255}function C(fe,Ie,Ae,ce){S(fe,Ie,Ae,ce)}function A(fe,Ie,Ae,ce){k(fe,Ie,Ae,ce)}var N=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function j(fe,Ie,Ae,ce,Oe,dt,vt){var Et=new Uint8Array(16),Ct=new Uint8Array(64),xn,yn;for(yn=0;yn<16;yn++)Et[yn]=0;for(yn=0;yn<8;yn++)Et[yn]=dt[yn];for(;Oe>=64;){for(C(Ct,Et,vt,N),yn=0;yn<64;yn++)fe[Ie+yn]=Ae[ce+yn]^Ct[yn];for(xn=1,yn=8;yn<16;yn++)xn=xn+(Et[yn]&255)|0,Et[yn]=xn&255,xn>>>=8;Oe-=64,Ie+=64,ce+=64}if(Oe>0)for(C(Ct,Et,vt,N),yn=0;yn<Oe;yn++)fe[Ie+yn]=Ae[ce+yn]^Ct[yn];return 0}function I(fe,Ie,Ae,ce,Oe){var dt=new Uint8Array(16),vt=new Uint8Array(64),Et,Ct;for(Ct=0;Ct<16;Ct++)dt[Ct]=0;for(Ct=0;Ct<8;Ct++)dt[Ct]=ce[Ct];for(;Ae>=64;){for(C(vt,dt,Oe,N),Ct=0;Ct<64;Ct++)fe[Ie+Ct]=vt[Ct];for(Et=1,Ct=8;Ct<16;Ct++)Et=Et+(dt[Ct]&255)|0,dt[Ct]=Et&255,Et>>>=8;Ae-=64,Ie+=64}if(Ae>0)for(C(vt,dt,Oe,N),Ct=0;Ct<Ae;Ct++)fe[Ie+Ct]=vt[Ct];return 0}function _(fe,Ie,Ae,ce,Oe){var dt=new Uint8Array(32);A(dt,ce,Oe,N);for(var vt=new Uint8Array(8),Et=0;Et<8;Et++)vt[Et]=ce[Et+16];return I(fe,Ie,Ae,vt,dt)}function L(fe,Ie,Ae,ce,Oe,dt,vt){var Et=new Uint8Array(32);A(Et,dt,vt,N);for(var Ct=new Uint8Array(8),xn=0;xn<8;xn++)Ct[xn]=dt[xn+16];return j(fe,Ie,Ae,ce,Oe,Ct,Et)}var M=function(fe){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var Ie,Ae,ce,Oe,dt,vt,Et,Ct;Ie=fe[0]&255|(fe[1]&255)<<8,this.r[0]=Ie&8191,Ae=fe[2]&255|(fe[3]&255)<<8,this.r[1]=(Ie>>>13|Ae<<3)&8191,ce=fe[4]&255|(fe[5]&255)<<8,this.r[2]=(Ae>>>10|ce<<6)&7939,Oe=fe[6]&255|(fe[7]&255)<<8,this.r[3]=(ce>>>7|Oe<<9)&8191,dt=fe[8]&255|(fe[9]&255)<<8,this.r[4]=(Oe>>>4|dt<<12)&255,this.r[5]=dt>>>1&8190,vt=fe[10]&255|(fe[11]&255)<<8,this.r[6]=(dt>>>14|vt<<2)&8191,Et=fe[12]&255|(fe[13]&255)<<8,this.r[7]=(vt>>>11|Et<<5)&8065,Ct=fe[14]&255|(fe[15]&255)<<8,this.r[8]=(Et>>>8|Ct<<8)&8191,this.r[9]=Ct>>>5&127,this.pad[0]=fe[16]&255|(fe[17]&255)<<8,this.pad[1]=fe[18]&255|(fe[19]&255)<<8,this.pad[2]=fe[20]&255|(fe[21]&255)<<8,this.pad[3]=fe[22]&255|(fe[23]&255)<<8,this.pad[4]=fe[24]&255|(fe[25]&255)<<8,this.pad[5]=fe[26]&255|(fe[27]&255)<<8,this.pad[6]=fe[28]&255|(fe[29]&255)<<8,this.pad[7]=fe[30]&255|(fe[31]&255)<<8};M.prototype.blocks=function(fe,Ie,Ae){for(var ce=this.fin?0:2048,Oe,dt,vt,Et,Ct,xn,yn,er,ze,We,lt,yt,Bt,Qt,dn,mn,Zt,An,bn,Ln=this.h[0],Un=this.h[1],gn=this.h[2],Tt=this.h[3],Lt=this.h[4],nn=this.h[5],Ft=this.h[6],en=this.h[7],Wt=this.h[8],nt=this.h[9],Mn=this.r[0],Zn=this.r[1],sr=this.r[2],at=this.r[3],fr=this.r[4],hr=this.r[5],Xr=this.r[6],kr=this.r[7],Lr=this.r[8],pr=this.r[9];Ae>=16;)Oe=fe[Ie+0]&255|(fe[Ie+1]&255)<<8,Ln+=Oe&8191,dt=fe[Ie+2]&255|(fe[Ie+3]&255)<<8,Un+=(Oe>>>13|dt<<3)&8191,vt=fe[Ie+4]&255|(fe[Ie+5]&255)<<8,gn+=(dt>>>10|vt<<6)&8191,Et=fe[Ie+6]&255|(fe[Ie+7]&255)<<8,Tt+=(vt>>>7|Et<<9)&8191,Ct=fe[Ie+8]&255|(fe[Ie+9]&255)<<8,Lt+=(Et>>>4|Ct<<12)&8191,nn+=Ct>>>1&8191,xn=fe[Ie+10]&255|(fe[Ie+11]&255)<<8,Ft+=(Ct>>>14|xn<<2)&8191,yn=fe[Ie+12]&255|(fe[Ie+13]&255)<<8,en+=(xn>>>11|yn<<5)&8191,er=fe[Ie+14]&255|(fe[Ie+15]&255)<<8,Wt+=(yn>>>8|er<<8)&8191,nt+=er>>>5|ce,ze=0,We=ze,We+=Ln*Mn,We+=Un*(5*pr),We+=gn*(5*Lr),We+=Tt*(5*kr),We+=Lt*(5*Xr),ze=We>>>13,We&=8191,We+=nn*(5*hr),We+=Ft*(5*fr),We+=en*(5*at),We+=Wt*(5*sr),We+=nt*(5*Zn),ze+=We>>>13,We&=8191,lt=ze,lt+=Ln*Zn,lt+=Un*Mn,lt+=gn*(5*pr),lt+=Tt*(5*Lr),lt+=Lt*(5*kr),ze=lt>>>13,lt&=8191,lt+=nn*(5*Xr),lt+=Ft*(5*hr),lt+=en*(5*fr),lt+=Wt*(5*at),lt+=nt*(5*sr),ze+=lt>>>13,lt&=8191,yt=ze,yt+=Ln*sr,yt+=Un*Zn,yt+=gn*Mn,yt+=Tt*(5*pr),yt+=Lt*(5*Lr),ze=yt>>>13,yt&=8191,yt+=nn*(5*kr),yt+=Ft*(5*Xr),yt+=en*(5*hr),yt+=Wt*(5*fr),yt+=nt*(5*at),ze+=yt>>>13,yt&=8191,Bt=ze,Bt+=Ln*at,Bt+=Un*sr,Bt+=gn*Zn,Bt+=Tt*Mn,Bt+=Lt*(5*pr),ze=Bt>>>13,Bt&=8191,Bt+=nn*(5*Lr),Bt+=Ft*(5*kr),Bt+=en*(5*Xr),Bt+=Wt*(5*hr),Bt+=nt*(5*fr),ze+=Bt>>>13,Bt&=8191,Qt=ze,Qt+=Ln*fr,Qt+=Un*at,Qt+=gn*sr,Qt+=Tt*Zn,Qt+=Lt*Mn,ze=Qt>>>13,Qt&=8191,Qt+=nn*(5*pr),Qt+=Ft*(5*Lr),Qt+=en*(5*kr),Qt+=Wt*(5*Xr),Qt+=nt*(5*hr),ze+=Qt>>>13,Qt&=8191,dn=ze,dn+=Ln*hr,dn+=Un*fr,dn+=gn*at,dn+=Tt*sr,dn+=Lt*Zn,ze=dn>>>13,dn&=8191,dn+=nn*Mn,dn+=Ft*(5*pr),dn+=en*(5*Lr),dn+=Wt*(5*kr),dn+=nt*(5*Xr),ze+=dn>>>13,dn&=8191,mn=ze,mn+=Ln*Xr,mn+=Un*hr,mn+=gn*fr,mn+=Tt*at,mn+=Lt*sr,ze=mn>>>13,mn&=8191,mn+=nn*Zn,mn+=Ft*Mn,mn+=en*(5*pr),mn+=Wt*(5*Lr),mn+=nt*(5*kr),ze+=mn>>>13,mn&=8191,Zt=ze,Zt+=Ln*kr,Zt+=Un*Xr,Zt+=gn*hr,Zt+=Tt*fr,Zt+=Lt*at,ze=Zt>>>13,Zt&=8191,Zt+=nn*sr,Zt+=Ft*Zn,Zt+=en*Mn,Zt+=Wt*(5*pr),Zt+=nt*(5*Lr),ze+=Zt>>>13,Zt&=8191,An=ze,An+=Ln*Lr,An+=Un*kr,An+=gn*Xr,An+=Tt*hr,An+=Lt*fr,ze=An>>>13,An&=8191,An+=nn*at,An+=Ft*sr,An+=en*Zn,An+=Wt*Mn,An+=nt*(5*pr),ze+=An>>>13,An&=8191,bn=ze,bn+=Ln*pr,bn+=Un*Lr,bn+=gn*kr,bn+=Tt*Xr,bn+=Lt*hr,ze=bn>>>13,bn&=8191,bn+=nn*fr,bn+=Ft*at,bn+=en*sr,bn+=Wt*Zn,bn+=nt*Mn,ze+=bn>>>13,bn&=8191,ze=(ze<<2)+ze|0,ze=ze+We|0,We=ze&8191,ze=ze>>>13,lt+=ze,Ln=We,Un=lt,gn=yt,Tt=Bt,Lt=Qt,nn=dn,Ft=mn,en=Zt,Wt=An,nt=bn,Ie+=16,Ae-=16;this.h[0]=Ln,this.h[1]=Un,this.h[2]=gn,this.h[3]=Tt,this.h[4]=Lt,this.h[5]=nn,this.h[6]=Ft,this.h[7]=en,this.h[8]=Wt,this.h[9]=nt},M.prototype.finish=function(fe,Ie){var Ae=new Uint16Array(10),ce,Oe,dt,vt;if(this.leftover){for(vt=this.leftover,this.buffer[vt++]=1;vt<16;vt++)this.buffer[vt]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(ce=this.h[1]>>>13,this.h[1]&=8191,vt=2;vt<10;vt++)this.h[vt]+=ce,ce=this.h[vt]>>>13,this.h[vt]&=8191;for(this.h[0]+=ce*5,ce=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=ce,ce=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=ce,Ae[0]=this.h[0]+5,ce=Ae[0]>>>13,Ae[0]&=8191,vt=1;vt<10;vt++)Ae[vt]=this.h[vt]+ce,ce=Ae[vt]>>>13,Ae[vt]&=8191;for(Ae[9]-=8192,Oe=(ce^1)-1,vt=0;vt<10;vt++)Ae[vt]&=Oe;for(Oe=~Oe,vt=0;vt<10;vt++)this.h[vt]=this.h[vt]&Oe|Ae[vt];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,dt=this.h[0]+this.pad[0],this.h[0]=dt&65535,vt=1;vt<8;vt++)dt=(this.h[vt]+this.pad[vt]|0)+(dt>>>16)|0,this.h[vt]=dt&65535;fe[Ie+0]=this.h[0]>>>0&255,fe[Ie+1]=this.h[0]>>>8&255,fe[Ie+2]=this.h[1]>>>0&255,fe[Ie+3]=this.h[1]>>>8&255,fe[Ie+4]=this.h[2]>>>0&255,fe[Ie+5]=this.h[2]>>>8&255,fe[Ie+6]=this.h[3]>>>0&255,fe[Ie+7]=this.h[3]>>>8&255,fe[Ie+8]=this.h[4]>>>0&255,fe[Ie+9]=this.h[4]>>>8&255,fe[Ie+10]=this.h[5]>>>0&255,fe[Ie+11]=this.h[5]>>>8&255,fe[Ie+12]=this.h[6]>>>0&255,fe[Ie+13]=this.h[6]>>>8&255,fe[Ie+14]=this.h[7]>>>0&255,fe[Ie+15]=this.h[7]>>>8&255},M.prototype.update=function(fe,Ie,Ae){var ce,Oe;if(this.leftover){for(Oe=16-this.leftover,Oe>Ae&&(Oe=Ae),ce=0;ce<Oe;ce++)this.buffer[this.leftover+ce]=fe[Ie+ce];if(Ae-=Oe,Ie+=Oe,this.leftover+=Oe,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(Ae>=16&&(Oe=Ae-Ae%16,this.blocks(fe,Ie,Oe),Ie+=Oe,Ae-=Oe),Ae){for(ce=0;ce<Ae;ce++)this.buffer[this.leftover+ce]=fe[Ie+ce];this.leftover+=Ae}};function F(fe,Ie,Ae,ce,Oe,dt){var vt=new M(dt);return vt.update(Ae,ce,Oe),vt.finish(fe,Ie),0}function D(fe,Ie,Ae,ce,Oe,dt){var vt=new Uint8Array(16);return F(vt,0,Ae,ce,Oe,dt),b(fe,Ie,vt,0)}function R(fe,Ie,Ae,ce,Oe){var dt;if(Ae<32)return-1;for(L(fe,0,Ie,0,Ae,ce,Oe),F(fe,16,fe,32,Ae-32,fe),dt=0;dt<16;dt++)fe[dt]=0;return 0}function z(fe,Ie,Ae,ce,Oe){var dt,vt=new Uint8Array(32);if(Ae<32||(_(vt,0,32,ce,Oe),D(Ie,16,Ie,32,Ae-32,vt)!==0))return-1;for(L(fe,0,Ie,0,Ae,ce,Oe),dt=0;dt<32;dt++)fe[dt]=0;return 0}function B(fe,Ie){var Ae;for(Ae=0;Ae<16;Ae++)fe[Ae]=Ie[Ae]|0}function H(fe){var Ie,Ae,ce=1;for(Ie=0;Ie<16;Ie++)Ae=fe[Ie]+ce+65535,ce=Math.floor(Ae/65536),fe[Ie]=Ae-ce*65536;fe[0]+=ce-1+37*(ce-1)}function G(fe,Ie,Ae){for(var ce,Oe=~(Ae-1),dt=0;dt<16;dt++)ce=Oe&(fe[dt]^Ie[dt]),fe[dt]^=ce,Ie[dt]^=ce}function te(fe,Ie){var Ae,ce,Oe,dt=n(),vt=n();for(Ae=0;Ae<16;Ae++)vt[Ae]=Ie[Ae];for(H(vt),H(vt),H(vt),ce=0;ce<2;ce++){for(dt[0]=vt[0]-65517,Ae=1;Ae<15;Ae++)dt[Ae]=vt[Ae]-65535-(dt[Ae-1]>>16&1),dt[Ae-1]&=65535;dt[15]=vt[15]-32767-(dt[14]>>16&1),Oe=dt[15]>>16&1,dt[14]&=65535,G(vt,dt,1-Oe)}for(Ae=0;Ae<16;Ae++)fe[2*Ae]=vt[Ae]&255,fe[2*Ae+1]=vt[Ae]>>8}function W(fe,Ie){var Ae=new Uint8Array(32),ce=new Uint8Array(32);return te(Ae,fe),te(ce,Ie),x(Ae,0,ce,0)}function T(fe){var Ie=new Uint8Array(32);return te(Ie,fe),Ie[0]&1}function U(fe,Ie){var Ae;for(Ae=0;Ae<16;Ae++)fe[Ae]=Ie[2*Ae]+(Ie[2*Ae+1]<<8);fe[15]&=32767}function P(fe,Ie,Ae){for(var ce=0;ce<16;ce++)fe[ce]=Ie[ce]+Ae[ce]}function K(fe,Ie,Ae){for(var ce=0;ce<16;ce++)fe[ce]=Ie[ce]-Ae[ce]}function J(fe,Ie,Ae){var ce,Oe,dt=0,vt=0,Et=0,Ct=0,xn=0,yn=0,er=0,ze=0,We=0,lt=0,yt=0,Bt=0,Qt=0,dn=0,mn=0,Zt=0,An=0,bn=0,Ln=0,Un=0,gn=0,Tt=0,Lt=0,nn=0,Ft=0,en=0,Wt=0,nt=0,Mn=0,Zn=0,sr=0,at=Ae[0],fr=Ae[1],hr=Ae[2],Xr=Ae[3],kr=Ae[4],Lr=Ae[5],pr=Ae[6],bs=Ae[7],ss=Ae[8],Cs=Ae[9],ms=Ae[10],Es=Ae[11],eo=Ae[12],Vs=Ae[13],ao=Ae[14],Er=Ae[15];ce=Ie[0],dt+=ce*at,vt+=ce*fr,Et+=ce*hr,Ct+=ce*Xr,xn+=ce*kr,yn+=ce*Lr,er+=ce*pr,ze+=ce*bs,We+=ce*ss,lt+=ce*Cs,yt+=ce*ms,Bt+=ce*Es,Qt+=ce*eo,dn+=ce*Vs,mn+=ce*ao,Zt+=ce*Er,ce=Ie[1],vt+=ce*at,Et+=ce*fr,Ct+=ce*hr,xn+=ce*Xr,yn+=ce*kr,er+=ce*Lr,ze+=ce*pr,We+=ce*bs,lt+=ce*ss,yt+=ce*Cs,Bt+=ce*ms,Qt+=ce*Es,dn+=ce*eo,mn+=ce*Vs,Zt+=ce*ao,An+=ce*Er,ce=Ie[2],Et+=ce*at,Ct+=ce*fr,xn+=ce*hr,yn+=ce*Xr,er+=ce*kr,ze+=ce*Lr,We+=ce*pr,lt+=ce*bs,yt+=ce*ss,Bt+=ce*Cs,Qt+=ce*ms,dn+=ce*Es,mn+=ce*eo,Zt+=ce*Vs,An+=ce*ao,bn+=ce*Er,ce=Ie[3],Ct+=ce*at,xn+=ce*fr,yn+=ce*hr,er+=ce*Xr,ze+=ce*kr,We+=ce*Lr,lt+=ce*pr,yt+=ce*bs,Bt+=ce*ss,Qt+=ce*Cs,dn+=ce*ms,mn+=ce*Es,Zt+=ce*eo,An+=ce*Vs,bn+=ce*ao,Ln+=ce*Er,ce=Ie[4],xn+=ce*at,yn+=ce*fr,er+=ce*hr,ze+=ce*Xr,We+=ce*kr,lt+=ce*Lr,yt+=ce*pr,Bt+=ce*bs,Qt+=ce*ss,dn+=ce*Cs,mn+=ce*ms,Zt+=ce*Es,An+=ce*eo,bn+=ce*Vs,Ln+=ce*ao,Un+=ce*Er,ce=Ie[5],yn+=ce*at,er+=ce*fr,ze+=ce*hr,We+=ce*Xr,lt+=ce*kr,yt+=ce*Lr,Bt+=ce*pr,Qt+=ce*bs,dn+=ce*ss,mn+=ce*Cs,Zt+=ce*ms,An+=ce*Es,bn+=ce*eo,Ln+=ce*Vs,Un+=ce*ao,gn+=ce*Er,ce=Ie[6],er+=ce*at,ze+=ce*fr,We+=ce*hr,lt+=ce*Xr,yt+=ce*kr,Bt+=ce*Lr,Qt+=ce*pr,dn+=ce*bs,mn+=ce*ss,Zt+=ce*Cs,An+=ce*ms,bn+=ce*Es,Ln+=ce*eo,Un+=ce*Vs,gn+=ce*ao,Tt+=ce*Er,ce=Ie[7],ze+=ce*at,We+=ce*fr,lt+=ce*hr,yt+=ce*Xr,Bt+=ce*kr,Qt+=ce*Lr,dn+=ce*pr,mn+=ce*bs,Zt+=ce*ss,An+=ce*Cs,bn+=ce*ms,Ln+=ce*Es,Un+=ce*eo,gn+=ce*Vs,Tt+=ce*ao,Lt+=ce*Er,ce=Ie[8],We+=ce*at,lt+=ce*fr,yt+=ce*hr,Bt+=ce*Xr,Qt+=ce*kr,dn+=ce*Lr,mn+=ce*pr,Zt+=ce*bs,An+=ce*ss,bn+=ce*Cs,Ln+=ce*ms,Un+=ce*Es,gn+=ce*eo,Tt+=ce*Vs,Lt+=ce*ao,nn+=ce*Er,ce=Ie[9],lt+=ce*at,yt+=ce*fr,Bt+=ce*hr,Qt+=ce*Xr,dn+=ce*kr,mn+=ce*Lr,Zt+=ce*pr,An+=ce*bs,bn+=ce*ss,Ln+=ce*Cs,Un+=ce*ms,gn+=ce*Es,Tt+=ce*eo,Lt+=ce*Vs,nn+=ce*ao,Ft+=ce*Er,ce=Ie[10],yt+=ce*at,Bt+=ce*fr,Qt+=ce*hr,dn+=ce*Xr,mn+=ce*kr,Zt+=ce*Lr,An+=ce*pr,bn+=ce*bs,Ln+=ce*ss,Un+=ce*Cs,gn+=ce*ms,Tt+=ce*Es,Lt+=ce*eo,nn+=ce*Vs,Ft+=ce*ao,en+=ce*Er,ce=Ie[11],Bt+=ce*at,Qt+=ce*fr,dn+=ce*hr,mn+=ce*Xr,Zt+=ce*kr,An+=ce*Lr,bn+=ce*pr,Ln+=ce*bs,Un+=ce*ss,gn+=ce*Cs,Tt+=ce*ms,Lt+=ce*Es,nn+=ce*eo,Ft+=ce*Vs,en+=ce*ao,Wt+=ce*Er,ce=Ie[12],Qt+=ce*at,dn+=ce*fr,mn+=ce*hr,Zt+=ce*Xr,An+=ce*kr,bn+=ce*Lr,Ln+=ce*pr,Un+=ce*bs,gn+=ce*ss,Tt+=ce*Cs,Lt+=ce*ms,nn+=ce*Es,Ft+=ce*eo,en+=ce*Vs,Wt+=ce*ao,nt+=ce*Er,ce=Ie[13],dn+=ce*at,mn+=ce*fr,Zt+=ce*hr,An+=ce*Xr,bn+=ce*kr,Ln+=ce*Lr,Un+=ce*pr,gn+=ce*bs,Tt+=ce*ss,Lt+=ce*Cs,nn+=ce*ms,Ft+=ce*Es,en+=ce*eo,Wt+=ce*Vs,nt+=ce*ao,Mn+=ce*Er,ce=Ie[14],mn+=ce*at,Zt+=ce*fr,An+=ce*hr,bn+=ce*Xr,Ln+=ce*kr,Un+=ce*Lr,gn+=ce*pr,Tt+=ce*bs,Lt+=ce*ss,nn+=ce*Cs,Ft+=ce*ms,en+=ce*Es,Wt+=ce*eo,nt+=ce*Vs,Mn+=ce*ao,Zn+=ce*Er,ce=Ie[15],Zt+=ce*at,An+=ce*fr,bn+=ce*hr,Ln+=ce*Xr,Un+=ce*kr,gn+=ce*Lr,Tt+=ce*pr,Lt+=ce*bs,nn+=ce*ss,Ft+=ce*Cs,en+=ce*ms,Wt+=ce*Es,nt+=ce*eo,Mn+=ce*Vs,Zn+=ce*ao,sr+=ce*Er,dt+=38*An,vt+=38*bn,Et+=38*Ln,Ct+=38*Un,xn+=38*gn,yn+=38*Tt,er+=38*Lt,ze+=38*nn,We+=38*Ft,lt+=38*en,yt+=38*Wt,Bt+=38*nt,Qt+=38*Mn,dn+=38*Zn,mn+=38*sr,Oe=1,ce=dt+Oe+65535,Oe=Math.floor(ce/65536),dt=ce-Oe*65536,ce=vt+Oe+65535,Oe=Math.floor(ce/65536),vt=ce-Oe*65536,ce=Et+Oe+65535,Oe=Math.floor(ce/65536),Et=ce-Oe*65536,ce=Ct+Oe+65535,Oe=Math.floor(ce/65536),Ct=ce-Oe*65536,ce=xn+Oe+65535,Oe=Math.floor(ce/65536),xn=ce-Oe*65536,ce=yn+Oe+65535,Oe=Math.floor(ce/65536),yn=ce-Oe*65536,ce=er+Oe+65535,Oe=Math.floor(ce/65536),er=ce-Oe*65536,ce=ze+Oe+65535,Oe=Math.floor(ce/65536),ze=ce-Oe*65536,ce=We+Oe+65535,Oe=Math.floor(ce/65536),We=ce-Oe*65536,ce=lt+Oe+65535,Oe=Math.floor(ce/65536),lt=ce-Oe*65536,ce=yt+Oe+65535,Oe=Math.floor(ce/65536),yt=ce-Oe*65536,ce=Bt+Oe+65535,Oe=Math.floor(ce/65536),Bt=ce-Oe*65536,ce=Qt+Oe+65535,Oe=Math.floor(ce/65536),Qt=ce-Oe*65536,ce=dn+Oe+65535,Oe=Math.floor(ce/65536),dn=ce-Oe*65536,ce=mn+Oe+65535,Oe=Math.floor(ce/65536),mn=ce-Oe*65536,ce=Zt+Oe+65535,Oe=Math.floor(ce/65536),Zt=ce-Oe*65536,dt+=Oe-1+37*(Oe-1),Oe=1,ce=dt+Oe+65535,Oe=Math.floor(ce/65536),dt=ce-Oe*65536,ce=vt+Oe+65535,Oe=Math.floor(ce/65536),vt=ce-Oe*65536,ce=Et+Oe+65535,Oe=Math.floor(ce/65536),Et=ce-Oe*65536,ce=Ct+Oe+65535,Oe=Math.floor(ce/65536),Ct=ce-Oe*65536,ce=xn+Oe+65535,Oe=Math.floor(ce/65536),xn=ce-Oe*65536,ce=yn+Oe+65535,Oe=Math.floor(ce/65536),yn=ce-Oe*65536,ce=er+Oe+65535,Oe=Math.floor(ce/65536),er=ce-Oe*65536,ce=ze+Oe+65535,Oe=Math.floor(ce/65536),ze=ce-Oe*65536,ce=We+Oe+65535,Oe=Math.floor(ce/65536),We=ce-Oe*65536,ce=lt+Oe+65535,Oe=Math.floor(ce/65536),lt=ce-Oe*65536,ce=yt+Oe+65535,Oe=Math.floor(ce/65536),yt=ce-Oe*65536,ce=Bt+Oe+65535,Oe=Math.floor(ce/65536),Bt=ce-Oe*65536,ce=Qt+Oe+65535,Oe=Math.floor(ce/65536),Qt=ce-Oe*65536,ce=dn+Oe+65535,Oe=Math.floor(ce/65536),dn=ce-Oe*65536,ce=mn+Oe+65535,Oe=Math.floor(ce/65536),mn=ce-Oe*65536,ce=Zt+Oe+65535,Oe=Math.floor(ce/65536),Zt=ce-Oe*65536,dt+=Oe-1+37*(Oe-1),fe[0]=dt,fe[1]=vt,fe[2]=Et,fe[3]=Ct,fe[4]=xn,fe[5]=yn,fe[6]=er,fe[7]=ze,fe[8]=We,fe[9]=lt,fe[10]=yt,fe[11]=Bt,fe[12]=Qt,fe[13]=dn,fe[14]=mn,fe[15]=Zt}function ee(fe,Ie){J(fe,Ie,Ie)}function X(fe,Ie){var Ae=n(),ce;for(ce=0;ce<16;ce++)Ae[ce]=Ie[ce];for(ce=253;ce>=0;ce--)ee(Ae,Ae),ce!==2&&ce!==4&&J(Ae,Ae,Ie);for(ce=0;ce<16;ce++)fe[ce]=Ae[ce]}function ne(fe,Ie){var Ae=n(),ce;for(ce=0;ce<16;ce++)Ae[ce]=Ie[ce];for(ce=250;ce>=0;ce--)ee(Ae,Ae),ce!==1&&J(Ae,Ae,Ie);for(ce=0;ce<16;ce++)fe[ce]=Ae[ce]}function Q(fe,Ie,Ae){var ce=new Uint8Array(32),Oe=new Float64Array(80),dt,vt,Et=n(),Ct=n(),xn=n(),yn=n(),er=n(),ze=n();for(vt=0;vt<31;vt++)ce[vt]=Ie[vt];for(ce[31]=Ie[31]&127|64,ce[0]&=248,U(Oe,Ae),vt=0;vt<16;vt++)Ct[vt]=Oe[vt],yn[vt]=Et[vt]=xn[vt]=0;for(Et[0]=yn[0]=1,vt=254;vt>=0;--vt)dt=ce[vt>>>3]>>>(vt&7)&1,G(Et,Ct,dt),G(xn,yn,dt),P(er,Et,xn),K(Et,Et,xn),P(xn,Ct,yn),K(Ct,Ct,yn),ee(yn,er),ee(ze,Et),J(Et,xn,Et),J(xn,Ct,er),P(er,Et,xn),K(Et,Et,xn),ee(Ct,Et),K(xn,yn,ze),J(Et,xn,c),P(Et,Et,yn),J(xn,xn,Et),J(Et,yn,ze),J(yn,Ct,Oe),ee(Ct,er),G(Et,Ct,dt),G(xn,yn,dt);for(vt=0;vt<16;vt++)Oe[vt+16]=Et[vt],Oe[vt+32]=xn[vt],Oe[vt+48]=Ct[vt],Oe[vt+64]=yn[vt];var We=Oe.subarray(32),lt=Oe.subarray(16);return X(We,We),J(lt,lt,We),te(fe,lt),0}function oe(fe,Ie){return Q(fe,Ie,o)}function de(fe,Ie){return r(Ie,32),oe(fe,Ie)}function ie(fe,Ie,Ae){var ce=new Uint8Array(32);return Q(ce,Ae,Ie),A(fe,s,ce,N)}var ue=R,ve=z;function ge(fe,Ie,Ae,ce,Oe,dt){var vt=new Uint8Array(32);return ie(vt,Oe,dt),ue(fe,Ie,Ae,ce,vt)}function Te(fe,Ie,Ae,ce,Oe,dt){var vt=new Uint8Array(32);return ie(vt,Oe,dt),ve(fe,Ie,Ae,ce,vt)}var De=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Me(fe,Ie,Ae,ce){for(var Oe=new Int32Array(16),dt=new Int32Array(16),vt,Et,Ct,xn,yn,er,ze,We,lt,yt,Bt,Qt,dn,mn,Zt,An,bn,Ln,Un,gn,Tt,Lt,nn,Ft,en,Wt,nt=fe[0],Mn=fe[1],Zn=fe[2],sr=fe[3],at=fe[4],fr=fe[5],hr=fe[6],Xr=fe[7],kr=Ie[0],Lr=Ie[1],pr=Ie[2],bs=Ie[3],ss=Ie[4],Cs=Ie[5],ms=Ie[6],Es=Ie[7],eo=0;ce>=128;){for(Un=0;Un<16;Un++)gn=8*Un+eo,Oe[Un]=Ae[gn+0]<<24|Ae[gn+1]<<16|Ae[gn+2]<<8|Ae[gn+3],dt[Un]=Ae[gn+4]<<24|Ae[gn+5]<<16|Ae[gn+6]<<8|Ae[gn+7];for(Un=0;Un<80;Un++)if(vt=nt,Et=Mn,Ct=Zn,xn=sr,yn=at,er=fr,ze=hr,We=Xr,lt=kr,yt=Lr,Bt=pr,Qt=bs,dn=ss,mn=Cs,Zt=ms,An=Es,Tt=Xr,Lt=Es,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=(at>>>14|ss<<18)^(at>>>18|ss<<14)^(ss>>>9|at<<23),Lt=(ss>>>14|at<<18)^(ss>>>18|at<<14)^(at>>>9|ss<<23),nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Tt=at&fr^~at&hr,Lt=ss&Cs^~ss&ms,nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Tt=De[Un*2],Lt=De[Un*2+1],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Tt=Oe[Un%16],Lt=dt[Un%16],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,bn=en&65535|Wt<<16,Ln=nn&65535|Ft<<16,Tt=bn,Lt=Ln,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=(nt>>>28|kr<<4)^(kr>>>2|nt<<30)^(kr>>>7|nt<<25),Lt=(kr>>>28|nt<<4)^(nt>>>2|kr<<30)^(nt>>>7|kr<<25),nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Tt=nt&Mn^nt&Zn^Mn&Zn,Lt=kr&Lr^kr&pr^Lr&pr,nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,We=en&65535|Wt<<16,An=nn&65535|Ft<<16,Tt=xn,Lt=Qt,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=bn,Lt=Ln,nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,xn=en&65535|Wt<<16,Qt=nn&65535|Ft<<16,Mn=vt,Zn=Et,sr=Ct,at=xn,fr=yn,hr=er,Xr=ze,nt=We,Lr=lt,pr=yt,bs=Bt,ss=Qt,Cs=dn,ms=mn,Es=Zt,kr=An,Un%16===15)for(gn=0;gn<16;gn++)Tt=Oe[gn],Lt=dt[gn],nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=Oe[(gn+9)%16],Lt=dt[(gn+9)%16],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,bn=Oe[(gn+1)%16],Ln=dt[(gn+1)%16],Tt=(bn>>>1|Ln<<31)^(bn>>>8|Ln<<24)^bn>>>7,Lt=(Ln>>>1|bn<<31)^(Ln>>>8|bn<<24)^(Ln>>>7|bn<<25),nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,bn=Oe[(gn+14)%16],Ln=dt[(gn+14)%16],Tt=(bn>>>19|Ln<<13)^(Ln>>>29|bn<<3)^bn>>>6,Lt=(Ln>>>19|bn<<13)^(bn>>>29|Ln<<3)^(Ln>>>6|bn<<26),nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,Oe[gn]=en&65535|Wt<<16,dt[gn]=nn&65535|Ft<<16;Tt=nt,Lt=kr,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[0],Lt=Ie[0],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[0]=nt=en&65535|Wt<<16,Ie[0]=kr=nn&65535|Ft<<16,Tt=Mn,Lt=Lr,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[1],Lt=Ie[1],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[1]=Mn=en&65535|Wt<<16,Ie[1]=Lr=nn&65535|Ft<<16,Tt=Zn,Lt=pr,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[2],Lt=Ie[2],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[2]=Zn=en&65535|Wt<<16,Ie[2]=pr=nn&65535|Ft<<16,Tt=sr,Lt=bs,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[3],Lt=Ie[3],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[3]=sr=en&65535|Wt<<16,Ie[3]=bs=nn&65535|Ft<<16,Tt=at,Lt=ss,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[4],Lt=Ie[4],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[4]=at=en&65535|Wt<<16,Ie[4]=ss=nn&65535|Ft<<16,Tt=fr,Lt=Cs,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[5],Lt=Ie[5],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[5]=fr=en&65535|Wt<<16,Ie[5]=Cs=nn&65535|Ft<<16,Tt=hr,Lt=ms,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[6],Lt=Ie[6],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[6]=hr=en&65535|Wt<<16,Ie[6]=ms=nn&65535|Ft<<16,Tt=Xr,Lt=Es,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[7],Lt=Ie[7],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[7]=Xr=en&65535|Wt<<16,Ie[7]=Es=nn&65535|Ft<<16,eo+=128,ce-=128}return ce}function Fe(fe,Ie,Ae){var ce=new Int32Array(8),Oe=new Int32Array(8),dt=new Uint8Array(256),vt,Et=Ae;for(ce[0]=1779033703,ce[1]=3144134277,ce[2]=1013904242,ce[3]=2773480762,ce[4]=1359893119,ce[5]=2600822924,ce[6]=528734635,ce[7]=1541459225,Oe[0]=4089235720,Oe[1]=2227873595,Oe[2]=4271175723,Oe[3]=1595750129,Oe[4]=2917565137,Oe[5]=725511199,Oe[6]=4215389547,Oe[7]=327033209,Me(ce,Oe,Ie,Ae),Ae%=128,vt=0;vt<Ae;vt++)dt[vt]=Ie[Et-Ae+vt];for(dt[Ae]=128,Ae=256-128*(Ae<112?1:0),dt[Ae-9]=0,m(dt,Ae-8,Et/536870912|0,Et<<3),Me(ce,Oe,dt,Ae),vt=0;vt<8;vt++)m(fe,8*vt,ce[vt],Oe[vt]);return 0}function He(fe,Ie){var Ae=n(),ce=n(),Oe=n(),dt=n(),vt=n(),Et=n(),Ct=n(),xn=n(),yn=n();K(Ae,fe[1],fe[0]),K(yn,Ie[1],Ie[0]),J(Ae,Ae,yn),P(ce,fe[0],fe[1]),P(yn,Ie[0],Ie[1]),J(ce,ce,yn),J(Oe,fe[3],Ie[3]),J(Oe,Oe,d),J(dt,fe[2],Ie[2]),P(dt,dt,dt),K(vt,ce,Ae),K(Et,dt,Oe),P(Ct,dt,Oe),P(xn,ce,Ae),J(fe[0],vt,Et),J(fe[1],xn,Ct),J(fe[2],Ct,Et),J(fe[3],vt,xn)}function tt(fe,Ie,Ae){var ce;for(ce=0;ce<4;ce++)G(fe[ce],Ie[ce],Ae)}function $e(fe,Ie){var Ae=n(),ce=n(),Oe=n();X(Oe,Ie[2]),J(Ae,Ie[0],Oe),J(ce,Ie[1],Oe),te(fe,ce),fe[31]^=T(Ae)<<7}function Ue(fe,Ie,Ae){var ce,Oe;for(B(fe[0],i),B(fe[1],l),B(fe[2],l),B(fe[3],i),Oe=255;Oe>=0;--Oe)ce=Ae[Oe/8|0]>>(Oe&7)&1,tt(fe,Ie,ce),He(Ie,fe),He(fe,fe),tt(fe,Ie,ce)}function Pe(fe,Ie){var Ae=[n(),n(),n(),n()];B(Ae[0],f),B(Ae[1],h),B(Ae[2],l),J(Ae[3],f,h),Ue(fe,Ae,Ie)}function we(fe,Ie,Ae){var ce=new Uint8Array(64),Oe=[n(),n(),n(),n()],dt;for(Ae||r(Ie,32),Fe(ce,Ie,32),ce[0]&=248,ce[31]&=127,ce[31]|=64,Pe(Oe,ce),$e(fe,Oe),dt=0;dt<32;dt++)Ie[dt+32]=fe[dt];return 0}var ye=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Re(fe,Ie){var Ae,ce,Oe,dt;for(ce=63;ce>=32;--ce){for(Ae=0,Oe=ce-32,dt=ce-12;Oe<dt;++Oe)Ie[Oe]+=Ae-16*Ie[ce]*ye[Oe-(ce-32)],Ae=Math.floor((Ie[Oe]+128)/256),Ie[Oe]-=Ae*256;Ie[Oe]+=Ae,Ie[ce]=0}for(Ae=0,Oe=0;Oe<32;Oe++)Ie[Oe]+=Ae-(Ie[31]>>4)*ye[Oe],Ae=Ie[Oe]>>8,Ie[Oe]&=255;for(Oe=0;Oe<32;Oe++)Ie[Oe]-=Ae*ye[Oe];for(ce=0;ce<32;ce++)Ie[ce+1]+=Ie[ce]>>8,fe[ce]=Ie[ce]&255}function _e(fe){var Ie=new Float64Array(64),Ae;for(Ae=0;Ae<64;Ae++)Ie[Ae]=fe[Ae];for(Ae=0;Ae<64;Ae++)fe[Ae]=0;Re(fe,Ie)}function Ve(fe,Ie,Ae,ce){var Oe=new Uint8Array(64),dt=new Uint8Array(64),vt=new Uint8Array(64),Et,Ct,xn=new Float64Array(64),yn=[n(),n(),n(),n()];Fe(Oe,ce,32),Oe[0]&=248,Oe[31]&=127,Oe[31]|=64;var er=Ae+64;for(Et=0;Et<Ae;Et++)fe[64+Et]=Ie[Et];for(Et=0;Et<32;Et++)fe[32+Et]=Oe[32+Et];for(Fe(vt,fe.subarray(32),Ae+32),_e(vt),Pe(yn,vt),$e(fe,yn),Et=32;Et<64;Et++)fe[Et]=ce[Et];for(Fe(dt,fe,Ae+64),_e(dt),Et=0;Et<64;Et++)xn[Et]=0;for(Et=0;Et<32;Et++)xn[Et]=vt[Et];for(Et=0;Et<32;Et++)for(Ct=0;Ct<32;Ct++)xn[Et+Ct]+=dt[Et]*Oe[Ct];return Re(fe.subarray(32),xn),er}function he(fe,Ie){var Ae=n(),ce=n(),Oe=n(),dt=n(),vt=n(),Et=n(),Ct=n();return B(fe[2],l),U(fe[1],Ie),ee(Oe,fe[1]),J(dt,Oe,u),K(Oe,Oe,fe[2]),P(dt,fe[2],dt),ee(vt,dt),ee(Et,vt),J(Ct,Et,vt),J(Ae,Ct,Oe),J(Ae,Ae,dt),ne(Ae,Ae),J(Ae,Ae,Oe),J(Ae,Ae,dt),J(Ae,Ae,dt),J(fe[0],Ae,dt),ee(ce,fe[0]),J(ce,ce,dt),W(ce,Oe)&&J(fe[0],fe[0],p),ee(ce,fe[0]),J(ce,ce,dt),W(ce,Oe)?-1:(T(fe[0])===Ie[31]>>7&&K(fe[0],i,fe[0]),J(fe[3],fe[0],fe[1]),0)}function Ye(fe,Ie,Ae,ce){var Oe,dt=new Uint8Array(32),vt=new Uint8Array(64),Et=[n(),n(),n(),n()],Ct=[n(),n(),n(),n()];if(Ae<64||he(Ct,ce))return-1;for(Oe=0;Oe<Ae;Oe++)fe[Oe]=Ie[Oe];for(Oe=0;Oe<32;Oe++)fe[Oe+32]=ce[Oe];if(Fe(vt,fe,Ae),_e(vt),Ue(Et,Ct,vt),Pe(Ct,Ie.subarray(32)),He(Et,Ct),$e(dt,Et),Ae-=64,x(Ie,0,dt,0)){for(Oe=0;Oe<Ae;Oe++)fe[Oe]=0;return-1}for(Oe=0;Oe<Ae;Oe++)fe[Oe]=Ie[Oe+64];return Ae}var Le=32,Ne=24,Ge=32,ft=16,Ze=32,je=32,Je=32,st=32,gt=32,ut=Ne,pt=Ge,It=ft,kt=64,ln=32,qt=64,Jt=32,cn=64;t.lowlevel={crypto_core_hsalsa20:A,crypto_stream_xor:L,crypto_stream:_,crypto_stream_salsa20_xor:j,crypto_stream_salsa20:I,crypto_onetimeauth:F,crypto_onetimeauth_verify:D,crypto_verify_16:b,crypto_verify_32:x,crypto_secretbox:R,crypto_secretbox_open:z,crypto_scalarmult:Q,crypto_scalarmult_base:oe,crypto_box_beforenm:ie,crypto_box_afternm:ue,crypto_box:ge,crypto_box_open:Te,crypto_box_keypair:de,crypto_hash:Fe,crypto_sign:Ve,crypto_sign_keypair:we,crypto_sign_open:Ye,crypto_secretbox_KEYBYTES:Le,crypto_secretbox_NONCEBYTES:Ne,crypto_secretbox_ZEROBYTES:Ge,crypto_secretbox_BOXZEROBYTES:ft,crypto_scalarmult_BYTES:Ze,crypto_scalarmult_SCALARBYTES:je,crypto_box_PUBLICKEYBYTES:Je,crypto_box_SECRETKEYBYTES:st,crypto_box_BEFORENMBYTES:gt,crypto_box_NONCEBYTES:ut,crypto_box_ZEROBYTES:pt,crypto_box_BOXZEROBYTES:It,crypto_sign_BYTES:kt,crypto_sign_PUBLICKEYBYTES:ln,crypto_sign_SECRETKEYBYTES:qt,crypto_sign_SEEDBYTES:Jt,crypto_hash_BYTES:cn,gf:n,D:u,L:ye,pack25519:te,unpack25519:U,M:J,A:P,S:ee,Z:K,pow2523:ne,add:He,set25519:B,modL:Re,scalarmult:Ue,scalarbase:Pe};function hn(fe,Ie){if(fe.length!==Le)throw new Error("bad key size");if(Ie.length!==Ne)throw new Error("bad nonce size")}function St(fe,Ie){if(fe.length!==Je)throw new Error("bad public key size");if(Ie.length!==st)throw new Error("bad secret key size")}function wt(){for(var fe=0;fe<arguments.length;fe++)if(!(arguments[fe]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Dt(fe){for(var Ie=0;Ie<fe.length;Ie++)fe[Ie]=0}t.randomBytes=function(fe){var Ie=new Uint8Array(fe);return r(Ie,fe),Ie},t.secretbox=function(fe,Ie,Ae){wt(fe,Ie,Ae),hn(Ae,Ie);for(var ce=new Uint8Array(Ge+fe.length),Oe=new Uint8Array(ce.length),dt=0;dt<fe.length;dt++)ce[dt+Ge]=fe[dt];return R(Oe,ce,ce.length,Ie,Ae),Oe.subarray(ft)},t.secretbox.open=function(fe,Ie,Ae){wt(fe,Ie,Ae),hn(Ae,Ie);for(var ce=new Uint8Array(ft+fe.length),Oe=new Uint8Array(ce.length),dt=0;dt<fe.length;dt++)ce[dt+ft]=fe[dt];return ce.length<32||z(Oe,ce,ce.length,Ie,Ae)!==0?null:Oe.subarray(Ge)},t.secretbox.keyLength=Le,t.secretbox.nonceLength=Ne,t.secretbox.overheadLength=ft,t.scalarMult=function(fe,Ie){if(wt(fe,Ie),fe.length!==je)throw new Error("bad n size");if(Ie.length!==Ze)throw new Error("bad p size");var Ae=new Uint8Array(Ze);return Q(Ae,fe,Ie),Ae},t.scalarMult.base=function(fe){if(wt(fe),fe.length!==je)throw new Error("bad n size");var Ie=new Uint8Array(Ze);return oe(Ie,fe),Ie},t.scalarMult.scalarLength=je,t.scalarMult.groupElementLength=Ze,t.box=function(fe,Ie,Ae,ce){var Oe=t.box.before(Ae,ce);return t.secretbox(fe,Ie,Oe)},t.box.before=function(fe,Ie){wt(fe,Ie),St(fe,Ie);var Ae=new Uint8Array(gt);return ie(Ae,fe,Ie),Ae},t.box.after=t.secretbox,t.box.open=function(fe,Ie,Ae,ce){var Oe=t.box.before(Ae,ce);return t.secretbox.open(fe,Ie,Oe)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var fe=new Uint8Array(Je),Ie=new Uint8Array(st);return de(fe,Ie),{publicKey:fe,secretKey:Ie}},t.box.keyPair.fromSecretKey=function(fe){if(wt(fe),fe.length!==st)throw new Error("bad secret key size");var Ie=new Uint8Array(Je);return oe(Ie,fe),{publicKey:Ie,secretKey:new Uint8Array(fe)}},t.box.publicKeyLength=Je,t.box.secretKeyLength=st,t.box.sharedKeyLength=gt,t.box.nonceLength=ut,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(fe,Ie){if(wt(fe,Ie),Ie.length!==qt)throw new Error("bad secret key size");var Ae=new Uint8Array(kt+fe.length);return Ve(Ae,fe,fe.length,Ie),Ae},t.sign.open=function(fe,Ie){if(wt(fe,Ie),Ie.length!==ln)throw new Error("bad public key size");var Ae=new Uint8Array(fe.length),ce=Ye(Ae,fe,fe.length,Ie);if(ce<0)return null;for(var Oe=new Uint8Array(ce),dt=0;dt<Oe.length;dt++)Oe[dt]=Ae[dt];return Oe},t.sign.detached=function(fe,Ie){for(var Ae=t.sign(fe,Ie),ce=new Uint8Array(kt),Oe=0;Oe<ce.length;Oe++)ce[Oe]=Ae[Oe];return ce},t.sign.detached.verify=function(fe,Ie,Ae){if(wt(fe,Ie,Ae),Ie.length!==kt)throw new Error("bad signature size");if(Ae.length!==ln)throw new Error("bad public key size");var ce=new Uint8Array(kt+fe.length),Oe=new Uint8Array(kt+fe.length),dt;for(dt=0;dt<kt;dt++)ce[dt]=Ie[dt];for(dt=0;dt<fe.length;dt++)ce[dt+kt]=fe[dt];return Ye(Oe,ce,ce.length,Ae)>=0},t.sign.keyPair=function(){var fe=new Uint8Array(ln),Ie=new Uint8Array(qt);return we(fe,Ie),{publicKey:fe,secretKey:Ie}},t.sign.keyPair.fromSecretKey=function(fe){if(wt(fe),fe.length!==qt)throw new Error("bad secret key size");for(var Ie=new Uint8Array(ln),Ae=0;Ae<Ie.length;Ae++)Ie[Ae]=fe[32+Ae];return{publicKey:Ie,secretKey:new Uint8Array(fe)}},t.sign.keyPair.fromSeed=function(fe){if(wt(fe),fe.length!==Jt)throw new Error("bad seed size");for(var Ie=new Uint8Array(ln),Ae=new Uint8Array(qt),ce=0;ce<32;ce++)Ae[ce]=fe[ce];return we(Ie,Ae,!0),{publicKey:Ie,secretKey:Ae}},t.sign.publicKeyLength=ln,t.sign.secretKeyLength=qt,t.sign.seedLength=Jt,t.sign.signatureLength=kt,t.hash=function(fe){wt(fe);var Ie=new Uint8Array(cn);return Fe(Ie,fe,fe.length),Ie},t.hash.hashLength=cn,t.verify=function(fe,Ie){return wt(fe,Ie),fe.length===0||Ie.length===0||fe.length!==Ie.length?!1:v(fe,0,Ie,0,fe.length)===0},t.setPRNG=function(fe){r=fe},(function(){var fe=typeof self<"u"?self.crypto||self.msCrypto:null;if(fe&&fe.getRandomValues){var Ie=65536;t.setPRNG(function(Ae,ce){var Oe,dt=new Uint8Array(ce);for(Oe=0;Oe<ce;Oe+=Ie)fe.getRandomValues(dt.subarray(Oe,Oe+Math.min(ce-Oe,Ie)));for(Oe=0;Oe<ce;Oe++)Ae[Oe]=dt[Oe];Dt(dt)})}else typeof Qan<"u"&&(fe=eln,fe&&fe.randomBytes&&t.setPRNG(function(Ae,ce){var Oe,dt=fe.randomBytes(ce);for(Oe=0;Oe<ce;Oe++)Ae[Oe]=dt[Oe];Dt(dt)}))})()})(e.exports?e.exports:self.nacl=self.nacl||{})})(zF)),zF.exports}tln();new TextEncoder;new TextDecoder;function nln(e){return{id:e.id,name:e.name,path:e.path,...e.alias?.trim()?{alias:e.alias.trim()}:{},...e.groupId?{groupId:e.groupId}:{},...e.kind==="ssh"?{kind:"ssh",...e.sshConnectionName?{sshConnectionName:e.sshConnectionName}:{},...e.sshHost?{sshHost:e.sshHost}:{}}:{}}}const rln=4096;BigInt(rln);function sln(e,t){const n=IN(e);if(n)return n.failed?{status:"queued",queueFailed:n.failed.error}:{status:"queued",queuePosition:t??1}}function oln(e,t,n){if(!(e.status==="running"||e.spawning))return hh(e.goal)?"upstream":t&&Jye(t,n)?"reminder":void 0}function iln(e,t=[]){return JSON.stringify({pinnedOrder:t,entries:e.map(n=>{const{updatedAt:r,...s}=n;return s})})}function aln(e){return JSON.stringify(e)}function lln(e,t,n=[]){const r=iq(e,t).map(o=>({id:o.id,name:o.name,models:o.models.map(i=>({id:i.id,...i.label?{label:i.label}:{}}))})),s=n.filter(o=>o.enabled&&r.some(i=>i.id===o.primary.providerId&&i.models.some(l=>l.id===o.primary.modelId)));return s.length>0&&r.unshift({id:Av,name:"Auto",models:s.map(o=>({id:o.id,label:o.name}))}),r}function cln(e,t,n=[]){const r=lln(e,t,n),s=t.availability.status,o=s==="unloaded"||s==="loading",i=e.some(l=>l.enabled&&l.oauthAccountKey);return{entries:r,settled:!(o&&i&&r.length===0)}}function uln(e){return e!=="scratch"&&e!=="secretary"}function dln(e,t){return new Set(e.filter(n=>n.kind==="secretary"||!t&&n.kind==="scratch").map(n=>n.id))}const fln=300;let mj=null,Gge=!1,OG=null;function hln(){const e=be.getState(),t=it.getState(),r=DX(e.projects,Ip(Wj)).filter(N=>uln(N.kind)),s=new Set(Ip(tg)),o=ZA(c2(e.language),"Temporary chats"),i=new Map(e.projects.map(N=>[N.id,N.kind==="scratch"?o:Ta(N)])),l=new Map(e.projects.map(N=>[N.id,N.path])),c=new Map(e.projects.map(N=>[N.id,N.kind])),u=N=>{const j=(N.parentId?t.conversations[N.parentId]:void 0)??N;return c.get(j.projectId)==="scratch"?jT({kind:"scratch",canonicalPath:l.get(j.projectId)??"",conversationId:j.id})??void 0:j.worktree?.path??l.get(N.projectId)},d=e.skills.filter(N=>N.enabled!==!1).map(N=>({name:`/skill:${N.name}`,description:N.description})),f=K_(t.conversations),h=Sk.getState().byConversation,p=Date.now(),m=N=>{const j=sln(N,f.get(N.id)),I=oln(N,h[N.id],p),_=Bje(N.occupancy,N.contextWindow),L={id:N.id,title:N.parentId&&N.coworkerName||N.title,projectName:i.get(N.projectId)??"",projectId:N.projectId,...u(N)?{cwd:u(N)}:{},status:j?.status??(N.spawning?"running":N.status),updatedAt:py(N),...N.parentId?{parentId:N.parentId}:{},...N.pinned===!0?{pinned:!0}:{},...N.archived===!0?{archived:!0}:{},...N.muted===!0?{muted:!0}:{},...N.lastProviderId?{providerId:N.lastProviderId}:{},...N.lastModelId?{modelId:N.lastModelId}:{},...N.reasoningEnabled!==void 0?{reasoningEnabled:N.reasoningEnabled}:{},...N.thinkingLevel?{thinkingLevel:N.thinkingLevel}:{},...N.unread===!0?{unread:!0}:{},...bg(N.pendingAsks)>0?{pendingAskCount:bg(N.pendingAsks)}:{},...N.pendingApprovals&&N.pendingApprovals.length>0?{pendingApprovalCount:N.pendingApprovals.length}:{},...N.queuedMessages?.length?{queued:N.queuedMessages.map(M=>({id:M.id,text:M.text,...M.images?.length?{hasImages:!0}:{}}))}:{},...N.goal?{goal:{text:N.goal.text,status:N.goal.status,...N.goal.note?{note:N.goal.note}:{},autoTurns:N.goal.autoTurns}}:{},...I?{parked:I}:{},...d.length?{slashCommands:d}:{},..._?{context:_}:{},...N.usageTotals?{usageTotals:N.usageTotals}:{}};return j&&"queuePosition"in j&&Object.assign(L,{queuePosition:j.queuePosition}),j&&"queueFailed"in j&&Object.assign(L,{queueFailed:j.queueFailed}),L},v=t.order.map(N=>t.conversations[N]).filter(N=>!!N),b=new Set(t.order),x=Object.values(t.conversations).filter(N=>!!(N?.parentId&&b.has(N.parentId))),S=[...v,...x].map(m),k=dln(e.projects,e.scratchSessionsEnabled),C=S.filter(N=>!k.has(N.projectId)),A=cln(RM(),Ri.getState().snapshot,e.virtualModels);return{catalog:C,pinnedOrder:Ip(MH),projects:r.map(N=>({...nln(N),...s.has(N.id)?{archived:!0}:{}})),projectGroups:e.projectGroups,providers:A.entries,providersSettled:A.settled,projectPaths:e.projects.map(N=>({id:N.id,path:N.path})),theme:e.theme,terminal:nN(e.terminalTheme),terminalFontFamily:e.terminalFontFamily,compactReadOnlyTools:e.compactReadOnlyTools,expandLiveEdits:e.expandLiveEdits,expandLiveReasoning:e.expandLiveReasoning,autoCollapseTurns:e.autoCollapseTurns,collapseCompletedActivity:e.collapseCompletedActivity,collapseLiveActivity:e.collapseLiveActivity,pinUnfinishedTodos:e.pinUnfinishedTodos}}function pln(e){return aln({catalog:iln(e.catalog,e.pinnedOrder??[]),projects:e.projects,projectGroups:e.projectGroups,providers:e.providers,providersSettled:e.providersSettled,projectPaths:e.projectPaths,theme:e.theme,terminal:e.terminal,terminalFontFamily:e.terminalFontFamily,compactReadOnlyTools:e.compactReadOnlyTools,expandLiveEdits:e.expandLiveEdits,expandLiveReasoning:e.expandLiveReasoning,autoCollapseTurns:e.autoCollapseTurns,collapseCompletedActivity:e.collapseCompletedActivity,collapseLiveActivity:e.collapseLiveActivity,pinUnfinishedTodos:e.pinUnfinishedTodos})}function mln(){return it.persist.hasHydrated()&&be.persist.hasHydrated()}function dp(){mj&&clearTimeout(mj),mj=setTimeout(()=>{if(mj=null,!Ql()||!mln())return;const e=hln(),t=pln(e);t!==OG&&(OG=t,window.electronAPI.pair.pushCatalog(e))},fln)}function gln(){Gge||(Gge=!0,dp(),it.persist.onFinishHydration(dp),be.persist.onFinishHydration(dp),it.subscribe((e,t)=>{(e.conversations!==t.conversations||e.order!==t.order)&&dp()}),Ri.subscribe((e,t)=>{e.snapshot!==t.snapshot&&dp()}),Sk.subscribe((e,t)=>{e.byConversation!==t.byConversation&&dp()}),Mf.subscribe((e,t)=>{e.snapshot!==t.snapshot&&dp()}),be.subscribe((e,t)=>{(e.projects!==t.projects||e.projectGroups!==t.projectGroups||e.providers!==t.providers||e.theme!==t.theme||e.terminalTheme!==t.terminalTheme||e.terminalFontFamily!==t.terminalFontFamily||e.compactReadOnlyTools!==t.compactReadOnlyTools||e.expandLiveEdits!==t.expandLiveEdits||e.expandLiveReasoning!==t.expandLiveReasoning||e.autoCollapseTurns!==t.autoCollapseTurns||e.collapseCompletedActivity!==t.collapseCompletedActivity||e.collapseLiveActivity!==t.collapseLiveActivity||e.pinUnfinishedTodos!==t.pinUnfinishedTodos||e.skills!==t.skills)&&dp()}),F2e(dp),ZJe(e=>{e&&(OG=null,dp())}),window.electronAPI.pair.onResumeSession(e=>{Jne(e),Ql()&&(it.getState().markConversationRead(e),it.getState().resumeConversation(e))}),window.electronAPI.pair.onSessionCreated(e=>{Jne(e.sessionId),Ql()&&it.getState().adoptPairSession(e)}),window.electronAPI.pair.onSessionConfig(e=>{if(!Ql())return;const t=it.getState();e.type==="set-model"?t.setModel(e.sessionId,e.providerId,e.modelId):e.type==="set-reasoning"?t.setReasoning(e.sessionId,e.enabled):t.setThinking(e.sessionId,e.level)}),window.electronAPI.pair.onQueueAction(e=>{if(!Ql())return;const t=it.getState();switch(e.type){case"enqueue":t.enqueueMessage(e.sessionId,e.text,e.images);break;case"queue-remove":t.removeQueuedMessage(e.sessionId,e.messageId);break;case"queue-update":t.updateQueuedMessage(e.sessionId,e.messageId,e.text);break;case"queue-send-now":t.sendQueuedNow(e.sessionId,e.messageId);break;case"queue-interrupt-send":t.interruptAndSendQueued(e.sessionId,e.messageId);break;case"goal-pause":t.pauseGoal(e.sessionId);break;case"goal-resume":t.resumeGoal(e.sessionId);break;case"goal-clear":t.clearGoal(e.sessionId);break;case"goal-set":t.setGoal(e.sessionId,e.text);break;case"compact":t.compact(e.sessionId,e.instructions,{quiet:!0});break;case"rewind":t.rewind(e.sessionId,e.userIndexFromEnd,e.restoreFiles);break;case"retry":t.retry(e.sessionId);break;case"task-stop":window.electronAPI.agent.stopTask(e.sessionId,e.taskId);break;case"subagent-stop":window.electronAPI.agent.stopSubagent(e.sessionId,e.agentId);break}}))}const vln=3e4;async function xln(e,t=Date.now()){const{order:n,conversations:r,activeId:s}=it.getState(),o=n.flatMap(d=>{const f=r[d];return!f||f.parentId?[]:(d===s||f.status==="running"||f.spawning===!0||f.workspaceMigrating===!0||(f.pendingAsks?.length??0)>0||(f.pendingApprovals?.length??0)>0)&&e.kind==="stale"?[]:[{id:d,projectId:f.projectId,archived:f.archived,archivedAt:f.archivedAt,pinned:f.pinned,lastActiveAt:py(f)}]}),i=x1e(o,e,t),l=it.getState();for(const d of i)l.removeConversation(d);const c=Date.now()+vln,u=()=>i.filter(d=>it.getState().conversations[d]);for(;u().length>0&&Date.now()<c;)await new Promise(d=>setTimeout(d,200));return i.length-u().length}const bln=y.lazy(()=>Be(()=>import("./SidePanel-Dnt_MZWO.js"),__vite__mapDeps([127,126,128]),import.meta.url).then(e=>({default:e.SidePanel}))),yln=e=>{const t=HLe(e);return t.length>0?t:l0e(e)},Wge="enso-sidebar-width",qge="enso-sidebar-collapsed";function gj(){const e=it.getState(),n=(e.activeId?e.conversations[e.activeId]:null)?.projectId??be.getState().projects[0]?.id;n&&e.newConversation(n)}const vj="no-drag flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",Yge=200,$ge=420;function wln(){const e=be(he=>he.onboarded),t=y.useSyncExternalStore(he=>be.persist?.onFinishHydration?.(he)??(()=>{}),()=>be.persist?.hasHydrated?.()??!0);FXe(),yan(),xan(),Tan(),jan(),ban();const[n,r]=y.useState(!1),[s,o]=y.useState(null);Pan();const[i,l]=y.useState(()=>{const he=Number(localStorage.getItem(Wge));return Number.isFinite(he)&&he>=Yge?Math.min(he,$ge):280}),[c,u]=y.useState(()=>localStorage.getItem(qge)==="1"),d=Xp(),f=GXe(),[h,p]=y.useState(!1),m=y.useCallback(()=>p(!1),[]);y.useEffect(()=>{d||p(!1)},[d]),y.useEffect(()=>it.subscribe((he,Ye)=>{he.activeId!==Ye.activeId&&p(!1)}),[]);const{t:v}=Se(),b=be(he=>he.chatWide),x=it(he=>he.activeId),S=Bq(x),k=fs(he=>he.uiByConversation[x??""]?.width??he.lastWidth),C=fs(he=>he.fullscreen),A=fs(he=>he.toggleOpen),N=_t(he=>he.panelOpen),j=_t(he=>he.togglePanel);y.useEffect(()=>{C&&!S&&fs.getState().setFullscreen(!1)},[S,C]),y.useEffect(()=>ost(),[]),y.useEffect(()=>(document.documentElement.classList.add("enso-main-shell"),()=>document.documentElement.classList.remove("enso-main-shell")),[]),y.useEffect(()=>window.electronAPI.app.onCloseRequest(o),[]),y.useEffect(()=>window.electronAPI.app.onFlushPersist(he=>{TXe().finally(()=>{window.electronAPI.app.respondFlushPersist(he)})}),[]);const I=he=>{const Ye=s;Ye&&(o(null),window.electronAPI.app.respondCloseRequest(Ye,{action:he}))},_=y.useCallback(()=>{VXe(window.innerWidth)?p(he=>!he):u(he=>!he)},[]),L=y.useCallback(()=>{window.electronAPI.env.platform==="darwin"&&window.setTimeout(()=>window.electronAPI.window.refreshDragRegions(),400)},[]),M=y.useCallback(()=>{_(),L()},[_,L]);y.useEffect(()=>Dan(M),[M]),y.useEffect(()=>window.electronAPI.window.onToggleSidebar(M),[M]);const[F,D]=y.useState(!1),R=y.useRef(null);y.useEffect(()=>{localStorage.setItem(Wge,String(i))},[i]),y.useEffect(()=>{localStorage.setItem(qge,c?"1":"0")},[c]),y.useEffect(()=>window.electronAPI.resources.onSessionsCleanRequest(({requestId:he,request:Ye})=>{xln(Ye).catch(()=>0).then(Le=>window.electronAPI.resources.sessionsCleanDone(he,Le))}),[]),y.useEffect(()=>{gln()},[]),y.useEffect(()=>{const he=window.electronAPI.remote;return he&&!he.nativePlatform?void 0:jd.getState().bind()},[]);const z=jd(he=>he.pairDialogOpen),B=tft(),H=be(he=>he.botModeEnabled),G=be(he=>he.headerSessionTabs),te=pg(he=>he.mode);y.useEffect(()=>{const he=be.persist?.hasHydrated?.()??!0;te==="bot"&&he&&!H&&pg.getState().setMode("code")},[te,H]),y.useEffect(()=>{if(!H)return;const he=_t.getState().bind(),Ye=window.electronAPI.bots.onEvent(Le=>{Le.kind==="open"&&nft(Le)});return()=>{he(),Ye()}},[H]);const W=be(he=>he.secretaryEnabled),T=Pr(he=>he.welcomeOpen),U=Ey(he=>he.open);y.useEffect(()=>W?Pr.getState().bind():void 0,[W]),y.useEffect(()=>window.electronAPI.agent.onFocusSession(he=>{it.getState().conversations[he]&&oP()}),[]);const P=y.useCallback(he=>{l(Ye=>Math.min($ge,Math.max(Yge,Ye+he)))},[]),K=be(he=>he.keybindings);y.useEffect(()=>{const he=jh(K),Ye=Ne=>{const Ge=it.getState(),ft=Ge.activeId?Ge.conversations[Ge.activeId]:null;if(!ft)return;const Ze=[void 0,...ft.coworkerIds??[]];if(Ze.length<=1)return;const je=Ze.indexOf(ft.activeTabId);Ge.selectTab(ft.id,Ze[(je+Ne+Ze.length)%Ze.length])},Le=Ne=>{const Ge=qv(Ne);if(!Ge)return;if(Ge===he["open-settings"]){Ne.preventDefault(),uLe();return}if(wc.getState().settings)return;if(Ge===he["toggle-app-mode"]){if(!be.getState().botModeEnabled)return;Ne.preventDefault();const je=pg.getState();je.setMode(je.mode==="bot"?"code":"bot");return}const ft=ooe();if(ft&&Ge===he["toggle-side-panel"]){Ne.preventDefault(),_t.getState().togglePanel();return}if(ft&&Ge===he["search-workspace"]){Ne.preventDefault(),_t.getState().setSearchOpen(!0);return}if(!(ft&&["new-conversation","next-tab","prev-tab","toggle-side-panel","toggle-side-panel-fullscreen","new-side-tab","new-btw-tab","close-side-tab","find-in-chat","search-workspace","open-secretary"].some(Ze=>Ge===he[Ze]))){if(Ge===he["toggle-sidebar"]){if(Ne.preventDefault(),nct(Ne,Ge))return;M()}else if(Ge===he["open-secretary"])be.getState().secretaryEnabled&&(Ne.preventDefault(),vR());else if(Ge===he["new-conversation"])Ne.preventDefault(),gj();else if(Ge===he["new-side-tab"])Ne.preventDefault(),tct(Ne.target)?K1t():gj();else if(Ge===he["new-btw-tab"])Ne.preventDefault(),Z1t();else if(Ge===he["next-tab"])Ne.preventDefault(),Ye(1);else if(Ge===he["prev-tab"])Ne.preventDefault(),Ye(-1);else if(Ge===he["toggle-side-panel"])Ne.preventDefault(),fs.getState().toggleOpen();else if(Ge===he["toggle-side-panel-fullscreen"])Ne.preventDefault(),fs.getState().toggleFullscreen();else if(Ge===he["close-side-tab"])Ne.preventDefault(),rwt();else if(Ge===he["focus-composer"])Ne.preventDefault(),b2();else if(Ge===he["find-in-chat"])Ne.preventDefault(),fje();else if(Ge===he["search-workspace"])Ne.preventDefault(),r(!0);else if(!ft){const Ze=oMe(vje(),K,he).byBinding.get(Ge);if(!Ze)return;Ne.preventDefault();const je=it.getState(),Je=je.activeId?je.conversations[je.activeId]:null;IX(Ze,Je?Je.activeTabId??Je.id:null).then(st=>{st&&Ht({type:"error",title:Ze.title,description:st})})}}};return window.addEventListener("keydown",Le),()=>window.removeEventListener("keydown",Le)},[K,M]),y.useEffect(()=>{if(!S||!C)return;const he=Ye=>{Ye.key==="Escape"&&(ooe()||wc.getState().settings||(Ye.preventDefault(),fs.getState().setFullscreen(!1)))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[S,C]);const J=MLe(RLe(GG,{activationConstraint:{distance:6}})),ee=pLe(),X=y.useRef(null),ne=y.useRef(null),Q=y.useRef(null),[oe,de]=y.useState(null),[ie]=y.useState(()=>Ban({reducedMotion:zan,onSettle:()=>de(null)})),[ue,ve]=y.useState(ee);y.useLayoutEffect(()=>{if(ue===ee)return;ve(ee);const he=X.current,Ye=Ne=>he?.querySelector(`[data-enso="${Ne}"]`)??null,Le=ie.run(ee?"settings":"workbench",{workbench:{sidebar:d?null:Q.current,main:B?ne.current:R.current},settings:d?{sidebar:he,main:null}:{sidebar:Ye("settings-nav"),main:Ye("settings-content")}});de(Le.animating?{top:Le.top}:null)},[ee,ue,ie,d,B]),y.useEffect(()=>()=>ie.finish(),[ie]),y.useLayoutEffect(()=>{oe===null&&ie.release()},[oe,ie]);const{settingsMounted:ge,workbenchHidden:Te}=Fan({open:ee,shown:ue,animating:oe!==null});y.useLayoutEffect(()=>fLe(ge),[ge]),y.useEffect(()=>{ee&&p(!1)},[ee]),y.useEffect(()=>Lan(window.electronAPI.window),[]);const De=y.useRef(d);De.current=d,y.useEffect(()=>{if(window.electronAPI.remote)return Oan(window,{depth:()=>hLe(wc.getState(),De.current),apply:he=>{if(he===0){lT();return}nu(),n0e(he===2)},subscribe:he=>wc.subscribe(he)})},[]);const Me=ge?a.jsx("div",{ref:X,"data-enso":"settings-view",inert:!ee,className:xe("absolute inset-0 flex",d&&"bg-background",oe?.top==="workbench"?"z-0":"z-[2]"),children:a.jsx(van,{navWidth:i,onNavResize:P,open:ee})}):null,Fe=iP(),He=Fe!=="mobile"&&!B,tt=y.useCallback(he=>{const Ye=R.current;if(!Ye)return;const Le=getComputedStyle(Ye),Ne=Ye.clientWidth-parseFloat(Le.paddingLeft)-parseFloat(Le.paddingRight);fs.getState().nudgeWidth(-he,Ne,He?est:aN)},[He]),$e=H?a.jsx(aDt,{}):null,Ue=He&&(Fe==="mac"||Fe==="windows"||Fe==="web"),Pe=Ue&&S&&!d&&!B,we=G&&!ee&&He&&!H&&!(Pe&&C)?a.jsx(vct,{onNew:gj}):null,ye=a.jsx("button",{type:"button",className:xe("flex items-center justify-center rounded-md transition-colors hover:bg-accent/50",d?"h-9 w-9":He?vj:"h-7 w-7",(B?N:S)?"text-foreground":"text-muted-foreground"),onClick:B?j:A,"aria-label":v("Toggle side panel"),title:v("Toggle side panel"),children:a.jsx(bUe,{className:"h-4 w-4"})}),Re=a.jsx("button",{type:"button",className:xe("flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-accent/50",b?"text-foreground":"text-muted-foreground",d&&"hidden"),onClick:()=>be.getState().setChatWide(!b),"aria-label":v(b?"Use reading width":"Use full chat width"),title:v(b?"Use reading width":"Use full chat width"),children:b?a.jsx(Vze,{className:"h-4 w-4"}):a.jsx(IVe,{className:"h-4 w-4"})}),_e=a.jsxs(a.Fragment,{children:[Re,ye]}),Ve=He?{trailing:Re}:null;return a.jsxs("div",{"data-enso":"canvas",className:xe("relative isolate flex flex-col",d?"h-dvh":"h-screen"),children:[a.jsx(B2e,{}),a.jsx(Van,{}),a.jsx(ast,{}),a.jsx(aft,{}),a.jsx(xzt,{}),Fe!=="mobile"?a.jsx(coe,{leading:a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx("div",{className:xe(Fe!=="mac"&&"flex justify-center",Fe!=="mac"&&(He?"w-[48px]":"w-12")),children:a.jsx("button",{type:"button","data-enso":"sidebar-toggle",className:xe(vj,ee&&"pointer-events-none opacity-40"),disabled:ee,onClick:M,title:v(c?"Expand sidebar":"Collapse sidebar"),children:c?a.jsx(Cxe,{className:"h-4 w-4"}):a.jsx(MW,{className:"h-4 w-4"})})}),He&&!ee&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button","data-enso":"search-button",className:vj,onClick:()=>r(!0),title:v("Search anything"),children:a.jsx(su,{className:"h-4 w-4"})}),a.jsx("button",{type:"button","data-enso":"new-session",className:vj,onClick:gj,title:v("New conversation"),children:a.jsx(lVe,{className:"h-4 w-4"})})]})]}),centered:(Pe&&C?null:$e)??void 0,middle:we,className:xe(Fe!=="mac"&&"pl-0",He&&"border-b-0",He&&"bg-transparent",He&&Fe==="mac"&&"pr-4"),actions:ee?void 0:He?Pe?void 0:ye:_e}):a.jsx(coe,{title:"EnsoCode",centered:$e??void 0,leading:d&&!B?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button","data-enso":"sidebar-toggle",className:"-ml-1.5 flex h-9 w-9 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",onClick:()=>p(!0),"aria-label":v("Conversations"),title:v("Conversations"),children:a.jsx(QHe,{className:"h-5 w-5"})}),!$e&&a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"EnsoCode"})]}):void 0,actions:_e}),!He&&a.jsx(loe,{}),!He&&a.jsx(Aae,{}),!He&&a.jsx(Nae,{}),a.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[a.jsx("div",{ref:ne,"data-enso":"workbench",inert:Te,className:xe("flex min-h-0 min-w-0 flex-1",Te&&"invisible",oe?.top==="workbench"&&"z-[1]"),children:B?a.jsx(nDt,{sidebarWidth:i,collapsed:c,onToggleCollapse:M,onResize:P}):a.jsxs(_8e,{sensors:J,collisionDetection:yln,children:[d?a.jsxs(a.Fragment,{children:[a.jsx(hE,{children:h&&a.jsx(hf.div,{className:"fixed inset-0 bg-black/40",style:{zIndex:_r.MOBILE_DRAWER},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:m},"drawer-backdrop")}),a.jsx(hf.div,{className:"fixed inset-y-0 left-0 flex bg-background shadow-xl",style:{zIndex:_r.MOBILE_DRAWER},initial:!1,animate:{x:h?0:"-105%"},transition:tk,inert:!h,children:a.jsx(Yue,{width:Math.min(320,Math.round(f*.85)),collapsed:!1,onToggleCollapse:m,onOpenSearch:()=>r(!0),onNavigate:m})})]}):a.jsxs("div",{ref:Q,className:"flex min-h-0 shrink-0",children:[a.jsx(Yue,{width:c?void 0:i,collapsed:c,onToggleCollapse:M,onOpenSearch:()=>r(!0)}),!c&&a.jsx(tA,{edge:He,onResize:P})]}),a.jsxs("div",{ref:R,className:xe("relative flex min-h-0 min-w-0 flex-1",Ue?"overflow-x-clip":"overflow-hidden",He&&"-mt-px -ml-px pt-px pr-[8px] pb-[8px] pl-px"),children:[a.jsxs("div",{"data-enso":"main",className:xe("relative flex min-h-0 min-w-0 flex-1 flex-col bg-background",He&&"overflow-hidden rounded-[10px] shadow-surface",Pe&&"rounded-r-none"),style:S&&C?{visibility:"hidden",transition:`visibility 0s ${U6.duration}s`}:void 0,children:[a.jsx(Xan,{}),a.jsx(tot,{hidden:W&&T||U,children:a.jsx(oSe.Provider,{value:Ve,children:a.jsx(wBt,{})})}),He&&a.jsx(loe,{}),He&&a.jsx(Aae,{}),He&&a.jsx(Nae,{}),W&&T&&a.jsx(FHt,{}),U&&a.jsx(OAt,{})]}),!C&&!d&&a.jsx(tA,{gap:He&&!Ue,inactive:!S,onResize:tt,onResizingChange:D}),a.jsx(y.Suspense,{fallback:null,children:a.jsx(bln,{width:k,resizing:F,card:He,titleRow:Ue})})]})]})}),!d&&Me]}),d&&Me,t&&!e&&!window.electronAPI.remote&&a.jsx(sHt,{}),a.jsx(BHt,{open:n,onOpenChange:r}),a.jsx(nUt,{}),a.jsx(wRe,{open:z,onOpenChange:jd.getState().setPairDialogOpen}),a.jsx(Zp,{open:s!==null,onOpenChange:he=>{!he&&s&&I("cancel")},children:a.jsxs(Jp,{className:"sm:max-w-sm",children:[a.jsxs(em,{children:[a.jsx(nm,{className:"text-base",children:v("Confirm exit")}),a.jsx(rm,{children:v("Exit closes the app completely, so your phone can no longer connect. Minimize to tray keeps the app running in the background so your phone can still connect.")})]}),a.jsxs(tm,{variant:"bare",children:[a.jsx(dx,{render:a.jsx(Ke,{variant:"outline",size:"sm"}),children:v("Cancel")}),a.jsx(Ke,{size:"sm",onClick:()=>I("tray"),children:v("Minimize to tray")}),a.jsx(Ke,{variant:"destructive",size:"sm",onClick:()=>I("quit"),children:v("Exit")})]})]})}),a.jsx(yft,{})]})}function kln(e){return new Worker(""+new URL("worker-DsKBD11i.js",import.meta.url).href,{type:"module",name:e?.name})}const Sln={workerFactory:()=>new kln,poolSize:2},Cln={theme:v4,langs:[...h6e],preferredHighlighter:"shiki-js"};function Eln({children:e}){return a.jsx(F$t,{poolOptions:Sln,highlighterOptions:Cln,children:e})}function Tln(e=document,t=800){const n=new Map,r=s=>{const o=s.target,i=o&&o.nodeType===9?o.documentElement:o;!i||typeof i.setAttribute!="function"||(i.setAttribute("data-scrolling",""),clearTimeout(n.get(i)),n.set(i,setTimeout(()=>{n.delete(i),i.removeAttribute("data-scrolling")},t)))};return e.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>{e.removeEventListener("scroll",r,{capture:!0});for(const s of n.values())clearTimeout(s);n.clear()}}function Kge({conversations:e,activeId:t}){const n=document.documentElement.dataset,r=FBt(e),s=Qje(t?e[t]:void 0,e);n.ensoActivity!==r&&(n.ensoActivity=r),n.ensoSession!==s&&(n.ensoSession=s)}function Aln(){Kge(it.getState()),it.subscribe((e,t)=>{(e.conversations!==t.conversations||e.activeId!==t.activeId)&&Kge(e)})}BXe();Aln();Tln();N2e();qPe.createRoot(document.getElementById("root")).render(a.jsx(y.StrictMode,{children:a.jsx(Eln,{children:a.jsx(wln,{})})}));export{oKt as $,pcn as A,ucn as B,v4 as C,IMe as D,v3e as E,tXt as F,SYt as G,Ccn as H,mcn as I,wL as J,kL as K,V3 as L,M2 as M,Acn as N,Ncn as O,Ofe as P,Qo as Q,Gk as R,dcn as S,sG as T,Cc as U,she as V,n6e as W,KYt as X,Lfe as Y,U3 as Z,kcn as _,qEt as a,VKt as a$,ohe as a0,xcn as a1,m4 as a2,hKt as a3,ru as a4,l$t as a5,Afe as a6,a6e as a7,rhe as a8,dKt as a9,gKt as aA,jMe as aB,RMe as aC,MMe as aD,kKt as aE,EKt as aF,cG as aG,MKt as aH,AKt as aI,GV as aJ,RKt as aK,jKt as aL,xKt as aM,LKt as aN,TKt as aO,rg as aP,c$t as aQ,aG as aR,Xfe as aS,z$t as aT,Mt as aU,gcn as aV,vcn as aW,bcn as aX,ycn as aY,wcn as aZ,ccn as a_,N$t as aa,m$t as ab,f$t as ac,_fe as ad,iKt as ae,Mv as af,s6e as ag,H$t as ah,lKt as ai,Mfe as aj,JYt as ak,IKt as al,J$t as am,G$t as an,Qfe as ao,u5 as ap,vA as aq,PKt as ar,sYt as as,Ecn as at,Tcn as au,iG as av,Al as aw,yKt as ax,wKt as ay,Kfe as az,JKt as b,oct as b$,lG as b0,$fe as b1,Ea as b2,CYt as b3,Hn as b4,vLe as b5,xe as b6,kW as b7,Bs as b8,Ho as b9,hrn as bA,lrn as bB,be as bC,t3t as bD,kk as bE,$u as bF,r2 as bG,acn as bH,io as bI,mT as bJ,PUe as bK,ua as bL,j3t as bM,xs as bN,Rf as bO,xNe as bP,NN as bQ,By as bR,ODt as bS,dK as bT,fK as bU,cA as bV,zy as bW,Pi as bX,n_ as bY,IN as bZ,K_ as b_,jW as ba,it as bb,O6 as bc,crn as bd,Is as be,kT as bf,Jr as bg,Fy as bh,bq as bi,v_ as bj,xxe as bk,YHt as bl,Vce as bm,ejt as bn,P2 as bo,mx as bp,tK as bq,rK as br,eK as bs,sK as bt,L2 as bu,Pr as bv,Ng as bw,GHe as bx,prn as by,mrn as bz,tx as c,xo as c$,Due as c0,KN as c1,HFt as c2,Md as c3,ZFt as c4,Hd as c5,Ri as c6,fu as c7,tcn as c8,xz as c9,jcn as cA,nu as cB,Fsn as cC,bxe as cD,Yu as cE,Q4 as cF,$p as cG,g4t as cH,Kp as cI,wf as cJ,Lf as cK,Y4 as cL,$A as cM,Lo as cN,z2 as cO,U2 as cP,H2 as cQ,kxe as cR,Dp as cS,Bp as cT,Fp as cU,zr as cV,YT as cW,_i as cX,Qu as cY,Zu as cZ,Ju as c_,TT as ca,pM as cb,Uv as cc,xg as cd,ncn as ce,uet as cf,rcn as cg,bje as ch,vz as ci,Og as cj,x3e as ck,X7t as cl,i7t as cm,Q9t as cn,sc as co,OIe as cp,B7t as cq,scn as cr,l2e as cs,Ht as ct,b2 as cu,Yv as cv,Ke as cw,Jn as cx,du as cy,ec as cz,kYt as d,Txe as d$,t1 as d0,fs as d1,Mln as d2,jT as d3,Pq as d4,K4 as d5,qa as d6,wxe as d7,aUe as d8,En as d9,zln as dA,R$ as dB,bse as dC,wYt as dD,su as dE,tA as dF,fv as dG,G1t as dH,nze as dI,xT as dJ,JRe as dK,ZKt as dL,Gp as dM,yYt as dN,E0e as dO,Bq as dP,HGe as dQ,T_ as dR,Nd as dS,EEe as dT,Sie as dU,$4 as dV,cq as dW,nN as dX,jln as dY,XJe as dZ,AW as d_,Bze as da,y6t as db,w6t as dc,Bln as dd,fie as de,BN as df,zP as dg,R2 as dh,GSe as di,Vxt as dj,Jxt as dk,eEe as dl,nWe as dm,i_ as dn,Oln as dp,Lln as dq,Dln as dr,b4t as ds,_cn as dt,Xp as du,hre as dv,Rcn as dw,Mcn as dx,Fln as dy,lg as dz,nXt as e,_W as e0,RM as e1,Rln as e2,qln as e3,Yj as e4,$ln as e5,J1t as e6,Kln as e7,ecn as e8,ocn as e9,bUe as eA,wft as eB,Yln as eC,lcn as eD,C4t as eE,icn as eF,Be as eG,hf as ea,v6t as eb,ywe as ec,hH as ed,zXe as ee,est as ef,aN as eg,Jln as eh,Iln as ei,Uln as ej,Vln as ek,Wln as el,Y1t as em,X1t as en,Pln as eo,Hln as ep,Gln as eq,q1t as er,_ln as es,iHe as et,r_ as eu,YP as ev,Fv as ew,Mg as ex,vf as ey,iP as ez,$nn as f,LMe as g,r6e as h,r1 as i,a as j,Zln as k,Q3t as l,Oy as m,Ife as n,ZX as o,Uk as p,Scn as q,y as r,t6e as s,WKt as t,Se as u,hcn as v,fcn as w,g4 as x,p4 as y,yA as z};
|
|
3003
|
+
`)[0].trim();return n?{type:"warning",title:n,description:t}:{type:"warning",title:t}}function wan(e){return{at:e.exitAt,kind:e.kind,unfinishedTools:[...e.unfinishedTools],...e.suppressedError?{suppressedError:e.suppressedError}:{}}}function kan(e){return e?e.status!=="running":!1}const San=3e4;function Can(e,t=San){return e()?Promise.resolve(!0):new Promise(n=>{const r=l=>{clearTimeout(i);for(const c of o)c();n(l)},s=()=>e()&&r(!0),o=[it.subscribe(s),Ri.subscribe(s),be.subscribe(s)],i=setTimeout(()=>r(e()),t)})}function Ean(){const e=Ri.getState().snapshot.availability.status;return it.persist.hasHydrated()&&be.persist.hasHydrated()&&e!=="unloaded"&&e!=="loading"}function Tan(){const{t:e}=Se();y.useEffect(()=>{Ql()&&(async()=>{const t=await window.electronAPI.agent.takeInterruptedTurns().catch(()=>[]);if(t.length===0||!await Can(Ean))return;const n=new Set;for(const r of t)kan(it.getState().conversations[r.conversationId])&&(n.add(r.conversationId),it.setState(s=>{const o=s.conversations[r.conversationId];return!o||o.status==="running"?s:{conversations:{...s.conversations,[r.conversationId]:{...o,status:"interrupted",interrupted:wan(r),error:void 0}}}}));n.size!==0&&Ht({type:"info",title:e("{{count}} conversation(s) interrupted by app exit",{count:n.size})})})()},[e])}const Aan=3e4;function Nan(e,t=Aan){return e()?Promise.resolve(!0):new Promise(n=>{const r=l=>{clearTimeout(i);for(const c of o)c();n(l)},s=()=>e()&&r(!0),o=[it.subscribe(s),be.subscribe(s)],i=setTimeout(()=>r(e()),t)})}function Ian(){return it.persist.hasHydrated()&&be.persist.hasHydrated()}function jan(){const{t:e}=Se();y.useEffect(()=>{if(!Ql())return;const t=()=>{OH(async()=>{if(!await Nan(Ian))return;const r=await window.electronAPI.window.takeOpenFolders().catch(()=>[]);let s=!1;for(const o of r)try{if(!await V2e(o)){Ht({type:"error",title:e("Failed to add project")});continue}s=!0}catch(i){Ht({type:"error",title:e("Failed to add project"),description:i instanceof Error?i.message:String(i)})}s&&oP()})},n=window.electronAPI.window.onOpenFolderRequested(t);return t(),n},[e])}const Oge="enso-win",M_e="enso-win-flush",hj="enso-win-pending",Dge="enso-win-native";function Ran(e,t,n){return{maximized:n.maximized?e.maximized:t.maximized,fullscreen:n.fullscreen?e.fullscreen:t.fullscreen}}function Man(e,t){return e||t}function _an(e,t){document.documentElement.classList.toggle(M_e,Man(e,t))}function Pan(){y.useEffect(()=>{if(window.electronAPI?.env.platform!=="win32")return;const e=document.documentElement;e.classList.add(Oge,hj),e.classList.add(Dge);let t={maximized:!1,fullscreen:!1};const n={maximized:0,fullscreen:0};let r=!1,s=0,o;const i=()=>_an(t.maximized,t.fullscreen),l=window.electronAPI.window,c=()=>{const h=++s,p={...n};Promise.all([l.isMaximized(),l.isFullScreen()]).then(([m,v])=>{r||h!==s||(t=Ran(t,{maximized:m,fullscreen:v},{maximized:n.maximized!==p.maximized,fullscreen:n.fullscreen!==p.fullscreen}),e.classList.remove(hj),i())}).catch(()=>{!r&&h===s&&e.classList.remove(hj)})};c();const u=()=>{o&&clearTimeout(o),o=setTimeout(c,50)};window.addEventListener("resize",u);const d=l.onMaximizedChange(h=>{n.maximized+=1,t.maximized=h,i()}),f=l.onFullScreenChange(h=>{n.fullscreen+=1,t.fullscreen=h,i()});return()=>{r=!0,o&&clearTimeout(o),window.removeEventListener("resize",u),d(),f(),e.classList.remove(Oge,M_e,hj,Dge)}},[])}function Lan(e){const t=()=>{e.consumeSettingsDeepLink().then(n=>{n&&nu(n.link)})};return t(),e.onSettingsDeepLink(t)}const __e="ensoSettingsDepth",Bge=e=>{const t=e?.[__e];return typeof t=="number"?t:0};function Oan(e,t){let n=Bge(e.history.state),r=!1;const s=()=>{if(r)return;const l=t.depth();for(;n<l;)n+=1,e.history.pushState({[__e]:n},"");n>l&&(r=!0,e.history.go(l-n))},o=l=>{if(n=Bge(l.state),r){r=!1,s();return}t.depth()!==n&&t.apply(n)};e.addEventListener("popstate",o);const i=t.subscribe(s);return s(),()=>{i(),e.removeEventListener("popstate",o)}}const Fge=new Set;function Dan(e){return Fge.add(e),()=>Fge.delete(e)}const pj={duration:180,easing:"cubic-bezier(0.22, 1, 0.36, 1)",shift:10,underlayHold:.6};function Ban(e){let t=null,n=[];const r=()=>{for(const i of n)i.cancel();n=[]},s=()=>{t&&(n.push(...t.animations),t=null,e.onSettle())};return{run:(i,l)=>{if(e.reducedMotion())return s(),r(),{animating:!1,top:i};if(t){if(t.to!==i){t.to=i;for(const v of t.animations)v.reverse()}return{animating:!0,top:t.top}}r();const c=i==="settings"?"workbench":"settings",u=pj.shift*(i==="settings"?1:-1),d=v=>({duration:pj.duration,easing:v,fill:"both"}),f=d(pj.easing),h=v=>`translateX(${v}px)`,p=[l[c].sidebar?.animate([{opacity:1,transform:h(0)},{opacity:0,transform:h(-u)}],f),l[i].sidebar?.animate([{opacity:0,transform:h(u)},{opacity:1,transform:h(0)}],f),l[c].main?.animate([{opacity:1},{opacity:1,offset:pj.underlayHold},{opacity:0}],d("linear")),l[i].main?.animate([{opacity:0},{opacity:1}],f)].filter(v=>v!==void 0),m={to:i,top:i,animations:p};return t=m,Promise.all(p.map(v=>v.finished)).then(()=>{t===m&&s()},()=>{}),{animating:!0,top:i}},target:()=>t?.to??null,release:r,finish:()=>{s(),r()}}}function Fan(e){return{settingsMounted:e.open||e.shown||e.animating,workbenchHidden:e.open&&e.shown&&!e.animating}}const zan=()=>typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Han(e){return{category:"plugins",rowId:"plugins.enso",pluginId:e}}const FF=e=>typeof e=="string"&&e.length>0?e:null;function Uan(e){if(!e||typeof e!="object")return null;const t=e,n=FF(t.pluginId),r=FF(t.name);if(!n||!r)return null;if(t.kind==="inject-denied")return{type:"warning",titleKey:"{{name}} tried to message another session and was blocked",params:{name:r},actionKey:"Turn on",pluginId:n};const s=FF(t.version);return s?t.kind==="update-needs-approval"?{type:"warning",titleKey:"{{name}} {{version}} needs new permissions",params:{name:r,version:s},actionKey:"Review permissions",pluginId:n}:t.kind==="auto-updated"?{type:"success",titleKey:"{{name}} updated to {{version}}",params:{name:r,version:s},actionKey:"View",pluginId:n}:null:null}function Van(){const{t:e}=Se();return y.useEffect(()=>window.electronAPI.extensionPlugins.onNotice(t=>{const n=Uan(t);n&&Ht({type:n.type,title:e(n.titleKey,n.params),...n.actionKey?{actions:[{label:e(n.actionKey),onClick:()=>{nu(Han(n.pluginId))}}]}:{}})}),[e]),null}function Gan(e,t){const n=new Set,r=[];for(const s of e)for(const o of s.interceptBreakers??[]){const i=`${s.id}:${o.event}:${o.until}`;n.add(i),t.has(i)||r.push({pluginName:s.name,event:o.event})}t.clear();for(const s of n)t.add(s);return r}function Wan(e,t){let n=0;for(const r of t)e.length>r.length&&e.endsWith(r)&&r.length>n&&(n=r.length);return n}function Rcn(e,t){const n=(e.split("/").at(-1)??"").toLowerCase();return t.map(r=>({viewer:r,length:Wan(n,r.extensions)})).filter(r=>r.length>0).sort((r,s)=>s.length-r.length).map(r=>r.viewer)}const Mcn=e=>`${e.pluginId}:${e.id}`;let P_e=[];const LG=new Set;function zge(e){P_e=e;for(const t of LG)t()}function qan(e){return LG.add(e),()=>LG.delete(e)}const Hge=()=>P_e;function _cn(){return y.useSyncExternalStore(qan,Hge,Hge)}function Uge(e){const t=e.permissions.includes("composer.draft")?"1":"0";return`${e.id}\0${e.version}\0${e.build}\0${e.renderer??""}\0${t}`}function L_e(e,t){try{t?.dispose()}catch(n){console.warn(`[plugin] ${e} 渲染模块卸载失败`,n)}}async function Yan(e,t,n,r){if(!r())return;const s=new Map;for(const i of t)i.state==="enabled"&&i.renderer&&s.set(i.id,{...i,renderer:i.renderer});const o=[];for(const[i,l]of e){const c=s.get(i);(!c||Uge(c)!==l.key)&&o.push(i)}for(const i of o)L_e(i,e.get(i)),e.delete(i);await Promise.allSettled([...s.values()].filter(i=>!e.has(i.id)).map(async i=>{if(!r())return;let l;try{l=await n(i)}catch(d){if(!r())return;console.warn(`[plugin] ${i.id} 渲染模块加载失败`,d);return}if(!r()){l.dispose();return}const c=Uge(i),u=e.get(i.id);if(u?.key===c){l.dispose();return}u?.dispose(),e.set(i.id,{key:c,dispose:()=>l.dispose()})}))}const Kl=(e,t)=>({ok:!1,code:e,error:t});async function $an(e,t){if(e.op==="focusSession"){const i=e.payload.sessionId;if(typeof i!="string"||!i)return Kl("BAD_REQUEST","缺少会话 id");const l=t.conversation(i);if(l)return t.focus(l.parentId??i,i),{ok:!0,value:null};const c=i.indexOf("::");if(c>0){const u=i.slice(0,c);return t.conversation(u)?(t.focusSubagent(u,i),{ok:!0,value:null}):Kl("NOT_FOUND","会话不在本窗口")}return Kl("NOT_FOUND","会话不在本窗口")}if(e.op==="openChildRun"){const i=e.payload.parentId,l=e.payload.childId;return typeof i!="string"||!i?Kl("BAD_REQUEST","缺少父会话 id"):typeof l!="string"||!l?Kl("BAD_REQUEST","缺少子会话 id"):t.conversation(i)?(t.openChildRun(i,l),{ok:!0,value:null}):Kl("NOT_FOUND","会话不在本窗口")}if(e.op==="focusSubagent"){const i=e.payload.sessionId,l=e.payload.agentId;return typeof i!="string"||!t.conversation(i)?Kl("NOT_FOUND","会话不在本窗口"):typeof l!="string"||!l?Kl("BAD_REQUEST","缺少子代理 id"):(t.focusSubagent(i,l),{ok:!0,value:null})}if(e.op==="ensureSession"){const i=t.conversation(e.sessionId);if(!i)return Kl("NOT_FOUND","会话不在本窗口");if(i.parentId)return Kl("UNSUPPORTED","子会话随主会话恢复");const l=await t.ensure(e.sessionId);return l?Kl("SESSION_FAILED",l):{ok:!0,value:null}}if(e.op==="openPluginView"){if(!t.conversation(e.sessionId))return Kl("NOT_FOUND","会话不在本窗口");const{pluginId:i,viewId:l,title:c}=e.payload;return typeof i!="string"||!i||typeof l!="string"||!l||typeof c!="string"||!c?Kl("BAD_REQUEST","缺少视图标识"):(t.openPluginView?.(e.sessionId,{pluginId:i,viewId:l,title:c}),{ok:!0,value:null})}if(e.op==="closePluginView"){if(!t.conversation(e.sessionId))return Kl("NOT_FOUND","会话不在本窗口");const{pluginId:i,viewId:l}=e.payload;return typeof i!="string"||!i||typeof l!="string"||!l?Kl("BAD_REQUEST","缺少视图标识"):(t.closePluginView?.(e.sessionId,{pluginId:i,viewId:l}),{ok:!0,value:null})}const n=t.conversation(e.sessionId);if(!n)return Kl("NO_SESSION","发起调用的会话不在本窗口");const r=typeof e.payload.presetId=="string"?e.payload.presetId:void 0,s=await t.create(n.projectId,r);if(!s)return Kl("CREATE_FAILED","新建会话失败");const o=e.payload.text;return typeof o=="string"&&o&&t.prefill(s,o),{ok:!0,value:{sessionId:s}}}const Kan={conversation:e=>it.getState().conversations[e]??null,focus:(e,t)=>{const n=it.getState();n.selectConversation(e),t!==e&&n.selectTab(e,t)},focusSubagent:(e,t)=>it.getState().focusSubagent(e,t),openChildRun:(e,t)=>it.getState().openChildRun(e,t),create:(e,t)=>it.getState().newConversation(e,t?{presetId:t}:void 0),prefill:ywt,ensure:async e=>{const t=it.getState(),n=t.conversations[e];if(n?.started||n?.spawning)return null;await t.resumeConversation(e,{fresh:!0});const r=it.getState().conversations[e];return r?.started||r?.spawning?null:r?.error??"无法启动会话:请检查默认模型与登录状态"},openPluginView:(e,t)=>NEe({conversationId:e,...t}),closePluginView:(e,t)=>nwt({conversationId:e,...t})};function Xan(){return y.useEffect(()=>{const e=Swt(()=>yDt(it.getState()));let t=0;const n=new Map,r=new Set,s=()=>{const l=++t;window.electronAPI.extensionPlugins.list().then(async c=>{if(l!==t)return;for(const{pluginName:d,event:f}of Gan(c,r))Ht({type:"warning",title:`插件 ${d} 的检查连续失败,已临时放行`,description:`${f} 事件 30 秒内不再经过该插件;详情见设置里的插件日志`});const u=c.filter(d=>d.state==="enabled");fjt(Object.fromEntries(c.flatMap(d=>d.icon?[[d.id,d.icon]]:[]))),Jce(xje(c)),oue(m9t(c)),lte(u.flatMap(d=>d.views.map(f=>({pluginId:d.id,pluginName:d.name,...f})))),$1t(c),zge(u.flatMap(d=>(d.fileViewers??[]).map(f=>({pluginId:d.id,pluginName:d.name,...f})))),lue(u.flatMap(d=>d.triggers.filter(f=>f.symbol==="#").map(f=>({pluginId:d.id,name:f.name})))),await Yan(n,c,d=>Ewt(d.id,d.renderer,e,{draft:d.permissions.includes("composer.draft")}),()=>l===t)})};s();const o=window.electronAPI.extensionPlugins.onChanged(s),i=window.electronAPI.extensionPlugins.onDraftRequest(l=>{if(l.op==="focusSession"||l.op==="focusSubagent"||l.op==="openChildRun"||l.op==="createSession"||l.op==="ensureSession"||l.op==="openPluginView"||l.op==="closePluginView"){$an(l,Kan).catch(c=>({ok:!1,code:"SESSION_FAILED",error:c instanceof Error?c.message:String(c)})).then(c=>window.electronAPI.extensionPlugins.respondDraft({requestId:l.requestId,...c}));return}window.electronAPI.extensionPlugins.respondDraft({requestId:l.requestId,...jEe(l)})});return()=>{t+=1,o(),i(),Jce([]),lue([]),lte([]),zge([]),oue([]);for(const[l,c]of n)L_e(l,c);n.clear()}},[]),null}function Qan(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zF={exports:{}};const Zan={},Jan=Object.freeze(Object.defineProperty({__proto__:null,default:Zan},Symbol.toStringTag,{value:"Module"})),eln=DPe(Jan);var Vge;function tln(){return Vge||(Vge=1,(function(e){(function(t){var n=function(fe){var Ie,Ae=new Float64Array(16);if(fe)for(Ie=0;Ie<fe.length;Ie++)Ae[Ie]=fe[Ie];return Ae},r=function(){throw new Error("no PRNG")},s=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var i=n(),l=n([1]),c=n([56129,1]),u=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),h=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(fe,Ie,Ae,ce){fe[Ie]=Ae>>24&255,fe[Ie+1]=Ae>>16&255,fe[Ie+2]=Ae>>8&255,fe[Ie+3]=Ae&255,fe[Ie+4]=ce>>24&255,fe[Ie+5]=ce>>16&255,fe[Ie+6]=ce>>8&255,fe[Ie+7]=ce&255}function v(fe,Ie,Ae,ce,Oe){var dt,vt=0;for(dt=0;dt<Oe;dt++)vt|=fe[Ie+dt]^Ae[ce+dt];return(1&vt-1>>>8)-1}function b(fe,Ie,Ae,ce){return v(fe,Ie,Ae,ce,16)}function x(fe,Ie,Ae,ce){return v(fe,Ie,Ae,ce,32)}function S(fe,Ie,Ae,ce){for(var Oe=ce[0]&255|(ce[1]&255)<<8|(ce[2]&255)<<16|(ce[3]&255)<<24,dt=Ae[0]&255|(Ae[1]&255)<<8|(Ae[2]&255)<<16|(Ae[3]&255)<<24,vt=Ae[4]&255|(Ae[5]&255)<<8|(Ae[6]&255)<<16|(Ae[7]&255)<<24,Et=Ae[8]&255|(Ae[9]&255)<<8|(Ae[10]&255)<<16|(Ae[11]&255)<<24,Ct=Ae[12]&255|(Ae[13]&255)<<8|(Ae[14]&255)<<16|(Ae[15]&255)<<24,xn=ce[4]&255|(ce[5]&255)<<8|(ce[6]&255)<<16|(ce[7]&255)<<24,yn=Ie[0]&255|(Ie[1]&255)<<8|(Ie[2]&255)<<16|(Ie[3]&255)<<24,er=Ie[4]&255|(Ie[5]&255)<<8|(Ie[6]&255)<<16|(Ie[7]&255)<<24,ze=Ie[8]&255|(Ie[9]&255)<<8|(Ie[10]&255)<<16|(Ie[11]&255)<<24,We=Ie[12]&255|(Ie[13]&255)<<8|(Ie[14]&255)<<16|(Ie[15]&255)<<24,lt=ce[8]&255|(ce[9]&255)<<8|(ce[10]&255)<<16|(ce[11]&255)<<24,yt=Ae[16]&255|(Ae[17]&255)<<8|(Ae[18]&255)<<16|(Ae[19]&255)<<24,Bt=Ae[20]&255|(Ae[21]&255)<<8|(Ae[22]&255)<<16|(Ae[23]&255)<<24,Qt=Ae[24]&255|(Ae[25]&255)<<8|(Ae[26]&255)<<16|(Ae[27]&255)<<24,dn=Ae[28]&255|(Ae[29]&255)<<8|(Ae[30]&255)<<16|(Ae[31]&255)<<24,mn=ce[12]&255|(ce[13]&255)<<8|(ce[14]&255)<<16|(ce[15]&255)<<24,Zt=Oe,An=dt,bn=vt,Ln=Et,Un=Ct,gn=xn,Tt=yn,Lt=er,nn=ze,Ft=We,en=lt,Wt=yt,nt=Bt,Mn=Qt,Zn=dn,sr=mn,at,fr=0;fr<20;fr+=2)at=Zt+nt|0,Un^=at<<7|at>>>25,at=Un+Zt|0,nn^=at<<9|at>>>23,at=nn+Un|0,nt^=at<<13|at>>>19,at=nt+nn|0,Zt^=at<<18|at>>>14,at=gn+An|0,Ft^=at<<7|at>>>25,at=Ft+gn|0,Mn^=at<<9|at>>>23,at=Mn+Ft|0,An^=at<<13|at>>>19,at=An+Mn|0,gn^=at<<18|at>>>14,at=en+Tt|0,Zn^=at<<7|at>>>25,at=Zn+en|0,bn^=at<<9|at>>>23,at=bn+Zn|0,Tt^=at<<13|at>>>19,at=Tt+bn|0,en^=at<<18|at>>>14,at=sr+Wt|0,Ln^=at<<7|at>>>25,at=Ln+sr|0,Lt^=at<<9|at>>>23,at=Lt+Ln|0,Wt^=at<<13|at>>>19,at=Wt+Lt|0,sr^=at<<18|at>>>14,at=Zt+Ln|0,An^=at<<7|at>>>25,at=An+Zt|0,bn^=at<<9|at>>>23,at=bn+An|0,Ln^=at<<13|at>>>19,at=Ln+bn|0,Zt^=at<<18|at>>>14,at=gn+Un|0,Tt^=at<<7|at>>>25,at=Tt+gn|0,Lt^=at<<9|at>>>23,at=Lt+Tt|0,Un^=at<<13|at>>>19,at=Un+Lt|0,gn^=at<<18|at>>>14,at=en+Ft|0,Wt^=at<<7|at>>>25,at=Wt+en|0,nn^=at<<9|at>>>23,at=nn+Wt|0,Ft^=at<<13|at>>>19,at=Ft+nn|0,en^=at<<18|at>>>14,at=sr+Zn|0,nt^=at<<7|at>>>25,at=nt+sr|0,Mn^=at<<9|at>>>23,at=Mn+nt|0,Zn^=at<<13|at>>>19,at=Zn+Mn|0,sr^=at<<18|at>>>14;Zt=Zt+Oe|0,An=An+dt|0,bn=bn+vt|0,Ln=Ln+Et|0,Un=Un+Ct|0,gn=gn+xn|0,Tt=Tt+yn|0,Lt=Lt+er|0,nn=nn+ze|0,Ft=Ft+We|0,en=en+lt|0,Wt=Wt+yt|0,nt=nt+Bt|0,Mn=Mn+Qt|0,Zn=Zn+dn|0,sr=sr+mn|0,fe[0]=Zt>>>0&255,fe[1]=Zt>>>8&255,fe[2]=Zt>>>16&255,fe[3]=Zt>>>24&255,fe[4]=An>>>0&255,fe[5]=An>>>8&255,fe[6]=An>>>16&255,fe[7]=An>>>24&255,fe[8]=bn>>>0&255,fe[9]=bn>>>8&255,fe[10]=bn>>>16&255,fe[11]=bn>>>24&255,fe[12]=Ln>>>0&255,fe[13]=Ln>>>8&255,fe[14]=Ln>>>16&255,fe[15]=Ln>>>24&255,fe[16]=Un>>>0&255,fe[17]=Un>>>8&255,fe[18]=Un>>>16&255,fe[19]=Un>>>24&255,fe[20]=gn>>>0&255,fe[21]=gn>>>8&255,fe[22]=gn>>>16&255,fe[23]=gn>>>24&255,fe[24]=Tt>>>0&255,fe[25]=Tt>>>8&255,fe[26]=Tt>>>16&255,fe[27]=Tt>>>24&255,fe[28]=Lt>>>0&255,fe[29]=Lt>>>8&255,fe[30]=Lt>>>16&255,fe[31]=Lt>>>24&255,fe[32]=nn>>>0&255,fe[33]=nn>>>8&255,fe[34]=nn>>>16&255,fe[35]=nn>>>24&255,fe[36]=Ft>>>0&255,fe[37]=Ft>>>8&255,fe[38]=Ft>>>16&255,fe[39]=Ft>>>24&255,fe[40]=en>>>0&255,fe[41]=en>>>8&255,fe[42]=en>>>16&255,fe[43]=en>>>24&255,fe[44]=Wt>>>0&255,fe[45]=Wt>>>8&255,fe[46]=Wt>>>16&255,fe[47]=Wt>>>24&255,fe[48]=nt>>>0&255,fe[49]=nt>>>8&255,fe[50]=nt>>>16&255,fe[51]=nt>>>24&255,fe[52]=Mn>>>0&255,fe[53]=Mn>>>8&255,fe[54]=Mn>>>16&255,fe[55]=Mn>>>24&255,fe[56]=Zn>>>0&255,fe[57]=Zn>>>8&255,fe[58]=Zn>>>16&255,fe[59]=Zn>>>24&255,fe[60]=sr>>>0&255,fe[61]=sr>>>8&255,fe[62]=sr>>>16&255,fe[63]=sr>>>24&255}function k(fe,Ie,Ae,ce){for(var Oe=ce[0]&255|(ce[1]&255)<<8|(ce[2]&255)<<16|(ce[3]&255)<<24,dt=Ae[0]&255|(Ae[1]&255)<<8|(Ae[2]&255)<<16|(Ae[3]&255)<<24,vt=Ae[4]&255|(Ae[5]&255)<<8|(Ae[6]&255)<<16|(Ae[7]&255)<<24,Et=Ae[8]&255|(Ae[9]&255)<<8|(Ae[10]&255)<<16|(Ae[11]&255)<<24,Ct=Ae[12]&255|(Ae[13]&255)<<8|(Ae[14]&255)<<16|(Ae[15]&255)<<24,xn=ce[4]&255|(ce[5]&255)<<8|(ce[6]&255)<<16|(ce[7]&255)<<24,yn=Ie[0]&255|(Ie[1]&255)<<8|(Ie[2]&255)<<16|(Ie[3]&255)<<24,er=Ie[4]&255|(Ie[5]&255)<<8|(Ie[6]&255)<<16|(Ie[7]&255)<<24,ze=Ie[8]&255|(Ie[9]&255)<<8|(Ie[10]&255)<<16|(Ie[11]&255)<<24,We=Ie[12]&255|(Ie[13]&255)<<8|(Ie[14]&255)<<16|(Ie[15]&255)<<24,lt=ce[8]&255|(ce[9]&255)<<8|(ce[10]&255)<<16|(ce[11]&255)<<24,yt=Ae[16]&255|(Ae[17]&255)<<8|(Ae[18]&255)<<16|(Ae[19]&255)<<24,Bt=Ae[20]&255|(Ae[21]&255)<<8|(Ae[22]&255)<<16|(Ae[23]&255)<<24,Qt=Ae[24]&255|(Ae[25]&255)<<8|(Ae[26]&255)<<16|(Ae[27]&255)<<24,dn=Ae[28]&255|(Ae[29]&255)<<8|(Ae[30]&255)<<16|(Ae[31]&255)<<24,mn=ce[12]&255|(ce[13]&255)<<8|(ce[14]&255)<<16|(ce[15]&255)<<24,Zt=Oe,An=dt,bn=vt,Ln=Et,Un=Ct,gn=xn,Tt=yn,Lt=er,nn=ze,Ft=We,en=lt,Wt=yt,nt=Bt,Mn=Qt,Zn=dn,sr=mn,at,fr=0;fr<20;fr+=2)at=Zt+nt|0,Un^=at<<7|at>>>25,at=Un+Zt|0,nn^=at<<9|at>>>23,at=nn+Un|0,nt^=at<<13|at>>>19,at=nt+nn|0,Zt^=at<<18|at>>>14,at=gn+An|0,Ft^=at<<7|at>>>25,at=Ft+gn|0,Mn^=at<<9|at>>>23,at=Mn+Ft|0,An^=at<<13|at>>>19,at=An+Mn|0,gn^=at<<18|at>>>14,at=en+Tt|0,Zn^=at<<7|at>>>25,at=Zn+en|0,bn^=at<<9|at>>>23,at=bn+Zn|0,Tt^=at<<13|at>>>19,at=Tt+bn|0,en^=at<<18|at>>>14,at=sr+Wt|0,Ln^=at<<7|at>>>25,at=Ln+sr|0,Lt^=at<<9|at>>>23,at=Lt+Ln|0,Wt^=at<<13|at>>>19,at=Wt+Lt|0,sr^=at<<18|at>>>14,at=Zt+Ln|0,An^=at<<7|at>>>25,at=An+Zt|0,bn^=at<<9|at>>>23,at=bn+An|0,Ln^=at<<13|at>>>19,at=Ln+bn|0,Zt^=at<<18|at>>>14,at=gn+Un|0,Tt^=at<<7|at>>>25,at=Tt+gn|0,Lt^=at<<9|at>>>23,at=Lt+Tt|0,Un^=at<<13|at>>>19,at=Un+Lt|0,gn^=at<<18|at>>>14,at=en+Ft|0,Wt^=at<<7|at>>>25,at=Wt+en|0,nn^=at<<9|at>>>23,at=nn+Wt|0,Ft^=at<<13|at>>>19,at=Ft+nn|0,en^=at<<18|at>>>14,at=sr+Zn|0,nt^=at<<7|at>>>25,at=nt+sr|0,Mn^=at<<9|at>>>23,at=Mn+nt|0,Zn^=at<<13|at>>>19,at=Zn+Mn|0,sr^=at<<18|at>>>14;fe[0]=Zt>>>0&255,fe[1]=Zt>>>8&255,fe[2]=Zt>>>16&255,fe[3]=Zt>>>24&255,fe[4]=gn>>>0&255,fe[5]=gn>>>8&255,fe[6]=gn>>>16&255,fe[7]=gn>>>24&255,fe[8]=en>>>0&255,fe[9]=en>>>8&255,fe[10]=en>>>16&255,fe[11]=en>>>24&255,fe[12]=sr>>>0&255,fe[13]=sr>>>8&255,fe[14]=sr>>>16&255,fe[15]=sr>>>24&255,fe[16]=Tt>>>0&255,fe[17]=Tt>>>8&255,fe[18]=Tt>>>16&255,fe[19]=Tt>>>24&255,fe[20]=Lt>>>0&255,fe[21]=Lt>>>8&255,fe[22]=Lt>>>16&255,fe[23]=Lt>>>24&255,fe[24]=nn>>>0&255,fe[25]=nn>>>8&255,fe[26]=nn>>>16&255,fe[27]=nn>>>24&255,fe[28]=Ft>>>0&255,fe[29]=Ft>>>8&255,fe[30]=Ft>>>16&255,fe[31]=Ft>>>24&255}function C(fe,Ie,Ae,ce){S(fe,Ie,Ae,ce)}function A(fe,Ie,Ae,ce){k(fe,Ie,Ae,ce)}var N=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function j(fe,Ie,Ae,ce,Oe,dt,vt){var Et=new Uint8Array(16),Ct=new Uint8Array(64),xn,yn;for(yn=0;yn<16;yn++)Et[yn]=0;for(yn=0;yn<8;yn++)Et[yn]=dt[yn];for(;Oe>=64;){for(C(Ct,Et,vt,N),yn=0;yn<64;yn++)fe[Ie+yn]=Ae[ce+yn]^Ct[yn];for(xn=1,yn=8;yn<16;yn++)xn=xn+(Et[yn]&255)|0,Et[yn]=xn&255,xn>>>=8;Oe-=64,Ie+=64,ce+=64}if(Oe>0)for(C(Ct,Et,vt,N),yn=0;yn<Oe;yn++)fe[Ie+yn]=Ae[ce+yn]^Ct[yn];return 0}function I(fe,Ie,Ae,ce,Oe){var dt=new Uint8Array(16),vt=new Uint8Array(64),Et,Ct;for(Ct=0;Ct<16;Ct++)dt[Ct]=0;for(Ct=0;Ct<8;Ct++)dt[Ct]=ce[Ct];for(;Ae>=64;){for(C(vt,dt,Oe,N),Ct=0;Ct<64;Ct++)fe[Ie+Ct]=vt[Ct];for(Et=1,Ct=8;Ct<16;Ct++)Et=Et+(dt[Ct]&255)|0,dt[Ct]=Et&255,Et>>>=8;Ae-=64,Ie+=64}if(Ae>0)for(C(vt,dt,Oe,N),Ct=0;Ct<Ae;Ct++)fe[Ie+Ct]=vt[Ct];return 0}function _(fe,Ie,Ae,ce,Oe){var dt=new Uint8Array(32);A(dt,ce,Oe,N);for(var vt=new Uint8Array(8),Et=0;Et<8;Et++)vt[Et]=ce[Et+16];return I(fe,Ie,Ae,vt,dt)}function L(fe,Ie,Ae,ce,Oe,dt,vt){var Et=new Uint8Array(32);A(Et,dt,vt,N);for(var Ct=new Uint8Array(8),xn=0;xn<8;xn++)Ct[xn]=dt[xn+16];return j(fe,Ie,Ae,ce,Oe,Ct,Et)}var M=function(fe){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var Ie,Ae,ce,Oe,dt,vt,Et,Ct;Ie=fe[0]&255|(fe[1]&255)<<8,this.r[0]=Ie&8191,Ae=fe[2]&255|(fe[3]&255)<<8,this.r[1]=(Ie>>>13|Ae<<3)&8191,ce=fe[4]&255|(fe[5]&255)<<8,this.r[2]=(Ae>>>10|ce<<6)&7939,Oe=fe[6]&255|(fe[7]&255)<<8,this.r[3]=(ce>>>7|Oe<<9)&8191,dt=fe[8]&255|(fe[9]&255)<<8,this.r[4]=(Oe>>>4|dt<<12)&255,this.r[5]=dt>>>1&8190,vt=fe[10]&255|(fe[11]&255)<<8,this.r[6]=(dt>>>14|vt<<2)&8191,Et=fe[12]&255|(fe[13]&255)<<8,this.r[7]=(vt>>>11|Et<<5)&8065,Ct=fe[14]&255|(fe[15]&255)<<8,this.r[8]=(Et>>>8|Ct<<8)&8191,this.r[9]=Ct>>>5&127,this.pad[0]=fe[16]&255|(fe[17]&255)<<8,this.pad[1]=fe[18]&255|(fe[19]&255)<<8,this.pad[2]=fe[20]&255|(fe[21]&255)<<8,this.pad[3]=fe[22]&255|(fe[23]&255)<<8,this.pad[4]=fe[24]&255|(fe[25]&255)<<8,this.pad[5]=fe[26]&255|(fe[27]&255)<<8,this.pad[6]=fe[28]&255|(fe[29]&255)<<8,this.pad[7]=fe[30]&255|(fe[31]&255)<<8};M.prototype.blocks=function(fe,Ie,Ae){for(var ce=this.fin?0:2048,Oe,dt,vt,Et,Ct,xn,yn,er,ze,We,lt,yt,Bt,Qt,dn,mn,Zt,An,bn,Ln=this.h[0],Un=this.h[1],gn=this.h[2],Tt=this.h[3],Lt=this.h[4],nn=this.h[5],Ft=this.h[6],en=this.h[7],Wt=this.h[8],nt=this.h[9],Mn=this.r[0],Zn=this.r[1],sr=this.r[2],at=this.r[3],fr=this.r[4],hr=this.r[5],Xr=this.r[6],kr=this.r[7],Lr=this.r[8],pr=this.r[9];Ae>=16;)Oe=fe[Ie+0]&255|(fe[Ie+1]&255)<<8,Ln+=Oe&8191,dt=fe[Ie+2]&255|(fe[Ie+3]&255)<<8,Un+=(Oe>>>13|dt<<3)&8191,vt=fe[Ie+4]&255|(fe[Ie+5]&255)<<8,gn+=(dt>>>10|vt<<6)&8191,Et=fe[Ie+6]&255|(fe[Ie+7]&255)<<8,Tt+=(vt>>>7|Et<<9)&8191,Ct=fe[Ie+8]&255|(fe[Ie+9]&255)<<8,Lt+=(Et>>>4|Ct<<12)&8191,nn+=Ct>>>1&8191,xn=fe[Ie+10]&255|(fe[Ie+11]&255)<<8,Ft+=(Ct>>>14|xn<<2)&8191,yn=fe[Ie+12]&255|(fe[Ie+13]&255)<<8,en+=(xn>>>11|yn<<5)&8191,er=fe[Ie+14]&255|(fe[Ie+15]&255)<<8,Wt+=(yn>>>8|er<<8)&8191,nt+=er>>>5|ce,ze=0,We=ze,We+=Ln*Mn,We+=Un*(5*pr),We+=gn*(5*Lr),We+=Tt*(5*kr),We+=Lt*(5*Xr),ze=We>>>13,We&=8191,We+=nn*(5*hr),We+=Ft*(5*fr),We+=en*(5*at),We+=Wt*(5*sr),We+=nt*(5*Zn),ze+=We>>>13,We&=8191,lt=ze,lt+=Ln*Zn,lt+=Un*Mn,lt+=gn*(5*pr),lt+=Tt*(5*Lr),lt+=Lt*(5*kr),ze=lt>>>13,lt&=8191,lt+=nn*(5*Xr),lt+=Ft*(5*hr),lt+=en*(5*fr),lt+=Wt*(5*at),lt+=nt*(5*sr),ze+=lt>>>13,lt&=8191,yt=ze,yt+=Ln*sr,yt+=Un*Zn,yt+=gn*Mn,yt+=Tt*(5*pr),yt+=Lt*(5*Lr),ze=yt>>>13,yt&=8191,yt+=nn*(5*kr),yt+=Ft*(5*Xr),yt+=en*(5*hr),yt+=Wt*(5*fr),yt+=nt*(5*at),ze+=yt>>>13,yt&=8191,Bt=ze,Bt+=Ln*at,Bt+=Un*sr,Bt+=gn*Zn,Bt+=Tt*Mn,Bt+=Lt*(5*pr),ze=Bt>>>13,Bt&=8191,Bt+=nn*(5*Lr),Bt+=Ft*(5*kr),Bt+=en*(5*Xr),Bt+=Wt*(5*hr),Bt+=nt*(5*fr),ze+=Bt>>>13,Bt&=8191,Qt=ze,Qt+=Ln*fr,Qt+=Un*at,Qt+=gn*sr,Qt+=Tt*Zn,Qt+=Lt*Mn,ze=Qt>>>13,Qt&=8191,Qt+=nn*(5*pr),Qt+=Ft*(5*Lr),Qt+=en*(5*kr),Qt+=Wt*(5*Xr),Qt+=nt*(5*hr),ze+=Qt>>>13,Qt&=8191,dn=ze,dn+=Ln*hr,dn+=Un*fr,dn+=gn*at,dn+=Tt*sr,dn+=Lt*Zn,ze=dn>>>13,dn&=8191,dn+=nn*Mn,dn+=Ft*(5*pr),dn+=en*(5*Lr),dn+=Wt*(5*kr),dn+=nt*(5*Xr),ze+=dn>>>13,dn&=8191,mn=ze,mn+=Ln*Xr,mn+=Un*hr,mn+=gn*fr,mn+=Tt*at,mn+=Lt*sr,ze=mn>>>13,mn&=8191,mn+=nn*Zn,mn+=Ft*Mn,mn+=en*(5*pr),mn+=Wt*(5*Lr),mn+=nt*(5*kr),ze+=mn>>>13,mn&=8191,Zt=ze,Zt+=Ln*kr,Zt+=Un*Xr,Zt+=gn*hr,Zt+=Tt*fr,Zt+=Lt*at,ze=Zt>>>13,Zt&=8191,Zt+=nn*sr,Zt+=Ft*Zn,Zt+=en*Mn,Zt+=Wt*(5*pr),Zt+=nt*(5*Lr),ze+=Zt>>>13,Zt&=8191,An=ze,An+=Ln*Lr,An+=Un*kr,An+=gn*Xr,An+=Tt*hr,An+=Lt*fr,ze=An>>>13,An&=8191,An+=nn*at,An+=Ft*sr,An+=en*Zn,An+=Wt*Mn,An+=nt*(5*pr),ze+=An>>>13,An&=8191,bn=ze,bn+=Ln*pr,bn+=Un*Lr,bn+=gn*kr,bn+=Tt*Xr,bn+=Lt*hr,ze=bn>>>13,bn&=8191,bn+=nn*fr,bn+=Ft*at,bn+=en*sr,bn+=Wt*Zn,bn+=nt*Mn,ze+=bn>>>13,bn&=8191,ze=(ze<<2)+ze|0,ze=ze+We|0,We=ze&8191,ze=ze>>>13,lt+=ze,Ln=We,Un=lt,gn=yt,Tt=Bt,Lt=Qt,nn=dn,Ft=mn,en=Zt,Wt=An,nt=bn,Ie+=16,Ae-=16;this.h[0]=Ln,this.h[1]=Un,this.h[2]=gn,this.h[3]=Tt,this.h[4]=Lt,this.h[5]=nn,this.h[6]=Ft,this.h[7]=en,this.h[8]=Wt,this.h[9]=nt},M.prototype.finish=function(fe,Ie){var Ae=new Uint16Array(10),ce,Oe,dt,vt;if(this.leftover){for(vt=this.leftover,this.buffer[vt++]=1;vt<16;vt++)this.buffer[vt]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(ce=this.h[1]>>>13,this.h[1]&=8191,vt=2;vt<10;vt++)this.h[vt]+=ce,ce=this.h[vt]>>>13,this.h[vt]&=8191;for(this.h[0]+=ce*5,ce=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=ce,ce=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=ce,Ae[0]=this.h[0]+5,ce=Ae[0]>>>13,Ae[0]&=8191,vt=1;vt<10;vt++)Ae[vt]=this.h[vt]+ce,ce=Ae[vt]>>>13,Ae[vt]&=8191;for(Ae[9]-=8192,Oe=(ce^1)-1,vt=0;vt<10;vt++)Ae[vt]&=Oe;for(Oe=~Oe,vt=0;vt<10;vt++)this.h[vt]=this.h[vt]&Oe|Ae[vt];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,dt=this.h[0]+this.pad[0],this.h[0]=dt&65535,vt=1;vt<8;vt++)dt=(this.h[vt]+this.pad[vt]|0)+(dt>>>16)|0,this.h[vt]=dt&65535;fe[Ie+0]=this.h[0]>>>0&255,fe[Ie+1]=this.h[0]>>>8&255,fe[Ie+2]=this.h[1]>>>0&255,fe[Ie+3]=this.h[1]>>>8&255,fe[Ie+4]=this.h[2]>>>0&255,fe[Ie+5]=this.h[2]>>>8&255,fe[Ie+6]=this.h[3]>>>0&255,fe[Ie+7]=this.h[3]>>>8&255,fe[Ie+8]=this.h[4]>>>0&255,fe[Ie+9]=this.h[4]>>>8&255,fe[Ie+10]=this.h[5]>>>0&255,fe[Ie+11]=this.h[5]>>>8&255,fe[Ie+12]=this.h[6]>>>0&255,fe[Ie+13]=this.h[6]>>>8&255,fe[Ie+14]=this.h[7]>>>0&255,fe[Ie+15]=this.h[7]>>>8&255},M.prototype.update=function(fe,Ie,Ae){var ce,Oe;if(this.leftover){for(Oe=16-this.leftover,Oe>Ae&&(Oe=Ae),ce=0;ce<Oe;ce++)this.buffer[this.leftover+ce]=fe[Ie+ce];if(Ae-=Oe,Ie+=Oe,this.leftover+=Oe,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(Ae>=16&&(Oe=Ae-Ae%16,this.blocks(fe,Ie,Oe),Ie+=Oe,Ae-=Oe),Ae){for(ce=0;ce<Ae;ce++)this.buffer[this.leftover+ce]=fe[Ie+ce];this.leftover+=Ae}};function F(fe,Ie,Ae,ce,Oe,dt){var vt=new M(dt);return vt.update(Ae,ce,Oe),vt.finish(fe,Ie),0}function D(fe,Ie,Ae,ce,Oe,dt){var vt=new Uint8Array(16);return F(vt,0,Ae,ce,Oe,dt),b(fe,Ie,vt,0)}function R(fe,Ie,Ae,ce,Oe){var dt;if(Ae<32)return-1;for(L(fe,0,Ie,0,Ae,ce,Oe),F(fe,16,fe,32,Ae-32,fe),dt=0;dt<16;dt++)fe[dt]=0;return 0}function z(fe,Ie,Ae,ce,Oe){var dt,vt=new Uint8Array(32);if(Ae<32||(_(vt,0,32,ce,Oe),D(Ie,16,Ie,32,Ae-32,vt)!==0))return-1;for(L(fe,0,Ie,0,Ae,ce,Oe),dt=0;dt<32;dt++)fe[dt]=0;return 0}function B(fe,Ie){var Ae;for(Ae=0;Ae<16;Ae++)fe[Ae]=Ie[Ae]|0}function H(fe){var Ie,Ae,ce=1;for(Ie=0;Ie<16;Ie++)Ae=fe[Ie]+ce+65535,ce=Math.floor(Ae/65536),fe[Ie]=Ae-ce*65536;fe[0]+=ce-1+37*(ce-1)}function G(fe,Ie,Ae){for(var ce,Oe=~(Ae-1),dt=0;dt<16;dt++)ce=Oe&(fe[dt]^Ie[dt]),fe[dt]^=ce,Ie[dt]^=ce}function te(fe,Ie){var Ae,ce,Oe,dt=n(),vt=n();for(Ae=0;Ae<16;Ae++)vt[Ae]=Ie[Ae];for(H(vt),H(vt),H(vt),ce=0;ce<2;ce++){for(dt[0]=vt[0]-65517,Ae=1;Ae<15;Ae++)dt[Ae]=vt[Ae]-65535-(dt[Ae-1]>>16&1),dt[Ae-1]&=65535;dt[15]=vt[15]-32767-(dt[14]>>16&1),Oe=dt[15]>>16&1,dt[14]&=65535,G(vt,dt,1-Oe)}for(Ae=0;Ae<16;Ae++)fe[2*Ae]=vt[Ae]&255,fe[2*Ae+1]=vt[Ae]>>8}function W(fe,Ie){var Ae=new Uint8Array(32),ce=new Uint8Array(32);return te(Ae,fe),te(ce,Ie),x(Ae,0,ce,0)}function T(fe){var Ie=new Uint8Array(32);return te(Ie,fe),Ie[0]&1}function U(fe,Ie){var Ae;for(Ae=0;Ae<16;Ae++)fe[Ae]=Ie[2*Ae]+(Ie[2*Ae+1]<<8);fe[15]&=32767}function P(fe,Ie,Ae){for(var ce=0;ce<16;ce++)fe[ce]=Ie[ce]+Ae[ce]}function K(fe,Ie,Ae){for(var ce=0;ce<16;ce++)fe[ce]=Ie[ce]-Ae[ce]}function J(fe,Ie,Ae){var ce,Oe,dt=0,vt=0,Et=0,Ct=0,xn=0,yn=0,er=0,ze=0,We=0,lt=0,yt=0,Bt=0,Qt=0,dn=0,mn=0,Zt=0,An=0,bn=0,Ln=0,Un=0,gn=0,Tt=0,Lt=0,nn=0,Ft=0,en=0,Wt=0,nt=0,Mn=0,Zn=0,sr=0,at=Ae[0],fr=Ae[1],hr=Ae[2],Xr=Ae[3],kr=Ae[4],Lr=Ae[5],pr=Ae[6],bs=Ae[7],ss=Ae[8],Cs=Ae[9],ms=Ae[10],Es=Ae[11],eo=Ae[12],Vs=Ae[13],ao=Ae[14],Er=Ae[15];ce=Ie[0],dt+=ce*at,vt+=ce*fr,Et+=ce*hr,Ct+=ce*Xr,xn+=ce*kr,yn+=ce*Lr,er+=ce*pr,ze+=ce*bs,We+=ce*ss,lt+=ce*Cs,yt+=ce*ms,Bt+=ce*Es,Qt+=ce*eo,dn+=ce*Vs,mn+=ce*ao,Zt+=ce*Er,ce=Ie[1],vt+=ce*at,Et+=ce*fr,Ct+=ce*hr,xn+=ce*Xr,yn+=ce*kr,er+=ce*Lr,ze+=ce*pr,We+=ce*bs,lt+=ce*ss,yt+=ce*Cs,Bt+=ce*ms,Qt+=ce*Es,dn+=ce*eo,mn+=ce*Vs,Zt+=ce*ao,An+=ce*Er,ce=Ie[2],Et+=ce*at,Ct+=ce*fr,xn+=ce*hr,yn+=ce*Xr,er+=ce*kr,ze+=ce*Lr,We+=ce*pr,lt+=ce*bs,yt+=ce*ss,Bt+=ce*Cs,Qt+=ce*ms,dn+=ce*Es,mn+=ce*eo,Zt+=ce*Vs,An+=ce*ao,bn+=ce*Er,ce=Ie[3],Ct+=ce*at,xn+=ce*fr,yn+=ce*hr,er+=ce*Xr,ze+=ce*kr,We+=ce*Lr,lt+=ce*pr,yt+=ce*bs,Bt+=ce*ss,Qt+=ce*Cs,dn+=ce*ms,mn+=ce*Es,Zt+=ce*eo,An+=ce*Vs,bn+=ce*ao,Ln+=ce*Er,ce=Ie[4],xn+=ce*at,yn+=ce*fr,er+=ce*hr,ze+=ce*Xr,We+=ce*kr,lt+=ce*Lr,yt+=ce*pr,Bt+=ce*bs,Qt+=ce*ss,dn+=ce*Cs,mn+=ce*ms,Zt+=ce*Es,An+=ce*eo,bn+=ce*Vs,Ln+=ce*ao,Un+=ce*Er,ce=Ie[5],yn+=ce*at,er+=ce*fr,ze+=ce*hr,We+=ce*Xr,lt+=ce*kr,yt+=ce*Lr,Bt+=ce*pr,Qt+=ce*bs,dn+=ce*ss,mn+=ce*Cs,Zt+=ce*ms,An+=ce*Es,bn+=ce*eo,Ln+=ce*Vs,Un+=ce*ao,gn+=ce*Er,ce=Ie[6],er+=ce*at,ze+=ce*fr,We+=ce*hr,lt+=ce*Xr,yt+=ce*kr,Bt+=ce*Lr,Qt+=ce*pr,dn+=ce*bs,mn+=ce*ss,Zt+=ce*Cs,An+=ce*ms,bn+=ce*Es,Ln+=ce*eo,Un+=ce*Vs,gn+=ce*ao,Tt+=ce*Er,ce=Ie[7],ze+=ce*at,We+=ce*fr,lt+=ce*hr,yt+=ce*Xr,Bt+=ce*kr,Qt+=ce*Lr,dn+=ce*pr,mn+=ce*bs,Zt+=ce*ss,An+=ce*Cs,bn+=ce*ms,Ln+=ce*Es,Un+=ce*eo,gn+=ce*Vs,Tt+=ce*ao,Lt+=ce*Er,ce=Ie[8],We+=ce*at,lt+=ce*fr,yt+=ce*hr,Bt+=ce*Xr,Qt+=ce*kr,dn+=ce*Lr,mn+=ce*pr,Zt+=ce*bs,An+=ce*ss,bn+=ce*Cs,Ln+=ce*ms,Un+=ce*Es,gn+=ce*eo,Tt+=ce*Vs,Lt+=ce*ao,nn+=ce*Er,ce=Ie[9],lt+=ce*at,yt+=ce*fr,Bt+=ce*hr,Qt+=ce*Xr,dn+=ce*kr,mn+=ce*Lr,Zt+=ce*pr,An+=ce*bs,bn+=ce*ss,Ln+=ce*Cs,Un+=ce*ms,gn+=ce*Es,Tt+=ce*eo,Lt+=ce*Vs,nn+=ce*ao,Ft+=ce*Er,ce=Ie[10],yt+=ce*at,Bt+=ce*fr,Qt+=ce*hr,dn+=ce*Xr,mn+=ce*kr,Zt+=ce*Lr,An+=ce*pr,bn+=ce*bs,Ln+=ce*ss,Un+=ce*Cs,gn+=ce*ms,Tt+=ce*Es,Lt+=ce*eo,nn+=ce*Vs,Ft+=ce*ao,en+=ce*Er,ce=Ie[11],Bt+=ce*at,Qt+=ce*fr,dn+=ce*hr,mn+=ce*Xr,Zt+=ce*kr,An+=ce*Lr,bn+=ce*pr,Ln+=ce*bs,Un+=ce*ss,gn+=ce*Cs,Tt+=ce*ms,Lt+=ce*Es,nn+=ce*eo,Ft+=ce*Vs,en+=ce*ao,Wt+=ce*Er,ce=Ie[12],Qt+=ce*at,dn+=ce*fr,mn+=ce*hr,Zt+=ce*Xr,An+=ce*kr,bn+=ce*Lr,Ln+=ce*pr,Un+=ce*bs,gn+=ce*ss,Tt+=ce*Cs,Lt+=ce*ms,nn+=ce*Es,Ft+=ce*eo,en+=ce*Vs,Wt+=ce*ao,nt+=ce*Er,ce=Ie[13],dn+=ce*at,mn+=ce*fr,Zt+=ce*hr,An+=ce*Xr,bn+=ce*kr,Ln+=ce*Lr,Un+=ce*pr,gn+=ce*bs,Tt+=ce*ss,Lt+=ce*Cs,nn+=ce*ms,Ft+=ce*Es,en+=ce*eo,Wt+=ce*Vs,nt+=ce*ao,Mn+=ce*Er,ce=Ie[14],mn+=ce*at,Zt+=ce*fr,An+=ce*hr,bn+=ce*Xr,Ln+=ce*kr,Un+=ce*Lr,gn+=ce*pr,Tt+=ce*bs,Lt+=ce*ss,nn+=ce*Cs,Ft+=ce*ms,en+=ce*Es,Wt+=ce*eo,nt+=ce*Vs,Mn+=ce*ao,Zn+=ce*Er,ce=Ie[15],Zt+=ce*at,An+=ce*fr,bn+=ce*hr,Ln+=ce*Xr,Un+=ce*kr,gn+=ce*Lr,Tt+=ce*pr,Lt+=ce*bs,nn+=ce*ss,Ft+=ce*Cs,en+=ce*ms,Wt+=ce*Es,nt+=ce*eo,Mn+=ce*Vs,Zn+=ce*ao,sr+=ce*Er,dt+=38*An,vt+=38*bn,Et+=38*Ln,Ct+=38*Un,xn+=38*gn,yn+=38*Tt,er+=38*Lt,ze+=38*nn,We+=38*Ft,lt+=38*en,yt+=38*Wt,Bt+=38*nt,Qt+=38*Mn,dn+=38*Zn,mn+=38*sr,Oe=1,ce=dt+Oe+65535,Oe=Math.floor(ce/65536),dt=ce-Oe*65536,ce=vt+Oe+65535,Oe=Math.floor(ce/65536),vt=ce-Oe*65536,ce=Et+Oe+65535,Oe=Math.floor(ce/65536),Et=ce-Oe*65536,ce=Ct+Oe+65535,Oe=Math.floor(ce/65536),Ct=ce-Oe*65536,ce=xn+Oe+65535,Oe=Math.floor(ce/65536),xn=ce-Oe*65536,ce=yn+Oe+65535,Oe=Math.floor(ce/65536),yn=ce-Oe*65536,ce=er+Oe+65535,Oe=Math.floor(ce/65536),er=ce-Oe*65536,ce=ze+Oe+65535,Oe=Math.floor(ce/65536),ze=ce-Oe*65536,ce=We+Oe+65535,Oe=Math.floor(ce/65536),We=ce-Oe*65536,ce=lt+Oe+65535,Oe=Math.floor(ce/65536),lt=ce-Oe*65536,ce=yt+Oe+65535,Oe=Math.floor(ce/65536),yt=ce-Oe*65536,ce=Bt+Oe+65535,Oe=Math.floor(ce/65536),Bt=ce-Oe*65536,ce=Qt+Oe+65535,Oe=Math.floor(ce/65536),Qt=ce-Oe*65536,ce=dn+Oe+65535,Oe=Math.floor(ce/65536),dn=ce-Oe*65536,ce=mn+Oe+65535,Oe=Math.floor(ce/65536),mn=ce-Oe*65536,ce=Zt+Oe+65535,Oe=Math.floor(ce/65536),Zt=ce-Oe*65536,dt+=Oe-1+37*(Oe-1),Oe=1,ce=dt+Oe+65535,Oe=Math.floor(ce/65536),dt=ce-Oe*65536,ce=vt+Oe+65535,Oe=Math.floor(ce/65536),vt=ce-Oe*65536,ce=Et+Oe+65535,Oe=Math.floor(ce/65536),Et=ce-Oe*65536,ce=Ct+Oe+65535,Oe=Math.floor(ce/65536),Ct=ce-Oe*65536,ce=xn+Oe+65535,Oe=Math.floor(ce/65536),xn=ce-Oe*65536,ce=yn+Oe+65535,Oe=Math.floor(ce/65536),yn=ce-Oe*65536,ce=er+Oe+65535,Oe=Math.floor(ce/65536),er=ce-Oe*65536,ce=ze+Oe+65535,Oe=Math.floor(ce/65536),ze=ce-Oe*65536,ce=We+Oe+65535,Oe=Math.floor(ce/65536),We=ce-Oe*65536,ce=lt+Oe+65535,Oe=Math.floor(ce/65536),lt=ce-Oe*65536,ce=yt+Oe+65535,Oe=Math.floor(ce/65536),yt=ce-Oe*65536,ce=Bt+Oe+65535,Oe=Math.floor(ce/65536),Bt=ce-Oe*65536,ce=Qt+Oe+65535,Oe=Math.floor(ce/65536),Qt=ce-Oe*65536,ce=dn+Oe+65535,Oe=Math.floor(ce/65536),dn=ce-Oe*65536,ce=mn+Oe+65535,Oe=Math.floor(ce/65536),mn=ce-Oe*65536,ce=Zt+Oe+65535,Oe=Math.floor(ce/65536),Zt=ce-Oe*65536,dt+=Oe-1+37*(Oe-1),fe[0]=dt,fe[1]=vt,fe[2]=Et,fe[3]=Ct,fe[4]=xn,fe[5]=yn,fe[6]=er,fe[7]=ze,fe[8]=We,fe[9]=lt,fe[10]=yt,fe[11]=Bt,fe[12]=Qt,fe[13]=dn,fe[14]=mn,fe[15]=Zt}function ee(fe,Ie){J(fe,Ie,Ie)}function X(fe,Ie){var Ae=n(),ce;for(ce=0;ce<16;ce++)Ae[ce]=Ie[ce];for(ce=253;ce>=0;ce--)ee(Ae,Ae),ce!==2&&ce!==4&&J(Ae,Ae,Ie);for(ce=0;ce<16;ce++)fe[ce]=Ae[ce]}function ne(fe,Ie){var Ae=n(),ce;for(ce=0;ce<16;ce++)Ae[ce]=Ie[ce];for(ce=250;ce>=0;ce--)ee(Ae,Ae),ce!==1&&J(Ae,Ae,Ie);for(ce=0;ce<16;ce++)fe[ce]=Ae[ce]}function Q(fe,Ie,Ae){var ce=new Uint8Array(32),Oe=new Float64Array(80),dt,vt,Et=n(),Ct=n(),xn=n(),yn=n(),er=n(),ze=n();for(vt=0;vt<31;vt++)ce[vt]=Ie[vt];for(ce[31]=Ie[31]&127|64,ce[0]&=248,U(Oe,Ae),vt=0;vt<16;vt++)Ct[vt]=Oe[vt],yn[vt]=Et[vt]=xn[vt]=0;for(Et[0]=yn[0]=1,vt=254;vt>=0;--vt)dt=ce[vt>>>3]>>>(vt&7)&1,G(Et,Ct,dt),G(xn,yn,dt),P(er,Et,xn),K(Et,Et,xn),P(xn,Ct,yn),K(Ct,Ct,yn),ee(yn,er),ee(ze,Et),J(Et,xn,Et),J(xn,Ct,er),P(er,Et,xn),K(Et,Et,xn),ee(Ct,Et),K(xn,yn,ze),J(Et,xn,c),P(Et,Et,yn),J(xn,xn,Et),J(Et,yn,ze),J(yn,Ct,Oe),ee(Ct,er),G(Et,Ct,dt),G(xn,yn,dt);for(vt=0;vt<16;vt++)Oe[vt+16]=Et[vt],Oe[vt+32]=xn[vt],Oe[vt+48]=Ct[vt],Oe[vt+64]=yn[vt];var We=Oe.subarray(32),lt=Oe.subarray(16);return X(We,We),J(lt,lt,We),te(fe,lt),0}function oe(fe,Ie){return Q(fe,Ie,o)}function de(fe,Ie){return r(Ie,32),oe(fe,Ie)}function ie(fe,Ie,Ae){var ce=new Uint8Array(32);return Q(ce,Ae,Ie),A(fe,s,ce,N)}var ue=R,ve=z;function ge(fe,Ie,Ae,ce,Oe,dt){var vt=new Uint8Array(32);return ie(vt,Oe,dt),ue(fe,Ie,Ae,ce,vt)}function Te(fe,Ie,Ae,ce,Oe,dt){var vt=new Uint8Array(32);return ie(vt,Oe,dt),ve(fe,Ie,Ae,ce,vt)}var De=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Me(fe,Ie,Ae,ce){for(var Oe=new Int32Array(16),dt=new Int32Array(16),vt,Et,Ct,xn,yn,er,ze,We,lt,yt,Bt,Qt,dn,mn,Zt,An,bn,Ln,Un,gn,Tt,Lt,nn,Ft,en,Wt,nt=fe[0],Mn=fe[1],Zn=fe[2],sr=fe[3],at=fe[4],fr=fe[5],hr=fe[6],Xr=fe[7],kr=Ie[0],Lr=Ie[1],pr=Ie[2],bs=Ie[3],ss=Ie[4],Cs=Ie[5],ms=Ie[6],Es=Ie[7],eo=0;ce>=128;){for(Un=0;Un<16;Un++)gn=8*Un+eo,Oe[Un]=Ae[gn+0]<<24|Ae[gn+1]<<16|Ae[gn+2]<<8|Ae[gn+3],dt[Un]=Ae[gn+4]<<24|Ae[gn+5]<<16|Ae[gn+6]<<8|Ae[gn+7];for(Un=0;Un<80;Un++)if(vt=nt,Et=Mn,Ct=Zn,xn=sr,yn=at,er=fr,ze=hr,We=Xr,lt=kr,yt=Lr,Bt=pr,Qt=bs,dn=ss,mn=Cs,Zt=ms,An=Es,Tt=Xr,Lt=Es,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=(at>>>14|ss<<18)^(at>>>18|ss<<14)^(ss>>>9|at<<23),Lt=(ss>>>14|at<<18)^(ss>>>18|at<<14)^(at>>>9|ss<<23),nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Tt=at&fr^~at&hr,Lt=ss&Cs^~ss&ms,nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Tt=De[Un*2],Lt=De[Un*2+1],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Tt=Oe[Un%16],Lt=dt[Un%16],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,bn=en&65535|Wt<<16,Ln=nn&65535|Ft<<16,Tt=bn,Lt=Ln,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=(nt>>>28|kr<<4)^(kr>>>2|nt<<30)^(kr>>>7|nt<<25),Lt=(kr>>>28|nt<<4)^(nt>>>2|kr<<30)^(nt>>>7|kr<<25),nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Tt=nt&Mn^nt&Zn^Mn&Zn,Lt=kr&Lr^kr&pr^Lr&pr,nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,We=en&65535|Wt<<16,An=nn&65535|Ft<<16,Tt=xn,Lt=Qt,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=bn,Lt=Ln,nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,xn=en&65535|Wt<<16,Qt=nn&65535|Ft<<16,Mn=vt,Zn=Et,sr=Ct,at=xn,fr=yn,hr=er,Xr=ze,nt=We,Lr=lt,pr=yt,bs=Bt,ss=Qt,Cs=dn,ms=mn,Es=Zt,kr=An,Un%16===15)for(gn=0;gn<16;gn++)Tt=Oe[gn],Lt=dt[gn],nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=Oe[(gn+9)%16],Lt=dt[(gn+9)%16],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,bn=Oe[(gn+1)%16],Ln=dt[(gn+1)%16],Tt=(bn>>>1|Ln<<31)^(bn>>>8|Ln<<24)^bn>>>7,Lt=(Ln>>>1|bn<<31)^(Ln>>>8|bn<<24)^(Ln>>>7|bn<<25),nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,bn=Oe[(gn+14)%16],Ln=dt[(gn+14)%16],Tt=(bn>>>19|Ln<<13)^(Ln>>>29|bn<<3)^bn>>>6,Lt=(Ln>>>19|bn<<13)^(bn>>>29|Ln<<3)^(Ln>>>6|bn<<26),nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,Oe[gn]=en&65535|Wt<<16,dt[gn]=nn&65535|Ft<<16;Tt=nt,Lt=kr,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[0],Lt=Ie[0],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[0]=nt=en&65535|Wt<<16,Ie[0]=kr=nn&65535|Ft<<16,Tt=Mn,Lt=Lr,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[1],Lt=Ie[1],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[1]=Mn=en&65535|Wt<<16,Ie[1]=Lr=nn&65535|Ft<<16,Tt=Zn,Lt=pr,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[2],Lt=Ie[2],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[2]=Zn=en&65535|Wt<<16,Ie[2]=pr=nn&65535|Ft<<16,Tt=sr,Lt=bs,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[3],Lt=Ie[3],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[3]=sr=en&65535|Wt<<16,Ie[3]=bs=nn&65535|Ft<<16,Tt=at,Lt=ss,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[4],Lt=Ie[4],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[4]=at=en&65535|Wt<<16,Ie[4]=ss=nn&65535|Ft<<16,Tt=fr,Lt=Cs,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[5],Lt=Ie[5],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[5]=fr=en&65535|Wt<<16,Ie[5]=Cs=nn&65535|Ft<<16,Tt=hr,Lt=ms,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[6],Lt=Ie[6],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[6]=hr=en&65535|Wt<<16,Ie[6]=ms=nn&65535|Ft<<16,Tt=Xr,Lt=Es,nn=Lt&65535,Ft=Lt>>>16,en=Tt&65535,Wt=Tt>>>16,Tt=fe[7],Lt=Ie[7],nn+=Lt&65535,Ft+=Lt>>>16,en+=Tt&65535,Wt+=Tt>>>16,Ft+=nn>>>16,en+=Ft>>>16,Wt+=en>>>16,fe[7]=Xr=en&65535|Wt<<16,Ie[7]=Es=nn&65535|Ft<<16,eo+=128,ce-=128}return ce}function Fe(fe,Ie,Ae){var ce=new Int32Array(8),Oe=new Int32Array(8),dt=new Uint8Array(256),vt,Et=Ae;for(ce[0]=1779033703,ce[1]=3144134277,ce[2]=1013904242,ce[3]=2773480762,ce[4]=1359893119,ce[5]=2600822924,ce[6]=528734635,ce[7]=1541459225,Oe[0]=4089235720,Oe[1]=2227873595,Oe[2]=4271175723,Oe[3]=1595750129,Oe[4]=2917565137,Oe[5]=725511199,Oe[6]=4215389547,Oe[7]=327033209,Me(ce,Oe,Ie,Ae),Ae%=128,vt=0;vt<Ae;vt++)dt[vt]=Ie[Et-Ae+vt];for(dt[Ae]=128,Ae=256-128*(Ae<112?1:0),dt[Ae-9]=0,m(dt,Ae-8,Et/536870912|0,Et<<3),Me(ce,Oe,dt,Ae),vt=0;vt<8;vt++)m(fe,8*vt,ce[vt],Oe[vt]);return 0}function He(fe,Ie){var Ae=n(),ce=n(),Oe=n(),dt=n(),vt=n(),Et=n(),Ct=n(),xn=n(),yn=n();K(Ae,fe[1],fe[0]),K(yn,Ie[1],Ie[0]),J(Ae,Ae,yn),P(ce,fe[0],fe[1]),P(yn,Ie[0],Ie[1]),J(ce,ce,yn),J(Oe,fe[3],Ie[3]),J(Oe,Oe,d),J(dt,fe[2],Ie[2]),P(dt,dt,dt),K(vt,ce,Ae),K(Et,dt,Oe),P(Ct,dt,Oe),P(xn,ce,Ae),J(fe[0],vt,Et),J(fe[1],xn,Ct),J(fe[2],Ct,Et),J(fe[3],vt,xn)}function tt(fe,Ie,Ae){var ce;for(ce=0;ce<4;ce++)G(fe[ce],Ie[ce],Ae)}function $e(fe,Ie){var Ae=n(),ce=n(),Oe=n();X(Oe,Ie[2]),J(Ae,Ie[0],Oe),J(ce,Ie[1],Oe),te(fe,ce),fe[31]^=T(Ae)<<7}function Ue(fe,Ie,Ae){var ce,Oe;for(B(fe[0],i),B(fe[1],l),B(fe[2],l),B(fe[3],i),Oe=255;Oe>=0;--Oe)ce=Ae[Oe/8|0]>>(Oe&7)&1,tt(fe,Ie,ce),He(Ie,fe),He(fe,fe),tt(fe,Ie,ce)}function Pe(fe,Ie){var Ae=[n(),n(),n(),n()];B(Ae[0],f),B(Ae[1],h),B(Ae[2],l),J(Ae[3],f,h),Ue(fe,Ae,Ie)}function we(fe,Ie,Ae){var ce=new Uint8Array(64),Oe=[n(),n(),n(),n()],dt;for(Ae||r(Ie,32),Fe(ce,Ie,32),ce[0]&=248,ce[31]&=127,ce[31]|=64,Pe(Oe,ce),$e(fe,Oe),dt=0;dt<32;dt++)Ie[dt+32]=fe[dt];return 0}var ye=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Re(fe,Ie){var Ae,ce,Oe,dt;for(ce=63;ce>=32;--ce){for(Ae=0,Oe=ce-32,dt=ce-12;Oe<dt;++Oe)Ie[Oe]+=Ae-16*Ie[ce]*ye[Oe-(ce-32)],Ae=Math.floor((Ie[Oe]+128)/256),Ie[Oe]-=Ae*256;Ie[Oe]+=Ae,Ie[ce]=0}for(Ae=0,Oe=0;Oe<32;Oe++)Ie[Oe]+=Ae-(Ie[31]>>4)*ye[Oe],Ae=Ie[Oe]>>8,Ie[Oe]&=255;for(Oe=0;Oe<32;Oe++)Ie[Oe]-=Ae*ye[Oe];for(ce=0;ce<32;ce++)Ie[ce+1]+=Ie[ce]>>8,fe[ce]=Ie[ce]&255}function _e(fe){var Ie=new Float64Array(64),Ae;for(Ae=0;Ae<64;Ae++)Ie[Ae]=fe[Ae];for(Ae=0;Ae<64;Ae++)fe[Ae]=0;Re(fe,Ie)}function Ve(fe,Ie,Ae,ce){var Oe=new Uint8Array(64),dt=new Uint8Array(64),vt=new Uint8Array(64),Et,Ct,xn=new Float64Array(64),yn=[n(),n(),n(),n()];Fe(Oe,ce,32),Oe[0]&=248,Oe[31]&=127,Oe[31]|=64;var er=Ae+64;for(Et=0;Et<Ae;Et++)fe[64+Et]=Ie[Et];for(Et=0;Et<32;Et++)fe[32+Et]=Oe[32+Et];for(Fe(vt,fe.subarray(32),Ae+32),_e(vt),Pe(yn,vt),$e(fe,yn),Et=32;Et<64;Et++)fe[Et]=ce[Et];for(Fe(dt,fe,Ae+64),_e(dt),Et=0;Et<64;Et++)xn[Et]=0;for(Et=0;Et<32;Et++)xn[Et]=vt[Et];for(Et=0;Et<32;Et++)for(Ct=0;Ct<32;Ct++)xn[Et+Ct]+=dt[Et]*Oe[Ct];return Re(fe.subarray(32),xn),er}function he(fe,Ie){var Ae=n(),ce=n(),Oe=n(),dt=n(),vt=n(),Et=n(),Ct=n();return B(fe[2],l),U(fe[1],Ie),ee(Oe,fe[1]),J(dt,Oe,u),K(Oe,Oe,fe[2]),P(dt,fe[2],dt),ee(vt,dt),ee(Et,vt),J(Ct,Et,vt),J(Ae,Ct,Oe),J(Ae,Ae,dt),ne(Ae,Ae),J(Ae,Ae,Oe),J(Ae,Ae,dt),J(Ae,Ae,dt),J(fe[0],Ae,dt),ee(ce,fe[0]),J(ce,ce,dt),W(ce,Oe)&&J(fe[0],fe[0],p),ee(ce,fe[0]),J(ce,ce,dt),W(ce,Oe)?-1:(T(fe[0])===Ie[31]>>7&&K(fe[0],i,fe[0]),J(fe[3],fe[0],fe[1]),0)}function Ye(fe,Ie,Ae,ce){var Oe,dt=new Uint8Array(32),vt=new Uint8Array(64),Et=[n(),n(),n(),n()],Ct=[n(),n(),n(),n()];if(Ae<64||he(Ct,ce))return-1;for(Oe=0;Oe<Ae;Oe++)fe[Oe]=Ie[Oe];for(Oe=0;Oe<32;Oe++)fe[Oe+32]=ce[Oe];if(Fe(vt,fe,Ae),_e(vt),Ue(Et,Ct,vt),Pe(Ct,Ie.subarray(32)),He(Et,Ct),$e(dt,Et),Ae-=64,x(Ie,0,dt,0)){for(Oe=0;Oe<Ae;Oe++)fe[Oe]=0;return-1}for(Oe=0;Oe<Ae;Oe++)fe[Oe]=Ie[Oe+64];return Ae}var Le=32,Ne=24,Ge=32,ft=16,Ze=32,je=32,Je=32,st=32,gt=32,ut=Ne,pt=Ge,It=ft,kt=64,ln=32,qt=64,Jt=32,cn=64;t.lowlevel={crypto_core_hsalsa20:A,crypto_stream_xor:L,crypto_stream:_,crypto_stream_salsa20_xor:j,crypto_stream_salsa20:I,crypto_onetimeauth:F,crypto_onetimeauth_verify:D,crypto_verify_16:b,crypto_verify_32:x,crypto_secretbox:R,crypto_secretbox_open:z,crypto_scalarmult:Q,crypto_scalarmult_base:oe,crypto_box_beforenm:ie,crypto_box_afternm:ue,crypto_box:ge,crypto_box_open:Te,crypto_box_keypair:de,crypto_hash:Fe,crypto_sign:Ve,crypto_sign_keypair:we,crypto_sign_open:Ye,crypto_secretbox_KEYBYTES:Le,crypto_secretbox_NONCEBYTES:Ne,crypto_secretbox_ZEROBYTES:Ge,crypto_secretbox_BOXZEROBYTES:ft,crypto_scalarmult_BYTES:Ze,crypto_scalarmult_SCALARBYTES:je,crypto_box_PUBLICKEYBYTES:Je,crypto_box_SECRETKEYBYTES:st,crypto_box_BEFORENMBYTES:gt,crypto_box_NONCEBYTES:ut,crypto_box_ZEROBYTES:pt,crypto_box_BOXZEROBYTES:It,crypto_sign_BYTES:kt,crypto_sign_PUBLICKEYBYTES:ln,crypto_sign_SECRETKEYBYTES:qt,crypto_sign_SEEDBYTES:Jt,crypto_hash_BYTES:cn,gf:n,D:u,L:ye,pack25519:te,unpack25519:U,M:J,A:P,S:ee,Z:K,pow2523:ne,add:He,set25519:B,modL:Re,scalarmult:Ue,scalarbase:Pe};function hn(fe,Ie){if(fe.length!==Le)throw new Error("bad key size");if(Ie.length!==Ne)throw new Error("bad nonce size")}function St(fe,Ie){if(fe.length!==Je)throw new Error("bad public key size");if(Ie.length!==st)throw new Error("bad secret key size")}function wt(){for(var fe=0;fe<arguments.length;fe++)if(!(arguments[fe]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Dt(fe){for(var Ie=0;Ie<fe.length;Ie++)fe[Ie]=0}t.randomBytes=function(fe){var Ie=new Uint8Array(fe);return r(Ie,fe),Ie},t.secretbox=function(fe,Ie,Ae){wt(fe,Ie,Ae),hn(Ae,Ie);for(var ce=new Uint8Array(Ge+fe.length),Oe=new Uint8Array(ce.length),dt=0;dt<fe.length;dt++)ce[dt+Ge]=fe[dt];return R(Oe,ce,ce.length,Ie,Ae),Oe.subarray(ft)},t.secretbox.open=function(fe,Ie,Ae){wt(fe,Ie,Ae),hn(Ae,Ie);for(var ce=new Uint8Array(ft+fe.length),Oe=new Uint8Array(ce.length),dt=0;dt<fe.length;dt++)ce[dt+ft]=fe[dt];return ce.length<32||z(Oe,ce,ce.length,Ie,Ae)!==0?null:Oe.subarray(Ge)},t.secretbox.keyLength=Le,t.secretbox.nonceLength=Ne,t.secretbox.overheadLength=ft,t.scalarMult=function(fe,Ie){if(wt(fe,Ie),fe.length!==je)throw new Error("bad n size");if(Ie.length!==Ze)throw new Error("bad p size");var Ae=new Uint8Array(Ze);return Q(Ae,fe,Ie),Ae},t.scalarMult.base=function(fe){if(wt(fe),fe.length!==je)throw new Error("bad n size");var Ie=new Uint8Array(Ze);return oe(Ie,fe),Ie},t.scalarMult.scalarLength=je,t.scalarMult.groupElementLength=Ze,t.box=function(fe,Ie,Ae,ce){var Oe=t.box.before(Ae,ce);return t.secretbox(fe,Ie,Oe)},t.box.before=function(fe,Ie){wt(fe,Ie),St(fe,Ie);var Ae=new Uint8Array(gt);return ie(Ae,fe,Ie),Ae},t.box.after=t.secretbox,t.box.open=function(fe,Ie,Ae,ce){var Oe=t.box.before(Ae,ce);return t.secretbox.open(fe,Ie,Oe)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var fe=new Uint8Array(Je),Ie=new Uint8Array(st);return de(fe,Ie),{publicKey:fe,secretKey:Ie}},t.box.keyPair.fromSecretKey=function(fe){if(wt(fe),fe.length!==st)throw new Error("bad secret key size");var Ie=new Uint8Array(Je);return oe(Ie,fe),{publicKey:Ie,secretKey:new Uint8Array(fe)}},t.box.publicKeyLength=Je,t.box.secretKeyLength=st,t.box.sharedKeyLength=gt,t.box.nonceLength=ut,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(fe,Ie){if(wt(fe,Ie),Ie.length!==qt)throw new Error("bad secret key size");var Ae=new Uint8Array(kt+fe.length);return Ve(Ae,fe,fe.length,Ie),Ae},t.sign.open=function(fe,Ie){if(wt(fe,Ie),Ie.length!==ln)throw new Error("bad public key size");var Ae=new Uint8Array(fe.length),ce=Ye(Ae,fe,fe.length,Ie);if(ce<0)return null;for(var Oe=new Uint8Array(ce),dt=0;dt<Oe.length;dt++)Oe[dt]=Ae[dt];return Oe},t.sign.detached=function(fe,Ie){for(var Ae=t.sign(fe,Ie),ce=new Uint8Array(kt),Oe=0;Oe<ce.length;Oe++)ce[Oe]=Ae[Oe];return ce},t.sign.detached.verify=function(fe,Ie,Ae){if(wt(fe,Ie,Ae),Ie.length!==kt)throw new Error("bad signature size");if(Ae.length!==ln)throw new Error("bad public key size");var ce=new Uint8Array(kt+fe.length),Oe=new Uint8Array(kt+fe.length),dt;for(dt=0;dt<kt;dt++)ce[dt]=Ie[dt];for(dt=0;dt<fe.length;dt++)ce[dt+kt]=fe[dt];return Ye(Oe,ce,ce.length,Ae)>=0},t.sign.keyPair=function(){var fe=new Uint8Array(ln),Ie=new Uint8Array(qt);return we(fe,Ie),{publicKey:fe,secretKey:Ie}},t.sign.keyPair.fromSecretKey=function(fe){if(wt(fe),fe.length!==qt)throw new Error("bad secret key size");for(var Ie=new Uint8Array(ln),Ae=0;Ae<Ie.length;Ae++)Ie[Ae]=fe[32+Ae];return{publicKey:Ie,secretKey:new Uint8Array(fe)}},t.sign.keyPair.fromSeed=function(fe){if(wt(fe),fe.length!==Jt)throw new Error("bad seed size");for(var Ie=new Uint8Array(ln),Ae=new Uint8Array(qt),ce=0;ce<32;ce++)Ae[ce]=fe[ce];return we(Ie,Ae,!0),{publicKey:Ie,secretKey:Ae}},t.sign.publicKeyLength=ln,t.sign.secretKeyLength=qt,t.sign.seedLength=Jt,t.sign.signatureLength=kt,t.hash=function(fe){wt(fe);var Ie=new Uint8Array(cn);return Fe(Ie,fe,fe.length),Ie},t.hash.hashLength=cn,t.verify=function(fe,Ie){return wt(fe,Ie),fe.length===0||Ie.length===0||fe.length!==Ie.length?!1:v(fe,0,Ie,0,fe.length)===0},t.setPRNG=function(fe){r=fe},(function(){var fe=typeof self<"u"?self.crypto||self.msCrypto:null;if(fe&&fe.getRandomValues){var Ie=65536;t.setPRNG(function(Ae,ce){var Oe,dt=new Uint8Array(ce);for(Oe=0;Oe<ce;Oe+=Ie)fe.getRandomValues(dt.subarray(Oe,Oe+Math.min(ce-Oe,Ie)));for(Oe=0;Oe<ce;Oe++)Ae[Oe]=dt[Oe];Dt(dt)})}else typeof Qan<"u"&&(fe=eln,fe&&fe.randomBytes&&t.setPRNG(function(Ae,ce){var Oe,dt=fe.randomBytes(ce);for(Oe=0;Oe<ce;Oe++)Ae[Oe]=dt[Oe];Dt(dt)}))})()})(e.exports?e.exports:self.nacl=self.nacl||{})})(zF)),zF.exports}tln();new TextEncoder;new TextDecoder;function nln(e){return{id:e.id,name:e.name,path:e.path,...e.alias?.trim()?{alias:e.alias.trim()}:{},...e.groupId?{groupId:e.groupId}:{},...e.kind==="ssh"?{kind:"ssh",...e.sshConnectionName?{sshConnectionName:e.sshConnectionName}:{},...e.sshHost?{sshHost:e.sshHost}:{}}:{}}}const rln=4096;BigInt(rln);function sln(e,t){const n=IN(e);if(n)return n.failed?{status:"queued",queueFailed:n.failed.error}:{status:"queued",queuePosition:t??1}}function oln(e,t,n){if(!(e.status==="running"||e.spawning))return hh(e.goal)?"upstream":t&&Jye(t,n)?"reminder":void 0}function iln(e,t=[]){return JSON.stringify({pinnedOrder:t,entries:e.map(n=>{const{updatedAt:r,...s}=n;return s})})}function aln(e){return JSON.stringify(e)}function lln(e,t,n=[]){const r=iq(e,t).map(o=>({id:o.id,name:o.name,models:o.models.map(i=>({id:i.id,...i.label?{label:i.label}:{}}))})),s=n.filter(o=>o.enabled&&r.some(i=>i.id===o.primary.providerId&&i.models.some(l=>l.id===o.primary.modelId)));return s.length>0&&r.unshift({id:Av,name:"Auto",models:s.map(o=>({id:o.id,label:o.name}))}),r}function cln(e,t,n=[]){const r=lln(e,t,n),s=t.availability.status,o=s==="unloaded"||s==="loading",i=e.some(l=>l.enabled&&l.oauthAccountKey);return{entries:r,settled:!(o&&i&&r.length===0)}}function uln(e){return e!=="scratch"&&e!=="secretary"}function dln(e,t){return new Set(e.filter(n=>n.kind==="secretary"||!t&&n.kind==="scratch").map(n=>n.id))}const fln=300;let mj=null,Gge=!1,OG=null;function hln(){const e=be.getState(),t=it.getState(),r=DX(e.projects,Ip(Wj)).filter(N=>uln(N.kind)),s=new Set(Ip(tg)),o=ZA(c2(e.language),"Temporary chats"),i=new Map(e.projects.map(N=>[N.id,N.kind==="scratch"?o:Ta(N)])),l=new Map(e.projects.map(N=>[N.id,N.path])),c=new Map(e.projects.map(N=>[N.id,N.kind])),u=N=>{const j=(N.parentId?t.conversations[N.parentId]:void 0)??N;return c.get(j.projectId)==="scratch"?jT({kind:"scratch",canonicalPath:l.get(j.projectId)??"",conversationId:j.id})??void 0:j.worktree?.path??l.get(N.projectId)},d=e.skills.filter(N=>N.enabled!==!1).map(N=>({name:`/skill:${N.name}`,description:N.description})),f=K_(t.conversations),h=Sk.getState().byConversation,p=Date.now(),m=N=>{const j=sln(N,f.get(N.id)),I=oln(N,h[N.id],p),_=Bje(N.occupancy,N.contextWindow),L={id:N.id,title:N.parentId&&N.coworkerName||N.title,projectName:i.get(N.projectId)??"",projectId:N.projectId,...u(N)?{cwd:u(N)}:{},status:j?.status??(N.spawning?"running":N.status),updatedAt:py(N),...N.parentId?{parentId:N.parentId}:{},...N.pinned===!0?{pinned:!0}:{},...N.archived===!0?{archived:!0}:{},...N.muted===!0?{muted:!0}:{},...N.lastProviderId?{providerId:N.lastProviderId}:{},...N.lastModelId?{modelId:N.lastModelId}:{},...N.reasoningEnabled!==void 0?{reasoningEnabled:N.reasoningEnabled}:{},...N.thinkingLevel?{thinkingLevel:N.thinkingLevel}:{},...N.unread===!0?{unread:!0}:{},...bg(N.pendingAsks)>0?{pendingAskCount:bg(N.pendingAsks)}:{},...N.pendingApprovals&&N.pendingApprovals.length>0?{pendingApprovalCount:N.pendingApprovals.length}:{},...N.queuedMessages?.length?{queued:N.queuedMessages.map(M=>({id:M.id,text:M.text,...M.images?.length?{hasImages:!0}:{}}))}:{},...N.goal?{goal:{text:N.goal.text,status:N.goal.status,...N.goal.note?{note:N.goal.note}:{},autoTurns:N.goal.autoTurns}}:{},...I?{parked:I}:{},...d.length?{slashCommands:d}:{},..._?{context:_}:{},...N.usageTotals?{usageTotals:N.usageTotals}:{}};return j&&"queuePosition"in j&&Object.assign(L,{queuePosition:j.queuePosition}),j&&"queueFailed"in j&&Object.assign(L,{queueFailed:j.queueFailed}),L},v=t.order.map(N=>t.conversations[N]).filter(N=>!!N),b=new Set(t.order),x=Object.values(t.conversations).filter(N=>!!(N?.parentId&&b.has(N.parentId))),S=[...v,...x].map(m),k=dln(e.projects,e.scratchSessionsEnabled),C=S.filter(N=>!k.has(N.projectId)),A=cln(RM(),Ri.getState().snapshot,e.virtualModels);return{catalog:C,pinnedOrder:Ip(MH),projects:r.map(N=>({...nln(N),...s.has(N.id)?{archived:!0}:{}})),projectGroups:e.projectGroups,providers:A.entries,providersSettled:A.settled,projectPaths:e.projects.map(N=>({id:N.id,path:N.path})),theme:e.theme,terminal:nN(e.terminalTheme),terminalFontFamily:e.terminalFontFamily,compactReadOnlyTools:e.compactReadOnlyTools,expandLiveEdits:e.expandLiveEdits,expandLiveReasoning:e.expandLiveReasoning,autoCollapseTurns:e.autoCollapseTurns,collapseCompletedActivity:e.collapseCompletedActivity,collapseLiveActivity:e.collapseLiveActivity,pinUnfinishedTodos:e.pinUnfinishedTodos}}function pln(e){return aln({catalog:iln(e.catalog,e.pinnedOrder??[]),projects:e.projects,projectGroups:e.projectGroups,providers:e.providers,providersSettled:e.providersSettled,projectPaths:e.projectPaths,theme:e.theme,terminal:e.terminal,terminalFontFamily:e.terminalFontFamily,compactReadOnlyTools:e.compactReadOnlyTools,expandLiveEdits:e.expandLiveEdits,expandLiveReasoning:e.expandLiveReasoning,autoCollapseTurns:e.autoCollapseTurns,collapseCompletedActivity:e.collapseCompletedActivity,collapseLiveActivity:e.collapseLiveActivity,pinUnfinishedTodos:e.pinUnfinishedTodos})}function mln(){return it.persist.hasHydrated()&&be.persist.hasHydrated()}function dp(){mj&&clearTimeout(mj),mj=setTimeout(()=>{if(mj=null,!Ql()||!mln())return;const e=hln(),t=pln(e);t!==OG&&(OG=t,window.electronAPI.pair.pushCatalog(e))},fln)}function gln(){Gge||(Gge=!0,dp(),it.persist.onFinishHydration(dp),be.persist.onFinishHydration(dp),it.subscribe((e,t)=>{(e.conversations!==t.conversations||e.order!==t.order)&&dp()}),Ri.subscribe((e,t)=>{e.snapshot!==t.snapshot&&dp()}),Sk.subscribe((e,t)=>{e.byConversation!==t.byConversation&&dp()}),Mf.subscribe((e,t)=>{e.snapshot!==t.snapshot&&dp()}),be.subscribe((e,t)=>{(e.projects!==t.projects||e.projectGroups!==t.projectGroups||e.providers!==t.providers||e.theme!==t.theme||e.terminalTheme!==t.terminalTheme||e.terminalFontFamily!==t.terminalFontFamily||e.compactReadOnlyTools!==t.compactReadOnlyTools||e.expandLiveEdits!==t.expandLiveEdits||e.expandLiveReasoning!==t.expandLiveReasoning||e.autoCollapseTurns!==t.autoCollapseTurns||e.collapseCompletedActivity!==t.collapseCompletedActivity||e.collapseLiveActivity!==t.collapseLiveActivity||e.pinUnfinishedTodos!==t.pinUnfinishedTodos||e.skills!==t.skills)&&dp()}),F2e(dp),ZJe(e=>{e&&(OG=null,dp())}),window.electronAPI.pair.onResumeSession(e=>{Jne(e),Ql()&&(it.getState().markConversationRead(e),it.getState().resumeConversation(e))}),window.electronAPI.pair.onSessionCreated(e=>{Jne(e.sessionId),Ql()&&it.getState().adoptPairSession(e)}),window.electronAPI.pair.onSessionConfig(e=>{if(!Ql())return;const t=it.getState();e.type==="set-model"?t.setModel(e.sessionId,e.providerId,e.modelId):e.type==="set-reasoning"?t.setReasoning(e.sessionId,e.enabled):t.setThinking(e.sessionId,e.level)}),window.electronAPI.pair.onQueueAction(e=>{if(!Ql())return;const t=it.getState();switch(e.type){case"enqueue":t.enqueueMessage(e.sessionId,e.text,e.images);break;case"queue-remove":t.removeQueuedMessage(e.sessionId,e.messageId);break;case"queue-update":t.updateQueuedMessage(e.sessionId,e.messageId,e.text);break;case"queue-send-now":t.sendQueuedNow(e.sessionId,e.messageId);break;case"queue-interrupt-send":t.interruptAndSendQueued(e.sessionId,e.messageId);break;case"goal-pause":t.pauseGoal(e.sessionId);break;case"goal-resume":t.resumeGoal(e.sessionId);break;case"goal-clear":t.clearGoal(e.sessionId);break;case"goal-set":t.setGoal(e.sessionId,e.text);break;case"compact":t.compact(e.sessionId,e.instructions,{quiet:!0});break;case"rewind":t.rewind(e.sessionId,e.userIndexFromEnd,e.restoreFiles);break;case"retry":t.retry(e.sessionId);break;case"task-stop":window.electronAPI.agent.stopTask(e.sessionId,e.taskId);break;case"subagent-stop":window.electronAPI.agent.stopSubagent(e.sessionId,e.agentId);break}}))}const vln=3e4;async function xln(e,t=Date.now()){const{order:n,conversations:r,activeId:s}=it.getState(),o=n.flatMap(d=>{const f=r[d];return!f||f.parentId?[]:(d===s||f.status==="running"||f.spawning===!0||f.workspaceMigrating===!0||(f.pendingAsks?.length??0)>0||(f.pendingApprovals?.length??0)>0)&&e.kind==="stale"?[]:[{id:d,projectId:f.projectId,archived:f.archived,archivedAt:f.archivedAt,pinned:f.pinned,lastActiveAt:py(f)}]}),i=x1e(o,e,t),l=it.getState();for(const d of i)l.removeConversation(d);const c=Date.now()+vln,u=()=>i.filter(d=>it.getState().conversations[d]);for(;u().length>0&&Date.now()<c;)await new Promise(d=>setTimeout(d,200));return i.length-u().length}const bln=y.lazy(()=>Be(()=>import("./SidePanel-BGXusuy3.js"),__vite__mapDeps([127,126,128]),import.meta.url).then(e=>({default:e.SidePanel}))),yln=e=>{const t=HLe(e);return t.length>0?t:l0e(e)},Wge="enso-sidebar-width",qge="enso-sidebar-collapsed";function gj(){const e=it.getState(),n=(e.activeId?e.conversations[e.activeId]:null)?.projectId??be.getState().projects[0]?.id;n&&e.newConversation(n)}const vj="no-drag flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",Yge=200,$ge=420;function wln(){const e=be(he=>he.onboarded),t=y.useSyncExternalStore(he=>be.persist?.onFinishHydration?.(he)??(()=>{}),()=>be.persist?.hasHydrated?.()??!0);FXe(),yan(),xan(),Tan(),jan(),ban();const[n,r]=y.useState(!1),[s,o]=y.useState(null);Pan();const[i,l]=y.useState(()=>{const he=Number(localStorage.getItem(Wge));return Number.isFinite(he)&&he>=Yge?Math.min(he,$ge):280}),[c,u]=y.useState(()=>localStorage.getItem(qge)==="1"),d=Xp(),f=GXe(),[h,p]=y.useState(!1),m=y.useCallback(()=>p(!1),[]);y.useEffect(()=>{d||p(!1)},[d]),y.useEffect(()=>it.subscribe((he,Ye)=>{he.activeId!==Ye.activeId&&p(!1)}),[]);const{t:v}=Se(),b=be(he=>he.chatWide),x=it(he=>he.activeId),S=Bq(x),k=fs(he=>he.uiByConversation[x??""]?.width??he.lastWidth),C=fs(he=>he.fullscreen),A=fs(he=>he.toggleOpen),N=_t(he=>he.panelOpen),j=_t(he=>he.togglePanel);y.useEffect(()=>{C&&!S&&fs.getState().setFullscreen(!1)},[S,C]),y.useEffect(()=>ost(),[]),y.useEffect(()=>(document.documentElement.classList.add("enso-main-shell"),()=>document.documentElement.classList.remove("enso-main-shell")),[]),y.useEffect(()=>window.electronAPI.app.onCloseRequest(o),[]),y.useEffect(()=>window.electronAPI.app.onFlushPersist(he=>{TXe().finally(()=>{window.electronAPI.app.respondFlushPersist(he)})}),[]);const I=he=>{const Ye=s;Ye&&(o(null),window.electronAPI.app.respondCloseRequest(Ye,{action:he}))},_=y.useCallback(()=>{VXe(window.innerWidth)?p(he=>!he):u(he=>!he)},[]),L=y.useCallback(()=>{window.electronAPI.env.platform==="darwin"&&window.setTimeout(()=>window.electronAPI.window.refreshDragRegions(),400)},[]),M=y.useCallback(()=>{_(),L()},[_,L]);y.useEffect(()=>Dan(M),[M]),y.useEffect(()=>window.electronAPI.window.onToggleSidebar(M),[M]);const[F,D]=y.useState(!1),R=y.useRef(null);y.useEffect(()=>{localStorage.setItem(Wge,String(i))},[i]),y.useEffect(()=>{localStorage.setItem(qge,c?"1":"0")},[c]),y.useEffect(()=>window.electronAPI.resources.onSessionsCleanRequest(({requestId:he,request:Ye})=>{xln(Ye).catch(()=>0).then(Le=>window.electronAPI.resources.sessionsCleanDone(he,Le))}),[]),y.useEffect(()=>{gln()},[]),y.useEffect(()=>{const he=window.electronAPI.remote;return he&&!he.nativePlatform?void 0:jd.getState().bind()},[]);const z=jd(he=>he.pairDialogOpen),B=tft(),H=be(he=>he.botModeEnabled),G=be(he=>he.headerSessionTabs),te=pg(he=>he.mode);y.useEffect(()=>{const he=be.persist?.hasHydrated?.()??!0;te==="bot"&&he&&!H&&pg.getState().setMode("code")},[te,H]),y.useEffect(()=>{if(!H)return;const he=_t.getState().bind(),Ye=window.electronAPI.bots.onEvent(Le=>{Le.kind==="open"&&nft(Le)});return()=>{he(),Ye()}},[H]);const W=be(he=>he.secretaryEnabled),T=Pr(he=>he.welcomeOpen),U=Ey(he=>he.open);y.useEffect(()=>W?Pr.getState().bind():void 0,[W]),y.useEffect(()=>window.electronAPI.agent.onFocusSession(he=>{it.getState().conversations[he]&&oP()}),[]);const P=y.useCallback(he=>{l(Ye=>Math.min($ge,Math.max(Yge,Ye+he)))},[]),K=be(he=>he.keybindings);y.useEffect(()=>{const he=jh(K),Ye=Ne=>{const Ge=it.getState(),ft=Ge.activeId?Ge.conversations[Ge.activeId]:null;if(!ft)return;const Ze=[void 0,...ft.coworkerIds??[]];if(Ze.length<=1)return;const je=Ze.indexOf(ft.activeTabId);Ge.selectTab(ft.id,Ze[(je+Ne+Ze.length)%Ze.length])},Le=Ne=>{const Ge=qv(Ne);if(!Ge)return;if(Ge===he["open-settings"]){Ne.preventDefault(),uLe();return}if(wc.getState().settings)return;if(Ge===he["toggle-app-mode"]){if(!be.getState().botModeEnabled)return;Ne.preventDefault();const je=pg.getState();je.setMode(je.mode==="bot"?"code":"bot");return}const ft=ooe();if(ft&&Ge===he["toggle-side-panel"]){Ne.preventDefault(),_t.getState().togglePanel();return}if(ft&&Ge===he["search-workspace"]){Ne.preventDefault(),_t.getState().setSearchOpen(!0);return}if(!(ft&&["new-conversation","next-tab","prev-tab","toggle-side-panel","toggle-side-panel-fullscreen","new-side-tab","new-btw-tab","close-side-tab","find-in-chat","search-workspace","open-secretary"].some(Ze=>Ge===he[Ze]))){if(Ge===he["toggle-sidebar"]){if(Ne.preventDefault(),nct(Ne,Ge))return;M()}else if(Ge===he["open-secretary"])be.getState().secretaryEnabled&&(Ne.preventDefault(),vR());else if(Ge===he["new-conversation"])Ne.preventDefault(),gj();else if(Ge===he["new-side-tab"])Ne.preventDefault(),tct(Ne.target)?K1t():gj();else if(Ge===he["new-btw-tab"])Ne.preventDefault(),Z1t();else if(Ge===he["next-tab"])Ne.preventDefault(),Ye(1);else if(Ge===he["prev-tab"])Ne.preventDefault(),Ye(-1);else if(Ge===he["toggle-side-panel"])Ne.preventDefault(),fs.getState().toggleOpen();else if(Ge===he["toggle-side-panel-fullscreen"])Ne.preventDefault(),fs.getState().toggleFullscreen();else if(Ge===he["close-side-tab"])Ne.preventDefault(),rwt();else if(Ge===he["focus-composer"])Ne.preventDefault(),b2();else if(Ge===he["find-in-chat"])Ne.preventDefault(),fje();else if(Ge===he["search-workspace"])Ne.preventDefault(),r(!0);else if(!ft){const Ze=oMe(vje(),K,he).byBinding.get(Ge);if(!Ze)return;Ne.preventDefault();const je=it.getState(),Je=je.activeId?je.conversations[je.activeId]:null;IX(Ze,Je?Je.activeTabId??Je.id:null).then(st=>{st&&Ht({type:"error",title:Ze.title,description:st})})}}};return window.addEventListener("keydown",Le),()=>window.removeEventListener("keydown",Le)},[K,M]),y.useEffect(()=>{if(!S||!C)return;const he=Ye=>{Ye.key==="Escape"&&(ooe()||wc.getState().settings||(Ye.preventDefault(),fs.getState().setFullscreen(!1)))};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[S,C]);const J=MLe(RLe(GG,{activationConstraint:{distance:6}})),ee=pLe(),X=y.useRef(null),ne=y.useRef(null),Q=y.useRef(null),[oe,de]=y.useState(null),[ie]=y.useState(()=>Ban({reducedMotion:zan,onSettle:()=>de(null)})),[ue,ve]=y.useState(ee);y.useLayoutEffect(()=>{if(ue===ee)return;ve(ee);const he=X.current,Ye=Ne=>he?.querySelector(`[data-enso="${Ne}"]`)??null,Le=ie.run(ee?"settings":"workbench",{workbench:{sidebar:d?null:Q.current,main:B?ne.current:R.current},settings:d?{sidebar:he,main:null}:{sidebar:Ye("settings-nav"),main:Ye("settings-content")}});de(Le.animating?{top:Le.top}:null)},[ee,ue,ie,d,B]),y.useEffect(()=>()=>ie.finish(),[ie]),y.useLayoutEffect(()=>{oe===null&&ie.release()},[oe,ie]);const{settingsMounted:ge,workbenchHidden:Te}=Fan({open:ee,shown:ue,animating:oe!==null});y.useLayoutEffect(()=>fLe(ge),[ge]),y.useEffect(()=>{ee&&p(!1)},[ee]),y.useEffect(()=>Lan(window.electronAPI.window),[]);const De=y.useRef(d);De.current=d,y.useEffect(()=>{if(window.electronAPI.remote)return Oan(window,{depth:()=>hLe(wc.getState(),De.current),apply:he=>{if(he===0){lT();return}nu(),n0e(he===2)},subscribe:he=>wc.subscribe(he)})},[]);const Me=ge?a.jsx("div",{ref:X,"data-enso":"settings-view",inert:!ee,className:xe("absolute inset-0 flex",d&&"bg-background",oe?.top==="workbench"?"z-0":"z-[2]"),children:a.jsx(van,{navWidth:i,onNavResize:P,open:ee})}):null,Fe=iP(),He=Fe!=="mobile"&&!B,tt=y.useCallback(he=>{const Ye=R.current;if(!Ye)return;const Le=getComputedStyle(Ye),Ne=Ye.clientWidth-parseFloat(Le.paddingLeft)-parseFloat(Le.paddingRight);fs.getState().nudgeWidth(-he,Ne,He?est:aN)},[He]),$e=H?a.jsx(aDt,{}):null,Ue=He&&(Fe==="mac"||Fe==="windows"||Fe==="web"),Pe=Ue&&S&&!d&&!B,we=G&&!ee&&He&&!H&&!(Pe&&C)?a.jsx(vct,{onNew:gj}):null,ye=a.jsx("button",{type:"button",className:xe("flex items-center justify-center rounded-md transition-colors hover:bg-accent/50",d?"h-9 w-9":He?vj:"h-7 w-7",(B?N:S)?"text-foreground":"text-muted-foreground"),onClick:B?j:A,"aria-label":v("Toggle side panel"),title:v("Toggle side panel"),children:a.jsx(bUe,{className:"h-4 w-4"})}),Re=a.jsx("button",{type:"button",className:xe("flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-accent/50",b?"text-foreground":"text-muted-foreground",d&&"hidden"),onClick:()=>be.getState().setChatWide(!b),"aria-label":v(b?"Use reading width":"Use full chat width"),title:v(b?"Use reading width":"Use full chat width"),children:b?a.jsx(Vze,{className:"h-4 w-4"}):a.jsx(IVe,{className:"h-4 w-4"})}),_e=a.jsxs(a.Fragment,{children:[Re,ye]}),Ve=He?{trailing:Re}:null;return a.jsxs("div",{"data-enso":"canvas",className:xe("relative isolate flex flex-col",d?"h-dvh":"h-screen"),children:[a.jsx(B2e,{}),a.jsx(Van,{}),a.jsx(ast,{}),a.jsx(aft,{}),a.jsx(xzt,{}),Fe!=="mobile"?a.jsx(coe,{leading:a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx("div",{className:xe(Fe!=="mac"&&"flex justify-center",Fe!=="mac"&&(He?"w-[48px]":"w-12")),children:a.jsx("button",{type:"button","data-enso":"sidebar-toggle",className:xe(vj,ee&&"pointer-events-none opacity-40"),disabled:ee,onClick:M,title:v(c?"Expand sidebar":"Collapse sidebar"),children:c?a.jsx(Cxe,{className:"h-4 w-4"}):a.jsx(MW,{className:"h-4 w-4"})})}),He&&!ee&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button","data-enso":"search-button",className:vj,onClick:()=>r(!0),title:v("Search anything"),children:a.jsx(su,{className:"h-4 w-4"})}),a.jsx("button",{type:"button","data-enso":"new-session",className:vj,onClick:gj,title:v("New conversation"),children:a.jsx(lVe,{className:"h-4 w-4"})})]})]}),centered:(Pe&&C?null:$e)??void 0,middle:we,className:xe(Fe!=="mac"&&"pl-0",He&&"border-b-0",He&&"bg-transparent",He&&Fe==="mac"&&"pr-4"),actions:ee?void 0:He?Pe?void 0:ye:_e}):a.jsx(coe,{title:"EnsoCode",centered:$e??void 0,leading:d&&!B?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("button",{type:"button","data-enso":"sidebar-toggle",className:"-ml-1.5 flex h-9 w-9 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",onClick:()=>p(!0),"aria-label":v("Conversations"),title:v("Conversations"),children:a.jsx(QHe,{className:"h-5 w-5"})}),!$e&&a.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"EnsoCode"})]}):void 0,actions:_e}),!He&&a.jsx(loe,{}),!He&&a.jsx(Aae,{}),!He&&a.jsx(Nae,{}),a.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[a.jsx("div",{ref:ne,"data-enso":"workbench",inert:Te,className:xe("flex min-h-0 min-w-0 flex-1",Te&&"invisible",oe?.top==="workbench"&&"z-[1]"),children:B?a.jsx(nDt,{sidebarWidth:i,collapsed:c,onToggleCollapse:M,onResize:P}):a.jsxs(_8e,{sensors:J,collisionDetection:yln,children:[d?a.jsxs(a.Fragment,{children:[a.jsx(hE,{children:h&&a.jsx(hf.div,{className:"fixed inset-0 bg-black/40",style:{zIndex:_r.MOBILE_DRAWER},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:m},"drawer-backdrop")}),a.jsx(hf.div,{className:"fixed inset-y-0 left-0 flex bg-background shadow-xl",style:{zIndex:_r.MOBILE_DRAWER},initial:!1,animate:{x:h?0:"-105%"},transition:tk,inert:!h,children:a.jsx(Yue,{width:Math.min(320,Math.round(f*.85)),collapsed:!1,onToggleCollapse:m,onOpenSearch:()=>r(!0),onNavigate:m})})]}):a.jsxs("div",{ref:Q,className:"flex min-h-0 shrink-0",children:[a.jsx(Yue,{width:c?void 0:i,collapsed:c,onToggleCollapse:M,onOpenSearch:()=>r(!0)}),!c&&a.jsx(tA,{edge:He,onResize:P})]}),a.jsxs("div",{ref:R,className:xe("relative flex min-h-0 min-w-0 flex-1",Ue?"overflow-x-clip":"overflow-hidden",He&&"-mt-px -ml-px pt-px pr-[8px] pb-[8px] pl-px"),children:[a.jsxs("div",{"data-enso":"main",className:xe("relative flex min-h-0 min-w-0 flex-1 flex-col bg-background",He&&"overflow-hidden rounded-[10px] shadow-surface",Pe&&"rounded-r-none"),style:S&&C?{visibility:"hidden",transition:`visibility 0s ${U6.duration}s`}:void 0,children:[a.jsx(Xan,{}),a.jsx(tot,{hidden:W&&T||U,children:a.jsx(oSe.Provider,{value:Ve,children:a.jsx(wBt,{})})}),He&&a.jsx(loe,{}),He&&a.jsx(Aae,{}),He&&a.jsx(Nae,{}),W&&T&&a.jsx(FHt,{}),U&&a.jsx(OAt,{})]}),!C&&!d&&a.jsx(tA,{gap:He&&!Ue,inactive:!S,onResize:tt,onResizingChange:D}),a.jsx(y.Suspense,{fallback:null,children:a.jsx(bln,{width:k,resizing:F,card:He,titleRow:Ue})})]})]})}),!d&&Me]}),d&&Me,t&&!e&&!window.electronAPI.remote&&a.jsx(sHt,{}),a.jsx(BHt,{open:n,onOpenChange:r}),a.jsx(nUt,{}),a.jsx(wRe,{open:z,onOpenChange:jd.getState().setPairDialogOpen}),a.jsx(Zp,{open:s!==null,onOpenChange:he=>{!he&&s&&I("cancel")},children:a.jsxs(Jp,{className:"sm:max-w-sm",children:[a.jsxs(em,{children:[a.jsx(nm,{className:"text-base",children:v("Confirm exit")}),a.jsx(rm,{children:v("Exit closes the app completely, so your phone can no longer connect. Minimize to tray keeps the app running in the background so your phone can still connect.")})]}),a.jsxs(tm,{variant:"bare",children:[a.jsx(dx,{render:a.jsx(Ke,{variant:"outline",size:"sm"}),children:v("Cancel")}),a.jsx(Ke,{size:"sm",onClick:()=>I("tray"),children:v("Minimize to tray")}),a.jsx(Ke,{variant:"destructive",size:"sm",onClick:()=>I("quit"),children:v("Exit")})]})]})}),a.jsx(yft,{})]})}function kln(e){return new Worker(""+new URL("worker-DsKBD11i.js",import.meta.url).href,{type:"module",name:e?.name})}const Sln={workerFactory:()=>new kln,poolSize:2},Cln={theme:v4,langs:[...h6e],preferredHighlighter:"shiki-js"};function Eln({children:e}){return a.jsx(F$t,{poolOptions:Sln,highlighterOptions:Cln,children:e})}function Tln(e=document,t=800){const n=new Map,r=s=>{const o=s.target,i=o&&o.nodeType===9?o.documentElement:o;!i||typeof i.setAttribute!="function"||(i.setAttribute("data-scrolling",""),clearTimeout(n.get(i)),n.set(i,setTimeout(()=>{n.delete(i),i.removeAttribute("data-scrolling")},t)))};return e.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>{e.removeEventListener("scroll",r,{capture:!0});for(const s of n.values())clearTimeout(s);n.clear()}}function Kge({conversations:e,activeId:t}){const n=document.documentElement.dataset,r=FBt(e),s=Qje(t?e[t]:void 0,e);n.ensoActivity!==r&&(n.ensoActivity=r),n.ensoSession!==s&&(n.ensoSession=s)}function Aln(){Kge(it.getState()),it.subscribe((e,t)=>{(e.conversations!==t.conversations||e.activeId!==t.activeId)&&Kge(e)})}BXe();Aln();Tln();N2e();qPe.createRoot(document.getElementById("root")).render(a.jsx(y.StrictMode,{children:a.jsx(Eln,{children:a.jsx(wln,{})})}));export{oKt as $,pcn as A,ucn as B,v4 as C,IMe as D,v3e as E,tXt as F,SYt as G,Ccn as H,mcn as I,wL as J,kL as K,V3 as L,M2 as M,Acn as N,Ncn as O,Ofe as P,Qo as Q,Gk as R,dcn as S,sG as T,Cc as U,she as V,n6e as W,KYt as X,Lfe as Y,U3 as Z,kcn as _,qEt as a,VKt as a$,ohe as a0,xcn as a1,m4 as a2,hKt as a3,ru as a4,l$t as a5,Afe as a6,a6e as a7,rhe as a8,dKt as a9,gKt as aA,jMe as aB,RMe as aC,MMe as aD,kKt as aE,EKt as aF,cG as aG,MKt as aH,AKt as aI,GV as aJ,RKt as aK,jKt as aL,xKt as aM,LKt as aN,TKt as aO,rg as aP,c$t as aQ,aG as aR,Xfe as aS,z$t as aT,Mt as aU,gcn as aV,vcn as aW,bcn as aX,ycn as aY,wcn as aZ,ccn as a_,N$t as aa,m$t as ab,f$t as ac,_fe as ad,iKt as ae,Mv as af,s6e as ag,H$t as ah,lKt as ai,Mfe as aj,JYt as ak,IKt as al,J$t as am,G$t as an,Qfe as ao,u5 as ap,vA as aq,PKt as ar,sYt as as,Ecn as at,Tcn as au,iG as av,Al as aw,yKt as ax,wKt as ay,Kfe as az,JKt as b,oct as b$,lG as b0,$fe as b1,Ea as b2,CYt as b3,Hn as b4,vLe as b5,xe as b6,kW as b7,Bs as b8,Ho as b9,hrn as bA,lrn as bB,be as bC,t3t as bD,kk as bE,$u as bF,r2 as bG,acn as bH,io as bI,mT as bJ,PUe as bK,ua as bL,j3t as bM,xs as bN,Rf as bO,xNe as bP,NN as bQ,By as bR,ODt as bS,dK as bT,fK as bU,cA as bV,zy as bW,Pi as bX,n_ as bY,IN as bZ,K_ as b_,jW as ba,it as bb,O6 as bc,crn as bd,Is as be,kT as bf,Jr as bg,Fy as bh,bq as bi,v_ as bj,xxe as bk,YHt as bl,Vce as bm,ejt as bn,P2 as bo,mx as bp,tK as bq,rK as br,eK as bs,sK as bt,L2 as bu,Pr as bv,Ng as bw,GHe as bx,prn as by,mrn as bz,tx as c,xo as c$,Due as c0,KN as c1,HFt as c2,Md as c3,ZFt as c4,Hd as c5,Ri as c6,fu as c7,tcn as c8,xz as c9,jcn as cA,nu as cB,Fsn as cC,bxe as cD,Yu as cE,Q4 as cF,$p as cG,g4t as cH,Kp as cI,wf as cJ,Lf as cK,Y4 as cL,$A as cM,Lo as cN,z2 as cO,U2 as cP,H2 as cQ,kxe as cR,Dp as cS,Bp as cT,Fp as cU,zr as cV,YT as cW,_i as cX,Qu as cY,Zu as cZ,Ju as c_,TT as ca,pM as cb,Uv as cc,xg as cd,ncn as ce,uet as cf,rcn as cg,bje as ch,vz as ci,Og as cj,x3e as ck,X7t as cl,i7t as cm,Q9t as cn,sc as co,OIe as cp,B7t as cq,scn as cr,l2e as cs,Ht as ct,b2 as cu,Yv as cv,Ke as cw,Jn as cx,du as cy,ec as cz,kYt as d,Txe as d$,t1 as d0,fs as d1,Mln as d2,jT as d3,Pq as d4,K4 as d5,qa as d6,wxe as d7,aUe as d8,En as d9,zln as dA,R$ as dB,bse as dC,wYt as dD,su as dE,tA as dF,fv as dG,G1t as dH,nze as dI,xT as dJ,JRe as dK,ZKt as dL,Gp as dM,yYt as dN,E0e as dO,Bq as dP,HGe as dQ,T_ as dR,Nd as dS,EEe as dT,Sie as dU,$4 as dV,cq as dW,nN as dX,jln as dY,XJe as dZ,AW as d_,Bze as da,y6t as db,w6t as dc,Bln as dd,fie as de,BN as df,zP as dg,R2 as dh,GSe as di,Vxt as dj,Jxt as dk,eEe as dl,nWe as dm,i_ as dn,Oln as dp,Lln as dq,Dln as dr,b4t as ds,_cn as dt,Xp as du,hre as dv,Rcn as dw,Mcn as dx,Fln as dy,lg as dz,nXt as e,_W as e0,RM as e1,Rln as e2,qln as e3,Yj as e4,$ln as e5,J1t as e6,Kln as e7,ecn as e8,ocn as e9,bUe as eA,wft as eB,Yln as eC,lcn as eD,C4t as eE,icn as eF,Be as eG,hf as ea,v6t as eb,ywe as ec,hH as ed,zXe as ee,est as ef,aN as eg,Jln as eh,Iln as ei,Uln as ej,Vln as ek,Wln as el,Y1t as em,X1t as en,Pln as eo,Hln as ep,Gln as eq,q1t as er,_ln as es,iHe as et,r_ as eu,YP as ev,Fv as ew,Mg as ex,vf as ey,iP as ez,$nn as f,LMe as g,r6e as h,r1 as i,a as j,Zln as k,Q3t as l,Oy as m,Ife as n,ZX as o,Uk as p,Scn as q,y as r,t6e as s,WKt as t,Se as u,hcn as v,fcn as w,g4 as x,p4 as y,yA as z};
|