import e from "../../d3-array/src/bisect.js";
import t from "../../d3-interpolate/src/number.js";
import n from "../../d3-interpolate/src/value.js";
import r from "../../d3-interpolate/src/round.js";
import i from "./constant.js";
import a from "./number.js";
//#region ../../node_modules/d3-scale/src/continuous.js
var o = [0, 1];
function s(e) {
	return e;
}
function c(e, t) {
	return (t -= e = +e) ? function(n) {
		return (n - e) / t;
	} : i(isNaN(t) ? NaN : .5);
}
function l(e, t) {
	var n;
	return e > t && (n = e, e = t, t = n), function(n) {
		return Math.max(e, Math.min(t, n));
	};
}
function u(e, t, n) {
	var r = e[0], i = e[1], a = t[0], o = t[1];
	return i < r ? (r = c(i, r), a = n(o, a)) : (r = c(r, i), a = n(a, o)), function(e) {
		return a(r(e));
	};
}
function d(t, n, r) {
	var i = Math.min(t.length, n.length) - 1, a = Array(i), o = Array(i), s = -1;
	for (t[i] < t[0] && (t = t.slice().reverse(), n = n.slice().reverse()); ++s < i;) a[s] = c(t[s], t[s + 1]), o[s] = r(n[s], n[s + 1]);
	return function(n) {
		var r = e(t, n, 1, i) - 1;
		return o[r](a[r](n));
	};
}
function f(e, t) {
	return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());
}
function p() {
	var e = o, i = o, c = n, f, p, m, h = s, g, _, v;
	function y() {
		var t = Math.min(e.length, i.length);
		return h !== s && (h = l(e[0], e[t - 1])), g = t > 2 ? d : u, _ = v = null, b;
	}
	function b(t) {
		return t == null || isNaN(t = +t) ? m : (_ ||= g(e.map(f), i, c))(f(h(t)));
	}
	return b.invert = function(n) {
		return h(p((v ||= g(i, e.map(f), t))(n)));
	}, b.domain = function(t) {
		return arguments.length ? (e = Array.from(t, a), y()) : e.slice();
	}, b.range = function(e) {
		return arguments.length ? (i = Array.from(e), y()) : i.slice();
	}, b.rangeRound = function(e) {
		return i = Array.from(e), c = r, y();
	}, b.clamp = function(e) {
		return arguments.length ? (h = e ? !0 : s, y()) : h !== s;
	}, b.interpolate = function(e) {
		return arguments.length ? (c = e, y()) : c;
	}, b.unknown = function(e) {
		return arguments.length ? (m = e, b) : m;
	}, function(e, t) {
		return f = e, p = t, y();
	};
}
function m() {
	return p()(s, s);
}
//#endregion
export { f as copy, m as default };
