"use client";
import { durationSecond as a, durationMinute as f, durationHour as d, durationDay as y, durationWeek as H, durationMonth as g, durationYear as s } from "./duration.js";
import { millisecond as Y } from "./millisecond.js";
import { second as k } from "./second.js";
import { utcMinute as b, timeMinute as W } from "./minute.js";
import { utcHour as j, timeHour as q } from "./hour.js";
import { unixDay as w, timeDay as z } from "./day.js";
import { utcSunday as A, timeSunday as B } from "./week.js";
import { utcMonth as C, timeMonth as E } from "./month.js";
import { utcYear as F, timeYear as G } from "./year.js";
import J from "../../d3-array/src/bisector.js";
import { tickStep as I } from "../../d3-array/src/ticks.js";
function S(v, l, T, p, c, m) {
  const o = [
    [k, 1, a],
    [k, 5, 5 * a],
    [k, 15, 15 * a],
    [k, 30, 30 * a],
    [m, 1, f],
    [m, 5, 5 * f],
    [m, 15, 15 * f],
    [m, 30, 30 * f],
    [c, 1, d],
    [c, 3, 3 * d],
    [c, 6, 6 * d],
    [c, 12, 12 * d],
    [p, 1, y],
    [p, 2, 2 * y],
    [T, 1, H],
    [l, 1, g],
    [l, 3, 3 * g],
    [v, 1, s]
  ];
  function h(r, t, e) {
    const n = t < r;
    n && ([r, t] = [t, r]);
    const i = e && typeof e.range == "function" ? e : M(r, t, e), u = i ? i.range(r, +t + 1) : [];
    return n ? u.reverse() : u;
  }
  function M(r, t, e) {
    const n = Math.abs(t - r) / e, i = J(([, , D]) => D).right(o, n);
    if (i === o.length) return v.every(I(r / s, t / s, e));
    if (i === 0) return Y.every(Math.max(I(r, t, e), 1));
    const [u, x] = o[n / o[i - 1][2] < o[i][2] / n ? i - 1 : i];
    return u.every(x);
  }
  return [h, M];
}
const [_, $] = S(F, C, A, w, j, b), [rr, tr] = S(G, E, B, z, q, W);
export {
  tr as timeTickInterval,
  rr as timeTicks,
  $ as utcTickInterval,
  _ as utcTicks
};
