import { nu as NuSpotInfo } from '../view/SpotInfo';
import * as Direction from './Direction';
import { boundsRestriction } from './LayoutBounds';
/*
  Layout for submenus;
  Either left or right of the anchor menu item. Never above or below.
  Aligned to the top or bottom of the anchor as appropriate.
 */
const labelPrefix = 'link-layout';
// display element to the right, left edge against the right of the menu
const eastX = (anchor) => anchor.x + anchor.width;
// display element to the left, right edge against the left of the menu
const westX = (anchor, element) => anchor.x - element.width;
// display element pointing up, bottom edge against the bottom of the menu (usually to one side)
const northY = (anchor, element) => anchor.y - element.height + anchor.height;
// display element pointing down, top edge against the top of the menu (usually to one side)
const southY = (anchor) => anchor.y;
const southeast = (anchor, element, bubbles) => NuSpotInfo(eastX(anchor), southY(anchor), bubbles.southeast(), Direction.southeast(), "southeast" /* Southeast */, boundsRestriction(anchor, { left: 0 /* RightEdge */, top: 2 /* TopEdge */ }), labelPrefix);
const southwest = (anchor, element, bubbles) => NuSpotInfo(westX(anchor, element), southY(anchor), bubbles.southwest(), Direction.southwest(), "southwest" /* Southwest */, boundsRestriction(anchor, { right: 1 /* LeftEdge */, top: 2 /* TopEdge */ }), labelPrefix);
const northeast = (anchor, element, bubbles) => NuSpotInfo(eastX(anchor), northY(anchor, element), bubbles.northeast(), Direction.northeast(), "northeast" /* Northeast */, boundsRestriction(anchor, { left: 0 /* RightEdge */, bottom: 3 /* BottomEdge */ }), labelPrefix);
const northwest = (anchor, element, bubbles) => NuSpotInfo(westX(anchor, element), northY(anchor, element), bubbles.northwest(), Direction.northwest(), "northwest" /* Northwest */, boundsRestriction(anchor, { right: 1 /* LeftEdge */, bottom: 3 /* BottomEdge */ }), labelPrefix);
const all = () => [southeast, southwest, northeast, northwest];
const allRtl = () => [southwest, southeast, northwest, northeast];
export { southeast, northeast, southwest, northwest, all, allRtl };
//# sourceMappingURL=LinkedLayout.js.map