"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initialState = {
    chosenDevice: 0,
    width: -1,
    height: -1,
    dimensionsManuallySet: false,
    orientation: "portrait" /* Portrait */,
    controlsReady: true,
    isMasked: false,
};
function reducer(state, action) {
    switch (action.type) {
        case "FRAME_SELECT" /* Select */:
            return Object.assign({}, state, { chosenDevice: action.index, width: -1, height: -1, dimensionsManuallySet: false, orientation: "landscape" /* Landscape */ });
        case "FRAME_SET_DIMENSIONS" /* SetDimensions */:
            return Object.assign({}, state, { dimensionsManuallySet: action.isManual, width: action.width || state.width, height: action.height || state.height });
        case "FRAME_ROTATE" /* Rotate */:
            return Object.assign({}, state, { dimensionsManuallySet: false, orientation: state.orientation === "landscape" /* Landscape */
                    ? "portrait" /* Portrait */
                    : "landscape" /* Landscape */ });
        case "FRAME_SET_READY" /* SetReady */:
            return Object.assign({}, state, { controlsReady: action.isReady });
        case "FRAME_MASK" /* Mask */:
            return Object.assign({}, state, { isMasked: action.isMasked });
        default:
            return state;
    }
}
exports.reducer = reducer;
