"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 is_rich_content_equal_exports = {};
__export(is_rich_content_equal_exports, {
  isRichContentEqual: () => isRichContentEqual
});
module.exports = __toCommonJS(is_rich_content_equal_exports);
var import_lodash = __toESM(require("lodash"));
const normalizeNodesIds = (nodes) => {
  let i = 0;
  if (!nodes) {
    return void 0;
  }
  const normalizeIds = (nodes2) => {
    if (nodes2?.length === 0) {
      return [];
    }
    return nodes2?.map((node) => {
      const { id: _, nodes: nodes3, ...rest } = node;
      return {
        ...rest,
        id: `${i++}`,
        ...nodes3 && { nodes: normalizeIds(nodes3) }
      };
    });
  };
  return normalizeIds(nodes);
};
const isRichContentEqual = (a = { nodes: [] }, b = { nodes: [] }) => {
  const aNormalized = JSON.parse(JSON.stringify(a));
  const bNormalized = JSON.parse(JSON.stringify(b));
  if (!import_lodash.default.isEqual(aNormalized.documentStyle, bNormalized.documentStyle)) {
    return false;
  }
  if (aNormalized.nodes?.length !== bNormalized.nodes?.length) {
    return false;
  }
  const aNodes = normalizeNodesIds(aNormalized.nodes);
  const bNodes = normalizeNodesIds(bNormalized.nodes);
  if (!import_lodash.default.isEqual(aNodes, bNodes)) {
    return false;
  }
  return true;
};
//# sourceMappingURL=is-rich-content-equal.js.map
