// packages/block-library/src/navigation-submenu/index.js
import { page, addSubmenu } from "@wordpress/icons";
import { _x, __ } from "@wordpress/i18n";
import initBlock from "../utils/init-block";
import metadata from "./block.json";
import edit from "./edit";
import save from "./save";
import transforms from "./transforms";
var { name } = metadata;
var settings = {
  icon: ({ context }) => {
    if (context === "list-view") {
      return page;
    }
    return addSubmenu;
  },
  __experimentalLabel(attributes, { context }) {
    const { label } = attributes;
    const customName = attributes?.metadata?.name;
    if (context === "list-view" && (customName || label)) {
      return attributes?.metadata?.name || label;
    }
    return label;
  },
  edit,
  example: {
    attributes: {
      label: _x("About", "Example link text for Navigation Submenu"),
      type: "page"
    }
  },
  save,
  transforms
};
if (window.__experimentalContentOnlyPatternInsertion) {
  settings.fields = [
    {
      label: __("Label"),
      type: "RichText",
      shownByDefault: true,
      mapping: {
        value: "label"
      }
    },
    {
      label: __("Link"),
      type: "Link",
      shownByDefault: false,
      mapping: {
        href: "url",
        rel: "rel"
        // TODO - opens in new tab? id?
      }
    }
  ];
}
var init = () => initBlock({ name, metadata, settings });
export {
  init,
  metadata,
  name,
  settings
};
//# sourceMappingURL=index.js.map
