import React, { useContext } from "react";
import classNames from "classnames";
import ConfigProviderContext from "../config-provider/ConfigProviderContext";
import useVisible from "./utils/useVisible";
const Lazyload = (props) => {
  const {
    prefixCls,
    createNamespace
  } = useContext(ConfigProviderContext);
  const [bem] = createNamespace("lazyload", prefixCls);
  const {
    children,
    forceVisible,
    className,
    height,
    style,
    loading
  } = props;
  const [ref, hasLoaded] = useVisible(forceVisible);
  return /* @__PURE__ */ React.createElement("div", {
    className: classNames(bem(), className),
    style,
    ref
  }, hasLoaded ? children : loading || /* @__PURE__ */ React.createElement("div", {
    style: {
      height
    },
    className: classNames(bem("placeholder"))
  }));
};
Lazyload.defaultProps = {
  loading: null,
  forceVisible: false,
  height: 0,
  className: "",
  style: {}
};
var stdin_default = Lazyload;
export {
  stdin_default as default
};
