import { jsx as L } from "@emotion/react/jsx-runtime";
import { useRef as S } from "react";
import { AnimatedScrollRoot as h } from "./styles.js";
const R = (u) => {
  const { children: f } = u, e = S(null), m = 0.1;
  let t;
  return /* @__PURE__ */ L(
    h,
    {
      className: "animated-scroll-container",
      ref: e,
      onMouseEnter: () => {
        if (e.current) {
          let c = function(a) {
            o || (o = a), r = a - o;
            const d = l + s * (r / i);
            n.scrollLeft = d, r < i && (t = requestAnimationFrame(c));
          };
          const n = e.current, l = n.scrollLeft, s = n.scrollWidth - l, i = s / m;
          let o, r;
          t = requestAnimationFrame(c);
        }
      },
      onMouseLeave: () => {
        t !== void 0 && cancelAnimationFrame(t), e.current && (e.current.scrollLeft = 0);
      },
      children: f
    }
  );
};
export {
  R as AnimatedScroll
};
