@kabmo-labs/kabmo 0.60.0 → 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (506) hide show
  1. package/README.md +53 -49
  2. package/dist/client/index.html +1 -1
  3. package/dist/client/index.js +1157 -825
  4. package/dist/client/static/js/{Body-p82s28sj.js → Body-z6kstvk6.js} +3 -3
  5. package/dist/client/static/js/{CsvGrid-erc5mcvc.js → CsvGrid-f73c0s4e.js} +2 -2
  6. package/dist/client/static/js/{DocxView-x3faj0jv.js → DocxView-a1pb7nsb.js} +3 -3
  7. package/dist/client/static/js/{DrawioView-t7fh3ens.js → DrawioView-r61gcg24.js} +2 -2
  8. package/dist/client/static/js/{HtmlPreview-zy7x7jmm.js → HtmlPreview-vt7j0b05.js} +1 -1
  9. package/dist/client/static/js/ImageView-4nhr5dtm.js +1 -0
  10. package/dist/client/static/js/LayoutWrapper-vwhy0vhj.js +2 -0
  11. package/dist/client/static/js/MergeDiffView-f4h9ss71.js +1 -0
  12. package/dist/client/static/js/Modal-cadmjkak.js +60 -0
  13. package/dist/client/static/js/{PdfView-kqx472q7.js → PdfView-mppt2gkd.js} +1 -1
  14. package/dist/client/static/js/SessionsView-vvsaw9f0.js +1 -0
  15. package/dist/client/static/js/{SheetView-0n9fze50.js → SheetView-5s9zfx9g.js} +9 -9
  16. package/dist/client/static/js/{SvgPreview-6xc6ts46.js → SvgPreview-ff78xn3e.js} +1 -1
  17. package/dist/client/static/js/{abnfDiagram-O67JEVCF-2xdkkqwg.js → abnfDiagram-O67JEVCF-p29sh3w2.js} +1 -1
  18. package/dist/client/static/js/architecture-7GRP2DOG-83w3kytq.js +1 -0
  19. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ja8cx19z.js → architectureDiagram-NJMV4G6O-nbpdyea3.js} +3 -3
  20. package/dist/client/static/js/{astro-yphdvdty.js → astro-qtfmc8x7.js} +1 -1
  21. package/dist/client/static/js/bash-wcy12qjx.js +1 -0
  22. package/dist/client/static/js/{blockDiagram-BEXU5L5S-ytf7s99c.js → blockDiagram-BEXU5L5S-t8xbexa6.js} +6 -6
  23. package/dist/client/static/js/c-vvantfth.js +1 -0
  24. package/dist/client/static/js/{c4Diagram-YGBWAQC7-5a0kdx0z.js → c4Diagram-YGBWAQC7-9fwf2zxk.js} +3 -3
  25. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-hd98dvjw.js → classDiagram-v2-NBCMYWYE-nbapgqbs.js} +4 -4
  26. package/dist/client/static/js/{cose-bilkent-JH36ORCC-man3fqcj.js → cose-bilkent-JH36ORCC-k54mmydp.js} +1 -1
  27. package/dist/client/static/js/cpp-5x63r6g0.js +1 -0
  28. package/dist/client/static/js/css-j2j6f03w.js +1 -0
  29. package/dist/client/static/js/css-qk59j6rj.js +1 -0
  30. package/dist/client/static/js/cynefin-OW5HDTMX-80z02zrj.js +1 -0
  31. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-2f0kbbv2.js → cynefinDiagram-VND7K2PF-qdg32wah.js} +1 -1
  32. package/dist/client/static/js/{dagre-6A5THRUB-k7pyhgzn.js → dagre-6A5THRUB-qzshg1vs.js} +2 -2
  33. package/dist/client/static/js/{diagram-22UHCM2B-qx0afa2m.js → diagram-22UHCM2B-197hemfa.js} +11 -11
  34. package/dist/client/static/js/{diagram-3UASUU5V-ydpe77sv.js → diagram-3UASUU5V-236gnjr6.js} +1 -1
  35. package/dist/client/static/js/{diagram-ATOU4E4O-e63v984n.js → diagram-ATOU4E4O-vjgpyaaq.js} +3 -3
  36. package/dist/client/static/js/{diagram-CDSNMT55-8c765h3a.js → diagram-CDSNMT55-ywvzcx7z.js} +4 -4
  37. package/dist/client/static/js/{diagram-MLGK6HIB-3pq0n7v8.js → diagram-MLGK6HIB-9ey7ev7j.js} +1 -1
  38. package/dist/client/static/js/{diagram-MPIPVDR6-638atzxz.js → diagram-MPIPVDR6-vrqbb6r7.js} +2 -2
  39. package/dist/client/static/js/{dockerfile-yehc914q.js → dockerfile-4nked309.js} +1 -1
  40. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-3gv43zvm.js → ebnfDiagram-ZINNZB2B-hvnkevqy.js} +1 -1
  41. package/dist/client/static/js/{elixir-3nwnd9yw.js → elixir-3jvh6v4k.js} +1 -1
  42. package/dist/client/static/js/{elk-276RUBZZ-6s5pggfc.js → elk-276RUBZZ-nej6yy1c.js} +1 -1
  43. package/dist/client/static/js/{erDiagram-OPXOYQCR-x7cqyb89.js → erDiagram-OPXOYQCR-ww453xcy.js} +5 -5
  44. package/dist/client/static/js/{erlang-p5c4n3t0.js → erlang-4fz73a1q.js} +1 -1
  45. package/dist/client/static/js/eventmodeling-NTZA5JFV-y9pq2709.js +1 -0
  46. package/dist/client/static/js/flowDiagram-KWPJA3E3-e6v7513q.js +1 -0
  47. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-g97te4v1.js → ganttDiagram-FUAMR5RP-abc5wy70.js} +3 -3
  48. package/dist/client/static/js/gitGraph-4MIJSDKK-fzaf9azs.js +1 -0
  49. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-sw4f94tc.js → gitGraphDiagram-X574FWY7-4acqzj2h.js} +7 -7
  50. package/dist/client/static/js/graphql-hpkvdvk7.js +1 -0
  51. package/dist/client/static/js/html-x12gb1wk.js +1 -0
  52. package/dist/client/static/js/{index-v88m5sva.js → index-0g82ph6h.js} +2 -2
  53. package/dist/client/static/js/{index-vejz38qt.js → index-0w1jzang.js} +5 -5
  54. package/dist/client/static/js/{index-bpcg34jp.js → index-1svt0cdw.js} +2 -2
  55. package/dist/client/static/js/{index-hgfyx8dt.js → index-1tb4py5v.js} +2 -2
  56. package/dist/client/static/js/index-2gt9krtj.js +4 -0
  57. package/dist/client/static/js/index-2x9m7s1a.js +1 -0
  58. package/dist/client/static/js/index-3fvqmz3m.js +4 -0
  59. package/dist/client/static/js/{index-pdz6j2g2.js → index-42wvbkm5.js} +2 -2
  60. package/dist/client/static/js/index-477vtt51.js +2 -0
  61. package/dist/client/static/js/{index-ca6tmamh.js → index-4px56qaz.js} +2 -2
  62. package/dist/client/static/js/{index-excgtjhx.js → index-5anvw7xg.js} +36 -36
  63. package/dist/client/static/js/index-5nb9k2ph.js +1 -0
  64. package/dist/client/static/js/{index-97sw4d9n.js → index-615je3km.js} +2 -2
  65. package/dist/client/static/js/{index-111bq6rs.js → index-66qxrh5n.js} +1 -1
  66. package/dist/client/static/js/{index-a145x0w2.js → index-7kct1sz1.js} +2 -2
  67. package/dist/client/static/js/{index-hwv7bfxc.js → index-8e0d8y30.js} +2 -2
  68. package/dist/client/static/js/{index-s4j2ghmx.js → index-90bq56xw.js} +2 -2
  69. package/dist/client/static/js/{index-wsy6y5em.js → index-b1gzh60t.js} +11 -11
  70. package/dist/client/static/js/{index-10vzyga1.js → index-bypkmjrz.js} +2 -2
  71. package/dist/client/static/js/{index-n8r7r86r.js → index-c1vd63yd.js} +2 -2
  72. package/dist/client/static/js/index-c9f0hejv.js +3 -0
  73. package/dist/client/static/js/{index-2dmew334.js → index-cgqj15g0.js} +2 -2
  74. package/dist/client/static/js/{index-mtav0rpf.js → index-cts5re1t.js} +2 -2
  75. package/dist/client/static/js/index-dxc14kmm.js +1 -0
  76. package/dist/client/static/js/{index-hwdkxe4n.js → index-dxyjxhm1.js} +2 -2
  77. package/dist/client/static/js/{index-43gmn7yb.js → index-edpyqz9f.js} +1 -1
  78. package/dist/client/static/js/{index-pdgc9ccr.js → index-eesepb70.js} +2 -2
  79. package/dist/client/static/js/{index-vec7m1yd.js → index-evh437bz.js} +2 -2
  80. package/dist/client/static/js/index-ey6v4t5b.js +1 -0
  81. package/dist/client/static/js/{index-025s3fp8.js → index-fsd7n336.js} +2 -2
  82. package/dist/client/static/js/{index-yfcy4cf6.js → index-h7a7fqag.js} +2 -2
  83. package/dist/client/static/js/{index-11qn05g9.js → index-hffgwnvz.js} +2 -2
  84. package/dist/client/static/js/index-j734ev6q.js +482 -0
  85. package/dist/client/static/js/{index-vcq6zfxx.js → index-jcbp1d9d.js} +6 -6
  86. package/dist/client/static/js/index-jg5h18sm.js +2 -0
  87. package/dist/client/static/js/{index-6qn9kygb.js → index-jtdve6xw.js} +7 -7
  88. package/dist/client/static/js/{index-4xbc0j7t.js → index-k0bqrb1y.js} +1 -1
  89. package/dist/client/static/js/{index-bdtftrym.js → index-kegevd10.js} +2 -2
  90. package/dist/client/static/js/{index-fr6wsqk8.js → index-kqcfxkch.js} +2 -2
  91. package/dist/client/static/js/{index-2n2evsg0.js → index-kv1xnem9.js} +2 -2
  92. package/dist/client/static/js/{index-8zct30zd.js → index-m54ctmxr.js} +1 -1
  93. package/dist/client/static/js/index-mgzbypt5.js +314 -0
  94. package/dist/client/static/js/{index-cf69bhjx.js → index-mh52531j.js} +2 -2
  95. package/dist/client/static/js/{index-0ze5bwvw.js → index-mhz5ywa4.js} +5 -5
  96. package/dist/client/static/js/{index-3j2he86h.js → index-nnwdbg3t.js} +2 -2
  97. package/dist/client/static/js/{index-9rz6kzsv.js → index-nxd6z7f9.js} +2 -2
  98. package/dist/client/static/js/{index-jfqd838j.js → index-pjrbt77c.js} +2 -2
  99. package/dist/client/static/js/index-r7h4pm42.js +2 -0
  100. package/dist/client/static/js/index-ratrdgc9.js +2 -0
  101. package/dist/client/static/js/{index-cfvc1zpk.js → index-rhmvh9w5.js} +2 -2
  102. package/dist/client/static/js/{index-twwsn91p.js → index-sqzjwy9h.js} +2 -2
  103. package/dist/client/static/js/{index-37apvxgj.js → index-tckzkw0f.js} +2 -2
  104. package/dist/client/static/js/index-tza9h3q6.css +1 -0
  105. package/dist/client/static/js/{index-qccydkze.js → index-vhjfr093.js} +2 -2
  106. package/dist/client/static/js/{index-z8k42dwz.js → index-w0j96eyy.js} +8 -8
  107. package/dist/client/static/js/{index-qkqkygrf.js → index-ws04kxy9.js} +1 -1
  108. package/dist/client/static/js/{index-a3bpmw2r.js → index-x1yqmzpr.js} +2 -2
  109. package/dist/client/static/js/{index-fb2fjndj.js → index-x2f7wykb.js} +6 -6
  110. package/dist/client/static/js/index-y8405hdg.js +10 -0
  111. package/dist/client/static/js/{index-sx83ans2.js → index-yxk7dgnb.js} +2 -2
  112. package/dist/client/static/js/{index-bkn6jtn1.js → index-zavecxak.js} +2 -2
  113. package/dist/client/static/js/{index-dv01prse.js → index-zg7q3kcb.js} +2 -2
  114. package/dist/client/static/js/{index-enm77k5z.js → index-zhn9vv3z.js} +2 -2
  115. package/dist/client/static/js/{index-ywp0sd1e.js → index-zy963qbh.js} +1 -1
  116. package/dist/client/static/js/info-A6RAGUB7-t7pbg7rt.js +1 -0
  117. package/dist/client/static/js/{infoDiagram-VRGFBTTK-pw2qaa27.js → infoDiagram-VRGFBTTK-9pe7w3r5.js} +2 -2
  118. package/dist/client/static/js/ini-522adp5a.js +1 -0
  119. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-d13jhvxy.js → ishikawaDiagram-OU5B5YK6-38arfrx5.js} +2 -2
  120. package/dist/client/static/js/java-z0rgs7v6.js +1 -0
  121. package/dist/client/static/js/javascript-fv87f565.js +1 -0
  122. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-20gb8a04.js → journeyDiagram-ZHPQQLJL-kcwzjgtz.js} +4 -4
  123. package/dist/client/static/js/json-1czq1ped.js +1 -0
  124. package/dist/client/static/js/jsx-1fch2jyr.js +1 -0
  125. package/dist/client/static/js/{julia-rpd1y9vh.js → julia-pzzxbptm.js} +1 -1
  126. package/dist/client/static/js/{kanban-definition-PNTS6WVX-s78e158c.js → kanban-definition-PNTS6WVX-nmegwy9w.js} +15 -15
  127. package/dist/client/static/js/lua-nn8bpjev.js +1 -0
  128. package/dist/client/static/js/markdown-38tqrgkn.js +1 -0
  129. package/dist/client/static/js/{mermaid.core-xbm27k28.js → mermaid.core-3aae27b9.js} +7 -7
  130. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-6y7xe2zm.js → mindmap-definition-NLK3R4M7-zsaq4e65.js} +12 -12
  131. package/dist/client/static/js/one-dark-pro-trnff03z.js +1 -0
  132. package/dist/client/static/js/one-light-ck31ptqs.js +1 -0
  133. package/dist/client/static/js/packet-AYTQ26CC-rwac7scq.js +1 -0
  134. package/dist/client/static/js/{pegDiagram-GJSIUBJH-dmvewetf.js → pegDiagram-GJSIUBJH-2b6whj1p.js} +1 -1
  135. package/dist/client/static/js/{perl-kmtz9dnv.js → perl-zdkbbjd2.js} +1 -1
  136. package/dist/client/static/js/{php-bttrsbxy.js → php-ktaxff6g.js} +1 -1
  137. package/dist/client/static/js/pie-WAS4IAKB-gjz20apz.js +1 -0
  138. package/dist/client/static/js/{pieDiagram-5QR66LMP-1q9e7rcm.js → pieDiagram-5QR66LMP-y09ar7vz.js} +3 -3
  139. package/dist/client/static/js/properties-kncqeqhn.js +1 -0
  140. package/dist/client/static/js/python-gx8ggmyh.js +1 -0
  141. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-mvrem3n6.js → quadrantDiagram-O4NWA36T-mapfzs06.js} +3 -3
  142. package/dist/client/static/js/r-x8rftkm3.js +1 -0
  143. package/dist/client/static/js/radar-RG4KPBEZ-akwdknab.js +1 -0
  144. package/dist/client/static/js/railroad-74A4TZTK-m5v4rfhx.js +1 -0
  145. package/dist/client/static/js/railroad-abnf-HS5TGJTU-k2gmqcjb.js +1 -0
  146. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zdsfjf4.js +1 -0
  147. package/dist/client/static/js/railroad-peg-WCYAUIDC-e98evqb6.js +1 -0
  148. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-axttcfhw.js → railroadDiagram-XR7U4H2S-70qy7qdh.js} +1 -1
  149. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-5qx7erta.js → requirementDiagram-PLB6GJNP-2vb2gp3e.js} +3 -3
  150. package/dist/client/static/js/{ruby-dve3y59w.js → ruby-ytqv3pqz.js} +1 -1
  151. package/dist/client/static/js/{rust-b3ckax3e.js → rust-6sddyxnt.js} +1 -1
  152. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-es87a3j6.js → sankeyDiagram-IPEJSGJF-9jd8ebrn.js} +3 -3
  153. package/dist/client/static/js/{sass-emxqt5p2.js → sass-dvbra5b6.js} +1 -1
  154. package/dist/client/static/js/{scss-4j4t3r6y.js → scss-sy7w8916.js} +1 -1
  155. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-dgpnjrtk.js → sequenceDiagram-PO4LG4MO-w7z84f80.js} +7 -7
  156. package/dist/client/static/js/{sizeCapture-INFHLROL-kyw0p86n.js → sizeCapture-INFHLROL-q8w7ehgx.js} +1 -1
  157. package/dist/client/static/js/sql-99y0qnag.js +1 -0
  158. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-vnsbw8y9.js → stateDiagram-v2-GCMORJYK-4978hapr.js} +3 -3
  159. package/dist/client/static/js/{svelte-dbsx1ehx.js → svelte-xvs3fkza.js} +1 -1
  160. package/dist/client/static/js/{swimlanes-2SLR337P-060q1rep.js → swimlanes-2SLR337P-eshg5fjy.js} +1 -1
  161. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-914e28hd.js +8 -0
  162. package/dist/client/static/js/timeline-definition-EJHVYXUP-5h5q357k.js +120 -0
  163. package/dist/client/static/js/treeView-Q6P3EWNA-fkm3a7gx.js +1 -0
  164. package/dist/client/static/js/treemap-WGGIJYW6-hm4ktxjf.js +1 -0
  165. package/dist/client/static/js/tsx-phngprp0.js +1 -0
  166. package/dist/client/static/js/typescript-m62a7zr2.js +1 -0
  167. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-18sp73v7.js → usecaseDiagram-POWQR4AR-4j69y3zx.js} +20 -20
  168. package/dist/client/static/js/vennDiagram-UO4OBE2U-pa9p5jpw.js +34 -0
  169. package/dist/client/static/js/{vue-hyr58df9.js → vue-p4g4avm3.js} +1 -1
  170. package/dist/client/static/js/wardley-WFR3VGLG-3y2rvdmy.js +1 -0
  171. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-q0kwmbzh.js → wardleyDiagram-VNRHLVJA-hjddd656.js} +3 -3
  172. package/dist/client/static/js/xml-59n0cjn6.js +1 -0
  173. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-y0gpmg6m.js → xychartDiagram-PMCCYNJV-8ng5m849.js} +4 -4
  174. package/dist/client/static/js/yaml-9fw908s4.js +1 -0
  175. package/dist/client/tailwindcss-oxide.linux-x64-gnu-c0fa36dv.node +0 -0
  176. package/dist/client/tailwindcss-oxide.linux-x64-musl-kr04sh0e.node +0 -0
  177. package/marketplace/plugins/command-runner/package.json +2 -2
  178. package/marketplace/plugins/command-runner/src/app.tsx +2 -5
  179. package/marketplace/plugins/command-runner/src/panel/CustomForm.tsx +35 -52
  180. package/marketplace/plugins/command-runner/src/panel/Groups.tsx +6 -5
  181. package/marketplace/plugins/command-runner/src/panel/Header.tsx +18 -54
  182. package/marketplace/plugins/command-runner/src/panel/Output.tsx +3 -7
  183. package/marketplace/plugins/command-runner/src/panel/Row.tsx +19 -38
  184. package/marketplace/plugins/command-runner/src/panel/index.tsx +1 -4
  185. package/marketplace/plugins/git-forge/package.json +2 -2
  186. package/marketplace/plugins/git-forge/src/app.tsx +2 -0
  187. package/marketplace/plugins/git-forge/src/panel/Credential.tsx +8 -15
  188. package/marketplace/plugins/git-forge/src/panel/Header.tsx +35 -66
  189. package/marketplace/plugins/git-forge/src/panel/ItemView.tsx +7 -13
  190. package/marketplace/plugins/git-forge/src/panel/List.tsx +28 -56
  191. package/marketplace/plugins/git-forge/src/panel/Row.tsx +7 -9
  192. package/marketplace/plugins/git-forge/src/panel/Sidebar.tsx +21 -31
  193. package/marketplace/plugins/git-forge/src/panel/Write.tsx +26 -40
  194. package/marketplace/plugins/git-forge/src/panel/index.tsx +0 -1
  195. package/marketplace/plugins/github-actions/package.json +2 -2
  196. package/marketplace/plugins/github-actions/src/app.tsx +2 -0
  197. package/marketplace/plugins/github-actions/src/panel/Actions.tsx +9 -17
  198. package/marketplace/plugins/github-actions/src/panel/LogView.tsx +4 -13
  199. package/marketplace/plugins/github-actions/src/panel/Row.tsx +4 -5
  200. package/marketplace/plugins/github-actions/src/panel/RunView.tsx +8 -15
  201. package/marketplace/plugins/github-actions/src/panel/index.test.tsx +3 -2
  202. package/marketplace/plugins/github-actions/src/panel/index.tsx +31 -37
  203. package/marketplace/plugins/kanban/package.json +2 -2
  204. package/marketplace/plugins/kanban/src/app.tsx +2 -0
  205. package/marketplace/plugins/kanban/src/panel/CardSheet.tsx +88 -98
  206. package/marketplace/plugins/kanban/src/panel/CardTile.tsx +6 -10
  207. package/marketplace/plugins/kanban/src/panel/StageColumn.tsx +22 -18
  208. package/marketplace/plugins/kanban/src/panel/StageSheet.tsx +59 -70
  209. package/marketplace/plugins/kanban/src/panel/index.tsx +37 -52
  210. package/marketplace/plugins/kanban/src/panel/use-board.ts +2 -0
  211. package/marketplace/plugins/session-info/package.json +2 -2
  212. package/marketplace/plugins/session-info/src/app.tsx +6 -3
  213. package/marketplace/plugins/stats/package.json +2 -2
  214. package/marketplace/plugins/stats/src/KillConfirm.test.tsx +6 -4
  215. package/marketplace/plugins/stats/src/KillConfirm.tsx +26 -76
  216. package/marketplace/plugins/stats/src/ProcessTable.tsx +8 -6
  217. package/marketplace/plugins/stats/src/RefreshButton.tsx +7 -5
  218. package/marketplace/plugins/stats/src/app.tsx +11 -9
  219. package/package.json +10 -10
  220. package/src/cli/lib/commands/plugin.js +8 -5
  221. package/src/client/bootstrap.d.ts +5 -0
  222. package/src/client/chat-title-overlay.test.ts +53 -0
  223. package/src/client/components/auth/login-screen/index.tsx +31 -3
  224. package/src/client/components/common/SignOutButton.tsx +4 -5
  225. package/src/client/components/common/account-badge/index.tsx +31 -0
  226. package/src/client/components/common/footer-version/index.tsx +40 -0
  227. package/src/client/components/common/fullscreen-viewer/fullscreen-viewer.test.tsx +24 -0
  228. package/src/client/components/common/fullscreen-viewer/index.tsx +22 -31
  229. package/src/client/components/common/header-controls/MoreMenu.tsx +5 -56
  230. package/src/client/components/common/header-controls/index.test.tsx +2 -6
  231. package/src/client/components/common/header-controls/index.tsx +9 -25
  232. package/src/client/components/common/header-controls/phone-row.test.tsx +3 -16
  233. package/src/client/components/common/shell-update-button/index.tsx +2 -2
  234. package/src/client/components/common/zoom-pan-stage/index.tsx +54 -50
  235. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +4 -5
  236. package/src/client/components/layout/desktop-layout/index.tsx +2 -4
  237. package/src/client/components/layout/left-bar/index.tsx +25 -3
  238. package/src/client/components/layout/rail-toggle.test.tsx +112 -0
  239. package/src/client/components/layout/session-sidebar/CategoryHeader.accent.test.tsx +81 -0
  240. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +11 -3
  241. package/src/client/components/layout/session-sidebar/Footer.test.tsx +36 -0
  242. package/src/client/components/layout/session-sidebar/Footer.tsx +42 -61
  243. package/src/client/components/layout/session-sidebar/FooterHost.tsx +5 -1
  244. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +30 -10
  245. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +4 -0
  246. package/src/client/components/layout/session-sidebar/modern/index.tsx +8 -1
  247. package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +25 -4
  248. package/src/client/components/layout/session-title-bar/index.tsx +13 -5
  249. package/src/client/components/layout/top-bars.test.tsx +4 -2
  250. package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
  251. package/src/client/components/mobile/RightSidebar.tsx +12 -3
  252. package/src/client/components/mobile/SessionSidebar.tsx +6 -2
  253. package/src/client/components/mobile/drawer-layout.test.tsx +7 -3
  254. package/src/client/components/mobile/drawer-strip.tsx +9 -2
  255. package/src/client/components/mobile/mobile-main-view/Header.test.tsx +29 -9
  256. package/src/client/components/mobile/mobile-main-view/Header.tsx +43 -12
  257. package/src/client/components/mobile/mobile-right-sidebar/Chrome.tsx +12 -1
  258. package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
  259. package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +1 -0
  260. package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +9 -1
  261. package/src/client/components/mobile/mobile-right-sidebar/StatusBar.tsx +4 -2
  262. package/src/client/components/mobile/mobile-session-sidebar/Body.tsx +1 -1
  263. package/src/client/components/mobile/mobile-session-sidebar/Footer.tsx +48 -46
  264. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +18 -1
  265. package/src/client/components/mobile/mobile-session-sidebar/Item.test.tsx +4 -0
  266. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +4 -6
  267. package/src/client/components/mobile/right-drawer-nav.test.tsx +53 -1
  268. package/src/client/components/settings/Band.tsx +5 -2
  269. package/src/client/components/settings/Modal.tsx +8 -5
  270. package/src/client/components/settings/Sidebar.tsx +5 -3
  271. package/src/client/components/settings/apply-side-effects.ts +5 -0
  272. package/src/client/components/settings/categories/AccountSettings.tsx +266 -0
  273. package/src/client/components/settings/categories/ProjectSettings.tsx +2 -0
  274. package/src/client/components/settings/categories/account-settings/Dialogs.tsx +223 -0
  275. package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.test.tsx +3 -4
  276. package/src/client/components/settings/categories/appearance-settings/ChromeStyleSection.tsx +66 -39
  277. package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +7 -4
  278. package/src/client/components/settings/categories/project-settings/DetailsForm.tsx +14 -1
  279. package/src/client/components/settings/categories/project-settings/ProjectSharing.tsx +130 -0
  280. package/src/client/components/settings/categories/project-settings/SidebarList.tsx +5 -0
  281. package/src/client/components/settings/category-content.tsx +3 -0
  282. package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +3 -1
  283. package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +2 -1
  284. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +3 -1
  285. package/src/client/components/workspace/chat-timeline/SessionSkeleton.tsx +1 -1
  286. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +1 -0
  287. package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +9 -2
  288. package/src/client/components/workspace/chat-timeline/chat-input/expansion.test.ts +1 -1
  289. package/src/client/components/workspace/chat-timeline/chat-input/expansion.ts +2 -1
  290. package/src/client/components/workspace/chat-timeline/chat-input/narrow.test.tsx +34 -0
  291. package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +9 -0
  292. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +4 -1
  293. package/src/client/components/workspace/editor/Tab.tsx +19 -26
  294. package/src/client/components/workspace/editor/Tabs.test.ts +13 -7
  295. package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +1 -0
  296. package/src/client/components/workspace/git-panel/commit-modal/floating.test.ts +46 -0
  297. package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -0
  298. package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +4 -5
  299. package/src/client/components/workspace/panel-tabs/TabChip.tsx +40 -37
  300. package/src/client/components/workspace/panel-tabs/TabStrip.connected.test.tsx +76 -49
  301. package/src/client/components/workspace/panel-tabs/TabStrip.test.tsx +9 -9
  302. package/src/client/components/workspace/panel-tabs/TabStrip.tsx +14 -1
  303. package/src/client/components/workspace/panel-tabs/index.tsx +1 -1
  304. package/src/client/components/workspace/plugin-panel/catalog.tsx +22 -5
  305. package/src/client/components/workspace/plugin-panel/chrome.test.tsx +89 -0
  306. package/src/client/components/workspace/plugin-panel/chrome.tsx +62 -0
  307. package/src/client/data/settings/omp-schema.json +40 -4
  308. package/src/client/floating-phone.test.ts +189 -0
  309. package/src/client/floating.css +205 -2
  310. package/src/client/floating.test.ts +43 -0
  311. package/src/client/glass.css +47 -0
  312. package/src/client/hooks/chat/omp/index.ts +6 -5
  313. package/src/client/hooks/chat/omp/prompt-send.test.ts +18 -0
  314. package/src/client/hooks/chat/omp/prompt-send.ts +26 -8
  315. package/src/client/hooks/chat/omp/session-list.tsx +20 -8
  316. package/src/client/hooks/chat/timeline/deferred-model.ts +13 -5
  317. package/src/client/hooks/chat/timeline/index.ts +2 -0
  318. package/src/client/hooks/chat/timeline/send-props.ts +14 -0
  319. package/src/client/hooks/chat/timeline/send-steer.test.ts +11 -2
  320. package/src/client/hooks/chat/timeline/send-switch.test.ts +92 -0
  321. package/src/client/hooks/chat/timeline/send.test-util.ts +37 -7
  322. package/src/client/hooks/chat/timeline/send.test.ts +11 -2
  323. package/src/client/hooks/chat/timeline/send.ts +62 -42
  324. package/src/client/hooks/editor/image-generation.ts +24 -0
  325. package/src/client/hooks/editor/resolve-viewer.test.ts +26 -20
  326. package/src/client/hooks/editor/resolve-viewer.ts +14 -5
  327. package/src/client/hooks/editor/use-file-editor.test.ts +34 -0
  328. package/src/client/hooks/editor/use-file-editor.ts +6 -2
  329. package/src/client/hooks/settings/accounts.ts +162 -0
  330. package/src/client/hooks/ui/auth.ts +58 -3
  331. package/src/client/hooks/ui/border-style.test.ts +5 -4
  332. package/src/client/hooks/ui/border-style.ts +3 -2
  333. package/src/client/hooks/ui/mobile-chrome-style.ts +68 -0
  334. package/src/client/hooks/ui/navbar-controls.test.ts +1 -2
  335. package/src/client/hooks/ui/navbar-controls.ts +0 -3
  336. package/src/client/hooks/ui/zoom-gesture.ts +104 -0
  337. package/src/client/lib/desktop/titlebar.test.ts +21 -0
  338. package/src/client/lib/desktop/titlebar.ts +34 -0
  339. package/src/client/lib/plugins/bootstrap.test.ts +20 -0
  340. package/src/client/lib/plugins/bootstrap.tsx +10 -15
  341. package/src/client/lib/plugins/kit-components.test.tsx +119 -0
  342. package/src/client/lib/plugins/kit-components.tsx +79 -0
  343. package/src/client/lib/plugins/kit.ts +8 -0
  344. package/src/client/lib/plugins/slots.test.ts +34 -0
  345. package/src/client/lib/plugins/slots.ts +31 -4
  346. package/src/client/lib/plugins/stylesheets.ts +10 -11
  347. package/src/client/lib/ui/pinch.test.ts +74 -0
  348. package/src/client/lib/ui/pinch.ts +104 -0
  349. package/src/client/lib/ui/safe-area.test.ts +25 -0
  350. package/src/client/lib/ui/safe-area.ts +23 -0
  351. package/src/client/main.tsx +8 -1
  352. package/src/client/tailwind.css +54 -1
  353. package/src/server/index.ts +2 -0
  354. package/src/server/lib/assets/shell-attributes.server.ts +12 -4
  355. package/src/server/lib/assets/shell-attributes.test.ts +19 -18
  356. package/src/server/lib/auth/client-address.test.ts +2 -2
  357. package/src/server/lib/auth/guard.test.ts +2 -2
  358. package/src/server/lib/auth/guard.ts +81 -97
  359. package/src/server/lib/auth/handover-guard.test.ts +1 -1
  360. package/src/server/lib/auth/rate-limit.test.ts +2 -2
  361. package/src/server/lib/auth/token.test.ts +1 -1
  362. package/src/server/lib/auth/workspace-gate.server.ts +34 -0
  363. package/src/server/lib/bundler/css.test.ts +16 -0
  364. package/src/server/lib/connect/devices.server.test.ts +12 -0
  365. package/src/server/lib/connect/devices.server.ts +63 -19
  366. package/src/server/lib/connect/pairing.server.ts +5 -3
  367. package/src/server/lib/connect/status.server.ts +2 -2
  368. package/src/server/lib/db/schema.test.ts +3 -3
  369. package/src/server/lib/db/schema.ts +6 -0
  370. package/src/server/lib/harness/update-spawn.server.test.ts +97 -0
  371. package/src/server/lib/harness/update-spawn.server.ts +10 -0
  372. package/src/server/lib/models/provider-icon-override.server.test.ts +140 -0
  373. package/src/server/lib/models/provider-icon-override.server.ts +197 -0
  374. package/src/server/lib/models/provider-icon-store.server.ts +8 -0
  375. package/src/server/lib/models/provider-icon.server.ts +31 -6
  376. package/src/server/lib/omp/session/artifacts.server.test.ts +11 -7
  377. package/src/server/lib/omp/session/artifacts.server.ts +21 -17
  378. package/src/server/lib/panels/build.server.ts +19 -2
  379. package/src/server/lib/panels/css.server.test.ts +141 -0
  380. package/src/server/lib/panels/css.server.ts +255 -0
  381. package/src/server/lib/panels/plugin-ui-contract.test.ts +64 -0
  382. package/src/server/lib/panels/registry-stylesheet.server.test.ts +69 -0
  383. package/src/server/lib/panels/scan.server.ts +13 -7
  384. package/src/server/lib/panels/source-warnings.server.test.ts +65 -0
  385. package/src/server/lib/panels/source-warnings.server.ts +71 -0
  386. package/src/server/lib/realtime/topics/catalog.server.ts +3 -0
  387. package/src/server/lib/realtime/topics.server.ts +14 -0
  388. package/src/server/lib/sessions/last-opened-client.server.ts +1 -1
  389. package/src/server/lib/workspace/access.server.ts +108 -0
  390. package/src/server/lib/workspace/project-patch.server.ts +4 -2
  391. package/src/server/lib/workspace/register-folder.server.ts +19 -5
  392. package/src/server/lib/workspace/session-access.server.ts +55 -0
  393. package/src/server/lib/workspace/tenancy-schema.server.ts +40 -0
  394. package/src/server/plugins/ssr.ts +19 -3
  395. package/src/server/routes/accounts/index.ts +8 -0
  396. package/src/server/routes/accounts/management.test.ts +174 -0
  397. package/src/server/routes/accounts/management.ts +166 -0
  398. package/src/server/routes/auth/login.ts +22 -8
  399. package/src/server/routes/auth/logout.ts +1 -1
  400. package/src/server/routes/auth/password.ts +40 -33
  401. package/src/server/routes/auth/revoke.test.ts +1 -1
  402. package/src/server/routes/auth/revoke.ts +26 -8
  403. package/src/server/routes/auth/routes.test.ts +3 -3
  404. package/src/server/routes/auth/state.ts +14 -7
  405. package/src/server/routes/connect/devices.ts +7 -4
  406. package/src/server/routes/connect/pair.ts +4 -3
  407. package/src/server/routes/connect/status.ts +4 -2
  408. package/src/server/routes/connect/tunnels.ts +2 -1
  409. package/src/server/routes/folders/batch-delete.ts +12 -0
  410. package/src/server/routes/folders/clone.ts +7 -2
  411. package/src/server/routes/folders/create.ts +3 -1
  412. package/src/server/routes/folders/folder.ts +44 -4
  413. package/src/server/routes/folders/index.ts +3 -0
  414. package/src/server/routes/folders/shares.ts +62 -0
  415. package/src/server/routes/index.ts +2 -0
  416. package/src/server/routes/panels/build.ts +1 -1
  417. package/src/server/routes/panels/css.test.ts +22 -0
  418. package/src/server/routes/panels/css.ts +5 -7
  419. package/src/server/routes/realtime/ws.ts +16 -1
  420. package/src/server/routes/sessions/list.ts +3 -2
  421. package/src/server/routes/settings/projects.ts +46 -7
  422. package/src/server/routes/settings/provider-icon.ts +18 -0
  423. package/src/shared/lib/chat/timeline/tool-render-mode.test.ts +2 -2
  424. package/src/shared/lib/chat/timeline/tool-render-mode.ts +6 -3
  425. package/src/shared/lib/icons/tint-hues.generated.ts +38 -37
  426. package/src/shared/lib/omp/config/schema-releases-19-4.test.ts +27 -1
  427. package/src/shared/lib/omp/session/prewarm-misc.test.ts +1 -1
  428. package/src/shared/lib/realtime/protocol.ts +16 -0
  429. package/src/shared/lib/settings/defaults.ts +2 -1
  430. package/src/shared/lib/settings/sections.ts +1 -1
  431. package/src/shared/lib/theme/border-style.test.ts +11 -9
  432. package/src/shared/lib/theme/border-style.ts +7 -7
  433. package/src/shared/lib/theme/chrome-style.test.ts +15 -0
  434. package/src/shared/lib/theme/chrome-style.ts +16 -1
  435. package/src/shared/types/index.ts +1 -0
  436. package/src/shared/types/settings/state.ts +6 -5
  437. package/src/test-support/file-editor.test-util.ts +25 -6
  438. package/tsconfig.json +21 -0
  439. package/dist/client/static/js/ImageView-xc90jc1c.js +0 -1
  440. package/dist/client/static/js/LayoutWrapper-wyqe98kf.js +0 -2
  441. package/dist/client/static/js/MergeDiffView-bng34cpr.js +0 -1
  442. package/dist/client/static/js/Modal-89jk7wff.js +0 -60
  443. package/dist/client/static/js/SessionsView-6bpz1faj.js +0 -1
  444. package/dist/client/static/js/architecture-7GRP2DOG-sxrkxwbq.js +0 -1
  445. package/dist/client/static/js/bash-bcbct9gc.js +0 -1
  446. package/dist/client/static/js/c-fn9jz26e.js +0 -1
  447. package/dist/client/static/js/cpp-a1q64mke.js +0 -1
  448. package/dist/client/static/js/css-b92azee8.js +0 -1
  449. package/dist/client/static/js/css-sn00sq6v.js +0 -1
  450. package/dist/client/static/js/cynefin-OW5HDTMX-g1xwa8b9.js +0 -1
  451. package/dist/client/static/js/eventmodeling-NTZA5JFV-05p61bka.js +0 -1
  452. package/dist/client/static/js/flowDiagram-KWPJA3E3-7sn6nwjv.js +0 -1
  453. package/dist/client/static/js/gitGraph-4MIJSDKK-z1yehwys.js +0 -1
  454. package/dist/client/static/js/graphql-8d8bn59j.js +0 -1
  455. package/dist/client/static/js/html-6hdrwtz2.js +0 -1
  456. package/dist/client/static/js/index-4h2zkrk1.js +0 -2
  457. package/dist/client/static/js/index-5nm8hm4k.js +0 -2
  458. package/dist/client/static/js/index-95jfphx5.js +0 -481
  459. package/dist/client/static/js/index-9pw441wc.js +0 -4
  460. package/dist/client/static/js/index-bjz54ht6.js +0 -1
  461. package/dist/client/static/js/index-bqapt2e8.js +0 -2
  462. package/dist/client/static/js/index-ddkjgv5h.js +0 -2
  463. package/dist/client/static/js/index-dekvtt2a.js +0 -314
  464. package/dist/client/static/js/index-fnwaxc6r.js +0 -1
  465. package/dist/client/static/js/index-h65zrhva.js +0 -1
  466. package/dist/client/static/js/index-hxsqw7sz.js +0 -4
  467. package/dist/client/static/js/index-hxy1sadd.js +0 -2
  468. package/dist/client/static/js/index-ja0ajnvq.js +0 -10
  469. package/dist/client/static/js/index-qkyy563e.js +0 -1
  470. package/dist/client/static/js/index-t6nqy2n5.css +0 -1
  471. package/dist/client/static/js/index-wrk99kks.js +0 -3
  472. package/dist/client/static/js/info-A6RAGUB7-dqyaxjc1.js +0 -1
  473. package/dist/client/static/js/ini-g6a5xsaw.js +0 -1
  474. package/dist/client/static/js/java-n596am4c.js +0 -1
  475. package/dist/client/static/js/javascript-zc1qnyyp.js +0 -1
  476. package/dist/client/static/js/json-7k70qbkj.js +0 -1
  477. package/dist/client/static/js/jsx-sndenqrc.js +0 -1
  478. package/dist/client/static/js/lua-djd3g9q5.js +0 -1
  479. package/dist/client/static/js/markdown-r2tpvxpn.js +0 -1
  480. package/dist/client/static/js/one-dark-pro-7bgqnyhm.js +0 -1
  481. package/dist/client/static/js/one-light-47y6etng.js +0 -1
  482. package/dist/client/static/js/packet-AYTQ26CC-7jxzax4z.js +0 -1
  483. package/dist/client/static/js/pie-WAS4IAKB-wc9wxr7f.js +0 -1
  484. package/dist/client/static/js/properties-brn72zdk.js +0 -1
  485. package/dist/client/static/js/python-g9mghwgm.js +0 -1
  486. package/dist/client/static/js/r-e247x4mw.js +0 -1
  487. package/dist/client/static/js/radar-RG4KPBEZ-kwj5padj.js +0 -1
  488. package/dist/client/static/js/railroad-74A4TZTK-h8sdx3w5.js +0 -1
  489. package/dist/client/static/js/railroad-abnf-HS5TGJTU-2wmwx246.js +0 -1
  490. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-h4cdgw3y.js +0 -1
  491. package/dist/client/static/js/railroad-peg-WCYAUIDC-q7m0tfd0.js +0 -1
  492. package/dist/client/static/js/sql-0kar81jy.js +0 -1
  493. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-y77g9dq0.js +0 -8
  494. package/dist/client/static/js/timeline-definition-EJHVYXUP-8a3yqmx0.js +0 -120
  495. package/dist/client/static/js/treeView-Q6P3EWNA-yv9640h3.js +0 -1
  496. package/dist/client/static/js/treemap-WGGIJYW6-7kpzjg21.js +0 -1
  497. package/dist/client/static/js/tsx-gjxfjnbk.js +0 -1
  498. package/dist/client/static/js/typescript-bm89v3gk.js +0 -1
  499. package/dist/client/static/js/vennDiagram-UO4OBE2U-gf4y1r3s.js +0 -34
  500. package/dist/client/static/js/wardley-WFR3VGLG-mggay64p.js +0 -1
  501. package/dist/client/static/js/xml-b7824nx0.js +0 -1
  502. package/dist/client/static/js/yaml-kqqktdv1.js +0 -1
  503. package/src/server/lib/auth/client-address.ts +0 -89
  504. package/src/server/lib/auth/config.ts +0 -133
  505. package/src/server/lib/auth/rate-limit.ts +0 -146
  506. package/src/server/lib/auth/token.ts +0 -220
@@ -1,9 +1,9 @@
1
- import{d,n,o,O,i,u,a,Lr,e,Mr,zo,sr,zm,Se,S,Gm,vA,vr,kr,s,lo,Ie,co,p,Yn,Ne,Q,E,At,f,I,le,ht,oe,fe,de,Xn,gn,In,L,D,Oa,G,$a,vn,h,Bt,it,$e,Od,Ri,X,ut,bt,$n,sn,yt,Dl,Ue,be,J}from"./index-95jfphx5.js";import{Pm,Rr}from"./index-2n2evsg0.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:m=!1,isGenerating:g=!1,suggestion:x=null,generated:v=!1,onToggleAmend:N,onChangeMessage:M,onCommit:w,onGenerate:C,onUseSuggestion:R,onDismissSuggestion:P}){let T=t.trim().length>0&&!c&&(r||l),k=(r||l)&&!c&&!g,b=r?"Rewrite the previous commit with this message":l?"Commit staged changes":"Stage changes first",y=g?"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:[x&&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:P,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:x})]}),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(Ne,{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&&m&&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:!k,title:y,"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:[g?e(p,{size:12,className:"animate-spin"}):e(Ne,{size:12}),g?"Generating…":"Generate"]}),e("button",{type:"button",onClick:w,disabled:!T,title:b,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 Qe({operation:t,conflicts:l,isBusy:c,onAbort:r,onContinue:m}){let g=zo[t],x=l.length,v=x===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(E,{size:13,className:"text-warning-text flex-shrink-0"}),e("span",{className:"font-medium",children:[g.charAt(0).toUpperCase()+g.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success-text":"text-warning-text"}`,children:v?"all conflicts resolved":`${x} conflict${x===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning-text 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 ${g} 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-text hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(vn,{size:12}),"Abort ",g]}),N&&e("button",{type:"button",onClick:m,disabled:c||!v,title:v?`Conclude the ${g}`:`Resolve all ${x} 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(Xn,{size:12}),"Continue ",g]})]})]})}function Ze({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:m,remoteBranches:g,onCheckout:x,onMerge:v,onOpenBranchPrompt:N,onManageBranches:M,optionsRef:w,showOptions:C,setShowOptions:R,onHistory:P,onGraph:T,viewMode:k,setViewMode:b,isBusy:y=!1,syncCount:A={ahead:0,behind:0},syncing:H=!1,onSync:_,onFetch:K,detached:B=!1}){let[V,Y]=n("");o(()=>{if(!l)Y("")},[l]);let U=V.trim(),z=u(()=>m.filter((F)=>sn(F,U)),[m,U]),j=u(()=>g.filter((F)=>sn(F,U)),[g,U]);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:B?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(de,{size:12,className:B?"text-warning-text":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${B?"font-mono text-warning-text":""}`,children:r}),e(I,{size:12,className:"text-ink/40"})]}),l&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-64 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[e($n,{value:V,onChange:Y,ariaLabel:"Search branches",placeholder:"Search branches…"}),e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[z.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),z.map((F)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{x(F),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:F}),r===F&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==F&&e("button",{type:"button",onClick:()=>{v(F),c(!1)},title:`Merge ${F} into ${r}`,"aria-label":`Merge ${F} 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(Xn,{size:12})})]},F))]}),j.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),j.map((F)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{x(F),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:F}),r===F&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==F&&e("button",{type:"button",onClick:()=>{v(F),c(!1)},title:`Merge ${F} into ${r}`,"aria-label":`Merge ${F} 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(Xn,{size:12})})]},F))]}),z.length===0&&j.length===0&&e("div",{className:"px-3 py-2 text-ink/40 italic",children:["No match for “",U,"”"]}),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(L,{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($a,{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:K,disabled:y,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(lo,{size:13})}),e("button",{type:"button",onClick:_,disabled:y,title:H?"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":H,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${H?"":"disabled:opacity-40"}`,children:[e(D,{size:13,className:H?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",A.ahead," ↓",A.behind]})]}),e("button",{type:"button",onClick:P,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Yn,{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(Xn,{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(Ie,{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:()=>{b("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"})]}),k==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{b("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"})]}),k==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Je({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:m,onSelectRepo:g,onRefresh:x,onRefreshRepos:v}){return e(Bt,{left:e(d,{children:[e(Pm,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(Rr,{rootPath:r,activeRepo:t,onSelectRepo:g,repos:l,scanning:m,onRefreshRepos:v})]}),right:e(it,{label:"Refresh",onClick:x,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let g=sr(t.status,l),{charStatus:x,colorClass:v}=g,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:x,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: ${g.label}`,children:x}),e(ut,{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(),m("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error-text hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("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(L,{size:11})})]}),l&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),m("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(gn,{size:11})})]})})]})}function et({change:t,repo:l,rootPath:c,onResolve:r}){let[m,g]=n(!1),[x,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 k=!m;if(g(k),k&&x===null){let b=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)b.set("root",c);try{let A=await(await fetch(`/api/fs/git?${b.toString()}`)).json();v(A.markers??{})}catch{v({})}}},P=x?.ours||"ours",T=x?.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(co,{size:11,className:"text-warning-text flex-shrink-0"}),e(ut,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning-text",title:t.file,children:M}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w}),Mr(t.status)&&e("span",{className:"text-[10px] text-warning-text font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),R()},title:m?"Hide resolve actions":"Show resolve actions","aria-label":m?"Hide resolve actions":"Show resolve actions","aria-expanded":m,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:m?e(ht,{size:11}):e(I,{size:11})})]}),m&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${P} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",P]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${T} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",T]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Wt(t){let l={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let m=r.file.replace(/^[./]+/,""),g=m.endsWith("/"),x=m.replace(/\/$/,"").split("/").filter(Boolean),v=l,N="";for(let M=0;M<x.length;M++){let w=x[M];N=N?`${N}/${w}`:w;let C=M===x.length-1;if(C&&!g)v.children.push({id:N,name:w,path:N,type:"file",change:r,children:[],changeCount:1});else{let P=v.children.find((T)=>T.type==="folder"&&T.name===w);if(!P)P={id:N,name:w,path:N,type:"folder",children:[],changeCount:0,change:C&&g?r:void 0},v.children.push(P);v=P}}}function c(r){if(r.type==="file")return 1;let m=r.change?1:0;for(let g of r.children)m+=c(g);return r.changeCount=m,r.children.sort((g,x)=>{if(g.type==="folder"&&x.type==="file")return-1;if(g.type==="file"&&x.type==="folder")return 1;return g.name.localeCompare(x.name)}),m}return c(l),l.children}function tt(t){let{sessionId:l,ready:c,read:r}=Gm(),m=u(()=>Wt(t),[t]),g=u(()=>{let R=new Set;function P(T){for(let k of T)if(k.type==="folder"){if(R.add(k.id),k.children&&k.children.length>0)P(k.children)}}return P(m),R},[m]),[x,v]=S("git.expandedFolders",[]),N=u(()=>new Set(x),[x]),M=i(null);o(()=>{if(!c||M.current===l)return;if(g.size===0)return;if(M.current=l,r("git.expandedFolders",[]).length>0)return;v(Array.from(g))},[c,l,g,r,v]);let w=a((R)=>{v((P)=>{let T=new Set(P);if(T.has(R))T.delete(R);else T.add(R);return Array.from(T)})},[v]),C=a((R)=>N.has(R),[N]);return{tree:m,expandedFolders:N,toggleFolder:w,isFolderOpen:C,expandAll:()=>v(Array.from(g)),collapseAll:()=>v([])}}function He({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:g,rootPath:x}){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(I,{size:12}):e(le,{size:12})}),e(ut,{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:(k)=>{k.stopPropagation(),m("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error-text hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("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(L,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("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(gn,{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((k)=>e(He,{node:k,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:g,rootPath:x},k.id))})]});let M=t.change,w=sr(M?.status||"M",l),{charStatus:C,colorClass:R}=w,P=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:P,staged:l,status:C,repo:g||".",root:x}}))},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(ut,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:P,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("revert",P)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error-text hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("stage",P)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(L,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),m("unstage",P)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(gn,{size:11})})})})]})}function ze({changes:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let{tree:g,isFolderOpen:x,toggleFolder:v}=tt(t);if(g.length===0)return null;return e("div",{className:"py-0.5",children:g.map((N)=>e(He,{node:N,isStaged:l,isFolderOpen:x,toggleFolder:v,onAction:m,repo:c,rootPath:r},N.id))})}function nt({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:m,onAction:g,onResolve:x}){let[v,N]=S("git.stagedExpanded",!0),[M,w]=S("git.unstagedExpanded",!0),[C,R]=S("git.conflictsExpanded",!0),P=t.filter((b)=>Mr(b.status)),T=t.filter((b)=>{if(Mr(b.status))return!1;let y=b.status;return y&&y[0]!==" "&&y[0]!=="?"}),k=t.filter((b)=>{if(Mr(b.status))return!1;let y=b.status;return y&&y[1]!==" "&&y[1]!=="?"||y==="??"});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:[P.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!C),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning-text text-xs",children:[e("span",{className:"w-3 text-center",children:C?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning-text font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:P.length})]})}),C&&P.map((b)=>e(et,{change:b,repo:r,rootPath:m,onResolve:x??(()=>{})},`conflict-${b.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:(b)=>{b.stopPropagation(),g("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(gn,{size:12})})})]}),v&&(c==="tree"?e(ze,{changes:T,isStaged:!0,repo:r,rootPath:m,onAction:g}):T.map((b)=>e(Fe,{change:b,isStaged:!0,repo:r,rootPath:m,onAction:g},b.file+"staged")))]}),k.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>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:k.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error-text hover:bg-error/10 cursor-pointer transition-colors",children:e(vn,{size:12})}),e("button",{type:"button",onClick:(b)=>{b.stopPropagation(),g("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(L,{size:12})})]})]}),M&&(c==="tree"?e(ze,{changes:k,isStaged:!1,repo:r,rootPath:m,onAction:g}):k.map((b)=>e(Fe,{change:b,isStaged:!1,repo:r,rootPath:m,onAction:g},b.file+"unstaged")))]})]})})}function ot({matches:t,loaded:l,total:c,hasMore:r,isFiltering:m}){if(m)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 st({isGraphMode:t,onToggleMode:l,searchQuery:c,onSearchChange:r,onRefresh:m,onClose:g,isRefreshing:x,totalCommits:v,loadedCount:N,totalCount:M,hasMore:w}){let C=ot({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(Yn,{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(Xn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:m,disabled:x,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(Oa,{size:13,className:x?"animate-spin text-ink":"","aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Refresh"})]}),e("button",{type:"button",onClick:g,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(h,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(G,{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(h,{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 m=c.findIndex((x)=>Oe(x,r.hash)||Oe(x,r.shortHash));if(m===-1)if(m=c.indexOf(null),m===-1)m=c.length,c.push(r.hash);else c[m]=r.hash;l.set(r.hash,m);let g=r.parents&&r.parents[0];if(g)c[m]=g;else c[m]=null;if(r.parents&&r.parents.length>1)for(let x=1;x<r.parents.length;x++){let v=r.parents[x];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 rt(t,l,c,r){let m=[],g=new Map;t.forEach((x,v)=>{if(g.set(x.hash,v),x.shortHash)g.set(x.shortHash,v);if(x.hash.length>=7)g.set(x.hash.substring(0,7),v)});for(let x of t){let v=l.get(x.hash)??0,N=c[x.hash]??0,M=ce[v%ce.length];if(!x.parents||x.parents.length===0)continue;for(let w of x.parents){let C=g.get(w);if(typeof C!=="number"&&w.length>=7)C=g.get(w.substring(0,7));if(typeof C==="number"){let R=t[C],P=l.get(R.hash)??v,T=c[R.hash]??N+60;m.push({fromHash:x.hash,toHash:R.hash,fromLane:v,toLane:P,fromY:N,toY:T,color:ce[v%ce.length]})}else m.push({fromHash:x.hash,toHash:"tail-"+x.hash,fromLane:v,toLane:v,fromY:N,toY:Math.max(N+80,r),color:M})}}return m}function at(t,l,c,r){if(Math.abs(t-c)<1)return`M ${t} ${l} L ${c} ${r}`;let m=r-l,g=l+m*0.45,x=r-m*0.45;return`M ${t} ${l} C ${t} ${g}, ${c} ${x}, ${c} ${r}`}function lt({commits:t,nodePositions:l,expandedHash:c,hoveredHash:r,isGraphMode:m,laneWidth:g=18,paddingLeft:x=16,totalHeight:v}){let N=u(()=>{if(!m){let R=new Map;return t.forEach((P)=>R.set(P.hash,0)),R}return Re(t)},[t,m]),M=u(()=>{let R=0;return N.forEach((P)=>{if(P>R)R=P}),R},[N]),w=m?(M+1)*g+x*2:36,C=u(()=>{if(!m){let R=[];for(let P=0;P<t.length-1;P++){let T=l[t[P].hash]??P*60+20,k=l[t[P+1].hash]??(P+1)*60+20;R.push({fromHash:t[P].hash,toHash:t[P+1].hash,fromLane:0,toLane:0,fromY:T,toY:k,color:"var(--theme-ink)"})}return R}return rt(t,N,l,v)},[t,N,l,v,m]);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 P=m?x+R.fromLane*g:16,T=m?x+R.toLane*g:16,k=m?R.color:"currentColor",b=m?0.95:0.25,y=at(P,R.fromY,T,R.toY);return e("path",{d:y,fill:"none",stroke:k,strokeWidth:m?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:b},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let P=N.get(R.hash)??0,T=m?x+P*g:16,k=l[R.hash]??20,b=c===R.hash||c===R.shortHash,y=r===R.hash||r===R.shortHash,A=m?ce[P%ce.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(b||y)&&e("circle",{cx:T,cy:k,r:8,fill:A,fillOpacity:b?0.35:0.2,stroke:A,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:T,cy:k,r:m?4:4.5,fill:m?"var(--theme-paper)":A,stroke:A,strokeWidth:m?2.5:1.5}),m&&e("circle",{cx:T,cy:k,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 ct({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:(m)=>{m.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 m=r-c;if(m>Ge*2+1){for(let g=c;g<c+Ge;g+=1)l.push({row:t[g],index:g});l.push({row:{type:"elided",count:m-Ge*2},index:-1});for(let g=r-Ge;g<r;g+=1)l.push({row:t[g],index:g})}else for(let g=c;g<r;g+=1)l.push({row:t[g],index:g});c=r-1}return l}function dt({diffText:t,isLoading:l,filePath:c,fullContext:r=!1,onToggleContext:m}){let g=Ri(),x=u(()=>{if(!t)return[];let w=[],C=1,R=1,P=t.split(/\r?\n/),k=P.some((b)=>b.startsWith("@@"))?P:[`@@ -0,0 +1,${P.length} @@`,...P.map((b)=>b.startsWith("+")||b.startsWith("-")?b:`+${b}`)];for(let b of k){if(b.startsWith("diff --git")||b.startsWith("index ")||b.startsWith("---")||b.startsWith("+++")||b.startsWith("new file mode")||b.startsWith("deleted file mode")||b.startsWith("similarity index")||b.startsWith("old mode")||b.startsWith("new mode")||b.startsWith("\\ No newline"))continue;if(b.startsWith("@@")){let y=b.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(y)C=parseInt(y[1],10),R=parseInt(y[2],10);w.push({type:"meta",text:b})}else if(b.startsWith("+"))w.push({type:"add",text:b.slice(1),newNum:R++});else if(b.startsWith("-"))w.push({type:"del",text:b.slice(1),oldNum:C++});else{let y=b.startsWith(" ")?b.slice(1):b;w.push({type:"context",text:y,oldNum:C++,newNum:R++})}}return w},[t]),v=yt(c),N=u(()=>{let w=Array(x.length).fill(""),C=-1,R=(P)=>{if(C<0)return;let T=Od(x.slice(C,P).map((k)=>k.text).join(`
3
- `),v);for(let k=C;k<P;k++)w[k]=T[k-C]??"";C=-1};return x.forEach((P,T)=>{if(P.type==="meta")R(T);else if(C<0)C=T}),R(x.length),w},[x,v,g]),M=u(()=>r?x.map((w,C)=>({row:w,index:C})):Kt(x),[x,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||x.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:m,disabled:!m,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(ht,{size:12,"aria-hidden":"true"})," Collapse context"]}):e(d,{children:[e(I,{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 P=w,T=C;if(P.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-muted text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:P.text})]},T);let k=P.type==="add",b=P.type==="del";return e("div",{className:`flex items-start font-mono ${k?"bg-success/10 hover:bg-success/15":b?"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 ${b?"bg-error/15 text-ink/80 font-semibold":k?"bg-success/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:P.oldNum??(k?"+":"")}),e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${k?"bg-success/15 text-ink/80 font-semibold":b?"bg-error/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:P.newNum??(b?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${k||b?"text-ink/80":"opacity-0"}`,children:k?"+":b?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:P.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:N[T]}}):" "})]},T)})})})]})}function mt({commit:t,isExpanded:l,onToggleExpand:c,onAction:r,onToggleFile:m,isExpandedFile:g,isLoadingFile:x,isFullContextFile:v,onToggleContext:N,fileDiffs:M,headerRef:w}){let[C,R]=n(!1),P=t.body?.trim()??"",T=P.length>0,k=t.files??[],b=k.length,y=b>0,A=T||y,H=(B)=>{B.stopPropagation(),navigator.clipboard.writeText(t.hash),R(!0),setTimeout(()=>R(!1),2000)},_=(B,V)=>{B.stopPropagation(),m(t.hash,V)},K=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:K,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((B,V)=>{let Y=B.includes("stash"),U=B.includes("HEAD")||B.includes("main")||B.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${Y?"bg-warning/10 text-ink/80 border-warning/25 font-semibold":U?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-muted border-ink/10 font-medium"}`,children:B},V)})}),e("div",{ref:w,className:"flex items-start gap-1.5",children:e("button",{type:"button",onClick:A?(B)=>{B.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(I,{size:13}):e(le,{size:13})})]})}),T&&l&&e("div",{className:"border-l-2 border-ink/15 pl-3 py-1",children:e(J,{content:P,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:H,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(oe,{size:11,"aria-hidden":"true"})]}),y&&e("span",{children:[b," ",b===1?"file":"files"]})]})]}),l&&e("div",{className:"mt-2",children:e(ct,{commit:t,onAction:r})}),y&&l&&e("div",{className:"mt-2 flex flex-col gap-1",children:k.map((B,V)=>{let Y=g(t.hash,B.file),U=`${t.hash}:${B.file}`,z=M[U]!==void 0?M[U]:B.diff,j=x(t.hash,B.file),F=B.status==="A"?"text-success-text font-bold":B.status==="D"?"text-error-text font-bold":B.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:(se)=>_(se,B),"aria-expanded":Y,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] ${F}`,children:B.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:B.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:["+",B.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error-text",children:["-",B.deletions]})]}),e("span",{className:"text-ink/55 group-hover:text-ink flex-shrink-0",children:Y?e(I,{size:13,"aria-hidden":"true"}):e(le,{size:13,"aria-hidden":"true"})})]}),Y&&e("div",{className:"pl-4 pr-1",children:e(dt,{diffText:z,isLoading:j,filePath:B.file,fullContext:v(t.hash,B.file),onToggleContext:()=>N(t.hash,B)})})]},V)})})]})})}var ge=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 _e(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c,m=typeof r.hash==="string"&&r.hash?r.hash:"";if(!m)continue;l.push({hash:m,shortHash:typeof r.shortHash==="string"&&r.shortHash?r.shortHash:m.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((g)=>typeof g==="string"):[],refs:Array.isArray(r.refs)?r.refs.filter((g)=>typeof g==="string"):[],files:Vt(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return l}function pt({output:t,isGraphMode:l,rootPath:c,activeRepo:r}){let[m,g]=n(!1),[x,v]=n(t?.hasMore??t?.data?.length===ge),[N,M]=n(t?.total),w=u(()=>_e(t?.data),[t?.data]),C=Array.isArray(t?.data)?t.data.length:0,[R,P]=n(w),[T,k]=n(C);o(()=>{if(P(w),k(C),v(t?.hasMore??C===ge),typeof t?.total==="number")M(t.total)},[w,C,t?.hasMore,t?.total]);let b=a(async()=>{if(m||!x)return;g(!0);try{let y=new FormData;if(y.set("actionType",l?"graph":"history"),y.set("limit",String(ge)),y.set("skip",String(T)),c)y.set("root",c);if(r)y.set("repo",r);let H=await(await fetch("/api/fs/git",{method:"POST",body:y})).json();if(H.success&&Array.isArray(H.data)){let _=_e(H.data),K=H.data.length;if(P((B)=>{let V=new Set(B.map((U)=>U.hash)),Y=_.filter((U)=>!V.has(U.hash));return[...B,...Y]}),k((B)=>B+K),v(Boolean(H.hasMore??K===ge)),typeof H.total==="number")M(H.total)}else v(!1)}catch(y){console.error("Failed to load more commits:",y)}finally{g(!1)}},[m,x,l,T,c,r]);return{commits:R,hasMore:x,totalCount:N,isLoadingMore:m,handleLoadMore:b}}function ft({onExecuteAction:t,rootPath:l,activeRepo:c}){let[r,m]=n({}),[g,x]=n(new Set),[v,N]=n(new Set),[M,w]=n(new Set),C=a(async(k,b,y)=>{let A=`${k}:${b.file}`;N((H)=>new Set(H).add(A));try{let H=new FormData;if(H.set("actionType","commit_diff"),H.set("hash",k),H.set("file",b.file),y)H.set("full","1");if(l)H.set("root",l);if(c&&c!==".")H.set("repo",c);let K=await(await fetch("/api/fs/git",{method:"POST",body:H})).json();if(K&&typeof K.diff==="string")m((B)=>({...B,[A]:K.diff}));else if(K&&K.error)m((B)=>({...B,[A]:`// Error: ${K.error}`}))}catch(H){console.error("Failed to load file diff:",H);let _=H instanceof Error?H.message:"Network error";m((K)=>({...K,[A]:`// Error loading diff: ${_}`}))}finally{N((H)=>{let _=new Set(H);return _.delete(A),_})}},[l,c]),R=a(async(k,b)=>{let y=`${k}:${b.file}`,A=!g.has(y);if(x((H)=>{let _=new Set(H);if(_.has(y))_.delete(y);else _.add(y);return _}),A&&r[y]===void 0&&!b.diff)await C(k,b,!1)},[g,r,C]),P=a(async(k,b)=>{let y=`${k}:${b.file}`,A=!M.has(y);w((H)=>{let _=new Set(H);if(_.has(y))_.delete(y);else _.add(y);return _}),await C(k,b,A)},[M,C]),T=a((k,b)=>{if(!t)return;if(k==="checkout")t("checkout",void 0,{branch:b.hash});else if(k==="create_branch_here"){let y=window.prompt(`Create new branch at commit ${b.shortHash}:`,`branch-${b.shortHash}`);if(y?.trim())t("create_branch_at",void 0,{branch:y.trim(),hash:b.hash})}else if(k==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${b.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:b.hash})}else if(k==="revert"){if(window.confirm(`Revert commit ${b.shortHash}?`))t("revert_commit",void 0,{hash:b.hash})}else if(k==="reset"){let y=window.prompt(`Reset current branch to ${b.shortHash} (soft, mixed, hard):`,"soft");if(y&&["soft","mixed","hard"].includes(y.toLowerCase()))t("reset_commit",void 0,{hash:b.hash,mode:y.toLowerCase()})}else if(k==="merge"){if(window.confirm(`Merge commit ${b.shortHash} into current branch?`))t("merge_commit",void 0,{hash:b.hash})}else if(k==="rebase"){if(window.confirm(`Rebase current branch onto commit ${b.shortHash}?`))t("rebase_commit",void 0,{hash:b.hash})}},[t]);return{fileDiffs:r,expandedFiles:g,loadingFiles:v,fullContextFiles:M,handleToggleFile:R,handleToggleContext:P,handleCommitAction:T}}function gt(t){let[l,c]=n({page:t,hash:""}),r=l.page===t?l.hash:"",m=a((g)=>{c((x)=>{let v=x.page===t&&x.hash===g;return{page:t,hash:v?"":g}})},[t]);return{expandedHash:r,toggleExpanded:m}}function je({output:t,onClose:l,onRefresh:c,onExecuteAction:r,rootPath:m,activeRepo:g}){if(o(()=>{if(!t)return;let W=(q)=>{if(q.key==="Escape")l()};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[t,l]),!t)return null;let[x,v]=n(()=>({title:t.title,graph:t.title.toLowerCase().includes("graph")}));if(x.title!==t.title)v({title:t.title,graph:t.title.toLowerCase().includes("graph")});let N=x.graph,M=(W)=>v((q)=>({...q,graph:W})),[w,C]=n(""),{expandedHash:R,toggleExpanded:P}=gt(t),[T,k]=n(!1),{commits:b,hasMore:y,totalCount:A,isLoadingMore:H,handleLoadMore:_}=pt({output:t,isGraphMode:N,rootPath:m,activeRepo:g}),{fileDiffs:K,expandedFiles:B,loadingFiles:V,fullContextFiles:Y,handleToggleFile:U,handleToggleContext:z,handleCommitAction:j}=ft({onExecuteAction:r,rootPath:m,activeRepo:g}),F=u(()=>{if(!w.trim())return b;let W=w.toLowerCase().trim();return b.filter((q)=>q.message.toLowerCase().includes(W)||q.author.toLowerCase().includes(W)||q.shortHash.toLowerCase().includes(W)||q.hash.toLowerCase().includes(W)||q.refs?.some((ne)=>ne.toLowerCase().includes(W)))},[b,w]),se=i(null),re=i(null),xe=i(null),pe=i({}),[ue,ve]=n({}),[Pe,Me]=n(800);o(()=>{let W=xe.current;if(!W||!y||H||w.trim())return;let q=new IntersectionObserver((ne)=>{if(ne[0].isIntersecting)_()},{root:se.current,threshold:0.1});return q.observe(W),()=>q.disconnect()},[y,H,w,_]);let ie=a(()=>{if(!se.current||!re.current)return;let W=se.current.getBoundingClientRect(),q=se.current.scrollTop,ne={};F.forEach((he,Ee)=>{let Ce=pe.current[he.hash];if(Ce){let me=Ce.getBoundingClientRect();ne[he.hash]=me.top+me.height/2-W.top+q}else ne[he.hash]=Ee*60+20}),ve(ne);let De=re.current.offsetHeight;Me(Math.max(De,se.current.clientHeight,600))},[F]);O(()=>{ie();let W=requestAnimationFrame(()=>{ie()});return()=>cancelAnimationFrame(W)},[ie,F,K,B,N,R]),o(()=>{let W=re.current;if(!W)return;let q=new ResizeObserver(()=>{ie()});q.observe(W);for(let ne of Array.from(W.children))q.observe(ne);return()=>q.disconnect()},[ie,F]);let ee=u(()=>Re(F),[F]),Te=u(()=>{let W=0;return ee.forEach((q)=>{if(q>W)W=q}),W},[ee]),ke=18,ye=16,Le=N?(Te+1)*ke+ye*2:36,Ae=()=>{k(!0),c?.(),setTimeout(()=>k(!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,O,i,u,a,Ye,e,Pr,Ho,lr,Wm,Se,S,Vm,TA,kr,wr,s,po,Ie,mo,p,Vn,Ne,Q,E,ht,f,I,le,bt,ie,fe,de,Zn,gn,_n,R,D,Ga,G,Ha,xn,A,It,st,ze,jd,$i,J,dt,yt,nr,An,vt,Gi,Le,ge,X}from"./index-j734ev6q.js";import{Hm,Fr}from"./index-kv1xnem9.js";var Ut={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(Ut);var Wt={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"}]]},Xe=s(Wt);function Qe({message:t,hasStagedChanges:l,isBusy:c=!1,amend:r=!1,seeded:m=!1,isGenerating:h=!1,suggestion:g=null,generated:b=!1,onToggleAmend:C,onChangeMessage:M,onCommit:N,onGenerate:y,onUseSuggestion:w,onDismissSuggestion:P}){let T=t.trim().length>0&&!c&&(r||l),v=(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:w,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:P,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:(L)=>M(L.currentTarget.value),onKeyDown:(L)=>{if(L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&T)L.preventDefault(),N()},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"}),b&&t.trim().length>0&&e("div",{className:"flex items-center gap-1 text-[10px] text-ink/40",children:[e(Ne,{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:(L)=>C?.(L.currentTarget.checked),className:`${ge} accent-ink cursor-pointer`}),"Amend"]}),r&&m&&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:y,disabled:!v,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(p,{size:12,className:"animate-spin"}):e(Ne,{size:12}),h?"Generating…":"Generate"]}),e("button",{type:"button",onClick:N,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:m}){let h=Ho[t],g=l.length,b=g===0,C=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(E,{size:13,className:"text-warning-text 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] ${b?"text-success-text":"text-warning-text"}`,children:b?"all conflicts resolved":`${g} conflict${g===1?"":"s"} left`})]}),!b&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning-text 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-text hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(xn,{size:12}),"Abort ",h]}),C&&e("button",{type:"button",onClick:m,disabled:c||!b,title:b?`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(Zn,{size:12}),"Continue ",h]})]})]})}function Je({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:m,remoteBranches:h,onCheckout:g,onMerge:b,onOpenBranchPrompt:C,onManageBranches:M,optionsRef:N,showOptions:y,setShowOptions:w,onHistory:P,onGraph:T,viewMode:v,setViewMode:x,isBusy:k=!1,syncCount:L={ahead:0,behind:0},syncing:H=!1,onSync:_,onFetch:K,detached:B=!1}){let[V,Y]=n("");o(()=>{if(!l)Y("")},[l]);let U=V.trim(),z=u(()=>m.filter((F)=>An(F,U)),[m,U]),j=u(()=>h.filter((F)=>An(F,U)),[h,U]);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:B?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(de,{size:12,className:B?"text-warning-text":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${B?"font-mono text-warning-text":""}`,children:r}),e(I,{size:12,className:"text-ink/40"})]}),l&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-64 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[e(nr,{value:V,onChange:Y,ariaLabel:"Search branches",placeholder:"Search branches…"}),e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[z.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),z.map((F)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(F),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:F}),r===F&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==F&&e("button",{type:"button",onClick:()=>{b(F),c(!1)},title:`Merge ${F} into ${r}`,"aria-label":`Merge ${F} 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(Zn,{size:12})})]},F))]}),j.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),j.map((F)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(F),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:F}),r===F&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==F&&e("button",{type:"button",onClick:()=>{b(F),c(!1)},title:`Merge ${F} into ${r}`,"aria-label":`Merge ${F} 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(Zn,{size:12})})]},F))]}),z.length===0&&j.length===0&&e("div",{className:"px-3 py-2 text-ink/40 italic",children:["No match for “",U,"”"]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{C(),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(R,{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(Ha,{size:12}),e("span",{children:"Manage branches..."})]})]})]})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:N,children:[e("button",{type:"button",onClick:K,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(po,{size:13})}),e("button",{type:"button",onClick:_,disabled:k,title:H?"Syncing with upstream…":L.ahead>0&&L.behind>0?`Pull ${L.behind} then push ${L.ahead} commit(s)`:L.ahead>0?`Push ${L.ahead} commit(s)`:L.behind>0?`Pull ${L.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":H,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${H?"":"disabled:opacity-40"}`,children:[e(D,{size:13,className:H?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",L.ahead," ↓",L.behind]})]}),e("button",{type:"button",onClick:P,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Vn,{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(Zn,{size:13})}),e("button",{type:"button",onClick:()=>w(!y),title:"View Options","aria-label":"View Options","aria-expanded":y,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Ie,{size:13})}),y&&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"),w(!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(Xe,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),v==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{x("tree"),w(!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"})]}),v==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function et({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:m,onSelectRepo:h,onRefresh:g,onRefreshRepos:b}){return e(It,{left:e(d,{children:[e(Hm,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(Fr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:l,scanning:m,onRefreshRepos:b})]}),right:e(st,{label:"Refresh",onClick:g,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let h=lr(t.status,l),{charStatus:g,colorClass:b}=h,C=t.file.split("/"),M=C.pop()||t.file,N=C.length>0?C.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 ${b}`,title:`Status: ${h.label}`,children:g}),e(dt,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${b}`,title:t.file,children:M}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!l&&e(d,{children:[e("button",{type:"button",onClick:(w)=>{w.stopPropagation(),m("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error-text hover:bg-error/10 cursor-pointer transition-colors",children:e(xn,{size:11})}),e("button",{type:"button",onClick:(w)=>{w.stopPropagation(),m("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(R,{size:11})})]}),l&&e("button",{type:"button",onClick:(w)=>{w.stopPropagation(),m("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(gn,{size:11})})]})})]})}function tt({change:t,repo:l,rootPath:c,onResolve:r}){let[m,h]=n(!1),[g,b]=n(null),C=t.file.split("/"),M=C.pop()||t.file,N=C.length>0?C.join("/"):"",y=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:l,root:c}}))},w=async()=>{let v=!m;if(h(v),v&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)x.set("root",c);try{let L=await(await fetch(`/api/fs/git?${x.toString()}`)).json();b(L.markers??{})}catch{b({})}}},P=g?.ours||"ours",T=g?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:y,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(mo,{size:11,className:"text-warning-text flex-shrink-0"}),e(dt,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning-text",title:t.file,children:M}),N&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:N}),Pr(t.status)&&e("span",{className:"text-[10px] text-warning-text font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(v)=>{v.stopPropagation(),w()},title:m?"Hide resolve actions":"Show resolve actions","aria-label":m?"Hide resolve actions":"Show resolve actions","aria-expanded":m,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:m?e(bt,{size:11}):e(I,{size:11})})]}),m&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${P} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",P]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${T} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",T]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function qt(t){let l={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let m=r.file.replace(/^[./]+/,""),h=m.endsWith("/"),g=m.replace(/\/$/,"").split("/").filter(Boolean),b=l,C="";for(let M=0;M<g.length;M++){let N=g[M];C=C?`${C}/${N}`:N;let y=M===g.length-1;if(y&&!h)b.children.push({id:C,name:N,path:C,type:"file",change:r,children:[],changeCount:1});else{let P=b.children.find((T)=>T.type==="folder"&&T.name===N);if(!P)P={id:C,name:N,path:C,type:"folder",children:[],changeCount:0,change:y&&h?r:void 0},b.children.push(P);b=P}}}function c(r){if(r.type==="file")return 1;let m=r.change?1:0;for(let h of r.children)m+=c(h);return r.changeCount=m,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)}),m}return c(l),l.children}function nt(t){let{sessionId:l,ready:c,read:r}=Vm(),m=u(()=>qt(t),[t]),h=u(()=>{let w=new Set;function P(T){for(let v of T)if(v.type==="folder"){if(w.add(v.id),v.children&&v.children.length>0)P(v.children)}}return P(m),w},[m]),[g,b]=S("git.expandedFolders",[]),C=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;b(Array.from(h))},[c,l,h,r,b]);let N=a((w)=>{b((P)=>{let T=new Set(P);if(T.has(w))T.delete(w);else T.add(w);return Array.from(T)})},[b]),y=a((w)=>C.has(w),[C]);return{tree:m,expandedFolders:C,toggleFolder:N,isFolderOpen:y,expandAll:()=>b(Array.from(h)),collapseAll:()=>b([])}}function He({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:h,rootPath:g}){let b=t.type==="folder",C=b?c(t.id):!1;if(b)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:C?e(I,{size:12}):e(le,{size:12})}),e(dt,{name:t.name,isFolder:!0,isOpen:C,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:(v)=>{v.stopPropagation(),m("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error-text hover:bg-error/10 cursor-pointer transition-colors",children:e(xn,{size:11})}),e("button",{type:"button",onClick:(v)=>{v.stopPropagation(),m("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(R,{size:11})})]}):e("button",{type:"button",onClick:(v)=>{v.stopPropagation(),m("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(gn,{size:11})})})})]}),C&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((v)=>e(He,{node:v,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:m,repo:h,rootPath:g},v.id))})]});let M=t.change,N=lr(M?.status||"M",l),{charStatus:y,colorClass:w}=N,P=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:P,staged:l,status:y,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] ${w}`,title:`Status: ${N.label}`,children:y})}),e(dt,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${w}`,title:P,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(v)=>{v.stopPropagation(),m("revert",P)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error-text hover:bg-error/10 cursor-pointer transition-colors",children:e(xn,{size:11})}),e("button",{type:"button",onClick:(v)=>{v.stopPropagation(),m("stage",P)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(R,{size:11})})]}):e("button",{type:"button",onClick:(v)=>{v.stopPropagation(),m("unstage",P)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(gn,{size:11})})})})]})}function Oe({changes:t,isStaged:l,repo:c,rootPath:r,onAction:m}){let{tree:h,isFolderOpen:g,toggleFolder:b}=nt(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((C)=>e(He,{node:C,isStaged:l,isFolderOpen:g,toggleFolder:b,onAction:m,repo:c,rootPath:r},C.id))})}function ot({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:m,onAction:h,onResolve:g}){let[b,C]=S("git.stagedExpanded",!0),[M,N]=S("git.unstagedExpanded",!0),[y,w]=S("git.conflictsExpanded",!0),P=t.filter((x)=>Pr(x.status)),T=t.filter((x)=>{if(Pr(x.status))return!1;let k=x.status;return k&&k[0]!==" "&&k[0]!=="?"}),v=t.filter((x)=>{if(Pr(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:[P.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>w(!y),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning-text text-xs",children:[e("span",{className:"w-3 text-center",children:y?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning-text font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:P.length})]})}),y&&P.map((x)=>e(tt,{change:x,repo:r,rootPath:m,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:()=>C(!b),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:b?"▾":"▸"}),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(gn,{size:12})})})]}),b&&(c==="tree"?e(Oe,{changes:T,isStaged:!0,repo:r,rootPath:m,onAction:h}):T.map((x)=>e(Fe,{change:x,isStaged:!0,repo:r,rootPath:m,onAction:h},x.file+"staged")))]}),v.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!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:v.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-text hover:bg-error/10 cursor-pointer transition-colors",children:e(xn,{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(R,{size:12})})]})]}),M&&(c==="tree"?e(Oe,{changes:v,isStaged:!1,repo:r,rootPath:m,onAction:h}):v.map((x)=>e(Fe,{change:x,isStaged:!1,repo:r,rootPath:m,onAction:h},x.file+"unstaged")))]})]})})}function rt({matches:t,loaded:l,total:c,hasMore:r,isFiltering:m}){if(m)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:m,onClose:h,isRefreshing:g,totalCommits:b,loadedCount:C,totalCount:M,hasMore:N}){let y=rt({matches:b,loaded:C,total:M,hasMore:N,isFiltering:c.trim().length>0});return e("div",{"data-mobile-history-header":"",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:y})]}),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(Vn,{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(Zn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:m,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(Ga,{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(A,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(G,{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:(w)=>r(w.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(A,{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 m=c.findIndex((g)=>_e(g,r.hash)||_e(g,r.shortHash));if(m===-1)if(m=c.indexOf(null),m===-1)m=c.length,c.push(r.hash);else c[m]=r.hash;l.set(r.hash,m);let h=r.parents&&r.parents[0];if(h)c[m]=h;else c[m]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let b=r.parents[g];if(!c.some((M)=>_e(M,b))){let M=c.indexOf(null);if(M===-1)c.push(b);else c[M]=b}}}return l}function at(t,l,c,r){let m=[],h=new Map;t.forEach((g,b)=>{if(h.set(g.hash,b),g.shortHash)h.set(g.shortHash,b);if(g.hash.length>=7)h.set(g.hash.substring(0,7),b)});for(let g of t){let b=l.get(g.hash)??0,C=c[g.hash]??0,M=ce[b%ce.length];if(!g.parents||g.parents.length===0)continue;for(let N of g.parents){let y=h.get(N);if(typeof y!=="number"&&N.length>=7)y=h.get(N.substring(0,7));if(typeof y==="number"){let w=t[y],P=l.get(w.hash)??b,T=c[w.hash]??C+60;m.push({fromHash:g.hash,toHash:w.hash,fromLane:b,toLane:P,fromY:C,toY:T,color:ce[b%ce.length]})}else m.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:b,toLane:b,fromY:C,toY:Math.max(C+80,r),color:M})}}return m}function lt(t,l,c,r){if(Math.abs(t-c)<1)return`M ${t} ${l} L ${c} ${r}`;let m=r-l,h=l+m*0.45,g=r-m*0.45;return`M ${t} ${l} C ${t} ${h}, ${c} ${g}, ${c} ${r}`}function ct({commits:t,nodePositions:l,expandedHash:c,hoveredHash:r,isGraphMode:m,laneWidth:h=18,paddingLeft:g=16,totalHeight:b}){let C=u(()=>{if(!m){let w=new Map;return t.forEach((P)=>w.set(P.hash,0)),w}return Re(t)},[t,m]),M=u(()=>{let w=0;return C.forEach((P)=>{if(P>w)w=P}),w},[C]),N=m?(M+1)*h+g*2:36,y=u(()=>{if(!m){let w=[];for(let P=0;P<t.length-1;P++){let T=l[t[P].hash]??P*60+20,v=l[t[P+1].hash]??(P+1)*60+20;w.push({fromHash:t[P].hash,toHash:t[P+1].hash,fromLane:0,toLane:0,fromY:T,toY:v,color:"var(--theme-ink)"})}return w}return at(t,C,l,b)},[t,C,l,b,m]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:N,height:b},"aria-hidden":"true",children:e("svg",{className:"w-full h-full overflow-visible",style:{width:N,height:b},children:[y.map((w)=>{let P=m?g+w.fromLane*h:16,T=m?g+w.toLane*h:16,v=m?w.color:"currentColor",x=m?0.95:0.25,k=lt(P,w.fromY,T,w.toY);return e("path",{d:k,fill:"none",stroke:v,strokeWidth:m?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${w.fromHash}->${w.toHash}`)}),t.map((w)=>{let P=C.get(w.hash)??0,T=m?g+P*h:16,v=l[w.hash]??20,x=c===w.hash||c===w.shortHash,k=r===w.hash||r===w.shortHash,L=m?ce[P%ce.length]:"var(--theme-success)";return e("g",{"data-commit-node":w.hash,children:[(x||k)&&e("circle",{cx:T,cy:v,r:8,fill:L,fillOpacity:x?0.35:0.2,stroke:L,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:T,cy:v,r:m?4:4.5,fill:m?"var(--theme-paper)":L,stroke:L,strokeWidth:m?2.5:1.5}),m&&e("circle",{cx:T,cy:v,r:1.8,fill:L})]},`node-${w.hash}`)})]})})}var Kt=[{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:Kt.map(({action:c,label:r})=>e("button",{type:"button",onClick:(m)=>{m.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 Vt(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 m=r-c;if(m>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:m-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 pt({diffText:t,isLoading:l,filePath:c,fullContext:r=!1,onToggleContext:m}){let h=$i(),g=u(()=>{if(!t)return[];let N=[],y=1,w=1,P=t.split(/\r?\n/),v=P.some((x)=>x.startsWith("@@"))?P:[`@@ -0,0 +1,${P.length} @@`,...P.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of v){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)y=parseInt(k[1],10),w=parseInt(k[2],10);N.push({type:"meta",text:x})}else if(x.startsWith("+"))N.push({type:"add",text:x.slice(1),newNum:w++});else if(x.startsWith("-"))N.push({type:"del",text:x.slice(1),oldNum:y++});else{let k=x.startsWith(" ")?x.slice(1):x;N.push({type:"context",text:k,oldNum:y++,newNum:w++})}}return N},[t]),b=vt(c),C=u(()=>{let N=Array(g.length).fill(""),y=-1,w=(P)=>{if(y<0)return;let T=jd(g.slice(y,P).map((v)=>v.text).join(`
3
+ `),b);for(let v=y;v<P;v++)N[v]=T[v-y]??"";y=-1};return g.forEach((P,T)=>{if(P.type==="meta")w(T);else if(y<0)y=T}),w(g.length),N},[g,b,h]),M=u(()=>r?g.map((N,y)=>({row:N,index:y})):Vt(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:m,disabled:!m,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(bt,{size:12,"aria-hidden":"true"})," Collapse context"]}):e(d,{children:[e(I,{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:N,index:y},w)=>{if(N.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-muted text-[10px] text-center select-none",title:`${N.count} unchanged line(s) hidden`,children:["⋯ ",N.count," unchanged line",N.count===1?"":"s"," hidden ⋯"]},`elided-${w}`);let P=N,T=y;if(P.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-muted text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:P.text})]},T);let v=P.type==="add",x=P.type==="del";return e("div",{className:`flex items-start font-mono ${v?"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":v?"bg-success/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:P.oldNum??(v?"+":"")}),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 ${v?"bg-success/15 text-ink/80 font-semibold":x?"bg-error/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:P.newNum??(x?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${v||x?"text-ink/80":"opacity-0"}`,children:v?"+":x?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:P.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:C[T]}}):" "})]},T)})})})]})}function ut({commit:t,isExpanded:l,onToggleExpand:c,onAction:r,onToggleFile:m,isExpandedFile:h,isLoadingFile:g,isFullContextFile:b,onToggleContext:C,fileDiffs:M,headerRef:N}){let[y,w]=n(!1),P=t.body?.trim()??"",T=P.length>0,v=t.files??[],x=v.length,k=x>0,L=T||k,H=(B)=>{B.stopPropagation(),navigator.clipboard.writeText(t.hash),w(!0),setTimeout(()=>w(!1),2000)},_=(B,V)=>{B.stopPropagation(),m(t.hash,V)},K=L?"border-b border-ink/5 transition-colors cursor-pointer hover:bg-ink/[0.015]":"border-b border-ink/5";return e("div",{onClick:L?c:void 0,"data-testid":"commit-row","data-commit-hash":t.hash,className:K,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((B,V)=>{let Y=B.includes("stash"),U=B.includes("HEAD")||B.includes("main")||B.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${Y?"bg-warning/10 text-ink/80 border-warning/25 font-semibold":U?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-muted border-ink/10 font-medium"}`,children:B},V)})}),e("div",{ref:N,className:"flex items-start gap-1.5",children:e("button",{type:"button",onClick:L?(B)=>{B.stopPropagation(),c()}:void 0,"aria-expanded":L?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}),L&&e("span",{className:"text-ink/55 flex-shrink-0 mt-0.5","aria-hidden":"true",children:l?e(I,{size:13}):e(le,{size:13})})]})}),T&&l&&e("div",{className:"border-l-2 border-ink/15 pl-3 py-1",children:e(X,{content:P,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:H,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}),y?e(f,{size:11,className:"text-success-text","aria-hidden":"true"}):e(ie,{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:v.map((B,V)=>{let Y=h(t.hash,B.file),U=`${t.hash}:${B.file}`,z=M[U]!==void 0?M[U]:B.diff,j=g(t.hash,B.file),F=B.status==="A"?"text-success-text font-bold":B.status==="D"?"text-error-text font-bold":B.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)=>_(oe,B),"aria-expanded":Y,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] ${F}`,children:B.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:B.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:["+",B.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error-text",children:["-",B.deletions]})]}),e("span",{className:"text-ink/55 group-hover:text-ink flex-shrink-0",children:Y?e(I,{size:13,"aria-hidden":"true"}):e(le,{size:13,"aria-hidden":"true"})})]}),Y&&e("div",{className:"pl-4 pr-1",children:e(pt,{diffText:z,isLoading:j,filePath:B.file,fullContext:b(t.hash,B.file),onToggleContext:()=>C(t.hash,B)})})]},V)})})]})})}var xe=50;function Yt(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,m=typeof r.hash==="string"&&r.hash?r.hash:"";if(!m)continue;l.push({hash:m,shortHash:typeof r.shortHash==="string"&&r.shortHash?r.shortHash:m.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:Yt(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return l}function ft({output:t,isGraphMode:l,rootPath:c,activeRepo:r}){let[m,h]=n(!1),[g,b]=n(t?.hasMore??t?.data?.length===xe),[C,M]=n(t?.total),N=u(()=>je(t?.data),[t?.data]),y=Array.isArray(t?.data)?t.data.length:0,[w,P]=n(N),[T,v]=n(y);o(()=>{if(P(N),v(y),b(t?.hasMore??y===xe),typeof t?.total==="number")M(t.total)},[N,y,t?.hasMore,t?.total]);let x=a(async()=>{if(m||!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 H=await(await fetch("/api/fs/git",{method:"POST",body:k})).json();if(H.success&&Array.isArray(H.data)){let _=je(H.data),K=H.data.length;if(P((B)=>{let V=new Set(B.map((U)=>U.hash)),Y=_.filter((U)=>!V.has(U.hash));return[...B,...Y]}),v((B)=>B+K),b(Boolean(H.hasMore??K===xe)),typeof H.total==="number")M(H.total)}else b(!1)}catch(k){console.error("Failed to load more commits:",k)}finally{h(!1)}},[m,g,l,T,c,r]);return{commits:w,hasMore:g,totalCount:C,isLoadingMore:m,handleLoadMore:x}}function gt({onExecuteAction:t,rootPath:l,activeRepo:c}){let[r,m]=n({}),[h,g]=n(new Set),[b,C]=n(new Set),[M,N]=n(new Set),y=a(async(v,x,k)=>{let L=`${v}:${x.file}`;C((H)=>new Set(H).add(L));try{let H=new FormData;if(H.set("actionType","commit_diff"),H.set("hash",v),H.set("file",x.file),k)H.set("full","1");if(l)H.set("root",l);if(c&&c!==".")H.set("repo",c);let K=await(await fetch("/api/fs/git",{method:"POST",body:H})).json();if(K&&typeof K.diff==="string")m((B)=>({...B,[L]:K.diff}));else if(K&&K.error)m((B)=>({...B,[L]:`// Error: ${K.error}`}))}catch(H){console.error("Failed to load file diff:",H);let _=H instanceof Error?H.message:"Network error";m((K)=>({...K,[L]:`// Error loading diff: ${_}`}))}finally{C((H)=>{let _=new Set(H);return _.delete(L),_})}},[l,c]),w=a(async(v,x)=>{let k=`${v}:${x.file}`,L=!h.has(k);if(g((H)=>{let _=new Set(H);if(_.has(k))_.delete(k);else _.add(k);return _}),L&&r[k]===void 0&&!x.diff)await y(v,x,!1)},[h,r,y]),P=a(async(v,x)=>{let k=`${v}:${x.file}`,L=!M.has(k);N((H)=>{let _=new Set(H);if(_.has(k))_.delete(k);else _.add(k);return _}),await y(v,x,L)},[M,y]),T=a((v,x)=>{if(!t)return;if(v==="checkout")t("checkout",void 0,{branch:x.hash});else if(v==="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(v==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${x.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:x.hash})}else if(v==="revert"){if(window.confirm(`Revert commit ${x.shortHash}?`))t("revert_commit",void 0,{hash:x.hash})}else if(v==="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(v==="merge"){if(window.confirm(`Merge commit ${x.shortHash} into current branch?`))t("merge_commit",void 0,{hash:x.hash})}else if(v==="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:b,fullContextFiles:M,handleToggleFile:w,handleToggleContext:P,handleCommitAction:T}}function xt(t){let[l,c]=n({page:t,hash:""}),r=l.page===t?l.hash:"",m=a((h)=>{c((g)=>{let b=g.page===t&&g.hash===h;return{page:t,hash:b?"":h}})},[t]);return{expandedHash:r,toggleExpanded:m}}function Ue({output:t,onClose:l,onRefresh:c,onExecuteAction:r,rootPath:m,activeRepo:h}){if(o(()=>{if(!t)return;let W=(q)=>{if(q.key==="Escape")l()};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[t,l]),!t)return null;let[g,b]=n(()=>({title:t.title,graph:t.title.toLowerCase().includes("graph")}));if(g.title!==t.title)b({title:t.title,graph:t.title.toLowerCase().includes("graph")});let C=g.graph,M=(W)=>b((q)=>({...q,graph:W})),[N,y]=n(""),{expandedHash:w,toggleExpanded:P}=xt(t),[T,v]=n(!1),{commits:x,hasMore:k,totalCount:L,isLoadingMore:H,handleLoadMore:_}=ft({output:t,isGraphMode:C,rootPath:m,activeRepo:h}),{fileDiffs:K,expandedFiles:B,loadingFiles:V,fullContextFiles:Y,handleToggleFile:U,handleToggleContext:z,handleCommitAction:j}=gt({onExecuteAction:r,rootPath:m,activeRepo:h}),F=u(()=>{if(!N.trim())return x;let W=N.toLowerCase().trim();return x.filter((q)=>q.message.toLowerCase().includes(W)||q.author.toLowerCase().includes(W)||q.shortHash.toLowerCase().includes(W)||q.hash.toLowerCase().includes(W)||q.refs?.some((ne)=>ne.toLowerCase().includes(W)))},[x,N]),oe=i(null),se=i(null),be=i(null),pe=i({}),[ue,ve]=n({}),[Pe,$e]=n(800);o(()=>{let W=be.current;if(!W||!k||H||N.trim())return;let q=new IntersectionObserver((ne)=>{if(ne[0].isIntersecting)_()},{root:oe.current,threshold:0.1});return q.observe(W),()=>q.disconnect()},[k,H,N,_]);let re=a(()=>{if(!oe.current||!se.current)return;let W=oe.current.getBoundingClientRect(),q=oe.current.scrollTop,ne={};F.forEach((he,Ee)=>{let Ce=pe.current[he.hash];if(Ce){let me=Ce.getBoundingClientRect();ne[he.hash]=me.top+me.height/2-W.top+q}else ne[he.hash]=Ee*60+20}),ve(ne);let De=se.current.offsetHeight;$e(Math.max(De,oe.current.clientHeight,600))},[F]);O(()=>{re();let W=requestAnimationFrame(()=>{re()});return()=>cancelAnimationFrame(W)},[re,F,K,B,C,w]),o(()=>{let W=se.current;if(!W)return;let q=new ResizeObserver(()=>{re()});q.observe(W);for(let ne of Array.from(W.children))q.observe(ne);return()=>q.disconnect()},[re,F]);let ee=u(()=>Re(F),[F]),Me=u(()=>{let W=0;return ee.forEach((q)=>{if(q>W)W=q}),W},[ee]),ke=18,ye=16,Te=C?(Me+1)*ke+ye*2:36,Ae=()=>{v(!0),c?.(),setTimeout(()=>v(!1),600)};return e("div",{"data-mobile-history":"",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",{"data-mobile-history-card":"",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:(W)=>W.stopPropagation(),children:[e(st,{isGraphMode:N,onToggleMode:M,searchQuery:w,onSearchChange:C,onRefresh:Ae,onClose:l,isRefreshing:T,totalCommits:F.length,loadedCount:b.length,totalCount:A,hasMore:y}),e("div",{ref:se,className:`flex-1 overflow-y-auto scrollbar-overlay-container relative select-text
6
+ pt-[env(safe-area-inset-top,0px)] lg:pt-0`,onClick:(W)=>W.stopPropagation(),children:[e(it,{isGraphMode:C,onToggleMode:M,searchQuery:N,onSearchChange:y,onRefresh:Ae,onClose:l,isRefreshing:T,totalCommits:F.length,loadedCount:x.length,totalCount:L,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:F.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(lt,{commits:F,nodePositions:ue,expandedHash:R,isGraphMode:N,laneWidth:ke,paddingLeft:ye,totalHeight:Pe}),e("div",{ref:re,className:"flex flex-col relative z-20",style:{paddingLeft:`${Le}px`},children:[F.map((W)=>e(mt,{commit:W,isExpanded:R===W.hash,onToggleExpand:()=>P(W.hash),onAction:j,onToggleFile:U,isExpandedFile:(q,ne)=>B.has(`${q}:${ne}`),isLoadingFile:(q,ne)=>V.has(`${q}:${ne}`),isFullContextFile:(q,ne)=>Y.has(`${q}:${ne}`),onToggleContext:z,fileDiffs:K,headerRef:(q)=>{pe.current[W.hash]=q}},W.hash)),e("div",{ref:xe,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:H?e("div",{className:"flex items-center gap-2 text-xs text-muted font-mono py-2",children:[e(p,{size:14,className:"animate-spin text-info-text","aria-hidden":"true"}),e("span",{children:"Loading more commits..."})]}):y&&!w.trim()?e("button",{type:"button",onClick:_,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..."}):F.length>10?e("div",{className:"text-[11px] font-mono text-muted py-2",children:["End of commit history (",typeof A==="number"&&A>0?A:b.length," commits)"]}):null})]})]})})]})})}function xt({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 vt({modal:t,onClose:l,onConfirm:c}){if(!t)return null;return e(xt,{onClose:l,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(E,{size:16,className:"text-error-text 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 kt({isOpen:t,branchName:l,inputRef:c,onChange:r,onClose:m,onCreate:g}){if(!t)return null;let x=a(()=>{if(l.trim())g()},[l,g]);return e(xt,{onClose:m,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Xn,{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")x();if(v.key==="Escape")m()},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:m,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:x,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 Ct({branch:t,detached:l,onCheckout:c,onMerge:r,onRename:m,onDelete:g}){let x=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:x&&e(f,{size:12,className:"text-ink","aria-label":"Current branch"})}),e("button",{type:"button",onClick:c,disabled:x,title:x?"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(de,{size:11,className:x?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${x?"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:[!x&&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(Xn,{size:11})}),e("button",{type:"button",onClick:m,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(In,{size:11})}),!x&&e("button",{type:"button",onClick:g,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-text hover:bg-error/10 cursor-pointer transition-colors",children:e(Q,{size:11})})]})]})}function Yt({branch:t}){if(t.gone)return e("span",{className:"text-[10px] font-mono text-warning-text 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 Nt({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,m]=n(t.name),[g,x]=n(!1),v=r.trim(),N=v===t.name,M=v.length>0&&!N,w=()=>{if(M)c(t.name,v,g)};return e(X,{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)=>m(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:g,onChange:(C)=>x(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 wt({branch:t,force:l,onForceChange:c,onClose:r,onConfirm:m}){if(!t)return null;return e(X,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(E,{size:15,className:"text-error-text 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:(g)=>c(g.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-text 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:()=>m(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 Rt({isOpen:t,rootPath:l,repo:c,currentBranch:r,detached:m,isBusy:g,onClose:x,onAction:v,onConfirmDelete:N}){let[M,w]=n([]),[C,R]=n(!1),[P,T]=n(null),[k,b]=n(""),[y,A]=n(null),[H,_]=n(null),[K,B]=n(!1),V=a(async()=>{R(!0),T(null);let z=new URLSearchParams({branches:"1",repo:c||"."});if(l)z.set("root",l);try{let j=await fetch(`/api/fs/git?${z.toString()}`),F=await j.json();if(F.success&&Array.isArray(F.branches))w(F.branches);else T(F.error||`Failed to read branches (HTTP ${j.status})`)}catch(j){T(j instanceof Error?j.message:"Failed to read branches")}finally{R(!1)}},[l,c]);o(()=>{if(t)V()},[t,V]);let Y=i(!1);o(()=>{if(!t){Y.current=!1;return}if(Y.current&&!g)V();Y.current=g},[t,g,V]),o(()=>{if(!t)A(null),_(null),B(!1),b("")},[t]);let U=u(()=>{let z=k.trim().toLowerCase();if(!z)return M;return M.filter((j)=>j.name.toLowerCase().includes(z)||j.upstream.toLowerCase().includes(z))},[M,k]);if(!t)return null;return e(d,{children:[e(X,{onClose:x,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:m?`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(G,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:k,onChange:(z)=>b(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 V(),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(p,{size:14,className:"animate-spin text-info-text"}),"Loading branches…"]}):P?e("div",{className:"py-12 px-6 text-center text-xs text-error-text font-mono",children:P}):U.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:k.trim()?"No matching branches.":"No branches."}):U.map((z)=>e(Ct,{branch:z,detached:m,onCheckout:()=>{v("checkout",{branch:z.name}),x()},onMerge:()=>{v("merge_branch",{branch:z.name}),x()},onRename:()=>A(z),onDelete:()=>{_(z),B(!1)}},z.name))})]}),e(Nt,{branch:y,onClose:()=>A(null),onSubmit:(z,j,F)=>{v("rename_branch",{branch:z,newName:j,...F?{remote:"1"}:{}}),A(null)}},y?.name??"none"),e(wt,{branch:H,force:K,onForceChange:B,onClose:()=>{_(null),B(!1)},onConfirm:(z)=>{N(z,K),_(null),B(!1)}})]})}function Gt({mounted:t,confirmModal:l,onCloseConfirm:c,onConfirm:r,branchPrompt:m,newBranchName:g,newBranchInputRef:x,onNewBranchNameChange:v,onCloseBranchPrompt:N,onCreateBranch:M,viewingOutput:w,onCloseOutput:C,onRefreshOutput:R,onExecuteAction:P,branchModalOpen:T,onCloseBranchModal:k,rootPath:b,activeRepo:y,currentBranch:A,detached:H,isBusy:_,onBranchAction:K,onConfirmDeleteBranch:B}){if(!t)return null;return e(d,{children:[e(vt,{modal:l,onClose:c,onConfirm:r}),e(kt,{isOpen:m,branchName:g,inputRef:x,onChange:v,onClose:N,onCreate:M}),e(je,{output:w,onClose:C,onRefresh:R,onExecuteAction:P,rootPath:b,activeRepo:y}),e(Rt,{isOpen:T,rootPath:b,repo:y,currentBranch:A,detached:H,isBusy:_,onClose:k,onAction:K,onConfirmDelete:B})]})}function St({rootPath:t,repo:l,isBusy:c,onAction:r}){let[m,g]=S("git.stashExpanded",!1),[x,v]=n([]),[N,M]=n(!1),[w,C]=n(""),[R,P]=n(!1),T=Lr(),k=a(async()=>{M(!0);let y=new URLSearchParams({stashes:"1",repo:l||"."});if(t)y.set("root",t);try{let H=await(await fetch(`/api/fs/git?${y.toString()}`)).json();v(H.stashes??[])}catch{v([])}finally{M(!1)}},[t,l]);o(()=>{if(m)k()},[m,k,c]);let b=(y,A)=>{if(r(y,A),y==="stash_push")C(""),P(!1)};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:[e("button",{type:"button",onClick:()=>g(!m),"aria-expanded":m,"aria-controls":T,title:m?"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:m?"▾":"▸"}),e(At,{size:12}),e("span",{children:"Stash"}),x.length>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:x.length})]}),e("button",{type:"button",onClick:()=>b("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(L,{size:10}),"Save"]})]}),e("div",{className:"section-reveal","data-expanded":m,id:T,inert:!m,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:(y)=>C(y.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:(y)=>P(y.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"-u"]})]}),N&&x.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"Loading…"}):x.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:x.map((y)=>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:y.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:y.subject,children:y.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:y.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:()=>b("stash_apply",{ref:y.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:()=>b("stash_apply",{ref:y.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:()=>b("stash_drop",{ref:y.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-text hover:bg-error/10 cursor-pointer transition-colors disabled:opacity-40",children:e(Q,{size:10})})]})]},y.ref))})]})})})]})}function Pt({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(de,{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(de,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function $t(t,l,c){let r=bt(),{pickedRepo:m,setActiveRepo:g,ready:x}=vr(t),{repos:v,scanning:N,rescan:M}=kr(t,l),w=vA(m,v),C=i(w);C.current=w;let R=i("");R.current=`${t??""}\x00${w}`;let P=i(""),T=i(""),k=i(void 0);if(r.data!==k.current)k.current=r.data,T.current=P.current;let b=l&&x?zm(`${t??""}\x00${w}`):null,y=Se(b),A=i(y.refresh);A.current=y.refresh;let H=T.current===R.current?r.data:void 0,_=y.data??H,K=_?.syncCount??H?.syncCount,B=a((U)=>{if(!l)return;let z=U??C.current,j=new URLSearchParams;if(t)j.set("root",t);if(z)j.set("repo",z);j.set("sync","1"),j.set("t",String(Date.now())),P.current=R.current;let F=A.current;r.load(`/api/fs/git?${j.toString()}`).then(()=>F())},[l,t,r.load]);o(()=>{if(!x)return;B()},[c,t,l,x,w,B]);let V=r.state==="loading",Y=V||y.refreshing;return{activeRepo:w,setActiveRepo:g,repos:v,reposScanning:N,refreshRepos:M,isReading:V,isRefreshing:Y,data:_,syncCount:K,loadRepo:B,refreshTopic:y.refresh}}function Mt(t,l){let c=bt(),r=i(null),m=a((g,x,v)=>{r.current={actionType:g,extra:v};let N=new FormData;if(N.append("actionType",g),N.append("repo",l),t)N.append("root",t);if(x)N.append("file",x);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:m,data:c.data,lastAction:r.current}}function Tt({rootPath:t,repo:l,execute:c}){let{sessionId:r}=Gm(),[m,g]=S("git.commitDraft",""),[x,v]=S("git.amend",!1),[N,M]=n(!1),[w,C]=n(null),[R,P]=n(!1),T=i(!1),k=i(null),b=i(m);b.current=m;let y=i(x);y.current=x;let A=i(g);A.current=g;let H=a((U)=>{g(U),P(!1)},[g]),_=a(()=>{if(T.current)return;T.current=!0,M(!0),C(null);let U={...t?{root:t}:{},repo:l,...r?{sessionId:r}:{},...y.current?{amend:!0}:{}};fetch("/api/fs/git-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)}).then(async(z)=>{let j=await z.json().catch(()=>null);if(!z.ok||typeof j?.message!=="string"||!j.message.trim())throw Error(typeof j?.error==="string"?j.error:`Request failed (HTTP ${z.status})`);let F=j.message.trim();if(b.current.trim().length===0)A.current(F),P(!0);else C(F)}).catch((z)=>{Dl(z instanceof Error?z.message:String(z),"error")}).finally(()=>{T.current=!1,M(!1)})},[t,l,r]),K=a(()=>{if(w===null)return;g(w),P(!0),C(null)},[w,g]),B=a(()=>C(null),[]);o(()=>{if(!x)return;if(b.current.trim().length>0)return;let U=new URLSearchParams({headMessage:"1"});if(t)U.set("root",t);if(l)U.set("repo",l);let z=!1;return fetch(`/api/fs/git?${U.toString()}`).then((j)=>j.json()).then((j)=>{if(z)return;if(!y.current||b.current.trim().length>0)return;let F=typeof j?.message==="string"?j.message:"";if(F.length===0)return;k.current=F,A.current(F)}).catch(()=>{}),()=>{z=!0}},[x,r,t,l]);let V=a((U)=>{if(U){v(!0);return}if(k.current!==null&&b.current===k.current)g("");k.current=null,v(!1)},[v,g]),Y=a(()=>{c("commit",void 0,{message:b.current,...y.current?{amend:"1"}:{}}),g(""),v(!1),k.current=null,C(null),P(!1)},[c,v,g]);return{message:m,setMessage:H,amend:x,seeded:k.current!==null&&m===k.current,toggleAmend:V,commit:Y,isGenerating:N,suggestion:w,generated:R,generate:_,useSuggestion:K,dismissSuggestion:B}}var Lt=48;function Qt(t,l){let c=l?.branch?.trim()??"",r=(l?.hash??"").slice(0,7),m=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 g=(l?.message??"").split(`
9
- `)[0].trim();if(!g)return{done:"Commit created"};return{done:`Committed “${g.length>Lt?`${g.slice(0,Lt-1)}…`:g}”`}}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 g=l?.newName?.trim()??"";return{done:c&&g?`Renamed ${c} to ${g}`:"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 g=l?.mode??"mixed";return{done:r?`Reset to ${r} (${g})`:`Reset (${g})`}}case"stash_push":return{done:"Stashed your changes"};case"stash_apply":return{done:l?.pop==="1"?`Popped ${m}`:`Applied ${m}`,stopped:l?.pop==="1"?`Popping ${m}`:`Applying ${m}`};case"stash_drop":return{done:`Dropped ${m}`};default:return null}}function Dt({actionType:t,extra:l,stopped:c}){let r=Qt(t,l);if(!c)return r?.done??null;let m=zo[c]??c,g=r?.stopped??r?.done??"",x=t==="sync"?"resolve it above, then Sync again":"resolve it above";return g?`${g} — the ${m} stopped on a conflict; ${x}`:`The ${m} stopped on a conflict; ${x}`}function Et(t){let{fetcher:l,onPage:c,onReload:r,onSuccess:m,onError:g}=t,x=i(null),v=i({onPage:c,onReload:r,onSuccess:m,onError:g});v.current={onPage:c,onReload:r,onSuccess:m,onError:g},o(()=>{if(l.state!=="idle"||!l.data)return;let N=l.data;if(N===x.current)return;x.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?Dt({...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 m=r?zo[r]:"operation";return{type:t,message:`Abort the ${m}? Everything resolved so far is discarded and the working tree returns to its pre-${m} state.`}}if(t==="delete_branch"){let m=c?.branch??"",g=c?.force==="1";return{type:t,extra:{branch:m,...g?{force:"1"}:{}},message:g?`Delete branch ${m} even though its commits are not merged? This cannot be undone from the panel.`:`Delete branch ${m}?`}}if(t==="stash_drop"){let m=c?.ref||"the top entry";return{type:t,extra:{ref:c?.ref??""},message:`Drop ${m}? The stash entry is removed — this cannot be undone from the panel.`}}return null}function Ar({className:t="",enabled:l=!0,rootPath:c,refreshKey:r=0}){let{activeRepo:m,setActiveRepo:g,repos:x,reposScanning:v,refreshRepos:N,isReading:M,isRefreshing:w,data:C,syncCount:R,loadRepo:P,refreshTopic:T}=$t(c,l,r),k=Mt(c,m),[b,y]=S("git.viewMode","flat"),[A,H]=n(!1),_=i(null),[K,B]=n(!1),V=i(null),[Y,U]=n(null),[z,j]=n(!1),[F,se]=n(""),re=i(null),[xe,pe]=n(!1),[ue,ve]=n(null),[Pe,Me]=n(!1),{pushToast:ie}=Ue();o(()=>{Me(!0)},[]),o(()=>{if(z&&re.current)re.current.focus()},[z]),Et({fetcher:k,onPage:ve,onReload:P,onSuccess:(Z,te)=>ie(Z,te),onError:(Z)=>ie(Z,"error")}),$e(_,()=>H(!1)),$e(V,()=>B(!1));let ee=k.execute,{message:Te,setMessage:ke,amend:ye,seeded:Le,toggleAmend:Ae,commit:W,isGenerating:q,suggestion:ne,generated:De,generate:he,useSuggestion:Ee,dismissSuggestion:Ce}=Tt({rootPath:c,repo:m,execute:ee}),me=(Z,te,we)=>{let Ke=Ft(Z,te,we,C?.state?.operation??null);if(Ke){U(Ke);return}ee(Z,te,we)},Ht=(Z,te)=>{ee("resolve_conflict",Z,te?{side:te}:void 0)},We=C?.branch||"main",zt=C?.branches||["main"],Ot=C?.remoteBranches||[],qe=C?.changes||[],ae=M||k.state!=="idle",Be=k.state==="idle"?null:k.lastAction?.actionType??null,It=Be==="sync"||Be==="push"||Be==="pull",_t=qe.filter((Z)=>{if(Mr(Z.status))return!1;let te=Z.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(Gt,{mounted:Pe,confirmModal:Y,onCloseConfirm:()=>U(null),onConfirm:()=>{if(Y)ee(Y.type,Y.file,Y.extra),U(null)},branchPrompt:z,newBranchName:F,newBranchInputRef:re,onNewBranchNameChange:se,onCloseBranchPrompt:()=>{j(!1),se("")},onCreateBranch:()=>{if(F.trim())ee("create_branch",void 0,{branch:F.trim()}),j(!1),se("")},viewingOutput:ue,onCloseOutput:()=>ve(null),onRefreshOutput:()=>{if(ue)ee(ue.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(Z,te,we)=>ee(Z,te,we),branchModalOpen:xe,onCloseBranchModal:()=>pe(!1),rootPath:c,activeRepo:m,currentBranch:We,detached:C?.state?.detached??!1,isBusy:ae,onBranchAction:(Z,te)=>ee(Z,void 0,te),onConfirmDeleteBranch:(Z,te)=>{ee("delete_branch",void 0,{branch:Z,...te?{force:"1"}:{}})}}),e(Je,{activeRepo:m,repos:x,isRefreshing:w,rootPath:c,reposScanning:v,onSelectRepo:(Z)=>{g(Z)},onRefresh:()=>{T(),P()},onRefreshRepos:N}),C?.isRepo===!1?e(Pt,{repo:m,isBusy:ae,onInit:()=>ee("init")}):e(d,{children:[e(Ze,{branchRef:V,showBranchMenu:K,setShowBranchMenu:B,branch:We,branches:zt,remoteBranches:Ot,onCheckout:(Z)=>ee("checkout",void 0,{branch:Z}),onMerge:(Z)=>ee("merge_branch",void 0,{branch:Z}),onOpenBranchPrompt:()=>j(!0),onManageBranches:()=>{pe(!0),B(!1)},optionsRef:_,showOptions:A,setShowOptions:H,onHistory:()=>ee("history"),onGraph:()=>ee("graph"),viewMode:b,setViewMode:y,isBusy:ae,syncCount:R,syncing:It,onSync:()=>ee("sync"),onFetch:()=>ee("fetch"),detached:C?.state?.detached??!1}),C?.state?.operation?e(Qe,{operation:C.state.operation,conflicts:C.state.conflicts,isBusy:ae,onAbort:()=>me("abort_operation"),onContinue:()=>ee("continue_operation")}):e(Xe,{message:Te,hasStagedChanges:_t.length>0,isBusy:ae,amend:ye,seeded:Le,isGenerating:q,suggestion:ne,generated:De,onToggleAmend:Ae,onChangeMessage:ke,onCommit:W,onGenerate:he,onUseSuggestion:Ee,onDismissSuggestion:Ce}),e(nt,{changes:qe,isLoading:ae,viewMode:b,repo:m,rootPath:c,onAction:me,onResolve:Ht}),e(St,{rootPath:c,repo:m,isBusy:ae,onAction:(Z,te)=>me(Z,void 0,te)})]})]})}export{Ar as GitPanel};
8
+ pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:F.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-muted font-mono text-xs",children:N.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(ct,{commits:F,nodePositions:ue,expandedHash:w,isGraphMode:C,laneWidth:ke,paddingLeft:ye,totalHeight:Pe}),e("div",{ref:se,className:"flex flex-col relative z-20",style:{paddingLeft:`${Te}px`},children:[F.map((W)=>e(ut,{commit:W,isExpanded:w===W.hash,onToggleExpand:()=>P(W.hash),onAction:j,onToggleFile:U,isExpandedFile:(q,ne)=>B.has(`${q}:${ne}`),isLoadingFile:(q,ne)=>V.has(`${q}:${ne}`),isFullContextFile:(q,ne)=>Y.has(`${q}:${ne}`),onToggleContext:z,fileDiffs:K,headerRef:(q)=>{pe.current[W.hash]=q}},W.hash)),e("div",{ref:be,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:H?e("div",{className:"flex items-center gap-2 text-xs text-muted font-mono py-2",children:[e(p,{size:14,className:"animate-spin text-info-text","aria-hidden":"true"}),e("span",{children:"Loading more commits..."})]}):k&&!N.trim()?e("button",{type:"button",onClick:_,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..."}):F.length>10?e("div",{className:"text-[11px] font-mono text-muted py-2",children:["End of commit history (",typeof L==="number"&&L>0?L: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(E,{size:16,className:"text-error-text 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:m,onCreate:h}){if(!t)return null;let g=a(()=>{if(l.trim())h()},[l,h]);return e(kt,{onClose:m,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Zn,{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:(b)=>r(b.currentTarget.value),onKeyDown:(b)=>{if(b.key==="Enter")g();if(b.key==="Escape")m()},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:m,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:m,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(de,{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(Xt,{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(Zn,{size:11})}),e("button",{type:"button",onClick:m,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(_n,{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-text hover:bg-error/10 cursor-pointer transition-colors",children:e(Q,{size:11})})]})]})}function Xt({branch:t}){if(t.gone)return e("span",{className:"text-[10px] font-mono text-warning-text 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(Qt,{branch:t,onClose:l,onSubmit:c})}function Qt({branch:t,onClose:l,onSubmit:c}){let[r,m]=n(t.name),[h,g]=n(!1),b=r.trim(),C=b===t.name,M=b.length>0&&!C,N=()=>{if(M)c(t.name,b,h)};return e(J,{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:(y)=>m(y.currentTarget.value),onKeyDown:(y)=>{if(y.key==="Enter")N();if(y.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"}),C&&b.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:(y)=>g(y.currentTarget.checked),className:`${ge} accent-ink cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{children:"Also rename it on the remote"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git push -u ",t.upstream?t.upstream.split("/")[0]:"origin"," ",b||"<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:N,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:m}){if(!t)return null;return e(J,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(E,{size:15,className:"text-error-text 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:`${ge} accent-error cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-error-text 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:()=>m(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:m,isBusy:h,onClose:g,onAction:b,onConfirmDelete:C}){let[M,N]=n([]),[y,w]=n(!1),[P,T]=n(null),[v,x]=n(""),[k,L]=n(null),[H,_]=n(null),[K,B]=n(!1),V=a(async()=>{w(!0),T(null);let z=new URLSearchParams({branches:"1",repo:c||"."});if(l)z.set("root",l);try{let j=await fetch(`/api/fs/git?${z.toString()}`),F=await j.json();if(F.success&&Array.isArray(F.branches))N(F.branches);else T(F.error||`Failed to read branches (HTTP ${j.status})`)}catch(j){T(j instanceof Error?j.message:"Failed to read branches")}finally{w(!1)}},[l,c]);o(()=>{if(t)V()},[t,V]);let Y=i(!1);o(()=>{if(!t){Y.current=!1;return}if(Y.current&&!h)V();Y.current=h},[t,h,V]),o(()=>{if(!t)L(null),_(null),B(!1),x("")},[t]);let U=u(()=>{let z=v.trim().toLowerCase();if(!z)return M;return M.filter((j)=>j.name.toLowerCase().includes(z)||j.upstream.toLowerCase().includes(z))},[M,v]);if(!t)return null;return e(d,{children:[e(J,{onClose:g,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Branches"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:m?`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(G,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:v,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 V(),disabled:y,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:y?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:y&&M.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(p,{size:14,className:"animate-spin text-info-text"}),"Loading branches…"]}):P?e("div",{className:"py-12 px-6 text-center text-xs text-error-text font-mono",children:P}):U.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:v.trim()?"No matching branches.":"No branches."}):U.map((z)=>e(wt,{branch:z,detached:m,onCheckout:()=>{b("checkout",{branch:z.name}),g()},onMerge:()=>{b("merge_branch",{branch:z.name}),g()},onRename:()=>L(z),onDelete:()=>{_(z),B(!1)}},z.name))})]}),e(Rt,{branch:k,onClose:()=>L(null),onSubmit:(z,j,F)=>{b("rename_branch",{branch:z,newName:j,...F?{remote:"1"}:{}}),L(null)}},k?.name??"none"),e(Gt,{branch:H,force:K,onForceChange:B,onClose:()=>{_(null),B(!1)},onConfirm:(z)=>{C(z,K),_(null),B(!1)}})]})}function Pt({mounted:t,confirmModal:l,onCloseConfirm:c,onConfirm:r,branchPrompt:m,newBranchName:h,newBranchInputRef:g,onNewBranchNameChange:b,onCloseBranchPrompt:C,onCreateBranch:M,viewingOutput:N,onCloseOutput:y,onRefreshOutput:w,onExecuteAction:P,branchModalOpen:T,onCloseBranchModal:v,rootPath:x,activeRepo:k,currentBranch:L,detached:H,isBusy:_,onBranchAction:K,onConfirmDeleteBranch:B}){if(!t)return null;return e(d,{children:[e(Ct,{modal:l,onClose:c,onConfirm:r}),e(Nt,{isOpen:m,branchName:h,inputRef:g,onChange:b,onClose:C,onCreate:M}),e(Ue,{output:N,onClose:y,onRefresh:w,onExecuteAction:P,rootPath:x,activeRepo:k}),e(St,{isOpen:T,rootPath:x,repo:k,currentBranch:L,detached:H,isBusy:_,onClose:v,onAction:K,onConfirmDelete:B})]})}function $t({rootPath:t,repo:l,isBusy:c,onAction:r}){let[m,h]=S("git.stashExpanded",!1),[g,b]=n([]),[C,M]=n(!1),[N,y]=n(""),[w,P]=n(!1),T=Ye(),v=a(async()=>{M(!0);let k=new URLSearchParams({stashes:"1",repo:l||"."});if(t)k.set("root",t);try{let H=await(await fetch(`/api/fs/git?${k.toString()}`)).json();b(H.stashes??[])}catch{b([])}finally{M(!1)}},[t,l]);o(()=>{if(m)v()},[m,v,c]);let x=(k,L)=>{if(r(k,L),k==="stash_push")y(""),P(!1)};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:[e("button",{type:"button",onClick:()=>h(!m),"aria-expanded":m,"aria-controls":T,title:m?"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:m?"▾":"▸"}),e(ht,{size:12}),e("span",{children:"Stash"}),g.length>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:g.length})]}),e("button",{type:"button",onClick:()=>x("stash_push",{...N.trim()?{message:N.trim()}:{},...w?{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(R,{size:10}),"Save"]})]}),e("div",{className:"section-reveal","data-expanded":m,id:T,inert:!m,children:e("div",{children:e("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("input",{type:"text",value:N,onChange:(k)=>y(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:w,onChange:(k)=>P(k.currentTarget.checked),className:`${ge} accent-ink cursor-pointer`}),"-u"]})]}),C&&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(ht,{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-text hover:bg-error/10 cursor-pointer transition-colors disabled:opacity-40",children:e(Q,{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(de,{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(de,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function Tt(t,l,c){let r=yt(),{pickedRepo:m,setActiveRepo:h,ready:g}=kr(t),{repos:b,scanning:C,rescan:M}=wr(t,l),N=TA(m,b),y=i(N);y.current=N;let w=i("");w.current=`${t??""}\x00${N}`;let P=i(""),T=i(""),v=i(void 0);if(r.data!==v.current)v.current=r.data,T.current=P.current;let x=l&&g?Wm(`${t??""}\x00${N}`):null,k=Se(x),L=i(k.refresh);L.current=k.refresh;let H=T.current===w.current?r.data:void 0,_=k.data??H,K=_?.syncCount??H?.syncCount,B=a((U)=>{if(!l)return;let z=U??y.current,j=new URLSearchParams;if(t)j.set("root",t);if(z)j.set("repo",z);j.set("sync","1"),j.set("t",String(Date.now())),P.current=w.current;let F=L.current;r.load(`/api/fs/git?${j.toString()}`).then(()=>F())},[l,t,r.load]);o(()=>{if(!g)return;B()},[c,t,l,g,N,B]);let V=r.state==="loading",Y=V||k.refreshing;return{activeRepo:N,setActiveRepo:h,repos:b,reposScanning:C,refreshRepos:M,isReading:V,isRefreshing:Y,data:_,syncCount:K,loadRepo:B,refreshTopic:k.refresh}}function Lt(t,l){let c=yt(),r=i(null),m=a((h,g,b)=>{r.current={actionType:h,extra:b};let C=new FormData;if(C.append("actionType",h),C.append("repo",l),t)C.append("root",t);if(g)C.append("file",g);if(b)Object.entries(b).forEach(([M,N])=>C.append(M,N));c.submit(C,{method:"POST",action:"/api/fs/git"})},[l,t,c]);return{state:c.state,execute:m,data:c.data,lastAction:r.current}}function At({rootPath:t,repo:l,execute:c}){let{sessionId:r}=Vm(),[m,h]=S("git.commitDraft",""),[g,b]=S("git.amend",!1),[C,M]=n(!1),[N,y]=n(null),[w,P]=n(!1),T=i(!1),v=i(null),x=i(m);x.current=m;let k=i(g);k.current=g;let L=i(h);L.current=h;let H=a((U)=>{h(U),P(!1)},[h]),_=a(()=>{if(T.current)return;T.current=!0,M(!0),y(null);let U={...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(U)}).then(async(z)=>{let j=await z.json().catch(()=>null);if(!z.ok||typeof j?.message!=="string"||!j.message.trim())throw Error(typeof j?.error==="string"?j.error:`Request failed (HTTP ${z.status})`);let F=j.message.trim();if(x.current.trim().length===0)L.current(F),P(!0);else y(F)}).catch((z)=>{Gi(z instanceof Error?z.message:String(z),"error")}).finally(()=>{T.current=!1,M(!1)})},[t,l,r]),K=a(()=>{if(N===null)return;h(N),P(!0),y(null)},[N,h]),B=a(()=>y(null),[]);o(()=>{if(!g)return;if(x.current.trim().length>0)return;let U=new URLSearchParams({headMessage:"1"});if(t)U.set("root",t);if(l)U.set("repo",l);let z=!1;return fetch(`/api/fs/git?${U.toString()}`).then((j)=>j.json()).then((j)=>{if(z)return;if(!k.current||x.current.trim().length>0)return;let F=typeof j?.message==="string"?j.message:"";if(F.length===0)return;v.current=F,L.current(F)}).catch(()=>{}),()=>{z=!0}},[g,r,t,l]);let V=a((U)=>{if(U){b(!0);return}if(v.current!==null&&x.current===v.current)h("");v.current=null,b(!1)},[b,h]),Y=a(()=>{c("commit",void 0,{message:x.current,...k.current?{amend:"1"}:{}}),h(""),b(!1),v.current=null,y(null),P(!1)},[c,b,h]);return{message:m,setMessage:H,amend:g,seeded:v.current!==null&&m===v.current,toggleAmend:V,commit:Y,isGenerating:C,suggestion:N,generated:w,generate:_,useSuggestion:K,dismissSuggestion:B}}var Dt=48;function Zt(t,l){let c=l?.branch?.trim()??"",r=(l?.hash??"").slice(0,7),m=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 ${m}`:`Applied ${m}`,stopped:l?.pop==="1"?`Popping ${m}`:`Applying ${m}`};case"stash_drop":return{done:`Dropped ${m}`};default:return null}}function Et({actionType:t,extra:l,stopped:c}){let r=Zt(t,l);if(!c)return r?.done??null;let m=Ho[c]??c,h=r?.stopped??r?.done??"",g=t==="sync"?"resolve it above, then Sync again":"resolve it above";return h?`${h} — the ${m} stopped on a conflict; ${g}`:`The ${m} stopped on a conflict; ${g}`}function Bt(t){let{fetcher:l,onPage:c,onReload:r,onSuccess:m,onError:h}=t,g=i(null),b=i({onPage:c,onReload:r,onSuccess:m,onError:h});b.current={onPage:c,onReload:r,onSuccess:m,onError:h},o(()=>{if(l.state!=="idle"||!l.data)return;let C=l.data;if(C===g.current)return;g.current=C;let M=b.current;if(C.type==="history"||C.type==="graph"){M.onPage({title:C.type==="graph"?"Git Graph":"Commit History",data:C.data||[],hasMore:C.hasMore,total:C.total});return}if(!C.success){M.onError(C.error||"Git operation failed");return}M.onReload();let N=l.lastAction,y=N?Et({...N,stopped:C.stopped}):null;if(y)M.onSuccess(y,C.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 m=r?Ho[r]:"operation";return{type:t,message:`Abort the ${m}? Everything resolved so far is discarded and the working tree returns to its pre-${m} state.`}}if(t==="delete_branch"){let m=c?.branch??"",h=c?.force==="1";return{type:t,extra:{branch:m,...h?{force:"1"}:{}},message:h?`Delete branch ${m} even though its commits are not merged? This cannot be undone from the panel.`:`Delete branch ${m}?`}}if(t==="stash_drop"){let m=c?.ref||"the top entry";return{type:t,extra:{ref:c?.ref??""},message:`Drop ${m}? The stash entry is removed — this cannot be undone from the panel.`}}return null}function Lr({className:t="",enabled:l=!0,rootPath:c,refreshKey:r=0}){let{activeRepo:m,setActiveRepo:h,repos:g,reposScanning:b,refreshRepos:C,isReading:M,isRefreshing:N,data:y,syncCount:w,loadRepo:P,refreshTopic:T}=Tt(c,l,r),v=Lt(c,m),[x,k]=S("git.viewMode","flat"),[L,H]=n(!1),_=i(null),[K,B]=n(!1),V=i(null),[Y,U]=n(null),[z,j]=n(!1),[F,oe]=n(""),se=i(null),[be,pe]=n(!1),[ue,ve]=n(null),[Pe,$e]=n(!1),{pushToast:re}=Le();o(()=>{$e(!0)},[]),o(()=>{if(z&&se.current)se.current.focus()},[z]),Bt({fetcher:v,onPage:ve,onReload:P,onSuccess:(Z,te)=>re(Z,te),onError:(Z)=>re(Z,"error")}),ze(_,()=>H(!1)),ze(V,()=>B(!1));let ee=v.execute,{message:Me,setMessage:ke,amend:ye,seeded:Te,toggleAmend:Ae,commit:W,isGenerating:q,suggestion:ne,generated:De,generate:he,useSuggestion:Ee,dismissSuggestion:Ce}=At({rootPath:c,repo:m,execute:ee}),me=(Z,te,we)=>{let Ke=Ft(Z,te,we,y?.state?.operation??null);if(Ke){U(Ke);return}ee(Z,te,we)},Ht=(Z,te)=>{ee("resolve_conflict",Z,te?{side:te}:void 0)},We=y?.branch||"main",zt=y?.branches||["main"],Ot=y?.remoteBranches||[],qe=y?.changes||[],ae=M||v.state!=="idle",Be=v.state==="idle"?null:v.lastAction?.actionType??null,_t=Be==="sync"||Be==="push"||Be==="pull",jt=qe.filter((Z)=>{if(Pr(Z.status))return!1;let te=Z.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:Y,onCloseConfirm:()=>U(null),onConfirm:()=>{if(Y)ee(Y.type,Y.file,Y.extra),U(null)},branchPrompt:z,newBranchName:F,newBranchInputRef:se,onNewBranchNameChange:oe,onCloseBranchPrompt:()=>{j(!1),oe("")},onCreateBranch:()=>{if(F.trim())ee("create_branch",void 0,{branch:F.trim()}),j(!1),oe("")},viewingOutput:ue,onCloseOutput:()=>ve(null),onRefreshOutput:()=>{if(ue)ee(ue.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(Z,te,we)=>ee(Z,te,we),branchModalOpen:be,onCloseBranchModal:()=>pe(!1),rootPath:c,activeRepo:m,currentBranch:We,detached:y?.state?.detached??!1,isBusy:ae,onBranchAction:(Z,te)=>ee(Z,void 0,te),onConfirmDeleteBranch:(Z,te)=>{ee("delete_branch",void 0,{branch:Z,...te?{force:"1"}:{}})}}),e(et,{activeRepo:m,repos:g,isRefreshing:N,rootPath:c,reposScanning:b,onSelectRepo:(Z)=>{h(Z)},onRefresh:()=>{T(),P()},onRefreshRepos:C}),y?.isRepo===!1?e(Mt,{repo:m,isBusy:ae,onInit:()=>ee("init")}):e(d,{children:[e(Je,{branchRef:V,showBranchMenu:K,setShowBranchMenu:B,branch:We,branches:zt,remoteBranches:Ot,onCheckout:(Z)=>ee("checkout",void 0,{branch:Z}),onMerge:(Z)=>ee("merge_branch",void 0,{branch:Z}),onOpenBranchPrompt:()=>j(!0),onManageBranches:()=>{pe(!0),B(!1)},optionsRef:_,showOptions:L,setShowOptions:H,onHistory:()=>ee("history"),onGraph:()=>ee("graph"),viewMode:x,setViewMode:k,isBusy:ae,syncCount:w,syncing:_t,onSync:()=>ee("sync"),onFetch:()=>ee("fetch"),detached:y?.state?.detached??!1}),y?.state?.operation?e(Ze,{operation:y.state.operation,conflicts:y.state.conflicts,isBusy:ae,onAbort:()=>me("abort_operation"),onContinue:()=>ee("continue_operation")}):e(Qe,{message:Me,hasStagedChanges:jt.length>0,isBusy:ae,amend:ye,seeded:Te,isGenerating:q,suggestion:ne,generated:De,onToggleAmend:Ae,onChangeMessage:ke,onCommit:W,onGenerate:he,onUseSuggestion:Ee,onDismissSuggestion:Ce}),e(ot,{changes:qe,isLoading:ae,viewMode:x,repo:m,rootPath:c,onAction:me,onResolve:Ht}),e($t,{rootPath:c,repo:m,isBusy:ae,onAction:(Z,te)=>me(Z,void 0,te)})]})]})}export{Lr as GitPanel};
@@ -0,0 +1,2 @@
1
+ import{Sn}from"./index-0g82ph6h.js";var X={};Sn(X,{default:()=>_a});var J={};Sn(J,{default:()=>Do});var lr=typeof global=="object"&&global&&global.Object===Object&&global,H=lr;var dr=typeof self=="object"&&self&&self.Object===Object&&self,xr=H||dr||Function("return this")(),Zt=xr;var cr=Zt.Symbol,Rn=cr;var _t=Object.prototype,{hasOwnProperty:gr,toString:yr}=_t,G=Rn?Rn.toStringTag:void 0;function _r(t){var e=gr.call(t,G),r=t[G];try{t[G]=void 0;var o=!0}catch(f){}var a=yr.call(t);if(o)if(e)t[G]=r;else delete t[G];return a}var bt=_r;var br=Object.prototype,vr=br.toString;function Or(t){return vr.call(t)}var vt=Or;var Tr="[object Null]",wr="[object Undefined]",Ot=Rn?Rn.toStringTag:void 0;function Sr(t){if(t==null)return t===void 0?wr:Tr;return Ot&&Ot in Object(t)?bt(t):vt(t)}var Ar=Sr;function Pr(t){return t!=null&&typeof t=="object"}var un=Pr;var Cr="[object Symbol]";function Er(t){return typeof t=="symbol"||un(t)&&Ar(t)==Cr}var na=Er;function Ir(t,e){var r=-1,o=t==null?0:t.length,a=Array(o);while(++r<o)a[r]=e(t[r],r,t);return a}var So=Ir;var jr=Array.isArray,we=jr;var Nr=1/0,At=Rn?Rn.prototype:void 0,Tt=At?At.toString:void 0;function wt(t){if(typeof t=="string")return t;if(we(t))return So(t,wt)+"";if(na(t))return Tt?Tt.call(t):"";var e=t+"";return e=="0"&&1/t==-Nr?"-0":e}var St=wt;function Dr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Mt=Dr;function Rr(t){return t}var Lr=Rr;var Fr="[object AsyncFunction]",Br="[object Function]",Gr="[object GeneratorFunction]",Ur="[object Proxy]";function zr(t){if(!Mt(t))return!1;var e=Ar(t);return e==Br||e==Gr||e==Fr||e==Ur}var To=zr;var Wr=Zt["__core-js_shared__"],q=Wr;var Pt=function(){var t=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Kr(t){return!!Pt&&Pt in t}var Ct=Kr;var Hr=Function.prototype,qr=Hr.toString;function $r(t){if(t!=null){try{return qr.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var y=$r;var kr=/[\\^$.*+?()[\]{}|]/g,Yr=/^\[object .+?Constructor\]$/,Xr=Function.prototype,Zr=Object.prototype,Jr=Xr.toString,Qr=Zr.hasOwnProperty,Vr=RegExp("^"+Jr.call(Qr).replace(kr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function to(t){if(!Mt(t)||Ct(t))return!1;var e=To(t)?Vr:Yr;return e.test(y(t))}var Et=to;function eo(t,e){return t==null?void 0:t[e]}var It=eo;function ro(t,e){var r=It(t,e);return Et(r)?r:void 0}var x=ro;var oo=x(Zt,"WeakMap"),k=oo;function ao(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Lt=ao;function fo(){}var jt=fo;var no=800,so=16,po=Date.now;function uo(t){var e=0,r=0;return function(){var o=po(),a=so-(o-r);if(r=o,a>0){if(++e>=no)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Nt=uo;function mo(t){return function(){return t}}var Mr=mo;var lo=function(){try{var t=x(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),gc=lo;var xo=!gc?Lr:function(t,e){return gc(t,"toString",{configurable:!0,enumerable:!1,value:Mr(e),writable:!0})},Dt=xo;var ho=Nt(Dt),Jp=ho;function co(t,e){var r=-1,o=t==null?0:t.length;while(++r<o)if(e(t[r],r,t)===!1)break;return t}var Zp=co;function go(t,e,r,o){var a=t.length,f=r+(o?1:-1);while(o?f--:++f<a)if(e(t[f],f,t))return f;return-1}var Xp=go;function yo(t){return t!==t}var Rt=yo;function _o(t,e,r){var o=r-1,a=t.length;while(++o<a)if(t[o]===e)return o;return-1}var Ft=_o;function bo(t,e,r){return e===e?Ft(t,e,r):Xp(t,Rt,r)}var Bt=bo;function vo(t,e){var r=t==null?0:t.length;return!!r&&Bt(t,e,0)>-1}var Gt=vo;var Oo=9007199254740991,Ao=/^(?:0|[1-9]\d*)$/;function wo(t,e){var r=typeof t;return e=e==null?Oo:e,!!e&&(r=="number"||r!="symbol"&&Ao.test(t))&&(t>-1&&t%1==0&&t<e)}var ns=wo;function Po(t,e){return t===e||t!==t&&e!==e}var Ia=Po;var Ut=Math.max;function Co(t,e,r){return e=Ut(e===void 0?t.length-1:e,0),function(){var o=arguments,a=-1,f=Ut(o.length-e,0),i=Array(f);while(++a<f)i[a]=o[e+a];a=-1;var n=Array(e+1);while(++a<e)n[a]=o[a];return n[e]=r(i),Lt(t,this,n)}}var em=Co;function Eo(t,e){return Jp(em(t,e,Lr),t+"")}var rs=Eo;var Io=9007199254740991;function Lo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Io}var j=Lo;function jo(t){return t!=null&&j(t.length)&&!To(t)}var Ln=jo;var Mo=Object.prototype;function Fo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Mo;return t===r}var as=Fo;function Bo(t,e){var r=-1,o=Array(t);while(++r<t)o[r]=e(r);return o}var zt=Bo;var Go="[object Arguments]";function Uo(t){return un(t)&&Ar(t)==Go}var mt=Uo;var Wt=Object.prototype,{hasOwnProperty:zo,propertyIsEnumerable:Wo}=Wt,Ko=mt(function(){return arguments}())?mt:function(t){return un(t)&&zo.call(t,"callee")&&!Wo.call(t,"callee")},io=Ko;function Ho(){return!1}var Kt=Ho;var $t=typeof X=="object"&&X&&!X.nodeType&&X,Ht=$t&&typeof Y=="object"&&Y&&!Y.nodeType&&Y,qo=Ht&&Ht.exports===$t,qt=qo?Zt.Buffer:void 0,$o=qt?qt.isBuffer:void 0,ko=$o||Kt,_a=ko;var Yo="[object Arguments]",Xo="[object Array]",Zo="[object Boolean]",Jo="[object Date]",Vo="[object Error]",ta="[object Function]",ea="[object Map]",oa="[object Number]",fa="[object Object]",ia="[object RegExp]",sa="[object Set]",pa="[object String]",ua="[object WeakMap]",ma="[object ArrayBuffer]",la="[object DataView]",da="[object Float32Array]",xa="[object Float64Array]",ha="[object Int8Array]",ca="[object Int16Array]",ga="[object Int32Array]",ya="[object Uint8Array]",ba="[object Uint8ClampedArray]",va="[object Uint16Array]",Oa="[object Uint32Array]",u={};u[da]=u[xa]=u[ha]=u[ca]=u[ga]=u[ya]=u[ba]=u[va]=u[Oa]=!0;u[Yo]=u[Xo]=u[ma]=u[Zo]=u[la]=u[Jo]=u[Vo]=u[ta]=u[ea]=u[oa]=u[fa]=u[ia]=u[sa]=u[pa]=u[ua]=!1;function Aa(t){return un(t)&&j(t.length)&&!!u[Ar(t)]}var kt=Aa;function Ta(t){return function(e){return t(e)}}var os=Ta;var Yt=typeof J=="object"&&J&&!J.nodeType&&J,U=Yt&&typeof Z=="object"&&Z&&!Z.nodeType&&Z,wa=U&&U.exports===Yt,lt=wa&&H.process,Sa=function(){try{var t=U&&U.require&&U.require("util").types;if(t)return t;return lt&&lt.binding&&lt.binding("util")}catch(e){}}(),Do=Sa;var Jt=Do&&Do.isTypedArray,Pa=Jt?os(Jt):kt,is=Pa;var Ca=Object.prototype,Ea=Ca.hasOwnProperty;function La(t,e){var r=we(t),o=!r&&io(t),a=!r&&!o&&_a(t),f=!r&&!o&&!a&&is(t),i=r||o||a||f,n=i?zt(t.length,String):[],s=n.length;for(var p in t)if((e||Ea.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||f&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||ns(p,s))))n.push(p);return n}var tm=La;function ja(t,e){return function(r){return t(e(r))}}var nm=ja;var Ma=nm(Object.keys,Object),Qt=Ma;var Na=Object.prototype,Da=Na.hasOwnProperty;function Ra(t){if(!as(t))return Qt(t);var e=[];for(var r in Object(t))if(Da.call(t,r)&&r!="constructor")e.push(r);return e}var Ac=Ra;function Fa(t){return Ln(t)?tm(t):Ac(t)}var Xt=Fa;var Ba=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ga=/^\w*$/;function Ua(t,e){if(we(t))return!1;var r=typeof t;if(r=="number"||r=="symbol"||r=="boolean"||t==null||na(t))return!0;return Ga.test(t)||!Ba.test(t)||e!=null&&t in Object(e)}var M=Ua;var za=x(Object,"create"),_=za;function Wa(){this.__data__=_?_(null):{},this.size=0}var Vt=Wa;function Ka(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var te=Ka;var Ha="__lodash_hash_undefined__",qa=Object.prototype,$a=qa.hasOwnProperty;function ka(t){var e=this.__data__;if(_){var r=e[t];return r===Ha?void 0:r}return $a.call(e,t)?e[t]:void 0}var ee=ka;var Ya=Object.prototype,Xa=Ya.hasOwnProperty;function Za(t){var e=this.__data__;return _?e[t]!==void 0:Xa.call(e,t)}var re=Za;var Ja="__lodash_hash_undefined__";function Qa(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=_&&e===void 0?Ja:e,this}var oe=Qa;function N(t){var e=-1,r=t==null?0:t.length;this.clear();while(++e<r){var o=t[e];this.set(o[0],o[1])}}N.prototype.clear=Vt;N.prototype.delete=te;N.prototype.get=ee;N.prototype.has=re;N.prototype.set=oe;var dt=N;function Va(){this.__data__=[],this.size=0}var ae=Va;function tf(t,e){var r=t.length;while(r--)if(Ia(t[r][0],e))return r;return-1}var O=tf;var ef=Array.prototype,rf=ef.splice;function of(t){var e=this.__data__,r=O(e,t);if(r<0)return!1;var o=e.length-1;if(r==o)e.pop();else rf.call(e,r,1);return--this.size,!0}var fe=of;function af(t){var e=this.__data__,r=O(e,t);return r<0?void 0:e[r][1]}var ie=af;function ff(t){return O(this.__data__,t)>-1}var ne=ff;function nf(t,e){var r=this.__data__,o=O(r,t);if(o<0)++this.size,r.push([t,e]);else r[o][1]=e;return this}var se=nf;function D(t){var e=-1,r=t==null?0:t.length;this.clear();while(++e<r){var o=t[e];this.set(o[0],o[1])}}D.prototype.clear=ae;D.prototype.delete=fe;D.prototype.get=ie;D.prototype.has=ne;D.prototype.set=se;var A=D;var sf=x(Zt,"Map"),T=sf;function pf(){this.size=0,this.__data__={hash:new dt,map:new(T||A),string:new dt}}var pe=pf;function uf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ue=uf;function mf(t,e){var r=t.__data__;return ue(e)?r[typeof e=="string"?"string":"hash"]:r.map}var w=mf;function lf(t){var e=w(this,t).delete(t);return this.size-=e?1:0,e}var me=lf;function df(t){return w(this,t).get(t)}var le=df;function xf(t){return w(this,t).has(t)}var de=xf;function hf(t,e){var r=w(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var xe=hf;function R(t){var e=-1,r=t==null?0:t.length;this.clear();while(++e<r){var o=t[e];this.set(o[0],o[1])}}R.prototype.clear=pe;R.prototype.delete=me;R.prototype.get=le;R.prototype.has=de;R.prototype.set=xe;var E=R;var cf="Expected a function";function xt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw TypeError(cf);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],f=r.cache;if(f.has(a))return f.get(a);var i=t.apply(this,o);return r.cache=f.set(a,i)||f,i};return r.cache=new(xt.Cache||E),r}xt.Cache=E;var he=xt;var gf=500;function yf(t){var e=he(t,function(o){if(r.size===gf)r.clear();return o}),r=e.cache;return e}var ce=yf;var _f=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bf=/\\(\\)?/g,vf=ce(function(t){var e=[];if(t.charCodeAt(0)===46)e.push("");return t.replace(_f,function(r,o,a,f){e.push(a?f.replace(bf,"$1"):o||r)}),e}),ge=vf;function Of(t){return t==null?"":St(t)}var rm=Of;function Af(t,e){if(we(t))return t;return M(t,e)?[t]:ge(rm(t))}var ss=Af;var Tf=1/0;function wf(t){if(typeof t=="string"||na(t))return t;var e=t+"";return e=="0"&&1/t==-Tf?"-0":e}var No=wf;function Sf(t,e){e=ss(e,t);var r=0,o=e.length;while(t!=null&&r<o)t=t[No(e[r++])];return r&&r==o?t:void 0}var ls=Sf;function Pf(t,e,r){var o=t==null?void 0:ls(t,e);return o===void 0?r:o}var ye=Pf;function Cf(t,e){var r=-1,o=e.length,a=t.length;while(++r<o)t[a+r]=e[r];return t}var hc=Cf;var _e=Rn?Rn.isConcatSpreadable:void 0;function Ef(t){return we(t)||io(t)||!!(_e&&t&&t[_e])}var be=Ef;function ve(t,e,r,o,a){var f=-1,i=t.length;r||(r=be),a||(a=[]);while(++f<i){var n=t[f];if(e>0&&r(n))if(e>1)ve(n,e-1,r,o,a);else hc(a,n);else if(!o)a[a.length]=n}return a}var bc=ve;function If(t,e,r,o){var a=-1,f=t==null?0:t.length;if(o&&f)r=t[++a];while(++a<f)r=e(r,t[a],a,t);return r}var Oe=If;function Lf(){this.__data__=new A,this.size=0}var Ae=Lf;function jf(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Te=jf;function Mf(t){return this.__data__.get(t)}var Se=Mf;function Nf(t){return this.__data__.has(t)}var Pe=Nf;var Df=200;function Rf(t,e){var r=this.__data__;if(r instanceof A){var o=r.__data__;if(!T||o.length<Df-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new E(o)}return r.set(t,e),this.size=r.size,this}var Ce=Rf;function F(t){var e=this.__data__=new A(t);this.size=e.size}F.prototype.clear=Ae;F.prototype.delete=Te;F.prototype.get=Se;F.prototype.has=Pe;F.prototype.set=Ce;var Qo=F;function Ff(t,e){var r=-1,o=t==null?0:t.length,a=0,f=[];while(++r<o){var i=t[r];if(e(i,r,t))f[a++]=i}return f}var Q=Ff;function Bf(){return[]}var am=Bf;var Gf=Object.prototype,Uf=Gf.propertyIsEnumerable,Ee=Object.getOwnPropertySymbols,zf=!Ee?am:function(t){if(t==null)return[];return t=Object(t),Q(Ee(t),function(e){return Uf.call(t,e)})},yc=zf;function Wf(t,e,r){var o=e(t);return we(t)?o:hc(o,r(t))}var om=Wf;function Kf(t){return om(t,Xt,yc)}var Bd=Kf;var Hf=x(Zt,"DataView"),V=Hf;var qf=x(Zt,"Promise"),tt=qf;var $f=x(Zt,"Set"),S=$f;var Ie="[object Map]",kf="[object Object]",Le="[object Promise]",je="[object Set]",Me="[object WeakMap]",Ne="[object DataView]",Yf=y(V),Xf=y(T),Zf=y(tt),Jf=y(S),Qf=y(k),I=Ar;if(V&&I(new V(new ArrayBuffer(1)))!=Ne||T&&I(new T)!=Ie||tt&&I(tt.resolve())!=Le||S&&I(new S)!=je||k&&I(new k)!=Me)I=function(t){var e=Ar(t),r=e==kf?t.constructor:void 0,o=r?y(r):"";if(o)switch(o){case Yf:return Ne;case Xf:return Ie;case Zf:return Le;case Jf:return je;case Qf:return Me}return e};var ra=I;var Vf=Zt.Uint8Array,vc=Vf;var ti="__lodash_hash_undefined__";function ei(t){return this.__data__.set(t,ti),this}var De=ei;function ri(t){return this.__data__.has(t)}var Re=ri;function et(t){var e=-1,r=t==null?0:t.length;this.__data__=new E;while(++e<r)this.add(t[e])}et.prototype.add=et.prototype.push=De;et.prototype.has=Re;var rt=et;function oi(t,e){var r=-1,o=t==null?0:t.length;while(++r<o)if(e(t[r],r,t))return!0;return!1}var Fe=oi;function ai(t,e){return t.has(e)}var ot=ai;var fi=1,ii=2;function ni(t,e,r,o,a,f){var i=r&fi,n=t.length,s=e.length;if(n!=s&&!(i&&s>n))return!1;var p=f.get(t),d=f.get(e);if(p&&d)return p==e&&d==t;var l=-1,m=!0,g=r&ii?new rt:void 0;f.set(t,e),f.set(e,t);while(++l<n){var h=t[l],c=e[l];if(o)var b=i?o(c,h,l,e,t,f):o(h,c,l,t,e,f);if(b!==void 0){if(b)continue;m=!1;break}if(g){if(!Fe(e,function(P,C){if(!ot(g,C)&&(h===P||a(h,P,r,o,f)))return g.push(C)})){m=!1;break}}else if(!(h===c||a(h,c,r,o,f))){m=!1;break}}return f.delete(t),f.delete(e),m}var at=ni;function si(t){var e=-1,r=Array(t.size);return t.forEach(function(o,a){r[++e]=[a,o]}),r}var Be=si;function pi(t){var e=-1,r=Array(t.size);return t.forEach(function(o){r[++e]=o}),r}var B=pi;var ui=1,mi=2,li="[object Boolean]",di="[object Date]",xi="[object Error]",hi="[object Map]",ci="[object Number]",gi="[object RegExp]",yi="[object Set]",_i="[object String]",bi="[object Symbol]",vi="[object ArrayBuffer]",Oi="[object DataView]",Ge=Rn?Rn.prototype:void 0,ht=Ge?Ge.valueOf:void 0;function Ai(t,e,r,o,a,f,i){switch(r){case Oi:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case vi:if(t.byteLength!=e.byteLength||!f(new vc(t),new vc(e)))return!1;return!0;case li:case di:case ci:return Ia(+t,+e);case xi:return t.name==e.name&&t.message==e.message;case gi:case _i:return t==e+"";case hi:var n=Be;case yi:var s=o&ui;if(n||(n=B),t.size!=e.size&&!s)return!1;var p=i.get(t);if(p)return p==e;o|=mi,i.set(t,e);var d=at(n(t),n(e),o,a,f,i);return i.delete(t),d;case bi:if(ht)return ht.call(t)==ht.call(e)}return!1}var Ue=Ai;var Ti=1,wi=Object.prototype,Si=wi.hasOwnProperty;function Pi(t,e,r,o,a,f){var i=r&Ti,n=Bd(t),s=n.length,p=Bd(e),d=p.length;if(s!=d&&!i)return!1;var l=s;while(l--){var m=n[l];if(!(i?m in e:Si.call(e,m)))return!1}var g=f.get(t),h=f.get(e);if(g&&h)return g==e&&h==t;var c=!0;f.set(t,e),f.set(e,t);var b=i;while(++l<s){m=n[l];var P=t[m],C=e[m];if(o)var yt=i?o(C,P,m,e,t,f):o(P,C,m,t,e,f);if(!(yt===void 0?P===C||a(P,C,r,o,f):yt)){c=!1;break}b||(b=m=="constructor")}if(c&&!b){var W=t.constructor,K=e.constructor;if(W!=K&&(("constructor"in t)&&("constructor"in e))&&!(typeof W=="function"&&W instanceof W&&typeof K=="function"&&K instanceof K))c=!1}return f.delete(t),f.delete(e),c}var ze=Pi;var Ci=1,We="[object Arguments]",Ke="[object Array]",ft="[object Object]",Ei=Object.prototype,He=Ei.hasOwnProperty;function Ii(t,e,r,o,a,f){var i=we(t),n=we(e),s=i?Ke:ra(t),p=n?Ke:ra(e);s=s==We?ft:s,p=p==We?ft:p;var d=s==ft,l=p==ft,m=s==p;if(m&&_a(t)){if(!_a(e))return!1;i=!0,d=!1}if(m&&!d)return f||(f=new Qo),i||is(t)?at(t,e,r,o,a,f):Ue(t,e,s,r,o,a,f);if(!(r&Ci)){var g=d&&He.call(t,"__wrapped__"),h=l&&He.call(e,"__wrapped__");if(g||h){var c=g?t.value():t,b=h?e.value():e;return f||(f=new Qo),a(c,b,r,o,f)}}if(!m)return!1;return f||(f=new Qo),ze(t,e,r,o,a,f)}var qe=Ii;function $e(t,e,r,o,a){if(t===e)return!0;if(t==null||e==null||!un(t)&&!un(e))return t!==t&&e!==e;return qe(t,e,r,o,$e,a)}var it=$e;var Li=1,ji=2;function Mi(t,e,r,o){var a=r.length,f=a,i=!o;if(t==null)return!f;t=Object(t);while(a--){var n=r[a];if(i&&n[2]?n[1]!==t[n[0]]:!(n[0]in t))return!1}while(++a<f){n=r[a];var s=n[0],p=t[s],d=n[1];if(i&&n[2]){if(p===void 0&&!(s in t))return!1}else{var l=new Qo;if(o)var m=o(p,d,s,t,e,l);if(!(m===void 0?it(d,p,Li|ji,o,l):m))return!1}}return!0}var ke=Mi;function Ni(t){return t===t&&!Mt(t)}var st=Ni;function Di(t){var e=Xt(t),r=e.length;while(r--){var o=e[r],a=t[o];e[r]=[o,a,st(a)]}return e}var Ye=Di;function Ri(t,e){return function(r){if(r==null)return!1;return r[t]===e&&(e!==void 0||(t in Object(r)))}}var pt=Ri;function Fi(t){var e=Ye(t);if(e.length==1&&e[0][2])return pt(e[0][0],e[0][1]);return function(r){return r===t||ke(r,t,e)}}var Xe=Fi;function Bi(t,e){return t!=null&&e in Object(t)}var Ze=Bi;function Gi(t,e,r){e=ss(e,t);var o=-1,a=e.length,f=!1;while(++o<a){var i=No(e[o]);if(!(f=t!=null&&r(t,i)))break;t=t[i]}if(f||++o!=a)return f;return a=t==null?0:t.length,!!a&&j(a)&&ns(i,a)&&(we(t)||io(t))}var im=Gi;function Ui(t,e){return t!=null&&im(t,e,Ze)}var sm=Ui;var zi=1,Wi=2;function Ki(t,e){if(M(t)&&st(e))return pt(No(t),e);return function(r){var o=ye(r,t);return o===void 0&&o===e?sm(r,t):it(e,o,zi|Wi)}}var Je=Ki;function Hi(t){return function(e){return e==null?void 0:e[t]}}var lm=Hi;function qi(t){return function(e){return ls(e,t)}}var Qe=qi;function $i(t){return M(t)?lm(No(t)):Qe(t)}var Ve=$i;function ki(t){if(typeof t=="function")return t;if(t==null)return Lr;if(typeof t=="object")return we(t)?Je(t[0],t[1]):Xe(t);return Ve(t)}var rr=ki;function Yi(t){return function(e,r,o){var a=-1,f=Object(e),i=o(e),n=i.length;while(n--){var s=i[t?n:++a];if(r(f[s],s,f)===!1)break}return e}}var tr=Yi;var Xi=tr(),xc=Xi;function Zi(t,e){return t&&xc(t,e,Xt)}var kc=Zi;function Ji(t,e){return function(r,o){if(r==null)return r;if(!Ln(r))return t(r,o);var a=r.length,f=e?a:-1,i=Object(r);while(e?f--:++f<a)if(o(i[f],f,i)===!1)break;return r}}var er=Ji;var Qi=er(kc),cs=Qi;function Vi(t){return un(t)&&Ln(t)}var cm=Vi;function tn(t,e,r){var o=-1,a=t==null?0:t.length;while(++o<a)if(r(e,t[o]))return!0;return!1}var or=tn;function rn(t){return typeof t=="function"?t:Lr}var wc=rn;function on(t,e){var r=we(t)?Zp:cs;return r(t,wc(e))}var v=on;function an(t,e){var r=[];return cs(t,function(o,a,f){if(e(o,a,f))r.push(o)}),r}var ar=an;function fn(t,e){var r=we(t)?Q:ar;return r(t,rr(e,3))}var hr=fn;function nn(t,e){return So(e,function(r){return t[r]})}var fr=nn;function sn(t){return t==null?[]:fr(t,Xt(t))}var aa=sn;var pn="[object Map]",mn="[object Set]",ln=Object.prototype,dn=ln.hasOwnProperty;function xn(t){if(t==null)return!0;if(Ln(t)&&(we(t)||typeof t=="string"||typeof t.splice=="function"||_a(t)||is(t)||io(t)))return!t.length;var e=ra(t);if(e==pn||e==mn)return!t.size;if(as(t))return!Ac(t).length;for(var r in t)if(dn.call(t,r))return!1;return!0}var ut=xn;function hn(t){return t===void 0}var en=hn;function cn(t,e,r,o,a){return a(t,function(f,i,n){r=o?(o=!1,f):e(r,f,i,n)}),r}var ir=cn;function gn(t,e,r){var o=we(t)?Oe:ir,a=arguments.length<3;return o(t,rr(e,4),r,a,cs)}var Ro=gn;var yn=1/0,_n=!(S&&1/B(new S([,-0]))[1]==yn)?jt:function(t){return new S(t)},nr=_n;var bn=200;function vn(t,e,r){var o=-1,a=Gt,f=t.length,i=!0,n=[],s=n;if(r)i=!1,a=or;else if(f>=bn){var p=e?null:nr(t);if(p)return B(p);i=!1,a=ot,s=new rt}else s=e?[]:n;t:while(++o<f){var d=t[o],l=e?e(d):d;if(d=r||d!==0?d:0,i&&l===l){var m=s.length;while(m--)if(s[m]===l)continue t;if(e)s.push(l);n.push(d)}else if(!a(s,l,r)){if(s!==n)s.push(l);n.push(d)}}return n}var sr=vn;var On=rs(function(t){return sr(bc(t,1,cm,!0))}),ct=On;var Tn="\x00",L="\x00",pr="\x01";class nt{constructor(t={}){if(this._isDirected=Object.prototype.hasOwnProperty.call(t,"directed")?t.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(t,"multigraph")?t.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=Mr(void 0),this._defaultEdgeLabelFn=Mr(void 0),this._nodes={},this._isCompound)this._parent={},this._children={},this._children[L]={};this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){if(!To(t))t=Mr(t);return this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Xt(this._nodes)}sources(){var t=this;return hr(this.nodes(),function(e){return ut(t._in[e])})}sinks(){var t=this;return hr(this.nodes(),function(e){return ut(t._out[e])})}setNodes(t,e){var r=arguments,o=this;return v(t,function(a){if(r.length>1)o.setNode(a,e);else o.setNode(a)}),this}setNode(t,e){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){if(arguments.length>1)this._nodes[t]=e;return this}if(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound)this._parent[t]=L,this._children[t]={},this._children[L][t]=!0;return this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var e=(r)=>this.removeEdge(this._edgeObjs[r]);if(delete this._nodes[t],this._isCompound)this._removeFromParentsChildList(t),delete this._parent[t],v(this.children(t),(r)=>{this.setParent(r)}),delete this._children[t];v(Xt(this._in[t]),e),delete this._in[t],delete this._preds[t],v(Xt(this._out[t]),e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(en(e))e=L;else{e+="";for(var r=e;!en(r);r=this.parent(r))if(r===t)throw Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if(e!==L)return e}}children(t){if(en(t))t=L;if(this._isCompound){var e=this._children[t];if(e)return Xt(e)}else if(t===L)return this.nodes();else if(this.hasNode(t))return[]}predecessors(t){var e=this._preds[t];if(e)return Xt(e)}successors(t){var e=this._sucs[t];if(e)return Xt(e)}neighbors(t){var e=this.predecessors(t);if(e)return ct(e,this.successors(t))}isLeaf(t){var e;if(this.isDirected())e=this.successors(t);else e=this.neighbors(t);return e.length===0}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;v(this._nodes,function(f,i){if(t(i))e.setNode(i,f)}),v(this._edgeObjs,function(f){if(e.hasNode(f.v)&&e.hasNode(f.w))e.setEdge(f,r.edge(f))});var o={};function a(f){var i=r.parent(f);if(i===void 0||e.hasNode(i))return o[f]=i,i;else if(i in o)return o[i];else return a(i)}if(this._isCompound)v(e.nodes(),function(f){e.setParent(f,a(f))});return e}setDefaultEdgeLabel(t){if(!To(t))t=Mr(t);return this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return aa(this._edgeObjs)}setPath(t,e){var r=this,o=arguments;return Ro(t,function(a,f){if(o.length>1)r.setEdge(a,f,e);else r.setEdge(a,f);return f}),this}setEdge(){var t,e,r,o,a=!1,f=arguments[0];if(typeof f==="object"&&f!==null&&"v"in f){if(t=f.v,e=f.w,r=f.name,arguments.length===2)o=arguments[1],a=!0}else if(t=f,e=arguments[1],r=arguments[3],arguments.length>2)o=arguments[2],a=!0;if(t=""+t,e=""+e,!en(r))r=""+r;var i=z(this._isDirected,t,e,r);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,i)){if(a)this._edgeLabels[i]=o;return this}if(!en(r)&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[i]=a?o:this._defaultEdgeLabelFn(t,e,r);var n=wn(this._isDirected,t,e,r);return t=n.v,e=n.w,Object.freeze(n),this._edgeObjs[i]=n,ur(this._preds[e],t),ur(this._sucs[t],e),this._in[e][i]=n,this._out[t][i]=n,this._edgeCount++,this}edge(t,e,r){var o=arguments.length===1?gt(this._isDirected,arguments[0]):z(this._isDirected,t,e,r);return this._edgeLabels[o]}hasEdge(t,e,r){var o=arguments.length===1?gt(this._isDirected,arguments[0]):z(this._isDirected,t,e,r);return Object.prototype.hasOwnProperty.call(this._edgeLabels,o)}removeEdge(t,e,r){var o=arguments.length===1?gt(this._isDirected,arguments[0]):z(this._isDirected,t,e,r),a=this._edgeObjs[o];if(a)t=a.v,e=a.w,delete this._edgeLabels[o],delete this._edgeObjs[o],mr(this._preds[e],t),mr(this._sucs[t],e),delete this._in[e][o],delete this._out[t][o],this._edgeCount--;return this}inEdges(t,e){var r=this._in[t];if(r){var o=aa(r);if(!e)return o;return hr(o,function(a){return a.v===e})}}outEdges(t,e){var r=this._out[t];if(r){var o=aa(r);if(!e)return o;return hr(o,function(a){return a.w===e})}}nodeEdges(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}}nt.prototype._nodeCount=0;nt.prototype._edgeCount=0;function ur(t,e){if(t[e])t[e]++;else t[e]=1}function mr(t,e){if(!--t[e])delete t[e]}function z(t,e,r,o){var a=""+e,f=""+r;if(!t&&a>f){var i=a;a=f,f=i}return a+pr+f+pr+(en(o)?Tn:o)}function wn(t,e,r,o){var a=""+e,f=""+r;if(!t&&a>f){var i=a;a=f,f=i}var n={v:a,w:f};if(o)n.name=o;return n}function gt(t,e){return z(t,e.v,e.w,e.name)}
2
+ export{Zt,Rn,Ar,un,na,So,we,Mt,Lr,To,Mr,gc,Jp,Zp,Xp,ns,Ia,em,rs,Ln,as,io,_a,os,Do,is,tm,nm,Ac,Xt,rm,ss,No,ls,hc,bc,Qo,am,yc,om,Bd,ra,vc,im,sm,lm,rr,xc,kc,cs,cm,wc,v,hr,aa,en,Ro,nt};