import { Arr, Obj } from '@ephox/katamari';
import { SugarPosition } from '@ephox/sugar';
const allAlignments = [
    'valignCentre',
    'alignLeft',
    'alignRight',
    'alignCentre',
    'top',
    'bottom',
    'left',
    'right',
    'inset'
];
const nu = (xOffset, yOffset, classes, insetModifier = 1) => {
    const insetXOffset = xOffset * insetModifier;
    const insetYOffset = yOffset * insetModifier;
    const getClasses = (prop) => Obj.get(classes, prop).getOr([]);
    const make = (xDelta, yDelta, alignmentsOn) => {
        const alignmentsOff = Arr.difference(allAlignments, alignmentsOn);
        return {
            offset: SugarPosition(xDelta, yDelta),
            classesOn: Arr.bind(alignmentsOn, getClasses),
            classesOff: Arr.bind(alignmentsOff, getClasses)
        };
    };
    return {
        southeast: () => make(-xOffset, yOffset, ['top', 'alignLeft']),
        southwest: () => make(xOffset, yOffset, ['top', 'alignRight']),
        south: () => make(-xOffset / 2, yOffset, ['top', 'alignCentre']),
        northeast: () => make(-xOffset, -yOffset, ['bottom', 'alignLeft']),
        northwest: () => make(xOffset, -yOffset, ['bottom', 'alignRight']),
        north: () => make(-xOffset / 2, -yOffset, ['bottom', 'alignCentre']),
        east: () => make(xOffset, -yOffset / 2, ['valignCentre', 'left']),
        west: () => make(-xOffset, -yOffset / 2, ['valignCentre', 'right']),
        insetNortheast: () => make(insetXOffset, insetYOffset, ['top', 'alignLeft', 'inset']),
        insetNorthwest: () => make(-insetXOffset, insetYOffset, ['top', 'alignRight', 'inset']),
        insetNorth: () => make(-insetXOffset / 2, insetYOffset, ['top', 'alignCentre', 'inset']),
        insetSoutheast: () => make(insetXOffset, -insetYOffset, ['bottom', 'alignLeft', 'inset']),
        insetSouthwest: () => make(-insetXOffset, -insetYOffset, ['bottom', 'alignRight', 'inset']),
        insetSouth: () => make(-insetXOffset / 2, -insetYOffset, ['bottom', 'alignCentre', 'inset']),
        insetEast: () => make(-insetXOffset, -insetYOffset / 2, ['valignCentre', 'right', 'inset']),
        insetWest: () => make(insetXOffset, -insetYOffset / 2, ['valignCentre', 'left', 'inset'])
    };
};
const fallback = () => nu(0, 0, {});
export { nu, fallback };
//# sourceMappingURL=Bubble.js.map