"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.viewerReducer = exports.VIEWER_INITIAL_STATE = void 0;
var tslib_1 = require("tslib");
var common_1 = require("../api/common");
var actions_1 = require("../constants/actions");
exports.VIEWER_INITIAL_STATE = {
    busyCount: 0,
    size: undefined,
    tool: common_1.ActiveMapTool.None,
    featureTooltipsEnabled: true
};
function viewerReducer(state, action) {
    if (state === void 0) { state = exports.VIEWER_INITIAL_STATE; }
    switch (action.type) {
        case actions_1.ActionType.INIT_APP:
            {
                var tool = action.payload.initialActiveTool;
                var ft = action.payload.featureTooltipsEnabled;
                var state1 = void 0;
                if (tool != null) {
                    state1 = {
                        tool: tool
                    };
                }
                var state2 = void 0;
                if (typeof (ft) != 'undefined') {
                    state2 = {
                        featureTooltipsEnabled: ft
                    };
                }
                return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, state), state1), state2);
            }
        case actions_1.ActionType.MAP_SET_ACTIVE_TOOL:
            {
                var state1 = {
                    tool: action.payload
                };
                return tslib_1.__assign(tslib_1.__assign({}, state), state1);
            }
        case actions_1.ActionType.MAP_SET_MAPTIP:
            {
                var state1 = {
                    featureTooltipsEnabled: action.payload
                };
                return tslib_1.__assign(tslib_1.__assign({}, state), state1);
            }
        case actions_1.ActionType.MAP_ENABLE_SELECT_DRAGPAN:
            {
                var state1 = {
                    selectCanDragPan: action.payload
                };
                return tslib_1.__assign(tslib_1.__assign({}, state), state1);
            }
        case actions_1.ActionType.MAP_SET_BUSY_COUNT:
            {
                var state1 = {
                    busyCount: action.payload
                };
                return tslib_1.__assign(tslib_1.__assign({}, state), state1);
            }
        case actions_1.ActionType.MAP_RESIZED:
            {
                var state1 = {
                    size: [action.payload.width, action.payload.height]
                };
                return tslib_1.__assign(tslib_1.__assign({}, state), state1);
            }
    }
    return state;
}
exports.viewerReducer = viewerReducer;
//# sourceMappingURL=viewer.js.map