"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const buildStyles = require("./dist-es-render-html-utils-build-styles.cjs");
const path = require("./dist-es-render-svg-utils-path.cjs");
const transformOrigin = require("./dist-es-render-svg-utils-transform-origin.cjs");
function buildSVGAttrs(state, {
  attrX,
  attrY,
  attrScale,
  originX,
  originY,
  pathLength,
  pathSpacing = 1,
  pathOffset = 0,
  // This is object creation, which we try to avoid per-frame.
  ...latest
}, isSVGTag, transformTemplate) {
  buildStyles.buildHTMLStyles(state, latest, transformTemplate);
  if (isSVGTag) {
    if (state.style.viewBox) {
      state.attrs.viewBox = state.style.viewBox;
    }
    return;
  }
  state.attrs = state.style;
  state.style = {};
  const { attrs, style, dimensions } = state;
  if (attrs.transform) {
    if (dimensions)
      style.transform = attrs.transform;
    delete attrs.transform;
  }
  if (dimensions && (originX !== void 0 || originY !== void 0 || style.transform)) {
    style.transformOrigin = transformOrigin.calcSVGTransformOrigin(dimensions, originX !== void 0 ? originX : 0.5, originY !== void 0 ? originY : 0.5);
  }
  if (attrX !== void 0)
    attrs.x = attrX;
  if (attrY !== void 0)
    attrs.y = attrY;
  if (attrScale !== void 0)
    attrs.scale = attrScale;
  if (pathLength !== void 0) {
    path.buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
  }
}
exports.buildSVGAttrs = buildSVGAttrs;
//# sourceMappingURL=dist-es-render-svg-utils-build-attrs.cjs.map
