"use client";
import { jsx } from "react/jsx-runtime";
import * as React from "react";
import dynamic from "next/dynamic";
import { Spinner } from "@open-mercato/ui/primitives/spinner";
const WorkflowGraphImpl = dynamic(() => import("./WorkflowGraphImpl.js"), {
  ssr: false,
  loading: () => null
});
function WorkflowGraphPlaceholder({ height }) {
  return /* @__PURE__ */ jsx(
    "div",
    {
      className: "workflow-graph-container flex items-center justify-center rounded-lg border border-border bg-muted/30",
      style: { height },
      children: /* @__PURE__ */ jsx(Spinner, { className: "h-6 w-6 text-muted-foreground" })
    }
  );
}
function WorkflowGraph(props) {
  const { height = "600px" } = props;
  const [isImplReady, setIsImplReady] = React.useState(false);
  React.useEffect(() => {
    let cancelled = false;
    void import("./WorkflowGraphImpl.js").then(() => {
      if (!cancelled) setIsImplReady(true);
    });
    return () => {
      cancelled = true;
    };
  }, []);
  if (!isImplReady) return /* @__PURE__ */ jsx(WorkflowGraphPlaceholder, { height });
  return /* @__PURE__ */ jsx(WorkflowGraphImpl, { ...props });
}
function WorkflowGraphReadOnly({
  nodes,
  edges,
  className = "",
  height = "500px"
}) {
  return /* @__PURE__ */ jsx(
    WorkflowGraph,
    {
      initialNodes: nodes,
      initialEdges: edges,
      editable: false,
      className,
      height
    }
  );
}
export {
  WorkflowGraph,
  WorkflowGraphReadOnly
};
//# sourceMappingURL=WorkflowGraph.js.map
