const findAdjustedNodeById = (doc, id) => {
  const nodesWithPos = [];
  doc.descendants((child, pos) => {
    if (child.attrs.id === id) {
      nodesWithPos.push({
        node: child,
        pos
      });
      return false;
    }
  });
  const nodeWithPos = nodesWithPos[0];
  if (!nodeWithPos) {
    return void 0;
  }
  const parent = doc.resolve(nodeWithPos.pos).parent;
  if (parent.type.name === "FIGURE" && nodeWithPos.node.type.name !== "CAPTION") {
    return { node: parent, pos: nodeWithPos.pos - 1 };
  }
  return nodeWithPos;
};
export {
  findAdjustedNodeById
};
//# sourceMappingURL=find-adjusted-node-by-id.js.map
