import { jsx } from "react/jsx-runtime";
import { useMemo } from "@wordpress/element";
import { useSelect } from "@wordpress/data";
import { BlockEditorProvider } from "@wordpress/block-editor";
import { createBlock } from "@wordpress/blocks";
import { unlock } from "../../lock-unlock";
import { store as editSiteStore } from "../../store";
import NavigationMenuContent from "../sidebar-navigation-screen-navigation-menus/navigation-menu-content";
const noop = () => {
};
function NavigationMenuEditor({ navigationMenuId }) {
  const { storedSettings } = useSelect((select) => {
    const { getSettings } = unlock(select(editSiteStore));
    return {
      storedSettings: getSettings()
    };
  }, []);
  const blocks = useMemo(() => {
    if (!navigationMenuId) {
      return [];
    }
    return [createBlock("core/navigation", { ref: navigationMenuId })];
  }, [navigationMenuId]);
  if (!navigationMenuId || !blocks?.length) {
    return null;
  }
  return /* @__PURE__ */ jsx(
    BlockEditorProvider,
    {
      settings: storedSettings,
      value: blocks,
      onChange: noop,
      onInput: noop,
      children: /* @__PURE__ */ jsx("div", { className: "edit-site-sidebar-navigation-screen-navigation-menus__content", children: /* @__PURE__ */ jsx(NavigationMenuContent, { rootClientId: blocks[0].clientId }) })
    }
  );
}
export {
  NavigationMenuEditor as default
};
//# sourceMappingURL=navigation-menu-editor.js.map
