import { jsxs, Fragment } from "react/jsx-runtime";
import { useState, useEffect } from "react";
const DefaultRoleRenderer = ({ role }) => /* @__PURE__ */ jsxs(Fragment, { children: [
  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
