"use client";
import { useState as s, useCallback as u } from "react";
var i = 1;
function f() {
  var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], [t, g] = s({
    height: 0,
    left: 0,
    top: 0,
    width: 0
  }), l = u(
    (a) => {
      if (a != null) {
        var h = a.getBoundingClientRect(), e = {
          height: h.height,
          left: h.left,
          top: h.top,
          width: h.width
        };
        (Math.abs(e.height - t.height) > i || Math.abs(e.left - t.left) > i || Math.abs(e.top - t.top) > i || Math.abs(e.width - t.width) > i) && g({
          height: e.height,
          left: e.left,
          top: e.top,
          width: e.width
        });
      }
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [t.width, t.height, t.top, t.left, ...n]
  );
  return [t, l];
}
export {
  f as useElementOffset
};
