import forEach_default from "../../../../lodash-es/forEach.js";
import map_default from "../../../../lodash-es/map.js";
import forOwn_default from "../../../../lodash-es/forOwn.js";
import max_default from "../../../../lodash-es/max.js";
import { asNonCompoundGraph, buildLayerMatrix } from "../util.js";
import { positionX } from "./bk.js";
function position(e) {
	e = asNonCompoundGraph(e), positionY(e), forOwn_default(positionX(e), function(r, i) {
		e.node(i).x = r;
	});
}
function positionY(i) {
	var a = buildLayerMatrix(i), s = i.graph().ranksep, c = 0;
	forEach_default(a, function(a) {
		var o = max_default(map_default(a, function(e) {
			return i.node(e).height;
		}));
		forEach_default(a, function(e) {
			i.node(e).y = c + o / 2;
		}), c += o + s;
	});
}
export { position };
