import { useState, useEffect, createElement, Fragment } from "react";
const DefaultRoleRenderer = ({ role }) => /* @__PURE__ */ createElement(Fragment, null, role, " ");
const useRoleRenderer = (roleRendererFactory, query) => {
  const [roleRenderer, setRoleRenderer] = useState();
  useEffect(() => {
    if (!roleRendererFactory) {
      setRoleRenderer(() => DefaultRoleRenderer);
      return;
    }
    if (query.state !== "success") {
      return;
    }
    (async () => {
      const renderer = await roleRendererFactory(query.data.project.roles);
      setRoleRenderer(() => renderer);
    })();
  }, [roleRendererFactory, query]);
  return roleRenderer;
};
export { useRoleRenderer };
//# sourceMappingURL=RoleRenderer.js.map
