import { defaultIconProps as e } from "../icon/defaults.js";
import { defaultIconCustomisations as t } from "../customisations/defaults.js";
import { calculateSize as n } from "./size.js";
import { wrapSVGContent as r } from "./defs.js";
//#region ../../node_modules/@iconify/utils/lib/svg/build.js
var i = (e) => e === "unset" || e === "undefined" || e === "none";
function a(a, o) {
	let s = {
		...e,
		...a
	}, c = {
		...t,
		...o
	}, l = {
		left: s.left,
		top: s.top,
		width: s.width,
		height: s.height
	}, u = s.body;
	[s, c].forEach((e) => {
		let t = [], n = e.hFlip, i = e.vFlip, a = e.rotate;
		n ? i ? a += 2 : (t.push("translate(" + (l.width + l.left).toString() + " " + (0 - l.top).toString() + ")"), t.push("scale(-1 1)"), l.top = l.left = 0) : i && (t.push("translate(" + (0 - l.left).toString() + " " + (l.height + l.top).toString() + ")"), t.push("scale(1 -1)"), l.top = l.left = 0);
		let o;
		switch (a < 0 && (a -= Math.floor(a / 4) * 4), a %= 4, a) {
			case 1:
				o = l.height / 2 + l.top, t.unshift("rotate(90 " + o.toString() + " " + o.toString() + ")");
				break;
			case 2:
				t.unshift("rotate(180 " + (l.width / 2 + l.left).toString() + " " + (l.height / 2 + l.top).toString() + ")");
				break;
			case 3:
				o = l.width / 2 + l.left, t.unshift("rotate(-90 " + o.toString() + " " + o.toString() + ")");
				break;
		}
		a % 2 == 1 && (l.left !== l.top && (o = l.left, l.left = l.top, l.top = o), l.width !== l.height && (o = l.width, l.width = l.height, l.height = o)), t.length && (u = r(u, "<g transform=\"" + t.join(" ") + "\">", "</g>"));
	});
	let d = c.width, f = c.height, p = l.width, m = l.height, h, g;
	d === null ? (g = f === null ? "1em" : f === "auto" ? m : f, h = n(g, p / m)) : (h = d === "auto" ? p : d, g = f === null ? n(h, m / p) : f === "auto" ? m : f);
	let _ = {}, v = (e, t) => {
		i(t) || (_[e] = t.toString());
	};
	v("width", h), v("height", g);
	let y = [
		l.left,
		l.top,
		p,
		m
	];
	return _.viewBox = y.join(" "), {
		attributes: _,
		viewBox: y,
		body: u
	};
}
//#endregion
export { a as iconToSVG };
