function T(n, l, e) {
  let i = e.initialDeps ?? [], t, c = !0;
  function h() {
    var d, m, f;
    let g;
    e.key && ((d = e.debug) != null && d.call(e)) && (g = Date.now());
    const o = n();
    if (!(o.length !== i.length || o.some((r, a) => i[a] !== r)))
      return t;
    i = o;
    let s;
    if (e.key && ((m = e.debug) != null && m.call(e)) && (s = Date.now()), t = l(...o), e.key && ((f = e.debug) != null && f.call(e))) {
      const r = Math.round((Date.now() - g) * 100) / 100, a = Math.round((Date.now() - s) * 100) / 100, b = a / 16, w = (u, D) => {
        for (u = String(u); u.length < D; )
          u = " " + u;
        return u;
      };
      console.info(
        `%c⏱ ${w(a, 5)} /${w(r, 5)} ms`,
        `
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(
          0,
          Math.min(120 - 120 * b, 120)
        )}deg 100% 31%);`,
        e == null ? void 0 : e.key
      );
    }
    return e != null && e.onChange && !(c && e.skipInitialOnChange) && e.onChange(t), c = !1, t;
  }
  return h.updateDeps = (d) => {
    i = d;
  }, h;
}
function k(n, l) {
  if (n === void 0)
    throw new Error("Unexpected undefined");
  return n;
}
const y = (n, l) => Math.abs(n - l) < 1.01, C = (n, l, e) => {
  let i;
  return function(...t) {
    n.clearTimeout(i), i = n.setTimeout(() => l.apply(this, t), e);
  };
};
export {
  y as approxEqual,
  C as debounce,
  T as memo,
  k as notUndefined
};
