import { copyProps as e, tapIf as t } from "../helpers/functions.js";
import n from "./VScroll.js";
import r from "./HScroll.js";
import { useResizeObserver as i } from "../composition/useResizeObserver.js";
import { createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, onMounted as l, onUnmounted as u, openBlock as d, reactive as f, ref as p, renderSlot as m, unref as h, withModifiers as g } from "vue";
var _ = { class: "ui-scrollable" }, v = /* @__PURE__ */ c({
	__name: "Scrollable",
	setup(c) {
		let v = p(), y = f({
			scrollTop: 0,
			scrollLeft: 0,
			clientHeight: 0,
			clientWidth: 0,
			scrollHeight: 0,
			scrollWidth: 0
		});
		function b(t) {
			e(y, t, "scrollTop", "scrollLeft", "clientHeight", "clientWidth", "scrollHeight", "scrollWidth");
		}
		let x = (e) => {
			e.preventDefault();
			let t = e.currentTarget;
			t.scrollTop += e.deltaY, t.scrollLeft += e.deltaX, b(t);
		};
		function S(e) {
			t(h(v), (t) => {
				t.scrollTop = e, b(t);
			});
		}
		function C(e) {
			t(h(v), (t) => {
				t.scrollLeft = e, b(t);
			});
		}
		return i(v, (e) => {
			t(e, (e) => b(e));
		}), l(() => {
			t(h(v), (e) => {
				b(e), e.addEventListener("wheel", x);
			});
		}), u(() => {
			t(h(v), (e) => e.removeEventListener("wheel", x));
		}), (e, t) => (d(), a("div", _, [
			o("div", {
				ref_key: "containerRef",
				ref: v,
				class: "ui-scrollable__container",
				onWheel: x
			}, [m(e.$slots, "default")], 544),
			s(n, {
				"scroll-top": y.scrollTop,
				"client-height": y.clientHeight,
				"scroll-height": y.scrollHeight,
				onWheel: t[0] ||= g(() => {}, ["stop"]),
				"onUpdate:scrollTop": S
			}, null, 8, [
				"scroll-top",
				"client-height",
				"scroll-height"
			]),
			s(r, {
				"scroll-left": y.scrollLeft,
				"client-width": y.clientWidth,
				"scroll-width": y.scrollWidth,
				onWheel: t[1] ||= g(() => {}, ["stop"]),
				"onUpdate:scrollLeft": C
			}, null, 8, [
				"scroll-left",
				"client-width",
				"scroll-width"
			])
		]));
	}
});
export { v as default };

//# sourceMappingURL=Scrollable.vue2.js.map