import { Gn as readonly, Kn as ref, gn as watch, jt as onBeforeUnmount } from "./vue.runtime.esm-bundler-BvoXUmaf.js";
import { Q as IN_BROWSER, Y as templateRef } from "./defineComponent-DB6xIcDy.js";
//#region node_modules/vuetify/lib/composables/resizeObserver.js
function useResizeObserver(callback, box = "content") {
	const resizeRef = templateRef();
	const contentRect = ref();
	if (IN_BROWSER) {
		const observer = new ResizeObserver((entries) => {
			callback?.(entries, observer);
			if (!entries.length) return;
			if (box === "content") contentRect.value = entries[0].contentRect;
			else contentRect.value = entries[0].target.getBoundingClientRect();
		});
		onBeforeUnmount(() => {
			observer.disconnect();
		});
		watch(() => resizeRef.el, (newValue, oldValue) => {
			if (oldValue) {
				observer.unobserve(oldValue);
				contentRect.value = void 0;
			}
			if (newValue) observer.observe(newValue);
		}, { flush: "post" });
	}
	return {
		resizeRef,
		contentRect: readonly(contentRect)
	};
}
//#endregion
export { useResizeObserver as t };

//# sourceMappingURL=resizeObserver-C12jWpYk.js.map