import namespace_default from "../../../d3-selection/src/namespace.js";
import { interpolateTransformSvg } from "../../../d3-interpolate/src/transform/index.js";
import { tweenValue } from "./tween.js";
import interpolate_default from "./interpolate.js";
function attrRemove(e) {
	return function() {
		this.removeAttribute(e);
	};
}
function attrRemoveNS(e) {
	return function() {
		this.removeAttributeNS(e.space, e.local);
	};
}
function attrConstant(e, n, r) {
	var i, a = r + "", o;
	return function() {
		var s = this.getAttribute(e);
		return s === a ? null : s === i ? o : o = n(i = s, r);
	};
}
function attrConstantNS(e, n, r) {
	var i, a = r + "", o;
	return function() {
		var s = this.getAttributeNS(e.space, e.local);
		return s === a ? null : s === i ? o : o = n(i = s, r);
	};
}
function attrFunction(e, n, r) {
	var i, a, o;
	return function() {
		var s, c = r(this), l;
		return c == null ? void this.removeAttribute(e) : (s = this.getAttribute(e), l = c + "", s === l ? null : s === i && l === a ? o : (a = l, o = n(i = s, c)));
	};
}
function attrFunctionNS(e, n, r) {
	var i, a, o;
	return function() {
		var s, c = r(this), l;
		return c == null ? void this.removeAttributeNS(e.space, e.local) : (s = this.getAttributeNS(e.space, e.local), l = c + "", s === l ? null : s === i && l === a ? o : (a = l, o = n(i = s, c)));
	};
}
function attr_default(u, d) {
	var f = namespace_default(u), p = f === "transform" ? interpolateTransformSvg : interpolate_default;
	return this.attrTween(u, typeof d == "function" ? (f.local ? attrFunctionNS : attrFunction)(f, p, tweenValue(this, "attr." + u, d)) : d == null ? (f.local ? attrRemoveNS : attrRemove)(f) : (f.local ? attrConstantNS : attrConstant)(f, p, d));
}
export { attr_default as default };
