import m from "./index-extends.js";
import p from "./index-objectWithoutPropertiesLoose.js";
import * as n from "react";
import d from "./index-_virtual16.js";
import { jsx as l } from "react/jsx-runtime";
import a from "./index-useEnhancedEffect2.js";
import h from "./index-debounce3.js";
import g from "./index-ownerWindow2.js";
const v = ["onChange"], E = {
  width: 99,
  height: 99,
  position: "absolute",
  top: -9999,
  overflow: "scroll"
};
function R(s) {
  const {
    onChange: r
  } = s, u = p(s, v), e = n.useRef(), t = n.useRef(null), i = () => {
    e.current = t.current.offsetHeight - t.current.clientHeight;
  };
  return a(() => {
    const o = h(() => {
      const f = e.current;
      i(), f !== e.current && r(e.current);
    }), c = g(t.current);
    return c.addEventListener("resize", o), () => {
      o.clear(), c.removeEventListener("resize", o);
    };
  }, [r]), n.useEffect(() => {
    i(), r(e.current);
  }, [r]), /* @__PURE__ */ l("div", m({
    style: E
  }, u, {
    ref: t
  }));
}
process.env.NODE_ENV !== "production" && (R.propTypes = {
  onChange: d.func.isRequired
});
export {
  R as default
};
