"use client";
import d from "./ascending.js";
import l from "./descending.js";
function b(c) {
  let u, s, o;
  c.length !== 2 ? (u = d, s = (n, e) => d(c(n), e), o = (n, e) => c(n) - e) : (u = c === d || c === l ? c : p, s = c, o = c);
  function f(n, e, t = 0, r = n.length) {
    if (t < r) {
      if (u(e, e) !== 0) return r;
      do {
        const i = t + r >>> 1;
        s(n[i], e) < 0 ? t = i + 1 : r = i;
      } while (t < r);
    }
    return t;
  }
  function m(n, e, t = 0, r = n.length) {
    if (t < r) {
      if (u(e, e) !== 0) return r;
      do {
        const i = t + r >>> 1;
        s(n[i], e) <= 0 ? t = i + 1 : r = i;
      } while (t < r);
    }
    return t;
  }
  function g(n, e, t = 0, r = n.length) {
    const i = f(n, e, t, r - 1);
    return i > t && o(n[i - 1], e) > -o(n[i], e) ? i - 1 : i;
  }
  return { left: f, center: g, right: m };
}
function p() {
  return 0;
}
export {
  b as default
};
