
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
import { ctxCommentEditorFocused } from './simpleCommentEditor.js';
import { CommentContextKeys } from '../common/commentContextKeys.js';
import { localize } from '../../../../nls.js';
import { AccessibilityVerbositySettingId } from '../../accessibility/browser/accessibilityConfiguration.js';
import { CommentCommandId } from '../common/commentCommandIds.js';
import { ToggleTabFocusModeAction } from '../../../../editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js';
import { AccessibleViewProviderId, AccessibleViewType } from '../../../../platform/accessibility/browser/accessibleView.js';
import { Disposable } from '../../../../base/common/lifecycle.js';

var CommentAccessibilityHelpNLS;
(function(CommentAccessibilityHelpNLS) {
    CommentAccessibilityHelpNLS.intro = ( localize(
        8634,
        "The editor contains commentable range(s). Some useful commands include:"
    ));
    CommentAccessibilityHelpNLS.tabFocus = ( localize(
        8635,
        "This widget contains a text area, for composition of new comments, and actions, that can be tabbed to once tab moves focus mode has been enabled with the command Toggle Tab Key Moves Focus{0}.",
        `<keybinding:${ToggleTabFocusModeAction.ID}>`
    ));
    CommentAccessibilityHelpNLS.commentCommands = ( localize(8636, "Some useful comment commands include:"));
    CommentAccessibilityHelpNLS.escape = ( localize(8637, "- Dismiss Comment{0}.", `<keybinding:${CommentCommandId.Hide}>`));
    CommentAccessibilityHelpNLS.nextRange = ( localize(
        8638,
        "- Go to Next Commenting Range{0}.",
        `<keybinding:${CommentCommandId.NextRange}>`
    ));
    CommentAccessibilityHelpNLS.previousRange = ( localize(
        8639,
        "- Go to Previous Commenting Range{0}.",
        `<keybinding:${CommentCommandId.PreviousRange}>`
    ));
    CommentAccessibilityHelpNLS.nextCommentThread = ( localize(
        8640,
        "- Go to Next Comment Thread{0}.",
        `<keybinding:${CommentCommandId.NextThread}>`
    ));
    CommentAccessibilityHelpNLS.previousCommentThread = ( localize(
        8641,
        "- Go to Previous Comment Thread{0}.",
        `<keybinding:${CommentCommandId.PreviousThread}>`
    ));
    CommentAccessibilityHelpNLS.nextCommentedRange = ( localize(
        8642,
        "- Go to Next Commented Range{0}.",
        `<keybinding:${CommentCommandId.NextCommentedRange}>`
    ));
    CommentAccessibilityHelpNLS.previousCommentedRange = ( localize(
        8643,
        "- Go to Previous Commented Range{0}.",
        `<keybinding:${CommentCommandId.PreviousCommentedRange}>`
    ));
    CommentAccessibilityHelpNLS.addComment = ( localize(
        8644,
        "- Add Comment on Current Selection{0}.",
        `<keybinding:${CommentCommandId.Add}>`
    ));
    CommentAccessibilityHelpNLS.submitComment = ( localize(8645, "- Submit Comment{0}.", `<keybinding:${CommentCommandId.Submit}>`));
})(CommentAccessibilityHelpNLS || (CommentAccessibilityHelpNLS = {}));
class CommentsAccessibilityHelpProvider extends Disposable {
    constructor() {
        super(...arguments);
        this.id = AccessibleViewProviderId.Comments;
        this.verbositySettingKey = AccessibilityVerbositySettingId.Comments;
        this.options = {
            type: AccessibleViewType.Help
        };
    }
    provideContent() {
        return [
            CommentAccessibilityHelpNLS.tabFocus,
            CommentAccessibilityHelpNLS.commentCommands,
            CommentAccessibilityHelpNLS.escape,
            CommentAccessibilityHelpNLS.addComment,
            CommentAccessibilityHelpNLS.submitComment,
            CommentAccessibilityHelpNLS.nextRange,
            CommentAccessibilityHelpNLS.previousRange
        ].join("\n");
    }
    onClose() {
        this._element?.focus();
    }
}
class CommentsAccessibilityHelp {
    constructor() {
        this.priority = 110;
        this.name = "comments";
        this.type = AccessibleViewType.Help;
        this.when = ( ContextKeyExpr.or(ctxCommentEditorFocused, CommentContextKeys.commentFocused));
    }
    getProvider(accessor) {
        return accessor.get(IInstantiationService).createInstance(CommentsAccessibilityHelpProvider);
    }
}

export { CommentAccessibilityHelpNLS, CommentsAccessibilityHelp, CommentsAccessibilityHelpProvider };
