vue-data-ui 3.15.12 → 3.16.1

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 (218) hide show
  1. package/README.md +132 -59
  2. package/dist/A11yDataTable-KcVAX2cP.js +54 -0
  3. package/dist/{Arrow-DlPyR6HQ.js → Arrow-Bn-9n3bm.js} +1 -1
  4. package/dist/{BaseDraggableDialog-DSpKTn3R.js → BaseDraggableDialog-CIb-iD9g.js} +2 -2
  5. package/dist/{BaseIcon-CNx8Tzl5.js → BaseIcon-Cb3zzG6s.js} +1 -1
  6. package/dist/{BaseLegendToggle-Y61xahI4.js → BaseLegendToggle-BQVIawmA.js} +1 -1
  7. package/dist/{BaseZoomControls-CoFievy9.js → BaseZoomControls-DievbOeJ.js} +2 -2
  8. package/dist/ColorPicker-B0mV4xzu.js +255 -0
  9. package/dist/{DataTable-Bo1pmAqG.js → DataTable-DT2kIdQ6.js} +2 -2
  10. package/dist/Legend-CS7Xo5LK.js +101 -0
  11. package/dist/{NonSvgPenAndPaper-CGk_xThe.js → NonSvgPenAndPaper-VyJFyJ6X.js} +3 -3
  12. package/dist/{PackageVersion-DN9d0ME5.js → PackageVersion-DPO-OOVI.js} +1 -1
  13. package/dist/{PenAndPaper-DWV1FMIi.js → PenAndPaper-Ct3qJ4lA.js} +109 -101
  14. package/dist/{Shape-CSyWYgXc.js → Shape-BKRUOeKk.js} +1 -1
  15. package/dist/{Slicer-DZJA9IG-.js → Slicer-DUycDH_N.js} +2 -2
  16. package/dist/{SlicerPreview-I2J0UUF_.js → SlicerPreview-DTjwV0iY.js} +2 -2
  17. package/dist/{SparkTooltip-BiseJed3.js → SparkTooltip-BorBpltj.js} +1 -1
  18. package/dist/{Title-BfyrP-jp.js → Title-BeMKE1cj.js} +1 -1
  19. package/dist/{Tooltip-DL3QgjZf.js → Tooltip-Bf-kM3_A.js} +86 -68
  20. package/dist/{UserOptions-CrLqEimB.js → UserOptions-rW2fRf3V.js} +228 -222
  21. package/dist/components/arrow.js +1 -1
  22. package/dist/components/vue-ui-3d-bar.js +1 -1
  23. package/dist/components/vue-ui-accordion.js +1 -1
  24. package/dist/components/vue-ui-age-pyramid.js +1 -1
  25. package/dist/components/vue-ui-annotator.js +1 -1
  26. package/dist/components/vue-ui-bullet.js +1 -1
  27. package/dist/components/vue-ui-bump.js +1 -1
  28. package/dist/components/vue-ui-candlestick.js +1 -1
  29. package/dist/components/vue-ui-carousel-table.js +1 -1
  30. package/dist/components/vue-ui-chestnut.js +1 -1
  31. package/dist/components/vue-ui-chord.js +1 -1
  32. package/dist/components/vue-ui-circle-pack.js +1 -1
  33. package/dist/components/vue-ui-cursor.js +1 -1
  34. package/dist/components/vue-ui-dag.js +1 -1
  35. package/dist/components/vue-ui-dashboard.js +1 -1
  36. package/dist/components/vue-ui-digits.js +1 -1
  37. package/dist/components/vue-ui-donut-evolution.js +1 -1
  38. package/dist/components/vue-ui-donut.js +1 -1
  39. package/dist/components/vue-ui-dumbbell.js +1 -1
  40. package/dist/components/vue-ui-flow.js +1 -1
  41. package/dist/components/vue-ui-funnel.js +1 -1
  42. package/dist/components/vue-ui-galaxy.js +1 -1
  43. package/dist/components/vue-ui-gauge.js +1 -1
  44. package/dist/components/vue-ui-geo.js +1 -1
  45. package/dist/components/vue-ui-gizmo.js +1 -1
  46. package/dist/components/vue-ui-heatmap.js +1 -1
  47. package/dist/components/vue-ui-history-plot.js +1 -1
  48. package/dist/components/vue-ui-horizontal-bar.js +1 -1
  49. package/dist/components/vue-ui-icon.js +1 -1
  50. package/dist/components/vue-ui-kpi.js +1 -1
  51. package/dist/components/vue-ui-mini-loader.js +1 -1
  52. package/dist/components/vue-ui-molecule.js +1 -1
  53. package/dist/components/vue-ui-mood-radar.js +1 -1
  54. package/dist/components/vue-ui-nested-donuts.js +1 -1
  55. package/dist/components/vue-ui-onion.js +1 -1
  56. package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
  57. package/dist/components/vue-ui-quadrant.js +1 -1
  58. package/dist/components/vue-ui-quick-chart.js +1 -1
  59. package/dist/components/vue-ui-radar.js +1 -1
  60. package/dist/components/vue-ui-rating.js +1 -1
  61. package/dist/components/vue-ui-relation-circle.js +1 -1
  62. package/dist/components/vue-ui-ridgeline.js +1 -1
  63. package/dist/components/vue-ui-rings.js +1 -1
  64. package/dist/components/vue-ui-scatter.js +1 -1
  65. package/dist/components/vue-ui-skeleton.js +1 -1
  66. package/dist/components/vue-ui-smiley.js +1 -1
  67. package/dist/components/vue-ui-spark-trend.js +1 -1
  68. package/dist/components/vue-ui-sparkbar.js +1 -1
  69. package/dist/components/vue-ui-sparkgauge.js +1 -1
  70. package/dist/components/vue-ui-sparkhistogram.js +1 -1
  71. package/dist/components/vue-ui-sparkline.js +1 -1
  72. package/dist/components/vue-ui-sparkstackbar.js +1 -1
  73. package/dist/components/vue-ui-stackbar.js +1 -1
  74. package/dist/components/vue-ui-stackline.js +1 -1
  75. package/dist/components/vue-ui-strip-plot.js +1 -1
  76. package/dist/components/vue-ui-table-heatmap.js +1 -1
  77. package/dist/components/vue-ui-table-sparkline.js +1 -1
  78. package/dist/components/vue-ui-table.js +1 -1
  79. package/dist/components/vue-ui-thermometer.js +1 -1
  80. package/dist/components/vue-ui-timer.js +1 -1
  81. package/dist/components/vue-ui-tiremarks.js +1 -1
  82. package/dist/components/vue-ui-treemap.js +1 -1
  83. package/dist/components/vue-ui-vertical-bar.js +1 -1
  84. package/dist/components/vue-ui-waffle.js +1 -1
  85. package/dist/components/vue-ui-wheel.js +1 -1
  86. package/dist/components/vue-ui-word-cloud.js +1 -1
  87. package/dist/components/vue-ui-world.js +1 -1
  88. package/dist/components/vue-ui-xy-canvas.js +1 -1
  89. package/dist/components/vue-ui-xy.js +1 -1
  90. package/dist/{dom-to-png-BAqzNjb1.js → dom-to-png-CtxhhdWb.js} +1 -1
  91. package/dist/{exposedLib-H4lmBl1t.js → exposedLib-DlqmhBx3.js} +1 -1
  92. package/dist/{img-BYYzY_QU.js → img-LXxMLmCg.js} +1 -1
  93. package/dist/{labelUtils-CTXUc3V9.js → labelUtils-CqTHa20R.js} +1 -1
  94. package/dist/{lib-GwPnJSrY.js → lib-DBptbyyI.js} +106 -84
  95. package/dist/{pdf-z-YiJeJQ.js → pdf-B4tTdfvl.js} +1 -1
  96. package/dist/style.css +1 -1
  97. package/dist/types/vue-data-ui.d.ts +59 -0
  98. package/dist/{useAutoSizeLabelsInsideViewbox-80fzdfxt.js → useAutoSizeLabelsInsideViewbox-DX7LdvFX.js} +1 -1
  99. package/dist/{useConfig-CIgyKZ6R.js → useConfig-DO94Aj5s.js} +953 -700
  100. package/dist/{useNestedProp-BBT0mbHh.js → useNestedProp-Bf5XFbs8.js} +1 -1
  101. package/dist/{useObjectBindings-BlXBVtRa.js → useObjectBindings-DQ8g8Jwi.js} +1 -1
  102. package/dist/usePrefersMotion-CUKm8_t8.js +15 -0
  103. package/dist/{usePrinter-DiK5R6k-.js → usePrinter-CEpYU3r5.js} +2 -2
  104. package/dist/utils.js +3 -3
  105. package/dist/{vue-data-ui-C2kPofmi.js → vue-data-ui-DXGkXRnC.js} +68 -68
  106. package/dist/vue-data-ui.js +72 -72
  107. package/dist/vue-ui-3d-bar-BaFpQnd5.js +1597 -0
  108. package/dist/{vue-ui-accordion-BGHTqIBt.js → vue-ui-accordion-nvggWcGN.js} +4 -4
  109. package/dist/vue-ui-age-pyramid-CRM498Pc.js +1069 -0
  110. package/dist/{vue-ui-annotator-B1GWVtPp.js → vue-ui-annotator-CkPi9moo.js} +7 -7
  111. package/dist/{vue-ui-bullet-DPoGGtaG.js → vue-ui-bullet-BBiwof3c.js} +158 -150
  112. package/dist/vue-ui-bump-Brxpu4xV.js +1147 -0
  113. package/dist/vue-ui-candlestick-DAnZv77-.js +1587 -0
  114. package/dist/{vue-ui-carousel-table-CmiHTJ8E.js → vue-ui-carousel-table-BHRZBYY0.js} +168 -160
  115. package/dist/vue-ui-chestnut-CbrYnRgm.js +1812 -0
  116. package/dist/vue-ui-chord-CaX_IUVs.js +1326 -0
  117. package/dist/vue-ui-circle-pack-CR3h53sc.js +988 -0
  118. package/dist/{vue-ui-cursor-B4mHR7QC.js → vue-ui-cursor-Cjfazw7Z.js} +4 -4
  119. package/dist/vue-ui-dag-B9vH3c66.js +3047 -0
  120. package/dist/{vue-ui-dashboard-Bo5FX73U.js → vue-ui-dashboard-DWll05qs.js} +70 -70
  121. package/dist/{vue-ui-digits-mpo2IcM5.js → vue-ui-digits-DcM67rMx.js} +76 -66
  122. package/dist/vue-ui-donut-Be5G38P5.js +2229 -0
  123. package/dist/vue-ui-donut-evolution-BLSesj3c.js +1358 -0
  124. package/dist/vue-ui-dumbbell-DIMiCY4r.js +1380 -0
  125. package/dist/vue-ui-flow-zvZylhgr.js +1202 -0
  126. package/dist/{vue-ui-funnel-BRkaEkBb.js → vue-ui-funnel-CSri-oWm.js} +7 -7
  127. package/dist/vue-ui-galaxy-CGykxsAI.js +1012 -0
  128. package/dist/{vue-ui-gauge-J2VYHsQe.js → vue-ui-gauge-D1MNB9Jq.js} +8 -8
  129. package/dist/vue-ui-geo-DdJDGhG2.js +1437 -0
  130. package/dist/{vue-ui-gizmo-DEec3-v9.js → vue-ui-gizmo-BZYRHGFm.js} +77 -68
  131. package/dist/vue-ui-heatmap-CryOx6XK.js +1500 -0
  132. package/dist/vue-ui-history-plot-C85iw9Kl.js +1449 -0
  133. package/dist/vue-ui-horizontal-bar-BoBZOybC.js +1637 -0
  134. package/dist/vue-ui-kpi-DHrolXw6.js +109 -0
  135. package/dist/{vue-ui-mini-loader-CoOHvZUk.js → vue-ui-mini-loader-Bc3fEQ9j.js} +3 -3
  136. package/dist/{vue-ui-molecule-Chq1qWDK.js → vue-ui-molecule-DJ_BQ4DK.js} +6 -6
  137. package/dist/vue-ui-mood-radar-CBE02TpQ.js +1086 -0
  138. package/dist/vue-ui-nested-donuts-YTFtb4CL.js +1595 -0
  139. package/dist/vue-ui-onion-B9l81-PS.js +1124 -0
  140. package/dist/vue-ui-parallel-coordinate-plot-C1e_rs8J.js +1252 -0
  141. package/dist/vue-ui-quadrant-C1qsLCRn.js +1759 -0
  142. package/dist/vue-ui-quick-chart-DFoz3WiA.js +2216 -0
  143. package/dist/vue-ui-radar-Cmo3p-UA.js +1139 -0
  144. package/dist/{vue-ui-rating-zV58MDQh.js → vue-ui-rating-BAHhYt_A.js} +3 -3
  145. package/dist/vue-ui-relation-circle-BqwznVwf.js +782 -0
  146. package/dist/vue-ui-ridgeline-CDk9eXJq.js +1473 -0
  147. package/dist/vue-ui-rings-BRkGoQdL.js +1156 -0
  148. package/dist/vue-ui-scatter-BxDtWASQ.js +1831 -0
  149. package/dist/{vue-ui-skeleton-CbqNz9IE.js → vue-ui-skeleton-D6kTb9aO.js} +4 -4
  150. package/dist/{vue-ui-smiley-BK5EKp9u.js → vue-ui-smiley-CzVaLlpB.js} +3 -3
  151. package/dist/vue-ui-spark-trend-D8Mf2A1w.js +378 -0
  152. package/dist/{vue-ui-sparkbar-DUDWvTo-.js → vue-ui-sparkbar-BbYj56c3.js} +86 -84
  153. package/dist/vue-ui-sparkgauge-DXzOSLRb.js +256 -0
  154. package/dist/vue-ui-sparkhistogram-DMfSx1iH.js +474 -0
  155. package/dist/vue-ui-sparkline-D-rQ9PsC.js +1327 -0
  156. package/dist/vue-ui-sparkstackbar-DK5n8IKP.js +621 -0
  157. package/dist/vue-ui-stackbar-BHthy6jf.js +2070 -0
  158. package/dist/vue-ui-stackline-C6-WNpKD.js +2164 -0
  159. package/dist/vue-ui-strip-plot-CHu-1ilI.js +1183 -0
  160. package/dist/{vue-ui-table-BHuXI4Eq.js → vue-ui-table-DW9JGsLq.js} +6 -6
  161. package/dist/{vue-ui-table-heatmap-y88sBfu3.js → vue-ui-table-heatmap-LYqoBit9.js} +6 -6
  162. package/dist/{vue-ui-table-sparkline-ClpLLKi2.js → vue-ui-table-sparkline-CXK1dFr-.js} +5 -5
  163. package/dist/{vue-ui-thermometer-sjruUGQx.js → vue-ui-thermometer-BN8tflOz.js} +272 -256
  164. package/dist/{vue-ui-timer-CgdgMKIc.js → vue-ui-timer-DGT0UBOF.js} +6 -6
  165. package/dist/{vue-ui-tiremarks-UBDpAIVr.js → vue-ui-tiremarks-BZ-osQqY.js} +204 -191
  166. package/dist/vue-ui-treemap-98KaVRyd.js +1723 -0
  167. package/dist/vue-ui-waffle-Cb7oJnIc.js +1321 -0
  168. package/dist/vue-ui-wheel-sfew1fjw.js +738 -0
  169. package/dist/vue-ui-word-cloud-vq1t9JHr.js +1548 -0
  170. package/dist/{vue-ui-world-D-3wgoTn.js → vue-ui-world-CN0f6elD.js} +8 -8
  171. package/dist/vue-ui-xy-BdzEiImZ.js +3877 -0
  172. package/dist/vue-ui-xy-canvas-CWQzUQzY.js +1810 -0
  173. package/package.json +2 -2
  174. package/dist/ColorPicker-j0ySewhI.js +0 -244
  175. package/dist/Legend-1LMMsPxL.js +0 -90
  176. package/dist/vue-ui-3d-bar-BhNgFaJA.js +0 -1484
  177. package/dist/vue-ui-age-pyramid-CuYRf5v-.js +0 -997
  178. package/dist/vue-ui-bump-C_fKharc.js +0 -1059
  179. package/dist/vue-ui-candlestick-BY-_E7eZ.js +0 -1487
  180. package/dist/vue-ui-chestnut-C-bQYaNI.js +0 -1557
  181. package/dist/vue-ui-chord-uQYQgyGM.js +0 -1220
  182. package/dist/vue-ui-circle-pack-CdbDcuDw.js +0 -907
  183. package/dist/vue-ui-dag-DsHUvjvm.js +0 -2885
  184. package/dist/vue-ui-donut-CzCgCVsx.js +0 -2139
  185. package/dist/vue-ui-donut-evolution-C_ck_TOR.js +0 -1297
  186. package/dist/vue-ui-dumbbell-CVSA90b2.js +0 -1293
  187. package/dist/vue-ui-flow-CsbSaFnu.js +0 -1075
  188. package/dist/vue-ui-galaxy-DWKHDciu.js +0 -914
  189. package/dist/vue-ui-geo-DykhEWVq.js +0 -1331
  190. package/dist/vue-ui-heatmap-BEDirv8T.js +0 -1334
  191. package/dist/vue-ui-history-plot-Bs96PebH.js +0 -1292
  192. package/dist/vue-ui-horizontal-bar-ClQcB9nL.js +0 -1522
  193. package/dist/vue-ui-kpi-DlUEHKuw.js +0 -101
  194. package/dist/vue-ui-mood-radar-A2LBLgUi.js +0 -967
  195. package/dist/vue-ui-nested-donuts-DFX251aT.js +0 -1513
  196. package/dist/vue-ui-onion-CW0YO9Ro.js +0 -1045
  197. package/dist/vue-ui-parallel-coordinate-plot-UFg10bHP.js +0 -1134
  198. package/dist/vue-ui-quadrant-C1pLW2zA.js +0 -1647
  199. package/dist/vue-ui-quick-chart-FaxttnJY.js +0 -2030
  200. package/dist/vue-ui-radar-DE70LPBZ.js +0 -1067
  201. package/dist/vue-ui-relation-circle-iuRXIyRU.js +0 -704
  202. package/dist/vue-ui-ridgeline-CwvDh5pG.js +0 -1385
  203. package/dist/vue-ui-rings-80ZUki42.js +0 -1083
  204. package/dist/vue-ui-scatter-FdAAYJOK.js +0 -1670
  205. package/dist/vue-ui-spark-trend-C68p8-Xp.js +0 -349
  206. package/dist/vue-ui-sparkgauge-DdRtHQDe.js +0 -245
  207. package/dist/vue-ui-sparkhistogram-C9DvzQae.js +0 -396
  208. package/dist/vue-ui-sparkline-B2RDrdiR.js +0 -1273
  209. package/dist/vue-ui-sparkstackbar-BsIOHUE5.js +0 -475
  210. package/dist/vue-ui-stackbar-BZl0kEkb.js +0 -2001
  211. package/dist/vue-ui-stackline-2VKxwFei.js +0 -2099
  212. package/dist/vue-ui-strip-plot-B9nBSRyY.js +0 -1080
  213. package/dist/vue-ui-treemap-BS5EilZf.js +0 -1645
  214. package/dist/vue-ui-waffle-CbX5K9Q2.js +0 -1211
  215. package/dist/vue-ui-wheel-BIJ09H5D.js +0 -723
  216. package/dist/vue-ui-word-cloud-DJmJ-oYT.js +0 -1466
  217. package/dist/vue-ui-xy-canvas-4auyhlTr.js +0 -1717
  218. package/dist/vue-ui-xy-f67V1xjd.js +0 -3713
@@ -0,0 +1,3047 @@
1
+ import { ref as C, watchEffect as Bo, unref as y, defineAsyncComponent as _t, computed as I, toRefs as zo, onMounted as vn, nextTick as Se, watch as ze, onBeforeUnmount as gn, openBlock as S, createElementBlock as L, normalizeStyle as Le, normalizeClass as pn, createElementVNode as X, toDisplayString as Me, createBlock as oe, createCommentVNode as $, withCtx as V, renderSlot as R, normalizeProps as H, guardReactiveProps as W, createSlots as Vo, createVNode as Ct, Fragment as ge, renderList as Ve, mergeProps as Te, withModifiers as yn, createTextVNode as Ho, Transition as wn, Teleport as bn } from "vue";
2
+ import { j as $t, aF as Wo, t as kn, o as Go, q as En, s as _n, X as jo, as as Yo } from "./lib-DBptbyyI.js";
3
+ import { t as Uo, u as Zo } from "./useResponsive-DfdjqQps.js";
4
+ import { u as Xo } from "./usePanZoom-CDF7rb3o.js";
5
+ import { u as Ko } from "./useConfig-DO94Aj5s.js";
6
+ import { u as qo, B as Jo } from "./BaseScanner-BhhkKVoj.js";
7
+ import { u as Qo } from "./usePrinter-CEpYU3r5.js";
8
+ import { u as es } from "./useSvgExport-ByUukOZt.js";
9
+ import { u as xt } from "./useNestedProp-Bf5XFbs8.js";
10
+ import { u as ts } from "./useThemeCheck-D1ZYXUwG.js";
11
+ import { u as ns } from "./useUserOptionState-BIvW1Kz7.js";
12
+ import { u as os } from "./useChartAccessibility-9icAAmYg.js";
13
+ import ss from "./img-LXxMLmCg.js";
14
+ import is from "./Title-BeMKE1cj.js";
15
+ import rs from "./vue_ui_dag-ZOwuDBZ8.js";
16
+ import { A as as } from "./A11yDataTable-KcVAX2cP.js";
17
+ import { B as Cn } from "./BaseZoomControls-DievbOeJ.js";
18
+ import { _ as ls } from "./_plugin-vue_export-helper-CHgC5LLL.js";
19
+ const us = "\0", pe = "\0", xn = "";
20
+ class ue {
21
+ _isDirected = !0;
22
+ _isMultigraph = !1;
23
+ _isCompound = !1;
24
+ // Label for the graph itself
25
+ _label;
26
+ // Defaults to be set when creating a new node
27
+ _defaultNodeLabelFn = () => {
28
+ };
29
+ // Defaults to be set when creating a new edge
30
+ _defaultEdgeLabelFn = () => {
31
+ };
32
+ // v -> label
33
+ _nodes = {};
34
+ // v -> edgeObj
35
+ _in = {};
36
+ // u -> v -> Number
37
+ _preds = {};
38
+ // v -> edgeObj
39
+ _out = {};
40
+ // v -> w -> Number
41
+ _sucs = {};
42
+ // e -> edgeObj
43
+ _edgeObjs = {};
44
+ // e -> label
45
+ _edgeLabels = {};
46
+ /* Number of nodes in the graph. Should only be changed by the implementation. */
47
+ _nodeCount = 0;
48
+ /* Number of edges in the graph. Should only be changed by the implementation. */
49
+ _edgeCount = 0;
50
+ _parent;
51
+ _children;
52
+ constructor(t) {
53
+ t && (this._isDirected = Object.hasOwn(t, "directed") ? t.directed : !0, this._isMultigraph = Object.hasOwn(t, "multigraph") ? t.multigraph : !1, this._isCompound = Object.hasOwn(t, "compound") ? t.compound : !1), this._isCompound && (this._parent = {}, this._children = {}, this._children[pe] = {});
54
+ }
55
+ /* === Graph functions ========= */
56
+ /**
57
+ * Whether graph was created with 'directed' flag set to true or not.
58
+ */
59
+ isDirected() {
60
+ return this._isDirected;
61
+ }
62
+ /**
63
+ * Whether graph was created with 'multigraph' flag set to true or not.
64
+ */
65
+ isMultigraph() {
66
+ return this._isMultigraph;
67
+ }
68
+ /**
69
+ * Whether graph was created with 'compound' flag set to true or not.
70
+ */
71
+ isCompound() {
72
+ return this._isCompound;
73
+ }
74
+ /**
75
+ * Sets the label of the graph.
76
+ */
77
+ setGraph(t) {
78
+ return this._label = t, this;
79
+ }
80
+ /**
81
+ * Gets the graph label.
82
+ */
83
+ graph() {
84
+ return this._label;
85
+ }
86
+ /* === Node functions ========== */
87
+ /**
88
+ * Sets the default node label. If newDefault is a function, it will be
89
+ * invoked each time when setting a label for a node. Otherwise, this label
90
+ * will be assigned as default label in case if no label was specified while
91
+ * setting a node.
92
+ * Complexity: O(1).
93
+ */
94
+ setDefaultNodeLabel(t) {
95
+ return this._defaultNodeLabelFn = t, typeof t != "function" && (this._defaultNodeLabelFn = () => t), this;
96
+ }
97
+ /**
98
+ * Gets the number of nodes in the graph.
99
+ * Complexity: O(1).
100
+ */
101
+ nodeCount() {
102
+ return this._nodeCount;
103
+ }
104
+ /**
105
+ * Gets all nodes of the graph. Note, the in case of compound graph subnodes are
106
+ * not included in list.
107
+ * Complexity: O(1).
108
+ */
109
+ nodes() {
110
+ return Object.keys(this._nodes);
111
+ }
112
+ /**
113
+ * Gets list of nodes without in-edges.
114
+ * Complexity: O(|V|).
115
+ */
116
+ sources() {
117
+ const t = this;
118
+ return this.nodes().filter((n) => Object.keys(t._in[n]).length === 0);
119
+ }
120
+ /**
121
+ * Gets list of nodes without out-edges.
122
+ * Complexity: O(|V|).
123
+ */
124
+ sinks() {
125
+ const t = this;
126
+ return this.nodes().filter((n) => Object.keys(t._out[n]).length === 0);
127
+ }
128
+ /**
129
+ * Invokes setNode method for each node in names list.
130
+ * Complexity: O(|names|).
131
+ */
132
+ setNodes(t, n) {
133
+ const o = arguments, s = this;
134
+ return t.forEach((r) => {
135
+ o.length > 1 ? s.setNode(r, n) : s.setNode(r);
136
+ }), this;
137
+ }
138
+ /**
139
+ * Creates or updates the value for the node v in the graph. If value is supplied
140
+ * it is set as the value for the node. If value is not supplied and the node was
141
+ * created by this call then the default node label will be assigned.
142
+ * Complexity: O(1).
143
+ */
144
+ setNode(t, n) {
145
+ return Object.hasOwn(this._nodes, t) ? (arguments.length > 1 && (this._nodes[t] = n), this) : (this._nodes[t] = arguments.length > 1 ? n : this._defaultNodeLabelFn(t), this._isCompound && (this._parent[t] = pe, this._children[t] = {}, this._children[pe][t] = !0), this._in[t] = {}, this._preds[t] = {}, this._out[t] = {}, this._sucs[t] = {}, ++this._nodeCount, this);
146
+ }
147
+ /**
148
+ * Gets the label of node with specified name.
149
+ * Complexity: O(1).
150
+ */
151
+ node(t) {
152
+ return this._nodes[t];
153
+ }
154
+ /**
155
+ * Detects whether graph has a node with specified name or not.
156
+ */
157
+ hasNode(t) {
158
+ return Object.hasOwn(this._nodes, t);
159
+ }
160
+ /**
161
+ * Remove the node with the name from the graph or do nothing if the node is not in
162
+ * the graph. If the node was removed this function also removes any incident
163
+ * edges.
164
+ * Complexity: O(1).
165
+ */
166
+ removeNode(t) {
167
+ const n = this;
168
+ if (Object.hasOwn(this._nodes, t)) {
169
+ const o = (s) => n.removeEdge(n._edgeObjs[s]);
170
+ delete this._nodes[t], this._isCompound && (this._removeFromParentsChildList(t), delete this._parent[t], this.children(t).forEach((s) => {
171
+ n.setParent(s);
172
+ }), delete this._children[t]), Object.keys(this._in[t]).forEach(o), delete this._in[t], delete this._preds[t], Object.keys(this._out[t]).forEach(o), delete this._out[t], delete this._sucs[t], --this._nodeCount;
173
+ }
174
+ return this;
175
+ }
176
+ /**
177
+ * Sets node parentId as a parent for node nodeId if it is defined, or removes the
178
+ * parent for nodeId if parentId is undefined. Method throws an exception in case of
179
+ * invoking it in context of noncompound graph.
180
+ * Average-case complexity: O(1).
181
+ */
182
+ setParent(t, n) {
183
+ if (!this._isCompound)
184
+ throw new Error("Cannot set parent in a non-compound graph");
185
+ if (n === void 0)
186
+ n = pe;
187
+ else {
188
+ n += "";
189
+ for (let o = n; o !== void 0; o = this.parent(o))
190
+ if (o === t)
191
+ throw new Error(
192
+ "Setting " + n + " as parent of " + t + " would create a cycle"
193
+ );
194
+ this.setNode(n);
195
+ }
196
+ return this.setNode(t), this._removeFromParentsChildList(t), this._parent[t] = n, this._children[n][t] = !0, this;
197
+ }
198
+ _removeFromParentsChildList(t) {
199
+ delete this._children[this._parent[t]][t];
200
+ }
201
+ /**
202
+ * Gets parent node for node nodeId.
203
+ * Complexity: O(1).
204
+ */
205
+ parent(t) {
206
+ if (this._isCompound) {
207
+ const n = this._parent[t];
208
+ if (n !== pe)
209
+ return n;
210
+ }
211
+ }
212
+ /**
213
+ * Gets list of direct children of node nodeId.
214
+ * Complexity: O(1).
215
+ */
216
+ children(t = pe) {
217
+ if (this._isCompound) {
218
+ const n = this._children[t];
219
+ if (n)
220
+ return Object.keys(n);
221
+ } else {
222
+ if (t === pe)
223
+ return this.nodes();
224
+ if (this.hasNode(t))
225
+ return [];
226
+ }
227
+ }
228
+ /**
229
+ * Return all nodes that are predecessors of the specified node or undefined if nodeId is not in
230
+ * the graph. Behavior is undefined for undirected graphs - use neighbors instead.
231
+ * Complexity: O(|V|).
232
+ */
233
+ predecessors(t) {
234
+ const n = this._preds[t];
235
+ if (n)
236
+ return Object.keys(n);
237
+ }
238
+ /**
239
+ * Return all nodes that are successors of the specified node or undefined if nodeId is not in
240
+ * the graph. Behavior is undefined for undirected graphs - use neighbors instead.
241
+ * Complexity: O(|V|).
242
+ */
243
+ successors(t) {
244
+ const n = this._sucs[t];
245
+ if (n)
246
+ return Object.keys(n);
247
+ }
248
+ /**
249
+ * Return all nodes that are predecessors or successors of the specified node or undefined if
250
+ * nodeId is not in the graph.
251
+ * Complexity: O(|V|).
252
+ */
253
+ neighbors(t) {
254
+ const n = this.predecessors(t);
255
+ if (n) {
256
+ const o = new Set(n);
257
+ for (const s of this.successors(t))
258
+ o.add(s);
259
+ return Array.from(o.values());
260
+ }
261
+ }
262
+ isLeaf(t) {
263
+ let n;
264
+ return this.isDirected() ? n = this.successors(t) : n = this.neighbors(t), n.length === 0;
265
+ }
266
+ /**
267
+ * Creates new graph with nodes filtered via filter. Edges incident to rejected node
268
+ * are also removed. In case of compound graph, if parent is rejected by filter,
269
+ * then all its children are rejected too.
270
+ * Average-case complexity: O(|E|+|V|).
271
+ */
272
+ filterNodes(t) {
273
+ const n = new this.constructor({
274
+ directed: this._isDirected,
275
+ multigraph: this._isMultigraph,
276
+ compound: this._isCompound
277
+ });
278
+ n.setGraph(this.graph());
279
+ const o = this;
280
+ Object.entries(this._nodes).forEach(([i, l]) => {
281
+ t(i) && n.setNode(i, l);
282
+ }), Object.values(this._edgeObjs).forEach((i) => {
283
+ n.hasNode(i.v) && n.hasNode(i.w) && n.setEdge(i, o.edge(i));
284
+ });
285
+ const s = {};
286
+ function r(i) {
287
+ const l = o.parent(i);
288
+ return l === void 0 || n.hasNode(l) ? (s[i] = l, l) : l in s ? s[l] : r(l);
289
+ }
290
+ return this._isCompound && n.nodes().forEach((i) => n.setParent(i, r(i))), n;
291
+ }
292
+ /* === Edge functions ========== */
293
+ /**
294
+ * Sets the default edge label or factory function. This label will be
295
+ * assigned as default label in case if no label was specified while setting
296
+ * an edge or this function will be invoked each time when setting an edge
297
+ * with no label specified and returned value will be used as a label for edge.
298
+ * Complexity: O(1).
299
+ */
300
+ setDefaultEdgeLabel(t) {
301
+ return this._defaultEdgeLabelFn = t, typeof t != "function" && (this._defaultEdgeLabelFn = () => t), this;
302
+ }
303
+ /**
304
+ * Gets the number of edges in the graph.
305
+ * Complexity: O(1).
306
+ */
307
+ edgeCount() {
308
+ return this._edgeCount;
309
+ }
310
+ /**
311
+ * Gets edges of the graph. In case of compound graph subgraphs are not considered.
312
+ * Complexity: O(|E|).
313
+ */
314
+ edges() {
315
+ return Object.values(this._edgeObjs);
316
+ }
317
+ /**
318
+ * Establish an edges path over the nodes in nodeIds list. If some edge already
319
+ * exists, it will update its label, otherwise it will create an edge between pair
320
+ * of nodes with label provided or default label if no label provided.
321
+ * Complexity: O(|nodeIds|).
322
+ */
323
+ setPath(t, n) {
324
+ const o = this, s = arguments;
325
+ return t.reduce((r, i) => (s.length > 1 ? o.setEdge(r, i, n) : o.setEdge(r, i), i)), this;
326
+ }
327
+ /**
328
+ * Creates or updates the label for the edge (v, w) with the optionally supplied
329
+ * name. If value is supplied it is set as the value for the edge. If value is not
330
+ * supplied and the edge was created by this call then the default edge label will
331
+ * be assigned. The name parameter is only useful with multigraphs.
332
+ */
333
+ setEdge() {
334
+ let t, n, o, s, r = !1;
335
+ const i = arguments[0];
336
+ typeof i == "object" && i !== null && "v" in i ? (t = i.v, n = i.w, o = i.name, arguments.length === 2 && (s = arguments[1], r = !0)) : (t = i, n = arguments[1], o = arguments[3], arguments.length > 2 && (s = arguments[2], r = !0)), t = "" + t, n = "" + n, o !== void 0 && (o = "" + o);
337
+ let l = He(this._isDirected, t, n, o);
338
+ if (Object.hasOwn(this._edgeLabels, l))
339
+ return r && (this._edgeLabels[l] = s), this;
340
+ if (o !== void 0 && !this._isMultigraph)
341
+ throw new Error("Cannot set a named edge when isMultigraph = false");
342
+ this.setNode(t), this.setNode(n), this._edgeLabels[l] = r ? s : this._defaultEdgeLabelFn(t, n, o);
343
+ const u = cs(this._isDirected, t, n, o);
344
+ return t = u.v, n = u.w, Object.freeze(u), this._edgeObjs[l] = u, Nn(this._preds[n], t), Nn(this._sucs[t], n), this._in[n][l] = u, this._out[t][l] = u, this._edgeCount++, this;
345
+ }
346
+ /**
347
+ * Gets the label for the specified edge.
348
+ * Complexity: O(1).
349
+ */
350
+ edge(t, n, o) {
351
+ const s = arguments.length === 1 ? Nt(this._isDirected, arguments[0]) : He(this._isDirected, t, n, o);
352
+ return this._edgeLabels[s];
353
+ }
354
+ /**
355
+ * Gets the label for the specified edge and converts it to an object.
356
+ * Complexity: O(1)
357
+ */
358
+ edgeAsObj() {
359
+ const t = this.edge(...arguments);
360
+ return typeof t != "object" ? { label: t } : t;
361
+ }
362
+ /**
363
+ * Detects whether the graph contains specified edge or not. No subgraphs are considered.
364
+ * Complexity: O(1).
365
+ */
366
+ hasEdge(t, n, o) {
367
+ const s = arguments.length === 1 ? Nt(this._isDirected, arguments[0]) : He(this._isDirected, t, n, o);
368
+ return Object.hasOwn(this._edgeLabels, s);
369
+ }
370
+ /**
371
+ * Removes the specified edge from the graph. No subgraphs are considered.
372
+ * Complexity: O(1).
373
+ */
374
+ removeEdge(t, n, o) {
375
+ const s = arguments.length === 1 ? Nt(this._isDirected, arguments[0]) : He(this._isDirected, t, n, o), r = this._edgeObjs[s];
376
+ return r && (t = r.v, n = r.w, delete this._edgeLabels[s], delete this._edgeObjs[s], Sn(this._preds[n], t), Sn(this._sucs[t], n), delete this._in[n][s], delete this._out[t][s], this._edgeCount--), this;
377
+ }
378
+ /**
379
+ * Return all edges that point to the node v. Optionally filters those edges down to just those
380
+ * coming from node u. Behavior is undefined for undirected graphs - use nodeEdges instead.
381
+ * Complexity: O(|E|).
382
+ */
383
+ inEdges(t, n) {
384
+ const o = this._in[t];
385
+ if (o) {
386
+ const s = Object.values(o);
387
+ return n ? s.filter((r) => r.v === n) : s;
388
+ }
389
+ }
390
+ /**
391
+ * Return all edges that are pointed at by node v. Optionally filters those edges down to just
392
+ * those pointing to w. Behavior is undefined for undirected graphs - use nodeEdges instead.
393
+ * Complexity: O(|E|).
394
+ */
395
+ outEdges(t, n) {
396
+ const o = this._out[t];
397
+ if (o) {
398
+ const s = Object.values(o);
399
+ return n ? s.filter((r) => r.w === n) : s;
400
+ }
401
+ }
402
+ /**
403
+ * Returns all edges to or from node v regardless of direction. Optionally filters those edges
404
+ * down to just those between nodes v and w regardless of direction.
405
+ * Complexity: O(|E|).
406
+ */
407
+ nodeEdges(t, n) {
408
+ const o = this.inEdges(t, n);
409
+ if (o)
410
+ return o.concat(this.outEdges(t, n));
411
+ }
412
+ }
413
+ function Nn(e, t) {
414
+ e[t] ? e[t]++ : e[t] = 1;
415
+ }
416
+ function Sn(e, t) {
417
+ --e[t] || delete e[t];
418
+ }
419
+ function He(e, t, n, o) {
420
+ let s = "" + t, r = "" + n;
421
+ if (!e && s > r) {
422
+ const i = s;
423
+ s = r, r = i;
424
+ }
425
+ return s + xn + r + xn + (o === void 0 ? us : o);
426
+ }
427
+ function cs(e, t, n, o) {
428
+ let s = "" + t, r = "" + n;
429
+ if (!e && s > r) {
430
+ const l = s;
431
+ s = r, r = l;
432
+ }
433
+ const i = { v: s, w: r };
434
+ return o && (i.name = o), i;
435
+ }
436
+ function Nt(e, t) {
437
+ return He(e, t.v, t.w, t.name);
438
+ }
439
+ class ds {
440
+ constructor() {
441
+ const t = {};
442
+ t._next = t._prev = t, this._sentinel = t;
443
+ }
444
+ dequeue() {
445
+ const t = this._sentinel, n = t._prev;
446
+ if (n !== t)
447
+ return Ln(n), n;
448
+ }
449
+ enqueue(t) {
450
+ const n = this._sentinel;
451
+ t._prev && t._next && Ln(t), t._next = n._next, n._next._prev = t, n._next = t, t._prev = n;
452
+ }
453
+ toString() {
454
+ const t = [], n = this._sentinel;
455
+ let o = n._prev;
456
+ for (; o !== n; )
457
+ t.push(JSON.stringify(o, fs)), o = o._prev;
458
+ return "[" + t.join(", ") + "]";
459
+ }
460
+ }
461
+ function Ln(e) {
462
+ e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
463
+ }
464
+ function fs(e, t) {
465
+ if (e !== "_next" && e !== "_prev")
466
+ return t;
467
+ }
468
+ const hs = () => 1;
469
+ function ms(e, t) {
470
+ if (e.nodeCount() <= 1)
471
+ return [];
472
+ const n = gs(e, t || hs);
473
+ return vs(n.graph, n.buckets, n.zeroIndex).flatMap((s) => e.outEdges(s.v, s.w));
474
+ }
475
+ function vs(e, t, n) {
476
+ let o = [];
477
+ const s = t[t.length - 1], r = t[0];
478
+ let i;
479
+ for (; e.nodeCount(); ) {
480
+ for (; i = r.dequeue(); )
481
+ St(e, t, n, i);
482
+ for (; i = s.dequeue(); )
483
+ St(e, t, n, i);
484
+ if (e.nodeCount()) {
485
+ for (let l = t.length - 2; l > 0; --l)
486
+ if (i = t[l].dequeue(), i) {
487
+ o = o.concat(St(e, t, n, i, !0));
488
+ break;
489
+ }
490
+ }
491
+ }
492
+ return o;
493
+ }
494
+ function St(e, t, n, o, s) {
495
+ const r = s ? [] : void 0;
496
+ return e.inEdges(o.v).forEach((i) => {
497
+ const l = e.edge(i), u = e.node(i.v);
498
+ s && r.push({ v: i.v, w: i.w }), u.out -= l, Rt(t, n, u);
499
+ }), e.outEdges(o.v).forEach((i) => {
500
+ const l = e.edge(i), u = e.node(i.w);
501
+ u.in -= l, Rt(t, n, u);
502
+ }), e.removeNode(o.v), r;
503
+ }
504
+ function gs(e, t) {
505
+ const n = new ue();
506
+ let o = 0, s = 0;
507
+ e.nodes().forEach((l) => {
508
+ n.setNode(l, { v: l, in: 0, out: 0 });
509
+ }), e.edges().forEach((l) => {
510
+ const u = n.edge(l.v, l.w) || 0, f = t(l), h = u + f;
511
+ n.setEdge(l.v, l.w, h), s = Math.max(s, n.node(l.v).out += f), o = Math.max(o, n.node(l.w).in += f);
512
+ });
513
+ const r = ps(s + o + 3).map(() => new ds()), i = o + 1;
514
+ return n.nodes().forEach((l) => {
515
+ Rt(r, i, n.node(l));
516
+ }), {
517
+ graph: n,
518
+ buckets: r,
519
+ zeroIndex: i
520
+ };
521
+ }
522
+ function Rt(e, t, n) {
523
+ n.out ? n.in ? e[n.out - n.in + t].enqueue(n) : e[e.length - 1].enqueue(n) : e[0].enqueue(n);
524
+ }
525
+ function ps(e) {
526
+ const t = [];
527
+ for (let n = 0; n < e; n++)
528
+ t.push(n);
529
+ return t;
530
+ }
531
+ function $e(e, t, n, o) {
532
+ let s = o;
533
+ for (; e.hasNode(s); )
534
+ s = Je(o);
535
+ return n.dummy = t, e.setNode(s, n), s;
536
+ }
537
+ function Bn(e) {
538
+ const t = new ue().setGraph(e.graph());
539
+ return e.nodes().forEach((n) => {
540
+ t.setNode(n, e.node(n));
541
+ }), e.edges().forEach((n) => {
542
+ const o = t.edge(n.v, n.w) || { weight: 0, minlen: 1 }, s = e.edge(n);
543
+ t.setEdge(n.v, n.w, {
544
+ weight: o.weight + s.weight,
545
+ minlen: Math.max(o.minlen, s.minlen)
546
+ });
547
+ }), t;
548
+ }
549
+ function Dt(e) {
550
+ const t = new ue({ multigraph: e.isMultigraph() }).setGraph(e.graph());
551
+ return e.nodes().forEach((n) => {
552
+ e.children(n).length || t.setNode(n, e.node(n));
553
+ }), e.edges().forEach((n) => {
554
+ t.setEdge(n, e.edge(n));
555
+ }), t;
556
+ }
557
+ function ys(e) {
558
+ const t = e.nodes().map((n) => {
559
+ const o = {};
560
+ return e.outEdges(n).forEach((s) => {
561
+ o[s.w] = (o[s.w] || 0) + e.edge(s).weight;
562
+ }), o;
563
+ });
564
+ return Qe(e.nodes(), t);
565
+ }
566
+ function ws(e) {
567
+ const t = e.nodes().map((n) => {
568
+ const o = {};
569
+ return e.inEdges(n).forEach((s) => {
570
+ o[s.v] = (o[s.v] || 0) + e.edge(s).weight;
571
+ }), o;
572
+ });
573
+ return Qe(e.nodes(), t);
574
+ }
575
+ function Pt(e, t) {
576
+ let n = e.x, o = e.y;
577
+ const s = t.x - n, r = t.y - o;
578
+ let i = e.width / 2, l = e.height / 2;
579
+ if (!s && !r)
580
+ throw new Error("Not possible to find intersection inside of the rectangle");
581
+ let u, f;
582
+ return Math.abs(r) * i > Math.abs(s) * l ? (r < 0 && (l = -l), u = l * s / r, f = l) : (s < 0 && (i = -i), u = i, f = i * r / s), { x: n + u, y: o + f };
583
+ }
584
+ function Ge(e) {
585
+ const t = Oe(At(e) + 1).map(() => []);
586
+ return e.nodes().forEach((n) => {
587
+ const o = e.node(n), s = o.rank;
588
+ s !== void 0 && (t[s][o.order] = n);
589
+ }), t;
590
+ }
591
+ function zn(e) {
592
+ const t = e.nodes().map((o) => {
593
+ const s = e.node(o).rank;
594
+ return s === void 0 ? Number.MAX_VALUE : s;
595
+ }), n = J(Math.min, t);
596
+ e.nodes().forEach((o) => {
597
+ const s = e.node(o);
598
+ Object.hasOwn(s, "rank") && (s.rank -= n);
599
+ });
600
+ }
601
+ function Vn(e) {
602
+ const t = e.nodes().map((i) => e.node(i).rank).filter((i) => i !== void 0), n = J(Math.min, t), o = [];
603
+ e.nodes().forEach((i) => {
604
+ const l = e.node(i).rank - n;
605
+ o[l] || (o[l] = []), o[l].push(i);
606
+ });
607
+ let s = 0;
608
+ const r = e.graph().nodeRankFactor;
609
+ Array.from(o).forEach((i, l) => {
610
+ i === void 0 && l % r !== 0 ? --s : i !== void 0 && s && i.forEach((u) => {
611
+ e.node(u).rank += s;
612
+ });
613
+ });
614
+ }
615
+ function bs(e, t, n, o) {
616
+ const s = {
617
+ width: 0,
618
+ height: 0
619
+ };
620
+ return arguments.length >= 4 && (s.rank = n, s.order = o), $e(e, "border", s, t);
621
+ }
622
+ const Hn = 65535;
623
+ function ks(e, t = Hn) {
624
+ const n = [];
625
+ for (let o = 0; o < e.length; o += t) {
626
+ const s = e.slice(o, o + t);
627
+ n.push(s);
628
+ }
629
+ return n;
630
+ }
631
+ function J(e, t) {
632
+ if (t.length > Hn) {
633
+ const n = ks(t);
634
+ return e.apply(
635
+ null,
636
+ n.map((o) => e.apply(null, o))
637
+ );
638
+ } else
639
+ return e.apply(null, t);
640
+ }
641
+ function At(e) {
642
+ const n = e.nodes().map((o) => {
643
+ const s = e.node(o).rank;
644
+ return s === void 0 ? Number.MIN_VALUE : s;
645
+ });
646
+ return J(Math.max, n);
647
+ }
648
+ function Wn(e, t) {
649
+ const n = { lhs: [], rhs: [] };
650
+ return e.forEach((o) => {
651
+ t(o) ? n.lhs.push(o) : n.rhs.push(o);
652
+ }), n;
653
+ }
654
+ function Gn(e, t) {
655
+ const n = Date.now();
656
+ try {
657
+ return t();
658
+ } finally {
659
+ console.log(e + " time: " + (Date.now() - n) + "ms");
660
+ }
661
+ }
662
+ function jn(e, t) {
663
+ return t();
664
+ }
665
+ let Es = 0;
666
+ function Je(e) {
667
+ const t = ++Es;
668
+ return e + String(t);
669
+ }
670
+ function Oe(e, t, n = 1) {
671
+ t == null && (t = e, e = 0);
672
+ let o = (r) => r < t;
673
+ n < 0 && (o = (r) => t < r);
674
+ const s = [];
675
+ for (let r = e; o(r); r += n)
676
+ s.push(r);
677
+ return s;
678
+ }
679
+ function We(e, t) {
680
+ const n = {};
681
+ for (const o of t)
682
+ e[o] !== void 0 && (n[o] = e[o]);
683
+ return n;
684
+ }
685
+ function je(e, t) {
686
+ let n = t;
687
+ if (typeof t == "string") {
688
+ const o = t;
689
+ n = (s) => s[o];
690
+ }
691
+ return Object.entries(e).reduce((o, [s, r]) => (o[s] = n(r, s), o), {});
692
+ }
693
+ function Qe(e, t) {
694
+ return e.reduce((n, o, s) => (n[o] = t[s], n), {});
695
+ }
696
+ const qe = {
697
+ addBorderNode: bs,
698
+ addDummyNode: $e,
699
+ applyWithChunking: J,
700
+ asNonCompoundGraph: Dt,
701
+ buildLayerMatrix: Ge,
702
+ intersectRect: Pt,
703
+ mapValues: je,
704
+ maxRank: At,
705
+ normalizeRanks: zn,
706
+ notime: jn,
707
+ partition: Wn,
708
+ pick: We,
709
+ predecessorWeights: ws,
710
+ range: Oe,
711
+ removeEmptyRanks: Vn,
712
+ simplify: Bn,
713
+ successorWeights: ys,
714
+ time: Gn,
715
+ uniqueId: Je,
716
+ zipObject: Qe
717
+ };
718
+ function _s(e) {
719
+ (e.graph().acyclicer === "greedy" ? ms(e, n(e)) : xs(e)).forEach((o) => {
720
+ const s = e.edge(o);
721
+ e.removeEdge(o), s.forwardName = o.name, s.reversed = !0, e.setEdge(o.w, o.v, s, Je("rev"));
722
+ });
723
+ function n(o) {
724
+ return (s) => o.edge(s).weight;
725
+ }
726
+ }
727
+ function Cs(e) {
728
+ e.edges().forEach((t) => {
729
+ const n = e.edge(t);
730
+ if (n.reversed) {
731
+ e.removeEdge(t);
732
+ const o = n.forwardName;
733
+ delete n.reversed, delete n.forwardName, e.setEdge(t.w, t.v, n, o);
734
+ }
735
+ });
736
+ }
737
+ function xs(e) {
738
+ const t = [], n = {}, o = {};
739
+ function s(r) {
740
+ Object.hasOwn(o, r) || (o[r] = !0, n[r] = !0, e.outEdges(r).forEach((i) => {
741
+ Object.hasOwn(n, i.w) ? t.push(i) : s(i.w);
742
+ }), delete n[r]);
743
+ }
744
+ return e.nodes().forEach(s), t;
745
+ }
746
+ function Ns(e) {
747
+ e.graph().dummyChains = [], e.edges().forEach((t) => Ss(e, t));
748
+ }
749
+ function Ss(e, t) {
750
+ let n = t.v, o = e.node(n).rank;
751
+ const s = t.w, r = e.node(s).rank, i = t.name, l = e.edge(t), u = l.labelRank;
752
+ if (r === o + 1)
753
+ return;
754
+ e.removeEdge(t);
755
+ let f, h, m;
756
+ for (m = 0, ++o; o < r; ++m, ++o)
757
+ l.points = [], h = {
758
+ width: 0,
759
+ height: 0,
760
+ edgeLabel: l,
761
+ edgeObj: t,
762
+ rank: o
763
+ }, f = $e(e, "edge", h, "_d"), o === u && (h.width = l.width, h.height = l.height, h.dummy = "edge-label", h.labelpos = l.labelpos), e.setEdge(n, f, { weight: l.weight }, i), m === 0 && e.graph().dummyChains.push(f), n = f;
764
+ e.setEdge(n, s, { weight: l.weight }, i);
765
+ }
766
+ function Ls(e) {
767
+ e.graph().dummyChains.forEach((t) => {
768
+ let n = e.node(t);
769
+ const o = n.edgeLabel;
770
+ e.setEdge(n.edgeObj, o);
771
+ let s;
772
+ for (; n.dummy; )
773
+ s = e.successors(t)[0], e.removeNode(t), o.points.push({ x: n.x, y: n.y }), n.dummy === "edge-label" && (o.x = n.x, o.y = n.y, o.width = n.width, o.height = n.height), t = s, n = e.node(t);
774
+ });
775
+ }
776
+ function Yn(e) {
777
+ function t(n) {
778
+ const o = e.node(n);
779
+ if (o && Object.prototype.hasOwnProperty.call(o, "rank"))
780
+ return o.rank;
781
+ const s = e.outEdges(n) || [];
782
+ if (!s.length)
783
+ return o && (o.rank = 0), 0;
784
+ const r = s.map((l) => {
785
+ if (!e.node(l.w))
786
+ return Number.POSITIVE_INFINITY;
787
+ const f = t(l.w), h = e.edge(l).minlen;
788
+ return f - h;
789
+ });
790
+ let i = J(Math.min, r);
791
+ return i === Number.POSITIVE_INFINITY && (i = 0), o && (o.rank = i), i;
792
+ }
793
+ (e.sources() || []).forEach(t);
794
+ }
795
+ function Ms(e, t) {
796
+ return e.node(t.w).rank - e.node(t.v).rank - e.edge(t).minlen;
797
+ }
798
+ function Ts(e) {
799
+ Os(e);
800
+ const t = new ue();
801
+ e.nodes().forEach((r) => {
802
+ t.setNode(r, {});
803
+ });
804
+ const n = e.nodes();
805
+ if (!n.length)
806
+ return t;
807
+ const o = n[0], s = /* @__PURE__ */ new Set([o]);
808
+ for (; s.size < n.length; ) {
809
+ const r = $s(e, s);
810
+ if (!r) {
811
+ const h = n.find((m) => !s.has(m));
812
+ s.add(h), t.setNode(h, {});
813
+ continue;
814
+ }
815
+ const { edgeObject: i, delta: l, attachFrom: u, attachTo: f } = r;
816
+ Rs(e, s, u, l), t.setEdge(i.v, i.w, {}), s.add(f);
817
+ }
818
+ return t;
819
+ }
820
+ function Os(e) {
821
+ e.nodes().forEach((t) => {
822
+ const n = e.node(t) || {};
823
+ Object.prototype.hasOwnProperty.call(n, "rank") || (n.rank = 0, e.setNode(t, n));
824
+ });
825
+ }
826
+ function $s(e, t) {
827
+ let n = null;
828
+ return e.edges().forEach((o) => {
829
+ const s = t.has(o.v), r = t.has(o.w);
830
+ if (s === r)
831
+ return;
832
+ const i = Ms(e, o), l = Math.abs(i);
833
+ if (!n || l < n.absoluteSlack) {
834
+ const u = s ? o.v : o.w, f = s ? o.w : o.v, h = s ? i : -i;
835
+ n = {
836
+ edgeObject: o,
837
+ delta: h,
838
+ attachFrom: u,
839
+ attachTo: f,
840
+ absoluteSlack: l
841
+ };
842
+ }
843
+ }), n;
844
+ }
845
+ function Rs(e, t, n, o) {
846
+ o && e.nodes().forEach((s) => {
847
+ if (!t.has(s)) {
848
+ const r = e.node(s);
849
+ r.rank += o;
850
+ }
851
+ });
852
+ }
853
+ function Re(e) {
854
+ const t = Bn(e);
855
+ return Yn(t), t.nodes().forEach((n) => {
856
+ const o = t.node(n), s = e.node(n) || {};
857
+ s.rank = o.rank, e.setNode(n, s);
858
+ }), e;
859
+ }
860
+ function Ps(e, t) {
861
+ }
862
+ function Ds(e, t) {
863
+ }
864
+ function As(e, t, n) {
865
+ return 0;
866
+ }
867
+ function Fs(e) {
868
+ return null;
869
+ }
870
+ function Is(e, t) {
871
+ return null;
872
+ }
873
+ Re.initLowLimValues = Ps;
874
+ Re.initCutValues = Ds;
875
+ Re.calcCutValue = As;
876
+ Re.leaveEdge = Fs;
877
+ Re.enterEdge = Is;
878
+ const Un = Yn;
879
+ function Bs(e) {
880
+ const t = e.graph().ranker;
881
+ if (t instanceof Function)
882
+ return t(e);
883
+ switch (e.graph().ranker) {
884
+ case "network-simplex":
885
+ Mn(e);
886
+ break;
887
+ case "tight-tree":
888
+ Vs(e);
889
+ break;
890
+ case "longest-path":
891
+ zs(e);
892
+ break;
893
+ case "none":
894
+ break;
895
+ default:
896
+ Mn(e);
897
+ }
898
+ }
899
+ const zs = Un;
900
+ function Vs(e) {
901
+ Un(e), Ts(e);
902
+ }
903
+ function Mn(e) {
904
+ Re(e);
905
+ }
906
+ function Hs(e) {
907
+ const t = Gs(e);
908
+ e.graph().dummyChains.forEach((n) => {
909
+ let o = e.node(n);
910
+ const s = o.edgeObj, r = Ws(e, t, s.v, s.w), i = r.path, l = r.lca;
911
+ let u = 0, f = i[u], h = !0, m = n;
912
+ for (; m !== s.w; ) {
913
+ if (o = e.node(m), h) {
914
+ for (; (f = i[u]) !== l && e.node(f).maxRank < o.rank; )
915
+ u++;
916
+ f === l && (h = !1);
917
+ }
918
+ if (!h) {
919
+ for (; u < i.length - 1 && e.node(f = i[u + 1]).minRank <= o.rank; )
920
+ u++;
921
+ f = i[u];
922
+ }
923
+ e.setParent(m, f), m = e.successors(m)[0];
924
+ }
925
+ });
926
+ }
927
+ function Ws(e, t, n, o) {
928
+ const s = [], r = [], i = Math.min(t[n].low, t[o].low), l = Math.max(t[n].lim, t[o].lim);
929
+ let u, f;
930
+ u = n;
931
+ do
932
+ u = e.parent(u), s.push(u);
933
+ while (u && (t[u].low > i || l > t[u].lim));
934
+ for (f = u, u = o; (u = e.parent(u)) !== f; )
935
+ r.push(u);
936
+ return {
937
+ path: s.concat(r.reverse()),
938
+ lca: f
939
+ };
940
+ }
941
+ function Gs(e) {
942
+ const t = {};
943
+ let n = 0;
944
+ function o(s) {
945
+ const r = n;
946
+ e.children(s).forEach(o), t[s] = { low: r, lim: n++ };
947
+ }
948
+ return e.children().forEach(o), t;
949
+ }
950
+ function js(e) {
951
+ const t = qe.addDummyNode(e, "root", {}, "_root"), n = Ys(e), o = Object.values(n), s = qe.applyWithChunking(Math.max, o) - 1, r = 2 * s + 1;
952
+ e.graph().nestingRoot = t, e.edges().forEach((l) => {
953
+ e.edge(l).minlen *= r;
954
+ });
955
+ const i = Us(e) + 1;
956
+ e.children().forEach((l) => {
957
+ Zn(e, t, r, i, s, n, l);
958
+ }), e.graph().nodeRankFactor = r;
959
+ }
960
+ function Zn(e, t, n, o, s, r, i) {
961
+ const l = e.children(i);
962
+ if (!l.length) {
963
+ i !== t && e.setEdge(t, i, { weight: 0, minlen: n });
964
+ return;
965
+ }
966
+ const u = qe.addBorderNode(e, "_bt"), f = qe.addBorderNode(e, "_bb"), h = e.node(i);
967
+ e.setParent(u, i), h.borderTop = u, e.setParent(f, i), h.borderBottom = f, l.forEach((m) => {
968
+ Zn(e, t, n, o, s, r, m);
969
+ const p = e.node(m), _ = p.borderTop ? p.borderTop : m, O = p.borderBottom ? p.borderBottom : m, M = p.borderTop ? o : 2 * o, z = _ !== O ? 1 : s - r[i] + 1;
970
+ e.setEdge(u, _, {
971
+ weight: M,
972
+ minlen: z,
973
+ nestingEdge: !0
974
+ }), e.setEdge(O, f, {
975
+ weight: M,
976
+ minlen: z,
977
+ nestingEdge: !0
978
+ });
979
+ }), e.parent(i) || e.setEdge(t, u, {
980
+ weight: 0,
981
+ minlen: s + r[i]
982
+ });
983
+ }
984
+ function Ys(e) {
985
+ const t = {};
986
+ function n(o, s) {
987
+ const r = e.children(o);
988
+ r && r.length && r.forEach((i) => n(i, s + 1)), t[o] = s;
989
+ }
990
+ return e.children().forEach((o) => n(o, 1)), t;
991
+ }
992
+ function Us(e) {
993
+ return e.edges().reduce((t, n) => t + e.edge(n).weight, 0);
994
+ }
995
+ function Zs(e) {
996
+ const t = e.graph();
997
+ e.removeNode(t.nestingRoot), delete t.nestingRoot, e.edges().forEach((n) => {
998
+ e.edge(n).nestingEdge && e.removeEdge(n);
999
+ });
1000
+ }
1001
+ function Xs(e) {
1002
+ function t(n) {
1003
+ const o = e.children(n), s = e.node(n);
1004
+ if (o.length && o.forEach(t), Object.hasOwn(s, "minRank")) {
1005
+ s.borderLeft = [], s.borderRight = [];
1006
+ for (let r = s.minRank, i = s.maxRank + 1; r < i; ++r)
1007
+ Tn(e, "borderLeft", "_bl", n, s, r), Tn(e, "borderRight", "_br", n, s, r);
1008
+ }
1009
+ }
1010
+ e.children().forEach(t);
1011
+ }
1012
+ function Tn(e, t, n, o, s, r) {
1013
+ const i = {
1014
+ width: 0,
1015
+ height: 0,
1016
+ rank: r,
1017
+ borderType: t
1018
+ }, l = s[t][r - 1], u = $e(e, "border", i, n);
1019
+ s[t][r] = u, e.setParent(u, o), l && e.setEdge(l, u, { weight: 1 });
1020
+ }
1021
+ function Ks(e) {
1022
+ const t = e.graph().rankdir.toLowerCase();
1023
+ (t === "lr" || t === "rl") && Xn(e);
1024
+ }
1025
+ function qs(e) {
1026
+ const t = e.graph().rankdir.toLowerCase();
1027
+ (t === "bt" || t === "rl") && Js(e), (t === "lr" || t === "rl") && (Qs(e), Xn(e));
1028
+ }
1029
+ function Xn(e) {
1030
+ e.nodes().forEach((t) => {
1031
+ On(e.node(t));
1032
+ }), e.edges().forEach((t) => {
1033
+ On(e.edge(t));
1034
+ });
1035
+ }
1036
+ function On(e) {
1037
+ const t = e.width;
1038
+ e.width = e.height, e.height = t;
1039
+ }
1040
+ function Js(e) {
1041
+ e.nodes().forEach((t) => {
1042
+ Lt(e.node(t));
1043
+ }), e.edges().forEach((t) => {
1044
+ const n = e.edge(t);
1045
+ n.points.forEach(Lt), Object.hasOwn(n, "y") && Lt(n);
1046
+ });
1047
+ }
1048
+ function Lt(e) {
1049
+ e.y = -e.y;
1050
+ }
1051
+ function Qs(e) {
1052
+ e.nodes().forEach((t) => {
1053
+ Mt(e.node(t));
1054
+ }), e.edges().forEach((t) => {
1055
+ const n = e.edge(t);
1056
+ n.points.forEach(Mt), Object.hasOwn(n, "x") && Mt(n);
1057
+ });
1058
+ }
1059
+ function Mt(e) {
1060
+ const t = e.x;
1061
+ e.x = e.y, e.y = t;
1062
+ }
1063
+ const $n = {
1064
+ adjust: Ks,
1065
+ undo: qs
1066
+ };
1067
+ function ei(e) {
1068
+ const t = {}, n = e.nodes().filter((u) => e.children(u).length === 0), o = n.map((u) => e.node(u).rank), s = J(Math.max, o), r = Oe(s + 1).map(() => []);
1069
+ function i(u) {
1070
+ if (t[u]) return;
1071
+ t[u] = !0;
1072
+ const f = e.node(u);
1073
+ r[f.rank].push(u), e.successors(u).forEach(i);
1074
+ }
1075
+ return n.sort(
1076
+ (u, f) => e.node(u).rank - e.node(f).rank
1077
+ ).forEach(i), r;
1078
+ }
1079
+ function ti(e, t) {
1080
+ let n = 0;
1081
+ for (let o = 1; o < t.length; ++o)
1082
+ n += ni(e, t[o - 1], t[o]);
1083
+ return n;
1084
+ }
1085
+ function ni(e, t, n) {
1086
+ const o = Qe(
1087
+ n,
1088
+ n.map((f, h) => h)
1089
+ ), s = t.flatMap((f) => e.outEdges(f).map((h) => ({
1090
+ pos: o[h.w],
1091
+ weight: e.edge(h).weight
1092
+ })).sort((h, m) => h.pos - m.pos));
1093
+ let r = 1;
1094
+ for (; r < n.length; ) r <<= 1;
1095
+ const i = 2 * r - 1;
1096
+ r -= 1;
1097
+ const l = new Array(i).fill(0);
1098
+ let u = 0;
1099
+ return s.forEach((f) => {
1100
+ let h = f.pos + r;
1101
+ l[h] += f.weight;
1102
+ let m = 0;
1103
+ for (; h > 0; )
1104
+ h % 2 && (m += l[h + 1]), h = h - 1 >> 1, l[h] += f.weight;
1105
+ u += f.weight * m;
1106
+ }), u;
1107
+ }
1108
+ function oi(e, t = []) {
1109
+ return t.map((n) => {
1110
+ const o = e.inEdges(n);
1111
+ if (!o.length)
1112
+ return { v: n };
1113
+ const s = o.reduce(
1114
+ (r, i) => {
1115
+ const l = e.edge(i), u = e.node(i.v);
1116
+ return {
1117
+ sum: r.sum + l.weight * u.order,
1118
+ weight: r.weight + l.weight
1119
+ };
1120
+ },
1121
+ { sum: 0, weight: 0 }
1122
+ );
1123
+ return {
1124
+ v: n,
1125
+ barycenter: s.sum / s.weight,
1126
+ weight: s.weight
1127
+ };
1128
+ });
1129
+ }
1130
+ function si(e, t) {
1131
+ const n = {};
1132
+ e.forEach((s, r) => {
1133
+ const i = n[s.v] = {
1134
+ indegree: 0,
1135
+ in: [],
1136
+ out: [],
1137
+ vs: [s.v],
1138
+ i: r
1139
+ };
1140
+ s.barycenter !== void 0 && (i.barycenter = s.barycenter, i.weight = s.weight);
1141
+ }), t.edges().forEach((s) => {
1142
+ const r = n[s.v], i = n[s.w];
1143
+ r !== void 0 && i !== void 0 && (i.indegree++, r.out.push(i));
1144
+ });
1145
+ const o = Object.values(n).filter((s) => !s.indegree);
1146
+ return ii(o);
1147
+ }
1148
+ function ii(e) {
1149
+ const t = [];
1150
+ function n(s) {
1151
+ return (r) => {
1152
+ r.merged || (r.barycenter === void 0 || s.barycenter === void 0 || r.barycenter >= s.barycenter) && ri(s, r);
1153
+ };
1154
+ }
1155
+ function o(s) {
1156
+ return (r) => {
1157
+ r.in.push(s), --r.indegree === 0 && e.push(r);
1158
+ };
1159
+ }
1160
+ for (; e.length; ) {
1161
+ const s = e.pop();
1162
+ t.push(s), s.in.reverse().forEach(n(s)), s.out.forEach(o(s));
1163
+ }
1164
+ return t.filter((s) => !s.merged).map((s) => We(s, ["vs", "i", "barycenter", "weight"]));
1165
+ }
1166
+ function ri(e, t) {
1167
+ let n = 0, o = 0;
1168
+ e.weight && (n += e.barycenter * e.weight, o += e.weight), t.weight && (n += t.barycenter * t.weight, o += t.weight), e.vs = t.vs.concat(e.vs), e.barycenter = n / o, e.weight = o, e.i = Math.min(t.i, e.i), t.merged = !0;
1169
+ }
1170
+ function ai(e, t) {
1171
+ const n = Wn(e, (h) => Object.hasOwn(h, "barycenter")), o = n.lhs, s = n.rhs.sort((h, m) => m.i - h.i), r = [];
1172
+ let i = 0, l = 0, u = 0;
1173
+ o.sort(li(!!t)), u = Rn(r, s, u), o.forEach((h) => {
1174
+ u += h.vs.length, r.push(h.vs), i += h.barycenter * h.weight, l += h.weight, u = Rn(r, s, u);
1175
+ });
1176
+ const f = { vs: r.flat(!0) };
1177
+ return l && (f.barycenter = i / l, f.weight = l), f;
1178
+ }
1179
+ function Rn(e, t, n) {
1180
+ let o;
1181
+ for (; t.length && (o = t[t.length - 1]).i <= n; )
1182
+ t.pop(), e.push(o.vs), n++;
1183
+ return n;
1184
+ }
1185
+ function li(e) {
1186
+ return (t, n) => t.barycenter < n.barycenter ? -1 : t.barycenter > n.barycenter ? 1 : e ? n.i - t.i : t.i - n.i;
1187
+ }
1188
+ function Kn(e, t, n, o) {
1189
+ let s = e.children(t);
1190
+ const r = e.node(t), i = r ? r.borderLeft : void 0, l = r ? r.borderRight : void 0, u = {};
1191
+ i && (s = s.filter((p) => p !== i && p !== l));
1192
+ const f = oi(e, s);
1193
+ f.forEach((p) => {
1194
+ if (e.children(p.v).length) {
1195
+ const _ = Kn(e, p.v, n, o);
1196
+ u[p.v] = _, Object.hasOwn(_, "barycenter") && ci(p, _);
1197
+ }
1198
+ });
1199
+ let h = si(f, n);
1200
+ ui(h, u);
1201
+ const m = ai(h, o);
1202
+ if (i && (m.vs = [i, m.vs, l].flat(!0), e.predecessors(i).length)) {
1203
+ const p = e.node(e.predecessors(i)[0]), _ = e.node(e.predecessors(l)[0]);
1204
+ Object.hasOwn(m, "barycenter") || (m.barycenter = 0, m.weight = 0), m.barycenter = (m.barycenter * m.weight + p.order + _.order) / (m.weight + 2), m.weight += 2;
1205
+ }
1206
+ return m;
1207
+ }
1208
+ function ui(e, t) {
1209
+ e.forEach((n) => {
1210
+ n.vs = n.vs.flatMap((o) => t[o] ? t[o].vs : o);
1211
+ });
1212
+ }
1213
+ function ci(e, t) {
1214
+ e.barycenter !== void 0 ? (e.barycenter = (e.barycenter * e.weight + t.barycenter * t.weight) / (e.weight + t.weight), e.weight += t.weight) : (e.barycenter = t.barycenter, e.weight = t.weight);
1215
+ }
1216
+ function di(e, t, n, o) {
1217
+ o || (o = e.nodes());
1218
+ const s = fi(e), r = new ue({ compound: !0 }).setGraph({ root: s }).setDefaultNodeLabel((i) => e.node(i));
1219
+ return o.forEach((i) => {
1220
+ const l = e.node(i), u = e.parent(i);
1221
+ (l.rank === t || l.minRank <= t && t <= l.maxRank) && (r.setNode(i), r.setParent(i, u || s), e[n](i).forEach((h) => {
1222
+ const m = h.v === i ? h.w : h.v, p = r.edge(m, i), _ = p ? p.weight : 0;
1223
+ r.setEdge(m, i, {
1224
+ weight: e.edge(h).weight + _
1225
+ });
1226
+ }), Object.hasOwn(l, "minRank") && r.setNode(i, {
1227
+ borderLeft: l.borderLeft[t],
1228
+ borderRight: l.borderRight[t]
1229
+ }));
1230
+ }), r;
1231
+ }
1232
+ function fi(e) {
1233
+ let t;
1234
+ for (; e.hasNode(t = Je("_root")); ) ;
1235
+ return t;
1236
+ }
1237
+ function hi(e, t, n) {
1238
+ let o = {}, s;
1239
+ n.forEach((r) => {
1240
+ let i = e.parent(r), l, u;
1241
+ for (; i; ) {
1242
+ if (l = e.parent(i), l ? (u = o[l], o[l] = i) : (u = s, s = i), u && u !== i) {
1243
+ t.setEdge(u, i);
1244
+ return;
1245
+ }
1246
+ i = l;
1247
+ }
1248
+ });
1249
+ }
1250
+ function qn(e, t = {}) {
1251
+ if (typeof t.customOrder == "function") {
1252
+ t.customOrder(e, qn);
1253
+ return;
1254
+ }
1255
+ const n = At(e), o = Pn(
1256
+ e,
1257
+ Oe(1, n + 1),
1258
+ "inEdges"
1259
+ ), s = Pn(
1260
+ e,
1261
+ Oe(n - 1, -1, -1),
1262
+ "outEdges"
1263
+ );
1264
+ let r = ei(e);
1265
+ if (Dn(e, r), t.disableOptimalOrderHeuristic)
1266
+ return;
1267
+ let i = Number.POSITIVE_INFINITY, l;
1268
+ const u = t.constraints || [];
1269
+ for (let f = 0, h = 0; h < 4; ++f, ++h) {
1270
+ const m = f % 2 === 0 ? o : s, p = f % 4 >= 2;
1271
+ mi(m, p, u), r = Ge(e);
1272
+ const _ = ti(e, r);
1273
+ _ < i ? (i = _, h = 0, l = structuredClone(r)) : _ === i && (l = structuredClone(r));
1274
+ }
1275
+ Dn(e, l);
1276
+ }
1277
+ function Pn(e, t, n) {
1278
+ const o = /* @__PURE__ */ new Map();
1279
+ function s(r, i) {
1280
+ o.has(r) || o.set(r, []), o.get(r).push(i);
1281
+ }
1282
+ for (const r of e.nodes()) {
1283
+ const i = e.node(r);
1284
+ if (typeof i.rank == "number" && s(i.rank, r), typeof i.minRank == "number" && typeof i.maxRank == "number")
1285
+ for (let l = i.minRank; l <= i.maxRank; l++)
1286
+ l !== i.rank && s(l, r);
1287
+ }
1288
+ return t.map(
1289
+ (r) => di(
1290
+ e,
1291
+ r,
1292
+ n,
1293
+ o.get(r) || []
1294
+ )
1295
+ );
1296
+ }
1297
+ function mi(e, t, n) {
1298
+ const o = new ue();
1299
+ e.forEach((s) => {
1300
+ n.forEach((l) => o.setEdge(l.left, l.right));
1301
+ const r = s.graph().root, i = Kn(s, r, o, t);
1302
+ i.vs.forEach((l, u) => {
1303
+ s.node(l).order = u;
1304
+ }), hi(s, o, i.vs);
1305
+ });
1306
+ }
1307
+ function Dn(e, t) {
1308
+ Object.values(t).forEach((n) => {
1309
+ n.forEach((o, s) => {
1310
+ e.node(o).order = s;
1311
+ });
1312
+ });
1313
+ }
1314
+ function vi(e, t) {
1315
+ const n = {};
1316
+ function o(s, r) {
1317
+ let i = 0, l = 0;
1318
+ const u = s.length, f = r[r.length - 1];
1319
+ return r.forEach((h, m) => {
1320
+ const p = pi(e, h), _ = p ? e.node(p).order : u;
1321
+ (p || h === f) && (r.slice(l, m + 1).forEach((O) => {
1322
+ e.predecessors(O).forEach((M) => {
1323
+ const z = e.node(M), se = z.order;
1324
+ (se < i || _ < se) && !(z.dummy && e.node(O).dummy) && Jn(n, M, O);
1325
+ });
1326
+ }), l = m + 1, i = _);
1327
+ }), r;
1328
+ }
1329
+ return t.length && t.reduce(o), n;
1330
+ }
1331
+ function gi(e, t) {
1332
+ const n = {};
1333
+ function o(r, i, l, u, f) {
1334
+ let h;
1335
+ Oe(i, l).forEach((m) => {
1336
+ h = r[m], e.node(h).dummy && e.predecessors(h).forEach((p) => {
1337
+ const _ = e.node(p);
1338
+ _.dummy && (_.order < u || _.order > f) && Jn(n, p, h);
1339
+ });
1340
+ });
1341
+ }
1342
+ function s(r, i) {
1343
+ let l = -1, u, f = 0;
1344
+ return i.forEach((h, m) => {
1345
+ if (e.node(h).dummy === "border") {
1346
+ const p = e.predecessors(h);
1347
+ p.length && (u = e.node(p[0]).order, o(i, f, m, l, u), f = m, l = u);
1348
+ }
1349
+ o(i, f, i.length, u, r.length);
1350
+ }), i;
1351
+ }
1352
+ return t.length && t.reduce(s), n;
1353
+ }
1354
+ function pi(e, t) {
1355
+ if (e.node(t).dummy)
1356
+ return e.predecessors(t).find((n) => e.node(n).dummy);
1357
+ }
1358
+ function Jn(e, t, n) {
1359
+ if (t > n) {
1360
+ const s = t;
1361
+ t = n, n = s;
1362
+ }
1363
+ let o = e[t];
1364
+ o || (e[t] = o = {}), o[n] = !0;
1365
+ }
1366
+ function yi(e, t, n) {
1367
+ if (t > n) {
1368
+ const o = t;
1369
+ t = n, n = o;
1370
+ }
1371
+ return !!e[t] && Object.hasOwn(e[t], n);
1372
+ }
1373
+ function wi(e, t, n, o) {
1374
+ const s = {}, r = {}, i = {};
1375
+ return t.forEach((l) => {
1376
+ l.forEach((u, f) => {
1377
+ s[u] = u, r[u] = u, i[u] = f;
1378
+ });
1379
+ }), t.forEach((l) => {
1380
+ let u = -1;
1381
+ l.forEach((f) => {
1382
+ let h = o(f);
1383
+ if (h.length) {
1384
+ h = h.sort((p, _) => i[p] - i[_]);
1385
+ const m = (h.length - 1) / 2;
1386
+ for (let p = Math.floor(m), _ = Math.ceil(m); p <= _; ++p) {
1387
+ const O = h[p];
1388
+ r[f] === f && u < i[O] && !yi(n, f, O) && (r[O] = f, r[f] = s[f] = s[O], u = i[O]);
1389
+ }
1390
+ }
1391
+ });
1392
+ }), { root: s, align: r };
1393
+ }
1394
+ function bi(e, t, n, o, s) {
1395
+ const r = {}, i = ki(e, t, n, s), l = s ? "borderLeft" : "borderRight";
1396
+ function u(m, p) {
1397
+ const _ = i.nodes().slice(), O = {};
1398
+ let M = _.pop();
1399
+ for (; M; ) {
1400
+ if (O[M])
1401
+ m(M);
1402
+ else {
1403
+ O[M] = !0, _.push(M);
1404
+ for (const z of p(M))
1405
+ _.push(z);
1406
+ }
1407
+ M = _.pop();
1408
+ }
1409
+ }
1410
+ function f(m) {
1411
+ r[m] = i.inEdges(m).reduce((p, _) => Math.max(p, r[_.v] + i.edge(_)), 0);
1412
+ }
1413
+ function h(m) {
1414
+ const p = i.outEdges(m).reduce((O, M) => Math.min(O, r[M.w] - i.edge(M)), Number.POSITIVE_INFINITY), _ = e.node(m);
1415
+ p !== Number.POSITIVE_INFINITY && _.borderType !== l && (r[m] = Math.max(r[m], p));
1416
+ }
1417
+ return u(f, i.predecessors.bind(i)), u(h, i.successors.bind(i)), Object.keys(o).forEach((m) => {
1418
+ r[m] = r[n[m]];
1419
+ }), r;
1420
+ }
1421
+ function ki(e, t, n, o) {
1422
+ const s = new e.constructor(), r = e.graph(), i = Ni(r.nodesep, r.edgesep, o);
1423
+ return t.forEach((l) => {
1424
+ let u;
1425
+ l.forEach((f) => {
1426
+ const h = n[f];
1427
+ if (s.setNode(h), u) {
1428
+ const m = n[u], p = s.edge(m, h);
1429
+ s.setEdge(
1430
+ m,
1431
+ h,
1432
+ Math.max(i(e, f, u), p || 0)
1433
+ );
1434
+ }
1435
+ u = f;
1436
+ });
1437
+ }), s;
1438
+ }
1439
+ function Ei(e, t) {
1440
+ return Object.values(t).reduce(
1441
+ (n, o) => {
1442
+ let s = Number.NEGATIVE_INFINITY, r = Number.POSITIVE_INFINITY;
1443
+ Object.entries(o).forEach(([l, u]) => {
1444
+ const f = Si(e, l) / 2;
1445
+ s = Math.max(u + f, s), r = Math.min(u - f, r);
1446
+ });
1447
+ const i = s - r;
1448
+ return i < n[0] && (n = [i, o]), n;
1449
+ },
1450
+ [Number.POSITIVE_INFINITY, null]
1451
+ )[1];
1452
+ }
1453
+ function _i(e, t) {
1454
+ const n = Object.values(t), o = J(Math.min, n), s = J(Math.max, n);
1455
+ ["u", "d"].forEach((r) => {
1456
+ ["l", "r"].forEach((i) => {
1457
+ const l = r + i;
1458
+ let u = e[l];
1459
+ if (u === t) return;
1460
+ const f = Object.values(u);
1461
+ let h = o - J(Math.min, f);
1462
+ i !== "l" && (h = s - J(Math.max, f)), h && (u = je(u, (m) => m + h), e[l] = u);
1463
+ });
1464
+ });
1465
+ }
1466
+ function Ci(e, t) {
1467
+ return je(e.ul, (n, o) => {
1468
+ if (t)
1469
+ return e[t.toLowerCase()][o];
1470
+ const s = Object.values(e).map((r) => r[o]).sort((r, i) => r - i);
1471
+ return (s[1] + s[2]) / 2;
1472
+ });
1473
+ }
1474
+ function xi(e) {
1475
+ const t = Ge(e), n = Object.assign(
1476
+ vi(e, t),
1477
+ gi(e, t)
1478
+ ), o = {};
1479
+ let s;
1480
+ ["u", "d"].forEach((i) => {
1481
+ s = i === "u" ? t : Object.values(t).reverse(), ["l", "r"].forEach((l) => {
1482
+ let u = s;
1483
+ l === "r" && (u = u.map(
1484
+ (p) => Object.values(p).reverse()
1485
+ ));
1486
+ const f = (i === "u" ? e.predecessors : e.successors).bind(e), h = wi(
1487
+ e,
1488
+ u,
1489
+ n,
1490
+ f
1491
+ );
1492
+ let m = bi(
1493
+ e,
1494
+ u,
1495
+ h.root,
1496
+ h.align,
1497
+ l === "r"
1498
+ );
1499
+ l === "r" && (m = je(m, (p) => -p)), o[i + l] = m;
1500
+ });
1501
+ });
1502
+ const r = Ei(e, o);
1503
+ return _i(o, r), Ci(o, e.graph().align);
1504
+ }
1505
+ function Ni(e, t, n) {
1506
+ return (o, s, r) => {
1507
+ const i = o.node(s), l = o.node(r);
1508
+ let u = 0, f;
1509
+ if (u += i.width / 2, Object.hasOwn(i, "labelpos"))
1510
+ switch (i.labelpos.toLowerCase()) {
1511
+ case "l":
1512
+ f = -i.width / 2;
1513
+ break;
1514
+ case "r":
1515
+ f = i.width / 2;
1516
+ break;
1517
+ }
1518
+ if (f && (u += n ? f : -f), f = 0, u += (i.dummy ? t : e) / 2, u += (l.dummy ? t : e) / 2, u += l.width / 2, Object.hasOwn(l, "labelpos"))
1519
+ switch (l.labelpos.toLowerCase()) {
1520
+ case "l":
1521
+ f = l.width / 2;
1522
+ break;
1523
+ case "r":
1524
+ f = -l.width / 2;
1525
+ break;
1526
+ }
1527
+ return f && (u += n ? f : -f), f = 0, u;
1528
+ };
1529
+ }
1530
+ function Si(e, t) {
1531
+ return e.node(t).width;
1532
+ }
1533
+ function Li(e) {
1534
+ const t = Dt(e);
1535
+ Mi(t);
1536
+ const n = xi(t);
1537
+ Object.entries(n).forEach(([o, s]) => {
1538
+ e.node(o).x = s;
1539
+ });
1540
+ }
1541
+ function Mi(e) {
1542
+ const t = Ge(e), n = e.graph().ranksep;
1543
+ let o = 0;
1544
+ t.forEach((s) => {
1545
+ const r = s.reduce((i, l) => {
1546
+ const u = e.node(l).height;
1547
+ return i > u ? i : u;
1548
+ }, 0);
1549
+ s.forEach((i) => {
1550
+ e.node(i).y = o + r / 2;
1551
+ }), o += r + n;
1552
+ });
1553
+ }
1554
+ function Ti(e, t = {}) {
1555
+ const n = t.debugTiming ? Gn : jn;
1556
+ return n("layout", () => {
1557
+ const o = n(" buildLayoutGraph", () => zi(e));
1558
+ return n(" runLayout", () => Oi(o, n, t)), n(" updateInputGraph", () => $i(e, o)), o;
1559
+ });
1560
+ }
1561
+ function Oi(e, t, n) {
1562
+ t(" makeSpaceForEdgeLabels", () => Vi(e)), t(" removeSelfEdges", () => Ki(e)), t(" acyclic", () => _s(e)), t(" nestingGraph.run", () => js(e)), t(" rank", () => Bs(Dt(e))), t(" injectEdgeLabelProxies", () => Hi(e)), t(" removeEmptyRanks", () => Vn(e)), t(" nestingGraph.cleanup", () => Zs(e)), t(" normalizeRanks", () => zn(e)), t(" assignRankMinMax", () => Wi(e)), t(" removeEdgeLabelProxies", () => Gi(e)), t(" normalize.run", () => Ns(e)), t(" parentDummyChains", () => Hs(e)), t(" addBorderSegments", () => Xs(e)), t(" order", () => qn(e, n)), t(" insertSelfEdges", () => qi(e)), t(" adjustCoordinateSystem", () => $n.adjust(e)), t(" position", () => Li(e)), t(" positionSelfEdges", () => Ji(e)), t(" removeBorderNodes", () => Xi(e)), t(" normalize.undo", () => Ls(e)), t(" fixupEdgeLabelCoords", () => Ui(e)), t(" undoCoordinateSystem", () => $n.undo(e)), t(" translateGraph", () => ji(e)), t(" assignNodeIntersects", () => Yi(e)), t(" reversePoints", () => Zi(e)), t(" acyclic.undo", () => Cs(e));
1563
+ }
1564
+ function $i(e, t) {
1565
+ e.nodes().forEach((s) => {
1566
+ const r = e.node(s), i = t.node(s);
1567
+ r && (r.x = i.x, r.y = i.y, r.order = i.order, r.rank = i.rank, t.children(s).length && (r.width = i.width, r.height = i.height));
1568
+ }), e.edges().forEach((s) => {
1569
+ const r = e.edge(s), i = t.edge(s);
1570
+ r.points = i.points, Object.hasOwn(i, "x") && (r.x = i.x, r.y = i.y);
1571
+ });
1572
+ const n = t.graph(), o = e.graph();
1573
+ o.width = n.width, o.height = n.height;
1574
+ }
1575
+ const Ri = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], Pi = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, Di = ["acyclicer", "ranker", "rankdir", "align"], Ai = ["width", "height", "rank"], An = { width: 0, height: 0 }, Fi = ["minlen", "weight", "width", "height", "labeloffset"], Ii = {
1576
+ minlen: 1,
1577
+ weight: 1,
1578
+ width: 0,
1579
+ height: 0,
1580
+ labeloffset: 10,
1581
+ labelpos: "r"
1582
+ }, Bi = ["labelpos", "arrowshape"];
1583
+ function zi(e) {
1584
+ const t = Ot(e.graph()), n = {
1585
+ ...Pi,
1586
+ ...Tt(t, Ri),
1587
+ ...We(t, Di)
1588
+ }, o = new ue({ multigraph: !0, compound: !0 });
1589
+ return o.setGraph(n), e.nodes().forEach((s) => {
1590
+ const r = Ot(e.node(s)), i = Tt(r, Ai);
1591
+ Object.keys(An).forEach((l) => {
1592
+ i[l] === void 0 && (i[l] = An[l]);
1593
+ }), o.setNode(s, i), o.setParent(s, e.parent(s));
1594
+ }), e.edges().forEach((s) => {
1595
+ const r = Ot(e.edge(s));
1596
+ o.setEdge(
1597
+ s,
1598
+ {
1599
+ ...Ii,
1600
+ ...Tt(r, Fi),
1601
+ ...We(r, Bi)
1602
+ }
1603
+ );
1604
+ }), o;
1605
+ }
1606
+ function Vi(e) {
1607
+ const t = e.graph();
1608
+ t.ranksep /= 2, e.edges().forEach((n) => {
1609
+ const o = e.edge(n);
1610
+ o.minlen *= 2, o.labelpos.toLowerCase() !== "c" && (t.rankdir === "TB" || t.rankdir === "BT" ? o.width += o.labeloffset : o.height += o.labeloffset);
1611
+ });
1612
+ }
1613
+ function Hi(e) {
1614
+ e.edges().forEach((t) => {
1615
+ const n = e.edge(t);
1616
+ if (n.width && n.height) {
1617
+ const o = e.node(t.v), r = { rank: (e.node(t.w).rank - o.rank) / 2 + o.rank, e: t };
1618
+ $e(e, "edge-proxy", r, "_ep");
1619
+ }
1620
+ });
1621
+ }
1622
+ function Wi(e) {
1623
+ let t = 0;
1624
+ e.nodes().forEach((n) => {
1625
+ const o = e.node(n);
1626
+ o.borderTop && (o.minRank = e.node(o.borderTop).rank, o.maxRank = e.node(o.borderBottom).rank, t = Math.max(t, o.maxRank));
1627
+ }), e.graph().maxRank = t;
1628
+ }
1629
+ function Gi(e) {
1630
+ e.nodes().forEach((t) => {
1631
+ const n = e.node(t);
1632
+ n.dummy === "edge-proxy" && (e.edge(n.e).labelRank = n.rank, e.removeNode(t));
1633
+ });
1634
+ }
1635
+ function ji(e) {
1636
+ let t = Number.POSITIVE_INFINITY, n = 0, o = Number.POSITIVE_INFINITY, s = 0;
1637
+ const r = e.graph(), i = r.marginx || 0, l = r.marginy || 0;
1638
+ function u(f) {
1639
+ const h = f.x, m = f.y, p = f.width, _ = f.height;
1640
+ t = Math.min(t, h - p / 2), n = Math.max(n, h + p / 2), o = Math.min(o, m - _ / 2), s = Math.max(s, m + _ / 2);
1641
+ }
1642
+ e.nodes().forEach((f) => u(e.node(f))), e.edges().forEach((f) => {
1643
+ const h = e.edge(f);
1644
+ Object.hasOwn(h, "x") && u(h);
1645
+ }), t -= i, o -= l, e.nodes().forEach((f) => {
1646
+ const h = e.node(f);
1647
+ h.x -= t, h.y -= o;
1648
+ }), e.edges().forEach((f) => {
1649
+ const h = e.edge(f);
1650
+ h.points.forEach((m) => {
1651
+ m.x -= t, m.y -= o;
1652
+ }), Object.hasOwn(h, "x") && (h.x -= t), Object.hasOwn(h, "y") && (h.y -= o);
1653
+ }), r.width = n - t + i, r.height = s - o + l;
1654
+ }
1655
+ function Fn(e, t, n) {
1656
+ if (!t)
1657
+ return e;
1658
+ const o = t.x - e.x, s = t.y - e.y, r = Math.sqrt(o * o + s * s);
1659
+ if (!r || r <= n)
1660
+ return e;
1661
+ const i = n / r;
1662
+ return {
1663
+ x: e.x + o * i,
1664
+ y: e.y + s * i
1665
+ };
1666
+ }
1667
+ function Yi(e) {
1668
+ e.edges().forEach((n) => {
1669
+ const o = e.edge(n), s = e.node(n.v), r = e.node(n.w);
1670
+ let i, l;
1671
+ !o.points || !o.points.length ? (o.points = [], i = r, l = s) : (i = o.points[0], l = o.points[o.points.length - 1]);
1672
+ const u = Pt(s, i), f = Pt(r, l), h = o.points.length ? o.points[0] : i, m = o.points.length ? o.points[o.points.length - 1] : l, p = o.arrowshape, _ = p === "normal" || p === "vee", O = !!o.reversed;
1673
+ let M = u, z = f;
1674
+ _ && (O ? M = Fn(u, h, 4) : z = Fn(f, m, 4)), o.points.unshift(M), o.points.push(z);
1675
+ });
1676
+ }
1677
+ function Ui(e) {
1678
+ e.edges().forEach((t) => {
1679
+ const n = e.edge(t);
1680
+ if (Object.hasOwn(n, "x"))
1681
+ switch ((n.labelpos === "l" || n.labelpos === "r") && (n.width -= n.labeloffset), n.labelpos) {
1682
+ case "l":
1683
+ n.x -= n.width / 2 + n.labeloffset;
1684
+ break;
1685
+ case "r":
1686
+ n.x += n.width / 2 + n.labeloffset;
1687
+ break;
1688
+ }
1689
+ });
1690
+ }
1691
+ function Zi(e) {
1692
+ e.edges().forEach((t) => {
1693
+ const n = e.edge(t);
1694
+ n.reversed && n.points.reverse();
1695
+ });
1696
+ }
1697
+ function Xi(e) {
1698
+ e.nodes().forEach((t) => {
1699
+ if (e.children(t).length) {
1700
+ const n = e.node(t), o = e.node(n.borderTop), s = e.node(n.borderBottom), r = e.node(n.borderLeft[n.borderLeft.length - 1]), i = e.node(n.borderRight[n.borderRight.length - 1]);
1701
+ n.width = Math.abs(i.x - r.x), n.height = Math.abs(s.y - o.y), n.x = r.x + n.width / 2, n.y = o.y + n.height / 2;
1702
+ }
1703
+ }), e.nodes().forEach((t) => {
1704
+ e.node(t).dummy === "border" && e.removeNode(t);
1705
+ });
1706
+ }
1707
+ function Ki(e) {
1708
+ e.edges().forEach((t) => {
1709
+ if (t.v === t.w) {
1710
+ const n = e.node(t.v);
1711
+ n.selfEdges || (n.selfEdges = []), n.selfEdges.push({ e: t, label: e.edge(t) }), e.removeEdge(t);
1712
+ }
1713
+ });
1714
+ }
1715
+ function qi(e) {
1716
+ Ge(e).forEach((n) => {
1717
+ let o = 0;
1718
+ n.forEach((s, r) => {
1719
+ const i = e.node(s);
1720
+ i.order = r + o, (i.selfEdges || []).forEach((l) => {
1721
+ $e(e, "selfedge", {
1722
+ width: l.label.width,
1723
+ height: l.label.height,
1724
+ rank: i.rank,
1725
+ order: r + ++o,
1726
+ e: l.e,
1727
+ label: l.label
1728
+ }, "_se");
1729
+ }), delete i.selfEdges;
1730
+ });
1731
+ });
1732
+ }
1733
+ function Ji(e) {
1734
+ e.nodes().forEach((t) => {
1735
+ const n = e.node(t);
1736
+ if (n.dummy === "selfedge") {
1737
+ const o = e.node(n.e.v), s = o.x + o.width / 2, r = o.y, i = n.x - s, l = o.height / 2;
1738
+ e.setEdge(n.e, n.label), e.removeNode(t), n.label.points = [
1739
+ { x: s + 2 * i / 3, y: r - l },
1740
+ { x: s + 5 * i / 6, y: r - l },
1741
+ { x: s + i, y: r },
1742
+ { x: s + 5 * i / 6, y: r + l },
1743
+ { x: s + 2 * i / 3, y: r + l }
1744
+ ], n.label.x = n.x, n.label.y = n.y;
1745
+ }
1746
+ });
1747
+ }
1748
+ function Tt(e, t) {
1749
+ return je(We(e, t), Number);
1750
+ }
1751
+ function Ot(e) {
1752
+ const t = {};
1753
+ return e && Object.entries(e).forEach(([n, o]) => {
1754
+ let s = n;
1755
+ typeof s == "string" && (s = s.toLowerCase()), t[s] = o;
1756
+ }), t;
1757
+ }
1758
+ const Qi = {
1759
+ rankDirection: "TB",
1760
+ // "TB", "BT", "LR", "RL"
1761
+ nodeSeparation: 50,
1762
+ rankSeparation: 50,
1763
+ edgeSeparation: 10,
1764
+ // "UL", "UR", "DL", "DR" or undefined force one of four extreme alignment strategies (Up/Down × Left/Right).
1765
+ align: void 0,
1766
+ nodeWidth: 100,
1767
+ nodeHeight: 40,
1768
+ curvedEdges: !1,
1769
+ padding: 20,
1770
+ // "undirected" | "normal" | "vee"
1771
+ arrowShape: "normal",
1772
+ arrowSize: 10
1773
+ };
1774
+ function er(e) {
1775
+ return e.length ? e.map(
1776
+ (t, n) => `${n === 0 ? "M" : "L"} ${t.x} ${t.y}`
1777
+ ).join(" ") : "";
1778
+ }
1779
+ function tr(e) {
1780
+ if (!e.length) return "";
1781
+ if (e.length === 1) {
1782
+ const s = e[0];
1783
+ return `M ${s.x} ${s.y}`;
1784
+ }
1785
+ if (e.length === 2)
1786
+ return `M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;
1787
+ const [t] = e;
1788
+ let n = `M ${t.x} ${t.y}`;
1789
+ for (let s = 1; s < e.length - 1; s += 1) {
1790
+ e[s - 1];
1791
+ const r = e[s], i = e[s + 1], l = r.x, u = r.y, f = (r.x + i.x) / 2, h = (r.y + i.y) / 2;
1792
+ n += ` Q ${l} ${u} ${f} ${h}`;
1793
+ }
1794
+ const o = e[e.length - 1];
1795
+ return n += ` L ${o.x} ${o.y}`, n;
1796
+ }
1797
+ function nr(e) {
1798
+ const { nodes: t, edges: n, configuration: o } = e, s = C(null), r = C(null), i = `dag-arrow-${$t()}`;
1799
+ function l(u, f, h) {
1800
+ r.value = null, s.value = null;
1801
+ const m = {
1802
+ ...Qi,
1803
+ ...h
1804
+ }, p = new ue({ multigraph: !0, compound: !0 });
1805
+ p.setGraph({
1806
+ rankdir: m.rankDirection,
1807
+ nodesep: m.nodeSeparation,
1808
+ ranksep: m.rankSeparation,
1809
+ edgesep: m.edgeSeparation,
1810
+ align: m.align
1811
+ }), u.forEach((k) => {
1812
+ p.setNode(k.id, {
1813
+ label: k.label,
1814
+ width: k.width ?? m.nodeWidth,
1815
+ height: k.height ?? m.nodeHeight
1816
+ });
1817
+ }), f.forEach((k) => {
1818
+ p.setEdge(k.from, k.to, {
1819
+ weight: k.weight ?? 1,
1820
+ minlen: k.minLength ?? 1,
1821
+ arrowShape: m.arrowShape ?? "normal"
1822
+ });
1823
+ }), Ti(p);
1824
+ const _ = u.map((k) => {
1825
+ const F = p.node(k.id);
1826
+ return {
1827
+ id: k.id,
1828
+ label: k.label,
1829
+ x: F.x,
1830
+ y: F.y,
1831
+ width: F.width,
1832
+ height: F.height,
1833
+ original: k
1834
+ };
1835
+ }), O = p.edges().map((k) => {
1836
+ const F = p.edge(k), G = F.points || [];
1837
+ if (!G.length)
1838
+ return null;
1839
+ const K = m.curvedEdges ? tr(G) : er(G), De = m.arrowShape !== "undirected" ? `url(#${i})` : null, be = f.find((c) => c?.from === k.v && c?.to === k.w);
1840
+ return {
1841
+ id: `${k.v}->${k.w}->${$t()}`,
1842
+ from: k.v,
1843
+ to: k.w,
1844
+ points: G,
1845
+ pathData: K,
1846
+ markerEnd: De,
1847
+ original: {
1848
+ ...be,
1849
+ ...F
1850
+ }
1851
+ };
1852
+ }).filter(Boolean), M = m.padding;
1853
+ if (!_.length) {
1854
+ s.value = {
1855
+ nodes: [],
1856
+ edges: O,
1857
+ viewBox: "0 0 0 0",
1858
+ arrowShape: m.arrowShape,
1859
+ arrowSize: m.arrowSize
1860
+ };
1861
+ return;
1862
+ }
1863
+ const z = _.flatMap((k) => [
1864
+ k.x - k.width / 2,
1865
+ k.x + k.width / 2
1866
+ ]), se = _.flatMap((k) => [
1867
+ k.y - k.height / 2,
1868
+ k.y + k.height / 2
1869
+ ]), Pe = Math.min(...z) - M, ye = Math.max(...z) + M, ce = Math.min(...se) - M, we = Math.max(...se) + M;
1870
+ s.value = {
1871
+ nodes: _,
1872
+ edges: O.map((k) => ({
1873
+ ...k,
1874
+ midpoint: k.pathData ? Wo(k.pathData) : { x: 0, y: 0 }
1875
+ })),
1876
+ viewBox: `${Pe} ${ce} ${ye - Pe} ${we - ce}`,
1877
+ arrowShape: m.arrowShape,
1878
+ arrowSize: m.arrowSize
1879
+ };
1880
+ }
1881
+ return Bo(() => {
1882
+ try {
1883
+ const u = y(t) || [], f = y(n) || [], h = y(o) || {};
1884
+ l(u, f, h);
1885
+ } catch (u) {
1886
+ console.error("[useDag] layout error:", u), r.value = u, s.value = null;
1887
+ }
1888
+ }), {
1889
+ layoutData: s,
1890
+ lastError: r,
1891
+ arrowMarkerIdentifier: i,
1892
+ recomputeLayout: () => {
1893
+ const u = y(t) || [], f = y(n) || [], h = y(o) || {};
1894
+ l(u, f, h);
1895
+ }
1896
+ };
1897
+ }
1898
+ const or = ["id"], sr = ["id"], ir = {
1899
+ key: 1,
1900
+ class: "dag-chart-error"
1901
+ }, rr = { style: { position: "relative" } }, ar = ["viewBox", "xmlns", "aria-describedby"], lr = { key: 0 }, ur = ["id", "width", "height"], cr = ["cx", "cy", "r", "fill"], dr = ["x", "y", "width", "height", "fill"], fr = { key: 2 }, hr = ["id", "markerWidth", "markerHeight", "refX", "refY"], mr = ["d", "fill", "stroke"], vr = ["d", "fill", "stroke"], gr = { class: "vue-ui-dag-edges" }, pr = ["data-a11y-midpoint-id", "aria-label", "onMouseenter"], yr = { class: "vue-ui-dag-nodes" }, wr = ["onClick", "onMouseenter", "onMouseleave"], br = ["data-a11y-node-id", "aria-label"], kr = ["x", "y", "width", "height"], Er = { class: "vue-ui-dag-edges" }, _r = ["d", "stroke-width", "marker-end"], Cr = { class: "vue-ui-dag-node-labels" }, xr = ["onClick", "onMouseenter", "onMouseleave"], Nr = ["x", "y", "font-size", "fill", "font-weight"], Sr = ["x", "y", "font-size", "fill", "font-weight", "innerHTML"], Lr = { key: 1 }, Mr = {
1902
+ key: 1,
1903
+ style: { position: "absolute", top: "100%", left: "0", width: "100%" },
1904
+ "data-dom-to-png-ignore": "",
1905
+ "aria-hidden": "true"
1906
+ }, Tr = {
1907
+ key: 6,
1908
+ class: "vue-data-ui-watermark"
1909
+ }, Or = ["data-position"], $r = { key: 0 }, Rr = ["data-position"], Pr = { key: 0 }, In = 1.5, Dr = {
1910
+ __name: "vue-ui-dag",
1911
+ props: {
1912
+ dataset: {
1913
+ type: Object,
1914
+ default() {
1915
+ return {
1916
+ nodes: [],
1917
+ edges: []
1918
+ };
1919
+ }
1920
+ },
1921
+ config: {
1922
+ type: Object,
1923
+ default() {
1924
+ return {};
1925
+ }
1926
+ }
1927
+ },
1928
+ emits: ["onNodeClick", "onMidpointEnter", "onMidpointLeave", "copyAlt", "rotate"],
1929
+ setup(e, { expose: t, emit: n }) {
1930
+ const o = _t(() => import("./PenAndPaper-Ct3qJ4lA.js")), s = _t(() => import("./UserOptions-rW2fRf3V.js")), r = _t(() => import("./PackageVersion-DPO-OOVI.js")), { vue_ui_dag: i } = Ko(), { isThemeValid: l, warnInvalidTheme: u } = ts(), f = e, h = n, m = C(null), p = C($t()), _ = C(null), O = C(null), M = C(null), z = C(0), se = C(0), Pe = C(!1), ye = C(!1), ce = C(!1), we = C(!1), k = C(null), F = C(null), G = C(null), K = C(null), et = C(null), De = C("pointer"), be = C(!1), c = C(lt()), tt = I(() => c.value.userOptions.useCursorPointer), nt = C(c.value.style.chart.width), ot = C(c.value.style.chart.height), Ft = C({ x: 0, y: 0 }), Y = C(null), st = C(null), It = C({ left: "0px", top: "0px" }), Bt = C("top"), ie = C(!1), zt = C({ x: 0, y: 0 }), Vt = C({ x: 0, y: 0 }), Ae = C(null), it = C(null), rt = C({ left: "0px", top: "0px" }), Ht = C("top"), de = C(!1), ke = C(!1), { svgRef: Q } = os({ config: c.value.style.chart.title }), { userOptionsVisible: at, setUserOptionsVisibility: Wt, keepUserOptionState: Gt } = ns({ config: c.value }), ee = C(c.value.style.chart.layout.rankDirection), Qn = I(() => kn({
1931
+ defaultConfig: {
1932
+ userOptions: { show: !1 },
1933
+ style: {
1934
+ chart: {
1935
+ backgroundColor: "#99999930",
1936
+ nodes: {
1937
+ stroke: "#CCCCCC",
1938
+ backgroundColor: "#DDDDDD50"
1939
+ },
1940
+ edges: {
1941
+ stroke: "#CCCCCC"
1942
+ },
1943
+ midpoints: {
1944
+ stroke: "#CCCCCC",
1945
+ fill: "#CCCCCC"
1946
+ }
1947
+ }
1948
+ }
1949
+ },
1950
+ userConfig: c.value.skeletonConfig ?? {}
1951
+ })), { loading: Fe, FINAL_DATASET: Ye, manualLoading: jt } = qo({
1952
+ ...zo(f),
1953
+ FINAL_CONFIG: c,
1954
+ prepareConfig: lt,
1955
+ skeletonDataset: f.config?.skeletonDataset ?? {
1956
+ nodes: [
1957
+ { id: "A", label: "" },
1958
+ { id: "B", label: "" },
1959
+ { id: "C", label: "" }
1960
+ ],
1961
+ edges: [
1962
+ { from: "A", to: "B" },
1963
+ { from: "A", to: "C" }
1964
+ ]
1965
+ },
1966
+ skeletonConfig: kn({
1967
+ defaultConfig: c.value,
1968
+ userConfig: Qn.value
1969
+ })
1970
+ });
1971
+ function lt() {
1972
+ const a = xt({
1973
+ userConfig: f.config,
1974
+ defaultConfig: i
1975
+ }), v = a.theme;
1976
+ if (!v) return a;
1977
+ if (!l.value(a))
1978
+ return u(a), a;
1979
+ const d = xt({
1980
+ userConfig: rs[v] || f.config,
1981
+ defaultConfig: a
1982
+ });
1983
+ return xt({
1984
+ userConfig: f.config,
1985
+ defaultConfig: d
1986
+ });
1987
+ }
1988
+ const ut = I(() => !!c.value.debug);
1989
+ vn(async () => {
1990
+ Go(f.dataset) && (En({
1991
+ componentName: "VueUiDag",
1992
+ type: "dataset",
1993
+ debug: ut.value
1994
+ }), ye.value = !1, jt.value = !0), f.dataset.nodes || (En({
1995
+ componentName: "VueUiDag",
1996
+ type: "datasetAttributeEmpty",
1997
+ property: "nodes",
1998
+ index: 0,
1999
+ debug: ut.value
2000
+ }), ye.value = !1, jt.value = !0), ye.value = !0, await Se(), rn();
2001
+ }), ze(() => f.config, async (a) => {
2002
+ Fe.value || (c.value = lt()), at.value = !c.value.userOptions.showOnChartHover, z.value += 1, ee.value = c.value.style.chart.layout.rankDirection, nt.value = c.value.style.chart.width, ot.value = c.value.style.chart.height, Ee.value = c.value.style.chart.zoom.active, await Se(), rn();
2003
+ }, { deep: !0 });
2004
+ const { isPrinting: ct, isImaging: dt, generatePdf: Yt, generateImage: Ut } = Qo({
2005
+ elementId: `dag_${p.value}`,
2006
+ fileName: c.value.style.chart.title.text || "vue-ui-dag",
2007
+ options: c.value.userOptions.print
2008
+ }), eo = I(() => c.value.style.chart.backgroundColor), to = I(() => c.value.style.chart.title), { exportSvg: no, getSvg: oo } = es({
2009
+ svg: Q,
2010
+ title: to,
2011
+ legend: void 0,
2012
+ legendItems: void 0,
2013
+ backgroundColor: eo
2014
+ });
2015
+ async function Zt({ isCb: a }) {
2016
+ we.value = !0, await Se();
2017
+ try {
2018
+ if (a) {
2019
+ const { blob: v, url: d, text: g, dataUrl: b } = await oo();
2020
+ await Promise.resolve(c.value.userOptions.callbacks.svg({ blob: v, url: d, text: g, dataUrl: b }));
2021
+ } else
2022
+ await Promise.resolve(no());
2023
+ } finally {
2024
+ we.value = !1;
2025
+ }
2026
+ }
2027
+ function so() {
2028
+ Pe.value = !0, Wt(!0);
2029
+ }
2030
+ function io() {
2031
+ Wt(!1), Pe.value = !1;
2032
+ }
2033
+ function Xt({
2034
+ tooltipRef: a,
2035
+ isVisibleRef: v,
2036
+ anchorRef: d,
2037
+ styleRef: g,
2038
+ placementRef: b,
2039
+ offsetRef: E,
2040
+ margin: w = 24
2041
+ }) {
2042
+ return function() {
2043
+ const A = a.value;
2044
+ if (!A || !v.value) return;
2045
+ const T = A.getBoundingClientRect(), B = window.innerWidth, j = window.innerHeight, te = d.value.x, U = d.value.y, ne = E?.value?.x ?? 0, ve = E?.value?.y ?? 0;
2046
+ let P = U - ve - T.height - w, Z = te - T.width / 2, Ie = "top";
2047
+ if (P < w) {
2048
+ const Ne = U + ve + w;
2049
+ Ne + T.height <= j - w ? (P = Ne, Ie = "bottom") : (P = U - T.height / 2, P < w && (P = w), P + T.height > j - w && (P = j - T.height - w), Ie = "center");
2050
+ }
2051
+ Z < w && (Z = w), Z + T.width > B - w && (Z = B - T.width - w);
2052
+ const Ao = Z <= w, Fo = Z + T.width >= B - w;
2053
+ if ((Ao || Fo) && Ie !== "center") {
2054
+ let Ne, Be;
2055
+ const Io = te - ne - w;
2056
+ B - (te + ne) - w >= Io ? (Ne = "right", Be = te + ne + w) : (Ne = "left", Be = te - ne - w - T.width), Be >= w && Be + T.width <= B - w && (Z = Be, P = U - T.height / 2, P < w && (P = w), P + T.height > j - w && (P = j - T.height - w), Ie = Ne);
2057
+ }
2058
+ b.value = Ie, g.value = {
2059
+ left: `${Z}px`,
2060
+ top: `${P}px`
2061
+ };
2062
+ };
2063
+ }
2064
+ const ro = I(() => Ye.value.nodes.map((a) => ({
2065
+ ...a,
2066
+ backgroundColor: a.backgroundColor ? _n(a.backgroundColor) : c.value.style.chart.nodes.backgroundColor,
2067
+ color: a.color ? _n(a.color) : c.value.style.chart.nodes.labels.color
2068
+ }))), ao = I(() => Ye.value.edges), lo = I(() => ({
2069
+ ...c.value.style.chart.layout,
2070
+ rankDirection: ee.value
2071
+ })), { layoutData: x, lastError: Kt, arrowMarkerIdentifier: uo } = nr({
2072
+ nodes: ro,
2073
+ edges: ao,
2074
+ configuration: lo
2075
+ });
2076
+ function re(a) {
2077
+ return x.value ? x.value.nodes.find((v) => v.id === a) : null;
2078
+ }
2079
+ I(() => {
2080
+ if (!x.value) return [];
2081
+ const a = c.value.style.chart.edges.stroke, v = /* @__PURE__ */ new Set();
2082
+ return x.value.edges.forEach((d) => {
2083
+ v.add({
2084
+ id: d.id,
2085
+ from: d.from,
2086
+ to: d.to,
2087
+ color: d.original?.color || a
2088
+ });
2089
+ }), Array.from(v);
2090
+ });
2091
+ const qt = I(() => {
2092
+ const a = nt.value, v = ot.value, d = Number(a), g = Number(v), b = Number.isFinite(d) && d > 0, E = Number.isFinite(g) && g > 0;
2093
+ return !b && !E ? null : {
2094
+ width: b ? d : null,
2095
+ height: E ? g : null
2096
+ };
2097
+ }), Ee = C(c.value.style.chart.zoom.active), {
2098
+ viewBox: _e,
2099
+ resetZoom: Ue,
2100
+ setInitialViewBox: co,
2101
+ scale: Jt,
2102
+ zoomByFactor: Qt
2103
+ } = Xo(
2104
+ Q,
2105
+ { x: 0, y: 0, width: 100, height: 100 },
2106
+ 1,
2107
+ Ee,
2108
+ () => {
2109
+ ie.value = !1;
2110
+ }
2111
+ );
2112
+ function fo() {
2113
+ Ee.value = !Ee.value;
2114
+ }
2115
+ function en() {
2116
+ const a = x.value && x.value.viewBox;
2117
+ if (!a) return;
2118
+ const v = String(a).split(" ").map(Number);
2119
+ if (v.length !== 4) return;
2120
+ const [d, g, b, E] = v;
2121
+ if (!Number.isFinite(d) || !Number.isFinite(g) || !Number.isFinite(b) || !Number.isFinite(E))
2122
+ return;
2123
+ let w = b, N = E, A = d, T = g;
2124
+ const B = qt.value;
2125
+ B && (B.width !== null && (w = B.width), B.height !== null && (N = B.height), A = d - (w - b) / 2, T = g - (N - E) / 2), co(
2126
+ { x: A, y: T, width: w, height: N },
2127
+ { overwriteCurrentIfNotZoomed: !0 }
2128
+ );
2129
+ }
2130
+ ze(
2131
+ () => x.value && x.value.viewBox,
2132
+ () => {
2133
+ en();
2134
+ },
2135
+ { immediate: !0 }
2136
+ ), ze(
2137
+ () => qt.value,
2138
+ () => {
2139
+ en();
2140
+ }
2141
+ ), ze(() => ke.value, (a) => {
2142
+ Ee.value = !a;
2143
+ });
2144
+ const ho = I(() => {
2145
+ const a = _e.value;
2146
+ return a ? `${a.x} ${a.y} ${a.width} ${a.height}` : "0 0 0 0";
2147
+ }), fe = C(!1);
2148
+ function tn(a) {
2149
+ fe.value = a, se.value += 1;
2150
+ }
2151
+ function ft() {
2152
+ ke.value = !ke.value;
2153
+ }
2154
+ function ht() {
2155
+ Qt(In, !0);
2156
+ }
2157
+ function mt() {
2158
+ Qt(1 / In, !0);
2159
+ }
2160
+ const vt = ["TB", "RL", "BT", "LR"];
2161
+ function gt() {
2162
+ ee.value = vt[(vt.indexOf(ee.value) + 1) % vt.length], Ue(), h("rotate", ee.value);
2163
+ }
2164
+ const mo = Xt({
2165
+ tooltipRef: st,
2166
+ isVisibleRef: de,
2167
+ anchorRef: Ft,
2168
+ styleRef: It,
2169
+ placementRef: Bt
2170
+ }), vo = Xt({
2171
+ tooltipRef: it,
2172
+ isVisibleRef: ie,
2173
+ anchorRef: zt,
2174
+ styleRef: rt,
2175
+ placementRef: Ht,
2176
+ offsetRef: Vt
2177
+ }), q = C(null);
2178
+ async function nn(a) {
2179
+ h("onMidpointEnter", a);
2180
+ const v = Q.value;
2181
+ if (!v || !a?.midpoint) return;
2182
+ const d = v.createSVGPoint();
2183
+ d.x = a.midpoint.x, d.y = a.midpoint.y;
2184
+ const g = v.getScreenCTM();
2185
+ if (!g) return;
2186
+ const b = d.matrixTransform(g);
2187
+ Ft.value = {
2188
+ x: b.x,
2189
+ y: b.y
2190
+ }, Y.value = a, de.value = !0, c.value.style.chart.midpoints.selectedEdge.animated === !0 && (q.value = a.id, he()), await Se(), mo();
2191
+ }
2192
+ function ae() {
2193
+ de.value = !1, Y.value = null, h("onMidpointLeave"), c.value.style.chart.midpoints.selectedEdge.animated === !0 && (q.value = null, he());
2194
+ }
2195
+ async function pt(a) {
2196
+ if (h("onNodeClick", a), !c.value.style.chart.nodes.tooltip.showOnClick) return;
2197
+ const v = Q.value;
2198
+ if (!v) return;
2199
+ const d = v.createSVGPoint();
2200
+ d.x = a.x, d.y = a.y;
2201
+ const g = v.getScreenCTM();
2202
+ if (!g) return;
2203
+ const b = d.matrixTransform(g), E = c.value.style.chart.layout.nodeWidth, w = c.value.style.chart.layout.nodeHeight, N = g.a, A = g.d, T = E * N, B = w * A;
2204
+ Vt.value = {
2205
+ x: T / 2,
2206
+ y: B / 2
2207
+ }, zt.value = {
2208
+ x: b.x,
2209
+ y: b.y
2210
+ }, Ae.value = a, ie.value = !0, await Se(), vo();
2211
+ }
2212
+ function Ce() {
2213
+ ie.value = !1, Ae.value = null;
2214
+ }
2215
+ function on(a) {
2216
+ if (!(ie.value || de.value)) return;
2217
+ const d = it.value;
2218
+ if (d && d.contains(a.target))
2219
+ return;
2220
+ const g = st.value;
2221
+ if (g && g.contains(a.target))
2222
+ return;
2223
+ const b = Q.value;
2224
+ if (b && b.contains(a.target)) {
2225
+ const E = a.target.closest(".vue-ui-dag-node"), w = a.target.closest(".vue-ui-dag-edge-midpoint");
2226
+ if (E || w)
2227
+ return;
2228
+ }
2229
+ Ce(), ae(), be.value || Xe();
2230
+ }
2231
+ function sn(a) {
2232
+ a.key === "Escape" && (ie.value && Ce(), de.value && ae());
2233
+ }
2234
+ vn(() => {
2235
+ document.addEventListener("mousedown", on), document.addEventListener("keydown", sn);
2236
+ }), gn(() => {
2237
+ document.removeEventListener("mousedown", on), document.removeEventListener("keydown", sn), k.value && (F.value && k.value.unobserve(F.value), k.value.disconnect());
2238
+ });
2239
+ function rn() {
2240
+ if (!c.value.responsive) {
2241
+ k.value && (F.value && k.value.unobserve(F.value), k.value.disconnect(), k.value = null, F.value = null);
2242
+ return;
2243
+ }
2244
+ const a = Uo(() => {
2245
+ if (!m.value) return;
2246
+ const { width: v, height: d } = Zo({
2247
+ chart: m.value,
2248
+ title: c.value.style.chart.title.text ? _.value : null,
2249
+ legend: c.value.style.chart.controls.show ? M.value?.$el : null,
2250
+ source: O.value
2251
+ });
2252
+ requestAnimationFrame(() => {
2253
+ nt.value = Math.max(0.1, v), ot.value = Math.max(0.1, d - 12);
2254
+ });
2255
+ });
2256
+ k.value && (F.value && k.value.unobserve(F.value), k.value.disconnect()), k.value = new ResizeObserver(a), F.value = m.value ? m.value.parentNode : null, F.value && k.value.observe(F.value), a();
2257
+ }
2258
+ function go(a, v = {}) {
2259
+ const {
2260
+ direction: d = -1,
2261
+ mode: g = "oneLapNearest",
2262
+ dasharray: b = null
2263
+ } = v;
2264
+ if (!a || typeof a.getTotalLength != "function")
2265
+ return ut.value && console.warn(
2266
+ "VueUiDag @getIdealDashoffsetDelta: invalid path element",
2267
+ a
2268
+ ), 0;
2269
+ const E = a.getTotalLength(), w = b ?? a.getAttribute("stroke-dasharray") ?? (typeof getComputedStyle == "function" ? getComputedStyle(a).strokeDasharray : ""), N = te(w);
2270
+ if (!Number.isFinite(N) || N <= 0)
2271
+ return d * E;
2272
+ const A = Math.max(1, Math.round(E / N)), T = Math.max(1, Math.ceil(E / N)), B = Math.max(1, Math.floor(E / N));
2273
+ let j;
2274
+ return g === "pattern" ? j = N : g === "oneLapCeil" ? j = T * N : g === "oneLapFloor" ? j = B * N : j = A * N, d * j;
2275
+ function te(U) {
2276
+ if (!U || U === "none") return NaN;
2277
+ const ne = String(U).replace(/,/g, " ").trim().split(/\s+/).map((P) => Number.parseFloat(P)).filter((P) => Number.isFinite(P));
2278
+ if (!ne.length) return NaN;
2279
+ const ve = ne.reduce((P, Z) => P + Z, 0);
2280
+ return ne.length % 2 === 1 ? ve * 2 : ve;
2281
+ }
2282
+ }
2283
+ const yt = C(/* @__PURE__ */ new Map()), wt = C(/* @__PURE__ */ new Map());
2284
+ function po(a) {
2285
+ return function(d) {
2286
+ d ? yt.value.set(a, d) : yt.value.delete(a);
2287
+ };
2288
+ }
2289
+ function an() {
2290
+ wt.value.forEach((a) => {
2291
+ try {
2292
+ a.cancel();
2293
+ } catch {
2294
+ }
2295
+ }), wt.value.clear();
2296
+ }
2297
+ function he() {
2298
+ an();
2299
+ const a = x.value?.edges ?? [];
2300
+ if (!a.length) return;
2301
+ const v = c.value.style.chart.edges.animations, d = Number(v.referenceDistance) > 0 ? Number(v.referenceDistance) : 24;
2302
+ a.forEach((g) => {
2303
+ const b = c.value.style.chart.midpoints.selectedEdge.animated === !0 && q.value != null && g.id === q.value, E = !!g?.original?.animated || !!g?.animated || b, w = yt.value.get(g.id);
2304
+ if (!w) return;
2305
+ if (!E) {
2306
+ w.style.strokeDasharray = "0", w.style.strokeDashoffset = "0";
2307
+ return;
2308
+ }
2309
+ const N = g?.original?.dasharray ?? v.dasharray;
2310
+ w.style.strokeDasharray = String(N), w.style.strokeDashoffset = "0";
2311
+ const A = ![void 0, null].includes(g?.original?.animationDirection), T = ![void 0, null].includes(v.animationDirection), B = A ? Number(g.original.animationDirection) : T ? Number(v.animationDirection) : -1, j = go(w, {
2312
+ direction: B,
2313
+ mode: "oneLapNearest",
2314
+ dasharray: String(N)
2315
+ }), te = g?.original?.animationDurationMs ?? v.animationDurationMs ?? 1e3, U = Number(te), ve = Number.isFinite(U) && U > 0 ? d / U : d / 1e3, P = Math.max(1, Math.round(Math.abs(j) / Math.max(1e-9, ve))), Z = w.animate([{ strokeDashoffset: 0 }, { strokeDashoffset: j }], { duration: P, iterations: 1 / 0, easing: "linear" });
2316
+ wt.value.set(g.id, Z);
2317
+ });
2318
+ }
2319
+ ze(
2320
+ () => x.value && x.value.edges,
2321
+ async () => {
2322
+ await Se(), he();
2323
+ },
2324
+ { deep: !0, immediate: !0 }
2325
+ ), gn(() => {
2326
+ an();
2327
+ });
2328
+ async function yo({ scale: a = 2 } = {}) {
2329
+ if (!m.value) return;
2330
+ const { width: v, height: d } = m.value.getBoundingClientRect(), g = v / d, { imageUri: b, base64: E } = await ss({ domElement: m.value, base64: !0, img: !0, scale: a });
2331
+ return {
2332
+ imageUri: b,
2333
+ base64: E,
2334
+ title: c.value.style.chart.title.text ?? "vue-ui-dag",
2335
+ width: v,
2336
+ height: d,
2337
+ aspectRatio: g
2338
+ };
2339
+ }
2340
+ const me = I(() => {
2341
+ const a = Number(c.value.style.chart.layout.nodeHeight);
2342
+ return Number.isFinite(a) && a > 0 ? a / c.value.style.chart.backgroundPattern.spacingRatio : 12;
2343
+ }), wo = I(() => me.value * (c.value.style.chart.backgroundPattern.dotRadiusRatio / 100)), D = C(null);
2344
+ let xe = null, ln = 0;
2345
+ function bt(a) {
2346
+ xe && (clearTimeout(xe), xe = null), D.value !== a && (D.value = a, (c.value.style.chart.nodes.selected.downstreamEdges.animated === !0 || c.value.style.chart.nodes.selected.upstreamEdges.animated === !0) && he());
2347
+ }
2348
+ function bo(a) {
2349
+ De.value = "pointer", q.value = null, bt(a);
2350
+ }
2351
+ async function ko(a) {
2352
+ De.value = "pointer", D.value = null, await nn(a);
2353
+ }
2354
+ function un(a) {
2355
+ const v = ++ln;
2356
+ xe && clearTimeout(xe), xe = setTimeout(() => {
2357
+ v === ln && D.value === a && (D.value = null, (c.value.style.chart.nodes.selected.downstreamEdges.animated === !0 || c.value.style.chart.nodes.selected.upstreamEdges.animated === !0) && he());
2358
+ }, 20);
2359
+ }
2360
+ function Eo(a) {
2361
+ const v = a.from === D.value, d = a.to === D.value, g = K.value === "midpoint" && G.value === a.id, b = q.value === a.id || Y.value?.id === a.id || g;
2362
+ let E = a.original.color ?? c.value.style.chart.edges.stroke;
2363
+ if (b && c.value.style.chart.midpoints.selectedEdge.stroke != null ? E = c.value.style.chart.midpoints.selectedEdge.stroke : v && c.value.style.chart.nodes.selected.downstreamEdges.stroke != null ? E = c.value.style.chart.nodes.selected.downstreamEdges.stroke : d && c.value.style.chart.nodes.selected.upstreamEdges.stroke != null && (E = c.value.style.chart.nodes.selected.upstreamEdges.stroke), v && c.value.style.chart.nodes.selected.downstreamEdges.animated === !0)
2364
+ a.animated = !0;
2365
+ else if (d && c.value.style.chart.nodes.selected.upstreamEdges.animated === !0)
2366
+ a.animated = !0;
2367
+ else if (g && c.value.style.chart.midpoints.selectedEdge.animated === !0)
2368
+ a.animated = !0;
2369
+ else {
2370
+ const w = x.value?.edges.find((N) => N.id === a.id);
2371
+ a.animated = w?.original?.animated ?? !1;
2372
+ }
2373
+ return {
2374
+ d: a.pathData,
2375
+ fill: "none",
2376
+ stroke: E,
2377
+ "stroke-width": c.value.style.chart.edges.strokeWidth * (b || a.from === D.value ? 2 : 1),
2378
+ "stroke-linecap": "round",
2379
+ "stroke-linejoin": "round"
2380
+ };
2381
+ }
2382
+ function cn(a) {
2383
+ return K.value === "node" && G.value === a;
2384
+ }
2385
+ function _o(a) {
2386
+ const v = D.value === a.id, d = K.value === "node" && G.value === a.id, g = v || d, b = g && c.value.style.chart.nodes.selected.backgroundColor != null ? c.value.style.chart.nodes.selected.backgroundColor : a.original.backgroundColor, E = g && c.value.style.chart.nodes.selected.stroke != null ? c.value.style.chart.nodes.selected.stroke : c.value.style.chart.nodes.stroke, w = g && c.value.style.chart.nodes.selected.strokeWidth != null ? c.value.style.chart.nodes.selected.strokeWidth : c.value.style.chart.nodes.strokeWidth;
2387
+ return {
2388
+ x: a.x - a.width / 2,
2389
+ y: a.y - a.height / 2,
2390
+ width: a.width,
2391
+ height: a.height,
2392
+ rx: c.value.style.chart.nodes.borderRadius,
2393
+ fill: b,
2394
+ stroke: E,
2395
+ "stroke-width": w
2396
+ };
2397
+ }
2398
+ function Co(a) {
2399
+ const v = a.from === D.value, d = a.to === D.value, g = K.value === "midpoint" && G.value === a.id, b = q.value === a.id || Y.value?.id === a.id || g;
2400
+ let E = a.original.color ?? c.value.style.chart.edges.stroke;
2401
+ return b && c.value.style.chart.midpoints.selectedEdge.stroke != null ? E = c.value.style.chart.midpoints.selectedEdge.stroke : v && c.value.style.chart.nodes.selected.downstreamEdges.stroke != null ? E = c.value.style.chart.nodes.selected.downstreamEdges.stroke : d && c.value.style.chart.nodes.selected.upstreamEdges.stroke != null && (E = c.value.style.chart.nodes.selected.upstreamEdges.stroke), {
2402
+ cx: a.midpoint.x,
2403
+ cy: a.midpoint.y,
2404
+ r: c.value.style.chart.midpoints.radius,
2405
+ fill: g ? c.value.style.chart.midpoints.selectedEdge.stroke ?? c.value.style.chart.midpoints.fill : c.value.style.chart.midpoints.fill,
2406
+ stroke: E,
2407
+ "stroke-width": c.value.style.chart.edges.strokeWidth * (b || a.from === D.value ? 2 : 1)
2408
+ };
2409
+ }
2410
+ function Ze(a) {
2411
+ const v = a.from === D.value, d = a.to === D.value, g = K.value === "midpoint" && G.value === a.id, b = q.value === a.id || Y.value?.id === a.id || g;
2412
+ let E = a.color ?? a.original?.color ?? c.value.style.chart.edges.stroke;
2413
+ return b && c.value.style.chart.midpoints.selectedEdge.stroke != null ? E = c.value.style.chart.midpoints.selectedEdge.stroke : v && c.value.style.chart.nodes.selected.downstreamEdges.stroke != null ? E = c.value.style.chart.nodes.selected.downstreamEdges.stroke : d && c.value.style.chart.nodes.selected.upstreamEdges.stroke != null && (E = c.value.style.chart.nodes.selected.upstreamEdges.stroke), E;
2414
+ }
2415
+ function dn(a) {
2416
+ return `${uo}-${String(a).replace(/[^a-zA-Z0-9_-]/g, "_")}`;
2417
+ }
2418
+ function xo() {
2419
+ return x.value;
2420
+ }
2421
+ function No(a) {
2422
+ if (a?.stage === "start") {
2423
+ ce.value = !0;
2424
+ return;
2425
+ }
2426
+ if (a?.stage === "end") {
2427
+ ce.value = !1;
2428
+ return;
2429
+ }
2430
+ Ut();
2431
+ }
2432
+ async function fn() {
2433
+ if (h("copyAlt", {
2434
+ config: c.value,
2435
+ dataset: Ye.value
2436
+ }), !c.value.userOptions.callbacks.altCopy) {
2437
+ console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.");
2438
+ return;
2439
+ }
2440
+ await Promise.resolve(c.value.userOptions.callbacks.altCopy({
2441
+ config: c.value,
2442
+ dataset: Ye.value
2443
+ }));
2444
+ }
2445
+ const So = I(() => (x.value?.nodes ?? []).map((v) => ({
2446
+ id: v.id,
2447
+ type: "node",
2448
+ x: v.x,
2449
+ y: v.y,
2450
+ label: v.label ?? v.id,
2451
+ raw: v
2452
+ }))), Lo = I(() => c.value.style.chart.midpoints.show ? (x.value?.edges ?? []).filter((v) => v?.midpoint).map((v) => ({
2453
+ id: v.id,
2454
+ type: "midpoint",
2455
+ x: v.midpoint.x,
2456
+ y: v.midpoint.y,
2457
+ label: `${re(v.from)?.label ?? v.from} → ${re(v.to)?.label ?? v.to}`,
2458
+ raw: v
2459
+ })) : []), le = I(() => [...So.value, ...Lo.value].sort((a, v) => a.x === v.x ? a.y - v.y : a.x - v.x)), Mo = I(() => {
2460
+ const a = /* @__PURE__ */ new Map();
2461
+ return le.value.forEach((v, d) => {
2462
+ a.set(`${v.type}:${v.id}`, d);
2463
+ }), a;
2464
+ }), kt = I(() => {
2465
+ const a = x.value?.nodes ?? [], v = x.value?.edges ?? [], d = [
2466
+ c.value.a11y?.translations?.node ?? "Node",
2467
+ c.value.a11y?.translations?.parents ?? "Parents",
2468
+ c.value.a11y?.translations?.children ?? "Children"
2469
+ ], g = a.map((b) => {
2470
+ const E = v.filter((N) => N.to === b.id).map((N) => re(N.from)?.label ?? N.from).join(", "), w = v.filter((N) => N.from === b.id).map((N) => re(N.to)?.label ?? N.to).join(", ");
2471
+ return [
2472
+ b.label ?? b.id,
2473
+ E || "—",
2474
+ w || "—"
2475
+ ];
2476
+ });
2477
+ return { headers: d, rows: g };
2478
+ });
2479
+ function Et(a) {
2480
+ return `${a.type}:${a.id}`;
2481
+ }
2482
+ function To() {
2483
+ return G.value == null || K.value == null ? null : le.value.find(
2484
+ (a) => a.id === G.value && a.type === K.value
2485
+ ) ?? null;
2486
+ }
2487
+ async function hn(a) {
2488
+ if (a) {
2489
+ if (a.type === "node") {
2490
+ ae();
2491
+ return;
2492
+ }
2493
+ a.type === "midpoint" && (Ce(), await nn(a.raw));
2494
+ }
2495
+ }
2496
+ function mn(a) {
2497
+ if (a) {
2498
+ if (G.value = a.id, K.value = a.type, et.value = Mo.value.get(Et(a)) ?? null, a.type === "node") {
2499
+ bt(a.id), q.value = null;
2500
+ return;
2501
+ }
2502
+ a.type === "midpoint" && (D.value = null, q.value = a.id, c.value.style.chart.midpoints.selectedEdge.animated === !0 && he());
2503
+ }
2504
+ }
2505
+ function Xe() {
2506
+ G.value = null, K.value = null, et.value = null, ie.value || (D.value = null), de.value || (q.value = null, c.value.style.chart.midpoints.selectedEdge.animated === !0 && he());
2507
+ }
2508
+ function Oo() {
2509
+ be.value = !0, Xe();
2510
+ }
2511
+ function $o() {
2512
+ be.value = !1, Ce(), ae(), Xe();
2513
+ }
2514
+ function Ro(a, v, d) {
2515
+ const g = v.x - a.x, b = v.y - a.y;
2516
+ return d === "right" && g <= 0 || d === "left" && g >= 0 || d === "down" && b <= 0 || d === "up" && b >= 0 ? 1 / 0 : d === "right" || d === "left" ? Math.abs(g) * 1e3 + Math.abs(b) : Math.abs(b) * 1e3 + Math.abs(g);
2517
+ }
2518
+ function Ke(a, v) {
2519
+ const d = le.value.filter((E) => Et(E) !== Et(a));
2520
+ if (!d.length) return null;
2521
+ let g = null, b = 1 / 0;
2522
+ return d.forEach((E) => {
2523
+ const w = Ro(a, E, v);
2524
+ w < b && (b = w, g = E);
2525
+ }), g || (v === "right" || v === "down" ? le.value[0] ?? null : le.value[le.value.length - 1] ?? null);
2526
+ }
2527
+ async function Po(a) {
2528
+ a && (De.value = "keyboard", a.type === "node" && (ae(), await pt(a.raw)));
2529
+ }
2530
+ async function Do(a) {
2531
+ if (!Q.value || ke.value || document.activeElement !== Q.value || !le.value.length) return;
2532
+ const v = a.key === "ArrowLeft", d = a.key === "ArrowRight", g = a.key === "ArrowUp", b = a.key === "ArrowDown", E = a.key === "Enter" || a.key === " ", w = a.key === "Escape";
2533
+ if (!v && !d && !g && !b && !E && !w)
2534
+ return;
2535
+ if (a.preventDefault(), a.stopPropagation(), w) {
2536
+ Ce(), ae(), Xe();
2537
+ return;
2538
+ }
2539
+ let N = To();
2540
+ if (E) {
2541
+ if (!N) return;
2542
+ N.type === "node" && await Po(N);
2543
+ return;
2544
+ }
2545
+ if (!N) {
2546
+ const T = le.value[0];
2547
+ if (!T) return;
2548
+ mn(T), await hn(T);
2549
+ return;
2550
+ }
2551
+ let A = null;
2552
+ d ? A = Ke(N, "right") : v ? A = Ke(N, "left") : b ? A = Ke(N, "down") : g && (A = Ke(N, "up")), A && (Ce(), ae(), mn(A), await hn(A));
2553
+ }
2554
+ return t({
2555
+ getData: xo,
2556
+ getImage: yo,
2557
+ generatePdf: Yt,
2558
+ generateSvg: Zt,
2559
+ generateImage: Ut,
2560
+ toggleAnnotator: ft,
2561
+ toggleFullscreen: tn,
2562
+ zoomIn: ht,
2563
+ zoomOut: mt,
2564
+ resetZoom: Ue,
2565
+ switchDirection: gt,
2566
+ copyAlt: fn
2567
+ }), (a, v) => (S(), L("div", {
2568
+ class: pn(`vue-data-ui-component vue-ui-dag ${fe.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${c.value.responsive ? "vue-ui-dag-responsive" : ""}`),
2569
+ id: `dag_${p.value}`,
2570
+ ref_key: "dagChart",
2571
+ ref: m,
2572
+ style: Le({
2573
+ fontFamily: c.value.style.fontFamily,
2574
+ backgroundColor: c.value.style.chart.backgroundColor,
2575
+ padding: "0.5rem"
2576
+ }),
2577
+ onMouseenter: so,
2578
+ onMouseleave: io
2579
+ }, [
2580
+ X("div", {
2581
+ id: `chart-instructions-${p.value}`,
2582
+ class: "sr-only"
2583
+ }, [
2584
+ X("p", null, Me(c.value.a11y.translations.keyboardNavigation), 1)
2585
+ ], 8, sr),
2586
+ kt.value?.rows?.length ? (S(), oe(as, {
2587
+ key: 0,
2588
+ uid: p.value,
2589
+ head: kt.value.headers,
2590
+ body: kt.value.rows,
2591
+ notice: c.value.a11y.translations.tableAvailable,
2592
+ caption: c.value.a11y.translations.tableCaption
2593
+ }, null, 8, ["uid", "head", "body", "notice", "caption"])) : $("", !0),
2594
+ y(Kt) ? (S(), L("div", ir, Me(String(y(Kt))), 1)) : $("", !0),
2595
+ c.value.userOptions.buttons.annotator ? (S(), oe(y(o), {
2596
+ key: 2,
2597
+ svgRef: y(Q),
2598
+ backgroundColor: c.value.style.chart.backgroundColor,
2599
+ color: c.value.style.chart.color,
2600
+ active: ke.value,
2601
+ isCursorPointer: tt.value,
2602
+ onClose: ft
2603
+ }, {
2604
+ "annotator-action-close": V(() => [
2605
+ R(a.$slots, "annotator-action-close", {}, void 0, !0)
2606
+ ]),
2607
+ "annotator-action-color": V(({ color: d }) => [
2608
+ R(a.$slots, "annotator-action-color", H(W({ color: d })), void 0, !0)
2609
+ ]),
2610
+ "annotator-action-draw": V(({ mode: d }) => [
2611
+ R(a.$slots, "annotator-action-draw", H(W({ mode: d })), void 0, !0)
2612
+ ]),
2613
+ "annotator-action-undo": V(({ disabled: d }) => [
2614
+ R(a.$slots, "annotator-action-undo", H(W({ disabled: d })), void 0, !0)
2615
+ ]),
2616
+ "annotator-action-redo": V(({ disabled: d }) => [
2617
+ R(a.$slots, "annotator-action-redo", H(W({ disabled: d })), void 0, !0)
2618
+ ]),
2619
+ "annotator-action-delete": V(({ disabled: d }) => [
2620
+ R(a.$slots, "annotator-action-delete", H(W({ disabled: d })), void 0, !0)
2621
+ ]),
2622
+ _: 3
2623
+ }, 8, ["svgRef", "backgroundColor", "color", "active", "isCursorPointer"])) : $("", !0),
2624
+ c.value.userOptions.show && ye.value && (y(Gt) || y(at)) ? (S(), oe(y(s), {
2625
+ ref: "userOptionsRef",
2626
+ key: `user_option_${se.value}`,
2627
+ backgroundColor: c.value.style.chart.backgroundColor,
2628
+ color: c.value.style.chart.color,
2629
+ isPrinting: y(ct),
2630
+ isImaging: y(dt),
2631
+ uid: p.value,
2632
+ hasTooltip: !1,
2633
+ hasTable: !1,
2634
+ hasXls: !1,
2635
+ hasLabel: !1,
2636
+ hasPdf: c.value.userOptions.buttons.pdf,
2637
+ hasImg: c.value.userOptions.buttons.img,
2638
+ hasSvg: c.value.userOptions.buttons.svg,
2639
+ hasFullscreen: c.value.userOptions.buttons.fullscreen,
2640
+ hasAltCopy: c.value.userOptions.buttons.altCopy,
2641
+ isFullscreen: fe.value,
2642
+ chartElement: m.value,
2643
+ position: c.value.userOptions.position,
2644
+ titles: { ...c.value.userOptions.buttonTitles },
2645
+ hasAnnotator: c.value.userOptions.buttons.annotator,
2646
+ isAnnotation: ke.value,
2647
+ callbacks: c.value.userOptions.callbacks,
2648
+ printScale: c.value.userOptions.print.scale,
2649
+ hasZoom: c.value.userOptions.buttons.zoom,
2650
+ isZoom: Ee.value,
2651
+ isCursorPointer: tt.value,
2652
+ onToggleFullscreen: tn,
2653
+ onGeneratePdf: y(Yt),
2654
+ onGenerateImage: No,
2655
+ onGenerateSvg: Zt,
2656
+ onToggleAnnotator: ft,
2657
+ onToggleZoom: fo,
2658
+ onCopyAlt: fn,
2659
+ style: Le({
2660
+ visibility: y(Gt) ? y(at) ? "visible" : "hidden" : "visible"
2661
+ })
2662
+ }, Vo({ _: 2 }, [
2663
+ a.$slots.menuIcon ? {
2664
+ name: "menuIcon",
2665
+ fn: V(({ isOpen: d, color: g }) => [
2666
+ R(a.$slots, "menuIcon", H(W({ isOpen: d, color: g })), void 0, !0)
2667
+ ]),
2668
+ key: "0"
2669
+ } : void 0,
2670
+ a.$slots.optionPdf ? {
2671
+ name: "optionPdf",
2672
+ fn: V(() => [
2673
+ R(a.$slots, "optionPdf", {}, void 0, !0)
2674
+ ]),
2675
+ key: "1"
2676
+ } : void 0,
2677
+ a.$slots.optionImg ? {
2678
+ name: "optionImg",
2679
+ fn: V(() => [
2680
+ R(a.$slots, "optionImg", {}, void 0, !0)
2681
+ ]),
2682
+ key: "2"
2683
+ } : void 0,
2684
+ a.$slots.optionSvg ? {
2685
+ name: "optionSvg",
2686
+ fn: V(() => [
2687
+ R(a.$slots, "optionSvg", {}, void 0, !0)
2688
+ ]),
2689
+ key: "3"
2690
+ } : void 0,
2691
+ a.$slots.optionFullscreen ? {
2692
+ name: "optionFullscreen",
2693
+ fn: V(({ toggleFullscreen: d, isFullscreen: g }) => [
2694
+ R(a.$slots, "optionFullscreen", H(W({ toggleFullscreen: d, isFullscreen: g })), void 0, !0)
2695
+ ]),
2696
+ key: "4"
2697
+ } : void 0,
2698
+ a.$slots.optionAnnotator ? {
2699
+ name: "optionAnnotator",
2700
+ fn: V(({ toggleAnnotator: d, isAnnotator: g }) => [
2701
+ R(a.$slots, "optionAnnotator", H(W({ toggleAnnotator: d, isAnnotator: g })), void 0, !0)
2702
+ ]),
2703
+ key: "5"
2704
+ } : void 0,
2705
+ a.$slots.optionZoom ? {
2706
+ name: "optionZoom",
2707
+ fn: V(({ toggleZoom: d, isZoomLocked: g }) => [
2708
+ R(a.$slots, "optionZoom", H(W({ toggleZoom: d, isZoomLocked: g })), void 0, !0)
2709
+ ]),
2710
+ key: "6"
2711
+ } : void 0,
2712
+ a.$slots.optionAltCopy ? {
2713
+ name: "optionAltCopy",
2714
+ fn: V(({ altCopy: d }) => [
2715
+ R(a.$slots, "optionAltCopy", H(W({ altCopy: d })), void 0, !0)
2716
+ ]),
2717
+ key: "7"
2718
+ } : void 0
2719
+ ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasSvg", "hasFullscreen", "hasAltCopy", "isFullscreen", "chartElement", "position", "titles", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "hasZoom", "isZoom", "isCursorPointer", "onGeneratePdf", "style"])) : $("", !0),
2720
+ c.value.style.chart.title.text ? (S(), L("div", {
2721
+ key: 4,
2722
+ ref_key: "chartTitle",
2723
+ ref: _,
2724
+ style: "width:100%;background:transparent;"
2725
+ }, [
2726
+ (S(), oe(is, {
2727
+ key: `title_${z.value}`,
2728
+ config: {
2729
+ title: {
2730
+ cy: "dag-title",
2731
+ ...c.value.style.chart.title
2732
+ },
2733
+ subtitle: {
2734
+ cy: "dag-subtitle",
2735
+ ...c.value.style.chart.title.subtitle
2736
+ }
2737
+ }
2738
+ }, null, 8, ["config"]))
2739
+ ], 512)) : $("", !0),
2740
+ c.value.style.chart.controls.position === "top" && !y(Fe) && c.value.style.chart.controls.show ? (S(), oe(Cn, {
2741
+ key: 5,
2742
+ ref_key: "zoomControls",
2743
+ ref: M,
2744
+ config: c.value,
2745
+ scale: y(Jt),
2746
+ isFullscreen: fe.value,
2747
+ withDirection: "",
2748
+ onZoomIn: ht,
2749
+ onZoomOut: mt,
2750
+ onResetZoom: v[0] || (v[0] = () => y(Ue)(!0)),
2751
+ onSwitchDirection: gt
2752
+ }, null, 8, ["config", "scale", "isFullscreen"])) : $("", !0),
2753
+ X("div", rr, [
2754
+ y(x) ? (S(), L("svg", {
2755
+ key: 0,
2756
+ ref_key: "svgRef",
2757
+ ref: Q,
2758
+ class: pn({ "vue-ui-dag-svg": !0, "vue-data-ui-loading": y(Fe) }),
2759
+ viewBox: ho.value,
2760
+ xmlns: y(jo),
2761
+ style: Le({
2762
+ backgroundColor: c.value.style.chart.backgroundColor,
2763
+ height: "100%",
2764
+ width: "100%"
2765
+ }),
2766
+ tabindex: "0",
2767
+ "aria-describedby": `chart-instructions-${p.value}`,
2768
+ onFocus: Oo,
2769
+ onBlur: $o,
2770
+ onKeydown: Do
2771
+ }, [
2772
+ Ct(y(r)),
2773
+ c.value.style.chart.backgroundPattern.show ? (S(), L("defs", lr, [
2774
+ X("pattern", {
2775
+ id: `dag_bg_pattern_${p.value}`,
2776
+ patternUnits: "userSpaceOnUse",
2777
+ width: me.value,
2778
+ height: me.value
2779
+ }, [
2780
+ R(a.$slots, "background-pattern", H(W({
2781
+ x: me.value / 2,
2782
+ y: me.value / 2,
2783
+ color: c.value.style.chart.backgroundPattern.dotColor
2784
+ })), () => [
2785
+ X("circle", {
2786
+ cx: me.value / 2,
2787
+ cy: me.value / 2,
2788
+ r: wo.value,
2789
+ fill: c.value.style.chart.backgroundPattern.dotColor
2790
+ }, null, 8, cr)
2791
+ ], !0)
2792
+ ], 8, ur)
2793
+ ])) : $("", !0),
2794
+ c.value.style.chart.backgroundPattern.show ? (S(), L("rect", {
2795
+ key: 1,
2796
+ x: y(_e)?.x ?? 0,
2797
+ y: y(_e)?.y ?? 0,
2798
+ width: y(_e)?.width ?? 0,
2799
+ height: y(_e)?.height ?? 0,
2800
+ fill: `url(#dag_bg_pattern_${p.value})`,
2801
+ style: Le({
2802
+ pointerEvents: "none",
2803
+ opacity: c.value.style.chart.backgroundPattern.opacity
2804
+ })
2805
+ }, null, 12, dr)) : $("", !0),
2806
+ y(x).arrowShape !== "undirected" ? (S(), L("defs", fr, [
2807
+ (S(!0), L(ge, null, Ve(y(x).edges, (d) => (S(), L("marker", {
2808
+ key: `marker_${d.id}`,
2809
+ id: dn(d.id),
2810
+ markerWidth: y(x).arrowSize,
2811
+ markerHeight: y(x).arrowSize,
2812
+ refX: y(x).arrowSize - 3,
2813
+ refY: y(x).arrowSize / 2,
2814
+ orient: "auto",
2815
+ markerUnits: "strokeWidth"
2816
+ }, [
2817
+ y(x).arrowShape === "normal" ? (S(), L("path", {
2818
+ key: 0,
2819
+ d: `M 0 0 L ${y(x).arrowSize} ${y(x).arrowSize / 2} L 0 ${y(x).arrowSize} Z`,
2820
+ fill: Ze(d),
2821
+ stroke: Ze(d),
2822
+ "stroke-width": "0",
2823
+ style: { transition: "stroke 0.2s ease-in-out, fill 0.2s ease-in-out, stroke-width 0.2s ease-in-out" }
2824
+ }, null, 8, mr)) : (S(), L("path", {
2825
+ key: 1,
2826
+ d: `M 0 0 L ${y(x).arrowSize} ${y(x).arrowSize / 2} L 0 ${y(x).arrowSize} L ${y(x).arrowSize / 3} ${y(x).arrowSize / 2} Z`,
2827
+ fill: Ze(d),
2828
+ stroke: Ze(d),
2829
+ "stroke-width": "0",
2830
+ style: { transition: "stroke 0.2s ease-in-out, fill 0.2s ease-in-out, stroke-width 0.2s ease-in-out" }
2831
+ }, null, 8, vr))
2832
+ ], 8, hr))), 128))
2833
+ ])) : $("", !0),
2834
+ X("g", gr, [
2835
+ (S(!0), L(ge, null, Ve(y(x).edges, (d) => (S(), L(ge, {
2836
+ key: d.id
2837
+ }, [
2838
+ X("path", Te({
2839
+ "data-cy-edge": "",
2840
+ ref_for: !0,
2841
+ ref: po(d.id)
2842
+ }, { ref_for: !0 }, Eo(d), { style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out, stroke 0.2s ease-in-out" } }), null, 16),
2843
+ c.value.style.chart.midpoints.show ? (S(), L("circle", Te({
2844
+ key: 0,
2845
+ "data-cy-midpoint": "",
2846
+ class: "vue-ui-dag-edge-midpoint",
2847
+ "data-a11y-midpoint-id": d.id
2848
+ }, { ref_for: !0 }, Co(d), {
2849
+ "aria-label": `${re(d.from)?.label ?? d.from} to ${re(d.to)?.label ?? d.to}`,
2850
+ style: { transition: "stroke-width 0.2s ease-in-out, stroke 0.2s ease-in-out, fill 0.2s ease-in-out" },
2851
+ onMouseenter: (g) => ko(d),
2852
+ onMouseleave: ae
2853
+ }), null, 16, pr)) : $("", !0)
2854
+ ], 64))), 128))
2855
+ ]),
2856
+ X("g", yr, [
2857
+ (S(!0), L(ge, null, Ve(y(x).nodes, (d) => (S(), L("g", {
2858
+ key: d.id,
2859
+ class: "vue-ui-dag-node",
2860
+ onClick: yn((g) => c.value.style.chart.nodes.tooltip.showOnClick && pt(d), ["stop"]),
2861
+ onMouseenter: (g) => bo(d.id),
2862
+ onMouseleave: (g) => un(d.id)
2863
+ }, [
2864
+ a.$slots.node ? $("", !0) : (S(), L("rect", Te({
2865
+ key: 0,
2866
+ "data-cy-node": ""
2867
+ }, { ref_for: !0 }, _o(d), {
2868
+ "data-a11y-node-id": d.id,
2869
+ "aria-label": `${d.label ?? d.id}`,
2870
+ style: {
2871
+ cursor: c.value.style.chart.nodes.tooltip.showOnClick && tt.value ? "pointer" : "default",
2872
+ transition: "stroke 0.2s ease-in-out, stroke-width 0.2s ease-in-out, fill 0.2s ease-in-out"
2873
+ }
2874
+ }), null, 16, br)),
2875
+ a.$slots.node ? (S(), L("foreignObject", {
2876
+ key: 1,
2877
+ x: d.x - d.width / 2,
2878
+ y: d.y - d.height / 2,
2879
+ width: d.width,
2880
+ height: d.height
2881
+ }, [
2882
+ R(a.$slots, "node", Te({ ref_for: !0 }, { node: d, orientation: ee.value }), void 0, !0)
2883
+ ], 8, kr)) : $("", !0)
2884
+ ], 40, wr))), 128))
2885
+ ]),
2886
+ X("g", Er, [
2887
+ (S(!0), L(ge, null, Ve(y(x).edges, (d) => (S(), L("path", {
2888
+ key: d.id,
2889
+ d: d.pathData,
2890
+ fill: "none",
2891
+ stroke: "transparent",
2892
+ "stroke-width": c.value.style.chart.edges.strokeWidth * (d.from === D.value || d.id === Y.value?.id ? 1.3 : 1),
2893
+ "stroke-linecap": "round",
2894
+ "stroke-linejoin": "round",
2895
+ "marker-end": y(x).arrowShape === "undirected" ? null : `url(#${dn(d.id)})`,
2896
+ style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out, stroke 0.2s ease-in-out" }
2897
+ }, null, 8, _r))), 128))
2898
+ ]),
2899
+ X("g", Cr, [
2900
+ (S(!0), L(ge, null, Ve(y(x).nodes, (d) => (S(), L("g", {
2901
+ key: d.id,
2902
+ onClick: yn((g) => c.value.style.chart.nodes.tooltip.showOnClick && pt(d), ["stop"]),
2903
+ onMouseenter: (g) => bt(d.id),
2904
+ onMouseleave: (g) => un(d.id)
2905
+ }, [
2906
+ a.$slots["free-node-label"] ? $("", !0) : (S(), L(ge, { key: 0 }, [
2907
+ a.$slots["node-label"] ? (S(), L("text", {
2908
+ key: 0,
2909
+ x: d.x,
2910
+ y: d.y + c.value.style.chart.nodes.labels.fontSize / 3,
2911
+ "text-anchor": "middle",
2912
+ "font-size": c.value.style.chart.nodes.labels.fontSize,
2913
+ fill: D.value === d.id && c.value.style.chart.nodes.selected.labelColor != null ? c.value.style.chart.nodes.selected.labelColor : d.original.color,
2914
+ "font-weight": c.value.style.chart.nodes.labels.bold ? "bold" : "normal",
2915
+ style: { transition: "fill 0.2s ease-in-out" }
2916
+ }, [
2917
+ R(a.$slots, "node-label", Te({ ref_for: !0 }, { node: d, orientation: ee.value }), () => [
2918
+ Ho(Me(d.label), 1)
2919
+ ], !0)
2920
+ ], 8, Nr)) : !a.$slots["free-node-label"] && !a.$slots.node ? (S(), L("text", {
2921
+ key: 1,
2922
+ "data-cy-node-label": "",
2923
+ x: d.x,
2924
+ y: d.y + c.value.style.chart.nodes.labels.fontSize / 3,
2925
+ "text-anchor": "middle",
2926
+ "font-size": c.value.style.chart.nodes.labels.fontSize,
2927
+ fill: (D.value === d.id || cn(d.id)) && c.value.style.chart.nodes.selected.labelColor != null ? c.value.style.chart.nodes.selected.labelColor : d.original.color,
2928
+ "font-weight": c.value.style.chart.nodes.labels.bold ? "bold" : "normal",
2929
+ style: { transition: "fill 0.2s ease-in-out" },
2930
+ innerHTML: y(Yo)({
2931
+ content: d.label,
2932
+ fontSize: c.value.style.chart.nodes.labels.fontSize,
2933
+ fontWeight: c.value.style.chart.nodes.labels.bold ? "bold" : "normal",
2934
+ fill: (D.value === d.id || cn(d.id)) && c.value.style.chart.nodes.selected.labelColor != null ? c.value.style.chart.nodes.selected.labelColor : d.original.color,
2935
+ x: d.x,
2936
+ y: d.y,
2937
+ autoOffset: !0
2938
+ })
2939
+ }, null, 8, Sr)) : $("", !0)
2940
+ ], 64)),
2941
+ a.$slots["free-node-label"] ? (S(), L("g", Lr, [
2942
+ R(a.$slots, "free-node-label", Te({ ref_for: !0 }, { node: d, layoutData: y(x), orientation: ee.value }), void 0, !0)
2943
+ ])) : $("", !0)
2944
+ ], 40, xr))), 128))
2945
+ ]),
2946
+ R(a.$slots, "svg", {
2947
+ svg: {
2948
+ drawingArea: y(_e),
2949
+ data: y(x),
2950
+ orientation: ee.value,
2951
+ isPrintingImg: y(ct) | y(dt) | ce.value,
2952
+ isPrintingSvg: we.value
2953
+ }
2954
+ }, void 0, !0)
2955
+ ], 46, ar)) : $("", !0),
2956
+ a.$slots.hint ? (S(), L("div", Mr, [
2957
+ R(a.$slots, "hint", H(W({ hint: c.value.a11y.translations.keyboardNavigation, isVisible: be.value })), void 0, !0)
2958
+ ])) : $("", !0)
2959
+ ]),
2960
+ a.$slots.watermark ? (S(), L("div", Tr, [
2961
+ R(a.$slots, "watermark", H(W({ isPrinting: y(ct) || y(dt) || ce.value || we.value })), void 0, !0)
2962
+ ])) : $("", !0),
2963
+ Ct(wn, { name: "fade" }, {
2964
+ default: V(() => [
2965
+ de.value ? (S(), oe(bn, {
2966
+ key: 0,
2967
+ to: fe.value ? m.value : "body"
2968
+ }, [
2969
+ X("div", {
2970
+ "data-cy-tooltip-midpoint": "",
2971
+ ref_key: "tooltipRef",
2972
+ ref: st,
2973
+ class: "vue-ui-dag-tooltip",
2974
+ style: Le({
2975
+ ...It.value,
2976
+ maxWidth: c.value.style.chart.midpoints.tooltip.maxWidth,
2977
+ "--vue-data-ui-dag-tooltip-background": c.value.style.chart.midpoints.tooltip.backgroundColor,
2978
+ "--vue-data-ui-dag-tooltip-color": c.value.style.chart.midpoints.tooltip.color
2979
+ }),
2980
+ "data-position": Bt.value
2981
+ }, [
2982
+ R(a.$slots, "tooltip-midpoint", H(W({ edge: Y.value, layoutData: y(x) })), () => [
2983
+ Y.value ? (S(), L("div", $r, Me(re(Y.value.from)?.label ?? Y.value.from) + " → " + Me(re(Y.value.to)?.label ?? Y.value.to), 1)) : $("", !0)
2984
+ ], !0)
2985
+ ], 12, Or)
2986
+ ], 8, ["to"])) : $("", !0)
2987
+ ]),
2988
+ _: 3
2989
+ }),
2990
+ Ct(wn, { name: "fade" }, {
2991
+ default: V(() => [
2992
+ ie.value ? (S(), oe(bn, {
2993
+ key: 0,
2994
+ to: fe.value ? m.value : "body"
2995
+ }, [
2996
+ X("div", {
2997
+ "data-cy-tooltip-node": "",
2998
+ ref_key: "nodeTooltipRef",
2999
+ ref: it,
3000
+ class: "vue-ui-dag-node-tooltip",
3001
+ style: Le({
3002
+ maxWidth: c.value.style.chart.nodes.tooltip.maxWidth,
3003
+ left: rt.value.left,
3004
+ top: rt.value.top,
3005
+ "--vue-data-ui-dag-node-tooltip-background": c.value.style.chart.nodes.tooltip.backgroundColor,
3006
+ "--vue-data-ui-dag-node-tooltip-color": c.value.style.chart.nodes.tooltip.color
3007
+ }),
3008
+ "data-position": Ht.value
3009
+ }, [
3010
+ R(a.$slots, "tooltip-node", H(W({ node: Ae.value, layoutData: y(x) })), () => [
3011
+ Ae.value ? (S(), L("div", Pr, Me(Ae.value.label), 1)) : $("", !0)
3012
+ ], !0)
3013
+ ], 12, Rr)
3014
+ ], 8, ["to"])) : $("", !0)
3015
+ ]),
3016
+ _: 3
3017
+ }),
3018
+ c.value.style.chart.controls.position === "bottom" && !y(Fe) && c.value.style.chart.controls.show ? (S(), oe(Cn, {
3019
+ key: 7,
3020
+ ref_key: "zoomControls",
3021
+ ref: M,
3022
+ config: c.value,
3023
+ scale: y(Jt),
3024
+ isFullscreen: fe.value,
3025
+ withDirection: "",
3026
+ onZoomIn: ht,
3027
+ onZoomOut: mt,
3028
+ onResetZoom: v[1] || (v[1] = () => y(Ue)(!0)),
3029
+ onSwitchDirection: gt
3030
+ }, null, 8, ["config", "scale", "isFullscreen"])) : $("", !0),
3031
+ a.$slots.source ? (S(), L("div", {
3032
+ key: 8,
3033
+ ref_key: "source",
3034
+ ref: O,
3035
+ dir: "auto"
3036
+ }, [
3037
+ R(a.$slots, "source", {}, void 0, !0)
3038
+ ], 512)) : $("", !0),
3039
+ R(a.$slots, "skeleton", {}, () => [
3040
+ y(Fe) ? (S(), oe(Jo, { key: 0 })) : $("", !0)
3041
+ ], !0)
3042
+ ], 46, or));
3043
+ }
3044
+ }, ta = /* @__PURE__ */ ls(Dr, [["__scopeId", "data-v-b2f198cc"]]);
3045
+ export {
3046
+ ta as default
3047
+ };