@loopstack/loopstack-studio 0.25.0 → 0.25.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 (196) hide show
  1. package/dist/components/ai-elements/message.js +2 -2
  2. package/dist/components/ai-elements/reasoning.js +9 -9
  3. package/dist/loopstack-studio.css +1 -1
  4. package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +2 -5
  5. package/dist/node_modules/@chevrotain/gast/lib/src/model.js +69 -72
  6. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-7HQA4BMR.js → architecture-YZFGNWBL.js} +2 -2
  7. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-TQ3KTPDO.js → chunk-2KRD3SAO.js} +1 -1
  8. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-4F5CHEZ2.js → chunk-67CJDMHE.js} +1 -1
  9. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-UMXZTB3W.js → chunk-7N4EOEYR.js} +5 -2
  10. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-PL6DKKU2.js → chunk-AA7GKIK3.js} +1 -1
  11. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +23 -0
  12. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-SJTYNZTY.js → chunk-FOC6F5B3.js} +1 -1
  13. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +1197 -0
  14. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FRFDVMJY.js → chunk-KGLVRYIC.js} +1 -1
  15. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-B2363JML.js → chunk-LIHQZDEY.js} +1 -1
  16. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +29 -0
  17. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-G5XIXVHT.js → gitGraph-7Q5UKJZL.js} +2 -2
  18. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +3 -0
  19. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +3 -0
  20. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +3 -0
  21. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +3 -0
  22. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.js +3 -0
  23. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +3 -0
  24. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +3 -0
  25. package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +27 -17
  26. package/dist/node_modules/@upsetjs/venn.js/build/venn.esm.js +903 -0
  27. package/dist/node_modules/@xyflow/react/dist/esm/index.js +76 -75
  28. package/dist/node_modules/@xyflow/system/dist/esm/index.js +30 -28
  29. package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +31 -40
  30. package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +23 -26
  31. package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +12 -13
  32. package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +181 -205
  33. package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +11 -13
  34. package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +12 -13
  35. package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +8 -9
  36. package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +176 -183
  37. package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +17 -19
  38. package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +153 -160
  39. package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +10 -12
  40. package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +36 -38
  41. package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +37 -45
  42. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +12 -14
  43. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +80 -86
  44. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +6 -2
  45. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +39 -41
  46. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +7 -8
  47. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +69 -70
  48. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +215 -205
  49. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +76 -76
  50. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +29 -39
  51. package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +252 -274
  52. package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +93 -106
  53. package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +61 -61
  54. package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +31 -41
  55. package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +15 -18
  56. package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +226 -226
  57. package/dist/node_modules/chevrotain-allstar/lib/atn.js +17 -17
  58. package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +17 -14
  59. package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
  60. package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
  61. package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
  62. package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
  63. package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
  64. package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
  65. package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
  66. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
  67. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
  68. package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +61 -61
  69. package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
  70. package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
  71. package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
  72. package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
  73. package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
  74. package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
  75. package/dist/node_modules/dompurify/dist/purify.es.js +67 -67
  76. package/dist/node_modules/katex/dist/katex.js +1256 -1209
  77. package/dist/node_modules/khroma/dist/methods/transparentize.js +3 -0
  78. package/dist/node_modules/lodash-es/_baseClone.js +2 -2
  79. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
  80. package/dist/node_modules/lodash-es/_baseToString.js +1 -1
  81. package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
  82. package/dist/node_modules/lodash-es/_createSet.js +1 -1
  83. package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
  84. package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
  85. package/dist/node_modules/lodash-es/findIndex.js +2 -2
  86. package/dist/node_modules/lodash-es/flatMap.js +1 -1
  87. package/dist/node_modules/lodash-es/forEach.js +1 -1
  88. package/dist/node_modules/lodash-es/max.js +1 -1
  89. package/dist/node_modules/lodash-es/min.js +1 -1
  90. package/dist/node_modules/lodash-es/minBy.js +1 -1
  91. package/dist/node_modules/lodash-es/reduce.js +1 -1
  92. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-Q4EWVU46.js +691 -0
  93. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-VD42YOAC.js → blockDiagram-DXYQGD6D.js} +183 -157
  94. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-YG6GDRKO.js → c4Diagram-AHTNJAMY.js} +65 -63
  95. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-336JU56O.js +47 -0
  96. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EXTU4WIE.js → chunk-426QAEUC.js} +1 -1
  97. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-B4BG7PRW.js → chunk-4TB4RGXK.js} +533 -393
  98. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5FUZZQ4R.js +3638 -0
  99. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-S3R3BYOJ.js → chunk-5PVQY5BW.js} +1 -1
  100. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-HN2XXSSU.js → chunk-BSJP7CBP.js} +20 -14
  101. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-QN33PNHL.js → chunk-EDXVE4YY.js} +1 -1
  102. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ENJZ2VHE.js +568 -0
  103. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICPOFSXX.js +2320 -0
  104. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-DI55MBZ5.js → chunk-OYMX7WX6.js} +35 -21
  105. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.js +272 -0
  106. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ATLVNIR6.js → chunk-X2U36JSP.js} +1 -1
  107. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-MI3HLSF2.js → chunk-XPW4576I.js} +11 -7
  108. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-YZCP3GAM.js +60 -0
  109. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.js +30 -0
  110. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-2ON5EDUG.js → classDiagram-6PBFFD2Q.js} +12 -11
  111. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-WZHVMYZB.js → classDiagram-v2-HSJHXN6E.js} +12 -11
  112. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-6UL2VRFP.js → dagre-KV5264BT.js} +8 -8
  113. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-5BDNPKRD.js +99 -0
  114. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-PSM6KHXK.js → diagram-G4DWMVQ6.js} +20 -23
  115. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-MMDJMWI5.js +211 -0
  116. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-S2PKOQOG.js → diagram-TYMM5635.js} +4 -4
  117. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-Q2GNP2WA.js → erDiagram-SMLLAGMA.js} +486 -386
  118. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-NV44I4VS.js → flowDiagram-DWJPFMVM.js} +915 -898
  119. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-JELNMOA3.js → ganttDiagram-T4ZO3ILL.js} +59 -29
  120. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-UUTBAWPF.js +728 -0
  121. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-42DDH7IO.js +17 -0
  122. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-UXIWVN3A.js +714 -0
  123. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-XKPGCS4Q.js → journeyDiagram-VCZTEJTY.js} +32 -32
  124. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-3W4ZIXB7.js → kanban-definition-6JOO6SKY.js} +13 -9
  125. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-VGOIOE7T.js → mindmap-definition-QFDTVHPH.js} +105 -59
  126. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-DEJITSTG.js +117 -0
  127. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-AYHSOK5B.js → quadrantDiagram-34T5L4WZ.js} +1 -1
  128. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-UZGBJVZJ.js → requirementDiagram-MS252O5E.js} +49 -19
  129. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-TZEHDZUN.js → sankeyDiagram-XADWPNL6.js} +1 -1
  130. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.js +4155 -0
  131. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FKZM4ZOC.js → stateDiagram-FHFEXIEX.js} +12 -12
  132. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-4FDKWEC3.js → stateDiagram-v2-QKLJ7IA2.js} +11 -11
  133. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-GMOUNBTQ.js +1071 -0
  134. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-DHZGUBPP.js +959 -0
  135. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +574 -0
  136. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-PRI3JC2R.js → xychartDiagram-5P7HB3ND.js} +38 -35
  137. package/dist/node_modules/mermaid/dist/mermaid.core.js +235 -192
  138. package/dist/node_modules/nanoid/url-alphabet/index.js +1 -1
  139. package/dist/node_modules/remend/dist/index.js +333 -264
  140. package/dist/node_modules/streamdown/dist/chunk-BO2N2NFS.js +2498 -0
  141. package/dist/node_modules/streamdown/dist/highlighted-body-OFNGDK62.js +35 -0
  142. package/dist/node_modules/streamdown/dist/index.js +1 -1
  143. package/dist/node_modules/streamdown/dist/mermaid-GHXKKRXX.js +3 -0
  144. package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +672 -667
  145. package/dist/pages/DashboardPage.js +3 -3
  146. package/package.json +2 -2
  147. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-TCCFYFTB.js +0 -787
  148. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-VBDWY6EO.js +0 -3
  149. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-DYOGHKS2.js +0 -3
  150. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-VRWISCQL.js +0 -3
  151. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-ZZBFDIW7.js +0 -3
  152. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-GDKQZRPO.js +0 -3
  153. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js +0 -16
  154. package/dist/node_modules/lodash-es/_arrayAggregator.js +0 -9
  155. package/dist/node_modules/lodash-es/_arrayEvery.js +0 -6
  156. package/dist/node_modules/lodash-es/_baseAggregator.js +0 -8
  157. package/dist/node_modules/lodash-es/_baseDifference.js +0 -22
  158. package/dist/node_modules/lodash-es/_baseEvery.js +0 -9
  159. package/dist/node_modules/lodash-es/_baseIsRegExp.js +0 -8
  160. package/dist/node_modules/lodash-es/_baseSlice.js +0 -8
  161. package/dist/node_modules/lodash-es/_baseSome.js +0 -9
  162. package/dist/node_modules/lodash-es/_createAggregator.js +0 -12
  163. package/dist/node_modules/lodash-es/assign.js +0 -14
  164. package/dist/node_modules/lodash-es/compact.js +0 -9
  165. package/dist/node_modules/lodash-es/difference.js +0 -8
  166. package/dist/node_modules/lodash-es/drop.js +0 -8
  167. package/dist/node_modules/lodash-es/dropRight.js +0 -8
  168. package/dist/node_modules/lodash-es/every.js +0 -11
  169. package/dist/node_modules/lodash-es/groupBy.js +0 -6
  170. package/dist/node_modules/lodash-es/head.js +0 -5
  171. package/dist/node_modules/lodash-es/includes.js +0 -13
  172. package/dist/node_modules/lodash-es/indexOf.js +0 -11
  173. package/dist/node_modules/lodash-es/isRegExp.js +0 -5
  174. package/dist/node_modules/lodash-es/negate.js +0 -16
  175. package/dist/node_modules/lodash-es/pickBy.js +0 -15
  176. package/dist/node_modules/lodash-es/reject.js +0 -10
  177. package/dist/node_modules/lodash-es/some.js +0 -11
  178. package/dist/node_modules/lodash-es/uniq.js +0 -6
  179. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-VXUJARFQ.js +0 -673
  180. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.js +0 -1547
  181. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.js +0 -10
  182. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-DR5Q36YT.js +0 -135
  183. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.js +0 -247
  184. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.js +0 -3516
  185. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.js +0 -39
  186. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.js +0 -497
  187. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +0 -55
  188. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-QEK2KX5R.js +0 -211
  189. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-V2S2FVAM.js +0 -621
  190. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-HS3SLOUP.js +0 -18
  191. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-ADFJNKIX.js +0 -117
  192. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +0 -3560
  193. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-IT6M3QCI.js +0 -833
  194. package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +0 -2189
  195. package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +0 -33
  196. package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +0 -3
@@ -1,621 +0,0 @@
1
- import { __name, log } from "./chunk-AGHRB4JF.js";
2
- import { clear, common_default, defaultConfig_default, getAccDescription, getAccTitle, getConfig, getConfig2, getDiagramTitle, setAccDescription, setAccTitle, setDiagramTitle, setupGraphViewbox2 } from "./chunk-ABZYJK2D.js";
3
- import select_default from "../../../../d3-selection/src/select.js";
4
- import "../../../../d3/src/index.js";
5
- import { cleanAndMerge, random, utils_default } from "./chunk-S3R3BYOJ.js";
6
- import { populateCommonDb } from "./chunk-4BX2VUAB.js";
7
- import { parse } from "../../../../@mermaid-js/parser/dist/mermaid-parser.core.js";
8
- import { ImperativeState } from "./chunk-QZHKN3VN.js";
9
- var commitType = {
10
- NORMAL: 0,
11
- REVERSE: 1,
12
- HIGHLIGHT: 2,
13
- MERGE: 3,
14
- CHERRY_PICK: 4
15
- }, DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph, getConfig3 = /* @__PURE__ */ __name(() => cleanAndMerge({
16
- ...DEFAULT_GITGRAPH_CONFIG,
17
- ...getConfig().gitGraph
18
- }), "getConfig"), state = new ImperativeState(() => {
19
- let f = getConfig3(), V = f.mainBranchName, H = f.mainBranchOrder;
20
- return {
21
- mainBranchName: V,
22
- commits: /* @__PURE__ */ new Map(),
23
- head: null,
24
- branchConfig: /* @__PURE__ */ new Map([[V, {
25
- name: V,
26
- order: H
27
- }]]),
28
- branches: /* @__PURE__ */ new Map([[V, null]]),
29
- currBranch: V,
30
- direction: "LR",
31
- seq: 0,
32
- options: {}
33
- };
34
- });
35
- function getID() {
36
- return random({ length: 7 });
37
- }
38
- __name(getID, "getID");
39
- function uniqBy(f, V) {
40
- let H = /* @__PURE__ */ Object.create(null);
41
- return f.reduce((f, U) => {
42
- let W = V(U);
43
- return H[W] || (H[W] = !0, f.push(U)), f;
44
- }, []);
45
- }
46
- __name(uniqBy, "uniqBy");
47
- var setDirection = /* @__PURE__ */ __name(function(f) {
48
- state.records.direction = f;
49
- }, "setDirection"), setOptions = /* @__PURE__ */ __name(function(f) {
50
- log.debug("options str", f), f = f?.trim(), f ||= "{}";
51
- try {
52
- state.records.options = JSON.parse(f);
53
- } catch (f) {
54
- log.error("error while parsing gitGraph options", f.message);
55
- }
56
- }, "setOptions"), getOptions = /* @__PURE__ */ __name(function() {
57
- return state.records.options;
58
- }, "getOptions"), commit = /* @__PURE__ */ __name(function(f) {
59
- let H = f.msg, W = f.id, G = f.type, K = f.tags;
60
- log.info("commit", H, W, G, K), log.debug("Entering commit:", H, W, G, K);
61
- let q = getConfig3();
62
- W = common_default.sanitizeText(W, q), H = common_default.sanitizeText(H, q), K = K?.map((f) => common_default.sanitizeText(f, q));
63
- let J = {
64
- id: W || state.records.seq + "-" + getID(),
65
- message: H,
66
- seq: state.records.seq++,
67
- type: G ?? commitType.NORMAL,
68
- tags: K ?? [],
69
- parents: state.records.head == null ? [] : [state.records.head.id],
70
- branch: state.records.currBranch
71
- };
72
- state.records.head = J, log.info("main branch", q.mainBranchName), state.records.commits.has(J.id) && log.warn(`Commit ID ${J.id} already exists`), state.records.commits.set(J.id, J), state.records.branches.set(state.records.currBranch, J.id), log.debug("in pushCommit " + J.id);
73
- }, "commit"), branch = /* @__PURE__ */ __name(function(f) {
74
- let H = f.name, W = f.order;
75
- 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}")`);
76
- state.records.branches.set(H, state.records.head == null ? null : state.records.head.id), state.records.branchConfig.set(H, {
77
- name: H,
78
- order: W
79
- }), checkout(H), log.debug("in createBranch");
80
- }, "branch"), merge = /* @__PURE__ */ __name((f) => {
81
- let H = f.branch, W = f.id, G = f.type, K = f.tags, q = getConfig3();
82
- H = common_default.sanitizeText(H, q), W &&= common_default.sanitizeText(W, q);
83
- let J = state.records.branches.get(state.records.currBranch), Y = state.records.branches.get(H), X = J ? state.records.commits.get(J) : void 0, Z = Y ? state.records.commits.get(Y) : void 0;
84
- if (X && Z && X.branch === H) throw Error(`Cannot merge branch '${H}' into itself.`);
85
- if (state.records.currBranch === H) {
86
- let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Cannot merge a branch to itself");
87
- throw f.hash = {
88
- text: `merge ${H}`,
89
- token: `merge ${H}`,
90
- expected: ["branch abc"]
91
- }, f;
92
- }
93
- if (X === void 0 || !X) {
94
- let f = /* @__PURE__ */ Error(`Incorrect usage of "merge". Current branch (${state.records.currBranch})has no commits`);
95
- throw f.hash = {
96
- text: `merge ${H}`,
97
- token: `merge ${H}`,
98
- expected: ["commit"]
99
- }, f;
100
- }
101
- if (!state.records.branches.has(H)) {
102
- let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Branch to be merged (" + H + ") does not exist");
103
- throw f.hash = {
104
- text: `merge ${H}`,
105
- token: `merge ${H}`,
106
- expected: [`branch ${H}`]
107
- }, f;
108
- }
109
- if (Z === void 0 || !Z) {
110
- let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Branch to be merged (" + H + ") has no commits");
111
- throw f.hash = {
112
- text: `merge ${H}`,
113
- token: `merge ${H}`,
114
- expected: ["\"commit\""]
115
- }, f;
116
- }
117
- if (X === Z) {
118
- let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Both branches have same head");
119
- throw f.hash = {
120
- text: `merge ${H}`,
121
- token: `merge ${H}`,
122
- expected: ["branch abc"]
123
- }, f;
124
- }
125
- if (W && state.records.commits.has(W)) {
126
- let f = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Commit with id:" + W + " already exists, use different custom id");
127
- throw f.hash = {
128
- text: `merge ${H} ${W} ${G} ${K?.join(" ")}`,
129
- token: `merge ${H} ${W} ${G} ${K?.join(" ")}`,
130
- expected: [`merge ${H} ${W}_UNIQUE ${G} ${K?.join(" ")}`]
131
- }, f;
132
- }
133
- let Q = Y || "", $ = {
134
- id: W || `${state.records.seq}-${getID()}`,
135
- message: `merged branch ${H} into ${state.records.currBranch}`,
136
- seq: state.records.seq++,
137
- parents: state.records.head == null ? [] : [state.records.head.id, Q],
138
- branch: state.records.currBranch,
139
- type: commitType.MERGE,
140
- customType: G,
141
- customId: !!W,
142
- tags: K ?? []
143
- };
144
- 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");
145
- }, "merge"), cherryPick = /* @__PURE__ */ __name(function(f) {
146
- let H = f.id, W = f.targetId, G = f.tags, K = f.parent;
147
- log.debug("Entering cherryPick:", H, W, G);
148
- let q = getConfig3();
149
- if (H = common_default.sanitizeText(H, q), W = common_default.sanitizeText(W, q), G = G?.map((f) => common_default.sanitizeText(f, q)), K = common_default.sanitizeText(K, q), !H || !state.records.commits.has(H)) {
150
- let f = /* @__PURE__ */ Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
151
- throw f.hash = {
152
- text: `cherryPick ${H} ${W}`,
153
- token: `cherryPick ${H} ${W}`,
154
- expected: ["cherry-pick abc"]
155
- }, f;
156
- }
157
- let J = state.records.commits.get(H);
158
- if (J === void 0 || !J) throw Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
159
- if (K && !(Array.isArray(J.parents) && J.parents.includes(K))) throw /* @__PURE__ */ Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");
160
- let Y = J.branch;
161
- if (J.type === commitType.MERGE && !K) throw /* @__PURE__ */ Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");
162
- if (!W || !state.records.commits.has(W)) {
163
- if (Y === state.records.currBranch) {
164
- let f = /* @__PURE__ */ Error("Incorrect usage of \"cherryPick\". Source commit is already on current branch");
165
- throw f.hash = {
166
- text: `cherryPick ${H} ${W}`,
167
- token: `cherryPick ${H} ${W}`,
168
- expected: ["cherry-pick abc"]
169
- }, f;
170
- }
171
- let f = state.records.branches.get(state.records.currBranch);
172
- if (f === void 0 || !f) {
173
- let f = /* @__PURE__ */ Error(`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`);
174
- throw f.hash = {
175
- text: `cherryPick ${H} ${W}`,
176
- token: `cherryPick ${H} ${W}`,
177
- expected: ["cherry-pick abc"]
178
- }, f;
179
- }
180
- let U = state.records.commits.get(f);
181
- if (U === void 0 || !U) {
182
- let f = /* @__PURE__ */ Error(`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`);
183
- throw f.hash = {
184
- text: `cherryPick ${H} ${W}`,
185
- token: `cherryPick ${H} ${W}`,
186
- expected: ["cherry-pick abc"]
187
- }, f;
188
- }
189
- let q = {
190
- id: state.records.seq + "-" + getID(),
191
- message: `cherry-picked ${J?.message} into ${state.records.currBranch}`,
192
- seq: state.records.seq++,
193
- parents: state.records.head == null ? [] : [state.records.head.id, J.id],
194
- branch: state.records.currBranch,
195
- type: commitType.CHERRY_PICK,
196
- tags: G ? G.filter(Boolean) : [`cherry-pick:${J.id}${J.type === commitType.MERGE ? `|parent:${K}` : ""}`]
197
- };
198
- state.records.head = q, state.records.commits.set(q.id, q), state.records.branches.set(state.records.currBranch, q.id), log.debug(state.records.branches), log.debug("in cherryPick");
199
- }
200
- }, "cherryPick"), checkout = /* @__PURE__ */ __name(function(f) {
201
- if (f = common_default.sanitizeText(f, getConfig3()), state.records.branches.has(f)) {
202
- state.records.currBranch = f;
203
- let V = state.records.branches.get(state.records.currBranch);
204
- V === void 0 || !V ? state.records.head = null : state.records.head = state.records.commits.get(V) ?? null;
205
- } else {
206
- let V = /* @__PURE__ */ Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${f}")`);
207
- throw V.hash = {
208
- text: `checkout ${f}`,
209
- token: `checkout ${f}`,
210
- expected: [`branch ${f}`]
211
- }, V;
212
- }
213
- }, "checkout");
214
- function upsert(f, V, H) {
215
- let U = f.indexOf(V);
216
- U === -1 ? f.push(H) : f.splice(U, 1, H);
217
- }
218
- __name(upsert, "upsert");
219
- function prettyPrintCommitHistory(f) {
220
- let H = f.reduce((f, V) => f.seq > V.seq ? f : V, f[0]), U = "";
221
- f.forEach(function(f) {
222
- f === H ? U += " *" : U += " |";
223
- });
224
- let W = [
225
- U,
226
- H.id,
227
- H.seq
228
- ];
229
- for (let f in state.records.branches) state.records.branches.get(f) === H.id && W.push(f);
230
- if (log.debug(W.join(" ")), H.parents && H.parents.length == 2 && H.parents[0] && H.parents[1]) {
231
- let V = state.records.commits.get(H.parents[0]);
232
- upsert(f, H, V), H.parents[1] && f.push(state.records.commits.get(H.parents[1]));
233
- } else if (H.parents.length == 0) return;
234
- else if (H.parents[0]) {
235
- let V = state.records.commits.get(H.parents[0]);
236
- upsert(f, H, V);
237
- }
238
- f = uniqBy(f, (f) => f.id), prettyPrintCommitHistory(f);
239
- }
240
- __name(prettyPrintCommitHistory, "prettyPrintCommitHistory");
241
- var prettyPrint = /* @__PURE__ */ __name(function() {
242
- log.debug(state.records.commits);
243
- let f = getCommitsArray()[0];
244
- prettyPrintCommitHistory([f]);
245
- }, "prettyPrint"), clear2 = /* @__PURE__ */ __name(function() {
246
- state.reset(), clear();
247
- }, "clear"), getBranchesAsObjArray = /* @__PURE__ */ __name(function() {
248
- return [...state.records.branchConfig.values()].map((f, V) => f.order !== null && f.order !== void 0 ? f : {
249
- ...f,
250
- order: parseFloat(`0.${V}`)
251
- }).sort((f, V) => (f.order ?? 0) - (V.order ?? 0)).map(({ name: f }) => ({ name: f }));
252
- }, "getBranchesAsObjArray"), getBranches = /* @__PURE__ */ __name(function() {
253
- return state.records.branches;
254
- }, "getBranches"), getCommits = /* @__PURE__ */ __name(function() {
255
- return state.records.commits;
256
- }, "getCommits"), getCommitsArray = /* @__PURE__ */ __name(function() {
257
- let f = [...state.records.commits.values()];
258
- return f.forEach(function(f) {
259
- log.debug(f.id);
260
- }), f.sort((f, V) => f.seq - V.seq), f;
261
- }, "getCommitsArray"), db = {
262
- commitType,
263
- getConfig: getConfig3,
264
- setDirection,
265
- setOptions,
266
- getOptions,
267
- commit,
268
- branch,
269
- merge,
270
- cherryPick,
271
- checkout,
272
- prettyPrint,
273
- clear: clear2,
274
- getBranchesAsObjArray,
275
- getBranches,
276
- getCommits,
277
- getCommitsArray,
278
- getCurrentBranch: /* @__PURE__ */ __name(function() {
279
- return state.records.currBranch;
280
- }, "getCurrentBranch"),
281
- getDirection: /* @__PURE__ */ __name(function() {
282
- return state.records.direction;
283
- }, "getDirection"),
284
- getHead: /* @__PURE__ */ __name(function() {
285
- return state.records.head;
286
- }, "getHead"),
287
- setAccTitle,
288
- getAccTitle,
289
- getAccDescription,
290
- setAccDescription,
291
- setDiagramTitle,
292
- getDiagramTitle
293
- }, populate = /* @__PURE__ */ __name((f, V) => {
294
- populateCommonDb(f, V), f.dir && V.setDirection(f.dir);
295
- for (let H of f.statements) parseStatement(H, V);
296
- }, "populate"), parseStatement = /* @__PURE__ */ __name((H, U) => {
297
- let W = {
298
- Commit: /* @__PURE__ */ __name((f) => U.commit(parseCommit(f)), "Commit"),
299
- Branch: /* @__PURE__ */ __name((f) => U.branch(parseBranch(f)), "Branch"),
300
- Merge: /* @__PURE__ */ __name((f) => U.merge(parseMerge(f)), "Merge"),
301
- Checkout: /* @__PURE__ */ __name((f) => U.checkout(parseCheckout(f)), "Checkout"),
302
- CherryPicking: /* @__PURE__ */ __name((f) => U.cherryPick(parseCherryPicking(f)), "CherryPicking")
303
- }[H.$type];
304
- W ? W(H) : log.error(`Unknown statement type: ${H.$type}`);
305
- }, "parseStatement"), parseCommit = /* @__PURE__ */ __name((f) => ({
306
- id: f.id,
307
- msg: f.message ?? "",
308
- type: f.type === void 0 ? commitType.NORMAL : commitType[f.type],
309
- tags: f.tags ?? void 0
310
- }), "parseCommit"), parseBranch = /* @__PURE__ */ __name((f) => ({
311
- name: f.name,
312
- order: f.order ?? 0
313
- }), "parseBranch"), parseMerge = /* @__PURE__ */ __name((f) => ({
314
- branch: f.branch,
315
- id: f.id ?? "",
316
- type: f.type === void 0 ? void 0 : commitType[f.type],
317
- tags: f.tags ?? void 0
318
- }), "parseMerge"), parseCheckout = /* @__PURE__ */ __name((f) => f.branch, "parseCheckout"), parseCherryPicking = /* @__PURE__ */ __name((f) => ({
319
- id: f.id,
320
- targetId: "",
321
- tags: f.tags?.length === 0 ? void 0 : f.tags,
322
- parent: f.parent
323
- }), "parseCherryPicking"), parser = { parse: /* @__PURE__ */ __name(async (f) => {
324
- let H = await parse("gitGraph", f);
325
- log.debug(H), populate(H, db);
326
- }, "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(() => {
327
- branchPos.clear(), commitPos.clear(), allCommitsDict.clear(), maxPos = 0, lanes = [], dir = "LR";
328
- }, "clear"), drawText = /* @__PURE__ */ __name((f) => {
329
- let V = document.createElementNS("http://www.w3.org/2000/svg", "text");
330
- return (typeof f == "string" ? f.split(/\\n|\n|<br\s*\/?>/gi) : f).forEach((f) => {
331
- let H = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
332
- 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);
333
- }), V;
334
- }, "drawText"), findClosestParent = /* @__PURE__ */ __name((V) => {
335
- let H, U, W;
336
- return dir === "BT" ? (U = /* @__PURE__ */ __name((f, V) => f <= V, "comparisonFunc"), W = Infinity) : (U = /* @__PURE__ */ __name((f, V) => f >= V, "comparisonFunc"), W = 0), V.forEach((f) => {
337
- let V = dir === "TB" || dir == "BT" ? commitPos.get(f)?.y : commitPos.get(f)?.x;
338
- V !== void 0 && U(V, W) && (H = f, W = V);
339
- }), H;
340
- }, "findClosestParent"), findClosestParentBT = /* @__PURE__ */ __name((f) => {
341
- let V = "", H = Infinity;
342
- return f.forEach((f) => {
343
- let U = commitPos.get(f).y;
344
- U <= H && (V = f, H = U);
345
- }), V || void 0;
346
- }, "findClosestParentBT"), setParallelBTPos = /* @__PURE__ */ __name((f, V, H) => {
347
- let U = H, W = H, G = [];
348
- f.forEach((f) => {
349
- let H = V.get(f);
350
- if (!H) throw Error(`Commit not found for key ${f}`);
351
- H.parents.length ? (U = calculateCommitPosition(H), W = Math.max(U, W)) : G.push(H), setCommitPosition(H, U);
352
- }), U = W, G.forEach((f) => {
353
- setRootPosition(f, U, H);
354
- }), f.forEach((f) => {
355
- let H = V.get(f);
356
- if (H?.parents.length) {
357
- let f = findClosestParentBT(H.parents);
358
- U = commitPos.get(f).y - COMMIT_STEP, U <= W && (W = U);
359
- let V = branchPos.get(H.branch).pos, G = U - LAYOUT_OFFSET;
360
- commitPos.set(H.id, {
361
- x: V,
362
- y: G
363
- });
364
- }
365
- });
366
- }, "setParallelBTPos"), findClosestParentPos = /* @__PURE__ */ __name((f) => {
367
- let V = findClosestParent(f.parents.filter((f) => f !== null));
368
- if (!V) throw Error(`Closest parent not found for commit ${f.id}`);
369
- let H = commitPos.get(V)?.y;
370
- if (H === void 0) throw Error(`Closest parent position not found for commit ${f.id}`);
371
- return H;
372
- }, "findClosestParentPos"), calculateCommitPosition = /* @__PURE__ */ __name((f) => findClosestParentPos(f) + COMMIT_STEP, "calculateCommitPosition"), setCommitPosition = /* @__PURE__ */ __name((f, V) => {
373
- let H = branchPos.get(f.branch);
374
- if (!H) throw Error(`Branch not found for commit ${f.id}`);
375
- let U = H.pos, W = V + LAYOUT_OFFSET;
376
- return commitPos.set(f.id, {
377
- x: U,
378
- y: W
379
- }), {
380
- x: U,
381
- y: W
382
- };
383
- }, "setCommitPosition"), setRootPosition = /* @__PURE__ */ __name((f, V, H) => {
384
- let U = branchPos.get(f.branch);
385
- if (!U) throw Error(`Branch not found for commit ${f.id}`);
386
- let W = V + H, G = U.pos;
387
- commitPos.set(f.id, {
388
- x: G,
389
- y: W
390
- });
391
- }, "setRootPosition"), drawCommitBullet = /* @__PURE__ */ __name((f, V, H, U, W, G) => {
392
- 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`);
393
- 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}`);
394
- else {
395
- let K = f.append("circle");
396
- 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) {
397
- let G = f.append("circle");
398
- 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}`);
399
- }
400
- 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}`);
401
- }
402
- }, "drawCommitBullet"), drawCommitLabel = /* @__PURE__ */ __name((f, V, H, U) => {
403
- if (V.type !== commitType.CHERRY_PICK && (V.customId && V.type === commitType.MERGE || V.type !== commitType.MERGE) && DEFAULT_GITGRAPH_CONFIG2?.showCommitLabel) {
404
- 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();
405
- 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 + ")");
406
- else {
407
- let f = -7.5 - (q.width + 10) / 25 * 9.5, V = 10 + q.width / 25 * 8.5;
408
- W.attr("transform", "translate(" + f + ", " + V + ") rotate(-45, " + U + ", " + H.y + ")");
409
- }
410
- }
411
- }, "drawCommitLabel"), drawCommitTags = /* @__PURE__ */ __name((f, V, H, U) => {
412
- if (V.tags.length > 0) {
413
- let W = 0, G = 0, K = 0, q = [];
414
- for (let U of V.tags.reverse()) {
415
- 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();
416
- if (!X) throw Error("Tag bbox not found");
417
- G = Math.max(G, X.width), K = Math.max(K, X.height), Y.attr("x", H.posWithOffset - X.width / 2), q.push({
418
- tag: Y,
419
- hole: J,
420
- rect: V,
421
- yOffset: W
422
- }), W += 20;
423
- }
424
- for (let { tag: f, hole: V, rect: W, yOffset: J } of q) {
425
- let q = K / 2, Y = H.y - 19.2 - J;
426
- if (W.attr("class", "tag-label-bkg").attr("points", `
427
- ${U - G / 2 - PX / 2},${Y + PY}
428
- ${U - G / 2 - PX / 2},${Y - PY}
429
- ${H.posWithOffset - G / 2 - PX},${Y - q - PY}
430
- ${H.posWithOffset + G / 2 + PX},${Y - q - PY}
431
- ${H.posWithOffset + G / 2 + PX},${Y + q + PY}
432
- ${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") {
433
- let K = U + J;
434
- W.attr("class", "tag-label-bkg").attr("points", `
435
- ${H.x},${K + 2}
436
- ${H.x},${K - 2}
437
- ${H.x + LAYOUT_OFFSET},${K - q - 2}
438
- ${H.x + LAYOUT_OFFSET + G + 4},${K - q - 2}
439
- ${H.x + LAYOUT_OFFSET + G + 4},${K + q + 2}
440
- ${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 + ")");
441
- }
442
- }
443
- }
444
- }, "drawCommitTags"), getCommitClassType = /* @__PURE__ */ __name((f) => {
445
- switch (f.customType ?? f.type) {
446
- case commitType.NORMAL: return "commit-normal";
447
- case commitType.REVERSE: return "commit-reverse";
448
- case commitType.HIGHLIGHT: return "commit-highlight";
449
- case commitType.MERGE: return "commit-merge";
450
- case commitType.CHERRY_PICK: return "commit-cherry-pick";
451
- default: return "commit-normal";
452
- }
453
- }, "getCommitClassType"), calculatePosition = /* @__PURE__ */ __name((f, V, H, U) => {
454
- let W = {
455
- x: 0,
456
- y: 0
457
- };
458
- if (f.parents.length > 0) {
459
- let H = findClosestParent(f.parents);
460
- if (H) {
461
- let G = U.get(H) ?? W;
462
- return V === "TB" ? G.y + COMMIT_STEP : V === "BT" ? (U.get(f.id) ?? W).y - COMMIT_STEP : G.x + COMMIT_STEP;
463
- }
464
- } else if (V === "TB") return defaultPos;
465
- else if (V === "BT") return (U.get(f.id) ?? W).y - COMMIT_STEP;
466
- else return 0;
467
- return 0;
468
- }, "calculatePosition"), getCommitPosition = /* @__PURE__ */ __name((f, V, H) => {
469
- 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;
470
- if (G === void 0 || W === void 0) throw Error(`Position were undefined for commit ${f.id}`);
471
- return {
472
- x: G,
473
- y: W,
474
- posWithOffset: U
475
- };
476
- }, "getCommitPosition"), drawCommits = /* @__PURE__ */ __name((V, H, U) => {
477
- if (!DEFAULT_GITGRAPH_CONFIG2) throw Error("GitGraph config not found");
478
- let W = V.append("g").attr("class", "commit-bullets"), G = V.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) => {
479
- let U = H.get(f)?.seq, W = H.get(V)?.seq;
480
- return U !== void 0 && W !== void 0 ? U - W : 0;
481
- }, "sortKeys"), X = q.sort(Y);
482
- dir === "BT" && (J && setParallelBTPos(X, H, K), X = X.reverse()), X.forEach((f) => {
483
- let V = H.get(f);
484
- if (!V) throw Error(`Commit not found for key ${f}`);
485
- J && (K = calculatePosition(V, dir, K, commitPos));
486
- let q = getCommitPosition(V, K, J);
487
- if (U) {
488
- let f = getCommitClassType(V), H = V.customType ?? V.type;
489
- drawCommitBullet(W, V, q, f, branchPos.get(V.branch)?.index ?? 0, H), drawCommitLabel(G, V, q, K), drawCommitTags(G, V, q, K);
490
- }
491
- dir === "TB" || dir === "BT" ? commitPos.set(V.id, {
492
- x: q.x,
493
- y: q.posWithOffset
494
- }) : commitPos.set(V.id, {
495
- x: q.posWithOffset,
496
- y: q.y
497
- }), K = dir === "BT" && J ? K + COMMIT_STEP : K + COMMIT_STEP + LAYOUT_OFFSET, K > maxPos && (maxPos = K);
498
- });
499
- }, "drawCommits"), shouldRerouteArrow = /* @__PURE__ */ __name((V, H, U, W, G) => {
500
- let K = (dir === "TB" || dir === "BT" ? U.x < W.x : U.y < W.y) ? H.branch : V.branch, q = /* @__PURE__ */ __name((f) => f.branch === K, "isOnBranchToGetCurve"), J = /* @__PURE__ */ __name((f) => f.seq > V.seq && f.seq < H.seq, "isBetweenCommits");
501
- return [...G.values()].some((f) => J(f) && q(f));
502
- }, "shouldRerouteArrow"), findLane = /* @__PURE__ */ __name((f, V, H = 0) => {
503
- let U = f + Math.abs(f - V) / 2;
504
- 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);
505
- }, "findLane"), drawArrow = /* @__PURE__ */ __name((f, V, H, U) => {
506
- let W = commitPos.get(V.id), G = commitPos.get(H.id);
507
- if (W === void 0 || G === void 0) throw Error(`Commit positions not found for commits ${V.id} and ${H.id}`);
508
- let K = shouldRerouteArrow(V, H, W, G, U), q = "", J = "", Y = 0, X = 0, Z = branchPos.get(H.branch)?.index;
509
- H.type === commitType.MERGE && V.id !== H.parents[0] && (Z = branchPos.get(V.branch)?.index);
510
- let Q;
511
- if (K) {
512
- q = "A 10 10, 0, 0, 0,", J = "A 10 10, 0, 0, 1,", Y = 10, X = 10;
513
- 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);
514
- 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}`);
515
- } 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}`));
516
- if (Q === void 0) throw Error("Line definition not found");
517
- f.append("path").attr("d", Q).attr("class", "arrow arrow" + Z % THEME_COLOR_LIMIT);
518
- }, "drawArrow"), drawArrows = /* @__PURE__ */ __name((f, V) => {
519
- let H = f.append("g").attr("class", "commit-arrows");
520
- [...V.keys()].forEach((f) => {
521
- let U = V.get(f);
522
- U.parents && U.parents.length > 0 && U.parents.forEach((f) => {
523
- drawArrow(H, V.get(f), U, V);
524
- });
525
- });
526
- }, "drawArrows"), drawBranches = /* @__PURE__ */ __name((f, V) => {
527
- let H = f.append("g");
528
- V.forEach((f, V) => {
529
- let U = V % THEME_COLOR_LIMIT, W = branchPos.get(f.name)?.pos;
530
- if (W === void 0) throw Error(`Position not found for branch ${f.name}`);
531
- let G = H.append("line");
532
- 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);
533
- 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);
534
- Y.node().appendChild(q);
535
- let X = q.getBBox();
536
- 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) + ")");
537
- });
538
- }, "drawBranches"), setBranchPosition = /* @__PURE__ */ __name(function(f, V, H, U, W) {
539
- return branchPos.set(f, {
540
- pos: V,
541
- index: H
542
- }), V += 50 + (W ? 40 : 0) + (dir === "TB" || dir === "BT" ? U.width / 2 : 0), V;
543
- }, "setBranchPosition"), diagram = {
544
- parser,
545
- db,
546
- renderer: { draw: /* @__PURE__ */ __name(function(f, H, U, W) {
547
- if (clear3(), log.debug("in gitgraph renderer", f + "\n", "id:", H, U), !DEFAULT_GITGRAPH_CONFIG2) throw Error("GitGraph config not found");
548
- let G = DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel ?? !1, K = W.db;
549
- allCommitsDict = K.getCommits();
550
- let q = K.getBranchesAsObjArray();
551
- dir = K.getDirection();
552
- let J = select_default(`[id="${H}"]`), Y = 0;
553
- q.forEach((f, V) => {
554
- let H = drawText(f.name), U = J.append("g"), W = U.insert("g").attr("class", "branchLabel"), K = W.insert("g").attr("class", "label branch-label");
555
- K.node()?.appendChild(H);
556
- let q = H.getBBox();
557
- Y = setBranchPosition(f.name, Y, V, q, G), K.remove(), W.remove(), U.remove();
558
- }), drawCommits(J, allCommitsDict, !1), DEFAULT_GITGRAPH_CONFIG2.showBranches && drawBranches(J, q), drawArrows(J, allCommitsDict), drawCommits(J, allCommitsDict, !0), utils_default.insertTitle(J, "gitTitleText", DEFAULT_GITGRAPH_CONFIG2.titleTopMargin ?? 0, K.getDiagramTitle()), setupGraphViewbox2(void 0, J, DEFAULT_GITGRAPH_CONFIG2.diagramPadding, DEFAULT_GITGRAPH_CONFIG2.useMaxWidth);
559
- }, "draw") },
560
- styles: /* @__PURE__ */ __name((f) => `
561
- .commit-id,
562
- .commit-msg,
563
- .branch-label {
564
- fill: lightgrey;
565
- color: lightgrey;
566
- font-family: 'trebuchet ms', verdana, arial, sans-serif;
567
- font-family: var(--mermaid-font-family);
568
- }
569
- ${[
570
- 0,
571
- 1,
572
- 2,
573
- 3,
574
- 4,
575
- 5,
576
- 6,
577
- 7
578
- ].map((V) => `
579
- .branch-label${V} { fill: ${f["gitBranchLabel" + V]}; }
580
- .commit${V} { stroke: ${f["git" + V]}; fill: ${f["git" + V]}; }
581
- .commit-highlight${V} { stroke: ${f["gitInv" + V]}; fill: ${f["gitInv" + V]}; }
582
- .label${V} { fill: ${f["git" + V]}; }
583
- .arrow${V} { stroke: ${f["git" + V]}; }
584
- `).join("\n")}
585
-
586
- .branch {
587
- stroke-width: 1;
588
- stroke: ${f.lineColor};
589
- stroke-dasharray: 2;
590
- }
591
- .commit-label { font-size: ${f.commitLabelFontSize}; fill: ${f.commitLabelColor};}
592
- .commit-label-bkg { font-size: ${f.commitLabelFontSize}; fill: ${f.commitLabelBackground}; opacity: 0.5; }
593
- .tag-label { font-size: ${f.tagLabelFontSize}; fill: ${f.tagLabelColor};}
594
- .tag-label-bkg { fill: ${f.tagLabelBackground}; stroke: ${f.tagLabelBorder}; }
595
- .tag-hole { fill: ${f.textColor}; }
596
-
597
- .commit-merge {
598
- stroke: ${f.primaryColor};
599
- fill: ${f.primaryColor};
600
- }
601
- .commit-reverse {
602
- stroke: ${f.primaryColor};
603
- fill: ${f.primaryColor};
604
- stroke-width: 3;
605
- }
606
- .commit-highlight-outer {
607
- }
608
- .commit-highlight-inner {
609
- stroke: ${f.primaryColor};
610
- fill: ${f.primaryColor};
611
- }
612
-
613
- .arrow { stroke-width: 8; stroke-linecap: round; fill: none}
614
- .gitTitleText {
615
- text-anchor: middle;
616
- font-size: 18px;
617
- fill: ${f.textColor};
618
- }
619
- `, "getStyles")
620
- };
621
- export { diagram };
@@ -1,18 +0,0 @@
1
- import { package_default } from "./chunk-DR5Q36YT.js";
2
- import { __name, log } from "./chunk-AGHRB4JF.js";
3
- import { configureSvgSize } from "./chunk-ABZYJK2D.js";
4
- import { selectSvgElement } from "./chunk-EXTU4WIE.js";
5
- import { parse } from "../../../../@mermaid-js/parser/dist/mermaid-parser.core.js";
6
- var parser = { parse: /* @__PURE__ */ __name(async (e) => {
7
- let o = await parse("info", e);
8
- log.debug(o);
9
- }, "parse") }, DEFAULT_INFO_DB = { version: package_default.version + "" }, diagram = {
10
- parser,
11
- db: { getVersion: /* @__PURE__ */ __name(() => DEFAULT_INFO_DB.version, "getVersion") },
12
- renderer: { draw: /* @__PURE__ */ __name((e, o, s) => {
13
- log.debug("rendering info diagram\n" + e);
14
- let c = selectSvgElement(o);
15
- configureSvgSize(c, 100, 400, !0), c.append("g").append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${s}`);
16
- }, "draw") }
17
- };
18
- export { diagram };