import { Fragment, useMemo, createElement } from "react";
import { useHTMLProps } from "./dist-es-render-html-use-props.js";
import { filterProps } from "./dist-es-render-dom-utils-filter-props.js";
import { isSVGComponent } from "./dist-es-render-dom-utils-is-svg-component.js";
import { useSVGProps } from "./dist-es-render-svg-use-props.js";
import { isMotionValue } from "./dist-es-value-utils-is-motion-value.js";
function createUseRender(forwardMotionProps = false) {
  const useRender = (Component, props, ref, { latestValues }, isStatic) => {
    const useVisualProps = isSVGComponent(Component) ? useSVGProps : useHTMLProps;
    const visualProps = useVisualProps(props, latestValues, isStatic, Component);
    const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
    const elementProps = Component !== Fragment ? { ...filteredProps, ...visualProps, ref } : {};
    const { children } = props;
    const renderedChildren = useMemo(() => isMotionValue(children) ? children.get() : children, [children]);
    return createElement(Component, {
      ...elementProps,
      children: renderedChildren
    });
  };
  return useRender;
}
export {
  createUseRender
};
//# sourceMappingURL=dist-es-render-dom-use-render.js.map
