import { ref as r, onMounted as u } from "vue";
const i = (e, t) => {
  const n = t || document.documentElement, o = new ResizeObserver((c) => {
    const s = c[0];
    e(s.contentRect);
  });
  return t !== null && o.observe(n), o;
}, h = () => {
  const e = r(null), t = r({ bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0, toJSON: () => {
  } });
  return u(() => {
    i((n) => {
      t.value = n;
    }, e.value), e.value;
  }), { el: e, rect: t };
};
export {
  i as SizeWatcher,
  h as useSizeWatcher
};
