vue-data-ui 3.7.16 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -43
- package/dist/{Arrow-9T8aUCDR.js → Arrow-pvqmWZAQ.js} +1 -1
- package/dist/{BaseDraggableDialog-CtB38kJq.js → BaseDraggableDialog-BYwNgX3M.js} +2 -2
- package/dist/{BaseIcon--wNsuYtd.js → BaseIcon-CALhpING.js} +5 -3
- package/dist/{ColorPicker-CsQ_h1jK.js → ColorPicker-B_9b0REv.js} +2 -2
- package/dist/{DataTable-DRZJOlJB.js → DataTable-Ca1twcf7.js} +2 -2
- package/dist/{Legend-DSyOOSJ1.js → Legend-Djkw4FGq.js} +2 -2
- package/dist/{NonSvgPenAndPaper-C_uUSM9z.js → NonSvgPenAndPaper-DCQPVA4M.js} +3 -3
- package/dist/{PackageVersion-BW9_gimf.js → PackageVersion-Dc4fCiDF.js} +1 -1
- package/dist/{PenAndPaper-CMmG5Mka.js → PenAndPaper-DscVdZ1u.js} +3 -3
- package/dist/{Shape-rPzC8L-O.js → Shape-BEGGcaL8.js} +1 -1
- package/dist/{Slicer-BJ0Jqa6a.js → Slicer-DaUi0o8i.js} +2 -2
- package/dist/{SlicerPreview-BWl4UOqy.js → SlicerPreview-Bk-h_ANq.js} +2 -2
- package/dist/{SparkTooltip-reDvtQYF.js → SparkTooltip-BWdCP-h3.js} +1 -1
- package/dist/{Title-CM2dM0rQ.js → Title-CWX8otQg.js} +1 -1
- package/dist/{Tooltip-De7i-i20.js → Tooltip-OHx7yHlS.js} +1 -1
- package/dist/{UserOptions-5GYBcJJU.js → UserOptions-ChRXLqps.js} +2 -2
- package/dist/components/arrow.js +1 -1
- package/dist/components/vue-ui-3d-bar.js +1 -1
- package/dist/components/vue-ui-accordion.js +1 -1
- package/dist/components/vue-ui-age-pyramid.js +1 -1
- package/dist/components/vue-ui-annotator.js +1 -1
- package/dist/components/vue-ui-bullet.js +1 -1
- package/dist/components/vue-ui-candlestick.js +1 -1
- package/dist/components/vue-ui-carousel-table.js +1 -1
- package/dist/components/vue-ui-chestnut.js +1 -1
- package/dist/components/vue-ui-chord.js +1 -1
- package/dist/components/vue-ui-circle-pack.js +1 -1
- package/dist/components/vue-ui-cursor.js +1 -1
- package/dist/components/vue-ui-dag.js +5 -0
- package/dist/components/vue-ui-dashboard.js +1 -1
- package/dist/components/vue-ui-digits.js +1 -1
- package/dist/components/vue-ui-donut-evolution.js +1 -1
- package/dist/components/vue-ui-donut.js +1 -1
- package/dist/components/vue-ui-dumbbell.js +1 -1
- package/dist/components/vue-ui-flow.js +1 -1
- package/dist/components/vue-ui-funnel.js +1 -1
- package/dist/components/vue-ui-galaxy.js +1 -1
- package/dist/components/vue-ui-gauge.js +1 -1
- package/dist/components/vue-ui-gizmo.js +1 -1
- package/dist/components/vue-ui-heatmap.js +1 -1
- package/dist/components/vue-ui-history-plot.js +1 -1
- package/dist/components/vue-ui-horizontal-bar.js +1 -1
- package/dist/components/vue-ui-icon.js +1 -1
- package/dist/components/vue-ui-kpi.js +1 -1
- package/dist/components/vue-ui-mini-loader.js +1 -1
- package/dist/components/vue-ui-molecule.js +1 -1
- package/dist/components/vue-ui-mood-radar.js +1 -1
- package/dist/components/vue-ui-nested-donuts.js +1 -1
- package/dist/components/vue-ui-onion.js +1 -1
- package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
- package/dist/components/vue-ui-quadrant.js +1 -1
- package/dist/components/vue-ui-quick-chart.js +1 -1
- package/dist/components/vue-ui-radar.js +1 -1
- package/dist/components/vue-ui-rating.js +1 -1
- package/dist/components/vue-ui-relation-circle.js +1 -1
- package/dist/components/vue-ui-ridgeline.js +1 -1
- package/dist/components/vue-ui-rings.js +1 -1
- package/dist/components/vue-ui-scatter.js +1 -1
- package/dist/components/vue-ui-skeleton.js +1 -1
- package/dist/components/vue-ui-smiley.js +1 -1
- package/dist/components/vue-ui-spark-trend.js +1 -1
- package/dist/components/vue-ui-sparkbar.js +1 -1
- package/dist/components/vue-ui-sparkgauge.js +1 -1
- package/dist/components/vue-ui-sparkhistogram.js +1 -1
- package/dist/components/vue-ui-sparkline.js +1 -1
- package/dist/components/vue-ui-sparkstackbar.js +1 -1
- package/dist/components/vue-ui-stackbar.js +1 -1
- package/dist/components/vue-ui-stackline.js +1 -1
- package/dist/components/vue-ui-strip-plot.js +1 -1
- package/dist/components/vue-ui-table-heatmap.js +1 -1
- package/dist/components/vue-ui-table-sparkline.js +1 -1
- package/dist/components/vue-ui-table.js +1 -1
- package/dist/components/vue-ui-thermometer.js +1 -1
- package/dist/components/vue-ui-timer.js +1 -1
- package/dist/components/vue-ui-tiremarks.js +1 -1
- package/dist/components/vue-ui-treemap.js +1 -1
- package/dist/components/vue-ui-vertical-bar.js +1 -1
- package/dist/components/vue-ui-waffle.js +1 -1
- package/dist/components/vue-ui-wheel.js +1 -1
- package/dist/components/vue-ui-word-cloud.js +1 -1
- package/dist/components/vue-ui-world.js +1 -1
- package/dist/components/vue-ui-xy-canvas.js +1 -1
- package/dist/components/vue-ui-xy.js +1 -1
- package/dist/{dom-to-png-BG68zYm5.js → dom-to-png-VQEAYRVr.js} +1 -1
- package/dist/{img-BYzbY8TZ.js → img-CwrkWkkl.js} +1 -1
- package/dist/{lib-DUaaQGCv.js → lib-qMPkcvmh.js} +194 -179
- package/dist/{pdf--SSvtzbF.js → pdf-BMMrFX8S.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/types/vue-data-ui.d.ts +146 -5
- package/dist/types/vue-ui-dag.d.ts +16 -0
- package/dist/{useAutoSizeLabelsInsideViewbox-DBJqy2aF.js → useAutoSizeLabelsInsideViewbox-CY90KinM.js} +1 -1
- package/dist/{useNestedProp-CoXaJ2T6.js → useNestedProp-DH2Pjkde.js} +270 -184
- package/dist/usePanZoom-DMfuOfaC.js +135 -0
- package/dist/{usePrinter-BdVu83IN.js → usePrinter-CjGh4mFJ.js} +2 -2
- package/dist/vue-data-ui-DqfM8Vz8.js +351 -0
- package/dist/vue-data-ui.js +202 -216
- package/dist/{vue-ui-3d-bar--XbxxtdU.js → vue-ui-3d-bar-CVgWSxvV.js} +6 -6
- package/dist/{vue-ui-accordion-WOXCCkiC.js → vue-ui-accordion-DiNnR-ZE.js} +3 -3
- package/dist/{vue-ui-age-pyramid-oJ-yVno1.js → vue-ui-age-pyramid-7CfFjz5B.js} +25 -25
- package/dist/{vue-ui-annotator-DmX0nJap.js → vue-ui-annotator-D_z1JO0m.js} +7 -7
- package/dist/{vue-ui-bullet-BSexyA7e.js → vue-ui-bullet-CkBYg2ju.js} +7 -7
- package/dist/{vue-ui-candlestick-Cn0FCDdN.js → vue-ui-candlestick-CoNGZeIc.js} +39 -39
- package/dist/{vue-ui-carousel-table-HJewuQDB.js → vue-ui-carousel-table-DFAWxemP.js} +4 -4
- package/dist/{vue-ui-chestnut-jpnadZPu.js → vue-ui-chestnut-CWxFxnja.js} +5 -5
- package/dist/{vue-ui-chord-DtAB5se2.js → vue-ui-chord-p2h6IONa.js} +8 -8
- package/dist/{vue-ui-circle-pack-BTbgkyJ2.js → vue-ui-circle-pack-Dei0aswf.js} +37 -37
- package/dist/{vue-ui-cursor-DgWumfhl.js → vue-ui-cursor-oaIVMRWP.js} +3 -3
- package/dist/vue-ui-dag-D0ImsCHg.js +2770 -0
- package/dist/{vue-ui-dashboard-BnAUQtnC.js → vue-ui-dashboard-DpotsaP2.js} +68 -68
- package/dist/{vue-ui-digits-ByiQlK70.js → vue-ui-digits-B7rN8UWS.js} +2 -2
- package/dist/{vue-ui-donut-CKSt_cq4.js → vue-ui-donut-DsCBPM7k.js} +88 -88
- package/dist/{vue-ui-donut-evolution-DvdTGB7S.js → vue-ui-donut-evolution-mSDD8tt9.js} +85 -85
- package/dist/{vue-ui-dumbbell-Injrp_b4.js → vue-ui-dumbbell-CU9Bqy_T.js} +33 -33
- package/dist/{vue-ui-flow-bbLDmA3Q.js → vue-ui-flow-BxjQr6zQ.js} +42 -42
- package/dist/{vue-ui-funnel-B9iC-gYh.js → vue-ui-funnel-Cs2_wFOA.js} +19 -19
- package/dist/{vue-ui-galaxy-SMeufYzr.js → vue-ui-galaxy-CFbE4FoS.js} +59 -59
- package/dist/{vue-ui-gauge-FMuSlHqG.js → vue-ui-gauge-6g1fkJjW.js} +25 -25
- package/dist/{vue-ui-gizmo-0B3wKFgG.js → vue-ui-gizmo-BzUlvG3U.js} +3 -3
- package/dist/{vue-ui-heatmap-BxztC6jw.js → vue-ui-heatmap-B9Sc1Qym.js} +67 -67
- package/dist/{vue-ui-history-plot-D_qkv6IS.js → vue-ui-history-plot-CpskzQg2.js} +43 -43
- package/dist/{vue-ui-horizontal-bar-BhTVXhQB.js → vue-ui-horizontal-bar-DMByg_zj.js} +69 -69
- package/dist/{vue-ui-kpi-DvCTUXWh.js → vue-ui-kpi-B6oDMqQL.js} +3 -3
- package/dist/{vue-ui-mini-loader-BjT-X5O8.js → vue-ui-mini-loader-BXLMnXR4.js} +2 -2
- package/dist/{vue-ui-molecule-CazE9-Nk.js → vue-ui-molecule-y8AOUQvZ.js} +53 -53
- package/dist/{vue-ui-mood-radar-vrciNRi0.js → vue-ui-mood-radar--XevYXsy.js} +7 -7
- package/dist/{vue-ui-nested-donuts-BAcHknTn.js → vue-ui-nested-donuts-A-J72aa_.js} +38 -38
- package/dist/{vue-ui-onion-DgmiBf_W.js → vue-ui-onion-CZH1uzU_.js} +38 -38
- package/dist/{vue-ui-parallel-coordinate-plot-CdvrCiVK.js → vue-ui-parallel-coordinate-plot-px6mudIa.js} +43 -43
- package/dist/{vue-ui-quadrant-C1GEbyIm.js → vue-ui-quadrant-Cnh6vISS.js} +8 -8
- package/dist/{vue-ui-quick-chart-DL9GV0J3.js → vue-ui-quick-chart-CA1Yns69.js} +51 -51
- package/dist/{vue-ui-radar-B4DfCpS5.js → vue-ui-radar-CwL0pqRH.js} +41 -41
- package/dist/{vue-ui-rating-CyJYLx9l.js → vue-ui-rating-CtkV7O_k.js} +2 -2
- package/dist/{vue-ui-relation-circle-Dm8wLlBa.js → vue-ui-relation-circle-B-sm1VFO.js} +19 -19
- package/dist/{vue-ui-ridgeline-E2EPeaJ7.js → vue-ui-ridgeline-DC2uKfbu.js} +8 -8
- package/dist/{vue-ui-rings-DnlHsA26.js → vue-ui-rings-CKOzGb8B.js} +37 -37
- package/dist/{vue-ui-scatter-DuKgh9Zo.js → vue-ui-scatter-C1ajpkcR.js} +8 -8
- package/dist/{vue-ui-skeleton-BhWvFc3O.js → vue-ui-skeleton-D6MjtTX_.js} +3 -3
- package/dist/{vue-ui-smiley-BkXC5UFE.js → vue-ui-smiley-C-mXyFxi.js} +2 -2
- package/dist/{vue-ui-spark-trend-DZWSf9JB.js → vue-ui-spark-trend-BsVhD00l.js} +16 -16
- package/dist/{vue-ui-sparkbar-CqH28hXO.js → vue-ui-sparkbar-Drazbrah.js} +3 -3
- package/dist/{vue-ui-sparkgauge-DT_yPxzw.js → vue-ui-sparkgauge-CRbo19gz.js} +17 -17
- package/dist/{vue-ui-sparkhistogram-Dv9UjLCt.js → vue-ui-sparkhistogram-C41IySqq.js} +4 -4
- package/dist/{vue-ui-sparkline-AvAyn0Uv.js → vue-ui-sparkline-DhMJlZAj.js} +31 -31
- package/dist/{vue-ui-sparkstackbar-X_VGCj6T.js → vue-ui-sparkstackbar-DfyfDxF-.js} +3 -3
- package/dist/{vue-ui-stackbar-DQP8yEJM.js → vue-ui-stackbar-DnDjTmzg.js} +9 -9
- package/dist/{vue-ui-stackline-VLPuuMyW.js → vue-ui-stackline-DYVq55D8.js} +55 -55
- package/dist/{vue-ui-strip-plot-Tf-eojtF.js → vue-ui-strip-plot-DDEm7mMm.js} +28 -28
- package/dist/{vue-ui-table-Onk8Ep_o.js → vue-ui-table-RCYr7_oK.js} +5 -5
- package/dist/{vue-ui-table-heatmap-DKJxeQIL.js → vue-ui-table-heatmap-DODhMbZE.js} +5 -5
- package/dist/{vue-ui-table-sparkline-DgISlLtt.js → vue-ui-table-sparkline-cheUhGm3.js} +4 -4
- package/dist/{vue-ui-thermometer-BnYdXPWo.js → vue-ui-thermometer-BheFELBN.js} +19 -19
- package/dist/{vue-ui-timer-BWNvvVI8.js → vue-ui-timer-DUaqMYu9.js} +12 -12
- package/dist/{vue-ui-tiremarks-CW0yee-q.js → vue-ui-tiremarks-CzEPq7Qm.js} +6 -6
- package/dist/{vue-ui-treemap-BfY0n0I2.js → vue-ui-treemap-JmxDMTGO.js} +51 -51
- package/dist/{vue-ui-waffle-D9lUh12t.js → vue-ui-waffle-Bd_MQwxV.js} +69 -69
- package/dist/{vue-ui-wheel-C-oMzvbq.js → vue-ui-wheel-BfR7YioI.js} +6 -6
- package/dist/{vue-ui-word-cloud-DYrmMP9R.js → vue-ui-word-cloud-CI2APc9f.js} +41 -41
- package/dist/{vue-ui-world-DAObATdc.js → vue-ui-world-3Oy8hJ6R.js} +6 -6
- package/dist/{vue-ui-xy-D6gFGE5R.js → vue-ui-xy-BWzZbqJo.js} +75 -75
- package/dist/{vue-ui-xy-canvas-B_dtbPQy.js → vue-ui-xy-canvas-Cq-lVd9y.js} +127 -127
- package/package.json +4 -3
- package/dist/usePanZoom-DZtyJi5q.js +0 -127
- package/dist/vue-data-ui-DOR1SV2J.js +0 -337
|
@@ -0,0 +1,2770 @@
|
|
|
1
|
+
import { ref as y, watchEffect as Jo, unref as v, createElementBlock as x, openBlock as k, normalizeStyle as X, normalizeClass as st, createElementVNode as G, createCommentVNode as L, createVNode as ae, toDisplayString as le, defineAsyncComponent as Xe, toRefs as Qo, computed as W, onMounted as zt, watch as De, onBeforeUnmount as en, createBlock as U, withCtx as T, renderSlot as A, normalizeProps as B, guardReactiveProps as V, createSlots as tn, Fragment as ie, renderList as Fe, withModifiers as on, mergeProps as Bt, createTextVNode as nn, Transition as Vt, Teleport as It, nextTick as Gt } from "vue";
|
|
2
|
+
import { c as rt, ay as sn, l as Ce, n as rn, r as ln, h as an, t as so, o as cn, g as jt, X as un, a8 as dn } from "./lib-qMPkcvmh.js";
|
|
3
|
+
import { t as fn, u as hn } from "./useResponsive-DfdjqQps.js";
|
|
4
|
+
import { u as mn } from "./usePanZoom-DMfuOfaC.js";
|
|
5
|
+
import { u as gn, a as qe } from "./useNestedProp-DH2Pjkde.js";
|
|
6
|
+
import { u as vn, B as bn } from "./BaseScanner-BgWxam9d.js";
|
|
7
|
+
import { u as pn } from "./usePrinter-CjGh4mFJ.js";
|
|
8
|
+
import { u as wn } from "./useSvgExport-DrjCWun4.js";
|
|
9
|
+
import { u as yn } from "./useThemeCheck-DGJ31Vi5.js";
|
|
10
|
+
import { u as kn } from "./useUserOptionState-BIvW1Kz7.js";
|
|
11
|
+
import { u as En } from "./useChartAccessibility-9icAAmYg.js";
|
|
12
|
+
import Cn from "./Title-CWX8otQg.js";
|
|
13
|
+
import Ke from "./BaseIcon-CALhpING.js";
|
|
14
|
+
import { _ as ro } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
15
|
+
import xn from "./img-CwrkWkkl.js";
|
|
16
|
+
const _n = "\0", te = "\0", Wt = "";
|
|
17
|
+
class q {
|
|
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((r) => {
|
|
132
|
+
n.length > 1 ? s.setNode(r, o) : s.setNode(r);
|
|
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(([i, l]) => {
|
|
278
|
+
t(i) && o.setNode(i, l);
|
|
279
|
+
}), Object.values(this._edgeObjs).forEach((i) => {
|
|
280
|
+
o.hasNode(i.v) && o.hasNode(i.w) && o.setEdge(i, n.edge(i));
|
|
281
|
+
});
|
|
282
|
+
const s = {};
|
|
283
|
+
function r(i) {
|
|
284
|
+
const l = n.parent(i);
|
|
285
|
+
return l === void 0 || o.hasNode(l) ? (s[i] = l, l) : l in s ? s[l] : r(l);
|
|
286
|
+
}
|
|
287
|
+
return this._isCompound && o.nodes().forEach((i) => o.setParent(i, r(i))), 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((r, i) => (s.length > 1 ? n.setEdge(r, i, o) : n.setEdge(r, i), i)), 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, r = !1;
|
|
332
|
+
const i = arguments[0];
|
|
333
|
+
typeof i == "object" && i !== null && "v" in i ? (t = i.v, o = i.w, n = i.name, arguments.length === 2 && (s = arguments[1], r = !0)) : (t = i, o = arguments[1], n = arguments[3], arguments.length > 2 && (s = arguments[2], r = !0)), t = "" + t, o = "" + o, n !== void 0 && (n = "" + n);
|
|
334
|
+
let l = Ee(this._isDirected, t, o, n);
|
|
335
|
+
if (Object.hasOwn(this._edgeLabels, l))
|
|
336
|
+
return r && (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] = r ? s : this._defaultEdgeLabelFn(t, o, n);
|
|
340
|
+
const a = Nn(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), r = this._edgeObjs[s];
|
|
373
|
+
return r && (t = r.v, o = r.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((r) => r.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((r) => r.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, r = "" + o;
|
|
418
|
+
if (!e && s > r) {
|
|
419
|
+
const i = s;
|
|
420
|
+
s = r, r = i;
|
|
421
|
+
}
|
|
422
|
+
return s + Wt + r + Wt + (n === void 0 ? _n : n);
|
|
423
|
+
}
|
|
424
|
+
function Nn(e, t, o, n) {
|
|
425
|
+
let s = "" + t, r = "" + o;
|
|
426
|
+
if (!e && s > r) {
|
|
427
|
+
const l = s;
|
|
428
|
+
s = r, r = l;
|
|
429
|
+
}
|
|
430
|
+
const i = { v: s, w: r };
|
|
431
|
+
return n && (i.name = n), i;
|
|
432
|
+
}
|
|
433
|
+
function Je(e, t) {
|
|
434
|
+
return Ee(e, t.v, t.w, t.name);
|
|
435
|
+
}
|
|
436
|
+
class An {
|
|
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, Sn)), 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 Sn(e, t) {
|
|
462
|
+
if (e !== "_next" && e !== "_prev")
|
|
463
|
+
return t;
|
|
464
|
+
}
|
|
465
|
+
const Ln = () => 1;
|
|
466
|
+
function On(e, t) {
|
|
467
|
+
if (e.nodeCount() <= 1)
|
|
468
|
+
return [];
|
|
469
|
+
const o = Tn(e, t || Ln);
|
|
470
|
+
return Rn(o.graph, o.buckets, o.zeroIndex).flatMap((s) => e.outEdges(s.v, s.w));
|
|
471
|
+
}
|
|
472
|
+
function Rn(e, t, o) {
|
|
473
|
+
let n = [];
|
|
474
|
+
const s = t[t.length - 1], r = t[0];
|
|
475
|
+
let i;
|
|
476
|
+
for (; e.nodeCount(); ) {
|
|
477
|
+
for (; i = r.dequeue(); )
|
|
478
|
+
Qe(e, t, o, i);
|
|
479
|
+
for (; i = s.dequeue(); )
|
|
480
|
+
Qe(e, t, o, i);
|
|
481
|
+
if (e.nodeCount()) {
|
|
482
|
+
for (let l = t.length - 2; l > 0; --l)
|
|
483
|
+
if (i = t[l].dequeue(), i) {
|
|
484
|
+
n = n.concat(Qe(e, t, o, i, !0));
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return n;
|
|
490
|
+
}
|
|
491
|
+
function Qe(e, t, o, n, s) {
|
|
492
|
+
const r = s ? [] : void 0;
|
|
493
|
+
return e.inEdges(n.v).forEach((i) => {
|
|
494
|
+
const l = e.edge(i), a = e.node(i.v);
|
|
495
|
+
s && r.push({ v: i.v, w: i.w }), a.out -= l, it(t, o, a);
|
|
496
|
+
}), e.outEdges(n.v).forEach((i) => {
|
|
497
|
+
const l = e.edge(i), a = e.node(i.w);
|
|
498
|
+
a.in -= l, it(t, o, a);
|
|
499
|
+
}), e.removeNode(n.v), r;
|
|
500
|
+
}
|
|
501
|
+
function Tn(e, t) {
|
|
502
|
+
const o = new q();
|
|
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 r = Mn(s + n + 3).map(() => new An()), i = n + 1;
|
|
511
|
+
return o.nodes().forEach((l) => {
|
|
512
|
+
it(r, i, o.node(l));
|
|
513
|
+
}), {
|
|
514
|
+
graph: o,
|
|
515
|
+
buckets: r,
|
|
516
|
+
zeroIndex: i
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function it(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 Mn(e) {
|
|
523
|
+
const t = [];
|
|
524
|
+
for (let o = 0; o < e; o++)
|
|
525
|
+
t.push(o);
|
|
526
|
+
return t;
|
|
527
|
+
}
|
|
528
|
+
function ue(e, t, o, n) {
|
|
529
|
+
let s = n;
|
|
530
|
+
for (; e.hasNode(s); )
|
|
531
|
+
s = ze(n);
|
|
532
|
+
return o.dummy = t, e.setNode(s, o), s;
|
|
533
|
+
}
|
|
534
|
+
function io(e) {
|
|
535
|
+
const t = new q().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 at(e) {
|
|
547
|
+
const t = new q({ 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 $n(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 Dn(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 lt(e, t) {
|
|
573
|
+
let o = e.x, n = e.y;
|
|
574
|
+
const s = t.x - o, r = t.y - n;
|
|
575
|
+
let i = e.width / 2, l = e.height / 2;
|
|
576
|
+
if (!s && !r)
|
|
577
|
+
throw new Error("Not possible to find intersection inside of the rectangle");
|
|
578
|
+
let a, c;
|
|
579
|
+
return Math.abs(r) * i > Math.abs(s) * l ? (r < 0 && (l = -l), a = l * s / r, c = l) : (s < 0 && (i = -i), a = i, c = i * r / s), { x: o + a, y: n + c };
|
|
580
|
+
}
|
|
581
|
+
function _e(e) {
|
|
582
|
+
const t = ce(ct(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 lo(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 = j(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 ao(e) {
|
|
599
|
+
const t = e.nodes().map((i) => e.node(i).rank).filter((i) => i !== void 0), o = j(Math.min, t), n = [];
|
|
600
|
+
e.nodes().forEach((i) => {
|
|
601
|
+
const l = e.node(i).rank - o;
|
|
602
|
+
n[l] || (n[l] = []), n[l].push(i);
|
|
603
|
+
});
|
|
604
|
+
let s = 0;
|
|
605
|
+
const r = e.graph().nodeRankFactor;
|
|
606
|
+
Array.from(n).forEach((i, l) => {
|
|
607
|
+
i === void 0 && l % r !== 0 ? --s : i !== void 0 && s && i.forEach((a) => {
|
|
608
|
+
e.node(a).rank += s;
|
|
609
|
+
});
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
function Fn(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), ue(e, "border", s, t);
|
|
618
|
+
}
|
|
619
|
+
const co = 65535;
|
|
620
|
+
function Pn(e, t = co) {
|
|
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 j(e, t) {
|
|
629
|
+
if (t.length > co) {
|
|
630
|
+
const o = Pn(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 ct(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 j(Math.max, o);
|
|
644
|
+
}
|
|
645
|
+
function uo(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 fo(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 ho(e, t) {
|
|
660
|
+
return t();
|
|
661
|
+
}
|
|
662
|
+
let zn = 0;
|
|
663
|
+
function ze(e) {
|
|
664
|
+
const t = ++zn;
|
|
665
|
+
return e + String(t);
|
|
666
|
+
}
|
|
667
|
+
function ce(e, t, o = 1) {
|
|
668
|
+
t == null && (t = e, e = 0);
|
|
669
|
+
let n = (r) => r < t;
|
|
670
|
+
o < 0 && (n = (r) => t < r);
|
|
671
|
+
const s = [];
|
|
672
|
+
for (let r = e; n(r); r += o)
|
|
673
|
+
s.push(r);
|
|
674
|
+
return s;
|
|
675
|
+
}
|
|
676
|
+
function xe(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 Ne(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, r]) => (n[s] = o(r, s), n), {});
|
|
689
|
+
}
|
|
690
|
+
function Be(e, t) {
|
|
691
|
+
return e.reduce((o, n, s) => (o[n] = t[s], o), {});
|
|
692
|
+
}
|
|
693
|
+
const Pe = {
|
|
694
|
+
addBorderNode: Fn,
|
|
695
|
+
addDummyNode: ue,
|
|
696
|
+
applyWithChunking: j,
|
|
697
|
+
asNonCompoundGraph: at,
|
|
698
|
+
buildLayerMatrix: _e,
|
|
699
|
+
intersectRect: lt,
|
|
700
|
+
mapValues: Ne,
|
|
701
|
+
maxRank: ct,
|
|
702
|
+
normalizeRanks: lo,
|
|
703
|
+
notime: ho,
|
|
704
|
+
partition: uo,
|
|
705
|
+
pick: xe,
|
|
706
|
+
predecessorWeights: Dn,
|
|
707
|
+
range: ce,
|
|
708
|
+
removeEmptyRanks: ao,
|
|
709
|
+
simplify: io,
|
|
710
|
+
successorWeights: $n,
|
|
711
|
+
time: fo,
|
|
712
|
+
uniqueId: ze,
|
|
713
|
+
zipObject: Be
|
|
714
|
+
};
|
|
715
|
+
function Bn(e) {
|
|
716
|
+
(e.graph().acyclicer === "greedy" ? On(e, o(e)) : In(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, ze("rev"));
|
|
719
|
+
});
|
|
720
|
+
function o(n) {
|
|
721
|
+
return (s) => n.edge(s).weight;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function Vn(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 In(e) {
|
|
735
|
+
const t = [], o = {}, n = {};
|
|
736
|
+
function s(r) {
|
|
737
|
+
Object.hasOwn(n, r) || (n[r] = !0, o[r] = !0, e.outEdges(r).forEach((i) => {
|
|
738
|
+
Object.hasOwn(o, i.w) ? t.push(i) : s(i.w);
|
|
739
|
+
}), delete o[r]);
|
|
740
|
+
}
|
|
741
|
+
return e.nodes().forEach(s), t;
|
|
742
|
+
}
|
|
743
|
+
function Gn(e) {
|
|
744
|
+
e.graph().dummyChains = [], e.edges().forEach((t) => jn(e, t));
|
|
745
|
+
}
|
|
746
|
+
function jn(e, t) {
|
|
747
|
+
let o = t.v, n = e.node(o).rank;
|
|
748
|
+
const s = t.w, r = e.node(s).rank, i = t.name, l = e.edge(t), a = l.labelRank;
|
|
749
|
+
if (r === n + 1)
|
|
750
|
+
return;
|
|
751
|
+
e.removeEdge(t);
|
|
752
|
+
let c, d, f;
|
|
753
|
+
for (f = 0, ++n; n < r; ++f, ++n)
|
|
754
|
+
l.points = [], d = {
|
|
755
|
+
width: 0,
|
|
756
|
+
height: 0,
|
|
757
|
+
edgeLabel: l,
|
|
758
|
+
edgeObj: t,
|
|
759
|
+
rank: n
|
|
760
|
+
}, c = ue(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 }, i), f === 0 && e.graph().dummyChains.push(c), o = c;
|
|
761
|
+
e.setEdge(o, s, { weight: l.weight }, i);
|
|
762
|
+
}
|
|
763
|
+
function Wn(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 mo(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 r = 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 i = j(Math.min, r);
|
|
788
|
+
return i === Number.POSITIVE_INFINITY && (i = 0), n && (n.rank = i), i;
|
|
789
|
+
}
|
|
790
|
+
(e.sources() || []).forEach(t);
|
|
791
|
+
}
|
|
792
|
+
function Yn(e, t) {
|
|
793
|
+
return e.node(t.w).rank - e.node(t.v).rank - e.edge(t).minlen;
|
|
794
|
+
}
|
|
795
|
+
function Hn(e) {
|
|
796
|
+
Zn(e);
|
|
797
|
+
const t = new q();
|
|
798
|
+
e.nodes().forEach((r) => {
|
|
799
|
+
t.setNode(r, {});
|
|
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 r = Un(e, s);
|
|
807
|
+
if (!r) {
|
|
808
|
+
const d = o.find((f) => !s.has(f));
|
|
809
|
+
s.add(d), t.setNode(d, {});
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
const { edgeObject: i, delta: l, attachFrom: a, attachTo: c } = r;
|
|
813
|
+
Xn(e, s, a, l), t.setEdge(i.v, i.w, {}), s.add(c);
|
|
814
|
+
}
|
|
815
|
+
return t;
|
|
816
|
+
}
|
|
817
|
+
function Zn(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 Un(e, t) {
|
|
824
|
+
let o = null;
|
|
825
|
+
return e.edges().forEach((n) => {
|
|
826
|
+
const s = t.has(n.v), r = t.has(n.w);
|
|
827
|
+
if (s === r)
|
|
828
|
+
return;
|
|
829
|
+
const i = Yn(e, n), l = Math.abs(i);
|
|
830
|
+
if (!o || l < o.absoluteSlack) {
|
|
831
|
+
const a = s ? n.v : n.w, c = s ? n.w : n.v, d = s ? i : -i;
|
|
832
|
+
o = {
|
|
833
|
+
edgeObject: n,
|
|
834
|
+
delta: d,
|
|
835
|
+
attachFrom: a,
|
|
836
|
+
attachTo: c,
|
|
837
|
+
absoluteSlack: l
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
}), o;
|
|
841
|
+
}
|
|
842
|
+
function Xn(e, t, o, n) {
|
|
843
|
+
n && e.nodes().forEach((s) => {
|
|
844
|
+
if (!t.has(s)) {
|
|
845
|
+
const r = e.node(s);
|
|
846
|
+
r.rank += n;
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
function de(e) {
|
|
851
|
+
const t = io(e);
|
|
852
|
+
return mo(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 qn(e, t) {
|
|
858
|
+
}
|
|
859
|
+
function Kn(e, t) {
|
|
860
|
+
}
|
|
861
|
+
function Jn(e, t, o) {
|
|
862
|
+
return 0;
|
|
863
|
+
}
|
|
864
|
+
function Qn(e) {
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
867
|
+
function es(e, t) {
|
|
868
|
+
return null;
|
|
869
|
+
}
|
|
870
|
+
de.initLowLimValues = qn;
|
|
871
|
+
de.initCutValues = Kn;
|
|
872
|
+
de.calcCutValue = Jn;
|
|
873
|
+
de.leaveEdge = Qn;
|
|
874
|
+
de.enterEdge = es;
|
|
875
|
+
const go = mo;
|
|
876
|
+
function ts(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
|
+
ns(e);
|
|
886
|
+
break;
|
|
887
|
+
case "longest-path":
|
|
888
|
+
os(e);
|
|
889
|
+
break;
|
|
890
|
+
case "none":
|
|
891
|
+
break;
|
|
892
|
+
default:
|
|
893
|
+
Ut(e);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
const os = go;
|
|
897
|
+
function ns(e) {
|
|
898
|
+
go(e), Hn(e);
|
|
899
|
+
}
|
|
900
|
+
function Ut(e) {
|
|
901
|
+
de(e);
|
|
902
|
+
}
|
|
903
|
+
function ss(e) {
|
|
904
|
+
const t = is(e);
|
|
905
|
+
e.graph().dummyChains.forEach((o) => {
|
|
906
|
+
let n = e.node(o);
|
|
907
|
+
const s = n.edgeObj, r = rs(e, t, s.v, s.w), i = r.path, l = r.lca;
|
|
908
|
+
let a = 0, c = i[a], d = !0, f = o;
|
|
909
|
+
for (; f !== s.w; ) {
|
|
910
|
+
if (n = e.node(f), d) {
|
|
911
|
+
for (; (c = i[a]) !== l && e.node(c).maxRank < n.rank; )
|
|
912
|
+
a++;
|
|
913
|
+
c === l && (d = !1);
|
|
914
|
+
}
|
|
915
|
+
if (!d) {
|
|
916
|
+
for (; a < i.length - 1 && e.node(c = i[a + 1]).minRank <= n.rank; )
|
|
917
|
+
a++;
|
|
918
|
+
c = i[a];
|
|
919
|
+
}
|
|
920
|
+
e.setParent(f, c), f = e.successors(f)[0];
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
function rs(e, t, o, n) {
|
|
925
|
+
const s = [], r = [], i = 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 > i || l > t[a].lim));
|
|
931
|
+
for (c = a, a = n; (a = e.parent(a)) !== c; )
|
|
932
|
+
r.push(a);
|
|
933
|
+
return {
|
|
934
|
+
path: s.concat(r.reverse()),
|
|
935
|
+
lca: c
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
function is(e) {
|
|
939
|
+
const t = {};
|
|
940
|
+
let o = 0;
|
|
941
|
+
function n(s) {
|
|
942
|
+
const r = o;
|
|
943
|
+
e.children(s).forEach(n), t[s] = { low: r, lim: o++ };
|
|
944
|
+
}
|
|
945
|
+
return e.children().forEach(n), t;
|
|
946
|
+
}
|
|
947
|
+
function ls(e) {
|
|
948
|
+
const t = Pe.addDummyNode(e, "root", {}, "_root"), o = as(e), n = Object.values(o), s = Pe.applyWithChunking(Math.max, n) - 1, r = 2 * s + 1;
|
|
949
|
+
e.graph().nestingRoot = t, e.edges().forEach((l) => {
|
|
950
|
+
e.edge(l).minlen *= r;
|
|
951
|
+
});
|
|
952
|
+
const i = cs(e) + 1;
|
|
953
|
+
e.children().forEach((l) => {
|
|
954
|
+
vo(e, t, r, i, s, o, l);
|
|
955
|
+
}), e.graph().nodeRankFactor = r;
|
|
956
|
+
}
|
|
957
|
+
function vo(e, t, o, n, s, r, i) {
|
|
958
|
+
const l = e.children(i);
|
|
959
|
+
if (!l.length) {
|
|
960
|
+
i !== t && e.setEdge(t, i, { weight: 0, minlen: o });
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
const a = Pe.addBorderNode(e, "_bt"), c = Pe.addBorderNode(e, "_bb"), d = e.node(i);
|
|
964
|
+
e.setParent(a, i), d.borderTop = a, e.setParent(c, i), d.borderBottom = c, l.forEach((f) => {
|
|
965
|
+
vo(e, t, o, n, s, r, f);
|
|
966
|
+
const g = e.node(f), b = g.borderTop ? g.borderTop : f, N = g.borderBottom ? g.borderBottom : f, _ = g.borderTop ? n : 2 * n, M = b !== N ? 1 : s - r[i] + 1;
|
|
967
|
+
e.setEdge(a, b, {
|
|
968
|
+
weight: _,
|
|
969
|
+
minlen: M,
|
|
970
|
+
nestingEdge: !0
|
|
971
|
+
}), e.setEdge(N, c, {
|
|
972
|
+
weight: _,
|
|
973
|
+
minlen: M,
|
|
974
|
+
nestingEdge: !0
|
|
975
|
+
});
|
|
976
|
+
}), e.parent(i) || e.setEdge(t, a, {
|
|
977
|
+
weight: 0,
|
|
978
|
+
minlen: s + r[i]
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
function as(e) {
|
|
982
|
+
const t = {};
|
|
983
|
+
function o(n, s) {
|
|
984
|
+
const r = e.children(n);
|
|
985
|
+
r && r.length && r.forEach((i) => o(i, s + 1)), t[n] = s;
|
|
986
|
+
}
|
|
987
|
+
return e.children().forEach((n) => o(n, 1)), t;
|
|
988
|
+
}
|
|
989
|
+
function cs(e) {
|
|
990
|
+
return e.edges().reduce((t, o) => t + e.edge(o).weight, 0);
|
|
991
|
+
}
|
|
992
|
+
function us(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 ds(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 r = s.minRank, i = s.maxRank + 1; r < i; ++r)
|
|
1004
|
+
Xt(e, "borderLeft", "_bl", o, s, r), Xt(e, "borderRight", "_br", o, s, r);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
e.children().forEach(t);
|
|
1008
|
+
}
|
|
1009
|
+
function Xt(e, t, o, n, s, r) {
|
|
1010
|
+
const i = {
|
|
1011
|
+
width: 0,
|
|
1012
|
+
height: 0,
|
|
1013
|
+
rank: r,
|
|
1014
|
+
borderType: t
|
|
1015
|
+
}, l = s[t][r - 1], a = ue(e, "border", i, o);
|
|
1016
|
+
s[t][r] = a, e.setParent(a, n), l && e.setEdge(l, a, { weight: 1 });
|
|
1017
|
+
}
|
|
1018
|
+
function fs(e) {
|
|
1019
|
+
const t = e.graph().rankdir.toLowerCase();
|
|
1020
|
+
(t === "lr" || t === "rl") && bo(e);
|
|
1021
|
+
}
|
|
1022
|
+
function hs(e) {
|
|
1023
|
+
const t = e.graph().rankdir.toLowerCase();
|
|
1024
|
+
(t === "bt" || t === "rl") && ms(e), (t === "lr" || t === "rl") && (gs(e), bo(e));
|
|
1025
|
+
}
|
|
1026
|
+
function bo(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 ms(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 gs(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: fs,
|
|
1062
|
+
undo: hs
|
|
1063
|
+
};
|
|
1064
|
+
function vs(e) {
|
|
1065
|
+
const t = {}, o = e.nodes().filter((a) => e.children(a).length === 0), n = o.map((a) => e.node(a).rank), s = j(Math.max, n), r = ce(s + 1).map(() => []);
|
|
1066
|
+
function i(a) {
|
|
1067
|
+
if (t[a]) return;
|
|
1068
|
+
t[a] = !0;
|
|
1069
|
+
const c = e.node(a);
|
|
1070
|
+
r[c.rank].push(a), e.successors(a).forEach(i);
|
|
1071
|
+
}
|
|
1072
|
+
return o.sort(
|
|
1073
|
+
(a, c) => e.node(a).rank - e.node(c).rank
|
|
1074
|
+
).forEach(i), r;
|
|
1075
|
+
}
|
|
1076
|
+
function bs(e, t) {
|
|
1077
|
+
let o = 0;
|
|
1078
|
+
for (let n = 1; n < t.length; ++n)
|
|
1079
|
+
o += ps(e, t[n - 1], t[n]);
|
|
1080
|
+
return o;
|
|
1081
|
+
}
|
|
1082
|
+
function ps(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 r = 1;
|
|
1091
|
+
for (; r < o.length; ) r <<= 1;
|
|
1092
|
+
const i = 2 * r - 1;
|
|
1093
|
+
r -= 1;
|
|
1094
|
+
const l = new Array(i).fill(0);
|
|
1095
|
+
let a = 0;
|
|
1096
|
+
return s.forEach((c) => {
|
|
1097
|
+
let d = c.pos + r;
|
|
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 ws(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
|
+
(r, i) => {
|
|
1112
|
+
const l = e.edge(i), a = e.node(i.v);
|
|
1113
|
+
return {
|
|
1114
|
+
sum: r.sum + l.weight * a.order,
|
|
1115
|
+
weight: r.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 ys(e, t) {
|
|
1128
|
+
const o = {};
|
|
1129
|
+
e.forEach((s, r) => {
|
|
1130
|
+
const i = o[s.v] = {
|
|
1131
|
+
indegree: 0,
|
|
1132
|
+
in: [],
|
|
1133
|
+
out: [],
|
|
1134
|
+
vs: [s.v],
|
|
1135
|
+
i: r
|
|
1136
|
+
};
|
|
1137
|
+
s.barycenter !== void 0 && (i.barycenter = s.barycenter, i.weight = s.weight);
|
|
1138
|
+
}), t.edges().forEach((s) => {
|
|
1139
|
+
const r = o[s.v], i = o[s.w];
|
|
1140
|
+
r !== void 0 && i !== void 0 && (i.indegree++, r.out.push(i));
|
|
1141
|
+
});
|
|
1142
|
+
const n = Object.values(o).filter((s) => !s.indegree);
|
|
1143
|
+
return ks(n);
|
|
1144
|
+
}
|
|
1145
|
+
function ks(e) {
|
|
1146
|
+
const t = [];
|
|
1147
|
+
function o(s) {
|
|
1148
|
+
return (r) => {
|
|
1149
|
+
r.merged || (r.barycenter === void 0 || s.barycenter === void 0 || r.barycenter >= s.barycenter) && Es(s, r);
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
function n(s) {
|
|
1153
|
+
return (r) => {
|
|
1154
|
+
r.in.push(s), --r.indegree === 0 && e.push(r);
|
|
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) => xe(s, ["vs", "i", "barycenter", "weight"]));
|
|
1162
|
+
}
|
|
1163
|
+
function Es(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 Cs(e, t) {
|
|
1168
|
+
const o = uo(e, (d) => Object.hasOwn(d, "barycenter")), n = o.lhs, s = o.rhs.sort((d, f) => f.i - d.i), r = [];
|
|
1169
|
+
let i = 0, l = 0, a = 0;
|
|
1170
|
+
n.sort(xs(!!t)), a = Jt(r, s, a), n.forEach((d) => {
|
|
1171
|
+
a += d.vs.length, r.push(d.vs), i += d.barycenter * d.weight, l += d.weight, a = Jt(r, s, a);
|
|
1172
|
+
});
|
|
1173
|
+
const c = { vs: r.flat(!0) };
|
|
1174
|
+
return l && (c.barycenter = i / 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 xs(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 po(e, t, o, n) {
|
|
1186
|
+
let s = e.children(t);
|
|
1187
|
+
const r = e.node(t), i = r ? r.borderLeft : void 0, l = r ? r.borderRight : void 0, a = {};
|
|
1188
|
+
i && (s = s.filter((g) => g !== i && g !== l));
|
|
1189
|
+
const c = ws(e, s);
|
|
1190
|
+
c.forEach((g) => {
|
|
1191
|
+
if (e.children(g.v).length) {
|
|
1192
|
+
const b = po(e, g.v, o, n);
|
|
1193
|
+
a[g.v] = b, Object.hasOwn(b, "barycenter") && Ns(g, b);
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
let d = ys(c, o);
|
|
1197
|
+
_s(d, a);
|
|
1198
|
+
const f = Cs(d, n);
|
|
1199
|
+
if (i && (f.vs = [i, f.vs, l].flat(!0), e.predecessors(i).length)) {
|
|
1200
|
+
const g = e.node(e.predecessors(i)[0]), b = 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 + b.order) / (f.weight + 2), f.weight += 2;
|
|
1202
|
+
}
|
|
1203
|
+
return f;
|
|
1204
|
+
}
|
|
1205
|
+
function _s(e, t) {
|
|
1206
|
+
e.forEach((o) => {
|
|
1207
|
+
o.vs = o.vs.flatMap((n) => t[n] ? t[n].vs : n);
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
function Ns(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 As(e, t, o, n) {
|
|
1214
|
+
n || (n = e.nodes());
|
|
1215
|
+
const s = Ss(e), r = new q({ compound: !0 }).setGraph({ root: s }).setDefaultNodeLabel((i) => e.node(i));
|
|
1216
|
+
return n.forEach((i) => {
|
|
1217
|
+
const l = e.node(i), a = e.parent(i);
|
|
1218
|
+
(l.rank === t || l.minRank <= t && t <= l.maxRank) && (r.setNode(i), r.setParent(i, a || s), e[o](i).forEach((d) => {
|
|
1219
|
+
const f = d.v === i ? d.w : d.v, g = r.edge(f, i), b = g ? g.weight : 0;
|
|
1220
|
+
r.setEdge(f, i, {
|
|
1221
|
+
weight: e.edge(d).weight + b
|
|
1222
|
+
});
|
|
1223
|
+
}), Object.hasOwn(l, "minRank") && r.setNode(i, {
|
|
1224
|
+
borderLeft: l.borderLeft[t],
|
|
1225
|
+
borderRight: l.borderRight[t]
|
|
1226
|
+
}));
|
|
1227
|
+
}), r;
|
|
1228
|
+
}
|
|
1229
|
+
function Ss(e) {
|
|
1230
|
+
let t;
|
|
1231
|
+
for (; e.hasNode(t = ze("_root")); ) ;
|
|
1232
|
+
return t;
|
|
1233
|
+
}
|
|
1234
|
+
function Ls(e, t, o) {
|
|
1235
|
+
let n = {}, s;
|
|
1236
|
+
o.forEach((r) => {
|
|
1237
|
+
let i = e.parent(r), l, a;
|
|
1238
|
+
for (; i; ) {
|
|
1239
|
+
if (l = e.parent(i), l ? (a = n[l], n[l] = i) : (a = s, s = i), a && a !== i) {
|
|
1240
|
+
t.setEdge(a, i);
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
i = l;
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
function wo(e, t = {}) {
|
|
1248
|
+
if (typeof t.customOrder == "function") {
|
|
1249
|
+
t.customOrder(e, wo);
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
const o = ct(e), n = Qt(
|
|
1253
|
+
e,
|
|
1254
|
+
ce(1, o + 1),
|
|
1255
|
+
"inEdges"
|
|
1256
|
+
), s = Qt(
|
|
1257
|
+
e,
|
|
1258
|
+
ce(o - 1, -1, -1),
|
|
1259
|
+
"outEdges"
|
|
1260
|
+
);
|
|
1261
|
+
let r = vs(e);
|
|
1262
|
+
if (eo(e, r), t.disableOptimalOrderHeuristic)
|
|
1263
|
+
return;
|
|
1264
|
+
let i = 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
|
+
Os(f, g, a), r = _e(e);
|
|
1269
|
+
const b = bs(e, r);
|
|
1270
|
+
b < i ? (i = b, d = 0, l = structuredClone(r)) : b === i && (l = structuredClone(r));
|
|
1271
|
+
}
|
|
1272
|
+
eo(e, l);
|
|
1273
|
+
}
|
|
1274
|
+
function Qt(e, t, o) {
|
|
1275
|
+
const n = /* @__PURE__ */ new Map();
|
|
1276
|
+
function s(r, i) {
|
|
1277
|
+
n.has(r) || n.set(r, []), n.get(r).push(i);
|
|
1278
|
+
}
|
|
1279
|
+
for (const r of e.nodes()) {
|
|
1280
|
+
const i = e.node(r);
|
|
1281
|
+
if (typeof i.rank == "number" && s(i.rank, r), typeof i.minRank == "number" && typeof i.maxRank == "number")
|
|
1282
|
+
for (let l = i.minRank; l <= i.maxRank; l++)
|
|
1283
|
+
l !== i.rank && s(l, r);
|
|
1284
|
+
}
|
|
1285
|
+
return t.map(
|
|
1286
|
+
(r) => As(
|
|
1287
|
+
e,
|
|
1288
|
+
r,
|
|
1289
|
+
o,
|
|
1290
|
+
n.get(r) || []
|
|
1291
|
+
)
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1294
|
+
function Os(e, t, o) {
|
|
1295
|
+
const n = new q();
|
|
1296
|
+
e.forEach((s) => {
|
|
1297
|
+
o.forEach((l) => n.setEdge(l.left, l.right));
|
|
1298
|
+
const r = s.graph().root, i = po(s, r, n, t);
|
|
1299
|
+
i.vs.forEach((l, a) => {
|
|
1300
|
+
s.node(l).order = a;
|
|
1301
|
+
}), Ls(s, n, i.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 Rs(e, t) {
|
|
1312
|
+
const o = {};
|
|
1313
|
+
function n(s, r) {
|
|
1314
|
+
let i = 0, l = 0;
|
|
1315
|
+
const a = s.length, c = r[r.length - 1];
|
|
1316
|
+
return r.forEach((d, f) => {
|
|
1317
|
+
const g = Ms(e, d), b = g ? e.node(g).order : a;
|
|
1318
|
+
(g || d === c) && (r.slice(l, f + 1).forEach((N) => {
|
|
1319
|
+
e.predecessors(N).forEach((_) => {
|
|
1320
|
+
const M = e.node(_), Y = M.order;
|
|
1321
|
+
(Y < i || b < Y) && !(M.dummy && e.node(N).dummy) && yo(o, _, N);
|
|
1322
|
+
});
|
|
1323
|
+
}), l = f + 1, i = b);
|
|
1324
|
+
}), r;
|
|
1325
|
+
}
|
|
1326
|
+
return t.length && t.reduce(n), o;
|
|
1327
|
+
}
|
|
1328
|
+
function Ts(e, t) {
|
|
1329
|
+
const o = {};
|
|
1330
|
+
function n(r, i, l, a, c) {
|
|
1331
|
+
let d;
|
|
1332
|
+
ce(i, l).forEach((f) => {
|
|
1333
|
+
d = r[f], e.node(d).dummy && e.predecessors(d).forEach((g) => {
|
|
1334
|
+
const b = e.node(g);
|
|
1335
|
+
b.dummy && (b.order < a || b.order > c) && yo(o, g, d);
|
|
1336
|
+
});
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
function s(r, i) {
|
|
1340
|
+
let l = -1, a, c = 0;
|
|
1341
|
+
return i.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(i, c, f, l, a), c = f, l = a);
|
|
1345
|
+
}
|
|
1346
|
+
n(i, c, i.length, a, r.length);
|
|
1347
|
+
}), i;
|
|
1348
|
+
}
|
|
1349
|
+
return t.length && t.reduce(s), o;
|
|
1350
|
+
}
|
|
1351
|
+
function Ms(e, t) {
|
|
1352
|
+
if (e.node(t).dummy)
|
|
1353
|
+
return e.predecessors(t).find((o) => e.node(o).dummy);
|
|
1354
|
+
}
|
|
1355
|
+
function yo(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 $s(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 Ds(e, t, o, n) {
|
|
1371
|
+
const s = {}, r = {}, i = {};
|
|
1372
|
+
return t.forEach((l) => {
|
|
1373
|
+
l.forEach((a, c) => {
|
|
1374
|
+
s[a] = a, r[a] = a, i[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, b) => i[g] - i[b]);
|
|
1382
|
+
const f = (d.length - 1) / 2;
|
|
1383
|
+
for (let g = Math.floor(f), b = Math.ceil(f); g <= b; ++g) {
|
|
1384
|
+
const N = d[g];
|
|
1385
|
+
r[c] === c && a < i[N] && !$s(o, c, N) && (r[N] = c, r[c] = s[c] = s[N], a = i[N]);
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
}), { root: s, align: r };
|
|
1390
|
+
}
|
|
1391
|
+
function Fs(e, t, o, n, s) {
|
|
1392
|
+
const r = {}, i = Ps(e, t, o, s), l = s ? "borderLeft" : "borderRight";
|
|
1393
|
+
function a(f, g) {
|
|
1394
|
+
const b = i.nodes().slice(), N = {};
|
|
1395
|
+
let _ = b.pop();
|
|
1396
|
+
for (; _; ) {
|
|
1397
|
+
if (N[_])
|
|
1398
|
+
f(_);
|
|
1399
|
+
else {
|
|
1400
|
+
N[_] = !0, b.push(_);
|
|
1401
|
+
for (const M of g(_))
|
|
1402
|
+
b.push(M);
|
|
1403
|
+
}
|
|
1404
|
+
_ = b.pop();
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
function c(f) {
|
|
1408
|
+
r[f] = i.inEdges(f).reduce((g, b) => Math.max(g, r[b.v] + i.edge(b)), 0);
|
|
1409
|
+
}
|
|
1410
|
+
function d(f) {
|
|
1411
|
+
const g = i.outEdges(f).reduce((N, _) => Math.min(N, r[_.w] - i.edge(_)), Number.POSITIVE_INFINITY), b = e.node(f);
|
|
1412
|
+
g !== Number.POSITIVE_INFINITY && b.borderType !== l && (r[f] = Math.max(r[f], g));
|
|
1413
|
+
}
|
|
1414
|
+
return a(c, i.predecessors.bind(i)), a(d, i.successors.bind(i)), Object.keys(n).forEach((f) => {
|
|
1415
|
+
r[f] = r[o[f]];
|
|
1416
|
+
}), r;
|
|
1417
|
+
}
|
|
1418
|
+
function Ps(e, t, o, n) {
|
|
1419
|
+
const s = new e.constructor(), r = e.graph(), i = Gs(r.nodesep, r.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(i(e, c, a), g || 0)
|
|
1430
|
+
);
|
|
1431
|
+
}
|
|
1432
|
+
a = c;
|
|
1433
|
+
});
|
|
1434
|
+
}), s;
|
|
1435
|
+
}
|
|
1436
|
+
function zs(e, t) {
|
|
1437
|
+
return Object.values(t).reduce(
|
|
1438
|
+
(o, n) => {
|
|
1439
|
+
let s = Number.NEGATIVE_INFINITY, r = Number.POSITIVE_INFINITY;
|
|
1440
|
+
Object.entries(n).forEach(([l, a]) => {
|
|
1441
|
+
const c = js(e, l) / 2;
|
|
1442
|
+
s = Math.max(a + c, s), r = Math.min(a - c, r);
|
|
1443
|
+
});
|
|
1444
|
+
const i = s - r;
|
|
1445
|
+
return i < o[0] && (o = [i, n]), o;
|
|
1446
|
+
},
|
|
1447
|
+
[Number.POSITIVE_INFINITY, null]
|
|
1448
|
+
)[1];
|
|
1449
|
+
}
|
|
1450
|
+
function Bs(e, t) {
|
|
1451
|
+
const o = Object.values(t), n = j(Math.min, o), s = j(Math.max, o);
|
|
1452
|
+
["u", "d"].forEach((r) => {
|
|
1453
|
+
["l", "r"].forEach((i) => {
|
|
1454
|
+
const l = r + i;
|
|
1455
|
+
let a = e[l];
|
|
1456
|
+
if (a === t) return;
|
|
1457
|
+
const c = Object.values(a);
|
|
1458
|
+
let d = n - j(Math.min, c);
|
|
1459
|
+
i !== "l" && (d = s - j(Math.max, c)), d && (a = Ne(a, (f) => f + d), e[l] = a);
|
|
1460
|
+
});
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
function Vs(e, t) {
|
|
1464
|
+
return Ne(e.ul, (o, n) => {
|
|
1465
|
+
if (t)
|
|
1466
|
+
return e[t.toLowerCase()][n];
|
|
1467
|
+
const s = Object.values(e).map((r) => r[n]).sort((r, i) => r - i);
|
|
1468
|
+
return (s[1] + s[2]) / 2;
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
function Is(e) {
|
|
1472
|
+
const t = _e(e), o = Object.assign(
|
|
1473
|
+
Rs(e, t),
|
|
1474
|
+
Ts(e, t)
|
|
1475
|
+
), n = {};
|
|
1476
|
+
let s;
|
|
1477
|
+
["u", "d"].forEach((i) => {
|
|
1478
|
+
s = i === "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 = (i === "u" ? e.predecessors : e.successors).bind(e), d = Ds(
|
|
1484
|
+
e,
|
|
1485
|
+
a,
|
|
1486
|
+
o,
|
|
1487
|
+
c
|
|
1488
|
+
);
|
|
1489
|
+
let f = Fs(
|
|
1490
|
+
e,
|
|
1491
|
+
a,
|
|
1492
|
+
d.root,
|
|
1493
|
+
d.align,
|
|
1494
|
+
l === "r"
|
|
1495
|
+
);
|
|
1496
|
+
l === "r" && (f = Ne(f, (g) => -g)), n[i + l] = f;
|
|
1497
|
+
});
|
|
1498
|
+
});
|
|
1499
|
+
const r = zs(e, n);
|
|
1500
|
+
return Bs(n, r), Vs(n, e.graph().align);
|
|
1501
|
+
}
|
|
1502
|
+
function Gs(e, t, o) {
|
|
1503
|
+
return (n, s, r) => {
|
|
1504
|
+
const i = n.node(s), l = n.node(r);
|
|
1505
|
+
let a = 0, c;
|
|
1506
|
+
if (a += i.width / 2, Object.hasOwn(i, "labelpos"))
|
|
1507
|
+
switch (i.labelpos.toLowerCase()) {
|
|
1508
|
+
case "l":
|
|
1509
|
+
c = -i.width / 2;
|
|
1510
|
+
break;
|
|
1511
|
+
case "r":
|
|
1512
|
+
c = i.width / 2;
|
|
1513
|
+
break;
|
|
1514
|
+
}
|
|
1515
|
+
if (c && (a += o ? c : -c), c = 0, a += (i.dummy ? t : e) / 2, a += (l.dummy ? t : e) / 2, a += l.width / 2, Object.hasOwn(l, "labelpos"))
|
|
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 js(e, t) {
|
|
1528
|
+
return e.node(t).width;
|
|
1529
|
+
}
|
|
1530
|
+
function Ws(e) {
|
|
1531
|
+
const t = at(e);
|
|
1532
|
+
Ys(t);
|
|
1533
|
+
const o = Is(t);
|
|
1534
|
+
Object.entries(o).forEach(([n, s]) => {
|
|
1535
|
+
e.node(n).x = s;
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
function Ys(e) {
|
|
1539
|
+
const t = _e(e), o = e.graph().ranksep;
|
|
1540
|
+
let n = 0;
|
|
1541
|
+
t.forEach((s) => {
|
|
1542
|
+
const r = s.reduce((i, l) => {
|
|
1543
|
+
const a = e.node(l).height;
|
|
1544
|
+
return i > a ? i : a;
|
|
1545
|
+
}, 0);
|
|
1546
|
+
s.forEach((i) => {
|
|
1547
|
+
e.node(i).y = n + r / 2;
|
|
1548
|
+
}), n += r + o;
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
function Hs(e, t = {}) {
|
|
1552
|
+
const o = t.debugTiming ? fo : ho;
|
|
1553
|
+
return o("layout", () => {
|
|
1554
|
+
const n = o(" buildLayoutGraph", () => or(e));
|
|
1555
|
+
return o(" runLayout", () => Zs(n, o, t)), o(" updateInputGraph", () => Us(e, n)), n;
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
function Zs(e, t, o) {
|
|
1559
|
+
t(" makeSpaceForEdgeLabels", () => nr(e)), t(" removeSelfEdges", () => fr(e)), t(" acyclic", () => Bn(e)), t(" nestingGraph.run", () => ls(e)), t(" rank", () => ts(at(e))), t(" injectEdgeLabelProxies", () => sr(e)), t(" removeEmptyRanks", () => ao(e)), t(" nestingGraph.cleanup", () => us(e)), t(" normalizeRanks", () => lo(e)), t(" assignRankMinMax", () => rr(e)), t(" removeEdgeLabelProxies", () => ir(e)), t(" normalize.run", () => Gn(e)), t(" parentDummyChains", () => ss(e)), t(" addBorderSegments", () => ds(e)), t(" order", () => wo(e, o)), t(" insertSelfEdges", () => hr(e)), t(" adjustCoordinateSystem", () => Kt.adjust(e)), t(" position", () => Ws(e)), t(" positionSelfEdges", () => mr(e)), t(" removeBorderNodes", () => dr(e)), t(" normalize.undo", () => Wn(e)), t(" fixupEdgeLabelCoords", () => cr(e)), t(" undoCoordinateSystem", () => Kt.undo(e)), t(" translateGraph", () => lr(e)), t(" assignNodeIntersects", () => ar(e)), t(" reversePoints", () => ur(e)), t(" acyclic.undo", () => Vn(e));
|
|
1560
|
+
}
|
|
1561
|
+
function Us(e, t) {
|
|
1562
|
+
e.nodes().forEach((s) => {
|
|
1563
|
+
const r = e.node(s), i = t.node(s);
|
|
1564
|
+
r && (r.x = i.x, r.y = i.y, r.order = i.order, r.rank = i.rank, t.children(s).length && (r.width = i.width, r.height = i.height));
|
|
1565
|
+
}), e.edges().forEach((s) => {
|
|
1566
|
+
const r = e.edge(s), i = t.edge(s);
|
|
1567
|
+
r.points = i.points, Object.hasOwn(i, "x") && (r.x = i.x, r.y = i.y);
|
|
1568
|
+
});
|
|
1569
|
+
const o = t.graph(), n = e.graph();
|
|
1570
|
+
n.width = o.width, n.height = o.height;
|
|
1571
|
+
}
|
|
1572
|
+
const Xs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], qs = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, Ks = ["acyclicer", "ranker", "rankdir", "align"], Js = ["width", "height", "rank"], to = { width: 0, height: 0 }, Qs = ["minlen", "weight", "width", "height", "labeloffset"], er = {
|
|
1573
|
+
minlen: 1,
|
|
1574
|
+
weight: 1,
|
|
1575
|
+
width: 0,
|
|
1576
|
+
height: 0,
|
|
1577
|
+
labeloffset: 10,
|
|
1578
|
+
labelpos: "r"
|
|
1579
|
+
}, tr = ["labelpos"];
|
|
1580
|
+
function or(e) {
|
|
1581
|
+
const t = nt(e.graph()), o = {
|
|
1582
|
+
...qs,
|
|
1583
|
+
...ot(t, Xs),
|
|
1584
|
+
...xe(t, Ks)
|
|
1585
|
+
}, n = new q({ multigraph: !0, compound: !0 });
|
|
1586
|
+
return n.setGraph(o), e.nodes().forEach((s) => {
|
|
1587
|
+
const r = nt(e.node(s)), i = ot(r, Js);
|
|
1588
|
+
Object.keys(to).forEach((l) => {
|
|
1589
|
+
i[l] === void 0 && (i[l] = to[l]);
|
|
1590
|
+
}), n.setNode(s, i), n.setParent(s, e.parent(s));
|
|
1591
|
+
}), e.edges().forEach((s) => {
|
|
1592
|
+
const r = nt(e.edge(s));
|
|
1593
|
+
n.setEdge(
|
|
1594
|
+
s,
|
|
1595
|
+
{
|
|
1596
|
+
...er,
|
|
1597
|
+
...ot(r, Qs),
|
|
1598
|
+
...xe(r, tr)
|
|
1599
|
+
}
|
|
1600
|
+
);
|
|
1601
|
+
}), n;
|
|
1602
|
+
}
|
|
1603
|
+
function nr(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 sr(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), r = { rank: (e.node(t.w).rank - n.rank) / 2 + n.rank, e: t };
|
|
1615
|
+
ue(e, "edge-proxy", r, "_ep");
|
|
1616
|
+
}
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
function rr(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 ir(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 lr(e) {
|
|
1633
|
+
let t = Number.POSITIVE_INFINITY, o = 0, n = Number.POSITIVE_INFINITY, s = 0;
|
|
1634
|
+
const r = e.graph(), i = r.marginx || 0, l = r.marginy || 0;
|
|
1635
|
+
function a(c) {
|
|
1636
|
+
const d = c.x, f = c.y, g = c.width, b = c.height;
|
|
1637
|
+
t = Math.min(t, d - g / 2), o = Math.max(o, d + g / 2), n = Math.min(n, f - b / 2), s = Math.max(s, f + b / 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 -= i, 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
|
+
}), r.width = o - t + i, r.height = s - n + l;
|
|
1651
|
+
}
|
|
1652
|
+
function ar(e) {
|
|
1653
|
+
e.edges().forEach((t) => {
|
|
1654
|
+
const o = e.edge(t), n = e.node(t.v), s = e.node(t.w);
|
|
1655
|
+
let r, i;
|
|
1656
|
+
!o.points || !o.points.length ? (o.points = [], r = s, i = n) : (r = o.points[0], i = o.points[o.points.length - 1]), o.points.unshift(lt(n, r)), o.points.push(lt(s, i));
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
function cr(e) {
|
|
1660
|
+
e.edges().forEach((t) => {
|
|
1661
|
+
const o = e.edge(t);
|
|
1662
|
+
if (Object.hasOwn(o, "x"))
|
|
1663
|
+
switch ((o.labelpos === "l" || o.labelpos === "r") && (o.width -= o.labeloffset), o.labelpos) {
|
|
1664
|
+
case "l":
|
|
1665
|
+
o.x -= o.width / 2 + o.labeloffset;
|
|
1666
|
+
break;
|
|
1667
|
+
case "r":
|
|
1668
|
+
o.x += o.width / 2 + o.labeloffset;
|
|
1669
|
+
break;
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
function ur(e) {
|
|
1674
|
+
e.edges().forEach((t) => {
|
|
1675
|
+
const o = e.edge(t);
|
|
1676
|
+
o.reversed && o.points.reverse();
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
function dr(e) {
|
|
1680
|
+
e.nodes().forEach((t) => {
|
|
1681
|
+
if (e.children(t).length) {
|
|
1682
|
+
const o = e.node(t), n = e.node(o.borderTop), s = e.node(o.borderBottom), r = e.node(o.borderLeft[o.borderLeft.length - 1]), i = e.node(o.borderRight[o.borderRight.length - 1]);
|
|
1683
|
+
o.width = Math.abs(i.x - r.x), o.height = Math.abs(s.y - n.y), o.x = r.x + o.width / 2, o.y = n.y + o.height / 2;
|
|
1684
|
+
}
|
|
1685
|
+
}), e.nodes().forEach((t) => {
|
|
1686
|
+
e.node(t).dummy === "border" && e.removeNode(t);
|
|
1687
|
+
});
|
|
1688
|
+
}
|
|
1689
|
+
function fr(e) {
|
|
1690
|
+
e.edges().forEach((t) => {
|
|
1691
|
+
if (t.v === t.w) {
|
|
1692
|
+
const o = e.node(t.v);
|
|
1693
|
+
o.selfEdges || (o.selfEdges = []), o.selfEdges.push({ e: t, label: e.edge(t) }), e.removeEdge(t);
|
|
1694
|
+
}
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
function hr(e) {
|
|
1698
|
+
_e(e).forEach((o) => {
|
|
1699
|
+
let n = 0;
|
|
1700
|
+
o.forEach((s, r) => {
|
|
1701
|
+
const i = e.node(s);
|
|
1702
|
+
i.order = r + n, (i.selfEdges || []).forEach((l) => {
|
|
1703
|
+
ue(e, "selfedge", {
|
|
1704
|
+
width: l.label.width,
|
|
1705
|
+
height: l.label.height,
|
|
1706
|
+
rank: i.rank,
|
|
1707
|
+
order: r + ++n,
|
|
1708
|
+
e: l.e,
|
|
1709
|
+
label: l.label
|
|
1710
|
+
}, "_se");
|
|
1711
|
+
}), delete i.selfEdges;
|
|
1712
|
+
});
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
function mr(e) {
|
|
1716
|
+
e.nodes().forEach((t) => {
|
|
1717
|
+
const o = e.node(t);
|
|
1718
|
+
if (o.dummy === "selfedge") {
|
|
1719
|
+
const n = e.node(o.e.v), s = n.x + n.width / 2, r = n.y, i = o.x - s, l = n.height / 2;
|
|
1720
|
+
e.setEdge(o.e, o.label), e.removeNode(t), o.label.points = [
|
|
1721
|
+
{ x: s + 2 * i / 3, y: r - l },
|
|
1722
|
+
{ x: s + 5 * i / 6, y: r - l },
|
|
1723
|
+
{ x: s + i, y: r },
|
|
1724
|
+
{ x: s + 5 * i / 6, y: r + l },
|
|
1725
|
+
{ x: s + 2 * i / 3, y: r + l }
|
|
1726
|
+
], o.label.x = o.x, o.label.y = o.y;
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
function ot(e, t) {
|
|
1731
|
+
return Ne(xe(e, t), Number);
|
|
1732
|
+
}
|
|
1733
|
+
function nt(e) {
|
|
1734
|
+
const t = {};
|
|
1735
|
+
return e && Object.entries(e).forEach(([o, n]) => {
|
|
1736
|
+
let s = o;
|
|
1737
|
+
typeof s == "string" && (s = s.toLowerCase()), t[s] = n;
|
|
1738
|
+
}), t;
|
|
1739
|
+
}
|
|
1740
|
+
const gr = {
|
|
1741
|
+
rankDirection: "TB",
|
|
1742
|
+
// "TB", "BT", "LR", "RL"
|
|
1743
|
+
nodeSeparation: 50,
|
|
1744
|
+
rankSeparation: 50,
|
|
1745
|
+
edgeSeparation: 10,
|
|
1746
|
+
// "UL", "UR", "DL", "DR" or undefined force one of four extreme alignment strategies (Up/Down × Left/Right).
|
|
1747
|
+
align: void 0,
|
|
1748
|
+
nodeWidth: 100,
|
|
1749
|
+
nodeHeight: 40,
|
|
1750
|
+
curvedEdges: !1,
|
|
1751
|
+
padding: 20,
|
|
1752
|
+
// "undirected" | "normal" | "vee"
|
|
1753
|
+
arrowShape: "normal",
|
|
1754
|
+
arrowSize: 10
|
|
1755
|
+
};
|
|
1756
|
+
function vr(e) {
|
|
1757
|
+
return e.length ? e.map(
|
|
1758
|
+
(t, o) => `${o === 0 ? "M" : "L"} ${t.x} ${t.y}`
|
|
1759
|
+
).join(" ") : "";
|
|
1760
|
+
}
|
|
1761
|
+
function br(e) {
|
|
1762
|
+
if (!e.length) return "";
|
|
1763
|
+
if (e.length === 1) {
|
|
1764
|
+
const s = e[0];
|
|
1765
|
+
return `M ${s.x} ${s.y}`;
|
|
1766
|
+
}
|
|
1767
|
+
if (e.length === 2)
|
|
1768
|
+
return `M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;
|
|
1769
|
+
const [t] = e;
|
|
1770
|
+
let o = `M ${t.x} ${t.y}`;
|
|
1771
|
+
for (let s = 1; s < e.length - 1; s += 1) {
|
|
1772
|
+
e[s - 1];
|
|
1773
|
+
const r = e[s], i = e[s + 1], l = r.x, a = r.y, c = (r.x + i.x) / 2, d = (r.y + i.y) / 2;
|
|
1774
|
+
o += ` Q ${l} ${a} ${c} ${d}`;
|
|
1775
|
+
}
|
|
1776
|
+
const n = e[e.length - 1];
|
|
1777
|
+
return o += ` L ${n.x} ${n.y}`, o;
|
|
1778
|
+
}
|
|
1779
|
+
function pr(e) {
|
|
1780
|
+
const { nodes: t, edges: o, configuration: n } = e, s = y(null), r = y(null), i = `dag-arrow-${rt()}`;
|
|
1781
|
+
function l(a, c, d) {
|
|
1782
|
+
r.value = null, s.value = null;
|
|
1783
|
+
const f = {
|
|
1784
|
+
...gr,
|
|
1785
|
+
...d
|
|
1786
|
+
}, g = new q({ multigraph: !0, compound: !0 });
|
|
1787
|
+
g.setGraph({
|
|
1788
|
+
rankdir: f.rankDirection,
|
|
1789
|
+
nodesep: f.nodeSeparation,
|
|
1790
|
+
ranksep: f.rankSeparation,
|
|
1791
|
+
edgesep: f.edgeSeparation,
|
|
1792
|
+
align: f.align
|
|
1793
|
+
}), a.forEach((u) => {
|
|
1794
|
+
g.setNode(u.id, {
|
|
1795
|
+
label: u.label,
|
|
1796
|
+
width: u.width ?? f.nodeWidth,
|
|
1797
|
+
height: u.height ?? f.nodeHeight
|
|
1798
|
+
});
|
|
1799
|
+
}), c.forEach((u) => {
|
|
1800
|
+
g.setEdge(u.from, u.to, {
|
|
1801
|
+
weight: u.weight ?? 1,
|
|
1802
|
+
minlen: u.minLength ?? 1
|
|
1803
|
+
});
|
|
1804
|
+
}), Hs(g);
|
|
1805
|
+
const b = a.map((u) => {
|
|
1806
|
+
const I = g.node(u.id);
|
|
1807
|
+
return {
|
|
1808
|
+
id: u.id,
|
|
1809
|
+
label: u.label,
|
|
1810
|
+
x: I.x,
|
|
1811
|
+
y: I.y,
|
|
1812
|
+
width: I.width,
|
|
1813
|
+
height: I.height,
|
|
1814
|
+
original: u
|
|
1815
|
+
};
|
|
1816
|
+
}), N = g.edges().map((u) => {
|
|
1817
|
+
const I = g.edge(u), H = I.points || [];
|
|
1818
|
+
if (!H.length)
|
|
1819
|
+
return null;
|
|
1820
|
+
const Ae = f.curvedEdges ? br(H) : vr(H), Se = f.arrowShape !== "undirected" ? `url(#${i})` : null, Le = c.find((he) => he?.from === u.v && he?.to === u.w);
|
|
1821
|
+
return {
|
|
1822
|
+
id: `${u.v}->${u.w}->${rt()}`,
|
|
1823
|
+
from: u.v,
|
|
1824
|
+
to: u.w,
|
|
1825
|
+
points: H,
|
|
1826
|
+
pathData: Ae,
|
|
1827
|
+
markerEnd: Se,
|
|
1828
|
+
original: {
|
|
1829
|
+
...Le,
|
|
1830
|
+
...I
|
|
1831
|
+
}
|
|
1832
|
+
};
|
|
1833
|
+
}).filter(Boolean), _ = f.padding;
|
|
1834
|
+
if (!b.length) {
|
|
1835
|
+
s.value = {
|
|
1836
|
+
nodes: [],
|
|
1837
|
+
edges: N,
|
|
1838
|
+
viewBox: "0 0 0 0",
|
|
1839
|
+
arrowShape: f.arrowShape,
|
|
1840
|
+
arrowSize: f.arrowSize
|
|
1841
|
+
};
|
|
1842
|
+
return;
|
|
1843
|
+
}
|
|
1844
|
+
const M = b.flatMap((u) => [
|
|
1845
|
+
u.x - u.width / 2,
|
|
1846
|
+
u.x + u.width / 2
|
|
1847
|
+
]), Y = b.flatMap((u) => [
|
|
1848
|
+
u.y - u.height / 2,
|
|
1849
|
+
u.y + u.height / 2
|
|
1850
|
+
]), fe = Math.min(...M) - _, oe = Math.max(...M) + _, R = Math.min(...Y) - _, P = Math.max(...Y) + _;
|
|
1851
|
+
s.value = {
|
|
1852
|
+
nodes: b,
|
|
1853
|
+
edges: N.map((u) => ({
|
|
1854
|
+
...u,
|
|
1855
|
+
midpoint: u.pathData ? sn(u.pathData) : { x: 0, y: 0 }
|
|
1856
|
+
})),
|
|
1857
|
+
viewBox: `${fe} ${R} ${oe - fe} ${P - R}`,
|
|
1858
|
+
arrowShape: f.arrowShape,
|
|
1859
|
+
arrowSize: f.arrowSize
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
return Jo(() => {
|
|
1863
|
+
try {
|
|
1864
|
+
const a = v(t) || [], c = v(o) || [], d = v(n) || {};
|
|
1865
|
+
l(a, c, d);
|
|
1866
|
+
} catch (a) {
|
|
1867
|
+
console.error("[useDag] layout error:", a), r.value = a, s.value = null;
|
|
1868
|
+
}
|
|
1869
|
+
}), {
|
|
1870
|
+
layoutData: s,
|
|
1871
|
+
lastError: r,
|
|
1872
|
+
arrowMarkerIdentifier: i,
|
|
1873
|
+
recomputeLayout: () => {
|
|
1874
|
+
const a = v(t) || [], c = v(o) || [], d = v(n) || {};
|
|
1875
|
+
l(a, c, d);
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
}
|
|
1879
|
+
const ko = { 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" } } } } }, Eo = { 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" } } } } }, Co = { 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" } } } } }, xo = { 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" } } } } }, _o = { 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" } } } } }, No = { 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" } } } } }, Ao = {
|
|
1880
|
+
default: {},
|
|
1881
|
+
dark: ko,
|
|
1882
|
+
celebration: Eo,
|
|
1883
|
+
celebrationNight: Co,
|
|
1884
|
+
hack: xo,
|
|
1885
|
+
zen: _o,
|
|
1886
|
+
concrete: No
|
|
1887
|
+
}, ai = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1888
|
+
__proto__: null,
|
|
1889
|
+
celebration: Eo,
|
|
1890
|
+
celebrationNight: Co,
|
|
1891
|
+
concrete: No,
|
|
1892
|
+
dark: ko,
|
|
1893
|
+
default: Ao,
|
|
1894
|
+
hack: xo,
|
|
1895
|
+
zen: _o
|
|
1896
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1897
|
+
function wr(e, t) {
|
|
1898
|
+
const o = Ce(e);
|
|
1899
|
+
return rn(o, t);
|
|
1900
|
+
}
|
|
1901
|
+
function ci(e, t) {
|
|
1902
|
+
const o = Ce(e);
|
|
1903
|
+
return ln(o, t);
|
|
1904
|
+
}
|
|
1905
|
+
function ui(e, t) {
|
|
1906
|
+
const o = Ce(e);
|
|
1907
|
+
return an(o, t);
|
|
1908
|
+
}
|
|
1909
|
+
function di({ defaultConfig: e, userConfig: t }) {
|
|
1910
|
+
return so({ defaultConfig: e, userConfig: t });
|
|
1911
|
+
}
|
|
1912
|
+
const yr = {
|
|
1913
|
+
__name: "BaseZoomControls",
|
|
1914
|
+
props: {
|
|
1915
|
+
config: {
|
|
1916
|
+
type: Object,
|
|
1917
|
+
default() {
|
|
1918
|
+
return {};
|
|
1919
|
+
}
|
|
1920
|
+
},
|
|
1921
|
+
scale: {
|
|
1922
|
+
type: Number,
|
|
1923
|
+
default: 0
|
|
1924
|
+
},
|
|
1925
|
+
withDirection: {
|
|
1926
|
+
type: Boolean,
|
|
1927
|
+
default: !1
|
|
1928
|
+
},
|
|
1929
|
+
isFullscreen: {
|
|
1930
|
+
type: Boolean,
|
|
1931
|
+
default: !1
|
|
1932
|
+
}
|
|
1933
|
+
},
|
|
1934
|
+
emits: ["zoomIn", "zoomOut", "resetZoom", "switchDirection"],
|
|
1935
|
+
setup(e, { emit: t }) {
|
|
1936
|
+
const o = t;
|
|
1937
|
+
return (n, s) => (k(), x("div", {
|
|
1938
|
+
class: st({ "vue-data-ui-zoom-controls": !0, "vue-data-ui-zoom-controls-fullscreen": e.isFullscreen }),
|
|
1939
|
+
"data-dom-to-png-ignore": "",
|
|
1940
|
+
style: X({
|
|
1941
|
+
border: e.config.style.chart.controls.border,
|
|
1942
|
+
backgroundColor: e.config.style.chart.controls.backgroundColor,
|
|
1943
|
+
padding: e.config.style.chart.controls.padding,
|
|
1944
|
+
borderRadius: e.config.style.chart.controls.borderRadius,
|
|
1945
|
+
"--vue-data-ui-zoom-control-button-color": e.config.style.chart.controls.buttonColor,
|
|
1946
|
+
"--vue-data-ui-zoom-control-button-color-hover": v(wr)(e.config.style.chart.controls.buttonColor, 0.2)
|
|
1947
|
+
})
|
|
1948
|
+
}, [
|
|
1949
|
+
G("button", {
|
|
1950
|
+
onClick: s[0] || (s[0] = (r) => o("zoomOut")),
|
|
1951
|
+
class: "vue-data-ui-zoom-controls-button",
|
|
1952
|
+
"data-cy-zoom-out": ""
|
|
1953
|
+
}, [
|
|
1954
|
+
ae(Ke, {
|
|
1955
|
+
name: "zoomMinus",
|
|
1956
|
+
stroke: e.config.style.chart.controls.color,
|
|
1957
|
+
size: e.config.style.chart.controls.fontSize * 1.2
|
|
1958
|
+
}, null, 8, ["stroke", "size"])
|
|
1959
|
+
]),
|
|
1960
|
+
G("button", {
|
|
1961
|
+
class: "vue-data-ui-zoom-controls-button-zoom",
|
|
1962
|
+
onClick: s[1] || (s[1] = (r) => o("resetZoom")),
|
|
1963
|
+
"data-cy-zoom-reset": "",
|
|
1964
|
+
style: X({
|
|
1965
|
+
color: e.config.style.chart.controls.color,
|
|
1966
|
+
width: e.config.style.chart.controls.fontSize * 4 + "px",
|
|
1967
|
+
borderRadius: e.config.style.chart.controls.borderRadius,
|
|
1968
|
+
fontSize: e.config.style.chart.controls.fontSize + "px"
|
|
1969
|
+
})
|
|
1970
|
+
}, le(Math.round(e.scale * 100)) + "% ", 5),
|
|
1971
|
+
G("button", {
|
|
1972
|
+
onClick: s[2] || (s[2] = (r) => o("zoomIn")),
|
|
1973
|
+
class: "vue-data-ui-zoom-controls-button",
|
|
1974
|
+
"data-cy-zoom-in": ""
|
|
1975
|
+
}, [
|
|
1976
|
+
ae(Ke, {
|
|
1977
|
+
name: "zoomPlus",
|
|
1978
|
+
stroke: e.config.style.chart.controls.color,
|
|
1979
|
+
size: e.config.style.chart.controls.fontSize * 1.2
|
|
1980
|
+
}, null, 8, ["stroke", "size"])
|
|
1981
|
+
]),
|
|
1982
|
+
e.withDirection ? (k(), x("button", {
|
|
1983
|
+
key: 0,
|
|
1984
|
+
onClick: s[3] || (s[3] = (r) => o("switchDirection")),
|
|
1985
|
+
class: "vue-data-ui-zoom-controls-button"
|
|
1986
|
+
}, [
|
|
1987
|
+
ae(Ke, {
|
|
1988
|
+
name: "direction",
|
|
1989
|
+
stroke: e.config.style.chart.controls.color,
|
|
1990
|
+
size: e.config.style.chart.controls.fontSize * 1.2
|
|
1991
|
+
}, null, 8, ["stroke", "size"])
|
|
1992
|
+
])) : L("", !0)
|
|
1993
|
+
], 6));
|
|
1994
|
+
}
|
|
1995
|
+
}, oo = /* @__PURE__ */ ro(yr, [["__scopeId", "data-v-e4479474"]]), kr = ["id"], Er = {
|
|
1996
|
+
key: 0,
|
|
1997
|
+
class: "dag-chart-error"
|
|
1998
|
+
}, Cr = ["viewBox", "xmlns"], xr = { key: 0 }, _r = ["id", "markerWidth", "markerHeight", "refX", "refY"], Nr = ["d", "fill", "stroke"], Ar = ["d", "fill", "stroke"], Sr = { class: "vue-ui-dag-edges" }, Lr = ["d", "stroke", "stroke-width"], Or = ["cx", "cy", "r", "fill", "stroke", "stroke-width", "onMouseenter"], Rr = { class: "vue-ui-dag-nodes" }, Tr = ["onClick", "onMouseenter"], Mr = ["x", "y", "width", "height", "rx", "fill", "stroke", "stroke-width"], $r = ["x", "y", "font-size", "fill", "font-weight"], Dr = ["x", "y", "font-size", "fill", "font-weight", "innerHTML"], Fr = ["x", "y", "width", "height"], Pr = { class: "vue-ui-dag-edges" }, zr = ["d", "stroke-width", "marker-end"], Br = {
|
|
1999
|
+
key: 6,
|
|
2000
|
+
class: "vue-data-ui-watermark"
|
|
2001
|
+
}, Vr = ["data-position"], Ir = { key: 0 }, Gr = ["data-position"], jr = { key: 0 }, no = 1.5, Wr = {
|
|
2002
|
+
__name: "vue-ui-dag",
|
|
2003
|
+
props: {
|
|
2004
|
+
dataset: {
|
|
2005
|
+
type: Object,
|
|
2006
|
+
default() {
|
|
2007
|
+
return {
|
|
2008
|
+
nodes: [],
|
|
2009
|
+
edges: []
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
2012
|
+
},
|
|
2013
|
+
config: {
|
|
2014
|
+
type: Object,
|
|
2015
|
+
default() {
|
|
2016
|
+
return {};
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
},
|
|
2020
|
+
emits: ["onNodeClick", "onMidpointEnter", "onMidpointLeave"],
|
|
2021
|
+
setup(e, { expose: t, emit: o }) {
|
|
2022
|
+
const n = Xe(() => import("./PenAndPaper-DscVdZ1u.js")), s = Xe(() => import("./UserOptions-ChRXLqps.js")), r = Xe(() => import("./PackageVersion-Dc4fCiDF.js")), { vue_ui_dag: i } = gn(), { isThemeValid: l, warnInvalidTheme: a } = yn(), c = e, d = o, f = y(null), g = y(rt()), b = y(null), N = y(null), _ = y(null), M = y(0), Y = y(0), fe = y(!1), oe = y(!1), R = y(null), P = y(null), u = y(je()), I = y(u.value.style.chart.width), H = y(u.value.style.chart.height), Ae = y({ x: 0, y: 0 }), z = y(null), Se = y(null), Le = y({ left: "0px", top: "0px" }), he = y("top"), K = y(!1), ut = y({ x: 0, y: 0 }), dt = y({ x: 0, y: 0 }), me = y(null), Ve = y(null), Ie = y({ left: "0px", top: "0px" }), ft = y("top"), Oe = y(!1), ge = y(!1), { svgRef: J } = En({ config: u.value.style.chart.title }), { userOptionsVisible: Ge, setUserOptionsVisibility: ht, keepUserOptionState: mt } = kn({ config: u.value }), Re = y(u.value.style.chart.layout.rankDirection), { loading: ve, FINAL_DATASET: gt, manualLoading: vt } = vn({
|
|
2023
|
+
...Qo(c),
|
|
2024
|
+
FINAL_CONFIG: u,
|
|
2025
|
+
prepareConfig: je,
|
|
2026
|
+
skeletonDataset: {
|
|
2027
|
+
nodes: [
|
|
2028
|
+
{ id: "A", label: "" },
|
|
2029
|
+
{ id: "B", label: "" },
|
|
2030
|
+
{ id: "C", label: "" }
|
|
2031
|
+
],
|
|
2032
|
+
edges: [
|
|
2033
|
+
{ from: "A", to: "B" },
|
|
2034
|
+
{ from: "A", to: "C" }
|
|
2035
|
+
]
|
|
2036
|
+
},
|
|
2037
|
+
skeletonConfig: so({
|
|
2038
|
+
defaultConfig: u.value,
|
|
2039
|
+
userConfig: {
|
|
2040
|
+
userOptions: { show: !1 },
|
|
2041
|
+
style: {
|
|
2042
|
+
chart: {
|
|
2043
|
+
backgroundColor: "#99999930",
|
|
2044
|
+
nodes: {
|
|
2045
|
+
stroke: "#CCCCCC",
|
|
2046
|
+
backgroundColor: "#DDDDDD50"
|
|
2047
|
+
},
|
|
2048
|
+
edges: {
|
|
2049
|
+
stroke: "#CCCCCC"
|
|
2050
|
+
},
|
|
2051
|
+
midpoints: {
|
|
2052
|
+
stroke: "#CCCCCC",
|
|
2053
|
+
fill: "#CCCCCC"
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
})
|
|
2059
|
+
});
|
|
2060
|
+
function je() {
|
|
2061
|
+
const m = qe({
|
|
2062
|
+
userConfig: c.config,
|
|
2063
|
+
defaultConfig: i
|
|
2064
|
+
}), p = m.theme;
|
|
2065
|
+
if (!p) return m;
|
|
2066
|
+
if (!l.value(m))
|
|
2067
|
+
return a(m), m;
|
|
2068
|
+
const h = qe({
|
|
2069
|
+
userConfig: Ao[p] || c.config,
|
|
2070
|
+
defaultConfig: m
|
|
2071
|
+
});
|
|
2072
|
+
return qe({
|
|
2073
|
+
userConfig: c.config,
|
|
2074
|
+
defaultConfig: h
|
|
2075
|
+
});
|
|
2076
|
+
}
|
|
2077
|
+
const bt = W(() => !!u.value.debug);
|
|
2078
|
+
zt(() => {
|
|
2079
|
+
cn(c.dataset) && (jt({
|
|
2080
|
+
componentName: "VueUiDag",
|
|
2081
|
+
type: "dataset",
|
|
2082
|
+
debug: bt.value
|
|
2083
|
+
}), oe.value = !1, vt.value = !0), c.dataset.nodes || (jt({
|
|
2084
|
+
componentName: "VueUiDag",
|
|
2085
|
+
type: "datasetAttributeEmpty",
|
|
2086
|
+
property: "nodes",
|
|
2087
|
+
index: 0,
|
|
2088
|
+
debug: bt.value
|
|
2089
|
+
}), oe.value = !1, vt.value = !0), oe.value = !0, Ft();
|
|
2090
|
+
}), De(() => c.config, (m) => {
|
|
2091
|
+
ve.value || (u.value = je()), Ge.value = !u.value.userOptions.showOnChartHover, M.value += 1, Re.value = u.value.style.chart.layout.rankDirection, I.value = u.value.style.chart.width, H.value = u.value.style.chart.height, ne.value = u.value.style.chart.zoom.active, Ft();
|
|
2092
|
+
}, { deep: !0 });
|
|
2093
|
+
const { isPrinting: pt, isImaging: wt, generatePdf: yt, generateImage: kt } = pn({
|
|
2094
|
+
elementId: `dag_${g.value}`,
|
|
2095
|
+
fileName: u.value.style.chart.title.text || "vue-ui-dag",
|
|
2096
|
+
options: u.value.userOptions.print
|
|
2097
|
+
}), So = W(() => u.value.style.chart.backgroundColor), Lo = W(() => u.value.style.chart.title), { exportSvg: Oo, getSvg: Ro } = wn({
|
|
2098
|
+
svg: J,
|
|
2099
|
+
title: Lo,
|
|
2100
|
+
legend: void 0,
|
|
2101
|
+
legendItems: void 0,
|
|
2102
|
+
backgroundColor: So
|
|
2103
|
+
});
|
|
2104
|
+
async function Et({ isCb: m }) {
|
|
2105
|
+
if (m) {
|
|
2106
|
+
const { blob: p, url: h, text: w, dataUrl: O } = await Ro();
|
|
2107
|
+
u.value.userOptions.callbacks.svg({ blob: p, url: h, text: w, dataUrl: O });
|
|
2108
|
+
} else
|
|
2109
|
+
Oo();
|
|
2110
|
+
}
|
|
2111
|
+
function To() {
|
|
2112
|
+
fe.value = !0, ht(!0);
|
|
2113
|
+
}
|
|
2114
|
+
function Mo() {
|
|
2115
|
+
ht(!1), fe.value = !1;
|
|
2116
|
+
}
|
|
2117
|
+
function Ct({
|
|
2118
|
+
tooltipRef: m,
|
|
2119
|
+
isVisibleRef: p,
|
|
2120
|
+
anchorRef: h,
|
|
2121
|
+
styleRef: w,
|
|
2122
|
+
placementRef: O,
|
|
2123
|
+
offsetRef: $,
|
|
2124
|
+
margin: C = 24
|
|
2125
|
+
}) {
|
|
2126
|
+
return function() {
|
|
2127
|
+
const ee = m.value;
|
|
2128
|
+
if (!ee || !p.value) return;
|
|
2129
|
+
const S = ee.getBoundingClientRect(), D = window.innerWidth, pe = window.innerHeight, we = h.value.x, Me = h.value.y, $e = $?.value?.x ?? 0, Pt = $?.value?.y ?? 0;
|
|
2130
|
+
let F = Me - Pt - S.height - C, Z = we - S.width / 2, ye = "top";
|
|
2131
|
+
if (F < C) {
|
|
2132
|
+
const re = Me + Pt + C;
|
|
2133
|
+
re + S.height <= pe - C ? (F = re, ye = "bottom") : (F = Me - S.height / 2, F < C && (F = C), F + S.height > pe - C && (F = pe - S.height - C), ye = "center");
|
|
2134
|
+
}
|
|
2135
|
+
Z < C && (Z = C), Z + S.width > D - C && (Z = D - S.width - C);
|
|
2136
|
+
const Xo = Z <= C, qo = Z + S.width >= D - C;
|
|
2137
|
+
if ((Xo || qo) && ye !== "center") {
|
|
2138
|
+
let re, ke;
|
|
2139
|
+
const Ko = we - $e - C;
|
|
2140
|
+
D - (we + $e) - C >= Ko ? (re = "right", ke = we + $e + C) : (re = "left", ke = we - $e - C - S.width), ke >= C && ke + S.width <= D - C && (Z = ke, F = Me - S.height / 2, F < C && (F = C), F + S.height > pe - C && (F = pe - S.height - C), ye = re);
|
|
2141
|
+
}
|
|
2142
|
+
O.value = ye, w.value = {
|
|
2143
|
+
left: `${Z}px`,
|
|
2144
|
+
top: `${F}px`
|
|
2145
|
+
};
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
const $o = W(() => gt.value.nodes.map((m) => ({
|
|
2149
|
+
...m,
|
|
2150
|
+
backgroundColor: m.backgroundColor ? Ce(m.backgroundColor) : u.value.style.chart.nodes.backgroundColor,
|
|
2151
|
+
color: m.color ? Ce(m.color) : u.value.style.chart.nodes.labels.color
|
|
2152
|
+
}))), Do = W(() => gt.value.edges), Fo = W(() => ({
|
|
2153
|
+
...u.value.style.chart.layout,
|
|
2154
|
+
rankDirection: Re.value
|
|
2155
|
+
})), { layoutData: E, lastError: xt, arrowMarkerIdentifier: Po } = pr({
|
|
2156
|
+
nodes: $o,
|
|
2157
|
+
edges: Do,
|
|
2158
|
+
configuration: Fo
|
|
2159
|
+
});
|
|
2160
|
+
function _t(m) {
|
|
2161
|
+
return E.value ? E.value.nodes.find((p) => p.id === m) : null;
|
|
2162
|
+
}
|
|
2163
|
+
const zo = W(() => {
|
|
2164
|
+
if (!E.value) return [];
|
|
2165
|
+
const m = u.value.style.chart.edges.stroke, p = /* @__PURE__ */ new Set();
|
|
2166
|
+
return E.value.edges.forEach((h) => {
|
|
2167
|
+
p.add(h.original?.color || m);
|
|
2168
|
+
}), Array.from(p);
|
|
2169
|
+
});
|
|
2170
|
+
function Nt(m) {
|
|
2171
|
+
return `${Po}-${String(m).replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
2172
|
+
}
|
|
2173
|
+
const At = W(() => {
|
|
2174
|
+
const m = I.value, p = H.value, h = Number(m), w = Number(p), O = Number.isFinite(h) && h > 0, $ = Number.isFinite(w) && w > 0;
|
|
2175
|
+
return !O && !$ ? null : {
|
|
2176
|
+
width: O ? h : null,
|
|
2177
|
+
height: $ ? w : null
|
|
2178
|
+
};
|
|
2179
|
+
}), be = y(null), ne = y(u.value.style.chart.zoom.active), {
|
|
2180
|
+
viewBox: St,
|
|
2181
|
+
resetZoom: Te,
|
|
2182
|
+
setInitialViewBox: Bo,
|
|
2183
|
+
scale: Lt,
|
|
2184
|
+
zoomByFactor: Ot
|
|
2185
|
+
} = mn(
|
|
2186
|
+
J,
|
|
2187
|
+
{ x: 0, y: 0, width: 100, height: 100 },
|
|
2188
|
+
1,
|
|
2189
|
+
ne,
|
|
2190
|
+
() => {
|
|
2191
|
+
K.value = !1;
|
|
2192
|
+
}
|
|
2193
|
+
);
|
|
2194
|
+
function Vo() {
|
|
2195
|
+
ne.value = !ne.value;
|
|
2196
|
+
}
|
|
2197
|
+
function Rt() {
|
|
2198
|
+
const m = E.value && E.value.viewBox;
|
|
2199
|
+
if (!m) return;
|
|
2200
|
+
const p = String(m).split(" ").map(Number);
|
|
2201
|
+
if (p.length !== 4) return;
|
|
2202
|
+
const [h, w, O, $] = p;
|
|
2203
|
+
if (!Number.isFinite(h) || !Number.isFinite(w) || !Number.isFinite(O) || !Number.isFinite($))
|
|
2204
|
+
return;
|
|
2205
|
+
let C = O, se = $, ee = h, S = w;
|
|
2206
|
+
const D = At.value;
|
|
2207
|
+
D && (D.width !== null && (C = D.width), D.height !== null && (se = D.height), ee = h - (C - O) / 2, S = w - (se - $) / 2), Bo(
|
|
2208
|
+
{ x: ee, y: S, width: C, height: se },
|
|
2209
|
+
{ overwriteCurrentIfNotZoomed: !0 }
|
|
2210
|
+
);
|
|
2211
|
+
}
|
|
2212
|
+
De(
|
|
2213
|
+
() => E.value && E.value.viewBox,
|
|
2214
|
+
() => {
|
|
2215
|
+
Rt();
|
|
2216
|
+
},
|
|
2217
|
+
{ immediate: !0 }
|
|
2218
|
+
), De(
|
|
2219
|
+
() => At.value,
|
|
2220
|
+
() => {
|
|
2221
|
+
Rt();
|
|
2222
|
+
}
|
|
2223
|
+
), De(() => ge.value, (m) => {
|
|
2224
|
+
ne.value = !m;
|
|
2225
|
+
});
|
|
2226
|
+
const Io = W(() => {
|
|
2227
|
+
const m = St.value;
|
|
2228
|
+
return m ? `${m.x} ${m.y} ${m.width} ${m.height}` : "0 0 0 0";
|
|
2229
|
+
}), Q = y(!1);
|
|
2230
|
+
function Tt(m) {
|
|
2231
|
+
Q.value = m, Y.value += 1;
|
|
2232
|
+
}
|
|
2233
|
+
function We() {
|
|
2234
|
+
ge.value = !ge.value;
|
|
2235
|
+
}
|
|
2236
|
+
function Ye() {
|
|
2237
|
+
Ot(no, !0);
|
|
2238
|
+
}
|
|
2239
|
+
function He() {
|
|
2240
|
+
Ot(1 / no, !0);
|
|
2241
|
+
}
|
|
2242
|
+
const Ze = ["TB", "RL", "BT", "LR"];
|
|
2243
|
+
function Ue() {
|
|
2244
|
+
Re.value = Ze[(Ze.indexOf(Re.value) + 1) % Ze.length], Te();
|
|
2245
|
+
}
|
|
2246
|
+
const Go = Ct({
|
|
2247
|
+
tooltipRef: Se,
|
|
2248
|
+
isVisibleRef: Oe,
|
|
2249
|
+
anchorRef: Ae,
|
|
2250
|
+
styleRef: Le,
|
|
2251
|
+
placementRef: he
|
|
2252
|
+
}), jo = Ct({
|
|
2253
|
+
tooltipRef: Ve,
|
|
2254
|
+
isVisibleRef: K,
|
|
2255
|
+
anchorRef: ut,
|
|
2256
|
+
styleRef: Ie,
|
|
2257
|
+
placementRef: ft,
|
|
2258
|
+
offsetRef: dt
|
|
2259
|
+
});
|
|
2260
|
+
async function Wo(m) {
|
|
2261
|
+
d("onMidpointEnter", m);
|
|
2262
|
+
const p = J.value;
|
|
2263
|
+
if (!p || !m?.midpoint) return;
|
|
2264
|
+
const h = p.createSVGPoint();
|
|
2265
|
+
h.x = m.midpoint.x, h.y = m.midpoint.y;
|
|
2266
|
+
const w = p.getScreenCTM();
|
|
2267
|
+
if (!w) return;
|
|
2268
|
+
const O = h.matrixTransform(w);
|
|
2269
|
+
Ae.value = {
|
|
2270
|
+
x: O.x,
|
|
2271
|
+
y: O.y
|
|
2272
|
+
}, z.value = m, Oe.value = !0, await Gt(), Go();
|
|
2273
|
+
}
|
|
2274
|
+
function Yo() {
|
|
2275
|
+
Oe.value = !1, z.value = null, d("onMidpointLeave");
|
|
2276
|
+
}
|
|
2277
|
+
async function Ho(m) {
|
|
2278
|
+
if (d("onNodeClick", m), !u.value.style.chart.nodes.tooltip.showOnClick) return;
|
|
2279
|
+
const p = J.value;
|
|
2280
|
+
if (!p) return;
|
|
2281
|
+
const h = p.createSVGPoint();
|
|
2282
|
+
h.x = m.x, h.y = m.y;
|
|
2283
|
+
const w = p.getScreenCTM();
|
|
2284
|
+
if (!w) return;
|
|
2285
|
+
const O = h.matrixTransform(w), $ = u.value.style.chart.layout.nodeWidth, C = u.value.style.chart.layout.nodeHeight, se = w.a, ee = w.d, S = $ * se, D = C * ee;
|
|
2286
|
+
dt.value = {
|
|
2287
|
+
x: S / 2,
|
|
2288
|
+
y: D / 2
|
|
2289
|
+
}, ut.value = {
|
|
2290
|
+
x: O.x,
|
|
2291
|
+
y: O.y
|
|
2292
|
+
}, me.value = m, K.value = !0, await Gt(), jo();
|
|
2293
|
+
}
|
|
2294
|
+
function Mt() {
|
|
2295
|
+
K.value = !1, me.value = null;
|
|
2296
|
+
}
|
|
2297
|
+
function $t(m) {
|
|
2298
|
+
if (!K.value) return;
|
|
2299
|
+
const p = Ve.value;
|
|
2300
|
+
if (p && p.contains(m.target))
|
|
2301
|
+
return;
|
|
2302
|
+
const h = J.value;
|
|
2303
|
+
h && h.contains(m.target) && m.target.closest(".vue-ui-dag-node") || Mt();
|
|
2304
|
+
}
|
|
2305
|
+
function Dt(m) {
|
|
2306
|
+
m.key === "Escape" && K.value && Mt();
|
|
2307
|
+
}
|
|
2308
|
+
zt(() => {
|
|
2309
|
+
document.addEventListener("mousedown", $t), document.addEventListener("keydown", Dt);
|
|
2310
|
+
}), en(() => {
|
|
2311
|
+
document.removeEventListener("mousedown", $t), document.removeEventListener("keydown", Dt), R.value && (P.value && R.value.unobserve(P.value), R.value.disconnect());
|
|
2312
|
+
});
|
|
2313
|
+
function Ft() {
|
|
2314
|
+
if (!u.value.responsive) {
|
|
2315
|
+
R.value && (P.value && R.value.unobserve(P.value), R.value.disconnect(), R.value = null, P.value = null);
|
|
2316
|
+
return;
|
|
2317
|
+
}
|
|
2318
|
+
const m = fn(() => {
|
|
2319
|
+
if (!f.value) return;
|
|
2320
|
+
const { width: p, height: h } = hn({
|
|
2321
|
+
chart: f.value,
|
|
2322
|
+
title: u.value.style.chart.title.text ? b.value : null,
|
|
2323
|
+
legend: u.value.style.chart.controls.show ? _.value.$el : null,
|
|
2324
|
+
source: N.value
|
|
2325
|
+
});
|
|
2326
|
+
requestAnimationFrame(() => {
|
|
2327
|
+
I.value = Math.max(0.1, p), H.value = Math.max(0.1, h - 12);
|
|
2328
|
+
});
|
|
2329
|
+
});
|
|
2330
|
+
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();
|
|
2331
|
+
}
|
|
2332
|
+
async function Zo({ scale: m = 2 } = {}) {
|
|
2333
|
+
if (!f.value) return;
|
|
2334
|
+
const { width: p, height: h } = f.value.getBoundingClientRect(), w = p / h, { imageUri: O, base64: $ } = await xn({ domElement: f.value, base64: !0, img: !0, scale: m });
|
|
2335
|
+
return {
|
|
2336
|
+
imageUri: O,
|
|
2337
|
+
base64: $,
|
|
2338
|
+
title: u.value.style.chart.title.text ?? "vue-ui-dag",
|
|
2339
|
+
width: p,
|
|
2340
|
+
height: h,
|
|
2341
|
+
aspectRatio: w
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
2344
|
+
function Uo() {
|
|
2345
|
+
return E.value;
|
|
2346
|
+
}
|
|
2347
|
+
return t({
|
|
2348
|
+
getData: Uo,
|
|
2349
|
+
getImage: Zo,
|
|
2350
|
+
generatePdf: yt,
|
|
2351
|
+
generateSvg: Et,
|
|
2352
|
+
generateImage: kt,
|
|
2353
|
+
toggleAnnotator: We,
|
|
2354
|
+
toggleFullscreen: Tt,
|
|
2355
|
+
zoomIn: Ye,
|
|
2356
|
+
zoomOut: He,
|
|
2357
|
+
resetZoom: Te,
|
|
2358
|
+
switchDirection: Ue
|
|
2359
|
+
}), (m, p) => (k(), x("div", {
|
|
2360
|
+
class: st(`vue-data-ui-component vue-ui-dag ${Q.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${u.value.responsive ? "vue-ui-dag-responsive" : ""}`),
|
|
2361
|
+
id: `dag_${g.value}`,
|
|
2362
|
+
ref_key: "dagChart",
|
|
2363
|
+
ref: f,
|
|
2364
|
+
style: X({
|
|
2365
|
+
fontFamily: u.value.style.fontFamily,
|
|
2366
|
+
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2367
|
+
padding: "0.5rem"
|
|
2368
|
+
}),
|
|
2369
|
+
onMouseenter: To,
|
|
2370
|
+
onMouseleave: Mo
|
|
2371
|
+
}, [
|
|
2372
|
+
v(xt) ? (k(), x("div", Er, le(String(v(xt))), 1)) : L("", !0),
|
|
2373
|
+
u.value.userOptions.buttons.annotator ? (k(), U(v(n), {
|
|
2374
|
+
key: 1,
|
|
2375
|
+
svgRef: v(J),
|
|
2376
|
+
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2377
|
+
color: u.value.style.chart.color,
|
|
2378
|
+
active: ge.value,
|
|
2379
|
+
onClose: We
|
|
2380
|
+
}, {
|
|
2381
|
+
"annotator-action-close": T(() => [
|
|
2382
|
+
A(m.$slots, "annotator-action-close", {}, void 0, !0)
|
|
2383
|
+
]),
|
|
2384
|
+
"annotator-action-color": T(({ color: h }) => [
|
|
2385
|
+
A(m.$slots, "annotator-action-color", B(V({ color: h })), void 0, !0)
|
|
2386
|
+
]),
|
|
2387
|
+
"annotator-action-draw": T(({ mode: h }) => [
|
|
2388
|
+
A(m.$slots, "annotator-action-draw", B(V({ mode: h })), void 0, !0)
|
|
2389
|
+
]),
|
|
2390
|
+
"annotator-action-undo": T(({ disabled: h }) => [
|
|
2391
|
+
A(m.$slots, "annotator-action-undo", B(V({ disabled: h })), void 0, !0)
|
|
2392
|
+
]),
|
|
2393
|
+
"annotator-action-redo": T(({ disabled: h }) => [
|
|
2394
|
+
A(m.$slots, "annotator-action-redo", B(V({ disabled: h })), void 0, !0)
|
|
2395
|
+
]),
|
|
2396
|
+
"annotator-action-delete": T(({ disabled: h }) => [
|
|
2397
|
+
A(m.$slots, "annotator-action-delete", B(V({ disabled: h })), void 0, !0)
|
|
2398
|
+
]),
|
|
2399
|
+
_: 3
|
|
2400
|
+
}, 8, ["svgRef", "backgroundColor", "color", "active"])) : L("", !0),
|
|
2401
|
+
u.value.userOptions.show && oe.value && (v(mt) || v(Ge)) ? (k(), U(v(s), {
|
|
2402
|
+
ref: "userOptionsRef",
|
|
2403
|
+
key: `user_option_${Y.value}`,
|
|
2404
|
+
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2405
|
+
color: u.value.style.chart.color,
|
|
2406
|
+
isPrinting: v(pt),
|
|
2407
|
+
isImaging: v(wt),
|
|
2408
|
+
uid: g.value,
|
|
2409
|
+
hasTooltip: !1,
|
|
2410
|
+
hasTable: !1,
|
|
2411
|
+
hasXls: !1,
|
|
2412
|
+
hasLabel: !1,
|
|
2413
|
+
hasPdf: u.value.userOptions.buttons.pdf,
|
|
2414
|
+
hasImg: u.value.userOptions.buttons.img,
|
|
2415
|
+
hasSvg: u.value.userOptions.buttons.svg,
|
|
2416
|
+
hasFullscreen: u.value.userOptions.buttons.fullscreen,
|
|
2417
|
+
isFullscreen: Q.value,
|
|
2418
|
+
chartElement: f.value,
|
|
2419
|
+
position: u.value.userOptions.position,
|
|
2420
|
+
titles: { ...u.value.userOptions.buttonTitles },
|
|
2421
|
+
hasAnnotator: u.value.userOptions.buttons.annotator,
|
|
2422
|
+
isAnnotation: ge.value,
|
|
2423
|
+
callbacks: u.value.userOptions.callbacks,
|
|
2424
|
+
printScale: u.value.userOptions.print.scale,
|
|
2425
|
+
hasZoom: u.value.userOptions.buttons.zoom,
|
|
2426
|
+
isZoom: ne.value,
|
|
2427
|
+
onToggleFullscreen: Tt,
|
|
2428
|
+
onGeneratePdf: v(yt),
|
|
2429
|
+
onGenerateImage: v(kt),
|
|
2430
|
+
onGenerateSvg: Et,
|
|
2431
|
+
onToggleAnnotator: We,
|
|
2432
|
+
onToggleZoom: Vo,
|
|
2433
|
+
style: X({
|
|
2434
|
+
visibility: v(mt) ? v(Ge) ? "visible" : "hidden" : "visible"
|
|
2435
|
+
})
|
|
2436
|
+
}, tn({ _: 2 }, [
|
|
2437
|
+
m.$slots.menuIcon ? {
|
|
2438
|
+
name: "menuIcon",
|
|
2439
|
+
fn: T(({ isOpen: h, color: w }) => [
|
|
2440
|
+
A(m.$slots, "menuIcon", B(V({ isOpen: h, color: w })), void 0, !0)
|
|
2441
|
+
]),
|
|
2442
|
+
key: "0"
|
|
2443
|
+
} : void 0,
|
|
2444
|
+
m.$slots.optionPdf ? {
|
|
2445
|
+
name: "optionPdf",
|
|
2446
|
+
fn: T(() => [
|
|
2447
|
+
A(m.$slots, "optionPdf", {}, void 0, !0)
|
|
2448
|
+
]),
|
|
2449
|
+
key: "1"
|
|
2450
|
+
} : void 0,
|
|
2451
|
+
m.$slots.optionImg ? {
|
|
2452
|
+
name: "optionImg",
|
|
2453
|
+
fn: T(() => [
|
|
2454
|
+
A(m.$slots, "optionImg", {}, void 0, !0)
|
|
2455
|
+
]),
|
|
2456
|
+
key: "2"
|
|
2457
|
+
} : void 0,
|
|
2458
|
+
m.$slots.optionSvg ? {
|
|
2459
|
+
name: "optionSvg",
|
|
2460
|
+
fn: T(() => [
|
|
2461
|
+
A(m.$slots, "optionSvg", {}, void 0, !0)
|
|
2462
|
+
]),
|
|
2463
|
+
key: "3"
|
|
2464
|
+
} : void 0,
|
|
2465
|
+
m.$slots.optionFullscreen ? {
|
|
2466
|
+
name: "optionFullscreen",
|
|
2467
|
+
fn: T(({ toggleFullscreen: h, isFullscreen: w }) => [
|
|
2468
|
+
A(m.$slots, "optionFullscreen", B(V({ toggleFullscreen: h, isFullscreen: w })), void 0, !0)
|
|
2469
|
+
]),
|
|
2470
|
+
key: "4"
|
|
2471
|
+
} : void 0,
|
|
2472
|
+
m.$slots.optionAnnotator ? {
|
|
2473
|
+
name: "optionAnnotator",
|
|
2474
|
+
fn: T(({ toggleAnnotator: h, isAnnotator: w }) => [
|
|
2475
|
+
A(m.$slots, "optionAnnotator", B(V({ toggleAnnotator: h, isAnnotator: w })), void 0, !0)
|
|
2476
|
+
]),
|
|
2477
|
+
key: "5"
|
|
2478
|
+
} : void 0,
|
|
2479
|
+
m.$slots.optionZoom ? {
|
|
2480
|
+
name: "optionZoom",
|
|
2481
|
+
fn: T(({ toggleZoom: h, isZoomLocked: w }) => [
|
|
2482
|
+
A(m.$slots, "optionZoom", B(V({ toggleZoom: h, isZoomLocked: w })), void 0, !0)
|
|
2483
|
+
]),
|
|
2484
|
+
key: "6"
|
|
2485
|
+
} : void 0
|
|
2486
|
+
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasSvg", "hasFullscreen", "isFullscreen", "chartElement", "position", "titles", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "hasZoom", "isZoom", "onGeneratePdf", "onGenerateImage", "style"])) : L("", !0),
|
|
2487
|
+
u.value.style.chart.title.text ? (k(), x("div", {
|
|
2488
|
+
key: 3,
|
|
2489
|
+
ref_key: "chartTitle",
|
|
2490
|
+
ref: b,
|
|
2491
|
+
style: "width:100%;background:transparent;"
|
|
2492
|
+
}, [
|
|
2493
|
+
(k(), U(Cn, {
|
|
2494
|
+
key: `title_${M.value}`,
|
|
2495
|
+
config: {
|
|
2496
|
+
title: {
|
|
2497
|
+
cy: "dag-title",
|
|
2498
|
+
...u.value.style.chart.title
|
|
2499
|
+
},
|
|
2500
|
+
subtitle: {
|
|
2501
|
+
cy: "dag-subtitle",
|
|
2502
|
+
...u.value.style.chart.title.subtitle
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
}, null, 8, ["config"]))
|
|
2506
|
+
], 512)) : L("", !0),
|
|
2507
|
+
u.value.style.chart.controls.position === "top" && !v(ve) && u.value.style.chart.controls.show ? (k(), U(oo, {
|
|
2508
|
+
key: 4,
|
|
2509
|
+
ref_key: "zoomControls",
|
|
2510
|
+
ref: _,
|
|
2511
|
+
config: u.value,
|
|
2512
|
+
scale: v(Lt),
|
|
2513
|
+
isFullscreen: Q.value,
|
|
2514
|
+
withDirection: "",
|
|
2515
|
+
onZoomIn: Ye,
|
|
2516
|
+
onZoomOut: He,
|
|
2517
|
+
onResetZoom: p[0] || (p[0] = () => v(Te)(!0)),
|
|
2518
|
+
onSwitchDirection: Ue
|
|
2519
|
+
}, null, 8, ["config", "scale", "isFullscreen"])) : L("", !0),
|
|
2520
|
+
v(E) ? (k(), x("svg", {
|
|
2521
|
+
key: 5,
|
|
2522
|
+
ref_key: "svgRef",
|
|
2523
|
+
ref: J,
|
|
2524
|
+
class: st({ "vue-ui-dag-svg": !0, "vue-data-ui-loading": v(ve) }),
|
|
2525
|
+
viewBox: Io.value,
|
|
2526
|
+
xmlns: v(un),
|
|
2527
|
+
style: X({
|
|
2528
|
+
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2529
|
+
height: "100%",
|
|
2530
|
+
width: "100%"
|
|
2531
|
+
})
|
|
2532
|
+
}, [
|
|
2533
|
+
ae(v(r)),
|
|
2534
|
+
v(E).arrowShape !== "undirected" ? (k(), x("defs", xr, [
|
|
2535
|
+
(k(!0), x(ie, null, Fe(zo.value, (h) => (k(), x("marker", {
|
|
2536
|
+
key: h,
|
|
2537
|
+
id: Nt(h),
|
|
2538
|
+
markerWidth: v(E).arrowSize,
|
|
2539
|
+
markerHeight: v(E).arrowSize,
|
|
2540
|
+
refX: v(E).arrowSize - 1,
|
|
2541
|
+
refY: v(E).arrowSize / 2,
|
|
2542
|
+
orient: "auto",
|
|
2543
|
+
markerUnits: "strokeWidth"
|
|
2544
|
+
}, [
|
|
2545
|
+
v(E).arrowShape === "normal" ? (k(), x("path", {
|
|
2546
|
+
key: 0,
|
|
2547
|
+
d: `M 0 0 L ${v(E).arrowSize} ${v(E).arrowSize / 2} L 0 ${v(E).arrowSize} Z`,
|
|
2548
|
+
fill: h,
|
|
2549
|
+
stroke: h,
|
|
2550
|
+
"stroke-width": "0"
|
|
2551
|
+
}, null, 8, Nr)) : (k(), x("path", {
|
|
2552
|
+
key: 1,
|
|
2553
|
+
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`,
|
|
2554
|
+
fill: h,
|
|
2555
|
+
stroke: h,
|
|
2556
|
+
"stroke-width": "0"
|
|
2557
|
+
}, null, 8, Ar))
|
|
2558
|
+
], 8, _r))), 128))
|
|
2559
|
+
])) : L("", !0),
|
|
2560
|
+
G("g", Sr, [
|
|
2561
|
+
(k(!0), x(ie, null, Fe(v(E).edges, (h) => (k(), x(ie, {
|
|
2562
|
+
key: h.id
|
|
2563
|
+
}, [
|
|
2564
|
+
G("path", {
|
|
2565
|
+
"data-cy-edge": "",
|
|
2566
|
+
d: h.pathData,
|
|
2567
|
+
fill: "none",
|
|
2568
|
+
stroke: h.original.color ?? u.value.style.chart.edges.stroke,
|
|
2569
|
+
"stroke-width": u.value.style.chart.edges.strokeWidth * (h.from === be.value || h.id === z.value?.id ? 2 : 1),
|
|
2570
|
+
"stroke-linecap": "round",
|
|
2571
|
+
"stroke-linejoin": "round",
|
|
2572
|
+
style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out" }
|
|
2573
|
+
}, null, 8, Lr),
|
|
2574
|
+
u.value.style.chart.midpoints.show ? (k(), x("circle", {
|
|
2575
|
+
key: 0,
|
|
2576
|
+
"data-cy-midpoint": "",
|
|
2577
|
+
class: "vue-ui-dag-edge-midpoint",
|
|
2578
|
+
cx: h.midpoint.x,
|
|
2579
|
+
cy: h.midpoint.y,
|
|
2580
|
+
r: u.value.style.chart.midpoints.radius,
|
|
2581
|
+
fill: u.value.style.chart.midpoints.fill,
|
|
2582
|
+
stroke: h.original.color ?? u.value.style.chart.midpoints.stroke,
|
|
2583
|
+
"stroke-width": u.value.style.chart.midpoints.strokeWidth * (h.from === be.value || h.id === z.value?.id ? 2 : 1),
|
|
2584
|
+
style: { transition: "stroke-width 0.2s ease-in-out" },
|
|
2585
|
+
onMouseenter: (w) => Wo(h),
|
|
2586
|
+
onMouseleave: Yo
|
|
2587
|
+
}, null, 40, Or)) : L("", !0)
|
|
2588
|
+
], 64))), 128))
|
|
2589
|
+
]),
|
|
2590
|
+
G("g", Rr, [
|
|
2591
|
+
(k(!0), x(ie, null, Fe(v(E).nodes, (h) => (k(), x("g", {
|
|
2592
|
+
key: h.id,
|
|
2593
|
+
class: "vue-ui-dag-node",
|
|
2594
|
+
onClick: on((w) => u.value.style.chart.nodes.tooltip.showOnClick && Ho(h), ["stop"]),
|
|
2595
|
+
onMouseenter: (w) => be.value = h.id,
|
|
2596
|
+
onMouseleave: p[1] || (p[1] = (w) => be.value = null)
|
|
2597
|
+
}, [
|
|
2598
|
+
m.$slots.node ? L("", !0) : (k(), x(ie, { key: 0 }, [
|
|
2599
|
+
G("rect", {
|
|
2600
|
+
"data-cy-node": "",
|
|
2601
|
+
x: h.x - h.width / 2,
|
|
2602
|
+
y: h.y - h.height / 2,
|
|
2603
|
+
width: h.width,
|
|
2604
|
+
height: h.height,
|
|
2605
|
+
rx: u.value.style.chart.nodes.borderRadius,
|
|
2606
|
+
fill: h.original.backgroundColor,
|
|
2607
|
+
stroke: u.value.style.chart.nodes.stroke,
|
|
2608
|
+
"stroke-width": u.value.style.chart.nodes.strokeWidth,
|
|
2609
|
+
style: X({
|
|
2610
|
+
cursor: u.value.style.chart.nodes.tooltip.showOnClick ? "pointer" : "default"
|
|
2611
|
+
})
|
|
2612
|
+
}, null, 12, Mr),
|
|
2613
|
+
m.$slots["node-label"] ? (k(), x("text", {
|
|
2614
|
+
key: 0,
|
|
2615
|
+
x: h.x,
|
|
2616
|
+
y: h.y + u.value.style.chart.nodes.labels.fontSize / 3,
|
|
2617
|
+
"text-anchor": "middle",
|
|
2618
|
+
"font-size": u.value.style.chart.nodes.labels.fontSize,
|
|
2619
|
+
fill: h.original.color,
|
|
2620
|
+
"font-weight": u.value.style.chart.nodes.labels.bold ? "bold" : "normal"
|
|
2621
|
+
}, [
|
|
2622
|
+
A(m.$slots, "node-label", Bt({ ref_for: !0 }, { node: h }), () => [
|
|
2623
|
+
nn(le(h.label), 1)
|
|
2624
|
+
], !0)
|
|
2625
|
+
], 8, $r)) : (k(), x("text", {
|
|
2626
|
+
key: 1,
|
|
2627
|
+
"data-cy-node-label": "",
|
|
2628
|
+
x: h.x,
|
|
2629
|
+
y: h.y + u.value.style.chart.nodes.labels.fontSize / 3,
|
|
2630
|
+
"text-anchor": "middle",
|
|
2631
|
+
"font-size": u.value.style.chart.nodes.labels.fontSize,
|
|
2632
|
+
fill: h.original.color,
|
|
2633
|
+
"font-weight": u.value.style.chart.nodes.labels.bold ? "bold" : "normal",
|
|
2634
|
+
innerHTML: v(dn)({
|
|
2635
|
+
content: h.label,
|
|
2636
|
+
fontSize: u.value.style.chart.nodes.labels.fontSize,
|
|
2637
|
+
fontWeight: u.value.style.chart.nodes.labels.bold ? "bold" : "normal",
|
|
2638
|
+
fill: h.original.color,
|
|
2639
|
+
x: h.x,
|
|
2640
|
+
y: h.y,
|
|
2641
|
+
autoOffset: !0
|
|
2642
|
+
})
|
|
2643
|
+
}, null, 8, Dr))
|
|
2644
|
+
], 64)),
|
|
2645
|
+
m.$slots.node ? (k(), x("foreignObject", {
|
|
2646
|
+
key: 1,
|
|
2647
|
+
x: h.x - h.width / 2,
|
|
2648
|
+
y: h.y - h.height / 2,
|
|
2649
|
+
width: h.width,
|
|
2650
|
+
height: h.height
|
|
2651
|
+
}, [
|
|
2652
|
+
A(m.$slots, "node", Bt({ ref_for: !0 }, { node: h }), void 0, !0)
|
|
2653
|
+
], 8, Fr)) : L("", !0)
|
|
2654
|
+
], 40, Tr))), 128))
|
|
2655
|
+
]),
|
|
2656
|
+
G("g", Pr, [
|
|
2657
|
+
(k(!0), x(ie, null, Fe(v(E).edges, (h) => (k(), x("path", {
|
|
2658
|
+
key: h.id,
|
|
2659
|
+
d: h.pathData,
|
|
2660
|
+
fill: "none",
|
|
2661
|
+
stroke: "transparent",
|
|
2662
|
+
"stroke-width": u.value.style.chart.edges.strokeWidth * (h.from === be.value || h.id === z.value?.id ? 1.3 : 1),
|
|
2663
|
+
"stroke-linecap": "round",
|
|
2664
|
+
"stroke-linejoin": "round",
|
|
2665
|
+
"marker-end": v(E).arrowShape === "undirected" ? null : `url(#${Nt(h.original?.color || u.value.style.chart.edges.stroke)})`,
|
|
2666
|
+
style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out" }
|
|
2667
|
+
}, null, 8, zr))), 128))
|
|
2668
|
+
]),
|
|
2669
|
+
A(m.$slots, "svg", {
|
|
2670
|
+
svg: {
|
|
2671
|
+
drawingArea: v(St),
|
|
2672
|
+
data: v(E)
|
|
2673
|
+
}
|
|
2674
|
+
}, void 0, !0)
|
|
2675
|
+
], 14, Cr)) : L("", !0),
|
|
2676
|
+
m.$slots.watermark ? (k(), x("div", Br, [
|
|
2677
|
+
A(m.$slots, "watermark", B(V({ isPrinting: v(pt) || v(wt) })), void 0, !0)
|
|
2678
|
+
])) : L("", !0),
|
|
2679
|
+
ae(Vt, { name: "fade" }, {
|
|
2680
|
+
default: T(() => [
|
|
2681
|
+
Oe.value ? (k(), U(It, {
|
|
2682
|
+
key: 0,
|
|
2683
|
+
to: Q.value ? f.value : "body"
|
|
2684
|
+
}, [
|
|
2685
|
+
G("div", {
|
|
2686
|
+
"data-cy-tooltip-midpoint": "",
|
|
2687
|
+
ref_key: "tooltipRef",
|
|
2688
|
+
ref: Se,
|
|
2689
|
+
class: "vue-ui-dag-tooltip",
|
|
2690
|
+
style: X({
|
|
2691
|
+
...Le.value,
|
|
2692
|
+
maxWidth: u.value.style.chart.midpoints.tooltip.maxWidth,
|
|
2693
|
+
"--vue-data-ui-dag-tooltip-background": u.value.style.chart.midpoints.tooltip.backgroundColor,
|
|
2694
|
+
"--vue-data-ui-dag-tooltip-color": u.value.style.chart.midpoints.tooltip.color
|
|
2695
|
+
}),
|
|
2696
|
+
"data-position": he.value
|
|
2697
|
+
}, [
|
|
2698
|
+
A(m.$slots, "tooltip-midpoint", B(V({ edge: z.value, layoutData: v(E) })), () => [
|
|
2699
|
+
z.value ? (k(), x("div", Ir, le(_t(z.value.from)?.label ?? z.value.from) + " → " + le(_t(z.value.to)?.label ?? z.value.to), 1)) : L("", !0)
|
|
2700
|
+
], !0)
|
|
2701
|
+
], 12, Vr)
|
|
2702
|
+
], 8, ["to"])) : L("", !0)
|
|
2703
|
+
]),
|
|
2704
|
+
_: 3
|
|
2705
|
+
}),
|
|
2706
|
+
ae(Vt, { name: "fade" }, {
|
|
2707
|
+
default: T(() => [
|
|
2708
|
+
K.value ? (k(), U(It, {
|
|
2709
|
+
key: 0,
|
|
2710
|
+
to: Q.value ? f.value : "body"
|
|
2711
|
+
}, [
|
|
2712
|
+
G("div", {
|
|
2713
|
+
"data-cy-tooltip-node": "",
|
|
2714
|
+
ref_key: "nodeTooltipRef",
|
|
2715
|
+
ref: Ve,
|
|
2716
|
+
class: "vue-ui-dag-node-tooltip",
|
|
2717
|
+
style: X({
|
|
2718
|
+
maxWidth: u.value.style.chart.nodes.tooltip.maxWidth,
|
|
2719
|
+
left: Ie.value.left,
|
|
2720
|
+
top: Ie.value.top,
|
|
2721
|
+
"--vue-data-ui-dag-node-tooltip-background": u.value.style.chart.nodes.tooltip.backgroundColor,
|
|
2722
|
+
"--vue-data-ui-dag-node-tooltip-color": u.value.style.chart.nodes.tooltip.color
|
|
2723
|
+
}),
|
|
2724
|
+
"data-position": ft.value
|
|
2725
|
+
}, [
|
|
2726
|
+
A(m.$slots, "tooltip-node", B(V({ node: me.value, layoutData: v(E) })), () => [
|
|
2727
|
+
me.value ? (k(), x("div", jr, le(me.value.label), 1)) : L("", !0)
|
|
2728
|
+
], !0)
|
|
2729
|
+
], 12, Gr)
|
|
2730
|
+
], 8, ["to"])) : L("", !0)
|
|
2731
|
+
]),
|
|
2732
|
+
_: 3
|
|
2733
|
+
}),
|
|
2734
|
+
u.value.style.chart.controls.position === "bottom" && !v(ve) && u.value.style.chart.controls.show ? (k(), U(oo, {
|
|
2735
|
+
key: 7,
|
|
2736
|
+
ref_key: "zoomControls",
|
|
2737
|
+
ref: _,
|
|
2738
|
+
config: u.value,
|
|
2739
|
+
scale: v(Lt),
|
|
2740
|
+
isFullscreen: Q.value,
|
|
2741
|
+
withDirection: "",
|
|
2742
|
+
onZoomIn: Ye,
|
|
2743
|
+
onZoomOut: He,
|
|
2744
|
+
onResetZoom: p[2] || (p[2] = () => v(Te)(!0)),
|
|
2745
|
+
onSwitchDirection: Ue
|
|
2746
|
+
}, null, 8, ["config", "scale", "isFullscreen"])) : L("", !0),
|
|
2747
|
+
m.$slots.source ? (k(), x("div", {
|
|
2748
|
+
key: 8,
|
|
2749
|
+
ref_key: "source",
|
|
2750
|
+
ref: N,
|
|
2751
|
+
dir: "auto"
|
|
2752
|
+
}, [
|
|
2753
|
+
A(m.$slots, "source", {}, void 0, !0)
|
|
2754
|
+
], 512)) : L("", !0),
|
|
2755
|
+
v(ve) ? (k(), U(bn, { key: 9 })) : L("", !0)
|
|
2756
|
+
], 46, kr));
|
|
2757
|
+
}
|
|
2758
|
+
}, Yr = /* @__PURE__ */ ro(Wr, [["__scopeId", "data-v-224df313"]]), fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2759
|
+
__proto__: null,
|
|
2760
|
+
default: Yr
|
|
2761
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2762
|
+
export {
|
|
2763
|
+
ai as a,
|
|
2764
|
+
fi as b,
|
|
2765
|
+
ci as d,
|
|
2766
|
+
wr as l,
|
|
2767
|
+
di as m,
|
|
2768
|
+
ui as s,
|
|
2769
|
+
Yr as v
|
|
2770
|
+
};
|