import { createSvgContainer as u } from "./createSvgContainer.js";
import { drawBins as k } from "./drawBins.js";
import { createGridlines as y } from "./createGridlines.js";
import { logspace as H } from "./logspace.js";
import { createLabels as z } from "./createLabels.js";
import { drawThreshold as S } from "./drawThreshold.js";
import { normalizeBins as w } from "./normalizeBins.js";
import { min as $, max as d, bin as F } from "d3-array";
import { scaleSymlog as T, scaleLinear as C } from "d3-scale";
import { axisBottom as b, axisLeft as B } from "d3-axis";
const V = (n, t) => n.append("g").style("font-size", "14px").style("font-weight", "500").attr("transform", `translate(0,${t})`), v = (n) => n.append("g").style("font-size", "14px").style("font-weight", "500"), L = (n, t) => C().domain([0, d(n, (r) => r.length)]).range([t, 0]);
function K(n, t, r) {
  const { width: g, height: m, nBins: s = 10 } = t, e = u(n, t), h = $(r), l = d(r), c = C().domain([h, l]).range([0, g]), o = w(F().domain(c.domain()).thresholds(c.ticks(s))(r)), a = L(o, m);
  y(e, t, { x: c, y: a }, (i) => i.ticks(6)), k(e, o, t, { x: c, y: a }), S(e, { x: c, y: a }, t), V(e, m).call(b(c).tickSize(0)), v(e).call(B(a).tickSize(0)), z(e, t);
}
function O(n, t, r) {
  const { width: g, height: m, nBins: s = 10 } = t, e = u(n, t), h = $(r), l = d(r), c = T().domain([h, l]).range([0, g]).nice(), o = (f) => {
    const M = [];
    for (let x = 0; x <= f; x++)
      M.push(Number(c.invert(g * (x / f)).toFixed(2)));
    return M;
  }, a = w(F().domain(c.domain()).thresholds(o(s))(r)), i = L(a, m), p = H(0, Math.ceil(Math.log10(l)), 6);
  y(e, t, { x: c, y: i }, (f) => f.tickValues(p)), k(e, a, t, { x: c, y: i }), S(e, { x: c, y: i }, t), V(e, m).call(b(c).tickValues(p).tickSize(0)), v(e).call(B(i).tickSize(0)), z(e, t);
}
function P(n, t, r) {
  const { width: g, height: m } = t, s = u(n, t), e = w(r), h = $(e, (i) => i.x0), l = d(e, (i) => i.x1), c = T().domain([h, l]).range([0, g]).nice(), o = L(e, m), a = H(0, Math.ceil(Math.log10(l)), 6);
  y(s, t, { x: c, y: o }, (i) => i.tickValues(a)), k(s, e, t, { x: c, y: o }), S(s, { x: c, y: o }, t), V(s, m).call(b(c).tickValues(a).tickSize(0)), v(s).call(B(o).tickSize(0)), z(s, t);
}
export {
  P as createHistogramFromBins,
  K as createHistogramLinear,
  O as createHistogramLog
};
//# sourceMappingURL=histogram.js.map
