// packages/editor/src/components/sidebar/post-revision-summary.js
import { useSelect } from "@wordpress/data";
import {
  ExternalLink,
  __experimentalVStack as VStack
} from "@wordpress/components";
import { __ } from "@wordpress/i18n";
import { addQueryArgs } from "@wordpress/url";
import { store as editorStore } from "../../store/index.mjs";
import { unlock } from "../../lock-unlock.mjs";
import RevisionAuthorPanel from "../revision-author-panel/index.mjs";
import RevisionCreatedPanel from "../revision-created-panel/index.mjs";
import { PostContentInformationUI } from "../post-content-information/index.mjs";
import RevisionFieldsDiffPanel from "../revision-fields-diff/index.mjs";
import PostPanelSection from "../post-panel-section/index.mjs";
import PostCardPanel from "../post-card-panel/index.mjs";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
function PostRevisionSummary() {
  const { revisionId, postId, postContent } = useSelect((select) => {
    const { getCurrentRevisionId, getCurrentRevision, getCurrentPostId } = unlock(select(editorStore));
    const _revisionId = getCurrentRevisionId();
    return {
      revisionId: _revisionId,
      postId: getCurrentPostId(),
      postContent: _revisionId && getCurrentRevision()?.content?.raw
    };
  }, []);
  if (!revisionId) {
    return null;
  }
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(PostPanelSection, { className: "editor-post-summary", children: /* @__PURE__ */ jsxs(VStack, { spacing: 4, children: [
      /* @__PURE__ */ jsx(PostCardPanel, { postId, hideActions: true }),
      /* @__PURE__ */ jsxs(VStack, { spacing: 1, children: [
        /* @__PURE__ */ jsx(PostContentInformationUI, { postContent }),
        /* @__PURE__ */ jsx(RevisionCreatedPanel, {})
      ] }),
      /* @__PURE__ */ jsx(
        ExternalLink,
        {
          href: addQueryArgs("revision.php", {
            revision: revisionId
          }),
          children: __("Open classic revisions screen")
        }
      ),
      /* @__PURE__ */ jsx(RevisionAuthorPanel, {})
    ] }) }),
    /* @__PURE__ */ jsx(RevisionFieldsDiffPanel, {})
  ] });
}
export {
  PostRevisionSummary as default
};
//# sourceMappingURL=post-revision-summary.mjs.map
