"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const util = require("./src-dagre-util.cjs");
const bk = require("./src-dagre-position-bk.cjs");
const forOwn = require("../lodash-es/forOwn.cjs");
const forEach = require("../lodash-es/forEach.cjs");
const max = require("../lodash-es/max.cjs");
const map = require("../lodash-es/map.cjs");
function position(g) {
  g = util.asNonCompoundGraph(g);
  positionY(g);
  forOwn.default(bk.positionX(g), function(x, v) {
    g.node(v).x = x;
  });
}
function positionY(g) {
  var layering = util.buildLayerMatrix(g);
  var rankSep = g.graph().ranksep;
  var prevY = 0;
  forEach.default(layering, function(layer) {
    var maxHeight = max.default(
      map.default(layer, function(v) {
        return g.node(v).height;
      })
    );
    forEach.default(layer, function(v) {
      g.node(v).y = prevY + maxHeight / 2;
    });
    prevY += maxHeight + rankSep;
  });
}
exports.position = position;
//# sourceMappingURL=src-dagre-position-index.cjs.map
