import e, { tickIncrement as t } from "../../d3-array/src/ticks.js";
import { initRange as n } from "./init.js";
import r, { copy as i } from "./continuous.js";
import a from "./tickFormat.js";
//#region ../../node_modules/d3-scale/src/linear.js
function o(n) {
	var r = n.domain;
	return n.ticks = function(t) {
		var n = r();
		return e(n[0], n[n.length - 1], t ?? 10);
	}, n.tickFormat = function(e, t) {
		var n = r();
		return a(n[0], n[n.length - 1], e ?? 10, t);
	}, n.nice = function(e) {
		e ??= 10;
		var i = r(), a = 0, o = i.length - 1, s = i[a], c = i[o], l, u, d = 10;
		for (c < s && (u = s, s = c, c = u, u = a, a = o, o = u); d-- > 0;) {
			if (u = t(s, c, e), u === l) return i[a] = s, i[o] = c, r(i);
			if (u > 0) s = Math.floor(s / u) * u, c = Math.ceil(c / u) * u;
			else if (u < 0) s = Math.ceil(s * u) / u, c = Math.floor(c * u) / u;
			else break;
			l = u;
		}
		return n;
	}, n;
}
function s() {
	var e = r();
	return e.copy = function() {
		return i(e, s());
	}, n.apply(e, arguments), o(e);
}
//#endregion
export { s as default };
