"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const forEach = require("../lodash-es/forEach.cjs");
function addSubgraphConstraints(g, cg, vs) {
  var prev = {}, rootPrev;
  forEach.default(vs, function(v) {
    var child = g.parent(v), parent, prevChild;
    while (child) {
      parent = g.parent(child);
      if (parent) {
        prevChild = prev[parent];
        prev[parent] = child;
      } else {
        prevChild = rootPrev;
        rootPrev = child;
      }
      if (prevChild && prevChild !== child) {
        cg.setEdge(prevChild, child);
        return;
      }
      child = parent;
    }
  });
}
exports.addSubgraphConstraints = addSubgraphConstraints;
//# sourceMappingURL=src-dagre-order-add-subgraph-constraints.cjs.map
