@notmrabhi/flowforge 0.1.5 → 0.1.6
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/dist/GatewayBranchEdge-C-gffuVA.js +1 -0
- package/dist/GatewayBranchEdge-DHqcdxpD.js +1176 -0
- package/dist/SchemaBuilderDrawer-BAOGl8dt.js +3682 -0
- package/dist/SchemaBuilderDrawer-CP-Lqo0S.js +4 -0
- package/dist/canvas.cjs +1 -1
- package/dist/canvas.js +2 -2
- package/dist/defaultUi.cjs +1 -1
- package/dist/defaultUi.js +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.js +39 -38
- package/dist/{index-uTiQ7O15.js → index-9Ahm5dnn.js} +1 -1
- package/dist/{index-C2VIw_j3.js → index-CiAhn6cP.js} +1 -1
- package/dist/index-D6g2IXSf.js +7611 -0
- package/dist/index-ucLEoH8L.js +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +85 -84
- package/dist/templateSkeletons-BLzZ5u00.js +1 -0
- package/dist/templateSkeletons-Ce90PFaV.js +2799 -0
- package/package.json +1 -1
- package/dist/GatewayBranchEdge-C-AVfqfT.js +0 -1
- package/dist/GatewayBranchEdge-gncIBR-0.js +0 -854
- package/dist/SchemaBuilderDrawer-B5oBHKmV.js +0 -3235
- package/dist/SchemaBuilderDrawer-DM3EucIa.js +0 -4
- package/dist/index-BbxqTJq-.js +0 -6
- package/dist/index-C9g7owAq.js +0 -7318
- package/dist/templateSkeletons-BGvu7nnP.js +0 -2617
- package/dist/templateSkeletons-Ccxv9TAx.js +0 -1
|
@@ -1,2617 +0,0 @@
|
|
|
1
|
-
import c, { useRef as ht, useEffect as re, useState as M, useMemo as P, useCallback as G } from "react";
|
|
2
|
-
import kn, { useStore as xn, useReactFlow as _n, Background as Tn, Controls as Nn, MiniMap as Cn } from "reactflow";
|
|
3
|
-
import "reactflow/dist/style.css";
|
|
4
|
-
import { e as Sn, G as In, E as On, P as Mn, L as jn, d as Fn, f as zn } from "./GatewayBranchEdge-gncIBR-0.js";
|
|
5
|
-
import { Dialog as Rn, Box as Q, Drawer as Dn, Typography as Ln, IconButton as gt, Button as pt } from "@mui/material";
|
|
6
|
-
import { MdClose as An, MdCalendarToday as Pn, MdBolt as Bn, MdAddCircleOutline as Wn, MdApps as Gn, MdArrowBack as $n, MdChevronRight as Rt, MdAccountTree as Yn, MdErrorOutline as Kn, MdAdd as Un, MdSearch as Vn, MdCategory as Hn, MdCancel as Dt, MdError as Lt, MdCheckCircle as At, MdPlayArrow as Pt, MdHourglassEmpty as qn, MdSchedule as mt, MdPerson as Xn, MdExpandLess as Jn, MdExpandMore as Zn } from "react-icons/md";
|
|
7
|
-
import { GrTrigger as Qn } from "react-icons/gr";
|
|
8
|
-
import { BiCollapse as er, BiExpand as tr } from "react-icons/bi";
|
|
9
|
-
import { a as nr } from "./index-C9g7owAq.js";
|
|
10
|
-
import { m as rr } from "./messages-CO299wPN.js";
|
|
11
|
-
import { T as or, E as V } from "./canvasTokens-CAD6G24b.js";
|
|
12
|
-
var Bt = Object.defineProperty, ir = (e, t, n) => t in e ? Bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, ar = (e, t) => {
|
|
13
|
-
for (var n in t) Bt(e, n, { get: t[n], enumerable: !0 });
|
|
14
|
-
}, lr = (e, t, n) => ir(e, t + "", n), Wt = {};
|
|
15
|
-
ar(Wt, { Graph: () => B, alg: () => Ke, json: () => $t, version: () => cr });
|
|
16
|
-
var sr = Object.defineProperty, Gt = (e, t) => {
|
|
17
|
-
for (var n in t) sr(e, n, { get: t[n], enumerable: !0 });
|
|
18
|
-
}, B = class {
|
|
19
|
-
constructor(e) {
|
|
20
|
-
this._isDirected = !0, this._isMultigraph = !1, this._isCompound = !1, this._nodes = {}, this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {}, this._nodeCount = 0, this._edgeCount = 0, this._defaultNodeLabelFn = () => {
|
|
21
|
-
}, this._defaultEdgeLabelFn = () => {
|
|
22
|
-
}, e && (this._isDirected = "directed" in e ? e.directed : !0, this._isMultigraph = "multigraph" in e ? e.multigraph : !1, this._isCompound = "compound" in e ? e.compound : !1), this._isCompound && (this._parent = {}, this._children = {}, this._children["\0"] = {});
|
|
23
|
-
}
|
|
24
|
-
isDirected() {
|
|
25
|
-
return this._isDirected;
|
|
26
|
-
}
|
|
27
|
-
isMultigraph() {
|
|
28
|
-
return this._isMultigraph;
|
|
29
|
-
}
|
|
30
|
-
isCompound() {
|
|
31
|
-
return this._isCompound;
|
|
32
|
-
}
|
|
33
|
-
setGraph(e) {
|
|
34
|
-
return this._label = e, this;
|
|
35
|
-
}
|
|
36
|
-
graph() {
|
|
37
|
-
return this._label;
|
|
38
|
-
}
|
|
39
|
-
setDefaultNodeLabel(e) {
|
|
40
|
-
return typeof e != "function" ? this._defaultNodeLabelFn = () => e : this._defaultNodeLabelFn = e, this;
|
|
41
|
-
}
|
|
42
|
-
nodeCount() {
|
|
43
|
-
return this._nodeCount;
|
|
44
|
-
}
|
|
45
|
-
nodes() {
|
|
46
|
-
return Object.keys(this._nodes);
|
|
47
|
-
}
|
|
48
|
-
sources() {
|
|
49
|
-
return this.nodes().filter((e) => Object.keys(this._in[e]).length === 0);
|
|
50
|
-
}
|
|
51
|
-
sinks() {
|
|
52
|
-
return this.nodes().filter((e) => Object.keys(this._out[e]).length === 0);
|
|
53
|
-
}
|
|
54
|
-
setNodes(e, t) {
|
|
55
|
-
return e.forEach((n) => {
|
|
56
|
-
t !== void 0 ? this.setNode(n, t) : this.setNode(n);
|
|
57
|
-
}), this;
|
|
58
|
-
}
|
|
59
|
-
setNode(e, t) {
|
|
60
|
-
return e in this._nodes ? (arguments.length > 1 && (this._nodes[e] = t), this) : (this._nodes[e] = arguments.length > 1 ? t : this._defaultNodeLabelFn(e), this._isCompound && (this._parent[e] = "\0", this._children[e] = {}, this._children["\0"][e] = !0), this._in[e] = {}, this._preds[e] = {}, this._out[e] = {}, this._sucs[e] = {}, ++this._nodeCount, this);
|
|
61
|
-
}
|
|
62
|
-
node(e) {
|
|
63
|
-
return this._nodes[e];
|
|
64
|
-
}
|
|
65
|
-
hasNode(e) {
|
|
66
|
-
return e in this._nodes;
|
|
67
|
-
}
|
|
68
|
-
removeNode(e) {
|
|
69
|
-
if (e in this._nodes) {
|
|
70
|
-
let t = (n) => this.removeEdge(this._edgeObjs[n]);
|
|
71
|
-
delete this._nodes[e], this._isCompound && (this._removeFromParentsChildList(e), delete this._parent[e], this.children(e).forEach((n) => {
|
|
72
|
-
this.setParent(n);
|
|
73
|
-
}), delete this._children[e]), Object.keys(this._in[e]).forEach(t), delete this._in[e], delete this._preds[e], Object.keys(this._out[e]).forEach(t), delete this._out[e], delete this._sucs[e], --this._nodeCount;
|
|
74
|
-
}
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
setParent(e, t) {
|
|
78
|
-
if (!this._isCompound) throw new Error("Cannot set parent in a non-compound graph");
|
|
79
|
-
if (t === void 0) t = "\0";
|
|
80
|
-
else {
|
|
81
|
-
t += "";
|
|
82
|
-
for (let n = t; n !== void 0; n = this.parent(n)) if (n === e) throw new Error("Setting " + t + " as parent of " + e + " would create a cycle");
|
|
83
|
-
this.setNode(t);
|
|
84
|
-
}
|
|
85
|
-
return this.setNode(e), this._removeFromParentsChildList(e), this._parent[e] = t, this._children[t][e] = !0, this;
|
|
86
|
-
}
|
|
87
|
-
parent(e) {
|
|
88
|
-
if (this._isCompound) {
|
|
89
|
-
let t = this._parent[e];
|
|
90
|
-
if (t !== "\0") return t;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
children(e = "\0") {
|
|
94
|
-
if (this._isCompound) {
|
|
95
|
-
let t = this._children[e];
|
|
96
|
-
if (t) return Object.keys(t);
|
|
97
|
-
} else {
|
|
98
|
-
if (e === "\0") return this.nodes();
|
|
99
|
-
if (this.hasNode(e)) return [];
|
|
100
|
-
}
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
predecessors(e) {
|
|
104
|
-
let t = this._preds[e];
|
|
105
|
-
if (t) return Object.keys(t);
|
|
106
|
-
}
|
|
107
|
-
successors(e) {
|
|
108
|
-
let t = this._sucs[e];
|
|
109
|
-
if (t) return Object.keys(t);
|
|
110
|
-
}
|
|
111
|
-
neighbors(e) {
|
|
112
|
-
let t = this.predecessors(e);
|
|
113
|
-
if (t) {
|
|
114
|
-
let n = new Set(t);
|
|
115
|
-
for (let r of this.successors(e)) n.add(r);
|
|
116
|
-
return Array.from(n.values());
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
isLeaf(e) {
|
|
120
|
-
let t;
|
|
121
|
-
return this.isDirected() ? t = this.successors(e) : t = this.neighbors(e), t.length === 0;
|
|
122
|
-
}
|
|
123
|
-
filterNodes(e) {
|
|
124
|
-
let t = new this.constructor({ directed: this._isDirected, multigraph: this._isMultigraph, compound: this._isCompound });
|
|
125
|
-
t.setGraph(this.graph()), Object.entries(this._nodes).forEach(([o, i]) => {
|
|
126
|
-
e(o) && t.setNode(o, i);
|
|
127
|
-
}), Object.values(this._edgeObjs).forEach((o) => {
|
|
128
|
-
t.hasNode(o.v) && t.hasNode(o.w) && t.setEdge(o, this.edge(o));
|
|
129
|
-
});
|
|
130
|
-
let n = {}, r = (o) => {
|
|
131
|
-
let i = this.parent(o);
|
|
132
|
-
return !i || t.hasNode(i) ? (n[o] = i ?? void 0, i ?? void 0) : i in n ? n[i] : r(i);
|
|
133
|
-
};
|
|
134
|
-
return this._isCompound && t.nodes().forEach((o) => t.setParent(o, r(o))), t;
|
|
135
|
-
}
|
|
136
|
-
setDefaultEdgeLabel(e) {
|
|
137
|
-
return typeof e != "function" ? this._defaultEdgeLabelFn = () => e : this._defaultEdgeLabelFn = e, this;
|
|
138
|
-
}
|
|
139
|
-
edgeCount() {
|
|
140
|
-
return this._edgeCount;
|
|
141
|
-
}
|
|
142
|
-
edges() {
|
|
143
|
-
return Object.values(this._edgeObjs);
|
|
144
|
-
}
|
|
145
|
-
setPath(e, t) {
|
|
146
|
-
return e.reduce((n, r) => (t !== void 0 ? this.setEdge(n, r, t) : this.setEdge(n, r), r)), this;
|
|
147
|
-
}
|
|
148
|
-
setEdge(e, t, n, r) {
|
|
149
|
-
let o, i, a, l, d = !1;
|
|
150
|
-
typeof e == "object" && e !== null && "v" in e ? (o = e.v, i = e.w, a = e.name, arguments.length === 2 && (l = t, d = !0)) : (o = e, i = t, a = r, arguments.length > 2 && (l = n, d = !0)), o = "" + o, i = "" + i, a !== void 0 && (a = "" + a);
|
|
151
|
-
let s = fe(this._isDirected, o, i, a);
|
|
152
|
-
if (s in this._edgeLabels) return d && (this._edgeLabels[s] = l), this;
|
|
153
|
-
if (a !== void 0 && !this._isMultigraph) throw new Error("Cannot set a named edge when isMultigraph = false");
|
|
154
|
-
this.setNode(o), this.setNode(i), this._edgeLabels[s] = d ? l : this._defaultEdgeLabelFn(o, i, a);
|
|
155
|
-
let u = dr(this._isDirected, o, i, a);
|
|
156
|
-
return o = u.v, i = u.w, Object.freeze(u), this._edgeObjs[s] = u, bt(this._preds[i], o), bt(this._sucs[o], i), this._in[i][s] = u, this._out[o][s] = u, this._edgeCount++, this;
|
|
157
|
-
}
|
|
158
|
-
edge(e, t, n) {
|
|
159
|
-
let r = arguments.length === 1 ? Me(this._isDirected, e) : fe(this._isDirected, e, t, n);
|
|
160
|
-
return this._edgeLabels[r];
|
|
161
|
-
}
|
|
162
|
-
edgeAsObj(e, t, n) {
|
|
163
|
-
let r = arguments.length === 1 ? this.edge(e) : this.edge(e, t, n);
|
|
164
|
-
return typeof r != "object" ? { label: r } : r;
|
|
165
|
-
}
|
|
166
|
-
hasEdge(e, t, n) {
|
|
167
|
-
return (arguments.length === 1 ? Me(this._isDirected, e) : fe(this._isDirected, e, t, n)) in this._edgeLabels;
|
|
168
|
-
}
|
|
169
|
-
removeEdge(e, t, n) {
|
|
170
|
-
let r = arguments.length === 1 ? Me(this._isDirected, e) : fe(this._isDirected, e, t, n), o = this._edgeObjs[r];
|
|
171
|
-
if (o) {
|
|
172
|
-
let i = o.v, a = o.w;
|
|
173
|
-
delete this._edgeLabels[r], delete this._edgeObjs[r], yt(this._preds[a], i), yt(this._sucs[i], a), delete this._in[a][r], delete this._out[i][r], this._edgeCount--;
|
|
174
|
-
}
|
|
175
|
-
return this;
|
|
176
|
-
}
|
|
177
|
-
inEdges(e, t) {
|
|
178
|
-
return this.isDirected() ? this.filterEdges(this._in[e], e, t) : this.nodeEdges(e, t);
|
|
179
|
-
}
|
|
180
|
-
outEdges(e, t) {
|
|
181
|
-
return this.isDirected() ? this.filterEdges(this._out[e], e, t) : this.nodeEdges(e, t);
|
|
182
|
-
}
|
|
183
|
-
nodeEdges(e, t) {
|
|
184
|
-
if (e in this._nodes) return this.filterEdges({ ...this._in[e], ...this._out[e] }, e, t);
|
|
185
|
-
}
|
|
186
|
-
_removeFromParentsChildList(e) {
|
|
187
|
-
delete this._children[this._parent[e]][e];
|
|
188
|
-
}
|
|
189
|
-
filterEdges(e, t, n) {
|
|
190
|
-
if (!e) return;
|
|
191
|
-
let r = Object.values(e);
|
|
192
|
-
return n ? r.filter((o) => o.v === t && o.w === n || o.v === n && o.w === t) : r;
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
function bt(e, t) {
|
|
196
|
-
e[t] ? e[t]++ : e[t] = 1;
|
|
197
|
-
}
|
|
198
|
-
function yt(e, t) {
|
|
199
|
-
e[t] !== void 0 && !--e[t] && delete e[t];
|
|
200
|
-
}
|
|
201
|
-
function fe(e, t, n, r) {
|
|
202
|
-
let o = "" + t, i = "" + n;
|
|
203
|
-
if (!e && o > i) {
|
|
204
|
-
let a = o;
|
|
205
|
-
o = i, i = a;
|
|
206
|
-
}
|
|
207
|
-
return o + "" + i + "" + (r === void 0 ? "\0" : r);
|
|
208
|
-
}
|
|
209
|
-
function dr(e, t, n, r) {
|
|
210
|
-
let o = "" + t, i = "" + n;
|
|
211
|
-
if (!e && o > i) {
|
|
212
|
-
let l = o;
|
|
213
|
-
o = i, i = l;
|
|
214
|
-
}
|
|
215
|
-
let a = { v: o, w: i };
|
|
216
|
-
return r && (a.name = r), a;
|
|
217
|
-
}
|
|
218
|
-
function Me(e, t) {
|
|
219
|
-
return fe(e, t.v, t.w, t.name);
|
|
220
|
-
}
|
|
221
|
-
var cr = "4.0.1", $t = {};
|
|
222
|
-
Gt($t, { read: () => gr, write: () => ur });
|
|
223
|
-
function ur(e) {
|
|
224
|
-
let t = { options: { directed: e.isDirected(), multigraph: e.isMultigraph(), compound: e.isCompound() }, nodes: fr(e), edges: hr(e) }, n = e.graph();
|
|
225
|
-
return n !== void 0 && (t.value = structuredClone(n)), t;
|
|
226
|
-
}
|
|
227
|
-
function fr(e) {
|
|
228
|
-
return e.nodes().map((t) => {
|
|
229
|
-
let n = e.node(t), r = e.parent(t), o = { v: t };
|
|
230
|
-
return n !== void 0 && (o.value = n), r !== void 0 && (o.parent = r), o;
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
function hr(e) {
|
|
234
|
-
return e.edges().map((t) => {
|
|
235
|
-
let n = e.edge(t), r = { v: t.v, w: t.w };
|
|
236
|
-
return t.name !== void 0 && (r.name = t.name), n !== void 0 && (r.value = n), r;
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
function gr(e) {
|
|
240
|
-
let t = new B(e.options);
|
|
241
|
-
return e.value !== void 0 && t.setGraph(e.value), e.nodes.forEach((n) => {
|
|
242
|
-
t.setNode(n.v, n.value), n.parent && t.setParent(n.v, n.parent);
|
|
243
|
-
}), e.edges.forEach((n) => {
|
|
244
|
-
t.setEdge({ v: n.v, w: n.w, name: n.name }, n.value);
|
|
245
|
-
}), t;
|
|
246
|
-
}
|
|
247
|
-
var Ke = {};
|
|
248
|
-
Gt(Ke, { CycleException: () => ke, bellmanFord: () => Yt, components: () => br, dijkstra: () => ve, dijkstraAll: () => wr, findCycles: () => vr, floydWarshall: () => xr, isAcyclic: () => Tr, postorder: () => Cr, preorder: () => Sr, prim: () => Ir, shortestPaths: () => Or, tarjan: () => Ut, topsort: () => Vt });
|
|
249
|
-
var pr = () => 1;
|
|
250
|
-
function Yt(e, t, n, r) {
|
|
251
|
-
return mr(e, String(t), n || pr, r || function(o) {
|
|
252
|
-
return e.outEdges(o);
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
function mr(e, t, n, r) {
|
|
256
|
-
let o = {}, i, a = 0, l = e.nodes(), d = function(f) {
|
|
257
|
-
let h = n(f);
|
|
258
|
-
o[f.v].distance + h < o[f.w].distance && (o[f.w] = { distance: o[f.v].distance + h, predecessor: f.v }, i = !0);
|
|
259
|
-
}, s = function() {
|
|
260
|
-
l.forEach(function(f) {
|
|
261
|
-
r(f).forEach(function(h) {
|
|
262
|
-
let g = h.v === f ? h.v : h.w, m = g === h.v ? h.w : h.v;
|
|
263
|
-
d({ v: g, w: m });
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
};
|
|
267
|
-
l.forEach(function(f) {
|
|
268
|
-
let h = f === t ? 0 : Number.POSITIVE_INFINITY;
|
|
269
|
-
o[f] = { distance: h, predecessor: "" };
|
|
270
|
-
});
|
|
271
|
-
let u = l.length;
|
|
272
|
-
for (let f = 1; f < u && (i = !1, a++, s(), !!i); f++) ;
|
|
273
|
-
if (a === u - 1 && (i = !1, s(), i)) throw new Error("The graph contains a negative weight cycle");
|
|
274
|
-
return o;
|
|
275
|
-
}
|
|
276
|
-
function br(e) {
|
|
277
|
-
let t = {}, n = [], r;
|
|
278
|
-
function o(i) {
|
|
279
|
-
i in t || (t[i] = !0, r.push(i), e.successors(i).forEach(o), e.predecessors(i).forEach(o));
|
|
280
|
-
}
|
|
281
|
-
return e.nodes().forEach(function(i) {
|
|
282
|
-
r = [], o(i), r.length && n.push(r);
|
|
283
|
-
}), n;
|
|
284
|
-
}
|
|
285
|
-
var Kt = class {
|
|
286
|
-
constructor() {
|
|
287
|
-
this._arr = [], this._keyIndices = {};
|
|
288
|
-
}
|
|
289
|
-
size() {
|
|
290
|
-
return this._arr.length;
|
|
291
|
-
}
|
|
292
|
-
keys() {
|
|
293
|
-
return this._arr.map((e) => e.key);
|
|
294
|
-
}
|
|
295
|
-
has(e) {
|
|
296
|
-
return e in this._keyIndices;
|
|
297
|
-
}
|
|
298
|
-
priority(e) {
|
|
299
|
-
let t = this._keyIndices[e];
|
|
300
|
-
if (t !== void 0) return this._arr[t].priority;
|
|
301
|
-
}
|
|
302
|
-
min() {
|
|
303
|
-
if (this.size() === 0) throw new Error("Queue underflow");
|
|
304
|
-
return this._arr[0].key;
|
|
305
|
-
}
|
|
306
|
-
add(e, t) {
|
|
307
|
-
let n = this._keyIndices, r = String(e);
|
|
308
|
-
if (!(r in n)) {
|
|
309
|
-
let o = this._arr, i = o.length;
|
|
310
|
-
return n[r] = i, o.push({ key: r, priority: t }), this._decrease(i), !0;
|
|
311
|
-
}
|
|
312
|
-
return !1;
|
|
313
|
-
}
|
|
314
|
-
removeMin() {
|
|
315
|
-
this._swap(0, this._arr.length - 1);
|
|
316
|
-
let e = this._arr.pop();
|
|
317
|
-
return delete this._keyIndices[e.key], this._heapify(0), e.key;
|
|
318
|
-
}
|
|
319
|
-
decrease(e, t) {
|
|
320
|
-
let n = this._keyIndices[e];
|
|
321
|
-
if (n === void 0) throw new Error(`Key not found: ${e}`);
|
|
322
|
-
let r = this._arr[n].priority;
|
|
323
|
-
if (t > r) throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);
|
|
324
|
-
this._arr[n].priority = t, this._decrease(n);
|
|
325
|
-
}
|
|
326
|
-
_heapify(e) {
|
|
327
|
-
let t = this._arr, n = 2 * e, r = n + 1, o = e;
|
|
328
|
-
n < t.length && (o = t[n].priority < t[o].priority ? n : o, r < t.length && (o = t[r].priority < t[o].priority ? r : o), o !== e && (this._swap(e, o), this._heapify(o)));
|
|
329
|
-
}
|
|
330
|
-
_decrease(e) {
|
|
331
|
-
let t = this._arr, n = t[e].priority, r;
|
|
332
|
-
for (; e !== 0 && (r = e >> 1, !(t[r].priority < n)); ) this._swap(e, r), e = r;
|
|
333
|
-
}
|
|
334
|
-
_swap(e, t) {
|
|
335
|
-
let n = this._arr, r = this._keyIndices, o = n[e], i = n[t];
|
|
336
|
-
n[e] = i, n[t] = o, r[i.key] = e, r[o.key] = t;
|
|
337
|
-
}
|
|
338
|
-
}, yr = () => 1;
|
|
339
|
-
function ve(e, t, n, r) {
|
|
340
|
-
let o = function(i) {
|
|
341
|
-
return e.outEdges(i);
|
|
342
|
-
};
|
|
343
|
-
return Er(e, String(t), n || yr, r || o);
|
|
344
|
-
}
|
|
345
|
-
function Er(e, t, n, r) {
|
|
346
|
-
let o = {}, i = new Kt(), a, l, d = function(s) {
|
|
347
|
-
let u = s.v !== a ? s.v : s.w, f = o[u], h = n(s), g = l.distance + h;
|
|
348
|
-
if (h < 0) throw new Error("dijkstra does not allow negative edge weights. Bad edge: " + s + " Weight: " + h);
|
|
349
|
-
g < f.distance && (f.distance = g, f.predecessor = a, i.decrease(u, g));
|
|
350
|
-
};
|
|
351
|
-
for (e.nodes().forEach(function(s) {
|
|
352
|
-
let u = s === t ? 0 : Number.POSITIVE_INFINITY;
|
|
353
|
-
o[s] = { distance: u, predecessor: "" }, i.add(s, u);
|
|
354
|
-
}); i.size() > 0 && (a = i.removeMin(), l = o[a], l.distance !== Number.POSITIVE_INFINITY); ) r(a).forEach(d);
|
|
355
|
-
return o;
|
|
356
|
-
}
|
|
357
|
-
function wr(e, t, n) {
|
|
358
|
-
return e.nodes().reduce(function(r, o) {
|
|
359
|
-
return r[o] = ve(e, o, t, n), r;
|
|
360
|
-
}, {});
|
|
361
|
-
}
|
|
362
|
-
function Ut(e) {
|
|
363
|
-
let t = 0, n = [], r = {}, o = [];
|
|
364
|
-
function i(a) {
|
|
365
|
-
let l = r[a] = { onStack: !0, lowlink: t, index: t++ };
|
|
366
|
-
if (n.push(a), e.successors(a).forEach(function(d) {
|
|
367
|
-
d in r ? r[d].onStack && (l.lowlink = Math.min(l.lowlink, r[d].index)) : (i(d), l.lowlink = Math.min(l.lowlink, r[d].lowlink));
|
|
368
|
-
}), l.lowlink === l.index) {
|
|
369
|
-
let d = [], s;
|
|
370
|
-
do
|
|
371
|
-
s = n.pop(), r[s].onStack = !1, d.push(s);
|
|
372
|
-
while (a !== s);
|
|
373
|
-
o.push(d);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return e.nodes().forEach(function(a) {
|
|
377
|
-
a in r || i(a);
|
|
378
|
-
}), o;
|
|
379
|
-
}
|
|
380
|
-
function vr(e) {
|
|
381
|
-
return Ut(e).filter(function(t) {
|
|
382
|
-
return t.length > 1 || t.length === 1 && e.hasEdge(t[0], t[0]);
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
var kr = () => 1;
|
|
386
|
-
function xr(e, t, n) {
|
|
387
|
-
return _r(e, t || kr, n || function(r) {
|
|
388
|
-
return e.outEdges(r);
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
function _r(e, t, n) {
|
|
392
|
-
let r = {}, o = e.nodes();
|
|
393
|
-
return o.forEach(function(i) {
|
|
394
|
-
r[i] = {}, r[i][i] = { distance: 0, predecessor: "" }, o.forEach(function(a) {
|
|
395
|
-
i !== a && (r[i][a] = { distance: Number.POSITIVE_INFINITY, predecessor: "" });
|
|
396
|
-
}), n(i).forEach(function(a) {
|
|
397
|
-
let l = a.v === i ? a.w : a.v, d = t(a);
|
|
398
|
-
r[i][l] = { distance: d, predecessor: i };
|
|
399
|
-
});
|
|
400
|
-
}), o.forEach(function(i) {
|
|
401
|
-
let a = r[i];
|
|
402
|
-
o.forEach(function(l) {
|
|
403
|
-
let d = r[l];
|
|
404
|
-
o.forEach(function(s) {
|
|
405
|
-
let u = d[i], f = a[s], h = d[s], g = u.distance + f.distance;
|
|
406
|
-
g < h.distance && (h.distance = g, h.predecessor = f.predecessor);
|
|
407
|
-
});
|
|
408
|
-
});
|
|
409
|
-
}), r;
|
|
410
|
-
}
|
|
411
|
-
var ke = class extends Error {
|
|
412
|
-
constructor(...e) {
|
|
413
|
-
super(...e);
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
function Vt(e) {
|
|
417
|
-
let t = {}, n = {}, r = [];
|
|
418
|
-
function o(i) {
|
|
419
|
-
if (i in n) throw new ke();
|
|
420
|
-
i in t || (n[i] = !0, t[i] = !0, e.predecessors(i).forEach(o), delete n[i], r.push(i));
|
|
421
|
-
}
|
|
422
|
-
if (e.sinks().forEach(o), Object.keys(t).length !== e.nodeCount()) throw new ke();
|
|
423
|
-
return r;
|
|
424
|
-
}
|
|
425
|
-
function Tr(e) {
|
|
426
|
-
try {
|
|
427
|
-
Vt(e);
|
|
428
|
-
} catch (t) {
|
|
429
|
-
if (t instanceof ke) return !1;
|
|
430
|
-
throw t;
|
|
431
|
-
}
|
|
432
|
-
return !0;
|
|
433
|
-
}
|
|
434
|
-
function Nr(e, t, n, r, o) {
|
|
435
|
-
Array.isArray(t) || (t = [t]);
|
|
436
|
-
let i = (l) => {
|
|
437
|
-
var d;
|
|
438
|
-
return (d = e.isDirected() ? e.successors(l) : e.neighbors(l)) != null ? d : [];
|
|
439
|
-
}, a = {};
|
|
440
|
-
return t.forEach(function(l) {
|
|
441
|
-
if (!e.hasNode(l)) throw new Error("Graph does not have node: " + l);
|
|
442
|
-
o = Ht(e, l, n === "post", a, i, r, o);
|
|
443
|
-
}), o;
|
|
444
|
-
}
|
|
445
|
-
function Ht(e, t, n, r, o, i, a) {
|
|
446
|
-
return t in r || (r[t] = !0, n || (a = i(a, t)), o(t).forEach(function(l) {
|
|
447
|
-
a = Ht(e, l, n, r, o, i, a);
|
|
448
|
-
}), n && (a = i(a, t))), a;
|
|
449
|
-
}
|
|
450
|
-
function qt(e, t, n) {
|
|
451
|
-
return Nr(e, t, n, function(r, o) {
|
|
452
|
-
return r.push(o), r;
|
|
453
|
-
}, []);
|
|
454
|
-
}
|
|
455
|
-
function Cr(e, t) {
|
|
456
|
-
return qt(e, t, "post");
|
|
457
|
-
}
|
|
458
|
-
function Sr(e, t) {
|
|
459
|
-
return qt(e, t, "pre");
|
|
460
|
-
}
|
|
461
|
-
function Ir(e, t) {
|
|
462
|
-
let n = new B(), r = {}, o = new Kt(), i;
|
|
463
|
-
function a(d) {
|
|
464
|
-
let s = d.v === i ? d.w : d.v, u = o.priority(s);
|
|
465
|
-
if (u !== void 0) {
|
|
466
|
-
let f = t(d);
|
|
467
|
-
f < u && (r[s] = i, o.decrease(s, f));
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
if (e.nodeCount() === 0) return n;
|
|
471
|
-
e.nodes().forEach(function(d) {
|
|
472
|
-
o.add(d, Number.POSITIVE_INFINITY), n.setNode(d);
|
|
473
|
-
}), o.decrease(e.nodes()[0], 0);
|
|
474
|
-
let l = !1;
|
|
475
|
-
for (; o.size() > 0; ) {
|
|
476
|
-
if (i = o.removeMin(), i in r) n.setEdge(i, r[i]);
|
|
477
|
-
else {
|
|
478
|
-
if (l) throw new Error("Input graph is not connected: " + e);
|
|
479
|
-
l = !0;
|
|
480
|
-
}
|
|
481
|
-
e.nodeEdges(i).forEach(a);
|
|
482
|
-
}
|
|
483
|
-
return n;
|
|
484
|
-
}
|
|
485
|
-
function Or(e, t, n, r) {
|
|
486
|
-
return Mr(e, t, n, r ?? ((o) => {
|
|
487
|
-
let i = e.outEdges(o);
|
|
488
|
-
return i ?? [];
|
|
489
|
-
}));
|
|
490
|
-
}
|
|
491
|
-
function Mr(e, t, n, r) {
|
|
492
|
-
if (n === void 0) return ve(e, t, n, r);
|
|
493
|
-
let o = !1, i = e.nodes();
|
|
494
|
-
for (let a = 0; a < i.length; a++) {
|
|
495
|
-
let l = r(i[a]);
|
|
496
|
-
for (let d = 0; d < l.length; d++) {
|
|
497
|
-
let s = l[d], u = s.v === i[a] ? s.v : s.w, f = u === s.v ? s.w : s.v;
|
|
498
|
-
n({ v: u, w: f }) < 0 && (o = !0);
|
|
499
|
-
}
|
|
500
|
-
if (o) return Yt(e, t, n, r);
|
|
501
|
-
}
|
|
502
|
-
return ve(e, t, n, r);
|
|
503
|
-
}
|
|
504
|
-
function ce(e, t, n, r) {
|
|
505
|
-
let o = r;
|
|
506
|
-
for (; e.hasNode(o); ) o = Ue(r);
|
|
507
|
-
return n.dummy = t, e.setNode(o, n), o;
|
|
508
|
-
}
|
|
509
|
-
function jr(e) {
|
|
510
|
-
let t = new B().setGraph(e.graph());
|
|
511
|
-
return e.nodes().forEach((n) => t.setNode(n, e.node(n))), e.edges().forEach((n) => {
|
|
512
|
-
let r = t.edge(n.v, n.w) || { weight: 0, minlen: 1 }, o = e.edge(n);
|
|
513
|
-
t.setEdge(n.v, n.w, { weight: r.weight + o.weight, minlen: Math.max(r.minlen, o.minlen) });
|
|
514
|
-
}), t;
|
|
515
|
-
}
|
|
516
|
-
function Xt(e) {
|
|
517
|
-
let t = new B({ multigraph: e.isMultigraph() }).setGraph(e.graph());
|
|
518
|
-
return e.nodes().forEach((n) => {
|
|
519
|
-
e.children(n).length || t.setNode(n, e.node(n));
|
|
520
|
-
}), e.edges().forEach((n) => {
|
|
521
|
-
t.setEdge(n, e.edge(n));
|
|
522
|
-
}), t;
|
|
523
|
-
}
|
|
524
|
-
function Et(e, t) {
|
|
525
|
-
let n = e.x, r = e.y, o = t.x - n, i = t.y - r, a = e.width / 2, l = e.height / 2;
|
|
526
|
-
if (!o && !i) throw new Error("Not possible to find intersection inside of the rectangle");
|
|
527
|
-
let d, s;
|
|
528
|
-
return Math.abs(i) * a > Math.abs(o) * l ? (i < 0 && (l = -l), d = l * o / i, s = l) : (o < 0 && (a = -a), d = a, s = a * i / o), { x: n + d, y: r + s };
|
|
529
|
-
}
|
|
530
|
-
function pe(e) {
|
|
531
|
-
let t = he(Zt(e) + 1).map(() => []);
|
|
532
|
-
return e.nodes().forEach((n) => {
|
|
533
|
-
let r = e.node(n), o = r.rank;
|
|
534
|
-
o !== void 0 && (t[o] || (t[o] = []), t[o][r.order] = n);
|
|
535
|
-
}), t;
|
|
536
|
-
}
|
|
537
|
-
function Fr(e) {
|
|
538
|
-
let t = e.nodes().map((r) => {
|
|
539
|
-
let o = e.node(r).rank;
|
|
540
|
-
return o === void 0 ? Number.MAX_VALUE : o;
|
|
541
|
-
}), n = $(Math.min, t);
|
|
542
|
-
e.nodes().forEach((r) => {
|
|
543
|
-
let o = e.node(r);
|
|
544
|
-
Object.hasOwn(o, "rank") && (o.rank -= n);
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
function zr(e) {
|
|
548
|
-
let t = e.nodes().map((a) => e.node(a).rank).filter((a) => a !== void 0), n = $(Math.min, t), r = [];
|
|
549
|
-
e.nodes().forEach((a) => {
|
|
550
|
-
let l = e.node(a).rank - n;
|
|
551
|
-
r[l] || (r[l] = []), r[l].push(a);
|
|
552
|
-
});
|
|
553
|
-
let o = 0, i = e.graph().nodeRankFactor;
|
|
554
|
-
Array.from(r).forEach((a, l) => {
|
|
555
|
-
a === void 0 && l % i !== 0 ? --o : a !== void 0 && o && a.forEach((d) => e.node(d).rank += o);
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
function wt(e, t, n, r) {
|
|
559
|
-
let o = { width: 0, height: 0 };
|
|
560
|
-
return arguments.length >= 4 && (o.rank = n, o.order = r), ce(e, "border", o, t);
|
|
561
|
-
}
|
|
562
|
-
function Rr(e, t = Jt) {
|
|
563
|
-
let n = [];
|
|
564
|
-
for (let r = 0; r < e.length; r += t) {
|
|
565
|
-
let o = e.slice(r, r + t);
|
|
566
|
-
n.push(o);
|
|
567
|
-
}
|
|
568
|
-
return n;
|
|
569
|
-
}
|
|
570
|
-
var Jt = 65535;
|
|
571
|
-
function $(e, t) {
|
|
572
|
-
if (t.length > Jt) {
|
|
573
|
-
let n = Rr(t);
|
|
574
|
-
return e(...n.map((r) => e(...r)));
|
|
575
|
-
} else return e(...t);
|
|
576
|
-
}
|
|
577
|
-
function Zt(e) {
|
|
578
|
-
let t = e.nodes().map((n) => {
|
|
579
|
-
let r = e.node(n).rank;
|
|
580
|
-
return r === void 0 ? Number.MIN_VALUE : r;
|
|
581
|
-
});
|
|
582
|
-
return $(Math.max, t);
|
|
583
|
-
}
|
|
584
|
-
function Dr(e, t) {
|
|
585
|
-
let n = { lhs: [], rhs: [] };
|
|
586
|
-
return e.forEach((r) => {
|
|
587
|
-
t(r) ? n.lhs.push(r) : n.rhs.push(r);
|
|
588
|
-
}), n;
|
|
589
|
-
}
|
|
590
|
-
function Qt(e, t) {
|
|
591
|
-
let n = Date.now();
|
|
592
|
-
try {
|
|
593
|
-
return t();
|
|
594
|
-
} finally {
|
|
595
|
-
console.log(e + " time: " + (Date.now() - n) + "ms");
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
function en(e, t) {
|
|
599
|
-
return t();
|
|
600
|
-
}
|
|
601
|
-
var Lr = 0;
|
|
602
|
-
function Ue(e) {
|
|
603
|
-
let t = ++Lr;
|
|
604
|
-
return e + ("" + t);
|
|
605
|
-
}
|
|
606
|
-
function he(e, t, n = 1) {
|
|
607
|
-
t == null && (t = e, e = 0);
|
|
608
|
-
let r = (i) => i < t;
|
|
609
|
-
n < 0 && (r = (i) => t < i);
|
|
610
|
-
let o = [];
|
|
611
|
-
for (let i = e; r(i); i += n) o.push(i);
|
|
612
|
-
return o;
|
|
613
|
-
}
|
|
614
|
-
function xe(e, t) {
|
|
615
|
-
let n = {};
|
|
616
|
-
for (let r of t) e[r] !== void 0 && (n[r] = e[r]);
|
|
617
|
-
return n;
|
|
618
|
-
}
|
|
619
|
-
function _e(e, t) {
|
|
620
|
-
let n;
|
|
621
|
-
return typeof t == "string" ? n = (r) => r[t] : n = t, Object.entries(e).reduce((r, [o, i]) => (r[o] = n(i, o), r), {});
|
|
622
|
-
}
|
|
623
|
-
function Ar(e, t) {
|
|
624
|
-
return e.reduce((n, r, o) => (n[r] = t[o], n), {});
|
|
625
|
-
}
|
|
626
|
-
var Te = "\0", Pr = "3.0.0", Br = class {
|
|
627
|
-
constructor() {
|
|
628
|
-
lr(this, "_sentinel");
|
|
629
|
-
let e = {};
|
|
630
|
-
e._next = e._prev = e, this._sentinel = e;
|
|
631
|
-
}
|
|
632
|
-
dequeue() {
|
|
633
|
-
let e = this._sentinel, t = e._prev;
|
|
634
|
-
if (t !== e) return vt(t), t;
|
|
635
|
-
}
|
|
636
|
-
enqueue(e) {
|
|
637
|
-
let t = this._sentinel;
|
|
638
|
-
e._prev && e._next && vt(e), e._next = t._next, t._next._prev = e, t._next = e, e._prev = t;
|
|
639
|
-
}
|
|
640
|
-
toString() {
|
|
641
|
-
let e = [], t = this._sentinel, n = t._prev;
|
|
642
|
-
for (; n !== t; ) e.push(JSON.stringify(n, Wr)), n = n._prev;
|
|
643
|
-
return "[" + e.join(", ") + "]";
|
|
644
|
-
}
|
|
645
|
-
};
|
|
646
|
-
function vt(e) {
|
|
647
|
-
e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
|
|
648
|
-
}
|
|
649
|
-
function Wr(e, t) {
|
|
650
|
-
if (e !== "_next" && e !== "_prev") return t;
|
|
651
|
-
}
|
|
652
|
-
var Gr = Br, $r = () => 1;
|
|
653
|
-
function Yr(e, t) {
|
|
654
|
-
if (e.nodeCount() <= 1) return [];
|
|
655
|
-
let n = Ur(e, t || $r);
|
|
656
|
-
return Kr(n.graph, n.buckets, n.zeroIdx).flatMap((r) => e.outEdges(r.v, r.w) || []);
|
|
657
|
-
}
|
|
658
|
-
function Kr(e, t, n) {
|
|
659
|
-
var r;
|
|
660
|
-
let o = [], i = t[t.length - 1], a = t[0], l;
|
|
661
|
-
for (; e.nodeCount(); ) {
|
|
662
|
-
for (; l = a.dequeue(); ) je(e, t, n, l);
|
|
663
|
-
for (; l = i.dequeue(); ) je(e, t, n, l);
|
|
664
|
-
if (e.nodeCount()) {
|
|
665
|
-
for (let d = t.length - 2; d > 0; --d) if (l = (r = t[d]) == null ? void 0 : r.dequeue(), l) {
|
|
666
|
-
o = o.concat(je(e, t, n, l, !0) || []);
|
|
667
|
-
break;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
return o;
|
|
672
|
-
}
|
|
673
|
-
function je(e, t, n, r, o) {
|
|
674
|
-
let i = [], a = o ? i : void 0;
|
|
675
|
-
return (e.inEdges(r.v) || []).forEach((l) => {
|
|
676
|
-
let d = e.edge(l), s = e.node(l.v);
|
|
677
|
-
o && i.push({ v: l.v, w: l.w }), s.out -= d, Be(t, n, s);
|
|
678
|
-
}), (e.outEdges(r.v) || []).forEach((l) => {
|
|
679
|
-
let d = e.edge(l), s = l.w, u = e.node(s);
|
|
680
|
-
u.in -= d, Be(t, n, u);
|
|
681
|
-
}), e.removeNode(r.v), a;
|
|
682
|
-
}
|
|
683
|
-
function Ur(e, t) {
|
|
684
|
-
let n = new B(), r = 0, o = 0;
|
|
685
|
-
e.nodes().forEach((l) => {
|
|
686
|
-
n.setNode(l, { v: l, in: 0, out: 0 });
|
|
687
|
-
}), e.edges().forEach((l) => {
|
|
688
|
-
let d = n.edge(l.v, l.w) || 0, s = t(l), u = d + s;
|
|
689
|
-
n.setEdge(l.v, l.w, u);
|
|
690
|
-
let f = n.node(l.v), h = n.node(l.w);
|
|
691
|
-
o = Math.max(o, f.out += s), r = Math.max(r, h.in += s);
|
|
692
|
-
});
|
|
693
|
-
let i = Vr(o + r + 3).map(() => new Gr()), a = r + 1;
|
|
694
|
-
return n.nodes().forEach((l) => {
|
|
695
|
-
Be(i, a, n.node(l));
|
|
696
|
-
}), { graph: n, buckets: i, zeroIdx: a };
|
|
697
|
-
}
|
|
698
|
-
function Be(e, t, n) {
|
|
699
|
-
var r, o, i;
|
|
700
|
-
n.out ? n.in ? (i = e[n.out - n.in + t]) == null || i.enqueue(n) : (o = e[e.length - 1]) == null || o.enqueue(n) : (r = e[0]) == null || r.enqueue(n);
|
|
701
|
-
}
|
|
702
|
-
function Vr(e) {
|
|
703
|
-
let t = [];
|
|
704
|
-
for (let n = 0; n < e; n++) t.push(n);
|
|
705
|
-
return t;
|
|
706
|
-
}
|
|
707
|
-
function Hr(e) {
|
|
708
|
-
(e.graph().acyclicer === "greedy" ? Yr(e, t(e)) : qr(e)).forEach((n) => {
|
|
709
|
-
let r = e.edge(n);
|
|
710
|
-
e.removeEdge(n), r.forwardName = n.name, r.reversed = !0, e.setEdge(n.w, n.v, r, Ue("rev"));
|
|
711
|
-
});
|
|
712
|
-
function t(n) {
|
|
713
|
-
return (r) => n.edge(r).weight;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
function qr(e) {
|
|
717
|
-
let t = [], n = {}, r = {};
|
|
718
|
-
function o(i) {
|
|
719
|
-
Object.hasOwn(r, i) || (r[i] = !0, n[i] = !0, e.outEdges(i).forEach((a) => {
|
|
720
|
-
Object.hasOwn(n, a.w) ? t.push(a) : o(a.w);
|
|
721
|
-
}), delete n[i]);
|
|
722
|
-
}
|
|
723
|
-
return e.nodes().forEach(o), t;
|
|
724
|
-
}
|
|
725
|
-
function Xr(e) {
|
|
726
|
-
e.edges().forEach((t) => {
|
|
727
|
-
let n = e.edge(t);
|
|
728
|
-
if (n.reversed) {
|
|
729
|
-
e.removeEdge(t);
|
|
730
|
-
let r = n.forwardName;
|
|
731
|
-
delete n.reversed, delete n.forwardName, e.setEdge(t.w, t.v, n, r);
|
|
732
|
-
}
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
function Jr(e) {
|
|
736
|
-
e.graph().dummyChains = [], e.edges().forEach((t) => Zr(e, t));
|
|
737
|
-
}
|
|
738
|
-
function Zr(e, t) {
|
|
739
|
-
let n = t.v, r = e.node(n).rank, o = t.w, i = e.node(o).rank, a = t.name, l = e.edge(t), d = l.labelRank;
|
|
740
|
-
if (i === r + 1) return;
|
|
741
|
-
e.removeEdge(t);
|
|
742
|
-
let s, u, f;
|
|
743
|
-
for (f = 0, ++r; r < i; ++f, ++r) l.points = [], u = { width: 0, height: 0, edgeLabel: l, edgeObj: t, rank: r }, s = ce(e, "edge", u, "_d"), r === d && (u.width = l.width, u.height = l.height, u.dummy = "edge-label", u.labelpos = l.labelpos), e.setEdge(n, s, { weight: l.weight }, a), f === 0 && e.graph().dummyChains.push(s), n = s;
|
|
744
|
-
e.setEdge(n, o, { weight: l.weight }, a);
|
|
745
|
-
}
|
|
746
|
-
function Qr(e) {
|
|
747
|
-
e.graph().dummyChains.forEach((t) => {
|
|
748
|
-
let n = e.node(t), r = n.edgeLabel, o;
|
|
749
|
-
for (e.setEdge(n.edgeObj, r); n.dummy; ) o = e.successors(t)[0], e.removeNode(t), r.points.push({ x: n.x, y: n.y }), n.dummy === "edge-label" && (r.x = n.x, r.y = n.y, r.width = n.width, r.height = n.height), t = o, n = e.node(t);
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
function Ve(e) {
|
|
753
|
-
let t = {};
|
|
754
|
-
function n(r) {
|
|
755
|
-
let o = e.node(r);
|
|
756
|
-
if (Object.hasOwn(t, r)) return o.rank;
|
|
757
|
-
t[r] = !0;
|
|
758
|
-
let i = e.outEdges(r), a = i ? i.map((d) => d == null ? Number.POSITIVE_INFINITY : n(d.w) - e.edge(d).minlen) : [], l = $(Math.min, a);
|
|
759
|
-
return l === Number.POSITIVE_INFINITY && (l = 0), o.rank = l;
|
|
760
|
-
}
|
|
761
|
-
e.sources().forEach(n);
|
|
762
|
-
}
|
|
763
|
-
function de(e, t) {
|
|
764
|
-
return e.node(t.w).rank - e.node(t.v).rank - e.edge(t).minlen;
|
|
765
|
-
}
|
|
766
|
-
var tn = eo;
|
|
767
|
-
function eo(e) {
|
|
768
|
-
let t = new B({ directed: !1 }), n = e.nodes();
|
|
769
|
-
if (n.length === 0) throw new Error("Graph must have at least one node");
|
|
770
|
-
let r = n[0], o = e.nodeCount();
|
|
771
|
-
t.setNode(r, {});
|
|
772
|
-
let i, a;
|
|
773
|
-
for (; to(t, e) < o && (i = no(t, e), !!i); ) a = t.hasNode(i.v) ? de(e, i) : -de(e, i), ro(t, e, a);
|
|
774
|
-
return t;
|
|
775
|
-
}
|
|
776
|
-
function to(e, t) {
|
|
777
|
-
function n(r) {
|
|
778
|
-
let o = t.nodeEdges(r);
|
|
779
|
-
o && o.forEach((i) => {
|
|
780
|
-
let a = i.v, l = r === a ? i.w : a;
|
|
781
|
-
!e.hasNode(l) && !de(t, i) && (e.setNode(l, {}), e.setEdge(r, l, {}), n(l));
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
return e.nodes().forEach(n), e.nodeCount();
|
|
785
|
-
}
|
|
786
|
-
function no(e, t) {
|
|
787
|
-
return t.edges().reduce((n, r) => {
|
|
788
|
-
let o = Number.POSITIVE_INFINITY;
|
|
789
|
-
return e.hasNode(r.v) !== e.hasNode(r.w) && (o = de(t, r)), o < n[0] ? [o, r] : n;
|
|
790
|
-
}, [Number.POSITIVE_INFINITY, null])[1];
|
|
791
|
-
}
|
|
792
|
-
function ro(e, t, n) {
|
|
793
|
-
e.nodes().forEach((r) => t.node(r).rank += n);
|
|
794
|
-
}
|
|
795
|
-
var { preorder: oo, postorder: io } = Ke, ao = oe;
|
|
796
|
-
oe.initLowLimValues = qe;
|
|
797
|
-
oe.initCutValues = He;
|
|
798
|
-
oe.calcCutValue = nn;
|
|
799
|
-
oe.leaveEdge = on;
|
|
800
|
-
oe.enterEdge = an;
|
|
801
|
-
oe.exchangeEdges = ln;
|
|
802
|
-
function oe(e) {
|
|
803
|
-
e = jr(e), Ve(e);
|
|
804
|
-
let t = tn(e);
|
|
805
|
-
qe(t), He(t, e);
|
|
806
|
-
let n, r;
|
|
807
|
-
for (; n = on(t); ) r = an(t, e, n), ln(t, e, n, r);
|
|
808
|
-
}
|
|
809
|
-
function He(e, t) {
|
|
810
|
-
let n = io(e, e.nodes());
|
|
811
|
-
n = n.slice(0, n.length - 1), n.forEach((r) => lo(e, t, r));
|
|
812
|
-
}
|
|
813
|
-
function lo(e, t, n) {
|
|
814
|
-
let r = e.node(n).parent, o = e.edge(n, r);
|
|
815
|
-
o.cutvalue = nn(e, t, n);
|
|
816
|
-
}
|
|
817
|
-
function nn(e, t, n) {
|
|
818
|
-
let r = e.node(n).parent, o = !0, i = t.edge(n, r), a = 0;
|
|
819
|
-
i || (o = !1, i = t.edge(r, n)), a = i.weight;
|
|
820
|
-
let l = t.nodeEdges(n);
|
|
821
|
-
return l && l.forEach((d) => {
|
|
822
|
-
let s = d.v === n, u = s ? d.w : d.v;
|
|
823
|
-
if (u !== r) {
|
|
824
|
-
let f = s === o, h = t.edge(d).weight;
|
|
825
|
-
if (a += f ? h : -h, co(e, n, u)) {
|
|
826
|
-
let g = e.edge(n, u).cutvalue;
|
|
827
|
-
a += f ? -g : g;
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
}), a;
|
|
831
|
-
}
|
|
832
|
-
function qe(e, t) {
|
|
833
|
-
arguments.length < 2 && (t = e.nodes()[0]), rn(e, {}, 1, t);
|
|
834
|
-
}
|
|
835
|
-
function rn(e, t, n, r, o) {
|
|
836
|
-
let i = n, a = e.node(r);
|
|
837
|
-
t[r] = !0;
|
|
838
|
-
let l = e.neighbors(r);
|
|
839
|
-
return l && l.forEach((d) => {
|
|
840
|
-
Object.hasOwn(t, d) || (n = rn(e, t, n, d, r));
|
|
841
|
-
}), a.low = i, a.lim = n++, o ? a.parent = o : delete a.parent, n;
|
|
842
|
-
}
|
|
843
|
-
function on(e) {
|
|
844
|
-
return e.edges().find((t) => e.edge(t).cutvalue < 0);
|
|
845
|
-
}
|
|
846
|
-
function an(e, t, n) {
|
|
847
|
-
let r = n.v, o = n.w;
|
|
848
|
-
t.hasEdge(r, o) || (r = n.w, o = n.v);
|
|
849
|
-
let i = e.node(r), a = e.node(o), l = i, d = !1;
|
|
850
|
-
return i.lim > a.lim && (l = a, d = !0), t.edges().filter((s) => d === kt(e, e.node(s.v), l) && d !== kt(e, e.node(s.w), l)).reduce((s, u) => de(t, u) < de(t, s) ? u : s);
|
|
851
|
-
}
|
|
852
|
-
function ln(e, t, n, r) {
|
|
853
|
-
let o = n.v, i = n.w;
|
|
854
|
-
e.removeEdge(o, i), e.setEdge(r.v, r.w, {}), qe(e), He(e, t), so(e, t);
|
|
855
|
-
}
|
|
856
|
-
function so(e, t) {
|
|
857
|
-
let n = e.nodes().find((o) => !e.node(o).parent);
|
|
858
|
-
if (!n) return;
|
|
859
|
-
let r = oo(e, [n]);
|
|
860
|
-
r = r.slice(1), r.forEach((o) => {
|
|
861
|
-
let i = e.node(o).parent, a = t.edge(o, i), l = !1;
|
|
862
|
-
a || (a = t.edge(i, o), l = !0), t.node(o).rank = t.node(i).rank + (l ? a.minlen : -a.minlen);
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
function co(e, t, n) {
|
|
866
|
-
return e.hasEdge(t, n);
|
|
867
|
-
}
|
|
868
|
-
function kt(e, t, n) {
|
|
869
|
-
return n.low <= t.lim && t.lim <= n.lim;
|
|
870
|
-
}
|
|
871
|
-
var uo = fo;
|
|
872
|
-
function fo(e) {
|
|
873
|
-
let t = e.graph().ranker;
|
|
874
|
-
if (typeof t == "function") return t(e);
|
|
875
|
-
switch (t) {
|
|
876
|
-
case "network-simplex":
|
|
877
|
-
xt(e);
|
|
878
|
-
break;
|
|
879
|
-
case "tight-tree":
|
|
880
|
-
go(e);
|
|
881
|
-
break;
|
|
882
|
-
case "longest-path":
|
|
883
|
-
ho(e);
|
|
884
|
-
break;
|
|
885
|
-
case "none":
|
|
886
|
-
break;
|
|
887
|
-
default:
|
|
888
|
-
xt(e);
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
var ho = Ve;
|
|
892
|
-
function go(e) {
|
|
893
|
-
Ve(e), tn(e);
|
|
894
|
-
}
|
|
895
|
-
function xt(e) {
|
|
896
|
-
ao(e);
|
|
897
|
-
}
|
|
898
|
-
var po = mo;
|
|
899
|
-
function mo(e) {
|
|
900
|
-
let t = yo(e);
|
|
901
|
-
e.graph().dummyChains.forEach((n) => {
|
|
902
|
-
let r = e.node(n), o = r.edgeObj, i = bo(e, t, o.v, o.w), a = i.path, l = i.lca, d = 0, s = a[d], u = !0;
|
|
903
|
-
for (; n !== o.w; ) {
|
|
904
|
-
if (r = e.node(n), u) {
|
|
905
|
-
for (; (s = a[d]) !== l && e.node(s).maxRank < r.rank; ) d++;
|
|
906
|
-
s === l && (u = !1);
|
|
907
|
-
}
|
|
908
|
-
if (!u) {
|
|
909
|
-
for (; d < a.length - 1 && e.node(a[d + 1]).minRank <= r.rank; ) d++;
|
|
910
|
-
s = a[d];
|
|
911
|
-
}
|
|
912
|
-
s !== void 0 && e.setParent(n, s), n = e.successors(n)[0];
|
|
913
|
-
}
|
|
914
|
-
});
|
|
915
|
-
}
|
|
916
|
-
function bo(e, t, n, r) {
|
|
917
|
-
let o = [], i = [], a = Math.min(t[n].low, t[r].low), l = Math.max(t[n].lim, t[r].lim), d;
|
|
918
|
-
d = n;
|
|
919
|
-
do
|
|
920
|
-
d = e.parent(d), o.push(d);
|
|
921
|
-
while (d && (t[d].low > a || l > t[d].lim));
|
|
922
|
-
let s = d, u = r;
|
|
923
|
-
for (; (u = e.parent(u)) !== s; ) i.push(u);
|
|
924
|
-
return { path: o.concat(i.reverse()), lca: s };
|
|
925
|
-
}
|
|
926
|
-
function yo(e) {
|
|
927
|
-
let t = {}, n = 0;
|
|
928
|
-
function r(o) {
|
|
929
|
-
let i = n;
|
|
930
|
-
e.children(o).forEach(r), t[o] = { low: i, lim: n++ };
|
|
931
|
-
}
|
|
932
|
-
return e.children(Te).forEach(r), t;
|
|
933
|
-
}
|
|
934
|
-
function Eo(e) {
|
|
935
|
-
let t = ce(e, "root", {}, "_root"), n = wo(e), r = Object.values(n), o = $(Math.max, r) - 1, i = 2 * o + 1;
|
|
936
|
-
e.graph().nestingRoot = t, e.edges().forEach((l) => e.edge(l).minlen *= i);
|
|
937
|
-
let a = vo(e) + 1;
|
|
938
|
-
e.children(Te).forEach((l) => sn(e, t, i, a, o, n, l)), e.graph().nodeRankFactor = i;
|
|
939
|
-
}
|
|
940
|
-
function sn(e, t, n, r, o, i, a) {
|
|
941
|
-
var l;
|
|
942
|
-
let d = e.children(a);
|
|
943
|
-
if (!d.length) {
|
|
944
|
-
a !== t && e.setEdge(t, a, { weight: 0, minlen: n });
|
|
945
|
-
return;
|
|
946
|
-
}
|
|
947
|
-
let s = wt(e, "_bt"), u = wt(e, "_bb"), f = e.node(a);
|
|
948
|
-
e.setParent(s, a), f.borderTop = s, e.setParent(u, a), f.borderBottom = u, d.forEach((h) => {
|
|
949
|
-
var g;
|
|
950
|
-
sn(e, t, n, r, o, i, h);
|
|
951
|
-
let m = e.node(h), b = m.borderTop ? m.borderTop : h, p = m.borderBottom ? m.borderBottom : h, E = m.borderTop ? r : 2 * r, T = b !== p ? 1 : o - ((g = i[a]) != null ? g : 0) + 1;
|
|
952
|
-
e.setEdge(s, b, { weight: E, minlen: T, nestingEdge: !0 }), e.setEdge(p, u, { weight: E, minlen: T, nestingEdge: !0 });
|
|
953
|
-
}), e.parent(a) || e.setEdge(t, s, { weight: 0, minlen: o + ((l = i[a]) != null ? l : 0) });
|
|
954
|
-
}
|
|
955
|
-
function wo(e) {
|
|
956
|
-
let t = {};
|
|
957
|
-
function n(r, o) {
|
|
958
|
-
let i = e.children(r);
|
|
959
|
-
i && i.length && i.forEach((a) => n(a, o + 1)), t[r] = o;
|
|
960
|
-
}
|
|
961
|
-
return e.children(Te).forEach((r) => n(r, 1)), t;
|
|
962
|
-
}
|
|
963
|
-
function vo(e) {
|
|
964
|
-
return e.edges().reduce((t, n) => t + e.edge(n).weight, 0);
|
|
965
|
-
}
|
|
966
|
-
function ko(e) {
|
|
967
|
-
let t = e.graph();
|
|
968
|
-
e.removeNode(t.nestingRoot), delete t.nestingRoot, e.edges().forEach((n) => {
|
|
969
|
-
e.edge(n).nestingEdge && e.removeEdge(n);
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
var xo = _o;
|
|
973
|
-
function _o(e) {
|
|
974
|
-
function t(n) {
|
|
975
|
-
let r = e.children(n), o = e.node(n);
|
|
976
|
-
if (r.length && r.forEach(t), Object.hasOwn(o, "minRank")) {
|
|
977
|
-
o.borderLeft = [], o.borderRight = [];
|
|
978
|
-
for (let i = o.minRank, a = o.maxRank + 1; i < a; ++i) _t(e, "borderLeft", "_bl", n, o, i), _t(e, "borderRight", "_br", n, o, i);
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
e.children(Te).forEach(t);
|
|
982
|
-
}
|
|
983
|
-
function _t(e, t, n, r, o, i) {
|
|
984
|
-
let a = { width: 0, height: 0, rank: i, borderType: t }, l = o[t][i - 1], d = ce(e, "border", a, n);
|
|
985
|
-
o[t][i] = d, e.setParent(d, r), l && e.setEdge(l, d, { weight: 1 });
|
|
986
|
-
}
|
|
987
|
-
function To(e) {
|
|
988
|
-
var t;
|
|
989
|
-
let n = (t = e.graph().rankdir) == null ? void 0 : t.toLowerCase();
|
|
990
|
-
(n === "lr" || n === "rl") && dn(e);
|
|
991
|
-
}
|
|
992
|
-
function No(e) {
|
|
993
|
-
var t;
|
|
994
|
-
let n = (t = e.graph().rankdir) == null ? void 0 : t.toLowerCase();
|
|
995
|
-
(n === "bt" || n === "rl") && Co(e), (n === "lr" || n === "rl") && (So(e), dn(e));
|
|
996
|
-
}
|
|
997
|
-
function dn(e) {
|
|
998
|
-
e.nodes().forEach((t) => Tt(e.node(t))), e.edges().forEach((t) => Tt(e.edge(t)));
|
|
999
|
-
}
|
|
1000
|
-
function Tt(e) {
|
|
1001
|
-
let t = e.width;
|
|
1002
|
-
e.width = e.height, e.height = t;
|
|
1003
|
-
}
|
|
1004
|
-
function Co(e) {
|
|
1005
|
-
e.nodes().forEach((t) => Fe(e.node(t))), e.edges().forEach((t) => {
|
|
1006
|
-
var n;
|
|
1007
|
-
let r = e.edge(t);
|
|
1008
|
-
(n = r.points) == null || n.forEach(Fe), Object.hasOwn(r, "y") && Fe(r);
|
|
1009
|
-
});
|
|
1010
|
-
}
|
|
1011
|
-
function Fe(e) {
|
|
1012
|
-
e.y = -e.y;
|
|
1013
|
-
}
|
|
1014
|
-
function So(e) {
|
|
1015
|
-
e.nodes().forEach((t) => ze(e.node(t))), e.edges().forEach((t) => {
|
|
1016
|
-
var n;
|
|
1017
|
-
let r = e.edge(t);
|
|
1018
|
-
(n = r.points) == null || n.forEach(ze), Object.hasOwn(r, "x") && ze(r);
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
function ze(e) {
|
|
1022
|
-
let t = e.x;
|
|
1023
|
-
e.x = e.y, e.y = t;
|
|
1024
|
-
}
|
|
1025
|
-
function Io(e) {
|
|
1026
|
-
let t = {}, n = e.nodes().filter((l) => !e.children(l).length), r = n.map((l) => e.node(l).rank), o = $(Math.max, r), i = he(o + 1).map(() => []);
|
|
1027
|
-
function a(l) {
|
|
1028
|
-
if (t[l]) return;
|
|
1029
|
-
t[l] = !0;
|
|
1030
|
-
let d = e.node(l);
|
|
1031
|
-
i[d.rank].push(l);
|
|
1032
|
-
let s = e.successors(l);
|
|
1033
|
-
s && s.forEach(a);
|
|
1034
|
-
}
|
|
1035
|
-
return n.sort((l, d) => e.node(l).rank - e.node(d).rank).forEach(a), i;
|
|
1036
|
-
}
|
|
1037
|
-
function Oo(e, t) {
|
|
1038
|
-
let n = 0;
|
|
1039
|
-
for (let r = 1; r < t.length; ++r) n += Mo(e, t[r - 1], t[r]);
|
|
1040
|
-
return n;
|
|
1041
|
-
}
|
|
1042
|
-
function Mo(e, t, n) {
|
|
1043
|
-
let r = Ar(n, n.map((s, u) => u)), o = t.flatMap((s) => {
|
|
1044
|
-
let u = e.outEdges(s);
|
|
1045
|
-
return u ? u.map((f) => ({ pos: r[f.w], weight: e.edge(f).weight })).sort((f, h) => f.pos - h.pos) : [];
|
|
1046
|
-
}), i = 1;
|
|
1047
|
-
for (; i < n.length; ) i <<= 1;
|
|
1048
|
-
let a = 2 * i - 1;
|
|
1049
|
-
i -= 1;
|
|
1050
|
-
let l = new Array(a).fill(0), d = 0;
|
|
1051
|
-
return o.forEach((s) => {
|
|
1052
|
-
let u = s.pos + i;
|
|
1053
|
-
l[u] += s.weight;
|
|
1054
|
-
let f = 0;
|
|
1055
|
-
for (; u > 0; ) u % 2 && (f += l[u + 1]), u = u - 1 >> 1, l[u] += s.weight;
|
|
1056
|
-
d += s.weight * f;
|
|
1057
|
-
}), d;
|
|
1058
|
-
}
|
|
1059
|
-
function jo(e, t = []) {
|
|
1060
|
-
return t.map((n) => {
|
|
1061
|
-
let r = e.inEdges(n);
|
|
1062
|
-
if (!r || !r.length) return { v: n };
|
|
1063
|
-
{
|
|
1064
|
-
let o = r.reduce((i, a) => {
|
|
1065
|
-
let l = e.edge(a), d = e.node(a.v);
|
|
1066
|
-
return { sum: i.sum + l.weight * d.order, weight: i.weight + l.weight };
|
|
1067
|
-
}, { sum: 0, weight: 0 });
|
|
1068
|
-
return { v: n, barycenter: o.sum / o.weight, weight: o.weight };
|
|
1069
|
-
}
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
function Fo(e, t) {
|
|
1073
|
-
let n = {};
|
|
1074
|
-
e.forEach((o, i) => {
|
|
1075
|
-
let a = { indegree: 0, in: [], out: [], vs: [o.v], i };
|
|
1076
|
-
o.barycenter !== void 0 && (a.barycenter = o.barycenter, a.weight = o.weight), n[o.v] = a;
|
|
1077
|
-
}), t.edges().forEach((o) => {
|
|
1078
|
-
let i = n[o.v], a = n[o.w];
|
|
1079
|
-
i !== void 0 && a !== void 0 && (a.indegree++, i.out.push(a));
|
|
1080
|
-
});
|
|
1081
|
-
let r = Object.values(n).filter((o) => !o.indegree);
|
|
1082
|
-
return zo(r);
|
|
1083
|
-
}
|
|
1084
|
-
function zo(e) {
|
|
1085
|
-
let t = [];
|
|
1086
|
-
function n(o) {
|
|
1087
|
-
return (i) => {
|
|
1088
|
-
i.merged || (i.barycenter === void 0 || o.barycenter === void 0 || i.barycenter >= o.barycenter) && Ro(o, i);
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
function r(o) {
|
|
1092
|
-
return (i) => {
|
|
1093
|
-
i.in.push(o), --i.indegree === 0 && e.push(i);
|
|
1094
|
-
};
|
|
1095
|
-
}
|
|
1096
|
-
for (; e.length; ) {
|
|
1097
|
-
let o = e.pop();
|
|
1098
|
-
t.push(o), o.in.reverse().forEach(n(o)), o.out.forEach(r(o));
|
|
1099
|
-
}
|
|
1100
|
-
return t.filter((o) => !o.merged).map((o) => xe(o, ["vs", "i", "barycenter", "weight"]));
|
|
1101
|
-
}
|
|
1102
|
-
function Ro(e, t) {
|
|
1103
|
-
let n = 0, r = 0;
|
|
1104
|
-
e.weight && (n += e.barycenter * e.weight, r += e.weight), t.weight && (n += t.barycenter * t.weight, r += t.weight), e.vs = t.vs.concat(e.vs), e.barycenter = n / r, e.weight = r, e.i = Math.min(t.i, e.i), t.merged = !0;
|
|
1105
|
-
}
|
|
1106
|
-
function Do(e, t) {
|
|
1107
|
-
let n = Dr(e, (u) => Object.hasOwn(u, "barycenter")), r = n.lhs, o = n.rhs.sort((u, f) => f.i - u.i), i = [], a = 0, l = 0, d = 0;
|
|
1108
|
-
r.sort(Lo(!!t)), d = Nt(i, o, d), r.forEach((u) => {
|
|
1109
|
-
d += u.vs.length, i.push(u.vs), a += u.barycenter * u.weight, l += u.weight, d = Nt(i, o, d);
|
|
1110
|
-
});
|
|
1111
|
-
let s = { vs: i.flat(1) };
|
|
1112
|
-
return l && (s.barycenter = a / l, s.weight = l), s;
|
|
1113
|
-
}
|
|
1114
|
-
function Nt(e, t, n) {
|
|
1115
|
-
let r;
|
|
1116
|
-
for (; t.length && (r = t[t.length - 1]).i <= n; ) t.pop(), e.push(r.vs), n++;
|
|
1117
|
-
return n;
|
|
1118
|
-
}
|
|
1119
|
-
function Lo(e) {
|
|
1120
|
-
return (t, n) => t.barycenter < n.barycenter ? -1 : t.barycenter > n.barycenter ? 1 : e ? n.i - t.i : t.i - n.i;
|
|
1121
|
-
}
|
|
1122
|
-
function cn(e, t, n, r) {
|
|
1123
|
-
let o = e.children(t), i = e.node(t), a = i ? i.borderLeft : void 0, l = i ? i.borderRight : void 0, d = {};
|
|
1124
|
-
a && (o = o.filter((h) => h !== a && h !== l));
|
|
1125
|
-
let s = jo(e, o);
|
|
1126
|
-
s.forEach((h) => {
|
|
1127
|
-
if (e.children(h.v).length) {
|
|
1128
|
-
let g = cn(e, h.v, n, r);
|
|
1129
|
-
d[h.v] = g, Object.hasOwn(g, "barycenter") && Po(h, g);
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
|
-
let u = Fo(s, n);
|
|
1133
|
-
Ao(u, d);
|
|
1134
|
-
let f = Do(u, r);
|
|
1135
|
-
if (a && l) {
|
|
1136
|
-
f.vs = [a, f.vs, l].flat(1);
|
|
1137
|
-
let h = e.predecessors(a);
|
|
1138
|
-
if (h && h.length) {
|
|
1139
|
-
let g = e.node(h[0]), m = e.predecessors(l), b = e.node(m[0]);
|
|
1140
|
-
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;
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
return f;
|
|
1144
|
-
}
|
|
1145
|
-
function Ao(e, t) {
|
|
1146
|
-
e.forEach((n) => {
|
|
1147
|
-
n.vs = n.vs.flatMap((r) => t[r] ? t[r].vs : r);
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
function Po(e, t) {
|
|
1151
|
-
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);
|
|
1152
|
-
}
|
|
1153
|
-
function Bo(e, t, n, r) {
|
|
1154
|
-
r || (r = e.nodes());
|
|
1155
|
-
let o = Wo(e), i = new B({ compound: !0 }).setGraph({ root: o }).setDefaultNodeLabel((a) => e.node(a));
|
|
1156
|
-
return r.forEach((a) => {
|
|
1157
|
-
let l = e.node(a), d = e.parent(a);
|
|
1158
|
-
if (l.rank === t || l.minRank <= t && t <= l.maxRank) {
|
|
1159
|
-
i.setNode(a), i.setParent(a, d || o);
|
|
1160
|
-
let s = e[n](a);
|
|
1161
|
-
s && s.forEach((u) => {
|
|
1162
|
-
let f = u.v === a ? u.w : u.v, h = i.edge(f, a), g = h !== void 0 ? h.weight : 0;
|
|
1163
|
-
i.setEdge(f, a, { weight: e.edge(u).weight + g });
|
|
1164
|
-
}), Object.hasOwn(l, "minRank") && i.setNode(a, { borderLeft: l.borderLeft[t], borderRight: l.borderRight[t] });
|
|
1165
|
-
}
|
|
1166
|
-
}), i;
|
|
1167
|
-
}
|
|
1168
|
-
function Wo(e) {
|
|
1169
|
-
let t;
|
|
1170
|
-
for (; e.hasNode(t = Ue("_root")); ) ;
|
|
1171
|
-
return t;
|
|
1172
|
-
}
|
|
1173
|
-
function Go(e, t, n) {
|
|
1174
|
-
let r = {}, o;
|
|
1175
|
-
n.forEach((i) => {
|
|
1176
|
-
let a = e.parent(i), l, d;
|
|
1177
|
-
for (; a; ) {
|
|
1178
|
-
if (l = e.parent(a), l ? (d = r[l], r[l] = a) : (d = o, o = a), d && d !== a) {
|
|
1179
|
-
t.setEdge(d, a);
|
|
1180
|
-
return;
|
|
1181
|
-
}
|
|
1182
|
-
a = l;
|
|
1183
|
-
}
|
|
1184
|
-
});
|
|
1185
|
-
}
|
|
1186
|
-
function un(e, t = {}) {
|
|
1187
|
-
if (typeof t.customOrder == "function") {
|
|
1188
|
-
t.customOrder(e, un);
|
|
1189
|
-
return;
|
|
1190
|
-
}
|
|
1191
|
-
let n = Zt(e), r = Ct(e, he(1, n + 1), "inEdges"), o = Ct(e, he(n - 1, -1, -1), "outEdges"), i = Io(e);
|
|
1192
|
-
if (St(e, i), t.disableOptimalOrderHeuristic) return;
|
|
1193
|
-
let a = Number.POSITIVE_INFINITY, l, d = t.constraints || [];
|
|
1194
|
-
for (let s = 0, u = 0; u < 4; ++s, ++u) {
|
|
1195
|
-
$o(s % 2 ? r : o, s % 4 >= 2, d), i = pe(e);
|
|
1196
|
-
let f = Oo(e, i);
|
|
1197
|
-
f < a ? (u = 0, l = Object.assign({}, i), a = f) : f === a && (l = structuredClone(i));
|
|
1198
|
-
}
|
|
1199
|
-
St(e, l);
|
|
1200
|
-
}
|
|
1201
|
-
function Ct(e, t, n) {
|
|
1202
|
-
let r = /* @__PURE__ */ new Map(), o = (i, a) => {
|
|
1203
|
-
r.has(i) || r.set(i, []), r.get(i).push(a);
|
|
1204
|
-
};
|
|
1205
|
-
for (let i of e.nodes()) {
|
|
1206
|
-
let a = e.node(i);
|
|
1207
|
-
if (typeof a.rank == "number" && o(a.rank, i), typeof a.minRank == "number" && typeof a.maxRank == "number") for (let l = a.minRank; l <= a.maxRank; l++) l !== a.rank && o(l, i);
|
|
1208
|
-
}
|
|
1209
|
-
return t.map(function(i) {
|
|
1210
|
-
return Bo(e, i, n, r.get(i) || []);
|
|
1211
|
-
});
|
|
1212
|
-
}
|
|
1213
|
-
function $o(e, t, n) {
|
|
1214
|
-
let r = new B();
|
|
1215
|
-
e.forEach(function(o) {
|
|
1216
|
-
n.forEach((l) => r.setEdge(l.left, l.right));
|
|
1217
|
-
let i = o.graph().root, a = cn(o, i, r, t);
|
|
1218
|
-
a.vs.forEach((l, d) => o.node(l).order = d), Go(o, r, a.vs);
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
function St(e, t) {
|
|
1222
|
-
Object.values(t).forEach((n) => n.forEach((r, o) => e.node(r).order = o));
|
|
1223
|
-
}
|
|
1224
|
-
function Yo(e, t) {
|
|
1225
|
-
let n = {};
|
|
1226
|
-
function r(o, i) {
|
|
1227
|
-
let a = 0, l = 0, d = o.length, s = i[i.length - 1];
|
|
1228
|
-
return i.forEach((u, f) => {
|
|
1229
|
-
let h = Uo(e, u), g = h ? e.node(h).order : d;
|
|
1230
|
-
(h || u === s) && (i.slice(l, f + 1).forEach((m) => {
|
|
1231
|
-
let b = e.predecessors(m);
|
|
1232
|
-
b && b.forEach((p) => {
|
|
1233
|
-
let E = e.node(p), T = E.order;
|
|
1234
|
-
(T < a || g < T) && !(E.dummy && e.node(m).dummy) && fn(n, p, m);
|
|
1235
|
-
});
|
|
1236
|
-
}), l = f + 1, a = g);
|
|
1237
|
-
}), i;
|
|
1238
|
-
}
|
|
1239
|
-
return t.length && t.reduce(r), n;
|
|
1240
|
-
}
|
|
1241
|
-
function Ko(e, t) {
|
|
1242
|
-
let n = {};
|
|
1243
|
-
function r(i, a, l, d, s) {
|
|
1244
|
-
he(a, l).forEach((u) => {
|
|
1245
|
-
let f = i[u];
|
|
1246
|
-
if (f !== void 0 && e.node(f).dummy) {
|
|
1247
|
-
let h = e.predecessors(f);
|
|
1248
|
-
h && h.forEach((g) => {
|
|
1249
|
-
if (g === void 0) return;
|
|
1250
|
-
let m = e.node(g);
|
|
1251
|
-
m.dummy && (m.order < d || m.order > s) && fn(n, g, f);
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
function o(i, a) {
|
|
1257
|
-
let l = -1, d = -1, s = 0;
|
|
1258
|
-
return a.forEach((u, f) => {
|
|
1259
|
-
if (e.node(u).dummy === "border") {
|
|
1260
|
-
let h = e.predecessors(u);
|
|
1261
|
-
if (h && h.length) {
|
|
1262
|
-
let g = h[0];
|
|
1263
|
-
if (g === void 0) return;
|
|
1264
|
-
d = e.node(g).order, r(a, s, f, l, d), s = f, l = d;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
r(a, s, a.length, d, i.length);
|
|
1268
|
-
}), a;
|
|
1269
|
-
}
|
|
1270
|
-
return t.length && t.reduce(o), n;
|
|
1271
|
-
}
|
|
1272
|
-
function Uo(e, t) {
|
|
1273
|
-
if (e.node(t).dummy) {
|
|
1274
|
-
let n = e.predecessors(t);
|
|
1275
|
-
if (n) return n.find((r) => e.node(r).dummy);
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
function fn(e, t, n) {
|
|
1279
|
-
if (t > n) {
|
|
1280
|
-
let o = t;
|
|
1281
|
-
t = n, n = o;
|
|
1282
|
-
}
|
|
1283
|
-
let r = e[t];
|
|
1284
|
-
r || (e[t] = r = {}), r[n] = !0;
|
|
1285
|
-
}
|
|
1286
|
-
function Vo(e, t, n) {
|
|
1287
|
-
if (t > n) {
|
|
1288
|
-
let o = t;
|
|
1289
|
-
t = n, n = o;
|
|
1290
|
-
}
|
|
1291
|
-
let r = e[t];
|
|
1292
|
-
return r !== void 0 && Object.hasOwn(r, n);
|
|
1293
|
-
}
|
|
1294
|
-
function Ho(e, t, n, r) {
|
|
1295
|
-
let o = {}, i = {}, a = {};
|
|
1296
|
-
return t.forEach((l) => {
|
|
1297
|
-
l.forEach((d, s) => {
|
|
1298
|
-
o[d] = d, i[d] = d, a[d] = s;
|
|
1299
|
-
});
|
|
1300
|
-
}), t.forEach((l) => {
|
|
1301
|
-
let d = -1;
|
|
1302
|
-
l.forEach((s) => {
|
|
1303
|
-
let u = r(s);
|
|
1304
|
-
if (u && u.length) {
|
|
1305
|
-
let f = u.sort((g, m) => {
|
|
1306
|
-
let b = a[g], p = a[m];
|
|
1307
|
-
return (b !== void 0 ? b : 0) - (p !== void 0 ? p : 0);
|
|
1308
|
-
}), h = (f.length - 1) / 2;
|
|
1309
|
-
for (let g = Math.floor(h), m = Math.ceil(h); g <= m; ++g) {
|
|
1310
|
-
let b = f[g];
|
|
1311
|
-
if (b === void 0) continue;
|
|
1312
|
-
let p = a[b];
|
|
1313
|
-
if (p !== void 0 && i[s] === s && d < p && !Vo(n, s, b)) {
|
|
1314
|
-
let E = o[b];
|
|
1315
|
-
E !== void 0 && (i[b] = s, i[s] = o[s] = E, d = p);
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
});
|
|
1320
|
-
}), { root: o, align: i };
|
|
1321
|
-
}
|
|
1322
|
-
function qo(e, t, n, r, o = !1) {
|
|
1323
|
-
let i = {}, a = Xo(e, t, n, o), l = o ? "borderLeft" : "borderRight";
|
|
1324
|
-
function d(g, m) {
|
|
1325
|
-
let b = a.nodes().slice(), p = {}, E = b.pop();
|
|
1326
|
-
for (; E; ) {
|
|
1327
|
-
if (p[E]) g(E);
|
|
1328
|
-
else {
|
|
1329
|
-
p[E] = !0, b.push(E);
|
|
1330
|
-
for (let T of m(E)) b.push(T);
|
|
1331
|
-
}
|
|
1332
|
-
E = b.pop();
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
function s(g) {
|
|
1336
|
-
let m = a.inEdges(g);
|
|
1337
|
-
m ? i[g] = m.reduce((b, p) => {
|
|
1338
|
-
var E;
|
|
1339
|
-
let T = (E = i[p.v]) != null ? E : 0, I = a.edge(p);
|
|
1340
|
-
return Math.max(b, T + (I !== void 0 ? I : 0));
|
|
1341
|
-
}, 0) : i[g] = 0;
|
|
1342
|
-
}
|
|
1343
|
-
function u(g) {
|
|
1344
|
-
let m = a.outEdges(g), b = Number.POSITIVE_INFINITY;
|
|
1345
|
-
m && (b = m.reduce((E, T) => {
|
|
1346
|
-
let I = i[T.w], O = a.edge(T);
|
|
1347
|
-
return Math.min(E, (I !== void 0 ? I : 0) - (O !== void 0 ? O : 0));
|
|
1348
|
-
}, Number.POSITIVE_INFINITY));
|
|
1349
|
-
let p = e.node(g);
|
|
1350
|
-
b !== Number.POSITIVE_INFINITY && p.borderType !== l && (i[g] = Math.max(i[g] !== void 0 ? i[g] : 0, b));
|
|
1351
|
-
}
|
|
1352
|
-
function f(g) {
|
|
1353
|
-
return a.predecessors(g) || [];
|
|
1354
|
-
}
|
|
1355
|
-
function h(g) {
|
|
1356
|
-
return a.successors(g) || [];
|
|
1357
|
-
}
|
|
1358
|
-
return d(s, f), d(u, h), Object.keys(r).forEach((g) => {
|
|
1359
|
-
var m;
|
|
1360
|
-
let b = n[g];
|
|
1361
|
-
b !== void 0 && (i[g] = (m = i[b]) != null ? m : 0);
|
|
1362
|
-
}), i;
|
|
1363
|
-
}
|
|
1364
|
-
function Xo(e, t, n, r) {
|
|
1365
|
-
let o = new B(), i = e.graph(), a = ti(i.nodesep, i.edgesep, r);
|
|
1366
|
-
return t.forEach((l) => {
|
|
1367
|
-
let d;
|
|
1368
|
-
l.forEach((s) => {
|
|
1369
|
-
let u = n[s];
|
|
1370
|
-
if (u !== void 0) {
|
|
1371
|
-
if (o.setNode(u), d !== void 0) {
|
|
1372
|
-
let f = n[d];
|
|
1373
|
-
if (f !== void 0) {
|
|
1374
|
-
let h = o.edge(f, u);
|
|
1375
|
-
o.setEdge(f, u, Math.max(a(e, s, d), h || 0));
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
d = s;
|
|
1379
|
-
}
|
|
1380
|
-
});
|
|
1381
|
-
}), o;
|
|
1382
|
-
}
|
|
1383
|
-
function Jo(e, t) {
|
|
1384
|
-
return Object.values(t).reduce((n, r) => {
|
|
1385
|
-
let o = Number.NEGATIVE_INFINITY, i = Number.POSITIVE_INFINITY;
|
|
1386
|
-
Object.entries(r).forEach(([l, d]) => {
|
|
1387
|
-
let s = ni(e, l) / 2;
|
|
1388
|
-
o = Math.max(d + s, o), i = Math.min(d - s, i);
|
|
1389
|
-
});
|
|
1390
|
-
let a = o - i;
|
|
1391
|
-
return a < n[0] && (n = [a, r]), n;
|
|
1392
|
-
}, [Number.POSITIVE_INFINITY, null])[1];
|
|
1393
|
-
}
|
|
1394
|
-
function Zo(e, t) {
|
|
1395
|
-
let n = Object.values(t), r = $(Math.min, n), o = $(Math.max, n);
|
|
1396
|
-
["u", "d"].forEach((i) => {
|
|
1397
|
-
["l", "r"].forEach((a) => {
|
|
1398
|
-
let l = i + a, d = e[l];
|
|
1399
|
-
if (!d || d === t) return;
|
|
1400
|
-
let s = Object.values(d), u = r - $(Math.min, s);
|
|
1401
|
-
a !== "l" && (u = o - $(Math.max, s)), u && (e[l] = _e(d, (f) => f + u));
|
|
1402
|
-
});
|
|
1403
|
-
});
|
|
1404
|
-
}
|
|
1405
|
-
function Qo(e, t = void 0) {
|
|
1406
|
-
let n = e.ul;
|
|
1407
|
-
return n ? _e(n, (r, o) => {
|
|
1408
|
-
var i, a;
|
|
1409
|
-
if (t) {
|
|
1410
|
-
let d = t.toLowerCase(), s = e[d];
|
|
1411
|
-
if (s && s[o] !== void 0) return s[o];
|
|
1412
|
-
}
|
|
1413
|
-
let l = Object.values(e).map((d) => {
|
|
1414
|
-
let s = d[o];
|
|
1415
|
-
return s !== void 0 ? s : 0;
|
|
1416
|
-
}).sort((d, s) => d - s);
|
|
1417
|
-
return (((i = l[1]) != null ? i : 0) + ((a = l[2]) != null ? a : 0)) / 2;
|
|
1418
|
-
}) : {};
|
|
1419
|
-
}
|
|
1420
|
-
function ei(e) {
|
|
1421
|
-
let t = pe(e), n = Object.assign(Yo(e, t), Ko(e, t)), r = {}, o;
|
|
1422
|
-
["u", "d"].forEach((a) => {
|
|
1423
|
-
o = a === "u" ? t : Object.values(t).reverse(), ["l", "r"].forEach((l) => {
|
|
1424
|
-
l === "r" && (o = o.map((u) => Object.values(u).reverse()));
|
|
1425
|
-
let d = Ho(e, o, n, (u) => (a === "u" ? e.predecessors(u) : e.successors(u)) || []), s = qo(e, o, d.root, d.align, l === "r");
|
|
1426
|
-
l === "r" && (s = _e(s, (u) => -u)), r[a + l] = s;
|
|
1427
|
-
});
|
|
1428
|
-
});
|
|
1429
|
-
let i = Jo(e, r);
|
|
1430
|
-
return Zo(r, i), Qo(r, e.graph().align);
|
|
1431
|
-
}
|
|
1432
|
-
function ti(e, t, n) {
|
|
1433
|
-
return (r, o, i) => {
|
|
1434
|
-
let a = r.node(o), l = r.node(i), d = 0, s;
|
|
1435
|
-
if (d += a.width / 2, Object.hasOwn(a, "labelpos")) switch (a.labelpos.toLowerCase()) {
|
|
1436
|
-
case "l":
|
|
1437
|
-
s = -a.width / 2;
|
|
1438
|
-
break;
|
|
1439
|
-
case "r":
|
|
1440
|
-
s = a.width / 2;
|
|
1441
|
-
break;
|
|
1442
|
-
}
|
|
1443
|
-
if (s && (d += n ? s : -s), s = void 0, d += (a.dummy ? t : e) / 2, d += (l.dummy ? t : e) / 2, d += l.width / 2, Object.hasOwn(l, "labelpos")) switch (l.labelpos.toLowerCase()) {
|
|
1444
|
-
case "l":
|
|
1445
|
-
s = l.width / 2;
|
|
1446
|
-
break;
|
|
1447
|
-
case "r":
|
|
1448
|
-
s = -l.width / 2;
|
|
1449
|
-
break;
|
|
1450
|
-
}
|
|
1451
|
-
return s && (d += n ? s : -s), d;
|
|
1452
|
-
};
|
|
1453
|
-
}
|
|
1454
|
-
function ni(e, t) {
|
|
1455
|
-
return e.node(t).width;
|
|
1456
|
-
}
|
|
1457
|
-
function ri(e) {
|
|
1458
|
-
e = Xt(e), oi(e), Object.entries(ei(e)).forEach(([t, n]) => e.node(t).x = n);
|
|
1459
|
-
}
|
|
1460
|
-
function oi(e) {
|
|
1461
|
-
let t = pe(e), n = e.graph(), r = n.ranksep, o = n.rankalign, i = 0;
|
|
1462
|
-
t.forEach((a) => {
|
|
1463
|
-
let l = a.reduce((d, s) => {
|
|
1464
|
-
var u;
|
|
1465
|
-
let f = (u = e.node(s).height) != null ? u : 0;
|
|
1466
|
-
return d > f ? d : f;
|
|
1467
|
-
}, 0);
|
|
1468
|
-
a.forEach((d) => {
|
|
1469
|
-
let s = e.node(d);
|
|
1470
|
-
o === "top" ? s.y = i + s.height / 2 : o === "bottom" ? s.y = i + l - s.height / 2 : s.y = i + l / 2;
|
|
1471
|
-
}), i += l + r;
|
|
1472
|
-
});
|
|
1473
|
-
}
|
|
1474
|
-
function ii(e, t = {}) {
|
|
1475
|
-
let n = t.debugTiming ? Qt : en;
|
|
1476
|
-
return n("layout", () => {
|
|
1477
|
-
let r = n(" buildLayoutGraph", () => pi(e));
|
|
1478
|
-
return n(" runLayout", () => ai(r, n, t)), n(" updateInputGraph", () => li(e, r)), r;
|
|
1479
|
-
});
|
|
1480
|
-
}
|
|
1481
|
-
function ai(e, t, n) {
|
|
1482
|
-
t(" makeSpaceForEdgeLabels", () => mi(e)), t(" removeSelfEdges", () => Ti(e)), t(" acyclic", () => Hr(e)), t(" nestingGraph.run", () => Eo(e)), t(" rank", () => uo(Xt(e))), t(" injectEdgeLabelProxies", () => bi(e)), t(" removeEmptyRanks", () => zr(e)), t(" nestingGraph.cleanup", () => ko(e)), t(" normalizeRanks", () => Fr(e)), t(" assignRankMinMax", () => yi(e)), t(" removeEdgeLabelProxies", () => Ei(e)), t(" normalize.run", () => Jr(e)), t(" parentDummyChains", () => po(e)), t(" addBorderSegments", () => xo(e)), t(" order", () => un(e, n)), t(" insertSelfEdges", () => Ni(e)), t(" adjustCoordinateSystem", () => To(e)), t(" position", () => ri(e)), t(" positionSelfEdges", () => Ci(e)), t(" removeBorderNodes", () => _i(e)), t(" normalize.undo", () => Qr(e)), t(" fixupEdgeLabelCoords", () => ki(e)), t(" undoCoordinateSystem", () => No(e)), t(" translateGraph", () => wi(e)), t(" assignNodeIntersects", () => vi(e)), t(" reversePoints", () => xi(e)), t(" acyclic.undo", () => Xr(e));
|
|
1483
|
-
}
|
|
1484
|
-
function li(e, t) {
|
|
1485
|
-
e.nodes().forEach((n) => {
|
|
1486
|
-
let r = e.node(n), o = t.node(n);
|
|
1487
|
-
r && (r.x = o.x, r.y = o.y, r.order = o.order, r.rank = o.rank, t.children(n).length && (r.width = o.width, r.height = o.height));
|
|
1488
|
-
}), e.edges().forEach((n) => {
|
|
1489
|
-
let r = e.edge(n), o = t.edge(n);
|
|
1490
|
-
r.points = o.points, Object.hasOwn(o, "x") && (r.x = o.x, r.y = o.y);
|
|
1491
|
-
}), e.graph().width = t.graph().width, e.graph().height = t.graph().height;
|
|
1492
|
-
}
|
|
1493
|
-
var si = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], di = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "TB", rankalign: "center" }, ci = ["acyclicer", "ranker", "rankdir", "align", "rankalign"], ui = ["width", "height", "rank"], It = { width: 0, height: 0 }, fi = ["minlen", "weight", "width", "height", "labeloffset"], hi = { minlen: 1, weight: 1, width: 0, height: 0, labeloffset: 10, labelpos: "r" }, gi = ["labelpos"];
|
|
1494
|
-
function pi(e) {
|
|
1495
|
-
let t = new B({ multigraph: !0, compound: !0 }), n = De(e.graph());
|
|
1496
|
-
return t.setGraph(Object.assign({}, di, Re(n, si), xe(n, ci))), e.nodes().forEach((r) => {
|
|
1497
|
-
let o = De(e.node(r)), i = Re(o, ui);
|
|
1498
|
-
Object.keys(It).forEach((l) => {
|
|
1499
|
-
i[l] === void 0 && (i[l] = It[l]);
|
|
1500
|
-
}), t.setNode(r, i);
|
|
1501
|
-
let a = e.parent(r);
|
|
1502
|
-
a !== void 0 && t.setParent(r, a);
|
|
1503
|
-
}), e.edges().forEach((r) => {
|
|
1504
|
-
let o = De(e.edge(r));
|
|
1505
|
-
t.setEdge(r, Object.assign({}, hi, Re(o, fi), xe(o, gi)));
|
|
1506
|
-
}), t;
|
|
1507
|
-
}
|
|
1508
|
-
function mi(e) {
|
|
1509
|
-
let t = e.graph();
|
|
1510
|
-
t.ranksep /= 2, e.edges().forEach((n) => {
|
|
1511
|
-
let r = e.edge(n);
|
|
1512
|
-
r.minlen *= 2, r.labelpos.toLowerCase() !== "c" && (t.rankdir === "TB" || t.rankdir === "BT" ? r.width += r.labeloffset : r.height += r.labeloffset);
|
|
1513
|
-
});
|
|
1514
|
-
}
|
|
1515
|
-
function bi(e) {
|
|
1516
|
-
e.edges().forEach((t) => {
|
|
1517
|
-
let n = e.edge(t);
|
|
1518
|
-
if (n.width && n.height) {
|
|
1519
|
-
let r = e.node(t.v), o = { rank: (e.node(t.w).rank - r.rank) / 2 + r.rank, e: t };
|
|
1520
|
-
ce(e, "edge-proxy", o, "_ep");
|
|
1521
|
-
}
|
|
1522
|
-
});
|
|
1523
|
-
}
|
|
1524
|
-
function yi(e) {
|
|
1525
|
-
let t = 0;
|
|
1526
|
-
e.nodes().forEach((n) => {
|
|
1527
|
-
let r = e.node(n);
|
|
1528
|
-
r.borderTop && (r.minRank = e.node(r.borderTop).rank, r.maxRank = e.node(r.borderBottom).rank, t = Math.max(t, r.maxRank));
|
|
1529
|
-
}), e.graph().maxRank = t;
|
|
1530
|
-
}
|
|
1531
|
-
function Ei(e) {
|
|
1532
|
-
e.nodes().forEach((t) => {
|
|
1533
|
-
let n = e.node(t);
|
|
1534
|
-
if (n.dummy === "edge-proxy") {
|
|
1535
|
-
let r = n;
|
|
1536
|
-
e.edge(r.e).labelRank = n.rank, e.removeNode(t);
|
|
1537
|
-
}
|
|
1538
|
-
});
|
|
1539
|
-
}
|
|
1540
|
-
function wi(e) {
|
|
1541
|
-
let t = Number.POSITIVE_INFINITY, n = 0, r = Number.POSITIVE_INFINITY, o = 0, i = e.graph(), a = i.marginx || 0, l = i.marginy || 0;
|
|
1542
|
-
function d(s) {
|
|
1543
|
-
let u = s.x, f = s.y, h = s.width, g = s.height;
|
|
1544
|
-
t = Math.min(t, u - h / 2), n = Math.max(n, u + h / 2), r = Math.min(r, f - g / 2), o = Math.max(o, f + g / 2);
|
|
1545
|
-
}
|
|
1546
|
-
e.nodes().forEach((s) => d(e.node(s))), e.edges().forEach((s) => {
|
|
1547
|
-
let u = e.edge(s);
|
|
1548
|
-
Object.hasOwn(u, "x") && d(u);
|
|
1549
|
-
}), t -= a, r -= l, e.nodes().forEach((s) => {
|
|
1550
|
-
let u = e.node(s);
|
|
1551
|
-
u.x -= t, u.y -= r;
|
|
1552
|
-
}), e.edges().forEach((s) => {
|
|
1553
|
-
let u = e.edge(s);
|
|
1554
|
-
u.points.forEach((f) => {
|
|
1555
|
-
f.x -= t, f.y -= r;
|
|
1556
|
-
}), Object.hasOwn(u, "x") && (u.x -= t), Object.hasOwn(u, "y") && (u.y -= r);
|
|
1557
|
-
}), i.width = n - t + a, i.height = o - r + l;
|
|
1558
|
-
}
|
|
1559
|
-
function vi(e) {
|
|
1560
|
-
e.edges().forEach((t) => {
|
|
1561
|
-
let n = e.edge(t), r = e.node(t.v), o = e.node(t.w), i, a;
|
|
1562
|
-
n.points ? (i = n.points[0], a = n.points[n.points.length - 1]) : (n.points = [], i = o, a = r), n.points.unshift(Et(r, i)), n.points.push(Et(o, a));
|
|
1563
|
-
});
|
|
1564
|
-
}
|
|
1565
|
-
function ki(e) {
|
|
1566
|
-
e.edges().forEach((t) => {
|
|
1567
|
-
let n = e.edge(t);
|
|
1568
|
-
if (Object.hasOwn(n, "x")) switch ((n.labelpos === "l" || n.labelpos === "r") && (n.width -= n.labeloffset), n.labelpos) {
|
|
1569
|
-
case "l":
|
|
1570
|
-
n.x -= n.width / 2 + n.labeloffset;
|
|
1571
|
-
break;
|
|
1572
|
-
case "r":
|
|
1573
|
-
n.x += n.width / 2 + n.labeloffset;
|
|
1574
|
-
break;
|
|
1575
|
-
}
|
|
1576
|
-
});
|
|
1577
|
-
}
|
|
1578
|
-
function xi(e) {
|
|
1579
|
-
e.edges().forEach((t) => {
|
|
1580
|
-
let n = e.edge(t);
|
|
1581
|
-
n.reversed && n.points.reverse();
|
|
1582
|
-
});
|
|
1583
|
-
}
|
|
1584
|
-
function _i(e) {
|
|
1585
|
-
e.nodes().forEach((t) => {
|
|
1586
|
-
if (e.children(t).length) {
|
|
1587
|
-
let n = e.node(t), r = e.node(n.borderTop), o = e.node(n.borderBottom), i = e.node(n.borderLeft[n.borderLeft.length - 1]), a = e.node(n.borderRight[n.borderRight.length - 1]);
|
|
1588
|
-
n.width = Math.abs(a.x - i.x), n.height = Math.abs(o.y - r.y), n.x = i.x + n.width / 2, n.y = r.y + n.height / 2;
|
|
1589
|
-
}
|
|
1590
|
-
}), e.nodes().forEach((t) => {
|
|
1591
|
-
e.node(t).dummy === "border" && e.removeNode(t);
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
function Ti(e) {
|
|
1595
|
-
e.edges().forEach((t) => {
|
|
1596
|
-
if (t.v === t.w) {
|
|
1597
|
-
let n = e.node(t.v);
|
|
1598
|
-
n.selfEdges || (n.selfEdges = []), n.selfEdges.push({ e: t, label: e.edge(t) }), e.removeEdge(t);
|
|
1599
|
-
}
|
|
1600
|
-
});
|
|
1601
|
-
}
|
|
1602
|
-
function Ni(e) {
|
|
1603
|
-
pe(e).forEach((t) => {
|
|
1604
|
-
let n = 0;
|
|
1605
|
-
t.forEach((r, o) => {
|
|
1606
|
-
let i = e.node(r);
|
|
1607
|
-
i.order = o + n, (i.selfEdges || []).forEach((a) => {
|
|
1608
|
-
ce(e, "selfedge", { width: a.label.width, height: a.label.height, rank: i.rank, order: o + ++n, e: a.e, label: a.label }, "_se");
|
|
1609
|
-
}), delete i.selfEdges;
|
|
1610
|
-
});
|
|
1611
|
-
});
|
|
1612
|
-
}
|
|
1613
|
-
function Ci(e) {
|
|
1614
|
-
e.nodes().forEach((t) => {
|
|
1615
|
-
let n = e.node(t);
|
|
1616
|
-
if (n.dummy === "selfedge") {
|
|
1617
|
-
let r = n, o = e.node(r.e.v), i = o.x + o.width / 2, a = o.y, l = n.x - i, d = o.height / 2;
|
|
1618
|
-
e.setEdge(r.e, r.label), e.removeNode(t), r.label.points = [{ x: i + 2 * l / 3, y: a - d }, { x: i + 5 * l / 6, y: a - d }, { x: i + l, y: a }, { x: i + 5 * l / 6, y: a + d }, { x: i + 2 * l / 3, y: a + d }], r.label.x = n.x, r.label.y = n.y;
|
|
1619
|
-
}
|
|
1620
|
-
});
|
|
1621
|
-
}
|
|
1622
|
-
function Re(e, t) {
|
|
1623
|
-
return _e(xe(e, t), Number);
|
|
1624
|
-
}
|
|
1625
|
-
function De(e) {
|
|
1626
|
-
let t = {};
|
|
1627
|
-
return e && Object.entries(e).forEach(([n, r]) => {
|
|
1628
|
-
typeof n == "string" && (n = n.toLowerCase()), t[n] = r;
|
|
1629
|
-
}), t;
|
|
1630
|
-
}
|
|
1631
|
-
function Si(e) {
|
|
1632
|
-
let t = pe(e), n = new B({ compound: !0, multigraph: !0 }).setGraph({});
|
|
1633
|
-
return e.nodes().forEach((r) => {
|
|
1634
|
-
n.setNode(r, { label: r }), n.setParent(r, "layer" + e.node(r).rank);
|
|
1635
|
-
}), e.edges().forEach((r) => n.setEdge(r.v, r.w, {}, r.name)), t.forEach((r, o) => {
|
|
1636
|
-
let i = "layer" + o;
|
|
1637
|
-
n.setNode(i, { rank: "same" }), r.reduce((a, l) => (n.setEdge(a, l, { style: "invis" }), l));
|
|
1638
|
-
}), n;
|
|
1639
|
-
}
|
|
1640
|
-
var Ii = { graphlib: Wt, version: Pr, layout: ii, debug: Si, util: { time: Qt, notime: en } }, Ot = Ii;
|
|
1641
|
-
/*! For license information please see dagre.esm.js.LEGAL.txt */
|
|
1642
|
-
const Oi = (e) => {
|
|
1643
|
-
const t = [];
|
|
1644
|
-
return e.nodeInternals.forEach((n, r) => t.push(`${r}:${n.height ?? 0}`)), t.join(",");
|
|
1645
|
-
}, Mi = ({ onHeightsReady: e, nodeCount: t }) => {
|
|
1646
|
-
const n = xn(Oi), r = ht("");
|
|
1647
|
-
ht(0);
|
|
1648
|
-
const { fitView: o } = _n();
|
|
1649
|
-
return re(() => {
|
|
1650
|
-
if (!n || n === r.current) return;
|
|
1651
|
-
const i = {};
|
|
1652
|
-
for (const a of n.split(",")) {
|
|
1653
|
-
const [l, d] = a.split(":"), s = Number(d);
|
|
1654
|
-
l && s > 0 && (i[l] = s);
|
|
1655
|
-
}
|
|
1656
|
-
Object.keys(i).length !== 0 && (r.current = n, e(i));
|
|
1657
|
-
}, [n]), null;
|
|
1658
|
-
}, Ne = ({ isOpen: e, onClose: t, title: n, icon: r, children: o, footer: i, width: a = 600 }) => {
|
|
1659
|
-
const [l, d] = M(!1), s = () => d((h) => !h), u = () => /* @__PURE__ */ c.createElement(Q, { sx: { display: "flex", alignItems: "center", p: 2, pt: 3, borderBottom: "1px solid #e0e0e0", mb: 0, flexShrink: 0 } }, r && /* @__PURE__ */ c.createElement(Q, { sx: { mr: 1.5, display: "flex", alignItems: "center", fontSize: "1.25rem", color: "#1DBF60" } }, r), /* @__PURE__ */ c.createElement(Ln, { variant: "h6", component: "div", sx: { flexGrow: 1, fontSize: "0.875rem", fontWeight: 600 } }, n), /* @__PURE__ */ c.createElement(gt, { onClick: s, size: "small", sx: { mr: 1 }, title: l ? "Collapse" : "Expand", "data-testid": "expand-collapse-base-drawer-btn" }, l ? /* @__PURE__ */ c.createElement(er, null) : /* @__PURE__ */ c.createElement(tr, null)), /* @__PURE__ */ c.createElement(gt, { onClick: t, size: "small", "data-testid": "close-drawer-button" }, /* @__PURE__ */ c.createElement(An, null))), f = () => i ? /* @__PURE__ */ c.createElement(Q, { sx: { flexShrink: 0, p: 2, borderTop: "1px solid #e0e0e0", display: "flex", justifyContent: "flex-end", gap: 2 } }, i) : null;
|
|
1660
|
-
return l ? /* @__PURE__ */ c.createElement(Rn, { open: e, onClose: t, maxWidth: !1, fullWidth: !0, PaperProps: { sx: { display: "flex", flexDirection: "column", height: "80vh", boxShadow: 24, width: "750px", maxWidth: "100%" } } }, /* @__PURE__ */ c.createElement(u, null), /* @__PURE__ */ c.createElement(Q, { sx: { flexGrow: 1, overflowY: "auto", p: 0 } }, o), /* @__PURE__ */ c.createElement(f, null)) : /* @__PURE__ */ c.createElement(
|
|
1661
|
-
Dn,
|
|
1662
|
-
{
|
|
1663
|
-
anchor: "right",
|
|
1664
|
-
open: e,
|
|
1665
|
-
onClose: t,
|
|
1666
|
-
variant: "persistent",
|
|
1667
|
-
sx: { zIndex: 900 },
|
|
1668
|
-
ModalProps: { keepMounted: !1 },
|
|
1669
|
-
PaperProps: {
|
|
1670
|
-
sx: {
|
|
1671
|
-
width: a,
|
|
1672
|
-
position: "fixed",
|
|
1673
|
-
top: "64px",
|
|
1674
|
-
height: "calc(100% - 74px)",
|
|
1675
|
-
right: "10px",
|
|
1676
|
-
borderRadius: "8px",
|
|
1677
|
-
border: "1px solid #bdbdbd",
|
|
1678
|
-
boxShadow: "none",
|
|
1679
|
-
zIndex: 900,
|
|
1680
|
-
display: "flex",
|
|
1681
|
-
flexDirection: "column"
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
},
|
|
1685
|
-
/* @__PURE__ */ c.createElement(u, null),
|
|
1686
|
-
/* @__PURE__ */ c.createElement(Q, { sx: { flexGrow: 1, overflowY: "auto", p: 0 } }, o),
|
|
1687
|
-
/* @__PURE__ */ c.createElement(f, null)
|
|
1688
|
-
);
|
|
1689
|
-
}, ji = ({ open: e, templates: t, messages: n, onSelect: r, onClose: o }) => /* @__PURE__ */ c.createElement(Ne, { isOpen: e, onClose: o, title: n.addTriggerTitle, icon: /* @__PURE__ */ c.createElement(Qn, null), width: 500 }, /* @__PURE__ */ c.createElement(Q, { sx: { p: 2 } }, /* @__PURE__ */ c.createElement("p", { className: "ff-text-muted ff-mb-3", style: { fontSize: 13 } }, n.chooseTrigger), /* @__PURE__ */ c.createElement("div", { className: "ff-d-flex ff-flex-column ff-gap-2" }, t.map((i) => /* @__PURE__ */ c.createElement(
|
|
1690
|
-
"div",
|
|
1691
|
-
{
|
|
1692
|
-
key: i.triggerKey,
|
|
1693
|
-
className: "ff-p-3 ff-rounded ff-border ff-d-flex ff-align-items-start ff-gap-3",
|
|
1694
|
-
style: { cursor: "pointer", transition: "background 0.15s" },
|
|
1695
|
-
onClick: () => r(i),
|
|
1696
|
-
role: "button",
|
|
1697
|
-
tabIndex: 0,
|
|
1698
|
-
onKeyDown: (a) => {
|
|
1699
|
-
a.key === "Enter" && r(i);
|
|
1700
|
-
},
|
|
1701
|
-
onMouseEnter: (a) => {
|
|
1702
|
-
a.currentTarget.style.background = "#f5f5f5";
|
|
1703
|
-
},
|
|
1704
|
-
onMouseLeave: (a) => {
|
|
1705
|
-
a.currentTarget.style.background = "";
|
|
1706
|
-
}
|
|
1707
|
-
},
|
|
1708
|
-
/* @__PURE__ */ c.createElement("div", { style: { color: i.triggerCategory === "scheduler" ? "#1976d2" : "#f57c00", marginTop: 2, flexShrink: 0 } }, i.triggerCategory === "scheduler" ? /* @__PURE__ */ c.createElement(Pn, { size: 18 }) : /* @__PURE__ */ c.createElement(Bn, { size: 18 })),
|
|
1709
|
-
/* @__PURE__ */ c.createElement("div", null, /* @__PURE__ */ c.createElement("div", { style: { fontSize: 14, fontWeight: 600, color: "#212121" } }, i.label), i.description && /* @__PURE__ */ c.createElement("div", { style: { fontSize: 12, color: "#757575", marginTop: 2 } }, i.description))
|
|
1710
|
-
)), t.length === 0 && /* @__PURE__ */ c.createElement("p", { className: "ff-text-muted ff-text-center", style: { fontSize: 13 } }, n.noTriggers)))), Le = {
|
|
1711
|
-
cursor: "pointer",
|
|
1712
|
-
transition: "background 0.15s"
|
|
1713
|
-
}, Ae = "ff-p-3 ff-rounded ff-border ff-d-flex ff-align-items-center ff-gap-3", Fi = ({ open: e, availableDescriptors: t, messages: n, onSelect: r, onClose: o }) => {
|
|
1714
|
-
const { apps: i, ungrouped: a } = P(() => {
|
|
1715
|
-
const f = /* @__PURE__ */ new Map(), h = [];
|
|
1716
|
-
for (const g of t)
|
|
1717
|
-
if (g.app) {
|
|
1718
|
-
const m = f.get(g.app.key);
|
|
1719
|
-
m ? m.descriptors.push(g) : f.set(g.app.key, {
|
|
1720
|
-
key: g.app.key,
|
|
1721
|
-
label: g.app.label,
|
|
1722
|
-
icon: g.app.icon,
|
|
1723
|
-
description: g.app.description,
|
|
1724
|
-
descriptors: [g]
|
|
1725
|
-
});
|
|
1726
|
-
} else
|
|
1727
|
-
h.push(g);
|
|
1728
|
-
return { apps: [...f.values()], ungrouped: h };
|
|
1729
|
-
}, [t]), [l, d] = M(null), s = l ? i.find((f) => f.key === l) ?? null : null;
|
|
1730
|
-
re(() => {
|
|
1731
|
-
e || d(null);
|
|
1732
|
-
}, [e]), re(() => {
|
|
1733
|
-
d(null);
|
|
1734
|
-
}, [t]);
|
|
1735
|
-
const u = !s;
|
|
1736
|
-
return /* @__PURE__ */ c.createElement(
|
|
1737
|
-
Ne,
|
|
1738
|
-
{
|
|
1739
|
-
isOpen: e,
|
|
1740
|
-
onClose: o,
|
|
1741
|
-
title: u ? n.addStepTitle : s.label,
|
|
1742
|
-
icon: u ? /* @__PURE__ */ c.createElement(Wn, null) : s.icon ?? /* @__PURE__ */ c.createElement(Gn, null),
|
|
1743
|
-
width: 500
|
|
1744
|
-
},
|
|
1745
|
-
/* @__PURE__ */ c.createElement(Q, { sx: { p: 2 } }, !u && /* @__PURE__ */ c.createElement(
|
|
1746
|
-
"div",
|
|
1747
|
-
{
|
|
1748
|
-
role: "button",
|
|
1749
|
-
tabIndex: 0,
|
|
1750
|
-
onClick: () => d(null),
|
|
1751
|
-
onKeyDown: (f) => {
|
|
1752
|
-
f.key === "Enter" && d(null);
|
|
1753
|
-
},
|
|
1754
|
-
className: "ff-d-flex ff-align-items-center ff-gap-1 ff-mb-3",
|
|
1755
|
-
style: { cursor: "pointer", color: "#0066cc", fontSize: 13, fontWeight: 500, width: "fit-content" }
|
|
1756
|
-
},
|
|
1757
|
-
/* @__PURE__ */ c.createElement($n, { size: 16 }),
|
|
1758
|
-
/* @__PURE__ */ c.createElement("span", null, n.addStepTitle)
|
|
1759
|
-
), /* @__PURE__ */ c.createElement("p", { className: "ff-text-muted ff-mb-3", style: { fontSize: 13 } }, u ? n.chooseAction : `Pick an action from ${s.label}`), /* @__PURE__ */ c.createElement("div", { className: "ff-d-flex ff-flex-column ff-gap-2" }, u ? /* @__PURE__ */ c.createElement(c.Fragment, null, i.map((f) => /* @__PURE__ */ c.createElement(
|
|
1760
|
-
"div",
|
|
1761
|
-
{
|
|
1762
|
-
key: `app-${f.key}`,
|
|
1763
|
-
className: Ae,
|
|
1764
|
-
style: Le,
|
|
1765
|
-
onClick: () => d(f.key),
|
|
1766
|
-
role: "button",
|
|
1767
|
-
tabIndex: 0,
|
|
1768
|
-
onKeyDown: (h) => {
|
|
1769
|
-
h.key === "Enter" && d(f.key);
|
|
1770
|
-
},
|
|
1771
|
-
onMouseEnter: (h) => {
|
|
1772
|
-
h.currentTarget.style.background = "#f5f5f5";
|
|
1773
|
-
},
|
|
1774
|
-
onMouseLeave: (h) => {
|
|
1775
|
-
h.currentTarget.style.background = "";
|
|
1776
|
-
}
|
|
1777
|
-
},
|
|
1778
|
-
f.icon && /* @__PURE__ */ c.createElement("div", { style: { flexShrink: 0 } }, f.icon),
|
|
1779
|
-
/* @__PURE__ */ c.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ c.createElement("div", { style: { fontSize: 14, fontWeight: 600, color: "#212121" } }, f.label), /* @__PURE__ */ c.createElement("div", { style: { fontSize: 12, color: "#757575", marginTop: 2 } }, f.description ?? `${f.descriptors.length} action${f.descriptors.length === 1 ? "" : "s"}`)),
|
|
1780
|
-
/* @__PURE__ */ c.createElement(Rt, { size: 18, color: "#9e9e9e" })
|
|
1781
|
-
)), a.map((f) => /* @__PURE__ */ c.createElement(
|
|
1782
|
-
"div",
|
|
1783
|
-
{
|
|
1784
|
-
key: f.type,
|
|
1785
|
-
className: Ae,
|
|
1786
|
-
style: Le,
|
|
1787
|
-
onClick: () => r(f),
|
|
1788
|
-
role: "button",
|
|
1789
|
-
tabIndex: 0,
|
|
1790
|
-
onKeyDown: (h) => {
|
|
1791
|
-
h.key === "Enter" && r(f);
|
|
1792
|
-
},
|
|
1793
|
-
onMouseEnter: (h) => {
|
|
1794
|
-
h.currentTarget.style.background = "#f5f5f5";
|
|
1795
|
-
},
|
|
1796
|
-
onMouseLeave: (h) => {
|
|
1797
|
-
h.currentTarget.style.background = "";
|
|
1798
|
-
}
|
|
1799
|
-
},
|
|
1800
|
-
f.icon && /* @__PURE__ */ c.createElement("div", { style: { flexShrink: 0 } }, f.icon),
|
|
1801
|
-
/* @__PURE__ */ c.createElement("span", { style: { fontSize: 14, fontWeight: 500, color: "#212121" } }, f.label)
|
|
1802
|
-
)), i.length === 0 && a.length === 0 && /* @__PURE__ */ c.createElement("p", { className: "ff-text-muted ff-text-center", style: { fontSize: 13 } }, n.noActions)) : (
|
|
1803
|
-
/* Stage 2 — actions for the selected app */
|
|
1804
|
-
s.descriptors.map((f) => /* @__PURE__ */ c.createElement(
|
|
1805
|
-
"div",
|
|
1806
|
-
{
|
|
1807
|
-
key: f.type,
|
|
1808
|
-
className: Ae,
|
|
1809
|
-
style: Le,
|
|
1810
|
-
onClick: () => r(f),
|
|
1811
|
-
role: "button",
|
|
1812
|
-
tabIndex: 0,
|
|
1813
|
-
onKeyDown: (h) => {
|
|
1814
|
-
h.key === "Enter" && r(f);
|
|
1815
|
-
},
|
|
1816
|
-
onMouseEnter: (h) => {
|
|
1817
|
-
h.currentTarget.style.background = "#f5f5f5";
|
|
1818
|
-
},
|
|
1819
|
-
onMouseLeave: (h) => {
|
|
1820
|
-
h.currentTarget.style.background = "";
|
|
1821
|
-
}
|
|
1822
|
-
},
|
|
1823
|
-
f.icon && /* @__PURE__ */ c.createElement("div", { style: { flexShrink: 0 } }, f.icon),
|
|
1824
|
-
/* @__PURE__ */ c.createElement("span", { style: { fontSize: 14, fontWeight: 500, color: "#212121" } }, f.label)
|
|
1825
|
-
))
|
|
1826
|
-
)))
|
|
1827
|
-
);
|
|
1828
|
-
}, Mt = "_conditionConfig", zi = ({ open: e, nodeId: t, descriptor: n, initialValues: r, messages: o, onSave: i, onClose: a }) => {
|
|
1829
|
-
const [l, d] = M([]), [s, u] = M(!1), [f, h] = M(null), [g, m] = M({});
|
|
1830
|
-
re(() => {
|
|
1831
|
-
m((r == null ? void 0 : r[Mt]) ?? {});
|
|
1832
|
-
}, [r, t]), re(() => {
|
|
1833
|
-
let T = !1;
|
|
1834
|
-
if (h(null), !n || !t) {
|
|
1835
|
-
d([]), u(!1);
|
|
1836
|
-
return;
|
|
1837
|
-
}
|
|
1838
|
-
const I = n.formSchema;
|
|
1839
|
-
return typeof I == "function" ? (u(!0), I(t).then((O) => {
|
|
1840
|
-
T || (d(O), u(!1));
|
|
1841
|
-
}).catch((O) => {
|
|
1842
|
-
T || (d([]), h(O instanceof Error ? O.message : "Unable to load configuration."), u(!1));
|
|
1843
|
-
})) : (d(I), u(!1)), () => {
|
|
1844
|
-
T = !0;
|
|
1845
|
-
};
|
|
1846
|
-
}, [n, t]);
|
|
1847
|
-
const b = t ? `node-config-form-${t}` : "node-config-form", p = !s && !f && l.length > 0, E = p ? /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(pt, { type: "button", variant: "outlined", size: "small", onClick: a }, o.cancel), /* @__PURE__ */ c.createElement(pt, { type: "submit", form: b, variant: "contained", size: "small" }, o.save)) : null;
|
|
1848
|
-
return /* @__PURE__ */ c.createElement(
|
|
1849
|
-
Ne,
|
|
1850
|
-
{
|
|
1851
|
-
isOpen: e,
|
|
1852
|
-
onClose: a,
|
|
1853
|
-
title: (n == null ? void 0 : n.label) ?? o.configureStep,
|
|
1854
|
-
icon: n == null ? void 0 : n.icon,
|
|
1855
|
-
width: 500,
|
|
1856
|
-
footer: E
|
|
1857
|
-
},
|
|
1858
|
-
/* @__PURE__ */ c.createElement(Q, { sx: { p: 2 } }, s && /* @__PURE__ */ c.createElement("p", { className: "ff-text-muted", style: { fontSize: 13 } }, o.loadingConfiguration), !s && f && /* @__PURE__ */ c.createElement("p", { style: { fontSize: 13, color: "#d32f2f" } }, f), !s && !f && l.length === 0 && /* @__PURE__ */ c.createElement("p", { className: "ff-text-muted", style: { fontSize: 13 } }, o.noConfigurationNeeded), p && /* @__PURE__ */ c.createElement(
|
|
1859
|
-
nr,
|
|
1860
|
-
{
|
|
1861
|
-
schema: { layout: "flat", fields: l },
|
|
1862
|
-
initialValues: r ?? {},
|
|
1863
|
-
formId: b,
|
|
1864
|
-
conditionConfig: g,
|
|
1865
|
-
onConditionConfigChange: m,
|
|
1866
|
-
onSubmit: (T) => {
|
|
1867
|
-
if (!t) return;
|
|
1868
|
-
const I = Object.keys(g).length > 0;
|
|
1869
|
-
i(t, { ...T, [Mt]: I ? g : void 0 }), a();
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
))
|
|
1873
|
-
);
|
|
1874
|
-
}, Ri = ({
|
|
1875
|
-
isOpen: e,
|
|
1876
|
-
onClose: t,
|
|
1877
|
-
workflowId: n,
|
|
1878
|
-
workflowLabel: r,
|
|
1879
|
-
onFetchWorkflow: o
|
|
1880
|
-
}) => {
|
|
1881
|
-
const [i, a] = M({ status: "idle" });
|
|
1882
|
-
return re(() => {
|
|
1883
|
-
if (!e || !n) {
|
|
1884
|
-
a({ status: "idle" });
|
|
1885
|
-
return;
|
|
1886
|
-
}
|
|
1887
|
-
a({ status: "loading" }), o(n).then((l) => a({ status: "loaded", state: l })).catch((l) => a({ status: "error", message: (l == null ? void 0 : l.message) ?? "Failed to load workflow" }));
|
|
1888
|
-
}, [e, n, o]), /* @__PURE__ */ c.createElement(
|
|
1889
|
-
Ne,
|
|
1890
|
-
{
|
|
1891
|
-
isOpen: e,
|
|
1892
|
-
onClose: t,
|
|
1893
|
-
title: r ? `Preview: ${r}` : "Sub-Workflow Preview",
|
|
1894
|
-
icon: /* @__PURE__ */ c.createElement(Yn, { size: 18, color: "#00695c" }),
|
|
1895
|
-
width: 700
|
|
1896
|
-
},
|
|
1897
|
-
/* @__PURE__ */ c.createElement("div", { style: { height: "100%", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", padding: 24 } }, i.status === "idle" && /* @__PURE__ */ c.createElement("span", { style: { color: "#9e9e9e", fontSize: 14 } }, "Select a workflow to preview"), i.status === "loading" && /* @__PURE__ */ c.createElement("div", { style: { textAlign: "center", color: "#9e9e9e" } }, /* @__PURE__ */ c.createElement("div", { style: { width: 32, height: 32, borderRadius: "50%", border: "3px solid #e0e0e0", borderTopColor: "#00897b", animation: "spin 0.8s linear infinite", margin: "0 auto 12px" } }), /* @__PURE__ */ c.createElement("span", { style: { fontSize: 14 } }, "Loading workflow…"), /* @__PURE__ */ c.createElement("style", null, "@keyframes spin { to { transform: rotate(360deg); } }")), i.status === "error" && /* @__PURE__ */ c.createElement("div", { style: { textAlign: "center", color: "#c62828" } }, /* @__PURE__ */ c.createElement(Kn, { size: 32, style: { marginBottom: 8 } }), /* @__PURE__ */ c.createElement("p", { style: { margin: 0, fontSize: 14 } }, i.message)), i.status === "loaded" && /* @__PURE__ */ c.createElement("div", { style: { width: "100%", flex: 1 } }, /* @__PURE__ */ c.createElement(Di, { state: i.state })))
|
|
1898
|
-
);
|
|
1899
|
-
}, Di = ({ state: e }) => {
|
|
1900
|
-
const [t, n] = M(null), [r, o] = M(null);
|
|
1901
|
-
return re(() => {
|
|
1902
|
-
Promise.all([
|
|
1903
|
-
Promise.resolve().then(() => Gi).then((i) => i.default),
|
|
1904
|
-
import("./nodeRegistry.js").then((i) => i.nodeTypeRegistry),
|
|
1905
|
-
import("./templateRegistry.js").then((i) => i.templateRegistry)
|
|
1906
|
-
]).then(([i, a, l]) => {
|
|
1907
|
-
n(() => i), o({ nodeTypeRegistry: a, templateRegistry: l });
|
|
1908
|
-
});
|
|
1909
|
-
}, []), !t || !r ? /* @__PURE__ */ c.createElement("div", { style: { color: "#9e9e9e", fontSize: 13, textAlign: "center" } }, "Loading canvas…") : /* @__PURE__ */ c.createElement("div", { style: { width: "100%", height: 480, border: "1px solid #e0e0e0", borderRadius: 8, overflow: "hidden" } }, /* @__PURE__ */ c.createElement(
|
|
1910
|
-
t,
|
|
1911
|
-
{
|
|
1912
|
-
nodeRegistry: r.nodeTypeRegistry,
|
|
1913
|
-
templateRegistry: r.templateRegistry,
|
|
1914
|
-
initialValue: e,
|
|
1915
|
-
readOnly: !0
|
|
1916
|
-
}
|
|
1917
|
-
));
|
|
1918
|
-
}, ge = 350, We = 70, Ge = 60, $e = {
|
|
1919
|
-
startNode: 40,
|
|
1920
|
-
endNode: 40,
|
|
1921
|
-
addTriggerNode: 56,
|
|
1922
|
-
triggerNode: 110,
|
|
1923
|
-
actionNode: 90,
|
|
1924
|
-
filterNode: 90,
|
|
1925
|
-
approvalNode: 90,
|
|
1926
|
-
delayNode: 80,
|
|
1927
|
-
notificationNode: 80
|
|
1928
|
-
}, Li = {
|
|
1929
|
-
plusEdge: Fn,
|
|
1930
|
-
labelPlusEdge: jn,
|
|
1931
|
-
plainEdge: Mn,
|
|
1932
|
-
edgeWithPlusLabel: On,
|
|
1933
|
-
gatewayBranchEdge: In
|
|
1934
|
-
};
|
|
1935
|
-
function jt() {
|
|
1936
|
-
return [
|
|
1937
|
-
{ id: "start", kind: "start", reactFlowType: "startNode" },
|
|
1938
|
-
{ id: "addTrigger", kind: "addTrigger", reactFlowType: "addTriggerNode" },
|
|
1939
|
-
{ id: "end", kind: "end", reactFlowType: "endNode" }
|
|
1940
|
-
];
|
|
1941
|
-
}
|
|
1942
|
-
function Ai(e, t, n, r = "TB") {
|
|
1943
|
-
const o = new Ot.graphlib.Graph();
|
|
1944
|
-
return o.setGraph({ rankdir: r, ranksep: 70, nodesep: 50 }), o.setDefaultEdgeLabel(() => ({})), e.forEach((i) => {
|
|
1945
|
-
const a = n[i.id] ?? { width: ge, height: $e[i.type ?? ""] ?? 80 };
|
|
1946
|
-
o.setNode(i.id, { width: a.width, height: a.height });
|
|
1947
|
-
}), t.forEach((i) => o.setEdge(i.source, i.target)), Ot.layout(o), e.map((i) => {
|
|
1948
|
-
var s, u;
|
|
1949
|
-
const a = o.node(i.id), l = ((s = n[i.id]) == null ? void 0 : s.width) ?? ge, d = ((u = n[i.id]) == null ? void 0 : u.height) ?? $e[i.type ?? ""] ?? 80;
|
|
1950
|
-
return { ...i, position: { x: a.x - l / 2, y: a.y - d / 2 } };
|
|
1951
|
-
});
|
|
1952
|
-
}
|
|
1953
|
-
const ne = (e) => e === "filter" || e === "approval";
|
|
1954
|
-
function Pi(e, t, n, r) {
|
|
1955
|
-
const a = We, l = 30, d = 30, s = {}, u = {}, f = /* @__PURE__ */ new Map();
|
|
1956
|
-
for (const p of e) f.set(p.id, p);
|
|
1957
|
-
for (const p of Object.values(t))
|
|
1958
|
-
for (const E of Object.values(p))
|
|
1959
|
-
for (const T of E) f.set(T.id, T);
|
|
1960
|
-
const h = (p, E, T) => {
|
|
1961
|
-
const I = r[p] ?? { width: ge, height: 80 };
|
|
1962
|
-
return s[p] = { x: E - I.width / 2, y: T }, T + I.height;
|
|
1963
|
-
}, g = (p, E, T) => {
|
|
1964
|
-
let I = T;
|
|
1965
|
-
for (const O of p)
|
|
1966
|
-
I = h(O.id, E, I) + a, ne(O.kind) && t[O.id] && (I = m(O.id, E, I));
|
|
1967
|
-
return I;
|
|
1968
|
-
}, m = (p, E, T) => {
|
|
1969
|
-
const I = E + 180, O = t[p], j = Object.keys(O), A = f.get(p), ee = (A == null ? void 0 : A.branchLabels) ?? { pass: "Pass", fail: "Fail" }, ue = s[p], F = r[p] ?? { height: 80 }, me = ue.y + F.height, be = [];
|
|
1970
|
-
let Y = T;
|
|
1971
|
-
return j.forEach((ie, H) => {
|
|
1972
|
-
const z = O[ie], q = Y;
|
|
1973
|
-
be.push({
|
|
1974
|
-
y: q - me,
|
|
1975
|
-
label: ee[ie] ?? ie,
|
|
1976
|
-
isPass: H === 0
|
|
1977
|
-
}), Y = g(z, I, Y + d), H < j.length - 1 && (Y += l);
|
|
1978
|
-
}), u[p] = {
|
|
1979
|
-
branches: be,
|
|
1980
|
-
height: Y - me,
|
|
1981
|
-
indent: 180
|
|
1982
|
-
}, Y;
|
|
1983
|
-
};
|
|
1984
|
-
let b = Ge;
|
|
1985
|
-
for (const p of e)
|
|
1986
|
-
b = h(p.id, 400, b) + a, ne(p.kind) && t[p.id] && (b = m(p.id, 400, b));
|
|
1987
|
-
return {
|
|
1988
|
-
nodes: n.map((p) => s[p.id] ? { ...p, position: s[p.id] } : p),
|
|
1989
|
-
railSpecs: u
|
|
1990
|
-
};
|
|
1991
|
-
}
|
|
1992
|
-
function Ft(e) {
|
|
1993
|
-
return {
|
|
1994
|
-
id: e.id,
|
|
1995
|
-
type: e.reactFlowType,
|
|
1996
|
-
position: { x: 0, y: 0 },
|
|
1997
|
-
data: { ...e.nodeData, ...e.formData, descriptorType: e.descriptorType },
|
|
1998
|
-
draggable: !1,
|
|
1999
|
-
selectable: !1
|
|
2000
|
-
};
|
|
2001
|
-
}
|
|
2002
|
-
function Bi(e, t, n, r, o) {
|
|
2003
|
-
return {
|
|
2004
|
-
id: `e-${e.id}-${t.id}`,
|
|
2005
|
-
source: e.id,
|
|
2006
|
-
target: t.id,
|
|
2007
|
-
type: "plusEdge",
|
|
2008
|
-
style: { stroke: n },
|
|
2009
|
-
data: {
|
|
2010
|
-
onAddStepClick: r,
|
|
2011
|
-
referenceNodeType: e.reactFlowType,
|
|
2012
|
-
...o ?? {}
|
|
2013
|
-
}
|
|
2014
|
-
};
|
|
2015
|
-
}
|
|
2016
|
-
function Wi(e, t, n, r, o = {}, i = "TB", a = "horizontal") {
|
|
2017
|
-
const l = o.edgeColor ?? "#b0bec5", d = [], s = [], u = (m, b) => {
|
|
2018
|
-
const p = t[m];
|
|
2019
|
-
if (!p) return;
|
|
2020
|
-
const T = b ?? { pass: "Pass", fail: "Fail" }, I = Object.keys(p), O = (j, A, ee, ue) => {
|
|
2021
|
-
if (j.length !== 0) {
|
|
2022
|
-
j.forEach((F) => d.push(Ft(F))), s.push({
|
|
2023
|
-
id: `e-${m}-${A}-start`,
|
|
2024
|
-
source: m,
|
|
2025
|
-
target: j[0].id,
|
|
2026
|
-
type: "gatewayBranchEdge",
|
|
2027
|
-
style: { stroke: l },
|
|
2028
|
-
data: { branch: A, filterId: m, label: ee, isFirst: ue === 0, onAddStepClick: n, verticalRouting: a === "vertical" }
|
|
2029
|
-
});
|
|
2030
|
-
for (let F = 1; F < j.length; F++)
|
|
2031
|
-
ne(j[F - 1].kind) || s.push(Bi(j[F - 1], j[F], l, n, { filterId: m, branch: A }));
|
|
2032
|
-
for (const F of j)
|
|
2033
|
-
ne(F.kind) && t[F.id] && u(F.id, F.branchLabels);
|
|
2034
|
-
}
|
|
2035
|
-
};
|
|
2036
|
-
I.forEach((j, A) => {
|
|
2037
|
-
O(p[j], j, T[j] ?? j, A);
|
|
2038
|
-
});
|
|
2039
|
-
};
|
|
2040
|
-
for (let m = 0; m < e.length; m++) {
|
|
2041
|
-
const b = e[m];
|
|
2042
|
-
if (d.push(Ft(b)), m > 0) {
|
|
2043
|
-
const p = e[m - 1], E = p.kind === "start" || p.kind === "addTrigger";
|
|
2044
|
-
if (p.kind === "filter" || p.kind === "approval") continue;
|
|
2045
|
-
s.push({
|
|
2046
|
-
id: `e-${p.id}-${b.id}`,
|
|
2047
|
-
source: p.id,
|
|
2048
|
-
target: b.id,
|
|
2049
|
-
type: E ? "plainEdge" : "plusEdge",
|
|
2050
|
-
style: { stroke: l },
|
|
2051
|
-
data: E ? {} : {
|
|
2052
|
-
onAddStepClick: n,
|
|
2053
|
-
referenceNodeType: p.reactFlowType
|
|
2054
|
-
}
|
|
2055
|
-
});
|
|
2056
|
-
}
|
|
2057
|
-
(b.kind === "filter" || b.kind === "approval") && t[b.id] && u(b.id, b.branchLabels);
|
|
2058
|
-
}
|
|
2059
|
-
const f = {};
|
|
2060
|
-
if (d.forEach((m) => {
|
|
2061
|
-
f[m.id] = {
|
|
2062
|
-
width: ge,
|
|
2063
|
-
height: r[m.id] ?? $e[m.type ?? ""] ?? 80
|
|
2064
|
-
};
|
|
2065
|
-
}), !(Object.keys(t).length > 0)) {
|
|
2066
|
-
if (i === "LR") {
|
|
2067
|
-
let T = Ge;
|
|
2068
|
-
return { nodes: d.map((O) => {
|
|
2069
|
-
const j = f[O.id].width, A = f[O.id].height, ee = { ...O, position: { x: T, y: 300 - A / 2 } };
|
|
2070
|
-
return T += j + We, ee;
|
|
2071
|
-
}), edges: s };
|
|
2072
|
-
}
|
|
2073
|
-
const m = 400;
|
|
2074
|
-
let b = Ge;
|
|
2075
|
-
return { nodes: d.map((E) => {
|
|
2076
|
-
const T = f[E.id].height, I = { ...E, position: { x: m - ge / 2, y: b } };
|
|
2077
|
-
return b += T + We, I;
|
|
2078
|
-
}), edges: s };
|
|
2079
|
-
}
|
|
2080
|
-
if (a === "vertical") {
|
|
2081
|
-
const { nodes: m, railSpecs: b } = Pi(e, t, d, f);
|
|
2082
|
-
return { nodes: m.map(
|
|
2083
|
-
(E) => b[E.id] ? { ...E, data: { ...E.data, _branchRail: b[E.id] } } : E
|
|
2084
|
-
), edges: s };
|
|
2085
|
-
}
|
|
2086
|
-
return { nodes: Ai(d, s, f, i), edges: s };
|
|
2087
|
-
}
|
|
2088
|
-
const zt = ({
|
|
2089
|
-
nodeRegistry: e,
|
|
2090
|
-
templateRegistry: t,
|
|
2091
|
-
initialValue: n,
|
|
2092
|
-
nodeTypes: r,
|
|
2093
|
-
edgeTypes: o,
|
|
2094
|
-
onSave: i,
|
|
2095
|
-
readOnly: a = !1,
|
|
2096
|
-
theme: l = {},
|
|
2097
|
-
messages: d,
|
|
2098
|
-
canvasOptions: s = {},
|
|
2099
|
-
renderTriggerSelector: u,
|
|
2100
|
-
renderNodePicker: f,
|
|
2101
|
-
renderNodeConfig: h,
|
|
2102
|
-
onNodeClick: g,
|
|
2103
|
-
maxNodes: m,
|
|
2104
|
-
layoutDirection: b = "TB",
|
|
2105
|
-
executionRecord: p,
|
|
2106
|
-
onFetchWorkflow: E
|
|
2107
|
-
}) => {
|
|
2108
|
-
const {
|
|
2109
|
-
fitView: T = !0,
|
|
2110
|
-
fitViewPadding: I = 0.3,
|
|
2111
|
-
showControls: O = !0,
|
|
2112
|
-
showMiniMap: j = !1,
|
|
2113
|
-
panOnScroll: A = !0,
|
|
2114
|
-
zoomOnScroll: ee = !1,
|
|
2115
|
-
minZoom: ue = 0.25,
|
|
2116
|
-
maxZoom: F = 2,
|
|
2117
|
-
snapToGrid: me = !1,
|
|
2118
|
-
snapGrid: be = [15, 15],
|
|
2119
|
-
branchLayout: Y = "horizontal",
|
|
2120
|
-
nodeBody: ie = "full"
|
|
2121
|
-
} = s, H = P(() => rr(d), [d]), [z, q] = M(() => (n == null ? void 0 : n.slots) ?? jt()), [K, X] = M(() => (n == null ? void 0 : n.branches) ?? {}), [ae, W] = M(null), [Ce, Xe] = M(null), [le, ye] = M(null), [Se, Je] = M(null), [Ee, Ze] = M(null), [J, Qe] = M(() => {
|
|
2122
|
-
const y = n == null ? void 0 : n.slots.find((v) => v.kind === "triggerFixed"), w = y != null && y.id.startsWith("trigger-") ? y.id.slice(8) : void 0;
|
|
2123
|
-
return w ? t.lookup(w) ?? null : null;
|
|
2124
|
-
}), [et, gn] = M({}), pn = G((y) => {
|
|
2125
|
-
gn(y);
|
|
2126
|
-
}, []), mn = P(() => ({ ...Sn, ...r }), [r]), bn = P(() => ({ ...Li, ...o }), [o]), yn = P(() => {
|
|
2127
|
-
const y = z.filter((v) => v.kind === "userTask").length, w = Object.values(K).flatMap((v) => Object.values(v).flat()).filter((v) => v.kind === "userTask").length;
|
|
2128
|
-
return y + w;
|
|
2129
|
-
}, [z, K]), tt = m ?? (J == null ? void 0 : J.maxTasks), nt = tt !== void 0 && yn >= tt, te = G((y) => {
|
|
2130
|
-
const w = z.find((v) => v.id === y);
|
|
2131
|
-
if (w) return w;
|
|
2132
|
-
for (const v of Object.values(K)) {
|
|
2133
|
-
const N = Object.values(v).flat().find((k) => k.id === y);
|
|
2134
|
-
if (N) return N;
|
|
2135
|
-
}
|
|
2136
|
-
return null;
|
|
2137
|
-
}, [z, K]), Ie = G((y) => {
|
|
2138
|
-
a || (Xe(y), W("nodeConfig"));
|
|
2139
|
-
}, [a]), rt = G((y) => {
|
|
2140
|
-
if (!a) {
|
|
2141
|
-
if (z.some((w) => w.id === y)) {
|
|
2142
|
-
const w = z.find((v) => v.id === y);
|
|
2143
|
-
if ((w == null ? void 0 : w.kind) === "triggerFixed") {
|
|
2144
|
-
q(jt()), X({}), Qe(null);
|
|
2145
|
-
return;
|
|
2146
|
-
}
|
|
2147
|
-
q((v) => {
|
|
2148
|
-
const N = v.filter((k) => k.id !== y);
|
|
2149
|
-
return ne((w == null ? void 0 : w.kind) ?? "") && !N.some((k) => k.kind === "end") ? [...N, { id: "end", kind: "end", reactFlowType: "endNode" }] : N;
|
|
2150
|
-
}), X((v) => {
|
|
2151
|
-
const N = { ...v }, k = (x) => {
|
|
2152
|
-
N[x] && (Object.values(N[x]).flat().filter((_) => ne(_.kind)).forEach((_) => k(_.id)), delete N[x]);
|
|
2153
|
-
};
|
|
2154
|
-
return k(y), N;
|
|
2155
|
-
});
|
|
2156
|
-
return;
|
|
2157
|
-
}
|
|
2158
|
-
X((w) => {
|
|
2159
|
-
const v = (k, x) => {
|
|
2160
|
-
const _ = [];
|
|
2161
|
-
for (const C of k)
|
|
2162
|
-
ne(C.kind) && x[C.id] && (_.push(C.id), Object.values(x[C.id]).forEach((S) => _.push(...v(S, x))));
|
|
2163
|
-
return _;
|
|
2164
|
-
}, N = { ...w };
|
|
2165
|
-
for (const k of Object.keys(N))
|
|
2166
|
-
for (const x of Object.keys(N[k])) {
|
|
2167
|
-
const _ = N[k][x], C = _.findIndex((L) => L.id === y);
|
|
2168
|
-
if (C === -1 || _[C].kind === "end") continue;
|
|
2169
|
-
const S = _[C];
|
|
2170
|
-
let R = _.filter((L) => L.id !== y);
|
|
2171
|
-
return S.kind === "filter" && ((S.id in N ? v([S], N) : []).forEach((D) => delete N[D]), delete N[S.id], R.some((D) => D.kind === "end") || (R = [...R, { id: `end-${k}-${x}`, kind: "end", reactFlowType: "endNode" }])), N[k] = { ...N[k], [x]: R }, N;
|
|
2172
|
-
}
|
|
2173
|
-
return N;
|
|
2174
|
-
});
|
|
2175
|
-
}
|
|
2176
|
-
}, [a, z]), Oe = G(() => {
|
|
2177
|
-
a || W("triggerSelect");
|
|
2178
|
-
}, [a]), ot = G((y, w) => {
|
|
2179
|
-
a || nt || (ye(y), Je(w.filterId && w.branch ? { filterId: w.filterId, branch: w.branch } : null), W("nodePicker"));
|
|
2180
|
-
}, [a, nt]), it = G((y) => {
|
|
2181
|
-
Qe(y), W(null), X({}), q([
|
|
2182
|
-
{ id: "start", kind: "start", reactFlowType: "startNode" },
|
|
2183
|
-
{
|
|
2184
|
-
id: `trigger-${y.triggerKey}`,
|
|
2185
|
-
kind: "triggerFixed",
|
|
2186
|
-
reactFlowType: "triggerNode",
|
|
2187
|
-
nodeData: { label: y.label, source: y.source },
|
|
2188
|
-
deletable: !1
|
|
2189
|
-
},
|
|
2190
|
-
{ id: "end", kind: "end", reactFlowType: "endNode" }
|
|
2191
|
-
]);
|
|
2192
|
-
}, []), at = G(() => {
|
|
2193
|
-
const y = e.list();
|
|
2194
|
-
return (J != null && J.availableTasks ? y.filter((v) => J.availableTasks.includes(v.type)) : y).filter((v) => v.maxPerWorkflow === void 0 ? !0 : z.filter((k) => k.descriptorType === v.type).length + Object.values(K).flatMap((k) => Object.values(k).flat()).filter((k) => k.descriptorType === v.type).length < v.maxPerWorkflow);
|
|
2195
|
-
}, [e, J, z, K]), lt = G((y) => {
|
|
2196
|
-
if (!le) return;
|
|
2197
|
-
const w = `${y.type}-${Date.now()}`, v = y.reactFlowType === "filterNode" || y.reactFlowType === "approvalNode" || y.reactFlowType === "conditionBranchNode", N = y.branchLabels ?? { pass: "Pass", fail: "Fail" }, k = {
|
|
2198
|
-
id: w,
|
|
2199
|
-
kind: v ? y.reactFlowType === "approvalNode" ? "approval" : "filter" : "userTask",
|
|
2200
|
-
reactFlowType: y.reactFlowType,
|
|
2201
|
-
descriptorType: y.type,
|
|
2202
|
-
formData: {},
|
|
2203
|
-
nodeData: { title: y.label },
|
|
2204
|
-
deletable: !0,
|
|
2205
|
-
branchLabels: N
|
|
2206
|
-
};
|
|
2207
|
-
if (Se) {
|
|
2208
|
-
const { filterId: x, branch: _ } = Se;
|
|
2209
|
-
X((C) => {
|
|
2210
|
-
const S = [...C[x][_]];
|
|
2211
|
-
if (v) {
|
|
2212
|
-
const Z = S.filter((se) => se.kind !== "end"), ft = Z.findIndex((se) => se.id === le), vn = ft === -1 ? Z.length : ft + 1;
|
|
2213
|
-
return Z.splice(vn, 0, k), {
|
|
2214
|
-
...C,
|
|
2215
|
-
[x]: { ...C[x], [_]: Z },
|
|
2216
|
-
[w]: Object.fromEntries(
|
|
2217
|
-
Object.keys(N).map((se) => [se, [{ id: `end-${w}-${se}`, kind: "end", reactFlowType: "endNode" }]])
|
|
2218
|
-
)
|
|
2219
|
-
};
|
|
2220
|
-
}
|
|
2221
|
-
const R = S.findIndex((Z) => Z.id === le), L = S.findIndex((Z) => Z.kind === "end"), D = R === -1 ? L === -1 ? S.length : L : R + 1;
|
|
2222
|
-
return S.splice(D, 0, k), { ...C, [x]: { ...C[x], [_]: S } };
|
|
2223
|
-
});
|
|
2224
|
-
} else
|
|
2225
|
-
v ? (q((x) => {
|
|
2226
|
-
const _ = x.findIndex((S) => S.id === le);
|
|
2227
|
-
return [...x.filter((S) => S.kind !== "end").slice(0, _ + 1), k];
|
|
2228
|
-
}), X((x) => ({
|
|
2229
|
-
...x,
|
|
2230
|
-
[w]: Object.fromEntries(
|
|
2231
|
-
Object.keys(N).map((_) => [_, [{ id: `end-${w}-${_}`, kind: "end", reactFlowType: "endNode" }]])
|
|
2232
|
-
)
|
|
2233
|
-
}))) : q((x) => {
|
|
2234
|
-
const _ = x.findIndex((C) => C.id === le);
|
|
2235
|
-
return _ === -1 ? x : [...x.slice(0, _ + 1), k, ...x.slice(_ + 1)];
|
|
2236
|
-
});
|
|
2237
|
-
ye(null), Je(null), Xe(w), W("nodeConfig");
|
|
2238
|
-
}, [le, Se]), st = G((y, w) => {
|
|
2239
|
-
const v = (k) => {
|
|
2240
|
-
const x = te(y);
|
|
2241
|
-
if ((x == null ? void 0 : x.descriptorType) !== "conditionBranch") return k;
|
|
2242
|
-
const _ = w.branchConfigs ?? [], C = _.map((D) => D.key).filter(Boolean);
|
|
2243
|
-
if (C.length === 0) return k;
|
|
2244
|
-
const S = k[y] ?? {}, R = {};
|
|
2245
|
-
C.forEach((D) => {
|
|
2246
|
-
R[D] = S[D] ?? [{ id: `end-${y}-${D}`, kind: "end", reactFlowType: "endNode" }];
|
|
2247
|
-
});
|
|
2248
|
-
const L = {};
|
|
2249
|
-
return _.forEach((D) => {
|
|
2250
|
-
D.key && (L[D.key] = D.label || D.key);
|
|
2251
|
-
}), { ...k, [y]: R };
|
|
2252
|
-
}, N = (k, x) => {
|
|
2253
|
-
if (k.descriptorType !== "conditionBranch") return { ...k, formData: x };
|
|
2254
|
-
const _ = x.branchConfigs ?? [], C = {};
|
|
2255
|
-
return _.forEach((S) => {
|
|
2256
|
-
S.key && (C[S.key] = S.label || S.key);
|
|
2257
|
-
}), { ...k, formData: x, branchLabels: C };
|
|
2258
|
-
};
|
|
2259
|
-
if (z.some((k) => k.id === y)) {
|
|
2260
|
-
X((k) => {
|
|
2261
|
-
const x = v(k);
|
|
2262
|
-
return q((_) => {
|
|
2263
|
-
const C = _.map((S) => S.id === y ? N(S, w) : S);
|
|
2264
|
-
return i == null || i({ slots: C, branches: x }), C;
|
|
2265
|
-
}), x;
|
|
2266
|
-
});
|
|
2267
|
-
return;
|
|
2268
|
-
}
|
|
2269
|
-
X((k) => {
|
|
2270
|
-
const _ = { ...v(k) };
|
|
2271
|
-
for (const C of Object.keys(_)) {
|
|
2272
|
-
const S = (R) => R.map((L) => L.id === y ? N(L, w) : L);
|
|
2273
|
-
for (const R of Object.keys(_[C]))
|
|
2274
|
-
if (_[C][R].some((L) => L.id === y))
|
|
2275
|
-
return _[C] = { ..._[C], [R]: S(_[C][R]) }, i == null || i({ slots: z, branches: _ }), _;
|
|
2276
|
-
}
|
|
2277
|
-
return _;
|
|
2278
|
-
});
|
|
2279
|
-
}, [z, K, te, i]), U = P(() => te(Ce ?? ""), [te, Ce]), dt = P(() => U != null && U.descriptorType ? e.forType(U.descriptorType) ?? null : null, [U, e]), { nodes: ct, edges: En } = P(
|
|
2280
|
-
() => Wi(z, K, a ? null : ot, et, l, b, Y),
|
|
2281
|
-
[z, K, a, ot, et, l, b, Y]
|
|
2282
|
-
), ut = P(() => {
|
|
2283
|
-
const y = p ? new Map(p.steps.map((w) => [w.nodeId, w])) : null;
|
|
2284
|
-
return ct.map((w) => {
|
|
2285
|
-
let v = {};
|
|
2286
|
-
if (y) {
|
|
2287
|
-
const N = y.get(w.id);
|
|
2288
|
-
N && (v = { _executionStatus: N.status, _executionError: N.error });
|
|
2289
|
-
}
|
|
2290
|
-
return w.type === "subWorkflowNode" && E && (v.onPreview = (N) => {
|
|
2291
|
-
var x;
|
|
2292
|
-
const k = te(w.id);
|
|
2293
|
-
Ze({ workflowId: N, workflowLabel: ((x = k == null ? void 0 : k.formData) == null ? void 0 : x.workflowLabel) ?? void 0 });
|
|
2294
|
-
}), Object.keys(v).length > 0 ? { ...w, data: { ...w.data, ...v } } : w;
|
|
2295
|
-
});
|
|
2296
|
-
}, [ct, p, E, te]), wn = P(() => ({ onEditNode: Ie, onDeleteNode: rt, onAddStep: () => {
|
|
2297
|
-
}, onClickAddTrigger: Oe, messages: H, nodeRegistry: e, nodeBody: ie }), [Ie, rt, Oe, H, e, ie]);
|
|
2298
|
-
return /* @__PURE__ */ c.createElement(zn.Provider, { value: wn }, /* @__PURE__ */ c.createElement(
|
|
2299
|
-
"div",
|
|
2300
|
-
{
|
|
2301
|
-
style: {
|
|
2302
|
-
width: "100%",
|
|
2303
|
-
height: "100%",
|
|
2304
|
-
position: "relative",
|
|
2305
|
-
// CSS variable consumed by edge SCSS for primary/hover color
|
|
2306
|
-
"--ff-primary": l.primaryColor ?? "#1dbf60",
|
|
2307
|
-
"--ff-edge-color": l.edgeColor ?? "#b0bec5",
|
|
2308
|
-
"--ff-text": l.textColor ?? "#212121",
|
|
2309
|
-
"--ff-muted": l.mutedTextColor ?? "#9ca3af",
|
|
2310
|
-
"--ff-surface": l.surfaceColor ?? "#fff",
|
|
2311
|
-
"--ff-border": l.borderColor ?? "#dee2e6",
|
|
2312
|
-
"--ff-danger": l.dangerColor ?? "#d32f2f",
|
|
2313
|
-
"--ff-radius": `${l.borderRadius ?? 6}px`,
|
|
2314
|
-
"--ff-font-family": l.fontFamily
|
|
2315
|
-
}
|
|
2316
|
-
},
|
|
2317
|
-
/* @__PURE__ */ c.createElement(
|
|
2318
|
-
kn,
|
|
2319
|
-
{
|
|
2320
|
-
nodes: ut,
|
|
2321
|
-
edges: En,
|
|
2322
|
-
nodeTypes: mn,
|
|
2323
|
-
edgeTypes: bn,
|
|
2324
|
-
fitView: T,
|
|
2325
|
-
fitViewOptions: { padding: I },
|
|
2326
|
-
nodesDraggable: !1,
|
|
2327
|
-
nodesConnectable: !1,
|
|
2328
|
-
panOnScroll: A,
|
|
2329
|
-
zoomOnScroll: ee,
|
|
2330
|
-
minZoom: ue,
|
|
2331
|
-
maxZoom: F,
|
|
2332
|
-
snapToGrid: me,
|
|
2333
|
-
snapGrid: be,
|
|
2334
|
-
proOptions: { hideAttribution: !0 },
|
|
2335
|
-
onNodeClick: (y, w) => {
|
|
2336
|
-
const v = te(w.id);
|
|
2337
|
-
v && (g != null && g(v) || (v.kind === "addTrigger" || v.kind === "triggerFixed" ? Oe() : (v.kind === "userTask" || v.kind === "filter" || v.kind === "approval") && Ie(w.id)));
|
|
2338
|
-
}
|
|
2339
|
-
},
|
|
2340
|
-
l.background !== "none" && /* @__PURE__ */ c.createElement(
|
|
2341
|
-
Tn,
|
|
2342
|
-
{
|
|
2343
|
-
variant: l.background,
|
|
2344
|
-
color: l.backgroundColor ?? "#e0e0e0",
|
|
2345
|
-
gap: 20
|
|
2346
|
-
}
|
|
2347
|
-
),
|
|
2348
|
-
O && /* @__PURE__ */ c.createElement(Nn, { showInteractive: !1 }),
|
|
2349
|
-
j && /* @__PURE__ */ c.createElement(Cn, { zoomable: !0, pannable: !0 }),
|
|
2350
|
-
/* @__PURE__ */ c.createElement(Mi, { onHeightsReady: pn, nodeCount: ut.length })
|
|
2351
|
-
),
|
|
2352
|
-
u ? ae === "triggerSelect" && u(t.list(), it, () => W(null)) : /* @__PURE__ */ c.createElement(ji, { open: ae === "triggerSelect", templates: t.list(), messages: H, onSelect: it, onClose: () => W(null) }),
|
|
2353
|
-
f ? ae === "nodePicker" && f(at(), lt, () => {
|
|
2354
|
-
W(null), ye(null);
|
|
2355
|
-
}) : /* @__PURE__ */ c.createElement(Fi, { open: ae === "nodePicker", availableDescriptors: at(), messages: H, onSelect: lt, onClose: () => {
|
|
2356
|
-
W(null), ye(null);
|
|
2357
|
-
} }),
|
|
2358
|
-
h ? ae === "nodeConfig" && h(dt ?? void 0, U, st, () => W(null)) : /* @__PURE__ */ c.createElement(zi, { open: ae === "nodeConfig", nodeId: Ce, descriptor: dt, initialValues: U == null ? void 0 : U.formData, messages: H, onSave: st, onClose: () => W(null) }),
|
|
2359
|
-
E && Ee && /* @__PURE__ */ c.createElement(
|
|
2360
|
-
Ri,
|
|
2361
|
-
{
|
|
2362
|
-
isOpen: !!Ee,
|
|
2363
|
-
onClose: () => Ze(null),
|
|
2364
|
-
workflowId: Ee.workflowId,
|
|
2365
|
-
workflowLabel: Ee.workflowLabel,
|
|
2366
|
-
onFetchWorkflow: E
|
|
2367
|
-
}
|
|
2368
|
-
)
|
|
2369
|
-
));
|
|
2370
|
-
}, Gi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2371
|
-
__proto__: null,
|
|
2372
|
-
WorkflowCanvas: zt,
|
|
2373
|
-
default: zt
|
|
2374
|
-
}, Symbol.toStringTag, { value: "Module" })), Pe = "All";
|
|
2375
|
-
function $i({ template: e, onSelect: t }) {
|
|
2376
|
-
var o, i;
|
|
2377
|
-
const n = e.triggerCategory ? or[e.triggerCategory] : null, r = ((o = e.skeletonState) == null ? void 0 : o.slots.filter((a) => a.kind === "userTask").length) ?? 0;
|
|
2378
|
-
return /* @__PURE__ */ c.createElement(
|
|
2379
|
-
"div",
|
|
2380
|
-
{
|
|
2381
|
-
role: "button",
|
|
2382
|
-
tabIndex: 0,
|
|
2383
|
-
onClick: t,
|
|
2384
|
-
onKeyDown: (a) => {
|
|
2385
|
-
(a.key === "Enter" || a.key === " ") && t();
|
|
2386
|
-
},
|
|
2387
|
-
style: {
|
|
2388
|
-
border: "1.5px solid #e0e0e0",
|
|
2389
|
-
borderRadius: 10,
|
|
2390
|
-
padding: "16px",
|
|
2391
|
-
background: "#fff",
|
|
2392
|
-
cursor: "pointer",
|
|
2393
|
-
transition: "border-color 0.15s, box-shadow 0.15s",
|
|
2394
|
-
display: "flex",
|
|
2395
|
-
flexDirection: "column",
|
|
2396
|
-
gap: 8,
|
|
2397
|
-
outline: "none"
|
|
2398
|
-
},
|
|
2399
|
-
onMouseEnter: (a) => {
|
|
2400
|
-
a.currentTarget.style.borderColor = "#1976d2", a.currentTarget.style.boxShadow = "0 2px 8px rgba(25,118,210,0.12)";
|
|
2401
|
-
},
|
|
2402
|
-
onMouseLeave: (a) => {
|
|
2403
|
-
a.currentTarget.style.borderColor = "#e0e0e0", a.currentTarget.style.boxShadow = "none";
|
|
2404
|
-
}
|
|
2405
|
-
},
|
|
2406
|
-
/* @__PURE__ */ c.createElement("div", { style: { display: "flex", alignItems: "flex-start", gap: 10 } }, e.icon && /* @__PURE__ */ c.createElement("div", { style: { flexShrink: 0, width: 36, height: 36, borderRadius: 8, background: "#f5f5f5", display: "flex", alignItems: "center", justifyContent: "center" } }, e.icon), /* @__PURE__ */ c.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ c.createElement("div", { style: { fontWeight: 600, fontSize: 14, color: "#212121", marginBottom: 2 } }, e.label), e.description && /* @__PURE__ */ c.createElement("div", { style: { fontSize: 12, color: "#757575", lineHeight: 1.4, display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden" } }, e.description))),
|
|
2407
|
-
/* @__PURE__ */ c.createElement("div", { style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 4 } }, n && /* @__PURE__ */ c.createElement("span", { style: { fontSize: 10, fontWeight: 600, padding: "2px 7px", borderRadius: 10, background: n.bg, color: n.color } }, n.label), (i = e.tags) == null ? void 0 : i.map((a) => /* @__PURE__ */ c.createElement("span", { key: a, style: { fontSize: 10, padding: "2px 7px", borderRadius: 10, background: "#f5f5f5", color: "#616161" } }, a)), r > 0 && /* @__PURE__ */ c.createElement("span", { style: { fontSize: 10, color: "#9e9e9e", marginLeft: "auto" } }, r, " step", r !== 1 ? "s" : "")),
|
|
2408
|
-
e.author && /* @__PURE__ */ c.createElement("div", { style: { fontSize: 11, color: "#bdbdbd" } }, "by ", e.author)
|
|
2409
|
-
);
|
|
2410
|
-
}
|
|
2411
|
-
const oa = ({
|
|
2412
|
-
templates: e,
|
|
2413
|
-
onSelectTemplate: t,
|
|
2414
|
-
onStartFromScratch: n
|
|
2415
|
-
}) => {
|
|
2416
|
-
const [r, o] = M(""), [i, a] = M(Pe), l = P(() => {
|
|
2417
|
-
const s = /* @__PURE__ */ new Set();
|
|
2418
|
-
return e.forEach((u) => {
|
|
2419
|
-
u.category && s.add(u.category);
|
|
2420
|
-
}), [Pe, ...Array.from(s)];
|
|
2421
|
-
}, [e]), d = P(() => {
|
|
2422
|
-
let s = e;
|
|
2423
|
-
if (i !== Pe && (s = s.filter((u) => u.category === i)), r.trim()) {
|
|
2424
|
-
const u = r.toLowerCase();
|
|
2425
|
-
s = s.filter(
|
|
2426
|
-
(f) => {
|
|
2427
|
-
var h, g;
|
|
2428
|
-
return f.label.toLowerCase().includes(u) || ((h = f.description) == null ? void 0 : h.toLowerCase().includes(u)) || ((g = f.tags) == null ? void 0 : g.some((m) => m.toLowerCase().includes(u)));
|
|
2429
|
-
}
|
|
2430
|
-
);
|
|
2431
|
-
}
|
|
2432
|
-
return [...s].sort((u, f) => (f.popularity ?? 0) - (u.popularity ?? 0));
|
|
2433
|
-
}, [e, i, r]);
|
|
2434
|
-
return /* @__PURE__ */ c.createElement("div", { style: { display: "flex", flexDirection: "column", height: "100%", fontFamily: "inherit" } }, /* @__PURE__ */ c.createElement("div", { style: { padding: "24px 24px 0", borderBottom: "1px solid #f0f0f0", paddingBottom: 16 } }, /* @__PURE__ */ c.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 16 } }, /* @__PURE__ */ c.createElement("div", null, /* @__PURE__ */ c.createElement("h2", { style: { margin: 0, fontSize: 20, fontWeight: 700, color: "#212121" } }, "Workflow Templates"), /* @__PURE__ */ c.createElement("p", { style: { margin: "4px 0 0", fontSize: 13, color: "#757575" } }, "Choose a pre-built template or start from scratch")), n && /* @__PURE__ */ c.createElement(
|
|
2435
|
-
"button",
|
|
2436
|
-
{
|
|
2437
|
-
onClick: n,
|
|
2438
|
-
style: { display: "flex", alignItems: "center", gap: 6, padding: "8px 16px", border: "1.5px solid #1976d2", borderRadius: 6, background: "#fff", color: "#1976d2", fontSize: 13, fontWeight: 600, cursor: "pointer" }
|
|
2439
|
-
},
|
|
2440
|
-
/* @__PURE__ */ c.createElement(Un, { size: 16 }),
|
|
2441
|
-
"Start from Scratch"
|
|
2442
|
-
)), /* @__PURE__ */ c.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, background: "#f5f5f5", borderRadius: 8, padding: "8px 12px", marginBottom: 12 } }, /* @__PURE__ */ c.createElement(Vn, { size: 18, color: "#9e9e9e" }), /* @__PURE__ */ c.createElement(
|
|
2443
|
-
"input",
|
|
2444
|
-
{
|
|
2445
|
-
value: r,
|
|
2446
|
-
onChange: (s) => o(s.target.value),
|
|
2447
|
-
placeholder: "Search templates...",
|
|
2448
|
-
style: { border: "none", background: "transparent", outline: "none", fontSize: 14, color: "#212121", flex: 1 }
|
|
2449
|
-
}
|
|
2450
|
-
)), l.length > 1 && /* @__PURE__ */ c.createElement("div", { style: { display: "flex", gap: 4, flexWrap: "wrap" } }, l.map((s) => /* @__PURE__ */ c.createElement(
|
|
2451
|
-
"button",
|
|
2452
|
-
{
|
|
2453
|
-
key: s,
|
|
2454
|
-
onClick: () => a(s),
|
|
2455
|
-
style: {
|
|
2456
|
-
padding: "4px 12px",
|
|
2457
|
-
borderRadius: 20,
|
|
2458
|
-
border: "1.5px solid",
|
|
2459
|
-
borderColor: i === s ? "#1976d2" : "#e0e0e0",
|
|
2460
|
-
background: i === s ? "#e3f2fd" : "#fff",
|
|
2461
|
-
color: i === s ? "#1565c0" : "#616161",
|
|
2462
|
-
fontSize: 12,
|
|
2463
|
-
fontWeight: i === s ? 600 : 400,
|
|
2464
|
-
cursor: "pointer"
|
|
2465
|
-
}
|
|
2466
|
-
},
|
|
2467
|
-
s
|
|
2468
|
-
)))), /* @__PURE__ */ c.createElement("div", { style: { flex: 1, overflowY: "auto", padding: 24 } }, d.length === 0 ? /* @__PURE__ */ c.createElement("div", { style: { textAlign: "center", padding: "40px 0", color: "#9e9e9e" } }, /* @__PURE__ */ c.createElement(Hn, { size: 36, style: { marginBottom: 8 } }), /* @__PURE__ */ c.createElement("p", { style: { margin: 0, fontSize: 14 } }, "No templates found")) : /* @__PURE__ */ c.createElement("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(280px, 1fr))", gap: 16 } }, d.map((s) => /* @__PURE__ */ c.createElement($i, { key: s.triggerKey, template: s, onSelect: () => t(s) })))));
|
|
2469
|
-
}, we = {
|
|
2470
|
-
running: { label: "Running", color: V.running, icon: c.createElement(Pt, { size: 14 }) },
|
|
2471
|
-
success: { label: "Success", color: V.success, icon: c.createElement(At, { size: 14 }) },
|
|
2472
|
-
failed: { label: "Failed", color: V.failed, icon: c.createElement(Lt, { size: 14 }) },
|
|
2473
|
-
cancelled: { label: "Cancelled", color: V.cancelled, icon: c.createElement(Dt, { size: 14 }) }
|
|
2474
|
-
}, Yi = {
|
|
2475
|
-
pending: { color: V.pending, icon: c.createElement(qn, { size: 14 }) },
|
|
2476
|
-
running: { color: V.running, icon: c.createElement(Pt, { size: 14 }) },
|
|
2477
|
-
success: { color: V.success, icon: c.createElement(At, { size: 14 }) },
|
|
2478
|
-
failed: { color: V.failed, icon: c.createElement(Lt, { size: 14 }) },
|
|
2479
|
-
skipped: { color: V.skipped, icon: c.createElement(Dt, { size: 14 }) }
|
|
2480
|
-
};
|
|
2481
|
-
function Ye(e) {
|
|
2482
|
-
try {
|
|
2483
|
-
return new Date(e).toLocaleString();
|
|
2484
|
-
} catch {
|
|
2485
|
-
return e;
|
|
2486
|
-
}
|
|
2487
|
-
}
|
|
2488
|
-
function hn(e, t) {
|
|
2489
|
-
try {
|
|
2490
|
-
const n = new Date(t ?? (/* @__PURE__ */ new Date()).toISOString()).getTime() - new Date(e).getTime();
|
|
2491
|
-
return n < 1e3 ? `${n}ms` : n < 6e4 ? `${(n / 1e3).toFixed(1)}s` : `${Math.floor(n / 6e4)}m ${Math.floor(n % 6e4 / 1e3)}s`;
|
|
2492
|
-
} catch {
|
|
2493
|
-
return "—";
|
|
2494
|
-
}
|
|
2495
|
-
}
|
|
2496
|
-
function Ki({ step: e }) {
|
|
2497
|
-
const [t, n] = M(!1), r = Yi[e.status], o = !!(e.inputs || e.outputs || e.error);
|
|
2498
|
-
return /* @__PURE__ */ c.createElement("div", { style: { borderBottom: "1px solid #f5f5f5" } }, /* @__PURE__ */ c.createElement(
|
|
2499
|
-
"div",
|
|
2500
|
-
{
|
|
2501
|
-
style: { display: "flex", alignItems: "center", gap: 8, padding: "8px 12px", cursor: o ? "pointer" : "default" },
|
|
2502
|
-
onClick: () => {
|
|
2503
|
-
o && n((i) => !i);
|
|
2504
|
-
},
|
|
2505
|
-
role: o ? "button" : void 0,
|
|
2506
|
-
tabIndex: o ? 0 : void 0,
|
|
2507
|
-
onKeyDown: (i) => {
|
|
2508
|
-
o && (i.key === "Enter" || i.key === " ") && n((a) => !a);
|
|
2509
|
-
}
|
|
2510
|
-
},
|
|
2511
|
-
/* @__PURE__ */ c.createElement("span", { style: { color: r.color, flexShrink: 0 } }, c.cloneElement(r.icon, { color: r.color })),
|
|
2512
|
-
/* @__PURE__ */ c.createElement("span", { style: { flex: 1, fontSize: 13, color: "#212121" } }, e.label || e.nodeId),
|
|
2513
|
-
e.branchTaken && /* @__PURE__ */ c.createElement("span", { style: { fontSize: 10, padding: "1px 6px", borderRadius: 10, background: "#e3f2fd", color: "#1565c0", fontWeight: 600 } }, e.branchTaken),
|
|
2514
|
-
/* @__PURE__ */ c.createElement("span", { style: { fontSize: 11, color: "#9e9e9e", flexShrink: 0 } }, e.startedAt ? hn(e.startedAt, e.completedAt) : "—"),
|
|
2515
|
-
o && /* @__PURE__ */ c.createElement("span", { style: { color: "#9e9e9e", flexShrink: 0 } }, t ? c.createElement(Jn, { size: 16 }) : c.createElement(Zn, { size: 16 }))
|
|
2516
|
-
), t && o && /* @__PURE__ */ c.createElement("div", { style: { padding: "0 12px 10px 32px", fontSize: 12 } }, e.error && /* @__PURE__ */ c.createElement("div", { style: { padding: "6px 10px", borderRadius: 6, background: "#ffebee", color: "#c62828", marginBottom: 6 } }, e.error), e.inputs && Object.keys(e.inputs).length > 0 && /* @__PURE__ */ c.createElement("details", { style: { marginBottom: 4 } }, /* @__PURE__ */ c.createElement("summary", { style: { cursor: "pointer", color: "#616161", marginBottom: 4 } }, "Inputs"), /* @__PURE__ */ c.createElement("pre", { style: { margin: 0, fontSize: 11, background: "#f5f5f5", padding: 8, borderRadius: 4, overflowX: "auto" } }, JSON.stringify(e.inputs, null, 2))), e.outputs && Object.keys(e.outputs).length > 0 && /* @__PURE__ */ c.createElement("details", null, /* @__PURE__ */ c.createElement("summary", { style: { cursor: "pointer", color: "#616161", marginBottom: 4 } }, "Outputs"), /* @__PURE__ */ c.createElement("pre", { style: { margin: 0, fontSize: 11, background: "#f5f5f5", padding: 8, borderRadius: 4, overflowX: "auto" } }, JSON.stringify(e.outputs, null, 2)))));
|
|
2517
|
-
}
|
|
2518
|
-
function Ui({ record: e, selected: t, onSelect: n }) {
|
|
2519
|
-
const r = we[e.status];
|
|
2520
|
-
return /* @__PURE__ */ c.createElement(
|
|
2521
|
-
"div",
|
|
2522
|
-
{
|
|
2523
|
-
role: "button",
|
|
2524
|
-
tabIndex: 0,
|
|
2525
|
-
onClick: n,
|
|
2526
|
-
onKeyDown: (o) => {
|
|
2527
|
-
(o.key === "Enter" || o.key === " ") && n();
|
|
2528
|
-
},
|
|
2529
|
-
style: {
|
|
2530
|
-
padding: "10px 14px",
|
|
2531
|
-
borderBottom: "1px solid #f0f0f0",
|
|
2532
|
-
cursor: "pointer",
|
|
2533
|
-
background: t ? "#e3f2fd" : "#fff",
|
|
2534
|
-
display: "flex",
|
|
2535
|
-
alignItems: "center",
|
|
2536
|
-
gap: 10,
|
|
2537
|
-
outline: "none"
|
|
2538
|
-
}
|
|
2539
|
-
},
|
|
2540
|
-
/* @__PURE__ */ c.createElement("span", { style: { color: r.color, flexShrink: 0 } }, c.cloneElement(r.icon, { color: r.color, size: 16 })),
|
|
2541
|
-
/* @__PURE__ */ c.createElement("div", { style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ c.createElement("div", { style: { fontSize: 12, color: "#212121", fontWeight: t ? 600 : 400, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }, Ye(e.triggeredAt)), /* @__PURE__ */ c.createElement("div", { style: { fontSize: 11, color: "#9e9e9e" } }, e.triggeredBy ? `by ${e.triggeredBy}` : "System", " · ", e.steps.length, " step", e.steps.length !== 1 ? "s" : "")),
|
|
2542
|
-
/* @__PURE__ */ c.createElement("span", { style: { fontSize: 11, fontWeight: 600, color: r.color, flexShrink: 0 } }, r.label),
|
|
2543
|
-
/* @__PURE__ */ c.createElement(Rt, { size: 14, color: "#bdbdbd" })
|
|
2544
|
-
);
|
|
2545
|
-
}
|
|
2546
|
-
const ia = ({ records: e, onViewOnCanvas: t }) => {
|
|
2547
|
-
var a;
|
|
2548
|
-
const [n, r] = M(((a = e[0]) == null ? void 0 : a.id) ?? null), o = e.find((l) => l.id === n) ?? null, i = [...e].sort((l, d) => new Date(d.triggeredAt).getTime() - new Date(l.triggeredAt).getTime());
|
|
2549
|
-
return e.length === 0 ? /* @__PURE__ */ c.createElement("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: 300, color: "#9e9e9e", gap: 8 } }, /* @__PURE__ */ c.createElement(mt, { size: 36 }), /* @__PURE__ */ c.createElement("p", { style: { margin: 0, fontSize: 14 } }, "No executions yet"), /* @__PURE__ */ c.createElement("p", { style: { margin: 0, fontSize: 12 } }, "Run history will appear here")) : /* @__PURE__ */ c.createElement("div", { style: { display: "flex", height: "100%", fontFamily: "inherit", border: "1px solid #e0e0e0", borderRadius: 8, overflow: "hidden" } }, /* @__PURE__ */ c.createElement("div", { style: { width: 260, flexShrink: 0, borderRight: "1px solid #e0e0e0", overflowY: "auto", background: "#fafafa" } }, /* @__PURE__ */ c.createElement("div", { style: { padding: "12px 14px", borderBottom: "1px solid #e0e0e0", fontWeight: 600, fontSize: 13, color: "#212121" } }, "Run History (", e.length, ")"), i.map((l) => /* @__PURE__ */ c.createElement(Ui, { key: l.id, record: l, selected: l.id === n, onSelect: () => r(l.id) }))), /* @__PURE__ */ c.createElement("div", { style: { flex: 1, overflowY: "auto" } }, o ? /* @__PURE__ */ c.createElement("div", null, /* @__PURE__ */ c.createElement("div", { style: { padding: "16px 20px", borderBottom: "1px solid #f0f0f0", display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 12 } }, /* @__PURE__ */ c.createElement("div", null, /* @__PURE__ */ c.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 4 } }, c.cloneElement(we[o.status].icon, { color: we[o.status].color, size: 18 }), /* @__PURE__ */ c.createElement("span", { style: { fontWeight: 700, fontSize: 15, color: "#212121" } }, we[o.status].label)), /* @__PURE__ */ c.createElement("div", { style: { fontSize: 12, color: "#757575", display: "flex", flexDirection: "column", gap: 2 } }, /* @__PURE__ */ c.createElement("span", { style: { display: "flex", alignItems: "center", gap: 4 } }, /* @__PURE__ */ c.createElement(mt, { size: 13 }), " ", Ye(o.triggeredAt), o.completedAt && ` → ${Ye(o.completedAt)} (${hn(o.triggeredAt, o.completedAt)})`), o.triggeredBy && /* @__PURE__ */ c.createElement("span", { style: { display: "flex", alignItems: "center", gap: 4 } }, /* @__PURE__ */ c.createElement(Xn, { size: 13 }), " ", o.triggeredBy))), t && /* @__PURE__ */ c.createElement(
|
|
2550
|
-
"button",
|
|
2551
|
-
{
|
|
2552
|
-
onClick: () => t(o),
|
|
2553
|
-
style: { padding: "6px 12px", border: "1.5px solid #1976d2", borderRadius: 6, background: "#fff", color: "#1976d2", fontSize: 12, fontWeight: 600, cursor: "pointer", flexShrink: 0 }
|
|
2554
|
-
},
|
|
2555
|
-
"View on Canvas"
|
|
2556
|
-
)), o.error && /* @__PURE__ */ c.createElement("div", { style: { margin: "12px 16px", padding: "10px 14px", borderRadius: 6, background: "#ffebee", color: "#c62828", fontSize: 13 } }, o.error), /* @__PURE__ */ c.createElement("div", null, /* @__PURE__ */ c.createElement("div", { style: { padding: "10px 12px", fontSize: 12, fontWeight: 600, color: "#757575", borderBottom: "1px solid #f0f0f0" } }, "STEPS (", o.steps.length, ")"), o.steps.map((l, d) => /* @__PURE__ */ c.createElement(Ki, { key: `${l.nodeId}-${d}`, step: l }))), o.inputs && Object.keys(o.inputs).length > 0 && /* @__PURE__ */ c.createElement("div", { style: { padding: "10px 16px" } }, /* @__PURE__ */ c.createElement("details", null, /* @__PURE__ */ c.createElement("summary", { style: { cursor: "pointer", fontSize: 12, fontWeight: 600, color: "#757575", marginBottom: 6 } }, "TRIGGER INPUTS"), /* @__PURE__ */ c.createElement("pre", { style: { margin: 0, fontSize: 11, background: "#f5f5f5", padding: 10, borderRadius: 4, overflowX: "auto" } }, JSON.stringify(o.inputs, null, 2))))) : /* @__PURE__ */ c.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: "100%", color: "#9e9e9e", fontSize: 14 } }, "Select a run to see details")));
|
|
2557
|
-
}, aa = {
|
|
2558
|
-
slots: [
|
|
2559
|
-
{ id: "start", kind: "start", reactFlowType: "startNode", deletable: !1 },
|
|
2560
|
-
{ id: "trigger-END_USER_CREATION", kind: "triggerFixed", reactFlowType: "triggerNode", deletable: !0, label: "New User Registration", nodeData: { label: "New User Registration" } },
|
|
2561
|
-
{ id: "notification-1", kind: "userTask", reactFlowType: "notificationNode", descriptorType: "notification", deletable: !0, label: "Welcome Email", nodeData: { title: "Welcome Email" } },
|
|
2562
|
-
{ id: "approval-1", kind: "approval", reactFlowType: "approvalNode", descriptorType: "approval", deletable: !0, label: "Manager Approval", branchLabels: { pass: "Approved", fail: "Rejected" } },
|
|
2563
|
-
{ id: "end", kind: "end", reactFlowType: "endNode", deletable: !1 }
|
|
2564
|
-
],
|
|
2565
|
-
branches: {
|
|
2566
|
-
"approval-1": {
|
|
2567
|
-
pass: [{ id: "notification-pass-1", kind: "userTask", reactFlowType: "notificationNode", descriptorType: "notification", deletable: !0, label: "Approval Confirmed", nodeData: { title: "Approval Confirmed" } }],
|
|
2568
|
-
fail: [{ id: "notification-fail-1", kind: "userTask", reactFlowType: "notificationNode", descriptorType: "notification", deletable: !0, label: "Rejection Notice", nodeData: { title: "Rejection Notice" } }]
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
}, la = {
|
|
2572
|
-
slots: [
|
|
2573
|
-
{ id: "start", kind: "start", reactFlowType: "startNode", deletable: !1 },
|
|
2574
|
-
{ id: "trigger-ACCESS_REQUEST", kind: "triggerFixed", reactFlowType: "triggerNode", deletable: !0, label: "Access Request Submitted", nodeData: { label: "Access Request Submitted" } },
|
|
2575
|
-
{ id: "approval-1", kind: "approval", reactFlowType: "approvalNode", descriptorType: "approval", deletable: !0, label: "Access Approval", branchLabels: { pass: "Approved", fail: "Denied" } },
|
|
2576
|
-
{ id: "end", kind: "end", reactFlowType: "endNode", deletable: !1 }
|
|
2577
|
-
],
|
|
2578
|
-
branches: {
|
|
2579
|
-
"approval-1": {
|
|
2580
|
-
pass: [
|
|
2581
|
-
{ id: "restApi-1", kind: "userTask", reactFlowType: "restApiNode", descriptorType: "restApi", deletable: !0, label: "Provision Access", nodeData: { title: "Provision Access" } },
|
|
2582
|
-
{ id: "notification-pass-1", kind: "userTask", reactFlowType: "notificationNode", descriptorType: "notification", deletable: !0, label: "Access Granted Email", nodeData: { title: "Access Granted Email" } }
|
|
2583
|
-
],
|
|
2584
|
-
fail: [
|
|
2585
|
-
{ id: "notification-fail-1", kind: "userTask", reactFlowType: "notificationNode", descriptorType: "notification", deletable: !0, label: "Access Denied Email", nodeData: { title: "Access Denied Email" } }
|
|
2586
|
-
]
|
|
2587
|
-
}
|
|
2588
|
-
}
|
|
2589
|
-
}, sa = {
|
|
2590
|
-
slots: [
|
|
2591
|
-
{ id: "start", kind: "start", reactFlowType: "startNode", deletable: !1 },
|
|
2592
|
-
{ id: "trigger-USER_DEACTIVATION", kind: "triggerFixed", reactFlowType: "triggerNode", deletable: !0, label: "User Deactivation", nodeData: { label: "User Deactivation" } },
|
|
2593
|
-
{ id: "delay-1", kind: "userTask", reactFlowType: "delayNode", descriptorType: "delay", deletable: !0, label: "Grace Period", nodeData: { title: "Grace Period", duration: 7, unit: "days" }, formData: { duration: 7, unit: "days" } },
|
|
2594
|
-
{ id: "notification-1", kind: "userTask", reactFlowType: "notificationNode", descriptorType: "notification", deletable: !0, label: "Notify IT Team", nodeData: { title: "Notify IT Team" } },
|
|
2595
|
-
{ id: "end", kind: "end", reactFlowType: "endNode", deletable: !1 }
|
|
2596
|
-
],
|
|
2597
|
-
branches: {}
|
|
2598
|
-
}, da = {
|
|
2599
|
-
slots: [
|
|
2600
|
-
{ id: "start", kind: "start", reactFlowType: "startNode", deletable: !1 },
|
|
2601
|
-
{ id: "trigger-WEBHOOK_TRIGGER", kind: "triggerFixed", reactFlowType: "webhookTriggerNode", deletable: !0, label: "Incoming Webhook", nodeData: { label: "Incoming Webhook" } },
|
|
2602
|
-
{ id: "restApi-1", kind: "userTask", reactFlowType: "restApiNode", descriptorType: "restApi", deletable: !0, label: "Call External API", nodeData: { title: "Call External API" } },
|
|
2603
|
-
{ id: "notification-1", kind: "userTask", reactFlowType: "notificationNode", descriptorType: "notification", deletable: !0, label: "Notify on Completion", nodeData: { title: "Notify on Completion" } },
|
|
2604
|
-
{ id: "end", kind: "end", reactFlowType: "endNode", deletable: !1 }
|
|
2605
|
-
],
|
|
2606
|
-
branches: {}
|
|
2607
|
-
};
|
|
2608
|
-
export {
|
|
2609
|
-
zt as F,
|
|
2610
|
-
Ri as S,
|
|
2611
|
-
ia as W,
|
|
2612
|
-
oa as a,
|
|
2613
|
-
la as b,
|
|
2614
|
-
sa as o,
|
|
2615
|
-
aa as u,
|
|
2616
|
-
da as w
|
|
2617
|
-
};
|