/**
 * The useMaximize hook can be used to determine whether the current window is maximized, and to
 * toggle that state. This is used by the MaximizeButton as well as TabRegion (where the drag region
 * can be double clicked to maximize)
 */
import { useDispatch, useSelector } from "react-redux";
import { useContext } from "react";
import { WindowNameContext } from "./WindowTitleBarContext";
import { actions } from "../../../platform/services/window/modules/actions";
export const useMaximize = () => {
    var _a;
    const dispatch = useDispatch();
    const state = useSelector((currentState) => currentState);
    const windowName = useContext(WindowNameContext);
    const isMaximized = !!(windowName ? (_a = state.windows[windowName]) === null || _a === void 0 ? void 0 : _a.maximized : false);
    const toggle = () => {
        dispatch(actions.setMaximize({
            toggleState: !isMaximized,
        }));
    };
    return { toggle, isMaximized };
};
//# sourceMappingURL=useMaximize.js.map