import { bindScroll } from "./util.mjs";
import { requestNewFrame } from "../../utils/dist/index.mjs";
function repositionScrollStrategy(data, _name) {
  var _a;
  let slow = false;
  let raf = -1;
  function update(e) {
    requestNewFrame(() => {
      var _a2, _b;
      const start = performance.now();
      (_b = (_a2 = data.updatePosition).value) == null ? void 0 : _b.call(_a2, e);
      const time = performance.now() - start;
      slow = time / (1e3 / 60) > 2;
    });
  }
  bindScroll((_a = data.activatorEl.value) != null ? _a : data.contentEl.value, (e) => {
    if (slow) {
      cancelAnimationFrame(raf);
      raf = requestAnimationFrame(() => {
        raf = requestAnimationFrame(() => {
          update(e);
        });
      });
    } else {
      update(e);
    }
  });
}
export {
  repositionScrollStrategy
};
//# sourceMappingURL=reposition.mjs.map
