"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UIWindowSize = exports.UIWindowSizeType = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
var UIWindowSizeType;
(function (UIWindowSizeType) {
    UIWindowSizeType["FULL"] = "full";
    UIWindowSizeType["NORMAL"] = "normal";
    UIWindowSizeType["MINIMUM"] = "minimum";
})(UIWindowSizeType = exports.UIWindowSizeType || (exports.UIWindowSizeType = {}));
function UIWindowSize(props) {
    const [size, setSize] = (0, react_1.useState)(2500);
    (0, react_1.useLayoutEffect)(() => {
        function updateSize() {
            setSize(window.innerWidth);
        }
        window.addEventListener("resize", updateSize);
        updateSize();
        return () => window.removeEventListener("resize", updateSize);
    }, []);
    let sizeType = UIWindowSizeType.FULL;
    if (size < (props.maxSizeAbove ?? 1920))
        sizeType = UIWindowSizeType.NORMAL;
    if (size < (props.minSizeBelow ?? 1366))
        sizeType = UIWindowSizeType.MINIMUM;
    return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.renderControl(sizeType) });
}
exports.UIWindowSize = UIWindowSize;
//# sourceMappingURL=UIWindowSize.js.map