"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const ui = require("@contember/ui");
const react = require("react");
function FeedbackRenderer({ accessorTreeState, children }) {
  react.useEffect(() => {
    if (accessorTreeState.name === "error" && accessorTreeState.error.type === "unauthorized") {
      window.location.href = "/";
    }
  }, [accessorTreeState]);
  if (accessorTreeState.name === "initializing") {
    return /* @__PURE__ */ jsxRuntime.jsx(ui.SpinnerOverlay, {});
  }
  if (accessorTreeState.name === "error") {
    if (accessorTreeState.error.type === "unauthorized") {
      return null;
    }
    return /* @__PURE__ */ jsxRuntime.jsx(ui.Message, { intent: "danger", children: accessorTreeState.error.type });
  }
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
}
exports.FeedbackRenderer = FeedbackRenderer;
//# sourceMappingURL=FeedbackRenderer.cjs.map
