'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var HTMLTextSystem = require('../HTMLTextSystem.js');

let tempHTMLTextRenderData;
function measureHtmlText(text, style, fontStyleCSS, htmlTextRenderData) {
  htmlTextRenderData = htmlTextRenderData || tempHTMLTextRenderData || (tempHTMLTextRenderData = new HTMLTextSystem.HTMLTextRenderData());
  const { domElement, styleElement, svgRoot } = htmlTextRenderData;
  domElement.innerHTML = text;
  domElement.setAttribute("style", style.cssStyle);
  if (fontStyleCSS) {
    styleElement.textContent = fontStyleCSS;
  }
  document.body.appendChild(svgRoot);
  const contentBounds = domElement.getBoundingClientRect();
  svgRoot.remove();
  return {
    width: contentBounds.width,
    height: contentBounds.height
  };
}

exports.measureHtmlText = measureHtmlText;
//# sourceMappingURL=measureHtmlText..js.map
