const panCenterFeature = function (map, layers, coordinate, menuOpen, isMobile, useOverlay) {
  let overlayWidthDesktop = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 400;
  let overlayHeightMobile = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 250;
  let menuWidthDesktop = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 381;
  let redCircleWidth = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 25;
  let forcePan = arguments.length > 10 ? arguments[10] : undefined;
  let overlaySide = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : "right";
  const [width, height] = map.getSize();
  const [pixelX, pixelY] = map.getPixelFromCoordinate(coordinate);
  const isUsingOverlay = useOverlay || !!layers.find(l => l.get("useOverlay"));
  const isHiddenByOverlayOnDesktop = isUsingOverlay && (overlaySide === "right" ? pixelX >= width - overlayWidthDesktop - redCircleWidth : pixelX <= overlayWidthDesktop + redCircleWidth);
  const isHiddenByOverlayOnMobile = isUsingOverlay && pixelY >= height - overlayHeightMobile - redCircleWidth;
  const isHiddenByMenuOnDesktop = menuOpen && pixelX <= menuWidthDesktop + redCircleWidth;
  let padding = null;
  if (isMobile && (isHiddenByOverlayOnMobile || forcePan)) {
    padding = [0, 0, overlayHeightMobile, 0];
  } else if (!isMobile && (isHiddenByOverlayOnDesktop || isHiddenByMenuOnDesktop || forcePan)) {
    let paddingLeft = menuOpen ? menuWidthDesktop : 0;
    // In some iframe topics we render the overlay on the left
    if (isUsingOverlay && overlaySide === "left") {
      paddingLeft = overlayWidthDesktop;
    }
    padding = [0, isUsingOverlay && overlaySide === "right" ? overlayWidthDesktop : 0, 0, paddingLeft];
  }
  if (padding) {
    map.getView().cancelAnimations();
    map.getView().fit([...coordinate, ...coordinate], {
      padding,
      maxZoom: map.getView().getZoom(),
      // only pan
      duration: 500
    });
  }
};
export default panCenterFeature;
//# sourceMappingURL=panCenterFeature.js.map