"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/utils/scroll-to.ts
var scroll_to_exports = {};
__export(scroll_to_exports, {
  scrollTo: () => scrollTo
});
module.exports = __toCommonJS(scroll_to_exports);
function scrollTo(element, targetPosition, duration) {
  const startPosition = element.scrollTop;
  const distance = targetPosition - startPosition;
  let startTime = null;
  function animation(currentTime) {
    if (startTime === null)
      startTime = currentTime;
    const timeElapsed = currentTime - startTime;
    const run = ease(timeElapsed, startPosition, distance, duration);
    element.scrollTop = run;
    if (timeElapsed < duration) {
      requestAnimationFrame(animation);
    }
  }
  function ease(t, b, c, d) {
    let [t2] = [t];
    const [b2, c2, d2] = [b, c, d];
    t2 /= d2 / 2;
    if (t2 < 1)
      return c2 / 2 * t2 * t2 + b2;
    t2--;
    return -c2 / 2 * (t2 * (t2 - 2) - 1) + b2;
  }
  requestAnimationFrame(animation);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  scrollTo
});
//# sourceMappingURL=scroll-to.cjs.map