function s(i, e) {
  function o(t) {
    const l = i.getBoundingClientRect(), f = i.ownerDocument.defaultView, d = l.left + f.scrollX, a = l.top + f.scrollY;
    let u = t.pageX - d, r = t.pageY - a;
    if (t._parentEvent) {
      const n = t.target;
      n instanceof HTMLElement && (u += n.getBoundingClientRect().left + n.ownerDocument.defaultView.scrollX, r += n.getBoundingClientRect().top + n.ownerDocument.defaultView.scrollY);
    }
    e?.onMove && e.onMove(u, r, t);
  }
  function c() {
    document.removeEventListener("pointermove", o), document.removeEventListener("pointerup", c), e?.onStop && e.onStop();
  }
  document.addEventListener("pointermove", o, { passive: !0 }), document.addEventListener("pointerup", c), e?.initialEvent instanceof PointerEvent && o(e.initialEvent);
}
export {
  s as d
};
