import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { useState, useEffect } from "react";
const DefaultRoleRenderer = ({ role }) => /* @__PURE__ */ jsxDEV(Fragment, { children: [
  role,
  " "
] }, void 0, true, {
  fileName: "/__w/interface/interface/packages/admin/src/tenant/components/member/RoleRenderer.tsx",
  lineNumber: 18,
  columnNumber: 57
}, void 0);
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
