"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var preprocess_exports = {};
__export(preprocess_exports, {
  preprocess: () => preprocess
});
module.exports = __toCommonJS(preprocess_exports);
var import_function = require("fp-ts-esm/function");
var import_string = require("fp-ts-esm/string");
var import_parse5 = require("parse5");
var import_ast_traversal = require("./../../../../converters/html/fromHtml/core/ast-traversal.js");
var import_parse5_utils = require("./../../../../converters/html/fromHtml/core/parse5-utils.js");
var import_preprocess = require("../core/preprocess.js");
const preprocess = (0, import_function.flow)(
  (0, import_string.replace)(/\s*\n\s*/g, ""),
  // remove spaces between lines (they count as elements)
  (0, import_string.replace)('"<', "<"),
  // remove first `"` if exists
  (0, import_string.replace)('>"', ">"),
  // remove last `"` if exists
  (0, import_string.replace)(/""/g, '"'),
  // convert `""string""` to `"string"`
  (0, import_string.replace)(/<\s*br\s*\/?>/g, "\n"),
  // replace br tags with new lines
  import_parse5_utils.toAst,
  (0, import_ast_traversal.traverseRoot)(import_preprocess.rootTextToP),
  import_parse5.serialize
);
//# sourceMappingURL=preprocess.js.map
