import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
import memoizeOne from 'memoize-one';
import { breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
import { roundToNearest } from '../media-single';
import { getContainerWidthOrFullEditorWidth } from './getContainerWidthOrFullEditorWidth';
var getDefaultGuidelines = memoizeOne(function (editorWidth) {
  return [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6].map(function (val, index) {
    return {
      key: "grid_".concat(index),
      position: {
        x: roundToNearest(val / 12 * editorWidth)
      }
    };
  });
});
var getWideGuidelines = memoizeOne(function (editorWidth) {
  var wideSpacing = roundToNearest(editorWidth * breakoutWideScaleRatio / 2);
  return [{
    key: "wide_left",
    position: {
      x: -wideSpacing
    }
  }, {
    key: "wide_right",
    position: {
      x: wideSpacing
    }
  }];
});
var getFullWidthGuidelines = memoizeOne(function (containerWidth) {
  var fullWidth = roundToNearest(getContainerWidthOrFullEditorWidth(containerWidth));
  return [{
    key: "full_width_left",
    position: {
      x: -fullWidth
    }
  }, {
    key: "full_width_right",
    position: {
      x: fullWidth
    }
  }];
});
export var generateDefaultGuidelines = function generateDefaultGuidelines(editorWidth, containerWidth) {
  var isFullWidthMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  var innerGrids = getDefaultGuidelines(editorWidth);
  var wideGuidelines = !isFullWidthMode ? getWideGuidelines(editorWidth) : [];
  var fullWidthGuidelines = !isFullWidthMode ? getFullWidthGuidelines(containerWidth) : [];
  return [].concat(_toConsumableArray(innerGrids), _toConsumableArray(wideGuidelines), _toConsumableArray(fullWidthGuidelines));
};