@vunk/plus 1.10.0 → 1.10.2

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 (312) hide show
  1. package/components/bubble-list/index.css +0 -22
  2. package/components/bubble-list/index.mjs +413 -9
  3. package/components/bubble-list/src/core/index.vue.d.ts +57 -0
  4. package/components/bubble-list/src/index.vue.d.ts +57 -0
  5. package/components/chat-independent/src/index.vue.d.ts +57 -0
  6. package/components/drawer/index.mjs +1 -1
  7. package/components/index3.mjs +20 -79450
  8. package/components/scrollbar/index.mjs +89 -15
  9. package/components/scrollbar/src/bar.d.ts +4 -0
  10. package/components/scrollbar/src/bar.vue.d.ts +26 -0
  11. package/components/scrollbar/src/index.vue.d.ts +57 -0
  12. package/components/scrollbar/src/thumb.d.ts +4 -0
  13. package/components/scrollbar/src/thumb.vue.d.ts +13 -0
  14. package/components/scrollbar/src/types.d.ts +5 -1
  15. package/components/tables-v1/src/ctx.d.ts +2 -2
  16. package/components/tables-v1/src/index.vue.d.ts +6 -6
  17. package/components/tables-v1-checkbox/src/ctx.d.ts +2 -2
  18. package/components/tables-v1-checkbox/src/index.vue.d.ts +12 -12
  19. package/components/text/src/ctx.d.ts +1 -1
  20. package/components/text/src/index.vue.d.ts +2 -2
  21. package/components/xgplayer/index.mjs +2 -16357
  22. package/index.css +0 -22
  23. package/package.json +1 -1
  24. package/components/_baseUniq-BXtq6_NW.mjs +0 -239
  25. package/components/abap-B7h4dtBh.mjs +0 -6
  26. package/components/actionscript-3-Bmm7RA3Y.mjs +0 -6
  27. package/components/ada-BZS802Se.mjs +0 -6
  28. package/components/andromeeda-CrngpmZk.mjs +0 -3
  29. package/components/apache-D4roVlsU.mjs +0 -6
  30. package/components/apex-D6mfw0H5.mjs +0 -6
  31. package/components/apl-DDK-VObo.mjs +0 -18
  32. package/components/applescript-C43Knf0G.mjs +0 -6
  33. package/components/ara-DRBH84ND.mjs +0 -6
  34. package/components/arc-Js_tyW10.mjs +0 -131
  35. package/components/architecture-O4VJ6CD3-ZoZ2IAk2.mjs +0 -15
  36. package/components/architectureDiagram-SUXI7LT5-kyYGGrHN.mjs +0 -8678
  37. package/components/asm-3tg4MVib.mjs +0 -6
  38. package/components/astro-v4FYbRud.mjs +0 -19
  39. package/components/aurora-x-wJ4-eM2h.mjs +0 -3
  40. package/components/awk-ChreaG-G.mjs +0 -6
  41. package/components/ayu-dark-BEKp3oqs.mjs +0 -3
  42. package/components/ballerina-B0yt0TYU.mjs +0 -6
  43. package/components/batch-Ce_EX3Sx.mjs +0 -14
  44. package/components/beancount-BRIsdQEB.mjs +0 -6
  45. package/components/berry-Brv4WWdL.mjs +0 -14
  46. package/components/bibtex-BLeFwAes.mjs +0 -6
  47. package/components/bicep-BVrgfErX.mjs +0 -6
  48. package/components/blade-By3Sw_Ex.mjs +0 -22
  49. package/components/blockDiagram-6J76NXCF-IAr4zDV3.mjs +0 -3610
  50. package/components/c-C4VtT7JA.mjs +0 -6
  51. package/components/c4Diagram-6F6E4RAY-Dv27rXcJ.mjs +0 -2492
  52. package/components/catppuccin-frappe-zLMNRRUx.mjs +0 -3
  53. package/components/catppuccin-latte-CdF5jC3c.mjs +0 -3
  54. package/components/catppuccin-macchiato-DyjXeyRt.mjs +0 -3
  55. package/components/catppuccin-mocha-66IdYxR8.mjs +0 -3
  56. package/components/cdc-30ktANo3.mjs +0 -14
  57. package/components/channel-BBZy6zOT.mjs +0 -7
  58. package/components/chunk-353BL4L5-Dn_Y_Yna.mjs +0 -17
  59. package/components/chunk-67H74DCK-Br5U8bfD.mjs +0 -102
  60. package/components/chunk-AACKK3MU-DH_MKxca.mjs +0 -17
  61. package/components/chunk-BFAMUDN2-DHLCoYMN.mjs +0 -13
  62. package/components/chunk-E2GYISFI-DQPHyyga.mjs +0 -19
  63. package/components/chunk-OW32GOEJ-CQOSE6Bn.mjs +0 -1924
  64. package/components/chunk-SKB7J2MH-BlwHRDiW.mjs +0 -25
  65. package/components/chunk-SZ463SBG-DEp8buKJ.mjs +0 -1823
  66. package/components/clarity-6uBl6Vpb.mjs +0 -6
  67. package/components/classDiagram-M3E45YP4-D0ySDe-v.mjs +0 -32
  68. package/components/classDiagram-v2-YAWTLIQI-D0ySDe-v.mjs +0 -32
  69. package/components/clojure-COBRmwo8.mjs +0 -14
  70. package/components/clone-CEJtuQzg.mjs +0 -8
  71. package/components/cmake-CDfQILeU.mjs +0 -6
  72. package/components/cobol-BOOIiISO.mjs +0 -13
  73. package/components/coffee-DO_RGoZp.mjs +0 -9
  74. package/components/cpp-DAK8ktHO.mjs +0 -25
  75. package/components/crystal-CBGbbyVp.mjs +0 -19
  76. package/components/cs-h3ksD6-P.mjs +0 -14
  77. package/components/css-BtVcDqlU.mjs +0 -6
  78. package/components/cue-BFSVLV6N.mjs +0 -6
  79. package/components/cypher-Dl2CXoXF.mjs +0 -14
  80. package/components/cytoscape.esm-BojS1z60.mjs +0 -30216
  81. package/components/d-9qSZPw74.mjs +0 -6
  82. package/components/dagre-JOIXM2OF-5zx0JY2T.mjs +0 -707
  83. package/components/dark-plus-DmZ1Dzd4.mjs +0 -3
  84. package/components/dart-CCSsOg9l.mjs +0 -6
  85. package/components/dax-CvsmLV-B.mjs +0 -6
  86. package/components/defaultLocale-DVr69WTU.mjs +0 -202
  87. package/components/diagram-5UYTHUR4-C19nyAKc.mjs +0 -215
  88. package/components/diagram-VMROVX33-DkGwo-hj.mjs +0 -861
  89. package/components/diagram-ZTM2IBQH-CBgHCu9L.mjs +0 -317
  90. package/components/diff-BEdzuHlE.mjs +0 -6
  91. package/components/dockerfile-B3DP334t.mjs +0 -14
  92. package/components/dracula-B8-AVrwI.mjs +0 -3
  93. package/components/dracula-soft-BHeefow7.mjs +0 -3
  94. package/components/dream-maker-CNLQpoF-.mjs +0 -6
  95. package/components/elixir-0rTCSSfp.mjs +0 -11
  96. package/components/elm-BhwiZPvf.mjs +0 -10
  97. package/components/erDiagram-3M52JZNH-cttdAJXW.mjs +0 -1169
  98. package/components/erb-Lra8TlYM.mjs +0 -27
  99. package/components/erlang-D2NNgvtR.mjs +0 -17
  100. package/components/everforest-dark-Cg1xdODP.mjs +0 -3
  101. package/components/everforest-light-BmTD3bxe.mjs +0 -3
  102. package/components/fish-BU5HSdZy.mjs +0 -6
  103. package/components/flowDiagram-KYDEHFYC-9HpsqDdB.mjs +0 -2345
  104. package/components/fs-CdBSddpF.mjs +0 -17
  105. package/components/ganttDiagram-EK5VF46D-8QB3ofs6.mjs +0 -3497
  106. package/components/gdresource-CAbkn6H_.mjs +0 -11
  107. package/components/gdscript-Be_cubqt.mjs +0 -6
  108. package/components/gdshader-BEzE4j_3.mjs +0 -6
  109. package/components/gherkin-xCNF9gh8.mjs +0 -6
  110. package/components/git-commit-PP9xCApN.mjs +0 -9
  111. package/components/git-rebase-DqdGofLo.mjs +0 -9
  112. package/components/gitGraph-ZV4HHKMB-BSmtVGRu.mjs +0 -15
  113. package/components/gitGraphDiagram-GW3U2K7C-DNzc0Vx_.mjs +0 -1227
  114. package/components/github-dark-O22yVQaY.mjs +0 -3
  115. package/components/github-dark-default-DB2Hkvqn.mjs +0 -3
  116. package/components/github-dark-dimmed-CMZ_OfqC.mjs +0 -3
  117. package/components/github-dark-high-contrast-DmxWVmCU.mjs +0 -3
  118. package/components/github-light-BTbR9xVK.mjs +0 -3
  119. package/components/github-light-default-DWEonwFe.mjs +0 -3
  120. package/components/github-light-high-contrast-WJ_cPDts.mjs +0 -3
  121. package/components/glimmer-js-BkPYTyD4.mjs +0 -23
  122. package/components/glsl-CGsiYPcu.mjs +0 -9
  123. package/components/gnuplot-tV8vezdE.mjs +0 -6
  124. package/components/go-CBmVHZBz.mjs +0 -6
  125. package/components/graph-3zJxsO-i.mjs +0 -425
  126. package/components/graphql-D4pgneW3.mjs +0 -15
  127. package/components/groovy-Bn4MhXgW.mjs +0 -6
  128. package/components/gruvbox-dark-hard-C89wZ4s3.mjs +0 -3
  129. package/components/gruvbox-dark-medium-swz85q_b.mjs +0 -3
  130. package/components/gruvbox-dark-soft-BYHBHQJW.mjs +0 -3
  131. package/components/gruvbox-light-hard-DEF_ZxYZ.mjs +0 -3
  132. package/components/gruvbox-light-medium-ziUMnHJx.mjs +0 -3
  133. package/components/gruvbox-light-soft-Cuwp0tsB.mjs +0 -3
  134. package/components/gts-d3WsqAZM.mjs +0 -23
  135. package/components/hack-CwaBuF5l.mjs +0 -13
  136. package/components/haml-gLijj4rW.mjs +0 -11
  137. package/components/hbs-CFi5SpI3.mjs +0 -23
  138. package/components/hcl-axoq0Ycu.mjs +0 -6
  139. package/components/hjson-I7LcauIB.mjs +0 -6
  140. package/components/hlsl-TRzjajlb.mjs +0 -6
  141. package/components/houston-CF_ws8Cq.mjs +0 -3
  142. package/components/hs-DXSGqUFF.mjs +0 -14
  143. package/components/html-CLq-n30c.mjs +0 -11
  144. package/components/html-derivative-C8POX8SL.mjs +0 -9
  145. package/components/http-BYUKZ6kX.mjs +0 -20
  146. package/components/imba-C4923lSV.mjs +0 -6
  147. package/components/index4.mjs +0 -78
  148. package/components/info-63CPKGFF-C8sYWczU.mjs +0 -15
  149. package/components/infoDiagram-LHK5PUON-C-vFFPTf.mjs +0 -44
  150. package/components/init-ZxktEp_H.mjs +0 -15
  151. package/components/java-BfXh-0uJ.mjs +0 -6
  152. package/components/jinja-html-BmW4v_vu.mjs +0 -11
  153. package/components/jison-C9kAT_Oj.mjs +0 -9
  154. package/components/journeyDiagram-EWQZEKCU-BJrw4-AG.mjs +0 -1264
  155. package/components/js-CN_xSsjU.mjs +0 -14
  156. package/components/json-TjWBGEk1.mjs +0 -6
  157. package/components/json5-DCGCKrmX.mjs +0 -6
  158. package/components/jsonc-DLVLp8id.mjs +0 -6
  159. package/components/jsonl-B-R_pDGg.mjs +0 -6
  160. package/components/jsonnet-Cs8BnnC6.mjs +0 -6
  161. package/components/jssm-D_YBQ_cM.mjs +0 -14
  162. package/components/jsx-BPmvoin2.mjs +0 -6
  163. package/components/julia-C-JjBobP.mjs +0 -19
  164. package/components/kanagawa-dragon-DU8n2NNT.mjs +0 -3
  165. package/components/kanagawa-lotus-Byd0CDet.mjs +0 -3
  166. package/components/kanagawa-wave-DExoagcR.mjs +0 -3
  167. package/components/kanban-definition-ZSS6B67P-BptAnqU-.mjs +0 -1059
  168. package/components/kotlin-BM2ZNTMh.mjs +0 -6
  169. package/components/kusto-D9MF7CZf.mjs +0 -14
  170. package/components/laserwave-DF03wMlf.mjs +0 -3
  171. package/components/latex-BsqkLZB_.mjs +0 -10
  172. package/components/layout-sGZIJplX.mjs +0 -2043
  173. package/components/less-BAzLMJNR.mjs +0 -6
  174. package/components/light-plus-DS08Xg5J.mjs +0 -3
  175. package/components/linear-DqgVh5FN.mjs +0 -336
  176. package/components/liquid-f2VHt0dg.mjs +0 -15
  177. package/components/lisp-DAq1kaby.mjs +0 -6
  178. package/components/logo-D9l7oEJ8.mjs +0 -6
  179. package/components/lua-CH3ttzl_.mjs +0 -9
  180. package/components/makefile-D2qLe7q0.mjs +0 -14
  181. package/components/marko-DwRyI_--.mjs +0 -15
  182. package/components/material-theme-B8B2U48Q.mjs +0 -3
  183. package/components/material-theme-darker-BV0iY_T3.mjs +0 -3
  184. package/components/material-theme-lighter-DrzybSTF.mjs +0 -3
  185. package/components/material-theme-ocean-BRPLVReX.mjs +0 -3
  186. package/components/material-theme-palenight-DSJwsR_D.mjs +0 -3
  187. package/components/matlab-7XHduepk.mjs +0 -6
  188. package/components/md-BIvDPr-W.mjs +0 -14
  189. package/components/mdc-Rx6hWSHn.mjs +0 -16
  190. package/components/mdx-D5wExp-O.mjs +0 -6
  191. package/components/mermaid-CUjtoYEe.mjs +0 -6
  192. package/components/mermaid-parser.core-CH9ryA1K.mjs +0 -16987
  193. package/components/mermaid.core-CAqkCmS1.mjs +0 -20977
  194. package/components/min-BngCxx8g.mjs +0 -109
  195. package/components/min-dark-BNaN9fWk.mjs +0 -3
  196. package/components/min-light-CMrjentn.mjs +0 -3
  197. package/components/mindmap-definition-6CBA2TL7-Cp_EeEsh.mjs +0 -5856
  198. package/components/mojo-CrbF881p.mjs +0 -6
  199. package/components/monokai-DelygWXa.mjs +0 -3
  200. package/components/narrat-DOwkIbBe.mjs +0 -14
  201. package/components/nf-DHfvJ2gH.mjs +0 -14
  202. package/components/nginx-B_jWsywZ.mjs +0 -10
  203. package/components/night-owl-DSS199ra.mjs +0 -3
  204. package/components/nim-yzbnZKJd.mjs +0 -22
  205. package/components/nix--3K2gyjg.mjs +0 -6
  206. package/components/nord-CvDbBq5M.mjs +0 -3
  207. package/components/objective-c-DkOBZg1J.mjs +0 -14
  208. package/components/objective-cpp-DEoN9Fe5.mjs +0 -6
  209. package/components/ocaml-B1kfGk9Y.mjs +0 -6
  210. package/components/one-dark-pro-CsMf0BoJ.mjs +0 -3
  211. package/components/one-light-BwwAsfsj.mjs +0 -3
  212. package/components/ordinal-DSZU4PqD.mjs +0 -76
  213. package/components/packet-HUATNLJX-bfFWFja0.mjs +0 -15
  214. package/components/pascal-CU8Kjkr_.mjs +0 -6
  215. package/components/perl-FH6su6vZ.mjs +0 -18
  216. package/components/php-Dnl1TfYH.mjs +0 -20
  217. package/components/pie-WTHONI2E-QPrWs3SR.mjs +0 -15
  218. package/components/pieDiagram-NIOCPIFQ-C46Y_4C6.mjs +0 -250
  219. package/components/plastic-BjwMpBc0.mjs +0 -3
  220. package/components/plsql-B3Na24V4.mjs +0 -6
  221. package/components/poimandres-ChWyhPrn.mjs +0 -3
  222. package/components/postcss-kj1IbjVd.mjs +0 -6
  223. package/components/powerquery-B-e1fO-k.mjs +0 -6
  224. package/components/prisma-bmxcSDxq.mjs +0 -6
  225. package/components/prolog-BT9GCzqD.mjs +0 -6
  226. package/components/properties-D6yKO1eW.mjs +0 -14
  227. package/components/proto-BIXM0k1a.mjs +0 -6
  228. package/components/ps1-aFyNx8UH.mjs +0 -18
  229. package/components/pug-BrOx0bSt.mjs +0 -21
  230. package/components/puppet-N15G4Usj.mjs +0 -6
  231. package/components/purescript-DrwsEYNH.mjs +0 -6
  232. package/components/python-D2s92fRP.mjs +0 -14
  233. package/components/ql-DTm-NCRo.mjs +0 -14
  234. package/components/quadrantDiagram-2OG54O6I-Dgf6d6F_.mjs +0 -1349
  235. package/components/r-oprfD2-9.mjs +0 -6
  236. package/components/radar-NJJJXTRR-BnUCJhQL.mjs +0 -15
  237. package/components/raku-xArQd_rF.mjs +0 -14
  238. package/components/razor-BoXCAbWQ.mjs +0 -13
  239. package/components/red-DByOl5N0.mjs +0 -3
  240. package/components/reg-CULnG2WX.mjs +0 -6
  241. package/components/rel-CHRwzjd4.mjs +0 -6
  242. package/components/requirementDiagram-QOLK2EJ7-CSF6N7HA.mjs +0 -1173
  243. package/components/riscv-BNQ9cVpw.mjs +0 -6
  244. package/components/rose-pine-LL9gXmP2.mjs +0 -3
  245. package/components/rose-pine-dawn-CH9zdisO.mjs +0 -3
  246. package/components/rose-pine-moon-B1oKSfEJ.mjs +0 -3
  247. package/components/rst-bEtD1v7N.mjs +0 -36
  248. package/components/ruby-BmfBy6EV.mjs +0 -44
  249. package/components/rust-Bf_fdNdL.mjs +0 -14
  250. package/components/sankeyDiagram-4UZDY2LN-BAHB7dMS.mjs +0 -1201
  251. package/components/sas-BLBgC3TA.mjs +0 -9
  252. package/components/sass-BheygBdF.mjs +0 -6
  253. package/components/scala-B-_7vFVn.mjs +0 -6
  254. package/components/scheme-BSHdPinv.mjs +0 -6
  255. package/components/scss-Dq-LbI_c.mjs +0 -9
  256. package/components/sequenceDiagram-SKLFT4DO-10gLJ50N.mjs +0 -3424
  257. package/components/shaderlab-BOQRTiQi.mjs +0 -17
  258. package/components/shellsession-Cu3c0QAc.mjs +0 -17
  259. package/components/slack-dark-BEe10hxO.mjs +0 -3
  260. package/components/slack-ochin-BKmu9pBc.mjs +0 -3
  261. package/components/smalltalk-qxcGy4fT.mjs +0 -6
  262. package/components/snazzy-light-Dcvd-ZyI.mjs +0 -3
  263. package/components/solarized-dark-BBl5y5sR.mjs +0 -3
  264. package/components/solarized-light-DW9b_AY8.mjs +0 -3
  265. package/components/solidity-CewKZgp-.mjs +0 -6
  266. package/components/sparql-DswowMAp.mjs +0 -9
  267. package/components/splunk-gK6Iw_P9.mjs +0 -14
  268. package/components/sql-DzUuSofg.mjs +0 -6
  269. package/components/ssh-config-Bk_I5wDR.mjs +0 -6
  270. package/components/stata-Dl7wDdBE.mjs +0 -9
  271. package/components/stateDiagram-MI5ZYTHO-D6p6nCaj.mjs +0 -461
  272. package/components/stateDiagram-v2-5AN5P6BG-DaN5hC-t.mjs +0 -31
  273. package/components/stylus-qRNkxrFU.mjs +0 -14
  274. package/components/svelte-B9qv3vkS.mjs +0 -15
  275. package/components/swift-BRQRsam8.mjs +0 -6
  276. package/components/synthwave-84-CoUef9sh.mjs +0 -3
  277. package/components/system-verilog-BcESSvRn.mjs +0 -6
  278. package/components/tasl-DfOr2qHi.mjs +0 -6
  279. package/components/tcl-CTsc4-t7.mjs +0 -6
  280. package/components/tex-CumJx1zu.mjs +0 -9
  281. package/components/timeline-definition-MYPXXCX6-gLqnWxDu.mjs +0 -1236
  282. package/components/tokyo-night-DjtLpAEY.mjs +0 -3
  283. package/components/toml-vHPzWDj6.mjs +0 -6
  284. package/components/treemap-75Q7IDZK-B2atdfMH.mjs +0 -15
  285. package/components/tsx-CmGGo4Hm.mjs +0 -6
  286. package/components/turtle-BnC7StHY.mjs +0 -6
  287. package/components/twig-0XKNpXN1.mjs +0 -35
  288. package/components/typescript-CgxwwAuC.mjs +0 -14
  289. package/components/v-Bmdjo9cy.mjs +0 -6
  290. package/components/vb-DuF6ZenW.mjs +0 -14
  291. package/components/verilog-CCb_iTfF.mjs +0 -6
  292. package/components/vesper-4Q1cEwPL.mjs +0 -3
  293. package/components/vhdl-DMqk4T2s.mjs +0 -6
  294. package/components/vimscript-aKp9YbYm.mjs +0 -18
  295. package/components/vitesse-black-BqNLki8b.mjs +0 -3
  296. package/components/vitesse-dark-jJ32WhwH.mjs +0 -3
  297. package/components/vitesse-light-476zM4e6.mjs +0 -3
  298. package/components/vue-DVNNTw2l.mjs +0 -40
  299. package/components/vue-html-Cr5wciIP.mjs +0 -16
  300. package/components/vyper-DYedWgAE.mjs +0 -14
  301. package/components/wasm-BBh6f151.mjs +0 -6
  302. package/components/wasm-DDgzZJey.mjs +0 -7
  303. package/components/wenyan-BdqozpMZ.mjs +0 -6
  304. package/components/wgsl-Vo-hHVWH.mjs +0 -6
  305. package/components/wolfram-CRmjUoI4.mjs +0 -6
  306. package/components/xml-BMzZeaqs.mjs +0 -9
  307. package/components/xsl-CAhvzxWv.mjs +0 -10
  308. package/components/xychartDiagram-H2YORKM3-Whqa4ezL.mjs +0 -1895
  309. package/components/yml-BhSrWWMS.mjs +0 -14
  310. package/components/zenscript-DFINJL6j.mjs +0 -6
  311. package/components/zig-CS4FMAZp.mjs +0 -6
  312. package/components/zsh-hcK4TBd7.mjs +0 -26
@@ -1,1227 +0,0 @@
1
- import { p as populateCommonDb } from './chunk-353BL4L5-Dn_Y_Yna.mjs';
2
- import { I as ImperativeState } from './chunk-AACKK3MU-DH_MKxca.mjs';
3
- import { H as defaultConfig_default, _ as __name, c as getConfig2, F as cleanAndMerge, G as getConfig, I as random, l as log, b as setAccTitle, a as getAccTitle, g as getAccDescription, s as setAccDescription, q as setDiagramTitle, t as getDiagramTitle, k as common_default, z as clear$2, d as select, u as utils_default, E as setupGraphViewbox2 } from './mermaid.core-CAqkCmS1.mjs';
4
- import { p as parse } from './mermaid-parser.core-CH9ryA1K.mjs';
5
- import './index3.mjs';
6
- import 'vue';
7
- import '@vunk/plus/components/bubble-templates';
8
- import 'element-plus';
9
- import './index4.mjs';
10
- import '@vueuse/core';
11
- import '@vunk/plus/components/scrollbar';
12
- import './_plugin-vue_export-helper.mjs';
13
- import '@vunk/shared/function';
14
- import '@vunk/plus/components/agent-chat-provider';
15
- import './_baseUniq-BXtq6_NW.mjs';
16
- import './min-BngCxx8g.mjs';
17
- import './clone-CEJtuQzg.mjs';
18
-
19
- var commitType = {
20
- NORMAL: 0,
21
- REVERSE: 1,
22
- HIGHLIGHT: 2,
23
- MERGE: 3,
24
- CHERRY_PICK: 4
25
- };
26
- var DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph;
27
- var getConfig3 = /* @__PURE__ */ __name(() => {
28
- const config = cleanAndMerge({
29
- ...DEFAULT_GITGRAPH_CONFIG,
30
- ...getConfig().gitGraph
31
- });
32
- return config;
33
- }, "getConfig");
34
- var state = new ImperativeState(() => {
35
- const config = getConfig3();
36
- const mainBranchName = config.mainBranchName;
37
- const mainBranchOrder = config.mainBranchOrder;
38
- return {
39
- mainBranchName,
40
- commits: /* @__PURE__ */ new Map(),
41
- head: null,
42
- branchConfig: /* @__PURE__ */ new Map([[mainBranchName, { name: mainBranchName, order: mainBranchOrder }]]),
43
- branches: /* @__PURE__ */ new Map([[mainBranchName, null]]),
44
- currBranch: mainBranchName,
45
- direction: "LR",
46
- seq: 0,
47
- options: {}
48
- };
49
- });
50
- function getID() {
51
- return random({ length: 7 });
52
- }
53
- __name(getID, "getID");
54
- function uniqBy(list, fn) {
55
- const recordMap = /* @__PURE__ */ Object.create(null);
56
- return list.reduce((out, item) => {
57
- const key = fn(item);
58
- if (!recordMap[key]) {
59
- recordMap[key] = true;
60
- out.push(item);
61
- }
62
- return out;
63
- }, []);
64
- }
65
- __name(uniqBy, "uniqBy");
66
- var setDirection = /* @__PURE__ */ __name(function(dir2) {
67
- state.records.direction = dir2;
68
- }, "setDirection");
69
- var setOptions = /* @__PURE__ */ __name(function(rawOptString) {
70
- log.debug("options str", rawOptString);
71
- rawOptString = rawOptString == null ? void 0 : rawOptString.trim();
72
- rawOptString = rawOptString || "{}";
73
- try {
74
- state.records.options = JSON.parse(rawOptString);
75
- } catch (e) {
76
- log.error("error while parsing gitGraph options", e.message);
77
- }
78
- }, "setOptions");
79
- var getOptions = /* @__PURE__ */ __name(function() {
80
- return state.records.options;
81
- }, "getOptions");
82
- var commit = /* @__PURE__ */ __name(function(commitDB) {
83
- let msg = commitDB.msg;
84
- let id = commitDB.id;
85
- const type = commitDB.type;
86
- let tags = commitDB.tags;
87
- log.info("commit", msg, id, type, tags);
88
- log.debug("Entering commit:", msg, id, type, tags);
89
- const config = getConfig3();
90
- id = common_default.sanitizeText(id, config);
91
- msg = common_default.sanitizeText(msg, config);
92
- tags = tags == null ? void 0 : tags.map((tag) => common_default.sanitizeText(tag, config));
93
- const newCommit = {
94
- id: id ? id : state.records.seq + "-" + getID(),
95
- message: msg,
96
- seq: state.records.seq++,
97
- type: type ?? commitType.NORMAL,
98
- tags: tags ?? [],
99
- parents: state.records.head == null ? [] : [state.records.head.id],
100
- branch: state.records.currBranch
101
- };
102
- state.records.head = newCommit;
103
- log.info("main branch", config.mainBranchName);
104
- if (state.records.commits.has(newCommit.id)) {
105
- log.warn(`Commit ID ${newCommit.id} already exists`);
106
- }
107
- state.records.commits.set(newCommit.id, newCommit);
108
- state.records.branches.set(state.records.currBranch, newCommit.id);
109
- log.debug("in pushCommit " + newCommit.id);
110
- }, "commit");
111
- var branch = /* @__PURE__ */ __name(function(branchDB) {
112
- let name = branchDB.name;
113
- const order = branchDB.order;
114
- name = common_default.sanitizeText(name, getConfig3());
115
- if (state.records.branches.has(name)) {
116
- throw new Error(
117
- `Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${name}")`
118
- );
119
- }
120
- state.records.branches.set(name, state.records.head != null ? state.records.head.id : null);
121
- state.records.branchConfig.set(name, { name, order });
122
- checkout(name);
123
- log.debug("in createBranch");
124
- }, "branch");
125
- var merge = /* @__PURE__ */ __name((mergeDB) => {
126
- let otherBranch = mergeDB.branch;
127
- let customId = mergeDB.id;
128
- const overrideType = mergeDB.type;
129
- const customTags = mergeDB.tags;
130
- const config = getConfig3();
131
- otherBranch = common_default.sanitizeText(otherBranch, config);
132
- if (customId) {
133
- customId = common_default.sanitizeText(customId, config);
134
- }
135
- const currentBranchCheck = state.records.branches.get(state.records.currBranch);
136
- const otherBranchCheck = state.records.branches.get(otherBranch);
137
- const currentCommit = currentBranchCheck ? state.records.commits.get(currentBranchCheck) : void 0;
138
- const otherCommit = otherBranchCheck ? state.records.commits.get(otherBranchCheck) : void 0;
139
- if (currentCommit && otherCommit && currentCommit.branch === otherBranch) {
140
- throw new Error(`Cannot merge branch '${otherBranch}' into itself.`);
141
- }
142
- if (state.records.currBranch === otherBranch) {
143
- const error = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
144
- error.hash = {
145
- text: `merge ${otherBranch}`,
146
- token: `merge ${otherBranch}`,
147
- expected: ["branch abc"]
148
- };
149
- throw error;
150
- }
151
- if (currentCommit === void 0 || !currentCommit) {
152
- const error = new Error(
153
- `Incorrect usage of "merge". Current branch (${state.records.currBranch})has no commits`
154
- );
155
- error.hash = {
156
- text: `merge ${otherBranch}`,
157
- token: `merge ${otherBranch}`,
158
- expected: ["commit"]
159
- };
160
- throw error;
161
- }
162
- if (!state.records.branches.has(otherBranch)) {
163
- const error = new Error(
164
- 'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") does not exist"
165
- );
166
- error.hash = {
167
- text: `merge ${otherBranch}`,
168
- token: `merge ${otherBranch}`,
169
- expected: [`branch ${otherBranch}`]
170
- };
171
- throw error;
172
- }
173
- if (otherCommit === void 0 || !otherCommit) {
174
- const error = new Error(
175
- 'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") has no commits"
176
- );
177
- error.hash = {
178
- text: `merge ${otherBranch}`,
179
- token: `merge ${otherBranch}`,
180
- expected: ['"commit"']
181
- };
182
- throw error;
183
- }
184
- if (currentCommit === otherCommit) {
185
- const error = new Error('Incorrect usage of "merge". Both branches have same head');
186
- error.hash = {
187
- text: `merge ${otherBranch}`,
188
- token: `merge ${otherBranch}`,
189
- expected: ["branch abc"]
190
- };
191
- throw error;
192
- }
193
- if (customId && state.records.commits.has(customId)) {
194
- const error = new Error(
195
- 'Incorrect usage of "merge". Commit with id:' + customId + " already exists, use different custom id"
196
- );
197
- error.hash = {
198
- text: `merge ${otherBranch} ${customId} ${overrideType} ${customTags == null ? void 0 : customTags.join(" ")}`,
199
- token: `merge ${otherBranch} ${customId} ${overrideType} ${customTags == null ? void 0 : customTags.join(" ")}`,
200
- expected: [
201
- `merge ${otherBranch} ${customId}_UNIQUE ${overrideType} ${customTags == null ? void 0 : customTags.join(" ")}`
202
- ]
203
- };
204
- throw error;
205
- }
206
- const verifiedBranch = otherBranchCheck ? otherBranchCheck : "";
207
- const commit2 = {
208
- id: customId || `${state.records.seq}-${getID()}`,
209
- message: `merged branch ${otherBranch} into ${state.records.currBranch}`,
210
- seq: state.records.seq++,
211
- parents: state.records.head == null ? [] : [state.records.head.id, verifiedBranch],
212
- branch: state.records.currBranch,
213
- type: commitType.MERGE,
214
- customType: overrideType,
215
- customId: customId ? true : false,
216
- tags: customTags ?? []
217
- };
218
- state.records.head = commit2;
219
- state.records.commits.set(commit2.id, commit2);
220
- state.records.branches.set(state.records.currBranch, commit2.id);
221
- log.debug(state.records.branches);
222
- log.debug("in mergeBranch");
223
- }, "merge");
224
- var cherryPick = /* @__PURE__ */ __name(function(cherryPickDB) {
225
- let sourceId = cherryPickDB.id;
226
- let targetId = cherryPickDB.targetId;
227
- let tags = cherryPickDB.tags;
228
- let parentCommitId = cherryPickDB.parent;
229
- log.debug("Entering cherryPick:", sourceId, targetId, tags);
230
- const config = getConfig3();
231
- sourceId = common_default.sanitizeText(sourceId, config);
232
- targetId = common_default.sanitizeText(targetId, config);
233
- tags = tags == null ? void 0 : tags.map((tag) => common_default.sanitizeText(tag, config));
234
- parentCommitId = common_default.sanitizeText(parentCommitId, config);
235
- if (!sourceId || !state.records.commits.has(sourceId)) {
236
- const error = new Error(
237
- 'Incorrect usage of "cherryPick". Source commit id should exist and provided'
238
- );
239
- error.hash = {
240
- text: `cherryPick ${sourceId} ${targetId}`,
241
- token: `cherryPick ${sourceId} ${targetId}`,
242
- expected: ["cherry-pick abc"]
243
- };
244
- throw error;
245
- }
246
- const sourceCommit = state.records.commits.get(sourceId);
247
- if (sourceCommit === void 0 || !sourceCommit) {
248
- throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
249
- }
250
- if (parentCommitId && !(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))) {
251
- const error = new Error(
252
- "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
253
- );
254
- throw error;
255
- }
256
- const sourceCommitBranch = sourceCommit.branch;
257
- if (sourceCommit.type === commitType.MERGE && !parentCommitId) {
258
- const error = new Error(
259
- "Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
260
- );
261
- throw error;
262
- }
263
- if (!targetId || !state.records.commits.has(targetId)) {
264
- if (sourceCommitBranch === state.records.currBranch) {
265
- const error = new Error(
266
- 'Incorrect usage of "cherryPick". Source commit is already on current branch'
267
- );
268
- error.hash = {
269
- text: `cherryPick ${sourceId} ${targetId}`,
270
- token: `cherryPick ${sourceId} ${targetId}`,
271
- expected: ["cherry-pick abc"]
272
- };
273
- throw error;
274
- }
275
- const currentCommitId = state.records.branches.get(state.records.currBranch);
276
- if (currentCommitId === void 0 || !currentCommitId) {
277
- const error = new Error(
278
- `Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`
279
- );
280
- error.hash = {
281
- text: `cherryPick ${sourceId} ${targetId}`,
282
- token: `cherryPick ${sourceId} ${targetId}`,
283
- expected: ["cherry-pick abc"]
284
- };
285
- throw error;
286
- }
287
- const currentCommit = state.records.commits.get(currentCommitId);
288
- if (currentCommit === void 0 || !currentCommit) {
289
- const error = new Error(
290
- `Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`
291
- );
292
- error.hash = {
293
- text: `cherryPick ${sourceId} ${targetId}`,
294
- token: `cherryPick ${sourceId} ${targetId}`,
295
- expected: ["cherry-pick abc"]
296
- };
297
- throw error;
298
- }
299
- const commit2 = {
300
- id: state.records.seq + "-" + getID(),
301
- message: `cherry-picked ${sourceCommit == null ? void 0 : sourceCommit.message} into ${state.records.currBranch}`,
302
- seq: state.records.seq++,
303
- parents: state.records.head == null ? [] : [state.records.head.id, sourceCommit.id],
304
- branch: state.records.currBranch,
305
- type: commitType.CHERRY_PICK,
306
- tags: tags ? tags.filter(Boolean) : [
307
- `cherry-pick:${sourceCommit.id}${sourceCommit.type === commitType.MERGE ? `|parent:${parentCommitId}` : ""}`
308
- ]
309
- };
310
- state.records.head = commit2;
311
- state.records.commits.set(commit2.id, commit2);
312
- state.records.branches.set(state.records.currBranch, commit2.id);
313
- log.debug(state.records.branches);
314
- log.debug("in cherryPick");
315
- }
316
- }, "cherryPick");
317
- var checkout = /* @__PURE__ */ __name(function(branch2) {
318
- branch2 = common_default.sanitizeText(branch2, getConfig3());
319
- if (!state.records.branches.has(branch2)) {
320
- const error = new Error(
321
- `Trying to checkout branch which is not yet created. (Help try using "branch ${branch2}")`
322
- );
323
- error.hash = {
324
- text: `checkout ${branch2}`,
325
- token: `checkout ${branch2}`,
326
- expected: [`branch ${branch2}`]
327
- };
328
- throw error;
329
- } else {
330
- state.records.currBranch = branch2;
331
- const id = state.records.branches.get(state.records.currBranch);
332
- if (id === void 0 || !id) {
333
- state.records.head = null;
334
- } else {
335
- state.records.head = state.records.commits.get(id) ?? null;
336
- }
337
- }
338
- }, "checkout");
339
- function upsert(arr, key, newVal) {
340
- const index = arr.indexOf(key);
341
- if (index === -1) {
342
- arr.push(newVal);
343
- } else {
344
- arr.splice(index, 1, newVal);
345
- }
346
- }
347
- __name(upsert, "upsert");
348
- function prettyPrintCommitHistory(commitArr) {
349
- const commit2 = commitArr.reduce((out, commit3) => {
350
- if (out.seq > commit3.seq) {
351
- return out;
352
- }
353
- return commit3;
354
- }, commitArr[0]);
355
- let line = "";
356
- commitArr.forEach(function(c) {
357
- if (c === commit2) {
358
- line += " *";
359
- } else {
360
- line += " |";
361
- }
362
- });
363
- const label = [line, commit2.id, commit2.seq];
364
- for (const branch2 in state.records.branches) {
365
- if (state.records.branches.get(branch2) === commit2.id) {
366
- label.push(branch2);
367
- }
368
- }
369
- log.debug(label.join(" "));
370
- if (commit2.parents && commit2.parents.length == 2 && commit2.parents[0] && commit2.parents[1]) {
371
- const newCommit = state.records.commits.get(commit2.parents[0]);
372
- upsert(commitArr, commit2, newCommit);
373
- if (commit2.parents[1]) {
374
- commitArr.push(state.records.commits.get(commit2.parents[1]));
375
- }
376
- } else if (commit2.parents.length == 0) {
377
- return;
378
- } else {
379
- if (commit2.parents[0]) {
380
- const newCommit = state.records.commits.get(commit2.parents[0]);
381
- upsert(commitArr, commit2, newCommit);
382
- }
383
- }
384
- commitArr = uniqBy(commitArr, (c) => c.id);
385
- prettyPrintCommitHistory(commitArr);
386
- }
387
- __name(prettyPrintCommitHistory, "prettyPrintCommitHistory");
388
- var prettyPrint = /* @__PURE__ */ __name(function() {
389
- log.debug(state.records.commits);
390
- const node = getCommitsArray()[0];
391
- prettyPrintCommitHistory([node]);
392
- }, "prettyPrint");
393
- var clear2 = /* @__PURE__ */ __name(function() {
394
- state.reset();
395
- clear$2();
396
- }, "clear");
397
- var getBranchesAsObjArray = /* @__PURE__ */ __name(function() {
398
- const branchesArray = [...state.records.branchConfig.values()].map((branchConfig, i) => {
399
- if (branchConfig.order !== null && branchConfig.order !== void 0) {
400
- return branchConfig;
401
- }
402
- return {
403
- ...branchConfig,
404
- order: parseFloat(`0.${i}`)
405
- };
406
- }).sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).map(({ name }) => ({ name }));
407
- return branchesArray;
408
- }, "getBranchesAsObjArray");
409
- var getBranches = /* @__PURE__ */ __name(function() {
410
- return state.records.branches;
411
- }, "getBranches");
412
- var getCommits = /* @__PURE__ */ __name(function() {
413
- return state.records.commits;
414
- }, "getCommits");
415
- var getCommitsArray = /* @__PURE__ */ __name(function() {
416
- const commitArr = [...state.records.commits.values()];
417
- commitArr.forEach(function(o) {
418
- log.debug(o.id);
419
- });
420
- commitArr.sort((a, b) => a.seq - b.seq);
421
- return commitArr;
422
- }, "getCommitsArray");
423
- var getCurrentBranch = /* @__PURE__ */ __name(function() {
424
- return state.records.currBranch;
425
- }, "getCurrentBranch");
426
- var getDirection = /* @__PURE__ */ __name(function() {
427
- return state.records.direction;
428
- }, "getDirection");
429
- var getHead = /* @__PURE__ */ __name(function() {
430
- return state.records.head;
431
- }, "getHead");
432
- var db = {
433
- commitType,
434
- getConfig: getConfig3,
435
- setDirection,
436
- setOptions,
437
- getOptions,
438
- commit,
439
- branch,
440
- merge,
441
- cherryPick,
442
- checkout,
443
- //reset,
444
- prettyPrint,
445
- clear: clear2,
446
- getBranchesAsObjArray,
447
- getBranches,
448
- getCommits,
449
- getCommitsArray,
450
- getCurrentBranch,
451
- getDirection,
452
- getHead,
453
- setAccTitle,
454
- getAccTitle,
455
- getAccDescription,
456
- setAccDescription,
457
- setDiagramTitle,
458
- getDiagramTitle
459
- };
460
- var populate = /* @__PURE__ */ __name((ast, db2) => {
461
- populateCommonDb(ast, db2);
462
- if (ast.dir) {
463
- db2.setDirection(ast.dir);
464
- }
465
- for (const statement of ast.statements) {
466
- parseStatement(statement, db2);
467
- }
468
- }, "populate");
469
- var parseStatement = /* @__PURE__ */ __name((statement, db2) => {
470
- const parsers = {
471
- Commit: /* @__PURE__ */ __name((stmt) => db2.commit(parseCommit(stmt)), "Commit"),
472
- Branch: /* @__PURE__ */ __name((stmt) => db2.branch(parseBranch(stmt)), "Branch"),
473
- Merge: /* @__PURE__ */ __name((stmt) => db2.merge(parseMerge(stmt)), "Merge"),
474
- Checkout: /* @__PURE__ */ __name((stmt) => db2.checkout(parseCheckout(stmt)), "Checkout"),
475
- CherryPicking: /* @__PURE__ */ __name((stmt) => db2.cherryPick(parseCherryPicking(stmt)), "CherryPicking")
476
- };
477
- const parser2 = parsers[statement.$type];
478
- if (parser2) {
479
- parser2(statement);
480
- } else {
481
- log.error(`Unknown statement type: ${statement.$type}`);
482
- }
483
- }, "parseStatement");
484
- var parseCommit = /* @__PURE__ */ __name((commit2) => {
485
- const commitDB = {
486
- id: commit2.id,
487
- msg: commit2.message ?? "",
488
- type: commit2.type !== void 0 ? commitType[commit2.type] : commitType.NORMAL,
489
- tags: commit2.tags ?? void 0
490
- };
491
- return commitDB;
492
- }, "parseCommit");
493
- var parseBranch = /* @__PURE__ */ __name((branch2) => {
494
- const branchDB = {
495
- name: branch2.name,
496
- order: branch2.order ?? 0
497
- };
498
- return branchDB;
499
- }, "parseBranch");
500
- var parseMerge = /* @__PURE__ */ __name((merge2) => {
501
- const mergeDB = {
502
- branch: merge2.branch,
503
- id: merge2.id ?? "",
504
- type: merge2.type !== void 0 ? commitType[merge2.type] : void 0,
505
- tags: merge2.tags ?? void 0
506
- };
507
- return mergeDB;
508
- }, "parseMerge");
509
- var parseCheckout = /* @__PURE__ */ __name((checkout2) => {
510
- const branch2 = checkout2.branch;
511
- return branch2;
512
- }, "parseCheckout");
513
- var parseCherryPicking = /* @__PURE__ */ __name((cherryPicking) => {
514
- var _a;
515
- const cherryPickDB = {
516
- id: cherryPicking.id,
517
- targetId: "",
518
- tags: ((_a = cherryPicking.tags) == null ? void 0 : _a.length) === 0 ? void 0 : cherryPicking.tags,
519
- parent: cherryPicking.parent
520
- };
521
- return cherryPickDB;
522
- }, "parseCherryPicking");
523
- var parser = {
524
- parse: /* @__PURE__ */ __name(async (input) => {
525
- const ast = await parse("gitGraph", input);
526
- log.debug(ast);
527
- populate(ast, db);
528
- }, "parse")
529
- };
530
- var DEFAULT_CONFIG = getConfig2();
531
- var DEFAULT_GITGRAPH_CONFIG2 = DEFAULT_CONFIG == null ? void 0 : DEFAULT_CONFIG.gitGraph;
532
- var LAYOUT_OFFSET = 10;
533
- var COMMIT_STEP = 40;
534
- var PX = 4;
535
- var PY = 2;
536
- var THEME_COLOR_LIMIT = 8;
537
- var branchPos = /* @__PURE__ */ new Map();
538
- var commitPos = /* @__PURE__ */ new Map();
539
- var defaultPos = 30;
540
- var allCommitsDict = /* @__PURE__ */ new Map();
541
- var lanes = [];
542
- var maxPos = 0;
543
- var dir = "LR";
544
- var clear3 = /* @__PURE__ */ __name(() => {
545
- branchPos.clear();
546
- commitPos.clear();
547
- allCommitsDict.clear();
548
- maxPos = 0;
549
- lanes = [];
550
- dir = "LR";
551
- }, "clear");
552
- var drawText = /* @__PURE__ */ __name((txt) => {
553
- const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
554
- const rows = typeof txt === "string" ? txt.split(/\\n|\n|<br\s*\/?>/gi) : txt;
555
- rows.forEach((row) => {
556
- const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
557
- tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
558
- tspan.setAttribute("dy", "1em");
559
- tspan.setAttribute("x", "0");
560
- tspan.setAttribute("class", "row");
561
- tspan.textContent = row.trim();
562
- svgLabel.appendChild(tspan);
563
- });
564
- return svgLabel;
565
- }, "drawText");
566
- var findClosestParent = /* @__PURE__ */ __name((parents) => {
567
- let closestParent;
568
- let comparisonFunc;
569
- let targetPosition;
570
- if (dir === "BT") {
571
- comparisonFunc = /* @__PURE__ */ __name((a, b) => a <= b, "comparisonFunc");
572
- targetPosition = Infinity;
573
- } else {
574
- comparisonFunc = /* @__PURE__ */ __name((a, b) => a >= b, "comparisonFunc");
575
- targetPosition = 0;
576
- }
577
- parents.forEach((parent) => {
578
- var _a, _b;
579
- const parentPosition = dir === "TB" || dir == "BT" ? (_a = commitPos.get(parent)) == null ? void 0 : _a.y : (_b = commitPos.get(parent)) == null ? void 0 : _b.x;
580
- if (parentPosition !== void 0 && comparisonFunc(parentPosition, targetPosition)) {
581
- closestParent = parent;
582
- targetPosition = parentPosition;
583
- }
584
- });
585
- return closestParent;
586
- }, "findClosestParent");
587
- var findClosestParentBT = /* @__PURE__ */ __name((parents) => {
588
- let closestParent = "";
589
- let maxPosition = Infinity;
590
- parents.forEach((parent) => {
591
- const parentPosition = commitPos.get(parent).y;
592
- if (parentPosition <= maxPosition) {
593
- closestParent = parent;
594
- maxPosition = parentPosition;
595
- }
596
- });
597
- return closestParent || void 0;
598
- }, "findClosestParentBT");
599
- var setParallelBTPos = /* @__PURE__ */ __name((sortedKeys, commits, defaultPos2) => {
600
- let curPos = defaultPos2;
601
- let maxPosition = defaultPos2;
602
- const roots = [];
603
- sortedKeys.forEach((key) => {
604
- const commit2 = commits.get(key);
605
- if (!commit2) {
606
- throw new Error(`Commit not found for key ${key}`);
607
- }
608
- if (commit2.parents.length) {
609
- curPos = calculateCommitPosition(commit2);
610
- maxPosition = Math.max(curPos, maxPosition);
611
- } else {
612
- roots.push(commit2);
613
- }
614
- setCommitPosition(commit2, curPos);
615
- });
616
- curPos = maxPosition;
617
- roots.forEach((commit2) => {
618
- setRootPosition(commit2, curPos, defaultPos2);
619
- });
620
- sortedKeys.forEach((key) => {
621
- const commit2 = commits.get(key);
622
- if (commit2 == null ? void 0 : commit2.parents.length) {
623
- const closestParent = findClosestParentBT(commit2.parents);
624
- curPos = commitPos.get(closestParent).y - COMMIT_STEP;
625
- if (curPos <= maxPosition) {
626
- maxPosition = curPos;
627
- }
628
- const x = branchPos.get(commit2.branch).pos;
629
- const y = curPos - LAYOUT_OFFSET;
630
- commitPos.set(commit2.id, { x, y });
631
- }
632
- });
633
- }, "setParallelBTPos");
634
- var findClosestParentPos = /* @__PURE__ */ __name((commit2) => {
635
- var _a;
636
- const closestParent = findClosestParent(commit2.parents.filter((p) => p !== null));
637
- if (!closestParent) {
638
- throw new Error(`Closest parent not found for commit ${commit2.id}`);
639
- }
640
- const closestParentPos = (_a = commitPos.get(closestParent)) == null ? void 0 : _a.y;
641
- if (closestParentPos === void 0) {
642
- throw new Error(`Closest parent position not found for commit ${commit2.id}`);
643
- }
644
- return closestParentPos;
645
- }, "findClosestParentPos");
646
- var calculateCommitPosition = /* @__PURE__ */ __name((commit2) => {
647
- const closestParentPos = findClosestParentPos(commit2);
648
- return closestParentPos + COMMIT_STEP;
649
- }, "calculateCommitPosition");
650
- var setCommitPosition = /* @__PURE__ */ __name((commit2, curPos) => {
651
- const branch2 = branchPos.get(commit2.branch);
652
- if (!branch2) {
653
- throw new Error(`Branch not found for commit ${commit2.id}`);
654
- }
655
- const x = branch2.pos;
656
- const y = curPos + LAYOUT_OFFSET;
657
- commitPos.set(commit2.id, { x, y });
658
- return { x, y };
659
- }, "setCommitPosition");
660
- var setRootPosition = /* @__PURE__ */ __name((commit2, curPos, defaultPos2) => {
661
- const branch2 = branchPos.get(commit2.branch);
662
- if (!branch2) {
663
- throw new Error(`Branch not found for commit ${commit2.id}`);
664
- }
665
- const y = curPos + defaultPos2;
666
- const x = branch2.pos;
667
- commitPos.set(commit2.id, { x, y });
668
- }, "setRootPosition");
669
- var drawCommitBullet = /* @__PURE__ */ __name((gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType) => {
670
- if (commitSymbolType === commitType.HIGHLIGHT) {
671
- gBullets.append("rect").attr("x", commitPosition.x - 10).attr("y", commitPosition.y - 10).attr("width", 20).attr("height", 20).attr(
672
- "class",
673
- `commit ${commit2.id} commit-highlight${branchIndex % THEME_COLOR_LIMIT} ${typeClass}-outer`
674
- );
675
- gBullets.append("rect").attr("x", commitPosition.x - 6).attr("y", commitPosition.y - 6).attr("width", 12).attr("height", 12).attr(
676
- "class",
677
- `commit ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT} ${typeClass}-inner`
678
- );
679
- } else if (commitSymbolType === commitType.CHERRY_PICK) {
680
- gBullets.append("circle").attr("cx", commitPosition.x).attr("cy", commitPosition.y).attr("r", 10).attr("class", `commit ${commit2.id} ${typeClass}`);
681
- gBullets.append("circle").attr("cx", commitPosition.x - 3).attr("cy", commitPosition.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
682
- gBullets.append("circle").attr("cx", commitPosition.x + 3).attr("cy", commitPosition.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
683
- gBullets.append("line").attr("x1", commitPosition.x + 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
684
- gBullets.append("line").attr("x1", commitPosition.x - 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
685
- } else {
686
- const circle = gBullets.append("circle");
687
- circle.attr("cx", commitPosition.x);
688
- circle.attr("cy", commitPosition.y);
689
- circle.attr("r", commit2.type === commitType.MERGE ? 9 : 10);
690
- circle.attr("class", `commit ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`);
691
- if (commitSymbolType === commitType.MERGE) {
692
- const circle2 = gBullets.append("circle");
693
- circle2.attr("cx", commitPosition.x);
694
- circle2.attr("cy", commitPosition.y);
695
- circle2.attr("r", 6);
696
- circle2.attr(
697
- "class",
698
- `commit ${typeClass} ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`
699
- );
700
- }
701
- if (commitSymbolType === commitType.REVERSE) {
702
- const cross = gBullets.append("path");
703
- cross.attr(
704
- "d",
705
- `M ${commitPosition.x - 5},${commitPosition.y - 5}L${commitPosition.x + 5},${commitPosition.y + 5}M${commitPosition.x - 5},${commitPosition.y + 5}L${commitPosition.x + 5},${commitPosition.y - 5}`
706
- ).attr("class", `commit ${typeClass} ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`);
707
- }
708
- }
709
- }, "drawCommitBullet");
710
- var drawCommitLabel = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => {
711
- var _a;
712
- if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && (DEFAULT_GITGRAPH_CONFIG2 == null ? void 0 : DEFAULT_GITGRAPH_CONFIG2.showCommitLabel)) {
713
- const wrapper = gLabels.append("g");
714
- const labelBkg = wrapper.insert("rect").attr("class", "commit-label-bkg");
715
- const text = wrapper.append("text").attr("x", pos).attr("y", commitPosition.y + 25).attr("class", "commit-label").text(commit2.id);
716
- const bbox = (_a = text.node()) == null ? void 0 : _a.getBBox();
717
- if (bbox) {
718
- labelBkg.attr("x", commitPosition.posWithOffset - bbox.width / 2 - PY).attr("y", commitPosition.y + 13.5).attr("width", bbox.width + 2 * PY).attr("height", bbox.height + 2 * PY);
719
- if (dir === "TB" || dir === "BT") {
720
- labelBkg.attr("x", commitPosition.x - (bbox.width + 4 * PX + 5)).attr("y", commitPosition.y - 12);
721
- text.attr("x", commitPosition.x - (bbox.width + 4 * PX)).attr("y", commitPosition.y + bbox.height - 12);
722
- } else {
723
- text.attr("x", commitPosition.posWithOffset - bbox.width / 2);
724
- }
725
- if (DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel) {
726
- if (dir === "TB" || dir === "BT") {
727
- text.attr(
728
- "transform",
729
- "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
730
- );
731
- labelBkg.attr(
732
- "transform",
733
- "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
734
- );
735
- } else {
736
- const r_x = -7.5 - (bbox.width + 10) / 25 * 9.5;
737
- const r_y = 10 + bbox.width / 25 * 8.5;
738
- wrapper.attr(
739
- "transform",
740
- "translate(" + r_x + ", " + r_y + ") rotate(-45, " + pos + ", " + commitPosition.y + ")"
741
- );
742
- }
743
- }
744
- }
745
- }
746
- }, "drawCommitLabel");
747
- var drawCommitTags = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => {
748
- var _a;
749
- if (commit2.tags.length > 0) {
750
- let yOffset = 0;
751
- let maxTagBboxWidth = 0;
752
- let maxTagBboxHeight = 0;
753
- const tagElements = [];
754
- for (const tagValue of commit2.tags.reverse()) {
755
- const rect = gLabels.insert("polygon");
756
- const hole = gLabels.append("circle");
757
- const tag = gLabels.append("text").attr("y", commitPosition.y - 16 - yOffset).attr("class", "tag-label").text(tagValue);
758
- const tagBbox = (_a = tag.node()) == null ? void 0 : _a.getBBox();
759
- if (!tagBbox) {
760
- throw new Error("Tag bbox not found");
761
- }
762
- maxTagBboxWidth = Math.max(maxTagBboxWidth, tagBbox.width);
763
- maxTagBboxHeight = Math.max(maxTagBboxHeight, tagBbox.height);
764
- tag.attr("x", commitPosition.posWithOffset - tagBbox.width / 2);
765
- tagElements.push({
766
- tag,
767
- hole,
768
- rect,
769
- yOffset
770
- });
771
- yOffset += 20;
772
- }
773
- for (const { tag, hole, rect, yOffset: yOffset2 } of tagElements) {
774
- const h2 = maxTagBboxHeight / 2;
775
- const ly = commitPosition.y - 19.2 - yOffset2;
776
- rect.attr("class", "tag-label-bkg").attr(
777
- "points",
778
- `
779
- ${pos - maxTagBboxWidth / 2 - PX / 2},${ly + PY}
780
- ${pos - maxTagBboxWidth / 2 - PX / 2},${ly - PY}
781
- ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly - h2 - PY}
782
- ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly - h2 - PY}
783
- ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly + h2 + PY}
784
- ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly + h2 + PY}`
785
- );
786
- hole.attr("cy", ly).attr("cx", pos - maxTagBboxWidth / 2 + PX / 2).attr("r", 1.5).attr("class", "tag-hole");
787
- if (dir === "TB" || dir === "BT") {
788
- const yOrigin = pos + yOffset2;
789
- rect.attr("class", "tag-label-bkg").attr(
790
- "points",
791
- `
792
- ${commitPosition.x},${yOrigin + 2}
793
- ${commitPosition.x},${yOrigin - 2}
794
- ${commitPosition.x + LAYOUT_OFFSET},${yOrigin - h2 - 2}
795
- ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin - h2 - 2}
796
- ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin + h2 + 2}
797
- ${commitPosition.x + LAYOUT_OFFSET},${yOrigin + h2 + 2}`
798
- ).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
799
- hole.attr("cx", commitPosition.x + PX / 2).attr("cy", yOrigin).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
800
- tag.attr("x", commitPosition.x + 5).attr("y", yOrigin + 3).attr("transform", "translate(14,14) rotate(45, " + commitPosition.x + "," + pos + ")");
801
- }
802
- }
803
- }
804
- }, "drawCommitTags");
805
- var getCommitClassType = /* @__PURE__ */ __name((commit2) => {
806
- const commitSymbolType = commit2.customType ?? commit2.type;
807
- switch (commitSymbolType) {
808
- case commitType.NORMAL:
809
- return "commit-normal";
810
- case commitType.REVERSE:
811
- return "commit-reverse";
812
- case commitType.HIGHLIGHT:
813
- return "commit-highlight";
814
- case commitType.MERGE:
815
- return "commit-merge";
816
- case commitType.CHERRY_PICK:
817
- return "commit-cherry-pick";
818
- default:
819
- return "commit-normal";
820
- }
821
- }, "getCommitClassType");
822
- var calculatePosition = /* @__PURE__ */ __name((commit2, dir2, pos, commitPos2) => {
823
- const defaultCommitPosition = { x: 0, y: 0 };
824
- if (commit2.parents.length > 0) {
825
- const closestParent = findClosestParent(commit2.parents);
826
- if (closestParent) {
827
- const parentPosition = commitPos2.get(closestParent) ?? defaultCommitPosition;
828
- if (dir2 === "TB") {
829
- return parentPosition.y + COMMIT_STEP;
830
- } else if (dir2 === "BT") {
831
- const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
832
- return currentPosition.y - COMMIT_STEP;
833
- } else {
834
- return parentPosition.x + COMMIT_STEP;
835
- }
836
- }
837
- } else {
838
- if (dir2 === "TB") {
839
- return defaultPos;
840
- } else if (dir2 === "BT") {
841
- const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
842
- return currentPosition.y - COMMIT_STEP;
843
- } else {
844
- return 0;
845
- }
846
- }
847
- return 0;
848
- }, "calculatePosition");
849
- var getCommitPosition = /* @__PURE__ */ __name((commit2, pos, isParallelCommits) => {
850
- var _a, _b;
851
- const posWithOffset = dir === "BT" && isParallelCommits ? pos : pos + LAYOUT_OFFSET;
852
- const y = dir === "TB" || dir === "BT" ? posWithOffset : (_a = branchPos.get(commit2.branch)) == null ? void 0 : _a.pos;
853
- const x = dir === "TB" || dir === "BT" ? (_b = branchPos.get(commit2.branch)) == null ? void 0 : _b.pos : posWithOffset;
854
- if (x === void 0 || y === void 0) {
855
- throw new Error(`Position were undefined for commit ${commit2.id}`);
856
- }
857
- return { x, y, posWithOffset };
858
- }, "getCommitPosition");
859
- var drawCommits = /* @__PURE__ */ __name((svg, commits, modifyGraph) => {
860
- if (!DEFAULT_GITGRAPH_CONFIG2) {
861
- throw new Error("GitGraph config not found");
862
- }
863
- const gBullets = svg.append("g").attr("class", "commit-bullets");
864
- const gLabels = svg.append("g").attr("class", "commit-labels");
865
- let pos = dir === "TB" || dir === "BT" ? defaultPos : 0;
866
- const keys = [...commits.keys()];
867
- const isParallelCommits = (DEFAULT_GITGRAPH_CONFIG2 == null ? void 0 : DEFAULT_GITGRAPH_CONFIG2.parallelCommits) ?? false;
868
- const sortKeys = /* @__PURE__ */ __name((a, b) => {
869
- var _a, _b;
870
- const seqA = (_a = commits.get(a)) == null ? void 0 : _a.seq;
871
- const seqB = (_b = commits.get(b)) == null ? void 0 : _b.seq;
872
- return seqA !== void 0 && seqB !== void 0 ? seqA - seqB : 0;
873
- }, "sortKeys");
874
- let sortedKeys = keys.sort(sortKeys);
875
- if (dir === "BT") {
876
- if (isParallelCommits) {
877
- setParallelBTPos(sortedKeys, commits, pos);
878
- }
879
- sortedKeys = sortedKeys.reverse();
880
- }
881
- sortedKeys.forEach((key) => {
882
- var _a;
883
- const commit2 = commits.get(key);
884
- if (!commit2) {
885
- throw new Error(`Commit not found for key ${key}`);
886
- }
887
- if (isParallelCommits) {
888
- pos = calculatePosition(commit2, dir, pos, commitPos);
889
- }
890
- const commitPosition = getCommitPosition(commit2, pos, isParallelCommits);
891
- if (modifyGraph) {
892
- const typeClass = getCommitClassType(commit2);
893
- const commitSymbolType = commit2.customType ?? commit2.type;
894
- const branchIndex = ((_a = branchPos.get(commit2.branch)) == null ? void 0 : _a.index) ?? 0;
895
- drawCommitBullet(gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType);
896
- drawCommitLabel(gLabels, commit2, commitPosition, pos);
897
- drawCommitTags(gLabels, commit2, commitPosition, pos);
898
- }
899
- if (dir === "TB" || dir === "BT") {
900
- commitPos.set(commit2.id, { x: commitPosition.x, y: commitPosition.posWithOffset });
901
- } else {
902
- commitPos.set(commit2.id, { x: commitPosition.posWithOffset, y: commitPosition.y });
903
- }
904
- pos = dir === "BT" && isParallelCommits ? pos + COMMIT_STEP : pos + COMMIT_STEP + LAYOUT_OFFSET;
905
- if (pos > maxPos) {
906
- maxPos = pos;
907
- }
908
- });
909
- }, "drawCommits");
910
- var shouldRerouteArrow = /* @__PURE__ */ __name((commitA, commitB, p1, p2, allCommits) => {
911
- const commitBIsFurthest = dir === "TB" || dir === "BT" ? p1.x < p2.x : p1.y < p2.y;
912
- const branchToGetCurve = commitBIsFurthest ? commitB.branch : commitA.branch;
913
- const isOnBranchToGetCurve = /* @__PURE__ */ __name((x) => x.branch === branchToGetCurve, "isOnBranchToGetCurve");
914
- const isBetweenCommits = /* @__PURE__ */ __name((x) => x.seq > commitA.seq && x.seq < commitB.seq, "isBetweenCommits");
915
- return [...allCommits.values()].some((commitX) => {
916
- return isBetweenCommits(commitX) && isOnBranchToGetCurve(commitX);
917
- });
918
- }, "shouldRerouteArrow");
919
- var findLane = /* @__PURE__ */ __name((y1, y2, depth = 0) => {
920
- const candidate = y1 + Math.abs(y1 - y2) / 2;
921
- if (depth > 5) {
922
- return candidate;
923
- }
924
- const ok = lanes.every((lane) => Math.abs(lane - candidate) >= 10);
925
- if (ok) {
926
- lanes.push(candidate);
927
- return candidate;
928
- }
929
- const diff = Math.abs(y1 - y2);
930
- return findLane(y1, y2 - diff / 5, depth + 1);
931
- }, "findLane");
932
- var drawArrow = /* @__PURE__ */ __name((svg, commitA, commitB, allCommits) => {
933
- var _a, _b, _c, _d, _e;
934
- const p1 = commitPos.get(commitA.id);
935
- const p2 = commitPos.get(commitB.id);
936
- if (p1 === void 0 || p2 === void 0) {
937
- throw new Error(`Commit positions not found for commits ${commitA.id} and ${commitB.id}`);
938
- }
939
- const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p2, allCommits);
940
- let arc = "";
941
- let arc2 = "";
942
- let radius = 0;
943
- let offset = 0;
944
- let colorClassNum = (_a = branchPos.get(commitB.branch)) == null ? void 0 : _a.index;
945
- if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
946
- colorClassNum = (_b = branchPos.get(commitA.branch)) == null ? void 0 : _b.index;
947
- }
948
- let lineDef;
949
- if (arrowNeedsRerouting) {
950
- arc = "A 10 10, 0, 0, 0,";
951
- arc2 = "A 10 10, 0, 0, 1,";
952
- radius = 10;
953
- offset = 10;
954
- const lineY = p1.y < p2.y ? findLane(p1.y, p2.y) : findLane(p2.y, p1.y);
955
- const lineX = p1.x < p2.x ? findLane(p1.x, p2.x) : findLane(p2.x, p1.x);
956
- if (dir === "TB") {
957
- if (p1.x < p2.x) {
958
- lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius} ${p1.y} ${arc2} ${lineX} ${p1.y + offset} L ${lineX} ${p2.y - radius} ${arc} ${lineX + offset} ${p2.y} L ${p2.x} ${p2.y}`;
959
- } else {
960
- colorClassNum = (_c = branchPos.get(commitA.branch)) == null ? void 0 : _c.index;
961
- lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius} ${p1.y} ${arc} ${lineX} ${p1.y + offset} L ${lineX} ${p2.y - radius} ${arc2} ${lineX - offset} ${p2.y} L ${p2.x} ${p2.y}`;
962
- }
963
- } else if (dir === "BT") {
964
- if (p1.x < p2.x) {
965
- lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius} ${p1.y} ${arc} ${lineX} ${p1.y - offset} L ${lineX} ${p2.y + radius} ${arc2} ${lineX + offset} ${p2.y} L ${p2.x} ${p2.y}`;
966
- } else {
967
- colorClassNum = (_d = branchPos.get(commitA.branch)) == null ? void 0 : _d.index;
968
- lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius} ${p1.y} ${arc2} ${lineX} ${p1.y - offset} L ${lineX} ${p2.y + radius} ${arc} ${lineX - offset} ${p2.y} L ${p2.x} ${p2.y}`;
969
- }
970
- } else {
971
- if (p1.y < p2.y) {
972
- lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY - radius} ${arc} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc2} ${p2.x} ${lineY + offset} L ${p2.x} ${p2.y}`;
973
- } else {
974
- colorClassNum = (_e = branchPos.get(commitA.branch)) == null ? void 0 : _e.index;
975
- lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY + radius} ${arc2} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc} ${p2.x} ${lineY - offset} L ${p2.x} ${p2.y}`;
976
- }
977
- }
978
- } else {
979
- arc = "A 20 20, 0, 0, 0,";
980
- arc2 = "A 20 20, 0, 0, 1,";
981
- radius = 20;
982
- offset = 20;
983
- if (dir === "TB") {
984
- if (p1.x < p2.x) {
985
- if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
986
- lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
987
- } else {
988
- lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
989
- }
990
- }
991
- if (p1.x > p2.x) {
992
- arc = "A 20 20, 0, 0, 0,";
993
- arc2 = "A 20 20, 0, 0, 1,";
994
- radius = 20;
995
- offset = 20;
996
- if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
997
- lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc2} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
998
- } else {
999
- lineDef = `M ${p1.x} ${p1.y} L ${p2.x + radius} ${p1.y} ${arc} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
1000
- }
1001
- }
1002
- if (p1.x === p2.x) {
1003
- lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
1004
- }
1005
- } else if (dir === "BT") {
1006
- if (p1.x < p2.x) {
1007
- if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
1008
- lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
1009
- } else {
1010
- lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
1011
- }
1012
- }
1013
- if (p1.x > p2.x) {
1014
- arc = "A 20 20, 0, 0, 0,";
1015
- arc2 = "A 20 20, 0, 0, 1,";
1016
- radius = 20;
1017
- offset = 20;
1018
- if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
1019
- lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
1020
- } else {
1021
- lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
1022
- }
1023
- }
1024
- if (p1.x === p2.x) {
1025
- lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
1026
- }
1027
- } else {
1028
- if (p1.y < p2.y) {
1029
- if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
1030
- lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
1031
- } else {
1032
- lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
1033
- }
1034
- }
1035
- if (p1.y > p2.y) {
1036
- if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
1037
- lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
1038
- } else {
1039
- lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
1040
- }
1041
- }
1042
- if (p1.y === p2.y) {
1043
- lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
1044
- }
1045
- }
1046
- }
1047
- if (lineDef === void 0) {
1048
- throw new Error("Line definition not found");
1049
- }
1050
- svg.append("path").attr("d", lineDef).attr("class", "arrow arrow" + colorClassNum % THEME_COLOR_LIMIT);
1051
- }, "drawArrow");
1052
- var drawArrows = /* @__PURE__ */ __name((svg, commits) => {
1053
- const gArrows = svg.append("g").attr("class", "commit-arrows");
1054
- [...commits.keys()].forEach((key) => {
1055
- const commit2 = commits.get(key);
1056
- if (commit2.parents && commit2.parents.length > 0) {
1057
- commit2.parents.forEach((parent) => {
1058
- drawArrow(gArrows, commits.get(parent), commit2, commits);
1059
- });
1060
- }
1061
- });
1062
- }, "drawArrows");
1063
- var drawBranches = /* @__PURE__ */ __name((svg, branches) => {
1064
- const g = svg.append("g");
1065
- branches.forEach((branch2, index) => {
1066
- var _a;
1067
- const adjustIndexForTheme = index % THEME_COLOR_LIMIT;
1068
- const pos = (_a = branchPos.get(branch2.name)) == null ? void 0 : _a.pos;
1069
- if (pos === void 0) {
1070
- throw new Error(`Position not found for branch ${branch2.name}`);
1071
- }
1072
- const line = g.append("line");
1073
- line.attr("x1", 0);
1074
- line.attr("y1", pos);
1075
- line.attr("x2", maxPos);
1076
- line.attr("y2", pos);
1077
- line.attr("class", "branch branch" + adjustIndexForTheme);
1078
- if (dir === "TB") {
1079
- line.attr("y1", defaultPos);
1080
- line.attr("x1", pos);
1081
- line.attr("y2", maxPos);
1082
- line.attr("x2", pos);
1083
- } else if (dir === "BT") {
1084
- line.attr("y1", maxPos);
1085
- line.attr("x1", pos);
1086
- line.attr("y2", defaultPos);
1087
- line.attr("x2", pos);
1088
- }
1089
- lanes.push(pos);
1090
- const name = branch2.name;
1091
- const labelElement = drawText(name);
1092
- const bkg = g.insert("rect");
1093
- const branchLabel = g.insert("g").attr("class", "branchLabel");
1094
- const label = branchLabel.insert("g").attr("class", "label branch-label" + adjustIndexForTheme);
1095
- label.node().appendChild(labelElement);
1096
- const bbox = labelElement.getBBox();
1097
- bkg.attr("class", "branchLabelBkg label" + adjustIndexForTheme).attr("rx", 4).attr("ry", 4).attr("x", -bbox.width - 4 - ((DEFAULT_GITGRAPH_CONFIG2 == null ? void 0 : DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel) === true ? 30 : 0)).attr("y", -bbox.height / 2 + 8).attr("width", bbox.width + 18).attr("height", bbox.height + 4);
1098
- label.attr(
1099
- "transform",
1100
- "translate(" + (-bbox.width - 14 - ((DEFAULT_GITGRAPH_CONFIG2 == null ? void 0 : DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel) === true ? 30 : 0)) + ", " + (pos - bbox.height / 2 - 1) + ")"
1101
- );
1102
- if (dir === "TB") {
1103
- bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", 0);
1104
- label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", 0)");
1105
- } else if (dir === "BT") {
1106
- bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", maxPos);
1107
- label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", " + maxPos + ")");
1108
- } else {
1109
- bkg.attr("transform", "translate(-19, " + (pos - bbox.height / 2) + ")");
1110
- }
1111
- });
1112
- }, "drawBranches");
1113
- var setBranchPosition = /* @__PURE__ */ __name(function(name, pos, index, bbox, rotateCommitLabel) {
1114
- branchPos.set(name, { pos, index });
1115
- pos += 50 + (rotateCommitLabel ? 40 : 0) + (dir === "TB" || dir === "BT" ? bbox.width / 2 : 0);
1116
- return pos;
1117
- }, "setBranchPosition");
1118
- var draw = /* @__PURE__ */ __name(function(txt, id, ver, diagObj) {
1119
- clear3();
1120
- log.debug("in gitgraph renderer", txt + "\n", "id:", id, ver);
1121
- if (!DEFAULT_GITGRAPH_CONFIG2) {
1122
- throw new Error("GitGraph config not found");
1123
- }
1124
- const rotateCommitLabel = DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel ?? false;
1125
- const db2 = diagObj.db;
1126
- allCommitsDict = db2.getCommits();
1127
- const branches = db2.getBranchesAsObjArray();
1128
- dir = db2.getDirection();
1129
- const diagram2 = select(`[id="${id}"]`);
1130
- let pos = 0;
1131
- branches.forEach((branch2, index) => {
1132
- var _a;
1133
- const labelElement = drawText(branch2.name);
1134
- const g = diagram2.append("g");
1135
- const branchLabel = g.insert("g").attr("class", "branchLabel");
1136
- const label = branchLabel.insert("g").attr("class", "label branch-label");
1137
- (_a = label.node()) == null ? void 0 : _a.appendChild(labelElement);
1138
- const bbox = labelElement.getBBox();
1139
- pos = setBranchPosition(branch2.name, pos, index, bbox, rotateCommitLabel);
1140
- label.remove();
1141
- branchLabel.remove();
1142
- g.remove();
1143
- });
1144
- drawCommits(diagram2, allCommitsDict, false);
1145
- if (DEFAULT_GITGRAPH_CONFIG2.showBranches) {
1146
- drawBranches(diagram2, branches);
1147
- }
1148
- drawArrows(diagram2, allCommitsDict);
1149
- drawCommits(diagram2, allCommitsDict, true);
1150
- utils_default.insertTitle(
1151
- diagram2,
1152
- "gitTitleText",
1153
- DEFAULT_GITGRAPH_CONFIG2.titleTopMargin ?? 0,
1154
- db2.getDiagramTitle()
1155
- );
1156
- setupGraphViewbox2(
1157
- void 0,
1158
- diagram2,
1159
- DEFAULT_GITGRAPH_CONFIG2.diagramPadding,
1160
- DEFAULT_GITGRAPH_CONFIG2.useMaxWidth
1161
- );
1162
- }, "draw");
1163
- var gitGraphRenderer_default = {
1164
- draw
1165
- };
1166
- var getStyles = /* @__PURE__ */ __name((options) => `
1167
- .commit-id,
1168
- .commit-msg,
1169
- .branch-label {
1170
- fill: lightgrey;
1171
- color: lightgrey;
1172
- font-family: 'trebuchet ms', verdana, arial, sans-serif;
1173
- font-family: var(--mermaid-font-family);
1174
- }
1175
- ${[0, 1, 2, 3, 4, 5, 6, 7].map(
1176
- (i) => `
1177
- .branch-label${i} { fill: ${options["gitBranchLabel" + i]}; }
1178
- .commit${i} { stroke: ${options["git" + i]}; fill: ${options["git" + i]}; }
1179
- .commit-highlight${i} { stroke: ${options["gitInv" + i]}; fill: ${options["gitInv" + i]}; }
1180
- .label${i} { fill: ${options["git" + i]}; }
1181
- .arrow${i} { stroke: ${options["git" + i]}; }
1182
- `
1183
- ).join("\n")}
1184
-
1185
- .branch {
1186
- stroke-width: 1;
1187
- stroke: ${options.lineColor};
1188
- stroke-dasharray: 2;
1189
- }
1190
- .commit-label { font-size: ${options.commitLabelFontSize}; fill: ${options.commitLabelColor};}
1191
- .commit-label-bkg { font-size: ${options.commitLabelFontSize}; fill: ${options.commitLabelBackground}; opacity: 0.5; }
1192
- .tag-label { font-size: ${options.tagLabelFontSize}; fill: ${options.tagLabelColor};}
1193
- .tag-label-bkg { fill: ${options.tagLabelBackground}; stroke: ${options.tagLabelBorder}; }
1194
- .tag-hole { fill: ${options.textColor}; }
1195
-
1196
- .commit-merge {
1197
- stroke: ${options.primaryColor};
1198
- fill: ${options.primaryColor};
1199
- }
1200
- .commit-reverse {
1201
- stroke: ${options.primaryColor};
1202
- fill: ${options.primaryColor};
1203
- stroke-width: 3;
1204
- }
1205
- .commit-highlight-outer {
1206
- }
1207
- .commit-highlight-inner {
1208
- stroke: ${options.primaryColor};
1209
- fill: ${options.primaryColor};
1210
- }
1211
-
1212
- .arrow { stroke-width: 8; stroke-linecap: round; fill: none}
1213
- .gitTitleText {
1214
- text-anchor: middle;
1215
- font-size: 18px;
1216
- fill: ${options.textColor};
1217
- }
1218
- `, "getStyles");
1219
- var styles_default = getStyles;
1220
- var diagram = {
1221
- parser,
1222
- db,
1223
- renderer: gitGraphRenderer_default,
1224
- styles: styles_default
1225
- };
1226
-
1227
- export { diagram };