"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// packages/block-editor/src/components/block-edit/index.js
var block_edit_exports = {};
__export(block_edit_exports, {
  default: () => BlockEdit,
  useBlockEditContext: () => import_context.useBlockEditContext
});
module.exports = __toCommonJS(block_edit_exports);
var import_element = require("@wordpress/element");
var import_blocks = require("@wordpress/blocks");
var import_edit = __toESM(require("./edit"));
var import_context = require("./context");
var import_multiple_usage_warning = require("./multiple-usage-warning");
var import_private_block_context = require("../block-list/private-block-context");
var import_jsx_runtime = require("react/jsx-runtime");
function BlockEdit({
  mayDisplayControls,
  mayDisplayParentControls,
  blockEditingMode,
  isPreviewMode,
  // The remaining props are passed through the BlockEdit filters and are thus
  // public API!
  ...props
}) {
  const {
    name,
    isSelected,
    clientId,
    attributes = {},
    __unstableLayoutClassNames
  } = props;
  const { layout = null, metadata = {} } = attributes;
  const { bindings } = metadata;
  const layoutSupport = (0, import_blocks.hasBlockSupport)(name, "layout", false) || (0, import_blocks.hasBlockSupport)(name, "__experimentalLayout", false);
  const { originalBlockClientId } = (0, import_element.useContext)(import_private_block_context.PrivateBlockContext);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
    import_context.BlockEditContextProvider,
    {
      value: (0, import_element.useMemo)(
        () => ({
          name,
          isSelected,
          clientId,
          layout: layoutSupport ? layout : null,
          __unstableLayoutClassNames,
          // We use symbols in favour of an __unstable prefix to avoid
          // usage outside of the package (this context is exposed).
          [import_context.mayDisplayControlsKey]: mayDisplayControls,
          [import_context.mayDisplayParentControlsKey]: mayDisplayParentControls,
          [import_context.blockEditingModeKey]: blockEditingMode,
          [import_context.blockBindingsKey]: bindings,
          [import_context.isPreviewModeKey]: isPreviewMode
        }),
        [
          name,
          isSelected,
          clientId,
          layoutSupport,
          layout,
          __unstableLayoutClassNames,
          mayDisplayControls,
          mayDisplayParentControls,
          blockEditingMode,
          bindings,
          isPreviewMode
        ]
      ),
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_edit.default, { ...props }),
        originalBlockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
          import_multiple_usage_warning.MultipleUsageWarning,
          {
            originalBlockClientId,
            name,
            onReplace: props.onReplace
          }
        )
      ]
    }
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  useBlockEditContext
});
//# sourceMappingURL=index.js.map
