
import { localize } from '../../../../../nls.js';
import { RawContextKey, ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js';
import { IsWebContext } from '../../../../../platform/contextkey/common/contextkeys.js';
import { RemoteNameContext } from '../../../../common/contextkeys.js';
import { ChatEntitlementContextKeys } from '../../../../services/chat/common/chatEntitlementService.js';
import { ChatAccountPolicyGateActiveContext } from '../../../../services/policies/common/accountPolicyService.js';
import { ChatModeKind, ChatPermissionLevel } from '../constants.js';

var ChatContextKeys;
(function(ChatContextKeys) {
    ChatContextKeys.responseVote = ( new RawContextKey("chatSessionResponseVote", "", {
        type: "string",
        description: ( localize(
            7828,
            "When the response has been voted up, is set to 'up'. When voted down, is set to 'down'. Otherwise an empty string."
        ))
    }));
    ChatContextKeys.responseDetectedAgentCommand = ( new RawContextKey("chatSessionResponseDetectedAgentOrCommand", false, {
        type: "boolean",
        description: ( localize(7829, "When the agent or command was automatically detected"))
    }));
    ChatContextKeys.responseSupportsIssueReporting = ( new RawContextKey("chatResponseSupportsIssueReporting", false, {
        type: "boolean",
        description: ( localize(7830, "True when the current chat response supports issue reporting."))
    }));
    ChatContextKeys.responseIsFiltered = ( new RawContextKey("chatSessionResponseFiltered", false, {
        type: "boolean",
        description: ( localize(7831, "True when the chat response was filtered out by the server."))
    }));
    ChatContextKeys.responseHasError = ( new RawContextKey("chatSessionResponseError", false, {
        type: "boolean",
        description: ( localize(7832, "True when the chat response resulted in an error."))
    }));
    ChatContextKeys.requestInProgress = ( new RawContextKey("chatSessionRequestInProgress", false, {
        type: "boolean",
        description: ( localize(7833, "True when the current request is still in progress."))
    }));
    ChatContextKeys.hasActiveRequest = ( new RawContextKey("chatSessionHasActiveRequest", false, {
        type: "boolean",
        description: ( localize(
            7834,
            "True when the current chat response has not completed, regardless of intermediate states like tool calls or elicitations."
        ))
    }));
    ChatContextKeys.currentlyEditing = ( new RawContextKey("chatSessionCurrentlyEditing", false, {
        type: "boolean",
        description: ( localize(7835, "True when the current request is being edited."))
    }));
    ChatContextKeys.currentlyEditingInput = ( new RawContextKey("chatSessionCurrentlyEditingInput", false, {
        type: "boolean",
        description: ( localize(7836, "True when the current request input at the bottom is being edited."))
    }));
    (function(EditingRequestType) {
        EditingRequestType["Sent"] = "s";
        EditingRequestType["Queue"] = "q";
        EditingRequestType["Steer"] = "st";
    })(
        ChatContextKeys.EditingRequestType || (ChatContextKeys.EditingRequestType = {})
    );
    ChatContextKeys.editingRequestType = ( new RawContextKey("chatEditingSentRequest", undefined, {
        type: "string",
        description: ( localize(7837, "The type of the current editing request."))
    }));
    ChatContextKeys.isResponse = ( new RawContextKey("chatResponse", false, {
        type: "boolean",
        description: ( localize(7838, "The chat item is a response."))
    }));
    ChatContextKeys.isRequest = ( new RawContextKey("chatRequest", false, {
        type: "boolean",
        description: ( localize(7839, "The chat item is a request"))
    }));
    ChatContextKeys.isFirstRequest = ( new RawContextKey("chatFirstRequest", false, {
        type: "boolean",
        description: ( localize(7840, "The chat item is the first request in the session."))
    }));
    ChatContextKeys.isPendingRequest = ( new RawContextKey("chatRequestIsPending", false, {
        type: "boolean",
        description: ( localize(7841, "True when the chat request item is pending in the queue."))
    }));
    ChatContextKeys.itemId = ( new RawContextKey("chatItemId", "", {
        type: "string",
        description: ( localize(7842, "The id of the chat item."))
    }));
    ChatContextKeys.lastItemId = ( new RawContextKey("chatLastItemId", [], {
        type: "string",
        description: ( localize(7843, "The id of the last chat item."))
    }));
    ChatContextKeys.editApplied = ( new RawContextKey("chatEditApplied", false, {
        type: "boolean",
        description: ( localize(7844, "True when the chat text edits have been applied."))
    }));
    ChatContextKeys.inputHasText = ( new RawContextKey("chatInputHasText", false, {
        type: "boolean",
        description: ( localize(7845, "True when the chat input has text."))
    }));
    ChatContextKeys.inputHasSendableContent = ( new RawContextKey("chatInputHasSendableContent", false, {
        type: "boolean",
        description: ( localize(
            7846,
            "True when the chat input has text or file attachments that can be sent."
        ))
    }));
    ChatContextKeys.inputHasFocus = ( new RawContextKey("chatInputHasFocus", false, {
        type: "boolean",
        description: ( localize(7847, "True when the chat input has focus."))
    }));
    ChatContextKeys.inChatInput = ( new RawContextKey("inChatInput", false, {
        type: "boolean",
        description: ( localize(7848, "True when focus is in the chat input, false otherwise."))
    }));
    ChatContextKeys.inChatSession = ( new RawContextKey("inChat", false, {
        type: "boolean",
        description: ( localize(7849, "True when focus is in the chat widget, false otherwise."))
    }));
    ChatContextKeys.inChatQuestionCarousel = ( new RawContextKey("inChatQuestionCarousel", false, {
        type: "boolean",
        description: ( localize(7850, "True when focus is in the chat question carousel."))
    }));
    ChatContextKeys.chatQuestionCarouselHasTerminal = ( new RawContextKey("chatQuestionCarouselHasTerminal", false, {
        type: "boolean",
        description: ( localize(
            7851,
            "True when the chat question carousel was triggered by a terminal and has a terminal to focus."
        ))
    }));
    ChatContextKeys.inChatEditor = ( new RawContextKey("inChatEditor", false, {
        type: "boolean",
        description: ( localize(7852, "Whether focus is in a chat editor."))
    }));
    ChatContextKeys.inChatTodoList = ( new RawContextKey("inChatTodoList", false, {
        type: "boolean",
        description: ( localize(7853, "True when focus is in the chat todo list."))
    }));
    ChatContextKeys.inChatTip = ( new RawContextKey("inChatTip", false, {
        type: "boolean",
        description: ( localize(7854, "True when focus is in a chat tip."))
    }));
    ChatContextKeys.multipleChatTips = ( new RawContextKey("multipleChatTips", false, {
        type: "boolean",
        description: ( localize(7855, "True when there are multiple chat tips available."))
    }));
    ChatContextKeys.inChatTerminalToolOutput = ( new RawContextKey("inChatTerminalToolOutput", false, {
        type: "boolean",
        description: ( localize(7856, "True when focus is in the chat terminal output region."))
    }));
    ChatContextKeys.chatModeKind = ( new RawContextKey("chatAgentKind", ChatModeKind.Ask, {
        type: "string",
        description: ( localize(7857, "The 'kind' of the current agent."))
    }));
    ChatContextKeys.chatPermissionLevel = ( new RawContextKey("chatPermissionLevel", ChatPermissionLevel.Default, {
        type: "string",
        description: ( localize(7858, "The current permission level for tool auto-approval."))
    }));
    ChatContextKeys.chatModeName = ( new RawContextKey("chatModeName", "", {
        type: "string",
        description: ( localize(7859, "The name of the current chat mode (e.g. 'Plan' for custom modes)."))
    }));
    ChatContextKeys.chatModelId = ( new RawContextKey("chatModelId", "", {
        type: "string",
        description: ( localize(
            7860,
            "The short id of the currently selected chat model (for example 'gpt-4.1')."
        ))
    }));
    ChatContextKeys.supported = ( ContextKeyExpr.or(( IsWebContext.negate()), ( RemoteNameContext.notEqualsTo("")), ( ContextKeyExpr.has("config.chat.experimental.serverlessWebEnabled"))));
    ChatContextKeys.enabled = ( new RawContextKey("chatIsEnabled", false, {
        type: "boolean",
        description: ( localize(
            7861,
            "True when chat is enabled because a default chat participant is activated with an implementation."
        ))
    }));
    ChatContextKeys.accountPolicyGateActive = ChatAccountPolicyGateActiveContext;
    ChatContextKeys.lockedToCodingAgent = ( new RawContextKey("lockedToCodingAgent", false, {
        type: "boolean",
        description: ( localize(7862, "True when the chat widget is locked to the coding agent session."))
    }));
    ChatContextKeys.lockedCodingAgentId = ( new RawContextKey("lockedCodingAgentId", "", {
        type: "string",
        description: ( localize(
            7863,
            "The agent ID when the chat widget is locked to a coding agent session."
        ))
    }));
    ChatContextKeys.chatSessionHasCustomAgentTarget = ( new RawContextKey("chatSessionHasCustomAgentTarget", false, {
        type: "boolean",
        description: ( localize(
            7864,
            "True when the chat session has a customAgentTarget defined to filter modes."
        ))
    }));
    ChatContextKeys.chatSessionHasTargetedModels = ( new RawContextKey("chatSessionHasTargetedModels", false, {
        type: "boolean",
        description: ( localize(
            7865,
            "True when the chat session has language models that target it via targetChatSessionType."
        ))
    }));
    ChatContextKeys.agentSupportsAttachments = ( new RawContextKey("agentSupportsAttachments", false, {
        type: "boolean",
        description: ( localize(7866, "True when the chat agent supports attachments."))
    }));
    ChatContextKeys.withinEditSessionDiff = ( new RawContextKey("withinEditSessionDiff", false, {
        type: "boolean",
        description: ( localize(7867, "True when the chat widget dispatches to the edit session chat."))
    }));
    ChatContextKeys.filePartOfEditSession = ( new RawContextKey("filePartOfEditSession", false, {
        type: "boolean",
        description: ( localize(7868, "True when the chat widget is within a file with an edit session."))
    }));
    ChatContextKeys.extensionParticipantRegistered = ( new RawContextKey("chatPanelExtensionParticipantRegistered", false, {
        type: "boolean",
        description: ( localize(
            7869,
            "True when a default chat participant is registered for the panel from an extension."
        ))
    }));
    ChatContextKeys.panelParticipantRegistered = ( new RawContextKey("chatPanelParticipantRegistered", false, {
        type: "boolean",
        description: ( localize(7870, "True when a default chat participant is registered for the panel."))
    }));
    ChatContextKeys.chatEditingCanUndo = ( new RawContextKey("chatEditingCanUndo", false, {
        type: "boolean",
        description: ( localize(
            7871,
            "True when it is possible to undo an interaction in the editing panel."
        ))
    }));
    ChatContextKeys.chatEditingCanRedo = ( new RawContextKey("chatEditingCanRedo", false, {
        type: "boolean",
        description: ( localize(
            7872,
            "True when it is possible to redo an interaction in the editing panel."
        ))
    }));
    ChatContextKeys.languageModelsAreUserSelectable = ( new RawContextKey("chatModelsAreUserSelectable", false, {
        type: "boolean",
        description: ( localize(7873, "True when the chat model can be selected manually by the user."))
    }));
    ChatContextKeys.nonCopilotLanguageModelsAreUserSelectable = ( new RawContextKey("chatNonCopilotModelsAreUserSelectable", false, {
        type: "boolean",
        description: ( localize(
            7874,
            "True when a user-selectable chat model from a non-Copilot vendor is available."
        ))
    }));
    ChatContextKeys.chatSessionHasModels = ( new RawContextKey("chatSessionHasModels", false, {
        type: "boolean",
        description: ( localize(
            7875,
            "True when the chat is in a contributed chat session that has available 'models' to display."
        ))
    }));
    ChatContextKeys.chatSessionOptionsValid = ( new RawContextKey("chatSessionOptionsValid", true, {
        type: "boolean",
        description: ( localize(
            7876,
            "True when all selected session options exist in their respective option group items."
        ))
    }));
    ChatContextKeys.extensionInvalid = ( new RawContextKey("chatExtensionInvalid", false, {
        type: "boolean",
        description: ( localize(
            7877,
            "True when the installed chat extension is invalid and needs to be updated."
        ))
    }));
    ChatContextKeys.inputCursorAtTop = ( new RawContextKey("chatCursorAtTop", false));
    ChatContextKeys.inputHasAgent = ( new RawContextKey("chatInputHasAgent", false));
    ChatContextKeys.location = ( new RawContextKey("chatLocation", undefined));
    ChatContextKeys.inQuickChat = ( new RawContextKey("quickChatHasFocus", false, {
        type: "boolean",
        description: ( localize(7878, "True when the quick chat UI has focus, false otherwise."))
    }));
    ChatContextKeys.inAgentSessionsWelcome = ( new RawContextKey("inAgentSessionsWelcome", false, {
        type: "boolean",
        description: ( localize(
            7879,
            "True when the chat input is within the agent sessions welcome page."
        ))
    }));
    ChatContextKeys.chatSessionType = ( new RawContextKey("chatSessionType", "", {
        type: "string",
        description: ( localize(7880, "The type of the current chat session."))
    }));
    ChatContextKeys.hasFileAttachments = ( new RawContextKey("chatHasFileAttachments", false, {
        type: "boolean",
        description: ( localize(7881, "True when the chat has file attachments."))
    }));
    ChatContextKeys.chatSessionIsEmpty = ( new RawContextKey("chatSessionIsEmpty", true, {
        type: "boolean",
        description: ( localize(7882, "True when the current chat session has no requests."))
    }));
    ChatContextKeys.hasPendingRequests = ( new RawContextKey("chatHasPendingRequests", false, {
        type: "boolean",
        description: ( localize(7883, "True when there are pending requests in the queue."))
    }));
    ChatContextKeys.chatSessionHasDebugData = ( new RawContextKey("chatSessionHasDebugData", false, {
        type: "boolean",
        description: ( localize(7884, "True when the current chat session has debug log data."))
    }));
    ChatContextKeys.chatSessionHasDebugTools = ( new RawContextKey("chatSessionHasDebugTools", false, {
        type: "boolean",
        description: ( localize(7885, "True when debug tools are enabled in the current chat session."))
    }));
    ChatContextKeys.remoteJobCreating = ( new RawContextKey("chatRemoteJobCreating", false, {
        type: "boolean",
        description: ( localize(7886, "True when a remote coding agent job is being created."))
    }));
    ChatContextKeys.hasRemoteCodingAgent = ( new RawContextKey("hasRemoteCodingAgent", false, ( localize(7887, "Whether any remote coding agent is available"))));
    ChatContextKeys.hasCanDelegateProviders = ( new RawContextKey("chatHasCanDelegateProviders", false, {
        type: "boolean",
        description: ( localize(
            7888,
            "True when there are chat session providers with delegation support available."
        ))
    }));
    ChatContextKeys.enableRemoteCodingAgentPromptFileOverlay = ( new RawContextKey("enableRemoteCodingAgentPromptFileOverlay", false, ( localize(
        7889,
        "Whether the remote coding agent prompt file overlay feature is enabled"
    ))));
    ChatContextKeys.skipChatRequestInProgressMessage = ( new RawContextKey("chatSkipRequestInProgressMessage", false, {
        type: "boolean",
        description: ( localize(7890, "True when the chat request in progress message should be skipped."))
    }));
    ChatContextKeys.Setup = ChatEntitlementContextKeys.Setup;
    ChatContextKeys.Entitlement = ChatEntitlementContextKeys.Entitlement;
    ChatContextKeys.chatQuotaExceeded = ChatEntitlementContextKeys.chatQuotaExceeded;
    ChatContextKeys.completionsQuotaExceeded = ChatEntitlementContextKeys.completionsQuotaExceeded;
    ChatContextKeys.Editing = {
        hasToolConfirmation: ( new RawContextKey("chatHasToolConfirmation", false, {
            type: "boolean",
            description: ( localize(7891, "True when a tool confirmation is present."))
        })),
        hasElicitationRequest: ( new RawContextKey("chatHasElicitationRequest", false, {
            type: "boolean",
            description: ( localize(7892, "True when a chat elicitation request is pending."))
        })),
        hasQuestionCarousel: ( new RawContextKey("chatHasQuestionCarousel", false, {
            type: "boolean",
            description: ( localize(7893, "True when a question carousel is rendered in the chat input."))
        }))
    };
    ChatContextKeys.Tools = {
        toolsCount: ( new RawContextKey("toolsCount", 0, {
            type: "number",
            description: ( localize(7894, "The count of tools available in the chat."))
        }))
    };
    ChatContextKeys.foregroundSessionCount = ( new RawContextKey("chatForegroundSessionCount", 0, {
        type: "number",
        description: ( localize(
            7895,
            "The number of foreground chat sessions visible across chat surfaces."
        ))
    }));
    ChatContextKeys.Modes = {
        hasCustomChatModes: ( new RawContextKey("chatHasCustomAgents", false, {
            type: "boolean",
            description: ( localize(7896, "True when the chat has custom agents available."))
        })),
        agentModeDisabledByPolicy: ( new RawContextKey("chatAgentModeDisabledByPolicy", false, {
            type: "boolean",
            description: ( localize(7897, "True when agent mode is disabled by organization policy."))
        }))
    };
    ChatContextKeys.panelLocation = ( new RawContextKey("chatPanelLocation", undefined, {
        type: "number",
        description: ( localize(7898, "The location of the chat panel."))
    }));
    ChatContextKeys.agentSessionsViewerFocused = ( new RawContextKey("agentSessionsViewerFocused", true, {
        type: "boolean",
        description: ( localize(7899, "If the agent sessions view in the chat view is focused."))
    }));
    ChatContextKeys.agentSessionsViewerOrientation = ( new RawContextKey("agentSessionsViewerOrientation", undefined, {
        type: "number",
        description: ( localize(7900, "Orientation of the agent sessions view in the chat view."))
    }));
    ChatContextKeys.agentSessionsViewerPosition = ( new RawContextKey("agentSessionsViewerPosition", undefined, {
        type: "number",
        description: ( localize(7901, "Position of the agent sessions view in the chat view."))
    }));
    ChatContextKeys.agentSessionsViewerVisible = ( new RawContextKey("agentSessionsViewerVisible", undefined, {
        type: "boolean",
        description: ( localize(7902, "Visibility of the agent sessions view in the chat view."))
    }));
    ChatContextKeys.agentSessionType = ( new RawContextKey("chatSessionType", "", {
        type: "string",
        description: ( localize(7903, "The type of the current agent session item."))
    }));
    ChatContextKeys.chatSessionSupportsDelegation = ( new RawContextKey("chatSessionSupportsDelegation", true, {
        type: "boolean",
        description: ( localize(7904, "True when the current session type supports delegation."))
    }));
    ChatContextKeys.chatSessionSupportsFork = ( new RawContextKey("chatSessionSupportsFork", false, {
        type: "boolean",
        description: ( localize(
            7905,
            "True when the current chat session provider supports forking conversations."
        ))
    }));
    ChatContextKeys.agentSessionSection = ( new RawContextKey("agentSessionSection", "", {
        type: "string",
        description: ( localize(7906, "The section of the current agent session section item."))
    }));
    ChatContextKeys.isArchivedAgentSession = ( new RawContextKey("agentSessionIsArchived", false, {
        type: "boolean",
        description: ( localize(7907, "True when the agent session item is archived."))
    }));
    ChatContextKeys.isPinnedAgentSession = ( new RawContextKey("agentSessionIsPinned", false, {
        type: "boolean",
        description: ( localize(7908, "True when the agent session item is pinned."))
    }));
    ChatContextKeys.isReadAgentSession = ( new RawContextKey("agentSessionIsRead", false, {
        type: "boolean",
        description: ( localize(7909, "True when the agent session item is read."))
    }));
    ChatContextKeys.hasMultipleAgentSessionsSelected = ( new RawContextKey("agentSessionHasMultipleSelected", false, {
        type: "boolean",
        description: ( localize(7910, "True when multiple agent sessions are selected."))
    }));
    ChatContextKeys.hasAgentSessionChanges = ( new RawContextKey("agentSessionHasChanges", false, {
        type: "boolean",
        description: ( localize(7911, "True when the current agent session item has changes."))
    }));
    ChatContextKeys.isKatexMathElement = ( new RawContextKey("chatIsKatexMathElement", false, {
        type: "boolean",
        description: ( localize(7912, "True when focusing a KaTeX math element."))
    }));
    ChatContextKeys.hasUsedCreateSlashCommands = ( new RawContextKey("chatHasUsedCreateSlashCommands", false, {
        type: "boolean",
        description: ( localize(7913, "True when the user has used any of the /create-* slash commands."))
    }));
    ChatContextKeys.contextUsageHasBeenOpened = ( new RawContextKey("chatContextUsageHasBeenOpened", false, {
        type: "boolean",
        description: ( localize(7914, "True when the user has opened the context window usage details."))
    }));
    ChatContextKeys.newChatButtonExperimentIcon = ( new RawContextKey("chatNewChatButtonExperimentIcon", "", {
        type: "string",
        description: ( localize(
            7915,
            "The icon variant for the new chat button, controlled by experiment. Values: 'copilot', 'new-session', 'comment', or empty for default."
        ))
    }));
})(ChatContextKeys || (ChatContextKeys = {}));
var ChatContextKeyExprs;
(function(ChatContextKeyExprs) {
    ChatContextKeyExprs.inEditingMode = ( ContextKeyExpr.or(( ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Edit)), ( ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent))));
    ChatContextKeyExprs.isAgentHostSession = ( ContextKeyExpr.or(( ContextKeyExpr.regex(ChatContextKeys.lockedCodingAgentId.key, /^agent-host-/)), ( ContextKeyExpr.regex(ChatContextKeys.lockedCodingAgentId.key, /^remote-/))));
    ChatContextKeyExprs.isAgentHostSessionItem = ( ContextKeyExpr.or(( ContextKeyExpr.regex(ChatContextKeys.agentSessionType.key, /^agent-host-/)), ( ContextKeyExpr.regex(ChatContextKeys.agentSessionType.key, /^remote-/))));
})(ChatContextKeyExprs || (ChatContextKeyExprs = {}));

export { ChatContextKeyExprs, ChatContextKeys };
