import { Fragment, jsx } from "react/jsx-runtime";
import {
  Component,
  forwardRef,
  useImperativeHandle,
  useRef
} from "react";
import { findDOMNode } from "./lib/react-dom";
function suppressWarningAndFindDomNode(instance) {
  const error = console.error;
  console.error = (...args) => {
    if (typeof args[0] === "string" && args[0].includes("%s is deprecated in StrictMode."))
      return;
    if (typeof args[0] === "string" && args[0].includes("findDOMNode is deprecated"))
      return;
    return error.apply(console, args);
  };
  const foundDomNode = findDOMNode(instance);
  console.error = error;
  return foundDomNode;
}
class FindDomNodeClassComponent extends Component {
  constructor(props) {
    super(props);
    this.props.innerRef.current = () => suppressWarningAndFindDomNode(this);
  }
  render() {
    return /* @__PURE__ */ jsx(Fragment, { children: this.props.children });
  }
}
const FindDomNode = forwardRef(
  function FindDomNode2(props, ref) {
    const findDomNodeRef = useRef(null);
    useImperativeHandle(ref, () => () => findDomNodeRef.current?.() ?? null, []);
    return /* @__PURE__ */ jsx(FindDomNodeClassComponent, { ...props, innerRef: findDomNodeRef });
  }
);
export {
  FindDomNode
};
//# sourceMappingURL=find-dom-node.js.map