vue-data-ui 3.9.3 → 3.9.5

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