import { jsxs as d, jsx as e } from "react/jsx-runtime";
import { IconButton as m } from "../IconButton/index.mjs";
import { Iconfont as l } from "../Iconfont/index.mjs";
import { useState as x, useEffect as y } from "react";
const j = (a) => {
  const {
    className: f,
    style: h,
    value: o,
    min: s,
    max: r,
    step: n = 1,
    onChange: c,
    showText: p = !1
  } = a, [t, i] = x(o != null ? o : 0);
  return y(() => {
    i(o != null ? o : 0);
  }, [o]), /* @__PURE__ */ d("div", {
    className: f,
    style: h,
    children: [/* @__PURE__ */ e(m, {
      disabled: !!(r && r <= t),
      onClick: () => {
        c(t + n), i(t + n);
      },
      children: /* @__PURE__ */ e(l, {
        type: "icon-fangda"
      })
    }), p && /* @__PURE__ */ d("div", {
      style: {
        width: 40,
        textAlign: "center"
      },
      children: [Math.round(t * 100), "%"]
    }), /* @__PURE__ */ e(m, {
      disabled: !!(s && s >= t),
      onClick: () => {
        c(t - n), i(t - n);
      },
      children: /* @__PURE__ */ e(l, {
        type: "icon-suoxiao"
      })
    })]
  });
};
export {
  j as Zoom
};
