
import { registerCss } from '../../../../../../../css.js';
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
import * as activitybarpart from './media/activitybarpart.css';
import * as activityaction from './media/activityaction.css';
import { localize, localize2 } from '../../../../nls.js';
import { ActionsOrientation } from '../../../../base/browser/ui/actionbar/actionbar.js';
import { Part } from '../../part.js';
import { Parts, LayoutSettings, Position, ActivityBarPosition } from '../../../services/layout/browser/layoutService.js';
import { IWorkbenchLayoutService } from '../../../services/layout/browser/layoutService.service.js';
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
import { MutableDisposable, DisposableStore } from '../../../../base/common/lifecycle.js';
import { ToggleSidebarPositionAction, ToggleSidebarVisibilityAction } from '../../actions/layoutActions.js';
import { registerThemingParticipant } from '../../../../platform/theme/common/themeService.js';
import { IThemeService } from '../../../../platform/theme/common/themeService.service.js';
import { ACTIVITY_BAR_DRAG_AND_DROP_BORDER, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_INACTIVE_FOREGROUND, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_ACTIVE_FOCUS_BORDER } from '../../../common/theme.js';
import '../../../../platform/theme/common/colorUtils.js';
import { contrastBorder, activeContrastBorder, focusBorder } from '../../../../platform/theme/common/colors/baseColors.js';
import '../../../../platform/theme/common/colors/chartsColors.js';
import '../../../../platform/theme/common/colors/editorColors.js';
import '../../../../platform/theme/common/colors/inputColors.js';
import '../../../../platform/theme/common/colors/listColors.js';
import '../../../../platform/theme/common/colors/menuColors.js';
import '../../../../platform/theme/common/colors/minimapColors.js';
import '../../../../platform/theme/common/colors/miscColors.js';
import '../../../../platform/theme/common/colors/quickpickColors.js';
import '../../../../platform/theme/common/colors/searchColors.js';
import { clearNode, append, $, isAncestor, addDisposableListener, EventType } from '../../../../base/browser/dom.js';
import { assertReturnsDefined } from '../../../../base/common/types.js';
import { CustomMenubarControl } from '../titlebar/menubarControl.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.service.js';
import { MenuSettings, getMenuBarVisibility } from '../../../../platform/window/common/window.js';
import { Separator, toAction, SubmenuAction } from '../../../../base/common/actions.js';
import { StandardKeyboardEvent } from '../../../../base/browser/keyboardEvent.js';
import { KeyCode } from '../../../../base/common/keyCodes.js';
import { HoverPosition } from '../../../../base/browser/ui/hover/hoverWidget.js';
import { PaneCompositeBar } from '../paneCompositeBar.js';
import { GlobalCompositeBar } from '../globalCompositeBar.js';
import { IStorageService } from '../../../../platform/storage/common/storage.service.js';
import { MenuId, registerAction2, Action2, MenuRegistry } from '../../../../platform/actions/common/actions.js';
import { IMenuService } from '../../../../platform/actions/common/actions.service.js';
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.service.js';
import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
import { getContextMenuActions } from '../../../../platform/actions/browser/menuEntryActionViewItem.js';
import { ViewContainerLocationToString, ViewContainerLocation } from '../../../common/views.js';
import { IViewDescriptorService } from '../../../common/views.service.js';
import { IExtensionService } from '../../../services/extensions/common/extensions.service.js';
import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.service.js';
import { IViewsService } from '../../../services/views/common/viewsService.service.js';
import { SwitchCompositeViewAction } from '../compositeBarActions.js';

var ActivitybarPart_1;
registerCss(activitybarpart);
registerCss(activityaction);
let ActivitybarPart = class ActivitybarPart extends Part {
    static {
        ActivitybarPart_1 = this;
    }
    static {
        this.ACTION_HEIGHT = 48;
    }
    static {
        this.COMPACT_ACTION_HEIGHT = 32;
    }
    static {
        this.ACTIVITYBAR_WIDTH = 48;
    }
    static {
        this.COMPACT_ACTIVITYBAR_WIDTH = 36;
    }
    static {
        this.ICON_SIZE = 24;
    }
    static {
        this.COMPACT_ICON_SIZE = 16;
    }
    static {
        this.pinnedViewContainersKey = "workbench.activity.pinnedViewlets2";
    }
    static {
        this.placeholderViewContainersKey = "workbench.activity.placeholderViewlets";
    }
    static {
        this.viewContainersWorkspaceStateKey = "workbench.activity.viewletsWorkspaceState";
    }
    get minimumWidth() {
        return this._isCompact ? ActivitybarPart_1.COMPACT_ACTIVITYBAR_WIDTH : ActivitybarPart_1.ACTIVITYBAR_WIDTH;
    }
    get maximumWidth() {
        return this._isCompact ? ActivitybarPart_1.COMPACT_ACTIVITYBAR_WIDTH : ActivitybarPart_1.ACTIVITYBAR_WIDTH;
    }
    constructor(
        location,
        paneCompositePart,
        instantiationService,
        layoutService,
        themeService,
        storageService,
        configurationService
    ) {
        super(Parts.ACTIVITYBAR_PART, {
            hasTitle: false
        }, themeService, storageService, layoutService);
        this.location = location;
        this.paneCompositePart = paneCompositePart;
        this.instantiationService = instantiationService;
        this.configurationService = configurationService;
        this.minimumHeight = 0;
        this.maximumHeight = Number.POSITIVE_INFINITY;
        this.compositeBar = this._register(( new MutableDisposable()));
        this._isCompact = this.configurationService.getValue(LayoutSettings.ACTIVITY_BAR_COMPACT) ?? false;
        this._register(this.configurationService.onDidChangeConfiguration(e => {
            if (e.affectsConfiguration(LayoutSettings.ACTIVITY_BAR_COMPACT)) {
                this._isCompact = this.configurationService.getValue(LayoutSettings.ACTIVITY_BAR_COMPACT) ?? false;
                this.updateCompactStyle();
                this.recreateCompositeBar();
                this._onDidChange.fire(undefined);
            }
        }));
    }
    updateCompactStyle() {
        if (this.element) {
            this.element.classList.toggle("compact", this._isCompact);
            this.element.style.setProperty("--activity-bar-width", `${this.minimumWidth}px`);
            this.element.style.setProperty(
                "--activity-bar-action-height",
                `${this._isCompact ? ActivitybarPart_1.COMPACT_ACTION_HEIGHT : ActivitybarPart_1.ACTION_HEIGHT}px`
            );
            this.element.style.setProperty(
                "--activity-bar-icon-size",
                `${this._isCompact ? ActivitybarPart_1.COMPACT_ICON_SIZE : ActivitybarPart_1.ICON_SIZE}px`
            );
        }
    }
    recreateCompositeBar() {
        if (!this.content || !this.compositeBar.value) {
            return;
        }
        this.compositeBar.clear();
        clearNode(this.content);
        this.compositeBar.value = this.createCompositeBar();
        this.compositeBar.value.create(this.content);
        if (this.dimension) {
            this.layout(this.dimension.width, this.dimension.height);
        }
    }
    createCompositeBar() {
        const actionHeight = this._isCompact ? ActivitybarPart_1.COMPACT_ACTION_HEIGHT : ActivitybarPart_1.ACTION_HEIGHT;
        const iconSize = this._isCompact ? ActivitybarPart_1.COMPACT_ICON_SIZE : ActivitybarPart_1.ICON_SIZE;
        return this.instantiationService.createInstance(ActivityBarCompositeBar, this.location, {
            partContainerClass: "activitybar",
            pinnedViewContainersKey: ActivitybarPart_1.pinnedViewContainersKey,
            placeholderViewContainersKey: ActivitybarPart_1.placeholderViewContainersKey,
            viewContainersWorkspaceStateKey: ActivitybarPart_1.viewContainersWorkspaceStateKey,
            orientation: ActionsOrientation.VERTICAL,
            icon: true,
            iconSize,
            activityHoverOptions: {
                position: () => this.layoutService.getSideBarPosition() === Position.LEFT ? HoverPosition.RIGHT : HoverPosition.LEFT
            },
            preventLoopNavigation: true,
            recomputeSizes: false,
            fillExtraContextMenuActions: (actions, e) => {},
            compositeSize: 52,
            colors: theme => ({
                activeForegroundColor: theme.getColor(ACTIVITY_BAR_FOREGROUND),
                inactiveForegroundColor: theme.getColor(ACTIVITY_BAR_INACTIVE_FOREGROUND),
                activeBorderColor: theme.getColor(ACTIVITY_BAR_ACTIVE_BORDER),
                activeBackground: theme.getColor(ACTIVITY_BAR_ACTIVE_BACKGROUND),
                badgeBackground: theme.getColor(ACTIVITY_BAR_BADGE_BACKGROUND),
                badgeForeground: theme.getColor(ACTIVITY_BAR_BADGE_FOREGROUND),
                dragAndDropBorder: theme.getColor(ACTIVITY_BAR_DRAG_AND_DROP_BORDER),
                activeBackgroundColor: undefined,
                inactiveBackgroundColor: undefined,
                activeBorderBottomColor: undefined
            }),
            overflowActionSize: actionHeight
        }, Parts.ACTIVITYBAR_PART, this.paneCompositePart, true);
    }
    createContentArea(parent) {
        this.element = parent;
        this.content = append(this.element, $(".content"));
        this.updateCompactStyle();
        if (this.layoutService.isVisible(Parts.ACTIVITYBAR_PART)) {
            this.show();
        }
        return this.content;
    }
    getPinnedPaneCompositeIds() {
        return this.compositeBar.value?.getPinnedPaneCompositeIds() ?? [];
    }
    getVisiblePaneCompositeIds() {
        return this.compositeBar.value?.getVisiblePaneCompositeIds() ?? [];
    }
    getPaneCompositeIds() {
        return this.compositeBar.value?.getPaneCompositeIds() ?? [];
    }
    focus() {
        this.compositeBar.value?.focus();
    }
    updateStyles() {
        super.updateStyles();
        const container = assertReturnsDefined(this.getContainer());
        const background = this.getColor(ACTIVITY_BAR_BACKGROUND) || "";
        container.style.backgroundColor = background;
        const borderColor = this.getColor(ACTIVITY_BAR_BORDER) || this.getColor(contrastBorder) || "";
        container.classList.toggle("bordered", !!borderColor);
        container.style.borderColor = borderColor ? borderColor : "";
    }
    show(focus) {
        if (!this.content) {
            return;
        }
        if (!this.compositeBar.value) {
            this.compositeBar.value = this.createCompositeBar();
            this.compositeBar.value.create(this.content);
            if (this.dimension) {
                this.layout(this.dimension.width, this.dimension.height);
            }
        }
        if (focus) {
            this.focus();
        }
    }
    hide() {
        if (!this.compositeBar.value) {
            return;
        }
        this.compositeBar.clear();
        if (this.content) {
            clearNode(this.content);
        }
    }
    layout(width, height) {
        super.layout(width, height, 0, 0);
        if (!this.compositeBar.value) {
            return;
        }
        const contentAreaSize = super.layoutContents(width, height).contentSize;
        this.compositeBar.value.layout(width, contentAreaSize.height);
    }
    toJSON() {
        return {
            type: Parts.ACTIVITYBAR_PART
        };
    }
};
ActivitybarPart = ActivitybarPart_1 = ( __decorate([( __param(2, IInstantiationService)), ( __param(3, IWorkbenchLayoutService)), ( __param(4, IThemeService)), ( __param(5, IStorageService)), ( __param(6, IConfigurationService))], ActivitybarPart));
let ActivityBarCompositeBar = class ActivityBarCompositeBar extends PaneCompositeBar {
    constructor(
        location,
        options,
        part,
        paneCompositePart,
        showGlobalActivities,
        instantiationService,
        storageService,
        extensionService,
        viewDescriptorService,
        viewService,
        contextKeyService,
        environmentService,
        configurationService,
        menuService,
        layoutService
    ) {
        super(location, {
            ...options,
            fillExtraContextMenuActions: (actions, e) => {
                options.fillExtraContextMenuActions(actions, e);
                this.fillContextMenuActions(actions, e);
            }
        }, part, paneCompositePart, instantiationService, storageService, extensionService, viewDescriptorService, viewService, contextKeyService, environmentService, layoutService);
        this.configurationService = configurationService;
        this.menuService = menuService;
        this.menuBar = this._register(( new MutableDisposable()));
        this.keyboardNavigationDisposables = this._register(( new DisposableStore()));
        if (showGlobalActivities) {
            this.globalCompositeBar = this._register(instantiationService.createInstance(
                GlobalCompositeBar,
                () => this.getContextMenuActions(),
                theme => this.options.colors(theme),
                this.options.activityHoverOptions
            ));
        }
        this._register(this.configurationService.onDidChangeConfiguration(e => {
            if (e.affectsConfiguration(MenuSettings.MenuBarVisibility)) {
                if (getMenuBarVisibility(this.configurationService) === "compact") {
                    this.installMenubar();
                } else {
                    this.uninstallMenubar();
                }
            }
        }));
    }
    fillContextMenuActions(actions, e) {
        const menuBarVisibility = getMenuBarVisibility(this.configurationService);
        if (menuBarVisibility === "compact" || menuBarVisibility === "hidden" || menuBarVisibility === "toggle") {
            actions.unshift(...[toAction({
                id: "toggleMenuVisibility",
                label: ( localize(3041, "Menu")),
                checked: menuBarVisibility === "compact",
                run: () => this.configurationService.updateValue(
                    MenuSettings.MenuBarVisibility,
                    menuBarVisibility === "compact" ? "toggle" : "compact"
                )
            }), ( new Separator())]);
        }
        if (menuBarVisibility === "compact" && this.menuBarContainer && e?.target) {
            if (isAncestor(e.target, this.menuBarContainer)) {
                actions.unshift(...[toAction({
                    id: "hideCompactMenu",
                    label: ( localize(3042, "Hide Menu")),
                    run: () => this.configurationService.updateValue(MenuSettings.MenuBarVisibility, "toggle")
                }), ( new Separator())]);
            }
        }
        if (this.globalCompositeBar) {
            actions.push(( new Separator()));
            actions.push(...this.globalCompositeBar.getContextMenuActions());
        }
        actions.push(( new Separator()));
        actions.push(...this.getActivityBarContextMenuActions());
    }
    uninstallMenubar() {
        if (this.menuBar.value) {
            this.menuBar.value = undefined;
        }
        if (this.menuBarContainer) {
            this.menuBarContainer.remove();
            this.menuBarContainer = undefined;
        }
    }
    installMenubar() {
        if (this.menuBar.value) {
            return;
        }
        this.menuBarContainer = $(".menubar");
        const content = assertReturnsDefined(this.element);
        content.prepend(this.menuBarContainer);
        this.menuBar.value = this._register(this.instantiationService.createInstance(CustomMenubarControl));
        this.menuBar.value.create(this.menuBarContainer);
    }
    registerKeyboardNavigationListeners() {
        this.keyboardNavigationDisposables.clear();
        if (this.menuBarContainer) {
            this.keyboardNavigationDisposables.add(addDisposableListener(this.menuBarContainer, EventType.KEY_DOWN, e => {
                const kbEvent = ( new StandardKeyboardEvent(e));
                if (kbEvent.equals(KeyCode.DownArrow) || kbEvent.equals(KeyCode.RightArrow)) {
                    this.focus();
                }
            }));
        }
        if (this.compositeBarContainer) {
            this.keyboardNavigationDisposables.add(
                addDisposableListener(this.compositeBarContainer, EventType.KEY_DOWN, e => {
                    const kbEvent = ( new StandardKeyboardEvent(e));
                    if (kbEvent.equals(KeyCode.DownArrow) || kbEvent.equals(KeyCode.RightArrow)) {
                        this.globalCompositeBar?.focus();
                    } else if (kbEvent.equals(KeyCode.UpArrow) || kbEvent.equals(KeyCode.LeftArrow)) {
                        this.menuBar.value?.toggleFocus();
                    }
                })
            );
        }
        if (this.globalCompositeBar) {
            this.keyboardNavigationDisposables.add(
                addDisposableListener(this.globalCompositeBar.element, EventType.KEY_DOWN, e => {
                    const kbEvent = ( new StandardKeyboardEvent(e));
                    if (kbEvent.equals(KeyCode.UpArrow) || kbEvent.equals(KeyCode.LeftArrow)) {
                        this.focus(this.getVisiblePaneCompositeIds().length - 1);
                    }
                })
            );
        }
    }
    create(parent) {
        this.element = parent;
        if (getMenuBarVisibility(this.configurationService) === "compact") {
            this.installMenubar();
        }
        this.compositeBarContainer = super.create(this.element);
        if (this.globalCompositeBar) {
            this.globalCompositeBar.create(this.element);
        }
        this.registerKeyboardNavigationListeners();
        return this.compositeBarContainer;
    }
    layout(width, height) {
        if (this.menuBarContainer) {
            if (this.options.orientation === ActionsOrientation.VERTICAL) {
                height -= this.menuBarContainer.clientHeight;
            } else {
                width -= this.menuBarContainer.clientWidth;
            }
        }
        if (this.globalCompositeBar) {
            if (this.options.orientation === ActionsOrientation.VERTICAL) {
                height -= (this.globalCompositeBar.size() * this.options.overflowActionSize);
            } else {
                width -= this.globalCompositeBar.element.clientWidth;
            }
        }
        super.layout(width, height);
    }
    getActivityBarContextMenuActions() {
        const activityBarPositionMenu = this.menuService.getMenuActions(MenuId.ActivityBarPositionMenu, this.contextKeyService, {
            shouldForwardArgs: true,
            renderShortTitle: true
        });
        const positionActions = getContextMenuActions(activityBarPositionMenu).secondary;
        const actions = [( new SubmenuAction("workbench.action.activityBar.position", ( localize(3043, "Activity Bar Position")), positionActions))];
        const activityBarPosition = this.configurationService.getValue(LayoutSettings.ACTIVITY_BAR_LOCATION);
        if (activityBarPosition === ActivityBarPosition.DEFAULT) {
            const isCompact = this.configurationService.getValue(LayoutSettings.ACTIVITY_BAR_COMPACT) ?? false;
            const sizeActions = [toAction({
                id: "workbench.action.activityBar.size.default",
                label: ( localize(3044, "Default")),
                checked: !isCompact,
                run: () => this.configurationService.updateValue(LayoutSettings.ACTIVITY_BAR_COMPACT, false)
            }), toAction({
                id: "workbench.action.activityBar.size.compact",
                label: ( localize(3045, "Compact")),
                checked: isCompact,
                run: () => this.configurationService.updateValue(LayoutSettings.ACTIVITY_BAR_COMPACT, true)
            })];
            actions.push(( new SubmenuAction("workbench.action.activityBar.size", ( localize(3046, "Activity Bar Size")), sizeActions)));
        }
        actions.push(toAction({
            id: ToggleSidebarPositionAction.ID,
            label: ToggleSidebarPositionAction.getLabel(this.layoutService),
            run: () => this.instantiationService.invokeFunction(accessor => ( new ToggleSidebarPositionAction()).run(accessor))
        }));
        if (this.part === Parts.SIDEBAR_PART) {
            actions.push(toAction({
                id: ToggleSidebarVisibilityAction.ID,
                label: ToggleSidebarVisibilityAction.LABEL,
                run: () => this.instantiationService.invokeFunction(accessor => ( new ToggleSidebarVisibilityAction()).run(accessor))
            }));
        }
        return actions;
    }
};
ActivityBarCompositeBar = ( __decorate([( __param(5, IInstantiationService)), ( __param(6, IStorageService)), ( __param(7, IExtensionService)), ( __param(8, IViewDescriptorService)), ( __param(9, IViewsService)), ( __param(10, IContextKeyService)), ( __param(11, IWorkbenchEnvironmentService)), ( __param(12, IConfigurationService)), ( __param(13, IMenuService)), ( __param(14, IWorkbenchLayoutService))], ActivityBarCompositeBar));
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: "workbench.action.activityBarLocation.default",
            title: {
                ...( localize2(3047, "Move Activity Bar to Side")),
                mnemonicTitle: ( localize(3048, "&&Default"))
            },
            shortTitle: ( localize(3049, "Default")),
            category: Categories.View,
            toggled: ( ContextKeyExpr.equals(
                `config.${LayoutSettings.ACTIVITY_BAR_LOCATION}`,
                ActivityBarPosition.DEFAULT
            )),
            menu: [{
                id: MenuId.ActivityBarPositionMenu,
                order: 1
            }, {
                id: MenuId.CommandPalette,
                when: ( ContextKeyExpr.notEquals(
                    `config.${LayoutSettings.ACTIVITY_BAR_LOCATION}`,
                    ActivityBarPosition.DEFAULT
                ))
            }]
        });
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        configurationService.updateValue(LayoutSettings.ACTIVITY_BAR_LOCATION, ActivityBarPosition.DEFAULT);
    }
});
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: "workbench.action.activityBarLocation.top",
            title: {
                ...( localize2(3050, "Move Activity Bar to Top")),
                mnemonicTitle: ( localize(3051, "&&Top"))
            },
            shortTitle: ( localize(3052, "Top")),
            category: Categories.View,
            toggled: ( ContextKeyExpr.equals(`config.${LayoutSettings.ACTIVITY_BAR_LOCATION}`, ActivityBarPosition.TOP)),
            menu: [{
                id: MenuId.ActivityBarPositionMenu,
                order: 2
            }, {
                id: MenuId.CommandPalette,
                when: ( ContextKeyExpr.notEquals(`config.${LayoutSettings.ACTIVITY_BAR_LOCATION}`, ActivityBarPosition.TOP))
            }]
        });
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        configurationService.updateValue(LayoutSettings.ACTIVITY_BAR_LOCATION, ActivityBarPosition.TOP);
    }
});
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: "workbench.action.activityBarLocation.bottom",
            title: {
                ...( localize2(3053, "Move Activity Bar to Bottom")),
                mnemonicTitle: ( localize(3054, "&&Bottom"))
            },
            shortTitle: ( localize(3055, "Bottom")),
            category: Categories.View,
            toggled: ( ContextKeyExpr.equals(
                `config.${LayoutSettings.ACTIVITY_BAR_LOCATION}`,
                ActivityBarPosition.BOTTOM
            )),
            menu: [{
                id: MenuId.ActivityBarPositionMenu,
                order: 3
            }, {
                id: MenuId.CommandPalette,
                when: ( ContextKeyExpr.notEquals(
                    `config.${LayoutSettings.ACTIVITY_BAR_LOCATION}`,
                    ActivityBarPosition.BOTTOM
                ))
            }]
        });
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        configurationService.updateValue(LayoutSettings.ACTIVITY_BAR_LOCATION, ActivityBarPosition.BOTTOM);
    }
});
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: "workbench.action.activityBarLocation.hide",
            title: {
                ...( localize2(3056, "Hide Activity Bar")),
                mnemonicTitle: ( localize(3057, "&&Hidden"))
            },
            shortTitle: ( localize(3058, "Hidden")),
            category: Categories.View,
            toggled: ( ContextKeyExpr.equals(
                `config.${LayoutSettings.ACTIVITY_BAR_LOCATION}`,
                ActivityBarPosition.HIDDEN
            )),
            menu: [{
                id: MenuId.ActivityBarPositionMenu,
                order: 4
            }, {
                id: MenuId.CommandPalette,
                when: ( ContextKeyExpr.notEquals(
                    `config.${LayoutSettings.ACTIVITY_BAR_LOCATION}`,
                    ActivityBarPosition.HIDDEN
                ))
            }]
        });
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        configurationService.updateValue(LayoutSettings.ACTIVITY_BAR_LOCATION, ActivityBarPosition.HIDDEN);
    }
});
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
    submenu: MenuId.ActivityBarPositionMenu,
    title: ( localize(3059, "Activity Bar Position")),
    group: "3_workbench_layout_move",
    order: 2
});
MenuRegistry.appendMenuItem(MenuId.ViewContainerTitleContext, {
    submenu: MenuId.ActivityBarPositionMenu,
    title: ( localize(3059, "Activity Bar Position")),
    when: ( ContextKeyExpr.or(( ContextKeyExpr.equals(
        "viewContainerLocation",
        ViewContainerLocationToString(ViewContainerLocation.Sidebar)
    )), ( ContextKeyExpr.equals(
        "viewContainerLocation",
        ViewContainerLocationToString(ViewContainerLocation.AuxiliaryBar)
    )))),
    group: "3_workbench_layout_move",
    order: 1
});
registerAction2(class extends SwitchCompositeViewAction {
    constructor() {
        super({
            id: "workbench.action.previousSideBarView",
            title: ( localize2(3060, "Previous Primary Side Bar View")),
            category: Categories.View,
            f1: true
        }, ViewContainerLocation.Sidebar, -1);
    }
});
registerAction2(class extends SwitchCompositeViewAction {
    constructor() {
        super({
            id: "workbench.action.nextSideBarView",
            title: ( localize2(3061, "Next Primary Side Bar View")),
            category: Categories.View,
            f1: true
        }, ViewContainerLocation.Sidebar, 1);
    }
});
registerAction2(class FocusActivityBarAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.focusActivityBar",
            title: ( localize2(3062, "Focus Activity Bar")),
            category: Categories.View,
            f1: true
        });
    }
    async run(accessor) {
        const layoutService = accessor.get(IWorkbenchLayoutService);
        layoutService.focusPart(Parts.ACTIVITYBAR_PART);
    }
});
registerThemingParticipant((theme, collector) => {
    const activityBarActiveBorderColor = theme.getColor(ACTIVITY_BAR_ACTIVE_BORDER);
    if (activityBarActiveBorderColor) {
        collector.addRule(`
            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .active-item-indicator:before {
                border-left-color: ${activityBarActiveBorderColor};
            }
        `);
    }
    const activityBarActiveFocusBorderColor = theme.getColor(ACTIVITY_BAR_ACTIVE_FOCUS_BORDER);
    if (activityBarActiveFocusBorderColor) {
        collector.addRule(`
            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:focus::before {
                visibility: hidden;
            }

            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:focus .active-item-indicator:before {
                visibility: visible;
                border-left-color: ${activityBarActiveFocusBorderColor};
            }
        `);
    }
    const activityBarActiveBackgroundColor = theme.getColor(ACTIVITY_BAR_ACTIVE_BACKGROUND);
    if (activityBarActiveBackgroundColor) {
        collector.addRule(`
            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .active-item-indicator {
                z-index: 0;
                background-color: ${activityBarActiveBackgroundColor};
            }
        `);
    }
    const outline = theme.getColor(activeContrastBorder);
    if (outline) {
        collector.addRule(`
            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label::before{
                padding: 6px;
            }

            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active .action-label::before,
            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active:hover .action-label::before,
            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .action-label::before,
            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:hover .action-label::before {
                outline: 1px solid ${outline};
            }

            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:hover .action-label::before {
                outline: 1px dashed ${outline};
            }

            .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .active-item-indicator:before {
                border-left-color: ${outline};
            }
        `);
    }
    else {
        const focusBorderColor = theme.getColor(focusBorder);
        if (focusBorderColor) {
            collector.addRule(`
                .monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .active-item-indicator::before {
                        border-left-color: ${focusBorderColor};
                    }
                `);
        }
    }
});

export { ActivityBarCompositeBar, ActivitybarPart };
