"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _slugid = _interopRequireDefault(require("slugid"));
var _constants = require("../constants");
const paragraphRule = (element, parseChild) => {
  const {
    nodeName,
    childNodes
  } = element;
  if (nodeName === 'P' && element.parentElement.nodeName !== 'LI') {
    if (childNodes.length === 0) {
      return {
        id: _slugid.default.nice(),
        type: _constants.PARAGRAPH,
        children: [{
          id: _slugid.default.nice(),
          text: ''
        }]
      };
    }
    return {
      id: _slugid.default.nice(),
      type: _constants.PARAGRAPH,
      children: parseChild(childNodes)
    };
  }
  return;
};
var _default = exports.default = paragraphRule;