<commit_before>(function () {
    'use strict';

    angular
        .module('atlas')
        .component('dpDashboard', {
            templateUrl: 'modules/atlas/components/dashboard/dashboard.html',
            controller: DpDashboardController,
            controllerAs: 'vm'
        });

    DpDashboardController.$inject = ['$scope', '$timeout', 'store', 'ACTIONS', 'dashboardColumns', 'HEADER'];

    function DpDashboardController ($scope, $timeout, store, ACTIONS, dashboardColumns, HEADER) {
        const vm = this;

        vm.store = store;

        store.subscribe(setLayout);
        setLayout();

        $scope.$watch(() => dashboardColumns.determineVisibility(store.getState()).httpStatus, setLayout);
        $scope.$watchGroup(['vm.isStraatbeeldActive', 'vm.straatbeeldHistory'], () => {
            if (vm.isStraatbeeldActive) {
                store.dispatch({ type: ACTIONS.MAP_ADD_PANO_OVERLAY });
            } else {
                $timeout(() => store.dispatch({ type: ACTIONS.MAP_REMOVE_PANO_OVERLAY }));
            }
        });

        $scope.$watchGroup(['vm.isEmbed', 'vm.isEmbedPreview'], () => {
            if (vm.store.getState().map.overlays.length) {
                return;
            }
            store.dispatch({ type: 'HIDE_MAP_PANEL' });
        });

        // (Re)render React `MapPanel` app when map is visible
        $scope.$watch('vm.visibility.map', (newValue, oldValue) => {
            if (vm.visibility.map && !vm.visibility.dataSelection && !vm.activity.detail && !vm.isStraatbeeldActive) {
                store.dispatch({ type: 'SHOW_MAP_PANEL' });
            }
            if (!vm.visibility.map || vm.visibility.dataSelection || vm.visibility.searchResults) {
                store.dispatch({ type: 'HIDE_MAP_PANEL' });
            }
        });

        $scope.$watchGroup(['vm.activity.searchResults', 'vm.isMapFullscreen'], () => {
            if (vm.activity.searchResults && vm.isMapFullscreen) {
                store.dispatch({ type: 'OPEN_MAP_PREVIEW_PANEL' });
            } else {
                store.dispatch({ type: 'CLOSE_MAP_PREVIEW_PANEL' });
            }
        });

        function setLayout () {
            const state = store.getState();

            vm.user = state.user;

            vm.activity = dashboardColumns.determineActivity(state);
            vm.visibility = dashboardColumns.determineVisibility(state);

            vm.hasMaxWidth = vm.visibility.page;
            vm.isHomePage = vm.visibility.page && state.page && state.page.name === 'home';
            vm.headerSize = vm.isHomePage ? HEADER.SIZE.TALL : HEADER.SIZE.SHORT;
            vm.pageType = state.page && state.page.type ? state.page.type : '';

            vm.isPrintMode = state.atlas.isPrintMode;
            vm.isEmbedPreview = state.atlas.isEmbedPreview;
            vm.isEmbed = state.atlas.isEmbed;
            vm.isPrintOrEmbedOrPreview = dashboardColumns.isPrintOrEmbedOrPreview(state);

            vm.dataSelectionState = state.dataSelection;

            vm.isRightColumnScrollable =
                vm.visibility.page ||
                vm.visibility.detail ||
                vm.visibility.searchResults ||
                vm.visibility.dataSelection;

            vm.columnSizes = dashboardColumns.determineColumnSizes(state);

            vm.isFullHeight = !vm.isRightColumnScrollable || vm.columnSizes.right < 12;

            vm.isMapFullscreen = Boolean(vm.visibility.map && state.map.isFullscreen);
            vm.isStraatbeeldActive = Boolean(state.straatbeeld);
            vm.straatbeeldHistory = vm.isStraatbeeldActive ? state.straatbeeld.history : null;
        }
    }
})();<commit_msg>Opening preview panel when it should be<commit_after>(function () {
    'use strict';

    angular
        .module('atlas')
        .component('dpDashboard', {
            templateUrl: 'modules/atlas/components/dashboard/dashboard.html',
            controller: DpDashboardController,
            controllerAs: 'vm'
        });

    DpDashboardController.$inject = ['$scope', '$timeout', 'store', 'ACTIONS', 'dashboardColumns', 'HEADER'];

    function DpDashboardController ($scope, $timeout, store, ACTIONS, dashboardColumns, HEADER) {
        const vm = this;

        vm.store = store;

        store.subscribe(setLayout);
        setLayout();

        $scope.$watch(() => dashboardColumns.determineVisibility(store.getState()).httpStatus, setLayout);
        $scope.$watchGroup(['vm.isStraatbeeldActive', 'vm.straatbeeldHistory'], () => {
            if (vm.isStraatbeeldActive) {
                store.dispatch({ type: ACTIONS.MAP_ADD_PANO_OVERLAY });
            } else {
                $timeout(() => store.dispatch({ type: ACTIONS.MAP_REMOVE_PANO_OVERLAY }));
            }
        });

        $scope.$watchGroup(['vm.isEmbed', 'vm.isEmbedPreview'], () => {
            if (vm.store.getState().map.overlays.length) {
                return;
            }
            store.dispatch({ type: 'HIDE_MAP_PANEL' });
        });

        // (Re)render React `MapPanel` app when map is visible
        $scope.$watch('vm.visibility.map', (newValue, oldValue) => {
            if (vm.visibility.map && !vm.visibility.dataSelection && !vm.activity.detail && !vm.isStraatbeeldActive) {
                store.dispatch({ type: 'SHOW_MAP_PANEL' });
            }
            if (!vm.visibility.map || vm.visibility.dataSelection || vm.visibility.searchResults) {
                store.dispatch({ type: 'HIDE_MAP_PANEL' });
            }
        });

        $scope.$watchGroup(['vm.searchLocation', 'vm.isMapFullscreen'], () => {
            if (vm.searchLocation && vm.isMapFullscreen) {
                store.dispatch({ type: 'OPEN_MAP_PREVIEW_PANEL' });
            } else {
                store.dispatch({ type: 'CLOSE_MAP_PREVIEW_PANEL' });
            }
        });

        function setLayout () { // eslint-disable-line complexity
            const state = store.getState();

            vm.user = state.user;

            vm.activity = dashboardColumns.determineActivity(state);
            vm.visibility = dashboardColumns.determineVisibility(state);

            vm.hasMaxWidth = vm.visibility.page;
            vm.isHomePage = vm.visibility.page && state.page && state.page.name === 'home';
            vm.headerSize = vm.isHomePage ? HEADER.SIZE.TALL : HEADER.SIZE.SHORT;
            vm.pageType = state.page && state.page.type ? state.page.type : '';

            vm.isPrintMode = state.atlas.isPrintMode;
            vm.isEmbedPreview = state.atlas.isEmbedPreview;
            vm.isEmbed = state.atlas.isEmbed;
            vm.isPrintOrEmbedOrPreview = dashboardColumns.isPrintOrEmbedOrPreview(state);

            vm.dataSelectionState = state.dataSelection;

            vm.isRightColumnScrollable =
                vm.visibility.page ||
                vm.visibility.detail ||
                vm.visibility.searchResults ||
                vm.visibility.dataSelection;

            vm.columnSizes = dashboardColumns.determineColumnSizes(state);

            vm.isFullHeight = !vm.isRightColumnScrollable || vm.columnSizes.right < 12;

            vm.isMapFullscreen = Boolean(vm.visibility.map && state.map.isFullscreen);
            vm.isStraatbeeldActive = Boolean(state.straatbeeld);
            vm.straatbeeldHistory = vm.isStraatbeeldActive ? state.straatbeeld.history : null;
            vm.searchLocation = vm.activity.searchResults
                ? state.search.location.reduce((acc, coordinate) => acc + coordinate, '')
                : null;
        }
    }
})();
{'fraction_non_alphanumeric': 0.13180856689582232, 'fraction_numerical': 0.0005288207297726071, 'mean_word_length': 2.163948138854036, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2139392', 'n_tokens_mistral': 2223, 'n_tokens_neox': 2106, 'n_words': 317}