"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const measure = require("./dist-es-projection-utils-measure.cjs");
const DOMVisualElement = require("./dist-es-render-dom-DOMVisualElement.cjs");
const isCssVariable = require("./dist-es-render-dom-utils-is-css-variable.cjs");
const defaults = require("./dist-es-render-dom-value-types-defaults.cjs");
const buildStyles = require("./dist-es-render-html-utils-build-styles.cjs");
const keysTransform = require("./dist-es-render-html-utils-keys-transform.cjs");
const render = require("./dist-es-render-html-utils-render.cjs");
const scrapeMotionValues = require("./dist-es-render-html-utils-scrape-motion-values.cjs");
function getComputedStyle(element) {
  return window.getComputedStyle(element);
}
class HTMLVisualElement extends DOMVisualElement.DOMVisualElement {
  constructor() {
    super(...arguments);
    this.type = "html";
    this.renderInstance = render.renderHTML;
  }
  readValueFromInstance(instance, key) {
    if (keysTransform.transformProps.has(key)) {
      const defaultType = defaults.getDefaultValueType(key);
      return defaultType ? defaultType.default || 0 : 0;
    } else {
      const computedStyle = getComputedStyle(instance);
      const value = (isCssVariable.isCSSVariableName(key) ? computedStyle.getPropertyValue(key) : computedStyle[key]) || 0;
      return typeof value === "string" ? value.trim() : value;
    }
  }
  measureInstanceViewportBox(instance, { transformPagePoint }) {
    return measure.measureViewportBox(instance, transformPagePoint);
  }
  build(renderState, latestValues, props) {
    buildStyles.buildHTMLStyles(renderState, latestValues, props.transformTemplate);
  }
  scrapeMotionValuesFromProps(props, prevProps, visualElement) {
    return scrapeMotionValues.scrapeMotionValuesFromProps(props, prevProps, visualElement);
  }
}
exports.HTMLVisualElement = HTMLVisualElement;
exports.getComputedStyle = getComputedStyle;
//# sourceMappingURL=dist-es-render-html-HTMLVisualElement.cjs.map
