import { useMemo } from "react";
const useGetCharMeasureInContainer = (container, containerSize) => {
  return useMemo(() => {
    var _a, _b;
    if (!container.current) {
      return {
        height: 0,
        width: 0
      };
    }
    const elem = document.createElement("div");
    elem.style.display = "inline";
    elem.style.opacity = "0";
    elem.style.position = "fixed";
    elem.style.top = "0";
    elem.style.width = "auto";
    elem.style.visibility = "hidden";
    elem.textContent = "W";
    (_b = (_a = container.current) == null ? void 0 : _a.appendChild) == null ? void 0 : _b.call(_a, elem);
    const charRect = elem.getBoundingClientRect();
    elem.remove();
    return {
      height: charRect.height,
      width: charRect.width
    };
  }, [container, containerSize]);
};
export {
  useGetCharMeasureInContainer as default
};
