import { jsx as r, Fragment as c } from "react/jsx-runtime";
import { useMemo as l, useCallback as p } from "react";
import { useZoomContext as O } from "../../../../contexts/ZoomContext.js";
import { UIButton as d } from "../../../ui/Button.js";
import Z from "../../../ui/RPTooltip.js";
import { useLocalizationContext as f } from "../../../../contexts/LocalizationContext.js";
import { ZoomOutIcon as a } from "../../../icons/ZoomOutIcon.js";
import { MIN_ZOOM_SCALE as h, MAX_ZOOM_SCALE as C } from "../../../../utils/constants.js";
const A = ({ icon: m }) => {
  const { currentZoom: t, setZoomLevel: n } = O(), { localeMessages: o } = f(), i = l(() => t <= h, [t]), e = p(() => {
    n(() => {
      const u = Math.ceil(t * 100 / 25) * 25;
      return Math.min(u - 25, C);
    });
  }, [n, t]);
  return /* @__PURE__ */ r(c, { children: /* @__PURE__ */ r(Z, { content: o == null ? void 0 : o.zoomOutTooltip, children: /* @__PURE__ */ r(
    d,
    {
      disabled: i,
      onClick: e,
      "aria-label": o == null ? void 0 : o.zoomOutTooltip,
      children: m || /* @__PURE__ */ r(a, {})
    }
  ) }) });
};
export {
  A as ZoomOutTool
};
