@kabmo-labs/kabmo 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +435 -432
- package/dist/client/static/js/{CsvGrid-0amzgtd7.js → CsvGrid-xb429wvb.js} +2 -2
- package/dist/client/static/js/{DocxView-bxjhzxe9.js → DocxView-g58e0bs7.js} +2 -2
- package/dist/client/static/js/{DrawioView-7s1yqsf4.js → DrawioView-1j66avvy.js} +2 -2
- package/dist/client/static/js/{ImageView-ycfbn66h.js → ImageView-kraqkypn.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-tw1q1x0g.js → LayoutWrapper-85dhbn62.js} +2 -2
- package/dist/client/static/js/{Modal-wqjactyd.js → Modal-f0nfya07.js} +16 -16
- package/dist/client/static/js/{PdfView-x6dmtwvr.js → PdfView-nddkrky9.js} +1 -1
- package/dist/client/static/js/{SessionsView-t85wq0me.js → SessionsView-a595m6g1.js} +1 -1
- package/dist/client/static/js/{SheetView-n52nvz8s.js → SheetView-s2p4sk6b.js} +13 -13
- package/dist/client/static/js/{SvgPreview-59z7syme.js → SvgPreview-ppdx4yb9.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-91gnt049.js → abnfDiagram-O67JEVCF-5cjzxcaq.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-7ewrw5vc.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-5b9qtff2.js → architectureDiagram-NJMV4G6O-62mygavm.js} +3 -3
- package/dist/client/static/js/{astro-31cbyw7b.js → astro-80bs6hvg.js} +1 -1
- package/dist/client/static/js/bash-b3rwyg5p.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-6f23fjkn.js → blockDiagram-BEXU5L5S-s5yz9hcd.js} +2 -2
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-76t6d3am.js → c4Diagram-YGBWAQC7-rf9xkmrm.js} +2 -2
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-f9tb19xm.js → classDiagram-v2-NBCMYWYE-zfm2cj2a.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-t6nwrbwj.js → cose-bilkent-JH36ORCC-fmgpv55e.js} +1 -1
- package/dist/client/static/js/cpp-y0t6mynx.js +1 -0
- package/dist/client/static/js/css-r2nhvzff.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-yyyx3px0.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-69gc244j.js → cynefinDiagram-VND7K2PF-468r5xc2.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-54bry3ey.js → dagre-6A5THRUB-w370qmgj.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-gfkebye6.js → diagram-22UHCM2B-sfvfjjsy.js} +3 -3
- package/dist/client/static/js/{diagram-3UASUU5V-a1mr319f.js → diagram-3UASUU5V-3r2c8s14.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-tkyk0qbe.js → diagram-ATOU4E4O-yathy97a.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-np0hc9m2.js → diagram-CDSNMT55-kk437kxq.js} +2 -2
- package/dist/client/static/js/{diagram-MLGK6HIB-nh06fshp.js → diagram-MLGK6HIB-qdxfjjhf.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-27q2veks.js → diagram-MPIPVDR6-dfqeqa1d.js} +1 -1
- package/dist/client/static/js/{dockerfile-4rtt6c0f.js → dockerfile-yxrt509r.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-x9p9jqe8.js → ebnfDiagram-ZINNZB2B-s0b0vv4k.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-fw7waks3.js → elk-276RUBZZ-mtpw0spa.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-fdfgzr5d.js → erDiagram-OPXOYQCR-agjdsm1b.js} +4 -4
- package/dist/client/static/js/{erlang-trjm07as.js → erlang-6m6tpt72.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-cx3ztxfz.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-267mw6sv.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-2avbqgdr.js → ganttDiagram-FUAMR5RP-z6ywqqc1.js} +1 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-eg9r85ak.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-9jmc0a3g.js → gitGraphDiagram-X574FWY7-bvbmfw6h.js} +2 -2
- package/dist/client/static/js/graphql-skw5krjr.js +1 -0
- package/dist/client/static/js/{index-a8ffattk.js → index-059qyaj0.js} +2 -2
- package/dist/client/static/js/{index-8f9x7ev8.js → index-09gx6edj.js} +1 -1
- package/dist/client/static/js/index-0mvcbbmy.js +12 -0
- package/dist/client/static/js/{index-fvc0x6nx.js → index-0sqa91wb.js} +3 -3
- package/dist/client/static/js/{index-8mwragbj.js → index-15zn3sns.js} +2 -2
- package/dist/client/static/js/{index-4vybd9e7.js → index-1tyvk778.js} +1 -1
- package/dist/client/static/js/{index-43qpbxjv.js → index-1y9r4frb.js} +2 -2
- package/dist/client/static/js/{index-a628fg4m.js → index-21b3zyrd.js} +2 -2
- package/dist/client/static/js/{index-vnw3hbeg.js → index-302d35e5.js} +27 -27
- package/dist/client/static/js/{index-jc1yagmk.js → index-3zc1b0dv.js} +2 -2
- package/dist/client/static/js/{index-t6c0pd43.js → index-49dhv8ry.js} +2 -2
- package/dist/client/static/js/{index-xxtsm2rb.js → index-5fn0agag.js} +2 -2
- package/dist/client/static/js/{index-yq39qbs1.js → index-64mb65wx.js} +2 -2
- package/dist/client/static/js/{index-xs1m0bpt.js → index-6q80csr0.js} +1 -1
- package/dist/client/static/js/{index-pc6eg8h2.js → index-72t6kqjx.js} +2 -2
- package/dist/client/static/js/{index-y3ms153k.js → index-7fdp9c7m.js} +2 -2
- package/dist/client/static/js/{index-py2k8std.js → index-7sa2e8mn.js} +2 -2
- package/dist/client/static/js/{index-7q02xnvq.js → index-83ts8zmk.js} +1 -1
- package/dist/client/static/js/{index-9ketbkh6.js → index-8e0s9p45.js} +1 -1
- package/dist/client/static/js/{index-tp7yb3bv.js → index-a0bdavdr.js} +2 -2
- package/dist/client/static/js/{index-7ct7qrsp.js → index-actppd4z.js} +2 -2
- package/dist/client/static/js/{index-k7q01ye4.js → index-cx89yk15.js} +2 -2
- package/dist/client/static/js/{index-vq6wts05.js → index-dt7e1328.js} +2 -2
- package/dist/client/static/js/{index-w7tpgt46.js → index-es3pt29g.js} +1 -1
- package/dist/client/static/js/{index-pzbssnsc.js → index-gbfg0anm.js} +2 -2
- package/dist/client/static/js/{index-qqz6bcdd.js → index-h7pn9qw6.js} +2 -2
- package/dist/client/static/js/{index-kdkfyrja.js → index-hbtk0c12.js} +2 -2
- package/dist/client/static/js/index-j7r414hf.js +2 -0
- package/dist/client/static/js/{index-ee2p07eg.js → index-jpkj6vqp.js} +1 -1
- package/dist/client/static/js/{index-nb8tp4mj.js → index-k06med7d.js} +30 -30
- package/dist/client/static/js/{index-8x9ecxb0.js → index-kzhtmrh0.js} +1 -1
- package/dist/client/static/js/{index-3ecsp1rx.js → index-m3j5yx5f.js} +3 -3
- package/dist/client/static/js/{index-sdby39w4.js → index-m87yykre.js} +3 -3
- package/dist/client/static/js/{index-ek2e773p.js → index-nmc30xaz.js} +1 -1
- package/dist/client/static/js/{index-p16scjt7.js → index-ntxm8pw3.js} +2 -2
- package/dist/client/static/js/{index-0v34a7wf.js → index-pd0140dx.js} +1 -1
- package/dist/client/static/js/{index-zh2jj56s.js → index-qkscve6n.js} +2 -2
- package/dist/client/static/js/{index-whbtxmwh.js → index-qz8mbxm9.js} +2 -2
- package/dist/client/static/js/{index-ncrenheb.js → index-qznwd6g8.js} +160 -160
- package/dist/client/static/js/{index-6f6cmcbq.js → index-sa9cp6km.js} +2 -2
- package/dist/client/static/js/{index-jmxqefe3.js → index-sezz011q.js} +1 -1
- package/dist/client/static/js/{index-rbgemjsp.js → index-t07b31ny.js} +3 -3
- package/dist/client/static/js/index-tcegdd2t.js +1 -0
- package/dist/client/static/js/{index-1wjp16f0.js → index-vtbbfwx0.js} +2 -2
- package/dist/client/static/js/{index-2v1nmxwr.js → index-w9zxmev3.js} +5 -5
- package/dist/client/static/js/{index-w5373tg1.js → index-we1rpftn.js} +2 -2
- package/dist/client/static/js/{index-b8s3xraa.js → index-xearvz2z.js} +5 -5
- package/dist/client/static/js/{index-rv89xpaf.js → index-xya34x4v.js} +2 -2
- package/dist/client/static/js/{index-mc4nefs7.js → index-z0frtyje.js} +1 -1
- package/dist/client/static/js/{index-7smwzkvq.js → index-z6g74h7g.js} +2 -2
- package/dist/client/static/js/{index-rkn0bxxt.js → index-z7qnffwj.js} +1 -1
- package/dist/client/static/js/{index-pnt0vc59.js → index-zvfvqvn9.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-7qhah7fs.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-g2dky5xg.js → infoDiagram-VRGFBTTK-58bv28d4.js} +1 -1
- package/dist/client/static/js/ini-cg0a5wm3.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-exrcjwp1.js → ishikawaDiagram-OU5B5YK6-tz6b0caw.js} +1 -1
- package/dist/client/static/js/java-vcck089n.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-pn752qa5.js → journeyDiagram-ZHPQQLJL-ydamm17a.js} +2 -2
- package/dist/client/static/js/jsx-ht9zyzwa.js +1 -0
- package/dist/client/static/js/{julia-evn99h2m.js → julia-v7j460gw.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-v8nvr373.js → kanban-definition-PNTS6WVX-7jxfsf17.js} +1 -1
- package/dist/client/static/js/lua-ke895s2q.js +1 -0
- package/dist/client/static/js/markdown-gwmsh53r.js +1 -0
- package/dist/client/static/js/{mermaid.core-egzv89zv.js → mermaid.core-vty0aq6f.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-t9njmv2w.js → mindmap-definition-NLK3R4M7-ra4wrts4.js} +2 -2
- package/dist/client/static/js/one-dark-pro-2pywnqrh.js +1 -0
- package/dist/client/static/js/one-light-vfgdt4wf.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-ag2g7tbk.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-zhycy2b7.js → pegDiagram-GJSIUBJH-ydjcfea9.js} +1 -1
- package/dist/client/static/js/{perl-506fy8m8.js → perl-gg4jdkcr.js} +1 -1
- package/dist/client/static/js/{php-axtsvxck.js → php-2q8fm6k8.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-nqcyj3x1.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-sgctvma2.js → pieDiagram-5QR66LMP-wh04y7wp.js} +1 -1
- package/dist/client/static/js/properties-mzvvbqg5.js +1 -0
- package/dist/client/static/js/python-3w64wsyd.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-kzzhdcph.js → quadrantDiagram-O4NWA36T-4mhbag8n.js} +1 -1
- package/dist/client/static/js/r-32re2zwb.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-60gby7be.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-cnkmcjse.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-qgfdnazd.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-609h6cpx.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-xqnytjhg.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-nzjffwxm.js → railroadDiagram-XR7U4H2S-pagmr4hc.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-tz4xxn4d.js → requirementDiagram-PLB6GJNP-jhfhp4eq.js} +1 -1
- package/dist/client/static/js/{ruby-qp7zfk2m.js → ruby-vag6a82m.js} +1 -1
- package/dist/client/static/js/{rust-fz913fvw.js → rust-yntkm6hw.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2wcb0xr6.js → sankeyDiagram-IPEJSGJF-qrfxzvp3.js} +2 -2
- package/dist/client/static/js/{sass-gnk9vsyp.js → sass-kbwea482.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-vqgebfns.js → sequenceDiagram-PO4LG4MO-fpznwnva.js} +5 -5
- package/dist/client/static/js/{sizeCapture-INFHLROL-xc314tes.js → sizeCapture-INFHLROL-3hz930jg.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-8bd9b1h8.js → stateDiagram-v2-GCMORJYK-2m99syxm.js} +2 -2
- package/dist/client/static/js/{svelte-brpgzrtv.js → svelte-mwtx07d9.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-t6hbdzcw.js → swimlanes-2SLR337P-hmhd360r.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-a8b7z74e.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-2txxasx5.js → timeline-definition-EJHVYXUP-765y3ssa.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-8djqab8k.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-hdztnffk.js +1 -0
- package/dist/client/static/js/tsx-nm94hed6.js +1 -0
- package/dist/client/static/js/typescript-0s2t05jj.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-3x353hn4.js → usecaseDiagram-POWQR4AR-rex2j507.js} +2 -2
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-cerpss8e.js → vennDiagram-UO4OBE2U-wd51qq26.js} +1 -1
- package/dist/client/static/js/{vue-apnkw9qy.js → vue-j8vb9d7r.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-avby77vv.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-cx6jfsbf.js → wardleyDiagram-VNRHLVJA-6jdqn8f7.js} +1 -1
- package/dist/client/static/js/xml-81hxjjt4.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-tgn23xj1.js → xychartDiagram-PMCCYNJV-kcz8y04e.js} +2 -2
- package/dist/client/static/js/yaml-yssayv8a.js +1 -0
- package/package.json +1 -1
- package/src/client/components/settings/apply-side-effects.test.ts +5 -4
- package/src/client/components/settings/categories/ConnectSettings.tsx +8 -1
- package/src/client/components/settings/categories/connect-settings/CloudflareConfig.test.tsx +84 -0
- package/src/client/components/settings/categories/connect-settings/CloudflareConfig.tsx +68 -0
- package/src/client/components/settings/categories/connect-settings/PairDialog.test.tsx +49 -49
- package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +12 -8
- package/src/client/components/settings/categories/connect-settings/QrCode.tsx +19 -2
- package/src/client/hooks/connect/use-connect-status.ts +44 -19
- package/src/client/hooks/connect/use-pairing.ts +5 -0
- package/src/client/hooks/ui/icon-style.ts +7 -4
- package/src/client/hooks/ui/style-attributes.test.ts +11 -11
- package/src/client/hooks/ui/surface-style.ts +8 -5
- package/src/client/lib/notifications/watch.ts +4 -1
- package/src/server/lib/assets/shell-attributes.server.ts +12 -9
- package/src/server/lib/assets/shell-attributes.test.ts +18 -13
- package/src/server/lib/connect/cloudflared-config.server.ts +236 -0
- package/src/server/lib/connect/cloudflared-config.test.ts +245 -0
- package/src/server/lib/connect/cloudflared.lifecycle.test.ts +116 -15
- package/src/server/lib/connect/cloudflared.server.ts +53 -66
- package/src/server/lib/connect/pairing.server.ts +33 -0
- package/src/server/lib/connect/qr-png.server.test.ts +93 -0
- package/src/server/lib/connect/qr-png.server.ts +119 -0
- package/src/server/lib/connect/status.server.ts +10 -4
- package/src/server/routes/connect/index.ts +2 -0
- package/src/server/routes/connect/pair-qr.test.ts +72 -0
- package/src/server/routes/connect/pair-qr.ts +44 -0
- package/src/server/routes/connect/pair.ts +8 -2
- package/src/server/routes/connect/tunnels.test.ts +141 -0
- package/src/server/routes/connect/tunnels.ts +32 -7
- package/src/server/routes/notifications/stream.ts +11 -2
- package/src/shared/lib/connect/types.ts +7 -0
- package/src/shared/lib/icons/icon-paint-authority.ts +5 -3
- package/src/shared/lib/theme/icon-style.test.ts +8 -5
- package/src/shared/lib/theme/icon-style.ts +15 -7
- package/src/shared/lib/theme/surface-style.test.ts +8 -5
- package/src/shared/lib/theme/surface-style.ts +17 -7
- package/src/shared/lib/workspace/sidebar-style.test.ts +7 -8
- package/src/shared/lib/workspace/sidebar-style.ts +7 -8
- package/dist/client/static/js/architecture-7GRP2DOG-bajpnvy7.js +0 -1
- package/dist/client/static/js/bash-0h36tk0k.js +0 -1
- package/dist/client/static/js/cpp-4wp9sy20.js +0 -1
- package/dist/client/static/js/css-c9nsbkh6.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-8q9e90m8.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-kn4hsm3p.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-ah8cvps1.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-hvavh16n.js +0 -1
- package/dist/client/static/js/graphql-hbkmxsty.js +0 -1
- package/dist/client/static/js/index-btr2w8cq.js +0 -12
- package/dist/client/static/js/index-dfzrpy54.js +0 -2
- package/dist/client/static/js/index-sbd5e816.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-fmjz8qwg.js +0 -1
- package/dist/client/static/js/ini-72yrpvd4.js +0 -1
- package/dist/client/static/js/java-ab5tb2ra.js +0 -1
- package/dist/client/static/js/jsx-25zj9j3k.js +0 -1
- package/dist/client/static/js/lua-j5w0c9wm.js +0 -1
- package/dist/client/static/js/markdown-j6hn4377.js +0 -1
- package/dist/client/static/js/one-dark-pro-bm3r4js7.js +0 -1
- package/dist/client/static/js/one-light-e07dt7sy.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-cwr6n1cm.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-h1ebfzgt.js +0 -1
- package/dist/client/static/js/properties-q8njes42.js +0 -1
- package/dist/client/static/js/python-vqxc7181.js +0 -1
- package/dist/client/static/js/r-0k5eej8m.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-k7p1m364.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-d08dw3t0.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-txnjycgk.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-p0r3cv6w.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-sryk900a.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-c1czc7kv.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-77kj68p1.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-rw94xc82.js +0 -1
- package/dist/client/static/js/tsx-yd5wt250.js +0 -1
- package/dist/client/static/js/typescript-v7z7crfe.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-18xe4fhz.js +0 -1
- package/dist/client/static/js/xml-94fhzrfs.js +0 -1
- package/dist/client/static/js/yaml-s8af9rnw.js +0 -1
- package/src/client/components/settings/categories/connect-settings/qr-image.ts +0 -76
- package/src/server/lib/connect/cloudflared.server.test.ts +0 -65
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{d,n,i,V,o,u,a,Ar,e,gr,li,Gn,hp,we,S,yp,Mf,ir,or,s,Ma,Be,Pa,m,Bn,M,D,Xe,f,B,ie,et,ae,he,fe,Sn,Jt,Tn,Y,C,ct,va,F,fi,tn,b,ce,Du,no,J,rt,at,dt,Ve,ge}from"./index-ncrenheb.js";import{mp,fr}from"./index-p16scjt7.js";var Tt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},_e=s(Tt);var At={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},je=s(At);function Ue({message:t,hasStagedChanges:c,isBusy:l=!1,amend:r=!1,seeded:p=!1,onToggleAmend:h,onChangeMessage:g,onCommit:v}){let y=t.trim().length>0&&!l&&(r||c),L=r?"Rewrite the previous commit with this message":c?"Commit staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[e("textarea",{value:t,onChange:(N)=>g(N.currentTarget.value),onKeyDown:(N)=>{if(N.key==="Enter"&&(N.metaKey||N.ctrlKey)&&y)N.preventDefault(),v()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("div",{className:"flex items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(N)=>h?.(N.currentTarget.checked),className:`${ge} accent-ink cursor-pointer`}),"Amend"]}),r&&p&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:v,disabled:!y,title:L,className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function We({operation:t,conflicts:c,isBusy:l,onAbort:r,onContinue:p}){let h=li[t],g=c.length,v=g===0,y=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(D,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[h.charAt(0).toUpperCase()+h.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${g} conflict${g===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:c.map((L)=>e("div",{className:"truncate",title:L,children:L},L))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:l,title:`Abort the ${h} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(tn,{size:12}),"Abort ",h]}),y&&e("button",{type:"button",onClick:p,disabled:l||!v,title:v?`Conclude the ${h}`:`Resolve all ${g} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Sn,{size:12}),"Continue ",h]})]})]})}function qe({branchRef:t,showBranchMenu:c,setShowBranchMenu:l,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:y,onManageBranches:L,optionsRef:N,showOptions:G,setShowOptions:R,onHistory:P,onGraph:T,viewMode:k,setViewMode:x,isBusy:w=!1,syncCount:E={ahead:0,behind:0},syncing:z=!1,onSync:I,onFetch:A,detached:H=!1}){return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>l(!c),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:H?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(fe,{size:12,className:H?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${H?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),c&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-56 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[p.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),p.map((O)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(O),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:O}),r===O&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==O&&e("button",{type:"button",onClick:()=>{v(O),l(!1)},title:`Merge ${O} into ${r}`,"aria-label":`Merge ${O} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Sn,{size:12})})]},O))]}),h.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),h.map((O)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(O),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:O}),r===O&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==O&&e("button",{type:"button",onClick:()=>{v(O),l(!1)},title:`Merge ${O} into ${r}`,"aria-label":`Merge ${O} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Sn,{size:12})})]},O))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{y(),l(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(Y,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:L,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(fi,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:N,children:[e("button",{type:"button",onClick:A,disabled:w,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(Ma,{size:13})}),e("button",{type:"button",onClick:I,disabled:w,title:z?"Syncing with upstream…":E.ahead>0&&E.behind>0?`Pull ${E.behind} then push ${E.ahead} commit(s)`:E.ahead>0?`Push ${E.ahead} commit(s)`:E.behind>0?`Pull ${E.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":z,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${z?"":"disabled:opacity-40"}`,children:[e(C,{size:13,className:z?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",E.ahead," ↓",E.behind]})]}),e("button",{type:"button",onClick:P,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Bn,{size:13})}),e("button",{type:"button",onClick:T,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Sn,{size:13})}),e("button",{type:"button",onClick:()=>R(!G),title:"View Options","aria-label":"View Options","aria-expanded":G,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Be,{size:13})}),G&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{x("flat"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(je,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),k==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{x("tree"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(_e,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),k==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Ke({activeRepo:t,repos:c,isRefreshing:l,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e("div",{className:"p-3 border-b border-ink/10 flex items-center justify-between",children:[e("div",{className:"flex items-center gap-1.5 min-w-0",children:[e(mp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(fr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:c,scanning:p,onRefreshRepos:v})]}),e("div",{className:"flex space-x-2 text-ink/40",children:e("button",{type:"button",onClick:g,title:"Refresh","aria-label":"Refresh",className:"hover:text-ink cursor-pointer inline-flex",children:e(ct,{size:14,className:l?"animate-spin":""})})})]})}function Te({change:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let h=Gn(t.status,c),{charStatus:g,colorClass:v}=h,y=t.file.split("/"),L=y.pop()||t.file,N=y.length>0?y.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:c,status:g,repo:l||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${h.label}`,children:g}),e(rt,{name:L,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:L}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!c&&e(d,{children:[e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}),c&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})]})})]})}function Ye({change:t,repo:c,rootPath:l,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),y=t.file.split("/"),L=y.pop()||t.file,N=y.length>0?y.join("/"):"",G=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:c,root:l}}))},R=async()=>{let k=!p;if(h(k),k&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:c||"."});if(l)x.set("root",l);try{let E=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(E.markers??{})}catch{v({})}}},P=g?.ours||"ours",T=g?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:G,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Pa,{size:11,className:"text-warning flex-shrink-0"}),e(rt,{name:L,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:L}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N}),gr(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),R()},title:p?"Hide resolve actions":"Show resolve actions","aria-label":p?"Hide resolve actions":"Show resolve actions","aria-expanded":p,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors flex-shrink-0",children:p?e(et,{size:11}):e(B,{size:11})})]}),p&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${P} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",P]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${T} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",T]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Bt(t){let c={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let p=r.file.replace(/^[./]+/,""),h=p.endsWith("/"),g=p.replace(/\/$/,"").split("/").filter(Boolean),v=c,y="";for(let L=0;L<g.length;L++){let N=g[L];y=y?`${y}/${N}`:N;let G=L===g.length-1;if(G&&!h)v.children.push({id:y,name:N,path:y,type:"file",change:r,children:[],changeCount:1});else{let P=v.children.find((T)=>T.type==="folder"&&T.name===N);if(!P)P={id:y,name:N,path:y,type:"folder",children:[],changeCount:0,change:G&&h?r:void 0},v.children.push(P);v=P}}}function l(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=l(h);return r.changeCount=p,r.children.sort((h,g)=>{if(h.type==="folder"&&g.type==="file")return-1;if(h.type==="file"&&g.type==="folder")return 1;return h.name.localeCompare(g.name)}),p}return l(c),c.children}function Ze(t){let{sessionId:c,ready:l,read:r}=yp(),p=u(()=>Bt(t),[t]),h=u(()=>{let R=new Set;function P(T){for(let k of T)if(k.type==="folder"){if(R.add(k.id),k.children&&k.children.length>0)P(k.children)}}return P(p),R},[p]),[g,v]=S("git.expandedFolders",[]),y=u(()=>new Set(g),[g]),L=o(null);i(()=>{if(!l||L.current===c)return;if(h.size===0)return;if(L.current=c,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[l,c,h,r,v]);let N=a((R)=>{v((P)=>{let T=new Set(P);if(T.has(R))T.delete(R);else T.add(R);return Array.from(T)})},[v]),G=a((R)=>y.has(R),[y]);return{tree:p,expandedFolders:y,toggleFolder:N,isFolderOpen:G,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function Ae({node:t,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",y=v?l(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:y?e(B,{size:12}):e(ie,{size:12})}),e(rt,{name:t.name,isFolder:!0,isOpen:y,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})})})]}),y&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((k)=>e(Ae,{node:k,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g},k.id))})]});let L=t.change,N=Gn(L?.status||"M",c),{charStatus:G,colorClass:R}=N,P=L?L.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:P,staged:c,status:G,repo:h||".",root:g}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${R}`,title:`Status: ${N.label}`,children:G})}),e(rt,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:P,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",P)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",P)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",P)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})})})]})}function Fe({changes:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=Ze(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((y)=>e(Ae,{node:y,isStaged:c,isFolderOpen:g,toggleFolder:v,onAction:p,repo:l,rootPath:r},y.id))})}function Qe({changes:t,isLoading:c,viewMode:l,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,y]=S("git.stagedExpanded",!0),[L,N]=S("git.unstagedExpanded",!0),[G,R]=S("git.conflictsExpanded",!0),P=t.filter((x)=>gr(x.status)),T=t.filter((x)=>{if(gr(x.status))return!1;let w=x.status;return w&&w[0]!==" "&&w[0]!=="?"}),k=t.filter((x)=>{if(gr(x.status))return!1;let w=x.status;return w&&w[1]!==" "&&w[1]!=="?"||w==="??"});if(c&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[P.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!G),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:G?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:P.length})]})}),G&&P.map((x)=>e(Ye,{change:x,repo:r,rootPath:p,onResolve:g??(()=>{})},`conflict-${x.file}`))]}),T.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>y(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:T.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:12})})})]}),v&&(l==="tree"?e(Fe,{changes:T,isStaged:!0,repo:r,rootPath:p,onAction:h}):T.map((x)=>e(Te,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),k.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!L),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:L?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:k.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:12})}),e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:12})})]})]}),L&&(l==="tree"?e(Fe,{changes:k,isStaged:!1,repo:r,rootPath:p,onAction:h}):k.map((x)=>e(Te,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function Je({matches:t,loaded:c,total:l,hasMore:r,isFiltering:p}){if(p)return`${t} of ${c} loaded`;if(typeof l==="number"&&l>0)return r||c<l?`${c} of ${l}`:`${l} commits`;return r?`${c}+ commits`:`${c} commits`}function tt({isGraphMode:t,onToggleMode:c,searchQuery:l,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:y,totalCount:L,hasMore:N}){let G=Je({matches:v,loaded:y,total:L,hasMore:N,isFiltering:l.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
|
|
2
|
-
pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:[e("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[e("div",{className:"flex flex-col min-w-0",children:[e("div",{className:"flex items-center gap-2.5 min-w-0",children:[e("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),e("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/50 border border-ink/10 whitespace-nowrap",children:G})]}),e("p",{className:"text-xs text-ink/50 mt-0.5 hidden lg:block",children:"Browse recent commits and inspect changed files."})]}),e("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[e("div",{className:"flex items-center bg-ink/5 p-0.5 rounded-lg border border-ink/10 text-xs",children:[e("button",{type:"button",onClick:()=>c(!1),title:"History view",className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${!t?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:[e(Bn,{size:13}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>c(!0),title:"Graph view",className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${t?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:[e(Sn,{size:13}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:p,disabled:g,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border border-ink/15 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer text-xs disabled:opacity-40",title:"Refresh commit history",children:[e(va,{size:13,className:g?"animate-spin text-ink":""}),e("span",{className:"hidden lg:inline",children:"refresh"})]}),e("button",{type:"button",onClick:h,className:"p-2 -mr-1 rounded-md hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors cursor-pointer",title:"Close modal",children:e(b,{size:16})})]})]}),e("div",{className:"relative mt-1",children:[e(F,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/40"}),e("input",{type:"text",value:l,onChange:(R)=>r(R.currentTarget.value),placeholder:"Filter commits by message, author, or hash...",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),l&&e("button",{type:"button",onClick:()=>r(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/40 hover:text-ink cursor-pointer",children:e(b,{size:12})})]})]})}var le=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function Ee(t,c){if(!t||!c)return!1;if(t===c)return!0;let l=Math.min(t.length,c.length);if(l>=4)return t.substring(0,l)===c.substring(0,l);return!1}function Re(t){let c=new Map,l=[];for(let r of t){if(typeof r.lane==="number"){c.set(r.hash,r.lane);continue}let p=l.findIndex((g)=>Ee(g,r.hash)||Ee(g,r.shortHash));if(p===-1)if(p=l.indexOf(null),p===-1)p=l.length,l.push(r.hash);else l[p]=r.hash;c.set(r.hash,p);let h=r.parents&&r.parents[0];if(h)l[p]=h;else l[p]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let v=r.parents[g];if(!l.some((L)=>Ee(L,v))){let L=l.indexOf(null);if(L===-1)l.push(v);else l[L]=v}}}return c}function nt(t,c,l,r){let p=[],h=new Map;t.forEach((g,v)=>{if(h.set(g.hash,v),g.shortHash)h.set(g.shortHash,v);if(g.hash.length>=7)h.set(g.hash.substring(0,7),v)});for(let g of t){let v=c.get(g.hash)??0,y=l[g.hash]??0,L=le[v%le.length];if(!g.parents||g.parents.length===0)continue;for(let N of g.parents){let G=h.get(N);if(typeof G!=="number"&&N.length>=7)G=h.get(N.substring(0,7));if(typeof G==="number"){let R=t[G],P=c.get(R.hash)??v,T=l[R.hash]??y+60;p.push({fromHash:g.hash,toHash:R.hash,fromLane:v,toLane:P,fromY:y,toY:T,color:le[v%le.length]})}else p.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:v,toLane:v,fromY:y,toY:Math.max(y+80,r),color:L})}}return p}function ot(t,c,l,r){if(Math.abs(t-l)<1)return`M ${t} ${c} L ${l} ${r}`;let p=r-c,h=c+p*0.45,g=r-p*0.45;return`M ${t} ${c} C ${t} ${h}, ${l} ${g}, ${l} ${r}`}function st({commits:t,nodePositions:c,selectedHash:l,hoveredHash:r,isGraphMode:p,laneWidth:h=18,paddingLeft:g=16,totalHeight:v}){let y=u(()=>{if(!p){let R=new Map;return t.forEach((P)=>R.set(P.hash,0)),R}return Re(t)},[t,p]),L=u(()=>{let R=0;return y.forEach((P)=>{if(P>R)R=P}),R},[y]),N=p?(L+1)*h+g*2:36,G=u(()=>{if(!p){let R=[];for(let P=0;P<t.length-1;P++){let T=c[t[P].hash]??P*60+20,k=c[t[P+1].hash]??(P+1)*60+20;R.push({fromHash:t[P].hash,toHash:t[P+1].hash,fromLane:0,toLane:0,fromY:T,toY:k,color:"var(--theme-ink)"})}return R}return nt(t,y,c,v)},[t,y,c,v,p]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:N,height:v},children:e("svg",{className:"w-full h-full overflow-visible",style:{width:N,height:v},children:[e("defs",{children:e("filter",{id:"node-glow",x:"-20%",y:"-20%",width:"140%",height:"140%",children:e("feDropShadow",{dx:"0",dy:"0",stdDeviation:"2",floodOpacity:"0.35"})})}),G.map((R)=>{let P=p?g+R.fromLane*h:16,T=p?g+R.toLane*h:16,k=p?R.color:"currentColor",x=p?0.95:0.25,w=ot(P,R.fromY,T,R.toY);return e("path",{d:w,fill:"none",stroke:k,strokeWidth:p?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let P=y.get(R.hash)??0,T=p?g+P*h:16,k=c[R.hash]??20,x=l===R.hash||l===R.shortHash,w=r===R.hash||r===R.shortHash,E=p?le[P%le.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(x||w)&&e("circle",{cx:T,cy:k,r:8,fill:E,fillOpacity:x?0.35:0.2,stroke:E,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:T,cy:k,r:p?4:4.5,fill:p?"var(--theme-paper)":E,stroke:E,strokeWidth:p?2.5:1.5,filter:"url(#node-glow)"}),p&&e("circle",{cx:T,cy:k,r:1.8,fill:E})]},`node-${R.hash}`)})]})})}function it({commit:t,onAction:c}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:[e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("checkout",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"checkout"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("create_branch_here",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"create branch here"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("cherry_pick",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"cherry-pick"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("revert",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"revert"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("reset",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"reset..."}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("merge",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"merge into current"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("rebase",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"rebase onto this"})]})}var Ge=3;function Ft(t){let c=[];for(let l=0;l<t.length;l+=1){if(t[l].type!=="context"){c.push({row:t[l],index:l});continue}let r=l;while(r<t.length&&t[r].type==="context")r+=1;let p=r-l;if(p>Ge*2+1){for(let h=l;h<l+Ge;h+=1)c.push({row:t[h],index:h});c.push({row:{type:"elided",count:p-Ge*2},index:-1});for(let h=r-Ge;h<r;h+=1)c.push({row:t[h],index:h})}else for(let h=l;h<r;h+=1)c.push({row:t[h],index:h});l=r-1}return c}function lt({diffText:t,isLoading:c,filePath:l,fullContext:r=!1,onToggleContext:p}){let h=no(),g=u(()=>{if(!t)return[];let N=[],G=1,R=1,P=t.split(/\r?\n/),k=P.some((x)=>x.startsWith("@@"))?P:[`@@ -0,0 +1,${P.length} @@`,...P.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of k){if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("---")||x.startsWith("+++")||x.startsWith("new file mode")||x.startsWith("deleted file mode")||x.startsWith("similarity index")||x.startsWith("old mode")||x.startsWith("new mode")||x.startsWith("\\ No newline"))continue;if(x.startsWith("@@")){let w=x.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(w)G=parseInt(w[1],10),R=parseInt(w[2],10);N.push({type:"meta",text:x})}else if(x.startsWith("+"))N.push({type:"add",text:x.slice(1),newNum:R++});else if(x.startsWith("-"))N.push({type:"del",text:x.slice(1),oldNum:G++});else{let w=x.startsWith(" ")?x.slice(1):x;N.push({type:"context",text:w,oldNum:G++,newNum:R++})}}return N},[t]),v=dt(l),y=u(()=>{let N=Array(g.length).fill(""),G=-1,R=(P)=>{if(G<0)return;let T=
|
|
1
|
+
import{d,n,i,V,o,u,a,Ar,e,gr,li,Gn,gp,we,S,bp,Rf,ir,or,s,Ma,Be,Pa,m,Bn,M,D,Xe,f,B,ie,et,ae,he,fe,Sn,Jt,Tn,Y,C,ct,va,F,fi,tn,b,ce,Tu,no,J,rt,at,dt,Ve,ge}from"./index-qznwd6g8.js";import{pp,fr}from"./index-ntxm8pw3.js";var Tt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},_e=s(Tt);var At={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},je=s(At);function Ue({message:t,hasStagedChanges:c,isBusy:l=!1,amend:r=!1,seeded:p=!1,onToggleAmend:h,onChangeMessage:g,onCommit:v}){let y=t.trim().length>0&&!l&&(r||c),L=r?"Rewrite the previous commit with this message":c?"Commit staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[e("textarea",{value:t,onChange:(N)=>g(N.currentTarget.value),onKeyDown:(N)=>{if(N.key==="Enter"&&(N.metaKey||N.ctrlKey)&&y)N.preventDefault(),v()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("div",{className:"flex items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(N)=>h?.(N.currentTarget.checked),className:`${ge} accent-ink cursor-pointer`}),"Amend"]}),r&&p&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:v,disabled:!y,title:L,className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function We({operation:t,conflicts:c,isBusy:l,onAbort:r,onContinue:p}){let h=li[t],g=c.length,v=g===0,y=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(D,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[h.charAt(0).toUpperCase()+h.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${g} conflict${g===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:c.map((L)=>e("div",{className:"truncate",title:L,children:L},L))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:l,title:`Abort the ${h} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(tn,{size:12}),"Abort ",h]}),y&&e("button",{type:"button",onClick:p,disabled:l||!v,title:v?`Conclude the ${h}`:`Resolve all ${g} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Sn,{size:12}),"Continue ",h]})]})]})}function qe({branchRef:t,showBranchMenu:c,setShowBranchMenu:l,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:y,onManageBranches:L,optionsRef:N,showOptions:G,setShowOptions:R,onHistory:P,onGraph:T,viewMode:k,setViewMode:x,isBusy:w=!1,syncCount:E={ahead:0,behind:0},syncing:z=!1,onSync:I,onFetch:A,detached:H=!1}){return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>l(!c),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:H?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(fe,{size:12,className:H?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${H?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),c&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-56 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[p.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),p.map((O)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(O),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:O}),r===O&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==O&&e("button",{type:"button",onClick:()=>{v(O),l(!1)},title:`Merge ${O} into ${r}`,"aria-label":`Merge ${O} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Sn,{size:12})})]},O))]}),h.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),h.map((O)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(O),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:O}),r===O&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==O&&e("button",{type:"button",onClick:()=>{v(O),l(!1)},title:`Merge ${O} into ${r}`,"aria-label":`Merge ${O} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Sn,{size:12})})]},O))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{y(),l(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(Y,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:L,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(fi,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:N,children:[e("button",{type:"button",onClick:A,disabled:w,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(Ma,{size:13})}),e("button",{type:"button",onClick:I,disabled:w,title:z?"Syncing with upstream…":E.ahead>0&&E.behind>0?`Pull ${E.behind} then push ${E.ahead} commit(s)`:E.ahead>0?`Push ${E.ahead} commit(s)`:E.behind>0?`Pull ${E.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":z,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${z?"":"disabled:opacity-40"}`,children:[e(C,{size:13,className:z?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",E.ahead," ↓",E.behind]})]}),e("button",{type:"button",onClick:P,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Bn,{size:13})}),e("button",{type:"button",onClick:T,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Sn,{size:13})}),e("button",{type:"button",onClick:()=>R(!G),title:"View Options","aria-label":"View Options","aria-expanded":G,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Be,{size:13})}),G&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{x("flat"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(je,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),k==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{x("tree"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(_e,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),k==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Ke({activeRepo:t,repos:c,isRefreshing:l,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e("div",{className:"p-3 border-b border-ink/10 flex items-center justify-between",children:[e("div",{className:"flex items-center gap-1.5 min-w-0",children:[e(pp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(fr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:c,scanning:p,onRefreshRepos:v})]}),e("div",{className:"flex space-x-2 text-ink/40",children:e("button",{type:"button",onClick:g,title:"Refresh","aria-label":"Refresh",className:"hover:text-ink cursor-pointer inline-flex",children:e(ct,{size:14,className:l?"animate-spin":""})})})]})}function Te({change:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let h=Gn(t.status,c),{charStatus:g,colorClass:v}=h,y=t.file.split("/"),L=y.pop()||t.file,N=y.length>0?y.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:c,status:g,repo:l||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${h.label}`,children:g}),e(rt,{name:L,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:L}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!c&&e(d,{children:[e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}),c&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})]})})]})}function Ye({change:t,repo:c,rootPath:l,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),y=t.file.split("/"),L=y.pop()||t.file,N=y.length>0?y.join("/"):"",G=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:c,root:l}}))},R=async()=>{let k=!p;if(h(k),k&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:c||"."});if(l)x.set("root",l);try{let E=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(E.markers??{})}catch{v({})}}},P=g?.ours||"ours",T=g?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:G,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Pa,{size:11,className:"text-warning flex-shrink-0"}),e(rt,{name:L,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:L}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N}),gr(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),R()},title:p?"Hide resolve actions":"Show resolve actions","aria-label":p?"Hide resolve actions":"Show resolve actions","aria-expanded":p,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors flex-shrink-0",children:p?e(et,{size:11}):e(B,{size:11})})]}),p&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${P} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",P]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${T} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",T]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Bt(t){let c={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let p=r.file.replace(/^[./]+/,""),h=p.endsWith("/"),g=p.replace(/\/$/,"").split("/").filter(Boolean),v=c,y="";for(let L=0;L<g.length;L++){let N=g[L];y=y?`${y}/${N}`:N;let G=L===g.length-1;if(G&&!h)v.children.push({id:y,name:N,path:y,type:"file",change:r,children:[],changeCount:1});else{let P=v.children.find((T)=>T.type==="folder"&&T.name===N);if(!P)P={id:y,name:N,path:y,type:"folder",children:[],changeCount:0,change:G&&h?r:void 0},v.children.push(P);v=P}}}function l(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=l(h);return r.changeCount=p,r.children.sort((h,g)=>{if(h.type==="folder"&&g.type==="file")return-1;if(h.type==="file"&&g.type==="folder")return 1;return h.name.localeCompare(g.name)}),p}return l(c),c.children}function Ze(t){let{sessionId:c,ready:l,read:r}=bp(),p=u(()=>Bt(t),[t]),h=u(()=>{let R=new Set;function P(T){for(let k of T)if(k.type==="folder"){if(R.add(k.id),k.children&&k.children.length>0)P(k.children)}}return P(p),R},[p]),[g,v]=S("git.expandedFolders",[]),y=u(()=>new Set(g),[g]),L=o(null);i(()=>{if(!l||L.current===c)return;if(h.size===0)return;if(L.current=c,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[l,c,h,r,v]);let N=a((R)=>{v((P)=>{let T=new Set(P);if(T.has(R))T.delete(R);else T.add(R);return Array.from(T)})},[v]),G=a((R)=>y.has(R),[y]);return{tree:p,expandedFolders:y,toggleFolder:N,isFolderOpen:G,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function Ae({node:t,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",y=v?l(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:y?e(B,{size:12}):e(ie,{size:12})}),e(rt,{name:t.name,isFolder:!0,isOpen:y,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})})})]}),y&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((k)=>e(Ae,{node:k,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g},k.id))})]});let L=t.change,N=Gn(L?.status||"M",c),{charStatus:G,colorClass:R}=N,P=L?L.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:P,staged:c,status:G,repo:h||".",root:g}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${R}`,title:`Status: ${N.label}`,children:G})}),e(rt,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:P,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",P)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",P)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",P)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:11})})})})]})}function Fe({changes:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=Ze(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((y)=>e(Ae,{node:y,isStaged:c,isFolderOpen:g,toggleFolder:v,onAction:p,repo:l,rootPath:r},y.id))})}function Qe({changes:t,isLoading:c,viewMode:l,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,y]=S("git.stagedExpanded",!0),[L,N]=S("git.unstagedExpanded",!0),[G,R]=S("git.conflictsExpanded",!0),P=t.filter((x)=>gr(x.status)),T=t.filter((x)=>{if(gr(x.status))return!1;let w=x.status;return w&&w[0]!==" "&&w[0]!=="?"}),k=t.filter((x)=>{if(gr(x.status))return!1;let w=x.status;return w&&w[1]!==" "&&w[1]!=="?"||w==="??"});if(c&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[P.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!G),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:G?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:P.length})]})}),G&&P.map((x)=>e(Ye,{change:x,repo:r,rootPath:p,onResolve:g??(()=>{})},`conflict-${x.file}`))]}),T.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>y(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:T.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Jt,{size:12})})})]}),v&&(l==="tree"?e(Fe,{changes:T,isStaged:!0,repo:r,rootPath:p,onAction:h}):T.map((x)=>e(Te,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),k.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!L),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:L?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:k.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(tn,{size:12})}),e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:12})})]})]}),L&&(l==="tree"?e(Fe,{changes:k,isStaged:!1,repo:r,rootPath:p,onAction:h}):k.map((x)=>e(Te,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function Je({matches:t,loaded:c,total:l,hasMore:r,isFiltering:p}){if(p)return`${t} of ${c} loaded`;if(typeof l==="number"&&l>0)return r||c<l?`${c} of ${l}`:`${l} commits`;return r?`${c}+ commits`:`${c} commits`}function tt({isGraphMode:t,onToggleMode:c,searchQuery:l,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:y,totalCount:L,hasMore:N}){let G=Je({matches:v,loaded:y,total:L,hasMore:N,isFiltering:l.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
|
|
2
|
+
pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:[e("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[e("div",{className:"flex flex-col min-w-0",children:[e("div",{className:"flex items-center gap-2.5 min-w-0",children:[e("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),e("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/50 border border-ink/10 whitespace-nowrap",children:G})]}),e("p",{className:"text-xs text-ink/50 mt-0.5 hidden lg:block",children:"Browse recent commits and inspect changed files."})]}),e("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[e("div",{className:"flex items-center bg-ink/5 p-0.5 rounded-lg border border-ink/10 text-xs",children:[e("button",{type:"button",onClick:()=>c(!1),title:"History view",className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${!t?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:[e(Bn,{size:13}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>c(!0),title:"Graph view",className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${t?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink hover:bg-ink/5"}`,children:[e(Sn,{size:13}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:p,disabled:g,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border border-ink/15 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer text-xs disabled:opacity-40",title:"Refresh commit history",children:[e(va,{size:13,className:g?"animate-spin text-ink":""}),e("span",{className:"hidden lg:inline",children:"refresh"})]}),e("button",{type:"button",onClick:h,className:"p-2 -mr-1 rounded-md hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors cursor-pointer",title:"Close modal",children:e(b,{size:16})})]})]}),e("div",{className:"relative mt-1",children:[e(F,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/40"}),e("input",{type:"text",value:l,onChange:(R)=>r(R.currentTarget.value),placeholder:"Filter commits by message, author, or hash...",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),l&&e("button",{type:"button",onClick:()=>r(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/40 hover:text-ink cursor-pointer",children:e(b,{size:12})})]})]})}var le=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function Ee(t,c){if(!t||!c)return!1;if(t===c)return!0;let l=Math.min(t.length,c.length);if(l>=4)return t.substring(0,l)===c.substring(0,l);return!1}function Re(t){let c=new Map,l=[];for(let r of t){if(typeof r.lane==="number"){c.set(r.hash,r.lane);continue}let p=l.findIndex((g)=>Ee(g,r.hash)||Ee(g,r.shortHash));if(p===-1)if(p=l.indexOf(null),p===-1)p=l.length,l.push(r.hash);else l[p]=r.hash;c.set(r.hash,p);let h=r.parents&&r.parents[0];if(h)l[p]=h;else l[p]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let v=r.parents[g];if(!l.some((L)=>Ee(L,v))){let L=l.indexOf(null);if(L===-1)l.push(v);else l[L]=v}}}return c}function nt(t,c,l,r){let p=[],h=new Map;t.forEach((g,v)=>{if(h.set(g.hash,v),g.shortHash)h.set(g.shortHash,v);if(g.hash.length>=7)h.set(g.hash.substring(0,7),v)});for(let g of t){let v=c.get(g.hash)??0,y=l[g.hash]??0,L=le[v%le.length];if(!g.parents||g.parents.length===0)continue;for(let N of g.parents){let G=h.get(N);if(typeof G!=="number"&&N.length>=7)G=h.get(N.substring(0,7));if(typeof G==="number"){let R=t[G],P=c.get(R.hash)??v,T=l[R.hash]??y+60;p.push({fromHash:g.hash,toHash:R.hash,fromLane:v,toLane:P,fromY:y,toY:T,color:le[v%le.length]})}else p.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:v,toLane:v,fromY:y,toY:Math.max(y+80,r),color:L})}}return p}function ot(t,c,l,r){if(Math.abs(t-l)<1)return`M ${t} ${c} L ${l} ${r}`;let p=r-c,h=c+p*0.45,g=r-p*0.45;return`M ${t} ${c} C ${t} ${h}, ${l} ${g}, ${l} ${r}`}function st({commits:t,nodePositions:c,selectedHash:l,hoveredHash:r,isGraphMode:p,laneWidth:h=18,paddingLeft:g=16,totalHeight:v}){let y=u(()=>{if(!p){let R=new Map;return t.forEach((P)=>R.set(P.hash,0)),R}return Re(t)},[t,p]),L=u(()=>{let R=0;return y.forEach((P)=>{if(P>R)R=P}),R},[y]),N=p?(L+1)*h+g*2:36,G=u(()=>{if(!p){let R=[];for(let P=0;P<t.length-1;P++){let T=c[t[P].hash]??P*60+20,k=c[t[P+1].hash]??(P+1)*60+20;R.push({fromHash:t[P].hash,toHash:t[P+1].hash,fromLane:0,toLane:0,fromY:T,toY:k,color:"var(--theme-ink)"})}return R}return nt(t,y,c,v)},[t,y,c,v,p]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:N,height:v},children:e("svg",{className:"w-full h-full overflow-visible",style:{width:N,height:v},children:[e("defs",{children:e("filter",{id:"node-glow",x:"-20%",y:"-20%",width:"140%",height:"140%",children:e("feDropShadow",{dx:"0",dy:"0",stdDeviation:"2",floodOpacity:"0.35"})})}),G.map((R)=>{let P=p?g+R.fromLane*h:16,T=p?g+R.toLane*h:16,k=p?R.color:"currentColor",x=p?0.95:0.25,w=ot(P,R.fromY,T,R.toY);return e("path",{d:w,fill:"none",stroke:k,strokeWidth:p?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let P=y.get(R.hash)??0,T=p?g+P*h:16,k=c[R.hash]??20,x=l===R.hash||l===R.shortHash,w=r===R.hash||r===R.shortHash,E=p?le[P%le.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(x||w)&&e("circle",{cx:T,cy:k,r:8,fill:E,fillOpacity:x?0.35:0.2,stroke:E,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:T,cy:k,r:p?4:4.5,fill:p?"var(--theme-paper)":E,stroke:E,strokeWidth:p?2.5:1.5,filter:"url(#node-glow)"}),p&&e("circle",{cx:T,cy:k,r:1.8,fill:E})]},`node-${R.hash}`)})]})})}function it({commit:t,onAction:c}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:[e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("checkout",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"checkout"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("create_branch_here",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"create branch here"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("cherry_pick",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"cherry-pick"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("revert",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"revert"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("reset",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"reset..."}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("merge",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"merge into current"}),e("button",{type:"button",onClick:(l)=>{l.stopPropagation(),c("rebase",t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer disabled:opacity-40",children:"rebase onto this"})]})}var Ge=3;function Ft(t){let c=[];for(let l=0;l<t.length;l+=1){if(t[l].type!=="context"){c.push({row:t[l],index:l});continue}let r=l;while(r<t.length&&t[r].type==="context")r+=1;let p=r-l;if(p>Ge*2+1){for(let h=l;h<l+Ge;h+=1)c.push({row:t[h],index:h});c.push({row:{type:"elided",count:p-Ge*2},index:-1});for(let h=r-Ge;h<r;h+=1)c.push({row:t[h],index:h})}else for(let h=l;h<r;h+=1)c.push({row:t[h],index:h});l=r-1}return c}function lt({diffText:t,isLoading:c,filePath:l,fullContext:r=!1,onToggleContext:p}){let h=no(),g=u(()=>{if(!t)return[];let N=[],G=1,R=1,P=t.split(/\r?\n/),k=P.some((x)=>x.startsWith("@@"))?P:[`@@ -0,0 +1,${P.length} @@`,...P.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of k){if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("---")||x.startsWith("+++")||x.startsWith("new file mode")||x.startsWith("deleted file mode")||x.startsWith("similarity index")||x.startsWith("old mode")||x.startsWith("new mode")||x.startsWith("\\ No newline"))continue;if(x.startsWith("@@")){let w=x.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(w)G=parseInt(w[1],10),R=parseInt(w[2],10);N.push({type:"meta",text:x})}else if(x.startsWith("+"))N.push({type:"add",text:x.slice(1),newNum:R++});else if(x.startsWith("-"))N.push({type:"del",text:x.slice(1),oldNum:G++});else{let w=x.startsWith(" ")?x.slice(1):x;N.push({type:"context",text:w,oldNum:G++,newNum:R++})}}return N},[t]),v=dt(l),y=u(()=>{let N=Array(g.length).fill(""),G=-1,R=(P)=>{if(G<0)return;let T=Tu(g.slice(G,P).map((k)=>k.text).join(`
|
|
3
3
|
`),v);for(let k=G;k<P;k++)N[k]=T[k-G]??"";G=-1};return g.forEach((P,T)=>{if(P.type==="meta")R(T);else if(G<0)G=T}),R(g.length),N},[g,v,h]),L=u(()=>r?g.map((N,G)=>({row:N,index:G})):Ft(g),[g,r]);if(c)return e("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-ink/40 font-mono text-xs flex items-center justify-center",children:"Loading commit diff..."});if(!t||g.length===0)return e("div",{className:"my-2 p-3 rounded bg-canvas border border-ink/10 text-ink/40 font-mono text-xs text-center",children:"No diff content available for this file."});return e("div",{className:"my-2 rounded border border-ink/15 bg-paper overflow-hidden text-[11px] font-mono leading-relaxed shadow-xs text-ink",children:[e("div",{className:"flex items-center justify-between px-3 py-1.5 bg-canvas border-b border-ink/10 text-ink/70 text-[10.5px]",children:[e("span",{className:"font-semibold text-meta",children:"Diff preview"}),e("button",{type:"button",onClick:p,disabled:!p,className:"hover:text-ink flex items-center gap-1 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-default",title:r?"Show only the changed hunks":"Read the whole file around the change","aria-pressed":r,children:r?e(d,{children:[e(et,{size:12})," Collapse context"]}):e(d,{children:[e(B,{size:12})," Expand all context"]})})]}),e("div",{className:"overflow-x-auto max-h-72 select-text",children:e("div",{className:"w-max min-w-full divide-y divide-ink/[0.04]",children:L.map(({row:N,index:G},R)=>{if(N.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-ink/40 text-[10px] text-center select-none",title:`${N.count} unchanged line(s) hidden`,children:["⋯ ",N.count," unchanged line",N.count===1?"":"s"," hidden ⋯"]},`elided-${R}`);let P=N,T=G;if(P.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-meta text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:P.text})]},T);let k=P.type==="add",x=P.type==="del";return e("div",{className:`flex items-start font-mono ${k?"bg-success/10 hover:bg-success/15":x?"bg-error/10 hover:bg-error/15":"text-ink hover:bg-ink/[0.02]"}`,children:[e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${x?"bg-error/15 text-error font-semibold":k?"bg-success/15 text-success/70":"bg-canvas/50 text-ink/40"}`,children:P.oldNum??(k?"+":"")}),e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${k?"bg-success/15 text-success font-semibold":x?"bg-error/15 text-error/70":"bg-canvas/50 text-ink/40"}`,children:P.newNum??(x?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${k?"text-success":x?"text-error":"opacity-0"}`,children:k?"+":x?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:P.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:y[T]}}):" "})]},T)})})})]})}function pt({commit:t,isSelected:c,isGraphMode:l,onSelect:r,onAction:p,onToggleFile:h,isExpandedFile:g,isLoadingFile:v,isFullContextFile:y,onToggleContext:L,fileDiffs:N,headerRef:G}){let[R,P]=n(!1),[T,k]=n(!1),x=t.body?.trim()??"",w=x.length>0,E=(A)=>{A.stopPropagation(),navigator.clipboard.writeText(t.hash),P(!0),setTimeout(()=>P(!1),2000)},z=(A,H)=>{A.stopPropagation(),h(t.hash,H)};return e("div",{onClick:()=>{if(r(t),!w)return;let A=globalThis.getSelection?.();if(A&&!A.isCollapsed)return;k((H)=>!H)},"data-testid":"commit-row","data-commit-hash":t.hash,className:`border-b border-ink/5 transition-colors cursor-pointer ${c?"bg-ink/[0.03]":"hover:bg-ink/[0.015]"}`,children:e("div",{className:"py-2.5 pr-4 pl-1 flex flex-col",children:[e("div",{className:"flex flex-col gap-1",children:[t.refs&&t.refs.length>0&&e("div",{className:"flex flex-wrap items-center gap-1.5 pb-0.5",children:t.refs.map((A,H)=>{let O=A.includes("stash"),X=A.includes("HEAD")||A.includes("main")||A.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${O?"bg-warning/10 text-warning border-warning/25 font-semibold":X?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-meta border-ink/10 font-medium"}`,children:A},H)})}),e("div",{ref:G,className:"flex items-start gap-1.5",children:[e("span",{"data-commit-title":"",className:"text-[13px] font-semibold text-ink leading-snug break-words flex-1 min-w-0",children:t.message}),w&&e("span",{className:"text-ink/40 flex-shrink-0 mt-0.5","aria-hidden":"true",children:T?e(B,{size:13}):e(ie,{size:13})})]}),w&&T&&e("div",{className:"text-[12px] text-ink/70 leading-relaxed whitespace-pre-wrap break-words border-l-2 border-ink/15 pl-2.5 py-0.5 font-mono",children:x}),e("div",{className:"flex items-center gap-2 text-[11px] text-ink/50 font-mono flex-wrap",children:[e("span",{children:t.author}),e("span",{children:"•"}),e("span",{children:t.date}),e("span",{children:"•"}),e("button",{type:"button",onClick:E,title:"Copy commit hash",className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[e("span",{children:t.shortHash}),R?e(f,{size:11,className:"text-success"}):e(ae,{size:11})]})]})]}),(c||l)&&e("div",{className:"mt-2",children:e(it,{commit:t,onAction:p})}),t.files&&t.files.length>0&&e("div",{className:"mt-2 flex flex-col gap-1",children:t.files.map((A,H)=>{let O=g(t.hash,A.file),X=`${t.hash}:${A.file}`,te=N[X]!==void 0?N[X]:A.diff,j=v(t.hash,A.file),K=A.status==="A"?"text-success font-bold":A.status==="D"?"text-error font-bold":A.status==="R"?"text-meta font-bold":"text-info font-bold";return e("div",{className:"flex flex-col",children:[e("div",{onClick:(W)=>z(W,A),className:"flex items-center gap-2 py-1 px-2 rounded hover:bg-ink/5 text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10",children:[e("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${K}`,children:A.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:A.file}),e("span",{className:"flex items-center gap-1 text-[10.5px] tabular-nums flex-shrink-0 font-medium",children:[e("span",{className:"text-success",children:["+",A.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error",children:["-",A.deletions]})]}),e("span",{className:"text-ink/40 group-hover:text-ink flex-shrink-0",children:O?e(B,{size:13}):e(ie,{size:13})})]}),O&&e("div",{className:"pl-4 pr-1",children:e(lt,{diffText:te,isLoading:j,filePath:A.file,fullContext:y(t.hash,A.file),onToggleContext:()=>L(t.hash,A)})})]},H)})})]})})}var xe=50;function Et(t){if(!Array.isArray(t))return[];let c=[];for(let l of t){if(!l||typeof l!=="object")continue;let r=l;if(typeof r.file!=="string"||!r.file)continue;c.push({file:r.file,status:typeof r.status==="string"?r.status:"M",additions:typeof r.additions==="number"&&Number.isFinite(r.additions)?r.additions:0,deletions:typeof r.deletions==="number"&&Number.isFinite(r.deletions)?r.deletions:0,diff:typeof r.diff==="string"?r.diff:void 0})}return c}function ze(t){if(!Array.isArray(t))return[];let c=[];for(let l of t){if(!l||typeof l!=="object")continue;let r=l,p=typeof r.hash==="string"&&r.hash?r.hash:"";if(!p)continue;c.push({hash:p,shortHash:typeof r.shortHash==="string"&&r.shortHash?r.shortHash:p.slice(0,8),author:typeof r.author==="string"?r.author:"Unknown",date:typeof r.date==="string"?r.date:typeof r.time==="string"?r.time:"",message:typeof r.message==="string"?r.message:"",body:typeof r.body==="string"?r.body:void 0,parents:Array.isArray(r.parents)?r.parents.filter((h)=>typeof h==="string"):[],refs:Array.isArray(r.refs)?r.refs.filter((h)=>typeof h==="string"):[],files:Et(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return c}function mt({output:t,isGraphMode:c,rootPath:l,activeRepo:r}){let[p,h]=n(!1),[g,v]=n(t?.hasMore??t?.data?.length===xe),[y,L]=n(t?.total),N=u(()=>ze(t?.data),[t?.data]),G=Array.isArray(t?.data)?t.data.length:0,[R,P]=n(N),[T,k]=n(G);i(()=>{if(P(N),k(G),v(t?.hasMore??G===xe),typeof t?.total==="number")L(t.total)},[N,G,t?.hasMore,t?.total]);let x=a(async()=>{if(p||!g)return;h(!0);try{let w=new FormData;if(w.set("actionType",c?"graph":"history"),w.set("limit",String(xe)),w.set("skip",String(T)),l)w.set("root",l);if(r)w.set("repo",r);let z=await(await fetch("/api/fs/git",{method:"POST",body:w})).json();if(z.success&&Array.isArray(z.data)){let I=ze(z.data),A=z.data.length;if(P((H)=>{let O=new Set(H.map((te)=>te.hash)),X=I.filter((te)=>!O.has(te.hash));return[...H,...X]}),k((H)=>H+A),v(Boolean(z.hasMore??A===xe)),typeof z.total==="number")L(z.total)}else v(!1)}catch(w){console.error("Failed to load more commits:",w)}finally{h(!1)}},[p,g,c,T,l,r]);return{commits:R,hasMore:g,totalCount:y,isLoadingMore:p,handleLoadMore:x}}function ut({onExecuteAction:t,rootPath:c,activeRepo:l}){let[r,p]=n({}),[h,g]=n(new Set),[v,y]=n(new Set),[L,N]=n(new Set),G=a(async(k,x,w)=>{let E=`${k}:${x.file}`;y((z)=>new Set(z).add(E));try{let z=new FormData;if(z.set("actionType","commit_diff"),z.set("hash",k),z.set("file",x.file),w)z.set("full","1");if(c)z.set("root",c);if(l&&l!==".")z.set("repo",l);let A=await(await fetch("/api/fs/git",{method:"POST",body:z})).json();if(A&&typeof A.diff==="string")p((H)=>({...H,[E]:A.diff}));else if(A&&A.error)p((H)=>({...H,[E]:`// Error: ${A.error}`}))}catch(z){console.error("Failed to load file diff:",z);let I=z instanceof Error?z.message:"Network error";p((A)=>({...A,[E]:`// Error loading diff: ${I}`}))}finally{y((z)=>{let I=new Set(z);return I.delete(E),I})}},[c,l]),R=a(async(k,x)=>{let w=`${k}:${x.file}`,E=!h.has(w);if(g((z)=>{let I=new Set(z);if(I.has(w))I.delete(w);else I.add(w);return I}),E&&r[w]===void 0&&!x.diff)await G(k,x,!1)},[h,r,G]),P=a(async(k,x)=>{let w=`${k}:${x.file}`,E=!L.has(w);N((z)=>{let I=new Set(z);if(I.has(w))I.delete(w);else I.add(w);return I}),await G(k,x,E)},[L,G]),T=a((k,x)=>{if(!t)return;if(k==="checkout")t("checkout",void 0,{branch:x.hash});else if(k==="create_branch_here"){let w=window.prompt(`Create new branch at commit ${x.shortHash}:`,`branch-${x.shortHash}`);if(w?.trim())t("create_branch_at",void 0,{branch:w.trim(),hash:x.hash})}else if(k==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${x.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:x.hash})}else if(k==="revert"){if(window.confirm(`Revert commit ${x.shortHash}?`))t("revert_commit",void 0,{hash:x.hash})}else if(k==="reset"){let w=window.prompt(`Reset current branch to ${x.shortHash} (soft, mixed, hard):`,"soft");if(w&&["soft","mixed","hard"].includes(w.toLowerCase()))t("reset_commit",void 0,{hash:x.hash,mode:w.toLowerCase()})}else if(k==="merge"){if(window.confirm(`Merge commit ${x.shortHash} into current branch?`))t("merge_commit",void 0,{hash:x.hash})}else if(k==="rebase"){if(window.confirm(`Rebase current branch onto commit ${x.shortHash}?`))t("rebase_commit",void 0,{hash:x.hash})}},[t]);return{fileDiffs:r,expandedFiles:h,loadingFiles:v,fullContextFiles:L,handleToggleFile:R,handleToggleContext:P,handleCommitAction:T}}function He({output:t,onClose:c,onRefresh:l,onExecuteAction:r,rootPath:p,activeRepo:h}){if(!t)return null;let[g,v]=n(()=>({title:t.title,graph:t.title.toLowerCase().includes("graph")}));if(g.title!==t.title)v({title:t.title,graph:t.title.toLowerCase().includes("graph")});let y=g.graph,L=(U)=>v((_)=>({..._,graph:U})),[N,G]=n(""),[R,P]=n(""),[T,k]=n(!1),{commits:x,hasMore:w,totalCount:E,isLoadingMore:z,handleLoadMore:I}=mt({output:t,isGraphMode:y,rootPath:p,activeRepo:h}),{fileDiffs:A,expandedFiles:H,loadingFiles:O,fullContextFiles:X,handleToggleFile:te,handleToggleContext:j,handleCommitAction:K}=ut({onExecuteAction:r,rootPath:p,activeRepo:h});i(()=>{if(x.length>0&&!R)P(x[0].hash)},[x,R]);let W=u(()=>{if(!N.trim())return x;let U=N.toLowerCase().trim();return x.filter((_)=>_.message.toLowerCase().includes(U)||_.author.toLowerCase().includes(U)||_.shortHash.toLowerCase().includes(U)||_.hash.toLowerCase().includes(U)||_.refs?.some((ee)=>ee.toLowerCase().includes(U)))},[x,N]),ne=o(null),se=o(null),be=o(null),de=o({}),[pe,ve]=n({}),[Se,Pe]=n(800);i(()=>{let U=be.current;if(!U||!w||z||N.trim())return;let _=new IntersectionObserver((ee)=>{if(ee[0].isIntersecting)I()},{root:ne.current,threshold:0.1});return _.observe(U),()=>_.disconnect()},[w,z,N,I]);let re=a(()=>{if(!ne.current||!se.current)return;let U=ne.current.getBoundingClientRect(),_=ne.current.scrollTop,ee={};W.forEach((me,Le)=>{let ue=de.current[me.hash];if(ue){let oe=ue.getBoundingClientRect();ee[me.hash]=oe.top+oe.height/2-U.top+_}else ee[me.hash]=Le*60+20}),ve(ee);let Ce=se.current.offsetHeight;Pe(Math.max(Ce,ne.current.clientHeight,600))},[W]);V(()=>{re();let U=requestAnimationFrame(()=>{re()});return()=>cancelAnimationFrame(U)},[re,W,A,H,y,R]),i(()=>{let U=se.current;if(!U)return;let _=new ResizeObserver(()=>{re()});_.observe(U);for(let ee of Array.from(U.children))_.observe(ee);return()=>_.disconnect()},[re,W]);let Z=u(()=>Re(W),[W]),$e=u(()=>{let U=0;return Z.forEach((_)=>{if(_>U)U=_}),U},[Z]),ye=18,ke=16,Me=y?($e+1)*ye+ke*2:36;return e("div",{className:"fixed inset-0 z-50 modal-scrim backdrop-blur-xs flex items-center justify-center p-0 lg:p-5",onClick:c,role:"dialog","aria-modal":"true",children:e("div",{className:`glass-overlay bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden
|
|
4
4
|
w-full h-full rounded-none border-0
|
|
5
5
|
lg:w-[min(94vw,1200px)] lg:h-[88vh] lg:rounded-xl lg:border
|
|
6
|
-
pt-[env(safe-area-inset-top,0px)] lg:pt-0`,onClick:(U)=>U.stopPropagation(),children:[e(tt,{isGraphMode:y,onToggleMode:L,searchQuery:N,onSearchChange:G,onRefresh:()=>{k(!0),l?.(),setTimeout(()=>k(!1),600)},onClose:c,isRefreshing:T,totalCommits:W.length,loadedCount:x.length,totalCount:E,hasMore:w}),e("div",{ref:ne,className:"flex-1 overflow-y-auto scrollbar-overlay-container relative select-text",children:W.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-ink/40 font-mono text-xs",children:N.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(st,{commits:W,nodePositions:pe,selectedHash:R,isGraphMode:y,laneWidth:ye,paddingLeft:ke,totalHeight:Se}),e("div",{ref:se,className:"flex flex-col relative z-20",style:{paddingLeft:`${Me}px`},children:[W.map((U)=>e(pt,{commit:U,isSelected:R===U.hash,isGraphMode:y,onSelect:(_)=>P(_.hash),onAction:K,onToggleFile:te,isExpandedFile:(_,ee)=>H.has(`${_}:${ee}`),isLoadingFile:(_,ee)=>O.has(`${_}:${ee}`),isFullContextFile:(_,ee)=>X.has(`${_}:${ee}`),onToggleContext:j,fileDiffs:A,headerRef:(_)=>{de.current[U.hash]=_}},U.hash)),e("div",{ref:be,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:z?e("div",{className:"flex items-center gap-2 text-xs text-ink/60 font-mono py-2",children:[e(m,{size:14,className:"animate-spin text-info"}),e("span",{children:"Loading more commits..."})]}):w&&!N.trim()?e("button",{type:"button",onClick:I,className:"px-3 py-1.5 text-xs font-mono text-ink/70 hover:text-ink bg-ink/5 hover:bg-ink/10 rounded-md border border-ink/10 transition-colors cursor-pointer",children:"Load more commits..."}):W.length>10?e("div",{className:"text-[11px] font-mono text-ink/40 py-2",children:["End of commit history (",typeof E==="number"&&E>0?E:x.length," commits)"]}):null})]})]})})]})})}function ft({children:t,onClose:c}){return e("div",{className:"fixed inset-0 z-50 modal-scrim flex items-center justify-center p-4",onClick:c,role:"dialog","aria-modal":"true",children:e("div",{className:"glass-overlay bg-paper border border-ink/20 rounded-lg shadow-xl flex flex-col overflow-hidden w-[min(94vw,420px)] max-h-[80vh]",onClick:(l)=>l.stopPropagation(),children:t})})}function ht({modal:t,onClose:c,onConfirm:l}){if(!t)return null;return e(ft,{onClose:c,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(D,{size:16,className:"text-error flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Confirm Action"})]}),e("div",{className:"px-4 py-4 text-xs text-ink/80 leading-relaxed",children:t.message}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Confirm"})]})]})}function gt({isOpen:t,branchName:c,inputRef:l,onChange:r,onClose:p,onCreate:h}){if(!t)return null;let g=a(()=>{if(c.trim())h()},[c,h]);return e(ft,{onClose:p,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Sn,{size:16,className:"text-ink/60 flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Create New Branch"})]}),e("div",{className:"px-4 py-4",children:e("input",{ref:l,type:"text",value:c,onChange:(v)=>r(v.currentTarget.value),onKeyDown:(v)=>{if(v.key==="Enter")g();if(v.key==="Escape")p()},placeholder:"branch-name",className:"w-full bg-canvas border border-ink/20 rounded px-3 py-2 text-xs focus:outline-none focus:border-ink/40 text-ink placeholder-ink/40 transition-colors"})}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:p,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:g,disabled:!c.trim(),className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Create"})]})]})}function xt({branch:t,detached:c,onCheckout:l,onMerge:r,onRename:p,onDelete:h}){let g=t.current&&!c;return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_minmax(0,9.5rem)_4.25rem_4rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:g&&e(f,{size:12,className:"text-ink","aria-label":"Current branch"})}),e("button",{type:"button",onClick:l,disabled:g,title:g?"Already on this branch":`Check out ${t.name}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:[e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(fe,{size:11,className:g?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${g?"font-semibold text-ink":"text-ink/90"}`,children:t.name})]}),t.subject&&e("div",{className:"h-4 flex items-center pl-[18px] min-w-0",children:e("span",{className:"truncate text-[10px] text-ink/40",title:t.subject,children:t.subject})})]}),e("div",{className:"h-5 flex items-center justify-end min-w-0",children:e(zt,{branch:t})}),e("div",{className:"h-5 flex items-center justify-end",children:t.date&&e("span",{className:"text-[10px] text-ink/40 truncate",children:t.date})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[!g&&e("button",{type:"button",onClick:r,title:`Merge ${t.name} into the current branch`,"aria-label":`Merge ${t.name} into the current branch`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Sn,{size:11})}),e("button",{type:"button",onClick:p,title:`Rename ${t.name}`,"aria-label":`Rename ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Tn,{size:11})}),!g&&e("button",{type:"button",onClick:h,title:`Delete ${t.name}`,"aria-label":`Delete ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(M,{size:11})})]})]})}function zt({branch:t}){if(t.gone)return e("span",{className:"text-[10px] font-mono text-warning border border-warning/30 rounded px-1 truncate",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"});if(!t.upstream)return e("span",{className:"text-[10px] font-mono text-ink/40 truncate",title:"No upstream: this branch has never been published",children:"unpublished"});return e("span",{className:"flex items-center gap-1 text-[10px] font-mono text-ink/50 min-w-0",children:[e("span",{className:"truncate",title:t.upstream,children:t.upstream}),(t.ahead>0||t.behind>0)&&e("span",{className:"tabular-nums text-ink/70 flex-shrink-0",children:[t.ahead>0&&`↑${t.ahead}`,t.behind>0&&`↓${t.behind}`]})]})}function bt({branch:t,onClose:c,onSubmit:l}){if(!t)return null;return e(Ht,{branch:t,onClose:c,onSubmit:l})}function Ht({branch:t,onClose:c,onSubmit:l}){let[r,p]=n(t.name),[h,g]=n(!1),v=r.trim(),y=v===t.name,L=v.length>0&&!y,N=()=>{if(L)l(t.name,v,h)};return e(J,{onClose:c,maxWidthClass:"max-w-[min(94vw,460px)]",header:e("div",{className:"flex items-center gap-2",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Rename branch"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:t.name})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3",children:[e("div",{children:[e("label",{className:"text-[10px] uppercase tracking-wider text-ink/50 font-semibold",htmlFor:"branch-rename-input",children:"New name"}),e("input",{id:"branch-rename-input",type:"text",value:r,autoFocus:!0,onChange:(G)=>p(G.currentTarget.value),onKeyDown:(G)=>{if(G.key==="Enter")N();if(G.key==="Escape")c()},className:"mt-1 w-full bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs font-mono text-ink focus:outline-none focus:border-ink/40 transition-colors"}),y&&v.length>0&&e("p",{className:"mt-1 text-[10px] text-ink/50",children:"The name is unchanged."})]}),e("div",{className:"text-[10px] font-mono text-ink/60 flex flex-col gap-0.5 border border-ink/10 rounded p-2 bg-canvas/40",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"upstream"}),e("span",{className:"truncate",children:t.upstream||"none (unpublished)"})]}),e("p",{className:"text-ink/40 leading-relaxed mt-0.5",children:"A local rename keeps this upstream unchanged — a plain push afterwards will refuse until the upstream matches the new name, which is what the remote option below does."})]}),e("label",{className:"flex items-start gap-2 text-[11px] text-ink/80 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:h,onChange:(G)=>g(G.currentTarget.checked),className:`${ge} accent-ink cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{children:"Also rename it on the remote"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git push -u ",t.upstream?t.upstream.split("/")[0]:"origin"," ",v||"<new>",e("br",{}),"git push ",t.upstream?t.upstream.split("/")[0]:"origin"," --delete ",t.name,e("br",{}),"git fetch --prune"]})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:N,disabled:!L,className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Rename"})]})]})}function vt({branch:t,force:c,onForceChange:l,onClose:r,onConfirm:p}){if(!t)return null;return e(J,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(D,{size:15,className:"text-error flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Delete branch"})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3 text-xs text-ink/80 leading-relaxed",children:[e("p",{children:["Delete ",e("span",{className:"font-mono font-semibold text-ink",children:t.name}),t.upstream&&e(d,{children:[" ","(tracks ",e("span",{className:"font-mono",children:t.upstream}),")"]}),"?"]}),e("div",{className:"text-[10px] font-mono text-ink/60 border border-ink/10 rounded p-2 bg-canvas/40 flex flex-col gap-0.5",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"last commit"}),e("span",{className:"truncate",children:t.subject||"–"})]}),e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"when"}),e("span",{children:t.date||"–"})]})]}),e("label",{className:"flex items-start gap-2 cursor-pointer select-none text-[11px]",children:[e("input",{type:"checkbox",checked:c,onChange:(h)=>l(h.currentTarget.checked),className:`${ge} accent-error cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-error font-medium",children:"Delete even if its commits are not merged"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git branch ",c?"-D":"-d"," ",t.name]}),e("span",{className:"text-ink/50",children:"Without this, git refuses when the branch holds commits no other branch has. Leaving it off is the safe default."})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:()=>p(t.name),className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:["Delete ",c?"(force)":""]})]})]})}function yt({isOpen:t,rootPath:c,repo:l,currentBranch:r,detached:p,isBusy:h,onClose:g,onAction:v,onConfirmDelete:y}){let[L,N]=n([]),[G,R]=n(!1),[P,T]=n(null),[k,x]=n(""),[w,E]=n(null),[z,I]=n(null),[A,H]=n(!1),O=a(async()=>{R(!0),T(null);let j=new URLSearchParams({branches:"1",repo:l||"."});if(c)j.set("root",c);try{let K=await fetch(`/api/fs/git?${j.toString()}`),W=await K.json();if(W.success&&Array.isArray(W.branches))N(W.branches);else T(W.error||`Failed to read branches (HTTP ${K.status})`)}catch(K){T(K instanceof Error?K.message:"Failed to read branches")}finally{R(!1)}},[c,l]);i(()=>{if(t)O()},[t,O]);let X=o(!1);i(()=>{if(!t){X.current=!1;return}if(X.current&&!h)O();X.current=h},[t,h,O]),i(()=>{if(!t)E(null),I(null),H(!1),x("")},[t]);let te=u(()=>{let j=k.trim().toLowerCase();if(!j)return L;return L.filter((K)=>K.name.toLowerCase().includes(j)||K.upstream.toLowerCase().includes(j))},[L,k]);if(!t)return null;return e(d,{children:[e(J,{onClose:g,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Branches"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:p?`detached at ${r}`:`on ${r}`})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(F,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:k,onChange:(j)=>x(j.currentTarget.value),placeholder:"Filter branches…","aria-label":"Filter branches",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:()=>void O(),disabled:G,title:"Refresh","aria-label":"Refresh branches",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(C,{size:12,className:G?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:G&&L.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Loading branches…"]}):P?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:P}):te.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:k.trim()?"No matching branches.":"No branches."}):te.map((j)=>e(xt,{branch:j,detached:p,onCheckout:()=>{v("checkout",{branch:j.name}),g()},onMerge:()=>{v("merge_branch",{branch:j.name}),g()},onRename:()=>E(j),onDelete:()=>{I(j),H(!1)}},j.name))})]}),e(bt,{branch:w,onClose:()=>E(null),onSubmit:(j,K,W)=>{v("rename_branch",{branch:j,newName:K,...W?{remote:"1"}:{}}),E(null)}},w?.name??"none"),e(vt,{branch:z,force:A,onForceChange:H,onClose:()=>{I(null),H(!1)},onConfirm:(j)=>{y(j,A),I(null),H(!1)}})]})}function kt({mounted:t,confirmModal:c,onCloseConfirm:l,onConfirm:r,branchPrompt:p,newBranchName:h,newBranchInputRef:g,onNewBranchNameChange:v,onCloseBranchPrompt:y,onCreateBranch:L,viewingOutput:N,onCloseOutput:G,onRefreshOutput:R,onExecuteAction:P,branchModalOpen:T,onCloseBranchModal:k,rootPath:x,activeRepo:w,currentBranch:E,detached:z,isBusy:I,onBranchAction:A,onConfirmDeleteBranch:H}){if(!t)return null;return e(d,{children:[e(ht,{modal:c,onClose:l,onConfirm:r}),e(gt,{isOpen:p,branchName:h,inputRef:g,onChange:v,onClose:y,onCreate:L}),e(He,{output:N,onClose:G,onRefresh:R,onExecuteAction:P,rootPath:x,activeRepo:w}),e(yt,{isOpen:T,rootPath:x,repo:w,currentBranch:E,detached:z,isBusy:I,onClose:k,onAction:A,onConfirmDelete:H})]})}function Ct({rootPath:t,repo:c,isBusy:l,onAction:r}){let[p,h]=S("git.stashExpanded",!1),[g,v]=n([]),[y,L]=n(!1),[N,G]=n(""),[R,P]=n(!1),T=Ar(),k=a(async()=>{L(!0);let w=new URLSearchParams({stashes:"1",repo:c||"."});if(t)w.set("root",t);try{let z=await(await fetch(`/api/fs/git?${w.toString()}`)).json();v(z.stashes??[])}catch{v([])}finally{L(!1)}},[t,c]);i(()=>{if(p)k()},[p,k,l]);let x=(w,E)=>{if(r(w,E),w==="stash_push")G(""),P(!1)};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:[e("button",{type:"button",onClick:()=>h(!p),"aria-expanded":p,"aria-controls":T,title:p?"Hide stashes":"Show stashes",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:p?"▾":"▸"}),e(Xe,{size:12}),e("span",{children:"Stash"}),g.length>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:g.length})]}),e("button",{type:"button",onClick:()=>x("stash_push",{...N.trim()?{message:N.trim()}:{},...R?{untracked:"1"}:{}}),disabled:l,title:"Stash the working tree",className:"mr-3 flex flex-shrink-0 items-center gap-1 px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Y,{size:10}),"Save"]})]}),e("div",{className:"section-reveal","data-expanded":p,id:T,inert:!p,children:e("div",{children:e("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("input",{type:"text",value:N,onChange:(w)=>G(w.currentTarget.value),placeholder:"Stash message (optional)","aria-label":"Stash message",className:"flex-1 min-w-0 bg-paper border border-ink/20 rounded px-2 py-1 text-[11px] text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("label",{className:"flex items-center gap-1 text-[10px] text-ink/60 cursor-pointer select-none flex-shrink-0",title:"Also stash untracked files (-u)",children:[e("input",{type:"checkbox",checked:R,onChange:(w)=>P(w.currentTarget.checked),className:`${ge} accent-ink cursor-pointer`}),"-u"]})]}),y&&g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"Loading…"}):g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"No stash entries."}):e("div",{className:"max-h-40 overflow-y-auto scrollbar-overlay-container flex flex-col",children:g.map((w)=>e("div",{className:"grid grid-cols-[4rem_minmax(0,1fr)_3.5rem_4.5rem] items-center gap-x-1 group/stash py-0.5",children:[e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:w.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:w.subject,children:w.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:w.date}),e("div",{className:"flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/stash:opacity-100",children:[e("button",{type:"button",onClick:()=>x("stash_apply",{ref:w.ref,pop:"1"}),disabled:l,title:"Pop: apply and remove the entry","aria-label":"Pop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(he,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_apply",{ref:w.ref}),disabled:l,title:"Apply: keep the entry","aria-label":"Apply stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(Xe,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_drop",{ref:w.ref}),disabled:l,title:"Drop: discard the entry (the stash is not recoverable from the panel)","aria-label":"Drop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors disabled:opacity-40",children:e(M,{size:10})})]})]},w.ref))})]})})})]})}function Nt({repo:t,isBusy:c,onInit:l}){let r=t==="."?"this folder":t;return e("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 text-center",children:[e(fe,{size:26,className:"text-ink/25","aria-hidden":!0}),e("div",{className:"font-mono space-y-1",children:[e("p",{className:"text-xs text-ink/70",children:"Not a Git repository"}),e("p",{className:"text-[11px] leading-4 text-ink/40",children:["Initialize one in ",r," to track changes, commit and manage branches."]})]}),e("button",{type:"button",onClick:l,disabled:c,"aria-label":"Initialize Git repository",title:`git init in ${r}`,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(fe,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function wt(t,c,l){let r=at(),{activeRepo:p,setActiveRepo:h,ready:g}=ir(t),{repos:v,scanning:y,rescan:L}=or(t,c),N=Mf(p,v),G=o(N);G.current=N;let R=o("");R.current=`${t??""}\x00${N}`;let P=o(""),T=o(""),k=o(void 0);if(r.data!==k.current)k.current=r.data,T.current=P.current;let x=c&&g?hp(`${t??""}\x00${N}`):null,w=we(x),E=o(w.refresh);E.current=w.refresh;let z=T.current===R.current?r.data:void 0,I=w.data??z,A=I?.syncCount??z?.syncCount,H=a((te)=>{if(!c)return;let j=te??G.current,K=new URLSearchParams;if(t)K.set("root",t);if(j&&j!==".")K.set("repo",j);K.set("sync","1"),K.set("t",String(Date.now())),P.current=R.current;let W=E.current;r.load(`/api/fs/git?${K.toString()}`).then(()=>W())},[c,t,r.load]);i(()=>{if(!g)return;H()},[l,t,c,g,N,H]);let O=r.state==="loading",X=O||w.refreshing;return{activeRepo:N,setActiveRepo:h,repos:v,reposScanning:y,refreshRepos:L,isReading:O,isRefreshing:X,data:I,syncCount:A,loadRepo:H,refreshTopic:w.refresh}}function Rt(t,c){let l=at(),r=o(null),p=a((h,g,v)=>{r.current={actionType:h,extra:v};let y=new FormData;if(y.append("actionType",h),y.append("repo",c),t)y.append("root",t);if(g)y.append("file",g);if(v)Object.entries(v).forEach(([L,N])=>y.append(L,N));l.submit(y,{method:"POST",action:"/api/fs/git"})},[c,t,l]);return{state:l.state,execute:p,data:l.data,lastAction:r.current}}function Gt({rootPath:t,repo:c,execute:l}){let{sessionId:r}=yp(),[p,h]=S("git.commitDraft",""),[g,v]=S("git.amend",!1),y=o(null),L=o(p);L.current=p;let N=o(g);N.current=g;let G=o(h);G.current=h,i(()=>{if(!g)return;if(L.current.trim().length>0)return;let T=new URLSearchParams({headMessage:"1"});if(t)T.set("root",t);if(c&&c!==".")T.set("repo",c);let k=!1;return fetch(`/api/fs/git?${T.toString()}`).then((x)=>x.json()).then((x)=>{if(k)return;if(!N.current||L.current.trim().length>0)return;let w=typeof x?.message==="string"?x.message:"";if(w.length===0)return;y.current=w,G.current(w)}).catch(()=>{}),()=>{k=!0}},[g,r,t,c]);let R=a((T)=>{if(T){v(!0);return}if(y.current!==null&&L.current===y.current)h("");y.current=null,v(!1)},[v,h]),P=a(()=>{l("commit",void 0,{message:L.current,...N.current?{amend:"1"}:{}}),h(""),v(!1),y.current=null},[l,v,h]);return{message:p,setMessage:h,amend:g,seeded:y.current!==null&&p===y.current,toggleAmend:R,commit:P}}var St=48;function Ot(t,c){let l=c?.branch?.trim()??"",r=(c?.hash??"").slice(0,7),p=c?.ref?.trim()||"stash@{0}";switch(t){case"init":return{done:"Initialized the repository"};case"fetch":return{done:"Fetched every remote"};case"push":return{done:"Pushed to upstream"};case"pull":return{done:"Pulled from upstream",stopped:"Pulled"};case"sync":return{done:"Synced with upstream",stopped:"Pulled, but nothing was pushed"};case"abort_operation":return{done:"Aborted the operation in progress"};case"continue_operation":return{done:"Concluded the operation"};case"commit":{if(c?.amend==="1")return{done:"Amended the last commit"};let h=(c?.message??"").split(`
|
|
6
|
+
pt-[env(safe-area-inset-top,0px)] lg:pt-0`,onClick:(U)=>U.stopPropagation(),children:[e(tt,{isGraphMode:y,onToggleMode:L,searchQuery:N,onSearchChange:G,onRefresh:()=>{k(!0),l?.(),setTimeout(()=>k(!1),600)},onClose:c,isRefreshing:T,totalCommits:W.length,loadedCount:x.length,totalCount:E,hasMore:w}),e("div",{ref:ne,className:"flex-1 overflow-y-auto scrollbar-overlay-container relative select-text",children:W.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-ink/40 font-mono text-xs",children:N.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(st,{commits:W,nodePositions:pe,selectedHash:R,isGraphMode:y,laneWidth:ye,paddingLeft:ke,totalHeight:Se}),e("div",{ref:se,className:"flex flex-col relative z-20",style:{paddingLeft:`${Me}px`},children:[W.map((U)=>e(pt,{commit:U,isSelected:R===U.hash,isGraphMode:y,onSelect:(_)=>P(_.hash),onAction:K,onToggleFile:te,isExpandedFile:(_,ee)=>H.has(`${_}:${ee}`),isLoadingFile:(_,ee)=>O.has(`${_}:${ee}`),isFullContextFile:(_,ee)=>X.has(`${_}:${ee}`),onToggleContext:j,fileDiffs:A,headerRef:(_)=>{de.current[U.hash]=_}},U.hash)),e("div",{ref:be,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:z?e("div",{className:"flex items-center gap-2 text-xs text-ink/60 font-mono py-2",children:[e(m,{size:14,className:"animate-spin text-info"}),e("span",{children:"Loading more commits..."})]}):w&&!N.trim()?e("button",{type:"button",onClick:I,className:"px-3 py-1.5 text-xs font-mono text-ink/70 hover:text-ink bg-ink/5 hover:bg-ink/10 rounded-md border border-ink/10 transition-colors cursor-pointer",children:"Load more commits..."}):W.length>10?e("div",{className:"text-[11px] font-mono text-ink/40 py-2",children:["End of commit history (",typeof E==="number"&&E>0?E:x.length," commits)"]}):null})]})]})})]})})}function ft({children:t,onClose:c}){return e("div",{className:"fixed inset-0 z-50 modal-scrim flex items-center justify-center p-4",onClick:c,role:"dialog","aria-modal":"true",children:e("div",{className:"glass-overlay bg-paper border border-ink/20 rounded-lg shadow-xl flex flex-col overflow-hidden w-[min(94vw,420px)] max-h-[80vh]",onClick:(l)=>l.stopPropagation(),children:t})})}function ht({modal:t,onClose:c,onConfirm:l}){if(!t)return null;return e(ft,{onClose:c,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(D,{size:16,className:"text-error flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Confirm Action"})]}),e("div",{className:"px-4 py-4 text-xs text-ink/80 leading-relaxed",children:t.message}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Confirm"})]})]})}function gt({isOpen:t,branchName:c,inputRef:l,onChange:r,onClose:p,onCreate:h}){if(!t)return null;let g=a(()=>{if(c.trim())h()},[c,h]);return e(ft,{onClose:p,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Sn,{size:16,className:"text-ink/60 flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Create New Branch"})]}),e("div",{className:"px-4 py-4",children:e("input",{ref:l,type:"text",value:c,onChange:(v)=>r(v.currentTarget.value),onKeyDown:(v)=>{if(v.key==="Enter")g();if(v.key==="Escape")p()},placeholder:"branch-name",className:"w-full bg-canvas border border-ink/20 rounded px-3 py-2 text-xs focus:outline-none focus:border-ink/40 text-ink placeholder-ink/40 transition-colors"})}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:p,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:g,disabled:!c.trim(),className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Create"})]})]})}function xt({branch:t,detached:c,onCheckout:l,onMerge:r,onRename:p,onDelete:h}){let g=t.current&&!c;return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_minmax(0,9.5rem)_4.25rem_4rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:g&&e(f,{size:12,className:"text-ink","aria-label":"Current branch"})}),e("button",{type:"button",onClick:l,disabled:g,title:g?"Already on this branch":`Check out ${t.name}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:[e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(fe,{size:11,className:g?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${g?"font-semibold text-ink":"text-ink/90"}`,children:t.name})]}),t.subject&&e("div",{className:"h-4 flex items-center pl-[18px] min-w-0",children:e("span",{className:"truncate text-[10px] text-ink/40",title:t.subject,children:t.subject})})]}),e("div",{className:"h-5 flex items-center justify-end min-w-0",children:e(zt,{branch:t})}),e("div",{className:"h-5 flex items-center justify-end",children:t.date&&e("span",{className:"text-[10px] text-ink/40 truncate",children:t.date})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[!g&&e("button",{type:"button",onClick:r,title:`Merge ${t.name} into the current branch`,"aria-label":`Merge ${t.name} into the current branch`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Sn,{size:11})}),e("button",{type:"button",onClick:p,title:`Rename ${t.name}`,"aria-label":`Rename ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Tn,{size:11})}),!g&&e("button",{type:"button",onClick:h,title:`Delete ${t.name}`,"aria-label":`Delete ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(M,{size:11})})]})]})}function zt({branch:t}){if(t.gone)return e("span",{className:"text-[10px] font-mono text-warning border border-warning/30 rounded px-1 truncate",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"});if(!t.upstream)return e("span",{className:"text-[10px] font-mono text-ink/40 truncate",title:"No upstream: this branch has never been published",children:"unpublished"});return e("span",{className:"flex items-center gap-1 text-[10px] font-mono text-ink/50 min-w-0",children:[e("span",{className:"truncate",title:t.upstream,children:t.upstream}),(t.ahead>0||t.behind>0)&&e("span",{className:"tabular-nums text-ink/70 flex-shrink-0",children:[t.ahead>0&&`↑${t.ahead}`,t.behind>0&&`↓${t.behind}`]})]})}function bt({branch:t,onClose:c,onSubmit:l}){if(!t)return null;return e(Ht,{branch:t,onClose:c,onSubmit:l})}function Ht({branch:t,onClose:c,onSubmit:l}){let[r,p]=n(t.name),[h,g]=n(!1),v=r.trim(),y=v===t.name,L=v.length>0&&!y,N=()=>{if(L)l(t.name,v,h)};return e(J,{onClose:c,maxWidthClass:"max-w-[min(94vw,460px)]",header:e("div",{className:"flex items-center gap-2",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Rename branch"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:t.name})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3",children:[e("div",{children:[e("label",{className:"text-[10px] uppercase tracking-wider text-ink/50 font-semibold",htmlFor:"branch-rename-input",children:"New name"}),e("input",{id:"branch-rename-input",type:"text",value:r,autoFocus:!0,onChange:(G)=>p(G.currentTarget.value),onKeyDown:(G)=>{if(G.key==="Enter")N();if(G.key==="Escape")c()},className:"mt-1 w-full bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs font-mono text-ink focus:outline-none focus:border-ink/40 transition-colors"}),y&&v.length>0&&e("p",{className:"mt-1 text-[10px] text-ink/50",children:"The name is unchanged."})]}),e("div",{className:"text-[10px] font-mono text-ink/60 flex flex-col gap-0.5 border border-ink/10 rounded p-2 bg-canvas/40",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"upstream"}),e("span",{className:"truncate",children:t.upstream||"none (unpublished)"})]}),e("p",{className:"text-ink/40 leading-relaxed mt-0.5",children:"A local rename keeps this upstream unchanged — a plain push afterwards will refuse until the upstream matches the new name, which is what the remote option below does."})]}),e("label",{className:"flex items-start gap-2 text-[11px] text-ink/80 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:h,onChange:(G)=>g(G.currentTarget.checked),className:`${ge} accent-ink cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{children:"Also rename it on the remote"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git push -u ",t.upstream?t.upstream.split("/")[0]:"origin"," ",v||"<new>",e("br",{}),"git push ",t.upstream?t.upstream.split("/")[0]:"origin"," --delete ",t.name,e("br",{}),"git fetch --prune"]})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:N,disabled:!L,className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Rename"})]})]})}function vt({branch:t,force:c,onForceChange:l,onClose:r,onConfirm:p}){if(!t)return null;return e(J,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(D,{size:15,className:"text-error flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Delete branch"})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3 text-xs text-ink/80 leading-relaxed",children:[e("p",{children:["Delete ",e("span",{className:"font-mono font-semibold text-ink",children:t.name}),t.upstream&&e(d,{children:[" ","(tracks ",e("span",{className:"font-mono",children:t.upstream}),")"]}),"?"]}),e("div",{className:"text-[10px] font-mono text-ink/60 border border-ink/10 rounded p-2 bg-canvas/40 flex flex-col gap-0.5",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"last commit"}),e("span",{className:"truncate",children:t.subject||"–"})]}),e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"when"}),e("span",{children:t.date||"–"})]})]}),e("label",{className:"flex items-start gap-2 cursor-pointer select-none text-[11px]",children:[e("input",{type:"checkbox",checked:c,onChange:(h)=>l(h.currentTarget.checked),className:`${ge} accent-error cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-error font-medium",children:"Delete even if its commits are not merged"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git branch ",c?"-D":"-d"," ",t.name]}),e("span",{className:"text-ink/50",children:"Without this, git refuses when the branch holds commits no other branch has. Leaving it off is the safe default."})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:()=>p(t.name),className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:["Delete ",c?"(force)":""]})]})]})}function yt({isOpen:t,rootPath:c,repo:l,currentBranch:r,detached:p,isBusy:h,onClose:g,onAction:v,onConfirmDelete:y}){let[L,N]=n([]),[G,R]=n(!1),[P,T]=n(null),[k,x]=n(""),[w,E]=n(null),[z,I]=n(null),[A,H]=n(!1),O=a(async()=>{R(!0),T(null);let j=new URLSearchParams({branches:"1",repo:l||"."});if(c)j.set("root",c);try{let K=await fetch(`/api/fs/git?${j.toString()}`),W=await K.json();if(W.success&&Array.isArray(W.branches))N(W.branches);else T(W.error||`Failed to read branches (HTTP ${K.status})`)}catch(K){T(K instanceof Error?K.message:"Failed to read branches")}finally{R(!1)}},[c,l]);i(()=>{if(t)O()},[t,O]);let X=o(!1);i(()=>{if(!t){X.current=!1;return}if(X.current&&!h)O();X.current=h},[t,h,O]),i(()=>{if(!t)E(null),I(null),H(!1),x("")},[t]);let te=u(()=>{let j=k.trim().toLowerCase();if(!j)return L;return L.filter((K)=>K.name.toLowerCase().includes(j)||K.upstream.toLowerCase().includes(j))},[L,k]);if(!t)return null;return e(d,{children:[e(J,{onClose:g,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Branches"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:p?`detached at ${r}`:`on ${r}`})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(F,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:k,onChange:(j)=>x(j.currentTarget.value),placeholder:"Filter branches…","aria-label":"Filter branches",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:()=>void O(),disabled:G,title:"Refresh","aria-label":"Refresh branches",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(C,{size:12,className:G?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:G&&L.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Loading branches…"]}):P?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:P}):te.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:k.trim()?"No matching branches.":"No branches."}):te.map((j)=>e(xt,{branch:j,detached:p,onCheckout:()=>{v("checkout",{branch:j.name}),g()},onMerge:()=>{v("merge_branch",{branch:j.name}),g()},onRename:()=>E(j),onDelete:()=>{I(j),H(!1)}},j.name))})]}),e(bt,{branch:w,onClose:()=>E(null),onSubmit:(j,K,W)=>{v("rename_branch",{branch:j,newName:K,...W?{remote:"1"}:{}}),E(null)}},w?.name??"none"),e(vt,{branch:z,force:A,onForceChange:H,onClose:()=>{I(null),H(!1)},onConfirm:(j)=>{y(j,A),I(null),H(!1)}})]})}function kt({mounted:t,confirmModal:c,onCloseConfirm:l,onConfirm:r,branchPrompt:p,newBranchName:h,newBranchInputRef:g,onNewBranchNameChange:v,onCloseBranchPrompt:y,onCreateBranch:L,viewingOutput:N,onCloseOutput:G,onRefreshOutput:R,onExecuteAction:P,branchModalOpen:T,onCloseBranchModal:k,rootPath:x,activeRepo:w,currentBranch:E,detached:z,isBusy:I,onBranchAction:A,onConfirmDeleteBranch:H}){if(!t)return null;return e(d,{children:[e(ht,{modal:c,onClose:l,onConfirm:r}),e(gt,{isOpen:p,branchName:h,inputRef:g,onChange:v,onClose:y,onCreate:L}),e(He,{output:N,onClose:G,onRefresh:R,onExecuteAction:P,rootPath:x,activeRepo:w}),e(yt,{isOpen:T,rootPath:x,repo:w,currentBranch:E,detached:z,isBusy:I,onClose:k,onAction:A,onConfirmDelete:H})]})}function Ct({rootPath:t,repo:c,isBusy:l,onAction:r}){let[p,h]=S("git.stashExpanded",!1),[g,v]=n([]),[y,L]=n(!1),[N,G]=n(""),[R,P]=n(!1),T=Ar(),k=a(async()=>{L(!0);let w=new URLSearchParams({stashes:"1",repo:c||"."});if(t)w.set("root",t);try{let z=await(await fetch(`/api/fs/git?${w.toString()}`)).json();v(z.stashes??[])}catch{v([])}finally{L(!1)}},[t,c]);i(()=>{if(p)k()},[p,k,l]);let x=(w,E)=>{if(r(w,E),w==="stash_push")G(""),P(!1)};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:[e("button",{type:"button",onClick:()=>h(!p),"aria-expanded":p,"aria-controls":T,title:p?"Hide stashes":"Show stashes",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:p?"▾":"▸"}),e(Xe,{size:12}),e("span",{children:"Stash"}),g.length>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:g.length})]}),e("button",{type:"button",onClick:()=>x("stash_push",{...N.trim()?{message:N.trim()}:{},...R?{untracked:"1"}:{}}),disabled:l,title:"Stash the working tree",className:"mr-3 flex flex-shrink-0 items-center gap-1 px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Y,{size:10}),"Save"]})]}),e("div",{className:"section-reveal","data-expanded":p,id:T,inert:!p,children:e("div",{children:e("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("input",{type:"text",value:N,onChange:(w)=>G(w.currentTarget.value),placeholder:"Stash message (optional)","aria-label":"Stash message",className:"flex-1 min-w-0 bg-paper border border-ink/20 rounded px-2 py-1 text-[11px] text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("label",{className:"flex items-center gap-1 text-[10px] text-ink/60 cursor-pointer select-none flex-shrink-0",title:"Also stash untracked files (-u)",children:[e("input",{type:"checkbox",checked:R,onChange:(w)=>P(w.currentTarget.checked),className:`${ge} accent-ink cursor-pointer`}),"-u"]})]}),y&&g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"Loading…"}):g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"No stash entries."}):e("div",{className:"max-h-40 overflow-y-auto scrollbar-overlay-container flex flex-col",children:g.map((w)=>e("div",{className:"grid grid-cols-[4rem_minmax(0,1fr)_3.5rem_4.5rem] items-center gap-x-1 group/stash py-0.5",children:[e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:w.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:w.subject,children:w.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:w.date}),e("div",{className:"flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/stash:opacity-100",children:[e("button",{type:"button",onClick:()=>x("stash_apply",{ref:w.ref,pop:"1"}),disabled:l,title:"Pop: apply and remove the entry","aria-label":"Pop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(he,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_apply",{ref:w.ref}),disabled:l,title:"Apply: keep the entry","aria-label":"Apply stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(Xe,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_drop",{ref:w.ref}),disabled:l,title:"Drop: discard the entry (the stash is not recoverable from the panel)","aria-label":"Drop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors disabled:opacity-40",children:e(M,{size:10})})]})]},w.ref))})]})})})]})}function Nt({repo:t,isBusy:c,onInit:l}){let r=t==="."?"this folder":t;return e("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 text-center",children:[e(fe,{size:26,className:"text-ink/25","aria-hidden":!0}),e("div",{className:"font-mono space-y-1",children:[e("p",{className:"text-xs text-ink/70",children:"Not a Git repository"}),e("p",{className:"text-[11px] leading-4 text-ink/40",children:["Initialize one in ",r," to track changes, commit and manage branches."]})]}),e("button",{type:"button",onClick:l,disabled:c,"aria-label":"Initialize Git repository",title:`git init in ${r}`,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(fe,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function wt(t,c,l){let r=at(),{activeRepo:p,setActiveRepo:h,ready:g}=ir(t),{repos:v,scanning:y,rescan:L}=or(t,c),N=Rf(p,v),G=o(N);G.current=N;let R=o("");R.current=`${t??""}\x00${N}`;let P=o(""),T=o(""),k=o(void 0);if(r.data!==k.current)k.current=r.data,T.current=P.current;let x=c&&g?gp(`${t??""}\x00${N}`):null,w=we(x),E=o(w.refresh);E.current=w.refresh;let z=T.current===R.current?r.data:void 0,I=w.data??z,A=I?.syncCount??z?.syncCount,H=a((te)=>{if(!c)return;let j=te??G.current,K=new URLSearchParams;if(t)K.set("root",t);if(j&&j!==".")K.set("repo",j);K.set("sync","1"),K.set("t",String(Date.now())),P.current=R.current;let W=E.current;r.load(`/api/fs/git?${K.toString()}`).then(()=>W())},[c,t,r.load]);i(()=>{if(!g)return;H()},[l,t,c,g,N,H]);let O=r.state==="loading",X=O||w.refreshing;return{activeRepo:N,setActiveRepo:h,repos:v,reposScanning:y,refreshRepos:L,isReading:O,isRefreshing:X,data:I,syncCount:A,loadRepo:H,refreshTopic:w.refresh}}function Rt(t,c){let l=at(),r=o(null),p=a((h,g,v)=>{r.current={actionType:h,extra:v};let y=new FormData;if(y.append("actionType",h),y.append("repo",c),t)y.append("root",t);if(g)y.append("file",g);if(v)Object.entries(v).forEach(([L,N])=>y.append(L,N));l.submit(y,{method:"POST",action:"/api/fs/git"})},[c,t,l]);return{state:l.state,execute:p,data:l.data,lastAction:r.current}}function Gt({rootPath:t,repo:c,execute:l}){let{sessionId:r}=bp(),[p,h]=S("git.commitDraft",""),[g,v]=S("git.amend",!1),y=o(null),L=o(p);L.current=p;let N=o(g);N.current=g;let G=o(h);G.current=h,i(()=>{if(!g)return;if(L.current.trim().length>0)return;let T=new URLSearchParams({headMessage:"1"});if(t)T.set("root",t);if(c&&c!==".")T.set("repo",c);let k=!1;return fetch(`/api/fs/git?${T.toString()}`).then((x)=>x.json()).then((x)=>{if(k)return;if(!N.current||L.current.trim().length>0)return;let w=typeof x?.message==="string"?x.message:"";if(w.length===0)return;y.current=w,G.current(w)}).catch(()=>{}),()=>{k=!0}},[g,r,t,c]);let R=a((T)=>{if(T){v(!0);return}if(y.current!==null&&L.current===y.current)h("");y.current=null,v(!1)},[v,h]),P=a(()=>{l("commit",void 0,{message:L.current,...N.current?{amend:"1"}:{}}),h(""),v(!1),y.current=null},[l,v,h]);return{message:p,setMessage:h,amend:g,seeded:y.current!==null&&p===y.current,toggleAmend:R,commit:P}}var St=48;function Ot(t,c){let l=c?.branch?.trim()??"",r=(c?.hash??"").slice(0,7),p=c?.ref?.trim()||"stash@{0}";switch(t){case"init":return{done:"Initialized the repository"};case"fetch":return{done:"Fetched every remote"};case"push":return{done:"Pushed to upstream"};case"pull":return{done:"Pulled from upstream",stopped:"Pulled"};case"sync":return{done:"Synced with upstream",stopped:"Pulled, but nothing was pushed"};case"abort_operation":return{done:"Aborted the operation in progress"};case"continue_operation":return{done:"Concluded the operation"};case"commit":{if(c?.amend==="1")return{done:"Amended the last commit"};let h=(c?.message??"").split(`
|
|
7
7
|
`)[0].trim();if(!h)return{done:"Commit created"};return{done:`Committed “${h.length>St?`${h.slice(0,St-1)}…`:h}”`}}case"checkout":return{done:l?`Switched to ${l}`:"Switched branch"};case"create_branch":case"create_branch_at":return{done:l?`Created branch ${l}`:"Created branch"};case"rename_branch":{let h=c?.newName?.trim()??"";return{done:l&&h?`Renamed ${l} to ${h}`:"Renamed branch"}}case"delete_branch":return{done:l?`Deleted branch ${l}`:"Deleted branch"};case"merge_branch":return{done:l?`Merged ${l}`:"Merged branch",stopped:l?`Merging ${l}`:"Merging the branch"};case"merge_commit":return{done:r?`Merged commit ${r}`:"Merged commit",stopped:r?`Merging ${r}`:"Merging the commit"};case"cherry_pick":return{done:r?`Cherry-picked ${r}`:"Cherry-picked commit",stopped:r?`Cherry-picking ${r}`:"Cherry-picking the commit"};case"revert_commit":return{done:r?`Reverted commit ${r}`:"Reverted commit",stopped:r?`Reverting ${r}`:"Reverting the commit"};case"rebase_commit":return{done:r?`Rebased onto ${r}`:"Rebased",stopped:r?`Rebasing onto ${r}`:"Rebasing"};case"reset_commit":{let h=c?.mode??"mixed";return{done:r?`Reset to ${r} (${h})`:`Reset (${h})`}}case"stash_push":return{done:"Stashed your changes"};case"stash_apply":return{done:c?.pop==="1"?`Popped ${p}`:`Applied ${p}`,stopped:c?.pop==="1"?`Popping ${p}`:`Applying ${p}`};case"stash_drop":return{done:`Dropped ${p}`};default:return null}}function Pt({actionType:t,extra:c,stopped:l}){let r=Ot(t,c);if(!l)return r?.done??null;let p=li[l]??l,h=r?.stopped??r?.done??"",g=t==="sync"?"resolve it above, then Sync again":"resolve it above";return h?`${h} — the ${p} stopped on a conflict; ${g}`:`The ${p} stopped on a conflict; ${g}`}function $t(t){let{fetcher:c,onPage:l,onReload:r,onSuccess:p,onError:h}=t,g=o(null),v=o({onPage:l,onReload:r,onSuccess:p,onError:h});v.current={onPage:l,onReload:r,onSuccess:p,onError:h},i(()=>{if(c.state!=="idle"||!c.data)return;let y=c.data;if(y===g.current)return;g.current=y;let L=v.current;if(y.type==="history"||y.type==="graph"){L.onPage({title:y.type==="graph"?"Git Graph":"Commit History",data:y.data||[],hasMore:y.hasMore,total:y.total});return}if(!y.success){L.onError(y.error||"Git operation failed");return}L.onReload();let N=c.lastAction,G=N?Pt({...N,stopped:y.stopped}):null;if(G)L.onSuccess(G,y.stopped?"warning":"success")},[c.state,c.data,c.lastAction])}function Mt(t,c,l,r){if(t==="revert")return{type:t,file:c,message:`Are you sure you want to discard changes in ${c}?`};if(t==="revert_all")return{type:t,message:"Are you sure you want to discard ALL unstaged changes? This cannot be undone."};if(t==="abort_operation"){let p=r?li[r]:"operation";return{type:t,message:`Abort the ${p}? Everything resolved so far is discarded and the working tree returns to its pre-${p} state.`}}if(t==="delete_branch"){let p=l?.branch??"",h=l?.force==="1";return{type:t,extra:{branch:p,...h?{force:"1"}:{}},message:h?`Delete branch ${p} even though its commits are not merged? This cannot be undone from the panel.`:`Delete branch ${p}?`}}if(t==="stash_drop"){let p=l?.ref||"the top entry";return{type:t,extra:{ref:l?.ref??""},message:`Drop ${p}? The stash entry is removed — this cannot be undone from the panel.`}}return null}function sr({className:t="",enabled:c=!0,rootPath:l,refreshKey:r=0}){let{activeRepo:p,setActiveRepo:h,repos:g,reposScanning:v,refreshRepos:y,isReading:L,isRefreshing:N,data:G,syncCount:R,loadRepo:P,refreshTopic:T}=wt(l,c,r),k=Rt(l,p),[x,w]=S("git.viewMode","flat"),[E,z]=n(!1),I=o(null),[A,H]=n(!1),O=o(null),[X,te]=n(null),[j,K]=n(!1),[W,ne]=n(""),se=o(null),[be,de]=n(!1),[pe,ve]=n(null),[Se,Pe]=n(!1),{pushToast:re}=Ve();i(()=>{Pe(!0)},[]),i(()=>{if(j&&se.current)se.current.focus()},[j]),$t({fetcher:k,onPage:ve,onReload:P,onSuccess:(q,Q)=>re(q,Q),onError:(q)=>re(q,"error")}),ce(I,()=>z(!1)),ce(O,()=>H(!1));let Z=k.execute,{message:$e,setMessage:ye,amend:ke,seeded:Me,toggleAmend:Oe,commit:U}=Gt({rootPath:l,repo:p,execute:Z}),_=(q,Q,Ne)=>{let Ie=Mt(q,Q,Ne,G?.state?.operation??null);if(Ie){te(Ie);return}Z(q,Q,Ne)},ee=(q,Q)=>{Z("resolve_conflict",q,Q?{side:Q}:void 0)},Ce=G?.branch||"main",me=G?.branches||["main"],Le=G?.remoteBranches||[],ue=G?.changes||[],oe=L||k.state!=="idle",De=k.state==="idle"?null:k.lastAction?.actionType??null,Lt=De==="sync"||De==="push"||De==="pull",Dt=ue.filter((q)=>{if(gr(q.status))return!1;let Q=q.status;return Q&&Q[0]!==" "&&Q[0]!=="?"});if(!c)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`flex flex-col h-full bg-paper relative ${t}`,children:[e(kt,{mounted:Se,confirmModal:X,onCloseConfirm:()=>te(null),onConfirm:()=>{if(X)Z(X.type,X.file,X.extra),te(null)},branchPrompt:j,newBranchName:W,newBranchInputRef:se,onNewBranchNameChange:ne,onCloseBranchPrompt:()=>{K(!1),ne("")},onCreateBranch:()=>{if(W.trim())Z("create_branch",void 0,{branch:W.trim()}),K(!1),ne("")},viewingOutput:pe,onCloseOutput:()=>ve(null),onRefreshOutput:()=>{if(pe)Z(pe.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(q,Q,Ne)=>Z(q,Q,Ne),branchModalOpen:be,onCloseBranchModal:()=>de(!1),rootPath:l,activeRepo:p,currentBranch:Ce,detached:G?.state?.detached??!1,isBusy:oe,onBranchAction:(q,Q)=>Z(q,void 0,Q),onConfirmDeleteBranch:(q,Q)=>{Z("delete_branch",void 0,{branch:q,...Q?{force:"1"}:{}})}}),e(Ke,{activeRepo:p,repos:g,isRefreshing:N,rootPath:l,reposScanning:v,onSelectRepo:(q)=>{if(q!==p)h(q)},onRefresh:()=>{T(),P()},onRefreshRepos:y}),G?.isRepo===!1?e(Nt,{repo:p,isBusy:oe,onInit:()=>Z("init")}):e(d,{children:[e(qe,{branchRef:O,showBranchMenu:A,setShowBranchMenu:H,branch:Ce,branches:me,remoteBranches:Le,onCheckout:(q)=>Z("checkout",void 0,{branch:q}),onMerge:(q)=>Z("merge_branch",void 0,{branch:q}),onOpenBranchPrompt:()=>K(!0),onManageBranches:()=>{de(!0),H(!1)},optionsRef:I,showOptions:E,setShowOptions:z,onHistory:()=>Z("history"),onGraph:()=>Z("graph"),viewMode:x,setViewMode:w,isBusy:oe,syncCount:R,syncing:Lt,onSync:()=>Z("sync"),onFetch:()=>Z("fetch"),detached:G?.state?.detached??!1}),G?.state?.operation?e(We,{operation:G.state.operation,conflicts:G.state.conflicts,isBusy:oe,onAbort:()=>_("abort_operation"),onContinue:()=>Z("continue_operation")}):e(Ue,{message:$e,hasStagedChanges:Dt.length>0,isBusy:oe,amend:ke,seeded:Me,onToggleAmend:Oe,onChangeMessage:ye,onCommit:U}),e(Qe,{changes:ue,isLoading:oe,viewMode:x,repo:p,rootPath:l,onAction:_,onResolve:ee}),e(Ct,{rootPath:l,repo:p,isBusy:oe,onAction:(q,Q)=>_(q,void 0,Q)})]})]})}export{sr as GitPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d,u,le,e,
|
|
1
|
+
import{d,u,le,e,IA,we,I,B,ie,vr,C,Rs,Fu,Lp,lg,Mp,Pp}from"./index-qznwd6g8.js";function k({phase:t,index:o,collapsed:a,currentKey:i,onToggle:x}){let m=Mp(t),r=t.tasks.length>0&&m===t.tasks.length;return e("div",{className:"overflow-hidden rounded-lg border border-ink/10 bg-paper",children:[e("button",{type:"button",onClick:x,"aria-expanded":!a,className:"flex w-full items-center gap-1.5 border-b border-ink/8 bg-canvas/40 px-2.5 py-1.5 text-left hover:bg-ink/5",children:[a?e(ie,{size:12,className:"shrink-0 text-ink/40"}):e(B,{size:12,className:"shrink-0 text-ink/40"}),e("span",{className:`min-w-0 flex-1 truncate text-[10px] font-semibold uppercase tracking-wider ${r?"text-ink/35":"text-ink/60"}`,title:t.name,children:[o+1,". ",t.name]}),e("span",{className:"shrink-0 font-mono text-[10px] text-ink/40",children:[m,"/",t.tasks.length]})]}),!a&&e("div",{className:"divide-y divide-ink/[0.05] p-0.5",children:t.tasks.length===0?e("div",{className:"px-2.5 py-1.5 text-[11px] text-ink/40",children:"No tasks in this phase"}):t.tasks.map((l,f)=>e(Pp,{task:l,current:i===`${o}:${f}`},`${f}-${l.content}`))})]})}function j({className:t="",active:o=!0}){let[a]=le(),i=a.get("sessionId"),[x,m]=Rs("todo.collapsedPhases",{}),{data:r,isLoading:l,refreshing:f,stale:g,refresh:b}=we(i?IA(i):null,{enabled:o}),s=r?.snapshot??null,p=r?.progress??null,v=u(()=>{let n=lg(s?.phases??[]);return n?`${n.phase}:${n.task}`:null},[s]);if(!i)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`flex h-full w-full min-w-0 flex-col overflow-hidden bg-paper text-ink ${t}`,children:[e("div",{className:"flex flex-shrink-0 items-center justify-between gap-3 border-b border-ink/10 px-3.5 py-2.5",children:[e("div",{className:"flex min-w-0 items-center gap-2",children:[e("h2",{className:"text-xs font-semibold uppercase tracking-wider text-ink",children:"Todos"}),s&&e("span",{className:"truncate font-mono text-[10.5px] text-ink/50",title:Fu(p),children:Fu(p)}),r?.isMock&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/60",children:"Mock"})]}),e("button",{type:"button",onClick:b,disabled:l,title:"Refresh todos","aria-label":"Refresh todos",className:"flex-shrink-0 rounded-md border border-ink/15 bg-paper p-1.5 text-ink/80 transition-colors hover:bg-ink/5 disabled:opacity-50",children:e(C,{size:12,className:l||f?"animate-spin text-ink":""})})]}),p&&p.total>0&&e("div",{className:"flex-shrink-0 border-b border-ink/10 px-3.5 py-2.5",children:e("div",{className:"h-1.5 overflow-hidden rounded-full bg-ink/8",children:e("div",{className:"h-full rounded-full bg-success transition-all duration-300",style:{width:`${Lp(p)}%`}})})}),e("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto scrollbar-overlay-container p-3.5",children:[g&&e("div",{className:"flex items-start gap-2 rounded-lg border border-ink/15 bg-ink/5 px-3 py-2 text-[11px] text-ink/60",children:[e(I,{size:13,className:"mt-[1px] shrink-0"}),e("span",{className:"min-w-0 break-words",children:"Reconnecting: this list may be out of date."})]}),!s?e("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center text-ink/40",children:[e(vr,{size:20}),e("p",{className:"max-w-[240px] text-[11.5px] leading-relaxed",children:["No todo list in this session. The agent writes one with the ",e("span",{className:"font-mono",children:"todo"})," tool when a task is worth planning."]})]}):e(d,{children:[s.phases.map((n,c)=>e(k,{phase:n,index:c,collapsed:Boolean(x[String(c)]),currentKey:v,onToggle:()=>m((h)=>({...h,[String(c)]:!h[String(c)]}))},`${c}-${n.name}`)),e("p",{className:"pt-1 text-[10.5px] leading-relaxed text-ink/35",children:["Read from this session's transcript",s.updatedAt?` · updated ${N(s.updatedAt)}`:"",s.source==="custom"?" · edited by hand":"","."]})]})]})]})}function N(t){let o=new Date(t);if(Number.isNaN(o.getTime()))return t;return o.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}export{j as TodoPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d,n,i,o,u,a,e,li,s,m,D,$r,Ro,f,ae,Dt,fe,C,F,Cp,J,nn,jl,Ep,Qu}from"./index-ncrenheb.js";var Y={name:"clipboard-paste",size:24,node:[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]},Ts=s(Y);var K={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]},mp=s(K);function _({row:t,active:r,name:p,loading:c,onSelect:l,onCopyPath:g,onReveal:M}){return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_3.5rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:r&&e(f,{size:12,className:"text-ink","aria-label":"Selected repository"})}),e("button",{type:"button",onClick:l,disabled:r||!t.isRepo,title:!t.isRepo?t.error??"Not a git repository":r?"Already showing this repository":`Show ${t.path}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(fe,{size:11,className:r?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${r?"font-semibold text-ink":"text-ink/90"}`,children:p})]})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[e("button",{type:"button",onClick:g,disabled:c,title:`Copy the absolute path of ${t.path}`,"aria-label":`Copy path of ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-default",children:e(ae,{size:11})}),e("button",{type:"button",onClick:M,title:`Reveal ${t.path} in the file manager`,"aria-label":`Reveal ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Dt,{size:11})})]}),e("div",{className:"col-start-2 col-span-2 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0 mt-0.5",children:[t.isRepo?e(d,{children:[e("span",{className:`text-[10px] font-mono truncate ${t.detached?"text-warning":"text-ink/50"}`,title:t.detached?`Detached HEAD at ${t.branch}`:`On branch ${t.branch}`,children:t.branch}),e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e(X,{row:t})]}):e("span",{className:"text-[10px] text-ink/40 truncate",children:t.error??"Not a git repository"}),t.isRepo&&t.subject&&e(d,{children:[e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e("span",{className:"text-[10px] text-ink/40 truncate min-w-0",title:t.subject,children:t.subject})]})]})]})}function X({row:t}){let r=[];if(t.operation)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:t.operation==="stash-pop"?`A stash pop stopped on ${t.conflicts} conflict(s)`:`A ${li[t.operation]} is in progress, stopped on ${t.conflicts} conflict(s)`,children:[e(D,{size:9}),li[t.operation]]},"operation"));else if(t.conflicts>0)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.conflicts} conflicted path(s)`,children:[e(D,{size:9}),t.conflicts]},"conflicts"));if(t.changed>0||t.untracked>0)r.push(e("span",{className:"flex-shrink-0 rounded border border-info/30 px-1 text-[10px] font-mono tabular-nums text-info",title:`${t.changed} changed, ${t.untracked} untracked`,children:[t.changed>0?`${t.changed}±`:"",t.changed>0&&t.untracked>0?" ":"",t.untracked>0?`${t.untracked}?`:""]},"dirty"));if(t.gone)r.push(e("span",{className:"flex-shrink-0 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"},"gone"));else if(t.upstream&&(t.ahead>0||t.behind>0))r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 text-[10px] font-mono tabular-nums text-ink/60",title:`${t.ahead} ahead of, ${t.behind} behind ${t.upstream}`,children:[t.ahead>0&&e("span",{className:"flex items-center",children:[e(Ro,{size:9}),t.ahead]}),t.behind>0&&e("span",{className:"flex items-center",children:[e($r,{size:9}),t.behind]})]},"track"));if(r.length===0)return e("span",{className:"text-[10px] font-mono text-ink/30",title:"Nothing to report: clean and in sync",children:"clean, in sync"});return e(d,{children:r})}function q(t){let{open:r,rootPath:p,scanning:c}=t,[l,g]=n([]),[M,y]=n(!1),[S,P]=n(!1),[k,v]=n(null),[w,j]=n(0),E=t.repos.join("\x00"),G=o(!0),b=o(null);i(()=>(G.current=!0,()=>{G.current=!1,b.current?.abort(),b.current=null}),[]);let A=a(async()=>{b.current?.abort();let R=new AbortController;b.current=R,P(!0),y(!0);try{let N=new URLSearchParams({repoDetails:"1"});if(p)N.set("root",p);let L=await fetch(`/api/fs/git?${N.toString()}`,{signal:R.signal}),T=await L.json();if(!G.current||b.current!==R)return;if(!L.ok||!Array.isArray(T.details)){v(T.error||`Failed to read repositories (HTTP ${L.status})`);return}g(T.details),v(null)}catch(N){if(!G.current||b.current!==R)return;if(N instanceof Error&&N.name==="AbortError")return;v(N instanceof Error?N.message:"Failed to read repositories")}finally{if(G.current&&b.current===R)b.current=null,P(!1),y(!1)}},[p]);i(()=>{if(!r){g([]),v(null),y(!1);return}A()},[r,A,E,c,w]);let O=a(()=>j((R)=>R+1),[]);return{details:l,loading:M,reading:S,error:k,refresh:O}}function I(t){let r=new Map;for(let p of t){if(!p||p==="."){if(!r.has(""))r.set("",{key:"",label:null,paths:[]});r.get("").paths.push(".");continue}let c=p.indexOf("/"),l=c===-1?"":p.slice(0,c),g=r.get(l);if(!g)g={key:l,label:l===""?null:l,paths:[]},r.set(l,g);g.paths.push(p)}for(let p of r.values())p.paths.sort((c,l)=>c==="."?-1:l==="."?1:c.localeCompare(l));return[...r.values()].sort((p,c)=>{if(p.key==="")return-1;if(c.key==="")return 1;return p.key.localeCompare(c.key)})}function B(t,r){if(t===".")return"workspace root";if(r==="")return t;return t.slice(r.length+1)}function U({isOpen:t,rootPath:r,activeRepo:p,repos:c,scanning:l,onSelectRepo:g,onRefreshRepos:M,onClose:y}){let[S,P]=n(""),[k,v]=n(null),{details:w,loading:j,reading:E,error:G,refresh:b}=q({open:t,rootPath:r,repos:c,scanning:l});i(()=>{if(!t)P(""),v(null)},[t]);let A=u(()=>{let x=S.trim().toLowerCase();if(!x)return w;return w.filter((h)=>h.path.toLowerCase().includes(x))},[w,S]),O=u(()=>I(A.map((x)=>x.path)),[A]),R=u(()=>{let x=new Map;for(let h of w)x.set(h.path,h);return x},[w]),N=a(()=>{M(),b()},[M,b]),L=a(async(x)=>{let h=r?Qu(r,x==="."?"":x):x,z=await nn(h);v(z?{text:`Copied ${h}`,kind:"success"}:{text:"Clipboard unavailable",kind:"error"})},[r]),T=a(async(x)=>{let h=new FormData;if(h.append("actionType","open_explorer"),h.append("path","."),h.append("repo",x),r)h.append("root",r);try{let z=await fetch("/api/fs/action",{method:"POST",body:h}),H=await z.json();if(!z.ok||H.error)v({text:H.error||"Could not open the file manager",kind:"error"})}catch{v({text:"Could not open the file manager",kind:"error"})}},[r]);if(!t)return null;return e(J,{onClose:y,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e(mp,{size:14,className:"text-ink/60 flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Repositories"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:[c.length," in this workspace"]})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(F,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:S,onChange:(x)=>P(x.currentTarget.value),placeholder:"Filter repositories…","aria-label":"Filter repositories",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:N,disabled:E||l,title:"Re-discover repositories and re-read their state","aria-label":"Refresh repositories",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(C,{size:12,className:E||l?"animate-spin":""})})]}),l&&e("div",{className:"px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono text-ink/50 flex items-center gap-1.5",children:[e(m,{size:10,className:"animate-spin"}),"Still discovering repositories in this workspace…"]}),k&&e("div",{className:`px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono truncate ${k.kind==="error"?"text-error":"text-ink/60"}`,title:k.text,role:"status",children:k.text}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:j&&w.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Reading repositories…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):A.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:S.trim()?"No matching repositories.":"No repositories in this workspace."}):O.map((x)=>e("div",{children:[e("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold bg-canvas/40 border-b border-ink/5 sticky top-0",children:x.label??jl(".",r)}),x.paths.map((h)=>{let z=R.get(h);if(!z)return null;return e(_,{row:z,active:h===p,name:B(h,x.key),loading:E,onSelect:()=>{g(h),y()},onCopyPath:()=>void L(h),onReveal:()=>void T(h)},h)})]},x.key))})]})}function fr({rootPath:t,activeRepo:r,onSelectRepo:p,repos:c,scanning:l,onRefreshRepos:g}){let[M,y]=n(!1),S=u(()=>({root:t??null,repo:r,rows:c.map((k)=>({repo:k,label:jl(k,t),short:Ep(k,t)})),scanning:l,ready:!0,setRepo:p,refresh:g}),[t,r,c,l,p,g]),P=a(()=>y(!0),[]);return e("div",{className:"relative",children:[e(Cp,{scope:S,onManage:P}),e(U,{isOpen:M,rootPath:t,activeRepo:r,repos:c,scanning:l,onSelectRepo:p,onRefreshRepos:g,onClose:()=>y(!1)})]})}var W="(pointer: coarse)",V="(hover: none)";function Q(){if(typeof window>"u")return!1;if(window.matchMedia(W).matches)return!0;return navigator.maxTouchPoints>0&&window.matchMedia(V).matches}function Su(){let[t,r]=n(Q);return i(()=>{let p=[W,V].map((l)=>window.matchMedia(l)),c=()=>r(Q());for(let l of p)l.addEventListener("change",c);return()=>{for(let l of p)l.removeEventListener("change",c)}},[]),t}
|
|
2
|
-
export{
|
|
1
|
+
import{d,n,i,o,u,a,e,li,s,m,D,$r,No,f,ae,Dt,fe,C,F,wp,J,nn,Gl,Cp,Du}from"./index-qznwd6g8.js";var Y={name:"clipboard-paste",size:24,node:[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]},Ss=s(Y);var K={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]},pp=s(K);function _({row:t,active:r,name:p,loading:c,onSelect:l,onCopyPath:g,onReveal:M}){return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_3.5rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:r&&e(f,{size:12,className:"text-ink","aria-label":"Selected repository"})}),e("button",{type:"button",onClick:l,disabled:r||!t.isRepo,title:!t.isRepo?t.error??"Not a git repository":r?"Already showing this repository":`Show ${t.path}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(fe,{size:11,className:r?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${r?"font-semibold text-ink":"text-ink/90"}`,children:p})]})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[e("button",{type:"button",onClick:g,disabled:c,title:`Copy the absolute path of ${t.path}`,"aria-label":`Copy path of ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-30 disabled:cursor-default",children:e(ae,{size:11})}),e("button",{type:"button",onClick:M,title:`Reveal ${t.path} in the file manager`,"aria-label":`Reveal ${t.path}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Dt,{size:11})})]}),e("div",{className:"col-start-2 col-span-2 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0 mt-0.5",children:[t.isRepo?e(d,{children:[e("span",{className:`text-[10px] font-mono truncate ${t.detached?"text-warning":"text-ink/50"}`,title:t.detached?`Detached HEAD at ${t.branch}`:`On branch ${t.branch}`,children:t.branch}),e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e(X,{row:t})]}):e("span",{className:"text-[10px] text-ink/40 truncate",children:t.error??"Not a git repository"}),t.isRepo&&t.subject&&e(d,{children:[e("span",{className:"text-[10px] text-ink/25","aria-hidden":!0,children:"·"}),e("span",{className:"text-[10px] text-ink/40 truncate min-w-0",title:t.subject,children:t.subject})]})]})]})}function X({row:t}){let r=[];if(t.operation)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:t.operation==="stash-pop"?`A stash pop stopped on ${t.conflicts} conflict(s)`:`A ${li[t.operation]} is in progress, stopped on ${t.conflicts} conflict(s)`,children:[e(D,{size:9}),li[t.operation]]},"operation"));else if(t.conflicts>0)r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.conflicts} conflicted path(s)`,children:[e(D,{size:9}),t.conflicts]},"conflicts"));if(t.changed>0||t.untracked>0)r.push(e("span",{className:"flex-shrink-0 rounded border border-info/30 px-1 text-[10px] font-mono tabular-nums text-info",title:`${t.changed} changed, ${t.untracked} untracked`,children:[t.changed>0?`${t.changed}±`:"",t.changed>0&&t.untracked>0?" ":"",t.untracked>0?`${t.untracked}?`:""]},"dirty"));if(t.gone)r.push(e("span",{className:"flex-shrink-0 rounded border border-warning/30 px-1 text-[10px] font-mono text-warning",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"},"gone"));else if(t.upstream&&(t.ahead>0||t.behind>0))r.push(e("span",{className:"flex flex-shrink-0 items-center gap-0.5 text-[10px] font-mono tabular-nums text-ink/60",title:`${t.ahead} ahead of, ${t.behind} behind ${t.upstream}`,children:[t.ahead>0&&e("span",{className:"flex items-center",children:[e(No,{size:9}),t.ahead]}),t.behind>0&&e("span",{className:"flex items-center",children:[e($r,{size:9}),t.behind]})]},"track"));if(r.length===0)return e("span",{className:"text-[10px] font-mono text-ink/30",title:"Nothing to report: clean and in sync",children:"clean, in sync"});return e(d,{children:r})}function q(t){let{open:r,rootPath:p,scanning:c}=t,[l,g]=n([]),[M,y]=n(!1),[S,P]=n(!1),[k,v]=n(null),[w,j]=n(0),E=t.repos.join("\x00"),G=o(!0),b=o(null);i(()=>(G.current=!0,()=>{G.current=!1,b.current?.abort(),b.current=null}),[]);let A=a(async()=>{b.current?.abort();let R=new AbortController;b.current=R,P(!0),y(!0);try{let N=new URLSearchParams({repoDetails:"1"});if(p)N.set("root",p);let L=await fetch(`/api/fs/git?${N.toString()}`,{signal:R.signal}),T=await L.json();if(!G.current||b.current!==R)return;if(!L.ok||!Array.isArray(T.details)){v(T.error||`Failed to read repositories (HTTP ${L.status})`);return}g(T.details),v(null)}catch(N){if(!G.current||b.current!==R)return;if(N instanceof Error&&N.name==="AbortError")return;v(N instanceof Error?N.message:"Failed to read repositories")}finally{if(G.current&&b.current===R)b.current=null,P(!1),y(!1)}},[p]);i(()=>{if(!r){g([]),v(null),y(!1);return}A()},[r,A,E,c,w]);let O=a(()=>j((R)=>R+1),[]);return{details:l,loading:M,reading:S,error:k,refresh:O}}function I(t){let r=new Map;for(let p of t){if(!p||p==="."){if(!r.has(""))r.set("",{key:"",label:null,paths:[]});r.get("").paths.push(".");continue}let c=p.indexOf("/"),l=c===-1?"":p.slice(0,c),g=r.get(l);if(!g)g={key:l,label:l===""?null:l,paths:[]},r.set(l,g);g.paths.push(p)}for(let p of r.values())p.paths.sort((c,l)=>c==="."?-1:l==="."?1:c.localeCompare(l));return[...r.values()].sort((p,c)=>{if(p.key==="")return-1;if(c.key==="")return 1;return p.key.localeCompare(c.key)})}function B(t,r){if(t===".")return"workspace root";if(r==="")return t;return t.slice(r.length+1)}function U({isOpen:t,rootPath:r,activeRepo:p,repos:c,scanning:l,onSelectRepo:g,onRefreshRepos:M,onClose:y}){let[S,P]=n(""),[k,v]=n(null),{details:w,loading:j,reading:E,error:G,refresh:b}=q({open:t,rootPath:r,repos:c,scanning:l});i(()=>{if(!t)P(""),v(null)},[t]);let A=u(()=>{let x=S.trim().toLowerCase();if(!x)return w;return w.filter((h)=>h.path.toLowerCase().includes(x))},[w,S]),O=u(()=>I(A.map((x)=>x.path)),[A]),R=u(()=>{let x=new Map;for(let h of w)x.set(h.path,h);return x},[w]),N=a(()=>{M(),b()},[M,b]),L=a(async(x)=>{let h=r?Du(r,x==="."?"":x):x,z=await nn(h);v(z?{text:`Copied ${h}`,kind:"success"}:{text:"Clipboard unavailable",kind:"error"})},[r]),T=a(async(x)=>{let h=new FormData;if(h.append("actionType","open_explorer"),h.append("path","."),h.append("repo",x),r)h.append("root",r);try{let z=await fetch("/api/fs/action",{method:"POST",body:h}),H=await z.json();if(!z.ok||H.error)v({text:H.error||"Could not open the file manager",kind:"error"})}catch{v({text:"Could not open the file manager",kind:"error"})}},[r]);if(!t)return null;return e(J,{onClose:y,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e(pp,{size:14,className:"text-ink/60 flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Repositories"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:[c.length," in this workspace"]})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(F,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:S,onChange:(x)=>P(x.currentTarget.value),placeholder:"Filter repositories…","aria-label":"Filter repositories",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:N,disabled:E||l,title:"Re-discover repositories and re-read their state","aria-label":"Refresh repositories",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(C,{size:12,className:E||l?"animate-spin":""})})]}),l&&e("div",{className:"px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono text-ink/50 flex items-center gap-1.5",children:[e(m,{size:10,className:"animate-spin"}),"Still discovering repositories in this workspace…"]}),k&&e("div",{className:`px-5 py-1.5 border-b border-ink/10 text-[10px] font-mono truncate ${k.kind==="error"?"text-error":"text-ink/60"}`,title:k.text,role:"status",children:k.text}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:j&&w.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Reading repositories…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):A.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:S.trim()?"No matching repositories.":"No repositories in this workspace."}):O.map((x)=>e("div",{children:[e("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold bg-canvas/40 border-b border-ink/5 sticky top-0",children:x.label??Gl(".",r)}),x.paths.map((h)=>{let z=R.get(h);if(!z)return null;return e(_,{row:z,active:h===p,name:B(h,x.key),loading:E,onSelect:()=>{g(h),y()},onCopyPath:()=>void L(h),onReveal:()=>void T(h)},h)})]},x.key))})]})}function fr({rootPath:t,activeRepo:r,onSelectRepo:p,repos:c,scanning:l,onRefreshRepos:g}){let[M,y]=n(!1),S=u(()=>({root:t??null,repo:r,rows:c.map((k)=>({repo:k,label:Gl(k,t),short:Cp(k,t)})),scanning:l,ready:!0,setRepo:p,refresh:g}),[t,r,c,l,p,g]),P=a(()=>y(!0),[]);return e("div",{className:"relative",children:[e(wp,{scope:S,onManage:P}),e(U,{isOpen:M,rootPath:t,activeRepo:r,repos:c,scanning:l,onSelectRepo:p,onRefreshRepos:g,onClose:()=>y(!1)})]})}var W="(pointer: coarse)",V="(hover: none)";function Q(){if(typeof window>"u")return!1;if(window.matchMedia(W).matches)return!0;return navigator.maxTouchPoints>0&&window.matchMedia(V).matches}function _u(){let[t,r]=n(Q);return i(()=>{let p=[W,V].map((l)=>window.matchMedia(l)),c=()=>r(Q());for(let l of p)l.addEventListener("change",c);return()=>{for(let l of p)l.removeEventListener("change",c)}},[]),t}
|
|
2
|
+
export{Ss,pp,fr,_u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n,i,o,u,a,e,NA,we,S,ir,or,I,m,Vt,Yt,Ce,Gr,C,F,J,ee}from"./index-ncrenheb.js";import{fr}from"./index-p16scjt7.js";function K({sections:c,selected:t,onSelect:l}){let[r,d]=n(""),k=u(()=>{let p=r.trim().toLowerCase();if(!p)return c;return c.map((x)=>({...x,links:x.links.filter((s)=>s.label.toLowerCase().includes(p)||(s.path??s.target).toLowerCase().includes(p))})).filter((x)=>x.links.length>0)},[c,r]),f=c.some((p)=>p.links.length>0);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-canvas/40",children:[e("div",{className:"flex items-center gap-1.5 border-b border-ink/10 px-2 py-1.5 flex-shrink-0",children:[e(F,{size:11,className:"flex-shrink-0 text-ink/40"}),e("input",{type:"text",value:r,onChange:(p)=>d(p.currentTarget.value),placeholder:"Filter pages…",title:"Filter wiki pages",className:"w-full min-w-0 bg-transparent text-xs text-ink outline-none placeholder-ink/40"}),r&&e("button",{type:"button",onClick:()=>d(""),title:"Clear filter",className:"flex-shrink-0 text-ink/40 hover:text-ink",children:"×"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:k.length===0?e("p",{className:"px-3 py-2 text-[11px] italic text-ink/40",children:f?"No page matches the filter":"This wiki has no pages"}):k.map((p,x)=>e("div",{className:"py-0.5",children:[p.title&&e("div",{className:"px-2.5 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink/40",children:p.title}),p.links.map((s,h)=>{let v=s.path!==null&&s.path===t,b=`${s.path??s.target}-${h}`;if(s.path)return e("button",{type:"button",onClick:()=>l(s.path),title:s.path,"aria-current":v?"page":void 0,className:`flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs transition-colors ${v?"bg-ink/8 font-medium text-ink":"text-ink/70 hover:bg-ink/5 hover:text-ink"}`,children:e("span",{className:"truncate",children:s.label})},b);if(s.url)return e("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",title:s.url,className:"flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs text-ink/70 hover:bg-ink/5 hover:text-ink",children:[e("span",{className:"truncate",children:s.label}),e(Ce,{size:10,className:"flex-shrink-0 text-ink/30"})]},b);return e("div",{title:`Not in this wiki: ${s.target}`,className:"flex w-full items-center px-2.5 py-1 text-left text-xs text-ink/35 line-through decoration-ink/20",children:e("span",{className:"truncate",children:s.label})},b)}),p.notes.map((s,h)=>e("p",{className:"px-2.5 py-0.5 text-[10px] leading-snug text-ink/50",children:s},`note-${h}`))]},`${p.title??"links"}-${x}`))})]})}function q({open:c,onClick:t}){return e("button",{type:"button",onClick:t,title:"Browse wiki pages","aria-label":"Browse wiki pages","aria-expanded":c,className:"absolute bottom-3 right-3 z-20 flex h-9 w-9 items-center justify-center rounded-full border border-ink/20 bg-paper text-ink/60 shadow-sm transition-all hover:bg-ink/5 hover:text-ink active:scale-95",children:e(Gr,{size:16})})}function V({open:c,sections:t,selected:l,onSelect:r,onClose:d}){if(i(()=>{if(!c)return;let k=(f)=>{if(f.key==="Escape")d()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c,d]),!c)return null;return e(J,{onClose:d,maxWidthClass:"max-w-sm",zClass:"z-[70]",ariaLabel:"Wiki pages",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(Gr,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Wiki pages"})]}),children:e("div",{className:"flex h-[60vh] min-h-0 flex-col",children:e(K,{sections:t,selected:l,onSelect:(k)=>{r(k),d()}})})})}function re(c,t){if(!c.webUrl)return null;let r=(t.split("/").pop()??t).replace(/\.(md|markdown)$/i,"");return c.provider==="gitlab"?`${c.webUrl.replace(/\/home$/,"")}/${encodeURIComponent(t.replace(/\.(md|markdown)$/i,""))}`:`${c.webUrl}/${encodeURIComponent(r)}`}function G({repo:c,entries:t,path:l,page:r,isLoading:d,error:k,rootPath:f,repoScope:p,onNavigate:x,onBack:s}){let h=re(c,l),v=u(()=>({path:l,entries:t,root:f,repo:p}),[l,t,f,p]);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-paper",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2.5 py-1.5",children:[s&&e("button",{type:"button",onClick:s,title:"Back to the page list","aria-label":"Back to the page list",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink @[520px]:hidden",children:e(Vt,{size:13})}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] text-ink/50",title:l,children:l}),d&&e(m,{size:12,className:"flex-shrink-0 animate-spin text-ink/40"}),h&&e("a",{href:h,target:"_blank",rel:"noopener noreferrer",title:"Open this page on the wiki host","aria-label":"Open this page on the wiki host",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Ce,{size:13})})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:k?e("div",{className:"flex flex-col items-center gap-2 px-6 py-8 text-center",children:[e(I,{size:16,className:"text-error"}),e("p",{className:"text-xs text-error",children:k})]}):!r?e("div",{className:"px-6 py-8 text-center text-xs text-ink/40",children:d?"Loading page…":"No page selected"}):e("article",{className:"mx-auto max-w-4xl px-5 py-4",children:[e(ee,{content:r.content,className:"max-w-none",wikiScope:v,onWikiNavigate:x}),r.truncated&&e("p",{className:"mt-4 border-t border-ink/10 pt-2 text-[11px] text-ink/50",children:"This page is longer than the reader's budget and was cut off."})]})})]})}function B(c,t){return`${c??""}\x00${t}`}function X(c,t){let l=new URLSearchParams;if(c)l.set("root",c);if(t&&t!==".")l.set("repo",t);return l}function H(c){let{rootPath:t,repo:l,enabled:r,active:d,revisionKey:k=0}=c,f=B(t,l),[p,x]=n(null),s=o(f);s.current=f;let h=we(NA(f),{enabled:r&&d}),{refresh:v}=h;i(()=>{x(null)},[f]);let b=a((P)=>{if(!r)return;if(!P?.force){v();return}let y=s.current,R=X(t,l);R.set("refresh","1"),fetch(`/api/wiki?${R.toString()}`).then(async(w)=>{let N=await w.json();if(!w.ok)throw Error(N?.error||`Wiki request failed (${w.status})`)}).then(()=>{if(s.current!==y)return;x(null),v()}).catch((w)=>{if(s.current!==y)return;x(w instanceof Error?w.message:"Failed to load the wiki")})},[r,t,l,v]);return i(()=>{if(k>0)v()},[k]),{data:h.data,isLoading:h.isLoading,refreshing:h.refreshing,error:p,reload:b}}function Q(c){let{rootPath:t,repo:l,path:r,enabled:d,active:k,revisionKey:f=0}=c,p=`${B(t,l)}\x00${r??""}`,[x,s]=n({scope:p,data:null}),[h,v]=n(!1),[b,P]=n(null),y=o(0);return i(()=>{if(!d||!k||!r){s({scope:p,data:null}),P(null);return}let R=++y.current;v(!0);let w=X(t,l);w.set("path",r),fetch(`/api/wiki/page?${w.toString()}`).then(async(N)=>{let T=await N.json();if(!N.ok)throw Error(T?.error||`Page request failed (${N.status})`);return T}).then((N)=>{if(y.current!==R)return;s({scope:p,data:N}),P(null)}).catch((N)=>{if(y.current!==R)return;P(N instanceof Error?N.message:"Failed to load the page")}).finally(()=>{if(y.current===R)v(!1)})},[p,t,l,r,d,k,f]),{data:x.scope===p?x.data:null,isLoading:h,error:b}}function Y(c){let t=[];for(let l of c){if(!l.isMarkdown)continue;let r=t[t.length-1],d={label:l.title,target:l.path,path:l.path,url:null};if(r&&r.title===(l.folder||"Pages")){r.links.push(d);continue}t.push({title:l.folder||"Pages",links:[d],notes:[]})}return t}var ae={"no-remote":"This repository has no origin remote, so there is no wiki to find.","unsupported-remote":"The origin remote is not a URL a wiki can be derived from.","no-wiki":"This project has no wiki (or Kabmo cannot read it).",unreachable:"The wiki could not be reached."};function Oe({className:c="",enabled:t=!0,active:l=!0,rootPath:r,refreshKey:d=0,layout:k="desktop"}){let f=k==="phone",{activeRepo:p,setActiveRepo:x}=ir(r),{repos:s,scanning:h,rescan:v}=or(r,t),b=B(r,p),[P,y]=S("wiki.selectedPage",null),[R,w]=n(!1),[N,T]=n(!1),[Z,te]=n(0),g=H({rootPath:r,repo:p,enabled:t,active:l,revisionKey:d}),z=g.data?.entries??[],A=u(()=>z.filter((L)=>L.isMarkdown),[z]),M=u(()=>g.data?.sidebar??Y(z),[g.data?.sidebar,z]),ie=u(()=>M.some((L)=>L.links.length>0),[M]),_=P&&P.scope===b?P.path:null,E=u(()=>{if(_&&A.some((j)=>j.path===_))return _;return(A.find((j)=>j.title.toLowerCase()==="home")??A[0])?.path??null},[_,A]),O=Q({rootPath:r,repo:p,path:E,enabled:t,active:l,revisionKey:Z});i(()=>{if(!E||E===_)return;y({scope:b,path:E})},[E,_,b,y]),i(()=>{w(!1),T(!1)},[b]);let D=(L)=>{if(y({scope:b,path:L}),!f)T(!0)},ne=()=>{g.reload({force:!0}),te((L)=>L+1)},W=g.data?.repo??null,U=g.data&&!W?g.data:null;if(!t)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${c}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`@container flex h-full min-h-0 w-full flex-col bg-paper text-xs text-ink ${c}`,children:[e("div",{className:"flex flex-shrink-0 items-center justify-between gap-2 border-b border-ink/10 px-2 py-1.5",children:[e("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(fr,{rootPath:r,activeRepo:p,onSelectRepo:x,repos:s,scanning:h,onRefreshRepos:v}),W&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/60",title:`${W.host}/${W.slug} · ${W.revision.slice(0,8)}`,children:W.provider})]}),e("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[W?.webUrl&&e("a",{href:W.webUrl,target:"_blank",rel:"noopener noreferrer",title:"Open the wiki on its host","aria-label":"Open the wiki on its host",className:"rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Ce,{size:13})}),e("button",{type:"button",onClick:ne,disabled:g.isLoading,title:"Re-fetch the wiki","aria-label":"Re-fetch the wiki",className:"rounded p-1 text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink disabled:opacity-50",children:e(C,{size:13,className:g.isLoading||g.refreshing?"animate-spin":""})})]})]}),g.error&&!g.data?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(I,{size:16,className:"text-error"}),e("p",{className:"text-error",children:g.error}),e("button",{type:"button",onClick:()=>g.reload(),className:"text-[11px] font-semibold text-ink/70 underline underline-offset-2 hover:text-ink",children:"Try again"})]}):!g.data?e("div",{className:"flex flex-1 items-center justify-center gap-2 text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Reading the wiki…"})]}):U?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(Yt,{size:18,className:"text-ink/30"}),e("p",{className:"max-w-sm text-[11px] leading-relaxed text-ink/60",children:ae[U.reason??"no-wiki"]}),U.detail&&e("p",{className:"max-w-sm break-words font-mono text-[10px] text-ink/40",children:U.detail})]}):e("div",{className:"flex min-h-0 flex-1 flex-col @[520px]:flex-row-reverse",children:[e("div",{className:`${f?"hidden":N?"hidden @[520px]:flex":"flex"} min-h-0 w-full flex-col @[520px]:w-52 @[520px]:flex-shrink-0 @[520px]:border-l @[520px]:border-ink/10`,children:e(K,{sections:M,selected:E,onSelect:D})}),e("div",{className:`relative min-w-0 min-h-0 flex-1 ${f?"flex":N?"flex":"hidden @[520px]:flex"} flex-col`,children:[W&&E?e(G,{repo:W,entries:z,path:E,page:O.data,isLoading:O.isLoading,error:O.error,rootPath:r,repoScope:p,onNavigate:D,onBack:f?void 0:()=>T(!1)}):e("div",{className:"flex h-full items-center justify-center px-6 text-center text-[11px] text-ink/40",children:"This wiki has no markdown pages."}),f&&ie&&e(q,{open:R,onClick:()=>w(!0)}),e(V,{open:R,sections:M,selected:E,onSelect:D,onClose:()=>w(!1)})]})]})]})}export{Oe as WikiPanel};
|
|
1
|
+
import{n,i,o,u,a,e,TA,we,S,ir,or,I,m,Vt,Yt,Ce,Gr,C,F,J,ee}from"./index-qznwd6g8.js";import{fr}from"./index-ntxm8pw3.js";function K({sections:c,selected:t,onSelect:l}){let[r,d]=n(""),k=u(()=>{let p=r.trim().toLowerCase();if(!p)return c;return c.map((x)=>({...x,links:x.links.filter((s)=>s.label.toLowerCase().includes(p)||(s.path??s.target).toLowerCase().includes(p))})).filter((x)=>x.links.length>0)},[c,r]),f=c.some((p)=>p.links.length>0);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-canvas/40",children:[e("div",{className:"flex items-center gap-1.5 border-b border-ink/10 px-2 py-1.5 flex-shrink-0",children:[e(F,{size:11,className:"flex-shrink-0 text-ink/40"}),e("input",{type:"text",value:r,onChange:(p)=>d(p.currentTarget.value),placeholder:"Filter pages…",title:"Filter wiki pages",className:"w-full min-w-0 bg-transparent text-xs text-ink outline-none placeholder-ink/40"}),r&&e("button",{type:"button",onClick:()=>d(""),title:"Clear filter",className:"flex-shrink-0 text-ink/40 hover:text-ink",children:"×"})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:k.length===0?e("p",{className:"px-3 py-2 text-[11px] italic text-ink/40",children:f?"No page matches the filter":"This wiki has no pages"}):k.map((p,x)=>e("div",{className:"py-0.5",children:[p.title&&e("div",{className:"px-2.5 py-1 text-[10px] font-semibold uppercase tracking-wider text-ink/40",children:p.title}),p.links.map((s,h)=>{let v=s.path!==null&&s.path===t,b=`${s.path??s.target}-${h}`;if(s.path)return e("button",{type:"button",onClick:()=>l(s.path),title:s.path,"aria-current":v?"page":void 0,className:`flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs transition-colors ${v?"bg-ink/8 font-medium text-ink":"text-ink/70 hover:bg-ink/5 hover:text-ink"}`,children:e("span",{className:"truncate",children:s.label})},b);if(s.url)return e("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",title:s.url,className:"flex w-full items-center gap-1 px-2.5 py-1 text-left text-xs text-ink/70 hover:bg-ink/5 hover:text-ink",children:[e("span",{className:"truncate",children:s.label}),e(Ce,{size:10,className:"flex-shrink-0 text-ink/30"})]},b);return e("div",{title:`Not in this wiki: ${s.target}`,className:"flex w-full items-center px-2.5 py-1 text-left text-xs text-ink/35 line-through decoration-ink/20",children:e("span",{className:"truncate",children:s.label})},b)}),p.notes.map((s,h)=>e("p",{className:"px-2.5 py-0.5 text-[10px] leading-snug text-ink/50",children:s},`note-${h}`))]},`${p.title??"links"}-${x}`))})]})}function q({open:c,onClick:t}){return e("button",{type:"button",onClick:t,title:"Browse wiki pages","aria-label":"Browse wiki pages","aria-expanded":c,className:"absolute bottom-3 right-3 z-20 flex h-9 w-9 items-center justify-center rounded-full border border-ink/20 bg-paper text-ink/60 shadow-sm transition-all hover:bg-ink/5 hover:text-ink active:scale-95",children:e(Gr,{size:16})})}function V({open:c,sections:t,selected:l,onSelect:r,onClose:d}){if(i(()=>{if(!c)return;let k=(f)=>{if(f.key==="Escape")d()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c,d]),!c)return null;return e(J,{onClose:d,maxWidthClass:"max-w-sm",zClass:"z-[70]",ariaLabel:"Wiki pages",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(Gr,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Wiki pages"})]}),children:e("div",{className:"flex h-[60vh] min-h-0 flex-col",children:e(K,{sections:t,selected:l,onSelect:(k)=>{r(k),d()}})})})}function re(c,t){if(!c.webUrl)return null;let r=(t.split("/").pop()??t).replace(/\.(md|markdown)$/i,"");return c.provider==="gitlab"?`${c.webUrl.replace(/\/home$/,"")}/${encodeURIComponent(t.replace(/\.(md|markdown)$/i,""))}`:`${c.webUrl}/${encodeURIComponent(r)}`}function G({repo:c,entries:t,path:l,page:r,isLoading:d,error:k,rootPath:f,repoScope:p,onNavigate:x,onBack:s}){let h=re(c,l),v=u(()=>({path:l,entries:t,root:f,repo:p}),[l,t,f,p]);return e("div",{className:"flex h-full min-h-0 w-full flex-col bg-paper",children:[e("div",{className:"flex flex-shrink-0 items-center gap-1.5 border-b border-ink/10 px-2.5 py-1.5",children:[s&&e("button",{type:"button",onClick:s,title:"Back to the page list","aria-label":"Back to the page list",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink @[520px]:hidden",children:e(Vt,{size:13})}),e("span",{className:"min-w-0 flex-1 truncate text-[11px] text-ink/50",title:l,children:l}),d&&e(m,{size:12,className:"flex-shrink-0 animate-spin text-ink/40"}),h&&e("a",{href:h,target:"_blank",rel:"noopener noreferrer",title:"Open this page on the wiki host","aria-label":"Open this page on the wiki host",className:"flex-shrink-0 rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Ce,{size:13})})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-overlay-container",children:k?e("div",{className:"flex flex-col items-center gap-2 px-6 py-8 text-center",children:[e(I,{size:16,className:"text-error"}),e("p",{className:"text-xs text-error",children:k})]}):!r?e("div",{className:"px-6 py-8 text-center text-xs text-ink/40",children:d?"Loading page…":"No page selected"}):e("article",{className:"mx-auto max-w-4xl px-5 py-4",children:[e(ee,{content:r.content,className:"max-w-none",wikiScope:v,onWikiNavigate:x}),r.truncated&&e("p",{className:"mt-4 border-t border-ink/10 pt-2 text-[11px] text-ink/50",children:"This page is longer than the reader's budget and was cut off."})]})})]})}function B(c,t){return`${c??""}\x00${t}`}function X(c,t){let l=new URLSearchParams;if(c)l.set("root",c);if(t&&t!==".")l.set("repo",t);return l}function H(c){let{rootPath:t,repo:l,enabled:r,active:d,revisionKey:k=0}=c,f=B(t,l),[p,x]=n(null),s=o(f);s.current=f;let h=we(TA(f),{enabled:r&&d}),{refresh:v}=h;i(()=>{x(null)},[f]);let b=a((P)=>{if(!r)return;if(!P?.force){v();return}let y=s.current,R=X(t,l);R.set("refresh","1"),fetch(`/api/wiki?${R.toString()}`).then(async(w)=>{let N=await w.json();if(!w.ok)throw Error(N?.error||`Wiki request failed (${w.status})`)}).then(()=>{if(s.current!==y)return;x(null),v()}).catch((w)=>{if(s.current!==y)return;x(w instanceof Error?w.message:"Failed to load the wiki")})},[r,t,l,v]);return i(()=>{if(k>0)v()},[k]),{data:h.data,isLoading:h.isLoading,refreshing:h.refreshing,error:p,reload:b}}function Q(c){let{rootPath:t,repo:l,path:r,enabled:d,active:k,revisionKey:f=0}=c,p=`${B(t,l)}\x00${r??""}`,[x,s]=n({scope:p,data:null}),[h,v]=n(!1),[b,P]=n(null),y=o(0);return i(()=>{if(!d||!k||!r){s({scope:p,data:null}),P(null);return}let R=++y.current;v(!0);let w=X(t,l);w.set("path",r),fetch(`/api/wiki/page?${w.toString()}`).then(async(N)=>{let T=await N.json();if(!N.ok)throw Error(T?.error||`Page request failed (${N.status})`);return T}).then((N)=>{if(y.current!==R)return;s({scope:p,data:N}),P(null)}).catch((N)=>{if(y.current!==R)return;P(N instanceof Error?N.message:"Failed to load the page")}).finally(()=>{if(y.current===R)v(!1)})},[p,t,l,r,d,k,f]),{data:x.scope===p?x.data:null,isLoading:h,error:b}}function Y(c){let t=[];for(let l of c){if(!l.isMarkdown)continue;let r=t[t.length-1],d={label:l.title,target:l.path,path:l.path,url:null};if(r&&r.title===(l.folder||"Pages")){r.links.push(d);continue}t.push({title:l.folder||"Pages",links:[d],notes:[]})}return t}var ae={"no-remote":"This repository has no origin remote, so there is no wiki to find.","unsupported-remote":"The origin remote is not a URL a wiki can be derived from.","no-wiki":"This project has no wiki (or Kabmo cannot read it).",unreachable:"The wiki could not be reached."};function Oe({className:c="",enabled:t=!0,active:l=!0,rootPath:r,refreshKey:d=0,layout:k="desktop"}){let f=k==="phone",{activeRepo:p,setActiveRepo:x}=ir(r),{repos:s,scanning:h,rescan:v}=or(r,t),b=B(r,p),[P,y]=S("wiki.selectedPage",null),[R,w]=n(!1),[N,T]=n(!1),[Z,te]=n(0),g=H({rootPath:r,repo:p,enabled:t,active:l,revisionKey:d}),z=g.data?.entries??[],A=u(()=>z.filter((L)=>L.isMarkdown),[z]),M=u(()=>g.data?.sidebar??Y(z),[g.data?.sidebar,z]),ie=u(()=>M.some((L)=>L.links.length>0),[M]),_=P&&P.scope===b?P.path:null,E=u(()=>{if(_&&A.some((j)=>j.path===_))return _;return(A.find((j)=>j.title.toLowerCase()==="home")??A[0])?.path??null},[_,A]),O=Q({rootPath:r,repo:p,path:E,enabled:t,active:l,revisionKey:Z});i(()=>{if(!E||E===_)return;y({scope:b,path:E})},[E,_,b,y]),i(()=>{w(!1),T(!1)},[b]);let D=(L)=>{if(y({scope:b,path:L}),!f)T(!0)},ne=()=>{g.reload({force:!0}),te((L)=>L+1)},W=g.data?.repo??null,U=g.data&&!W?g.data:null;if(!t)return e("div",{className:`flex h-full flex-col items-center justify-center bg-paper text-ink/40 ${c}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`@container flex h-full min-h-0 w-full flex-col bg-paper text-xs text-ink ${c}`,children:[e("div",{className:"flex flex-shrink-0 items-center justify-between gap-2 border-b border-ink/10 px-2 py-1.5",children:[e("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(fr,{rootPath:r,activeRepo:p,onSelectRepo:x,repos:s,scanning:h,onRefreshRepos:v}),W&&e("span",{className:"flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/60",title:`${W.host}/${W.slug} · ${W.revision.slice(0,8)}`,children:W.provider})]}),e("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[W?.webUrl&&e("a",{href:W.webUrl,target:"_blank",rel:"noopener noreferrer",title:"Open the wiki on its host","aria-label":"Open the wiki on its host",className:"rounded p-1 text-ink/60 hover:bg-ink/5 hover:text-ink",children:e(Ce,{size:13})}),e("button",{type:"button",onClick:ne,disabled:g.isLoading,title:"Re-fetch the wiki","aria-label":"Re-fetch the wiki",className:"rounded p-1 text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink disabled:opacity-50",children:e(C,{size:13,className:g.isLoading||g.refreshing?"animate-spin":""})})]})]}),g.error&&!g.data?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(I,{size:16,className:"text-error"}),e("p",{className:"text-error",children:g.error}),e("button",{type:"button",onClick:()=>g.reload(),className:"text-[11px] font-semibold text-ink/70 underline underline-offset-2 hover:text-ink",children:"Try again"})]}):!g.data?e("div",{className:"flex flex-1 items-center justify-center gap-2 text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Reading the wiki…"})]}):U?e("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[e(Yt,{size:18,className:"text-ink/30"}),e("p",{className:"max-w-sm text-[11px] leading-relaxed text-ink/60",children:ae[U.reason??"no-wiki"]}),U.detail&&e("p",{className:"max-w-sm break-words font-mono text-[10px] text-ink/40",children:U.detail})]}):e("div",{className:"flex min-h-0 flex-1 flex-col @[520px]:flex-row-reverse",children:[e("div",{className:`${f?"hidden":N?"hidden @[520px]:flex":"flex"} min-h-0 w-full flex-col @[520px]:w-52 @[520px]:flex-shrink-0 @[520px]:border-l @[520px]:border-ink/10`,children:e(K,{sections:M,selected:E,onSelect:D})}),e("div",{className:`relative min-w-0 min-h-0 flex-1 ${f?"flex":N?"flex":"hidden @[520px]:flex"} flex-col`,children:[W&&E?e(G,{repo:W,entries:z,path:E,page:O.data,isLoading:O.isLoading,error:O.error,rootPath:r,repoScope:p,onNavigate:D,onBack:f?void 0:()=>T(!1)}):e("div",{className:"flex h-full items-center justify-center px-6 text-center text-[11px] text-ink/40",children:"This wiki has no markdown pages."}),f&&ie&&e(q,{open:R,onClick:()=>w(!0)}),e(V,{open:R,sections:M,selected:E,onSelect:D,onClose:()=>w(!1)})]})]})]})}export{Oe as WikiPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n=Object.freeze(JSON.parse(`{"displayName":"INI","name":"ini","patterns":[{"begin":"(^[\\\\t ]+)?(?=#)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.ini"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.ini"}},"end":"\\\\n","name":"comment.line.number-sign.ini"}]},{"begin":"(^[\\\\t ]+)?(?=;)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.ini"}},"end":"(?!\\\\G)","patterns":[{"begin":";","beginCaptures":{"0":{"name":"punctuation.definition.comment.ini"}},"end":"\\\\n","name":"comment.line.semicolon.ini"}]},{"captures":{"1":{"name":"keyword.other.definition.ini"},"2":{"name":"punctuation.separator.key-value.ini"}},"match":"\\\\b([-.0-9A-Z_a-z]+)\\\\b\\\\s*(=)"},{"captures":{"1":{"name":"punctuation.definition.entity.ini"},"3":{"name":"punctuation.definition.entity.ini"}},"match":"^(\\\\[)(.*?)(])","name":"entity.name.section.group-title.ini"},{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.ini"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.ini"}},"name":"string.quoted.single.ini","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.ini"}]},{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.ini"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.ini"}},"name":"string.quoted.double.ini"}],"scopeName":"source.ini","aliases":["properties"]}`)),
|
|
2
|
-
export{
|
|
1
|
+
var n=Object.freeze(JSON.parse(`{"displayName":"INI","name":"ini","patterns":[{"begin":"(^[\\\\t ]+)?(?=#)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.ini"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.ini"}},"end":"\\\\n","name":"comment.line.number-sign.ini"}]},{"begin":"(^[\\\\t ]+)?(?=;)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.ini"}},"end":"(?!\\\\G)","patterns":[{"begin":";","beginCaptures":{"0":{"name":"punctuation.definition.comment.ini"}},"end":"\\\\n","name":"comment.line.semicolon.ini"}]},{"captures":{"1":{"name":"keyword.other.definition.ini"},"2":{"name":"punctuation.separator.key-value.ini"}},"match":"\\\\b([-.0-9A-Z_a-z]+)\\\\b\\\\s*(=)"},{"captures":{"1":{"name":"punctuation.definition.entity.ini"},"3":{"name":"punctuation.definition.entity.ini"}},"match":"^(\\\\[)(.*?)(])","name":"entity.name.section.group-title.ini"},{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.ini"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.ini"}},"name":"string.quoted.single.ini","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.ini"}]},{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.ini"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.ini"}},"name":"string.quoted.double.ini"}],"scopeName":"source.ini","aliases":["properties"]}`)),EA=[n];
|
|
2
|
+
export{EA};
|