"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index = require("../../../../../node_modules/@vueuse/core/index.js");
const Vue = require("vue");
const useAutoResize = (props) => {
  const sizer = Vue.ref();
  const width$ = Vue.ref(0);
  const height$ = Vue.ref(0);
  let resizerStopper;
  Vue.onMounted(() => {
    resizerStopper = index.useResizeObserver(sizer, ([entry]) => {
      const { width, height } = entry.contentRect;
      const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
      const left = Number.parseInt(paddingLeft) || 0;
      const right = Number.parseInt(paddingRight) || 0;
      const top = Number.parseInt(paddingTop) || 0;
      const bottom = Number.parseInt(paddingBottom) || 0;
      width$.value = width - left - right;
      height$.value = height - top - bottom;
    }).stop;
  });
  Vue.onBeforeUnmount(() => {
    resizerStopper == null ? void 0 : resizerStopper();
  });
  Vue.watch([width$, height$], ([width, height]) => {
    var _a;
    (_a = props.onResize) == null ? void 0 : _a.call(props, {
      width,
      height
    });
  });
  return {
    sizer,
    width: width$,
    height: height$
  };
};
exports.useAutoResize = useAutoResize;
