import forEach_default from "../../../lodash-es/forEach.js";
function adjust(e) {
	var o = e.graph().rankdir.toLowerCase();
	(o === "lr" || o === "rl") && swapWidthHeight(e);
}
function undo(e) {
	var o = e.graph().rankdir.toLowerCase();
	(o === "bt" || o === "rl") && reverseY(e), (o === "lr" || o === "rl") && (swapXY(e), swapWidthHeight(e));
}
function swapWidthHeight(o) {
	forEach_default(o.nodes(), function(e) {
		swapWidthHeightOne(o.node(e));
	}), forEach_default(o.edges(), function(e) {
		swapWidthHeightOne(o.edge(e));
	});
}
function swapWidthHeightOne(e) {
	var o = e.width;
	e.width = e.height, e.height = o;
}
function reverseY(o) {
	forEach_default(o.nodes(), function(e) {
		reverseYOne(o.node(e));
	}), forEach_default(o.edges(), function(s) {
		var c = o.edge(s);
		forEach_default(c.points, reverseYOne), Object.prototype.hasOwnProperty.call(c, "y") && reverseYOne(c);
	});
}
function reverseYOne(e) {
	e.y = -e.y;
}
function swapXY(o) {
	forEach_default(o.nodes(), function(e) {
		swapXYOne(o.node(e));
	}), forEach_default(o.edges(), function(s) {
		var c = o.edge(s);
		forEach_default(c.points, swapXYOne), Object.prototype.hasOwnProperty.call(c, "x") && swapXYOne(c);
	});
}
function swapXYOne(e) {
	var o = e.x;
	e.x = e.y, e.y = o;
}
export { adjust, undo };
