
import { localize } from '../../../../nls.js';
import { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
import { language } from '../../../../base/common/platform.js';

const HasSpeechProvider = ( new RawContextKey('hasSpeechProvider', false, { type: 'boolean', description: ( localize(9523, "A speech provider is registered to the speech service.")) }));
const SpeechToTextInProgress = ( new RawContextKey(
    'speechToTextInProgress',
    false,
    { type: 'boolean', description: ( localize(9524, "A speech-to-text session is in progress.")) }
));
const TextToSpeechInProgress = ( new RawContextKey(
    'textToSpeechInProgress',
    false,
    { type: 'boolean', description: ( localize(9525, "A text-to-speech session is in progress.")) }
));
var SpeechToTextStatus;
(function (SpeechToTextStatus) {
    SpeechToTextStatus[SpeechToTextStatus["Started"] = 1] = "Started";
    SpeechToTextStatus[SpeechToTextStatus["Recognizing"] = 2] = "Recognizing";
    SpeechToTextStatus[SpeechToTextStatus["Recognized"] = 3] = "Recognized";
    SpeechToTextStatus[SpeechToTextStatus["Stopped"] = 4] = "Stopped";
    SpeechToTextStatus[SpeechToTextStatus["Error"] = 5] = "Error";
})(SpeechToTextStatus || (SpeechToTextStatus = {}));
var TextToSpeechStatus;
(function (TextToSpeechStatus) {
    TextToSpeechStatus[TextToSpeechStatus["Started"] = 1] = "Started";
    TextToSpeechStatus[TextToSpeechStatus["Stopped"] = 2] = "Stopped";
    TextToSpeechStatus[TextToSpeechStatus["Error"] = 3] = "Error";
})(TextToSpeechStatus || (TextToSpeechStatus = {}));
var KeywordRecognitionStatus;
(function (KeywordRecognitionStatus) {
    KeywordRecognitionStatus[KeywordRecognitionStatus["Recognized"] = 1] = "Recognized";
    KeywordRecognitionStatus[KeywordRecognitionStatus["Stopped"] = 2] = "Stopped";
    KeywordRecognitionStatus[KeywordRecognitionStatus["Canceled"] = 3] = "Canceled";
})(KeywordRecognitionStatus || (KeywordRecognitionStatus = {}));
var AccessibilityVoiceSettingId;
(function (AccessibilityVoiceSettingId) {
    AccessibilityVoiceSettingId["SpeechTimeout"] = "accessibility.voice.speechTimeout";
    AccessibilityVoiceSettingId["AutoSynthesize"] = "accessibility.voice.autoSynthesize";
    AccessibilityVoiceSettingId["SpeechLanguage"] = "accessibility.voice.speechLanguage";
    AccessibilityVoiceSettingId["IgnoreCodeBlocks"] = "accessibility.voice.ignoreCodeBlocks";
})(AccessibilityVoiceSettingId || (AccessibilityVoiceSettingId = {}));
const SPEECH_LANGUAGE_CONFIG = AccessibilityVoiceSettingId.SpeechLanguage;
const SPEECH_LANGUAGES = {
    ['da-DK']: {
        name: ( localize(9526, "Danish (Denmark)"))
    },
    ['de-DE']: {
        name: ( localize(9527, "German (Germany)"))
    },
    ['en-AU']: {
        name: ( localize(9528, "English (Australia)"))
    },
    ['en-CA']: {
        name: ( localize(9529, "English (Canada)"))
    },
    ['en-GB']: {
        name: ( localize(9530, "English (United Kingdom)"))
    },
    ['en-IE']: {
        name: ( localize(9531, "English (Ireland)"))
    },
    ['en-IN']: {
        name: ( localize(9532, "English (India)"))
    },
    ['en-NZ']: {
        name: ( localize(9533, "English (New Zealand)"))
    },
    ['en-US']: {
        name: ( localize(9534, "English (United States)"))
    },
    ['es-ES']: {
        name: ( localize(9535, "Spanish (Spain)"))
    },
    ['es-MX']: {
        name: ( localize(9536, "Spanish (Mexico)"))
    },
    ['fr-CA']: {
        name: ( localize(9537, "French (Canada)"))
    },
    ['fr-FR']: {
        name: ( localize(9538, "French (France)"))
    },
    ['hi-IN']: {
        name: ( localize(9539, "Hindi (India)"))
    },
    ['it-IT']: {
        name: ( localize(9540, "Italian (Italy)"))
    },
    ['ja-JP']: {
        name: ( localize(9541, "Japanese (Japan)"))
    },
    ['ko-KR']: {
        name: ( localize(9542, "Korean (South Korea)"))
    },
    ['nl-NL']: {
        name: ( localize(9543, "Dutch (Netherlands)"))
    },
    ['pt-PT']: {
        name: ( localize(9544, "Portuguese (Portugal)"))
    },
    ['pt-BR']: {
        name: ( localize(9545, "Portuguese (Brazil)"))
    },
    ['ru-RU']: {
        name: ( localize(9546, "Russian (Russia)"))
    },
    ['sv-SE']: {
        name: ( localize(9547, "Swedish (Sweden)"))
    },
    ['tr-TR']: {
        name: ( localize(9548, "Turkish (Türkiye)"))
    },
    ['zh-CN']: {
        name: ( localize(9549, "Chinese (Simplified, China)"))
    },
    ['zh-HK']: {
        name: ( localize(9550, "Chinese (Traditional, Hong Kong)"))
    },
    ['zh-TW']: {
        name: ( localize(9551, "Chinese (Traditional, Taiwan)"))
    }
};
function speechLanguageConfigToLanguage(config, lang = language) {
    if (typeof config === 'string') {
        if (config === 'auto') {
            if (lang !== 'en') {
                const langParts = lang.split('-');
                return speechLanguageConfigToLanguage(`${langParts[0]}-${(langParts[1] ?? langParts[0]).toUpperCase()}`);
            }
        }
        else {
            if (SPEECH_LANGUAGES[config]) {
                return config;
            }
        }
    }
    return 'en-US';
}

export { AccessibilityVoiceSettingId, HasSpeechProvider, KeywordRecognitionStatus, SPEECH_LANGUAGES, SPEECH_LANGUAGE_CONFIG, SpeechToTextInProgress, SpeechToTextStatus, TextToSpeechInProgress, TextToSpeechStatus, speechLanguageConfigToLanguage };
