var v = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), y = v((e, t) => {
	var n = Object.defineProperty, r = (e, t, r) => t in e ? n(e, t, {
		enumerable: !0,
		configurable: !0,
		writable: !0,
		value: r
	}) : e[t] = r, i = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), a = (e, t, n) => r(e, typeof t == "symbol" ? t : t + "", n), o = i((e, t) => {
		var n = "\0", r = "\0", i = "", o = class {
			constructor(e) {
				a(this, "_isDirected", !0), a(this, "_isMultigraph", !1), a(this, "_isCompound", !1), a(this, "_label"), a(this, "_defaultNodeLabelFn", () => {}), a(this, "_defaultEdgeLabelFn", () => {}), a(this, "_nodes", {}), a(this, "_in", {}), a(this, "_preds", {}), a(this, "_out", {}), a(this, "_sucs", {}), a(this, "_edgeObjs", {}), a(this, "_edgeLabels", {}), a(this, "_nodeCount", 0), a(this, "_edgeCount", 0), a(this, "_parent"), a(this, "_children"), e && (this._isDirected = Object.hasOwn(e, "directed") ? e.directed : !0, this._isMultigraph = Object.hasOwn(e, "multigraph") ? e.multigraph : !1, this._isCompound = Object.hasOwn(e, "compound") ? e.compound : !1), this._isCompound && (this._parent = {}, this._children = {}, this._children[r] = {});
			}
			isDirected() {
				return this._isDirected;
			}
			isMultigraph() {
				return this._isMultigraph;
			}
			isCompound() {
				return this._isCompound;
			}
			setGraph(e) {
				return this._label = e, this;
			}
			graph() {
				return this._label;
			}
			setDefaultNodeLabel(e) {
				return this._defaultNodeLabelFn = e, typeof e != "function" && (this._defaultNodeLabelFn = () => e), this;
			}
			nodeCount() {
				return this._nodeCount;
			}
			nodes() {
				return Object.keys(this._nodes);
			}
			sources() {
				var e = this;
				return this.nodes().filter((t) => Object.keys(e._in[t]).length === 0);
			}
			sinks() {
				var e = this;
				return this.nodes().filter((t) => Object.keys(e._out[t]).length === 0);
			}
			setNodes(e, t) {
				var n = arguments, r = this;
				return e.forEach(function(e) {
					n.length > 1 ? r.setNode(e, t) : r.setNode(e);
				}), this;
			}
			setNode(e, t) {
				return Object.hasOwn(this._nodes, e) ? (arguments.length > 1 && (this._nodes[e] = t), this) : (this._nodes[e] = arguments.length > 1 ? t : this._defaultNodeLabelFn(e), this._isCompound && (this._parent[e] = r, this._children[e] = {}, this._children[r][e] = !0), this._in[e] = {}, this._preds[e] = {}, this._out[e] = {}, this._sucs[e] = {}, ++this._nodeCount, this);
			}
			node(e) {
				return this._nodes[e];
			}
			hasNode(e) {
				return Object.hasOwn(this._nodes, e);
			}
			removeNode(e) {
				var t = this;
				if (Object.hasOwn(this._nodes, e)) {
					var n = (e) => t.removeEdge(t._edgeObjs[e]);
					delete this._nodes[e], this._isCompound && (this._removeFromParentsChildList(e), delete this._parent[e], this.children(e).forEach(function(e) {
						t.setParent(e);
					}), delete this._children[e]), Object.keys(this._in[e]).forEach(n), delete this._in[e], delete this._preds[e], Object.keys(this._out[e]).forEach(n), delete this._out[e], delete this._sucs[e], --this._nodeCount;
				}
				return this;
			}
			setParent(e, t) {
				if (!this._isCompound) throw Error("Cannot set parent in a non-compound graph");
				if (t === void 0) t = r;
				else {
					t += "";
					for (var n = t; n !== void 0; n = this.parent(n)) if (n === e) throw Error("Setting " + t + " as parent of " + e + " would create a cycle");
					this.setNode(t);
				}
				return this.setNode(e), this._removeFromParentsChildList(e), this._parent[e] = t, this._children[t][e] = !0, this;
			}
			_removeFromParentsChildList(e) {
				delete this._children[this._parent[e]][e];
			}
			parent(e) {
				if (this._isCompound) {
					var t = this._parent[e];
					if (t !== r) return t;
				}
			}
			children(e = r) {
				if (this._isCompound) {
					var t = this._children[e];
					if (t) return Object.keys(t);
				} else {
					if (e === r) return this.nodes();
					if (this.hasNode(e)) return [];
				}
			}
			predecessors(e) {
				var t = this._preds[e];
				if (t) return Object.keys(t);
			}
			successors(e) {
				var t = this._sucs[e];
				if (t) return Object.keys(t);
			}
			neighbors(e) {
				var t = this.predecessors(e);
				if (t) {
					let r = new Set(t);
					for (var n of this.successors(e)) r.add(n);
					return Array.from(r.values());
				}
			}
			isLeaf(e) {
				var t;
				return t = this.isDirected() ? this.successors(e) : this.neighbors(e), t.length === 0;
			}
			filterNodes(e) {
				var t = new this.constructor({
					directed: this._isDirected,
					multigraph: this._isMultigraph,
					compound: this._isCompound
				});
				t.setGraph(this.graph());
				var n = this;
				Object.entries(this._nodes).forEach(function([n, r]) {
					e(n) && t.setNode(n, r);
				}), Object.values(this._edgeObjs).forEach(function(e) {
					t.hasNode(e.v) && t.hasNode(e.w) && t.setEdge(e, n.edge(e));
				});
				var r = {};
				function i(e) {
					var a = n.parent(e);
					return a === void 0 || t.hasNode(a) ? (r[e] = a, a) : a in r ? r[a] : i(a);
				}
				return this._isCompound && t.nodes().forEach((e) => t.setParent(e, i(e))), t;
			}
			setDefaultEdgeLabel(e) {
				return this._defaultEdgeLabelFn = e, typeof e != "function" && (this._defaultEdgeLabelFn = () => e), this;
			}
			edgeCount() {
				return this._edgeCount;
			}
			edges() {
				return Object.values(this._edgeObjs);
			}
			setPath(e, t) {
				var n = this, r = arguments;
				return e.reduce(function(e, i) {
					return r.length > 1 ? n.setEdge(e, i, t) : n.setEdge(e, i), i;
				}), this;
			}
			setEdge() {
				var e, t, n, r, i = !1, a = arguments[0];
				typeof a == "object" && a && "v" in a ? (e = a.v, t = a.w, n = a.name, arguments.length === 2 && (r = arguments[1], i = !0)) : (e = a, t = arguments[1], n = arguments[3], arguments.length > 2 && (r = arguments[2], i = !0)), e = "" + e, t = "" + t, n !== void 0 && (n = "" + n);
				var o = l(this._isDirected, e, t, n);
				if (Object.hasOwn(this._edgeLabels, o)) return i && (this._edgeLabels[o] = r), this;
				if (n !== void 0 && !this._isMultigraph) throw Error("Cannot set a named edge when isMultigraph = false");
				this.setNode(e), this.setNode(t), this._edgeLabels[o] = i ? r : this._defaultEdgeLabelFn(e, t, n);
				var c = u(this._isDirected, e, t, n);
				return e = c.v, t = c.w, Object.freeze(c), this._edgeObjs[o] = c, s(this._preds[t], e), s(this._sucs[e], t), this._in[t][o] = c, this._out[e][o] = c, this._edgeCount++, this;
			}
			edge(e, t, n) {
				var r = arguments.length === 1 ? d(this._isDirected, arguments[0]) : l(this._isDirected, e, t, n);
				return this._edgeLabels[r];
			}
			edgeAsObj() {
				let e = this.edge(...arguments);
				return typeof e == "object" ? e : { label: e };
			}
			hasEdge(e, t, n) {
				var r = arguments.length === 1 ? d(this._isDirected, arguments[0]) : l(this._isDirected, e, t, n);
				return Object.hasOwn(this._edgeLabels, r);
			}
			removeEdge(e, t, n) {
				var r = arguments.length === 1 ? d(this._isDirected, arguments[0]) : l(this._isDirected, e, t, n), i = this._edgeObjs[r];
				return i && (e = i.v, t = i.w, delete this._edgeLabels[r], delete this._edgeObjs[r], c(this._preds[t], e), c(this._sucs[e], t), delete this._in[t][r], delete this._out[e][r], this._edgeCount--), this;
			}
			inEdges(e, t) {
				return this.isDirected() ? this.filterEdges(this._in[e], e, t) : this.nodeEdges(e, t);
			}
			outEdges(e, t) {
				return this.isDirected() ? this.filterEdges(this._out[e], e, t) : this.nodeEdges(e, t);
			}
			nodeEdges(e, t) {
				if (e in this._nodes) return this.filterEdges({
					...this._in[e],
					...this._out[e]
				}, e, t);
			}
			filterEdges(e, t, n) {
				if (e) {
					var r = Object.values(e);
					return n ? r.filter(function(e) {
						return e.v === t && e.w === n || e.v === n && e.w === t;
					}) : r;
				}
			}
		};
		function s(e, t) {
			e[t] ? e[t]++ : e[t] = 1;
		}
		function c(e, t) {
			--e[t] || delete e[t];
		}
		function l(e, t, r, a) {
			var o = "" + t, s = "" + r;
			if (!e && o > s) {
				var c = o;
				o = s, s = c;
			}
			return o + i + s + i + (a === void 0 ? n : a);
		}
		function u(e, t, n, r) {
			var i = "" + t, a = "" + n;
			if (!e && i > a) {
				var o = i;
				i = a, a = o;
			}
			var s = {
				v: i,
				w: a
			};
			return r && (s.name = r), s;
		}
		function d(e, t) {
			return l(e, t.v, t.w, t.name);
		}
		t.exports = o;
	}), s = i((e, t) => {
		t.exports = "3.0.2";
	}), c = i((e, t) => {
		t.exports = {
			Graph: o(),
			version: s()
		};
	}), l = i((e, t) => {
		var n = o();
		t.exports = {
			write: r,
			read: s
		};
		function r(e) {
			var t = {
				options: {
					directed: e.isDirected(),
					multigraph: e.isMultigraph(),
					compound: e.isCompound()
				},
				nodes: i(e),
				edges: a(e)
			};
			return e.graph() !== void 0 && (t.value = structuredClone(e.graph())), t;
		}
		function i(e) {
			return e.nodes().map(function(t) {
				var n = e.node(t), r = e.parent(t), i = { v: t };
				return n !== void 0 && (i.value = n), r !== void 0 && (i.parent = r), i;
			});
		}
		function a(e) {
			return e.edges().map(function(t) {
				var n = e.edge(t), r = {
					v: t.v,
					w: t.w
				};
				return t.name !== void 0 && (r.name = t.name), n !== void 0 && (r.value = n), r;
			});
		}
		function s(e) {
			var t = new n(e.options).setGraph(e.value);
			return e.nodes.forEach(function(e) {
				t.setNode(e.v, e.value), e.parent && t.setParent(e.v, e.parent);
			}), e.edges.forEach(function(e) {
				t.setEdge({
					v: e.v,
					w: e.w,
					name: e.name
				}, e.value);
			}), t;
		}
	}), u = i((e, t) => {
		t.exports = r;
		var n = () => 1;
		function r(e, t, r, a) {
			return i(e, String(t), r || n, a || function(t) {
				return e.outEdges(t);
			});
		}
		function i(e, t, n, r) {
			var i = {}, a = !0, o = 0, s = e.nodes(), c = function(e) {
				var t = n(e);
				i[e.v].distance + t < i[e.w].distance && (i[e.w] = {
					distance: i[e.v].distance + t,
					predecessor: e.v
				}, a = !0);
			}, l = function() {
				s.forEach(function(e) {
					r(e).forEach(function(t) {
						var n = t.v === e ? t.v : t.w;
						c({
							v: n,
							w: n === t.v ? t.w : t.v
						});
					});
				});
			};
			s.forEach(function(e) {
				i[e] = { distance: e === t ? 0 : Infinity };
			});
			for (var u = s.length, d = 1; d < u && (a = !1, o++, l(), a); d++);
			if (o === u - 1 && (a = !1, l(), a)) throw Error("The graph contains a negative weight cycle");
			return i;
		}
	}), d = i((e, t) => {
		t.exports = n;
		function n(e) {
			var t = {}, n = [], r;
			function i(n) {
				Object.hasOwn(t, n) || (t[n] = !0, r.push(n), e.successors(n).forEach(i), e.predecessors(n).forEach(i));
			}
			return e.nodes().forEach(function(e) {
				r = [], i(e), r.length && n.push(r);
			}), n;
		}
	}), f = i((e, t) => {
		t.exports = class {
			constructor() {
				a(this, "_arr", []), a(this, "_keyIndices", {});
			}
			size() {
				return this._arr.length;
			}
			keys() {
				return this._arr.map(function(e) {
					return e.key;
				});
			}
			has(e) {
				return Object.hasOwn(this._keyIndices, e);
			}
			priority(e) {
				var t = this._keyIndices[e];
				if (t !== void 0) return this._arr[t].priority;
			}
			min() {
				if (this.size() === 0) throw Error("Queue underflow");
				return this._arr[0].key;
			}
			add(e, t) {
				var n = this._keyIndices;
				if (e = String(e), !Object.hasOwn(n, e)) {
					var r = this._arr, i = r.length;
					return n[e] = i, r.push({
						key: e,
						priority: t
					}), this._decrease(i), !0;
				}
				return !1;
			}
			removeMin() {
				this._swap(0, this._arr.length - 1);
				var e = this._arr.pop();
				return delete this._keyIndices[e.key], this._heapify(0), e.key;
			}
			decrease(e, t) {
				var n = this._keyIndices[e];
				if (t > this._arr[n].priority) throw Error("New priority is greater than current priority. Key: " + e + " Old: " + this._arr[n].priority + " New: " + t);
				this._arr[n].priority = t, this._decrease(n);
			}
			_heapify(e) {
				var t = this._arr, n = 2 * e, r = n + 1, i = e;
				n < t.length && (i = t[n].priority < t[i].priority ? n : i, r < t.length && (i = t[r].priority < t[i].priority ? r : i), i !== e && (this._swap(e, i), this._heapify(i)));
			}
			_decrease(e) {
				for (var t = this._arr, n = t[e].priority, r; e !== 0 && (r = e >> 1, !(t[r].priority < n));) this._swap(e, r), e = r;
			}
			_swap(e, t) {
				var n = this._arr, r = this._keyIndices, i = n[e], a = n[t];
				n[e] = a, n[t] = i, r[a.key] = e, r[i.key] = t;
			}
		};
	}), p = i((e, t) => {
		var n = f();
		t.exports = i;
		var r = () => 1;
		function i(e, t, n, i) {
			return a(e, String(t), n || r, i || function(t) {
				return e.outEdges(t);
			});
		}
		function a(e, t, r, i) {
			var a = {}, o = new n(), s, c, l = function(e) {
				var t = e.v === s ? e.w : e.v, n = a[t], i = r(e), l = c.distance + i;
				if (i < 0) throw Error("dijkstra does not allow negative edge weights. Bad edge: " + e + " Weight: " + i);
				l < n.distance && (n.distance = l, n.predecessor = s, o.decrease(t, l));
			};
			for (e.nodes().forEach(function(e) {
				var n = e === t ? 0 : Infinity;
				a[e] = { distance: n }, o.add(e, n);
			}); o.size() > 0 && (s = o.removeMin(), c = a[s], c.distance !== Infinity);) i(s).forEach(l);
			return a;
		}
	}), m = i((e, t) => {
		var n = p();
		t.exports = r;
		function r(e, t, r) {
			return e.nodes().reduce(function(i, a) {
				return i[a] = n(e, a, t, r), i;
			}, {});
		}
	}), h = i((e, t) => {
		t.exports = n;
		function n(e, t, n) {
			if (e[t].predecessor !== void 0) throw Error("Invalid source vertex");
			if (e[n].predecessor === void 0 && n !== t) throw Error("Invalid destination vertex");
			return {
				weight: e[n].distance,
				path: r(e, t, n)
			};
		}
		function r(e, t, n) {
			for (var r = [], i = n; i !== t;) r.push(i), i = e[i].predecessor;
			return r.push(t), r.reverse();
		}
	}), g = i((e, t) => {
		t.exports = n;
		function n(e) {
			var t = 0, n = [], r = {}, i = [];
			function a(o) {
				var s = r[o] = {
					onStack: !0,
					lowlink: t,
					index: t++
				};
				if (n.push(o), e.successors(o).forEach(function(e) {
					Object.hasOwn(r, e) ? r[e].onStack && (s.lowlink = Math.min(s.lowlink, r[e].index)) : (a(e), s.lowlink = Math.min(s.lowlink, r[e].lowlink));
				}), s.lowlink === s.index) {
					var c = [], l;
					do
						l = n.pop(), r[l].onStack = !1, c.push(l);
					while (o !== l);
					i.push(c);
				}
			}
			return e.nodes().forEach(function(e) {
				Object.hasOwn(r, e) || a(e);
			}), i;
		}
	}), b = i((e, t) => {
		var n = g();
		t.exports = r;
		function r(e) {
			return n(e).filter(function(t) {
				return t.length > 1 || t.length === 1 && e.hasEdge(t[0], t[0]);
			});
		}
	}), x = i((e, t) => {
		t.exports = r;
		var n = () => 1;
		function r(e, t, r) {
			return i(e, t || n, r || function(t) {
				return e.outEdges(t);
			});
		}
		function i(e, t, n) {
			var r = {}, i = e.nodes();
			return i.forEach(function(e) {
				r[e] = {}, r[e][e] = { distance: 0 }, i.forEach(function(t) {
					e !== t && (r[e][t] = { distance: Infinity });
				}), n(e).forEach(function(n) {
					var i = n.v === e ? n.w : n.v, a = t(n);
					r[e][i] = {
						distance: a,
						predecessor: e
					};
				});
			}), i.forEach(function(e) {
				var t = r[e];
				i.forEach(function(n) {
					var a = r[n];
					i.forEach(function(n) {
						var r = a[e], i = t[n], o = a[n], s = r.distance + i.distance;
						s < o.distance && (o.distance = s, o.predecessor = i.predecessor);
					});
				});
			}), r;
		}
	}), S = i((e, t) => {
		function n(e) {
			var t = {}, n = {}, i = [];
			function a(o) {
				if (Object.hasOwn(n, o)) throw new r();
				Object.hasOwn(t, o) || (n[o] = !0, t[o] = !0, e.predecessors(o).forEach(a), delete n[o], i.push(o));
			}
			if (e.sinks().forEach(a), Object.keys(t).length !== e.nodeCount()) throw new r();
			return i;
		}
		var r = class extends Error {
			constructor() {
				super(...arguments);
			}
		};
		t.exports = n, n.CycleException = r;
	}), C = i((e, t) => {
		var n = S();
		t.exports = r;
		function r(e) {
			try {
				n(e);
			} catch (e) {
				if (e instanceof n.CycleException) return !1;
				throw e;
			}
			return !0;
		}
	}), w = i((e, t) => {
		t.exports = n;
		function n(e, t, n, i, a) {
			Array.isArray(t) || (t = [t]);
			var o = (e.isDirected() ? e.successors : e.neighbors).bind(e), s = {};
			return t.forEach(function(t) {
				if (!e.hasNode(t)) throw Error("Graph does not have node: " + t);
				a = r(e, t, n === "post", s, o, i, a);
			}), a;
		}
		function r(e, t, n, i, a, o, s) {
			return Object.hasOwn(i, t) || (i[t] = !0, n || (s = o(s, t)), a(t).forEach(function(t) {
				s = r(e, t, n, i, a, o, s);
			}), n && (s = o(s, t))), s;
		}
	}), T = i((e, t) => {
		var n = w();
		t.exports = r;
		function r(e, t, r) {
			return n(e, t, r, function(e, t) {
				return e.push(t), e;
			}, []);
		}
	}), E = i((e, t) => {
		var n = T();
		t.exports = r;
		function r(e, t) {
			return n(e, t, "post");
		}
	}), D = i((e, t) => {
		var n = T();
		t.exports = r;
		function r(e, t) {
			return n(e, t, "pre");
		}
	}), O = i((e, t) => {
		var n = o(), r = f();
		t.exports = i;
		function i(e, t) {
			var i = new n(), a = {}, o = new r(), s;
			function c(e) {
				var n = e.v === s ? e.w : e.v, r = o.priority(n);
				if (r !== void 0) {
					var i = t(e);
					i < r && (a[n] = s, o.decrease(n, i));
				}
			}
			if (e.nodeCount() === 0) return i;
			e.nodes().forEach(function(e) {
				o.add(e, Infinity), i.setNode(e);
			}), o.decrease(e.nodes()[0], 0);
			for (var l = !1; o.size() > 0;) {
				if (s = o.removeMin(), Object.hasOwn(a, s)) i.setEdge(s, a[s]);
				else {
					if (l) throw Error("Input graph is not connected: " + e);
					l = !0;
				}
				e.nodeEdges(s).forEach(c);
			}
			return i;
		}
	}), k = i((e, t) => {
		var n = p(), r = u();
		t.exports = i;
		function i(e, t, n, r) {
			return a(e, t, n, r || function(t) {
				return e.outEdges(t);
			});
		}
		function a(e, t, i, a) {
			if (i === void 0) return n(e, t, i, a);
			for (var o = !1, s = e.nodes(), c = 0; c < s.length; c++) {
				for (var l = a(s[c]), u = 0; u < l.length; u++) {
					var d = l[u], f = d.v === s[c] ? d.v : d.w;
					i({
						v: f,
						w: f === d.v ? d.w : d.v
					}) < 0 && (o = !0);
				}
				if (o) return r(e, t, i, a);
			}
			return n(e, t, i, a);
		}
	}), A = i((e, t) => {
		t.exports = {
			bellmanFord: u(),
			components: d(),
			dijkstra: p(),
			dijkstraAll: m(),
			extractPath: h(),
			findCycles: b(),
			floydWarshall: x(),
			isAcyclic: C(),
			postorder: E(),
			preorder: D(),
			prim: O(),
			shortestPaths: k(),
			reduce: w(),
			tarjan: g(),
			topsort: S()
		};
	}), M = c();
	t.exports = {
		Graph: M.Graph,
		json: l(),
		alg: A(),
		version: M.version
	};
}), ne = v((e, t) => {
	var n = class {
		constructor() {
			let e = {};
			e._next = e._prev = e, this._sentinel = e;
		}
		dequeue() {
			let e = this._sentinel, t = e._prev;
			if (t !== e) return r(t), t;
		}
		enqueue(e) {
			let t = this._sentinel;
			e._prev && e._next && r(e), e._next = t._next, t._next._prev = e, t._next = e, e._prev = t;
		}
		toString() {
			let e = [], t = this._sentinel, n = t._prev;
			for (; n !== t;) e.push(JSON.stringify(n, i)), n = n._prev;
			return "[" + e.join(", ") + "]";
		}
	};
	function r(e) {
		e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
	}
	function i(e, t) {
		if (e !== "_next" && e !== "_prev") return t;
	}
	t.exports = n;
}), oe = v((e, r) => {
	var i = y().Graph, a = ne();
	r.exports = s;
	var o = () => 1;
	function s(e, t) {
		if (e.nodeCount() <= 1) return [];
		let n = u(e, t || o);
		return c(n.graph, n.buckets, n.zeroIdx).flatMap((t) => e.outEdges(t.v, t.w));
	}
	function c(e, t, n) {
		let r = [], i = t[t.length - 1], a = t[0], o;
		for (; e.nodeCount();) {
			for (; o = a.dequeue();) l(e, t, n, o);
			for (; o = i.dequeue();) l(e, t, n, o);
			if (e.nodeCount()) {
				for (let i = t.length - 2; i > 0; --i) if (o = t[i].dequeue(), o) {
					r = r.concat(l(e, t, n, o, !0));
					break;
				}
			}
		}
		return r;
	}
	function l(e, t, n, r, i) {
		let a = i ? [] : void 0;
		return e.inEdges(r.v).forEach((r) => {
			let o = e.edge(r), s = e.node(r.v);
			i && a.push({
				v: r.v,
				w: r.w
			}), s.out -= o, d(t, n, s);
		}), e.outEdges(r.v).forEach((r) => {
			let i = e.edge(r), a = r.w, o = e.node(a);
			o.in -= i, d(t, n, o);
		}), e.removeNode(r.v), a;
	}
	function u(e, t) {
		let n = new i(), r = 0, o = 0;
		e.nodes().forEach((e) => {
			n.setNode(e, {
				v: e,
				in: 0,
				out: 0
			});
		}), e.edges().forEach((e) => {
			let i = n.edge(e.v, e.w) || 0, a = t(e), s = i + a;
			n.setEdge(e.v, e.w, s), o = Math.max(o, n.node(e.v).out += a), r = Math.max(r, n.node(e.w).in += a);
		});
		let s = f(o + r + 3).map(() => new a()), c = r + 1;
		return n.nodes().forEach((e) => {
			d(s, c, n.node(e));
		}), {
			graph: n,
			buckets: s,
			zeroIdx: c
		};
	}
	function d(e, t, n) {
		n.out ? n.in ? e[n.out - n.in + t].enqueue(n) : e[e.length - 1].enqueue(n) : e[0].enqueue(n);
	}
	function f(e) {
		let t = [];
		for (let n = 0; n < e; n++) t.push(n);
		return t;
	}
}), _ = v((e, n) => {
	var r = y().Graph;
	n.exports = {
		addBorderNode: p,
		addDummyNode: i,
		applyWithChunking: g,
		asNonCompoundGraph: o,
		buildLayerMatrix: u,
		intersectRect: l,
		mapValues: O,
		maxRank: b,
		normalizeRanks: d,
		notime: C,
		partition: x,
		pick: D,
		predecessorWeights: c,
		range: E,
		removeEmptyRanks: f,
		simplify: a,
		successorWeights: s,
		time: S,
		uniqueId: T,
		zipObject: k
	};
	function i(e, t, n, r) {
		for (var i = r; e.hasNode(i);) i = T(r);
		return n.dummy = t, e.setNode(i, n), i;
	}
	function a(e) {
		let t = new r().setGraph(e.graph());
		return e.nodes().forEach((n) => t.setNode(n, e.node(n))), e.edges().forEach((n) => {
			let r = t.edge(n.v, n.w) || {
				weight: 0,
				minlen: 1
			}, i = e.edge(n);
			t.setEdge(n.v, n.w, {
				weight: r.weight + i.weight,
				minlen: Math.max(r.minlen, i.minlen)
			});
		}), t;
	}
	function o(e) {
		let t = new r({ multigraph: e.isMultigraph() }).setGraph(e.graph());
		return e.nodes().forEach((n) => {
			e.children(n).length || t.setNode(n, e.node(n));
		}), e.edges().forEach((n) => {
			t.setEdge(n, e.edge(n));
		}), t;
	}
	function s(e) {
		let t = e.nodes().map((t) => {
			let n = {};
			return e.outEdges(t).forEach((t) => {
				n[t.w] = (n[t.w] || 0) + e.edge(t).weight;
			}), n;
		});
		return k(e.nodes(), t);
	}
	function c(e) {
		let t = e.nodes().map((t) => {
			let n = {};
			return e.inEdges(t).forEach((t) => {
				n[t.v] = (n[t.v] || 0) + e.edge(t).weight;
			}), n;
		});
		return k(e.nodes(), t);
	}
	function l(e, t) {
		let n = e.x, r = e.y, i = t.x - n, a = t.y - r, o = e.width / 2, s = e.height / 2;
		if (!i && !a) throw Error("Not possible to find intersection inside of the rectangle");
		let c, l;
		return Math.abs(a) * o > Math.abs(i) * s ? (a < 0 && (s = -s), c = s * i / a, l = s) : (i < 0 && (o = -o), c = o, l = o * a / i), {
			x: n + c,
			y: r + l
		};
	}
	function u(e) {
		let t = E(b(e) + 1).map(() => []);
		return e.nodes().forEach((n) => {
			let r = e.node(n), i = r.rank;
			i !== void 0 && (t[i][r.order] = n);
		}), t;
	}
	function d(e) {
		let t = e.nodes().map((t) => {
			let n = e.node(t).rank;
			return n === void 0 ? Number.MAX_VALUE : n;
		}), n = g(Math.min, t);
		e.nodes().forEach((t) => {
			let r = e.node(t);
			Object.hasOwn(r, "rank") && (r.rank -= n);
		});
	}
	function f(e) {
		let t = e.nodes().map((t) => e.node(t).rank).filter((e) => e !== void 0), n = g(Math.min, t), r = [];
		e.nodes().forEach((t) => {
			let i = e.node(t).rank - n;
			r[i] || (r[i] = []), r[i].push(t);
		});
		let i = 0, a = e.graph().nodeRankFactor;
		Array.from(r).forEach((t, n) => {
			t === void 0 && n % a !== 0 ? --i : t !== void 0 && i && t.forEach((t) => e.node(t).rank += i);
		});
	}
	function p(e, t, n, r) {
		let a = {
			width: 0,
			height: 0
		};
		return arguments.length >= 4 && (a.rank = n, a.order = r), i(e, "border", a, t);
	}
	function m(e, t = h) {
		let n = [];
		for (let r = 0; r < e.length; r += t) {
			let i = e.slice(r, r + t);
			n.push(i);
		}
		return n;
	}
	var h = 65535;
	function g(e, t) {
		if (t.length > h) {
			let n = m(t);
			return e.apply(null, n.map((t) => e.apply(null, t)));
		} else return e.apply(null, t);
	}
	function b(e) {
		let t = e.nodes().map((t) => {
			let n = e.node(t).rank;
			return n === void 0 ? Number.MIN_VALUE : n;
		});
		return g(Math.max, t);
	}
	function x(e, t) {
		let n = {
			lhs: [],
			rhs: []
		};
		return e.forEach((e) => {
			t(e) ? n.lhs.push(e) : n.rhs.push(e);
		}), n;
	}
	function S(e, t) {
		let n = Date.now();
		try {
			return t();
		} finally {
			console.log(e + " time: " + (Date.now() - n) + "ms");
		}
	}
	function C(e, t) {
		return t();
	}
	var w = 0;
	function T(e) {
		return e + ("" + ++w);
	}
	function E(e, t, n = 1) {
		t ?? (t = e, e = 0);
		let r = (e) => e < t;
		n < 0 && (r = (e) => t < e);
		let i = [];
		for (let t = e; r(t); t += n) i.push(t);
		return i;
	}
	function D(e, t) {
		let n = {};
		for (let r of t) e[r] !== void 0 && (n[r] = e[r]);
		return n;
	}
	function O(e, t) {
		let n = t;
		return typeof t == "string" && (n = (e) => e[t]), Object.entries(e).reduce((e, [t, r]) => (e[t] = n(r, t), e), {});
	}
	function k(e, t) {
		return e.reduce((e, n, r) => (e[n] = t[r], e), {});
	}
}), pe = v((e, t) => {
	var n = oe(), a = _().uniqueId;
	t.exports = {
		run: o,
		undo: c
	};
	function o(e) {
		(e.graph().acyclicer === "greedy" ? n(e, t(e)) : s(e)).forEach((t) => {
			let n = e.edge(t);
			e.removeEdge(t), n.forwardName = t.name, n.reversed = !0, e.setEdge(t.w, t.v, n, a("rev"));
		});
		function t(e) {
			return (t) => e.edge(t).weight;
		}
	}
	function s(e) {
		let t = [], n = {}, r = {};
		function i(a) {
			Object.hasOwn(r, a) || (r[a] = !0, n[a] = !0, e.outEdges(a).forEach((e) => {
				Object.hasOwn(n, e.w) ? t.push(e) : i(e.w);
			}), delete n[a]);
		}
		return e.nodes().forEach(i), t;
	}
	function c(e) {
		e.edges().forEach((t) => {
			let n = e.edge(t);
			if (n.reversed) {
				e.removeEdge(t);
				let r = n.forwardName;
				delete n.reversed, delete n.forwardName, e.setEdge(t.w, t.v, n, r);
			}
		});
	}
}), we = v((e, t) => {
	var n = _();
	t.exports = {
		run: r,
		undo: o
	};
	function r(e) {
		e.graph().dummyChains = [], e.edges().forEach((t) => a(e, t));
	}
	function a(e, t) {
		let r = t.v, i = e.node(r).rank, a = t.w, o = e.node(a).rank, s = t.name, c = e.edge(t), l = c.labelRank;
		if (o === i + 1) return;
		e.removeEdge(t);
		let u, d, f;
		for (f = 0, ++i; i < o; ++f, ++i) c.points = [], d = {
			width: 0,
			height: 0,
			edgeLabel: c,
			edgeObj: t,
			rank: i
		}, u = n.addDummyNode(e, "edge", d, "_d"), i === l && (d.width = c.width, d.height = c.height, d.dummy = "edge-label", d.labelpos = c.labelpos), e.setEdge(r, u, { weight: c.weight }, s), f === 0 && e.graph().dummyChains.push(u), r = u;
		e.setEdge(r, a, { weight: c.weight }, s);
	}
	function o(e) {
		e.graph().dummyChains.forEach((t) => {
			let n = e.node(t), r = n.edgeLabel, i;
			for (e.setEdge(n.edgeObj, r); n.dummy;) i = 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 = i, n = e.node(t);
		});
	}
}), j = v((e, t) => {
	var { applyWithChunking: n } = _();
	t.exports = {
		longestPath: r,
		slack: a
	};
	function r(e) {
		var t = {};
		function r(i) {
			var a = e.node(i);
			if (Object.hasOwn(t, i)) return a.rank;
			t[i] = !0;
			let o = e.outEdges(i).map((t) => t == null ? Infinity : r(t.w) - e.edge(t).minlen);
			var s = n(Math.min, o);
			return s === Infinity && (s = 0), a.rank = s;
		}
		e.sources().forEach(r);
	}
	function a(e, t) {
		return e.node(t.w).rank - e.node(t.v).rank - e.edge(t).minlen;
	}
}), G = v((e, n) => {
	var r = y().Graph, i = j().slack;
	n.exports = a;
	function a(e) {
		var t = new r({ directed: !1 }), n = e.nodes()[0], a = e.nodeCount();
		t.setNode(n, {});
		for (var s, u; o(t, e) < a;) s = c(t, e), u = t.hasNode(s.v) ? i(e, s) : -i(e, s), l(t, e, u);
		return t;
	}
	function o(e, t) {
		function n(r) {
			t.nodeEdges(r).forEach((a) => {
				var o = a.v, s = r === o ? a.w : o;
				!e.hasNode(s) && !i(t, a) && (e.setNode(s, {}), e.setEdge(r, s, {}), n(s));
			});
		}
		return e.nodes().forEach(n), e.nodeCount();
	}
	function c(e, t) {
		return t.edges().reduce((n, r) => {
			let a = Infinity;
			return e.hasNode(r.v) !== e.hasNode(r.w) && (a = i(t, r)), a < n[0] ? [a, r] : n;
		}, [Infinity, null])[1];
	}
	function l(e, t, n) {
		e.nodes().forEach((e) => t.node(e).rank += n);
	}
}), Ie = v((e, n) => {
	var r = G(), a = j().slack, o = j().longestPath, l = y().alg.preorder, u = y().alg.postorder, d = _().simplify;
	n.exports = f, f.initLowLimValues = g, f.initCutValues = p, f.calcCutValue = h, f.leaveEdge = x, f.enterEdge = S, f.exchangeEdges = C;
	function f(e) {
		e = d(e), o(e);
		var t = r(e);
		g(t), p(t, e);
		for (var n, i; n = x(t);) i = S(t, e, n), C(t, e, n, i);
	}
	function p(e, t) {
		var n = u(e, e.nodes());
		n = n.slice(0, n.length - 1), n.forEach((n) => m(e, t, n));
	}
	function m(e, t, n) {
		var r = e.node(n).parent;
		e.edge(n, r).cutvalue = h(e, t, n);
	}
	function h(e, t, n) {
		var r = e.node(n).parent, i = !0, a = t.edge(n, r), o = 0;
		return a ||= (i = !1, t.edge(r, n)), o = a.weight, t.nodeEdges(n).forEach((a) => {
			var s = a.v === n, c = s ? a.w : a.v;
			if (c !== r) {
				var l = s === i, u = t.edge(a).weight;
				if (o += l ? u : -u, T(e, n, c)) {
					var d = e.edge(n, c).cutvalue;
					o += l ? -d : d;
				}
			}
		}), o;
	}
	function g(e, t) {
		arguments.length < 2 && (t = e.nodes()[0]), b(e, {}, 1, t);
	}
	function b(e, t, n, r, i) {
		var a = n, o = e.node(r);
		return t[r] = !0, e.neighbors(r).forEach((i) => {
			Object.hasOwn(t, i) || (n = b(e, t, n, i, r));
		}), o.low = a, o.lim = n++, i ? o.parent = i : delete o.parent, n;
	}
	function x(e) {
		return e.edges().find((t) => e.edge(t).cutvalue < 0);
	}
	function S(e, t, n) {
		var r = n.v, i = n.w;
		t.hasEdge(r, i) || (r = n.w, i = n.v);
		var o = e.node(r), s = e.node(i), c = o, l = !1;
		return o.lim > s.lim && (c = s, l = !0), t.edges().filter((t) => l === E(e, e.node(t.v), c) && l !== E(e, e.node(t.w), c)).reduce((e, n) => a(t, n) < a(t, e) ? n : e);
	}
	function C(e, t, n, r) {
		var i = n.v, a = n.w;
		e.removeEdge(i, a), e.setEdge(r.v, r.w, {}), g(e), p(e, t), w(e, t);
	}
	function w(e, t) {
		var n = l(e, e.nodes().find((e) => !t.node(e).parent));
		n = n.slice(1), n.forEach((n) => {
			var r = e.node(n).parent, i = t.edge(n, r), a = !1;
			i || (i = t.edge(r, n), a = !0), t.node(n).rank = t.node(r).rank + (a ? i.minlen : -i.minlen);
		});
	}
	function T(e, t, n) {
		return e.hasEdge(t, n);
	}
	function E(e, t, n) {
		return n.low <= t.lim && t.lim <= n.lim;
	}
}), qe = v((e, t) => {
	var n = j().longestPath, r = G(), i = Ie();
	t.exports = a;
	function a(e) {
		var t = e.graph().ranker;
		if (t instanceof Function) return t(e);
		switch (e.graph().ranker) {
			case "network-simplex":
				d(e);
				break;
			case "tight-tree":
				u(e);
				break;
			case "longest-path":
				o(e);
				break;
			case "none": break;
			default: d(e);
		}
	}
	var o = n;
	function u(e) {
		n(e), r(e);
	}
	function d(e) {
		i(e);
	}
}), Re = v((e, t) => {
	t.exports = n;
	function n(e) {
		let t = i(e);
		e.graph().dummyChains.forEach((n) => {
			let i = e.node(n), a = i.edgeObj, o = r(e, t, a.v, a.w), s = o.path, c = o.lca, l = 0, u = s[l], d = !0;
			for (; n !== a.w;) {
				if (i = e.node(n), d) {
					for (; (u = s[l]) !== c && e.node(u).maxRank < i.rank;) l++;
					u === c && (d = !1);
				}
				if (!d) {
					for (; l < s.length - 1 && e.node(u = s[l + 1]).minRank <= i.rank;) l++;
					u = s[l];
				}
				e.setParent(n, u), n = e.successors(n)[0];
			}
		});
	}
	function r(e, t, n, r) {
		let i = [], a = [], o = Math.min(t[n].low, t[r].low), s = Math.max(t[n].lim, t[r].lim), c, l;
		c = n;
		do
			c = e.parent(c), i.push(c);
		while (c && (t[c].low > o || s > t[c].lim));
		for (l = c, c = r; (c = e.parent(c)) !== l;) a.push(c);
		return {
			path: i.concat(a.reverse()),
			lca: l
		};
	}
	function i(e) {
		let t = {}, n = 0;
		function r(i) {
			let a = n;
			e.children(i).forEach(r), t[i] = {
				low: a,
				lim: n++
			};
		}
		return e.children().forEach(r), t;
	}
}), Pe = v((e, t) => {
	var n = _();
	t.exports = {
		run: r,
		cleanup: c
	};
	function r(e) {
		let t = n.addDummyNode(e, "root", {}, "_root"), r = o(e), i = Object.values(r), c = n.applyWithChunking(Math.max, i) - 1, l = 2 * c + 1;
		e.graph().nestingRoot = t, e.edges().forEach((t) => e.edge(t).minlen *= l);
		let u = s(e) + 1;
		e.children().forEach((n) => a(e, t, l, u, c, r, n)), e.graph().nodeRankFactor = l;
	}
	function a(e, t, r, i, o, s, c) {
		let l = e.children(c);
		if (!l.length) {
			c !== t && e.setEdge(t, c, {
				weight: 0,
				minlen: r
			});
			return;
		}
		let u = n.addBorderNode(e, "_bt"), d = n.addBorderNode(e, "_bb"), f = e.node(c);
		e.setParent(u, c), f.borderTop = u, e.setParent(d, c), f.borderBottom = d, l.forEach((n) => {
			a(e, t, r, i, o, s, n);
			let l = e.node(n), f = l.borderTop ? l.borderTop : n, p = l.borderBottom ? l.borderBottom : n, m = l.borderTop ? i : 2 * i, h = f === p ? o - s[c] + 1 : 1;
			e.setEdge(u, f, {
				weight: m,
				minlen: h,
				nestingEdge: !0
			}), e.setEdge(p, d, {
				weight: m,
				minlen: h,
				nestingEdge: !0
			});
		}), e.parent(c) || e.setEdge(t, u, {
			weight: 0,
			minlen: o + s[c]
		});
	}
	function o(e) {
		var t = {};
		function n(r, i) {
			var a = e.children(r);
			a && a.length && a.forEach((e) => n(e, i + 1)), t[r] = i;
		}
		return e.children().forEach((e) => n(e, 1)), t;
	}
	function s(e) {
		return e.edges().reduce((t, n) => t + e.edge(n).weight, 0);
	}
	function c(e) {
		var t = e.graph();
		e.removeNode(t.nestingRoot), delete t.nestingRoot, e.edges().forEach((t) => {
			e.edge(t).nestingEdge && e.removeEdge(t);
		});
	}
}), Ge = v((e, t) => {
	var n = _();
	t.exports = r;
	function r(e) {
		function t(n) {
			let r = e.children(n), i = e.node(n);
			if (r.length && r.forEach(t), Object.hasOwn(i, "minRank")) {
				i.borderLeft = [], i.borderRight = [];
				for (let t = i.minRank, r = i.maxRank + 1; t < r; ++t) a(e, "borderLeft", "_bl", n, i, t), a(e, "borderRight", "_br", n, i, t);
			}
		}
		e.children().forEach(t);
	}
	function a(e, t, r, i, a, o) {
		let s = {
			width: 0,
			height: 0,
			rank: o,
			borderType: t
		}, c = a[t][o - 1], l = n.addDummyNode(e, "border", s, r);
		a[t][o] = l, e.setParent(l, i), c && e.setEdge(c, l, { weight: 1 });
	}
}), Be = v((e, t) => {
	t.exports = {
		adjust: n,
		undo: r
	};
	function n(e) {
		let t = e.graph().rankdir.toLowerCase();
		(t === "lr" || t === "rl") && i(e);
	}
	function r(e) {
		let t = e.graph().rankdir.toLowerCase();
		(t === "bt" || t === "rl") && o(e), (t === "lr" || t === "rl") && (c(e), i(e));
	}
	function i(e) {
		e.nodes().forEach((t) => a(e.node(t))), e.edges().forEach((t) => a(e.edge(t)));
	}
	function a(e) {
		let t = e.width;
		e.width = e.height, e.height = t;
	}
	function o(e) {
		e.nodes().forEach((t) => s(e.node(t))), e.edges().forEach((t) => {
			let n = e.edge(t);
			n.points.forEach(s), Object.hasOwn(n, "y") && s(n);
		});
	}
	function s(e) {
		e.y = -e.y;
	}
	function c(e) {
		e.nodes().forEach((t) => l(e.node(t))), e.edges().forEach((t) => {
			let n = e.edge(t);
			n.points.forEach(l), Object.hasOwn(n, "x") && l(n);
		});
	}
	function l(e) {
		let t = e.x;
		e.x = e.y, e.y = t;
	}
}), Xe = v((e, t) => {
	var n = _();
	t.exports = r;
	function r(e) {
		let t = {}, r = e.nodes().filter((t) => !e.children(t).length), i = r.map((t) => e.node(t).rank), a = n.applyWithChunking(Math.max, i), o = n.range(a + 1).map(() => []);
		function s(n) {
			t[n] || (t[n] = !0, o[e.node(n).rank].push(n), e.successors(n).forEach(s));
		}
		return r.sort((t, n) => e.node(t).rank - e.node(n).rank).forEach(s), o;
	}
}), Ue = v((e, t) => {
	var n = _().zipObject;
	t.exports = r;
	function r(e, t) {
		let n = 0;
		for (let r = 1; r < t.length; ++r) n += a(e, t[r - 1], t[r]);
		return n;
	}
	function a(e, t, r) {
		let i = n(r, r.map((e, t) => t)), a = t.flatMap((t) => e.outEdges(t).map((t) => ({
			pos: i[t.w],
			weight: e.edge(t).weight
		})).sort((e, t) => e.pos - t.pos)), o = 1;
		for (; o < r.length;) o <<= 1;
		let s = 2 * o - 1;
		--o;
		let c = Array(s).fill(0), l = 0;
		return a.forEach((e) => {
			let t = e.pos + o;
			c[t] += e.weight;
			let n = 0;
			for (; t > 0;) t % 2 && (n += c[t + 1]), t = t - 1 >> 1, c[t] += e.weight;
			l += e.weight * n;
		}), l;
	}
}), Qe = v((e, t) => {
	t.exports = n;
	function n(e, t = []) {
		return t.map((t) => {
			let n = e.inEdges(t);
			if (n.length) {
				let r = n.reduce((t, n) => {
					let r = e.edge(n), i = e.node(n.v);
					return {
						sum: t.sum + r.weight * i.order,
						weight: t.weight + r.weight
					};
				}, {
					sum: 0,
					weight: 0
				});
				return {
					v: t,
					barycenter: r.sum / r.weight,
					weight: r.weight
				};
			} else return { v: t };
		});
	}
}), Ze = v((e, t) => {
	var n = _();
	t.exports = r;
	function r(e, t) {
		let n = {};
		return e.forEach((e, t) => {
			let r = n[e.v] = {
				indegree: 0,
				in: [],
				out: [],
				vs: [e.v],
				i: t
			};
			e.barycenter !== void 0 && (r.barycenter = e.barycenter, r.weight = e.weight);
		}), t.edges().forEach((e) => {
			let t = n[e.v], r = n[e.w];
			t !== void 0 && r !== void 0 && (r.indegree++, t.out.push(n[e.w]));
		}), a(Object.values(n).filter((e) => !e.indegree));
	}
	function a(e) {
		let t = [];
		function r(e) {
			return (t) => {
				t.merged || (t.barycenter === void 0 || e.barycenter === void 0 || t.barycenter >= e.barycenter) && o(e, t);
			};
		}
		function i(t) {
			return (n) => {
				n.in.push(t), --n.indegree === 0 && e.push(n);
			};
		}
		for (; e.length;) {
			let n = e.pop();
			t.push(n), n.in.reverse().forEach(r(n)), n.out.forEach(i(n));
		}
		return t.filter((e) => !e.merged).map((e) => n.pick(e, [
			"vs",
			"i",
			"barycenter",
			"weight"
		]));
	}
	function o(e, t) {
		let n = 0, r = 0;
		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;
	}
}), tt = v((e, t) => {
	var n = _();
	t.exports = r;
	function r(e, t) {
		let r = n.partition(e, (e) => Object.hasOwn(e, "barycenter")), i = r.lhs, s = r.rhs.sort((e, t) => t.i - e.i), c = [], l = 0, u = 0, d = 0;
		i.sort(o(!!t)), d = a(c, s, d), i.forEach((e) => {
			d += e.vs.length, c.push(e.vs), l += e.barycenter * e.weight, u += e.weight, d = a(c, s, d);
		});
		let f = { vs: c.flat(!0) };
		return u && (f.barycenter = l / u, f.weight = u), f;
	}
	function a(e, t, n) {
		let r;
		for (; t.length && (r = t[t.length - 1]).i <= n;) t.pop(), e.push(r.vs), n++;
		return n;
	}
	function o(e) {
		return (t, n) => t.barycenter < n.barycenter ? -1 : t.barycenter > n.barycenter ? 1 : e ? n.i - t.i : t.i - n.i;
	}
}), it = v((e, t) => {
	var n = Qe(), r = Ze(), i = tt();
	t.exports = a;
	function a(e, t, c, l) {
		let u = e.children(t), d = e.node(t), f = d ? d.borderLeft : void 0, p = d ? d.borderRight : void 0, m = {};
		f && (u = u.filter((e) => e !== f && e !== p));
		let h = n(e, u);
		h.forEach((t) => {
			if (e.children(t.v).length) {
				let n = a(e, t.v, c, l);
				m[t.v] = n, Object.hasOwn(n, "barycenter") && s(t, n);
			}
		});
		let g = r(h, c);
		o(g, m);
		let b = i(g, l);
		if (f && (b.vs = [
			f,
			b.vs,
			p
		].flat(!0), e.predecessors(f).length)) {
			let t = e.node(e.predecessors(f)[0]), n = e.node(e.predecessors(p)[0]);
			Object.hasOwn(b, "barycenter") || (b.barycenter = 0, b.weight = 0), b.barycenter = (b.barycenter * b.weight + t.order + n.order) / (b.weight + 2), b.weight += 2;
		}
		return b;
	}
	function o(e, t) {
		e.forEach((e) => {
			e.vs = e.vs.flatMap((e) => t[e] ? t[e].vs : e);
		});
	}
	function s(e, t) {
		e.barycenter === void 0 ? (e.barycenter = t.barycenter, e.weight = t.weight) : (e.barycenter = (e.barycenter * e.weight + t.barycenter * t.weight) / (e.weight + t.weight), e.weight += t.weight);
	}
}), st = v((e, n) => {
	var r = y().Graph, a = _();
	n.exports = o;
	function o(e, t, n, i) {
		i ||= e.nodes();
		let a = s(e), o = new r({ compound: !0 }).setGraph({ root: a }).setDefaultNodeLabel((t) => e.node(t));
		return i.forEach((r) => {
			let i = e.node(r), s = e.parent(r);
			(i.rank === t || i.minRank <= t && t <= i.maxRank) && (o.setNode(r), o.setParent(r, s || a), e[n](r).forEach((t) => {
				let n = t.v === r ? t.w : t.v, i = o.edge(n, r), a = i === void 0 ? 0 : i.weight;
				o.setEdge(n, r, { weight: e.edge(t).weight + a });
			}), Object.hasOwn(i, "minRank") && o.setNode(r, {
				borderLeft: i.borderLeft[t],
				borderRight: i.borderRight[t]
			}));
		}), o;
	}
	function s(e) {
		for (var t; e.hasNode(t = a.uniqueId("_root")););
		return t;
	}
}), dt = v((e, t) => {
	t.exports = n;
	function n(e, t, n) {
		let r = {}, i;
		n.forEach((n) => {
			let a = e.parent(n), o, s;
			for (; a;) {
				if (o = e.parent(a), o ? (s = r[o], r[o] = a) : (s = i, i = a), s && s !== a) {
					t.setEdge(s, a);
					return;
				}
				a = o;
			}
		});
	}
}), ft = v((e, n) => {
	var r = Xe(), a = Ue(), o = it(), s = st(), c = dt(), l = y().Graph, u = _();
	n.exports = d;
	function d(e, t = {}) {
		if (typeof t.customOrder == "function") {
			t.customOrder(e, d);
			return;
		}
		let n = u.maxRank(e), i = f(e, u.range(1, n + 1), "inEdges"), o = f(e, u.range(n - 1, -1, -1), "outEdges"), s = r(e);
		if (m(e, s), t.disableOptimalOrderHeuristic) return;
		let c = Infinity, l, h = t.constraints || [];
		for (let t = 0, n = 0; n < 4; ++t, ++n) {
			p(t % 2 ? i : o, t % 4 >= 2, h), s = u.buildLayerMatrix(e);
			let r = a(e, s);
			r < c ? (n = 0, l = Object.assign({}, s), c = r) : r === c && (l = structuredClone(s));
		}
		m(e, l);
	}
	function f(e, t, n) {
		let r = /* @__PURE__ */ new Map(), i = (e, t) => {
			r.has(e) || r.set(e, []), r.get(e).push(t);
		};
		for (let t of e.nodes()) {
			let n = e.node(t);
			if (typeof n.rank == "number" && i(n.rank, t), typeof n.minRank == "number" && typeof n.maxRank == "number") for (let e = n.minRank; e <= n.maxRank; e++) e !== n.rank && i(e, t);
		}
		return t.map(function(t) {
			return s(e, t, n, r.get(t) || []);
		});
	}
	function p(e, t, n) {
		let r = new l();
		e.forEach(function(e) {
			n.forEach((e) => r.setEdge(e.left, e.right));
			let i = e.graph().root, a = o(e, i, r, t);
			a.vs.forEach((t, n) => e.node(t).order = n), c(e, r, a.vs);
		});
	}
	function m(e, t) {
		Object.values(t).forEach((t) => t.forEach((t, n) => e.node(t).order = n));
	}
}), yt = v((e, n) => {
	var r = y().Graph, a = _();
	n.exports = {
		positionX: b,
		findType1Conflicts: o,
		findType2Conflicts: s,
		addConflict: l,
		hasConflict: u,
		verticalAlignment: d,
		horizontalCompaction: f,
		alignCoordinates: h,
		findSmallestWidthAlignment: m,
		balance: g
	};
	function o(e, t) {
		let n = {};
		function r(t, r) {
			let i = 0, a = 0, o = t.length, s = r[r.length - 1];
			return r.forEach((t, u) => {
				let d = c(e, t), f = d ? e.node(d).order : o;
				(d || t === s) && (r.slice(a, u + 1).forEach((t) => {
					e.predecessors(t).forEach((r) => {
						let a = e.node(r), o = a.order;
						(o < i || f < o) && !(a.dummy && e.node(t).dummy) && l(n, r, t);
					});
				}), a = u + 1, i = f);
			}), r;
		}
		return t.length && t.reduce(r), n;
	}
	function s(e, t) {
		let n = {};
		function r(t, r, i, o, s) {
			let c;
			a.range(r, i).forEach((r) => {
				c = t[r], e.node(c).dummy && e.predecessors(c).forEach((t) => {
					let r = e.node(t);
					r.dummy && (r.order < o || r.order > s) && l(n, t, c);
				});
			});
		}
		function i(t, n) {
			let i = -1, a, o = 0;
			return n.forEach((s, c) => {
				if (e.node(s).dummy === "border") {
					let t = e.predecessors(s);
					t.length && (a = e.node(t[0]).order, r(n, o, c, i, a), o = c, i = a);
				}
				r(n, o, n.length, a, t.length);
			}), n;
		}
		return t.length && t.reduce(i), n;
	}
	function c(e, t) {
		if (e.node(t).dummy) return e.predecessors(t).find((t) => e.node(t).dummy);
	}
	function l(e, t, n) {
		if (t > n) {
			let e = t;
			t = n, n = e;
		}
		let r = e[t];
		r || (e[t] = r = {}), r[n] = !0;
	}
	function u(e, t, n) {
		if (t > n) {
			let e = t;
			t = n, n = e;
		}
		return !!e[t] && Object.hasOwn(e[t], n);
	}
	function d(e, t, n, r) {
		let i = {}, a = {}, o = {};
		return t.forEach((e) => {
			e.forEach((e, t) => {
				i[e] = e, a[e] = e, o[e] = t;
			});
		}), t.forEach((e) => {
			let t = -1;
			e.forEach((e) => {
				let s = r(e);
				if (s.length) {
					s = s.sort((e, t) => o[e] - o[t]);
					let r = (s.length - 1) / 2;
					for (let c = Math.floor(r), l = Math.ceil(r); c <= l; ++c) {
						let r = s[c];
						a[e] === e && t < o[r] && !u(n, e, r) && (a[r] = e, a[e] = i[e] = i[r], t = o[r]);
					}
				}
			});
		}), {
			root: i,
			align: a
		};
	}
	function f(e, t, n, r, i) {
		let a = {}, o = p(e, t, n, i), s = i ? "borderLeft" : "borderRight";
		function c(e, t) {
			let n = o.nodes().slice(), r = {}, i = n.pop();
			for (; i;) {
				if (r[i]) e(i);
				else {
					r[i] = !0, n.push(i);
					for (let e of t(i)) n.push(e);
				}
				i = n.pop();
			}
		}
		function l(e) {
			a[e] = o.inEdges(e).reduce((e, t) => Math.max(e, a[t.v] + o.edge(t)), 0);
		}
		function u(t) {
			let n = o.outEdges(t).reduce((e, t) => Math.min(e, a[t.w] - o.edge(t)), Infinity), r = e.node(t);
			n !== Infinity && r.borderType !== s && (a[t] = Math.max(a[t], n));
		}
		return c(l, o.predecessors.bind(o)), c(u, o.successors.bind(o)), Object.keys(r).forEach((e) => a[e] = a[n[e]]), a;
	}
	function p(e, t, n, i) {
		let a = new r(), o = e.graph(), s = x(o.nodesep, o.edgesep, i);
		return t.forEach((t) => {
			let r;
			t.forEach((t) => {
				let i = n[t];
				if (a.setNode(i), r) {
					var o = n[r], c = a.edge(o, i);
					a.setEdge(o, i, Math.max(s(e, t, r), c || 0));
				}
				r = t;
			});
		}), a;
	}
	function m(e, t) {
		return Object.values(t).reduce((t, n) => {
			let r = -Infinity, i = Infinity;
			Object.entries(n).forEach(([t, n]) => {
				let a = S(e, t) / 2;
				r = Math.max(n + a, r), i = Math.min(n - a, i);
			});
			let a = r - i;
			return a < t[0] && (t = [a, n]), t;
		}, [Infinity, null])[1];
	}
	function h(e, t) {
		let n = Object.values(t), r = a.applyWithChunking(Math.min, n), i = a.applyWithChunking(Math.max, n);
		["u", "d"].forEach((n) => {
			["l", "r"].forEach((o) => {
				let s = n + o, c = e[s];
				if (c === t) return;
				let l = Object.values(c), u = r - a.applyWithChunking(Math.min, l);
				o !== "l" && (u = i - a.applyWithChunking(Math.max, l)), u && (e[s] = a.mapValues(c, (e) => e + u));
			});
		});
	}
	function g(e, t) {
		return a.mapValues(e.ul, (n, r) => {
			if (t) return e[t.toLowerCase()][r];
			{
				let t = Object.values(e).map((e) => e[r]).sort((e, t) => e - t);
				return (t[1] + t[2]) / 2;
			}
		});
	}
	function b(e) {
		let t = a.buildLayerMatrix(e), n = Object.assign(o(e, t), s(e, t)), r = {}, i;
		return ["u", "d"].forEach((o) => {
			i = o === "u" ? t : Object.values(t).reverse(), ["l", "r"].forEach((t) => {
				t === "r" && (i = i.map((e) => Object.values(e).reverse()));
				let s = (o === "u" ? e.predecessors : e.successors).bind(e), c = d(e, i, n, s), l = f(e, i, c.root, c.align, t === "r");
				t === "r" && (l = a.mapValues(l, (e) => -e)), r[o + t] = l;
			});
		}), h(r, m(e, r)), g(r, e.graph().align);
	}
	function x(e, t, n) {
		return (r, i, a) => {
			let o = r.node(i), s = r.node(a), c = 0, l;
			if (c += o.width / 2, Object.hasOwn(o, "labelpos")) switch (o.labelpos.toLowerCase()) {
				case "l":
					l = -o.width / 2;
					break;
				case "r":
					l = o.width / 2;
					break;
			}
			if (l && (c += n ? l : -l), l = 0, c += (o.dummy ? t : e) / 2, c += (s.dummy ? t : e) / 2, c += s.width / 2, Object.hasOwn(s, "labelpos")) switch (s.labelpos.toLowerCase()) {
				case "l":
					l = s.width / 2;
					break;
				case "r":
					l = -s.width / 2;
					break;
			}
			return l && (c += n ? l : -l), l = 0, c;
		};
	}
	function S(e, t) {
		return e.node(t).width;
	}
}), Nt = v((e, t) => {
	var n = _(), r = yt().positionX;
	t.exports = a;
	function a(e) {
		e = n.asNonCompoundGraph(e), o(e), Object.entries(r(e)).forEach(([t, n]) => e.node(t).x = n);
	}
	function o(e) {
		let t = n.buildLayerMatrix(e), r = e.graph().ranksep, i = e.graph().rankalign, a = 0;
		t.forEach((t) => {
			let n = t.reduce((t, n) => {
				let r = e.node(n).height;
				return t > r ? t : r;
			}, 0);
			t.forEach((t) => {
				let r = e.node(t);
				i === "top" ? r.y = a + r.height / 2 : i === "bottom" ? r.y = a + n - r.height / 2 : r.y = a + n / 2;
			}), a += n + r;
		});
	}
}), Rt = v((e, n) => {
	var r = pe(), s = we(), c = qe(), l = _().normalizeRanks, h = Re(), g = _().removeEmptyRanks, b = Pe(), x = Ge(), S = Be(), C = ft(), w = Nt(), T = _(), D = y().Graph;
	n.exports = k;
	function k(e, t = {}) {
		let n = t.debugTiming ? T.time : T.notime;
		return n("layout", () => {
			let r = n("  buildLayoutGraph", () => V(e));
			return n("  runLayout", () => A(r, n, t)), n("  updateInputGraph", () => M(e, r)), r;
		});
	}
	function A(e, t, n) {
		t("    makeSpaceForEdgeLabels", () => H(e)), t("    removeSelfEdges", () => ee(e)), t("    acyclic", () => r.run(e)), t("    nestingGraph.run", () => b.run(e)), t("    rank", () => c(T.asNonCompoundGraph(e))), t("    injectEdgeLabelProxies", () => U(e)), t("    removeEmptyRanks", () => g(e)), t("    nestingGraph.cleanup", () => b.cleanup(e)), t("    normalizeRanks", () => l(e)), t("    assignRankMinMax", () => W(e)), t("    removeEdgeLabelProxies", () => K(e)), t("    normalize.run", () => s.run(e)), t("    parentDummyChains", () => h(e)), t("    addBorderSegments", () => x(e)), t("    order", () => C(e, n)), t("    insertSelfEdges", () => te(e)), t("    adjustCoordinateSystem", () => S.adjust(e)), t("    position", () => w(e)), t("    positionSelfEdges", () => re(e)), t("    removeBorderNodes", () => Z(e)), t("    normalize.undo", () => s.undo(e)), t("    fixupEdgeLabelCoords", () => Y(e)), t("    undoCoordinateSystem", () => S.undo(e)), t("    translateGraph", () => q(e)), t("    assignNodeIntersects", () => J(e)), t("    reversePoints", () => X(e)), t("    acyclic.undo", () => r.undo(e));
	}
	function M(e, t) {
		e.nodes().forEach((n) => {
			let r = e.node(n), i = t.node(n);
			r && (r.x = i.x, r.y = i.y, r.order = i.order, r.rank = i.rank, t.children(n).length && (r.width = i.width, r.height = i.height));
		}), e.edges().forEach((n) => {
			let r = e.edge(n), i = t.edge(n);
			r.points = i.points, Object.hasOwn(i, "x") && (r.x = i.x, r.y = i.y);
		}), e.graph().width = t.graph().width, e.graph().height = t.graph().height;
	}
	var N = [
		"nodesep",
		"edgesep",
		"ranksep",
		"marginx",
		"marginy"
	], P = {
		ranksep: 50,
		edgesep: 20,
		nodesep: 50,
		rankdir: "tb",
		rankalign: "center"
	}, F = [
		"acyclicer",
		"ranker",
		"rankdir",
		"align",
		"rankalign"
	], I = [
		"width",
		"height",
		"rank"
	], L = {
		width: 0,
		height: 0
	}, R = [
		"minlen",
		"weight",
		"width",
		"height",
		"labeloffset"
	], z = {
		minlen: 1,
		weight: 1,
		width: 0,
		height: 0,
		labeloffset: 10,
		labelpos: "r"
	}, B = ["labelpos"];
	function V(e) {
		let t = new D({
			multigraph: !0,
			compound: !0
		}), n = $(e.graph());
		return t.setGraph(Object.assign({}, P, Q(n, N), T.pick(n, F))), e.nodes().forEach((n) => {
			let r = Q($(e.node(n)), I);
			Object.keys(L).forEach((e) => {
				r[e] === void 0 && (r[e] = L[e]);
			}), t.setNode(n, r), t.setParent(n, e.parent(n));
		}), e.edges().forEach((n) => {
			let r = $(e.edge(n));
			t.setEdge(n, Object.assign({}, z, Q(r, R), T.pick(r, B)));
		}), t;
	}
	function H(e) {
		let t = e.graph();
		t.ranksep /= 2, e.edges().forEach((n) => {
			let r = e.edge(n);
			r.minlen *= 2, r.labelpos.toLowerCase() !== "c" && (t.rankdir === "TB" || t.rankdir === "BT" ? r.width += r.labeloffset : r.height += r.labeloffset);
		});
	}
	function U(e) {
		e.edges().forEach((t) => {
			let n = e.edge(t);
			if (n.width && n.height) {
				let n = e.node(t.v), r = {
					rank: (e.node(t.w).rank - n.rank) / 2 + n.rank,
					e: t
				};
				T.addDummyNode(e, "edge-proxy", r, "_ep");
			}
		});
	}
	function W(e) {
		let t = 0;
		e.nodes().forEach((n) => {
			let r = e.node(n);
			r.borderTop && (r.minRank = e.node(r.borderTop).rank, r.maxRank = e.node(r.borderBottom).rank, t = Math.max(t, r.maxRank));
		}), e.graph().maxRank = t;
	}
	function K(e) {
		e.nodes().forEach((t) => {
			let n = e.node(t);
			n.dummy === "edge-proxy" && (e.edge(n.e).labelRank = n.rank, e.removeNode(t));
		});
	}
	function q(e) {
		let t = Infinity, n = 0, r = Infinity, i = 0, a = e.graph(), o = a.marginx || 0, s = a.marginy || 0;
		function c(e) {
			let a = e.x, o = e.y, s = e.width, c = e.height;
			t = Math.min(t, a - s / 2), n = Math.max(n, a + s / 2), r = Math.min(r, o - c / 2), i = Math.max(i, o + c / 2);
		}
		e.nodes().forEach((t) => c(e.node(t))), e.edges().forEach((t) => {
			let n = e.edge(t);
			Object.hasOwn(n, "x") && c(n);
		}), t -= o, r -= s, e.nodes().forEach((n) => {
			let i = e.node(n);
			i.x -= t, i.y -= r;
		}), e.edges().forEach((n) => {
			let i = e.edge(n);
			i.points.forEach((e) => {
				e.x -= t, e.y -= r;
			}), Object.hasOwn(i, "x") && (i.x -= t), Object.hasOwn(i, "y") && (i.y -= r);
		}), a.width = n - t + o, a.height = i - r + s;
	}
	function J(e) {
		e.edges().forEach((t) => {
			let n = e.edge(t), r = e.node(t.v), i = e.node(t.w), a, o;
			n.points ? (a = n.points[0], o = n.points[n.points.length - 1]) : (n.points = [], a = i, o = r), n.points.unshift(T.intersectRect(r, a)), n.points.push(T.intersectRect(i, o));
		});
	}
	function Y(e) {
		e.edges().forEach((t) => {
			let n = e.edge(t);
			if (Object.hasOwn(n, "x")) switch ((n.labelpos === "l" || n.labelpos === "r") && (n.width -= n.labeloffset), n.labelpos) {
				case "l":
					n.x -= n.width / 2 + n.labeloffset;
					break;
				case "r":
					n.x += n.width / 2 + n.labeloffset;
					break;
			}
		});
	}
	function X(e) {
		e.edges().forEach((t) => {
			let n = e.edge(t);
			n.reversed && n.points.reverse();
		});
	}
	function Z(e) {
		e.nodes().forEach((t) => {
			if (e.children(t).length) {
				let n = e.node(t), r = e.node(n.borderTop), i = e.node(n.borderBottom), a = e.node(n.borderLeft[n.borderLeft.length - 1]), o = e.node(n.borderRight[n.borderRight.length - 1]);
				n.width = Math.abs(o.x - a.x), n.height = Math.abs(i.y - r.y), n.x = a.x + n.width / 2, n.y = r.y + n.height / 2;
			}
		}), e.nodes().forEach((t) => {
			e.node(t).dummy === "border" && e.removeNode(t);
		});
	}
	function ee(e) {
		e.edges().forEach((t) => {
			if (t.v === t.w) {
				var n = e.node(t.v);
				n.selfEdges ||= [], n.selfEdges.push({
					e: t,
					label: e.edge(t)
				}), e.removeEdge(t);
			}
		});
	}
	function te(e) {
		T.buildLayerMatrix(e).forEach((t) => {
			var n = 0;
			t.forEach((t, r) => {
				var i = e.node(t);
				i.order = r + n, (i.selfEdges || []).forEach((t) => {
					T.addDummyNode(e, "selfedge", {
						width: t.label.width,
						height: t.label.height,
						rank: i.rank,
						order: r + ++n,
						e: t.e,
						label: t.label
					}, "_se");
				}), delete i.selfEdges;
			});
		});
	}
	function re(e) {
		e.nodes().forEach((t) => {
			var n = e.node(t);
			if (n.dummy === "selfedge") {
				var r = e.node(n.e.v), i = r.x + r.width / 2, a = r.y, o = n.x - i, s = r.height / 2;
				e.setEdge(n.e, n.label), e.removeNode(t), n.label.points = [
					{
						x: i + 2 * o / 3,
						y: a - s
					},
					{
						x: i + 5 * o / 6,
						y: a - s
					},
					{
						x: i + o,
						y: a
					},
					{
						x: i + 5 * o / 6,
						y: a + s
					},
					{
						x: i + 2 * o / 3,
						y: a + s
					}
				], n.label.x = n.x, n.label.y = n.y;
			}
		});
	}
	function Q(e, t) {
		return T.mapValues(T.pick(e, t), Number);
	}
	function $(e) {
		var t = {};
		return e && Object.entries(e).forEach(([e, n]) => {
			typeof e == "string" && (e = e.toLowerCase()), t[e] = n;
		}), t;
	}
}), St = v((e, n) => {
	var r = _(), a = y().Graph;
	n.exports = { debugOrdering: o };
	function o(e) {
		let t = r.buildLayerMatrix(e), n = new a({
			compound: !0,
			multigraph: !0
		}).setGraph({});
		return e.nodes().forEach((t) => {
			n.setNode(t, { label: t }), n.setParent(t, "layer" + e.node(t).rank);
		}), e.edges().forEach((e) => n.setEdge(e.v, e.w, {}, e.name)), t.forEach((e, t) => {
			let r = "layer" + t;
			n.setNode(r, { rank: "same" }), e.reduce((e, t) => (n.setEdge(e, t, { style: "invis" }), t));
		}), n;
	}
}), Ft = v((e, t) => {
	t.exports = "2.0.4";
}), dagre_esm_default = v((e, n) => {
	n.exports = {
		graphlib: y(),
		layout: Rt(),
		debug: St(),
		util: {
			time: _().time,
			notime: _().notime
		},
		version: Ft()
	};
})();
export { dagre_esm_default as default };
