
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(8932, "A speech provider is registered to the speech service.")) }));
const SpeechToTextInProgress = ( new RawContextKey(
    'speechToTextInProgress',
    false,
    { type: 'boolean', description: ( localize(8933, "A speech-to-text session is in progress.")) }
));
const TextToSpeechInProgress = ( new RawContextKey(
    'textToSpeechInProgress',
    false,
    { type: 'boolean', description: ( localize(8934, "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 || (AccessibilityVoiceSettingId = {}));
const SPEECH_LANGUAGE_CONFIG = AccessibilityVoiceSettingId.SpeechLanguage;
const SPEECH_LANGUAGES = {
    ['da-DK']: {
        name: ( localize(8935, "Danish (Denmark)"))
    },
    ['de-DE']: {
        name: ( localize(8936, "German (Germany)"))
    },
    ['en-AU']: {
        name: ( localize(8937, "English (Australia)"))
    },
    ['en-CA']: {
        name: ( localize(8938, "English (Canada)"))
    },
    ['en-GB']: {
        name: ( localize(8939, "English (United Kingdom)"))
    },
    ['en-IE']: {
        name: ( localize(8940, "English (Ireland)"))
    },
    ['en-IN']: {
        name: ( localize(8941, "English (India)"))
    },
    ['en-NZ']: {
        name: ( localize(8942, "English (New Zealand)"))
    },
    ['en-US']: {
        name: ( localize(8943, "English (United States)"))
    },
    ['es-ES']: {
        name: ( localize(8944, "Spanish (Spain)"))
    },
    ['es-MX']: {
        name: ( localize(8945, "Spanish (Mexico)"))
    },
    ['fr-CA']: {
        name: ( localize(8946, "French (Canada)"))
    },
    ['fr-FR']: {
        name: ( localize(8947, "French (France)"))
    },
    ['hi-IN']: {
        name: ( localize(8948, "Hindi (India)"))
    },
    ['it-IT']: {
        name: ( localize(8949, "Italian (Italy)"))
    },
    ['ja-JP']: {
        name: ( localize(8950, "Japanese (Japan)"))
    },
    ['ko-KR']: {
        name: ( localize(8951, "Korean (South Korea)"))
    },
    ['nl-NL']: {
        name: ( localize(8952, "Dutch (Netherlands)"))
    },
    ['pt-PT']: {
        name: ( localize(8953, "Portuguese (Portugal)"))
    },
    ['pt-BR']: {
        name: ( localize(8954, "Portuguese (Brazil)"))
    },
    ['ru-RU']: {
        name: ( localize(8955, "Russian (Russia)"))
    },
    ['sv-SE']: {
        name: ( localize(8956, "Swedish (Sweden)"))
    },
    ['tr-TR']: {
        name: ( localize(8957, "Turkish (Türkiye)"))
    },
    ['zh-CN']: {
        name: ( localize(8958, "Chinese (Simplified, China)"))
    },
    ['zh-HK']: {
        name: ( localize(8959, "Chinese (Traditional, Hong Kong)"))
    },
    ['zh-TW']: {
        name: ( localize(8960, "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 };
