@blueking/ai-blueking 2.0.0-dev.2 → 2.0.0-dev.3

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 (183) hide show
  1. package/dist/vue2/_baseFor-DAbrc8SN.js +309 -0
  2. package/dist/vue2/arc-BqlAOiZb.js +78 -0
  3. package/dist/vue2/architecture-U656AL7Q-Dtuq8BzO.js +7 -0
  4. package/dist/vue2/architectureDiagram-VXUJARFQ-BQS5Ixrn.js +4052 -0
  5. package/dist/vue2/array-TB8zN_HT.js +5 -0
  6. package/dist/vue2/blockDiagram-VD42YOAC-Bp6L6c6e.js +3013 -0
  7. package/dist/vue2/c4Diagram-YG6GDRKO-B15ZDn3Z.js +2956 -0
  8. package/dist/vue2/channel-edTl5mpN.js +3 -0
  9. package/dist/vue2/chunk-4BX2VUAB-eAYYj1bL.js +6 -0
  10. package/dist/vue2/chunk-55IACEB6-CTzuTcHv.js +6 -0
  11. package/dist/vue2/chunk-76Q3JFCE-BrJX66ha.js +19 -0
  12. package/dist/vue2/chunk-ABZYJK2D-gsx40GnJ.js +1971 -0
  13. package/dist/vue2/chunk-ATLVNIR6-CTTwtx-5.js +65 -0
  14. package/dist/vue2/chunk-B4BG7PRW-D8o7VxRH.js +3108 -0
  15. package/dist/vue2/chunk-CVBHYZKI-Cs8lCw3u.js +10 -0
  16. package/dist/vue2/chunk-DI55MBZ5-Dl59YBtR.js +1994 -0
  17. package/dist/vue2/chunk-DNh5sLlG.js +18 -0
  18. package/dist/vue2/chunk-EXTU4WIE-BPc8ye_N.js +7 -0
  19. package/dist/vue2/chunk-FMBD7UC4-PFlLPz_s.js +3 -0
  20. package/dist/vue2/chunk-FPAJGGOC-DPvjUKQ8.js +13428 -0
  21. package/dist/vue2/chunk-FWNWRKHM-BlUTFsPK.js +56 -0
  22. package/dist/vue2/chunk-HN2XXSSU-DueSY85P.js +74 -0
  23. package/dist/vue2/chunk-JA3XYJ7Z-CRet4f6a.js +1845 -0
  24. package/dist/vue2/chunk-JZLCHNYA-Df0-MseJ.js +4861 -0
  25. package/dist/vue2/chunk-LBM3YZW2-B0-w2HZs.js +19 -0
  26. package/dist/vue2/chunk-LHMN2FUI-BOH3yE2u.js +19 -0
  27. package/dist/vue2/chunk-MI3HLSF2-6-T1J0MS.js +1140 -0
  28. package/dist/vue2/chunk-N4CR4FBY-jNnt5D3v.js +39 -0
  29. package/dist/vue2/chunk-O7ZBX7Z2-BEP34BEE.js +26 -0
  30. package/dist/vue2/chunk-QN33PNHL-DsC-XeM9.js +23 -0
  31. package/dist/vue2/chunk-QXUST7PY-DxFRymyS.js +486 -0
  32. package/dist/vue2/chunk-QZHKN3VN-D9B5jQvg.js +11 -0
  33. package/dist/vue2/chunk-S3R3BYOJ-Bs_r55Kk.js +1222 -0
  34. package/dist/vue2/chunk-S6J4BHB3-XXfWHJvh.js +19 -0
  35. package/dist/vue2/chunk-T53DSG4Q-CNvqP6Iy.js +24 -0
  36. package/dist/vue2/chunk-TZMSLE5B-C5ccYWGN.js +55 -0
  37. package/dist/vue2/chunk-XAJISQIX-XsDvU4jW.js +135 -0
  38. package/dist/vue2/classDiagram-2ON5EDUG-Cgf9yVXj.js +33 -0
  39. package/dist/vue2/classDiagram-v2-WZHVMYZB-BtF1_0UK.js +33 -0
  40. package/dist/vue2/clone-Bbr3WSpg.js +7 -0
  41. package/dist/vue2/cose-bilkent-S5V4N54A-Cmf6WLkk.js +2250 -0
  42. package/dist/vue2/cytoscape.esm-nrcriBSO.js +18100 -0
  43. package/dist/vue2/dagre-6UL2VRFP-CTl_U96l.js +298 -0
  44. package/dist/vue2/dagre-DUjlMe_B.js +1496 -0
  45. package/dist/vue2/defaultLocale-BLATqOV5.js +177 -0
  46. package/dist/vue2/diagram-PSM6KHXK-Bl7brR-1.js +497 -0
  47. package/dist/vue2/diagram-QEK2KX5R-CAeywSxy.js +226 -0
  48. package/dist/vue2/diagram-S2PKOQOG-6I6J4WRC.js +144 -0
  49. package/dist/vue2/dist-xWJvauxf.js +49 -0
  50. package/dist/vue2/erDiagram-Q2GNP2WA-C8EbfuTj.js +1603 -0
  51. package/dist/vue2/flatten-CfPhNHUL.js +34 -0
  52. package/dist/vue2/flowDiagram-NV44I4VS-lFr4G2WN.js +4132 -0
  53. package/dist/vue2/ganttDiagram-JELNMOA3-Bvtip7yn.js +3010 -0
  54. package/dist/vue2/gitGraph-F6HP7TQM-OQvD95bN.js +7 -0
  55. package/dist/vue2/gitGraphDiagram-NY62KEGX-Cjvy4fHM.js +634 -0
  56. package/dist/vue2/graphlib-KDKEjVHX.js +344 -0
  57. package/dist/vue2/index.es.min.js +26703 -786
  58. package/dist/vue2/index.umd.min.js +2796 -9
  59. package/dist/vue2/info-NVLQJR56-DBsOnIKy.js +7 -0
  60. package/dist/vue2/infoDiagram-WHAUD3N6-D_isj7oC.js +31 -0
  61. package/dist/vue2/init-hAkIK9Bd.js +13 -0
  62. package/dist/vue2/isEmpty-z27q3o-D.js +32 -0
  63. package/dist/vue2/journeyDiagram-XKPGCS4Q-DlXHMS3v.js +885 -0
  64. package/dist/vue2/kanban-definition-3W4ZIXB7-CV6572lv.js +971 -0
  65. package/dist/vue2/katex-CEAw-xiA.js +22097 -0
  66. package/dist/vue2/katex-D8o5-F7C.js +2 -0
  67. package/dist/vue2/line-wvheYP7S.js +30 -0
  68. package/dist/vue2/linear-STTevhnH.js +250 -0
  69. package/dist/vue2/math-DF_v6dOl.js +8 -0
  70. package/dist/vue2/mermaid-parser.core-VAa8Vi1g.js +48 -0
  71. package/dist/vue2/mermaid.core-vqI6KB9k.js +895 -0
  72. package/dist/vue2/mindmap-definition-VGOIOE7T-gtjvHqQ-.js +960 -0
  73. package/dist/vue2/ordinal-DOM6Fa9P.js +61 -0
  74. package/dist/vue2/packet-BFZMPI3H-CG049KmZ.js +7 -0
  75. package/dist/vue2/path-CW_-_Ti7.js +79 -0
  76. package/dist/vue2/pie-7BOR55EZ-BHq0KcLP.js +7 -0
  77. package/dist/vue2/pieDiagram-ADFJNKIX-CTUoM-kp.js +172 -0
  78. package/dist/vue2/purify.es-Cm_tUMzZ.js +547 -0
  79. package/dist/vue2/quadrantDiagram-AYHSOK5B-Njl7BMW7.js +1971 -0
  80. package/dist/vue2/radar-NHE76QYJ-CUoVtrAx.js +7 -0
  81. package/dist/vue2/reduce-BFKSG9Rs.js +451 -0
  82. package/dist/vue2/requirementDiagram-UZGBJVZJ-DKjE3cDK.js +2194 -0
  83. package/dist/vue2/sankeyDiagram-TZEHDZUN-DW2ap3zY.js +885 -0
  84. package/dist/vue2/sequenceDiagram-WL72ISMW-BjMq4OjH.js +3561 -0
  85. package/dist/vue2/src-VlKYSsxJ.js +1975 -0
  86. package/dist/vue2/stateDiagram-FKZM4ZOC-CnvtGM9U.js +224 -0
  87. package/dist/vue2/stateDiagram-v2-4FDKWEC3-C15xi-04.js +32 -0
  88. package/dist/vue2/style.css +1 -1
  89. package/dist/vue2/timeline-definition-IT6M3QCI-C7q6jdLA.js +831 -0
  90. package/dist/vue2/treemap-KMMF4GRG--FdijCcy.js +7 -0
  91. package/dist/vue2/xychartDiagram-PRI3JC2R-UcfQmj72.js +2022 -0
  92. package/dist/vue3/_baseFor-DAbrc8SN.js +309 -0
  93. package/dist/vue3/arc-BqlAOiZb.js +78 -0
  94. package/dist/vue3/architecture-U656AL7Q-Dtuq8BzO.js +7 -0
  95. package/dist/vue3/architectureDiagram-VXUJARFQ-BQS5Ixrn.js +4052 -0
  96. package/dist/vue3/array-TB8zN_HT.js +5 -0
  97. package/dist/vue3/blockDiagram-VD42YOAC-Bp6L6c6e.js +3013 -0
  98. package/dist/vue3/c4Diagram-YG6GDRKO-B15ZDn3Z.js +2956 -0
  99. package/dist/vue3/channel-edTl5mpN.js +3 -0
  100. package/dist/vue3/chunk-4BX2VUAB-eAYYj1bL.js +6 -0
  101. package/dist/vue3/chunk-55IACEB6-CTzuTcHv.js +6 -0
  102. package/dist/vue3/chunk-76Q3JFCE-BrJX66ha.js +19 -0
  103. package/dist/vue3/chunk-ABZYJK2D-gsx40GnJ.js +1971 -0
  104. package/dist/vue3/chunk-ATLVNIR6-CTTwtx-5.js +65 -0
  105. package/dist/vue3/chunk-B4BG7PRW-D8o7VxRH.js +3108 -0
  106. package/dist/vue3/chunk-CVBHYZKI-Cs8lCw3u.js +10 -0
  107. package/dist/vue3/chunk-DI55MBZ5-Dl59YBtR.js +1994 -0
  108. package/dist/vue3/chunk-DNh5sLlG.js +18 -0
  109. package/dist/vue3/chunk-EXTU4WIE-BPc8ye_N.js +7 -0
  110. package/dist/vue3/chunk-FMBD7UC4-PFlLPz_s.js +3 -0
  111. package/dist/vue3/chunk-FPAJGGOC-DPvjUKQ8.js +13428 -0
  112. package/dist/vue3/chunk-FWNWRKHM-BlUTFsPK.js +56 -0
  113. package/dist/vue3/chunk-HN2XXSSU-DueSY85P.js +74 -0
  114. package/dist/vue3/chunk-JA3XYJ7Z-CRet4f6a.js +1845 -0
  115. package/dist/vue3/chunk-JZLCHNYA-Df0-MseJ.js +4861 -0
  116. package/dist/vue3/chunk-LBM3YZW2-B0-w2HZs.js +19 -0
  117. package/dist/vue3/chunk-LHMN2FUI-BOH3yE2u.js +19 -0
  118. package/dist/vue3/chunk-MI3HLSF2-6-T1J0MS.js +1140 -0
  119. package/dist/vue3/chunk-N4CR4FBY-jNnt5D3v.js +39 -0
  120. package/dist/vue3/chunk-O7ZBX7Z2-BEP34BEE.js +26 -0
  121. package/dist/vue3/chunk-QN33PNHL-DsC-XeM9.js +23 -0
  122. package/dist/vue3/chunk-QXUST7PY-DxFRymyS.js +486 -0
  123. package/dist/vue3/chunk-QZHKN3VN-D9B5jQvg.js +11 -0
  124. package/dist/vue3/chunk-S3R3BYOJ-Bs_r55Kk.js +1222 -0
  125. package/dist/vue3/chunk-S6J4BHB3-XXfWHJvh.js +19 -0
  126. package/dist/vue3/chunk-T53DSG4Q-CNvqP6Iy.js +24 -0
  127. package/dist/vue3/chunk-TZMSLE5B-C5ccYWGN.js +55 -0
  128. package/dist/vue3/chunk-XAJISQIX-XsDvU4jW.js +135 -0
  129. package/dist/vue3/classDiagram-2ON5EDUG-Cgf9yVXj.js +33 -0
  130. package/dist/vue3/classDiagram-v2-WZHVMYZB-BtF1_0UK.js +33 -0
  131. package/dist/vue3/clone-Bbr3WSpg.js +7 -0
  132. package/dist/vue3/cose-bilkent-S5V4N54A-Cmf6WLkk.js +2250 -0
  133. package/dist/vue3/cytoscape.esm-nrcriBSO.js +18100 -0
  134. package/dist/vue3/dagre-6UL2VRFP-CTl_U96l.js +298 -0
  135. package/dist/vue3/dagre-DUjlMe_B.js +1496 -0
  136. package/dist/vue3/defaultLocale-BLATqOV5.js +177 -0
  137. package/dist/vue3/diagram-PSM6KHXK-Bl7brR-1.js +497 -0
  138. package/dist/vue3/diagram-QEK2KX5R-CAeywSxy.js +226 -0
  139. package/dist/vue3/diagram-S2PKOQOG-6I6J4WRC.js +144 -0
  140. package/dist/vue3/dist-xWJvauxf.js +49 -0
  141. package/dist/vue3/erDiagram-Q2GNP2WA-C8EbfuTj.js +1603 -0
  142. package/dist/vue3/flatten-CfPhNHUL.js +34 -0
  143. package/dist/vue3/flowDiagram-NV44I4VS-lFr4G2WN.js +4132 -0
  144. package/dist/vue3/ganttDiagram-JELNMOA3-Bvtip7yn.js +3010 -0
  145. package/dist/vue3/gitGraph-F6HP7TQM-OQvD95bN.js +7 -0
  146. package/dist/vue3/gitGraphDiagram-NY62KEGX-Cjvy4fHM.js +634 -0
  147. package/dist/vue3/graphlib-KDKEjVHX.js +344 -0
  148. package/dist/vue3/index.es.min.js +26730 -813
  149. package/dist/vue3/index.umd.min.js +2796 -9
  150. package/dist/vue3/info-NVLQJR56-DBsOnIKy.js +7 -0
  151. package/dist/vue3/infoDiagram-WHAUD3N6-D_isj7oC.js +31 -0
  152. package/dist/vue3/init-hAkIK9Bd.js +13 -0
  153. package/dist/vue3/isEmpty-z27q3o-D.js +32 -0
  154. package/dist/vue3/journeyDiagram-XKPGCS4Q-DlXHMS3v.js +885 -0
  155. package/dist/vue3/kanban-definition-3W4ZIXB7-CV6572lv.js +971 -0
  156. package/dist/vue3/katex-CEAw-xiA.js +22097 -0
  157. package/dist/vue3/katex-D8o5-F7C.js +2 -0
  158. package/dist/vue3/line-wvheYP7S.js +30 -0
  159. package/dist/vue3/linear-STTevhnH.js +250 -0
  160. package/dist/vue3/math-DF_v6dOl.js +8 -0
  161. package/dist/vue3/mermaid-parser.core-VAa8Vi1g.js +48 -0
  162. package/dist/vue3/mermaid.core-vqI6KB9k.js +895 -0
  163. package/dist/vue3/mindmap-definition-VGOIOE7T-gtjvHqQ-.js +960 -0
  164. package/dist/vue3/ordinal-DOM6Fa9P.js +61 -0
  165. package/dist/vue3/packet-BFZMPI3H-CG049KmZ.js +7 -0
  166. package/dist/vue3/path-CW_-_Ti7.js +79 -0
  167. package/dist/vue3/pie-7BOR55EZ-BHq0KcLP.js +7 -0
  168. package/dist/vue3/pieDiagram-ADFJNKIX-CTUoM-kp.js +172 -0
  169. package/dist/vue3/purify.es-Cm_tUMzZ.js +547 -0
  170. package/dist/vue3/quadrantDiagram-AYHSOK5B-Njl7BMW7.js +1971 -0
  171. package/dist/vue3/radar-NHE76QYJ-CUoVtrAx.js +7 -0
  172. package/dist/vue3/reduce-BFKSG9Rs.js +451 -0
  173. package/dist/vue3/requirementDiagram-UZGBJVZJ-DKjE3cDK.js +2194 -0
  174. package/dist/vue3/sankeyDiagram-TZEHDZUN-DW2ap3zY.js +885 -0
  175. package/dist/vue3/sequenceDiagram-WL72ISMW-BjMq4OjH.js +3561 -0
  176. package/dist/vue3/src-VlKYSsxJ.js +1975 -0
  177. package/dist/vue3/stateDiagram-FKZM4ZOC-CnvtGM9U.js +224 -0
  178. package/dist/vue3/stateDiagram-v2-4FDKWEC3-C15xi-04.js +32 -0
  179. package/dist/vue3/style.css +1 -1
  180. package/dist/vue3/timeline-definition-IT6M3QCI-C7q6jdLA.js +831 -0
  181. package/dist/vue3/treemap-KMMF4GRG--FdijCcy.js +7 -0
  182. package/dist/vue3/xychartDiagram-PRI3JC2R-UcfQmj72.js +2022 -0
  183. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ import "./chunk-FPAJGGOC-DPvjUKQ8.js";
2
+ import "./reduce-BFKSG9Rs.js";
3
+ import "./_baseFor-DAbrc8SN.js";
4
+ import "./isEmpty-z27q3o-D.js";
5
+ import "./flatten-CfPhNHUL.js";
6
+ import { n as createGitGraphServices, t as GitGraphModule } from "./chunk-S6J4BHB3-XXfWHJvh.js";
7
+ export { createGitGraphServices };
@@ -0,0 +1,634 @@
1
+ import "./purify.es-Cm_tUMzZ.js";
2
+ import "./chunk-FPAJGGOC-DPvjUKQ8.js";
3
+ import "./reduce-BFKSG9Rs.js";
4
+ import "./_baseFor-DAbrc8SN.js";
5
+ import "./isEmpty-z27q3o-D.js";
6
+ import "./flatten-CfPhNHUL.js";
7
+ import "./chunk-O7ZBX7Z2-BEP34BEE.js";
8
+ import "./chunk-S6J4BHB3-XXfWHJvh.js";
9
+ import "./chunk-LBM3YZW2-B0-w2HZs.js";
10
+ import "./chunk-76Q3JFCE-BrJX66ha.js";
11
+ import "./chunk-T53DSG4Q-CNvqP6Iy.js";
12
+ import "./chunk-LHMN2FUI-BOH3yE2u.js";
13
+ import "./chunk-FWNWRKHM-BlUTFsPK.js";
14
+ import { g as log, h as __name, p as select_default } from "./src-VlKYSsxJ.js";
15
+ import { B as setAccTitle, C as getDiagramTitle, K as setupGraphViewbox2, U as setDiagramTitle, _ as getAccDescription, a as clear, b as getConfig2, d as defaultConfig_default, s as common_default, v as getAccTitle, y as getConfig, z as setAccDescription } from "./chunk-ABZYJK2D-gsx40GnJ.js";
16
+ import "./math-DF_v6dOl.js";
17
+ import { g as utils_default, i as cleanAndMerge, m as random } from "./chunk-S3R3BYOJ-Bs_r55Kk.js";
18
+ import "./dist-xWJvauxf.js";
19
+ import { t as populateCommonDb } from "./chunk-4BX2VUAB-eAYYj1bL.js";
20
+ import { t as parse } from "./mermaid-parser.core-VAa8Vi1g.js";
21
+ import { t as ImperativeState } from "./chunk-QZHKN3VN-D9B5jQvg.js";
22
+ var commitType = {
23
+ NORMAL: 0,
24
+ REVERSE: 1,
25
+ HIGHLIGHT: 2,
26
+ MERGE: 3,
27
+ CHERRY_PICK: 4
28
+ }, DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph, getConfig3 = /* @__PURE__ */ __name(() => cleanAndMerge({
29
+ ...DEFAULT_GITGRAPH_CONFIG,
30
+ ...getConfig().gitGraph
31
+ }), "getConfig"), state = new ImperativeState(() => {
32
+ let f = getConfig3(), V = f.mainBranchName, H = f.mainBranchOrder;
33
+ return {
34
+ mainBranchName: V,
35
+ commits: /* @__PURE__ */ new Map(),
36
+ head: null,
37
+ branchConfig: /* @__PURE__ */ new Map([[V, {
38
+ name: V,
39
+ order: H
40
+ }]]),
41
+ branches: /* @__PURE__ */ new Map([[V, null]]),
42
+ currBranch: V,
43
+ direction: "LR",
44
+ seq: 0,
45
+ options: {}
46
+ };
47
+ });
48
+ function getID() {
49
+ return random({ length: 7 });
50
+ }
51
+ __name(getID, "getID");
52
+ function uniqBy(f, V) {
53
+ let H = /* @__PURE__ */ Object.create(null);
54
+ return f.reduce((f, U) => {
55
+ let W = V(U);
56
+ return H[W] || (H[W] = !0, f.push(U)), f;
57
+ }, []);
58
+ }
59
+ __name(uniqBy, "uniqBy");
60
+ var setDirection = /* @__PURE__ */ __name(function(f) {
61
+ state.records.direction = f;
62
+ }, "setDirection"), setOptions = /* @__PURE__ */ __name(function(V) {
63
+ log.debug("options str", V), V = V?.trim(), V ||= "{}";
64
+ try {
65
+ state.records.options = JSON.parse(V);
66
+ } catch (V) {
67
+ log.error("error while parsing gitGraph options", V.message);
68
+ }
69
+ }, "setOptions"), getOptions = /* @__PURE__ */ __name(function() {
70
+ return state.records.options;
71
+ }, "getOptions"), commit = /* @__PURE__ */ __name(function(V) {
72
+ let H = V.msg, U = V.id, W = V.type, G = V.tags;
73
+ log.info("commit", H, U, W, G), log.debug("Entering commit:", H, U, W, G);
74
+ let K = getConfig3();
75
+ U = common_default.sanitizeText(U, K), H = common_default.sanitizeText(H, K), G = G?.map((f) => common_default.sanitizeText(f, K));
76
+ let q = {
77
+ id: U || state.records.seq + "-" + getID(),
78
+ message: H,
79
+ seq: state.records.seq++,
80
+ type: W ?? commitType.NORMAL,
81
+ tags: G ?? [],
82
+ parents: state.records.head == null ? [] : [state.records.head.id],
83
+ branch: state.records.currBranch
84
+ };
85
+ state.records.head = q, log.info("main branch", K.mainBranchName), state.records.commits.has(q.id) && log.warn(`Commit ID ${q.id} already exists`), state.records.commits.set(q.id, q), state.records.branches.set(state.records.currBranch, q.id), log.debug("in pushCommit " + q.id);
86
+ }, "commit"), branch = /* @__PURE__ */ __name(function(V) {
87
+ let H = V.name, U = V.order;
88
+ if (H = common_default.sanitizeText(H, getConfig3()), state.records.branches.has(H)) throw Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${H}")`);
89
+ state.records.branches.set(H, state.records.head == null ? null : state.records.head.id), state.records.branchConfig.set(H, {
90
+ name: H,
91
+ order: U
92
+ }), checkout(H), log.debug("in createBranch");
93
+ }, "branch"), merge = /* @__PURE__ */ __name((V) => {
94
+ let H = V.branch, U = V.id, W = V.type, G = V.tags, K = getConfig3();
95
+ H = common_default.sanitizeText(H, K), U &&= common_default.sanitizeText(U, K);
96
+ let q = state.records.branches.get(state.records.currBranch), J = state.records.branches.get(H), Y = q ? state.records.commits.get(q) : void 0, X = J ? state.records.commits.get(J) : void 0;
97
+ if (Y && X && Y.branch === H) throw Error(`Cannot merge branch '${H}' into itself.`);
98
+ if (state.records.currBranch === H) {
99
+ let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Cannot merge a branch to itself");
100
+ throw f.hash = {
101
+ text: `merge ${H}`,
102
+ token: `merge ${H}`,
103
+ expected: ["branch abc"]
104
+ }, f;
105
+ }
106
+ if (Y === void 0 || !Y) {
107
+ let f = /* @__PURE__ */ Error(`Incorrect usage of "merge". Current branch (${state.records.currBranch})has no commits`);
108
+ throw f.hash = {
109
+ text: `merge ${H}`,
110
+ token: `merge ${H}`,
111
+ expected: ["commit"]
112
+ }, f;
113
+ }
114
+ if (!state.records.branches.has(H)) {
115
+ let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Branch to be merged (" + H + ") does not exist");
116
+ throw f.hash = {
117
+ text: `merge ${H}`,
118
+ token: `merge ${H}`,
119
+ expected: [`branch ${H}`]
120
+ }, f;
121
+ }
122
+ if (X === void 0 || !X) {
123
+ let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Branch to be merged (" + H + ") has no commits");
124
+ throw f.hash = {
125
+ text: `merge ${H}`,
126
+ token: `merge ${H}`,
127
+ expected: ["\"commit\""]
128
+ }, f;
129
+ }
130
+ if (Y === X) {
131
+ let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Both branches have same head");
132
+ throw f.hash = {
133
+ text: `merge ${H}`,
134
+ token: `merge ${H}`,
135
+ expected: ["branch abc"]
136
+ }, f;
137
+ }
138
+ if (U && state.records.commits.has(U)) {
139
+ let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Commit with id:" + U + " already exists, use different custom id");
140
+ throw f.hash = {
141
+ text: `merge ${H} ${U} ${W} ${G?.join(" ")}`,
142
+ token: `merge ${H} ${U} ${W} ${G?.join(" ")}`,
143
+ expected: [`merge ${H} ${U}_UNIQUE ${W} ${G?.join(" ")}`]
144
+ }, f;
145
+ }
146
+ let Q = J || "", $ = {
147
+ id: U || `${state.records.seq}-${getID()}`,
148
+ message: `merged branch ${H} into ${state.records.currBranch}`,
149
+ seq: state.records.seq++,
150
+ parents: state.records.head == null ? [] : [state.records.head.id, Q],
151
+ branch: state.records.currBranch,
152
+ type: commitType.MERGE,
153
+ customType: W,
154
+ customId: !!U,
155
+ tags: G ?? []
156
+ };
157
+ state.records.head = $, state.records.commits.set($.id, $), state.records.branches.set(state.records.currBranch, $.id), log.debug(state.records.branches), log.debug("in mergeBranch");
158
+ }, "merge"), cherryPick = /* @__PURE__ */ __name(function(V) {
159
+ let H = V.id, U = V.targetId, W = V.tags, G = V.parent;
160
+ log.debug("Entering cherryPick:", H, U, W);
161
+ let K = getConfig3();
162
+ if (H = common_default.sanitizeText(H, K), U = common_default.sanitizeText(U, K), W = W?.map((f) => common_default.sanitizeText(f, K)), G = common_default.sanitizeText(G, K), !H || !state.records.commits.has(H)) {
163
+ let f = /* @__PURE__ */ Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
164
+ throw f.hash = {
165
+ text: `cherryPick ${H} ${U}`,
166
+ token: `cherryPick ${H} ${U}`,
167
+ expected: ["cherry-pick abc"]
168
+ }, f;
169
+ }
170
+ let q = state.records.commits.get(H);
171
+ if (q === void 0 || !q) throw Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
172
+ if (G && !(Array.isArray(q.parents) && q.parents.includes(G))) throw /* @__PURE__ */ Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");
173
+ let J = q.branch;
174
+ if (q.type === commitType.MERGE && !G) throw /* @__PURE__ */ Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");
175
+ if (!U || !state.records.commits.has(U)) {
176
+ if (J === state.records.currBranch) {
177
+ let f = /* @__PURE__ */ Error("Incorrect usage of \"cherryPick\". Source commit is already on current branch");
178
+ throw f.hash = {
179
+ text: `cherryPick ${H} ${U}`,
180
+ token: `cherryPick ${H} ${U}`,
181
+ expected: ["cherry-pick abc"]
182
+ }, f;
183
+ }
184
+ let V = state.records.branches.get(state.records.currBranch);
185
+ if (V === void 0 || !V) {
186
+ let f = /* @__PURE__ */ Error(`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`);
187
+ throw f.hash = {
188
+ text: `cherryPick ${H} ${U}`,
189
+ token: `cherryPick ${H} ${U}`,
190
+ expected: ["cherry-pick abc"]
191
+ }, f;
192
+ }
193
+ let K = state.records.commits.get(V);
194
+ if (K === void 0 || !K) {
195
+ let f = /* @__PURE__ */ Error(`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`);
196
+ throw f.hash = {
197
+ text: `cherryPick ${H} ${U}`,
198
+ token: `cherryPick ${H} ${U}`,
199
+ expected: ["cherry-pick abc"]
200
+ }, f;
201
+ }
202
+ let Y = {
203
+ id: state.records.seq + "-" + getID(),
204
+ message: `cherry-picked ${q?.message} into ${state.records.currBranch}`,
205
+ seq: state.records.seq++,
206
+ parents: state.records.head == null ? [] : [state.records.head.id, q.id],
207
+ branch: state.records.currBranch,
208
+ type: commitType.CHERRY_PICK,
209
+ tags: W ? W.filter(Boolean) : [`cherry-pick:${q.id}${q.type === commitType.MERGE ? `|parent:${G}` : ""}`]
210
+ };
211
+ state.records.head = Y, state.records.commits.set(Y.id, Y), state.records.branches.set(state.records.currBranch, Y.id), log.debug(state.records.branches), log.debug("in cherryPick");
212
+ }
213
+ }, "cherryPick"), checkout = /* @__PURE__ */ __name(function(f) {
214
+ if (f = common_default.sanitizeText(f, getConfig3()), state.records.branches.has(f)) {
215
+ state.records.currBranch = f;
216
+ let V = state.records.branches.get(state.records.currBranch);
217
+ V === void 0 || !V ? state.records.head = null : state.records.head = state.records.commits.get(V) ?? null;
218
+ } else {
219
+ let V = /* @__PURE__ */ Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${f}")`);
220
+ throw V.hash = {
221
+ text: `checkout ${f}`,
222
+ token: `checkout ${f}`,
223
+ expected: [`branch ${f}`]
224
+ }, V;
225
+ }
226
+ }, "checkout");
227
+ function upsert(f, V, H) {
228
+ let U = f.indexOf(V);
229
+ U === -1 ? f.push(H) : f.splice(U, 1, H);
230
+ }
231
+ __name(upsert, "upsert");
232
+ function prettyPrintCommitHistory(V) {
233
+ let H = V.reduce((f, V) => f.seq > V.seq ? f : V, V[0]), U = "";
234
+ V.forEach(function(f) {
235
+ f === H ? U += " *" : U += " |";
236
+ });
237
+ let W = [
238
+ U,
239
+ H.id,
240
+ H.seq
241
+ ];
242
+ for (let f in state.records.branches) state.records.branches.get(f) === H.id && W.push(f);
243
+ if (log.debug(W.join(" ")), H.parents && H.parents.length == 2 && H.parents[0] && H.parents[1]) {
244
+ let f = state.records.commits.get(H.parents[0]);
245
+ upsert(V, H, f), H.parents[1] && V.push(state.records.commits.get(H.parents[1]));
246
+ } else if (H.parents.length == 0) return;
247
+ else if (H.parents[0]) {
248
+ let f = state.records.commits.get(H.parents[0]);
249
+ upsert(V, H, f);
250
+ }
251
+ V = uniqBy(V, (f) => f.id), prettyPrintCommitHistory(V);
252
+ }
253
+ __name(prettyPrintCommitHistory, "prettyPrintCommitHistory");
254
+ var prettyPrint = /* @__PURE__ */ __name(function() {
255
+ log.debug(state.records.commits);
256
+ let V = getCommitsArray()[0];
257
+ prettyPrintCommitHistory([V]);
258
+ }, "prettyPrint"), clear2 = /* @__PURE__ */ __name(function() {
259
+ state.reset(), clear();
260
+ }, "clear"), getBranchesAsObjArray = /* @__PURE__ */ __name(function() {
261
+ return [...state.records.branchConfig.values()].map((f, V) => f.order !== null && f.order !== void 0 ? f : {
262
+ ...f,
263
+ order: parseFloat(`0.${V}`)
264
+ }).sort((f, V) => (f.order ?? 0) - (V.order ?? 0)).map(({ name: f }) => ({ name: f }));
265
+ }, "getBranchesAsObjArray"), getBranches = /* @__PURE__ */ __name(function() {
266
+ return state.records.branches;
267
+ }, "getBranches"), getCommits = /* @__PURE__ */ __name(function() {
268
+ return state.records.commits;
269
+ }, "getCommits"), getCommitsArray = /* @__PURE__ */ __name(function() {
270
+ let V = [...state.records.commits.values()];
271
+ return V.forEach(function(V) {
272
+ log.debug(V.id);
273
+ }), V.sort((f, V) => f.seq - V.seq), V;
274
+ }, "getCommitsArray"), db = {
275
+ commitType,
276
+ getConfig: getConfig3,
277
+ setDirection,
278
+ setOptions,
279
+ getOptions,
280
+ commit,
281
+ branch,
282
+ merge,
283
+ cherryPick,
284
+ checkout,
285
+ prettyPrint,
286
+ clear: clear2,
287
+ getBranchesAsObjArray,
288
+ getBranches,
289
+ getCommits,
290
+ getCommitsArray,
291
+ getCurrentBranch: /* @__PURE__ */ __name(function() {
292
+ return state.records.currBranch;
293
+ }, "getCurrentBranch"),
294
+ getDirection: /* @__PURE__ */ __name(function() {
295
+ return state.records.direction;
296
+ }, "getDirection"),
297
+ getHead: /* @__PURE__ */ __name(function() {
298
+ return state.records.head;
299
+ }, "getHead"),
300
+ setAccTitle,
301
+ getAccTitle,
302
+ getAccDescription,
303
+ setAccDescription,
304
+ setDiagramTitle,
305
+ getDiagramTitle
306
+ }, populate = /* @__PURE__ */ __name((f, V) => {
307
+ populateCommonDb(f, V), f.dir && V.setDirection(f.dir);
308
+ for (let H of f.statements) parseStatement(H, V);
309
+ }, "populate"), parseStatement = /* @__PURE__ */ __name((H, U) => {
310
+ let W = {
311
+ Commit: /* @__PURE__ */ __name((f) => U.commit(parseCommit(f)), "Commit"),
312
+ Branch: /* @__PURE__ */ __name((f) => U.branch(parseBranch(f)), "Branch"),
313
+ Merge: /* @__PURE__ */ __name((f) => U.merge(parseMerge(f)), "Merge"),
314
+ Checkout: /* @__PURE__ */ __name((f) => U.checkout(parseCheckout(f)), "Checkout"),
315
+ CherryPicking: /* @__PURE__ */ __name((f) => U.cherryPick(parseCherryPicking(f)), "CherryPicking")
316
+ }[H.$type];
317
+ W ? W(H) : log.error(`Unknown statement type: ${H.$type}`);
318
+ }, "parseStatement"), parseCommit = /* @__PURE__ */ __name((f) => ({
319
+ id: f.id,
320
+ msg: f.message ?? "",
321
+ type: f.type === void 0 ? commitType.NORMAL : commitType[f.type],
322
+ tags: f.tags ?? void 0
323
+ }), "parseCommit"), parseBranch = /* @__PURE__ */ __name((f) => ({
324
+ name: f.name,
325
+ order: f.order ?? 0
326
+ }), "parseBranch"), parseMerge = /* @__PURE__ */ __name((f) => ({
327
+ branch: f.branch,
328
+ id: f.id ?? "",
329
+ type: f.type === void 0 ? void 0 : commitType[f.type],
330
+ tags: f.tags ?? void 0
331
+ }), "parseMerge"), parseCheckout = /* @__PURE__ */ __name((f) => f.branch, "parseCheckout"), parseCherryPicking = /* @__PURE__ */ __name((f) => ({
332
+ id: f.id,
333
+ targetId: "",
334
+ tags: f.tags?.length === 0 ? void 0 : f.tags,
335
+ parent: f.parent
336
+ }), "parseCherryPicking"), parser = { parse: /* @__PURE__ */ __name(async (V) => {
337
+ let H = await parse("gitGraph", V);
338
+ log.debug(H), populate(H, db);
339
+ }, "parse") }, DEFAULT_GITGRAPH_CONFIG2 = getConfig2()?.gitGraph, LAYOUT_OFFSET = 10, COMMIT_STEP = 40, PX = 4, PY = 2, THEME_COLOR_LIMIT = 8, branchPos = /* @__PURE__ */ new Map(), commitPos = /* @__PURE__ */ new Map(), defaultPos = 30, allCommitsDict = /* @__PURE__ */ new Map(), lanes = [], maxPos = 0, dir = "LR", clear3 = /* @__PURE__ */ __name(() => {
340
+ branchPos.clear(), commitPos.clear(), allCommitsDict.clear(), maxPos = 0, lanes = [], dir = "LR";
341
+ }, "clear"), drawText = /* @__PURE__ */ __name((f) => {
342
+ let V = document.createElementNS("http://www.w3.org/2000/svg", "text");
343
+ return (typeof f == "string" ? f.split(/\\n|\n|<br\s*\/?>/gi) : f).forEach((f) => {
344
+ let H = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
345
+ H.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), H.setAttribute("dy", "1em"), H.setAttribute("x", "0"), H.setAttribute("class", "row"), H.textContent = f.trim(), V.appendChild(H);
346
+ }), V;
347
+ }, "drawText"), findClosestParent = /* @__PURE__ */ __name((f) => {
348
+ let H, U, W;
349
+ return dir === "BT" ? (U = /* @__PURE__ */ __name((f, V) => f <= V, "comparisonFunc"), W = Infinity) : (U = /* @__PURE__ */ __name((f, V) => f >= V, "comparisonFunc"), W = 0), f.forEach((f) => {
350
+ let V = dir === "TB" || dir == "BT" ? commitPos.get(f)?.y : commitPos.get(f)?.x;
351
+ V !== void 0 && U(V, W) && (H = f, W = V);
352
+ }), H;
353
+ }, "findClosestParent"), findClosestParentBT = /* @__PURE__ */ __name((f) => {
354
+ let V = "", H = Infinity;
355
+ return f.forEach((f) => {
356
+ let U = commitPos.get(f).y;
357
+ U <= H && (V = f, H = U);
358
+ }), V || void 0;
359
+ }, "findClosestParentBT"), setParallelBTPos = /* @__PURE__ */ __name((f, V, H) => {
360
+ let U = H, W = H, G = [];
361
+ f.forEach((f) => {
362
+ let H = V.get(f);
363
+ if (!H) throw Error(`Commit not found for key ${f}`);
364
+ H.parents.length ? (U = calculateCommitPosition(H), W = Math.max(U, W)) : G.push(H), setCommitPosition(H, U);
365
+ }), U = W, G.forEach((f) => {
366
+ setRootPosition(f, U, H);
367
+ }), f.forEach((f) => {
368
+ let H = V.get(f);
369
+ if (H?.parents.length) {
370
+ let f = findClosestParentBT(H.parents);
371
+ U = commitPos.get(f).y - COMMIT_STEP, U <= W && (W = U);
372
+ let V = branchPos.get(H.branch).pos, G = U - LAYOUT_OFFSET;
373
+ commitPos.set(H.id, {
374
+ x: V,
375
+ y: G
376
+ });
377
+ }
378
+ });
379
+ }, "setParallelBTPos"), findClosestParentPos = /* @__PURE__ */ __name((f) => {
380
+ let V = findClosestParent(f.parents.filter((f) => f !== null));
381
+ if (!V) throw Error(`Closest parent not found for commit ${f.id}`);
382
+ let H = commitPos.get(V)?.y;
383
+ if (H === void 0) throw Error(`Closest parent position not found for commit ${f.id}`);
384
+ return H;
385
+ }, "findClosestParentPos"), calculateCommitPosition = /* @__PURE__ */ __name((f) => findClosestParentPos(f) + COMMIT_STEP, "calculateCommitPosition"), setCommitPosition = /* @__PURE__ */ __name((f, V) => {
386
+ let H = branchPos.get(f.branch);
387
+ if (!H) throw Error(`Branch not found for commit ${f.id}`);
388
+ let U = H.pos, W = V + LAYOUT_OFFSET;
389
+ return commitPos.set(f.id, {
390
+ x: U,
391
+ y: W
392
+ }), {
393
+ x: U,
394
+ y: W
395
+ };
396
+ }, "setCommitPosition"), setRootPosition = /* @__PURE__ */ __name((f, V, H) => {
397
+ let U = branchPos.get(f.branch);
398
+ if (!U) throw Error(`Branch not found for commit ${f.id}`);
399
+ let W = V + H, G = U.pos;
400
+ commitPos.set(f.id, {
401
+ x: G,
402
+ y: W
403
+ });
404
+ }, "setRootPosition"), drawCommitBullet = /* @__PURE__ */ __name((f, V, H, U, W, G) => {
405
+ if (G === commitType.HIGHLIGHT) f.append("rect").attr("x", H.x - 10).attr("y", H.y - 10).attr("width", 20).attr("height", 20).attr("class", `commit ${V.id} commit-highlight${W % THEME_COLOR_LIMIT} ${U}-outer`), f.append("rect").attr("x", H.x - 6).attr("y", H.y - 6).attr("width", 12).attr("height", 12).attr("class", `commit ${V.id} commit${W % THEME_COLOR_LIMIT} ${U}-inner`);
406
+ else if (G === commitType.CHERRY_PICK) f.append("circle").attr("cx", H.x).attr("cy", H.y).attr("r", 10).attr("class", `commit ${V.id} ${U}`), f.append("circle").attr("cx", H.x - 3).attr("cy", H.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${V.id} ${U}`), f.append("circle").attr("cx", H.x + 3).attr("cy", H.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${V.id} ${U}`), f.append("line").attr("x1", H.x + 3).attr("y1", H.y + 1).attr("x2", H.x).attr("y2", H.y - 5).attr("stroke", "#fff").attr("class", `commit ${V.id} ${U}`), f.append("line").attr("x1", H.x - 3).attr("y1", H.y + 1).attr("x2", H.x).attr("y2", H.y - 5).attr("stroke", "#fff").attr("class", `commit ${V.id} ${U}`);
407
+ else {
408
+ let K = f.append("circle");
409
+ if (K.attr("cx", H.x), K.attr("cy", H.y), K.attr("r", V.type === commitType.MERGE ? 9 : 10), K.attr("class", `commit ${V.id} commit${W % THEME_COLOR_LIMIT}`), G === commitType.MERGE) {
410
+ let G = f.append("circle");
411
+ G.attr("cx", H.x), G.attr("cy", H.y), G.attr("r", 6), G.attr("class", `commit ${U} ${V.id} commit${W % THEME_COLOR_LIMIT}`);
412
+ }
413
+ G === commitType.REVERSE && f.append("path").attr("d", `M ${H.x - 5},${H.y - 5}L${H.x + 5},${H.y + 5}M${H.x - 5},${H.y + 5}L${H.x + 5},${H.y - 5}`).attr("class", `commit ${U} ${V.id} commit${W % THEME_COLOR_LIMIT}`);
414
+ }
415
+ }, "drawCommitBullet"), drawCommitLabel = /* @__PURE__ */ __name((f, V, H, U) => {
416
+ if (V.type !== commitType.CHERRY_PICK && (V.customId && V.type === commitType.MERGE || V.type !== commitType.MERGE) && DEFAULT_GITGRAPH_CONFIG2?.showCommitLabel) {
417
+ let W = f.append("g"), G = W.insert("rect").attr("class", "commit-label-bkg"), K = W.append("text").attr("x", U).attr("y", H.y + 25).attr("class", "commit-label").text(V.id), q = K.node()?.getBBox();
418
+ if (q && (G.attr("x", H.posWithOffset - q.width / 2 - PY).attr("y", H.y + 13.5).attr("width", q.width + 2 * PY).attr("height", q.height + 2 * PY), dir === "TB" || dir === "BT" ? (G.attr("x", H.x - (q.width + 4 * PX + 5)).attr("y", H.y - 12), K.attr("x", H.x - (q.width + 4 * PX)).attr("y", H.y + q.height - 12)) : K.attr("x", H.posWithOffset - q.width / 2), DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel)) if (dir === "TB" || dir === "BT") K.attr("transform", "rotate(-45, " + H.x + ", " + H.y + ")"), G.attr("transform", "rotate(-45, " + H.x + ", " + H.y + ")");
419
+ else {
420
+ let f = -7.5 - (q.width + 10) / 25 * 9.5, V = 10 + q.width / 25 * 8.5;
421
+ W.attr("transform", "translate(" + f + ", " + V + ") rotate(-45, " + U + ", " + H.y + ")");
422
+ }
423
+ }
424
+ }, "drawCommitLabel"), drawCommitTags = /* @__PURE__ */ __name((f, V, H, U) => {
425
+ if (V.tags.length > 0) {
426
+ let W = 0, G = 0, K = 0, q = [];
427
+ for (let U of V.tags.reverse()) {
428
+ let V = f.insert("polygon"), J = f.append("circle"), Y = f.append("text").attr("y", H.y - 16 - W).attr("class", "tag-label").text(U), X = Y.node()?.getBBox();
429
+ if (!X) throw Error("Tag bbox not found");
430
+ G = Math.max(G, X.width), K = Math.max(K, X.height), Y.attr("x", H.posWithOffset - X.width / 2), q.push({
431
+ tag: Y,
432
+ hole: J,
433
+ rect: V,
434
+ yOffset: W
435
+ }), W += 20;
436
+ }
437
+ for (let { tag: f, hole: V, rect: W, yOffset: J } of q) {
438
+ let q = K / 2, Y = H.y - 19.2 - J;
439
+ if (W.attr("class", "tag-label-bkg").attr("points", `
440
+ ${U - G / 2 - PX / 2},${Y + PY}
441
+ ${U - G / 2 - PX / 2},${Y - PY}
442
+ ${H.posWithOffset - G / 2 - PX},${Y - q - PY}
443
+ ${H.posWithOffset + G / 2 + PX},${Y - q - PY}
444
+ ${H.posWithOffset + G / 2 + PX},${Y + q + PY}
445
+ ${H.posWithOffset - G / 2 - PX},${Y + q + PY}`), V.attr("cy", Y).attr("cx", U - G / 2 + PX / 2).attr("r", 1.5).attr("class", "tag-hole"), dir === "TB" || dir === "BT") {
446
+ let K = U + J;
447
+ W.attr("class", "tag-label-bkg").attr("points", `
448
+ ${H.x},${K + 2}
449
+ ${H.x},${K - 2}
450
+ ${H.x + LAYOUT_OFFSET},${K - q - 2}
451
+ ${H.x + LAYOUT_OFFSET + G + 4},${K - q - 2}
452
+ ${H.x + LAYOUT_OFFSET + G + 4},${K + q + 2}
453
+ ${H.x + LAYOUT_OFFSET},${K + q + 2}`).attr("transform", "translate(12,12) rotate(45, " + H.x + "," + U + ")"), V.attr("cx", H.x + PX / 2).attr("cy", K).attr("transform", "translate(12,12) rotate(45, " + H.x + "," + U + ")"), f.attr("x", H.x + 5).attr("y", K + 3).attr("transform", "translate(14,14) rotate(45, " + H.x + "," + U + ")");
454
+ }
455
+ }
456
+ }
457
+ }, "drawCommitTags"), getCommitClassType = /* @__PURE__ */ __name((f) => {
458
+ switch (f.customType ?? f.type) {
459
+ case commitType.NORMAL: return "commit-normal";
460
+ case commitType.REVERSE: return "commit-reverse";
461
+ case commitType.HIGHLIGHT: return "commit-highlight";
462
+ case commitType.MERGE: return "commit-merge";
463
+ case commitType.CHERRY_PICK: return "commit-cherry-pick";
464
+ default: return "commit-normal";
465
+ }
466
+ }, "getCommitClassType"), calculatePosition = /* @__PURE__ */ __name((f, V, H, U) => {
467
+ let W = {
468
+ x: 0,
469
+ y: 0
470
+ };
471
+ if (f.parents.length > 0) {
472
+ let H = findClosestParent(f.parents);
473
+ if (H) {
474
+ let G = U.get(H) ?? W;
475
+ return V === "TB" ? G.y + COMMIT_STEP : V === "BT" ? (U.get(f.id) ?? W).y - COMMIT_STEP : G.x + COMMIT_STEP;
476
+ }
477
+ } else if (V === "TB") return defaultPos;
478
+ else if (V === "BT") return (U.get(f.id) ?? W).y - COMMIT_STEP;
479
+ else return 0;
480
+ return 0;
481
+ }, "calculatePosition"), getCommitPosition = /* @__PURE__ */ __name((f, V, H) => {
482
+ let U = dir === "BT" && H ? V : V + LAYOUT_OFFSET, W = dir === "TB" || dir === "BT" ? U : branchPos.get(f.branch)?.pos, G = dir === "TB" || dir === "BT" ? branchPos.get(f.branch)?.pos : U;
483
+ if (G === void 0 || W === void 0) throw Error(`Position were undefined for commit ${f.id}`);
484
+ return {
485
+ x: G,
486
+ y: W,
487
+ posWithOffset: U
488
+ };
489
+ }, "getCommitPosition"), drawCommits = /* @__PURE__ */ __name((f, H, U) => {
490
+ if (!DEFAULT_GITGRAPH_CONFIG2) throw Error("GitGraph config not found");
491
+ let W = f.append("g").attr("class", "commit-bullets"), G = f.append("g").attr("class", "commit-labels"), K = dir === "TB" || dir === "BT" ? defaultPos : 0, q = [...H.keys()], J = DEFAULT_GITGRAPH_CONFIG2?.parallelCommits ?? !1, Y = /* @__PURE__ */ __name((f, V) => {
492
+ let U = H.get(f)?.seq, W = H.get(V)?.seq;
493
+ return U !== void 0 && W !== void 0 ? U - W : 0;
494
+ }, "sortKeys"), X = q.sort(Y);
495
+ dir === "BT" && (J && setParallelBTPos(X, H, K), X = X.reverse()), X.forEach((f) => {
496
+ let V = H.get(f);
497
+ if (!V) throw Error(`Commit not found for key ${f}`);
498
+ J && (K = calculatePosition(V, dir, K, commitPos));
499
+ let q = getCommitPosition(V, K, J);
500
+ if (U) {
501
+ let f = getCommitClassType(V), H = V.customType ?? V.type;
502
+ drawCommitBullet(W, V, q, f, branchPos.get(V.branch)?.index ?? 0, H), drawCommitLabel(G, V, q, K), drawCommitTags(G, V, q, K);
503
+ }
504
+ dir === "TB" || dir === "BT" ? commitPos.set(V.id, {
505
+ x: q.x,
506
+ y: q.posWithOffset
507
+ }) : commitPos.set(V.id, {
508
+ x: q.posWithOffset,
509
+ y: q.y
510
+ }), K = dir === "BT" && J ? K + COMMIT_STEP : K + COMMIT_STEP + LAYOUT_OFFSET, K > maxPos && (maxPos = K);
511
+ });
512
+ }, "drawCommits"), shouldRerouteArrow = /* @__PURE__ */ __name((f, H, U, W, G) => {
513
+ let K = (dir === "TB" || dir === "BT" ? U.x < W.x : U.y < W.y) ? H.branch : f.branch, q = /* @__PURE__ */ __name((f) => f.branch === K, "isOnBranchToGetCurve"), J = /* @__PURE__ */ __name((V) => V.seq > f.seq && V.seq < H.seq, "isBetweenCommits");
514
+ return [...G.values()].some((f) => J(f) && q(f));
515
+ }, "shouldRerouteArrow"), findLane = /* @__PURE__ */ __name((f, V, H = 0) => {
516
+ let U = f + Math.abs(f - V) / 2;
517
+ return H > 5 ? U : lanes.every((f) => Math.abs(f - U) >= 10) ? (lanes.push(U), U) : findLane(f, V - Math.abs(f - V) / 5, H + 1);
518
+ }, "findLane"), drawArrow = /* @__PURE__ */ __name((f, V, H, U) => {
519
+ let W = commitPos.get(V.id), G = commitPos.get(H.id);
520
+ if (W === void 0 || G === void 0) throw Error(`Commit positions not found for commits ${V.id} and ${H.id}`);
521
+ let K = shouldRerouteArrow(V, H, W, G, U), q = "", J = "", Y = 0, X = 0, Z = branchPos.get(H.branch)?.index;
522
+ H.type === commitType.MERGE && V.id !== H.parents[0] && (Z = branchPos.get(V.branch)?.index);
523
+ let Q;
524
+ if (K) {
525
+ q = "A 10 10, 0, 0, 0,", J = "A 10 10, 0, 0, 1,", Y = 10, X = 10;
526
+ let f = W.y < G.y ? findLane(W.y, G.y) : findLane(G.y, W.y), H = W.x < G.x ? findLane(W.x, G.x) : findLane(G.x, W.x);
527
+ dir === "TB" ? W.x < G.x ? Q = `M ${W.x} ${W.y} L ${H - Y} ${W.y} ${J} ${H} ${W.y + X} L ${H} ${G.y - Y} ${q} ${H + X} ${G.y} L ${G.x} ${G.y}` : (Z = branchPos.get(V.branch)?.index, Q = `M ${W.x} ${W.y} L ${H + Y} ${W.y} ${q} ${H} ${W.y + X} L ${H} ${G.y - Y} ${J} ${H - X} ${G.y} L ${G.x} ${G.y}`) : dir === "BT" ? W.x < G.x ? Q = `M ${W.x} ${W.y} L ${H - Y} ${W.y} ${q} ${H} ${W.y - X} L ${H} ${G.y + Y} ${J} ${H + X} ${G.y} L ${G.x} ${G.y}` : (Z = branchPos.get(V.branch)?.index, Q = `M ${W.x} ${W.y} L ${H + Y} ${W.y} ${J} ${H} ${W.y - X} L ${H} ${G.y + Y} ${q} ${H - X} ${G.y} L ${G.x} ${G.y}`) : W.y < G.y ? Q = `M ${W.x} ${W.y} L ${W.x} ${f - Y} ${q} ${W.x + X} ${f} L ${G.x - Y} ${f} ${J} ${G.x} ${f + X} L ${G.x} ${G.y}` : (Z = branchPos.get(V.branch)?.index, Q = `M ${W.x} ${W.y} L ${W.x} ${f + Y} ${J} ${W.x + X} ${f} L ${G.x - Y} ${f} ${q} ${G.x} ${f - X} L ${G.x} ${G.y}`);
528
+ } else q = "A 20 20, 0, 0, 0,", J = "A 20 20, 0, 0, 1,", Y = 20, X = 20, dir === "TB" ? (W.x < G.x && (Q = H.type === commitType.MERGE && V.id !== H.parents[0] ? `M ${W.x} ${W.y} L ${W.x} ${G.y - Y} ${q} ${W.x + X} ${G.y} L ${G.x} ${G.y}` : `M ${W.x} ${W.y} L ${G.x - Y} ${W.y} ${J} ${G.x} ${W.y + X} L ${G.x} ${G.y}`), W.x > G.x && (q = "A 20 20, 0, 0, 0,", J = "A 20 20, 0, 0, 1,", Y = 20, X = 20, Q = H.type === commitType.MERGE && V.id !== H.parents[0] ? `M ${W.x} ${W.y} L ${W.x} ${G.y - Y} ${J} ${W.x - X} ${G.y} L ${G.x} ${G.y}` : `M ${W.x} ${W.y} L ${G.x + Y} ${W.y} ${q} ${G.x} ${W.y + X} L ${G.x} ${G.y}`), W.x === G.x && (Q = `M ${W.x} ${W.y} L ${G.x} ${G.y}`)) : dir === "BT" ? (W.x < G.x && (Q = H.type === commitType.MERGE && V.id !== H.parents[0] ? `M ${W.x} ${W.y} L ${W.x} ${G.y + Y} ${J} ${W.x + X} ${G.y} L ${G.x} ${G.y}` : `M ${W.x} ${W.y} L ${G.x - Y} ${W.y} ${q} ${G.x} ${W.y - X} L ${G.x} ${G.y}`), W.x > G.x && (q = "A 20 20, 0, 0, 0,", J = "A 20 20, 0, 0, 1,", Y = 20, X = 20, Q = H.type === commitType.MERGE && V.id !== H.parents[0] ? `M ${W.x} ${W.y} L ${W.x} ${G.y + Y} ${q} ${W.x - X} ${G.y} L ${G.x} ${G.y}` : `M ${W.x} ${W.y} L ${G.x - Y} ${W.y} ${q} ${G.x} ${W.y - X} L ${G.x} ${G.y}`), W.x === G.x && (Q = `M ${W.x} ${W.y} L ${G.x} ${G.y}`)) : (W.y < G.y && (Q = H.type === commitType.MERGE && V.id !== H.parents[0] ? `M ${W.x} ${W.y} L ${G.x - Y} ${W.y} ${J} ${G.x} ${W.y + X} L ${G.x} ${G.y}` : `M ${W.x} ${W.y} L ${W.x} ${G.y - Y} ${q} ${W.x + X} ${G.y} L ${G.x} ${G.y}`), W.y > G.y && (Q = H.type === commitType.MERGE && V.id !== H.parents[0] ? `M ${W.x} ${W.y} L ${G.x - Y} ${W.y} ${q} ${G.x} ${W.y - X} L ${G.x} ${G.y}` : `M ${W.x} ${W.y} L ${W.x} ${G.y + Y} ${J} ${W.x + X} ${G.y} L ${G.x} ${G.y}`), W.y === G.y && (Q = `M ${W.x} ${W.y} L ${G.x} ${G.y}`));
529
+ if (Q === void 0) throw Error("Line definition not found");
530
+ f.append("path").attr("d", Q).attr("class", "arrow arrow" + Z % THEME_COLOR_LIMIT);
531
+ }, "drawArrow"), drawArrows = /* @__PURE__ */ __name((f, V) => {
532
+ let H = f.append("g").attr("class", "commit-arrows");
533
+ [...V.keys()].forEach((f) => {
534
+ let U = V.get(f);
535
+ U.parents && U.parents.length > 0 && U.parents.forEach((f) => {
536
+ drawArrow(H, V.get(f), U, V);
537
+ });
538
+ });
539
+ }, "drawArrows"), drawBranches = /* @__PURE__ */ __name((f, V) => {
540
+ let H = f.append("g");
541
+ V.forEach((f, V) => {
542
+ let U = V % THEME_COLOR_LIMIT, W = branchPos.get(f.name)?.pos;
543
+ if (W === void 0) throw Error(`Position not found for branch ${f.name}`);
544
+ let G = H.append("line");
545
+ G.attr("x1", 0), G.attr("y1", W), G.attr("x2", maxPos), G.attr("y2", W), G.attr("class", "branch branch" + U), dir === "TB" ? (G.attr("y1", defaultPos), G.attr("x1", W), G.attr("y2", maxPos), G.attr("x2", W)) : dir === "BT" && (G.attr("y1", maxPos), G.attr("x1", W), G.attr("y2", defaultPos), G.attr("x2", W)), lanes.push(W);
546
+ let K = f.name, q = drawText(K), J = H.insert("rect"), Y = H.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + U);
547
+ Y.node().appendChild(q);
548
+ let X = q.getBBox();
549
+ J.attr("class", "branchLabelBkg label" + U).attr("rx", 4).attr("ry", 4).attr("x", -X.width - 4 - (DEFAULT_GITGRAPH_CONFIG2?.rotateCommitLabel === !0 ? 30 : 0)).attr("y", -X.height / 2 + 8).attr("width", X.width + 18).attr("height", X.height + 4), Y.attr("transform", "translate(" + (-X.width - 14 - (DEFAULT_GITGRAPH_CONFIG2?.rotateCommitLabel === !0 ? 30 : 0)) + ", " + (W - X.height / 2 - 1) + ")"), dir === "TB" ? (J.attr("x", W - X.width / 2 - 10).attr("y", 0), Y.attr("transform", "translate(" + (W - X.width / 2 - 5) + ", 0)")) : dir === "BT" ? (J.attr("x", W - X.width / 2 - 10).attr("y", maxPos), Y.attr("transform", "translate(" + (W - X.width / 2 - 5) + ", " + maxPos + ")")) : J.attr("transform", "translate(-19, " + (W - X.height / 2) + ")");
550
+ });
551
+ }, "drawBranches"), setBranchPosition = /* @__PURE__ */ __name(function(f, V, H, U, W) {
552
+ return branchPos.set(f, {
553
+ pos: V,
554
+ index: H
555
+ }), V += 50 + (W ? 40 : 0) + (dir === "TB" || dir === "BT" ? U.width / 2 : 0), V;
556
+ }, "setBranchPosition"), diagram = {
557
+ parser,
558
+ db,
559
+ renderer: { draw: /* @__PURE__ */ __name(function(V, U, W, K) {
560
+ if (clear3(), log.debug("in gitgraph renderer", V + "\n", "id:", U, W), !DEFAULT_GITGRAPH_CONFIG2) throw Error("GitGraph config not found");
561
+ let q = DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel ?? !1, J = K.db;
562
+ allCommitsDict = J.getCommits();
563
+ let Y = J.getBranchesAsObjArray();
564
+ dir = J.getDirection();
565
+ let X = select_default(`[id="${U}"]`), Z = 0;
566
+ Y.forEach((f, V) => {
567
+ let H = drawText(f.name), U = X.append("g"), W = U.insert("g").attr("class", "branchLabel"), G = W.insert("g").attr("class", "label branch-label");
568
+ G.node()?.appendChild(H);
569
+ let K = H.getBBox();
570
+ Z = setBranchPosition(f.name, Z, V, K, q), G.remove(), W.remove(), U.remove();
571
+ }), drawCommits(X, allCommitsDict, !1), DEFAULT_GITGRAPH_CONFIG2.showBranches && drawBranches(X, Y), drawArrows(X, allCommitsDict), drawCommits(X, allCommitsDict, !0), utils_default.insertTitle(X, "gitTitleText", DEFAULT_GITGRAPH_CONFIG2.titleTopMargin ?? 0, J.getDiagramTitle()), setupGraphViewbox2(void 0, X, DEFAULT_GITGRAPH_CONFIG2.diagramPadding, DEFAULT_GITGRAPH_CONFIG2.useMaxWidth);
572
+ }, "draw") },
573
+ styles: /* @__PURE__ */ __name((f) => `
574
+ .commit-id,
575
+ .commit-msg,
576
+ .branch-label {
577
+ fill: lightgrey;
578
+ color: lightgrey;
579
+ font-family: 'trebuchet ms', verdana, arial, sans-serif;
580
+ font-family: var(--mermaid-font-family);
581
+ }
582
+ ${[
583
+ 0,
584
+ 1,
585
+ 2,
586
+ 3,
587
+ 4,
588
+ 5,
589
+ 6,
590
+ 7
591
+ ].map((V) => `
592
+ .branch-label${V} { fill: ${f["gitBranchLabel" + V]}; }
593
+ .commit${V} { stroke: ${f["git" + V]}; fill: ${f["git" + V]}; }
594
+ .commit-highlight${V} { stroke: ${f["gitInv" + V]}; fill: ${f["gitInv" + V]}; }
595
+ .label${V} { fill: ${f["git" + V]}; }
596
+ .arrow${V} { stroke: ${f["git" + V]}; }
597
+ `).join("\n")}
598
+
599
+ .branch {
600
+ stroke-width: 1;
601
+ stroke: ${f.lineColor};
602
+ stroke-dasharray: 2;
603
+ }
604
+ .commit-label { font-size: ${f.commitLabelFontSize}; fill: ${f.commitLabelColor};}
605
+ .commit-label-bkg { font-size: ${f.commitLabelFontSize}; fill: ${f.commitLabelBackground}; opacity: 0.5; }
606
+ .tag-label { font-size: ${f.tagLabelFontSize}; fill: ${f.tagLabelColor};}
607
+ .tag-label-bkg { fill: ${f.tagLabelBackground}; stroke: ${f.tagLabelBorder}; }
608
+ .tag-hole { fill: ${f.textColor}; }
609
+
610
+ .commit-merge {
611
+ stroke: ${f.primaryColor};
612
+ fill: ${f.primaryColor};
613
+ }
614
+ .commit-reverse {
615
+ stroke: ${f.primaryColor};
616
+ fill: ${f.primaryColor};
617
+ stroke-width: 3;
618
+ }
619
+ .commit-highlight-outer {
620
+ }
621
+ .commit-highlight-inner {
622
+ stroke: ${f.primaryColor};
623
+ fill: ${f.primaryColor};
624
+ }
625
+
626
+ .arrow { stroke-width: 8; stroke-linecap: round; fill: none}
627
+ .gitTitleText {
628
+ text-anchor: middle;
629
+ font-size: 18px;
630
+ fill: ${f.textColor};
631
+ }
632
+ `, "getStyles")
633
+ };
634
+ export { diagram };