import { memo, createElement } from "react";
import { DialogProvider, Portal, HoveringToolbar } from "@contember/ui";
import { HoveringToolbarContents } from "./HoveringToolbarContents.js";
import { useToolbarState } from "../editorSelection/useToolbarsState.js";
const HoveringToolbars = memo((props) => {
  const { inlineToolbarRef, blockToolbarActive, inlineToolbarActive } = useToolbarState();
  const shouldDisplayInlineToolbar = inlineToolbarActive && (props.shouldDisplayInlineToolbar === void 0 || props.shouldDisplayInlineToolbar());
  return /* @__PURE__ */ createElement(DialogProvider, null, /* @__PURE__ */ createElement(Portal, null, props.inlineButtons && /* @__PURE__ */ createElement(HoveringToolbar, {
    scheme: props.toolbarScheme,
    isActive: shouldDisplayInlineToolbar,
    ref: inlineToolbarRef,
    scope: "contextual"
  }, /* @__PURE__ */ createElement(HoveringToolbarContents, {
    buttons: props.inlineButtons
  }))), props.blockButtons && /* @__PURE__ */ createElement(HoveringToolbar, {
    scheme: props.toolbarScheme,
    isActive: blockToolbarActive
  }, Array.isArray(props.blockButtons) && /* @__PURE__ */ createElement(HoveringToolbarContents, {
    buttons: props.blockButtons
  }), Array.isArray(props.blockButtons) || props.blockButtons));
});
export { HoveringToolbars };
//# sourceMappingURL=HoveringToolbars.js.map
