"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const ticks = require("../d3-array/src-ticks.cjs");
const formatSpecifier = require("../d3-format/src-formatSpecifier.cjs");
const precisionFixed = require("../d3-format/src-precisionFixed.cjs");
const precisionRound = require("../d3-format/src-precisionRound.cjs");
const precisionPrefix = require("../d3-format/src-precisionPrefix.cjs");
const defaultLocale = require("../d3-format/src-defaultLocale.cjs");
function tickFormat(start, stop, count, specifier) {
  var step = ticks.tickStep(start, stop, count), precision;
  specifier = formatSpecifier.default(specifier == null ? ",f" : specifier);
  switch (specifier.type) {
    case "s": {
      var value = Math.max(Math.abs(start), Math.abs(stop));
      if (specifier.precision == null && !isNaN(precision = precisionPrefix.default(step, value))) specifier.precision = precision;
      return defaultLocale.formatPrefix(specifier, value);
    }
    case "":
    case "e":
    case "g":
    case "p":
    case "r": {
      if (specifier.precision == null && !isNaN(precision = precisionRound.default(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
      break;
    }
    case "f":
    case "%": {
      if (specifier.precision == null && !isNaN(precision = precisionFixed.default(step))) specifier.precision = precision - (specifier.type === "%") * 2;
      break;
    }
  }
  return defaultLocale.format(specifier);
}
exports.default = tickFormat;
//# sourceMappingURL=src-tickFormat.cjs.map
