import { addDummyNode as c } from "./util.js";
import h from "../../../../../lodash-es@4.17.22/node_modules/lodash-es/forEach.js";
function u(e) {
  function o(t) {
    var i = e.children(t), r = e.node(t);
    if (i.length && h(i, o), Object.prototype.hasOwnProperty.call(r, "minRank")) {
      r.borderLeft = [], r.borderRight = [];
      for (var d = r.minRank, n = r.maxRank + 1; d < n; ++d)
        b(e, "borderLeft", "_bl", t, r, d), b(e, "borderRight", "_br", t, r, d);
    }
  }
  h(e.children(), o);
}
function b(e, o, t, i, r, d) {
  var n = { width: 0, height: 0, rank: d, borderType: o }, f = r[o][d - 1], a = c(e, "border", n, t);
  r[o][d] = a, e.setParent(a, i), f && e.setEdge(f, a, { weight: 1 });
}
export {
  u as addBorderSegments
};
