"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);
var posts_exports = {};
__export(posts_exports, {
  initializePostsDashboard: () => initializePostsDashboard
});
module.exports = __toCommonJS(posts_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_blocks = require("@wordpress/blocks");
var import_block_library = require("@wordpress/block-library");
var import_data = require("@wordpress/data");
var import_element = require("@wordpress/element");
var import_preferences = require("@wordpress/preferences");
var import_widgets = require("@wordpress/widgets");
var import_hooks = require("./hooks");
var import_store = require("./store");
var import_posts_app = __toESM(require("./components/posts-app"));
function initializePostsDashboard(id, settings) {
  if (!globalThis.IS_GUTENBERG_PLUGIN) {
    return;
  }
  const target = document.getElementById(id);
  const root = (0, import_element.createRoot)(target);
  (0, import_data.dispatch)(import_blocks.store).reapplyBlockTypeFilters();
  const coreBlocks = (0, import_block_library.__experimentalGetCoreBlocks)().filter(
    ({ name }) => name !== "core/freeform"
  );
  (0, import_block_library.registerCoreBlocks)(coreBlocks);
  (0, import_data.dispatch)(import_blocks.store).setFreeformFallbackBlockName("core/html");
  (0, import_widgets.registerLegacyWidgetBlock)({ inserter: false });
  (0, import_widgets.registerWidgetGroupBlock)({ inserter: false });
  if (globalThis.IS_GUTENBERG_PLUGIN) {
    (0, import_block_library.__experimentalRegisterExperimentalCoreBlocks)({
      enableFSEBlocks: true
    });
  }
  (0, import_data.dispatch)(import_preferences.store).setDefaults("core/edit-site", {
    welcomeGuide: true,
    welcomeGuideStyles: true,
    welcomeGuidePage: true,
    welcomeGuideTemplate: true
  });
  (0, import_data.dispatch)(import_preferences.store).setDefaults("core", {
    allowRightClickOverrides: true,
    distractionFree: false,
    editorMode: "visual",
    editorTool: "edit",
    fixedToolbar: false,
    focusMode: false,
    inactivePanels: [],
    keepCaretInsideBlock: false,
    openPanels: ["post-status"],
    showBlockBreadcrumbs: true,
    showListViewByDefault: false,
    enableChoosePatternModal: true
  });
  (0, import_data.dispatch)(import_store.store).updateSettings(settings);
  window.addEventListener("dragover", (e) => e.preventDefault(), false);
  window.addEventListener("drop", (e) => e.preventDefault(), false);
  root.render(
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_posts_app.default, {}) })
  );
  return root;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  initializePostsDashboard
});
//# sourceMappingURL=posts.js.map
