@kabmo-labs/kabmo 0.45.1 → 0.46.1

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.
Files changed (369) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +412 -412
  3. package/dist/client/static/js/{CsvGrid-eqmctwyq.js → CsvGrid-qdkmv8bj.js} +2 -2
  4. package/dist/client/static/js/{DocxView-rjrshmzf.js → DocxView-k84ns803.js} +3 -3
  5. package/dist/client/static/js/{DrawioView-za569srw.js → DrawioView-r1n717f7.js} +2 -2
  6. package/dist/client/static/js/ImageView-jkrdrq8v.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-sh634350.js +2 -0
  8. package/dist/client/static/js/Modal-xe6h99jn.js +59 -0
  9. package/dist/client/static/js/{PdfView-2m78d4jz.js → PdfView-ffg4mccg.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-54awmse0.js → SessionsView-cdcbsee9.js} +1 -1
  11. package/dist/client/static/js/{SheetView-xfvjdh24.js → SheetView-89sscpz6.js} +19 -19
  12. package/dist/client/static/js/{SvgPreview-yfjrfb40.js → SvgPreview-68c0ccbv.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-tmsa3b36.js → abnfDiagram-O67JEVCF-h3a5s259.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-pvb4d65d.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-a5effrpz.js → architectureDiagram-NJMV4G6O-983p0jgn.js} +3 -3
  16. package/dist/client/static/js/{astro-56b0as3q.js → astro-hyj5wege.js} +1 -1
  17. package/dist/client/static/js/bash-8d8z8zrg.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-3q2kf22c.js → blockDiagram-BEXU5L5S-16pse5mh.js} +5 -5
  19. package/dist/client/static/js/c-acmn1zc9.js +1 -0
  20. package/dist/client/static/js/{c4Diagram-YGBWAQC7-mkw3jvf6.js → c4Diagram-YGBWAQC7-mvnb00zt.js} +3 -3
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fw9bs1za.js → classDiagram-v2-NBCMYWYE-kmpd91xb.js} +7 -7
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-eqjrpps4.js → cose-bilkent-JH36ORCC-3ek5r5se.js} +1 -1
  23. package/dist/client/static/js/cpp-620mvjkk.js +1 -0
  24. package/dist/client/static/js/css-bt76kxbq.js +1 -0
  25. package/dist/client/static/js/css-drfs4n12.js +1 -0
  26. package/dist/client/static/js/cynefin-OW5HDTMX-gmx4vean.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-4w61hq3e.js → cynefinDiagram-VND7K2PF-jkbh84zn.js} +1 -1
  28. package/dist/client/static/js/{dagre-6A5THRUB-t52jdfr1.js → dagre-6A5THRUB-4fdc0sgn.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-448hyxaz.js → diagram-22UHCM2B-hbk61nq9.js} +18 -18
  30. package/dist/client/static/js/{diagram-3UASUU5V-350k213a.js → diagram-3UASUU5V-hfpbr9qh.js} +1 -1
  31. package/dist/client/static/js/{diagram-ATOU4E4O-9davjeyb.js → diagram-ATOU4E4O-fn0nt71a.js} +3 -3
  32. package/dist/client/static/js/{diagram-CDSNMT55-034wwghk.js → diagram-CDSNMT55-ssswxjeb.js} +4 -4
  33. package/dist/client/static/js/{diagram-MLGK6HIB-kzzd4ecm.js → diagram-MLGK6HIB-whnzxv6f.js} +2 -2
  34. package/dist/client/static/js/{diagram-MPIPVDR6-rsky4e3s.js → diagram-MPIPVDR6-hk1chzxk.js} +2 -2
  35. package/dist/client/static/js/{dockerfile-68b0e6b6.js → dockerfile-zmsj8r4g.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-7bm1e394.js → ebnfDiagram-ZINNZB2B-q1vkg5mr.js} +1 -1
  37. package/dist/client/static/js/{elixir-12pgbgtq.js → elixir-80wq7gak.js} +1 -1
  38. package/dist/client/static/js/{elk-276RUBZZ-4xjp4rgh.js → elk-276RUBZZ-kt98vg8j.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-v52qmcrv.js → erDiagram-OPXOYQCR-ey3avsn9.js} +9 -9
  40. package/dist/client/static/js/{erlang-811btv6p.js → erlang-814e8qy5.js} +1 -1
  41. package/dist/client/static/js/eventmodeling-NTZA5JFV-vrnheyh7.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-1r1fn18p.js → ganttDiagram-FUAMR5RP-a9k1at43.js} +4 -4
  44. package/dist/client/static/js/gitGraph-4MIJSDKK-n6wnc8st.js +1 -0
  45. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-zt5cwg83.js → gitGraphDiagram-X574FWY7-gnekjfym.js} +13 -13
  46. package/dist/client/static/js/graphql-j1a6zp7m.js +1 -0
  47. package/dist/client/static/js/html-m0megrvb.js +1 -0
  48. package/dist/client/static/js/{index-qt9jc4ck.js → index-19x11s5w.js} +2 -2
  49. package/dist/client/static/js/{index-0gmw2bt3.js → index-1ax52p0q.js} +2 -2
  50. package/dist/client/static/js/{index-2b1wnvez.js → index-1c2jvnyh.js} +2 -2
  51. package/dist/client/static/js/index-2a6qp9y6.js +2 -0
  52. package/dist/client/static/js/{index-gcwmpfr4.js → index-2ks0m8ss.js} +2 -2
  53. package/dist/client/static/js/{index-pfj3sd1n.js → index-33qxg79j.js} +7 -7
  54. package/dist/client/static/js/{index-bcpyxt97.js → index-3x7h2eqj.js} +2 -2
  55. package/dist/client/static/js/{index-q36gq3yz.js → index-4cag7w6k.js} +198 -198
  56. package/dist/client/static/js/{index-03j5j1j0.js → index-561gkvve.js} +2 -2
  57. package/dist/client/static/js/{index-m9s7r4z9.js → index-5ka2tyf9.js} +3 -3
  58. package/dist/client/static/js/{index-f51jxezc.js → index-5wz0y88c.js} +2 -2
  59. package/dist/client/static/js/{index-frqq7yen.js → index-60v30k5h.js} +64 -64
  60. package/dist/client/static/js/{index-x2wvq4ae.js → index-64sqfr4a.js} +2 -2
  61. package/dist/client/static/js/{index-xgv501v0.js → index-65afr75v.js} +2 -2
  62. package/dist/client/static/js/index-83rkg916.js +2 -0
  63. package/dist/client/static/js/{index-ga6492qc.js → index-84fyq5a6.js} +1 -1
  64. package/dist/client/static/js/{index-2tmnqqzt.js → index-8g7q8mz4.js} +3 -3
  65. package/dist/client/static/js/{index-mnh8nptt.js → index-9vv7wr1n.js} +2 -2
  66. package/dist/client/static/js/{index-gzafyqsr.js → index-abs635a1.js} +56 -56
  67. package/dist/client/static/js/{index-j50y0z44.js → index-amsa0tfs.js} +1 -1
  68. package/dist/client/static/js/index-atq9q1s7.js +1 -0
  69. package/dist/client/static/js/{index-8ps5gdwz.js → index-b2e5pwx7.js} +5 -5
  70. package/dist/client/static/js/{index-cza9mnxx.js → index-b5dfvget.js} +6 -6
  71. package/dist/client/static/js/{index-zwx3vbf0.js → index-bsr7wmj2.js} +1 -1
  72. package/dist/client/static/js/{index-ex3w7t7s.js → index-c9e417cs.js} +2 -2
  73. package/dist/client/static/js/{index-fbct0jcf.js → index-d23eacf2.js} +2 -2
  74. package/dist/client/static/js/{index-wqrdgt1g.js → index-dn7hg4em.js} +2 -2
  75. package/dist/client/static/js/index-dpy3ewrn.css +1 -0
  76. package/dist/client/static/js/index-dt6q3rws.js +12 -0
  77. package/dist/client/static/js/{index-3h2mr90j.js → index-dxvtjn6a.js} +2 -2
  78. package/dist/client/static/js/{index-127se1a3.js → index-e9cxje00.js} +19 -19
  79. package/dist/client/static/js/{index-6sqmhdyv.js → index-fj5rsp5v.js} +2 -2
  80. package/dist/client/static/js/{index-c7vbr57m.js → index-fzngzhww.js} +2 -2
  81. package/dist/client/static/js/{index-n1ga63de.js → index-g7s0wsag.js} +2 -2
  82. package/dist/client/static/js/{index-x0kgnkv3.js → index-hgzntg2j.js} +2 -2
  83. package/dist/client/static/js/{index-jaqjvk22.js → index-hkz2mz34.js} +2 -2
  84. package/dist/client/static/js/{index-gzp4j2h5.js → index-hnb66d3s.js} +2 -2
  85. package/dist/client/static/js/{index-9zwtpazh.js → index-kb14dhrx.js} +2 -2
  86. package/dist/client/static/js/{index-snjtkfkq.js → index-kbhrvep8.js} +6 -6
  87. package/dist/client/static/js/{index-vgcm2g0g.js → index-kty4ncsr.js} +2 -2
  88. package/dist/client/static/js/index-m4k054wz.js +4 -0
  89. package/dist/client/static/js/{index-pxq4v81r.js → index-nw5mvcaj.js} +2 -2
  90. package/dist/client/static/js/index-pavvxrsz.js +1 -0
  91. package/dist/client/static/js/index-q9ytjey8.js +1 -0
  92. package/dist/client/static/js/{index-8dtp7mt0.js → index-qf3y3ahx.js} +2 -2
  93. package/dist/client/static/js/{index-as1wptfa.js → index-qfxn7yh5.js} +2 -2
  94. package/dist/client/static/js/{index-e6any867.js → index-sa1675y0.js} +2 -2
  95. package/dist/client/static/js/{index-ehg2ftnp.js → index-trvqvb1v.js} +2 -2
  96. package/dist/client/static/js/{index-1nwwvv29.js → index-vjmg7kn5.js} +2 -2
  97. package/dist/client/static/js/index-vkqb4dnt.js +1 -0
  98. package/dist/client/static/js/{index-nzhwd6t3.js → index-wbws16ag.js} +2 -2
  99. package/dist/client/static/js/{index-528x5x8c.js → index-wrcdc9vz.js} +1 -1
  100. package/dist/client/static/js/{index-2zntn964.js → index-x9r7zfp4.js} +2 -2
  101. package/dist/client/static/js/{index-mhnwyra0.js → index-xq5f3nxa.js} +2 -2
  102. package/dist/client/static/js/index-xwjbq003.js +2 -0
  103. package/dist/client/static/js/{index-2gbfke1a.js → index-yf93db65.js} +1 -1
  104. package/dist/client/static/js/{index-tkfxnnr5.js → index-ykm7a3cp.js} +2 -2
  105. package/dist/client/static/js/{index-t0yv1375.js → index-z0fkfphe.js} +2 -2
  106. package/dist/client/static/js/{index-84vmdg3k.js → index-z25ss7xj.js} +1 -1
  107. package/dist/client/static/js/{index-dmv2zasz.js → index-z4530r3c.js} +2 -2
  108. package/dist/client/static/js/info-A6RAGUB7-1xtdxjz2.js +1 -0
  109. package/dist/client/static/js/{infoDiagram-VRGFBTTK-yd4zwrtv.js → infoDiagram-VRGFBTTK-r1p25738.js} +2 -2
  110. package/dist/client/static/js/ini-5f4zqtqr.js +1 -0
  111. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-7sjp09d4.js → ishikawaDiagram-OU5B5YK6-afgrqdrt.js} +3 -3
  112. package/dist/client/static/js/java-jj41mty3.js +1 -0
  113. package/dist/client/static/js/javascript-n9w9p97f.js +1 -0
  114. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-qh9jk7qk.js → journeyDiagram-ZHPQQLJL-hepa4wk7.js} +5 -5
  115. package/dist/client/static/js/json-rnh2h17x.js +1 -0
  116. package/dist/client/static/js/jsx-4gecrt29.js +1 -0
  117. package/dist/client/static/js/{julia-mgsev9df.js → julia-yv2j8qd0.js} +1 -1
  118. package/dist/client/static/js/{kanban-definition-PNTS6WVX-cjc8k0jk.js → kanban-definition-PNTS6WVX-jysft8ya.js} +5 -5
  119. package/dist/client/static/js/lua-zszaw2f7.js +1 -0
  120. package/dist/client/static/js/markdown-nm6gw4v4.js +1 -0
  121. package/dist/client/static/js/{mermaid.core-vw0b7r0k.js → mermaid.core-0m90b0s8.js} +7 -7
  122. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-jyhtpt1z.js → mindmap-definition-NLK3R4M7-x2rrzpvr.js} +8 -8
  123. package/dist/client/static/js/one-dark-pro-09d8p5vy.js +1 -0
  124. package/dist/client/static/js/one-light-g3ednt6p.js +1 -0
  125. package/dist/client/static/js/packet-AYTQ26CC-zm1r82x5.js +1 -0
  126. package/dist/client/static/js/{pegDiagram-GJSIUBJH-80ygdd29.js → pegDiagram-GJSIUBJH-z7vb7f1z.js} +1 -1
  127. package/dist/client/static/js/{perl-6n93vjsa.js → perl-917pjq5a.js} +1 -1
  128. package/dist/client/static/js/{php-w23nmbtc.js → php-hwz75qzt.js} +1 -1
  129. package/dist/client/static/js/pie-WAS4IAKB-sqa7321j.js +1 -0
  130. package/dist/client/static/js/{pieDiagram-5QR66LMP-6vgh7ntn.js → pieDiagram-5QR66LMP-jqv6v4e6.js} +3 -3
  131. package/dist/client/static/js/properties-rkptax7r.js +1 -0
  132. package/dist/client/static/js/python-qf1se1mj.js +1 -0
  133. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-k5byajmm.js → quadrantDiagram-O4NWA36T-w2h8yxrv.js} +6 -6
  134. package/dist/client/static/js/r-ms0cygq2.js +1 -0
  135. package/dist/client/static/js/radar-RG4KPBEZ-z3z82syp.js +1 -0
  136. package/dist/client/static/js/railroad-74A4TZTK-z6swcqq2.js +1 -0
  137. package/dist/client/static/js/railroad-abnf-HS5TGJTU-33km6py4.js +1 -0
  138. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zbf1xmq.js +1 -0
  139. package/dist/client/static/js/railroad-peg-WCYAUIDC-wte1xzzy.js +1 -0
  140. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-qffrkk7g.js → railroadDiagram-XR7U4H2S-nd09yac3.js} +1 -1
  141. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-r80w7tdp.js → requirementDiagram-PLB6GJNP-t61zxh5v.js} +10 -10
  142. package/dist/client/static/js/{ruby-ag3b3t9t.js → ruby-er7ayhte.js} +1 -1
  143. package/dist/client/static/js/{rust-a9jcfy2e.js → rust-avnkhh0p.js} +1 -1
  144. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-g9qdy74b.js → sankeyDiagram-IPEJSGJF-2f7h2cmw.js} +4 -4
  145. package/dist/client/static/js/{sass-x0eez0kp.js → sass-n47tt136.js} +1 -1
  146. package/dist/client/static/js/{scss-qycakpjn.js → scss-kvev49ga.js} +1 -1
  147. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-nywg1eq3.js → sequenceDiagram-PO4LG4MO-kfb5d7zd.js} +19 -19
  148. package/dist/client/static/js/{sizeCapture-INFHLROL-m5pks027.js → sizeCapture-INFHLROL-amfg19se.js} +1 -1
  149. package/dist/client/static/js/sql-hd42h8wx.js +1 -0
  150. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-xzzv780w.js → stateDiagram-v2-GCMORJYK-k5hx7btx.js} +3 -3
  151. package/dist/client/static/js/{svelte-tg19by0f.js → svelte-2pmz35vx.js} +1 -1
  152. package/dist/client/static/js/{swimlanes-2SLR337P-n4q5ad13.js → swimlanes-2SLR337P-wv3rp8kk.js} +1 -1
  153. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-6y8zdbm4.js +8 -0
  154. package/dist/client/static/js/{timeline-definition-EJHVYXUP-j9pde7sa.js → timeline-definition-EJHVYXUP-0re95wtn.js} +6 -6
  155. package/dist/client/static/js/treeView-Q6P3EWNA-pvgx6n22.js +1 -0
  156. package/dist/client/static/js/treemap-WGGIJYW6-3n9zm628.js +1 -0
  157. package/dist/client/static/js/tsx-gx7td06z.js +1 -0
  158. package/dist/client/static/js/typescript-1a808spn.js +1 -0
  159. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-ehnc0600.js → usecaseDiagram-POWQR4AR-yrje14qp.js} +44 -44
  160. package/dist/client/static/js/{vennDiagram-UO4OBE2U-cp4kj6kw.js → vennDiagram-UO4OBE2U-jxkmrfy5.js} +7 -7
  161. package/dist/client/static/js/{vue-mhj4sme0.js → vue-d5gpjfgn.js} +1 -1
  162. package/dist/client/static/js/wardley-WFR3VGLG-7m07ewc4.js +1 -0
  163. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-eegf1jpw.js → wardleyDiagram-VNRHLVJA-d3v2m9b1.js} +3 -3
  164. package/dist/client/static/js/xml-3117mxd9.js +1 -0
  165. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-zkkqfyex.js → xychartDiagram-PMCCYNJV-9a1s1rjt.js} +5 -5
  166. package/dist/client/static/js/yaml-dmvh8vyt.js +1 -0
  167. package/extensions/kabmo-modes/index.ts +1 -1
  168. package/extensions/kabmo-modes/parked.test.ts +2 -2
  169. package/extensions/kabmo-modes/parked.ts +10 -9
  170. package/extensions/kabmo-modes/plan.test.ts +4 -4
  171. package/extensions/kabmo-modes/plan.ts +6 -6
  172. package/extensions/kabmo-modes/session.ts +2 -2
  173. package/package.json +1 -1
  174. package/src/client/components/common/FolderPicker.tsx +1 -1
  175. package/src/client/components/common/Modal.tsx +8 -3
  176. package/src/client/components/common/NotificationPermissionDialog.test.tsx +8 -3
  177. package/src/client/components/common/NotificationPermissionDialog.tsx +7 -9
  178. package/src/client/components/common/PWAInstallButton.tsx +1 -1
  179. package/src/client/components/common/header-panel-buttons/index.tsx +5 -1
  180. package/src/client/components/common/shell-update-button/Modal.tsx +31 -36
  181. package/src/client/components/common/shell-update-button/index.test.tsx +5 -2
  182. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +16 -0
  183. package/src/client/components/layout/desktop-layout/RightColumn.test.tsx +204 -0
  184. package/src/client/components/layout/desktop-layout/RightColumn.tsx +52 -15
  185. package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
  186. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +4 -6
  187. package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +1 -1
  188. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +1 -1
  189. package/src/client/components/mobile/LayoutWrapper.tsx +9 -43
  190. package/src/client/components/mobile/RightSidebar.tsx +31 -12
  191. package/src/client/components/mobile/SessionSidebar.tsx +112 -137
  192. package/src/client/components/mobile/drawer-strip.tsx +85 -0
  193. package/src/client/components/mobile/left-drawer-nav.test.tsx +350 -0
  194. package/src/client/components/mobile/mobile-drawer-reveals.test.tsx +194 -0
  195. package/src/client/components/mobile/mobile-drawer-reveals.ts +138 -0
  196. package/src/client/components/mobile/mobile-main-view/Header.tsx +12 -24
  197. package/src/client/components/mobile/mobile-right-sidebar/Action.tsx +57 -0
  198. package/src/client/components/mobile/mobile-right-sidebar/Chrome.tsx +14 -87
  199. package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +2 -7
  200. package/src/client/components/mobile/mobile-right-sidebar/Header.test.tsx +157 -0
  201. package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +109 -105
  202. package/src/client/components/mobile/mobile-right-sidebar/OutlineButton.tsx +1 -1
  203. package/src/client/components/mobile/mobile-right-sidebar/Overflow.tsx +95 -0
  204. package/src/client/components/mobile/mobile-session-sidebar/Body.tsx +212 -0
  205. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +7 -9
  206. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +2 -2
  207. package/src/client/components/mobile/mobile-session-sidebar/use-dock.ts +29 -8
  208. package/src/client/components/mobile/mobile-session-sidebar/use-drawer-tabs.ts +97 -0
  209. package/src/client/components/settings/Band.test.tsx +83 -0
  210. package/src/client/components/settings/Band.tsx +96 -0
  211. package/src/client/components/settings/Modal.tsx +44 -69
  212. package/src/client/components/settings/apply-side-effects.ts +15 -4
  213. package/src/client/components/settings/band-height.test.tsx +16 -3
  214. package/src/client/components/settings/categories/AppearanceSettings.test.tsx +35 -9
  215. package/src/client/components/settings/categories/AppearanceSettings.tsx +2 -0
  216. package/src/client/components/settings/categories/ChatSettings.test.tsx +32 -9
  217. package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
  218. package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
  219. package/src/client/components/settings/categories/appearance-settings/PanelNavSection.tsx +40 -223
  220. package/src/client/components/settings/categories/appearance-settings/nav-choice.tsx +176 -0
  221. package/src/client/components/settings/categories/appearance-settings/nav-miniatures.tsx +93 -0
  222. package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +1 -1
  223. package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +1 -1
  224. package/src/client/components/settings/categories/notification-settings/PermissionNotice.tsx +1 -1
  225. package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +1 -1
  226. package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +1 -1
  227. package/src/client/components/settings/drill.tsx +113 -0
  228. package/src/client/components/settings/master-detail/GroupDetail.tsx +14 -6
  229. package/src/client/components/settings/master-detail/GroupSidebar.tsx +9 -1
  230. package/src/client/components/settings/master-detail/index.tsx +45 -25
  231. package/src/client/components/workspace/chat-timeline/MessageList.test.ts +11 -0
  232. package/src/client/components/workspace/chat-timeline/MessageList.tsx +29 -21
  233. package/src/client/components/workspace/chat-timeline/MobileTurnJump.tsx +1 -1
  234. package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +1 -1
  235. package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +4 -0
  236. package/src/client/components/workspace/chat-timeline/ToolCallingSection.test.ts +23 -6
  237. package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +1 -1
  238. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +19 -2
  239. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +1 -1
  240. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +1 -1
  241. package/src/client/components/workspace/chat-timeline/index.tsx +5 -9
  242. package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +1 -1
  243. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormAsk.test.tsx +4 -4
  244. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormDialog.test.tsx +127 -0
  245. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormDialog.tsx +225 -0
  246. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.test.tsx +5 -4
  247. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +1 -1
  248. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/PluginPendingInteractions.test.ts +2 -2
  249. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.test.ts +4 -3
  250. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +40 -4
  251. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Footer.tsx +1 -1
  252. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +1 -1
  253. package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +5 -1
  254. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +8 -3
  255. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +5 -0
  256. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +16 -7
  257. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +16 -4
  258. package/src/client/components/workspace/chat-timeline/tool-renderers/registry.ts +37 -12
  259. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +4 -3
  260. package/src/client/components/workspace/diff-panel/index.tsx +1 -1
  261. package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +1 -1
  262. package/src/client/components/workspace/file-explorer/ArchiveModals.tsx +1 -1
  263. package/src/client/components/workspace/file-explorer/Modals.tsx +4 -4
  264. package/src/client/components/workspace/git-panel/Modals.tsx +1 -1
  265. package/src/client/components/workspace/model-dropdown/CloseButton.tsx +38 -0
  266. package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +16 -25
  267. package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +30 -9
  268. package/src/client/components/workspace/model-dropdown/Header.tsx +33 -21
  269. package/src/client/components/workspace/model-dropdown/Panel.tsx +19 -4
  270. package/src/client/components/workspace/model-dropdown/picker-close.test.tsx +139 -0
  271. package/src/client/components/workspace/model-dropdown/placement.test.tsx +9 -7
  272. package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +1 -1
  273. package/src/client/components/workspace/wiki-panel/NavModal.tsx +1 -1
  274. package/src/client/data/settings/omp-schema.json +103 -42
  275. package/src/client/hooks/chat/timeline/ask-form-frame.ts +33 -0
  276. package/src/client/hooks/chat/timeline/ask-frame-asks.ts +68 -0
  277. package/src/client/hooks/chat/timeline/ask-frame-buckets.ts +77 -0
  278. package/src/client/hooks/chat/timeline/ask-frames-context.ts +68 -0
  279. package/src/client/hooks/chat/timeline/ask-frames-form.test.ts +170 -0
  280. package/src/client/hooks/chat/timeline/ask-frames.test.ts +1 -1
  281. package/src/client/hooks/chat/timeline/ask-frames.ts +36 -93
  282. package/src/client/hooks/chat/timeline/row-measure.ts +75 -0
  283. package/src/client/hooks/chat/timeline/row-window.test.ts +41 -21
  284. package/src/client/hooks/chat/timeline/row-window.ts +6 -24
  285. package/src/client/hooks/workspace/left-dock.ts +19 -0
  286. package/src/client/hooks/workspace/mobile-panel-nav.ts +90 -0
  287. package/src/client/hooks/workspace/panel-nav.test.ts +42 -21
  288. package/src/client/hooks/workspace/panel-tabs-reveal.test.tsx +286 -0
  289. package/src/client/hooks/workspace/panel-tabs-reveal.ts +174 -0
  290. package/src/client/hooks/workspace/panel-tabs.ts +22 -4
  291. package/src/client/hooks/workspace/session-state/index.test.tsx +145 -0
  292. package/src/client/hooks/workspace/session-state/index.ts +28 -16
  293. package/src/client/lib/ui/phone-row.test.ts +52 -0
  294. package/src/client/lib/ui/phone-row.ts +71 -0
  295. package/src/client/press-state.test.ts +179 -0
  296. package/src/client/tailwind.css +146 -0
  297. package/src/server/lib/bundler/titlebar-css.test.ts +10 -1
  298. package/src/server/lib/omp/rpc/constants.test.ts +6 -1
  299. package/src/shared/lib/chat/ask-form/data.ts +155 -0
  300. package/src/shared/lib/chat/ask-form/fields.ts +4 -0
  301. package/src/shared/lib/chat/ask-form/index.ts +8 -0
  302. package/src/shared/lib/chat/ask-form/types.ts +12 -0
  303. package/src/shared/lib/chat/timeline/tool-verbs.ts +28 -1
  304. package/src/shared/lib/chat/tool/tool-commands.test.ts +102 -0
  305. package/src/shared/lib/chat/tool/tool-commands.ts +124 -0
  306. package/src/shared/lib/omp/config/schema-releases.test.ts +34 -1
  307. package/src/shared/lib/omp/dialog-methods.ts +6 -0
  308. package/src/shared/lib/omp/session/wait-idle.ts +7 -3
  309. package/src/shared/lib/settings/defaults.ts +3 -2
  310. package/src/shared/lib/workspace/panel-nav.test.ts +26 -19
  311. package/src/shared/lib/workspace/panel-nav.ts +20 -9
  312. package/src/shared/types/omp/agent.ts +20 -3
  313. package/src/shared/types/settings/state.ts +17 -5
  314. package/dist/client/static/js/ImageView-6ksvyzqv.js +0 -1
  315. package/dist/client/static/js/LayoutWrapper-px60417t.js +0 -2
  316. package/dist/client/static/js/Modal-yv1718s1.js +0 -59
  317. package/dist/client/static/js/architecture-7GRP2DOG-bch3nye9.js +0 -1
  318. package/dist/client/static/js/bash-mevzaywf.js +0 -1
  319. package/dist/client/static/js/c-y1y6v00q.js +0 -1
  320. package/dist/client/static/js/cpp-wk9z0c5g.js +0 -1
  321. package/dist/client/static/js/css-3w3p9s67.js +0 -1
  322. package/dist/client/static/js/css-g85rwzty.js +0 -1
  323. package/dist/client/static/js/cynefin-OW5HDTMX-vqy5jtnk.js +0 -1
  324. package/dist/client/static/js/eventmodeling-NTZA5JFV-65ph4s3m.js +0 -1
  325. package/dist/client/static/js/flowDiagram-KWPJA3E3-hekt0qsb.js +0 -1
  326. package/dist/client/static/js/gitGraph-4MIJSDKK-t45ekjb6.js +0 -1
  327. package/dist/client/static/js/graphql-027z8sc0.js +0 -1
  328. package/dist/client/static/js/html-fqda6wxx.js +0 -1
  329. package/dist/client/static/js/index-252br0k2.js +0 -1
  330. package/dist/client/static/js/index-6bm4pw90.css +0 -1
  331. package/dist/client/static/js/index-80qxk9hx.js +0 -1
  332. package/dist/client/static/js/index-9674dxb4.js +0 -1
  333. package/dist/client/static/js/index-9k4121z4.js +0 -4
  334. package/dist/client/static/js/index-b6454rme.js +0 -12
  335. package/dist/client/static/js/index-ck0fd3aj.js +0 -2
  336. package/dist/client/static/js/index-jdf1tks1.js +0 -2
  337. package/dist/client/static/js/index-q58e8x6j.js +0 -1
  338. package/dist/client/static/js/info-A6RAGUB7-mw29xbwf.js +0 -1
  339. package/dist/client/static/js/ini-3cx6tmv4.js +0 -1
  340. package/dist/client/static/js/java-zs6qh1dm.js +0 -1
  341. package/dist/client/static/js/javascript-b9mkygak.js +0 -1
  342. package/dist/client/static/js/json-qn73s8xb.js +0 -1
  343. package/dist/client/static/js/jsx-gahhfczw.js +0 -1
  344. package/dist/client/static/js/lua-d8enp14s.js +0 -1
  345. package/dist/client/static/js/markdown-qetaj4vp.js +0 -1
  346. package/dist/client/static/js/one-dark-pro-axkq0m3s.js +0 -1
  347. package/dist/client/static/js/one-light-pncb08qd.js +0 -1
  348. package/dist/client/static/js/packet-AYTQ26CC-md85wpjq.js +0 -1
  349. package/dist/client/static/js/pie-WAS4IAKB-4grcqnp8.js +0 -1
  350. package/dist/client/static/js/properties-g6tpq003.js +0 -1
  351. package/dist/client/static/js/python-cy06fzhg.js +0 -1
  352. package/dist/client/static/js/r-vw8berfv.js +0 -1
  353. package/dist/client/static/js/radar-RG4KPBEZ-7j9prhg1.js +0 -1
  354. package/dist/client/static/js/railroad-74A4TZTK-g8x2jps1.js +0 -1
  355. package/dist/client/static/js/railroad-abnf-HS5TGJTU-cbg7k68h.js +0 -1
  356. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-xfvjk9f8.js +0 -1
  357. package/dist/client/static/js/railroad-peg-WCYAUIDC-7w97805z.js +0 -1
  358. package/dist/client/static/js/sql-bwnasywx.js +0 -1
  359. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-253nz20y.js +0 -8
  360. package/dist/client/static/js/treeView-Q6P3EWNA-xhf1r6c3.js +0 -1
  361. package/dist/client/static/js/treemap-WGGIJYW6-4n3j7ekq.js +0 -1
  362. package/dist/client/static/js/tsx-3dzv8h6k.js +0 -1
  363. package/dist/client/static/js/typescript-44vs0wn4.js +0 -1
  364. package/dist/client/static/js/wardley-WFR3VGLG-fb0py35r.js +0 -1
  365. package/dist/client/static/js/xml-yvv5fn3k.js +0 -1
  366. package/dist/client/static/js/yaml-avewh7n5.js +0 -1
  367. package/src/client/hooks/workspace/mobile-right-panel-nav.ts +0 -63
  368. package/src/shared/lib/ui/safe-area.test.ts +0 -28
  369. package/src/shared/lib/ui/safe-area.ts +0 -42
@@ -1,9 +1,9 @@
1
- import{d,n,o,K,i,u,a,xr,e,s,za,_e,Ua,m,Ln,Se,L,S,nt,f,B,se,rt,re,ge,pe,Pn,rn,On,P,D,Ea,U,Ba,dn,b,_r,Bo,Xn,Pp,Be,_,$p,lg,fr,gr,At,ot,me,Vu,pi,Z,st,lt,ht,el,qe,be,J}from"./index-q36gq3yz.js";import{Fp,kr}from"./index-ex3w7t7s.js";var jt={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"}]]},Ve=s(jt);var Ut={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"}]]},Ye=s(Ut);function Xe({message:t,hasStagedChanges:l,isBusy:c=!1,amend:r=!1,seeded:p=!1,isGenerating:h=!1,suggestion:g=null,generated:v=!1,onToggleAmend:N,onChangeMessage:M,onCommit:w,onGenerate:C,onUseSuggestion:R,onDismissSuggestion:G}){let T=t.trim().length>0&&!c&&(r||l),y=(r||l)&&!c&&!h,x=r?"Rewrite the previous commit with this message":l?"Commit staged changes":"Stage changes first",k=h?"Generating…":r||l?"Generate a commit message from the 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:[g&&e("div",{className:"rounded border border-ink/20 bg-paper p-2.5 space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Generated message"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:R,className:"px-2 py-0.5 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:"Use"}),e("button",{type:"button",onClick:G,className:"px-2 py-0.5 rounded border border-ink/20 text-ink/70 text-[10px] font-medium hover:bg-ink/5 transition-colors cursor-pointer",children:"Dismiss"})]})]}),e("pre",{className:"whitespace-pre-wrap break-words text-[11px] text-ink/80 font-mono max-h-32 overflow-y-auto",children:g})]}),e("textarea",{value:t,onChange:(A)=>M(A.currentTarget.value),onKeyDown:(A)=>{if(A.key==="Enter"&&(A.metaKey||A.ctrlKey)&&T)A.preventDefault(),w()},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"}),v&&t.trim().length>0&&e("div",{className:"flex items-center gap-1 text-[10px] text-ink/40",children:[e(Se,{size:10})," Generated from staged changes"]}),e("div",{className:"flex flex-wrap 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:(A)=>N?.(A.currentTarget.checked),className:`${be} 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:C,disabled:!y,title:k,"aria-label":"Generate commit message with AI",className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[h?e(m,{size:12,className:"animate-spin"}):e(Se,{size:12}),h?"Generating…":"Generate"]}),e("button",{type:"button",onClick:w,disabled:!T,title:x,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(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function Ze({operation:t,conflicts:l,isBusy:c,onAbort:r,onContinue:p}){let h=Bo[t],g=l.length,v=g===0,N=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(S,{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:l.map((M)=>e("div",{className:"truncate",title:M,children:M},M))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:c,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(dn,{size:12}),"Abort ",h]}),N&&e("button",{type:"button",onClick:p,disabled:c||!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(Pn,{size:12}),"Continue ",h]})]})]})}function Qe({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:N,onManageBranches:M,optionsRef:w,showOptions:C,setShowOptions:R,onHistory:G,onGraph:T,viewMode:y,setViewMode:x,isBusy:k=!1,syncCount:A={ahead:0,behind:0},syncing:F=!1,onSync:O,onFetch:V,detached:E=!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:()=>c(!l),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:E?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(pe,{size:12,className:E?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${E?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),l&&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((H)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(H),c(!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:H}),r===H&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==H&&e("button",{type:"button",onClick:()=>{v(H),c(!1)},title:`Merge ${H} into ${r}`,"aria-label":`Merge ${H} 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(Pn,{size:12})})]},H))]}),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((H)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(H),c(!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:H}),r===H&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==H&&e("button",{type:"button",onClick:()=>{v(H),c(!1)},title:`Merge ${H} into ${r}`,"aria-label":`Merge ${H} 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(Pn,{size:12})})]},H))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{N(),c(!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(P,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:M,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(Ba,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:w,children:[e("button",{type:"button",onClick:V,disabled:k,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(za,{size:13})}),e("button",{type:"button",onClick:O,disabled:k,title:F?"Syncing with upstream…":A.ahead>0&&A.behind>0?`Pull ${A.behind} then push ${A.ahead} commit(s)`:A.ahead>0?`Push ${A.ahead} commit(s)`:A.behind>0?`Pull ${A.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":F,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${F?"":"disabled:opacity-40"}`,children:[e(D,{size:13,className:F?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",A.ahead," ↓",A.behind]})]}),e("button",{type:"button",onClick:G,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Ln,{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(Pn,{size:13})}),e("button",{type:"button",onClick:()=>R(!C),title:"View Options","aria-label":"View Options","aria-expanded":C,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(_e,{size:13})}),C&&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(Ye,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),y==="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(Ve,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),y==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Je({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e(At,{left:e(d,{children:[e(Fp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(kr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:l,scanning:p,onRefreshRepos:v})]}),right:e(ot,{label:"Refresh",onClick:g,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let h=Xn(t.status,l),{charStatus:g,colorClass:v}=h,N=t.file.split("/"),M=N.pop()||t.file,w=N.length>0?N.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:l,status:g,repo:c||".",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(st,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:M}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w})]}),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:[!l&&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(dn,{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(P,{size:11})})]}),l&&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(rn,{size:11})})]})})]})}function et({change:t,repo:l,rootPath:c,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),N=t.file.split("/"),M=N.pop()||t.file,w=N.length>0?N.join("/"):"",C=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:l,root:c}}))},R=async()=>{let y=!p;if(h(y),y&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)x.set("root",c);try{let A=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(A.markers??{})}catch{v({})}}},G=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:C,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Ua,{size:11,className:"text-warning flex-shrink-0"}),e(st,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:M}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w}),_r(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(y)=>{y.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(rt,{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 ${G} — \`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 ",G]}),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 Wt(t){let l={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=l,N="";for(let M=0;M<g.length;M++){let w=g[M];N=N?`${N}/${w}`:w;let C=M===g.length-1;if(C&&!h)v.children.push({id:N,name:w,path:N,type:"file",change:r,children:[],changeCount:1});else{let G=v.children.find((T)=>T.type==="folder"&&T.name===w);if(!G)G={id:N,name:w,path:N,type:"folder",children:[],changeCount:0,change:C&&h?r:void 0},v.children.push(G);v=G}}}function c(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=c(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 c(l),l.children}function tt(t){let{sessionId:l,ready:c,read:r}=$p(),p=u(()=>Wt(t),[t]),h=u(()=>{let R=new Set;function G(T){for(let y of T)if(y.type==="folder"){if(R.add(y.id),y.children&&y.children.length>0)G(y.children)}}return G(p),R},[p]),[g,v]=_("git.expandedFolders",[]),N=u(()=>new Set(g),[g]),M=i(null);o(()=>{if(!c||M.current===l)return;if(h.size===0)return;if(M.current=l,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[c,l,h,r,v]);let w=a((R)=>{v((G)=>{let T=new Set(G);if(T.has(R))T.delete(R);else T.add(R);return Array.from(T)})},[v]),C=a((R)=>N.has(R),[N]);return{tree:p,expandedFolders:N,toggleFolder:w,isFolderOpen:C,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function He({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",N=v?c(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:N?e(B,{size:12}):e(se,{size:12})}),e(st,{name:t.name,isFolder:!0,isOpen:N,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:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.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(dn,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.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(P,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.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(rn,{size:11})})})})]}),N&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((y)=>e(He,{node:y,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g},y.id))})]});let M=t.change,w=Xn(M?.status||"M",l),{charStatus:C,colorClass:R}=w,G=M?M.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:G,staged:l,status:C,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: ${w.label}`,children:C})}),e(st,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:G,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:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("revert",G)},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(dn,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("stage",G)},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(P,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("unstage",G)},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(rn,{size:11})})})})]})}function ze({changes:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=tt(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((N)=>e(He,{node:N,isStaged:l,isFolderOpen:g,toggleFolder:v,onAction:p,repo:c,rootPath:r},N.id))})}function it({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,N]=_("git.stagedExpanded",!0),[M,w]=_("git.unstagedExpanded",!0),[C,R]=_("git.conflictsExpanded",!0),G=t.filter((x)=>_r(x.status)),T=t.filter((x)=>{if(_r(x.status))return!1;let k=x.status;return k&&k[0]!==" "&&k[0]!=="?"}),y=t.filter((x)=>{if(_r(x.status))return!1;let k=x.status;return k&&k[1]!==" "&&k[1]!=="?"||k==="??"});if(l&&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:[G.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(!C),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:C?"▾":"▸"}),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:G.length})]})}),C&&G.map((x)=>e(et,{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:()=>N(!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(rn,{size:12})})})]}),v&&(c==="tree"?e(ze,{changes:T,isStaged:!0,repo:r,rootPath:p,onAction:h}):T.map((x)=>e(Fe,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),y.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:()=>w(!M),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:M?"▾":"▸"}),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:y.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(dn,{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(P,{size:12})})]})]}),M&&(c==="tree"?e(ze,{changes:y,isStaged:!1,repo:r,rootPath:p,onAction:h}):y.map((x)=>e(Fe,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function at({matches:t,loaded:l,total:c,hasMore:r,isFiltering:p}){if(p)return`${t} of ${l} loaded`;if(typeof c==="number"&&c>0)return r||l<c?`${l} of ${c}`:`${c} commits`;return r?`${l}+ commits`:`${l} commits`}function ct({isGraphMode:t,onToggleMode:l,searchQuery:c,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:N,totalCount:M,hasMore:w}){let C=at({matches:v,loaded:N,total:M,hasMore:w,isFiltering:c.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/80 border border-ink/10 whitespace-nowrap",children:C})]}),e("p",{className:"text-xs text-muted mt-0.5 hidden lg:block",children:t?"Follow branch topology and inspect commits.":"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 text-xs lg:bg-ink/5 lg:p-0.5 lg:rounded-lg lg:border lg:border-ink/10",children:[e("button",{type:"button",onClick:()=>l(!1),title:"History view","aria-label":"History view","aria-pressed":!t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${!t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Ln,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>l(!0),title:"Graph view","aria-label":"Graph view","aria-pressed":t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Pn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:p,disabled:g,className:"tap-target flex items-center justify-center gap-1.5 p-2 rounded-md text-ink/70 transition-colors cursor-pointer text-xs disabled:opacity-40 lg:px-2.5 lg:py-1.5 lg:border lg:border-ink/15 lg:hover:bg-ink/5 lg:hover:text-ink",title:"Refresh commit history","aria-label":"Refresh commit history",children:[e(Ea,{size:13,className:g?"animate-spin text-ink":"","aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Refresh"})]}),e("button",{type:"button",onClick:h,className:"tap-target p-2 -mr-1 rounded-md hover:bg-ink/5 text-muted hover:text-ink transition-colors cursor-pointer",title:"Close modal","aria-label":"Close commit history",children:e(b,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(U,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/55","aria-hidden":"true"}),e("input",{type:"text",value:c,onChange:(R)=>r(R.currentTarget.value),placeholder:"Filter commits by message, author, or hash...","aria-label":"Filter commits",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"}),c&&e("button",{type:"button",onClick:()=>r(""),"aria-label":"Clear filter",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/55 hover:text-ink cursor-pointer",children:e(b,{size:12,"aria-hidden":"true"})})]})]})}var ce=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function Oe(t,l){if(!t||!l)return!1;if(t===l)return!0;let c=Math.min(t.length,l.length);if(c>=4)return t.substring(0,c)===l.substring(0,c);return!1}function Re(t){let l=new Map,c=[];for(let r of t){if(typeof r.lane==="number"){l.set(r.hash,r.lane);continue}let p=c.findIndex((g)=>Oe(g,r.hash)||Oe(g,r.shortHash));if(p===-1)if(p=c.indexOf(null),p===-1)p=c.length,c.push(r.hash);else c[p]=r.hash;l.set(r.hash,p);let h=r.parents&&r.parents[0];if(h)c[p]=h;else c[p]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let v=r.parents[g];if(!c.some((M)=>Oe(M,v))){let M=c.indexOf(null);if(M===-1)c.push(v);else c[M]=v}}}return l}function dt(t,l,c,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=l.get(g.hash)??0,N=c[g.hash]??0,M=ce[v%ce.length];if(!g.parents||g.parents.length===0)continue;for(let w of g.parents){let C=h.get(w);if(typeof C!=="number"&&w.length>=7)C=h.get(w.substring(0,7));if(typeof C==="number"){let R=t[C],G=l.get(R.hash)??v,T=c[R.hash]??N+60;p.push({fromHash:g.hash,toHash:R.hash,fromLane:v,toLane:G,fromY:N,toY:T,color:ce[v%ce.length]})}else p.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:v,toLane:v,fromY:N,toY:Math.max(N+80,r),color:M})}}return p}function pt(t,l,c,r){if(Math.abs(t-c)<1)return`M ${t} ${l} L ${c} ${r}`;let p=r-l,h=l+p*0.45,g=r-p*0.45;return`M ${t} ${l} C ${t} ${h}, ${c} ${g}, ${c} ${r}`}function mt({commits:t,nodePositions:l,expandedHash:c,hoveredHash:r,isGraphMode:p,laneWidth:h=18,paddingLeft:g=16,totalHeight:v}){let N=u(()=>{if(!p){let R=new Map;return t.forEach((G)=>R.set(G.hash,0)),R}return Re(t)},[t,p]),M=u(()=>{let R=0;return N.forEach((G)=>{if(G>R)R=G}),R},[N]),w=p?(M+1)*h+g*2:36,C=u(()=>{if(!p){let R=[];for(let G=0;G<t.length-1;G++){let T=l[t[G].hash]??G*60+20,y=l[t[G+1].hash]??(G+1)*60+20;R.push({fromHash:t[G].hash,toHash:t[G+1].hash,fromLane:0,toLane:0,fromY:T,toY:y,color:"var(--theme-ink)"})}return R}return dt(t,N,l,v)},[t,N,l,v,p]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:w,height:v},"aria-hidden":"true",children:e("svg",{className:"w-full h-full overflow-visible",style:{width:w,height:v},children:[C.map((R)=>{let G=p?g+R.fromLane*h:16,T=p?g+R.toLane*h:16,y=p?R.color:"currentColor",x=p?0.95:0.25,k=pt(G,R.fromY,T,R.toY);return e("path",{d:k,fill:"none",stroke:y,strokeWidth:p?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let G=N.get(R.hash)??0,T=p?g+G*h:16,y=l[R.hash]??20,x=c===R.hash||c===R.shortHash,k=r===R.hash||r===R.shortHash,A=p?ce[G%ce.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(x||k)&&e("circle",{cx:T,cy:y,r:8,fill:A,fillOpacity:x?0.35:0.2,stroke:A,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:T,cy:y,r:p?4:4.5,fill:p?"var(--theme-paper)":A,stroke:A,strokeWidth:p?2.5:1.5}),p&&e("circle",{cx:T,cy:y,r:1.8,fill:A})]},`node-${R.hash}`)})]})})}var qt=[{action:"checkout",label:"checkout"},{action:"create_branch_here",label:"create branch here"},{action:"cherry_pick",label:"cherry-pick"},{action:"revert",label:"revert"},{action:"reset",label:"reset..."},{action:"merge",label:"merge into current"},{action:"rebase",label:"rebase onto this"}];function ut({commit:t,onAction:l}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:qt.map(({action:c,label:r})=>e("button",{type:"button",onClick:(p)=>{p.stopPropagation(),l(c,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",children:r},c))})}var Ge=3;function Kt(t){let l=[];for(let c=0;c<t.length;c+=1){if(t[c].type!=="context"){l.push({row:t[c],index:c});continue}let r=c;while(r<t.length&&t[r].type==="context")r+=1;let p=r-c;if(p>Ge*2+1){for(let h=c;h<c+Ge;h+=1)l.push({row:t[h],index:h});l.push({row:{type:"elided",count:p-Ge*2},index:-1});for(let h=r-Ge;h<r;h+=1)l.push({row:t[h],index:h})}else for(let h=c;h<r;h+=1)l.push({row:t[h],index:h});c=r-1}return l}function ft({diffText:t,isLoading:l,filePath:c,fullContext:r=!1,onToggleContext:p}){let h=pi(),g=u(()=>{if(!t)return[];let w=[],C=1,R=1,G=t.split(/\r?\n/),y=G.some((x)=>x.startsWith("@@"))?G:[`@@ -0,0 +1,${G.length} @@`,...G.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of y){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 k=x.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(k)C=parseInt(k[1],10),R=parseInt(k[2],10);w.push({type:"meta",text:x})}else if(x.startsWith("+"))w.push({type:"add",text:x.slice(1),newNum:R++});else if(x.startsWith("-"))w.push({type:"del",text:x.slice(1),oldNum:C++});else{let k=x.startsWith(" ")?x.slice(1):x;w.push({type:"context",text:k,oldNum:C++,newNum:R++})}}return w},[t]),v=ht(c),N=u(()=>{let w=Array(g.length).fill(""),C=-1,R=(G)=>{if(C<0)return;let T=Vu(g.slice(C,G).map((y)=>y.text).join(`
3
- `),v);for(let y=C;y<G;y++)w[y]=T[y-C]??"";C=-1};return g.forEach((G,T)=>{if(G.type==="meta")R(T);else if(C<0)C=T}),R(g.length),w},[g,v,h]),M=u(()=>r?g.map((w,C)=>({row:w,index:C})):Kt(g),[g,r]);if(l)return e("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-muted 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-muted 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 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-muted",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(rt,{size:12,"aria-hidden":"true"})," Collapse context"]}):e(d,{children:[e(B,{size:12,"aria-hidden":"true"})," 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:M.map(({row:w,index:C},R)=>{if(w.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-muted text-[10px] text-center select-none",title:`${w.count} unchanged line(s) hidden`,children:["⋯ ",w.count," unchanged line",w.count===1?"":"s"," hidden ⋯"]},`elided-${R}`);let G=w,T=C;if(G.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-muted text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:G.text})]},T);let y=G.type==="add",x=G.type==="del";return e("div",{className:`flex items-start font-mono ${y?"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-ink/80 font-semibold":y?"bg-success/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.oldNum??(y?"+":"")}),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 ${y?"bg-success/15 text-ink/80 font-semibold":x?"bg-error/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.newNum??(x?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${y||x?"text-ink/80":"opacity-0"}`,children:y?"+":x?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:G.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:N[T]}}):" "})]},T)})})})]})}function gt({commit:t,isExpanded:l,onToggleExpand:c,onAction:r,onToggleFile:p,isExpandedFile:h,isLoadingFile:g,isFullContextFile:v,onToggleContext:N,fileDiffs:M,headerRef:w}){let[C,R]=n(!1),G=t.body?.trim()??"",T=G.length>0,y=t.files??[],x=y.length,k=x>0,A=T||k,F=(E)=>{E.stopPropagation(),navigator.clipboard.writeText(t.hash),R(!0),setTimeout(()=>R(!1),2000)},O=(E,H)=>{E.stopPropagation(),p(t.hash,H)},V=A?"border-b border-ink/5 transition-colors cursor-pointer hover:bg-ink/[0.015]":"border-b border-ink/5";return e("div",{onClick:A?c:void 0,"data-testid":"commit-row","data-commit-hash":t.hash,className:V,children:e("div",{className:"py-2.5 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((E,H)=>{let Q=E.includes("stash"),Y=E.includes("HEAD")||E.includes("main")||E.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${Q?"bg-warning/10 text-ink/80 border-warning/25 font-semibold":Y?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-muted border-ink/10 font-medium"}`,children:E},H)})}),e("div",{ref:w,className:"flex items-start gap-1.5",children:e("button",{type:"button",onClick:A?(E)=>{E.stopPropagation(),c()}:void 0,"aria-expanded":A?l:void 0,className:"flex flex-1 min-w-0 items-start gap-1.5 text-left cursor-pointer rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20",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}),A&&e("span",{className:"text-ink/55 flex-shrink-0 mt-0.5","aria-hidden":"true",children:l?e(B,{size:13}):e(se,{size:13})})]})}),T&&l&&e("div",{className:"border-l-2 border-ink/15 pl-3 py-1",children:e(J,{content:G,className:"text-ink/70"})}),e("div",{className:"flex items-center gap-x-2 gap-y-0.5 text-[11px] text-muted font-mono flex-wrap",children:[e("span",{children:t.author}),e("span",{children:t.date}),e("button",{type:"button",onClick:F,title:"Copy commit hash","aria-label":`Copy commit hash ${t.shortHash}`,className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[e("span",{children:t.shortHash}),C?e(f,{size:11,className:"text-success-text","aria-hidden":"true"}):e(re,{size:11,"aria-hidden":"true"})]}),k&&e("span",{children:[x," ",x===1?"file":"files"]})]})]}),l&&e("div",{className:"mt-2",children:e(ut,{commit:t,onAction:r})}),k&&l&&e("div",{className:"mt-2 flex flex-col gap-1",children:y.map((E,H)=>{let Q=h(t.hash,E.file),Y=`${t.hash}:${E.file}`,z=M[Y]!==void 0?M[Y]:E.diff,I=g(t.hash,E.file),W=E.status==="A"?"text-success-text font-bold":E.status==="D"?"text-error-text font-bold":E.status==="R"?"text-meta-text font-bold":"text-info-text font-bold";return e("div",{className:"flex flex-col",children:[e("button",{type:"button",onClick:(oe)=>O(oe,E),"aria-expanded":Q,className:"flex w-full items-center gap-2 py-1 px-2 rounded text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10 text-left",children:[e("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${W}`,children:E.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:E.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-text",children:["+",E.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error-text",children:["-",E.deletions]})]}),e("span",{className:"text-ink/55 group-hover:text-ink flex-shrink-0",children:Q?e(B,{size:13,"aria-hidden":"true"}):e(se,{size:13,"aria-hidden":"true"})})]}),Q&&e("div",{className:"pl-4 pr-1",children:e(ft,{diffText:z,isLoading:I,filePath:E.file,fullContext:v(t.hash,E.file),onToggleContext:()=>N(t.hash,E)})})]},H)})})]})})}var xe=50;function Vt(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c;if(typeof r.file!=="string"||!r.file)continue;l.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 l}function Ie(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c,p=typeof r.hash==="string"&&r.hash?r.hash:"";if(!p)continue;l.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:Vt(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return l}function xt({output:t,isGraphMode:l,rootPath:c,activeRepo:r}){let[p,h]=n(!1),[g,v]=n(t?.hasMore??t?.data?.length===xe),[N,M]=n(t?.total),w=u(()=>Ie(t?.data),[t?.data]),C=Array.isArray(t?.data)?t.data.length:0,[R,G]=n(w),[T,y]=n(C);o(()=>{if(G(w),y(C),v(t?.hasMore??C===xe),typeof t?.total==="number")M(t.total)},[w,C,t?.hasMore,t?.total]);let x=a(async()=>{if(p||!g)return;h(!0);try{let k=new FormData;if(k.set("actionType",l?"graph":"history"),k.set("limit",String(xe)),k.set("skip",String(T)),c)k.set("root",c);if(r)k.set("repo",r);let F=await(await fetch("/api/fs/git",{method:"POST",body:k})).json();if(F.success&&Array.isArray(F.data)){let O=Ie(F.data),V=F.data.length;if(G((E)=>{let H=new Set(E.map((Y)=>Y.hash)),Q=O.filter((Y)=>!H.has(Y.hash));return[...E,...Q]}),y((E)=>E+V),v(Boolean(F.hasMore??V===xe)),typeof F.total==="number")M(F.total)}else v(!1)}catch(k){console.error("Failed to load more commits:",k)}finally{h(!1)}},[p,g,l,T,c,r]);return{commits:R,hasMore:g,totalCount:N,isLoadingMore:p,handleLoadMore:x}}function bt({onExecuteAction:t,rootPath:l,activeRepo:c}){let[r,p]=n({}),[h,g]=n(new Set),[v,N]=n(new Set),[M,w]=n(new Set),C=a(async(y,x,k)=>{let A=`${y}:${x.file}`;N((F)=>new Set(F).add(A));try{let F=new FormData;if(F.set("actionType","commit_diff"),F.set("hash",y),F.set("file",x.file),k)F.set("full","1");if(l)F.set("root",l);if(c&&c!==".")F.set("repo",c);let V=await(await fetch("/api/fs/git",{method:"POST",body:F})).json();if(V&&typeof V.diff==="string")p((E)=>({...E,[A]:V.diff}));else if(V&&V.error)p((E)=>({...E,[A]:`// Error: ${V.error}`}))}catch(F){console.error("Failed to load file diff:",F);let O=F instanceof Error?F.message:"Network error";p((V)=>({...V,[A]:`// Error loading diff: ${O}`}))}finally{N((F)=>{let O=new Set(F);return O.delete(A),O})}},[l,c]),R=a(async(y,x)=>{let k=`${y}:${x.file}`,A=!h.has(k);if(g((F)=>{let O=new Set(F);if(O.has(k))O.delete(k);else O.add(k);return O}),A&&r[k]===void 0&&!x.diff)await C(y,x,!1)},[h,r,C]),G=a(async(y,x)=>{let k=`${y}:${x.file}`,A=!M.has(k);w((F)=>{let O=new Set(F);if(O.has(k))O.delete(k);else O.add(k);return O}),await C(y,x,A)},[M,C]),T=a((y,x)=>{if(!t)return;if(y==="checkout")t("checkout",void 0,{branch:x.hash});else if(y==="create_branch_here"){let k=window.prompt(`Create new branch at commit ${x.shortHash}:`,`branch-${x.shortHash}`);if(k?.trim())t("create_branch_at",void 0,{branch:k.trim(),hash:x.hash})}else if(y==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${x.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:x.hash})}else if(y==="revert"){if(window.confirm(`Revert commit ${x.shortHash}?`))t("revert_commit",void 0,{hash:x.hash})}else if(y==="reset"){let k=window.prompt(`Reset current branch to ${x.shortHash} (soft, mixed, hard):`,"soft");if(k&&["soft","mixed","hard"].includes(k.toLowerCase()))t("reset_commit",void 0,{hash:x.hash,mode:k.toLowerCase()})}else if(y==="merge"){if(window.confirm(`Merge commit ${x.shortHash} into current branch?`))t("merge_commit",void 0,{hash:x.hash})}else if(y==="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:M,handleToggleFile:R,handleToggleContext:G,handleCommitAction:T}}function vt(t){let[l,c]=n({page:t,hash:""}),r=l.page===t?l.hash:"",p=a((h)=>{c((g)=>{let v=g.page===t&&g.hash===h;return{page:t,hash:v?"":h}})},[t]);return{expandedHash:r,toggleExpanded:p}}function je({output:t,onClose:l,onRefresh:c,onExecuteAction:r,rootPath:p,activeRepo:h}){if(o(()=>{if(!t)return;let j=(q)=>{if(q.key==="Escape")l()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[t,l]),!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 N=g.graph,M=(j)=>v((q)=>({...q,graph:j})),[w,C]=n(""),{expandedHash:R,toggleExpanded:G}=vt(t),[T,y]=n(!1),{commits:x,hasMore:k,totalCount:A,isLoadingMore:F,handleLoadMore:O}=xt({output:t,isGraphMode:N,rootPath:p,activeRepo:h}),{fileDiffs:V,expandedFiles:E,loadingFiles:H,fullContextFiles:Q,handleToggleFile:Y,handleToggleContext:z,handleCommitAction:I}=bt({onExecuteAction:r,rootPath:p,activeRepo:h}),W=u(()=>{if(!w.trim())return x;let j=w.toLowerCase().trim();return x.filter((q)=>q.message.toLowerCase().includes(j)||q.author.toLowerCase().includes(j)||q.shortHash.toLowerCase().includes(j)||q.hash.toLowerCase().includes(j)||q.refs?.some((ne)=>ne.toLowerCase().includes(j)))},[x,w]),oe=i(null),ie=i(null),ve=i(null),ue=i({}),[fe,ye]=n({}),[Pe,$e]=n(800);o(()=>{let j=ve.current;if(!j||!k||F||w.trim())return;let q=new IntersectionObserver((ne)=>{if(ne[0].isIntersecting)O()},{root:oe.current,threshold:0.1});return q.observe(j),()=>q.disconnect()},[k,F,w,O]);let ae=a(()=>{if(!oe.current||!ie.current)return;let j=oe.current.getBoundingClientRect(),q=oe.current.scrollTop,ne={};W.forEach((he,De)=>{let Ne=ue.current[he.hash];if(Ne){let de=Ne.getBoundingClientRect();ne[he.hash]=de.top+de.height/2-j.top+q}else ne[he.hash]=De*60+20}),ye(ne);let Le=ie.current.offsetHeight;$e(Math.max(Le,oe.current.clientHeight,600))},[W]);K(()=>{ae();let j=requestAnimationFrame(()=>{ae()});return()=>cancelAnimationFrame(j)},[ae,W,V,E,N,R]),o(()=>{let j=ie.current;if(!j)return;let q=new ResizeObserver(()=>{ae()});q.observe(j);for(let ne of Array.from(j.children))q.observe(ne);return()=>q.disconnect()},[ae,W]);let ee=u(()=>Re(W),[W]),Me=u(()=>{let j=0;return ee.forEach((q)=>{if(q>j)j=q}),j},[ee]),ke=18,Ce=16,Te=N?(Me+1)*ke+Ce*2:36,Ae=()=>{y(!0),c?.(),setTimeout(()=>y(!1),600)};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:l,role:"dialog","aria-modal":"true","aria-label":t.title,children:e("div",{className:`glass-overlay bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden
1
+ import{d,n,o,K,i,u,a,xr,e,s,Ua,Ee,Ga,m,Pn,Se,L,_,at,f,B,se,ot,re,fe,me,$n,sn,zn,P,D,Ea,U,Ba,fn,b,_r,Bo,er,jp,Ie,S,Hp,hg,gr,Ar,bt,st,ue,ed,mi,Z,ct,ut,yt,il,He,be,J}from"./index-4cag7w6k.js";import{zp,kr}from"./index-c9e417cs.js";var jt={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"}]]},Ve=s(jt);var Ut={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"}]]},Ye=s(Ut);function Xe({message:t,hasStagedChanges:l,isBusy:c=!1,amend:r=!1,seeded:p=!1,isGenerating:h=!1,suggestion:g=null,generated:v=!1,onToggleAmend:N,onChangeMessage:M,onCommit:w,onGenerate:C,onUseSuggestion:R,onDismissSuggestion:G}){let T=t.trim().length>0&&!c&&(r||l),y=(r||l)&&!c&&!h,x=r?"Rewrite the previous commit with this message":l?"Commit staged changes":"Stage changes first",k=h?"Generating…":r||l?"Generate a commit message from the 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:[g&&e("div",{className:"rounded border border-ink/20 bg-paper p-2.5 space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Generated message"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:R,className:"px-2 py-0.5 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:"Use"}),e("button",{type:"button",onClick:G,className:"px-2 py-0.5 rounded border border-ink/20 text-ink/70 text-[10px] font-medium hover:bg-ink/5 transition-colors cursor-pointer",children:"Dismiss"})]})]}),e("pre",{className:"whitespace-pre-wrap break-words text-[11px] text-ink/80 font-mono max-h-32 overflow-y-auto",children:g})]}),e("textarea",{value:t,onChange:(A)=>M(A.currentTarget.value),onKeyDown:(A)=>{if(A.key==="Enter"&&(A.metaKey||A.ctrlKey)&&T)A.preventDefault(),w()},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"}),v&&t.trim().length>0&&e("div",{className:"flex items-center gap-1 text-[10px] text-ink/40",children:[e(Se,{size:10})," Generated from staged changes"]}),e("div",{className:"flex flex-wrap 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:(A)=>N?.(A.currentTarget.checked),className:`${be} 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:C,disabled:!y,title:k,"aria-label":"Generate commit message with AI",className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[h?e(m,{size:12,className:"animate-spin"}):e(Se,{size:12}),h?"Generating…":"Generate"]}),e("button",{type:"button",onClick:w,disabled:!T,title:x,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(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function Ze({operation:t,conflicts:l,isBusy:c,onAbort:r,onContinue:p}){let h=Bo[t],g=l.length,v=g===0,N=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(_,{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:l.map((M)=>e("div",{className:"truncate",title:M,children:M},M))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:c,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(fn,{size:12}),"Abort ",h]}),N&&e("button",{type:"button",onClick:p,disabled:c||!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($n,{size:12}),"Continue ",h]})]})]})}function Qe({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:N,onManageBranches:M,optionsRef:w,showOptions:C,setShowOptions:R,onHistory:G,onGraph:T,viewMode:y,setViewMode:x,isBusy:k=!1,syncCount:A={ahead:0,behind:0},syncing:F=!1,onSync:O,onFetch:V,detached:E=!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:()=>c(!l),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:E?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(me,{size:12,className:E?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${E?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),l&&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((H)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(H),c(!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:H}),r===H&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==H&&e("button",{type:"button",onClick:()=>{v(H),c(!1)},title:`Merge ${H} into ${r}`,"aria-label":`Merge ${H} 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($n,{size:12})})]},H))]}),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((H)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(H),c(!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:H}),r===H&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==H&&e("button",{type:"button",onClick:()=>{v(H),c(!1)},title:`Merge ${H} into ${r}`,"aria-label":`Merge ${H} 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($n,{size:12})})]},H))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{N(),c(!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(P,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:M,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(Ba,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:w,children:[e("button",{type:"button",onClick:V,disabled:k,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(Ua,{size:13})}),e("button",{type:"button",onClick:O,disabled:k,title:F?"Syncing with upstream…":A.ahead>0&&A.behind>0?`Pull ${A.behind} then push ${A.ahead} commit(s)`:A.ahead>0?`Push ${A.ahead} commit(s)`:A.behind>0?`Pull ${A.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":F,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${F?"":"disabled:opacity-40"}`,children:[e(D,{size:13,className:F?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",A.ahead," ↓",A.behind]})]}),e("button",{type:"button",onClick:G,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Pn,{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($n,{size:13})}),e("button",{type:"button",onClick:()=>R(!C),title:"View Options","aria-label":"View Options","aria-expanded":C,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Ee,{size:13})}),C&&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(Ye,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),y==="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(Ve,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),y==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Je({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e(bt,{left:e(d,{children:[e(zp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(kr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:l,scanning:p,onRefreshRepos:v})]}),right:e(st,{label:"Refresh",onClick:g,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let h=er(t.status,l),{charStatus:g,colorClass:v}=h,N=t.file.split("/"),M=N.pop()||t.file,w=N.length>0?N.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:l,status:g,repo:c||".",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(ct,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:M}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w})]}),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:[!l&&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(fn,{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(P,{size:11})})]}),l&&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(sn,{size:11})})]})})]})}function et({change:t,repo:l,rootPath:c,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),N=t.file.split("/"),M=N.pop()||t.file,w=N.length>0?N.join("/"):"",C=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:l,root:c}}))},R=async()=>{let y=!p;if(h(y),y&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)x.set("root",c);try{let A=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(A.markers??{})}catch{v({})}}},G=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:C,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Ga,{size:11,className:"text-warning flex-shrink-0"}),e(ct,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:M}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w}),_r(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(y)=>{y.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(ot,{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 ${G} — \`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 ",G]}),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 Wt(t){let l={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=l,N="";for(let M=0;M<g.length;M++){let w=g[M];N=N?`${N}/${w}`:w;let C=M===g.length-1;if(C&&!h)v.children.push({id:N,name:w,path:N,type:"file",change:r,children:[],changeCount:1});else{let G=v.children.find((T)=>T.type==="folder"&&T.name===w);if(!G)G={id:N,name:w,path:N,type:"folder",children:[],changeCount:0,change:C&&h?r:void 0},v.children.push(G);v=G}}}function c(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=c(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 c(l),l.children}function tt(t){let{sessionId:l,ready:c,read:r}=Hp(),p=u(()=>Wt(t),[t]),h=u(()=>{let R=new Set;function G(T){for(let y of T)if(y.type==="folder"){if(R.add(y.id),y.children&&y.children.length>0)G(y.children)}}return G(p),R},[p]),[g,v]=S("git.expandedFolders",[]),N=u(()=>new Set(g),[g]),M=i(null);o(()=>{if(!c||M.current===l)return;if(h.size===0)return;if(M.current=l,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[c,l,h,r,v]);let w=a((R)=>{v((G)=>{let T=new Set(G);if(T.has(R))T.delete(R);else T.add(R);return Array.from(T)})},[v]),C=a((R)=>N.has(R),[N]);return{tree:p,expandedFolders:N,toggleFolder:w,isFolderOpen:C,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function ze({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",N=v?c(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:N?e(B,{size:12}):e(se,{size:12})}),e(ct,{name:t.name,isFolder:!0,isOpen:N,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:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.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(fn,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.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(P,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.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(sn,{size:11})})})})]}),N&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((y)=>e(ze,{node:y,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g},y.id))})]});let M=t.change,w=er(M?.status||"M",l),{charStatus:C,colorClass:R}=w,G=M?M.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:G,staged:l,status:C,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: ${w.label}`,children:C})}),e(ct,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:G,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:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("revert",G)},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(fn,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("stage",G)},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(P,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("unstage",G)},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(sn,{size:11})})})})]})}function Oe({changes:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=tt(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((N)=>e(ze,{node:N,isStaged:l,isFolderOpen:g,toggleFolder:v,onAction:p,repo:c,rootPath:r},N.id))})}function nt({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,N]=S("git.stagedExpanded",!0),[M,w]=S("git.unstagedExpanded",!0),[C,R]=S("git.conflictsExpanded",!0),G=t.filter((x)=>_r(x.status)),T=t.filter((x)=>{if(_r(x.status))return!1;let k=x.status;return k&&k[0]!==" "&&k[0]!=="?"}),y=t.filter((x)=>{if(_r(x.status))return!1;let k=x.status;return k&&k[1]!==" "&&k[1]!=="?"||k==="??"});if(l&&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:[G.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(!C),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:C?"▾":"▸"}),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:G.length})]})}),C&&G.map((x)=>e(et,{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:()=>N(!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(sn,{size:12})})})]}),v&&(c==="tree"?e(Oe,{changes:T,isStaged:!0,repo:r,rootPath:p,onAction:h}):T.map((x)=>e(Fe,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),y.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:()=>w(!M),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:M?"▾":"▸"}),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:y.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(fn,{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(P,{size:12})})]})]}),M&&(c==="tree"?e(Oe,{changes:y,isStaged:!1,repo:r,rootPath:p,onAction:h}):y.map((x)=>e(Fe,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function rt({matches:t,loaded:l,total:c,hasMore:r,isFiltering:p}){if(p)return`${t} of ${l} loaded`;if(typeof c==="number"&&c>0)return r||l<c?`${l} of ${c}`:`${c} commits`;return r?`${l}+ commits`:`${l} commits`}function it({isGraphMode:t,onToggleMode:l,searchQuery:c,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:N,totalCount:M,hasMore:w}){let C=rt({matches:v,loaded:N,total:M,hasMore:w,isFiltering:c.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/80 border border-ink/10 whitespace-nowrap",children:C})]}),e("p",{className:"text-xs text-muted mt-0.5 hidden lg:block",children:t?"Follow branch topology and inspect commits.":"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 text-xs lg:bg-ink/5 lg:p-0.5 lg:rounded-lg lg:border lg:border-ink/10",children:[e("button",{type:"button",onClick:()=>l(!1),title:"History view","aria-label":"History view","aria-pressed":!t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${!t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Pn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>l(!0),title:"Graph view","aria-label":"Graph view","aria-pressed":t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e($n,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:p,disabled:g,className:"tap-target flex items-center justify-center gap-1.5 p-2 rounded-md text-ink/70 transition-colors cursor-pointer text-xs disabled:opacity-40 lg:px-2.5 lg:py-1.5 lg:border lg:border-ink/15 lg:hover:bg-ink/5 lg:hover:text-ink",title:"Refresh commit history","aria-label":"Refresh commit history",children:[e(Ea,{size:13,className:g?"animate-spin text-ink":"","aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Refresh"})]}),e("button",{type:"button",onClick:h,className:"tap-target p-2 -mr-1 rounded-md hover:bg-ink/5 text-muted hover:text-ink transition-colors cursor-pointer",title:"Close modal","aria-label":"Close commit history",children:e(b,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(U,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/55","aria-hidden":"true"}),e("input",{type:"text",value:c,onChange:(R)=>r(R.currentTarget.value),placeholder:"Filter commits by message, author, or hash...","aria-label":"Filter commits",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"}),c&&e("button",{type:"button",onClick:()=>r(""),"aria-label":"Clear filter",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/55 hover:text-ink cursor-pointer",children:e(b,{size:12,"aria-hidden":"true"})})]})]})}var ce=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function _e(t,l){if(!t||!l)return!1;if(t===l)return!0;let c=Math.min(t.length,l.length);if(c>=4)return t.substring(0,c)===l.substring(0,c);return!1}function Re(t){let l=new Map,c=[];for(let r of t){if(typeof r.lane==="number"){l.set(r.hash,r.lane);continue}let p=c.findIndex((g)=>_e(g,r.hash)||_e(g,r.shortHash));if(p===-1)if(p=c.indexOf(null),p===-1)p=c.length,c.push(r.hash);else c[p]=r.hash;l.set(r.hash,p);let h=r.parents&&r.parents[0];if(h)c[p]=h;else c[p]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let v=r.parents[g];if(!c.some((M)=>_e(M,v))){let M=c.indexOf(null);if(M===-1)c.push(v);else c[M]=v}}}return l}function lt(t,l,c,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=l.get(g.hash)??0,N=c[g.hash]??0,M=ce[v%ce.length];if(!g.parents||g.parents.length===0)continue;for(let w of g.parents){let C=h.get(w);if(typeof C!=="number"&&w.length>=7)C=h.get(w.substring(0,7));if(typeof C==="number"){let R=t[C],G=l.get(R.hash)??v,T=c[R.hash]??N+60;p.push({fromHash:g.hash,toHash:R.hash,fromLane:v,toLane:G,fromY:N,toY:T,color:ce[v%ce.length]})}else p.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:v,toLane:v,fromY:N,toY:Math.max(N+80,r),color:M})}}return p}function dt(t,l,c,r){if(Math.abs(t-c)<1)return`M ${t} ${l} L ${c} ${r}`;let p=r-l,h=l+p*0.45,g=r-p*0.45;return`M ${t} ${l} C ${t} ${h}, ${c} ${g}, ${c} ${r}`}function pt({commits:t,nodePositions:l,expandedHash:c,hoveredHash:r,isGraphMode:p,laneWidth:h=18,paddingLeft:g=16,totalHeight:v}){let N=u(()=>{if(!p){let R=new Map;return t.forEach((G)=>R.set(G.hash,0)),R}return Re(t)},[t,p]),M=u(()=>{let R=0;return N.forEach((G)=>{if(G>R)R=G}),R},[N]),w=p?(M+1)*h+g*2:36,C=u(()=>{if(!p){let R=[];for(let G=0;G<t.length-1;G++){let T=l[t[G].hash]??G*60+20,y=l[t[G+1].hash]??(G+1)*60+20;R.push({fromHash:t[G].hash,toHash:t[G+1].hash,fromLane:0,toLane:0,fromY:T,toY:y,color:"var(--theme-ink)"})}return R}return lt(t,N,l,v)},[t,N,l,v,p]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:w,height:v},"aria-hidden":"true",children:e("svg",{className:"w-full h-full overflow-visible",style:{width:w,height:v},children:[C.map((R)=>{let G=p?g+R.fromLane*h:16,T=p?g+R.toLane*h:16,y=p?R.color:"currentColor",x=p?0.95:0.25,k=dt(G,R.fromY,T,R.toY);return e("path",{d:k,fill:"none",stroke:y,strokeWidth:p?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let G=N.get(R.hash)??0,T=p?g+G*h:16,y=l[R.hash]??20,x=c===R.hash||c===R.shortHash,k=r===R.hash||r===R.shortHash,A=p?ce[G%ce.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(x||k)&&e("circle",{cx:T,cy:y,r:8,fill:A,fillOpacity:x?0.35:0.2,stroke:A,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:T,cy:y,r:p?4:4.5,fill:p?"var(--theme-paper)":A,stroke:A,strokeWidth:p?2.5:1.5}),p&&e("circle",{cx:T,cy:y,r:1.8,fill:A})]},`node-${R.hash}`)})]})})}var qt=[{action:"checkout",label:"checkout"},{action:"create_branch_here",label:"create branch here"},{action:"cherry_pick",label:"cherry-pick"},{action:"revert",label:"revert"},{action:"reset",label:"reset..."},{action:"merge",label:"merge into current"},{action:"rebase",label:"rebase onto this"}];function mt({commit:t,onAction:l}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:qt.map(({action:c,label:r})=>e("button",{type:"button",onClick:(p)=>{p.stopPropagation(),l(c,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",children:r},c))})}var Ge=3;function Kt(t){let l=[];for(let c=0;c<t.length;c+=1){if(t[c].type!=="context"){l.push({row:t[c],index:c});continue}let r=c;while(r<t.length&&t[r].type==="context")r+=1;let p=r-c;if(p>Ge*2+1){for(let h=c;h<c+Ge;h+=1)l.push({row:t[h],index:h});l.push({row:{type:"elided",count:p-Ge*2},index:-1});for(let h=r-Ge;h<r;h+=1)l.push({row:t[h],index:h})}else for(let h=c;h<r;h+=1)l.push({row:t[h],index:h});c=r-1}return l}function ft({diffText:t,isLoading:l,filePath:c,fullContext:r=!1,onToggleContext:p}){let h=mi(),g=u(()=>{if(!t)return[];let w=[],C=1,R=1,G=t.split(/\r?\n/),y=G.some((x)=>x.startsWith("@@"))?G:[`@@ -0,0 +1,${G.length} @@`,...G.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of y){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 k=x.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(k)C=parseInt(k[1],10),R=parseInt(k[2],10);w.push({type:"meta",text:x})}else if(x.startsWith("+"))w.push({type:"add",text:x.slice(1),newNum:R++});else if(x.startsWith("-"))w.push({type:"del",text:x.slice(1),oldNum:C++});else{let k=x.startsWith(" ")?x.slice(1):x;w.push({type:"context",text:k,oldNum:C++,newNum:R++})}}return w},[t]),v=yt(c),N=u(()=>{let w=Array(g.length).fill(""),C=-1,R=(G)=>{if(C<0)return;let T=ed(g.slice(C,G).map((y)=>y.text).join(`
3
+ `),v);for(let y=C;y<G;y++)w[y]=T[y-C]??"";C=-1};return g.forEach((G,T)=>{if(G.type==="meta")R(T);else if(C<0)C=T}),R(g.length),w},[g,v,h]),M=u(()=>r?g.map((w,C)=>({row:w,index:C})):Kt(g),[g,r]);if(l)return e("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-muted 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-muted 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 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-muted",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(ot,{size:12,"aria-hidden":"true"})," Collapse context"]}):e(d,{children:[e(B,{size:12,"aria-hidden":"true"})," 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:M.map(({row:w,index:C},R)=>{if(w.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-muted text-[10px] text-center select-none",title:`${w.count} unchanged line(s) hidden`,children:["⋯ ",w.count," unchanged line",w.count===1?"":"s"," hidden ⋯"]},`elided-${R}`);let G=w,T=C;if(G.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-muted text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:G.text})]},T);let y=G.type==="add",x=G.type==="del";return e("div",{className:`flex items-start font-mono ${y?"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-ink/80 font-semibold":y?"bg-success/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.oldNum??(y?"+":"")}),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 ${y?"bg-success/15 text-ink/80 font-semibold":x?"bg-error/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.newNum??(x?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${y||x?"text-ink/80":"opacity-0"}`,children:y?"+":x?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:G.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:N[T]}}):" "})]},T)})})})]})}function ht({commit:t,isExpanded:l,onToggleExpand:c,onAction:r,onToggleFile:p,isExpandedFile:h,isLoadingFile:g,isFullContextFile:v,onToggleContext:N,fileDiffs:M,headerRef:w}){let[C,R]=n(!1),G=t.body?.trim()??"",T=G.length>0,y=t.files??[],x=y.length,k=x>0,A=T||k,F=(E)=>{E.stopPropagation(),navigator.clipboard.writeText(t.hash),R(!0),setTimeout(()=>R(!1),2000)},O=(E,H)=>{E.stopPropagation(),p(t.hash,H)},V=A?"border-b border-ink/5 transition-colors cursor-pointer hover:bg-ink/[0.015]":"border-b border-ink/5";return e("div",{onClick:A?c:void 0,"data-testid":"commit-row","data-commit-hash":t.hash,className:V,children:e("div",{className:"py-2.5 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((E,H)=>{let Q=E.includes("stash"),Y=E.includes("HEAD")||E.includes("main")||E.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${Q?"bg-warning/10 text-ink/80 border-warning/25 font-semibold":Y?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-muted border-ink/10 font-medium"}`,children:E},H)})}),e("div",{ref:w,className:"flex items-start gap-1.5",children:e("button",{type:"button",onClick:A?(E)=>{E.stopPropagation(),c()}:void 0,"aria-expanded":A?l:void 0,className:"flex flex-1 min-w-0 items-start gap-1.5 text-left cursor-pointer rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20",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}),A&&e("span",{className:"text-ink/55 flex-shrink-0 mt-0.5","aria-hidden":"true",children:l?e(B,{size:13}):e(se,{size:13})})]})}),T&&l&&e("div",{className:"border-l-2 border-ink/15 pl-3 py-1",children:e(J,{content:G,className:"text-ink/70"})}),e("div",{className:"flex items-center gap-x-2 gap-y-0.5 text-[11px] text-muted font-mono flex-wrap",children:[e("span",{children:t.author}),e("span",{children:t.date}),e("button",{type:"button",onClick:F,title:"Copy commit hash","aria-label":`Copy commit hash ${t.shortHash}`,className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[e("span",{children:t.shortHash}),C?e(f,{size:11,className:"text-success-text","aria-hidden":"true"}):e(re,{size:11,"aria-hidden":"true"})]}),k&&e("span",{children:[x," ",x===1?"file":"files"]})]})]}),l&&e("div",{className:"mt-2",children:e(mt,{commit:t,onAction:r})}),k&&l&&e("div",{className:"mt-2 flex flex-col gap-1",children:y.map((E,H)=>{let Q=h(t.hash,E.file),Y=`${t.hash}:${E.file}`,z=M[Y]!==void 0?M[Y]:E.diff,I=g(t.hash,E.file),W=E.status==="A"?"text-success-text font-bold":E.status==="D"?"text-error-text font-bold":E.status==="R"?"text-meta-text font-bold":"text-info-text font-bold";return e("div",{className:"flex flex-col",children:[e("button",{type:"button",onClick:(oe)=>O(oe,E),"aria-expanded":Q,className:"flex w-full items-center gap-2 py-1 px-2 rounded text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10 text-left",children:[e("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${W}`,children:E.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:E.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-text",children:["+",E.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error-text",children:["-",E.deletions]})]}),e("span",{className:"text-ink/55 group-hover:text-ink flex-shrink-0",children:Q?e(B,{size:13,"aria-hidden":"true"}):e(se,{size:13,"aria-hidden":"true"})})]}),Q&&e("div",{className:"pl-4 pr-1",children:e(ft,{diffText:z,isLoading:I,filePath:E.file,fullContext:v(t.hash,E.file),onToggleContext:()=>N(t.hash,E)})})]},H)})})]})})}var xe=50;function Vt(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c;if(typeof r.file!=="string"||!r.file)continue;l.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 l}function je(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c,p=typeof r.hash==="string"&&r.hash?r.hash:"";if(!p)continue;l.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:Vt(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return l}function gt({output:t,isGraphMode:l,rootPath:c,activeRepo:r}){let[p,h]=n(!1),[g,v]=n(t?.hasMore??t?.data?.length===xe),[N,M]=n(t?.total),w=u(()=>je(t?.data),[t?.data]),C=Array.isArray(t?.data)?t.data.length:0,[R,G]=n(w),[T,y]=n(C);o(()=>{if(G(w),y(C),v(t?.hasMore??C===xe),typeof t?.total==="number")M(t.total)},[w,C,t?.hasMore,t?.total]);let x=a(async()=>{if(p||!g)return;h(!0);try{let k=new FormData;if(k.set("actionType",l?"graph":"history"),k.set("limit",String(xe)),k.set("skip",String(T)),c)k.set("root",c);if(r)k.set("repo",r);let F=await(await fetch("/api/fs/git",{method:"POST",body:k})).json();if(F.success&&Array.isArray(F.data)){let O=je(F.data),V=F.data.length;if(G((E)=>{let H=new Set(E.map((Y)=>Y.hash)),Q=O.filter((Y)=>!H.has(Y.hash));return[...E,...Q]}),y((E)=>E+V),v(Boolean(F.hasMore??V===xe)),typeof F.total==="number")M(F.total)}else v(!1)}catch(k){console.error("Failed to load more commits:",k)}finally{h(!1)}},[p,g,l,T,c,r]);return{commits:R,hasMore:g,totalCount:N,isLoadingMore:p,handleLoadMore:x}}function xt({onExecuteAction:t,rootPath:l,activeRepo:c}){let[r,p]=n({}),[h,g]=n(new Set),[v,N]=n(new Set),[M,w]=n(new Set),C=a(async(y,x,k)=>{let A=`${y}:${x.file}`;N((F)=>new Set(F).add(A));try{let F=new FormData;if(F.set("actionType","commit_diff"),F.set("hash",y),F.set("file",x.file),k)F.set("full","1");if(l)F.set("root",l);if(c&&c!==".")F.set("repo",c);let V=await(await fetch("/api/fs/git",{method:"POST",body:F})).json();if(V&&typeof V.diff==="string")p((E)=>({...E,[A]:V.diff}));else if(V&&V.error)p((E)=>({...E,[A]:`// Error: ${V.error}`}))}catch(F){console.error("Failed to load file diff:",F);let O=F instanceof Error?F.message:"Network error";p((V)=>({...V,[A]:`// Error loading diff: ${O}`}))}finally{N((F)=>{let O=new Set(F);return O.delete(A),O})}},[l,c]),R=a(async(y,x)=>{let k=`${y}:${x.file}`,A=!h.has(k);if(g((F)=>{let O=new Set(F);if(O.has(k))O.delete(k);else O.add(k);return O}),A&&r[k]===void 0&&!x.diff)await C(y,x,!1)},[h,r,C]),G=a(async(y,x)=>{let k=`${y}:${x.file}`,A=!M.has(k);w((F)=>{let O=new Set(F);if(O.has(k))O.delete(k);else O.add(k);return O}),await C(y,x,A)},[M,C]),T=a((y,x)=>{if(!t)return;if(y==="checkout")t("checkout",void 0,{branch:x.hash});else if(y==="create_branch_here"){let k=window.prompt(`Create new branch at commit ${x.shortHash}:`,`branch-${x.shortHash}`);if(k?.trim())t("create_branch_at",void 0,{branch:k.trim(),hash:x.hash})}else if(y==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${x.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:x.hash})}else if(y==="revert"){if(window.confirm(`Revert commit ${x.shortHash}?`))t("revert_commit",void 0,{hash:x.hash})}else if(y==="reset"){let k=window.prompt(`Reset current branch to ${x.shortHash} (soft, mixed, hard):`,"soft");if(k&&["soft","mixed","hard"].includes(k.toLowerCase()))t("reset_commit",void 0,{hash:x.hash,mode:k.toLowerCase()})}else if(y==="merge"){if(window.confirm(`Merge commit ${x.shortHash} into current branch?`))t("merge_commit",void 0,{hash:x.hash})}else if(y==="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:M,handleToggleFile:R,handleToggleContext:G,handleCommitAction:T}}function vt(t){let[l,c]=n({page:t,hash:""}),r=l.page===t?l.hash:"",p=a((h)=>{c((g)=>{let v=g.page===t&&g.hash===h;return{page:t,hash:v?"":h}})},[t]);return{expandedHash:r,toggleExpanded:p}}function Ue({output:t,onClose:l,onRefresh:c,onExecuteAction:r,rootPath:p,activeRepo:h}){if(o(()=>{if(!t)return;let j=(q)=>{if(q.key==="Escape")l()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[t,l]),!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 N=g.graph,M=(j)=>v((q)=>({...q,graph:j})),[w,C]=n(""),{expandedHash:R,toggleExpanded:G}=vt(t),[T,y]=n(!1),{commits:x,hasMore:k,totalCount:A,isLoadingMore:F,handleLoadMore:O}=gt({output:t,isGraphMode:N,rootPath:p,activeRepo:h}),{fileDiffs:V,expandedFiles:E,loadingFiles:H,fullContextFiles:Q,handleToggleFile:Y,handleToggleContext:z,handleCommitAction:I}=xt({onExecuteAction:r,rootPath:p,activeRepo:h}),W=u(()=>{if(!w.trim())return x;let j=w.toLowerCase().trim();return x.filter((q)=>q.message.toLowerCase().includes(j)||q.author.toLowerCase().includes(j)||q.shortHash.toLowerCase().includes(j)||q.hash.toLowerCase().includes(j)||q.refs?.some((ne)=>ne.toLowerCase().includes(j)))},[x,w]),oe=i(null),ie=i(null),ve=i(null),pe=i({}),[he,ye]=n({}),[Pe,$e]=n(800);o(()=>{let j=ve.current;if(!j||!k||F||w.trim())return;let q=new IntersectionObserver((ne)=>{if(ne[0].isIntersecting)O()},{root:oe.current,threshold:0.1});return q.observe(j),()=>q.disconnect()},[k,F,w,O]);let ae=a(()=>{if(!oe.current||!ie.current)return;let j=oe.current.getBoundingClientRect(),q=oe.current.scrollTop,ne={};W.forEach((ge,De)=>{let Ne=pe.current[ge.hash];if(Ne){let de=Ne.getBoundingClientRect();ne[ge.hash]=de.top+de.height/2-j.top+q}else ne[ge.hash]=De*60+20}),ye(ne);let Le=ie.current.offsetHeight;$e(Math.max(Le,oe.current.clientHeight,600))},[W]);K(()=>{ae();let j=requestAnimationFrame(()=>{ae()});return()=>cancelAnimationFrame(j)},[ae,W,V,E,N,R]),o(()=>{let j=ie.current;if(!j)return;let q=new ResizeObserver(()=>{ae()});q.observe(j);for(let ne of Array.from(j.children))q.observe(ne);return()=>q.disconnect()},[ae,W]);let ee=u(()=>Re(W),[W]),Me=u(()=>{let j=0;return ee.forEach((q)=>{if(q>j)j=q}),j},[ee]),ke=18,Ce=16,Te=N?(Me+1)*ke+Ce*2:36,Ae=()=>{y(!0),c?.(),setTimeout(()=>y(!1),600)};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:l,role:"dialog","aria-modal":"true","aria-label":t.title,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:(j)=>j.stopPropagation(),children:[e(ct,{isGraphMode:N,onToggleMode:M,searchQuery:w,onSearchChange:C,onRefresh:Ae,onClose:l,isRefreshing:T,totalCommits:W.length,loadedCount:x.length,totalCount:A,hasMore:k}),e("div",{ref:oe,className:`flex-1 overflow-y-auto scrollbar-overlay-container relative select-text
6
+ pt-[env(safe-area-inset-top,0px)] lg:pt-0`,onClick:(j)=>j.stopPropagation(),children:[e(it,{isGraphMode:N,onToggleMode:M,searchQuery:w,onSearchChange:C,onRefresh:Ae,onClose:l,isRefreshing:T,totalCommits:W.length,loadedCount:x.length,totalCount:A,hasMore:k}),e("div",{ref:oe,className:`flex-1 overflow-y-auto scrollbar-overlay-container relative select-text
7
7
  px-3 lg:px-5
8
- pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:W.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-muted font-mono text-xs",children:w.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(mt,{commits:W,nodePositions:fe,expandedHash:R,isGraphMode:N,laneWidth:ke,paddingLeft:Ce,totalHeight:Pe}),e("div",{ref:ie,className:"flex flex-col relative z-20",style:{paddingLeft:`${Te}px`},children:[W.map((j)=>e(gt,{commit:j,isExpanded:R===j.hash,onToggleExpand:()=>G(j.hash),onAction:I,onToggleFile:Y,isExpandedFile:(q,ne)=>E.has(`${q}:${ne}`),isLoadingFile:(q,ne)=>H.has(`${q}:${ne}`),isFullContextFile:(q,ne)=>Q.has(`${q}:${ne}`),onToggleContext:z,fileDiffs:V,headerRef:(q)=>{ue.current[j.hash]=q}},j.hash)),e("div",{ref:ve,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:F?e("div",{className:"flex items-center gap-2 text-xs text-muted font-mono py-2",children:[e(m,{size:14,className:"animate-spin text-info-text","aria-hidden":"true"}),e("span",{children:"Loading more commits..."})]}):k&&!w.trim()?e("button",{type:"button",onClick:O,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-muted py-2",children:["End of commit history (",typeof A==="number"&&A>0?A:x.length," commits)"]}):null})]})]})})]})})}function yt({children:t,onClose:l}){return e("div",{className:"fixed inset-0 z-50 modal-scrim flex items-center justify-center p-4",onClick:l,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:(c)=>c.stopPropagation(),children:t})})}function kt({modal:t,onClose:l,onConfirm:c}){if(!t)return null;return e(yt,{onClose:l,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(S,{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:l,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:c,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 Ct({isOpen:t,branchName:l,inputRef:c,onChange:r,onClose:p,onCreate:h}){if(!t)return null;let g=a(()=>{if(l.trim())h()},[l,h]);return e(yt,{onClose:p,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Pn,{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:c,type:"text",value:l,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:!l.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 Nt({branch:t,detached:l,onCheckout:c,onMerge:r,onRename:p,onDelete:h}){let g=t.current&&!l;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:c,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(pe,{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(Yt,{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(Pn,{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(On,{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(L,{size:11})})]})]})}function Yt({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 wt({branch:t,onClose:l,onSubmit:c}){if(!t)return null;return e(Xt,{branch:t,onClose:l,onSubmit:c})}function Xt({branch:t,onClose:l,onSubmit:c}){let[r,p]=n(t.name),[h,g]=n(!1),v=r.trim(),N=v===t.name,M=v.length>0&&!N,w=()=>{if(M)c(t.name,v,h)};return e(Z,{onClose:l,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:(C)=>p(C.currentTarget.value),onKeyDown:(C)=>{if(C.key==="Enter")w();if(C.key==="Escape")l()},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"}),N&&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:(C)=>g(C.currentTarget.checked),className:`${be} 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:l,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:w,disabled:!M,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 Rt({branch:t,force:l,onForceChange:c,onClose:r,onConfirm:p}){if(!t)return null;return e(Z,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(S,{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:l,onChange:(h)=>c(h.currentTarget.checked),className:`${be} 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 ",l?"-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 ",l?"(force)":""]})]})]})}function Gt({isOpen:t,rootPath:l,repo:c,currentBranch:r,detached:p,isBusy:h,onClose:g,onAction:v,onConfirmDelete:N}){let[M,w]=n([]),[C,R]=n(!1),[G,T]=n(null),[y,x]=n(""),[k,A]=n(null),[F,O]=n(null),[V,E]=n(!1),H=a(async()=>{R(!0),T(null);let z=new URLSearchParams({branches:"1",repo:c||"."});if(l)z.set("root",l);try{let I=await fetch(`/api/fs/git?${z.toString()}`),W=await I.json();if(W.success&&Array.isArray(W.branches))w(W.branches);else T(W.error||`Failed to read branches (HTTP ${I.status})`)}catch(I){T(I instanceof Error?I.message:"Failed to read branches")}finally{R(!1)}},[l,c]);o(()=>{if(t)H()},[t,H]);let Q=i(!1);o(()=>{if(!t){Q.current=!1;return}if(Q.current&&!h)H();Q.current=h},[t,h,H]),o(()=>{if(!t)A(null),O(null),E(!1),x("")},[t]);let Y=u(()=>{let z=y.trim().toLowerCase();if(!z)return M;return M.filter((I)=>I.name.toLowerCase().includes(z)||I.upstream.toLowerCase().includes(z))},[M,y]);if(!t)return null;return e(d,{children:[e(Z,{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(U,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:y,onChange:(z)=>x(z.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 H(),disabled:C,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(D,{size:12,className:C?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:C&&M.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…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):Y.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:y.trim()?"No matching branches.":"No branches."}):Y.map((z)=>e(Nt,{branch:z,detached:p,onCheckout:()=>{v("checkout",{branch:z.name}),g()},onMerge:()=>{v("merge_branch",{branch:z.name}),g()},onRename:()=>A(z),onDelete:()=>{O(z),E(!1)}},z.name))})]}),e(wt,{branch:k,onClose:()=>A(null),onSubmit:(z,I,W)=>{v("rename_branch",{branch:z,newName:I,...W?{remote:"1"}:{}}),A(null)}},k?.name??"none"),e(Rt,{branch:F,force:V,onForceChange:E,onClose:()=>{O(null),E(!1)},onConfirm:(z)=>{N(z,V),O(null),E(!1)}})]})}function St({mounted:t,confirmModal:l,onCloseConfirm:c,onConfirm:r,branchPrompt:p,newBranchName:h,newBranchInputRef:g,onNewBranchNameChange:v,onCloseBranchPrompt:N,onCreateBranch:M,viewingOutput:w,onCloseOutput:C,onRefreshOutput:R,onExecuteAction:G,branchModalOpen:T,onCloseBranchModal:y,rootPath:x,activeRepo:k,currentBranch:A,detached:F,isBusy:O,onBranchAction:V,onConfirmDeleteBranch:E}){if(!t)return null;return e(d,{children:[e(kt,{modal:l,onClose:c,onConfirm:r}),e(Ct,{isOpen:p,branchName:h,inputRef:g,onChange:v,onClose:N,onCreate:M}),e(je,{output:w,onClose:C,onRefresh:R,onExecuteAction:G,rootPath:x,activeRepo:k}),e(Gt,{isOpen:T,rootPath:x,repo:k,currentBranch:A,detached:F,isBusy:O,onClose:y,onAction:V,onConfirmDelete:E})]})}function Pt({rootPath:t,repo:l,isBusy:c,onAction:r}){let[p,h]=_("git.stashExpanded",!1),[g,v]=n([]),[N,M]=n(!1),[w,C]=n(""),[R,G]=n(!1),T=xr(),y=a(async()=>{M(!0);let k=new URLSearchParams({stashes:"1",repo:l||"."});if(t)k.set("root",t);try{let F=await(await fetch(`/api/fs/git?${k.toString()}`)).json();v(F.stashes??[])}catch{v([])}finally{M(!1)}},[t,l]);o(()=>{if(p)y()},[p,y,c]);let x=(k,A)=>{if(r(k,A),k==="stash_push")C(""),G(!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(nt,{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",{...w.trim()?{message:w.trim()}:{},...R?{untracked:"1"}:{}}),disabled:c,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(P,{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:w,onChange:(k)=>C(k.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:(k)=>G(k.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"-u"]})]}),N&&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((k)=>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:k.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:k.subject,children:k.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:k.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:k.ref,pop:"1"}),disabled:c,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(ge,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_apply",{ref:k.ref}),disabled:c,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(nt,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_drop",{ref:k.ref}),disabled:c,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(L,{size:10})})]})]},k.ref))})]})})})]})}function $t({repo:t,isBusy:l,onInit:c}){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(pe,{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:c,disabled:l,"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(pe,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function Mt(t,l,c){let r=lt(),{pickedRepo:p,setActiveRepo:h,ready:g}=fr(t),{repos:v,scanning:N,rescan:M}=gr(t,l),w=lg(p,v),C=i(w);C.current=w;let R=i("");R.current=`${t??""}\x00${w}`;let G=i(""),T=i(""),y=i(void 0);if(r.data!==y.current)y.current=r.data,T.current=G.current;let x=l&&g?Pp(`${t??""}\x00${w}`):null,k=Be(x),A=i(k.refresh);A.current=k.refresh;let F=T.current===R.current?r.data:void 0,O=k.data??F,V=O?.syncCount??F?.syncCount,E=a((Y)=>{if(!l)return;let z=Y??C.current,I=new URLSearchParams;if(t)I.set("root",t);if(z)I.set("repo",z);I.set("sync","1"),I.set("t",String(Date.now())),G.current=R.current;let W=A.current;r.load(`/api/fs/git?${I.toString()}`).then(()=>W())},[l,t,r.load]);o(()=>{if(!g)return;E()},[c,t,l,g,w,E]);let H=r.state==="loading",Q=H||k.refreshing;return{activeRepo:w,setActiveRepo:h,repos:v,reposScanning:N,refreshRepos:M,isReading:H,isRefreshing:Q,data:O,syncCount:V,loadRepo:E,refreshTopic:k.refresh}}function Tt(t,l){let c=lt(),r=i(null),p=a((h,g,v)=>{r.current={actionType:h,extra:v};let N=new FormData;if(N.append("actionType",h),N.append("repo",l),t)N.append("root",t);if(g)N.append("file",g);if(v)Object.entries(v).forEach(([M,w])=>N.append(M,w));c.submit(N,{method:"POST",action:"/api/fs/git"})},[l,t,c]);return{state:c.state,execute:p,data:c.data,lastAction:r.current}}function Lt({rootPath:t,repo:l,execute:c}){let{sessionId:r}=$p(),[p,h]=_("git.commitDraft",""),[g,v]=_("git.amend",!1),[N,M]=n(!1),[w,C]=n(null),[R,G]=n(!1),T=i(!1),y=i(null),x=i(p);x.current=p;let k=i(g);k.current=g;let A=i(h);A.current=h;let F=a((Y)=>{h(Y),G(!1)},[h]),O=a(()=>{if(T.current)return;T.current=!0,M(!0),C(null);let Y={...t?{root:t}:{},repo:l,...r?{sessionId:r}:{},...k.current?{amend:!0}:{}};fetch("/api/fs/git-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)}).then(async(z)=>{let I=await z.json().catch(()=>null);if(!z.ok||typeof I?.message!=="string"||!I.message.trim())throw Error(typeof I?.error==="string"?I.error:`Request failed (HTTP ${z.status})`);let W=I.message.trim();if(x.current.trim().length===0)A.current(W),G(!0);else C(W)}).catch((z)=>{el(z instanceof Error?z.message:String(z),"error")}).finally(()=>{T.current=!1,M(!1)})},[t,l,r]),V=a(()=>{if(w===null)return;h(w),G(!0),C(null)},[w,h]),E=a(()=>C(null),[]);o(()=>{if(!g)return;if(x.current.trim().length>0)return;let Y=new URLSearchParams({headMessage:"1"});if(t)Y.set("root",t);if(l&&l!==".")Y.set("repo",l);let z=!1;return fetch(`/api/fs/git?${Y.toString()}`).then((I)=>I.json()).then((I)=>{if(z)return;if(!k.current||x.current.trim().length>0)return;let W=typeof I?.message==="string"?I.message:"";if(W.length===0)return;y.current=W,A.current(W)}).catch(()=>{}),()=>{z=!0}},[g,r,t,l]);let H=a((Y)=>{if(Y){v(!0);return}if(y.current!==null&&x.current===y.current)h("");y.current=null,v(!1)},[v,h]),Q=a(()=>{c("commit",void 0,{message:x.current,...k.current?{amend:"1"}:{}}),h(""),v(!1),y.current=null,C(null),G(!1)},[c,v,h]);return{message:p,setMessage:F,amend:g,seeded:y.current!==null&&p===y.current,toggleAmend:H,commit:Q,isGenerating:N,suggestion:w,generated:R,generate:O,useSuggestion:V,dismissSuggestion:E}}var Dt=48;function Zt(t,l){let c=l?.branch?.trim()??"",r=(l?.hash??"").slice(0,7),p=l?.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(l?.amend==="1")return{done:"Amended the last commit"};let h=(l?.message??"").split(`
9
- `)[0].trim();if(!h)return{done:"Commit created"};return{done:`Committed “${h.length>Dt?`${h.slice(0,Dt-1)}…`:h}”`}}case"checkout":return{done:c?`Switched to ${c}`:"Switched branch"};case"create_branch":case"create_branch_at":return{done:c?`Created branch ${c}`:"Created branch"};case"rename_branch":{let h=l?.newName?.trim()??"";return{done:c&&h?`Renamed ${c} to ${h}`:"Renamed branch"}}case"delete_branch":return{done:c?`Deleted branch ${c}`:"Deleted branch"};case"merge_branch":return{done:c?`Merged ${c}`:"Merged branch",stopped:c?`Merging ${c}`:"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=l?.mode??"mixed";return{done:r?`Reset to ${r} (${h})`:`Reset (${h})`}}case"stash_push":return{done:"Stashed your changes"};case"stash_apply":return{done:l?.pop==="1"?`Popped ${p}`:`Applied ${p}`,stopped:l?.pop==="1"?`Popping ${p}`:`Applying ${p}`};case"stash_drop":return{done:`Dropped ${p}`};default:return null}}function Et({actionType:t,extra:l,stopped:c}){let r=Zt(t,l);if(!c)return r?.done??null;let p=Bo[c]??c,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 Bt(t){let{fetcher:l,onPage:c,onReload:r,onSuccess:p,onError:h}=t,g=i(null),v=i({onPage:c,onReload:r,onSuccess:p,onError:h});v.current={onPage:c,onReload:r,onSuccess:p,onError:h},o(()=>{if(l.state!=="idle"||!l.data)return;let N=l.data;if(N===g.current)return;g.current=N;let M=v.current;if(N.type==="history"||N.type==="graph"){M.onPage({title:N.type==="graph"?"Git Graph":"Commit History",data:N.data||[],hasMore:N.hasMore,total:N.total});return}if(!N.success){M.onError(N.error||"Git operation failed");return}M.onReload();let w=l.lastAction,C=w?Et({...w,stopped:N.stopped}):null;if(C)M.onSuccess(C,N.stopped?"warning":"success")},[l.state,l.data,l.lastAction])}function Ft(t,l,c,r){if(t==="revert")return{type:t,file:l,message:`Are you sure you want to discard changes in ${l}?`};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?Bo[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=c?.branch??"",h=c?.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=c?.ref||"the top entry";return{type:t,extra:{ref:c?.ref??""},message:`Drop ${p}? The stash entry is removed — this cannot be undone from the panel.`}}return null}function Rr({className:t="",enabled:l=!0,rootPath:c,refreshKey:r=0}){let{activeRepo:p,setActiveRepo:h,repos:g,reposScanning:v,refreshRepos:N,isReading:M,isRefreshing:w,data:C,syncCount:R,loadRepo:G,refreshTopic:T}=Mt(c,l,r),y=Tt(c,p),[x,k]=_("git.viewMode","flat"),[A,F]=n(!1),O=i(null),[V,E]=n(!1),H=i(null),[Q,Y]=n(null),[z,I]=n(!1),[W,oe]=n(""),ie=i(null),[ve,ue]=n(!1),[fe,ye]=n(null),[Pe,$e]=n(!1),{pushToast:ae}=qe();o(()=>{$e(!0)},[]),o(()=>{if(z&&ie.current)ie.current.focus()},[z]),Bt({fetcher:y,onPage:ye,onReload:G,onSuccess:(X,te)=>ae(X,te),onError:(X)=>ae(X,"error")}),me(O,()=>F(!1)),me(H,()=>E(!1));let ee=y.execute,{message:Me,setMessage:ke,amend:Ce,seeded:Te,toggleAmend:Ae,commit:j,isGenerating:q,suggestion:ne,generated:Le,generate:he,useSuggestion:De,dismissSuggestion:Ne}=Lt({rootPath:c,repo:p,execute:ee}),de=(X,te,we)=>{let Ke=Ft(X,te,we,C?.state?.operation??null);if(Ke){Y(Ke);return}ee(X,te,we)},Ht=(X,te)=>{ee("resolve_conflict",X,te?{side:te}:void 0)},Ue=C?.branch||"main",zt=C?.branches||["main"],Ot=C?.remoteBranches||[],We=C?.changes||[],le=M||y.state!=="idle",Ee=y.state==="idle"?null:y.lastAction?.actionType??null,It=Ee==="sync"||Ee==="push"||Ee==="pull",_t=We.filter((X)=>{if(_r(X.status))return!1;let te=X.status;return te&&te[0]!==" "&&te[0]!=="?"});if(!l)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(St,{mounted:Pe,confirmModal:Q,onCloseConfirm:()=>Y(null),onConfirm:()=>{if(Q)ee(Q.type,Q.file,Q.extra),Y(null)},branchPrompt:z,newBranchName:W,newBranchInputRef:ie,onNewBranchNameChange:oe,onCloseBranchPrompt:()=>{I(!1),oe("")},onCreateBranch:()=>{if(W.trim())ee("create_branch",void 0,{branch:W.trim()}),I(!1),oe("")},viewingOutput:fe,onCloseOutput:()=>ye(null),onRefreshOutput:()=>{if(fe)ee(fe.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(X,te,we)=>ee(X,te,we),branchModalOpen:ve,onCloseBranchModal:()=>ue(!1),rootPath:c,activeRepo:p,currentBranch:Ue,detached:C?.state?.detached??!1,isBusy:le,onBranchAction:(X,te)=>ee(X,void 0,te),onConfirmDeleteBranch:(X,te)=>{ee("delete_branch",void 0,{branch:X,...te?{force:"1"}:{}})}}),e(Je,{activeRepo:p,repos:g,isRefreshing:w,rootPath:c,reposScanning:v,onSelectRepo:(X)=>{if(X!==p)h(X)},onRefresh:()=>{T(),G()},onRefreshRepos:N}),C?.isRepo===!1?e($t,{repo:p,isBusy:le,onInit:()=>ee("init")}):e(d,{children:[e(Qe,{branchRef:H,showBranchMenu:V,setShowBranchMenu:E,branch:Ue,branches:zt,remoteBranches:Ot,onCheckout:(X)=>ee("checkout",void 0,{branch:X}),onMerge:(X)=>ee("merge_branch",void 0,{branch:X}),onOpenBranchPrompt:()=>I(!0),onManageBranches:()=>{ue(!0),E(!1)},optionsRef:O,showOptions:A,setShowOptions:F,onHistory:()=>ee("history"),onGraph:()=>ee("graph"),viewMode:x,setViewMode:k,isBusy:le,syncCount:R,syncing:It,onSync:()=>ee("sync"),onFetch:()=>ee("fetch"),detached:C?.state?.detached??!1}),C?.state?.operation?e(Ze,{operation:C.state.operation,conflicts:C.state.conflicts,isBusy:le,onAbort:()=>de("abort_operation"),onContinue:()=>ee("continue_operation")}):e(Xe,{message:Me,hasStagedChanges:_t.length>0,isBusy:le,amend:Ce,seeded:Te,isGenerating:q,suggestion:ne,generated:Le,onToggleAmend:Ae,onChangeMessage:ke,onCommit:j,onGenerate:he,onUseSuggestion:De,onDismissSuggestion:Ne}),e(it,{changes:We,isLoading:le,viewMode:x,repo:p,rootPath:c,onAction:de,onResolve:Ht}),e(Pt,{rootPath:c,repo:p,isBusy:le,onAction:(X,te)=>de(X,void 0,te)})]})]})}export{Rr as GitPanel};
8
+ pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:W.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-muted font-mono text-xs",children:w.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(pt,{commits:W,nodePositions:he,expandedHash:R,isGraphMode:N,laneWidth:ke,paddingLeft:Ce,totalHeight:Pe}),e("div",{ref:ie,className:"flex flex-col relative z-20",style:{paddingLeft:`${Te}px`},children:[W.map((j)=>e(ht,{commit:j,isExpanded:R===j.hash,onToggleExpand:()=>G(j.hash),onAction:I,onToggleFile:Y,isExpandedFile:(q,ne)=>E.has(`${q}:${ne}`),isLoadingFile:(q,ne)=>H.has(`${q}:${ne}`),isFullContextFile:(q,ne)=>Q.has(`${q}:${ne}`),onToggleContext:z,fileDiffs:V,headerRef:(q)=>{pe.current[j.hash]=q}},j.hash)),e("div",{ref:ve,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:F?e("div",{className:"flex items-center gap-2 text-xs text-muted font-mono py-2",children:[e(m,{size:14,className:"animate-spin text-info-text","aria-hidden":"true"}),e("span",{children:"Loading more commits..."})]}):k&&!w.trim()?e("button",{type:"button",onClick:O,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-muted py-2",children:["End of commit history (",typeof A==="number"&&A>0?A:x.length," commits)"]}):null})]})]})})]})})}function kt({children:t,onClose:l}){return e("div",{className:"fixed inset-0 z-50 modal-scrim flex items-center justify-center modal-safe",onClick:l,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:(c)=>c.stopPropagation(),children:t})})}function Ct({modal:t,onClose:l,onConfirm:c}){if(!t)return null;return e(kt,{onClose:l,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(_,{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:l,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:c,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 Nt({isOpen:t,branchName:l,inputRef:c,onChange:r,onClose:p,onCreate:h}){if(!t)return null;let g=a(()=>{if(l.trim())h()},[l,h]);return e(kt,{onClose:p,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e($n,{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:c,type:"text",value:l,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:!l.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 wt({branch:t,detached:l,onCheckout:c,onMerge:r,onRename:p,onDelete:h}){let g=t.current&&!l;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:c,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(me,{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(Yt,{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($n,{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(zn,{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(L,{size:11})})]})]})}function Yt({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 Rt({branch:t,onClose:l,onSubmit:c}){if(!t)return null;return e(Xt,{branch:t,onClose:l,onSubmit:c})}function Xt({branch:t,onClose:l,onSubmit:c}){let[r,p]=n(t.name),[h,g]=n(!1),v=r.trim(),N=v===t.name,M=v.length>0&&!N,w=()=>{if(M)c(t.name,v,h)};return e(Z,{onClose:l,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:(C)=>p(C.currentTarget.value),onKeyDown:(C)=>{if(C.key==="Enter")w();if(C.key==="Escape")l()},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"}),N&&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:(C)=>g(C.currentTarget.checked),className:`${be} 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:l,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:w,disabled:!M,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 Gt({branch:t,force:l,onForceChange:c,onClose:r,onConfirm:p}){if(!t)return null;return e(Z,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(_,{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:l,onChange:(h)=>c(h.currentTarget.checked),className:`${be} 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 ",l?"-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 ",l?"(force)":""]})]})]})}function St({isOpen:t,rootPath:l,repo:c,currentBranch:r,detached:p,isBusy:h,onClose:g,onAction:v,onConfirmDelete:N}){let[M,w]=n([]),[C,R]=n(!1),[G,T]=n(null),[y,x]=n(""),[k,A]=n(null),[F,O]=n(null),[V,E]=n(!1),H=a(async()=>{R(!0),T(null);let z=new URLSearchParams({branches:"1",repo:c||"."});if(l)z.set("root",l);try{let I=await fetch(`/api/fs/git?${z.toString()}`),W=await I.json();if(W.success&&Array.isArray(W.branches))w(W.branches);else T(W.error||`Failed to read branches (HTTP ${I.status})`)}catch(I){T(I instanceof Error?I.message:"Failed to read branches")}finally{R(!1)}},[l,c]);o(()=>{if(t)H()},[t,H]);let Q=i(!1);o(()=>{if(!t){Q.current=!1;return}if(Q.current&&!h)H();Q.current=h},[t,h,H]),o(()=>{if(!t)A(null),O(null),E(!1),x("")},[t]);let Y=u(()=>{let z=y.trim().toLowerCase();if(!z)return M;return M.filter((I)=>I.name.toLowerCase().includes(z)||I.upstream.toLowerCase().includes(z))},[M,y]);if(!t)return null;return e(d,{children:[e(Z,{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(U,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:y,onChange:(z)=>x(z.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 H(),disabled:C,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(D,{size:12,className:C?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:C&&M.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…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):Y.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:y.trim()?"No matching branches.":"No branches."}):Y.map((z)=>e(wt,{branch:z,detached:p,onCheckout:()=>{v("checkout",{branch:z.name}),g()},onMerge:()=>{v("merge_branch",{branch:z.name}),g()},onRename:()=>A(z),onDelete:()=>{O(z),E(!1)}},z.name))})]}),e(Rt,{branch:k,onClose:()=>A(null),onSubmit:(z,I,W)=>{v("rename_branch",{branch:z,newName:I,...W?{remote:"1"}:{}}),A(null)}},k?.name??"none"),e(Gt,{branch:F,force:V,onForceChange:E,onClose:()=>{O(null),E(!1)},onConfirm:(z)=>{N(z,V),O(null),E(!1)}})]})}function Pt({mounted:t,confirmModal:l,onCloseConfirm:c,onConfirm:r,branchPrompt:p,newBranchName:h,newBranchInputRef:g,onNewBranchNameChange:v,onCloseBranchPrompt:N,onCreateBranch:M,viewingOutput:w,onCloseOutput:C,onRefreshOutput:R,onExecuteAction:G,branchModalOpen:T,onCloseBranchModal:y,rootPath:x,activeRepo:k,currentBranch:A,detached:F,isBusy:O,onBranchAction:V,onConfirmDeleteBranch:E}){if(!t)return null;return e(d,{children:[e(Ct,{modal:l,onClose:c,onConfirm:r}),e(Nt,{isOpen:p,branchName:h,inputRef:g,onChange:v,onClose:N,onCreate:M}),e(Ue,{output:w,onClose:C,onRefresh:R,onExecuteAction:G,rootPath:x,activeRepo:k}),e(St,{isOpen:T,rootPath:x,repo:k,currentBranch:A,detached:F,isBusy:O,onClose:y,onAction:V,onConfirmDelete:E})]})}function $t({rootPath:t,repo:l,isBusy:c,onAction:r}){let[p,h]=S("git.stashExpanded",!1),[g,v]=n([]),[N,M]=n(!1),[w,C]=n(""),[R,G]=n(!1),T=xr(),y=a(async()=>{M(!0);let k=new URLSearchParams({stashes:"1",repo:l||"."});if(t)k.set("root",t);try{let F=await(await fetch(`/api/fs/git?${k.toString()}`)).json();v(F.stashes??[])}catch{v([])}finally{M(!1)}},[t,l]);o(()=>{if(p)y()},[p,y,c]);let x=(k,A)=>{if(r(k,A),k==="stash_push")C(""),G(!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(at,{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",{...w.trim()?{message:w.trim()}:{},...R?{untracked:"1"}:{}}),disabled:c,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(P,{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:w,onChange:(k)=>C(k.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:(k)=>G(k.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"-u"]})]}),N&&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((k)=>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:k.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:k.subject,children:k.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:k.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:k.ref,pop:"1"}),disabled:c,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(fe,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_apply",{ref:k.ref}),disabled:c,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(at,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_drop",{ref:k.ref}),disabled:c,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(L,{size:10})})]})]},k.ref))})]})})})]})}function Mt({repo:t,isBusy:l,onInit:c}){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(me,{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:c,disabled:l,"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(me,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function Tt(t,l,c){let r=ut(),{pickedRepo:p,setActiveRepo:h,ready:g}=gr(t),{repos:v,scanning:N,rescan:M}=Ar(t,l),w=hg(p,v),C=i(w);C.current=w;let R=i("");R.current=`${t??""}\x00${w}`;let G=i(""),T=i(""),y=i(void 0);if(r.data!==y.current)y.current=r.data,T.current=G.current;let x=l&&g?jp(`${t??""}\x00${w}`):null,k=Ie(x),A=i(k.refresh);A.current=k.refresh;let F=T.current===R.current?r.data:void 0,O=k.data??F,V=O?.syncCount??F?.syncCount,E=a((Y)=>{if(!l)return;let z=Y??C.current,I=new URLSearchParams;if(t)I.set("root",t);if(z)I.set("repo",z);I.set("sync","1"),I.set("t",String(Date.now())),G.current=R.current;let W=A.current;r.load(`/api/fs/git?${I.toString()}`).then(()=>W())},[l,t,r.load]);o(()=>{if(!g)return;E()},[c,t,l,g,w,E]);let H=r.state==="loading",Q=H||k.refreshing;return{activeRepo:w,setActiveRepo:h,repos:v,reposScanning:N,refreshRepos:M,isReading:H,isRefreshing:Q,data:O,syncCount:V,loadRepo:E,refreshTopic:k.refresh}}function At(t,l){let c=ut(),r=i(null),p=a((h,g,v)=>{r.current={actionType:h,extra:v};let N=new FormData;if(N.append("actionType",h),N.append("repo",l),t)N.append("root",t);if(g)N.append("file",g);if(v)Object.entries(v).forEach(([M,w])=>N.append(M,w));c.submit(N,{method:"POST",action:"/api/fs/git"})},[l,t,c]);return{state:c.state,execute:p,data:c.data,lastAction:r.current}}function Lt({rootPath:t,repo:l,execute:c}){let{sessionId:r}=Hp(),[p,h]=S("git.commitDraft",""),[g,v]=S("git.amend",!1),[N,M]=n(!1),[w,C]=n(null),[R,G]=n(!1),T=i(!1),y=i(null),x=i(p);x.current=p;let k=i(g);k.current=g;let A=i(h);A.current=h;let F=a((Y)=>{h(Y),G(!1)},[h]),O=a(()=>{if(T.current)return;T.current=!0,M(!0),C(null);let Y={...t?{root:t}:{},repo:l,...r?{sessionId:r}:{},...k.current?{amend:!0}:{}};fetch("/api/fs/git-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)}).then(async(z)=>{let I=await z.json().catch(()=>null);if(!z.ok||typeof I?.message!=="string"||!I.message.trim())throw Error(typeof I?.error==="string"?I.error:`Request failed (HTTP ${z.status})`);let W=I.message.trim();if(x.current.trim().length===0)A.current(W),G(!0);else C(W)}).catch((z)=>{il(z instanceof Error?z.message:String(z),"error")}).finally(()=>{T.current=!1,M(!1)})},[t,l,r]),V=a(()=>{if(w===null)return;h(w),G(!0),C(null)},[w,h]),E=a(()=>C(null),[]);o(()=>{if(!g)return;if(x.current.trim().length>0)return;let Y=new URLSearchParams({headMessage:"1"});if(t)Y.set("root",t);if(l&&l!==".")Y.set("repo",l);let z=!1;return fetch(`/api/fs/git?${Y.toString()}`).then((I)=>I.json()).then((I)=>{if(z)return;if(!k.current||x.current.trim().length>0)return;let W=typeof I?.message==="string"?I.message:"";if(W.length===0)return;y.current=W,A.current(W)}).catch(()=>{}),()=>{z=!0}},[g,r,t,l]);let H=a((Y)=>{if(Y){v(!0);return}if(y.current!==null&&x.current===y.current)h("");y.current=null,v(!1)},[v,h]),Q=a(()=>{c("commit",void 0,{message:x.current,...k.current?{amend:"1"}:{}}),h(""),v(!1),y.current=null,C(null),G(!1)},[c,v,h]);return{message:p,setMessage:F,amend:g,seeded:y.current!==null&&p===y.current,toggleAmend:H,commit:Q,isGenerating:N,suggestion:w,generated:R,generate:O,useSuggestion:V,dismissSuggestion:E}}var Dt=48;function Zt(t,l){let c=l?.branch?.trim()??"",r=(l?.hash??"").slice(0,7),p=l?.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(l?.amend==="1")return{done:"Amended the last commit"};let h=(l?.message??"").split(`
9
+ `)[0].trim();if(!h)return{done:"Commit created"};return{done:`Committed “${h.length>Dt?`${h.slice(0,Dt-1)}…`:h}”`}}case"checkout":return{done:c?`Switched to ${c}`:"Switched branch"};case"create_branch":case"create_branch_at":return{done:c?`Created branch ${c}`:"Created branch"};case"rename_branch":{let h=l?.newName?.trim()??"";return{done:c&&h?`Renamed ${c} to ${h}`:"Renamed branch"}}case"delete_branch":return{done:c?`Deleted branch ${c}`:"Deleted branch"};case"merge_branch":return{done:c?`Merged ${c}`:"Merged branch",stopped:c?`Merging ${c}`:"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=l?.mode??"mixed";return{done:r?`Reset to ${r} (${h})`:`Reset (${h})`}}case"stash_push":return{done:"Stashed your changes"};case"stash_apply":return{done:l?.pop==="1"?`Popped ${p}`:`Applied ${p}`,stopped:l?.pop==="1"?`Popping ${p}`:`Applying ${p}`};case"stash_drop":return{done:`Dropped ${p}`};default:return null}}function Et({actionType:t,extra:l,stopped:c}){let r=Zt(t,l);if(!c)return r?.done??null;let p=Bo[c]??c,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 Bt(t){let{fetcher:l,onPage:c,onReload:r,onSuccess:p,onError:h}=t,g=i(null),v=i({onPage:c,onReload:r,onSuccess:p,onError:h});v.current={onPage:c,onReload:r,onSuccess:p,onError:h},o(()=>{if(l.state!=="idle"||!l.data)return;let N=l.data;if(N===g.current)return;g.current=N;let M=v.current;if(N.type==="history"||N.type==="graph"){M.onPage({title:N.type==="graph"?"Git Graph":"Commit History",data:N.data||[],hasMore:N.hasMore,total:N.total});return}if(!N.success){M.onError(N.error||"Git operation failed");return}M.onReload();let w=l.lastAction,C=w?Et({...w,stopped:N.stopped}):null;if(C)M.onSuccess(C,N.stopped?"warning":"success")},[l.state,l.data,l.lastAction])}function Ft(t,l,c,r){if(t==="revert")return{type:t,file:l,message:`Are you sure you want to discard changes in ${l}?`};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?Bo[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=c?.branch??"",h=c?.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=c?.ref||"the top entry";return{type:t,extra:{ref:c?.ref??""},message:`Drop ${p}? The stash entry is removed — this cannot be undone from the panel.`}}return null}function wr({className:t="",enabled:l=!0,rootPath:c,refreshKey:r=0}){let{activeRepo:p,setActiveRepo:h,repos:g,reposScanning:v,refreshRepos:N,isReading:M,isRefreshing:w,data:C,syncCount:R,loadRepo:G,refreshTopic:T}=Tt(c,l,r),y=At(c,p),[x,k]=S("git.viewMode","flat"),[A,F]=n(!1),O=i(null),[V,E]=n(!1),H=i(null),[Q,Y]=n(null),[z,I]=n(!1),[W,oe]=n(""),ie=i(null),[ve,pe]=n(!1),[he,ye]=n(null),[Pe,$e]=n(!1),{pushToast:ae}=He();o(()=>{$e(!0)},[]),o(()=>{if(z&&ie.current)ie.current.focus()},[z]),Bt({fetcher:y,onPage:ye,onReload:G,onSuccess:(X,te)=>ae(X,te),onError:(X)=>ae(X,"error")}),ue(O,()=>F(!1)),ue(H,()=>E(!1));let ee=y.execute,{message:Me,setMessage:ke,amend:Ce,seeded:Te,toggleAmend:Ae,commit:j,isGenerating:q,suggestion:ne,generated:Le,generate:ge,useSuggestion:De,dismissSuggestion:Ne}=Lt({rootPath:c,repo:p,execute:ee}),de=(X,te,we)=>{let Ke=Ft(X,te,we,C?.state?.operation??null);if(Ke){Y(Ke);return}ee(X,te,we)},Ht=(X,te)=>{ee("resolve_conflict",X,te?{side:te}:void 0)},We=C?.branch||"main",zt=C?.branches||["main"],Ot=C?.remoteBranches||[],qe=C?.changes||[],le=M||y.state!=="idle",Be=y.state==="idle"?null:y.lastAction?.actionType??null,It=Be==="sync"||Be==="push"||Be==="pull",_t=qe.filter((X)=>{if(_r(X.status))return!1;let te=X.status;return te&&te[0]!==" "&&te[0]!=="?"});if(!l)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(Pt,{mounted:Pe,confirmModal:Q,onCloseConfirm:()=>Y(null),onConfirm:()=>{if(Q)ee(Q.type,Q.file,Q.extra),Y(null)},branchPrompt:z,newBranchName:W,newBranchInputRef:ie,onNewBranchNameChange:oe,onCloseBranchPrompt:()=>{I(!1),oe("")},onCreateBranch:()=>{if(W.trim())ee("create_branch",void 0,{branch:W.trim()}),I(!1),oe("")},viewingOutput:he,onCloseOutput:()=>ye(null),onRefreshOutput:()=>{if(he)ee(he.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(X,te,we)=>ee(X,te,we),branchModalOpen:ve,onCloseBranchModal:()=>pe(!1),rootPath:c,activeRepo:p,currentBranch:We,detached:C?.state?.detached??!1,isBusy:le,onBranchAction:(X,te)=>ee(X,void 0,te),onConfirmDeleteBranch:(X,te)=>{ee("delete_branch",void 0,{branch:X,...te?{force:"1"}:{}})}}),e(Je,{activeRepo:p,repos:g,isRefreshing:w,rootPath:c,reposScanning:v,onSelectRepo:(X)=>{if(X!==p)h(X)},onRefresh:()=>{T(),G()},onRefreshRepos:N}),C?.isRepo===!1?e(Mt,{repo:p,isBusy:le,onInit:()=>ee("init")}):e(d,{children:[e(Qe,{branchRef:H,showBranchMenu:V,setShowBranchMenu:E,branch:We,branches:zt,remoteBranches:Ot,onCheckout:(X)=>ee("checkout",void 0,{branch:X}),onMerge:(X)=>ee("merge_branch",void 0,{branch:X}),onOpenBranchPrompt:()=>I(!0),onManageBranches:()=>{pe(!0),E(!1)},optionsRef:O,showOptions:A,setShowOptions:F,onHistory:()=>ee("history"),onGraph:()=>ee("graph"),viewMode:x,setViewMode:k,isBusy:le,syncCount:R,syncing:It,onSync:()=>ee("sync"),onFetch:()=>ee("fetch"),detached:C?.state?.detached??!1}),C?.state?.operation?e(Ze,{operation:C.state.operation,conflicts:C.state.conflicts,isBusy:le,onAbort:()=>de("abort_operation"),onContinue:()=>ee("continue_operation")}):e(Xe,{message:Me,hasStagedChanges:_t.length>0,isBusy:le,amend:Ce,seeded:Te,isGenerating:q,suggestion:ne,generated:Le,onToggleAmend:Ae,onChangeMessage:ke,onCommit:j,onGenerate:ge,onUseSuggestion:De,onDismissSuggestion:Ne}),e(nt,{changes:qe,isLoading:le,viewMode:x,repo:p,rootPath:c,onAction:de,onResolve:Ht}),e($t,{rootPath:c,repo:p,isBusy:le,onAction:(X,te)=>de(X,void 0,te)})]})]})}export{wr as GitPanel};