import { ICodeEditorService } from '../../../../editor/browser/services/codeEditorService.js';
import { AccessibleDiffViewerPrev, AccessibleDiffViewerNext } from '../../../../editor/browser/widget/diffEditor/commands.js';
import { DiffEditorWidget } from '../../../../editor/browser/widget/diffEditor/diffEditorWidget.js';
import { localizeWithPath } from '../../../../nls.js';
import { AccessibleViewType, AccessibleViewProviderId } from '../../../../platform/accessibility/browser/accessibleView.js';
import { ContextKeyEqualsExpr } from '../../../../platform/contextkey/common/contextkey.js';
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.service.js';
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.service.js';
import { AccessibilityVerbositySettingId } from '../../accessibility/browser/accessibilityConfiguration.js';
import { getCommentCommandInfo } from '../../accessibility/browser/editorAccessibilityHelp.js';
import { IEditorService } from '../../../services/editor/common/editorService.service.js';
const _moduleId = "vs/workbench/contrib/codeEditor/browser/diffEditorAccessibilityHelp";
class DiffEditorAccessibilityHelp {
    constructor() {
        this.priority = 105;
        this.name = 'diff-editor';
        this.when = ContextKeyEqualsExpr.create('isInDiffEditor', true);
        this.type = AccessibleViewType.Help;
    }
    getProvider(accessor) {
        const editorService = accessor.get(IEditorService);
        const codeEditorService = accessor.get(ICodeEditorService);
        const keybindingService = accessor.get(IKeybindingService);
        const contextKeyService = accessor.get(IContextKeyService);
        if (!(editorService.activeTextEditorControl instanceof DiffEditorWidget)) {
            return;
        }
        const codeEditor = codeEditorService.getActiveCodeEditor() || codeEditorService.getFocusedCodeEditor();
        if (!codeEditor) {
            return;
        }
        const switchSides = ( localizeWithPath(
            _moduleId,
            0,
            "Run the command Diff Editor: Switch Side<keybinding:diffEditor.switchSide> to toggle between the original and modified editors."
        ));
        const diffEditorActiveAnnouncement = ( localizeWithPath(
            _moduleId,
            1,
            "The setting, accessibility.verbosity.diffEditorActive, controls if a diff editor announcement is made when it becomes the active editor."
        ));
        const keys = ['accessibility.signals.diffLineDeleted', 'accessibility.signals.diffLineInserted', 'accessibility.signals.diffLineModified'];
        const content = [
            ( localizeWithPath(_moduleId, 2, "You are in a diff editor.")),
            ( localizeWithPath(
                _moduleId,
                3,
                "View the next<keybinding:{0}> or previous<keybinding:{1}> diff in diff review mode, which is optimized for screen readers.",
                AccessibleDiffViewerNext.id,
                AccessibleDiffViewerPrev.id
            )),
            switchSides,
            diffEditorActiveAnnouncement,
            ( localizeWithPath(
                _moduleId,
                4,
                "To control which accessibility signals should be played, the following settings can be configured: {0}.",
                keys.join(', ')
            )),
        ];
        const commentCommandInfo = getCommentCommandInfo(keybindingService, contextKeyService, codeEditor);
        if (commentCommandInfo) {
            content.push(commentCommandInfo);
        }
        return {
            id: AccessibleViewProviderId.DiffEditor,
            verbositySettingKey: AccessibilityVerbositySettingId.DiffEditor,
            provideContent: () => content.join('\n\n'),
            onClose: () => {
                codeEditor.focus();
            },
            options: { type: AccessibleViewType.Help }
        };
    }
    dispose() { }
}
export { DiffEditorAccessibilityHelp };
