"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DASHBOARD_REFRESH = exports.LAYOUT_SHOW_NON_EXTENDED_OBJECTS = exports.DISABLE_DELETE_CONFIRMATION = exports.QUICK_FILTER_BAR_HIDE = exports.QUICK_FILTER_BAR_SHOW = exports.SETTINGS_PANEL_SET = exports.DATA_CHANGE_HISTORY_RESUME = exports.DATA_CHANGE_HISTORY_SUSPEND = exports.DATA_CHANGE_HISTORY_DISABLE = exports.DATA_CHANGE_HISTORY_ENABLE = exports.DATA_CHANGE_HISTORY_CLEAR_ROW = exports.DATA_CHANGE_HISTORY_UNDO = exports.DATA_CHANGE_HISTORY_ADD = exports.LICENSE_DISABLE_PERSISTENCE = exports.LICENSE_SHOW_WATERMARK = exports.CREATE_CELL_SUMMARY_INFO = exports.SET_CELL_SUMMARY_INFO = exports.CELL_SUMMARY_CHANGE_OPERATION = exports.CACHED_QUERY_ADD = exports.BULK_UPDATE_CHANGE_VALUE = exports.BULK_UPDATE_SET_PREVIEW = exports.BULK_UPDATE_SET_VALID_SELECTION = exports.BULK_UPDATE_CHECK_CELL_SELECTION = exports.SMART_EDIT_CHANGE_OPERATION = exports.SMART_EDIT_CHANGE_VALUE = exports.SMARTEDIT_SET_PREVIEW = exports.SMARTEDIT_SET_VALID_SELECTION = exports.SMARTEDIT_FETCH_PREVIEW = exports.SMARTEDIT_CHECK_CELL_SELECTION = exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL = exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE = exports.SYSTEM_STATUS_MESSAGE_INFO_ADD = exports.ALERT_REMOVE_ROW_HIGHLIGHT = exports.ALERT_REMOVE_CELL_HIGHLIGHT = exports.ALERT_DELETE_ALL = exports.ALERT_DELETE = exports.ALERT_ADD = exports.HIGHLIGHT_ROW_DELETE_ALL = exports.HIGHLIGHT_ROWS_DELETE = exports.HIGHLIGHT_ROW_DELETE = exports.HIGHLIGHT_ROWS_ADD = exports.HIGHLIGHT_ROW_ADD = exports.HIGHLIGHT_CELL_DELETE_ALL = exports.HIGHLIGHT_CELL_DELETE = exports.HIGHLIGHT_CELL_ADD = exports.SET_DASHBOARD_MODULE_BUTTONS = exports.SET_SETTINGS_PANEL_ITEMS = exports.SET_SELECTED_ROWS = exports.SET_SELECTED_CELLS = exports.SET_COLUMNS = void 0;
exports.DataChangeHistoryEnable = exports.DataChangeHistoryClearRow = exports.DataChangeHistoryUndo = exports.DataChangeHistoryAdd = exports.LicenseDisablePersistence = exports.LicenseShowWatermark = exports.CellSummaryChangeOperation = exports.CachedQueryAdd = exports.BulkUpdateChangeValue = exports.BulkUpdateSetPreview = exports.BulkUpdateSetValidSelection = exports.BulkUpdateCheckCellSelection = exports.SmartEditSetPreview = exports.SmartEditSetValidSelection = exports.SmartEditCheckCellSelection = exports.SmartEditChangeOperation = exports.SmartEditChangeValue = exports.SystemStatusMessageInfoDeleteAll = exports.SystemStatusMessageInfoDelete = exports.SystemStatusMessageInfoAdd = exports.SetCellSummaryInfo = exports.CreateCellSummaryInfo = exports.AdaptableAlertRemoveRowHighlight = exports.AdaptableAlertRemoveCellHighlight = exports.AdaptableAlertDeleteAll = exports.AdaptableAlertDelete = exports.AdaptableAlertAdd = exports.SetDasboardModuleButtons = exports.SetSettingsPanelItems = exports.SetSelectedRows = exports.SetSelectedCells = exports.SetColumns = exports.GridHighlightRowDeleteAll = exports.GridHighlightRowsDelete = exports.HighlightRowDelete = exports.HighlightRowsAdd = exports.HighlightRowAdd = exports.HighlightCellDeleteAll = exports.HighlightCellDelete = exports.HighlightCellAdd = exports.DATA_IMPORT_COMPLETED = exports.SUMMARY_ROW_SET = exports.CELL_POPUP_EDIT_FOCUSED_ENTITY = exports.CELL_POPUP_HIDE = exports.CELL_POPUP_SHOW = exports.SYSTEM_EXPORT_END = exports.SYSTEM_EXPORT_BEGIN = exports.SET_QUICK_SEARCH_FLOATING_VISIBILITY = exports.CHARTING_SET_CURRENT_CHART_MODELS = exports.DATA_SET_SELECT = void 0;
exports.InternalReducer = exports.DataImportCompleted = exports.CommentsAndNotesFocusedEntitySelector = exports.CommentsAndNotesEditModeSelector = exports.CommentsAndNotesSelector = exports.QuickSearchFloatingVisibilitySelector = exports.DisableDeleteConfirmationSelector = exports.CellPopupHide = exports.RowSummarySet = exports.CellPopupEditFocusedEntity = exports.CellPopupShow = exports.QuickSearchFloatingVisibility = exports.SystemExportEnd = exports.SystemExportBegin = exports.DisableDeleteConfirmation = exports.ChartingCurrentChartModelsSelector = exports.ChartingSetCurrentChartModels = exports.DataSetSelect = exports.DashboardRefresh = exports.LayoutShowNonExtendedObjects = exports.QuickFilterBarHide = exports.QuickFilterBarShow = exports.SettingsPanelSet = exports.DataChangeHistoryResume = exports.DataChangeHistorySuspend = exports.DataChangeHistoryDisable = void 0;
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
const ReduxConstants_1 = require("../../Utilities/Constants/ReduxConstants");
const Enums_1 = require("../../AdaptableState/Common/Enums");
const Helper_1 = require("../../Utilities/Helpers/Helper");
const AnnotationsService_1 = require("../../Utilities/Services/AnnotationsService");
/*
Bit of a mixed bag of actions but essentially its those that are related to Strategies but where we DONT want to persist state
This allows us to keep the other reducers pure in terms of everything persists
*/
/*
ACTION NAMES
*/
// Column
exports.SET_COLUMNS = 'SET_COLUMNS';
// Selection
exports.SET_SELECTED_CELLS = 'SET_SELECTED_CELLS';
exports.SET_SELECTED_ROWS = 'SET_SELECTED_ROWS';
// UI
exports.SET_SETTINGS_PANEL_ITEMS = 'SET_SETTINGS_PANEL_ITEMS';
exports.SET_DASHBOARD_MODULE_BUTTONS = 'SET_DASHBOARD_MODULE_BUTTONS';
// Cell Highlight
exports.HIGHLIGHT_CELL_ADD = 'HIGHLIGHT_CELL_ADD';
exports.HIGHLIGHT_CELL_DELETE = 'HIGHLIGHT_CELL_DELETE';
exports.HIGHLIGHT_CELL_DELETE_ALL = 'HIGHLIGHT_CELL_DELETE_ALL';
// Row Highlight
exports.HIGHLIGHT_ROW_ADD = 'HIGHLIGHT_ROW_ADD';
exports.HIGHLIGHT_ROWS_ADD = 'HIGHLIGHT_ROWS_ADD';
exports.HIGHLIGHT_ROW_DELETE = 'HIGHLIGHT_ROW_DELETE';
exports.HIGHLIGHT_ROWS_DELETE = 'HIGHLIGHT_ROWS_DELETE';
exports.HIGHLIGHT_ROW_DELETE_ALL = 'HIGHLIGHT_ROW_DELETE_ALL';
// Alerts
exports.ALERT_ADD = 'ALERT_ADD';
exports.ALERT_DELETE = 'ALERT_DELETE';
exports.ALERT_DELETE_ALL = 'ALERT_DELETE_ALL';
exports.ALERT_REMOVE_CELL_HIGHLIGHT = 'ALERT_REMOVE_CELL_HIGHLIGHT';
exports.ALERT_REMOVE_ROW_HIGHLIGHT = 'ALERT_REMOVE_ROW_HIGHLIGHT';
// Status Message
exports.SYSTEM_STATUS_MESSAGE_INFO_ADD = 'SYSTEM_STATUS_MESSAGE_INFO_ADD';
exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE = 'SYSTEM_STATUS_MESSAGE_INFO_DELETE';
exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL = 'SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL';
// Smart Edit
exports.SMARTEDIT_CHECK_CELL_SELECTION = 'SMARTEDIT_CHECK_CELL_SELECTION';
exports.SMARTEDIT_FETCH_PREVIEW = 'SMARTEDIT_FETCH_PREVIEW';
exports.SMARTEDIT_SET_VALID_SELECTION = 'SMARTEDIT_SET_VALID_SELECTION';
exports.SMARTEDIT_SET_PREVIEW = 'SMARTEDIT_SET_PREVIEW';
exports.SMART_EDIT_CHANGE_VALUE = 'SMART_EDIT_CHANGE_VALUE';
exports.SMART_EDIT_CHANGE_OPERATION = 'SMART_EDIT_CHANGE_OPERATION';
// Bulk Update
exports.BULK_UPDATE_CHECK_CELL_SELECTION = 'BULK_UPDATE_CHECK_CELL_SELECTION';
exports.BULK_UPDATE_SET_VALID_SELECTION = 'BULK_UPDATE_SET_VALID_SELECTION';
exports.BULK_UPDATE_SET_PREVIEW = 'BULK_UPDATE_SET_PREVIEW';
exports.BULK_UPDATE_CHANGE_VALUE = 'BULK_UPDATE_CHANGE_VALUE';
// Cached Queries
exports.CACHED_QUERY_ADD = 'CACHED_QUERY_ADD';
// Cell Summary
exports.CELL_SUMMARY_CHANGE_OPERATION = 'CELL_SUMMARY_CHANGE_OPERATION';
exports.SET_CELL_SUMMARY_INFO = 'SET_CELL_SUMMARY_INFO';
exports.CREATE_CELL_SUMMARY_INFO = 'CREATE_CELL_SUMMARY_INFO';
// License
exports.LICENSE_SHOW_WATERMARK = 'LICENSE_SHOW_WATERMARK';
exports.LICENSE_DISABLE_PERSISTENCE = 'LICENSE_DISABLE_PERSISTENCE';
// Data Change History
exports.DATA_CHANGE_HISTORY_ADD = 'DATA_CHANGE_HISTORY_ADD';
exports.DATA_CHANGE_HISTORY_UNDO = 'DATA_CHANGE_HISTORY_UNDO';
exports.DATA_CHANGE_HISTORY_CLEAR_ROW = 'DATA_CHANGE_HISTORY_CLEAR_ROW';
exports.DATA_CHANGE_HISTORY_ENABLE = 'DATA_CHANGE_HISTORY_ENABLE';
exports.DATA_CHANGE_HISTORY_DISABLE = 'DATA_CHANGE_HISTORY_DISABLE';
exports.DATA_CHANGE_HISTORY_SUSPEND = 'DATA_CHANGE_HISTORY_SUSPEND';
exports.DATA_CHANGE_HISTORY_RESUME = 'DATA_CHANGE_HISTORY_RESUME';
// Settings Panel
exports.SETTINGS_PANEL_SET = 'SETTINGS_PANEL_SET';
// Quick Filter
exports.QUICK_FILTER_BAR_SHOW = 'QUICK_FILTER_BAR_SHOW';
exports.QUICK_FILTER_BAR_HIDE = 'QUICK_FILTER_BAR_HIDE';
// Delete warning
exports.DISABLE_DELETE_CONFIRMATION = 'DISABLE_DELETE_CONFIRMATION';
// Layout
exports.LAYOUT_SHOW_NON_EXTENDED_OBJECTS = 'LAYOUT_SHOW_NON_EXTENDED_OBJECTS';
exports.DASHBOARD_REFRESH = 'DASHBOARD_REFRESH';
// DataSet
exports.DATA_SET_SELECT = 'DATA_SET_SELECT';
// Charting
exports.CHARTING_SET_CURRENT_CHART_MODELS = 'CHARTING_SET_CURRENT_CHART_MODELS';
// Quick Search
exports.SET_QUICK_SEARCH_FLOATING_VISIBILITY = 'SET_QUICK_SEARCH_FLOATING_VISIBILITY';
// Data Export (Report)
exports.SYSTEM_EXPORT_BEGIN = 'SYSTEM_EXPORT_BEGIN';
exports.SYSTEM_EXPORT_END = 'SYSTEM_EXPORT_END';
// Notes and Comments
exports.CELL_POPUP_SHOW = 'CELL_POPUP_SHOW';
exports.CELL_POPUP_HIDE = 'CELL_POPUP_HIDE';
exports.CELL_POPUP_EDIT_FOCUSED_ENTITY = 'CELL_POPUP_EDIT_FOCUSED_ENTITY';
// Row Summaries
exports.SUMMARY_ROW_SET = 'SUMMARY_ROW_SET';
// Data Import
exports.DATA_IMPORT_COMPLETED = 'DATA_IMPORT_COMPLETED';
const HighlightCellAdd = (cellHighlightInfo) => ({
    type: exports.HIGHLIGHT_CELL_ADD,
    cellHighlightInfo: cellHighlightInfo,
});
exports.HighlightCellAdd = HighlightCellAdd;
const HighlightCellDelete = (primaryKeyValue, columnId) => ({
    type: exports.HIGHLIGHT_CELL_DELETE,
    primaryKeyValue,
    columnId,
});
exports.HighlightCellDelete = HighlightCellDelete;
const HighlightCellDeleteAll = () => ({
    type: exports.HIGHLIGHT_CELL_DELETE_ALL,
});
exports.HighlightCellDeleteAll = HighlightCellDeleteAll;
const HighlightRowAdd = (rowHighlightInfo) => ({
    type: exports.HIGHLIGHT_ROW_ADD,
    rowHighlightInfo: rowHighlightInfo,
});
exports.HighlightRowAdd = HighlightRowAdd;
const HighlightRowsAdd = (rowsHighlightInfo) => ({
    type: exports.HIGHLIGHT_ROWS_ADD,
    rowsHighlightInfo: rowsHighlightInfo,
});
exports.HighlightRowsAdd = HighlightRowsAdd;
const HighlightRowDelete = (primaryKeyValue) => ({
    type: exports.HIGHLIGHT_ROW_DELETE,
    primaryKeyValue: primaryKeyValue,
});
exports.HighlightRowDelete = HighlightRowDelete;
const GridHighlightRowsDelete = (primaryKeyValues) => ({
    type: exports.HIGHLIGHT_ROWS_DELETE,
    primaryKeyValues: primaryKeyValues,
});
exports.GridHighlightRowsDelete = GridHighlightRowsDelete;
const GridHighlightRowDeleteAll = () => ({
    type: exports.HIGHLIGHT_ROW_DELETE_ALL,
});
exports.GridHighlightRowDeleteAll = GridHighlightRowDeleteAll;
const SetColumns = (Columns) => ({
    type: exports.SET_COLUMNS,
    columns: Columns,
});
exports.SetColumns = SetColumns;
const SetSelectedCells = (SelectedCellInfo) => ({
    type: exports.SET_SELECTED_CELLS,
    selectedCellInfo: SelectedCellInfo,
});
exports.SetSelectedCells = SetSelectedCells;
const SetSelectedRows = (SelectedRowInfo) => ({
    type: exports.SET_SELECTED_ROWS,
    selectedRowInfo: SelectedRowInfo,
});
exports.SetSelectedRows = SetSelectedRows;
const SetSettingsPanelItems = (MenuItems) => ({
    type: exports.SET_SETTINGS_PANEL_ITEMS,
    menuItems: MenuItems,
});
exports.SetSettingsPanelItems = SetSettingsPanelItems;
const SetDasboardModuleButtons = (MenuItems) => ({
    type: exports.SET_DASHBOARD_MODULE_BUTTONS,
    menuItems: MenuItems,
});
exports.SetDasboardModuleButtons = SetDasboardModuleButtons;
/*
Public Functions
*/
const AdaptableAlertAdd = (alert, maxAlerts) => ({
    type: exports.ALERT_ADD,
    alert: alert,
    maxAlerts: maxAlerts,
});
exports.AdaptableAlertAdd = AdaptableAlertAdd;
const AdaptableAlertDelete = (alert) => ({
    type: exports.ALERT_DELETE,
    alert: alert,
});
exports.AdaptableAlertDelete = AdaptableAlertDelete;
const AdaptableAlertDeleteAll = (alerts) => ({
    type: exports.ALERT_DELETE_ALL,
    alerts: alerts,
});
exports.AdaptableAlertDeleteAll = AdaptableAlertDeleteAll;
const AdaptableAlertRemoveCellHighlight = (alert) => ({
    type: exports.ALERT_REMOVE_CELL_HIGHLIGHT,
    alert: alert,
});
exports.AdaptableAlertRemoveCellHighlight = AdaptableAlertRemoveCellHighlight;
const AdaptableAlertRemoveRowHighlight = (alert) => ({
    type: exports.ALERT_REMOVE_ROW_HIGHLIGHT,
    alert: alert,
});
exports.AdaptableAlertRemoveRowHighlight = AdaptableAlertRemoveRowHighlight;
const CreateCellSummaryInfo = () => ({
    type: exports.CREATE_CELL_SUMMARY_INFO,
});
exports.CreateCellSummaryInfo = CreateCellSummaryInfo;
const SetCellSummaryInfo = (CellSummary) => ({
    type: exports.SET_CELL_SUMMARY_INFO,
    cellSummaryInfo: CellSummary,
});
exports.SetCellSummaryInfo = SetCellSummaryInfo;
const SystemStatusMessageInfoAdd = (SystemStatusMessageInfo, MaxSystemStatusMessagesInStore) => ({
    type: exports.SYSTEM_STATUS_MESSAGE_INFO_ADD,
    systemStatusMessageInfo: SystemStatusMessageInfo,
    maxSystemStatusMessagesInStore: MaxSystemStatusMessagesInStore,
});
exports.SystemStatusMessageInfoAdd = SystemStatusMessageInfoAdd;
const SystemStatusMessageInfoDelete = (SystemStatusMessageInfo) => ({
    type: exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE,
    systemStatusMessageInfo: SystemStatusMessageInfo,
});
exports.SystemStatusMessageInfoDelete = SystemStatusMessageInfoDelete;
const SystemStatusMessageInfoDeleteAll = () => ({
    type: exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL,
});
exports.SystemStatusMessageInfoDeleteAll = SystemStatusMessageInfoDeleteAll;
const SmartEditChangeValue = (value) => ({
    type: exports.SMART_EDIT_CHANGE_VALUE,
    value,
});
exports.SmartEditChangeValue = SmartEditChangeValue;
const SmartEditChangeOperation = (smartEditOperation) => ({
    type: exports.SMART_EDIT_CHANGE_OPERATION,
    smartEditOperation,
});
exports.SmartEditChangeOperation = SmartEditChangeOperation;
const SmartEditCheckCellSelection = () => ({
    type: exports.SMARTEDIT_CHECK_CELL_SELECTION,
});
exports.SmartEditCheckCellSelection = SmartEditCheckCellSelection;
const SmartEditSetValidSelection = (IsValidSmartEditSelection) => ({
    type: exports.SMARTEDIT_SET_VALID_SELECTION,
    isValidSmartEditSelection: IsValidSmartEditSelection,
});
exports.SmartEditSetValidSelection = SmartEditSetValidSelection;
const SmartEditSetPreview = (SmartEditPreviewInfo) => ({
    type: exports.SMARTEDIT_SET_PREVIEW,
    smartEditPreviewInfo: SmartEditPreviewInfo,
});
exports.SmartEditSetPreview = SmartEditSetPreview;
const BulkUpdateCheckCellSelection = () => ({
    type: exports.BULK_UPDATE_CHECK_CELL_SELECTION,
});
exports.BulkUpdateCheckCellSelection = BulkUpdateCheckCellSelection;
const BulkUpdateSetValidSelection = (bulkUpdateValidationResult) => ({
    type: exports.BULK_UPDATE_SET_VALID_SELECTION,
    bulkUpdateValidationResult,
});
exports.BulkUpdateSetValidSelection = BulkUpdateSetValidSelection;
const BulkUpdateSetPreview = (BulkUpdatePreviewInfo) => ({
    type: exports.BULK_UPDATE_SET_PREVIEW,
    bulkUpdatePreviewInfo: BulkUpdatePreviewInfo,
});
exports.BulkUpdateSetPreview = BulkUpdateSetPreview;
const BulkUpdateChangeValue = (bulkUpdateValue) => ({
    type: exports.BULK_UPDATE_CHANGE_VALUE,
    bulkUpdateValue,
});
exports.BulkUpdateChangeValue = BulkUpdateChangeValue;
const CachedQueryAdd = (cachedQuery) => ({
    type: exports.CACHED_QUERY_ADD,
    cachedQuery,
});
exports.CachedQueryAdd = CachedQueryAdd;
const CellSummaryChangeOperation = (cellSummaryOperation) => ({
    type: exports.CELL_SUMMARY_CHANGE_OPERATION,
    cellSummaryOperation: cellSummaryOperation,
});
exports.CellSummaryChangeOperation = CellSummaryChangeOperation;
const LicenseShowWatermark = (text) => ({
    type: exports.LICENSE_SHOW_WATERMARK,
    text,
});
exports.LicenseShowWatermark = LicenseShowWatermark;
const LicenseDisablePersistence = () => ({
    type: exports.LICENSE_DISABLE_PERSISTENCE,
});
exports.LicenseDisablePersistence = LicenseDisablePersistence;
const DataChangeHistoryAdd = (changeInfo, uniqueKey) => ({
    type: exports.DATA_CHANGE_HISTORY_ADD,
    changeInfo,
    uniqueKey,
});
exports.DataChangeHistoryAdd = DataChangeHistoryAdd;
const DataChangeHistoryUndo = (changeInfo, uniqueKey) => ({
    type: exports.DATA_CHANGE_HISTORY_UNDO,
    changeInfo,
    uniqueKey,
});
exports.DataChangeHistoryUndo = DataChangeHistoryUndo;
const DataChangeHistoryClearRow = (changeInfo, uniqueKey) => ({
    type: exports.DATA_CHANGE_HISTORY_CLEAR_ROW,
    changeInfo,
    uniqueKey,
});
exports.DataChangeHistoryClearRow = DataChangeHistoryClearRow;
const DataChangeHistoryEnable = () => ({
    type: exports.DATA_CHANGE_HISTORY_ENABLE,
});
exports.DataChangeHistoryEnable = DataChangeHistoryEnable;
const DataChangeHistoryDisable = () => ({
    type: exports.DATA_CHANGE_HISTORY_DISABLE,
});
exports.DataChangeHistoryDisable = DataChangeHistoryDisable;
const DataChangeHistorySuspend = () => ({
    type: exports.DATA_CHANGE_HISTORY_SUSPEND,
});
exports.DataChangeHistorySuspend = DataChangeHistorySuspend;
const DataChangeHistoryResume = () => ({
    type: exports.DATA_CHANGE_HISTORY_RESUME,
});
exports.DataChangeHistoryResume = DataChangeHistoryResume;
const SettingsPanelSet = (name, settings) => ({
    type: exports.SETTINGS_PANEL_SET,
    name,
    settings,
});
exports.SettingsPanelSet = SettingsPanelSet;
const QuickFilterBarShow = () => ({
    type: exports.QUICK_FILTER_BAR_SHOW,
});
exports.QuickFilterBarShow = QuickFilterBarShow;
const QuickFilterBarHide = () => ({
    type: exports.QUICK_FILTER_BAR_HIDE,
});
exports.QuickFilterBarHide = QuickFilterBarHide;
const LayoutShowNonExtendedObjects = (showNonExtendedObjects) => ({
    type: exports.LAYOUT_SHOW_NON_EXTENDED_OBJECTS,
    showNonExtendedObjects: showNonExtendedObjects,
});
exports.LayoutShowNonExtendedObjects = LayoutShowNonExtendedObjects;
const DashboardRefresh = () => ({
    type: exports.DASHBOARD_REFRESH,
});
exports.DashboardRefresh = DashboardRefresh;
const DataSetSelect = (dataSet) => ({
    type: exports.DATA_SET_SELECT,
    dataSet: dataSet,
});
exports.DataSetSelect = DataSetSelect;
const ChartingSetCurrentChartModels = (chartModels) => ({
    type: exports.CHARTING_SET_CURRENT_CHART_MODELS,
    chartModels,
});
exports.ChartingSetCurrentChartModels = ChartingSetCurrentChartModels;
const ChartingCurrentChartModelsSelector = (state) => {
    return state.Charting.currentChartModels;
};
exports.ChartingCurrentChartModelsSelector = ChartingCurrentChartModelsSelector;
const DisableDeleteConfirmation = () => ({
    type: exports.DISABLE_DELETE_CONFIRMATION,
});
exports.DisableDeleteConfirmation = DisableDeleteConfirmation;
const SystemExportBegin = (reportName, reportFormat, exportDestination) => ({
    type: exports.SYSTEM_EXPORT_BEGIN,
    reportName,
    reportFormat,
    exportDestination,
});
exports.SystemExportBegin = SystemExportBegin;
const SystemExportEnd = () => ({
    type: exports.SYSTEM_EXPORT_END,
});
exports.SystemExportEnd = SystemExportEnd;
const QuickSearchFloatingVisibility = (visible) => ({
    type: exports.SET_QUICK_SEARCH_FLOATING_VISIBILITY,
    visible,
});
exports.QuickSearchFloatingVisibility = QuickSearchFloatingVisibility;
const CellPopupShow = (cellPosition, editMode) => ({
    type: exports.CELL_POPUP_SHOW,
    editMode,
    cellPosition,
});
exports.CellPopupShow = CellPopupShow;
const CellPopupEditFocusedEntity = (focusedEntity) => ({
    type: exports.CELL_POPUP_EDIT_FOCUSED_ENTITY,
    focusedEntity,
});
exports.CellPopupEditFocusedEntity = CellPopupEditFocusedEntity;
const RowSummarySet = (rowSummaries) => ({
    type: exports.SUMMARY_ROW_SET,
    rowSummaries: rowSummaries,
});
exports.RowSummarySet = RowSummarySet;
const CellPopupHide = () => ({
    type: exports.CELL_POPUP_HIDE,
});
exports.CellPopupHide = CellPopupHide;
const DisableDeleteConfirmationSelector = (state) => {
    return state.DisableDeleteConfirmation;
};
exports.DisableDeleteConfirmationSelector = DisableDeleteConfirmationSelector;
const QuickSearchFloatingVisibilitySelector = (state) => {
    return state?.QuickSearch?.floatingVisible;
};
exports.QuickSearchFloatingVisibilitySelector = QuickSearchFloatingVisibilitySelector;
const CommentsAndNotesSelector = (state) => {
    return state?.NotesAndComments?.popupPosition;
};
exports.CommentsAndNotesSelector = CommentsAndNotesSelector;
const CommentsAndNotesEditModeSelector = (state) => {
    return state?.NotesAndComments?.editMode;
};
exports.CommentsAndNotesEditModeSelector = CommentsAndNotesEditModeSelector;
const CommentsAndNotesFocusedEntitySelector = (state) => {
    return state?.NotesAndComments?.focusedEntity;
};
exports.CommentsAndNotesFocusedEntitySelector = CommentsAndNotesFocusedEntitySelector;
const DataImportCompleted = (dataImportedInfo) => ({
    type: exports.DATA_IMPORT_COMPLETED,
    dataImportedInfo: dataImportedInfo,
});
exports.DataImportCompleted = DataImportCompleted;
const initialState = {
    Columns: GeneralConstants_1.EMPTY_ARRAY,
    SelectedCellInfo: null,
    SelectedRowInfo: null,
    CellHighlightInfo: GeneralConstants_1.EMPTY_ARRAY,
    RowHighlightInfo: GeneralConstants_1.EMPTY_ARRAY,
    SettingsPanelModuleEntries: GeneralConstants_1.EMPTY_ARRAY,
    AdaptableAlerts: GeneralConstants_1.EMPTY_ARRAY,
    SystemStatusMessages: GeneralConstants_1.EMPTY_ARRAY,
    Dashboard: { DashboardModuleButtons: GeneralConstants_1.EMPTY_ARRAY, DashboardRevision: 1 },
    SmartEdit: {
        IsValidSmartEditSelection: false,
        SmartEditPreviewInfo: null,
        SmartEditValue: 1,
        SmartEditOperation: Enums_1.MathOperation.Multiply,
    },
    BulkUpdate: {
        BulkUpdateValidationResult: { IsValid: false, Column: null },
        BulkUpdatePreviewInfo: null,
        BulkUpdateValue: GeneralConstants_1.EMPTY_STRING,
    },
    CachedQueries: GeneralConstants_1.EMPTY_ARRAY,
    CellSummary: {
        CellSummaryOperation: ReduxConstants_1.CELL_SUMMARY_DEFAULT_OPERATION,
        CellSummaryInfo: null,
    },
    License: {
        watermark: { show: false, text: null },
        disablePersistence: false,
    },
    DataChangeHistory: {
        logs: {},
        currentMode: 'INACTIVE',
        enableTime: null,
        suspendTime: null,
    },
    SettingsPanel: {},
    IsQuickFilterVisible: true,
    CurrentDataSet: GeneralConstants_1.EMPTY_STRING,
    Charting: {
        currentChartModels: [],
        externalChartingDefinitions: [],
    },
    Layout: {
        showLayoutNonExtendedObjects: false,
    },
    DisableDeleteConfirmation: false,
    Export: {
        inProgress: null,
    },
};
const InternalReducer = (state = initialState, action) => {
    let alerts;
    let systemStatusMessages;
    switch (action.type) {
        case exports.SET_COLUMNS:
            return Object.assign({}, state, {
                Columns: [].concat(action.columns),
            });
        case exports.SET_SELECTED_CELLS:
            return Object.assign({}, state, {
                SelectedCellInfo: action.selectedCellInfo,
            });
        case exports.SET_SELECTED_ROWS:
            return Object.assign({}, state, {
                SelectedRowInfo: action.selectedRowInfo,
            });
        case exports.SET_SETTINGS_PANEL_ITEMS: {
            const actionTyped = action;
            const menuItems = actionTyped.menuItems.sort((a, b) => a.label < b.label ? -1 : a.label > b.label ? 1 : 0);
            return Object.assign({}, state, { SettingsPanelModuleEntries: menuItems });
        }
        case exports.SET_DASHBOARD_MODULE_BUTTONS: {
            const actionTyped = action;
            const menuItems = actionTyped.menuItems.sort((a, b) => a.label < b.label ? -1 : a.label > b.label ? 1 : 0);
            return {
                ...state,
                Dashboard: {
                    ...state.Dashboard,
                    DashboardModuleButtons: menuItems,
                },
            };
        }
        case exports.HIGHLIGHT_CELL_ADD: {
            const actionTypedAdd = action;
            return Object.assign({}, state, {
                CellHighlightInfo: [...state.CellHighlightInfo, actionTypedAdd.cellHighlightInfo],
            });
        }
        case exports.HIGHLIGHT_CELL_DELETE: {
            const actionTypedDelete = action;
            const actionId = `${actionTypedDelete.columnId}-${actionTypedDelete.primaryKeyValue}`;
            return Object.assign({}, state, {
                CellHighlightInfo: state.CellHighlightInfo.filter((celHighlightInfo) => {
                    const id = `${celHighlightInfo.columnId}-${celHighlightInfo.primaryKeyValue}`;
                    return id !== actionId;
                }),
            });
        }
        case exports.HIGHLIGHT_CELL_DELETE_ALL: {
            return Object.assign({}, state, {
                CellHighlightInfo: [],
            });
        }
        case exports.HIGHLIGHT_ROW_ADD: {
            const actionTypedAdd = action;
            return Object.assign({}, state, {
                RowHighlightInfo: [...state.RowHighlightInfo, actionTypedAdd.rowHighlightInfo],
            });
        }
        case exports.HIGHLIGHT_ROWS_ADD: {
            const actionTypedAdd = action;
            const rowHighlightInfos = actionTypedAdd.rowsHighlightInfo.primaryKeyValues.map((primaryKeyValue) => {
                return {
                    primaryKeyValue,
                    highlightStyle: actionTypedAdd.rowsHighlightInfo.highlightStyle,
                    timeout: actionTypedAdd.rowsHighlightInfo.timeout,
                };
            });
            return Object.assign({}, state, {
                RowHighlightInfo: [...state.RowHighlightInfo, ...rowHighlightInfos],
            });
        }
        case exports.HIGHLIGHT_ROW_DELETE: {
            const actionTypedDelete = action;
            const actionId = actionTypedDelete.primaryKeyValue;
            return Object.assign({}, state, {
                RowHighlightInfo: state.RowHighlightInfo.filter((rowHighlightInfo) => {
                    return rowHighlightInfo.primaryKeyValue !== actionId;
                }),
            });
        }
        case exports.HIGHLIGHT_ROWS_DELETE: {
            const actionTypedDelete = action;
            return Object.assign({}, state, {
                RowHighlightInfo: state.RowHighlightInfo.filter((rowHighlightInfo) => {
                    return !actionTypedDelete.primaryKeyValues.includes(rowHighlightInfo.primaryKeyValue);
                }),
            });
        }
        case exports.HIGHLIGHT_ROW_DELETE_ALL: {
            return Object.assign({}, state, {
                RowHighlightInfo: [],
            });
        }
        case exports.ALERT_ADD: {
            const actionTypedAdd = action;
            alerts = [].concat(state.AdaptableAlerts);
            if (alerts.length == actionTypedAdd.maxAlerts) {
                // we have hit the maximum so remove first item (oldest)
                alerts.splice(0, 1);
            }
            alerts.push(actionTypedAdd.alert);
            return Object.assign({}, state, { AdaptableAlerts: alerts });
        }
        case exports.ALERT_DELETE: {
            const adaptableAlert = action.alert;
            return {
                ...state,
                AdaptableAlerts: state.AdaptableAlerts.filter((abObject) => abObject.Uuid !== adaptableAlert.Uuid),
            };
        }
        case exports.ALERT_DELETE_ALL: {
            return Object.assign({}, state, { AdaptableAlerts: [] });
        }
        case exports.ALERT_REMOVE_CELL_HIGHLIGHT: {
            const adaptableAlert = action
                .alert;
            return {
                ...state,
                AdaptableAlerts: state.AdaptableAlerts.map((abObject) => {
                    if (abObject.Uuid === adaptableAlert.Uuid) {
                        // AdaptableAlerts are still linked to the live AlertDefinitions, so we have to decouple them
                        const newAbObject = {
                            ...abObject,
                        };
                        newAbObject.alertDefinition = (0, Helper_1.cloneObject)(abObject.alertDefinition);
                        delete newAbObject.alertDefinition.AlertProperties.HighlightCell;
                        return newAbObject;
                    }
                    return abObject;
                }),
            };
        }
        case exports.ALERT_REMOVE_ROW_HIGHLIGHT: {
            const adaptableAlert = action
                .alert;
            return {
                ...state,
                AdaptableAlerts: state.AdaptableAlerts.map((abObject) => {
                    if (abObject.Uuid === adaptableAlert.Uuid) {
                        // AdaptableAlerts are still linked to the live AlertDefinitions, so we have to decouple them
                        const newAbObject = {
                            ...abObject,
                        };
                        newAbObject.alertDefinition = (0, Helper_1.cloneObject)(abObject.alertDefinition);
                        delete newAbObject.alertDefinition.AlertProperties.HighlightRow;
                        return newAbObject;
                    }
                    return abObject;
                }),
            };
        }
        case exports.SYSTEM_STATUS_MESSAGE_INFO_ADD: {
            const actionTypedAdd = action;
            systemStatusMessages = [].concat(state.SystemStatusMessages);
            if (systemStatusMessages.length == actionTypedAdd.maxSystemStatusMessagesInStore) {
                // we have hit the maximum so remove first item (oldest)
                systemStatusMessages.splice(0, 1);
            }
            systemStatusMessages.push(actionTypedAdd.systemStatusMessageInfo);
            return Object.assign({}, state, {
                SystemStatusMessages: systemStatusMessages,
            });
        }
        case exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL: {
            return Object.assign({}, state, { SystemStatusMessages: [] });
        }
        case exports.SMART_EDIT_CHANGE_VALUE:
            return {
                ...state,
                SmartEdit: {
                    ...state.SmartEdit,
                    SmartEditValue: action.value,
                },
            };
        case exports.SMART_EDIT_CHANGE_OPERATION:
            return {
                ...state,
                SmartEdit: {
                    ...state.SmartEdit,
                    SmartEditOperation: action.smartEditOperation,
                },
            };
        case exports.SMARTEDIT_SET_VALID_SELECTION:
            return {
                ...state,
                SmartEdit: {
                    ...state.SmartEdit,
                    IsValidSmartEditSelection: action
                        .isValidSmartEditSelection,
                },
            };
        case exports.SMARTEDIT_SET_PREVIEW:
            return {
                ...state,
                SmartEdit: {
                    ...state.SmartEdit,
                    SmartEditPreviewInfo: action.smartEditPreviewInfo,
                },
            };
        case exports.BULK_UPDATE_SET_VALID_SELECTION:
            return {
                ...state,
                BulkUpdate: {
                    ...state.BulkUpdate,
                    BulkUpdateValidationResult: action
                        .bulkUpdateValidationResult,
                },
            };
        case exports.BULK_UPDATE_SET_PREVIEW:
            return {
                ...state,
                BulkUpdate: {
                    ...state.BulkUpdate,
                    BulkUpdatePreviewInfo: action.bulkUpdatePreviewInfo,
                },
            };
        case exports.BULK_UPDATE_CHANGE_VALUE:
            return {
                ...state,
                BulkUpdate: {
                    ...state.BulkUpdate,
                    BulkUpdateValue: action.bulkUpdateValue,
                },
            };
        case exports.CACHED_QUERY_ADD: {
            const actionTypedAdd = action;
            let cachedQueries = [].concat(state.CachedQueries);
            let queryToAdd = actionTypedAdd.cachedQuery;
            if (queryToAdd) {
                if (cachedQueries.length == 5) {
                    // we have hit the maximum so remove first item (oldest)
                    cachedQueries.splice(0, 1);
                }
                cachedQueries.push(actionTypedAdd.cachedQuery);
            }
            return Object.assign({}, state, { CachedQueries: cachedQueries });
        }
        case exports.SET_CELL_SUMMARY_INFO:
            return {
                ...state,
                CellSummary: {
                    ...state.CellSummary,
                    CellSummaryInfo: action.cellSummaryInfo,
                },
            };
        case exports.CELL_SUMMARY_CHANGE_OPERATION:
            return {
                ...state,
                CellSummary: {
                    ...state.CellSummary,
                    CellSummaryOperation: action.cellSummaryOperation,
                },
            };
        case exports.LICENSE_SHOW_WATERMARK: {
            return {
                ...state,
                License: {
                    ...state.License,
                    watermark: {
                        show: true,
                        text: action.text,
                    },
                },
            };
        }
        case exports.LICENSE_DISABLE_PERSISTENCE: {
            return {
                ...state,
                License: {
                    ...state.License,
                    disablePersistence: true,
                },
            };
        }
        case exports.DATA_CHANGE_HISTORY_ADD: {
            const actionTypedAdd = action;
            const cellDataChangedInfo = actionTypedAdd.changeInfo;
            const uniqueKey = actionTypedAdd.uniqueKey;
            const updatedDataChangeHistoryLogs = { ...state.DataChangeHistory.logs };
            updatedDataChangeHistoryLogs[uniqueKey] = cellDataChangedInfo;
            return {
                ...state,
                DataChangeHistory: {
                    ...state.DataChangeHistory,
                    logs: updatedDataChangeHistoryLogs,
                },
            };
        }
        case exports.DATA_CHANGE_HISTORY_UNDO: {
            const actionTypedUndo = action;
            const cellDataChangedInfo = actionTypedUndo.changeInfo;
            const uniqueKey = actionTypedUndo.uniqueKey;
            const updatedDataChangeHistoryLogs = { ...state.DataChangeHistory.logs };
            delete updatedDataChangeHistoryLogs[uniqueKey];
            return {
                ...state,
                DataChangeHistory: {
                    ...state.DataChangeHistory,
                    logs: updatedDataChangeHistoryLogs,
                },
            };
        }
        case exports.DATA_CHANGE_HISTORY_CLEAR_ROW: {
            const actionTypedClearRow = action;
            const cellDataChangedInfo = actionTypedClearRow.changeInfo;
            const uniqueKey = actionTypedClearRow.uniqueKey;
            const updatedDataChangeHistoryLogs = { ...state.DataChangeHistory.logs };
            delete updatedDataChangeHistoryLogs[uniqueKey];
            return {
                ...state,
                DataChangeHistory: {
                    ...state.DataChangeHistory,
                    logs: updatedDataChangeHistoryLogs,
                },
            };
        }
        case exports.DATA_CHANGE_HISTORY_ENABLE: {
            return {
                ...state,
                DataChangeHistory: {
                    ...state.DataChangeHistory,
                    currentMode: 'ACTIVE',
                    enableTime: new Date(),
                    suspendTime: null,
                },
            };
        }
        case exports.DATA_CHANGE_HISTORY_DISABLE: {
            return {
                ...state,
                DataChangeHistory: {
                    ...state.DataChangeHistory,
                    logs: {},
                    currentMode: 'INACTIVE',
                    enableTime: null,
                    suspendTime: null,
                },
            };
        }
        case exports.DATA_CHANGE_HISTORY_SUSPEND: {
            return {
                ...state,
                DataChangeHistory: {
                    ...state.DataChangeHistory,
                    currentMode: 'SUSPENDED',
                    suspendTime: new Date(),
                },
            };
        }
        case exports.DATA_CHANGE_HISTORY_RESUME: {
            return {
                ...state,
                DataChangeHistory: {
                    ...state.DataChangeHistory,
                    currentMode: 'ACTIVE',
                    suspendTime: null,
                },
            };
        }
        case exports.SETTINGS_PANEL_SET: {
            const setSettingsAction = action;
            return {
                ...state,
                SettingsPanel: {
                    ...state?.SettingsPanel,
                    [setSettingsAction.name]: setSettingsAction.settings,
                },
            };
        }
        case exports.QUICK_FILTER_BAR_SHOW:
            return Object.assign({}, state, { IsQuickFilterVisible: true });
        case exports.QUICK_FILTER_BAR_HIDE:
            return Object.assign({}, state, { IsQuickFilterVisible: false });
        case exports.LAYOUT_SHOW_NON_EXTENDED_OBJECTS: {
            const typedAction = action;
            return {
                ...state,
                Layout: {
                    showLayoutNonExtendedObjects: typedAction.showNonExtendedObjects,
                },
            };
        }
        case exports.DATA_SET_SELECT:
            return Object.assign({}, state, {
                CurrentDataSet: action.dataSet.name,
            });
        case exports.DASHBOARD_REFRESH: {
            return {
                ...state,
                Dashboard: {
                    ...state.Dashboard,
                    DashboardRevision: state.Dashboard.DashboardRevision + 1,
                },
            };
        }
        case exports.CHARTING_SET_CURRENT_CHART_MODELS: {
            const typedAction = action;
            return {
                ...state,
                Charting: {
                    ...state.Charting,
                    currentChartModels: typedAction.chartModels,
                },
            };
        }
        case exports.DISABLE_DELETE_CONFIRMATION: {
            return {
                ...state,
                DisableDeleteConfirmation: true,
            };
        }
        case exports.SYSTEM_EXPORT_BEGIN: {
            const typedAction = action;
            return {
                ...state,
                Export: {
                    inProgress: {
                        reportName: typedAction.reportName,
                        reportFormat: typedAction.reportFormat,
                        exportDestination: typedAction.exportDestination,
                    },
                },
            };
        }
        case exports.SYSTEM_EXPORT_END: {
            return {
                ...state,
                Export: {
                    inProgress: null,
                },
            };
        }
        case exports.SET_QUICK_SEARCH_FLOATING_VISIBILITY: {
            const typedAction = action;
            return {
                ...state,
                QuickSearch: {
                    ...state.QuickSearch,
                    floatingVisible: typedAction.visible,
                },
            };
        }
        case exports.CELL_POPUP_SHOW: {
            const typedAction = action;
            // reuse address reference if we are editing the same cell
            let newAddress = typedAction?.cellPosition;
            const oldAddress = state?.NotesAndComments?.popupPosition;
            if (AnnotationsService_1.AnnotationsService.isSameAddress(oldAddress, typedAction.cellPosition)) {
                newAddress = oldAddress;
                // if edit mode is the same, just exist
                if (typedAction.editMode === state.NotesAndComments.editMode) {
                    return state;
                }
            }
            return {
                ...state,
                NotesAndComments: {
                    ...state.NotesAndComments,
                    editMode: typedAction.editMode,
                    popupPosition: newAddress,
                },
            };
        }
        case exports.CELL_POPUP_EDIT_FOCUSED_ENTITY: {
            const typedAction = action;
            return {
                ...state,
                NotesAndComments: {
                    ...state.NotesAndComments,
                    focusedEntity: typedAction.focusedEntity,
                },
            };
        }
        case exports.CELL_POPUP_HIDE: {
            return {
                ...state,
                NotesAndComments: {
                    editMode: false,
                    popupPosition: null,
                },
            };
        }
        case exports.SUMMARY_ROW_SET: {
            const typedAction = action;
            return {
                ...state,
                RowSummary: {
                    rowSummaries: typedAction.rowSummaries,
                },
            };
        }
        default:
            return state;
    }
};
exports.InternalReducer = InternalReducer;
