import { tickStep as e } from "../../d3-array/src/ticks.js";
import t from "../../d3-format/src/formatSpecifier.js";
import { format as n, formatPrefix as r } from "../../d3-format/src/defaultLocale.js";
import i from "../../d3-format/src/precisionFixed.js";
import a from "../../d3-format/src/precisionPrefix.js";
import o from "../../d3-format/src/precisionRound.js";
//#region ../../node_modules/d3-scale/src/tickFormat.js
function s(s, c, l, u) {
	var d = e(s, c, l), f;
	switch (u = t(u ?? ",f"), u.type) {
		case "s":
			var p = Math.max(Math.abs(s), Math.abs(c));
			return u.precision == null && !isNaN(f = a(d, p)) && (u.precision = f), r(u, p);
		case "":
		case "e":
		case "g":
		case "p":
		case "r":
			u.precision == null && !isNaN(f = o(d, Math.max(Math.abs(s), Math.abs(c)))) && (u.precision = f - (u.type === "e"));
			break;
		case "f":
		case "%":
			u.precision == null && !isNaN(f = i(d)) && (u.precision = f - (u.type === "%") * 2);
			break;
	}
	return n(u);
}
//#endregion
export { s as default };
