@kabmo-labs/kabmo 0.46.1 → 0.47.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 (287) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +439 -435
  3. package/dist/client/static/js/{CsvGrid-qdkmv8bj.js → CsvGrid-vfgttmym.js} +2 -2
  4. package/dist/client/static/js/{DocxView-k84ns803.js → DocxView-dc41t6rp.js} +2 -2
  5. package/dist/client/static/js/{DrawioView-r1n717f7.js → DrawioView-wpwr38d9.js} +2 -2
  6. package/dist/client/static/js/HtmlPreview-23n7t5cs.js +1 -0
  7. package/dist/client/static/js/ImageView-mvjb3qh1.js +1 -0
  8. package/dist/client/static/js/LayoutWrapper-eenx0hp2.js +2 -0
  9. package/dist/client/static/js/{Modal-xe6h99jn.js → Modal-dsqhas10.js} +13 -13
  10. package/dist/client/static/js/{PdfView-ffg4mccg.js → PdfView-cpvsbfk0.js} +1 -1
  11. package/dist/client/static/js/{SessionsView-cdcbsee9.js → SessionsView-s0crtcm8.js} +1 -1
  12. package/dist/client/static/js/{SheetView-89sscpz6.js → SheetView-n6mst0hq.js} +13 -13
  13. package/dist/client/static/js/{SvgPreview-68c0ccbv.js → SvgPreview-g2aqq812.js} +1 -1
  14. package/dist/client/static/js/{abnfDiagram-O67JEVCF-h3a5s259.js → abnfDiagram-O67JEVCF-3vac8sq4.js} +1 -1
  15. package/dist/client/static/js/architecture-7GRP2DOG-b5w9mnn5.js +1 -0
  16. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-983p0jgn.js → architectureDiagram-NJMV4G6O-1nh4htz2.js} +3 -3
  17. package/dist/client/static/js/{astro-hyj5wege.js → astro-63zcysj7.js} +1 -1
  18. package/dist/client/static/js/bash-hv3167gh.js +1 -0
  19. package/dist/client/static/js/{blockDiagram-BEXU5L5S-16pse5mh.js → blockDiagram-BEXU5L5S-62z6kaar.js} +2 -2
  20. package/dist/client/static/js/{c4Diagram-YGBWAQC7-mvnb00zt.js → c4Diagram-YGBWAQC7-rts5zgx4.js} +3 -3
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-kmpd91xb.js → classDiagram-v2-NBCMYWYE-tnpww186.js} +1 -1
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-3ek5r5se.js → cose-bilkent-JH36ORCC-8vsjbzwa.js} +1 -1
  23. package/dist/client/static/js/cpp-v2mqp8j7.js +1 -0
  24. package/dist/client/static/js/css-x7gyc3ta.js +1 -0
  25. package/dist/client/static/js/cynefin-OW5HDTMX-kdj8rjc1.js +1 -0
  26. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-jkbh84zn.js → cynefinDiagram-VND7K2PF-005gc8km.js} +1 -1
  27. package/dist/client/static/js/{dagre-6A5THRUB-4fdc0sgn.js → dagre-6A5THRUB-41zsteyd.js} +2 -2
  28. package/dist/client/static/js/{diagram-22UHCM2B-hbk61nq9.js → diagram-22UHCM2B-prsm18a1.js} +3 -3
  29. package/dist/client/static/js/{diagram-3UASUU5V-hfpbr9qh.js → diagram-3UASUU5V-5nx9wf04.js} +1 -1
  30. package/dist/client/static/js/{diagram-ATOU4E4O-fn0nt71a.js → diagram-ATOU4E4O-k3d4z3aq.js} +3 -3
  31. package/dist/client/static/js/{diagram-CDSNMT55-ssswxjeb.js → diagram-CDSNMT55-x2c5x5j2.js} +2 -2
  32. package/dist/client/static/js/{diagram-MLGK6HIB-whnzxv6f.js → diagram-MLGK6HIB-nvr76jqh.js} +1 -1
  33. package/dist/client/static/js/{diagram-MPIPVDR6-hk1chzxk.js → diagram-MPIPVDR6-v1jpzp9p.js} +1 -1
  34. package/dist/client/static/js/{dockerfile-zmsj8r4g.js → dockerfile-vz6va73h.js} +1 -1
  35. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-q1vkg5mr.js → ebnfDiagram-ZINNZB2B-0v4tqr9v.js} +1 -1
  36. package/dist/client/static/js/{elk-276RUBZZ-kt98vg8j.js → elk-276RUBZZ-qfn4r7xj.js} +1 -1
  37. package/dist/client/static/js/{erDiagram-OPXOYQCR-ey3avsn9.js → erDiagram-OPXOYQCR-cd667n9f.js} +4 -4
  38. package/dist/client/static/js/{erlang-814e8qy5.js → erlang-vk66vt7q.js} +1 -1
  39. package/dist/client/static/js/eventmodeling-NTZA5JFV-m57b7ytw.js +1 -0
  40. package/dist/client/static/js/flowDiagram-KWPJA3E3-fasj2gxy.js +1 -0
  41. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-a9k1at43.js → ganttDiagram-FUAMR5RP-ps0h3drm.js} +1 -1
  42. package/dist/client/static/js/gitGraph-4MIJSDKK-wvzsc4ph.js +1 -0
  43. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-gnekjfym.js → gitGraphDiagram-X574FWY7-fts23jer.js} +2 -2
  44. package/dist/client/static/js/graphql-a4gbqpj9.js +1 -0
  45. package/dist/client/static/js/{index-xq5f3nxa.js → index-0dkc6z8e.js} +2 -2
  46. package/dist/client/static/js/{index-m4k054wz.js → index-1d8bxjsz.js} +3 -3
  47. package/dist/client/static/js/{index-kty4ncsr.js → index-1whzs9kb.js} +2 -2
  48. package/dist/client/static/js/{index-qfxn7yh5.js → index-396r53n0.js} +2 -2
  49. package/dist/client/static/js/{index-kbhrvep8.js → index-39d8zbkx.js} +3 -3
  50. package/dist/client/static/js/{index-dn7hg4em.js → index-3nsrnyqr.js} +2 -2
  51. package/dist/client/static/js/{index-1ax52p0q.js → index-4jzsr1ky.js} +2 -2
  52. package/dist/client/static/js/{index-2a6qp9y6.js → index-4wnzs76g.js} +1 -1
  53. package/dist/client/static/js/{index-hgzntg2j.js → index-4x9p7hf9.js} +2 -2
  54. package/dist/client/static/js/{index-fzngzhww.js → index-52nd4hgm.js} +1 -1
  55. package/dist/client/static/js/{index-pavvxrsz.js → index-54mkp2r2.js} +1 -1
  56. package/dist/client/static/js/{index-abs635a1.js → index-56rtb871.js} +25 -25
  57. package/dist/client/static/js/{index-dxvtjn6a.js → index-5f4b44ay.js} +2 -2
  58. package/dist/client/static/js/{index-q9ytjey8.js → index-6009v8jf.js} +1 -1
  59. package/dist/client/static/js/{index-e9cxje00.js → index-62jgcgfd.js} +5 -5
  60. package/dist/client/static/js/{index-nw5mvcaj.js → index-64p1dncg.js} +2 -2
  61. package/dist/client/static/js/{index-fj5rsp5v.js → index-6d6hxwb5.js} +2 -2
  62. package/dist/client/static/js/{index-19x11s5w.js → index-70g527sb.js} +2 -2
  63. package/dist/client/static/js/{index-ykm7a3cp.js → index-7zeah164.js} +2 -2
  64. package/dist/client/static/js/{index-z25ss7xj.js → index-7zedprz3.js} +1 -1
  65. package/dist/client/static/js/{index-g7s0wsag.js → index-9ab6xaxd.js} +2 -2
  66. package/dist/client/static/js/index-9vqkyj58.js +3 -0
  67. package/dist/client/static/js/{index-60v30k5h.js → index-9xsf8162.js} +35 -35
  68. package/dist/client/static/js/{index-3x7h2eqj.js → index-a4h5np9r.js} +2 -2
  69. package/dist/client/static/js/{index-9vv7wr1n.js → index-an2wv33f.js} +2 -2
  70. package/dist/client/static/js/{index-64sqfr4a.js → index-c5hjht5e.js} +2 -2
  71. package/dist/client/static/js/{index-84fyq5a6.js → index-c63qyysm.js} +1 -1
  72. package/dist/client/static/js/{index-atq9q1s7.js → index-ccgzzydx.js} +1 -1
  73. package/dist/client/static/js/{index-b5dfvget.js → index-cra9mgkq.js} +4 -4
  74. package/dist/client/static/js/index-cvyqp8nz.css +1 -0
  75. package/dist/client/static/js/index-d2xtbabt.js +2 -0
  76. package/dist/client/static/js/{index-wrcdc9vz.js → index-dxkefysk.js} +1 -1
  77. package/dist/client/static/js/index-dxp2yvy7.js +2 -0
  78. package/dist/client/static/js/{index-vjmg7kn5.js → index-dyc886cc.js} +1 -1
  79. package/dist/client/static/js/{index-5wz0y88c.js → index-dzeyd153.js} +2 -2
  80. package/dist/client/static/js/{index-qf3y3ahx.js → index-e5j5gc4h.js} +2 -2
  81. package/dist/client/static/js/{index-2ks0m8ss.js → index-evmcc5qh.js} +2 -2
  82. package/dist/client/static/js/{index-b2e5pwx7.js → index-f2ahkev0.js} +5 -5
  83. package/dist/client/static/js/{index-65afr75v.js → index-fjex1y0t.js} +2 -2
  84. package/dist/client/static/js/{index-kb14dhrx.js → index-fxd8dfj4.js} +2 -2
  85. package/dist/client/static/js/{index-trvqvb1v.js → index-g4kkapka.js} +2 -2
  86. package/dist/client/static/js/{index-561gkvve.js → index-gzkzwgzv.js} +2 -2
  87. package/dist/client/static/js/{index-yf93db65.js → index-n1yr4khe.js} +1 -1
  88. package/dist/client/static/js/{index-d23eacf2.js → index-nkahe229.js} +2 -2
  89. package/dist/client/static/js/{index-dt6q3rws.js → index-p6s3fz6b.js} +11 -11
  90. package/dist/client/static/js/{index-hnb66d3s.js → index-q4ke39rh.js} +2 -2
  91. package/dist/client/static/js/index-qtd0e38d.js +1 -0
  92. package/dist/client/static/js/{index-x9r7zfp4.js → index-tqgj7rd9.js} +2 -2
  93. package/dist/client/static/js/{index-wbws16ag.js → index-x0xspam4.js} +2 -2
  94. package/dist/client/static/js/{index-4cag7w6k.js → index-x2v1zmth.js} +185 -185
  95. package/dist/client/static/js/{index-amsa0tfs.js → index-x9hfvbz6.js} +1 -1
  96. package/dist/client/static/js/{index-8g7q8mz4.js → index-xk1cqjkn.js} +3 -3
  97. package/dist/client/static/js/{index-c9e417cs.js → index-y6ke70e6.js} +2 -2
  98. package/dist/client/static/js/{index-bsr7wmj2.js → index-zhjjpvcc.js} +1 -1
  99. package/dist/client/static/js/info-A6RAGUB7-ym2xevn8.js +1 -0
  100. package/dist/client/static/js/{infoDiagram-VRGFBTTK-r1p25738.js → infoDiagram-VRGFBTTK-88qbtpq5.js} +1 -1
  101. package/dist/client/static/js/ini-80p6sp79.js +1 -0
  102. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-afgrqdrt.js → ishikawaDiagram-OU5B5YK6-s8bagk00.js} +1 -1
  103. package/dist/client/static/js/java-mm2b3s9b.js +1 -0
  104. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-hepa4wk7.js → journeyDiagram-ZHPQQLJL-hz8z0b9x.js} +2 -2
  105. package/dist/client/static/js/json-fzy76fkw.js +1 -0
  106. package/dist/client/static/js/jsx-c7v2f8s7.js +1 -0
  107. package/dist/client/static/js/{julia-yv2j8qd0.js → julia-dm0j9apa.js} +1 -1
  108. package/dist/client/static/js/{kanban-definition-PNTS6WVX-jysft8ya.js → kanban-definition-PNTS6WVX-sjjnjb51.js} +1 -1
  109. package/dist/client/static/js/lua-ppfdxrmv.js +1 -0
  110. package/dist/client/static/js/markdown-xed7y3ds.js +1 -0
  111. package/dist/client/static/js/{mermaid.core-0m90b0s8.js → mermaid.core-zvwygxbh.js} +7 -7
  112. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-x2rrzpvr.js → mindmap-definition-NLK3R4M7-kgj8enan.js} +2 -2
  113. package/dist/client/static/js/one-dark-pro-mq6sn6a2.js +1 -0
  114. package/dist/client/static/js/one-light-pt6t6vax.js +1 -0
  115. package/dist/client/static/js/packet-AYTQ26CC-01vcsy6x.js +1 -0
  116. package/dist/client/static/js/{pegDiagram-GJSIUBJH-z7vb7f1z.js → pegDiagram-GJSIUBJH-gxzw1qwa.js} +1 -1
  117. package/dist/client/static/js/{perl-917pjq5a.js → perl-4jcm2jxv.js} +1 -1
  118. package/dist/client/static/js/{php-hwz75qzt.js → php-q32mec74.js} +1 -1
  119. package/dist/client/static/js/pie-WAS4IAKB-053gzkmh.js +1 -0
  120. package/dist/client/static/js/{pieDiagram-5QR66LMP-jqv6v4e6.js → pieDiagram-5QR66LMP-pdqwyqcm.js} +1 -1
  121. package/dist/client/static/js/properties-8ysbq2n2.js +1 -0
  122. package/dist/client/static/js/python-4ysexc8s.js +1 -0
  123. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-w2h8yxrv.js → quadrantDiagram-O4NWA36T-yx2t364p.js} +1 -1
  124. package/dist/client/static/js/r-hrsw5arc.js +1 -0
  125. package/dist/client/static/js/radar-RG4KPBEZ-bkpby8am.js +1 -0
  126. package/dist/client/static/js/railroad-74A4TZTK-67bxrjgw.js +1 -0
  127. package/dist/client/static/js/railroad-abnf-HS5TGJTU-xj9ymacg.js +1 -0
  128. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2xxpbnf6.js +1 -0
  129. package/dist/client/static/js/railroad-peg-WCYAUIDC-78w88znz.js +1 -0
  130. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-nd09yac3.js → railroadDiagram-XR7U4H2S-800fdzkr.js} +1 -1
  131. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-t61zxh5v.js → requirementDiagram-PLB6GJNP-vc5rpgtm.js} +1 -1
  132. package/dist/client/static/js/{ruby-er7ayhte.js → ruby-npmpb290.js} +1 -1
  133. package/dist/client/static/js/{rust-avnkhh0p.js → rust-waks43wh.js} +1 -1
  134. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2f7h2cmw.js → sankeyDiagram-IPEJSGJF-ccjk8zgn.js} +2 -2
  135. package/dist/client/static/js/{sass-n47tt136.js → sass-502a4r7y.js} +1 -1
  136. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-kfb5d7zd.js → sequenceDiagram-PO4LG4MO-c0tk7gfn.js} +6 -6
  137. package/dist/client/static/js/{sizeCapture-INFHLROL-amfg19se.js → sizeCapture-INFHLROL-fma9p1vy.js} +1 -1
  138. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-k5hx7btx.js → stateDiagram-v2-GCMORJYK-d8f24b7j.js} +2 -2
  139. package/dist/client/static/js/{svelte-2pmz35vx.js → svelte-c15d0421.js} +1 -1
  140. package/dist/client/static/js/{swimlanes-2SLR337P-wv3rp8kk.js → swimlanes-2SLR337P-sdt7qy36.js} +1 -1
  141. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-rz309qrx.js +8 -0
  142. package/dist/client/static/js/{timeline-definition-EJHVYXUP-0re95wtn.js → timeline-definition-EJHVYXUP-rv8qyr8b.js} +2 -2
  143. package/dist/client/static/js/treeView-Q6P3EWNA-g2bkjr4z.js +1 -0
  144. package/dist/client/static/js/treemap-WGGIJYW6-pj7yw9rw.js +1 -0
  145. package/dist/client/static/js/tsx-xjp2ds8g.js +1 -0
  146. package/dist/client/static/js/typescript-yg97da8h.js +1 -0
  147. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-yrje14qp.js → usecaseDiagram-POWQR4AR-w6ew1red.js} +2 -2
  148. package/dist/client/static/js/{vennDiagram-UO4OBE2U-jxkmrfy5.js → vennDiagram-UO4OBE2U-p9axw7ch.js} +1 -1
  149. package/dist/client/static/js/{vue-d5gpjfgn.js → vue-xpemy62d.js} +1 -1
  150. package/dist/client/static/js/wardley-WFR3VGLG-c7ekf8r2.js +1 -0
  151. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-d3v2m9b1.js → wardleyDiagram-VNRHLVJA-5ewc8s4p.js} +1 -1
  152. package/dist/client/static/js/xml-nrb23phz.js +1 -0
  153. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-9a1s1rjt.js → xychartDiagram-PMCCYNJV-7n4gn7k6.js} +2 -2
  154. package/dist/client/static/js/yaml-sqs6pjpx.js +1 -0
  155. package/marketplace/marketplace.json +34 -7
  156. package/marketplace/plugins/kanban/README.md +143 -0
  157. package/marketplace/plugins/kanban/icon.svg +5 -0
  158. package/marketplace/plugins/kanban/package.json +30 -0
  159. package/marketplace/plugins/kanban/src/app.tsx +34 -0
  160. package/marketplace/plugins/kanban/src/mcp-tools.ts +296 -0
  161. package/marketplace/plugins/kanban/src/mcp.test.ts +199 -0
  162. package/marketplace/plugins/kanban/src/mcp.ts +148 -0
  163. package/marketplace/plugins/kanban/src/panel/CardSheet.tsx +319 -0
  164. package/marketplace/plugins/kanban/src/panel/CardTile.tsx +97 -0
  165. package/marketplace/plugins/kanban/src/panel/StageColumn.tsx +116 -0
  166. package/marketplace/plugins/kanban/src/panel/StageSheet.tsx +249 -0
  167. package/marketplace/plugins/kanban/src/panel/catalogs.ts +114 -0
  168. package/marketplace/plugins/kanban/src/panel/index.tsx +327 -0
  169. package/marketplace/plugins/kanban/src/panel/panel.test.ts +219 -0
  170. package/marketplace/plugins/kanban/src/panel/start-work.ts +132 -0
  171. package/marketplace/plugins/kanban/src/panel/use-board.ts +148 -0
  172. package/marketplace/plugins/kanban/src/panel/use-card-detail.ts +70 -0
  173. package/marketplace/plugins/kanban/src/panel/use-writes.ts +123 -0
  174. package/marketplace/plugins/kanban/src/protocol.ts +180 -0
  175. package/marketplace/plugins/kanban/src/server.test.ts +113 -0
  176. package/marketplace/plugins/kanban/src/server.ts +227 -0
  177. package/marketplace/plugins/kanban/src/store/board.test.ts +311 -0
  178. package/marketplace/plugins/kanban/src/store/board.ts +147 -0
  179. package/marketplace/plugins/kanban/src/store/cards.ts +228 -0
  180. package/marketplace/plugins/kanban/src/store/fs.ts +159 -0
  181. package/marketplace/plugins/kanban/src/store/ops.ts +245 -0
  182. package/marketplace/plugins/kanban/src/store/resolve.test.ts +82 -0
  183. package/marketplace/plugins/kanban/src/store/resolve.ts +135 -0
  184. package/marketplace/plugins/kanban/tsconfig.json +26 -0
  185. package/package.json +2 -2
  186. package/src/client/components/common/file-icon/index.tsx +1 -1
  187. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +12 -3
  188. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +34 -7
  189. package/src/client/components/layout/desktop-layout/index.tsx +17 -22
  190. package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +2 -0
  191. package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +11 -3
  192. package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.test.tsx +21 -0
  193. package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +8 -4
  194. package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +8 -2
  195. package/src/client/components/settings/categories/appearance-settings/ThemeGrid.tsx +15 -4
  196. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +21 -0
  197. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +7 -1
  198. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +3 -1
  199. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +1 -1
  200. package/src/client/components/workspace/editor/FilePane.tsx +4 -2
  201. package/src/client/components/workspace/editor/Tabs.tsx +7 -1
  202. package/src/client/components/workspace/editor/Toolbar.tsx +7 -1
  203. package/src/client/components/workspace/editor/chrome-rows.test.tsx +126 -0
  204. package/src/client/components/workspace/editor/viewers/HtmlPreview.test.tsx +94 -0
  205. package/src/client/components/workspace/editor/viewers/HtmlPreview.tsx +71 -0
  206. package/src/client/components/workspace/editor/viewers/bytes.ts +1 -1
  207. package/src/client/components/workspace/editor/viewers/dispatch.tsx +18 -2
  208. package/src/client/components/workspace/editor/viewers/viewers.test.ts +14 -1
  209. package/src/client/components/workspace/panel-header/index.test.tsx +2 -1
  210. package/src/client/components/workspace/panel-header/index.tsx +6 -4
  211. package/src/client/hooks/editor/resolve-viewer.ts +1 -1
  212. package/src/client/hooks/editor/use-editor-drop.ts +14 -0
  213. package/src/client/hooks/editor/use-editor-tab-state.ts +5 -4
  214. package/src/client/hooks/ui/media-query.ts +27 -0
  215. package/src/client/hooks/workspace/file-tabs.ts +10 -0
  216. package/src/client/hooks/workspace/right-panel-presence.test.ts +152 -0
  217. package/src/client/hooks/workspace/right-panel-presence.ts +119 -0
  218. package/src/client/lib/router/search-params.test.ts +83 -0
  219. package/src/client/lib/router/search-params.ts +14 -3
  220. package/src/server/lib/mcp/session-mcp.test.ts +64 -1
  221. package/src/server/lib/mcp/session-overlay.server.ts +7 -4
  222. package/src/server/lib/omp/rpc/constants.test.ts +31 -0
  223. package/src/server/lib/omp/rpc/constants.ts +19 -0
  224. package/src/server/lib/omp/rpc/session-new.ts +78 -0
  225. package/src/server/lib/omp/rpc/session-registry.ts +22 -49
  226. package/src/server/lib/omp/rpc/spawn-mcp.ts +8 -1
  227. package/src/server/lib/omp/session/blobs.server.ts +2 -1
  228. package/src/server/lib/plugins/e2e.test.ts +71 -2
  229. package/src/server/lib/plugins/loader.server.ts +20 -1
  230. package/src/server/lib/plugins/module-import.server.ts +45 -0
  231. package/src/server/routes/agent/new-prompt.test.ts +81 -0
  232. package/src/server/routes/agent/new.ts +78 -4
  233. package/src/server/routes/fs/raw.test.ts +12 -0
  234. package/src/server/routes/fs/raw.ts +2 -6
  235. package/src/server/routes/wiki/asset.ts +1 -1
  236. package/src/shared/lib/fs/document-kind.test.ts +39 -2
  237. package/src/shared/lib/fs/document-kind.ts +49 -1
  238. package/src/shared/lib/fs/file-kind.test.ts +30 -3
  239. package/src/shared/lib/fs/file-kind.ts +7 -104
  240. package/src/shared/lib/fs/mime.ts +159 -0
  241. package/src/shared/lib/workspace/sidebar-width.test.ts +34 -0
  242. package/src/shared/lib/workspace/sidebar-width.ts +33 -0
  243. package/src/shared/lib/workspace/workspace-panel-widths.test.ts +124 -0
  244. package/src/shared/lib/workspace/workspace-panel-widths.ts +115 -18
  245. package/dist/client/static/js/ImageView-jkrdrq8v.js +0 -1
  246. package/dist/client/static/js/LayoutWrapper-sh634350.js +0 -2
  247. package/dist/client/static/js/architecture-7GRP2DOG-pvb4d65d.js +0 -1
  248. package/dist/client/static/js/bash-8d8z8zrg.js +0 -1
  249. package/dist/client/static/js/cpp-620mvjkk.js +0 -1
  250. package/dist/client/static/js/css-bt76kxbq.js +0 -1
  251. package/dist/client/static/js/cynefin-OW5HDTMX-gmx4vean.js +0 -1
  252. package/dist/client/static/js/eventmodeling-NTZA5JFV-vrnheyh7.js +0 -1
  253. package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +0 -1
  254. package/dist/client/static/js/gitGraph-4MIJSDKK-n6wnc8st.js +0 -1
  255. package/dist/client/static/js/graphql-j1a6zp7m.js +0 -1
  256. package/dist/client/static/js/index-5ka2tyf9.js +0 -3
  257. package/dist/client/static/js/index-83rkg916.js +0 -2
  258. package/dist/client/static/js/index-dpy3ewrn.css +0 -1
  259. package/dist/client/static/js/index-vkqb4dnt.js +0 -1
  260. package/dist/client/static/js/index-xwjbq003.js +0 -2
  261. package/dist/client/static/js/info-A6RAGUB7-1xtdxjz2.js +0 -1
  262. package/dist/client/static/js/ini-5f4zqtqr.js +0 -1
  263. package/dist/client/static/js/java-jj41mty3.js +0 -1
  264. package/dist/client/static/js/json-rnh2h17x.js +0 -1
  265. package/dist/client/static/js/jsx-4gecrt29.js +0 -1
  266. package/dist/client/static/js/lua-zszaw2f7.js +0 -1
  267. package/dist/client/static/js/markdown-nm6gw4v4.js +0 -1
  268. package/dist/client/static/js/one-dark-pro-09d8p5vy.js +0 -1
  269. package/dist/client/static/js/one-light-g3ednt6p.js +0 -1
  270. package/dist/client/static/js/packet-AYTQ26CC-zm1r82x5.js +0 -1
  271. package/dist/client/static/js/pie-WAS4IAKB-sqa7321j.js +0 -1
  272. package/dist/client/static/js/properties-rkptax7r.js +0 -1
  273. package/dist/client/static/js/python-qf1se1mj.js +0 -1
  274. package/dist/client/static/js/r-ms0cygq2.js +0 -1
  275. package/dist/client/static/js/radar-RG4KPBEZ-z3z82syp.js +0 -1
  276. package/dist/client/static/js/railroad-74A4TZTK-z6swcqq2.js +0 -1
  277. package/dist/client/static/js/railroad-abnf-HS5TGJTU-33km6py4.js +0 -1
  278. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zbf1xmq.js +0 -1
  279. package/dist/client/static/js/railroad-peg-WCYAUIDC-wte1xzzy.js +0 -1
  280. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-6y8zdbm4.js +0 -8
  281. package/dist/client/static/js/treeView-Q6P3EWNA-pvgx6n22.js +0 -1
  282. package/dist/client/static/js/treemap-WGGIJYW6-3n9zm628.js +0 -1
  283. package/dist/client/static/js/tsx-gx7td06z.js +0 -1
  284. package/dist/client/static/js/typescript-1a808spn.js +0 -1
  285. package/dist/client/static/js/wardley-WFR3VGLG-7m07ewc4.js +0 -1
  286. package/dist/client/static/js/xml-3117mxd9.js +0 -1
  287. package/dist/client/static/js/yaml-dmvh8vyt.js +0 -1
@@ -1,9 +1,9 @@
1
- import{d,n,o,K,i,u,a,xr,e,s,Ua,Ee,Ga,m,Pn,Se,L,_,at,f,B,se,ot,re,fe,me,$n,sn,zn,P,D,Ea,U,Ba,fn,b,_r,Bo,er,jp,Ie,S,Hp,hg,gr,Ar,bt,st,ue,ed,mi,Z,ct,ut,yt,il,He,be,J}from"./index-4cag7w6k.js";import{zp,kr}from"./index-c9e417cs.js";var jt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},Ve=s(jt);var Ut={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},Ye=s(Ut);function Xe({message:t,hasStagedChanges:l,isBusy:c=!1,amend:r=!1,seeded:p=!1,isGenerating:h=!1,suggestion:g=null,generated:v=!1,onToggleAmend:N,onChangeMessage:M,onCommit:w,onGenerate:C,onUseSuggestion:R,onDismissSuggestion:G}){let T=t.trim().length>0&&!c&&(r||l),y=(r||l)&&!c&&!h,x=r?"Rewrite the previous commit with this message":l?"Commit staged changes":"Stage changes first",k=h?"Generating…":r||l?"Generate a commit message from the staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[g&&e("div",{className:"rounded border border-ink/20 bg-paper p-2.5 space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Generated message"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:R,className:"px-2 py-0.5 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:"Use"}),e("button",{type:"button",onClick:G,className:"px-2 py-0.5 rounded border border-ink/20 text-ink/70 text-[10px] font-medium hover:bg-ink/5 transition-colors cursor-pointer",children:"Dismiss"})]})]}),e("pre",{className:"whitespace-pre-wrap break-words text-[11px] text-ink/80 font-mono max-h-32 overflow-y-auto",children:g})]}),e("textarea",{value:t,onChange:(A)=>M(A.currentTarget.value),onKeyDown:(A)=>{if(A.key==="Enter"&&(A.metaKey||A.ctrlKey)&&T)A.preventDefault(),w()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),v&&t.trim().length>0&&e("div",{className:"flex items-center gap-1 text-[10px] text-ink/40",children:[e(Se,{size:10})," Generated from staged changes"]}),e("div",{className:"flex flex-wrap items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(A)=>N?.(A.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"Amend"]}),r&&p&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:C,disabled:!y,title:k,"aria-label":"Generate commit message with AI",className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[h?e(m,{size:12,className:"animate-spin"}):e(Se,{size:12}),h?"Generating…":"Generate"]}),e("button",{type:"button",onClick:w,disabled:!T,title:x,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function Ze({operation:t,conflicts:l,isBusy:c,onAbort:r,onContinue:p}){let h=Bo[t],g=l.length,v=g===0,N=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(_,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[h.charAt(0).toUpperCase()+h.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${g} conflict${g===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:l.map((M)=>e("div",{className:"truncate",title:M,children:M},M))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:c,title:`Abort the ${h} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(fn,{size:12}),"Abort ",h]}),N&&e("button",{type:"button",onClick:p,disabled:c||!v,title:v?`Conclude the ${h}`:`Resolve all ${g} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e($n,{size:12}),"Continue ",h]})]})]})}function Qe({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:N,onManageBranches:M,optionsRef:w,showOptions:C,setShowOptions:R,onHistory:G,onGraph:T,viewMode:y,setViewMode:x,isBusy:k=!1,syncCount:A={ahead:0,behind:0},syncing:F=!1,onSync:O,onFetch:V,detached:E=!1}){return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>c(!l),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:E?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(me,{size:12,className:E?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${E?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),l&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-56 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[p.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),p.map((H)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(H),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:H}),r===H&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==H&&e("button",{type:"button",onClick:()=>{v(H),c(!1)},title:`Merge ${H} into ${r}`,"aria-label":`Merge ${H} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e($n,{size:12})})]},H))]}),h.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),h.map((H)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(H),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:H}),r===H&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==H&&e("button",{type:"button",onClick:()=>{v(H),c(!1)},title:`Merge ${H} into ${r}`,"aria-label":`Merge ${H} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e($n,{size:12})})]},H))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{N(),c(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(P,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:M,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(Ba,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:w,children:[e("button",{type:"button",onClick:V,disabled:k,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(Ua,{size:13})}),e("button",{type:"button",onClick:O,disabled:k,title:F?"Syncing with upstream…":A.ahead>0&&A.behind>0?`Pull ${A.behind} then push ${A.ahead} commit(s)`:A.ahead>0?`Push ${A.ahead} commit(s)`:A.behind>0?`Pull ${A.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":F,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${F?"":"disabled:opacity-40"}`,children:[e(D,{size:13,className:F?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",A.ahead," ↓",A.behind]})]}),e("button",{type:"button",onClick:G,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Pn,{size:13})}),e("button",{type:"button",onClick:T,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e($n,{size:13})}),e("button",{type:"button",onClick:()=>R(!C),title:"View Options","aria-label":"View Options","aria-expanded":C,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Ee,{size:13})}),C&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{x("flat"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ye,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),y==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{x("tree"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ve,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),y==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Je({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e(bt,{left:e(d,{children:[e(zp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(kr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:l,scanning:p,onRefreshRepos:v})]}),right:e(st,{label:"Refresh",onClick:g,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let h=er(t.status,l),{charStatus:g,colorClass:v}=h,N=t.file.split("/"),M=N.pop()||t.file,w=N.length>0?N.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:l,status:g,repo:c||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${h.label}`,children:g}),e(ct,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:M}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!l&&e(d,{children:[e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(fn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(P,{size:11})})]}),l&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(sn,{size:11})})]})})]})}function et({change:t,repo:l,rootPath:c,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),N=t.file.split("/"),M=N.pop()||t.file,w=N.length>0?N.join("/"):"",C=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:l,root:c}}))},R=async()=>{let y=!p;if(h(y),y&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)x.set("root",c);try{let A=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(A.markers??{})}catch{v({})}}},G=g?.ours||"ours",T=g?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:C,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Ga,{size:11,className:"text-warning flex-shrink-0"}),e(ct,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:M}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w}),_r(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),R()},title:p?"Hide resolve actions":"Show resolve actions","aria-label":p?"Hide resolve actions":"Show resolve actions","aria-expanded":p,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors flex-shrink-0",children:p?e(ot,{size:11}):e(B,{size:11})})]}),p&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${G} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",G]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${T} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",T]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Wt(t){let l={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let p=r.file.replace(/^[./]+/,""),h=p.endsWith("/"),g=p.replace(/\/$/,"").split("/").filter(Boolean),v=l,N="";for(let M=0;M<g.length;M++){let w=g[M];N=N?`${N}/${w}`:w;let C=M===g.length-1;if(C&&!h)v.children.push({id:N,name:w,path:N,type:"file",change:r,children:[],changeCount:1});else{let G=v.children.find((T)=>T.type==="folder"&&T.name===w);if(!G)G={id:N,name:w,path:N,type:"folder",children:[],changeCount:0,change:C&&h?r:void 0},v.children.push(G);v=G}}}function c(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=c(h);return r.changeCount=p,r.children.sort((h,g)=>{if(h.type==="folder"&&g.type==="file")return-1;if(h.type==="file"&&g.type==="folder")return 1;return h.name.localeCompare(g.name)}),p}return c(l),l.children}function tt(t){let{sessionId:l,ready:c,read:r}=Hp(),p=u(()=>Wt(t),[t]),h=u(()=>{let R=new Set;function G(T){for(let y of T)if(y.type==="folder"){if(R.add(y.id),y.children&&y.children.length>0)G(y.children)}}return G(p),R},[p]),[g,v]=S("git.expandedFolders",[]),N=u(()=>new Set(g),[g]),M=i(null);o(()=>{if(!c||M.current===l)return;if(h.size===0)return;if(M.current=l,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[c,l,h,r,v]);let w=a((R)=>{v((G)=>{let T=new Set(G);if(T.has(R))T.delete(R);else T.add(R);return Array.from(T)})},[v]),C=a((R)=>N.has(R),[N]);return{tree:p,expandedFolders:N,toggleFolder:w,isFolderOpen:C,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function ze({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",N=v?c(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:N?e(B,{size:12}):e(se,{size:12})}),e(ct,{name:t.name,isFolder:!0,isOpen:N,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(fn,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(P,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(sn,{size:11})})})})]}),N&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((y)=>e(ze,{node:y,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g},y.id))})]});let M=t.change,w=er(M?.status||"M",l),{charStatus:C,colorClass:R}=w,G=M?M.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:G,staged:l,status:C,repo:h||".",root:g}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${R}`,title:`Status: ${w.label}`,children:C})}),e(ct,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:G,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("revert",G)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(fn,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("stage",G)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(P,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("unstage",G)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(sn,{size:11})})})})]})}function Oe({changes:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=tt(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((N)=>e(ze,{node:N,isStaged:l,isFolderOpen:g,toggleFolder:v,onAction:p,repo:c,rootPath:r},N.id))})}function nt({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,N]=S("git.stagedExpanded",!0),[M,w]=S("git.unstagedExpanded",!0),[C,R]=S("git.conflictsExpanded",!0),G=t.filter((x)=>_r(x.status)),T=t.filter((x)=>{if(_r(x.status))return!1;let k=x.status;return k&&k[0]!==" "&&k[0]!=="?"}),y=t.filter((x)=>{if(_r(x.status))return!1;let k=x.status;return k&&k[1]!==" "&&k[1]!=="?"||k==="??"});if(l&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[G.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!C),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:C?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:G.length})]})}),C&&G.map((x)=>e(et,{change:x,repo:r,rootPath:p,onResolve:g??(()=>{})},`conflict-${x.file}`))]}),T.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:T.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(sn,{size:12})})})]}),v&&(c==="tree"?e(Oe,{changes:T,isStaged:!0,repo:r,rootPath:p,onAction:h}):T.map((x)=>e(Fe,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),y.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>w(!M),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:M?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:y.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(fn,{size:12})}),e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(P,{size:12})})]})]}),M&&(c==="tree"?e(Oe,{changes:y,isStaged:!1,repo:r,rootPath:p,onAction:h}):y.map((x)=>e(Fe,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function rt({matches:t,loaded:l,total:c,hasMore:r,isFiltering:p}){if(p)return`${t} of ${l} loaded`;if(typeof c==="number"&&c>0)return r||l<c?`${l} of ${c}`:`${c} commits`;return r?`${l}+ commits`:`${l} commits`}function it({isGraphMode:t,onToggleMode:l,searchQuery:c,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:N,totalCount:M,hasMore:w}){let C=rt({matches:v,loaded:N,total:M,hasMore:w,isFiltering:c.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
2
- pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:[e("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[e("div",{className:"flex flex-col min-w-0",children:[e("div",{className:"flex items-center gap-2.5 min-w-0",children:[e("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),e("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/80 border border-ink/10 whitespace-nowrap",children:C})]}),e("p",{className:"text-xs text-muted mt-0.5 hidden lg:block",children:t?"Follow branch topology and inspect commits.":"Browse recent commits and inspect changed files."})]}),e("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[e("div",{className:"flex items-center text-xs lg:bg-ink/5 lg:p-0.5 lg:rounded-lg lg:border lg:border-ink/10",children:[e("button",{type:"button",onClick:()=>l(!1),title:"History view","aria-label":"History view","aria-pressed":!t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${!t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Pn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>l(!0),title:"Graph view","aria-label":"Graph view","aria-pressed":t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e($n,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:p,disabled:g,className:"tap-target flex items-center justify-center gap-1.5 p-2 rounded-md text-ink/70 transition-colors cursor-pointer text-xs disabled:opacity-40 lg:px-2.5 lg:py-1.5 lg:border lg:border-ink/15 lg:hover:bg-ink/5 lg:hover:text-ink",title:"Refresh commit history","aria-label":"Refresh commit history",children:[e(Ea,{size:13,className:g?"animate-spin text-ink":"","aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Refresh"})]}),e("button",{type:"button",onClick:h,className:"tap-target p-2 -mr-1 rounded-md hover:bg-ink/5 text-muted hover:text-ink transition-colors cursor-pointer",title:"Close modal","aria-label":"Close commit history",children:e(b,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(U,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/55","aria-hidden":"true"}),e("input",{type:"text",value:c,onChange:(R)=>r(R.currentTarget.value),placeholder:"Filter commits by message, author, or hash...","aria-label":"Filter commits",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),c&&e("button",{type:"button",onClick:()=>r(""),"aria-label":"Clear filter",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/55 hover:text-ink cursor-pointer",children:e(b,{size:12,"aria-hidden":"true"})})]})]})}var ce=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function _e(t,l){if(!t||!l)return!1;if(t===l)return!0;let c=Math.min(t.length,l.length);if(c>=4)return t.substring(0,c)===l.substring(0,c);return!1}function Re(t){let l=new Map,c=[];for(let r of t){if(typeof r.lane==="number"){l.set(r.hash,r.lane);continue}let p=c.findIndex((g)=>_e(g,r.hash)||_e(g,r.shortHash));if(p===-1)if(p=c.indexOf(null),p===-1)p=c.length,c.push(r.hash);else c[p]=r.hash;l.set(r.hash,p);let h=r.parents&&r.parents[0];if(h)c[p]=h;else c[p]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let v=r.parents[g];if(!c.some((M)=>_e(M,v))){let M=c.indexOf(null);if(M===-1)c.push(v);else c[M]=v}}}return l}function lt(t,l,c,r){let p=[],h=new Map;t.forEach((g,v)=>{if(h.set(g.hash,v),g.shortHash)h.set(g.shortHash,v);if(g.hash.length>=7)h.set(g.hash.substring(0,7),v)});for(let g of t){let v=l.get(g.hash)??0,N=c[g.hash]??0,M=ce[v%ce.length];if(!g.parents||g.parents.length===0)continue;for(let w of g.parents){let C=h.get(w);if(typeof C!=="number"&&w.length>=7)C=h.get(w.substring(0,7));if(typeof C==="number"){let R=t[C],G=l.get(R.hash)??v,T=c[R.hash]??N+60;p.push({fromHash:g.hash,toHash:R.hash,fromLane:v,toLane:G,fromY:N,toY:T,color:ce[v%ce.length]})}else p.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:v,toLane:v,fromY:N,toY:Math.max(N+80,r),color:M})}}return p}function dt(t,l,c,r){if(Math.abs(t-c)<1)return`M ${t} ${l} L ${c} ${r}`;let p=r-l,h=l+p*0.45,g=r-p*0.45;return`M ${t} ${l} C ${t} ${h}, ${c} ${g}, ${c} ${r}`}function pt({commits:t,nodePositions:l,expandedHash:c,hoveredHash:r,isGraphMode:p,laneWidth:h=18,paddingLeft:g=16,totalHeight:v}){let N=u(()=>{if(!p){let R=new Map;return t.forEach((G)=>R.set(G.hash,0)),R}return Re(t)},[t,p]),M=u(()=>{let R=0;return N.forEach((G)=>{if(G>R)R=G}),R},[N]),w=p?(M+1)*h+g*2:36,C=u(()=>{if(!p){let R=[];for(let G=0;G<t.length-1;G++){let T=l[t[G].hash]??G*60+20,y=l[t[G+1].hash]??(G+1)*60+20;R.push({fromHash:t[G].hash,toHash:t[G+1].hash,fromLane:0,toLane:0,fromY:T,toY:y,color:"var(--theme-ink)"})}return R}return lt(t,N,l,v)},[t,N,l,v,p]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:w,height:v},"aria-hidden":"true",children:e("svg",{className:"w-full h-full overflow-visible",style:{width:w,height:v},children:[C.map((R)=>{let G=p?g+R.fromLane*h:16,T=p?g+R.toLane*h:16,y=p?R.color:"currentColor",x=p?0.95:0.25,k=dt(G,R.fromY,T,R.toY);return e("path",{d:k,fill:"none",stroke:y,strokeWidth:p?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let G=N.get(R.hash)??0,T=p?g+G*h:16,y=l[R.hash]??20,x=c===R.hash||c===R.shortHash,k=r===R.hash||r===R.shortHash,A=p?ce[G%ce.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(x||k)&&e("circle",{cx:T,cy:y,r:8,fill:A,fillOpacity:x?0.35:0.2,stroke:A,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:T,cy:y,r:p?4:4.5,fill:p?"var(--theme-paper)":A,stroke:A,strokeWidth:p?2.5:1.5}),p&&e("circle",{cx:T,cy:y,r:1.8,fill:A})]},`node-${R.hash}`)})]})})}var qt=[{action:"checkout",label:"checkout"},{action:"create_branch_here",label:"create branch here"},{action:"cherry_pick",label:"cherry-pick"},{action:"revert",label:"revert"},{action:"reset",label:"reset..."},{action:"merge",label:"merge into current"},{action:"rebase",label:"rebase onto this"}];function mt({commit:t,onAction:l}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:qt.map(({action:c,label:r})=>e("button",{type:"button",onClick:(p)=>{p.stopPropagation(),l(c,t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer",children:r},c))})}var Ge=3;function Kt(t){let l=[];for(let c=0;c<t.length;c+=1){if(t[c].type!=="context"){l.push({row:t[c],index:c});continue}let r=c;while(r<t.length&&t[r].type==="context")r+=1;let p=r-c;if(p>Ge*2+1){for(let h=c;h<c+Ge;h+=1)l.push({row:t[h],index:h});l.push({row:{type:"elided",count:p-Ge*2},index:-1});for(let h=r-Ge;h<r;h+=1)l.push({row:t[h],index:h})}else for(let h=c;h<r;h+=1)l.push({row:t[h],index:h});c=r-1}return l}function ft({diffText:t,isLoading:l,filePath:c,fullContext:r=!1,onToggleContext:p}){let h=mi(),g=u(()=>{if(!t)return[];let w=[],C=1,R=1,G=t.split(/\r?\n/),y=G.some((x)=>x.startsWith("@@"))?G:[`@@ -0,0 +1,${G.length} @@`,...G.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of y){if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("---")||x.startsWith("+++")||x.startsWith("new file mode")||x.startsWith("deleted file mode")||x.startsWith("similarity index")||x.startsWith("old mode")||x.startsWith("new mode")||x.startsWith("\\ No newline"))continue;if(x.startsWith("@@")){let k=x.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(k)C=parseInt(k[1],10),R=parseInt(k[2],10);w.push({type:"meta",text:x})}else if(x.startsWith("+"))w.push({type:"add",text:x.slice(1),newNum:R++});else if(x.startsWith("-"))w.push({type:"del",text:x.slice(1),oldNum:C++});else{let k=x.startsWith(" ")?x.slice(1):x;w.push({type:"context",text:k,oldNum:C++,newNum:R++})}}return w},[t]),v=yt(c),N=u(()=>{let w=Array(g.length).fill(""),C=-1,R=(G)=>{if(C<0)return;let T=ed(g.slice(C,G).map((y)=>y.text).join(`
1
+ import{d,n,o,K,i,u,a,xr,e,s,Ua,Ee,Ga,m,Pn,Se,L,_,at,f,B,se,ot,re,fe,me,$n,sn,zn,P,D,Ea,U,Ba,fn,b,_r,Bo,er,Hp,Ie,S,Kp,vg,gr,Ar,bt,st,ue,rd,mi,Z,ct,ut,yt,ll,He,be,J}from"./index-x2v1zmth.js";import{Gp,kr}from"./index-y6ke70e6.js";var jt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},Ve=s(jt);var Ut={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},Ye=s(Ut);function Xe({message:t,hasStagedChanges:l,isBusy:c=!1,amend:r=!1,seeded:p=!1,isGenerating:h=!1,suggestion:g=null,generated:v=!1,onToggleAmend:N,onChangeMessage:M,onCommit:w,onGenerate:C,onUseSuggestion:R,onDismissSuggestion:G}){let T=t.trim().length>0&&!c&&(r||l),y=(r||l)&&!c&&!h,x=r?"Rewrite the previous commit with this message":l?"Commit staged changes":"Stage changes first",k=h?"Generating…":r||l?"Generate a commit message from the staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[g&&e("div",{className:"rounded border border-ink/20 bg-paper p-2.5 space-y-2",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-ink/45",children:"Generated message"}),e("div",{className:"flex items-center gap-1",children:[e("button",{type:"button",onClick:R,className:"px-2 py-0.5 rounded bg-ink text-canvas text-[10px] font-medium hover:bg-ink/90 transition-colors cursor-pointer",children:"Use"}),e("button",{type:"button",onClick:G,className:"px-2 py-0.5 rounded border border-ink/20 text-ink/70 text-[10px] font-medium hover:bg-ink/5 transition-colors cursor-pointer",children:"Dismiss"})]})]}),e("pre",{className:"whitespace-pre-wrap break-words text-[11px] text-ink/80 font-mono max-h-32 overflow-y-auto",children:g})]}),e("textarea",{value:t,onChange:(A)=>M(A.currentTarget.value),onKeyDown:(A)=>{if(A.key==="Enter"&&(A.metaKey||A.ctrlKey)&&T)A.preventDefault(),w()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),v&&t.trim().length>0&&e("div",{className:"flex items-center gap-1 text-[10px] text-ink/40",children:[e(Se,{size:10})," Generated from staged changes"]}),e("div",{className:"flex flex-wrap items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(A)=>N?.(A.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"Amend"]}),r&&p&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:C,disabled:!y,title:k,"aria-label":"Generate commit message with AI",className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-ink/20 text-ink/80 hover:bg-ink/5 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[h?e(m,{size:12,className:"animate-spin"}):e(Se,{size:12}),h?"Generating…":"Generate"]}),e("button",{type:"button",onClick:w,disabled:!T,title:x,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function Ze({operation:t,conflicts:l,isBusy:c,onAbort:r,onContinue:p}){let h=Bo[t],g=l.length,v=g===0,N=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(_,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[h.charAt(0).toUpperCase()+h.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${g} conflict${g===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:l.map((M)=>e("div",{className:"truncate",title:M,children:M},M))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:c,title:`Abort the ${h} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(fn,{size:12}),"Abort ",h]}),N&&e("button",{type:"button",onClick:p,disabled:c||!v,title:v?`Conclude the ${h}`:`Resolve all ${g} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e($n,{size:12}),"Continue ",h]})]})]})}function Qe({branchRef:t,showBranchMenu:l,setShowBranchMenu:c,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:N,onManageBranches:M,optionsRef:w,showOptions:C,setShowOptions:R,onHistory:G,onGraph:T,viewMode:y,setViewMode:x,isBusy:k=!1,syncCount:A={ahead:0,behind:0},syncing:F=!1,onSync:O,onFetch:V,detached:E=!1}){return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>c(!l),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:E?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(me,{size:12,className:E?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${E?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),l&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-56 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[p.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),p.map((H)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(H),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:H}),r===H&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==H&&e("button",{type:"button",onClick:()=>{v(H),c(!1)},title:`Merge ${H} into ${r}`,"aria-label":`Merge ${H} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e($n,{size:12})})]},H))]}),h.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),h.map((H)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(H),c(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:H}),r===H&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==H&&e("button",{type:"button",onClick:()=>{v(H),c(!1)},title:`Merge ${H} into ${r}`,"aria-label":`Merge ${H} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e($n,{size:12})})]},H))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{N(),c(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(P,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:M,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(Ba,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:w,children:[e("button",{type:"button",onClick:V,disabled:k,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(Ua,{size:13})}),e("button",{type:"button",onClick:O,disabled:k,title:F?"Syncing with upstream…":A.ahead>0&&A.behind>0?`Pull ${A.behind} then push ${A.ahead} commit(s)`:A.ahead>0?`Push ${A.ahead} commit(s)`:A.behind>0?`Pull ${A.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":F,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${F?"":"disabled:opacity-40"}`,children:[e(D,{size:13,className:F?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",A.ahead," ↓",A.behind]})]}),e("button",{type:"button",onClick:G,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Pn,{size:13})}),e("button",{type:"button",onClick:T,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e($n,{size:13})}),e("button",{type:"button",onClick:()=>R(!C),title:"View Options","aria-label":"View Options","aria-expanded":C,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Ee,{size:13})}),C&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{x("flat"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ye,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),y==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{x("tree"),R(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ve,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),y==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Je({activeRepo:t,repos:l,isRefreshing:c,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e(bt,{left:e(d,{children:[e(Gp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(kr,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:l,scanning:p,onRefreshRepos:v})]}),right:e(st,{label:"Refresh",onClick:g,busy:c})})}function Fe({change:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let h=er(t.status,l),{charStatus:g,colorClass:v}=h,N=t.file.split("/"),M=N.pop()||t.file,w=N.length>0?N.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:l,status:g,repo:c||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${h.label}`,children:g}),e(ct,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:M}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!l&&e(d,{children:[e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(fn,{size:11})}),e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(P,{size:11})})]}),l&&e("button",{type:"button",onClick:(R)=>{R.stopPropagation(),p("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(sn,{size:11})})]})})]})}function et({change:t,repo:l,rootPath:c,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),N=t.file.split("/"),M=N.pop()||t.file,w=N.length>0?N.join("/"):"",C=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:l,root:c}}))},R=async()=>{let y=!p;if(h(y),y&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:l||"."});if(c)x.set("root",c);try{let A=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(A.markers??{})}catch{v({})}}},G=g?.ours||"ours",T=g?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:C,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Ga,{size:11,className:"text-warning flex-shrink-0"}),e(ct,{name:M,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:M}),w&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:w}),_r(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),R()},title:p?"Hide resolve actions":"Show resolve actions","aria-label":p?"Hide resolve actions":"Show resolve actions","aria-expanded":p,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors flex-shrink-0",children:p?e(ot,{size:11}):e(B,{size:11})})]}),p&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${G} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",G]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${T} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",T]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Wt(t){let l={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let p=r.file.replace(/^[./]+/,""),h=p.endsWith("/"),g=p.replace(/\/$/,"").split("/").filter(Boolean),v=l,N="";for(let M=0;M<g.length;M++){let w=g[M];N=N?`${N}/${w}`:w;let C=M===g.length-1;if(C&&!h)v.children.push({id:N,name:w,path:N,type:"file",change:r,children:[],changeCount:1});else{let G=v.children.find((T)=>T.type==="folder"&&T.name===w);if(!G)G={id:N,name:w,path:N,type:"folder",children:[],changeCount:0,change:C&&h?r:void 0},v.children.push(G);v=G}}}function c(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=c(h);return r.changeCount=p,r.children.sort((h,g)=>{if(h.type==="folder"&&g.type==="file")return-1;if(h.type==="file"&&g.type==="folder")return 1;return h.name.localeCompare(g.name)}),p}return c(l),l.children}function tt(t){let{sessionId:l,ready:c,read:r}=Kp(),p=u(()=>Wt(t),[t]),h=u(()=>{let R=new Set;function G(T){for(let y of T)if(y.type==="folder"){if(R.add(y.id),y.children&&y.children.length>0)G(y.children)}}return G(p),R},[p]),[g,v]=S("git.expandedFolders",[]),N=u(()=>new Set(g),[g]),M=i(null);o(()=>{if(!c||M.current===l)return;if(h.size===0)return;if(M.current=l,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[c,l,h,r,v]);let w=a((R)=>{v((G)=>{let T=new Set(G);if(T.has(R))T.delete(R);else T.add(R);return Array.from(T)})},[v]),C=a((R)=>N.has(R),[N]);return{tree:p,expandedFolders:N,toggleFolder:w,isFolderOpen:C,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function ze({node:t,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",N=v?c(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:N?e(B,{size:12}):e(se,{size:12})}),e(ct,{name:t.name,isFolder:!0,isOpen:N,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(fn,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(P,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(sn,{size:11})})})})]}),N&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((y)=>e(ze,{node:y,isStaged:l,isFolderOpen:c,toggleFolder:r,onAction:p,repo:h,rootPath:g},y.id))})]});let M=t.change,w=er(M?.status||"M",l),{charStatus:C,colorClass:R}=w,G=M?M.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:G,staged:l,status:C,repo:h||".",root:g}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${R}`,title:`Status: ${w.label}`,children:C})}),e(ct,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${R}`,title:G,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!l?e(d,{children:[e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("revert",G)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(fn,{size:11})}),e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("stage",G)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(P,{size:11})})]}):e("button",{type:"button",onClick:(y)=>{y.stopPropagation(),p("unstage",G)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(sn,{size:11})})})})]})}function Oe({changes:t,isStaged:l,repo:c,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=tt(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((N)=>e(ze,{node:N,isStaged:l,isFolderOpen:g,toggleFolder:v,onAction:p,repo:c,rootPath:r},N.id))})}function nt({changes:t,isLoading:l,viewMode:c,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,N]=S("git.stagedExpanded",!0),[M,w]=S("git.unstagedExpanded",!0),[C,R]=S("git.conflictsExpanded",!0),G=t.filter((x)=>_r(x.status)),T=t.filter((x)=>{if(_r(x.status))return!1;let k=x.status;return k&&k[0]!==" "&&k[0]!=="?"}),y=t.filter((x)=>{if(_r(x.status))return!1;let k=x.status;return k&&k[1]!==" "&&k[1]!=="?"||k==="??"});if(l&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[G.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>R(!C),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:C?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:G.length})]})}),C&&G.map((x)=>e(et,{change:x,repo:r,rootPath:p,onResolve:g??(()=>{})},`conflict-${x.file}`))]}),T.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>N(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:T.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(sn,{size:12})})})]}),v&&(c==="tree"?e(Oe,{changes:T,isStaged:!0,repo:r,rootPath:p,onAction:h}):T.map((x)=>e(Fe,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),y.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>w(!M),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:M?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:y.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(fn,{size:12})}),e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(P,{size:12})})]})]}),M&&(c==="tree"?e(Oe,{changes:y,isStaged:!1,repo:r,rootPath:p,onAction:h}):y.map((x)=>e(Fe,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function rt({matches:t,loaded:l,total:c,hasMore:r,isFiltering:p}){if(p)return`${t} of ${l} loaded`;if(typeof c==="number"&&c>0)return r||l<c?`${l} of ${c}`:`${c} commits`;return r?`${l}+ commits`:`${l} commits`}function it({isGraphMode:t,onToggleMode:l,searchQuery:c,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:N,totalCount:M,hasMore:w}){let C=rt({matches:v,loaded:N,total:M,hasMore:w,isFiltering:c.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
2
+ pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:[e("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[e("div",{className:"flex flex-col min-w-0",children:[e("div",{className:"flex items-center gap-2.5 min-w-0",children:[e("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),e("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/80 border border-ink/10 whitespace-nowrap",children:C})]}),e("p",{className:"text-xs text-muted mt-0.5 hidden lg:block",children:t?"Follow branch topology and inspect commits.":"Browse recent commits and inspect changed files."})]}),e("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[e("div",{className:"flex items-center text-xs lg:bg-ink/5 lg:p-0.5 lg:rounded-lg lg:border lg:border-ink/10",children:[e("button",{type:"button",onClick:()=>l(!1),title:"History view","aria-label":"History view","aria-pressed":!t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${!t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Pn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>l(!0),title:"Graph view","aria-label":"Graph view","aria-pressed":t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e($n,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:p,disabled:g,className:"tap-target flex items-center justify-center gap-1.5 p-2 rounded-md text-ink/70 transition-colors cursor-pointer text-xs disabled:opacity-40 lg:px-2.5 lg:py-1.5 lg:border lg:border-ink/15 lg:hover:bg-ink/5 lg:hover:text-ink",title:"Refresh commit history","aria-label":"Refresh commit history",children:[e(Ea,{size:13,className:g?"animate-spin text-ink":"","aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Refresh"})]}),e("button",{type:"button",onClick:h,className:"tap-target p-2 -mr-1 rounded-md hover:bg-ink/5 text-muted hover:text-ink transition-colors cursor-pointer",title:"Close modal","aria-label":"Close commit history",children:e(b,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(U,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/55","aria-hidden":"true"}),e("input",{type:"text",value:c,onChange:(R)=>r(R.currentTarget.value),placeholder:"Filter commits by message, author, or hash...","aria-label":"Filter commits",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),c&&e("button",{type:"button",onClick:()=>r(""),"aria-label":"Clear filter",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/55 hover:text-ink cursor-pointer",children:e(b,{size:12,"aria-hidden":"true"})})]})]})}var ce=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function _e(t,l){if(!t||!l)return!1;if(t===l)return!0;let c=Math.min(t.length,l.length);if(c>=4)return t.substring(0,c)===l.substring(0,c);return!1}function Re(t){let l=new Map,c=[];for(let r of t){if(typeof r.lane==="number"){l.set(r.hash,r.lane);continue}let p=c.findIndex((g)=>_e(g,r.hash)||_e(g,r.shortHash));if(p===-1)if(p=c.indexOf(null),p===-1)p=c.length,c.push(r.hash);else c[p]=r.hash;l.set(r.hash,p);let h=r.parents&&r.parents[0];if(h)c[p]=h;else c[p]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let v=r.parents[g];if(!c.some((M)=>_e(M,v))){let M=c.indexOf(null);if(M===-1)c.push(v);else c[M]=v}}}return l}function lt(t,l,c,r){let p=[],h=new Map;t.forEach((g,v)=>{if(h.set(g.hash,v),g.shortHash)h.set(g.shortHash,v);if(g.hash.length>=7)h.set(g.hash.substring(0,7),v)});for(let g of t){let v=l.get(g.hash)??0,N=c[g.hash]??0,M=ce[v%ce.length];if(!g.parents||g.parents.length===0)continue;for(let w of g.parents){let C=h.get(w);if(typeof C!=="number"&&w.length>=7)C=h.get(w.substring(0,7));if(typeof C==="number"){let R=t[C],G=l.get(R.hash)??v,T=c[R.hash]??N+60;p.push({fromHash:g.hash,toHash:R.hash,fromLane:v,toLane:G,fromY:N,toY:T,color:ce[v%ce.length]})}else p.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:v,toLane:v,fromY:N,toY:Math.max(N+80,r),color:M})}}return p}function dt(t,l,c,r){if(Math.abs(t-c)<1)return`M ${t} ${l} L ${c} ${r}`;let p=r-l,h=l+p*0.45,g=r-p*0.45;return`M ${t} ${l} C ${t} ${h}, ${c} ${g}, ${c} ${r}`}function pt({commits:t,nodePositions:l,expandedHash:c,hoveredHash:r,isGraphMode:p,laneWidth:h=18,paddingLeft:g=16,totalHeight:v}){let N=u(()=>{if(!p){let R=new Map;return t.forEach((G)=>R.set(G.hash,0)),R}return Re(t)},[t,p]),M=u(()=>{let R=0;return N.forEach((G)=>{if(G>R)R=G}),R},[N]),w=p?(M+1)*h+g*2:36,C=u(()=>{if(!p){let R=[];for(let G=0;G<t.length-1;G++){let T=l[t[G].hash]??G*60+20,y=l[t[G+1].hash]??(G+1)*60+20;R.push({fromHash:t[G].hash,toHash:t[G+1].hash,fromLane:0,toLane:0,fromY:T,toY:y,color:"var(--theme-ink)"})}return R}return lt(t,N,l,v)},[t,N,l,v,p]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:w,height:v},"aria-hidden":"true",children:e("svg",{className:"w-full h-full overflow-visible",style:{width:w,height:v},children:[C.map((R)=>{let G=p?g+R.fromLane*h:16,T=p?g+R.toLane*h:16,y=p?R.color:"currentColor",x=p?0.95:0.25,k=dt(G,R.fromY,T,R.toY);return e("path",{d:k,fill:"none",stroke:y,strokeWidth:p?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${R.fromHash}->${R.toHash}`)}),t.map((R)=>{let G=N.get(R.hash)??0,T=p?g+G*h:16,y=l[R.hash]??20,x=c===R.hash||c===R.shortHash,k=r===R.hash||r===R.shortHash,A=p?ce[G%ce.length]:"var(--theme-success)";return e("g",{"data-commit-node":R.hash,children:[(x||k)&&e("circle",{cx:T,cy:y,r:8,fill:A,fillOpacity:x?0.35:0.2,stroke:A,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:T,cy:y,r:p?4:4.5,fill:p?"var(--theme-paper)":A,stroke:A,strokeWidth:p?2.5:1.5}),p&&e("circle",{cx:T,cy:y,r:1.8,fill:A})]},`node-${R.hash}`)})]})})}var qt=[{action:"checkout",label:"checkout"},{action:"create_branch_here",label:"create branch here"},{action:"cherry_pick",label:"cherry-pick"},{action:"revert",label:"revert"},{action:"reset",label:"reset..."},{action:"merge",label:"merge into current"},{action:"rebase",label:"rebase onto this"}];function mt({commit:t,onAction:l}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:qt.map(({action:c,label:r})=>e("button",{type:"button",onClick:(p)=>{p.stopPropagation(),l(c,t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer",children:r},c))})}var Ge=3;function Kt(t){let l=[];for(let c=0;c<t.length;c+=1){if(t[c].type!=="context"){l.push({row:t[c],index:c});continue}let r=c;while(r<t.length&&t[r].type==="context")r+=1;let p=r-c;if(p>Ge*2+1){for(let h=c;h<c+Ge;h+=1)l.push({row:t[h],index:h});l.push({row:{type:"elided",count:p-Ge*2},index:-1});for(let h=r-Ge;h<r;h+=1)l.push({row:t[h],index:h})}else for(let h=c;h<r;h+=1)l.push({row:t[h],index:h});c=r-1}return l}function ft({diffText:t,isLoading:l,filePath:c,fullContext:r=!1,onToggleContext:p}){let h=mi(),g=u(()=>{if(!t)return[];let w=[],C=1,R=1,G=t.split(/\r?\n/),y=G.some((x)=>x.startsWith("@@"))?G:[`@@ -0,0 +1,${G.length} @@`,...G.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of y){if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("---")||x.startsWith("+++")||x.startsWith("new file mode")||x.startsWith("deleted file mode")||x.startsWith("similarity index")||x.startsWith("old mode")||x.startsWith("new mode")||x.startsWith("\\ No newline"))continue;if(x.startsWith("@@")){let k=x.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(k)C=parseInt(k[1],10),R=parseInt(k[2],10);w.push({type:"meta",text:x})}else if(x.startsWith("+"))w.push({type:"add",text:x.slice(1),newNum:R++});else if(x.startsWith("-"))w.push({type:"del",text:x.slice(1),oldNum:C++});else{let k=x.startsWith(" ")?x.slice(1):x;w.push({type:"context",text:k,oldNum:C++,newNum:R++})}}return w},[t]),v=yt(c),N=u(()=>{let w=Array(g.length).fill(""),C=-1,R=(G)=>{if(C<0)return;let T=rd(g.slice(C,G).map((y)=>y.text).join(`
3
3
  `),v);for(let y=C;y<G;y++)w[y]=T[y-C]??"";C=-1};return g.forEach((G,T)=>{if(G.type==="meta")R(T);else if(C<0)C=T}),R(g.length),w},[g,v,h]),M=u(()=>r?g.map((w,C)=>({row:w,index:C})):Kt(g),[g,r]);if(l)return e("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs flex items-center justify-center",children:"Loading commit diff..."});if(!t||g.length===0)return e("div",{className:"my-2 p-3 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs text-center",children:"No diff content available for this file."});return e("div",{className:"my-2 rounded border border-ink/15 bg-paper overflow-hidden text-[11px] font-mono leading-relaxed text-ink",children:[e("div",{className:"flex items-center justify-between px-3 py-1.5 bg-canvas border-b border-ink/10 text-ink/70 text-[10.5px]",children:[e("span",{className:"font-semibold text-muted",children:"Diff preview"}),e("button",{type:"button",onClick:p,disabled:!p,className:"hover:text-ink flex items-center gap-1 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-default",title:r?"Show only the changed hunks":"Read the whole file around the change","aria-pressed":r,children:r?e(d,{children:[e(ot,{size:12,"aria-hidden":"true"})," Collapse context"]}):e(d,{children:[e(B,{size:12,"aria-hidden":"true"})," Expand all context"]})})]}),e("div",{className:"overflow-x-auto max-h-72 select-text",children:e("div",{className:"w-max min-w-full divide-y divide-ink/[0.04]",children:M.map(({row:w,index:C},R)=>{if(w.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-muted text-[10px] text-center select-none",title:`${w.count} unchanged line(s) hidden`,children:["⋯ ",w.count," unchanged line",w.count===1?"":"s"," hidden ⋯"]},`elided-${R}`);let G=w,T=C;if(G.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-muted text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:G.text})]},T);let y=G.type==="add",x=G.type==="del";return e("div",{className:`flex items-start font-mono ${y?"bg-success/10 hover:bg-success/15":x?"bg-error/10 hover:bg-error/15":"text-ink hover:bg-ink/[0.02]"}`,children:[e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${x?"bg-error/15 text-ink/80 font-semibold":y?"bg-success/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.oldNum??(y?"+":"")}),e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${y?"bg-success/15 text-ink/80 font-semibold":x?"bg-error/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.newNum??(x?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${y||x?"text-ink/80":"opacity-0"}`,children:y?"+":x?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:G.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:N[T]}}):" "})]},T)})})})]})}function ht({commit:t,isExpanded:l,onToggleExpand:c,onAction:r,onToggleFile:p,isExpandedFile:h,isLoadingFile:g,isFullContextFile:v,onToggleContext:N,fileDiffs:M,headerRef:w}){let[C,R]=n(!1),G=t.body?.trim()??"",T=G.length>0,y=t.files??[],x=y.length,k=x>0,A=T||k,F=(E)=>{E.stopPropagation(),navigator.clipboard.writeText(t.hash),R(!0),setTimeout(()=>R(!1),2000)},O=(E,H)=>{E.stopPropagation(),p(t.hash,H)},V=A?"border-b border-ink/5 transition-colors cursor-pointer hover:bg-ink/[0.015]":"border-b border-ink/5";return e("div",{onClick:A?c:void 0,"data-testid":"commit-row","data-commit-hash":t.hash,className:V,children:e("div",{className:"py-2.5 flex flex-col",children:[e("div",{className:"flex flex-col gap-1",children:[t.refs&&t.refs.length>0&&e("div",{className:"flex flex-wrap items-center gap-1.5 pb-0.5",children:t.refs.map((E,H)=>{let Q=E.includes("stash"),Y=E.includes("HEAD")||E.includes("main")||E.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${Q?"bg-warning/10 text-ink/80 border-warning/25 font-semibold":Y?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-muted border-ink/10 font-medium"}`,children:E},H)})}),e("div",{ref:w,className:"flex items-start gap-1.5",children:e("button",{type:"button",onClick:A?(E)=>{E.stopPropagation(),c()}:void 0,"aria-expanded":A?l:void 0,className:"flex flex-1 min-w-0 items-start gap-1.5 text-left cursor-pointer rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20",children:[e("span",{"data-commit-title":"",className:"text-[13px] font-semibold text-ink leading-snug break-words flex-1 min-w-0",children:t.message}),A&&e("span",{className:"text-ink/55 flex-shrink-0 mt-0.5","aria-hidden":"true",children:l?e(B,{size:13}):e(se,{size:13})})]})}),T&&l&&e("div",{className:"border-l-2 border-ink/15 pl-3 py-1",children:e(J,{content:G,className:"text-ink/70"})}),e("div",{className:"flex items-center gap-x-2 gap-y-0.5 text-[11px] text-muted font-mono flex-wrap",children:[e("span",{children:t.author}),e("span",{children:t.date}),e("button",{type:"button",onClick:F,title:"Copy commit hash","aria-label":`Copy commit hash ${t.shortHash}`,className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[e("span",{children:t.shortHash}),C?e(f,{size:11,className:"text-success-text","aria-hidden":"true"}):e(re,{size:11,"aria-hidden":"true"})]}),k&&e("span",{children:[x," ",x===1?"file":"files"]})]})]}),l&&e("div",{className:"mt-2",children:e(mt,{commit:t,onAction:r})}),k&&l&&e("div",{className:"mt-2 flex flex-col gap-1",children:y.map((E,H)=>{let Q=h(t.hash,E.file),Y=`${t.hash}:${E.file}`,z=M[Y]!==void 0?M[Y]:E.diff,I=g(t.hash,E.file),W=E.status==="A"?"text-success-text font-bold":E.status==="D"?"text-error-text font-bold":E.status==="R"?"text-meta-text font-bold":"text-info-text font-bold";return e("div",{className:"flex flex-col",children:[e("button",{type:"button",onClick:(oe)=>O(oe,E),"aria-expanded":Q,className:"flex w-full items-center gap-2 py-1 px-2 rounded text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10 text-left",children:[e("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${W}`,children:E.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:E.file}),e("span",{className:"flex items-center gap-1 text-[10.5px] tabular-nums flex-shrink-0 font-medium",children:[e("span",{className:"text-success-text",children:["+",E.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error-text",children:["-",E.deletions]})]}),e("span",{className:"text-ink/55 group-hover:text-ink flex-shrink-0",children:Q?e(B,{size:13,"aria-hidden":"true"}):e(se,{size:13,"aria-hidden":"true"})})]}),Q&&e("div",{className:"pl-4 pr-1",children:e(ft,{diffText:z,isLoading:I,filePath:E.file,fullContext:v(t.hash,E.file),onToggleContext:()=>N(t.hash,E)})})]},H)})})]})})}var xe=50;function Vt(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c;if(typeof r.file!=="string"||!r.file)continue;l.push({file:r.file,status:typeof r.status==="string"?r.status:"M",additions:typeof r.additions==="number"&&Number.isFinite(r.additions)?r.additions:0,deletions:typeof r.deletions==="number"&&Number.isFinite(r.deletions)?r.deletions:0,diff:typeof r.diff==="string"?r.diff:void 0})}return l}function je(t){if(!Array.isArray(t))return[];let l=[];for(let c of t){if(!c||typeof c!=="object")continue;let r=c,p=typeof r.hash==="string"&&r.hash?r.hash:"";if(!p)continue;l.push({hash:p,shortHash:typeof r.shortHash==="string"&&r.shortHash?r.shortHash:p.slice(0,8),author:typeof r.author==="string"?r.author:"Unknown",date:typeof r.date==="string"?r.date:typeof r.time==="string"?r.time:"",message:typeof r.message==="string"?r.message:"",body:typeof r.body==="string"?r.body:void 0,parents:Array.isArray(r.parents)?r.parents.filter((h)=>typeof h==="string"):[],refs:Array.isArray(r.refs)?r.refs.filter((h)=>typeof h==="string"):[],files:Vt(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return l}function gt({output:t,isGraphMode:l,rootPath:c,activeRepo:r}){let[p,h]=n(!1),[g,v]=n(t?.hasMore??t?.data?.length===xe),[N,M]=n(t?.total),w=u(()=>je(t?.data),[t?.data]),C=Array.isArray(t?.data)?t.data.length:0,[R,G]=n(w),[T,y]=n(C);o(()=>{if(G(w),y(C),v(t?.hasMore??C===xe),typeof t?.total==="number")M(t.total)},[w,C,t?.hasMore,t?.total]);let x=a(async()=>{if(p||!g)return;h(!0);try{let k=new FormData;if(k.set("actionType",l?"graph":"history"),k.set("limit",String(xe)),k.set("skip",String(T)),c)k.set("root",c);if(r)k.set("repo",r);let F=await(await fetch("/api/fs/git",{method:"POST",body:k})).json();if(F.success&&Array.isArray(F.data)){let O=je(F.data),V=F.data.length;if(G((E)=>{let H=new Set(E.map((Y)=>Y.hash)),Q=O.filter((Y)=>!H.has(Y.hash));return[...E,...Q]}),y((E)=>E+V),v(Boolean(F.hasMore??V===xe)),typeof F.total==="number")M(F.total)}else v(!1)}catch(k){console.error("Failed to load more commits:",k)}finally{h(!1)}},[p,g,l,T,c,r]);return{commits:R,hasMore:g,totalCount:N,isLoadingMore:p,handleLoadMore:x}}function xt({onExecuteAction:t,rootPath:l,activeRepo:c}){let[r,p]=n({}),[h,g]=n(new Set),[v,N]=n(new Set),[M,w]=n(new Set),C=a(async(y,x,k)=>{let A=`${y}:${x.file}`;N((F)=>new Set(F).add(A));try{let F=new FormData;if(F.set("actionType","commit_diff"),F.set("hash",y),F.set("file",x.file),k)F.set("full","1");if(l)F.set("root",l);if(c&&c!==".")F.set("repo",c);let V=await(await fetch("/api/fs/git",{method:"POST",body:F})).json();if(V&&typeof V.diff==="string")p((E)=>({...E,[A]:V.diff}));else if(V&&V.error)p((E)=>({...E,[A]:`// Error: ${V.error}`}))}catch(F){console.error("Failed to load file diff:",F);let O=F instanceof Error?F.message:"Network error";p((V)=>({...V,[A]:`// Error loading diff: ${O}`}))}finally{N((F)=>{let O=new Set(F);return O.delete(A),O})}},[l,c]),R=a(async(y,x)=>{let k=`${y}:${x.file}`,A=!h.has(k);if(g((F)=>{let O=new Set(F);if(O.has(k))O.delete(k);else O.add(k);return O}),A&&r[k]===void 0&&!x.diff)await C(y,x,!1)},[h,r,C]),G=a(async(y,x)=>{let k=`${y}:${x.file}`,A=!M.has(k);w((F)=>{let O=new Set(F);if(O.has(k))O.delete(k);else O.add(k);return O}),await C(y,x,A)},[M,C]),T=a((y,x)=>{if(!t)return;if(y==="checkout")t("checkout",void 0,{branch:x.hash});else if(y==="create_branch_here"){let k=window.prompt(`Create new branch at commit ${x.shortHash}:`,`branch-${x.shortHash}`);if(k?.trim())t("create_branch_at",void 0,{branch:k.trim(),hash:x.hash})}else if(y==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${x.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:x.hash})}else if(y==="revert"){if(window.confirm(`Revert commit ${x.shortHash}?`))t("revert_commit",void 0,{hash:x.hash})}else if(y==="reset"){let k=window.prompt(`Reset current branch to ${x.shortHash} (soft, mixed, hard):`,"soft");if(k&&["soft","mixed","hard"].includes(k.toLowerCase()))t("reset_commit",void 0,{hash:x.hash,mode:k.toLowerCase()})}else if(y==="merge"){if(window.confirm(`Merge commit ${x.shortHash} into current branch?`))t("merge_commit",void 0,{hash:x.hash})}else if(y==="rebase"){if(window.confirm(`Rebase current branch onto commit ${x.shortHash}?`))t("rebase_commit",void 0,{hash:x.hash})}},[t]);return{fileDiffs:r,expandedFiles:h,loadingFiles:v,fullContextFiles:M,handleToggleFile:R,handleToggleContext:G,handleCommitAction:T}}function vt(t){let[l,c]=n({page:t,hash:""}),r=l.page===t?l.hash:"",p=a((h)=>{c((g)=>{let v=g.page===t&&g.hash===h;return{page:t,hash:v?"":h}})},[t]);return{expandedHash:r,toggleExpanded:p}}function Ue({output:t,onClose:l,onRefresh:c,onExecuteAction:r,rootPath:p,activeRepo:h}){if(o(()=>{if(!t)return;let j=(q)=>{if(q.key==="Escape")l()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[t,l]),!t)return null;let[g,v]=n(()=>({title:t.title,graph:t.title.toLowerCase().includes("graph")}));if(g.title!==t.title)v({title:t.title,graph:t.title.toLowerCase().includes("graph")});let N=g.graph,M=(j)=>v((q)=>({...q,graph:j})),[w,C]=n(""),{expandedHash:R,toggleExpanded:G}=vt(t),[T,y]=n(!1),{commits:x,hasMore:k,totalCount:A,isLoadingMore:F,handleLoadMore:O}=gt({output:t,isGraphMode:N,rootPath:p,activeRepo:h}),{fileDiffs:V,expandedFiles:E,loadingFiles:H,fullContextFiles:Q,handleToggleFile:Y,handleToggleContext:z,handleCommitAction:I}=xt({onExecuteAction:r,rootPath:p,activeRepo:h}),W=u(()=>{if(!w.trim())return x;let j=w.toLowerCase().trim();return x.filter((q)=>q.message.toLowerCase().includes(j)||q.author.toLowerCase().includes(j)||q.shortHash.toLowerCase().includes(j)||q.hash.toLowerCase().includes(j)||q.refs?.some((ne)=>ne.toLowerCase().includes(j)))},[x,w]),oe=i(null),ie=i(null),ve=i(null),pe=i({}),[he,ye]=n({}),[Pe,$e]=n(800);o(()=>{let j=ve.current;if(!j||!k||F||w.trim())return;let q=new IntersectionObserver((ne)=>{if(ne[0].isIntersecting)O()},{root:oe.current,threshold:0.1});return q.observe(j),()=>q.disconnect()},[k,F,w,O]);let ae=a(()=>{if(!oe.current||!ie.current)return;let j=oe.current.getBoundingClientRect(),q=oe.current.scrollTop,ne={};W.forEach((ge,De)=>{let Ne=pe.current[ge.hash];if(Ne){let de=Ne.getBoundingClientRect();ne[ge.hash]=de.top+de.height/2-j.top+q}else ne[ge.hash]=De*60+20}),ye(ne);let Le=ie.current.offsetHeight;$e(Math.max(Le,oe.current.clientHeight,600))},[W]);K(()=>{ae();let j=requestAnimationFrame(()=>{ae()});return()=>cancelAnimationFrame(j)},[ae,W,V,E,N,R]),o(()=>{let j=ie.current;if(!j)return;let q=new ResizeObserver(()=>{ae()});q.observe(j);for(let ne of Array.from(j.children))q.observe(ne);return()=>q.disconnect()},[ae,W]);let ee=u(()=>Re(W),[W]),Me=u(()=>{let j=0;return ee.forEach((q)=>{if(q>j)j=q}),j},[ee]),ke=18,Ce=16,Te=N?(Me+1)*ke+Ce*2:36,Ae=()=>{y(!0),c?.(),setTimeout(()=>y(!1),600)};return e("div",{className:"fixed inset-0 z-50 modal-scrim backdrop-blur-xs flex items-center justify-center p-0 lg:p-5",onClick:l,role:"dialog","aria-modal":"true","aria-label":t.title,children:e("div",{className:`glass-overlay bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden
4
4
  w-full h-full rounded-none border-0
5
5
  lg:w-[min(94vw,1200px)] lg:h-[88vh] lg:rounded-xl lg:border
6
6
  pt-[env(safe-area-inset-top,0px)] lg:pt-0`,onClick:(j)=>j.stopPropagation(),children:[e(it,{isGraphMode:N,onToggleMode:M,searchQuery:w,onSearchChange:C,onRefresh:Ae,onClose:l,isRefreshing:T,totalCommits:W.length,loadedCount:x.length,totalCount:A,hasMore:k}),e("div",{ref:oe,className:`flex-1 overflow-y-auto scrollbar-overlay-container relative select-text
7
7
  px-3 lg:px-5
8
- pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:W.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-muted font-mono text-xs",children:w.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(pt,{commits:W,nodePositions:he,expandedHash:R,isGraphMode:N,laneWidth:ke,paddingLeft:Ce,totalHeight:Pe}),e("div",{ref:ie,className:"flex flex-col relative z-20",style:{paddingLeft:`${Te}px`},children:[W.map((j)=>e(ht,{commit:j,isExpanded:R===j.hash,onToggleExpand:()=>G(j.hash),onAction:I,onToggleFile:Y,isExpandedFile:(q,ne)=>E.has(`${q}:${ne}`),isLoadingFile:(q,ne)=>H.has(`${q}:${ne}`),isFullContextFile:(q,ne)=>Q.has(`${q}:${ne}`),onToggleContext:z,fileDiffs:V,headerRef:(q)=>{pe.current[j.hash]=q}},j.hash)),e("div",{ref:ve,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:F?e("div",{className:"flex items-center gap-2 text-xs text-muted font-mono py-2",children:[e(m,{size:14,className:"animate-spin text-info-text","aria-hidden":"true"}),e("span",{children:"Loading more commits..."})]}):k&&!w.trim()?e("button",{type:"button",onClick:O,className:"px-3 py-1.5 text-xs font-mono text-ink/70 hover:text-ink bg-ink/5 hover:bg-ink/10 rounded-md border border-ink/10 transition-colors cursor-pointer",children:"Load more commits..."}):W.length>10?e("div",{className:"text-[11px] font-mono text-muted py-2",children:["End of commit history (",typeof A==="number"&&A>0?A:x.length," commits)"]}):null})]})]})})]})})}function kt({children:t,onClose:l}){return e("div",{className:"fixed inset-0 z-50 modal-scrim flex items-center justify-center modal-safe",onClick:l,role:"dialog","aria-modal":"true",children:e("div",{className:"glass-overlay bg-paper border border-ink/20 rounded-lg shadow-xl flex flex-col overflow-hidden w-[min(94vw,420px)] max-h-[80vh]",onClick:(c)=>c.stopPropagation(),children:t})})}function Ct({modal:t,onClose:l,onConfirm:c}){if(!t)return null;return e(kt,{onClose:l,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(_,{size:16,className:"text-error flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Confirm Action"})]}),e("div",{className:"px-4 py-4 text-xs text-ink/80 leading-relaxed",children:t.message}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Confirm"})]})]})}function Nt({isOpen:t,branchName:l,inputRef:c,onChange:r,onClose:p,onCreate:h}){if(!t)return null;let g=a(()=>{if(l.trim())h()},[l,h]);return e(kt,{onClose:p,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e($n,{size:16,className:"text-ink/60 flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Create New Branch"})]}),e("div",{className:"px-4 py-4",children:e("input",{ref:c,type:"text",value:l,onChange:(v)=>r(v.currentTarget.value),onKeyDown:(v)=>{if(v.key==="Enter")g();if(v.key==="Escape")p()},placeholder:"branch-name",className:"w-full bg-canvas border border-ink/20 rounded px-3 py-2 text-xs focus:outline-none focus:border-ink/40 text-ink placeholder-ink/40 transition-colors"})}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:p,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:g,disabled:!l.trim(),className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Create"})]})]})}function wt({branch:t,detached:l,onCheckout:c,onMerge:r,onRename:p,onDelete:h}){let g=t.current&&!l;return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_minmax(0,9.5rem)_4.25rem_4rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:g&&e(f,{size:12,className:"text-ink","aria-label":"Current branch"})}),e("button",{type:"button",onClick:c,disabled:g,title:g?"Already on this branch":`Check out ${t.name}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:[e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(me,{size:11,className:g?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${g?"font-semibold text-ink":"text-ink/90"}`,children:t.name})]}),t.subject&&e("div",{className:"h-4 flex items-center pl-[18px] min-w-0",children:e("span",{className:"truncate text-[10px] text-ink/40",title:t.subject,children:t.subject})})]}),e("div",{className:"h-5 flex items-center justify-end min-w-0",children:e(Yt,{branch:t})}),e("div",{className:"h-5 flex items-center justify-end",children:t.date&&e("span",{className:"text-[10px] text-ink/40 truncate",children:t.date})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[!g&&e("button",{type:"button",onClick:r,title:`Merge ${t.name} into the current branch`,"aria-label":`Merge ${t.name} into the current branch`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e($n,{size:11})}),e("button",{type:"button",onClick:p,title:`Rename ${t.name}`,"aria-label":`Rename ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(zn,{size:11})}),!g&&e("button",{type:"button",onClick:h,title:`Delete ${t.name}`,"aria-label":`Delete ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(L,{size:11})})]})]})}function Yt({branch:t}){if(t.gone)return e("span",{className:"text-[10px] font-mono text-warning border border-warning/30 rounded px-1 truncate",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"});if(!t.upstream)return e("span",{className:"text-[10px] font-mono text-ink/40 truncate",title:"No upstream: this branch has never been published",children:"unpublished"});return e("span",{className:"flex items-center gap-1 text-[10px] font-mono text-ink/50 min-w-0",children:[e("span",{className:"truncate",title:t.upstream,children:t.upstream}),(t.ahead>0||t.behind>0)&&e("span",{className:"tabular-nums text-ink/70 flex-shrink-0",children:[t.ahead>0&&`↑${t.ahead}`,t.behind>0&&`↓${t.behind}`]})]})}function Rt({branch:t,onClose:l,onSubmit:c}){if(!t)return null;return e(Xt,{branch:t,onClose:l,onSubmit:c})}function Xt({branch:t,onClose:l,onSubmit:c}){let[r,p]=n(t.name),[h,g]=n(!1),v=r.trim(),N=v===t.name,M=v.length>0&&!N,w=()=>{if(M)c(t.name,v,h)};return e(Z,{onClose:l,maxWidthClass:"max-w-[min(94vw,460px)]",header:e("div",{className:"flex items-center gap-2",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Rename branch"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:t.name})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3",children:[e("div",{children:[e("label",{className:"text-[10px] uppercase tracking-wider text-ink/50 font-semibold",htmlFor:"branch-rename-input",children:"New name"}),e("input",{id:"branch-rename-input",type:"text",value:r,autoFocus:!0,onChange:(C)=>p(C.currentTarget.value),onKeyDown:(C)=>{if(C.key==="Enter")w();if(C.key==="Escape")l()},className:"mt-1 w-full bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs font-mono text-ink focus:outline-none focus:border-ink/40 transition-colors"}),N&&v.length>0&&e("p",{className:"mt-1 text-[10px] text-ink/50",children:"The name is unchanged."})]}),e("div",{className:"text-[10px] font-mono text-ink/60 flex flex-col gap-0.5 border border-ink/10 rounded p-2 bg-canvas/40",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"upstream"}),e("span",{className:"truncate",children:t.upstream||"none (unpublished)"})]}),e("p",{className:"text-ink/40 leading-relaxed mt-0.5",children:"A local rename keeps this upstream unchanged — a plain push afterwards will refuse until the upstream matches the new name, which is what the remote option below does."})]}),e("label",{className:"flex items-start gap-2 text-[11px] text-ink/80 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:h,onChange:(C)=>g(C.currentTarget.checked),className:`${be} accent-ink cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{children:"Also rename it on the remote"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git push -u ",t.upstream?t.upstream.split("/")[0]:"origin"," ",v||"<new>",e("br",{}),"git push ",t.upstream?t.upstream.split("/")[0]:"origin"," --delete ",t.name,e("br",{}),"git fetch --prune"]})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:w,disabled:!M,className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Rename"})]})]})}function Gt({branch:t,force:l,onForceChange:c,onClose:r,onConfirm:p}){if(!t)return null;return e(Z,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(_,{size:15,className:"text-error flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Delete branch"})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3 text-xs text-ink/80 leading-relaxed",children:[e("p",{children:["Delete ",e("span",{className:"font-mono font-semibold text-ink",children:t.name}),t.upstream&&e(d,{children:[" ","(tracks ",e("span",{className:"font-mono",children:t.upstream}),")"]}),"?"]}),e("div",{className:"text-[10px] font-mono text-ink/60 border border-ink/10 rounded p-2 bg-canvas/40 flex flex-col gap-0.5",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"last commit"}),e("span",{className:"truncate",children:t.subject||"–"})]}),e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"when"}),e("span",{children:t.date||"–"})]})]}),e("label",{className:"flex items-start gap-2 cursor-pointer select-none text-[11px]",children:[e("input",{type:"checkbox",checked:l,onChange:(h)=>c(h.currentTarget.checked),className:`${be} accent-error cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-error font-medium",children:"Delete even if its commits are not merged"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git branch ",l?"-D":"-d"," ",t.name]}),e("span",{className:"text-ink/50",children:"Without this, git refuses when the branch holds commits no other branch has. Leaving it off is the safe default."})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:()=>p(t.name),className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:["Delete ",l?"(force)":""]})]})]})}function St({isOpen:t,rootPath:l,repo:c,currentBranch:r,detached:p,isBusy:h,onClose:g,onAction:v,onConfirmDelete:N}){let[M,w]=n([]),[C,R]=n(!1),[G,T]=n(null),[y,x]=n(""),[k,A]=n(null),[F,O]=n(null),[V,E]=n(!1),H=a(async()=>{R(!0),T(null);let z=new URLSearchParams({branches:"1",repo:c||"."});if(l)z.set("root",l);try{let I=await fetch(`/api/fs/git?${z.toString()}`),W=await I.json();if(W.success&&Array.isArray(W.branches))w(W.branches);else T(W.error||`Failed to read branches (HTTP ${I.status})`)}catch(I){T(I instanceof Error?I.message:"Failed to read branches")}finally{R(!1)}},[l,c]);o(()=>{if(t)H()},[t,H]);let Q=i(!1);o(()=>{if(!t){Q.current=!1;return}if(Q.current&&!h)H();Q.current=h},[t,h,H]),o(()=>{if(!t)A(null),O(null),E(!1),x("")},[t]);let Y=u(()=>{let z=y.trim().toLowerCase();if(!z)return M;return M.filter((I)=>I.name.toLowerCase().includes(z)||I.upstream.toLowerCase().includes(z))},[M,y]);if(!t)return null;return e(d,{children:[e(Z,{onClose:g,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Branches"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:p?`detached at ${r}`:`on ${r}`})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(U,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:y,onChange:(z)=>x(z.currentTarget.value),placeholder:"Filter branches…","aria-label":"Filter branches",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:()=>void H(),disabled:C,title:"Refresh","aria-label":"Refresh branches",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(D,{size:12,className:C?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:C&&M.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Loading branches…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):Y.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:y.trim()?"No matching branches.":"No branches."}):Y.map((z)=>e(wt,{branch:z,detached:p,onCheckout:()=>{v("checkout",{branch:z.name}),g()},onMerge:()=>{v("merge_branch",{branch:z.name}),g()},onRename:()=>A(z),onDelete:()=>{O(z),E(!1)}},z.name))})]}),e(Rt,{branch:k,onClose:()=>A(null),onSubmit:(z,I,W)=>{v("rename_branch",{branch:z,newName:I,...W?{remote:"1"}:{}}),A(null)}},k?.name??"none"),e(Gt,{branch:F,force:V,onForceChange:E,onClose:()=>{O(null),E(!1)},onConfirm:(z)=>{N(z,V),O(null),E(!1)}})]})}function Pt({mounted:t,confirmModal:l,onCloseConfirm:c,onConfirm:r,branchPrompt:p,newBranchName:h,newBranchInputRef:g,onNewBranchNameChange:v,onCloseBranchPrompt:N,onCreateBranch:M,viewingOutput:w,onCloseOutput:C,onRefreshOutput:R,onExecuteAction:G,branchModalOpen:T,onCloseBranchModal:y,rootPath:x,activeRepo:k,currentBranch:A,detached:F,isBusy:O,onBranchAction:V,onConfirmDeleteBranch:E}){if(!t)return null;return e(d,{children:[e(Ct,{modal:l,onClose:c,onConfirm:r}),e(Nt,{isOpen:p,branchName:h,inputRef:g,onChange:v,onClose:N,onCreate:M}),e(Ue,{output:w,onClose:C,onRefresh:R,onExecuteAction:G,rootPath:x,activeRepo:k}),e(St,{isOpen:T,rootPath:x,repo:k,currentBranch:A,detached:F,isBusy:O,onClose:y,onAction:V,onConfirmDelete:E})]})}function $t({rootPath:t,repo:l,isBusy:c,onAction:r}){let[p,h]=S("git.stashExpanded",!1),[g,v]=n([]),[N,M]=n(!1),[w,C]=n(""),[R,G]=n(!1),T=xr(),y=a(async()=>{M(!0);let k=new URLSearchParams({stashes:"1",repo:l||"."});if(t)k.set("root",t);try{let F=await(await fetch(`/api/fs/git?${k.toString()}`)).json();v(F.stashes??[])}catch{v([])}finally{M(!1)}},[t,l]);o(()=>{if(p)y()},[p,y,c]);let x=(k,A)=>{if(r(k,A),k==="stash_push")C(""),G(!1)};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:[e("button",{type:"button",onClick:()=>h(!p),"aria-expanded":p,"aria-controls":T,title:p?"Hide stashes":"Show stashes",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:p?"▾":"▸"}),e(at,{size:12}),e("span",{children:"Stash"}),g.length>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:g.length})]}),e("button",{type:"button",onClick:()=>x("stash_push",{...w.trim()?{message:w.trim()}:{},...R?{untracked:"1"}:{}}),disabled:c,title:"Stash the working tree",className:"mr-3 flex flex-shrink-0 items-center gap-1 px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:[e(P,{size:10}),"Save"]})]}),e("div",{className:"section-reveal","data-expanded":p,id:T,inert:!p,children:e("div",{children:e("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("input",{type:"text",value:w,onChange:(k)=>C(k.currentTarget.value),placeholder:"Stash message (optional)","aria-label":"Stash message",className:"flex-1 min-w-0 bg-paper border border-ink/20 rounded px-2 py-1 text-[11px] text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("label",{className:"flex items-center gap-1 text-[10px] text-ink/60 cursor-pointer select-none flex-shrink-0",title:"Also stash untracked files (-u)",children:[e("input",{type:"checkbox",checked:R,onChange:(k)=>G(k.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"-u"]})]}),N&&g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"Loading…"}):g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"No stash entries."}):e("div",{className:"max-h-40 overflow-y-auto scrollbar-overlay-container flex flex-col",children:g.map((k)=>e("div",{className:"grid grid-cols-[4rem_minmax(0,1fr)_3.5rem_4.5rem] items-center gap-x-1 group/stash py-0.5",children:[e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:k.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:k.subject,children:k.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:k.date}),e("div",{className:"flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/stash:opacity-100",children:[e("button",{type:"button",onClick:()=>x("stash_apply",{ref:k.ref,pop:"1"}),disabled:c,title:"Pop: apply and remove the entry","aria-label":"Pop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(fe,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_apply",{ref:k.ref}),disabled:c,title:"Apply: keep the entry","aria-label":"Apply stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(at,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_drop",{ref:k.ref}),disabled:c,title:"Drop: discard the entry (the stash is not recoverable from the panel)","aria-label":"Drop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors disabled:opacity-40",children:e(L,{size:10})})]})]},k.ref))})]})})})]})}function Mt({repo:t,isBusy:l,onInit:c}){let r=t==="."?"this folder":t;return e("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 text-center",children:[e(me,{size:26,className:"text-ink/25","aria-hidden":!0}),e("div",{className:"font-mono space-y-1",children:[e("p",{className:"text-xs text-ink/70",children:"Not a Git repository"}),e("p",{className:"text-[11px] leading-4 text-ink/40",children:["Initialize one in ",r," to track changes, commit and manage branches."]})]}),e("button",{type:"button",onClick:c,disabled:l,"aria-label":"Initialize Git repository",title:`git init in ${r}`,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(me,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function Tt(t,l,c){let r=ut(),{pickedRepo:p,setActiveRepo:h,ready:g}=gr(t),{repos:v,scanning:N,rescan:M}=Ar(t,l),w=hg(p,v),C=i(w);C.current=w;let R=i("");R.current=`${t??""}\x00${w}`;let G=i(""),T=i(""),y=i(void 0);if(r.data!==y.current)y.current=r.data,T.current=G.current;let x=l&&g?jp(`${t??""}\x00${w}`):null,k=Ie(x),A=i(k.refresh);A.current=k.refresh;let F=T.current===R.current?r.data:void 0,O=k.data??F,V=O?.syncCount??F?.syncCount,E=a((Y)=>{if(!l)return;let z=Y??C.current,I=new URLSearchParams;if(t)I.set("root",t);if(z)I.set("repo",z);I.set("sync","1"),I.set("t",String(Date.now())),G.current=R.current;let W=A.current;r.load(`/api/fs/git?${I.toString()}`).then(()=>W())},[l,t,r.load]);o(()=>{if(!g)return;E()},[c,t,l,g,w,E]);let H=r.state==="loading",Q=H||k.refreshing;return{activeRepo:w,setActiveRepo:h,repos:v,reposScanning:N,refreshRepos:M,isReading:H,isRefreshing:Q,data:O,syncCount:V,loadRepo:E,refreshTopic:k.refresh}}function At(t,l){let c=ut(),r=i(null),p=a((h,g,v)=>{r.current={actionType:h,extra:v};let N=new FormData;if(N.append("actionType",h),N.append("repo",l),t)N.append("root",t);if(g)N.append("file",g);if(v)Object.entries(v).forEach(([M,w])=>N.append(M,w));c.submit(N,{method:"POST",action:"/api/fs/git"})},[l,t,c]);return{state:c.state,execute:p,data:c.data,lastAction:r.current}}function Lt({rootPath:t,repo:l,execute:c}){let{sessionId:r}=Hp(),[p,h]=S("git.commitDraft",""),[g,v]=S("git.amend",!1),[N,M]=n(!1),[w,C]=n(null),[R,G]=n(!1),T=i(!1),y=i(null),x=i(p);x.current=p;let k=i(g);k.current=g;let A=i(h);A.current=h;let F=a((Y)=>{h(Y),G(!1)},[h]),O=a(()=>{if(T.current)return;T.current=!0,M(!0),C(null);let Y={...t?{root:t}:{},repo:l,...r?{sessionId:r}:{},...k.current?{amend:!0}:{}};fetch("/api/fs/git-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)}).then(async(z)=>{let I=await z.json().catch(()=>null);if(!z.ok||typeof I?.message!=="string"||!I.message.trim())throw Error(typeof I?.error==="string"?I.error:`Request failed (HTTP ${z.status})`);let W=I.message.trim();if(x.current.trim().length===0)A.current(W),G(!0);else C(W)}).catch((z)=>{il(z instanceof Error?z.message:String(z),"error")}).finally(()=>{T.current=!1,M(!1)})},[t,l,r]),V=a(()=>{if(w===null)return;h(w),G(!0),C(null)},[w,h]),E=a(()=>C(null),[]);o(()=>{if(!g)return;if(x.current.trim().length>0)return;let Y=new URLSearchParams({headMessage:"1"});if(t)Y.set("root",t);if(l&&l!==".")Y.set("repo",l);let z=!1;return fetch(`/api/fs/git?${Y.toString()}`).then((I)=>I.json()).then((I)=>{if(z)return;if(!k.current||x.current.trim().length>0)return;let W=typeof I?.message==="string"?I.message:"";if(W.length===0)return;y.current=W,A.current(W)}).catch(()=>{}),()=>{z=!0}},[g,r,t,l]);let H=a((Y)=>{if(Y){v(!0);return}if(y.current!==null&&x.current===y.current)h("");y.current=null,v(!1)},[v,h]),Q=a(()=>{c("commit",void 0,{message:x.current,...k.current?{amend:"1"}:{}}),h(""),v(!1),y.current=null,C(null),G(!1)},[c,v,h]);return{message:p,setMessage:F,amend:g,seeded:y.current!==null&&p===y.current,toggleAmend:H,commit:Q,isGenerating:N,suggestion:w,generated:R,generate:O,useSuggestion:V,dismissSuggestion:E}}var Dt=48;function Zt(t,l){let c=l?.branch?.trim()??"",r=(l?.hash??"").slice(0,7),p=l?.ref?.trim()||"stash@{0}";switch(t){case"init":return{done:"Initialized the repository"};case"fetch":return{done:"Fetched every remote"};case"push":return{done:"Pushed to upstream"};case"pull":return{done:"Pulled from upstream",stopped:"Pulled"};case"sync":return{done:"Synced with upstream",stopped:"Pulled, but nothing was pushed"};case"abort_operation":return{done:"Aborted the operation in progress"};case"continue_operation":return{done:"Concluded the operation"};case"commit":{if(l?.amend==="1")return{done:"Amended the last commit"};let h=(l?.message??"").split(`
8
+ pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:W.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-muted font-mono text-xs",children:w.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(pt,{commits:W,nodePositions:he,expandedHash:R,isGraphMode:N,laneWidth:ke,paddingLeft:Ce,totalHeight:Pe}),e("div",{ref:ie,className:"flex flex-col relative z-20",style:{paddingLeft:`${Te}px`},children:[W.map((j)=>e(ht,{commit:j,isExpanded:R===j.hash,onToggleExpand:()=>G(j.hash),onAction:I,onToggleFile:Y,isExpandedFile:(q,ne)=>E.has(`${q}:${ne}`),isLoadingFile:(q,ne)=>H.has(`${q}:${ne}`),isFullContextFile:(q,ne)=>Q.has(`${q}:${ne}`),onToggleContext:z,fileDiffs:V,headerRef:(q)=>{pe.current[j.hash]=q}},j.hash)),e("div",{ref:ve,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:F?e("div",{className:"flex items-center gap-2 text-xs text-muted font-mono py-2",children:[e(m,{size:14,className:"animate-spin text-info-text","aria-hidden":"true"}),e("span",{children:"Loading more commits..."})]}):k&&!w.trim()?e("button",{type:"button",onClick:O,className:"px-3 py-1.5 text-xs font-mono text-ink/70 hover:text-ink bg-ink/5 hover:bg-ink/10 rounded-md border border-ink/10 transition-colors cursor-pointer",children:"Load more commits..."}):W.length>10?e("div",{className:"text-[11px] font-mono text-muted py-2",children:["End of commit history (",typeof A==="number"&&A>0?A:x.length," commits)"]}):null})]})]})})]})})}function kt({children:t,onClose:l}){return e("div",{className:"fixed inset-0 z-50 modal-scrim flex items-center justify-center modal-safe",onClick:l,role:"dialog","aria-modal":"true",children:e("div",{className:"glass-overlay bg-paper border border-ink/20 rounded-lg shadow-xl flex flex-col overflow-hidden w-[min(94vw,420px)] max-h-[80vh]",onClick:(c)=>c.stopPropagation(),children:t})})}function Ct({modal:t,onClose:l,onConfirm:c}){if(!t)return null;return e(kt,{onClose:l,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(_,{size:16,className:"text-error flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Confirm Action"})]}),e("div",{className:"px-4 py-4 text-xs text-ink/80 leading-relaxed",children:t.message}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Confirm"})]})]})}function Nt({isOpen:t,branchName:l,inputRef:c,onChange:r,onClose:p,onCreate:h}){if(!t)return null;let g=a(()=>{if(l.trim())h()},[l,h]);return e(kt,{onClose:p,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e($n,{size:16,className:"text-ink/60 flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Create New Branch"})]}),e("div",{className:"px-4 py-4",children:e("input",{ref:c,type:"text",value:l,onChange:(v)=>r(v.currentTarget.value),onKeyDown:(v)=>{if(v.key==="Enter")g();if(v.key==="Escape")p()},placeholder:"branch-name",className:"w-full bg-canvas border border-ink/20 rounded px-3 py-2 text-xs focus:outline-none focus:border-ink/40 text-ink placeholder-ink/40 transition-colors"})}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:p,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:g,disabled:!l.trim(),className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Create"})]})]})}function wt({branch:t,detached:l,onCheckout:c,onMerge:r,onRename:p,onDelete:h}){let g=t.current&&!l;return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_minmax(0,9.5rem)_4.25rem_4rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:g&&e(f,{size:12,className:"text-ink","aria-label":"Current branch"})}),e("button",{type:"button",onClick:c,disabled:g,title:g?"Already on this branch":`Check out ${t.name}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:[e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(me,{size:11,className:g?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${g?"font-semibold text-ink":"text-ink/90"}`,children:t.name})]}),t.subject&&e("div",{className:"h-4 flex items-center pl-[18px] min-w-0",children:e("span",{className:"truncate text-[10px] text-ink/40",title:t.subject,children:t.subject})})]}),e("div",{className:"h-5 flex items-center justify-end min-w-0",children:e(Yt,{branch:t})}),e("div",{className:"h-5 flex items-center justify-end",children:t.date&&e("span",{className:"text-[10px] text-ink/40 truncate",children:t.date})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[!g&&e("button",{type:"button",onClick:r,title:`Merge ${t.name} into the current branch`,"aria-label":`Merge ${t.name} into the current branch`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e($n,{size:11})}),e("button",{type:"button",onClick:p,title:`Rename ${t.name}`,"aria-label":`Rename ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(zn,{size:11})}),!g&&e("button",{type:"button",onClick:h,title:`Delete ${t.name}`,"aria-label":`Delete ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(L,{size:11})})]})]})}function Yt({branch:t}){if(t.gone)return e("span",{className:"text-[10px] font-mono text-warning border border-warning/30 rounded px-1 truncate",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"});if(!t.upstream)return e("span",{className:"text-[10px] font-mono text-ink/40 truncate",title:"No upstream: this branch has never been published",children:"unpublished"});return e("span",{className:"flex items-center gap-1 text-[10px] font-mono text-ink/50 min-w-0",children:[e("span",{className:"truncate",title:t.upstream,children:t.upstream}),(t.ahead>0||t.behind>0)&&e("span",{className:"tabular-nums text-ink/70 flex-shrink-0",children:[t.ahead>0&&`↑${t.ahead}`,t.behind>0&&`↓${t.behind}`]})]})}function Rt({branch:t,onClose:l,onSubmit:c}){if(!t)return null;return e(Xt,{branch:t,onClose:l,onSubmit:c})}function Xt({branch:t,onClose:l,onSubmit:c}){let[r,p]=n(t.name),[h,g]=n(!1),v=r.trim(),N=v===t.name,M=v.length>0&&!N,w=()=>{if(M)c(t.name,v,h)};return e(Z,{onClose:l,maxWidthClass:"max-w-[min(94vw,460px)]",header:e("div",{className:"flex items-center gap-2",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Rename branch"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:t.name})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3",children:[e("div",{children:[e("label",{className:"text-[10px] uppercase tracking-wider text-ink/50 font-semibold",htmlFor:"branch-rename-input",children:"New name"}),e("input",{id:"branch-rename-input",type:"text",value:r,autoFocus:!0,onChange:(C)=>p(C.currentTarget.value),onKeyDown:(C)=>{if(C.key==="Enter")w();if(C.key==="Escape")l()},className:"mt-1 w-full bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs font-mono text-ink focus:outline-none focus:border-ink/40 transition-colors"}),N&&v.length>0&&e("p",{className:"mt-1 text-[10px] text-ink/50",children:"The name is unchanged."})]}),e("div",{className:"text-[10px] font-mono text-ink/60 flex flex-col gap-0.5 border border-ink/10 rounded p-2 bg-canvas/40",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"upstream"}),e("span",{className:"truncate",children:t.upstream||"none (unpublished)"})]}),e("p",{className:"text-ink/40 leading-relaxed mt-0.5",children:"A local rename keeps this upstream unchanged — a plain push afterwards will refuse until the upstream matches the new name, which is what the remote option below does."})]}),e("label",{className:"flex items-start gap-2 text-[11px] text-ink/80 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:h,onChange:(C)=>g(C.currentTarget.checked),className:`${be} accent-ink cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{children:"Also rename it on the remote"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git push -u ",t.upstream?t.upstream.split("/")[0]:"origin"," ",v||"<new>",e("br",{}),"git push ",t.upstream?t.upstream.split("/")[0]:"origin"," --delete ",t.name,e("br",{}),"git fetch --prune"]})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:w,disabled:!M,className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Rename"})]})]})}function Gt({branch:t,force:l,onForceChange:c,onClose:r,onConfirm:p}){if(!t)return null;return e(Z,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(_,{size:15,className:"text-error flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Delete branch"})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3 text-xs text-ink/80 leading-relaxed",children:[e("p",{children:["Delete ",e("span",{className:"font-mono font-semibold text-ink",children:t.name}),t.upstream&&e(d,{children:[" ","(tracks ",e("span",{className:"font-mono",children:t.upstream}),")"]}),"?"]}),e("div",{className:"text-[10px] font-mono text-ink/60 border border-ink/10 rounded p-2 bg-canvas/40 flex flex-col gap-0.5",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"last commit"}),e("span",{className:"truncate",children:t.subject||"–"})]}),e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"when"}),e("span",{children:t.date||"–"})]})]}),e("label",{className:"flex items-start gap-2 cursor-pointer select-none text-[11px]",children:[e("input",{type:"checkbox",checked:l,onChange:(h)=>c(h.currentTarget.checked),className:`${be} accent-error cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-error font-medium",children:"Delete even if its commits are not merged"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git branch ",l?"-D":"-d"," ",t.name]}),e("span",{className:"text-ink/50",children:"Without this, git refuses when the branch holds commits no other branch has. Leaving it off is the safe default."})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:()=>p(t.name),className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:["Delete ",l?"(force)":""]})]})]})}function St({isOpen:t,rootPath:l,repo:c,currentBranch:r,detached:p,isBusy:h,onClose:g,onAction:v,onConfirmDelete:N}){let[M,w]=n([]),[C,R]=n(!1),[G,T]=n(null),[y,x]=n(""),[k,A]=n(null),[F,O]=n(null),[V,E]=n(!1),H=a(async()=>{R(!0),T(null);let z=new URLSearchParams({branches:"1",repo:c||"."});if(l)z.set("root",l);try{let I=await fetch(`/api/fs/git?${z.toString()}`),W=await I.json();if(W.success&&Array.isArray(W.branches))w(W.branches);else T(W.error||`Failed to read branches (HTTP ${I.status})`)}catch(I){T(I instanceof Error?I.message:"Failed to read branches")}finally{R(!1)}},[l,c]);o(()=>{if(t)H()},[t,H]);let Q=i(!1);o(()=>{if(!t){Q.current=!1;return}if(Q.current&&!h)H();Q.current=h},[t,h,H]),o(()=>{if(!t)A(null),O(null),E(!1),x("")},[t]);let Y=u(()=>{let z=y.trim().toLowerCase();if(!z)return M;return M.filter((I)=>I.name.toLowerCase().includes(z)||I.upstream.toLowerCase().includes(z))},[M,y]);if(!t)return null;return e(d,{children:[e(Z,{onClose:g,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Branches"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:p?`detached at ${r}`:`on ${r}`})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(U,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:y,onChange:(z)=>x(z.currentTarget.value),placeholder:"Filter branches…","aria-label":"Filter branches",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:()=>void H(),disabled:C,title:"Refresh","aria-label":"Refresh branches",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(D,{size:12,className:C?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:C&&M.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Loading branches…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):Y.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:y.trim()?"No matching branches.":"No branches."}):Y.map((z)=>e(wt,{branch:z,detached:p,onCheckout:()=>{v("checkout",{branch:z.name}),g()},onMerge:()=>{v("merge_branch",{branch:z.name}),g()},onRename:()=>A(z),onDelete:()=>{O(z),E(!1)}},z.name))})]}),e(Rt,{branch:k,onClose:()=>A(null),onSubmit:(z,I,W)=>{v("rename_branch",{branch:z,newName:I,...W?{remote:"1"}:{}}),A(null)}},k?.name??"none"),e(Gt,{branch:F,force:V,onForceChange:E,onClose:()=>{O(null),E(!1)},onConfirm:(z)=>{N(z,V),O(null),E(!1)}})]})}function Pt({mounted:t,confirmModal:l,onCloseConfirm:c,onConfirm:r,branchPrompt:p,newBranchName:h,newBranchInputRef:g,onNewBranchNameChange:v,onCloseBranchPrompt:N,onCreateBranch:M,viewingOutput:w,onCloseOutput:C,onRefreshOutput:R,onExecuteAction:G,branchModalOpen:T,onCloseBranchModal:y,rootPath:x,activeRepo:k,currentBranch:A,detached:F,isBusy:O,onBranchAction:V,onConfirmDeleteBranch:E}){if(!t)return null;return e(d,{children:[e(Ct,{modal:l,onClose:c,onConfirm:r}),e(Nt,{isOpen:p,branchName:h,inputRef:g,onChange:v,onClose:N,onCreate:M}),e(Ue,{output:w,onClose:C,onRefresh:R,onExecuteAction:G,rootPath:x,activeRepo:k}),e(St,{isOpen:T,rootPath:x,repo:k,currentBranch:A,detached:F,isBusy:O,onClose:y,onAction:V,onConfirmDelete:E})]})}function $t({rootPath:t,repo:l,isBusy:c,onAction:r}){let[p,h]=S("git.stashExpanded",!1),[g,v]=n([]),[N,M]=n(!1),[w,C]=n(""),[R,G]=n(!1),T=xr(),y=a(async()=>{M(!0);let k=new URLSearchParams({stashes:"1",repo:l||"."});if(t)k.set("root",t);try{let F=await(await fetch(`/api/fs/git?${k.toString()}`)).json();v(F.stashes??[])}catch{v([])}finally{M(!1)}},[t,l]);o(()=>{if(p)y()},[p,y,c]);let x=(k,A)=>{if(r(k,A),k==="stash_push")C(""),G(!1)};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:[e("button",{type:"button",onClick:()=>h(!p),"aria-expanded":p,"aria-controls":T,title:p?"Hide stashes":"Show stashes",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:p?"▾":"▸"}),e(at,{size:12}),e("span",{children:"Stash"}),g.length>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:g.length})]}),e("button",{type:"button",onClick:()=>x("stash_push",{...w.trim()?{message:w.trim()}:{},...R?{untracked:"1"}:{}}),disabled:c,title:"Stash the working tree",className:"mr-3 flex flex-shrink-0 items-center gap-1 px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:[e(P,{size:10}),"Save"]})]}),e("div",{className:"section-reveal","data-expanded":p,id:T,inert:!p,children:e("div",{children:e("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("input",{type:"text",value:w,onChange:(k)=>C(k.currentTarget.value),placeholder:"Stash message (optional)","aria-label":"Stash message",className:"flex-1 min-w-0 bg-paper border border-ink/20 rounded px-2 py-1 text-[11px] text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("label",{className:"flex items-center gap-1 text-[10px] text-ink/60 cursor-pointer select-none flex-shrink-0",title:"Also stash untracked files (-u)",children:[e("input",{type:"checkbox",checked:R,onChange:(k)=>G(k.currentTarget.checked),className:`${be} accent-ink cursor-pointer`}),"-u"]})]}),N&&g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"Loading…"}):g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"No stash entries."}):e("div",{className:"max-h-40 overflow-y-auto scrollbar-overlay-container flex flex-col",children:g.map((k)=>e("div",{className:"grid grid-cols-[4rem_minmax(0,1fr)_3.5rem_4.5rem] items-center gap-x-1 group/stash py-0.5",children:[e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:k.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:k.subject,children:k.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:k.date}),e("div",{className:"flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/stash:opacity-100",children:[e("button",{type:"button",onClick:()=>x("stash_apply",{ref:k.ref,pop:"1"}),disabled:c,title:"Pop: apply and remove the entry","aria-label":"Pop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(fe,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_apply",{ref:k.ref}),disabled:c,title:"Apply: keep the entry","aria-label":"Apply stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(at,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_drop",{ref:k.ref}),disabled:c,title:"Drop: discard the entry (the stash is not recoverable from the panel)","aria-label":"Drop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors disabled:opacity-40",children:e(L,{size:10})})]})]},k.ref))})]})})})]})}function Mt({repo:t,isBusy:l,onInit:c}){let r=t==="."?"this folder":t;return e("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 text-center",children:[e(me,{size:26,className:"text-ink/25","aria-hidden":!0}),e("div",{className:"font-mono space-y-1",children:[e("p",{className:"text-xs text-ink/70",children:"Not a Git repository"}),e("p",{className:"text-[11px] leading-4 text-ink/40",children:["Initialize one in ",r," to track changes, commit and manage branches."]})]}),e("button",{type:"button",onClick:c,disabled:l,"aria-label":"Initialize Git repository",title:`git init in ${r}`,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(me,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function Tt(t,l,c){let r=ut(),{pickedRepo:p,setActiveRepo:h,ready:g}=gr(t),{repos:v,scanning:N,rescan:M}=Ar(t,l),w=vg(p,v),C=i(w);C.current=w;let R=i("");R.current=`${t??""}\x00${w}`;let G=i(""),T=i(""),y=i(void 0);if(r.data!==y.current)y.current=r.data,T.current=G.current;let x=l&&g?Hp(`${t??""}\x00${w}`):null,k=Ie(x),A=i(k.refresh);A.current=k.refresh;let F=T.current===R.current?r.data:void 0,O=k.data??F,V=O?.syncCount??F?.syncCount,E=a((Y)=>{if(!l)return;let z=Y??C.current,I=new URLSearchParams;if(t)I.set("root",t);if(z)I.set("repo",z);I.set("sync","1"),I.set("t",String(Date.now())),G.current=R.current;let W=A.current;r.load(`/api/fs/git?${I.toString()}`).then(()=>W())},[l,t,r.load]);o(()=>{if(!g)return;E()},[c,t,l,g,w,E]);let H=r.state==="loading",Q=H||k.refreshing;return{activeRepo:w,setActiveRepo:h,repos:v,reposScanning:N,refreshRepos:M,isReading:H,isRefreshing:Q,data:O,syncCount:V,loadRepo:E,refreshTopic:k.refresh}}function At(t,l){let c=ut(),r=i(null),p=a((h,g,v)=>{r.current={actionType:h,extra:v};let N=new FormData;if(N.append("actionType",h),N.append("repo",l),t)N.append("root",t);if(g)N.append("file",g);if(v)Object.entries(v).forEach(([M,w])=>N.append(M,w));c.submit(N,{method:"POST",action:"/api/fs/git"})},[l,t,c]);return{state:c.state,execute:p,data:c.data,lastAction:r.current}}function Lt({rootPath:t,repo:l,execute:c}){let{sessionId:r}=Kp(),[p,h]=S("git.commitDraft",""),[g,v]=S("git.amend",!1),[N,M]=n(!1),[w,C]=n(null),[R,G]=n(!1),T=i(!1),y=i(null),x=i(p);x.current=p;let k=i(g);k.current=g;let A=i(h);A.current=h;let F=a((Y)=>{h(Y),G(!1)},[h]),O=a(()=>{if(T.current)return;T.current=!0,M(!0),C(null);let Y={...t?{root:t}:{},repo:l,...r?{sessionId:r}:{},...k.current?{amend:!0}:{}};fetch("/api/fs/git-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)}).then(async(z)=>{let I=await z.json().catch(()=>null);if(!z.ok||typeof I?.message!=="string"||!I.message.trim())throw Error(typeof I?.error==="string"?I.error:`Request failed (HTTP ${z.status})`);let W=I.message.trim();if(x.current.trim().length===0)A.current(W),G(!0);else C(W)}).catch((z)=>{ll(z instanceof Error?z.message:String(z),"error")}).finally(()=>{T.current=!1,M(!1)})},[t,l,r]),V=a(()=>{if(w===null)return;h(w),G(!0),C(null)},[w,h]),E=a(()=>C(null),[]);o(()=>{if(!g)return;if(x.current.trim().length>0)return;let Y=new URLSearchParams({headMessage:"1"});if(t)Y.set("root",t);if(l&&l!==".")Y.set("repo",l);let z=!1;return fetch(`/api/fs/git?${Y.toString()}`).then((I)=>I.json()).then((I)=>{if(z)return;if(!k.current||x.current.trim().length>0)return;let W=typeof I?.message==="string"?I.message:"";if(W.length===0)return;y.current=W,A.current(W)}).catch(()=>{}),()=>{z=!0}},[g,r,t,l]);let H=a((Y)=>{if(Y){v(!0);return}if(y.current!==null&&x.current===y.current)h("");y.current=null,v(!1)},[v,h]),Q=a(()=>{c("commit",void 0,{message:x.current,...k.current?{amend:"1"}:{}}),h(""),v(!1),y.current=null,C(null),G(!1)},[c,v,h]);return{message:p,setMessage:F,amend:g,seeded:y.current!==null&&p===y.current,toggleAmend:H,commit:Q,isGenerating:N,suggestion:w,generated:R,generate:O,useSuggestion:V,dismissSuggestion:E}}var Dt=48;function Zt(t,l){let c=l?.branch?.trim()??"",r=(l?.hash??"").slice(0,7),p=l?.ref?.trim()||"stash@{0}";switch(t){case"init":return{done:"Initialized the repository"};case"fetch":return{done:"Fetched every remote"};case"push":return{done:"Pushed to upstream"};case"pull":return{done:"Pulled from upstream",stopped:"Pulled"};case"sync":return{done:"Synced with upstream",stopped:"Pulled, but nothing was pushed"};case"abort_operation":return{done:"Aborted the operation in progress"};case"continue_operation":return{done:"Concluded the operation"};case"commit":{if(l?.amend==="1")return{done:"Amended the last commit"};let h=(l?.message??"").split(`
9
9
  `)[0].trim();if(!h)return{done:"Commit created"};return{done:`Committed “${h.length>Dt?`${h.slice(0,Dt-1)}…`:h}”`}}case"checkout":return{done:c?`Switched to ${c}`:"Switched branch"};case"create_branch":case"create_branch_at":return{done:c?`Created branch ${c}`:"Created branch"};case"rename_branch":{let h=l?.newName?.trim()??"";return{done:c&&h?`Renamed ${c} to ${h}`:"Renamed branch"}}case"delete_branch":return{done:c?`Deleted branch ${c}`:"Deleted branch"};case"merge_branch":return{done:c?`Merged ${c}`:"Merged branch",stopped:c?`Merging ${c}`:"Merging the branch"};case"merge_commit":return{done:r?`Merged commit ${r}`:"Merged commit",stopped:r?`Merging ${r}`:"Merging the commit"};case"cherry_pick":return{done:r?`Cherry-picked ${r}`:"Cherry-picked commit",stopped:r?`Cherry-picking ${r}`:"Cherry-picking the commit"};case"revert_commit":return{done:r?`Reverted commit ${r}`:"Reverted commit",stopped:r?`Reverting ${r}`:"Reverting the commit"};case"rebase_commit":return{done:r?`Rebased onto ${r}`:"Rebased",stopped:r?`Rebasing onto ${r}`:"Rebasing"};case"reset_commit":{let h=l?.mode??"mixed";return{done:r?`Reset to ${r} (${h})`:`Reset (${h})`}}case"stash_push":return{done:"Stashed your changes"};case"stash_apply":return{done:l?.pop==="1"?`Popped ${p}`:`Applied ${p}`,stopped:l?.pop==="1"?`Popping ${p}`:`Applying ${p}`};case"stash_drop":return{done:`Dropped ${p}`};default:return null}}function Et({actionType:t,extra:l,stopped:c}){let r=Zt(t,l);if(!c)return r?.done??null;let p=Bo[c]??c,h=r?.stopped??r?.done??"",g=t==="sync"?"resolve it above, then Sync again":"resolve it above";return h?`${h} — the ${p} stopped on a conflict; ${g}`:`The ${p} stopped on a conflict; ${g}`}function Bt(t){let{fetcher:l,onPage:c,onReload:r,onSuccess:p,onError:h}=t,g=i(null),v=i({onPage:c,onReload:r,onSuccess:p,onError:h});v.current={onPage:c,onReload:r,onSuccess:p,onError:h},o(()=>{if(l.state!=="idle"||!l.data)return;let N=l.data;if(N===g.current)return;g.current=N;let M=v.current;if(N.type==="history"||N.type==="graph"){M.onPage({title:N.type==="graph"?"Git Graph":"Commit History",data:N.data||[],hasMore:N.hasMore,total:N.total});return}if(!N.success){M.onError(N.error||"Git operation failed");return}M.onReload();let w=l.lastAction,C=w?Et({...w,stopped:N.stopped}):null;if(C)M.onSuccess(C,N.stopped?"warning":"success")},[l.state,l.data,l.lastAction])}function Ft(t,l,c,r){if(t==="revert")return{type:t,file:l,message:`Are you sure you want to discard changes in ${l}?`};if(t==="revert_all")return{type:t,message:"Are you sure you want to discard ALL unstaged changes? This cannot be undone."};if(t==="abort_operation"){let p=r?Bo[r]:"operation";return{type:t,message:`Abort the ${p}? Everything resolved so far is discarded and the working tree returns to its pre-${p} state.`}}if(t==="delete_branch"){let p=c?.branch??"",h=c?.force==="1";return{type:t,extra:{branch:p,...h?{force:"1"}:{}},message:h?`Delete branch ${p} even though its commits are not merged? This cannot be undone from the panel.`:`Delete branch ${p}?`}}if(t==="stash_drop"){let p=c?.ref||"the top entry";return{type:t,extra:{ref:c?.ref??""},message:`Drop ${p}? The stash entry is removed — this cannot be undone from the panel.`}}return null}function wr({className:t="",enabled:l=!0,rootPath:c,refreshKey:r=0}){let{activeRepo:p,setActiveRepo:h,repos:g,reposScanning:v,refreshRepos:N,isReading:M,isRefreshing:w,data:C,syncCount:R,loadRepo:G,refreshTopic:T}=Tt(c,l,r),y=At(c,p),[x,k]=S("git.viewMode","flat"),[A,F]=n(!1),O=i(null),[V,E]=n(!1),H=i(null),[Q,Y]=n(null),[z,I]=n(!1),[W,oe]=n(""),ie=i(null),[ve,pe]=n(!1),[he,ye]=n(null),[Pe,$e]=n(!1),{pushToast:ae}=He();o(()=>{$e(!0)},[]),o(()=>{if(z&&ie.current)ie.current.focus()},[z]),Bt({fetcher:y,onPage:ye,onReload:G,onSuccess:(X,te)=>ae(X,te),onError:(X)=>ae(X,"error")}),ue(O,()=>F(!1)),ue(H,()=>E(!1));let ee=y.execute,{message:Me,setMessage:ke,amend:Ce,seeded:Te,toggleAmend:Ae,commit:j,isGenerating:q,suggestion:ne,generated:Le,generate:ge,useSuggestion:De,dismissSuggestion:Ne}=Lt({rootPath:c,repo:p,execute:ee}),de=(X,te,we)=>{let Ke=Ft(X,te,we,C?.state?.operation??null);if(Ke){Y(Ke);return}ee(X,te,we)},Ht=(X,te)=>{ee("resolve_conflict",X,te?{side:te}:void 0)},We=C?.branch||"main",zt=C?.branches||["main"],Ot=C?.remoteBranches||[],qe=C?.changes||[],le=M||y.state!=="idle",Be=y.state==="idle"?null:y.lastAction?.actionType??null,It=Be==="sync"||Be==="push"||Be==="pull",_t=qe.filter((X)=>{if(_r(X.status))return!1;let te=X.status;return te&&te[0]!==" "&&te[0]!=="?"});if(!l)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`flex flex-col h-full bg-paper relative ${t}`,children:[e(Pt,{mounted:Pe,confirmModal:Q,onCloseConfirm:()=>Y(null),onConfirm:()=>{if(Q)ee(Q.type,Q.file,Q.extra),Y(null)},branchPrompt:z,newBranchName:W,newBranchInputRef:ie,onNewBranchNameChange:oe,onCloseBranchPrompt:()=>{I(!1),oe("")},onCreateBranch:()=>{if(W.trim())ee("create_branch",void 0,{branch:W.trim()}),I(!1),oe("")},viewingOutput:he,onCloseOutput:()=>ye(null),onRefreshOutput:()=>{if(he)ee(he.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(X,te,we)=>ee(X,te,we),branchModalOpen:ve,onCloseBranchModal:()=>pe(!1),rootPath:c,activeRepo:p,currentBranch:We,detached:C?.state?.detached??!1,isBusy:le,onBranchAction:(X,te)=>ee(X,void 0,te),onConfirmDeleteBranch:(X,te)=>{ee("delete_branch",void 0,{branch:X,...te?{force:"1"}:{}})}}),e(Je,{activeRepo:p,repos:g,isRefreshing:w,rootPath:c,reposScanning:v,onSelectRepo:(X)=>{if(X!==p)h(X)},onRefresh:()=>{T(),G()},onRefreshRepos:N}),C?.isRepo===!1?e(Mt,{repo:p,isBusy:le,onInit:()=>ee("init")}):e(d,{children:[e(Qe,{branchRef:H,showBranchMenu:V,setShowBranchMenu:E,branch:We,branches:zt,remoteBranches:Ot,onCheckout:(X)=>ee("checkout",void 0,{branch:X}),onMerge:(X)=>ee("merge_branch",void 0,{branch:X}),onOpenBranchPrompt:()=>I(!0),onManageBranches:()=>{pe(!0),E(!1)},optionsRef:O,showOptions:A,setShowOptions:F,onHistory:()=>ee("history"),onGraph:()=>ee("graph"),viewMode:x,setViewMode:k,isBusy:le,syncCount:R,syncing:It,onSync:()=>ee("sync"),onFetch:()=>ee("fetch"),detached:C?.state?.detached??!1}),C?.state?.operation?e(Ze,{operation:C.state.operation,conflicts:C.state.conflicts,isBusy:le,onAbort:()=>de("abort_operation"),onContinue:()=>ee("continue_operation")}):e(Xe,{message:Me,hasStagedChanges:_t.length>0,isBusy:le,amend:Ce,seeded:Te,isGenerating:q,suggestion:ne,generated:Le,onToggleAmend:Ae,onChangeMessage:ke,onCommit:j,onGenerate:ge,onUseSuggestion:De,onDismissSuggestion:Ne}),e(nt,{changes:qe,isLoading:le,viewMode:x,repo:p,rootPath:c,onAction:de,onResolve:Ht}),e($t,{rootPath:c,repo:p,isBusy:le,onAction:(X,te)=>de(X,void 0,te)})]})]})}export{wr as GitPanel};
@@ -1,2 +1,2 @@
1
- import{En}from"./index-2ks0m8ss.js";var X={};En(X,{default:()=>ua});var J={};En(J,{default:()=>io});var hr=typeof global=="object"&&global&&global.Object===Object&&global,H=hr;var cr=typeof self=="object"&&self&&self.Object===Object&&self,gr=H||cr||Function("return this")(),Ut=gr;var _r=Ut.Symbol,Bn=_r;var yt=Object.prototype,{hasOwnProperty:br,toString:Ar}=yt,G=Bn?Bn.toStringTag:void 0;function Tr(t){var e=br.call(t,G),r=t[G];try{t[G]=void 0;var o=!0}catch(f){}var a=Ar.call(t);if(o)if(e)t[G]=r;else delete t[G];return a}var bt=Tr;var wr=Object.prototype,Sr=wr.toString;function Cr(t){return Sr.call(t)}var vt=Cr;var Er="[object Null]",Ir="[object Undefined]",Ot=Bn?Bn.toStringTag:void 0;function Lr(t){if(t==null)return t===void 0?Ir:Er;return Ot&&Ot in Object(t)?bt(t):vt(t)}var ir=Lr;function jr(t){return t!=null&&typeof t=="object"}var Xt=jr;var Nr="[object Symbol]";function Dr(t){return typeof t=="symbol"||Xt(t)&&ir(t)==Nr}var Mr=Dr;function Rr(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 ao=Rr;var Fr=Array.isArray,ke=Fr;var Br=1/0,At=Bn?Bn.prototype:void 0,Tt=At?At.toString:void 0;function wt(t){if(typeof t=="string")return t;if(ke(t))return ao(t,wt)+"";if(Mr(t))return Tt?Tt.call(t):"";var e=t+"";return e=="0"&&1/t==-Br?"-0":e}var St=wt;function Gr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var _t=Gr;function Ur(t){return t}var yr=Ur;var zr="[object AsyncFunction]",Wr="[object Function]",Kr="[object GeneratorFunction]",Hr="[object Proxy]";function qr(t){if(!_t(t))return!1;var e=ir(t);return e==Wr||e==Kr||e==zr||e==Hr}var oo=qr;var $r=Ut["__core-js_shared__"],q=$r;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 Yr=Function.prototype,Xr=Yr.toString;function Zr(t){if(t!=null){try{return Xr.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var y=Zr;var Jr=/[\\^$.*+?()[\]{}|]/g,Qr=/^\[object .+?Constructor\]$/,Vr=Function.prototype,to=Object.prototype,eo=Vr.toString,ro=to.hasOwnProperty,fo=RegExp("^"+eo.call(ro).replace(Jr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function no(t){if(!_t(t)||Ct(t))return!1;var e=oo(t)?fo:Qr;return e.test(y(t))}var Et=no;function po(t,e){return t==null?void 0:t[e]}var It=po;function uo(t,e){var r=It(t,e);return Et(r)?r:void 0}var x=uo;var mo=x(Ut,"WeakMap"),k=mo;function xo(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=xo;function ho(){}var Mt=ho;var go=800,yo=16,_o=Date.now;function bo(t){var e=0,r=0;return function(){var o=_o(),a=yo-(o-r);if(r=o,a>0){if(++e>=go)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Nt=bo;function vo(t){return function(){return t}}var vr=vo;var Oo=function(){try{var t=x(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),Ol=Oo;var Ao=!Ol?yr:function(t,e){return Ol(t,"toString",{configurable:!0,enumerable:!1,value:vr(e),writable:!0})},Dt=Ao;var To=Nt(Dt),Kd=To;function wo(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 Vd=wo;function So(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 Yd=So;function Po(t){return t!==t}var Rt=Po;function Co(t,e,r){var o=r-1,a=t.length;while(++o<a)if(t[o]===e)return o;return-1}var Ft=Co;function Eo(t,e,r){return e===e?Ft(t,e,r):Yd(t,Rt,r)}var Bt=Eo;function Io(t,e){var r=t==null?0:t.length;return!!r&&Bt(t,e,0)>-1}var zt=Io;var Lo=9007199254740991,jo=/^(?:0|[1-9]\d*)$/;function Mo(t,e){var r=typeof t;return e=e==null?Lo:e,!!e&&(r=="number"||r!="symbol"&&jo.test(t))&&(t>-1&&t%1==0&&t<e)}var _i=Mo;function No(t,e){return t===e||t!==t&&e!==e}var ca=No;var Wt=Math.max;function Do(t,e,r){return e=Wt(e===void 0?t.length-1:e,0),function(){var o=arguments,a=-1,f=Wt(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 Jd=Do;function Ro(t,e){return Kd(Jd(t,e,yr),t+"")}var Si=Ro;var Fo=9007199254740991;function Bo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Fo}var j=Bo;function Go(t){return t!=null&&j(t.length)&&!oo(t)}var In=Go;var Uo=Object.prototype;function zo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Uo;return t===r}var Ti=zo;function Wo(t,e){var r=-1,o=Array(t);while(++r<t)o[r]=e(r);return o}var Kt=Wo;var Ko="[object Arguments]";function Ho(t){return Xt(t)&&ir(t)==Ko}var ut=Ho;var Ht=Object.prototype,{hasOwnProperty:qo,propertyIsEnumerable:$o}=Ht,ko=ut(function(){return arguments}())?ut:function(t){return Xt(t)&&qo.call(t,"callee")&&!$o.call(t,"callee")},Pa=ko;function Yo(){return!1}var qt=Yo;var Yt=typeof X=="object"&&X&&!X.nodeType&&X,$t=Yt&&typeof Y=="object"&&Y&&!Y.nodeType&&Y,Xo=$t&&$t.exports===Yt,kt=Xo?Ut.Buffer:void 0,Zo=kt?kt.isBuffer:void 0,Jo=Zo||qt,ua=Jo;var Qo="[object Arguments]",Vo="[object Array]",ta="[object Boolean]",ea="[object Date]",ra="[object Error]",oa="[object Function]",aa="[object Map]",fa="[object Number]",ia="[object Object]",na="[object RegExp]",sa="[object Set]",pa="[object String]",ma="[object WeakMap]",la="[object ArrayBuffer]",da="[object DataView]",xa="[object Float32Array]",ha="[object Float64Array]",ga="[object Int8Array]",ya="[object Int16Array]",_a="[object Int32Array]",ba="[object Uint8Array]",va="[object Uint8ClampedArray]",Oa="[object Uint16Array]",Aa="[object Uint32Array]",u={};u[xa]=u[ha]=u[ga]=u[ya]=u[_a]=u[ba]=u[va]=u[Oa]=u[Aa]=!0;u[Qo]=u[Vo]=u[la]=u[ta]=u[da]=u[ea]=u[ra]=u[oa]=u[aa]=u[fa]=u[ia]=u[na]=u[sa]=u[pa]=u[ma]=!1;function Ta(t){return Xt(t)&&j(t.length)&&!!u[ir(t)]}var Zt=Ta;function wa(t){return function(e){return t(e)}}var Di=wa;var Jt=typeof J=="object"&&J&&!J.nodeType&&J,U=Jt&&typeof Z=="object"&&Z&&!Z.nodeType&&Z,Sa=U&&U.exports===Jt,mt=Sa&&H.process,Ca=function(){try{var t=U&&U.require&&U.require("util").types;if(t)return t;return mt&&mt.binding&&mt.binding("util")}catch(e){}}(),io=Ca;var Qt=io&&io.isTypedArray,Ea=Qt?Di(Qt):Zt,Ni=Ea;var Ia=Object.prototype,La=Ia.hasOwnProperty;function ja(t,e){var r=ke(t),o=!r&&Pa(t),a=!r&&!o&&ua(t),f=!r&&!o&&!a&&Ni(t),i=r||o||a||f,n=i?Kt(t.length,String):[],s=n.length;for(var p in t)if((e||La.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||f&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||_i(p,s))))n.push(p);return n}var Zd=ja;function Ma(t,e){return function(r){return t(e(r))}}var Xd=Ma;var Na=Xd(Object.keys,Object),Vt=Na;var Da=Object.prototype,Ra=Da.hasOwnProperty;function Fa(t){if(!Ti(t))return Vt(t);var e=[];for(var r in Object(t))if(Ra.call(t,r)&&r!="constructor")e.push(r);return e}var $l=Fa;function Ba(t){return In(t)?Zd(t):$l(t)}var Gt=Ba;var Ga=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ua=/^\w*$/;function za(t,e){if(ke(t))return!1;var r=typeof t;if(r=="number"||r=="symbol"||r=="boolean"||t==null||Mr(t))return!0;return Ua.test(t)||!Ga.test(t)||e!=null&&t in Object(e)}var M=za;var Wa=x(Object,"create"),_=Wa;function Ka(){this.__data__=_?_(null):{},this.size=0}var te=Ka;function Ha(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ee=Ha;var qa="__lodash_hash_undefined__",$a=Object.prototype,ka=$a.hasOwnProperty;function Ya(t){var e=this.__data__;if(_){var r=e[t];return r===qa?void 0:r}return ka.call(e,t)?e[t]:void 0}var re=Ya;var Xa=Object.prototype,Za=Xa.hasOwnProperty;function Ja(t){var e=this.__data__;return _?e[t]!==void 0:Za.call(e,t)}var oe=Ja;var Qa="__lodash_hash_undefined__";function Va(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=_&&e===void 0?Qa:e,this}var ae=Va;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=te;N.prototype.delete=ee;N.prototype.get=re;N.prototype.has=oe;N.prototype.set=ae;var lt=N;function tf(){this.__data__=[],this.size=0}var fe=tf;function ef(t,e){var r=t.length;while(r--)if(ca(t[r][0],e))return r;return-1}var O=ef;var rf=Array.prototype,of=rf.splice;function af(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 of.call(e,r,1);return--this.size,!0}var ie=af;function ff(t){var e=this.__data__,r=O(e,t);return r<0?void 0:e[r][1]}var ne=ff;function nf(t){return O(this.__data__,t)>-1}var se=nf;function sf(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 pe=sf;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=fe;D.prototype.delete=ie;D.prototype.get=ne;D.prototype.has=se;D.prototype.set=pe;var A=D;var pf=x(Ut,"Map"),T=pf;function uf(){this.size=0,this.__data__={hash:new lt,map:new(T||A),string:new lt}}var ue=uf;function mf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var me=mf;function lf(t,e){var r=t.__data__;return me(e)?r[typeof e=="string"?"string":"hash"]:r.map}var w=lf;function df(t){var e=w(this,t).delete(t);return this.size-=e?1:0,e}var le=df;function xf(t){return w(this,t).get(t)}var de=xf;function hf(t){return w(this,t).has(t)}var xe=hf;function cf(t,e){var r=w(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var he=cf;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=ue;R.prototype.delete=le;R.prototype.get=de;R.prototype.has=xe;R.prototype.set=he;var E=R;var gf="Expected a function";function dt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw TypeError(gf);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(dt.Cache||E),r}dt.Cache=E;var ce=dt;var yf=500;function _f(t){var e=ce(t,function(o){if(r.size===yf)r.clear();return o}),r=e.cache;return e}var ge=_f;var bf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vf=/\\(\\)?/g,Of=ge(function(t){var e=[];if(t.charCodeAt(0)===46)e.push("");return t.replace(bf,function(r,o,a,f){e.push(a?f.replace(vf,"$1"):o||r)}),e}),ye=Of;function Af(t){return t==null?"":St(t)}var ep=Af;function Tf(t,e){if(ke(t))return t;return M(t,e)?[t]:ye(ep(t))}var Qi=Tf;var wf=1/0;function Sf(t){if(typeof t=="string"||Mr(t))return t;var e=t+"";return e=="0"&&1/t==-wf?"-0":e}var so=Sf;function Pf(t,e){e=Qi(e,t);var r=0,o=e.length;while(t!=null&&r<o)t=t[so(e[r++])];return r&&r==o?t:void 0}var Ri=Pf;function Cf(t,e,r){var o=t==null?void 0:Ri(t,e);return o===void 0?r:o}var _e=Cf;function Ef(t,e){var r=-1,o=e.length,a=t.length;while(++r<o)t[a+r]=e[r];return t}var zl=Ef;var be=Bn?Bn.isConcatSpreadable:void 0;function If(t){return ke(t)||Pa(t)||!!(be&&t&&t[be])}var ve=If;function Oe(t,e,r,o,a){var f=-1,i=t.length;r||(r=ve),a||(a=[]);while(++f<i){var n=t[f];if(e>0&&r(n))if(e>1)Oe(n,e-1,r,o,a);else zl(a,n);else if(!o)a[a.length]=n}return a}var Ul=Oe;function Lf(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 Ae=Lf;function jf(){this.__data__=new A,this.size=0}var Te=jf;function Mf(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var we=Mf;function Nf(t){return this.__data__.get(t)}var Se=Nf;function Df(t){return this.__data__.has(t)}var Pe=Df;var Rf=200;function Ff(t,e){var r=this.__data__;if(r instanceof A){var o=r.__data__;if(!T||o.length<Rf-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=Ff;function F(t){var e=this.__data__=new A(t);this.size=e.size}F.prototype.clear=Te;F.prototype.delete=we;F.prototype.get=Se;F.prototype.has=Pe;F.prototype.set=Ce;var lo=F;function Bf(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=Bf;function Gf(){return[]}var tp=Gf;var Uf=Object.prototype,zf=Uf.propertyIsEnumerable,Ee=Object.getOwnPropertySymbols,Wf=!Ee?tp:function(t){if(t==null)return[];return t=Object(t),Q(Ee(t),function(e){return zf.call(t,e)})},Gl=Wf;function Kf(t,e,r){var o=e(t);return ke(t)?o:zl(o,r(t))}var np=Kf;function Hf(t){return np(t,Gt,Gl)}var Lu=Hf;var qf=x(Ut,"DataView"),V=qf;var $f=x(Ut,"Promise"),tt=$f;var kf=x(Ut,"Set"),S=kf;var Ie="[object Map]",Yf="[object Object]",Le="[object Promise]",je="[object Set]",Me="[object WeakMap]",Ne="[object DataView]",Xf=y(V),Zf=y(T),Jf=y(tt),Qf=y(S),Vf=y(k),I=ir;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=ir(t),r=e==Yf?t.constructor:void 0,o=r?y(r):"";if(o)switch(o){case Xf:return Ne;case Zf:return Ie;case Jf:return Le;case Qf:return je;case Vf:return Me}return e};var Pr=I;var ti=Ut.Uint8Array,jl=ti;var ei="__lodash_hash_undefined__";function ri(t){return this.__data__.set(t,ei),this}var De=ri;function oi(t){return this.__data__.has(t)}var Re=oi;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 ai(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=ai;function fi(t,e){return t.has(e)}var ot=fi;var ii=1,ni=2;function si(t,e,r,o,a,f){var i=r&ii,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&ni?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=si;function pi(t){var e=-1,r=Array(t.size);return t.forEach(function(o,a){r[++e]=[a,o]}),r}var Be=pi;function ui(t){var e=-1,r=Array(t.size);return t.forEach(function(o){r[++e]=o}),r}var B=ui;var mi=1,li=2,di="[object Boolean]",xi="[object Date]",hi="[object Error]",ci="[object Map]",gi="[object Number]",yi="[object RegExp]",bi="[object Set]",vi="[object String]",Oi="[object Symbol]",Ai="[object ArrayBuffer]",wi="[object DataView]",Ue=Bn?Bn.prototype:void 0,xt=Ue?Ue.valueOf:void 0;function Pi(t,e,r,o,a,f,i){switch(r){case wi:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Ai:if(t.byteLength!=e.byteLength||!f(new jl(t),new jl(e)))return!1;return!0;case di:case xi:case gi:return ca(+t,+e);case hi:return t.name==e.name&&t.message==e.message;case yi:case vi:return t==e+"";case ci:var n=Be;case bi:var s=o&mi;if(n||(n=B),t.size!=e.size&&!s)return!1;var p=i.get(t);if(p)return p==e;o|=li,i.set(t,e);var d=at(n(t),n(e),o,a,f,i);return i.delete(t),d;case Oi:if(xt)return xt.call(t)==xt.call(e)}return!1}var ze=Pi;var Ci=1,Ei=Object.prototype,Ii=Ei.hasOwnProperty;function Li(t,e,r,o,a,f){var i=r&Ci,n=Lu(t),s=n.length,p=Lu(e),d=p.length;if(s!=d&&!i)return!1;var l=s;while(l--){var m=n[l];if(!(i?m in e:Ii.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 gt=i?o(C,P,m,e,t,f):o(P,C,m,t,e,f);if(!(gt===void 0?P===C||a(P,C,r,o,f):gt)){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 We=Li;var ji=1,Ke="[object Arguments]",He="[object Array]",ft="[object Object]",Mi=Object.prototype,qe=Mi.hasOwnProperty;function Bi(t,e,r,o,a,f){var i=ke(t),n=ke(e),s=i?He:Pr(t),p=n?He:Pr(e);s=s==Ke?ft:s,p=p==Ke?ft:p;var d=s==ft,l=p==ft,m=s==p;if(m&&ua(t)){if(!ua(e))return!1;i=!0,d=!1}if(m&&!d)return f||(f=new lo),i||Ni(t)?at(t,e,r,o,a,f):ze(t,e,s,r,o,a,f);if(!(r&ji)){var g=d&&qe.call(t,"__wrapped__"),h=l&&qe.call(e,"__wrapped__");if(g||h){var c=g?t.value():t,b=h?e.value():e;return f||(f=new lo),a(c,b,r,o,f)}}if(!m)return!1;return f||(f=new lo),We(t,e,r,o,a,f)}var $e=Bi;function Ye(t,e,r,o,a){if(t===e)return!0;if(t==null||e==null||!Xt(t)&&!Xt(e))return t!==t&&e!==e;return $e(t,e,r,o,Ye,a)}var it=Ye;var Gi=1,Ui=2;function zi(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 lo;if(o)var m=o(p,d,s,t,e,l);if(!(m===void 0?it(d,p,Gi|Ui,o,l):m))return!1}}return!0}var Xe=zi;function Wi(t){return t===t&&!_t(t)}var nt=Wi;function Ki(t){var e=Gt(t),r=e.length;while(r--){var o=e[r],a=t[o];e[r]=[o,a,nt(a)]}return e}var Ze=Ki;function Hi(t,e){return function(r){if(r==null)return!1;return r[t]===e&&(e!==void 0||(t in Object(r)))}}var st=Hi;function qi(t){var e=Ze(t);if(e.length==1&&e[0][2])return st(e[0][0],e[0][1]);return function(r){return r===t||Xe(r,t,e)}}var Je=qi;function $i(t,e){return t!=null&&e in Object(t)}var Qe=$i;function ki(t,e,r){e=Qi(e,t);var o=-1,a=e.length,f=!1;while(++o<a){var i=so(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)&&_i(i,a)&&(ke(t)||Pa(t))}var rp=ki;function Yi(t,e){return t!=null&&rp(t,e,Qe)}var ap=Yi;var Xi=1,Zi=2;function Ji(t,e){if(M(t)&&nt(e))return st(so(t),e);return function(r){var o=_e(r,t);return o===void 0&&o===e?ap(r,t):it(e,o,Xi|Zi)}}var Ve=Ji;function Vi(t){return function(e){return e==null?void 0:e[t]}}var op=Vi;function tn(t){return function(e){return Ri(e,t)}}var tr=tn;function en(t){return M(t)?op(so(t)):tr(t)}var er=en;function rn(t){if(typeof t=="function")return t;if(t==null)return yr;if(typeof t=="object")return ke(t)?Ve(t[0],t[1]):Je(t);return er(t)}var Wn=rn;function on(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 rr=on;var an=rr(),ql=an;function fn(t,e){return t&&ql(t,e,Gt)}var Hl=fn;function nn(t,e){return function(r,o){if(r==null)return r;if(!In(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 or=nn;var sn=or(Hl),Fi=sn;function pn(t){return Xt(t)&&In(t)}var ip=pn;function un(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 ar=un;function mn(t){return typeof t=="function"?t:yr}var Wl=mn;function ln(t,e){var r=ke(t)?Vd:Fi;return r(t,Wl(e))}var v=ln;function dn(t,e){var r=[];return Fi(t,function(o,a,f){if(e(o,a,f))r.push(o)}),r}var fr=dn;function xn(t,e){var r=ke(t)?Q:fr;return r(t,Wn(e,3))}var sr=xn;function hn(t,e){return ao(e,function(r){return t[r]})}var nr=hn;function cn(t){return t==null?[]:nr(t,Gt(t))}var Or=cn;var gn="[object Map]",yn="[object Set]",_n=Object.prototype,bn=_n.hasOwnProperty;function vn(t){if(t==null)return!0;if(In(t)&&(ke(t)||typeof t=="string"||typeof t.splice=="function"||ua(t)||Ni(t)||Pa(t)))return!t.length;var e=Pr(t);if(e==gn||e==yn)return!t.size;if(Ti(t))return!$l(t).length;for(var r in t)if(bn.call(t,r))return!1;return!0}var pt=vn;function On(t){return t===void 0}var jt=On;function An(t,e,r,o,a){return a(t,function(f,i,n){r=o?(o=!1,f):e(r,f,i,n)}),r}var pr=An;function Tn(t,e,r){var o=ke(t)?Ae:pr,a=arguments.length<3;return o(t,Wn(e,4),r,a,Fi)}var co=Tn;var wn=1/0,Sn=!(S&&1/B(new S([,-0]))[1]==wn)?Mt:function(t){return new S(t)},ur=Sn;var Pn=200;function Cn(t,e,r){var o=-1,a=zt,f=t.length,i=!0,n=[],s=n;if(r)i=!1,a=ar;else if(f>=Pn){var p=e?null:ur(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 mr=Cn;var Ln=Si(function(t){return mr(Ul(t,1,ip,!0))}),ht=Ln;var Mn="\x00",L="\x00",lr="\x01";class Ge{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=vr(void 0),this._defaultEdgeLabelFn=vr(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(!oo(t))t=vr(t);return this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Gt(this._nodes)}sources(){var t=this;return sr(this.nodes(),function(e){return pt(t._in[e])})}sinks(){var t=this;return sr(this.nodes(),function(e){return pt(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(Gt(this._in[t]),e),delete this._in[t],delete this._preds[t],v(Gt(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(jt(e))e=L;else{e+="";for(var r=e;!jt(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(jt(t))t=L;if(this._isCompound){var e=this._children[t];if(e)return Gt(e)}else if(t===L)return this.nodes();else if(this.hasNode(t))return[]}predecessors(t){var e=this._preds[t];if(e)return Gt(e)}successors(t){var e=this._sucs[t];if(e)return Gt(e)}neighbors(t){var e=this.predecessors(t);if(e)return ht(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(!oo(t))t=vr(t);return this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Or(this._edgeObjs)}setPath(t,e){var r=this,o=arguments;return co(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,!jt(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(!jt(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=Nn(this._isDirected,t,e,r);return t=n.v,e=n.w,Object.freeze(n),this._edgeObjs[i]=n,dr(this._preds[e],t),dr(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?ct(this._isDirected,arguments[0]):z(this._isDirected,t,e,r);return this._edgeLabels[o]}hasEdge(t,e,r){var o=arguments.length===1?ct(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?ct(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],xr(this._preds[e],t),xr(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=Or(r);if(!e)return o;return sr(o,function(a){return a.v===e})}}outEdges(t,e){var r=this._out[t];if(r){var o=Or(r);if(!e)return o;return sr(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))}}Ge.prototype._nodeCount=0;Ge.prototype._edgeCount=0;function dr(t,e){if(t[e])t[e]++;else t[e]=1}function xr(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+lr+f+lr+(jt(o)?Mn:o)}function Nn(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 ct(t,e){return z(t,e.v,e.w,e.name)}
2
- export{Ut,Bn,ir,Xt,Mr,ao,ke,_t,yr,oo,vr,Ol,Kd,Vd,Yd,_i,ca,Jd,Si,In,Ti,Pa,ua,Di,io,Ni,Zd,Xd,$l,Gt,ep,Qi,so,Ri,zl,Ul,lo,tp,Gl,np,Lu,Pr,jl,rp,ap,op,Wn,ql,Hl,Fi,ip,Wl,v,sr,Or,jt,co,Ge};
1
+ import{En}from"./index-evmcc5qh.js";var X={};En(X,{default:()=>ua});var J={};En(J,{default:()=>io});var hr=typeof global=="object"&&global&&global.Object===Object&&global,H=hr;var cr=typeof self=="object"&&self&&self.Object===Object&&self,gr=H||cr||Function("return this")(),Ut=gr;var _r=Ut.Symbol,Bn=_r;var yt=Object.prototype,{hasOwnProperty:br,toString:Ar}=yt,G=Bn?Bn.toStringTag:void 0;function Tr(t){var e=br.call(t,G),r=t[G];try{t[G]=void 0;var o=!0}catch(f){}var a=Ar.call(t);if(o)if(e)t[G]=r;else delete t[G];return a}var bt=Tr;var wr=Object.prototype,Sr=wr.toString;function Cr(t){return Sr.call(t)}var vt=Cr;var Er="[object Null]",Ir="[object Undefined]",Ot=Bn?Bn.toStringTag:void 0;function Lr(t){if(t==null)return t===void 0?Ir:Er;return Ot&&Ot in Object(t)?bt(t):vt(t)}var ir=Lr;function jr(t){return t!=null&&typeof t=="object"}var Xt=jr;var Nr="[object Symbol]";function Dr(t){return typeof t=="symbol"||Xt(t)&&ir(t)==Nr}var Mr=Dr;function Rr(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 ao=Rr;var Fr=Array.isArray,ke=Fr;var Br=1/0,At=Bn?Bn.prototype:void 0,Tt=At?At.toString:void 0;function wt(t){if(typeof t=="string")return t;if(ke(t))return ao(t,wt)+"";if(Mr(t))return Tt?Tt.call(t):"";var e=t+"";return e=="0"&&1/t==-Br?"-0":e}var St=wt;function Gr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var _t=Gr;function Ur(t){return t}var yr=Ur;var zr="[object AsyncFunction]",Wr="[object Function]",Kr="[object GeneratorFunction]",Hr="[object Proxy]";function qr(t){if(!_t(t))return!1;var e=ir(t);return e==Wr||e==Kr||e==zr||e==Hr}var oo=qr;var $r=Ut["__core-js_shared__"],q=$r;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 Yr=Function.prototype,Xr=Yr.toString;function Zr(t){if(t!=null){try{return Xr.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var y=Zr;var Jr=/[\\^$.*+?()[\]{}|]/g,Qr=/^\[object .+?Constructor\]$/,Vr=Function.prototype,to=Object.prototype,eo=Vr.toString,ro=to.hasOwnProperty,fo=RegExp("^"+eo.call(ro).replace(Jr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function no(t){if(!_t(t)||Ct(t))return!1;var e=oo(t)?fo:Qr;return e.test(y(t))}var Et=no;function po(t,e){return t==null?void 0:t[e]}var It=po;function uo(t,e){var r=It(t,e);return Et(r)?r:void 0}var x=uo;var mo=x(Ut,"WeakMap"),k=mo;function xo(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=xo;function ho(){}var Mt=ho;var go=800,yo=16,_o=Date.now;function bo(t){var e=0,r=0;return function(){var o=_o(),a=yo-(o-r);if(r=o,a>0){if(++e>=go)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Nt=bo;function vo(t){return function(){return t}}var vr=vo;var Oo=function(){try{var t=x(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),$l=Oo;var Ao=!$l?yr:function(t,e){return $l(t,"toString",{configurable:!0,enumerable:!1,value:vr(e),writable:!0})},Dt=Ao;var To=Nt(Dt),Yd=To;function wo(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 Jd=wo;function So(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 Zd=So;function Po(t){return t!==t}var Rt=Po;function Co(t,e,r){var o=r-1,a=t.length;while(++o<a)if(t[o]===e)return o;return-1}var Ft=Co;function Eo(t,e,r){return e===e?Ft(t,e,r):Zd(t,Rt,r)}var Bt=Eo;function Io(t,e){var r=t==null?0:t.length;return!!r&&Bt(t,e,0)>-1}var zt=Io;var Lo=9007199254740991,jo=/^(?:0|[1-9]\d*)$/;function Mo(t,e){var r=typeof t;return e=e==null?Lo:e,!!e&&(r=="number"||r!="symbol"&&jo.test(t))&&(t>-1&&t%1==0&&t<e)}var Ti=Mo;function No(t,e){return t===e||t!==t&&e!==e}var ca=No;var Wt=Math.max;function Do(t,e,r){return e=Wt(e===void 0?t.length-1:e,0),function(){var o=arguments,a=-1,f=Wt(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 Xd=Do;function Ro(t,e){return Yd(Xd(t,e,yr),t+"")}var Di=Ro;var Fo=9007199254740991;function Bo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Fo}var j=Bo;function Go(t){return t!=null&&j(t.length)&&!oo(t)}var In=Go;var Uo=Object.prototype;function zo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Uo;return t===r}var Ni=zo;function Wo(t,e){var r=-1,o=Array(t);while(++r<t)o[r]=e(r);return o}var Kt=Wo;var Ko="[object Arguments]";function Ho(t){return Xt(t)&&ir(t)==Ko}var ut=Ho;var Ht=Object.prototype,{hasOwnProperty:qo,propertyIsEnumerable:$o}=Ht,ko=ut(function(){return arguments}())?ut:function(t){return Xt(t)&&qo.call(t,"callee")&&!$o.call(t,"callee")},Pa=ko;function Yo(){return!1}var qt=Yo;var Yt=typeof X=="object"&&X&&!X.nodeType&&X,$t=Yt&&typeof Y=="object"&&Y&&!Y.nodeType&&Y,Xo=$t&&$t.exports===Yt,kt=Xo?Ut.Buffer:void 0,Zo=kt?kt.isBuffer:void 0,Jo=Zo||qt,ua=Jo;var Qo="[object Arguments]",Vo="[object Array]",ta="[object Boolean]",ea="[object Date]",ra="[object Error]",oa="[object Function]",aa="[object Map]",fa="[object Number]",ia="[object Object]",na="[object RegExp]",sa="[object Set]",pa="[object String]",ma="[object WeakMap]",la="[object ArrayBuffer]",da="[object DataView]",xa="[object Float32Array]",ha="[object Float64Array]",ga="[object Int8Array]",ya="[object Int16Array]",_a="[object Int32Array]",ba="[object Uint8Array]",va="[object Uint8ClampedArray]",Oa="[object Uint16Array]",Aa="[object Uint32Array]",u={};u[xa]=u[ha]=u[ga]=u[ya]=u[_a]=u[ba]=u[va]=u[Oa]=u[Aa]=!0;u[Qo]=u[Vo]=u[la]=u[ta]=u[da]=u[ea]=u[ra]=u[oa]=u[aa]=u[fa]=u[ia]=u[na]=u[sa]=u[pa]=u[ma]=!1;function Ta(t){return Xt(t)&&j(t.length)&&!!u[ir(t)]}var Zt=Ta;function wa(t){return function(e){return t(e)}}var Qi=wa;var Jt=typeof J=="object"&&J&&!J.nodeType&&J,U=Jt&&typeof Z=="object"&&Z&&!Z.nodeType&&Z,Sa=U&&U.exports===Jt,mt=Sa&&H.process,Ca=function(){try{var t=U&&U.require&&U.require("util").types;if(t)return t;return mt&&mt.binding&&mt.binding("util")}catch(e){}}(),io=Ca;var Qt=io&&io.isTypedArray,Ea=Qt?Qi(Qt):Zt,Ri=Ea;var Ia=Object.prototype,La=Ia.hasOwnProperty;function ja(t,e){var r=ke(t),o=!r&&Pa(t),a=!r&&!o&&ua(t),f=!r&&!o&&!a&&Ri(t),i=r||o||a||f,n=i?Kt(t.length,String):[],s=n.length;for(var p in t)if((e||La.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||f&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Ti(p,s))))n.push(p);return n}var ep=ja;function Ma(t,e){return function(r){return t(e(r))}}var tp=Ma;var Na=tp(Object.keys,Object),Vt=Na;var Da=Object.prototype,Ra=Da.hasOwnProperty;function Fa(t){if(!Ni(t))return Vt(t);var e=[];for(var r in Object(t))if(Ra.call(t,r)&&r!="constructor")e.push(r);return e}var zl=Fa;function Ba(t){return In(t)?ep(t):zl(t)}var Gt=Ba;var Ga=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ua=/^\w*$/;function za(t,e){if(ke(t))return!1;var r=typeof t;if(r=="number"||r=="symbol"||r=="boolean"||t==null||Mr(t))return!0;return Ua.test(t)||!Ga.test(t)||e!=null&&t in Object(e)}var M=za;var Wa=x(Object,"create"),_=Wa;function Ka(){this.__data__=_?_(null):{},this.size=0}var te=Ka;function Ha(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ee=Ha;var qa="__lodash_hash_undefined__",$a=Object.prototype,ka=$a.hasOwnProperty;function Ya(t){var e=this.__data__;if(_){var r=e[t];return r===qa?void 0:r}return ka.call(e,t)?e[t]:void 0}var re=Ya;var Xa=Object.prototype,Za=Xa.hasOwnProperty;function Ja(t){var e=this.__data__;return _?e[t]!==void 0:Za.call(e,t)}var oe=Ja;var Qa="__lodash_hash_undefined__";function Va(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=_&&e===void 0?Qa:e,this}var ae=Va;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=te;N.prototype.delete=ee;N.prototype.get=re;N.prototype.has=oe;N.prototype.set=ae;var lt=N;function tf(){this.__data__=[],this.size=0}var fe=tf;function ef(t,e){var r=t.length;while(r--)if(ca(t[r][0],e))return r;return-1}var O=ef;var rf=Array.prototype,of=rf.splice;function af(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 of.call(e,r,1);return--this.size,!0}var ie=af;function ff(t){var e=this.__data__,r=O(e,t);return r<0?void 0:e[r][1]}var ne=ff;function nf(t){return O(this.__data__,t)>-1}var se=nf;function sf(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 pe=sf;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=fe;D.prototype.delete=ie;D.prototype.get=ne;D.prototype.has=se;D.prototype.set=pe;var A=D;var pf=x(Ut,"Map"),T=pf;function uf(){this.size=0,this.__data__={hash:new lt,map:new(T||A),string:new lt}}var ue=uf;function mf(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var me=mf;function lf(t,e){var r=t.__data__;return me(e)?r[typeof e=="string"?"string":"hash"]:r.map}var w=lf;function df(t){var e=w(this,t).delete(t);return this.size-=e?1:0,e}var le=df;function xf(t){return w(this,t).get(t)}var de=xf;function hf(t){return w(this,t).has(t)}var xe=hf;function cf(t,e){var r=w(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var he=cf;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=ue;R.prototype.delete=le;R.prototype.get=de;R.prototype.has=xe;R.prototype.set=he;var E=R;var gf="Expected a function";function dt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw TypeError(gf);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(dt.Cache||E),r}dt.Cache=E;var ce=dt;var yf=500;function _f(t){var e=ce(t,function(o){if(r.size===yf)r.clear();return o}),r=e.cache;return e}var ge=_f;var bf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vf=/\\(\\)?/g,Of=ge(function(t){var e=[];if(t.charCodeAt(0)===46)e.push("");return t.replace(bf,function(r,o,a,f){e.push(a?f.replace(vf,"$1"):o||r)}),e}),ye=Of;function Af(t){return t==null?"":St(t)}var np=Af;function Tf(t,e){if(ke(t))return t;return M(t,e)?[t]:ye(np(t))}var Fi=Tf;var wf=1/0;function Sf(t){if(typeof t=="string"||Mr(t))return t;var e=t+"";return e=="0"&&1/t==-wf?"-0":e}var so=Sf;function Pf(t,e){e=Fi(e,t);var r=0,o=e.length;while(t!=null&&r<o)t=t[so(e[r++])];return r&&r==o?t:void 0}var Li=Pf;function Cf(t,e,r){var o=t==null?void 0:Li(t,e);return o===void 0?r:o}var _e=Cf;function Ef(t,e){var r=-1,o=e.length,a=t.length;while(++r<o)t[a+r]=e[r];return t}var Ul=Ef;var be=Bn?Bn.isConcatSpreadable:void 0;function If(t){return ke(t)||Pa(t)||!!(be&&t&&t[be])}var ve=If;function Oe(t,e,r,o,a){var f=-1,i=t.length;r||(r=ve),a||(a=[]);while(++f<i){var n=t[f];if(e>0&&r(n))if(e>1)Oe(n,e-1,r,o,a);else Ul(a,n);else if(!o)a[a.length]=n}return a}var Gl=Oe;function Lf(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 Ae=Lf;function jf(){this.__data__=new A,this.size=0}var Te=jf;function Mf(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var we=Mf;function Nf(t){return this.__data__.get(t)}var Se=Nf;function Df(t){return this.__data__.has(t)}var Pe=Df;var Rf=200;function Ff(t,e){var r=this.__data__;if(r instanceof A){var o=r.__data__;if(!T||o.length<Rf-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=Ff;function F(t){var e=this.__data__=new A(t);this.size=e.size}F.prototype.clear=Te;F.prototype.delete=we;F.prototype.get=Se;F.prototype.has=Pe;F.prototype.set=Ce;var lo=F;function Bf(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=Bf;function Gf(){return[]}var rp=Gf;var Uf=Object.prototype,zf=Uf.propertyIsEnumerable,Ee=Object.getOwnPropertySymbols,Wf=!Ee?rp:function(t){if(t==null)return[];return t=Object(t),Q(Ee(t),function(e){return zf.call(t,e)})},jl=Wf;function Kf(t,e,r){var o=e(t);return ke(t)?o:Ul(o,r(t))}var ap=Kf;function Hf(t){return ap(t,Gt,jl)}var Ou=Hf;var qf=x(Ut,"DataView"),V=qf;var $f=x(Ut,"Promise"),tt=$f;var kf=x(Ut,"Set"),S=kf;var Ie="[object Map]",Yf="[object Object]",Le="[object Promise]",je="[object Set]",Me="[object WeakMap]",Ne="[object DataView]",Xf=y(V),Zf=y(T),Jf=y(tt),Qf=y(S),Vf=y(k),I=ir;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=ir(t),r=e==Yf?t.constructor:void 0,o=r?y(r):"";if(o)switch(o){case Xf:return Ne;case Zf:return Ie;case Jf:return Le;case Qf:return je;case Vf:return Me}return e};var Pr=I;var ti=Ut.Uint8Array,ql=ti;var ei="__lodash_hash_undefined__";function ri(t){return this.__data__.set(t,ei),this}var De=ri;function oi(t){return this.__data__.has(t)}var Re=oi;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 ai(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=ai;function fi(t,e){return t.has(e)}var ot=fi;var ii=1,ni=2;function si(t,e,r,o,a,f){var i=r&ii,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&ni?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=si;function pi(t){var e=-1,r=Array(t.size);return t.forEach(function(o,a){r[++e]=[a,o]}),r}var Be=pi;function ui(t){var e=-1,r=Array(t.size);return t.forEach(function(o){r[++e]=o}),r}var B=ui;var mi=1,li=2,di="[object Boolean]",xi="[object Date]",hi="[object Error]",ci="[object Map]",gi="[object Number]",yi="[object RegExp]",_i="[object Set]",bi="[object String]",vi="[object Symbol]",Oi="[object ArrayBuffer]",Ai="[object DataView]",Ue=Bn?Bn.prototype:void 0,xt=Ue?Ue.valueOf:void 0;function wi(t,e,r,o,a,f,i){switch(r){case Ai:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Oi:if(t.byteLength!=e.byteLength||!f(new ql(t),new ql(e)))return!1;return!0;case di:case xi:case gi:return ca(+t,+e);case hi:return t.name==e.name&&t.message==e.message;case yi:case bi:return t==e+"";case ci:var n=Be;case _i:var s=o&mi;if(n||(n=B),t.size!=e.size&&!s)return!1;var p=i.get(t);if(p)return p==e;o|=li,i.set(t,e);var d=at(n(t),n(e),o,a,f,i);return i.delete(t),d;case vi:if(xt)return xt.call(t)==xt.call(e)}return!1}var ze=wi;var Si=1,Pi=Object.prototype,Ci=Pi.hasOwnProperty;function Ei(t,e,r,o,a,f){var i=r&Si,n=Ou(t),s=n.length,p=Ou(e),d=p.length;if(s!=d&&!i)return!1;var l=s;while(l--){var m=n[l];if(!(i?m in e:Ci.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 gt=i?o(C,P,m,e,t,f):o(P,C,m,t,e,f);if(!(gt===void 0?P===C||a(P,C,r,o,f):gt)){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 We=Ei;var Ii=1,Ke="[object Arguments]",He="[object Array]",ft="[object Object]",ji=Object.prototype,qe=ji.hasOwnProperty;function Bi(t,e,r,o,a,f){var i=ke(t),n=ke(e),s=i?He:Pr(t),p=n?He:Pr(e);s=s==Ke?ft:s,p=p==Ke?ft:p;var d=s==ft,l=p==ft,m=s==p;if(m&&ua(t)){if(!ua(e))return!1;i=!0,d=!1}if(m&&!d)return f||(f=new lo),i||Ri(t)?at(t,e,r,o,a,f):ze(t,e,s,r,o,a,f);if(!(r&Ii)){var g=d&&qe.call(t,"__wrapped__"),h=l&&qe.call(e,"__wrapped__");if(g||h){var c=g?t.value():t,b=h?e.value():e;return f||(f=new lo),a(c,b,r,o,f)}}if(!m)return!1;return f||(f=new lo),We(t,e,r,o,a,f)}var $e=Bi;function Ye(t,e,r,o,a){if(t===e)return!0;if(t==null||e==null||!Xt(t)&&!Xt(e))return t!==t&&e!==e;return $e(t,e,r,o,Ye,a)}var it=Ye;var Gi=1,Ui=2;function zi(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 lo;if(o)var m=o(p,d,s,t,e,l);if(!(m===void 0?it(d,p,Gi|Ui,o,l):m))return!1}}return!0}var Xe=zi;function Wi(t){return t===t&&!_t(t)}var nt=Wi;function Ki(t){var e=Gt(t),r=e.length;while(r--){var o=e[r],a=t[o];e[r]=[o,a,nt(a)]}return e}var Ze=Ki;function Hi(t,e){return function(r){if(r==null)return!1;return r[t]===e&&(e!==void 0||(t in Object(r)))}}var st=Hi;function qi(t){var e=Ze(t);if(e.length==1&&e[0][2])return st(e[0][0],e[0][1]);return function(r){return r===t||Xe(r,t,e)}}var Je=qi;function $i(t,e){return t!=null&&e in Object(t)}var Qe=$i;function ki(t,e,r){e=Fi(e,t);var o=-1,a=e.length,f=!1;while(++o<a){var i=so(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)&&Ti(i,a)&&(ke(t)||Pa(t))}var op=ki;function Yi(t,e){return t!=null&&op(t,e,Qe)}var ip=Yi;var Xi=1,Zi=2;function Ji(t,e){if(M(t)&&nt(e))return st(so(t),e);return function(r){var o=_e(r,t);return o===void 0&&o===e?ip(r,t):it(e,o,Xi|Zi)}}var Ve=Ji;function Vi(t){return function(e){return e==null?void 0:e[t]}}var sp=Vi;function tn(t){return function(e){return Li(e,t)}}var tr=tn;function en(t){return M(t)?sp(so(t)):tr(t)}var er=en;function rn(t){if(typeof t=="function")return t;if(t==null)return yr;if(typeof t=="object")return ke(t)?Ve(t[0],t[1]):Je(t);return er(t)}var Wn=rn;function on(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 rr=on;var an=rr(),Hl=an;function fn(t,e){return t&&Hl(t,e,Gt)}var Wl=fn;function nn(t,e){return function(r,o){if(r==null)return r;if(!In(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 or=nn;var sn=or(Wl),Mi=sn;function pn(t){return Xt(t)&&In(t)}var lp=pn;function un(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 ar=un;function mn(t){return typeof t=="function"?t:yr}var Kl=mn;function ln(t,e){var r=ke(t)?Jd:Mi;return r(t,Kl(e))}var v=ln;function dn(t,e){var r=[];return Mi(t,function(o,a,f){if(e(o,a,f))r.push(o)}),r}var fr=dn;function xn(t,e){var r=ke(t)?Q:fr;return r(t,Wn(e,3))}var sr=xn;function hn(t,e){return ao(e,function(r){return t[r]})}var nr=hn;function cn(t){return t==null?[]:nr(t,Gt(t))}var Or=cn;var gn="[object Map]",yn="[object Set]",_n=Object.prototype,bn=_n.hasOwnProperty;function vn(t){if(t==null)return!0;if(In(t)&&(ke(t)||typeof t=="string"||typeof t.splice=="function"||ua(t)||Ri(t)||Pa(t)))return!t.length;var e=Pr(t);if(e==gn||e==yn)return!t.size;if(Ni(t))return!zl(t).length;for(var r in t)if(bn.call(t,r))return!1;return!0}var pt=vn;function On(t){return t===void 0}var jt=On;function An(t,e,r,o,a){return a(t,function(f,i,n){r=o?(o=!1,f):e(r,f,i,n)}),r}var pr=An;function Tn(t,e,r){var o=ke(t)?Ae:pr,a=arguments.length<3;return o(t,Wn(e,4),r,a,Mi)}var co=Tn;var wn=1/0,Sn=!(S&&1/B(new S([,-0]))[1]==wn)?Mt:function(t){return new S(t)},ur=Sn;var Pn=200;function Cn(t,e,r){var o=-1,a=zt,f=t.length,i=!0,n=[],s=n;if(r)i=!1,a=ar;else if(f>=Pn){var p=e?null:ur(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 mr=Cn;var Ln=Di(function(t){return mr(Gl(t,1,lp,!0))}),ht=Ln;var Mn="\x00",L="\x00",lr="\x01";class Ge{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=vr(void 0),this._defaultEdgeLabelFn=vr(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(!oo(t))t=vr(t);return this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Gt(this._nodes)}sources(){var t=this;return sr(this.nodes(),function(e){return pt(t._in[e])})}sinks(){var t=this;return sr(this.nodes(),function(e){return pt(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(Gt(this._in[t]),e),delete this._in[t],delete this._preds[t],v(Gt(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(jt(e))e=L;else{e+="";for(var r=e;!jt(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(jt(t))t=L;if(this._isCompound){var e=this._children[t];if(e)return Gt(e)}else if(t===L)return this.nodes();else if(this.hasNode(t))return[]}predecessors(t){var e=this._preds[t];if(e)return Gt(e)}successors(t){var e=this._sucs[t];if(e)return Gt(e)}neighbors(t){var e=this.predecessors(t);if(e)return ht(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(!oo(t))t=vr(t);return this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Or(this._edgeObjs)}setPath(t,e){var r=this,o=arguments;return co(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,!jt(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(!jt(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=Nn(this._isDirected,t,e,r);return t=n.v,e=n.w,Object.freeze(n),this._edgeObjs[i]=n,dr(this._preds[e],t),dr(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?ct(this._isDirected,arguments[0]):z(this._isDirected,t,e,r);return this._edgeLabels[o]}hasEdge(t,e,r){var o=arguments.length===1?ct(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?ct(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],xr(this._preds[e],t),xr(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=Or(r);if(!e)return o;return sr(o,function(a){return a.v===e})}}outEdges(t,e){var r=this._out[t];if(r){var o=Or(r);if(!e)return o;return sr(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))}}Ge.prototype._nodeCount=0;Ge.prototype._edgeCount=0;function dr(t,e){if(t[e])t[e]++;else t[e]=1}function xr(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+lr+f+lr+(jt(o)?Mn:o)}function Nn(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 ct(t,e){return z(t,e.v,e.w,e.name)}
2
+ export{Ut,Bn,ir,Xt,Mr,ao,ke,_t,yr,oo,vr,$l,Yd,Jd,Zd,Ti,ca,Xd,Di,In,Ni,Pa,ua,Qi,io,Ri,ep,tp,zl,Gt,np,Fi,so,Li,Ul,Gl,lo,rp,jl,ap,Ou,Pr,ql,op,ip,sp,Wn,Hl,Wl,Mi,lp,Kl,v,sr,Or,jt,co,Ge};
@@ -1,2 +1,2 @@
1
- import{t,Wt}from"./index-60v30k5h.js";var N=5,R=0.00001,X=2,Y=0.6,w=0.000001;function P(n){let o=[];for(let r=0;r<n.length-1;r++)o.push({a:n[r],b:n[r+1]});return o}t(P,"buildSegmentList");function T(n,o,r,a){let c=o.x-n.x,s=o.y-n.y,u=a.x-r.x,f=a.y-r.y,d=c*f-s*u;if(d===0)return null;let e=r.x-n.x,i=r.y-n.y,h=(e*f-i*u)/d,p=(e*s-i*c)/d;if(h<=w||h>=1-w||p<=w||p>=1-w)return null;return{point:{x:n.x+h*c,y:n.y+h*s},tA:h,tB:p}}t(T,"segmentIntersection");function v(n){return Math.abs(n.b.x-n.a.x)>=Math.abs(n.b.y-n.a.y)}t(v,"isHorizontalSeg");function B(n,o,r){if(n.curve!=="rounded")return!1;let a=n.points,c=a[o],s=a[o+1];if(!c||!s)return!1;let u=Math.hypot(s.x-c.x,s.y-c.y),f=r*u,d=o>0?L(a[o-1],c,s,N):null;if(d&&f<d.cutLen)return!0;let e=o+2<a.length?L(c,s,a[o+2],N):null;return e!==null&&u-f<e.cutLen}t(B,"crossingSitsInRoundedCorner");function C(n){let o=[];for(let r=0;r<n.length;r++){let a=n[r],c=P(a.points);for(let s=r+1;s<n.length;s++){let u=n[s],f=P(u.points);for(let[d,e]of c.entries())for(let[i,h]of f.entries()){let p=T(e.a,e.b,h.a,h.b);if(!p)continue;if(B(a,d,p.tA)||B(u,i,p.tB))continue;let g=v(e),S=v(h);if(g!==S?g:!1)o.push({jumpEdgeId:a.id,otherEdgeId:u.id,segIndex:d,t:p.tA,point:p.point});else o.push({jumpEdgeId:u.id,otherEdgeId:a.id,segIndex:i,t:p.tB,point:p.point})}}}return o}t(C,"findEdgeIntersections");function M(n){let o=Math.round(n*1000)/1000;return Number.isInteger(o)?`${o}`:`${o}`}t(M,"fmt");function A(n){return`${M(n.x)},${M(n.y)}`}t(A,"pointToString");function D(n){let o=n.b.x-n.a.x,r=n.b.y-n.a.y;if(Math.abs(o)>=Math.abs(r))return o>=0?1:0;return r>=0?1:0}t(D,"getArcSweepFlag");function _(n,o){if(n.length<2)return n.map((s)=>({...s}));let r=n.map((s)=>({...s})),a=o.arrowTypeStart&&Wt[o.arrowTypeStart];if(a){let s=n[0],u=n[1],f=Math.atan2(u.y-s.y,u.x-s.x);r[0].x=s.x+a*Math.cos(f),r[0].y=s.y+a*Math.sin(f)}let c=o.arrowTypeEnd&&Wt[o.arrowTypeEnd];if(c){let s=n.length,u=n[s-2],f=n[s-1],d=Math.atan2(f.y-u.y,f.x-u.x);r[s-1].x=f.x-c*Math.cos(d),r[s-1].y=f.y-c*Math.sin(d)}return r}t(_,"applyMarkerOffsets");function k(n,o,r,a,c){let s=n.point.x,u=n.point.y,f={x:s-o*n.r,y:u-r*n.r},d={x:s+o*n.r,y:u+r*n.r},e=[`L${A(f)}`];if(c==="arc")e.push(`A${M(n.r)},${M(n.r)} 0 0 ${a} ${A(d)}`);else e.push(`M${A(d)}`);return e}t(k,"emitJump");function L(n,o,r,a){let c=o.x-n.x,s=o.y-n.y,u=r.x-o.x,f=r.y-o.y,d=Math.hypot(c,s),e=Math.hypot(u,f);if(d<R||e<R)return null;let i=c/d,h=s/d,p=u/e,g=f/e,S=i*p+h*g,b=Math.max(-1,Math.min(1,S)),x=Math.acos(b);if(x<R||Math.abs(Math.PI-x)<R)return null;let y=Math.min(a/Math.sin(x/2),d/2,e/2);return{startX:o.x-i*y,startY:o.y-h*y,endX:o.x+p*y,endY:o.y+g*y,ctrlX:o.x,ctrlY:o.y,cutLen:y}}t(L,"computeRoundedCorner");function H(n,o,r){let a=n.points;if(a.length<2)return"";let c=_(a,n),s=n.curve==="rounded",u=P(c),f=new Map;for(let e of o){let i=u[e.segIndex];if(!i)continue;let h=Math.hypot(i.b.x-i.a.x,i.b.y-i.a.y),p=f.get(e.segIndex)??[];p.push({t:e.t,point:e.point,d:e.t*h,r:r.jumpRadius}),f.set(e.segIndex,p)}let d=[`M${A(c[0])}`];for(let e=0;e<u.length;e++){let i=u[e],h=Math.hypot(i.b.x-i.a.x,i.b.y-i.a.y),p=h===0?0:(i.b.x-i.a.x)/h,g=h===0?0:(i.b.y-i.a.y)/h,S=D(i),b=0;if(s&&e>0){let l=L(c[e-1],c[e],c[e+1]??c[e],N);if(l)b=l.cutLen}let x=h,y=null;if(s&&e<u.length-1){if(y=L(c[e],c[e+1],c[e+2]??c[e+1],N),y)x=h-y.cutLen}let I=r.jumpRadius*Y,m=[...f.get(e)??[]].sort((l,E)=>l.t-E.t).filter((l)=>{let E=Math.min(l.d-b,x-l.d)-X;return l.r=Math.min(l.r,E),l.r>=I});for(let l=0;l<m.length-1;l++){let E=m[l+1].d-m[l].d;if(m[l].r+m[l+1].r>E){let O=E/2;m[l].r=Math.min(m[l].r,O),m[l+1].r=Math.min(m[l+1].r,O)}}for(let l of m){if(l.r<I)continue;d.push(...k(l,p,g,S,r.jumpStyle))}if(s&&y)d.push(`L${M(y.startX)},${M(y.startY)}`),d.push(`Q${M(y.ctrlX)},${M(y.ctrlY)} ${M(y.endX)},${M(y.endY)}`);else d.push(`L${A(i.b)}`)}return d.join(" ")}t(H,"rewriteEdgePath");function J(n){return/^[\d\s+,.LMelm-]*$/.test(n)}t(J,"isStraightPath");function U(n){if(!n)return!0;return n==="linear"||n==="rounded"||n==="step"||n==="stepBefore"||n==="stepAfter"}t(U,"curveSupportsLineHops");function j(n){if(!n)return null;try{let o=typeof atob==="function"?atob(n):Buffer.from(n,"base64").toString(),r=JSON.parse(o);if(!Array.isArray(r))return null;let a=[];for(let c of r)if(c&&typeof c.x==="number"&&typeof c.y==="number")a.push({x:c.x,y:c.y});return a.length>=2?a:null}catch{return null}}t(j,"decodeDataPoints");function Pl(n,o,r){if(!r.enabled)return;let a=n.node();if(!a)return;let c=new Map;for(let e of o)c.set(e.id,e);let s=new Map;for(let e of a.querySelectorAll("path[data-id]")){let i=e.getAttribute("data-id");if(i!==null&&!s.has(i))s.set(i,e)}let u=[];for(let e of o){let i=s.get(e.id);if(!i)continue;let p=j(i.getAttribute("data-points"))??e.points;u.push({...e,points:p})}let f=C(u);if(f.length===0)return;let d=new Map;for(let e of f){let i=d.get(e.jumpEdgeId)??[];i.push(e),d.set(e.jumpEdgeId,i)}for(let e of u){let i=d.get(e.id);if(!i||i.length===0)continue;let p=c.get(e.id)?.curve;if(p!==void 0&&!U(p))continue;let g=s.get(e.id);if(!g)continue;if(p===void 0){let m=g.getAttribute("d")??"";if(!J(m))continue}let S=g.getAttribute("style")??"",b=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(S),x=b?Number.parseFloat(b[1]):null,y=b?Number.parseFloat(b[2]):null,I=H(e,i,r);if(g.setAttribute("d",I),x!==null&&y!==null&&typeof g.getTotalLength==="function"){let m=g.getTotalLength(),l=Math.max(0,m-x-y),E=`0 ${x} ${l} ${y}`,O=S.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${E};`).replace(/;\s*;+/g,";");g.setAttribute("style",O)}}}t(Pl,"applyLineJumpsToSvg");
2
- export{Pl};
1
+ import{t,Wt}from"./index-9xsf8162.js";var N=5,R=0.00001,X=2,Y=0.6,w=0.000001;function P(n){let o=[];for(let r=0;r<n.length-1;r++)o.push({a:n[r],b:n[r+1]});return o}t(P,"buildSegmentList");function T(n,o,r,a){let c=o.x-n.x,s=o.y-n.y,u=a.x-r.x,f=a.y-r.y,d=c*f-s*u;if(d===0)return null;let e=r.x-n.x,i=r.y-n.y,h=(e*f-i*u)/d,p=(e*s-i*c)/d;if(h<=w||h>=1-w||p<=w||p>=1-w)return null;return{point:{x:n.x+h*c,y:n.y+h*s},tA:h,tB:p}}t(T,"segmentIntersection");function v(n){return Math.abs(n.b.x-n.a.x)>=Math.abs(n.b.y-n.a.y)}t(v,"isHorizontalSeg");function B(n,o,r){if(n.curve!=="rounded")return!1;let a=n.points,c=a[o],s=a[o+1];if(!c||!s)return!1;let u=Math.hypot(s.x-c.x,s.y-c.y),f=r*u,d=o>0?L(a[o-1],c,s,N):null;if(d&&f<d.cutLen)return!0;let e=o+2<a.length?L(c,s,a[o+2],N):null;return e!==null&&u-f<e.cutLen}t(B,"crossingSitsInRoundedCorner");function C(n){let o=[];for(let r=0;r<n.length;r++){let a=n[r],c=P(a.points);for(let s=r+1;s<n.length;s++){let u=n[s],f=P(u.points);for(let[d,e]of c.entries())for(let[i,h]of f.entries()){let p=T(e.a,e.b,h.a,h.b);if(!p)continue;if(B(a,d,p.tA)||B(u,i,p.tB))continue;let g=v(e),S=v(h);if(g!==S?g:!1)o.push({jumpEdgeId:a.id,otherEdgeId:u.id,segIndex:d,t:p.tA,point:p.point});else o.push({jumpEdgeId:u.id,otherEdgeId:a.id,segIndex:i,t:p.tB,point:p.point})}}}return o}t(C,"findEdgeIntersections");function M(n){let o=Math.round(n*1000)/1000;return Number.isInteger(o)?`${o}`:`${o}`}t(M,"fmt");function A(n){return`${M(n.x)},${M(n.y)}`}t(A,"pointToString");function D(n){let o=n.b.x-n.a.x,r=n.b.y-n.a.y;if(Math.abs(o)>=Math.abs(r))return o>=0?1:0;return r>=0?1:0}t(D,"getArcSweepFlag");function _(n,o){if(n.length<2)return n.map((s)=>({...s}));let r=n.map((s)=>({...s})),a=o.arrowTypeStart&&Wt[o.arrowTypeStart];if(a){let s=n[0],u=n[1],f=Math.atan2(u.y-s.y,u.x-s.x);r[0].x=s.x+a*Math.cos(f),r[0].y=s.y+a*Math.sin(f)}let c=o.arrowTypeEnd&&Wt[o.arrowTypeEnd];if(c){let s=n.length,u=n[s-2],f=n[s-1],d=Math.atan2(f.y-u.y,f.x-u.x);r[s-1].x=f.x-c*Math.cos(d),r[s-1].y=f.y-c*Math.sin(d)}return r}t(_,"applyMarkerOffsets");function k(n,o,r,a,c){let s=n.point.x,u=n.point.y,f={x:s-o*n.r,y:u-r*n.r},d={x:s+o*n.r,y:u+r*n.r},e=[`L${A(f)}`];if(c==="arc")e.push(`A${M(n.r)},${M(n.r)} 0 0 ${a} ${A(d)}`);else e.push(`M${A(d)}`);return e}t(k,"emitJump");function L(n,o,r,a){let c=o.x-n.x,s=o.y-n.y,u=r.x-o.x,f=r.y-o.y,d=Math.hypot(c,s),e=Math.hypot(u,f);if(d<R||e<R)return null;let i=c/d,h=s/d,p=u/e,g=f/e,S=i*p+h*g,b=Math.max(-1,Math.min(1,S)),x=Math.acos(b);if(x<R||Math.abs(Math.PI-x)<R)return null;let y=Math.min(a/Math.sin(x/2),d/2,e/2);return{startX:o.x-i*y,startY:o.y-h*y,endX:o.x+p*y,endY:o.y+g*y,ctrlX:o.x,ctrlY:o.y,cutLen:y}}t(L,"computeRoundedCorner");function H(n,o,r){let a=n.points;if(a.length<2)return"";let c=_(a,n),s=n.curve==="rounded",u=P(c),f=new Map;for(let e of o){let i=u[e.segIndex];if(!i)continue;let h=Math.hypot(i.b.x-i.a.x,i.b.y-i.a.y),p=f.get(e.segIndex)??[];p.push({t:e.t,point:e.point,d:e.t*h,r:r.jumpRadius}),f.set(e.segIndex,p)}let d=[`M${A(c[0])}`];for(let e=0;e<u.length;e++){let i=u[e],h=Math.hypot(i.b.x-i.a.x,i.b.y-i.a.y),p=h===0?0:(i.b.x-i.a.x)/h,g=h===0?0:(i.b.y-i.a.y)/h,S=D(i),b=0;if(s&&e>0){let l=L(c[e-1],c[e],c[e+1]??c[e],N);if(l)b=l.cutLen}let x=h,y=null;if(s&&e<u.length-1){if(y=L(c[e],c[e+1],c[e+2]??c[e+1],N),y)x=h-y.cutLen}let I=r.jumpRadius*Y,m=[...f.get(e)??[]].sort((l,E)=>l.t-E.t).filter((l)=>{let E=Math.min(l.d-b,x-l.d)-X;return l.r=Math.min(l.r,E),l.r>=I});for(let l=0;l<m.length-1;l++){let E=m[l+1].d-m[l].d;if(m[l].r+m[l+1].r>E){let O=E/2;m[l].r=Math.min(m[l].r,O),m[l+1].r=Math.min(m[l+1].r,O)}}for(let l of m){if(l.r<I)continue;d.push(...k(l,p,g,S,r.jumpStyle))}if(s&&y)d.push(`L${M(y.startX)},${M(y.startY)}`),d.push(`Q${M(y.ctrlX)},${M(y.ctrlY)} ${M(y.endX)},${M(y.endY)}`);else d.push(`L${A(i.b)}`)}return d.join(" ")}t(H,"rewriteEdgePath");function J(n){return/^[\d\s+,.LMelm-]*$/.test(n)}t(J,"isStraightPath");function U(n){if(!n)return!0;return n==="linear"||n==="rounded"||n==="step"||n==="stepBefore"||n==="stepAfter"}t(U,"curveSupportsLineHops");function j(n){if(!n)return null;try{let o=typeof atob==="function"?atob(n):Buffer.from(n,"base64").toString(),r=JSON.parse(o);if(!Array.isArray(r))return null;let a=[];for(let c of r)if(c&&typeof c.x==="number"&&typeof c.y==="number")a.push({x:c.x,y:c.y});return a.length>=2?a:null}catch{return null}}t(j,"decodeDataPoints");function Ol(n,o,r){if(!r.enabled)return;let a=n.node();if(!a)return;let c=new Map;for(let e of o)c.set(e.id,e);let s=new Map;for(let e of a.querySelectorAll("path[data-id]")){let i=e.getAttribute("data-id");if(i!==null&&!s.has(i))s.set(i,e)}let u=[];for(let e of o){let i=s.get(e.id);if(!i)continue;let p=j(i.getAttribute("data-points"))??e.points;u.push({...e,points:p})}let f=C(u);if(f.length===0)return;let d=new Map;for(let e of f){let i=d.get(e.jumpEdgeId)??[];i.push(e),d.set(e.jumpEdgeId,i)}for(let e of u){let i=d.get(e.id);if(!i||i.length===0)continue;let p=c.get(e.id)?.curve;if(p!==void 0&&!U(p))continue;let g=s.get(e.id);if(!g)continue;if(p===void 0){let m=g.getAttribute("d")??"";if(!J(m))continue}let S=g.getAttribute("style")??"",b=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(S),x=b?Number.parseFloat(b[1]):null,y=b?Number.parseFloat(b[2]):null,I=H(e,i,r);if(g.setAttribute("d",I),x!==null&&y!==null&&typeof g.getTotalLength==="function"){let m=g.getTotalLength(),l=Math.max(0,m-x-y),E=`0 ${x} ${l} ${y}`,O=S.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${E};`).replace(/;\s*;+/g,";");g.setAttribute("style",O)}}}t(Ol,"applyLineJumpsToSvg");
2
+ export{Ol};