vue-data-ui 3.7.16 → 3.8.0

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