var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
            t[p[i]] = s[p[i]];
    return t;
};
import { handleActions } from 'redux-actions';
import { openSection, showNotification, hideNotification, keyDown, keyUp, } from '../actions/ui';
var initialState = {
    currentSectionId: '3d',
    notifications: {},
    shiftPressed: false,
    controlPressed: false,
    altPressed: false,
};
var ui = handleActions(new Map([
    [
        openSection,
        function (state, action) { return (__assign({}, state, { currentSectionId: action.payload })); }
    ],
    [
        showNotification,
        function (state, _a) {
            var payload = _a.payload;
            var _b;
            return (__assign({}, state, { notifications: __assign({}, state.notifications, (_b = {}, _b[payload.key] = payload, _b)) }));
        }
    ],
    [
        hideNotification,
        function (state, _a) {
            var payload = _a.payload;
            var _b = state.notifications, _c = payload, value = _b[_c], notifications = __rest(_b, [typeof _c === "symbol" ? _c : _c + ""]);
            return __assign({}, state, { notifications: notifications });
        }
    ],
    [
        keyDown,
        function (state, _a) {
            var payload = _a.payload;
            return (__assign({}, state, { shiftPressed: state.shiftPressed || payload === 'Shift', controlPressed: state.controlPressed || payload === 'Control', altPressed: state.altPressed || payload === 'Alt' }));
        }
    ],
    [
        keyUp,
        function (state, _a) {
            var payload = _a.payload;
            return (__assign({}, state, { shiftPressed: state.shiftPressed && payload !== 'Shift', controlPressed: state.controlPressed && payload !== 'Control', altPressed: state.altPressed && payload !== 'Alt' }));
        }
    ]
]), initialState);
export default ui;
//# sourceMappingURL=ui.js.map