
import { Disposable } from '../../../../base/common/lifecycle.js';
import { localize } from '../../../../nls.js';
import { AccessibleViewType, AccessibleViewProviderId } from '../../../../platform/accessibility/browser/accessibleView.js';
import { KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED } from './webview.js';
import { AccessibilityVerbositySettingId } from '../../accessibility/browser/accessibilityConfiguration.js';

class WebviewFindAccessibilityHelp {
    constructor() {
        this.priority = 105;
        this.name = "webview-find";
        this.type = AccessibleViewType.Help;
        this.when = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED;
    }
    getProvider(accessor) {
        return ( new WebviewFindAccessibilityHelpProvider());
    }
}
class WebviewFindAccessibilityHelpProvider extends Disposable {
    constructor() {
        super(...arguments);
        this.id = AccessibleViewProviderId.WebviewFindHelp;
        this.verbositySettingKey = AccessibilityVerbositySettingId.Find;
        this.options = {
            type: AccessibleViewType.Help
        };
    }
    onClose() {}
    provideContent() {
        const content = [];
        content.push(( localize(15987, "Accessibility Help: Webview Find")));
        content.push(( localize(
            15988,
            "You are in the Find input for embedded web content. This could be a Markdown preview, a documentation viewer, or a web-based extension interface."
        )));
        content.push("");
        content.push(( localize(15989, "Current Search Status:")));
        content.push(( localize(15990, "You are searching the web content.")));
        content.push("");
        content.push(( localize(15991, "Inside the Webview Find Input (What It Does):")));
        content.push(( localize(
            15992,
            "While you are in the Find input, your focus stays in the field. You can type, edit your search term, or navigate matches without leaving the input. When you navigate to a match, the webview updates to show it, but your focus remains in the Find input."
        )));
        content.push("");
        content.push(( localize(15993, "What You Hear Each Time You Move to a Match:")));
        content.push(( localize(15994, "Each navigation step gives you a complete spoken update:")));
        content.push(( localize(
            15995,
            "1) The content containing the match is read first, so you get immediate context."
        )));
        content.push(( localize(
            15996,
            "2) Your position among the matches is announced, so you know how far you are through the results."
        )));
        content.push(( localize(
            15997,
            "3) The exact location information is announced so you know where the match is."
        )));
        content.push("");
        content.push(( localize(15998, "Focus Behavior (Important):")));
        content.push(( localize(
            15999,
            "When you navigate from the Webview Find input, the content updates in the background while your focus stays in the input. This is intentional, so you can keep refining your search without losing your place."
        )));
        content.push(( localize(
            16000,
            "The webview may scroll to show the match, depending on how it is designed."
        )));
        content.push(( localize(
            16001,
            "If you want to close Find and return focus to the webview content, press Escape. Focus moves back into the webview."
        )));
        content.push("");
        content.push(( localize(16002, "Keyboard Navigation Summary:")));
        content.push("");
        content.push(( localize(16003, "While focused IN the Find input:")));
        content.push(( localize(16004, "- Enter: Move to the next match while staying in the Find input.")));
        content.push(( localize(
            16005,
            "- Shift+Enter: Move to the previous match while staying in the Find input."
        )));
        content.push("");
        content.push(( localize(16006, "Find Options:")));
        content.push(( localize(16007, "- Match Case: Only exact case matches are included.")));
        content.push(( localize(16008, "- Whole Word: Only full words are matched.")));
        content.push(( localize(16009, "- Regular Expression: Use pattern matching for advanced searches.")));
        content.push("");
        content.push(( localize(16010, "Important About Webviews:")));
        content.push(( localize(
            16011,
            "Some webviews intercept keyboard input before VS Code's Find can use it. If Enter or Shift+Enter do not navigate matches, the webview may be handling those keys. Try clicking or tabbing into the webview content first to ensure the webview has focus, then reopen Find and try navigation again."
        )));
        content.push("");
        content.push(( localize(
            16012,
            "Settings You Can Adjust ({0} opens Settings):",
            "<keybinding:workbench.action.openSettings>"
        )));
        content.push(( localize(
            16013,
            "Webview Find has minimal configuration. Most behavior depends on the webview itself."
        )));
        content.push(( localize(
            16014,
            "- `accessibility.verbosity.find`: Controls whether the Webview Find input announces the Accessibility Help hint."
        )));
        content.push("");
        content.push(( localize(16015, "Closing:")));
        content.push(( localize(
            16016,
            "Press Escape to close Webview Find. Focus moves back into the webview content, and your search history is available on next Find."
        )));
        return content.join("\n");
    }
}

export { WebviewFindAccessibilityHelp };
