import { jsx as e } from "react/jsx-runtime";
import { forwardRef as R, useRef as n, useImperativeHandle as S, useEffect as V } from "react";
import { Scrollbars as I } from "react-custom-scrollbars-4";
import { noop as O, debounce as x } from "es-toolkit/function";
import s from "../../utils/classNames.js";
const E = 100, P = R(
  (i, m) => {
    const {
      slideIn: b = !1,
      largeTrack: l = !1,
      trackOffset: t = !1,
      className: u = "",
      onScroll: d = O,
      tagName: f = "div",
      autoHeight: h = !1,
      autoHeightMin: N = 0,
      autoHeightMax: p = 200,
      children: v,
      style: y,
      ...k
    } = i, a = n(null), c = n(null);
    S(m, () => a.current, []), V(() => {
      if (!c.current || !a.current)
        return;
      const r = x(() => {
        a.current && a.current.update();
      }, E), o = new ResizeObserver(r);
      return o.observe(c.current), () => {
        o.disconnect(), r.cancel();
      };
    }, []);
    const T = s(u, b && "scrollbar-fly-in", "smooth-scrollbar-wrapper"), z = s(
      "scrollbar-track-vertical",
      l && "scrollbar-track-size-large",
      t && "scrollbar-track-offset"
    ), g = s(
      "scrollbar-thumb-vertical",
      l && "scrollbar-thumb-size-large"
    ), H = s(
      "scrollbar-track-horizontal",
      l && "scrollbar-track-size-large",
      t && "scrollbar-track-offset"
    ), w = s(
      "scrollbar-thumb-horizontal",
      l && "scrollbar-thumb-size-large"
    );
    return /* @__PURE__ */ e(
      I,
      {
        ...k,
        ref: a,
        tagName: f,
        onScroll: d,
        className: T,
        hideTracksWhenNotNeeded: !0,
        autoHeight: h,
        autoHeightMin: N,
        autoHeightMax: p,
        renderView: (r) => /* @__PURE__ */ e("div", { ...r, className: "scrollbar-view" }),
        renderTrackVertical: (r) => /* @__PURE__ */ e("div", { ...r, className: z }),
        renderThumbVertical: (r) => /* @__PURE__ */ e("div", { ...r, className: g }),
        renderTrackHorizontal: (r) => /* @__PURE__ */ e("div", { ...r, className: H }),
        renderThumbHorizontal: (r) => /* @__PURE__ */ e("div", { ...r, className: w }),
        children: /* @__PURE__ */ e("div", { className: "scrollbar-content-wrapper", ref: c, children: v })
      }
    );
  }
);
export {
  P as default
};
//# sourceMappingURL=SmoothScrollbars.js.map
