import { COMMENT, DECLARATION, IMPORT, KEYFRAMES, LAYER, NAMESPACE, RULESET } from "./Enum.js";
import { strlen } from "./Utility.js";
function serialize(e, o) {
	for (var s = "", c = 0; c < e.length; c++) s += o(e[c], c, e, o) || "";
	return s;
}
function stringify(l, u, d, f) {
	switch (l.type) {
		case LAYER: if (l.children.length) break;
		case IMPORT:
		case NAMESPACE:
		case DECLARATION: return l.return = l.return || l.value;
		case COMMENT: return "";
		case KEYFRAMES: return l.return = l.value + "{" + serialize(l.children, f) + "}";
		case RULESET: if (!strlen(l.value = l.props.join(","))) return "";
	}
	return strlen(d = serialize(l.children, f)) ? l.return = l.value + "{" + d + "}" : "";
}
export { serialize, stringify };
