import e from "../../../../lodash-es/forEach.js";
import t from "../../../../lodash-es/size.js";
//#region ../../node_modules/dagre-d3-es/src/graphlib/alg/topsort.js
n.CycleException = r;
function n(n) {
	var i = {}, a = {}, o = [];
	function s(t) {
		if (Object.prototype.hasOwnProperty.call(a, t)) throw new r();
		Object.prototype.hasOwnProperty.call(i, t) || (a[t] = !0, i[t] = !0, e(n.predecessors(t), s), delete a[t], o.push(t));
	}
	if (e(n.sinks(), s), t(i) !== n.nodeCount()) throw new r();
	return o;
}
function r() {}
r.prototype = /* @__PURE__ */ Error();
//#endregion
export { n as topsort };
