
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
import { localize2, localize } from '../../../../nls.js';
import { Action } from '../../../../base/common/actions.js';
import { CloseDirection, EditorsOrder, EditorInputCapabilities, SaveReason, EditorResourceAccessor, DEFAULT_EDITOR_ASSOCIATION } from '../../../common/editor.js';
import { SideBySideEditorInput } from '../../../common/editor/sideBySideEditorInput.js';
import { Parts } from '../../../services/layout/browser/layoutService.js';
import { IWorkbenchLayoutService } from '../../../services/layout/browser/layoutService.service.js';
import { GoFilter } from '../../../services/history/common/history.js';
import { IHistoryService } from '../../../services/history/common/history.service.js';
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.service.js';
import { ICommandService } from '../../../../platform/commands/common/commands.service.js';
import { splitEditor, SPLIT_EDITOR, SPLIT_EDITOR_LEFT, SPLIT_EDITOR_RIGHT, SPLIT_EDITOR_UP, SPLIT_EDITOR_DOWN, CLOSE_EDITOR_COMMAND_ID, UNPIN_EDITOR_COMMAND_ID, TOGGLE_MAXIMIZE_EDITOR_GROUP, MOVE_ACTIVE_EDITOR_COMMAND_ID, MOVE_EDITOR_INTO_ABOVE_GROUP, MOVE_EDITOR_INTO_BELOW_GROUP, MOVE_EDITOR_INTO_LEFT_GROUP, MOVE_EDITOR_INTO_RIGHT_GROUP, COPY_ACTIVE_EDITOR_COMMAND_ID, LAYOUT_EDITOR_GROUPS_COMMAND_ID, MOVE_EDITOR_INTO_NEW_WINDOW_COMMAND_ID, COPY_EDITOR_INTO_NEW_WINDOW_COMMAND_ID, MOVE_EDITOR_GROUP_INTO_NEW_WINDOW_COMMAND_ID, COPY_EDITOR_GROUP_INTO_NEW_WINDOW_COMMAND_ID, NEW_EMPTY_EDITOR_WINDOW_COMMAND_ID } from './editorCommands.js';
import { preferredSideBySideGroupDirection, GroupDirection, GroupLocation, GroupsOrder, GroupsArrangement, GroupOrientation, MergeGroupMode } from '../../../services/editor/common/editorGroupsService.js';
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.service.js';
import { IEditorService } from '../../../services/editor/common/editorService.service.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.service.js';
import { IWorkspacesService } from '../../../../platform/workspaces/common/workspaces.service.js';
import { ConfirmResult } from '../../../../platform/dialogs/common/dialogs.js';
import { IFileDialogService, IDialogService } from '../../../../platform/dialogs/common/dialogs.service.js';
import { ItemActivation } from '../../../../platform/quickinput/common/quickInput.js';
import { IQuickInputService } from '../../../../platform/quickinput/common/quickInput.service.js';
import { ActiveGroupEditorsByMostRecentlyUsedQuickAccess, AllEditorsByAppearanceQuickAccess, AllEditorsByMostRecentlyUsedQuickAccess } from './editorQuickAccess.js';
import { Codicon } from '../../../../base/common/codicons.js';
import { ThemeIcon } from '../../../../base/common/themables.js';
import { AutoSaveMode } from '../../../services/filesConfiguration/common/filesConfigurationService.js';
import { IFilesConfigurationService } from '../../../services/filesConfiguration/common/filesConfigurationService.service.js';
import { IEditorResolverService } from '../../../services/editor/common/editorResolverService.service.js';
import { isNative, isWindows, isLinux } from '../../../../base/common/platform.js';
import { Action2, MenuId } from '../../../../platform/actions/common/actions.js';
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
import { KeyMod as KeyMod$1, KeyCode, KeyChord } from '../../../../base/common/keyCodes.js';
import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
import { ILogService } from '../../../../platform/log/common/log.service.js';
import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
import { MultipleEditorGroupsContext, SideBarVisibleContext, AuxiliaryBarVisibleContext, EditorPartMaximizedEditorGroupContext, EditorPartMultipleEditorGroupsContext, ActiveEditorGroupEmptyContext, InAutomationContext, ActiveEditorAvailableEditorIdsContext, ActiveEditorContext, IsAuxiliaryWindowFocusedContext } from '../../../common/contextkeys.js';
import { getActiveDocument } from '../../../../base/browser/dom.js';
import { ProgressLocation } from '../../../../platform/progress/common/progress.js';
import { IProgressService } from '../../../../platform/progress/common/progress.service.js';
import { resolveCommandsContext } from './editorCommandsContext.js';
import { IListService } from '../../../../platform/list/browser/listService.service.js';
import { prepareMoveCopyEditors } from './editor.js';

class ExecuteCommandAction extends Action2 {
    constructor(desc, commandId, commandArgs) {
        super(desc);
        this.commandId = commandId;
        this.commandArgs = commandArgs;
    }
    run(accessor) {
        const commandService = accessor.get(ICommandService);
        return commandService.executeCommand(this.commandId, this.commandArgs);
    }
}
class AbstractSplitEditorAction extends Action2 {
    getDirection(configurationService) {
        return preferredSideBySideGroupDirection(configurationService);
    }
    async run(accessor, ...args) {
        const editorGroupsService = accessor.get(IEditorGroupsService);
        const configurationService = accessor.get(IConfigurationService);
        const editorService = accessor.get(IEditorService);
        const listService = accessor.get(IListService);
        const direction = this.getDirection(configurationService);
        const commandContext = resolveCommandsContext(args, editorService, editorGroupsService, listService);
        splitEditor(editorGroupsService, direction, commandContext);
    }
}
class SplitEditorAction extends AbstractSplitEditorAction {
    static {
        this.ID = SPLIT_EDITOR;
    }
    constructor() {
        super({
            id: SplitEditorAction.ID,
            title: ( localize2(3312, "Split Editor")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyCode.Backslash
            },
            category: Categories.View
        });
    }
}
class SplitEditorOrthogonalAction extends AbstractSplitEditorAction {
    constructor() {
        super({
            id: "workbench.action.splitEditorOrthogonal",
            title: ( localize2(3313, "Split Editor Orthogonal")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.Backslash)
            },
            category: Categories.View
        });
    }
    getDirection(configurationService) {
        const direction = preferredSideBySideGroupDirection(configurationService);
        return direction === GroupDirection.RIGHT ? GroupDirection.DOWN : GroupDirection.RIGHT;
    }
}
class SplitEditorLeftAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: SPLIT_EDITOR_LEFT,
            title: ( localize2(3314, "Split Editor Left")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.Backslash)
            },
            category: Categories.View
        }, SPLIT_EDITOR_LEFT);
    }
}
class SplitEditorRightAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: SPLIT_EDITOR_RIGHT,
            title: ( localize2(3315, "Split Editor Right")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.Backslash)
            },
            category: Categories.View
        }, SPLIT_EDITOR_RIGHT);
    }
}
class SplitEditorUpAction extends ExecuteCommandAction {
    static {
        this.LABEL = ( localize(3316, "Split Editor Up"));
    }
    constructor() {
        super({
            id: SPLIT_EDITOR_UP,
            title: ( localize2(3316, "Split Editor Up")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.Backslash)
            },
            category: Categories.View
        }, SPLIT_EDITOR_UP);
    }
}
class SplitEditorDownAction extends ExecuteCommandAction {
    static {
        this.LABEL = ( localize(3317, "Split Editor Down"));
    }
    constructor() {
        super({
            id: SPLIT_EDITOR_DOWN,
            title: ( localize2(3317, "Split Editor Down")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.Backslash)
            },
            category: Categories.View
        }, SPLIT_EDITOR_DOWN);
    }
}
class JoinTwoGroupsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.joinTwoGroups",
            title: ( localize2(3318, "Join Editor Group with Next Group")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor, context) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        let sourceGroup;
        if (context && typeof context.groupId === "number") {
            sourceGroup = editorGroupService.getGroup(context.groupId);
        } else {
            sourceGroup = editorGroupService.activeGroup;
        }
        if (sourceGroup) {
            const targetGroupDirections = [
                GroupDirection.RIGHT,
                GroupDirection.DOWN,
                GroupDirection.LEFT,
                GroupDirection.UP
            ];
            for (const targetGroupDirection of targetGroupDirections) {
                const targetGroup = editorGroupService.findGroup({
                    direction: targetGroupDirection
                }, sourceGroup);
                if (targetGroup && sourceGroup !== targetGroup) {
                    editorGroupService.mergeGroup(sourceGroup, targetGroup);
                    break;
                }
            }
        }
    }
}
class JoinAllGroupsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.joinAllGroups",
            title: ( localize2(3319, "Join All Editor Groups")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        editorGroupService.mergeAllGroups(editorGroupService.activeGroup);
    }
}
class NavigateBetweenGroupsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigateEditorGroups",
            title: ( localize2(3320, "Navigate Between Editor Groups")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        const nextGroup = editorGroupService.findGroup({
            location: GroupLocation.NEXT
        }, editorGroupService.activeGroup, true);
        nextGroup?.focus();
    }
}
class FocusActiveGroupAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.focusActiveEditorGroup",
            title: ( localize2(3321, "Focus Active Editor Group")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        editorGroupService.activeGroup.focus();
    }
}
class AbstractFocusGroupAction extends Action2 {
    constructor(desc, scope) {
        super(desc);
        this.scope = scope;
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        const group = editorGroupService.findGroup(this.scope, editorGroupService.activeGroup, true);
        group?.focus();
    }
}
class FocusFirstGroupAction extends AbstractFocusGroupAction {
    constructor() {
        super({
            id: "workbench.action.focusFirstEditorGroup",
            title: ( localize2(3322, "Focus First Editor Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyCode.Digit1
            },
            category: Categories.View
        }, {
            location: GroupLocation.FIRST
        });
    }
}
class FocusLastGroupAction extends AbstractFocusGroupAction {
    constructor() {
        super({
            id: "workbench.action.focusLastEditorGroup",
            title: ( localize2(3323, "Focus Last Editor Group")),
            f1: true,
            category: Categories.View
        }, {
            location: GroupLocation.LAST
        });
    }
}
class FocusNextGroup extends AbstractFocusGroupAction {
    constructor() {
        super({
            id: "workbench.action.focusNextGroup",
            title: ( localize2(3324, "Focus Next Editor Group")),
            f1: true,
            category: Categories.View
        }, {
            location: GroupLocation.NEXT
        });
    }
}
class FocusPreviousGroup extends AbstractFocusGroupAction {
    constructor() {
        super({
            id: "workbench.action.focusPreviousGroup",
            title: ( localize2(3325, "Focus Previous Editor Group")),
            f1: true,
            category: Categories.View
        }, {
            location: GroupLocation.PREVIOUS
        });
    }
}
class FocusLeftGroup extends AbstractFocusGroupAction {
    constructor() {
        super({
            id: "workbench.action.focusLeftGroup",
            title: ( localize2(3326, "Focus Left Editor Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.LeftArrow)
            },
            category: Categories.View
        }, {
            direction: GroupDirection.LEFT
        });
    }
}
class FocusRightGroup extends AbstractFocusGroupAction {
    constructor() {
        super({
            id: "workbench.action.focusRightGroup",
            title: ( localize2(3327, "Focus Right Editor Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.RightArrow)
            },
            category: Categories.View
        }, {
            direction: GroupDirection.RIGHT
        });
    }
}
class FocusAboveGroup extends AbstractFocusGroupAction {
    constructor() {
        super({
            id: "workbench.action.focusAboveGroup",
            title: ( localize2(3328, "Focus Editor Group Above")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.UpArrow)
            },
            category: Categories.View
        }, {
            direction: GroupDirection.UP
        });
    }
}
class FocusBelowGroup extends AbstractFocusGroupAction {
    constructor() {
        super({
            id: "workbench.action.focusBelowGroup",
            title: ( localize2(3329, "Focus Editor Group Below")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.DownArrow)
            },
            category: Categories.View
        }, {
            direction: GroupDirection.DOWN
        });
    }
}
let CloseEditorAction = class CloseEditorAction extends Action {
    static {
        this.ID = "workbench.action.closeActiveEditor";
    }
    static {
        this.LABEL = ( localize(3330, "Close Editor"));
    }
    constructor(id, label, commandService) {
        super(id, label, ThemeIcon.asClassName(Codicon.close));
        this.commandService = commandService;
    }
    run(context) {
        return this.commandService.executeCommand(CLOSE_EDITOR_COMMAND_ID, undefined, context);
    }
};
CloseEditorAction = ( __decorate([( __param(2, ICommandService))], CloseEditorAction));
let UnpinEditorAction = class UnpinEditorAction extends Action {
    static {
        this.ID = "workbench.action.unpinActiveEditor";
    }
    static {
        this.LABEL = ( localize(3331, "Unpin Editor"));
    }
    constructor(id, label, commandService) {
        super(id, label, ThemeIcon.asClassName(Codicon.pinned));
        this.commandService = commandService;
    }
    run(context) {
        return this.commandService.executeCommand(UNPIN_EDITOR_COMMAND_ID, undefined, context);
    }
};
UnpinEditorAction = ( __decorate([( __param(2, ICommandService))], UnpinEditorAction));
let CloseEditorTabAction = class CloseEditorTabAction extends Action {
    static {
        this.ID = "workbench.action.closeActiveEditor";
    }
    static {
        this.LABEL = ( localize(3332, "Close"));
    }
    constructor(id, label, editorGroupService) {
        super(id, label, ThemeIcon.asClassName(Codicon.close));
        this.editorGroupService = editorGroupService;
    }
    async run(context) {
        const group = context ? this.editorGroupService.getGroup(context.groupId) : this.editorGroupService.activeGroup;
        if (!group) {
            return;
        }
        const targetEditor = context?.editorIndex !== undefined ? group.getEditorByIndex(context.editorIndex) : group.activeEditor;
        if (!targetEditor) {
            return;
        }
        const editors = [];
        if (group.isSelected(targetEditor)) {
            editors.push(...group.selectedEditors);
        } else {
            editors.push(targetEditor);
        }
        for (const editor of editors) {
            await group.closeEditor(editor, {
                preserveFocus: context?.preserveFocus
            });
        }
    }
};
CloseEditorTabAction = ( __decorate([( __param(2, IEditorGroupsService))], CloseEditorTabAction));
class RevertAndCloseEditorAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.revertAndCloseActiveEditor",
            title: ( localize2(3333, "Revert and Close Editor")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const editorService = accessor.get(IEditorService);
        const logService = accessor.get(ILogService);
        const activeEditorPane = editorService.activeEditorPane;
        if (activeEditorPane) {
            const editor = activeEditorPane.input;
            const group = activeEditorPane.group;
            try {
                await editorService.revert({
                    editor,
                    groupId: group.id
                });
            } catch (error) {
                logService.error(error);
                await editorService.revert({
                    editor,
                    groupId: group.id
                }, {
                    soft: true
                });
            }
            await group.closeEditor(editor);
        }
    }
}
class CloseLeftEditorsInGroupAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.closeEditorsToTheLeft",
            title: ( localize2(3334, "Close Editors to the Left in Group")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor, context) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        const {
            group,
            editor
        } = this.getTarget(editorGroupService, context);
        if (group && editor) {
            await group.closeEditors({
                direction: CloseDirection.LEFT,
                except: editor,
                excludeSticky: true
            });
        }
    }
    getTarget(editorGroupService, context) {
        if (context) {
            return {
                editor: context.editor,
                group: editorGroupService.getGroup(context.groupId)
            };
        }
        return {
            group: editorGroupService.activeGroup,
            editor: editorGroupService.activeGroup.activeEditor
        };
    }
}
class AbstractCloseAllAction extends Action2 {
    groupsToClose(editorGroupService) {
        const groupsToClose = [];
        const groups = editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE);
        for (let i = groups.length - 1; i >= 0; i--) {
            groupsToClose.push(groups[i]);
        }
        return groupsToClose;
    }
    async run(accessor) {
        const editorService = accessor.get(IEditorService);
        const logService = accessor.get(ILogService);
        const progressService = accessor.get(IProgressService);
        const editorGroupService = accessor.get(IEditorGroupsService);
        const filesConfigurationService = accessor.get(IFilesConfigurationService);
        const fileDialogService = accessor.get(IFileDialogService);
        const dirtyEditorsWithDefaultConfirm = ( new Set());
        const dirtyAutoSaveOnFocusChangeEditors = ( new Set());
        const dirtyAutoSaveOnWindowChangeEditors = ( new Set());
        const editorsWithCustomConfirm = ( new Map());
        for (const {
            editor,
            groupId
        } of editorService.getEditors(EditorsOrder.SEQUENTIAL, {
            excludeSticky: this.excludeSticky
        })) {
            let confirmClose = false;
            let handlerDidError = false;
            if (editor.closeHandler) {
                try {
                    confirmClose = editor.closeHandler.showConfirm();
                } catch (error) {
                    logService.error(error);
                    handlerDidError = true;
                }
            }
            if (!editor.closeHandler || handlerDidError) {
                confirmClose = editor.isDirty() && !editor.isSaving();
            }
            if (!confirmClose) {
                continue;
            }
            if (typeof editor.closeHandler?.confirm === "function") {
                let customEditorsToConfirm = editorsWithCustomConfirm.get(editor.typeId);
                if (!customEditorsToConfirm) {
                    customEditorsToConfirm = ( new Set());
                    editorsWithCustomConfirm.set(editor.typeId, customEditorsToConfirm);
                }
                customEditorsToConfirm.add({
                    editor,
                    groupId
                });
            }
            else if (!editor.hasCapability(EditorInputCapabilities.Untitled) && filesConfigurationService.getAutoSaveMode(editor).mode === AutoSaveMode.ON_FOCUS_CHANGE) {
                dirtyAutoSaveOnFocusChangeEditors.add({
                    editor,
                    groupId
                });
            }
            else if ((isNative && (isWindows || isLinux)) && !editor.hasCapability(EditorInputCapabilities.Untitled) && filesConfigurationService.getAutoSaveMode(editor).mode === AutoSaveMode.ON_WINDOW_CHANGE) {
                dirtyAutoSaveOnWindowChangeEditors.add({
                    editor,
                    groupId
                });
            }
            else {
                dirtyEditorsWithDefaultConfirm.add({
                    editor,
                    groupId
                });
            }
        }
        if (dirtyEditorsWithDefaultConfirm.size > 0) {
            const editors = Array.from(( dirtyEditorsWithDefaultConfirm.values()));
            await this.revealEditorsToConfirm(editors, editorGroupService);
            const confirmation = await fileDialogService.showSaveConfirm(( editors.map((
                {
                    editor
                }
            ) => {
                if (editor instanceof SideBySideEditorInput) {
                    return editor.primary.getName();
                }
                return editor.getName();
            })));
            switch (confirmation) {
            case ConfirmResult.CANCEL:
                return;
            case ConfirmResult.DONT_SAVE:
                await this.revertEditors(editorService, logService, progressService, editors);
                break;
            case ConfirmResult.SAVE:
                await editorService.save(editors, {
                    reason: SaveReason.EXPLICIT
                });
                break;
            }
        }
        for (const [, editorIdentifiers] of editorsWithCustomConfirm) {
            const editors = Array.from(( editorIdentifiers.values()));
            await this.revealEditorsToConfirm(editors, editorGroupService);
            const confirmation = await editors.at(0)?.editor.closeHandler?.confirm?.(editors);
            if (typeof confirmation === "number") {
                switch (confirmation) {
                case ConfirmResult.CANCEL:
                    return;
                case ConfirmResult.DONT_SAVE:
                    await this.revertEditors(editorService, logService, progressService, editors);
                    break;
                case ConfirmResult.SAVE:
                    await editorService.save(editors, {
                        reason: SaveReason.EXPLICIT
                    });
                    break;
                }
            }
        }
        if (dirtyAutoSaveOnFocusChangeEditors.size > 0) {
            const editors = Array.from(( dirtyAutoSaveOnFocusChangeEditors.values()));
            await editorService.save(editors, {
                reason: SaveReason.FOCUS_CHANGE
            });
        }
        if (dirtyAutoSaveOnWindowChangeEditors.size > 0) {
            const editors = Array.from(( dirtyAutoSaveOnWindowChangeEditors.values()));
            await editorService.save(editors, {
                reason: SaveReason.WINDOW_CHANGE
            });
        }
        return this.doCloseAll(editorGroupService);
    }
    revertEditors(editorService, logService, progressService, editors) {
        return progressService.withProgress({
            location: ProgressLocation.Window,
            delay: 800,
            title: ( localize(3335, "Reverting Editors..."))
        }, () => this.doRevertEditors(editorService, logService, editors));
    }
    async doRevertEditors(editorService, logService, editors) {
        try {
            await editorService.revert(editors);
        } catch (error) {
            logService.error(error);
            await editorService.revert(editors, {
                soft: true
            });
        }
    }
    async revealEditorsToConfirm(editors, editorGroupService) {
        try {
            const handledGroups = ( new Set());
            for (const {
                editor,
                groupId
            } of editors) {
                if (( handledGroups.has(groupId))) {
                    continue;
                }
                handledGroups.add(groupId);
                const group = editorGroupService.getGroup(groupId);
                await group?.openEditor(editor);
            }
        } catch (error) {}
    }
    async doCloseAll(editorGroupService) {
        await Promise.all(( this.groupsToClose(editorGroupService).map(group => group.closeAllEditors({
            excludeSticky: this.excludeSticky
        }))));
    }
}
class CloseAllEditorsAction extends AbstractCloseAllAction {
    static {
        this.ID = "workbench.action.closeAllEditors";
    }
    static {
        this.LABEL = ( localize2(3336, "Close All Editors"));
    }
    constructor() {
        super({
            id: CloseAllEditorsAction.ID,
            title: CloseAllEditorsAction.LABEL,
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.KeyW)
            },
            icon: Codicon.closeAll,
            category: Categories.View
        });
    }
    get excludeSticky() {
        return true;
    }
}
class CloseAllEditorGroupsAction extends AbstractCloseAllAction {
    constructor() {
        super({
            id: "workbench.action.closeAllGroups",
            title: ( localize2(3337, "Close All Editor Groups")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(
                    KeyMod$1.CtrlCmd | KeyCode.KeyK,
                    KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.KeyW
                )
            },
            category: Categories.View
        });
    }
    get excludeSticky() {
        return false;
    }
    async doCloseAll(editorGroupService) {
        await super.doCloseAll(editorGroupService);
        for (const groupToClose of this.groupsToClose(editorGroupService)) {
            editorGroupService.removeGroup(groupToClose);
        }
    }
}
class CloseEditorsInOtherGroupsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.closeEditorsInOtherGroups",
            title: ( localize2(3338, "Close Editors in Other Groups")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor, context) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        const groupToSkip = context ? editorGroupService.getGroup(context.groupId) : editorGroupService.activeGroup;
        await Promise.all(( editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).map(async group => {
            if (groupToSkip && group.id === groupToSkip.id) {
                return;
            }
            return group.closeAllEditors({
                excludeSticky: true
            });
        })));
    }
}
class CloseEditorInAllGroupsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.closeEditorInAllGroups",
            title: ( localize2(3339, "Close Editor in All Groups")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const editorService = accessor.get(IEditorService);
        const editorGroupService = accessor.get(IEditorGroupsService);
        const activeEditor = editorService.activeEditor;
        if (activeEditor) {
            await Promise.all(( editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).map(group => group.closeEditor(activeEditor))));
        }
    }
}
class AbstractMoveCopyGroupAction extends Action2 {
    constructor(desc, direction, isMove) {
        super(desc);
        this.direction = direction;
        this.isMove = isMove;
    }
    async run(accessor, context) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        let sourceGroup;
        if (context && typeof context.groupId === "number") {
            sourceGroup = editorGroupService.getGroup(context.groupId);
        } else {
            sourceGroup = editorGroupService.activeGroup;
        }
        if (sourceGroup) {
            let resultGroup = undefined;
            if (this.isMove) {
                const targetGroup = this.findTargetGroup(editorGroupService, sourceGroup);
                if (targetGroup) {
                    resultGroup = editorGroupService.moveGroup(sourceGroup, targetGroup, this.direction);
                }
            } else {
                resultGroup = editorGroupService.copyGroup(sourceGroup, sourceGroup, this.direction);
            }
            if (resultGroup) {
                editorGroupService.activateGroup(resultGroup);
            }
        }
    }
    findTargetGroup(editorGroupService, sourceGroup) {
        const targetNeighbours = [this.direction];
        switch (this.direction) {
        case GroupDirection.LEFT:
        case GroupDirection.RIGHT:
            targetNeighbours.push(GroupDirection.UP, GroupDirection.DOWN);
            break;
        case GroupDirection.UP:
        case GroupDirection.DOWN:
            targetNeighbours.push(GroupDirection.LEFT, GroupDirection.RIGHT);
            break;
        }
        for (const targetNeighbour of targetNeighbours) {
            const targetNeighbourGroup = editorGroupService.findGroup({
                direction: targetNeighbour
            }, sourceGroup);
            if (targetNeighbourGroup) {
                return targetNeighbourGroup;
            }
        }
        return undefined;
    }
}
class AbstractMoveGroupAction extends AbstractMoveCopyGroupAction {
    constructor(desc, direction) {
        super(desc, direction, true);
    }
}
class MoveGroupLeftAction extends AbstractMoveGroupAction {
    constructor() {
        super({
            id: "workbench.action.moveActiveEditorGroupLeft",
            title: ( localize2(3340, "Move Editor Group Left")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyCode.LeftArrow)
            },
            category: Categories.View
        }, GroupDirection.LEFT);
    }
}
class MoveGroupRightAction extends AbstractMoveGroupAction {
    constructor() {
        super({
            id: "workbench.action.moveActiveEditorGroupRight",
            title: ( localize2(3341, "Move Editor Group Right")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyCode.RightArrow)
            },
            category: Categories.View
        }, GroupDirection.RIGHT);
    }
}
class MoveGroupUpAction extends AbstractMoveGroupAction {
    constructor() {
        super({
            id: "workbench.action.moveActiveEditorGroupUp",
            title: ( localize2(3342, "Move Editor Group Up")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyCode.UpArrow)
            },
            category: Categories.View
        }, GroupDirection.UP);
    }
}
class MoveGroupDownAction extends AbstractMoveGroupAction {
    constructor() {
        super({
            id: "workbench.action.moveActiveEditorGroupDown",
            title: ( localize2(3343, "Move Editor Group Down")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyCode.DownArrow)
            },
            category: Categories.View
        }, GroupDirection.DOWN);
    }
}
class AbstractDuplicateGroupAction extends AbstractMoveCopyGroupAction {
    constructor(desc, direction) {
        super(desc, direction, false);
    }
}
class DuplicateGroupLeftAction extends AbstractDuplicateGroupAction {
    constructor() {
        super({
            id: "workbench.action.duplicateActiveEditorGroupLeft",
            title: ( localize2(3344, "Duplicate Editor Group Left")),
            f1: true,
            category: Categories.View
        }, GroupDirection.LEFT);
    }
}
class DuplicateGroupRightAction extends AbstractDuplicateGroupAction {
    constructor() {
        super({
            id: "workbench.action.duplicateActiveEditorGroupRight",
            title: ( localize2(3345, "Duplicate Editor Group Right")),
            f1: true,
            category: Categories.View
        }, GroupDirection.RIGHT);
    }
}
class DuplicateGroupUpAction extends AbstractDuplicateGroupAction {
    constructor() {
        super({
            id: "workbench.action.duplicateActiveEditorGroupUp",
            title: ( localize2(3346, "Duplicate Editor Group Up")),
            f1: true,
            category: Categories.View
        }, GroupDirection.UP);
    }
}
class DuplicateGroupDownAction extends AbstractDuplicateGroupAction {
    constructor() {
        super({
            id: "workbench.action.duplicateActiveEditorGroupDown",
            title: ( localize2(3347, "Duplicate Editor Group Down")),
            f1: true,
            category: Categories.View
        }, GroupDirection.DOWN);
    }
}
class MinimizeOtherGroupsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.minimizeOtherEditors",
            title: ( localize2(3348, "Expand Editor Group")),
            f1: true,
            category: Categories.View,
            precondition: MultipleEditorGroupsContext
        });
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        editorGroupService.arrangeGroups(GroupsArrangement.EXPAND);
    }
}
class MinimizeOtherGroupsHideSidebarAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.minimizeOtherEditorsHideSidebar",
            title: ( localize2(3349, "Expand Editor Group and Hide Side Bars")),
            f1: true,
            category: Categories.View,
            precondition: ( ContextKeyExpr.or(
                MultipleEditorGroupsContext,
                SideBarVisibleContext,
                AuxiliaryBarVisibleContext
            ))
        });
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        const layoutService = accessor.get(IWorkbenchLayoutService);
        layoutService.setPartHidden(true, Parts.SIDEBAR_PART);
        layoutService.setPartHidden(true, Parts.AUXILIARYBAR_PART);
        editorGroupService.arrangeGroups(GroupsArrangement.EXPAND);
    }
}
class ResetGroupSizesAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.evenEditorWidths",
            title: ( localize2(3350, "Reset Editor Group Sizes")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        editorGroupService.arrangeGroups(GroupsArrangement.EVEN);
    }
}
class ToggleGroupSizesAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.toggleEditorWidths",
            title: ( localize2(3351, "Toggle Editor Group Sizes")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        editorGroupService.toggleExpandGroup();
    }
}
class MaximizeGroupHideSidebarAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.maximizeEditorHideSidebar",
            title: ( localize2(3352, "Maximize Editor Group and Hide Side Bars")),
            f1: true,
            category: Categories.View,
            precondition: ( ContextKeyExpr.or(( ContextKeyExpr.and(( EditorPartMaximizedEditorGroupContext.negate()), EditorPartMultipleEditorGroupsContext)), SideBarVisibleContext, AuxiliaryBarVisibleContext))
        });
    }
    async run(accessor) {
        const layoutService = accessor.get(IWorkbenchLayoutService);
        const editorGroupService = accessor.get(IEditorGroupsService);
        const editorService = accessor.get(IEditorService);
        if (editorService.activeEditor) {
            layoutService.setPartHidden(true, Parts.SIDEBAR_PART);
            layoutService.setPartHidden(true, Parts.AUXILIARYBAR_PART);
            editorGroupService.arrangeGroups(GroupsArrangement.MAXIMIZE);
        }
    }
}
class ToggleMaximizeEditorGroupAction extends Action2 {
    constructor() {
        super({
            id: TOGGLE_MAXIMIZE_EDITOR_GROUP,
            title: ( localize2(3353, "Toggle Maximize Editor Group")),
            f1: true,
            category: Categories.View,
            precondition: ( ContextKeyExpr.or(
                EditorPartMultipleEditorGroupsContext,
                EditorPartMaximizedEditorGroupContext
            )),
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.KeyM)
            },
            menu: [{
                id: MenuId.EditorTitle,
                order: -1e4,
                group: "navigation",
                when: EditorPartMaximizedEditorGroupContext
            }, {
                id: MenuId.EmptyEditorGroup,
                order: -1e4,
                group: "navigation",
                when: EditorPartMaximizedEditorGroupContext
            }],
            icon: Codicon.screenFull,
            toggled: {
                condition: EditorPartMaximizedEditorGroupContext,
                title: ( localize(3354, "Unmaximize Group"))
            }
        });
    }
    async run(accessor, ...args) {
        const editorGroupsService = accessor.get(IEditorGroupsService);
        const editorService = accessor.get(IEditorService);
        const listService = accessor.get(IListService);
        const resolvedContext = resolveCommandsContext(args, editorService, editorGroupsService, listService);
        if (resolvedContext.groupedEditors.length) {
            editorGroupsService.toggleMaximizeGroup(resolvedContext.groupedEditors[0].group);
        }
    }
}
class AbstractNavigateEditorAction extends Action2 {
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        const result = this.navigate(editorGroupService);
        if (!result) {
            return;
        }
        const {
            groupId,
            editor
        } = result;
        if (!editor) {
            return;
        }
        const group = editorGroupService.getGroup(groupId);
        if (group) {
            await group.openEditor(editor);
        }
    }
}
class OpenNextEditor extends AbstractNavigateEditorAction {
    constructor() {
        super({
            id: "workbench.action.nextEditor",
            title: ( localize2(3355, "Open Next Editor")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyCode.PageDown,
                mac: {
                    primary: KeyMod$1.CtrlCmd | KeyMod$1.Alt | KeyCode.RightArrow,
                    secondary: [KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.BracketRight]
                }
            },
            category: Categories.View
        });
    }
    navigate(editorGroupService) {
        const activeGroup = editorGroupService.activeGroup;
        const activeGroupEditors = activeGroup.getEditors(EditorsOrder.SEQUENTIAL);
        const activeEditorIndex = activeGroup.activeEditor ? activeGroupEditors.indexOf(activeGroup.activeEditor) : -1;
        if (activeEditorIndex + 1 < activeGroupEditors.length) {
            return {
                editor: activeGroupEditors[activeEditorIndex + 1],
                groupId: activeGroup.id
            };
        }
        const handledGroups = ( new Set());
        let currentGroup = editorGroupService.activeGroup;
        while (currentGroup && !( handledGroups.has(currentGroup.id))) {
            currentGroup = editorGroupService.findGroup({
                location: GroupLocation.NEXT
            }, currentGroup, true);
            if (currentGroup) {
                handledGroups.add(currentGroup.id);
                const groupEditors = currentGroup.getEditors(EditorsOrder.SEQUENTIAL);
                if (groupEditors.length > 0) {
                    return {
                        editor: groupEditors[0],
                        groupId: currentGroup.id
                    };
                }
            }
        }
        return undefined;
    }
}
class OpenPreviousEditor extends AbstractNavigateEditorAction {
    constructor() {
        super({
            id: "workbench.action.previousEditor",
            title: ( localize2(3356, "Open Previous Editor")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyCode.PageUp,
                mac: {
                    primary: KeyMod$1.CtrlCmd | KeyMod$1.Alt | KeyCode.LeftArrow,
                    secondary: [KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.BracketLeft]
                }
            },
            category: Categories.View
        });
    }
    navigate(editorGroupService) {
        const activeGroup = editorGroupService.activeGroup;
        const activeGroupEditors = activeGroup.getEditors(EditorsOrder.SEQUENTIAL);
        const activeEditorIndex = activeGroup.activeEditor ? activeGroupEditors.indexOf(activeGroup.activeEditor) : -1;
        if (activeEditorIndex > 0) {
            return {
                editor: activeGroupEditors[activeEditorIndex - 1],
                groupId: activeGroup.id
            };
        }
        const handledGroups = ( new Set());
        let currentGroup = editorGroupService.activeGroup;
        while (currentGroup && !( handledGroups.has(currentGroup.id))) {
            currentGroup = editorGroupService.findGroup({
                location: GroupLocation.PREVIOUS
            }, currentGroup, true);
            if (currentGroup) {
                handledGroups.add(currentGroup.id);
                const groupEditors = currentGroup.getEditors(EditorsOrder.SEQUENTIAL);
                if (groupEditors.length > 0) {
                    return {
                        editor: groupEditors[groupEditors.length - 1],
                        groupId: currentGroup.id
                    };
                }
            }
        }
        return undefined;
    }
}
class OpenNextEditorInGroup extends AbstractNavigateEditorAction {
    constructor() {
        super({
            id: "workbench.action.nextEditorInGroup",
            title: ( localize2(3357, "Open Next Editor in Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.PageDown),
                mac: {
                    primary: KeyChord(
                        KeyMod$1.CtrlCmd | KeyCode.KeyK,
                        KeyMod$1.CtrlCmd | KeyMod$1.Alt | KeyCode.RightArrow
                    )
                }
            },
            category: Categories.View
        });
    }
    navigate(editorGroupService) {
        const group = editorGroupService.activeGroup;
        const editors = group.getEditors(EditorsOrder.SEQUENTIAL);
        const index = group.activeEditor ? editors.indexOf(group.activeEditor) : -1;
        return {
            editor: index + 1 < editors.length ? editors[index + 1] : editors[0],
            groupId: group.id
        };
    }
}
class OpenPreviousEditorInGroup extends AbstractNavigateEditorAction {
    constructor() {
        super({
            id: "workbench.action.previousEditorInGroup",
            title: ( localize2(3358, "Open Previous Editor in Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.PageUp),
                mac: {
                    primary: KeyChord(
                        KeyMod$1.CtrlCmd | KeyCode.KeyK,
                        KeyMod$1.CtrlCmd | KeyMod$1.Alt | KeyCode.LeftArrow
                    )
                }
            },
            category: Categories.View
        });
    }
    navigate(editorGroupService) {
        const group = editorGroupService.activeGroup;
        const editors = group.getEditors(EditorsOrder.SEQUENTIAL);
        const index = group.activeEditor ? editors.indexOf(group.activeEditor) : -1;
        return {
            editor: index > 0 ? editors[index - 1] : editors[editors.length - 1],
            groupId: group.id
        };
    }
}
class OpenFirstEditorInGroup extends AbstractNavigateEditorAction {
    constructor() {
        super({
            id: "workbench.action.firstEditorInGroup",
            title: ( localize2(3359, "Open First Editor in Group")),
            f1: true,
            category: Categories.View
        });
    }
    navigate(editorGroupService) {
        const group = editorGroupService.activeGroup;
        const editors = group.getEditors(EditorsOrder.SEQUENTIAL);
        return {
            editor: editors[0],
            groupId: group.id
        };
    }
}
class OpenLastEditorInGroup extends AbstractNavigateEditorAction {
    constructor() {
        super({
            id: "workbench.action.lastEditorInGroup",
            title: ( localize2(3360, "Open Last Editor in Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.Alt | KeyCode.Digit0,
                secondary: [KeyMod$1.CtrlCmd | KeyCode.Digit9],
                mac: {
                    primary: KeyMod$1.WinCtrl | KeyCode.Digit0,
                    secondary: [KeyMod$1.CtrlCmd | KeyCode.Digit9]
                }
            },
            category: Categories.View
        });
    }
    navigate(editorGroupService) {
        const group = editorGroupService.activeGroup;
        const editors = group.getEditors(EditorsOrder.SEQUENTIAL);
        return {
            editor: editors[editors.length - 1],
            groupId: group.id
        };
    }
}
class NavigateForwardAction extends Action2 {
    static {
        this.ID = "workbench.action.navigateForward";
    }
    static {
        this.LABEL = ( localize(3361, "Go Forward"));
    }
    constructor() {
        super({
            id: NavigateForwardAction.ID,
            title: {
                ...( localize2(3361, "Go Forward")),
                mnemonicTitle: ( localize(3362, "&&Forward"))
            },
            f1: true,
            icon: Codicon.arrowRight,
            precondition: ( ContextKeyExpr.has("canNavigateForward")),
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                win: {
                    primary: KeyMod$1.Alt | KeyCode.RightArrow,
                    secondary: [KeyCode.BrowserForward]
                },
                mac: {
                    primary: KeyMod$1.WinCtrl | KeyMod$1.Shift | KeyCode.Minus,
                    secondary: [KeyCode.BrowserForward]
                },
                linux: {
                    primary: KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.Minus,
                    secondary: [KeyCode.BrowserForward]
                }
            },
            menu: [{
                id: MenuId.MenubarGoMenu,
                group: "1_history_nav",
                order: 2
            }, {
                id: MenuId.CommandCenter,
                order: 2,
                when: ( ContextKeyExpr.has("config.workbench.navigationControl.enabled"))
            }]
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goForward(GoFilter.NONE);
    }
}
class NavigateBackwardsAction extends Action2 {
    static {
        this.ID = "workbench.action.navigateBack";
    }
    static {
        this.LABEL = ( localize(3363, "Go Back"));
    }
    constructor() {
        super({
            id: NavigateBackwardsAction.ID,
            title: {
                ...( localize2(3363, "Go Back")),
                mnemonicTitle: ( localize(3364, "&&Back"))
            },
            f1: true,
            precondition: ( ContextKeyExpr.has("canNavigateBack")),
            icon: Codicon.arrowLeft,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                win: {
                    primary: KeyMod$1.Alt | KeyCode.LeftArrow,
                    secondary: [KeyCode.BrowserBack]
                },
                mac: {
                    primary: KeyMod$1.WinCtrl | KeyCode.Minus,
                    secondary: [KeyCode.BrowserBack]
                },
                linux: {
                    primary: KeyMod$1.CtrlCmd | KeyMod$1.Alt | KeyCode.Minus,
                    secondary: [KeyCode.BrowserBack]
                }
            },
            menu: [{
                id: MenuId.MenubarGoMenu,
                group: "1_history_nav",
                order: 1
            }, {
                id: MenuId.CommandCenter,
                order: 1,
                when: ( ContextKeyExpr.has("config.workbench.navigationControl.enabled"))
            }]
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goBack(GoFilter.NONE);
    }
}
class NavigatePreviousAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigateLast",
            title: ( localize2(3365, "Go Previous")),
            f1: true
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goPrevious(GoFilter.NONE);
    }
}
class NavigateForwardInEditsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigateForwardInEditLocations",
            title: ( localize2(3366, "Go Forward in Edit Locations")),
            f1: true
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goForward(GoFilter.EDITS);
    }
}
class NavigateBackwardsInEditsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigateBackInEditLocations",
            title: ( localize2(3367, "Go Back in Edit Locations")),
            f1: true
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goBack(GoFilter.EDITS);
    }
}
class NavigatePreviousInEditsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigatePreviousInEditLocations",
            title: ( localize2(3368, "Go Previous in Edit Locations")),
            f1: true
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goPrevious(GoFilter.EDITS);
    }
}
class NavigateToLastEditLocationAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigateToLastEditLocation",
            title: ( localize2(3369, "Go to Last Edit Location")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.KeyQ)
            }
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goLast(GoFilter.EDITS);
    }
}
class NavigateForwardInNavigationsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigateForwardInNavigationLocations",
            title: ( localize2(3370, "Go Forward in Navigation Locations")),
            f1: true
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goForward(GoFilter.NAVIGATION);
    }
}
class NavigateBackwardsInNavigationsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigateBackInNavigationLocations",
            title: ( localize2(3371, "Go Back in Navigation Locations")),
            f1: true
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goBack(GoFilter.NAVIGATION);
    }
}
class NavigatePreviousInNavigationsAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigatePreviousInNavigationLocations",
            title: ( localize2(3372, "Go Previous in Navigation Locations")),
            f1: true
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goPrevious(GoFilter.NAVIGATION);
    }
}
class NavigateToLastNavigationLocationAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.navigateToLastNavigationLocation",
            title: ( localize2(3373, "Go to Last Navigation Location")),
            f1: true
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.goLast(GoFilter.NAVIGATION);
    }
}
class ReopenClosedEditorAction extends Action2 {
    static {
        this.ID = "workbench.action.reopenClosedEditor";
    }
    constructor() {
        super({
            id: ReopenClosedEditorAction.ID,
            title: ( localize2(3374, "Reopen Closed Editor")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.KeyT
            },
            category: Categories.View
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        await historyService.reopenLastClosedEditor();
    }
}
class ClearRecentFilesAction extends Action2 {
    static {
        this.ID = "workbench.action.clearRecentFiles";
    }
    constructor() {
        super({
            id: ClearRecentFilesAction.ID,
            title: ( localize2(3375, "Clear Recently Opened...")),
            f1: true,
            category: Categories.File
        });
    }
    async run(accessor) {
        const dialogService = accessor.get(IDialogService);
        const workspacesService = accessor.get(IWorkspacesService);
        const historyService = accessor.get(IHistoryService);
        const {
            confirmed
        } = await dialogService.confirm({
            type: "warning",
            message: ( localize(3376, "Do you want to clear all recently opened files and workspaces?")),
            detail: ( localize(3377, "This action is irreversible!")),
            primaryButton: ( localize(3378, "&&Clear"))
        });
        if (!confirmed) {
            return;
        }
        workspacesService.clearRecentlyOpened();
        historyService.clearRecentlyOpened();
    }
}
class ShowEditorsInActiveGroupByMostRecentlyUsedAction extends Action2 {
    static {
        this.ID = "workbench.action.showEditorsInActiveGroup";
    }
    constructor() {
        super({
            id: ShowEditorsInActiveGroupByMostRecentlyUsedAction.ID,
            title: ( localize2(3379, "Show Editors in Active Group By Most Recently Used")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const quickInputService = accessor.get(IQuickInputService);
        quickInputService.quickAccess.show(ActiveGroupEditorsByMostRecentlyUsedQuickAccess.PREFIX);
    }
}
class ShowAllEditorsByAppearanceAction extends Action2 {
    static {
        this.ID = "workbench.action.showAllEditors";
    }
    constructor() {
        super({
            id: ShowAllEditorsByAppearanceAction.ID,
            title: ( localize2(3380, "Show All Editors By Appearance")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyMod$1.CtrlCmd | KeyCode.KeyP),
                mac: {
                    primary: KeyMod$1.CtrlCmd | KeyMod$1.Alt | KeyCode.Tab
                }
            },
            category: Categories.File
        });
    }
    async run(accessor) {
        const quickInputService = accessor.get(IQuickInputService);
        quickInputService.quickAccess.show(AllEditorsByAppearanceQuickAccess.PREFIX);
    }
}
class ShowAllEditorsByMostRecentlyUsedAction extends Action2 {
    static {
        this.ID = "workbench.action.showAllEditorsByMostRecentlyUsed";
    }
    constructor() {
        super({
            id: ShowAllEditorsByMostRecentlyUsedAction.ID,
            title: ( localize2(3381, "Show All Editors By Most Recently Used")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const quickInputService = accessor.get(IQuickInputService);
        quickInputService.quickAccess.show(AllEditorsByMostRecentlyUsedQuickAccess.PREFIX);
    }
}
class AbstractQuickAccessEditorAction extends Action2 {
    constructor(desc, prefix, itemActivation) {
        super(desc);
        this.prefix = prefix;
        this.itemActivation = itemActivation;
    }
    async run(accessor) {
        const keybindingService = accessor.get(IKeybindingService);
        const quickInputService = accessor.get(IQuickInputService);
        const keybindings = keybindingService.lookupKeybindings(this.desc.id);
        quickInputService.quickAccess.show(this.prefix, {
            quickNavigateConfiguration: {
                keybindings
            },
            itemActivation: this.itemActivation
        });
    }
}
class QuickAccessPreviousRecentlyUsedEditorAction extends AbstractQuickAccessEditorAction {
    constructor() {
        super({
            id: "workbench.action.quickOpenPreviousRecentlyUsedEditor",
            title: ( localize2(3382, "Quick Open Previous Recently Used Editor")),
            f1: true,
            category: Categories.View
        }, AllEditorsByMostRecentlyUsedQuickAccess.PREFIX, undefined);
    }
}
class QuickAccessLeastRecentlyUsedEditorAction extends AbstractQuickAccessEditorAction {
    constructor() {
        super({
            id: "workbench.action.quickOpenLeastRecentlyUsedEditor",
            title: ( localize2(3383, "Quick Open Least Recently Used Editor")),
            f1: true,
            category: Categories.View
        }, AllEditorsByMostRecentlyUsedQuickAccess.PREFIX, undefined);
    }
}
class QuickAccessPreviousRecentlyUsedEditorInGroupAction extends AbstractQuickAccessEditorAction {
    constructor() {
        super({
            id: "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
            title: ( localize2(3384, "Quick Open Previous Recently Used Editor in Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyCode.Tab,
                mac: {
                    primary: KeyMod$1.WinCtrl | KeyCode.Tab
                }
            },
            precondition: ( ActiveEditorGroupEmptyContext.toNegated()),
            category: Categories.View
        }, ActiveGroupEditorsByMostRecentlyUsedQuickAccess.PREFIX, undefined);
    }
}
class QuickAccessLeastRecentlyUsedEditorInGroupAction extends AbstractQuickAccessEditorAction {
    constructor() {
        super({
            id: "workbench.action.quickOpenLeastRecentlyUsedEditorInGroup",
            title: ( localize2(3385, "Quick Open Least Recently Used Editor in Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.Tab,
                mac: {
                    primary: KeyMod$1.WinCtrl | KeyMod$1.Shift | KeyCode.Tab
                }
            },
            precondition: ( ActiveEditorGroupEmptyContext.toNegated()),
            category: Categories.View
        }, ActiveGroupEditorsByMostRecentlyUsedQuickAccess.PREFIX, ItemActivation.LAST);
    }
}
class QuickAccessPreviousEditorFromHistoryAction extends Action2 {
    static {
        this.ID = "workbench.action.openPreviousEditorFromHistory";
    }
    constructor() {
        super({
            id: QuickAccessPreviousEditorFromHistoryAction.ID,
            title: ( localize2(3386, "Quick Open Previous Editor from History")),
            f1: true
        });
    }
    async run(accessor) {
        const keybindingService = accessor.get(IKeybindingService);
        const quickInputService = accessor.get(IQuickInputService);
        const editorGroupService = accessor.get(IEditorGroupsService);
        const keybindings = keybindingService.lookupKeybindings(QuickAccessPreviousEditorFromHistoryAction.ID);
        let itemActivation = undefined;
        if (editorGroupService.activeGroup.count === 0) {
            itemActivation = ItemActivation.FIRST;
        }
        quickInputService.quickAccess.show("", {
            quickNavigateConfiguration: {
                keybindings
            },
            itemActivation
        });
    }
}
class OpenNextRecentlyUsedEditorAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.openNextRecentlyUsedEditor",
            title: ( localize2(3387, "Open Next Recently Used Editor")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        historyService.openNextRecentlyUsedEditor();
    }
}
class OpenPreviousRecentlyUsedEditorAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.openPreviousRecentlyUsedEditor",
            title: ( localize2(3388, "Open Previous Recently Used Editor")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        historyService.openPreviouslyUsedEditor();
    }
}
class OpenNextRecentlyUsedEditorInGroupAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.openNextRecentlyUsedEditorInGroup",
            title: ( localize2(3389, "Open Next Recently Used Editor In Group")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        const editorGroupsService = accessor.get(IEditorGroupsService);
        historyService.openNextRecentlyUsedEditor(editorGroupsService.activeGroup.id);
    }
}
class OpenPreviousRecentlyUsedEditorInGroupAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.openPreviousRecentlyUsedEditorInGroup",
            title: ( localize2(3390, "Open Previous Recently Used Editor In Group")),
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        const editorGroupsService = accessor.get(IEditorGroupsService);
        historyService.openPreviouslyUsedEditor(editorGroupsService.activeGroup.id);
    }
}
class ClearEditorHistoryWithoutConfirmAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.clearEditorHistoryWithoutConfirm",
            title: ( localize2(3391, "Clear Editor History without Confirmation")),
            f1: true,
            precondition: InAutomationContext
        });
    }
    async run(accessor) {
        const historyService = accessor.get(IHistoryService);
        historyService.clear();
    }
}
class ClearEditorHistoryAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.clearEditorHistory",
            title: ( localize2(3392, "Clear Editor History")),
            f1: true
        });
    }
    async run(accessor) {
        const dialogService = accessor.get(IDialogService);
        const historyService = accessor.get(IHistoryService);
        const {
            confirmed
        } = await dialogService.confirm({
            type: "warning",
            message: ( localize(3393, "Do you want to clear the history of recently opened editors?")),
            detail: ( localize(3377, "This action is irreversible!")),
            primaryButton: ( localize(3378, "&&Clear"))
        });
        if (!confirmed) {
            return;
        }
        historyService.clear();
    }
}
class MoveEditorLeftInGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.moveEditorLeftInGroup",
            title: ( localize2(3394, "Move Editor Left")),
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.PageUp,
                mac: {
                    primary: KeyChord(
                        KeyMod$1.CtrlCmd | KeyCode.KeyK,
                        KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.LeftArrow
                    )
                }
            },
            f1: true,
            category: Categories.View
        }, MOVE_ACTIVE_EDITOR_COMMAND_ID, {
            to: "left"
        });
    }
}
class MoveEditorRightInGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.moveEditorRightInGroup",
            title: ( localize2(3395, "Move Editor Right")),
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.PageDown,
                mac: {
                    primary: KeyChord(
                        KeyMod$1.CtrlCmd | KeyCode.KeyK,
                        KeyMod$1.CtrlCmd | KeyMod$1.Shift | KeyCode.RightArrow
                    )
                }
            },
            f1: true,
            category: Categories.View
        }, MOVE_ACTIVE_EDITOR_COMMAND_ID, {
            to: "right"
        });
    }
}
class MoveEditorToStartAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.moveEditorToStart",
            title: ( localize2(3396, "Move Editor to Start")),
            f1: true,
            category: Categories.View
        }, MOVE_ACTIVE_EDITOR_COMMAND_ID, {
            to: "first"
        });
    }
}
class MoveEditorToEndAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.moveEditorToEnd",
            title: ( localize2(3397, "Move Editor to End")),
            f1: true,
            category: Categories.View
        }, MOVE_ACTIVE_EDITOR_COMMAND_ID, {
            to: "last"
        });
    }
}
class MoveEditorToPreviousGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.moveEditorToPreviousGroup",
            title: ( localize2(3398, "Move Editor into Previous Group")),
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyMod$1.Alt | KeyCode.LeftArrow,
                mac: {
                    primary: KeyMod$1.CtrlCmd | KeyMod$1.WinCtrl | KeyCode.LeftArrow
                }
            },
            f1: true,
            category: Categories.View
        }, MOVE_ACTIVE_EDITOR_COMMAND_ID, {
            to: "previous",
            by: "group"
        });
    }
}
class MoveEditorToNextGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.moveEditorToNextGroup",
            title: ( localize2(3399, "Move Editor into Next Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyMod$1.Alt | KeyCode.RightArrow,
                mac: {
                    primary: KeyMod$1.CtrlCmd | KeyMod$1.WinCtrl | KeyCode.RightArrow
                }
            },
            category: Categories.View
        }, MOVE_ACTIVE_EDITOR_COMMAND_ID, {
            to: "next",
            by: "group"
        });
    }
}
class MoveEditorToAboveGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: MOVE_EDITOR_INTO_ABOVE_GROUP,
            title: ( localize2(3400, "Move Editor into Group Above")),
            f1: true,
            category: Categories.View
        }, MOVE_EDITOR_INTO_ABOVE_GROUP);
    }
}
class MoveEditorToBelowGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: MOVE_EDITOR_INTO_BELOW_GROUP,
            title: ( localize2(3401, "Move Editor into Group Below")),
            f1: true,
            category: Categories.View
        }, MOVE_EDITOR_INTO_BELOW_GROUP);
    }
}
class MoveEditorToLeftGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: MOVE_EDITOR_INTO_LEFT_GROUP,
            title: ( localize2(3402, "Move Editor into Left Group")),
            f1: true,
            category: Categories.View
        }, MOVE_EDITOR_INTO_LEFT_GROUP);
    }
}
class MoveEditorToRightGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: MOVE_EDITOR_INTO_RIGHT_GROUP,
            title: ( localize2(3403, "Move Editor into Right Group")),
            f1: true,
            category: Categories.View
        }, MOVE_EDITOR_INTO_RIGHT_GROUP);
    }
}
class MoveEditorToFirstGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.moveEditorToFirstGroup",
            title: ( localize2(3404, "Move Editor into First Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.Shift | KeyMod$1.Alt | KeyCode.Digit1,
                mac: {
                    primary: KeyMod$1.CtrlCmd | KeyMod$1.WinCtrl | KeyCode.Digit1
                }
            },
            category: Categories.View
        }, MOVE_ACTIVE_EDITOR_COMMAND_ID, {
            to: "first",
            by: "group"
        });
    }
}
class MoveEditorToLastGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.moveEditorToLastGroup",
            title: ( localize2(3405, "Move Editor into Last Group")),
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.Shift | KeyMod$1.Alt | KeyCode.Digit9,
                mac: {
                    primary: KeyMod$1.CtrlCmd | KeyMod$1.WinCtrl | KeyCode.Digit9
                }
            },
            category: Categories.View
        }, MOVE_ACTIVE_EDITOR_COMMAND_ID, {
            to: "last",
            by: "group"
        });
    }
}
class SplitEditorToPreviousGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.splitEditorToPreviousGroup",
            title: ( localize2(3406, "Split Editor into Previous Group")),
            f1: true,
            category: Categories.View
        }, COPY_ACTIVE_EDITOR_COMMAND_ID, {
            to: "previous",
            by: "group"
        });
    }
}
class SplitEditorToNextGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.splitEditorToNextGroup",
            title: ( localize2(3407, "Split Editor into Next Group")),
            f1: true,
            category: Categories.View
        }, COPY_ACTIVE_EDITOR_COMMAND_ID, {
            to: "next",
            by: "group"
        });
    }
}
class SplitEditorToAboveGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.splitEditorToAboveGroup",
            title: ( localize2(3408, "Split Editor into Group Above")),
            f1: true,
            category: Categories.View
        }, COPY_ACTIVE_EDITOR_COMMAND_ID, {
            to: "up",
            by: "group"
        });
    }
}
class SplitEditorToBelowGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.splitEditorToBelowGroup",
            title: ( localize2(3409, "Split Editor into Group Below")),
            f1: true,
            category: Categories.View
        }, COPY_ACTIVE_EDITOR_COMMAND_ID, {
            to: "down",
            by: "group"
        });
    }
}
class SplitEditorToLeftGroupAction extends ExecuteCommandAction {
    static {
        this.ID = "workbench.action.splitEditorToLeftGroup";
    }
    static {
        this.LABEL = ( localize(3410, "Split Editor into Left Group"));
    }
    constructor() {
        super({
            id: "workbench.action.splitEditorToLeftGroup",
            title: ( localize2(3410, "Split Editor into Left Group")),
            f1: true,
            category: Categories.View
        }, COPY_ACTIVE_EDITOR_COMMAND_ID, {
            to: "left",
            by: "group"
        });
    }
}
class SplitEditorToRightGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.splitEditorToRightGroup",
            title: ( localize2(3411, "Split Editor into Right Group")),
            f1: true,
            category: Categories.View
        }, COPY_ACTIVE_EDITOR_COMMAND_ID, {
            to: "right",
            by: "group"
        });
    }
}
class SplitEditorToFirstGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.splitEditorToFirstGroup",
            title: ( localize2(3412, "Split Editor into First Group")),
            f1: true,
            category: Categories.View
        }, COPY_ACTIVE_EDITOR_COMMAND_ID, {
            to: "first",
            by: "group"
        });
    }
}
class SplitEditorToLastGroupAction extends ExecuteCommandAction {
    constructor() {
        super({
            id: "workbench.action.splitEditorToLastGroup",
            title: ( localize2(3413, "Split Editor into Last Group")),
            f1: true,
            category: Categories.View
        }, COPY_ACTIVE_EDITOR_COMMAND_ID, {
            to: "last",
            by: "group"
        });
    }
}
class EditorLayoutSingleAction extends ExecuteCommandAction {
    static {
        this.ID = "workbench.action.editorLayoutSingle";
    }
    constructor() {
        super({
            id: EditorLayoutSingleAction.ID,
            title: ( localize2(3414, "Single Column Editor Layout")),
            f1: true,
            category: Categories.View
        }, LAYOUT_EDITOR_GROUPS_COMMAND_ID, {
            groups: [{}],
            orientation: GroupOrientation.HORIZONTAL
        });
    }
}
class EditorLayoutTwoColumnsAction extends ExecuteCommandAction {
    static {
        this.ID = "workbench.action.editorLayoutTwoColumns";
    }
    constructor() {
        super({
            id: EditorLayoutTwoColumnsAction.ID,
            title: ( localize2(3415, "Two Columns Editor Layout")),
            f1: true,
            category: Categories.View
        }, LAYOUT_EDITOR_GROUPS_COMMAND_ID, {
            groups: [{}, {}],
            orientation: GroupOrientation.HORIZONTAL
        });
    }
}
class EditorLayoutThreeColumnsAction extends ExecuteCommandAction {
    static {
        this.ID = "workbench.action.editorLayoutThreeColumns";
    }
    constructor() {
        super({
            id: EditorLayoutThreeColumnsAction.ID,
            title: ( localize2(3416, "Three Columns Editor Layout")),
            f1: true,
            category: Categories.View
        }, LAYOUT_EDITOR_GROUPS_COMMAND_ID, {
            groups: [{}, {}, {}],
            orientation: GroupOrientation.HORIZONTAL
        });
    }
}
class EditorLayoutTwoRowsAction extends ExecuteCommandAction {
    static {
        this.ID = "workbench.action.editorLayoutTwoRows";
    }
    constructor() {
        super({
            id: EditorLayoutTwoRowsAction.ID,
            title: ( localize2(3417, "Two Rows Editor Layout")),
            f1: true,
            category: Categories.View
        }, LAYOUT_EDITOR_GROUPS_COMMAND_ID, {
            groups: [{}, {}],
            orientation: GroupOrientation.VERTICAL
        });
    }
}
class EditorLayoutThreeRowsAction extends ExecuteCommandAction {
    static {
        this.ID = "workbench.action.editorLayoutThreeRows";
    }
    constructor() {
        super({
            id: EditorLayoutThreeRowsAction.ID,
            title: ( localize2(3418, "Three Rows Editor Layout")),
            f1: true,
            category: Categories.View
        }, LAYOUT_EDITOR_GROUPS_COMMAND_ID, {
            groups: [{}, {}, {}],
            orientation: GroupOrientation.VERTICAL
        });
    }
}
class EditorLayoutTwoByTwoGridAction extends ExecuteCommandAction {
    static {
        this.ID = "workbench.action.editorLayoutTwoByTwoGrid";
    }
    constructor() {
        super({
            id: EditorLayoutTwoByTwoGridAction.ID,
            title: ( localize2(3419, "Grid Editor Layout (2x2)")),
            f1: true,
            category: Categories.View
        }, LAYOUT_EDITOR_GROUPS_COMMAND_ID, {
            groups: [{
                groups: [{}, {}]
            }, {
                groups: [{}, {}]
            }],
            orientation: GroupOrientation.HORIZONTAL
        });
    }
}
class EditorLayoutTwoColumnsBottomAction extends ExecuteCommandAction {
    static {
        this.ID = "workbench.action.editorLayoutTwoColumnsBottom";
    }
    constructor() {
        super({
            id: EditorLayoutTwoColumnsBottomAction.ID,
            title: ( localize2(3420, "Two Columns Bottom Editor Layout")),
            f1: true,
            category: Categories.View
        }, LAYOUT_EDITOR_GROUPS_COMMAND_ID, {
            groups: [{}, {
                groups: [{}, {}]
            }],
            orientation: GroupOrientation.VERTICAL
        });
    }
}
class EditorLayoutTwoRowsRightAction extends ExecuteCommandAction {
    static {
        this.ID = "workbench.action.editorLayoutTwoRowsRight";
    }
    constructor() {
        super({
            id: EditorLayoutTwoRowsRightAction.ID,
            title: ( localize2(3421, "Two Rows Right Editor Layout")),
            f1: true,
            category: Categories.View
        }, LAYOUT_EDITOR_GROUPS_COMMAND_ID, {
            groups: [{}, {
                groups: [{}, {}]
            }],
            orientation: GroupOrientation.HORIZONTAL
        });
    }
}
class AbstractCreateEditorGroupAction extends Action2 {
    constructor(desc, direction) {
        super(desc);
        this.direction = direction;
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        const layoutService = accessor.get(IWorkbenchLayoutService);
        const activeDocument = getActiveDocument();
        const focusNewGroup = layoutService.hasFocus(Parts.EDITOR_PART) || activeDocument.activeElement === activeDocument.body;
        const group = editorGroupService.addGroup(editorGroupService.activeGroup, this.direction);
        editorGroupService.activateGroup(group);
        if (focusNewGroup) {
            group.focus();
        }
    }
}
class NewEditorGroupLeftAction extends AbstractCreateEditorGroupAction {
    constructor() {
        super({
            id: "workbench.action.newGroupLeft",
            title: ( localize2(3422, "New Editor Group to the Left")),
            f1: true,
            category: Categories.View
        }, GroupDirection.LEFT);
    }
}
class NewEditorGroupRightAction extends AbstractCreateEditorGroupAction {
    constructor() {
        super({
            id: "workbench.action.newGroupRight",
            title: ( localize2(3423, "New Editor Group to the Right")),
            f1: true,
            category: Categories.View
        }, GroupDirection.RIGHT);
    }
}
class NewEditorGroupAboveAction extends AbstractCreateEditorGroupAction {
    constructor() {
        super({
            id: "workbench.action.newGroupAbove",
            title: ( localize2(3424, "New Editor Group Above")),
            f1: true,
            category: Categories.View
        }, GroupDirection.UP);
    }
}
class NewEditorGroupBelowAction extends AbstractCreateEditorGroupAction {
    constructor() {
        super({
            id: "workbench.action.newGroupBelow",
            title: ( localize2(3425, "New Editor Group Below")),
            f1: true,
            category: Categories.View
        }, GroupDirection.DOWN);
    }
}
class ToggleEditorTypeAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.toggleEditorType",
            title: ( localize2(3426, "Toggle Editor Type")),
            f1: true,
            category: Categories.View,
            precondition: ActiveEditorAvailableEditorIdsContext
        });
    }
    async run(accessor) {
        const editorService = accessor.get(IEditorService);
        const editorResolverService = accessor.get(IEditorResolverService);
        const activeEditorPane = editorService.activeEditorPane;
        if (!activeEditorPane) {
            return;
        }
        const activeEditorResource = EditorResourceAccessor.getCanonicalUri(activeEditorPane.input);
        if (!activeEditorResource) {
            return;
        }
        const editorIds = ( editorResolverService.getEditors(activeEditorResource).map(editor => editor.id)).filter(id => id !== activeEditorPane.input.editorId);
        if (editorIds.length === 0) {
            return;
        }
        await editorService.replaceEditors([{
            editor: activeEditorPane.input,
            replacement: {
                resource: activeEditorResource,
                options: {
                    override: editorIds[0]
                }
            }
        }], activeEditorPane.group);
    }
}
class ReOpenInTextEditorAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.reopenTextEditor",
            title: ( localize2(3427, "Reopen Editor with Text Editor")),
            f1: true,
            category: Categories.View,
            precondition: ActiveEditorAvailableEditorIdsContext
        });
    }
    async run(accessor) {
        const editorService = accessor.get(IEditorService);
        const activeEditorPane = editorService.activeEditorPane;
        if (!activeEditorPane) {
            return;
        }
        const activeEditorResource = EditorResourceAccessor.getCanonicalUri(activeEditorPane.input);
        if (!activeEditorResource) {
            return;
        }
        await editorService.replaceEditors([{
            editor: activeEditorPane.input,
            replacement: {
                resource: activeEditorResource,
                options: {
                    override: DEFAULT_EDITOR_ASSOCIATION.id
                }
            }
        }], activeEditorPane.group);
    }
}
class BaseMoveCopyEditorToNewWindowAction extends Action2 {
    constructor(id, title, keybinding, move) {
        super({
            id,
            title,
            category: Categories.View,
            precondition: ActiveEditorContext,
            keybinding,
            f1: true
        });
        this.move = move;
    }
    async run(accessor, ...args) {
        const editorGroupsService = accessor.get(IEditorGroupsService);
        const editorService = accessor.get(IEditorService);
        const listService = accessor.get(IListService);
        const resolvedContext = resolveCommandsContext(args, editorService, editorGroupsService, listService);
        if (!resolvedContext.groupedEditors.length) {
            return;
        }
        const auxiliaryEditorPart = await editorGroupsService.createAuxiliaryEditorPart();
        const {
            group,
            editors
        } = resolvedContext.groupedEditors[0];
        const editorsWithOptions = prepareMoveCopyEditors(group, editors, resolvedContext.preserveFocus);
        if (this.move) {
            group.moveEditors(editorsWithOptions, auxiliaryEditorPart.activeGroup);
        } else {
            group.copyEditors(editorsWithOptions, auxiliaryEditorPart.activeGroup);
        }
        auxiliaryEditorPart.activeGroup.focus();
    }
}
class MoveEditorToNewWindowAction extends BaseMoveCopyEditorToNewWindowAction {
    constructor() {
        super(MOVE_EDITOR_INTO_NEW_WINDOW_COMMAND_ID, {
            ...( localize2(3428, "Move Editor into New Window")),
            mnemonicTitle: ( localize(3429, "&&Move Editor into New Window"))
        }, undefined, true);
    }
}
class CopyEditorToNewindowAction extends BaseMoveCopyEditorToNewWindowAction {
    constructor() {
        super(COPY_EDITOR_INTO_NEW_WINDOW_COMMAND_ID, {
            ...( localize2(3430, "Copy Editor into New Window")),
            mnemonicTitle: ( localize(3431, "&&Copy Editor into New Window"))
        }, {
            primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyCode.KeyO),
            weight: KeybindingWeight.WorkbenchContrib
        }, false);
    }
}
class BaseMoveCopyEditorGroupToNewWindowAction extends Action2 {
    constructor(id, title, move) {
        super({
            id,
            title,
            category: Categories.View,
            f1: true
        });
        this.move = move;
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        const activeGroup = editorGroupService.activeGroup;
        const auxiliaryEditorPart = await editorGroupService.createAuxiliaryEditorPart();
        editorGroupService.mergeGroup(activeGroup, auxiliaryEditorPart.activeGroup, {
            mode: this.move ? MergeGroupMode.MOVE_EDITORS : MergeGroupMode.COPY_EDITORS
        });
        auxiliaryEditorPart.activeGroup.focus();
    }
}
class MoveEditorGroupToNewWindowAction extends BaseMoveCopyEditorGroupToNewWindowAction {
    constructor() {
        super(MOVE_EDITOR_GROUP_INTO_NEW_WINDOW_COMMAND_ID, {
            ...( localize2(3432, "Move Editor Group into New Window")),
            mnemonicTitle: ( localize(3433, "&&Move Editor Group into New Window"))
        }, true);
    }
}
class CopyEditorGroupToNewWindowAction extends BaseMoveCopyEditorGroupToNewWindowAction {
    constructor() {
        super(COPY_EDITOR_GROUP_INTO_NEW_WINDOW_COMMAND_ID, {
            ...( localize2(3434, "Copy Editor Group into New Window")),
            mnemonicTitle: ( localize(3435, "&&Copy Editor Group into New Window"))
        }, false);
    }
}
class RestoreEditorsToMainWindowAction extends Action2 {
    constructor() {
        super({
            id: "workbench.action.restoreEditorsToMainWindow",
            title: {
                ...( localize2(3436, "Restore Editors into Main Window")),
                mnemonicTitle: ( localize(3437, "&&Restore Editors into Main Window"))
            },
            f1: true,
            precondition: IsAuxiliaryWindowFocusedContext,
            category: Categories.View
        });
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        editorGroupService.mergeAllGroups(editorGroupService.mainPart.activeGroup);
    }
}
class NewEmptyEditorWindowAction extends Action2 {
    constructor() {
        super({
            id: NEW_EMPTY_EDITOR_WINDOW_COMMAND_ID,
            title: {
                ...( localize2(3438, "New Empty Editor Window")),
                mnemonicTitle: ( localize(3439, "&&New Empty Editor Window"))
            },
            f1: true,
            category: Categories.View
        });
    }
    async run(accessor) {
        const editorGroupService = accessor.get(IEditorGroupsService);
        const auxiliaryEditorPart = await editorGroupService.createAuxiliaryEditorPart();
        auxiliaryEditorPart.activeGroup.focus();
    }
}

export { ClearEditorHistoryAction, ClearEditorHistoryWithoutConfirmAction, ClearRecentFilesAction, CloseAllEditorGroupsAction, CloseAllEditorsAction, CloseEditorAction, CloseEditorInAllGroupsAction, CloseEditorTabAction, CloseEditorsInOtherGroupsAction, CloseLeftEditorsInGroupAction, CopyEditorGroupToNewWindowAction, CopyEditorToNewindowAction, DuplicateGroupDownAction, DuplicateGroupLeftAction, DuplicateGroupRightAction, DuplicateGroupUpAction, EditorLayoutSingleAction, EditorLayoutThreeColumnsAction, EditorLayoutThreeRowsAction, EditorLayoutTwoByTwoGridAction, EditorLayoutTwoColumnsAction, EditorLayoutTwoColumnsBottomAction, EditorLayoutTwoRowsAction, EditorLayoutTwoRowsRightAction, FocusAboveGroup, FocusActiveGroupAction, FocusBelowGroup, FocusFirstGroupAction, FocusLastGroupAction, FocusLeftGroup, FocusNextGroup, FocusPreviousGroup, FocusRightGroup, JoinAllGroupsAction, JoinTwoGroupsAction, MaximizeGroupHideSidebarAction, MinimizeOtherGroupsAction, MinimizeOtherGroupsHideSidebarAction, MoveEditorGroupToNewWindowAction, MoveEditorLeftInGroupAction, MoveEditorRightInGroupAction, MoveEditorToAboveGroupAction, MoveEditorToBelowGroupAction, MoveEditorToEndAction, MoveEditorToFirstGroupAction, MoveEditorToLastGroupAction, MoveEditorToLeftGroupAction, MoveEditorToNewWindowAction, MoveEditorToNextGroupAction, MoveEditorToPreviousGroupAction, MoveEditorToRightGroupAction, MoveEditorToStartAction, MoveGroupDownAction, MoveGroupLeftAction, MoveGroupRightAction, MoveGroupUpAction, NavigateBackwardsAction, NavigateBackwardsInEditsAction, NavigateBackwardsInNavigationsAction, NavigateBetweenGroupsAction, NavigateForwardAction, NavigateForwardInEditsAction, NavigateForwardInNavigationsAction, NavigatePreviousAction, NavigatePreviousInEditsAction, NavigatePreviousInNavigationsAction, NavigateToLastEditLocationAction, NavigateToLastNavigationLocationAction, NewEditorGroupAboveAction, NewEditorGroupBelowAction, NewEditorGroupLeftAction, NewEditorGroupRightAction, NewEmptyEditorWindowAction, OpenFirstEditorInGroup, OpenLastEditorInGroup, OpenNextEditor, OpenNextEditorInGroup, OpenNextRecentlyUsedEditorAction, OpenNextRecentlyUsedEditorInGroupAction, OpenPreviousEditor, OpenPreviousEditorInGroup, OpenPreviousRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorInGroupAction, QuickAccessLeastRecentlyUsedEditorAction, QuickAccessLeastRecentlyUsedEditorInGroupAction, QuickAccessPreviousEditorFromHistoryAction, QuickAccessPreviousRecentlyUsedEditorAction, QuickAccessPreviousRecentlyUsedEditorInGroupAction, ReOpenInTextEditorAction, ReopenClosedEditorAction, ResetGroupSizesAction, RestoreEditorsToMainWindowAction, RevertAndCloseEditorAction, ShowAllEditorsByAppearanceAction, ShowAllEditorsByMostRecentlyUsedAction, ShowEditorsInActiveGroupByMostRecentlyUsedAction, SplitEditorAction, SplitEditorDownAction, SplitEditorLeftAction, SplitEditorOrthogonalAction, SplitEditorRightAction, SplitEditorToAboveGroupAction, SplitEditorToBelowGroupAction, SplitEditorToFirstGroupAction, SplitEditorToLastGroupAction, SplitEditorToLeftGroupAction, SplitEditorToNextGroupAction, SplitEditorToPreviousGroupAction, SplitEditorToRightGroupAction, SplitEditorUpAction, ToggleEditorTypeAction, ToggleGroupSizesAction, ToggleMaximizeEditorGroupAction, UnpinEditorAction };
