@ashwin_droid/notion-stream 1.0.0 → 1.0.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 (154) hide show
  1. package/dist/{_baseUniq-DSwfPiGC.js → _baseUniq-D32sgNIc.js} +1 -1
  2. package/dist/{_baseUniq-CT-tc-CG.mjs → _baseUniq-DCnQIx8G.mjs} +51 -51
  3. package/dist/{arc-BBnIBs2j.js → arc-B0uBm0sN.js} +1 -1
  4. package/dist/{arc-DmoYXidQ.mjs → arc-OrNNmmBm.mjs} +1 -1
  5. package/dist/{architecture-U656AL7Q-C0ZB2O9M.js → architecture-U656AL7Q-CLYqYgyv.js} +1 -1
  6. package/dist/{architecture-U656AL7Q-CMPtJMZ-.mjs → architecture-U656AL7Q-seCMyeyz.mjs} +1 -1
  7. package/dist/architectureDiagram-VXUJARFQ-BGsDPmi_.js +36 -0
  8. package/dist/{architectureDiagram-VXUJARFQ-BYzpbF40.mjs → architectureDiagram-VXUJARFQ-BmPLNLcs.mjs} +1846 -1850
  9. package/dist/{blockDiagram-VD42YOAC-DPVTCHn5.mjs → blockDiagram-VD42YOAC-CXKvT-9-.mjs} +913 -922
  10. package/dist/blockDiagram-VD42YOAC-NQhzFvsO.js +122 -0
  11. package/dist/c4Diagram-YG6GDRKO-CMXx6pyB.js +10 -0
  12. package/dist/{c4Diagram-YG6GDRKO-C2Y4q08p.mjs → c4Diagram-YG6GDRKO-DAGMHESb.mjs} +169 -170
  13. package/dist/{channel-DVpqhnow.mjs → channel-BXGyzQA6.mjs} +1 -1
  14. package/dist/channel-Dw8BXC8D.js +1 -0
  15. package/dist/chunk-4BX2VUAB-MnK73C0-.js +1 -0
  16. package/dist/chunk-4BX2VUAB-ZaWvd3Xe.mjs +8 -0
  17. package/dist/{chunk-55IACEB6-P_FVKIbW.js → chunk-55IACEB6-B1EpdpVW.js} +1 -1
  18. package/dist/{chunk-55IACEB6-Du1Simcj.mjs → chunk-55IACEB6-iKbZBHA5.mjs} +1 -1
  19. package/dist/chunk-B4BG7PRW-Bo_sfBKL.js +165 -0
  20. package/dist/{chunk-B4BG7PRW-BUKsa2yH.mjs → chunk-B4BG7PRW-DgqSow4f.mjs} +251 -252
  21. package/dist/{chunk-DI55MBZ5-C9h0qLVI.mjs → chunk-DI55MBZ5-BAHL-2VJ.mjs} +444 -456
  22. package/dist/chunk-DI55MBZ5-BuuMLI1S.js +220 -0
  23. package/dist/{chunk-FMBD7UC4-C08-zA06.mjs → chunk-FMBD7UC4-BE8MbNLe.mjs} +1 -1
  24. package/dist/{chunk-FMBD7UC4-48-zdz-1.js → chunk-FMBD7UC4-Cs1BNv23.js} +1 -1
  25. package/dist/chunk-QN33PNHL-MX1ZMWu-.js +1 -0
  26. package/dist/chunk-QN33PNHL-ZaWv5vaA.mjs +19 -0
  27. package/dist/{chunk-QZHKN3VN-DbO6TJSK.mjs → chunk-QZHKN3VN-D2X7PBDi.mjs} +1 -1
  28. package/dist/{chunk-QZHKN3VN-Dy2264ui.js → chunk-QZHKN3VN-Db6mVb9M.js} +1 -1
  29. package/dist/{chunk-TZMSLE5B-BPmI9i6R.mjs → chunk-TZMSLE5B-AMFXF6mq.mjs} +20 -20
  30. package/dist/{chunk-TZMSLE5B-COENnLAZ.js → chunk-TZMSLE5B-CzjtACDr.js} +1 -1
  31. package/dist/{classDiagram-v2-WZHVMYZB-mzvV1Ifg.mjs → classDiagram-2ON5EDUG-CPwvtUDj.mjs} +2 -2
  32. package/dist/{classDiagram-2ON5EDUG-CFFwYK87.js → classDiagram-2ON5EDUG-UNrH9bQo.js} +1 -1
  33. package/dist/{classDiagram-2ON5EDUG-mzvV1Ifg.mjs → classDiagram-v2-WZHVMYZB-CPwvtUDj.mjs} +2 -2
  34. package/dist/{classDiagram-v2-WZHVMYZB-CFFwYK87.js → classDiagram-v2-WZHVMYZB-UNrH9bQo.js} +1 -1
  35. package/dist/{clone-KtLCwiKH.mjs → clone-CV4F8CSW.mjs} +1 -1
  36. package/dist/clone-HVsPHeK3.js +1 -0
  37. package/dist/{code-block-37QAKDTI-sxlq94xm.js → code-block-37QAKDTI-38K5Mxo2.js} +1 -1
  38. package/dist/{code-block-37QAKDTI-CmykMxjQ.mjs → code-block-37QAKDTI-Q-OOsw6q.mjs} +1 -1
  39. package/dist/cose-bilkent-S5V4N54A-1B77PywG.js +1 -0
  40. package/dist/{cose-bilkent-S5V4N54A-BXcldnso.mjs → cose-bilkent-S5V4N54A-greBbyuM.mjs} +592 -589
  41. package/dist/cytoscape.esm-CNUX3VTg.js +321 -0
  42. package/dist/{cytoscape.esm-ZmItrg9y.mjs → cytoscape.esm-Cvf3sx9F.mjs} +56 -83
  43. package/dist/dagre-6UL2VRFP-DEQXyXKh.js +4 -0
  44. package/dist/dagre-6UL2VRFP-DN5Inkgr.mjs +443 -0
  45. package/dist/diagram-PSM6KHXK-C7tjFZpr.js +24 -0
  46. package/dist/{diagram-PSM6KHXK-DIV3jw9d.mjs → diagram-PSM6KHXK-D-GS1fTc.mjs} +45 -48
  47. package/dist/{diagram-QEK2KX5R-Q0M2_YtR.mjs → diagram-QEK2KX5R-DJXBxeH4.mjs} +10 -14
  48. package/dist/diagram-QEK2KX5R-Doa8ooC_.js +43 -0
  49. package/dist/diagram-S2PKOQOG-BN04h93a.js +24 -0
  50. package/dist/{diagram-S2PKOQOG-_WGA6s2-.mjs → diagram-S2PKOQOG-BuPevKqw.mjs} +22 -23
  51. package/dist/erDiagram-Q2GNP2WA-AS2vnQKc.js +60 -0
  52. package/dist/{erDiagram-Q2GNP2WA-CW0D_QGb.mjs → erDiagram-Q2GNP2WA-DxOmvmqL.mjs} +77 -78
  53. package/dist/flowDiagram-NV44I4VS-BChiRwcp.js +162 -0
  54. package/dist/{flowDiagram-NV44I4VS-DVQ8Ntc4.mjs → flowDiagram-NV44I4VS-Cs_jC87H.mjs} +442 -449
  55. package/dist/{ganttDiagram-JELNMOA3-Bk-dX6qT.mjs → ganttDiagram-JELNMOA3-02b_-xyZ.mjs} +1049 -1041
  56. package/dist/ganttDiagram-JELNMOA3-BGy1b6TD.js +267 -0
  57. package/dist/{gitGraph-F6HP7TQM-CsdwxYUE.mjs → gitGraph-F6HP7TQM-BWm0SBV4.mjs} +1 -1
  58. package/dist/{gitGraph-F6HP7TQM-DvIgo2TM.js → gitGraph-F6HP7TQM-DVfckSNX.js} +1 -1
  59. package/dist/gitGraphDiagram-NY62KEGX-CfzoE07P.mjs +699 -0
  60. package/dist/gitGraphDiagram-NY62KEGX-Cm9ywQoW.js +65 -0
  61. package/dist/{graph-C_T4ZBuC.mjs → graph-DEu7-ZhH.mjs} +8 -8
  62. package/dist/{graph-BNpx6ebg.js → graph-Dw_87ii6.js} +1 -1
  63. package/dist/index-BwYOYPeK.js +670 -0
  64. package/dist/{index-oe4HpmeG.mjs → index-DH3CVXwD.mjs} +22541 -22646
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.js +1 -1
  67. package/dist/index.mjs +3 -3
  68. package/dist/{info-NVLQJR56-BwFQRguW.js → info-NVLQJR56-BpKxONZx.js} +1 -1
  69. package/dist/info-NVLQJR56-MmJP3L6S.mjs +5 -0
  70. package/dist/{infoDiagram-WHAUD3N6-C-gzsm95.mjs → infoDiagram-WHAUD3N6-Bfsucvti.mjs} +2 -2
  71. package/dist/{infoDiagram-WHAUD3N6-CCb5k_S7.js → infoDiagram-WHAUD3N6-q-yX3_By.js} +1 -1
  72. package/dist/journeyDiagram-XKPGCS4Q-BqtyHvQF.js +139 -0
  73. package/dist/{journeyDiagram-XKPGCS4Q-DzkUL_YG.mjs → journeyDiagram-XKPGCS4Q-dFRLmnr-.mjs} +24 -26
  74. package/dist/kanban-definition-3W4ZIXB7-DeOl9Eme.mjs +719 -0
  75. package/dist/kanban-definition-3W4ZIXB7-DraMxv75.js +89 -0
  76. package/dist/{layout-CuWQnP5Y.js → layout-BKTUO8WZ.js} +1 -1
  77. package/dist/{layout-Cd98WJ7r.mjs → layout-CpL-hYTa.mjs} +22 -22
  78. package/dist/{linear-SU4e8MRt.mjs → linear-CLwIU3di.mjs} +20 -20
  79. package/dist/{linear-DFDw13y6.js → linear-DvM229Di.js} +1 -1
  80. package/dist/mermaid-4DMBBIKO-BpqXz0_U.mjs +4 -0
  81. package/dist/{mermaid-4DMBBIKO-BihEtyib.js → mermaid-4DMBBIKO-Cd15t2pT.js} +1 -1
  82. package/dist/mermaid-parser.core-BVlc9Lqd.js +128 -0
  83. package/dist/{mermaid-parser.core-C8Sxzqul.mjs → mermaid-parser.core-CLAapB2-.mjs} +3404 -3369
  84. package/dist/{min-C2k771MZ.mjs → min--ML-ONY_.mjs} +2 -2
  85. package/dist/{min-CppMRDFn.js → min-BQ4NUvNf.js} +1 -1
  86. package/dist/{mindmap-definition-VGOIOE7T-BUd354uH.mjs → mindmap-definition-VGOIOE7T-78K_EDCb.mjs} +170 -172
  87. package/dist/mindmap-definition-VGOIOE7T-ZHY70ZzV.js +68 -0
  88. package/dist/notion-stream.css +1 -0
  89. package/dist/{ordinal-C0oynhte.mjs → ordinal-B-KqvkJf.mjs} +1 -1
  90. package/dist/{packet-BFZMPI3H-Cz_A86d3.mjs → packet-BFZMPI3H-B34lFb6T.mjs} +1 -1
  91. package/dist/{packet-BFZMPI3H-CFx3kSkL.js → packet-BFZMPI3H-C9xcJQVN.js} +1 -1
  92. package/dist/{pie-7BOR55EZ-_1MqisBd.js → pie-7BOR55EZ-Bz_jfTd_.js} +1 -1
  93. package/dist/pie-7BOR55EZ-DW2Zgje5.mjs +5 -0
  94. package/dist/{pieDiagram-ADFJNKIX-Bg0_gu43.js → pieDiagram-ADFJNKIX-CKzchAXU.js} +2 -2
  95. package/dist/{pieDiagram-ADFJNKIX-lRs_rpwI.mjs → pieDiagram-ADFJNKIX-Ctp6QR7f.mjs} +21 -21
  96. package/dist/quadrantDiagram-AYHSOK5B-D2Rt32D2.js +7 -0
  97. package/dist/{quadrantDiagram-AYHSOK5B-D9kypJt6.mjs → quadrantDiagram-AYHSOK5B-D3U_Qicu.mjs} +230 -232
  98. package/dist/{radar-NHE76QYJ-B-PvZD0K.mjs → radar-NHE76QYJ-CO5ECFHq.mjs} +1 -1
  99. package/dist/{radar-NHE76QYJ-CdtC4C8F.js → radar-NHE76QYJ-DI4PJJjm.js} +1 -1
  100. package/dist/requirementDiagram-UZGBJVZJ-CSgb6U9N.js +64 -0
  101. package/dist/{requirementDiagram-UZGBJVZJ-B5ulaHjE.mjs → requirementDiagram-UZGBJVZJ-Da_yWSD1.mjs} +190 -192
  102. package/dist/sankeyDiagram-TZEHDZUN-C8jpBnM0.js +10 -0
  103. package/dist/{sankeyDiagram-TZEHDZUN-DprIPFbe.mjs → sankeyDiagram-TZEHDZUN-Dp3Eyl8Q.mjs} +189 -189
  104. package/dist/sequenceDiagram-WL72ISMW-BZJ7d_X4.js +145 -0
  105. package/dist/{sequenceDiagram-WL72ISMW-B4m4oag0.mjs → sequenceDiagram-WL72ISMW-yJKe02sV.mjs} +222 -229
  106. package/dist/{stateDiagram-FKZM4ZOC-BD4tnS-V.js → stateDiagram-FKZM4ZOC-Cfuygt_P.js} +1 -1
  107. package/dist/{stateDiagram-FKZM4ZOC-DjkdDbQ2.mjs → stateDiagram-FKZM4ZOC-z0IX85WL.mjs} +4 -4
  108. package/dist/{stateDiagram-v2-4FDKWEC3-AK86F3i6.mjs → stateDiagram-v2-4FDKWEC3-BDMFqSat.mjs} +2 -2
  109. package/dist/{stateDiagram-v2-4FDKWEC3-sybMoxOk.js → stateDiagram-v2-4FDKWEC3-BiriAQkj.js} +1 -1
  110. package/dist/{timeline-definition-IT6M3QCI-BFuQEeZP.mjs → timeline-definition-IT6M3QCI-BmEq-RM3.mjs} +217 -223
  111. package/dist/timeline-definition-IT6M3QCI-CBmpRgUM.js +61 -0
  112. package/dist/{treemap-KMMF4GRG-gtrnY16v.mjs → treemap-KMMF4GRG-IaHP18r_.mjs} +1 -1
  113. package/dist/{treemap-KMMF4GRG-DTnRa789.js → treemap-KMMF4GRG-qP0VzKwW.js} +1 -1
  114. package/dist/{xychartDiagram-PRI3JC2R-CjXiy6m0.mjs → xychartDiagram-PRI3JC2R-BSaI76KX.mjs} +7 -7
  115. package/dist/xychartDiagram-PRI3JC2R-CQgij0Fy.js +7 -0
  116. package/package.json +5 -5
  117. package/dist/architectureDiagram-VXUJARFQ-BPQoZmaM.js +0 -36
  118. package/dist/blockDiagram-VD42YOAC-Z3Fc3Bew.js +0 -122
  119. package/dist/c4Diagram-YG6GDRKO-LzDuCZ2V.js +0 -10
  120. package/dist/channel-6dUO0MQi.js +0 -1
  121. package/dist/chunk-4BX2VUAB-BwubFldI.js +0 -1
  122. package/dist/chunk-4BX2VUAB-DldMXCTt.mjs +0 -9
  123. package/dist/chunk-B4BG7PRW-CKX0VJ-S.js +0 -165
  124. package/dist/chunk-DI55MBZ5-CMq-O8k2.js +0 -220
  125. package/dist/chunk-QN33PNHL-B0sO38bZ.js +0 -1
  126. package/dist/chunk-QN33PNHL-B_PGnTkk.mjs +0 -20
  127. package/dist/clone-B0UaPT2Z.js +0 -1
  128. package/dist/cose-bilkent-S5V4N54A-BCaAPmuF.js +0 -1
  129. package/dist/cytoscape.esm-DkGgpG6d.js +0 -331
  130. package/dist/dagre-6UL2VRFP-By42zbLA.mjs +0 -446
  131. package/dist/dagre-6UL2VRFP-DCwfkcWi.js +0 -4
  132. package/dist/diagram-PSM6KHXK-hjXN9n1N.js +0 -24
  133. package/dist/diagram-QEK2KX5R-B04ODMim.js +0 -43
  134. package/dist/diagram-S2PKOQOG-BmCs4MZE.js +0 -24
  135. package/dist/erDiagram-Q2GNP2WA-4KtQUUuI.js +0 -60
  136. package/dist/flowDiagram-NV44I4VS-BwpfJE0U.js +0 -162
  137. package/dist/ganttDiagram-JELNMOA3-D7rI7u8B.js +0 -267
  138. package/dist/gitGraphDiagram-NY62KEGX-BDTsbSkO.mjs +0 -712
  139. package/dist/gitGraphDiagram-NY62KEGX-IQ8KriUw.js +0 -65
  140. package/dist/index-CkYZRBYn.js +0 -676
  141. package/dist/info-NVLQJR56-B5gDnSIT.mjs +0 -5
  142. package/dist/journeyDiagram-XKPGCS4Q-POnSekz9.js +0 -139
  143. package/dist/kanban-definition-3W4ZIXB7-BPr0_7wG.mjs +0 -720
  144. package/dist/kanban-definition-3W4ZIXB7-Bm064qrf.js +0 -89
  145. package/dist/mermaid-4DMBBIKO-DDxvQcE9.mjs +0 -4
  146. package/dist/mermaid-parser.core-BHAgLMGa.js +0 -128
  147. package/dist/mindmap-definition-VGOIOE7T-CV7bD4HY.js +0 -68
  148. package/dist/pie-7BOR55EZ-B0-atE_o.mjs +0 -5
  149. package/dist/quadrantDiagram-AYHSOK5B-B4gVakRV.js +0 -7
  150. package/dist/requirementDiagram-UZGBJVZJ-0zMPj-SD.js +0 -64
  151. package/dist/sankeyDiagram-TZEHDZUN-Cl8-L83T.js +0 -10
  152. package/dist/sequenceDiagram-WL72ISMW-DRQn7Fe4.js +0 -145
  153. package/dist/timeline-definition-IT6M3QCI-2X4dfyLj.js +0 -61
  154. package/dist/xychartDiagram-PRI3JC2R-BaFd1In8.js +0 -7
@@ -0,0 +1,443 @@
1
+ import { _ as w, aw as F, ax as Y, ay as _, az as H, l as i, f as V, aA as z, aB as U, an as $, as as q, ao as P, am as K, aC as Q, aD as W, aE as Z } from "./index-DH3CVXwD.mjs";
2
+ import { i as b, G as B } from "./graph-DEu7-ZhH.mjs";
3
+ import { l as I } from "./layout-CpL-hYTa.mjs";
4
+ import { c as L } from "./clone-CV4F8CSW.mjs";
5
+ import { m as A } from "./min--ML-ONY_.mjs";
6
+ function h(e) {
7
+ var t = {
8
+ options: {
9
+ directed: e.isDirected(),
10
+ multigraph: e.isMultigraph(),
11
+ compound: e.isCompound()
12
+ },
13
+ nodes: ee(e),
14
+ edges: ne(e)
15
+ };
16
+ return b(e.graph()) || (t.value = L(e.graph())), t;
17
+ }
18
+ function ee(e) {
19
+ return A(e.nodes(), function(t) {
20
+ var n = e.node(t), a = e.parent(t), r = { v: t };
21
+ return b(n) || (r.value = n), b(a) || (r.parent = a), r;
22
+ });
23
+ }
24
+ function ne(e) {
25
+ return A(e.edges(), function(t) {
26
+ var n = e.edge(t), a = { v: t.v, w: t.w };
27
+ return b(t.name) || (a.name = t.name), b(n) || (a.value = n), a;
28
+ });
29
+ }
30
+ var d = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ w(() => {
31
+ y.clear(), J.clear(), d.clear();
32
+ }, "clear"), D = /* @__PURE__ */ w((e, t) => {
33
+ const n = y.get(t) || [];
34
+ return i.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
35
+ }, "isDescendant"), se = /* @__PURE__ */ w((e, t) => {
36
+ const n = y.get(t) || [];
37
+ return i.info("Descendants of ", t, " is ", n), i.info("Edge is ", e), e.v === t || e.w === t ? !1 : n ? n.includes(e.v) || D(e.v, t) || D(e.w, t) || n.includes(e.w) : (i.debug("Tilt, ", t, ",not in descendants"), !1);
38
+ }, "edgeInCluster"), G = /* @__PURE__ */ w((e, t, n, a) => {
39
+ i.warn(
40
+ "Copying children of ",
41
+ e,
42
+ "root",
43
+ a,
44
+ "data",
45
+ t.node(e),
46
+ a
47
+ );
48
+ const r = t.children(e) || [];
49
+ e !== a && r.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", r), r.forEach((o) => {
50
+ if (t.children(o).length > 0)
51
+ G(o, t, n, a);
52
+ else {
53
+ const l = t.node(o);
54
+ i.info("cp ", o, " to ", a, " with parent ", e), n.setNode(o, l), a !== t.parent(o) && (i.warn("Setting parent", o, t.parent(o)), n.setParent(o, t.parent(o))), e !== a && o !== e ? (i.debug("Setting parent", o, e), n.setParent(o, e)) : (i.info("In copy ", e, "root", a, "data", t.node(e), a), i.debug(
55
+ "Not Setting parent for node=",
56
+ o,
57
+ "cluster!==rootId",
58
+ e !== a,
59
+ "node!==clusterId",
60
+ o !== e
61
+ ));
62
+ const u = t.edges(o);
63
+ i.debug("Copying Edges", u), u.forEach((c) => {
64
+ i.info("Edge", c);
65
+ const m = t.edge(c.v, c.w, c.name);
66
+ i.info("Edge data", m, a);
67
+ try {
68
+ se(c, a) ? (i.info("Copying as ", c.v, c.w, m, c.name), n.setEdge(c.v, c.w, m, c.name), i.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : i.info(
69
+ "Skipping copy of edge ",
70
+ c.v,
71
+ "-->",
72
+ c.w,
73
+ " rootId: ",
74
+ a,
75
+ " clusterId:",
76
+ e
77
+ );
78
+ } catch (v) {
79
+ i.error(v);
80
+ }
81
+ });
82
+ }
83
+ i.debug("Removing node", o), t.removeNode(o);
84
+ });
85
+ }, "copy"), R = /* @__PURE__ */ w((e, t) => {
86
+ const n = t.children(e);
87
+ let a = [...n];
88
+ for (const r of n)
89
+ J.set(r, e), a = [...a, ...R(r, t)];
90
+ return a;
91
+ }, "extractDescendants"), ie = /* @__PURE__ */ w((e, t, n) => {
92
+ const a = e.edges().filter((c) => c.v === t || c.w === t), r = e.edges().filter((c) => c.v === n || c.w === n), o = a.map((c) => ({ v: c.v === t ? n : c.v, w: c.w === t ? t : c.w })), l = r.map((c) => ({ v: c.v, w: c.w }));
93
+ return o.filter((c) => l.some((m) => c.v === m.v && c.w === m.w));
94
+ }, "findCommonEdges"), C = /* @__PURE__ */ w((e, t, n) => {
95
+ const a = t.children(e);
96
+ if (i.trace("Searching children of id ", e, a), a.length < 1)
97
+ return e;
98
+ let r;
99
+ for (const o of a) {
100
+ const l = C(o, t, n), u = ie(t, n, l);
101
+ if (l)
102
+ if (u.length > 0)
103
+ r = l;
104
+ else
105
+ return l;
106
+ }
107
+ return r;
108
+ }, "findNonClusterChild"), k = /* @__PURE__ */ w((e) => !d.has(e) || !d.get(e).externalConnections ? e : d.has(e) ? d.get(e).id : e, "getAnchorId"), re = /* @__PURE__ */ w((e, t) => {
109
+ if (!e || t > 10) {
110
+ i.debug("Opting out, no graph ");
111
+ return;
112
+ } else
113
+ i.debug("Opting in, graph ");
114
+ e.nodes().forEach(function(n) {
115
+ e.children(n).length > 0 && (i.warn(
116
+ "Cluster identified",
117
+ n,
118
+ " Replacement id in edges: ",
119
+ C(n, e, n)
120
+ ), y.set(n, R(n, e)), d.set(n, { id: C(n, e, n), clusterData: e.node(n) }));
121
+ }), e.nodes().forEach(function(n) {
122
+ const a = e.children(n), r = e.edges();
123
+ a.length > 0 ? (i.debug("Cluster identified", n, y), r.forEach((o) => {
124
+ const l = D(o.v, n), u = D(o.w, n);
125
+ l ^ u && (i.warn("Edge: ", o, " leaves cluster ", n), i.warn("Descendants of XXX ", n, ": ", y.get(n)), d.get(n).externalConnections = !0);
126
+ })) : i.debug("Not a cluster ", n, y);
127
+ });
128
+ for (let n of d.keys()) {
129
+ const a = d.get(n).id, r = e.parent(a);
130
+ r !== n && d.has(r) && !d.get(r).externalConnections && (d.get(n).id = r);
131
+ }
132
+ e.edges().forEach(function(n) {
133
+ const a = e.edge(n);
134
+ i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
135
+ let r = n.v, o = n.w;
136
+ if (i.warn(
137
+ "Fix XXX",
138
+ d,
139
+ "ids:",
140
+ n.v,
141
+ n.w,
142
+ "Translating: ",
143
+ d.get(n.v),
144
+ " --- ",
145
+ d.get(n.w)
146
+ ), d.get(n.v) || d.get(n.w)) {
147
+ if (i.warn("Fixing and trying - removing XXX", n.v, n.w, n.name), r = k(n.v), o = k(n.w), e.removeEdge(n.v, n.w, n.name), r !== n.v) {
148
+ const l = e.parent(r);
149
+ d.get(l).externalConnections = !0, a.fromCluster = n.v;
150
+ }
151
+ if (o !== n.w) {
152
+ const l = e.parent(o);
153
+ d.get(l).externalConnections = !0, a.toCluster = n.w;
154
+ }
155
+ i.warn("Fix Replacing with XXX", r, o, n.name), e.setEdge(r, o, a, n.name);
156
+ }
157
+ }), i.warn("Adjusted Graph", h(e)), T(e, 0), i.trace(d);
158
+ }, "adjustClustersAndEdges"), T = /* @__PURE__ */ w((e, t) => {
159
+ if (i.warn("extractor - ", t, h(e), e.children("D")), t > 10) {
160
+ i.error("Bailing out");
161
+ return;
162
+ }
163
+ let n = e.nodes(), a = !1;
164
+ for (const r of n) {
165
+ const o = e.children(r);
166
+ a = a || o.length > 0;
167
+ }
168
+ if (!a) {
169
+ i.debug("Done, no node has children", e.nodes());
170
+ return;
171
+ }
172
+ i.debug("Nodes = ", n, t);
173
+ for (const r of n)
174
+ if (i.debug(
175
+ "Extracting node",
176
+ r,
177
+ d,
178
+ d.has(r) && !d.get(r).externalConnections,
179
+ !e.parent(r),
180
+ e.node(r),
181
+ e.children("D"),
182
+ " Depth ",
183
+ t
184
+ ), !d.has(r))
185
+ i.debug("Not a cluster", r, t);
186
+ else if (!d.get(r).externalConnections && e.children(r) && e.children(r).length > 0) {
187
+ i.warn(
188
+ "Cluster without external connections, without a parent and with children",
189
+ r,
190
+ t
191
+ );
192
+ let l = e.graph().rankdir === "TB" ? "LR" : "TB";
193
+ d.get(r)?.clusterData?.dir && (l = d.get(r).clusterData.dir, i.warn("Fixing dir", d.get(r).clusterData.dir, l));
194
+ const u = new B({
195
+ multigraph: !0,
196
+ compound: !0
197
+ }).setGraph({
198
+ rankdir: l,
199
+ nodesep: 50,
200
+ ranksep: 50,
201
+ marginx: 8,
202
+ marginy: 8
203
+ }).setDefaultEdgeLabel(function() {
204
+ return {};
205
+ });
206
+ i.warn("Old graph before copy", h(e)), G(r, e, u, r), e.setNode(r, {
207
+ clusterNode: !0,
208
+ id: r,
209
+ clusterData: d.get(r).clusterData,
210
+ label: d.get(r).label,
211
+ graph: u
212
+ }), i.warn("New graph after copy node: (", r, ")", h(u)), i.debug("Old graph after copy", h(e));
213
+ } else
214
+ i.warn(
215
+ "Cluster ** ",
216
+ r,
217
+ " **not meeting the criteria !externalConnections:",
218
+ !d.get(r).externalConnections,
219
+ " no parent: ",
220
+ !e.parent(r),
221
+ " children ",
222
+ e.children(r) && e.children(r).length > 0,
223
+ e.children("D"),
224
+ t
225
+ ), i.debug(d);
226
+ n = e.nodes(), i.warn("New list of nodes", n);
227
+ for (const r of n) {
228
+ const o = e.node(r);
229
+ i.warn(" Now next level", r, o), o?.clusterNode && T(o.graph, t + 1);
230
+ }
231
+ }, "extractor"), M = /* @__PURE__ */ w((e, t) => {
232
+ if (t.length === 0)
233
+ return [];
234
+ let n = Object.assign([], t);
235
+ return t.forEach((a) => {
236
+ const r = e.children(a), o = M(e, r);
237
+ n = [...n, ...o];
238
+ }), n;
239
+ }, "sorter"), oe = /* @__PURE__ */ w((e) => M(e, e.children()), "sortNodesByHierarchy"), j = /* @__PURE__ */ w(async (e, t, n, a, r, o) => {
240
+ i.warn("Graph in recursive render:XAX", h(t), r);
241
+ const l = t.graph().rankdir;
242
+ i.trace("Dir in recursive render - dir:", l);
243
+ const u = e.insert("g").attr("class", "root");
244
+ t.nodes() ? i.info("Recursive render XXX", t.nodes()) : i.info("No nodes found for", t), t.edges().length > 0 && i.info("Recursive edges", t.edge(t.edges()[0]));
245
+ const c = u.insert("g").attr("class", "clusters"), m = u.insert("g").attr("class", "edgePaths"), v = u.insert("g").attr("class", "edgeLabels"), X = u.insert("g").attr("class", "nodes");
246
+ await Promise.all(
247
+ t.nodes().map(async function(f) {
248
+ const s = t.node(f);
249
+ if (r !== void 0) {
250
+ const g = JSON.parse(JSON.stringify(r.clusterData));
251
+ i.trace(
252
+ `Setting data for parent cluster XXX
253
+ Node.id = `,
254
+ f,
255
+ `
256
+ data=`,
257
+ g.height,
258
+ `
259
+ Parent cluster`,
260
+ r.height
261
+ ), t.setNode(r.id, g), t.parent(f) || (i.trace("Setting parent", f, r.id), t.setParent(f, r.id, g));
262
+ }
263
+ if (i.info("(Insert) Node XXX" + f + ": " + JSON.stringify(t.node(f))), s?.clusterNode) {
264
+ i.info("Cluster identified XBX", f, s.width, t.node(f));
265
+ const { ranksep: g, nodesep: p } = t.graph();
266
+ s.graph.setGraph({
267
+ ...s.graph.graph(),
268
+ ranksep: g + 25,
269
+ nodesep: p
270
+ });
271
+ const N = await j(
272
+ X,
273
+ s.graph,
274
+ n,
275
+ a,
276
+ t.node(f),
277
+ o
278
+ ), x = N.elem;
279
+ z(s, x), s.diff = N.diff || 0, i.info(
280
+ "New compound node after recursive render XAX",
281
+ f,
282
+ "width",
283
+ // node,
284
+ s.width,
285
+ "height",
286
+ s.height
287
+ // node.x,
288
+ // node.y
289
+ ), U(x, s);
290
+ } else
291
+ t.children(f).length > 0 ? (i.trace(
292
+ "Cluster - the non recursive path XBX",
293
+ f,
294
+ s.id,
295
+ s,
296
+ s.width,
297
+ "Graph:",
298
+ t
299
+ ), i.trace(C(s.id, t)), d.set(s.id, { id: C(s.id, t), node: s })) : (i.trace("Node - the non recursive path XAX", f, X, t.node(f), l), await $(X, t.node(f), { config: o, dir: l }));
300
+ })
301
+ ), await (/* @__PURE__ */ w(async () => {
302
+ const f = t.edges().map(async function(s) {
303
+ const g = t.edge(s.v, s.w, s.name);
304
+ i.info("Edge " + s.v + " -> " + s.w + ": " + JSON.stringify(s)), i.info("Edge " + s.v + " -> " + s.w + ": ", s, " ", JSON.stringify(t.edge(s))), i.info(
305
+ "Fix",
306
+ d,
307
+ "ids:",
308
+ s.v,
309
+ s.w,
310
+ "Translating: ",
311
+ d.get(s.v),
312
+ d.get(s.w)
313
+ ), await Z(v, g);
314
+ });
315
+ await Promise.all(f);
316
+ }, "processEdges"))(), i.info("Graph before layout:", JSON.stringify(h(t))), i.info("############################################# XXX"), i.info("### Layout ### XXX"), i.info("############################################# XXX"), I(t), i.info("Graph after layout:", JSON.stringify(h(t)));
317
+ let O = 0, { subGraphTitleTotalMargin: S } = q(o);
318
+ return await Promise.all(
319
+ oe(t).map(async function(f) {
320
+ const s = t.node(f);
321
+ if (i.info(
322
+ "Position XBX => " + f + ": (" + s.x,
323
+ "," + s.y,
324
+ ") width: ",
325
+ s.width,
326
+ " height: ",
327
+ s.height
328
+ ), s?.clusterNode)
329
+ s.y += S, i.info(
330
+ "A tainted cluster node XBX1",
331
+ f,
332
+ s.id,
333
+ s.width,
334
+ s.height,
335
+ s.x,
336
+ s.y,
337
+ t.parent(f)
338
+ ), d.get(s.id).node = s, P(s);
339
+ else if (t.children(f).length > 0) {
340
+ i.info(
341
+ "A pure cluster node XBX1",
342
+ f,
343
+ s.id,
344
+ s.x,
345
+ s.y,
346
+ s.width,
347
+ s.height,
348
+ t.parent(f)
349
+ ), s.height += S, t.node(s.parentId);
350
+ const g = s?.padding / 2 || 0, p = s?.labelBBox?.height || 0, N = p - g || 0;
351
+ i.debug("OffsetY", N, "labelHeight", p, "halfPadding", g), await K(c, s), d.get(s.id).node = s;
352
+ } else {
353
+ const g = t.node(s.parentId);
354
+ s.y += S / 2, i.info(
355
+ "A regular node XBX1 - using the padding",
356
+ s.id,
357
+ "parent",
358
+ s.parentId,
359
+ s.width,
360
+ s.height,
361
+ s.x,
362
+ s.y,
363
+ "offsetY",
364
+ s.offsetY,
365
+ "parent",
366
+ g,
367
+ g?.offsetY,
368
+ s
369
+ ), P(s);
370
+ }
371
+ })
372
+ ), t.edges().forEach(function(f) {
373
+ const s = t.edge(f);
374
+ i.info("Edge " + f.v + " -> " + f.w + ": " + JSON.stringify(s), s), s.points.forEach((x) => x.y += S / 2);
375
+ const g = t.node(f.v);
376
+ var p = t.node(f.w);
377
+ const N = Q(m, s, d, n, g, p, a);
378
+ W(s, N);
379
+ }), t.nodes().forEach(function(f) {
380
+ const s = t.node(f);
381
+ i.info(f, s.type, s.diff), s.isGroup && (O = s.diff);
382
+ }), i.warn("Returning from recursive render XAX", u, O), { elem: u, diff: O };
383
+ }, "recursiveRender"), ue = /* @__PURE__ */ w(async (e, t) => {
384
+ const n = new B({
385
+ multigraph: !0,
386
+ compound: !0
387
+ }).setGraph({
388
+ rankdir: e.direction,
389
+ nodesep: e.config?.nodeSpacing || e.config?.flowchart?.nodeSpacing || e.nodeSpacing,
390
+ ranksep: e.config?.rankSpacing || e.config?.flowchart?.rankSpacing || e.rankSpacing,
391
+ marginx: 8,
392
+ marginy: 8
393
+ }).setDefaultEdgeLabel(function() {
394
+ return {};
395
+ }), a = t.select("g");
396
+ F(a, e.markers, e.type, e.diagramId), Y(), _(), H(), te(), e.nodes.forEach((o) => {
397
+ n.setNode(o.id, { ...o }), o.parentId && n.setParent(o.id, o.parentId);
398
+ }), i.debug("Edges:", e.edges), e.edges.forEach((o) => {
399
+ if (o.start === o.end) {
400
+ const l = o.start, u = l + "---" + l + "---1", c = l + "---" + l + "---2", m = n.node(l);
401
+ n.setNode(u, {
402
+ domId: u,
403
+ id: u,
404
+ parentId: m.parentId,
405
+ labelStyle: "",
406
+ label: "",
407
+ padding: 0,
408
+ shape: "labelRect",
409
+ // shape: 'rect',
410
+ style: "",
411
+ width: 10,
412
+ height: 10
413
+ }), n.setParent(u, m.parentId), n.setNode(c, {
414
+ domId: c,
415
+ id: c,
416
+ parentId: m.parentId,
417
+ labelStyle: "",
418
+ padding: 0,
419
+ // shape: 'rect',
420
+ shape: "labelRect",
421
+ label: "",
422
+ style: "",
423
+ width: 10,
424
+ height: 10
425
+ }), n.setParent(c, m.parentId);
426
+ const v = structuredClone(o), X = structuredClone(o), E = structuredClone(o);
427
+ v.label = "", v.arrowTypeEnd = "none", v.id = l + "-cyclic-special-1", X.arrowTypeStart = "none", X.arrowTypeEnd = "none", X.id = l + "-cyclic-special-mid", E.label = "", m.isGroup && (v.fromCluster = l, E.toCluster = l), E.id = l + "-cyclic-special-2", E.arrowTypeStart = "none", n.setEdge(l, u, v, l + "-cyclic-special-0"), n.setEdge(u, c, X, l + "-cyclic-special-1"), n.setEdge(c, l, E, l + "-cyc<lic-special-2");
428
+ } else
429
+ n.setEdge(o.start, o.end, { ...o }, o.id);
430
+ }), i.warn("Graph at first:", JSON.stringify(h(n))), re(n), i.warn("Graph after XAX:", JSON.stringify(h(n)));
431
+ const r = V();
432
+ await j(
433
+ a,
434
+ n,
435
+ e.type,
436
+ e.diagramId,
437
+ void 0,
438
+ r
439
+ );
440
+ }, "render");
441
+ export {
442
+ ue as render
443
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-BwYOYPeK.js"),se=require("./chunk-QN33PNHL-MX1ZMWu-.js"),ie=require("./chunk-4BX2VUAB-MnK73C0-.js"),oe=require("./mermaid-parser.core-BVlc9Lqd.js"),I=require("./defaultLocale-C4wbwF1n.js"),U=require("./ordinal-CPpcdEvZ.js");function ce(a){var t=0,l=a.children,n=l&&l.length;if(!n)t=1;else for(;--n>=0;)t+=l[n].value;a.value=t}function de(){return this.eachAfter(ce)}function ue(a,t){let l=-1;for(const n of this)a.call(t,n,++l,this);return this}function he(a,t){for(var l=this,n=[l],o,s,d=-1;l=n.pop();)if(a.call(t,l,++d,this),o=l.children)for(s=o.length-1;s>=0;--s)n.push(o[s]);return this}function pe(a,t){for(var l=this,n=[l],o=[],s,d,h,m=-1;l=n.pop();)if(o.push(l),s=l.children)for(d=0,h=s.length;d<h;++d)n.push(s[d]);for(;l=o.pop();)a.call(t,l,++m,this);return this}function fe(a,t){let l=-1;for(const n of this)if(a.call(t,n,++l,this))return n}function ge(a){return this.eachAfter(function(t){for(var l=+a(t.data)||0,n=t.children,o=n&&n.length;--o>=0;)l+=n[o].value;t.value=l})}function me(a){return this.eachBefore(function(t){t.children&&t.children.sort(a)})}function ye(a){for(var t=this,l=Se(t,a),n=[t];t!==l;)t=t.parent,n.push(t);for(var o=n.length;a!==l;)n.splice(o,0,a),a=a.parent;return n}function Se(a,t){if(a===t)return a;var l=a.ancestors(),n=t.ancestors(),o=null;for(a=l.pop(),t=n.pop();a===t;)o=a,a=l.pop(),t=n.pop();return o}function ve(){for(var a=this,t=[a];a=a.parent;)t.push(a);return t}function xe(){return Array.from(this)}function be(){var a=[];return this.eachBefore(function(t){t.children||a.push(t)}),a}function we(){var a=this,t=[];return a.each(function(l){l!==a&&t.push({source:l.parent,target:l})}),t}function*Ce(){var a=this,t,l=[a],n,o,s;do for(t=l.reverse(),l=[];a=t.pop();)if(yield a,n=a.children)for(o=0,s=n.length;o<s;++o)l.push(n[o]);while(l.length)}function Q(a,t){a instanceof Map?(a=[void 0,a],t===void 0&&(t=Le)):t===void 0&&(t=Te);for(var l=new j(a),n,o=[l],s,d,h,m;n=o.pop();)if((d=t(n.data))&&(m=(d=Array.from(d)).length))for(n.children=d,h=m-1;h>=0;--h)o.push(s=d[h]=new j(d[h])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ae)}function _e(){return Q(this).eachBefore($e)}function Te(a){return a.children}function Le(a){return Array.isArray(a)?a[1]:null}function $e(a){a.data.value!==void 0&&(a.value=a.data.value),a.data=a.data.data}function Ae(a){var t=0;do a.height=t;while((a=a.parent)&&a.height<++t)}function j(a){this.data=a,this.depth=this.height=0,this.parent=null}j.prototype=Q.prototype={constructor:j,count:de,each:ue,eachAfter:pe,eachBefore:he,find:fe,sum:ge,sort:me,path:ye,ancestors:ve,descendants:xe,leaves:be,links:we,copy:_e,[Symbol.iterator]:Ce};function ke(a){if(typeof a!="function")throw new Error;return a}function q(){return 0}function O(a){return function(){return a}}function Ne(a){a.x0=Math.round(a.x0),a.y0=Math.round(a.y0),a.x1=Math.round(a.x1),a.y1=Math.round(a.y1)}function Me(a,t,l,n,o){for(var s=a.children,d,h=-1,m=s.length,c=a.value&&(n-t)/a.value;++h<m;)d=s[h],d.y0=l,d.y1=o,d.x0=t,d.x1=t+=d.value*c}function Fe(a,t,l,n,o){for(var s=a.children,d,h=-1,m=s.length,c=a.value&&(o-l)/a.value;++h<m;)d=s[h],d.x0=t,d.x1=n,d.y0=l,d.y1=l+=d.value*c}var ze=(1+Math.sqrt(5))/2;function Ve(a,t,l,n,o,s){for(var d=[],h=t.children,m,c,p=0,w=0,r=h.length,b,v,x=t.value,f,y,N,k,V,R,M;p<r;){b=o-l,v=s-n;do f=h[w++].value;while(!f&&w<r);for(y=N=f,R=Math.max(v/b,b/v)/(x*a),M=f*f*R,V=Math.max(N/M,M/y);w<r;++w){if(f+=c=h[w].value,c<y&&(y=c),c>N&&(N=c),M=f*f*R,k=Math.max(N/M,M/y),k>V){f-=c;break}V=k}d.push(m={value:f,dice:b<v,children:h.slice(p,w)}),m.dice?Me(m,l,n,o,x?n+=v*f/x:s):Fe(m,l,n,x?l+=b*f/x:o,s),x-=f,p=w}return d}const Pe=(function a(t){function l(n,o,s,d,h){Ve(t,n,o,s,d,h)}return l.ratio=function(n){return a((n=+n)>1?n:1)},l})(ze);function Be(){var a=Pe,t=!1,l=1,n=1,o=[0],s=q,d=q,h=q,m=q,c=q;function p(r){return r.x0=r.y0=0,r.x1=l,r.y1=n,r.eachBefore(w),o=[0],t&&r.eachBefore(Ne),r}function w(r){var b=o[r.depth],v=r.x0+b,x=r.y0+b,f=r.x1-b,y=r.y1-b;f<v&&(v=f=(v+f)/2),y<x&&(x=y=(x+y)/2),r.x0=v,r.y0=x,r.x1=f,r.y1=y,r.children&&(b=o[r.depth+1]=s(r)/2,v+=c(r)-b,x+=d(r)-b,f-=h(r)-b,y-=m(r)-b,f<v&&(v=f=(v+f)/2),y<x&&(x=y=(x+y)/2),a(r,v,x,f,y))}return p.round=function(r){return arguments.length?(t=!!r,p):t},p.size=function(r){return arguments.length?(l=+r[0],n=+r[1],p):[l,n]},p.tile=function(r){return arguments.length?(a=ke(r),p):a},p.padding=function(r){return arguments.length?p.paddingInner(r).paddingOuter(r):p.paddingInner()},p.paddingInner=function(r){return arguments.length?(s=typeof r=="function"?r:O(+r),p):s},p.paddingOuter=function(r){return arguments.length?p.paddingTop(r).paddingRight(r).paddingBottom(r).paddingLeft(r):p.paddingTop()},p.paddingTop=function(r){return arguments.length?(d=typeof r=="function"?r:O(+r),p):d},p.paddingRight=function(r){return arguments.length?(h=typeof r=="function"?r:O(+r),p):h},p.paddingBottom=function(r){return arguments.length?(m=typeof r=="function"?r:O(+r),p):m},p.paddingLeft=function(r){return arguments.length?(c=typeof r=="function"?r:O(+r),p):c},p}var D,J=(D=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=u.setAccTitle,this.getAccTitle=u.getAccTitle,this.setDiagramTitle=u.setDiagramTitle,this.getDiagramTitle=u.getDiagramTitle,this.getAccDescription=u.getAccDescription,this.setAccDescription=u.setAccDescription}getNodes(){return this.nodes}getConfig(){const t=u.defaultConfig_default,l=u.getConfig();return u.cleanAndMerge({...t.treemap,...l.treemap??{}})}addNode(t,l){this.nodes.push(t),this.levels.set(t,l),l===0&&(this.outerNodes.push(t),this.root??=t)}getRoot(){return{name:"",children:this.outerNodes}}addClass(t,l){const n=this.classes.get(t)??{id:t,styles:[],textStyles:[]},o=l.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");o&&o.forEach(s=>{u.isLabelStyle(s)&&(n?.textStyles?n.textStyles.push(s):n.textStyles=[s]),n?.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(t,n)}getClasses(){return this.classes}getStylesForClass(t){return this.classes.get(t)?.styles??[]}clear(){u.clear(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},u.__name(D,"TreeMapDB"),D);function K(a){if(!a.length)return[];const t=[],l=[];return a.forEach(n=>{const o={name:n.name,children:n.type==="Leaf"?void 0:[]};for(o.classSelector=n?.classSelector,n?.cssCompiledStyles&&(o.cssCompiledStyles=[n.cssCompiledStyles]),n.type==="Leaf"&&n.value!==void 0&&(o.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)t.push(o);else{const s=l[l.length-1].node;s.children?s.children.push(o):s.children=[o]}n.type!=="Leaf"&&l.push({node:o,level:n.level})}),t}u.__name(K,"buildHierarchy");var De=u.__name((a,t)=>{ie.populateCommonDb(a,t);const l=[];for(const s of a.TreemapRows??[])s.$type==="ClassDefStatement"&&t.addClass(s.className??"",s.styleText??"");for(const s of a.TreemapRows??[]){const d=s.item;if(!d)continue;const h=s.indent?parseInt(s.indent):0,m=Re(d),c=d.classSelector?t.getStylesForClass(d.classSelector):[],p=c.length>0?c.join(";"):void 0,w={level:h,name:m,type:d.$type,value:d.value,classSelector:d.classSelector,cssCompiledStyles:p};l.push(w)}const n=K(l),o=u.__name((s,d)=>{for(const h of s)t.addNode(h,d),h.children&&h.children.length>0&&o(h.children,d+1)},"addNodesRecursively");o(n,0)},"populate"),Re=u.__name(a=>a.name?String(a.name):"","getItemName"),ee={parser:{yy:void 0},parse:u.__name(async a=>{try{const t=oe.parse,l=await t("treemap",a);u.log.debug("Treemap AST:",l);const n=ee.parser?.yy;if(!(n instanceof J))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");De(l,n)}catch(t){throw u.log.error("Error parsing treemap:",t),t}},"parse")},Ee=10,B=10,G=25,We=u.__name((a,t,l,n)=>{const o=n.db,s=o.getConfig(),d=s.padding??Ee,h=o.getDiagramTitle(),m=o.getRoot(),{themeVariables:c}=u.getConfig();if(!m)return;const p=h?30:0,w=u.selectSvgElement(t),r=s.nodeWidth?s.nodeWidth*B:960,b=s.nodeHeight?s.nodeHeight*B:500,v=r,x=b+p;w.attr("viewBox",`0 0 ${v} ${x}`),u.configureSvgSize(w,x,v,s.useMaxWidth);let f;try{const e=s.valueFormat||",";if(e==="$0,0")f=u.__name(i=>"$"+I.format(",")(i),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const i=/\.\d+/.exec(e),g=i?i[0]:"";f=u.__name(C=>"$"+I.format(","+g)(C),"valueFormat")}else if(e.startsWith("$")){const i=e.substring(1);f=u.__name(g=>"$"+I.format(i||"")(g),"valueFormat")}else f=I.format(e)}catch(e){u.log.error("Error creating format function:",e),f=I.format(",")}const y=U.ordinal().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=U.ordinal().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),k=U.ordinal().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);h&&w.append("text").attr("x",v/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(h);const V=w.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),R=Q(m).sum(e=>e.value??0).sort((e,i)=>(i.value??0)-(e.value??0)),Z=Be().size([r,b]).paddingTop(e=>e.children&&e.children.length>0?G+B:0).paddingInner(d).paddingLeft(e=>e.children&&e.children.length>0?B:0).paddingRight(e=>e.children&&e.children.length>0?B:0).paddingBottom(e=>e.children&&e.children.length>0?B:0).round(!0)(R),te=Z.descendants().filter(e=>e.children&&e.children.length>0),E=V.selectAll(".treemapSection").data(te).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);E.append("rect").attr("width",e=>e.x1-e.x0).attr("height",G).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),E.append("clipPath").attr("id",(e,i)=>`clip-section-${t}-${i}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",G),E.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,i)=>`treemapSection section${i}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const i=u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return i.nodeStyles+";"+i.borderStyles.join(";")}),E.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",G/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("style",e=>{if(e.depth===0)return"display: none;";const i="dominant-baseline: middle; font-size: 12px; fill:"+k(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",g=u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return i+g.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const i=u.select(this),g=e.data.name;i.text(g);const C=e.x1-e.x0,T=6;let L;s.showValues!==!1&&e.value?L=C-10-30-10-T:L=C-T-6;const $=Math.max(15,L),S=i.node();if(S.getComputedTextLength()>$){let _=g;for(;_.length>0;){if(_=g.substring(0,_.length-1),_.length===0){i.text("..."),S.getComputedTextLength()>$&&i.text("");break}if(i.text(_+"..."),S.getComputedTextLength()<=$)break}}}),s.showValues!==!1&&E.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",G/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?f(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const i="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+k(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",g=u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return i+g.labelStyles.replace("color:","fill:")});const ae=Z.leaves(),X=V.selectAll(".treemapLeafGroup").data(ae).enter().append("g").attr("class",(e,i)=>`treemapNode treemapLeafGroup leaf${i}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);X.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),X.append("clipPath").attr("id",(e,i)=>`clip-${t}-${i}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),X.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const i="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+k(e.data.name)+";",g=u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return i+g.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,i)=>`url(#clip-${t}-${i})`).text(e=>e.data.name).each(function(e){const i=u.select(this),g=e.x1-e.x0,C=e.y1-e.y0,T=i.node(),L=4,P=g-2*L,$=C-2*L;if(P<10||$<10){i.style("display","none");return}let S=parseInt(i.style("font-size"),10);const F=8,A=28,_=.6,z=6,W=2;for(;T.getComputedTextLength()>P&&S>F;)S--,i.style("font-size",`${S}px`);let H=Math.max(z,Math.min(A,Math.round(S*_))),Y=S+W+H;for(;Y>$&&S>F&&(S--,H=Math.max(z,Math.min(A,Math.round(S*_))),!(H<z&&S===F));)i.style("font-size",`${S}px`),Y=S+W+H;i.style("font-size",`${S}px`),(T.getComputedTextLength()>P||S<F||$<S)&&i.style("display","none")}),s.showValues!==!1&&X.append("text").attr("class","treemapValue").attr("x",i=>(i.x1-i.x0)/2).attr("y",function(i){return(i.y1-i.y0)/2}).attr("style",i=>{const g="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+k(i.data.name)+";",C=u.styles2String({cssCompiledStyles:i.data.cssCompiledStyles});return g+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(i,g)=>`url(#clip-${t}-${g})`).text(i=>i.value?f(i.value):"").each(function(i){const g=u.select(this),C=this.parentNode;if(!C){g.style("display","none");return}const T=u.select(C).select(".treemapLabel");if(T.empty()||T.style("display")==="none"){g.style("display","none");return}const L=parseFloat(T.style("font-size")),P=28,$=.6,S=6,F=2,A=Math.max(S,Math.min(P,Math.round(L*$)));g.style("font-size",`${A}px`);const z=(i.y1-i.y0)/2+L/2+F;g.attr("y",z);const W=i.x1-i.x0,le=i.y1-i.y0-4,re=W-8;g.node().getComputedTextLength()>re||z+A>le||A<S?g.style("display","none"):g.style("display",null)});const ne=s.diagramPadding??8;se.setupViewPortForSVG(w,ne,"flowchart",s?.useMaxWidth||!1)},"draw"),He=u.__name(function(a,t){return t.db.getClasses()},"getClasses"),Ie={draw:We,getClasses:He},qe={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelColor:"black",labelFontSize:"12px",valueFontSize:"10px",valueColor:"black",titleColor:"black",titleFontSize:"14px"},Oe=u.__name(({treemap:a}={})=>{const t=u.cleanAndMerge(qe,a);return`
2
+ .treemapNode.section {
3
+ stroke: ${t.sectionStrokeColor};
4
+ stroke-width: ${t.sectionStrokeWidth};
5
+ fill: ${t.sectionFillColor};
6
+ }
7
+ .treemapNode.leaf {
8
+ stroke: ${t.leafStrokeColor};
9
+ stroke-width: ${t.leafStrokeWidth};
10
+ fill: ${t.leafFillColor};
11
+ }
12
+ .treemapLabel {
13
+ fill: ${t.labelColor};
14
+ font-size: ${t.labelFontSize};
15
+ }
16
+ .treemapValue {
17
+ fill: ${t.valueColor};
18
+ font-size: ${t.valueFontSize};
19
+ }
20
+ .treemapTitle {
21
+ fill: ${t.titleColor};
22
+ font-size: ${t.titleFontSize};
23
+ }
24
+ `},"getStyles"),Ge=Oe,Xe={parser:ee,get db(){return new J},renderer:Ie,styles:Ge};exports.diagram=Xe;