import { useRef as v, useEffect as c } from "react";
import { resolveResponsiveViewType as w } from "../model/resolveResponsiveViewType.js";
import y from "../shared/parsePixelSize.js";
const h = (u) => {
  const { onViewTypeChange: n, responsiveBreakpoint: p, viewType: r, wrapperTableWidth: a, wrapperWidth: d } = u, t = v(r), i = v(
    void 0
  ), e = p !== void 0, f = e ? y(a) ?? d : void 0, T = e && r !== t.current, o = e ? w("TABLE", f, p) : r;
  e ? T && (i.current = {
    responsiveViewType: o,
    viewType: r
  }) : i.current = void 0, e && i.current?.responsiveViewType !== o && (i.current = void 0);
  const s = e ? i.current?.viewType ?? o : r;
  return c(() => {
    e && n?.(s);
  }, [e, n, s]), c(() => {
    t.current = r;
  }, [r]), s;
};
export {
  h as default
};
//# sourceMappingURL=useResponsiveResolvedViewType.js.map
