function Transform(e, t, n) {
	this.k = e, this.x = t, this.y = n;
}
Transform.prototype = {
	constructor: Transform,
	scale: function(t) {
		return t === 1 ? this : new Transform(this.k * t, this.x, this.y);
	},
	translate: function(t, n) {
		return t === 0 & n === 0 ? this : new Transform(this.k, this.x + this.k * t, this.y + this.k * n);
	},
	apply: function(e) {
		return [e[0] * this.k + this.x, e[1] * this.k + this.y];
	},
	applyX: function(e) {
		return e * this.k + this.x;
	},
	applyY: function(e) {
		return e * this.k + this.y;
	},
	invert: function(e) {
		return [(e[0] - this.x) / this.k, (e[1] - this.y) / this.k];
	},
	invertX: function(e) {
		return (e - this.x) / this.k;
	},
	invertY: function(e) {
		return (e - this.y) / this.k;
	},
	rescaleX: function(e) {
		return e.copy().domain(e.range().map(this.invertX, this).map(e.invert, e));
	},
	rescaleY: function(e) {
		return e.copy().domain(e.range().map(this.invertY, this).map(e.invert, e));
	},
	toString: function() {
		return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
	}
};
var identity = new Transform(1, 0, 0);
transform.prototype = Transform.prototype;
function transform(e) {
	for (; !e.__zoom;) if (!(e = e.parentNode)) return identity;
	return e.__zoom;
}
export { Transform, transform as default, identity };
